Browse Source

Merge remote-tracking branch 'origin/dev_ic_diaodong' into dev_ic_diaodong

# Conflicts:
#	epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java
master
wangxianzhang 4 years ago
parent
commit
2aab12f433
  1. 7
      epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.10__add_icuserchangetype_dict.sql
  2. 72
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DateEnum.java
  3. 4
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  4. 110
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/FactIcuserCategoryAnalysisDailyDTO.java
  5. 37
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/IcUserCategoryFormDTO.java
  6. 50
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/IcUserCategoryResultDTO.java
  7. 42
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/IcUserController.java
  8. 10
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/datastats/DataStatsDao.java
  9. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/opercustomize/CustomerFootBarDao.java
  10. 5
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/DataStatsService.java
  11. 19
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java
  12. 7
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java
  13. 63
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java
  14. 9
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercustomize/CustomerFootBarService.java
  15. 14
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercustomize/impl/CustomerFootBarServiceImpl.java
  16. 36
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml
  17. 15
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/opercustomize/CustomerFootBarDao.xml
  18. 1
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/DataSourceConstant.java
  19. 18
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/customize/IcResiCategoryConfigDTO.java
  20. 32
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/IcUserCategoryAnalysisDailyFormDTO.java
  21. 12
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/OrgIcUserTotalDTO.java
  22. 8
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java
  23. 10
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java
  24. 26
      epmet-module/data-statistical/data-statistical-server/pom.xml
  25. 76
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IcController.java
  26. 14
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/customize/IcResiCategoryStatsConfigDao.java
  27. 20
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactIcuserCategoryAnalysisDailyDao.java
  28. 14
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java
  29. 74
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactIcuserCategoryAnalysisDailyEntity.java
  30. 22
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/customize/IcResiCategoryStatsConfigService.java
  31. 40
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/customize/impl/IcResiCategoryStatsConfigServiceImpl.java
  32. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java
  33. 7
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java
  34. 20
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactIcuserCategoryAnalysisDailyService.java
  35. 198
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactIcuserCategoryAnalysisDailyServiceImpl.java
  36. 29
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java
  37. 101
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java
  38. 5
      epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml
  39. 23
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/customize/IcResiCategoryStatsConfigDao.xml
  40. 13
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIcuserCategoryAnalysisDailyDao.xml
  41. 82
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml
  42. 115
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyUnitCompletionDTO.java
  43. 18
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/CompletionFormDTO.java
  44. 40
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/PointRecordFormDTO.java
  45. 44
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/PointRecordDTO.java
  46. 21
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/PointRecordResultDTO.java
  47. 50
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitCompletionController.java
  48. 18
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java
  49. 16
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcPartyUnitCompletionDao.java
  50. 17
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcUserDemandRecDao.java
  51. 71
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcPartyUnitCompletionEntity.java
  52. 46
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyUnitCompletionService.java
  53. 11
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcUserDemandRecService.java
  54. 86
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitCompletionServiceImpl.java
  55. 44
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java
  56. 22
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.9__add_icompletion.sql
  57. 27
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyUnitCompletionDao.xml
  58. 46
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml
  59. 34
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/IcUserCategoryAnalysisTask.java
  60. 7
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseInfoDTO.java
  61. 2
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java
  62. 4
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java
  63. 4
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java
  64. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java
  65. 35
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/redis/IcHouseRedis.java
  66. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java
  67. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
  68. 16
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java
  69. 25
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml
  70. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcUserChangeDetailedDTO.java
  71. 42
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcUsercategoryAnalysisFormDTO.java
  72. 33
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcUsercategoryAnalysisResultDTO.java
  73. 7
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PersonWarnRightListResultDTO.java
  74. 14
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcUserChangeRecordController.java
  75. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java
  76. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcUserChangeRecordDao.java
  77. 5
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcUserChangeDetailedEntity.java
  78. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcUserChangeRecordService.java
  79. 109
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  80. 63
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserChangeRecordServiceImpl.java
  81. 87
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserTransferRecordServiceImpl.java
  82. 96
      epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.23__ic_user_transfer_and_change.sql
  83. 3
      epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.24__alter_change_detailed.sql
  84. 19
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml
  85. 29
      epmet-user/epmet-user-server/src/main/resources/mapper/IcUserChangeRecordDao.xml

7
epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.10__add_icuserchangetype_dict.sql

@ -0,0 +1,7 @@
INSERT INTO `epmet_admin`.`sys_dict_type` (`id`, `dict_type`, `dict_name`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1483355574648180737', 'ic_user_change_type', '人员变动类型', '操作类型名称【add:新增 category:类别 in:迁入 out:迁出】', 17, 0, 0, '1', '2022-01-18 16:28:23', '1', '2022-01-18 16:28:42');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1483355968996642817', 1483355574648180737, '迁出', 'out', '0', '操作类型名称【add:新增 category:类别 in:迁入 out:迁出】', 4, 0, 0, '1', '2022-01-18 16:29:57', '1', '2022-01-18 16:29:57');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1483355899824181249', 1483355574648180737, '迁入', 'in', '0', '操作类型名称【add:新增 category:类别 in:迁入 out:迁出】', 3, 0, 0, '1', '2022-01-18 16:29:41', '1', '2022-01-18 16:29:41');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1483355832321052673', 1483355574648180737, '类别', 'category', '0', '操作类型名称【add:新增 category:类别 in:迁入 out:迁出】', 2, 0, 0, '1', '2022-01-18 16:29:25', '1', '2022-01-18 16:29:25');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1483355752541196290', 1483355574648180737, '新增', 'add', '0', '操作类型名称【add:新增 category:类别 in:迁入 out:迁出】', 1, 0, 0, '1', '2022-01-18 16:29:05', '1', '2022-01-18 16:29:05');

72
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DateEnum.java

@ -0,0 +1,72 @@
package com.epmet.commons.tools.enums;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import java.util.Objects;
/**
* @author Administrator
*/
public enum DateEnum {
/**
* 月份相关枚举
*/
JAN("01", "1月"),
FEB("02", "2月"),
MAR("03", "3月"),
APR("04", "4月"),
MAY("05", "5月"),
JUN("06", "6月"),
JUL("07", "7月"),
AUG("08", "8月"),
SEP("09", "9月"),
OCT("10", "10月"),
NOV("11", "11月"),
DEC("12", "12月"),
/**
* 季度相关枚举
*/
Q1("Q1", "第一季度"),
Q2("Q2", "第二季度"),
Q3("Q3", "第三季度"),
Q4("Q4", "第四季度"),
UN_KNOWN("0", "未知");
private String code;
private String name;
DateEnum(String code, String name) {
this.code = code;
this.name = name;
}
public static String getName(String code) {
DateEnum[] dateEnums = values();
for (DateEnum dateEnum : dateEnums) {
if (Objects.equals(dateEnum.getCode(), code)) {
return dateEnum.getName();
}
}
return EpmetErrorCode.SERVER_ERROR.getMsg();
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

4
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java

@ -636,4 +636,8 @@ public class RedisKeys {
public static String getOrgTreeCacheKey(String agencyId) {
return rootPrefix.concat("org:temp:orgtree").concat(agencyId);
}
public static String getHouseInfoCacheKey(String houseId,String customerId){
return rootPrefix.concat("house:").concat(customerId).concat(":").concat(houseId);
}
}

110
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/FactIcuserCategoryAnalysisDailyDTO.java

@ -0,0 +1,110 @@
package com.epmet.dataaggre.dto.epmetuser;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 人员类别分析
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-01-17
*/
@Data
public class FactIcuserCategoryAnalysisDailyDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键人员类别分析表
*/
private String id;
/**
* 客户id
*/
private String customerId;
/**
* 预警配置ID
*/
private String configId;
/**
* 类别列名对个数据太麻烦了在这个表存一下
*/
private String columnName;
/**
* 当前数据是截止到XXX的yyyyMMdd
*/
private String dateId;
/**
* 网格id或者组织id
*/
private String orgId;
/**
* grid或者agency
*/
private String orgType;
/**
* orgid的上级
*/
private String pid;
/**
* orgid的所有上级
*/
private String pids;
/**
* 当前类别总人数
*/
private Integer total;
/**
* 较上月迁出
*/
private Integer qcIncr;
/**
* 较上月迁入
*/
private Integer qrIncr;
/**
* 删除标识 0.未删除 1.已删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

37
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/IcUserCategoryFormDTO.java

@ -0,0 +1,37 @@
package com.epmet.dataaggre.dto.epmetuser.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 人员类别分析 入参
*/
@Data
public class IcUserCategoryFormDTO implements Serializable {
private static final long serialVersionUID = 2834180692632036316L;
public interface AddUserInternalGroup {
}
public interface AddUserShowGroup extends CustomerClientShowGroup {
}
@NotBlank(message = "请选择查看某个组织或网格", groups = AddUserShowGroup.class)
private String orgId;
@NotBlank(message = "orgType不能为空", groups = AddUserInternalGroup.class)
private String orgType;
@NotBlank(message = "dateId不能为空", groups = AddUserInternalGroup.class)
@Length(min = 8, max = 8, message = "dateId格式:yyyyMMdd", groups = AddUserInternalGroup.class)
private String dateId;
@NotBlank(message = "customerId不能为空", groups = AddUserInternalGroup.class)
private String customerId;
}

50
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/IcUserCategoryResultDTO.java

@ -0,0 +1,50 @@
package com.epmet.dataaggre.dto.epmetuser.result;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.io.Serializable;
/**
* 人员类别分析-返参DTO
*/
@Data
public class IcUserCategoryResultDTO implements Serializable {
private static final long serialVersionUID = -2150403803220667018L;
/**
* 居民类别配置主键
*/
// @JsonIgnore
private String configId;
/**
* 当前类别对应的列名
*/
private String categoryKey;
/**
* 类别名称
*/
private String categoryName;
/**
* 类别图标
*/
private String dataIcon;
/**
* 当前类别下总人数
*/
private Integer total=0;
/**
* 桥上月迁入
*/
private Integer immigration=0;
/**
* 较上月迁出
*/
private Integer emigration=0;
}

42
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/IcUserController.java

@ -0,0 +1,42 @@
package com.epmet.dataaggre.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dataaggre.dto.epmetuser.form.IcUserCategoryFormDTO;
import com.epmet.dataaggre.dto.epmetuser.result.IcUserCategoryResultDTO;
import com.epmet.dataaggre.service.epmetuser.EpmetUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("icuser")
public class IcUserController {
@Autowired
private EpmetUserService epmetUserService;
/**
* 人员类别分析-各类别人数
*
* @param tokenDto
* @param formDTO
* @return
*/
@PostMapping("category-data")
public Result<List<IcUserCategoryResultDTO>> queryIcUserCategoryData(@LoginUser TokenDto tokenDto, @RequestBody IcUserCategoryFormDTO formDTO) {
formDTO.setCustomerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(formDTO, IcUserCategoryFormDTO.AddUserShowGroup.class, IcUserCategoryFormDTO.AddUserInternalGroup.class);
return new Result<List<IcUserCategoryResultDTO>>().ok(epmetUserService.queryIcUserCategoryData(formDTO));
}
}

10
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/datastats/DataStatsDao.java

@ -22,10 +22,10 @@ import com.epmet.dataaggre.dto.datastats.form.CustomerDataManageFormDTO;
import com.epmet.dataaggre.dto.datastats.form.SubAgencyFormDTO;
import com.epmet.dataaggre.dto.datastats.form.SubGridFormDTO;
import com.epmet.dataaggre.dto.datastats.result.*;
import com.epmet.dataaggre.dto.epmetuser.FactIcuserCategoryAnalysisDailyDTO;
import com.epmet.dataaggre.dto.epmetuser.form.GridMemberPatrolListFormDTO;
import com.epmet.dataaggre.dto.epmetuser.result.GridMemberPatrolListResultDTO;
import com.epmet.dataaggre.dto.govproject.form.ProjectTotalFormDTO;
import com.epmet.dataaggre.dto.govproject.result.ProjectMonthIncrResultDTO;
import com.epmet.dataaggre.dto.resigroup.ActCategoryDictDTO;
import com.epmet.dataaggre.dto.resigroup.result.GroupActRankDetailDTO;
import com.epmet.dataaggre.entity.datastats.DimAgencyEntity;
@ -349,4 +349,12 @@ public interface DataStatsDao {
* @author sun
*/
List<FactAgencyProjectMonthResultDTO> getProjectMonthIncr(ProjectTotalFormDTO formDTO);
List<FactIcuserCategoryAnalysisDailyDTO> queryGridIcUserCategoryData(@Param("orgId") String orgId,
@Param("dateId") String dateId,
@Param("configIds") List<String> configIds);
List<FactIcuserCategoryAnalysisDailyDTO> queryAgencyIcUserCategoryData(@Param("gridPids") String gridPids,
@Param("dateId") String dateId,
@Param("configIds") List<String> configIds);
}

2
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/opercustomize/CustomerFootBarDao.java

@ -20,6 +20,7 @@ package com.epmet.dataaggre.dao.opercustomize;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dataaggre.dto.app.result.CustomerFootBarDTO;
import com.epmet.dataaggre.dto.epmetuser.IcFormResColumnDTO;
import com.epmet.dataaggre.dto.epmetuser.result.IcUserCategoryResultDTO;
import com.epmet.dataaggre.entity.opercustomize.CustomerFootBarEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -59,4 +60,5 @@ public interface CustomerFootBarDao extends BaseDao<CustomerFootBarEntity> {
*/
CustomerFootBarEntity selectDefaultIcon(@Param("customerId") String customerId, @Param("appType")String appType, @Param("barKey")String barKey);
List<IcUserCategoryResultDTO> queryCustomerIcResiCategoryStatsConfig(String customerId);
}

5
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/DataStatsService.java

@ -3,6 +3,7 @@ package com.epmet.dataaggre.service.datastats;
import com.epmet.dataaggre.dto.datastats.FactGroupActDailyDTO;
import com.epmet.dataaggre.dto.datastats.form.*;
import com.epmet.dataaggre.dto.datastats.result.*;
import com.epmet.dataaggre.dto.epmetuser.FactIcuserCategoryAnalysisDailyDTO;
import com.epmet.dataaggre.dto.epmetuser.form.GridMemberPatrolListFormDTO;
import com.epmet.dataaggre.dto.epmetuser.result.GridMemberPatrolListResultDTO;
import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO;
@ -279,4 +280,8 @@ public interface DataStatsService {
String startDateID,
String endDateID,
Boolean needCount);
List<FactIcuserCategoryAnalysisDailyDTO> queryGridIcUserCategoryData(String orgId, String dateId, List<String> configIds);
List<FactIcuserCategoryAnalysisDailyDTO> queryAgencyIcUserCategoryData(String gridPids, String dateId, List<String> configIds);
}

19
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java

@ -16,7 +16,8 @@ import com.epmet.dataaggre.dao.datastats.FactGridMemberStatisticsDailyDao;
import com.epmet.dataaggre.dto.datastats.FactGroupActDailyDTO;
import com.epmet.dataaggre.dto.datastats.form.*;
import com.epmet.dataaggre.dto.datastats.result.*;
import com.epmet.dataaggre.dto.epmetuser.form.GridMemberPatrolListFormDTO;
import com.epmet.dataaggre.dto.epmetuser.FactIcuserCategoryAnalysisDailyDTO;
import com.epmet.dataaggre.dto.epmetuser.form.GridMemberPatrolListFormDTO;
import com.epmet.dataaggre.dto.epmetuser.result.GridMemberPatrolListResultDTO;
import com.epmet.dataaggre.dto.epmetuser.result.PatrolDailySumResult;
import com.epmet.dataaggre.dto.evaluationindex.ScreenAgencyOrGridListDTO;
@ -2170,4 +2171,20 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
PageHelper.startPage(pageNo, pageSize, needCount);
return factGridMemberStatisticsDailyDao.listGridMemberDataStatsIncr(pids, gridId, startDateID, endDateID);
}
@Override
public List<FactIcuserCategoryAnalysisDailyDTO> queryGridIcUserCategoryData(String orgId, String dateId, List<String> configIds) {
if(CollectionUtils.isEmpty(configIds)||StringUtils.isBlank(orgId)){
return new ArrayList<>();
}
return dataStatsDao.queryGridIcUserCategoryData(orgId,dateId,configIds);
}
@Override
public List<FactIcuserCategoryAnalysisDailyDTO> queryAgencyIcUserCategoryData(String gridPids, String dateId, List<String> configIds) {
if(CollectionUtils.isEmpty(configIds)||StringUtils.isBlank(gridPids)){
return new ArrayList<>();
}
return dataStatsDao.queryAgencyIcUserCategoryData(gridPids,dateId,configIds);
}
}

