wangxianzhang 4 years ago
parent
commit
b2693c3813
  1. 17
      epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.12__up_sys_dict_data.sql
  2. 6
      epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.13__up_sys_dict_data.sql
  3. 10
      epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.14__up_del_sys_dict_data.sql
  4. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/OptionResultDTO.java
  5. 15
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/PartyUnitTypeEnum.java
  6. 4
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerIcHouseRedis.java
  7. 28
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/AgencyInfoCache.java
  8. 6
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/CustomerAgencyDTO.java
  9. 8
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java
  10. 1
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerAgencyDao.java
  11. 3
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java
  12. 79
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
  13. 5
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/AggreGridServiceImpl.java
  14. 2
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyUserRankDataDao.xml
  15. 2
      epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/AreaCodeDao.xml
  16. 5
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcCommunitySelfOrganizationDTO.java
  17. 4
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyActivityDTO.java
  18. 2
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/LatestActInfoDTO.java
  19. 5
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/AddCommunitySelfOrganizationFormDTO.java
  20. 2
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/CommunitySelfOrganizationListFormDTO.java
  21. 5
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/EditCommunitySelfOrganizationFormDTO.java
  22. 1
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/PartyActivityFormDTO.java
  23. 2
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/DraftActInfoFormDTO.java
  24. 2
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/PublishActInfoFormDTO.java
  25. 2
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/RePublishFormDTO.java
  26. 6
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/CommunitySelfOrganizationListDTO.java
  27. 3
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActDetailResultDTO.java
  28. 3
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ActPreviewResultDTO.java
  29. 2
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledActDetailResultDTO.java
  30. 3
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/FinishedActDetailResultDTO.java
  31. 3
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/InProgressActDetailResultDTO.java
  32. 1
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/LatestDraftActInfoResultDTO.java
  33. 3
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ReEditActInfoResultDTO.java
  34. 5
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcCommunitySelfOrganizationEntity.java
  35. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcPartyActivityEntity.java
  36. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActInfoEntity.java
  37. 3
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/ExportCommunitySelfOrganizationExcel.java
  38. 3
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/ImportCommunitySelfOrganization.java
  39. 10
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java
  40. 28
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java
  41. 57
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActDraftServiceImpl.java
  42. 35
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java
  43. 1
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.13__add_column_remark.sql
  44. 4
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.14__activity_add_grid.sql
  45. 7
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcCommunitySelfOrganizationDao.xml
  46. 6
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyActivityDao.xml
  47. 1
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActInfoDao.xml
  48. BIN
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/templates/self_org_import_template.xlsx
  49. 2
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/ImportGeneralDTO.java
  50. 29
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcBuildingListFormDTO.java
  51. 4
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcBulidingAddFormDTO.java
  52. 6
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcHouseAddFormDTO.java
  53. 69
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcHouseListFormDTO.java
  54. 2
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcNeighborHoodAddFormDTO.java
  55. 63
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcNeighborHoodListFormDTO.java
  56. 85
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ListIcNeighborHoodFormDTO.java
  57. 17
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseResultDTO.java
  58. 20
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HousesNameResultDTO.java
  59. 35
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcBuildingListResultDTO.java
  60. 85
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcHouseListResultDTO.java
  61. 37
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcNeighborHoodResultDTO.java
  62. 8
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/enums/HouseRentFlagEnums.java
  63. 9
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java
  64. 5
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java
  65. 3
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/ImportErrorMsgConstants.java
  66. 89
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/BuildingController.java
  67. 178
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java
  68. 52
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcBuildingController.java
  69. 52
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcHouseController.java
  70. 4
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcNeighborHoodController.java
  71. 149
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/NeighborHoodController.java
  72. 17
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingDao.java
  73. 35
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java
  74. 10
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcNeighborHoodDao.java
  75. 147
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/IcHouseExcel.java
  76. 3
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/BuildingErrorInfoModel.java
  77. 4
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/BuildingInfoModel.java
  78. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/HouseErrorInfoModel.java
  79. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/HouseInfoModel.java
  80. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportBuildingInfoListener.java
  81. 7
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportHouseInfoListener.java
  82. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportNeighborHoodInfoListener.java
  83. 3
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/NeighborHoodErrorInfoModel.java
  84. 4
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/NeighborHoodInfoModel.java
  85. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/redis/CustomerAgencyRedis.java
  86. 5
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/redis/IcHouseRedis.java
  87. 20
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/BuildingService.java
  88. 29
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java
  89. 9
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcHouseService.java
  90. 4
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcNeighborHoodService.java
  91. 22
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/NeighborHoodService.java
  92. 50
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
  93. 363
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java
  94. 216
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java
  95. 16
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java
  96. 4
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java
  97. 211
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/NeighborHoodServiceImpl.java
  98. 2
      epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.15__alter_ic_house.sql
  99. 3
      epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.16__add_index_ic_house.sql
  100. BIN
      epmet-module/gov-org/gov-org-server/src/main/resources/excel/house_export.xlsx

17
epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.12__up_sys_dict_data.sql

@ -0,0 +1,17 @@
UPDATE `epmet_admin`.`sys_dict_data` SET `id` = '1000000000000000220', `dict_label` = '区域化党建单位--楼宇党建'
WHERE (`id` = '1000000000000000200');
UPDATE `epmet_admin`.`sys_dict_data` SET `id` = '1000000000000000221', `dict_label` = '区域化党建单位--两新组织'
WHERE (`id` = '1000000000000000201');
UPDATE `epmet_admin`.`sys_dict_data` SET `id` = '1000000000000000222', `dict_label` = '区域化党建单位--区域单位党建'
WHERE (`id` = '1000000000000000202');
UPDATE `epmet_admin`.`sys_dict_data` SET `id` = '1000000000000000223', `dict_label` = '区域化党建单位--机关直属部门'
WHERE (`id` = '1000000000000000203');
UPDATE `epmet_admin`.`sys_dict_data` SET `id` = '1000000000000000224', `dict_label` = '区域化党建单位--其他'
WHERE (`id` = '1000000000000000204');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1000000000000000225', '1000000000000000007', '社会组织--社会团体', '5', '0', '', '5', '0', '0', '', '2022-04-12 14:39:18', '', '2022-04-12 14:39:18');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1000000000000000226', '1000000000000000007', '社会组织--民办非企业单位', '6', '0', '', '6', '0', '0', '', '2022-04-12 14:39:18', '', '2022-04-12 14:39:18');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1000000000000000227', '1000000000000000007', '社会组织--基金会', '7', '0', '', '7', '0', '0', '', '2022-04-12 14:39:18', '', '2022-04-12 14:39:18');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1000000000000000228', '1000000000000000007', '社会组织--其他', '8', '0', '', '8', '0', '0', '', '2022-04-12 14:39:18', '', '2022-04-12 14:39:18');

6
epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.13__up_sys_dict_data.sql

@ -0,0 +1,6 @@
update sys_dict_data set dict_label='联建单位'
where dict_value='party_unit'
and DEL_FLAG='0'
and dict_type_id=(
select st.id from sys_dict_type st where st.dict_type='user_demand_service_type' and st.DEL_FLAG='0'
);

10
epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.14__up_del_sys_dict_data.sql

@ -0,0 +1,10 @@
UPDATE `epmet_admin`.`sys_dict_data` SET `dict_label`='楼宇党建' WHERE (`id`='1000000000000000220');
UPDATE `epmet_admin`.`sys_dict_data` SET `dict_label`='两新组织' WHERE (`id`='1000000000000000221');
UPDATE `epmet_admin`.`sys_dict_data` SET `dict_label`='区域单位党建' WHERE (`id`='1000000000000000222');
UPDATE `epmet_admin`.`sys_dict_data` SET `dict_label`='机关直属部门' WHERE (`id`='1000000000000000223');
UPDATE `epmet_admin`.`sys_dict_data` SET `dict_label`='社会团体' WHERE (`id`='1000000000000000224');
UPDATE `epmet_admin`.`sys_dict_data` SET `dict_label`='民办非企业单位' WHERE (`id`='1000000000000000225');
UPDATE `epmet_admin`.`sys_dict_data` SET `dict_label`='基金会' WHERE (`id`='1000000000000000226');
UPDATE `epmet_admin`.`sys_dict_data` SET `dict_label`='其他' WHERE (`id`='1000000000000000227');
DELETE FROM `epmet_admin`.`sys_dict_data` WHERE id = '1000000000000000228';

1
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/OptionResultDTO.java

@ -20,4 +20,5 @@ public class OptionResultDTO implements Serializable {
private String sysDictDataId;
private List<OptionResultDTO> children;
private Boolean usableFlag;
private String type;
}

15
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/PartyUnitTypeEnum.java

@ -7,11 +7,16 @@ import com.epmet.commons.tools.exception.EpmetErrorCode;
*/
public enum PartyUnitTypeEnum {
//房屋类型,1楼房,2平房,3别墅
LOUYU("0", "楼宇党建"),
ZUZHI("1", "两新组织"),
DANWEI("2", "区域单位党建"),
JIGUAN("3", "机关直属部门"),
QITA("4", "其他");
LOUYU("0", "区域化党建单位--楼宇党建"),
ZUZHI("1", "区域化党建单位--两新组织"),
DANWEI("2", "区域化党建单位--区域单位党建"),
JIGUAN("3", "区域化党建单位--机关直属部门"),
QITA("4", "区域化党建单位--其他"),
SHZZ_SHTT("5", "社会组织--社会团体"),
SHZZ_MBFQYDW("6", "社会组织--民办非企业单位"),
SHZZ_JJH("7", "社会组织--基金会"),
SHZZ_QT("8", "社会组织--其他");
private String code;
private String name;

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

@ -62,4 +62,8 @@ public class CustomerIcHouseRedis {
return buildInfoResult.getData();
}
public static void delBuildingInfo(String buildingId){
String key = RedisKeys.getBuildingInfoKey(buildingId);
customerIcHouseRedis.redisUtils.delete(key);
}
}

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

