Browse Source

Merge remote-tracking branch 'remotes/origin/develop' into release_temp

dev_shibei_match
jianjun 4 years ago
parent
commit
64c21c1399
  1. 21
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java
  2. 12
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonAggFeignClientFallback.java
  3. 93
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerOrgRedis.java
  4. 142
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/AgencyInfoCache.java
  5. 116
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/GridInfoCache.java
  6. 10
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/CustomerGridDTO.java
  7. 31
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java
  8. 8
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerGridDao.java
  9. 17
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java
  10. 23
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
  11. 12
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml
  12. 49
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/form/CategoryProjectListFormDTO.java
  13. 37
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/form/ProjectCategoryFormDTO.java
  14. 61
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/CategoryProjectListResultDTO.java
  15. 28
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/PageCategoryProjectListResultDTO.java
  16. 64
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectCategoryResultDTO.java
  17. 56
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectCategorySonResultDTO.java
  18. 10
      epmet-module/data-report/data-report-server/pom.xml
  19. 84
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java
  20. 31
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.java
  21. 12
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectDataDao.java
  22. 6
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectOrgDailyDao.java
  23. 26
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/ScreenProjectService.java
  24. 172
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java
  25. BIN
      epmet-module/data-report/data-report-server/src/main/resources/excel/project_category_temp.xlsx
  26. 49
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectCategoryOrgDailyDao.xml
  27. 21
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml
  28. 26
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectOrgDailyDao.xml
  29. 5
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyResultDTO.java
  30. 2
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyTreeResultDTO.java
  31. 24
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/BuildingResultDTO.java
  32. 30
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseListResultDTO.java
  33. 3
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java
  34. 5
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java
  35. 6
      epmet-module/gov-org/gov-org-server/pom.xml
  36. 14
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/BuildingController.java
  37. 16
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java
  38. 15
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcHouseController.java
  39. 10
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java
  40. 3
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingDao.java
  41. 3
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/BuildingService.java
  42. 12
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java
  43. 12
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcHouseService.java
  44. 7
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java
  45. 58
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
  46. 77
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java
  47. 13
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
  48. 20
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml
  49. 4
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/BaseGridInfoController.java
  50. 3
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridInfoServiceImpl.java
  51. 9
      epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/ExDeptDao.xml
  52. 3
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/IcResiCategoryStatsConfigSortFormDTO.java
  53. 26
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java
  54. 27
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java
  55. 11
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormItemOptionsController.java
  56. 5
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcResiCategoryStatsConfigController.java
  57. 43
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/ResiCategoryStatsConfigController.java
  58. 13
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormItemOptionsDao.java
  59. 4
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcResiCategoryWarnConfigEntity.java
  60. 8
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcFormItemOptionsService.java
  61. 9
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcResiCategoryStatsConfigService.java
  62. 11
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormItemOptionsServiceImpl.java
  63. 24
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcResiCategoryStatsConfigServiceImpl.java
  64. 26
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/ResiCategoryStatsConfigServiceImpl.java
  65. 15
      epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormItemOptionsDao.xml
  66. 111
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcStatsResiWarnDTO.java
  67. 46
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StatsResiListFormDTO.java
  68. 55
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StatsResiWarnFormDTO.java
  69. 44
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcStatsResiResultDTO.java
  70. 58
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcStatsResiWarnBuildingResultDTO.java
  71. 47
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcStatsResiWarnUserResultDTO.java
  72. 12
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PersonDataResultDTO.java
  73. 3
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  74. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
  75. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/constant/LevelConstant.java
  76. 1
      epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserConstant.java
  77. 79
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
  78. 94
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcStatsResiWarnController.java
  79. 95
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StatsResiWarnController.java
  80. 16
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java
  81. 49
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcStatsResiWarnDao.java
  82. 81
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcStatsResiWarnEntity.java
  83. 82
      epmet-user/epmet-user-server/src/main/java/com/epmet/enums/IcResiUserTableEnums.java
  84. 80
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcStatsResiWarnExcel.java
  85. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/DynamicEasyExcelListener.java
  86. 47
      epmet-user/epmet-user-server/src/main/java/com/epmet/redis/IcStatsResiWarnRedis.java
  87. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserImportService.java
  88. 14
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java
  89. 95
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcStatsResiWarnService.java
  90. 41
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/StatsResiWarnService.java
  91. 356
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java
  92. 82
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  93. 104
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcStatsResiWarnServiceImpl.java
  94. 210
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsResiWarnServiceImpl.java
  95. BIN
      epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_info_cid.xls
  96. 42
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml
  97. 106
      epmet-user/epmet-user-server/src/main/resources/mapper/IcStatsResiWarnDao.xml

21
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java

@ -2,11 +2,14 @@ package com.epmet.commons.tools.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.feign.fallback.CommonAggFeignClientFallBackFactory;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.redis.common.bean.CustomerStaffInfoCache;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.utils.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
@ -24,4 +27,22 @@ public interface CommonAggFeignClient {
*/
@PostMapping("/data/aggregator/epmetuser/getStaffInfo/{staffId}")
Result<CustomerStaffInfoCache> getStaffInfo(@PathVariable("staffId") String staffId);
/**
* @Description 查询组织信息
* @param agencyId
* @author zxc
* @date 2021/11/5 2:54 下午
*/
@PostMapping("/data/aggregator/org/agency")
Result<AgencyInfoCache> getAgencyInfo(@RequestParam("agencyId")String agencyId);
/**
* @Description 查询网格信息
* @param gridId
* @author zxc
* @date 2021/11/5 2:54 下午
*/
@PostMapping("/data/aggregator/org/grid")
Result<GridInfoCache> getGridInfo(@RequestParam("gridId")String gridId);
}

12
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonAggFeignClientFallback.java

@ -2,7 +2,9 @@ package com.epmet.commons.tools.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.feign.CommonAggFeignClient;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.redis.common.bean.CustomerStaffInfoCache;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import org.springframework.stereotype.Component;
@ -20,4 +22,14 @@ public class CommonAggFeignClientFallback implements CommonAggFeignClient {
public Result<CustomerStaffInfoCache> getStaffInfo(String staffId) {
return ModuleUtils.feignConError(ServiceConstant.DATA_AGGREGATOR_SERVER, "getStaffInfo", staffId);
}
@Override
public Result<AgencyInfoCache> getAgencyInfo(String agencyId) {
return ModuleUtils.feignConError(ServiceConstant.DATA_AGGREGATOR_SERVER, "getAgencyInfo", agencyId);
}
@Override
public Result<GridInfoCache> getGridInfo(String gridId) {
return ModuleUtils.feignConError(ServiceConstant.DATA_AGGREGATOR_SERVER, "getGridInfo", gridId);
}
}

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

@ -0,0 +1,93 @@
package com.epmet.commons.tools.redis.common;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.feign.CommonAggFeignClient;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.redis.common.bean.*;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import javax.annotation.PostConstruct;
import java.util.Map;
/**
* @Author zxc
* @DateTime 2021/11/5 2:29 下午
* @DESC
*/
@Slf4j
@Component
public class CustomerOrgRedis {
@Autowired
private RedisUtils redisUtils;
@Autowired
private CommonAggFeignClient commonAggFeignClient;
private static CustomerOrgRedis customerOrgRedis;
private static final String ROLE_MAP_KEY = "roleMap";
@PostConstruct
public void init() {
customerOrgRedis = this;
customerOrgRedis.redisUtils = this.redisUtils;
customerOrgRedis.commonAggFeignClient = this.commonAggFeignClient;
}
/**
* @Description 获取网格信息
* @param gridId
* @author zxc
* @date 2021/11/5 3:12 下午
*/
public static GridInfoCache getGridInfo(String gridId){
String key = RedisKeys.getGridInfoKey(gridId);
Map<String, Object> grid = customerOrgRedis.redisUtils.hGetAll(key);
if (!CollectionUtils.isEmpty(grid)) {
return ConvertUtils.mapToEntity(grid, GridInfoCache.class);
}
Result<GridInfoCache> gridInfoResult = customerOrgRedis.commonAggFeignClient.getGridInfo(gridId);
if (!gridInfoResult.success()){
throw new RenException("查询网格信息失败...");
}
if (null == gridInfoResult.getData()){
throw new RenException("没有此网格信息...");
}
Map<String, Object> map = BeanUtil.beanToMap(gridInfoResult.getData(), false, true);
customerOrgRedis.redisUtils.hMSet(key, map);
return gridInfoResult.getData();
}
/**
* @Description 获取组织信息
* @param agencyId
* @author zxc
* @date 2021/11/5 3:12 下午
*/
public static AgencyInfoCache getAgencyInfo(String agencyId){
String key = RedisKeys.getAgencyByIdKey(agencyId);
Map<String, Object> agency = customerOrgRedis.redisUtils.hGetAll(key);
if (!CollectionUtils.isEmpty(agency)) {
return ConvertUtils.mapToEntity(agency, AgencyInfoCache.class);
}
Result<AgencyInfoCache> agencyInfoResult = customerOrgRedis.commonAggFeignClient.getAgencyInfo(agencyId);
if (!agencyInfoResult.success()){
throw new RenException("查询组织信息失败...");
}
if (null == agencyInfoResult.getData()){
throw new RenException("没有此组织信息...");
}
Map<String, Object> map = BeanUtil.beanToMap(agencyInfoResult.getData(), false, true);
customerOrgRedis.redisUtils.hMSet(key, map);
return agencyInfoResult.getData();
}
}

142
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/AgencyInfoCache.java

@ -0,0 +1,142 @@
package com.epmet.commons.tools.redis.common.bean;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @Author zxc
* @DateTime 2021/11/5 2:45 下午
* @DESC
*/
@Data
public class AgencyInfoCache implements Serializable {
private static final long serialVersionUID = -1332373159954084159L;
/**
* ID
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 上级组织机构ID
*/
private String pid;
/**
* 所有上级组织机构ID(以英文:隔开)
*/
private String pids;
/**
* 所有上级名称,-连接
*/
private String allParentName;
/**
* 组织名称
*/
private String organizationName;
/**
* 机关级别社区级community
街道:street,
区县级: district,
市级: city
省级:province 机关级别社区级community街道:street,区县级: district,市级: city省级:province
*/
private String level;
/**
* 地区编码
*/
private String areaCode;
/**
* 删除标识
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
/**
* 总人数
*/
private Integer totalUser;
/**
*
*/
private String province;
/**
*
*/
private String city;
/**
* 区县
*/
private String district;
/**
* 当前组织的上级行政地区编码add0204;举例平阴县对应的是济南市3701
*/
private String parentAreaCode;
/**
* 街道
*/
private String street;
/**
* 社区
*/
private String community;
/**
* 坐标区域
*/
private String coordinates;
/**
* 中心位置经度
*/
private String longitude;
/**
* 中心位置纬度
*/
private String latitude;
}

116
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/GridInfoCache.java

@ -0,0 +1,116 @@
package com.epmet.commons.tools.redis.common.bean;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @Author zxc
* @DateTime 2021/11/5 2:24 下午
* @DESC
*/
@Data
public class GridInfoCache implements Serializable {
private static final long serialVersionUID = -6159429894486235267L;
/**
* ID 唯一标识
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 网格名称
*/
private String gridName;
/** 组织-网格 */
private String gridNamePath;
/**
* 中心位置经度
*/
private String longitude;
/**
* 中心位置纬度
*/
private String latitude;
/**
* 所属地区码所属组织地区码
*/
private String areaCode;
/**
* 删除标识:0.未删除 1.已删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
/**
* 管辖区域
*/
private String manageDistrict;
/**
* 当前网格总人数
*/
private Integer totalUser;
/**
* 所属组织机构IDcustomer_organization.id
*/
private String pid;
/**
* 所有上级组织ID
*/
private String pids;
/**
* 所属组织机构名
*/
private String agencyName;
/**
* 所有上级组织名
*/
private String allParentName;
/**
* 坐标区域
*/
private String coordinates;
}

10
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/CustomerGridDTO.java

@ -59,6 +59,11 @@ public class CustomerGridDTO implements Serializable {
*/
private String latitude;
/**
* 坐标区域
*/
private String coordinates;
/**
* 所属地区码所属组织地区码
*/
@ -123,4 +128,9 @@ public class CustomerGridDTO implements Serializable {
* 所有上级组织名
*/
private String allParentName;
/**
* 组织-网格
*/
private String gridNamePath;
}

31
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java

@ -9,18 +9,19 @@ import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dataaggre.dto.govorg.CustomerAgencyDTO;
import com.epmet.dataaggre.dto.govorg.CustomerGridDTO;
import com.epmet.dataaggre.dto.govorg.form.*;
import com.epmet.dataaggre.dto.govorg.result.*;
import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity;
import com.epmet.dataaggre.entity.govorg.CustomerGridEntity;
import com.epmet.dataaggre.enums.GridMemberDataAnalysisEnums;
import com.epmet.dataaggre.service.AggreGridService;
import com.epmet.dataaggre.service.govorg.GovOrgService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
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 org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
@ -178,4 +179,26 @@ public class GovOrgController {
return new Result<List<OrgTreeResultDTO>>().ok(govOrgService.getAgencyTree(tokenDto, formDTO));
}
/**
* @Description 查询组织信息
* @param agencyId
* @author zxc
* @date 2021/11/5 2:54 下午
*/
@PostMapping("agency")
public Result<CustomerAgencyEntity> getAgencyInfo(@RequestParam("agencyId")String agencyId){
return new Result<CustomerAgencyEntity>().ok(govOrgService.getAgencyInfo(agencyId));
}
/**
* @Description 查询网格信息
* @param gridId
* @author zxc
* @date 2021/11/5 2:54 下午
*/
@PostMapping("grid")
public Result<CustomerGridDTO> getGridInfo(@RequestParam("gridId")String gridId){
return new Result<CustomerGridDTO>().ok(govOrgService.getGridInfo(gridId));
}
}

8
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerGridDao.java

@ -76,4 +76,12 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
**/
List<StaffAgencyGridListResultDTO.GridResultDTO> getGridListByAgencyId(@Param("agencyId") String agencyId);
/**
* @Description 查询网格信息
* @param gridId
* @author zxc
* @date 2021/11/5 3:39 下午
*/
CustomerGridDTO getGridInfo(@Param("gridId") String gridId);
}

17
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java

@ -10,6 +10,8 @@ import com.epmet.dataaggre.dto.govorg.form.StaffDetailV2FormDTO;
import com.epmet.dataaggre.dto.govorg.form.SubOrgFormDTO;
import com.epmet.dataaggre.dto.govorg.result.*;
import com.epmet.dataaggre.dto.resigroup.result.OrgInfoCommonDTO;
import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity;
import com.epmet.dataaggre.entity.govorg.CustomerGridEntity;
import java.util.List;
@ -155,4 +157,19 @@ public interface GovOrgService {
*/
List<String> getStaffOrgList(String staffId);
/**
* @Description 查询组织信息
* @param agencyId
* @author zxc
* @date 2021/11/5 2:54 下午
*/
CustomerAgencyEntity getAgencyInfo(String agencyId);
/**
* @Description 查询网格信息
* @param gridId
* @author zxc
* @date 2021/11/5 2:57 下午
*/
CustomerGridDTO getGridInfo(String gridId);
}

23
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java

@ -20,6 +20,7 @@ import com.epmet.dataaggre.dto.govorg.form.SubOrgFormDTO;
import com.epmet.dataaggre.dto.govorg.result.*;
import com.epmet.dataaggre.dto.resigroup.result.OrgInfoCommonDTO;
import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity;
import com.epmet.dataaggre.entity.govorg.CustomerGridEntity;
import com.epmet.dataaggre.service.commonservice.AreaCodeService;
import com.epmet.dataaggre.service.epmetuser.EpmetUserService;
import com.epmet.dataaggre.service.govorg.GovOrgService;
@ -532,5 +533,27 @@ public class GovOrgServiceImpl implements GovOrgService {
return customerAgencyDao.getOrgList(staffId);
}
/**
* @Description 查询组织信息
* @param agencyId
* @author zxc
* @date 2021/11/5 2:54 下午
*/
@Override
public CustomerAgencyEntity getAgencyInfo(String agencyId) {
return customerAgencyDao.selectById(agencyId);
}
/**
* @Description 查询网格信息
* @param gridId
* @author zxc
* @date 2021/11/5 2:57 下午
*/
@Override
public CustomerGridDTO getGridInfo(String gridId) {
return customerGridDao.getGridInfo(gridId);
}
}

12
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml

@ -163,4 +163,16 @@
AND cg.pid = #{agencyId}
</select>
<!-- 查询网格信息 -->
<select id="getGridInfo" resultType="com.epmet.dataaggre.dto.govorg.CustomerGridDTO">
SELECT
ca.ORGANIZATION_NAME AS agencyName,
CONCAT(ca.ORGANIZATION_NAME,'-',cg.GRID_NAME) AS gridNamePath,
cg.*
FROM customer_grid cg
LEFT JOIN customer_agency ca ON (ca.ID = cg.PID AND ca.DEL_FLAG = '0')
WHERE cg.DEL_FLAG = '0'
AND cg.ID = #{gridId}
</select>
</mapper>

49
epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/form/CategoryProjectListFormDTO.java

@ -0,0 +1,49 @@
package com.epmet.project.dto.form;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/11/4 3:23 下午
* @DESC
*/
@Data
public class CategoryProjectListFormDTO implements Serializable {
private static final long serialVersionUID = -5448734274886241594L;
public interface CategoryProjectListForm{}
@NotNull(message = "pageSize不能为空",groups = CategoryProjectListForm.class)
private Integer pageSize;
@NotNull(message = "pageNo不能为空",groups = CategoryProjectListForm.class)
private Integer pageNo;
/**
* 项目状态closed已结案all全部
*/
@NotNull(message = "status不能为空",groups = CategoryProjectListForm.class)
private String status;
@NotNull(message = "categoryCode不能为空",groups = CategoryProjectListForm.class)
private String categoryCode;
/**
* 组织ID
*/
private String orgId;
/**
* 组织类型agency组织grid网格
*/
private String orgType;
/**
* 是否分页默认truefalse的时候 给导出用
*/
private Boolean isPage = true;
}

37
epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/form/ProjectCategoryFormDTO.java

@ -0,0 +1,37 @@
package com.epmet.project.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/11/4 3:18 下午
* @DESC
*/
@Data
public class ProjectCategoryFormDTO implements Serializable {
private static final long serialVersionUID = 5047143743629810527L;
public interface ProjectCategoryForm{}
/**
* 组织ID
*/
private String orgId;
/**
* 组织类型 组织agency网格grid
*/
private String orgType;
@NotBlank(message = "结束时间不能为空",groups = ProjectCategoryForm.class)
private String endTime;
/**
* 开始时间
*/
private String startTime;
}

61
epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/CategoryProjectListResultDTO.java

@ -0,0 +1,61 @@
package com.epmet.project.dto.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/11/4 3:31 下午
* @DESC
*/
@Data
public class CategoryProjectListResultDTO implements Serializable {
private static final long serialVersionUID = 8820354423099062062L;
/**
* 分类
*/
private String category;
/**
* 项目状态:待处理 pending结案closed
*/
private String projectStatus;
/**
* 项目标题
*/
private String projectTitle;
/**
* 网格
*/
private String gridName;
/**
* 项目创建时间
*/
private String createTime;
/**
* 项目ID
*/
private String projectId;
@JsonIgnore
private String orgId;
@JsonIgnore
private String orgType;
public CategoryProjectListResultDTO() {
this.category = "";
this.projectStatus = "";
this.projectTitle = "";
this.gridName = "";
this.createTime = "";
}
}

28
epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/PageCategoryProjectListResultDTO.java