7
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java

@ -175,4 +175,11 @@ public interface EpmetUserService {
* @return
*/
List<CustomerStaffEntity> listStaffsByIds(List<String> userIdsPart);
/**
* 人员类别分析-各类别人数
* @param formDTO
* @return
*/
List<IcUserCategoryResultDTO> queryIcUserCategoryData(IcUserCategoryFormDTO formDTO);
}

63
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java

@ -11,9 +11,11 @@ import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.BadgeConstant;
import com.epmet.constant.OrgInfoConstant;
import com.epmet.dataaggre.constant.DataSourceConstant;
import com.epmet.dataaggre.dao.epmetuser.*;
import com.epmet.dataaggre.dto.epmetuser.CustomerStaffDTO;
import com.epmet.dataaggre.dto.epmetuser.FactIcuserCategoryAnalysisDailyDTO;
import com.epmet.dataaggre.dto.epmetuser.StaffPatrolDetailDTO;
import com.epmet.dataaggre.dto.epmetuser.StaffPatrolRecordDTO;
import com.epmet.dataaggre.dto.epmetuser.form.*;
@ -30,18 +32,21 @@ 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.service.datastats.DataStatsService;
import com.epmet.dataaggre.entity.epmetuser.StaffRoleEntity;
import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity;
import com.epmet.dataaggre.service.datastats.DataStatsService;
import com.epmet.dataaggre.service.epmetuser.EpmetUserService;
import com.epmet.dataaggre.service.epmetuser.StaffPatrolDetailService;
import com.epmet.dataaggre.service.epmetuser.StaffPatrolRecordService;
import com.epmet.dataaggre.service.govorg.GovOrgService;
import com.epmet.dataaggre.service.govproject.GovProjectService;
import com.epmet.dataaggre.service.opercustomize.CustomerFootBarService;
import com.epmet.dto.IcResiUserDTO;
import com.epmet.dto.UserBaseInfoDTO;
import com.epmet.dto.result.StaffRoleResultDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -84,6 +89,8 @@ public class EpmetUserServiceImpl implements EpmetUserService {
private GovStaffRoleDao govStaffRoleDao;
@Resource
private IcResiUserDao icResiUserDao;
@Resource
private CustomerFootBarService customerFootBarService;
/**
* @Description 根据UserIds查询
@ -742,4 +749,58 @@ public class EpmetUserServiceImpl implements EpmetUserService {
return customerStaffDao.selectList(query);
}
/**
* 人员类别分析-各类别人数
*
* @param formDTO
* @return
*/
@Override
public List<IcUserCategoryResultDTO> queryIcUserCategoryData(IcUserCategoryFormDTO formDTO) {
// 1、 先查询出居民类别配置(状态为显示)
List<IcUserCategoryResultDTO> resList=customerFootBarService.queryCustomerIcResiCategoryStatsConfig(formDTO.getCustomerId());
if(CollectionUtils.isNotEmpty(resList)){
List<String> configIds=resList.stream().map(IcUserCategoryResultDTO::getConfigId).collect(Collectors.toList());
if(OrgInfoConstant.GRID.equals(formDTO.getOrgType())){
List<FactIcuserCategoryAnalysisDailyDTO> list=dataStatsService.queryGridIcUserCategoryData(formDTO.getOrgId(),formDTO.getDateId(),configIds);
if(CollectionUtils.isNotEmpty(list)){
Map<String, FactIcuserCategoryAnalysisDailyDTO> configMap = list.stream().collect(Collectors.toMap(FactIcuserCategoryAnalysisDailyDTO::getConfigId, m -> m, (k1, k2) -> k1));
resList.forEach(resDto->{
if(MapUtils.isNotEmpty(configMap)&&configMap.containsKey(resDto.getConfigId())){
FactIcuserCategoryAnalysisDailyDTO dailyDTO=configMap.get(resDto.getConfigId());
resDto.setTotal(dailyDTO.getTotal());
resDto.setImmigration(dailyDTO.getQrIncr());
resDto.setEmigration(dailyDTO.getQcIncr());
}
});
}
}else if(OrgInfoConstant.AGENCY.equals(formDTO.getOrgType())){
CustomerAgencyEntity agencyEntity=govOrgService.getAgencyInfo(formDTO.getOrgId());
String gridPids="";
if(NumConstant.ZERO_STR.equals(agencyEntity.getPid())){
// 当前组织是根组织
gridPids=formDTO.getOrgId();
}else {
gridPids=agencyEntity.getPids().concat(StrConstant.COLON).concat(formDTO.getOrgId());
}
List<FactIcuserCategoryAnalysisDailyDTO> list = dataStatsService.queryAgencyIcUserCategoryData(gridPids, formDTO.getDateId(), configIds);
if(CollectionUtils.isNotEmpty(list)){
Map<String, FactIcuserCategoryAnalysisDailyDTO> configMap = list.stream().collect(Collectors.toMap(FactIcuserCategoryAnalysisDailyDTO::getConfigId, m -> m, (k1, k2) -> k1));
resList.forEach(resDto->{
if(MapUtils.isNotEmpty(configMap)&&configMap.containsKey(resDto.getConfigId())){
FactIcuserCategoryAnalysisDailyDTO dailyDTO=configMap.get(resDto.getConfigId());
resDto.setTotal(dailyDTO.getTotal());
resDto.setImmigration(dailyDTO.getQrIncr());
resDto.setEmigration(dailyDTO.getQcIncr());
}
});
}
}
}
return resList;
}
}

9
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercustomize/CustomerFootBarService.java

@ -20,8 +20,11 @@ package com.epmet.dataaggre.service.opercustomize;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.dataaggre.dto.app.form.AppFootBarFormDTO;
import com.epmet.dataaggre.dto.app.result.AppFootBarResultDTO;
import com.epmet.dataaggre.dto.epmetuser.result.IcUserCategoryResultDTO;
import com.epmet.dataaggre.entity.opercustomize.CustomerFootBarEntity;
import java.util.List;
/**
* APP底部菜单栏信息
*
@ -40,4 +43,10 @@ public interface CustomerFootBarService extends BaseService<CustomerFootBarEntit
*/
AppFootBarResultDTO queryAppFootBars(AppFootBarFormDTO footBarFormDTO);
/**
* 查询居民类别配置表ic_resi_category_stats_config
* @param customerId
* @return
*/
List<IcUserCategoryResultDTO> queryCustomerIcResiCategoryStatsConfig(String customerId);
}

14
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercustomize/impl/CustomerFootBarServiceImpl.java

@ -27,7 +27,7 @@ import com.epmet.dataaggre.dao.opercustomize.CustomerFootBarDao;
import com.epmet.dataaggre.dto.app.form.AppFootBarFormDTO;
import com.epmet.dataaggre.dto.app.result.AppFootBarResultDTO;
import com.epmet.dataaggre.dto.app.result.CustomerFootBarDTO;
import com.epmet.dataaggre.dto.epmetuser.IcFormResColumnDTO;
import com.epmet.dataaggre.dto.epmetuser.result.IcUserCategoryResultDTO;
import com.epmet.dataaggre.entity.opercrm.CustomerParameterEntity;
import com.epmet.dataaggre.entity.opercustomize.CustomerFootBarEntity;
import com.epmet.dataaggre.service.opercrm.CustomerParameterService;
@ -39,7 +39,6 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.Set;
/**
@ -114,4 +113,15 @@ public class CustomerFootBarServiceImpl extends BaseServiceImpl<CustomerFootBarD
return resultDTO;
}
/**
* 查询居民类别配置表ic_resi_category_stats_config
*
* @param customerId
* @return
*/
@Override
public List<IcUserCategoryResultDTO> queryCustomerIcResiCategoryStatsConfig(String customerId) {
return baseDao.queryCustomerIcResiCategoryStatsConfig(customerId);
}
}

36
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml

@ -1107,4 +1107,40 @@
ORDER BY month_id ASC
</select>
<select id="queryGridIcUserCategoryData" parameterType="map" resultType="com.epmet.dataaggre.dto.epmetuser.FactIcuserCategoryAnalysisDailyDTO">
SELECT
m.*
FROM
fact_icuser_category_analysis_daily m
WHERE
m.DATE_ID = #{dateId}
AND m.DEL_FLAG = '0'
AND m.ORG_ID = #{orgId}
<if test='null!=configIds and configIds.size()>0'>
<foreach collection="configIds" item="configId" open="AND (" close=")" separator=" OR ">
m.CONFIG_ID = #{configId}
</foreach>
</if>
</select>
<select id="queryAgencyIcUserCategoryData" parameterType="map" resultType="com.epmet.dataaggre.dto.epmetuser.FactIcuserCategoryAnalysisDailyDTO">
SELECT
m.CONFIG_ID,m.COLUMN_NAME,
SUM(m.TOTAL)as TOTAL,
SUM(m.QR_INCR) AS QR_INCR,
SUM(m.QC_INCR) AS QC_INCR
FROM
fact_icuser_category_analysis_daily m
WHERE
m.DATE_ID = #{dateId}
AND m.DEL_FLAG = '0'
AND m.PIDS LIKE concat(#{gridPids},'%')
AND M.ORG_TYPE='grid'
<if test='null!=configIds and configIds.size()>0'>
<foreach collection="configIds" item="configId" open="AND (" close=")" separator=" OR ">
m.CONFIG_ID = #{configId}
</foreach>
</if>
group by m.CONFIG_ID,m.COLUMN_NAME
</select>
</mapper>

15
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/opercustomize/CustomerFootBarDao.xml

@ -39,4 +39,19 @@
AND C.DISPLAY='1'
</select>
<select id="queryCustomerIcResiCategoryStatsConfig" parameterType="java.lang.String" resultType="com.epmet.dataaggre.dto.epmetuser.result.IcUserCategoryResultDTO">
SELECT
m.id AS configId,
m.COLUMN_NAME AS categoryKey,
m.LABEL AS categoryName,
m.DATA_ICON AS dataIcon
FROM
ic_resi_category_stats_config m
WHERE
m.DEL_FLAG = '0'
AND m.CUSTOMER_ID = #{customerId}
AND m.`STATUS`='show'
ORDER BY
m.SORT ASC
</select>
</mapper>

1
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/DataSourceConstant.java

@ -15,4 +15,5 @@ public interface DataSourceConstant {
String PARTY_MEMBER = "partyMember";
String EPMET_HEART="epmetHeart";
String EPMET_POINT = "epmetPoint";
String OPER_CUSTOMIZE="operCustomize";
}

18
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/customize/IcResiCategoryConfigDTO.java

@ -0,0 +1,18 @@
package com.epmet.dto.customize;
import lombok.Data;
import java.io.Serializable;
@Data
public class IcResiCategoryConfigDTO implements Serializable {
private String configId;
/**
* 列名
*/
private String columnName;
private String itemLabel;
}

32
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/IcUserCategoryAnalysisDailyFormDTO.java

@ -0,0 +1,32 @@
package com.epmet.dto.extract.form;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import java.io.Serializable;
/**
* 数字社区-人员类别分析按天计算入参
* 以下参数都可以为空
*/
@Data
public class IcUserCategoryAnalysisDailyFormDTO implements Serializable {
public interface AddUserInternalGroup {
}
private String customerId;
@Length(max = 8, message = "日期格式:yyyyMMdd", groups = AddUserInternalGroup.class)
private String dateId;
/**
* 开始时间
*/
@Length(max = 8, message = "开始日期日期格式:yyyyMMdd", groups = AddUserInternalGroup.class)
private String startDate;
/**
* 结束时间
*/
@Length(max = 8, message = "截止日期格式:yyyyMMdd", groups = AddUserInternalGroup.class)
private String endDate;
}

12
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/OrgIcUserTotalDTO.java

@ -0,0 +1,12 @@
package com.epmet.dto.user.result;
import lombok.Data;
import java.io.Serializable;
@Data
public class OrgIcUserTotalDTO implements Serializable {
private String orgId;
private Integer total;
private String columnName;
}

8
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java

@ -5,10 +5,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.StatsFormDTO;
import com.epmet.dto.basereport.form.EventInfoFormDTO;
import com.epmet.dto.basereport.result.EventInfoResultDTO;
import com.epmet.dto.extract.form.BizDataFormDTO;
import com.epmet.dto.extract.form.ExtractIndexFormDTO;
import com.epmet.dto.extract.form.ExtractOriginFormDTO;
import com.epmet.dto.extract.form.ExtractScreenFormDTO;
import com.epmet.dto.extract.form.*;
import com.epmet.dto.group.form.GroupStatsFormDTO;
import com.epmet.dto.group.form.GroupTotalFormDTO;
import com.epmet.dto.org.form.GridBaseInfoFormDTO;
@ -353,4 +350,7 @@ public interface DataStatisticalOpenFeignClient {
*/
@PostMapping("/data/stats/demand/volunteer/daily")
Result statsVolunteerDemandServicesDaily(@RequestParam(value = "customer-id", required = false) String customerId);
@PostMapping("/data/stats/ic/user/category-analysis-daily")
Result statUserCategoryDaily(@RequestBody IcUserCategoryAnalysisDailyFormDTO formDTO);
}

10
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java

@ -6,10 +6,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.StatsFormDTO;
import com.epmet.dto.basereport.form.EventInfoFormDTO;
import com.epmet.dto.basereport.result.EventInfoResultDTO;
import com.epmet.dto.extract.form.BizDataFormDTO;
import com.epmet.dto.extract.form.ExtractIndexFormDTO;
import com.epmet.dto.extract.form.ExtractOriginFormDTO;
import com.epmet.dto.extract.form.ExtractScreenFormDTO;
import com.epmet.dto.extract.form.*;
import com.epmet.dto.group.form.GroupStatsFormDTO;
import com.epmet.dto.group.form.GroupTotalFormDTO;
import com.epmet.dto.org.form.GridBaseInfoFormDTO;
@ -339,4 +336,9 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp
public Result statsVolunteerDemandServicesDaily(String customerId) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "statsVolunteerDemandServicesDaily", customerId);
}
@Override
public Result statUserCategoryDaily(IcUserCategoryAnalysisDailyFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "statUserCategoryDaily", formDTO);
}
}

26
epmet-module/data-statistical/data-statistical-server/pom.xml

