From eee3dd9e5f04de30ec1f2bbe0062890a00731e2b Mon Sep 17 00:00:00 2001 From: qi_liang Date: Wed, 18 Sep 2019 09:52:37 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=87=E7=94=A8jdk8=E6=96=B0=E7=89=B9?= =?UTF-8?q?=E6=95=88=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cms/service/impl/SysLogServiceImpl.java | 2 +- .../impl/SysPermissionServiceImpl.java | 18 ++++++++++------- .../service/impl/SysResourceServiceImpl.java | 8 +++++--- .../SysRoleResourcePermissionServiceImpl.java | 20 ++++++++++--------- .../cms/service/impl/SysRoleServiceImpl.java | 2 +- .../service/impl/SysUserRoleServiceImpl.java | 2 +- .../cms/service/impl/SysUserServiceImpl.java | 2 +- .../service/impl/WechatInfoServiceImpl.java | 2 +- 8 files changed, 32 insertions(+), 24 deletions(-) diff --git a/src/main/java/com/lq/cms/service/impl/SysLogServiceImpl.java b/src/main/java/com/lq/cms/service/impl/SysLogServiceImpl.java index 5e3e398..c5a807a 100755 --- a/src/main/java/com/lq/cms/service/impl/SysLogServiceImpl.java +++ b/src/main/java/com/lq/cms/service/impl/SysLogServiceImpl.java @@ -15,7 +15,7 @@ import java.util.List; * Created by qi_liang on 2018/6/21. */ @Service -public class SysLogServiceImpl extends BaseServiceImpl implements SysLogService { +public class SysLogServiceImpl implements SysLogService { @Autowired private SysLogDao sysLogDao; diff --git a/src/main/java/com/lq/cms/service/impl/SysPermissionServiceImpl.java b/src/main/java/com/lq/cms/service/impl/SysPermissionServiceImpl.java index 6310155..daef001 100644 --- a/src/main/java/com/lq/cms/service/impl/SysPermissionServiceImpl.java +++ b/src/main/java/com/lq/cms/service/impl/SysPermissionServiceImpl.java @@ -19,6 +19,7 @@ import org.springframework.stereotype.Service; import java.util.Date; import java.util.List; +import java.util.Optional; /** * @Author: qi @@ -26,7 +27,7 @@ import java.util.List; * @Date: Create in 12:06 AM 2019/7/23 */ @Service -public class SysPermissionServiceImpl extends BaseServiceImpl implements SysPermissionService{ +public class SysPermissionServiceImpl implements SysPermissionService{ @Autowired private SysPermissionDao sysPermissionDao; @@ -39,20 +40,23 @@ public class SysPermissionServiceImpl extends BaseServiceImpl imp public List findListPage(SysPermissionVo vo) { List sysPermissionVos = sysPermissionDao.findListPage(vo); sysPermissionVos.forEach(sysPermissionVo1->{ - if (sysPermissionVo1.getSysResourceId()!=null) { - SysResource sysResource = sysResourceDao.findOne(sysPermissionVo1.getSysResourceId()); + Optional sysResourceIdOptional = Optional.of(sysPermissionVo1.getSysResourceId()); + if (sysResourceIdOptional.isPresent()) { + SysResource sysResource = sysResourceDao.findOne(sysResourceIdOptional.get()); if (sysResource!=null) { sysPermissionVo1.setSysResourceName(sysResource.getMenuName()); } } - if (sysPermissionVo1.getCreateUserId()!=null) { - SysUser createUser = sysUserDao.findOne(sysPermissionVo1.getCreateUserId()); + Optional createUserIdOptional = Optional.of(sysPermissionVo1.getCreateUserId()); + if (createUserIdOptional.isPresent()) { + SysUser createUser = sysUserDao.findOne(createUserIdOptional.get()); if (createUser!=null) { sysPermissionVo1.setCreateUserName(createUser.getLoginName()); } } - if (sysPermissionVo1.getUpdateUserId()!=null) { - SysUser updateUser = sysUserDao.findOne(sysPermissionVo1.getUpdateUserId()); + Optional updateUserIdOptional = Optional.of(sysPermissionVo1.getUpdateUserId()); + if (updateUserIdOptional.isPresent()) { + SysUser updateUser = sysUserDao.findOne(updateUserIdOptional.get()); if (updateUser!=null) { sysPermissionVo1.setUpdateUserName(updateUser.getLoginName()); } diff --git a/src/main/java/com/lq/cms/service/impl/SysResourceServiceImpl.java b/src/main/java/com/lq/cms/service/impl/SysResourceServiceImpl.java index 2770678..4fc6597 100755 --- a/src/main/java/com/lq/cms/service/impl/SysResourceServiceImpl.java +++ b/src/main/java/com/lq/cms/service/impl/SysResourceServiceImpl.java @@ -52,13 +52,13 @@ public class SysResourceServiceImpl extends BaseServiceImpl impleme @Override public List findMenusListBySysUserId(Long sysUserId, String contextPath) { - Map map=new HashMap(3); + Map map=new HashMap(3); map.put("userId",sysUserId); map.put("parentId", Constant.TOP_PARENT_ID); map.put("permissionId", PermissionTyepEnum.SELECT.getValue()); List menusItmeList=sysResourceDao.findMenu(map); List list=new ArrayList<>(); - for (SysResource sysResource:menusItmeList){ + menusItmeList.forEach(sysResource->{ MenusItem menusItem=new MenusItem(); menusItem.setMenuname(sysResource.getMenuName()); menusItem.setIcon(sysResource.getMenuIco()); @@ -74,7 +74,9 @@ public class SysResourceServiceImpl extends BaseServiceImpl impleme menusItem.add(menus); } list.add(menusItem); - } + + }); + return list; } diff --git a/src/main/java/com/lq/cms/service/impl/SysRoleResourcePermissionServiceImpl.java b/src/main/java/com/lq/cms/service/impl/SysRoleResourcePermissionServiceImpl.java index 744544b..49aa6d0 100755 --- a/src/main/java/com/lq/cms/service/impl/SysRoleResourcePermissionServiceImpl.java +++ b/src/main/java/com/lq/cms/service/impl/SysRoleResourcePermissionServiceImpl.java @@ -27,7 +27,7 @@ import java.util.*; * Created by qi_liang on 2018/6/21. */ @Service -public class SysRoleResourcePermissionServiceImpl extends BaseServiceImpl implements SysRoleResourcePermissionService { +public class SysRoleResourcePermissionServiceImpl implements SysRoleResourcePermissionService { public static final String RESOURCE_SYMBOL = "_"; @@ -128,10 +128,10 @@ public class SysRoleResourcePermissionServiceImpl extends BaseServiceImpl findAllPermissonVo() { List list = new ArrayList<>(); List sysResourceList = sysResourceDao.findAll(); - Iterator iterator = sysResourceList.iterator(); + Iterator iterator = sysResourceList.iterator(); PermissionTyepEnum[] tyepEnums = PermissionTyepEnum.values(); while (iterator.hasNext()){ - SysResource sysResource = (SysResource) iterator.next(); + SysResource sysResource = iterator.next(); if (sysResource!=null){ for (PermissionTyepEnum permissionTyepEnum:tyepEnums){ PermissionVo permissionVo = new PermissionVo(); @@ -151,19 +151,21 @@ public class SysRoleResourcePermissionServiceImpl extends BaseServiceImpl getAttributes(Long resourceId,Long permissionId){ - Map map=new HashMap<>(); + Map map=new HashMap<>(1); map.put(PERMISSIONID_KEY,resourceId+RESOURCE_SYMBOL+permissionId); return map; } diff --git a/src/main/java/com/lq/cms/service/impl/SysRoleServiceImpl.java b/src/main/java/com/lq/cms/service/impl/SysRoleServiceImpl.java index 1505379..3a8ed0e 100755 --- a/src/main/java/com/lq/cms/service/impl/SysRoleServiceImpl.java +++ b/src/main/java/com/lq/cms/service/impl/SysRoleServiceImpl.java @@ -22,7 +22,7 @@ import java.util.Map; * Created by qi_liang on 2018/6/21. */ @Service -public class SysRoleServiceImpl extends BaseServiceImpl implements SysRoleService { +public class SysRoleServiceImpl implements SysRoleService { @Autowired private SysRoleDao sysRoleDao; diff --git a/src/main/java/com/lq/cms/service/impl/SysUserRoleServiceImpl.java b/src/main/java/com/lq/cms/service/impl/SysUserRoleServiceImpl.java index 7b7fab1..5a3c0f5 100755 --- a/src/main/java/com/lq/cms/service/impl/SysUserRoleServiceImpl.java +++ b/src/main/java/com/lq/cms/service/impl/SysUserRoleServiceImpl.java @@ -19,7 +19,7 @@ import java.util.Map; * Created by qi_liang on 2018/6/21. */ @Service -public class SysUserRoleServiceImpl extends BaseServiceImpl implements SysUserRoleService { +public class SysUserRoleServiceImpl implements SysUserRoleService { @Autowired private SysUserRoleDao sysUserRoleDao; diff --git a/src/main/java/com/lq/cms/service/impl/SysUserServiceImpl.java b/src/main/java/com/lq/cms/service/impl/SysUserServiceImpl.java index 8d2c5fa..872eade 100755 --- a/src/main/java/com/lq/cms/service/impl/SysUserServiceImpl.java +++ b/src/main/java/com/lq/cms/service/impl/SysUserServiceImpl.java @@ -18,7 +18,7 @@ import java.util.List; * Created by qi_liang on 2018/6/21. */ @Service -public class SysUserServiceImpl extends BaseServiceImpl implements SysUserService { +public class SysUserServiceImpl implements SysUserService { @Autowired private SysUserDao sysUserDao; diff --git a/src/main/java/com/lq/cms/service/impl/WechatInfoServiceImpl.java b/src/main/java/com/lq/cms/service/impl/WechatInfoServiceImpl.java index 506591a..ff1277b 100755 --- a/src/main/java/com/lq/cms/service/impl/WechatInfoServiceImpl.java +++ b/src/main/java/com/lq/cms/service/impl/WechatInfoServiceImpl.java @@ -15,7 +15,7 @@ import java.util.List; * Created by qi_liang on 2018/6/21. */ @Service -public class WechatInfoServiceImpl extends BaseServiceImpl implements WechatInfoService { +public class WechatInfoServiceImpl implements WechatInfoService { @Autowired private WechatInfoDao wechatInfoDao;