Browse Source

Merge branches 'dev' and 'wxz_blockchain' of http://git.elinkit.com.cn:7070/r/epmet-cloud into wxz_blockchain

master
wangxianzhang 4 years ago
parent
commit
e5e037db13
  1. 2
      epmet-commons/epmet-commons-mybatis/pom.xml
  2. 10
      epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/config/MybatisPlusConfig.java
  3. 2
      epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/entity/BaseEpmetEntity.java
  4. 14
      epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/service/impl/BaseServiceImpl.java
  5. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java
  6. 5
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/PageFormDTO.java
  7. 4
      epmet-gateway/src/main/resources/bootstrap.yml
  8. 5
      epmet-module/data-aggregator/data-aggregator-client/pom.xml
  9. 18
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java
  10. 4
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/CustomerStaffDao.java
  11. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/UserBaseInfoDao.java
  12. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java
  13. 18
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java
  14. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java
  15. 35
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
  16. 15
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/UserBaseInfoDao.xml
  17. 12
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java
  18. 5
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java
  19. 106
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ShiBeiICJobController.java
  20. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/crm/CustomerEntity.java
  21. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPartyUserRankDataServiceImpl.java
  22. 15
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java
  23. 1
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java
  24. 5
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcResiDemandDictServiceImpl.java
  25. 4
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcResiDemandDictDao.xml
  26. 33
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/ic/IcPrivateDeploySupportProjectTask.java
  27. 33
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/ic/IcPrivateDeploySupportUserPointTask.java
  28. 32
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerGridStaffResultDTO.java
  29. 32
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerStaffGridResultDTO.java
  30. 11
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java
  31. 7
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java
  32. 13
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java
  33. 15
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java
  34. 12
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java
  35. 6
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
  36. 22
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml
  37. 1
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ResiEventDao.xml
  38. 5
      epmet-module/open-data-worker/open-data-worker-server/src/main/resources/bootstrap.yml
  39. 11
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/entity/CustomerEntity.java
  40. 13
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/SubTableJoinDTO.java
  41. 4
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java
  42. 2
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java
  43. 4
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormController.java
  44. 7
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormItemDao.java
  45. 7
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcFormItemService.java
  46. 19
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormItemServiceImpl.java
  47. 5
      epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormItemDao.xml
  48. 6
      epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java
  49. 4
      epmet-module/resi-hall/resi-hall-server/src/main/resources/bootstrap.yml
  50. 4
      epmet-module/resi-home/resi-home-server/src/main/resources/bootstrap.yml
  51. 56
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/GridStaffFormDTO.java
  52. 3
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
  53. 22
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java
  54. 11
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java
  55. 76
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java
  56. 33
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  57. 113
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java
  58. 31
      epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml

2
epmet-commons/epmet-commons-mybatis/pom.xml

@ -13,7 +13,7 @@
<packaging>jar</packaging>
<properties>
<mybatisplus.version>3.2.0</mybatisplus.version>
<mybatisplus.version>3.4.2</mybatisplus.version>
<druid.version>1.1.14</druid.version>
<sqlserver.version>4.0</sqlserver.version>
<oracle.version>11.2.0.3</oracle.version>

10
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;
}
}

2
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;
/**

14
epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/service/impl/BaseServiceImpl.java

@ -57,7 +57,7 @@ public abstract class BaseServiceImpl<M extends BaseMapper<T>, T> implements Bas
Page<T> 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<M extends BaseMapper<T>, 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<M extends BaseMapper<T>, T> implements Bas
protected Map<String, Object> paramsToLike(Map<String, Object> 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<M extends BaseMapper<T>, 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<? extends Serializable> 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<M extends BaseMapper<T>, 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<M extends BaseMapper<T>, 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 {

1
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;

5
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 {
}

4
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获取网格员 网格长
# 对外开放接口认证白名单

5
epmet-module/data-aggregator/data-aggregator-client/pom.xml

@ -20,9 +20,8 @@
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-annotation</artifactId>
<version>3.2.0</version>
<scope>compile</scope>
<version>3.4.2</version>
</dependency>
</dependencies>
</project>
</project>

18
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<OrgStaffListResultDTO>().ok(govOrgService.staffList(formDTO));
}
/**
* @Param formDTO
* @Description 获取当前组织下的组织添加的工作人员 组织/部门/网格下人员列表
* @author sun
*/
@PostMapping("currentOrgStafflist")
public Result<OrgStaffListResultDTO> 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<OrgStaffListResultDTO>().ok(govOrgService.getCurrentOrgStafflist(formDTO));
}
/**
* @Param formDTO
* @Description 通讯录人员详情v2

4
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<CustomerStaffEntity> {
* @Description 分页查询工作人员基础信息角色信息组织人员单位领导角色人员在前部门人员部门领导角色人员在前网格人员网格长角色人员在前
* @author sun
*/
List<ListStaffResultDTO> selectStaffList(@Param("staffIds") LinkedList<String> staffIds);
List<ListStaffResultDTO> selectStaffList(@Param("staffIds") List<String> staffIds);
/**
* @Description 查询工作人员基础信息
* @author sun
*/
CustomerStaffDTO selectByStaffId(@Param("staffId") String staffId);
}
}