@ -260,6 +260,13 @@
<datasource.druid.epmetPoint.username>epmet_point_user</datasource.druid.epmetPoint.username>
<datasource.druid.epmetPoint.password>EpmEt-db-UsEr</datasource.druid.epmetPoint.password>
<!-- oper_customize-->
<datasource.druid.operCustomize.url>
<![CDATA[jdbc:mysql://192.168.1.140:3306/epmet_oper_customize?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</datasource.druid.operCustomize.url>
<datasource.druid.operCustomize.username>epmet_oper_customize_user</datasource.druid.operCustomize.username>
<datasource.druid.operCustomize.password>EpmEt-db-UsEr</datasource.druid.operCustomize.password>
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>192.168.1.140</spring.redis.host>
@ -382,6 +389,13 @@
<datasource.druid.epmetPoint.username>epmet_point_user</datasource.druid.epmetPoint.username>
<datasource.druid.epmetPoint.password>EpmEt-db-UsEr</datasource.druid.epmetPoint.password>
<!-- oper_customize-->
<datasource.druid.operCustomize.url>
<![CDATA[jdbc:mysql://192.168.1.140:3306/epmet_oper_customize?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</datasource.druid.operCustomize.url>
<datasource.druid.operCustomize.username>epmet_oper_customize_user</datasource.druid.operCustomize.username>
<datasource.druid.operCustomize.password>EpmEt-db-UsEr</datasource.druid.operCustomize.password>
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>192.168.1.140</spring.redis.host>
@ -504,6 +518,12 @@
<datasource.druid.epmetPoint.username>epmet</datasource.druid.epmetPoint.username>
<datasource.druid.epmetPoint.password>elink@833066</datasource.druid.epmetPoint.password>
<datasource.druid.operCustomize.url>
<![CDATA[jdbc:mysql://rm-m5ef9t617j6o5eup7.mysql.rds.aliyuncs.com:3306/epmet_oper_customize?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</datasource.druid.operCustomize.url>
<datasource.druid.operCustomize.username>epmet</datasource.druid.operCustomize.username>
<datasource.druid.operCustomize.password>elink@833066</datasource.druid.operCustomize.password>
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>r-m5eoz5b6tkx09y6bpz.redis.rds.aliyuncs.com</spring.redis.host>
@ -622,6 +642,12 @@
<datasource.druid.epmetPoint.username>epmet_point_user</datasource.druid.epmetPoint.username>
<datasource.druid.epmetPoint.password>EpmEt-db-UsEr</datasource.druid.epmetPoint.password>
<datasource.druid.operCustomize.url>
<![CDATA[jdbc:mysql://rm-m5e3vzs2637224wj9.mysql.rds.aliyuncs.com:3306/epmet_oper_customize?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</datasource.druid.operCustomize.url>
<datasource.druid.operCustomize.username>epmet_oper_customize_user</datasource.druid.operCustomize.username>
<datasource.druid.operCustomize.password>EpmEt-db-UsEr</datasource.druid.operCustomize.password>
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>r-m5ez3n1j0qc3ykq2ut.redis.rds.aliyuncs.com</spring.redis.host>

76
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IcController.java

@ -0,0 +1,76 @@
package com.epmet.controller;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.extract.form.IcUserCategoryAnalysisDailyFormDTO;
import com.epmet.service.stats.DimCustomerService;
import com.epmet.service.stats.FactIcuserCategoryAnalysisDailyService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
/**
* @Description 数字社区相关统计任务可以放这目前只有人员类别分析
* @Author yinzuomei
* @Date 2022/01/17
* @Version 1.0
*/
@RestController
@RequestMapping("ic")
public class IcController {
@Autowired
private FactIcuserCategoryAnalysisDailyService userCategoryAnalysisDailyService;
@Autowired
private DimCustomerService dimCustomerService;
/**
* 数字社区-基础信息-人员类别分析-每个类别的人员总数较上月迁入迁出人数
* 说明安调统计截止到当前dateId的党员总数+30迁入党员+之前的居民在本月内变更为党员身份的-10在本月丢失党员身份的人+迁出的人
* @return
*/
@PostMapping("/user/category-analysis-daily")
public Result statUserCategoryDaily(@RequestBody IcUserCategoryAnalysisDailyFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, IcUserCategoryAnalysisDailyFormDTO.AddUserInternalGroup.class);
List<String> customerIds = new ArrayList<>();
if (StringUtils.isNotBlank(formDTO.getCustomerId())) {
customerIds.add(formDTO.getCustomerId());
} else {
//未指定客户,则查询dim_customer表
customerIds = dimCustomerService.selectCustomerIdPage(NumConstant.ONE, NumConstant.ONE_THOUSAND);
}
if (CollectionUtils.isNotEmpty(customerIds)) {
customerIds.forEach(customerId -> {
if (StringUtils.isNotBlank(formDTO.getStartDate()) && StringUtils.isNotBlank(formDTO.getEndDate())) {
//[a,b]yyyyMMdd
List<String> daysBetween = DateUtils.getDaysBetween(formDTO.getStartDate(), formDTO.getEndDate());
daysBetween.forEach(dateId -> {
//计算网格维度的数据
userCategoryAnalysisDailyService.statUserCategoryGridDaily(customerId, dateId);
});
} else if (StringUtils.isNotBlank(formDTO.getDateId())) {
//计算网格维度的数据
userCategoryAnalysisDailyService.statUserCategoryGridDaily(customerId, formDTO.getDateId());
} else {
//计算网格维度的数据
//当前时间的前一天yyyyMMdd
String dateId = LocalDate.now().minusDays(NumConstant.ONE).toString().replace("-", "");
userCategoryAnalysisDailyService.statUserCategoryGridDaily(customerId, dateId);
}
});
}
return new Result();
}
}

14
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/customize/IcResiCategoryStatsConfigDao.java

@ -0,0 +1,14 @@
package com.epmet.dao.customize;
import com.epmet.dto.customize.IcResiCategoryConfigDTO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface IcResiCategoryStatsConfigDao {
List<IcResiCategoryConfigDTO> queryDataColumn(String customerId);
}

20
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactIcuserCategoryAnalysisDailyDao.java

@ -0,0 +1,20 @@
package com.epmet.dao.stats;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.stats.FactIcuserCategoryAnalysisDailyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 人员类别分析
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-01-17
*/
@Mapper
public interface FactIcuserCategoryAnalysisDailyDao extends BaseDao<FactIcuserCategoryAnalysisDailyEntity> {
int limitDelete(@Param("customerId")String customerId,
@Param("dateId")String dateId,
@Param("orgType")String orgType);
}

14
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java

@ -269,5 +269,19 @@ public interface UserDao {
List<String> filterUserIds(@Param("userIds") List<String> userIds, @Param("roleKey") String roleKey);
List<PatrolRoutineWorkResult> selectRoutineWorkListByDateId(@Param("customerId") String customerId, @Param("dateId") String dateId);
List<OrgIcUserTotalDTO> selectCountForGrid(@Param("customerId") String customerId,
@Param("columnName") String columnName);
OrgIcUserTotalDTO selectCountForAgency(@Param("customerId") String customerId,
@Param("columnName") String columnName,
@Param("agencyId") String agencyId);
List<OrgIcUserTotalDTO> selectGridIcUserCategoryTotal(@Param("customerId")String customerId, @Param("dateId")String dateId);
List<OrgIcUserTotalDTO> selectGridIcUserCategoryIncr(@Param("customerId")String customerId,
@Param("startDate")String startDate,
@Param("endDate")String endDate,
@Param("type")String type);
}

74
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactIcuserCategoryAnalysisDailyEntity.java

@ -0,0 +1,74 @@
package com.epmet.entity.stats;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 人员类别分析
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-01-17
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("fact_icuser_category_analysis_daily")
public class FactIcuserCategoryAnalysisDailyEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户id
*/
private String customerId;
/**
* 预警配置ID
*/
private String configId;
/**
* 类别列名对个数据太麻烦了在这个表存一下
*/
private String columnName;
/**
* 当前数据是截止到XXX的yyyyMMdd
*/
private String dateId;
/**
* 网格id或者组织id
*/
private String orgId;
/**
* grid或者agency
*/
private String orgType;
/**
* orgid的上级
*/
private String pid;
/**
* orgid的所有上级
*/
private String pids;
/**
* 当前类别总人数
*/
private Integer total;
/**
* 较上月迁出
*/
private Integer qcIncr;
/**
* 较上月迁入
*/
private Integer qrIncr;
}

22
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/customize/IcResiCategoryStatsConfigService.java

@ -0,0 +1,22 @@
package com.epmet.service.customize;
import com.epmet.dto.customize.IcResiCategoryConfigDTO;
import java.util.List;
/**
* 居民类别配置表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-11-04
*/
public interface IcResiCategoryStatsConfigService {
/**
* 返回用于数据分析的列名+居民类别配置表的id
* @param customerId
* @return
*/
List<IcResiCategoryConfigDTO> queryDataColumn(String customerId);
}

40
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/customize/impl/IcResiCategoryStatsConfigServiceImpl.java

@ -0,0 +1,40 @@
package com.epmet.service.customize.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.customize.IcResiCategoryStatsConfigDao;
import com.epmet.dto.customize.IcResiCategoryConfigDTO;
import com.epmet.service.customize.IcResiCategoryStatsConfigService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 居民类别配置表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-11-04
*/
@Slf4j
@DataSource(DataSourceConstant.OPER_CUSTOMIZE)
@Service
public class IcResiCategoryStatsConfigServiceImpl implements IcResiCategoryStatsConfigService{
@Autowired
private IcResiCategoryStatsConfigDao baseDao;
/**
* 返回用于数据分析的列名+居民类别配置表的id
*
* @param customerId
* @return
*/
@Override
public List<IcResiCategoryConfigDTO> queryDataColumn(String customerId) {
return baseDao.queryDataColumn(customerId);
}
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java

@ -136,4 +136,6 @@ public interface ScreenCustomerGridService extends BaseService<ScreenCustomerGri
* @return
*/
Date getLastSyncEndTime();
List<ScreenCustomerGridEntity> getByCustomerId(String customerId);
}

7
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java

@ -290,4 +290,11 @@ public class ScreenCustomerGridServiceImpl extends BaseServiceImpl<ScreenCustome
public Date getLastSyncEndTime() {
return dimLastSyncRecordDao.getDimLastSyncEndTime("grid");
}
@Override
public List<ScreenCustomerGridEntity> getByCustomerId(String customerId) {
LambdaQueryWrapper<ScreenCustomerGridEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ScreenCustomerGridEntity::getCustomerId, customerId);
return baseDao.selectList(wrapper);
}
}

20
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactIcuserCategoryAnalysisDailyService.java

@ -0,0 +1,20 @@
package com.epmet.service.stats;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.entity.stats.FactIcuserCategoryAnalysisDailyEntity;
/**
* 人员类别分析
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-01-17
*/
public interface FactIcuserCategoryAnalysisDailyService extends BaseService<FactIcuserCategoryAnalysisDailyEntity> {
/**
* 数字社区-基础信息-人员类别分析-每个类别的人员总数较上月迁入迁出人数
* 网格
* @param customerId
* @param dateId
*/
void statUserCategoryGridDaily(String customerId, String dateId);
}

198
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactIcuserCategoryAnalysisDailyServiceImpl.java

@ -0,0 +1,198 @@
package com.epmet.service.stats.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.enums.OrgTypeEnum;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.stats.FactIcuserCategoryAnalysisDailyDao;
import com.epmet.dto.customize.IcResiCategoryConfigDTO;
import com.epmet.dto.user.result.OrgIcUserTotalDTO;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity;
import com.epmet.entity.stats.FactIcuserCategoryAnalysisDailyEntity;
import com.epmet.service.customize.IcResiCategoryStatsConfigService;
import com.epmet.service.evaluationindex.screen.ScreenCustomerAgencyService;
import com.epmet.service.evaluationindex.screen.ScreenCustomerGridService;
import com.epmet.service.stats.FactIcuserCategoryAnalysisDailyService;
import com.epmet.service.user.UserService;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 人员类别分析
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-01-17
*/
@Service
@Slf4j
@DataSource(DataSourceConstant.STATS)
public class FactIcuserCategoryAnalysisDailyServiceImpl extends BaseServiceImpl<FactIcuserCategoryAnalysisDailyDao, FactIcuserCategoryAnalysisDailyEntity> implements FactIcuserCategoryAnalysisDailyService {
@Autowired
private IcResiCategoryStatsConfigService icResiCategoryStatsConfigService;
@Autowired
private ScreenCustomerAgencyService agencyService;
@Autowired
private ScreenCustomerGridService gridService;
@Autowired
private UserService userService;
/**
* 数字社区-基础信息-人员类别分析-每个类别的人员总数较上月迁入迁出人数
*
* @param customerId
* @param dateId
*/
@Override
public void statUserCategoryGridDaily(String customerId, String dateId) {
//查询出所有用语数据分析的类别column_name,没有则不计算
List<IcResiCategoryConfigDTO> columnList = icResiCategoryStatsConfigService.queryDataColumn(customerId);
if (CollectionUtils.isEmpty(columnList)) {
return;
}
//所有网格查询出来
List<ScreenCustomerGridEntity> gridDTOList = gridService.getByCustomerId(customerId);
if (CollectionUtils.isEmpty(gridDTOList)) {
return;
}
//网格维度、组织维度初始好数据
List<FactIcuserCategoryAnalysisDailyEntity> initList = constructInitValue(customerId, dateId, gridDTOList, columnList);
if (CollectionUtils.isEmpty(initList)) {
return;
}
//当这3个数都为0的时候不插入数据库了
List<FactIcuserCategoryAnalysisDailyEntity> insertList = initList.stream().filter(entity -> (null != entity.getTotal() && entity.getTotal() > 0)
|| (null != entity.getQcIncr() && entity.getQcIncr() > 0)
|| (null != entity.getQrIncr() && entity.getQrIncr() > 0)).collect(Collectors.toList());
//删除旧数据
clearOldDatas(customerId, dateId, OrgTypeEnum.GRID.getCode());
// 批量插入数据
Lists.partition(insertList, NumConstant.ONE_HUNDRED).forEach(list -> {
insertBatch(list);
});
}
/**
* 删除旧数据
*
* @param customerId
* @param dateId
* @param orgType gridagency
*/
private void clearOldDatas(String customerId, String dateId, String orgType) {
int deleteNum;
do {
//每次删除1000条
deleteNum = baseDao.limitDelete(customerId, dateId, orgType);
} while (deleteNum != NumConstant.ZERO);
}
/**
* @param customerId
* @param dateId yyyyMMdd
* @param gridDTOList 当前客户下所有的网格
* @param columnList 所有需要分析的类别对应的ic_resi_user的列名目前只有18类
* @return
*/
private List<FactIcuserCategoryAnalysisDailyEntity> constructInitValue(String customerId, String dateId, List<ScreenCustomerGridEntity> gridDTOList, List<IcResiCategoryConfigDTO> columnList) {
List<FactIcuserCategoryAnalysisDailyEntity> list = new ArrayList<>();
//1、total
// 查询明细ic_user_change_detailed变更明细表,各个网格的各个分类的总人数
Map<String, List<OrgIcUserTotalDTO>> totalMapList = userService.calGridIcUserTotal(customerId, dateId);
String monthId = dateId.substring(NumConstant.ZERO, NumConstant.SIX);
String startDate = monthId.concat("01");
String endDate = dateId;
//2、迁入+30:eg:dateId:20211226, [20211201,20211226],类别sum值=1的
Map<String, List<OrgIcUserTotalDTO>> qrList = userService.calGridIcUserIncr(customerId, startDate, endDate, "qr");
//3、迁出 -10 :eg:dateId:20211226, [20211201,20211226],类别sum值 !=1的
Map<String, List<OrgIcUserTotalDTO>> qcList = userService.calGridIcUserIncr(customerId, startDate, endDate, "qc");
for (IcResiCategoryConfigDTO config : columnList) {
gridDTOList.forEach(grid -> {
FactIcuserCategoryAnalysisDailyEntity gridData = new FactIcuserCategoryAnalysisDailyEntity();
gridData.setCustomerId(customerId);
gridData.setConfigId(config.getConfigId());
gridData.setColumnName(config.getColumnName());
gridData.setDateId(dateId);
gridData.setOrgId(grid.getGridId());
gridData.setOrgType(OrgTypeEnum.GRID.getCode());
gridData.setPid(StringUtils.isNotBlank(grid.getParentAgencyId()) ? grid.getParentAgencyId() : NumConstant.ZERO_STR);
gridData.setPids(grid.getAllParentIds());
//截止到目前累计值
boolean totalZeroFlag = true;
if (MapUtils.isNotEmpty(totalMapList) && totalMapList.containsKey(grid.getGridId())) {
//当前网格下,有的类别
List<OrgIcUserTotalDTO> crrentGrid = totalMapList.get(grid.getGridId());
if (CollectionUtils.isNotEmpty(crrentGrid)) {
//各个类别对应的数
Map<String, Integer> categoryTotalMap = crrentGrid.stream().collect(Collectors.toMap(OrgIcUserTotalDTO::getColumnName, OrgIcUserTotalDTO::getTotal, (key1, key2) -> key2));
if (MapUtils.isNotEmpty(categoryTotalMap) && categoryTotalMap.containsKey(config.getColumnName())) {
totalZeroFlag = false;
gridData.setTotal(categoryTotalMap.get(config.getColumnName()));
}
}
}
if (totalZeroFlag) {
gridData.setTotal(NumConstant.ZERO);
}
//较上月迁入
boolean incrZeroFlag = true;
if (MapUtils.isNotEmpty(qrList) && qrList.containsKey(grid.getGridId())) {
//当前网格下,有的类别
List<OrgIcUserTotalDTO> crrentGrid = qrList.get(grid.getGridId());
if (CollectionUtils.isNotEmpty(crrentGrid)) {
//各个类别对应的数
Map<String, Integer> categoryTotalMap = crrentGrid.stream().collect(Collectors.toMap(OrgIcUserTotalDTO::getColumnName, OrgIcUserTotalDTO::getTotal, (key1, key2) -> key2));
if (MapUtils.isNotEmpty(categoryTotalMap) && categoryTotalMap.containsKey(config.getColumnName())) {
incrZeroFlag = false;
gridData.setQrIncr(categoryTotalMap.get(config.getColumnName()));
}
}
}
if (incrZeroFlag) {
gridData.setQrIncr(NumConstant.ZERO);
}
// 较上月迁出:
boolean qcZeroFlag = true;
if (MapUtils.isNotEmpty(qcList) && qcList.containsKey(grid.getGridId())) {
//当前网格下,有的类别
List<OrgIcUserTotalDTO> crrentGridQc = qcList.get(grid.getGridId());
if (CollectionUtils.isNotEmpty(crrentGridQc)) {
//各个类别对应的数
Map<String, Integer> categoryTotalMap = crrentGridQc.stream().collect(Collectors.toMap(OrgIcUserTotalDTO::getColumnName, OrgIcUserTotalDTO::getTotal, (key1, key2) -> key2));
if (MapUtils.isNotEmpty(categoryTotalMap) && categoryTotalMap.containsKey(config.getColumnName())) {
qcZeroFlag = false;
gridData.setQcIncr(categoryTotalMap.get(config.getColumnName()));
}
}
}
if (qcZeroFlag) {
gridData.setQcIncr(NumConstant.ZERO);
}
list.add(gridData);
});
}
return list;
}
}

29
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java

@ -157,4 +157,33 @@ public interface UserService {
* @return
*/
List<PatrolRoutineWorkResult> selectRoutineWorkListByDateId(String customerId, String dateId);
Map<String,Integer> selectCountForGrid(String customerId, String columnName);
/**
*
* @param customerId
* @param columnName
* @param agencyIds
* @return
*/
Map<String, Integer> selectCountForGrid(String customerId, String columnName, List<String> agencyIds);
/**
*
* @param customerId
* @param dateId 截止到这一天的各个网格下每个分类的总人数
* @return
*/
Map<String, List<OrgIcUserTotalDTO>> calGridIcUserTotal(String customerId, String dateId);
/**
*
* @param customerId
* @param startDate 变动时间在此范围内的 yyyyMMdd
* @param endDate :yyyyMMdd
* @param type:qr:迁入qc:迁出
* @return
*/
Map<String, List<OrgIcUserTotalDTO>> calGridIcUserIncr(String customerId, String startDate, String endDate, String type);
}

101
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java

@ -1126,4 +1126,105 @@ public class UserServiceImpl implements UserService {
public List<PatrolRoutineWorkResult> selectRoutineWorkListByDateId(String customerId, String dateId) {
return userDao.selectRoutineWorkListByDateId(customerId, dateId);
}
/**
*
* @param customerId
* @param columnName
* @return 截止到目前每个网格内某个分类的总人数
*/
@Override
public Map<String, Integer> selectCountForGrid(String customerId, String columnName) {
Map<String, Integer> map = new HashMap<>();
List<OrgIcUserTotalDTO> list = userDao.selectCountForGrid(customerId, columnName);
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(list)) {
map = list.stream().collect(Collectors.toMap(OrgIcUserTotalDTO::getOrgId, OrgIcUserTotalDTO::getTotal));
}
return map;
}
/**
* @param customerId
* @param columnName
* @param agencyIds
* @return 截止到目前各个组织内某个分类的总人数
*/
@Override
public Map<String, Integer> selectCountForGrid(String customerId, String columnName, List<String> agencyIds) {
Map<String, Integer> map = new HashMap<>();
if (CollectionUtils.isEmpty(agencyIds)) {
return map;
}
List<OrgIcUserTotalDTO> list = new ArrayList<>();
for (String agencyId:agencyIds) {
OrgIcUserTotalDTO dto=new OrgIcUserTotalDTO();
dto.setOrgId(agencyId);
OrgIcUserTotalDTO totalDto=userDao.selectCountForAgency(customerId,columnName,agencyId);
dto.setTotal(null!=totalDto?totalDto.getTotal():NumConstant.ZERO);
list.add(dto);
}
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(list)) {
map = list.stream().collect(Collectors.toMap(OrgIcUserTotalDTO::getOrgId, OrgIcUserTotalDTO::getTotal));
}
return map;
}
/**
* @param customerId
* @param dateId 截止到这一天的各个网格下每个分类的总人数
* @return
*/
@Override
public Map<String, List<OrgIcUserTotalDTO>> calGridIcUserTotal(String customerId, String dateId) {
Map<String, List<OrgIcUserTotalDTO>> resultMap=new HashMap<>();
List<OrgIcUserTotalDTO> list=userDao.selectGridIcUserCategoryTotal(customerId,dateId);
if(CollectionUtils.isEmpty(list)){
return resultMap;
}
// list 数据
// gridId columnName total
// 1001 IS_DBH 1
// 1001 IS_PARTY 1
// 1002 IS_DBH 1
// 1002 IS_ENSURE_HOUSE 1
// 1003 IS_VETERANS 1
// 1004 IS_PARTY 1
for(OrgIcUserTotalDTO dto:list){
if(resultMap.containsKey(dto.getOrgId())){
resultMap.get(dto.getOrgId()).add(dto);
continue;
}
List<OrgIcUserTotalDTO> newList=new ArrayList<>();
newList.add(dto);
resultMap.put(dto.getOrgId(),newList);
}
return resultMap;
}
/**
* @param customerId
* @param startDate 变动时间在此范围内的 yyyyMMdd
* @param endDate :yyyyMMdd
* @param type :qr:迁入qc:迁出
* @return
*/
@Override
public Map<String, List<OrgIcUserTotalDTO>> calGridIcUserIncr(String customerId, String startDate, String endDate, String type) {
Map<String, List<OrgIcUserTotalDTO>> resultMap=new HashMap<>();
List<OrgIcUserTotalDTO> list=userDao.selectGridIcUserCategoryIncr(customerId,startDate,endDate,type);
if(CollectionUtils.isEmpty(list)){
return resultMap;
}
for(OrgIcUserTotalDTO dto:list){
if(resultMap.containsKey(dto.getOrgId())){
resultMap.get(dto.getOrgId()).add(dto);
continue;
}
List<OrgIcUserTotalDTO> newList=new ArrayList<>();
newList.add(dto);
resultMap.put(dto.getOrgId(),newList);
}
return resultMap;
}
}

5
epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml

@ -188,6 +188,11 @@ dynamic:
url: @datasource.druid.epmetPoint.url@
username: @datasource.druid.epmetPoint.username@
password: @datasource.druid.epmetPoint.password@
operCustomize:
driver-class-name: com.mysql.cj.jdbc.Driver
url: @datasource.druid.operCustomize.url@
username: @datasource.druid.operCustomize.username@
password: @datasource.druid.operCustomize.password@
thread:
# 线程池配置

23
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/customize/IcResiCategoryStatsConfigDao.xml

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.customize.IcResiCategoryStatsConfigDao">
<select id="queryDataColumn" parameterType="java.lang.String" resultType="com.epmet.dto.customize.IcResiCategoryConfigDTO">
SELECT
m.COLUMN_NAME as columnName,
c.id as configId,
m.LABEL as itemLabel
FROM
ic_form_item m
INNER JOIN ic_resi_category_stats_config c ON ( m.CUSTOMER_ID = c.CUSTOMER_ID AND m.COLUMN_NAME = c.COLUMN_NAME AND c.DEL_FLAG = '0' )
WHERE
m.DEL_FLAG = '0'
AND m.DATA_ANALYSE = '1'
AND m.CUSTOMER_ID = #{customerId}
ORDER BY
m.SORT ASC
</select>
</mapper>

13
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIcuserCategoryAnalysisDailyDao.xml

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.stats.FactIcuserCategoryAnalysisDailyDao">
<delete id="limitDelete" parameterType="map">
delete from fact_icuser_category_analysis_daily
where CUSTOMER_ID = #{customerId}
and date_id=#{dateId}
and org_type=#{orgType}
limit 1000
</delete>
</mapper>

82
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml

@ -1074,4 +1074,86 @@
</select>
<select id="selectCountForGrid" parameterType="map" resultType="com.epmet.dto.user.result.OrgIcUserTotalDTO">
SELECT
m.grid_id as orgId
count(*) AS total,
#{columnName} as columnName
FROM
ic_resi_user m
WHERE
m.DEL_FLAG = '0'
AND m.CUSTOMER_ID = #{customerId}
AND concat('m.',${columnName}) = '1'
AND m.GRID_ID=#{gridId}
group by m.grid_id
</select>
<select id="selectCountForAgency" parameterType="map" resultType="com.epmet.dto.user.result.OrgIcUserTotalDTO">
SELECT
#{agencyId} as orgId,
count(*) AS total,
#{columnName} as columnName
FROM
ic_resi_user m
WHERE
m.DEL_FLAG = '0'
AND m.CUSTOMER_ID = #{customerId}
AND concat('m.',${columnName}) = '1'
AND ( m.AGENCY_ID = #{agencyId} OR M.PIDS LIKE CONCAT( '%', #{agencyId}, '%' ) )
</select>
<select id="selectGridIcUserCategoryTotal" parameterType="map" resultType="com.epmet.dto.user.result.OrgIcUserTotalDTO">
select
temp.orgId,
temp.FIELD_NAME as columnName,
count(temp.IC_USER_ID) as total
from (
SELECT
d.GRID_ID as orgId,
d.IC_USER_ID,
d.FIELD_NAME,
sum(d.`VALUE`)as result
FROM
ic_user_change_detailed d
WHERE
d.DEL_FLAG = '0'
AND d.CUSTOMER_ID = #{customerId}
AND DATE_FORMAT( d.CREATED_TIME, '%Y%m%d' ) &lt;= #{dateId}
group by d.GRID_ID,d.IC_USER_ID,d.FIELD_NAME
)temp
where temp.result=1
group by temp.orgId,temp.FIELD_NAME
</select>
<select id="selectGridIcUserCategoryIncr" parameterType="map" resultType="com.epmet.dto.user.result.OrgIcUserTotalDTO">
select
temp.orgId,
temp.FIELD_NAME as columnName,
count(temp.IC_USER_ID) as total
from (
SELECT
d.GRID_ID as orgId,
d.IC_USER_ID,
d.FIELD_NAME,
sum(d.`VALUE`)as result
FROM
ic_user_change_detailed d
WHERE
d.DEL_FLAG = '0'
AND d.CUSTOMER_ID = #{customerId}
AND DATE_FORMAT( d.CREATED_TIME, '%Y%m%d' ) &gt;= #{startDate}
AND DATE_FORMAT( d.CREATED_TIME, '%Y%m%d' ) &lt;= #{endDate}
group by d.GRID_ID,d.IC_USER_ID,d.FIELD_NAME
)temp
where 1=1
<if test="type != null and type == 'qr'">
and temp.result=1
</if>
<if test="type != null and type == 'qc'">
and temp.result !=1
</if>
group by temp.orgId,temp.FIELD_NAME
</select>
</mapper>

115
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyUnitCompletionDTO.java

@ -0,0 +1,115 @@
package com.epmet.dto;
import com.epmet.commons.tools.validator.group.AddGroup;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
/**
* 联建单位完成情况
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-01-17
*/
@Data
public class IcPartyUnitCompletionDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户id
*/
private String customerId;
/**
* 组织ID
*/
private String agencyId;
/**
*
*/
private String pids;
/**
* 单位ID
*/
@NotNull(message = "单位ID不能为空",groups = AddGroup.class)
private String unitId;
/**
* 类型 monthly月度quarter季度
*/
@NotNull(message = "类型不能为空",groups = AddGroup.class)
private String type;
/**
* 评分 百分制
*/
@NotNull(message = "评分不能为空",groups = AddGroup.class)
private String score;
/**
* 完成情况1已完成0未完成
*/
@NotNull(message = "完成情况不能为空",groups = AddGroup.class)
private String status;
/**
* 年份
*/
@NotNull(message = "年份不能为空",groups = AddGroup.class)
private String year;
/**
* 月或季度
*/
@NotNull(message = "月或季度",groups = AddGroup.class)
private String monthQuarter;
private String monthQuarterName;
/**
* 时间
*/
private String recordDate;
/**
* 删除标识 0未删除1已删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

18
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/CompletionFormDTO.java

@ -0,0 +1,18 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @Description
* @Author zhaoqifeng
* @Date 2022/1/17 15:46
*/
@Data
public class CompletionFormDTO implements Serializable {
private static final long serialVersionUID = 4925867264241549310L;
private String unitId;
private Integer pageNo = 1;
private Integer pageSize = 10;
}

40
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/PointRecordFormDTO.java

@ -0,0 +1,40 @@
package com.epmet.dto.form;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* @Description
* @Author zhaoqifeng
* @Date 2022/1/18 9:34
*/
@NoArgsConstructor
@Data
public class PointRecordFormDTO implements Serializable {
private static final long serialVersionUID = -5200348821951188343L;
/**
* 服务方类型社会组织social_org社区自组织community_org区域党建单位party_unit
*/
private String serviceType;
/**
* 服务方ID
*/
private String serviceId;
/**
* 开始时间
*/
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date startTime;
/**
* 结束时间
*/
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date endTime;
private Integer pageNo = 1;
private Integer pageSize = 10;
private String customerId;
}

44
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/PointRecordDTO.java

@ -0,0 +1,44 @@
package com.epmet.dto.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @Description
* @Author zhaoqifeng
* @Date 2022/1/18 9:30
*/
@NoArgsConstructor
@Data
public class PointRecordDTO implements Serializable {
private static final long serialVersionUID = 8562346042241117055L;
/**
* 需求类型
*/
@JsonIgnore
private String categoryCode;
private String categoryName;
/**
* 需求人
*/
private String demandUserName;
/**
* 需求内容
*/
private String content;
/**
* 发放积分时间
*/
private String pointTime;
/**
* 评价
*/
private String score;
/**
* 积分
*/
private String point;
}

21
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/PointRecordResultDTO.java

@ -0,0 +1,21 @@
package com.epmet.dto.result;
import com.epmet.commons.tools.page.PageData;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @Description
* @Author zhaoqifeng
* @Date 2022/1/18 9:28
*/
@NoArgsConstructor
@Data
public class PointRecordResultDTO implements Serializable {
private static final long serialVersionUID = -2359756064125925616L;
private Integer totalPoint;
private PageData<PointRecordDTO> page;
}

50
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitCompletionController.java

@ -0,0 +1,50 @@
package com.epmet.controller;
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.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.IcPartyUnitCompletionDTO;
import com.epmet.dto.form.CompletionFormDTO;
import com.epmet.service.IcPartyUnitCompletionService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* 联建单位完成情况
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-01-17
*/
@RestController
@RequestMapping("icpartyunitcompletion")
public class IcPartyUnitCompletionController {
@Autowired
private IcPartyUnitCompletionService icPartyUnitCompletionService;
@PostMapping("list")
public Result<PageData<IcPartyUnitCompletionDTO>> page(@RequestBody CompletionFormDTO formDTO){
PageData<IcPartyUnitCompletionDTO> page = icPartyUnitCompletionService.page(formDTO);
return new Result<PageData<IcPartyUnitCompletionDTO>>().ok(page);
}
@PostMapping("save")
public Result save(@RequestBody IcPartyUnitCompletionDTO dto){
//效验数据
if (StringUtils.isBlank(dto.getUnitId())) {
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
}
icPartyUnitCompletionService.save(dto);
return new Result();
}
@PostMapping("delete")
public Result delete(@RequestBody IcPartyUnitCompletionDTO dto){
icPartyUnitCompletionService.delete(dto.getId());
return new Result();
}
}

18
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java

@ -25,7 +25,6 @@ import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.dto.form.mq.eventmsg.BasePointEventMsg;
import com.epmet.commons.tools.enums.EventEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
@ -35,9 +34,11 @@ import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.constant.SystemMessageType;
import com.epmet.constant.UserDemandConstant;
import com.epmet.dto.form.LoginUserDetailsFormDTO;
import com.epmet.dto.form.PointRecordFormDTO;
import com.epmet.dto.form.SystemMsgFormDTO;
import com.epmet.dto.form.demand.*;
import com.epmet.dto.result.LoginUserDetailsResultDTO;
import com.epmet.dto.result.PointRecordResultDTO;
import com.epmet.dto.result.demand.*;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient;
@ -364,5 +365,20 @@ public class IcUserDemandRecController implements ResultDataResolver {
return new Result().ok(page);
}
/**
* 组织单位积分记录
*
* @Param formDTO
* @Return {@link Result< PointRecordResultDTO>}
* @Author zhaoqifeng
* @Date 2022/1/18 9:45
*/
@PostMapping("recordList")
public Result<PointRecordResultDTO> pointRecordList(@LoginUser TokenDto tokenDto, @RequestBody PointRecordFormDTO formDTO) {
formDTO.setCustomerId(tokenDto.getCustomerId());
PointRecordResultDTO result = icUserDemandRecService.pointRecordList(formDTO);
return new Result<PointRecordResultDTO>().ok(result);
}
}

16
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcPartyUnitCompletionDao.java

@ -0,0 +1,16 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.IcPartyUnitCompletionEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 联建单位完成情况
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-01-17
*/
@Mapper
public interface IcPartyUnitCompletionDao extends BaseDao<IcPartyUnitCompletionEntity> {
}

17
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcUserDemandRecDao.java

@ -19,13 +19,12 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.IcUserDemandRecDTO;
import com.epmet.dto.form.PointRecordFormDTO;
import com.epmet.dto.form.demand.IcResiUserDemandFromDTO;
import com.epmet.dto.form.demand.PageListAnalysisFormDTO;
import com.epmet.dto.form.demand.UserDemandPageFormDTO;
import com.epmet.dto.result.PointRecordDTO;
import com.epmet.dto.result.demand.*;
import com.epmet.dto.result.demand.DemandRecResultDTO;
import com.epmet.dto.result.demand.IcResiUserReportDemandRes;
import com.epmet.dto.result.demand.ServiceStatDTO;
import com.epmet.entity.IcUserDemandRecEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -118,4 +117,16 @@ public interface IcUserDemandRecDao extends BaseDao<IcUserDemandRecEntity> {
@Param("type")String type);
int evaluate(@Param("demandRecId")String demandRecId, @Param("finishResult")String finishResult);
/**
* 组织单位积分记录
*
* @Param formDTO
* @Return {@link List< PointRecordDTO>}
* @Author zhaoqifeng
* @Date 2022/1/18 10:33
*/
List<PointRecordDTO> getPointRecordList(PointRecordFormDTO formDTO);
Integer getTotalPoint(PointRecordFormDTO formDTO);
}

71
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcPartyUnitCompletionEntity.java

@ -0,0 +1,71 @@
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 联建单位完成情况
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-01-17
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("ic_party_unit_completion")
public class IcPartyUnitCompletionEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户id
*/
private String customerId;
/**
* 组织ID
*/
private String agencyId;
/**
*
*/
private String pids;
/**
* 单位ID
*/
private String unitId;
/**
* 类型 monthly月度quarter季度
*/
private String type;
/**
* 评分 百分制
*/
private String score;
/**
* 完成情况1已完成0未完成
*/
private String status;
/**
* 年份
*/
private String year;
/**
* 月或季度
*/
private String monthQuarter;
/**
* 时间
*/
private String recordDate;
}

