Browse Source

Merge branch 'master' of http://git.elinkit.com.cn:7070/r/epmet-cloud into dev_compare_data

master
wangxianzhang 3 years ago
parent
commit
4f467cd754
  1. 38
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerOrgRedis.java
  2. 1
      epmet-gateway/src/main/resources/bootstrap.yml
  3. 1
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/constant/DataSourceConstant.java
  4. 23
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/stats/UserHouseStatsQueryFormDTO.java
  5. 12
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/feign/DataReportOpenFeignClient.java
  6. 7
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/feign/impl/DataReportOpenFeignClientFallBack.java
  7. 18
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/stats/UserHouseStatsResultDTO.java
  8. 37
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/stats/UserHouseController.java
  9. 17
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/stats/FactAgencyUserHouseDailyDao.java
  10. 17
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/stats/FactGridUserHouseDailyDao.java
  11. 115
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/stats/FactAgencyUserHouseDailyEntity.java
  12. 106
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/stats/FactGridUserHouseDailyEntity.java
  13. 19
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/stats/UserHouseStatsService.java
  14. 87
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/stats/impl/UserHouseStatsServiceImpl.java
  15. 33
      epmet-module/data-report/data-report-server/src/main/resources/mapper/stats/FactAgencyUserHouseDailyDao.xml
  16. 32
      epmet-module/data-report/data-report-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml
  17. 15
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommunityUserHouseStatsFormDTO.java
  18. 15
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/UsingCommunityStatsFormDTO.java
  19. 20
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseChartResultDTO.java
  20. 20
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/SubUserHouseListResultDTO.java
  21. 21
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/UsingCommunityStatsResultDTO.java
  22. 11
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java
  23. 1
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java
  24. 16
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java
  25. 11
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java
  26. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/EnterpriseImportExcelDTO.java
  27. 5
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java
  28. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java
  29. 55
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
  30. 121
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java
  31. 29
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
  32. 3
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml
  33. 2
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/IcEventListFormDTO.java
  34. 8
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/IcEventServiceImpl.java
  35. 14
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/IcFormItemGroupDTO.java
  36. 5
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FormGroupDTO.java
  37. 3
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormController.java
  38. 10
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcFormItemGroupEntity.java
  39. 50
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormServiceImpl.java
  40. 56
      epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.40__itemgroup_code.sql
  41. 7
      epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormDao.xml
  42. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNatDTO.java
  43. 4
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddIcNatFormDTO.java
  44. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcMoveInAddEditFormDTO.java
  45. 32
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/RHZKStatisticsFormDTO.java
  46. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserChartFormDTO.java
  47. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/MyNatListResultDTO.java
  48. 13
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatListResultDTO.java
  49. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/OwnerRelationResultDTO.java
  50. 38
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/RHZKStatisticsResultDTO.java
  51. 13
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserChartResultDTO.java
  52. 4
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  53. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
  54. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserConstant.java
  55. 18
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
  56. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java
  57. 5
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatEntity.java
  58. 55
      epmet-user/epmet-user-server/src/main/java/com/epmet/enums/RenHuConditionEnum.java
  59. 3
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcNatImportExcelData.java
  60. 11
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java
  61. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java
  62. 12
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java
  63. 97
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  64. 4
      epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.89__alter_ic_nat.sql
  65. 3
      epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.90__alter_ic_move_in_record.sql
  66. 0
      epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.91__data_sync_job_create.sql
  67. BIN
      epmet-user/epmet-user-server/src/main/resources/excel/ic_nat.xlsx
  68. BIN
      epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_import_template.xls
  69. 5
      epmet-user/epmet-user-server/src/main/resources/mapper/ChangeDeathDao.xml
  70. 12
      epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml
  71. 81
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

38
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerOrgRedis.java

@ -1,7 +1,6 @@
package com.epmet.commons.tools.redis.common;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.dto.form.CustomerGridFormDTO;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.feign.CommonAggFeignClient;
@ -13,6 +12,7 @@ import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
@ -55,6 +55,10 @@ public class CustomerOrgRedis {
* @date 2021/11/5 3:12 下午
*/
public static GridInfoCache getGridInfo(String gridId){
if (StringUtils.isBlank(gridId)) {
log.warn("查询网格缓存,gridId is null");
return null;
}
String key = RedisKeys.getGridInfoKey(gridId);
Map<String, Object> grid = customerOrgRedis.redisUtils.hGetAll(key);
if (!CollectionUtils.isEmpty(grid)) {
@ -110,4 +114,36 @@ public class CustomerOrgRedis {
customerOrgRedis.redisUtils.delete(key);
}
/**
* 拼接orgIdPath
* @param orgId
* @param orgType
* @return
*/
public static String getOrgIdPath(String orgId, String orgType) {
String orgPids = null;
if ("grid".equals(orgType)) {
GridInfoCache gridInfo = getGridInfo(orgId);
if (gridInfo == null) {
log.error("查询网格信息失败:{}", orgId);
return null;
}
orgPids = gridInfo.getPids();
} else if ("agency".equals(orgType)) {
AgencyInfoCache agencyInfo = getAgencyInfo(orgId);
if (agencyInfo == null) {
log.error("查询组织信息失败:{}", orgId);
return null;
}
orgPids = agencyInfo.getPids();
}
if (StringUtils.isBlank(orgPids) || "0".equals(orgPids)) {
return orgId;
}
return orgPids.concat(":").concat(orgId);
}
}

1
epmet-gateway/src/main/resources/bootstrap.yml

@ -80,6 +80,7 @@ spring:
- Path=${server.servlet.context-path}/job/**
filters:
- StripPrefix=1
- CpAuth=true
#用户服务
- id: epmet-user-server
uri: @gateway.routes.epmet-user-server.uri@

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

@ -7,5 +7,6 @@ public interface DataSourceConstant {
*/
String EVALUATION_INDEX = "evaluationIndex";
String STATS_DISPLAY = "statsDisplay";
String STATS = "stats";
}

23
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/stats/UserHouseStatsQueryFormDTO.java

@ -0,0 +1,23 @@
package com.epmet.dto.form.stats;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
/**
* 人房信息查询dto
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserHouseStatsQueryFormDTO {
private String orgId;
private String orgType;
@NotBlank(message = "dateId不能为空")
private String dateId;
}

12
epmet-module/data-report/data-report-client/src/main/java/com/epmet/feign/DataReportOpenFeignClient.java

@ -2,11 +2,15 @@ package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.stats.UserHouseStatsQueryFormDTO;
import com.epmet.dto.result.plugins.AgencyNodeDTO;
import com.epmet.feign.impl.DataReportOpenFeignClientFallBackFactory;
import com.epmet.stats.UserHouseStatsResultDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
* 本服务对外开放的API,其他服务通过引用此client调用该服务
@ -24,4 +28,12 @@ public interface DataReportOpenFeignClient {
**/
@GetMapping("/data/report/screen/agency/querystaffagencytree/{agencyId}")
Result<AgencyNodeDTO> queryStaffAgencyTree(@PathVariable("agencyId") String agencyId);
/**
* 通过dateId查询人房统计信息
* @param input 3个参数就不用dto了类太多
* @return
*/
@PostMapping("/data/report/userHouse/getUserHouseDailyStatsByDateId")
Result<UserHouseStatsResultDTO> getUserHouseDailyStatsByDateId(@RequestBody UserHouseStatsQueryFormDTO input);
}

7
epmet-module/data-report/data-report-client/src/main/java/com/epmet/feign/impl/DataReportOpenFeignClientFallBack.java

@ -3,8 +3,10 @@ package com.epmet.feign.impl;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.stats.UserHouseStatsQueryFormDTO;
import com.epmet.dto.result.plugins.AgencyNodeDTO;
import com.epmet.feign.DataReportOpenFeignClient;
import com.epmet.stats.UserHouseStatsResultDTO;
//@Component
public class DataReportOpenFeignClientFallBack implements DataReportOpenFeignClient {
@ -17,4 +19,9 @@ public class DataReportOpenFeignClientFallBack implements DataReportOpenFeignCli
public Result<AgencyNodeDTO> queryStaffAgencyTree(String agencyId) {
return ModuleUtils.feignConError(ServiceConstant.DATA_REPORT_SERVER, "queryStaffAgencyTree",agencyId);
}
@Override
public Result<UserHouseStatsResultDTO> getUserHouseDailyStatsByDateId(UserHouseStatsQueryFormDTO input) {
return ModuleUtils.feignConError(ServiceConstant.DATA_REPORT_SERVER, "getUserHouseDailyStatsByDateId",input);
}
}

18
epmet-module/data-report/data-report-client/src/main/java/com/epmet/stats/UserHouseStatsResultDTO.java

@ -0,0 +1,18 @@
package com.epmet.stats;
import lombok.Data;
/**
* 人房信息统计
*/
@Data
public class UserHouseStatsResultDTO {
private Integer houseTotal = 0;
private Integer zzHouseTotal = 0;
private Integer czHouseTotal = 0;
private Integer xzHouseTotal = 0;
private Integer userTotal = 0;
private Integer czUserTotal = 0;
private Integer ldUserTotal = 0;
private Integer usingCommunityNum = 0;
}

37
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/stats/UserHouseController.java