2
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<UserBaseInfoEntity> {
* @Description 查询userId的身份证号在小程序用户中存在的多个userId值
* @author sun
*/
List<UserBaseInfoDTO> getUserBaseList(@Param("userId") String userId, @Param("customerId") String customerId);
List<UserBaseInfoDTO> getUserBaseList(@Param("customerId") String customerId, @Param("userId") String userId, @Param("idCard") String idCard);
}

2
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<CustomerStaffEntity> listStaffsByIds(List<String> userIdsPart);
List<ListStaffResultDTO> selectStaffList(List<String> staffIds);
}

18
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<UserBaseInfoDTO> getUserBaseList(String userId, String customerId) {
return userBaseInfoDao.getUserBaseList(userId, customerId);
List<UserBaseInfoDTO> resultList = new ArrayList<>();
List<UserBaseInfoDTO> 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<ListStaffResultDTO> selectStaffList(List<String> staffIds) {
return customerStaffDao.selectStaffList(staffIds);
}
}

2
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

35
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<String> 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<ListStaffResultDTO> staffList = epmetUserService.selectStaffList(staffIds);
//3.查询工作人员注册组织关系信息
List<String> staffIdList = staffList.stream().map(ListStaffResultDTO::getStaffId).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(staffIdList)){
List<StaffOrgNameResultDTO> 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

15
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/UserBaseInfoDao.xml

@ -41,13 +41,24 @@
<select id="getUserBaseList" resultType="com.epmet.dto.UserBaseInfoDTO">
SELECT
*
customer_id,
user_id,
mobile,
real_name,
id_num,
gender,
head_img_url
FROM
user_base_info
WHERE
del_flag = '0'
AND id_num = ( SELECT id_num FROM user_base_info WHERE user_id = #{userId})
AND customer_id = #{customerId}
<if test='userId != "" and userId != null'>
AND user_id = #{userId}
</if>
<if test='idCard != "" and idCard != null'>
AND id_num = #{idCard}
</if>
</select>
</mapper>

12
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);
}

5
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);
}
}

106
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<String> userPointAndProjectStatus(@PathVariable("bizType") String bizType, @RequestBody ExtractOriginFormDTO formDTO) {
if (StringUtils.isBlank(formDTO.getCustomerId())){
return new Result<String>().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"参数错误cid不能为空");
}
long start = System.currentTimeMillis();
Set<String> result = new LinkedHashSet<>();
if (StringUtils.isNotBlank(formDTO.getStartDate()) && StringUtils.isNotBlank(formDTO.getEndDate())) {
List<String> 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<String>().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);
}
}
}

10
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;
/**
* 客户名称
*/

3
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<ScreenPa
do {
affectedRows = baseDao.deletePartyUserRankData(customerId);
} while (affectedRows > NumConstant.ZERO);
baseDao.insertBatch(dataList);
ListUtils.partition(dataList,NumConstant.ONE_THOUSAND).forEach(part->baseDao.insertBatch(part));
}
}
}

15
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<String> 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<ProjectProcessEntity> processList = new ArrayList<>();
int size;
List<ProjectProcessEntity> 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<FactAgencyProjectDailyEntity> projectDateEntityList = new ArrayList<>(mapList.values());
//三、批量保存数据,先删后增