46
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyUnitCompletionService.java

@ -0,0 +1,46 @@
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.IcPartyUnitCompletionDTO;
import com.epmet.dto.form.CompletionFormDTO;
import com.epmet.entity.IcPartyUnitCompletionEntity;
/**
* 联建单位完成情况
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-01-17
*/
public interface IcPartyUnitCompletionService extends BaseService<IcPartyUnitCompletionEntity> {
/**
* 默认分页
*
* @param formDTO
* @return PageData<IcPartyUnitCompletionDTO>
* @author generator
* @date 2022-01-17
*/
PageData<IcPartyUnitCompletionDTO> page(CompletionFormDTO formDTO);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2022-01-17
*/
void save(IcPartyUnitCompletionDTO dto);
/**
* 删除
*
* @param id
* @return void
* @author generator
* @date 2022-01-17
*/
void delete(String id);
}

11
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcUserDemandRecService.java

@ -20,7 +20,9 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.IcUserDemandRecDTO;
import com.epmet.dto.form.PointRecordFormDTO;
import com.epmet.dto.form.demand.*;
import com.epmet.dto.result.PointRecordResultDTO;
import com.epmet.dto.result.demand.*;
import com.epmet.entity.IcUserDemandRecEntity;
@ -224,4 +226,13 @@ public interface IcUserDemandRecService extends BaseService<IcUserDemandRecEntit
* @return
*/
PageData<DemandRecResultDTO> search(String customerId, String agencyId, String keyword, Integer pageNo, Integer pageSize);
/**
* 组织单位积分记录
* @Param formDTO
* @Return {@link PointRecordResultDTO}
* @Author zhaoqifeng
* @Date 2022/1/18 9:45
*/
PointRecordResultDTO pointRecordList(PointRecordFormDTO formDTO);
}

