采用jdk8新特效修改

master
星期八 5 years ago
parent a13f590f4b
commit eee3dd9e5f
  1. 2
      src/main/java/com/lq/cms/service/impl/SysLogServiceImpl.java
  2. 18
      src/main/java/com/lq/cms/service/impl/SysPermissionServiceImpl.java
  3. 8
      src/main/java/com/lq/cms/service/impl/SysResourceServiceImpl.java
  4. 20
      src/main/java/com/lq/cms/service/impl/SysRoleResourcePermissionServiceImpl.java
  5. 2
      src/main/java/com/lq/cms/service/impl/SysRoleServiceImpl.java
  6. 2
      src/main/java/com/lq/cms/service/impl/SysUserRoleServiceImpl.java
  7. 2
      src/main/java/com/lq/cms/service/impl/SysUserServiceImpl.java
  8. 2
      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. * Created by qi_liang on 2018/6/21.
*/ */
@Service @Service
public class SysLogServiceImpl extends BaseServiceImpl<SysLog> implements SysLogService { public class SysLogServiceImpl implements SysLogService {
@Autowired @Autowired
private SysLogDao sysLogDao; private SysLogDao sysLogDao;

@ -19,6 +19,7 @@ import org.springframework.stereotype.Service;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Optional;
/** /**
* @Author: qi * @Author: qi
@ -26,7 +27,7 @@ import java.util.List;
* @Date: Create in 12:06 AM 2019/7/23 * @Date: Create in 12:06 AM 2019/7/23
*/ */
@Service @Service
public class SysPermissionServiceImpl extends BaseServiceImpl<SysPermission> implements SysPermissionService{ public class SysPermissionServiceImpl implements SysPermissionService{
@Autowired @Autowired
private SysPermissionDao sysPermissionDao; private SysPermissionDao sysPermissionDao;
@ -39,20 +40,23 @@ public class SysPermissionServiceImpl extends BaseServiceImpl<SysPermission> imp
public List<SysPermissionVo> findListPage(SysPermissionVo vo) { public List<SysPermissionVo> findListPage(SysPermissionVo vo) {
List<SysPermissionVo> sysPermissionVos = sysPermissionDao.findListPage(vo); List<SysPermissionVo> sysPermissionVos = sysPermissionDao.findListPage(vo);
sysPermissionVos.forEach(sysPermissionVo1->{ sysPermissionVos.forEach(sysPermissionVo1->{
if (sysPermissionVo1.getSysResourceId()!=null) { Optional<Long> sysResourceIdOptional = Optional.of(sysPermissionVo1.getSysResourceId());
SysResource sysResource = sysResourceDao.findOne(sysPermissionVo1.getSysResourceId()); if (sysResourceIdOptional.isPresent()) {
SysResource sysResource = sysResourceDao.findOne(sysResourceIdOptional.get());
if (sysResource!=null) { if (sysResource!=null) {
sysPermissionVo1.setSysResourceName(sysResource.getMenuName()); sysPermissionVo1.setSysResourceName(sysResource.getMenuName());
} }
} }
if (sysPermissionVo1.getCreateUserId()!=null) { Optional<Long> createUserIdOptional = Optional.of(sysPermissionVo1.getCreateUserId());
SysUser createUser = sysUserDao.findOne(sysPermissionVo1.getCreateUserId()); if (createUserIdOptional.isPresent()) {
SysUser createUser = sysUserDao.findOne(createUserIdOptional.get());
if (createUser!=null) { if (createUser!=null) {
sysPermissionVo1.setCreateUserName(createUser.getLoginName()); sysPermissionVo1.setCreateUserName(createUser.getLoginName());
} }
} }
if (sysPermissionVo1.getUpdateUserId()!=null) { Optional<Long> updateUserIdOptional = Optional.of(sysPermissionVo1.getUpdateUserId());
SysUser updateUser = sysUserDao.findOne(sysPermissionVo1.getUpdateUserId()); if (updateUserIdOptional.isPresent()) {
SysUser updateUser = sysUserDao.findOne(updateUserIdOptional.get());
if (updateUser!=null) { if (updateUser!=null) {
sysPermissionVo1.setUpdateUserName(updateUser.getLoginName()); sysPermissionVo1.setUpdateUserName(updateUser.getLoginName());
} }

@ -52,13 +52,13 @@ public class SysResourceServiceImpl extends BaseServiceImpl<SysResource> impleme
@Override @Override
public List<MenusComposite> findMenusListBySysUserId(Long sysUserId, String contextPath) { public List<MenusComposite> findMenusListBySysUserId(Long sysUserId, String contextPath) {
Map<String,Object> map=new HashMap(3); Map<String,Object> map=new HashMap(3);
map.put("userId",sysUserId); map.put("userId",sysUserId);
map.put("parentId", Constant.TOP_PARENT_ID); map.put("parentId", Constant.TOP_PARENT_ID);
map.put("permissionId", PermissionTyepEnum.SELECT.getValue()); map.put("permissionId", PermissionTyepEnum.SELECT.getValue());
List<SysResource> menusItmeList=sysResourceDao.findMenu(map); List<SysResource> menusItmeList=sysResourceDao.findMenu(map);
List<MenusComposite> list=new ArrayList<>(); List<MenusComposite> list=new ArrayList<>();
for (SysResource sysResource:menusItmeList){ menusItmeList.forEach(sysResource->{
MenusItem menusItem=new MenusItem(); MenusItem menusItem=new MenusItem();
menusItem.setMenuname(sysResource.getMenuName()); menusItem.setMenuname(sysResource.getMenuName());
menusItem.setIcon(sysResource.getMenuIco()); menusItem.setIcon(sysResource.getMenuIco());
@ -74,7 +74,9 @@ public class SysResourceServiceImpl extends BaseServiceImpl<SysResource> impleme
menusItem.add(menus); menusItem.add(menus);
} }
list.add(menusItem); list.add(menusItem);
}
});
return list; return list;
} }

@ -27,7 +27,7 @@ import java.util.*;
* Created by qi_liang on 2018/6/21. * Created by qi_liang on 2018/6/21.
*/ */
@Service @Service
public class SysRoleResourcePermissionServiceImpl extends BaseServiceImpl<SysRoleResourcePermission> implements SysRoleResourcePermissionService { public class SysRoleResourcePermissionServiceImpl implements SysRoleResourcePermissionService {
public static final String RESOURCE_SYMBOL = "_"; public static final String RESOURCE_SYMBOL = "_";
@ -128,10 +128,10 @@ public class SysRoleResourcePermissionServiceImpl extends BaseServiceImpl<SysRol
public List<PermissionVo> findAllPermissonVo() { public List<PermissionVo> findAllPermissonVo() {
List<PermissionVo> list = new ArrayList<>(); List<PermissionVo> list = new ArrayList<>();
List<SysResource> sysResourceList = sysResourceDao.findAll(); List<SysResource> sysResourceList = sysResourceDao.findAll();
Iterator iterator = sysResourceList.iterator(); Iterator<SysResource> iterator = sysResourceList.iterator();
PermissionTyepEnum[] tyepEnums = PermissionTyepEnum.values(); PermissionTyepEnum[] tyepEnums = PermissionTyepEnum.values();
while (iterator.hasNext()){ while (iterator.hasNext()){
SysResource sysResource = (SysResource) iterator.next(); SysResource sysResource = iterator.next();
if (sysResource!=null){ if (sysResource!=null){
for (PermissionTyepEnum permissionTyepEnum:tyepEnums){ for (PermissionTyepEnum permissionTyepEnum:tyepEnums){
PermissionVo permissionVo = new PermissionVo(); PermissionVo permissionVo = new PermissionVo();
@ -151,19 +151,21 @@ public class SysRoleResourcePermissionServiceImpl extends BaseServiceImpl<SysRol
*内部方法用于判断角色是否有权限 *内部方法用于判断角色是否有权限
*/ */
private boolean isCheck(Long resourceId,Long permissionId,Long roleId){ private boolean isCheck(Long resourceId,Long permissionId,Long roleId){
SysRoleResourcePermission roleResourcePermission=sysRoleResourcePermissionDao.getByResourceIdAndPermissionIdAndRoleId(resourceId,permissionId,roleId); boolean result = false;
if (roleResourcePermission!=null&&StatusTypeEnum.STATUS_ACTIVITY_YES.getValue().equals(roleResourcePermission.getStatus())){ if (permissionId!=null&&roleId!=null){
return true; SysRoleResourcePermission roleResourcePermission=sysRoleResourcePermissionDao.getByResourceIdAndPermissionIdAndRoleId(resourceId,permissionId,roleId);
}else{ if (roleResourcePermission!=null&&StatusTypeEnum.STATUS_ACTIVITY_YES.getValue().equals(roleResourcePermission.getStatus())){
return false; result = true;
}
} }
return result;
} }
/** /**
*内部方法拼接资源和权限ID *内部方法拼接资源和权限ID
*/ */
private Map<String,Object> getAttributes(Long resourceId,Long permissionId){ private Map<String,Object> getAttributes(Long resourceId,Long permissionId){
Map<String,Object> map=new HashMap<>(); Map<String,Object> map=new HashMap<>(1);
map.put(PERMISSIONID_KEY,resourceId+RESOURCE_SYMBOL+permissionId); map.put(PERMISSIONID_KEY,resourceId+RESOURCE_SYMBOL+permissionId);
return map; return map;
} }

@ -22,7 +22,7 @@ import java.util.Map;
* Created by qi_liang on 2018/6/21. * Created by qi_liang on 2018/6/21.
*/ */
@Service @Service
public class SysRoleServiceImpl extends BaseServiceImpl<SysRole> implements SysRoleService { public class SysRoleServiceImpl implements SysRoleService {
@Autowired @Autowired
private SysRoleDao sysRoleDao; private SysRoleDao sysRoleDao;

@ -19,7 +19,7 @@ import java.util.Map;
* Created by qi_liang on 2018/6/21. * Created by qi_liang on 2018/6/21.
*/ */
@Service @Service
public class SysUserRoleServiceImpl extends BaseServiceImpl<SysUserRole> implements SysUserRoleService { public class SysUserRoleServiceImpl implements SysUserRoleService {
@Autowired @Autowired
private SysUserRoleDao sysUserRoleDao; private SysUserRoleDao sysUserRoleDao;

@ -18,7 +18,7 @@ import java.util.List;
* Created by qi_liang on 2018/6/21. * Created by qi_liang on 2018/6/21.
*/ */
@Service @Service
public class SysUserServiceImpl extends BaseServiceImpl<SysUser> implements SysUserService { public class SysUserServiceImpl implements SysUserService {
@Autowired @Autowired
private SysUserDao sysUserDao; private SysUserDao sysUserDao;

@ -15,7 +15,7 @@ import java.util.List;
* Created by qi_liang on 2018/6/21. * Created by qi_liang on 2018/6/21.
*/ */
@Service @Service
public class WechatInfoServiceImpl extends BaseServiceImpl<WechatInfo> implements WechatInfoService { public class WechatInfoServiceImpl implements WechatInfoService {
@Autowired @Autowired
private WechatInfoDao wechatInfoDao; private WechatInfoDao wechatInfoDao;

Loading…
Cancel
Save