1
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<CustomerGridDao, Cu
* @param gridId
* @return
*/
@Override
public GridInfoDTO queryGridInfoDTO(String gridId){
return baseDao.selectGridInfo(gridId);
}

5
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcResiDemandDictServiceImpl.java

@ -81,6 +81,7 @@ public class IcResiDemandDictServiceImpl extends BaseServiceImpl<IcResiDemandDic
@Override
@Transactional(rollbackFor = Exception.class)
public void addFirstCategory(AddFirstCategoryFormDTO formDTO) {
formDTO.setCategoryName(formDTO.getCategoryName().trim());
if (checkCategoryName(formDTO.getCustomerId(), formDTO.getCategoryName(), NumConstant.ONE, NumConstant.ZERO_STR,null) > 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<IcResiDemandDic
@Transactional(rollbackFor = Exception.class)
@Override
public void addChild(AddCategoryFormDTO formDTO) {
formDTO.setCategoryName(formDTO.getCategoryName().trim());
if(NumConstant.ZERO_STR.equals(formDTO.getParentCategoryCode())){
throw new RenException("添加一级分类,调用接口/heart/icresidemanddict/addfirst");
}
@ -160,8 +162,9 @@ public class IcResiDemandDictServiceImpl extends BaseServiceImpl<IcResiDemandDic
@Override
@Transactional(rollbackFor = Exception.class)
public void update(UpdateFormDTO formDTO) {
formDTO.setCategoryName(formDTO.getCategoryName().trim());
IcResiDemandDictEntity origin = baseDao.selectById(formDTO.getCategoryId());
if (checkCategoryName(formDTO.getCustomerId(), formDTO.getCategoryName(), NumConstant.TWO, origin.getParentCode(), formDTO.getCategoryId()) > 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()), "分类名称已存在");
}

4
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}
</select>

33
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数字社区私有化部署 任务之一还有autoEvaluateDemandTaskstatsDemandTaskdailyStatisticalVoteTask,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);
}
}

33
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数字社区私有化部署 任务之一还有autoEvaluateDemandTaskstatsDemandTaskdailyStatisticalVoteTask,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);
}
}

32
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;
}

32
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;
}

11
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<List<HouseInfoDTO>> queryListHouseInfo(@RequestBody Set<String> houseIds);
/**
* @Description 获取组织下网格选项
* @Param formDTO
@ -549,7 +549,7 @@ public interface GovOrgOpenFeignClient {
*/
@PostMapping("/gov/org/agency/getsonagencyid")
Result<List<SonOrgResultDTO>> 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<List<CustomerStaffGridResultDTO>> getStaffGridList(@RequestParam("customerId") String customerId,
@RequestParam("orgId") String orgId,
@RequestParam("orgType") String orgType);
}

7
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<List<CustomerStaffGridResultDTO>> getStaffGridList(String customerId, String orgId, String orgType) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getStaffGridList",customerId, orgId, orgType);
}
}

13
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<List<AgencyGridList>>().ok(customerGridService.gridListByAgencyId(agencyId));
}
/**
* @Description 获取工作人员所在的网格列表
* @author sun
**/
@PostMapping("getstaffgridlist")
Result<List<CustomerStaffGridResultDTO>> getStaffGridList(@RequestParam("customerId")String customerId,
@RequestParam("orgId")String orgId,
@RequestParam("orgType")String orgType) {
//tokenDto.setCustomerId("45687aa479955f9d06204d415238f7cc");
List<CustomerStaffGridResultDTO> staffGridList = customerGridService.getStaffGridList(customerId, orgId, orgType);
return new Result<List<CustomerStaffGridResultDTO>>().ok(staffGridList);
}
}

15
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java