86
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitCompletionServiceImpl.java

@ -0,0 +1,86 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.enums.DateEnum;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.IcPartyUnitCompletionDao;
import com.epmet.dto.IcPartyUnitCompletionDTO;
import com.epmet.dto.IcPartyUnitDTO;
import com.epmet.dto.form.CompletionFormDTO;
import com.epmet.entity.IcPartyUnitCompletionEntity;
import com.epmet.service.IcPartyUnitCompletionService;
import com.epmet.service.IcPartyUnitService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
/**
* 联建单位完成情况
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-01-17
*/
@Service
public class IcPartyUnitCompletionServiceImpl extends BaseServiceImpl<IcPartyUnitCompletionDao, IcPartyUnitCompletionEntity> implements IcPartyUnitCompletionService {
@Resource
private IcPartyUnitService icPartyUnitService;
@Override
public PageData<IcPartyUnitCompletionDTO> page(CompletionFormDTO formDTO) {
if (StringUtils.isBlank(formDTO.getUnitId())) {
return new PageData<>(Collections.emptyList(), NumConstant.ZERO);
}
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize());
LambdaQueryWrapper<IcPartyUnitCompletionEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcPartyUnitCompletionEntity::getUnitId, formDTO.getUnitId());
wrapper.orderByDesc(IcPartyUnitCompletionEntity::getCreatedTime);
List<IcPartyUnitCompletionEntity> list = baseDao.selectList(wrapper);
PageInfo<IcPartyUnitCompletionEntity> pageInfo = new PageInfo<>(list);
List<IcPartyUnitCompletionDTO> dtoList = ConvertUtils.sourceToTarget(list, IcPartyUnitCompletionDTO.class);
if(CollectionUtils.isNotEmpty(dtoList)) {
dtoList.forEach(item -> {
item.setMonthQuarterName(DateEnum.getName(item.getMonthQuarter()));
});
}
return new PageData<>(dtoList, pageInfo.getTotal());
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(IcPartyUnitCompletionDTO dto) {
IcPartyUnitCompletionEntity entity = ConvertUtils.sourceToTarget(dto, IcPartyUnitCompletionEntity.class);
if (StringUtils.isNotBlank(dto.getYear()) && StringUtils.isNotBlank(dto.getMonthQuarter())) {
entity.setRecordDate(dto.getYear().concat(dto.getMonthQuarter()));
}
if(StringUtils.isBlank(dto.getId())) {
IcPartyUnitDTO unity = icPartyUnitService.get(dto.getUnitId());
entity.setCustomerId(unity.getCustomerId());
entity.setAgencyId(unity.getAgencyId());
entity.setPids(unity.getPids());
insert(entity);
} else {
updateById(entity);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String id) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteById(id);
}
}

44
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java

@ -154,7 +154,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
// 查询需求人的居住地址
Set<String> houseIds=new HashSet<>();
houseIds.add(updateEntity.getDemandUserHouseId());
Result<List<HouseInfoDTO>> houseInfoRes=govOrgOpenFeignClient.queryListHouseInfo(houseIds);
Result<List<HouseInfoDTO>> houseInfoRes=govOrgOpenFeignClient.queryListHouseInfo(houseIds,dto.getCustomerId());
if(!houseInfoRes.success()||CollectionUtils.isEmpty(houseInfoRes.getData())){
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "查询需求人房屋地址信息异常"+JSON.toJSONString(houseInfoRes));
}
@ -223,7 +223,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
// 查询需求人的居住地址
Set<String> houseIds=new HashSet<>();
houseIds.add(insertEntity.getDemandUserHouseId());
Result<List<HouseInfoDTO>> houseInfoRes=govOrgOpenFeignClient.queryListHouseInfo(houseIds);
Result<List<HouseInfoDTO>> houseInfoRes=govOrgOpenFeignClient.queryListHouseInfo(houseIds, fromDTO.getCustomerId());
if(!houseInfoRes.success()||CollectionUtils.isEmpty(houseInfoRes.getData())){
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "查询需求人房屋地址信息异常"+JSON.toJSONString(houseInfoRes));
}
@ -1644,5 +1644,45 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
return new PageData<>(list, new PageInfo<>(list).getTotal());
}
/**
* 组织单位积分记录
*
* @param formDTO
* @Param formDTO
* @Return {@link PointRecordResultDTO}
* @Author zhaoqifeng
* @Date 2022/1/18 9:45
*/
@Override
public PointRecordResultDTO pointRecordList(PointRecordFormDTO formDTO) {
PointRecordResultDTO result = new PointRecordResultDTO();
if (StringUtils.isBlank(formDTO.getServiceId())) {
result.setTotalPoint(NumConstant.ZERO);
result.setPage(new PageData<>(Collections.emptyList(), NumConstant.ZERO));
}
Integer total = baseDao.getTotalPoint(formDTO);
//总积分
result.setTotalPoint(null == total?NumConstant.ZERO:total);
//分页查询
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize());
List<PointRecordDTO> list = baseDao.getPointRecordList(formDTO);
PageInfo<PointRecordDTO> pageInfo = new PageInfo<>(list);
if (CollectionUtils.isNotEmpty(list)) {
//查询分类名称
List<String> categoryCodes = list.stream().map(PointRecordDTO::getCategoryCode).collect(Collectors.toList());
List<IcResiDemandDictEntity> dictList = demandDictService.listByCodes(formDTO.getCustomerId(), categoryCodes);
Map<String, String> dictMap = dictList.stream().collect(Collectors.toMap(IcResiDemandDictEntity::getCategoryCode, IcResiDemandDictEntity::getCategoryName));
list.forEach(item -> {
if (dictMap.containsKey(item.getCategoryCode())) {
item.setCategoryName(dictMap.get(item.getCategoryCode()));
}
});
}
result.setPage(new PageData<>(list, pageInfo.getTotal()));
return result;
}
}

22
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.9__add_icompletion.sql

@ -0,0 +1,22 @@
CREATE TABLE `ic_party_unit_completion`
(
`ID` varchar(64) NOT NULL COMMENT '主键',
`CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id',
`AGENCY_ID` varchar(64) NOT NULL COMMENT '组织ID',
`PIDS` varchar(255) NOT NULL,
`UNIT_ID` varchar(64) NOT NULL COMMENT '单位ID',
`TYPE` varchar(10) NOT NULL COMMENT '类型 monthly月度,quarter季度',
`SCORE` varchar(5) NOT NULL COMMENT '评分 百分制',
`STATUS` varchar(1) NOT NULL COMMENT '完成情况1已完成,0未完成',
`YEAR` varchar(4) NOT NULL COMMENT '年份',
`MONTH_QUARTER` varchar(4) NOT NULL COMMENT '月或季度',
`RECORD_DATE` varchar(12) NOT NULL COMMENT '时间',
`DEL_FLAG` varchar(1) NOT NULL DEFAULT '0' COMMENT '删除标识 0未删除、1已删除',
`REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁',
`CREATED_BY` varchar(32) NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT ='联建单位完成情况';

27
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyUnitCompletionDao.xml

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.IcPartyUnitCompletionDao">
<resultMap type="com.epmet.entity.IcPartyUnitCompletionEntity" id="icPartyUnitCompletionMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="agencyId" column="AGENCY_ID"/>
<result property="pids" column="PIDS"/>
<result property="unitId" column="UNIT_ID"/>
<result property="type" column="TYPE"/>
<result property="score" column="SCORE"/>
<result property="status" column="STATUS"/>
<result property="year" column="YEAR"/>
<result property="monthQuarter" column="MONTH_QUARTER"/>
<result property="recordDate" column="RECORD_DATE"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
</mapper>

46
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml

@ -572,4 +572,50 @@
UPDATED_TIME=NOW()
where id=#{demandRecId}
</update>
<select id="getPointRecordList" resultType="com.epmet.dto.result.PointRecordDTO">
SELECT
a.CATEGORY_CODE,
a.DEMAND_USER_NAME,
a.CONTENT,
a.AWARD_POINT AS point,
a.`STATUS`,
c.SCORE,
DATE_FORMAT(c.EVALUATE_TIME, '%Y-%m-%d %H:%i') AS pointTime
FROM
ic_user_demand_rec a
INNER JOIN ic_user_demand_service b ON a.ID = b.DEMAND_REC_ID AND b.SERVICE_TYPE = #{serviceType}
AND b.SERVER_ID = #{serviceId} AND b.DEL_FLAG = '0'
INNER JOIN ic_user_demand_satisfaction c ON a.ID = c.DEMAND_REC_ID AND c.DEL_FLAG = '0'
WHERE
a.DEL_FLAG = '0'
AND a.`STATUS` = 'finished'
AND a.EVALUATE_FLAG = 1
<if test="null != startTime">
AND c.EVALUATE_TIME &gt;= #{startTime}
</if>
<if test="null != endTime">
AND c.EVALUATE_TIME &lt;= #{endTime}
</if>
ORDER BY c.EVALUATE_TIME DESC
</select>
<select id="getTotalPoint" resultType="java.lang.Integer">
SELECT
SUM(a.AWARD_POINT)
FROM
ic_user_demand_rec a
INNER JOIN ic_user_demand_service b ON a.ID = b.DEMAND_REC_ID AND b.SERVICE_TYPE = #{serviceType}
AND b.SERVER_ID = #{serviceId} AND b.DEL_FLAG = '0'
INNER JOIN ic_user_demand_satisfaction c ON a.ID = c.DEMAND_REC_ID AND c.DEL_FLAG = '0'
WHERE
a.DEL_FLAG = '0'
AND a.`STATUS` = 'finished'
AND a.EVALUATE_FLAG = 1
<if test="null != startTime">
AND c.EVALUATE_TIME &gt;= #{startTime}
</if>
<if test="null != endTime">
AND c.EVALUATE_TIME &lt;= #{endTime}
</if>
</select>
</mapper>

34
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/IcUserCategoryAnalysisTask.java

@ -0,0 +1,34 @@
package com.epmet.task;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.extract.form.IcUserCategoryAnalysisDailyFormDTO;
import com.epmet.feign.DataStatisticalOpenFeignClient;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Slf4j
@Component("icUserCategoryAnalysisTask")
public class IcUserCategoryAnalysisTask implements ITask {
@Autowired
private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient;
@Override
public void run(String params) {
log.info("icUserCategoryAnalysisTask定时任务正在执行,参数为:{}", params);
IcUserCategoryAnalysisDailyFormDTO formDTO = new IcUserCategoryAnalysisDailyFormDTO();
if (StringUtils.isNotBlank(params)) {
formDTO = JSON.parseObject(params, IcUserCategoryAnalysisDailyFormDTO.class);
}
Result result = dataStatisticalOpenFeignClient.statUserCategoryDaily(formDTO);
if (result.success()) {
log.info("icUserCategoryAnalysisTask定时任务正在执行定时任务执行成功");
} else {
log.warn("icUserCategoryAnalysisTask定时任务正在执行定时任务执行失败:" + result.getMsg());
}
}
}

7
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseInfoDTO.java

@ -71,4 +71,11 @@ public class HouseInfoDTO implements Serializable {
* 楼的纬度
*/
private String buildingLatitude;
/**
* 小区名+楼栋名+单元名+房屋名
*/
private String allName;
private String customerId;
}

2
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java

@ -460,7 +460,7 @@ public interface GovOrgOpenFeignClient {
Result<CustomerGridDTO> getGridBaseInfoByGridId(CustomerGridFormDTO customerGridFormDTO);
@PostMapping(value = "/gov/org/house/queryListHouseInfo",consumes = MediaType.APPLICATION_JSON_VALUE)
Result<List<HouseInfoDTO>> queryListHouseInfo(@RequestBody Set<String> houseIds);
Result<List<HouseInfoDTO>> queryListHouseInfo(@RequestBody Set<String> houseIds, @RequestParam("customerId") String customerId);

4
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java

@ -276,8 +276,8 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient {
}
@Override
public Result<List<HouseInfoDTO>> queryListHouseInfo(Set<String> houseIds) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "queryListHouseInfo", houseIds);
public Result<List<HouseInfoDTO>> queryListHouseInfo(Set<String> houseIds ,String customerId) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "queryListHouseInfo", houseIds, customerId);
}
@Override

