diff --git a/iot-common/iot-common-dao/iot-common-model/src/main/java/cc/iotkit/model/system/SysLogininfor.java b/iot-common/iot-common-dao/iot-common-model/src/main/java/cc/iotkit/model/system/SysLoginInfo.java similarity index 89% rename from iot-common/iot-common-dao/iot-common-model/src/main/java/cc/iotkit/model/system/SysLogininfor.java rename to iot-common/iot-common-dao/iot-common-model/src/main/java/cc/iotkit/model/system/SysLoginInfo.java index 21806ece..52d756c0 100644 --- a/iot-common/iot-common-dao/iot-common-model/src/main/java/cc/iotkit/model/system/SysLogininfor.java +++ b/iot-common/iot-common-dao/iot-common-model/src/main/java/cc/iotkit/model/system/SysLoginInfo.java @@ -1,7 +1,6 @@ package cc.iotkit.model.system; import cc.iotkit.model.Id; -import io.github.linpeilie.annotations.AutoMapper; import lombok.Data; import java.io.Serializable; import java.util.Date; @@ -14,7 +13,7 @@ import java.util.Date; * @date 2023-02-07 */ @Data -public class SysLogininfor implements Id,Serializable { +public class SysLoginInfo implements Id,Serializable { private static final long serialVersionUID = 1L; /** diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/system/ISysLogininforData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/system/ISysLogininforData.java index f3a4f063..1968857d 100644 --- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/system/ISysLogininforData.java +++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/system/ISysLogininforData.java @@ -2,7 +2,7 @@ package cc.iotkit.data.system; import cc.iotkit.data.ICommonData; import cc.iotkit.common.api.Paging; -import cc.iotkit.model.system.SysLogininfor; +import cc.iotkit.model.system.SysLoginInfo; import java.util.List; @@ -11,17 +11,17 @@ import java.util.List; * * @author sjg */ -public interface ISysLogininforData extends ICommonData { +public interface ISysLogininforData extends ICommonData { /** * 按条件查询 */ - List findByConditions(SysLogininfor cond); + List findByConditions(SysLoginInfo cond); /** * 按条件分页查询 */ - Paging findByConditions(SysLogininfor cond, int page, int size); + Paging findByConditions(SysLoginInfo cond, int page, int size); /** * 按租户清除登录日志 diff --git a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbSysLogininfor.java b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbSysLogininfor.java index 83b48438..6b0ba4cb 100644 --- a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbSysLogininfor.java +++ b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbSysLogininfor.java @@ -1,6 +1,6 @@ package cc.iotkit.data.model; -import cc.iotkit.model.system.SysLogininfor; +import cc.iotkit.model.system.SysLoginInfo; import io.github.linpeilie.annotations.AutoMapper; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -21,7 +21,7 @@ import java.util.Date; @Data @Entity @Table(name = "sys_logininfor") -@AutoMapper(target = SysLogininfor.class) +@AutoMapper(target = SysLoginInfo.class) public class TbSysLogininfor extends BaseEntity { /** * ID diff --git a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbSysNotice.java b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbSysNotice.java index 16d72c19..5f5dbeee 100644 --- a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbSysNotice.java +++ b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbSysNotice.java @@ -1,7 +1,5 @@ package cc.iotkit.data.model; -import cc.iotkit.data.model.BaseEntity; -import cc.iotkit.model.system.SysLogininfor; import cc.iotkit.model.system.SysNotice; import io.github.linpeilie.annotations.AutoMapper; import io.swagger.annotations.ApiModel; diff --git a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbSysTenant.java b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbSysTenant.java index e585f9f2..a839ee77 100644 --- a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbSysTenant.java +++ b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbSysTenant.java @@ -1,7 +1,6 @@ package cc.iotkit.data.model; import cc.iotkit.common.constant.UserConstants; -import cc.iotkit.data.model.BaseEntity; import cc.iotkit.model.system.SysTenant; import io.github.linpeilie.annotations.AutoMapper; import io.swagger.annotations.ApiModelProperty; diff --git a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbSysTenantPackage.java b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbSysTenantPackage.java index fa4072b0..2e67fc97 100644 --- a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbSysTenantPackage.java +++ b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbSysTenantPackage.java @@ -1,7 +1,6 @@ package cc.iotkit.data.model; import cc.iotkit.common.constant.UserConstants; -import cc.iotkit.data.model.BaseEntity; import cc.iotkit.model.system.SysTenantPackage; import io.github.linpeilie.annotations.AutoMapper; import io.swagger.annotations.ApiModelProperty; diff --git a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbSysUser.java b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbSysUser.java index b3a77f75..b2d79dc2 100644 --- a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbSysUser.java +++ b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbSysUser.java @@ -8,7 +8,6 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import org.hibernate.annotations.GenericGenerator; -import org.springframework.boot.context.properties.bind.DefaultValue; import javax.persistence.Entity; import javax.persistence.GeneratedValue; diff --git a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbVirtualDeviceMapping.java b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbVirtualDeviceMapping.java index fecd7c2f..323ec22f 100644 --- a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbVirtualDeviceMapping.java +++ b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbVirtualDeviceMapping.java @@ -9,7 +9,6 @@ */ package cc.iotkit.data.model; -import io.github.linpeilie.annotations.AutoMapper; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/SysLogininfoDataImpl.java b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/SysLogininfoDataImpl.java index cb9a0149..3fb5d5da 100644 --- a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/SysLogininfoDataImpl.java +++ b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/SysLogininfoDataImpl.java @@ -10,7 +10,7 @@ import cc.iotkit.data.model.TbSysLogininfor; import cc.iotkit.data.system.ISysLogininforData; import cc.iotkit.data.util.PageBuilder; import cc.iotkit.data.util.PredicateBuilder; -import cc.iotkit.model.system.SysLogininfor; +import cc.iotkit.model.system.SysLoginInfo; import com.querydsl.core.types.Predicate; import com.querydsl.jpa.impl.JPAQueryFactory; import lombok.RequiredArgsConstructor; @@ -30,7 +30,7 @@ import static cc.iotkit.data.model.QTbSysLogininfor.tbSysLogininfor; @Primary @Service @RequiredArgsConstructor -public class SysLogininfoDataImpl implements ISysLogininforData, IJPACommData { +public class SysLogininfoDataImpl implements ISysLogininforData, IJPACommData { private final SysLogininforRepository logininfoRepository; @@ -50,22 +50,22 @@ public class SysLogininfoDataImpl implements ISysLogininforData, IJPACommData findAll(PageRequest pageRequest) { - return PageBuilder.toPaging(logininfoRepository.findAll(genPredicate(pageRequest.getData()), PageBuilder.toPageable(pageRequest))).to(SysLogininfor.class); + public Paging findAll(PageRequest pageRequest) { + return PageBuilder.toPaging(logininfoRepository.findAll(genPredicate(pageRequest.getData()), PageBuilder.toPageable(pageRequest))).to(SysLoginInfo.class); } @Override - public List findByConditions(SysLogininfor data) { + public List findByConditions(SysLoginInfo data) { List ret=jpaQueryFactory.selectFrom(tbSysLogininfor).where(genPredicate(data)) .orderBy(tbSysLogininfor.id.desc()).fetch(); - return MapstructUtils.convert(ret, SysLogininfor.class); + return MapstructUtils.convert(ret, SysLoginInfo.class); } - private static Predicate genPredicate(SysLogininfor data) { + private static Predicate genPredicate(SysLoginInfo data) { return PredicateBuilder.instance() .and(StringUtils.isNotBlank(data.getIpaddr()), () -> tbSysLogininfor.ipaddr.like(data.getIpaddr())) .and(StringUtils.isNotBlank(data.getStatus()), () -> tbSysLogininfor.status.eq(data.getStatus())) @@ -74,9 +74,9 @@ public class SysLogininfoDataImpl implements ISysLogininforData, IJPACommData findByConditions(SysLogininfor cond, int page, int size) { + public Paging findByConditions(SysLoginInfo cond, int page, int size) { Page all = logininfoRepository.findAll(genPredicate(cond), PageBuilder.buildPageable(page, size)); - return PageBuilder.toPaging(all, SysLogininfor.class); + return PageBuilder.toPaging(all, SysLoginInfo.class); } @Override diff --git a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/ExampleDataInit.java b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/ExampleDataInit.java index 762aadac..908f2ed9 100644 --- a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/ExampleDataInit.java +++ b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/ExampleDataInit.java @@ -241,7 +241,7 @@ public class ExampleDataInit implements SmartInitializingSingleton { initData("sys_dict_type", sysDictTypeData, new TypeReference>() { }); - initData("sys_logininfor", sysLogininforData, new TypeReference>() { + initData("sys_logininfor", sysLogininforData, new TypeReference>() { }); initData("sys_menu", sysMenuData, new TypeReference>() { }); diff --git a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/impl/ScreenServiceImpl.java b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/impl/ScreenServiceImpl.java index 9590a2c8..812d761b 100644 --- a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/impl/ScreenServiceImpl.java +++ b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/impl/ScreenServiceImpl.java @@ -149,17 +149,17 @@ public class ScreenServiceImpl implements IScreenService { @Override public void publishStatusChange(PublishChangeBo data) { Screen screen = getAndCheckBigScreen(data.getId()); - if (screen.STATE_RUNNING.equals(data.getState())) {//发布状态 + if (Screen.STATE_RUNNING.equals(data.getState())) {//发布状态 List screenApis=screenApiData.findByScreenId(screen.getId()); if(screenApis==null||screenApis.size()==0){ throw new BizException(ErrCode.API_LIST_BLANK); } - screen.setState(screen.STATE_RUNNING); + screen.setState(Screen.STATE_RUNNING); screenManager.register(screen); screenManager.publish(screen); } else {//取消发布 - screen.setState(screen.STATE_STOPPED); - screenManager.unpublish(screen); + screen.setState(Screen.STATE_STOPPED); + screenManager.unPublish(screen); } screenData.save(screen); } diff --git a/iot-module/iot-screen/src/main/java/cc/iotkit/screen/ScreenManager.java b/iot-module/iot-screen/src/main/java/cc/iotkit/screen/ScreenManager.java index 401bd648..99fb006a 100644 --- a/iot-module/iot-screen/src/main/java/cc/iotkit/screen/ScreenManager.java +++ b/iot-module/iot-screen/src/main/java/cc/iotkit/screen/ScreenManager.java @@ -13,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -75,7 +76,7 @@ public class ScreenManager { states.put(id, true); } - public void unpublish(Screen screen) { + public void unPublish(Screen screen) { Long id = screen.getId(); ScreenComponent screenComponent = screens.get(id); if (screenComponent == null) { @@ -83,7 +84,7 @@ public class ScreenManager { } screens.remove(id); states.remove(id); - screenComponent.unpublish(); + screenComponent.unPublish(); } public void previewApis(Screen screen,List screenApis) { @@ -99,7 +100,7 @@ public class ScreenManager { Long id = screen.getId(); ScreenComponent screenComponent = screens.get(id); if (screenComponent == null) { - return null; + return Collections.emptyList(); } return screenComponent.getScreenApis(); } diff --git a/iot-module/iot-screen/src/main/java/cc/iotkit/screen/staticres/ScreenComponent.java b/iot-module/iot-screen/src/main/java/cc/iotkit/screen/staticres/ScreenComponent.java index 4f37abb8..6ee13cf6 100644 --- a/iot-module/iot-screen/src/main/java/cc/iotkit/screen/staticres/ScreenComponent.java +++ b/iot-module/iot-screen/src/main/java/cc/iotkit/screen/staticres/ScreenComponent.java @@ -68,9 +68,9 @@ public class ScreenComponent { } @SneakyThrows - public void unpublish() { + public void unPublish() { screenVerticle.stop(); Future future = vertx.undeploy(deployedId); - future.onSuccess(unused -> log.info("unpublish screen success")); + future.onSuccess(unused -> log.info("unPublish screen success")); } } diff --git a/iot-module/iot-screen/src/main/java/cc/iotkit/screen/staticres/ScreenVerticle.java b/iot-module/iot-screen/src/main/java/cc/iotkit/screen/staticres/ScreenVerticle.java index 62dd0e8a..bf1adf73 100644 --- a/iot-module/iot-screen/src/main/java/cc/iotkit/screen/staticres/ScreenVerticle.java +++ b/iot-module/iot-screen/src/main/java/cc/iotkit/screen/staticres/ScreenVerticle.java @@ -37,7 +37,7 @@ public class ScreenVerticle extends AbstractVerticle { } @Override - public void start() throws Exception { + public void start() { httpServer = vertx.createHttpServer(); Router router = Router.router(vertx); router.route(screenConfig.screenAdmin + "/*").handler(StaticHandler.create(screenConfig.getScreenDir()+"/"+apiHandler.getScreenId()+"/"+packageName)); @@ -62,7 +62,7 @@ public class ScreenVerticle extends AbstractVerticle { } @Override - public void stop() throws Exception { + public void stop() { httpServer.close(voidAsyncResult -> log.info("close screen server...")); } } diff --git a/iot-module/iot-system/src/main/java/cc/iotkit/system/config/AutoMapperConfig.java b/iot-module/iot-system/src/main/java/cc/iotkit/system/config/AutoMapperConfig.java index a1afc72c..6eedbb78 100644 --- a/iot-module/iot-system/src/main/java/cc/iotkit/system/config/AutoMapperConfig.java +++ b/iot-module/iot-system/src/main/java/cc/iotkit/system/config/AutoMapperConfig.java @@ -1,6 +1,5 @@ package cc.iotkit.system.config; -import io.github.linpeilie.annotations.ComponentModelConfig; import io.github.linpeilie.annotations.MapperConfig; /** diff --git a/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysDictTypeController.java b/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysDictTypeController.java index 8fc9f3e1..a7aa4cf0 100644 --- a/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysDictTypeController.java +++ b/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysDictTypeController.java @@ -22,7 +22,6 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletResponse; -import java.util.Collection; import java.util.List; /** diff --git a/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysLogininforController.java b/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysLogininforController.java index d21b0a2e..636e246a 100644 --- a/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysLogininforController.java +++ b/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysLogininforController.java @@ -10,7 +10,7 @@ import cc.iotkit.common.log.enums.BusinessType; import cc.iotkit.common.redis.utils.RedisUtils; import cc.iotkit.common.validate.QueryGroup; import cc.iotkit.common.web.core.BaseController; -import cc.iotkit.system.dto.bo.SysLogininforBo; +import cc.iotkit.system.dto.bo.SysLoginInfoBo; import cc.iotkit.system.dto.vo.SysLogininforVo; import cc.iotkit.system.service.ISysLogininforService; import cn.dev33.satoken.annotation.SaCheckPermission; @@ -43,7 +43,7 @@ public class SysLogininforController extends BaseController { @ApiOperation("获取系统访问记录列表") @SaCheckPermission("monitor:logininfor:list") @PostMapping("/list") - public Paging list(@RequestBody @Validated(QueryGroup.class) PageRequest query) { + public Paging list(@RequestBody @Validated(QueryGroup.class) PageRequest query) { return logininforService.findAll(query); } @@ -54,7 +54,7 @@ public class SysLogininforController extends BaseController { @Log(title = "登录日志", businessType = BusinessType.EXPORT) @SaCheckPermission("monitor:logininfor:export") @PostMapping("/export") - public void export(SysLogininforBo logininfor, HttpServletResponse response) { + public void export(SysLoginInfoBo logininfor, HttpServletResponse response) { List list = logininforService.selectLogininforList(logininfor); ExcelUtil.exportExcel(list, "登录日志", SysLogininforVo.class, response); } @@ -88,7 +88,7 @@ public class SysLogininforController extends BaseController { @PostMapping("/unlockByUserName") public void unlock(@Validated @RequestBody Request bo) { String loginName = GlobalConstants.PWD_ERR_CNT_KEY + bo.getData(); - if (RedisUtils.hasKey(loginName)) { + if (Boolean.TRUE.equals(RedisUtils.hasKey(loginName))) { RedisUtils.deleteObject(loginName); } } diff --git a/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysMenuController.java b/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysMenuController.java index 23199696..2c1c7651 100644 --- a/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysMenuController.java +++ b/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysMenuController.java @@ -89,7 +89,7 @@ public class SysMenuController extends BaseController { }, mode = SaMode.OR) @SaCheckPermission("system:menu:query") @PostMapping("/treeselect") - public List> treeselect(@Validated @RequestBody Request menu) { + public List> treeSelect(@Validated @RequestBody Request menu) { List menus = menuService.selectMenuList(menu.getData(), LoginHelper.getUserId()); return menuService.buildMenuTreeSelect(menus); } @@ -105,7 +105,7 @@ public class SysMenuController extends BaseController { }, mode = SaMode.OR) @SaCheckPermission("system:menu:query") @PostMapping(value = "/roleMenuTreeselectByRoleId") - public MenuTreeSelectVo roleMenuTreeselect(@Validated @RequestBody Request bo) { + public MenuTreeSelectVo roleMenuTreeSelect(@Validated @RequestBody Request bo) { List menus = menuService.selectMenuList(LoginHelper.getUserId()); MenuTreeSelectVo selectVo = new MenuTreeSelectVo(); selectVo.setCheckedKeys(menuService.selectMenuListByRoleId(bo.getData())); diff --git a/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysNoticeController.java b/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysNoticeController.java index ff200267..260d5da7 100644 --- a/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysNoticeController.java +++ b/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysNoticeController.java @@ -8,14 +8,16 @@ import cc.iotkit.common.log.enums.BusinessType; import cc.iotkit.common.web.core.BaseController; import cc.iotkit.system.dto.bo.SysNoticeBo; import cc.iotkit.system.dto.vo.SysNoticeVo; -import cn.dev33.satoken.annotation.SaCheckPermission; import cc.iotkit.system.service.ISysNoticeService; +import cn.dev33.satoken.annotation.SaCheckPermission; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; -import java.util.Collection; import java.util.List; /** diff --git a/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysOssController.java b/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysOssController.java index 9fca5b8f..9b2fa740 100644 --- a/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysOssController.java +++ b/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysOssController.java @@ -15,7 +15,6 @@ import cc.iotkit.system.service.ISysOssService; import cn.dev33.satoken.annotation.SaCheckPermission; import cn.hutool.core.util.ObjectUtil; import io.swagger.annotations.ApiOperation; -import jakarta.validation.constraints.NotEmpty; import lombok.RequiredArgsConstructor; import org.springframework.http.MediaType; import org.springframework.validation.annotation.Validated; @@ -24,7 +23,6 @@ import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; import java.io.IOException; -import java.util.Arrays; import java.util.List; /** diff --git a/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysPostController.java b/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysPostController.java index b27663cb..4d10f531 100644 --- a/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysPostController.java +++ b/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysPostController.java @@ -17,10 +17,12 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletResponse; -import java.util.Collection; import java.util.List; /** diff --git a/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysProfileController.java b/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysProfileController.java index 9e436170..745bd801 100644 --- a/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysProfileController.java +++ b/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysProfileController.java @@ -66,7 +66,7 @@ public class SysProfileController extends BaseController { public void updateProfile(@RequestBody Request bo) { SysUserProfileBo profile = bo.getData(); SysUserBo user = BeanUtil.toBean(profile, SysUserBo.class); - if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) { + if (StringUtils.isNotEmpty(user.getPhoneNumber()) && !userService.checkPhoneUnique(user)) { fail("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); } if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) { diff --git a/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysTenantController.java b/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysTenantController.java index a005530c..904f740d 100644 --- a/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysTenantController.java +++ b/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysTenantController.java @@ -20,8 +20,6 @@ import com.baomidou.lock.annotation.Lock4j; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.NotEmpty; -import jakarta.validation.constraints.NotNull; import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; diff --git a/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysUserController.java b/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysUserController.java index 2aae0bb7..74be6c25 100644 --- a/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysUserController.java +++ b/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysUserController.java @@ -153,15 +153,13 @@ public class SysUserController extends BaseController { SysUserBo user = reqUser.getData(); if (!userService.checkUserNameUnique(user)) { fail("新增用户'" + user.getUserName() + "'失败,登录账号已存在"); - } else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) { + } else if (StringUtils.isNotEmpty(user.getPhoneNumber()) && !userService.checkPhoneUnique(user)) { fail("新增用户'" + user.getUserName() + "'失败,手机号码已存在"); } else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) { fail("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在"); } - if (TenantHelper.isEnable()) { - if (!tenantService.checkAccountBalance(TenantHelper.getTenantId())) { - fail("当前租户下用户名额不足,请联系管理员"); - } + if (TenantHelper.isEnable() && !tenantService.checkAccountBalance(TenantHelper.getTenantId())) { + fail("当前租户下用户名额不足,请联系管理员"); } user.setPassword(BCrypt.hashpw(user.getPassword())); user.setUserType("sys_user"); @@ -181,7 +179,7 @@ public class SysUserController extends BaseController { userService.checkUserDataScope(user.getId()); if (!userService.checkUserNameUnique(user)) { fail("修改用户'" + user.getUserName() + "'失败,登录账号已存在"); - } else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) { + } else if (StringUtils.isNotEmpty(user.getPhoneNumber()) && !userService.checkPhoneUnique(user)) { fail("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); } else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) { fail("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); diff --git a/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysUserOnlineController.java b/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysUserOnlineController.java index 8a97c547..0ebd4043 100644 --- a/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysUserOnlineController.java +++ b/iot-module/iot-system/src/main/java/cc/iotkit/system/controller/SysUserOnlineController.java @@ -84,9 +84,6 @@ public class SysUserOnlineController extends BaseController { @Log(title = "在线用户", businessType = BusinessType.FORCE) @PostMapping("/kickoutByTokenValue") public void forceLogout(@RequestBody @Validated Request bo) { - try { - StpUtil.kickoutByTokenValue(bo.getData()); - } catch (NotLoginException ignored) { - } + StpUtil.kickoutByTokenValue(bo.getData()); } } diff --git a/iot-module/iot-system/src/main/java/cc/iotkit/system/dto/bo/SysChangePwdBo.java b/iot-module/iot-system/src/main/java/cc/iotkit/system/dto/bo/SysChangePwdBo.java index dd038bfd..7d7efc7d 100644 --- a/iot-module/iot-system/src/main/java/cc/iotkit/system/dto/bo/SysChangePwdBo.java +++ b/iot-module/iot-system/src/main/java/cc/iotkit/system/dto/bo/SysChangePwdBo.java @@ -2,9 +2,6 @@ package cc.iotkit.system.dto.bo; import cc.iotkit.common.api.BaseDto; import io.swagger.annotations.ApiModelProperty; -import io.swagger.annotations.ApiOperation; -import jakarta.validation.constraints.Email; -import jakarta.validation.constraints.Size; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; diff --git a/iot-module/iot-system/src/main/java/cc/iotkit/system/dto/bo/SysLogininforBo.java b/iot-module/iot-system/src/main/java/cc/iotkit/system/dto/bo/SysLoginInfoBo.java similarity index 87% rename from iot-module/iot-system/src/main/java/cc/iotkit/system/dto/bo/SysLogininforBo.java rename to iot-module/iot-system/src/main/java/cc/iotkit/system/dto/bo/SysLoginInfoBo.java index 04e592b5..5545c05d 100644 --- a/iot-module/iot-system/src/main/java/cc/iotkit/system/dto/bo/SysLogininforBo.java +++ b/iot-module/iot-system/src/main/java/cc/iotkit/system/dto/bo/SysLoginInfoBo.java @@ -1,6 +1,6 @@ package cc.iotkit.system.dto.bo; -import cc.iotkit.model.system.SysLogininfor; +import cc.iotkit.model.system.SysLoginInfo; import io.github.linpeilie.annotations.AutoMapper; import lombok.Data; @@ -15,8 +15,8 @@ import java.util.Map; */ @Data -@AutoMapper(target = SysLogininfor.class, reverseConvertGenerate = false) -public class SysLogininforBo { +@AutoMapper(target = SysLoginInfo.class, reverseConvertGenerate = false) +public class SysLoginInfoBo { /** * 访问ID diff --git a/iot-module/iot-system/src/main/java/cc/iotkit/system/dto/bo/SysRoleAuthBo.java b/iot-module/iot-system/src/main/java/cc/iotkit/system/dto/bo/SysRoleAuthBo.java index d5082474..a453016f 100644 --- a/iot-module/iot-system/src/main/java/cc/iotkit/system/dto/bo/SysRoleAuthBo.java +++ b/iot-module/iot-system/src/main/java/cc/iotkit/system/dto/bo/SysRoleAuthBo.java @@ -1,15 +1,8 @@ package cc.iotkit.system.dto.bo; import cc.iotkit.common.api.BaseDto; -import cc.iotkit.common.constant.UserConstants; -import cc.iotkit.common.validate.AddGroup; -import cc.iotkit.common.validate.EditGroup; -import cc.iotkit.model.system.SysRole; -import io.github.linpeilie.annotations.AutoMapper; import io.swagger.annotations.ApiModelProperty; -import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; -import jakarta.validation.constraints.Size; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; @@ -32,7 +25,6 @@ public class SysRoleAuthBo extends BaseDto { @ApiModelProperty(value = "用户ID列表") - private Long[] userIds; diff --git a/iot-module/iot-system/src/main/java/cc/iotkit/system/dto/bo/UserOnlineBo.java b/iot-module/iot-system/src/main/java/cc/iotkit/system/dto/bo/UserOnlineBo.java index 59dbb8a0..4f6acc87 100644 --- a/iot-module/iot-system/src/main/java/cc/iotkit/system/dto/bo/UserOnlineBo.java +++ b/iot-module/iot-system/src/main/java/cc/iotkit/system/dto/bo/UserOnlineBo.java @@ -1,14 +1,7 @@ package cc.iotkit.system.dto.bo; import cc.iotkit.common.api.BaseDto; -import cc.iotkit.common.constant.UserConstants; -import cc.iotkit.model.system.SysUser; -import io.github.linpeilie.annotations.AutoMapper; import io.swagger.annotations.ApiModelProperty; -import io.swagger.annotations.ApiOperation; -import jakarta.validation.constraints.Email; -import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.Size; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; diff --git a/iot-module/iot-system/src/main/java/cc/iotkit/system/dto/vo/SysLogininforVo.java b/iot-module/iot-system/src/main/java/cc/iotkit/system/dto/vo/SysLogininforVo.java index 559a2d86..f69ed2d3 100644 --- a/iot-module/iot-system/src/main/java/cc/iotkit/system/dto/vo/SysLogininforVo.java +++ b/iot-module/iot-system/src/main/java/cc/iotkit/system/dto/vo/SysLogininforVo.java @@ -2,7 +2,7 @@ package cc.iotkit.system.dto.vo; import cc.iotkit.common.excel.annotation.ExcelDictFormat; import cc.iotkit.common.excel.convert.ExcelDictConvert; -import cc.iotkit.model.system.SysLogininfor; +import cc.iotkit.model.system.SysLoginInfo; import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelProperty; import io.github.linpeilie.annotations.AutoMapper; @@ -21,7 +21,7 @@ import java.util.Date; */ @Data @ExcelIgnoreUnannotated -@AutoMapper(target = SysLogininfor.class) +@AutoMapper(target = SysLoginInfo.class) public class SysLogininforVo implements Serializable { private static final long serialVersionUID = 1L; diff --git a/iot-module/iot-system/src/main/java/cc/iotkit/system/listener/SysUserImportListener.java b/iot-module/iot-system/src/main/java/cc/iotkit/system/listener/SysUserImportListener.java index 1205b9dd..10b634f7 100644 --- a/iot-module/iot-system/src/main/java/cc/iotkit/system/listener/SysUserImportListener.java +++ b/iot-module/iot-system/src/main/java/cc/iotkit/system/listener/SysUserImportListener.java @@ -18,6 +18,7 @@ import com.alibaba.excel.context.AnalysisContext; import com.alibaba.excel.event.AnalysisEventListener; import lombok.extern.slf4j.Slf4j; +import java.util.Collections; import java.util.List; /** @@ -62,7 +63,7 @@ public class SysUserImportListener extends AnalysisEventListener").append(successNum).append("、账号 ").append(user.getUserName()).append(" 导入成功"); - } else if (isUpdateSupport) { + } else if (Boolean.TRUE.equals(isUpdateSupport)) { Long userId = sysUser.getId(); SysUserBo user = BeanUtil.toBean(userVo, SysUserBo.class); user.setId(userId); @@ -107,12 +108,12 @@ public class SysUserImportListener extends AnalysisEventListener getList() { - return null; + return Collections.emptyList(); } @Override public List getErrorList() { - return null; + return Collections.emptyList(); } }; } diff --git a/iot-module/iot-system/src/main/java/cc/iotkit/system/runner/SystemApplicationRunner.java b/iot-module/iot-system/src/main/java/cc/iotkit/system/runner/SystemApplicationRunner.java index 2920a2d2..3f9ab1b9 100644 --- a/iot-module/iot-system/src/main/java/cc/iotkit/system/runner/SystemApplicationRunner.java +++ b/iot-module/iot-system/src/main/java/cc/iotkit/system/runner/SystemApplicationRunner.java @@ -20,7 +20,7 @@ public class SystemApplicationRunner implements ApplicationRunner { private final ISysOssConfigService ossConfigService; @Override - public void run(ApplicationArguments args) throws Exception { + public void run(ApplicationArguments args) { ossConfigService.init(); log.info("初始化OSS配置成功"); } diff --git a/iot-module/iot-system/src/main/java/cc/iotkit/system/service/ISysLogininforService.java b/iot-module/iot-system/src/main/java/cc/iotkit/system/service/ISysLogininforService.java index 48b1c7d7..946d0f83 100644 --- a/iot-module/iot-system/src/main/java/cc/iotkit/system/service/ISysLogininforService.java +++ b/iot-module/iot-system/src/main/java/cc/iotkit/system/service/ISysLogininforService.java @@ -2,7 +2,7 @@ package cc.iotkit.system.service; import cc.iotkit.common.api.PageRequest; import cc.iotkit.common.api.Paging; -import cc.iotkit.system.dto.bo.SysLogininforBo; +import cc.iotkit.system.dto.bo.SysLoginInfoBo; import cc.iotkit.system.dto.vo.SysLogininforVo; import java.util.Collection; @@ -22,7 +22,7 @@ public interface ISysLogininforService { * * @param bo 访问日志对象 */ - void insertLogininfor(SysLogininforBo bo); + void insertLogininfor(SysLoginInfoBo bo); /** * 查询系统登录日志集合 @@ -30,7 +30,7 @@ public interface ISysLogininforService { * @param logininfor 访问日志对象 * @return 登录记录集合 */ - List selectLogininforList(SysLogininforBo logininfor); + List selectLogininforList(SysLoginInfoBo logininfor); /** * 批量删除系统登录日志 @@ -45,5 +45,5 @@ public interface ISysLogininforService { */ void cleanLogininfor(); - Paging findAll(PageRequest query); + Paging findAll(PageRequest query); } diff --git a/iot-module/iot-system/src/main/java/cc/iotkit/system/service/ISysOssService.java b/iot-module/iot-system/src/main/java/cc/iotkit/system/service/ISysOssService.java index fd57505a..0021e026 100644 --- a/iot-module/iot-system/src/main/java/cc/iotkit/system/service/ISysOssService.java +++ b/iot-module/iot-system/src/main/java/cc/iotkit/system/service/ISysOssService.java @@ -6,7 +6,6 @@ import cc.iotkit.system.dto.bo.SysOssBo; import cc.iotkit.system.dto.vo.SysOssVo; import org.springframework.web.multipart.MultipartFile; -import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.Collection; import java.util.List; diff --git a/iot-module/iot-system/src/main/java/cc/iotkit/system/service/impl/SysLogininforServiceImpl.java b/iot-module/iot-system/src/main/java/cc/iotkit/system/service/impl/SysLogininforServiceImpl.java index e57f15cd..bcb6f44b 100644 --- a/iot-module/iot-system/src/main/java/cc/iotkit/system/service/impl/SysLogininforServiceImpl.java +++ b/iot-module/iot-system/src/main/java/cc/iotkit/system/service/impl/SysLogininforServiceImpl.java @@ -9,8 +9,8 @@ import cc.iotkit.common.utils.StringUtils; import cc.iotkit.common.utils.ip.AddressUtils; import cc.iotkit.common.web.utils.ServletUtils; import cc.iotkit.data.system.ISysLogininforData; -import cc.iotkit.model.system.SysLogininfor; -import cc.iotkit.system.dto.bo.SysLogininforBo; +import cc.iotkit.model.system.SysLoginInfo; +import cc.iotkit.system.dto.bo.SysLoginInfoBo; import cc.iotkit.system.dto.vo.SysLogininforVo; import cc.iotkit.system.service.ISysLogininforService; import cn.hutool.http.useragent.UserAgent; @@ -64,7 +64,7 @@ public class SysLogininforServiceImpl implements ISysLogininforService { // 获取客户端浏览器 String browser = userAgent.getBrowser().getName(); // 封装对象 - SysLogininforBo logininfor = new SysLogininforBo(); + SysLoginInfoBo logininfor = new SysLoginInfoBo(); logininfor.setTenantId(logininforEvent.getTenantId()); logininfor.setUserName(logininforEvent.getUsername()); logininfor.setIpaddr(ip); @@ -97,8 +97,8 @@ public class SysLogininforServiceImpl implements ISysLogininforService { * @param bo 访问日志对象 */ @Override - public void insertLogininfor(SysLogininforBo bo) { - SysLogininfor logininfor = MapstructUtils.convert(bo, SysLogininfor.class); + public void insertLogininfor(SysLoginInfoBo bo) { + SysLoginInfo logininfor = MapstructUtils.convert(bo, SysLoginInfo.class); logininfor.setLoginTime(new Date()); sysLogininforData.save(logininfor); } @@ -110,10 +110,10 @@ public class SysLogininforServiceImpl implements ISysLogininforService { * @return 登录记录集合 */ @Override - public List selectLogininforList(SysLogininforBo logininfor) { + public List selectLogininforList(SysLoginInfoBo logininfor) { return MapstructUtils.convert( sysLogininforData.findByConditions( - MapstructUtils.convert(logininfor, SysLogininfor.class) + MapstructUtils.convert(logininfor, SysLoginInfo.class) ), SysLogininforVo.class ); } @@ -138,7 +138,7 @@ public class SysLogininforServiceImpl implements ISysLogininforService { } @Override - public Paging findAll(PageRequest query) { - return sysLogininforData.findAll(query.to(SysLogininfor.class)).to(SysLogininforVo.class); + public Paging findAll(PageRequest query) { + return sysLogininforData.findAll(query.to(SysLoginInfo.class)).to(SysLogininforVo.class); } } diff --git a/iot-module/iot-system/src/main/java/cc/iotkit/system/service/impl/SysNoticeServiceImpl.java b/iot-module/iot-system/src/main/java/cc/iotkit/system/service/impl/SysNoticeServiceImpl.java index ffac80d5..fd8ee52a 100644 --- a/iot-module/iot-system/src/main/java/cc/iotkit/system/service/impl/SysNoticeServiceImpl.java +++ b/iot-module/iot-system/src/main/java/cc/iotkit/system/service/impl/SysNoticeServiceImpl.java @@ -7,14 +7,10 @@ import cc.iotkit.data.system.ISysNoticeData; import cc.iotkit.model.system.SysNotice; import cc.iotkit.system.dto.bo.SysNoticeBo; import cc.iotkit.system.dto.vo.SysNoticeVo; -import cc.iotkit.system.dto.vo.SysUserVo; -import cn.hutool.core.util.ObjectUtil; import cc.iotkit.system.service.ISysNoticeService; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; -import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.List; diff --git a/iot-module/iot-system/src/main/java/cc/iotkit/system/service/impl/SysOssConfigServiceImpl.java b/iot-module/iot-system/src/main/java/cc/iotkit/system/service/impl/SysOssConfigServiceImpl.java index 00ee4272..19988ae9 100644 --- a/iot-module/iot-system/src/main/java/cc/iotkit/system/service/impl/SysOssConfigServiceImpl.java +++ b/iot-module/iot-system/src/main/java/cc/iotkit/system/service/impl/SysOssConfigServiceImpl.java @@ -29,6 +29,7 @@ import org.springframework.transaction.annotation.Transactional; import java.util.Collection; import java.util.List; import java.util.Map; +import java.util.Objects; /** * 对象存储配置Service业务层处理 @@ -52,10 +53,10 @@ public class SysOssConfigServiceImpl implements ISysOssConfigService { List list = baseData.findAll(); Map> map = StreamUtils.groupByKey(list, SysOssConfig::getTenantId); try { - for (String tenantId : map.keySet()) { - TenantHelper.setDynamic(tenantId); - // 加载OSS初始化配置 - for (SysOssConfig config : map.get(tenantId)) { + + for (Map.Entry> stringListEntry : map.entrySet()) { + TenantHelper.setDynamic(stringListEntry.getKey()); + for (SysOssConfig config : stringListEntry.getValue()) { String configKey = config.getConfigKey(); if ("0".equals(config.getStatus())) { RedisUtils.setCacheObject(OssConstant.DEFAULT_CONFIG_KEY, configKey); @@ -75,12 +76,10 @@ public class SysOssConfigServiceImpl implements ISysOssConfigService { @Override public Paging queryPageList(PageRequest query) { - return baseData.findAll(query.to(SysOssConfig.class)).to(SysOssConfigVo.class); + return baseData.findAll(query.to(SysOssConfig.class)).to(SysOssConfigVo.class); } - - @Override public Boolean insertByBo(SysOssConfigBo bo) { SysOssConfig config = MapstructUtils.convert(bo, SysOssConfig.class); @@ -105,17 +104,15 @@ public class SysOssConfigServiceImpl implements ISysOssConfigService { */ private void validEntityBeforeSave(SysOssConfig entity) { if (StringUtils.isNotEmpty(entity.getConfigKey()) - && !checkConfigKeyUnique(entity)) { + && !checkConfigKeyUnique(entity)) { throw new BizException("操作配置'" + entity.getConfigKey() + "'失败, 配置key已存在!"); } } @Override public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { - if (isValid) { - if (CollUtil.containsAny(ids, OssConstant.SYSTEM_DATA_IDS)) { + if (Objects.equals(Boolean.TRUE, isValid) && CollUtil.containsAny(ids, OssConstant.SYSTEM_DATA_IDS)) { throw new BizException("系统内置, 不可删除!"); - } } List list = CollUtil.newArrayList(); for (Long configId : ids) { @@ -124,12 +121,9 @@ public class SysOssConfigServiceImpl implements ISysOssConfigService { } // TODO: 2021/8/13 删除数据校验 baseData.deleteByIds(ids); - boolean flag = true; - if (flag) { - list.forEach(sysOssConfig -> + list.forEach(sysOssConfig -> CacheUtils.evict(CacheNames.SYS_OSS_CONFIG, sysOssConfig.getConfigKey())); - } - return flag; + return true; } /** @@ -140,10 +134,7 @@ public class SysOssConfigServiceImpl implements ISysOssConfigService { SysOssConfig q = new SysOssConfig(); q.setConfigKey(sysOssConfig.getConfigKey()); SysOssConfig info = baseData.findOneByCondition(q); - if (ObjectUtil.isNotNull(info) && info.getId() != ossConfigId) { - return false; - } - return true; + return !ObjectUtil.isNotNull(info) || info.getId() == ossConfigId; } /** diff --git a/iot-module/iot-system/src/main/java/cc/iotkit/system/service/impl/SysOssServiceImpl.java b/iot-module/iot-system/src/main/java/cc/iotkit/system/service/impl/SysOssServiceImpl.java index 68c6f128..dfc89e4a 100644 --- a/iot-module/iot-system/src/main/java/cc/iotkit/system/service/impl/SysOssServiceImpl.java +++ b/iot-module/iot-system/src/main/java/cc/iotkit/system/service/impl/SysOssServiceImpl.java @@ -28,7 +28,6 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.List; -import java.util.Map; /** * 文件上传 服务层实现 @@ -77,13 +76,16 @@ public class SysOssServiceImpl implements ISysOssService, OssService { } @Override - public void download(Long ossId) throws IOException { + public void download(Long ossId) { } @Override public SysOssVo upload(MultipartFile file) { - String originalfileName = file.getOriginalFilename(); - String suffix = StringUtils.substring(originalfileName, originalfileName.lastIndexOf("."), originalfileName.length()); + String originalFileName = file.getOriginalFilename(); + if(originalFileName ==null){ + throw new BizException("文件名为空,获取失败"); + } + String suffix = StringUtils.substring(originalFileName, originalFileName.lastIndexOf("."), originalFileName.length()); OssClient storage = OssFactory.instance(); UploadResult uploadResult; try { @@ -96,7 +98,7 @@ public class SysOssServiceImpl implements ISysOssService, OssService { oss.setUrl(uploadResult.getUrl()); oss.setFileSuffix(suffix); oss.setFileName(uploadResult.getFilename()); - oss.setOriginalName(originalfileName); + oss.setOriginalName(originalFileName); oss.setService(storage.getConfigKey()); sysOssData.save(oss); SysOssVo sysOssVo = MapstructUtils.convert(oss, SysOssVo.class); @@ -105,7 +107,7 @@ public class SysOssServiceImpl implements ISysOssService, OssService { @Override public void deleteWithValidByIds(Collection ids, Boolean isValid) { - if (isValid) { + if (Boolean.TRUE.equals(isValid)) { // 做一些业务上的校验,判断是否需要校验 } List list = sysOssData.findByIds(ids); diff --git a/iot-module/iot-system/src/main/java/cc/iotkit/system/service/impl/SysRoleServiceImpl.java b/iot-module/iot-system/src/main/java/cc/iotkit/system/service/impl/SysRoleServiceImpl.java index d830a7e3..a7317256 100644 --- a/iot-module/iot-system/src/main/java/cc/iotkit/system/service/impl/SysRoleServiceImpl.java +++ b/iot-module/iot-system/src/main/java/cc/iotkit/system/service/impl/SysRoleServiceImpl.java @@ -19,7 +19,6 @@ import cc.iotkit.model.system.SysUserRole; import cc.iotkit.system.dto.bo.SysRoleBo; import cc.iotkit.system.dto.vo.SysRoleVo; import cc.iotkit.system.service.ISysRoleService; -import cn.dev33.satoken.exception.NotLoginException; import cn.dev33.satoken.stp.StpUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjectUtil; @@ -279,7 +278,7 @@ public class SysRoleServiceImpl implements ISysRoleService { rm.setMenuId(menuId); list.add(rm); } - if (list.size() > 0) { + if (!list.isEmpty()) { rows = iSysRoleMenuData.insertBatch(list); } return Integer.parseInt(rows + ""); @@ -300,7 +299,7 @@ public class SysRoleServiceImpl implements ISysRoleService { rd.setDeptId(deptId); list.add(rd); } - if (list.size() > 0) { + if (!list.isEmpty()) { rows = iSysRoleDeptData.insertBatch(list); } return Integer.parseInt(rows + ""); @@ -417,10 +416,7 @@ public class SysRoleServiceImpl implements ISysRoleService { } LoginUser loginUser = LoginHelper.getLoginUser(token); if (loginUser.getRoles().stream().anyMatch(r -> r.getId().equals(roleId))) { - try { - StpUtil.logoutByTokenValue(token); - } catch (NotLoginException ignored) { - } + StpUtil.logoutByTokenValue(token); } }); } diff --git a/iot-module/iot-system/src/main/java/cc/iotkit/system/service/impl/SysTenantServiceImpl.java b/iot-module/iot-system/src/main/java/cc/iotkit/system/service/impl/SysTenantServiceImpl.java index d62aa6a1..9634efaa 100644 --- a/iot-module/iot-system/src/main/java/cc/iotkit/system/service/impl/SysTenantServiceImpl.java +++ b/iot-module/iot-system/src/main/java/cc/iotkit/system/service/impl/SysTenantServiceImpl.java @@ -57,12 +57,12 @@ public class SysTenantServiceImpl implements ISysTenantService { @Override public Boolean insertByBo(SysTenantBo bo) { - return null; + return false; } @Override public Boolean updateByBo(SysTenantBo bo) { - return null; + return false; } @Override @@ -77,7 +77,7 @@ public class SysTenantServiceImpl implements ISysTenantService { @Override public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { - return null; + return false; } @Override @@ -104,6 +104,6 @@ public class SysTenantServiceImpl implements ISysTenantService { @Override public Boolean syncTenantPackage(String tenantId, String packageId) { - return null; + return false; } } diff --git a/iot-module/iot-system/src/main/java/cc/iotkit/system/service/impl/SysUserServiceImpl.java b/iot-module/iot-system/src/main/java/cc/iotkit/system/service/impl/SysUserServiceImpl.java index 2d6a883b..5c91c110 100644 --- a/iot-module/iot-system/src/main/java/cc/iotkit/system/service/impl/SysUserServiceImpl.java +++ b/iot-module/iot-system/src/main/java/cc/iotkit/system/service/impl/SysUserServiceImpl.java @@ -56,7 +56,6 @@ public class SysUserServiceImpl implements ISysUserService, UserService { private ISysUserPostData sysUserPostData; - @Override public String selectUserNameById(Long userId) { return null; @@ -69,33 +68,33 @@ public class SysUserServiceImpl implements ISysUserService, UserService { @Override public List selectUserList(SysUserBo user) { - return MapstructUtils.convert(sysUserData.findAllByCondition(user.to(SysUser.class)),SysUserVo.class); + return MapstructUtils.convert(sysUserData.findAllByCondition(user.to(SysUser.class)), SysUserVo.class); } @Override - public Paging selectAllocatedList( PageRequest query) { + public Paging selectAllocatedList(PageRequest query) { return sysUserData.selectAllocatedList(query.to(SysUser.class)).to(SysUserVo.class); } @Override - public Paging selectUnallocatedList( PageRequest query) { + public Paging selectUnallocatedList(PageRequest query) { return sysUserData.selectUnallocatedList(query.to(SysUser.class)).to(SysUserVo.class); } @Override public SysUserVo selectUserByUserName(String userName) { - return MapstructUtils.convert(sysUserData.selectUserByUserName(userName),SysUserVo.class); + return MapstructUtils.convert(sysUserData.selectUserByUserName(userName), SysUserVo.class); } @Override public SysUserVo selectUserByPhonenumber(String phonenumber) { - return MapstructUtils.convert(sysUserData.findByPhonenumber(phonenumber),SysUserVo.class); + return MapstructUtils.convert(sysUserData.findByPhonenumber(phonenumber), SysUserVo.class); } @Override public SysUserVo selectUserById(Long userId) { - return MapstructUtils.convert(sysUserData.findById(userId),SysUserVo.class); + return MapstructUtils.convert(sysUserData.findById(userId), SysUserVo.class); } @Override @@ -110,20 +109,17 @@ public class SysUserServiceImpl implements ISysUserService, UserService { @Override public boolean checkUserNameUnique(SysUserBo user) { - boolean exist = sysUserData.checkUserNameUnique(user.to(SysUser.class)); - return exist; + return sysUserData.checkUserNameUnique(user.to(SysUser.class)); } @Override public boolean checkPhoneUnique(SysUserBo user) { - boolean exist = sysUserData.checkPhoneUnique(user.to(SysUser.class)); - return exist; + return sysUserData.checkPhoneUnique(user.to(SysUser.class)); } @Override public boolean checkEmailUnique(SysUserBo user) { - boolean exist = sysUserData.checkEmailUnique(user.to(SysUser.class)); - return exist; + return sysUserData.checkEmailUnique(user.to(SysUser.class)); } @Override @@ -149,13 +145,13 @@ public class SysUserServiceImpl implements ISysUserService, UserService { @Override public int insertUser(SysUserBo user) { // 新增用户信息 - SysUser newUser=sysUserData.save(user.to(SysUser.class)); + SysUser newUser = sysUserData.save(user.to(SysUser.class)); user.setId(newUser.getId()); // 新增用户岗位关联 - insertUserPost(user,false); + insertUserPost(user, false); // 新增用户与角色管理 insertUserRole(user, false); - return newUser!=null?1:0; + return newUser != null ? 1 : 0; } /** @@ -244,11 +240,10 @@ public class SysUserServiceImpl implements ISysUserService, UserService { SysUser sysUser = MapstructUtils.convert(user, SysUser.class); // 防止错误更新后导致的数据误删除 SysUser ret = sysUserData.save(sysUser); - if (ret==null) { + if (ret == null) { throw new BizException("修改用户" + user.getUserName() + "信息失败"); } - return ret==null?1:0; - + return 0; } @Override @@ -259,21 +254,21 @@ public class SysUserServiceImpl implements ISysUserService, UserService { @Override public int updateUserStatus(Long userId, String status) { - SysUser user=sysUserData.findById(userId); + SysUser user = sysUserData.findById(userId); user.setStatus(status); - return sysUserData.save(user)!=null?1:0; + return sysUserData.save(user) != null ? 1 : 0; } @Override public int updateUserProfile(SysUserBo user) { - SysUser oldUser=sysUserData.findById(user.getId()); - if(ObjectUtil.isNotNull(user.getNickName())){ + SysUser oldUser = sysUserData.findById(user.getId()); + if (ObjectUtil.isNotNull(user.getNickName())) { oldUser.setNickName(user.getNickName()); } - oldUser.setPhonenumber(user.getPhonenumber()); + oldUser.setPhonenumber(user.getPhoneNumber()); oldUser.setEmail(user.getEmail()); oldUser.setSex(user.getSex()); - return sysUserData.save(oldUser)!=null?1:0; + return sysUserData.save(oldUser) != null ? 1 : 0; } @Override @@ -283,9 +278,9 @@ public class SysUserServiceImpl implements ISysUserService, UserService { @Override public int resetUserPwd(Long userId, String password) { - SysUser user=sysUserData.findById(userId); + SysUser user = sysUserData.findById(userId); user.setPassword(password); - return sysUserData.save(user)!=null?1:0; + return sysUserData.save(user) != null ? 1 : 0; } @Override