@ -0,0 +1,28 @@
package com.epmet.project.dto.result;
import com.epmet.commons.tools.constant.NumConstant;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* @Author zxc
* @DateTime 2021/11/5 1:51 下午
* @DESC
*/
@Data
public class PageCategoryProjectListResultDTO implements Serializable {
private static final long serialVersionUID = 8822993169364931502L;
private Integer total;
private List<CategoryProjectListResultDTO> list;
public PageCategoryProjectListResultDTO() {
this.total = NumConstant.ZERO;
this.list = new ArrayList<>();
}
}

64
epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectCategoryResultDTO.java

@ -0,0 +1,64 @@
package com.epmet.project.dto.result;
import com.epmet.commons.tools.constant.NumConstant;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* @Author zxc
* @DateTime 2021/11/4 3:13 下午
* @DESC
*/
@Data
public class ProjectCategoryResultDTO implements Serializable {
private static final long serialVersionUID = -2662970383306349424L;
/**
* 分类CODE
*/
private String categoryCode;
/**
* 分类名字
*/
private String categoryName;
/**
* 项目总数
*/
private Integer projectTotal;
/**
* 结案项目数
*/
private Integer closedProjectTotal;
/**
* 总数占比
*/
private String totalRatio;
/**
* 结案率
*/
private String closedRatio;
private List<ProjectCategoryResultDTO> children;
@JsonIgnore
private int index;
public ProjectCategoryResultDTO() {
this.categoryCode = "";
this.categoryName = "";
this.projectTotal = NumConstant.ZERO;
this.closedProjectTotal = NumConstant.ZERO;
this.totalRatio = "";
this.closedRatio = "";
this.children = new ArrayList<>();
}
}

56
epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectCategorySonResultDTO.java

@ -0,0 +1,56 @@
package com.epmet.project.dto.result;
import com.epmet.commons.tools.constant.NumConstant;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/11/4 3:13 下午
* @DESC
*/
@Data
public class ProjectCategorySonResultDTO implements Serializable {
private static final long serialVersionUID = -2662970383306349424L;
/**
* 分类CODE
*/
private String categoryCode;
/**
* 分类名字
*/
private String categoryName;
/**
* 项目总数
*/
private Integer projectTotal;
/**
* 结案项目数
*/
private Integer closedProjectTotal;
/**
* 总数占比
*/
private String totalRatio;
/**
* 结案率
*/
private String closedRatio;
public ProjectCategorySonResultDTO() {
this.categoryCode = "";
this.categoryName = "";
this.projectTotal = NumConstant.ZERO;
this.closedProjectTotal = NumConstant.ZERO;
this.totalRatio = "";
this.closedRatio = "";
}
}

10
epmet-module/data-report/data-report-server/pom.xml

@ -116,6 +116,16 @@
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>xls</nonFilteredFileExtension>
<nonFilteredFileExtension>xlsx</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
</plugins>
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
<resources>

84
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java

@ -1,5 +1,13 @@
package com.epmet.datareport.controller.screen;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.datareport.service.evaluationindex.screen.ScreenProjectOrgDailyService;
@ -12,13 +20,24 @@ import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDetailFormDTO;
import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDistributionFormDTO;
import com.epmet.evaluationindex.screen.dto.result.ProjectDetailResultDTO;
import com.epmet.evaluationindex.screen.dto.result.ScreenProjectDistributionResultDTO;
import com.epmet.project.dto.form.CategoryProjectListFormDTO;
import com.epmet.project.dto.form.CategoryTopAppealFormDTO;
import com.epmet.project.dto.form.ProjectCategoryFormDTO;
import com.epmet.project.dto.result.CategoryTopAppealResultDTO;
import com.epmet.project.dto.result.PageCategoryProjectListResultDTO;
import com.epmet.project.dto.result.ProjectCategoryResultDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 项目
@ -155,4 +174,69 @@ public class ScreenProjectController {
return new Result<List<CategoryTopAppealResultDTO>>().ok(screenProjectService.categoryTopAppeal(formDTO));
}
/**
* @Description 项目分类查询项目分类
* @param formDTO
* @param tokenDto
* @author zxc
* @date 2021/11/4 3:38 下午
*/
@PostMapping("selectprojectcategory")
public Result<List<ProjectCategoryResultDTO>> selectProjectCategory(@RequestBody ProjectCategoryFormDTO formDTO, @LoginUser TokenDto tokenDto){
ValidatorUtils.validateEntity(formDTO, ProjectCategoryFormDTO.ProjectCategoryForm.class);
return new Result<List<ProjectCategoryResultDTO>>().ok(screenProjectService.selectProjectCategory(formDTO,tokenDto));
}
/**
* @Description 项目分类查询项目分类
* @param formDTO
* @param tokenDto
* @author zxc
* @date 2021/11/4 3:38 下午
*/
@PostMapping("selectprojectcategory/export")
public void selectProjectCategoryExport(@RequestBody ProjectCategoryFormDTO formDTO, /*@LoginUser*/ TokenDto tokenDto, HttpServletResponse response) throws Exception {
tokenDto.setUserId("36bc0fb38565ecdebf8ab9b476b44548");
tokenDto.setCustomerId("45687aa479955f9d06204d415238f7cc");
ValidatorUtils.validateEntity(formDTO, ProjectCategoryFormDTO.ProjectCategoryForm.class);
List<ProjectCategoryResultDTO> data = screenProjectService.selectProjectCategory(formDTO, tokenDto);
String templatePath = "excel/project_category_temp.xlsx";
StringBuilder dateBuilder = new StringBuilder();
if (StringUtils.isNotBlank(formDTO.getStartTime())){
dateBuilder.append(formDTO.getStartTime()).append(StrConstant.HYPHEN);
}
if (StringUtils.isNotBlank(formDTO.getEndTime())){
dateBuilder.append(formDTO.getEndTime());
}
List<ProjectCategoryResultDTO> resultDTOList = new ArrayList<>();
data.forEach(e->{
resultDTOList.add(e);
e.setIndex(1);
resultDTOList.addAll(ConvertUtils.sourceToTarget(e.getChildren(),ProjectCategoryResultDTO.class));
});
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId());
Map<String,Object> mapData = new HashMap<>();
mapData.put("list",resultDTOList);
mapData.put("orgName",staffInfo.getAgencyName());
mapData.put("exportDate",dateBuilder.toString());
Workbook workbook = ExcelExportUtil.exportExcel(new TemplateExportParams(templatePath), mapData);
response.setHeader("content-Type", "application/vnd.ms-excel");
response.addHeader("Content-Disposition", "attachment;fileName=" + URLEncoder.encode("项目分类统计.xls", "UTF-8"));
workbook.write(response.getOutputStream());
}
/**
* @Description 项目分类查询分类下的项目
* @param formDTO
* @param tokenDto
* @author zxc
* @date 2021/11/4 3:39 下午
*/
@PostMapping("selectcategoryprojectlist")
public Result<PageCategoryProjectListResultDTO> selectCategoryProjectList(@RequestBody CategoryProjectListFormDTO formDTO, @LoginUser TokenDto tokenDto){
ValidatorUtils.validateEntity(formDTO, CategoryProjectListFormDTO.CategoryProjectListForm.class);
return new Result<PageCategoryProjectListResultDTO>().ok(screenProjectService.selectCategoryProjectList(formDTO,tokenDto));
}
}

31
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.java

@ -19,7 +19,9 @@ package com.epmet.datareport.dao.evaluationindex.screen;
import com.epmet.dto.result.screen.CategoryAnalysisResultDTO;
import com.epmet.project.CustomerProjectCategoryDTO;
import com.epmet.project.dto.form.ProjectCategoryFormDTO;
import com.epmet.project.dto.result.CategoryTopAppealResultDTO;
import com.epmet.project.dto.result.ProjectCategoryResultDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -52,4 +54,33 @@ public interface ScreenProjectCategoryOrgDailyDao {
* @date 2021/8/18 1:40 下午
*/
List<CategoryTopAppealResultDTO> categoryTopAppeal(@Param("agencyId") String agencyId,@Param("customerId")String customerId,@Param("topCount")Integer topCount);
/**
* @Description 组织查询分类
* @param customerId
* @param time
* @param orgId
* @author zxc
* @date 2021/11/5 8:54 上午
*/
List<ProjectCategoryResultDTO> selectProjectCategoryByAgency(@Param("customerId")String customerId,@Param("time")String time,@Param("orgId")String orgId);
/**
* @Description 网格查询分类
* @param customerId
* @param time
* @param orgId
* @author zxc
* @date 2021/11/5 8:55 上午
*/
List<ProjectCategoryResultDTO> selectProjectCategoryByGrid(@Param("customerId")String customerId,@Param("time")String time,@Param("orgId")String orgId);
/**
* @Description 查询客户下所有分类
* @param customerId
* @author zxc
* @date 2021/11/4 5:45 下午
*/
List<ProjectCategoryResultDTO> selectCategoryByCustomerId(@Param("customerId")String customerId);
}

12
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectDataDao.java

@ -3,6 +3,7 @@ package com.epmet.datareport.dao.evaluationindex.screen;
import com.epmet.dto.result.screen.ColorProjectTotalResultDTO;
import com.epmet.evaluationindex.screen.dto.result.ScreenProjectDetailResultDTO;
import com.epmet.evaluationindex.screen.dto.result.ScreenProjectDistributionResultDTO;
import com.epmet.project.dto.result.CategoryProjectListResultDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -45,4 +46,15 @@ public interface ScreenProjectDataDao {
* @date 2021/6/1 3:48 下午
*/
List<ColorProjectTotalResultDTO> selectColorProjectByAreaCode(@Param("areaCode") String areaCode,@Param("monthCount")Integer monthCount);
/**
* @Description 查询分类下的项目列表
* @param customerId
* @param orgId
* @author zxc
* @date 2021/11/5 1:40 下午
*/
List<CategoryProjectListResultDTO> selectCategoryProjectList(@Param("customerId") String customerId,@Param("orgId") String orgId,
@Param("categoryCode")String categoryCode,@Param("status")String status);
}

6
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectOrgDailyDao.java

@ -19,6 +19,7 @@ package com.epmet.datareport.dao.evaluationindex.screen;
import com.epmet.dto.result.screen.EfficiencyAnalysisResultDTO;
import com.epmet.dto.result.screen.ProjectQuantityResultDTO;
import com.epmet.project.dto.form.ProjectCategoryFormDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -45,4 +46,9 @@ public interface ScreenProjectOrgDailyDao {
* @description 下级组织的效率解决率列表
**/
List<EfficiencyAnalysisResultDTO> queryEfficiencyAnalysis(@Param("customerId")String customerId,@Param("areaCode") String areaCode);
Integer selectProjectTotalByAgency(@Param("customerId")String customerId,@Param("time")String time,@Param("orgId")String orgId);
Integer selectProjectTotalByGrid(@Param("customerId")String customerId,@Param("time")String time,@Param("orgId")String orgId);
}

26
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/ScreenProjectService.java

@ -1,5 +1,6 @@
package com.epmet.datareport.service.evaluationindex.screen;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.screen.CategoryAnalysisFormDTO;
import com.epmet.dto.form.screen.ColorProjectTotalFormDTO;
@ -10,8 +11,13 @@ import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDetailFormDTO;
import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDistributionFormDTO;
import com.epmet.evaluationindex.screen.dto.result.ProjectDetailResultDTO;
import com.epmet.evaluationindex.screen.dto.result.ScreenProjectDistributionResultDTO;
import com.epmet.project.dto.form.CategoryProjectListFormDTO;
import com.epmet.project.dto.form.CategoryTopAppealFormDTO;
import com.epmet.project.dto.form.ProjectCategoryFormDTO;
import com.epmet.project.dto.result.CategoryProjectListResultDTO;
import com.epmet.project.dto.result.CategoryTopAppealResultDTO;
import com.epmet.project.dto.result.PageCategoryProjectListResultDTO;
import com.epmet.project.dto.result.ProjectCategoryResultDTO;
import java.util.List;
@ -62,4 +68,24 @@ public interface ScreenProjectService {
*/
List<CategoryTopAppealResultDTO> categoryTopAppeal(CategoryTopAppealFormDTO formDTO);
/**
* @Description 项目分类查询项目分类
* @param formDTO
* @param tokenDto
* @author zxc
* @date 2021/11/4 3:38 下午
*/
List<ProjectCategoryResultDTO> selectProjectCategory(ProjectCategoryFormDTO formDTO, TokenDto tokenDto);
/**
* @Description 项目分类查询分类下的项目
* @param formDTO
* @param tokenDto
* @author zxc
* @date 2021/11/4 3:39 下午
*/
PageCategoryProjectListResultDTO selectCategoryProjectList(CategoryProjectListFormDTO formDTO, TokenDto tokenDto);
}

172
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java

@ -3,14 +3,18 @@ package com.epmet.datareport.service.evaluationindex.screen.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
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.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.DataSourceConstant;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenEventDataDao;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenEventImgDataDao;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenProjectCategoryOrgDailyDao;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenProjectDataDao;
import com.epmet.datareport.constant.FactConstant;
import com.epmet.datareport.dao.evaluationindex.screen.*;
import com.epmet.datareport.service.evaluationindex.screen.ScreenProjectService;
import com.epmet.dto.UserDTO;
import com.epmet.dto.form.CustomerAgencyUserRoleFormDTO;
@ -26,15 +30,21 @@ import com.epmet.evaluationindex.screen.dto.result.ScreenProjectDetailResultDTO;
import com.epmet.evaluationindex.screen.dto.result.ScreenProjectDistributionResultDTO;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.project.CustomerProjectCategoryDTO;
import com.epmet.project.dto.form.CategoryProjectListFormDTO;
import com.epmet.project.dto.form.CategoryTopAppealFormDTO;
import com.epmet.project.dto.result.CategoryTopAppealResultDTO;
import com.epmet.project.dto.form.ProjectCategoryFormDTO;
import com.epmet.project.dto.result.*;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@ -63,6 +73,9 @@ public class ScreenProjectServiceImpl implements ScreenProjectService {
@Autowired
private EpmetUserOpenFeignClient userOpenFeignClient;
@Autowired
private ScreenProjectOrgDailyDao screenProjectOrgDailyDao;
/**
* @Description 3项目详情
* @param projectDetailFormDTO
@ -228,4 +241,153 @@ public class ScreenProjectServiceImpl implements ScreenProjectService {
}
return result;
}
/**
* @Description 项目分类查询项目分类
* @param formDTO
* @param tokenDto
* @author zxc
* @date 2021/11/4 3:38 下午
*/
@Override
public List<ProjectCategoryResultDTO> selectProjectCategory(ProjectCategoryFormDTO formDTO, TokenDto tokenDto) {
if (StringUtils.isBlank(formDTO.getOrgId())){
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId());
if (null == staffInfo){
throw new RenException("未查询到此工作人员的所属组织信息...");
}
formDTO.setOrgId(staffInfo.getAgencyId());
formDTO.setOrgType(FactConstant.AGENCY);
}
String customerId = tokenDto.getCustomerId();
String endTime = formDTO.getEndTime();
String startTime = formDTO.getStartTime();
String orgId = formDTO.getOrgId();
// 查询客户下的所有分类
List<ProjectCategoryResultDTO> result = screenProjectCategoryOrgDailyDao.selectCategoryByCustomerId(tokenDto.getCustomerId());
List<ProjectCategoryResultDTO> endCategoryList = new ArrayList<>();
if (formDTO.getOrgType().equals(FactConstant.GRID)){
Integer endTotal = screenProjectOrgDailyDao.selectProjectTotalByGrid(customerId, endTime, orgId);
endTotal = null == endTotal ? NumConstant.ZERO : endTotal;
endCategoryList = screenProjectCategoryOrgDailyDao.selectProjectCategoryByGrid(customerId,endTime,orgId);
Integer total = endTotal;
if (StringUtils.isNotBlank(startTime)){
Integer startTotal = screenProjectOrgDailyDao.selectProjectTotalByGrid(customerId, startTime, orgId);
startTotal = null == startTotal ? NumConstant.ZERO : startTotal;
total = endTotal - startTotal;
List<ProjectCategoryResultDTO> startCategoryList = screenProjectCategoryOrgDailyDao.selectProjectCategoryByGrid(customerId,startTime,orgId);
endCategoryList.forEach(e -> startCategoryList.stream().filter(s -> e.getCategoryCode().equals(s.getCategoryCode())).forEach(s -> e.setProjectTotal(subtract(e.getProjectTotal(),s.getProjectTotal()))));
endCategoryList.forEach(e -> startCategoryList.stream().filter(s -> e.getCategoryCode().equals(s.getCategoryCode())).forEach(s -> e.setClosedProjectTotal(subtract(e.getClosedProjectTotal(),s.getClosedProjectTotal()))));
}
Integer finalTotal = total;
endCategoryList.forEach(e -> {
e.setTotalRatio(ratio(e.getProjectTotal(), finalTotal));
e.setClosedRatio(ratio(e.getClosedProjectTotal(),e.getProjectTotal()));
});
}else {
Integer endTotal = screenProjectOrgDailyDao.selectProjectTotalByAgency(customerId, endTime, orgId);
endTotal = null == endTotal ? NumConstant.ZERO : endTotal;
endCategoryList = screenProjectCategoryOrgDailyDao.selectProjectCategoryByAgency(customerId,endTime,orgId);
Integer total = endTotal;
if (StringUtils.isNotBlank(startTime)){
Integer startTotal = screenProjectOrgDailyDao.selectProjectTotalByAgency(customerId, startTime, orgId);
startTotal = null == startTotal ? NumConstant.ZERO : startTotal;
total = endTotal - startTotal;
List<ProjectCategoryResultDTO> startCategoryList = screenProjectCategoryOrgDailyDao.selectProjectCategoryByAgency(customerId,startTime,orgId);
endCategoryList.forEach(e -> startCategoryList.stream().filter(s -> e.getCategoryCode().equals(s.getCategoryCode())).forEach(s -> e.setProjectTotal(subtract(e.getProjectTotal(),s.getProjectTotal()))));
endCategoryList.forEach(e -> startCategoryList.stream().filter(s -> e.getCategoryCode().equals(s.getCategoryCode())).forEach(s -> e.setClosedProjectTotal(subtract(e.getClosedProjectTotal(),s.getClosedProjectTotal()))));
}
Integer finalTotal = total;
endCategoryList.forEach(e -> {
e.setTotalRatio(ratio(e.getProjectTotal(), finalTotal));
e.setClosedRatio(ratio(e.getClosedProjectTotal(),e.getProjectTotal()));
});
}
List<ProjectCategoryResultDTO> finalEndCategoryList = endCategoryList;
result.forEach(r -> {
finalEndCategoryList.stream().filter(e -> r.getCategoryCode().equals(e.getCategoryCode())).forEach(e -> {
r.setTotalRatio(e.getTotalRatio());r.setClosedRatio(e.getClosedRatio());
});
r.getChildren().forEach(son -> finalEndCategoryList.stream().filter(e -> son.getCategoryCode().equals(e.getCategoryCode())).forEach(e -> {
son.setTotalRatio(e.getTotalRatio());son.setClosedRatio(e.getClosedRatio());
}));
});
// 排序
List<ProjectCategoryResultDTO> collect = result.stream().sorted(Comparator.comparing(ProjectCategoryResultDTO::getProjectTotal).reversed()).collect(Collectors.toList());
collect.forEach(c -> {
c.setChildren(c.getChildren().stream().sorted(Comparator.comparing(ProjectCategoryResultDTO::getProjectTotal).reversed()).collect(Collectors.toList()));
});
return collect;
}
/**
* @Description 俩数相减小于0就赋值为0
* @param end
* @param start
* @author zxc
* @date 2021/11/5 9:18 上午
*/
public Integer subtract(Integer end,Integer start){
return end - start < NumConstant.ZERO ? NumConstant.ZERO : end - start;
}
/**
* @Description 返回占比,保留小数点2位
* @param molecule 分子
* @param denominator 分母
* @author zxc
* @date 2021/11/5 9:26 上午
*/
public String ratio(Integer molecule, Integer denominator){
if (denominator == NumConstant.ZERO){
return "0.00%";
}
BigDecimal bigDecimalMolecule = new BigDecimal(molecule);
BigDecimal bigDecimalDenominator = new BigDecimal(denominator);
BigDecimal divide = bigDecimalMolecule.divide(bigDecimalDenominator, NumConstant.TWO, BigDecimal.ROUND_HALF_UP);
return divide.multiply(NumConstant.ONE_HUNDRED_DECIMAL)+"%";
}
/**
* @Description 项目分类查询分类下的项目
* @param formDTO
* @param tokenDto
* @author zxc
* @date 2021/11/4 3:39 下午
*/
@Override
public PageCategoryProjectListResultDTO selectCategoryProjectList(CategoryProjectListFormDTO formDTO, TokenDto tokenDto) {
if (StringUtils.isBlank(formDTO.getOrgId())){
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId());
if (null == staffInfo){
throw new RenException("未查询到此工作人员的所属组织信息...");
}
formDTO.setOrgId(staffInfo.getAgencyId());
formDTO.setOrgType(FactConstant.AGENCY);
}
PageCategoryProjectListResultDTO result = new PageCategoryProjectListResultDTO();
List<CategoryProjectListResultDTO> list;
if (formDTO.getIsPage()){
PageInfo<CategoryProjectListResultDTO> objectPageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> screenProjectDataDao.selectCategoryProjectList(tokenDto.getCustomerId(), formDTO.getOrgId(), formDTO.getCategoryCode(), formDTO.getStatus()));
list = objectPageInfo.getList();
result.setTotal(Integer.valueOf(String.valueOf(objectPageInfo.getTotal())));
}else {
list = screenProjectDataDao.selectCategoryProjectList(tokenDto.getCustomerId(), formDTO.getOrgId(), formDTO.getCategoryCode(), formDTO.getStatus());
}
if (!CollectionUtils.isEmpty(list)){
list.forEach(l -> {
if (l.getOrgType().equals(FactConstant.AGENCY)){
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(l.getOrgId());
l.setGridName(agencyInfo.getOrganizationName());
}else {
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(l.getOrgId());
l.setGridName(gridInfo.getGridNamePath());
}
});
}
result.setList(list);
return result;
}
}