4
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java

@ -229,7 +229,7 @@ public class HouseController implements ResultDataResolver {
}
@PostMapping( "queryListHouseInfo")
Result<List<HouseInfoDTO>> queryListHouseInfo(@RequestBody Set<String> houseIds){
return new Result<List<HouseInfoDTO>>().ok(houseService.queryListHouseInfo(houseIds));
Result<List<HouseInfoDTO>> queryListHouseInfo(@RequestBody Set<String> houseIds, @RequestParam("customerId") String customerId){
return new Result<List<HouseInfoDTO>>().ok(houseService.queryListHouseInfo(houseIds,customerId));
}
}

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java

@ -59,6 +59,8 @@ public interface IcHouseDao extends BaseDao<IcHouseEntity> {
List<HouseInfoDTO> queryHouseInfo(@Param("houseIdList") Set<String> houseIdList);
HouseInfoDTO queryHouseInfoByHouseId(@Param("houseId") String houseId);
/**
* @Description 查询房屋信息
* @param idCard

35
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/redis/IcHouseRedis.java

@ -17,9 +17,17 @@
package com.epmet.redis;
import cn.hutool.core.bean.BeanUtil;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.IcHouseDao;
import com.epmet.dto.result.HouseInfoDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.util.Map;
/**
* 房屋信息
@ -32,6 +40,9 @@ public class IcHouseRedis {
@Autowired
private RedisUtils redisUtils;
@Autowired
private IcHouseDao icHouseDao;
public void delete(Object[] ids) {
}
@ -44,4 +55,28 @@ public class IcHouseRedis {
return null;
}
/**
* @Description 往缓存放房屋信息
* @param houseId
* @param map
* @author zxc
* @date 2022/1/18 3:55 下午
*/
public void setHouseInfo(String houseId, Map<String, Object> map,String customerId){
String key = RedisKeys.getHouseInfoCacheKey(houseId,customerId);
redisUtils.hMSet(key, map);
}
public HouseInfoDTO getHouseInfo(String houseId,String customerId){
String key = RedisKeys.getHouseInfoCacheKey(houseId,customerId);
Map<String, Object> map = redisUtils.hGetAll(key);
if (!CollectionUtils.isEmpty(map)){
return ConvertUtils.mapToEntity(map,HouseInfoDTO.class);
}
HouseInfoDTO houseInfo = icHouseDao.queryHouseInfoByHouseId(houseId);
Map<String, Object> result = BeanUtil.beanToMap(houseInfo, false, true);
setHouseInfo(houseId,result,houseInfo.getCustomerId());
return houseInfo;
}
}

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java

@ -61,5 +61,5 @@ public interface HouseService {
void exportBuildinginfo(ListIcNeighborHoodFormDTO formDTO, HttpServletResponse response) throws Exception;
List<HouseInfoDTO> queryListHouseInfo(Set<String> houseIds);
List<HouseInfoDTO> queryListHouseInfo(Set<String> houseIds, String customerId);
}

8
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java

@ -1387,10 +1387,10 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
IcResiUserOrgMsgResultDTO resultDTO = new IcResiUserOrgMsgResultDTO();
CustomerAgencyDTO agencyDTO = ConvertUtils.sourceToTarget(baseDao.selectById(formDTO.getAgencyId()), CustomerAgencyDTO.class);
CustomerGridDTO gridDTO = ConvertUtils.sourceToTarget(customerGridDao.selectById(formDTO.getGridId()), CustomerGridDTO.class);
IcNeighborHoodDTO neighborHoodDTO = ConvertUtils.sourceToTarget(icNeighborHoodDao.selectById(formDTO.getGridId()), IcNeighborHoodDTO.class);
IcBuildingDTO buildingDTO = ConvertUtils.sourceToTarget(icBuildingDao.selectById(formDTO.getGridId()), IcBuildingDTO.class);
IcBuildingUnitDTO buildingUnitDTO = ConvertUtils.sourceToTarget(icBuildingUnitDao.selectById(formDTO.getGridId()), IcBuildingUnitDTO.class);
IcHouseDTO houseDTO = ConvertUtils.sourceToTarget(icHouseDao.selectById(formDTO.getGridId()), IcHouseDTO.class);
IcNeighborHoodDTO neighborHoodDTO = ConvertUtils.sourceToTarget(icNeighborHoodDao.selectById(formDTO.getNeighborHoodId()), IcNeighborHoodDTO.class);
IcBuildingDTO buildingDTO = ConvertUtils.sourceToTarget(icBuildingDao.selectById(formDTO.getBuildingId()), IcBuildingDTO.class);
IcBuildingUnitDTO buildingUnitDTO = ConvertUtils.sourceToTarget(icBuildingUnitDao.selectById(formDTO.getBuildingUnitId()), IcBuildingUnitDTO.class);
IcHouseDTO houseDTO = ConvertUtils.sourceToTarget(icHouseDao.selectById(formDTO.getHouseId()), IcHouseDTO.class);
resultDTO.setAgencyDTO(agencyDTO);
resultDTO.setGridDTO(gridDTO);
resultDTO.setNeighborHoodDTO(neighborHoodDTO);

16
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java