@ -0,0 +1,37 @@
package com.epmet.datareport.controller.stats;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.datareport.service.stats.UserHouseStatsService;
import com.epmet.dto.form.stats.UserHouseStatsQueryFormDTO;
import com.epmet.stats.UserHouseStatsResultDTO;
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;
@RestController
@RequestMapping("userHouse")
public class UserHouseController {
@Autowired
private UserHouseStatsService userHouseStatsService;
/**
* 通过dateId查询人房统计信息
* @param input
* @return
*/
@PostMapping("getUserHouseDailyStatsByDateId")
public Result<UserHouseStatsResultDTO> getUserHouseDailyStatsByDateId(@RequestBody UserHouseStatsQueryFormDTO input) {
ValidatorUtils.validateEntity(input);
String orgId = input.getOrgId();
String orgType = input.getOrgType();
String dateId = input.getDateId();
UserHouseStatsResultDTO r = userHouseStatsService.getUserHouseDailyStats(orgId, orgType, dateId);
return new Result<UserHouseStatsResultDTO>().ok(r);
}
}

17
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/stats/FactAgencyUserHouseDailyDao.java

@ -0,0 +1,17 @@
package com.epmet.datareport.dao.stats;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.datareport.entity.stats.FactAgencyUserHouseDailyEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 人房信息统计数按天统计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-05-27
*/
@Mapper
public interface FactAgencyUserHouseDailyDao extends BaseDao<FactAgencyUserHouseDailyEntity> {
}

17
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/stats/FactGridUserHouseDailyDao.java

@ -0,0 +1,17 @@
package com.epmet.datareport.dao.stats;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.datareport.entity.stats.FactGridUserHouseDailyEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 网格的人房信息统计数按天统计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-05-27
*/
@Mapper
public interface FactGridUserHouseDailyDao extends BaseDao<FactGridUserHouseDailyEntity> {
}

115
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/stats/FactAgencyUserHouseDailyEntity.java

@ -0,0 +1,115 @@
package com.epmet.datareport.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-05-27
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("fact_agency_user_house_daily")
public class FactAgencyUserHouseDailyEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户id
*/
private String customerId;
/**
* 数据更新至yyyyMMdd;
*/
private String dateId;
/**
* 组织id
*/
private String agencyId;
/**
* agency_id所属的机关级别社区级community
街道:street,
区县级: district,
市级: city
省级:province
*/
private String level;
/**
* 组织i所属的组织id
*/
private String pid;
/**
* 组织i所有上级id
*/
private String pids;
/**
* 小区总数
*/
private Integer neighbourhoodsCount;
/**
* 房屋总数
*/
private Integer houseCount;
/**
* 自住房屋总数
*/
private Integer houseSelfCount;
/**
* 出租房屋总数
*/
private Integer houseLeaseCount;
/**
* 闲置房屋总数
*/
private Integer houseIdleCount;
/**
* 居民总数
*/
private Integer userCount;
/**
* 常住居民总数
*/
private Integer userResiCount;
/**
* 流动居民总数
*/
private Integer userFloatCount;
/**
* 当日新增房屋数
*/
private Integer houseIncr;
/**
* 当日修改房屋数
*/
private Integer houseModify;
/**
* 当日新增居民数
*/
private Integer userIncr;
/**
* 当日修改居民数
*/
private Integer userModify;
}

106
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/stats/FactGridUserHouseDailyEntity.java

@ -0,0 +1,106 @@
package com.epmet.datareport.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-05-27
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("fact_grid_user_house_daily")
public class FactGridUserHouseDailyEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户id
*/
private String customerId;
/**
* 数据更新至yyyyMMdd;
*/
private String dateId;
/**
* 网格id
*/
private String gridId;
/**
* 网格所属的组织id
*/
private String pid;
/**
* 网格所有上级id
*/
private String pids;
/**
* 小区总数
*/
private Integer neighbourhoodsCount;
/**
* 房屋总数
*/
private Integer houseCount;
/**
* 自住房屋总数
*/
private Integer houseSelfCount;
/**
* 出租房屋总数
*/
private Integer houseLeaseCount;
/**
* 闲置房屋总数
*/
private Integer houseIdleCount;
/**
* 居民总数
*/
private Integer userCount;
/**
* 常住居民总数
*/
private Integer userResiCount;
/**
* 流动居民总数
*/
private Integer userFloatCount;
/**
* 当日新增房屋数
*/
private Integer houseIncr;
/**
* 当日修改房屋数
*/
private Integer houseModify;
/**
* 当日新增居民数
*/
private Integer userIncr;
/**
* 当日修改居民数
*/
private Integer userModify;
}

19
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/stats/UserHouseStatsService.java

@ -0,0 +1,19 @@
package com.epmet.datareport.service.stats;
import com.epmet.stats.UserHouseStatsResultDTO;
import lombok.extern.slf4j.Slf4j;
/**
* 人房统计service
*/
public interface UserHouseStatsService {
/**
* 查询指定dateId的人房统计信息
* @param orgId
* @param orgType
* @param dateId
* @return
*/
UserHouseStatsResultDTO getUserHouseDailyStats(String orgId, String orgType, String dateId);
}

87
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/stats/impl/UserHouseStatsServiceImpl.java

@ -0,0 +1,87 @@
package com.epmet.datareport.service.stats.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.utils.EpmetRequestHolder;
import com.epmet.constant.DataSourceConstant;
import com.epmet.datareport.dao.stats.FactAgencyUserHouseDailyDao;
import com.epmet.datareport.dao.stats.FactGridUserHouseDailyDao;
import com.epmet.datareport.entity.stats.FactAgencyUserHouseDailyEntity;
import com.epmet.datareport.entity.stats.FactGridUserHouseDailyEntity;
import com.epmet.datareport.service.stats.UserHouseStatsService;
import com.epmet.stats.UserHouseStatsResultDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Slf4j
@Service
@DataSource(DataSourceConstant.STATS)
public class UserHouseStatsServiceImpl implements UserHouseStatsService {
@Autowired
private FactGridUserHouseDailyDao factGridUserHouseDailyDao;
@Autowired
private FactAgencyUserHouseDailyDao factAgencyUserHouseDailyDao;
@Override
public UserHouseStatsResultDTO getUserHouseDailyStats(String orgId, String orgType, String dateId) {
// 没有传参,使用当前登录人的
if (StringUtils.isEmpty(orgId) || StringUtils.isEmpty(orgType)) {
String userId = EpmetRequestHolder.getLoginUserId();
String customerId = EpmetRequestHolder.getLoginUserCustomerId();
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, userId);
if (null == staffInfo) {
throw new EpmetException(String.format("查询工作人员%s缓存信息失败:%s", userId));
}
orgId = staffInfo.getAgencyId();
orgType = "agency";
}
// 结果对象初始化
UserHouseStatsResultDTO result = new UserHouseStatsResultDTO();
if ("agency".equals(orgType)) {
// 查询的目标是组织
LambdaQueryWrapper<FactAgencyUserHouseDailyEntity> query = new LambdaQueryWrapper<>();
query.eq(FactAgencyUserHouseDailyEntity::getDateId, dateId);
query.eq(FactAgencyUserHouseDailyEntity::getAgencyId, orgId);
FactAgencyUserHouseDailyEntity agencyDailyStats = factAgencyUserHouseDailyDao.selectOne(query);
if (agencyDailyStats != null) {
result.setHouseTotal(agencyDailyStats.getHouseCount());
result.setCzHouseTotal(agencyDailyStats.getHouseLeaseCount());
result.setXzHouseTotal(agencyDailyStats.getHouseIdleCount());
result.setZzHouseTotal(agencyDailyStats.getHouseSelfCount());
result.setUserTotal(agencyDailyStats.getUserCount());
result.setCzUserTotal(agencyDailyStats.getUserResiCount());
result.setLdUserTotal(agencyDailyStats.getUserFloatCount());
}
} else {
// 查询的目标是网格
LambdaQueryWrapper<FactGridUserHouseDailyEntity> query = new LambdaQueryWrapper<>();
query.eq(FactGridUserHouseDailyEntity::getDateId, dateId);
query.eq(FactGridUserHouseDailyEntity::getGridId, orgId);
FactGridUserHouseDailyEntity gridDailyStats = factGridUserHouseDailyDao.selectOne(query);
if (gridDailyStats != null) {
result.setHouseTotal(gridDailyStats.getHouseCount());
result.setCzHouseTotal(gridDailyStats.getHouseLeaseCount());
result.setXzHouseTotal(gridDailyStats.getHouseIdleCount());
result.setZzHouseTotal(gridDailyStats.getHouseSelfCount());
result.setUserTotal(gridDailyStats.getUserCount());
result.setCzUserTotal(gridDailyStats.getUserResiCount());
result.setLdUserTotal(gridDailyStats.getUserFloatCount());
}
}
return result;
}
}

33
epmet-module/data-report/data-report-server/src/main/resources/mapper/stats/FactAgencyUserHouseDailyDao.xml

@ -0,0 +1,33 @@
<?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.datareport.dao.stats.FactAgencyUserHouseDailyDao">
<resultMap type="com.epmet.datareport.entity.stats.FactAgencyUserHouseDailyEntity" id="factAgencyUserHouseDailyMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="dateId" column="DATE_ID"/>
<result property="agencyId" column="AGENCY_ID"/>
<result property="level" column="LEVEL"/>
<result property="pid" column="PID"/>
<result property="pids" column="PIDS"/>
<result property="neighbourhoodsCount" column="NEIGHBOURHOODS_COUNT"/>
<result property="houseCount" column="HOUSE_COUNT"/>
<result property="houseSelfCount" column="HOUSE_SELF_COUNT"/>
<result property="houseLeaseCount" column="HOUSE_LEASE_COUNT"/>
<result property="houseIdleCount" column="HOUSE_IDLE_COUNT"/>
<result property="userCount" column="USER_COUNT"/>
<result property="userResiCount" column="USER_RESI_COUNT"/>
<result property="userFloatCount" column="USER_FLOAT_COUNT"/>
<result property="houseIncr" column="HOUSE_INCR"/>
<result property="houseModify" column="HOUSE_MODIFY"/>
<result property="userIncr" column="USER_INCR"/>
<result property="userModify" column="USER_MODIFY"/>
<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>