@ -156,8 +156,8 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
List<AllGridsByUserIdResultDTO> selectGridByIds(@Param("gridIdList") List<String> 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<CustomerGridEntity> {
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<CustomerGridEntity> {
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<CustomerGridEntity> {
List<String> selectOrgNameByType(@Param("orgIds") List<String> orgIds);
/**
* @Description 根据人查询所在组织
* @Description 根据人查询所在组织
* @Param userId
* @author zxc
* @date 2021/8/5 10:08 上午
@ -361,7 +361,8 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
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<CustomerStaffGridResultDTO> getStaffGridList(@Param("customerId") String customerId, @Param("orgId") String orgId, @Param("orgType") String orgType);
}

12
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java

@ -362,4 +362,16 @@ public interface CustomerGridService extends BaseService<CustomerGridEntity> {
* @Description 查询组织直属网格列表
**/
List<AgencyGridList> gridListByAgencyId(String agencyId);
/**
* desc: 获取组织及网格下 工作人员网格关系列表
*
* @param customerId
* @param orgId
* @param orgType
* @return java.util.List<com.epmet.dto.result.CustomerStaffGridResultDTO>
* @author LiuJanJun
* @date 2022/1/17 3:50 下午
*/
List<CustomerStaffGridResultDTO> getStaffGridList(String customerId, String orgId, String orgType);
}

6
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<CustomerGridDao, Cu
return result;
}
@Override
public List<CustomerStaffGridResultDTO> getStaffGridList(String customerId, String orgId, String orgType) {
return baseDao.getStaffGridList(customerId,orgId,orgType);
}
}

22
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}, '%' )
</update>
<select id="getStaffGridList" resultType="com.epmet.dto.result.CustomerStaffGridResultDTO">
SELECT
csg.USER_ID,
csg.GRID_ID,
cg.GRID_NAME,
cg.PID agencyId
from customer_staff_grid csg
INNER JOIN customer_grid cg ON cg.ID = csg.GRID_ID
WHERE cg.DEL_FLAG = '0'
AND csg.DEL_FLAG = '0'
AND cg.CUSTOMER_ID = #{customerId}
<if test="orgType != null and orgType != ''">
<choose>
<when test="orgType == 'grid'">
AND cg.ID = #{orgId}
</when>
<otherwise>
AND cg.PIDS like concat('%', #{orgId},'%')
</otherwise>
</choose>
</if>
</select>
</mapper>

1
epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ResiEventDao.xml

@ -242,6 +242,7 @@
<foreach item="epmetUserId" collection="epmetUserIdList" open="AND (" separator="or" close=")" index="">
re.REPORT_USER_ID = #{epmetUserId}
</foreach>
order by re.CREATED_TIME desc
</select>
<resultMap id="resiEventListResultMap" type="com.epmet.dto.result.ResiEventListResultDTO">

5
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

11
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;
/**
* 客户名称
*/

13
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;
}

4
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<List<String>> querySubTables(@RequestBody CustomerFormQueryDTO queryDTO);
Result<List<SubTableJoinDTO>> querySubTables(@RequestBody CustomerFormQueryDTO queryDTO);
@PostMapping(value = "/oper/customize/icform/queryIcResiSubTables", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
Result<Set<String>> queryIcResiSubTables(@RequestBody CustomerFormQueryDTO queryDTO);

2
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<List<String>> querySubTables(CustomerFormQueryDTO formDto) {
public Result<List<SubTableJoinDTO>> querySubTables(CustomerFormQueryDTO formDto) {
return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "querySubTables", formDto);
}

4
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<List<String>> querySubTables(@RequestBody CustomerFormQueryDTO formQueryDTO){
Result<List<SubTableJoinDTO>> querySubTables(@RequestBody CustomerFormQueryDTO formQueryDTO){
ValidatorUtils.validateEntity(formQueryDTO,CustomerFormQueryDTO.AddUserInternalGroup.class);
return new Result<List<String>>().ok(icFormItemService.querySubTables(formQueryDTO.getCustomerId(),formQueryDTO.getFormCode()));
return new Result<List<SubTableJoinDTO>>().ok(icFormItemService.querySubTables(formQueryDTO.getCustomerId(),formQueryDTO.getFormCode()));
}
@PostMapping(value = "queryIcResiSubTables")

7
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<IcFormItemEntity> {
* @author yinzuomei
* @date 2021/11/1 1:25 下午
*/
List<String> querySubTables(@Param("customerId") String customerId, @Param("formCode")String formCode);
List<SubTableJoinDTO> querySubTables(@Param("customerId") String customerId, @Param("formCode")String formCode);
Set<String> queryIcResiSubTables(@Param("customerId") String customerId, @Param("formCode")String formCode);

7
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<IcFormItemEntity> {
List<IcFormResColumnDTO> queryConditions(String customerId,String formCode);
List<String> querySubTables(String customerId, String formCode);
List<SubTableJoinDTO> querySubTables(String customerId, String formCode);
Set<String> queryIcResiSubTables(String customerId, String formCode);

19
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<IcFormItemDao, IcForm
}
@Override
public List<String> querySubTables(String customerId, String formCode) {
public List<SubTableJoinDTO> querySubTables(String customerId, String formCode) {
return baseDao.querySubTables(customerId,formCode);
}

5
epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormItemDao.xml

@ -113,9 +113,10 @@
</select>
<!-- 构造出所有子表关联语句 -->
<select id="querySubTables" parameterType="map" resultType="java.lang.String">
<select id="querySubTables" parameterType="map" resultType="com.epmet.dto.result.SubTableJoinDTO">
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

6
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<String> userIdList = new ArrayList<>();
userIdList.add(issueResult.getUserId());
Result<List<UserBaseInfoResultDTO>> 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();

4
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

4
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

56
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<String> roleKeyList;
/**
* 组织ID
*/
@NotBlank(message = "组织ID不能为空", groups = {DefaultGroup.class})
private String orgId;
/**
* 组织类型 agency or grid
*/
@NotBlank(message = "组织类型不能为空", groups = {DefaultGroup.class})
private String orgType;
}

3
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<PageData<Map<String, Object>>>().ok(icResiUserService.pageResiMap(pageFormDTO));
}

22
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<Set<String>>().ok(staffRoleService.queryRoleStaffIds(formDTO));
}
/**
* desc: 根据角色用户名手机号 组织获取网格下的工作人员 精确匹配
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<java.util.Set<java.lang.String>>
* @author LiuJanJun
* @date 2022/1/17 2:26 下午
*/
@PostMapping("getGridStaffList")
Result<PageData<CustomerGridStaffResultDTO>> 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<PageData<CustomerGridStaffResultDTO>>().ok(staffRoleService.getGridStaffList(formDTO));
}
}

