From 8faf6218c7d4c33e0f22f10627e5401b939321bf Mon Sep 17 00:00:00 2001 From: "yunhao.wang" Date: Thu, 1 Nov 2018 21:15:46 +0800 Subject: [PATCH 1/2] Merge branch 'master' of http://git.estsh.com/i3-IMPP/i3plus-pojo # Conflicts: # modules/i3plus-pojo-platform/src/main/java/cn/estsh/i3plus/pojo/platform/sqlpack/CoreHqlPack.java --- .../core/api/iservice/busi/ISysMessageService.java | 12 ++- .../controller/busi/SysMessageController.java | 30 ++++-- ...onfigServiceImpl.java => SysConfigService.java} | 4 +- ...yServiceImpl.java => SysDictionaryService.java} | 4 +- ...sageServiceImpl.java => SysMessageService.java} | 36 +++++-- .../{ToolServiceImpl.java => ToolService.java} | 5 +- ...olTypeServiceImpl.java => ToolTypeService.java} | 7 +- .../serviceimpl/busi/TestMessageServiceImpl.java | 111 +++++++++++++++++++++ ...gServiceImpl.java => TestSysConfigService.java} | 2 +- ...viceImpl.java => TestSysDictionaryService.java} | 2 +- ...stToolServiceImpl.java => TestToolService.java} | 2 +- ...peServiceImpl.java => TestToolTypeService.java} | 2 +- 12 files changed, 181 insertions(+), 36 deletions(-) rename modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/{SysConfigServiceImpl.java => SysConfigService.java} (96%) rename modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/{SysDictionaryServiceImpl.java => SysDictionaryService.java} (97%) rename modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/{SysMessageServiceImpl.java => SysMessageService.java} (63%) rename modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/{ToolServiceImpl.java => ToolService.java} (96%) rename modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/{ToolTypeServiceImpl.java => ToolTypeService.java} (94%) create mode 100644 modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestMessageServiceImpl.java rename modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/{TestSysConfigServiceImpl.java => TestSysConfigService.java} (97%) rename modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/{TestSysDictionaryServiceImpl.java => TestSysDictionaryService.java} (97%) rename modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/{TestToolServiceImpl.java => TestToolService.java} (98%) rename modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/{TestToolTypeServiceImpl.java => TestToolTypeService.java} (97%) diff --git a/modules/i3plus-core-api/src/main/java/cn/estsh/i3plus/core/api/iservice/busi/ISysMessageService.java b/modules/i3plus-core-api/src/main/java/cn/estsh/i3plus/core/api/iservice/busi/ISysMessageService.java index b2cc056..0cd29f5 100644 --- a/modules/i3plus-core-api/src/main/java/cn/estsh/i3plus/core/api/iservice/busi/ISysMessageService.java +++ b/modules/i3plus-core-api/src/main/java/cn/estsh/i3plus/core/api/iservice/busi/ISysMessageService.java @@ -1,5 +1,7 @@ package cn.estsh.i3plus.core.api.iservice.busi; +import cn.estsh.i3plus.pojo.base.bean.ListPager; +import cn.estsh.i3plus.pojo.base.common.Pager; import cn.estsh.i3plus.pojo.platform.bean.SysMessage; import java.util.List; @@ -17,7 +19,7 @@ public interface ISysMessageService { * 添加消息 * @param sysMessage */ - void insertSysMessage(SysMessage sysMessage); + SysMessage insertSysMessage(SysMessage sysMessage); /** * 删除消息 @@ -43,4 +45,12 @@ public interface ISysMessageService { * @return */ SysMessage getSysMessageById(String id); + + /** + * 系统消息复制查询,分页,排序 + * @param sysMessage + * @param pager + * @return + */ + ListPager querySysMessageByPager(SysMessage sysMessage, Pager pager); } diff --git a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/busi/SysMessageController.java b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/busi/SysMessageController.java index 00a027e..613bba4 100644 --- a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/busi/SysMessageController.java +++ b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/busi/SysMessageController.java @@ -2,6 +2,8 @@ package cn.estsh.i3plus.core.apiservice.controller.busi; import cn.estsh.i3plus.core.api.iservice.busi.ISysMessageService; import cn.estsh.i3plus.platform.common.convert.ConvertBean; +import cn.estsh.i3plus.pojo.base.bean.ListPager; +import cn.estsh.i3plus.pojo.base.common.Pager; import cn.estsh.i3plus.pojo.base.enumutil.ImppEnumUtil; import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil; import cn.estsh.i3plus.pojo.platform.bean.SessionUser; @@ -52,8 +54,8 @@ public class SysMessageController { // 添加初始化 ConvertBean.modelInitialize(sysMessage,user); - // sysMessage.setMessageSendId(user.getUser().getId()); - // sysMessage.setRedSendName(user.getUser().getName()); + sysMessage.setMessageSendId(user.getUser().getId()); + sysMessage.setRedSendName(user.getUser().getName()); sysMessage.setMessageStatusId(ImppEnumUtil.USER_MESSAGE_STATUS.UNREAD.getValue()); // TODO 状态 status @@ -122,9 +124,7 @@ public class SysMessageController { public ResultBean findSysConfigAll(){ try { List sysMessageList = sysMessageService.listSysMessage(); - return ResultBean.success("查询成功") - .setResultList(sysMessageList) - .setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()); + return ResultBean.success("查询成功").setResultList(sysMessageList).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()); }catch(ImppBusiException busExcep){ LOGGER.error(busExcep.getErrorMsg() + ":{}",busExcep.getErrorDetail(),busExcep); return ResultBean.fail(busExcep.getErrorShow()); @@ -134,14 +134,12 @@ public class SysMessageController { } } - @GetMapping(value = "/get-by-id") + @GetMapping(value = "/get/{id}") @ApiOperation(value = "根据id查询系统参数",notes = "根据id查询系统参数") public ResultBean getSysConfigById(String id){ try { SysMessage sysMessageList = sysMessageService.getSysMessageById(id); - return ResultBean.success("查询成功") - .setResultObject(sysMessageList) - .setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()); + return ResultBean.success("查询成功").setResultObject(sysMessageList).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()); }catch(ImppBusiException busExcep){ LOGGER.error(busExcep.getErrorMsg() + ":{}",busExcep.getErrorDetail(),busExcep); return ResultBean.fail(busExcep.getErrorShow()); @@ -151,4 +149,18 @@ public class SysMessageController { } } + @GetMapping(value = "/query") + @ApiOperation(value = "消息复杂查询,分页,排序",notes = "消息复杂查询,分页,排序") + public ResultBean querySysMessageByPager(SysMessage sysMessage, Pager pager){ + try { + ListPager sysMessageListPager = sysMessageService.querySysMessageByPager(sysMessage,pager); + return ResultBean.success("查询成功").setListPager(sysMessageListPager).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()); + }catch(ImppBusiException busExcep){ + LOGGER.error(busExcep.getErrorMsg() + ":{}",busExcep.getErrorDetail(),busExcep); + return ResultBean.fail(busExcep.getErrorShow()); + }catch(Exception e){ + LOGGER.error(ImppExceptionEnum.SYSTEM_EXCEPTION.getDescription() + ":{}",e.getMessage(),e); + return ResultBean.fail().setCode(ImppExceptionEnum.SYSTEM_EXCEPTION.getCode()); + } + } } diff --git a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/SysConfigServiceImpl.java b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/SysConfigService.java similarity index 96% rename from modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/SysConfigServiceImpl.java rename to modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/SysConfigService.java index 5799f3a..b95a082 100644 --- a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/SysConfigServiceImpl.java +++ b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/SysConfigService.java @@ -22,8 +22,8 @@ import java.util.List; * @Modify : **/ @Service -public class SysConfigServiceImpl implements ISysConfigService { - public static final Logger LOGGER = LoggerFactory.getLogger(SysConfigServiceImpl.class); +public class SysConfigService implements ISysConfigService { + public static final Logger LOGGER = LoggerFactory.getLogger(SysConfigService.class); @Autowired private SysConfigRepository SysConfigRDao; diff --git a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/SysDictionaryServiceImpl.java b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/SysDictionaryService.java similarity index 97% rename from modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/SysDictionaryServiceImpl.java rename to modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/SysDictionaryService.java index 9fe28f7..cf4e900 100644 --- a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/SysDictionaryServiceImpl.java +++ b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/SysDictionaryService.java @@ -24,8 +24,8 @@ import java.util.List; * @Modify : **/ @Service -public class SysDictionaryServiceImpl implements ISysDictionaryService { - public static final Logger LOGGER = LoggerFactory.getLogger(SysDictionaryServiceImpl.class); +public class SysDictionaryService implements ISysDictionaryService { + public static final Logger LOGGER = LoggerFactory.getLogger(SysDictionaryService.class); @Autowired private SysDictionaryRepository sysDictionaryRDao; diff --git a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/SysMessageServiceImpl.java b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/SysMessageService.java similarity index 63% rename from modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/SysMessageServiceImpl.java rename to modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/SysMessageService.java index 4ac17db..f4670a2 100644 --- a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/SysMessageServiceImpl.java +++ b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/SysMessageService.java @@ -1,11 +1,14 @@ package cn.estsh.i3plus.core.apiservice.serviceimpl.busi; import cn.estsh.i3plus.core.api.iservice.busi.ISysMessageService; -import cn.estsh.i3plus.pojo.platform.bean.Department; +import cn.estsh.i3plus.pojo.base.bean.ListPager; +import cn.estsh.i3plus.pojo.base.common.Pager; +import cn.estsh.i3plus.pojo.base.common.PagerHelper; import cn.estsh.i3plus.pojo.platform.bean.SysMessage; import cn.estsh.i3plus.pojo.platform.bean.SysUser; import cn.estsh.i3plus.pojo.platform.repository.SysMessageRepository; import cn.estsh.i3plus.pojo.platform.repository.SysUserRepository; +import cn.estsh.i3plus.pojo.platform.sqlpack.CoreHqlPack; import cn.estsh.impp.framework.boot.util.ValidatorBean; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -22,8 +25,8 @@ import java.util.List; * @Modify : **/ @Service -public class SysMessageServiceImpl implements ISysMessageService { - public static final Logger LOGGER = LoggerFactory.getLogger(SysMessageServiceImpl.class); +public class SysMessageService implements ISysMessageService { + public static final Logger LOGGER = LoggerFactory.getLogger(SysMessageService.class); @Autowired public SysMessageRepository sysMessageRDao; @@ -32,7 +35,7 @@ public class SysMessageServiceImpl implements ISysMessageService { public SysUserRepository sysUserRDao; @Override - public void insertSysMessage(SysMessage sysMessage) { + public SysMessage insertSysMessage(SysMessage sysMessage) { // 查询接收人名称 if (sysMessage.getMessageRecipientId() != null && sysMessage.getMessageRecipientId() > 0) { LOGGER.info("用户信息 SYSUSER id:{}", sysMessage.getMessageRecipientId()); @@ -42,13 +45,13 @@ public class SysMessageServiceImpl implements ISysMessageService { sysMessage.setRedMessageRecipientName(acceptUser.getName()); } - LOGGER.info("系统信息 SYS_MESSAGE :{}",sysMessage); - sysMessageRDao.insert(sysMessage); + LOGGER.info("消息 SYS_MESSAGE :{}",sysMessage); + return sysMessageRDao.insert(sysMessage); } @Override public void deleteSysMessageById(String id) { - LOGGER.info("系统信息 SYS_MESSAGE id:{}",id); + LOGGER.info("消息 SYS_MESSAGE id:{}",id); sysMessageRDao.deleteById(Long.parseLong(id)); } @@ -64,19 +67,32 @@ public class SysMessageServiceImpl implements ISysMessageService { sysMessage.setRedMessageRecipientName(acceptUser.getName()); } - LOGGER.info("系统信息 SYS_MESSAGE :{}",sysMessage); + LOGGER.info("消息 SYS_MESSAGE :{}",sysMessage); sysMessageRDao.update(sysMessage); } @Override public List listSysMessage() { - LOGGER.info("系统信息 SYS_MESSAGE list"); + LOGGER.info("消息 SYS_MESSAGE list"); return sysMessageRDao.list(); } @Override public SysMessage getSysMessageById(String id) { - LOGGER.info("系统信息 SYS_MESSAGE id:{}",id); + LOGGER.info("消息 SYS_MESSAGE id:{}",id); return sysMessageRDao.getById(Long.parseLong(id)); } + + @Override + public ListPager querySysMessageByPager(SysMessage sysMessage, Pager pager) { + LOGGER.info("消息 SYS_MESSAGE SysMessage:{},Pager:{}",sysMessage,pager); + if(sysMessage == null) { + pager = PagerHelper.getPager(pager, sysMessageRDao.listCount()); + return new ListPager(sysMessageRDao.listPager(pager),pager); + }else { + String hqlPack = CoreHqlPack.packHqlSysMessage(sysMessage); + pager = PagerHelper.getPager(pager, sysMessageRDao.findByHqlWhereCount(hqlPack)); + return new ListPager(sysMessageRDao.findByHqlWherePage(hqlPack + sysMessage.orderBy(),pager),pager); + } + } } diff --git a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/ToolServiceImpl.java b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/ToolService.java similarity index 96% rename from modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/ToolServiceImpl.java rename to modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/ToolService.java index f79488a..f2e040a 100644 --- a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/ToolServiceImpl.java +++ b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/ToolService.java @@ -5,7 +5,6 @@ import cn.estsh.i3plus.pojo.base.bean.ListPager; import cn.estsh.i3plus.pojo.base.common.Pager; import cn.estsh.i3plus.pojo.base.common.PagerHelper; import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; -import cn.estsh.i3plus.pojo.platform.bean.Organize; import cn.estsh.i3plus.pojo.platform.bean.Tool; import cn.estsh.i3plus.pojo.platform.bean.ToolType; import cn.estsh.i3plus.pojo.platform.repository.ToolRepository; @@ -27,8 +26,8 @@ import java.util.List; * @Modify : **/ @Service -public class ToolServiceImpl implements IToolService { - public static final Logger LOGGER = LoggerFactory.getLogger(ToolServiceImpl.class); +public class ToolService implements IToolService { + public static final Logger LOGGER = LoggerFactory.getLogger(ToolService.class); @Autowired private ToolRepository toolRDao; diff --git a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/ToolTypeServiceImpl.java b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/ToolTypeService.java similarity index 94% rename from modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/ToolTypeServiceImpl.java rename to modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/ToolTypeService.java index 41005be..a50b2b8 100644 --- a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/ToolTypeServiceImpl.java +++ b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/ToolTypeService.java @@ -1,19 +1,16 @@ package cn.estsh.i3plus.core.apiservice.serviceimpl.busi; -import cn.estsh.i3plus.core.api.iservice.busi.IToolService; import cn.estsh.i3plus.core.api.iservice.busi.IToolTypeService; import cn.estsh.i3plus.pojo.base.bean.ListPager; import cn.estsh.i3plus.pojo.base.common.Pager; import cn.estsh.i3plus.pojo.base.common.PagerHelper; import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; -import cn.estsh.i3plus.pojo.platform.bean.Organize; import cn.estsh.i3plus.pojo.platform.bean.ToolType; import cn.estsh.i3plus.pojo.platform.repository.ToolRepository; import cn.estsh.i3plus.pojo.platform.repository.ToolTypeRepository; import cn.estsh.i3plus.pojo.platform.sqlpack.CoreHqlPack; import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder; import cn.estsh.impp.framework.boot.exception.ImppExceptionEnum; -import cn.estsh.impp.framework.boot.util.ValidatorBean; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -29,8 +26,8 @@ import java.util.List; * @Modify : **/ @Service -public class ToolTypeServiceImpl implements IToolTypeService { - public static final Logger LOGGER = LoggerFactory.getLogger(ToolTypeServiceImpl.class); +public class ToolTypeService implements IToolTypeService { + public static final Logger LOGGER = LoggerFactory.getLogger(ToolTypeService.class); @Autowired private ToolTypeRepository toolTypeRDao; diff --git a/modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestMessageServiceImpl.java b/modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestMessageServiceImpl.java new file mode 100644 index 0000000..36fade5 --- /dev/null +++ b/modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestMessageServiceImpl.java @@ -0,0 +1,111 @@ +package cn.estsh.i3plus.core.apiservice.serviceimpl.busi; + +import cn.estsh.i3plus.core.api.iservice.busi.ISysMessageService; +import cn.estsh.i3plus.core.api.iservice.busi.ISysMessageService; +import cn.estsh.i3plus.pojo.base.bean.ListPager; +import cn.estsh.i3plus.pojo.base.common.Pager; +import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; +import cn.estsh.i3plus.pojo.base.enumutil.ImppEnumUtil; +import cn.estsh.i3plus.pojo.platform.bean.SysMessage; +import com.alibaba.fastjson.JSON; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.annotation.Rollback; + +import javax.transaction.Transactional; +import java.util.List; + +/** + * @Description : 测试 消息服务接口 + * @Reference : + * @Author : yunhao + * @Date : 2018-10-31 15:30 + * @Modify : + **/ +public class TestMessageServiceImpl extends TestBase { + + @Autowired + ISysMessageService sysMessageService; + + /** + * 测试 查询所有消息 + */ + @Test + @Transactional + public void testListSysMessage() { + List list = sysMessageService.listSysMessage(); + System.out.println(JSON.toJSONString(list)); + } + + /** + * 测试 根据id查询消息 + */ + @Test + @Transactional + public void testGetSysMessageById() { + SysMessage sysMessage = sysMessageService.getSysMessageById("1057110061127700480"); + System.out.println(JSON.toJSONString(sysMessage)); + } + + /** + * 测试 添加消息 + */ + @Test + @Transactional + @Rollback(false) + public void testInsertSysMessage() { + SysMessage sysMessage = new SysMessage(); + sysMessage.setMessageTitle("test-系统通知"); + sysMessage.setRedSendName("system"); + sysMessage.setMessageSendId(-1L); + sysMessage.setRedMessageRecipientName("admin"); + sysMessage.setMessageRecipientId(-1L); + sysMessage.setMessageTypeId(ImppEnumUtil.USER_MESSAGE_TYPE.NOTICE.getValue()); + sysMessage.setMessageStatusId(ImppEnumUtil.USER_MESSAGE_STATUS.UNREAD.getValue()); + sysMessage.setCreateDatetime("2018-11-01 16:58:00"); + + for (int i = 0; i < 50; i++) { + sysMessage.setId(null); + sysMessage.setMessageTitle("test-系统通知" + i); + sysMessageService.insertSysMessage(sysMessage); + } + System.out.println(JSON.toJSONString(sysMessage)); + } + + /** + * 测试 修改消息 + */ + @Test + @Transactional + public void testUpdateSysMessage(){ + SysMessage sysMessage = sysMessageService.getSysMessageById("1057110613261684736"); + sysMessage.setMessageTitle("测试修改"); + + sysMessageService.updateSysMessage(sysMessage); + } + + /** + * 测试 根据id删除消息 + */ + @Test + @Transactional + public void testDeleteSysMessageById(){ + sysMessageService.deleteSysMessageById("1057111616417566720"); + } + + /** + * 测试 复杂查询 + */ + @Test + @Transactional + public void testQuerySysMessageByPager(){ + SysMessage sysMessage = new SysMessage(); + + Pager pager = new Pager(); + pager.setPageSize(10); + pager.setCurrentPage(5); + + ListPager list = sysMessageService.querySysMessageByPager(sysMessage,pager); + System.out.println(list); + } +} diff --git a/modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestSysConfigServiceImpl.java b/modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestSysConfigService.java similarity index 97% rename from modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestSysConfigServiceImpl.java rename to modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestSysConfigService.java index 8ecc87b..32db391 100644 --- a/modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestSysConfigServiceImpl.java +++ b/modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestSysConfigService.java @@ -19,7 +19,7 @@ import java.util.List; * @Date : 2018-10-30 10:49 * @Modify : **/ -public class TestSysConfigServiceImpl extends TestBase { +public class TestSysConfigService extends TestBase { @Autowired private ISysConfigService sysConfigService; diff --git a/modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestSysDictionaryServiceImpl.java b/modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestSysDictionaryService.java similarity index 97% rename from modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestSysDictionaryServiceImpl.java rename to modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestSysDictionaryService.java index 58ba7be..5fee332 100644 --- a/modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestSysDictionaryServiceImpl.java +++ b/modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestSysDictionaryService.java @@ -19,7 +19,7 @@ import java.util.List; * @Date : 2018-10-30 18:52 * @Modify : **/ -public class TestSysDictionaryServiceImpl extends TestBase { +public class TestSysDictionaryService extends TestBase { @Autowired private ISysDictionaryService sysDictionaryService; diff --git a/modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestToolServiceImpl.java b/modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestToolService.java similarity index 98% rename from modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestToolServiceImpl.java rename to modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestToolService.java index 3c8f330..cc14785 100644 --- a/modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestToolServiceImpl.java +++ b/modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestToolService.java @@ -22,7 +22,7 @@ import java.util.List; * @Date : 2018-10-31 15:30 * @Modify : **/ -public class TestToolServiceImpl extends TestBase { +public class TestToolService extends TestBase { @Autowired IToolService toolService; diff --git a/modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestToolTypeServiceImpl.java b/modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestToolTypeService.java similarity index 97% rename from modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestToolTypeServiceImpl.java rename to modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestToolTypeService.java index 4a58fa4..01e9fd1 100644 --- a/modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestToolTypeServiceImpl.java +++ b/modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestToolTypeService.java @@ -20,7 +20,7 @@ import java.util.List; * @Date : 2018-10-30 20:36 * @Modify : **/ -public class TestToolTypeServiceImpl extends TestBase { +public class TestToolTypeService extends TestBase { @Autowired private IToolTypeService toolTypeService; From e82f083239331c4c27d45a13886c730ca087c089 Mon Sep 17 00:00:00 2001 From: "wei.peng" Date: Thu, 1 Nov 2018 21:20:35 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E6=9D=83=E9=99=90?= =?UTF-8?q?=E7=AE=A1=E7=90=86=20=E7=B3=BB=E7=BB=9F=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/api/iservice/busi/ISysRoleService.java | 8 ++ .../controller/busi/OrganizeController.java | 2 - .../controller/busi/SysMenuController.java | 9 +- .../controller/busi/SysRoleController.java | 42 ++++++++- .../apiservice/controller/busi/ToolController.java | 4 +- .../apiservice/controller/busi/TreeController.java | 42 ++++++++- .../serviceimpl/busi/DepartmentServiceImpl.java | 9 +- .../serviceimpl/busi/OrganizeServiceImpl.java | 2 +- .../serviceimpl/busi/PositionServiceImpl.java | 10 +- ...SysMenuServiceImpl.java => SysMenuService.java} | 8 +- .../serviceimpl/busi/SysRoleServiceImpl.java | 9 ++ .../serviceimpl/busi/ToolTypeServiceImpl.java | 5 +- ...ServiceImpl.java => TestDepartmentService.java} | 2 +- ...zeServiceImpl.java => TestOrganizeService.java} | 2 +- ...onServiceImpl.java => TestPositionService.java} | 2 +- .../serviceimpl/busi/TestSysMenuService.java | 102 +++++++++++++++++++++ 16 files changed, 222 insertions(+), 36 deletions(-) rename modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/{SysMenuServiceImpl.java => SysMenuService.java} (94%) rename modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/{TestDepartmentServiceImpl.java => TestDepartmentService.java} (98%) rename modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/{TestOrganizeServiceImpl.java => TestOrganizeService.java} (98%) rename modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/{TestPositionServiceImpl.java => TestPositionService.java} (98%) create mode 100644 modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestSysMenuService.java diff --git a/modules/i3plus-core-api/src/main/java/cn/estsh/i3plus/core/api/iservice/busi/ISysRoleService.java b/modules/i3plus-core-api/src/main/java/cn/estsh/i3plus/core/api/iservice/busi/ISysRoleService.java index d65af2b..2dcc28f 100644 --- a/modules/i3plus-core-api/src/main/java/cn/estsh/i3plus/core/api/iservice/busi/ISysRoleService.java +++ b/modules/i3plus-core-api/src/main/java/cn/estsh/i3plus/core/api/iservice/busi/ISysRoleService.java @@ -35,6 +35,14 @@ public interface ISysRoleService { void updateSysRoleStatus(String id, int status, SessionUser user); /** + * 批量修改状态 + * @param ids + * @param status + * @param user + */ + void updateSysRoleStatusByIds(String[] ids, int status, SessionUser user); + + /** * 根据Key 删除数据 * @param id */ diff --git a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/busi/OrganizeController.java b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/busi/OrganizeController.java index c5d9c18..b5f51d7 100644 --- a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/busi/OrganizeController.java +++ b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/busi/OrganizeController.java @@ -42,7 +42,6 @@ public class OrganizeController { @PostMapping(value = "/insert") @ApiOperation(value = "新增组织", notes = "组织") public ResultBean insertOrganize(Organize organize) { - ; try { //条件验证 ValidatorBean.beginValid(organize) @@ -187,7 +186,6 @@ public class OrganizeController { public ResultBean deleteOrganizeByIds(String[] ids){ try{ if(ids.length == 0){ - throw ImppExceptionBuilder.newInstance() .setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode()) .setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode()) diff --git a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/busi/SysMenuController.java b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/busi/SysMenuController.java index 4c02db7..69c2eff 100644 --- a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/busi/SysMenuController.java +++ b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/busi/SysMenuController.java @@ -4,6 +4,7 @@ import cn.estsh.i3plus.platform.common.convert.ConvertBean; import cn.estsh.i3plus.pojo.base.bean.ListPager; import cn.estsh.i3plus.pojo.base.common.Pager; + import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil; import cn.estsh.i3plus.pojo.platform.bean.Organize; import cn.estsh.i3plus.pojo.platform.bean.SysMenu; @@ -49,6 +50,9 @@ public class SysMenuController { //新增初始化 ConvertBean.modelInitialize(menu, AuthUtil.getSessionUser()); + if(menu.getParentId() == null || menu.getParentId().intValue() == 0){ + menu.setParentId(CommonEnumUtil.PARENT.DEFAULT.getValue()); + } menu = sysMenuService.insertSysMenu(menu); return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultObject(menu); @@ -122,6 +126,7 @@ public class SysMenuController { public ResultBean queryPosition(SysMenu menu, Pager pager){ try{ ListPager listPager = sysMenuService.querySysMenu(menu, pager); + return ResultBean.success("操作成功").setListPager(listPager) .setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()); }catch(ImppBusiException busExcep){ @@ -133,7 +138,6 @@ public class SysMenuController { } } - @GetMapping(value = "/get/{id}") @ApiOperation(value = "查询系统功能", notes = "查询根据ID查询系统功能") public ResultBean getById(@PathVariable("id") String id) { @@ -184,7 +188,8 @@ public class SysMenuController { ValidatorBean.checkNotZero(status, "功能状态不能为空"); sysMenuService.updateSysMenuStatusByIds(ids,status,AuthUtil.getSessionUser()); - return new ResultBean(true); + + return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()); } catch(ImppBusiException busExcep){ LOGGER.error(busExcep.getErrorMsg() + ":{}",busExcep.getErrorDetail(),busExcep); return ResultBean.fail(busExcep.getErrorShow()); diff --git a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/busi/SysRoleController.java b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/busi/SysRoleController.java index be6648a..2fa1a3e 100644 --- a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/busi/SysRoleController.java +++ b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/busi/SysRoleController.java @@ -2,8 +2,11 @@ package cn.estsh.i3plus.core.apiservice.controller.busi; import cn.estsh.i3plus.core.api.iservice.busi.ISysRoleService; import cn.estsh.i3plus.platform.common.convert.ConvertBean; +import cn.estsh.i3plus.pojo.base.bean.ListPager; +import cn.estsh.i3plus.pojo.base.common.Pager; import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil; import cn.estsh.i3plus.pojo.platform.bean.SessionUser; +import cn.estsh.i3plus.pojo.platform.bean.SysMenu; import cn.estsh.i3plus.pojo.platform.bean.SysRole; import cn.estsh.impp.framework.boot.auth.AuthUtil; import cn.estsh.impp.framework.boot.exception.ImppBusiException; @@ -115,6 +118,23 @@ public class SysRoleController { } } + @GetMapping(value="/query") + @ApiOperation(value="查询所有角色",notes="查询所有角色") + public ResultBean querySysRole(SysRole role, Pager pager){ + try{ + ListPager listPager = sysRoleService.querySysRole(role, pager); + + return ResultBean.success("操作成功").setListPager(listPager) + .setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()); + }catch(ImppBusiException busExcep){ + LOGGER.error(busExcep.getErrorMsg() + ":{}",busExcep.getErrorDetail(),busExcep); + return ResultBean.fail(busExcep.getErrorShow()); + }catch(Exception e){ + LOGGER.error(ImppExceptionEnum.SYSTEM_EXCEPTION.getDescription() + ":{}",e.getMessage(),e); + return ResultBean.fail().setCode(ImppExceptionEnum.SYSTEM_EXCEPTION.getCode()); + } + } + @GetMapping(value = "/get/{id}") @ApiOperation(value = "查询系统角色", notes = "查询根据ID查询系统角色") public ResultBean getById(@PathVariable("id") String id) { @@ -137,7 +157,7 @@ public class SysRoleController { } @PutMapping(value = "/status") - @ApiOperation(value = "修改权限状态", notes = "根据ID修改权限状态") + @ApiOperation(value = "修改角色状态", notes = "根据ID修改角色状态") public ResultBean updateStatus(String id, int status) { try { // 数据校验 @@ -154,4 +174,24 @@ public class SysRoleController { return ResultBean.fail().setCode(ImppExceptionEnum.BUSINESS_EXCEPTION_DATA_ERROR.getCode()); } } + + @PutMapping(value = "/batch-status") + @ApiOperation(value = "批量修改系统角色状态", notes = "根据ID修改系统角色状态") + public ResultBean updateBatchStatus(String[] ids,int status) { + try { + // 数据校验 + ValidatorBean.checkNotNull(ids, "角色id 不能为空"); + ValidatorBean.checkNotZero(status, "角色状态不能为空"); + + sysRoleService.updateSysRoleStatusByIds(ids,status,AuthUtil.getSessionUser()); + + return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()); + } catch(ImppBusiException busExcep){ + LOGGER.error(busExcep.getErrorMsg() + ":{}",busExcep.getErrorDetail(),busExcep); + return ResultBean.fail(busExcep.getErrorShow()); + }catch(Exception e){ + LOGGER.error(ImppExceptionEnum.BUSINESS_EXCEPTION_DATA_ERROR.getDescription() + ":{}",e.getMessage(),e); + return ResultBean.fail().setCode(ImppExceptionEnum.BUSINESS_EXCEPTION_DATA_ERROR.getCode()); + } + } } diff --git a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/busi/ToolController.java b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/busi/ToolController.java index 0e2d366..bc84bf6 100644 --- a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/busi/ToolController.java +++ b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/busi/ToolController.java @@ -178,9 +178,9 @@ public class ToolController { } } - @PutMapping(value = "/update/status/enable") + @PutMapping(value = "/status") @ApiOperation(value = "硬件类型启用",notes = "硬件类型禁用") - public ResultBean updateStatusEnable(String id){ + public ResultBean updateStatusEnable(String id,Integer status){ try { toolService.updateStatusEnable(id); return ResultBean.success("操作成功") diff --git a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/busi/TreeController.java b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/busi/TreeController.java index ee477d3..18ef4a1 100644 --- a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/busi/TreeController.java +++ b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/busi/TreeController.java @@ -6,6 +6,7 @@ import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil; import cn.estsh.i3plus.pojo.platform.bean.Department; import cn.estsh.i3plus.pojo.platform.bean.Organize; import cn.estsh.i3plus.pojo.platform.bean.Position; +import cn.estsh.i3plus.pojo.platform.bean.SysMenu; import cn.estsh.impp.framework.boot.exception.ImppBusiException; import cn.estsh.impp.framework.boot.exception.ImppExceptionEnum; import cn.estsh.impp.framework.boot.util.ResultBean; @@ -120,7 +121,7 @@ public class TreeController { try { Department obj = coreTreeService.getDepartmentTreeByParentId(id); - return ResultBean.success("查询部门树成功") + return ResultBean.success("查询部门树成功") .setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()) .setResultObject(obj); }catch(ImppBusiException busExcep){ @@ -132,7 +133,6 @@ public class TreeController { } } - @GetMapping(value="/department/list/{parentId}") @ApiOperation(value="查询组织树",notes="通过部门主键获取组织树,-1为根节点") public ResultBean listDepartmentListTree(@PathVariable("parentId") long parentId) { @@ -150,4 +150,42 @@ public class TreeController { return ResultBean.fail().setCode(ImppExceptionEnum.SYSTEM_EXCEPTION.getCode()); } } + + + @GetMapping(value="/sys-menu/get/{id}") + @ApiOperation(value="部门树",notes="通过部门主键获取部门树,-1为根节点") + public ResultBean listSysMenuTree(@PathVariable("id") long id) { + try { + SysMenu obj = coreTreeService.getSysMenuTreeByParentId(id); + + return ResultBean.success("查询部门树成功") + .setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()) + .setResultObject(obj); + }catch(ImppBusiException busExcep){ + LOGGER.error(busExcep.getErrorMsg() + ":{}",busExcep.getErrorDetail(),busExcep); + return ResultBean.fail(busExcep.getErrorShow()); + }catch(Exception e){ + LOGGER.error(ImppExceptionEnum.SYSTEM_EXCEPTION.getDescription() + ":{}",e.getMessage(),e); + return ResultBean.fail().setCode(ImppExceptionEnum.SYSTEM_EXCEPTION.getCode()); + } + } + + @GetMapping(value="/sys-menu/list/{parentId}") + @ApiOperation(value="查询组织树",notes="通过部门主键获取组织树,-1为根节点") + public ResultBean listSysMenuListTree(@PathVariable("parentId") long parentId) { + try { + List resultList = coreTreeService.findSysMenuTreeByParentId(parentId); + + return ResultBean.success("查询部门树成功") + .setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()) + .setResultList(resultList); + }catch(ImppBusiException busExcep){ + LOGGER.error(busExcep.getErrorMsg() + ":{}",busExcep.getErrorDetail(),busExcep); + return ResultBean.fail(busExcep.getErrorShow()); + }catch(Exception e){ + LOGGER.error(ImppExceptionEnum.SYSTEM_EXCEPTION.getDescription() + ":{}",e.getMessage(),e); + return ResultBean.fail().setCode(ImppExceptionEnum.SYSTEM_EXCEPTION.getCode()); + } + } + } diff --git a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/DepartmentServiceImpl.java b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/DepartmentServiceImpl.java index 7689861..67d7662 100644 --- a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/DepartmentServiceImpl.java +++ b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/DepartmentServiceImpl.java @@ -39,7 +39,6 @@ public class DepartmentServiceImpl implements IDepartmentService { @Override public Department insertDepartment(Department department) { - // 查询父级部门名称 if (department.getParentId() != null && department.getParentId().intValue() > 0) { LOGGER.info("部门信息 DEPARTMENT :{}", department.getParentId()); Department parentPosition = departmentRDao.getById(department.getParentId()); @@ -48,14 +47,12 @@ public class DepartmentServiceImpl implements IDepartmentService { department.setRedParentName(parentPosition.getName()); } - // 查询所属组织名称 LOGGER.info("组织信息 ORGANIZE :{}", department.getOrganizeId()); Organize organize = organizeRDao.getById(department.getOrganizeId()); ValidatorBean.checkNotNull(organize); department.setRedOrganizeName(organize.getName()); - // 新增部门 LOGGER.info("部门信息 DEPARTMENT {}",department); return departmentRDao.insert(department); } @@ -66,7 +63,7 @@ public class DepartmentServiceImpl implements IDepartmentService { LOGGER.info("部门信息 DEPARTMENT :{}", id); if (departmentRDao.findByPropertyCount("parentId",Long.parseLong(id)) > 0) { throw ImppExceptionBuilder.newInstance() - .setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode()) + .setSystemID(CommonEnumUtil.SOFT_TYPE.WMS.getCode()) .setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode()) .setErrorDetail("存在子节点无法删除!") .setErrorSolution("请重新操作") @@ -93,7 +90,7 @@ public class DepartmentServiceImpl implements IDepartmentService { for (int i = 0; i < ids.length; i++) { array[i] = Long.parseLong(ids[i]); } - departmentRDao.deleteByIdIn(array); + departmentRDao.deleteByIds(array); } } @@ -128,7 +125,7 @@ public class DepartmentServiceImpl implements IDepartmentService { @Override public ListPager queryDepartment(Department department, Pager pager) { - LOGGER.info("部门 Department find menu :{} department :{}", department, pager); + LOGGER.info("部门 Department find department :{} page:{}", department, pager); if (department == null) { //不传入实体对象,查询所有 diff --git a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/OrganizeServiceImpl.java b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/OrganizeServiceImpl.java index 6afaa84..6494ac8 100644 --- a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/OrganizeServiceImpl.java +++ b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/OrganizeServiceImpl.java @@ -87,7 +87,7 @@ public class OrganizeServiceImpl implements IOrganizeService { for (int i = 0; i < ids.length; i++) { array[i] = Long.parseLong(ids[i]); } - organizeRDao.deleteByIdIn(array); + organizeRDao.deleteByIds(array); } } diff --git a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/PositionServiceImpl.java b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/PositionServiceImpl.java index 3c1cf2e..69a250c 100644 --- a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/PositionServiceImpl.java +++ b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/PositionServiceImpl.java @@ -5,25 +5,17 @@ import cn.estsh.i3plus.pojo.base.bean.ListPager; import cn.estsh.i3plus.pojo.base.common.Pager; import cn.estsh.i3plus.pojo.base.common.PagerHelper; import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; -import cn.estsh.i3plus.pojo.base.tool.HqlPack; import cn.estsh.i3plus.pojo.platform.bean.Position; import cn.estsh.i3plus.pojo.platform.repository.PositionRepository; import cn.estsh.i3plus.pojo.platform.sqlpack.CoreHqlPack; import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder; import cn.estsh.impp.framework.boot.exception.ImppExceptionEnum; -import cn.estsh.impp.framework.boot.util.ResultBean; import cn.estsh.impp.framework.boot.util.ValidatorBean; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.domain.Page; import org.springframework.stereotype.Service; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestParam; -import java.lang.reflect.Array; -import java.util.ArrayList; -import java.util.Arrays; import java.util.List; /** @@ -106,7 +98,7 @@ public class PositionServiceImpl implements IPositionService { for (int i = 0; i < ids.length; i++) { array[i] = Long.parseLong(ids[i]); } - positionRDao.deleteByIdIn(array); + positionRDao.deleteByIds(array); } } diff --git a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/SysMenuServiceImpl.java b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/SysMenuService.java similarity index 94% rename from modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/SysMenuServiceImpl.java rename to modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/SysMenuService.java index 4ef57f6..ca13357 100644 --- a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/SysMenuServiceImpl.java +++ b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/SysMenuService.java @@ -27,9 +27,9 @@ import java.util.List; * @Modify : **/ @Service -public class SysMenuServiceImpl implements ISysMenuService { +public class SysMenuService implements ISysMenuService { - public static final Logger LOGGER = LoggerFactory.getLogger(SysMenuServiceImpl.class); + public static final Logger LOGGER = LoggerFactory.getLogger(SysMenuService.class); @Autowired private SysMenuRepository sysMenuRDao; @@ -55,7 +55,7 @@ public class SysMenuServiceImpl implements ISysMenuService { StringBuffer where = new StringBuffer(); HqlPack.getInPack(String.join(",", ids), "id", where); - sysMenuRDao.updateByHqlWhere(where.toString(), "status", status); + sysMenuRDao.updateByHqlWhere(where.toString(), "menuStatus", status); } @Override @@ -77,7 +77,7 @@ public class SysMenuServiceImpl implements ISysMenuService { @Override public SysMenu insertSysMenu(SysMenu sysMenu) { LOGGER.info("系统功能 SYS_MENU :{}", sysMenu); - if(0 != sysMenu.getParentId()){ + if (sysMenu.getParentId() != null && sysMenu.getParentId().intValue() > 0) { SysMenu parent = sysMenuRDao.getById(sysMenu.getParentId()); if(null != parent){ sysMenu.setRedParentName(parent.getName()); diff --git a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/SysRoleServiceImpl.java b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/SysRoleServiceImpl.java index 0d77c31..585ede8 100644 --- a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/SysRoleServiceImpl.java +++ b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/SysRoleServiceImpl.java @@ -5,6 +5,7 @@ import cn.estsh.i3plus.pojo.base.bean.ListPager; import cn.estsh.i3plus.pojo.base.common.Pager; import cn.estsh.i3plus.pojo.base.common.PagerHelper; import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; +import cn.estsh.i3plus.pojo.base.tool.HqlPack; import cn.estsh.i3plus.pojo.platform.bean.SessionUser; import cn.estsh.i3plus.pojo.platform.bean.SysRole; import cn.estsh.i3plus.pojo.platform.repository.SysRoleRepository; @@ -46,7 +47,15 @@ public class SysRoleServiceImpl implements ISysRoleService { role.setRoleStatusId(status); role.setModifyUser(user.getUserName()); sysRoleRDao.update(role); + } + + @Override + public void updateSysRoleStatusByIds(String[] ids, int status, SessionUser user) { + LOGGER.info("系统功能 SYS_MENU ids:{} status:{} user:{}", ids, status, user); + StringBuffer where = new StringBuffer(); + HqlPack.getInPack(String.join(",", ids), "id", where); + sysRoleRDao.updateByHqlWhere(where.toString(), "roleStatusId", status); } @Override diff --git a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/ToolTypeServiceImpl.java b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/ToolTypeServiceImpl.java index 41005be..ab5ae22 100644 --- a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/ToolTypeServiceImpl.java +++ b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/ToolTypeServiceImpl.java @@ -1,19 +1,16 @@ package cn.estsh.i3plus.core.apiservice.serviceimpl.busi; -import cn.estsh.i3plus.core.api.iservice.busi.IToolService; import cn.estsh.i3plus.core.api.iservice.busi.IToolTypeService; import cn.estsh.i3plus.pojo.base.bean.ListPager; import cn.estsh.i3plus.pojo.base.common.Pager; import cn.estsh.i3plus.pojo.base.common.PagerHelper; import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; -import cn.estsh.i3plus.pojo.platform.bean.Organize; import cn.estsh.i3plus.pojo.platform.bean.ToolType; import cn.estsh.i3plus.pojo.platform.repository.ToolRepository; import cn.estsh.i3plus.pojo.platform.repository.ToolTypeRepository; import cn.estsh.i3plus.pojo.platform.sqlpack.CoreHqlPack; import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder; import cn.estsh.impp.framework.boot.exception.ImppExceptionEnum; -import cn.estsh.impp.framework.boot.util.ValidatorBean; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -107,7 +104,7 @@ public class ToolTypeServiceImpl implements IToolTypeService { for (int i = 0; i < ids.length; i++) { array[i] = Long.parseLong(ids[i]); } - toolTypeRDao.deleteByIdIn(array); + toolTypeRDao.deleteByIds(array); } } } diff --git a/modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestDepartmentServiceImpl.java b/modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestDepartmentService.java similarity index 98% rename from modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestDepartmentServiceImpl.java rename to modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestDepartmentService.java index 96e6e3a..af280da 100644 --- a/modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestDepartmentServiceImpl.java +++ b/modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestDepartmentService.java @@ -20,7 +20,7 @@ import java.util.List; * @Date : 2018-10-29 19:02 * @Modify : **/ -public class TestDepartmentServiceImpl extends TestBase { +public class TestDepartmentService extends TestBase { @Autowired private IDepartmentService departmentService; diff --git a/modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestOrganizeServiceImpl.java b/modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestOrganizeService.java similarity index 98% rename from modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestOrganizeServiceImpl.java rename to modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestOrganizeService.java index 0e55dfa..b84be11 100644 --- a/modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestOrganizeServiceImpl.java +++ b/modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestOrganizeService.java @@ -20,7 +20,7 @@ import java.util.List; * @Date : 2018-10-29 19:02 * @Modify : **/ -public class TestOrganizeServiceImpl extends TestBase { +public class TestOrganizeService extends TestBase { @Autowired private IOrganizeService organizeService; diff --git a/modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestPositionServiceImpl.java b/modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestPositionService.java similarity index 98% rename from modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestPositionServiceImpl.java rename to modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestPositionService.java index 03f85d9..0eacb1d 100644 --- a/modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestPositionServiceImpl.java +++ b/modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestPositionService.java @@ -20,7 +20,7 @@ import java.util.List; * @Date : 2018-10-29 19:02 * @Modify : **/ -public class TestPositionServiceImpl extends TestBase { +public class TestPositionService extends TestBase { @Autowired private IPositionService positionService; diff --git a/modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestSysMenuService.java b/modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestSysMenuService.java new file mode 100644 index 0000000..e7277b9 --- /dev/null +++ b/modules/i3plus-core-apiservice/src/test/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/TestSysMenuService.java @@ -0,0 +1,102 @@ +package cn.estsh.i3plus.core.apiservice.serviceimpl.busi; + +import cn.estsh.i3plus.core.api.iservice.busi.ISysMenuService; +import cn.estsh.i3plus.pojo.platform.bean.Organize; +import cn.estsh.i3plus.pojo.platform.bean.SysMenu; +import com.alibaba.fastjson.JSON; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.annotation.Rollback; + +import javax.transaction.Transactional; +import java.util.List; + +/** + * @Description : + * @Reference : + * @Author : wei.peng + * @Date : 2018-11-01 11:58 + * @Modify : + **/ +public class TestSysMenuService extends TestBase { + + @Autowired + private ISysMenuService sysMenuService; + + + /** + * 修改数据 + */ + @Test + public void testUpdateSysMenu() { + + } + + /** + * 修改权限状态 + */ + @Test + public void testUpdateSysMenuStatus() { + + } + + /** + * 批量修改状态 + */ + @Test + public void testUpdateSysMenuStatusByIds() { + + } + + /** + * 根据Key 删除数据 + */ + @Test + public void testDeleteSysMenuById() { + + } + + /** + * 新增数据 + */ + @Test + @Transactional + @Rollback(false) + public void testInsertSysMenu() { + for(int i = 0 ; i < 50 ; i++ ){ + SysMenu obj = new SysMenu(); + obj.setName("Junit Test " + i); + obj.setMenuCode("TEST_JUNIT " + i); + obj.setParentId(-1L); + obj = sysMenuService.insertSysMenu(obj); + System.out.println(JSON.toJSONString(obj)); + } + } + + /** + * 查询所有数据 + */ + @Test + public void testFindSysMenuAll() { + List list = sysMenuService.findSysMenuAll(); + System.out.println(JSON.toJSONString(list)); + } + + /** + * 根据id 数据 + */ + @Test + public void testGetSysMenuById() { + SysMenu menu = sysMenuService.getSysMenuById("1057844135052054528"); + System.out.println(JSON.toJSONString(menu)); + } + + /** + * 复杂查询 + */ + @Test + public void testQuerySysMenu() { + + } + +}