32
epmet-module/data-report/data-report-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml

@ -0,0 +1,32 @@
<?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.datareport.dao.stats.FactGridUserHouseDailyDao">
<resultMap type="com.epmet.datareport.entity.stats.FactGridUserHouseDailyEntity" id="factGridUserHouseDailyMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="dateId" column="DATE_ID"/>
<result property="gridId" column="GRID_ID"/>
<result property="pid" column="PID"/>
<result property="pids" column="PIDS"/>
<result property="neighbourhoodsCount" column="NEIGHBOURHOODS_COUNT"/>
<result property="houseCount" column="HOUSE_COUNT"/>
<result property="houseSelfCount" column="HOUSE_SELF_COUNT"/>
<result property="houseLeaseCount" column="HOUSE_LEASE_COUNT"/>
<result property="houseIdleCount" column="HOUSE_IDLE_COUNT"/>
<result property="userCount" column="USER_COUNT"/>
<result property="userResiCount" column="USER_RESI_COUNT"/>
<result property="userFloatCount" column="USER_FLOAT_COUNT"/>
<result property="houseIncr" column="HOUSE_INCR"/>
<result property="houseModify" column="HOUSE_MODIFY"/>
<result property="userIncr" column="USER_INCR"/>
<result property="userModify" column="USER_MODIFY"/>
<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>

15
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommunityUserHouseStatsFormDTO.java

@ -0,0 +1,15 @@
package com.epmet.dto.form;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class CommunityUserHouseStatsFormDTO {
private String orgId;
private String orgType;
private Integer pageNo = 1;
private Integer pageSize = 10;
}

15
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/UsingCommunityStatsFormDTO.java

@ -0,0 +1,15 @@
package com.epmet.dto.form;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UsingCommunityStatsFormDTO {
private String orgId;
private String orgType;
}

20
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseChartResultDTO.java

@ -56,6 +56,26 @@ public class HouseChartResultDTO implements Serializable {
*/
private Double wscHouseRatio = 0.0;
/**
* 房屋总数-较上月
*/
private Integer houseTotalJSY;
/**
* 自住房屋树-较上月
*/
private Integer zzHouseTotalJSY;
/**
* 出租房屋总数-较上月
*/
private Integer czHouseTotalJSY;
/**
* 闲置房屋总数-较上月
*/
private Integer xzHouseTotalJSY;
@JsonIgnore
private Integer num;
//1:出租 0:自住 2:闲置 3:未出售

20
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/SubUserHouseListResultDTO.java

@ -1,8 +1,10 @@
package com.epmet.dto.result;
import com.epmet.commons.tools.constant.NumConstant;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @author sun
@ -79,4 +81,22 @@ public class SubUserHouseListResultDTO implements Serializable {
*/
private Double ldUserRatio = 0.0;
/**
* 开通平台的社区数
*/
private Integer usingCommunityNum;
/**
* 人户一致人在户不在户在人不在
* 为空的 暂不清楚
*/
private Integer rhyzUserTotal = NumConstant.ZERO;
private BigDecimal rhyzUserRatio = NumConstant.ZERO_DECIMAL;
private Integer rzhbzUserTotal = NumConstant.ZERO;
private BigDecimal rzhbzUserRatio = NumConstant.ZERO_DECIMAL;
private Integer hzrbzUserTotal = NumConstant.ZERO;
private BigDecimal hzrbzUserRatio = NumConstant.ZERO_DECIMAL;
private Integer zbqcUserTotal = NumConstant.ZERO;
private BigDecimal zbqcUserRatio = NumConstant.ZERO_DECIMAL;
}

21
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/UsingCommunityStatsResultDTO.java

@ -0,0 +1,21 @@
package com.epmet.dto.result;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UsingCommunityStatsResultDTO {
/**
* 开通平台社区数
*/
private Integer usingCommunityNum;
/**
* 开通平台社区数-较上月
*/
private Integer usingCommunityNumJSY;
}

11
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java

@ -614,5 +614,14 @@ public class AgencyController {
return new Result<List<CustomerTreeDTO>>().ok(agencyService.getCustomerTree(tokenDto));
}
/**
* 开通平台的社区数统计
* @return
*/
@RequestMapping("usingCommunityStats")
public Result<UsingCommunityStatsResultDTO> usingCommunityStats(@RequestBody UsingCommunityStatsFormDTO input) {
String orgId = input.getOrgId();
String orgType = input.getOrgType();
return new Result<UsingCommunityStatsResultDTO>().ok(agencyService.usingCommunityStats(orgId, orgType));
}
}

1
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java

@ -342,6 +342,7 @@ public class CustomerAgencyController {
/**
* @Description 获取客户下组织树不含网格和部门
* 哪些地方用到了比如办事指南-指南管理查询条件
* @Param tokenDTO
* @Return {@link Result< AgencyTreeResultDTO >}
* @Author zhaoqifeng

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

@ -661,4 +661,20 @@ public class HouseController implements ResultDataResolver {
return new Result<PageData<IcHouseListResultDTO>>().ok(houseService.houseStatisListDetail(formDTO));
}
/**
* 针对社区的人房统计列表
* @return
*/
@PostMapping("usingCommunityUserHouseStats")
public Result<PageData<SubUserHouseListResultDTO>> communityUserHouseStats(@RequestBody CommunityUserHouseStatsFormDTO input) {
String orgId = input.getOrgId();
String orgType = input.getOrgType();
Integer pageNo = input.getPageNo();
Integer pageSize = input.getPageSize();
PageData<SubUserHouseListResultDTO> r = houseService.usingCommunityUserHouseStats(orgId, orgType, pageNo, pageSize);
return new Result<PageData<SubUserHouseListResultDTO>>().ok(r);
}
}

11
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java

@ -27,6 +27,7 @@ import com.epmet.entity.CustomerAgencyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
@ -387,5 +388,15 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
*/
CustomerAgencyEntity getAgencyByUserId(@Param("userId") String userId, @Param("customerId") String customerId);
/**
* 开通社区列表
* @param agencyId 机关组织的id
* @param agencyOrgIdPath agency的id路径path包含自己
* @param endDate 截止日期也即查询截止改日期有多少社区在使用
* @return
*/
List<String> getUsingCommunityList(@Param("customerId") String customerId, @Param("agencyId") String agencyId, @Param("agencyOrgIdPath") String agencyOrgIdPath, @Param("endDate") Date endDate);
List<String> getCommunitysByOrgIdPath(@Param("customerId") String customerId, @Param("orgId") String orgId, @Param("orgIdPath") String orgIdPath);
}

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/EnterpriseImportExcelDTO.java

@ -90,7 +90,7 @@ public class EnterpriseImportExcelDTO {
* 默认0
*/
@ColumnWidth(20)
@ExcelProperty(value = "场所类别(九小场所/企事业单位)")
@ExcelProperty(value = "场所类别")
private String placeCategoryName;
@ColumnWidth(20)

5
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java

@ -199,4 +199,9 @@ public interface AgencyService {
*/
List<CustomerTreeDTO> getCustomerTree(TokenDto tokenDto);
/**
* 开通平台的社区数统计
* @return
*/
UsingCommunityStatsResultDTO usingCommunityStats(String orgId, String orgType);
}

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

@ -197,4 +197,6 @@ public interface HouseService {
PageData<ReportHouseTestResultDTO> listHouses4ReportTest(String houseId, Integer pageNo, Integer pageSize);
PageData<IcHouseListResultDTO> houseStatisListDetail(HouseChartFormDTO formDTO);
PageData<SubUserHouseListResultDTO> usingCommunityUserHouseStats(String orgId, String orgType, Integer pageNo, Integer pageSize);
}

55
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java

@ -34,9 +34,7 @@ import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.NodeTreeUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.*;
import com.epmet.constant.CustomerAgencyConstant;
import com.epmet.constant.OrgInfoConstant;
import com.epmet.constant.RoleKeyConstants;
@ -1117,4 +1115,55 @@ public class AgencyServiceImpl implements AgencyService {
}
@Override
public UsingCommunityStatsResultDTO usingCommunityStats(String orgId, String orgType) {
String customerId = EpmetRequestHolder.getLoginUserCustomerId();
String userId = EpmetRequestHolder.getLoginUserId();
// 所属组织的上级
String agencyOrgIdPath = null;
if (StringUtils.isBlank(orgId)) {
// 没有传参数,使用当前登录人员所属的组织去查询
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, userId);
if (staffInfo == null) {
String errorMsg = String.format("查询当前工作人员信息失败。staffId:%s", userId);
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), errorMsg, errorMsg);
}
orgId = staffInfo.getAgencyId();
orgType = "agency";
// agencyOrgIdPath = getOrgIdPath(staffInfo);
}
if ("agency".equals(orgType)) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.set(Calendar.DAY_OF_MONTH, 1);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
Date endTime = calendar.getTime();
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(orgId);
agencyOrgIdPath = getOrgIdPath(agencyInfo.getPids(), agencyInfo.getId());
List<String> currentUsingCommunityList = customerAgencyDao.getUsingCommunityList(customerId, orgId, agencyOrgIdPath, null);
List<String> preferUsingCommunityList = customerAgencyDao.getUsingCommunityList(customerId, orgId, agencyOrgIdPath, endTime);
return new UsingCommunityStatsResultDTO(currentUsingCommunityList.size(), currentUsingCommunityList.size() - preferUsingCommunityList.size());
} else if ("grid".equals(orgType)) {
// 网格下不会有该数据,给个0
return new UsingCommunityStatsResultDTO(0, 0);
}
return null;
}
private String getOrgIdPath(String orgPids, String orgId) {
if (StringUtils.isBlank(orgPids) || "0".equals(orgPids)) {
return orgId;
}
return orgPids.concat(":").concat(orgId);
}
}

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