11
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<StaffRoleEntity> {
* @Description 事件网格员服务电话
**/
List<GridMobileListResultDTO.Role> staffRoleList(@Param("staffIds") List<String> staffIds);
/**
* desc: 条件获取工作人员list
*
* @param formDTO
* @return java.util.List<com.epmet.dto.result.CustomerStaffResultDTO>
* @author LiuJanJun
* @date 2022/1/17 2:45 下午
*/
List<CustomerGridStaffResultDTO> getStaffList(GridStaffFormDTO formDTO);
}

76
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<StaffRoleEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<StaffRoleDTO>
* @author generator
* @date 2020-04-22
*/
PageData<StaffRoleDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<StaffRoleDTO>
* @author generator
* @date 2020-04-22
*/
List<StaffRoleDTO> list(Map<String, Object> 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<StaffRoleEntity> {
* @date 2021/8/19 11:14 上午
*/
Set<String> queryRoleStaffIds(RoleStaffIdFormDTO formDTO);
/**
* desc: 条件获取 网格工作人员信息
*
* @param formDTO
* @return com.epmet.commons.tools.page.PageData<com.epmet.dto.result.CustomerStaffResultDTO>
* @author LiuJanJun
* @date 2022/1/17 2:37 下午
*/
PageData<CustomerGridStaffResultDTO> getGridStaffList(GridStaffFormDTO formDTO);
}

33
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java

@ -335,9 +335,29 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
return new PageData(new ArrayList(), NumConstant.ZERO);
}
List<IcFormResColumnDTO> resultColumns = resultColumnRes.getData();
// 查询结果列对应的表:
Set<String> resultColumnTables=resultColumns.stream().map(IcFormResColumnDTO::getTableName).collect(Collectors.toSet());
// 查询列表展示项需要用到哪些子表
Result<List<String>> subTablesRes=operCustomizeOpenFeignClient.querySubTables(queryDTO1);
List<String> subTables =subTablesRes.getData();
Result<List<SubTableJoinDTO>> subTablesRes=operCustomizeOpenFeignClient.querySubTables(queryDTO1);
List<SubTableJoinDTO> subTables =subTablesRes.getData();
log.info("1、所有的子表subTables:"+JSON.toJSONString(subTables,true));
//关联哪些子表:查询条件用到的表名+查询的列对应的表 并集去重
Set<String> whereConditionTables=formDTO.getConditions().stream().map(ResiUserQueryValueDTO::getTableName).collect(Collectors.toSet());
Set<String> tables=new HashSet<>();
tables.addAll(whereConditionTables);
tables.addAll(resultColumnTables);
log.info("2、查询条件+查询列对应的tables并集去重:"+ JSON.toJSONString(tables,true));
//最终关联的子表对应的sql:
List<String> finalSubTables =new ArrayList<>();
subTables.forEach(subTable->{
if(tables.contains(subTable.getTableName())){
finalSubTables.add(subTable.getJoinTableSql());
}
});
PageInfo<Map<String, Object>> pageInfo=new PageInfo<>();
if (null == formDTO.getPageFlag()||formDTO.getPageFlag()) {
//分页
@ -347,7 +367,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
formDTO.getFormCode(),
formDTO.getConditions(),
resultColumns,
subTables,
finalSubTables,
staffInfoCacheResult.getAgencyId(), finalStaffOrgPath,null
));
}else{
@ -355,7 +375,8 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
formDTO.getFormCode(),
formDTO.getConditions(),
resultColumns,
subTables,staffInfoCacheResult.getAgencyId(),
finalSubTables,
staffInfoCacheResult.getAgencyId(),
staffOrgPath,null);
pageInfo.setTotal(CollectionUtils.isEmpty(list)?NumConstant.ZERO:list.size());
pageInfo.setList(list);
@ -515,10 +536,10 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
queryDTO.setCustomerId(customerId);
queryDTO.setFormCode(formCode);
//所有的子表
Result<List<String>> subTablesRes=operCustomizeOpenFeignClient.querySubTables(queryDTO);
Result<List<SubTableJoinDTO>> subTablesRes=operCustomizeOpenFeignClient.querySubTables(queryDTO);
List<String> 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);
}