@ -1,6 +1,7 @@
package com.epmet.service.impl;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.epmet.commons.tools.constant.NumConstant;
@ -31,6 +32,11 @@ import com.epmet.enums.HouseRentFlagEnums;
import com.epmet.enums.HouseTypeEnums;
import com.epmet.excel.IcHouseExcel;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.redis.IcHouseRedis;
import com.epmet.service.HouseService;
import com.epmet.service.IcBuildingService;
import com.epmet.service.IcBuildingUnitService;
import com.epmet.service.IcHouseService;
import com.epmet.service.*;
import com.epmet.util.ExcelPoiUtils;
import lombok.extern.slf4j.Slf4j;
@ -67,6 +73,8 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver {
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired
private IcHouseRedis icHouseRedis;
@Autowired
private AgencyService agencyservice;
@ -308,10 +316,14 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver {
}*/
@Override
public List<HouseInfoDTO> queryListHouseInfo(Set<String> houseIdList) {
public List<HouseInfoDTO> queryListHouseInfo(Set<String> houseIdList, String customerId) {
if(org.apache.commons.collections4.CollectionUtils.isEmpty(houseIdList)){
return new ArrayList<>();
}
return icHouseDao.queryHouseInfo(houseIdList);
List<HouseInfoDTO> result = new ArrayList<>();
houseIdList.forEach(h -> {
result.add(icHouseRedis.getHouseInfo(h,customerId));
});
return result;
}
}

25
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml

@ -300,4 +300,29 @@
and ih.id !=#{houseId}
</if>
</select>
<select id="queryHouseInfoByHouseId" resultType="com.epmet.dto.result.HouseInfoDTO">
SELECT
ih.ID as homeId,
IFNULL(n.ADDRESS,'') as neighborAddress,
ih.NEIGHBOR_HOOD_ID as neighborHoodId,
IFNULL(n.NEIGHBOR_HOOD_NAME,'') as neighborHoodName,
ih.BUILDING_ID as buildingId,
IFNULL(ib.BUILDING_NAME,'') as buildingName,
ih.BUILDING_UNIT_ID as buildingUnitId,
IFNULL(u.UNIT_NAME,'') as unitName,
IFNULL(ih.DOOR_NAME,'') as doorName,
ih.house_type,
IFNULL(ih.HOUSE_NAME,'') as HOUSE_NAME,
IFNULL(ib.LONGITUDE,'') as buildingLongitude,
IFNULL(ib.LATITUDE,'') as buildingLatitude,
ih.CUSTOMER_ID AS customerId,
concat(IFNULL(n.NEIGHBOR_HOOD_NAME,''),IFNULL(ib.BUILDING_NAME,''),IFNULL(u.UNIT_NAME,''),IFNULL(ih.HOUSE_NAME,'')) AS allName
FROM ic_house ih
left JOIN ic_neighbor_hood n ON ( ih.NEIGHBOR_HOOD_ID = n.id )
left JOIN ic_building ib ON ( ih.BUILDING_ID = ib.id )
left JOIN ic_building_unit u ON ( ih.BUILDING_UNIT_ID = u.ID )
WHERE
ih.DEL_FLAG = '0'
AND ih.ID = #{houseId}
</select>
</mapper>

5
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcUserChangeDetailedDTO.java

@ -49,6 +49,11 @@ public class IcUserChangeDetailedDTO implements Serializable {
*/
private String icUserChangeRecordId;
/**
* 组织的所有上级Id
*/
private String pids;
/**
* 组织Id
*/

42
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcUsercategoryAnalysisFormDTO.java

@ -0,0 +1,42 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* 数字社区-人员类别分析 入参DTO
* 某个类别的迁入迁出新增类别列表
*/
@Data
public class IcUsercategoryAnalysisFormDTO implements Serializable {
public interface AddUserInternalGroup {}
public interface AddUserShowGroup extends CustomerClientShowGroup {}
@NotBlank(message = "请选择查看某个人员类别",groups =AddUserShowGroup.class )
private String categoryKey;
@NotBlank(message = "dateId不能为空",groups =AddUserInternalGroup.class )
@Length(min = 8, max = 8,message = "dateId格式:yyyyMMdd",groups =AddUserInternalGroup.class)
private String dateId;
private String type;
@NotNull(message = "页码pageNo不能为空",groups =AddUserInternalGroup.class )
private Integer pageNo;
@NotNull(message = "页量pageSize不能为空",groups =AddUserInternalGroup.class )
private Integer pageSize;
@NotBlank(message = "请选择查看某个组织或网格",groups =AddUserShowGroup.class )
private String orgId;
@NotBlank(message = "orgType不能为空",groups =AddUserInternalGroup.class )
private String orgType;
private String startDate;
private String endDate;
}

33
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcUsercategoryAnalysisResultDTO.java

@ -0,0 +1,33 @@
package com.epmet.dto.result;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 人员类别分析
* 列表返参
*/
@Data
public class IcUsercategoryAnalysisResultDTO implements Serializable {
private static final long serialVersionUID = 8071180665763717817L;
private String icUserId;
private String name;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
private Date changeTime;
private String typeName;
private String type;
private String gridName;
private String address;
// @JsonIgnore
private String buildingId;
// @JsonIgnore
private String gridId;
// @JsonIgnore
private Integer value;
// @JsonIgnore
private String fieldName;
}

7
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PersonWarnRightListResultDTO.java

@ -1,6 +1,7 @@
package com.epmet.dto.result;
import com.epmet.commons.tools.constant.NumConstant;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
@ -39,6 +40,9 @@ public class PersonWarnRightListResultDTO implements Serializable {
*/
private String gridName;
@JsonIgnore
private String gridId;
/**
* 姓名
*/
@ -49,6 +53,9 @@ public class PersonWarnRightListResultDTO implements Serializable {
*/
private String family;
@JsonIgnore
private String homeId;
/**
* 电话
*/

14
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcUserChangeRecordController.java

@ -17,11 +17,14 @@
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.IcResiUserChangeRecordFormDTO;
import com.epmet.dto.form.IcResiUserTransferFormDTO;
import com.epmet.dto.form.IcUsercategoryAnalysisFormDTO;
import com.epmet.dto.result.IcUserChangeRecordResultDTO;
import com.epmet.dto.result.IcUsercategoryAnalysisResultDTO;
import com.epmet.service.IcUserChangeRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
@ -53,4 +56,15 @@ public class IcUserChangeRecordController {
return new Result<IcUserChangeRecordResultDTO>().ok(icUserChangeRecordService.list(formDTO));
}
/**
* 人员类别分析
* @param formDTO
* @return
*/
// /epmetuser/icuserchangerecord/category-analysis-list
@PostMapping("category-analysis-list")
public Result<PageData<IcUsercategoryAnalysisResultDTO>> categoryAnalysisList(@RequestBody IcUsercategoryAnalysisFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO,IcUsercategoryAnalysisFormDTO.AddUserShowGroup.class,IcUsercategoryAnalysisFormDTO.AddUserInternalGroup.class);
return new Result<PageData<IcUsercategoryAnalysisResultDTO>>().ok(icUserChangeRecordService.categoryAnalysisList(formDTO));
}
}

2
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java

@ -231,4 +231,6 @@ public interface IcResiUserDao extends BaseDao<IcResiUserEntity> {
List<VolunteerDistributionResultDTO.Distribution> listIcResiInfosByUserIds(@Param("userIds") List<String> userIds);
Map<String, String> getCategoryListMap(@Param("icUserId") String icUserId);
List<Map<String,Object>> selectResiUsers(@Param("types")List<String> types,@Param("orgId")String orgId);
}

4
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcUserChangeRecordDao.java

@ -19,6 +19,8 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.IcUserChangeRecordDTO;
import com.epmet.dto.form.IcUsercategoryAnalysisFormDTO;
import com.epmet.dto.result.IcUsercategoryAnalysisResultDTO;
import com.epmet.entity.IcUserChangeRecordEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -39,4 +41,6 @@ public interface IcUserChangeRecordDao extends BaseDao<IcUserChangeRecordEntity>
* @Description 查询居民变更记录
**/
List<IcUserChangeRecordDTO> getList(@Param("icUserId") String icUserId);
List<IcUsercategoryAnalysisResultDTO> categoryAnalysisList(IcUsercategoryAnalysisFormDTO formDTO);
}

5
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcUserChangeDetailedEntity.java

@ -46,6 +46,11 @@ public class IcUserChangeDetailedEntity extends BaseEpmetEntity {
*/
private String icUserChangeRecordId;
/**
* 组织的所有上级Id
*/
private String pids;
/**
* 组织Id
*/

10
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcUserChangeRecordService.java

@ -18,8 +18,11 @@
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.form.IcResiUserChangeRecordFormDTO;
import com.epmet.dto.form.IcUsercategoryAnalysisFormDTO;
import com.epmet.dto.result.IcUserChangeRecordResultDTO;
import com.epmet.dto.result.IcUsercategoryAnalysisResultDTO;
import com.epmet.entity.IcUserChangeRecordEntity;
/**
@ -35,4 +38,11 @@ public interface IcUserChangeRecordService extends BaseService<IcUserChangeRecor
* @Description 基础信息变更记录
**/
IcUserChangeRecordResultDTO list(IcResiUserChangeRecordFormDTO formDTO);
/**
* 人员类别分析
* @param formDTO
* @return
*/
PageData<IcUsercategoryAnalysisResultDTO> categoryAnalysisList(IcUsercategoryAnalysisFormDTO formDTO);
}

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

@ -40,6 +40,7 @@ import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
@ -254,6 +255,10 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
if (!resultList.success()) {
throw new RuntimeException("人员新增,获取客户居民类别预警配置表数据失败");
}
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(map.get("AGENCY_ID"));
if (null == agencyInfo) {
throw new EpmetException(String.format("查询组织信息失败%s", map.get("AGENCY_ID")));
}
IcUserChangeDetailedEntity outEntity = null;
for (IcResiCategoryWarnConfigDTO cf : resultList.getData()) {
if (map.containsKey(cf.getColumnName()) && "1".equals(map.get(cf.getColumnName()))) {
@ -261,6 +266,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
outEntity = new IcUserChangeDetailedEntity();
outEntity.setCustomerId(tokenDto.getCustomerId());
outEntity.setIcUserChangeRecordId(icUserChangeRecordId);
outEntity.setPids(agencyInfo.getPids());
outEntity.setAgencyId(map.get("AGENCY_ID"));
outEntity.setGridId(map.get("GRID_ID"));
outEntity.setNeighborHoodId(map.get("VILLAGE_ID"));
@ -354,7 +360,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
* @Description 居民信息修改--生成变更记录和变更明细
**/
private void icUserChangeRecord(TokenDto tokenDto, IcResiUserEntity entity, LinkedHashMap<String, String> map) {
Date date = (Date) new java.util.Date();
java.util.Date date = new java.util.Date();
//1.判断维度数据是否修改【网格、小区、楼栋、单元、房间有变化则先走人员调动逻辑】
if ((map.containsKey("GRID_ID") && !entity.getGridId().equals(map.get("GRID_ID"))) || (map.containsKey("VILLAGE_ID") && !entity.getVillageId().equals(map.get("VILLAGE_ID")))
|| (map.containsKey("BUILD_ID") && !entity.getBuildId().equals(map.get("BUILD_ID"))) || (map.containsKey("UNIT_ID") && !entity.getUnitId().equals(map.get("UNIT_ID")))
@ -399,6 +405,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
//变更明细里边存修改后的新值,是就存1否就存-1
categoryEntity = new IcUserChangeDetailedEntity();
categoryEntity.setCustomerId(tokenDto.getCustomerId());
categoryEntity.setPids(entity.getPids());
categoryEntity.setAgencyId(entity.getAgencyId());
categoryEntity.setGridId(map.containsKey("GRID_ID") ? map.get("GRID_ID") : entity.getGridId());
categoryEntity.setNeighborHoodId(map.containsKey("VILLAGE_ID") ? map.get("VILLAGE_ID") : entity.getVillageId());
@ -413,22 +420,25 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
list.add(categoryEntity);
}
}
//变更记录
CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId());
changeRecordEntity.setCustomerId(tokenDto.getCustomerId());
changeRecordEntity.setOperatorId(tokenDto.getUserId());
changeRecordEntity.setIcUserId(entity.getId());
changeRecordEntity.setOperatorName(staffInfoCache.getRealName());
changeRecordEntity.setIcUserName(map.containsKey("NAME") ? map.get("NAME") : entity.getName());
changeRecordEntity.setType("category");
changeRecordEntity.setTypeName("类别");
changeRecordEntity.setBeforeChangeName(beforeChangeName.toString());
changeRecordEntity.setAfterChangeName(afterChangeName.toString());
changeRecordEntity.setChangeTime(date);
icUserChangeRecordService.insert(changeRecordEntity);
list.forEach(l -> l.setIcUserChangeRecordId(changeRecordEntity.getId()));
icUserChangeDetailedService.insertBatch(list);
//居民信息修改中有类别修改的才会生成变更记录和变更明细
if (list.size() > NumConstant.ZERO) {
//变更记录
CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId());
changeRecordEntity.setCustomerId(tokenDto.getCustomerId());
changeRecordEntity.setOperatorId(tokenDto.getUserId());
changeRecordEntity.setIcUserId(entity.getId());
changeRecordEntity.setOperatorName(staffInfoCache.getRealName());
changeRecordEntity.setIcUserName(map.containsKey("NAME") ? map.get("NAME") : entity.getName());
changeRecordEntity.setType("category");
changeRecordEntity.setTypeName("类别");
changeRecordEntity.setBeforeChangeName(beforeChangeName.toString());
changeRecordEntity.setAfterChangeName(afterChangeName.toString());
changeRecordEntity.setChangeTime(date);
icUserChangeRecordService.insert(changeRecordEntity);
list.forEach(l -> l.setIcUserChangeRecordId(changeRecordEntity.getId()));
icUserChangeDetailedService.insertBatch(list);
}
}
/**
@ -526,7 +536,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
Map<String, AllGridsByUserIdResultDTO> gridInfoMap = gridInfoList.stream().collect(Collectors.toMap(AllGridsByUserIdResultDTO::getGridId, Function.identity()));
//查询房子名称
Result<List<HouseInfoDTO>> houseInfoRes=govOrgOpenFeignClient.queryListHouseInfo(houseIds);
Result<List<HouseInfoDTO>> houseInfoRes=govOrgOpenFeignClient.queryListHouseInfo(houseIds,formDTO.getCustomerId());
List<HouseInfoDTO> houseInfoDTOList = houseInfoRes.success() && !CollectionUtils.isEmpty(houseInfoRes.getData()) ? houseInfoRes.getData() : new ArrayList<>();
Map<String, HouseInfoDTO> houseInfoMap = houseInfoDTOList.stream().collect(Collectors.toMap(HouseInfoDTO::getHomeId, Function.identity()));
for (Map<String, Object> resultMap : list) {
@ -1099,7 +1109,68 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
*/
@Override
public PersonWarnRightListResultDTO personWarnRightList(PersonWarnRightListFormDTO formDTO, TokenDto tokenDto) {
return null;
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId());
if (null == staffInfo){
throw new EpmetException(String.format("未查询到此工作人员信息%s",tokenDto.getUserId()));
}
Result<List<CustomerCategoryShowAndWarnListResultDTO>> configListResult = operCustomizeOpenFeignClient.getCustomerCategoryShowAndWarnList(tokenDto.getCustomerId());
if (!configListResult.success()){
throw new EpmetException("查询居民分类配置失败...");
}
PersonWarnRightListResultDTO result = new PersonWarnRightListResultDTO();
if (CollectionUtils.isEmpty(configListResult.getData())){
return result;
}
List<CustomerCategoryShowAndWarnListResultDTO> configList = configListResult.getData();
PageInfo<Map<String, Object>> pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.selectResiUsers(configList.stream().map(m -> m.getColumnName()).collect(Collectors.toList()), staffInfo.getAgencyId()));
List<Map<String, Object>> list = pageInfo.getList();
if (CollectionUtils.isEmpty(list)) {
return result;
}
result.setTotal(Integer.valueOf(String.valueOf(pageInfo.getTotal())));
List<PersonWarnRightListResultDTO.PersonWarnRightList> userList = disposeCategory(list, configList);
Result<List<HouseInfoDTO>> houseInfosResult = govOrgOpenFeignClient.queryListHouseInfo(userList.stream().distinct().map(m -> m.getHomeId()).collect(Collectors.toSet()),tokenDto.getCustomerId());
if (!houseInfosResult.success()){
throw new EpmetException("查询房屋信息失败...");
}
List<HouseInfoDTO> houseInfos = houseInfosResult.getData();
userList.forEach(u -> houseInfos.stream().filter(h -> h.getHomeId().equals(u.getHomeId())).forEach(h -> u.setFamily(h.getAllName())));
result.setList(userList);
return result;
}
/**
* @Description 居民分类 网格名 处理
* @param list
* @param configList
* @author zxc
* @date 2022/1/18 3:22 下午
*/
public List<PersonWarnRightListResultDTO.PersonWarnRightList> disposeCategory(List<Map<String, Object>> list,List<CustomerCategoryShowAndWarnListResultDTO> configList){
List<PersonWarnRightListResultDTO.PersonWarnRightList> userList = new ArrayList<>();
list.forEach(l -> {
PersonWarnRightListResultDTO.PersonWarnRightList dto = ConvertUtils.mapToEntity(l, PersonWarnRightListResultDTO.PersonWarnRightList.class);
// 分类名字
List<String> types = new ArrayList<>();
configList.forEach(c -> {
l.forEach((k,v) -> {
if (c.getColumnName().equals(k) && null != v && v.equals(NumConstant.ONE_STR)){
types.add(c.getLabel());
}
});
});
// 只显示有类别的居民
if (CollectionUtils.isNotEmpty(types)){
dto.setType(types);
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(dto.getGridId());
if (null == gridInfo){
throw new EpmetException(String.format("查询网格信息失败%s",dto.getGridId()));
}
dto.setGridName(gridInfo.getGridNamePath());
userList.add(dto);
}
});
return userList;
}
/**

63
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserChangeRecordServiceImpl.java

@ -18,17 +18,34 @@
package com.epmet.service.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.IcUserChangeRecordDao;
import com.epmet.dto.IcUserChangeRecordDTO;
import com.epmet.dto.form.IcResiUserChangeRecordFormDTO;
import com.epmet.dto.form.IcUsercategoryAnalysisFormDTO;
import com.epmet.dto.result.AllGridsByUserIdResultDTO;
import com.epmet.dto.result.BuildingResultDTO;
import com.epmet.dto.result.IcUserChangeRecordResultDTO;
import com.epmet.dto.result.IcUsercategoryAnalysisResultDTO;
import com.epmet.entity.IcUserChangeRecordEntity;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.service.IcUserChangeRecordService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 居民变更记录表
*
@ -37,6 +54,9 @@ import org.springframework.util.CollectionUtils;
*/
@Service
public class IcUserChangeRecordServiceImpl extends BaseServiceImpl<IcUserChangeRecordDao, IcUserChangeRecordEntity> implements IcUserChangeRecordService {
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
/**
* @Author sun
@ -55,4 +75,47 @@ public class IcUserChangeRecordServiceImpl extends BaseServiceImpl<IcUserChangeR
return resultDTO;
}
/**
* 人员类别分析
*
* @param formDTO
* @return
*/
@Override
public PageData<IcUsercategoryAnalysisResultDTO> categoryAnalysisList(IcUsercategoryAnalysisFormDTO formDTO) {
formDTO.setEndDate(formDTO.getDateId());
String monthId = formDTO.getDateId().substring(NumConstant.ZERO, NumConstant.SIX);
formDTO.setStartDate(monthId.concat("01"));
PageInfo<IcUsercategoryAnalysisResultDTO> pageInfo = PageHelper.startPage(formDTO.getPageNo(),
formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.categoryAnalysisList(formDTO));
List<IcUsercategoryAnalysisResultDTO> list = pageInfo.getList();
if (!CollectionUtils.isEmpty(list)) {
//获取网格信息
Set<String> gridIds = list.stream().map(IcUsercategoryAnalysisResultDTO::getGridId).collect(Collectors.toSet());
Result<List<AllGridsByUserIdResultDTO>> gridInfoRes = govOrgOpenFeignClient.getGridListByGridIds(new ArrayList<>(gridIds));
List<AllGridsByUserIdResultDTO> gridInfoList = gridInfoRes.success() && !org.apache.commons.collections4.CollectionUtils.isEmpty(gridInfoRes.getData()) ? gridInfoRes.getData() : new ArrayList<>();
Map<String, AllGridsByUserIdResultDTO> gridInfoMap = gridInfoList.stream().collect(Collectors.toMap(AllGridsByUserIdResultDTO::getGridId, Function.identity()));
//获取楼栋信息
Set<String> buildingIds = list.stream().map(IcUsercategoryAnalysisResultDTO::getBuildingId).collect(Collectors.toSet());
Result<List<BuildingResultDTO>> buildRes = govOrgOpenFeignClient.buildingListByIds(new ArrayList<>(buildingIds));
List<BuildingResultDTO> buildInfoList = buildRes.success() && !org.apache.commons.collections4.CollectionUtils.isEmpty(buildRes.getData()) ? buildRes.getData() : new ArrayList<>();
Map<String, BuildingResultDTO> buildInfoMap = buildInfoList.stream().collect(Collectors.toMap(BuildingResultDTO::getBuildingId, Function.identity()));
list.forEach(resultDto -> {
//赋值小区名+楼栋名
if (null != buildInfoMap && buildInfoMap.containsKey(resultDto.getBuildingId())) {
resultDto.setAddress(buildInfoMap.get(resultDto.getBuildingId()).getNeighborhoodName().concat(buildInfoMap.get(resultDto.getBuildingId()).getBuildingName()));
} else {
resultDto.setAddress(StrConstant.EPMETY_STR);
}
//赋值XXX-xxx网格名
if (null != gridInfoMap && gridInfoMap.containsKey(resultDto.getGridId())) {
resultDto.setGridName(gridInfoMap.get(resultDto.getGridId()).getGridName());
} else {
resultDto.setGridName(StrConstant.EPMETY_STR);
}
});
}
return new PageData<>(list, pageInfo.getTotal());
}
}

87
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserTransferRecordServiceImpl.java

@ -19,8 +19,11 @@ package com.epmet.service.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.IcResiUserDao;
import com.epmet.dao.IcUserTransferRecordDao;
@ -98,22 +101,24 @@ public class IcUserTransferRecordServiceImpl extends BaseServiceImpl<IcUserTrans
}
//3.查询人员调动后的组织、网格、小区、楼栋、单元、房屋信息
IcResiUserOrgMsgFormDTO orgMsgFormDTO2 = new IcResiUserOrgMsgFormDTO();
orgMsgFormDTO2.setCustomerId(formDTO.getCustomerId());
orgMsgFormDTO2.setAgencyId(formDTO.getNewAgencyId());
orgMsgFormDTO2.setGridId(formDTO.getNewGridId());
orgMsgFormDTO2.setNeighborHoodId(formDTO.getNewNeighborHoodId());
orgMsgFormDTO2.setBuildingId(formDTO.getNewBuildingId());
orgMsgFormDTO2.setBuildingUnitId(formDTO.getNewBuildingUnitId());
orgMsgFormDTO2.setHouseId(formDTO.getNewHouseId());
Result<IcResiUserOrgMsgResultDTO> result2 = govOrgOpenFeignClient.icResiUserOrgMsg(orgMsgFormDTO2);
if (!result2.success() || null == result2.getData().getAgencyDTO() || null == result2.getData().getGridDTO() || null == result2.getData().getNeighborHoodDTO()
|| null == result2.getData().getBuildingDTO() || null == result2.getData().getBuildingUnitDTO() || null == result2.getData().getHouseDTO()) {
log.warn("查找被调动人调动后的组织、网格、小区、楼栋、单元、房屋信息失败");
throw new RenException("9000", "获取被调动人基础信息失败");
Result<IcResiUserOrgMsgResultDTO> result2 = new Result<>();
if("in".equals(formDTO.getType())){
IcResiUserOrgMsgFormDTO orgMsgFormDTO2 = new IcResiUserOrgMsgFormDTO();
orgMsgFormDTO2.setCustomerId(formDTO.getCustomerId());
orgMsgFormDTO2.setAgencyId(formDTO.getNewAgencyId());
orgMsgFormDTO2.setGridId(formDTO.getNewGridId());
orgMsgFormDTO2.setNeighborHoodId(formDTO.getNewNeighborHoodId());
orgMsgFormDTO2.setBuildingId(formDTO.getNewBuildingId());
orgMsgFormDTO2.setBuildingUnitId(formDTO.getNewBuildingUnitId());
orgMsgFormDTO2.setHouseId(formDTO.getNewHouseId());
result2 = govOrgOpenFeignClient.icResiUserOrgMsg(orgMsgFormDTO2);
if (!result2.success() || null == result2.getData().getAgencyDTO() || null == result2.getData().getGridDTO() || null == result2.getData().getNeighborHoodDTO()
|| null == result2.getData().getBuildingDTO() || null == result2.getData().getBuildingUnitDTO() || null == result2.getData().getHouseDTO()) {
log.warn("查找被调动人调动后的组织、网格、小区、楼栋、单元、房屋信息失败");
throw new RenException("9000", "获取被调动人基础信息失败");
}
}
//4.修改被调动人所属各维度信息或人员状态信息
if (formDTO.getIdEdit()) {
IcResiUserEntity userEntity = new IcResiUserEntity();
@ -156,10 +161,12 @@ public class IcUserTransferRecordServiceImpl extends BaseServiceImpl<IcUserTrans
.append(result1.getData().getNeighborHoodDTO().getNeighborHoodName()).append("-").append(result1.getData().getBuildingDTO().getBuildingName()).append("-")
.append(result1.getData().getBuildingUnitDTO().getUnitName()).append("-").append(result1.getData().getHouseDTO().getHouseName());
changeRecordEntity.setBeforeChangeName(beforeName.toString());
StringBuffer afterName = new StringBuffer();
afterName.append(result2.getData().getAgencyDTO().getOrganizationName()).append("-").append(result2.getData().getGridDTO().getGridName()).append("-")
.append(result2.getData().getNeighborHoodDTO().getNeighborHoodName()).append("-").append(result2.getData().getBuildingDTO().getBuildingName()).append("-")
.append(result2.getData().getBuildingUnitDTO().getUnitName()).append("-").append(result2.getData().getHouseDTO().getHouseName());
StringBuffer afterName = new StringBuffer("-");
if ("in".equals(formDTO.getType())) {
afterName.append(result2.getData().getAgencyDTO().getOrganizationName()).append("-").append(result2.getData().getGridDTO().getGridName()).append("-")
.append(result2.getData().getNeighborHoodDTO().getNeighborHoodName()).append("-").append(result2.getData().getBuildingDTO().getBuildingName()).append("-")
.append(result2.getData().getBuildingUnitDTO().getUnitName()).append("-").append(result2.getData().getHouseDTO().getHouseName());
}
changeRecordEntity.setAfterChangeName(afterName.toString());
changeRecordEntity.setChangeTime(formDTO.getTransferTime());
changeRecordEntity.setRemark(formDTO.getRemark());
@ -186,35 +193,36 @@ public class IcUserTransferRecordServiceImpl extends BaseServiceImpl<IcUserTrans
recordEntity.setIcUserName(resiUserDTO.getName());
recordEntity.setOperatorName(null == staffInfoCache ? "" : staffInfoCache.getRealName());
recordEntity.setOldCustomerId(formDTO.getCustomerId());
if ("in".equals(formDTO.getType())) {
recordEntity.setNewCustomerId(resiUserDTO.getCustomerId());
}
recordEntity.setOldAgencyId(resiUserDTO.getAgencyId());
recordEntity.setNewAgencyId(formDTO.getNewAgencyId());
recordEntity.setOldAgencyName(result1.getAgencyDTO().getOrganizationName());
recordEntity.setNewAgencyName(result2.getAgencyDTO().getOrganizationName());
recordEntity.setOldGridId(resiUserDTO.getGridId());
recordEntity.setNewGridId(formDTO.getNewGridId());
recordEntity.setOldGridName(result1.getGridDTO().getGridName());
recordEntity.setNewGridName(result2.getGridDTO().getGridName());
recordEntity.setOldNeighborHoodId(resiUserDTO.getVillageId());
recordEntity.setNewNeighborHoodId(formDTO.getNewNeighborHoodId());
recordEntity.setOldNeighborHoodName(result1.getNeighborHoodDTO().getNeighborHoodName());
recordEntity.setNewNeighborHoodName(result2.getNeighborHoodDTO().getNeighborHoodName());
recordEntity.setOldBuildingId(resiUserDTO.getBuildId());
recordEntity.setNewBuildingId(formDTO.getNewBuildingId());
recordEntity.setOldBuildingName(result1.getBuildingDTO().getBuildingName());
recordEntity.setNewBuildingName(result2.getBuildingDTO().getBuildingName());
recordEntity.setOldBuildingUnitId(resiUserDTO.getUnitId());
recordEntity.setNewBuildingUnitId(formDTO.getNewBuildingUnitId());
recordEntity.setOldBuildingUnitName(result1.getBuildingUnitDTO().getUnitName());
recordEntity.setNewBuildingUnitName(result2.getBuildingUnitDTO().getUnitName());
recordEntity.setOldHouseId(resiUserDTO.getHomeId());
recordEntity.setNewHouseId(formDTO.getNewHouseId());
recordEntity.setOldHouseName(result1.getHouseDTO().getHouseName());
recordEntity.setNewHouseName(result2.getHouseDTO().getHouseName());
recordEntity.setTransferTime(formDTO.getTransferTime());
recordEntity.setRemark(formDTO.getRemark());
if ("in".equals(formDTO.getType())) {
recordEntity.setNewCustomerId(resiUserDTO.getCustomerId());
recordEntity.setNewAgencyId(formDTO.getNewAgencyId());
recordEntity.setNewAgencyName(result2.getAgencyDTO().getOrganizationName());
recordEntity.setNewGridId(formDTO.getNewGridId());
recordEntity.setNewGridName(result2.getGridDTO().getGridName());
recordEntity.setNewNeighborHoodId(formDTO.getNewNeighborHoodId());
recordEntity.setNewNeighborHoodName(result2.getNeighborHoodDTO().getNeighborHoodName());
recordEntity.setNewBuildingId(formDTO.getNewBuildingId());
recordEntity.setNewBuildingName(result2.getBuildingDTO().getBuildingName());
recordEntity.setNewBuildingUnitId(formDTO.getNewBuildingUnitId());
recordEntity.setNewBuildingUnitName(result2.getBuildingUnitDTO().getUnitName());
recordEntity.setNewHouseId(formDTO.getNewHouseId());
recordEntity.setNewHouseName(result2.getHouseDTO().getHouseName());
}
return recordEntity;
}
@ -226,12 +234,24 @@ public class IcUserTransferRecordServiceImpl extends BaseServiceImpl<IcUserTrans
List<IcUserChangeDetailedEntity> list = new ArrayList<>();
IcUserChangeDetailedEntity outEntity = null;
IcUserChangeDetailedEntity inEntity = null;
AgencyInfoCache oldAgencyInfo = CustomerOrgRedis.getAgencyInfo(resiUserDTO.getAgencyId());
if (null == oldAgencyInfo) {
throw new EpmetException(String.format("查询组织信息失败%s", resiUserDTO.getAgencyId()));
}
AgencyInfoCache newAgencyInfo = new AgencyInfoCache();
if ("in".equals(formDTO.getType())) {
newAgencyInfo = CustomerOrgRedis.getAgencyInfo(formDTO.getNewAgencyId());
if (null == newAgencyInfo) {
throw new EpmetException(String.format("查询组织信息失败%s", formDTO.getNewAgencyId()));
}
}
for (IcResiCategoryWarnConfigDTO cf : configList) {
if ("1".equals(map.get(cf.getColumnName()))) {
//迁出
outEntity = new IcUserChangeDetailedEntity();
outEntity.setCustomerId(formDTO.getCustomerId());
outEntity.setIcUserChangeRecordId(icUserChangeRecordId);
outEntity.setPids(oldAgencyInfo.getPids());
outEntity.setAgencyId(resiUserDTO.getAgencyId());
outEntity.setGridId(resiUserDTO.getGridId());
outEntity.setNeighborHoodId(resiUserDTO.getVillageId());
@ -249,6 +269,7 @@ public class IcUserTransferRecordServiceImpl extends BaseServiceImpl<IcUserTrans
inEntity = new IcUserChangeDetailedEntity();
inEntity.setCustomerId(formDTO.getCustomerId());
inEntity.setIcUserChangeRecordId(icUserChangeRecordId);
inEntity.setPids(newAgencyInfo.getPids());
inEntity.setAgencyId(formDTO.getNewAgencyId());
inEntity.setGridId(formDTO.getNewGridId());
inEntity.setNeighborHoodId(formDTO.getNewNeighborHoodId());

96
epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.23__ic_user_transfer_and_change.sql

@ -0,0 +1,96 @@
ALTER TABLE `ic_resi_user`
ADD COLUMN `STATUS` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '用户状态【0:正常 1:转出】' AFTER `JTXX_REMAKES`;
ALTER TABLE `ic_resi_user`
DROP INDEX `customer_idcard_unique`;
CREATE TABLE `ic_user_transfer_record` (
`ID` varchar(64) NOT NULL COMMENT '唯一标识',
`IC_USER_ID` varchar(64) NOT NULL COMMENT '被调动人Id【ic_resi_user表id】',
`OPERATOR_ID` varchar(64) NOT NULL COMMENT '调动(工作)人员Id【customer_staff表userId】',
`IC_USER_NAME` varchar(64) NOT NULL COMMENT '被调动人名称【ic_resi_user表name】',
`OPERATOR_NAME` varchar(64) NOT NULL COMMENT '调动(工作)人员名称【customer_staff表real_name】',
`OLD_CUSTOMER_ID` varchar(64) NOT NULL COMMENT '调动前客户Id',
`NEW_CUSTOMER_ID` varchar(64) DEFAULT NULL COMMENT '调动后客户Id',
`OLD_AGENCY_ID` varchar(64) DEFAULT NULL COMMENT '调动前组织Id',
`NEW_AGENCY_ID` varchar(64) DEFAULT NULL COMMENT '调动后组织Id',
`OLD_AGENCY_NAME` varchar(64) DEFAULT NULL COMMENT '调动前组织名称',
`NEW_AGENCY_NAME` varchar(255) DEFAULT NULL COMMENT '调动后组织名称',
`OLD_GRID_ID` varchar(64) DEFAULT NULL COMMENT '调动前网格Id',
`NEW_GRID_ID` varchar(64) DEFAULT NULL COMMENT '调动后网格Id',
`OLD_GRID_NAME` varchar(255) DEFAULT NULL COMMENT '调动前网格名称',
`NEW_GRID_NAME` varchar(255) DEFAULT NULL COMMENT '调动后网格名称',
`OLD_NEIGHBOR_HOOD_ID` varchar(64) DEFAULT NULL COMMENT '调动前小区Id',
`NEW_NEIGHBOR_HOOD_ID` varchar(64) DEFAULT NULL COMMENT '调动后小区Id',
`OLD_NEIGHBOR_HOOD_NAME` varchar(255) DEFAULT NULL COMMENT '调动前小区名称',
`NEW_NEIGHBOR_HOOD_NAME` varchar(255) DEFAULT NULL COMMENT '调动后小区名称',
`OLD_BUILDING_ID` varchar(64) DEFAULT NULL COMMENT '调动前楼栋Id',
`NEW_BUILDING_ID` varchar(64) DEFAULT NULL COMMENT '调动后楼栋Id',
`OLD_BUILDING_NAME` varchar(255) DEFAULT NULL COMMENT '调动前楼栋名称',
`NEW_BUILDING_NAME` varchar(255) DEFAULT NULL COMMENT '调动后楼栋名称',
`OLD_BUILDING_UNIT_ID` varchar(64) DEFAULT NULL COMMENT '调动前单元Id',
`NEW_BUILDING_UNIT_ID` varchar(64) DEFAULT NULL COMMENT '调动后单元Id',
`OLD_BUILDING_UNIT_NAME` varchar(255) DEFAULT NULL COMMENT '调动前单元名称',
`NEW_BUILDING_UNIT_NAME` varchar(255) DEFAULT NULL COMMENT '调动后单元名称',
`OLD_HOUSE_ID` varchar(64) DEFAULT NULL COMMENT '调动前房屋Id',
`NEW_HOUSE_ID` varchar(64) DEFAULT NULL COMMENT '调动后房屋Id',
`OLD_HOUSE_NAME` varchar(255) DEFAULT NULL COMMENT '调动前房屋名称',
`NEW_HOUSE_NAME` varchar(255) DEFAULT NULL COMMENT '调动后房屋名称',
`TRANSFER_TIME` datetime NOT NULL COMMENT '调动时间',
`REMARK` varchar(512) DEFAULT NULL COMMENT '备注说明',
`DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标识',
`REVISION` int(10) NOT NULL COMMENT '乐观锁',
`CREATED_BY` varchar(32) NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='居民调动记录表';
CREATE TABLE `ic_user_change_record` (
`ID` varchar(64) NOT NULL COMMENT '唯一标识',
`IC_USER_TRANSFER_RECORD_ID` varchar(64) DEFAULT NULL COMMENT '调动表Id【只有调动记录此列才有值】',
`CUSTOMER_ID` varchar(64) DEFAULT NULL COMMENT '当前所属客户Id[迁出客户的此列没值]',
`OPERATOR_ID` varchar(64) NOT NULL COMMENT '操作人Id【customer_staff表userId】',
`IC_USER_ID` varchar(64) NOT NULL COMMENT '被操作人Id【ic_resi_user表id】',
`OPERATOR_NAME` varchar(64) NOT NULL COMMENT '操作人名称【customer_staff表real_name】',
`IC_USER_NAME` varchar(64) NOT NULL COMMENT '被操作人名称【ic_resi_user表name】',
`TYPE` varchar(64) NOT NULL COMMENT '操作类型【add:新增 category:类别 transfer:调动】',
`TYPE_NAME` varchar(64) NOT NULL COMMENT '操作类型名称【add:新增 category:类别 transfer:调动】',
`BEFORE_CHANGE_NAME` varchar(512) DEFAULT NULL COMMENT '变更前文字描述',
`AFTER_CHANGE_NAME` varchar(512) DEFAULT NULL COMMENT '变更后文字描述',
`CHANGE_TIME` datetime NOT NULL COMMENT '调整时间',
`REMARK` varchar(512) DEFAULT NULL COMMENT '备注说明',
`DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标识',
`REVISION` int(10) NOT NULL COMMENT '乐观锁',
`CREATED_BY` varchar(32) NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='居民变更记录表';
CREATE TABLE `ic_user_change_detailed` (
`ID` varchar(64) NOT NULL COMMENT '唯一标识',
`CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户Id',
`IC_USER_CHANGE_RECORD_ID` varchar(64) NOT NULL COMMENT '变更记录表主键【ic_user_change_record.id】',
`AGENCY_ID` varchar(64) NOT NULL COMMENT '组织Id',
`GRID_ID` varchar(64) NOT NULL COMMENT '网格Id',
`NEIGHBOR_HOOD_ID` varchar(64) NOT NULL COMMENT '小区Id',
`BUILDING_ID` varchar(64) NOT NULL COMMENT '楼栋Id',
`BUILDING_UNIT_ID` varchar(64) NOT NULL COMMENT '单元Id',
`HOUSE_ID` varchar(64) NOT NULL COMMENT '房屋Id',
`IC_USER_ID` varchar(64) NOT NULL COMMENT '变更人Id',
`TYPE` varchar(255) NOT NULL COMMENT '操作类型【add:新增 category:类别 in:迁入 out:迁出】',
`TYPE_NAME` varchar(255) NOT NULL COMMENT '操作类型名称【add:新增 category:类别 in:迁入 out:迁出】',
`FIELD_NAME` varchar(64) NOT NULL COMMENT '字段名【18类对应的ic_resi_user表字段名】',
`VALUE` int(3) NOT NULL COMMENT '当前类别的值',
`DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标识',
`REVISION` int(10) NOT NULL COMMENT '乐观锁',
`CREATED_BY` varchar(32) NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='变更明细表\r\n[一条变更记录对应多条人员类别数据]';

3
epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.24__alter_change_detailed.sql

@ -0,0 +1,3 @@
ALTER TABLE `ic_user_change_detailed`
ADD COLUMN `PIDS` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT ''Id'' AFTER `IC_USER_CHANGE_RECORD_ID`;

19
epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

@ -540,5 +540,24 @@
del_flag = '0'
AND id = #{icUserId}
</select>
<select id="selectResiUsers" resultType="java.util.Map">
SELECT
ID AS userId,
GRID_ID AS gridId,
HOME_ID AS homeId,
`NAME` AS name,
MOBILE AS mobile,
<foreach collection="types" item="t" separator=",">
${t}
</foreach>
FROM ic_resi_user
WHERE DEL_FLAG = 0
AND CONCAT(PIDS,':',AGENCY_ID) LIKE CONCAT('%',#{orgId},'%')
AND(
<foreach collection="types" item="t" separator="OR">
(${t} IS NOT NULL AND ${t} != 0)
</foreach>)
ORDER BY CREATED_TIME DESC
</select>
</mapper>

29
epmet-user/epmet-user-server/src/main/resources/mapper/IcUserChangeRecordDao.xml

@ -26,4 +26,33 @@
ORDER BY change_time DESC, type ASC
</select>
<select id="categoryAnalysisList" resultType="com.epmet.dto.result.IcUsercategoryAnalysisResultDTO" parameterType="com.epmet.dto.form.IcUsercategoryAnalysisFormDTO">
select
d.IC_USER_ID as icUserId,
r.IC_USER_NAME as name,
d.CREATED_TIME as changeTime,
d.TYPE as type,
d.TYPE_NAME as typeName,
d.GRID_ID as gridId,
d.BUILDING_ID as buildingId,
d.`VALUE` as value,
d.FIELD_NAME as fieldName
from ic_user_change_detailed d
left join ic_user_change_record r
on(d.IC_USER_CHANGE_RECORD_ID=r.id and r.DEL_FLAG='0')
where d.DEL_FLAG='0'
and d.FIELD_NAME=#{categoryKey}
<if test="orgType != null and orgType !=''">
<if test="orgType == 'agency'">
and (d.AGENCY_ID=#{orgId} or d.pids like concat('%',#{orgId},'%'))
</if>
<if test="orgType == 'grid'">
and d.GRID_ID=#{orgId}
</if>
</if>
<![CDATA[ AND DATE_FORMAT( d.CREATED_TIME, '%Y%m%d' ) >= #{startDate} ]]>
<![CDATA[ AND DATE_FORMAT( d.CREATED_TIME, '%Y%m%d' ) <= #{endDate} ]]>
order by d.CREATED_TIME asc,d.id asc
</select>
</mapper>
Loading…
Cancel
Save