@ -8,6 +8,7 @@ import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.enums.HouseQrcodeEnum;
@ -34,17 +35,17 @@ import com.epmet.constants.ImportTaskConstants;
import com.epmet.dao.*;
import com.epmet.dto.*;
import com.epmet.dto.form.*;
import com.epmet.dto.form.stats.UserHouseStatsQueryFormDTO;
import com.epmet.dto.result.*;
import com.epmet.entity.*;
import com.epmet.enums.*;
import com.epmet.feign.EpmetAdminOpenFeignClient;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.OssFeignClient;
import com.epmet.feign.*;
import com.epmet.model.HouseInfoModel;
import com.epmet.model.ImportHouseInfoListener;
import com.epmet.redis.CustomerAgencyRedis;
import com.epmet.redis.IcHouseRedis;
import com.epmet.service.*;
import com.epmet.stats.UserHouseStatsResultDTO;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.google.common.cache.Cache;
@ -68,6 +69,7 @@ import java.awt.image.BufferedImage;
import java.io.*;
import java.net.URLEncoder;
import java.text.NumberFormat;
import java.time.LocalDate;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
@ -132,6 +134,9 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver {
@Autowired
private IcBuildingUnitDao icBuildingUnitDao;
@Autowired
private DataReportOpenFeignClient dataReportOpenFeignClient;
@Override
@Transactional(rollbackFor = Exception.class)
@ -718,6 +723,17 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver {
resultDTO.setWscHouseRatio(Double.valueOf((resultDTO.getHouseTotal() == 0 || resultDTO.getWscHouseTotal() > resultDTO.getHouseTotal()) ? "0" : numberFormat.format(((float) resultDTO.getWscHouseTotal() / (float) resultDTO.getHouseTotal()) * 100)));
resultDTO.setOrgId(formDTO.getOrgId());
resultDTO.setOrgType(formDTO.getOrgType());
// 加载上个月,该组织的人房统计信息,并且计算较上月信息
Date lastDayOfLastMonth = DateUtils.getLastDayOfMonth(DateUtils.addDateMonths(new Date(), -1));
UserHouseStatsQueryFormDTO form = new UserHouseStatsQueryFormDTO(formDTO.getOrgId(), formDTO.getOrgType(), DateUtils.format(lastDayOfLastMonth, "yyyyMMdd"));
UserHouseStatsResultDTO lastMonthUserHouseStats = getResultDataOrThrowsException(dataReportOpenFeignClient.getUserHouseDailyStatsByDateId(form), ServiceConstant.DATA_REPORT_SERVER,
EpmetErrorCode.SERVER_ERROR.getCode(), null, null);
resultDTO.setHouseTotalJSY(resultDTO.getHouseTotal() - lastMonthUserHouseStats.getHouseTotal());
resultDTO.setCzHouseTotalJSY(resultDTO.getCzHouseTotal() - lastMonthUserHouseStats.getCzHouseTotal());
resultDTO.setXzHouseTotalJSY(resultDTO.getXzHouseTotal() - lastMonthUserHouseStats.getXzHouseTotal());
resultDTO.setZzHouseTotalJSY(resultDTO.getZzHouseTotal() - lastMonthUserHouseStats.getZzHouseTotal());
return resultDTO;
}
@ -927,6 +943,8 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver {
houseDTO.setOrgId(id);
houseList.add(houseChart(houseDTO));
}
//start 2022.11.17需求:http://zentao.elinkservice.cn/story-view-718.html
//原来饼图是:居民总数、常住人口数、流动人口数 后改为下面的人户状况饼图,后面如果所有客户都上线了,就把第2步的查询注释掉。
//2.直属下级列表的居民数据
UserChartFormDTO userDTO = new UserChartFormDTO();
userDTO.setOrgType(orgType);
@ -935,6 +953,15 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver {
if (!userResult.success()) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取居民人房统计数据失败" + userResult.getInternalMsg(), userResult.getMsg());
}
//end
//3.居民总数、人户一致、人在户不在、户在人不在,没填写是暂不清楚
RHZKStatisticsFormDTO rhzkStatisticsFormDTO = new RHZKStatisticsFormDTO();
rhzkStatisticsFormDTO.setOrgIds(idList);
rhzkStatisticsFormDTO.setOrgType(orgType);
Result<List<RHZKStatisticsResultDTO>> rhzkResult = epmetUserOpenFeignClient.renHuCondition(rhzkStatisticsFormDTO);
if (!rhzkResult.success()){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取居民人户状况统计数据失败" + rhzkResult.getInternalMsg(), rhzkResult.getMsg());
}
//3.汇总封装数据
SubUserHouseListResultDTO dto = null;
for (String id : idList) {
@ -964,6 +991,35 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver {
dto.setLdUserRatio(u.getLdUserRatio());
}
}
// 为每一个子级组织,查询开通了多少个社区
if ("agency".equals(dto.getOrgType())) {
AgencyService agencyService = SpringContextUtils.getBean(AgencyService.class);
if (agencyService != null) {
UsingCommunityStatsResultDTO usingCommunityStats = agencyService.usingCommunityStats(dto.getOrgId(), dto.getOrgType());
if (usingCommunityStats != null) {
dto.setUsingCommunityNum(usingCommunityStats.getUsingCommunityNum());
}
}
} else if ("grid".equals(dto.getOrgType())) {
// 网格这项数据为0
dto.setUsingCommunityNum(0);
}
for (RHZKStatisticsResultDTO r : rhzkResult.getData()) {
if (StringUtils.isNotBlank(r.getOrgId())){
if (r.getOrgId().equals(id)){
dto.setRhyzUserTotal(r.getRhyzUserTotal());
dto.setRhyzUserRatio(r.getRhyzUserRatio());
dto.setRzhbzUserTotal(r.getRzhbzUserTotal());
dto.setRzhbzUserRatio(r.getRzhbzUserRatio());
dto.setHzrbzUserTotal(r.getHzrbzUserTotal());
dto.setHzrbzUserRatio(r.getHzrbzUserRatio());
dto.setZbqcUserTotal(r.getZbqcUserTotal());
dto.setZbqcUserRatio(r.getZbqcUserRatio());
dto.setUserTotal(r.getUserTotal());
}
}
}
list.add(dto);
}
return list;
@ -1365,5 +1421,62 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver {
return new PageData<>(list, pageInfo.getTotal());
}
@Override
public PageData<SubUserHouseListResultDTO> usingCommunityUserHouseStats(String orgId, String orgType, Integer pageNo, Integer pageSize) {
String customerId = EpmetRequestHolder.getLoginUserCustomerId();
if (StringUtils.isBlank(orgId)) {
// 没有传参数,使用当前登录人员所属的组织去查询
String userId = EpmetRequestHolder.getLoginUserId();
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, userId);
if (staffInfo == null) {
String errorMsg = String.format("查询当前工作人员信息失败。staffId:%s", userId);
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), errorMsg, errorMsg);
}
orgId = staffInfo.getAgencyId();
orgType = "agency";
}
PageHelper.startPage(pageNo, pageSize);
List<String> communityIds = customerAgencyDao.getUsingCommunityList(customerId, orgId, CustomerOrgRedis.getOrgIdPath(orgId, orgType), null);
// List<String> communityIds = customerAgencyDao.getCommunitysByOrgIdPath(customerId, orgId, CustomerOrgRedis.getOrgIdPath(orgId, orgType));
// 填充组织信息
Map<String, String> communityMap = communityIds.stream().collect(Collectors.toMap(id -> id, id -> concatAgencyNamePath(id)));
List<SubUserHouseListResultDTO> communityUserHouseStats = houseUserChartList(communityIds, communityMap, "agency");
return new PageData<SubUserHouseListResultDTO>(communityUserHouseStats, new PageInfo<>(communityIds).getTotal());
}
public String concatAgencyNamePath(String agencyId) {
List<String> agencyNamePathList = new ArrayList();
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(agencyId);
if (agencyInfo == null) {
return null;
}
String pidsStr = agencyInfo.getPids();
if (StringUtils.isBlank(pidsStr)) {
// 没有pids,是顶级,直接返回
agencyNamePathList.add(agencyInfo.getOrganizationName());
return String.join("-", agencyNamePathList);
}
String[] pidList = pidsStr.split(":");
for (String pAgencyId : pidList) {
AgencyInfoCache pAgencyInfo = CustomerOrgRedis.getAgencyInfo(pAgencyId);
if (pAgencyInfo == null) {
continue;
}
agencyNamePathList.add(pAgencyInfo.getOrganizationName());
}
// 最后把自己加上
agencyNamePathList.add(agencyInfo.getOrganizationName());
return String.join("-", agencyNamePathList);
}
}

29
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml

@ -1011,4 +1011,33 @@
LIMIT 1
</select>
<select id="getCommunitysByOrgIdPath" resultType="string">
select ca.ID
from customer_agency ca
where ca.CUSTOMER_ID=#{customerId}
and ca.LEVEL = 'community'
and ca.DEL_FLAG = 0
and (ca.ID = #{orgId} or ca.PIDS like CONCAT(#{orgIdPath},'%'))
order by ca.CREATED_TIME asc
</select>
<!--开通社区列表-->
<select id="getUsingCommunityList" resultType="string">
select t.ID
from (select ca.ID
, ca.CREATED_TIME created_time
, count(csa.ID) community_count
from customer_agency ca
inner join customer_staff_agency csa on (ca.ID = csa.AGENCY_ID and csa.DEL_FLAG = 0)
where ca.DEL_FLAG = 0
and ca.CUSTOMER_ID=#{customerId}
and ca.LEVEL = 'community'
<if test="endDate != null">
and csa.CREATED_TIME <![CDATA[<]]> #{endDate}
</if>
and (ca.ID = #{agencyId} or ca.PIDS like CONCAT(#{agencyOrgIdPath}, '%'))
group by ca.ID, ca.CREATED_TIME
having community_count > 0
order by created_time desc) t
</select>
</mapper>

3
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml

@ -160,7 +160,8 @@
AND a.DEL_FLAG = '0'
</where>
ORDER BY CAST(a.NEIGHBOR_HOOD_NAME AS SIGNED),CONVERT(a.NEIGHBOR_HOOD_NAME using gbk)
ORDER BY a.GRID_ID asc,
CAST(a.NEIGHBOR_HOOD_NAME AS SIGNED),CONVERT(a.NEIGHBOR_HOOD_NAME using gbk)
</select>
<select id="searchAllNeighborhood" resultType="com.epmet.excel.IcNeighborHoodExcel">
select

2
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/IcEventListFormDTO.java

@ -1,7 +1,6 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@ -28,6 +27,7 @@ public class IcEventListFormDTO implements Serializable {
private String icEventId;
/**
* 所属组织
* 前端传入如果没传默认查询登录用户所属组织及下级
*/
private String agencyId;
/**

8
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/IcEventServiceImpl.java

@ -112,9 +112,11 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
@Override
public PageData<IcEventListResultDTO> list(IcEventListFormDTO formDTO) {
//获取当前工作人员缓存信息
CustomerStaffInfoCacheResult staffInfo = getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId());
formDTO.setAgencyId(staffInfo.getAgencyId());
if(StringUtils.isBlank(formDTO.getAgencyId())){
//获取当前工作人员缓存信息
CustomerStaffInfoCacheResult staffInfo = getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId());
formDTO.setAgencyId(staffInfo.getAgencyId());
}
//分页查询当前组织下网格内事件数据
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage());

14
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/IcFormItemGroupDTO.java

@ -78,4 +78,18 @@ public class IcFormItemGroupDTO implements Serializable {
*/
private Boolean display;
/**
* 政策人员信息组件;1:展示0不展示默认0
*/
private String policyFlag;
/**
* 1展示0不展示默认0
*/
private String childShowFlag;
/**
* 组编码,唯一标识
*/
private String groupCode;
}

5
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FormGroupDTO.java

@ -39,6 +39,11 @@ public class FormGroupDTO implements Serializable {
*/
private String tableName;
/**
*组编码,唯一标识
*/
private String groupCode;
/**
* 分组里面的组件
*/

3
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormController.java

@ -52,9 +52,10 @@ public class IcFormController {
/**
* desc: 初始化 客户表单配置
* 运营端-数字社区初始化
*
* @param customerId
* @param formCode
* @param formCode value: resi_base_info
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.CustomerFormResultDTO>
* @author LiuJanJun
* @date 2021/12/8 4:28 下午

10
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcFormItemGroupEntity.java

@ -79,4 +79,14 @@ public class IcFormItemGroupEntity extends BaseEpmetEntity {
* 政策人员信息组件;1:展示0不展示默认0
*/
private String policyFlag;
/**
* 1展示0不展示默认0
*/
private String childShowFlag;
/**
* 组编码,唯一标识
*/
private String groupCode;
}

50
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormServiceImpl.java

@ -172,7 +172,7 @@ public class IcFormServiceImpl extends BaseServiceImpl<IcFormDao, IcFormEntity>
defaultIcForm.setCreatedTime(new Date());
defaultIcForm.setUpdatedBy("init_user");
defaultIcForm.setUpdatedTime(new Date());
// 1、设置ic_form
int insert = baseDao.insert(defaultIcForm);
log.info("insert icForm:" + insert);
@ -184,7 +184,7 @@ public class IcFormServiceImpl extends BaseServiceImpl<IcFormDao, IcFormEntity>
return "默认配置错误";
}
String defaultBaseInfoGroupId = "default_0";
//设置ic_form_item
//2、设置ic_form_item
itemList.forEach(item -> {
item.setId(newPrefixed + item.getId());
item.setCustomerId(customerId);
@ -215,7 +215,7 @@ public class IcFormServiceImpl extends BaseServiceImpl<IcFormDao, IcFormEntity>
icFormItemDao.insert(item);
});
//设置ic_form_item_options
//3、设置ic_form_item_options
LambdaQueryWrapper<IcFormItemOptionsEntity> wrapperOptions = new LambdaQueryWrapper<>();
wrapperOptions.eq(IcFormItemOptionsEntity::getCustomerId, defaultCustomerId);
wrapperOptions.eq(IcFormItemOptionsEntity::getFormCode, formCode);
@ -233,7 +233,7 @@ public class IcFormServiceImpl extends BaseServiceImpl<IcFormDao, IcFormEntity>
icFormItemOptionsDao.insert(item);
});
//设置ic_form_item_group
//4、设置ic_form_item_group
LambdaQueryWrapper<IcFormItemGroupEntity> wrapperGroup = new LambdaQueryWrapper<>();
wrapperGroup.eq(IcFormItemGroupEntity::getCustomerId, defaultCustomerId);
wrapperGroup.eq(IcFormItemGroupEntity::getFormCode, formCode);
@ -255,7 +255,7 @@ public class IcFormServiceImpl extends BaseServiceImpl<IcFormDao, IcFormEntity>
icFormItemGroupDao.insert(item);
});
//设置ic_form_query_builder
//5、设置ic_form_query_builder
LambdaQueryWrapper<IcFormQueryBuilderEntity> wrapperQuery = new LambdaQueryWrapper<>();
wrapperQuery.eq(IcFormQueryBuilderEntity::getCustomerId, defaultCustomerId);
wrapperQuery.eq(IcFormQueryBuilderEntity::getFormCode, formCode);
@ -272,6 +272,26 @@ public class IcFormServiceImpl extends BaseServiceImpl<IcFormDao, IcFormEntity>
icFormQueryBuilderDao.insert(item);
});
//6、设置ic_form_list_item
LambdaQueryWrapper<IcFormListItemEntity> listItemWapper = new LambdaQueryWrapper<>();
listItemWapper.eq(IcFormListItemEntity::getCustomerId, defaultCustomerId);
listItemWapper.eq(IcFormListItemEntity::getFormCode, formCode);
List<IcFormListItemEntity> listItemList = icFormListItemDao.selectList(listItemWapper);
if (CollectionUtils.isEmpty(listItemList)) {
return "默认配置错误";
}
listItemList.forEach(item -> {
item.setId(newPrefixed + item.getId());
item.setCustomerId(customerId);
item.setFormItemId(newPrefixed + item.getFormItemId());
item.setCreatedBy("init_user");
item.setCreatedTime(new Date());
item.setUpdatedBy("init_user");
item.setUpdatedTime(new Date());
log.debug("stats:"+ JSON.toJSONString(item));
icFormListItemDao.insert(item);
});
//设置ic_resi_category_stats_config
LambdaQueryWrapper<IcResiCategoryStatsConfigEntity> wrapperStats = new LambdaQueryWrapper<>();
wrapperStats.eq(IcResiCategoryStatsConfigEntity::getCustomerId, defaultCustomerId);
@ -302,26 +322,6 @@ public class IcFormServiceImpl extends BaseServiceImpl<IcFormDao, IcFormEntity>
icResiCategoryWarnConfigDao.insert(item);
});
//设置ic_form_list_item
LambdaQueryWrapper<IcFormListItemEntity> listItemWapper = new LambdaQueryWrapper<>();
listItemWapper.eq(IcFormListItemEntity::getCustomerId, defaultCustomerId);
listItemWapper.eq(IcFormListItemEntity::getFormCode, formCode);
List<IcFormListItemEntity> listItemList = icFormListItemDao.selectList(listItemWapper);
if (CollectionUtils.isEmpty(listItemList)) {
return "默认配置错误";
}
listItemList.forEach(item -> {
item.setId(newPrefixed + item.getId());
item.setCustomerId(customerId);
item.setFormItemId(newPrefixed + item.getFormItemId());
item.setCreatedBy("init_user");
item.setCreatedTime(new Date());
item.setUpdatedBy("init_user");
item.setUpdatedTime(new Date());
log.debug("stats:"+ JSON.toJSONString(item));
icFormListItemDao.insert(item);
});
//设置ic_service_item_dict和ic_resi_demand_dict
Result result = epmetHeartOpenFeignClient.customerInit(customerId);
if (!result.success()) {

56
epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.40__itemgroup_code.sql

@ -0,0 +1,56 @@
alter table ic_form_item_group add COLUMN GROUP_CODE VARCHAR(32) DEFAULT '' COMMENT '组编码,唯一标识' after CHILD_SHOW_FLAG;
update ic_form_item_group g set g.GROUP_CODE='jcxx'
where g.LABEL='基础信息';
update ic_form_item_group g set g.GROUP_CODE='jyxx'
where g.LABEL='教育信息';
update ic_form_item_group g set g.GROUP_CODE='xqah'
where g.LABEL='兴趣爱好';
update ic_form_item_group g set g.GROUP_CODE='zjxy'
where g.LABEL='宗教信仰';
update ic_form_item_group g set g.GROUP_CODE='jkxx'
where g.LABEL='健康信息';
update ic_form_item_group g set g.GROUP_CODE='gzxx'
where g.LABEL='工作信息';
update ic_form_item_group g set g.GROUP_CODE='jjzk'
where g.LABEL='经济状况';
update ic_form_item_group g set g.GROUP_CODE='jzxx'
where g.LABEL='居住信息';
update ic_form_item_group g set g.GROUP_CODE='jtxx'
where g.LABEL='家庭信息';
update ic_form_item_group g set g.GROUP_CODE='dyxx'
where g.LABEL='党员信息';
update ic_form_item_group g set g.GROUP_CODE='bzfxx'
where g.LABEL='保障房信息';
update ic_form_item_group g set g.GROUP_CODE='syxx'
where g.LABEL='失业信息';
update ic_form_item_group g set g.GROUP_CODE='tyjrxx'
where g.LABEL='退役军人信息';
update ic_form_item_group g set g.GROUP_CODE='zyzxx'
where g.LABEL='志愿者信息';
update ic_form_item_group g set g.GROUP_CODE='tsrqxx'
where g.LABEL='特殊人群信息';
update ic_form_item_group g set g.GROUP_CODE='tzry'
where g.LABEL='统战人员';
update ic_form_item_group g set g.GROUP_CODE='lnrxx'
where g.LABEL='老年人信息';
update ic_form_item_group g set g.GROUP_CODE='resi_demand'
where g.LABEL='居民需求信息';

7
epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormDao.xml

@ -66,7 +66,8 @@
g.LABEL,
g.sort,
g.SUPPORT_ADD,
g.TABLE_NAME AS TABLE_NAME
g.TABLE_NAME AS TABLE_NAME,
g.GROUP_CODE
FROM
ic_form_item_group g
WHERE
@ -124,6 +125,7 @@
<result property="sort" column="sort"/>
<result property="supportAdd" column="SUPPORT_ADD"/>
<result property="tableName" column="TABLE_NAME"/>
<result property="groupCode" column="GROUP_CODE"/>
<collection property="itemList" ofType="com.epmet.dto.result.FormItemResult2"
column="group_id" select="com.epmet.dao.IcFormDao.selectItemListByGroupId">
</collection>
@ -200,7 +202,8 @@
case when g.table_name is null or g.table_name ='' then 'ic_resi_user'
else g.TABLE_NAME
end
) AS TABLE_NAME
) AS TABLE_NAME,
g.GROUP_CODE
FROM
ic_form_item_group g
WHERE

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