BIN
epmet-module/data-report/data-report-server/src/main/resources/excel/project_category_temp.xlsx

Binary file not shown.

49
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectCategoryOrgDailyDao.xml

@ -63,4 +63,53 @@
AND DATE_ID = (select date_id from screen_project_category_org_daily where del_flag = '0' and ORG_ID = #{agencyId} and CUSTOMER_ID= #{customerId} order by date_id desc, created_time desc limit 1)
ORDER BY PROJECT_TOTAL DESC LIMIT #{topCount}
</select>
<!-- 组织查询分类 -->
<select id="selectProjectCategoryByAgency" resultType="com.epmet.project.dto.result.ProjectCategoryResultDTO">
SELECT
co.CATEGORY_CODE,
co.PROJECT_TOTAL,
co.CLOSED_PROJECT_TOTAL
FROM screen_project_category_org_daily co
WHERE co.DEL_FLAG = '0'
AND co.ORG_ID = #{orgId}
AND co.CUSTOMER_ID = #{customerId}
AND co.DATE_ID = #{time}
</select>
<!-- 网格查询分类 -->
<select id="selectProjectCategoryByGrid" resultType="com.epmet.project.dto.result.ProjectCategoryResultDTO">
SELECT
co.CATEGORY_CODE,
co.PROJECT_TOTAL,
co.CLOSED_PROJECT_TOTAL
FROM screen_project_category_grid_daily co
WHERE co.DEL_FLAG = '0'
AND co.GRID_ID = #{orgId}
AND co.CUSTOMER_ID = #{customerId}
AND co.DATE_ID = #{time}
</select>
<!-- 查询客户下所有分类 -->
<resultMap id="selectCategoryByCustomerIdMap" type="com.epmet.project.dto.result.ProjectCategoryResultDTO">
<result column="c" property="categoryCode"/>
<result column="n" property="categoryName"/>
<collection property="children" ofType="com.epmet.project.dto.result.ProjectCategoryResultDTO">
<result column="c2" property="categoryCode"/>
<result column="n2" property="categoryName"/>
</collection>
</resultMap>
<select id="selectCategoryByCustomerId" resultMap="selectCategoryByCustomerIdMap">
SELECT
p1.CATEGORY_CODE AS c,
p2.CATEGORY_CODE AS c2,
p1.CATEGORY_NAME AS n,
p2.CATEGORY_NAME AS n2
FROM customer_project_category_dict p1,customer_project_category_dict p2
WHERE p1.DEL_FLAG = '0'
AND p2.DEL_FLAG = '0'
AND p1.CUSTOMER_ID = #{customerId}
AND p2.CUSTOMER_ID = #{customerId}
AND p1.CATEGORY_CODE = p2.PARENT_CATEGORY_CODE
</select>
</mapper>

21
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml

@ -158,4 +158,25 @@
AND UNIX_TIMESTAMP(pd.CREATED_TIME) >= UNIX_TIMESTAMP(DATE_SUB(NOW(),INTERVAL #{monthCount} MONTH))
)
</select>
<!-- 查询分类下的项目列表 -->
<select id="selectCategoryProjectList" resultType="com.epmet.project.dto.result.CategoryProjectListResultDTO">
SELECT
ALL_CATEGORY_NAME AS category,
CASE WHEN PROJECT_STATUS_CODE = 'closed_case' THEN 'closed' ELSE PROJECT_STATUS_CODE END AS projectStatus,
IFNULL(PROJECT_TITLE,'') AS projectTitle,
DATE_FORMAT(PROJECT_CREATE_TIME,'%Y-%m-%d %h:%i:%s') AS createTime,
ORG_ID,
ORG_TYPE,
PROJECT_ID
FROM screen_project_data
WHERE DEL_FLAG = '0'
<if test=' status == "closed" '>
AND PROJECT_STATUS_CODE IN ('closed_case','closed')
</if>
AND CONCAT(ALL_PARENT_IDS,':',ORG_ID) LIKE CONCAT('%',#{orgId},'%')
AND CATEGORY_CODE LIKE CONCAT('%',#{categoryCode},'%')
AND CUSTOMER_ID = #{customerId}
ORDER BY PROJECT_CREATE_TIME DESC
</select>
</mapper>

26
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectOrgDailyDao.xml

@ -54,4 +54,30 @@
)and m.CUSTOMER_ID=#{customerId}
order by resolvedRatio+0 desc
</select>
<!-- 查询项目总数组织 -->
<select id="selectProjectTotalByAgency" resultType="java.lang.Integer">
SELECT
PROJECT_TOTAL
FROM
screen_project_org_daily
WHERE
del_flag = '0'
AND ORG_ID = #{orgId}
AND DATE_ID = #{time}
AND CUSTOMER_ID = #{customerId}
</select>
<!-- 查询项目总数网格 -->
<select id="selectProjectTotalByGrid" resultType="java.lang.Integer">
SELECT
PROJECT_TOTAL
FROM
screen_project_grid_daily
WHERE
del_flag = '0'
AND grid_id = #{orgId}
AND DATE_ID = #{time}
AND CUSTOMER_ID = #{customerId}
</select>
</mapper>

5
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyResultDTO.java

@ -41,9 +41,12 @@ public class AgencyResultDTO implements Serializable {
* 机关组织名称
*/
private String agencyName = "";
private String pid;
private String level;
/**
* 所有上级组织机构ID(以英文:隔开)
*/
@JsonIgnore
private String pids = "";
}
}

2
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyTreeResultDTO.java

@ -24,6 +24,8 @@ public class AgencyTreeResultDTO implements Serializable {
private String agencyName;
private String pid;
private String level;
/**
* 下级机关组织
*/

24
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/BuildingResultDTO.java

@ -0,0 +1,24 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Description
* @Author zhaoqifeng
* @Date 2021/10/25 15:03
*/
@Data
public class BuildingResultDTO implements Serializable {
private static final long serialVersionUID = -2129418426919785999L;
private String buildingId;
private String gridName;
private String neighborhoodName;
private String buildingName;
}

30
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseListResultDTO.java

@ -0,0 +1,30 @@
package com.epmet.dto.result;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* @Description
* @Author zhaoqifeng
* @Date 2021/11/5 15:59
*/
@NoArgsConstructor
@Data
public class HouseListResultDTO implements Serializable {
private static final long serialVersionUID = 2063032844842070847L;
private String houseId;
private String houseName;
private List<CategoryListBean> categoryList;
@NoArgsConstructor
@Data
public static class CategoryListBean {
private String name;
private String iconUrl;
private String isSpecial;
}
}

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

@ -519,4 +519,7 @@ public interface GovOrgOpenFeignClient {
@GetMapping("/gov/org/ichouse/{id}")
Result<IcHouseDTO> get(@PathVariable("id") String id);
@PostMapping("/gov/org/building/buildinglistbyids")
Result<List<BuildingResultDTO>> buildingListByIds(@RequestBody List<String> buildingIdList);
}

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

@ -315,6 +315,11 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "get", id);
}
@Override
public Result<List<BuildingResultDTO>> buildingListByIds(List<String> buildingIdList) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "buildingListByIds", buildingIdList);
}
@Override
public Result<String> selectPidsByGridId(String gridId) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "selectPidsByGridId", gridId);

6
epmet-module/gov-org/gov-org-server/pom.xml

@ -113,6 +113,12 @@
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>oper-customize-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

14
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/BuildingController.java

@ -37,6 +37,7 @@ import com.epmet.dto.form.IcBulidingFormDTO;
import com.epmet.dto.form.IcBulidingUnitFormDTO;
import com.epmet.dto.form.IcNeighborHoodFormDTO;
import com.epmet.dto.form.ListIcNeighborHoodFormDTO;
import com.epmet.dto.result.BuildingResultDTO;
import com.epmet.dto.result.IcNeighborHoodResultDTO;
import com.epmet.entity.IcBuildingUnitEntity;
import com.epmet.excel.IcBuildingExcel;
@ -206,7 +207,7 @@ public class BuildingController {
* @return
* @throws IOException
*/
@PostMapping("buildingunitlist")
public Result buildingunitlist(@LoginUser TokenDto tokenDTO,@RequestBody IcBulidingUnitFormDTO icBulidingUnitFormDTO ){
ValidatorUtils.validateEntity(icBulidingUnitFormDTO);
List<IcBuildingUnitEntity> icBuildingUnitEntityList = icBuildingUnitDao.selectList(new QueryWrapper<IcBuildingUnitEntity>().lambda().eq(IcBuildingUnitEntity::getBuildingId, icBulidingUnitFormDTO.getBuildingId()).orderByAsc(IcBuildingUnitEntity::getUnitNum));
@ -221,4 +222,15 @@ public class BuildingController {
return new Result().ok(result);
}
@PostMapping("buildinglistbyids")
public Result<List<BuildingResultDTO>> buildingListByIds(@RequestBody List<String> buildingIdList){
if(CollectionUtils.isEmpty(buildingIdList)){
return new Result();
}
List<BuildingResultDTO> result = buildingService.buildingListByIds(buildingIdList);
return new Result<List<BuildingResultDTO>>().ok(result);
}
}

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

@ -325,7 +325,7 @@ public class CustomerAgencyController {
}
/**
* @Description 获取客户下组织树
* @Description 获取客户下组织树不含网格和部门
* @Param tokenDTO
* @Return {@link Result< AgencyTreeResultDTO >}
* @Author zhaoqifeng
@ -357,4 +357,16 @@ public class CustomerAgencyController {
return new Result<List<StaffOrgsResultDTO>>().ok(orgList);
}
}
/**
* @Description 获取当前登陆人的 所属组织及下级组织/网格含直属网格
* @Param tokenDTO
* @Return {@link Result< AgencyTreeResultDTO >}
* @Author zhaoqifeng
* @Date 2021/9/8 15:20
*/
@PostMapping("agencygridtree")
public Result<AgencyTreeResultDTO> getOrgTreeData(@LoginUser TokenDto tokenDTO) {
return new Result<AgencyTreeResultDTO>().ok(customerAgencyService.getOrgTreeData(tokenDTO.getUserId()));
}
}

15
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcHouseController.java

@ -17,8 +17,10 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
@ -27,6 +29,7 @@ import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.IcHouseDTO;
import com.epmet.dto.form.HouseFormDTO;
import com.epmet.dto.result.HouseListResultDTO;
import com.epmet.service.IcHouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -99,4 +102,16 @@ public class IcHouseController {
return new Result<List<String>>().ok(icHouseService.selectHouseInfoByIdCard(idCard));
}
/**
* @Description 房屋查询
* @Param formDTO
* @Return {@link Result< List< HouseListResultDTO>>}
* @Author zhaoqifeng
* @Date 2021/11/5 16:01
*/
@PostMapping("houselist")
public Result<List<HouseListResultDTO>> getHouseList(@LoginUser TokenDto tokenDto, @RequestBody HouseFormDTO formDTO){
return new Result<List<HouseListResultDTO>>().ok(icHouseService.getHouseList(tokenDto, formDTO));
}
}

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

@ -273,4 +273,12 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
* @date 2021/10/25 2:30 下午
*/
List<MapSonOrgResultDTO> selectSonOrg(@Param("pid")String pid,@Param("type")String type);
}
/**
* desc获取组织网格树 含直属网格
* @param agencyId
* @return
*/
AgencyTreeResultDTO getAgencyGridTree(String agencyId);
}

3
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingDao.java

@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.result.BaseInfoFamilyBuildingResultDTO;
import com.epmet.dto.result.BuildingResultDTO;
import com.epmet.entity.CustomerAgencyEntity;
import com.epmet.entity.IcBuildingEntity;
import com.epmet.entity.IcHouseEntity;
@ -69,4 +70,6 @@ public interface IcBuildingDao extends BaseDao<IcBuildingEntity> {
* @date 2021/11/2 9:25 上午
*/
List<BaseInfoFamilyBuildingResultDTO> baseInfoFamilyBuilding(@Param("neighborHoodId")String neighborHoodId);
List<BuildingResultDTO> buildingListByIds(@Param("buildingIdList") List<String> buildingIdList);
}

3
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/BuildingService.java

@ -20,6 +20,7 @@ package com.epmet.service;
import com.epmet.dto.BuildingTreeLevelDTO;
import com.epmet.dto.form.IcBulidingFormDTO;
import com.epmet.dto.form.ListIcNeighborHoodFormDTO;
import com.epmet.dto.result.BuildingResultDTO;
import com.epmet.dto.result.IcNeighborHoodResultDTO;
import com.epmet.excel.IcBuildingExcel;
import com.epmet.excel.IcNeighborHoodExcel;
@ -57,4 +58,6 @@ public interface BuildingService {
IcNeighborHoodResultDTO listBuilding(ListIcNeighborHoodFormDTO formDTO);
void exportBuildinginfo(ListIcNeighborHoodFormDTO formDTO, HttpServletResponse response) throws Exception ;
List<BuildingResultDTO> buildingListByIds(List<String> buildingIdList);
}

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

@ -19,7 +19,6 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.form.*;
@ -257,4 +256,13 @@ public interface CustomerAgencyService extends BaseService<CustomerAgencyEntity>
AgencyTreeResultDTO getAgencyList(GetAgencyListFormDTO formDTO);
List<StaffOrgsResultDTO> getStaffOrgListByStaffId(String staffId);
}
/**
* desc:获取用户所属组织的组织及网格树
* @param staffId
* @return
*/
AgencyTreeResultDTO getOrgTreeData(String staffId);
List<StaffOrgsResultDTO> getStaffOrgListByStaffId(String staffId);
}

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

@ -20,8 +20,10 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dto.IcHouseDTO;
import com.epmet.dto.form.HouseFormDTO;
import com.epmet.dto.result.HouseListResultDTO;
import com.epmet.entity.IcHouseEntity;
import java.util.List;
@ -112,4 +114,14 @@ public interface IcHouseService extends BaseService<IcHouseEntity> {
*/
List<String> selectHouseInfoByIdCard(String idCard);
/**
* @Description 楼栋下房屋列表
* @Param tokenDto
* @Param formDTO
* @Return {@link List< HouseListResultDTO>}
* @Author zhaoqifeng
* @Date 2021/11/5 16:01
*/
List<HouseListResultDTO> getHouseList(TokenDto tokenDto, HouseFormDTO formDTO);
}

7
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java

