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 2c6e0d5ed8..1dbe11149b 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 @@ -20,21 +20,6 @@ import java.util.Set; @FeignClient(name = ServiceConstant.GOV_ACCESS_SERVER, fallback = MybatisGovAccessFeignClientFallback.class) public interface MybatisGovAccessFeignClient { - /** - * 查询角色的操作key对应操作范围列表 - * @param operationScopeFormDTO - * @return - */ - @PostMapping("/gov/access/access/operationscopes") - Result> getOperationScopesByRoleId(OperationScopeFormDTO operationScopeFormDTO); - - /** - * 查询角色所有operation及其范围(缓存) - * @return - */ - @PostMapping("/gov/access/access/roleallopesandscopes/{roleId}") - Result> listRoleAllOperationScopesByRoleId(@PathVariable("roleId") String roleId); - /** * 查询sql过滤片段 * @param 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 a14452346a..97f64e9d95 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 @@ -21,16 +21,6 @@ import java.util.Set; @Component public class MybatisGovAccessFeignClientFallback implements MybatisGovAccessFeignClient { - @Override - public Result> getOperationScopesByRoleId(OperationScopeFormDTO operationScopeFormDTO) { - return ModuleUtils.feignConError(ServiceConstant.GOV_ACCESS_SERVER, "getOperationScopesByRoleId", operationScopeFormDTO); - } - - @Override - public Result> listRoleAllOperationScopesByRoleId(@PathVariable("roleId") String roleId){ - return ModuleUtils.feignConError(ServiceConstant.GOV_ACCESS_SERVER, "listRoleAllOperationScopesByRoleId", roleId); - } - @Override 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/constant/EpmetRoleKeyConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/EpmetRoleKeyConstant.java index 4d11b57738..d4ec337c86 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/EpmetRoleKeyConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/EpmetRoleKeyConstant.java @@ -1,7 +1,7 @@ package com.epmet.commons.tools.constant; /** - * @Description + * @Description 居民端角色key * @Author yinzuomei * @Date 2020/3/30 16:38 */ diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java index e8cec08991..ba34e7ff6a 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java @@ -15,10 +15,12 @@ import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactor import org.springframework.data.redis.core.HashOperations; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.data.redis.core.ZSetOperations; import org.springframework.data.redis.support.atomic.RedisAtomicLong; import org.springframework.stereotype.Component; import java.util.Collection; +import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.TimeUnit; @@ -276,16 +278,33 @@ public class RedisUtils { } /** - * @Description 获取key集合与多个集合的并集 + * @Description 获取key集合与多个集合的交集 * @param key * @param otherKeys * @author zxc */ - public Set sUnion(String key, Collection otherKeys) { - return redisTemplate.opsForSet().union(key, otherKeys); + public Set intersect(String key, Collection otherKeys) { + return redisTemplate.opsForSet().intersect(key, otherKeys); } + /** + * @Description 获取集合(set) + * @param key + * @author zxc + */ public Set sMembers(String key){ return redisTemplate.opsForSet().members(key); } + + /** + * @Description 获取 zset 中带score的集合 + * @param key + * @param start + * @param end + * @author zxc + */ + public Set> zReverseRangeWithScores(String key, long start, long end) { + Set> typedTuples = redisTemplate.opsForZSet().reverseRangeWithScores(key, start, end); + return typedTuples; + } } 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 487c854dd9..dad8f7e095 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,12 +3,10 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.*; -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 java.util.List; import java.util.Set; /** @@ -24,67 +22,6 @@ public class AccessController { @Autowired private AccessService accessService; - /** - * 更新工作人员权限缓存(前端查询权限时候gov-mine会调用此处) - * @param staffPermCacheFormDTO - * @return - */ - @PostMapping("updatepermissioncache") - public Result updatePermissionCache(@RequestBody StaffPermCacheFormDTO staffPermCacheFormDTO) { - ValidatorUtils.validateEntity(staffPermCacheFormDTO, StaffPermCacheFormDTO.UpdatePermissionCache.class); - String staffId = staffPermCacheFormDTO.getStaffId(); - String app = staffPermCacheFormDTO.getApp(); - String client = staffPermCacheFormDTO.getClient(); - Set permissions = staffPermCacheFormDTO.getPermissions(); - Set roleIdList = staffPermCacheFormDTO.getRoleIdList(); - String orgId = staffPermCacheFormDTO.getOrgIdPath(); - String gridId = staffPermCacheFormDTO.getGridId(); - accessService.updatePermissionCache(staffId, app, client, permissions, roleIdList, orgId, gridId); - return new Result(); - } - - ///** - // * 从缓存中查询用户信息(DataFilterAspect中用到) - // * @return - // */ - //@PostMapping("loginuserinfo") - //public Result getLoginUserInfo(@RequestBody StaffPermCacheFormDTO dto) { - // ValidatorUtils.validateEntity(dto, StaffPermCacheFormDTO.GetStaffCurrPermissions.class); - // GovTokenDto govTokenDto = accessService.getUserDetails(dto.getApp(), dto.getClient(), dto.getStaffId()); - // LoginUserInfoResultDTO resultDTO = null; - // if (govTokenDto != null) { - // resultDTO = new LoginUserInfoResultDTO(); - // resultDTO.setRoleIdList(govTokenDto.getRoleIdList()); - // //resultDTO.setGridId(govTokenDto.getGridId()); - // resultDTO.setOrgIdPath(govTokenDto.getOrgIdPath()); - // resultDTO.setGridIdList(govTokenDto.getGridIdList()); - // resultDTO.setDeptIdList(govTokenDto.getDeptIdList()); - // resultDTO.setUserId(govTokenDto.getUserId()); - // } - // return new Result().ok(resultDTO); - //} - - /** - * 查询角色的操作key对应操作范围列表(缓存) - * @return - */ - @PostMapping("operationscopes") - public Result> getOperationScopesByRoleId(@RequestBody OperationScopeFormDTO operationScopeFormDTO) { - ValidatorUtils.validateEntity(operationScopeFormDTO, OperationScopeFormDTO.ListOperationScopeGroup.class); - Set scopes = accessService.listOperationScopesByRoleId(operationScopeFormDTO.getRoleId(), operationScopeFormDTO.getOperationKey()); - return new Result>().ok(scopes); - } - - /** - * 查询角色所有operation及其范围(缓存) - * @return - */ - @PostMapping("roleallopesandscopes/{roleId}") - public Result> listRoleAllOperationScopesByRoleId(@PathVariable("roleId") String roleId) { - List scopes = accessService.listAllRoleOperationScopesByRoleId(roleId); - return new Result>().ok(scopes); - } - /** * 用户是否具有指定功能权限 * @return 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 de151c9eed..7b365fa21b 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,21 +1,13 @@ package com.epmet.service; -import com.epmet.commons.tools.security.dto.GovTokenDto; import com.epmet.dto.form.GetSQLFilterFormDTO; import com.epmet.dto.result.LoginUserDetailsResultDTO; import com.epmet.dto.result.RoleOpeScopeResultDTO; import java.util.List; -import java.util.Map; import java.util.Set; public interface AccessService { - /** - * 更新权限缓存 - * @param staffId - * @param permissions - */ - void updatePermissionCache(String staffId, String app, String client, Set permissions, Set roleIdList, String orgIdPath, String gridId); /** * 查询登陆用户登陆信息 @@ -23,14 +15,6 @@ public interface AccessService { */ LoginUserDetailsResultDTO getLoginUserDetails(String app, String client, String staffId); - /** - * 查询角色的操作key对应操作范围列表 - * @param roleId - * @param operationKey - * @return - */ - Set listOperationScopesByRoleId(String roleId, String operationKey); - /** * 查询角色所有operation及其范围(缓存) * @param roleId 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 8adcf8c301..96b996ddd2 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 @@ -4,9 +4,7 @@ import cn.hutool.core.collection.CollectionUtil; import com.epmet.bean.OpeScopeFilterResultBean; import com.epmet.commons.tools.constant.AppClientConstant; 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.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.CpUserDetailRedis; import com.epmet.commons.tools.utils.Result; @@ -65,57 +63,11 @@ public class AccessServiceImpl implements AccessService { public static final String ORG_RELATION_SUP = "sup"; public static final String ORG_PATH_SEPARATOR = ":"; - /** - * 更新权限缓存 - * @param staffId - * @param permissions - */ - @Override - public void updatePermissionCache(String staffId, String app, String client, Set permissions, Set roleIdList, - String orgIdPath, String gridId) { - GovTokenDto govTokenDto = cpUserDetailRedis.get(app, client, staffId, GovTokenDto.class); - if (govTokenDto == null) { - logger.warn("更新[{}]用户缓存:Redis中不存在该用户TokenDto缓存信息", staffId); - return ; - } - // 将权限,角色列表,和当前组织ID存入TokenDto - govTokenDto.setPermissions(permissions); - govTokenDto.setRoleIdList(roleIdList); - govTokenDto.setOrgIdPath(orgIdPath); - govTokenDto.setGridId(gridId); - - // 将新的TokenDto更新到redis中 - long expire = cpUserDetailRedis.getExpire(app, client, staffId); - cpUserDetailRedis.set(govTokenDto, expire); - logger.warn("更新[{}]用户缓存成功。", staffId); - } - @Override public LoginUserDetailsResultDTO getLoginUserDetails(String app, String client, String staffId) { return cpUserDetailRedis.get(app, client, staffId, LoginUserDetailsResultDTO.class); } - /** - * 查询角色的操作key对应操作范围列表 - * @param roleId - * @param operationKey - * @return - */ - public Set listOperationScopesByRoleId(String roleId, String operationKey) { - Set roleOpeScopes = roleOpeScopeRedis.getRoleOpeScopes(roleId, operationKey); - if (roleOpeScopes != null) { - return roleOpeScopes; - } - Set scopes = operationScopeDao.listOperationScopesByRoleId(roleId, operationKey); - try { - roleOpeScopeRedis.setRoleOpeScopes(roleId, operationKey, scopes); - } catch (Exception e) { - String errorStackTrace = ExceptionUtils.getErrorStackTrace(e); - logger.error("GovAccess:查询角色的操作范围:缓存范围出错:{}", errorStackTrace); - } - return scopes; - } - @Override public List listAllRoleOperationScopesByRoleId(String roleId) { List roleAllOpeScopes = roleOpeScopeRedis.getRoleAllOpeScopes(roleId); 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 d3ea928230..fadab52ce9 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 @@ -2,19 +2,12 @@ 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; -import com.epmet.dto.result.RoleOperationResultDTO; import com.epmet.feign.fallback.GovAccessFeignClientFallback; 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.Set; /** @@ -25,37 +18,6 @@ import java.util.Set; @FeignClient(name = ServiceConstant.GOV_ACCESS_SERVER, fallback = GovAccessFeignClientFallback.class) public interface GovAccessFeignClient { - /** - * 根据角色ID查询角色权限列表 - * @param roleId - * @return - */ - @PostMapping("/gov/access/role/operations/{roleId}") - Result> listOperationsByRoleId(@PathVariable("roleId") String roleId); - - /** - * 刷新用户权限缓存 - * @param staffPermCacheFormDTO - * @return - */ - @PostMapping("/gov/access/access/updatepermissioncache") - Result updatePermissionCache(@RequestBody StaffPermCacheFormDTO staffPermCacheFormDTO); - - /** - * 查询角色的操作key对应操作范围列表 - * @param operationScopeFormDTO - * @return - */ - @PostMapping("/gov/access/access/operationscopes") - Result> getOperationScopesByRoleId(OperationScopeFormDTO operationScopeFormDTO); - - /** - * 查询角色所有operation及其范围(缓存) - * @return - */ - @PostMapping("/gov/access/access/roleallopesandscopes/{roleId}") - Result> listRoleAllOperationScopesByRoleId(@PathVariable("roleId") String roleId); - /** * 列出觉得的功能权限列表 * @return 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 36ed3ae74f..1f9b0aaa2e 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 @@ -3,17 +3,9 @@ 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.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; -import com.epmet.dto.result.RoleOperationResultDTO; import com.epmet.feign.GovAccessFeignClient; import org.springframework.stereotype.Component; -import org.springframework.web.bind.annotation.RequestBody; - -import java.util.List; import java.util.Set; /** @@ -23,31 +15,6 @@ import java.util.Set; @Component public class GovAccessFeignClientFallback implements GovAccessFeignClient { - @Override - public Result> listOperationsByRoleId(String roleId) { - return ModuleUtils.feignConError(ServiceConstant.GOV_ACCESS_SERVER, "listOperationsByRoleId"); - } - - /** - * 刷新用户权限缓存 - * @param staffPermCacheFormDTO - * @return - */ - @Override - public Result updatePermissionCache(@RequestBody StaffPermCacheFormDTO staffPermCacheFormDTO) { - return ModuleUtils.feignConError(ServiceConstant.GOV_ACCESS_SERVER, "updatePermissionCache"); - } - - @Override - public Result> getOperationScopesByRoleId(OperationScopeFormDTO operationScopeFormDTO) { - return ModuleUtils.feignConError(ServiceConstant.GOV_ACCESS_SERVER, "getOperationScopesByRoleId", operationScopeFormDTO); - } - - @Override - 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-org/gov-org-client/pom.xml b/epmet-module/gov-org/gov-org-client/pom.xml index f97bdc99ad..124e7ca4a5 100644 --- a/epmet-module/gov-org/gov-org-client/pom.xml +++ b/epmet-module/gov-org/gov-org-client/pom.xml @@ -32,6 +32,12 @@ 2.0.0 compile + + com.epmet + gov-voice-client + 2.0.0 + compile + diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/feign/GovOrgSelfFeignClient.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/feign/GovOrgSelfFeignClient.java index 84e77dc8da..9cba1d736e 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/feign/GovOrgSelfFeignClient.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/feign/GovOrgSelfFeignClient.java @@ -2,14 +2,15 @@ package com.epmet.dto.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.feign.fallback.GovOrgSelfFeignClientFallBack; +import com.epmet.dto.form.PublishGridListFormDTO; import com.epmet.dto.result.ArticleGridResultDTO; import com.epmet.dto.result.PublishAgencyListResultDTO; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; /** * @Description gov-org服务 @@ -36,12 +37,4 @@ public interface GovOrgSelfFeignClient { @PostMapping(value = "gov/org/customeragency/getpublishagencylist/{staffId}", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) Result getPublishAgencyList(@PathVariable("staffId") String staffId); - /** - * @param staffId - * @return - * @Author sun - * @Description 根据工作人员Id查询对应的组织信息 - **/ - @PostMapping(value = "gov/org/customeragency/getagencybystaffId/{staffId}", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) - Result getAgencyByStaffId(@PathVariable("staffId") String staffId); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/feign/fallback/GovOrgSelfFeignClientFallBack.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/feign/fallback/GovOrgSelfFeignClientFallBack.java index c75f6e9257..b7c8924ea9 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/feign/fallback/GovOrgSelfFeignClientFallBack.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/feign/fallback/GovOrgSelfFeignClientFallBack.java @@ -3,8 +3,8 @@ package com.epmet.dto.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.feign.GovOrgSelfFeignClient; +import com.epmet.dto.form.PublishGridListFormDTO; import com.epmet.dto.result.ArticleGridResultDTO; import com.epmet.dto.result.PublishAgencyListResultDTO; import org.springframework.stereotype.Component; @@ -26,8 +26,4 @@ public class GovOrgSelfFeignClientFallBack implements GovOrgSelfFeignClient { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getPublishAgencyList", staffId); } - @Override - public Result getAgencyByStaffId(String staffId) { - return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAgencyByStaffId", staffId); - } } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ArticleGridResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ArticleGridResultDTO.java index 2e83e432c3..8ab4f95bec 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ArticleGridResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ArticleGridResultDTO.java @@ -24,7 +24,7 @@ import java.util.List; /** - * 党建声音-可选发布范围-接口返参 + * 党建声音-可选发布范围、可下线网格列表-接口返参 * * @author sun */ @@ -50,8 +50,16 @@ public class ArticleGridResultDTO implements Serializable { */ private List subAgencyGridList; /** - * 所有上级机关Ids + * 上级组织机构ID + */ + private String pid = ""; + /** + * 所有上级组织机构ID(以英文:隔开) */ private String pids = ""; + /** + * 所有上级名称,以-连接 + */ + private String allParentName = ""; } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java new file mode 100644 index 0000000000..88df475dac --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java @@ -0,0 +1,23 @@ +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.callback.GovOrgOpenFeignClientFallback; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; + +//@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgOpenFeignClientFallback.class, url = "localhost:8092") +@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgOpenFeignClientFallback.class) +public interface GovOrgOpenFeignClient { + + /** + * 根据Id查询agency + * @param agencyId + * @return + */ + @PostMapping("/gov/org/agency/agencybyid/{agencyId}") + Result getAgencyById(@PathVariable("agencyId") String agencyId); + +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/callback/GovOrgOpenFeignClientFallback.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/callback/GovOrgOpenFeignClientFallback.java new file mode 100644 index 0000000000..03c5cf8712 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/callback/GovOrgOpenFeignClientFallback.java @@ -0,0 +1,16 @@ +package com.epmet.feign.callback; + +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.feign.GovOrgOpenFeignClient; +import org.springframework.stereotype.Component; + +@Component +public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient { + @Override + public Result getAgencyById(String agencyId) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getAgencyById", agencyId); + } +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java index a5d236f972..6177a24ce6 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java @@ -26,10 +26,7 @@ import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.CustomerAgencyDTO; -import com.epmet.dto.form.AgencyDeptGridFormDTO; -import com.epmet.dto.form.CanTickStaffListFormDTO; -import com.epmet.dto.form.StaffOrgFormDTO; -import com.epmet.dto.form.TransferOptionalStaffListFormDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.excel.CustomerAgencyExcel; import com.epmet.service.CustomerAgencyService; @@ -178,22 +175,10 @@ public class CustomerAgencyController { * @param staffId * @return * @Author sun - * @Description 党建声音-政府端-可选发布范围接口调用-根据人员角色查询对应的不同发布范围 + * @Description 党建声音-政府端-可选发布单位接口调用-根据人员角色查询对应的不同发布单位 **/ @PostMapping("getpublishagencylist/{staffId}") public Result getPublishAgencyList(@PathVariable("staffId") String staffId) { return new Result().ok(customerAgencyService.getPublishAgencyList(staffId)); } - - /** - * @param staffId - * @return - * @Author sun - * @Description 根据工作人员Id查询对应的组织信息 - **/ - @PostMapping("getagencybystaffId/{staffId}") - public Result getAgencyByStaffId(@PathVariable("staffId") String staffId) { - return new Result().ok(customerAgencyService.getAgencyByStaffId(staffId)); - } - } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java index f7aeb9367e..66586aeec4 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java @@ -21,10 +21,7 @@ import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerAgencyDTO; -import com.epmet.dto.form.AgencyDeptGridFormDTO; -import com.epmet.dto.form.CanTickStaffListFormDTO; -import com.epmet.dto.form.StaffOrgFormDTO; -import com.epmet.dto.form.TransferOptionalStaffListFormDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.entity.CustomerAgencyEntity; @@ -172,12 +169,4 @@ public interface CustomerAgencyService extends BaseService * @Description 党建声音-政府端-可选发布单位接口调用-根据人员角色查询对应的不同发布单位 **/ PublishAgencyListResultDTO getPublishAgencyList(String staffId); - - /** - * @param staffId - * @return - * @Author sun - * @Description 根据工作人员Id查询对应的组织信息 - **/ - CustomerAgencyDTO getAgencyByStaffId(String staffId); } \ No newline at end of file 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 7172d74c7d..bebb36025d 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 @@ -806,21 +806,5 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl gridIdList; - private String customerId; - private String staffId; } diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/PublishGridListFormDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/PublishGridListFormDTO.java new file mode 100644 index 0000000000..4d16716083 --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/PublishGridListFormDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + +/** + * 党建声音-可下线网格列表-接口入参 + * + * @author sun + */ +@Data +public class PublishGridListFormDTO implements Serializable { + private static final long serialVersionUID = -6659391832410565077L; + + public interface AddUserInternalGroup {} + + /** + * 文章Id + */ + @NotBlank(message = "文章id不能为空", groups = {PublishGridListFormDTO.AddUserInternalGroup.class}) + private String articleId; +} diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/TagRankResultDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/TagRankResultDTO.java new file mode 100644 index 0000000000..5763ecddbd --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/TagRankResultDTO.java @@ -0,0 +1,30 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/6/3 19:38 + */ +@Data +public class TagRankResultDTO implements Serializable { + + private static final long serialVersionUID = 4107657623174653243L; + + /** + * zSet排序 + */ + private Double score; + + /** + * 标签Id + */ + private String tagId; + + /** + * 标签名字 + */ + private String tagName; +} diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/ArticleConstant.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/ArticleConstant.java index 4142598634..d2e2edecfb 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/ArticleConstant.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/ArticleConstant.java @@ -36,7 +36,7 @@ public interface ArticleConstant { */ String SELECT_AGRNCY_EXCEPTION = "获取用户组织信息失败"; /** - * 下线文章(用于拼接操作表字段值) + * 下线文章操作记录表文案 */ - String OFF_LINE_ARTICLE = "下线文章"; + String OFF_LINE_ARTICLE_MSG = "%s-%s下线文章【%s】"; } diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/DraftConstant.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/DraftConstant.java index dfab2106a0..26bbba7918 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/DraftConstant.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/DraftConstant.java @@ -30,4 +30,15 @@ public interface DraftConstant { * 审核中:auditing */ String AUDITING = "auditing"; + + //是否置顶 + /** + * 置顶:1 + */ + Integer TOP = 1; + + /** + * 不置顶:0 + */ + Integer UN_TOP = 0; } diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java index 84e93b7568..6040b192de 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java @@ -210,7 +210,6 @@ public class ArticleController { **/ @PostMapping("offlinearticle") public Result offLineArticle(@LoginUser TokenDto tokenDTO, @RequestBody OffLineArticleFormDTO formDTO) { - formDTO.setCustomerId(tokenDTO.getCustomerId()); formDTO.setStaffId(tokenDTO.getUserId()); ValidatorUtils.validateEntity(formDTO, OffLineArticleFormDTO.AddUserInternalGroup.class); articleService.offLineArticle(formDTO); @@ -328,6 +327,19 @@ public class ArticleController { return new Result>().ok(articleService.getArticleList(articlePageFormDTO)); } + /** + * @param tokenDTO formDTO + * @return + * @Author sun + * @Description 党建声音-政府端-可下线网格列表 + **/ + @PostMapping("publishgridlist") + public Result publishGridList(@LoginUser TokenDto tokenDTO, @RequestBody PublishGridListFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, PublishGridListFormDTO.AddUserInternalGroup.class); + return new Result().ok(articleService.publishGridList(formDTO)); + } + + /** * @Description 根绝文章Id查询出文章的内容、封面等相关信息,如果居民端传入的网格Id不在该文章的发布范围内,则返回NULL * @param articleDetailFormDTO diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/ArticlePublishRangeEntity.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/ArticlePublishRangeEntity.java index de4911067c..1328aa6f1e 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/ArticlePublishRangeEntity.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/ArticlePublishRangeEntity.java @@ -58,6 +58,21 @@ public class ArticlePublishRangeEntity extends BaseEpmetEntity { */ private String agencyGridName; + /** + * 组织ID + */ + private String agencyId; + + /** + * 所有上级组织机构ID 以英文:隔开 + */ + private String pids; + + /** + * 所有上级名称 以横杠隔开 + */ + private String allParentName; + /** * 下线时间 */ diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/DraftPublishRangeEntity.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/DraftPublishRangeEntity.java index fb3233cbb1..861b80c239 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/DraftPublishRangeEntity.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/DraftPublishRangeEntity.java @@ -58,6 +58,21 @@ public class DraftPublishRangeEntity extends BaseEpmetEntity { */ private String agencyGridName; + /** + * 组织ID + */ + private String agencyId; + + /** + * 所有上级组织机构ID 以英文:隔开 + */ + private String pids; + + /** + * 所有上级名称 以横杠隔开 + */ + private String allParentName; + /** * 下线时间 */ diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/TagRedis.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/TagRedis.java index 9de49830ba..48dcb2a23c 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/TagRedis.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/TagRedis.java @@ -24,14 +24,17 @@ import com.epmet.dto.form.CorrelationTagListFormDTO; import com.epmet.dto.form.TagCascadeListFormDTO; import com.epmet.dto.result.CorrelationTagListResultDTO; import com.epmet.dto.result.TagInfoResultDTO; +import com.epmet.dto.result.TagRankResultDTO; import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.poi.ss.formula.functions.T; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.ZSetOperations; import org.springframework.stereotype.Component; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Set; +import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.Stream; @Component public class TagRedis { @@ -56,6 +59,7 @@ public class TagRedis { List tagIdList = formDto.getTagIdList(); Set objects ; Collection keys = new ArrayList<>(); + //当查询关联标签数量大于1条时 if (tagIdList.size() > 1){ for (int i = NumConstant.ONE; i < tagIdList.size(); i++) { String tagId = tagIdList.get(i); @@ -63,8 +67,9 @@ public class TagRedis { keys.add(tagId); } String key = TagConstant.GOV_RETAG_KEY+customerId+TagConstant.COLON+tagIdList.get(0); - objects = redisUtils.sUnion(key, keys); + objects = redisUtils.intersect(key, keys); }else { + // 查询关联标签数量 等于1条时 String key = TagConstant.GOV_RETAG_KEY+customerId+TagConstant.COLON+tagIdList.get(0); objects = redisUtils.sMembers(key); } @@ -72,12 +77,37 @@ public class TagRedis { if (objects.size()==NumConstant.ZERO){ return resultList; } - ObjectMapper objectMapper = new ObjectMapper(); + //转换DTO for (Object object : objects) { - CorrelationTagListResultDTO correlationTag = objectMapper.convertValue(object, CorrelationTagListResultDTO.class); - resultList.add(correlationTag); + resultList.add(objectToDTO(object,CorrelationTagListResultDTO.class)); + } + //级联标签排序 + //1.取出 zset 中的有序标签,根据级联标签,筛选有序标签 + List resultEquals = new ArrayList<>(); + if (resultList.size() > NumConstant.ZERO) { + long start = 0; + long end = -1; + String customerKey = TagConstant.GOV_TAG_KEY + customerId; + Set> typedTuples = redisUtils.zReverseRangeWithScores(customerKey, start, end); + for (CorrelationTagListResultDTO correlationTagList : resultList) { + for (ZSetOperations.TypedTuple typedTuple : typedTuples) { + TagRankResultDTO tagRank = objectToDTO(typedTuple.getValue(), TagRankResultDTO.class); + tagRank.setScore(typedTuple.getScore()); + if (correlationTagList.getTagId().equals(tagRank.getTagId())){ + resultEquals.add(tagRank); + } + } + } + } + // 根据标签使用顺序倒叙 + List collect = resultEquals.stream().sorted(Comparator.comparing(TagRankResultDTO::getScore).reversed()).collect(Collectors.toList()); + List realResult = new ArrayList<>(); + for (TagRankResultDTO tagRankResultDTO : collect) { + CorrelationTagListResultDTO correlation = new CorrelationTagListResultDTO(); + BeanUtils.copyProperties(tagRankResultDTO,correlation); + realResult.add(correlation); } - return resultList; + return realResult; } @@ -95,10 +125,8 @@ public class TagRedis { return new ArrayList<>(); } List result = new ArrayList(); - ObjectMapper objectMapper = new ObjectMapper(); for (Object object : objects) { - TagInfoResultDTO tagInfoResultDto = objectMapper.convertValue(object, TagInfoResultDTO.class); - result.add(tagInfoResultDto); + result.add(objectToDTO(object,TagInfoResultDTO.class)); } return result; } @@ -117,16 +145,14 @@ public class TagRedis { return new ArrayList<>(); } List result = new ArrayList(); - ObjectMapper objectMapper = new ObjectMapper(); for (Object object : objects) { - TagInfoResultDTO tagInfoResultDto = objectMapper.convertValue(object, TagInfoResultDTO.class); - result.add(tagInfoResultDto); + result.add(objectToDTO(object,TagInfoResultDTO.class)); } return result; } /** - * @Description + * @Description 获取居民端级联标签——按照使用次数倒序 * @param formDto * @author zxc */ @@ -135,6 +161,7 @@ public class TagRedis { String gridId = formDto.getGridId(); Set objects ; Collection keys = new ArrayList<>(); + //当 级联标签大于1条的时候 if (tagIdList.size() > 1){ for (int i = NumConstant.ONE; i < tagIdList.size(); i++) { String tagId = tagIdList.get(i); @@ -142,8 +169,9 @@ public class TagRedis { keys.add(tagId); } String key = TagConstant.GRID_RETAG_KEY+gridId+TagConstant.COLON+tagIdList.get(0); - objects = redisUtils.sUnion(key, keys); + objects = redisUtils.intersect(key, keys); }else { + //当级联标签为一条时 String key = TagConstant.GRID_RETAG_KEY+gridId+TagConstant.COLON+tagIdList.get(0); objects = redisUtils.sMembers(key); } @@ -151,12 +179,49 @@ public class TagRedis { if (objects.size()==NumConstant.ZERO){ return resultList; } - ObjectMapper objectMapper = new ObjectMapper(); + //转换DTO for (Object object : objects) { - TagInfoResultDTO tagInfo = objectMapper.convertValue(object, TagInfoResultDTO.class); - resultList.add(tagInfo); + resultList.add(objectToDTO(object, TagInfoResultDTO.class)); + } + //级联标签排序 + //1.取出 zset 中的有序标签,根据级联标签,筛选有序标签 + List resultEquals = new ArrayList<>(); + if (resultList.size() > NumConstant.ZERO) { + long start = 0; + long end = -1; + String customerKey = TagConstant.GRID_TAG_KEY+formDto.getGridId(); + Set> typedTuples = redisUtils.zReverseRangeWithScores(customerKey, start, end); + for (TagInfoResultDTO tagInfo : resultList) { + for (ZSetOperations.TypedTuple typedTuple : typedTuples) { + TagRankResultDTO tagRank = objectToDTO(typedTuple.getValue(), TagRankResultDTO.class); + tagRank.setScore(typedTuple.getScore()); + if (tagInfo.getTagId().equals(tagRank.getTagId())){ + resultEquals.add(tagRank); + } + } + } + } + // 根据标签使用顺序倒叙 + List collect = resultEquals.stream().sorted(Comparator.comparing(TagRankResultDTO::getScore).reversed()).collect(Collectors.toList()); + List tagInfoResultList = new ArrayList<>(); + for (TagRankResultDTO tagRankResultDTO : collect) { + TagInfoResultDTO tagInfoResult = new TagInfoResultDTO(); + BeanUtils.copyProperties(tagRankResultDTO,tagInfoResult); + tagInfoResultList.add(tagInfoResult); } - return resultList; + return tagInfoResultList; + } + + /** + * @Description Object 转换 DTO + * @param o + * @param tClass + * @author zxc + */ + public T objectToDTO(Object o,Class tClass){ + ObjectMapper objectMapper = new ObjectMapper(); + T t = objectMapper.convertValue(o, tClass); + return t; } } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java index 7936148774..1fbeeadf2f 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java @@ -214,6 +214,14 @@ public interface ArticleService extends BaseService { **/ List getArticleList(ArticlePageFormDTO articlePageFormDTO); + /** + * @param formDTO + * @return + * @Author sun + * @Description 党建声音-政府端-可下线网格列表 + **/ + ArticleGridResultDTO publishGridList(PublishGridListFormDTO formDTO); + /** * @Description 根绝文章Id查询出文章的内容、封面等相关信息,如果居民端传入的网格Id不在该文章的发布范围内,则返回NULL * @param articleDetailFormDTO diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java index b2ab64eb21..d9a4c4852e 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java @@ -538,18 +538,14 @@ public class ArticleServiceImpl extends BaseServiceImpl resultAgency = govOrgSelfFeignClient.getAgencyByStaffId(formDTO.getStaffId()); - if (null == resultAgency.getData()) { - throw new RenException(ArticleConstant.SELECT_AGRNCY_EXCEPTION); - } - CustomerAgencyDTO agencyDTO = resultAgency.getData(); + //4.2:查询文章表数据 + ArticleEntity articleEntity = baseDao.selectById(formDTO.getArticleId()); //4.3:新增操作表数据 ArticleOperateRecordEntity recordEntity = new ArticleOperateRecordEntity(); - recordEntity.setCustomerId(formDTO.getCustomerId()); + recordEntity.setCustomerId(articleEntity.getCustomerId()); recordEntity.setArticleId(formDTO.getArticleId()); - recordEntity.setOpUser(agencyDTO.getOrganizationName() + "-" + staffDTO.getRealName()); - recordEntity.setContent(recordEntity.getOpUser() + ArticleConstant.OFF_LINE_ARTICLE); + recordEntity.setOpUser(articleEntity.getPublisherName() + "-" + staffDTO.getRealName()); + recordEntity.setContent(String.format(ArticleConstant.OFF_LINE_ARTICLE_MSG, articleEntity.getPublisherName(), staffDTO.getRealName(), articleEntity.getTitle())); recordEntity.setOpType(ArticleConstant.OFFLINE); recordEntity.setOpTime(date); articleOperateRecordService.insert(recordEntity); @@ -643,6 +639,27 @@ public class ArticleServiceImpl extends BaseServiceImpl rangeEntityList = articlePublishRangeDao.selectByArticleId(rangeEntity); + if(null==rangeEntityList||rangeEntityList.size() gridIdList = rangeEntityList.stream().map(ArticlePublishRangeEntity::getGridId).collect(Collectors.toList()); + formDTO.setGridIdList(gridIdList);*/ + + return null; + } /** * @Description 根绝文章Id查询出文章的内容、封面等相关信息,如果居民端传入的网格Id不在该文章的发布范围内,则返回NULL * @param articleDetailFormDTO diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticlePublishRangeDao.xml b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticlePublishRangeDao.xml index ee2fa6bf60..0052c7414a 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticlePublishRangeDao.xml +++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticlePublishRangeDao.xml @@ -10,7 +10,12 @@ article_publish_range WHERE del_flag = '0' - AND article_id = #{articleId} + + AND article_id = #{articleId} + + + AND publish_status = #{publishStatus} + ORDER BY created_time ASC \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/migration/epmet_gov_voice.sql b/epmet-module/gov-voice/gov-voice-server/src/main/resources/migration/epmet_gov_voice.sql index a648a84f99..3e6b5f587d 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/resources/migration/epmet_gov_voice.sql +++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/migration/epmet_gov_voice.sql @@ -75,13 +75,13 @@ CREATE TABLE draft( TITLE VARCHAR(128) NOT NULL COMMENT '文章标题' , PREVIEW_CONTENT VARCHAR(512) NOT NULL COMMENT '文章内容 精简内容' , IS_TOP INT NOT NULL COMMENT '是否置顶 1是;0否;' , - PUBLISH_RANGE_DESC VARCHAR(512) NOT NULL COMMENT '发布范围描述 所有发布范围集合,顿号隔开' , - PUBLISHER_ID VARCHAR(64) NOT NULL COMMENT '发布单位ID' , - PUBLISHER_NAME VARCHAR(128) NOT NULL COMMENT '发布单位名称' , - PUBLISHER_TYPE VARCHAR(32) NOT NULL COMMENT '发布单位类型 机关:agency;部门:department;网格:grid' , - PUBLISH_DATE DATE NOT NULL COMMENT '发布时间' , + PUBLISH_RANGE_DESC VARCHAR(512) COMMENT '发布范围描述 所有发布范围集合,顿号隔开' , + PUBLISHER_ID VARCHAR(64) COMMENT '发布单位ID' , + PUBLISHER_NAME VARCHAR(128) COMMENT '发布单位名称' , + PUBLISHER_TYPE VARCHAR(32) COMMENT '发布单位类型 机关:agency;部门:department;网格:grid' , + PUBLISH_DATE DATE COMMENT '发布时间' , STATUS_FLAG VARCHAR(32) NOT NULL COMMENT '发布状态 未发布:unpublish ;已发布:published,审核中:auditing;审核失败:auditfail' , - TAGS VARCHAR(512) NOT NULL COMMENT '文章标签串 竖杠分割的标签名称' , + TAGS VARCHAR(512) COMMENT '文章标签串 竖杠分割的标签名称' , ORG_ID VARCHAR(64) COMMENT '组织ID' , ORG_ID_PATH VARCHAR(512) COMMENT '组织ID路径 eg:字段为def:abc' , GRID_ID VARCHAR(64) COMMENT '网格ID 数据权限使用' , @@ -121,6 +121,9 @@ CREATE TABLE draft_publish_range( DRAFT_ID VARCHAR(64) NOT NULL COMMENT 'ID草稿' , GRID_ID VARCHAR(64) NOT NULL COMMENT '网格ID' , AGENCY_GRID_NAME VARCHAR(64) NOT NULL COMMENT '组织-网格名称' , + AGENCY_ID VARCHAR(64) NOT NULL COMMENT '组织ID' , + PIDS VARCHAR(1024) NOT NULL COMMENT '所有上级组织机构ID 以英文:隔开' , + ALL_PARENT_NAME VARCHAR(1024) NOT NULL COMMENT '所有上级名称 以横杠隔开' , OFF_LINE_TIME DATETIME COMMENT '下线时间' , PUBLISH_STATUS VARCHAR(32) NOT NULL COMMENT '发布状态 未发布:unpublish ;已发布:published' , DEL_FLAG INT NOT NULL DEFAULT 0 COMMENT '删除标识 0.未删除 1.已删除' , @@ -221,6 +224,9 @@ CREATE TABLE article_publish_range( ARTICLE_ID VARCHAR(64) NOT NULL COMMENT '文章ID' , GRID_ID VARCHAR(64) NOT NULL COMMENT '网格ID' , AGENCY_GRID_NAME VARCHAR(64) NOT NULL COMMENT '组织-网格名称' , + AGENCY_ID VARCHAR(64) NOT NULL COMMENT '组织ID' , + PIDS VARCHAR(1024) NOT NULL COMMENT '所有上级组织机构ID 以英文:隔开' , + ALL_PARENT_NAME VARCHAR(1024) NOT NULL COMMENT '所有上级名称 以横杠隔开' , OFF_LINE_TIME DATETIME COMMENT '下线时间' , PUBLISH_STATUS VARCHAR(32) NOT NULL COMMENT '发布状态 已发布:published;已下线:offline' , DEL_FLAG INT NOT NULL DEFAULT 0 COMMENT '删除标识 0.未删除 1.已删除' , @@ -269,3 +275,4 @@ CREATE TABLE article_visit_record( ALTER TABLE article_visit_record ADD UNIQUE UNX_INDEX(ARTICLE_ID,GRID_ID,USER_ID); ALTER TABLE article_visit_record COMMENT '文章访问记录表'; + diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/RoleKeyConstants.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/RoleKeyConstants.java index 1bc1e03a24..4d82df0d1f 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/RoleKeyConstants.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/RoleKeyConstants.java @@ -1,17 +1,47 @@ package com.epmet.constant; /** - * 角色key常量 + * 政府端工作人员角色key常量 */ public class RoleKeyConstants { - + /** + * 管理员 + */ public static final String ROLE_KEY_MANAGER = "manager"; + + /** + * 党建负责人 + */ public static final String ROLE_KEY_PARTY_PRINCIPALS = "party_principals"; + + /** + * 网格长 + */ public static final String ROLE_KEY_GRID_MANAGER = "grid_manager"; + + /** + * 单位领导 + */ public static final String ROLE_KEY_AGENCY_LEADER = "agency_leader"; + + /** + * 网格党建指导员 + */ public static final String ROLE_KEY_GRID_PARTY_DIRECTOR = "grid_party_director"; + + /** + * 部门领导 + */ public static final String ROLE_KEY_DEPT_LEADER = "dept_leader"; + + /** + * 工作人员 + */ public static final String ROLE_KEY_STAFF = "staff"; + + /** + * 网格员 + */ public static final String ROLE_KEY_GRID_MEMBER = "grid_member"; }