@ -107,6 +107,11 @@ public class IcNatDTO implements Serializable {
*/
private String attachmentUrl;
/**
* 试管编号
*/
private String testTubeCode;
/**
* 删除标识
*/

4
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddIcNatFormDTO.java

@ -89,6 +89,10 @@ public class AddIcNatFormDTO implements Serializable {
* 附件地址
*/
private String attachmentUrl;
/**
* 试管编号
*/
private String testTubeCode;
/**
* 是否客户下居民(0: 1:)
*/

2
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcMoveInAddEditFormDTO.java

@ -111,7 +111,7 @@ public class IcMoveInAddEditFormDTO implements Serializable {
/**
* 详细地址
*/
@NotBlank(message = "详细地址不能为空", groups = {AddGroup.class})
//@NotBlank(message = "详细地址不能为空", groups = {AddGroup.class})
private String address;
/**
* 迁移证号码

32
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/RHZKStatisticsFormDTO.java

@ -0,0 +1,32 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Author zxc
* @DateTime 2022/11/16 13:26
*/
@Data
public class RHZKStatisticsFormDTO implements Serializable {
private static final long serialVersionUID = -4474168123286467820L;
private String orgId;
/**
* grid网格village小区
*/
private String orgType;
/**
* /epmetuser/icresiuser/rhzkList调用会赋值
*/
private List<String> orgIds;
//tokenDto中获取
private String staffId;
private String customerId;
}

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

@ -27,6 +27,11 @@ public class UserChartFormDTO implements Serializable {
*/
private String type;
/**
* 人户一致:rhyz人在户不在rzhbz户在人不在hzrbz暂不清楚no全部all
*/
private String rhType;
private Integer pageNo = 1;
private Integer pageSize = 20;
private Boolean isPage = true;

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

@ -73,4 +73,9 @@ public class MyNatListResultDTO implements Serializable {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
private Date reportTime;
/**
* 试管编号
*/
private String testTubeCode;
}

13
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatListResultDTO.java

@ -73,14 +73,14 @@ public class NatListResultDTO implements Serializable {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
@ColumnWidth(25)
@ExcelProperty(value = "采样时间",order = 4)
@ExcelProperty(value = "采样时间",order = 5)
private Date sampleTime;
/**
* 检测结果
*/
@ColumnWidth(20)
@ExcelProperty(value = "检测结果",order = 5)
@ExcelProperty(value = "检测结果",order = 7)
private String natResult;
/**
@ -99,8 +99,15 @@ public class NatListResultDTO implements Serializable {
* 检测地点
*/
@ColumnWidth(30)
@ExcelProperty(value = "检测地点",order = 7)
@ExcelProperty(value = "检测地点",order = 6)
private String natAddress;
/**
* 试管编号
*/
@ColumnWidth(30)
@ExcelProperty(value = "试管编号",order = 8)
private String testTubeCode;
}

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

@ -25,5 +25,10 @@ public class OwnerRelationResultDTO implements Serializable {
private String userName;
private String isSelf;
private String relation;
/**
* 2022.11.17人户状况人户一致人在户不在户在人不在暂不清楚
*/
private String renHuCondition;
}
}

38
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/RHZKStatisticsResultDTO.java

@ -0,0 +1,38 @@
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;
import java.math.BigDecimal;
/**
* @Author zxc
* @DateTime 2022/11/16 09:15
*/
@Data
public class RHZKStatisticsResultDTO implements Serializable {
private static final long serialVersionUID = 6493812449146476415L;
private Integer userTotal = NumConstant.ZERO;
/**
* 人户一致人在户不在户在人不在
* 为空的 暂不清楚
*/
private Integer rhyzUserTotal = NumConstant.ZERO;
private BigDecimal rhyzUserRatio = NumConstant.ZERO_DECIMAL;
private Integer rzhbzUserTotal = NumConstant.ZERO;
private BigDecimal rzhbzUserRatio = NumConstant.ZERO_DECIMAL;
private Integer hzrbzUserTotal = NumConstant.ZERO;
private BigDecimal hzrbzUserRatio = NumConstant.ZERO_DECIMAL;
private Integer zbqcUserTotal = NumConstant.ZERO;
private BigDecimal zbqcUserRatio = NumConstant.ZERO_DECIMAL;
private String orgId;
@JsonIgnore
private Integer total;
@JsonIgnore
private String rhzk;
}

13
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserChartResultDTO.java

@ -40,6 +40,19 @@ public class UserChartResultDTO implements Serializable {
*/
private Double ldUserRatio = 0.0;
/**
* 用户总数-较上月
*/
private Integer userTotalJSY;
/**
* 常住用户-较上月
*/
private Integer czUserTotalJSY;
/**
* 流动人口-较上月
*/
private Integer ldUserTotalJSY;
@JsonIgnore
private Integer num;
//是否是流动人口【是:1 否:0】

4
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java

@ -955,4 +955,8 @@ public interface EpmetUserOpenFeignClient {
@PostMapping("/epmetuser/dataSyncConfig/vaccineInfoScanTask")
Result vaccineInfoScanTask(@RequestBody DataSyncTaskParam formDTO);
@PostMapping("/epmetuser/icresiuser/rhzkList")
Result<List<RHZKStatisticsResultDTO>> renHuCondition(@RequestBody RHZKStatisticsFormDTO formDTO);
}

5
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java

@ -746,4 +746,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien
public Result vaccineInfoScanTask(DataSyncTaskParam formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "vaccineInfoScanTask", formDTO);
}
@Override
public Result<List<RHZKStatisticsResultDTO>> renHuCondition(RHZKStatisticsFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "renHuCondition", formDTO);
}
}

9
epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserConstant.java

@ -108,4 +108,13 @@ public interface UserConstant {
* 居民信息 子表中的主表id
*/
String IC_RESI_USER = "IC_RESI_USER";
/**
* 人户一致人在户不在户在人不在
* 为空的 暂不清楚
*/
String R_H_Y_Z = "rhyz";
String R_Z_H_B_Z = "rzhbz";
String H_Z_R_B_Z = "hzrbz";
String Z_B_Q_C = "";
}

18
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java

@ -1465,4 +1465,22 @@ public class IcResiUserController implements ResultDataResolver {
return new Result<IcResiUserInfoCache>().ok(icResiUserService.getIcResiUserInfo(userId));
}
/**
* @Description 人户状况统计查询
* @param tokenDto
* @Author zxc
* @Date 2022/11/16 09:22
*/
@PostMapping("rhzk")
public Result<RHZKStatisticsResultDTO> renHuCondition(@LoginUser TokenDto tokenDto,@RequestBody RHZKStatisticsFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setStaffId(tokenDto.getUserId());
return new Result<RHZKStatisticsResultDTO>().ok(icResiUserService.renHuCondition(formDTO));
}
@PostMapping("rhzkList")
public Result<List<RHZKStatisticsResultDTO>> renHuConditionList(@RequestBody RHZKStatisticsFormDTO formDTO){
return new Result<List<RHZKStatisticsResultDTO>>().ok(icResiUserService.renHuConditionList(formDTO));
}
}

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