@ -4,6 +4,7 @@ import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @Author zxc
@ -59,6 +60,11 @@ public class AgencyInfoCache implements Serializable {
*/
private String areaCode;
/**
* 地区编码全路径例如37,3702,370203,370203005,370203005015
*/
private List<String> areaCodePath;
/**
* 删除标识
*/
@ -139,4 +145,26 @@ public class AgencyInfoCache implements Serializable {
* 中心位置纬度
*/
private String latitude;
/**
* 组织编码
*/
private String code;
/**
* 负责人姓名
*/
private String contacts;
/**
* 联系电话
*/
private String mobile;
//内部接口使用
/**
* open:当前客户新增组织需要选择areaCodeclosed: 无需选择区域编码
*/
private String areaCodeSwitch;
}

6
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/CustomerAgencyDTO.java

@ -21,6 +21,7 @@ import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
@ -172,4 +173,9 @@ public class CustomerAgencyDTO implements Serializable {
* 联系电话
*/
private String mobile;
/**
* 地区编码全路径例如37,3702,370203,370203005,370203005015
*/
private List<String> areaCodePath;
}

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

@ -21,10 +21,10 @@ import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dataaggre.beans.GridMemberDataAnalysisExcelExportBean;
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.enums.GridMemberDataAnalysisEnums;
import com.epmet.dataaggre.service.AggreGridService;
import com.epmet.dataaggre.service.govorg.GovOrgService;
@ -242,8 +242,8 @@ public class GovOrgController {
* @date 2021/11/5 2:54 下午
*/
@PostMapping("agency")
public Result<CustomerAgencyEntity> getAgencyInfo(@RequestParam("agencyId")String agencyId){
return new Result<CustomerAgencyEntity>().ok(govOrgService.getAgencyInfo(agencyId));
public Result<CustomerAgencyDTO> getAgencyInfo(@RequestParam("agencyId")String agencyId){
return new Result<CustomerAgencyDTO>().ok(govOrgService.getAgencyInfo(agencyId));
}
/**
@ -305,7 +305,7 @@ public class GovOrgController {
CustomerGridDTO gridInfo = govOrgService.getGridInfo(orgId);
Optional.ofNullable(gridInfo).ifPresent((g) -> orgName.set(g.getGridName()));
} else if ("agency".equals(orgType)) {
CustomerAgencyEntity agencyInfo = govOrgService.getAgencyInfo(orgId);
CustomerAgencyDTO agencyInfo = govOrgService.getAgencyInfo(orgId);
Optional.ofNullable(agencyInfo).ifPresent((a) -> orgName.set(a.getOrganizationName()));
}

1
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerAgencyDao.java

@ -105,4 +105,5 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
* @author sun
*/
LinkedList<GridLivelyResultDTO> subAgencyListAndGridSumNum(@Param("agencyId") String agencyId);
}

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

@ -8,7 +8,6 @@ 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.dto.resigroup.result.OrgInfoCommonDTO;
import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
@ -162,7 +161,7 @@ public interface GovOrgService {
* @author zxc
* @date 2021/11/5 2:54 下午
*/
CustomerAgencyEntity getAgencyInfo(String agencyId);
CustomerAgencyDTO getAgencyInfo(String agencyId);
/**
* @Description 查询网格信息

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

@ -6,6 +6,7 @@ import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import com.alibaba.fastjson.JSON;
import com.dingtalk.api.request.OapiRobotSendRequest;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.constant.DingDingRobotConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
@ -23,6 +24,7 @@ import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.redis.common.bean.BuildingInfoCache;
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.HttpClientManager;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dataaggre.constant.DataSourceConstant;
@ -250,41 +252,6 @@ public class GovOrgServiceImpl implements GovOrgService {
return result;
}
public static void main(String[] args) {
List<NextAreaCodeResultDTO> allList = new ArrayList<>();
NextAreaCodeResultDTO m1 = new NextAreaCodeResultDTO();
m1.setAreaCode("1");
m1.setAreaName("a");
allList.add(m1);
NextAreaCodeResultDTO m2 = new NextAreaCodeResultDTO();
m2.setAreaCode("2");
m2.setAreaName("b");
allList.add(m2);
NextAreaCodeResultDTO m3 = new NextAreaCodeResultDTO();
m3.setAreaCode("3");
m3.setAreaName("c");
allList.add(m3);
List<String> stringList = new ArrayList<>();
stringList.add("1");
stringList.add("2");
Iterator<NextAreaCodeResultDTO> iterator = allList.iterator();
while (iterator.hasNext()) {
NextAreaCodeResultDTO next = iterator.next();
for (String usedAreaCode : stringList) {
if (next.getAreaCode().equals(usedAreaCode)) {
iterator.remove();
}
}
}
System.out.println(JSON.toJSONString(allList, true));
}
/**
* @param staffId
* @Author sun
@ -642,8 +609,46 @@ public class GovOrgServiceImpl implements GovOrgService {
* @date 2021/11/5 2:54 下午
*/
@Override
public CustomerAgencyEntity getAgencyInfo(String agencyId) {
return customerAgencyDao.selectById(agencyId);
public CustomerAgencyDTO getAgencyInfo(String agencyId) {
CustomerAgencyEntity customerAgencyEntity=customerAgencyDao.selectById(agencyId);
CustomerAgencyDTO res= ConvertUtils.sourceToTarget(customerAgencyEntity,CustomerAgencyDTO.class);
//设置行政地区编码全路径
if (StringUtils.isNotBlank(res.getAreaCode()) && StringUtils.isNotBlank(res.getParentAreaCode())) {
res.setAreaCodePath(queryAreaCodePath(res));
}
return res;
}
private List<String> queryAreaCodePath(CustomerAgencyDTO customerAgencyEntity) {
List<String> areaCodePath = new ArrayList<>();
switch (customerAgencyEntity.getLevel()) {
case Constant.COMMUNITY:
areaCodePath.add(customerAgencyEntity.getAreaCode().substring(NumConstant.ZERO, NumConstant.TWO));
areaCodePath.add(customerAgencyEntity.getAreaCode().substring(NumConstant.ZERO, NumConstant.FOUR));
areaCodePath.add(customerAgencyEntity.getAreaCode().substring(NumConstant.ZERO, NumConstant.SIX));
areaCodePath.add(customerAgencyEntity.getParentAreaCode());
areaCodePath.add(customerAgencyEntity.getAreaCode());
break;
case Constant.STREET:
areaCodePath.add(customerAgencyEntity.getAreaCode().substring(NumConstant.ZERO, NumConstant.TWO));
areaCodePath.add(customerAgencyEntity.getAreaCode().substring(NumConstant.ZERO, NumConstant.FOUR));
areaCodePath.add(customerAgencyEntity.getParentAreaCode());
areaCodePath.add(customerAgencyEntity.getAreaCode());
break;
case Constant.DISTRICT:
areaCodePath.add(customerAgencyEntity.getAreaCode().substring(NumConstant.ZERO, NumConstant.TWO));
areaCodePath.add(customerAgencyEntity.getParentAreaCode());
areaCodePath.add(customerAgencyEntity.getAreaCode());
break;
case Constant.CITY:
areaCodePath.add(customerAgencyEntity.getParentAreaCode());
areaCodePath.add(customerAgencyEntity.getAreaCode());
break;
case Constant.PROVINCE:
areaCodePath.add(customerAgencyEntity.getAreaCode());
break;
}
return areaCodePath;
}
/**

5
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/AggreGridServiceImpl.java

@ -8,10 +8,10 @@ import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.dataaggre.dto.epmetuser.result.StaffPatrolRecordDailyResultDTO;
import com.epmet.dataaggre.dto.govorg.CustomerAgencyDTO;
import com.epmet.dataaggre.dto.govorg.CustomerGridDTO;
import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO;
import com.epmet.dataaggre.entity.epmetuser.CustomerStaffEntity;
import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity;
import com.epmet.dataaggre.service.AggreGridService;
import com.epmet.dataaggre.service.datastats.DataStatsService;
import com.epmet.dataaggre.service.epmetuser.EpmetUserService;
@ -22,7 +22,6 @@ import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import sun.rmi.runtime.Log;
import java.util.*;
@ -173,7 +172,7 @@ public class AggreGridServiceImpl implements AggreGridService {
* @return
*/
private String getPidsByAgencyId(String agencyId) {
CustomerAgencyEntity agencyInfo = govOrgService.getAgencyInfo(agencyId);
CustomerAgencyDTO agencyInfo = govOrgService.getAgencyInfo(agencyId);
if (agencyInfo == null) {
String errorMsg = "【网格员数据统计查询pcwork】查询组织信息返回为null";

2
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyUserRankDataDao.xml

@ -163,6 +163,7 @@
WHERE
u.del_flag = '0'
AND PARTY_FLAG = 0
AND u.point_total > 0 <!-- 初心互助中公益达人,0分人员不显示在榜单上 -->
<if test="orgType != null and orgType !=''">
<if test="orgType == 'agency'">
AND u.all_parent_ids LIKE CONCAT('%',#{orgId},'%')
@ -207,6 +208,7 @@
WHERE
u.del_flag = '0'
AND party_flag = '1'<!-- 是否是党员标志:1是。0不是党员 -->
and u.point_total > 0 <!-- 初心互助中党员先锋排行,0分人员不显示在榜单上 -->
<if test="orgType != null and orgType !=''">
<if test="orgType == 'agency'">
AND u.all_parent_ids LIKE CONCAT('%',#{orgId},'%')

2
epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/AreaCodeDao.xml

@ -84,7 +84,6 @@
area_code_child ac
WHERE
ac.DEL_FLAG = '0'
AND ac.USER_DEFINED = '0'
<if test='null != pCode and "" != pCode'>
AND ac.p_code=#{pCode}
</if>
@ -101,7 +100,6 @@
area_code_child ac
WHERE
ac.DEL_FLAG = '0'
AND ac.USER_DEFINED = '0'
<if test='null != pCode and "" != pCode'>
AND ac.p_code=#{pCode}
</if>

5
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcCommunitySelfOrganizationDTO.java

@ -133,4 +133,9 @@ public class IcCommunitySelfOrganizationDTO implements Serializable {
*/
private Date updatedTime;
/**
* 备注
*/
private String remark;
}

4
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyActivityDTO.java

@ -57,7 +57,8 @@ public class IcPartyActivityDTO implements Serializable {
*/
@JsonIgnore
private String agencyId;
private String gridId;
private String gridName;
/**
* 组织的所有上级
*/
@ -67,7 +68,6 @@ public class IcPartyActivityDTO implements Serializable {
/**
* act_info表ID
*/
@JsonIgnore
private String actId;
private String unitId;

2
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/LatestActInfoDTO.java

@ -43,7 +43,7 @@ public class LatestActInfoDTO implements Serializable {
* 客户id
*/
private String customerId;
private String gridId;
/**
* 活动标题
*/

5
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/AddCommunitySelfOrganizationFormDTO.java

@ -56,6 +56,11 @@ public class AddCommunitySelfOrganizationFormDTO implements Serializable {
*/
private String organizationCreatedTime;
/**
* 备注
*/
private String remark;
/**
* 经度
*/

2
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/CommunitySelfOrganizationListFormDTO.java

@ -46,4 +46,6 @@ public class CommunitySelfOrganizationListFormDTO implements Serializable {
private String customerId;
private String agencyId;
private Integer ranking;
private String remark;
}

5
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/EditCommunitySelfOrganizationFormDTO.java

@ -68,6 +68,11 @@ public class EditCommunitySelfOrganizationFormDTO implements Serializable {
*/
private String latitude;
/**
* 备注
*/
private String remark;
/**
* 社区自组织ID
*/

1
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/PartyActivityFormDTO.java

@ -19,6 +19,7 @@ public class PartyActivityFormDTO implements Serializable {
private static final long serialVersionUID = -2510068555703677L;
@NotBlank(message = "组织Id不能为空" )
private String agencyId;
private String gridId;
private String unitId;
private String title;
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")

2
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/DraftActInfoFormDTO.java

@ -28,7 +28,7 @@ public class DraftActInfoFormDTO implements Serializable {
* 活动草稿id,如果是编辑之前的活动草稿此列是有值的
*/
private String actDraftId;
private String gridId;
/**
* 如果是重新发布活动此列是有值的

2
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/PublishActInfoFormDTO.java

@ -36,7 +36,7 @@ public class PublishActInfoFormDTO implements Serializable {
* 活动草稿id,如果是编辑之前的活动草稿此列是有值的
*/
private String actDraftId;
private String gridId;
/**
* 客户id
*/

2
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/RePublishFormDTO.java

@ -36,6 +36,8 @@ public class RePublishFormDTO implements Serializable {
*/
private String actDraftId;
private String gridId;
/**
* 活动id
*/

6
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/CommunitySelfOrganizationListDTO.java

@ -53,6 +53,11 @@ public class CommunitySelfOrganizationListDTO implements Serializable {
*/
private String organizationCreatedTime;
/**
* 备注
*/
private String remark;
/**
* 经度
*/
@ -87,6 +92,7 @@ public class CommunitySelfOrganizationListDTO implements Serializable {
this.longitude = "";
this.latitude = "";
this.orgId = "";
this.remark = "";
this.score = NumConstant.ZERO;
this.organizationPersonnel = new ArrayList<>();
}

3
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActDetailResultDTO.java

@ -181,6 +181,9 @@ public class ResiActDetailResultDTO implements Serializable {
*/
private String actType;
private String gridId;
private String gridName;
/**
* 联建单位
*/

3
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ActPreviewResultDTO.java

@ -101,6 +101,9 @@ public class ActPreviewResultDTO implements Serializable {
*/
private String actType;
private String gridId;
private String gridName;
/**
* 联建单位
*/

2
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledActDetailResultDTO.java

@ -153,6 +153,8 @@ public class CanceledActDetailResultDTO implements Serializable {
*/
private String actType;
private String gridId;
private String gridName;
/**
* 联建单位
*/

3
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/FinishedActDetailResultDTO.java

@ -142,6 +142,9 @@ public class FinishedActDetailResultDTO implements Serializable {
*/
private String actType;
private String gridId;
private String gridName;
/**
* 联建单位
*/

3
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/InProgressActDetailResultDTO.java

@ -137,6 +137,9 @@ public class InProgressActDetailResultDTO implements Serializable {
*/
private String actType;
private String gridId;
private String gridName;
/**
* 联建单位
*/

1
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/LatestDraftActInfoResultDTO.java

@ -21,6 +21,7 @@ public class LatestDraftActInfoResultDTO implements Serializable {
* 活动草稿id
*/
private String actDraftId;
private String gridId;
/**
* 客户id
*/

3
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ReEditActInfoResultDTO.java

@ -154,6 +154,9 @@ public class ReEditActInfoResultDTO implements Serializable {
*/
private String actType;
private String gridId;
private String gridName;
/**
* 联建单位
*/

5
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcCommunitySelfOrganizationEntity.java

@ -106,4 +106,9 @@ public class IcCommunitySelfOrganizationEntity extends BaseEpmetEntity {
*/
private String latitude;
/**
* 备注
*/
private String remark;
}

2
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcPartyActivityEntity.java

@ -47,7 +47,7 @@ public class IcPartyActivityEntity extends BaseEpmetEntity {
* 组织ID
*/
private String agencyId;
private String gridId;
/**
* 组织的所有上级
*/

2
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActInfoEntity.java

@ -43,7 +43,7 @@ public class LatestActInfoEntity extends BaseEpmetEntity {
* 客户id
*/
private String customerId;
private String gridId;
/**
* 活动标题
*/

3
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/ExportCommunitySelfOrganizationExcel.java

@ -31,6 +31,9 @@ public class ExportCommunitySelfOrganizationExcel {
@Excel(name = "创建时间", width = 20, needMerge = true)
private String organizationCreatedTime;
@Excel(name = "备注", width = 60, needMerge = true)
private String remark;
@ExcelCollection(name = "组织成员")
private List<ImportCommunitySelfOrganizationSon> organizationPersonnel;

3
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/ImportCommunitySelfOrganization.java

@ -40,6 +40,9 @@ public class ImportCommunitySelfOrganization extends ExcelVerifyInfo {
@Excel(name = "创建时间", needMerge = true)
private String organizationCreatedTime;
@Excel(name = "备注", needMerge = true)
private String remark;
@ExcelCollection(name = "组织成员")
private List<ImportCommunitySelfOrganizationSon> persons;

10
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java

@ -25,6 +25,8 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
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.bean.GridInfoCache;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
@ -279,6 +281,14 @@ public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntit
List<String> unitNames = unitIds.stream().map(option::get).collect(Collectors.toList());
detailResultDTO.setUnitIdList(unitIds);
detailResultDTO.setUnitNameList(unitNames);
if (StringUtils.isNotEmpty(dto.getGridId())) {
detailResultDTO.setGridId(dto.getGridId());
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(dto.getGridId());
if (null != gridInfo) {
detailResultDTO.setGridName(gridInfo.getGridName());
}
}
}
}
return new Result<ResiActDetailResultDTO>().ok(detailResultDTO);

28
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java

@ -28,7 +28,9 @@ import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
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.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.DateUtils;
@ -123,6 +125,12 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl<IcPartyActivityD
List<String> unitIds = Arrays.asList(dto.getUnitId().split(StrConstant.COMMA));
List<String> unitNames = unitIds.stream().map(option::get).collect(Collectors.toList());
dto.setUnitName(StringUtils.join(unitNames, StrConstant.COMMA));
if (StringUtils.isNotEmpty(dto.getGridId())) {
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(dto.getGridId());
if (null != gridInfo) {
dto.setGridName(gridInfo.getGridName());
}
}
});
}
@ -150,6 +158,12 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl<IcPartyActivityD
List<String> unitIds = Arrays.asList(dto.getUnitId().split(StrConstant.COMMA));
List<String> unitNames = unitIds.stream().map(option::get).collect(Collectors.toList());
dto.setUnitName(StringUtils.join(unitNames, StrConstant.COMMA));
if (StringUtils.isNotEmpty(dto.getGridId())) {
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(dto.getGridId());
if (null != gridInfo) {
dto.setGridName(gridInfo.getGridName());
}
}
});
}
@ -171,6 +185,12 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl<IcPartyActivityD
List<String> serviceNames = services.stream().map(categoryMap::get).collect(Collectors.toList());
dto.setServiceMatterList(services);
dto.setServiceMatterNameList(serviceNames);
if (StringUtils.isNotEmpty(dto.getGridId())) {
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(dto.getGridId());
if (null != gridInfo) {
dto.setGridName(gridInfo.getGridName());
}
}
//获取单位
//获取组织下联建单位
@ -547,6 +567,14 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl<IcPartyActivityD
List<String> services = Arrays.asList(dto.getServiceMatter().split(StrConstant.COMMA));
List<String> serviceNames = services.stream().map(categoryMap::get).collect(Collectors.toList());
dto.setServiceMatterName(StringUtils.join(serviceNames, StrConstant.SEMICOLON));
if (StringUtils.isNotEmpty(dto.getGridId())) {
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(dto.getGridId());
if (null != gridInfo) {
dto.setGridName(gridInfo.getGridName());
}
}
});
}
PageInfo<IcPartyActivityDTO> pageInfo = new PageInfo<>(dtoList);

57
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActDraftServiceImpl.java

@ -2,6 +2,8 @@ package com.epmet.service.impl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.ActConstant;
@ -16,6 +18,7 @@ import com.epmet.dto.result.work.*;
import com.epmet.entity.LatestActServiceRelationEntity;
import com.epmet.entity.LatestActUnitRelationEntity;
import com.epmet.service.*;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -131,29 +134,32 @@ public class WorkActDraftServiceImpl implements WorkActDraftService {
//保存活动与服务关系
latestActServiceRelationService.deleteByAct(actDraftId);
AtomicInteger i = new AtomicInteger(NumConstant.ONE);
List<LatestActServiceRelationEntity> serviceList = formDTO.getServiceMatterList().stream().map(service -> {
LatestActServiceRelationEntity entity = new LatestActServiceRelationEntity();
entity.setCustomerId(formDTO.getCustomerId());
entity.setActId(actDraftId);
entity.setServiceMatter(service);
entity.setSort(i.getAndIncrement());
return entity;
}).collect(Collectors.toList());
latestActServiceRelationService.insertBatch(serviceList);
if (CollectionUtils.isNotEmpty(formDTO.getServiceMatterList())) {
AtomicInteger i = new AtomicInteger(NumConstant.ONE);
List<LatestActServiceRelationEntity> serviceList = formDTO.getServiceMatterList().stream().map(service -> {
LatestActServiceRelationEntity entity = new LatestActServiceRelationEntity();
entity.setCustomerId(formDTO.getCustomerId());
entity.setActId(actDraftId);
entity.setServiceMatter(service);
entity.setSort(i.getAndIncrement());
return entity;
}).collect(Collectors.toList());
latestActServiceRelationService.insertBatch(serviceList);
}
//保存活动与单位关系
latestActUnitRelationService.deleteByAct(actDraftId);
AtomicInteger j = new AtomicInteger(NumConstant.ONE);
List<LatestActUnitRelationEntity> unitList = formDTO.getUnitIdList().stream().map(unitId -> {
LatestActUnitRelationEntity entity = new LatestActUnitRelationEntity();
entity.setCustomerId(formDTO.getCustomerId());
entity.setActId(actDraftId);
entity.setUnitId(unitId);
entity.setSort(j.getAndIncrement());
return entity;
}).collect(Collectors.toList());
latestActUnitRelationService.insertBatch(unitList);
if (CollectionUtils.isNotEmpty(formDTO.getServiceMatterList())) {
AtomicInteger j = new AtomicInteger(NumConstant.ONE);
List<LatestActUnitRelationEntity> unitList = formDTO.getUnitIdList().stream().map(unitId -> {
LatestActUnitRelationEntity entity = new LatestActUnitRelationEntity();
entity.setCustomerId(formDTO.getCustomerId());
entity.setActId(actDraftId);
entity.setUnitId(unitId);
entity.setSort(j.getAndIncrement());
return entity;
}).collect(Collectors.toList());
latestActUnitRelationService.insertBatch(unitList);
}
return resultDTO;
}
@ -201,6 +207,13 @@ public class WorkActDraftServiceImpl implements WorkActDraftService {
List<String> unitNames = unitIds.stream().map(option::get).collect(Collectors.toList());
actPreviewResultDTO.setUnitIdList(unitIds);
actPreviewResultDTO.setUnitNameList(unitNames);
if (StringUtils.isNotEmpty(actPreviewResultDTO.getGridId())) {
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(actPreviewResultDTO.getGridId());
if (null != gridInfo) {
actPreviewResultDTO.setGridName(gridInfo.getGridName());
}
}
}
}
return actPreviewResultDTO;
@ -337,7 +350,7 @@ public class WorkActDraftServiceImpl implements WorkActDraftService {
latestActInfoDTO.setActType(formDTO.getActType());
latestActInfoDTO.setTarget(formDTO.getTarget());
latestActInfoDTO.setGridId(formDTO.getGridId());
return latestActInfoDTO;
}

35
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java

@ -9,6 +9,8 @@ import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.form.mq.eventmsg.BasePointEventMsg;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.scan.param.ImgScanParamDTO;
import com.epmet.commons.tools.scan.param.ImgTaskDTO;
import com.epmet.commons.tools.scan.param.TextScanParamDTO;
@ -832,6 +834,14 @@ public class WorkActServiceImpl implements WorkActService {
List<String> unitNames = unitIds.stream().map(option::get).collect(Collectors.toList());
canceledActDetailResultDTO.setUnitIdList(unitIds);
canceledActDetailResultDTO.setUnitNameList(unitNames);
if (StringUtils.isNotEmpty(dto.getGridId())) {
canceledActDetailResultDTO.setGridId(dto.getGridId());
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(dto.getGridId());
if (null != gridInfo) {
canceledActDetailResultDTO.setGridName(gridInfo.getGridName());
}
}
}
}
}
@ -897,6 +907,14 @@ public class WorkActServiceImpl implements WorkActService {
List<String> unitNames = unitIds.stream().map(option::get).collect(Collectors.toList());
resultDTO.setUnitIdList(unitIds);
resultDTO.setUnitNameList(unitNames);
if (StringUtils.isNotEmpty(dto.getGridId())) {
resultDTO.setGridId(dto.getGridId());
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(dto.getGridId());
if (null != gridInfo) {
resultDTO.setGridName(gridInfo.getGridName());
}
}
}
}
}
@ -986,6 +1004,14 @@ public class WorkActServiceImpl implements WorkActService {
List<String> unitNames = unitIds.stream().map(option::get).collect(Collectors.toList());
resultDTO.setUnitIdList(unitIds);
resultDTO.setUnitNameList(unitNames);
if (StringUtils.isNotEmpty(dto.getGridId())) {
resultDTO.setGridId(dto.getGridId());
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(dto.getGridId());
if (null != gridInfo) {
resultDTO.setGridName(gridInfo.getGridName());
}
}
}
}
}
@ -1390,6 +1416,14 @@ public class WorkActServiceImpl implements WorkActService {
List<String> unitNames = unitIds.stream().map(option::get).collect(Collectors.toList());
resultDTO.setUnitIdList(unitIds);
resultDTO.setUnitNameList(unitNames);
if (StringUtils.isNotEmpty(dto.getGridId())) {
resultDTO.setGridId(dto.getGridId());
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(dto.getGridId());
if (null != gridInfo) {
resultDTO.setGridName(gridInfo.getGridName());
}
}
}
}
@ -1563,6 +1597,7 @@ public class WorkActServiceImpl implements WorkActService {
}else{
logger.warn("根据agencyId查询组织信息失败,agencyId={}",formDTO.getSponsorId());
}
entity.setGridId(formDTO.getGridId());
entity.setActId(actInfoEntity.getId());
entity.setTitle(actInfoEntity.getTitle());
entity.setTarget(actInfoEntity.getTarget());

1
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.13__add_column_remark.sql

@ -0,0 +1 @@
alter table ic_community_self_organization add COLUMN REMARK VARCHAR(500) comment '备注' AFTER ORGANIZATION_CREATED_TIME;

4
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.14__activity_add_grid.sql

@ -0,0 +1,4 @@
ALTER TABLE `epmet_heart`.`ic_party_activity`
ADD COLUMN `GRID_ID` varchar(64) NULL COMMENT '网格ID' AFTER `AGENCY_ID`;
ALTER TABLE `epmet_heart`.`latest_act_info`
ADD COLUMN `GRID_ID` varchar(64) NULL COMMENT '网格ID' AFTER `CUSTOMER_ID`;

7
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcCommunitySelfOrganizationDao.xml

@ -14,6 +14,7 @@
LONGITUDE = #{longitude},
LATITUDE = #{latitude},
ORGANIZATION_CREATED_TIME = #{organizationCreatedTime},
REMARK = #{remark},
UPDATED_TIME = NOW(),
UPDATED_BY = #{updatedBy}
WHERE DEL_FLAG = 0
@ -52,7 +53,8 @@
so.SERVICE_ITEM AS serviceItem,
so.LONGITUDE AS longitude,
so.LATITUDE AS latitude,
so.ID as orgId
so.ID as orgId,
so.remark
FROM ic_community_self_organization so
WHERE so.DEL_FLAG = 0
AND so.ORG_ID = #{agencyId}
@ -60,6 +62,9 @@
<if test="null != organizationName and organizationName != '' ">
AND so.ORGANIZATION_NAME LIKE CONCAT('%',#{organizationName},'%')
</if>
<if test="null != remark and remark != '' ">
AND so.REMARK LIKE CONCAT('%',#{remark},'%')
</if>
<if test=" null != startTime and startTime != '' ">
AND so.ORGANIZATION_CREATED_TIME <![CDATA[ >= ]]> #{startTime}
</if>

6
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyActivityDao.xml

@ -49,6 +49,8 @@
<select id="selectActivityList" resultType="com.epmet.entity.IcPartyActivityEntity" parameterType = "com.epmet.dto.form.PartyActivityFormDTO">
SELECT
a.ID,
a.ACT_ID,
a.GRID_ID,
b.unitId,
c.serviceMatter,
TITLE,
@ -95,10 +97,14 @@
WHERE
a.DEL_FLAG = '0'
AND a.AGENCY_ID = #{agencyId}
<if test='null != gridId and "" != gridId'>
AND a.GRID_ID = #{gridId}
</if>
<if test='null != title and "" != title'>
AND TITLE LIKE concat('%', #{title}, '%')
</if>
AND ACTIVITY_TIME BETWEEN #{startTime} AND #{endTime}
ORDER BY ACTIVITY_TIME DESC
</select>

1
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActInfoDao.xml

@ -102,6 +102,7 @@
<select id="previewActInfo" parameterType="java.lang.String" resultType="com.epmet.dto.result.work.ActPreviewResultDTO">
SELECT
lai.id AS actDraftId,
lai.GRID_ID AS gridId,
lai.title AS title,
lai.ACT_QUOTA AS actQuota,
lai.ACT_QUOTA_CATEGORY AS actQuotaCategory,

BIN
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/templates/self_org_import_template.xlsx

Binary file not shown.

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

@ -87,7 +87,7 @@ public class ImportGeneralDTO implements Serializable {
private String purpose;
/**
* 是否出租
* 房屋状态 1出租 0自住 2闲置
*/
private String rentFlagString;
private Integer rentFlag;

29
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcBuildingListFormDTO.java

@ -0,0 +1,29 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.dto.form.PageFormDTO;
import lombok.Data;
/**
* desc: 楼宇列表查询条件
*
* @return
* @author LiuJanJun
* @date 2022/4/13 2:45 下午
*/
@Data
public class IcBuildingListFormDTO extends PageFormDTO {
private static final long serialVersionUID = -7536532648656861790L;
/**
* 小区ID
*/
private String neighborHoodId;
/**
* 房主姓名
*/
private String ownerName;
/**
* 房主电话
*/
private String ownerPhone;
}

4
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcBulidingFormDTO.java → epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcBulidingAddFormDTO.java

@ -27,7 +27,7 @@ import java.io.Serializable;
@Data
public class IcBulidingFormDTO implements Serializable {
public class IcBulidingAddFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ -126,4 +126,4 @@ public class IcBulidingFormDTO implements Serializable {
}
}

6
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcHouseFormDTO.java → epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcHouseAddFormDTO.java

@ -26,7 +26,7 @@ import java.io.Serializable;
@Data
public class IcHouseFormDTO implements Serializable {
public class IcHouseAddFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ -79,9 +79,9 @@ public class IcHouseFormDTO implements Serializable {
private String purpose;
/**
* 1出租0未出租
* 1出租 0自住 2闲置
*/
@NotNull(message = "是否出租不能为空", groups = {AddShowGroup.class, UpdateShowGroup.class})
@NotNull(message = "房屋状态不能为空", groups = {AddShowGroup.class, UpdateShowGroup.class})
private Integer rentFlag;
/**

69
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcHouseListFormDTO.java

@ -0,0 +1,69 @@
package com.epmet.dto.form;/**
* Created by 11 on 2020/3/19.
*/
import com.epmet.commons.tools.dto.form.PageFormDTO;
import lombok.Data;
/**
* @Description 小区房屋列表查询条件
* @ClassName ListCustomerGridFormDTO
* @Author wangc
* @date 2020.03.19 15:00
*/
@Data
public class IcHouseListFormDTO extends PageFormDTO {
private static final long serialVersionUID = -1L;
/**
* 组织类别
*/
private String level;
private String id;
/**
* 组织ID
*/
private String agencyId;
private String pids;
private String gridId;
/**
* 小区名字
*/
private String neighborHoodName;
/**
* 楼栋名字
*/
private String buildingName;
/**
* 房主姓名
*/
private String ownerName;
/**
* 房主电话
*/
private String ownerPhone;
/**
* 房屋状态 1出租 0自住 2闲置
*/
private String rentFlag;
/**
* 楼栋ID
*/
private String buildingId;
/**
* 小区ID
*/
private String neighborHoodId;
/**
* 搜索关键词社区查询搜索输入的关键词
*/
private String keyword;
}

2
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcNeighborHoodFormDTO.java → epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcNeighborHoodAddFormDTO.java

@ -27,7 +27,7 @@ import javax.validation.constraints.NotBlank;
@Data
public class IcNeighborHoodFormDTO extends PageFormDTO {
public class IcNeighborHoodAddFormDTO extends PageFormDTO {
private static final long serialVersionUID = 1L;

63
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcNeighborHoodListFormDTO.java

@ -0,0 +1,63 @@
/**
* 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 com.epmet.commons.tools.dto.form.PageFormDTO;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@Data
public class IcNeighborHoodListFormDTO extends PageFormDTO {
private static final long serialVersionUID = 1L;
/**
* 组织类别
*/
@NotBlank(message = "组织类别不能为空")
private String level;
/**
* orgId 跟level配套使用
*/
@NotBlank(message = "组织Id不能为空")
private String id;
/**
* 组织ID
*/
private String agencyId;
private String pids;
private String gridId;
/**
* 房主姓名
*/
private String ownerName;
/**
* 房主电话
*/
private String ownerPhone;
}

85
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ListIcNeighborHoodFormDTO.java

@ -1,85 +0,0 @@
package com.epmet.dto.form;/**
* Created by 11 on 2020/3/19.
*/
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
/**
* @Description 陌生人导览查询附近网格传参定义
* @ClassName ListCustomerGridFormDTO
* @Author wangc
* @date 2020.03.19 15:00
*/
@Data
public class ListIcNeighborHoodFormDTO implements Serializable{
private static final long serialVersionUID = -1L;
/**
* 当前页
* */
private Integer pageNo = 1;
/**
* 每页显示数量
* */
private Integer pageSize = 20;
/**
* 组织类别
*/
private String level ;
private String id;
/**
* 组织ID
*/
// private String agencyId;
/**
* 网格ID
*/
// private String gridId;
/**
* 小区名字
*/
// private String neighborHoodName;
/**
* 楼栋名字
*/
// private String buildingName;
/**
* 房主姓名
*/
private String ownerName;
/**
* 房主电话
*/
private String ownerPhone;
/**
* 数据类型小区neighbourHood楼栋building房屋house
*/
// @Pattern(regexp = "^(neighbourHood|building|house)?$",message = "数据类型选择错误")
// private String dataType;
/**
* 楼栋ID
*/
private String buildingId;
/**
* 小区ID
*/
private String neighborHoodId;
/**
* 搜索关键词社区查询搜索输入的关键词
*/
private String keyword;
}

17
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseResultDTO.java

@ -1,17 +0,0 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description
* @Author zhaoqifeng
* @Date 2021/10/25 16:58
*/
@Data
public class HouseResultDTO implements Serializable {
private static final long serialVersionUID = 8054109017922254586L;
private String houseId;
private String houseName;
}

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

@ -0,0 +1,20 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2022/4/12 16:40
* @DESC
*/
@Data
public class HousesNameResultDTO implements Serializable {
private static final long serialVersionUID = -8643628706377635279L;
private String idCard;
private String houseName;
}

35
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcBuildingListResultDTO.java

@ -0,0 +1,35 @@
package com.epmet.dto.result;
import com.epmet.commons.tools.dto.form.PageFormDTO;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* desc:楼宇列表结果类
*
* @author: LiuJanJun
* @date: 2022/4/13 2:28 下午
* @version: 1.0
*/
@NoArgsConstructor
@Data
public class IcBuildingListResultDTO extends PageFormDTO {
private static final long serialVersionUID = -8277921228438123299L;
private String gridName;
private Integer totalHouseNum;
private String latitude;
private String agencyId;
private Integer sort;
private String agencyName;
private String buildingId;
private String buildingName;
private String buildingTypeKey;
private String neighborHoodId;
private String neighborHoodName;
private Integer totalFloorNum;
private String gridId;
private Integer totalUnitNum;
private String longitude;
private String buildingType;
}

85
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcHouseListResultDTO.java

@ -0,0 +1,85 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* desc:房屋列表结果类
*
* @author liujianjun
*/
@Data
public class IcHouseListResultDTO implements Serializable {
private static final long serialVersionUID = 4963952996288796744L;
private String houseId;
private String doorName;
private String buildingId;
private String houseName;
private String rentFlag;
private String neighborHoodId;
private String purposeKey;
private String unitNumKey;
/**
* 所属组织
*/
private String agencyName;
private String agencyId;
/**
* 所属网格
*/
private String gridName;
private String gridId;
/**
* 所属小区
*/
private String neighborHoodName;
/**
* 所属楼栋
*/
private String buildingName;
/**
* 单元号
*/
private String unitNum;
/**
* 房屋类型
*/
private String houseType;
private String houseTypeKey;
/**
* 房屋用途
*/
private String purpose;
/**
* 是否出租
*/
private Integer rentFlagKey;
/**
* 房主姓名
*/
private String ownerName;
/**
* 房主电话
*/
private String ownerPhone;
/**
* 房主身份证
*/
private String ownerIdCard;
}

37
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcNeighborHoodResultDTO.java

@ -1,10 +1,8 @@
package com.epmet.dto.result;
import com.epmet.commons.tools.dto.form.PageFormDTO;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import lombok.NoArgsConstructor;
/**
* @Description 网格列表信息
@ -12,25 +10,22 @@ import java.util.Map;
* @Author wangc
* @date 2020.04.23 14:21
*/
@NoArgsConstructor
@Data
public class IcNeighborHoodResultDTO implements Serializable {
public class IcNeighborHoodResultDTO extends PageFormDTO {
private static final long serialVersionUID = 1L;
/**
* 总条数
* */
private Integer total;
// /**
// * 数据类型【小区:neighbourHood,楼栋:building,房屋:house】
// * */
// private String dataType;
/**
* 结果集
*/
private List<Map<String,Object>> list;
private String gridName;
private String address;
private String neighborHoodId;
private String neighborHoodName;
private String latitude;
private String remark;
private String agencyId;
private String location;
private String gridId;
private String propertyId;
private String agencyName;
private String longitude;
}

8
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/enums/HouseRentFlagEnums.java

@ -3,8 +3,12 @@ package com.epmet.enums;
import org.springframework.util.StringUtils;
public enum HouseRentFlagEnums {
YES(1,"是"),
NO(0,"否");
//原有的房屋出租状态是否改为房屋状态【1:出租 0:自住 2:闲置】
/*YES(1,"是"),
NO(0,"否");*/
HOUSE_ZZ(0,"自住"),
HOUSE_CZ(1,"出租"),
HOUSE_XZ(2,"闲置");

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

@ -605,4 +605,13 @@ public interface GovOrgOpenFeignClient {
*/
@PostMapping("/gov/org/customerstaffgrid/getallstaffbygridid")
Result<List<String>> getAllStaffByGridId(@RequestParam("gridId")String gridId);
/**
* Desc: 根据身份证查询房屋名
* @param idCards
* @author zxc
* @date 2022/4/12 16:42
*/
@PostMapping("/gov/org/ichouse/houses-name")
Result<List<HousesNameResultDTO>> getHousesNameByIdCards(@RequestBody List<String> idCards);
}

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

@ -393,4 +393,9 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient {
public Result<List<String>> getAllStaffByGridId(String gridId) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAllStaffByGridId", gridId);
}
@Override
public Result<List<HousesNameResultDTO>> getHousesNameByIdCards(List<String> idCards) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getHousesNameByIdCards", idCards);
}
}

3
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/ImportErrorMsgConstants.java

@ -20,5 +20,8 @@ public interface ImportErrorMsgConstants {
String BUILDING_TYPE_ERROR = "楼栋类型的值未填写或者所填写信息在系统中未找到";
String NEIGHBORHOOD_TYPE_ERROR = "小区名称的值未填写或者所填写信息在系统中未找到";
String HOUSE_ERROR_NAME = "导入失败的列表-房屋";
String BUILDING_ERROR_NAME = "导入失败的列表-楼栋";
String NEIGHBORHOOD_ERROR_NAME = "导入失败的列表-小区";
}

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

@ -18,14 +18,13 @@
package com.epmet.controller;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
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.ValidatorUtils;
@ -35,10 +34,9 @@ import com.epmet.dto.BuildingTreeLevelDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.BuildingResultDTO;
import com.epmet.dto.result.BuildingResultPagedDTO;
import com.epmet.dto.result.IcNeighborHoodResultDTO;
import com.epmet.dto.result.IcBuildingListResultDTO;
import com.epmet.dto.result.ImportTaskCommonResultDTO;
import com.epmet.entity.IcBuildingUnitEntity;
import com.epmet.excel.IcBuildingExcel;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.service.BuildingService;
import com.epmet.util.ExcelPoiUtils;
@ -51,8 +49,9 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.util.stream.Collectors;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
@ -75,19 +74,17 @@ public class BuildingController {
@PostMapping("buildinglist")
public Result houseList(@RequestBody ListIcNeighborHoodFormDTO formDTO){
//效验数据
ValidatorUtils.validateEntity(formDTO);
IcNeighborHoodResultDTO icNeighborHoodResultDTO = buildingService.listBuilding(formDTO);
public Result<PageData<IcBuildingListResultDTO>> houseList(@RequestBody IcBuildingListFormDTO formDTO){
PageData<IcBuildingListResultDTO> icNeighborHoodResultDTO = buildingService.listBuilding(formDTO);
return new Result().ok(icNeighborHoodResultDTO);
}
@NoRepeatSubmit
@PostMapping("buildingadd")
public Result buildingAdd(@LoginUser TokenDto tokenDTO, @RequestBody IcBulidingFormDTO formDTO){
public Result buildingAdd(@LoginUser TokenDto tokenDTO, @RequestBody IcBulidingAddFormDTO formDTO){
//效验数据
ValidatorUtils.validateEntity(formDTO, IcBulidingFormDTO.AddShowGroup.class);
ValidatorUtils.validateEntity(formDTO, IcBulidingAddFormDTO.AddShowGroup.class);
String customerId = tokenDTO.getCustomerId();
buildingService.addBuilding(customerId,formDTO);
return new Result().ok("保存成功");
@ -95,9 +92,9 @@ public class BuildingController {
@NoRepeatSubmit
@PostMapping("buildingupdate")
public Result buildingUpdate(@LoginUser TokenDto tokenDTO, @RequestBody IcBulidingFormDTO formDTO){
public Result buildingUpdate(@LoginUser TokenDto tokenDTO, @RequestBody IcBulidingAddFormDTO formDTO){
//效验数据
ValidatorUtils.validateEntity(formDTO, IcBulidingFormDTO.UpdateShowGroup.class);
ValidatorUtils.validateEntity(formDTO, IcBulidingAddFormDTO.UpdateShowGroup.class);
String customerId = tokenDTO.getCustomerId();
// String customerId = "123123";
buildingService.updateBuilding(customerId,formDTO);
@ -105,9 +102,9 @@ public class BuildingController {
}
@PostMapping("buildingdel")
public Result buildingDel(@LoginUser TokenDto tokenDTO, @RequestBody IcBulidingFormDTO formDTO){
public Result buildingDel(@LoginUser TokenDto tokenDTO, @RequestBody IcBulidingAddFormDTO formDTO){
//效验数据
ValidatorUtils.validateEntity(formDTO, IcBulidingFormDTO.DeleteGroup.class);
ValidatorUtils.validateEntity(formDTO, IcBulidingAddFormDTO.DeleteGroup.class);
String buildingId = formDTO.getBuildingId();
buildingService.delBuilding(buildingId);
return new Result();
@ -118,6 +115,18 @@ public class BuildingController {
List<BuildingTreeLevelDTO> buildingTreeLevelDTOS =buildingService.treeList(tokenDTO.getCustomerId(), tokenDTO.getUserId());
return new Result().ok(buildingTreeLevelDTOS);
}
/**
* Desc: 根据前端方便新开接口只返回树的ID
* @param tokenDTO
* @author zxc
* @date 2022/4/12 15:20
*/
@PostMapping("tree-ids")
public Result treeIds(@LoginUser TokenDto tokenDTO){
List<String> ids =buildingService.treeIds(tokenDTO.getCustomerId(), tokenDTO.getUserId());
return new Result().ok(ids);
}
/**
* 导出模板
* @param response
@ -125,12 +134,8 @@ public class BuildingController {
*/
@PostMapping("exporttemplate")
public void exportTemplate( HttpServletResponse response) throws Exception {
TemplateExportParams templatePath = new TemplateExportParams("excel/building_template.xlsx");
Map<String,Object> map = new HashMap<>();
map.put("maplist",new ArrayList<IcBuildingExcel>());
ExcelPoiUtils.exportExcel(templatePath ,map,"楼宇信息录入表",response);
ExcelPoiUtils.exportExcel(templatePath ,new HashMap<>(),"楼栋信息录入表",response);
}
/**
* 导出
@ -139,10 +144,9 @@ public class BuildingController {
* @throws Exception
*/
@RequestMapping("exportbuildinginfo")
public void exportbuildinginfo(@RequestBody ListIcNeighborHoodFormDTO formDTO, HttpServletResponse response) throws Exception {
public void exportbuildinginfo(@RequestBody IcHouseListFormDTO formDTO, HttpServletResponse response) throws Exception {
ValidatorUtils.validateEntity(formDTO);
buildingService.exportBuildinginfo(formDTO,response);
}
/**
@ -153,49 +157,12 @@ public class BuildingController {
*/
@GetMapping("export")
public void export(HttpServletResponse response) throws Exception {
ListIcNeighborHoodFormDTO formDTO = new ListIcNeighborHoodFormDTO();
IcHouseListFormDTO formDTO = new IcHouseListFormDTO();
ValidatorUtils.validateEntity(formDTO);
buildingService.exportBuildinginfo(formDTO,response);
}
/**
* 导入数据
* @param file
* @return
* @throws IOException
*/
@PostMapping("import")
public Result importExcel(@LoginUser TokenDto tokenDTO, @RequestParam("file") MultipartFile file) throws IOException {
String customerId = tokenDTO.getCustomerId();
// String customerId = "123123";
ExcelImportResult<IcBuildingExcel> importResult = ExcelPoiUtils.importExcelMore(file, 0, 1, IcBuildingExcel.class);
List<IcBuildingExcel> failList = importResult.getFailList();
//存放错误数据行号
List<Integer> numList = new ArrayList<>();
if(!CollectionUtils.isEmpty(failList)){
for ( IcBuildingExcel entity : failList) {
log.error("第{}行,{}",entity.getRowNum(),entity.getErrorMsg());//打印失败的行 和失败的信息
numList.add(entity.getRowNum());
}
//return new Result().error(8001,failList.get(0).getErrorMsg());
}
List<IcBuildingExcel> result =importResult.getList();
List<Integer> resultList = buildingService.importExcel(customerId,result,tokenDTO.getUserId(),numList);
String str = String.format("共%s条,成功导入%s条。",numList.size()+result.size(),numList.size()+result.size()-resultList.size());
if(resultList.size()> NumConstant.ZERO){
Collections.sort(resultList);
String subList = resultList.stream().map(String::valueOf).collect(Collectors.joining("、"));
log.warn(str + "第" + subList + "行未成功!");
return new Result().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), str+"第"+subList+"行未成功!");
}
return new Result().ok(str);
}
/**
* @Description 楼宇导入
* @param tokenDTO

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

@ -18,7 +18,6 @@
package com.epmet.controller;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.constant.NumConstant;
@ -26,36 +25,29 @@ import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.constants.ImportTaskConstants;
import com.epmet.dao.IcBuildingDao;
import com.epmet.dto.form.*;
import com.epmet.dto.result.HouseInfoDTO;
import com.epmet.dto.result.IcNeighborHoodResultDTO;
import com.epmet.dto.result.IcHouseListResultDTO;
import com.epmet.dto.result.ImportTaskCommonResultDTO;
import com.epmet.dto.result.LoginUserDetailsResultDTO;
import com.epmet.excel.IcHouseExcel;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.redis.IcHouseRedis;
import com.epmet.service.HouseService;
import com.epmet.service.IcHouseService;
import com.epmet.util.ExcelPoiUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -75,45 +67,42 @@ public class HouseController implements ResultDataResolver {
@Autowired
private EpmetUserOpenFeignClient userOpenFeignClient;
@Autowired
private IcBuildingDao icBuildingDao;
@Autowired
private IcHouseRedis icHouseRedis;
@Autowired
private IcHouseService icHouseService;
@Autowired
private EpmetCommonServiceOpenFeignClient epmetCommonServiceOpenFeignClient;
@PostMapping("houselist")
public Result houseList(@RequestBody ListIcNeighborHoodFormDTO formDTO){
public Result<PageData<IcHouseListResultDTO>> houseList(@LoginUser TokenDto loginUser, @RequestBody IcHouseListFormDTO formDTO) {
//效验数据
LoginUserDetailsResultDTO loginUserDetail = getLoginUserDetailsResultDTO(loginUser, "【查询房屋】查询当前staff所在组织信息失败");
formDTO.setAgencyId(loginUserDetail.getAgencyId());
ValidatorUtils.validateEntity(formDTO);
return new Result().ok(houseService.getHouseList(formDTO));
String queryScene = "house_manage";
IcNeighborHoodResultDTO icNeighborHoodResultDTO = houseService.listNeighborhood(null, formDTO.getBuildingId(), formDTO.getOwnerName(),
formDTO.getOwnerPhone(), null,
null, queryScene,
formDTO.getPageNo(), formDTO.getPageSize());
return new Result().ok(icNeighborHoodResultDTO);
}
public LoginUserDetailsResultDTO getLoginUserDetailsResultDTO(@LoginUser TokenDto loginUser, String errorMsg) {
LoginUserDetailsFormDTO form = new LoginUserDetailsFormDTO();
form.setUserId(loginUser.getUserId());
form.setClient(loginUser.getClient());
form.setApp(loginUser.getApp());
return getResultDataOrThrowsException(userOpenFeignClient.getLoginUserDetails(form), ServiceConstant.EPMET_USER_SERVER,
EpmetErrorCode.SERVER_ERROR.getCode(),
errorMsg,
null);
}
/**
*@Description 社区查询-搜索房屋
*@Author wangxianzhang
*@Date 2022/1/14 11:00 上午
*@Param
*@return
*/
* @return
* @Description 社区查询-搜索房屋
* @Author wangxianzhang
* @Date 2022/1/14 11:00 上午
* @Param
*/
@PostMapping("search")
public Result<IcNeighborHoodResultDTO> searchHouse(@RequestBody ListIcNeighborHoodFormDTO formDTO, @LoginUser TokenDto loginUser) {
public Result<PageData<IcHouseListResultDTO>> searchHouse(@RequestBody IcHouseListFormDTO formDTO, @LoginUser TokenDto loginUser) {
String keyword = formDTO.getKeyword();
if (StringUtils.isBlank(keyword)) {
IcNeighborHoodResultDTO r = new IcNeighborHoodResultDTO();
r.setTotal(0);
r.setList(new ArrayList<>());
return new Result<IcNeighborHoodResultDTO>().ok(r);
return new Result<PageData<IcHouseListResultDTO>>().ok(new PageData<>(new ArrayList<>(), NumConstant.ZERO));
}
keyword = keyword.trim();
@ -129,132 +118,87 @@ public class HouseController implements ResultDataResolver {
buildingName = null;
}
// 使用场景:社区查询
String scene = "community_search";
LoginUserDetailsFormDTO form = new LoginUserDetailsFormDTO();
form.setUserId(loginUser.getUserId());
form.setClient(loginUser.getClient());
form.setApp(loginUser.getApp());
LoginUserDetailsResultDTO loginUserDetail = getResultDataOrThrowsException(userOpenFeignClient.getLoginUserDetails(form), ServiceConstant.EPMET_USER_SERVER,
EpmetErrorCode.SERVER_ERROR.getCode(),
"【社区查询-查询房屋】查询当前staff所在组织信息失败",
null);
IcNeighborHoodResultDTO icNeighborHoodResultDTO = houseService.listNeighborhood(loginUserDetail.getAgencyId(),null, null, null,
neighborhoodName, buildingName, scene, formDTO.getPageNo(), formDTO.getPageSize());
return new Result<IcNeighborHoodResultDTO>().ok(icNeighborHoodResultDTO);
LoginUserDetailsResultDTO loginUserDetail = getLoginUserDetailsResultDTO(loginUser, "【社区查询-查询房屋】查询当前staff所在组织信息失败");
formDTO.setAgencyId(loginUserDetail.getAgencyId());
formDTO.setBuildingName(buildingName);
formDTO.setNeighborHoodName(neighborhoodName);
return new Result<PageData<IcHouseListResultDTO>>().ok(houseService.getHouseList(formDTO));
}
@NoRepeatSubmit
@PostMapping("houseadd")
public Result houseAdd(@LoginUser TokenDto tokenDTO, @RequestBody IcHouseFormDTO formDTO){
public Result houseAdd(@LoginUser TokenDto tokenDTO, @RequestBody IcHouseAddFormDTO formDTO) {
//效验数据
ValidatorUtils.validateEntity(formDTO, IcHouseFormDTO.AddShowGroup.class);
ValidatorUtils.validateEntity(formDTO, IcHouseAddFormDTO.AddShowGroup.class);
String customerId = tokenDTO.getCustomerId();
// String customerId = "123123";
houseService.addHouse(customerId,formDTO);
houseService.addHouse(customerId, formDTO);
return new Result();
}
@NoRepeatSubmit
@PostMapping("houseupdate")
public Result houseUpdate(@LoginUser TokenDto tokenDTO, @RequestBody IcHouseFormDTO formDTO){
public Result houseUpdate(@LoginUser TokenDto tokenDTO, @RequestBody IcHouseAddFormDTO formDTO) {
//效验数据
ValidatorUtils.validateEntity(formDTO, IcHouseFormDTO.UpdateShowGroup.class);
ValidatorUtils.validateEntity(formDTO, IcHouseAddFormDTO.UpdateShowGroup.class);
String customerId = tokenDTO.getCustomerId();
// String customerId = "123123";
houseService.updateHouse(customerId,formDTO);
houseService.updateHouse(customerId, formDTO);
return new Result();
}
/**
* lzh
*
* @param formDTO
* @return 单独删除房屋内部调用/gov/org/house/delete
*/
@PostMapping("housedel")
public Result houseDel(@RequestBody IcHouseFormDTO formDTO){
public Result houseDel(@RequestBody IcHouseAddFormDTO formDTO) {
//效验数据
ValidatorUtils.validateEntity(formDTO, IcNeighborHoodFormDTO.DeleteGroup.class);
ValidatorUtils.validateEntity(formDTO, IcNeighborHoodAddFormDTO.DeleteGroup.class);
houseService.delHouse(formDTO.getHouseId());
return new Result();
}
/**
* 导出模板
*
* @param response
* @throws Exception
*/
@PostMapping("exporttemplate")
public void exportTemplate(HttpServletResponse response) throws Exception {
// ValidatorUtils.validateEntity(ListIcNeighborHoodFormDTO.class);
TemplateExportParams templatePath = new TemplateExportParams("excel/house_template.xlsx");
Map<String,Object> map = new HashMap<>();
map.put("maplist",new ArrayList<IcHouseExcel>());
ExcelPoiUtils.exportExcel(templatePath ,map,"房屋信息录入表",response);
ExcelPoiUtils.exportExcel(templatePath, new HashMap<>(), "房屋信息录入表", response);
}
/**
* 导出
*
* @param formDTO
* @param response
* @throws Exception
*/
@RequestMapping("exporthouseinfo")
public void exporthouseinfo(@RequestBody ListIcNeighborHoodFormDTO formDTO, HttpServletResponse response) throws Exception {
public void exporthouseinfo(@RequestBody IcHouseListFormDTO formDTO, HttpServletResponse response) throws Exception {
ValidatorUtils.validateEntity(formDTO);
houseService.exportBuildinginfo(formDTO,response);
formDTO.setIsPage(false);
houseService.exportBuildinginfo(formDTO, response);
}
/**
* 导入数据
* @param file
* @return
* @throws IOException
*/
@PostMapping("import")
public Result importExcel(@LoginUser TokenDto tokenDTO, @RequestParam("file") MultipartFile file) throws IOException {
String customerId = tokenDTO.getCustomerId();
// String customerId = "123123";
ExcelImportResult<IcHouseExcel> importResult = ExcelPoiUtils.importExcelMore(file, 0, 1, IcHouseExcel.class);
List<IcHouseExcel> failList = importResult.getFailList();
//存放错误数据行号
List<Integer> numList = new ArrayList<>();
if(!CollectionUtils.isEmpty(failList)){
for ( IcHouseExcel entity : failList) {
log.warn("第{}行,{}",entity.getRowNum(),entity.getErrorMsg());//打印失败的行 和失败的信息
numList.add(entity.getRowNum());
}
}
List<IcHouseExcel> result =importResult.getList();
List<Integer> resultList = houseService.importExcel(customerId,result,tokenDTO.getUserId(),numList);
String str = String.format("共%s条,成功导入%s条。",numList.size()+result.size(),numList.size()+result.size()-resultList.size());
if(resultList.size()> NumConstant.ZERO){
Collections.sort(resultList);
String subList = resultList.stream().map(String::valueOf).collect(Collectors.joining("、"));
log.warn(str + "第" + subList + "行未成功!");
return new Result().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), str+"第"+subList+"行未成功!");
}
return new Result().ok(str);
}
@PostMapping( "queryListHouseInfo")
Result<List<HouseInfoDTO>> queryListHouseInfo(@RequestBody Set<String> houseIds, @RequestParam("customerId") String customerId){
return new Result<List<HouseInfoDTO>>().ok(houseService.queryListHouseInfo(houseIds,customerId));
@PostMapping("queryListHouseInfo")
Result<List<HouseInfoDTO>> queryListHouseInfo(@RequestBody Set<String> houseIds, @RequestParam("customerId") String customerId) {
return new Result<List<HouseInfoDTO>>().ok(houseService.queryListHouseInfo(houseIds, customerId));
}
@PostMapping("houseimport")
public Result houseImport(@LoginUser TokenDto tokenDTO, @RequestParam("file") MultipartFile file,
@RequestParam("orgId")String orgId,
@RequestParam("orgType")String orgType,HttpServletRequest multipartRequest){
@RequestParam("orgId") String orgId,
@RequestParam("orgType") String orgType) {
ImportInfoFormDTO formDTO = new ImportInfoFormDTO();
formDTO.setCustomerId(tokenDTO.getCustomerId());
formDTO.setOrgType(orgType);
@ -265,32 +209,33 @@ public class HouseController implements ResultDataResolver {
importFormDTO.setOperatorId(formDTO.getUserId());
importFormDTO.setOriginFileName(file.getOriginalFilename());
Result<ImportTaskCommonResultDTO> importTask = epmetCommonServiceOpenFeignClient.createImportTask(importFormDTO);
if (!importTask.success()){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"","存在进行中的导入");
if (!importTask.success()) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "", "存在进行中的导入");
}
InputStream inputStream = null;
try {
inputStream = file.getInputStream();
}catch (Exception e){
} catch (Exception e) {
ImportTaskCommonFormDTO input = new ImportTaskCommonFormDTO();
input.setOperatorId(formDTO.getUserId());
input.setTaskId(importTask.getData().getTaskId());
input.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL);
epmetCommonServiceOpenFeignClient.finishImportTask(input);
log.error("读取文件失败",e);
log.error("读取文件失败", e);
}
houseService.dispose(inputStream,formDTO,importTask);
houseService.dispose(inputStream, formDTO, importTask);
return new Result<>();
}
/**
* Desc 小区管理中批量删除
*
* @param formDTO
* @author zxc
* @date 2022/3/1 4:57 下午
*/
@PostMapping("delete")
public Result allDelete(@RequestBody NeighborHoodManageDelFormDTO formDTO){
public Result allDelete(@RequestBody NeighborHoodManageDelFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, NeighborHoodManageDelFormDTO.NeighborHoodManageDelForm.class);
houseService.allDelete(formDTO);
return new Result();
@ -298,14 +243,15 @@ public class HouseController implements ResultDataResolver {
/**
* 获取房屋信息
*
* @param houseId
* @return
*/
@PostMapping("gethouseinfo/{houseId}")
public Result<HouseInfoDTO> getHouseInfo(@LoginUser TokenDto tokenDto,@PathVariable("houseId") String houseId){
if(StringUtils.isBlank(houseId)){
public Result<HouseInfoDTO> getHouseInfo(@LoginUser TokenDto tokenDto, @PathVariable("houseId") String houseId) {
if (StringUtils.isBlank(houseId)) {
return new Result<>();
}
return new Result<HouseInfoDTO>().ok(houseService.getHouseInfoDTO(tokenDto.getCustomerId(),houseId));
return new Result<HouseInfoDTO>().ok(houseService.getHouseInfoDTO(tokenDto.getCustomerId(), houseId));
}
}

52
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcBuildingController.java

@ -18,20 +18,16 @@
package com.epmet.controller;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.page.PageData;
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.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.IcBuildingDTO;
import com.epmet.service.IcBuildingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
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;
import java.util.Map;
/**
@ -43,46 +39,10 @@ import java.util.Map;
@RestController
@RequestMapping("icbuilding")
public class IcBuildingController {
@Autowired
private IcBuildingService icBuildingService;
@GetMapping("page")
public Result<PageData<IcBuildingDTO>> page(@RequestParam Map<String, Object> params){
PageData<IcBuildingDTO> page = icBuildingService.page(params);
return new Result<PageData<IcBuildingDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<IcBuildingDTO> get(@PathVariable("id") String id){
IcBuildingDTO data = icBuildingService.get(id);
return new Result<IcBuildingDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody IcBuildingDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
icBuildingService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody IcBuildingDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
icBuildingService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
icBuildingService.delete(ids);
return new Result();
}
/**
* @Description 获取小区内的楼栋
* @Param dto
@ -94,4 +54,4 @@ public class IcBuildingController {
public Result<List<OptionResultDTO>> getBuildingOptions(@RequestBody IcBuildingDTO dto) {
return new Result<List<OptionResultDTO>>().ok(icBuildingService.getBuildingOptions(dto.getNeighborHoodId()));
}
}
}

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

@ -19,23 +19,17 @@ 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;
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.dto.IcHouseDTO;
import com.epmet.dto.form.HouseFormDTO;
import com.epmet.dto.result.HouseListResultDTO;
import com.epmet.dto.result.HousesNameResultDTO;
import com.epmet.service.IcHouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
@ -47,45 +41,16 @@ import java.util.Map;
@RestController
@RequestMapping("ichouse")
public class IcHouseController {
@Autowired
private IcHouseService icHouseService;
@GetMapping("page")
public Result<PageData<IcHouseDTO>> page(@RequestParam Map<String, Object> params){
PageData<IcHouseDTO> page = icHouseService.page(params);
return new Result<PageData<IcHouseDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<IcHouseDTO> get(@PathVariable("id") String id){
IcHouseDTO data = icHouseService.get(id);
return new Result<IcHouseDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody IcHouseDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
icHouseService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody IcHouseDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
icHouseService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
icHouseService.delete(ids);
return new Result();
}
@PostMapping("houseoption")
public Result<List<OptionResultDTO>> getHouseOption(@RequestBody HouseFormDTO formDTO){
return new Result<List<OptionResultDTO>>().ok(icHouseService.getHouseOption(formDTO));
@ -114,4 +79,15 @@ public class IcHouseController {
return new Result<List<HouseListResultDTO>>().ok(icHouseService.getHouseList(tokenDto, formDTO));
}
}
/**
* Desc: 根据身份证查询房屋名
* @param idCards
* @author zxc
* @date 2022/4/12 16:42
*/
@PostMapping("houses-name")
public Result<List<HousesNameResultDTO>> getHousesNameByIdCards(@RequestBody List<String> idCards){
return new Result<List<HousesNameResultDTO>>().ok(icHouseService.getHousesNameByIdCards(idCards));
}
}

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

@ -35,7 +35,7 @@ import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.constants.ImportTaskConstants;
import com.epmet.dto.IcNeighborHoodDTO;
import com.epmet.dto.form.IcNeighborHoodFormDTO;
import com.epmet.dto.form.IcNeighborHoodAddFormDTO;
import com.epmet.dto.form.ImportInfoFormDTO;
import com.epmet.dto.form.ImportTaskCommonFormDTO;
import com.epmet.dto.result.ImportTaskCommonResultDTO;
@ -79,7 +79,7 @@ public class IcNeighborHoodController {
}
@PostMapping("open/list")
public Result<PageData<IcNeighborHoodDTO>> openList(@RequestBody IcNeighborHoodFormDTO params){
public Result<PageData<IcNeighborHoodDTO>> openList(@RequestBody IcNeighborHoodAddFormDTO params){
PageData<IcNeighborHoodDTO> page = icNeighborHoodService.openPage(params);
return new Result<PageData<IcNeighborHoodDTO>>().ok(page);
}

149
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/NeighborHoodController.java

@ -18,37 +18,32 @@
package com.epmet.controller;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
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.dao.IcBuildingDao;
import com.epmet.dto.form.IcNeighborHoodFormDTO;
import com.epmet.dto.form.ListIcNeighborHoodFormDTO;
import com.epmet.dto.form.IcHouseListFormDTO;
import com.epmet.dto.form.IcNeighborHoodAddFormDTO;
import com.epmet.dto.form.IcNeighborHoodListFormDTO;
import com.epmet.dto.result.IcNeighborHoodResultDTO;
import com.epmet.entity.IcBuildingEntity;
import com.epmet.excel.IcNeighborHoodExcel;
import com.epmet.service.BuildingService;
import com.epmet.service.HouseService;
import com.epmet.service.IcNeighborHoodService;
import com.epmet.service.NeighborHoodService;
import com.epmet.util.ExcelPoiUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
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 javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
import java.util.HashMap;
import java.util.List;
/**
@ -62,63 +57,52 @@ import java.util.stream.Collectors;
@RequestMapping("neighborhood")
public class NeighborHoodController {
@Autowired
private IcNeighborHoodService icNeighborHoodService;
@Autowired
private NeighborHoodService neighborHoodService;
@Autowired
private BuildingService buildingService;
@Autowired
private HouseService houseService;
@Resource
private IcBuildingDao icBuildingDao;
@PostMapping("neighborhoodlist")
public Result neighborhoodlist(@RequestBody ListIcNeighborHoodFormDTO formDTO){
public Result<IcNeighborHoodResultDTO> neighborhoodlist(@RequestBody IcNeighborHoodListFormDTO formDTO){
//效验数据
ValidatorUtils.validateEntity(formDTO);
IcNeighborHoodResultDTO icNeighborHoodResultDTO = neighborHoodService.listNeighborhood(formDTO);
return new Result().ok(icNeighborHoodResultDTO);
return new Result().ok(neighborHoodService.listNeighborhood(formDTO));
}
@NoRepeatSubmit
@PostMapping("neighborhoodadd")
public Result neighborhoodadd(@LoginUser TokenDto tokenDTO, @RequestBody IcNeighborHoodFormDTO formDTO){
public Result neighborhoodadd(@LoginUser TokenDto tokenDTO, @RequestBody IcNeighborHoodAddFormDTO formDTO){
//效验数据
ValidatorUtils.validateEntity(formDTO, IcNeighborHoodFormDTO.AddShowGroup.class);
ValidatorUtils.validateEntity(formDTO, IcNeighborHoodAddFormDTO.AddShowGroup.class);
String customerId = tokenDTO.getCustomerId();
// String customerId = "123123";
neighborHoodService.AddNeighborhood(customerId,formDTO);
neighborHoodService.addNeighborhood(customerId,formDTO);
return new Result();
}
@NoRepeatSubmit
@PostMapping("neighborhoodupdate")
public Result neighborhoodupdate(@LoginUser TokenDto tokenDTO, @RequestBody IcNeighborHoodFormDTO formDTO){
public Result neighborhoodupdate(@LoginUser TokenDto tokenDTO, @RequestBody IcNeighborHoodAddFormDTO formDTO){
//效验数据
ValidatorUtils.validateEntity(formDTO, IcNeighborHoodFormDTO.UpdateShowGroup.class);
ValidatorUtils.validateEntity(formDTO, IcNeighborHoodAddFormDTO.UpdateShowGroup.class);
String customerId = tokenDTO.getCustomerId();
// String customerId = "123123";
neighborHoodService.UpdateNeighborhood(customerId,formDTO);
neighborHoodService.updateNeighborhood(customerId,formDTO);
return new Result();
}
@PostMapping("neighborhooddel")
public Result neighborhooddel(@LoginUser TokenDto tokenDTO, @RequestBody IcNeighborHoodFormDTO formDTO){
public Result neighborhooddel(@LoginUser TokenDto tokenDTO, @RequestBody IcNeighborHoodAddFormDTO formDTO){
//效验数据
ValidatorUtils.validateEntity(formDTO, IcNeighborHoodFormDTO.DeleteGroup.class);
ValidatorUtils.validateEntity(formDTO, IcNeighborHoodAddFormDTO.DeleteGroup.class);
String neighborHoodId = formDTO.getNeighborHoodId();
//判断是否存在楼宇,如果存在不能删除
List<IcBuildingEntity> icBuildingEntities = icBuildingDao.selectList(new QueryWrapper<IcBuildingEntity>().lambda().eq(IcBuildingEntity::getNeighborHoodId, neighborHoodId));
if(!CollectionUtils.isEmpty(icBuildingEntities)){
return new Result().error(8001,"小区下已存在楼,无法删除");
return new Result().error(8001,"小区下已存在楼,无法删除");
}
neighborHoodService.DelNeighborhood(neighborHoodId);
neighborHoodService.delNeighborhood(neighborHoodId);
return new Result().ok("删除成功");
}
@ -130,7 +114,7 @@ public class NeighborHoodController {
* @throws Exception
*/
@PostMapping("exportneighborhoodinfo")
public void exportneighborhoodinfo(@RequestBody ListIcNeighborHoodFormDTO formDTO, HttpServletResponse response) throws Exception {
public void exportneighborhoodinfo(@RequestBody IcHouseListFormDTO formDTO, HttpServletResponse response) throws Exception {
ValidatorUtils.validateEntity(formDTO);
neighborHoodService.exportNeighborhoodinfo(formDTO,response);
@ -142,94 +126,7 @@ public class NeighborHoodController {
*/
@PostMapping("exporttemplate")
public void exportTemplate( HttpServletResponse response) throws Exception {
// ValidatorUtils.validateEntity(ListIcNeighborHoodFormDTO.class);
TemplateExportParams templatePath = new TemplateExportParams("excel/neighbor_template.xlsx");
Map<String,Object> map = new HashMap<>();
map.put("maplist",new ArrayList<IcNeighborHoodExcel>());
ExcelPoiUtils.exportExcel(templatePath ,map,"小区信息录入表",response);
}
/**
* 导出模板
* @param response
* @throws Exception
*/
/*@GetMapping("export")
public void export( HttpServletResponse response) throws Exception {
ValidatorUtils.validateEntity(ListIcNeighborHoodFormDTO.class);
TemplateExportParams templatePath = new TemplateExportParams("excel/neighbor_template.xlsx");
Map<String,Object> map = new HashMap<>();
map.put("maplist",new ArrayList<IcNeighborHoodExcel>());
ExcelPoiUtils.exportExcel(templatePath ,map,"小区信息录入表",response);
}*/
/**
* 导出
* @param response
* @throws Exception
*/
/* @RequestMapping("exportinfo")
public void exportinfo(HttpServletResponse response) throws Exception {
ListIcNeighborHoodFormDTO formDTO = new ListIcNeighborHoodFormDTO();
ValidatorUtils.validateEntity(ListIcNeighborHoodFormDTO.class);
neighborHoodService.exportNeighborhoodinfo(formDTO,response);
}*/
// /**
// * 导入
// * @param params
// * @param response
// * @throws Exception
// */
// @PostMapping("importneighborhoodinfo")
// public void importneighborhoodinfo(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
// List<IcNeighborHoodDTO> list = icNeighborHoodService.list(params);
// ExcelUtils.exportExcelToTarget(response, "小区信息录入表", list, IcNeighborHoodExcel.class);
//// ExcelUtils.expor
// }
/**
* 导入数据
* @param file
* @return
* @throws IOException
*/
@PostMapping("import")
public Result importExcel(@LoginUser TokenDto tokenDTO, @RequestParam("file") MultipartFile file) throws IOException {
String customerId = tokenDTO.getCustomerId();
// String customerId = "123123";
ExcelImportResult<IcNeighborHoodExcel> importResult = ExcelPoiUtils.importExcelMore(file, 0, 1, IcNeighborHoodExcel.class);
// List<IcNeighborHoodExcel> result = ExcelPoiUtils.importExcel(file, 0, 1, IcNeighborHoodExcel.class);
List<IcNeighborHoodExcel> failList = importResult.getFailList();
//存放错误数据行号
List<Integer> numList = new ArrayList<>();
if(!CollectionUtils.isEmpty(failList)){
for ( IcNeighborHoodExcel entity : failList) {
log.warn("第{}行,{}",entity.getRowNum(),entity.getErrorMsg());//打印失败的行 和失败的信息
numList.add(entity.getRowNum());
}
//return new Result().error(8001,failList.get(0).getErrorMsg());
}
List<IcNeighborHoodExcel> result =importResult.getList();
// log.info(JSON.toJSONString(result));
List<Integer> resultList = neighborHoodService.importExcel(customerId,result,tokenDTO.getUserId(),numList);
String str = String.format("共%s条,成功导入%s条。",numList.size()+result.size(),numList.size()+result.size()-resultList.size());
if (resultList.size() > NumConstant.ZERO) {
Collections.sort(resultList);
String subList = resultList.stream().map(String::valueOf).collect(Collectors.joining("、"));
log.warn(str + "第" + subList + "行未成功!");
return new Result().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), str + "第" + subList + "行未成功!");
}
return new Result().ok(str);
ExcelPoiUtils.exportExcel(templatePath ,new HashMap<>(),"小区信息录入表",response);
}
}

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

@ -20,10 +20,8 @@ package com.epmet.dao;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.ImportGeneralDTO;
import com.epmet.dto.result.BaseInfoFamilyBuildingResultDTO;
import com.epmet.dto.result.BuildingResultDTO;
import com.epmet.dto.result.ExistHouseInfoResultDTO;
import com.epmet.dto.result.UpdateBuildingHouseNumResultDTO;
import com.epmet.dto.form.IcBuildingListFormDTO;
import com.epmet.dto.result.*;
import com.epmet.entity.CustomerAgencyEntity;
import com.epmet.entity.IcBuildingEntity;
import com.epmet.entity.IcHouseEntity;
@ -45,16 +43,9 @@ import java.util.Set;
@Mapper
public interface IcBuildingDao extends BaseDao<IcBuildingEntity> {
// IPage<Map<String, Object>> searchBuildingByPage(IPage<IcBuildingEntity> page,
// @Param("neighbor") IcNeighborHoodEntity neighbor,
// @Param("building")IcBuildingEntity building);
IPage<Map<String, Object>> searchBuildingByPage(IPage<IcBuildingEntity> page,
@Param("building")IcBuildingEntity building, @Param("house") IcHouseEntity house);
// List<IcBuildingExcel> searchAllBuilding(@Param(Constants.WRAPPER) QueryWrapper<IcNeighborHoodEntity> neighborHoodEntityQueryWrapper,
// @Param("ew1") QueryWrapper<IcBuildingEntity> buildingEntityQueryWrapper);
// List<IcBuildingExcel> searchAllBuilding(@Param("neighbor") IcNeighborHoodEntity neighbor,
// @Param("building")IcBuildingEntity building);
List<IcBuildingListResultDTO> searchBuildingByPage(IcBuildingListFormDTO formDTO);
List<IcBuildingExcel> searchAllBuilding(
@Param("building")IcBuildingEntity building, @Param("house")IcHouseEntity house);

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

@ -1,17 +1,17 @@
package com.epmet.dao;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.ImportGeneralDTO;
import com.epmet.dto.form.IcHouseListFormDTO;
import com.epmet.dto.result.HouseInfoDTO;
import com.epmet.dto.result.HousesNameResultDTO;
import com.epmet.dto.result.IcHouseListResultDTO;
import com.epmet.dto.result.NeighborHoodManageDelResultDTO;
import com.epmet.entity.IcHouseEntity;
import com.epmet.excel.IcHouseExcel;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
@ -23,24 +23,7 @@ import java.util.Set;
@Mapper
public interface IcHouseDao extends BaseDao<IcHouseEntity> {
// IPage<Map<String, Object>> searchHouseByPage(IPage<IcHouseEntity> page,
// @Param(Constants.WRAPPER) QueryWrapper<IcNeighborHoodEntity> neighborHoodEntityQueryWrapper,
// @Param("ew1") QueryWrapper<IcBuildingEntity> buildingEntityQueryWrapper,
// @Param("ew2") QueryWrapper<IcHouseEntity> houseEntityQueryWrapper);
// IPage<Map<String, Object>> searchHouseByPage(IPage<IcHouseEntity> page,
// @Param("neighbor") IcNeighborHoodEntity neighbor,
// @Param("building") IcBuildingEntity building,
// @Param("house") IcHouseEntity house);
IPage<Map<String, Object>> searchHouseByPage(IPage<IcHouseEntity> page,
@Param("pids") String pids,
@Param("buildingId") String buildingId,
@Param("ownerName") String ownerName,
@Param("ownerPhone") String ownerPhone,
@Param("neighborHoodName") String neighborHoodName,
@Param("buildingName") String buildingName,
@Param("queryScene") String queryScene);
List<IcHouseExcel> searchAllHouse(@Param("house") IcHouseEntity house);
List<IcHouseListResultDTO> searchHouseByPage(IcHouseListFormDTO formDTO);
List<HouseInfoDTO> queryHouseInfo(@Param("houseIdList") Set<String> houseIdList);
@ -92,4 +75,12 @@ public interface IcHouseDao extends BaseDao<IcHouseEntity> {
*/
void houseUpdate(@Param("houses") List<ImportGeneralDTO> houses);
}
/**
* Desc: 根据身份证查询房屋名
* @param idCards
* @author zxc
* @date 2022/4/12 16:42
*/
List<HousesNameResultDTO> getHousesNameByIdCards(@Param("idCards") List<String> idCards);
}

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

@ -17,8 +17,9 @@
package com.epmet.dao;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.IcNeighborHoodListFormDTO;
import com.epmet.dto.result.IcNeighborHoodResultDTO;
import com.epmet.entity.IcHouseEntity;
import com.epmet.entity.IcNeighborHoodEntity;
import com.epmet.excel.IcNeighborHoodExcel;
@ -26,7 +27,6 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* 小区表
@ -37,10 +37,8 @@ import java.util.Map;
@Mapper
public interface IcNeighborHoodDao extends BaseDao<IcNeighborHoodEntity> {
// IPage<Map<String, Object>> searchNeighborhoodByPage(IPage<IcNeighborHoodEntity> page,@Param(Constants.WRAPPER) QueryWrapper<IcNeighborHoodEntity> neighborHoodEntityQueryWrapper);
IPage<Map<String, Object>> searchNeighborhoodByPage(IPage<IcNeighborHoodEntity> page, @Param("neighbor") IcNeighborHoodEntity neighbor, @Param("house")IcHouseEntity house);
List<IcNeighborHoodResultDTO> searchNeighborhoodByPage(IcNeighborHoodListFormDTO formDTO);
// List<IcNeighborHoodExcel> searchAllNeighborhood(@Param(Constants.WRAPPER) QueryWrapper<IcNeighborHoodEntity> neighborHoodEntityQueryWrapper);
List<IcNeighborHoodExcel> searchAllNeighborhood(@Param("neighbor") IcNeighborHoodEntity neighbor, @Param("house")IcHouseEntity house);
List<IcNeighborHoodEntity> selectListByName(@Param("customerId") String customerId,
@ -61,4 +59,4 @@ public interface IcNeighborHoodDao extends BaseDao<IcNeighborHoodEntity> {
*/
List<String> selectNeighborhoodNameByNames(@Param("names")List<String> names,@Param("customerId") String customerId);
}
}

147
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/IcHouseExcel.java

@ -1,147 +0,0 @@
/**
* 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 com.epmet.util.ExcelVerifyInfo;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* 房屋信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-10-27
*/
@Data
public class IcHouseExcel extends ExcelVerifyInfo implements Serializable {
/*@Excel(name = "房屋主键")
private String id;
@Excel(name = "客户id")
private String customerId;
@Excel(name = "小区id")
private String neighborHoodId;
@Excel(name = "片区id,neighbor_hood_part.id,可为空。")
private String partId;
@Excel(name = "所属楼栋id")
private String buildingId;
@Excel(name = "所属单元id")
private String buildingUnitId;
@Excel(name = "房屋名字后台插入时生成")
private String houseName;
@Excel(name = "门牌号")
private String doorName;
@Excel(name = "房屋类型,这里存储字典value就可以")
private String houseType;
@Excel(name = "存储字典value")
private String purpose;
@Excel(name = "1出租;0未出租")
private Integer rentFlag;
@Excel(name = "房主姓名")
private String ownerName;
@Excel(name = "房主电话")
private String ownerPhone;
@Excel(name = "房主身份证号")
private String ownerIdCard;
@Excel(name = "删除标识 0未删除、1已删除")
private String delFlag;
@Excel(name = "乐观锁")
private Integer revision;
@Excel(name = "创建人")
private String createdBy;
@Excel(name = "创建时间")
private Date createdTime;
@Excel(name = "更新人")
private String updatedBy;
@Excel(name = "更新时间")
private Date updatedTime;*/
@Excel(name = "所属组织")
@NotBlank(message = "不能为空")
private String agencyName;
@Excel(name = "所属网格")
@NotBlank(message = "不能为空")
private String gridName;
@Excel(name = "所属小区")
@NotBlank(message = "不能为空")
@Length(max=50,message = "不能超过50个字")
private String neighborHoodName;
@Excel(name = "所属楼栋")
@NotBlank(message = "不能为空")
private String buildingName;
@Excel(name = "单元号")
@NotNull(message = "不能为空")
private Integer buildingUnit;
@Excel(name = "门牌号")
@NotBlank(message = "不能为空")
private String doorName;
@Excel(name = "房屋类型")
@NotBlank(message = "不能为空")
private String houseType;
@Excel(name = "房屋用途")
@NotBlank(message = "不能为空")
private String purpose;
@Excel(name = "出租")
@NotBlank(message = "不能为空")
private String rentFlag;
@Excel(name = "房主姓名")
@NotBlank(message = "不能为空")
private String ownerName;
@Excel(name = "房主电话")
@NotBlank(message = "不能为空")
private String ownerPhone;
@Excel(name = "房主身份证")
@NotBlank(message = "不能为空")
private String ownerIdCard;
}

3
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/BuildingErrorInfoModel.java

@ -12,6 +12,9 @@ import lombok.Data;
@Data
public class BuildingErrorInfoModel {
@Excel(name = "行号", width = 20)
private Integer num;
@Excel(name = "小区名称" , width = 20)
private String neighborHoodName;

4
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/BuildingInfoModel.java

@ -1,5 +1,6 @@
package com.epmet.model;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
@ -35,4 +36,7 @@ public class BuildingInfoModel {
@ExcelProperty(value = "户数")
private Integer totalHouseNum;
@ExcelIgnore
private Integer num;
}

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/HouseErrorInfoModel.java

@ -13,7 +13,7 @@ import org.hibernate.validator.constraints.Length;
@Data
public class HouseErrorInfoModel {
@Excel(name = "行号(不计算表头)", width = 20)
@Excel(name = "行号", width = 20)
private Integer num;
@Excel(name = "所属小区", width = 20)

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/HouseInfoModel.java

@ -38,7 +38,7 @@ public class HouseInfoModel {
@ExcelProperty(value = "房屋用途")
private String purpose;
@ExcelProperty(value = "出租")
@ExcelProperty(value = "房屋状态")
private String rentFlagString;
@ExcelProperty(value = "房主姓名")

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportBuildingInfoListener.java

@ -86,6 +86,7 @@ public class ImportBuildingInfoListener extends AnalysisEventListener<BuildingIn
ImportGeneralDTO dto = ConvertUtils.sourceToTarget(data, ImportGeneralDTO.class);
dto.setNum(num);
dto.setCustomerId(formDTO.getCustomerId());
info.setNum(num);
if(StringUtils.isBlank(data.getAgencyName())){
nums.add(num);
disposeErrorMsg(info, "所属组织的值未填写");
@ -384,6 +385,7 @@ public class ImportBuildingInfoListener extends AnalysisEventListener<BuildingIn
public void disposeErrorMsg(BuildingInfoModel data,String msg){
BuildingErrorInfoModel err = ConvertUtils.sourceToTarget(data, BuildingErrorInfoModel.class);
err.setErrorMsg(msg);
err.setNum(err.getNum() + NumConstant.ONE);
errorInfos.add(err);
}

7
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportHouseInfoListener.java

@ -134,7 +134,7 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode
}
if(StringUtils.isBlank(data.getRentFlagString())){
nums.add(num);
disposeErrorMsg(info, "是否出租的值未填写");
disposeErrorMsg(info, "房屋状态的值未填写");
return;
}
if(StringUtils.isBlank(data.getDoorName())){
@ -183,9 +183,9 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode
return;
}
dto.setPurpose(HousePurposeEnums.getKeyByValue(dto.getPurpose()));
if (StringUtils.isNotBlank(dto.getRentFlagString()) && (!dto.getRentFlagString().equals("") && !dto.getRentFlagString().equals(""))){
if (StringUtils.isNotBlank(dto.getRentFlagString()) && (!dto.getRentFlagString().equals("自住") && !dto.getRentFlagString().equals("出租") && !dto.getRentFlagString().equals("闲置"))){
nums.add(num);
disposeErrorMsg(info,"是否出租的值未填写或者所填写信息在系统中未找到");
disposeErrorMsg(info,"房屋状态的值未填写或者所填写信息在系统中未找到");
return;
}
dto.setRentFlag(HouseRentFlagEnums.getCodeByName(dto.getRentFlagString()));
@ -208,6 +208,7 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode
public void disposeErrorMsg(HouseInfoModel data,String msg){
HouseErrorInfoModel err = ConvertUtils.sourceToTarget(data, HouseErrorInfoModel.class);
err.setErrorMsg(msg);
err.setNum(err.getNum() + NumConstant.ONE);
errorInfos.add(err);
}

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportNeighborHoodInfoListener.java

@ -86,6 +86,7 @@ public class ImportNeighborHoodInfoListener extends AnalysisEventListener<Neighb
}
info = data;
num = num + NumConstant.ONE;
info.setNum(num);
if (StringUtils.isBlank(data.getNeighborHoodName()) ||
StringUtils.isBlank(data.getGridName()) || StringUtils.isBlank(data.getAgencyName()) || StringUtils.isBlank(data.getAddress())){
nums.add(num);
@ -333,6 +334,7 @@ public class ImportNeighborHoodInfoListener extends AnalysisEventListener<Neighb
public void disposeErrorMsg(NeighborHoodInfoModel data,String msg){
NeighborHoodErrorInfoModel err = ConvertUtils.sourceToTarget(data, NeighborHoodErrorInfoModel.class);
err.setErrorMsg(msg);
err.setNum(err.getNum() + NumConstant.ONE);
errorInfos.add(err);
}

3
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/NeighborHoodErrorInfoModel.java

@ -12,6 +12,9 @@ import lombok.Data;
@Data
public class NeighborHoodErrorInfoModel {
@Excel(name = "行号", width = 20)
private Integer num;
@Excel(name = "小区名称", width = 20)
private String neighborHoodName;

4
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/NeighborHoodInfoModel.java

@ -1,5 +1,6 @@
package com.epmet.model;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
@ -29,4 +30,7 @@ public class NeighborHoodInfoModel {
@ExcelProperty(value = "备注")
private String remark;
@ExcelIgnore
private Integer num;
}

8
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/redis/CustomerAgencyRedis.java

@ -20,7 +20,7 @@ package com.epmet.redis;
import cn.hutool.core.bean.BeanUtil;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
@ -44,19 +44,19 @@ public class CustomerAgencyRedis {
redisUtils.delete(key);
}
public void set(String agencyId, CustomerAgencyDTO value){
public void set(String agencyId, AgencyInfoCache value){
String key = RedisKeys.getAgencyByIdKey(agencyId);
Map<String, Object> map = BeanUtil.beanToMap(value, false, true);
redisUtils.hMSet(key, map);
}
public CustomerAgencyDTO get(String agencyId){
public AgencyInfoCache get(String agencyId){
String key = RedisKeys.getAgencyByIdKey(agencyId);
Map<String, Object> resultMap = redisUtils.hGetAll(key);
if (CollectionUtils.isEmpty(resultMap)) {
return null;
}
return BeanUtil.mapToBean(resultMap, CustomerAgencyDTO.class, true);
return BeanUtil.mapToBean(resultMap, AgencyInfoCache.class, true);
}
}

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

@ -90,6 +90,11 @@ public class IcHouseRedis {
return houseInfo;
}
public void delHouseInfo(String houseId,String customerId){
String key = RedisKeys.getHouseInfoCacheKey(houseId,customerId);
redisUtils.delete(key);
}
/**
* @Description 存放房屋临时缓存
* @param customerId

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

@ -17,16 +17,17 @@
package com.epmet.service;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.BuildingTreeLevelDTO;
import com.epmet.dto.form.IcBulidingFormDTO;
import com.epmet.dto.form.IcBuildingListFormDTO;
import com.epmet.dto.form.IcBulidingAddFormDTO;
import com.epmet.dto.form.IcHouseListFormDTO;
import com.epmet.dto.form.ImportInfoFormDTO;
import com.epmet.dto.form.ListIcNeighborHoodFormDTO;
import com.epmet.dto.result.BuildingResultDTO;
import com.epmet.dto.result.BuildingResultPagedDTO;
import com.epmet.dto.result.IcNeighborHoodResultDTO;
import com.epmet.dto.result.IcBuildingListResultDTO;
import com.epmet.dto.result.ImportTaskCommonResultDTO;
import com.epmet.excel.IcBuildingExcel;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@ -45,7 +46,7 @@ public interface BuildingService {
void updateBuilding(String customerId, IcBulidingFormDTO formDTO);
void updateBuilding(String customerId, IcBulidingAddFormDTO formDTO);
/**
* 删除小区
@ -54,15 +55,14 @@ public interface BuildingService {
void delBuilding(String buildingId);
void addBuilding(String customerId, IcBulidingFormDTO formDTO);
void addBuilding(String customerId, IcBulidingAddFormDTO formDTO);
List<BuildingTreeLevelDTO> treeList(String customerId, String staffId);
List<String> treeIds(String customerId, String staffId);
List<Integer> importExcel(String customerId, List<IcBuildingExcel> list, String staffId, List<Integer> numList);
PageData<IcBuildingListResultDTO> listBuilding(IcBuildingListFormDTO formDTO);
IcNeighborHoodResultDTO listBuilding(ListIcNeighborHoodFormDTO formDTO);
void exportBuildinginfo(ListIcNeighborHoodFormDTO formDTO, HttpServletResponse response) throws Exception ;
void exportBuildinginfo(IcHouseListFormDTO formDTO, HttpServletResponse response) throws Exception ;
List<BuildingResultDTO> buildingListByIds(List<String> buildingIdList);

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

@ -17,15 +17,15 @@
package com.epmet.service;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.IcHouseFormDTO;
import com.epmet.dto.form.IcHouseAddFormDTO;
import com.epmet.dto.form.IcHouseListFormDTO;
import com.epmet.dto.form.ImportInfoFormDTO;
import com.epmet.dto.form.ListIcNeighborHoodFormDTO;
import com.epmet.dto.form.NeighborHoodManageDelFormDTO;
import com.epmet.dto.result.HouseInfoDTO;
import com.epmet.dto.result.IcNeighborHoodResultDTO;
import com.epmet.dto.result.IcHouseListResultDTO;
import com.epmet.dto.result.ImportTaskCommonResultDTO;
import com.epmet.excel.IcHouseExcel;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
@ -40,10 +40,10 @@ import java.util.Set;
*/
public interface HouseService {
void addHouse(String customerId, IcHouseFormDTO formDTO);
void addHouse(String customerId, IcHouseAddFormDTO formDTO);
void updateHouse(String customerId, IcHouseFormDTO formDTO);
void updateHouse(String customerId, IcHouseAddFormDTO formDTO);
/**
* 删除小区
@ -51,20 +51,9 @@ public interface HouseService {
*/
void delHouse(String houseId);
PageData<IcHouseListResultDTO> getHouseList(IcHouseListFormDTO formDTO);
List<Integer> importExcel(String customerId, List<IcHouseExcel> list, String staffId, List<Integer> numList);
IcNeighborHoodResultDTO listNeighborhood(String ancestorAgencyId,
String buildingId,
String ownerName,
String ownerPhone,
String neighborHoodName,
String buildingName,
String queryScene,
Integer pageNo,
Integer pageSize);
void exportBuildinginfo(ListIcNeighborHoodFormDTO formDTO, HttpServletResponse response) throws Exception;
void exportBuildinginfo(IcHouseListFormDTO formDTO, HttpServletResponse response) throws Exception;
List<HouseInfoDTO> queryListHouseInfo(Set<String> houseIds, String customerId);
@ -79,4 +68,4 @@ public interface HouseService {
void allDelete(NeighborHoodManageDelFormDTO formDTO);
HouseInfoDTO getHouseInfoDTO(String customerId,String houseId);
}
}

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

@ -8,6 +8,7 @@ import com.epmet.dto.IcHouseDTO;
import com.epmet.dto.ImportGeneralDTO;
import com.epmet.dto.form.HouseFormDTO;
import com.epmet.dto.result.HouseListResultDTO;
import com.epmet.dto.result.HousesNameResultDTO;
import com.epmet.entity.IcHouseEntity;
import java.util.List;
@ -116,4 +117,12 @@ public interface IcHouseService extends BaseService<IcHouseEntity> {
*/
void houseUpdate(List<ImportGeneralDTO> houses);
/**
* Desc: 根据身份证查询房屋名
* @param idCards
* @author zxc
* @date 2022/4/12 16:42
*/
List<HousesNameResultDTO> getHousesNameByIdCards(List<String> idCards);
}

4
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcNeighborHoodService.java

@ -23,7 +23,7 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.IcNeighborHoodDTO;
import com.epmet.dto.ImportGeneralDTO;
import com.epmet.dto.form.IcNeighborHoodFormDTO;
import com.epmet.dto.form.IcNeighborHoodAddFormDTO;
import com.epmet.dto.form.ImportInfoFormDTO;
import com.epmet.dto.result.ImportTaskCommonResultDTO;
import com.epmet.entity.IcNeighborHoodEntity;
@ -154,5 +154,5 @@ public interface IcNeighborHoodService extends BaseService<IcNeighborHoodEntity>
* @param params
* @return
*/
PageData<IcNeighborHoodDTO> openPage(IcNeighborHoodFormDTO params);
PageData<IcNeighborHoodDTO> openPage(IcNeighborHoodAddFormDTO params);
}

22
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/NeighborHoodService.java

@ -17,13 +17,13 @@
package com.epmet.service;
import com.epmet.dto.form.IcNeighborHoodFormDTO;
import com.epmet.dto.form.ListIcNeighborHoodFormDTO;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.form.IcHouseListFormDTO;
import com.epmet.dto.form.IcNeighborHoodAddFormDTO;
import com.epmet.dto.form.IcNeighborHoodListFormDTO;
import com.epmet.dto.result.IcNeighborHoodResultDTO;
import com.epmet.excel.IcNeighborHoodExcel;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 小区表
@ -33,24 +33,22 @@ import java.util.List;
*/
public interface NeighborHoodService{
void AddNeighborhood(String customerId, IcNeighborHoodFormDTO formDTO);
void addNeighborhood(String customerId, IcNeighborHoodAddFormDTO formDTO);
IcNeighborHoodResultDTO listNeighborhood(ListIcNeighborHoodFormDTO formDTO);
PageData<IcNeighborHoodResultDTO> listNeighborhood(IcNeighborHoodListFormDTO formDTO);
void UpdateNeighborhood(String customerId, IcNeighborHoodFormDTO formDTO);
void updateNeighborhood(String customerId, IcNeighborHoodAddFormDTO formDTO);
/**
* 删除小区
* @param neighborHoodId
*/
void DelNeighborhood(String neighborHoodId);
void delNeighborhood(String neighborHoodId);
/**
* 导出数据
* @param formDTO
* @param response
*/
void exportNeighborhoodinfo(ListIcNeighborHoodFormDTO formDTO, HttpServletResponse response) throws Exception ;
List<Integer> importExcel(String customerId, List<IcNeighborHoodExcel> list, String staffId, List<Integer> numList);
}
void exportNeighborhoodinfo(IcHouseListFormDTO formDTO, HttpServletResponse response) throws Exception ;
}

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

@ -20,6 +20,7 @@ package com.epmet.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
@ -490,16 +491,53 @@ public class AgencyServiceImpl implements AgencyService {
@Override
public CustomerAgencyDTO getAgencyById(String agencyId) {
CustomerAgencyDTO cachedAgency = customerAgencyRedis.get(agencyId);
if (cachedAgency == null) {
cachedAgency = new CustomerAgencyDTO();
AgencyInfoCache agencyInfoCache = customerAgencyRedis.get(agencyId);
if (agencyInfoCache == null) {
agencyInfoCache = new AgencyInfoCache();
CustomerAgencyEntity agencyEntity = customerAgencyDao.selectById(agencyId);
if (agencyEntity != null) {
BeanUtils.copyProperties(agencyEntity, cachedAgency);
//设置行政地区编码全路径
if (StringUtils.isNotBlank(agencyEntity.getAreaCode()) && StringUtils.isNotBlank(agencyEntity.getParentAreaCode())) {
agencyInfoCache.setAreaCodePath(queryAreaCodePath(agencyEntity));
}
BeanUtils.copyProperties(agencyEntity, agencyInfoCache);
}
customerAgencyRedis.set(agencyId, cachedAgency);
customerAgencyRedis.set(agencyId, agencyInfoCache);
}
CustomerAgencyDTO customerAgencyDTO=ConvertUtils.sourceToTarget(agencyInfoCache,CustomerAgencyDTO.class);
return customerAgencyDTO;
}
private List<String> queryAreaCodePath(CustomerAgencyEntity customerAgencyEntity) {
List<String> areaCodePath = new ArrayList<>();
switch (customerAgencyEntity.getLevel()) {
case Constant.COMMUNITY:
areaCodePath.add(customerAgencyEntity.getAreaCode().substring(NumConstant.ZERO, NumConstant.TWO));
areaCodePath.add(customerAgencyEntity.getAreaCode().substring(NumConstant.ZERO, NumConstant.FOUR));
areaCodePath.add(customerAgencyEntity.getAreaCode().substring(NumConstant.ZERO, NumConstant.SIX));
areaCodePath.add(customerAgencyEntity.getParentAreaCode());
areaCodePath.add(customerAgencyEntity.getAreaCode());
break;
case Constant.STREET:
areaCodePath.add(customerAgencyEntity.getAreaCode().substring(NumConstant.ZERO, NumConstant.TWO));
areaCodePath.add(customerAgencyEntity.getAreaCode().substring(NumConstant.ZERO, NumConstant.FOUR));
areaCodePath.add(customerAgencyEntity.getParentAreaCode());
areaCodePath.add(customerAgencyEntity.getAreaCode());
break;
case Constant.DISTRICT:
areaCodePath.add(customerAgencyEntity.getAreaCode().substring(NumConstant.ZERO, NumConstant.TWO));
areaCodePath.add(customerAgencyEntity.getParentAreaCode());
areaCodePath.add(customerAgencyEntity.getAreaCode());
break;
case Constant.CITY:
areaCodePath.add(customerAgencyEntity.getParentAreaCode());
areaCodePath.add(customerAgencyEntity.getAreaCode());
break;
case Constant.PROVINCE:
areaCodePath.add(customerAgencyEntity.getAreaCode());
break;
}
return cachedAgency;
return areaCodePath;
}
@Override

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

@ -7,6 +7,7 @@ import com.alibaba.excel.read.metadata.ReadSheet;
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.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import com.epmet.commons.tools.constant.NumConstant;
@ -16,6 +17,8 @@ import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerIcHouseRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
@ -23,13 +26,10 @@ import com.epmet.constants.ImportTaskConstants;
import com.epmet.dao.*;
import com.epmet.dto.BuildingTreeLevelDTO;
import com.epmet.dto.IcBuildingDTO;
import com.epmet.dto.form.IcBulidingFormDTO;
import com.epmet.dto.form.ImportInfoFormDTO;
import com.epmet.dto.form.ImportTaskCommonFormDTO;
import com.epmet.dto.form.ListIcNeighborHoodFormDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.BuildingResultDTO;
import com.epmet.dto.result.BuildingResultPagedDTO;
import com.epmet.dto.result.IcNeighborHoodResultDTO;
import com.epmet.dto.result.IcBuildingListResultDTO;
import com.epmet.dto.result.ImportTaskCommonResultDTO;
import com.epmet.entity.*;
import com.epmet.enums.BuildingTypeEnums;
@ -38,8 +38,13 @@ import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.model.BuildingInfoModel;
import com.epmet.model.ImportBuildingInfoListener;
import com.epmet.redis.IcHouseRedis;
import com.epmet.service.*;
import com.epmet.service.BuildingService;
import com.epmet.service.IcBuildingService;
import com.epmet.service.IcBuildingUnitService;
import com.epmet.service.IcNeighborHoodService;
import com.epmet.util.ExcelPoiUtils;
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;
@ -49,11 +54,12 @@ import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.function.Function;
import java.util.stream.Collectors;
@Slf4j
@ -65,15 +71,10 @@ public class BuildingServiceImpl implements BuildingService {
private IcBuildingService icBuildingService;
@Resource
private IcBuildingDao icBuildingDao;
@Autowired
private IcBuildingUnitService icBuildingUnitService;
@Resource
private IcHouseDao icHouseDao;
@Autowired
private IcHouseService icHouseService;
@Resource
private CustomerAgencyDao customerAgencyDao;
@Resource
@ -81,8 +82,6 @@ public class BuildingServiceImpl implements BuildingService {
@Resource
private IcNeighborHoodDao icNeighborHoodDao;
@Resource
private CustomerStaffAgencyDao customerStaffAgencyDao;
@Resource
private IcBuildingUnitDao icBuildingUnitDao;
@Autowired
private IcHouseRedis icHouseRedis;
@ -95,13 +94,13 @@ public class BuildingServiceImpl implements BuildingService {
@Override
@Transactional(rollbackFor = Exception.class)
public void addBuilding(String customerId, IcBulidingFormDTO formDTO) {
public void addBuilding(String customerId, IcBulidingAddFormDTO formDTO) {
//同一小区下不能存在楼栋名字一样的
Integer count = icBuildingDao.checkBuildName(formDTO.getNeighborHoodId(),formDTO.getBuildingName(),null);
Integer count = icBuildingDao.checkBuildName(formDTO.getNeighborHoodId(), formDTO.getBuildingName(), null);
if (null != count && count > 0) {
throw new RenException(EpmetErrorCode.BUILDING_NAME_EXITED.getCode(),EpmetErrorCode.BUILDING_NAME_EXITED.getMsg());
throw new RenException(EpmetErrorCode.BUILDING_NAME_EXITED.getCode(), EpmetErrorCode.BUILDING_NAME_EXITED.getMsg());
}
IcBuildingDTO icBuildingDTO= ConvertUtils.sourceToTarget(formDTO, IcBuildingDTO.class);
IcBuildingDTO icBuildingDTO = ConvertUtils.sourceToTarget(formDTO, IcBuildingDTO.class);
icBuildingDTO.setCustomerId(customerId);
IcBuildingEntity entity = ConvertUtils.sourceToTarget(icBuildingDTO, IcBuildingEntity.class);
icBuildingDao.insert(entity);
@ -109,23 +108,23 @@ public class BuildingServiceImpl implements BuildingService {
//设置楼宇单元
Integer totalUnitNum = formDTO.getTotalUnitNum();
List<IcBuildingUnitEntity> unitList = new ArrayList<>();
for(int i =0 ;i<totalUnitNum;i++){
IcBuildingUnitEntity icBuildingUnit= new IcBuildingUnitEntity();
for (int i = 0; i < totalUnitNum; i++) {
IcBuildingUnitEntity icBuildingUnit = new IcBuildingUnitEntity();
icBuildingUnit.setCustomerId(customerId);
icBuildingUnit.setBuildingId(entity.getId());
icBuildingUnit.setUnitName((i + 1) +"单元");
icBuildingUnit.setUnitNum(String.valueOf(i+1));
icBuildingUnit.setUnitName((i + 1) + "单元");
icBuildingUnit.setUnitNum(String.valueOf(i + 1));
unitList.add(icBuildingUnit);
}
icBuildingUnitService.insertBatch(unitList);
icBuildingUnitService.insertBatch(unitList, NumConstant.ONE_HUNDRED);
}
@Override
public List<BuildingTreeLevelDTO> treeList(String customerId, String staffId) {
CustomerStaffInfoCacheResult agency = CustomerStaffRedis.getStaffInfo(customerId, staffId);
if(null == agency || StringUtils.isBlank(agency.getAgencyId())){
log.error("com.epmet.service.impl.BuildingServiceImpl.treeList,没有找到工作人员所属的机关信息,用户Id:{}",staffId);
if (null == agency || StringUtils.isBlank(agency.getAgencyId())) {
log.error("com.epmet.service.impl.BuildingServiceImpl.treeList,没有找到工作人员所属的机关信息,用户Id:{}", staffId);
return new ArrayList<>();
}
@ -136,7 +135,7 @@ public class BuildingServiceImpl implements BuildingService {
List<CustomerAgencyEntity> customerAgencyList = icBuildingDao.selectAgencyChildrenList(agency.getAgencyId());
customerAgencyList.add(customerAgency);
if(CollectionUtils.isEmpty(customerAgencyList)){
if (CollectionUtils.isEmpty(customerAgencyList)) {
return new ArrayList<>();
}
@ -155,14 +154,13 @@ public class BuildingServiceImpl implements BuildingService {
}).collect(Collectors.toList());
//2.获取组织所在网格
List<String> agencyIdList = customerAgencyList.stream().map(BaseEpmetEntity::getId).collect(Collectors.toList());
// agencyIdList.add(customerAgency.getId());
List<CustomerGridEntity> customerGridList = customerGridDao.selectList(new QueryWrapper<CustomerGridEntity>().lambda().in(CustomerGridEntity::getPid, agencyIdList));
if(CollectionUtils.isEmpty(customerGridList)){
return covertToTree(customerAgency,agencyList);
if (CollectionUtils.isEmpty(customerGridList)) {
return covertToTree(customerAgency, agencyList);
}
List<BuildingTreeLevelDTO> gridList = customerGridList.stream().map(item -> {
@ -186,9 +184,9 @@ public class BuildingServiceImpl implements BuildingService {
.in(IcNeighborHoodEntity::getGridId, gridIdList)
.orderByAsc(IcNeighborHoodEntity::getCreatedTime);
List<IcNeighborHoodEntity> icNeighborHoodList = icNeighborHoodDao.selectList(queryWrapper);
if(CollectionUtils.isEmpty(icNeighborHoodList)){
if (CollectionUtils.isEmpty(icNeighborHoodList)) {
agencyList.addAll(gridList);
return covertToTree(customerAgency,agencyList);
return covertToTree(customerAgency, agencyList);
}
List<BuildingTreeLevelDTO> neighbourHoodList = icNeighborHoodList.stream().map(item -> {
BuildingTreeLevelDTO buildingTreeLevelDTO = new BuildingTreeLevelDTO();
@ -208,13 +206,13 @@ public class BuildingServiceImpl implements BuildingService {
List<String> neighborHoodIdList = icNeighborHoodList.stream().map(BaseEpmetEntity::getId).collect(Collectors.toList());
LambdaQueryWrapper<IcBuildingEntity> buildingQueryWrapper = new QueryWrapper<IcBuildingEntity>().lambda()
.in(IcBuildingEntity::getNeighborHoodId, neighborHoodIdList)
.orderByAsc(IcBuildingEntity::getCreatedTime,IcBuildingEntity::getBuildingName);
.orderByAsc(IcBuildingEntity::getCreatedTime, IcBuildingEntity::getBuildingName);
List<IcBuildingEntity> icBuildingList = icBuildingDao.selectList(buildingQueryWrapper);
if(CollectionUtils.isEmpty(neighborHoodIdList)){
if (CollectionUtils.isEmpty(neighborHoodIdList)) {
agencyList.addAll(gridList);
agencyList.addAll(neighbourHoodList);
return covertToTree(customerAgency,agencyList);
return covertToTree(customerAgency, agencyList);
}
//获取楼里已经有多少个房屋
LambdaQueryWrapper<IcHouseEntity> icHouseEntityWrapper = new QueryWrapper<IcHouseEntity>().lambda()
@ -248,10 +246,10 @@ public class BuildingServiceImpl implements BuildingService {
// .in(IcHouseEntity::getBuildingId, item.getId());
// int count= icHouseDao.selectCount(icHouseEntityWrapper);
int count = buildingHouseCountMap.getOrDefault(item.getId(), NumConstant.ZERO_L).intValue();
if(NumConstant.ZERO==total){
buildingTreeLevelDTO.setShowNum(String.format("%s/%s",count,count));
}else{
buildingTreeLevelDTO.setShowNum(String.format("%s/%s",count,total));
if (NumConstant.ZERO == total) {
buildingTreeLevelDTO.setShowNum(String.format("%s/%s", count, count));
} else {
buildingTreeLevelDTO.setShowNum(String.format("%s/%s", count, total));
}
return buildingTreeLevelDTO;
}).collect(Collectors.toList());
@ -259,131 +257,78 @@ public class BuildingServiceImpl implements BuildingService {
agencyList.addAll(gridList);
agencyList.addAll(neighbourHoodList);
agencyList.addAll(buildingList);
return covertToTree(customerAgency,agencyList);
return covertToTree(customerAgency, agencyList);
}
@Override
@Transactional(rollbackFor = Exception.class)
public List<Integer> importExcel(String customerId, List<IcBuildingExcel> list, String staffId, List<Integer> numList) {
//2021.11.9 需求变更 当前工作人员只能导致自己所属组织下数据,网格名对应不上的数据舍弃【注:需求就这样】 sun
CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(customerId, staffId);
//组织名称不一样的数据舍弃
Iterator<IcBuildingExcel> iterator = list.iterator();
while (iterator.hasNext()) {
IcBuildingExcel obj = iterator.next();
if (!obj.getAgencyName().trim().equals(staffInfoCache.getAgencyName())) {
numList.add(obj.getRowNum());
iterator.remove();
}
public List<String> treeIds(String customerId, String staffId) {
List<String> result = new ArrayList<>();
CustomerStaffInfoCacheResult agency = CustomerStaffRedis.getStaffInfo(customerId, staffId);
if (null == agency || StringUtils.isBlank(agency.getAgencyId())) {
log.error("com.epmet.service.impl.BuildingServiceImpl.treeIds,没有找到工作人员所属的机关信息,用户Id:{}", staffId);
return new ArrayList<>();
}
//用于存储匹配不上的数据给前端的提示 如南宁社区不存在
//StringBuffer str = new StringBuffer("");
//end sun
//导入
if(CollectionUtils.isEmpty(list)){
return numList;
//1.获取所在组织及下级组织
CustomerAgencyEntity customerAgency = customerAgencyDao.selectById(agency.getAgencyId());
List<CustomerAgencyEntity> customerAgencyList = icBuildingDao.selectAgencyChildrenList(agency.getAgencyId());
customerAgencyList.add(customerAgency);
if (CollectionUtils.isEmpty(customerAgencyList)) {
return new ArrayList<>();
}
//查询所有组织和网格根据名字
//获取所有小区 list 根据组织和网格
Set<String> neighborNameList = list.stream().map(item -> item.getNeighborHoodName()).collect(Collectors.toSet());
Set<String> agencyNameList = list.stream().map(item -> item.getAgencyName()).collect(Collectors.toSet());
Set<String> gridNameList = list.stream().map(item -> item.getGridName()).collect(Collectors.toSet());
List<IcNeighborHoodEntity> neighborHoodList = icNeighborHoodDao.selectListByName(customerId, new ArrayList<String>(neighborNameList),new ArrayList<String>(agencyNameList),new ArrayList<String>(gridNameList));
// List<IcNeighborHoodEntity> neighborHoodList = icNeighborHoodDao.selectList(new QueryWrapper<IcNeighborHoodEntity>().lambda().in(IcNeighborHoodEntity::getNeighborHoodName, neighborNameList));
Map<String,IcNeighborHoodEntity> neighborHoodMap = neighborHoodList.stream().collect(Collectors.toMap(IcNeighborHoodEntity::getNeighborHoodName, Function.identity(),(key1, key2)->key1));
//2.获取小区数据
//封装数据
List<IcBuildingEntity> buildingEntityList = new ArrayList<>();
List<IcBuildingUnitEntity> icBuildingUnitEntityList = new ArrayList<>();
Iterator<IcBuildingExcel> iterator1 = list.iterator();
while (iterator1.hasNext()) {
IcBuildingExcel icBuildingExcel = iterator1.next();
IcBuildingEntity entity = new IcBuildingEntity();
String uuid = UUID.randomUUID().toString().replace("-", "");
entity.setId(uuid);
entity.setCustomerId(customerId);
entity.setNeighborHoodId(Optional.ofNullable(neighborHoodMap.get(icBuildingExcel.getNeighborHoodName())).map(u->u.getId()).orElse(""));//neighborHoodMap.get(icBuildingExcel.getNeighborHoodName()).getId()
if ("".equals(entity.getNeighborHoodId())) {
//str.append("".equals(str) ? icBuildingExcel.getNeighborHoodName() : str.append("、").append(icBuildingExcel.getNeighborHoodName()));
numList.add(icBuildingExcel.getRowNum());
iterator1.remove();
continue;
}
entity.setBuildingName(icBuildingExcel.getBuildingName());
entity.setType(BuildingTypeEnums.getKeyByValue(icBuildingExcel.getType()));
entity.setSort(0);
entity.setTotalUnitNum(icBuildingExcel.getTotalUnitNum());
entity.setTotalFloorNum(icBuildingExcel.getTotalFloorNum());
entity.setTotalHouseNum(icBuildingExcel.getTotalHouseNum());
buildingEntityList.add(entity);
Integer totalUnitNum = icBuildingExcel.getTotalUnitNum();
//设置楼宇单元
List<IcBuildingUnitEntity> unitList = new ArrayList<>();
for(int i =0 ;i<totalUnitNum;i++){
IcBuildingUnitEntity icBuildingUnit= new IcBuildingUnitEntity();
icBuildingUnit.setBuildingId(uuid);
icBuildingUnit.setCustomerId(customerId);
icBuildingUnit.setUnitName((i + 1) +"单元");
icBuildingUnit.setUnitNum(String.valueOf(i+1));
unitList.add(icBuildingUnit);
}
//同一小区下不能存在楼栋名字一样的
Integer count = icBuildingDao.checkBuildName(entity.getNeighborHoodId(),entity.getBuildingName(),null);
if (null != count && count > 0) {
//throw new RenException(EpmetErrorCode.BUILDING_NAME_EXITED.getCode(),EpmetErrorCode.BUILDING_NAME_EXITED.getMsg());
log.error(EpmetErrorCode.BUILDING_NAME_EXITED.getMsg());
numList.add(icBuildingExcel.getRowNum());
iterator1.remove();
continue;
}
icBuildingUnitEntityList.addAll(unitList);
result.addAll(customerAgencyList.stream().map(m -> m.getId()).collect(Collectors.toList()));
List<BuildingTreeLevelDTO> agencyList = customerAgencyList.stream().map(item -> {
BuildingTreeLevelDTO buildingTreeLevelDTO = new BuildingTreeLevelDTO();
buildingTreeLevelDTO.setId(item.getId());
buildingTreeLevelDTO.setPId(item.getPid());
buildingTreeLevelDTO.setLabel(item.getOrganizationName());
buildingTreeLevelDTO.setLevel(item.getLevel());
buildingTreeLevelDTO.setLongitude(item.getLongitude());
buildingTreeLevelDTO.setLatitude(item.getLatitude());
buildingTreeLevelDTO.setChildren(new ArrayList<>());
//当前组织有几个下级组织
buildingTreeLevelDTO.setShowNum(StrConstant.EPMETY_STR);
return buildingTreeLevelDTO;
}).collect(Collectors.toList());
//2.获取组织所在网格
List<String> agencyIdList = customerAgencyList.stream().map(BaseEpmetEntity::getId).collect(Collectors.toList());
List<CustomerGridEntity> customerGridList = customerGridDao.selectList(new QueryWrapper<CustomerGridEntity>().lambda().in(CustomerGridEntity::getPid, agencyIdList));
if (CollectionUtils.isEmpty(customerGridList)) {
return result;
}
//3.保存
//4.新增单元
icBuildingService.insertBatch(buildingEntityList);
icBuildingUnitService.insertBatch(icBuildingUnitEntityList);
/* if(!"".equals(str)){
return new Result().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), str.append("不存在").toString());
}*/
return numList;
result.addAll(customerGridList.stream().map(m -> m.getId()).collect(Collectors.toList()));
return result;
}
@Override
public IcNeighborHoodResultDTO listBuilding(ListIcNeighborHoodFormDTO formDTO) {
IcNeighborHoodResultDTO result = new IcNeighborHoodResultDTO();
IPage<Map<String, Object>> resultMap = searchBuilding(formDTO);
result.setTotal(Long.valueOf(resultMap.getTotal()).intValue());
result.setList(resultMap.getRecords());
return result;
public PageData<IcBuildingListResultDTO> listBuilding(IcBuildingListFormDTO formDTO) {
PageInfo<IcBuildingListResultDTO> pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage())
.doSelectPageInfo(() -> icBuildingDao.searchBuildingByPage(formDTO));
List<IcBuildingListResultDTO> records = pageInfo.getList();
records.forEach(item -> item.setBuildingType(BuildingTypeEnums.getTypeValue(item.getBuildingTypeKey())));
return new PageData<>(pageInfo.getList(), pageInfo.getTotal());
}
@Override
public void exportBuildinginfo(ListIcNeighborHoodFormDTO formDTO, HttpServletResponse response) throws Exception {
public void exportBuildinginfo(IcHouseListFormDTO formDTO, HttpServletResponse response) throws Exception {
//如果类型是building 查楼栋
//导出楼栋
List<IcBuildingExcel> icBuildingExcels = searchAllBuilding(formDTO);
TemplateExportParams templatePath = new TemplateExportParams("excel/building_export.xlsx");
Map<String,Object> map = new HashMap<>();
map.put("maplist",icBuildingExcels);
ExcelPoiUtils.exportExcel(templatePath ,map,"楼宇信息录入表",response);
return ;
Map<String, Object> map = new HashMap<>();
map.put("maplist", icBuildingExcels);
ExcelPoiUtils.exportExcel(templatePath, map, "楼栋信息录入表", response);
return;
}
@Override
public List<BuildingResultDTO> buildingListByIds(List<String> buildingIdList) {
return icBuildingDao.buildingListByIds(buildingIdList);
}
@Override
public BuildingResultPagedDTO buildinglistbyidsPage(List<String> buildingIdList,Integer pageNo, Integer pageSize) {
IPage<IcBuildingEntity> page = new Page<IcBuildingEntity>(pageNo,pageSize);
public BuildingResultPagedDTO buildinglistbyidsPage(List<String> buildingIdList, Integer pageNo, Integer pageSize) {
IPage<IcBuildingEntity> page = new Page<IcBuildingEntity>(pageNo, pageSize);
IPage<BuildingResultDTO> buildingResultDTOIPage = icBuildingDao.buildingListByIds(page, buildingIdList);
BuildingResultPagedDTO result = new BuildingResultPagedDTO();
result.setTotal(Long.valueOf(buildingResultDTOIPage.getTotal()).intValue());
@ -393,29 +338,29 @@ public class BuildingServiceImpl implements BuildingService {
}
/**
* @param formDTO
* @param inputStream
* @Description 楼宇导入
* 根据左侧树选中的层级可导入对应数据
* 根据左侧树选中的层级可导入对应数据
* 1. 选中社区可导入该社区下所有小区信息楼宇信息房屋信息没有匹配的小区楼宇均新增网格没有对应的不新增
* 2. 选中网格可导入该网格下所有小区信息楼宇信息房屋信息没有匹配的小区楼宇均新增
* 3. 选中小区可导入该小区下所有楼宇信息房屋信息没有匹配的楼宇均新增
* 4. 选中楼宇可导入该楼宇下所有房屋信息
* @param formDTO
* @param file
* @author zxc
* @date 2022/2/13 10:15 上午
*/
@Override
public Result buildingImportExcel(ImportInfoFormDTO formDTO, InputStream inputStream,Result<ImportTaskCommonResultDTO> importTask) throws IOException {
public Result buildingImportExcel(ImportInfoFormDTO formDTO, InputStream inputStream, Result<ImportTaskCommonResultDTO> importTask) {
executorService.submit(() -> {
ExcelReader excelReader = null;
try {
excelReader = EasyExcel.read(inputStream).build();
// 这里为了简单 所以注册了 同样的head 和Listener 自己使用功能必须不同的Listener
ReadSheet readSheet = EasyExcel.readSheet(0).head(BuildingInfoModel.class)
.registerReadListener(new ImportBuildingInfoListener(formDTO,icHouseRedis,icBuildingDao,neighborHoodService,epmetCommonServiceOpenFeignClient,importTask.getData().getTaskId()))
.registerReadListener(new ImportBuildingInfoListener(formDTO, icHouseRedis, icBuildingDao, neighborHoodService, epmetCommonServiceOpenFeignClient, importTask.getData().getTaskId()))
.build();
excelReader.read(readSheet);
} catch (Exception e){
} catch (Exception e) {
ImportTaskCommonFormDTO input = new ImportTaskCommonFormDTO();
input.setOperatorId(formDTO.getUserId());
input.setTaskId(importTask.getData().getTaskId());
@ -430,48 +375,19 @@ public class BuildingServiceImpl implements BuildingService {
return new Result<>();
}
private List<IcBuildingExcel> searchAllBuilding(ListIcNeighborHoodFormDTO formDTO) {
// QueryWrapper<IcNeighborHoodEntity> neighborHoodEntityQueryWrapper = new QueryWrapper<>();
// neighborHoodEntityQueryWrapper.lambda()
// .eq(!StringUtils.isEmpty(formDTO.getAgencyId()),IcNeighborHoodEntity::getAgencyId,formDTO.getAgencyId())
// .eq(!StringUtils.isEmpty(formDTO.getGridId()),IcNeighborHoodEntity::getId,formDTO.getGridId())
// .eq(!StringUtils.isEmpty(formDTO.getNeighborHoodId()),IcNeighborHoodEntity::getId,formDTO.getNeighborHoodId())
// .like(!StringUtils.isEmpty(formDTO.getNeighborHoodName()),IcNeighborHoodEntity::getNeighborHoodName,formDTO.getNeighborHoodName());
// IcNeighborHoodEntity neighbor = ConvertUtils.sourceToTarget(formDTO, IcNeighborHoodEntity.class);
// QueryWrapper<IcBuildingEntity> buildingEntityQueryWrapper = new QueryWrapper<>();
// buildingEntityQueryWrapper.lambda()
// .eq(!StringUtils.isEmpty(formDTO.getBuildingId()),IcBuildingEntity::getId,formDTO.getBuildingId())
// .like(!StringUtils.isEmpty(formDTO.getBuildingName()),IcBuildingEntity::getBuildingName,formDTO.getBuildingName());
// buildingEntityQueryWrapper.eq("a.DEL_FLAG","0");
private List<IcBuildingExcel> searchAllBuilding(IcHouseListFormDTO formDTO) {
IcBuildingEntity building = ConvertUtils.sourceToTarget(formDTO, IcBuildingEntity.class);
building.setDelFlag("0");
IcHouseEntity house = ConvertUtils.sourceToTarget(formDTO, IcHouseEntity.class);
List<IcBuildingExcel> icBuildingExcels = icBuildingDao.searchAllBuilding(building, house);
icBuildingExcels.forEach(item->{
icBuildingExcels.forEach(item -> {
item.setType(BuildingTypeEnums.getTypeValue(item.getType()));
});
return icBuildingExcels;
}
private IPage<Map<String, Object>> searchBuilding(ListIcNeighborHoodFormDTO formDTO) {
IPage<IcBuildingEntity> page = new Page<IcBuildingEntity>(formDTO.getPageNo(),formDTO.getPageSize());
IcBuildingEntity building = ConvertUtils.sourceToTarget(formDTO, IcBuildingEntity.class);
building.setDelFlag("0");
IcHouseEntity house = ConvertUtils.sourceToTarget(formDTO, IcHouseEntity.class);
IPage<Map<String, Object>> mapIPage = icBuildingDao.searchBuildingByPage(page, building, house);
List<Map<String, Object>> records = mapIPage.getRecords();
records.forEach(item->{
item.put("buildingType", BuildingTypeEnums.getTypeValue(item.get("buildingTypeKey")));
});
return mapIPage;
}
private List<BuildingTreeLevelDTO> covertToTree(CustomerAgencyEntity customerAgency,List<BuildingTreeLevelDTO> agencyList) {
private List<BuildingTreeLevelDTO> covertToTree(CustomerAgencyEntity customerAgency, List<BuildingTreeLevelDTO> agencyList) {
BuildingTreeLevelDTO buildingTreeLevelDTO = new BuildingTreeLevelDTO();
buildingTreeLevelDTO.setId(customerAgency.getId());
buildingTreeLevelDTO.setLabel(customerAgency.getOrganizationName());
@ -479,7 +395,7 @@ public class BuildingServiceImpl implements BuildingService {
buildingTreeLevelDTO.setLongitude(customerAgency.getLongitude());
buildingTreeLevelDTO.setLatitude(customerAgency.getLatitude());
buildingTreeLevelDTO.setChildren(new ArrayList<>());
recursionCovertToTree(buildingTreeLevelDTO,agencyList);
recursionCovertToTree(buildingTreeLevelDTO, agencyList);
List<BuildingTreeLevelDTO> result = new ArrayList<>();
result.add(buildingTreeLevelDTO);
return result;
@ -489,78 +405,87 @@ public class BuildingServiceImpl implements BuildingService {
//获取子节点
List<BuildingTreeLevelDTO> subList = customerAgencyList.stream().filter(item -> item.getPId().equals(parent.getId())).collect(Collectors.toList());
for(BuildingTreeLevelDTO agencyEntity :subList){
recursionCovertToTree(agencyEntity,customerAgencyList);
for (BuildingTreeLevelDTO agencyEntity : subList) {
recursionCovertToTree(agencyEntity, customerAgencyList);
}
parent.setChildren(subList);
if(!"building".equals(parent.getLevel())){
if (!"building".equals(parent.getLevel())) {
parent.setShowNum(CollectionUtils.isEmpty(subList) ? NumConstant.ZERO_STR : String.valueOf(subList.size()));
}
parent.setShowName(String.format("%s(%s)",parent.getLabel(),parent.getShowNum()));
parent.setShowName(String.format("%s(%s)", parent.getLabel(), parent.getShowNum()));
}
/**
* 更新
*
* @param customerId
* @param formDTO
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void updateBuilding(String customerId, IcBulidingFormDTO formDTO) {
public void updateBuilding(String customerId, IcBulidingAddFormDTO formDTO) {
//同一小区下不能存在楼栋名字一样的
Integer count = icBuildingDao.checkBuildName(formDTO.getNeighborHoodId(),formDTO.getBuildingName(),formDTO.getBuildingId());
Integer count = icBuildingDao.checkBuildName(formDTO.getNeighborHoodId(), formDTO.getBuildingName(), formDTO.getBuildingId());
if (null != count && count > 0) {
throw new RenException(EpmetErrorCode.BUILDING_NAME_EXITED.getCode(),EpmetErrorCode.BUILDING_NAME_EXITED.getMsg());
throw new RenException(EpmetErrorCode.BUILDING_NAME_EXITED.getCode(), EpmetErrorCode.BUILDING_NAME_EXITED.getMsg());
}
IcBuildingDTO icBuilding= icBuildingService.get(formDTO.getBuildingId());
IcBuildingDTO icBuilding = icBuildingService.get(formDTO.getBuildingId());
if(!icBuilding.getNeighborHoodId().equals(formDTO.getNeighborHoodId())){
if (!icBuilding.getNeighborHoodId().equals(formDTO.getNeighborHoodId())) {
//更新对应房屋小区id
List<IcHouseEntity> icHouseEntities = icHouseDao.selectList(new QueryWrapper<IcHouseEntity>().lambda().eq(IcHouseEntity::getBuildingId, formDTO.getBuildingId()));
if(!CollectionUtils.isEmpty(icHouseEntities)){
if (!CollectionUtils.isEmpty(icHouseEntities)) {
//
throw new RenException(EpmetErrorCode.ORG_EDIT_FAILED.getCode(),"楼宇单元下存在房屋,无法更新");
// icHouseEntities.forEach(item->{
// item.setNeighborHoodId(formDTO.getNeighborHoodId());
// });
// icHouseService.updateBatchById(icHouseEntities);
throw new RenException(EpmetErrorCode.ORG_EDIT_FAILED.getCode(), "楼栋单元下存在房屋,无法更新");
}
}
IcBuildingDTO icBuildingDTO= ConvertUtils.sourceToTarget(formDTO, IcBuildingDTO.class);
IcBuildingDTO icBuildingDTO = ConvertUtils.sourceToTarget(formDTO, IcBuildingDTO.class);
icBuildingDTO.setId(formDTO.getBuildingId());
icBuildingDTO.setCustomerId(customerId);
icBuildingService.update(icBuildingDTO);
//更新楼宇单元
//如果楼宇单元大于之前的楼宇单元,新增单元
Integer nowUnit= formDTO.getTotalUnitNum();
Integer nowUnit = formDTO.getTotalUnitNum();
Integer unit = icBuilding.getTotalUnitNum();
if(nowUnit<unit){
if (nowUnit < unit) {
//如果小于,判断是否存在房屋,如果存在就提示不能更改
throw new EpmetException(EpmetErrorCode.ORG_EDIT_FAILED.getCode(),EpmetErrorCode.ORG_EDIT_FAILED.getMsg(),"暂不支持单元号减小");
}
//新增单元
List<OptionResultDTO> units = icBuildingUnitService.getUnitOptions(icBuilding.getId());
Map<String, String> unitMap = units.stream().collect(Collectors.toMap(OptionResultDTO::getCode, OptionResultDTO::getLabel));
List<IcBuildingUnitEntity> unitList = new ArrayList<>();
for (int i = 1; i <= nowUnit; i++) {
String unitNum = String.valueOf(i);
if (!unitMap.containsKey(unitNum)) {
IcBuildingUnitEntity icBuildingUnit = new IcBuildingUnitEntity();
icBuildingUnit.setBuildingId(icBuilding.getId());
icBuildingUnit.setCustomerId(customerId);
icBuildingUnit.setUnitName(unitNum + "单元");
icBuildingUnit.setUnitNum(unitNum);
unitList.add(icBuildingUnit);
throw new EpmetException(EpmetErrorCode.ORG_EDIT_FAILED.getCode(), EpmetErrorCode.ORG_EDIT_FAILED.getMsg(), "暂不支持单元号减小");
} else {
//新增单元
List<OptionResultDTO> units = icBuildingUnitService.getUnitOptions(icBuilding.getId());
Map<String, String> unitMap = units.stream().collect(Collectors.toMap(OptionResultDTO::getCode, OptionResultDTO::getLabel));
List<IcBuildingUnitEntity> unitList = new ArrayList<>();
for (int i = 1; i <= nowUnit; i++) {
String unitNum = String.valueOf(i);
if (!unitMap.containsKey(unitNum)) {
IcBuildingUnitEntity icBuildingUnit = new IcBuildingUnitEntity();
icBuildingUnit.setId(IdWorker.getIdStr());
icBuildingUnit.setBuildingId(icBuilding.getId());
icBuildingUnit.setCustomerId(customerId);
icBuildingUnit.setUnitName(unitNum + "单元");
icBuildingUnit.setUnitNum(unitNum);
unitList.add(icBuildingUnit);
}
}
icBuildingUnitService.insertBatch(unitList, NumConstant.ONE_HUNDRED);
}
//删除楼栋下所有的房屋缓存
List<IcHouseEntity> houseList = icHouseDao.selectList(new QueryWrapper<IcHouseEntity>().lambda().eq(IcHouseEntity::getBuildingId, formDTO.getBuildingId()));
if (!CollectionUtils.isEmpty(houseList)) {
houseList.forEach(house -> {
//删除房屋的缓存
icHouseRedis.delHouseInfo(house.getId(), customerId);
});
}
icBuildingUnitService.insertBatch(unitList);
//删除楼栋缓存
CustomerIcHouseRedis.delBuildingInfo(formDTO.getBuildingId());
}
/**
* 删除
*
* @param buildingId
*/
@Override
@ -568,13 +493,13 @@ public class BuildingServiceImpl implements BuildingService {
public void delBuilding(String buildingId) {
//如果存在房屋,无法删除
List<IcHouseEntity> icHouseEntities = icHouseDao.selectList(new QueryWrapper<IcHouseEntity>().lambda().eq(IcHouseEntity::getBuildingId, buildingId));
if(!CollectionUtils.isEmpty(icHouseEntities)){
throw new RenException(EpmetErrorCode.ORG_DEL_FAILED.getCode(),"楼宇单元下存在房屋,无法删除");
if (!CollectionUtils.isEmpty(icHouseEntities)) {
throw new RenException(EpmetErrorCode.ORG_DEL_FAILED.getCode(), "楼栋单元下存在房屋,无法删除");
}
//删除楼宇
icBuildingService.deleteById(buildingId);
//删除楼宇单元
icBuildingUnitDao.delete(new QueryWrapper<IcBuildingUnitEntity>().lambda().eq(IcBuildingUnitEntity::getBuildingId,buildingId));
icBuildingUnitDao.delete(new QueryWrapper<IcBuildingUnitEntity>().lambda().eq(IcBuildingUnitEntity::getBuildingId, buildingId));
}

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

@ -4,17 +4,15 @@ import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelReader;
import com.alibaba.excel.read.metadata.ReadSheet;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.enums.OrgTypeEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.feign.ResultDataResolver;
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.AgencyInfoCache;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
@ -30,14 +28,11 @@ import com.epmet.dto.IcBuildingUnitDTO;
import com.epmet.dto.IcHouseDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.HouseInfoDTO;
import com.epmet.dto.result.IcNeighborHoodResultDTO;
import com.epmet.dto.result.IcHouseListResultDTO;
import com.epmet.dto.result.ImportTaskCommonResultDTO;
import com.epmet.dto.result.NeighborHoodManageDelResultDTO;
import com.epmet.entity.IcHouseEntity;
import com.epmet.enums.HousePurposeEnums;
import com.epmet.enums.HouseRentFlagEnums;
import com.epmet.enums.HouseTypeEnums;
import com.epmet.excel.IcHouseExcel;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
@ -46,6 +41,8 @@ import com.epmet.model.ImportHouseInfoListener;
import com.epmet.redis.IcHouseRedis;
import com.epmet.service.*;
import com.epmet.util.ExcelPoiUtils;
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;
@ -99,7 +96,7 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver {
@Override
@Transactional(rollbackFor = Exception.class)
public void addHouse(String customerId, IcHouseFormDTO formDTO) {
public void addHouse(String customerId, IcHouseAddFormDTO formDTO) {
//同一楼栋,单元内,房屋名称唯一
Integer count = icHouseDao.checkDoorNameUq(formDTO.getNeighborHoodId(), formDTO.getBuildingId(), formDTO.getBuildingUnitId(), formDTO.getDoorName(),null);
if (null != count && count > 0) {
@ -107,13 +104,11 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver {
}
IcHouseDTO icHouseDTO= ConvertUtils.sourceToTarget(formDTO, IcHouseDTO.class);
icHouseDTO.setCustomerId(customerId);
// icHouseDTO.setRentFlag(formDTO.getRentFlag());
icHouseDTO.setHouseName(getHouseName(formDTO));
icHouseService.save(icHouseDTO);
}
private String getHouseName(IcHouseFormDTO formDTO){
private String getHouseName(IcHouseAddFormDTO formDTO){
//设置房间名 楼栋-单元号-门牌号
IcBuildingDTO icBuilding = icBuildingService.get(formDTO.getBuildingId());
IcBuildingUnitDTO icBuildingUnit = icBuildingUnitService.get(formDTO.getBuildingUnitId());
@ -130,7 +125,7 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver {
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void updateHouse(String customerId, IcHouseFormDTO formDTO) {
public void updateHouse(String customerId, IcHouseAddFormDTO formDTO) {
//同一楼栋,单元内,房屋名称唯一
Integer count = icHouseDao.checkDoorNameUq(formDTO.getNeighborHoodId(), formDTO.getBuildingId(), formDTO.getBuildingUnitId(),formDTO.getDoorName(), formDTO.getHouseId());
if (null != count && count > 0) {
@ -162,184 +157,61 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver {
}
@Override
@Transactional(rollbackFor = Exception.class)
public List<Integer> importExcel(String customerId, List<IcHouseExcel> list, String staffId, List<Integer> numList) {
//2021.11.10 需求变更 当前工作人员只能导致自己所属组织下数据,对应不上的数据舍弃【注:需求就这样】 sun
CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(customerId, staffId);
//组织名称不一样的数据舍弃
Iterator<IcHouseExcel> iterator = list.iterator();
while (iterator.hasNext()) {
IcHouseExcel obj = iterator.next();
if (!obj.getAgencyName().trim().equals(staffInfoCache.getAgencyName())) {
numList.add(obj.getRowNum());
iterator.remove();
}
public PageData<IcHouseListResultDTO> getHouseList(IcHouseListFormDTO formDTO) {
// 查询pids
String pids = null;
if (StringUtils.isNotBlank(formDTO.getAgencyId())) {
pids = getPids(formDTO.getAgencyId());
}
//用于存储匹配不上的数据给前端的提示 如南宁社区不存在
//StringBuffer str = new StringBuffer("");
//end sun
//导入
if(CollectionUtils.isEmpty(list)){
return numList;
if (StringUtils.isNotBlank(formDTO.getLevel()) && OrgTypeEnum.AGENCY.getCode().equals(formDTO.getLevel())){
pids = getPids(formDTO.getAgencyId());
}
//获取所有小区 list
// List<String> neighborNameList = list.stream().map(item -> item.getNeighborHoodName()).collect(Collectors.toList());
// List<IcNeighborHoodEntity> neighborHoodList = icNeighborHoodDao.selectList(new QueryWrapper<IcNeighborHoodEntity>().lambda().in(IcNeighborHoodEntity::getNeighborHoodName, neighborNameList));
// Map<String,IcNeighborHoodEntity> neighborHoodMap = neighborHoodList.stream().collect(Collectors.toMap(IcNeighborHoodEntity::getNeighborHoodName, Function.identity(),(key1, key2)->key1));
//获取所有楼宇 list
// List<String> buildingNameList = list.stream().map(item -> item.getBuildingName()).collect(Collectors.toList());
// icBuildingDao.selectList(new QueryWrapper<IcBuildingEntity>().lambda().in(IcBuildingEntity::getBuildingName, buildingNameList).in();
Set<String> neighborNameList = list.stream().map(item -> item.getNeighborHoodName()).collect(Collectors.toSet());
Set<String> buildingNameList = list.stream().map(item -> item.getBuildingName()).collect(Collectors.toSet());
Set<Integer> buildingUnitList = list.stream().map(item -> item.getBuildingUnit()).collect(Collectors.toSet());
List<Map<String,Object>> buildMapList = icBuildingDao.selectListByName(customerId, new ArrayList<String>(neighborNameList),new ArrayList<String>(buildingNameList),new ArrayList<Integer>(buildingUnitList));
//转Map
Map<String,Map<String,Object>> buildMap = new HashMap<>();
buildMapList.forEach(item->{
buildMap.put(item.get("neighborName")+","+item.get("buildingName")+","+item.get("unitNum"),item);
});
//封装数据
List<IcHouseEntity> houseEntityList = new ArrayList<>();
Iterator<IcHouseExcel> iterator1 = list.iterator();
while (iterator1.hasNext()) {
IcHouseExcel icHouseExcel = iterator1.next();
IcHouseEntity entity = new IcHouseEntity();
String uuid = UUID.randomUUID().toString().replace("-", "");
entity.setId(uuid);
entity.setCustomerId(customerId);
Map<String,Object> item = buildMap.get(icHouseExcel.getNeighborHoodName()+","+icHouseExcel.getBuildingName()+","+icHouseExcel.getBuildingUnit());
entity.setNeighborHoodId(String.valueOf(Optional.ofNullable(item).map(u->u.get("neighborId")).orElse("")));
entity.setBuildingId(String.valueOf(Optional.ofNullable(item).map(u->u.get("buildingId")).orElse("")));
entity.setBuildingUnitId(String.valueOf(Optional.ofNullable(item).map(u->u.get("buildingUnitId")).orElse("")));
entity.setHouseName(icHouseExcel.getBuildingName()+"-"+icHouseExcel.getBuildingUnit()+"-"+icHouseExcel.getDoorName());
if ("".equals(entity.getNeighborHoodId()) || "".equals(entity.getBuildingId()) || "".equals(entity.getBuildingUnitId())) {
//str.append("".equals(str) ? icHouseExcel.getBuildingName() + icHouseExcel.getBuildingUnit() : str.append("、").append(icHouseExcel.getBuildingName() + icHouseExcel.getBuildingUnit()));
numList.add(icHouseExcel.getRowNum());
iterator1.remove();
continue;
}
entity.setDoorName(icHouseExcel.getDoorName());
entity.setHouseType(HouseTypeEnums.getKeyByValue(icHouseExcel.getHouseType()));
entity.setPurpose(HousePurposeEnums.getKeyByValue(icHouseExcel.getPurpose()));
entity.setRentFlag(HouseRentFlagEnums.getCodeByName(icHouseExcel.getRentFlag()));
entity.setOwnerName(icHouseExcel.getOwnerName());
entity.setOwnerPhone(icHouseExcel.getOwnerPhone());
entity.setOwnerIdCard(icHouseExcel.getOwnerIdCard());
//同一楼栋,单元内,房屋名称唯一
Integer count = icHouseDao.checkDoorNameUq(entity.getNeighborHoodId(), entity.getBuildingId(), entity.getBuildingUnitId(), entity.getDoorName(),null);
if (null != count && count > 0) {
//throw new RenException(EpmetErrorCode.DOOR_NAME_EXITED.getCode(), EpmetErrorCode.DOOR_NAME_EXITED.getMsg());
log.error(EpmetErrorCode.DOOR_NAME_EXITED.getMsg());
numList.add(icHouseExcel.getRowNum());
iterator1.remove();
continue;
}
houseEntityList.add(entity);
formDTO.setPids(pids);
PageInfo<IcHouseListResultDTO> pageInfo = null;
if (formDTO.getIsPage()){
pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(),formDTO.getIsPage())
.doSelectPageInfo(() -> icHouseDao.searchHouseByPage(formDTO));
}else{
List<IcHouseListResultDTO> resultDTOS = icHouseDao.searchHouseByPage(formDTO);
pageInfo = new PageInfo<>(resultDTOS,resultDTOS.size());
}
//3.保存
icHouseService.insertBatch(houseEntityList);
return numList;
List<IcHouseListResultDTO> records = pageInfo.getList();
records.forEach(item->{
item.setHouseType(HouseTypeEnums.getTypeValue(item.getHouseTypeKey()));
item.setPurpose(HousePurposeEnums.getTypeValue(item.getPurposeKey()));
});
return new PageData<>(records,pageInfo.getTotal());
}
@Override
public IcNeighborHoodResultDTO listNeighborhood(String ancestorAgencyId,
String buildingId,
String ownerName,
String ownerPhone,
String neighborHoodName,
String buildingName,
String queryScene,
Integer pageNo,
Integer pageSize) {
IcNeighborHoodResultDTO result = new IcNeighborHoodResultDTO();
//如果类型是house 查房屋
//IPage<Map<String, Object>> resultMap = searchHouse(buildingId, ownerName, ownerPhone, neighborHoodName, buildingName, pageNo, pageSize);
// 查询pids
public String getPids(String agencyId){
String pids = null;
if (StringUtils.isNotBlank(ancestorAgencyId)) {
CustomerAgencyDTO agency = agencyservice.getAgencyById(ancestorAgencyId);
if (agency == null) {
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "【社区查询-查询房屋列表】查询当前staff所属组织信息失败");
}
CustomerAgencyDTO agency = agencyservice.getAgencyById(agencyId);
if (NumConstant.ZERO_STR.equals(agency.getPid())) {
pids = ancestorAgencyId;
} else {
pids = agency.getPids().concat(StrConstant.COLON).concat(ancestorAgencyId);
}
if (agency == null) {
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "【社区查询-查询房屋列表】查询当前staff所属组织信息失败");
}
IPage<IcHouseEntity> page = new Page<IcHouseEntity>(pageNo,pageSize);
IPage<Map<String, Object>> mapIPage = icHouseDao.searchHouseByPage(page, pids, buildingId, ownerName, ownerPhone, neighborHoodName, buildingName, queryScene);
List<Map<String, Object>> records = mapIPage.getRecords();
records.forEach(item->{
item.put("houseType", HouseTypeEnums.getTypeValue(item.get("houseTypeKey")));
item.put("purpose", HousePurposeEnums.getTypeValue(item.get("purposeKey")));
});
result.setTotal(Long.valueOf(mapIPage.getTotal()).intValue());
result.setList(records);
return result;
if (NumConstant.ZERO_STR.equals(agency.getPid())) {
pids = agencyId;
} else {
pids = agency.getPids().concat(StrConstant.COLON).concat(agencyId);
}
return pids;
}
@Override
public void exportBuildinginfo(ListIcNeighborHoodFormDTO formDTO, HttpServletResponse response) throws Exception {
public void exportBuildinginfo(IcHouseListFormDTO formDTO, HttpServletResponse response) throws Exception {
//如果类型是house 查房屋
//导出房屋
List<IcHouseExcel> icHouseExcels = searchAllHouse(formDTO);
PageData<IcHouseListResultDTO> icHouseExcels = getHouseList(formDTO);
TemplateExportParams templatePath = new TemplateExportParams("excel/house_export.xlsx");
Map<String,Object> map = new HashMap<>();
map.put("maplist",icHouseExcels);
map.put("maplist",icHouseExcels.getList());
ExcelPoiUtils.exportExcel(templatePath ,map,"房屋信息录入表",response);
return ;
}
private List<IcHouseExcel> searchAllHouse(ListIcNeighborHoodFormDTO formDTO) {
//IcNeighborHoodEntity neighbor = ConvertUtils.sourceToTarget(formDTO, IcNeighborHoodEntity.class);
//
//IcBuildingEntity building = ConvertUtils.sourceToTarget(formDTO, IcBuildingEntity.class);
IcHouseEntity house = ConvertUtils.sourceToTarget(formDTO, IcHouseEntity.class);
house.setDelFlag("0");
List<IcHouseExcel> icHouseExcels = icHouseDao.searchAllHouse(house);
icHouseExcels.forEach(item->{
item.setHouseType(HouseTypeEnums.getTypeValue(item.getHouseType()));
item.setPurpose(HousePurposeEnums.getTypeValue(item.getPurpose()));
});
return icHouseExcels;
}
/*private IPage<Map<String, Object>> searchHouse(String buildingId,
String ownerName,
String ownerPhone,
String neighborHoodName,
String buildingName,
Integer pageNo,
Integer pageSize) {
IPage<IcHouseEntity> page = new Page<IcHouseEntity>(pageNo,pageSize);
IPage<Map<String, Object>> mapIPage = icHouseDao.searchHouseByPage(page, buildingId, ownerName, ownerPhone, neighborHoodName, buildingName);
List<Map<String, Object>> records = mapIPage.getRecords();
records.forEach(item->{
item.put("houseType", HouseTypeEnums.getTypeValue(item.get("houseTypeKey")));
item.put("purpose", HousePurposeEnums.getTypeValue(item.get("purposeKey")));
});
return mapIPage;
}*/
@Override
public List<HouseInfoDTO> queryListHouseInfo(Set<String> houseIdList, String customerId) {
@ -412,7 +284,7 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver {
}
if (!CollectionUtils.isEmpty(exists)){
String collect = exists.stream().map(m -> m.getName()).collect(Collectors.joining(","));
EpmetErrorCode.NEIGHBORHOOD_DEL_FAILED.setMsg(String.format("%s内包含楼信息,暂无法删除",collect));
EpmetErrorCode.NEIGHBORHOOD_DEL_FAILED.setMsg(String.format("%s内包含楼信息,暂无法删除",collect));
throw new EpmetException(EpmetErrorCode.NEIGHBORHOOD_DEL_FAILED.getCode());
}
}else if (formDTO.getType().equals(CustomerGridConstant.BUILDING)){

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

@ -19,6 +19,7 @@ import com.epmet.dto.IcResiUserDTO;
import com.epmet.dto.ImportGeneralDTO;
import com.epmet.dto.form.HouseFormDTO;
import com.epmet.dto.result.HouseListResultDTO;
import com.epmet.dto.result.HousesNameResultDTO;
import com.epmet.entity.IcHouseEntity;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.OperCustomizeOpenFeignClient;
@ -126,6 +127,7 @@ public class IcHouseServiceImpl extends BaseServiceImpl<IcHouseDao, IcHouseEntit
OptionResultDTO dto = new OptionResultDTO();
dto.setValue(item.getId());
dto.setLabel(item.getDoorName());
dto.setType(item.getRentFlag().toString());
return dto;
}).collect(Collectors.toList());
}
@ -231,4 +233,18 @@ public class IcHouseServiceImpl extends BaseServiceImpl<IcHouseDao, IcHouseEntit
baseDao.houseUpdate(houses);
}
/**
* Desc: 根据身份证查询房屋名
* @param idCards
* @author zxc
* @date 2022/4/12 16:42
*/
@Override
public List<HousesNameResultDTO> getHousesNameByIdCards(List<String> idCards) {
if (CollectionUtils.isEmpty(idCards)){
return new ArrayList<>();
}
return baseDao.getHousesNameByIdCards(idCards);
}
}

4
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java

@ -48,7 +48,7 @@ import com.epmet.dao.IcBuildingDao;
import com.epmet.dao.IcNeighborHoodDao;
import com.epmet.dao.IcPropertyManagementDao;
import com.epmet.dto.*;
import com.epmet.dto.form.IcNeighborHoodFormDTO;
import com.epmet.dto.form.IcNeighborHoodAddFormDTO;
import com.epmet.dto.form.ImportInfoFormDTO;
import com.epmet.dto.form.ImportTaskCommonFormDTO;
import com.epmet.dto.result.ImportTaskCommonResultDTO;
@ -687,7 +687,7 @@ public class IcNeighborHoodServiceImpl extends BaseServiceImpl<IcNeighborHoodDao
}
@Override
public PageData<IcNeighborHoodDTO> openPage(IcNeighborHoodFormDTO params) {
public PageData<IcNeighborHoodDTO> openPage(IcNeighborHoodAddFormDTO params) {
LambdaQueryWrapper<IcNeighborHoodEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcNeighborHoodEntity::getAgencyId,params.getAgencyId());
PageData<IcNeighborHoodDTO> result = null;

211
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/NeighborHoodServiceImpl.java

@ -2,13 +2,10 @@ package com.epmet.service.impl;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.enums.OrgTypeEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.NeighborhoodConstant;
@ -16,29 +13,33 @@ import com.epmet.dao.*;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.IcNeighborHoodDTO;
import com.epmet.dto.IcNeighborHoodPropertyDTO;
import com.epmet.dto.form.IcNeighborHoodFormDTO;
import com.epmet.dto.form.ListIcNeighborHoodFormDTO;
import com.epmet.dto.form.IcHouseListFormDTO;
import com.epmet.dto.form.IcNeighborHoodAddFormDTO;
import com.epmet.dto.form.IcNeighborHoodListFormDTO;
import com.epmet.dto.result.IcNeighborHoodResultDTO;
import com.epmet.entity.*;
import com.epmet.entity.IcHouseEntity;
import com.epmet.entity.IcNeighborHoodEntity;
import com.epmet.entity.IcNeighborHoodPropertyEntity;
import com.epmet.excel.IcNeighborHoodExcel;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.service.IcNeighborHoodPropertyService;
import com.epmet.service.IcNeighborHoodService;
import com.epmet.service.NeighborHoodService;
import com.epmet.util.ExcelPoiUtils;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
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 org.springframework.util.StringUtils;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@Slf4j
@Service
@ -46,33 +47,19 @@ public class NeighborHoodServiceImpl implements NeighborHoodService {
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired
private IcNeighborHoodService icNeighborHoodService;
@Autowired
private IcNeighborHoodPropertyService icNeighborHoodPropertyService;
@Resource
private IcNeighborHoodPropertyDao icNeighborHoodPropertyDao;
@Resource
private IcNeighborHoodDao icNeighborHoodDao;
@Resource
private IcBuildingDao icBuildingDao;
@Resource
private IcHouseDao icHouseDao;
@Resource
private CustomerAgencyDao customerAgencyDao;
@Resource
private CustomerGridDao customerGridDao;
@Resource
private IcPropertyManagementDao icPropertyManagementDao;
@Override
@Transactional(rollbackFor = Exception.class)
public void AddNeighborhood(String customerId, IcNeighborHoodFormDTO formDTO) {
public void addNeighborhood(String customerId, IcNeighborHoodAddFormDTO formDTO) {
//同一网格下,小区名称唯一
Integer count = icNeighborHoodDao.checkNameUq(formDTO.getGridId(),formDTO.getNeighborHoodName(),null);
if (null != count && count > 0) {
@ -105,45 +92,20 @@ public class NeighborHoodServiceImpl implements NeighborHoodService {
/**
* 查询
* @param formDTO
* @return
*/
@Override
public IcNeighborHoodResultDTO listNeighborhood(ListIcNeighborHoodFormDTO formDTO) {
String level = formDTO.getLevel();
Integer pageNo = formDTO.getPageNo();
Integer pageSize = formDTO.getPageSize();
IcNeighborHoodResultDTO result = new IcNeighborHoodResultDTO();
IPage<Map<String, Object>> resultMap = searchNeighborhood(formDTO);
result.setTotal(Long.valueOf(resultMap.getTotal()).intValue());
result.setList(resultMap.getRecords());
return result;
}
private IPage<Map<String,Object>> searchNeighborhood(ListIcNeighborHoodFormDTO formDTO) {
IPage<IcNeighborHoodEntity> page = new Page<IcNeighborHoodEntity>(formDTO.getPageNo(),formDTO.getPageSize());
IcNeighborHoodEntity neighbor = ConvertUtils.sourceToTarget(formDTO, IcNeighborHoodEntity.class);
IcHouseEntity house = ConvertUtils.sourceToTarget(formDTO, IcHouseEntity.class);
neighbor.setDelFlag("0");
public PageData<IcNeighborHoodResultDTO> listNeighborhood(IcNeighborHoodListFormDTO formDTO) {
if(NeighborhoodConstant.GRID.equals(formDTO.getLevel())){
//根据网格过滤
neighbor.setGridId(formDTO.getId());
formDTO.setGridId(formDTO.getId());
}else{
//根据组织过滤
neighbor.setAgencyId(formDTO.getId());
formDTO.setAgencyId(formDTO.getId());
}
return icNeighborHoodDao.searchNeighborhoodByPage(page, neighbor,house);
PageInfo<IcNeighborHoodResultDTO> pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage())
.doSelectPageInfo(() -> icNeighborHoodDao.searchNeighborhoodByPage(formDTO));
return new PageData<>(pageInfo.getList(),pageInfo.getTotal());
}
/**
@ -153,7 +115,7 @@ public class NeighborHoodServiceImpl implements NeighborHoodService {
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void UpdateNeighborhood(String customerId, IcNeighborHoodFormDTO formDTO) {
public void updateNeighborhood(String customerId, IcNeighborHoodAddFormDTO formDTO) {
//同一客户下,小区名称唯一
Integer count = icNeighborHoodDao.checkNameUq(formDTO.getGridId(),formDTO.getNeighborHoodName(),formDTO.getNeighborHoodId());
if (null != count && count > 0) {
@ -192,8 +154,6 @@ public class NeighborHoodServiceImpl implements NeighborHoodService {
//更新
icNeighborHoodPropertyService.updateById(icNeighborHoodProperty);
}
}
}
@ -203,7 +163,7 @@ public class NeighborHoodServiceImpl implements NeighborHoodService {
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void DelNeighborhood(String neighborHoodId) {
public void delNeighborhood(String neighborHoodId) {
//删除小区
icNeighborHoodService.deleteById(neighborHoodId);
//删除小区物业关联
@ -220,10 +180,9 @@ public class NeighborHoodServiceImpl implements NeighborHoodService {
* @param response
*/
@Override
public void exportNeighborhoodinfo(ListIcNeighborHoodFormDTO formDTO, HttpServletResponse response) throws Exception {
public void exportNeighborhoodinfo(IcHouseListFormDTO formDTO, HttpServletResponse response) throws Exception {
//导出小区
List<IcNeighborHoodExcel> icNeighborHoodExcels = searchAllNeighborhood(formDTO);
// ExcelUtils.exportExcelToTarget(response, "小区信息录入表", icNeighborHoodExcels, IcNeighborHoodExcel.class);
TemplateExportParams templatePath = new TemplateExportParams("excel/neighbor_export.xlsx");
Map<String,Object> map = new HashMap<>();
@ -231,119 +190,7 @@ public class NeighborHoodServiceImpl implements NeighborHoodService {
ExcelPoiUtils.exportExcel(templatePath ,map,"小区信息录入表",response);
}
@Override
@Transactional(rollbackFor = Exception.class)
public List<Integer> importExcel(String customerId,List<IcNeighborHoodExcel> list,String staffId, List<Integer> numList) {
//2021.11.9 需求变更 当前工作人员只能导致自己所属组织下数据,网格名对应不上的数据舍弃【注:需求就这样】 sun
CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(customerId, staffId);
//查询当前组织下网格列表
List<CustomerGridEntity> customerGridList = customerGridDao.selectByPid(staffInfoCache.getAgencyId());
//组织名称不一样的数据舍弃
Iterator<IcNeighborHoodExcel> iterator = list.iterator();
while (iterator.hasNext()) {
IcNeighborHoodExcel obj = iterator.next();
if (!obj.getAgencyName().trim().equals(staffInfoCache.getAgencyName())) {
numList.add(obj.getRowNum());
iterator.remove();
continue;
}
//当前组织下网格名不存在的也不允许导入
AtomicBoolean br = new AtomicBoolean(true);
customerGridList.forEach(g->{
if(obj.getGridName().trim().equals(g.getGridName())){
br.set(false);
}
});
if(br.get()){
numList.add(obj.getRowNum());
iterator.remove();
}
}
//end sun
//导入
if(CollectionUtils.isEmpty(list)){
return numList;
}
//获取所有组织 list
List<String> agencyNameList = list.stream().map(item -> item.getAgencyName()).collect(Collectors.toList());
agencyNameList = agencyNameList.stream().distinct().collect(Collectors.toList());
//获取所有网格 list
//List<String> gridNameList = list.stream().map(item->item.getGridName()).collect(Collectors.toList());
//获取所有物业 list
List<String> propertyNameList = list.stream().map(item->item.getPropertyName()).collect(Collectors.toList());
propertyNameList = propertyNameList.stream().distinct().collect(Collectors.toList());
//查询对应的id
List<CustomerAgencyEntity> customerAgencyList = customerAgencyDao.selectList(new QueryWrapper<CustomerAgencyEntity>().lambda().in(CustomerAgencyEntity::getOrganizationName, agencyNameList));
//List<CustomerGridEntity> customerGridList = customerGridDao.selectList(new QueryWrapper<CustomerGridEntity>().lambda().in(CustomerGridEntity::getGridName, gridNameList));
List<IcPropertyManagementEntity> icPropertyManagementList = icPropertyManagementDao.selectList(new QueryWrapper<IcPropertyManagementEntity>().lambda().in(IcPropertyManagementEntity::getName, propertyNameList));
Map<String,CustomerAgencyEntity> agencyMap = customerAgencyList.stream().collect(Collectors.toMap(CustomerAgencyEntity::getOrganizationName, Function.identity(),(key1, key2)->key1));
Map<String,CustomerGridEntity> gridMap = customerGridList.stream().collect(Collectors.toMap(CustomerGridEntity::getGridName,Function.identity(),(key1,key2)->key1));
Map<String,IcPropertyManagementEntity> propertyMap = icPropertyManagementList.stream().collect(Collectors.toMap(IcPropertyManagementEntity::getName,Function.identity(),(key1,key2)->key1));
//封装数据
List<IcNeighborHoodEntity> neighborHoodEntityList = new ArrayList<>();
List<IcNeighborHoodPropertyEntity> icNeighborHoodPropertyEntityList = new ArrayList<>();
Iterator<IcNeighborHoodExcel> iterator1 = list.iterator();
while (iterator1.hasNext()) {
IcNeighborHoodExcel icNeighborHoodExcel = iterator1.next();
//同一客户下,小区名称唯一
Integer count = icNeighborHoodDao.checkNameUq(customerId,icNeighborHoodExcel.getNeighborHoodName(),null);
if (null != count && count > 0) {
//throw new RenException(EpmetErrorCode.NEIGHBOOR_NAME_EXITED.getCode(), icNeighborHoodExcel.getNeighborHoodName()+EpmetErrorCode.NEIGHBOOR_NAME_EXITED.getMsg());
log.error(icNeighborHoodExcel.getNeighborHoodName()+EpmetErrorCode.NEIGHBOOR_NAME_EXITED.getMsg());
numList.add(icNeighborHoodExcel.getRowNum());
iterator1.remove();
continue;
}
IcNeighborHoodEntity entity = new IcNeighborHoodEntity();
String uuid =UUID.randomUUID().toString().replace("-", "");
entity.setId(uuid);
entity.setCustomerId(customerId);
entity.setNeighborHoodName(icNeighborHoodExcel.getNeighborHoodName());
entity.setAgencyId(Optional.ofNullable(agencyMap.get(icNeighborHoodExcel.getAgencyName().trim())).map(u->u.getId()).orElse("")); // agencyMap.get(icNeighborHoodExcel.getAgencyName()).getId());
entity.setParentAgencyId(Optional.ofNullable(agencyMap.get(icNeighborHoodExcel.getAgencyName().trim())).map(u->u.getPid()).orElse(""));//agencyMap.get(icNeighborHoodExcel.getAgencyName()).getPid()
entity.setAgencyPids(Optional.ofNullable(agencyMap.get(icNeighborHoodExcel.getAgencyName().trim())).map(u->u.getPids()).orElse(""));//agencyMap.get(icNeighborHoodExcel.getAgencyName()).getPids()
entity.setGridId(Optional.ofNullable(gridMap.get(icNeighborHoodExcel.getGridName().trim())).map(u->u.getId()).orElse(""));//gridMap.get(icNeighborHoodExcel.getGridName()).getId()
//网格名对应不上的数据舍弃
if ("".equals(entity.getGridId())) {
numList.add(icNeighborHoodExcel.getRowNum());
iterator1.remove();
continue;
}
entity.setAddress(icNeighborHoodExcel.getAddress());
entity.setRemark(icNeighborHoodExcel.getRemark());
neighborHoodEntityList.add(entity);
IcNeighborHoodPropertyEntity entity1 = new IcNeighborHoodPropertyEntity();
entity1.setPropertyId(Optional.ofNullable(propertyMap.get(icNeighborHoodExcel.getPropertyName())).map(u->u.getId()).orElse(""));
entity1.setNeighborHoodId(uuid);
icNeighborHoodPropertyEntityList.add(entity1);
}
// icNeighborHoodDao.
//保存
icNeighborHoodService.insertBatch(neighborHoodEntityList);
icNeighborHoodPropertyService.insertBatch(icNeighborHoodPropertyEntityList);
return numList;
}
private List<IcNeighborHoodExcel> searchAllNeighborhood(ListIcNeighborHoodFormDTO formDTO) {
// QueryWrapper<IcNeighborHoodEntity> neighborHoodEntityQueryWrapper = new QueryWrapper<>();
// neighborHoodEntityQueryWrapper.lambda()
// .eq(!StringUtils.isEmpty(formDTO.getAgencyId()),IcNeighborHoodEntity::getAgencyId,formDTO.getAgencyId())
// .eq(!StringUtils.isEmpty(formDTO.getGridId()),IcNeighborHoodEntity::getId,formDTO.getGridId())
// .eq(!StringUtils.isEmpty(formDTO.getNeighborHoodId()),IcNeighborHoodEntity::getId,formDTO.getNeighborHoodId())
// .like(!StringUtils.isEmpty(formDTO.getNeighborHoodName()),IcNeighborHoodEntity::getNeighborHoodName,formDTO.getNeighborHoodName());
// neighborHoodEntityQueryWrapper.eq("a.DEL_FLAG","0");
private List<IcNeighborHoodExcel> searchAllNeighborhood(IcHouseListFormDTO formDTO) {
IcNeighborHoodEntity neighbor = ConvertUtils.sourceToTarget(formDTO, IcNeighborHoodEntity.class);
neighbor.setDelFlag("0");
if(OrgTypeEnum.GRID.getCode().equals(formDTO.getLevel())){
@ -354,10 +201,4 @@ public class NeighborHoodServiceImpl implements NeighborHoodService {
IcHouseEntity house = ConvertUtils.sourceToTarget(formDTO, IcHouseEntity.class);
return icNeighborHoodDao.searchAllNeighborhood(neighbor,house);
}
}

2
epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.15__alter_ic_house.sql

@ -0,0 +1,2 @@
ALTER TABLE `ic_house`
MODIFY COLUMN `RENT_FLAG` tinyint(1) NOT NULL COMMENT '1:出租 0:自住 2:闲置' AFTER `PURPOSE`;

3
epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.16__add_index_ic_house.sql

@ -0,0 +1,3 @@
ALTER TABLE `epmet_gov_org`.`ic_house`
ADD INDEX `idx_building_id`(`BUILDING_ID`) USING BTREE COMMENT '楼宇id',
ADD INDEX `idx_hood_id`(`NEIGHBOR_HOOD_ID`) USING BTREE COMMENT '小区id';

BIN
epmet-module/gov-org/gov-org-server/src/main/resources/excel/house_export.xlsx

Binary file not shown.

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save