@ -13,6 +13,7 @@ import com.epmet.dto.CustomerStaffAgencyDTO;
import com.epmet.dto.IcBuildingDTO;
import com.epmet.dto.form.IcBulidingFormDTO;
import com.epmet.dto.form.ListIcNeighborHoodFormDTO;
import com.epmet.dto.result.BuildingResultDTO;
import com.epmet.dto.result.IcNeighborHoodResultDTO;
import com.epmet.entity.*;
import com.epmet.enums.BuildingTypeEnums;
@ -278,6 +279,12 @@ public class BuildingServiceImpl implements BuildingService {
ExcelPoiUtils.exportExcel(templatePath ,map,"楼宇信息录入表",response);
return ;
}
@Override
public List<BuildingResultDTO> buildingListByIds(List<String> buildingIdList) {
return icBuildingDao.buildingListByIds(buildingIdList);
}
private List<IcBuildingExcel> searchAllBuilding(ListIcNeighborHoodFormDTO formDTO) {
// QueryWrapper<IcNeighborHoodEntity> neighborHoodEntityQueryWrapper = new QueryWrapper<>();

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

@ -16,7 +16,6 @@
*/
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
@ -1107,6 +1106,63 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
return agency;
}
@Override
public AgencyTreeResultDTO getOrgTreeData(String staffId) {
AgencyTreeResultDTO result = new AgencyTreeResultDTO();
//1.查询工作人员所属组织信息
AgencyResultDTO rootAgency = baseDao.selectAgencyByStaffId(staffId);
if (null == rootAgency) {
logger.error(String.format("查询工作人员所属组织信息失败,staffId->%s", staffId));
throw new RenException(CustomerAgencyConstant.SELECT_STAFF_AGENCY_EXCEPTION);
}
result.setPid(rootAgency.getPid());
result.setAgencyName(rootAgency.getAgencyName());
result.setAgencyId(rootAgency.getAgencyId());
result.setLevel(rootAgency.getLevel());
ExtStaffPermissionResultDTO res = baseDao.selectAgencyById(rootAgency.getAgencyId());
convert2AgencyTreeResult(result,res.getSubAgencyList(),res.getGridList());
return result;
}
/**
* 递归查询子节点
* @param root 根节点
* @param all 所有节点
* @return 根节点信息
*/
private void convert2AgencyTreeResult(AgencyTreeResultDTO root, List<ExtStaffPermissionResultDTO> agencyList, List<ExtGridResultDTO> gridList) {
try {
for (ExtStaffPermissionResultDTO agency : agencyList) {
AgencyTreeResultDTO resultDTO = new AgencyTreeResultDTO();
resultDTO.setAgencyId(agency.getAgencyId());
resultDTO.setAgencyName(agency.getAgencyName());
resultDTO.setPid(root.getAgencyId());
resultDTO.setLevel(agency.getLevel());
if (root.getSubAgencyList() == null) {
root.setSubAgencyList(new ArrayList<>());
}
root.getSubAgencyList().add(resultDTO);
if (CollectionUtils.isNotEmpty(agency.getSubAgencyList()) || CollectionUtils.isNotEmpty(agency.getGridList())) {
convert2AgencyTreeResult(resultDTO, agency.getSubAgencyList(), agency.getGridList());
}
}
for (ExtGridResultDTO o : gridList) {
AgencyTreeResultDTO grid = new AgencyTreeResultDTO();
grid.setAgencyId(o.getGridId());
grid.setAgencyName(o.getGridName());
grid.setPid(root.getAgencyId());
grid.setLevel("grid");
grid.setSubAgencyList(null);
if (root.getSubAgencyList() == null) {
root.setSubAgencyList(new ArrayList<>());
}
root.getSubAgencyList().add(grid);
}
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* @Description 组织树最后一级没有数据的话设null
* @Param agencyList

77
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java

@ -22,13 +22,22 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.IcHouseDao;
import com.epmet.dto.IcHouseDTO;
import com.epmet.dto.IcResiCategoryStatsConfigDTO;
import com.epmet.dto.IcResiUserDTO;
import com.epmet.dto.form.HouseFormDTO;
import com.epmet.dto.result.HouseListResultDTO;
import com.epmet.entity.IcHouseEntity;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.OperCustomizeOpenFeignClient;
import com.epmet.service.IcHouseService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
@ -36,6 +45,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
@ -48,6 +58,10 @@ import java.util.stream.Collectors;
@Slf4j
@Service
public class IcHouseServiceImpl extends BaseServiceImpl<IcHouseDao, IcHouseEntity> implements IcHouseService {
@Resource
private OperCustomizeOpenFeignClient operCustomizeOpenFeignClient;
@Resource
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Override
@ -147,4 +161,67 @@ public class IcHouseServiceImpl extends BaseServiceImpl<IcHouseDao, IcHouseEntit
return result;
}
/**
* @param formDTO
* @Description 楼栋下房屋列表
* @Param tokenDto
* @Param formDTO
* @Return {@link List< HouseListResultDTO >}
* @Author zhaoqifeng
* @Date 2021/11/5 16:01
*/
@Override
public List<HouseListResultDTO> getHouseList(TokenDto tokenDto, HouseFormDTO formDTO) {
//查询楼栋下房屋列表
LambdaQueryWrapper<IcHouseEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcHouseEntity::getBuildingId, formDTO.getBuildingId());
wrapper.last("ORDER BY CONVERT ( HOUSE_NAME USING gbk ) ASC");
List<IcHouseEntity> list = baseDao.selectList(wrapper);
if(CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
}
//获取居民分类列表
IcResiCategoryStatsConfigDTO categoryDto = new IcResiCategoryStatsConfigDTO();
categoryDto.setCustomerId(tokenDto.getCustomerId());
Result<List<IcResiCategoryStatsConfigDTO>> categoryResult = operCustomizeOpenFeignClient.getCategoryList(categoryDto);
if (!categoryResult.success()) {
throw new RenException(categoryResult.getCode(), categoryResult.getMsg());
}
List<IcResiCategoryStatsConfigDTO> categoryList = categoryResult.getData();
//获取居民分类数量统计
IcResiUserDTO userDTO = new IcResiUserDTO();
userDTO.setBuildId(formDTO.getBuildingId());
Result<Map<String, Map<String, Integer>>> resultMap = epmetUserOpenFeignClient.getHomeUserCategoryCount(userDTO);
if (!resultMap.success()) {
throw new RenException(resultMap.getCode(), resultMap.getMsg());
}
Map<String, Map<String, Integer>> map = resultMap.getData();
return list.stream().map(item -> {
Map<String, Integer> countMap = map.get(item.getId());
HouseListResultDTO dto = new HouseListResultDTO();
dto.setHouseId(item.getId());
dto.setHouseName(item.getHouseName());
List<HouseListResultDTO.CategoryListBean> categories = new ArrayList<>();
if (null != countMap && CollectionUtils.isNotEmpty(categoryList)) {
for (IcResiCategoryStatsConfigDTO category : categoryList) {
if (null == countMap.get(category.getColumnName()) || countMap.get(category.getColumnName()) == NumConstant.ZERO) {
continue;
}
HouseListResultDTO.CategoryListBean bean = new HouseListResultDTO.CategoryListBean();
bean.setName(category.getLabel());
bean.setIconUrl(category.getHouseShowIcon());
if ("党员".equals(category.getLabel())) {
bean.setIsSpecial(NumConstant.ONE_STR);
} else {
bean.setIsSpecial(NumConstant.ZERO_STR);
}
categories.add(bean);
}
}
dto.setCategoryList(categories);
return dto;
}).collect(Collectors.toList());
}
}

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

@ -342,7 +342,9 @@
SELECT
ca.id AS "agencyId",
ca.organization_name AS "agencyName",
ca.pids AS "pids"
ca.pids AS "pids",
ca.PID AS pid,
ca.LEVEL
FROM
customer_agency ca
INNER JOIN customer_staff_agency csa ON ca.id = csa.agency_id
@ -545,6 +547,7 @@
<result column="agencyId" property="agencyId"/>
<result column="agencyName" property="agencyName"/>
<result column="pid" property="pid"/>
<result column="level" property="level"/>
</resultMap>
<resultMap id="NodeTreeResult" type="com.epmet.dto.result.AgencyTreeResultDTO"
extends="BaseResultMap">
@ -557,7 +560,8 @@
select
ID AS agencyId,
ORGANIZATION_NAME AS agencyName,
PID
PID,
LEVEL
from customer_agency
where
DEL_FLAG = 0
@ -568,7 +572,8 @@
select
ID AS agencyId,
ORGANIZATION_NAME AS agencyName,
PID
PID,
LEVEL
from
customer_agency
where
@ -633,4 +638,4 @@
order by created_time desc
</select>
</mapper>
</mapper>

20
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml

@ -300,5 +300,25 @@
AND b.NEIGHBOR_HOOD_ID = #{neighborHoodId}
</select>
<select id="buildingListByIds" resultType="com.epmet.dto.result.BuildingResultDTO">
select
a.ID as buildingId,
a.BUILDING_NAME as buildingName,
b.NEIGHBOR_HOOD_NAME as neighborHoodName,
d.GRID_NAME as gridName
from ic_building a
LEFT JOIN ic_neighbor_hood b on a.NEIGHBOR_HOOD_ID = b.ID and b.DEL_FLAG='0'
LEFT JOIN customer_grid d on b.GRID_ID = d.ID and d.DEL_FLAG='0'
where 1=1 and a.DEL_FLAG ='0'
and a.ID in
<foreach collection="buildingIdList" open="(" separator="," close=")" item="val">
#{val}
</foreach>
</select>
</mapper>

4
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/BaseGridInfoController.java

@ -44,7 +44,7 @@ public class BaseGridInfoController {
/**
* @Author sun
* @Description 组织基础信息中库同步
* @Description 组织基础信息中库同步
**/
@PostMapping("agencybaseinfo")
public Result getAgencyBaseInfo(@RequestBody(required = false) GridBaseInfoFormDTO formDTO) {
@ -55,7 +55,7 @@ public class BaseGridInfoController {
/**
* @Author sun
* @Description 网格基础信息中库同步
* @Description 网格基础信息中库同步
**/
@PostMapping("gridbaseinfo")
public Result getGridBaseInfo(@RequestBody(required = false) GridBaseInfoFormDTO formDTO) {

3
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridInfoServiceImpl.java

@ -144,7 +144,8 @@ public class BaseGridInfoServiceImpl extends BaseServiceImpl<BaseGridInfoDao, Ba
ExList.add(entity);
});
if (null != formDTO.getType() && "all".equals(formDTO.getType())) {
exDeptDao.updateBatchGrid(ExList);
exDeptDao.updateBatch(ExList);
//exDeptDao.updateBatchGrid(ExList);
} else {
exDeptDao.insertBatch(ExList);
}

9
epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/ExDeptDao.xml

@ -21,7 +21,8 @@
<trim prefix="dept_id_qx =(case" suffix="end),">
<foreach collection="list" item="item">
<if test='null != item.deptIdQx'>
when grid_code = #{item.gridCode} then #{item.deptIdQx}
<!-- when grid_code = #{item.gridCode} then #{item.deptIdQx} -->
when dept_name_qx = #{item.deptNameQx} then #{item.deptIdQx}
</if>
</foreach>
</trim>
@ -29,7 +30,8 @@
<trim prefix="dept_name_qx =(case" suffix="end),">
<foreach collection="list" item="item">
<if test='null != item.deptNameQx'>
when grid_code = #{item.gridCode} then #{item.deptNameQx}
when dept_name_qx = #{item.deptNameQx} then #{item.deptIdQx}
<!-- when grid_code = #{item.gridCode} then #{item.deptNameQx} -->
</if>
</foreach>
</trim>
@ -38,7 +40,8 @@
WHERE
1=1
<foreach collection="list" item="item" open="AND( " separator=" OR " index="index" close=")">
grid_code = #{item.gridCode}
<!-- grid_code = #{item.gridCode} -->
dept_name_qx = #{item.deptNameQx}
</foreach>
</update>

3
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/IcResiCategoryStatsConfigSortFormDTO.java

@ -21,6 +21,7 @@ import com.epmet.commons.tools.validator.group.UpdateGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@ -44,7 +45,7 @@ public class IcResiCategoryStatsConfigSortFormDTO implements Serializable {
/**
* 排序
*/
@NotBlank(message = "排序不能为空")
@NotNull(message = "排序不能为空")
private Integer sort;

26
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java

@ -3,6 +3,8 @@ package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerFootBarDTO;
import com.epmet.dto.IcResiCategoryStatsConfigDTO;
import com.epmet.dto.IcResiCategoryWarnConfigDTO;
import com.epmet.dto.form.CheckFloatFootBarFormDTO;
import com.epmet.dto.form.CustomerFootBarFormDTO;
import com.epmet.dto.form.CustomerFormQueryDTO;
@ -14,6 +16,7 @@ import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Set;
@ -97,4 +100,27 @@ public interface OperCustomizeOpenFeignClient {
@PostMapping("/oper/customize/icformitem/getmustcolumn/{customerId}")
Result<List<ColumnTableNameResultDTO>> getMustColumn(@PathVariable("customerId") String customerId);
@PostMapping("/oper/customize/icresicategorystatsconfig/categorylist")
Result<List<IcResiCategoryStatsConfigDTO>> getCategoryList(@RequestBody IcResiCategoryStatsConfigDTO dto);
@PostMapping("/oper/customize/resicategorystatsconfig/resicategorystatslistshowd")
Result<List<IcResiCategoryStatsConfigDTO>> resiCategoryStatsListShowd();
@PostMapping("/oper/customize/resicategorystatsconfig/resicategorywarnlist")
Result<List<IcResiCategoryWarnConfigDTO>> resiCategoryWarnList();
@PostMapping("/oper/customize/resicategorystatsconfig/resicategorywarninfobyid")
Result<IcResiCategoryWarnConfigDTO> resiCategoryWarnInfoById(@RequestBody IcResiCategoryWarnConfigDTO dto);
/**
* @Description 查询志愿者类型
* @param volunteers
* @author zxc
* @date 2021/11/8 10:02 上午
*/
@PostMapping("/oper/customize/icformitemoptions/volunteerlabelbyvalues")
Result<List<String>> volunteerLabelByValues(@RequestBody List<String> volunteers,@RequestParam("customerId") String customerId);
}

27
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java

@ -4,6 +4,8 @@ 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.CustomerFootBarDTO;
import com.epmet.dto.IcResiCategoryStatsConfigDTO;
import com.epmet.dto.IcResiCategoryWarnConfigDTO;
import com.epmet.dto.form.CheckFloatFootBarFormDTO;
import com.epmet.dto.form.CustomerFootBarFormDTO;
import com.epmet.dto.form.CustomerFormQueryDTO;
@ -79,4 +81,29 @@ public class OperCustomizeOpenFeignClientFallback implements OperCustomizeOpenFe
public Result<List<ColumnTableNameResultDTO>> getMustColumn(String customerId) {
return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "getMustColumn", customerId);
}
@Override
public Result<List<IcResiCategoryStatsConfigDTO>> getCategoryList(IcResiCategoryStatsConfigDTO dto) {
return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "getCategoryList", dto);
}
@Override
public Result<List<IcResiCategoryStatsConfigDTO>> resiCategoryStatsListShowd() {
return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "resiCategoryStatsListShowd");
}
@Override
public Result<List<IcResiCategoryWarnConfigDTO>> resiCategoryWarnList() {
return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "resiCategoryWarnList");
}
@Override
public Result<IcResiCategoryWarnConfigDTO> resiCategoryWarnInfoById(IcResiCategoryWarnConfigDTO dto) {
return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "resiCategoryWarnInfoById",dto);
}
@Override
public Result<List<String>> volunteerLabelByValues(List<String> volunteers,String customerId) {
return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "volunteerLabelByValues",volunteers,customerId);
}
}

11
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormItemOptionsController.java

@ -91,4 +91,15 @@ public class IcFormItemOptionsController {
ExcelUtils.exportExcelToTarget(response, null, list, IcFormItemOptionsExcel.class);
}
/**
* @Description 查询志愿者类型
* @param volunteers
* @author zxc
* @date 2021/11/8 10:02 上午
*/
@PostMapping("volunteerlabelbyvalues")
public Result<List<String>> volunteerLabelByValues(@RequestBody List<String> volunteers,@RequestParam("customerId") String customerId){
return new Result<List<String>>().ok(icFormItemOptionsService.volunteerLabelByValues(volunteers,customerId));
}
}

5
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcResiCategoryStatsConfigController.java

@ -91,4 +91,9 @@ public class IcResiCategoryStatsConfigController {
ExcelUtils.exportExcelToTarget(response, null, list, IcResiCategoryStatsConfigExcel.class);
}
@PostMapping("categorylist")
public Result<List<IcResiCategoryStatsConfigDTO>> getCategoryList(@RequestBody IcResiCategoryStatsConfigDTO dto) {
return new Result<List<IcResiCategoryStatsConfigDTO>>().ok(icResiCategoryStatsConfigService.getCategoryList(dto));
}
}

43
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/ResiCategoryStatsConfigController.java

@ -17,9 +17,11 @@
package com.epmet.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
@ -27,17 +29,25 @@ 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.commons.tools.validator.group.UpdateGroup;
import com.epmet.dao.IcResiCategoryStatsConfigDao;
import com.epmet.dao.IcResiCategoryWarnConfigDao;
import com.epmet.dto.IcResiCategoryStatsConfigDTO;
import com.epmet.dto.IcResiCategoryWarnConfigDTO;
import com.epmet.dto.form.IcResiCategoryStatsConfigFormDTO;
import com.epmet.dto.form.IcResiCategoryStatsConfigSortFormDTO;
import com.epmet.dto.form.UpGovRoleFormDTO;
import com.epmet.dto.result.IcResiCategoryStatsConfigResultDTO;
import com.epmet.entity.IcResiCategoryStatsConfigEntity;
import com.epmet.entity.IcResiCategoryWarnConfigEntity;
import com.epmet.excel.IcResiCategoryStatsConfigExcel;
import com.epmet.service.IcResiCategoryStatsConfigService;
import com.epmet.service.ResiCategoryStatsConfigService;
import com.github.pagehelper.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
@ -58,6 +68,10 @@ public class ResiCategoryStatsConfigController {
@Autowired
private ResiCategoryStatsConfigService resiCategoryStatsConfigService;
@Resource
private IcResiCategoryWarnConfigDao icResiCategoryWarnConfigDao;
@Resource
private IcResiCategoryStatsConfigDao icResiCategoryStatsConfigDao;
/**
* 居民类别配置列表
@ -103,5 +117,34 @@ public class ResiCategoryStatsConfigController {
return new Result<IcResiCategoryStatsConfigResultDTO>().ok(resiCategoryStatsConfigService.info(formDTO.getId()));
}
@PostMapping("resicategorystatslistshowd")
public Result<List<IcResiCategoryStatsConfigDTO>> resiCategoryStatsListShowd(){
//获取预警配置列表
List<IcResiCategoryStatsConfigEntity> statsConfigEntityList = icResiCategoryStatsConfigDao.selectList(new QueryWrapper<IcResiCategoryStatsConfigEntity>()
.lambda()
.eq(IcResiCategoryStatsConfigEntity::getStatus,"show")
.orderByAsc(IcResiCategoryStatsConfigEntity::getSort));
return new Result<List<IcResiCategoryStatsConfigDTO>>().ok(ConvertUtils.sourceToTarget(statsConfigEntityList, IcResiCategoryStatsConfigDTO.class));
}
@PostMapping("resicategorywarnlist")
public Result<List<IcResiCategoryWarnConfigDTO>> resiCategoryWarnList(){
//获取预警配置列表
List<IcResiCategoryWarnConfigEntity> warnConfigEntityList = icResiCategoryWarnConfigDao.selectList(new QueryWrapper<IcResiCategoryWarnConfigEntity>()
.lambda()
.orderByAsc(IcResiCategoryWarnConfigEntity::getSort));
return new Result<List<IcResiCategoryWarnConfigDTO>>().ok(ConvertUtils.sourceToTarget(warnConfigEntityList, IcResiCategoryWarnConfigDTO.class));
}
@PostMapping("resicategorywarninfobyid")
public Result<IcResiCategoryWarnConfigDTO> resiCategoryWarnInfoById(@RequestBody IcResiCategoryWarnConfigDTO dto){
//获取预警配置列表
if(StringUtils.isEmpty(dto.getId())){
return new Result<>();
}
return new Result<IcResiCategoryWarnConfigDTO>().ok(ConvertUtils.sourceToTarget(icResiCategoryWarnConfigDao.selectById(dto.getId()),IcResiCategoryWarnConfigDTO.class));
}
}

13
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormItemOptionsDao.java

@ -20,6 +20,9 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.IcFormItemOptionsEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 表单项的选项
@ -29,5 +32,13 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface IcFormItemOptionsDao extends BaseDao<IcFormItemOptionsEntity> {
/**
* @Description 查询志愿者类型
* @param volunteers
* @author zxc
* @date 2021/11/8 10:02 上午
*/
List<String> volunteerLabelByValues(@Param("volunteers") List<String> volunteers,@Param("customerId")String customerId);
}

4
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcResiCategoryWarnConfigEntity.java

@ -17,6 +17,7 @@
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
@ -66,16 +67,19 @@ public class IcResiCategoryWarnConfigEntity extends BaseEpmetEntity {
/**
* 等级1阈值
*/
@TableField(value = "LEVEL_1")
private Integer level1;
/**
* 等级2阈值
*/
@TableField(value = "LEVEL_2")
private Integer level2;
/**
* 等级3阈值
*/
@TableField(value = "LEVEL_3")
private Integer level3;
}

8
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcFormItemOptionsService.java

@ -92,4 +92,12 @@ public interface IcFormItemOptionsService extends BaseService<IcFormItemOptionsE
* @date 2021-10-26
*/
void delete(String[] ids);
/**
* @Description 查询志愿者类型
* @param volunteers
* @author zxc
* @date 2021/11/8 10:02 上午
*/
List<String> volunteerLabelByValues(List<String> volunteers, String customerId);
}

9
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcResiCategoryStatsConfigService.java

@ -92,4 +92,13 @@ public interface IcResiCategoryStatsConfigService extends BaseService<IcResiCate
* @date 2021-11-04
*/
void delete(String[] ids);
/**
* @Description 获取居民类别
* @Param dto
* @Return {@link List< IcResiCategoryStatsConfigDTO>}
* @Author zhaoqifeng
* @Date 2021/11/5 15:43
*/
List<IcResiCategoryStatsConfigDTO> getCategoryList(IcResiCategoryStatsConfigDTO dto);
}

11
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormItemOptionsServiceImpl.java

@ -97,4 +97,15 @@ public class IcFormItemOptionsServiceImpl extends BaseServiceImpl<IcFormItemOpti
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @Description 查询志愿者类型
* @param volunteers
* @author zxc
* @date 2021/11/8 10:02 上午
*/
@Override
public List<String> volunteerLabelByValues(List<String> volunteers,String customerId) {
return baseDao.volunteerLabelByValues(volunteers,customerId);
}
}

