From 92badec65b7918680d1e2c906b206dc86249082b Mon Sep 17 00:00:00 2001 From: wxz Date: Sun, 17 May 2020 21:41:09 +0800 Subject: [PATCH 01/31] =?UTF-8?q?1.=E6=97=A5=E5=BF=97=E5=88=87=E9=9D=A2?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=89=A7=E8=A1=8C=E6=97=B6=E9=95=BF=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=202.=E5=B0=86=E6=9D=83=E9=99=90=E7=9A=84=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E4=BB=A5=E5=8F=8ASQL=E8=BF=87=E6=BB=A4=E7=89=87?= =?UTF-8?q?=E6=AE=B5=E7=9A=84=E7=94=9F=E6=88=90=E6=94=BE=E5=88=B0=E4=BA=86?= =?UTF-8?q?gov-access=EF=BC=8C=E4=BB=8E=E4=B8=9A=E5=8A=A1=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E5=89=A5=E7=A6=BB=E5=87=BA=E6=9D=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mybatis/aspect/DataFilterAspect.java | 363 +---------------- .../mybatis/dto/form/GetSQLFilterFormDTO.java | 28 ++ .../feign/MybatisGovAccessFeignClient.java | 15 +- .../MybatisGovAccessFeignClientFallback.java | 8 +- .../tools/aspect/BaseRequestLogAspect.java | 15 +- .../tools/aspect/RequirePermissionAspect.java | 61 +-- .../tools/aspect/ThreadLocalInitAspect.java | 1 - .../tools/constant/OpeScopeConstant.java | 5 +- .../tools/constant/ThreadLocalConstant.java | 5 - .../form/HasSpecifiedPermissionFormDTO.java | 22 ++ .../tools/exception/EpmetErrorCode.java | 5 +- .../feign/CommonGovAccessFeignClient.java | 9 + .../CommonGovAccessFeignClientFallback.java | 6 + .../epmet/commons/tools/redis/RedisKeys.java | 9 - ...O.java => AccessConfigOptionsFormDTO.java} | 2 +- ...TO.java => AccessConfigSaveConfigDTO.java} | 2 +- .../epmet/dto/form/GetSQLFilterFormDTO.java | 28 ++ .../form/HasSpecifiedPermissionFormDTO.java | 22 ++ .../result/AccessConfigOptionsResultDTO.java | 1 - .../result/AccessConfigSettingResultDTO.java | 14 - .../dto/result/RoleOpeScopeResultDTO.java | 3 + .../epmet/bean/OpeScopeFilterResultBean.java | 15 + .../constant/OperationScopeConstant.java | 48 +++ .../controller/AccessConfigController.java | 32 +- .../epmet/controller/AccessController.java | 28 +- .../java/com/epmet/dao/AccessSettingDao.java | 75 ---- .../epmet/dao/AccessSettingOptionsDao.java | 33 -- .../main/java/com/epmet/dao/RoleScopeDao.java | 1 - .../com/epmet/entity/AccessSettingEntity.java | 61 --- .../entity/AccessSettingOptionsEntity.java | 56 --- .../epmet/entity/OperationScopeEntity.java | 4 + .../epmet/redis/RoleAccessSettingRedis.java | 52 --- .../epmet/service/AccessConfigService.java | 4 +- .../java/com/epmet/service/AccessService.java | 18 +- .../service/impl/AccessConfigServiceImpl.java | 69 +--- .../epmet/service/impl/AccessServiceImpl.java | 365 ++++++++++++++++-- .../resources/mapper/AccessSettingDao.xml | 80 ---- .../mapper/AccessSettingOptionsDao.xml | 20 - .../resources/mapper/OperationScopeDao.xml | 5 +- .../main/resources/mapper/RoleScopeDao.xml | 2 +- .../test/govaccess/AccessSettingTest.java | 38 -- 41 files changed, 640 insertions(+), 990 deletions(-) create mode 100644 epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/dto/form/GetSQLFilterFormDTO.java create mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/HasSpecifiedPermissionFormDTO.java rename epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/{AccessConfigSettingFormDTO.java => AccessConfigOptionsFormDTO.java} (86%) rename epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/{AccessConfigSaveSettingDTO.java => AccessConfigSaveConfigDTO.java} (89%) create mode 100644 epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/GetSQLFilterFormDTO.java create mode 100644 epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/HasSpecifiedPermissionFormDTO.java delete mode 100644 epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/AccessConfigSettingResultDTO.java create mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/bean/OpeScopeFilterResultBean.java create mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/constant/OperationScopeConstant.java delete mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/AccessSettingDao.java delete mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/AccessSettingOptionsDao.java delete mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/AccessSettingEntity.java delete mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/AccessSettingOptionsEntity.java delete mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/RoleAccessSettingRedis.java delete mode 100644 epmet-module/gov-access/gov-access-server/src/main/resources/mapper/AccessSettingDao.xml delete mode 100644 epmet-module/gov-access/gov-access-server/src/main/resources/mapper/AccessSettingOptionsDao.xml delete mode 100644 epmet-module/gov-access/gov-access-server/src/test/java/com/epmet/test/govaccess/AccessSettingTest.java diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/aspect/DataFilterAspect.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/aspect/DataFilterAspect.java index ce4cde92b7..3a60549d6a 100644 --- a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/aspect/DataFilterAspect.java +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/aspect/DataFilterAspect.java @@ -1,22 +1,11 @@ -/** - * Copyright (c) 2018 人人开源 All rights reserved. - *

- * https://www.renren.io - *

- * 版权所有,侵权必究! - */ - package com.epmet.commons.mybatis.aspect; import com.epmet.commons.mybatis.annotation.DataFilter; import com.epmet.commons.mybatis.feign.MybatisGovAccessFeignClient; -import com.epmet.commons.tools.constant.AccessSettingConstant; -import com.epmet.commons.tools.constant.OpeScopeConstant; import com.epmet.commons.mybatis.dto.form.*; import com.epmet.commons.tools.constant.ThreadLocalConstant; -import com.epmet.commons.tools.dto.form.LoginUserInfoResultDTO; -import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.Result; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; @@ -28,9 +17,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import org.springframework.util.CollectionUtils; - -import java.util.*; /** * 数据过滤,切面处理类 @@ -44,13 +30,11 @@ public class DataFilterAspect { private static final Logger log = LoggerFactory.getLogger(DataFilterAspect.class); - /** - * 线程变量,记录是否已经添加了至少一个过滤条件 - */ - private static final ThreadLocal hasConditions = new ThreadLocal(); + @Autowired + private LoginUserUtil loginUserUtil; @Autowired - private MybatisGovAccessFeignClient govAccessFeignClient; + private MybatisGovAccessFeignClient mybatisGovAccessFeignClient; @Before("@annotation(com.epmet.commons.mybatis.annotation.DataFilter)") public void dataFilter(JoinPoint point) { @@ -88,22 +72,17 @@ public class DataFilterAspect { } } - LoginUserInfoResultDTO loginUserInfo = ThreadLocalConstant.loginUserInfoTl.get(); - - hasConditions.set(false); + //LoginUserInfoResultDTO loginUserInfo = getLoginUserInfo(); - // 生成过滤sql - String sqlFilterSegment = getSqlFilterSegment( - loginUserInfo.getUserId(), - loginUserInfo.getRoleIdList(), - requirePermission, - loginUserInfo.getOrgIdPath(), - loginUserInfo.getGridIdList(), - tableAlias, - loginUserInfo.getDeptIdList(), - gridId, - deptId, - requirePermission); + GetSQLFilterFormDTO form = new GetSQLFilterFormDTO(); + form.setApp(loginUserUtil.getLoginUserApp()); + form.setClient(loginUserUtil.getLoginUserClient()); + form.setUserId(loginUserUtil.getLoginUserId()); + form.setDepartmentId(deptId); + form.setGridId(gridId); + form.setOperationKey(requirePermission); + form.setTableAlias(tableAlias); + Result sqlFilterSegmentRst = mybatisGovAccessFeignClient.getSqlFilterSegment(form); // 方式1.填充到Service方法列表中的DataScope对象中。如果dao入参是用DTO的话,那么再加一个DataScope入参,sql中会报错提示#{}参数找不到,因此改用方法2 //Object[] methodArgs = point.getArgs(); @@ -115,319 +94,13 @@ public class DataFilterAspect { //} // 方式2,采用ThreadLocal传参到DataFilterInterceptor中 - if (StringUtils.isNotBlank(sqlFilterSegment)) { - ThreadLocalConstant.sqlFilter.set(sqlFilterSegment); - } - } - - /** - * 生成过滤sql片段 - * - * @return - */ - private String getSqlFilterSegment(String userId, Set roleIds, String reqiurePermission, String orgIdPath, - Set gridIdList, String tableAlias, Set deptIds, String gridId, String deptId, - String operationKey) { - - StringBuilder sb = new StringBuilder(); - - Map accessSettings = listRoleAccessSettings(roleIds, operationKey); - - // 1.生成sql:组织范围过滤 - if (!genOrgScopeSql(sb, orgIdPath, roleIds, reqiurePermission, tableAlias)) { - // 返回false,说明已经开启了all所有范围,后续条件不在拼接入sql,结束执行 - return sb.toString(); - } - - // 2.生成sql:我发起的 - String iCreated = accessSettings.get(AccessSettingConstant.I_CREATED_KEY); - if (StringUtils.isNotBlank(iCreated) && AccessSettingConstant.I_CREATED_ON.equals(iCreated)) { - genICreatedSql(sb, userId, tableAlias); - } - // 3.生成sql:本网格的 - String inGrid = accessSettings.get(AccessSettingConstant.IN_GRID_KEY); - if (StringUtils.isNotBlank(inGrid) && AccessSettingConstant.IN_GRID_ON.equals(inGrid)) { - if (StringUtils.isBlank(gridId)) { - log.error("DataFilter:拼接SQL语句出错:需要in grid权限,但是代码中没有获取到:{}", gridId); - throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); - } - genInGrid(sb, gridId, tableAlias); - } - - // 4.生成sql:根据部门列表 - String inDept = accessSettings.get(AccessSettingConstant.IN_DEPARTMENT_KEY); - if (StringUtils.isNotBlank(inDept) && AccessSettingConstant.IN_DEPARTMENT_ON.equals(inDept)) { - if (StringUtils.isBlank(deptId)) { - log.error("DataFilter:拼接SQL语句出错:需要in department权限,但是代码中没有获取到:{}", deptId); - throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); - } - genDepartmentFilterSql(sb, deptId, tableAlias); + if (!sqlFilterSegmentRst.success()) { + throw new RenException("DataFilterAspect调用Access服务生成SqlFilterSegment失败:" + sqlFilterSegmentRst.getMsg()); } - return sb.toString(); - } - - /** - * 列出角色对应的权限设置项 - * - * @param roleIds - * @return - */ - private Map listRoleAccessSettings(Set roleIds, String operationKey) { - Map settings = new HashMap<>(); - roleIds.forEach(roleId -> { - settings.putAll(listRoleAccessSettings(roleId, operationKey)); - }); - return settings; - } - - private Map listRoleAccessSettings(String roleId, String operationKey) { - AccessSettingFormDTO accessSettingFormDTO = new AccessSettingFormDTO(); - accessSettingFormDTO.setRoleId(roleId); - accessSettingFormDTO.setOperationKey(operationKey); - Result> result = govAccessFeignClient.listAccessSettings(accessSettingFormDTO); - if (result.success()) { - return result.getData(); - } else { - log.error("角色[{}]查询权限配置AccessSettings失败:{}", roleId, result.getMsg()); - } - return new HashMap<>(); - } - - /** - * 生成部门过滤sql - * - * @param sb - */ - private void genDepartmentFilterSql(StringBuilder sb, String deptId, String tableAlias) { - //Result> deptListResult = govOrgFeignClient.getDepartmentListByStaffId(staffId); - if (hasConditions.get()) { - // 之前没有条件 - sb.append(" OR "); - } - if (StringUtils.isBlank(tableAlias)) { - sb.append(" DEPARTMENT_ID = '").append(deptId).append("' "); - } else { - sb.append(" ").append(tableAlias).append(".DEPARTMENT_ID ='").append(deptId).append("' "); - } - hasConditions.set(true); - } - - //private void genDepartmentFilterSql(StringBuilder sb, Set deptIdList) { - // //Result> deptListResult = govOrgFeignClient.getDepartmentListByStaffId(staffId); - // if (CollectionUtils.isEmpty(deptIdList)) { - // return; - // } - // deptIdList.forEach(deptId -> { - // sb.append(hasConditions.get() ? " OR " : "").append(" DEPARTMENT_ID = '").append(deptId).append("' "); - // }); - // hasConditions.set(true); - //} - - /** - * 网格sql - * - * @param sb - * @param tableAlias - */ - private void genInGrid(StringBuilder sb, String gridId, String tableAlias) { - if (hasConditions.get()) { - // 之前没有条件 - sb.append(" OR "); - } - - // OR GRID_ID = 'XXX' OR GRID_ID = 'QQQ' - if (StringUtils.isBlank(tableAlias)) { - sb.append(" GRID_ID = '").append(gridId).append("' "); - } else { - sb.append(" ").append(tableAlias).append(".GRID_ID ='").append(gridId).append("' "); - } - hasConditions.set(true); - } - - /** - * sql:我发起的 - * - * @param userId - */ - private void genICreatedSql(StringBuilder sb, String userId, String tableAlias) { - if (StringUtils.isBlank(tableAlias)) { - sb.append(hasConditions.get() ? " OR " : " ").append(" CREATED_BY ='").append(userId).append("'"); - } else { - sb.append(hasConditions.get() ? " OR " : " ").append(tableAlias).append(".CREATED_BY ='").append(userId).append("'"); - } - hasConditions.set(true); - } - - /** - * 计算组织范围过滤sql,整体入口 - * @param sb - * @param orgIdPath - * @param roleIds - * @param reqiurePermission - * @param tableAlias - * @return Boolean 是否继续往下执行。true:继续执行,false:不继续执行 - */ - public boolean genOrgScopeSql(StringBuilder sb, String orgIdPath, Set roleIds, String reqiurePermission, String tableAlias) { - - // 根据角色列表查询操作范围列表 - Set opeAndScopes = new HashSet<>(); - - roleIds.forEach(roleId -> { - Result> opeResult = govAccessFeignClient.listRoleAllOperationScopesByRoleId(roleId); - if (!opeResult.success()) { - log.error("DataFilter:根据角色查询角色所有的操作列表出错:{}", opeResult.getMsg()); - } else { - List opes = opeResult.getData(); - if (!CollectionUtils.isEmpty(opes)) { - opes.forEach(ope -> { - if (reqiurePermission.equals(ope.getOperationKey())) { - // 拿到当前操作对应的 RoleOpeScopeResultDTO - opeAndScopes.add(ope); - } - }); - } - } - }); - - // 过滤出最大的范围 - HashSet scopes = filteScopes(opeAndScopes); - if (CollectionUtils.isEmpty(scopes)) { - // 没有范围限制 - return true; - } - if (scopes.contains(OpeScopeConstant.ORG_ALL)) { - return false; - } - - // 生成sql语句 - genOrgScopeSql(sb, scopes, orgIdPath, tableAlias); - sb.replace(sb.lastIndexOf("OR"), sb.lastIndexOf("OR") + 3, ""); - hasConditions.set(true); - return true; - } - - /** - * 计算组织范围过滤sql - * PS:这个方法需要优化,当前阶段因为逻辑不稳定,暂时不做过度封装 - * @param scopes - * @return - */ - private void genOrgScopeSql(StringBuilder sb, HashSet scopes, String orgIdPath, String tableAlias) { - // 取出父组织ID path 和当前组织ID - //String parentOrgIDPath = orgIdPath.substring(0, orgIdPath.lastIndexOf(orgIdPathSpliter)); - //String currOrgID = orgIdPath.substring(orgIdPath.lastIndexOf(orgIdPathSpliter) + 1); - - for (String scope : scopes) { - switch (scope) { - // 当前单位(可以用ORG_ID_PATH,也可以用ORG_ID判断) - case OpeScopeConstant.ORG_CURR: - if (StringUtils.isBlank(tableAlias)) { - sb.append(" ORG_ID_PATH = '").append(orgIdPath).append("' OR "); - //sb.append(" ORG_ID = '").append(currOrgID).append("' OR "); - } else { - sb.append(" ").append(tableAlias).append(".ORG_ID_PATH = '").append(orgIdPath).append("' OR "); - //sb.append(" ").append(tableAlias).append(".ORG_ID = '").append(currOrgID).append("' OR "); - } - break; - // 本单位及其子级单位 - case OpeScopeConstant.ORG_CURR_AND_SUB: - if (StringUtils.isBlank(tableAlias)) { - sb.append(" ORG_ID_PATH like '").append(orgIdPath).append("%' OR "); - } else { - sb.append(" ").append(tableAlias).append(".ORG_ID_PATH like '").append(orgIdPath).append("%' OR "); - } - break; - // 本单位的子级单位 - case OpeScopeConstant.ORG_CURR_SUB: - if (StringUtils.isBlank(tableAlias)) { - sb.append(" ORG_ID_PATH like '").append(orgIdPath).append(":%' OR "); - } else { - sb.append(" ").append(tableAlias).append(".ORG_ID_PATH like '").append(orgIdPath).append(":%' OR "); - } - break; - //当前单位的父级单位 - case OpeScopeConstant.ORG_CURR_SUP: - if (StringUtils.isBlank(tableAlias)) { - sb.append(" '").append(orgIdPath).append("' like CONCAT(").append("ORG_ID_PATH,':%') OR "); - } else { - sb.append(" '").append(orgIdPath).append("' like CONCAT(").append(tableAlias).append(".ORG_ID_PATH,':%') OR "); - } - break; - // 当前单位及其父级单位 - case OpeScopeConstant.ORG_CURR_AND_SUP: - if (StringUtils.isBlank(tableAlias)) { - sb.append(" '").append(orgIdPath).append("' like CONCAT(").append("ORG_ID_PATH,'%') OR "); - } else { - sb.append(" '").append(orgIdPath).append("' like CONCAT(").append(tableAlias).append(".ORG_ID_PATH,'%' ) OR "); - } - break; - case OpeScopeConstant.ORG_EQUAL: - // todo 同级 - //sb.append(" OR "); - break; - case OpeScopeConstant.ORG_EQUAL_AND_SUB: - // todo 同级及其子级 - //sb.append(" OR "); - break; - case OpeScopeConstant.ORG_EQUAL_SUB: - // todo 同级的子级 - //sb.append(" OR "); - break; - case OpeScopeConstant.ORG_EQUAL_AND_SUP: - // todo 同级及其上级 - //sb.append(" OR "); - break; - case OpeScopeConstant.ORG_EQUAL_SUP: - // todo 同级的上级 - //sb.append(" OR "); - break; - } - } - } - - /** - * 过滤有效范围 - * - * @param scopeDTOS - * @return - */ - private HashSet filteScopes(Set scopeDTOS) { - HashMap filtedScopes = new HashMap<>(); - for (RoleOpeScopeResultDTO scope : scopeDTOS) { - String scopeIndex = scope.getScopeIndex(); - if (StringUtils.isBlank(scopeIndex)) { - continue; - } - if (OpeScopeConstant.ORG_ALL.equals(scope.getScopeKey())) { - // 该操作具有all的权限,直接放入 - filtedScopes.put(scopeIndex, scope); - break; - } - String[] currArr = scopeIndex.split("_"); - if ("0".equals(currArr[1])) { - // 为0,说明没有包含关系,直接放入 - filtedScopes.put(scopeIndex, scope); - continue; - } - - RoleOpeScopeResultDTO tempScope = filtedScopes.get(currArr[0]); - if (tempScope != null) { - // 已经有ac开头的了 - String tempScopeIndex = tempScope.getScopeIndex(); - if (Integer.valueOf(currArr[1]) < Integer.valueOf(tempScopeIndex.split("_")[1])) { - filtedScopes.put(currArr[0], scope); - } - } else { - filtedScopes.put(currArr[0], scope); - } - } - HashSet scopeStrs = new HashSet<>(); - Set> entries = filtedScopes.entrySet(); - for (Map.Entry entry : entries) { - scopeStrs.add(entry.getValue().getScopeKey()); + if (StringUtils.isNotBlank(sqlFilterSegmentRst.getData())) { + ThreadLocalConstant.sqlFilter.set(sqlFilterSegmentRst.getData()); } - return scopeStrs; } } diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/dto/form/GetSQLFilterFormDTO.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/dto/form/GetSQLFilterFormDTO.java new file mode 100644 index 0000000000..e0d6b266d6 --- /dev/null +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/dto/form/GetSQLFilterFormDTO.java @@ -0,0 +1,28 @@ +package com.epmet.commons.mybatis.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +@Data +public class GetSQLFilterFormDTO { + + @NotBlank + private String operationKey; + + @NotBlank + private String userId; + + @NotBlank + private String app; + + @NotBlank + private String client; + + private String tableAlias; + + private String gridId; + + private String departmentId; + +} diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/feign/MybatisGovAccessFeignClient.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/feign/MybatisGovAccessFeignClient.java index 91e7743f4e..2c6e0d5ed8 100644 --- a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/feign/MybatisGovAccessFeignClient.java +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/feign/MybatisGovAccessFeignClient.java @@ -7,9 +7,9 @@ import com.epmet.commons.tools.utils.Result; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import java.util.List; -import java.util.Map; import java.util.Set; /** @@ -29,16 +29,17 @@ public interface MybatisGovAccessFeignClient { Result> getOperationScopesByRoleId(OperationScopeFormDTO operationScopeFormDTO); /** - * 查询角色的权限相关配置 + * 查询角色所有operation及其范围(缓存) * @return */ - @PostMapping("/gov/access/access/accesssettings") - Result> listAccessSettings(AccessSettingFormDTO accessSettingFormDTO); + @PostMapping("/gov/access/access/roleallopesandscopes/{roleId}") + Result> listRoleAllOperationScopesByRoleId(@PathVariable("roleId") String roleId); /** - * 查询角色所有operation及其范围(缓存) + * 查询sql过滤片段 + * @param form * @return */ - @PostMapping("/gov/access/access/roleallopesandscopes/{roleId}") - Result> listRoleAllOperationScopesByRoleId(@PathVariable("roleId") String roleId); + @PostMapping("/gov/access/access/getSqlFilterSegment") + Result getSqlFilterSegment(@RequestBody GetSQLFilterFormDTO form); } diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/feign/fallback/MybatisGovAccessFeignClientFallback.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/feign/fallback/MybatisGovAccessFeignClientFallback.java index 15562aa607..a14452346a 100644 --- a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/feign/fallback/MybatisGovAccessFeignClientFallback.java +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/feign/fallback/MybatisGovAccessFeignClientFallback.java @@ -27,12 +27,12 @@ public class MybatisGovAccessFeignClientFallback implements MybatisGovAccessFeig } @Override - public Result> listAccessSettings(AccessSettingFormDTO accessSettingFormDTO) { - return ModuleUtils.feignConError(ServiceConstant.GOV_ACCESS_SERVER, "listAccessSettings", accessSettingFormDTO); + public Result> listRoleAllOperationScopesByRoleId(@PathVariable("roleId") String roleId){ + return ModuleUtils.feignConError(ServiceConstant.GOV_ACCESS_SERVER, "listRoleAllOperationScopesByRoleId", roleId); } @Override - public Result> listRoleAllOperationScopesByRoleId(@PathVariable("roleId") String roleId){ - return ModuleUtils.feignConError(ServiceConstant.GOV_ACCESS_SERVER, "listRoleAllOperationScopesByRoleId", roleId); + public Result getSqlFilterSegment(GetSQLFilterFormDTO form) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ACCESS_SERVER, "getSqlFilterSegment", form); } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java index 7ff4486544..eae13bdfd2 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java @@ -11,6 +11,8 @@ import org.slf4j.LoggerFactory; import org.springframework.dao.DuplicateKeyException; import javax.servlet.http.HttpServletRequest; +import java.time.Duration; +import java.time.LocalDateTime; /** * 日志切面 @@ -40,13 +42,14 @@ public abstract class BaseRequestLogAspect { String requestURI = request.getRequestURI(); long id = Thread.currentThread().getId(); - Result result; + Result result = null; Exception exception = null; + LocalDateTime startTime = LocalDateTime.now(); + try { Object[] args = point.getArgs(); log.info(">>>>>>>>请求信息>>>>>>>>:线程ID:{},url:{},请求参数:{}", id, requestURI, objectsToString(args)); result = (Result)point.proceed(); - log.info("<<<<<<<<正常响应<<<<<<<<:线程ID:{},响应数据:{}", id, result.toString()); } catch (RenException e) { exception = e; result = handleRenException(e); @@ -63,8 +66,13 @@ public abstract class BaseRequestLogAspect { exception = e; result = handlerException(e); } finally { + LocalDateTime endTime = LocalDateTime.now(); + long execTimeMillis = Duration.between(startTime, endTime).toMillis(); + if (exception != null) { - log.info("<<<<<<<<异常响应<<<<<<<<:线程ID:{},异常信息:{}", id, ExceptionUtils.getErrorStackTrace(exception)); + log.info("<<<<<<<<异常响应<<<<<<<<:线程ID:{},执行时长:{}ms, 异常信息:{}", id, execTimeMillis, ExceptionUtils.getErrorStackTrace(exception)); + } else { + log.info("<<<<<<<<正常响应<<<<<<<<:线程ID:{},执行时长:{}ms, 响应数据:{}", id, execTimeMillis, result == null ? result : result.toString()); } } return result; @@ -124,6 +132,7 @@ public abstract class BaseRequestLogAspect { } Result result=new Result().error(); result.setData(e.getMsg()); + //result.setMsg(e.getMsg()); return result; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/RequirePermissionAspect.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/RequirePermissionAspect.java index dca14ce55f..3b5858b805 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/RequirePermissionAspect.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/RequirePermissionAspect.java @@ -10,6 +10,7 @@ package com.epmet.commons.tools.aspect; import com.epmet.commons.tools.annotation.RequirePermission; import com.epmet.commons.tools.constant.ThreadLocalConstant; +import com.epmet.commons.tools.dto.form.HasSpecifiedPermissionFormDTO; import com.epmet.commons.tools.dto.form.LoginUserInfoFormDTO; import com.epmet.commons.tools.dto.form.LoginUserInfoResultDTO; import com.epmet.commons.tools.dto.form.RoleOpeScopeResultDTO; @@ -65,68 +66,32 @@ public class RequirePermissionAspect { String requirePermission = requirePermissionEnum.getKey(); - LoginUserInfoResultDTO loginUserInfo = getLoginUserInfo(); - - Set ownPermissions = getPermissions(loginUserInfo.getRoleIdList()); - - // 校验操作权限 - validateOpePermission(ownPermissions, requirePermission); + validPermission(requirePermission); // 操作权限校验通过。将该操作key放入ThreadLocal,供DataFilterAspect中数据权限过滤器进一步使用 ThreadLocalConstant.requirePermissionTl.set(requirePermission); - ThreadLocalConstant.loginUserInfoTl.set(loginUserInfo); } /** - * 获取登陆用户信息 - * @return + * 校验权限 + * @param requirePermission */ - private LoginUserInfoResultDTO getLoginUserInfo() { - LoginUserInfoFormDTO loginUserinfoFormDTO = new LoginUserInfoFormDTO(); - loginUserinfoFormDTO.setApp(loginUserUtil.getLoginUserApp()); - loginUserinfoFormDTO.setClient(loginUserUtil.getLoginUserClient()); - loginUserinfoFormDTO.setStaffId(loginUserUtil.getLoginUserId()); - Result result = govAccessFeignClient.getLoginUserInfo(loginUserinfoFormDTO); - + private void validPermission(String requirePermission) { + HasSpecifiedPermissionFormDTO form = new HasSpecifiedPermissionFormDTO(); + form.setApp(loginUserUtil.getLoginUserApp()); + form.setClient(loginUserUtil.getLoginUserClient()); + form.setUserId(loginUserUtil.getLoginUserId()); + form.setOperationKey(requirePermission); + Result result = govAccessFeignClient.hasSpecifiedPermission(form); if (result.getCode() != 0) { // 查询不到权限,记录日志,抛出8000异常 log.error("调用Access查询权限失败:{}", result.getMsg()); throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); } - - LoginUserInfoResultDTO loginUserInfo = result.getData(); - if (loginUserInfo == null) { - log.error("操作权限不足,查询不到登录用户信息"); - throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); - } - - return loginUserInfo; - } - - /** - * 校验操作权限 - */ - private void validateOpePermission(Set permissions, String reqiurePermission) { - if (!permissions.contains(reqiurePermission)) { - // 权限不足 + Boolean data = result.getData(); + if (data == null || !data) { log.error("操作权限不足"); throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); } } - - private Set getPermissions(Set roleIdList) { - Set permissions = new HashSet<>(); - roleIdList.forEach(role -> { - // 找出该角色的所有功能操作列表 - Result> result = govAccessFeignClient.listRoleAllOperationScopesByRoleId(role); - if (!result.success()) { - // 获取operation异常 - log.error("调用GovAccess,根据RoleId查询Operation列表失败:{}", result.getMsg()); - throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); - } - List roleOperations = result.getData(); - permissions.addAll(roleOperations.stream().map(ope -> ope.getOperationKey()).collect(Collectors.toSet())); - }); - return permissions; - } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ThreadLocalInitAspect.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ThreadLocalInitAspect.java index d42d3f7f55..2e070b1817 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ThreadLocalInitAspect.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ThreadLocalInitAspect.java @@ -38,7 +38,6 @@ public class ThreadLocalInitAspect { try { ThreadLocalConstant.sqlFilter.remove(); ThreadLocalConstant.requirePermissionTl.remove(); - ThreadLocalConstant.loginUserInfoTl.remove(); } catch (Exception e) { log.error("清理sqlFilter缓存失败:{}", ExceptionUtils.getErrorStackTrace(e)); } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/OpeScopeConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/OpeScopeConstant.java index b770f2f2cb..104e4bad7a 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/OpeScopeConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/OpeScopeConstant.java @@ -5,7 +5,10 @@ package com.epmet.commons.tools.constant; */ public class OpeScopeConstant { - // 权限覆盖所有范围 + // 无任何范围限制 + public static final String ALL = "all"; + + // 覆盖机构下的所有范围 public static final String ORG_ALL = "org_all"; //"同级组织的下级" diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ThreadLocalConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ThreadLocalConstant.java index 16f8113cf7..2dad0d6dba 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ThreadLocalConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ThreadLocalConstant.java @@ -12,11 +12,6 @@ public class ThreadLocalConstant { */ public static final ThreadLocal requirePermissionTl = new ThreadLocal<>(); - /** - * 登陆用户信息的 ThreadLocal - */ - public static final ThreadLocal loginUserInfoTl = new ThreadLocal<>(); - /** * 用于向DataFilterInterceptor传递权限过滤的sql片段(需要在Controller相关的AOP中进行清理,防止变量残留) */ diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/HasSpecifiedPermissionFormDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/HasSpecifiedPermissionFormDTO.java new file mode 100644 index 0000000000..4141741fb0 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/HasSpecifiedPermissionFormDTO.java @@ -0,0 +1,22 @@ +package com.epmet.commons.tools.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +@Data +public class HasSpecifiedPermissionFormDTO { + + @NotBlank + private String operationKey; + + @NotBlank + private String userId; + + @NotBlank + private String app; + + @NotBlank + private String client; + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 78f66e9330..d4ff8fb7e5 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -43,7 +43,10 @@ public enum EpmetErrorCode { CANNOT_DISABLE_YOURSELF(8405,"您不能禁用自己"), ALREADY_EVALUATE(8501,"您已评价"), - ALREADY_VOTE(8502,"您已表态"); + ALREADY_VOTE(8502,"您已表态"), + + // 该错误不会提示给前端,只是后端传输错误信息用。 + ACCESS_SQL_FILTER_MISSION_ARGS(8601, "缺少生成权限过滤SQL所需参数"); private int code; private String msg; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonGovAccessFeignClient.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonGovAccessFeignClient.java index 682a30e96c..180cef4025 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonGovAccessFeignClient.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonGovAccessFeignClient.java @@ -1,6 +1,7 @@ package com.epmet.commons.tools.feign; import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.dto.form.HasSpecifiedPermissionFormDTO; import com.epmet.commons.tools.dto.form.LoginUserInfoFormDTO; import com.epmet.commons.tools.dto.form.LoginUserInfoResultDTO; import com.epmet.commons.tools.dto.form.RoleOpeScopeResultDTO; @@ -34,4 +35,12 @@ public interface CommonGovAccessFeignClient { */ @PostMapping("/gov/access/access/roleallopesandscopes/{roleId}") Result> listRoleAllOperationScopesByRoleId(@PathVariable("roleId") String roleId); + + /** + * 用户是否具有指定权限 + * @param form + * @return + */ + @PostMapping("/gov/access/access/hasspecifiedpermission") + Result hasSpecifiedPermission(@RequestBody HasSpecifiedPermissionFormDTO form); } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonGovAccessFeignClientFallback.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonGovAccessFeignClientFallback.java index a03f87ccc9..feb8af499f 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonGovAccessFeignClientFallback.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonGovAccessFeignClientFallback.java @@ -1,6 +1,7 @@ package com.epmet.commons.tools.feign.fallback; import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.dto.form.HasSpecifiedPermissionFormDTO; import com.epmet.commons.tools.dto.form.LoginUserInfoFormDTO; import com.epmet.commons.tools.dto.form.LoginUserInfoResultDTO; import com.epmet.commons.tools.dto.form.RoleOpeScopeResultDTO; @@ -30,4 +31,9 @@ public class CommonGovAccessFeignClientFallback implements CommonGovAccessFeignC public Result> listRoleAllOperationScopesByRoleId(@PathVariable("roleId") String roleId){ return ModuleUtils.feignConError(ServiceConstant.GOV_ACCESS_SERVER, "listRoleAllOperationScopesByRoleId", roleId); } + + @Override + public Result hasSpecifiedPermission(HasSpecifiedPermissionFormDTO form) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ACCESS_SERVER, "hasSpecifiedPermission", form); + } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java index 3670e1f9a6..4732f4f32f 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java @@ -204,13 +204,4 @@ public class RedisKeys { public static String getRoleAllOpeScopesKey(String roleId) { return rootPrefix.concat("gov:access:role:allopescopes:").concat(roleId); } - - /** - * 角色ID对应的权限配置 - * @param roleId - * @return - */ - public static String getRoleAccessSettingKey(String roleId, String operationKey) { - return rootPrefix.concat(String.format("gov:access:role:accesssettings:%s:%s", roleId, operationKey)); - } } diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AccessConfigSettingFormDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AccessConfigOptionsFormDTO.java similarity index 86% rename from epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AccessConfigSettingFormDTO.java rename to epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AccessConfigOptionsFormDTO.java index 58193ec816..b96e438e0b 100644 --- a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AccessConfigSettingFormDTO.java +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AccessConfigOptionsFormDTO.java @@ -5,7 +5,7 @@ import lombok.Data; import javax.validation.constraints.NotBlank; @Data -public class AccessConfigSettingFormDTO { +public class AccessConfigOptionsFormDTO { @NotBlank(message = "角色ID不能为空") private String roleId; diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AccessConfigSaveSettingDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AccessConfigSaveConfigDTO.java similarity index 89% rename from epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AccessConfigSaveSettingDTO.java rename to epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AccessConfigSaveConfigDTO.java index 6a9f46c010..6a918b5bb2 100644 --- a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AccessConfigSaveSettingDTO.java +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/AccessConfigSaveConfigDTO.java @@ -6,7 +6,7 @@ import javax.validation.constraints.NotBlank; import java.util.Set; @Data -public class AccessConfigSaveSettingDTO { +public class AccessConfigSaveConfigDTO { @NotBlank(message = "角色ID不能为空") private String roleId; diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/GetSQLFilterFormDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/GetSQLFilterFormDTO.java new file mode 100644 index 0000000000..4a63754bd7 --- /dev/null +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/GetSQLFilterFormDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +@Data +public class GetSQLFilterFormDTO { + + @NotBlank + private String operationKey; + + @NotBlank + private String userId; + + @NotBlank + private String app; + + @NotBlank + private String client; + + private String tableAlias; + + private String gridId; + + private String departmentId; + +} diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/HasSpecifiedPermissionFormDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/HasSpecifiedPermissionFormDTO.java new file mode 100644 index 0000000000..4dabc98dd0 --- /dev/null +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/HasSpecifiedPermissionFormDTO.java @@ -0,0 +1,22 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +@Data +public class HasSpecifiedPermissionFormDTO { + + @NotBlank + private String operationKey; + + @NotBlank + private String userId; + + @NotBlank + private String app; + + @NotBlank + private String client; + +} diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/AccessConfigOptionsResultDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/AccessConfigOptionsResultDTO.java index 55d965ae05..4959a3af40 100644 --- a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/AccessConfigOptionsResultDTO.java +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/AccessConfigOptionsResultDTO.java @@ -7,5 +7,4 @@ import java.util.List; @Data public class AccessConfigOptionsResultDTO { private List scopeOptions; - private List settingOptions; } diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/AccessConfigSettingResultDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/AccessConfigSettingResultDTO.java deleted file mode 100644 index 150a02a49f..0000000000 --- a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/AccessConfigSettingResultDTO.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.epmet.dto.result; - -import lombok.Data; - -@Data -public class AccessConfigSettingResultDTO { - - private String settingKey; - private String settingName; - private String roleId; - private Boolean assigned; - private String operationKey; - -} diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/RoleOpeScopeResultDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/RoleOpeScopeResultDTO.java index db971dcbb2..d950f7dc85 100644 --- a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/RoleOpeScopeResultDTO.java +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/RoleOpeScopeResultDTO.java @@ -30,4 +30,7 @@ public class RoleOpeScopeResultDTO { */ private String scopeIndex; + private String series; + private Integer sort; + } diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/bean/OpeScopeFilterResultBean.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/bean/OpeScopeFilterResultBean.java new file mode 100644 index 0000000000..fbe1b38052 --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/bean/OpeScopeFilterResultBean.java @@ -0,0 +1,15 @@ +package com.epmet.bean; + +import lombok.Data; + +import java.util.HashSet; +import java.util.Set; + +@Data +public class OpeScopeFilterResultBean { + + private HashSet orgLevelScopes; + private Set switchScopes; + private boolean allScopes; + +} diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/constant/OperationScopeConstant.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/constant/OperationScopeConstant.java new file mode 100644 index 0000000000..02dd6664ff --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/constant/OperationScopeConstant.java @@ -0,0 +1,48 @@ +package com.epmet.constant; + +/** + * 操作范围系列常量 + */ +public class OperationScopeConstant { + + /** + * ===================系列=================== + */ + public static final String SERIES_ORG_LEVEL = "org_level"; + public static final String SERIES_SWITCH = "switch"; + public static final String SERIES_ALL = "all"; + + /** + * ===================范围=================== + */ + // 无任何范围限制 + public static final String SCOPE_ALL = "all"; + + // 覆盖机构下的所有范围 + public static final String SCOPE_ORG_ALL = "org_all"; + + //"同级组织的下级" + public static final String SCOPE_ORG_EQUAL_SUB = "org_equal_sub"; + //"同级组织及下级" + public static final String SCOPE_ORG_EQUAL_AND_SUB = "org_equal_and_sub"; + // 同级组织的上级 + public static final String SCOPE_ORG_EQUAL_SUP = "org_equal_sup"; + // 同级组织及上级 + public static final String SCOPE_ORG_EQUAL_AND_SUP = "org_equal_and_sup"; + //"同级组织" + public static final String SCOPE_ORG_EQUAL = "org_equal"; + + //"本组织的下级" + public static final String SCOPE_ORG_CURR_SUB = "org_curr_sub"; + //"本组织及下级" + public static final String SCOPE_ORG_CURR_AND_SUB = "org_curr_and_sub"; + //"本组织" + public static final String SCOPE_ORG_CURR = "org_curr"; + + //我创建的 + public static final String SCOPE_I_CREATED = "i_created"; + //网格内 + public static final String SCOPE_IN_GRID = "in_grid"; + // 部门内 + public static final String SCOPE_IN_DEPARTMENT = "in_department"; +} diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessConfigController.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessConfigController.java index 70436077be..49374b9084 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessConfigController.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessConfigController.java @@ -3,15 +3,14 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.AccessConfigOpesFormDTO; -import com.epmet.dto.form.AccessConfigSaveSettingDTO; -import com.epmet.dto.form.AccessConfigSettingFormDTO; +import com.epmet.dto.form.AccessConfigOptionsFormDTO; +import com.epmet.dto.form.AccessConfigSaveConfigDTO; import com.epmet.dto.result.AccessConfigOpesResultDTO; import com.epmet.dto.result.AccessConfigOptionsResultDTO; import com.epmet.service.AccessConfigService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; -import javax.validation.constraints.NotBlank; import java.util.List; import java.util.Set; @@ -34,7 +33,7 @@ public class AccessConfigController { } /** - * 保存角色的操作功能列表 + * 保存角色的操作权限列表 * @return */ @PostMapping("saveroleopes") @@ -47,26 +46,25 @@ public class AccessConfigController { * 查询可配置项列表 * @return */ - @PostMapping("settingoptions") - public Result listSettingoptions(@RequestBody AccessConfigSettingFormDTO settingFormDTO) { - ValidatorUtils.validateEntity(settingFormDTO); - AccessConfigOptionsResultDTO options = accessConfigService.listScopeItemsForAccessConfig(settingFormDTO.getRoleId(), settingFormDTO.getOperationKey()); + @PostMapping("configoptions") + public Result listConfigOptions(@RequestBody AccessConfigOptionsFormDTO accessConfigFormDTO) { + ValidatorUtils.validateEntity(accessConfigFormDTO); + AccessConfigOptionsResultDTO options = accessConfigService.listScopeOptionsForAccessConfig(accessConfigFormDTO.getRoleId(), accessConfigFormDTO.getOperationKey()); return new Result().ok(options); } /** * 保存设置 - * @param settings + * @param config * @return */ - @PostMapping("savesettings") - public Result saveSettings(@RequestBody AccessConfigSaveSettingDTO settings) { - ValidatorUtils.validateEntity(settings); - String roleId = settings.getRoleId(); - String operationKey = settings.getOperationKey(); - Set scopeKeys = settings.getScopeKeys(); - Set settingKeys = settings.getSettingKeys(); - accessConfigService.saveSettings(roleId, operationKey, scopeKeys, settingKeys); + @PostMapping("saveconfig") + public Result saveSettings(@RequestBody AccessConfigSaveConfigDTO config) { + ValidatorUtils.validateEntity(config); + String roleId = config.getRoleId(); + String operationKey = config.getOperationKey(); + Set scopeKeys = config.getScopeKeys(); + accessConfigService.saveConfig(roleId, operationKey, scopeKeys); return new Result(); } diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessController.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessController.java index caabc26491..74e40a8579 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessController.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessController.java @@ -3,9 +3,7 @@ package com.epmet.controller; import com.epmet.commons.tools.security.dto.GovTokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.dto.form.AccessSettingFormDTO; -import com.epmet.dto.form.OperationScopeFormDTO; -import com.epmet.dto.form.StaffPermCacheFormDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.LoginUserInfoResultDTO; import com.epmet.dto.result.RoleOpeScopeResultDTO; import com.epmet.service.AccessService; @@ -13,7 +11,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; -import java.util.Map; import java.util.Set; /** @@ -91,12 +88,25 @@ public class AccessController { } /** - * 查询角色的权限相关配置(缓存) + * 用户是否具有指定权限 * @return */ - @PostMapping("/accesssettings") - public Result> listAccessSettings(@RequestBody AccessSettingFormDTO accessSettingFormDTO) { - Map settings = accessService.listAccessSettings(accessSettingFormDTO.getRoleId(), accessSettingFormDTO.getOperationKey()); - return new Result>().ok(settings); + @PostMapping("hasspecifiedpermission") + public Result hasSpecifiedPermission(@RequestBody HasSpecifiedPermissionFormDTO form) { + ValidatorUtils.validateEntity(form); + Boolean hasPermission = accessService.hasPermission(form.getOperationKey(), form.getUserId(), form.getApp(), form.getClient()); + return new Result().ok(hasPermission); + } + + /** + * 查询sql过滤片段 + * @param form + * @return + */ + @PostMapping("getSqlFilterSegment") + public Result getSqlFilterSegment(@RequestBody GetSQLFilterFormDTO form) { + ValidatorUtils.validateEntity(form); + String sqlFilterSegment = accessService.getSqlFilterSegment(form); + return new Result().ok(sqlFilterSegment); } } diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/AccessSettingDao.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/AccessSettingDao.java deleted file mode 100644 index 1af564a116..0000000000 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/AccessSettingDao.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Copyright 2018 人人开源 https://www.renren.io - *

- * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - *

- * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - *

- * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.epmet.dao; - -import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.dto.result.AccessConfigSettingResultDTO; -import com.epmet.dto.result.AccessSettingResultDTO; -import com.epmet.entity.AccessSettingEntity; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; - -import java.util.List; -import java.util.Set; - -/** - * 权限配置 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2020-04-29 - */ -@Mapper -public interface AccessSettingDao extends BaseDao { - - /** - * 根据角色查询配置列表 - * @param roleId - * @return - */ - List listAccessSettingsByRoleId(@Param("roleId") String roleId, - @Param("operationKey") String operationKey); - - List listSettingOptionsForAccessConfig(@Param("roleId") String roleId, - @Param("operationKey") String operationKey); - - /** - * 删除 - * @param roleId - * @param operationKey - * @param settingKeys2Delete - * @return - */ - int delete(@Param("roleId") String roleId, - @Param("operationKey") String operationKey, - @Param("settingKeys2Delete") Set settingKeys2Delete); - - AccessSettingEntity get(@Param("roleId") String roleId, - @Param("operationKey") String operationKey, - @Param("settingKey") String settingKey); - - /** - * 启用 - * @param roleId - * @param operationKey - * @param settingKey - * @return - */ - int enable(@Param("roleId") String roleId, - @Param("operationKey") String operationKey, - @Param("settingKey") String settingKey); -} \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/AccessSettingOptionsDao.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/AccessSettingOptionsDao.java deleted file mode 100644 index f07c5e1efe..0000000000 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/AccessSettingOptionsDao.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright 2018 人人开源 https://www.renren.io - *

- * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - *

- * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - *

- * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.epmet.dao; - -import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.entity.AccessSettingOptionsEntity; -import org.apache.ibatis.annotations.Mapper; - -/** - * 权限配置选项 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2020-04-29 - */ -@Mapper -public interface AccessSettingOptionsDao extends BaseDao { - -} \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/RoleScopeDao.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/RoleScopeDao.java index 361bd033d4..3199a78e3d 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/RoleScopeDao.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/RoleScopeDao.java @@ -19,7 +19,6 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.result.AccessConfigScopeResultDTO; -import com.epmet.dto.result.AccessConfigSettingResultDTO; import com.epmet.entity.RoleScopeEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/AccessSettingEntity.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/AccessSettingEntity.java deleted file mode 100644 index 076476fcfa..0000000000 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/AccessSettingEntity.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Copyright 2018 人人开源 https://www.renren.io - *

- * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - *

- * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - *

- * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.epmet.entity; - -import com.baomidou.mybatisplus.annotation.TableName; - -import com.epmet.commons.mybatis.entity.BaseEpmetEntity; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.util.Date; - -/** - * 权限配置 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2020-04-29 - */ -@Data -@EqualsAndHashCode(callSuper=false) -@TableName("access_setting") -public class AccessSettingEntity extends BaseEpmetEntity { - - private static final long serialVersionUID = 1L; - - /** - * 角色ID - */ - private String roleId; - - /** - * 操作key - */ - private String operationKey; - - /** - * 配置KEY - */ - private String settingKey; - - /** - * 配置值 - */ - private String settingValue; - -} diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/AccessSettingOptionsEntity.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/AccessSettingOptionsEntity.java deleted file mode 100644 index 49fb16db01..0000000000 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/AccessSettingOptionsEntity.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Copyright 2018 人人开源 https://www.renren.io - *

- * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - *

- * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - *

- * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.epmet.entity; - -import com.baomidou.mybatisplus.annotation.TableName; - -import com.epmet.commons.mybatis.entity.BaseEpmetEntity; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.util.Date; - -/** - * 权限配置选项 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2020-04-29 - */ -@Data -@EqualsAndHashCode(callSuper=false) -@TableName("access_setting_options") -public class AccessSettingOptionsEntity extends BaseEpmetEntity { - - private static final long serialVersionUID = 1L; - - /** - * 配置KEY - */ - private String settingKey; - - /** - * 配置name - */ - private String settingName; - - /** - * 简介 - */ - private String brief; - -} diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/OperationScopeEntity.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/OperationScopeEntity.java index 2fd6b18361..2c7223d97d 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/OperationScopeEntity.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/OperationScopeEntity.java @@ -48,4 +48,8 @@ public class OperationScopeEntity extends BaseEpmetEntity { */ private String scopeName; + private String scopeIndex; + private String series; + private Integer sort; + } diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/RoleAccessSettingRedis.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/RoleAccessSettingRedis.java deleted file mode 100644 index c188cf2566..0000000000 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/RoleAccessSettingRedis.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.epmet.redis; - -import com.epmet.commons.tools.redis.RedisKeys; -import com.epmet.commons.tools.redis.RedisUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import org.springframework.util.CollectionUtils; - -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -@Component -public class RoleAccessSettingRedis { - - @Autowired - private RedisUtils redisUtils; - - public void set(Map settings, String roleId, String operationKey) { - // 转化Map - HashMap newSettings = new HashMap<>(); - Set> entries = settings.entrySet(); - entries.forEach(entry -> { - newSettings.put(entry.getKey(), entry.getValue()); - }); - - String roleAccessSettingKey = RedisKeys.getRoleAccessSettingKey(roleId, operationKey); - redisUtils.hMSet(roleAccessSettingKey, newSettings); - } - - public Map get(String roleId, String operationKey) { - String roleAccessSettingKey = RedisKeys.getRoleAccessSettingKey(roleId, operationKey); - Map s = redisUtils.hGetAll(roleAccessSettingKey); - // 转化Map - if (!CollectionUtils.isEmpty(s)) { - Map settings = new HashMap<>(); - s.forEach((s1, o) -> { - if (o != null) { - settings.put(s1, String.valueOf(o)); - } - }); - return settings; - } - - return null; - } - - public void delete(String roleId, String operationKey) { - redisUtils.delete(RedisKeys.getRoleAccessSettingKey(roleId, operationKey)); - } - -} diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessConfigService.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessConfigService.java index 19e7421d6e..e6dfec5878 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessConfigService.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessConfigService.java @@ -11,7 +11,7 @@ public interface AccessConfigService { void saveRoleOpes(String roleId, List opes); - AccessConfigOptionsResultDTO listScopeItemsForAccessConfig(String roleId, String operationKey); + AccessConfigOptionsResultDTO listScopeOptionsForAccessConfig(String roleId, String operationKey); - void saveSettings(String roleId, String operationKey, Set scopeKeys, Set settingKeys); + void saveConfig(String roleId, String operationKey, Set scopeKeys); } diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessService.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessService.java index 7e976d3e65..8ba649e51d 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessService.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessService.java @@ -1,6 +1,7 @@ package com.epmet.service; import com.epmet.commons.tools.security.dto.GovTokenDto; +import com.epmet.dto.form.GetSQLFilterFormDTO; import com.epmet.dto.result.RoleOpeScopeResultDTO; import java.util.List; @@ -30,16 +31,23 @@ public interface AccessService { Set listOperationScopesByRoleId(String roleId, String operationKey); /** - * 查询角色的权限相关配置 + * 查询角色所有operation及其范围(缓存) * @param roleId * @return */ - Map listAccessSettings(String roleId, String operationKey); + List listAllRoleOperationScopesByRoleId(String roleId); /** - * 查询角色所有operation及其范围(缓存) - * @param roleId + * 角色 + * @param operationKey + * @param userId * @return */ - List listAllRoleOperationScopesByRoleId(String roleId); + Boolean hasPermission(String operationKey, String userId, String app, String client); + + /** + * 生成sql过滤脚本 + * @param form + */ + String getSqlFilterSegment(GetSQLFilterFormDTO form); } diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessConfigServiceImpl.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessConfigServiceImpl.java index cc39398289..78594a96fd 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessConfigServiceImpl.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessConfigServiceImpl.java @@ -1,14 +1,11 @@ package com.epmet.service.impl; -import com.epmet.commons.tools.constant.AccessSettingConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.dao.*; import com.epmet.dto.result.*; -import com.epmet.entity.AccessSettingEntity; import com.epmet.entity.RoleOperationEntity; import com.epmet.entity.RoleScopeEntity; -import com.epmet.redis.RoleAccessSettingRedis; import com.epmet.redis.RoleOpeScopeRedis; import com.epmet.service.AccessConfigService; import org.slf4j.Logger; @@ -36,12 +33,6 @@ public class AccessConfigServiceImpl implements AccessConfigService { @Autowired private RoleScopeDao roleScopeDao; - @Autowired - private AccessSettingDao accessSettingDao; - - @Autowired - private RoleAccessSettingRedis roleAccessSettingRedis; - @Override public List listOpesByRole(String roleId) { return roleOperationDao.listOpesForAccessConfig(roleId); @@ -84,70 +75,18 @@ public class AccessConfigServiceImpl implements AccessConfigService { } @Override - public AccessConfigOptionsResultDTO listScopeItemsForAccessConfig(String roleId, String operationKey) { + public AccessConfigOptionsResultDTO listScopeOptionsForAccessConfig(String roleId, String operationKey) { List scopeOptions = roleScopeDao.listScopeOptionsForAccessConfig(roleId, operationKey); - List settingOptions = accessSettingDao.listSettingOptionsForAccessConfig(roleId, operationKey); + //List settingOptions = accessSettingDao.listSettingOptionsForAccessConfig(roleId, operationKey); AccessConfigOptionsResultDTO options = new AccessConfigOptionsResultDTO(); options.setScopeOptions(scopeOptions); - options.setSettingOptions(settingOptions); + //options.setSettingOptions(settingOptions); return options; } @Override @Transactional - public void saveSettings(String roleId, String operationKey, Set scopeKeys, Set settingKeys) { - saveScopeSettings(roleId, operationKey, scopeKeys); - saveAccessSettingSettings(roleId, operationKey, settingKeys); - } - - /** - * 保存设置 - * 可以优化为:遍历时候直接删除或者新增,而不用新建settingKeys2Delete, settingKeys2Add变量 - * @param roleId - * @param operationKey - */ - private void saveAccessSettingSettings(String roleId, String operationKey, Set newSettingKeys) { - Set settingKeysDB = accessSettingDao.listAccessSettingsByRoleId(roleId, operationKey) - .stream() - .map(setting -> setting.getSettingKey()) - .collect(Collectors.toSet()); - - Set settingKeys2Delete = settingKeysDB.stream().filter(settingKeyDB -> !newSettingKeys.contains(settingKeyDB)).collect(Collectors.toSet()); - Set settingKeys2Add = newSettingKeys.stream().filter(newSetting -> !settingKeysDB.contains(newSetting)).collect(Collectors.toSet()); - - // 删除 - if (!CollectionUtils.isEmpty(settingKeys2Delete)) { - accessSettingDao.delete(roleId, operationKey, settingKeys2Delete); - } - - // 新增 - if (!CollectionUtils.isEmpty(settingKeys2Add)) { - settingKeys2Add.forEach(settingKey -> { - if (accessSettingDao.get(roleId, operationKey, settingKey) != null) { - // 数据库中已有 - accessSettingDao.enable(roleId, operationKey, settingKey); - } else { - AccessSettingEntity newSetting = new AccessSettingEntity(); - newSetting.setRoleId(roleId); - newSetting.setOperationKey(operationKey); - newSetting.setSettingKey(settingKey); - newSetting.setSettingValue(AccessSettingConstant.ON); - accessSettingDao.insert(newSetting); - } - }); - } - - // 清空redis缓存 - roleAccessSettingRedis.delete(roleId, operationKey); - } - - /** - * 保存Scope设置 - * @param roleId - * @param operationKey - * @param scopeKeys - */ - private void saveScopeSettings(String roleId, String operationKey, Set scopeKeys) { + public void saveConfig(String roleId, String operationKey, Set scopeKeys) { List scopesDB = roleScopeDao.listScopeEntities(roleId, operationKey); // 数据库中已有的scopeKey列表 Set scopeKeysDB = scopesDB.stream().map(scope -> scope.getScopeKey()).collect(Collectors.toSet()); diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java index 37a5dfd305..ee246fe87d 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java @@ -1,15 +1,20 @@ package com.epmet.service.impl; +import cn.hutool.core.collection.CollectionUtil; +import com.epmet.bean.OpeScopeFilterResultBean; +import com.epmet.commons.tools.constant.OpeScopeConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.security.dto.GovTokenDto; import com.epmet.commons.tools.utils.CpUserDetailRedis; -import com.epmet.dao.AccessSettingDao; +import com.epmet.constant.OperationScopeConstant; import com.epmet.dao.OperationScopeDao; -import com.epmet.dto.result.AccessSettingResultDTO; +import com.epmet.dto.form.GetSQLFilterFormDTO; import com.epmet.dto.result.RoleOpeScopeResultDTO; -import com.epmet.redis.RoleAccessSettingRedis; import com.epmet.redis.RoleOpeScopeRedis; import com.epmet.service.AccessService; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -17,28 +22,27 @@ import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.util.*; +import java.util.stream.Collectors; @Service public class AccessServiceImpl implements AccessService { private static Logger logger = LoggerFactory.getLogger(AccessServiceImpl.class); + /** + * 线程变量,记录是否已经添加了至少一个过滤条件 + */ + private static final ThreadLocal hasConditions = new ThreadLocal(); + @Autowired private CpUserDetailRedis cpUserDetailRedis; @Autowired private OperationScopeDao operationScopeDao; - @Autowired - private AccessSettingDao accessSettingDao; - @Autowired private RoleOpeScopeRedis roleOpeScopeRedis; - @Autowired - private RoleAccessSettingRedis roleAccessSettingRedis; - - /** * 更新权限缓存 * @param staffId @@ -90,38 +94,333 @@ public class AccessServiceImpl implements AccessService { return scopes; } + @Override + public List listAllRoleOperationScopesByRoleId(String roleId) { + List roleAllOpeScopes = roleOpeScopeRedis.getRoleAllOpeScopes(roleId); + if (roleAllOpeScopes == null) { + roleAllOpeScopes = operationScopeDao.listAllRoleOperationScopesByRoleId(roleId); + roleOpeScopeRedis.setRoleAllOpeScopes(roleId, roleAllOpeScopes); + } + return roleAllOpeScopes; + } + + @Override + public Boolean hasPermission(String operationKey, String userId, String app, String client) { + GovTokenDto userDetails = getUserDetails(app, client, userId); + if (userDetails == null) { + return false; + } + Set roleIdList = userDetails.getRoleIdList(); + if (CollectionUtils.isEmpty(roleIdList)) { + return false; + } + + final Set operationKeys = new HashSet<>(); + + roleIdList.stream().forEach(roleId -> { + List opeAndScopes = listAllRoleOperationScopesByRoleId(roleId); + operationKeys.addAll(opeAndScopes.stream().map(opeAndScope -> opeAndScope.getOperationKey()).collect(Collectors.toSet())); + }); + + if (operationKeys.contains(operationKey)) { + return true; + } + return false; + } + + @Override + public String getSqlFilterSegment(GetSQLFilterFormDTO form) { + hasConditions.set(false); + GovTokenDto userDetails = getUserDetails(form.getApp(), form.getClient(), form.getUserId()); + if (userDetails == null) { + logger.error("查询SQL过滤脚本:没有找到用户的登陆信息:app: {}, client: {}, userId:{}", form.getApp(), form.getClient(), form.getUserId()); + throw new RenException(EpmetErrorCode.ERR10006.getCode()); + } + + StringBuilder sb = new StringBuilder(); + + if (CollectionUtils.isEmpty(userDetails.getRoleIdList())) { + //logger.warn("用户{}没有配置任何角色,无法执行{}操作", form.getUserId(), form.getOperationKey()); + throw new RenException(String.format("用户%s没有配置任何角色,无法执行%s操作", form.getUserId(), form.getOperationKey())); + } + + OpeScopeFilterResultBean effectiveOpeScopes = getEffectiveOpeScopes(userDetails.getRoleIdList(), form.getOperationKey()); + if (effectiveOpeScopes.isAllScopes()) { + return sb.toString(); + } + + HashSet orgLevelScopes = effectiveOpeScopes.getOrgLevelScopes(); + Set switchScopes = effectiveOpeScopes.getSwitchScopes(); + + // 生成组织上下级关系系列的sql过滤片段 + if (!CollectionUtil.isEmpty(orgLevelScopes) && !orgLevelScopes.contains(OpeScopeConstant.ORG_ALL)) { + genOrgLevelScopeSqlFilter(sb, orgLevelScopes, userDetails.getOrgIdPath(), form.getTableAlias()); + } + + // 生成开关范围的sql过滤器 + if (!CollectionUtil.isEmpty(switchScopes)) { + genSwitchScopeSqlFilter(switchScopes, sb, form.getTableAlias(), userDetails.getUserId(), form.getGridId(), form.getDepartmentId()); + } + + return sb.toString(); + } + /** - * 查询角色的权限相关配置 - * @param roleId + * 生成开关系列范围sql过滤片段 + * @param switchScopes + */ + private void genSwitchScopeSqlFilter(Set switchScopes, + StringBuilder sb, + String tableAlias, + String userId, + String gridId, + String departmentId) { + + if (switchScopes.contains(OperationScopeConstant.SCOPE_I_CREATED)) { + genICreatedSql(sb, userId, tableAlias); + } + + if (switchScopes.contains(OperationScopeConstant.SCOPE_IN_GRID)) { + if (StringUtils.isBlank(gridId)) { + String error = String.format("DataFilter:拼接SQL语句出错:需要in grid权限,但是代码中没有获取到,GridId:%s", gridId); + logger.error(error); + throw new RenException(error); + } + genInGrid(sb, gridId, tableAlias); + } + + if (switchScopes.contains(OperationScopeConstant.SCOPE_IN_DEPARTMENT)) { + if (StringUtils.isBlank(departmentId)) { + String error = String.format("DataFilter:拼接SQL语句出错:需要in department权限,但是代码中没有获取到, departmentId:%s", departmentId); + logger.error(error); + throw new RenException(error); + } + genDepartmentFilterSql(sb, departmentId, tableAlias); + } + } + + /** + * sql:我发起的 + * + * @param userId + */ + private void genICreatedSql(StringBuilder sb, String userId, String tableAlias) { + if (StringUtils.isBlank(tableAlias)) { + sb.append(hasConditions.get() ? " OR " : " ").append(" CREATED_BY ='").append(userId).append("'"); + } else { + sb.append(hasConditions.get() ? " OR " : " ").append(tableAlias).append(".CREATED_BY ='").append(userId).append("'"); + } + hasConditions.set(true); + } + + /** + * 网格sql + * + * @param sb + * @param tableAlias + */ + private void genInGrid(StringBuilder sb, String gridId, String tableAlias) { + if (hasConditions.get()) { + // 之前没有条件 + sb.append(" OR "); + } + + // OR GRID_ID = 'XXX' OR GRID_ID = 'QQQ' + if (StringUtils.isBlank(tableAlias)) { + sb.append(" GRID_ID = '").append(gridId).append("' "); + } else { + sb.append(" ").append(tableAlias).append(".GRID_ID ='").append(gridId).append("' "); + } + hasConditions.set(true); + } + + /** + * 生成部门过滤sql + * + * @param sb + */ + private void genDepartmentFilterSql(StringBuilder sb, String deptId, String tableAlias) { + //Result> deptListResult = govOrgFeignClient.getDepartmentListByStaffId(staffId); + if (hasConditions.get()) { + // 之前没有条件 + sb.append(" OR "); + } + if (StringUtils.isBlank(tableAlias)) { + sb.append(" DEPARTMENT_ID = '").append(deptId).append("' "); + } else { + sb.append(" ").append(tableAlias).append(".DEPARTMENT_ID ='").append(deptId).append("' "); + } + hasConditions.set(true); + } + + /** + * 计算有效操作范围 + */ + public OpeScopeFilterResultBean getEffectiveOpeScopes(Set roleIds, String reqiurePermission) { + + // 根据角色列表查询操作范围列表 + Set opeAndScopesOfThisOperation = new HashSet<>(); + roleIds.forEach(roleId -> { + List opes = listAllRoleOperationScopesByRoleId(roleId); + if (!CollectionUtils.isEmpty(opes)) { + opes.forEach(ope -> { + if (reqiurePermission.equals(ope.getOperationKey())) { + // 拿到当前操作对应的 RoleOpeScopeResultDTO + opeAndScopesOfThisOperation.add(ope); + } + }); + } + }); + + // 过滤范围 + return filteAndGroupScopes(opeAndScopesOfThisOperation); + } + + /** + * 对范围进行过滤和分组 + * + * @param scopeDTOS * @return */ - @Override - public Map listAccessSettings(String roleId, String operationKey) { - Map settings = roleAccessSettingRedis.get(roleId, operationKey); - if (settings == null) { - settings = new HashMap<>(); - // 数据库查出来,放入redis一份。此处为权限过滤器用到 - List accessSettingDtos = accessSettingDao.listAccessSettingsByRoleId(roleId, operationKey); - if (!CollectionUtils.isEmpty(accessSettingDtos)) { - for (AccessSettingResultDTO setting : accessSettingDtos) { - settings.put(setting.getSettingKey(), setting.getSettingValue()); + private OpeScopeFilterResultBean filteAndGroupScopes(Set scopeDTOS) { + // 存储上下级关系系列范围。先放到Map是为了去重和中途判断 + HashMap orgLevelScopes = new HashMap<>(); + + // 存储开关系列范围 + Set switchScopes = new HashSet<>(); + + // 所有范围 + Boolean all = false; + + for (RoleOpeScopeResultDTO scope : scopeDTOS) { + + if (OpeScopeConstant.ALL.equals(scope.getScopeKey())) { + all = true; + break; + } + + if (OperationScopeConstant.SERIES_SWITCH.equals(scope.getSeries())) { + switchScopes.add(scope.getScopeKey()); + continue; + } + + String scopeIndex = scope.getScopeIndex(); + if (OpeScopeConstant.ORG_ALL.equals(scope.getScopeKey())) { + // 该操作具有org_all的权限,直接放入 + orgLevelScopes.put(scopeIndex, scope); + continue; + } + + String[] currArr = scopeIndex.split("_"); + if ("0".equals(currArr[1])) { + // 为0,说明没有包含关系,直接放入 + orgLevelScopes.put(scopeIndex, scope); + continue; + } + + RoleOpeScopeResultDTO tempScope = orgLevelScopes.get(currArr[0]); + if (tempScope != null) { + // 已经有ac开头的了 + String tempScopeIndex = tempScope.getScopeIndex(); + if (Integer.valueOf(currArr[1]) < Integer.valueOf(tempScopeIndex.split("_")[1])) { + orgLevelScopes.put(currArr[0], scope); } } else { - // 占位,否则空map存不到redis中 - settings.put("-", "-"); + orgLevelScopes.put(currArr[0], scope); } - roleAccessSettingRedis.set(settings, roleId, operationKey); } - return settings; + HashSet scopeStrs = new HashSet<>(); + Set> entries = orgLevelScopes.entrySet(); + for (Map.Entry entry : entries) { + scopeStrs.add(entry.getValue().getScopeKey()); + } + OpeScopeFilterResultBean resultBean = new OpeScopeFilterResultBean(); + resultBean.setOrgLevelScopes(scopeStrs); + resultBean.setSwitchScopes(switchScopes); + resultBean.setAllScopes(all); + return resultBean; } - @Override - public List listAllRoleOperationScopesByRoleId(String roleId) { - List roleAllOpeScopes = roleOpeScopeRedis.getRoleAllOpeScopes(roleId); - if (roleAllOpeScopes == null) { - roleAllOpeScopes = operationScopeDao.listAllRoleOperationScopesByRoleId(roleId); - roleOpeScopeRedis.setRoleAllOpeScopes(roleId, roleAllOpeScopes); + /** + * 生成组织上下级关系系列的sql过滤片段 + * @param sb + * @param orgIdPath + * @param tableAlias + * @return + */ + private void genOrgLevelScopeSqlFilter(StringBuilder sb, HashSet scopes, String orgIdPath, String tableAlias) { + // 取出父组织ID path 和当前组织ID + //String parentOrgIDPath = orgIdPath.substring(0, orgIdPath.lastIndexOf(orgIdPathSpliter)); + //String currOrgID = orgIdPath.substring(orgIdPath.lastIndexOf(orgIdPathSpliter) + 1); + + for (String scope : scopes) { + switch (scope) { + // 当前单位(可以用ORG_ID_PATH,也可以用ORG_ID判断) + case OpeScopeConstant.ORG_CURR: + if (StringUtils.isBlank(tableAlias)) { + sb.append(" ORG_ID_PATH = '").append(orgIdPath).append("' OR "); + //sb.append(" ORG_ID = '").append(currOrgID).append("' OR "); + } else { + sb.append(" ").append(tableAlias).append(".ORG_ID_PATH = '").append(orgIdPath).append("' OR "); + //sb.append(" ").append(tableAlias).append(".ORG_ID = '").append(currOrgID).append("' OR "); + } + break; + // 本单位及其子级单位 + case OpeScopeConstant.ORG_CURR_AND_SUB: + if (StringUtils.isBlank(tableAlias)) { + sb.append(" ORG_ID_PATH like '").append(orgIdPath).append("%' OR "); + } else { + sb.append(" ").append(tableAlias).append(".ORG_ID_PATH like '").append(orgIdPath).append("%' OR "); + } + break; + // 本单位的子级单位 + case OpeScopeConstant.ORG_CURR_SUB: + if (StringUtils.isBlank(tableAlias)) { + sb.append(" ORG_ID_PATH like '").append(orgIdPath).append(":%' OR "); + } else { + sb.append(" ").append(tableAlias).append(".ORG_ID_PATH like '").append(orgIdPath).append(":%' OR "); + } + break; + //当前单位的父级单位 + case OpeScopeConstant.ORG_CURR_SUP: + if (StringUtils.isBlank(tableAlias)) { + sb.append(" '").append(orgIdPath).append("' like CONCAT(").append("ORG_ID_PATH,':%') OR "); + } else { + sb.append(" '").append(orgIdPath).append("' like CONCAT(").append(tableAlias).append(".ORG_ID_PATH,':%') OR "); + } + break; + // 当前单位及其父级单位 + case OpeScopeConstant.ORG_CURR_AND_SUP: + if (StringUtils.isBlank(tableAlias)) { + sb.append(" '").append(orgIdPath).append("' like CONCAT(").append("ORG_ID_PATH,'%') OR "); + } else { + sb.append(" '").append(orgIdPath).append("' like CONCAT(").append(tableAlias).append(".ORG_ID_PATH,'%' ) OR "); + } + break; + case OpeScopeConstant.ORG_EQUAL: + // todo 同级 + //sb.append(" OR "); + break; + case OpeScopeConstant.ORG_EQUAL_AND_SUB: + // todo 同级及其子级 + //sb.append(" OR "); + break; + case OpeScopeConstant.ORG_EQUAL_SUB: + // todo 同级的子级 + //sb.append(" OR "); + break; + case OpeScopeConstant.ORG_EQUAL_AND_SUP: + // todo 同级及其上级 + //sb.append(" OR "); + break; + case OpeScopeConstant.ORG_EQUAL_SUP: + // todo 同级的上级 + //sb.append(" OR "); + break; + } } - return roleAllOpeScopes; + + sb.replace(sb.lastIndexOf("OR"), sb.lastIndexOf("OR") + 3, ""); + hasConditions.set(true); } } diff --git a/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/AccessSettingDao.xml b/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/AccessSettingDao.xml deleted file mode 100644 index 1449da2fc0..0000000000 --- a/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/AccessSettingDao.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - DELETE - FROM access_setting - WHERE ROLE_ID = #{roleId} - AND OPERATION_KEY = #{operationKey} - AND SETTING_KEY IN - - #{settingKey} - - - - - - - - UPDATE access_setting s - SET DEL_FLAG = 0 - WHERE s.ROLE_ID = #{roleId} - AND s.OPERATION_KEY = #{operationKey} - AND s.SETTING_KEY = #{settingKey} - - \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/AccessSettingOptionsDao.xml b/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/AccessSettingOptionsDao.xml deleted file mode 100644 index bce8884f0f..0000000000 --- a/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/AccessSettingOptionsDao.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/OperationScopeDao.xml b/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/OperationScopeDao.xml index 89a3256e3e..c1772b7c54 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/OperationScopeDao.xml +++ b/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/OperationScopeDao.xml @@ -7,6 +7,9 @@ + + + @@ -29,7 +32,7 @@ diff --git a/epmet-module/gov-access/gov-access-server/src/test/java/com/epmet/test/govaccess/AccessSettingTest.java b/epmet-module/gov-access/gov-access-server/src/test/java/com/epmet/test/govaccess/AccessSettingTest.java deleted file mode 100644 index c40e1c2463..0000000000 --- a/epmet-module/gov-access/gov-access-server/src/test/java/com/epmet/test/govaccess/AccessSettingTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.epmet.test.govaccess; - -import com.epmet.dao.AccessSettingDao; -import com.epmet.dto.result.AccessSettingResultDTO; -import com.epmet.redis.RoleAccessSettingRedis; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class AccessSettingTest { - - @Autowired - private AccessSettingDao roleAccessSettingDao; - - @Autowired - private RoleAccessSettingRedis roleAccessSettingRedis; - - @Test - public void addAccessSettings2Redis() { - List settings = roleAccessSettingDao.listAccessSettingsByRoleId("1", "org_staff_list"); - HashMap objectObjectHashMap = new HashMap<>(); - settings.forEach(setting -> { - objectObjectHashMap.put(setting.getSettingKey(), setting.getSettingValue()); - }); - roleAccessSettingRedis.set(objectObjectHashMap, "1", "org_staff_list"); - Map map = roleAccessSettingRedis.get("1", "org_staff_list"); - System.out.println(map); - } - -} From 53cc2c2ef4c2de9b99e7d58f2fe2ebb35ab01d35 Mon Sep 17 00:00:00 2001 From: wxz Date: Mon, 18 May 2020 19:50:23 +0800 Subject: [PATCH 02/31] =?UTF-8?q?=E6=9D=83=E9=99=90=E5=A4=A7=E6=94=B9?= =?UTF-8?q?=E5=89=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/form/ListOpePermsFormDTO.java | 4 ++ .../com/epmet/feign/EpmetUserFeignClient.java | 64 +++++++++++++++++++ .../com/epmet/feign/GovOrgFeignClient.java | 34 ++++++++++ .../EpmetUserFeignClientFallback.java | 42 ++++++++++++ .../fallback/GovOrgFeignClientFallBack.java | 31 +++++++++ 5 files changed, 175 insertions(+) create mode 100644 epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/ListOpePermsFormDTO.java create mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java create mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java create mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java create mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/ListOpePermsFormDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/ListOpePermsFormDTO.java new file mode 100644 index 0000000000..31e8aadd1f --- /dev/null +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/ListOpePermsFormDTO.java @@ -0,0 +1,4 @@ +package com.epmet.dto.form; + +public class ListOpePermsFormDTO { +} diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java new file mode 100644 index 0000000000..cc93ea20d7 --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java @@ -0,0 +1,64 @@ +package com.epmet.feign.fallback; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.GovStaffRoleDTO; +import com.epmet.dto.form.LatestGridFormDTO; +import com.epmet.dto.form.StaffGridVisitedFormDTO; +import com.epmet.dto.form.StaffRoleFormDTO; +import com.epmet.dto.result.CustomerGridByUserIdResultDTO; +import com.epmet.dto.result.LatestCustomerResultDTO; +import com.epmet.feign.fallback.EpmetUserFeignClientFallback; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +import java.util.List; + + +/** + * @Description + * @Author sun + */ +//, url = "localhost:8087" +@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallback.class) +public interface EpmetUserFeignClient { + /** + * 获取最近一次登录的客户信息 + * + * @param userId + * @return + */ + @GetMapping("/epmetuser/staffagencyvisited/getlatestcustomer/{userId}") + Result getLatestCustomer(@PathVariable("userId") String userId); + + /** + * @Description 查询工作人员上次登录的网格 + * @Param customerId ; staffId + * @return Result + * @Author wangc + * @Date 2020.04.23 10:44 + **/ + @PostMapping(value = "/epmetuser/staffgridvisited/getstafflatestgrid") + Result getStaffLatestGrid(LatestGridFormDTO latestGridFormDTO); + + /** + * @param staffGridVisitedFormDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 保存网格访问记录 + * @Date 2020/4/23 13:27 + **/ + @PostMapping(value = "/epmetuser/staffgridvisited/savestaffgridvisitedrecord", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) + Result saveStaffGridVisitedRecord(@RequestBody StaffGridVisitedFormDTO staffGridVisitedFormDTO); + /** + * 查询工作人员的角色 + * @return + */ + @PostMapping("/epmetuser/staffrole/staffroles") + Result> getRolesOfStaff(StaffRoleFormDTO staffRoleFormDTO); +} + diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java new file mode 100644 index 0000000000..0e559e5d94 --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java @@ -0,0 +1,34 @@ +package com.epmet.feign.fallback; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerAgencyDTO; +import com.epmet.feign.fallback.GovOrgFeignClientFallBack; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; + +/** + * @Description + * @Author sun + */ +//, url = "localhost:8092" +@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgFeignClientFallBack.class) +public interface GovOrgFeignClient { + + /** + * 根据Id查询agency + * @param agencyId + * @return + */ + @PostMapping("/gov/org/agency/agencybyid/{agencyId}") + Result getAgencyById(@PathVariable("agencyId") String agencyId); + + /** + * 根据staffId查询所属的组织机构 + * @param staffId + * @return + */ + @PostMapping("/gov/org/agency/agencybystaff/{staffId}") + Result getAgencyByStaff(@PathVariable("staffId") String staffId); +} diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java new file mode 100644 index 0000000000..12a4b4e6c6 --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java @@ -0,0 +1,42 @@ +package com.epmet.feign.fallback; + + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.GovStaffRoleDTO; +import com.epmet.dto.form.LatestGridFormDTO; +import com.epmet.dto.form.StaffGridVisitedFormDTO; +import com.epmet.dto.form.StaffRoleFormDTO; +import com.epmet.dto.result.CustomerGridByUserIdResultDTO; +import com.epmet.dto.result.LatestCustomerResultDTO; +import com.epmet.feign.EpmetUserFeignClient; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * @Description + * @Author sun + */ +@Component +public class EpmetUserFeignClientFallback implements EpmetUserFeignClient { + + @Override + public Result getLatestCustomer(String userId) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getLatestCustomer", userId); + } + + @Override + public Result> getRolesOfStaff(StaffRoleFormDTO staffRoleFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getRolesOfStaff"); + } + @Override + public Result getStaffLatestGrid(LatestGridFormDTO latestGridFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffLatestGrid",latestGridFormDTO); + } + @Override + public Result saveStaffGridVisitedRecord(StaffGridVisitedFormDTO staffGridVisitedFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "saveStaffGridVisitedRecord", staffGridVisitedFormDTO); + } +} diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java new file mode 100644 index 0000000000..f418de95e0 --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java @@ -0,0 +1,31 @@ +package com.epmet.feign.fallback; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerAgencyDTO; +import com.epmet.dto.form.LatestGridFormDTO; +import com.epmet.dto.result.CustomerGridByUserIdResultDTO; +import com.epmet.dto.result.LatestCustomerResultDTO; +import com.epmet.feign.GovOrgFeignClient; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * @Description + * @Author sun + */ +@Component +public class GovOrgFeignClientFallBack implements GovOrgFeignClient { + + @Override + public Result getAgencyById(String agencyId) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAgencyById", agencyId); + } + + @Override + public Result getAgencyByStaff(String staffId) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAgencyByStaff", staffId); + } +} \ No newline at end of file From acaaf1eddab26463d1421774669e757e0c27822f Mon Sep 17 00:00:00 2001 From: wxz Date: Mon, 18 May 2020 19:51:14 +0800 Subject: [PATCH 03/31] =?UTF-8?q?1.=E6=9D=83=E9=99=90=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/form/ListOpePermsFormDTO.java | 10 + .../epmet/controller/AccessController.java | 16 +- .../com/epmet/feign/EpmetUserFeignClient.java | 2 +- .../com/epmet/feign/GovOrgFeignClient.java | 2 +- .../java/com/epmet/service/AccessService.java | 6 + .../epmet/service/impl/AccessServiceImpl.java | 145 ++++++++++ .../com/epmet/feign/GovAccessFeignClient.java | 10 +- .../GovAccessFeignClientFallback.java | 6 + .../epmet/service/impl/AccessServiceImpl.java | 257 +----------------- .../epmet/service/CustomerAgencyService.java | 1 - 10 files changed, 201 insertions(+), 254 deletions(-) diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/ListOpePermsFormDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/ListOpePermsFormDTO.java index 31e8aadd1f..af13b14a3c 100644 --- a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/ListOpePermsFormDTO.java +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/ListOpePermsFormDTO.java @@ -1,4 +1,14 @@ package com.epmet.dto.form; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +@Data public class ListOpePermsFormDTO { + + @NotBlank(message = "用户ID不能为空") + private String staffId; + @NotBlank(message = "当前单位不能为空") + private String currAgencyId; } diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessController.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessController.java index 74e40a8579..8a68bec452 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessController.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessController.java @@ -10,6 +10,7 @@ import com.epmet.service.AccessService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import javax.validation.constraints.NotBlank; import java.util.List; import java.util.Set; @@ -88,7 +89,7 @@ public class AccessController { } /** - * 用户是否具有指定权限 + * 用户是否具有指定功能权限 * @return */ @PostMapping("hasspecifiedpermission") @@ -98,6 +99,19 @@ public class AccessController { return new Result().ok(hasPermission); } + /** + * 列出功能权限列表 + * @return + */ + @PostMapping("listoperationpermissions") + public Result> listOperationPermissions(@RequestBody ListOpePermsFormDTO listOpePermsFormDTO) { + ValidatorUtils.validateEntity(listOpePermsFormDTO); + String currAgencyId = listOpePermsFormDTO.getCurrAgencyId(); + String staffId = listOpePermsFormDTO.getStaffId(); + Set operationPermissions = accessService.listOperationPermissions(staffId, currAgencyId); + return new Result>().ok(operationPermissions); + } + /** * 查询sql过滤片段 * @param form diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java index cc93ea20d7..eaabe43f49 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java @@ -1,4 +1,4 @@ -package com.epmet.feign.fallback; +package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java index 0e559e5d94..d6ab4325af 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java @@ -1,4 +1,4 @@ -package com.epmet.feign.fallback; +package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessService.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessService.java index 8ba649e51d..831126f6bf 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessService.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessService.java @@ -50,4 +50,10 @@ public interface AccessService { * @param form */ String getSqlFilterSegment(GetSQLFilterFormDTO form); + + /** + * 列出角色的功能权限 + * @return + */ + Set listOperationPermissions(String staffId, String currAgencyId); } diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java index ee246fe87d..c74e8db9c0 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java @@ -8,9 +8,13 @@ import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.security.dto.GovTokenDto; import com.epmet.commons.tools.utils.CpUserDetailRedis; +import com.epmet.commons.tools.utils.Result; import com.epmet.constant.OperationScopeConstant; import com.epmet.dao.OperationScopeDao; +import com.epmet.dto.CustomerAgencyDTO; +import com.epmet.dto.GovStaffRoleDTO; import com.epmet.dto.form.GetSQLFilterFormDTO; +import com.epmet.dto.form.StaffRoleFormDTO; import com.epmet.dto.result.RoleOpeScopeResultDTO; import com.epmet.redis.RoleOpeScopeRedis; import com.epmet.service.AccessService; @@ -43,6 +47,16 @@ public class AccessServiceImpl implements AccessService { @Autowired private RoleOpeScopeRedis roleOpeScopeRedis; + @Autowired + private GovOrgFeignClient govOrgFeignClient; + + @Autowired + private EpmetUserFeignClient userFeignClient; + + public static final String ORG_RELATION_SAME = "same"; + public static final String ORG_RELATION_SUB = "sub"; + public static final String ORG_RELATION_SUP = "sup"; + /** * 更新权限缓存 * @param staffId @@ -423,4 +437,135 @@ public class AccessServiceImpl implements AccessService { sb.replace(sb.lastIndexOf("OR"), sb.lastIndexOf("OR") + 3, ""); hasConditions.set(true); } + + @Override + public Set listOperationPermissions(String staffId, String currAgencyId) { + + // 1.拿到所属组织机构信息 + Result agencyByStaffRst = govOrgFeignClient.getAgencyByStaff(staffId); + if (!agencyByStaffRst.success()) { + logger.error("根据StaffId查询所属单位出错,StaffId:{}, 错误信息:{}", staffId, agencyByStaffRst.getMsg()); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } + CustomerAgencyDTO belongAgency = agencyByStaffRst.getData(); + if (belongAgency == null) { + logger.error("根据StaffId查询所属单位结果为空,StaffId:{}", staffId); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } + + // 2.拿到当前所处机关单位信息 + Result currAgencyRst = govOrgFeignClient.getAgencyById(currAgencyId); + CustomerAgencyDTO currAgencyDto = currAgencyRst.getData(); + if (!currAgencyRst.success() || currAgencyDto == null) { + logger.error("根据当前机构id[{}]查询pids失败:{}", currAgencyId, currAgencyRst.getMsg()); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } + + // 查询机关单位中的角色 + List roleDTOS = queryGovStaffRoles(staffId, belongAgency.getId()); + + // 当前组织和所属组织的orgId路径,以及他们的上下级关系 + String belongOrgIdPath = getOrgIdPath(belongAgency); + String currOrgIdPath = getOrgIdPath(currAgencyDto); + String currOrgRelation = getCurrOrgRelation(belongOrgIdPath, currOrgIdPath); + + Set filtedOps = new HashSet<>(); + + roleDTOS.forEach(roleDTO -> { + List opeAndScopeDTO = listAllRoleOperationScopesByRoleId(roleDTO.getId()); + filtedOps.addAll(filterOpesByScope(currOrgRelation, opeAndScopeDTO)); + }); + return filtedOps; + } + + /** + * 获取当前所处机关与所属机关的关系 + */ + private String getCurrOrgRelation(String belongOrgPath, String currAgencyPath) { + if (belongOrgPath.equals(currAgencyPath)) { + // 当前机关即该人员所属机关 + return ORG_RELATION_SAME; + } else if (currAgencyPath.indexOf(belongOrgPath.concat(":")) > -1) { + // 说明当前所在机关是人员所属机关子级,只取出scope为sub的 + return ORG_RELATION_SUB; + } else if (belongOrgPath.indexOf(currAgencyPath.concat(":")) > -1) { + // 说明当前所在机关是人员所属机关的上级 + return ORG_RELATION_SUP; + } + return belongOrgPath; + } + + /** + * 获取组织的orgId路径 + */ + public String getOrgIdPath(CustomerAgencyDTO agency) { + // 拼接单位ID全路径 + if ("0".equals(agency.getPid())) { + // 顶级组织 + return agency.getId(); + } else { + return agency.getPids().concat(":").concat(agency.getId()); + } + } + + public List queryGovStaffRoles(String staffId, String orgId) { + List roleDTOS = new ArrayList<>(); + StaffRoleFormDTO formDTO = new StaffRoleFormDTO(); + formDTO.setStaffId(staffId); + formDTO.setOrgId(orgId); + Result> gridResult = userFeignClient.getRolesOfStaff(formDTO); + if (!CollectionUtils.isEmpty(gridResult.getData())) { + roleDTOS.addAll(gridResult.getData()); + } + return roleDTOS; + } + + /** + * 根据上下级关系过滤出要返回的权限列表 + * + * @param currOrgRelation + * @param roleOperations + * @return + */ + private HashSet filterOpesByScope(String currOrgRelation, List roleOperations) { + HashSet opeKeys = new HashSet<>(); + for (RoleOpeScopeResultDTO opeScope : roleOperations) { + String scopeKey = opeScope.getScopeKey(); + if (OpeScopeConstant.ORG_ALL.equals(scopeKey) || OpeScopeConstant.ALL.equals(scopeKey)) { + // 如果该操作的范围是org_all或者all,不需要根据上下级关系判断,直接返回即可。 + opeKeys.add(opeScope.getOperationKey()); + continue; + } + + if (!opeScope.getSeries().equals(OperationScopeConstant.SERIES_ORG_LEVEL)) { + // 如果不是org_level系列权限,跳过。(如果一个操作没有分配org_level系列权限,那么无法根据所在机构判断是否具有该功能权限) + // 此时不会给前台返回此功能权限。即要求所有操作必须分配至少一个org_level系列权限(如果实在不需要,可以分配成org_all)。 + continue; + } + + switch (currOrgRelation) { + case ORG_RELATION_SAME:// 就在所在机构下 + if (OpeScopeConstant.ORG_CURR.equals(scopeKey) + || OpeScopeConstant.ORG_CURR_AND_SUB.equals(scopeKey) + || OpeScopeConstant.ORG_CURR_AND_SUP.equals(scopeKey)) { + opeKeys.add(opeScope.getOperationKey()); + } + break; + case ORG_RELATION_SUB:// 所在机构的子级 + if (OpeScopeConstant.ORG_CURR_SUB.equals(scopeKey) + || OpeScopeConstant.ORG_CURR_AND_SUB.equals(scopeKey)) { + opeKeys.add(opeScope.getOperationKey()); + } + break; + case ORG_RELATION_SUP:// 所在机构的上级 + if (OpeScopeConstant.ORG_CURR_SUP.equals(scopeKey) + || OpeScopeConstant.ORG_CURR_AND_SUP.equals(scopeKey)) { + opeKeys.add(opeScope.getOperationKey()); + } + break; + } + } + return opeKeys; + } + } diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovAccessFeignClient.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovAccessFeignClient.java index d554ad636e..ff347a674c 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovAccessFeignClient.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovAccessFeignClient.java @@ -3,6 +3,7 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.OperationScopeDTO; +import com.epmet.dto.form.ListOpePermsFormDTO; import com.epmet.dto.form.OperationScopeFormDTO; import com.epmet.dto.form.StaffPermCacheFormDTO; import com.epmet.dto.result.RoleOpeScopeResultDTO; @@ -21,7 +22,7 @@ import java.util.Set; * @Author sun */ //url = "localhost:8099" -@FeignClient(name = ServiceConstant.GOV_ACCESS_SERVER, fallback = GovAccessFeignClientFallback.class) +@FeignClient(name = ServiceConstant.GOV_ACCESS_SERVER, fallback = GovAccessFeignClientFallback.class, url = "localhost:8099") public interface GovAccessFeignClient { /** @@ -55,4 +56,11 @@ public interface GovAccessFeignClient { @PostMapping("/gov/access/access/roleallopesandscopes/{roleId}") Result> listRoleAllOperationScopesByRoleId(@PathVariable("roleId") String roleId); + /** + * 列出觉得的功能权限列表 + * @return + */ + @PostMapping("listoperationpermissions") + Result> listOperationPermissions(@RequestBody ListOpePermsFormDTO listOpePermsFormDTO); + } diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovAccessFeignClientFallback.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovAccessFeignClientFallback.java index 55f4143e0a..36ed3ae74f 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovAccessFeignClientFallback.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovAccessFeignClientFallback.java @@ -4,6 +4,7 @@ import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.OperationScopeDTO; +import com.epmet.dto.form.ListOpePermsFormDTO; import com.epmet.dto.form.OperationScopeFormDTO; import com.epmet.dto.form.StaffPermCacheFormDTO; import com.epmet.dto.result.RoleOpeScopeResultDTO; @@ -46,4 +47,9 @@ public class GovAccessFeignClientFallback implements GovAccessFeignClient { public Result> listRoleAllOperationScopesByRoleId(String roleId) { return ModuleUtils.feignConError(ServiceConstant.GOV_ACCESS_SERVER, "listRoleAllOperationScopesByRoleId", roleId); } + + @Override + public Result> listOperationPermissions(ListOpePermsFormDTO listOpePermsFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ACCESS_SERVER, "listOperationPermissions", listOpePermsFormDTO); + } } diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java index 4012555d6d..5f7926415b 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java @@ -1,24 +1,15 @@ package com.epmet.service.impl; -import com.epmet.commons.tools.constant.OpeScopeConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.CustomerAgencyDTO; -import com.epmet.dto.GovStaffRoleDTO; -import com.epmet.dto.OperationScopeDTO; -import com.epmet.dto.form.StaffRoleFormDTO; -import com.epmet.dto.result.RoleOpeScopeResultDTO; -import com.epmet.feign.EpmetUserFeignClient; +import com.epmet.dto.form.ListOpePermsFormDTO; import com.epmet.feign.GovAccessFeignClient; -import com.epmet.feign.GovOrgFeignClient; import com.epmet.service.AccessService; -import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; import java.util.*; @@ -27,253 +18,21 @@ public class AccessServiceImpl implements AccessService { private static Logger logger = LoggerFactory.getLogger(AccessServiceImpl.class); - @Autowired - private EpmetUserFeignClient userFeignClient; - @Autowired private GovAccessFeignClient govAccessFeignClient; - @Autowired - private GovOrgFeignClient govOrgFeignClient; - - public static final String ORG_RELATION_SAME = "same"; - public static final String ORG_RELATION_SUB = "sub"; - public static final String ORG_RELATION_SUP = "sup"; - - public List queryGovStaffRoles(String staffId, String orgId) { - List roleDTOS = new ArrayList<>(); - StaffRoleFormDTO formDTO = new StaffRoleFormDTO(); - formDTO.setStaffId(staffId); - formDTO.setOrgId(orgId); - Result> gridResult = userFeignClient.getRolesOfStaff(formDTO); - if (!CollectionUtils.isEmpty(gridResult.getData())) { - roleDTOS.addAll(gridResult.getData()); - } - return roleDTOS; - } - @Override public Set listOpeKeysByStaffId(String app, String client, String staffId, String currAgencyId, String currGridId) { - // 1.拿到所属组织机构信息 - Result agencyByStaffRst = govOrgFeignClient.getAgencyByStaff(staffId); - if (!agencyByStaffRst.success()) { - logger.error("根据StaffId查询所属单位出错,StaffId:{}, 错误信息:{}", staffId, agencyByStaffRst.getMsg()); - throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); - } - CustomerAgencyDTO belongAgency = agencyByStaffRst.getData(); - if (belongAgency == null) { - logger.error("根据StaffId查询所属单位结果为空,StaffId:{}", staffId); - throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); - } - - // 2.拿到当前所处机关单位信息 - Result currAgencyRst = govOrgFeignClient.getAgencyById(currAgencyId); - CustomerAgencyDTO currAgencyDto = currAgencyRst.getData(); - if (!currAgencyRst.success() || currAgencyDto == null) { - logger.error("根据当前机构id[{}]查询pids失败:{}", currAgencyId, currAgencyRst.getMsg()); + ListOpePermsFormDTO listOpePermsFormDTO = new ListOpePermsFormDTO(); + listOpePermsFormDTO.setStaffId(staffId); + listOpePermsFormDTO.setCurrAgencyId(currAgencyId); + Result> result = govAccessFeignClient.listOperationPermissions(listOpePermsFormDTO); + if (!result.success()) { + logger.error("调用GovAccess服务查询功能权限列表失败,StaffId:{},错误信息:{}", staffId, result.getMsg()); throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); } - // 拿到该用户所属的组织机构的orgIdPath,拿到当前组织机构的orgIdPath,看当前组织机构的orgIdPath是否在用户所属的组织机构的orgIdPath下 - - // 查询机关单位中的角色 - List roleDTOS = queryGovStaffRoles(staffId, belongAgency.getId()); - - // 拼装操作key列表 - //Set opeKeys = new HashSet<>(); - // 角色ID列表 - //Set roleIds = new HashSet<>(); - - // 当前组织和所属组织的orgId路径,以及他们的上下级关系 - String belongOrgIdPath = getOrgIdPath(belongAgency); - String currOrgIdPath = getOrgIdPath(currAgencyDto); - String currOrgRelation = getCurrOrgRelation(belongOrgIdPath, currOrgIdPath); - - HashSet filtedOps = new HashSet<>(); - roleDTOS.forEach(roleDto -> { - String roleId = roleDto.getId(); - // 找出该角色的所有功能操作列表 - Result> result = govAccessFeignClient.listRoleAllOperationScopesByRoleId(roleId); - if (!result.success()) { - // 获取operation异常 - logger.error("调用GovAccess,根据RoleId查询Operation列表失败:{}", result.getMsg()); - throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); - } - List roleOperations = result.getData(); - filtedOps.addAll(filterOpesByScope(currOrgRelation, roleOperations)); - }); - return filtedOps; - } - - /** - * 根据上下级关系过滤出要返回的权限列表 - * - * @param currOrgRelation - * @param roleOperations - * @return - */ - private HashSet filterOpesByScope(String currOrgRelation, List roleOperations) { - HashSet opeKeys = new HashSet<>(); - for (RoleOpeScopeResultDTO opeScope : roleOperations) { - String scopeKey = opeScope.getScopeKey(); - if (OpeScopeConstant.ORG_ALL.equals(scopeKey)) { - // 如果该操作的范围是org_all,那就具有所有范围的该操作权限,不需要根据上下级关系判断 - opeKeys.add(opeScope.getOperationKey()); - continue; - } - switch (currOrgRelation) { - case ORG_RELATION_SAME:// 就在所在机构下 - if (OpeScopeConstant.ORG_CURR.equals(scopeKey) - || OpeScopeConstant.ORG_CURR_AND_SUB.equals(scopeKey) - || OpeScopeConstant.ORG_CURR_AND_SUP.equals(scopeKey)) { - opeKeys.add(opeScope.getOperationKey()); - } - break; - case ORG_RELATION_SUB:// 所在机构的子级 - if (OpeScopeConstant.ORG_CURR_SUB.equals(scopeKey) - || OpeScopeConstant.ORG_CURR_AND_SUB.equals(scopeKey)) { - opeKeys.add(opeScope.getOperationKey()); - } - break; - case ORG_RELATION_SUP:// 所在机构的上级 - if (OpeScopeConstant.ORG_CURR_SUP.equals(scopeKey) - || OpeScopeConstant.ORG_CURR_AND_SUP.equals(scopeKey)) { - opeKeys.add(opeScope.getOperationKey()); - } - break; - } - } - return opeKeys; - } - - /** - * 获取当前所处机关与所属机关的关系 - */ - private String getCurrOrgRelation(String belongOrgPath, String currAgencyPath) { - if (belongOrgPath.equals(currAgencyPath)) { - // 当前机关即该人员所属机关 - return ORG_RELATION_SAME; - } else if (currAgencyPath.indexOf(belongOrgPath.concat(":")) > -1) { - // 说明当前所在机关是人员所属机关子级,只取出scope为sub的 - return ORG_RELATION_SUB; - } else if (belongOrgPath.indexOf(currAgencyPath.concat(":")) > -1) { - // 说明当前所在机关是人员所属机关的上级 - return ORG_RELATION_SUP; - } - return belongOrgPath; - } - - /** - * 获取组织的orgId路径 - */ - public String getOrgIdPath(CustomerAgencyDTO agency) { - // 拼接单位ID全路径 - if ("0".equals(agency.getPid())) { - // 顶级组织 - return agency.getId(); - } else { - return agency.getPids().concat(":").concat(agency.getId()); - } - } - - //private boolean filterCurrOrgKeysByScope(Set roleIds, String opeKey) { - // for (String roleId : roleIds) { - // Result> result = govAccessFeignClient.listRoleAllOperationScopesByRoleId(roleId); - // if (!result.success()) { - // continue; - // } - // Set scopeDTOS = result.getData(); - // Set scopeKeys = scopeDTOS.stream() - // .filter(scope -> scope.getScopeKey().equals(opeKey)) - // .map(scope -> scope.getScopeKey()) - // .collect(Collectors.toSet()); - // if (scopeKeys.contains(OpeScopeConstant.ORG_CURR) - // || scopeKeys.contains(OpeScopeConstant.ORG_CURR_AND_SUB) - // || scopeKeys.contains(OpeScopeConstant.ORG_CURR_AND_SUP)) { - // return true; - // } - // } - // return false; - //} - - //private boolean filterSubOrgKeysByScope(Set roleIds, String opeKey) { - // for (String roleId : roleIds) { - // OperationScopeFormDTO opeScopeFormDTO = new OperationScopeFormDTO(); - // opeScopeFormDTO.setRoleId(roleId); - // opeScopeFormDTO.setOperationKey(opeKey); - // Result> result = govAccessFeignClient.getOperationScopesByRoleId(opeScopeFormDTO); - // if (!result.success()) { - // continue; - // } - // - // Set scopeDTOS = result.getData(); - // Set scopeKeys = scopeDTOS.stream().map(scope -> scope.getScopeKey()).collect(Collectors.toSet()); - // if (scopeKeys.contains(OpeScopeConstant.ORG_CURR_SUB) - // || scopeKeys.contains(OpeScopeConstant.ORG_CURR_AND_SUB)) { - // return true; - // } - // } - // return false; - //} - - //private boolean filterSupOrgKeysByScope(Set roleIds, String opeKey) { - // for (String roleId : roleIds) { - // OperationScopeFormDTO opeScopeFormDTO = new OperationScopeFormDTO(); - // opeScopeFormDTO.setRoleId(roleId); - // opeScopeFormDTO.setOperationKey(opeKey); - // Result> result = govAccessFeignClient.getOperationScopesByRoleId(opeScopeFormDTO); - // if (!result.success()) { - // continue; - // } - // - // Set scopeDTOS = result.getData(); - // Set scopeKeys = scopeDTOS.stream().map(scope -> scope.getScopeKey()).collect(Collectors.toSet()); - // if (scopeKeys.contains(OpeScopeConstant.ORG_CURR_SUP) - // || scopeKeys.contains(OpeScopeConstant.ORG_CURR_AND_SUP)) { - // return true; - // } - // } - // return false; - //} - - /** - * 过滤有效范围 - * - * @param scopeDTOS - * @return - */ - private HashSet filteScopes(Set scopeDTOS) { - HashMap filtedScopes = new HashMap<>(); - - for (OperationScopeDTO scope : scopeDTOS) { - String scopeIndex = scope.getScopeIndex(); - if (StringUtils.isBlank(scopeIndex)) { - continue; - } - String[] currArr = scopeIndex.split("_"); - if ("0".equals(currArr[1])) { - // 为0,说明没有包含关系,直接放入 - filtedScopes.put(scopeIndex, scope); - continue; - } - - OperationScopeDTO tempScope = filtedScopes.get(currArr[0]); - if (tempScope != null) { - // 已经有ac开头的了 - String tempScopeIndex = tempScope.getScopeIndex(); - if (Integer.valueOf(currArr[1]) < Integer.valueOf(tempScopeIndex.split("_")[1])) { - filtedScopes.put(currArr[0], scope); - } - } else { - filtedScopes.put(currArr[0], scope); - } - } - HashSet scopeStrs = new HashSet<>(); - Set> entries = filtedScopes.entrySet(); - for (Map.Entry entry : entries) { - scopeStrs.add(entry.getValue().getScopeKey()); - } - return scopeStrs; + return result.getData(); } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java index 6cc44ea483..b0babab2fc 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java @@ -22,7 +22,6 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.form.AgencyDeptGridFormDTO; -import com.epmet.dto.form.CanTickStaffListFormDTO; import com.epmet.dto.form.StaffOrgFormDTO; import com.epmet.dto.result.*; import com.epmet.entity.CustomerAgencyEntity; From ea7d17e3bbf0d1640e6abb45c11f9969e1e74cc9 Mon Sep 17 00:00:00 2001 From: wxz Date: Mon, 18 May 2020 20:33:59 +0800 Subject: [PATCH 04/31] =?UTF-8?q?1.=E5=B0=86gov-mine=E7=9A=84=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E6=9D=83=E9=99=90=E8=AE=A1=E7=AE=97=E6=94=BE=E5=88=B0?= =?UTF-8?q?=E4=BA=86gov-access?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-module/gov-access/gov-access-server/pom.xml | 12 ++++++++++++ .../com/epmet/service/impl/AccessServiceImpl.java | 2 ++ .../java/com/epmet/feign/GovAccessFeignClient.java | 2 +- .../com/epmet/service/CustomerAgencyService.java | 1 + 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/epmet-module/gov-access/gov-access-server/pom.xml b/epmet-module/gov-access/gov-access-server/pom.xml index f52504e33e..b45aab6aac 100644 --- a/epmet-module/gov-access/gov-access-server/pom.xml +++ b/epmet-module/gov-access/gov-access-server/pom.xml @@ -19,6 +19,18 @@ gov-access-client 2.0.0 + + com.epmet + gov-org-client + 2.0.0 + compile + + + com.epmet + epmet-user-client + 2.0.0 + compile + com.epmet epmet-commons-tools diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java index c74e8db9c0..28c9535f83 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java @@ -16,6 +16,8 @@ import com.epmet.dto.GovStaffRoleDTO; import com.epmet.dto.form.GetSQLFilterFormDTO; import com.epmet.dto.form.StaffRoleFormDTO; import com.epmet.dto.result.RoleOpeScopeResultDTO; +import com.epmet.feign.EpmetUserFeignClient; +import com.epmet.feign.GovOrgFeignClient; import com.epmet.redis.RoleOpeScopeRedis; import com.epmet.service.AccessService; import org.apache.commons.lang3.StringUtils; diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovAccessFeignClient.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovAccessFeignClient.java index ff347a674c..6e0fabe86f 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovAccessFeignClient.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovAccessFeignClient.java @@ -60,7 +60,7 @@ public interface GovAccessFeignClient { * 列出觉得的功能权限列表 * @return */ - @PostMapping("listoperationpermissions") + @PostMapping("/gov/access/access/listoperationpermissions") Result> listOperationPermissions(@RequestBody ListOpePermsFormDTO listOpePermsFormDTO); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java index b0babab2fc..6cc44ea483 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java @@ -22,6 +22,7 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.form.AgencyDeptGridFormDTO; +import com.epmet.dto.form.CanTickStaffListFormDTO; import com.epmet.dto.form.StaffOrgFormDTO; import com.epmet.dto.result.*; import com.epmet.entity.CustomerAgencyEntity; From 3c16844a7a44206e2aa63e1cb12f39ae91df6033 Mon Sep 17 00:00:00 2001 From: wxz Date: Mon, 18 May 2020 20:41:45 +0800 Subject: [PATCH 05/31] =?UTF-8?q?1.=E7=89=88=E6=9C=AC=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-admin/epmet-admin-server/deploy/docker-compose-dev.yml | 2 +- epmet-admin/epmet-admin-server/pom.xml | 2 +- epmet-auth/deploy/docker-compose-dev.yml | 2 +- epmet-auth/pom.xml | 2 +- .../epmet-message-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-message/epmet-message-server/pom.xml | 2 +- .../epmet-oss/epmet-oss-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-oss/epmet-oss-server/pom.xml | 2 +- .../gov-access/gov-access-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/gov-access/gov-access-server/pom.xml | 2 +- .../gov-grid/gov-grid-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/gov-grid/gov-grid-server/pom.xml | 2 +- .../gov-issue/gov-issue-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/gov-issue/gov-issue-server/pom.xml | 2 +- .../gov-mine/gov-mine-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/gov-mine/gov-mine-server/pom.xml | 2 +- .../gov-org/gov-org-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/gov-org/gov-org-server/pom.xml | 2 +- .../gov-project-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/gov-project/gov-project-server/pom.xml | 2 +- .../oper-access-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/oper-access/oper-access-server/pom.xml | 2 +- .../oper-crm/oper-crm-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/oper-crm/oper-crm-server/pom.xml | 2 +- .../oper-customize-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/oper-customize/oper-customize-server/pom.xml | 2 +- .../resi-group/resi-group-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/resi-group/resi-group-server/pom.xml | 2 +- .../resi-guide/resi-guide-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/resi-guide/resi-guide-server/pom.xml | 2 +- .../resi-hall/resi-hall-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/resi-hall/resi-hall-server/pom.xml | 2 +- .../resi-mine/resi-mine-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/resi-mine/resi-mine-server/pom.xml | 2 +- .../resi-partymember-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/resi-partymember/resi-partymember-server/pom.xml | 2 +- epmet-user/epmet-user-server/deploy/docker-compose-dev.yml | 2 +- epmet-user/epmet-user-server/pom.xml | 2 +- 38 files changed, 38 insertions(+), 38 deletions(-) diff --git a/epmet-admin/epmet-admin-server/deploy/docker-compose-dev.yml b/epmet-admin/epmet-admin-server/deploy/docker-compose-dev.yml index 12296879cc..d222a6a0eb 100644 --- a/epmet-admin/epmet-admin-server/deploy/docker-compose-dev.yml +++ b/epmet-admin/epmet-admin-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-admin-server: container_name: epmet-admin-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-admin-server:0.3.6 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-admin-server:0.3.7 ports: - "8082:8082" network_mode: host # 使用现有网络 diff --git a/epmet-admin/epmet-admin-server/pom.xml b/epmet-admin/epmet-admin-server/pom.xml index acd3ed2875..a044cd52f6 100644 --- a/epmet-admin/epmet-admin-server/pom.xml +++ b/epmet-admin/epmet-admin-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.6 + 0.3.7 com.epmet epmet-admin diff --git a/epmet-auth/deploy/docker-compose-dev.yml b/epmet-auth/deploy/docker-compose-dev.yml index 5a52f95588..6b96de98e3 100644 --- a/epmet-auth/deploy/docker-compose-dev.yml +++ b/epmet-auth/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-auth-server: container_name: epmet-auth-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.7 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.8 ports: - "8081:8081" network_mode: host # 使用现有网络 diff --git a/epmet-auth/pom.xml b/epmet-auth/pom.xml index d7510729ac..d8bc464fbe 100644 --- a/epmet-auth/pom.xml +++ b/epmet-auth/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.7 + 0.3.8 com.epmet epmet-cloud diff --git a/epmet-module/epmet-message/epmet-message-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-message/epmet-message-server/deploy/docker-compose-dev.yml index cbd63b2826..1b19b0b280 100644 --- a/epmet-module/epmet-message/epmet-message-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-message/epmet-message-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-message-server: container_name: epmet-message-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-message-server:0.3.6 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-message-server:0.3.7 ports: - "8085:8085" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-message/epmet-message-server/pom.xml b/epmet-module/epmet-message/epmet-message-server/pom.xml index fb71878a09..b3365e1fc6 100644 --- a/epmet-module/epmet-message/epmet-message-server/pom.xml +++ b/epmet-module/epmet-message/epmet-message-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.6 + 0.3.7 com.epmet epmet-message diff --git a/epmet-module/epmet-oss/epmet-oss-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-oss/epmet-oss-server/deploy/docker-compose-dev.yml index 5ff4ca3c46..82b4e95e18 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-oss/epmet-oss-server/deploy/docker-compose-dev.yml @@ -3,7 +3,7 @@ services: epmet-oss-server: container_name: epmet-oss-server-dev # image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-dev/epmet-oss-server:0.3.2 - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-oss-server:0.3.7 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-oss-server:0.3.8 ports: - "8083:8083" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-oss/epmet-oss-server/pom.xml b/epmet-module/epmet-oss/epmet-oss-server/pom.xml index 39c11018a9..fe2ff88815 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/pom.xml +++ b/epmet-module/epmet-oss/epmet-oss-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.7 + 0.3.8 com.epmet epmet-oss diff --git a/epmet-module/gov-access/gov-access-server/deploy/docker-compose-dev.yml b/epmet-module/gov-access/gov-access-server/deploy/docker-compose-dev.yml index 8757440506..e53f25d20a 100644 --- a/epmet-module/gov-access/gov-access-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-access/gov-access-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-access-server: container_name: gov-access-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-access-server:0.3.10 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-access-server:0.3.11 ports: - "8099:8099" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-access/gov-access-server/pom.xml b/epmet-module/gov-access/gov-access-server/pom.xml index b45aab6aac..4776239c49 100644 --- a/epmet-module/gov-access/gov-access-server/pom.xml +++ b/epmet-module/gov-access/gov-access-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.10 + 0.3.11 gov-access com.epmet diff --git a/epmet-module/gov-grid/gov-grid-server/deploy/docker-compose-dev.yml b/epmet-module/gov-grid/gov-grid-server/deploy/docker-compose-dev.yml index 02b5605c0e..66da251dc6 100644 --- a/epmet-module/gov-grid/gov-grid-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-grid/gov-grid-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-grid-server: container_name: gov-grid-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-grid-server:0.3.18 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-grid-server:0.3.19 ports: - "8097:8097" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-grid/gov-grid-server/pom.xml b/epmet-module/gov-grid/gov-grid-server/pom.xml index 6bdbf0173e..2fb2fabe4d 100644 --- a/epmet-module/gov-grid/gov-grid-server/pom.xml +++ b/epmet-module/gov-grid/gov-grid-server/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - 0.3.18 + 0.3.19 com.epmet gov-grid diff --git a/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml b/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml index 8e8eb36dcb..09ad9844eb 100644 --- a/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-issue-server: container_name: gov-issue-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-issue-server:0.3.8 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-issue-server:0.3.9 ports: - "8101:8101" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-issue/gov-issue-server/pom.xml b/epmet-module/gov-issue/gov-issue-server/pom.xml index b1f8a177e9..2fc548c145 100644 --- a/epmet-module/gov-issue/gov-issue-server/pom.xml +++ b/epmet-module/gov-issue/gov-issue-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.8 + 0.3.9 gov-issue com.epmet diff --git a/epmet-module/gov-mine/gov-mine-server/deploy/docker-compose-dev.yml b/epmet-module/gov-mine/gov-mine-server/deploy/docker-compose-dev.yml index 89a4dfed2b..fa9d543e92 100644 --- a/epmet-module/gov-mine/gov-mine-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-mine/gov-mine-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-mine-server: container_name: gov-mine-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-mine-server:0.3.15 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-mine-server:0.3.16 ports: - "8098:8098" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-mine/gov-mine-server/pom.xml b/epmet-module/gov-mine/gov-mine-server/pom.xml index 8409a5794b..c06766b3a7 100644 --- a/epmet-module/gov-mine/gov-mine-server/pom.xml +++ b/epmet-module/gov-mine/gov-mine-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.15 + 0.3.16 com.epmet gov-mine diff --git a/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml b/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml index 0abde8187f..413fc95074 100644 --- a/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-org-server: container_name: gov-org-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-org-server:0.3.38 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-org-server:0.3.39 ports: - "8092:8092" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-org/gov-org-server/pom.xml b/epmet-module/gov-org/gov-org-server/pom.xml index bab556d2a9..2a07550480 100644 --- a/epmet-module/gov-org/gov-org-server/pom.xml +++ b/epmet-module/gov-org/gov-org-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.38 + 0.3.39 com.epmet gov-org diff --git a/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml b/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml index 7243211cf4..b59a034f47 100644 --- a/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-project-server: container_name: gov-project-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-project-server:0.3.6 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-project-server:0.3.7 ports: - "8102:8102" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-project/gov-project-server/pom.xml b/epmet-module/gov-project/gov-project-server/pom.xml index c8e73701ca..a295ba8970 100644 --- a/epmet-module/gov-project/gov-project-server/pom.xml +++ b/epmet-module/gov-project/gov-project-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.6 + 0.3.7 gov-project com.epmet diff --git a/epmet-module/oper-access/oper-access-server/deploy/docker-compose-dev.yml b/epmet-module/oper-access/oper-access-server/deploy/docker-compose-dev.yml index 613e8ff293..cf1a70099e 100644 --- a/epmet-module/oper-access/oper-access-server/deploy/docker-compose-dev.yml +++ b/epmet-module/oper-access/oper-access-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: oper-access-server: container_name: oper-access-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/oper-access-server:0.3.6 + image: 192.168.1.130:10080/epmet-cloud-dev/oper-access-server:0.3.7 ports: - "8093:8093" network_mode: host # 使用现有网络 diff --git a/epmet-module/oper-access/oper-access-server/pom.xml b/epmet-module/oper-access/oper-access-server/pom.xml index ead4e79273..7d3e4e9975 100644 --- a/epmet-module/oper-access/oper-access-server/pom.xml +++ b/epmet-module/oper-access/oper-access-server/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - 0.3.6 + 0.3.7 oper-access com.epmet diff --git a/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-dev.yml b/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-dev.yml index 2c4a57b403..91318f2653 100644 --- a/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-dev.yml +++ b/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: oper-crm-server: container_name: oper-crm-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/oper-crm-server:0.3.7 + image: 192.168.1.130:10080/epmet-cloud-dev/oper-crm-server:0.3.8 ports: - "8090:8090" network_mode: host # 使用现有网络 diff --git a/epmet-module/oper-crm/oper-crm-server/pom.xml b/epmet-module/oper-crm/oper-crm-server/pom.xml index d4272fbbc9..ed5debabd9 100644 --- a/epmet-module/oper-crm/oper-crm-server/pom.xml +++ b/epmet-module/oper-crm/oper-crm-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.7 + 0.3.8 com.epmet oper-crm diff --git a/epmet-module/oper-customize/oper-customize-server/deploy/docker-compose-dev.yml b/epmet-module/oper-customize/oper-customize-server/deploy/docker-compose-dev.yml index 8f8df757fe..1509f6220d 100644 --- a/epmet-module/oper-customize/oper-customize-server/deploy/docker-compose-dev.yml +++ b/epmet-module/oper-customize/oper-customize-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: oper-customize-server: container_name: oper-customize-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/oper-customize-server:0.3.9 + image: 192.168.1.130:10080/epmet-cloud-dev/oper-customize-server:0.3.10 ports: - "8089:8089" network_mode: host # 使用现有网络 diff --git a/epmet-module/oper-customize/oper-customize-server/pom.xml b/epmet-module/oper-customize/oper-customize-server/pom.xml index 57ad325ec3..7457d99de4 100644 --- a/epmet-module/oper-customize/oper-customize-server/pom.xml +++ b/epmet-module/oper-customize/oper-customize-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.9 + 0.3.10 com.epmet oper-customize diff --git a/epmet-module/resi-group/resi-group-server/deploy/docker-compose-dev.yml b/epmet-module/resi-group/resi-group-server/deploy/docker-compose-dev.yml index 15ce732a08..3a3db94db8 100644 --- a/epmet-module/resi-group/resi-group-server/deploy/docker-compose-dev.yml +++ b/epmet-module/resi-group/resi-group-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: resi-group-server: container_name: resi-group-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/resi-group-server:0.3.23 + image: 192.168.1.130:10080/epmet-cloud-dev/resi-group-server:0.3.24 ports: - "8095:8095" network_mode: host # 使用现有网络 diff --git a/epmet-module/resi-group/resi-group-server/pom.xml b/epmet-module/resi-group/resi-group-server/pom.xml index c8c83e8605..33df0c0b14 100644 --- a/epmet-module/resi-group/resi-group-server/pom.xml +++ b/epmet-module/resi-group/resi-group-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.23 + 0.3.24 com.epmet resi-group diff --git a/epmet-module/resi-guide/resi-guide-server/deploy/docker-compose-dev.yml b/epmet-module/resi-guide/resi-guide-server/deploy/docker-compose-dev.yml index 66e42c6272..234d48c8fd 100644 --- a/epmet-module/resi-guide/resi-guide-server/deploy/docker-compose-dev.yml +++ b/epmet-module/resi-guide/resi-guide-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: resi-guide-server: container_name: resi-guide-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/resi-guide-server:0.3.7 + image: 192.168.1.130:10080/epmet-cloud-dev/resi-guide-server:0.3.8 ports: - "8091:8091" network_mode: host # 使用现有网络 diff --git a/epmet-module/resi-guide/resi-guide-server/pom.xml b/epmet-module/resi-guide/resi-guide-server/pom.xml index ee7df2894b..0f36f1dc06 100644 --- a/epmet-module/resi-guide/resi-guide-server/pom.xml +++ b/epmet-module/resi-guide/resi-guide-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.7 + 0.3.8 com.epmet resi-guide diff --git a/epmet-module/resi-hall/resi-hall-server/deploy/docker-compose-dev.yml b/epmet-module/resi-hall/resi-hall-server/deploy/docker-compose-dev.yml index 8d4c6032da..0b441c86ba 100644 --- a/epmet-module/resi-hall/resi-hall-server/deploy/docker-compose-dev.yml +++ b/epmet-module/resi-hall/resi-hall-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: resi-hall-server: container_name: resi-hall-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/resi-hall-server:0.3.7 + image: 192.168.1.130:10080/epmet-cloud-dev/resi-hall-server:0.3.8 ports: - "8100:8100" network_mode: host # 使用现有网络 diff --git a/epmet-module/resi-hall/resi-hall-server/pom.xml b/epmet-module/resi-hall/resi-hall-server/pom.xml index 6de3bc3a44..d95cf5eb1e 100644 --- a/epmet-module/resi-hall/resi-hall-server/pom.xml +++ b/epmet-module/resi-hall/resi-hall-server/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - 0.3.7 + 0.3.8 resi-hall com.epmet diff --git a/epmet-module/resi-mine/resi-mine-server/deploy/docker-compose-dev.yml b/epmet-module/resi-mine/resi-mine-server/deploy/docker-compose-dev.yml index 6535e604b8..3555c0974a 100644 --- a/epmet-module/resi-mine/resi-mine-server/deploy/docker-compose-dev.yml +++ b/epmet-module/resi-mine/resi-mine-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: resi-mine-server: container_name: resi-mine-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/resi-mine-server:0.3.11 + image: 192.168.1.130:10080/epmet-cloud-dev/resi-mine-server:0.3.12 ports: - "8094:8094" network_mode: host # 使用现有网络 diff --git a/epmet-module/resi-mine/resi-mine-server/pom.xml b/epmet-module/resi-mine/resi-mine-server/pom.xml index 0263d0a15c..f34ee7f56f 100644 --- a/epmet-module/resi-mine/resi-mine-server/pom.xml +++ b/epmet-module/resi-mine/resi-mine-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.11 + 0.3.12 com.epmet resi-mine diff --git a/epmet-module/resi-partymember/resi-partymember-server/deploy/docker-compose-dev.yml b/epmet-module/resi-partymember/resi-partymember-server/deploy/docker-compose-dev.yml index 48005eb3a2..484dd25d44 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/deploy/docker-compose-dev.yml +++ b/epmet-module/resi-partymember/resi-partymember-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: resi-partymember-server: container_name: resi-partymember-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/resi-partymember-server:0.3.21 + image: 192.168.1.130:10080/epmet-cloud-dev/resi-partymember-server:0.3.22 ports: - "8096:8096" network_mode: host # 使用现有网络 diff --git a/epmet-module/resi-partymember/resi-partymember-server/pom.xml b/epmet-module/resi-partymember/resi-partymember-server/pom.xml index dbb51c1bdc..0857264477 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/pom.xml +++ b/epmet-module/resi-partymember/resi-partymember-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.21 + 0.3.22 com.epmet resi-partymember diff --git a/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml b/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml index 6f9f48020d..66ce45c17b 100644 --- a/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml +++ b/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-user-server: container_name: epmet-user-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-user-server:0.3.28 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-user-server:0.3.29 ports: - "8087:8087" network_mode: host # 不会创建新的网络 diff --git a/epmet-user/epmet-user-server/pom.xml b/epmet-user/epmet-user-server/pom.xml index db9737f45c..aa4dff0192 100644 --- a/epmet-user/epmet-user-server/pom.xml +++ b/epmet-user/epmet-user-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.28 + 0.3.29 com.epmet epmet-user From 4a0c15f75f519a1a815612b5dd0da0a5ea0a4b5e Mon Sep 17 00:00:00 2001 From: wxz Date: Tue, 19 May 2020 09:17:59 +0800 Subject: [PATCH 06/31] =?UTF-8?q?1.=E4=BF=AE=E5=A4=8D=EF=BC=9A=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E7=9A=84=E5=B0=86FeignClient=E4=B8=AD=E7=9A=84url?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E5=88=B0=E8=BF=9C=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/feign/GovAccessFeignClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovAccessFeignClient.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovAccessFeignClient.java index 6e0fabe86f..d3ea928230 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovAccessFeignClient.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovAccessFeignClient.java @@ -22,7 +22,7 @@ import java.util.Set; * @Author sun */ //url = "localhost:8099" -@FeignClient(name = ServiceConstant.GOV_ACCESS_SERVER, fallback = GovAccessFeignClientFallback.class, url = "localhost:8099") +@FeignClient(name = ServiceConstant.GOV_ACCESS_SERVER, fallback = GovAccessFeignClientFallback.class) public interface GovAccessFeignClient { /** From 24fe5a08ee03c5e53e2aa4fddfe2543915f59d70 Mon Sep 17 00:00:00 2001 From: wxz Date: Tue, 19 May 2020 10:14:32 +0800 Subject: [PATCH 07/31] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E5=88=87=E9=9D=A2=EF=BC=8C=E4=B8=8D=E5=86=8D=E6=98=8E=E7=A1=AE?= =?UTF-8?q?Result=E8=BF=94=E5=9B=9E=E7=B1=BB=E5=9E=8B=EF=BC=8C=E6=94=B9?= =?UTF-8?q?=E4=B8=BAObject?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/commons/tools/aspect/BaseRequestLogAspect.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java index eae13bdfd2..54417b7117 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java @@ -42,14 +42,14 @@ public abstract class BaseRequestLogAspect { String requestURI = request.getRequestURI(); long id = Thread.currentThread().getId(); - Result result = null; + Object result = null; Exception exception = null; LocalDateTime startTime = LocalDateTime.now(); try { Object[] args = point.getArgs(); log.info(">>>>>>>>请求信息>>>>>>>>:线程ID:{},url:{},请求参数:{}", id, requestURI, objectsToString(args)); - result = (Result)point.proceed(); + result = point.proceed(); } catch (RenException e) { exception = e; result = handleRenException(e); From 8857b2048f131ba10155edeaa2e464dfc7cda419 Mon Sep 17 00:00:00 2001 From: wxz Date: Tue, 19 May 2020 10:17:39 +0800 Subject: [PATCH 08/31] =?UTF-8?q?1.=E5=8D=87=E7=BA=A7=E7=89=88=E6=9C=AC?= =?UTF-8?q?=EF=BC=8C=E6=97=A5=E5=BF=97=E5=88=87=E9=9D=A2=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E5=B0=86=E8=BF=94=E5=9B=9E=E5=80=BC=E8=BD=AC=E6=8D=A2=E4=B8=BA?= =?UTF-8?q?Result?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-admin/epmet-admin-server/deploy/docker-compose-dev.yml | 2 +- epmet-admin/epmet-admin-server/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-admin/epmet-admin-server/deploy/docker-compose-dev.yml b/epmet-admin/epmet-admin-server/deploy/docker-compose-dev.yml index d222a6a0eb..a076e424e3 100644 --- a/epmet-admin/epmet-admin-server/deploy/docker-compose-dev.yml +++ b/epmet-admin/epmet-admin-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-admin-server: container_name: epmet-admin-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-admin-server:0.3.7 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-admin-server:0.3.8 ports: - "8082:8082" network_mode: host # 使用现有网络 diff --git a/epmet-admin/epmet-admin-server/pom.xml b/epmet-admin/epmet-admin-server/pom.xml index a044cd52f6..3f8c574716 100644 --- a/epmet-admin/epmet-admin-server/pom.xml +++ b/epmet-admin/epmet-admin-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.7 + 0.3.8 com.epmet epmet-admin From c905674e6cd214504bbc0eb7cadd3bb1fc5641be Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Tue, 19 May 2020 10:52:26 +0800 Subject: [PATCH 09/31] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gov-issue/gov-issue-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/gov-issue/gov-issue-server/pom.xml | 2 +- .../gov-org/gov-org-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/gov-org/gov-org-server/pom.xml | 2 +- .../gov-project-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/gov-project/gov-project-server/pom.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml b/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml index 09ad9844eb..b4e17adea1 100644 --- a/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-issue-server: container_name: gov-issue-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-issue-server:0.3.9 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-issue-server:0.3.10 ports: - "8101:8101" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-issue/gov-issue-server/pom.xml b/epmet-module/gov-issue/gov-issue-server/pom.xml index 2fc548c145..b3706b25b2 100644 --- a/epmet-module/gov-issue/gov-issue-server/pom.xml +++ b/epmet-module/gov-issue/gov-issue-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.9 + 0.3.10 gov-issue com.epmet diff --git a/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml b/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml index 413fc95074..f718979ac1 100644 --- a/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-org-server: container_name: gov-org-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-org-server:0.3.39 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-org-server:0.3.40 ports: - "8092:8092" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-org/gov-org-server/pom.xml b/epmet-module/gov-org/gov-org-server/pom.xml index 2a07550480..f504e1d816 100644 --- a/epmet-module/gov-org/gov-org-server/pom.xml +++ b/epmet-module/gov-org/gov-org-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.39 + 0.3.40 com.epmet gov-org diff --git a/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml b/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml index b59a034f47..eaef7e629a 100644 --- a/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-project-server: container_name: gov-project-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-project-server:0.3.7 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-project-server:0.3.8 ports: - "8102:8102" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-project/gov-project-server/pom.xml b/epmet-module/gov-project/gov-project-server/pom.xml index a295ba8970..37d88eb982 100644 --- a/epmet-module/gov-project/gov-project-server/pom.xml +++ b/epmet-module/gov-project/gov-project-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.7 + 0.3.8 gov-project com.epmet From ef5970239e2ccc7353bff0a57a93aefbada3c4f8 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Tue, 19 May 2020 12:01:24 +0800 Subject: [PATCH 10/31] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gov-project-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/gov-project/gov-project-server/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml b/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml index eaef7e629a..f76a3c1da4 100644 --- a/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-project-server: container_name: gov-project-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-project-server:0.3.8 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-project-server:0.3.9 ports: - "8102:8102" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-project/gov-project-server/pom.xml b/epmet-module/gov-project/gov-project-server/pom.xml index 37d88eb982..4ced981dcb 100644 --- a/epmet-module/gov-project/gov-project-server/pom.xml +++ b/epmet-module/gov-project/gov-project-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.8 + 0.3.9 gov-project com.epmet From 09904cca9bab06f9f73c4ed091c0ff3d6a122297 Mon Sep 17 00:00:00 2001 From: wangchao Date: Tue, 19 May 2020 12:12:09 +0800 Subject: [PATCH 11/31] =?UTF-8?q?gov-issue=E7=89=88=E6=9C=AC=E5=8F=B7+1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gov-issue/gov-issue-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/gov-issue/gov-issue-server/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml b/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml index b4e17adea1..53d66af421 100644 --- a/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-issue-server: container_name: gov-issue-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-issue-server:0.3.10 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-issue-server:0.3.11 ports: - "8101:8101" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-issue/gov-issue-server/pom.xml b/epmet-module/gov-issue/gov-issue-server/pom.xml index b3706b25b2..5192f5e1d5 100644 --- a/epmet-module/gov-issue/gov-issue-server/pom.xml +++ b/epmet-module/gov-issue/gov-issue-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.10 + 0.3.11 gov-issue com.epmet From 061a97a90c8890fa624e272014565cc8f672a9d4 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Tue, 19 May 2020 15:25:35 +0800 Subject: [PATCH 12/31] Marge --- .../gov-project-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/gov-project/gov-project-server/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml b/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml index f76a3c1da4..26a33832bf 100644 --- a/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-project-server: container_name: gov-project-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-project-server:0.3.9 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-project-server:0.3.10 ports: - "8102:8102" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-project/gov-project-server/pom.xml b/epmet-module/gov-project/gov-project-server/pom.xml index 4ced981dcb..8112b6e5ea 100644 --- a/epmet-module/gov-project/gov-project-server/pom.xml +++ b/epmet-module/gov-project/gov-project-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.9 + 0.3.10 gov-project com.epmet From 42afb36ff3a5bbab8d77faf6a98c299dc3354d47 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Tue, 19 May 2020 16:17:53 +0800 Subject: [PATCH 13/31] =?UTF-8?q?=E5=B7=B2=E8=BD=AC=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gov-issue/gov-issue-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/gov-issue/gov-issue-server/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml b/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml index 53d66af421..e509e0911a 100644 --- a/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-issue-server: container_name: gov-issue-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-issue-server:0.3.11 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-issue-server:0.3.12 ports: - "8101:8101" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-issue/gov-issue-server/pom.xml b/epmet-module/gov-issue/gov-issue-server/pom.xml index 5192f5e1d5..88ec78207d 100644 --- a/epmet-module/gov-issue/gov-issue-server/pom.xml +++ b/epmet-module/gov-issue/gov-issue-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.11 + 0.3.12 gov-issue com.epmet From dab4c65a13f0274ff77438fad76c892ea4c07ff3 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Tue, 19 May 2020 16:44:15 +0800 Subject: [PATCH 14/31] =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gov-issue/gov-issue-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/gov-issue/gov-issue-server/pom.xml | 2 +- .../gov-org/gov-org-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/gov-org/gov-org-server/pom.xml | 2 +- .../resi-group/resi-group-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/resi-group/resi-group-server/pom.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml b/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml index e509e0911a..7baa5d1cff 100644 --- a/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-issue-server: container_name: gov-issue-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-issue-server:0.3.12 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-issue-server:0.3.13 ports: - "8101:8101" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-issue/gov-issue-server/pom.xml b/epmet-module/gov-issue/gov-issue-server/pom.xml index 88ec78207d..fd4dc34694 100644 --- a/epmet-module/gov-issue/gov-issue-server/pom.xml +++ b/epmet-module/gov-issue/gov-issue-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.12 + 0.3.13 gov-issue com.epmet diff --git a/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml b/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml index f718979ac1..3a010546b9 100644 --- a/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-org-server: container_name: gov-org-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-org-server:0.3.40 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-org-server:0.3.41 ports: - "8092:8092" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-org/gov-org-server/pom.xml b/epmet-module/gov-org/gov-org-server/pom.xml index f504e1d816..b98f2c1106 100644 --- a/epmet-module/gov-org/gov-org-server/pom.xml +++ b/epmet-module/gov-org/gov-org-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.40 + 0.3.41 com.epmet gov-org diff --git a/epmet-module/resi-group/resi-group-server/deploy/docker-compose-dev.yml b/epmet-module/resi-group/resi-group-server/deploy/docker-compose-dev.yml index 3a3db94db8..48539bd852 100644 --- a/epmet-module/resi-group/resi-group-server/deploy/docker-compose-dev.yml +++ b/epmet-module/resi-group/resi-group-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: resi-group-server: container_name: resi-group-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/resi-group-server:0.3.24 + image: 192.168.1.130:10080/epmet-cloud-dev/resi-group-server:0.3.25 ports: - "8095:8095" network_mode: host # 使用现有网络 diff --git a/epmet-module/resi-group/resi-group-server/pom.xml b/epmet-module/resi-group/resi-group-server/pom.xml index 33df0c0b14..abfb3c8e4e 100644 --- a/epmet-module/resi-group/resi-group-server/pom.xml +++ b/epmet-module/resi-group/resi-group-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.24 + 0.3.25 com.epmet resi-group From 0d2968c765112f06fa8b7de890ba8e78e3eb2bda Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Tue, 19 May 2020 17:17:29 +0800 Subject: [PATCH 15/31] =?UTF-8?q?=E8=BF=AD=E4=BB=A3=E5=99=A8Bug=E4=BF=AE?= =?UTF-8?q?=E6=94=B9-=E7=89=88=E6=9C=AC=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gov-org/gov-org-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/gov-org/gov-org-server/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml b/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml index 3a010546b9..a9cba4bbea 100644 --- a/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-org-server: container_name: gov-org-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-org-server:0.3.41 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-org-server:0.3.42 ports: - "8092:8092" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-org/gov-org-server/pom.xml b/epmet-module/gov-org/gov-org-server/pom.xml index b98f2c1106..3b1c576177 100644 --- a/epmet-module/gov-org/gov-org-server/pom.xml +++ b/epmet-module/gov-org/gov-org-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.41 + 0.3.42 com.epmet gov-org From 110ed032c5f42dd1c5b6ba7745d63b7c8a2ac89f Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Tue, 19 May 2020 17:58:49 +0800 Subject: [PATCH 16/31] =?UTF-8?q?=E8=BF=AD=E4=BB=A3=E5=99=A8Bug=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/service/impl/CustomerAgencyServiceImpl.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index 155cafd024..454a1aee4f 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -265,6 +265,7 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl Date: Tue, 19 May 2020 18:01:14 +0800 Subject: [PATCH 17/31] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gov-org/gov-org-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/gov-org/gov-org-server/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml b/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml index a9cba4bbea..7216f6ac16 100644 --- a/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-org-server: container_name: gov-org-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-org-server:0.3.42 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-org-server:0.3.43 ports: - "8092:8092" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-org/gov-org-server/pom.xml b/epmet-module/gov-org/gov-org-server/pom.xml index 3b1c576177..fab4bffcd3 100644 --- a/epmet-module/gov-org/gov-org-server/pom.xml +++ b/epmet-module/gov-org/gov-org-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.42 + 0.3.43 com.epmet gov-org From d591e7af3f0f59b9a29faa96eb981e2c32f7b50b Mon Sep 17 00:00:00 2001 From: wxz Date: Tue, 19 May 2020 18:17:53 +0800 Subject: [PATCH 18/31] =?UTF-8?q?1.=E7=89=88=E6=9C=AC=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=EF=BC=8C=E6=B5=8B=E8=AF=95=E8=B4=9F=E8=BD=BD=E5=9D=87=E8=A1=A1?= =?UTF-8?q?=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gov-mine-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/gov-mine/gov-mine-server/pom.xml | 2 +- .../java/com/epmet/config/LoadBalancerConfig.java | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/epmet-module/gov-mine/gov-mine-server/deploy/docker-compose-dev.yml b/epmet-module/gov-mine/gov-mine-server/deploy/docker-compose-dev.yml index fa9d543e92..b490913c6c 100644 --- a/epmet-module/gov-mine/gov-mine-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-mine/gov-mine-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-mine-server: container_name: gov-mine-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-mine-server:0.3.16 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-mine-server:0.3.17 ports: - "8098:8098" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-mine/gov-mine-server/pom.xml b/epmet-module/gov-mine/gov-mine-server/pom.xml index c06766b3a7..f7dcccbc31 100644 --- a/epmet-module/gov-mine/gov-mine-server/pom.xml +++ b/epmet-module/gov-mine/gov-mine-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.16 + 0.3.17 com.epmet gov-mine diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/config/LoadBalancerConfig.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/config/LoadBalancerConfig.java index 150e7253ab..2c0b3411e7 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/config/LoadBalancerConfig.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/config/LoadBalancerConfig.java @@ -19,11 +19,11 @@ public class LoadBalancerConfig { * 自定义负载均衡算法bean * @return */ - //@Bean - //public IRule getMyLoadBalancerRule(Environment env) { - // EpmetRequestLoadBalancerRule rule = new EpmetRequestLoadBalancerRule(); - // rule.setEnv(env); - // return rule; - //} + @Bean + public IRule getMyLoadBalancerRule(Environment env) { + EpmetRequestLoadBalancerRule rule = new EpmetRequestLoadBalancerRule(); + rule.setEnv(env); + return rule; + } } From b318d284466887930b214cf0348b773a809bc47a Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 20 May 2020 09:40:34 +0800 Subject: [PATCH 19/31] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=B7=9F=E8=B8=AA?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E6=B7=BB=E5=8A=A0=E8=B0=83=E7=94=A8=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E6=9C=8D=E5=8A=A1feign=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/form/TickStaffFormDTO.java | 2 +- .../gov-project/gov-project-server/pom.xml | 6 ++++ .../com/epmet/feign/MessageFeignClient.java | 29 +++++++++++++++++++ .../fallback/MessageFeignClientFallback.java | 23 +++++++++++++++ 4 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/feign/MessageFeignClient.java create mode 100644 epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/feign/fallback/MessageFeignClientFallback.java diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/TickStaffFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/TickStaffFormDTO.java index 790d21914a..6fe9793020 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/TickStaffFormDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/TickStaffFormDTO.java @@ -26,7 +26,7 @@ public class TickStaffFormDTO implements Serializable { */ private String gridId=""; - @NotBlank(message = "内部备注不能为空") + @NotBlank(message = "工作人员Id不能为空") private String staffId; } diff --git a/epmet-module/gov-project/gov-project-server/pom.xml b/epmet-module/gov-project/gov-project-server/pom.xml index 8112b6e5ea..665792d20a 100644 --- a/epmet-module/gov-project/gov-project-server/pom.xml +++ b/epmet-module/gov-project/gov-project-server/pom.xml @@ -84,6 +84,12 @@ 2.0.0 compile + + com.epmet + epmet-message-client + 2.0.0 + compile + diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/feign/MessageFeignClient.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/feign/MessageFeignClient.java new file mode 100644 index 0000000000..8ba3894440 --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/feign/MessageFeignClient.java @@ -0,0 +1,29 @@ +package com.epmet.feign; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.UserMessageFormDTO; +import com.epmet.feign.fallback.MessageFeignClientFallback; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.PostMapping; + +import java.util.List; + +/** + * @Description 调用epmet-message服务 + * @Author sun + * , url = "localhost:8085" + */ +@FeignClient(name = ServiceConstant.EPMET_MESSAGE_SERVER, fallback = MessageFeignClientFallback.class) +public interface MessageFeignClient { + + /** + * @param msgList + * @return com.epmet.commons.tools.utils.Result + * @Author sun + * @Description 批量推送消息 + **/ + @PostMapping(value = "message/usermessage/saveusermessagelist", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) + Result saveUserMessageList(List msgList); +} diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/feign/fallback/MessageFeignClientFallback.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/feign/fallback/MessageFeignClientFallback.java new file mode 100644 index 0000000000..bb5491ea78 --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/feign/fallback/MessageFeignClientFallback.java @@ -0,0 +1,23 @@ +package com.epmet.feign.fallback; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.UserMessageFormDTO; +import com.epmet.feign.MessageFeignClient; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * @Description 调用epmet-message服务 + * @Author sun + */ +@Component +public class MessageFeignClientFallback implements MessageFeignClient { + + @Override + public Result saveUserMessageList(List msgList) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_MESSAGE_SERVER, "saveUserMessageList", msgList); + } +} From 1c7e3a96f01769c46873c6eb3b84696d65866b69 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 20 May 2020 09:54:25 +0800 Subject: [PATCH 20/31] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=B7=9F=E8=B8=AA?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/constant/UserMessageConstant.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/UserMessageConstant.java diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/UserMessageConstant.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/UserMessageConstant.java new file mode 100644 index 0000000000..62f64e8a96 --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/UserMessageConstant.java @@ -0,0 +1,19 @@ +package com.epmet.constant; + +/** + * @Description 项目跟踪模块消息通知 + * @Author sun + */ +public interface UserMessageConstant { + + /** + * 消息标题 + */ + String ISSUE_TITLE = "您有一条项目消息"; + + /** + * 议题转项目、项目流转、项目退回消息模板 + */ + String ISSUE_RESLOVED_MSG = "您好。您收到一条【%s】的新信息,请您尽快处理。"; + +} From 5d19351b384447e5e9a255abec62e2bd25eeeb61 Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 20 May 2020 09:58:09 +0800 Subject: [PATCH 21/31] =?UTF-8?q?1.=E5=A2=9E=E5=8A=A0TokenDTO=E7=9A=84toSt?= =?UTF-8?q?ring()=E6=96=B9=E6=B3=95=EF=BC=8C=E7=94=A8JSON.toJSONString()?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/commons/tools/security/dto/GovTokenDto.java | 7 ++++++- .../com/epmet/commons/tools/security/dto/TokenDto.java | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java index 5362a740ca..1025d173a4 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java @@ -1,9 +1,9 @@ package com.epmet.commons.tools.security.dto; +import com.alibaba.fastjson.JSON; import lombok.Data; import java.io.Serializable; -import java.util.List; import java.util.Set; /** @@ -78,5 +78,10 @@ public class GovTokenDto extends BaseTokenDto implements Serializable { * 角色ID列表 */ private Set roleIdList; + + @Override + public String toString() { + return JSON.toJSONString(this); + } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/TokenDto.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/TokenDto.java index 402dfc1b59..642bad2941 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/TokenDto.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/TokenDto.java @@ -1,5 +1,6 @@ package com.epmet.commons.tools.security.dto; +import com.alibaba.fastjson.JSON; import lombok.Data; import java.io.Serializable; @@ -39,4 +40,8 @@ public class TokenDto extends BaseTokenDto implements Serializable { */ private long updateTime; + @Override + public String toString() { + return JSON.toJSONString(this); + } } From f3e0f71b8e6951bf04019c4644bc3b76435d5a9f Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Wed, 20 May 2020 10:15:03 +0800 Subject: [PATCH 22/31] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/constant/UserMessageConstant.java | 9 +++++++-- .../java/com/epmet/service/impl/ProjectServiceImpl.java | 8 ++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/UserMessageConstant.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/UserMessageConstant.java index 62f64e8a96..756a599ac3 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/UserMessageConstant.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/UserMessageConstant.java @@ -9,11 +9,16 @@ public interface UserMessageConstant { /** * 消息标题 */ - String ISSUE_TITLE = "您有一条项目消息"; + String PROJECT_TITLE = "您有一条项目消息"; /** * 议题转项目、项目流转、项目退回消息模板 */ - String ISSUE_RESLOVED_MSG = "您好。您收到一条【%s】的新信息,请您尽快处理。"; + String PROJECT_RESOLVED_MSG = "您好。您收到一条【%s】的新信息,请您尽快处理。"; + + /** + * 项目结案消息模板 + */ + String PROJECT_CLOSED_MSG = "您好,您参与的【%s】项目已结案,原因:%s"; } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java index 11089feddb..a903e21050 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java @@ -186,7 +186,7 @@ public class ProjectServiceImpl extends BaseServiceImpl finalDays) { @@ -229,7 +229,7 @@ public class ProjectServiceImpl extends BaseServiceImpl finalDays) { @@ -258,7 +258,7 @@ public class ProjectServiceImpl extends BaseServiceImpl departmentList = projectStaffService.getDepartmentNameList(projectStaffDTO); - if (null != departmentList && departmentList.size() > 0) { + if (null != departmentList && departmentList.size() > NumConstant.ZERO) { resultDTO.setProcessable(true); } else { resultDTO.setProcessable(false); @@ -404,7 +404,7 @@ public class ProjectServiceImpl extends BaseServiceImpl> detentionDays = commonFeignClient.detentionDays(list); - return detentionDays.getData().get(0).getDetentionDays(); + return detentionDays.getData().get(NumConstant.ZERO).getDetentionDays(); } /** From d7a9c60a35a1d26d24bd79c7c8e11a3f54fb8265 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Wed, 20 May 2020 10:50:32 +0800 Subject: [PATCH 23/31] =?UTF-8?q?=E6=8A=98=E7=BA=BF=E5=9B=BE=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/dao/IssueDao.java | 8 +++++ .../impl/IssueVoteStatisticalServiceImpl.java | 30 +++++++++++++++++-- .../src/main/resources/mapper/IssueDao.xml | 11 +++++++ 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueDao.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueDao.java index 709afb5f7c..670979f8bc 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueDao.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueDao.java @@ -29,6 +29,7 @@ import com.epmet.dto.result.IssueResultDTO; import com.epmet.dto.result.VotingIssueListResultDTO; import com.epmet.entity.IssueEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -99,4 +100,11 @@ public interface IssueDao extends BaseDao { * @author zxc */ Integer checkIssuePublisher(VoteFormDTO formDTO); + + /** + * @Description 获取转项目或者议题关闭时间 + * @param issueId + * @author zxc + */ + String operateTime(@Param("issueId")String issueId); } \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java index ea992c476e..daccc0f384 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java @@ -27,6 +27,7 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.constant.IssueConstant; +import com.epmet.dao.IssueDao; import com.epmet.dao.IssueSatisfactionDetailDao; import com.epmet.dao.IssueVoteStatisticalDao; import com.epmet.dto.IssueVoteStatisticalDTO; @@ -50,6 +51,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.ZoneOffset; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -75,6 +79,8 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl page(Map params) { @@ -160,13 +166,33 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl polyLineDTOS = issueVoteStatisticalDao.polyLineData(issueId); + PolyLineDTO polyLineDTO = new PolyLineDTO(); + polyLineDTO.setVoteDtae(LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8"))); + //今天刚转项目或刚刚关闭,当天数据DB没有,直接从缓存拿 + if (polyLineDTOS.size()==NumConstant.ZERO){ + polyLineDTO.setSupportIncrement(voteRedisFormDTO.getSupportAmount()); + polyLineDTO.setOppositionIncrement(voteRedisFormDTO.getOppositionAmount()); + polyLineDTOS.add(polyLineDTO); + }else { + //折线数据=DB + String date = issueDao.operateTime(issueId.getIssueId()); + if (date.equals(LocalDate.now().toString())) { + Integer yesterdaySupport = 0; + Integer yesterdayOppose = 0; + for (PolyLineDTO lineDTO : polyLineDTOS) { + yesterdaySupport += lineDTO.getSupportIncrement(); + yesterdayOppose += lineDTO.getOppositionIncrement(); + } + polyLineDTO.setSupportIncrement(voteRedisFormDTO.getSupportAmount() - yesterdaySupport); + polyLineDTO.setOppositionIncrement(voteRedisFormDTO.getOppositionAmount() - yesterdayOppose); + polyLineDTOS.add(polyLineDTO); + } + } votingTrendResultDTO.setPolyLine(polyLineDTOS); return votingTrendResultDTO; } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueDao.xml index 7107c16107..2973973d20 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueDao.xml +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueDao.xml @@ -258,4 +258,15 @@ AND id = #{issueId} + + + \ No newline at end of file From 6894f587ec04527aa8e530ac0c315fdc5240155b Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 20 May 2020 11:24:53 +0800 Subject: [PATCH 24/31] =?UTF-8?q?1.=E8=B4=9F=E8=BD=BD=E5=9D=87=E8=A1=A1?= =?UTF-8?q?=E5=99=A8=E5=9B=9E=E6=BB=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/config/LoadBalancerConfig.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/config/LoadBalancerConfig.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/config/LoadBalancerConfig.java index 2c0b3411e7..150e7253ab 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/config/LoadBalancerConfig.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/config/LoadBalancerConfig.java @@ -19,11 +19,11 @@ public class LoadBalancerConfig { * 自定义负载均衡算法bean * @return */ - @Bean - public IRule getMyLoadBalancerRule(Environment env) { - EpmetRequestLoadBalancerRule rule = new EpmetRequestLoadBalancerRule(); - rule.setEnv(env); - return rule; - } + //@Bean + //public IRule getMyLoadBalancerRule(Environment env) { + // EpmetRequestLoadBalancerRule rule = new EpmetRequestLoadBalancerRule(); + // rule.setEnv(env); + // return rule; + //} } From 27bfb0d0eccb9d7c2d3d73d591372a8680cbfb4e Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Wed, 20 May 2020 13:01:58 +0800 Subject: [PATCH 25/31] =?UTF-8?q?=E5=8F=91=E5=B8=83=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gov-issue/gov-issue-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/gov-issue/gov-issue-server/pom.xml | 2 +- .../gov-mine/gov-mine-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/gov-mine/gov-mine-server/pom.xml | 2 +- .../gov-project-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/gov-project/gov-project-server/pom.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml b/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml index 7baa5d1cff..b2b0c86afd 100644 --- a/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-issue-server: container_name: gov-issue-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-issue-server:0.3.13 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-issue-server:0.3.14 ports: - "8101:8101" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-issue/gov-issue-server/pom.xml b/epmet-module/gov-issue/gov-issue-server/pom.xml index fd4dc34694..144170cee4 100644 --- a/epmet-module/gov-issue/gov-issue-server/pom.xml +++ b/epmet-module/gov-issue/gov-issue-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.13 + 0.3.14 gov-issue com.epmet diff --git a/epmet-module/gov-mine/gov-mine-server/deploy/docker-compose-dev.yml b/epmet-module/gov-mine/gov-mine-server/deploy/docker-compose-dev.yml index b490913c6c..675a050c2e 100644 --- a/epmet-module/gov-mine/gov-mine-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-mine/gov-mine-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-mine-server: container_name: gov-mine-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-mine-server:0.3.17 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-mine-server:0.3.18 ports: - "8098:8098" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-mine/gov-mine-server/pom.xml b/epmet-module/gov-mine/gov-mine-server/pom.xml index f7dcccbc31..0fd4c98cdd 100644 --- a/epmet-module/gov-mine/gov-mine-server/pom.xml +++ b/epmet-module/gov-mine/gov-mine-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.17 + 0.3.18 com.epmet gov-mine diff --git a/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml b/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml index 26a33832bf..68ac13c6aa 100644 --- a/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-project-server: container_name: gov-project-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-project-server:0.3.10 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-project-server:0.3.11 ports: - "8102:8102" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-project/gov-project-server/pom.xml b/epmet-module/gov-project/gov-project-server/pom.xml index 665792d20a..0ce01920a0 100644 --- a/epmet-module/gov-project/gov-project-server/pom.xml +++ b/epmet-module/gov-project/gov-project-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.10 + 0.3.11 gov-project com.epmet From 89aa56fdc641795e1d57ab25a9168cda5f87529f Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Wed, 20 May 2020 13:09:16 +0800 Subject: [PATCH 26/31] =?UTF-8?q?group=E6=9C=8D=E5=8A=A1redis=E6=94=B9?= =?UTF-8?q?=E4=B8=BAdb0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-module/resi-group/resi-group-server/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/resi-group/resi-group-server/pom.xml b/epmet-module/resi-group/resi-group-server/pom.xml index abfb3c8e4e..6c47a7275a 100644 --- a/epmet-module/resi-group/resi-group-server/pom.xml +++ b/epmet-module/resi-group/resi-group-server/pom.xml @@ -136,7 +136,7 @@ epmet_resi_group_user EpmEt-db-UsEr - 1 + 0 192.168.1.130 6379 123456 @@ -166,7 +166,7 @@ epmet elink@833066 - 1 + 0 r-m5eoz5b6tkx09y6bpz.redis.rds.aliyuncs.com 6379 EpmEtrEdIs!q@w From 75f43781dc4e7ea7296f171b887a436065389ce9 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Wed, 20 May 2020 13:37:02 +0800 Subject: [PATCH 27/31] =?UTF-8?q?=E6=8A=95=E7=A5=A8=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/dto/PolyLineDTO.java | 2 +- .../com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java | 2 +- .../src/main/resources/mapper/IssueVoteStatisticalDao.xml | 2 +- .../src/main/java/com/epmet/dto/PolyLineDTO.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/PolyLineDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/PolyLineDTO.java index 975971e403..6c7960d26b 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/PolyLineDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/PolyLineDTO.java @@ -17,7 +17,7 @@ public class PolyLineDTO implements Serializable { /** * 投票日期 */ - private Long voteDtae; + private Long voteDate; /** * 当日赞成票数量 diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java index daccc0f384..dffee0edc1 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java @@ -172,7 +172,7 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl polyLineDTOS = issueVoteStatisticalDao.polyLineData(issueId); PolyLineDTO polyLineDTO = new PolyLineDTO(); - polyLineDTO.setVoteDtae(LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8"))); + polyLineDTO.setVoteDate(LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8"))); //今天刚转项目或刚刚关闭,当天数据DB没有,直接从缓存拿 if (polyLineDTOS.size()==NumConstant.ZERO){ polyLineDTO.setSupportIncrement(voteRedisFormDTO.getSupportAmount()); diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteStatisticalDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteStatisticalDao.xml index 3d35fea463..c12c1ab45b 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteStatisticalDao.xml +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteStatisticalDao.xml @@ -58,7 +58,7 @@ + SELECT + * + FROM + project_related_personnel + WHERE + DEL_FLAG = '0' + AND PROJECT_ID = #{projectId} + + + + \ No newline at end of file From ace5528b2faa1c75bd0d3fba3efb0129b2fba7f5 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 20 May 2020 14:35:05 +0800 Subject: [PATCH 29/31] =?UTF-8?q?=E8=AE=AE=E9=A2=98=E8=BD=AC=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E3=80=81=E9=A1=B9=E7=9B=AE=E6=B5=81=E8=BD=AC=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=B6=88=E6=81=AF=E5=8F=91=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gov-issue/gov-issue-client/pom.xml | 6 ++ .../epmet/dto/form/ShiftProjectFormDTO.java | 5 ++ .../epmet/constant/UserMessageConstant.java | 8 ++ .../epmet/service/impl/IssueServiceImpl.java | 77 ++++++++++++++----- .../com/epmet/dto/form/TickStaffFormDTO.java | 2 +- .../com/epmet/constant/ProjectConstant.java | 8 ++ .../impl/ProjectProcessServiceImpl.java | 42 ++++++++++ .../service/impl/ProjectServiceImpl.java | 24 ++++-- 8 files changed, 148 insertions(+), 24 deletions(-) diff --git a/epmet-module/gov-issue/gov-issue-client/pom.xml b/epmet-module/gov-issue/gov-issue-client/pom.xml index 6b630e83b6..3cc3330134 100644 --- a/epmet-module/gov-issue/gov-issue-client/pom.xml +++ b/epmet-module/gov-issue/gov-issue-client/pom.xml @@ -17,5 +17,11 @@ epmet-commons-tools 2.0.0 + + com.epmet + resi-group-client + 2.0.0 + compile + \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/ShiftProjectFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/ShiftProjectFormDTO.java index 3ef4e65555..a405cc7fcc 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/ShiftProjectFormDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/ShiftProjectFormDTO.java @@ -1,6 +1,7 @@ package com.epmet.dto.form; import com.epmet.dto.IssueDTO; +import com.epmet.resi.group.dto.topic.ResiTopicDTO; import lombok.Data; import org.hibernate.validator.constraints.Length; @@ -38,6 +39,10 @@ public class ShiftProjectFormDTO implements Serializable { * token中工作人员Id */ private String staffId; + /** + * 话题对象信息 + */ + private ResiTopicDTO topicDTO ; } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/UserMessageConstant.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/UserMessageConstant.java index 26dcf4e53c..3d3fde4b30 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/UserMessageConstant.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/UserMessageConstant.java @@ -10,6 +10,10 @@ public interface UserMessageConstant { * 消息标题 */ String ISSUE_TITLE = "您有一条议题消息"; + /** + * 项目跟踪-消息标题 + */ + String PROJECT_TITLE = "您有一条项目消息"; /** * 议题关闭时,选择已解决 @@ -26,5 +30,9 @@ public interface UserMessageConstant { */ String ISSUE_SHIFT_PROJECT_MSG = "您好,您发表的话题\"%s\"的问题,已由%s部门处理,请查看。"; + /** + * 议题转项目消息模板 + */ + String PROJECT_RESLOVED_MSG = "您好。您收到一条【%s】的新信息,请您尽快处理。"; } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java index 7eac6655c3..ee5eb6bc52 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java @@ -402,7 +402,7 @@ public class IssueServiceImpl extends BaseServiceImpl imp } /** - * @Description 关闭议题、议题转项目时给话题创建人和议题发起人发送消息 + * @Description 关闭议题时给话题创建人和议题发起人发送消息 * @author sun */ private Result saveUserMessageList(ResiTopicDTO topicDTO, String messageContent, IssueEntity entity) { @@ -480,20 +480,28 @@ public class IssueServiceImpl extends BaseServiceImpl imp } formDTO.setIssueDTO(ConvertUtils.sourceToTarget(entity, IssueDTO.class)); - //2:调用gov-project服务,新增项目各业务表初始数据 + //2:调用resi-group查询话题创建人数据(目前议题来源只有来自话题),为了到项目服务初始数据以及发送消息使用 + Result resultTopicDTO = resiGroupFeignClient.getTopicById(entity.getSourceId()); + if (!resultTopicDTO.success() || null == resultTopicDTO.getData()) { + throw new RenException(IssueConstant.SELECT_TOPIC_EXCEPTION); + } + ResiTopicDTO topicDTO = resultTopicDTO.getData(); + formDTO.setTopicDTO(topicDTO); + + //3:调用gov-project服务,新增项目各业务表初始数据 Result resultDTO = govProjectFeignClient.issueShiftProject(formDTO); if (!resultDTO.success() || null == resultDTO.getData()) { throw new RenException(IssueConstant.GOV_PRJECT_EXCEPTION); } IssueProjectResultDTO issueProjectResultDTO = resultDTO.getData(); - //3:更新议题相关业务表数据 - //3.1:更新议题表数据 + //4:更新议题相关业务表数据 + //4.1:更新议题表数据 entity.setIssueStatus(IssueConstant.ISSUE_SHIFT_PROJECT); entity.setShiftedTime(issueProjectResultDTO.getShiftedTime()); baseDao.updateById(entity); - //3.2:议题处理进展表新增数据 + //4.2:议题处理进展表新增数据 IssueProcessEntity processEntity = new IssueProcessEntity(); processEntity.setIssueId(entity.getId()); processEntity.setIssueStatus(IssueConstant.ISSUE_SHIFT_PROJECT); @@ -502,30 +510,63 @@ public class IssueServiceImpl extends BaseServiceImpl imp processEntity.setOrgName(issueProjectResultDTO.getOrgName()); issueProcessDao.insert(processEntity); - //3.3:议题项目关系表新增数据 + //4.3:议题项目关系表新增数据 IssueProjectRelationEntity relationEntity = new IssueProjectRelationEntity(); relationEntity.setIssueId(entity.getId()); relationEntity.setProjectId(issueProjectResultDTO.getProjectId()); issueProjectRelationDao.insert(relationEntity); - //4:调用epmet-message服务,给居民端话题创建人和议题发起人发送消息 - //4.1:调用resi-group查询话题创建人数据(目前议题来源只有来自话题) - Result resultTopicDTO = resiGroupFeignClient.getTopicById(entity.getSourceId()); - if (!resultTopicDTO.success() || null == resultTopicDTO.getData()) { - throw new RenException(IssueConstant.SELECT_TOPIC_EXCEPTION); - } - ResiTopicDTO topicDTO = resultTopicDTO.getData(); - //4.2:创建消息模板 - String messageContent = String.format(UserMessageConstant.ISSUE_SHIFT_PROJECT_MSG, topicDTO.getTopicContent(), issueProjectResultDTO.getOrgName()); - //4.3:调用服务,发送消息 - if (!saveUserMessageList(topicDTO, messageContent, entity).success()) { + //5:调用epmet-message服务,给居民端话题创建人、议题发起人以及政府端工作人员发送消息 + if (!shiftProjectMessage(issueProjectResultDTO, formDTO, entity).success()) { throw new RenException(IssueConstant.SAVE_MSG_EXCEPTION); } - //5:缓存中网格下表决中的议题总数减1 + //6:缓存中网格下表决中的议题总数减1 govIssueRedis.subtractWorkGrassrootsIssueRedDotValue(entity.getGridId()); } + /** + * @Description 议题转项目时给话题创建人、议题发起人、勾选的工作人员分别推送消息 + * @author sun + */ + private Result shiftProjectMessage(IssueProjectResultDTO issueProjectResultDTO, ShiftProjectFormDTO formDTO, IssueEntity entity) { + + List msgList = new ArrayList<>(); + //1:创建话题发起人、议题发表人消息对象 + UserMessageFormDTO msgDTO = new UserMessageFormDTO(); + msgDTO.setCustomerId(entity.getCustomerId()); + msgDTO.setGridId(entity.getGridId()); + msgDTO.setApp(AppClientConstant.APP_RESI); + msgDTO.setTitle(UserMessageConstant.ISSUE_TITLE); + String topicIssueMessage = String.format(UserMessageConstant.ISSUE_SHIFT_PROJECT_MSG, formDTO.getTopicDTO().getTopicContent(), issueProjectResultDTO.getOrgName()); + msgDTO.setMessageContent(topicIssueMessage); + msgDTO.setReadFlag(ReadFlagConstant.UN_READ); + UserMessageFormDTO msgIssue = ConvertUtils.sourceToTarget(msgDTO,UserMessageFormDTO.class); + msgDTO.setUserId(formDTO.getTopicDTO().getCreatedBy()); + msgList.add(msgDTO); + msgIssue.setUserId(entity.getCreatedBy()); + msgList.add(msgIssue); + //2:创建项目工作人员消息对象 + String projectStaffMessage = String.format(UserMessageConstant.PROJECT_RESLOVED_MSG, entity.getIssueTitle()); + //所选人员如果即在部门下又在网格下则只发一条消息 + Map map = new HashMap<>(); + formDTO.getStaffList().forEach(staff->{ + if(!map.containsKey(staff.getStaffId())){ + UserMessageFormDTO msg = new UserMessageFormDTO(); + msg.setCustomerId(entity.getCustomerId()); + msg.setGridId("*"); + msg.setApp(AppClientConstant.APP_GOV); + msg.setTitle(UserMessageConstant.PROJECT_TITLE); + msg.setMessageContent(projectStaffMessage); + msg.setReadFlag(ReadFlagConstant.UN_READ); + msg.setUserId(staff.getStaffId()); + msgList.add(msg); + map.put(staff.getStaffId(),staff.getStaffId()); + } + }); + return messageFeignClient.saveUserMessageList(msgList); + } + /** * @Description * @param issueListForm diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/TickStaffFormDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/TickStaffFormDTO.java index c481b89492..bac2f60c7e 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/TickStaffFormDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/TickStaffFormDTO.java @@ -29,7 +29,7 @@ public class TickStaffFormDTO implements Serializable { */ private String gridId; - @NotBlank(message = "内部备注不能为空") + @NotBlank(message = "工作人员Id不能为空") private String staffId; } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java index ecd82ff5d3..67ececc8f7 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java @@ -93,4 +93,12 @@ public interface ProjectConstant { * 调用gov-org服务查询数据失败 */ String UNHANDLED_EXCEPTION = "已转过其他部门,不能再次操作"; + /** + * 调用user-message服务失败 + */ + String SAVE_MSG_EXCEPTION = "发送消息失败"; + /** + * 查询项目表数据失败 + */ + String SELECT_PROJECT_EXCEPTION = "获取项目数据失败"; } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java index 9afab22488..8a9392db14 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java @@ -20,6 +20,7 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.RenException; @@ -27,6 +28,8 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.ProjectConstant; +import com.epmet.constant.ReadFlagConstant; +import com.epmet.constant.UserMessageConstant; import com.epmet.dao.ProjectProcessDao; import com.epmet.dao.ProjectStaffDao; import com.epmet.dto.CustomerAgencyDTO; @@ -38,6 +41,7 @@ import com.epmet.entity.ProjectProcessEntity; import com.epmet.entity.ProjectStaffEntity; import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.GovOrgFeignClient; +import com.epmet.feign.MessageFeignClient; import com.epmet.redis.ProjectProcessRedis; import com.epmet.service.ProjectProcessService; import com.epmet.service.ProjectService; @@ -74,6 +78,8 @@ public class ProjectProcessServiceImpl extends BaseServiceImpl page(Map params) { @@ -245,6 +251,42 @@ public class ProjectProcessServiceImpl extends BaseServiceImpl msgList = new ArrayList<>(); + ProjectEntity projectEntity = projectService.selectById(formDTO.getProjectId()); + if (null == projectEntity) { + throw new RenException(ProjectConstant.SELECT_PROJECT_EXCEPTION); + } + //3:创建项目工作人员消息对象 + //所选人员如果即在部门下又在网格下则只发一条消息 + Map map = new HashMap<>(); + String projectStaffMessage = String.format(UserMessageConstant.PROJECT_RESOLVED_MSG, projectEntity.getTitle()); + formDTO.getStaffList().forEach(staff->{ + if(!map.containsKey(staff.getStaffId())){ + UserMessageFormDTO msg = new UserMessageFormDTO(); + msg.setCustomerId(projectEntity.getCustomerId()); + msg.setGridId("*"); + msg.setApp(AppClientConstant.APP_GOV); + msg.setTitle(UserMessageConstant.PROJECT_TITLE); + msg.setMessageContent(projectStaffMessage); + msg.setReadFlag(ReadFlagConstant.UN_READ); + msg.setUserId(staff.getStaffId()); + msgList.add(msg); + map.put(staff.getStaffId(),staff.getStaffId()); + } + }); + return messageFeignClient.saveUserMessageList(msgList); } /** diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java index a903e21050..459bf5de8e 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java @@ -20,6 +20,7 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; @@ -35,15 +36,13 @@ import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.entity.ProjectEntity; import com.epmet.entity.ProjectProcessEntity; +import com.epmet.entity.ProjectRelatedPersonnelEntity; import com.epmet.entity.ProjectStaffEntity; import com.epmet.feign.CommonFeignClient; import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.GovOrgFeignClient; import com.epmet.redis.ProjectRedis; -import com.epmet.service.CustomerProjectParameterService; -import com.epmet.service.ProjectProcessService; -import com.epmet.service.ProjectService; -import com.epmet.service.ProjectStaffService; +import com.epmet.service.*; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -76,6 +75,8 @@ public class ProjectServiceImpl extends BaseServiceImpl list = new ArrayList<>(); + ProjectRelatedPersonnelEntity entity1 = new ProjectRelatedPersonnelEntity(); + entity1.setProjectId(projectEntity.getId()); + entity1.setApp(AppClientConstant.APP_RESI); + entity1.setGridId(issueDTO.getGridId()); + entity1.setUserId(formDTO.getTopicDTO().getCreatedBy()); + ProjectRelatedPersonnelEntity entity2 = ConvertUtils.sourceToTarget(entity1,ProjectRelatedPersonnelEntity.class); + entity2.setUserId(issueDTO.getCreatedBy()); + list.add(entity1); + list.add(entity2); + projectRelatedPersonnelService.insertBatch(list); + + //6:返回接口参数 issueProjectResultDTO.setProjectId(projectEntity.getId()); issueProjectResultDTO.setOrgName(processEntity.getDepartmentName()); issueProjectResultDTO.setShiftedTime(projectEntity.getCreatedTime()); From 8f18abebf609d0b24640d09f913075e1c58199b1 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Wed, 20 May 2020 14:55:23 +0800 Subject: [PATCH 30/31] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/tools/constant/Constant.java | 8 +++ .../com/epmet/constant/ProjectConstant.java | 8 +++ .../java/com/epmet/dao/ProjectStaffDao.java | 9 ++++ .../ProjectRelatedPersonnelService.java | 9 ++++ .../epmet/service/ProjectStaffService.java | 9 ++++ .../ProjectRelatedPersonnelServiceImpl.java | 5 ++ .../service/impl/ProjectServiceImpl.java | 49 ++++++++++++++++++- .../service/impl/ProjectStaffServiceImpl.java | 5 ++ .../main/resources/mapper/ProjectStaffDao.xml | 3 ++ 9 files changed, 104 insertions(+), 1 deletion(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java index 6fc8b3b948..c2aaddf70c 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java @@ -118,5 +118,13 @@ public interface Constant { * 否 */ String NO="no"; + /** + * 已读 + */ + String READ = "read"; + /** + * 未读 + */ + String UNREAD = "unread"; } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java index 67ececc8f7..c75452d03a 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java @@ -101,4 +101,12 @@ public interface ProjectConstant { * 查询项目表数据失败 */ String SELECT_PROJECT_EXCEPTION = "获取项目数据失败"; + /** + * 居民端 + */ + String RESI = "resi"; + /** + * 政府端 + */ + String GOV = "gov"; } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectStaffDao.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectStaffDao.java index 27b5165246..e65e670f12 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectStaffDao.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectStaffDao.java @@ -54,4 +54,13 @@ public interface ProjectStaffDao extends BaseDao { */ ProjectStaffDTO selectProjectStaffInfo(@Param("processId") String processId); + /** + * 获取项目关联的工作人员ID + * @author zhaoqifeng + * @date 2020/5/20 14:32 + * @param projectId + * @return java.util.List + */ + List selectStaffsByProjectId(@Param("projectId") String projectId); + } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectRelatedPersonnelService.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectRelatedPersonnelService.java index 1017db8e66..282fdd2718 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectRelatedPersonnelService.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectRelatedPersonnelService.java @@ -92,4 +92,13 @@ public interface ProjectRelatedPersonnelService extends BaseService + */ + List getPersonnelListByProjectId(String projectId); } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectStaffService.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectStaffService.java index 6457dc7749..349068ce2c 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectStaffService.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectStaffService.java @@ -122,4 +122,13 @@ public interface ProjectStaffService extends BaseService { * @Description 项目跟踪-部门人员选择 **/ DepartmentStaffListResultDTO departmentStaffList(DepartmentStaffListFormDTO formDTO); + + /** + * 获取项目关联的工作人员ID + * @author zhaoqifeng + * @date 2020/5/20 14:36 + * @param projectId + * @return java.util.List + */ + List getStaffsByProjectId(String projectId); } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectRelatedPersonnelServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectRelatedPersonnelServiceImpl.java index eada922662..a4b06bb1ed 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectRelatedPersonnelServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectRelatedPersonnelServiceImpl.java @@ -101,4 +101,9 @@ public class ProjectRelatedPersonnelServiceImpl extends BaseServiceImpl getPersonnelListByProjectId(String projectId) { + return baseDao.selectPersonnelListByProjectId(projectId); + } + } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java index 459bf5de8e..d4e4595363 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java @@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.AppClientConstant; +import com.epmet.commons.tools.constant.Constant; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; @@ -30,6 +31,7 @@ import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.ParameterKeyConstant; import com.epmet.constant.ProjectConstant; +import com.epmet.constant.UserMessageConstant; import com.epmet.dao.ProjectDao; import com.epmet.dto.*; import com.epmet.dto.form.*; @@ -41,6 +43,7 @@ import com.epmet.entity.ProjectStaffEntity; import com.epmet.feign.CommonFeignClient; import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.GovOrgFeignClient; +import com.epmet.feign.MessageFeignClient; import com.epmet.redis.ProjectRedis; import com.epmet.service.*; import org.apache.commons.lang3.StringUtils; @@ -76,6 +79,8 @@ public class ProjectServiceImpl extends BaseServiceImpl msgList = new ArrayList<>(); + //通知项目相关人员 + List personnelList = projectRelatedPersonnelService.getPersonnelListByProjectId(fromDTO.getProjectId()); + personnelList.forEach(p -> { + UserMessageFormDTO messageFormDTO = new UserMessageFormDTO(); + messageFormDTO.setCustomerId(projectEntity.getCustomerId()); + messageFormDTO.setApp(p.getApp()); + messageFormDTO.setGridId(p.getGridId()); + messageFormDTO.setUserId(p.getUserId()); + messageFormDTO.setTitle(UserMessageConstant.PROJECT_TITLE); + messageFormDTO.setMessageContent(String.format(UserMessageConstant.PROJECT_CLOSED_MSG, projectEntity.getTitle(), fromDTO.getPublicReply())); + messageFormDTO.setReadFlag(Constant.UNREAD); + msgList.add(messageFormDTO); + }); + //通知项目关联的部门人员 + List staffList = projectStaffService.getStaffsByProjectId(fromDTO.getProjectId()); + staffList.add(projectEntity.getCreatedBy()); + staffList.stream().distinct().forEach(s -> { + UserMessageFormDTO messageFormDTO = new UserMessageFormDTO(); + messageFormDTO.setCustomerId(projectEntity.getCustomerId()); + messageFormDTO.setApp(ProjectConstant.GOV); + messageFormDTO.setGridId("*"); + messageFormDTO.setUserId(s); + messageFormDTO.setTitle(UserMessageConstant.PROJECT_TITLE); + messageFormDTO.setMessageContent(String.format(UserMessageConstant.PROJECT_CLOSED_MSG, projectEntity.getTitle(), fromDTO.getPublicReply())); + messageFormDTO.setReadFlag(Constant.UNREAD); + msgList.add(messageFormDTO); + }); + messageFeignClient.saveUserMessageList(msgList); } @Override @@ -347,7 +383,18 @@ public class ProjectServiceImpl extends BaseServiceImpl msgList = new ArrayList<>(); + UserMessageFormDTO messageFormDTO = new UserMessageFormDTO(); + messageFormDTO.setCustomerId(projectEntity.getCustomerId()); + messageFormDTO.setApp(ProjectConstant.GOV); + messageFormDTO.setGridId("*"); + messageFormDTO.setUserId(projectStaffDTO.getStaffId()); + messageFormDTO.setTitle(UserMessageConstant.PROJECT_TITLE); + messageFormDTO.setMessageContent(String.format(UserMessageConstant.PROJECT_RESOLVED_MSG, projectEntity.getTitle())); + messageFormDTO.setReadFlag(Constant.UNREAD); + msgList.add(messageFormDTO); + messageFeignClient.saveUserMessageList(msgList); } @Override diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectStaffServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectStaffServiceImpl.java index 340fe15393..425179c4e6 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectStaffServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectStaffServiceImpl.java @@ -146,4 +146,9 @@ public class ProjectStaffServiceImpl extends BaseServiceImpl getStaffsByProjectId(String projectId) { + return baseDao.selectStaffsByProjectId(projectId); + } + } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectStaffDao.xml b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectStaffDao.xml index 2d7bf24fed..1325b8cff3 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectStaffDao.xml +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectStaffDao.xml @@ -40,6 +40,9 @@ AND pp.ID = #{processId} LIMIT 1 + \ No newline at end of file From f195ce097450f76618e29ec1faede4858094f96b Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 20 May 2020 16:19:02 +0800 Subject: [PATCH 31/31] =?UTF-8?q?=E5=85=B3=E9=97=AD=E8=AE=AE=E9=A2=98?= =?UTF-8?q?=E3=80=81=E8=AE=AE=E9=A2=98=E8=BD=AC=E9=A1=B9=E7=9B=AE=E5=B1=85?= =?UTF-8?q?=E6=B0=91=E7=AB=AF=E8=AF=9D=E9=A2=98=E4=BA=BA=E8=AE=AE=E9=A2=98?= =?UTF-8?q?=E4=BA=BA=E7=9B=B8=E5=90=8C=E5=8F=91=E9=80=81=E4=B8=80=E6=9D=A1?= =?UTF-8?q?=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/service/impl/IssueServiceImpl.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java index ee5eb6bc52..683ebb5560 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java @@ -415,11 +415,14 @@ public class IssueServiceImpl extends BaseServiceImpl imp msgDTO.setTitle(UserMessageConstant.ISSUE_TITLE); msgDTO.setMessageContent(messageContent); msgDTO.setReadFlag(ReadFlagConstant.UN_READ); - UserMessageFormDTO msgIssue = ConvertUtils.sourceToTarget(msgDTO,UserMessageFormDTO.class); msgDTO.setUserId(topicDTO.getCreatedBy()); msgList.add(msgDTO); - msgIssue.setUserId(entity.getCreatedBy()); - msgList.add(msgIssue); + //话题人和议题人是同一个人时则只发送一条居民消息 + if (!topicDTO.getCreatedBy().equals(entity.getCreatedBy())) { + UserMessageFormDTO msgIssue = ConvertUtils.sourceToTarget(msgDTO,UserMessageFormDTO.class); + msgIssue.setUserId(entity.getCreatedBy()); + msgList.add(msgIssue); + } return messageFeignClient.saveUserMessageList(msgList); } @@ -541,11 +544,14 @@ public class IssueServiceImpl extends BaseServiceImpl imp String topicIssueMessage = String.format(UserMessageConstant.ISSUE_SHIFT_PROJECT_MSG, formDTO.getTopicDTO().getTopicContent(), issueProjectResultDTO.getOrgName()); msgDTO.setMessageContent(topicIssueMessage); msgDTO.setReadFlag(ReadFlagConstant.UN_READ); - UserMessageFormDTO msgIssue = ConvertUtils.sourceToTarget(msgDTO,UserMessageFormDTO.class); msgDTO.setUserId(formDTO.getTopicDTO().getCreatedBy()); msgList.add(msgDTO); - msgIssue.setUserId(entity.getCreatedBy()); - msgList.add(msgIssue); + //话题人和议题人是同一个人时则只发送一条居民消息 + if (!formDTO.getTopicDTO().getCreatedBy().equals(entity.getCreatedBy())) { + UserMessageFormDTO msgIssue = ConvertUtils.sourceToTarget(msgDTO, UserMessageFormDTO.class); + msgIssue.setUserId(entity.getCreatedBy()); + msgList.add(msgIssue); + } //2:创建项目工作人员消息对象 String projectStaffMessage = String.format(UserMessageConstant.PROJECT_RESLOVED_MSG, entity.getIssueTitle()); //所选人员如果即在部门下又在网格下则只发一条消息