diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 03d26cb96e..a13d6cf1db 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -160,6 +160,7 @@ public enum EpmetErrorCode { ERROR_DATE(8533, "不合理日期"), CHECK_PHONE_ERROR(8534, "号码不合法"), + TITLE_AND_CONTENT_ERROR(8535, "标题和内容不能同时为空"), // 该错误不会提示给前端,只是后端传输错误信息用。 ACCESS_SQL_FILTER_MISSION_ARGS(8701, "缺少生成权限过滤SQL所需参数"), diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml index 56bde19105..dc505b1985 100644 --- a/epmet-gateway/pom.xml +++ b/epmet-gateway/pom.xml @@ -275,6 +275,7 @@ lb://epmet-admin-server lb://epmet-oss-server + lb://epmet-message-server diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java index 7ad89d1728..e0a3760bed 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java @@ -688,6 +688,9 @@ public class EpmetUserServiceImpl implements EpmetUserService { //1.分页查询排好序的工作人员Id列表【原本1/2步可以用一个sql,但涉及2需要按1的顺序排序,sql复杂且效率低,所以拆开】 LinkedList staffIds = customerStaffDao.selectOrderRole(formDTO); //2.批量查询工作人员信息,按传入顺序排序 + if(CollectionUtils.isEmpty(staffIds)){ + return new ArrayList<>(); + } List resultList = customerStaffDao.selectStaffList(staffIds); return resultList; } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml index 3efcdfb3dc..9ac36b2509 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml @@ -116,16 +116,18 @@ customer_staff WHERE del_flag = '0' - AND user_id IN - - #{staffId} - - ORDER BY field( - user_id, - + + AND user_id IN + #{staffId} - ) + ORDER BY field( + user_id, + + #{staffId} + + ) + + + + diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceProjectDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceProjectDao.xml index 17f4de965a..c042978f80 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceProjectDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceProjectDao.xml @@ -43,7 +43,7 @@ AND ID = #{serviceProjectId} - AND AGENCY_ID = #{agencyId} + AND AGENCY_ID_PATH like concat( '%',#{agencyId},'%') AND SERVICE_CATEGORY_KEY = #{serviceCategoryKey} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceRecordDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceRecordDao.xml index ad5df068ef..2c3093c02d 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceRecordDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceRecordDao.xml @@ -36,6 +36,7 @@ record.SERVICE_STATUS, record.SERVICE_PEOPLE_NUMBER from ic_service_record record + inner join ic_service_scope scope on (scope.DEL_FLAG = '0' and record.ID = scope.SERVICE_RECORD_ID) left join ic_service_feedback feedback on (record.ID = feedback.SERVICE_RECORD_ID) record.DEL_FLAG = '0' @@ -61,6 +62,9 @@ and feedback.SATISFACTION = #{satisfaction} + + and scope.OBJECT_ID_PATH like CONCAT(#{searchOrgIdPath}, '%') + order by record.CREATED_TIME desc diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java index 563c5cac04..78e67f817c 100644 --- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java @@ -1,9 +1,11 @@ package com.epmet.service.impl; +import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.StatsFormDTO; import com.epmet.feign.DataStatisticalOpenFeignClient; import com.epmet.service.StatsProjectService; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -24,7 +26,9 @@ public class StatsProjectServiceImpl implements StatsProjectService { @Override public Result agencyProjectStats(String params) { StatsFormDTO formDTO = new StatsFormDTO(); - formDTO.setDate(params); + if (StringUtils.isNotBlank(params)) { + formDTO = JSON.parseObject(params, StatsFormDTO.class); + } return dataStatisticalOpenFeignClient.agencyProjectStats(formDTO); } @@ -35,7 +39,9 @@ public class StatsProjectServiceImpl implements StatsProjectService { @Override public Result gridProjectStats(String params) { StatsFormDTO formDTO = new StatsFormDTO(); - formDTO.setDate(params); + if (StringUtils.isNotBlank(params)) { + formDTO = JSON.parseObject(params, StatsFormDTO.class); + } return dataStatisticalOpenFeignClient.gridProjectStats(formDTO); } } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java index b265308eaf..8946e7e73a 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java @@ -158,7 +158,7 @@ public class OssController { */ @PostMapping("compressuploadimg") public Result compressUploadImg(@RequestParam("file") MultipartFile file) { - return ossService.compressUploadImg(file, null); + return ossService.compressUploadImg(file, null,200L); } @PostMapping("uploadwximg") @@ -254,15 +254,19 @@ public class OssController { throw new RenException(EpmetErrorCode.OPER_UPLOAD_FILE_OVER_SIZE.getCode() , EpmetErrorCode.OPER_UPLOAD_FILE_OVER_SIZE.getMsg()); } + } + Result result =null; + String originFileName = file.getOriginalFilename(); + String format = "-" + originFileName.substring(originFileName.lastIndexOf(".") + NumConstant.ONE) + "-"; + format = format.toLowerCase(); + int compressSize = 2 * 1024 * 1024; + // 如果是图片,超过2M的压缩一下 + if (ModuleConstant.PROJECT_FILE_IMAGE.contains(format) && file.getSize() > compressSize) { + // 单个图片10M + result= ossService.compressUploadImg(file, null, 2 * 1024); } else { - // 校验文件大小,不超过2m - long maxSize = 2 * 1024 * 1024; - if (size > maxSize) { - throw new RenException(EpmetErrorCode.OPER_UPLOAD_FILE_OVER_SIZE.getCode() - , EpmetErrorCode.OPER_UPLOAD_FILE_OVER_SIZE.getMsg()); - } + result=ossService.uploadImg(file, null); } - Result result = ossService.uploadImg(file, null); if (result != null && result.success() ){ UploadImgResultDTO data = result.getData(); if ( data!= null && StringUtils.isNotBlank(data.getUrl())){ @@ -350,7 +354,13 @@ public class OssController { if (size > maxSize) { throw new RenException(EpmetErrorCode.OPER_UPLOAD_FILE_OVER_SIZE.getCode(), EpmetErrorCode.OPER_UPLOAD_FILE_OVER_SIZE.getMsg()); } - + // 如果是图片,超过2M的压缩一下 + if (ModuleConstant.PROJECT_FILE_IMAGE.contains(format)) {//单个图片10M + int compressSize = 2 * 1024 * 1024; + if(file.getSize()>compressSize){ + return ossService.compressUploadImg(file, null,2 * 1024); + } + } return ossService.uploadVariedFile(file); } @@ -410,7 +420,11 @@ public class OssController { throw new RenException(EpmetErrorCode.OPER_UPLOAD_FILE_TYPE_ERROR.getCode() , EpmetErrorCode.OPER_UPLOAD_FILE_TYPE_ERROR.getMsg()); } - + //如果图片大于2M压缩一下 + int compressSize = 2 * 1024 * 1024; + if(file.getSize()>compressSize){ + return ossService.compressUploadImg(file, null,2 * 1024); + } return ossService.uploadImgV2(file, PrivacyType.EXTERNAL, customerId); } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java index d9e210c006..531cf986fb 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java @@ -31,7 +31,7 @@ public interface OssService extends BaseService { Result uploadImg(MultipartFile file, String privacy); - Result compressUploadImg(MultipartFile file, String privacy); + Result compressUploadImg(MultipartFile file, String privacy,long desFileSize); Result extUpload(MultipartFile file, String fileName, String privacy); diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java index 40d5d7b492..d55751762c 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java @@ -101,7 +101,7 @@ public class OssServiceImpl extends BaseServiceImpl implement } @Override - public Result compressUploadImg(MultipartFile file, String privacy) { + public Result compressUploadImg(MultipartFile file, String privacy,long desFileSize) { if (file.isEmpty()) { return new Result().error(ModuleErrorCode.UPLOAD_FILE_EMPTY); } @@ -110,7 +110,7 @@ public class OssServiceImpl extends BaseServiceImpl implement String url = null; String ossDomain = null; try { - byte[] fileBytes = compressPicCycle(file.getBytes(),200L,0.3); + byte[] fileBytes = compressPicCycle(file.getBytes(),desFileSize,0.3); AbstractCloudStorageService storageService = OssFactory.build(); url = storageService.uploadSuffix(fileBytes, extension, privacy); ossDomain = storageService.getOssDomain(privacy); diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcBuildingDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcBuildingDTO.java index b72e68c723..52567226eb 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcBuildingDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcBuildingDTO.java @@ -141,4 +141,19 @@ public class IcBuildingDTO implements Serializable { */ private Date updatedTime; -} \ No newline at end of file + /** + * 楼栋编码 + */ + private String coding; + + /** + * 楼栋系统编码 + */ + private String sysCoding; + + /** + * 实有人口数 + */ + private Integer realPerson; + +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcHouseDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcHouseDTO.java index f3221c4f69..e026d7cbdc 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcHouseDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcHouseDTO.java @@ -157,4 +157,8 @@ public class IcHouseDTO implements Serializable { */ private String remark; -} \ No newline at end of file + /** + * 房屋可编辑编码 + */ + private String coding; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcNeighborHoodDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcNeighborHoodDTO.java index 14bc28d43b..d50508c522 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcNeighborHoodDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcNeighborHoodDTO.java @@ -129,4 +129,19 @@ public class IcNeighborHoodDTO implements Serializable { */ private Date updatedTime; + /** + * 小区编码 + */ + private String coding; + + /** + * 小区系统编码 + */ + private String sysCoding; + + /** + * 实有楼栋数 + */ + private Integer realBuilding; + } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcOrganizationCodeInfoDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcOrganizationCodeInfoDTO.java new file mode 100644 index 0000000000..edeca85503 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcOrganizationCodeInfoDTO.java @@ -0,0 +1,44 @@ +package com.epmet.dto; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 小区/楼栋/房屋编码辅助表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-06-27 + */ +@Data +public class IcOrganizationCodeInfoDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 社区id + */ + private String communityId; + + /** + * 该社区下最大的小区编码序列号 + */ + private String neighborMaxNum; + + /** + * 该社区下最大的楼栋编码序列号 + */ + private String buildingMaxNum; + + /** + * 该社区下最大的房屋编码序列号 + */ + private String houseMaxNum; + +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/HouseInformationFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/HouseInformationFormDTO.java new file mode 100644 index 0000000000..8fd3a8358e --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/HouseInformationFormDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.dto.form.PageFormDTO; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2022/6/28 15:06 + */ +@Data +public class HouseInformationFormDTO extends PageFormDTO implements Serializable { + private static final long serialVersionUID = 2348447479132364176L; + private String customerId; + private String staffId; + private String communityId; + private String gridId; + private String neighborHoodId; + private String buildingId; + private String unitId; + private String name; + private String sort = "1"; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcBulidingAddFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcBulidingAddFormDTO.java index 58655da002..91b93b2569 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcBulidingAddFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcBulidingAddFormDTO.java @@ -110,7 +110,7 @@ public class IcBulidingAddFormDTO implements Serializable { * 坐标位置 */ - private String location; + private String coordinatePosition; /** @@ -135,7 +135,20 @@ public class IcBulidingAddFormDTO implements Serializable { */ private String buildingLeaderMobile; + /** + * 楼栋编码 + */ + private String coding; + /** + * 楼栋系统编码 + */ + private String sysCoding; + + /** + * 实有人口数 + */ + private Integer realPerson; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcHouseAddFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcHouseAddFormDTO.java index a07f4fe886..aa4e6a999b 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcHouseAddFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcHouseAddFormDTO.java @@ -108,4 +108,9 @@ public class IcHouseAddFormDTO implements Serializable { private BigDecimal sort = NumConstant.ZERO_DECIMAL; + /** + * 房屋可编辑编码 + */ + private String coding; + } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcNeighborHoodAddFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcNeighborHoodAddFormDTO.java index 65708da4d3..854462c6e1 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcNeighborHoodAddFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcNeighborHoodAddFormDTO.java @@ -99,7 +99,20 @@ public class IcNeighborHoodAddFormDTO extends PageFormDTO { private String latitude; + /** + * 小区编码 + */ + private String coding; + /** + * 小区系统编码 + */ + private String sysCoding; + + /** + * 实有楼栋数 + */ + private Integer realBuilding; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/BuildingCountResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/BuildingCountResultDTO.java new file mode 100644 index 0000000000..c6a09dd2ab --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/BuildingCountResultDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dto.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2022/6/28 16:49 + */ +@NoArgsConstructor +@Data +public class BuildingCountResultDTO { + private String buildingId; + private String buildingName; + private String buildingType; + private Integer unitCount = 0; + private Integer houseCount = 0; + private Integer personCount = 0; + private Integer unitRealCount = 0; + private Integer houseRealCount = 0; + private Integer personRealCount = 0; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/BuildingListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/BuildingListResultDTO.java new file mode 100644 index 0000000000..67b4642640 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/BuildingListResultDTO.java @@ -0,0 +1,26 @@ +package com.epmet.dto.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2022/6/28 16:45 + */ +@NoArgsConstructor +@Data +public class BuildingListResultDTO implements Serializable { + private static final long serialVersionUID = -1423424057500044373L; + private String id; + private String name; + private Integer unitCoun = 0; + private Integer houseCount = 0; + private Integer personCount = 0; + private Integer differHouseCount = 0; + private Integer differPersonCount = 0; + private Integer houseRealCount = 0; + private Integer personRealCount = 0; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CommunityCountResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CommunityCountResultDTO.java new file mode 100644 index 0000000000..393d6d5b2e --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CommunityCountResultDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2022/6/28 15:24 + */ +@NoArgsConstructor +@Data +public class CommunityCountResultDTO implements Serializable { + private static final long serialVersionUID = -1677303397440121269L; + private String id; + private String name; + private Integer buildingCount = 0; + private Integer houseCount = 0; + private Integer personCount = 0; + private Integer buildingRealCount = 0; + private Integer houseRealCount = 0; + private Integer personRealCount = 0; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridCountListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridCountListResultDTO.java new file mode 100644 index 0000000000..6863f4cf49 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridCountListResultDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dto.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2022/6/28 15:35 + */ +@NoArgsConstructor +@Data +public class GridCountListResultDTO implements Serializable { + private static final long serialVersionUID = -7938740461257344347L; + private String id; + private String name; + private Integer buildingCount = 0; + private Integer houseCount = 0; + private Integer personCount = 0; + private Integer differBuildingCount = 0; + private Integer differHouseCount = 0; + private Integer differPersonCount = 0; + private Integer buildingRealCount = 0; + private Integer houseRealCount = 0; + private Integer personRealCount = 0; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridStatisticsResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridStatisticsResultDTO.java new file mode 100644 index 0000000000..d855740dca --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridStatisticsResultDTO.java @@ -0,0 +1,26 @@ +package com.epmet.dto.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2022/6/28 15:37 + */ +@NoArgsConstructor +@Data +public class GridStatisticsResultDTO implements Serializable { + + private static final long serialVersionUID = -2022337690871957027L; + private String gridId; + private String gridName; + private Integer buildingCount = 0; + private Integer houseCount = 0; + private Integer personCount = 0; + private Integer buildingRealCount = 0; + private Integer houseRealCount = 0; + private Integer personRealCount = 0; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HomeListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HomeListResultDTO.java new file mode 100644 index 0000000000..9dbf8bfcac --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HomeListResultDTO.java @@ -0,0 +1,22 @@ +package com.epmet.dto.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2022/6/28 17:00 + */ +@NoArgsConstructor +@Data +public class HomeListResultDTO implements Serializable { + private static final long serialVersionUID = -1098032063828430218L; + private String id; + private String name; + private Integer personCount = 0; + private String houseType; + private String houseCode; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseInfoResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseInfoResultDTO.java index e83ec67bf4..ddb4af560e 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseInfoResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseInfoResultDTO.java @@ -103,4 +103,9 @@ public class HouseInfoResultDTO implements Serializable { * 备注 */ private String remark; + + /** + * 房屋可编辑编码 + */ + private String coding; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcBulidingDetailDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcBulidingDetailDTO.java new file mode 100644 index 0000000000..910044f9cb --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcBulidingDetailDTO.java @@ -0,0 +1,120 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + + +@Data +public class IcBulidingDetailDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private String buildingId; + + /** + * 组织id + */ + private String agencyId; + + + /** + * 网格id + */ + private String gridId; + + + /** + * 小区id + */ + private String neighborHoodId; + + /** + * 楼栋名称 + */ + private String buildingName; + + /** + * 楼栋类型 + */ + private String type; + + + /** + * 排序 + */ + private BigDecimal sort; + + /** + * 总单元数 + */ + private Integer totalUnitNum; + + /** + * 总楼层总数 + */ + private Integer totalFloorNum; + + /** + * 总户数 + */ + private Integer totalHouseNum; + /** + * 坐标位置 + */ + + private String coordinatePosition; + + + /** + * 中心点位:经度 + */ + + private String longitude; + + /** + * 中心点位:纬度 + */ + + private String latitude; + + /** + * 楼长姓名 + */ + private String buildingLeaderName; + + /** + * 楼长电话 + */ + private String buildingLeaderMobile; + + + /** + * 楼栋编码 + */ + private String coding; + + /** + * 实有人口数 + */ + private Integer realPerson; + +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/NeighborHoodCountResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/NeighborHoodCountResultDTO.java new file mode 100644 index 0000000000..6795bbb9f3 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/NeighborHoodCountResultDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2022/6/28 16:41 + */ +@NoArgsConstructor +@Data +public class NeighborHoodCountResultDTO implements Serializable { + private static final long serialVersionUID = 4148009467129407023L; + private String neighborHoodId; + private String neighborHoodName; + private Integer buildingCount = 0; + private Integer houseCount = 0; + private Integer personCount = 0; + private Integer buildingRealCount = 0; + private Integer houseRealCount = 0; + private Integer personRealCount = 0; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/NeighborHoodListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/NeighborHoodListResultDTO.java new file mode 100644 index 0000000000..e947b2e385 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/NeighborHoodListResultDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dto.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2022/6/28 16:21 + */ +@NoArgsConstructor +@Data +public class NeighborHoodListResultDTO implements Serializable { + private static final long serialVersionUID = -5333918463141094854L; + private String id; + private String name; + private Integer buildingCount = 0; + private Integer houseCount = 0; + private Integer personCount = 0; + private Integer differBuildingCount = 0; + private Integer differHouseCount = 0; + private Integer differPersonCount = 0; + private Integer buildingRealCount = 0; + private Integer houseRealCount = 0; + private Integer personRealCount = 0; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrganizationCodeResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrganizationCodeResultDTO.java new file mode 100644 index 0000000000..c370f5bbe3 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrganizationCodeResultDTO.java @@ -0,0 +1,26 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @program: epmet-cloud + * @description:小区-楼栋-房屋编码 + * @author: wangtong + * @create: 2022-06-29 09:51 + **/ +@Data +public class OrganizationCodeResultDTO implements Serializable { + + /** + * 可编辑的楼栋编码 + */ + private String coding; + + + /** + * 不可编辑的楼栋编码 + */ + private String sysCoding; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrganizationCommunityDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrganizationCommunityDTO.java new file mode 100644 index 0000000000..1933aeaa66 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrganizationCommunityDTO.java @@ -0,0 +1,24 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @program: epmet-cloud + * @description: + * @author: wangtong + * @create: 2022-06-29 10:13 + **/ +@Data +public class OrganizationCommunityDTO implements Serializable { + + private String communityId; + + private String areaCode; + + private String coding; + + private String sysCoding; + +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/UnitCountResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/UnitCountResultDTO.java new file mode 100644 index 0000000000..f9a634f59d --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/UnitCountResultDTO.java @@ -0,0 +1,18 @@ +package com.epmet.dto.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2022/6/28 16:56 + */ +@NoArgsConstructor +@Data +public class UnitCountResultDTO { + private String unitId; + private String unitName; + private Integer houseCount = 0; + private Integer personCount = 0; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/UnitListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/UnitListResultDTO.java new file mode 100644 index 0000000000..4deeb9dd66 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/UnitListResultDTO.java @@ -0,0 +1,22 @@ +package com.epmet.dto.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2022/6/28 16:53 + */ +@NoArgsConstructor +@Data +public class UnitListResultDTO implements Serializable { + private static final long serialVersionUID = -8750897881106004416L; + private String id; + private String name; + private Integer houseCount = 0; + private Integer personCount = 0; + private Integer differHouseCount = 0; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/enums/OrganizationTypeEnums.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/enums/OrganizationTypeEnums.java new file mode 100644 index 0000000000..5a35712ac7 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/enums/OrganizationTypeEnums.java @@ -0,0 +1,32 @@ +package com.epmet.enums; + +public enum OrganizationTypeEnums { + COMM("community","社区"), + NEI("neighbor","小区"), + BUI("building","楼栋"), + UNIT("unit","单元"); + + private String code; + private String name; + + OrganizationTypeEnums(String code, String name) { + this.code = code; + this.name = name; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseInformationController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseInformationController.java new file mode 100644 index 0000000000..21ca6fb933 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseInformationController.java @@ -0,0 +1,291 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.HouseInformationFormDTO; +import com.epmet.dto.result.*; +import com.epmet.entity.IcNeighborHoodEntity; +import com.epmet.service.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + + +/** + * 双实信息相关 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-10-25 + */ +@RestController +@RequestMapping("houseInformation") +public class HouseInformationController { + + @Autowired + private IcNeighborHoodService icNeighborHoodService; + + @Autowired + private IcBuildingService icBuildingService; + + @Autowired + private IcBuildingUnitService icBuildingUnitService; + + @Resource + private HouseInformationService houseInformationService; + + @Autowired + private IcOrganizationCodeInfoService icOrganizationCodeInfoService; + + /** + * @describe: 【双实录入】小区详情 + * @author wangtong + * @date 2022/6/28 10:48 + * @params [neighborhoodId] + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("neighborhoodDetail/{neighborhoodId}") + public Result neighborhoodDetail(@PathVariable("neighborhoodId") String neighborhoodId){ + return icNeighborHoodService.neighborhoodDetail(neighborhoodId); + } + + /** + * @describe: 【双实录入】楼栋详情 + * @author wangtong + * @date 2022/6/28 14:30 + * @params [buildingId] + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("getBuildingDetail/{buildingId}") + public Result getBuildingDetail(@PathVariable("buildingId") String buildingId){ + return icBuildingService.getBuildingDetail(buildingId); + } + + /** + * @describe: 【双实录入】单元详情 + * @author wangtong + * @date 2022/6/28 15:00 + * @params [unitId] + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("getUnitDetail/{unitId}") + public Result getUnitDetail(@PathVariable("unitId") String unitId){ + return icBuildingUnitService.getUnitDetail(unitId); + } + + /** + * 【双实录入】社区录入数据统计 + * + * @Param tokenDTO + * @Param formDTO + * @Return {@link Result} + * @Author zhaoqifeng + * @Date 2022/6/28 15:32 + */ + @PostMapping("getCommunityCount") + public Result getCommunityCount(@LoginUser TokenDto tokenDTO, @RequestBody HouseInformationFormDTO formDTO) { + formDTO.setCustomerId(tokenDTO.getCustomerId()); + formDTO.setStaffId(tokenDTO.getUserId()); + return new Result().ok(houseInformationService.getCommunityCount(formDTO)); + } + + /** + * 【双实录入】社区-网格列表 + * + * @Param tokenDTO + * @Param formDTO + * @Return {@link Result>} + * @Author zhaoqifeng + * @Date 2022/6/28 15:42 + */ + @PostMapping("getGridList") + public Result> getGridList(@LoginUser TokenDto tokenDTO, @RequestBody HouseInformationFormDTO formDTO) { + formDTO.setCustomerId(tokenDTO.getCustomerId()); + formDTO.setStaffId(tokenDTO.getUserId()); + return new Result>().ok(houseInformationService.getGridList(formDTO)); + } + + /** + * 【双实录入】网格录入数据统计 + * + * @Param tokenDTO + * @Param formDTO + * @Return {@link Result} + * @Author zhaoqifeng + * @Date 2022/6/28 15:42 + */ + @PostMapping("getGridCount") + public Result getGridCount(@LoginUser TokenDto tokenDTO, @RequestBody HouseInformationFormDTO formDTO) { + formDTO.setCustomerId(tokenDTO.getCustomerId()); + formDTO.setStaffId(tokenDTO.getUserId()); + return new Result().ok(houseInformationService.getGridCount(formDTO)); + } + + /** + * 【双实录入】网格-小区列表 + * + * @Param tokenDTO + * @Param formDTO + * @Return {@link Result>} + * @Author zhaoqifeng + * @Date 2022/6/28 16:23 + */ + @PostMapping("getNeighborHoodList") + public Result> getNeighborHoodList(@LoginUser TokenDto tokenDTO, @RequestBody HouseInformationFormDTO formDTO) { + formDTO.setCustomerId(tokenDTO.getCustomerId()); + formDTO.setStaffId(tokenDTO.getUserId()); + return new Result>().ok(houseInformationService.getNeighborHoodList(formDTO)); + } + + /** + * 【双实录入】小区录入数据统计 + * + * @Param tokenDTO + * @Param formDTO + * @Return {@link Result} + * @Author zhaoqifeng + * @Date 2022/6/28 16:44 + */ + @PostMapping("getNeighborHoodCount") + public Result getNeighborHoodCount(@LoginUser TokenDto tokenDTO, @RequestBody HouseInformationFormDTO formDTO) { + formDTO.setCustomerId(tokenDTO.getCustomerId()); + formDTO.setStaffId(tokenDTO.getUserId()); + return new Result().ok(houseInformationService.getNeighborHoodCount(formDTO)); + } + + /** + * 【双实录入】小区-楼栋列表 + * + * @Param tokenDTO + * @Param formDTO + * @Return {@link Result>} + * @Author zhaoqifeng + * @Date 2022/6/28 16:47 + */ + @PostMapping("getBuildingList") + public Result> getBuildingList(@LoginUser TokenDto tokenDTO, @RequestBody HouseInformationFormDTO formDTO) { + formDTO.setCustomerId(tokenDTO.getCustomerId()); + formDTO.setStaffId(tokenDTO.getUserId()); + return new Result>().ok(houseInformationService.getBuildingList(formDTO)); + } + + + /** + * 【双实录入】楼栋录入数据统计 + * + * @Param tokenDTO + * @Param formDTO + * @Return {@link Result} + * @Author zhaoqifeng + * @Date 2022/6/28 16:51 + */ + @PostMapping("getBuildingCount") + public Result getBuildingCount(@LoginUser TokenDto tokenDTO, @RequestBody HouseInformationFormDTO formDTO) { + formDTO.setCustomerId(tokenDTO.getCustomerId()); + formDTO.setStaffId(tokenDTO.getUserId()); + return new Result().ok(houseInformationService.getBuildingCount(formDTO)); + } + + /** + * 【双实录入】楼栋-单元列表 + * + * @Param tokenDTO + * @Param formDTO + * @Return {@link Result>} + * @Author zhaoqifeng + * @Date 2022/6/28 16:55 + */ + @PostMapping("getUnitList") + public Result> getUnitList(@LoginUser TokenDto tokenDTO, @RequestBody HouseInformationFormDTO formDTO) { + formDTO.setCustomerId(tokenDTO.getCustomerId()); + formDTO.setStaffId(tokenDTO.getUserId()); + return new Result>().ok(houseInformationService.getUnitList(formDTO)); + } + + /** + * 【双实录入】单元录入数据统计 + * + * @Param tokenDTO + * @Param formDTO + * @Return {@link Result} + * @Author zhaoqifeng + * @Date 2022/6/28 16:57 + */ + @PostMapping("getUnitCount") + public Result getUnitCount(@LoginUser TokenDto tokenDTO, @RequestBody HouseInformationFormDTO formDTO) { + formDTO.setCustomerId(tokenDTO.getCustomerId()); + formDTO.setStaffId(tokenDTO.getUserId()); + return new Result().ok(houseInformationService.getUnitCount(formDTO)); + } + + /** + * 【双实录入】单元-房屋列表 + * + * @Param tokenDTO + * @Param formDTO + * @Return {@link Result>} + * @Author zhaoqifeng + * @Date 2022/6/28 17:02 + */ + @PostMapping("getHouseList") + public Result> getHouseList(@LoginUser TokenDto tokenDTO, @RequestBody HouseInformationFormDTO formDTO) { + formDTO.setCustomerId(tokenDTO.getCustomerId()); + formDTO.setStaffId(tokenDTO.getUserId()); + return new Result>().ok(houseInformationService.getHouseList(formDTO)); + } + + /** + * @describe: 【双实录入】获取小区编码 + * @author wangtong + * @date 2022/6/29 9:59 + * @params [tokenDTO, gridId] + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("getNeighborHoodCoding/{gridId}") + public Result getNeighborHoodCoding(@LoginUser TokenDto tokenDTO, @PathVariable("gridId") String gridId) { + return icOrganizationCodeInfoService.getNeighborHoodCoding(tokenDTO.getCustomerId(),gridId,false); + } + + /** + * @describe: 【双实录入】获取楼栋编码 + * @author wangtong + * @date 2022/6/29 9:59 + * @params [tokenDTO, neighborhoodId] + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("getBuildingCoding/{neighborhoodId}") + public Result getBuildingCoding(@LoginUser TokenDto tokenDTO, @PathVariable("neighborhoodId") String neighborhoodId) { + return icOrganizationCodeInfoService.getBuildingCoding(tokenDTO.getCustomerId(),neighborhoodId,false); + } + + /** + * @describe: 【双实录入】获取房屋编码 + * @author wangtong + * @date 2022/6/29 9:59 + * @params [tokenDTO, unitId] + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("getHouseCoding/{unitId}") + public Result getHouseCoding(@LoginUser TokenDto tokenDTO, @PathVariable("unitId") String unitId) { + return icOrganizationCodeInfoService.getHouseCoding(tokenDTO.getCustomerId(),unitId,false); + } +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcOrganizationCodeInfoController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcOrganizationCodeInfoController.java new file mode 100644 index 0000000000..5e20a16ea3 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcOrganizationCodeInfoController.java @@ -0,0 +1,82 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.IcOrganizationCodeInfoDTO; +import com.epmet.excel.IcOrganizationCodeInfoExcel; +import com.epmet.service.IcOrganizationCodeInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 小区/楼栋/房屋编码辅助表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-06-27 + */ +@RestController +@RequestMapping("icOrganizationCodeInfo") +public class IcOrganizationCodeInfoController { + + @Autowired + private IcOrganizationCodeInfoService icOrganizationCodeInfoService; + + @RequestMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = icOrganizationCodeInfoService.page(params); + return new Result>().ok(page); + } + + @RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) + public Result get(@PathVariable("id") String id){ + IcOrganizationCodeInfoDTO data = icOrganizationCodeInfoService.get(id); + return new Result().ok(data); + } + + @NoRepeatSubmit + @PostMapping("save") + public Result save(@RequestBody IcOrganizationCodeInfoDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + icOrganizationCodeInfoService.save(dto); + return new Result(); + } + + @NoRepeatSubmit + @PostMapping("update") + public Result update(@RequestBody IcOrganizationCodeInfoDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + icOrganizationCodeInfoService.update(dto); + return new Result(); + } + + @PostMapping("delete") + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + icOrganizationCodeInfoService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = icOrganizationCodeInfoService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, IcOrganizationCodeInfoExcel.class); + } + + + +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java index 737e579fa5..1fb999e0f0 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java @@ -384,4 +384,13 @@ public interface CustomerGridDao extends BaseDao { int updateTotalUser(@Param("gridId") String gridId, @Param("incrCount") long incrCount); List getDelGridIdList(@Param("agencyId") String agencyId); + + /** + * @describe: 通过网格id获取社区行政编码 + * @author wangtong + * @date 2022/6/29 10:16 + * @params [gridId] + * @return com.epmet.dto.result.OrganizationCommunityDTO + */ + OrganizationCommunityDTO selectCommunityByGridId(@Param("gridId") String gridId); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingDao.java index 3fd205a48d..8b0cd3f470 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingDao.java @@ -196,4 +196,32 @@ public interface IcBuildingDao extends BaseDao { */ Integer selectUnitCount(@Param("buildingId")String buildingId); + /** + * @describe: 获取楼栋详情 + * @author wangtong + * @date 2022/6/28 16:16 + * @params [buildingId] + * @return com.epmet.dto.result.IcBulidingDetailDTO + */ + IcBulidingDetailDTO getBuildingDetail(@Param("buildingId") String buildingId); + + /** + * @describe: 查询社区id及楼栋编码 + * @author wangtong + * @date 2022/6/29 14:39 + * @params [buildingId] + * @return com.epmet.dto.result.OrganizationCommunityDTO + */ + OrganizationCommunityDTO selectCommunityByBuildingId(@Param("buildingId") String buildingId); + + /** + * @describe: 通过可编辑编码查询 + * @author wangtong + * @date 2022/6/29 14:57 + * @params [coding] + * @return com.epmet.entity.IcBuildingEntity + */ + IcBuildingEntity selectByCoding(@Param("coding") String coding, + @Param("id") String id); + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingUnitDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingUnitDao.java index 147f25f7d2..09c40920ed 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingUnitDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingUnitDao.java @@ -18,6 +18,8 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.HouseInfoResultDTO; +import com.epmet.dto.result.OrganizationCommunityDTO; import com.epmet.entity.IcBuildingUnitEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -50,4 +52,30 @@ public interface IcBuildingUnitDao extends BaseDao { */ void delUnit(@Param("ids")List ids); -} \ No newline at end of file + /** + * @describe: 获取单元详情 + * @author wangtong + * @date 2022/6/28 17:03 + * @params [unitId] + * @return com.epmet.dto.result.HouseInfoResultDTO + */ + HouseInfoResultDTO getUnitDetail(@Param("unitId") String unitId); + + /** + * @describe: 通过可编辑编码查询 + * @author wangtong + * @date 2022/6/29 14:59 + * @params [coding] + * @return com.epmet.entity.IcBuildingUnitEntity + */ + IcBuildingUnitEntity selectByCoding(@Param("coding") String coding); + + /** + * @describe: 查询社区id及单元编码 + * @author wangtong + * @date 2022/6/29 15:15 + * @params [buildingId] + * @return com.epmet.dto.result.OrganizationCommunityDTO + */ + OrganizationCommunityDTO selectCommunityByUnitId(@Param("unitId") String unitId); +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java index a2213ed024..35abf9d798 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java @@ -176,9 +176,18 @@ public interface IcHouseDao extends BaseDao { /** * desc:更新房屋的屋内居民数 及更新时间 不更新 更新人以及 resiNumber没有变化的 记录 * - * @param houseId, + * @param houseId, * @param resiNumber * @return */ int updateIcHouseResiNumber(String houseId, Integer resiNumber); + + /** + * @return com.epmet.entity.IcHouseEntity + * @describe: 通过可编辑的编码查询 + * @author wangtong + * @date 2022/6/29 15:24 + * @params [coding] + */ + IcHouseEntity selectByCoding(@Param("coding") String coding); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcNeighborHoodDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcNeighborHoodDao.java index ca929081cc..a1999a0ee6 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcNeighborHoodDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcNeighborHoodDao.java @@ -21,8 +21,9 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.IcNeighborHoodDTO; import com.epmet.dto.ImportGeneralDTO; import com.epmet.dto.NeighborHoodAndManagementDTO; +import com.epmet.dto.form.HouseInformationFormDTO; import com.epmet.dto.form.IcNeighborHoodListFormDTO; -import com.epmet.dto.result.IcNeighborHoodResultDTO; +import com.epmet.dto.result.*; import com.epmet.entity.IcHouseEntity; import com.epmet.entity.IcNeighborHoodEntity; import com.epmet.excel.IcNeighborHoodExcel; @@ -91,4 +92,123 @@ public interface IcNeighborHoodDao extends BaseDao { void updateOneNeighborHood(ImportGeneralDTO info); String getAreaCode(@Param("neighborHoodId")String neighborHoodId); + + /** + * @describe: 查询社区id及小区编码 + * @author wangtong + * @date 2022/6/29 13:35 + * @params [neighborhoodId] + * @return com.epmet.dto.result.OrganizationCommunityDTO + */ + OrganizationCommunityDTO selectCommunityByNeiId(@Param("neighborhoodId") String neighborhoodId); + + /** + * @describe: 通过可编辑的编码查询 + * @author wangtong + * @date 2022/6/29 14:08 + * @params [coding] + * @return com.epmet.entity.IcNeighborHoodEntity + */ + IcNeighborHoodEntity selectByCoding(@Param("coding") String coding, + @Param("id") String id); + + /** + * 社区录入数据统计 + * + * @Param communityId + * @Return {@link CommunityCountResultDTO} + * @Author zhaoqifeng + * @Date 2022/6/28 17:16 + */ + CommunityCountResultDTO getCommunityCount(HouseInformationFormDTO formDTO); + + /** + * 【双实录入】社区-网格列表 + * + * @Param formDTO + * @Return {@link List< GridCountListResultDTO>} + * @Author zhaoqifeng + * @Date 2022/6/29 11:06 + */ + List getGridList(HouseInformationFormDTO formDTO); + + /** + * 【双实录入】网格录入数据统计 + * + * @Param formDTO + * @Return {@link GridStatisticsResultDTO} + * @Author zhaoqifeng + * @Date 2022/6/29 13:52 + */ + GridStatisticsResultDTO getGridCount(HouseInformationFormDTO formDTO); + + /** + * 【双实录入】网格-小区列表 + * + * @Param formDTO + * @Return {@link List} + * @Author zhaoqifeng + * @Date 2022/6/29 14:11 + */ + List getNeighborHoodList(HouseInformationFormDTO formDTO); + + /** + * 【双实录入】小区录入数据统计 + * + * @Param formDTO + * @Return {@link NeighborHoodCountResultDTO} + * @Author zhaoqifeng + * @Date 2022/6/29 14:27 + */ + NeighborHoodCountResultDTO getNeighborHoodCount(HouseInformationFormDTO formDTO); + + /** + * 【双实录入】小区-楼栋列表 + * + * @Param formDTO + * @Return {@link List< BuildingListResultDTO>} + * @Author zhaoqifeng + * @Date 2022/6/29 14:50 + */ + List getBuildingList(HouseInformationFormDTO formDTO); + + /** + * 【双实录入】楼栋录入数据统计 + * + * @Param formDTO + * @Return {@link BuildingCountResultDTO} + * @Author zhaoqifeng + * @Date 2022/6/29 15:44 + */ + BuildingCountResultDTO getBuildingCount(HouseInformationFormDTO formDTO); + + /** + * 【双实录入】楼栋-单元列表 + * + * @Param formDTO + * @Return {@link List} + * @Author zhaoqifeng + * @Date 2022/6/29 16:07 + */ + List getUnitList(HouseInformationFormDTO formDTO); + + /** + * 【双实录入】单元录入数据统计 + * + * @Param formDTO + * @Return {@link UnitCountResultDTO} + * @Author zhaoqifeng + * @Date 2022/6/29 16:06 + */ + UnitCountResultDTO getUnitCount(HouseInformationFormDTO formDTO); + + /** + * 【双实录入】单元-房屋列表 + * + * @Param formDTO + * @Return {@link List} + * @Author zhaoqifeng + * @Date 2022/6/29 16:48 + */ + List getHouseList(HouseInformationFormDTO formDTO); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcOrganizationCodeInfoDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcOrganizationCodeInfoDao.java new file mode 100644 index 0000000000..d217c69a5a --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcOrganizationCodeInfoDao.java @@ -0,0 +1,63 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.IcOrganizationCodeInfoEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 小区/楼栋/房屋编码辅助表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-06-27 + */ +@Mapper +public interface IcOrganizationCodeInfoDao extends BaseDao { + + /** + * @describe: 通过客户id和社区id查询 + * @author wangtong + * @date 2022/6/29 10:24 + * @params [customerId, communityId] + * @return com.epmet.entity.IcOrganizationCodeInfoEntity + */ + IcOrganizationCodeInfoEntity selectByIdAndType(@Param("customerId") String customerId, + @Param("sysId") String sysId, + @Param("sysType") String sysType); + + /** + * @describe: 根据客户id和社区id更新小区编号 + * @author wangtong + * @date 2022/6/29 10:53 + * @params [communEntity] + * @return void + */ + void updateMaxNumByIdAndType(IcOrganizationCodeInfoEntity communEntity); + +// /** +// * @describe: 根据客户id和社区id更新楼栋编号 +// * @author wangtong +// * @date 2022/6/29 14:51 +// * @params [buildingEntity] +// * @return void +// */ +// void updateBuildingByCuIdAndCoId(IcOrganizationCodeInfoEntity buildingEntity); +// +// /** +// * @describe: 根据客户id和社区id更新单元编号 +// * @author wangtong +// * @date 2022/6/29 15:01 +// * @params [unitEntity] +// * @return void +// */ +// void updateUnitByCuIdAndCoId(IcOrganizationCodeInfoEntity unitEntity); +// +// /** +// * @describe: 根据客户id和社区id更新房屋编号 +// * @author wangtong +// * @date 2022/6/29 15:25 +// * @params [houseEntity] +// * @return void +// */ +// void updateHouseByCuIdAndCoId(IcOrganizationCodeInfoEntity houseEntity); +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcBuildingEntity.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcBuildingEntity.java index 1b0535f803..801267e2dd 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcBuildingEntity.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcBuildingEntity.java @@ -107,4 +107,19 @@ public class IcBuildingEntity extends BaseEpmetEntity { */ private String coordinatePosition; + /** + * 楼栋编码 + */ + private String coding; + + /** + * 楼栋系统编码 + */ + private String sysCoding; + + /** + * 实有人口数 + */ + private Integer realPerson; + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcBuildingUnitEntity.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcBuildingUnitEntity.java index bce611c47f..02124c90cc 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcBuildingUnitEntity.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcBuildingUnitEntity.java @@ -55,4 +55,14 @@ public class IcBuildingUnitEntity extends BaseEpmetEntity { */ private String unitName; + /** + * 楼栋编码 + */ + private String coding; + + /** + * 楼栋系统编码 + */ + private String sysCoding; + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcHouseEntity.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcHouseEntity.java index 25a02ec5fd..96e993c865 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcHouseEntity.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcHouseEntity.java @@ -132,4 +132,8 @@ public class IcHouseEntity extends BaseEpmetEntity { * 居住人数 */ private Integer resiNumber; + /** + * 房屋可编辑编码 + */ + private String coding; } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcNeighborHoodEntity.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcNeighborHoodEntity.java index 8f83a0aba1..f96edb70bb 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcNeighborHoodEntity.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcNeighborHoodEntity.java @@ -101,4 +101,19 @@ public class IcNeighborHoodEntity extends BaseEpmetEntity { @TableField(exist = false) private String propertyName; + + /** + * 小区编码 + */ + private String coding; + + /** + * 小区系统编码 + */ + private String sysCoding; + + /** + * 实有楼栋数 + */ + private Integer realBuilding; } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcOrganizationCodeInfoEntity.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcOrganizationCodeInfoEntity.java new file mode 100644 index 0000000000..a5d9c8e9a4 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcOrganizationCodeInfoEntity.java @@ -0,0 +1,45 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 小区/楼栋/房屋编码辅助表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-06-27 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ic_organization_code_info") +public class IcOrganizationCodeInfoEntity{ + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 社区/小区/楼栋/单元id + */ + private String sysId; + + /** + * 类型: + * 社区community + * 小区neighbor + * 楼栋building + * 单元unit + */ + private String sysType; + + /** + * 最大数 + */ + private String maxNum; + + +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/IcOrganizationCodeInfoExcel.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/IcOrganizationCodeInfoExcel.java new file mode 100644 index 0000000000..3402ef797a --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/IcOrganizationCodeInfoExcel.java @@ -0,0 +1,33 @@ +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 小区/楼栋/房屋编码辅助表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-06-27 + */ +@Data +public class IcOrganizationCodeInfoExcel { + + @Excel(name = "客户id") + private String customerId; + + @Excel(name = "社区id") + private String communityId; + + @Excel(name = "该社区下最大的小区编码序列号") + private String neighborMaxNum; + + @Excel(name = "该社区下最大的楼栋编码序列号") + private String buildingMaxNum; + + @Excel(name = "该社区下最大的房屋编码序列号") + private String houseMaxNum; + + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/redis/IcOrganizationCodeInfoRedis.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/redis/IcOrganizationCodeInfoRedis.java new file mode 100644 index 0000000000..50860d27ae --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/redis/IcOrganizationCodeInfoRedis.java @@ -0,0 +1,30 @@ +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 小区/楼栋/房屋编码辅助表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-06-27 + */ +@Component +public class IcOrganizationCodeInfoRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseInformationService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseInformationService.java new file mode 100644 index 0000000000..ab49566845 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseInformationService.java @@ -0,0 +1,112 @@ +package com.epmet.service; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.form.HouseInformationFormDTO; +import com.epmet.dto.result.*; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2022/6/28 15:14 + */ +public interface HouseInformationService { + /** + * 【双实录入】社区录入数据统计 + * + * @Param formDTO + * @Return {@link CommunityCountResultDTO} + * @Author zhaoqifeng + * @Date 2022/6/28 15:31 + */ + CommunityCountResultDTO getCommunityCount(HouseInformationFormDTO formDTO); + + /** + * 【双实录入】社区-网格列表 + * + * @Param formDTO + * @Return {@link PageData} + * @Author zhaoqifeng + * @Date 2022/6/28 15:41 + */ + PageData getGridList(HouseInformationFormDTO formDTO); + + /** + * 【双实录入】网格录入数据统计 + * + * @Param formDTO + * @Return {@link GridStatisticsResultDTO} + * @Author zhaoqifeng + * @Date 2022/6/28 15:41 + */ + GridStatisticsResultDTO getGridCount(HouseInformationFormDTO formDTO); + + /** + * 【双实录入】网格-小区列表 + * + * @Param formDTO + * @Return {@link PageData} + * @Author zhaoqifeng + * @Date 2022/6/28 16:24 + */ + PageData getNeighborHoodList(HouseInformationFormDTO formDTO); + + /** + * 【双实录入】小区录入数据统计 + * + * @Param formDTO + * @Return {@link NeighborHoodCountResultDTO} + * @Author zhaoqifeng + * @Date 2022/6/28 16:43 + */ + NeighborHoodCountResultDTO getNeighborHoodCount(HouseInformationFormDTO formDTO); + + /** + * 【双实录入】小区-楼栋列表 + * + * @Param formDTO + * @Return {@link PageData} + * @Author zhaoqifeng + * @Date 2022/6/28 16:47 + */ + PageData getBuildingList(HouseInformationFormDTO formDTO); + + /** + * 【双实录入】楼栋录入数据统计 + * + * @Param formDTO + * @Return {@link BuildingCountResultDTO} + * @Author zhaoqifeng + * @Date 2022/6/28 16:50 + */ + BuildingCountResultDTO getBuildingCount(HouseInformationFormDTO formDTO); + + /** + * 【双实录入】楼栋-单元列表 + * + * @Param formDTO + * @Return {@link PageData} + * @Author zhaoqifeng + * @Date 2022/6/28 16:54 + */ + PageData getUnitList(HouseInformationFormDTO formDTO); + + /** + * 【双实录入】单元录入数据统计 + * + * @Param formDTO + * @Return {@link UnitCountResultDTO} + * @Author zhaoqifeng + * @Date 2022/6/28 16:57 + */ + UnitCountResultDTO getUnitCount(HouseInformationFormDTO formDTO); + + /** + * 【双实录入】单元-房屋列表 + * + * @Param formDTO + * @Return {@link PageData} + * @Author zhaoqifeng + * @Date 2022/6/28 17:01 + */ + PageData getHouseList(HouseInformationFormDTO formDTO); +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcBuildingService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcBuildingService.java index 0822d4805b..cde64d4da0 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcBuildingService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcBuildingService.java @@ -20,8 +20,10 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.Result; import com.epmet.dto.IcBuildingDTO; import com.epmet.dto.ImportGeneralDTO; +import com.epmet.dto.result.IcBulidingDetailDTO; import com.epmet.entity.IcBuildingEntity; import java.util.List; @@ -122,4 +124,13 @@ public interface IcBuildingService extends BaseService { * @date 2022/4/27 13:29 */ void updateBuilding(ImportGeneralDTO info); -} \ No newline at end of file + + /** + * @describe: 【双实录入】楼栋详情 + * @author wangtong + * @date 2022/6/28 14:30 + * @params [buildingId] + * @return com.epmet.commons.tools.utils.Result + */ + Result getBuildingDetail(String buildingId); +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcBuildingUnitService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcBuildingUnitService.java index 0d315539e6..da966fbf6e 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcBuildingUnitService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcBuildingUnitService.java @@ -20,7 +20,9 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.Result; import com.epmet.dto.IcBuildingUnitDTO; +import com.epmet.dto.result.HouseInfoResultDTO; import com.epmet.entity.IcBuildingUnitEntity; import java.util.List; @@ -112,4 +114,13 @@ public interface IcBuildingUnitService extends BaseService * @Date 2022/2/14 15:42 */ IcBuildingUnitDTO getUnitInfo(String buildingId, String unitName); -} \ No newline at end of file + + /** + * @describe: 【双实录入】单元详情 + * @author wangtong + * @date 2022/6/28 15:00 + * @params [unitId] + * @return com.epmet.commons.tools.utils.Result + */ + Result getUnitDetail(String unitId); +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcNeighborHoodService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcNeighborHoodService.java index 087ab03441..085c363819 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcNeighborHoodService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcNeighborHoodService.java @@ -172,4 +172,13 @@ public interface IcNeighborHoodService extends BaseService * @date 2022/4/27 10:33 */ void neighborHoodPropertyUpdate(List updateNeighborHoodAndManagement); + + /** + * @describe: 【双实录入】小区详情 + * @author wangtong + * @date 2022/6/28 15:04 + * @params [neighborhoodId] + * @return com.epmet.commons.tools.utils.Result + */ + Result neighborhoodDetail(String neighborhoodId); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcOrganizationCodeInfoService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcOrganizationCodeInfoService.java new file mode 100644 index 0000000000..58791b1b44 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcOrganizationCodeInfoService.java @@ -0,0 +1,116 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.IcOrganizationCodeInfoDTO; +import com.epmet.dto.result.OrganizationCodeResultDTO; +import com.epmet.entity.IcOrganizationCodeInfoEntity; + +import java.util.List; +import java.util.Map; + +/** + * 小区/楼栋/房屋编码辅助表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-06-27 + */ +public interface IcOrganizationCodeInfoService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-06-27 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-06-27 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return IcOrganizationCodeInfoDTO + * @author generator + * @date 2022-06-27 + */ + IcOrganizationCodeInfoDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-06-27 + */ + void save(IcOrganizationCodeInfoDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-06-27 + */ + void update(IcOrganizationCodeInfoDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-06-27 + */ + void delete(String[] ids); + + /** + * @describe: 【双实录入】获取小区编码 + * @author wangtong + * @date 2022/6/29 9:59 + * @params [tokenDTO, gridId] + * @return com.epmet.commons.tools.utils.Result + */ + Result getNeighborHoodCoding(String customerId, String gridId,Boolean updateFlag); + + /** + * @describe: 【双实录入】获取楼栋编码 + * @author wangtong + * @date 2022/6/29 9:59 + * @params [tokenDTO, neighborhoodId] + * @return com.epmet.commons.tools.utils.Result + */ + Result getBuildingCoding(String customerId, String neighborhoodId,Boolean updateFlag); + + /** + * @describe: 【双实录入】获取单元编码 + * @author wangtong + * @date 2022/6/29 9:59 + * @params [tokenDTO, neighborhoodId] + * @return com.epmet.commons.tools.utils.Result + */ + Result getUnitCoding(String customerId, String buildingId,Boolean updateFlag); + + /** + * @describe: 【双实录入】获取房屋编码 + * @author wangtong + * @date 2022/6/29 9:59 + * @params [tokenDTO, unitId] + * @return com.epmet.commons.tools.utils.Result + */ + Result getHouseCoding(String customerId, String unitId,Boolean updateFlag); +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java index 6a95c20596..77fb6a3d53 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java @@ -33,15 +33,13 @@ import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.entity.*; import com.epmet.enums.BuildingTypeEnums; +import com.epmet.enums.OrganizationTypeEnums; import com.epmet.excel.IcBuildingExcel; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.model.BuildingInfoModel; import com.epmet.model.ImportBuildingInfoListener; import com.epmet.redis.IcHouseRedis; -import com.epmet.service.BuildingService; -import com.epmet.service.IcBuildingService; -import com.epmet.service.IcBuildingUnitService; -import com.epmet.service.IcNeighborHoodService; +import com.epmet.service.*; import com.epmet.util.ExcelPoiUtils; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; @@ -91,6 +89,13 @@ public class BuildingServiceImpl implements BuildingService { private EpmetCommonServiceOpenFeignClient epmetCommonServiceOpenFeignClient; @Autowired private ExecutorService executorService; + @Autowired + private IcOrganizationCodeInfoService icOrganizationCodeInfoService; + @Autowired + private IcOrganizationCodeInfoDao icOrganizationCodeInfoDao; + @Autowired + private IcOrganizationCodeInfoServiceImpl icOrganizationCodeInfoServiceImpl; + @Override @Transactional(rollbackFor = Exception.class) @@ -100,6 +105,14 @@ public class BuildingServiceImpl implements BuildingService { if (null != count && count > 0) { throw new RenException(EpmetErrorCode.BUILDING_NAME_EXITED.getCode(), EpmetErrorCode.BUILDING_NAME_EXITED.getMsg()); } + //楼栋编码不可重复 + if(org.apache.commons.lang3.StringUtils.isNotBlank(formDTO.getCoding())){ + IcBuildingEntity isHaveCoding = icBuildingDao.selectByCoding(formDTO.getCoding(),null); + if(null != isHaveCoding){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "该楼栋编码已存在,请勿重复!","该楼栋编码已存在,请勿重复!"); + } + updateBuildingMaxNum(customerId,formDTO); + } IcBuildingDTO icBuildingDTO = ConvertUtils.sourceToTarget(formDTO, IcBuildingDTO.class); icBuildingDTO.setCustomerId(customerId); IcBuildingEntity entity = ConvertUtils.sourceToTarget(icBuildingDTO, IcBuildingEntity.class); @@ -114,12 +127,42 @@ public class BuildingServiceImpl implements BuildingService { icBuildingUnit.setBuildingId(entity.getId()); icBuildingUnit.setUnitName((i + 1) + "单元"); icBuildingUnit.setUnitNum(String.valueOf(i + 1)); + Result codeResult = icOrganizationCodeInfoService.getUnitCoding(customerId,entity.getId(),true); + if(!codeResult.success() || null == codeResult.getData()){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "生成单元编码异常,请联系管理员","生成单元编码异常,请联系管理员"); + } + icBuildingUnit.setCoding(codeResult.getData().getCoding()); + icBuildingUnit.setSysCoding(codeResult.getData().getSysCoding()); unitList.add(icBuildingUnit); } icBuildingUnitService.insertBatch(unitList, NumConstant.ONE_HUNDRED); } + /** + * @describe: 如果编码未改动提交,则最大数+1 + * @author wangtong + * @date 2022/7/5 10:43 + * @params [formDTO] + * @return void + */ + private void updateBuildingMaxNum(String customerId,IcBulidingAddFormDTO formDTO){ + //如果是自增的,则最大数+1 + IcOrganizationCodeInfoEntity communEntity = icOrganizationCodeInfoDao.selectByIdAndType(customerId, formDTO.getNeighborHoodId(), OrganizationTypeEnums.NEI.getCode()); + Integer buildMaxNum = org.apache.commons.lang3.StringUtils.isBlank(communEntity.getMaxNum())?1:Integer.valueOf(communEntity.getMaxNum()) + 1; + Integer submitMaxNum = null; + try { + submitMaxNum = Integer.valueOf(formDTO.getCoding().substring(formDTO.getCoding().length()-3)); + }catch (Exception e){ + e.printStackTrace(); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "编码转换失败", "编码转换失败"); + } + if(buildMaxNum.intValue() == submitMaxNum.intValue()){ + communEntity.setMaxNum(icOrganizationCodeInfoServiceImpl.getNewMaxIndex(3, buildMaxNum)); + icOrganizationCodeInfoDao.updateMaxNumByIdAndType(communEntity); + } + } + @Override public List treeList(String customerId, String staffId) { CustomerStaffInfoCacheResult agency = CustomerStaffRedis.getStaffInfo(customerId, staffId); @@ -440,6 +483,15 @@ public class BuildingServiceImpl implements BuildingService { throw new RenException(EpmetErrorCode.ORG_EDIT_FAILED.getCode(), "楼栋单元下存在房屋,无法更新"); } } + //楼栋编码不可重复 + formDTO.setSysCoding(null); + if(org.apache.commons.lang3.StringUtils.isNotBlank(formDTO.getCoding())){ + IcBuildingEntity isHaveCoding = icBuildingDao.selectByCoding(formDTO.getCoding(),formDTO.getBuildingId()); + if(null != isHaveCoding){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "该楼栋编码已存在,请勿重复!","该楼栋编码已存在,请勿重复!"); + } + updateBuildingMaxNum(customerId,formDTO); + } IcBuildingDTO icBuildingDTO = ConvertUtils.sourceToTarget(formDTO, IcBuildingDTO.class); icBuildingDTO.setId(formDTO.getBuildingId()); icBuildingDTO.setCustomerId(customerId); @@ -481,6 +533,12 @@ public class BuildingServiceImpl implements BuildingService { icBuildingUnit.setCustomerId(customerId); icBuildingUnit.setUnitName(unitNum + "单元"); icBuildingUnit.setUnitNum(unitNum); + Result codeResult = icOrganizationCodeInfoService.getUnitCoding(customerId,icBuilding.getId(),true); + if(!codeResult.success() || null == codeResult.getData()){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "生成单元编码异常,请联系管理员","生成单元编码异常,请联系管理员"); + } + icBuildingUnit.setCoding(codeResult.getData().getCoding()); + icBuildingUnit.setSysCoding(codeResult.getData().getSysCoding()); unitList.add(icBuildingUnit); } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index 6d46ba3b3a..5839114b8b 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -710,6 +710,9 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl map = getMapResult(countFormDTO); + if (map.containsKey(formDTO.getCommunityId())) { + result.setPersonCount(map.get(formDTO.getCommunityId())); + } + return result; + } + + /** + * 【双实录入】社区-网格列表 + * + * @param formDTO + * @Param formDTO + * @Return {@link PageData} + * @Author zhaoqifeng + * @Date 2022/6/28 15:41 + */ + @Override + public PageData getGridList(HouseInformationFormDTO formDTO) { + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); + List list = icNeighborHoodDao.getGridList(formDTO); + PageInfo pageInfo = new PageInfo<>(list); + if (CollectionUtils.isNotEmpty(list)) { + //获取录入人口数 + IcUserCountFormDTO countFormDTO = new IcUserCountFormDTO(); + countFormDTO.setOrgType(NumConstant.ZERO_STR); + countFormDTO.setOrgId(formDTO.getCommunityId()); + countFormDTO.setType(NumConstant.ONE_STR); + Map map = getMapResult(countFormDTO); + + list.forEach(item -> { + if (map.containsKey(item.getId())) { + item.setPersonCount(map.get(item.getId())); + } + item.setDifferPersonCount(item.getPersonRealCount() - item.getPersonCount()); + }); + + } + return new PageData<>(list, pageInfo.getTotal()); + } + + /** + * 【双实录入】网格录入数据统计 + * + * @param formDTO + * @Param formDTO + * @Return {@link GridStatisticsResultDTO} + * @Author zhaoqifeng + * @Date 2022/6/28 15:41 + */ + @Override + public GridStatisticsResultDTO getGridCount(HouseInformationFormDTO formDTO) { + GridStatisticsResultDTO result = icNeighborHoodDao.getGridCount(formDTO); + //获取录入人口数 + IcUserCountFormDTO countFormDTO = new IcUserCountFormDTO(); + countFormDTO.setOrgType(NumConstant.ONE_STR); + countFormDTO.setOrgId(formDTO.getGridId()); + countFormDTO.setType(NumConstant.ZERO_STR); + Map map = getMapResult(countFormDTO); + if (map.containsKey(formDTO.getGridId())) { + result.setPersonCount(map.get(formDTO.getGridId())); + } + return result; + } + + /** + * 【双实录入】网格-小区列表 + * + * @param formDTO + * @Param formDTO + * @Return {@link PageData} + * @Author zhaoqifeng + * @Date 2022/6/28 16:24 + */ + @Override + public PageData getNeighborHoodList(HouseInformationFormDTO formDTO) { + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); + List list = icNeighborHoodDao.getNeighborHoodList(formDTO); + PageInfo pageInfo = new PageInfo<>(list); + if (CollectionUtils.isNotEmpty(list)) { + //获取录入人口数 + IcUserCountFormDTO countFormDTO = new IcUserCountFormDTO(); + countFormDTO.setOrgType(NumConstant.ONE_STR); + countFormDTO.setOrgId(formDTO.getGridId()); + countFormDTO.setType(NumConstant.ONE_STR); + Map map = getMapResult(countFormDTO); + list.forEach(item -> { + if (map.containsKey(item.getId())) { + item.setPersonCount(map.get(item.getId())); + } + item.setDifferPersonCount(item.getPersonRealCount() - item.getPersonCount()); + }); + } + return new PageData<>(list, pageInfo.getTotal()); + } + + /** + * 【双实录入】小区录入数据统计 + * + * @param formDTO + * @Param formDTO + * @Return {@link NeighborHoodCountResultDTO} + * @Author zhaoqifeng + * @Date 2022/6/28 16:43 + */ + @Override + public NeighborHoodCountResultDTO getNeighborHoodCount(HouseInformationFormDTO formDTO) { + NeighborHoodCountResultDTO result = icNeighborHoodDao.getNeighborHoodCount(formDTO); + //获取录入人口数 + IcUserCountFormDTO countFormDTO = new IcUserCountFormDTO(); + countFormDTO.setOrgType(NumConstant.TWO_STR); + countFormDTO.setOrgId(formDTO.getNeighborHoodId()); + countFormDTO.setType(NumConstant.ZERO_STR); + Map map = getMapResult(countFormDTO); + if (map.containsKey(formDTO.getNeighborHoodId())) { + result.setPersonCount(map.get(formDTO.getNeighborHoodId())); + } + return result; + } + + /** + * 【双实录入】小区-楼栋列表 + * + * @param formDTO + * @Param formDTO + * @Return {@link PageData} + * @Author zhaoqifeng + * @Date 2022/6/28 16:47 + */ + @Override + public PageData getBuildingList(HouseInformationFormDTO formDTO) { + List list; + long total = 0; + + //获取录入人口数 + IcUserCountFormDTO countFormDTO = new IcUserCountFormDTO(); + countFormDTO.setOrgType(NumConstant.TWO_STR); + countFormDTO.setOrgId(formDTO.getNeighborHoodId()); + countFormDTO.setType(NumConstant.ONE_STR); + Map map = getMapResult(countFormDTO); + + if (!NumConstant.FIVE_STR.equals(formDTO.getSort())) { + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); + list = icNeighborHoodDao.getBuildingList(formDTO); + PageInfo pageInfo = new PageInfo<>(list); + total = pageInfo.getTotal(); + + if (CollectionUtils.isNotEmpty(list)) { + list.forEach(item -> { + if (map.containsKey(item.getId())) { + item.setPersonCount(map.get(item.getId())); + } + item.setDifferPersonCount(item.getPersonRealCount() - item.getPersonCount()); + }); + } + } else { + list = icNeighborHoodDao.getBuildingList(formDTO); + if (CollectionUtils.isNotEmpty(list)) { + total = list.size(); + list.forEach(item -> { + if (map.containsKey(item.getId())) { + item.setPersonCount(map.get(item.getId())); + } + item.setDifferPersonCount(item.getPersonRealCount() - item.getPersonCount()); + }); + + //排序 + list = list.stream().sorted(Comparator.comparing(BuildingListResultDTO::getDifferPersonCount).reversed()).collect(Collectors.toList()); + //分页 + list = list.stream().skip((long)(formDTO.getPageNo() - 1) * formDTO.getPageSize()).limit(formDTO.getPageSize()).collect(Collectors.toList()); + } + } + + + return new PageData<>(list, total); + } + + /** + * 【双实录入】楼栋录入数据统计 + * + * @param formDTO + * @Param formDTO + * @Return {@link BuildingCountResultDTO} + * @Author zhaoqifeng + * @Date 2022/6/28 16:50 + */ + @Override + public BuildingCountResultDTO getBuildingCount(HouseInformationFormDTO formDTO) { + BuildingCountResultDTO result = icNeighborHoodDao.getBuildingCount(formDTO); + //获取录入人口数 + IcUserCountFormDTO countFormDTO = new IcUserCountFormDTO(); + countFormDTO.setOrgType(NumConstant.THREE_STR); + countFormDTO.setOrgId(formDTO.getBuildingId()); + countFormDTO.setType(NumConstant.ZERO_STR); + Map map = getMapResult(countFormDTO); + if (map.containsKey(formDTO.getBuildingId())) { + result.setPersonCount(map.get(formDTO.getBuildingId())); + } + result.setBuildingType(BuildingTypeEnums.getTypeValue(result.getBuildingType())); + return result; + } + + /** + * 【双实录入】楼栋-单元列表 + * + * @param formDTO + * @Param formDTO + * @Return {@link PageData} + * @Author zhaoqifeng + * @Date 2022/6/28 16:54 + */ + @Override + public PageData getUnitList(HouseInformationFormDTO formDTO) { + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); + List list = icNeighborHoodDao.getUnitList(formDTO); + PageInfo pageInfo = new PageInfo<>(list); + if (CollectionUtils.isNotEmpty(list)) { + //获取录入人口数 + IcUserCountFormDTO countFormDTO = new IcUserCountFormDTO(); + countFormDTO.setOrgType(NumConstant.THREE_STR); + countFormDTO.setOrgId(formDTO.getBuildingId()); + countFormDTO.setType(NumConstant.ONE_STR); + Map map = getMapResult(countFormDTO); + list.forEach(item -> { + if (map.containsKey(item.getId())) { + item.setPersonCount(map.get(item.getId())); + } + }); + } + return new PageData<>(list, pageInfo.getTotal()); + } + + /** + * 【双实录入】单元录入数据统计 + * + * @param formDTO + * @Param formDTO + * @Return {@link UnitCountResultDTO} + * @Author zhaoqifeng + * @Date 2022/6/28 16:57 + */ + @Override + public UnitCountResultDTO getUnitCount(HouseInformationFormDTO formDTO) { + UnitCountResultDTO result = icNeighborHoodDao.getUnitCount(formDTO); + //获取录入人口数 + IcUserCountFormDTO countFormDTO = new IcUserCountFormDTO(); + countFormDTO.setOrgType(NumConstant.FOUR_STR); + countFormDTO.setOrgId(formDTO.getUnitId()); + countFormDTO.setType(NumConstant.ZERO_STR); + Map map = getMapResult(countFormDTO); + if (map.containsKey(formDTO.getUnitId())) { + result.setPersonCount(map.get(formDTO.getUnitId())); + } + return result; + } + + /** + * 【双实录入】单元-房屋列表 + * + * @param formDTO + * @Param formDTO + * @Return {@link PageData} + * @Author zhaoqifeng + * @Date 2022/6/28 17:01 + */ + @Override + public PageData getHouseList(HouseInformationFormDTO formDTO) { + List list = null; + long total = 0; + //获取录入人口数 + IcUserCountFormDTO countFormDTO = new IcUserCountFormDTO(); + countFormDTO.setOrgType(NumConstant.FOUR_STR); + countFormDTO.setOrgId(formDTO.getUnitId()); + countFormDTO.setType(NumConstant.ONE_STR); + Map map = getMapResult(countFormDTO); + + if (!NumConstant.TWO_STR.equals(formDTO.getSort())) { + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); + list = icNeighborHoodDao.getHouseList(formDTO); + PageInfo pageInfo = new PageInfo<>(list); + total = pageInfo.getTotal(); + if (CollectionUtils.isNotEmpty(list)) { + list.forEach(item -> { + item.setHouseType(HouseRentFlagEnums.getTypeValue(item.getHouseType())); + if (map.containsKey(item.getId())) { + item.setPersonCount(map.get(item.getId())); + } + }); + } + } else { + list = icNeighborHoodDao.getHouseList(formDTO); + if (CollectionUtils.isNotEmpty(list)) { + total = list.size(); + list.forEach(item -> { + item.setHouseType(HouseRentFlagEnums.getTypeValue(item.getHouseType())); + if (map.containsKey(item.getId())) { + item.setPersonCount(map.get(item.getId())); + } + }); + //排序 + list = list.stream().sorted(Comparator.comparing(HomeListResultDTO::getPersonCount).reversed()).collect(Collectors.toList()); + //分页 + list = list.stream().skip((long)(formDTO.getPageNo() - 1) * formDTO.getPageSize()).limit(formDTO.getPageSize()).collect(Collectors.toList()); + } + } + + return new PageData<>(list, total); + } + + private Map getMapResult(IcUserCountFormDTO countFormDTO) { + Result> result = userOpenFeignClient.getIcUserCount(countFormDTO); + if (!result.success()) { + log.warn("查询录入人数失败"); + return Collections.emptyMap(); + } + return result.getData(); + } +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java index 76ce9a6149..c89d9eb8c4 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java @@ -34,10 +34,7 @@ import com.epmet.dto.*; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.entity.*; -import com.epmet.enums.HouseChangeEnums; -import com.epmet.enums.HousePurposeEnums; -import com.epmet.enums.HouseRentFlagEnums; -import com.epmet.enums.HouseTypeEnums; +import com.epmet.enums.*; import com.epmet.feign.EpmetAdminOpenFeignClient; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient; @@ -126,6 +123,12 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { private OssFeignClient ossFeignClient; @Autowired private EpmetAdminOpenFeignClient epmetAdminOpenFeignClient; + @Autowired + private IcOrganizationCodeInfoDao icOrganizationCodeInfoDao; + @Autowired + private IcOrganizationCodeInfoServiceImpl icOrganizationCodeInfoServiceImpl; + @Autowired + private IcBuildingUnitDao icBuildingUnitDao; @Override @@ -136,7 +139,14 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { if (null != count && count > 0) { throw new RenException(EpmetErrorCode.DOOR_NAME_EXITED.getCode(), EpmetErrorCode.DOOR_NAME_EXITED.getMsg()); } - + //房屋编码不可重复 + if(org.apache.commons.lang3.StringUtils.isNotBlank(formDTO.getCoding())){ + IcHouseEntity isHaveCoding = icHouseDao.selectByCoding(formDTO.getCoding()); + if(null != isHaveCoding){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "该房屋编码已存在,请勿重复!","该房屋编码已存在,请勿重复!"); + } + updateHouseMaxNum(customerId,formDTO); + } IcHouseEntity icHouseDTO = ConvertUtils.sourceToTarget(formDTO, IcHouseEntity.class); icHouseDTO.setCustomerId(customerId); icHouseDTO.setHouseName(getHouseName(formDTO)); @@ -168,6 +178,30 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { icHouseDao.updateById(entity); } + /** + * @describe: 如果编码未改动提交,则最大数+1 + * @author wangtong + * @date 2022/7/5 10:53 + * @params [customerId, formDTO] + * @return void + */ + private void updateHouseMaxNum(String customerId, IcHouseAddFormDTO formDTO){ + //如果是自增的,则最大数+1 + IcOrganizationCodeInfoEntity communEntity = icOrganizationCodeInfoDao.selectByIdAndType(customerId, formDTO.getBuildingUnitId(), OrganizationTypeEnums.UNIT.getCode()); + Integer houseMaxNum = org.apache.commons.lang3.StringUtils.isBlank(communEntity.getMaxNum())?1:Integer.valueOf(communEntity.getMaxNum()) + 1; + Integer submitMaxNum = null; + try { + submitMaxNum = Integer.valueOf(formDTO.getCoding().substring(formDTO.getCoding().length()-4)); + }catch (Exception e){ + e.printStackTrace(); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "编码转换失败", "编码转换失败"); + } + if(houseMaxNum.intValue() == submitMaxNum.intValue()){ + communEntity.setMaxNum(icOrganizationCodeInfoServiceImpl.getNewMaxIndex(4, houseMaxNum)); + icOrganizationCodeInfoDao.updateMaxNumByIdAndType(communEntity); + } + } + private String getHouseName(IcHouseAddFormDTO formDTO) { //设置房间名 楼栋-单元号-门牌号 IcBuildingDTO icBuilding = icBuildingService.get(formDTO.getBuildingId()); @@ -537,6 +571,9 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { @Override public HouseInfoDTO getHouseInfoDTO(String customerId, String houseId) { HouseInfoDTO houseInfo = icHouseRedis.getHouseInfo(houseId, customerId); + if (null == houseInfo) { + return houseInfo; + } if (null != houseInfo && StringUtils.isNotBlank(houseInfo.getAgencyId())) { AgencyInfoCache agencyInfoCache = CustomerOrgRedis.getAgencyInfo(houseInfo.getAgencyId()); houseInfo.setAgencyPathName(StringUtils.isNotBlank(agencyInfoCache.getAllParentName()) ? agencyInfoCache.getAllParentName().concat(StrConstant.HYPHEN).concat(agencyInfoCache.getOrganizationName()) : agencyInfoCache.getOrganizationName()); @@ -1080,6 +1117,10 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { public Result getHomeInfoByHouseCode(HouseInfoFormDTO dto) { HouseInfoResultDTO house = icHouseDao.selectHomeInfoByHouseCode(dto.getHouseCode()); + if(null == house){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"未获取到房屋信息,请核对房屋编码","未获取到房屋信息,请核对房屋编码"); + } + HouseInfoCache cache = CustomerIcHouseRedis.getHouseInfo(house.getCustomerId(), house.getHouseId()); BeanUtils.copyProperties(cache,house); diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcBuildingServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcBuildingServiceImpl.java index 351fc95306..9059a84eda 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcBuildingServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcBuildingServiceImpl.java @@ -25,9 +25,11 @@ import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; import com.epmet.dao.IcBuildingDao; import com.epmet.dto.IcBuildingDTO; import com.epmet.dto.ImportGeneralDTO; +import com.epmet.dto.result.IcBulidingDetailDTO; import com.epmet.entity.IcBuildingEntity; import com.epmet.service.IcBuildingService; import lombok.extern.slf4j.Slf4j; @@ -166,4 +168,9 @@ public class IcBuildingServiceImpl extends BaseServiceImpl getBuildingDetail(String buildingId) { + return new Result().ok(baseDao.getBuildingDetail(buildingId)); + } + +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcBuildingUnitServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcBuildingUnitServiceImpl.java index 2e800bbda5..6b55f20cfd 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcBuildingUnitServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcBuildingUnitServiceImpl.java @@ -25,8 +25,11 @@ import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; import com.epmet.dao.IcBuildingUnitDao; import com.epmet.dto.IcBuildingUnitDTO; +import com.epmet.dto.result.HouseInfoResultDTO; +import com.epmet.dto.result.IcBulidingDetailDTO; import com.epmet.entity.IcBuildingUnitEntity; import com.epmet.service.IcBuildingUnitService; import lombok.extern.slf4j.Slf4j; @@ -154,4 +157,9 @@ public class IcBuildingUnitServiceImpl extends BaseServiceImpl getUnitDetail(String unitId) { + return new Result().ok(baseDao.getUnitDetail(unitId)); + } + +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java index c54ea3a436..14c9af3048 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java @@ -791,4 +791,13 @@ public class IcNeighborHoodServiceImpl extends BaseServiceImpl neighborhoodDetail(String neighborhoodId) { + IcNeighborHoodEntity result = baseDao.selectById(neighborhoodId); + if(null != result && null == result.getRemark()){ + result.setRemark(""); + } + return new Result().ok(result); + } + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcOrganizationCodeInfoServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcOrganizationCodeInfoServiceImpl.java new file mode 100644 index 0000000000..abc9fbf58c --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcOrganizationCodeInfoServiceImpl.java @@ -0,0 +1,387 @@ +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dao.*; +import com.epmet.dto.IcOrganizationCodeInfoDTO; +import com.epmet.dto.ImportGeneralDTO; +import com.epmet.dto.result.HouseInfoResultDTO; +import com.epmet.dto.result.OrganizationCodeResultDTO; +import com.epmet.dto.result.OrganizationCommunityDTO; +import com.epmet.entity.*; +import com.epmet.enums.OrganizationTypeEnums; +import com.epmet.redis.IcOrganizationCodeInfoRedis; +import com.epmet.service.IcOrganizationCodeInfoService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 小区/楼栋/房屋编码辅助表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-06-27 + */ +@Service +public class IcOrganizationCodeInfoServiceImpl extends BaseServiceImpl implements IcOrganizationCodeInfoService { + + @Autowired + private IcOrganizationCodeInfoRedis icOrganizationCodeInfoRedis; + + @Autowired + private CustomerGridDao customerGridDao; + + @Autowired + private IcNeighborHoodDao icNeighborHoodDao; + + @Autowired + private IcBuildingDao icBuildingDao; + + @Autowired + private IcBuildingUnitDao icBuildingUnitDao; + + @Autowired + private IcHouseDao icHouseDao; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, IcOrganizationCodeInfoDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, IcOrganizationCodeInfoDTO.class); + } + + private QueryWrapper getWrapper(Map params) { + String id = (String) params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public IcOrganizationCodeInfoDTO get(String id) { + IcOrganizationCodeInfoEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, IcOrganizationCodeInfoDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(IcOrganizationCodeInfoDTO dto) { + IcOrganizationCodeInfoEntity entity = ConvertUtils.sourceToTarget(dto, IcOrganizationCodeInfoEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(IcOrganizationCodeInfoDTO dto) { + IcOrganizationCodeInfoEntity entity = ConvertUtils.sourceToTarget(dto, IcOrganizationCodeInfoEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Result getNeighborHoodCoding(String customerId, String gridId, Boolean updateFlag) { + if (StringUtils.isBlank(customerId) || StringUtils.isBlank(gridId)) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "所有字段不可为空", "所有字段不可为空"); + } + OrganizationCodeResultDTO result = new OrganizationCodeResultDTO(); + //获取社区id、行政编码 + OrganizationCommunityDTO communResult = customerGridDao.selectCommunityByGridId(gridId); + if (null == communResult || StringUtils.isBlank(communResult.getCommunityId())) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "未查到相关社区信息", "未查到相关社区信息"); + } + //查询该社区下是否存在数据 + IcOrganizationCodeInfoEntity communEntity = baseDao.selectByIdAndType(customerId, communResult.getCommunityId(), OrganizationTypeEnums.COMM.getCode()); + if (null == communEntity) { + Integer neighborMaxNum = 1; + String neighborCode = getCompleteAreaCode(communResult.getAreaCode()) + getNewMaxIndex(3, neighborMaxNum); + //开发测试需要检测,因为包含行政编码为空的社区,会出现小区编码重复的情况 + IcNeighborHoodEntity isHaveCoding = icNeighborHoodDao.selectByCoding(neighborCode, null); + while (null != isHaveCoding) { + neighborMaxNum++; + neighborCode = getCompleteAreaCode(communResult.getAreaCode()) + getNewMaxIndex(3, neighborMaxNum); + isHaveCoding = icNeighborHoodDao.selectByCoding(neighborCode, null); + } + + result.setCoding(neighborCode); + result.setSysCoding(neighborCode); + //新增该社区辅助数据 + IcOrganizationCodeInfoEntity newEntity = new IcOrganizationCodeInfoEntity(); + newEntity.setCustomerId(customerId); + newEntity.setSysId(communResult.getCommunityId()); + if (updateFlag) { + newEntity.setMaxNum(getNewMaxIndex(3, neighborMaxNum)); + } + newEntity.setSysType(OrganizationTypeEnums.COMM.getCode()); + baseDao.insert(newEntity); + } else { + Integer neighborMaxNum = StringUtils.isBlank(communEntity.getMaxNum()) ? 1 : Integer.valueOf(communEntity.getMaxNum()) + 1; + //验证可编辑的编码是否有重复 + String neiCode = getCompleteAreaCode(communResult.getAreaCode()) + getNewMaxIndex(3, neighborMaxNum); + IcNeighborHoodEntity isHaveCoding = icNeighborHoodDao.selectByCoding(neiCode, null); + while (null != isHaveCoding) { + //先更新已有的最大值 + communEntity.setMaxNum(getNewMaxIndex(3, neighborMaxNum)); + baseDao.updateMaxNumByIdAndType(communEntity); + neighborMaxNum++; + neiCode = getCompleteAreaCode(communResult.getAreaCode()) + getNewMaxIndex(3, neighborMaxNum); + isHaveCoding = icNeighborHoodDao.selectByCoding(neiCode, null); + } + //更新该社区下最大的小区编号 + if (updateFlag) { + communEntity.setMaxNum(getNewMaxIndex(3, neighborMaxNum)); + baseDao.updateMaxNumByIdAndType(communEntity); + } + String neighborCode = getCompleteAreaCode(communResult.getAreaCode()) + getNewMaxIndex(3, neighborMaxNum); + result.setCoding(neiCode); + result.setSysCoding(neighborCode); + } + return new Result().ok(result); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Result getBuildingCoding(String customerId, String neighborhoodId, Boolean updateFlag) { + if (StringUtils.isBlank(customerId) || StringUtils.isBlank(neighborhoodId)) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "所有字段不可为空", "所有字段不可为空"); + } + //组装返回结果 + OrganizationCodeResultDTO result = new OrganizationCodeResultDTO(); + + IcNeighborHoodEntity neighborHood = icNeighborHoodDao.selectById(neighborhoodId); + if (null == neighborHood) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "未查到相关小区信息", "未查到相关小区信息"); + } + //如果小区编码为空,先生成小区编码并更新 + if (StringUtils.isBlank(neighborHood.getSysCoding())) { + OrganizationCodeResultDTO org = getNeighborHoodCoding(customerId, neighborHood.getGridId(), true).getData(); + neighborHood.setCoding(org.getCoding()); + neighborHood.setSysCoding(org.getSysCoding()); + icNeighborHoodDao.updateById(neighborHood); + } + + //获取社区id、小区编码 + OrganizationCommunityDTO communResult = icNeighborHoodDao.selectCommunityByNeiId(neighborhoodId); + //查询该小区下是否存在楼栋数据 + IcOrganizationCodeInfoEntity buildingEntity = baseDao.selectByIdAndType(customerId, neighborhoodId, OrganizationTypeEnums.NEI.getCode()); + if (null == buildingEntity) { + Integer maxNum = 1; + result.setCoding(communResult.getCoding() + getNewMaxIndex(3, maxNum)); + result.setSysCoding(communResult.getSysCoding() + getNewMaxIndex(3, maxNum)); + //新增该楼栋辅助数据 + IcOrganizationCodeInfoEntity newEntity = new IcOrganizationCodeInfoEntity(); + newEntity.setCustomerId(customerId); + newEntity.setSysId(neighborhoodId); + if (updateFlag) { + newEntity.setMaxNum(getNewMaxIndex(3, maxNum)); + } + newEntity.setSysType(OrganizationTypeEnums.NEI.getCode()); + baseDao.insert(newEntity); + } else { + Integer buildingMaxNum = StringUtils.isBlank(buildingEntity.getMaxNum()) ? 1 : Integer.valueOf(buildingEntity.getMaxNum()) + 1; + //验证可编辑的编码是否有重复 + String buildingCode = communResult.getCoding() + getNewMaxIndex(3, buildingMaxNum); + IcBuildingEntity isHaveCoding = icBuildingDao.selectByCoding(buildingCode, null); + while (null != isHaveCoding) { + //先更新已有的最大值 + buildingEntity.setMaxNum(getNewMaxIndex(3, buildingMaxNum)); + baseDao.updateMaxNumByIdAndType(buildingEntity); + buildingMaxNum++; + buildingCode = communResult.getCoding() + getNewMaxIndex(3, buildingMaxNum); + isHaveCoding = icBuildingDao.selectByCoding(buildingCode, null); + } + result.setCoding(buildingCode); + result.setSysCoding(communResult.getSysCoding() + getNewMaxIndex(3, buildingMaxNum)); + + //更新该社区下最大的楼栋编号 + if (updateFlag) { + buildingEntity.setMaxNum(getNewMaxIndex(3, buildingMaxNum)); + baseDao.updateMaxNumByIdAndType(buildingEntity); + } + } + return new Result().ok(result); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Result getUnitCoding(String customerId, String buildingId, Boolean updateFlag) { + if (StringUtils.isBlank(customerId) || StringUtils.isBlank(buildingId)) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "所有字段不可为空", "所有字段不可为空"); + } + //组装返回结果 + OrganizationCodeResultDTO result = new OrganizationCodeResultDTO(); + + IcBuildingEntity buildingEntity = icBuildingDao.selectById(buildingId); + if (null == buildingEntity) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "未查到相关楼栋信息", "未查到相关楼栋信息"); + } + //如果楼栋编码为空,先生成楼栋编码并更新 + if (StringUtils.isBlank(buildingEntity.getSysCoding())) { + ImportGeneralDTO neiInfo = icBuildingDao.selectBuildingById(buildingId); + OrganizationCodeResultDTO org = getBuildingCoding(customerId, neiInfo.getNeighborHoodId(), true).getData(); + buildingEntity.setCoding(org.getCoding()); + buildingEntity.setSysCoding(org.getSysCoding()); + icBuildingDao.updateById(buildingEntity); + } + + //获取社区id、楼栋编码 + OrganizationCommunityDTO communResult = icBuildingDao.selectCommunityByBuildingId(buildingId); + //查询该楼栋下是否存在单元数据 + IcOrganizationCodeInfoEntity unitEntity = baseDao.selectByIdAndType(customerId, buildingId, OrganizationTypeEnums.BUI.getCode()); + if (null == unitEntity) { + Integer maxNum = 1; + result.setCoding(communResult.getCoding() + getNewMaxIndex(2, maxNum)); + result.setSysCoding(communResult.getSysCoding() + getNewMaxIndex(2, maxNum)); + //新增该单元辅助数据 + IcOrganizationCodeInfoEntity newEntity = new IcOrganizationCodeInfoEntity(); + newEntity.setCustomerId(customerId); + newEntity.setSysId(buildingId); + if (updateFlag) { + newEntity.setMaxNum(getNewMaxIndex(2, maxNum)); + } + newEntity.setSysType(OrganizationTypeEnums.BUI.getCode()); + baseDao.insert(newEntity); + } else { + Integer unitMaxNum = StringUtils.isBlank(unitEntity.getMaxNum()) ? 1 : Integer.valueOf(unitEntity.getMaxNum()) + 1; + //验证可编辑的编码是否有重复 + String unitCode = communResult.getCoding() + getNewMaxIndex(2, unitMaxNum); + IcBuildingUnitEntity isHaveCoding = icBuildingUnitDao.selectByCoding(unitCode); + while (null != isHaveCoding) { + unitMaxNum++; + unitCode = communResult.getCoding() + getNewMaxIndex(2, unitMaxNum); + isHaveCoding = icBuildingUnitDao.selectByCoding(unitCode); + } + result.setCoding(unitCode); + result.setSysCoding(communResult.getSysCoding() + getNewMaxIndex(2, unitMaxNum)); + + //更新该社区下最大的单元编号 + if (updateFlag) { + unitEntity.setMaxNum(getNewMaxIndex(2, unitMaxNum)); + baseDao.updateMaxNumByIdAndType(unitEntity); + } + } + return new Result().ok(result); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Result getHouseCoding(String customerId, String unitId, Boolean updateFlag) { + if (StringUtils.isBlank(customerId) || StringUtils.isBlank(unitId)) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "所有字段不可为空", "所有字段不可为空"); + } + //组装返回结果 + OrganizationCodeResultDTO result = new OrganizationCodeResultDTO(); + + IcBuildingUnitEntity unitEntity = icBuildingUnitDao.selectById(unitId); + if (null == unitEntity) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "未查到相关单元信息", "未查到相关单元信息"); + } + //如果单元编码为空,先生成单元编码并更新 + if (StringUtils.isBlank(unitEntity.getSysCoding())) { + HouseInfoResultDTO buildingInfo = icBuildingUnitDao.getUnitDetail(unitId); + OrganizationCodeResultDTO org = getUnitCoding(customerId, buildingInfo.getBuildingId(), true).getData(); + unitEntity.setCoding(org.getCoding()); + unitEntity.setSysCoding(org.getSysCoding()); + icBuildingUnitDao.updateById(unitEntity); + } + + //获取社区id、单元编码 + OrganizationCommunityDTO communResult = icBuildingUnitDao.selectCommunityByUnitId(unitId); + //查询该单元下是否存在房屋数据 + IcOrganizationCodeInfoEntity houseEntity = baseDao.selectByIdAndType(customerId, unitId, OrganizationTypeEnums.UNIT.getCode()); + if (null == houseEntity) { + Integer maxNum = 1; + result.setCoding(communResult.getCoding() + getNewMaxIndex(4, maxNum)); + //新增该单元辅助数据 + IcOrganizationCodeInfoEntity newEntity = new IcOrganizationCodeInfoEntity(); + newEntity.setCustomerId(customerId); + newEntity.setSysId(unitId); + if (updateFlag) { + newEntity.setMaxNum(getNewMaxIndex(4, maxNum)); + } + newEntity.setSysType(OrganizationTypeEnums.UNIT.getCode()); + baseDao.insert(newEntity); + } else { + Integer houseMaxNum = StringUtils.isBlank(houseEntity.getMaxNum()) ? 1 : Integer.valueOf(houseEntity.getMaxNum()) + 1; + //验证可编辑的编码是否有重复 + String houseCode = communResult.getCoding() + getNewMaxIndex(4, houseMaxNum); + IcHouseEntity isHaveCoding = icHouseDao.selectByCoding(houseCode); + while (null != isHaveCoding) { + //先更新已有的最大值 + houseEntity.setMaxNum(getNewMaxIndex(4, houseMaxNum)); + baseDao.updateMaxNumByIdAndType(houseEntity); + houseMaxNum++; + houseCode = communResult.getCoding() + getNewMaxIndex(4, houseMaxNum); + isHaveCoding = icHouseDao.selectByCoding(houseCode); + } + result.setCoding(houseCode); + + //更新该社区下最大的房屋编号 +// houseEntity.setHouseMaxNum(getNewMaxIndex(4, houseMaxNum)); +// baseDao.updateMaxNumByIdAndType(houseEntity); + } + return new Result().ok(result); + } + + /** + * @return java.lang.String + * @describe: 把数字转换成maxLength位的字符串,不够的前面补0 + * @author wangtong + * @date 2022/6/29 10:30 + * @params [maxLength, maxIndex] + */ + public String getNewMaxIndex(Integer maxLength, Integer maxIndex) { + String result = maxIndex.toString(); + while (result.length() < maxLength) { + result = "0" + result; + } + return result; + } + + /** + * @return java.lang.String + * @describe: 补全行政编码,12位 + * @author wangtong + * @date 2022/6/29 10:34 + * @params [areaCode] + */ + private String getCompleteAreaCode(String areaCode) { + if (StringUtils.isBlank(areaCode)) { + areaCode = "0"; + } + while (areaCode.length() < 12) { + areaCode = areaCode + "0"; + } + return areaCode; + } + +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/NeighborHoodServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/NeighborHoodServiceImpl.java index a053e7b183..65eb7c90e2 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/NeighborHoodServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/NeighborHoodServiceImpl.java @@ -11,8 +11,10 @@ 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; +import com.epmet.dao.CustomerGridDao; import com.epmet.dao.IcNeighborHoodDao; import com.epmet.dao.IcNeighborHoodPropertyDao; +import com.epmet.dao.IcOrganizationCodeInfoDao; import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.IcNeighborHoodDTO; import com.epmet.dto.IcNeighborHoodPropertyDTO; @@ -21,9 +23,12 @@ import com.epmet.dto.form.IcNeighborHoodAddFormDTO; import com.epmet.dto.form.IcNeighborHoodListFormDTO; import com.epmet.dto.form.IcUserBelongToChangedFormDTO; import com.epmet.dto.result.IcNeighborHoodResultDTO; +import com.epmet.dto.result.OrganizationCommunityDTO; import com.epmet.entity.IcHouseEntity; import com.epmet.entity.IcNeighborHoodEntity; import com.epmet.entity.IcNeighborHoodPropertyEntity; +import com.epmet.entity.IcOrganizationCodeInfoEntity; +import com.epmet.enums.OrganizationTypeEnums; import com.epmet.excel.IcNeighborHoodExcel; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient; @@ -62,6 +67,12 @@ public class NeighborHoodServiceImpl extends BaseServiceImpl 0) { throw new RenException(EpmetErrorCode.NEIGHBOOR_NAME_EXITED.getCode(), EpmetErrorCode.NEIGHBOOR_NAME_EXITED.getMsg()); } - + //小区编码不可重复 + formDTO.setSysCoding(null); + if(org.apache.commons.lang3.StringUtils.isNotBlank(formDTO.getCoding())){ + IcNeighborHoodEntity isHaveCoding = icNeighborHoodDao.selectByCoding(formDTO.getCoding(),formDTO.getNeighborHoodId()); + if(null != isHaveCoding){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "该小区编码已存在,请勿重复!","该小区编码已存在,请勿重复!"); + } + updateNeiMaxNum(customerId,formDTO); + } IcNeighborHoodDTO icNeighborHoodDTO = ConvertUtils.sourceToTarget(formDTO, IcNeighborHoodDTO.class); icNeighborHoodDTO.setId(formDTO.getNeighborHoodId()); icNeighborHoodDTO.setCustomerId(customerId); diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.31__add_ic_organization_code_info.sql b/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.31__add_ic_organization_code_info.sql new file mode 100644 index 0000000000..c55fc29940 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.31__add_ic_organization_code_info.sql @@ -0,0 +1,18 @@ +CREATE TABLE `ic_organization_code_info` ( + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id', + `COMMUNITY_ID` varchar(64) NOT NULL COMMENT '社区id', + `NEIGHBOR_MAX_NUM` varchar(10) NOT NULL COMMENT '该社区下最大的小区编码序列号', + `BUILDING_MAX_NUM` varchar(10) NOT NULL COMMENT '该社区下最大的楼栋编码序列号', + `HOUSE_MAX_NUM` varchar(10) NOT NULL COMMENT '该社区下最大的房屋编码序列号' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='小区/楼栋/房屋编码辅助表'; + + +alter table ic_neighbor_hood add COLUMN `CODING` varchar(64) DEFAULT NULL COMMENT '小区编码'; +alter table ic_neighbor_hood add COLUMN `SYS_CODING` varchar(64) DEFAULT NULL COMMENT '小区系统编码'; +alter table ic_neighbor_hood add COLUMN `REAL_BUILDING` int(10) DEFAULT NULL COMMENT '实有楼栋'; + +alter table ic_building add COLUMN `CODING` varchar(64) DEFAULT NULL COMMENT '楼栋编码'; +alter table ic_building add COLUMN `SYS_CODING` varchar(64) DEFAULT NULL COMMENT '楼栋系统编码'; +alter table ic_building add COLUMN `REAL_PERSON` int(10) DEFAULT NULL COMMENT '实有人口'; + +alter table ic_house add COLUMN `CODING` varchar(64) DEFAULT NULL COMMENT '房屋可编辑编码'; diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.32__alter_ic_organization_code_info.sql b/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.32__alter_ic_organization_code_info.sql new file mode 100644 index 0000000000..ee6e1fc7a1 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.32__alter_ic_organization_code_info.sql @@ -0,0 +1,9 @@ +alter table ic_organization_code_info add COLUMN `UNIT_MAX_NUM` varchar(10) NOT NULL COMMENT '该社区下最大的单元编码序列号'; + +alter table ic_building_unit add COLUMN `CODING` varchar(64) DEFAULT NULL COMMENT '单元编码'; +alter table ic_building_unit add COLUMN `SYS_CODING` varchar(64) DEFAULT NULL COMMENT '单元系统编码'; + +ALTER TABLE ic_organization_code_info MODIFY COLUMN `NEIGHBOR_MAX_NUM` varchar(10) DEFAULT NULL COMMENT '该社区下最大的小区编码序列号'; +ALTER TABLE ic_organization_code_info MODIFY COLUMN `BUILDING_MAX_NUM` varchar(10) DEFAULT NULL COMMENT '该社区下最大的楼栋编码序列号'; +ALTER TABLE ic_organization_code_info MODIFY COLUMN `UNIT_MAX_NUM` varchar(10) DEFAULT NULL COMMENT '该社区下最大的单元编码序列号'; +ALTER TABLE ic_organization_code_info MODIFY COLUMN `HOUSE_MAX_NUM` varchar(10) DEFAULT NULL COMMENT '该社区下最大的房屋编码序列号'; diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.33__alter_ic_building.sql b/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.33__alter_ic_building.sql new file mode 100644 index 0000000000..a3a448ba14 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.33__alter_ic_building.sql @@ -0,0 +1 @@ +alter table ic_building modify column `BUILDING_LEADER_NAME` varchar(32) DEFAULT NULL COMMENT '楼长姓名'; diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.34__alter_ic_house.sql b/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.34__alter_ic_house.sql new file mode 100644 index 0000000000..277dadd03d --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.34__alter_ic_house.sql @@ -0,0 +1 @@ +update `ic_house` set CODING=HOUSE_CODE diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.35__alter_ic_organization_code_info.sql b/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.35__alter_ic_organization_code_info.sql new file mode 100644 index 0000000000..e143c87c1d --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.35__alter_ic_organization_code_info.sql @@ -0,0 +1,8 @@ +Drop Table ic_organization_code_info; + +CREATE TABLE `ic_organization_code_info` ( + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id', + `SYS_ID` varchar(64) NOT NULL COMMENT '社区/小区/楼栋/单元id', + `SYS_TYPE` varchar(32) DEFAULT NULL COMMENT '类型:\r\n社区community \r\n小区neighbor \r\n楼栋building \r\n单元unit', + `MAX_NUM` varchar(32) DEFAULT NULL COMMENT '最大数' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='小区/楼栋/房屋编码辅助表'; diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml index 94d29e08b4..bd6f04bbc8 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml @@ -863,5 +863,13 @@ UPDATE customer_grid SET total_user = total_user+#{incrCount} where id = #{gridId} and del_flag = '0' + diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml index 92c486f24a..5f825edc25 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml @@ -403,5 +403,51 @@ + + + diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingUnitDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingUnitDao.xml index 09f334b42d..fe5a0ef73b 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingUnitDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingUnitDao.xml @@ -17,6 +17,47 @@ + + + - \ No newline at end of file + diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml index 4943a95b1c..f770ddfa8e 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml @@ -451,7 +451,8 @@ a.OWNER_PHONE, a.OWNER_ID_CARD, a.REMARK, - c.AGENCY_PIDS + c.AGENCY_PIDS, + a.CODING from ic_house a LEFT JOIN ic_building b on a.BUILDING_ID = b.ID and b.DEL_FLAG = '0' LEFT JOIN ic_neighbor_hood c on a.NEIGHBOR_HOOD_ID = c.ID and c.DEL_FLAG = '0' @@ -522,8 +523,17 @@ #{id} ) + UPDATE ic_house SET RESI_NUMBER = #{resiNumber}, UPDATED_TIME = NOW() where ID = #{houseId} and RESI_NUMBER != #{resiNumber} and DEL_FLAG = '0' + + + diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml index 8d6e24b5f7..ba47187e06 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml @@ -312,4 +312,344 @@ a.del_flag = '0' AND a.ID = #{neighborHoodId} + + + + + + + + + + + + + + + + + + + + + diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcOrganizationCodeInfoDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcOrganizationCodeInfoDao.xml new file mode 100644 index 0000000000..7a3d8441f9 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcOrganizationCodeInfoDao.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + update ic_organization_code_info + set MAX_NUM=#{maxNum} + where CUSTOMER_ID = #{customerId} + and SYS_ID = #{sysId} + AND SYS_TYPE = #{sysType} + + + + + + + + + + + + + + + + + + + + + + diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/ArticleContentDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/ArticleContentDTO.java index a8269648f3..a71e8179fb 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/ArticleContentDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/ArticleContentDTO.java @@ -55,7 +55,7 @@ public class ArticleContentDTO implements Serializable { private String content; /** - * 内容类型 图片:img;文字:text;文件:file + * 内容类型 图片:img;文字:text;文件:file 富文本:rich_text */ private String contentType; diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/ArticleDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/ArticleDTO.java index 4c72866e27..09660e6c8c 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/ArticleDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/ArticleDTO.java @@ -124,6 +124,11 @@ public class ArticleDTO implements Serializable { */ private String departmentId; + /** + * 1:富文本;0:不是 + */ + private String richTextFlag; + /** * 删除标识 0.未删除 1.已删除 */ diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/DraftContentDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/DraftContentDTO.java index ee29b969c7..add18d59f8 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/DraftContentDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/DraftContentDTO.java @@ -55,7 +55,7 @@ public class DraftContentDTO implements Serializable { private String content; /** - * 内容类型 图片:img;文字:text;文件:file + * 内容类型 图片:img;文字:text;文件:file 富文本:rich_text */ private String contentType; diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/DraftDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/DraftDTO.java index c7a383a56d..55751bdfd1 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/DraftDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/DraftDTO.java @@ -114,6 +114,11 @@ public class DraftDTO implements Serializable { */ private String departmentId; + /** + * 1:富文本;0:不是 + */ + private String richTextFlag; + /** * 删除标识 0.未删除 1.已删除 */ diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/AddOrSaveDraftFormDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/AddOrSaveDraftFormDTO.java new file mode 100644 index 0000000000..568943b537 --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/AddOrSaveDraftFormDTO.java @@ -0,0 +1,84 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.constant.NumConstant; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2022/6/30 13:41 + * @DESC + */ +@Data +public class AddOrSaveDraftFormDTO implements Serializable { + + public interface AddArticleForm{} + public interface AddDraftForm{} + + /** + * 类型 发布文章:article;存草稿:draft + */ + @NotBlank(message = "类型不能为空",groups = AddArticleForm.class) + private String type; + + @NotBlank(message = "标题不能为空",groups = {AddArticleForm.class}) + @Length(max = 50, message = "标题最长为50个字") + private String title; + + /** + * 发布范围IDs + */ + private List gridIdList; + + /** + * 发布范围Names + */ + private String publishRangeDesc; + + /** + * 文章标签 + */ + private List tagNameList; + + @NotBlank(message = "发布单位不能为空",groups = AddArticleForm.class) + private String publisher; + + @NotBlank(message = "发布单位名称不能为空",groups = AddArticleForm.class) + private String publisherName; + /** + * 发布单位类型 机关:agency;部门:department;网格:grid + */ + @NotBlank(message = "发布单位类型不能为空",groups = AddArticleForm.class) + private String publisherType; + + @NotBlank(message = "发布时间不能为空",groups = AddArticleForm.class) + private String publishDate; + + @NotBlank(message = "文章内容不能为空",groups = {AddArticleForm.class}) + private String content; + + /** + * 是否置顶 1是;0否; + */ + private Integer isTop = NumConstant.ZERO; + + private String userId; + + private String customerId; + + /** + * 草稿ID + */ + private String draftId; + + /** + * 封面图地址 + */ + private String imgUrl; +} diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/ArticleListFormDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/ArticleListFormDTO.java new file mode 100644 index 0000000000..0a601e9802 --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/ArticleListFormDTO.java @@ -0,0 +1,60 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2021/7/15 4:34 下午 + * @DESC + */ +@Data +public class ArticleListFormDTO implements Serializable { + private static final long serialVersionUID = 6397877545890473794L; + + /** + * 文章标题 + */ + private String title; + /** + * 标签Id集合 + */ + private List tagIds; + /** + * 上下线状态,上线:published,下线:offline + */ + private String statusFlag; + /** + * 发布范围类型,组织:agency,网格:grid + */ + private String publishRangeType; + /** + * 发布范围Id==网格Id + */ + private String publishRangeId; + /** + * 开始日期 yyyy-MM-dd + */ + private String startDate; + /** + * 结束日期 yyyy-MM-dd + */ + private String endDate; + /** + * 页码 + */ + private Integer pageNo = 1; + /** + * 每页显示数量 + */ + private Integer pageSize = 20; + + private Boolean isPage = true; + private String articleId; + private String customerId; + private String agencyId; + private String staffId; + +} diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftListFormDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftListFormDTO.java index 02dd80d4df..51e659bdd0 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftListFormDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftListFormDTO.java @@ -12,12 +12,31 @@ import java.io.Serializable; @Data public class DraftListFormDTO implements Serializable { private static final long serialVersionUID = 7957826609741967502L; + + /** + * 文章标题 + */ + private String title; + /** + * 开始日期 yyyy-MM-dd + */ + private String startDate; + /** + * 结束日期 yyyy-MM-dd + */ + private String endDate; /** * 页码 */ - private Integer pageNo; + private Integer pageNo = 1; /** * 每页显示数量 */ - private Integer pageSize; + private Integer pageSize = 20; + + private Boolean isPage = true; + private String draftId; + private String customerId; + private String agencyId; + private String staffId; } diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/PublishGridListFormDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/PublishGridListFormDTO.java index a9ad61ecc6..3b35533d99 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/PublishGridListFormDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/PublishGridListFormDTO.java @@ -25,4 +25,8 @@ public class PublishGridListFormDTO implements Serializable { * token中人员Id */ private String staffId; + /** + * token中客户ID + */ + private String customerId; } diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftPcListResultDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftPcListResultDTO.java new file mode 100644 index 0000000000..2f14da3dc6 --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftPcListResultDTO.java @@ -0,0 +1,128 @@ +package com.epmet.dto.result; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * @author sun + */ +@NoArgsConstructor +@Data +public class DraftPcListResultDTO implements Serializable { + + private static final long serialVersionUID = -8525181219822398750L; + /** + * 文章草稿ID + */ + private String draftId; + /** + * 组织Id + */ + private String agencyId; + /** + * 文章标题 + */ + private String title; + /** + * 是否置顶 1是;0否; + */ + private String isTop; + /** + * 是否置顶 1是;0否; + */ + private String isTopName; + /** + * 发布单位ID + */ + private String publisher; + /** + * 发布单位 + */ + private String publisherName; + /** + * 发布单位类型 机关:agency;部门:department;网格:grid + */ + private String publisherType; + /** + * 发布时间 + */ + private String publishDate; + /** + * 创建时间 + */ + private String createdTime; + /** + * 文章标签串 + */ + @JsonIgnore + private String tags; + /** + * 文章标签名列表 + */ + private List tagNameList; + /** + * 文章标签Id列表 + */ + private List tagIdList; + /** + * 概要内容 + */ + private String previewContent; + /** + * 上下线状态,上线:published,下线:offline + */ + private String statusFlag; + /** + * 是不是我发布 + */ + private Boolean isMePublished; + /** + * 发布范围 + */ + private String publishRangeDesc; + /** + * 1:是否富文本类型【】富文本;0:不是】 + */ + private String richTextFlag; + /** + * 文章创建人 + */ + private String createdBy; + /** + * 封面图片url + */ + private String imgUrl; + /** + * 发布范围网格Id集合 + */ + private List gridIdList; + /** + * 文章内容 + */ + private List contentList; + + @Data + public static class Content { + /** + * 内容 + */ + private String content; + /** + * 内容类型 图片:img;文字:text;文件:file;视频:video;富文本:rich_text + */ + private String contentType; + /** + * 文件名称 + */ + private String fileName; + /** + * 内容顺序 从1开始 + */ + private Integer orderNum; + } + +} diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/PublishedListResultDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/PublishedListResultDTO.java index c566028269..e73acb6294 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/PublishedListResultDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/PublishedListResultDTO.java @@ -21,14 +21,34 @@ public class PublishedListResultDTO implements Serializable { * 文章ID */ private String articleId; + /** + * 组织Id + */ + private String agencyId; /** * 文章标题 */ private String title; + /** + * 是否置顶 1是;0否; + */ + private String isTop; + /** + * 是否置顶 1是;0否; + */ + private String isTopName; + /** + * 发布单位ID + */ + private String publisher; /** * 发布单位 */ private String publisherName; + /** + * 发布单位类型 机关:agency;部门:department;网格:grid + */ + private String publisherType; /** * 发布时间 */ @@ -39,11 +59,71 @@ public class PublishedListResultDTO implements Serializable { @JsonIgnore private String tags; /** - * 文章标签列表 + * 文章标签名列表 */ private List tagNameList; + /** + * 文章标签Id列表 + */ + private List tagIdList; /** * 概要内容 */ private String previewContent; + /** + * 上下线状态,上线:published,下线:offline + */ + private String statusFlag; + /** + * 上下线状态,已发布:published,已下线:offline + */ + private String statusFlagName; + /** + * 是不是我发布 + */ + private Boolean isMePublished; + /** + * 发布范围 + */ + private String publishRangeDesc; + /** + * 1:是否富文本类型【】富文本;0:不是】 + */ + private String richTextFlag; + /** + * 文章创建人 + */ + private String createdBy; + /** + * 封面图片url + */ + private String imgUrl; + /** + * 发布范围网格Id集合 + */ + private List gridIdList; + /** + * 文章内容 + */ + private List contentList; + + @Data + public static class Content { + /** + * 内容 + */ + private String content; + /** + * 内容类型 图片:img;文字:text;文件:file;视频:video;富文本:rich_text + */ + private String contentType; + /** + * 文件名称 + */ + private String fileName; + /** + * 内容顺序 从1开始 + */ + private Integer orderNum; + } } diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/ArticleConstant.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/ArticleConstant.java index 65a7f54855..29d8bca111 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/ArticleConstant.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/ArticleConstant.java @@ -19,6 +19,8 @@ public interface ArticleConstant { * 发布状态-已发布 */ String PUBLISHED = "published"; + String PUBLISH = "publish"; + String PUBLISH_CONTENT = "发布文章"; /** * 发布状态-已下线 */ @@ -66,4 +68,12 @@ public interface ArticleConstant { * 发布方式 api审核后自动发布 */ String PUBLISH_WAY_AUTO_AUDIT = "autoAudit"; + + /** + * 未审核 + */ + String AUDIT_WAY_NO_AUDIT = "noAudit"; + + String SAVE_TYPE_ARTICLE = "article"; + String SAVE_TYPE_DRAFT = "draft"; } diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java index 4c7457f4c3..56b92b7d5c 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java @@ -21,11 +21,15 @@ import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.RequirePermission; import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.enums.RequirePermissionEnum; +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.scan.result.SyncScanResult; 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.commons.tools.validator.group.DefaultGroup; +import com.epmet.constant.ArticleConstant; import com.epmet.constant.DraftConstant; import com.epmet.dto.form.*; import com.epmet.dto.result.*; @@ -33,6 +37,7 @@ import com.epmet.service.ArticleOperateRecordService; import com.epmet.service.ArticleService; import com.epmet.service.DraftService; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Async; import org.springframework.web.bind.annotation.PostMapping; @@ -177,7 +182,7 @@ public class ArticleController { * @Description 党建声音-政府端-下线文章 **/ @PostMapping("offlinearticle") - @RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_OFFLINE) + //@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_OFFLINE) public Result offLineArticle(@LoginUser TokenDto tokenDTO, @RequestBody OffLineArticleFormDTO formDTO) { formDTO.setStaffId(tokenDTO.getUserId()); ValidatorUtils.validateEntity(formDTO, OffLineArticleFormDTO.AddUserInternalGroup.class); @@ -346,6 +351,7 @@ public class ArticleController { **/ @PostMapping("publishgridlist") public Result publishGridList(@LoginUser TokenDto tokenDTO, @RequestBody PublishGridListFormDTO formDTO) { + formDTO.setCustomerId(tokenDTO.getCustomerId()); formDTO.setStaffId(tokenDTO.getUserId()); ValidatorUtils.validateEntity(formDTO, PublishGridListFormDTO.AddUserInternalGroup.class); ArticleAgencyGridListResultDTO agencyGridList = new ArticleAgencyGridListResultDTO(); @@ -405,4 +411,50 @@ public class ArticleController { return new Result>().ok(articleService.subjectList(formDTO)); } + /** + * @param tokenDTO + * @return + * @Author sun + * @Description 数字平台-党建声音-文章列表 + **/ + @PostMapping("articleListV2") + public Result> articleListV2(@LoginUser TokenDto tokenDTO, @RequestBody ArticleListFormDTO formDTO) { + formDTO.setCustomerId(tokenDTO.getCustomerId()); + formDTO.setStaffId(tokenDTO.getUserId()); + return new Result>().ok(articleService.articleListV2(formDTO)); + } + + /** + * @param tokenDTO + * @return + * @Author sun + * @Description 数字平台-党建声音-文章详情 + **/ + @PostMapping("detailV2") + public Result detailV2(@LoginUser TokenDto tokenDTO, @RequestBody ArticleListFormDTO formDTO) { + formDTO.setCustomerId(tokenDTO.getCustomerId()); + formDTO.setStaffId(tokenDTO.getUserId()); + return new Result().ok(articleService.detailV2(formDTO)); + } + + /** + * Desc: 发布文章/存草稿 + * @param formDTO + * @author zxc + * @date 2022/6/30 14:03 + */ + @PostMapping("addOrSaveDraft") + public Result addOrSaveDraft(@LoginUser TokenDto tokenDto,@RequestBody AddOrSaveDraftFormDTO formDTO){ + if (formDTO.getType().equals(ArticleConstant.SAVE_TYPE_ARTICLE)){ + ValidatorUtils.validateEntity(formDTO, AddOrSaveDraftFormDTO.AddArticleForm.class); + }else { + if (StringUtils.isBlank(formDTO.getTitle()) && StringUtils.isBlank(formDTO.getContent())){ + throw new EpmetException(EpmetErrorCode.TITLE_AND_CONTENT_ERROR.getCode()); + } + } + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + articleService.addOrSaveDraft(formDTO); + return new Result(); + } } diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/DraftController.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/DraftController.java index b7ffc4a382..6cf5a28000 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/DraftController.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/DraftController.java @@ -20,15 +20,15 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.RequirePermission; import com.epmet.commons.tools.enums.RequirePermissionEnum; +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.dto.form.DeleteDraftFormDTO; -import com.epmet.dto.form.DraftDetailFormDTO; -import com.epmet.dto.form.DraftListFormDTO; -import com.epmet.dto.form.GovArticleDetailFormDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.DraftDetailResultDTO; import com.epmet.dto.result.DraftListResultDTO; +import com.epmet.dto.result.DraftPcListResultDTO; +import com.epmet.dto.result.PublishedListResultDTO; import com.epmet.service.DraftService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -86,4 +86,31 @@ public class DraftController { DraftDetailResultDTO draftDetailResultDTO = draftService.queryDraftDetail(formDTO); return new Result().ok(draftDetailResultDTO); } + + /** + * @param tokenDTO + * @return + * @Author sun + * @Description 数字平台-党建声音-草稿列表 + **/ + @PostMapping("draftListV2") + public Result> draftListV2(@LoginUser TokenDto tokenDTO, @RequestBody DraftListFormDTO formDTO) { + formDTO.setCustomerId(tokenDTO.getCustomerId()); + formDTO.setStaffId(tokenDTO.getUserId()); + return new Result>().ok(draftService.draftListV2(formDTO)); + } + + /** + * @param tokenDTO + * @return + * @Author sun + * @Description 数字平台-党建声音-草稿详情 + **/ + @PostMapping("detailV2") + public Result detailV2(@LoginUser TokenDto tokenDTO, @RequestBody DraftListFormDTO formDTO) { + formDTO.setCustomerId(tokenDTO.getCustomerId()); + formDTO.setStaffId(tokenDTO.getUserId()); + return new Result().ok(draftService.detailV2(formDTO)); + } + } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticleDao.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticleDao.java index 79b63f91f6..2c19c2aa38 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticleDao.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticleDao.java @@ -16,6 +16,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.annotation.DataFilter; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.ArticleListFormDTO; import com.epmet.dto.form.ResiTagListFormDTO; import com.epmet.dto.result.*; import com.epmet.entity.ArticleEntity; @@ -160,4 +161,6 @@ public interface ArticleDao extends BaseDao { * @date 2021/7/16 10:29 上午 */ List subjectList(@Param("pidList")List pidList); + + List selectAllArticle(ArticleListFormDTO formDTO); } diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/DraftDao.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/DraftDao.java index 470ec938b6..0b5a30084a 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/DraftDao.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/DraftDao.java @@ -18,6 +18,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.DraftListFormDTO; import com.epmet.dto.result.*; import com.epmet.entity.DraftEntity; import org.apache.ibatis.annotations.Mapper; @@ -112,4 +113,6 @@ public interface DraftDao extends BaseDao { * @return */ int updateAuditStatusById(@Param("draftId") String draftId, @Param("statusFlag") String statusFlag, @Param("titleAuditStatus") String titleAuditStatus); + + List selectAllDraft(DraftListFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/ArticleContentEntity.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/ArticleContentEntity.java index 29661c7350..f5d571ec75 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/ArticleContentEntity.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/ArticleContentEntity.java @@ -51,7 +51,7 @@ public class ArticleContentEntity extends BaseEpmetEntity { private String content; /** - * 内容类型 图片:img;文字:text;文件:file + * 内容类型 图片:img;文字:text;文件:file 富文本:rich_text */ private String contentType; diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/ArticleEntity.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/ArticleEntity.java index 13dc5bd83e..87a4c76078 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/ArticleEntity.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/ArticleEntity.java @@ -131,5 +131,9 @@ public class ArticleEntity extends BaseEpmetEntity { * 部门ID 数据权限使用 */ private String departmentId; + /** + * 1:富文本;0:不是 + */ + private String richTextFlag; } diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/DraftContentEntity.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/DraftContentEntity.java index 15a7ba4e76..bf93f1b2c8 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/DraftContentEntity.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/DraftContentEntity.java @@ -51,7 +51,7 @@ public class DraftContentEntity extends BaseEpmetEntity { private String content; /** - * 内容类型 图片:img;文字:text;文件:file + * 内容类型 图片:img;文字:text;文件:file 富文本:rich_text */ private String contentType; diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/DraftEntity.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/DraftEntity.java index 04e1b22158..1c93cfc7cf 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/DraftEntity.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/DraftEntity.java @@ -117,4 +117,9 @@ public class DraftEntity extends BaseEpmetEntity { */ private String departmentId; + /** + * 1:富文本;0:不是 + */ + private String richTextFlag; + } diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java index db03b3a0c5..127e7422ee 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java @@ -243,4 +243,16 @@ public interface ArticleService extends BaseService { * @return java.util.List */ List getArticleListByTag(String tagId, Integer pageNo, Integer pageSize); + + /** + * Desc: 发布文章/存草稿 + * @param formDTO + * @author zxc + * @date 2022/6/30 14:03 + */ + void addOrSaveDraft(AddOrSaveDraftFormDTO formDTO); + + PageData articleListV2(ArticleListFormDTO formDTO); + + PublishedListResultDTO detailV2(ArticleListFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/DraftService.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/DraftService.java index a11c1361a3..f34898f749 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/DraftService.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/DraftService.java @@ -27,6 +27,7 @@ import com.epmet.dto.form.DraftListFormDTO; import com.epmet.dto.result.DraftAttrResultDTO; import com.epmet.dto.result.DraftContentResultDTO; import com.epmet.dto.result.DraftDetailResultDTO; +import com.epmet.dto.result.DraftPcListResultDTO; import com.epmet.entity.DraftEntity; import java.util.List; @@ -148,4 +149,8 @@ public interface DraftService extends BaseService { * @date 2020-06-03 */ DraftDetailResultDTO queryDraftDetail(DraftDetailFormDTO formDTO); + + PageData draftListV2(DraftListFormDTO formDTO); + + DraftPcListResultDTO detailV2(DraftListFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java index e63c58590f..3a01001543 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java @@ -18,15 +18,22 @@ package com.epmet.service.impl; import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.FieldConstant; 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.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.RedisKeys; +import com.epmet.commons.tools.redis.common.CustomerOrgRedis; +import com.epmet.commons.tools.redis.common.CustomerStaffRedis; +import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; +import com.epmet.commons.tools.redis.common.bean.GridInfoCache; import com.epmet.commons.tools.scan.param.ImgScanParamDTO; import com.epmet.commons.tools.scan.param.ImgTaskDTO; import com.epmet.commons.tools.scan.param.TextScanParamDTO; @@ -41,10 +48,7 @@ import com.epmet.commons.tools.utils.ScanContentUtils; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.constant.*; import com.epmet.dao.*; -import com.epmet.dto.ArticleVisitRecordDTO; -import com.epmet.dto.CustomerStaffDTO; -import com.epmet.dto.DraftCoverDTO; -import com.epmet.dto.DraftDTO; +import com.epmet.dto.*; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.entity.*; @@ -70,6 +74,8 @@ import org.springframework.util.CollectionUtils; import java.util.*; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import java.util.stream.Collectors; /** @@ -122,6 +128,10 @@ public class ArticleServiceImpl extends BaseServiceImpl resultDTOResult = epmetUserOpenFeignClient.getLoginUserDetails(loginUserDetailsFormDTO); - String agencyId = resultDTOResult.getData().getOrgIdPath().substring(resultDTOResult.getData().getOrgIdPath().lastIndexOf(":") + NumConstant.ONE); + String agencyId = resultDTOResult.getData().getOrgIdPath().substring(resultDTOResult.getData().getOrgIdPath().lastIndexOf(":") + NumConstant.ONE);*/ + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); + if (null == staffInfo) { + throw new EpmetException("获取工作人员信息失败"); + } + String agencyId = staffInfo.getAgencyId(); //存放树的每一个节点对象,用于将同一节点下的网格列表合并(主键:agencyId 值:节点对象) Map map = new HashMap<>(); //3:循环可下线网格列表,根据pids组织每一个树节点对象信息 @@ -1258,9 +1275,18 @@ public class ArticleServiceImpl extends BaseServiceImpl tagsInfo = formDto.getTagsInfo(); String customerId = formDto.getCustomerId(); //更新缓存标签使用数量 @@ -1314,13 +1341,20 @@ public class ArticleServiceImpl extends BaseServiceImpl tagsInfo = formDto.getTagsInfo(); String userId = tokenDto.getUserId(); //根据草稿id查询发布范围id集合 List gridIds = draftPublishRangeDao.selectGridIdByDraftId(draftId); if (gridIds.size() == NumConstant.ZERO) { throw new RenException(TagConstant.SELECT_GRIDIDLIST_FAILURE); } + return updateGridTagV2(formDto,customerId,gridIds,userId); + } + + public List updateGridTagV2(UpdateCustomerTagCacheDTO formDto,String customerId,List gridIds,String userId){ + if ( null == formDto || CollectionUtils.isEmpty(formDto.getTagsInfo()) || CollectionUtils.isEmpty(gridIds)){ + return new ArrayList<>(); + } + List tagsInfo = formDto.getTagsInfo(); List gridTags = new ArrayList<>(); List gridTagCache = new ArrayList<>(); gridIds.forEach(gridId -> { @@ -1348,6 +1382,9 @@ public class ArticleServiceImpl extends BaseServiceImpl gridTagCache) { + if (CollectionUtils.isEmpty(gridTagCache)){ + return; + } //更新 网格下 标签使用数量 List gridTagCacheCopy = new ArrayList<>(); gridTagCache.forEach(cacheDTO -> { @@ -1376,23 +1413,26 @@ public class ArticleServiceImpl extends BaseServiceImpl addArticleTags = new ArrayList<>(); - List tagsInfo = formDto.getTagsInfo(); DraftDTO draft = draftService.get(draftId); String customerId = draft.getCustomerId(); - String userId = tokenDto.getUserId(); String articleId = articleDao.getArticleIdByDraftId(draftId); + addArticleTagsV2(formDto,customerId,articleId); + } + + public void addArticleTagsV2(UpdateCustomerTagCacheDTO formDto,String customerId,String articleId){ + List articleTags = new ArrayList<>(); + + if (null == formDto || CollectionUtils.isEmpty(formDto.getTagsInfo())){ + return; + } + List tagsInfo = formDto.getTagsInfo(); tagsInfo.forEach(resultDTO -> { - AddArticleTagsFormDTO addArticleTag = new AddArticleTagsFormDTO(); - addArticleTag.setCreatedBy(userId); - addArticleTag.setUpdatedBy(userId); - addArticleTag.setCustomerId(customerId); - addArticleTag.setArticleId(articleId); - BeanUtils.copyProperties(resultDTO, addArticleTag); - addArticleTag.setCreatedTime(createdTime); - addArticleTags.add(addArticleTag); + ArticleTagsEntity e = ConvertUtils.sourceToTarget(resultDTO, ArticleTagsEntity.class); + e.setCustomerId(customerId); + e.setArticleId(articleId); + articleTags.add(e); }); - articleTagsDao.addArticleTags(addArticleTags); + articleTagsService.insertBatch(articleTags); } /** @@ -1449,4 +1489,290 @@ public class ArticleServiceImpl extends BaseServiceImpl getArticleListByTag(String tagId, Integer pageNo, Integer pageSize) { return baseDao.selectArticleListByTag(tagId, pageNo, pageSize); } + + /** + * Desc: 发布文章/存草稿 + * @param formDTO + * @author zxc + * @date 2022/6/30 14:03 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void addOrSaveDraft(AddOrSaveDraftFormDTO formDTO) { + if (StringUtils.isNotBlank(formDTO.getDraftId())){ + // 删除草稿,草稿内容,草稿发布范围,封面图 + draftDao.deleteDraft(formDTO.getDraftId()); + draftContentDao.deleteByDraftId(formDTO.getDraftId()); + draftPublishRangeDao.deleteByDraftId(formDTO.getDraftId()); + draftCoverDao.deleteByDraftId(formDTO.getDraftId()); + } + String customerId = formDTO.getCustomerId(); + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, formDTO.getUserId()); + if (null == staffInfo){ + throw new EpmetException("未查询到当前工作人员信息:"+formDTO.getUserId()); + } + AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(staffInfo.getAgencyId()); + if (null == agencyInfo){ + throw new EpmetException("未查询到组织信息:"+staffInfo.getAgencyId()); + } + // 发文章 + if (formDTO.getType().equals(ArticleConstant.SAVE_TYPE_ARTICLE)){ + // 1.文章 + ArticleEntity article = ConvertUtils.sourceToTarget(formDTO, ArticleEntity.class); + // 按照之前逻辑存成客户ID + article.setDepartmentId(customerId); + article.setStatusFlag(DraftConstant.PUBLISHED); + article.setPublishWay(ArticleConstant.PUBLISH_WAY_MANUAL); + if (formDTO.getPublisherType().equals(DraftConstant.GRID)){ + article.setGridId(formDTO.getPublisher()); + } + article.setPreviewContent(getPreviewContent(formDTO.getContent()).length() > DraftConstant.PREVIEW_CONTENT_MAX_LENGTH ? getPreviewContent(formDTO.getContent()).substring(NumConstant.ZERO,DraftConstant.PREVIEW_CONTENT_MAX_LENGTH) : getPreviewContent(formDTO.getContent())); + article.setPublishDate(DateUtils.stringToDate(formDTO.getPublishDate(),DateUtils.DATE_PATTERN)); + article.setPublisherId(formDTO.getPublisher()); + article.setTags(CollectionUtils.isEmpty(formDTO.getTagNameList()) ? "" : formDTO.getTagNameList().stream().collect(Collectors.joining("|"))); + article.setOrgId(staffInfo.getAgencyId()); + article.setOrgIdPath(StringUtils.isBlank(agencyInfo.getPids()) || agencyInfo.getPids().equals(NumConstant.ZERO_STR) ? agencyInfo.getId() : agencyInfo.getPids().concat(":").concat(agencyInfo.getId())); + article.setRichTextFlag(NumConstant.ONE_STR); + baseDao.insert(article); + // 2.内容 + ArticleContentEntity articleContent = ConvertUtils.sourceToTarget(article, ArticleContentEntity.class); + articleContent.setCustomerId(customerId); + articleContent.setArticleId(article.getId()); + articleContent.setContent(formDTO.getContent()); + articleContent.setContentType("rich_text"); + articleContent.setOrderNum(NumConstant.ZERO); + articleContentDao.insert(articleContent); + // 3.操作记录 + ArticleOperateRecordEntity articleOperateRecord = new ArticleOperateRecordEntity(); + articleOperateRecord.setCustomerId(customerId); + articleOperateRecord.setArticleId(article.getId()); + articleOperateRecord.setGridIds(CollectionUtils.isEmpty(formDTO.getGridIdList()) ? "" : formDTO.getGridIdList().stream().collect(Collectors.joining(":"))); + articleOperateRecord.setOpUser(staffInfo.getAgencyName().concat("-").concat(staffInfo.getRealName())); + articleOperateRecord.setContent(articleOperateRecord.getOpUser() + "发布文章【" +formDTO.getTitle() + "】"); + articleOperateRecord.setOpType(ArticleConstant.PUBLISH); + articleOperateRecord.setOpTime(new Date()); + articleOperateRecordService.insert(articleOperateRecord); + // 4.发布范围 + if (!CollectionUtils.isEmpty(formDTO.getGridIdList())){ + List rangeList = new ArrayList<>(); + formDTO.getGridIdList().forEach(g -> { + GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(g); + if (null == gridInfo){ + throw new EpmetException("未查询到网格信息:"+g); + } + ArticlePublishRangeEntity articlePublishRange = ConvertUtils.sourceToTarget(gridInfo,ArticlePublishRangeEntity.class); + articlePublishRange.setCustomerId(customerId); + articlePublishRange.setArticleId(article.getId()); + articlePublishRange.setGridId(g); + articlePublishRange.setAgencyGridName(gridInfo.getGridNamePath()); + articlePublishRange.setAgencyId(gridInfo.getPid()); + AgencyInfoCache info = CustomerOrgRedis.getAgencyInfo(gridInfo.getPid()); + if (null == info){ + throw new EpmetException("未查询到组织信息:"+gridInfo.getPid()); + } + articlePublishRange.setPids(info.getPids()); + articlePublishRange.setPublishStatus(ArticleConstant.PUBLISHED); + articlePublishRange.setId(null); + rangeList.add(articlePublishRange); + }); + articlePublishRangeService.insertBatch(rangeList); + } + // 5.文章标签 + UpdateCustomerTagCacheDTO updateCustomerTagCacheDTO = updateCustomerTagV2(formDTO.getUserId(), formDTO.getCustomerId(), StringUtils.isBlank(article.getTags()) ? "" : article.getTags()); + if (null != updateCustomerTagCacheDTO){ + addArticleTagsV2(updateCustomerTagCacheDTO,customerId,article.getId()); + } + // 6.更新网格tag + List updateGridTagCacheDTOS = updateGridTagV2(updateCustomerTagCacheDTO, customerId, formDTO.getGridIdList(), formDTO.getUserId()); + // 7.文章封面 + if (StringUtils.isNotBlank(formDTO.getImgUrl())){ + ArticleCoverEntity articleCover = new ArticleCoverEntity(); + articleCover.setCustomerId(customerId); + articleCover.setArticleId(article.getId()); + articleCover.setImgUrl(formDTO.getImgUrl()); + articleCover.setAuditStatus("pass"); + articleCoverDao.insert(articleCover); + } + // 8.更新redis + try { + this.updateCacheCustomerTag(updateCustomerTagCacheDTO); + this.updateCacheGridTag(updateGridTagCacheDTOS); + } catch (Exception e) { + log.error("scanAllPassPublishArticle update redis exception", e); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); + } + }else {// 存草稿 + // 1.草稿 + DraftEntity draft = ConvertUtils.sourceToTarget(formDTO, DraftEntity.class); + draft.setDepartmentId(customerId); + draft.setPreviewContent(StringUtils.isBlank(formDTO.getContent()) ? "" : getPreviewContent(formDTO.getContent()).length() > DraftConstant.PREVIEW_CONTENT_MAX_LENGTH ? getPreviewContent(formDTO.getContent()).substring(NumConstant.ZERO,DraftConstant.PREVIEW_CONTENT_MAX_LENGTH) : getPreviewContent(formDTO.getContent())); + draft.setPublisherId(StringUtils.isBlank(formDTO.getPublisher()) ? "" : formDTO.getPublisher()); + draft.setPublishDate(StringUtils.isBlank(formDTO.getPublishDate()) ? null : DateUtils.stringToDate(formDTO.getPublishDate(),DateUtils.DATE_PATTERN)); + draft.setTags(CollectionUtils.isEmpty(formDTO.getTagNameList()) ? "" : formDTO.getTagNameList().stream().collect(Collectors.joining("|"))); + draft.setOrgId(staffInfo.getAgencyId()); + draft.setOrgIdPath(StringUtils.isBlank(agencyInfo.getPids()) || agencyInfo.getPids().equals(NumConstant.ZERO_STR) ? agencyInfo.getId() : agencyInfo.getPids().concat(":").concat(agencyInfo.getId())); + if (formDTO.getPublisherType().equals(DraftConstant.GRID)){ + draft.setGridId(formDTO.getPublisher()); + } + draft.setStatusFlag(DraftConstant.UNPUBLISH); + draft.setRichTextFlag(NumConstant.ONE_STR); + draftDao.insert(draft); + // 2.内容 + if (StringUtils.isNotBlank(formDTO.getContent())){ + DraftContentEntity draftContent = ConvertUtils.sourceToTarget(draft, DraftContentEntity.class); + draftContent.setCustomerId(customerId); + draftContent.setDraftId(draft.getId()); + draftContent.setContent(formDTO.getContent()); + draftContent.setContentType("rich_text"); + draftContent.setOrderNum(NumConstant.ZERO); + draftContentDao.insert(draftContent); + } + // 3.发布范围 + if (!CollectionUtils.isEmpty(formDTO.getGridIdList())){ + List rangeList = new ArrayList<>(); + formDTO.getGridIdList().forEach(g -> { + GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(g); + if (null == gridInfo){ + throw new EpmetException("未查询到网格信息:"+g); + } + DraftPublishRangeEntity draftPublishRange = ConvertUtils.sourceToTarget(gridInfo,DraftPublishRangeEntity.class); + draftPublishRange.setCustomerId(customerId); + draftPublishRange.setDraftId(draft.getId()); + draftPublishRange.setGridId(g); + draftPublishRange.setAgencyGridName(gridInfo.getGridNamePath()); + draftPublishRange.setAgencyId(gridInfo.getPid()); + AgencyInfoCache info = CustomerOrgRedis.getAgencyInfo(gridInfo.getPid()); + if (null == info){ + throw new EpmetException("未查询到组织信息:"+gridInfo.getPid()); + } + draftPublishRange.setPids(info.getPids()); + draftPublishRange.setPublishStatus(DraftConstant.UNPUBLISH); + draftPublishRange.setId(null); + rangeList.add(draftPublishRange); + }); + draftPublishRangeService.insertBatch(rangeList); + } + // 4.草稿封面 + if (StringUtils.isNotBlank(formDTO.getImgUrl())){ + DraftCoverEntity draftCover = new DraftCoverEntity(); + draftCover.setCustomerId(customerId); + draftCover.setDraftId(draft.getId()); + draftCover.setImgUrl(formDTO.getImgUrl()); + draftCover.setAuditStatus("pass"); + draftCoverDao.insert(draftCover); + } + } + } + + /** + * Desc: 获取内容中的汉字 + * @param content + * @author zxc + * @date 2022/7/1 10:32 + */ + public String getPreviewContent(String content) { + // 定义script的正则表达式 + String regEx_script = "]*?>[\\s\\S]*?<\\/script>"; + // 定义style的正则表达式 + String regEx_style = "]*?>[\\s\\S]*?<\\/style>"; + // 定义HTML标签的正则表达式 + String regEx_html = "<[^>]+>"; + //定义空格回车换行符 + String regEx_space = "\\s*|\t|\r|\n"; + Pattern p_script = Pattern.compile(regEx_script, Pattern.CASE_INSENSITIVE); + Matcher m_script = p_script.matcher(content); + // 过滤script标签 + content = m_script.replaceAll(""); + Pattern p_style = Pattern.compile(regEx_style, Pattern.CASE_INSENSITIVE); + Matcher m_style = p_style.matcher(content); + // 过滤style标签 + content = m_style.replaceAll(""); + Pattern p_html = Pattern.compile(regEx_html, Pattern.CASE_INSENSITIVE); + Matcher m_html = p_html.matcher(content); + // 过滤html标签 + content = m_html.replaceAll(""); + Pattern p_space = Pattern.compile(regEx_space, Pattern.CASE_INSENSITIVE); + Matcher m_space = p_space.matcher(content); + // 过滤空格回车标签 + content = m_space.replaceAll(""); + //去空格 + content = content.replaceAll(" ", ""); + return content.trim(); + } + + @Override + public PageData articleListV2(ArticleListFormDTO formDTO) { + //1.获取工作人员缓存信息 + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); + if (null == staffInfo) { + throw new EpmetException("获取工作人员信息失败"); + } + //查询当前组织及下级数据 + formDTO.setAgencyId(staffInfo.getAgencyId()); + //列表查询 + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()); + List list = baseDao.selectAllArticle(formDTO); + PageInfo pageInfo = new PageInfo<>(list); + + //封装数据 + if (!CollectionUtils.isEmpty(list)) { + list.forEach(l->{ + l.setTagNameList(StringUtils.isNotBlank(l.getTags())?Arrays.asList(l.getTags().split("[|]")):new ArrayList<>()); + l.setIsMePublished(l.getCreatedBy().equals(formDTO.getStaffId())?true:false); + }); + } + + return new PageData<>(list, pageInfo.getTotal()); + } + + @Override + public PublishedListResultDTO detailV2(ArticleListFormDTO formDTO) { + PublishedListResultDTO resultDTO = new PublishedListResultDTO(); + //1.查询文章主表信息 + List list = baseDao.selectAllArticle(formDTO); + + if (!CollectionUtils.isEmpty(list)) { + resultDTO = list.get(NumConstant.ZERO); + resultDTO.setTagNameList(StringUtils.isNotBlank(resultDTO.getTags())?Arrays.asList(resultDTO.getTags().split("[|]")):new ArrayList<>()); + resultDTO.setIsMePublished(resultDTO.getCreatedBy().equals(formDTO.getStaffId())?true:false); + //查询文章涉及的发布范围网络Id列表 + LambdaQueryWrapper tWrapper = new LambdaQueryWrapper<>(); + tWrapper.eq(ArticlePublishRangeEntity::getArticleId, formDTO.getArticleId()); + tWrapper.eq(ArticlePublishRangeEntity::getDelFlag, NumConstant.ZERO_STR); + //【文章下线的查所有发布范围,文章没下线的只查还没下线的发布范围】 + if("offline".equals(resultDTO.getStatusFlag())){ + tWrapper.eq(ArticlePublishRangeEntity::getPublishStatus, "offline"); + }else { + tWrapper.eq(ArticlePublishRangeEntity::getPublishStatus, "published"); + } + List entityList = articlePublishRangeDao.selectList(tWrapper); + if (!CollectionUtils.isEmpty(entityList)) { + List contentList = entityList.stream().map(ArticlePublishRangeEntity::getGridId).collect(Collectors.toList()); + resultDTO.setGridIdList(contentList); + } + + //查询文章内容 + LambdaQueryWrapper tWrapper1 = new LambdaQueryWrapper<>(); + tWrapper1.eq(ArticleContentEntity::getArticleId, formDTO.getArticleId()); + tWrapper1.eq(ArticleContentEntity::getDelFlag, NumConstant.ZERO_STR); + tWrapper1.orderByDesc(ArticleContentEntity::getOrderNum); + List contentEntityList = articleContentDao.selectList(tWrapper1); + if (!CollectionUtils.isEmpty(contentEntityList)) { + List contentList = ConvertUtils.sourceToTarget(contentEntityList, PublishedListResultDTO.Content.class); + resultDTO.setContentList(contentList); + } + + //标签列表 + LambdaQueryWrapper tWrapper2 = new LambdaQueryWrapper<>(); + tWrapper2.eq(ArticleTagsEntity::getArticleId, formDTO.getArticleId()); + tWrapper2.eq(ArticleTagsEntity::getDelFlag, NumConstant.ZERO_STR); + List tagsEntityList = articleTagsDao.selectList(tWrapper2); + if (!CollectionUtils.isEmpty(tagsEntityList)) { + List contentList = tagsEntityList.stream().map(ArticleTagsEntity::getTagId).collect(Collectors.toList()); + resultDTO.setTagIdList(contentList); + } + } + + return resultDTO; + } } diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/DraftServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/DraftServiceImpl.java index c2f755e901..5d786be693 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/DraftServiceImpl.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/DraftServiceImpl.java @@ -17,24 +17,26 @@ package com.epmet.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.constant.DraftConstant; -import com.epmet.dao.DraftCoverDao; -import com.epmet.dao.DraftDao; +import com.epmet.dao.*; import com.epmet.dto.DraftDTO; import com.epmet.dto.form.DeleteDraftFormDTO; import com.epmet.dto.form.DraftDetailFormDTO; import com.epmet.dto.form.DraftListFormDTO; import com.epmet.dto.result.*; -import com.epmet.entity.DraftCoverEntity; -import com.epmet.entity.DraftEntity; +import com.epmet.entity.*; import com.epmet.service.DraftService; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; @@ -44,11 +46,13 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * 草稿表 @@ -62,6 +66,13 @@ public class DraftServiceImpl extends BaseServiceImpl imp @Autowired private DraftCoverDao draftCoverDao; + @Autowired + private DraftPublishRangeDao draftPublishRangeDao; + @Autowired + private DraftContentDao draftContentDao; + @Autowired + private TagCustomerDao tagCustomerDao; + @Override public PageData page(Map params) { IPage page = baseDao.selectPage( @@ -201,4 +212,84 @@ public class DraftServiceImpl extends BaseServiceImpl imp return draftDetailResultDTO; } + @Override + public PageData draftListV2(DraftListFormDTO formDTO) { + //1.获取工作人员缓存信息 + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); + if (null == staffInfo) { + throw new EpmetException("获取工作人员信息失败"); + } + //查询当前组织及下级数据 + formDTO.setAgencyId(staffInfo.getAgencyId()); + //列表查询 + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()); + List list = baseDao.selectAllDraft(formDTO); + PageInfo pageInfo = new PageInfo<>(list); + + //封装数据 + if (!CollectionUtils.isEmpty(list)) { + list.forEach(l->{ + l.setTagNameList(StringUtils.isNotBlank(l.getTags())?Arrays.asList(l.getTags().split("[|]")):new ArrayList<>()); + l.setIsMePublished(l.getCreatedBy().equals(formDTO.getStaffId())?true:false); + }); + } + + return new PageData<>(list, pageInfo.getTotal()); + } + + @Override + public DraftPcListResultDTO detailV2(DraftListFormDTO formDTO) { + DraftPcListResultDTO resultDTO = new DraftPcListResultDTO(); + //1.查询文章主表信息 + List list = baseDao.selectAllDraft(formDTO); + + if (!CollectionUtils.isEmpty(list)) { + resultDTO = list.get(NumConstant.ZERO); + resultDTO.setTagNameList(StringUtils.isNotBlank(resultDTO.getTags())?Arrays.asList(resultDTO.getTags().split("[|]")):new ArrayList<>()); + resultDTO.setIsMePublished(resultDTO.getCreatedBy().equals(formDTO.getStaffId())?true:false); + //查询文章涉及的发布范围网络Id列表 + LambdaQueryWrapper tWrapper = new LambdaQueryWrapper<>(); + tWrapper.eq(DraftPublishRangeEntity::getDraftId, formDTO.getDraftId()); + tWrapper.eq(DraftPublishRangeEntity::getDelFlag, NumConstant.ZERO_STR); + //【文章下线的查所有发布范围,文章没下线的只查还没下线的发布范围】 + if("unpublish".equals(resultDTO.getStatusFlag())){ + tWrapper.eq(DraftPublishRangeEntity::getPublishStatus, "unpublish"); + }else { + tWrapper.eq(DraftPublishRangeEntity::getPublishStatus, "published"); + } + List entityList = draftPublishRangeDao.selectList(tWrapper); + if (!CollectionUtils.isEmpty(entityList)) { + List contentList = entityList.stream().map(DraftPublishRangeEntity::getGridId).collect(Collectors.toList()); + resultDTO.setGridIdList(contentList); + } + + //查询文章内容 + LambdaQueryWrapper tWrapper1 = new LambdaQueryWrapper<>(); + tWrapper1.eq(DraftContentEntity::getDraftId, formDTO.getDraftId()); + tWrapper1.eq(DraftContentEntity::getDelFlag, NumConstant.ZERO_STR); + tWrapper1.orderByDesc(DraftContentEntity::getOrderNum); + List contentEntityList = draftContentDao.selectList(tWrapper1); + if (!CollectionUtils.isEmpty(contentEntityList)) { + List contentList = ConvertUtils.sourceToTarget(contentEntityList, DraftPcListResultDTO.Content.class); + resultDTO.setContentList(contentList); + } + + //标签列表 + if(!CollectionUtils.isEmpty(resultDTO.getTagNameList())){ + LambdaQueryWrapper tWrapper2 = new LambdaQueryWrapper<>(); + tWrapper2.eq(TagCustomerEntity::getCustomerId, formDTO.getCustomerId()); + tWrapper2.in(TagCustomerEntity::getTagName, resultDTO.getTagNameList()); + tWrapper2.eq(TagCustomerEntity::getDelFlag, NumConstant.ZERO_STR); + List tagEntityList = tagCustomerDao.selectList(tWrapper2); + if (!CollectionUtils.isEmpty(tagEntityList)) { + List contentList = tagEntityList.stream().map(TagCustomerEntity::getId).collect(Collectors.toList()); + resultDTO.setTagIdList(contentList); + } + } + + } + + return resultDTO; + } + } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/db/migration/V0.0.10__alert_new_article_and_draft.sql b/epmet-module/gov-voice/gov-voice-server/src/main/resources/db/migration/V0.0.10__alert_new_article_and_draft.sql new file mode 100644 index 0000000000..00d77ca9fe --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/db/migration/V0.0.10__alert_new_article_and_draft.sql @@ -0,0 +1,6 @@ +ALTER TABLE `draft` ADD COLUMN `RICH_TEXT_FLAG` tinyint(1) NOT NULL DEFAULT 0 COMMENT '1:富文本;0:不是' AFTER `DEPARTMENT_ID`; +ALTER TABLE `draft_content` MODIFY COLUMN `CONTENT_TYPE` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '内容类型 图片:img;文字:text;文件:file;\r\n富文本:rich_text' AFTER `CONTENT`; +ALTER TABLE `article` ADD COLUMN `RICH_TEXT_FLAG` tinyint(1) NOT NULL DEFAULT 0 COMMENT '1:富文本;0:不是' AFTER `DEPARTMENT_ID`; +ALTER TABLE `article_content` + MODIFY COLUMN `CONTENT` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '内容' AFTER `ARTICLE_ID`, + MODIFY COLUMN `CONTENT_TYPE` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '内容类型 图片:img;文字:text;文件:file;视频:video;富文本:rich_text' AFTER `CONTENT`; diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/db/migration/V0.0.11__alert_article_draft_id.sql b/epmet-module/gov-voice/gov-voice-server/src/main/resources/db/migration/V0.0.11__alert_article_draft_id.sql new file mode 100644 index 0000000000..073cc6362f --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/db/migration/V0.0.11__alert_article_draft_id.sql @@ -0,0 +1 @@ +ALTER TABLE `article` MODIFY COLUMN `DRAFT_ID` varchar(64) NULL COMMENT '草稿ID'; \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml index 732bf2683a..572bd59e84 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml +++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml @@ -25,8 +25,8 @@ + + diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/DraftDao.xml b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/DraftDao.xml index a6675ddb4e..ab61a224e1 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/DraftDao.xml +++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/DraftDao.xml @@ -26,9 +26,9 @@ + + + update draft set DEL_FLAG='1' where id=#{draftId} diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/GuideDao.xml b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/GuideDao.xml index a850719121..d3d5c34a56 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/GuideDao.xml +++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/GuideDao.xml @@ -57,6 +57,8 @@ INNER JOIN guide_category gc ON g.CATEGORY_CODE = gc.CATEGORY_CODE AND gc.CUSTOMER_ID = #{customerId} WHERE g.ID = #{guideId} + and g.DEL_FLAG = '0' + and gc.DEL_FLAG = '0' - \ No newline at end of file + diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/IcPartyMemberServiceImpl.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/IcPartyMemberServiceImpl.java index 7e4ecfc6ac..2b0f70bade 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/IcPartyMemberServiceImpl.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/IcPartyMemberServiceImpl.java @@ -566,6 +566,7 @@ public class IcPartyMemberServiceImpl extends BaseServiceImpl otherRows = listener.getOtherRows(); + List otherRows = listener.getErrorRows(); String idCard = e.getIdCard(); String name = e.getName(); String mobile = e.getMobile(); @@ -699,9 +700,10 @@ public class IcPartyMemberServiceImpl extends BaseServiceImpl result = epmetUserOpenFeignClient.icPartyMemberSync(ConvertUtils.sourceToTarget(e, IcPartyMemberDTO.class)); - if (!result.success() && null != result.getData()) { + if (result.success() && null != result.getData()) { e.setIcResiUser(result.getData().getIcResiUser()); e.setVolunteerCategory(result.getData().getVolunteerCategory()); + e.setAddress(result.getData().getAddress()); } e.setCreatedBy(currentUserId); e.setUpdatedBy(currentUserId); diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/ChangeRelocationDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/ChangeRelocationDTO.java index 25b5dbf56b..088f8431d5 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/ChangeRelocationDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/ChangeRelocationDTO.java @@ -210,4 +210,6 @@ public class ChangeRelocationDTO implements Serializable { */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date transferTime; + + private String isMoveOut; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcResiUserConfirmDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcResiUserConfirmDTO.java index e0a297cd63..d8e37ceba2 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcResiUserConfirmDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcResiUserConfirmDTO.java @@ -221,4 +221,6 @@ public class IcResiUserConfirmDTO implements Serializable { private String moveOutDate; + private String isMoveOut; + } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CancelAttentionPackageFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CancelAttentionPackageFormDTO.java index 6867827cd4..a059d76680 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CancelAttentionPackageFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CancelAttentionPackageFormDTO.java @@ -22,7 +22,7 @@ public class CancelAttentionPackageFormDTO implements Serializable { /** * 身份证 */ - @NotNull(message = "idCard不能为空",groups = CancelAttentionPackageForm.class) +// @NotNull(message = "idCard不能为空",groups = CancelAttentionPackageForm.class) private List idCards; /** @@ -30,4 +30,7 @@ public class CancelAttentionPackageFormDTO implements Serializable { */ @NotNull(message = "attentionType不能为空",groups = CancelAttentionPackageForm.class) private Integer attentionType ; + + @NotNull(message = "ids不能为空",groups = CancelAttentionPackageForm.class) + private List ids; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EditInfoFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EditInfoFormDTO.java index e8eb4249fa..7917113509 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EditInfoFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EditInfoFormDTO.java @@ -37,11 +37,13 @@ public class EditInfoFormDTO implements Serializable { * 姓 */ @NotBlank(message = "姓不能为空",groups = AddUserShowGroup.class) + @Length(max = 10,groups =AddUserShowGroup.class ,message = "姓不能超过10个字") private String surname; /** * 名 */ @NotBlank(message = "名不能为空",groups = AddUserShowGroup.class) + @Length(max = 10,groups =AddUserShowGroup.class ,message = "名不能超过10个字") private String name; //@NotBlank(message = "身份证号不能为空") diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcUserCountFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcUserCountFormDTO.java new file mode 100644 index 0000000000..675109ce0c --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcUserCountFormDTO.java @@ -0,0 +1,24 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2022/6/29 17:27 + */ +@Data +public class IcUserCountFormDTO implements Serializable { + private static final long serialVersionUID = 1303693003176367290L; + private String orgId; + /** + * 0 组织,1 网格,2 小区,3 楼栋,4 单元,5 房屋 + */ + private String orgType; + /** + * 0 本级,1 下级 + */ + private String type; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/ConfirmListResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/ConfirmListResultDTO.java index f9c131d7b5..7871653ae7 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/ConfirmListResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/ConfirmListResultDTO.java @@ -12,6 +12,7 @@ import lombok.NoArgsConstructor; @Data public class ConfirmListResultDTO { private String id; + private String agencyId; private String name; private String gender; private String mobile; diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcUserCountResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcUserCountResultDTO.java new file mode 100644 index 0000000000..a1e6e6a482 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcUserCountResultDTO.java @@ -0,0 +1,17 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2022/6/29 17:50 + */ +@Data +public class IcUserCountResultDTO implements Serializable { + private static final long serialVersionUID = 2875016989035736971L; + private String id; + private Integer count; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index 7aa527475e..65e7b7b850 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -824,4 +824,15 @@ public interface EpmetUserOpenFeignClient { @PostMapping("/epmetuser/icresiuser/getUserId/{icUserId}") Result> getUserId(@PathVariable("icUserId") String icUserId); + + /** + * 获取录入居民的数量 + * + * @Param formDTO + * @Return {@link Result>} + * @Author zhaoqifeng + * @Date 2022/6/30 9:35 + */ + @PostMapping("/epmetuser/icresiuser/getIcUserCount") + Result> getIcUserCount(@RequestBody IcUserCountFormDTO formDTO); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index cf8c53d1b2..8c47cdb204 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -622,4 +622,18 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getUserId", icUserId); } + /** + * 获取录入居民的数量 + * + * @param formDTO + * @Param formDTO + * @Return {@link Result>} + * @Author zhaoqifeng + * @Date 2022/6/30 9:35 + */ + @Override + public Result> getIcUserCount(IcUserCountFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getIcUserCount", formDTO); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/ChangeRelocationController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/ChangeRelocationController.java index 8066a87271..1b84302742 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/ChangeRelocationController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/ChangeRelocationController.java @@ -124,4 +124,24 @@ public class ChangeRelocationController { return new Result(); } + /** + * 从家庭中移除 + * + * @Param tokenDto + * @Param dto + * @Return {@link Result} + * @Author zhaoqifeng + * @Date 2022/6/27 10:50 + */ + @NoRepeatSubmit + @PostMapping("moveOutHomeConfirm") + public Result moveOutHomeConfirm(@LoginUser TokenDto tokenDto, @RequestBody ChangeRelocationDTO dto){ + dto.setCustomerId(tokenDto.getCustomerId()); + dto.setStaffId(tokenDto.getUserId()); + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + changeRelocationService.moveOutHomeConfirm(dto); + return new Result(); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java index 9eb61ac3bc..9becc91a97 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java @@ -48,6 +48,7 @@ import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.*; import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter; import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.constant.OrgInfoConstant; import com.epmet.constant.SystemMessageType; import com.epmet.constants.ImportTaskConstants; import com.epmet.dto.IcResiUserDTO; @@ -1238,4 +1239,17 @@ public class IcResiUserController implements ResultDataResolver { public Result> queryVolunteerList(@LoginUser TokenDto tokenDto) { return new Result>().ok(icResiUserService.queryVolunteerList(tokenDto.getCustomerId(), tokenDto.getUserId())); } + + /** + * 获取录入居民的数量 + * + * @Param formDTO + * @Return {@link Result>} + * @Author zhaoqifeng + * @Date 2022/6/30 9:35 + */ + @PostMapping("getIcUserCount") + public Result> getIcUserCount(@RequestBody IcUserCountFormDTO formDTO) { + return new Result>().ok(icResiUserService.getIcUserCount(formDTO)); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java index 5496919f3c..31ef9ec667 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java @@ -44,13 +44,6 @@ public interface IcNatDao extends BaseDao { **/ int delById(@Param("icNatId") String icNatId); - /** - * 插入或者更新 - * - * @param e - */ - void insertOrUpdate(IcNatEntity e); - /** * @Author sun * @Description 按条件查询业务数据 diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java index 0780d52eb3..73e5247785 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java @@ -416,4 +416,14 @@ public interface IcResiUserDao extends BaseDao { * @return */ List getUserListByCommunityId(@Param("communityId") String communityId); + + /** + * 获取录入居民的数量 + * + * @Param formDTO + * @Return {@link Map} + * @Author zhaoqifeng + * @Date 2022/6/29 17:37 + */ + List getIcUserCount(IcUserCountFormDTO formDTO); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineDao.java index 6f6eef59ba..d4db61ad5b 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineDao.java @@ -47,13 +47,6 @@ public interface IcVaccineDao extends BaseDao { **/ int delById(@Param("icVaccineId") String icVaccineId); - /** - * 插入或者更新 - * - * @param e - */ - void insertOrUpdate(IcVaccineEntity e); - /** * @Author sun * @Description 按条件查询业务数据 diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/ChangeRelocationService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/ChangeRelocationService.java index 1a54dba7c7..150fc05fa0 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/ChangeRelocationService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/ChangeRelocationService.java @@ -95,4 +95,14 @@ public interface ChangeRelocationService extends BaseService { * @return */ List getUserListByCommunityId(String communityId); + + /** + * 获取录入居民的数量 + * + * @Param formDTO + * @Return {@link Map} + * @Author zhaoqifeng + * @Date 2022/6/29 17:32 + */ + Map getIcUserCount(IcUserCountFormDTO formDTO); + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/ChangeRelocationServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/ChangeRelocationServiceImpl.java index e7fcf36e0a..a7c985599e 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/ChangeRelocationServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/ChangeRelocationServiceImpl.java @@ -10,6 +10,8 @@ import com.epmet.commons.tools.enums.IcResiUserSubStatusEnum; 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.redis.common.CustomerIcHouseRedis; +import com.epmet.commons.tools.redis.common.bean.HouseInfoCache; import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; @@ -32,10 +34,7 @@ import com.epmet.entity.ChangeRelocationEntity; import com.epmet.entity.IcResiUserEntity; import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.redis.ChangeRelocationRedis; -import com.epmet.service.ChangeRelocationService; -import com.epmet.service.ChangeWelfareService; -import com.epmet.service.IcResiUserService; -import com.epmet.service.IcUserTransferRecordService; +import com.epmet.service.*; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -44,6 +43,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.Arrays; +import java.util.Date; import java.util.List; import java.util.Map; @@ -76,6 +76,8 @@ public class ChangeRelocationServiceImpl extends BaseServiceImpl page(Map params) { @@ -279,6 +281,67 @@ public class ChangeRelocationServiceImpl extends BaseServiceImpl wrapper = new LambdaQueryWrapper<>(); wrapper.eq(IcResiUserConfirmEntity::getIcResiUserId, dto.getIcResiUserId()); + wrapper.eq(IcResiUserConfirmEntity::getHouseId, result.getHouseId()); wrapper.in(IcResiUserConfirmEntity::getSubmitType, Arrays.asList("in", "out")); wrapper.orderByDesc(IcResiUserConfirmEntity::getCreatedTime); List list = baseDao.selectList(wrapper); if (CollectionUtils.isNotEmpty(list)) { - result.setMoveOutStatus(list.get(NumConstant.ZERO).getConfirmResult()); + result.setMoveOutStatus(NumConstant.ONE_STR.equals(list.get(NumConstant.ZERO).getConfirmResult())? + NumConstant.THREE_STR:list.get(NumConstant.ZERO).getConfirmResult()); } else { result.setMoveOutStatus(NumConstant.THREE_STR); } @@ -341,6 +343,7 @@ public class IcResiUserConfirmServiceImpl extends BaseServiceImpl formItemList, String excelPathName, IcResiUserTableEnum sheetTableEnum, String currUserAgencyId, String currUserAgencyPids, String currentUserId, - String customerId) { + String customerId) { IcResiImportDynamicExcelListener readListener = new IcResiImportDynamicExcelListener(this, customerId, currentUserId, currUserAgencyId, currUserAgencyPids, true, formItemList, sheetTableEnum); @@ -448,8 +456,8 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res * @param checkBoxOptionColumnIdxAndLabel 复选框的列号&label中文 */ public void persistIcResiBaseInfo(Map itemIdAndColumnWrapper, List> dataRows, - String currUserAgencyId, Map checkBoxOptionColumnIdxAndLabel, - String currUserAgencyPids, String currentUserId, String tableName) { + String currUserAgencyId, Map checkBoxOptionColumnIdxAndLabel, + String currUserAgencyPids, String currentUserId, String tableName) { String loginUserCustomerId = EpmetRequestHolder.getLoginUserCustomerId(); // 遍历每一行,将行内容转化为 for (Map row : dataRows) { @@ -564,7 +572,10 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res } catch (Exception e) { String errorMsg; - if (e instanceof RenException | e instanceof EpmetException) { + + if (e instanceof RenException) { + errorMsg = e.getMessage(); + } else if (e instanceof EpmetException) { errorMsg = e.getMessage(); } else { errorMsg = "未知系统错误"; @@ -574,6 +585,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res ErrorRow errorRow = new ErrorRow(); errorRow.setIdCard(columnAndValues.get("ID_CARD")); errorRow.setName(columnAndValues.get("NAME")); + errorRow.setMobile(columnAndValues.get("MOBILE")); errorRow.setErrorInfo(errorMsg); errorRow.setTableName(tableName); errorRows.get().get(IcResiUserTableEnum.IC_RESI_USER.getTableName()).add(errorRow); @@ -679,8 +691,8 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res * @param targetTableName 要插入到哪一个表 */ public List persistIcResiExtraInfo(Map headerColumnWrapper, List> dataRows, - String currUserAgencyId, Map checkBoxOptionColumnIdxAndLabel, - String currentUserId, String targetTableName, String customerId) { + String currUserAgencyId, Map checkBoxOptionColumnIdxAndLabel, + String currentUserId, String targetTableName, String customerId) { LinkedHashMap columnAndValues = new LinkedHashMap<>(); @@ -756,6 +768,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res ErrorRow errorRow = new ErrorRow(); errorRow.setName(columnAndValues.get("NAME")); errorRow.setIdCard(columnAndValues.get("ID_CARD")); + errorRow.setMobile(columnAndValues.get("MOBILE")); errorRow.setErrorInfo(errorMsg); errorRow.setTableName(targetTableName); errorRows.get().get(targetTableName).add(errorRow); @@ -784,6 +797,8 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res */ public void singlePersistResiVirtualSheetExtraInfo(Map columnAndValues, IcResiUserTableEnum sheetEnumObject) { String idCard = columnAndValues.get(ID_CARD_COLUMN_NO); + String name = columnAndValues.get(ID_NAME_COLUMN_NO); + String mobile = columnAndValues.get(MOBILE_COLUMN_NO); try { if (StringUtils.isBlank(idCard)) { throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), @@ -813,8 +828,9 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res } ErrorRow errorRow = new ErrorRow(); - errorRow.setName(columnAndValues.get("NAME")); + errorRow.setName(name); errorRow.setIdCard(idCard); + errorRow.setMobile(mobile); errorRow.setErrorInfo(errorMsg); errorRow.setTableName(sheetEnumObject.getTableName()); errorRows.get().get(sheetEnumObject.getTableName()).add(errorRow); @@ -927,6 +943,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res // 这两列要提前放进去,因为有的列未填写的话,会抛异常出去,需要用这两列来做描述 target2Insert.put("ID_CARD", row.get(ID_CARD_COLUMN_NO)); target2Insert.put("NAME", row.get(ID_NAME_COLUMN_NO)); + target2Insert.put("MOBILE", row.get(MOBILE_COLUMN_NO)); for (Map.Entry dbColumnMetadata : dbMetadataItemIdAndColumnWrappers.entrySet()) { @@ -1366,35 +1383,41 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res } List options = null; + String optionTypeName = null; switch (pureUri) { case "/gov/org/customergrid/gridoption": + optionTypeName = "网格"; GridOptionFormDTO form = new GridOptionFormDTO(); form.setAgencyId(currUserAgencyId); form.setPurpose(purpose); options = getResultDataOrThrowsException(govOrgOpenFeignClient.getGridOption(form), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null, null); break; case "/gov/org/customerpartybranch/branchoption": - + optionTypeName = "所属支部"; CustomerPartyBranchDTO bform = new CustomerPartyBranchDTO(); bform.setGridId(cascadeItemColumnWrapper.getColValue()); options = getResultDataOrThrowsException(govOrgOpenFeignClient.getBranchOption(bform), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null, null); break; case "/gov/org/icbuilding/buildingoption": + optionTypeName = "楼栋"; IcBuildingDTO buildingform = new IcBuildingDTO(); buildingform.setNeighborHoodId(cascadeItemColumnWrapper.getColValue()); options = getResultDataOrThrowsException(govOrgOpenFeignClient.getBuildingOptions(buildingform), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null, null); break; case "/gov/org/icbuildingunit/unitoption": + optionTypeName = "单元"; IcBuildingUnitDTO buForm = new IcBuildingUnitDTO(); buForm.setBuildingId(cascadeItemColumnWrapper.getColValue()); options = getResultDataOrThrowsException(govOrgOpenFeignClient.getUnitOptions(buForm), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null, null); break; case "/gov/org/ichouse/houseoption": + optionTypeName = "房屋"; HouseFormDTO hform = new HouseFormDTO(); hform.setUnitId(cascadeItemColumnWrapper.getColValue()); options = getResultDataOrThrowsException(govOrgOpenFeignClient.getHouseOption(hform), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null, null); break; case "/gov/org/icneighborhood/neighborhoodoption": + optionTypeName = "所属小区"; IcNeighborHoodDTO nform = new IcNeighborHoodDTO(); String gridId = cascadeItemColumnWrapper.getColValue(); if (StringUtils.isBlank(gridId)){ @@ -1405,21 +1428,27 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res options = getResultDataOrThrowsException(govOrgOpenFeignClient.getNeighborHoodOptions(nform), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null, null); break; case "/sys/dict/data/education": + optionTypeName = "文化程度"; options = getResultDataOrThrowsException(adminOpenFeignClient.getEducationOption(), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null, null); break; case "/sys/dict/data/house": + optionTypeName = "住房性质"; options = getResultDataOrThrowsException(adminOpenFeignClient.getHouseOption(), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null, null); break; case "/sys/dict/data/nation": + optionTypeName = "民族"; options = getResultDataOrThrowsException(adminOpenFeignClient.getNationOption(), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null, null); break; case "/sys/dict/data/ninesmallplaces": + optionTypeName = "九小场所"; options = getResultDataOrThrowsException(adminOpenFeignClient.getNineSmallPlacesOption(), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null, null); break; case "/sys/dict/data/relationship": + optionTypeName = "人员关系"; options = getResultDataOrThrowsException(adminOpenFeignClient.getRelationshipOption(), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null, null); break; case "/resi/partymember/icPartyOrg/branchlist": + optionTypeName = "所属支部"; options = this.listBranchOptions(); break; default: @@ -1430,8 +1459,16 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res if (options == null) { return null; } + try { + return options.stream().collect(Collectors.toMap(OptionResultDTO::getLabel, OptionResultDTO::getValue)); + } catch (Exception e) { + String erroMsg = ExceptionUtils.getErrorStackTrace(e); + log.error("【居民信息导入】{}转化Options为map失败,url:{}, cascadeItemId:{}, currUserAgencyId:{},错误信息:{}", + optionTypeName, pureUri, cascadeItemId, currUserAgencyId, erroMsg); - return options.stream().collect(Collectors.toMap(OptionResultDTO::getLabel, OptionResultDTO::getValue)); + String hintMsg = optionTypeName + "解析失败"; + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), hintMsg, hintMsg); + } // 通用api调用,无法实现 /*if (!uri.startsWith("/api")) uri = "/api".concat(uri); @@ -2019,7 +2056,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res // 保存 changeDetail for (Map.Entry newCategories : newData.getCategories().entrySet()) { String key = newCategories.getKey(); - String newValue = newCategories.getValue(); + String newValue = newCategories.getValue(); // 现在是这个类型,这个类型要+1 if ("1".equals(newValue)) { diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java index 1e90281665..f6a476c64e 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java @@ -61,10 +61,6 @@ import com.epmet.dto.result.demand.IcResiDemandDictDTO; import com.epmet.dto.result.demand.OptionDTO; import com.epmet.entity.*; import com.epmet.excel.support.ExportResiUserItemDTO; -import com.epmet.feign.EpmetAdminOpenFeignClient; -import com.epmet.feign.EpmetHeartOpenFeignClient; -import com.epmet.feign.GovOrgOpenFeignClient; -import com.epmet.feign.OperCustomizeOpenFeignClient; import com.epmet.feign.*; import com.epmet.opendata.dto.form.GetResidentDetailByIdCardFormDTO; import com.epmet.opendata.dto.form.SaveCaResidentUserFormDTO; @@ -90,7 +86,6 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.math.BigDecimal; import java.math.RoundingMode; - import java.sql.Timestamp; import java.text.NumberFormat; import java.text.SimpleDateFormat; @@ -2295,7 +2290,26 @@ public class IcResiUserServiceImpl extends BaseServiceImpl} + * @Author zhaoqifeng + * @Date 2022/6/29 17:32 + */ + @Override + public Map getIcUserCount(IcUserCountFormDTO formDTO) { + List list = baseDao.getIcUserCount(formDTO); + list = list.stream().filter(item -> null != item.getId()).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyMap(); + } + return list.stream().collect(Collectors.toMap(IcUserCountResultDTO::getId, IcUserCountResultDTO::getCount, (key1 , key2)-> key2)); + } + /** * 根据身份证获取居民角色(目前只有是否是志愿者) * diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java index 5970d78788..6785817934 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java @@ -378,6 +378,8 @@ public class UserBaseInfoServiceImpl extends BaseServiceImpl page(Map params) { IPage page = baseDao.selectPage( @@ -420,6 +422,7 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl #{l} diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml index 1baf8a507a..4459802f6d 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml @@ -139,24 +139,6 @@ DELETE FROM ic_nat WHERE id = #{icNatId} - - INSERT INTO epmet_user.ic_nat - (ID, CUSTOMER_ID, AGENCY_ID, PIDS, USER_ID, - USER_TYPE, NAME, MOBILE, ID_CARD, NAT_TIME, NAT_RESULT, NAT_ADDRESS, FILE_NAME, ATTACHMENT_TYPE, ATTACHMENT_URL, - DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME) - VALUES (#{id}, #{customerId}, #{agencyId}, #{pids}, #{userId}, - #{userType}, #{name}, #{mobile}, #{idCard}, #{natTime}, - #{natResult}, #{natAddress}, #{fileName}, #{attachmentType}, #{attachmentUrl}, - #{delFlag}, #{revision}, #{createdBy}, #{createdTime}, #{updatedBy}, - #{updatedTime}) - ON DUPLICATE KEY update - NAME=#{name}, - MOBILE=#{mobile}, - NAT_ADDRESS=#{natAddress}, - NAT_RESULT=#{natResult}, - UPDATED_BY=#{updatedBy}, - UPDATED_TIME=NOW() - UPDATE ic_nat m, ( diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserConfirmDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserConfirmDao.xml index b85e79003a..515384e843 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserConfirmDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserConfirmDao.xml @@ -62,6 +62,7 @@ + + diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccineDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccineDao.xml index d2c9aa3488..0ed766fb77 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccineDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccineDao.xml @@ -157,24 +157,6 @@ DELETE FROM ic_vaccine WHERE id = #{icVaccineId} - - INSERT INTO epmet_user.ic_nat - (ID, CUSTOMER_ID, AGENCY_ID, PIDS, USER_ID, - USER_TYPE, NAME, MOBILE, ID_CARD, NAT_TIME, NAT_RESULT, NAT_ADDRESS, FILE_NAME, ATTACHMENT_TYPE, ATTACHMENT_URL, - DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME) - VALUES (#{id}, #{customerId}, #{agencyId}, #{pids}, #{userId}, - #{userType}, #{name}, #{mobile}, #{idCard}, #{natTime}, - #{natResult}, #{natAddress}, #{fileName}, #{attachmentType}, #{attachmentUrl}, - #{delFlag}, #{revision}, #{createdBy}, #{createdTime}, #{updatedBy}, - #{updatedTime}) - ON DUPLICATE KEY update - NAME=#{name}, - MOBILE=#{mobile}, - NAT_ADDRESS=#{natAddress}, - NAT_RESULT=#{natResult}, - UPDATED_BY=#{updatedBy}, - UPDATED_TIME=NOW() - UPDATE ic_nat m, (