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..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.6 + 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 acd3ed2875..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.6 + 0.3.8 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-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..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 @@ -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; + 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(); - log.info("<<<<<<<<正常响应<<<<<<<<:线程ID:{},响应数据:{}", id, result.toString()); + result = point.proceed(); } 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/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-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 784fba9d9f..243367637a 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 @@ -45,8 +45,10 @@ public enum EpmetErrorCode { ALREADY_EVALUATE(8501,"您已评价"), ALREADY_VOTE(8502,"您已表态"), - PROJECT_IS_CLOSED(8601,"项目已结案") - ; + PROJECT_IS_CLOSED(8601,"项目已结案"), + + // 该错误不会提示给前端,只是后端传输错误信息用。 + ACCESS_SQL_FILTER_MISSION_ARGS(8701, "缺少生成权限过滤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 b3d04b021b..1f449cf23c 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-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); + } } 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-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/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..af13b14a3c --- /dev/null +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/ListOpePermsFormDTO.java @@ -0,0 +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-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/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 f52504e33e..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 @@ -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/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..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 @@ -3,17 +3,15 @@ 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; 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.Map; import java.util.Set; /** @@ -91,12 +89,38 @@ 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); + } + + /** + * 列出功能权限列表 + * @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 + * @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/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/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/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..eaabe43f49 --- /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; + +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..d6ab4325af --- /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; + +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 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..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 @@ -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,29 @@ 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); + + /** + * 列出角色的功能权限 + * @return + */ + Set listOperationPermissions(String staffId, String currAgencyId); } 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..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 @@ -1,15 +1,26 @@ 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.commons.tools.utils.Result; +import com.epmet.constant.OperationScopeConstant; import com.epmet.dao.OperationScopeDao; -import com.epmet.dto.result.AccessSettingResultDTO; +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.RoleAccessSettingRedis; +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; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -17,12 +28,18 @@ 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; @@ -30,14 +47,17 @@ public class AccessServiceImpl implements AccessService { private OperationScopeDao operationScopeDao; @Autowired - private AccessSettingDao accessSettingDao; + private RoleOpeScopeRedis roleOpeScopeRedis; @Autowired - private RoleOpeScopeRedis roleOpeScopeRedis; + private GovOrgFeignClient govOrgFeignClient; @Autowired - private RoleAccessSettingRedis roleAccessSettingRedis; + 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"; /** * 更新权限缓存 @@ -90,38 +110,464 @@ 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; + } + + /** + * 生成组织上下级关系系列的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; + } + } + + sb.replace(sb.lastIndexOf("OR"), sb.lastIndexOf("OR") + 3, ""); + hasConditions.set(true); } @Override - public List listAllRoleOperationScopesByRoleId(String roleId) { - List roleAllOpeScopes = roleOpeScopeRedis.getRoleAllOpeScopes(roleId); - if (roleAllOpeScopes == null) { - roleAllOpeScopes = operationScopeDao.listAllRoleOperationScopesByRoleId(roleId); - roleOpeScopeRedis.setRoleAllOpeScopes(roleId, roleAllOpeScopes); + 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()); } - return roleAllOpeScopes; + 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-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); - } - -} 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-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/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-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-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-issue/gov-issue-server/deploy/docker-compose-dev.yml b/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml index 8e8eb36dcb..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.8 + 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 b1f8a177e9..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.8 + 0.3.14 gov-issue com.epmet 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/dao/IssueDao.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueDao.java index d40377e231..f616afaa1d 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 @@ -30,6 +30,7 @@ import com.epmet.dto.result.VotingIssueListResultDTO; import com.epmet.dto.result.*; import com.epmet.entity.IssueEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -101,6 +102,13 @@ public interface IssueDao extends BaseDao { */ Integer checkIssuePublisher(VoteFormDTO formDTO); + /** + * @Description 获取转项目或者议题关闭时间 + * @param issueId + * @author zxc + */ + String operateTime(@Param("issueId")String issueId); + /** * @Description 生成昨日的议题日统计信息 * @param 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..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 @@ -402,7 +402,7 @@ public class IssueServiceImpl extends BaseServiceImpl imp } /** - * @Description 关闭议题、议题转项目时给话题创建人和议题发起人发送消息 + * @Description 关闭议题时给话题创建人和议题发起人发送消息 * @author sun */ private Result saveUserMessageList(ResiTopicDTO topicDTO, String messageContent, IssueEntity entity) { @@ -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); } @@ -480,20 +483,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 +513,66 @@ 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); + msgDTO.setUserId(formDTO.getTopicDTO().getCreatedBy()); + msgList.add(msgDTO); + //话题人和议题人是同一个人时则只发送一条居民消息 + 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()); + //所选人员如果即在部门下又在网格下则只发一条消息 + 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-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..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 @@ -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.setVoteDate(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 d31d8bd7cf..71686b52cf 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,6 +258,17 @@ AND id = #{issueId} + + + SELECT - UNIX_TIMESTAMP(statistical_date) AS voteDtae, + UNIX_TIMESTAMP(statistical_date) AS voteDate, support_increment AS supportIncrement, opposition_increment AS oppositionIncrement FROM 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..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.15 + 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 8409a5794b..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.15 + 0.3.18 com.epmet gov-mine 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..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 @@ -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; @@ -55,4 +56,11 @@ public interface GovAccessFeignClient { @PostMapping("/gov/access/access/roleallopesandscopes/{roleId}") Result> listRoleAllOperationScopesByRoleId(@PathVariable("roleId") String roleId); + /** + * 列出觉得的功能权限列表 + * @return + */ + @PostMapping("/gov/access/access/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/deploy/docker-compose-dev.yml b/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml index 0abde8187f..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.38 + 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 bab556d2a9..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.38 + 0.3.43 com.epmet gov-org 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 + * 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.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 项目相关人员表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-05-20 + */ +@Data +public class ProjectRelatedPersonnelDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 唯一标识 + */ + private String id; + + /** + * 项目ID + */ + private String projectId; + + /** + * 所属端 居民端用户resi、政府端工作人员gov、运营端工作人员oper + */ + private String app; + + /** + * 网格ID app=resi时,此列为gridId,其他情况暂定 * + */ + private String gridId; + + /** + * 用户ID + */ + private String userId; + + /** + * 删除标识 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file 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/deploy/docker-compose-dev.yml b/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml index 7243211cf4..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.6 + 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 c8e73701ca..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.6 + 0.3.11 gov-project com.epmet @@ -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/constant/ProjectConstant.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java index ecd82ff5d3..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 @@ -93,4 +93,20 @@ public interface ProjectConstant { * 调用gov-org服务查询数据失败 */ String UNHANDLED_EXCEPTION = "已转过其他部门,不能再次操作"; + /** + * 调用user-message服务失败 + */ + String SAVE_MSG_EXCEPTION = "发送消息失败"; + /** + * 查询项目表数据失败 + */ + 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/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..756a599ac3 --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/UserMessageConstant.java @@ -0,0 +1,24 @@ +package com.epmet.constant; + +/** + * @Description 项目跟踪模块消息通知 + * @Author sun + */ +public interface UserMessageConstant { + + /** + * 消息标题 + */ + String PROJECT_TITLE = "您有一条项目消息"; + + /** + * 议题转项目、项目流转、项目退回消息模板 + */ + 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/controller/ProjectRelatedPersonnelController.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectRelatedPersonnelController.java new file mode 100644 index 0000000000..b23ff79827 --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectRelatedPersonnelController.java @@ -0,0 +1,94 @@ +/** + * 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.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.ProjectRelatedPersonnelDTO; +import com.epmet.excel.ProjectRelatedPersonnelExcel; +import com.epmet.service.ProjectRelatedPersonnelService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 项目相关人员表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-05-20 + */ +@RestController +@RequestMapping("projectrelatedpersonnel") +public class ProjectRelatedPersonnelController { + + @Autowired + private ProjectRelatedPersonnelService projectRelatedPersonnelService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = projectRelatedPersonnelService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + ProjectRelatedPersonnelDTO data = projectRelatedPersonnelService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody ProjectRelatedPersonnelDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + projectRelatedPersonnelService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody ProjectRelatedPersonnelDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + projectRelatedPersonnelService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + projectRelatedPersonnelService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = projectRelatedPersonnelService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, ProjectRelatedPersonnelExcel.class); + } + +} \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/AccessSettingOptionsEntity.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectRelatedPersonnelDao.java similarity index 51% rename from epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/AccessSettingOptionsEntity.java rename to epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectRelatedPersonnelDao.java index 49fb16db01..cb570632e8 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/AccessSettingOptionsEntity.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectRelatedPersonnelDao.java @@ -15,42 +15,30 @@ * along with this program. If not, see . */ -package com.epmet.entity; +package com.epmet.dao; -import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.ProjectRelatedPersonnelDTO; +import com.epmet.entity.ProjectRelatedPersonnelEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; -import com.epmet.commons.mybatis.entity.BaseEpmetEntity; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.util.Date; +import java.util.List; /** - * 权限配置选项 + * 项目相关人员表 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-04-29 + * @since v1.0.0 2020-05-20 */ -@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; - -} +@Mapper +public interface ProjectRelatedPersonnelDao extends BaseDao { + /** + * 查找项目关联人员 + * @author zhaoqifeng + * @date 2020/5/20 13:45 + * @param projectId + * @return java.util.List + */ + List selectPersonnelListByProjectId(@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/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-access/gov-access-server/src/main/java/com/epmet/entity/AccessSettingEntity.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectRelatedPersonnelEntity.java similarity index 72% rename from epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/AccessSettingEntity.java rename to epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectRelatedPersonnelEntity.java index 076476fcfa..b2ed014ced 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/AccessSettingEntity.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectRelatedPersonnelEntity.java @@ -26,36 +26,36 @@ import lombok.EqualsAndHashCode; import java.util.Date; /** - * 权限配置 + * 项目相关人员表 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-04-29 + * @since v1.0.0 2020-05-20 */ @Data @EqualsAndHashCode(callSuper=false) -@TableName("access_setting") -public class AccessSettingEntity extends BaseEpmetEntity { +@TableName("project_related_personnel") +public class ProjectRelatedPersonnelEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; /** - * 角色ID + * 项目ID */ - private String roleId; + private String projectId; /** - * 操作key + * 所属端 居民端用户resi、政府端工作人员gov、运营端工作人员oper */ - private String operationKey; + private String app; /** - * 配置KEY + * 网格ID app=resi时,此列为gridId,其他情况暂定 * */ - private String settingKey; + private String gridId; /** - * 配置值 + * 用户ID */ - private String settingValue; + private String userId; } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/excel/ProjectRelatedPersonnelExcel.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/excel/ProjectRelatedPersonnelExcel.java new file mode 100644 index 0000000000..8cfb220d77 --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/excel/ProjectRelatedPersonnelExcel.java @@ -0,0 +1,68 @@ +/** + * 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.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 项目相关人员表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-05-20 + */ +@Data +public class ProjectRelatedPersonnelExcel { + + @Excel(name = "主键 唯一标识") + private String id; + + @Excel(name = "项目ID") + private String projectId; + + @Excel(name = "所属端 居民端用户resi、政府端工作人员gov、运营端工作人员oper") + private String app; + + @Excel(name = "网格ID app=resi时,此列为gridId,其他情况暂定 *") + private String gridId; + + @Excel(name = "用户ID") + private String userId; + + @Excel(name = "删除标识") + private String delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file 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); + } +} diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/AccessSettingOptionsDao.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/redis/ProjectRelatedPersonnelRedis.java similarity index 61% rename from epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/AccessSettingOptionsDao.java rename to epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/redis/ProjectRelatedPersonnelRedis.java index f07c5e1efe..f3d113f01b 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/AccessSettingOptionsDao.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/redis/ProjectRelatedPersonnelRedis.java @@ -15,19 +15,33 @@ * along with this program. If not, see . */ -package com.epmet.dao; +package com.epmet.redis; -import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.entity.AccessSettingOptionsEntity; -import org.apache.ibatis.annotations.Mapper; +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; /** - * 权限配置选项 + * 项目相关人员表 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-04-29 + * @since v1.0.0 2020-05-20 */ -@Mapper -public interface AccessSettingOptionsDao extends BaseDao { - +@Component +public class ProjectRelatedPersonnelRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + } \ 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 new file mode 100644 index 0000000000..282fdd2718 --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectRelatedPersonnelService.java @@ -0,0 +1,104 @@ +/** + * 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.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.ProjectRelatedPersonnelDTO; +import com.epmet.entity.ProjectRelatedPersonnelEntity; + +import java.util.List; +import java.util.Map; + +/** + * 项目相关人员表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-05-20 + */ +public interface ProjectRelatedPersonnelService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-05-20 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-05-20 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return ProjectRelatedPersonnelDTO + * @author generator + * @date 2020-05-20 + */ + ProjectRelatedPersonnelDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-05-20 + */ + void save(ProjectRelatedPersonnelDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-05-20 + */ + void update(ProjectRelatedPersonnelDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-05-20 + */ + void delete(String[] ids); + + /** + * 查找项目关联人员 + * @author zhaoqifeng + * @date 2020/5/20 13:52 + * @param projectId + * @return java.util.List + */ + 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/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/ProjectRelatedPersonnelServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectRelatedPersonnelServiceImpl.java new file mode 100644 index 0000000000..a4b06bb1ed --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectRelatedPersonnelServiceImpl.java @@ -0,0 +1,109 @@ +/** + * 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.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.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.ProjectRelatedPersonnelDao; +import com.epmet.dto.ProjectRelatedPersonnelDTO; +import com.epmet.entity.ProjectRelatedPersonnelEntity; +import com.epmet.redis.ProjectRelatedPersonnelRedis; +import com.epmet.service.ProjectRelatedPersonnelService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 项目相关人员表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-05-20 + */ +@Service +public class ProjectRelatedPersonnelServiceImpl extends BaseServiceImpl implements ProjectRelatedPersonnelService { + + @Autowired + private ProjectRelatedPersonnelRedis projectRelatedPersonnelRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, ProjectRelatedPersonnelDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, ProjectRelatedPersonnelDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public ProjectRelatedPersonnelDTO get(String id) { + ProjectRelatedPersonnelEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, ProjectRelatedPersonnelDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(ProjectRelatedPersonnelDTO dto) { + ProjectRelatedPersonnelEntity entity = ConvertUtils.sourceToTarget(dto, ProjectRelatedPersonnelEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(ProjectRelatedPersonnelDTO dto) { + ProjectRelatedPersonnelEntity entity = ConvertUtils.sourceToTarget(dto, ProjectRelatedPersonnelEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + public List 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 11089feddb..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 @@ -20,6 +20,8 @@ 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.Constant; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; @@ -29,21 +31,21 @@ 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.*; 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.feign.MessageFeignClient; 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 +78,10 @@ public class ProjectServiceImpl extends BaseServiceImpl finalDays) { @@ -229,7 +235,7 @@ public class ProjectServiceImpl extends BaseServiceImpl finalDays) { @@ -258,7 +264,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); @@ -311,6 +317,37 @@ 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 @@ -346,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 @@ -404,7 +452,7 @@ public class ProjectServiceImpl extends BaseServiceImpl> detentionDays = commonFeignClient.detentionDays(list); - return detentionDays.getData().get(0).getDetentionDays(); + return detentionDays.getData().get(NumConstant.ZERO).getDetentionDays(); } /** @@ -502,7 +550,20 @@ 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()); 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/ProjectRelatedPersonnelDao.xml b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectRelatedPersonnelDao.xml new file mode 100644 index 0000000000..9b8a16d319 --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectRelatedPersonnelDao.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + \ 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 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..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.23 + 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 c8c83e8605..6c47a7275a 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.25 com.epmet resi-group @@ -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 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-client/src/main/java/com/epmet/dto/PolyLineDTO.java b/epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/PolyLineDTO.java index 838dfbad15..fc800d4d6e 100644 --- a/epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/PolyLineDTO.java +++ b/epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/PolyLineDTO.java @@ -18,7 +18,7 @@ public class PolyLineDTO implements Serializable { /** * 投票日期 */ - private Long voteDtae; + private Long voteDate; /** * 当日赞成票数量 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