24
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcResiCategoryStatsConfigServiceImpl.java

@ -17,12 +17,13 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.IcResiCategoryStatsConfigDao;
import com.epmet.dto.IcResiCategoryStatsConfigDTO;
import com.epmet.entity.IcResiCategoryStatsConfigEntity;
@ -34,6 +35,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@ -101,4 +103,24 @@ public class IcResiCategoryStatsConfigServiceImpl extends BaseServiceImpl<IcResi
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @param dto
* @Description 获取居民类别
* @Param dto
* @Return {@link List< IcResiCategoryStatsConfigDTO>}
* @Author zhaoqifeng
* @Date 2021/11/5 15:43
*/
@Override
public List<IcResiCategoryStatsConfigDTO> getCategoryList(IcResiCategoryStatsConfigDTO dto) {
if(StringUtils.isBlank(dto.getCustomerId())) {
return Collections.emptyList();
}
LambdaQueryWrapper<IcResiCategoryStatsConfigEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcResiCategoryStatsConfigEntity::getCustomerId, dto.getCustomerId());
wrapper.orderByAsc(IcResiCategoryStatsConfigEntity::getSort);
List<IcResiCategoryStatsConfigEntity> list = baseDao.selectList(wrapper);
return ConvertUtils.sourceToTarget(list, IcResiCategoryStatsConfigDTO.class);
}
}

26
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/ResiCategoryStatsConfigServiceImpl.java

@ -54,7 +54,10 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf
return new ArrayList<>();
}
Set<String> groupIds = icFormItemEntityList.stream().filter(item-> !"0".equals(item.getItemGroupId())).map(item->item.getItemGroupId()).collect(Collectors.toSet());
List<IcFormItemGroupEntity> icFormItemGroupEntityList = icFormItemGroupDao.selectList(new QueryWrapper<IcFormItemGroupEntity>().lambda().in(IcFormItemGroupEntity::getId, groupIds));
List<IcFormItemGroupEntity> icFormItemGroupEntityList = new ArrayList<>();
if(!CollectionUtils.isEmpty(groupIds)){
icFormItemGroupEntityList.addAll(icFormItemGroupDao.selectList(new QueryWrapper<IcFormItemGroupEntity>().lambda().in(IcFormItemGroupEntity::getId, groupIds)));
}
//获取tableName和COLUMN_NAME
Map<String,IcFormItemEntity> tableColumnMap = new HashMap<>();
Map<String,String> idTableMap = new HashMap<>();
@ -202,6 +205,8 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf
//更新配置预警
if(IcResiCategoryStatsConfigConstant.WARN_YES.equals(formDTO.getWarn())){
//TODO 判断阈值范围
//更新
IcResiCategoryWarnConfigEntity icResiCategoryWarnConfigEntity = icResiCategoryWarnConfigDao.selectOne(new QueryWrapper<IcResiCategoryWarnConfigEntity>().lambda()
.eq(IcResiCategoryWarnConfigEntity::getTableName, icResiCategoryStatsConfigDTO.getTableName())
@ -259,6 +264,25 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf
icResiCategoryStatsConfigEntity.setSort(formDTO.getSort());
entityList.add(icResiCategoryStatsConfigEntity);
}
if(CollectionUtils.isEmpty(entityList)){
return ;
}
icResiCategoryStatsConfigService.updateBatchById(entityList);
//排序更新预警的
List<IcResiCategoryStatsConfigEntity> statsConfigEntityList = icResiCategoryStatsConfigDao.selectList(null);
List<IcResiCategoryWarnConfigEntity> warnConfigEntityList = icResiCategoryWarnConfigDao.selectList(null);
if(CollectionUtils.isEmpty(warnConfigEntityList)){
return ;
}
for (IcResiCategoryWarnConfigEntity warnConfigEntity : warnConfigEntityList) {
List<IcResiCategoryStatsConfigEntity> collect = statsConfigEntityList.stream().filter(i -> i.getTableName().equals(warnConfigEntity.getTableName()) && i.getColumnName().equals(warnConfigEntity.getColumnName())).collect(Collectors.toList());
if(CollectionUtils.isEmpty(collect)){
continue;
}
warnConfigEntity.setSort(collect.get(0).getSort());
}
icResiCategoryWarnConfigService.updateBatchById(warnConfigEntityList);
}
}

15
epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormItemOptionsDao.xml

@ -3,6 +3,17 @@
<mapper namespace="com.epmet.dao.IcFormItemOptionsDao">
<!-- 查询志愿者类型 -->
<select id="volunteerLabelByValues" resultType="java.lang.String">
SELECT
OPTION_LABEL
FROM ic_form_item_options
WHERE DEL_FLAG = 0
AND CUSTOMER_ID = #{customerId}
AND OPTION_VALUE IN(
<foreach collection="volunteers" item="v" separator=",">
#{v}
</foreach>
)
</select>
</mapper>

111
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcStatsResiWarnDTO.java

@ -0,0 +1,111 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 预警统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-11-04
*/
@Data
public class IcStatsResiWarnDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
private String id;
/**
* 客户id
*/
private String customerId;
/**
* 预警配置ID
*/
private String configId;
/**
* 网格id
*/
private String gridId;
/**
* 组织id
*/
private String agencyId;
/**
* 组织的所有上级组织id
*/
private String agencyPids;
/**
* 小区id
*/
private String neighborHoodId;
/**
* 楼宇id
*/
private String buildingId;
/**
* 该分类的居民数量
*/
private Integer count;
/**
* 删除标识:0.未删除 1.已删除
*/
private String delFlag;
/**
* 乐观锁
*/
private String revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private String createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

46
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StatsResiListFormDTO.java

@ -0,0 +1,46 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 预警统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-11-04
*/
@Data
public class StatsResiListFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 组织id
*/
@NotBlank(message = "id不能为空")
private String id;
@NotBlank(message = "level不能为空")
private String level;
}

55
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StatsResiWarnFormDTO.java

@ -0,0 +1,55 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 预警统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-11-04
*/
@Data
public class StatsResiWarnFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
public interface ListSelectedBuilding {};
public interface ListSelectedUser {};
/**
* 组织id
*/
@NotBlank(message = "组织id不能为空",groups = {ListSelectedBuilding.class})
private String agencyId;
@NotBlank(message = "配置id不能为空",groups = {ListSelectedUser.class})
private String configId;
@NotNull(message = "楼宇不能为空",groups = {ListSelectedUser.class})
private List<String> buildingIdList;
}

44
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcStatsResiResultDTO.java

@ -0,0 +1,44 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* 预警统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-11-04
*/
@Data
public class IcStatsResiResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
private String id;
private String label;
private Integer count;
private String managementIcon;
private String dataIcon;
private String houseShowIcon;
}

58
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcStatsResiWarnBuildingResultDTO.java

@ -0,0 +1,58 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 预警统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-11-04
*/
@Data
public class IcStatsResiWarnBuildingResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 预警配置ID
*/
private String configId;
private String label;
private Integer sort;
private Integer level1;
private Integer levelCount1;
private Integer level2;
private Integer levelCount2;
private Integer level3;
private Integer levelCount3;
private List<String> buildingIdList1;
private List<String> buildingIdList2;
private List<String> buildingIdList3;
}

47
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcStatsResiWarnUserResultDTO.java

@ -0,0 +1,47 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 预警统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-11-04
*/
@Data
public class IcStatsResiWarnUserResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 预警配置ID
*/
private String configId;
private String buildingId;
private String gridName;
private String neighborhoodName;
private String buildingName;
private String residentNames;
}

12
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PersonDataResultDTO.java

@ -72,4 +72,16 @@ public class PersonDataResultDTO implements Serializable {
*/
@JsonIgnore
private String idCard;
/**
* 是否是志愿者 1是0否
*/
@JsonIgnore
private String isVolunteer;
@JsonIgnore
private String customerId;
@JsonIgnore
private String gridId;
}

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

@ -650,4 +650,7 @@ public interface EpmetUserOpenFeignClient {
@PostMapping("/epmetuser/icresidemanddict/demandoption/demandoption")
Result<List<OptionResultDTO>> getDemandOptions();
@PostMapping("/epmetuser/icresiuser/categorycount")
Result<Map<String, Map<String, Integer>>> getHomeUserCategoryCount(@RequestBody IcResiUserDTO formDTO);
}

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

@ -469,4 +469,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien
public Result<List<OptionResultDTO>> getDemandOptions() {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getDemandOptions", null);
}
@Override
public Result<Map<String, Map<String, Integer>>> getHomeUserCategoryCount(IcResiUserDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getHomeUserCategoryCount", formDTO);
}
}

8
epmet-user/epmet-user-server/src/main/java/com/epmet/constant/LevelConstant.java

@ -0,0 +1,8 @@
package com.epmet.constant;
public interface LevelConstant {
String AGENCY = "agency";
String GRID = "grid";
String NEIGHBORHOOD = "neighborHood";
String BUILDING = "building";
}

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