113
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<StaffRoleDao, StaffRoleEntity> implements StaffRoleService {
@Override
public PageData<StaffRoleDTO> page(Map<String, Object> params) {
IPage<StaffRoleEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, StaffRoleDTO.class);
}
@Override
public List<StaffRoleDTO> list(Map<String, Object> params) {
List<StaffRoleEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, StaffRoleDTO.class);
}
private QueryWrapper<StaffRoleEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<StaffRoleEntity> 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<StaffRoleDao, StaffRol
return baseDao.selectRoleStaffIds(formDTO.getCustomerId(),formDTO.getRoleIds());
}
@Override
public PageData<CustomerGridStaffResultDTO> getGridStaffList(GridStaffFormDTO formDTO) {
//有这些条件 优先查询用户信息
List<CustomerGridStaffResultDTO> 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<List<CustomerStaffGridResultDTO>> 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<String, List<CustomerStaffGridResultDTO>> userGridListMap = staffGridResult.getData().stream()
.collect(Collectors.groupingBy(CustomerStaffGridResultDTO::getUserId));
List<CustomerGridStaffResultDTO> result = new ArrayList<>();
Integer offset = formDTO.getOffset();
Integer pageSize = formDTO.getPageSize();
AtomicInteger count = new AtomicInteger();
staffList.forEach(staff->{
List<CustomerStaffGridResultDTO> 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());
}
}

31
epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml

@ -271,5 +271,36 @@
</foreach>
ORDER BY sr.staff_id, gsr.role_key
</select>
<select id="getStaffList" resultType="com.epmet.dto.result.CustomerGridStaffResultDTO">
SELECT
DISTINCT
cs.USER_ID,
cs.REAL_NAME userName,
cs.MOBILE,
cs.GENDER
FROM
customer_staff cs
INNER JOIN staff_role sr ON sr.STAFF_ID = cs.USER_ID
INNER JOIN gov_staff_role gsr ON sr.role_id = gsr.id
WHERE 1=1
<if test="userId != null and userId != ''">
AND cs.USER_ID = #{userId}
</if>
<if test="userName != null and userName != ''">
AND cs.REAL_NAME = #{userName}
</if>
<if test="mobile != null and mobile != ''">
AND cs.mobile = #{mobile}
</if>
AND cs.CUSTOMER_ID = #{customerId}
AND gsr.role_key IN
<foreach collection="roleKeyList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
AND cs.DEL_FLAG = '0'
AND sr.del_flag = '0'
AND gsr.del_flag = '0'
ORDER BY cs.CREATED_TIME DESC
</select>
</mapper>

Loading…
Cancel
Save