@ -442,4 +442,6 @@ public interface IcResiUserDao extends BaseDao<IcResiUserEntity> {
ResiAndLocalResiResultDTO getResiCount(@Param("agencyId")String agencyId,@Param("idCard")String idCard,@Param("customerId")String customerId);
List<IcResiUserDTO> getResiUserList(ComparisonFormDTO formDTO);
List<RHZKStatisticsResultDTO> getUserByRenHu(RHZKStatisticsFormDTO formDTO);
}

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

@ -94,6 +94,11 @@ public class IcNatEntity extends BaseEpmetEntity {
*/
private String attachmentUrl;
/**
* 试管编号
*/
private String testTubeCode;
@TableField(exist = false)
private String agencyId;

55
epmet-user/epmet-user-server/src/main/java/com/epmet/enums/RenHuConditionEnum.java

@ -0,0 +1,55 @@
package com.epmet.enums;
import org.apache.commons.lang3.StringUtils;
/**
* 居民信息里的人户状况枚举类
*/
public enum RenHuConditionEnum {
/**
* 人户一致人在户不在户在人不在
* 为空的 暂不清楚
*/
RHYZ("rhyz","人户一致"),
RZHBZ("rzhbz","人在户不在"),
HZRBZ("hzrbz","户在人不在"),
ZBQC("","暂不清楚"),
;
private String code;
private String name;
public static String getNameByCode(String code){
if (StringUtils.isBlank(code)){
return ZBQC.name;
}
for (RenHuConditionEnum e : values()) {
if (e.getCode().equals(code)){
return e.getName();
}
}
return ZBQC.name;
}
RenHuConditionEnum(String code, String name) {
this.code = code;
this.name = name;
}
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;
}
}

3
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcNatImportExcelData.java

