diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java index 8c6432aadd..3217260019 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java @@ -424,6 +424,13 @@ public class DateUtils { return DateUtils.format(date,DateUtils.DATE_PATTERN_YYYYMMDD); } + public static String getBeforeNDay(int beforDay,String format){ + Calendar c = Calendar.getInstance(); + c.add(Calendar.DATE, - beforDay); + Date date = c.getTime(); + return DateUtils.format(date,format); + } + /** * @return java.lang.String * @param beforMonth diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/user/result/UserStatisticalData.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/user/result/UserStatisticalData.java index e50824d0cb..40315afc0c 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/user/result/UserStatisticalData.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/user/result/UserStatisticalData.java @@ -17,25 +17,58 @@ import java.util.List; public class UserStatisticalData implements Serializable { private static final long serialVersionUID = 7423427555123585566L; + /** + * 机关下(按日)参与用户数分析 + */ private List partiAgencyDailyList; + /** + * 网格下(按日)参与用户数分析 + */ private List partiGridDailyList; + /** + * 机关下(按月)参与用户数分析 + */ private List partiAgencyMonthlyList; + /** + * 网格下(月)参与用户数分析 + */ private List partiGridMonthlyList; + /** + * 机关(按日)注册用户数分析 + */ private List regAgencyDailyList; + /** + * 网格(按日)注册用户数分析 + */ private List regGridDailyList; + /** + * 机关(按月)注册用户数分析 + */ private List regAgencyMonthlyList; + /** + * 网格(月)注册用户数分析 + */ private List regGridMonthlyList; + /** + * 当前正在计算的客户id + */ private String customerId; + /** + * yyyyMMdd + */ private String dateId; + /** + * yyyyMM + */ private String monthId; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsUserController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsUserController.java index bc3ed0d09b..9c521b770a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsUserController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsUserController.java @@ -21,6 +21,12 @@ public class StatsUserController { @Autowired private StatsUserService statsUserService; + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @description 工作端数据一期,用户分析:参与用户、注册用户分析 + * @Date 2021/3/26 13:27 + **/ @RequestMapping("execute") public Result execute(@RequestBody StatsFormDTO formDTO) { statsUserService.partition(formDTO); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java index 35568a1e2f..0d35eede37 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java @@ -1,6 +1,7 @@ package com.epmet.service.impl; +import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.ProjectConstant; @@ -58,17 +59,25 @@ public class StatsUserServiceImpl implements StatsUserService { **/ @Override public void partition(StatsFormDTO formDTO) { + if(StringUtils.isBlank(formDTO.getDate())){ + //如果定时任务没有指定参数,默认数据更新至t-1,包含t-1这一天内的数据 + formDTO.setDate(DateUtils.getBeforeNDay(1,DateUtils.DATE_PATTERN)); + } + int pageNo = NumConstant.ONE; int pageSize = NumConstant.ONE_HUNDRED; List customerIdList = null; Date date = null; + if (StringUtils.isNotBlank(formDTO.getDate())) { + //如果指定了参数,转化为yyyy-MM-dd格式 date = DateUtils.stringToDate(formDTO.getDate(), DateUtils.DATE_PATTERN); } if (StringUtils.isNotBlank(formDTO.getCustomerId())) { generate(formDTO.getCustomerId(), date); } else { do { + //每100个客户一组 customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize); if (!CollectionUtils.isEmpty(customerIdList)) { for (String customerId : customerIdList) { @@ -90,6 +99,7 @@ public class StatsUserServiceImpl implements StatsUserService { * @date 2020.06.28 14:40 **/ void generate(String customerId,Date date){ + log.info("customerId:"+customerId+";date:"+DateUtils.format(date,DateUtils.DATE_TIME_PATTERN)); //1.初始化时间参数 Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date()); @@ -99,13 +109,11 @@ public class StatsUserServiceImpl implements StatsUserService { calendar.set(Calendar.MINUTE, NumConstant.ZERO); calendar.set(Calendar.SECOND, NumConstant.ZERO); - //2.初始化时间维度 + //2.初始化时间维度{"dateId":"20210325","monthId":"202103","quarterId":"2021Q1","weekId":"2021W13","yearId":"2021"} DimIdGenerator.DimIdBean timeDimension = DimIdGenerator.getDimIdBean(null == date ? calendar.getTime() : date); - + log.info("timeDimension:"+ JSON.toJSONString(timeDimension)); //3.初始化机关维度 List agencies = dimAgencyService.getAllAgency(customerId); - //List topAgencies = dimAgencyService.getTopAgency(customerId); - //4.计算机关统计数据、生成唯一性统计数据 try { UserStatisticalData agencyData = userService.traverseAgencyUser(agencies, date, timeDimension); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java index db739b79ab..b5594541a6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java @@ -62,8 +62,8 @@ public class UserServiceImpl implements UserService { dataPacket.setDateId(timeDimension.getDateId()); dataPacket.setMonthId(timeDimension.getMonthId()); //自上向下检索 - Map> agencyMap = agencies.stream().collect(Collectors.groupingBy(AgencySubTreeDto::getAgencyId)); + //subGridOfAgency key:agencyId ,value:当前组织下的所有网格(即直属网格+下级组织下的所有网格) Map> subGridOfAgency = new HashMap<>(); agencies.forEach(agency -> { initAgencyGridMap(agency.getAgencyId(),agency,subGridOfAgency); @@ -71,12 +71,13 @@ public class UserServiceImpl implements UserService { //对每一个机关进行数据统计 if(subGridOfAgency.size() > NumConstant.ZERO){ - subGridOfAgency.forEach((k,v) -> { + //如果当前客户存在组织 + subGridOfAgency.forEach((agencyId,subGridIds) -> { queryUserData(ModuleConstant.DIM_SUB_AGENCY, - k, - (null == agencyMap.get(k) || agencyMap.get(k).isEmpty()) ? NumConstant.ZERO_STR : agencyMap.get(k).get(NumConstant.ZERO).getPid(), - (null == agencyMap.get(k) || agencyMap.get(k).isEmpty()) ? null : agencyMap.get(k).get(NumConstant.ZERO).getCustomerId(), - v, + agencyId, + // (null == agencyMap.get(agencyId) || agencyMap.get(agencyId).isEmpty()) ? NumConstant.ZERO_STR : agencyMap.get(agencyId).get(NumConstant.ZERO).getPid(), + (null == agencyMap.get(agencyId) || agencyMap.get(agencyId).isEmpty()) ? null : agencyMap.get(agencyId).get(NumConstant.ZERO).getCustomerId(), + subGridIds, targetDate, dataPacket, timeDimension); @@ -107,11 +108,11 @@ public class UserServiceImpl implements UserService { //自上向下检索 Map> agencyMap = agencies.stream().collect(Collectors.groupingBy(AgencySubTreeDto::getAgencyId)); if(null != agencyMap && agencyMap.size() > NumConstant.ZERO){ - agencyMap.forEach((k,v) -> { + agencyMap.forEach((agencyId,v) -> { if(null != v && v.size() > NumConstant.ZERO){ queryUserData(ModuleConstant.DIM_BELONGING_GRID, - k, - v.get(NumConstant.ZERO).getPid(), + agencyId, + // v.get(NumConstant.ZERO).getPid(), v.get(NumConstant.ZERO).getCustomerId(), new HashSet<>(v.get(NumConstant.ZERO).getGridIds()), targetDate, @@ -181,22 +182,22 @@ public class UserServiceImpl implements UserService { /** * @Description 初始化机关-所有下级网格Map - * @param pid - 固定一个机关Id + * @param agencyId - 当前组织id * @param agency - AgencySubTreeDto * @param subGridOfAgency - Map> * @return * @author wangc * @date 2020.06.18 15:54 **/ - void initAgencyGridMap(String pid, AgencySubTreeDto agency, Map> subGridOfAgency){ + void initAgencyGridMap(String agencyId, AgencySubTreeDto agency, Map> subGridOfAgency){ //向map中放入数据 - if(subGridOfAgency.containsKey(pid)){ + if(subGridOfAgency.containsKey(agencyId)){ //包含key - Set grids = subGridOfAgency.get(pid); + Set grids = subGridOfAgency.get(agencyId); if(null == grids){ grids = new HashSet<>(); - subGridOfAgency.put(pid,grids); + subGridOfAgency.put(agencyId,grids); } if(null != agency.getGridIds() && agency.getGridIds().size() > NumConstant.ZERO){ grids.addAll(agency.getGridIds()); @@ -204,18 +205,20 @@ public class UserServiceImpl implements UserService { }else{ //不包含key Set grids = new HashSet<>(agency.getGridIds()); - subGridOfAgency.put(pid,grids); + subGridOfAgency.put(agencyId,grids); } - + //外层是从顶级组织向下循环,所以循环到社区时跳出 //定义递归出口 - if(StringUtils.equals(ModuleConstant.AGENCY_LEVEL_COMMUNITY,agency.getLevel()) || null == agency.getSubAgencies() || agency.getSubAgencies().size() == NumConstant.ZERO){ - return ; + if (StringUtils.equals(ModuleConstant.AGENCY_LEVEL_COMMUNITY, agency.getLevel()) + || null == agency.getSubAgencies() + || agency.getSubAgencies().size() == NumConstant.ZERO) { + return; } //定义递归入口 agency.getSubAgencies().forEach(obj -> { - initAgencyGridMap(pid,obj,subGridOfAgency); + initAgencyGridMap(agencyId,obj,subGridOfAgency); }); } @@ -223,7 +226,7 @@ public class UserServiceImpl implements UserService { * @Description 执行查询用户数据统计的逻辑 * @param relation - agency(下级机关加网格) | grid(直属网格) * @param agencyId - * @param pid + * @param //pid 当前agency的父级组织id * @param customerId * @param gridIds - 机关下所有网格集合/机关下直属网格集合 * @param targetDate @@ -233,10 +236,12 @@ public class UserServiceImpl implements UserService { * @author wangc * @date 2020.06.19 10:01 **/ - void queryUserData(String relation, String agencyId, String pid, String customerId, Set gridIds, Date targetDate, UserStatisticalData dataPacket, DimIdGenerator.DimIdBean timeDimension){ - - if(StringUtils.isBlank(pid)) - pid = NumConstant.ZERO_STR; + void queryUserData(String relation, String agencyId, + // String pid, + String customerId, Set gridIds, Date targetDate, UserStatisticalData dataPacket, DimIdGenerator.DimIdBean timeDimension){ + //pid没用到还传过来干啥-- 注释掉 + // if(StringUtils.isBlank(pid)) + // pid = NumConstant.ZERO_STR; dataPacket.setCustomerId(customerId); @@ -253,6 +258,9 @@ public class UserServiceImpl implements UserService { //指定日期 OR T-1 calendar.setTime(targetDateCheck); + //calendar.get(Calendar.DATE) 当前日期数eg:2021-03-29 :29 + //calendar.getActualMinimum(Calendar.DAY_OF_MONTH) :1 + //如果目标日期不是是当月的第一天 if(calendar.get(Calendar.DATE) != calendar.getActualMinimum(Calendar.DAY_OF_MONTH)){ //求出这个月的第一天 @@ -264,7 +272,6 @@ public class UserServiceImpl implements UserService { isMonthBeginning = false; } - if(StringUtils.equals(ModuleConstant.DIM_SUB_AGENCY,relation)){ @@ -396,8 +403,6 @@ public class UserServiceImpl implements UserService { partiAgencyM.setWarmHeartedProportion(partiAgencyD.getWarmHeartedProportion()); partiAgencyM.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT); - - //如果是月初第一天,不再做日期区间查询 if(isMonthBeginning) { if (null == dataPacket.getRegAgencyMonthlyList()) { @@ -416,6 +421,7 @@ public class UserServiceImpl implements UserService { } }else{ //如果不是月初第一天 + //targetDateCheck:定时任务参数中的date;calendar.getTime():date所属月第一天; //本月注册用户增长数 Integer regIncrMonthly = userDao.selectResiIncrWithinTimeRange(ModuleConstant.REG_OR_PARTI_FLAG_REG,gridIds,calendar.getTime(),targetDateCheck); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml index 969a848ae3..f30740e0ee 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml @@ -40,11 +40,13 @@ + - AND CREATED_TIME =]]> #{targetDate} AND CREATED_TIME DATE_SUB( #{targetDate}, INTERVAL - 1 DAY) + and DATE_FORMAT(CREATED_TIME,"%Y-%m-%d") = DATE_FORMAT(#{targetDate},"%Y-%m-%d") + - AND CREATED_TIME CURDATE( ) AND CREATED_TIME =]]> DATE_SUB( CURDATE( ), INTERVAL 1 DAY ) + and DATE_FORMAT(CREATED_TIME,"%Y-%m-%d") = DATE_FORMAT( DATE_SUB( CURDATE( ), INTERVAL 1 DAY ),"%Y-%m-%d") ) AS incr @@ -76,11 +78,13 @@ + - AND CREATED_TIME DATE_SUB( #{targetDate}, INTERVAL - 1 DAY ) + and DATE_FORMAT(CREATED_TIME,"%Y-%m-%d") DATE_FORMAT(#{targetDate},"%Y-%m-%d") + - AND CREATED_TIME CURDATE( ) + and DATE_FORMAT(CREATED_TIME,"%Y-%m-%d") DATE_FORMAT(DATE_SUB( CURDATE( ), INTERVAL 1 DAY ),"%Y-%m-%d") @@ -121,10 +125,10 @@ - AND CREATED_TIME =]]> #{targetDate} AND CREATED_TIME DATE_SUB( #{targetDate}, INTERVAL - 1 DAY) + and DATE_FORMAT(CREATED_TIME,"%Y-%m-%d") = DATE_FORMAT(#{targetDate},"%Y-%m-%d") - AND CREATED_TIME CURDATE( ) AND CREATED_TIME =]]> DATE_SUB( CURDATE( ), INTERVAL 1 DAY ) + and DATE_FORMAT(CREATED_TIME,"%Y-%m-%d") = DATE_FORMAT(DATE_SUB( CURDATE( ), INTERVAL 1 DAY ),"%Y-%m-%d") @@ -164,10 +168,10 @@ - AND CREATED_TIME DATE_SUB( #{targetDate}, INTERVAL - 1 DAY ) + and DATE_FORMAT(CREATED_TIME,"%Y-%m-%d") DATE_FORMAT(#{targetDate},"%Y-%m-%d") - AND CREATED_TIME CURDATE( ) + and DATE_FORMAT(CREATED_TIME,"%Y-%m-%d") DATE_FORMAT(DATE_SUB( CURDATE( ), INTERVAL 1 DAY ),"%Y-%m-%d") @@ -190,10 +194,10 @@ - AND urole.CREATED_TIME =]]> #{targetDate} AND urole.CREATED_TIME DATE_SUB( #{targetDate}, INTERVAL - 1 DAY) + and DATE_FORMAT(urole.CREATED_TIME,"%Y-%m-%d") = DATE_FORMAT(#{targetDate},"%Y-%m-%d") - AND urole.CREATED_TIME CURDATE( ) AND urole.CREATED_TIME =]]> DATE_SUB( CURDATE( ), INTERVAL 1 DAY ) + and DATE_FORMAT(urole.CREATED_TIME,"%Y-%m-%d") = DATE_FORMAT(DATE_SUB( CURDATE( ), INTERVAL 1 DAY ),"%Y-%m-%d") @@ -221,10 +225,10 @@ - AND urole.CREATED_TIME DATE_SUB( #{targetDate}, INTERVAL - 1 DAY ) + and DATE_FORMAT( urole.CREATED_TIME,"%Y-%m-%d") DATE_FORMAT(#{targetDate},"%Y-%m-%d") - AND urole.CREATED_TIME CURDATE( ) + and DATE_FORMAT(urole.CREATED_TIME,"%Y-%m-%d") DATE_FORMAT(DATE_SUB( CURDATE( ), INTERVAL 1 DAY ),"%Y-%m-%d") AND erole.ROLE_NAME = '党员' @@ -261,10 +265,10 @@ - AND urole.CREATED_TIME =]]> #{targetDate} AND urole.CREATED_TIME DATE_SUB( #{targetDate}, INTERVAL - 1 DAY) + and DATE_FORMAT(urole.CREATED_TIME,"%Y-%m-%d")=DATE_FORMAT(#{targetDate},"%Y-%m-%d") - AND urole.CREATED_TIME CURDATE( ) AND urole.CREATED_TIME =]]> DATE_SUB( CURDATE( ), INTERVAL 1 DAY ) + and DATE_FORMAT(urole.CREATED_TIME,"%Y-%m-%d")=DATE_FORMAT(DATE_SUB( CURDATE( ), INTERVAL 1 DAY ),"%Y-%m-%d") AND erole.ROLE_NAME = '热心居民' @@ -290,10 +294,10 @@ - AND urole.CREATED_TIME DATE_SUB( #{targetDate}, INTERVAL - 1 DAY ) + and DATE_FORMAT(urole.CREATED_TIME,"%Y-%m-%d") DATE_FORMAT(#{targetDate},"%Y-%m-%d") - AND urole.CREATED_TIME CURDATE( ) + and DATE_FORMAT(urole.CREATED_TIME,"%Y-%m-%d") DATE_FORMAT(DATE_SUB( CURDATE( ), INTERVAL 1 DAY ),"%Y-%m-%d") AND erole.ROLE_NAME = '热心居民'; @@ -332,8 +336,8 @@ - - AND CREATED_TIME =]]> #{startDate} AND CREATED_TIME DATE_SUB( #{endDate}, INTERVAL - 1 DAY) + AND CREATED_TIME =]]> DATE_FORMAT(#{startDate},"%Y-%m-%d") + AND CREATED_TIME DATE_FORMAT(#{endDate},"%Y-%m-%d") @@ -368,10 +372,8 @@ - - - AND CREATED_TIME =]]> #{startDate} AND CREATED_TIME DATE_SUB( #{endDate}, INTERVAL - 1 DAY) - + AND CREATED_TIME =]]> DATE_FORMAT(#{startDate},"%Y-%m-%d") + AND CREATED_TIME DATE_FORMAT(#{endDate},"%Y-%m-%d") @@ -394,9 +396,8 @@ - - - AND urole.CREATED_TIME =]]> #{startDate} AND urole.CREATED_TIME DATE_SUB( #{endDate}, INTERVAL - 1 DAY) + AND urole.CREATED_TIME =]]> DATE_FORMAT(#{startDate},"%Y-%m-%d") + AND urole.CREATED_TIME DATE_FORMAT(#{endDate},"%Y-%m-%d") AND erole.ROLE_NAME = '党员' @@ -423,7 +424,8 @@ - AND urole.CREATED_TIME =]]> #{startDate} AND urole.CREATED_TIME DATE_SUB( #{endDate}, INTERVAL - 1 DAY) + AND urole.CREATED_TIME =]]> DATE_FORMAT(#{startDate},"%Y-%m-%d") + AND urole.CREATED_TIME DATE_FORMAT(#{endDate},"%Y-%m-%d") AND erole.ROLE_NAME = '热心居民' diff --git a/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/result/CustomerRoleResultDTO.java b/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/result/CustomerRoleResultDTO.java new file mode 100644 index 0000000000..a8fe59a2f8 --- /dev/null +++ b/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/result/CustomerRoleResultDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2021/3/29 15:26 + */ +@Data +public class CustomerRoleResultDTO implements Serializable { + private static final long serialVersionUID = 4933114432141586045L; + + private String roleName; + private String roleKey; + private String roleId; + private Boolean fullTimeOnly; +} diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java index 4fd89b0dbc..c0535b648b 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java @@ -147,5 +147,18 @@ public class OpenUpController { ValidatorUtils.validateEntity(formDTO); return new Result().ok(openUpService.queryStaffPermissionV2(formDTO)); } + + /** + * @return + * @param formDTO 客户id + * @author yinzuomei + * @description 010、获取当前客户下-工作端角色列表 + * @Date 2021/3/29 15:25 + **/ + @PostMapping("govrolelist") + public Result> queryCustomerGovRoleList(@RequestBody CustomerInfoQueryFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO); + return new Result>().ok(openUpService.queryCustomerGovRoleList(formDTO.getCustomerId())); + } } diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenUpService.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenUpService.java index 6fbe32afe6..8047ec9f8c 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenUpService.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenUpService.java @@ -62,4 +62,13 @@ public interface OpenUpService { * @Date 2021/2/3 20:59 **/ StaffPermissionResultDTO queryStaffPermissionV2(StaffPermissionFormDTO formDTO); + + /** + * @return java.util.List + * @param customerId + * @author yinzuomei + * @description 010、获取当前客户下-工作端角色列表 + * @Date 2021/3/29 15:27 + **/ + List queryCustomerGovRoleList(String customerId); } diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java index 43f50a34c9..0f6cb365b3 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java @@ -210,4 +210,21 @@ public class OpenUpServiceImpl implements OpenUpService { return resultDTO; } + /** + * @param customerId + * @return java.util.List + * @author yinzuomei + * @description 010、获取当前客户下-工作端角色列表 + * @Date 2021/3/29 15:27 + **/ + @Override + public List queryCustomerGovRoleList(String customerId) { + Result> userRes = epmetUserOpenFeignClient.queryCustomerGovRoleList(customerId); + if (!userRes.success() || CollectionUtils.isEmpty(userRes.getData())) { + log.error(String.format("获取当前客户下,工作端角色列表失败,customerId:%s", customerId)); + return new ArrayList<>(); + } + return ConvertUtils.sourceToTarget(userRes.getData(), CustomerRoleResultDTO.class); + } + } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/RoleInfoResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/RoleInfoResultDTO.java index c2378a87a5..81498e5586 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/RoleInfoResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/RoleInfoResultDTO.java @@ -29,4 +29,6 @@ public class RoleInfoResultDTO implements Serializable{ * */ @JsonInclude(JsonInclude.Include.NON_NULL) private Boolean fullTimeOnly = false; + + private String roleKey; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index d48703ffb4..3332aec3a1 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -486,4 +486,14 @@ public interface EpmetUserOpenFeignClient { */ @PostMapping(value = "/epmetuser/user/saveuserinfo") Result saveUserInfo(@RequestBody UserInfoFormDTO formDTO); + + /** + * @return com.epmet.commons.tools.utils.Result> + * @param customerId + * @author yinzuomei + * @description 获取当前客户下-工作端角色列表 + * @Date 2021/3/29 15:35 + **/ + @GetMapping(value = "/epmetuser/govstaffrole/querycustomergovrolelist/{customerId}") + Result> queryCustomerGovRoleList(@PathVariable("customerId")String customerId); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index 195f1a0c38..c1944b43a3 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -337,8 +337,21 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "saveUserInfo", formDTO); } + /** + * @param customerId + * @return com.epmet.commons.tools.utils.Result> + * @author yinzuomei + * @description 获取当前客户下-工作端角色列表 + * @Date 2021/3/29 15:35 + **/ + @Override + public Result> queryCustomerGovRoleList(String customerId) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "queryCustomerGovRoleList", customerId); + } + @Override public Result initGovStaffRolesForCustomer(String customerId) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "initGovStaffRolesForCustomer", customerId); } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GovStaffRoleController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GovStaffRoleController.java index 40cab6cb5a..37df7c9140 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GovStaffRoleController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GovStaffRoleController.java @@ -9,6 +9,7 @@ import com.epmet.dto.form.GovStaffRoleFormDTO; import com.epmet.dto.result.GovStaffRoleResultDTO; import com.epmet.dto.result.GovStaffRoleTemplateDTO; import com.epmet.dto.result.ResiGovRoleListResultDTO; +import com.epmet.dto.result.RoleInfoResultDTO; import com.epmet.service.GovStaffRoleService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.CollectionUtils; @@ -112,4 +113,15 @@ public class GovStaffRoleController { return new Result>().ok(roles); } + /** + * @return com.epmet.commons.tools.utils.Result> + * @param customerId + * @author yinzuomei + * @description 获取当前客户下-工作端角色列表 + * @Date 2021/3/29 15:37 + **/ + @GetMapping("querycustomergovrolelist/{customerId}") + Result> queryCustomerGovRoleList(@PathVariable("customerId") String customerId){ + return new Result>().ok(govStaffRoleService.queryCustomerGovRoleList(customerId)); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java index 346fad61b2..6ee17905c2 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java @@ -23,6 +23,7 @@ import com.epmet.dto.GovStaffRoleDTO; import com.epmet.dto.result.GovStaffRoleResultDTO; import com.epmet.dto.result.GovStaffRoleTemplateDTO; import com.epmet.dto.result.ResiGovRoleListResultDTO; +import com.epmet.dto.result.RoleInfoResultDTO; import com.epmet.entity.GovStaffRoleEntity; import java.util.List; @@ -140,4 +141,13 @@ public interface GovStaffRoleService extends BaseService { void saveSortOrder(List roleIdList); List listRolesByRoleKey(String roleKey); + + /** + * @return java.util.List + * @param customerId + * @author yinzuomei + * @description 获取当前客户下-工作端角色列表 + * @Date 2021/3/29 15:37 + **/ + List queryCustomerGovRoleList(String customerId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java index 16c6a375e2..15a8b10483 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java @@ -20,20 +20,17 @@ 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.FieldConstant; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.GovStaffRoleDao; import com.epmet.dao.GovStaffRoleTemplateDao; import com.epmet.dao.RoleDao; import com.epmet.dto.GovStaffRoleDTO; import com.epmet.dto.form.InitDefaultOperationsFormDTO; -import com.epmet.dto.result.GovStaffRoleResultDTO; -import com.epmet.dto.result.GovStaffRoleTemplateDTO; -import com.epmet.dto.result.ResiGovRoleListResultDTO; -import com.epmet.dto.result.ResiGovRoleResultDTO; +import com.epmet.dto.result.*; import com.epmet.entity.GovStaffRoleEntity; import com.epmet.feign.GovAccessFeignClient; import com.epmet.redis.GovStaffRoleRedis; @@ -242,4 +239,28 @@ public class GovStaffRoleServiceImpl extends BaseServiceImpl listRolesByRoleKey(String roleKey) { return govStaffRoleDao.listRolesByRoleKey(roleKey); } + + /** + * @param customerId + * @return java.util.List + * @author yinzuomei + * @description 获取当前客户下-工作端角色列表 + * @Date 2021/3/29 15:37 + **/ + @Override + public List queryCustomerGovRoleList(String customerId) { + List resultList=new ArrayList<>(); + GovStaffRoleDTO govStaffRoleDTO=new GovStaffRoleDTO(); + govStaffRoleDTO.setCustomerId(customerId); + List roleList = this.getGovStaffRoleList(govStaffRoleDTO); + roleList.forEach(role->{ + RoleInfoResultDTO resultDTO=new RoleInfoResultDTO(); + resultDTO.setFullTimeOnly(role.getFullTimeOnly()); + resultDTO.setRoleId(role.getId()); + resultDTO.setRoleName(role.getRoleName()); + resultDTO.setRoleKey(role.getRoleKey()); + resultList.add(resultDTO); + }); + return resultList; + } } \ No newline at end of file