diff --git a/epmet-commons/epmet-commons-mybatis/pom.xml b/epmet-commons/epmet-commons-mybatis/pom.xml index 502ef21e81..db396c4042 100644 --- a/epmet-commons/epmet-commons-mybatis/pom.xml +++ b/epmet-commons/epmet-commons-mybatis/pom.xml @@ -13,7 +13,7 @@ jar - 3.2.0 + 3.4.2 1.1.14 4.0 11.2.0.3 diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/config/MybatisPlusConfig.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/config/MybatisPlusConfig.java index 4eef291b8b..8ef978f3c3 100644 --- a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/config/MybatisPlusConfig.java +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/config/MybatisPlusConfig.java @@ -8,7 +8,9 @@ package com.epmet.commons.mybatis.config; -import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; +import com.baomidou.mybatisplus.annotation.DbType; +import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; +import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; import com.epmet.commons.mybatis.interceptor.DataFilterInterceptor; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -37,8 +39,10 @@ public class MybatisPlusConfig { */ @Bean @Order(0) - public PaginationInterceptor paginationInterceptor() { - return new PaginationInterceptor(); + public MybatisPlusInterceptor mybatisPlusInterceptor() { + MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); + interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); + return interceptor; } } diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/entity/BaseEpmetEntity.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/entity/BaseEpmetEntity.java index 9a70d44c39..52071d79e2 100644 --- a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/entity/BaseEpmetEntity.java +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/entity/BaseEpmetEntity.java @@ -26,7 +26,7 @@ public abstract class BaseEpmetEntity implements Serializable { /** * id */ - @TableId(type = IdType.UUID) + @TableId(type = IdType.ASSIGN_ID) private String id; /** diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/service/impl/BaseServiceImpl.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/service/impl/BaseServiceImpl.java index 445f5a6e40..8d7327cfa0 100644 --- a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/service/impl/BaseServiceImpl.java +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/service/impl/BaseServiceImpl.java @@ -57,7 +57,7 @@ public abstract class BaseServiceImpl, T> implements Bas Page page = initPage(params); //默认排序 - if (StringUtils.isNotEmpty(defaultOrderField)) { + if (StringUtils.isNotBlank(defaultOrderField)) { if (isAsc) { page.addOrder(OrderItem.asc(defaultOrderField)); } else { @@ -111,7 +111,7 @@ public abstract class BaseServiceImpl, T> implements Bas String order = (String) params.get(Constant.ORDER); //前端字段排序 - if (StringUtils.isNotEmpty(orderField) && StringUtils.isNotEmpty(order)) { + if (StringUtils.isNotBlank(orderField) && StringUtils.isNotBlank(order)) { if (Constant.ASC.equalsIgnoreCase(order)) { return page.addOrder(OrderItem.asc(orderField)); } else { @@ -135,7 +135,7 @@ public abstract class BaseServiceImpl, T> implements Bas protected Map paramsToLike(Map params, String... likes) { for (String like : likes) { String val = (String) params.get(like); - if (StringUtils.isNotEmpty(val)) { + if (StringUtils.isNotBlank(val)) { params.put(like, "%" + val + "%"); } else { params.put(like, null); @@ -294,12 +294,12 @@ public abstract class BaseServiceImpl, T> implements Bas @Override public boolean deleteById(Serializable id) { - return SqlHelper.delBool(baseDao.deleteById(id)); + return SqlHelper.retBool(baseDao.deleteById(id)); } @Override public boolean deleteBatchIds(Collection idList) { - return SqlHelper.delBool(baseDao.deleteBatchIds(idList)); + return SqlHelper.retBool(baseDao.deleteBatchIds(idList)); } @Transactional(rollbackFor = Exception.class) @@ -311,7 +311,7 @@ public abstract class BaseServiceImpl, T> implements Bas Assert.notNull(tableInfo, "error: can not execute. because can not find cache of TableInfo for entity!"); String keyProperty = tableInfo.getKeyProperty(); Assert.notEmpty(keyProperty, "error: can not execute. because can not find column for id from entity!"); - Object idVal = ReflectionKit.getMethodValue(cls, entity, tableInfo.getKeyProperty()); + Object idVal = ReflectionKit.getFieldValue( entity, tableInfo.getKeyProperty()); return StringUtils.checkValNull(idVal) || Objects.isNull(selectById((Serializable) idVal)) ? insert(entity) : updateById(entity); } return false; @@ -335,7 +335,7 @@ public abstract class BaseServiceImpl, T> implements Bas try (SqlSession batchSqlSession = sqlSessionBatch()) { int i = 0; for (T entity : entityList) { - Object idVal = ReflectionKit.getMethodValue(cls, entity, keyProperty); + Object idVal = ReflectionKit.getFieldValue(entity, keyProperty); if (StringUtils.checkValNull(idVal) || Objects.isNull(selectById((Serializable) idVal))) { batchSqlSession.insert(sqlStatement(SqlMethod.INSERT_ONE), entity); } else { diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java index 9ba8e7a96a..2fe5b49d9a 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java @@ -47,6 +47,7 @@ public interface NumConstant { BigDecimal ONE_HUNDRED_DECIMAL = new BigDecimal(100); BigDecimal ZERO_DECIMAL = new BigDecimal(0); int ONE_THOUSAND = 1000; + int TEN_THOUSAND = 10000; int MAX = 99999999; int EIGHTY_EIGHT = 88; int EIGHTY = 80; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/PageFormDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/PageFormDTO.java index 9922a2fb6e..fe22284567 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/PageFormDTO.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/PageFormDTO.java @@ -4,6 +4,7 @@ import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import lombok.Data; import javax.validation.constraints.NotNull; +import java.io.Serializable; /** * 分页通用类 @@ -12,7 +13,9 @@ import javax.validation.constraints.NotNull; * @date 2020/11/20 17:02 */ @Data -public class PageFormDTO { +public class PageFormDTO implements Serializable { + private static final long serialVersionUID = -4145040961294503137L; + public interface AddUserInternalGroup { } diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index 35b4f1802b..c8c245b15a 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/epmet-gateway/src/main/resources/bootstrap.yml @@ -486,7 +486,8 @@ epmet: - /data/aggregator/** - /gov/voice/** - /resi/voice/** - - /epmet/point/** + - /point/** + - /heart/** # 内部认证url白名单(在白名单中的,就不会再校验登录了) internalAuthUrlsWhiteList: @@ -523,6 +524,7 @@ epmet: - /third/private-epmet/push-component-access-token - /data/stats/plugins/ofs/** - /data/stats/plugins/workrecord/** + - /epmetuser/staffrole/getGridStaffList #py获取网格员 网格长 # 对外开放接口认证白名单 diff --git a/epmet-module/data-aggregator/data-aggregator-client/pom.xml b/epmet-module/data-aggregator/data-aggregator-client/pom.xml index 7f6f4cd2ff..6248b5536f 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/pom.xml +++ b/epmet-module/data-aggregator/data-aggregator-client/pom.xml @@ -20,9 +20,8 @@ com.baomidou mybatis-plus-annotation - 3.2.0 - compile + 3.4.2 - \ No newline at end of file + diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java index 6011344b15..5ea1b47061 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java @@ -177,6 +177,24 @@ public class GovOrgController { return new Result().ok(govOrgService.staffList(formDTO)); } + /** + * @Param formDTO + * @Description 获取当前组织下的【组织添加的】工作人员 组织/部门/网格下人员列表 + * @author sun + */ + @PostMapping("currentOrgStafflist") + public Result getCurrentOrgStafflist(@LoginUser TokenDto tokenDto, @RequestBody OrgStaffListFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, OrgStaffListFormDTO.OrgStaff.class); + if(!"agency".equals(formDTO.getOrgType())&&!"dept".equals(formDTO.getOrgType())&&!"grid".equals(formDTO.getOrgType())){ + throw new RenException("参数类型错误"); + } + //formDTO.setCustomerId("45687aa479955f9d06204d415238f7cc"); + //formDTO.setStaffId("73ae6280e46a6653a5605d51d5462725"); + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setStaffId(tokenDto.getUserId()); + return new Result().ok(govOrgService.getCurrentOrgStafflist(formDTO)); + } + /** * @Param formDTO * @Description 【通讯录】人员详情v2 diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/CustomerStaffDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/CustomerStaffDao.java index a046a17f9c..de989d76e6 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/CustomerStaffDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/CustomerStaffDao.java @@ -64,11 +64,11 @@ public interface CustomerStaffDao extends BaseDao { * @Description 分页查询工作人员基础信息、角色信息【组织人员单位领导角色人员在前;部门人员部门领导角色人员在前;网格人员网格长角色人员在前】 * @author sun */ - List selectStaffList(@Param("staffIds") LinkedList staffIds); + List selectStaffList(@Param("staffIds") List staffIds); /** * @Description 查询工作人员基础信息 * @author sun */ CustomerStaffDTO selectByStaffId(@Param("staffId") String staffId); -} \ No newline at end of file +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/UserBaseInfoDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/UserBaseInfoDao.java index e79c563c0a..4d77b2b91e 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/UserBaseInfoDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/UserBaseInfoDao.java @@ -55,5 +55,5 @@ public interface UserBaseInfoDao extends BaseDao { * @Description 查询userId的身份证号在小程序用户中存在的多个userId值 * @author sun */ - List getUserBaseList(@Param("userId") String userId, @Param("customerId") String customerId); + List getUserBaseList(@Param("customerId") String customerId, @Param("userId") String userId, @Param("idCard") String idCard); } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java index a1509063c1..9106a81317 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java @@ -175,4 +175,6 @@ public interface EpmetUserService { * @return */ List listStaffsByIds(List userIdsPart); + + List selectStaffList(List staffIds); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java index 7f9809a052..94c1adcfd4 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java @@ -27,11 +27,8 @@ import com.epmet.dataaggre.dto.govorg.result.GridStaffResultDTO; import com.epmet.dataaggre.dto.govorg.result.StaffOrgNameResultDTO; import com.epmet.dataaggre.dto.govorg.result.StaffOrgRelationResultDTO; import com.epmet.dataaggre.dto.govproject.result.ProjectAnalysisResultDTO; -import com.epmet.dataaggre.entity.epmetuser.CustomerStaffEntity; -import com.epmet.dataaggre.entity.epmetuser.GovStaffRoleEntity; -import com.epmet.dataaggre.entity.epmetuser.ResiUserBadgeEntity; +import com.epmet.dataaggre.entity.epmetuser.*; import com.epmet.dataaggre.service.datastats.DataStatsService; -import com.epmet.dataaggre.entity.epmetuser.StaffRoleEntity; import com.epmet.dataaggre.service.epmetuser.EpmetUserService; import com.epmet.dataaggre.service.epmetuser.StaffPatrolDetailService; import com.epmet.dataaggre.service.epmetuser.StaffPatrolRecordService; @@ -714,7 +711,13 @@ public class EpmetUserServiceImpl implements EpmetUserService { */ @Override public List getUserBaseList(String userId, String customerId) { - return userBaseInfoDao.getUserBaseList(userId, customerId); + List resultList = new ArrayList<>(); + List list = userBaseInfoDao.getUserBaseList(customerId, userId, null); + if (!CollectionUtils.isEmpty(list) && StringUtils.isNotBlank(list.get(0).getIdNum())) { + return userBaseInfoDao.getUserBaseList(customerId, null, list.get(0).getIdNum()); + } + resultList.addAll(list); + return resultList; } /** @@ -742,4 +745,9 @@ public class EpmetUserServiceImpl implements EpmetUserService { return customerStaffDao.selectList(query); } + + @Override + public List selectStaffList(List staffIds) { + return customerStaffDao.selectStaffList(staffIds); + } } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java index 77c8c33d0f..b2101a6798 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java @@ -11,7 +11,6 @@ import com.epmet.dataaggre.dto.govorg.form.SubOrgFormDTO; import com.epmet.dataaggre.dto.govorg.result.*; import com.epmet.dataaggre.dto.resigroup.result.OrgInfoCommonDTO; import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity; -import com.epmet.dataaggre.entity.govorg.CustomerGridEntity; import java.util.List; @@ -93,6 +92,7 @@ public interface GovOrgService { * @author sun */ OrgStaffListResultDTO staffList(OrgStaffListFormDTO formDTO); + OrgStaffListResultDTO getCurrentOrgStafflist(OrgStaffListFormDTO formDTO); /** * @Param formDTO diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java index 23866c207c..41e390a1c7 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java @@ -416,6 +416,41 @@ public class GovOrgServiceImpl implements GovOrgService { return resultDTO; } + /** + * @Param formDTO + * @Description 【通讯录】组织/部门/网格下人员列表 + * @author sun + */ + @Override + public OrgStaffListResultDTO getCurrentOrgStafflist(OrgStaffListFormDTO formDTO) { + OrgStaffListResultDTO resultDTO = new OrgStaffListResultDTO(); + //1.按类型查询组织、部门、网格下所有工作人员Id列表[需要按角色排序 所以这里不能分页] + List staffIds = customerStaffAgencyDao.selectStaffList(formDTO.getOrgId(), formDTO.getOrgType()); + if (org.springframework.util.CollectionUtils.isEmpty(staffIds)) { + return resultDTO; + } + formDTO.setStaffIds(staffIds); + //是否包含自己 + if("0".equals(formDTO.getIncludeMe())){ + staffIds.removeIf(s->s.equals(formDTO.getStaffId())); + } + + //2.分页查询工作人员基础信息、角色信息【组织人员单位领导角色人员在前;部门人员部门领导角色人员在前;网格人员网格长角色人员在前】 + List staffList = epmetUserService.selectStaffList(staffIds); + + //3.查询工作人员注册组织关系信息 + List staffIdList = staffList.stream().map(ListStaffResultDTO::getStaffId).collect(Collectors.toList()); + if (!CollectionUtils.isEmpty(staffIdList)){ + List list = customerAgencyDao.selelctStaffOrg(staffIdList); + staffList.forEach(re -> list.stream().filter(l -> re.getStaffId().equals(l.getStaffId())).forEach(s -> re.setOrgType(s.getOrgType()))); + } + + //3.封装数据并返回 + resultDTO.setStaffCount(staffIds.size()); + resultDTO.setStaffList((null == staffList ? new ArrayList<>() : staffList)); + return resultDTO; + } + /** * @Param formDTO * @Description 【通讯录】人员详情v2 diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/UserBaseInfoDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/UserBaseInfoDao.xml index 6c118e2ce0..9ba9386fb3 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/UserBaseInfoDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/UserBaseInfoDao.xml @@ -41,13 +41,24 @@ \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java index dab2edf301..dde180c1ca 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java @@ -23,6 +23,7 @@ import com.epmet.dto.user.result.MidPatrolDetailResult; import com.epmet.dto.user.result.MidPatrolRecordResult; import com.epmet.feign.impl.DataStatisticalOpenFeignClientFallBackFactory; 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 org.springframework.web.bind.annotation.RequestParam; @@ -353,4 +354,15 @@ public interface DataStatisticalOpenFeignClient { */ @PostMapping("/data/stats/demand/volunteer/daily") Result statsVolunteerDemandServicesDaily(@RequestParam(value = "customer-id", required = false) String customerId); + + /** + * desc: 市北私有化部署需要 支持的任务之一 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author LiuJanJun + * @date 2022/1/18 4:37 下午 + */ + @PostMapping("/data/stats/shibeiICJob/userPointAndProjectStatus/{bizType}") + Result userPointAndProjectStatus(@PathVariable("bizType") String biztype,@RequestBody ExtractOriginFormDTO formDTO); } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java index 56fea9c03f..ad48c01c34 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java @@ -339,4 +339,9 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp public Result statsVolunteerDemandServicesDaily(String customerId) { return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "statsVolunteerDemandServicesDaily", customerId); } + + @Override + public Result userPointAndProjectStatus(String biztype,ExtractOriginFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "userPointAndProjectStatus", biztype,formDTO); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ShiBeiICJobController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ShiBeiICJobController.java new file mode 100644 index 0000000000..d4f114c9ac --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ShiBeiICJobController.java @@ -0,0 +1,106 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.enums.BizTypeEnum; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.StatsFormDTO; +import com.epmet.dto.extract.form.ExtractOriginFormDTO; +import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO; +import com.epmet.service.StatsProjectService; +import com.epmet.service.evaluationindex.extract.toscreen.ScreenGrassrootsGovernDataAbsorptionService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; + +/** + * desc:市北数字社区 单独部署 job入口 【用户积分排名及项目状态数据】 + */ +@RequestMapping("shibeiICJob") +@RestController +@Slf4j +public class ShiBeiICJobController { + @Autowired + private ScreenGrassrootsGovernDataAbsorptionService screenGrassrootsGovernDataAbsorptionService; + @Autowired + private StatsProjectService statsProjectService; + @Autowired + private RedisUtils redisUtils; + + @PostMapping("userPointAndProjectStatus/{bizType}") + public Result userPointAndProjectStatus(@PathVariable("bizType") String bizType, @RequestBody ExtractOriginFormDTO formDTO) { + if (StringUtils.isBlank(formDTO.getCustomerId())){ + return new Result().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"参数错误cid不能为空"); + } + long start = System.currentTimeMillis(); + Set result = new LinkedHashSet<>(); + if (StringUtils.isNotBlank(formDTO.getStartDate()) && StringUtils.isNotBlank(formDTO.getEndDate())) { + List daysBetween = DateUtils.getDaysBetween(formDTO.getStartDate(), formDTO.getEndDate()); + daysBetween.forEach(d -> { + executeMethod(bizType, formDTO.getCustomerId(), d); + result.add(d); + redisUtils.hSet(RedisKeys.getBackDoorbizExcuteResult("userPointAndProjectStatus-"+bizType), formDTO.getCustomerId(), result, 3 * 24 * 60 * 60L); + }); + } else { + if (StringUtils.isBlank(formDTO.getDateId())){ + formDTO.setDateId(DateUtils.getBeforeNDay(NumConstant.ONE)); + } + executeMethod(bizType, formDTO.getCustomerId(), formDTO.getDateId()); + result.add(formDTO.getDateId()); + redisUtils.hSet(RedisKeys.getBackDoorbizExcuteResult("userPointAndProjectStatus-"+bizType), formDTO.getCustomerId(), result, 3 * 24 * 60 * 60L); + } + long end = System.currentTimeMillis(); + long l = (end - start) / 1000; + return new Result().ok("userPointAndProjectStatus耗时-"+bizType + l + "s"); + } + + private void executeMethod(String bizType, String customerId, String d) { + if (bizType.equals(BizTypeEnum.USER.getType())){ + this.extractUserPointData(customerId, d); + } + if (bizType.equals(BizTypeEnum.PROJECT.getType())) { + this.agencyProjectStats(customerId, d); + } + } + + /** + * @Author sun + * @Description 数据-项目-机关日(月)统计 + **/ + private void agencyProjectStats(String customerId, String dateId) { + try { + if (StringUtils.isNotBlank(dateId)) { + dateId = DateUtils.format(DateUtils.parseDate(dateId, DateUtils.DATE_PATTERN_YYYYMMDD)); + } + StatsFormDTO formDTO = new StatsFormDTO(); + formDTO.setCustomerId(customerId); + formDTO.setDate(dateId); + + statsProjectService.agencyProjectStats(formDTO); + } catch (Exception e) { + log.error("市北-项目状态数据写入失败,参数为:{}" + customerId + StrConstant.HYPHEN + dateId, e); + } + new Result(); + } + + private void extractUserPointData(String customerId, String dateId) { + try { + //基层治理 - 热心市民 screen_party_user_rank_data + ScreenCentralZoneDataFormDTO param = new ScreenCentralZoneDataFormDTO(); + param.setCustomerId(customerId); + param.setDateId(dateId); + screenGrassrootsGovernDataAbsorptionService.userScoreDataHub(param); + } catch (Exception e) { + log.error("市北-热心市民/党员得分数据写入失败,参数为:{}" + customerId + StrConstant.HYPHEN + dateId, e); + } + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/crm/CustomerEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/crm/CustomerEntity.java index c6dc6dba64..af4cb6844e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/crm/CustomerEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/crm/CustomerEntity.java @@ -17,9 +17,10 @@ package com.epmet.entity.crm; +import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; - import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; @@ -27,7 +28,7 @@ import lombok.EqualsAndHashCode; import java.util.Date; /** - * 客户表 + * 客户表 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-03-11 @@ -39,6 +40,11 @@ public class CustomerEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; + /** + * id + */ + @TableId(type = IdType.ASSIGN_UUID) + private String id; /** * 客户名称 */ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPartyUserRankDataServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPartyUserRankDataServiceImpl.java index a419a53ee5..ed32077153 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPartyUserRankDataServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPartyUserRankDataServiceImpl.java @@ -25,6 +25,7 @@ import com.epmet.constant.DataSourceConstant; import com.epmet.dao.evaluationindex.screen.ScreenPartyUserRankDataDao; import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity; import com.epmet.service.evaluationindex.screen.ScreenPartyUserRankDataService; +import org.apache.commons.collections4.ListUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -61,7 +62,7 @@ public class ScreenPartyUserRankDataServiceImpl extends BaseServiceImpl NumConstant.ZERO); - baseDao.insertBatch(dataList); + ListUtils.partition(dataList,NumConstant.ONE_THOUSAND).forEach(part->baseDao.insertBatch(part)); } } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java index bacc003c5c..eb849391a9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java @@ -1,6 +1,5 @@ package com.epmet.service.impl; -import cn.hutool.core.collection.CollectionUtil; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.ProjectConstant; @@ -80,8 +79,8 @@ public class StatsProjectServiceImpl implements StatsProjectService { if (null != formDTO && StringUtils.isNotBlank(formDTO.getCustomerId())) { customerAgencyStats(formDTO.getCustomerId(), date); } else { - int pageNo = 1; - int pageSize = 100; + int pageNo = NumConstant.ONE; + int pageSize = NumConstant.ONE_HUNDRED; List customerIdList = null; do { customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize); @@ -185,10 +184,10 @@ public class StatsProjectServiceImpl implements StatsProjectService { projectEntity.setCustomerId(customerId); projectEntity.setCreatedTime(date); projectEntity.setStatus(ProjectConstant.CLOSED); - projectEntity.setPageSize(NumConstant.ONE_THOUSAND); + projectEntity.setPageSize(NumConstant.TEN_THOUSAND); int pageNo = NumConstant.ONE; - int size = NumConstant.ZERO; - List processList = new ArrayList<>(); + int size; + List processList = null; do { //1.一千条一循环查询节点数据,封装每个组织对应数据 projectEntity.setPageNo(pageNo); @@ -278,7 +277,7 @@ public class StatsProjectServiceImpl implements StatsProjectService { } mapList.put(agency.getId(), entity); } - } while (size == NumConstant.ONE_THOUSAND); + } while (size == projectEntity.getPageSize()); //二、再分页查询项目表数据,封装每个组织的已结案已解决总数、已结案未解决总数;日增量中已结案已解决总数、已结案未解决总数 int num = NumConstant.ONE; @@ -374,7 +373,7 @@ public class StatsProjectServiceImpl implements StatsProjectService { } mapList.put(agency.getId(), entity); } - } while (size == NumConstant.ONE_THOUSAND); + } while (size == projectEntity.getPageSize()); List projectDateEntityList = new ArrayList<>(mapList.values()); //三、批量保存数据,先删后增 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java index 9abd714221..c9ad658627 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java @@ -81,6 +81,7 @@ public class CustomerGridServiceImpl extends BaseServiceImpl NumConstant.ZERO) { // 名称唯一 throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), String.format("【%s】已存在", formDTO.getCategoryName()), "分类名称已存在"); @@ -105,6 +106,7 @@ public class IcResiDemandDictServiceImpl extends BaseServiceImpl NumConstant.ZERO) { + if (checkCategoryName(formDTO.getCustomerId(), formDTO.getCategoryName(), formDTO.getLevel(), origin.getParentCode(), formDTO.getCategoryId()) > NumConstant.ZERO) { // 名称唯一 throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), String.format("【%s】已存在", formDTO.getCategoryName()), "分类名称已存在"); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcResiDemandDictDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcResiDemandDictDao.xml index 36aa408316..0d7a8dc0a7 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcResiDemandDictDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcResiDemandDictDao.xml @@ -192,9 +192,7 @@ CONVERT ( m.CATEGORY_CODE, UNSIGNED )) AS maxFirstCategoryCode FROM ic_resi_demand_dict m - WHERE - m.DEL_FLAG = '0' - AND m.CUSTOMER_ID = #{customerId} + WHERE m.CUSTOMER_ID = #{customerId} AND m.`LEVEL` = #{level} and m.parent_code=#{parentCode} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/ic/IcPrivateDeploySupportProjectTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/ic/IcPrivateDeploySupportProjectTask.java new file mode 100644 index 0000000000..bf3a1b3ac3 --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/ic/IcPrivateDeploySupportProjectTask.java @@ -0,0 +1,33 @@ +package com.epmet.task.ic; + + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.enums.BizTypeEnum; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.extract.form.ExtractOriginFormDTO; +import com.epmet.feign.DataStatisticalOpenFeignClient; +import com.epmet.task.ITask; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * desc:数字社区私有化部署 任务之一还有【autoEvaluateDemandTask,statsDemandTask,dailyStatisticalVoteTask,IcPrivateDeploySupportUserPointTask】 + */ +@Slf4j +@Component("icPrivateDeploySupportProjectTask") +public class IcPrivateDeploySupportProjectTask implements ITask { + @Autowired + private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient; + + @Override + public void run(String params) { + ExtractOriginFormDTO formDTO = new ExtractOriginFormDTO(); + if (StringUtils.isNotBlank(params)) { + formDTO = JSON.parseObject(params, ExtractOriginFormDTO.class); + } + Result result = dataStatisticalOpenFeignClient.userPointAndProjectStatus(BizTypeEnum.PROJECT.getType(), formDTO); + log.info("icPrivateDeploySupportProjectTask excute end,param:{},result:{}",params,result); + } +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/ic/IcPrivateDeploySupportUserPointTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/ic/IcPrivateDeploySupportUserPointTask.java new file mode 100644 index 0000000000..3f9b9f2d9d --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/ic/IcPrivateDeploySupportUserPointTask.java @@ -0,0 +1,33 @@ +package com.epmet.task.ic; + + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.enums.BizTypeEnum; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.extract.form.ExtractOriginFormDTO; +import com.epmet.feign.DataStatisticalOpenFeignClient; +import com.epmet.task.ITask; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * desc:数字社区私有化部署 任务之一还有【autoEvaluateDemandTask,statsDemandTask,dailyStatisticalVoteTask,icPrivateDeploySupportProjectTask】 + */ +@Slf4j +@Component("icPrivateDeploySupportUserPointTask") +public class IcPrivateDeploySupportUserPointTask implements ITask { + @Autowired + private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient; + + @Override + public void run(String params) { + ExtractOriginFormDTO formDTO = new ExtractOriginFormDTO(); + if (StringUtils.isNotBlank(params)) { + formDTO = JSON.parseObject(params, ExtractOriginFormDTO.class); + } + Result result = dataStatisticalOpenFeignClient.userPointAndProjectStatus(BizTypeEnum.USER.getType(), formDTO); + log.info("icPrivateDeploySupportUserPointTask excute end,param:{},result:{}",params,result); + } +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerGridStaffResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerGridStaffResultDTO.java new file mode 100644 index 0000000000..b325e80461 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerGridStaffResultDTO.java @@ -0,0 +1,32 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * desc:客户下网格工作人员结果 + * @Author zxc + * @DateTime 2021/6/8 3:23 下午 + * @DESC + */ +@Data +public class CustomerGridStaffResultDTO implements Serializable { + + private static final long serialVersionUID = -5910427385795368242L; + + private String userId; + + private String userName; + + private String mobile; + + private Integer gender; + + private String gridId; + + private String gridName; + + private String agencyId; + +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerStaffGridResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerStaffGridResultDTO.java new file mode 100644 index 0000000000..ece0ebfc73 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerStaffGridResultDTO.java @@ -0,0 +1,32 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author 在网格中的工作人员 + * @dscription + * @date 2020/4/23 16:08 + */ +@Data +public class CustomerStaffGridResultDTO implements Serializable { + private static final long serialVersionUID = 1301415104939403933L; + /** + * 用户ID + */ + private String userId; + /** + * 网格Id + */ + private String gridId; + /** + * 网格名称 + */ + private String gridName; + /** + * 组织Id + */ + private String agencyId; + +} 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 index 9bd7bfb642..022809bc85 100644 --- 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 @@ -462,8 +462,8 @@ public interface GovOrgOpenFeignClient { @PostMapping(value = "/gov/org/house/queryListHouseInfo",consumes = MediaType.APPLICATION_JSON_VALUE) Result> queryListHouseInfo(@RequestBody Set houseIds); - - + + /** * @Description 获取组织下网格选项 * @Param formDTO @@ -549,7 +549,7 @@ public interface GovOrgOpenFeignClient { */ @PostMapping("/gov/org/agency/getsonagencyid") Result> getSonAgencyId(@RequestParam("orgId")String orgId,@RequestParam("type")String type); - + // /icbuilding/{id}?id=demoData /** @@ -576,4 +576,9 @@ public interface GovOrgOpenFeignClient { */ @PostMapping("/gov/org/customeragency/configcustomerareacode") Result configCustomerAreaCode(@RequestBody CustomerAreaCodeFormDTO formDTO); + + @PostMapping("/gov/org/customergrid/getstaffgridlist") + Result> getStaffGridList(@RequestParam("customerId") String customerId, + @RequestParam("orgId") String orgId, + @RequestParam("orgType") String orgType); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java index c3ddd39202..8d1d2ed21e 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java @@ -362,11 +362,16 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient { /** * 运营端-客户管理,修改客户信息,调用gov-org服务,修改组织区划开关,修改根组织areaCode入参。 * - * @param areaCodeFormDTO + * @param formDTO * @return */ @Override public Result configCustomerAreaCode(CustomerAreaCodeFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "configCustomerAreaCode", formDTO); } + + @Override + public Result> getStaffGridList(String customerId, String orgId, String orgType) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getStaffGridList",customerId, orgId, orgType); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java index 8843d646c5..34628a197f 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java @@ -330,4 +330,17 @@ public class CustomerGridController { return new Result>().ok(customerGridService.gridListByAgencyId(agencyId)); } + /** + * @Description 获取工作人员所在的网格列表 + * @author sun + **/ + @PostMapping("getstaffgridlist") + Result> getStaffGridList(@RequestParam("customerId")String customerId, + @RequestParam("orgId")String orgId, + @RequestParam("orgType")String orgType) { + //tokenDto.setCustomerId("45687aa479955f9d06204d415238f7cc"); + List staffGridList = customerGridService.getStaffGridList(customerId, orgId, orgType); + return new Result>().ok(staffGridList); + } + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java index 3b5e8c794a..7eef403d38 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java @@ -156,8 +156,8 @@ public interface CustomerGridDao extends BaseDao { List selectGridByIds(@Param("gridIdList") List gridIdList); /** - * @Description 查询网格名 不限制是否同步条件 SYNC_FLAG * @param gridIdList + * @Description 查询网格名 不限制是否同步条件 SYNC_FLAG * @author zxc * @date 2022/1/12 9:42 上午 */ @@ -279,15 +279,15 @@ public interface CustomerGridDao extends BaseDao { CustomerGridDTO getGridBaseInfoById(@Param("gridId") String gridId); /** - * @Description 根据网格ID查询pids + * @Description 根据网格ID查询pids * @Param gridId * @author zxc * @date 2021/7/16 9:52 上午 */ - String selectPidsByGridId(@Param("gridId")String gridId); + String selectPidsByGridId(@Param("gridId") String gridId); /** - * @Description 查询网格名字 + * @Description 查询网格名字 * @Param gridId * @author zxc * @date 2021/8/4 4:30 下午 @@ -295,7 +295,7 @@ public interface CustomerGridDao extends BaseDao { String gridName(String gridId); /** - * @Description 查询组织名字 + * @Description 查询组织名字 * @Param orgIds * @author zxc * @date 2021/8/4 6:25 下午 @@ -303,7 +303,7 @@ public interface CustomerGridDao extends BaseDao { List selectOrgNameByType(@Param("orgIds") List orgIds); /** - * @Description 根据人查询所在组织 + * @Description 根据人查询所在组织 * @Param userId * @author zxc * @date 2021/8/5 10:08 上午 @@ -361,7 +361,8 @@ public interface CustomerGridDao extends BaseDao { CustomerGridDTO gridAgencyByGrid(@Param("gridId") String gridId); int updateSubGridAreaCode(@Param("customerId") String customerId, - @Param("agencyId")String agencyId, + @Param("agencyId") String agencyId, @Param("operateUserId") String operateUserId); + List getStaffGridList(@Param("customerId") String customerId, @Param("orgId") String orgId, @Param("orgType") String orgType); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java index 1bc418d8fd..cac10ea123 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java @@ -362,4 +362,16 @@ public interface CustomerGridService extends BaseService { * @Description 查询组织直属网格列表 **/ List gridListByAgencyId(String agencyId); + + /** + * desc: 获取组织及网格下 工作人员网格关系列表 + * + * @param customerId + * @param orgId + * @param orgType + * @return java.util.List + * @author LiuJanJun + * @date 2022/1/17 3:50 下午 + */ + List getStaffGridList(String customerId, String orgId, String orgType); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java index 115a784406..57fc7340fb 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java @@ -42,7 +42,6 @@ import com.epmet.dao.CustomerStaffGridDao; import com.epmet.dto.*; import com.epmet.dto.form.*; import com.epmet.dto.result.*; -import com.epmet.entity.CustomerAgencyEntity; import com.epmet.entity.CustomerGridEntity; import com.epmet.feign.EpmetAdminOpenFeignClient; import com.epmet.feign.EpmetMessageOpenFeignClient; @@ -931,4 +930,9 @@ public class CustomerGridServiceImpl extends BaseServiceImpl getStaffGridList(String customerId, String orgId, String orgType) { + return baseDao.getStaffGridList(customerId,orgId,orgType); + } + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml index ca2e81e89b..a70cf1d9b6 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml @@ -783,5 +783,27 @@ where customer_id=#{customerId} AND pids LIKE concat('%',#{agencyId}, '%' ) + diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ResiEventDao.xml b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ResiEventDao.xml index fb5d8b7d8f..3b8fbaa1cf 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ResiEventDao.xml +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ResiEventDao.xml @@ -242,6 +242,7 @@ re.REPORT_USER_ID = #{epmetUserId} + order by re.CREATED_TIME desc diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/bootstrap.yml b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/bootstrap.yml index b158975c86..49db95eb6d 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/bootstrap.yml +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/bootstrap.yml @@ -112,11 +112,6 @@ hystrix: isolation: thread: timeoutInMilliseconds: 60000 #缺省为1000 - threadpool: - default: - coreSize: 10 - maxQueueSize: 500 - queueSizeRejectionThreshold: 500 ribbon: ReadTimeout: 300000 diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/entity/CustomerEntity.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/entity/CustomerEntity.java index 6e56fbee35..fe23757571 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/entity/CustomerEntity.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/entity/CustomerEntity.java @@ -17,8 +17,9 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; - import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; @@ -26,7 +27,7 @@ import lombok.EqualsAndHashCode; import java.util.Date; /** - * 客户表 + * 客户表 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-03-11 @@ -38,6 +39,12 @@ public class CustomerEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; + /** + * id + */ + @TableId(type = IdType.ASSIGN_UUID) + private String id; + /** * 客户名称 */ diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/SubTableJoinDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/SubTableJoinDTO.java new file mode 100644 index 0000000000..a7b950d891 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/SubTableJoinDTO.java @@ -0,0 +1,13 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + + +@Data +public class SubTableJoinDTO implements Serializable { + private static final long serialVersionUID = 8243764437194993736L; + private String tableName; + private String joinTableSql; +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java index 9cda858533..0b7aed5915 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java @@ -25,7 +25,7 @@ import java.util.Set; * @author yinzuomei@elink-cn.com * @date 2020/6/4 13:16 */ -//@FeignClient(name = ServiceConstant.OPER_CUSTOMIZE_SERVER, fallbackFactory = OperCustomizeOpenFeignClientFallbackFactory.class,url = "http://localhost:8089") +// @FeignClient(name = ServiceConstant.OPER_CUSTOMIZE_SERVER, fallbackFactory = OperCustomizeOpenFeignClientFallbackFactory.class,url = "http://localhost:8089") @FeignClient(name = ServiceConstant.OPER_CUSTOMIZE_SERVER, fallbackFactory = OperCustomizeOpenFeignClientFallbackFactory.class) public interface OperCustomizeOpenFeignClient { @@ -75,7 +75,7 @@ public interface OperCustomizeOpenFeignClient { * @date 2021/11/1 1:07 下午 */ @PostMapping(value = "/oper/customize/icform/querySubTables", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) - Result> querySubTables(@RequestBody CustomerFormQueryDTO queryDTO); + Result> querySubTables(@RequestBody CustomerFormQueryDTO queryDTO); @PostMapping(value = "/oper/customize/icform/queryIcResiSubTables", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) Result> queryIcResiSubTables(@RequestBody CustomerFormQueryDTO queryDTO); diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java index da282124bb..f393370bf9 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java @@ -61,7 +61,7 @@ public class OperCustomizeOpenFeignClientFallback implements OperCustomizeOpenFe } @Override - public Result> querySubTables(CustomerFormQueryDTO formDto) { + public Result> querySubTables(CustomerFormQueryDTO formDto) { return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "querySubTables", formDto); } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormController.java index 8466ceb6a6..cce2730c6f 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormController.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormController.java @@ -133,9 +133,9 @@ public class IcFormController { * @date 2021/11/1 1:25 下午 */ @PostMapping(value = "querySubTables") - Result> querySubTables(@RequestBody CustomerFormQueryDTO formQueryDTO){ + Result> querySubTables(@RequestBody CustomerFormQueryDTO formQueryDTO){ ValidatorUtils.validateEntity(formQueryDTO,CustomerFormQueryDTO.AddUserInternalGroup.class); - return new Result>().ok(icFormItemService.querySubTables(formQueryDTO.getCustomerId(),formQueryDTO.getFormCode())); + return new Result>().ok(icFormItemService.querySubTables(formQueryDTO.getCustomerId(),formQueryDTO.getFormCode())); } @PostMapping(value = "queryIcResiSubTables") diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormItemDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormItemDao.java index a0ad3ad839..d20a49202a 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormItemDao.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormItemDao.java @@ -18,10 +18,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.dto.result.ColumnTableNameResultDTO; -import com.epmet.dto.result.ConditionResultDTO; -import com.epmet.dto.result.IcFormResColumnDTO; -import com.epmet.dto.result.TableHeaderResultDTO; +import com.epmet.dto.result.*; import com.epmet.entity.IcFormItemEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -62,7 +59,7 @@ public interface IcFormItemDao extends BaseDao { * @author yinzuomei * @date 2021/11/1 1:25 下午 */ - List querySubTables(@Param("customerId") String customerId, @Param("formCode")String formCode); + List querySubTables(@Param("customerId") String customerId, @Param("formCode")String formCode); Set queryIcResiSubTables(@Param("customerId") String customerId, @Param("formCode")String formCode); diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcFormItemService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcFormItemService.java index 575e31d6b1..1856656fd1 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcFormItemService.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcFormItemService.java @@ -19,10 +19,7 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.dto.form.CustomerFormQueryDTO; -import com.epmet.dto.result.ColumnTableNameResultDTO; -import com.epmet.dto.result.ConditionResultDTO; -import com.epmet.dto.result.IcFormResColumnDTO; -import com.epmet.dto.result.TableHeaderResultDTO; +import com.epmet.dto.result.*; import com.epmet.entity.IcFormItemEntity; import java.util.List; @@ -49,7 +46,7 @@ public interface IcFormItemService extends BaseService { List queryConditions(String customerId,String formCode); - List querySubTables(String customerId, String formCode); + List querySubTables(String customerId, String formCode); Set queryIcResiSubTables(String customerId, String formCode); diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormItemServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormItemServiceImpl.java index 00c79db52c..9bc06dd941 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormItemServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormItemServiceImpl.java @@ -17,28 +17,19 @@ 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.constant.StrConstant; -import com.epmet.commons.tools.page.PageData; -import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.dao.IcFormItemDao; -import com.epmet.dto.IcFormItemDTO; import com.epmet.dto.form.CustomerFormQueryDTO; -import com.epmet.dto.result.ColumnTableNameResultDTO; -import com.epmet.dto.result.ConditionResultDTO; -import com.epmet.dto.result.IcFormResColumnDTO; -import com.epmet.dto.result.TableHeaderResultDTO; +import com.epmet.dto.result.*; import com.epmet.entity.IcFormItemEntity; import com.epmet.service.IcFormItemService; -import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; /** * 表单项 @@ -100,7 +91,7 @@ public class IcFormItemServiceImpl extends BaseServiceImpl querySubTables(String customerId, String formCode) { + public List querySubTables(String customerId, String formCode) { return baseDao.querySubTables(customerId,formCode); } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormItemDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormItemDao.xml index c9b16fd11c..9af84eaee4 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormItemDao.xml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormItemDao.xml @@ -113,9 +113,10 @@ - select - CONCAT('left join ',temp.TABLE_NAME, ' on ( ic_resi_user.ID=',temp.TABLE_NAME,'.IC_RESI_USER and ',temp.TABLE_NAME,'.del_flag="0" )') as subTables + temp.TABLE_NAME as tableName, + CONCAT('left join ',temp.TABLE_NAME, ' on ( ic_resi_user.ID=',temp.TABLE_NAME,'.IC_RESI_USER and ',temp.TABLE_NAME,'.del_flag="0" )') as joinTableSql from ( SELECT DISTINCT m.TABLE_NAME diff --git a/epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java b/epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java index edc3a74476..1e970897f2 100644 --- a/epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java +++ b/epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java @@ -94,7 +94,7 @@ public class IssueServiceImpl implements IssueService { issueDetailResult.setTopicInfo(topicInfoDTOResult == null ? new TopicInfoDTO() : topicInfoDTOResult); } - /*if("branch".equals(topicInfoDTOResult.getGroupType())){//支部小组话题发起人显示真实姓名 + if (null != topicInfoDTOResult && "branch".equals(topicInfoDTOResult.getGroupType())) {//支部小组话题发起人显示真实姓名 List userIdList = new ArrayList<>(); userIdList.add(issueResult.getUserId()); Result> result = epmetUserOpenFeignClient.queryUserBaseInfo(userIdList); @@ -118,8 +118,8 @@ public class IssueServiceImpl implements IssueService { IssueInitiatorResultDTO initiatorResult = userFeignClient.selectIssueInitiator(initiatorFormDTO).getData(); issueDetailResult.setIssueInitiator(initiatorResult == null ? HallConstat.NULL_CHARACTER_STRING : initiatorResult.getIssueInitiator()); } - }*/ - issueDetailResult.setIssueInitiator(topicInfoDTOResult.getPublishedUser()); + } + //issueDetailResult.setIssueInitiator(topicInfoDTOResult.getPublishedUser()); //判断是否投票 CheckVoteFormDTO formDTO = new CheckVoteFormDTO(); diff --git a/epmet-module/resi-hall/resi-hall-server/src/main/resources/bootstrap.yml b/epmet-module/resi-hall/resi-hall-server/src/main/resources/bootstrap.yml index 4522364f57..33e54c75af 100644 --- a/epmet-module/resi-hall/resi-hall-server/src/main/resources/bootstrap.yml +++ b/epmet-module/resi-hall/resi-hall-server/src/main/resources/bootstrap.yml @@ -69,6 +69,10 @@ hystrix: isolation: thread: timeoutInMilliseconds: 60000 #缺省为1000 + threadpool: + default: + # hystric最大线程个数,默认10,改为20 + maximumSize: 20 ribbon: ReadTimeout: 300000 diff --git a/epmet-module/resi-home/resi-home-server/src/main/resources/bootstrap.yml b/epmet-module/resi-home/resi-home-server/src/main/resources/bootstrap.yml index b0ecb87085..a0fecfc66f 100644 --- a/epmet-module/resi-home/resi-home-server/src/main/resources/bootstrap.yml +++ b/epmet-module/resi-home/resi-home-server/src/main/resources/bootstrap.yml @@ -68,6 +68,10 @@ hystrix: isolation: thread: timeoutInMilliseconds: 60000 #缺省为1000 + threadpool: + default: +# hystric最大线程个数,默认10,改为20 + maximumSize: 20 ribbon: ReadTimeout: 300000 diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/GridStaffFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/GridStaffFormDTO.java new file mode 100644 index 0000000000..f7bc145afe --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/GridStaffFormDTO.java @@ -0,0 +1,56 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.dto.form.PageFormDTO; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import java.util.List; + +/** + * DESC:网格下的工作人员 查询 + * @author liujianjun + */ +@Data +public class GridStaffFormDTO extends PageFormDTO { + + /** + * 客户Id + */ + @NotBlank(message = "客户Id不能为空", groups = {DefaultGroup.class}) + private String customerId; + + /** + * 工作人员Id + */ + private String userId; + + /** + * 工作人员姓名 + */ + private String userName; + + /** + * 手机号 + */ + private String mobile; + + /** + * 角色key + */ + @NotEmpty(message = "角色Key不能为空", groups = {DefaultGroup.class}) + private List roleKeyList; + + /** + * 组织ID + */ + @NotBlank(message = "组织ID不能为空", groups = {DefaultGroup.class}) + private String orgId; + + /** + * 组织类型 agency or grid + */ + @NotBlank(message = "组织类型不能为空", groups = {DefaultGroup.class}) + private String orgType; +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java index 395a5d40b9..fee9ee43ea 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java @@ -256,6 +256,9 @@ public class IcResiUserController { pageFormDTO.setCustomerId(tokenDto.getCustomerId()); pageFormDTO.setStaffId(tokenDto.getUserId()); ValidatorUtils.validateEntity(pageFormDTO, IcResiUserPageFormDTO.AddUserInternalGroup.class); + if(null==pageFormDTO.getConditions()){ + pageFormDTO.setConditions(new ArrayList<>()); + } return new Result>>().ok(icResiUserService.pageResiMap(pageFormDTO)); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java index 998c3eba7e..0cf0bc1760 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java @@ -2,8 +2,10 @@ package com.epmet.controller; import cn.hutool.core.collection.CollectionUtil; import com.epmet.commons.mybatis.entity.DataScope; +import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.dto.GovStaffRoleDTO; import com.epmet.dto.StaffRoleDTO; import com.epmet.dto.form.*; @@ -11,6 +13,7 @@ import com.epmet.dto.result.*; import com.epmet.entity.GovStaffRoleEntity; import com.epmet.service.GovStaffRoleService; import com.epmet.service.StaffRoleService; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -195,4 +198,23 @@ public class StaffRoleController { ValidatorUtils.validateEntity(formDTO,RoleStaffIdFormDTO.AddUserInternalGroup.class); return new Result>().ok(staffRoleService.queryRoleStaffIds(formDTO)); } + + /** + * desc: 根据角色、用户名、手机号 组织获取网格下的工作人员 精确匹配 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result> + * @author LiuJanJun + * @date 2022/1/17 2:26 下午 + */ + @PostMapping("getGridStaffList") + Result> getGridStaffList(@RequestHeader(value = "customerId",required = false) String customerId, @RequestBody GridStaffFormDTO formDTO){ + //tokenDto.setCustomerId("45687aa479955f9d06204d415238f7cc"); + if (StringUtils.isBlank(formDTO.getCustomerId())){ + formDTO.setCustomerId(customerId); + } + ValidatorUtils.validateEntity(formDTO, DefaultGroup.class); + + return new Result>().ok(staffRoleService.getGridStaffList(formDTO)); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java index 31e6591d92..3cfb231881 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java @@ -23,6 +23,7 @@ import com.epmet.dto.StaffRoleDTO; import com.epmet.dto.form.CommonUserFormDTO; import com.epmet.dto.form.CustomerStaffRoleListFormDTO; import com.epmet.dto.form.GetRoleKeyListFormDTO; +import com.epmet.dto.form.GridStaffFormDTO; import com.epmet.dto.result.*; import com.epmet.entity.StaffRoleEntity; import org.apache.ibatis.annotations.Mapper; @@ -169,4 +170,14 @@ public interface StaffRoleDao extends BaseDao { * @Description 【事件】网格员服务电话 **/ List staffRoleList(@Param("staffIds") List staffIds); + + /** + * desc: 条件获取工作人员list + * + * @param formDTO + * @return java.util.List + * @author LiuJanJun + * @date 2022/1/17 2:45 下午 + */ + List getStaffList(GridStaffFormDTO formDTO); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java index e8737d7a0c..2458ba809d 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java @@ -22,15 +22,11 @@ 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.StaffRoleDTO; -import com.epmet.dto.form.CommonUserFormDTO; -import com.epmet.dto.form.CustomerStaffRoleListFormDTO; -import com.epmet.dto.form.RoleStaffIdFormDTO; -import com.epmet.dto.form.RolesUsersListFormDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.entity.StaffRoleEntity; import java.util.List; -import java.util.Map; import java.util.Set; /** @@ -41,66 +37,6 @@ import java.util.Set; */ public interface StaffRoleService extends BaseService { - /** - * 默认分页 - * - * @param params - * @return PageData - * @author generator - * @date 2020-04-22 - */ - PageData page(Map params); - - /** - * 默认查询 - * - * @param params - * @return java.util.List - * @author generator - * @date 2020-04-22 - */ - List list(Map params); - - /** - * 单条查询 - * - * @param id - * @return StaffRoleDTO - * @author generator - * @date 2020-04-22 - */ - StaffRoleDTO get(String id); - - /** - * 默认保存 - * - * @param dto - * @return void - * @author generator - * @date 2020-04-22 - */ - void save(StaffRoleDTO dto); - - /** - * 默认更新 - * - * @param dto - * @return void - * @author generator - * @date 2020-04-22 - */ - void update(StaffRoleDTO dto); - - /** - * 批量删除 - * - * @param ids - * @return void - * @author generator - * @date 2020-04-22 - */ - void delete(String[] ids); - /** * 查询具有某角色的staff列表 * @param roleKey @@ -176,4 +112,14 @@ public interface StaffRoleService extends BaseService { * @date 2021/8/19 11:14 上午 */ Set queryRoleStaffIds(RoleStaffIdFormDTO formDTO); + + /** + * desc: 条件获取 网格工作人员信息 + * + * @param formDTO + * @return com.epmet.commons.tools.page.PageData + * @author LiuJanJun + * @date 2022/1/17 2:37 下午 + */ + PageData getGridStaffList(GridStaffFormDTO formDTO); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java index 70f34f2849..822e7fed4c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java @@ -335,9 +335,29 @@ public class IcResiUserServiceImpl extends BaseServiceImpl resultColumns = resultColumnRes.getData(); + // 查询结果列对应的表: + Set resultColumnTables=resultColumns.stream().map(IcFormResColumnDTO::getTableName).collect(Collectors.toSet()); + // 查询列表展示项需要用到哪些子表 - Result> subTablesRes=operCustomizeOpenFeignClient.querySubTables(queryDTO1); - List subTables =subTablesRes.getData(); + Result> subTablesRes=operCustomizeOpenFeignClient.querySubTables(queryDTO1); + List subTables =subTablesRes.getData(); + log.info("1、所有的子表subTables:"+JSON.toJSONString(subTables,true)); + + //关联哪些子表:查询条件用到的表名+查询的列对应的表 并集去重 + Set whereConditionTables=formDTO.getConditions().stream().map(ResiUserQueryValueDTO::getTableName).collect(Collectors.toSet()); + Set tables=new HashSet<>(); + tables.addAll(whereConditionTables); + tables.addAll(resultColumnTables); + log.info("2、查询条件+查询列对应的tables并集去重:"+ JSON.toJSONString(tables,true)); + //最终关联的子表对应的sql: + List finalSubTables =new ArrayList<>(); + subTables.forEach(subTable->{ + if(tables.contains(subTable.getTableName())){ + finalSubTables.add(subTable.getJoinTableSql()); + } + }); + + PageInfo> pageInfo=new PageInfo<>(); if (null == formDTO.getPageFlag()||formDTO.getPageFlag()) { //分页 @@ -347,7 +367,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl> subTablesRes=operCustomizeOpenFeignClient.querySubTables(queryDTO); + Result> subTablesRes=operCustomizeOpenFeignClient.querySubTables(queryDTO); List subTables=new ArrayList<>(); if(subTablesRes.success()&&CollectionUtils.isNotEmpty(subTablesRes.getData())){ - subTables =subTablesRes.getData(); + subTables =subTablesRes.getData().stream().map(SubTableJoinDTO::getJoinTableSql).collect(Collectors.toList()); } return baseDao.dynamicQuery(customerId,resultTableName,conditions,subTables,currentStaffAgencyId,staffOrgPath); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java index 181b788434..fca7a68aed 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java @@ -17,30 +17,29 @@ package com.epmet.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; +import com.alibaba.fastjson.JSON; import com.epmet.commons.mybatis.entity.DataScope; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; -import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.StaffRoleDao; import com.epmet.dto.StaffRoleDTO; -import com.epmet.dto.form.CommonUserFormDTO; -import com.epmet.dto.form.CustomerStaffRoleListFormDTO; -import com.epmet.dto.form.RoleStaffIdFormDTO; -import com.epmet.dto.form.RolesUsersListFormDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.entity.StaffRoleEntity; +import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.service.StaffRoleService; -import org.apache.commons.lang3.StringUtils; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Collectors; /** * 工作人员-角色关系表 @@ -48,61 +47,12 @@ import java.util.*; * @author generator generator@elink-cn.com * @since v1.0.0 2020-04-22 */ +@Slf4j @Service public class StaffRoleServiceImpl extends BaseServiceImpl implements StaffRoleService { - @Override - public PageData page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, StaffRoleDTO.class); - } - - @Override - public List list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); - - return ConvertUtils.sourceToTarget(entityList, StaffRoleDTO.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 StaffRoleDTO get(String id) { - StaffRoleEntity entity = baseDao.selectById(id); - return ConvertUtils.sourceToTarget(entity, StaffRoleDTO.class); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void save(StaffRoleDTO dto) { - StaffRoleEntity entity = ConvertUtils.sourceToTarget(dto, StaffRoleEntity.class); - insert(entity); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(StaffRoleDTO dto) { - StaffRoleEntity entity = ConvertUtils.sourceToTarget(dto, StaffRoleEntity.class); - updateById(entity); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void delete(String[] ids) { - // 逻辑删除(@TableLogic 注解) - baseDao.deleteBatchIds(Arrays.asList(ids)); - } - + @Autowired + private GovOrgOpenFeignClient govOrgOpenFeignClient; /** * 查询具有某角色的staff列表 * @param roleKey @@ -209,4 +159,47 @@ public class StaffRoleServiceImpl extends BaseServiceImpl getGridStaffList(GridStaffFormDTO formDTO) { + //有这些条件 优先查询用户信息 + List staffList = baseDao.getStaffList(formDTO); + + if (CollectionUtils.isEmpty(staffList)){ + log.warn("getGridStaffList getStaffList return empty,param:{}", JSON.toJSONString(formDTO)); + return new PageData<>(null,NumConstant.ZERO); + } + //继续查询 在网格里的人 + Result> staffGridResult = govOrgOpenFeignClient.getStaffGridList(formDTO.getCustomerId(),formDTO.getOrgId(),formDTO.getOrgType()); + if (staffGridResult == null || !staffGridResult.success() || CollectionUtils.isEmpty(staffGridResult.getData())){ + log.warn("getGridStaffList getStaffGridList return empty,param orgId:{},orgType:{}",formDTO.getOrgId(),formDTO.getOrgType()); + return new PageData<>(null,NumConstant.ZERO); + } + Map> userGridListMap = staffGridResult.getData().stream() + .collect(Collectors.groupingBy(CustomerStaffGridResultDTO::getUserId)); + List result = new ArrayList<>(); + Integer offset = formDTO.getOffset(); + Integer pageSize = formDTO.getPageSize(); + + AtomicInteger count = new AtomicInteger(); + staffList.forEach(staff->{ + List dtoList = userGridListMap.get(staff.getUserId()); + if (dtoList == null){ + return; + } + + dtoList.forEach(grid-> { + CustomerGridStaffResultDTO staffNew = ConvertUtils.sourceToTarget(staff, CustomerGridStaffResultDTO.class); + staffNew.setGridId(grid.getGridId()); + staffNew.setGridName(grid.getGridName()); + staffNew.setAgencyId(grid.getAgencyId()); + if (count.intValue() >= offset && result.size() < pageSize) { + result.add(staffNew); + } + count.getAndIncrement(); + }); + + }); + return new PageData<>(result,count.get()); + } + } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml index edb8b4e4a4..777ef27ee8 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml @@ -271,5 +271,36 @@ ORDER BY sr.staff_id, gsr.role_key +