@ -43,6 +43,9 @@ public class IcNatImportExcelData {
@ExcelProperty("检测结果")
private String natResultZh;
@ExcelProperty("试管编号")
private String testTubeCode;
@Data
public static class RowRemarkMessage {

11
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java

@ -525,4 +525,15 @@ public interface IcResiUserService extends BaseService<IcResiUserEntity> {
IcResiUserInfoCache getIcResiUserInfo(String userId);
void epidemicPreventionExport(EpidemicPreventionFormDTO formDTO, HttpServletResponse response) throws IOException;
/**
* @Description 人户状况统计查询
* @param formDTO
* @Author zxc
* @Date 2022/11/16 09:22
*/
RHZKStatisticsResultDTO renHuCondition(RHZKStatisticsFormDTO formDTO);
List<RHZKStatisticsResultDTO> renHuConditionList(RHZKStatisticsFormDTO formDTO);
}

9
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java

@ -246,9 +246,14 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp
public void edit(AddIcNatFormDTO formDTO) {
disposeIsNull(formDTO);
//0.先根据身份证号和检测时间以及检测结果校验除当前数据是否还存在相同数据
IcNatDTO icNatDTO = baseDao.getNatDTO(formDTO.getCustomerId(), formDTO.getIcNatId(), formDTO.getIdCard(), null != formDTO.getNatTime() ? DateUtils.format(formDTO.getNatTime(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE) : null, formDTO.getNatResult(), null != formDTO.getSampleTime() ? DateUtils.format(formDTO.getSampleTime(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE) : null);
IcNatDTO icNatDTO = baseDao.getNatDTO(formDTO.getCustomerId(),
formDTO.getIcNatId(),
formDTO.getIdCard(),
null != formDTO.getNatTime() ? DateUtils.format(formDTO.getNatTime(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE) : null,
formDTO.getNatResult(),
null != formDTO.getSampleTime() ? DateUtils.format(formDTO.getSampleTime(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE) : null);
if (null != icNatDTO) {
throw new RenException(EpmetErrorCode.IC_NAT.getCode(), EpmetErrorCode.IC_NAT.getMsg());
throw new EpmetException(EpmetErrorCode.IC_NAT.getCode(), EpmetErrorCode.IC_NAT.getMsg());
}
//1.更新核酸记录基础信息表数据
IcNatEntity entity = ConvertUtils.sourceToTarget(formDTO, IcNatEntity.class);

12
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java

@ -6,6 +6,7 @@ import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.epmet.bean.ResiImportCategoryData;
@ -452,6 +453,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
String currUserAgencyPids, String currentUserId, String tableName) {
String loginUserCustomerId = EpmetRequestHolder.getLoginUserCustomerId();
// 遍历每一行,将行内容转化为
String idCard = null;
for (Map<Integer, String> row : dataRows) {
LinkedHashMap<String, String> columnAndValues = new LinkedHashMap<>();
@ -462,7 +464,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
execSpecifiedCheckAndFill(columnAndValues);
//默认新增
columnAndValues.put("SUB_STATUS", IcResiUserSubStatusEnum.IMPORT.getSubStatus());
String idCard = columnAndValues.get("ID_CARD");
idCard = columnAndValues.get("ID_CARD");
Map<String, String> existingResiMap = icResiUserDao.selectResiInfoMap(loginUserCustomerId, idCard, null);
if (existingResiMap == null) {
@ -579,7 +581,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
errorMsg = e.getMessage();
} else {
errorMsg = "未知系统错误";
log.error(ExceptionUtils.getErrorStackTrace(e));
log.error("【居民信息导入】导入身份证为{}的居民基础信息出现未知错误:{}", idCard == null ? "" : idCard, ExceptionUtils.getErrorStackTrace(e));
}
ErrorRow errorRow = new ErrorRow();
@ -695,12 +697,12 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
// 遍历每一行,将行内容转化为
for (Map<Integer, String> row : dataRows) {
String idCard = null;
try {
convertColumnWrappers2Map4Persist(headerColumnWrapper, row, currUserAgencyId, checkBoxOptionColumnIdxAndLabel, columnAndValues, false);
// 检验身份证号
String idCard = columnAndValues.get("ID_CARD");
idCard = columnAndValues.get("ID_CARD");
if (StringUtils.isBlank(idCard)) {
String resiName = columnAndValues.get("NAME");
if (resiName == null) {
@ -754,7 +756,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
errorMsg = e.getMessage();
} else {
errorMsg = "未知系统错误";
log.error(ExceptionUtils.getErrorStackTrace(e));
log.error("【居民信息导入】导入身份证为{}的居民扩展信息{}出现未知错误:{}", idCard == null ? "" : idCard, targetTableName, ExceptionUtils.getErrorStackTrace(e));
}
ErrorRow errorRow = new ErrorRow();

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

@ -58,11 +58,13 @@ import com.epmet.dao.*;
import com.epmet.dto.*;
import com.epmet.dto.form.*;
import com.epmet.dto.form.demand.UserDemandNameQueryFormDTO;
import com.epmet.dto.form.stats.UserHouseStatsQueryFormDTO;
import com.epmet.dto.result.*;
import com.epmet.dto.result.demand.IcResiDemandDictDTO;
import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.dto.result.resi.IcResiNonDynamicResultDTO;
import com.epmet.entity.*;
import com.epmet.enums.RenHuConditionEnum;
import com.epmet.excel.EpidemicPreventionExportExcel;
import com.epmet.excel.support.ExportResiUserItemDTO;
import com.epmet.feign.*;
@ -72,6 +74,7 @@ import com.epmet.opendata.dto.result.ResidentByIdCardResultDTO;
import com.epmet.opendata.feign.GuardarDatosFeignClient;
import com.epmet.resi.partymember.feign.ResiPartyMemberOpenFeignClient;
import com.epmet.service.*;
import com.epmet.stats.UserHouseStatsResultDTO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@ -167,6 +170,9 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
@Resource
private IcUserChangeDetailedDao icUserChangeDetailedDao;
@Autowired
private DataReportOpenFeignClient dataReportOpenFeignClient;
private QueryWrapper<IcResiUserEntity> getWrapper(Map<String, Object> params) {
@ -1478,6 +1484,12 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
if (RelationshipEnum.SELF.getCode().equals(item.getYhzgx())) {
result.setOwnerName(item.getName());
}
//2022.11.17 返参增加人户状况名称
if (StringUtils.isBlank(item.getRhzk())){
bean.setRenHuCondition(RenHuConditionEnum.ZBQC.getName());
}else {
bean.setRenHuCondition(RenHuConditionEnum.getNameByCode(item.getRhzk()));
}
return bean;
}).collect(Collectors.toList());
result.setUserList(userList);
@ -2090,6 +2102,16 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
resultDTO.setOrgId(formDTO.getOrgId());
resultDTO.setOrgType(formDTO.getOrgType());
// 计算较上月的数据
Date lastDayOfLastMonth = DateUtils.getLastDayOfMonth(DateUtils.addDateMonths(new Date(), -1));
UserHouseStatsQueryFormDTO form = new UserHouseStatsQueryFormDTO(formDTO.getOrgId(), formDTO.getOrgType(), DateUtils.format(lastDayOfLastMonth, "yyyyMMdd"));
UserHouseStatsResultDTO lastMonthUserHouseStats = getResultDataOrThrowsException(dataReportOpenFeignClient.getUserHouseDailyStatsByDateId(form),
ServiceConstant.DATA_REPORT_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null, null);
resultDTO.setUserTotalJSY(resultDTO.getUserTotal() - lastMonthUserHouseStats.getUserTotal());
resultDTO.setCzUserTotalJSY(resultDTO.getCzUserTotal() - lastMonthUserHouseStats.getCzUserTotal());
resultDTO.setLdUserTotalJSY(resultDTO.getLdUserTotal() - lastMonthUserHouseStats.getLdUserTotal());
return resultDTO;
}
@ -3630,4 +3652,79 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
}
}
/**
* @Description 人户状况统计查询
* @param formDTO
* @Author zxc
* @Date 2022/11/16 09:22
*/
@Override
public RHZKStatisticsResultDTO renHuCondition(RHZKStatisticsFormDTO formDTO) {
if (StringUtils.isBlank(formDTO.getOrgId())){
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId());
if (null == staffInfo){
throw new EpmetException("未查询到工作人员:"+formDTO.getStaffId());
}
formDTO.setOrgId(staffInfo.getAgencyId());
formDTO.setOrgType("agency");
}
List<RHZKStatisticsResultDTO> userByRenHu = baseDao.getUserByRenHu(formDTO);
RHZKStatisticsResultDTO r = new RHZKStatisticsResultDTO();
if (CollectionUtils.isEmpty(userByRenHu)){
return r;
}
r.setOrgId(formDTO.getOrgId());
r.setUserTotal(userByRenHu.stream().collect(Collectors.summingInt(RHZKStatisticsResultDTO::getTotal)));
userByRenHu.forEach(u -> {
switch (u.getRhzk()){
case UserConstant.R_H_Y_Z:
r.setRhyzUserTotal(u.getTotal());
r.setRhyzUserRatio(getRatio(r.getUserTotal(),u.getTotal()));
break;
case UserConstant.R_Z_H_B_Z:
r.setRzhbzUserTotal(u.getTotal());
r.setRzhbzUserRatio(getRatio(r.getUserTotal(),u.getTotal()));
break;
case UserConstant.H_Z_R_B_Z:
r.setHzrbzUserTotal(u.getTotal());
r.setHzrbzUserRatio(getRatio(r.getUserTotal(),u.getTotal()));
break;
case UserConstant.Z_B_Q_C:
r.setZbqcUserTotal(u.getTotal());
r.setZbqcUserRatio(getRatio(r.getUserTotal(),u.getTotal()));
break;
default:
break;
}
});
return r;
}
@Override
public List<RHZKStatisticsResultDTO> renHuConditionList(RHZKStatisticsFormDTO formDTO) {
if (CollectionUtils.isEmpty(formDTO.getOrgIds())){
return new ArrayList<>();
}
List<RHZKStatisticsResultDTO> result = new ArrayList<>();
formDTO.getOrgIds().forEach(o -> {
formDTO.setOrgId(o);
result.add(renHuCondition(formDTO));
});
return result;
}
/**
* @Description
* @param total 总人数
* @param fz 分子人数
* @Author zxc
* @Date 2022/11/16 10:12
*/
public BigDecimal getRatio(Integer total,Integer fz){
BigDecimal totalBig = new BigDecimal(total);
BigDecimal fzBig = new BigDecimal(fz);
return fzBig.multiply(NumConstant.ONE_HUNDRED_DECIMAL).divide(totalBig, NumConstant.TWO, BigDecimal.ROUND_HALF_UP);
}
}

4
epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.89__alter_ic_nat.sql

@ -0,0 +1,4 @@
-- 核酸记录表增加非必填字段“试管编号” 对应产蛋4679
ALTER TABLE `ic_nat`
ADD COLUMN `TEST_TUBE_CODE` varchar(255) NULL COMMENT '试管编号' AFTER `ATTACHMENT_URL`;

3
epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.90__alter_ic_move_in_record.sql

@ -0,0 +1,3 @@
ALTER TABLE `ic_move_in_record`
MODIFY COLUMN `ADDRESS` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '详细地址' AFTER `SOURCE_ADDRESS`;

0
epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.89__data_sync_job_create.sql → epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.91__data_sync_job_create.sql

BIN
epmet-user/epmet-user-server/src/main/resources/excel/ic_nat.xlsx

Binary file not shown.

BIN
epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_import_template.xls

Binary file not shown.

5
epmet-user/epmet-user-server/src/main/resources/mapper/ChangeDeathDao.xml

@ -44,7 +44,10 @@
d.UPDATED_TIME
FROM
pli_change_death d
LEFT JOIN ic_resi_user u ON u.ID_CARD = d.ID_CARD
LEFT JOIN ic_resi_user u
ON (u.ID_CARD = d.ID_CARD
and u.DEL_FLAG='0'
and d.CUSTOMER_ID=u.CUSTOMER_ID)
LEFT JOIN pli_change_welfare w ON d.ID_CARD = w.ID_CARD
AND w.DEL_FLAG = '0'
WHERE

12
epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml

@ -16,7 +16,8 @@
nat_address natAddress,
file_name fileName,
attachment_url attachmentUrl,
created_time reportTime
created_time reportTime,
test_tube_code testTubeCode
FROM
ic_nat
WHERE
@ -45,7 +46,8 @@
b.nat_time natTime,
b.sample_time sampleTime,
b.nat_result natResult,
b.nat_address natAddress
b.nat_address natAddress,
b.test_tube_code testTubeCode
FROM
ic_nat_relation a
INNER JOIN ic_nat b ON a.IC_NAT_ID = b.ID
@ -93,7 +95,8 @@
nat_time natTime,
sample_time sampleTime,
nat_result natResult,
nat_address natAddress
nat_address natAddress,
test_tube_code testTubeCode
FROM
ic_nat
WHERE
@ -134,7 +137,8 @@
nat_time,
sample_time,
nat_result,
nat_address
nat_address,
test_tube_code
FROM
ic_nat
WHERE

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

@ -182,6 +182,7 @@
</sql>
<!-- 查询列表用 -->
<!-- 2022.11.18 小寨子写死排序 -->
<select id="selectListResiMap" parameterType="map" resultType="map">
select
ic_resi_user.id as icResiUserId,
@ -200,9 +201,9 @@
<include refid="listWhereForPage"></include>
<if test="keyword != null and keyword != ''">
AND (
NAME = #{keyword}
or MOBILE = #{keyword}
or ID_CARD = #{keyword}
NAME like concat('%', #{keyword},'%')
or MOBILE like concat('%', #{keyword},'%')
or ID_CARD like concat('%', #{keyword},'%')
)
</if>
</where>
@ -212,13 +213,26 @@
${groupTableName}.ID
</foreach>
</if>
ORDER BY
IC_RESI_USER.GRID_ID desc,
IC_RESI_USER.VILLAGE_ID ASC,
IC_RESI_USER.BUILD_ID ASC,
IC_RESI_USER.UNIT_ID ASC,
IC_RESI_USER.HOME_ID ASC,
IC_RESI_USER.ID ASC
<choose>
<when test="customerId == '1536638904600752130' ">
ORDER BY
field( IC_RESI_USER.GRID_ID, '1537272060187049986', '1537272342477508609', '1537275342477501111', '1593432493598076929' ),
IC_RESI_USER.VILLAGE_ID ASC,
IC_RESI_USER.BUILD_ID ASC,
IC_RESI_USER.UNIT_ID ASC,
IC_RESI_USER.HOME_ID ASC,
IC_RESI_USER.ID ASC
</when>
<otherwise>
ORDER BY
IC_RESI_USER.GRID_ID desc,
IC_RESI_USER.VILLAGE_ID ASC,
IC_RESI_USER.BUILD_ID ASC,
IC_RESI_USER.UNIT_ID ASC,
IC_RESI_USER.HOME_ID ASC,
IC_RESI_USER.ID ASC
</otherwise>
</choose>
</select>
<update id="updateToDel" parameterType="map">
@ -1359,6 +1373,18 @@
<if test='null != type and type.trim() != "" and type == "ld" '>
AND (is_floating != '0' or is_floating is null)
</if>
<if test='null != rhType and rhType.trim() != "" and rhType == "rhyz" '>
AND RHZK = 'rhyz'
</if>
<if test='null != rhType and rhType.trim() != "" and rhType == "rzhbz" '>
AND RHZK = 'rzhbz'
</if>
<if test='null != rhType and rhType.trim() != "" and rhType == "hzrbz" '>
AND RHZK = 'hzrbz'
</if>
<if test='null != rhType and rhType.trim() != "" and rhType == "no" '>
AND(RHZK = '' or RHZK IS null)
</if>
<choose>
<when test='orgType == "agency"'>
AND (agency_id = #{orgId} OR pids LIKE CONCAT('%', #{orgId}, '%'))
@ -1402,6 +1428,41 @@
AND ID_CARD = #{idCard}
</select>
<!-- 根据人户状况查询每个类型的人数 -->
<select id="getUserByRenHu" resultType="com.epmet.dto.result.RHZKStatisticsResultDTO">
SELECT
COUNT(ID) AS total,
rhzk,
orgId
FROM
(SELECT
ID,
IFNULL(RHZK,'') AS rhzk,
<if test='orgType == "agency" '>
AGENCY_ID AS orgId
</if>
<if test='orgType == "grid" '>
GRID_ID AS orgId
</if>
<if test='orgType == "village" '>
VILLAGE_ID AS orgId
</if>
FROM ic_resi_user
WHERE DEL_FLAG = '0'
AND `STATUS` = '0'
<if test='orgType == "agency" '>
AND PIDS LIKE CONCAT('%',#{orgId},'%')
</if>
<if test='orgType == "grid" '>
AND GRID_ID = #{orgId}
</if>
<if test='orgType == "village" '>
AND VILLAGE_ID = #{orgId}
</if>
) t
GROUP BY rhzk
</select>
<select id="getResiUserList" resultType="com.epmet.dto.IcResiUserDTO">
SELECT
a.id,

Loading…
Cancel
Save