@ -99,6 +99,7 @@ public interface UserConstant {
String MAN_WOMAN = "先生/女士";
String GRID_ID="GRID_ID";
String GRID_NAME="GRID_NAME";
String GENDER="GENDER";
String HOUSE_TYPE_KEY="HOUSE_TYPE";
String HOME_ID = "HOME_ID";

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

@ -22,6 +22,7 @@ import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
@ -35,18 +36,26 @@ import com.epmet.feign.OperCustomizeOpenFeignClient;
import com.epmet.service.IcResiUserImportService;
import com.epmet.service.IcResiUserService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Workbook;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URLEncoder;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;
@ -62,6 +71,8 @@ import java.util.concurrent.atomic.AtomicInteger;
public class IcResiUserController {
private static final String BASE_TABLE_NAME = "ic_resi_user";
private Path IC_RESI_UPLOAD_DIR;
@Autowired
private OperCustomizeOpenFeignClient operCustomizeOpenFeignClient;
@Autowired
@ -69,6 +80,20 @@ public class IcResiUserController {
@Autowired
private IcResiUserImportService icResiUserImportService;
{
// 初始化上传目录
String home = System.getProperty("user.home");
Path importDir = Paths.get(home, "epmet_files", "ic_user_import");
if (Files.notExists(importDir)) {
try {
Files.createDirectories(importDir);
} catch (IOException e) {
log.error("创建数字赋能平台上传目录失败");
}
}
IC_RESI_UPLOAD_DIR = importDir;
}
@PostMapping("delete")
public Result delete(@LoginUser TokenDto tokenDto,@RequestBody DelIcResiUserFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
@ -162,7 +187,7 @@ public class IcResiUserController {
continue;
}
if (item2.getItemType().equals("checkbox") || item2.getItemType().equals("select") || item2.getItemType().equals("radio")) {
if ("checkbox".equals(item2.getItemType()) || "select".equals(item2.getItemType()) || "radio".equals(item2.getItemType())) {
itemMap.put(item2.getColumnName().concat(item2.getColumnNum() == 0 ? "" : item2.getColumnNum().toString()), ConvertUtils.sourceToTarget(item2, FormItem.class));
}
}
@ -181,13 +206,13 @@ public class IcResiUserController {
if (StringUtils.isBlank(formItem2.getColumnName())) {
continue;
}
if (formItem2.getItemType().equals("checkbox") || formItem2.getItemType().equals("select") || formItem2.getItemType().equals("radio")) {
if ("checkbox".equals(formItem2.getItemType()) || "select".equals(formItem2.getItemType()) || "radio".equals(formItem2.getItemType())) {
itemMap.put(formItem2.getColumnName().concat(formItem2.getColumnNum() == 0 ? "" : formItem2.getColumnNum().toString()), ConvertUtils.sourceToTarget(formItem2, FormItem.class));
}
}
}
Map<String, Map<String, Object>> resiMainList = icResiUserService.getDataForExport(otherSheetItems.get(BASE_TABLE_NAME), pageFormDTO.getCustomerId(), pageFormDTO.getFormCode(), BASE_TABLE_NAME, pageFormDTO.getConditions());
Map<String, Map<String, Object>> resiMainList = icResiUserService.getDataForExport(otherSheetItems.get(BASE_TABLE_NAME),new HashMap<>(), pageFormDTO.getCustomerId(), pageFormDTO.getFormCode(), BASE_TABLE_NAME, pageFormDTO.getConditions());
//resiMainList = (List<Map<String, Object>>)JSON.parse("[{\"IS_BDHJ\":\"1\",\"IS_SPECIAL\":\"1\",\"IS_XFRY\":\"0\",\"REMARKS\":\"beizhu\",\"IS_PARTY\":\"1\",\"icResiUserId\":\"yzmtest2\",\"HOME_ID\":\"中海国际社区一里城1号楼1单元101\",\"HOUSE_TYPE\":\"平房\",\"UNIT_NAME\":\"1单元\",\"GRID_ID\":\"市北区-市北区第三网格3\",\"IS_DB\":\"0\",\"GENDER\":\"男\",\"BIRTHDAY\":\"2021-10-04\",\"IS_VETERANS\":\"0\",\"IS_MB\":\"0\",\"IS_UNEMPLOYED\":\"0\",\"DEMAND_NAME\":null,\"IS_KC\":\"0\",\"IS_ENSURE_HOUSE\":\"0\",\"IS_SD\":\"0\",\"NAME\":\"尹作梅\",\"RDSJ\":null,\"IS_VOLUNTEER\":\"1\",\"GRID_ID_VALUE\":\"e74829ffc43d5470eba6b5e060c11e63\",\"IS_SZ\":\"0\",\"IS_CJ\":\"0\",\"HOME_ID_VALUE\":\"200\",\"DEMAND_CATEGORY_IDS\":null,\"VILLAGE_NAME\":\"中海国际社区一里城\",\"IS_DBH\":\"0\",\"IS_SN\":\"0\",\"BUILD_NAME\":\"1号楼\",\"IS_YLFN\":\"0\",\"IS_UNITED_FRONT\":\"0\",\"ID_CARD\":\"371325199310260529\",\"MOBILE\":\"15764229697\",\"IS_OLD_PEOPLE\":\"0\",\"DOOR_NAME\":\"101\"},{\"IS_SPECIAL\":\"1\",\"IS_XFRY\":\"0\",\"REMARKS\":\"beizhu\",\"IS_PARTY\":\"1\",\"icResiUserId\":\"yzmtest\",\"HOME_ID\":\"中海国际社区一里城1号楼1单元101\",\"HOUSE_TYPE\":\"平房\",\"UNIT_NAME\":\"1单元\",\"GRID_ID\":\"市北区-市北区第三网格3\",\"IS_DB\":\"0\",\"GENDER\":\"男\",\"BIRTHDAY\":\"2021-10-04\",\"IS_VETERANS\":\"0\",\"IS_MB\":\"0\",\"IS_UNEMPLOYED\":\"0\",\"DEMAND_NAME\":\"心理咨询\",\"IS_KC\":\"0\",\"IS_ENSURE_HOUSE\":\"0\",\"IS_SD\":\"0\",\"NAME\":\"尹作梅\",\"RDSJ\":\"2021-10-28 00:00:00\",\"IS_VOLUNTEER\":\"1\",\"GRID_ID_VALUE\":\"e74829ffc43d5470eba6b5e060c11e63\",\"IS_SZ\":\"0\",\"IS_CJ\":\"0\",\"HOME_ID_VALUE\":\"200\",\"DEMAND_CATEGORY_IDS\":\"10180002\",\"VILLAGE_NAME\":\"中海国际社区一里城\",\"IS_DBH\":\"0\",\"IS_SN\":\"0\",\"BUILD_NAME\":\"1号楼\",\"IS_YLFN\":\"0\",\"IS_UNITED_FRONT\":\"0\",\"ID_CARD\":\"371325199310260529\",\"MOBILE\":\"15764229697\",\"IS_OLD_PEOPLE\":\"0\",\"DOOR_NAME\":\"101\"}]");
log.info("resiMainList:{}", JSON.toJSONString(resiMainList));
String templatePath = "excel/ic_resi_info_cid.xls";
@ -203,7 +228,7 @@ public class IcResiUserController {
if (item.getChildGroup() != null) {
if (!item.getChildGroup().getTableName().equals(BASE_TABLE_NAME)) {
Map<String, FormItem> itemMap1 = otherSheetItems.get(item.getChildGroup().getTableName());
Map<String, Map<String, Object>> resiChildMap = icResiUserService.getDataForExport(itemMap1, pageFormDTO.getCustomerId(), pageFormDTO.getFormCode(), item.getChildGroup().getTableName(), pageFormDTO.getConditions());
Map<String, Map<String, Object>> resiChildMap = icResiUserService.getDataForExport(itemMap1,resiMainList, pageFormDTO.getCustomerId(), pageFormDTO.getFormCode(), item.getChildGroup().getTableName(), pageFormDTO.getConditions());
resiChildMap.forEach((key, value) -> value.putAll(resiMainList.get(key)));
Map<String, Object> mapData2 = new HashMap<>();
@ -227,10 +252,36 @@ public class IcResiUserController {
*
* @return
*/
@PostMapping("import/excel")
public Result importExcelByEasyExcel() {
Object result = icResiUserImportService.importIcResiInfoFromExcel();
return new Result().ok(result);
@PostMapping("importExcel")
public void importExcelByEasyExcel(@RequestPart("file") MultipartFile file, HttpServletResponse response) {
if (file.isEmpty()) {
throw new RenException("请上传文件");
}
// 校验文件类型
String extension = FilenameUtils.getExtension(file.getOriginalFilename());
if (!"xls".equals(extension) && !"xlsx".equals(extension)) {
throw new RenException("文件类型不匹配");
}
Path savePath = null;
try {
String fileName = UUID.randomUUID().toString().concat(".").concat(extension);
savePath = IC_RESI_UPLOAD_DIR.resolve(fileName);
IOUtils.copy(file.getInputStream(), new FileOutputStream(savePath.toString()));
icResiUserImportService.importIcResiInfoFromExcel(savePath.toString(), response);
} catch (IOException e) {
String errorMsg = ExceptionUtils.getErrorStackTrace(e);
log.error("【导入居民信息失败】导入失败:{}", errorMsg);
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} finally {
try {
Files.delete(savePath);
} catch (IOException e) {
log.error("【导入居民信息失败】清理上传的文件失败:{}", ExceptionUtils.getErrorStackTrace(e));
}
}
}
@PostMapping("test")
@ -292,4 +343,16 @@ public class IcResiUserController {
return new Result<OwnerRelationResultDTO>().ok(icResiUserService.getOwnerRelation(formDTO.getUserId()));
}
/**
* @Description 获取一栋楼每个房间人员分类的数量
* @Param formDTO
* @Return {@link Result< Map< String, Map< String, Integer>>>}
* @Author zhaoqifeng
* @Date 2021/11/5 15:10
*/
@PostMapping("categorycount")
public Result<Map<String, Map<String, Integer>>> getHomeUserCategoryCount(@RequestBody IcResiUserDTO formDTO) {
return new Result<Map<String, Map<String, Integer>>>().ok(icResiUserService.getHomeUserCategoryCount(formDTO.getBuildId()));
}
}

94
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcStatsResiWarnController.java

@ -0,0 +1,94 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.IcStatsResiWarnDTO;
import com.epmet.excel.IcStatsResiWarnExcel;
import com.epmet.service.IcStatsResiWarnService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 预警统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-11-04
*/
@RestController
@RequestMapping("icstatsresiwarn")
public class IcStatsResiWarnController {
@Autowired
private IcStatsResiWarnService icStatsResiWarnService;
@GetMapping("page")
public Result<PageData<IcStatsResiWarnDTO>> page(@RequestParam Map<String, Object> params){
PageData<IcStatsResiWarnDTO> page = icStatsResiWarnService.page(params);
return new Result<PageData<IcStatsResiWarnDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<IcStatsResiWarnDTO> get(@PathVariable("id") String id){
IcStatsResiWarnDTO data = icStatsResiWarnService.get(id);
return new Result<IcStatsResiWarnDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody IcStatsResiWarnDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
icStatsResiWarnService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody IcStatsResiWarnDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
icStatsResiWarnService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
icStatsResiWarnService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<IcStatsResiWarnDTO> list = icStatsResiWarnService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, IcStatsResiWarnExcel.class);
}
}

95
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StatsResiWarnController.java

@ -0,0 +1,95 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.common.token.annotation.Login;
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.dto.form.StatsResiListFormDTO;
import com.epmet.dto.form.StatsResiWarnFormDTO;
import com.epmet.dto.result.IcStatsResiResultDTO;
import com.epmet.dto.result.IcStatsResiWarnBuildingResultDTO;
import com.epmet.dto.result.IcStatsResiWarnUserResultDTO;
import com.epmet.service.IcStatsResiWarnService;
import com.epmet.service.StatsResiWarnService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
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;
/**
* 预警统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-11-04
*/
@RestController
@RequestMapping("statsresiwarn")
public class StatsResiWarnController {
@Autowired
private IcStatsResiWarnService icStatsResiWarnService;
@Autowired
private StatsResiWarnService statsResiWarnService;
@PostMapping("list")
public Result list(@RequestBody StatsResiListFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO);
List<IcStatsResiResultDTO> icStatsResiResultDTOList = statsResiWarnService.list(formDTO.getId(),formDTO.getLevel());
return new Result().ok(icStatsResiResultDTOList);
}
@PostMapping("buildingwarnlist")
public Result buildingWarnList(@RequestBody StatsResiWarnFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, StatsResiWarnFormDTO.ListSelectedBuilding.class);
String agencyID = formDTO.getAgencyId();
List<IcStatsResiWarnBuildingResultDTO> icStatsResiWarnBuildingResultDTOS = statsResiWarnService.buildingwWarnList(agencyID);
return new Result().ok(icStatsResiWarnBuildingResultDTOS);
}
@PostMapping("userwarnlist")
public Result userWarnList(@RequestBody StatsResiWarnFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, StatsResiWarnFormDTO.ListSelectedUser.class);
List<String> buildingIdList = formDTO.getBuildingIdList();
if(CollectionUtils.isEmpty(buildingIdList)){
return new Result();
}
List<IcStatsResiWarnUserResultDTO> icStatsResiWarnUserResultDTOS = statsResiWarnService.userWarnList(formDTO.getConfigId(), formDTO.getBuildingIdList());
return new Result().ok(icStatsResiWarnUserResultDTOS);
}
/**
* 统计
* @return
*/
@PostMapping("resiwarn")
public Result resiWarn(@LoginUser TokenDto tokenDto){
statsResiWarnService.resiWarn(tokenDto.getCustomerId());
return new Result();
}
}

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

@ -23,6 +23,7 @@ import com.epmet.dto.result.IcFormResColumnDTO;
import com.epmet.dto.result.PersonDataResultDTO;
import com.epmet.dto.result.SearchByNameResultDTO;
import com.epmet.entity.IcResiUserEntity;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -49,7 +50,7 @@ public interface IcResiUserDao extends BaseDao<IcResiUserEntity> {
* @Author sun
* @Description 更新或新增居民信息各表数据
**/
void upTable(@Param("tableName") String tableName, @Param("id") String id, @Param("map") Map<String, String> map);
void upTable(@Param("tableName") String tableName, @Param("id") String id, @Param("map") Map<String, ?> map);
List<Map<String,Object>> selectListResiMap(@Param("customerId") String customerId,
@Param("formCode") String formCode,
@ -119,6 +120,17 @@ public interface IcResiUserDao extends BaseDao<IcResiUserEntity> {
List<SearchByNameResultDTO> searchByName(@Param("name")String name, @Param("agencyId")String agencyId,@Param("pageNo")Integer pageNo);
Set<String> selectUserDemandCode(String icResiUserId);
String selectCategoryNames(@Param("customerId") String customerId,@Param("codeSet") Set<String> codeSet);
@MapKey("HOME_ID")
Map<String, Map<String, Integer>> getHomeUserCategoryCount(@Param("buildId") String buildId);
/**
* @Description 根据userId查询志愿者
* @param userId
* @author zxc
* @date 2021/11/5 5:44 下午
*/
List<String> selectVolunteerByUserId(@Param("userId")String userId);
}

49
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcStatsResiWarnDao.java

@ -0,0 +1,49 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.IcResiCategoryStatsConfigDTO;
import com.epmet.entity.IcStatsResiWarnEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* 预警统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-11-04
*/
@Mapper
public interface IcStatsResiWarnDao extends BaseDao<IcStatsResiWarnEntity> {
List<IcStatsResiWarnEntity> selectResiWarnByAgencyId(@Param("agencyId") String agencyId);
List<Map<String,String>> userWarnList(@Param("buildingIdList") List<String> buildingIdList, @Param("tableName") String tableName, @Param("columnName") String columnName);
Integer countListByLevelAndCol(
@Param("tableName") String tableName,
@Param("columnName") String columnName,
@Param("id")String id,
@Param("level")String level);
List<IcStatsResiWarnEntity> resiWarn(@Param("tableName") String tableName,@Param("columnName") String columnName);
}

81
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcStatsResiWarnEntity.java

@ -0,0 +1,81 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 预警统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-11-04
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("ic_stats_resi_warn")
public class IcStatsResiWarnEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户id
*/
private String customerId;
/**
* 预警配置ID
*/
private String configId;
/**
* 网格id
*/
private String gridId;
/**
* 组织id
*/
private String agencyId;
/**
* 组织的所有上级组织id
*/
private String agencyPids;
/**
* 小区id
*/
private String neighborHoodId;
/**
* 楼宇id
*/
private String buildingId;
/**
* 该分类的居民数量
*/
private Integer count;
}

82
epmet-user/epmet-user-server/src/main/java/com/epmet/enums/IcResiUserTableEnums.java

@ -0,0 +1,82 @@
package com.epmet.enums;
import lombok.AllArgsConstructor;
import lombok.Data;
/**
* @Description 描述
* @Author wangxianzhang
* @Date 2021/11/5 10:37 上午
* @Version 1.0
*/
@AllArgsConstructor
public enum IcResiUserTableEnums {
IC_RESI_USER("ic_resi_user","社区居民基本信息录入表", 0, 3, null),
IC_PARTY_MEMBER("ic_party_member","党员信息录入表", 1, 2, "IS_PARTY"),
IC_ENSURE_HOUSE("ic_ensure_house","保障房人员信息录入表", 2, 2, "IS_ENSURE_HOUSE"),
IC_UNEMPLOYED("ic_unemployed","失业人员信息录入表", 3, 2, "IS_UNEMPLOYED"),
IC_VETERANS("ic_veterans","退役军人信息录入表", 4, 2, "IS_VETERANS"),
IC_UNITED_FRONT("ic_united_front","统战人员信息录入表", 5, 2, "IS_UNITED_FRONT"),
IC_VOLUNTEER("ic_volunteer","志愿者信息录入表", 6, 3, "IS_VOLUNTEER"),
IC_OLD_PEOPLE("ic_old_people","老年人信息录入表", 7, 2, "IS_OLD_PEOPLE"),
IC_SPECIAL("ic_special","特殊人群信息录入表", 8, 3, "IS_SPECIAL");
private String tableName;
private String tableComment;
private int sheetNo;
private int headRowNo;
private String mainTableFlagColumnName;
public static IcResiUserTableEnums getObjectByTableName(String tableName) {
for (IcResiUserTableEnums i : IcResiUserTableEnums.values()) {
if (i.tableName.equals(tableName)) {
return i;
}
}
return null;
}
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
public String getTableComment() {
return tableComment;
}
public void setTableComment(String tableComment) {
this.tableComment = tableComment;
}
public int getSheetNo() {
return sheetNo;
}
public void setSheetNo(int sheetNo) {
this.sheetNo = sheetNo;
}
public int getHeadRowNo() {
return headRowNo;
}
public void setHeadRowNo(int headRowNo) {
this.headRowNo = headRowNo;
}
public String getMainTableFlagColumnName() {
return mainTableFlagColumnName;
}
public void setMainTableFlagColumnName(String mainTableFlagColumnName) {
this.mainTableFlagColumnName = mainTableFlagColumnName;
}
}

80
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcStatsResiWarnExcel.java

@ -0,0 +1,80 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 预警统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-11-04
*/
@Data
public class IcStatsResiWarnExcel {
@Excel(name = "id")
private String id;
@Excel(name = "客户id")
private String customerId;
@Excel(name = "预警配置ID")
private String configId;
@Excel(name = "网格id")
private String gridId;
@Excel(name = "组织id")
private String agencyId;
@Excel(name = "组织的所有上级组织id")
private String agencyPids;
@Excel(name = "小区id")
private String neighborHoodId;
@Excel(name = "楼宇id")
private String buildingId;
@Excel(name = "该分类的居民数量")
private Integer count;
@Excel(name = "删除标识:0.未删除 1.已删除")
private String delFlag;
@Excel(name = "乐观锁")
private String revision;
@Excel(name = "创建人")
private String createdBy;
@Excel(name = "创建时间")
private String createdTime;
@Excel(name = "更新人")
private String updatedBy;
@Excel(name = "更新时间")
private Date updatedTime;
}

6
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/DynamicEasyExcelListener.java

@ -34,7 +34,7 @@ public class DynamicEasyExcelListener extends AnalysisEventListener<Map<Integer,
*/
@Override
public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
log.info("解析到一条头数据:{}", JSON.toJSONString(headMap));
//log.info("解析到一条头数据:{}", JSON.toJSONString(headMap));
//存储全部表头数据
headList.add(headMap);
}
@ -48,7 +48,7 @@ public class DynamicEasyExcelListener extends AnalysisEventListener<Map<Integer,
*/
@Override
public void invoke(Map<Integer, String> data, AnalysisContext context) {
log.info("解析到一条数据:{}", JSON.toJSONString(data));
//log.info("解析到一条数据:{}", JSON.toJSONString(data));
dataList.add(data);
}
@ -60,7 +60,7 @@ public class DynamicEasyExcelListener extends AnalysisEventListener<Map<Integer,
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
// 这里也要保存数据,确保最后遗留的数据也存储到数据库
log.info("所有数据解析完成!");
//log.info("所有数据解析完成!");
}
public List<Map<Integer, String>> getHeadList() {

47
epmet-user/epmet-user-server/src/main/java/com/epmet/redis/IcStatsResiWarnRedis.java

@ -0,0 +1,47 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 预警统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-11-04
*/
@Component
public class IcStatsResiWarnRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

6
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserImportService.java

@ -1,5 +1,8 @@
package com.epmet.service;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
*@Description 居民信息导入service
*@Author wangxianzhang
@ -7,6 +10,5 @@ package com.epmet.service;
*/
public interface IcResiUserImportService {
Object importIcResiInfoFromExcel();
void importIcResiInfoFromExcel(String excelPathName, HttpServletResponse response);
}

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

@ -75,7 +75,7 @@ public interface IcResiUserService extends BaseService<IcResiUserEntity> {
*/
Map queryIcResiDetail(IcResiDetailFormDTO pageFormDTO);
List<Map<String,Object>> dynamicQuery(String customerId,
String formCode,
@ -104,13 +104,14 @@ public interface IcResiUserService extends BaseService<IcResiUserEntity> {
* desc:条件导出
*
* @param itemList
* @param resiMainList
* @param customerId
* @param formCode
* @param baseTableName
* @param conditions
* @return
*/
Map<String, Map<String, Object>> getDataForExport(Map<String, FormItem> itemList, String customerId, String formCode, String baseTableName, List<ResiUserQueryValueDTO> conditions);
Map<String, Map<String, Object>> getDataForExport(Map<String, FormItem> itemList, Map<String, Map<String, Object>> resiMainList, String customerId, String formCode, String baseTableName, List<ResiUserQueryValueDTO> conditions);
/**
* @Description 家庭关系
@ -120,4 +121,13 @@ public interface IcResiUserService extends BaseService<IcResiUserEntity> {
* @Date 2021/11/5 10:28
*/
OwnerRelationResultDTO getOwnerRelation(String userId);
/**
* @Description 获取一栋楼每个房间人员分类的数量
* @Param buildId
* @Return {@link Map< String, Map< String, Integer>>}
* @Author zhaoqifeng
* @Date 2021/11/5 14:40
*/
Map<String, Map<String, Integer>> getHomeUserCategoryCount(String buildId);
}

95
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcStatsResiWarnService.java

@ -0,0 +1,95 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.IcStatsResiWarnDTO;
import com.epmet.entity.IcStatsResiWarnEntity;
import java.util.List;
import java.util.Map;
/**
* 预警统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-11-04
*/
public interface IcStatsResiWarnService extends BaseService<IcStatsResiWarnEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<IcStatsResiWarnDTO>
* @author generator
* @date 2021-11-04
*/
PageData<IcStatsResiWarnDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<IcStatsResiWarnDTO>
* @author generator
* @date 2021-11-04
*/
List<IcStatsResiWarnDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return IcStatsResiWarnDTO
* @author generator
* @date 2021-11-04
*/
IcStatsResiWarnDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2021-11-04
*/
void save(IcStatsResiWarnDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2021-11-04
*/
void update(IcStatsResiWarnDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2021-11-04
*/
void delete(String[] ids);
}

41
epmet-user/epmet-user-server/src/main/java/com/epmet/service/StatsResiWarnService.java

@ -0,0 +1,41 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service;
import com.epmet.dto.result.IcStatsResiResultDTO;
import com.epmet.dto.result.IcStatsResiWarnBuildingResultDTO;
import com.epmet.dto.result.IcStatsResiWarnUserResultDTO;
import java.util.List;
/**
* 预警统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-11-04
*/
public interface StatsResiWarnService{
List<IcStatsResiWarnBuildingResultDTO> buildingwWarnList(String agencyID);
List<IcStatsResiWarnUserResultDTO> userWarnList(String configId, List<String> buildingIdList);
List<IcStatsResiResultDTO> list(String id, String level);
void resiWarn(String customerId);
}

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

@ -1,10 +1,15 @@
package com.epmet.service.impl;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.security.user.LoginUserUtil;
@ -19,6 +24,7 @@ import com.epmet.dto.result.FormItem;
import com.epmet.dto.result.LoginUserDetailsResultDTO;
import com.epmet.dto.result.OptionDTO;
import com.epmet.entity.IcResiUserEntity;
import com.epmet.enums.IcResiUserTableEnums;
import com.epmet.excel.handler.DynamicEasyExcelListener;
import com.epmet.feign.EpmetAdminOpenFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient;
@ -29,10 +35,14 @@ import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.*;
import java.util.stream.Collectors;
@ -47,7 +57,9 @@ import java.util.stream.Collectors;
@Service
public class IcResiUserImportServiceImpl implements IcResiUserImportService, ResultDataResolver {
public static final ThreadLocal errorRow = new ThreadLocal<ErrorRow>();
// 错误和跳过excel行暂存
public static final ThreadLocal<Map<String, List<ErrorRow>>> errorRows = new ThreadLocal<>();
public static final ThreadLocal<Map<String, List<SkipedRow>>> skipedRows = new ThreadLocal<>();
@Autowired
private LoginUserUtil loginUserUtil;
@ -80,6 +92,9 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
private String columnName;
private String itemType;
private String itemId;
// 是否必填
private Integer required;
private List<Integer> colIndexs;
//private List<String> colContents;
// 单元格内容
@ -104,20 +119,49 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
/**
* 错误行信息
*/
@Data
public static class ErrorRow {
@Excel(name = "工作表", width = 30)
private String sheetName;
private String tableName;
@Excel(name = "身份证号", width = 40)
private String idCard;
@Excel(name = "姓名", width = 25)
private String name;
@Excel(name = "错误信息", width = 40)
private String errorInfo;
}
@Data
public static class SkipedRow {
@Excel(name = "工作表")
private String sheetName;
private String tableName;
@Excel(name = "身份证号")
private String idCard;
@Excel(name = "姓名")
private String name;
@Excel(name = "信息")
private String info;
}
/**
* 导入居民信息
* 导入主表和所有子表信息
* @return
*/
@Override
public Object importIcResiInfoFromExcel() {
public void importIcResiInfoFromExcel(String excelPathName, HttpServletResponse response) {
String loginUserId = loginUserUtil.getLoginUserId();
String loginUserApp = loginUserUtil.getLoginUserApp();
String loginUserClient = loginUserUtil.getLoginUserClient();
@ -130,21 +174,67 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
LoginUserDetailsResultDTO loginUserDetails = getResultDataOrThrowsException(epmetUserOpenFeignClient.getLoginUserDetails(userForm), ServiceConstant.EPMET_USER_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null);
String currUserAgencyId = loginUserDetails.getAgencyId();
String excelPathName = "/opt/test/基础信息表/resi_info.xls";
//String excelPathName = "/opt/test/基础信息表/resi_info.xls";
CustomerAgencyDTO agencyInfo = getResultDataOrThrowsException(govOrgOpenFeignClient.getAgencyById(currUserAgencyId), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null);
String customerId = agencyInfo.getCustomerId();
importIcResiBaseInfoFromExcel(excelPathName, 0, 3, currUserAgencyId, agencyInfo.getPids(), loginUserId);
importIcResiExtraInfoFromExcel(excelPathName, 1, 2, currUserAgencyId, loginUserId, "ic_party_member", customerId);
importIcResiExtraInfoFromExcel(excelPathName, 2, 2, currUserAgencyId, loginUserId, "ic_ensure_house", customerId);
importIcResiExtraInfoFromExcel(excelPathName, 3, 2, currUserAgencyId, loginUserId, "ic_unemployed", customerId);
importIcResiExtraInfoFromExcel(excelPathName, 4, 2, currUserAgencyId, loginUserId, "ic_veterans", customerId);
importIcResiExtraInfoFromExcel(excelPathName, 5, 2, currUserAgencyId, loginUserId, "ic_united_front", customerId);
importIcResiExtraInfoFromExcel(excelPathName, 6, 3, currUserAgencyId, loginUserId, "ic_volunteer", customerId);
importIcResiExtraInfoFromExcel(excelPathName, 7, 2, currUserAgencyId, loginUserId, "ic_old_people", customerId);
importIcResiExtraInfoFromExcel(excelPathName, 8, 3, currUserAgencyId, loginUserId, "ic_special", customerId);
return null;
try {
initThreadLocalRowsStorage();
// 上传主表信息
importIcResiBaseInfoFromExcel(excelPathName, IcResiUserTableEnums.IC_RESI_USER.getSheetNo(), IcResiUserTableEnums.IC_RESI_USER.getHeadRowNo(),
currUserAgencyId, agencyInfo.getPids(), loginUserId, IcResiUserTableEnums.IC_RESI_USER.getTableName());
// 上传附表信息
for (IcResiUserTableEnums sheet : IcResiUserTableEnums.values()) {
if (sheet == IcResiUserTableEnums.IC_RESI_USER) {
continue;
}
try {
importIcResiExtraInfoFromExcel(excelPathName, sheet.getSheetNo(), sheet.getHeadRowNo(), currUserAgencyId, loginUserId, sheet.getTableName(), customerId);
} catch (Exception e) {
String errorMsg = ExceptionUtils.getErrorStackTrace(e);
log.error("导入IC居民附加信息【{}】错误:{}", sheet.getTableComment(), errorMsg);
ErrorRow errorRow = new ErrorRow();
errorRow.setName("*");
errorRow.setIdCard("*");
errorRows.get().get(sheet.getTableName()).add(errorRow);
}
}
String errors = JSON.toJSONString(errorRows.get());
//String skipeds = JSON.toJSONString(skipedRows.get());
log.error(errors);
//log.error(skipeds);
try {
downLoadResults(response);
} catch (IOException e) {
log.error("【导入IC居民附加信息】下载导入结果信息失败:{}", ExceptionUtils.getErrorStackTrace(e));
}
} finally {
skipedRows.remove();
errorRows.remove();
}
}
/**
* 暂存rows信息初始化
*/
private void initThreadLocalRowsStorage() {
Map<String, List<SkipedRow>> skipedRowsMap = new LinkedHashMap<>();
for (IcResiUserTableEnums e : IcResiUserTableEnums.values()) {
skipedRowsMap.put(e.getTableName(), new LinkedList<>());
}
skipedRows.set(skipedRowsMap);
Map<String, List<ErrorRow>> errorRowsMap = new LinkedHashMap<>();
for (IcResiUserTableEnums e : IcResiUserTableEnums.values()) {
errorRowsMap.put(e.getTableName(), new LinkedList<>());
}
errorRows.set(errorRowsMap);
}
/**
@ -156,7 +246,8 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
* @param currentUserId
* @return
*/
private Object importIcResiBaseInfoFromExcel(String excelPathName, int sheetNo, int headRowNumber, String currUserAgencyId, String currUserAgencyPids, String currentUserId) {
private Object importIcResiBaseInfoFromExcel(String excelPathName, int sheetNo, int headRowNumber, String currUserAgencyId, String currUserAgencyPids, String currentUserId,
String tableName) {
DynamicEasyExcelListener readListener = new DynamicEasyExcelListener();
EasyExcelFactory.read(new File(excelPathName)).registerReadListener(readListener).headRowNumber(headRowNumber).sheet(sheetNo).doRead();
@ -189,7 +280,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
Map<String, ColumnWrapper> headerColumnWrapper = convertExcelHeaders2DBColumnWrappers(formItemMap, combinedHeaders, dataList, abandonedHeaders);
// 持久化
persistIcResiBaseInfo(headerColumnWrapper, dataList, currUserAgencyId, abandonedHeaders, currUserAgencyPids, currentUserId);
persistIcResiBaseInfo(headerColumnWrapper, dataList, currUserAgencyId, abandonedHeaders, currUserAgencyPids, currentUserId, tableName);
return headers;
}
@ -249,39 +340,66 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
*/
private void persistIcResiBaseInfo(Map<String, ColumnWrapper> headerColumnWrapper, List<Map<Integer, String>> dataRows,
String currUserAgencyId, Map<Integer, String> checkBoxOptionColumnIdxAndLabel,
String currUserAgencyPids, String currentUserId) {
String currUserAgencyPids, String currentUserId, String tableName) {
// 遍历每一行,将行内容转化为
for (Map<Integer, String> row : dataRows) {
LinkedHashMap<String, String> columnAndValues = convertColumnWrappers2Map4Persist(headerColumnWrapper, row, currUserAgencyId, checkBoxOptionColumnIdxAndLabel);
columnAndValues.put("IS_ENSURE_HOUSE", "0");
columnAndValues.put("IS_OLD_PEOPLE", "0");
columnAndValues.put("IS_PARTY", "0");
columnAndValues.put("IS_SPECIAL", "0");
columnAndValues.put("IS_UNEMPLOYED", "0");
columnAndValues.put("IS_UNITED_FRONT", "0");
columnAndValues.put("IS_VETERANS", "0");
columnAndValues.put("IS_VOLUNTEER", "0");
columnAndValues.put("AGENCY_ID", currUserAgencyId);
columnAndValues.put("PIDS", currUserAgencyPids);
columnAndValues.put("CUSTOMER_ID", loginUserUtil.getCurrentCustomerId());
columnAndValues.put("CREATED_BY", currentUserId);
columnAndValues.put("UPDATED_BY", currentUserId);
columnAndValues.put("ID", UUID.randomUUID().toString().replace("-", ""));
// 验证居民信息是否存在
String idCard = columnAndValues.get("ID_CARD");
LambdaQueryWrapper<IcResiUserEntity> idCardQuery = new LambdaQueryWrapper<>();
idCardQuery.eq(IcResiUserEntity::getIdCard, idCard);
if (icResiUserDao.selectCount(idCardQuery) > 0) {
log.info("身份证号为【{}】的居民信息已存在,跳过导入", idCard);
}
LinkedHashMap<String, String> columnAndValues = new LinkedHashMap<>();
try {
convertColumnWrappers2Map4Persist(headerColumnWrapper, row, currUserAgencyId, checkBoxOptionColumnIdxAndLabel, columnAndValues);
columnAndValues.put("IS_ENSURE_HOUSE", "0");
columnAndValues.put("IS_OLD_PEOPLE", "0");
columnAndValues.put("IS_PARTY", "0");
columnAndValues.put("IS_SPECIAL", "0");
columnAndValues.put("IS_UNEMPLOYED", "0");
columnAndValues.put("IS_UNITED_FRONT", "0");
columnAndValues.put("IS_VETERANS", "0");
columnAndValues.put("IS_VOLUNTEER", "0");
columnAndValues.put("AGENCY_ID", currUserAgencyId);
columnAndValues.put("PIDS", currUserAgencyPids);
columnAndValues.put("CUSTOMER_ID", loginUserUtil.getCurrentCustomerId());
columnAndValues.put("CREATED_BY", currentUserId);
columnAndValues.put("UPDATED_BY", currentUserId);
columnAndValues.put("ID", UUID.randomUUID().toString().replace("-", ""));
// 验证居民信息是否存在
String idCard = columnAndValues.get("ID_CARD");
LambdaQueryWrapper<IcResiUserEntity> idCardQuery = new LambdaQueryWrapper<>();
idCardQuery.eq(IcResiUserEntity::getIdCard, idCard);
if (icResiUserDao.selectCount(idCardQuery) > 0) {
//log.info("身份证号为【{}】的居民信息已存在,跳过导入", idCard);
SkipedRow skipedRow = new SkipedRow();
skipedRow.setName(columnAndValues.get("NAME"));
skipedRow.setIdCard(idCard);
skipedRow.setInfo("身份证号已存在,跳过导入");
skipedRow.setTableName(tableName);
skipedRows.get().get(IcResiUserTableEnums.IC_RESI_USER.getTableName()).add(skipedRow);
continue;
}
icResiUserDao.add(tableName, columnAndValues);
} catch (Exception e) {
String errorMsg;
if (e instanceof RenException) {
errorMsg = e.getMessage();
} else {
errorMsg = "未知系统错误";
log.error(ExceptionUtils.getErrorStackTrace(e));
}
icResiUserDao.add("ic_resi_user", columnAndValues);
ErrorRow errorRow = new ErrorRow();
errorRow.setIdCard(columnAndValues.get("ID_CARD"));
errorRow.setName(columnAndValues.get("NAME"));
errorRow.setErrorInfo(errorMsg);
errorRow.setTableName(tableName);
errorRows.get().get(IcResiUserTableEnums.IC_RESI_USER.getTableName()).add(errorRow);
} finally {
columnAndValues.clear();
}
}
}
@ -297,44 +415,75 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
String currUserAgencyId, Map<Integer, String> checkBoxOptionColumnIdxAndLabel,
String currentUserId, String targetTableName, String customerId) {
LinkedHashMap<String, String> columnAndValues = new LinkedHashMap<>();
// 遍历每一行,将行内容转化为
for (Map<Integer, String> row : dataRows) {
LinkedHashMap<String, String> columnAndValues = convertColumnWrappers2Map4Persist(headerColumnWrapper, row, currUserAgencyId, checkBoxOptionColumnIdxAndLabel);
try {
convertColumnWrappers2Map4Persist(headerColumnWrapper, row, currUserAgencyId, checkBoxOptionColumnIdxAndLabel, columnAndValues);
// 检验身份证号
String idCard = columnAndValues.get("ID_CARD");
if (StringUtils.isBlank(idCard)) {
throw new RenException(EpmetErrorCode.IDCARDNO_ERROR.getCode(), String.format("用户【%s】身份证号未填写或格式错误", columnAndValues.get("NAME")));
}
// 检验身份证号
String idCard = columnAndValues.get("ID_CARD");
if (StringUtils.isBlank(idCard)) {
throw new RenException(EpmetErrorCode.IDCARDNO_ERROR.getCode(), String.format("用户【%s】身份证号未填写或格式错误", columnAndValues.get("NAME")));
}
// 检查用户是否存在
LambdaQueryWrapper<IcResiUserEntity> idCardQuery = new LambdaQueryWrapper<>();
idCardQuery.eq(IcResiUserEntity::getIdCard, idCard);
// 检查用户是否存在
LambdaQueryWrapper<IcResiUserEntity> idCardQuery = new LambdaQueryWrapper<>();
idCardQuery.eq(IcResiUserEntity::getIdCard, idCard);
IcResiUserEntity icResiUserBaseInfo = icResiUserDao.selectOne(idCardQuery);
if (icResiUserBaseInfo == null) {
throw new RenException(EpmetErrorCode.RESI_NOT_FOUND.getCode(), String.format("身份证号为【%s】的居民信息未找到,请确认该居民信息存在", idCard));
}
IcResiUserEntity icResiUserBaseInfo = icResiUserDao.selectOne(idCardQuery);
if (icResiUserBaseInfo == null) {
throw new RenException(EpmetErrorCode.RESI_NOT_FOUND.getCode(), String.format("身份证号为【%s】的居民信息未找到,请确认该居民信息存在", idCard));
}
String icResiId = icResiUserBaseInfo.getId();
String icResiId = icResiUserBaseInfo.getId();
// 验证党员信息是否存在
if (CollectionUtils.isNotEmpty(icResiUserDao.selectSubTableRecords(customerId, icResiId, targetTableName))) {
log.info("身份证号为【{}】的居民【{}】信息已存在,跳过导入", idCard, targetTableName);
continue;
}
// 验证党员信息是否存在
if (CollectionUtils.isNotEmpty(icResiUserDao.selectSubTableRecords(customerId, icResiId, targetTableName))) {
log.info("身份证号为【{}】的居民【{}】信息已存在,跳过导入", idCard, targetTableName);
SkipedRow skipedRow = new SkipedRow();
skipedRow.setName(columnAndValues.get("NAME"));
skipedRow.setIdCard(columnAndValues.get("ID_CARD"));
skipedRow.setInfo("信息已存在,跳过导入");
skipedRow.setTableName(targetTableName);
skipedRows.get().get(targetTableName).add(skipedRow);
continue;
}
columnAndValues.put("IC_RESI_USER", icResiId);
columnAndValues.put("IC_RESI_USER", icResiId);
columnAndValues.put("CUSTOMER_ID", loginUserUtil.getCurrentCustomerId());
columnAndValues.put("CREATED_BY", currentUserId);
columnAndValues.put("UPDATED_BY", currentUserId);
columnAndValues.put("ID", UUID.randomUUID().toString().replace("-", ""));
columnAndValues.put("CUSTOMER_ID", loginUserUtil.getCurrentCustomerId());
columnAndValues.put("CREATED_BY", currentUserId);
columnAndValues.put("UPDATED_BY", currentUserId);
columnAndValues.put("ID", UUID.randomUUID().toString().replace("-", ""));
columnAndValues = removeNeedlessColumns(columnAndValues);
columnAndValues = removeNeedlessColumns(columnAndValues);
icResiUserDao.add(targetTableName, columnAndValues);
icResiUserDao.add(targetTableName, columnAndValues);
updateMainTableResiTypeFlag(Objects.requireNonNull(IcResiUserTableEnums.getObjectByTableName(targetTableName)), icResiId);
} catch (Exception e) {
String errorMsg;
if (e instanceof RenException) {
errorMsg = e.getMessage();
} else {
errorMsg = "未知系统错误";
log.error(ExceptionUtils.getErrorStackTrace(e));
}
ErrorRow errorRow = new ErrorRow();
errorRow.setName(columnAndValues.get("NAME"));
errorRow.setIdCard(columnAndValues.get("ID_CARD"));
errorRow.setErrorInfo(errorMsg);
errorRow.setTableName(targetTableName);
errorRows.get().get(targetTableName).add(errorRow);
} finally {
columnAndValues.clear();
}
}
}
@ -365,12 +514,16 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
* @param row 当前行数据
* @param currUserAgencyId 当前用户所属机构ID
* @param checkBoxOptionColumnIdxAndLabel 复选框options列表key:列号value复选框中文
* @return
* @param target 要将数据放到哪个对象中
*/
private LinkedHashMap<String, String> convertColumnWrappers2Map4Persist(Map<String, ColumnWrapper> headerColumnWrapper, Map<Integer, String> row,
String currUserAgencyId, Map<Integer, String> checkBoxOptionColumnIdxAndLabel) {
LinkedHashMap<String, String> columnAndValues = new LinkedHashMap<>();
private void convertColumnWrappers2Map4Persist(Map<String, ColumnWrapper> headerColumnWrapper, Map<Integer, String> row,
String currUserAgencyId, Map<Integer, String> checkBoxOptionColumnIdxAndLabel,
LinkedHashMap<String, String> target) {
boolean interupt = false;
List<String> errorColumnNames = new LinkedList<>();
for (Map.Entry<String, ColumnWrapper> columnWrapperEntry : headerColumnWrapper.entrySet()) {
ColumnWrapper columnWrapper = columnWrapperEntry.getValue();
@ -408,10 +561,19 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
String checkBoxColValue = getCheckBoxColValue(columnWrapper, row, checkBoxOptionColumnIdxAndLabel);
columnWrapper.setColValue(checkBoxColValue);
}
columnAndValues.put(columnWrapper.columnName, columnWrapper.colValue);
// requiredColumns中的值为必填项
if (columnWrapper.getRequired() == 1 && StringUtils.isBlank(columnWrapper.colValue)) {
interupt = true;
errorColumnNames.add(columnWrapper.combinedLabel);
}
target.put(columnWrapper.columnName, columnWrapper.colValue);
}
if (interupt) {
throw new RenException(String.join(",", errorColumnNames) + "的值未填写");
}
return columnAndValues;
}
/**
@ -517,6 +679,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
columnWrapper.setCombinedLabel(combinedLabel);
columnWrapper.setColumnName(item.getColumnName());
columnWrapper.setColIndexs(entry.getValue());
columnWrapper.setRequired(item.getRequired());
columnWrapper.setOptionSourceType(item.getOptionSourceType());
columnWrapper.setOptionSourceValue(item.getOptionSourceValue());
@ -714,5 +877,40 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
}*/
}
/**
* 更新主表中人员类别标记
* @param icResiUserTableEnum
* @param resiUserId
*/
private void updateMainTableResiTypeFlag(IcResiUserTableEnums icResiUserTableEnum, String resiUserId) {
HashMap<String, Boolean> map = new HashMap<>();
map.put(icResiUserTableEnum.getMainTableFlagColumnName(), true);
icResiUserDao.upTable("ic_resi_user", resiUserId, map);
}
/**
* 下载导入结果
* @param response
* @throws IOException
*/
public void downLoadResults(HttpServletResponse response) throws IOException {
//public static final ThreadLocal<Map<String, List<ErrorRow>>> errorRows = new ThreadLocal<>();
String fileName = "导入失败条目清单.xls";
response.setHeader("content-Type", "application/vnd.ms-excel");
response.addHeader("Content-Disposition", "attachment;fileName=" + URLEncoder.encode(fileName, "UTF-8"));
LinkedList<ErrorRow> list = new LinkedList<>();
for (Map.Entry<String, List<ErrorRow>> entry : errorRows.get().entrySet()) {
list.addAll(entry.getValue());
}
list.forEach(row -> row.setSheetName(IcResiUserTableEnums.getObjectByTableName(row.tableName).getTableComment()));
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("导入失败的条目列表","导入失败"),
ErrorRow.class, list);
workbook.write(response.getOutputStream());
}
}

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

@ -31,7 +31,9 @@ import com.epmet.commons.tools.enums.HouseTypeEnum;
import com.epmet.commons.tools.enums.RelationshipEnum;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
@ -493,7 +495,36 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
throw new RenException("查询房屋信息失败");
}
personData.setHouseInfo(listResult.getData());
// TODO
// 志愿者处理
if (personData.getIsVolunteer().equals(NumConstant.ONE_STR)){
List<String> volunteerList = baseDao.selectVolunteerByUserId(formDTO.getUserId());
if (!CollectionUtils.isEmpty(volunteerList)){
List<String> volunteers = new ArrayList<>();
List<String> finalVolunteers = volunteers;
volunteerList.forEach(v -> {
List<String> collect = Arrays.stream(v.split(",")).collect(Collectors.toList());
finalVolunteers.addAll(collect);
});
volunteers = volunteers.stream().distinct().collect(Collectors.toList());
// 去customize 查询志愿者类别
Result<List<String>> volunteerResult = operCustomizeOpenFeignClient.volunteerLabelByValues(volunteers, personData.getCustomerId());
if (!volunteerResult.success()){
throw new RenException("查询志愿者类别失败...");
}
personData.setVolunteerCategory(volunteerResult.getData());
}
}
// 网格名
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(personData.getGridId());
if (null != gridInfo){
personData.setGridName(gridInfo.getGridNamePath());
}
/**
* 人员类别
* 先查询customize配置的
* 再根据配置去查询字段
*/
return personData;
}
@ -526,7 +557,8 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
* desc:条件导出
*
*
* @param formItemMap
* @param formItemMap key 表名 value formItem
* @param resiMainList
* @param customerId
* @param formCode
* @param baseTableName
@ -534,11 +566,21 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
* @return
*/
@Override
public Map<String, Map<String, Object>> getDataForExport(Map<String, FormItem> formItemMap, String customerId, String formCode, String baseTableName, List<ResiUserQueryValueDTO> conditions) {
public Map<String, Map<String, Object>> getDataForExport(Map<String, FormItem> formItemMap, Map<String, Map<String, Object>> resiMainList, String customerId, String formCode, String baseTableName, List<ResiUserQueryValueDTO> conditions) {
List<Map<String, Object>> mapList = this.dynamicQuery(customerId, formCode, baseTableName, conditions);
Map<String, Map<String, Object>> result = new LinkedHashMap<>();
mapList.stream().filter(Objects::nonNull).forEach(map -> {
String resiId = (String) map.getOrDefault(UserConstant.IC_RESI_USER, "");
if ("ic_resi_user".equals(baseTableName)) {
resiId = (String) map.get("ID");
}
if (StringUtils.isBlank(resiId)){
log.error("getDataForExport error,resiId:{}",resiId);
return;
}
result.put(resiId, map);
for (Map.Entry<String, FormItem> e : formItemMap.entrySet()) {
String k = e.getKey();
FormItem v = e.getValue();
@ -546,8 +588,16 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
if (temp != null) {
if (v.getOptionSourceType().equals("remote")) {
try {
Map<String, IcResiUserImportServiceImpl.ColumnWrapper> columnWrappers = new HashMap<>();
if(v.getItemId().equals("1078")){
Map<String, Object> userMap = resiMainList.get(map.get(UserConstant.IC_RESI_USER));
Object gridId = userMap.get(UserConstant.GRID_ID);
IcResiUserImportServiceImpl.ColumnWrapper value = new IcResiUserImportServiceImpl.ColumnWrapper();
value.setColValue(gridId.toString());
columnWrappers.put("1001", value);
}
//todo 获取 options
Map<String, String> stringMap = icResiUserImportService.listRemoteOptions(new HashMap<>(), v.getOptionSourceValue(), null);
Map<String, String> stringMap = icResiUserImportService.listRemoteOptions(columnWrappers, v.getOptionSourceValue(), null);
if ("checkbox".equals(v.getItemType())) {
stringMap.forEach((label, value) -> map.put(value, temp.toString().contains(value) ? "是" : "否"));
} else if ("select".equals(v.getItemType())) {
@ -582,15 +632,8 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
}
}
}
if ("ic_resi_user".equals(baseTableName)) {
resiId = (String) map.get("ID");
}
if (StringUtils.isBlank(resiId)){
log.error("getDataForExport error,resiId:{}",resiId);
return;
}
result.put(resiId, map);
if (!"ic_resi_user".equals(baseTableName)) {
map.putAll(resiMainList.get(resiId));
return;
}
Object gridId = map.get(UserConstant.GRID_ID);
@ -599,7 +642,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
formDTO.setGridId(gridId.toString());
Result<CustomerGridDTO> gridInfoRes = govOrgOpenFeignClient.getGridBaseInfoByGridId(formDTO);
if (gridInfoRes != null && gridInfoRes.success() && gridInfoRes.getData() != null) {
map.put(UserConstant.GRID_ID, gridInfoRes.getData().getGridName());
map.put(UserConstant.GRID_NAME, gridInfoRes.getData().getGridName());
}
}
Object homeId = map.get(UserConstant.HOME_ID);
@ -658,4 +701,17 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
result.setUserList(userList);
return result;
}
/**
* @param buildId
* @Description 获取一栋楼每个房间人员分类的数量
* @Param buildId
* @Return {@link Map<String,Map<String,Integer>>}
* @Author zhaoqifeng
* @Date 2021/11/5 14:40
*/
@Override
public Map<String, Map<String, Integer>> getHomeUserCategoryCount(String buildId) {
return baseDao.getHomeUserCategoryCount(buildId);
}
}

104
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcStatsResiWarnServiceImpl.java

@ -0,0 +1,104 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.IcStatsResiWarnDao;
import com.epmet.dto.IcStatsResiWarnDTO;
import com.epmet.entity.IcStatsResiWarnEntity;
import com.epmet.redis.IcStatsResiWarnRedis;
import com.epmet.service.IcStatsResiWarnService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 预警统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-11-04
*/
@Service
public class IcStatsResiWarnServiceImpl extends BaseServiceImpl<IcStatsResiWarnDao, IcStatsResiWarnEntity> implements IcStatsResiWarnService {
@Autowired
private IcStatsResiWarnRedis icStatsResiWarnRedis;
@Override
public PageData<IcStatsResiWarnDTO> page(Map<String, Object> params) {
IPage<IcStatsResiWarnEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, IcStatsResiWarnDTO.class);
}
@Override
public List<IcStatsResiWarnDTO> list(Map<String, Object> params) {
List<IcStatsResiWarnEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, IcStatsResiWarnDTO.class);
}
private QueryWrapper<IcStatsResiWarnEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<IcStatsResiWarnEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public IcStatsResiWarnDTO get(String id) {
IcStatsResiWarnEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, IcStatsResiWarnDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(IcStatsResiWarnDTO dto) {
IcStatsResiWarnEntity entity = ConvertUtils.sourceToTarget(dto, IcStatsResiWarnEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(IcStatsResiWarnDTO dto) {
IcStatsResiWarnEntity entity = ConvertUtils.sourceToTarget(dto, IcStatsResiWarnEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}

210
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsResiWarnServiceImpl.java

@ -0,0 +1,210 @@
package com.epmet.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.IcStatsResiWarnDao;
import com.epmet.dto.IcResiCategoryStatsConfigDTO;
import com.epmet.dto.IcResiCategoryWarnConfigDTO;
import com.epmet.dto.result.BuildingResultDTO;
import com.epmet.dto.result.IcStatsResiResultDTO;
import com.epmet.dto.result.IcStatsResiWarnBuildingResultDTO;
import com.epmet.dto.result.IcStatsResiWarnUserResultDTO;
import com.epmet.entity.IcStatsResiWarnEntity;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.feign.OperCustomizeOpenFeignClient;
import com.epmet.service.IcStatsResiWarnService;
import com.epmet.service.StatsResiWarnService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors;
@Slf4j
@Service
public class StatsResiWarnServiceImpl implements StatsResiWarnService {
@Resource
private IcStatsResiWarnDao icStatsResiWarnDao;
@Autowired
private IcStatsResiWarnService icStatsResiWarnService;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired
private OperCustomizeOpenFeignClient operCustomizeOpenFeignClient;
@Override
public List<IcStatsResiWarnBuildingResultDTO> buildingwWarnList(String agencyID) {
List<IcStatsResiWarnBuildingResultDTO> result = new ArrayList<>();
//feign获取当前需要预警的配置信息以及阈值
Result<List<IcResiCategoryWarnConfigDTO>> warnResult = operCustomizeOpenFeignClient.resiCategoryWarnList();
if (!warnResult.success() || null == warnResult.getData()) {
throw new RenException("预警配置查询失败:"+ warnResult.getMsg());
}
List<IcResiCategoryWarnConfigDTO> icResiCategoryWarnConfigDTOList = warnResult.getData();
if(CollectionUtils.isEmpty(icResiCategoryWarnConfigDTOList )){
return result;
}
result = icResiCategoryWarnConfigDTOList.stream().map(item -> {
IcStatsResiWarnBuildingResultDTO resiWarnBuildingResultDTO = new IcStatsResiWarnBuildingResultDTO();
resiWarnBuildingResultDTO.setConfigId(item.getId());
resiWarnBuildingResultDTO.setLabel(item.getLabel());
resiWarnBuildingResultDTO.setLevel1(item.getLevel1());
resiWarnBuildingResultDTO.setLevel2(item.getLevel2());
resiWarnBuildingResultDTO.setLevel3(item.getLevel3());
resiWarnBuildingResultDTO.setSort(item.getSort());
resiWarnBuildingResultDTO.setLevelCount1(0);
resiWarnBuildingResultDTO.setLevelCount2(0);
resiWarnBuildingResultDTO.setLevelCount3(0);
resiWarnBuildingResultDTO.setBuildingIdList1(new ArrayList<>());
resiWarnBuildingResultDTO.setBuildingIdList2(new ArrayList<>());
resiWarnBuildingResultDTO.setBuildingIdList3(new ArrayList<>());
return resiWarnBuildingResultDTO;
}).collect(Collectors.toList());
//统计数量
List<IcStatsResiWarnEntity> icStatsResiWarnEntityList = icStatsResiWarnDao.selectResiWarnByAgencyId(agencyID);
if(CollectionUtils.isEmpty(icStatsResiWarnEntityList )){
return result;
}
Map<String,IcStatsResiWarnBuildingResultDTO> warnResultMap = result.stream().collect(Collectors.toMap(IcStatsResiWarnBuildingResultDTO::getConfigId, Function.identity(),(k1, k2)->k1));
for (IcStatsResiWarnEntity item : icStatsResiWarnEntityList) {
//每栋楼的数量
Integer count = Optional.ofNullable(item.getCount()).orElse(0);
IcStatsResiWarnBuildingResultDTO resiWarnBuildingResultDTO = warnResultMap.get(item.getConfigId());
//判断数量
Integer levle1= resiWarnBuildingResultDTO.getLevel1();
Integer levle2= resiWarnBuildingResultDTO.getLevel2();
Integer levle3= resiWarnBuildingResultDTO.getLevel3();
if(0 == count){
continue;
}
if(null!=levle1 && count>levle1){
resiWarnBuildingResultDTO.setLevelCount1(resiWarnBuildingResultDTO.getLevelCount1()+1);
resiWarnBuildingResultDTO.getBuildingIdList1().add(item.getBuildingId());
}
if(null!=levle1 && null!=levle2 && count<=levle1 && count>=levle2){
resiWarnBuildingResultDTO.setLevelCount2(resiWarnBuildingResultDTO.getLevelCount2()+1);
resiWarnBuildingResultDTO.getBuildingIdList2().add(item.getBuildingId());
}
if(null!=levle2 && null!=levle3 && count<=levle2 && count>=levle3){
resiWarnBuildingResultDTO.setLevelCount3(resiWarnBuildingResultDTO.getLevelCount3()+1);
resiWarnBuildingResultDTO.getBuildingIdList3().add(item.getBuildingId());
}
}
return result;
}
@Override
public List<IcStatsResiWarnUserResultDTO> userWarnList(String configId, List<String> buildingIdList) {
//feign根据buildingIdList 获取网格,小区,楼宇 信息
Result<List<BuildingResultDTO>> buildingList = govOrgOpenFeignClient.buildingListByIds(buildingIdList);
if (!buildingList.success() || null == buildingList.getData()) {
throw new RenException("楼宇信息查询失败,buildingList="+ JSON.toJSONString(buildingIdList));
}
List<BuildingResultDTO> buildingResultDTOList = buildingList.getData();
List<IcStatsResiWarnUserResultDTO> result = ConvertUtils.sourceToTarget(buildingResultDTOList,IcStatsResiWarnUserResultDTO.class);
if(CollectionUtils.isEmpty(result)){
return new ArrayList<>();
}
//获取configId预警配置信息
IcResiCategoryWarnConfigDTO formDto = new IcResiCategoryWarnConfigDTO();
formDto.setId(configId);
Result<IcResiCategoryWarnConfigDTO> warnResult = operCustomizeOpenFeignClient.resiCategoryWarnInfoById(formDto);
if (!warnResult.success() || null == warnResult.getData()) {
throw new RenException("获取预警配置信息失败,configId="+ configId);
}
IcResiCategoryWarnConfigDTO icResiCategoryWarnConfigDTO = warnResult.getData();
//根据buildingID,tableName he columnName获取名字
List<Map<String, String>> maps = icStatsResiWarnDao.userWarnList(buildingIdList, icResiCategoryWarnConfigDTO.getTableName(), icResiCategoryWarnConfigDTO.getColumnName());
result.forEach(item->{
item.setConfigId(configId);
List<Map<String, String>> buildingIds = maps.stream().filter(map -> item.getBuildingId().equals(map.get("buildingId"))).collect(Collectors.toList());
item.setResidentNames(CollectionUtils.isEmpty(buildingIds)?"":buildingIds.get(0).get("residentNames"));
});
return result;
}
@Override
public List<IcStatsResiResultDTO> list(String id, String level) {
//获取所有配置类项 getshow
Result<List<IcResiCategoryStatsConfigDTO>> statsResult = operCustomizeOpenFeignClient.resiCategoryStatsListShowd();
if (!statsResult.success() || null == statsResult.getData()) {
throw new RenException("获取配置类项失败");
}
List<IcResiCategoryStatsConfigDTO> icResiCategoryStatsConfigDTOList = statsResult.getData();
//获取tableName 和columnName
List<IcStatsResiResultDTO> result = new ArrayList<>();
icResiCategoryStatsConfigDTOList.forEach(item->{
IcStatsResiResultDTO resultDTO = new IcStatsResiResultDTO();
resultDTO.setId(item.getId());
resultDTO.setLabel(item.getLabel());
resultDTO.setDataIcon(item.getDataIcon());
resultDTO.setHouseShowIcon(item.getHouseShowIcon());
resultDTO.setManagementIcon(item.getManagementIcon());
//根据id ,level 获取count
Integer count = icStatsResiWarnDao.countListByLevelAndCol(item.getTableName(),item.getColumnName(),id,level);
resultDTO.setCount(count);
result.add(resultDTO);
});
return result;
}
/**
* 统计
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void resiWarn(String customerId) {
// 获取预警配置项
Result<List<IcResiCategoryWarnConfigDTO>> warnResult = operCustomizeOpenFeignClient.resiCategoryWarnList();
if (!warnResult.success() || null == warnResult.getData()) {
throw new RenException("预警配置查询失败:"+ warnResult.getMsg());
}
List<IcResiCategoryWarnConfigDTO> icResiCategoryWarnConfigDTOList = warnResult.getData();
//保存数据
List<IcStatsResiWarnEntity> icStatsResiWarnEntities = new ArrayList<>();
for (IcResiCategoryWarnConfigDTO item : icResiCategoryWarnConfigDTOList) {
icStatsResiWarnDao.delete(new QueryWrapper<IcStatsResiWarnEntity>().lambda().eq(IcStatsResiWarnEntity::getConfigId,item.getId()));
List<IcStatsResiWarnEntity> maps = icStatsResiWarnDao.resiWarn(item.getTableName(), item.getColumnName());
if(CollectionUtils.isEmpty(maps)){
continue;
}
maps.forEach(map->{
IcStatsResiWarnEntity icStatsResiWarnEntity = new IcStatsResiWarnEntity();
icStatsResiWarnEntity.setAgencyId(map.getAgencyId());
icStatsResiWarnEntity.setAgencyPids(map.getAgencyPids());
icStatsResiWarnEntity.setBuildingId(map.getBuildingId());
icStatsResiWarnEntity.setConfigId(item.getId());
icStatsResiWarnEntity.setCount(map.getCount());
icStatsResiWarnEntity.setCustomerId(customerId);
icStatsResiWarnEntity.setGridId(map.getGridId());
icStatsResiWarnEntity.setNeighborHoodId(map.getNeighborHoodId());
icStatsResiWarnEntities.add(icStatsResiWarnEntity);
});
}
icStatsResiWarnService.insertBatch(icStatsResiWarnEntities,500);
}
}

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

Binary file not shown.

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

@ -153,6 +153,10 @@
<resultMap id="selectPersonData" type="com.epmet.dto.result.PersonDataResultDTO">
<result column="GZDW" property="workUnit"/>
<result column="ID_CARD" property="idCard"/>
<result column="name" property="name"/>
<result column="isVolunteer" property="isVolunteer"/>
<result column="CUSTOMER_ID" property="customerId"/>
<result column="GRID_ID" property="gridId"/>
<collection property="financialSituation" ofType="com.epmet.dto.FinancialSituationDTO">
<result column="YSR" property="monthlyIncome"/>
<result column="TXJE" property="retirementAmount"/>
@ -160,11 +164,14 @@
</resultMap>
<select id="personData" resultMap="selectPersonData">
SELECT
GZDW AS workUnit,
GZDW,
name,
YSR,
TXJE,
ID_CARD
ID_CARD,
IFNULL(IS_VOLUNTEER,'0') AS isVolunteer,
CUSTOMER_ID,
GRID_ID
FROM ic_resi_user
WHERE DEL_FLAG = '0'
AND ID = #{userId}
@ -214,4 +221,35 @@
</foreach>
</if>
</select>
<select id="getHomeUserCategoryCount" resultType="java.util.Map">
SELECT
HOME_ID,
SUM(IF('1' = IS_PARTY, 1, 0)) AS IS_PARTY,
SUM(IF('1' = IS_DBH, 1, 0)) AS IS_DBH,
SUM(IF('1' = IS_ENSURE_HOUSE, 1, 0)) AS IS_ENSURE_HOUSE,
SUM(IF('1' = IS_UNEMPLOYED, 1, 0)) AS IS_UNEMPLOYED,
SUM(IF('1' = IS_YLFN, 1, 0)) AS IS_YLFN,
SUM(IF('1' = IS_VETERANS, 1, 0)) AS IS_VETERANS,
SUM(IF('1' = IS_UNITED_FRONT, 1, 0)) AS IS_UNITED_FRONT,
SUM(IF('1' = IS_XFRY, 1, 0)) AS IS_XFRY,
SUM(IF('1' = IS_VOLUNTEER, 1, 0)) AS IS_VOLUNTEER,
SUM(IF('1' = IS_OLD_PEOPLE, 1, 0)) AS IS_OLD_PEOPLE,
SUM(IF('1' = IS_KC, 1, 0)) AS IS_KC,
SUM(IF('1' = IS_SD, 1, 0)) AS IS_SD,
SUM(IF('1' = IS_SN, 1, 0)) AS IS_SN,
SUM(IF('1' = IS_SZ, 1, 0)) AS IS_SZ,
SUM(IF('1' = IS_CJ, 1, 0)) AS IS_CJ,
SUM(IF('1' = IS_DB, 1, 0)) AS IS_DB,
SUM(IF('1' = IS_MB, 1, 0)) AS IS_MB,
SUM(IF('1' = IS_SPECIAL, 1, 0)) AS IS_SPECIAL
FROM ic_resi_user
WHERE DEL_FLAG = 0
AND BUILD_ID = #{buildId}
GROUP BY HOME_ID
</select>
<!-- 根据userId查询志愿者 -->
<select id="selectVolunteerByUserId" resultType="java.lang.String">
SELECT VOLUNTEER_CATEGORY FROM ic_volunteer WHERE DEL_FLAG = '0' AND ic_resi_user = #{userId}
</select>
</mapper>

106
epmet-user/epmet-user-server/src/main/resources/mapper/IcStatsResiWarnDao.xml

@ -0,0 +1,106 @@
<?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.IcStatsResiWarnDao">
<resultMap type="com.epmet.entity.IcStatsResiWarnEntity" id="icStatsResiWarnMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="configId" column="CONFIG_ID"/>
<result property="gridId" column="GRID_ID"/>
<result property="agencyId" column="AGENCY_ID"/>
<result property="agencyPids" column="AGENCY_PIDS"/>
<result property="neighborHoodId" column="NEIGHBOR_HOOD_ID"/>
<result property="buildingId" column="BUILDING_ID"/>
<result property="count" column="COUNT"/>
<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>
<select id="selectResiWarnByAgencyId" resultType="com.epmet.entity.IcStatsResiWarnEntity">
select * from ic_stats_resi_warn
where
DEL_FLAG='0'
<if test="agencyId != null and agencyId.trim() != ''">
AND (AGENCY_ID = #{agencyId} or CONCAT(':',AGENCY_PIDS, ':') like CONCAT('%:',#{agencyId},':%'))
</if>
</select>
<select id="userWarnList" resultType="map">
select
BUILD_ID as buildingId,
GROUP_CONCAT(name) as residentNames
from ic_resi_user
where
BUILD_ID in
<foreach collection="buildingIdList" item="buildingId" open="(" separator="," close=" )">
#{buildingId}
</foreach>
<if test="tableName=='ic_resi_user'">
and ${columnName} = '1'
</if>
<if test="tableName!='ic_resi_user'">
and ID in (
select IC_RESI_USER from ${tableName} where ${columnName} = '1' and DEL_FLAG = '0'
)
</if>
and DEL_FLAG = '0'
group by BUILD_ID
</select>
<select id="countListByLevelAndCol" resultType="int">
select count(*)
from ic_resi_user
where 1=1
<if test="tableName=='ic_resi_user'">
and ${columnName} = '1'
</if>
<if test="tableName!='ic_resi_user'">
and ID in (
select IC_RESI_USER from ${tableName} where ${columnName} = '1' and DEL_FLAG = '0'
)
</if>
<if test="level=='agency'">
AND (AGENCY_ID = #{id} or CONCAT(':',PIDS, ':') like CONCAT('%:',#{id},':%'))
</if>
<if test="level=='grid'">
AND GRID_ID = #{id}
</if>
<if test="level=='neighborHood'">
AND VILLAGE_ID = #{id}
</if>
<if test="level=='building'">
AND BUILD_ID = #{id}
</if>
and DEL_FLAG = '0'
</select>
<select id="resiWarn" resultType="com.epmet.entity.IcStatsResiWarnEntity">
SELECT
AGENCY_ID as agencyId,
PIDS as agencyPids,
GRID_ID as gridId,
VILLAGE_ID as neighborHoodId,
BUILD_ID as buildingId,
count(*) as count
from ic_resi_user
where 1=1
<if test="tableName=='ic_resi_user'">
and ${columnName} = '1'
</if>
<if test="tableName!='ic_resi_user'">
and ID in (
select IC_RESI_USER from ${tableName} where ${columnName} = '1' and DEL_FLAG = '0'
)
</if>
and DEL_FLAG = '0'
group by AGENCY_ID,GRID_ID,VILLAGE_ID,BUILD_ID
</select>
</mapper>
Loading…
Cancel
Save