Browse Source

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

master
wangxianzhang 3 years ago
parent
commit
f8ece9acb4
  1. 27
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/IdCardTypeEnum.java
  2. 31
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/processor/MaskProcessor.java
  3. 133
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/IdCardRegexUtils.java
  4. 4
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/UserBaseInfoDao.xml
  5. 2
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml
  6. 7
      epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java
  7. 39
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcSocietyOrgDTO.java
  8. 19
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/AddSocietyOrgFormDTO.java
  9. 17
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/EditSocietyOrgFormDTO.java
  10. 2
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiVolunteerAuthenticateFormDTO.java
  11. 8
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/GetListSocietyOrgResultDTO.java
  12. 8
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/SocietyOrgListResultDTO.java
  13. 171
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcSocietyOrgController.java
  14. 8
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java
  15. 4
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcSocietyOrgDao.java
  16. 9
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcSocietyOrgEntity.java
  17. 27
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/IcSocietyOrgExcel.java
  18. 42
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/IcSocietyOrgExportExcel.java
  19. 74
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/IcSocietyOrgImportExcelDTO.java
  20. 157
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/handler/IcSocietyOrgExcelImportListener.java
  21. 10
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcSocietyOrgService.java
  22. 244
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcSocietyOrgServiceImpl.java
  23. 13
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcSocietyOrgDao.xml
  24. BIN
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/templates/societyorg_import_template.xlsx
  25. 2
      epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/form/SaveOrUpdateParyMemberFormDTO.java
  26. 10
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcNeighborHoodDTO.java
  27. 31
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CheckHouseInfoFormDTO.java
  28. 10
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/BuildingResultDTO.java
  29. 38
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CheckHomeInfoResultInfo.java
  30. 41
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridInfoByNameResultDTO.java
  31. 12
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java
  32. 20
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcHouseController.java
  33. 15
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcNeighborHoodController.java
  34. 3
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java
  35. 20
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingDao.java
  36. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingUnitDao.java
  37. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java
  38. 9
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcNeighborHoodDao.java
  39. 9
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java
  40. 9
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcHouseService.java
  41. 14
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcNeighborHoodService.java
  42. 7
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
  43. 4
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java
  44. 59
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java
  45. 16
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java
  46. 15
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
  47. 40
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml
  48. 11
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingUnitDao.xml
  49. 9
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml
  50. 9
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml
  51. 14
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java
  52. 12
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java
  53. 2
      epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/result/IssueDetailResultDTO.java
  54. 3
      epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java
  55. 8
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/controller/ResiMineGridController.java
  56. 10
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/mine/controller/PersonalCenterController.java
  57. 9
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartyMemberConfirmServiceImpl.java
  58. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcFollowUpRecordDTO.java
  59. 15
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcVaccinePrarmeterDTO.java
  60. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddIcVaccineFormDTO.java
  61. 4
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EditInfoFormDTO.java
  62. 36
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/GridInfoVaccinePrarmeterFormDTO.java
  63. 4
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcMoveInAddEditFormDTO.java
  64. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcNoticeFormDTO.java
  65. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcTripReportFormDTO.java
  66. 79
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcVaccineCheckFormDTO.java
  67. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/InfoSubmitFromDTO.java
  68. 4
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PageFollowUpFormDTO.java
  69. 42
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VaccinePrarmeterListFormDTO.java
  70. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CollectListMemberExcelResultDTO.java
  71. 16
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectController.java
  72. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectVisitorController.java
  73. 18
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
  74. 7
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java
  75. 118
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVaccinePrarmeterController.java
  76. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineDao.java
  77. 19
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccinePrarmeterDao.java
  78. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineRelationDao.java
  79. 7
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiUserEntity.java
  80. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcVaccinePrarmeterEntity.java
  81. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeDeathExcel.java
  82. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeRelocationExcel.java
  83. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeWelfareExcel.java
  84. 50
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcVaccinePrarmeterExcel.java
  85. 97
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcVaccinePrarmeterImportExcel.java
  86. 77
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/error/IcVaccinePrarmeterImportErrorModel.java
  87. 11
      epmet-user/epmet-user-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java
  88. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java
  89. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBaseInfoRedis.java
  90. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcPointNucleicMonitoringService.java
  91. 29
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcVaccinePrarmeterService.java
  92. 34
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java
  93. 12
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcBirthRecordServiceImpl.java
  94. 12
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcMoveInRecordServiceImpl.java
  95. 94
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java
  96. 25
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  97. 744
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVaccinePrarmeterServiceImpl.java
  98. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RegisterRelationServiceImpl.java
  99. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java
  100. 19
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java

27
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/IdCardTypeEnum.java

@ -0,0 +1,27 @@
package com.epmet.commons.tools.enums;
/**
* 唯一整件类型
*/
public enum IdCardTypeEnum {
OTHERS("0", "其他"),
SFZH("1", "身份证号"),
PASSPORT("2", "护照");
private String type;
private String name;
IdCardTypeEnum(String type, String name) {
this.type = type;
this.name = name;
}
public String getType() {
return type;
}
public String getName() {
return name;
}
}

31
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/processor/MaskProcessor.java

@ -2,8 +2,10 @@ package com.epmet.commons.tools.processor;
import cn.hutool.core.util.StrUtil;
import com.epmet.commons.tools.annotation.MaskResponse;
import com.epmet.commons.tools.enums.IdCardTypeEnum;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.IdCardRegexUtils;
import com.epmet.commons.tools.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@ -13,6 +15,7 @@ import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
/**
* desc:脱敏处理器
@ -136,21 +139,37 @@ public class MaskProcessor {
}
/**
* 唯一整件号打码可能是身份证号或者是护照号
* 将明文字符串打码变为掩码保留前6后面打码
* @param originString
* @return
*/
private String maskIdCard(String originString) {
int clearTextLength = 12;
// 仅将6位之后的全都打码
int length = originString.length();
if (length <= clearTextLength) {
IdCardRegexUtils regexUtil = IdCardRegexUtils.parse(originString);
if (regexUtil == null) {
// 不匹配任何类型,不码
return originString;
}
String maskStr = StrUtil.repeatByLength("*", length - clearTextLength);
if (regexUtil.getTypeEnum() == IdCardTypeEnum.SFZH) {
// 身份证号
// 仅将6位之后的全都打码
int maskedTextLength = 12;
int length = originString.length();
String maskStr = StrUtil.repeatByLength("*", length - maskedTextLength);
return originString.replaceAll("^(\\d{10})\\d+([a-zA-Z0-9]{2})$", new StringBuilder("$1").append(maskStr).append("$2").toString());
} else if (regexUtil.getTypeEnum() == IdCardTypeEnum.PASSPORT) {
// 护照,前两位,后两位为明文,其他*
int clearLength = 4;
int maskedLength = 0;
if ((maskedLength = originString.length() - clearLength) > 0) {
String maskStr = StrUtil.repeatByLength("*", maskedLength);
return originString.replaceAll("^([a-zA-Z0-9]{2})[a-zA-Z0-9]+([a-zA-Z0-9]{2})$", new StringBuilder("$1").append(maskStr).append("$2").toString());
}
}
return originString.replaceAll("^(\\d{10})\\d+([a-zA-Z0-9]{2})$", new StringBuilder("$1").append(maskStr).append("$2").toString());
return originString;
}
/**

133
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/IdCardRegexUtils.java

@ -0,0 +1,133 @@
package com.epmet.commons.tools.utils;
import com.epmet.commons.tools.enums.IdCardTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* 唯一整件正则工具
*/
public class IdCardRegexUtils {
/**
* 15位身份证号的正则表达式
*/
private static final Pattern PATTERN_15_ID = Pattern.compile("^\\d{6}(?<year>\\d{2})(?<month>0[1-9]|1[0-2])(?<day>[0-2][0-9]|3[0-1])\\d{2}(?<sex>\\d)$");
/**
* 18位身份证号的正则表达式
*/
private static final Pattern PATTERN_18_ID = Pattern.compile("^\\d{6}(?<year>\\d{4})(?<month>0[1-9]|1[0-2])(?<day>[0-2][0-9]|3[0-1])\\d{2}(?<sex>\\d)[0-9a-xA-X]$");
/**
* 9位护照
*/
private static final Pattern PATTERN_9_PASSPORT = Pattern.compile("^[a-zA-Z0-9]{8,9}$");
private String inputText;
private Matcher matcher;
private IdCardTypeEnum idCardType;
private IdCardRegexUtils(IdCardTypeEnum idCardType, Matcher matcher, String inputText) {
this.idCardType = idCardType;
this.matcher = matcher;
this.inputText = inputText;
}
/**
* 正则解析结果
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public static class ParsedContent {
private String birthdayYear;
private String birthdayMonth;
private String birthdayDay;
private String sex;
}
/**
* desc:校验输入的证件号是否合法
* @param input
* @return
*/
public static boolean validateIdCard(String input){
IdCardRegexUtils parse = IdCardRegexUtils.parse(input);
return parse != null;
}
/**
* 解析正则
* @param input
* @return
*/
public static IdCardRegexUtils parse(String input) {
if (input == null || input.trim().length() == 0) {
return null;
}
if (input.length() == 15) {
Matcher matcher = PATTERN_15_ID.matcher(input);
if (matcher.matches()) {
return new IdCardRegexUtils(IdCardTypeEnum.SFZH, matcher, input);
}
}
if (input.length() == 18) {
Matcher matcher = PATTERN_18_ID.matcher(input);
if (matcher.matches()) {
return new IdCardRegexUtils(IdCardTypeEnum.SFZH, matcher, input);
}
}
if (input.length() == 9 || input.length() == 8) {
Matcher matcher = PATTERN_9_PASSPORT.matcher(input);
if (matcher.matches()) {
return new IdCardRegexUtils(IdCardTypeEnum.PASSPORT, matcher, input);
}
}
return null;
}
/**
* 获取解析结果
* @return
*/
public ParsedContent getParsedResult() {
if (matcher == null || idCardType == null) {
return null;
}
if (IdCardTypeEnum.SFZH == idCardType) {
//是身份证号,可以解析
String year;
if (inputText.length() == 15) {
// 15位身份证号,years前需要拼上19
year = "19".concat(matcher.group("year"));
} else {
year = matcher.group("year");
}
String month = matcher.group("month");
String day = matcher.group("day");
String sex = matcher.group("sex");
return new ParsedContent(year, month, day, sex);
}
// 其他类型暂时不可解析
return null;
}
/**
* 获取类型枚举
* @return
*/
public IdCardTypeEnum getTypeEnum() {
return idCardType;
}
}

4
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/UserBaseInfoDao.xml

@ -7,13 +7,13 @@
<select id="selectUserInfosByUserIds" resultType="com.epmet.dataaggre.dto.epmetuser.result.UserInfosResultDTO">
SELECT
user_id,
CONCAT(STREET,'-',SURNAME,
CONCAT(SURNAME,
CASE WHEN GENDER = '1' THEN '先生'
WHEN GENDER = '2' THEN '女士'
ELSE '先生/女士' END
) AS userShowName,
HEAD_IMG_URL AS headPhoto,
CONCAT(STREET,'-',REAL_NAME) AS realName
CONCAT(REAL_NAME) AS realName
FROM user_base_info
WHERE DEL_FLAG = 0
AND

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

@ -521,7 +521,7 @@
<select id="selectScreenProjectData" resultType="com.epmet.dto.screen.ScreenProjectDataDTO">
SELECT
CONCAT( STREET, '-', SURNAME, CASE WHEN GENDER = '1' THEN '先生' WHEN GENDER = '2' THEN '女士' ELSE '先生/女士' END ) AS linkName,
CONCAT( SURNAME, CASE WHEN GENDER = '1' THEN '先生' WHEN GENDER = '2' THEN '女士' ELSE '先生/女士' END ) AS linkName,
MOBILE AS linkMobile,
USER_ID as topicId
FROM

7
epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java

@ -23,6 +23,8 @@ public interface ImportTaskConstants {
String BIZ_TYPE_IC_ENTERPRISE="ic_enterprise";
String IC_POINT_NUCLEIC_MONITORING = "ic_point_nucleic_monitoring";
String IC_POINT_VACCINES_INOCULATION = "ic_point_vaccines_inoculation";
// 新冠病毒疫苗接种人员信息台账
String IC_VACCINE_PRARMETER = "ic_vaccine_prarmeter";
/**
* 工作日志导入
*/
@ -66,4 +68,9 @@ public interface ImportTaskConstants {
* 城市管理
*/
String IC_CITY_MANAGEMENT = "ic_city_management";
/**
* 社会组织
*/
String IC_SOCIETY_ORG="ic_society_org";
}

39
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcSocietyOrgDTO.java

@ -39,6 +39,11 @@ public class IcSocietyOrgDTO implements Serializable {
*/
private String id;
/**
* 图片地址
*/
private String imgUrl;
/**
* 客户Id
*/
@ -74,6 +79,11 @@ public class IcSocietyOrgDTO implements Serializable {
*/
private String mobile;
/**
* 服务时间
*/
private String serviceTimeStr;
/**
* 起始服务时间
*/
@ -109,34 +119,5 @@ public class IcSocietyOrgDTO implements Serializable {
*/
private String remarks;
/**
* 删除标识0.未删除 1.已删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

19
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/AddSocietyOrgFormDTO.java

@ -23,7 +23,7 @@ import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.util.Date;
@ -48,6 +48,11 @@ public class AddSocietyOrgFormDTO implements Serializable {
* agency_id的所有上级
*/
private String pids;
/**
* 社会组织头像
*/
@NotEmpty(message = "组织头像不能为空", groups = { AddSocietyOrgFormDTO.Add.class})
private String[] imageList;
/**
* 社会组织名称
*/
@ -63,7 +68,7 @@ public class AddSocietyOrgFormDTO implements Serializable {
/**
* 负责人
*/
@NotBlank(message = "负责人名称不能为空", groups = { AddSocietyOrgFormDTO.Add.class })
//@NotBlank(message = "负责人名称不能为空", groups = { AddSocietyOrgFormDTO.Add.class })
@Length(max = 20, message = "负责人名称不能超过20个字符",groups = {Add.class})
private String personInCharge;
/**
@ -72,22 +77,24 @@ public class AddSocietyOrgFormDTO implements Serializable {
@NotBlank(message = "负责人电话不能为空", groups = { AddSocietyOrgFormDTO.Add.class })
@Length(max = 11, message = "负责人电话不能超过11个字符",groups = {Add.class})
private String mobile;
/**
* 服务时间
*/
@NotBlank(message = "服务时间不能为空", groups = { AddSocietyOrgFormDTO.Add.class })
private String serviceTimeStr;
/**
* 起始服务时间
*/
@NotNull(message = "起始服务时间不能为空", groups = { AddSocietyOrgFormDTO.Add.class })
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date serviceStartTime;
/**
* 终止服务时间
*/
@NotNull(message = "终止服务时间不能为空", groups = { AddSocietyOrgFormDTO.Add.class })
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date serviceEndTime;
/**
* 绑定管理员[组织下录入的工作人员]
*/
@NotBlank(message = "绑定管理员名称不能为空", groups = { AddSocietyOrgFormDTO.Add.class })
private String adminStaffId;
/**
* 地址
@ -106,4 +113,4 @@ public class AddSocietyOrgFormDTO implements Serializable {
public interface Add extends CustomerClientShowGroup {}
}
}

17
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/EditSocietyOrgFormDTO.java

@ -22,6 +22,7 @@ import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.util.Date;
@ -40,6 +41,12 @@ public class EditSocietyOrgFormDTO implements Serializable {
*/
@NotBlank(message = "社会组织Id不能为空", groups = { Edit.class, Del.class })
private String societyId;
/**
* 社会组织头像
*/
@NotEmpty(message = "组织头像不能为空", groups = { Edit.class})
private String[] imageList;
/**
* 社会组织名称
*/
@ -53,13 +60,19 @@ public class EditSocietyOrgFormDTO implements Serializable {
/**
* 负责人
*/
@Length(max = 20, message = "负责人名称不能超过20个字符",groups = {Edit.class})
//@Length(max = 20, message = "负责人名称不能超过20个字符",groups = {Edit.class})
private String personInCharge;
/**
* 负责人电话
*/
@Length(max = 11, message = "负责人电话不能超过11个字符",groups = {Edit.class})
private String mobile;
/**
* 服务时间
*/
@NotBlank(message = "服务时间不能为空",groups = {Edit.class})
private String serviceTimeStr;
/**
* 起始服务时间
*/
@ -92,4 +105,4 @@ public class EditSocietyOrgFormDTO implements Serializable {
public interface Edit {}
public interface Del {}
}
}

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

@ -59,7 +59,7 @@ public class ResiVolunteerAuthenticateFormDTO implements Serializable {
/**
* 身份证号码
*/
@NotBlank(message = "身份证号码不能为空", groups = {AddUserShowGroup.class })
@NotBlank(message = "证号能为空", groups = {AddUserShowGroup.class })
private String idNum;
/**

8
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/GetListSocietyOrgResultDTO.java

@ -44,6 +44,10 @@ public class GetListSocietyOrgResultDTO implements Serializable {
private String agencyId;
//社会组织Id
private String societyId;
/**
* 社会组织头像
*/
private String imgUrl;
//社会组织名称
private String societyName;
//服务事项
@ -52,6 +56,10 @@ public class GetListSocietyOrgResultDTO implements Serializable {
private String personInCharge;
//负责人电话
private String mobile;
/**
* 服务时间
*/
private String serviceTimeStr;
//起始服务时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date serviceStartTime;

8
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/SocietyOrgListResultDTO.java

@ -35,6 +35,10 @@ public class SocietyOrgListResultDTO implements Serializable {
private String agencyName;
//社会组织Id
private String societyId;
/**
* 图像
*/
private String imgUrl;
//社会组织名称
private String societyName;
//服务事项
@ -43,6 +47,10 @@ public class SocietyOrgListResultDTO implements Serializable {
private String personInCharge;
//负责人电话
private String mobile;
/**
* 服务时间
*/
private String serviceTimeStr;
//起始服务时间
//@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
//private Date serviceStartTime;

171
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcSocietyOrgController.java

@ -18,34 +18,55 @@
package com.epmet.controller;
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ExcelPoiUtils;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
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.constants.ImportTaskConstants;
import com.epmet.dto.IcSocietyOrgDTO;
import com.epmet.dto.form.AddSocietyOrgFormDTO;
import com.epmet.dto.form.EditSocietyOrgFormDTO;
import com.epmet.dto.form.GetListSocietyOrgFormDTO;
import com.epmet.dto.form.ImportTaskCommonFormDTO;
import com.epmet.dto.form.demand.ServiceQueryFormDTO;
import com.epmet.dto.result.GetListSocietyOrgResultDTO;
import com.epmet.dto.result.ImportTaskCommonResultDTO;
import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.excel.IcSocietyOrgExcel;
import com.epmet.excel.IcSocietyOrgExportExcel;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.service.IcSocietyOrgService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.net.URLEncoder;
import java.nio.file.Path;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
@ -58,11 +79,13 @@ import java.util.stream.Collectors;
@Slf4j
@RestController
@RequestMapping("societyorg")
public class IcSocietyOrgController {
public class IcSocietyOrgController implements ResultDataResolver {
private static final String DEFAULT_NO_IMG = "https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet/test/20220826/38eb186191ab48fe8d3920b642b56e64.png";
@Autowired
private IcSocietyOrgService societyOrgService;
@Autowired
private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient;
/**
* @Author sun
* @Description 新增社会组织
@ -87,6 +110,19 @@ public class IcSocietyOrgController {
return new Result();
}
/**
* @Author sun
* @Description 删除社会组织
**/
@RequestMapping("detail/{id}")
public Result detail(@LoginUser TokenDto tokenDto, @PathVariable(value = "id") String id) {
IcSocietyOrgDTO icSocietyOrgDTO = societyOrgService.get(id);
if (StringUtils.isBlank(icSocietyOrgDTO.getImgUrl())){
icSocietyOrgDTO.setImgUrl(DEFAULT_NO_IMG);
}
return new Result().ok(icSocietyOrgDTO);
}
/**
* @Author sun
* @Description 删除社会组织
@ -129,14 +165,50 @@ public class IcSocietyOrgController {
**/
@PostMapping("export")
public void export(@LoginUser TokenDto tokenDto, @RequestBody GetListSocietyOrgFormDTO formDTO, HttpServletResponse response) throws Exception {
//废弃原来的导出
// formDTO.setCustomerId(tokenDto.getCustomerId());
// formDTO.setStaffId(tokenDto.getUserId());
// formDTO.setIsPage(false);
// GetListSocietyOrgResultDTO list = societyOrgService.getList(formDTO);
// ExcelUtils.exportExcelToTarget(response, null, list.getList(), IcSocietyOrgExportExcel.class);
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setStaffId(tokenDto.getUserId());
formDTO.setIsPage(false);
GetListSocietyOrgResultDTO list = societyOrgService.getList(formDTO);
ExcelUtils.exportExcelToTarget(response, null, list.getList(), IcSocietyOrgExcel.class);
ExcelWriter excelWriter = null;
formDTO.setPageNo(NumConstant.ONE);
formDTO.setPageSize(NumConstant.TEN_THOUSAND);
try {
String fileName = "社会组织" + DateUtils.format(new Date()) + ".xlsx";
excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), IcSocietyOrgExportExcel.class).build();
WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build();
GetListSocietyOrgResultDTO data = null;
List<IcSocietyOrgExportExcel> list = null;
do {
data = societyOrgService.getList(formDTO);
list = ConvertUtils.sourceToTarget(data.getList(), IcSocietyOrgExportExcel.class);
formDTO.setPageNo(formDTO.getPageNo() + NumConstant.ONE);
excelWriter.write(list, writeSheet);
} while (org.apache.commons.collections4.CollectionUtils.isNotEmpty(list) && list.size() == formDTO.getPageSize());
} catch (EpmetException e) {
response.reset();
response.setCharacterEncoding("UTF-8");
response.setHeader("content-type", "application/json; charset=UTF-8");
PrintWriter printWriter = response.getWriter();
Result<Object> result = new Result<>().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),e.getMsg());
printWriter.write(JSON.toJSONString(result));
printWriter.close();
} catch (Exception e) {
log.error("社会组织export exception", e);
} finally {
if (excelWriter != null) {
excelWriter.finish();
}
}
}
/**
* 废弃此方法用下面的importV2
* @Author sun
* @Description 九小场所下组织列表导入
**/
@ -168,4 +240,83 @@ public class IcSocietyOrgController {
return new Result().ok(str);
}
/**
* 下载社会组织导入模板
* @param response
* @throws IOException
*/
@RequestMapping(value = "import-template-download", method = {RequestMethod.GET, RequestMethod.POST})
public void downloadTemplate(HttpServletResponse response) throws IOException {
response.setCharacterEncoding("UTF-8");
response.addHeader(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, "Content-Disposition");
response.setHeader(HttpHeaders.CONTENT_TYPE, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode("社区组织导入模板", "UTF-8") + ".xlsx");
InputStream is = this.getClass().getClassLoader().getResourceAsStream("templates/societyorg_import_template.xlsx");
try {
ServletOutputStream os = response.getOutputStream();
IOUtils.copy(is, os);
} finally {
if (is != null) {
is.close();
}
}
}
/**
*
* @param tokenDto
* @param file
* @return
*/
@PostMapping("importV2")
public Result importExcelV2(@LoginUser TokenDto tokenDto, @RequestPart("file") MultipartFile file) {
String userId = EpmetRequestHolder.getHeader(AppClientConstant.USER_ID);
// 1.暂存文件
String originalFilename = file.getOriginalFilename();
String extName = originalFilename.substring(originalFilename.lastIndexOf("."));
Path fileSavePath;
try {
Path importPath = FileUtils.getAndCreateDirUnderEpmetFilesDir("ic_society_org", "import");
fileSavePath = importPath.resolve(UUID.randomUUID().toString().concat(extName));
} catch (IOException e) {
String errorMsg = ExceptionUtils.getErrorStackTrace(e);
log.error("【社会组织】创建临时存储文件失败:{}", errorMsg);
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "社会组织导入文件上传失败", "社会组织导入文件上传失败");
}
InputStream is = null;
FileOutputStream os = null;
try {
is = file.getInputStream();
os = new FileOutputStream(fileSavePath.toString());
IOUtils.copy(is, os);
} catch (Exception e) {
log.error("【社会组织】导入method exception", e);
} finally {
org.apache.poi.util.IOUtils.closeQuietly(is);
org.apache.poi.util.IOUtils.closeQuietly(os);
}
// 2.生成导入任务记录
ImportTaskCommonFormDTO importTaskForm = new ImportTaskCommonFormDTO();
importTaskForm.setOperatorId(userId);
importTaskForm.setBizType(ImportTaskConstants.IC_SOCIETY_ORG);
importTaskForm.setOriginFileName(originalFilename);
ImportTaskCommonResultDTO rstData = getResultDataOrThrowsException(commonServiceOpenFeignClient.createImportTask(importTaskForm),
ServiceConstant.EPMET_COMMON_SERVICE,
EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),
"excel导入社会组织错误",
"社会组织导入失败");
// 3.执行导入
societyOrgService.execAsyncExcelImport(fileSavePath, rstData.getTaskId(),tokenDto.getCustomerId(),tokenDto.getUserId());
return new Result();
}
}

8
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java

@ -22,6 +22,7 @@ import com.epmet.commons.tools.dto.form.mq.MqBaseFormDTO;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.IdCardRegexUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.constant.SystemMessageType;
@ -38,6 +39,7 @@ import com.epmet.dto.result.resi.ResiVolunteerInfoResultDTO;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.send.SendMqMsgUtil;
import com.epmet.service.VolunteerInfoService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -72,6 +74,12 @@ public class ResiVolunteerController {
formDTO.setUserId(tokenDto.getUserId());
formDTO.setCustomerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(formDTO, ResiVolunteerAuthenticateFormDTO.AddUserShowGroup.class, ResiVolunteerAuthenticateFormDTO.AddUserInternalGroup.class);
if (StringUtils.isNotBlank(formDTO.getIdNum())){
boolean b = IdCardRegexUtils.validateIdCard(formDTO.getIdNum());
if (!b){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"请输入正确的证件号","请输入正确的证件号");
}
}
volunteerInfoService.authenticate(formDTO);
//发送志愿者人员消息变动

4
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcSocietyOrgDao.java

@ -59,4 +59,8 @@ public interface IcSocietyOrgDao extends BaseDao<IcSocietyOrgEntity> {
* @Description 查询当前组织下的社会组织数据
**/
List<IcSocietyOrgDTO> getByAgencyId(@Param("agencyId") String agencyId);
List<IcSocietyOrgEntity> selectListForUniqueName(@Param("agencyId") String agencyId,
@Param("societyName") String societyName,
@Param("id") String id);
}

9
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcSocietyOrgEntity.java

@ -73,6 +73,11 @@ public class IcSocietyOrgEntity extends BaseEpmetEntity {
private String mobile;
/**
* 服务时间
*/
private String serviceTimeStr;
/**
* 起始服务时间
*/
private Date serviceStartTime;
@ -87,6 +92,10 @@ public class IcSocietyOrgEntity extends BaseEpmetEntity {
*/
private String adminStaffId;
/**
* 图片地址
*/
private String imgUrl;
/**
* 地址
*/

27
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/IcSocietyOrgExcel.java

@ -34,37 +34,28 @@ import java.io.Serializable;
@Data
public class IcSocietyOrgExcel extends ExcelVerifyInfo implements Serializable {
@Excel(name = "组织名称")
@Excel(name = "所属组织")
@NotBlank(message = "不能为空")
private String agencyName;
@Excel(name = "社会组织名称")
@Excel(name = "组织名称")
@NotBlank(message = "不能为空")
@Length(max=50,message = "不能超过50个字")
private String societyName;
@Excel(name = "服务事项")
@Excel(name = "服务内容")
@NotBlank(message = "不能为空")
@Length(max=1000,message = "不能超过1000个字")
private String serviceMatters;
@Excel(name = "负责人")
@NotBlank(message = "不能为空")
@Length(max=20,message = "不能超过20个字")
private String personInCharge;
@Excel(name = "负责人电话")
@Excel(name = "服务电话")
@NotBlank(message = "不能为空")
@Length(max=11,message = "不能超过11个字")
private String mobile;
@Excel(name = "起始服务时间")
@Excel(name = "服务时间")
@NotBlank(message = "不能为空")
private String serviceStartTime;
@Excel(name = "终止服务时间")
@NotBlank(message = "不能为空")
private String serviceEndTime;
private String serviceTimeStr;
@Excel(name = "管理员姓名")
private String adminStaffName;
@ -72,10 +63,4 @@ public class IcSocietyOrgExcel extends ExcelVerifyInfo implements Serializable {
@Excel(name = "地址")
private String address;
@Excel(name = "经度")
private String longitude;
@Excel(name = "维度")
private String latitude;
}

42
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/IcSocietyOrgExportExcel.java

@ -0,0 +1,42 @@
package com.epmet.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import lombok.Data;
/**
* @Description
* @Author yzm
* @Date 2022/8/24 8:41
*/
@Data
public class IcSocietyOrgExportExcel {
@ExcelProperty(value = "所属组织")
@ColumnWidth(30)
private String agencyName;
@ExcelProperty(value = "组织名称")
@ColumnWidth(30)
private String societyName;
@ColumnWidth(50)
@ExcelProperty(value = "服务内容")
private String serviceMatters;
@ColumnWidth(20)
@ExcelProperty(value = "服务电话")
private String mobile;
@ColumnWidth(20)
@ExcelProperty(value = "服务时间")
private String serviceTimeStr;
@ColumnWidth(20)
@ExcelProperty(value = "管理员姓名")
private String adminStaffName;
/*@ColumnWidth(30)
@ExcelProperty(value = "地址")
private String address;*/
}

74
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/IcSocietyOrgImportExcelDTO.java

@ -0,0 +1,74 @@
package com.epmet.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
/**
* @Description
* @Author yzm
* @Date 2022/8/24 10:46
*/
@Data
public class IcSocietyOrgImportExcelDTO {
@ExcelProperty(value = "组织名称")
@NotBlank(message = "组织名称不能为空")
@Length(max=50,message = "组织名称不能超过50个字")
private String societyName;
@ExcelProperty(value = "服务内容")
@NotBlank(message = "服务内容不能为空")
@Length(max=1000,message = "服务内容不能超过1000个字")
private String serviceMatters;
@ExcelProperty(value = "服务电话")
@NotBlank(message = "服务电话不能为空")
private String mobile;
@ExcelProperty(value = "服务时间")
@NotBlank(message = "服务时间不能为空")
private String serviceTimeStr;
@ExcelProperty(value = "管理员姓名")
private String adminStaffName;
@ExcelProperty(value = "地址")
private String address;
@Data
public static class ErrorRow {
@ColumnWidth(40)
@ExcelProperty(value = "组织名称")
private String societyName;
@ColumnWidth(50)
@ExcelProperty(value = "服务内容")
private String serviceMatters;
@ColumnWidth(20)
@ExcelProperty(value = "服务电话")
private String mobile;
@ColumnWidth(25)
@ExcelProperty(value = "服务时间")
private String serviceTimeStr;
@ColumnWidth(20)
@ExcelProperty(value = "管理员姓名")
private String adminStaffName;
@ColumnWidth(50)
@ExcelProperty(value = "地址")
private String address;
@ColumnWidth(60)
@ExcelProperty("错误信息")
private String errorInfo;
}
}

157
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/handler/IcSocietyOrgExcelImportListener.java

@ -0,0 +1,157 @@
package com.epmet.excel.handler;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.read.listener.ReadListener;
import com.epmet.commons.tools.constant.NumConstant;
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.ExceptionUtils;
import com.epmet.commons.tools.exception.ValidateException;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.ObjectUtil;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.entity.IcSocietyOrgEntity;
import com.epmet.excel.IcSocietyOrgImportExcelDTO;
import com.epmet.service.impl.IcSocietyOrgServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description
* @Author yzm
* @Date 2022/8/24 11:42
*/
@Slf4j
public class IcSocietyOrgExcelImportListener implements ReadListener<IcSocietyOrgImportExcelDTO> {
// 最大条数阈值
public static final int MAX_THRESHOLD = 2;
private String currentCustomerId;
/**
* 当前操作用户
*/
private CustomerStaffInfoCacheResult staffInfo;
private IcSocietyOrgServiceImpl icSocietyOrgService;
private List<IcSocietyOrgImportExcelDTO.ErrorRow> errorRows = new ArrayList<>();
/**
* 要插入的数据
*/
private List<IcSocietyOrgEntity> insertDatas = new ArrayList<>();
/**
* 根据组织名称更新的数据
*/
private List<IcSocietyOrgEntity> updateDatas = new ArrayList<>();
private Map<String,String> staffMap=new HashMap<>();
public IcSocietyOrgExcelImportListener(String customerId, CustomerStaffInfoCacheResult staffInfo, IcSocietyOrgServiceImpl icSocietyOrgService, Map<String,String> staffMap) {
this.currentCustomerId = customerId;
this.staffInfo = staffInfo;
this.icSocietyOrgService = icSocietyOrgService;
this.staffMap=staffMap;
}
@Override
public void invoke(IcSocietyOrgImportExcelDTO data, AnalysisContext analysisContext) {
try {
// log.warn("有数据吗?"+JSON.toJSONString(data));
// 不能为空先校验数据
ValidatorUtils.validateEntity(data);
// 去除空格
ObjectUtil.objectToTrim(data);
IcSocietyOrgEntity icSocietyOrgEntity = ConvertUtils.sourceToTarget(data, IcSocietyOrgEntity.class);
icSocietyOrgEntity.setCustomerId(currentCustomerId);
icSocietyOrgEntity.setAgencyId(staffInfo.getAgencyId());
icSocietyOrgEntity.setPids(staffInfo.getAgencyPIds());
if(StringUtils.isNotBlank(data.getAdminStaffName())){
String adminStaffId = null;
for(String key:staffMap.keySet()){
if (data.getAdminStaffName().equals(staffMap.get(key))) {
adminStaffId=key;
break;
}
}
if (StringUtils.isBlank(adminStaffId)) {
String msg = String.format("当前组织下没有【%s】", data.getAdminStaffName());
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), msg, msg);
}
icSocietyOrgEntity.setAdminStaffId(adminStaffId);
}
//网格id+场所名称
List<IcSocietyOrgEntity> originList = icSocietyOrgService.selectForUniqueName(icSocietyOrgEntity.getAgencyId(), icSocietyOrgEntity.getSocietyName(), null);
if(CollectionUtils.isEmpty(originList)){
insertDatas.add(icSocietyOrgEntity);
}else{
IcSocietyOrgEntity origin=originList.get(NumConstant.ZERO);
icSocietyOrgEntity.setId(origin.getId());
updateDatas.add(icSocietyOrgEntity);
}
if (insertDatas.size() == MAX_THRESHOLD) {
execPersist();
}
if (updateDatas.size() == MAX_THRESHOLD) {
execPersist();
}
} catch (Exception e) {
String errorMsg = null;
if (e instanceof ValidateException) {
errorMsg = ((ValidateException) e).getMsg();
}else if(e instanceof EpmetException){
errorMsg = ((EpmetException) e).getMsg();
}else {
errorMsg = "未知错误";
log.error("【社会组织导入】出错:{}", ExceptionUtils.getErrorStackTrace(e));
}
IcSocietyOrgImportExcelDTO.ErrorRow errorRow = new IcSocietyOrgImportExcelDTO.ErrorRow();
errorRow.setSocietyName(data.getSocietyName());
errorRow.setServiceMatters(data.getServiceMatters());
errorRow.setMobile(data.getMobile());
errorRow.setServiceTimeStr(data.getServiceTimeStr());
errorRow.setAdminStaffName(data.getAdminStaffName());
errorRow.setAddress(data.getAddress());
errorRow.setErrorInfo(errorMsg);
errorRows.add(errorRow);
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext analysisContext) {
log.info("☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆");
// 最后几条达不到阈值,这里必须再调用一次
execPersist();
}
/**
* 执行持久化
*/
private void execPersist() {
try {
if (CollectionUtils.isNotEmpty(insertDatas)) {
icSocietyOrgService.insertBatch(insertDatas);
}
if (CollectionUtils.isNotEmpty(updateDatas)) {
icSocietyOrgService.updateBatchById(updateDatas);
}
} finally {
insertDatas.clear();
updateDatas.clear();
}
}
/**
* 获取错误行
*
* @return
*/
public List<IcSocietyOrgImportExcelDTO.ErrorRow> getErrorRows() {
return errorRows;
}
}

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

@ -28,6 +28,7 @@ import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.entity.IcSocietyOrgEntity;
import com.epmet.excel.IcSocietyOrgExcel;
import java.nio.file.Path;
import java.text.ParseException;
import java.util.List;
@ -79,4 +80,13 @@ public interface IcSocietyOrgService extends BaseService<IcSocietyOrgEntity> {
List<IcSocietyOrgEntity> queryListById(List<String> socialOrgIds);
IcSocietyOrgDTO get(String id);
/**
* 导入社会组织之前的废弃了
* @param fileSavePath
* @param taskId
* @param customerId
* @param userId
*/
void execAsyncExcelImport(Path fileSavePath, String taskId, String customerId, String userId);
}

244
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcSocietyOrgServiceImpl.java

@ -17,42 +17,58 @@
package com.epmet.service.impl;
import com.alibaba.excel.EasyExcel;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
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.ExceptionUtils;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.FileUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.UserDemandConstant;
import com.epmet.constants.ImportTaskConstants;
import com.epmet.dao.IcSocietyOrgDao;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.IcSocietyOrgDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.form.demand.ServiceQueryFormDTO;
import com.epmet.dto.result.GetListSocietyOrgResultDTO;
import com.epmet.dto.result.OrgInfoResultDTO;
import com.epmet.dto.result.SocietyOrgListResultDTO;
import com.epmet.dto.result.StaffSinGridResultDTO;
import com.epmet.dto.result.*;
import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.entity.IcSocietyOrgEntity;
import com.epmet.excel.IcSocietyOrgExcel;
import com.epmet.excel.IcSocietyOrgImportExcelDTO;
import com.epmet.excel.handler.IcSocietyOrgExcelImportListener;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.feign.OssFeignClient;
import com.epmet.service.IcSocietyOrgService;
import com.epmet.service.IcUserDemandRecService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.entity.ContentType;
import org.slf4j.Logger;
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 org.springframework.web.multipart.commons.CommonsMultipartFile;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@ -71,6 +87,10 @@ public class IcSocietyOrgServiceImpl extends BaseServiceImpl<IcSocietyOrgDao, Ic
private IcUserDemandRecService icUserDemandRecService;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired
private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient;
@Autowired
private OssFeignClient ossFeignClient;
/**
* @Author sun
@ -80,6 +100,10 @@ public class IcSocietyOrgServiceImpl extends BaseServiceImpl<IcSocietyOrgDao, Ic
@Transactional(rollbackFor = Exception.class)
public void add(AddSocietyOrgFormDTO dto) {
IcSocietyOrgEntity entity = ConvertUtils.sourceToTarget(dto, IcSocietyOrgEntity.class);
//图片必填
if(dto.getImageList() != null&& StringUtils.isNotBlank(dto.getImageList()[0])){
entity.setImgUrl(dto.getImageList()[0]);
}
CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(dto.getCustomerId(), dto.getStaffId());
entity.setAgencyId(staffInfoCache.getAgencyId());
entity.setPids(staffInfoCache.getAgencyPIds());
@ -97,6 +121,10 @@ public class IcSocietyOrgServiceImpl extends BaseServiceImpl<IcSocietyOrgDao, Ic
throw new RenException(String.format("修改社会组织信息失败,社会组织信息不存在,组织Id->%s", formDTO.getSocietyId()));
}
entity = ConvertUtils.sourceToTarget(formDTO, IcSocietyOrgEntity.class);
//图片必填
if(formDTO.getImageList() != null && StringUtils.isNotBlank(formDTO.getImageList()[0])){
entity.setImgUrl(formDTO.getImageList()[0]);
}
entity.setId(formDTO.getSocietyId());
baseDao.updateById(entity);
}
@ -115,14 +143,17 @@ public class IcSocietyOrgServiceImpl extends BaseServiceImpl<IcSocietyOrgDao, Ic
/**
* @Author sun
* @Description 社会组织列表查询
**/
*
* @return*/
@Override
public GetListSocietyOrgResultDTO getList(GetListSocietyOrgFormDTO formDTO) {
GetListSocietyOrgResultDTO resultDTO = new GetListSocietyOrgResultDTO();
CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId());
//2022.1.7 应产品要求 当前组织只能看到自己组织添加的社会组织数据,不允许看其他下级的
//formDTO.setPids(staffInfoCache.getAgencyPIds());
formDTO.setAgencyId(staffInfoCache.getAgencyId());
if(StringUtils.isBlank(formDTO.getAgencyId())){
formDTO.setAgencyId(staffInfoCache.getAgencyId());
}
//1.根据查询条件分页查询社会组织数据
PageInfo<SocietyOrgListResultDTO> result =
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()).doSelectPageInfo(() -> baseDao.getList(formDTO));
@ -134,14 +165,16 @@ public class IcSocietyOrgServiceImpl extends BaseServiceImpl<IcSocietyOrgDao, Ic
Map<String, Integer> pointMap = icUserDemandRecService.getServicePoint(formDTO.getCustomerId(), UserDemandConstant.SOCIAL_ORG);
//2.查询被绑定管理员信息
UserIdsFormDTO dto = new UserIdsFormDTO();
List<String> staffIdList = result.getList().stream().map(SocietyOrgListResultDTO::getAdminStaffId).collect(Collectors.toList());
staffIdList = staffIdList.stream().distinct().collect(Collectors.toList());
dto.setUserIds(staffIdList);
Result<List<StaffSinGridResultDTO>> listResult = epmetUserOpenFeignClient.getStaffInfoList(dto);
if (!listResult.success()) {
throw new RenException("获取工作人员基本信息失败......");
List<String> staffIdList = result.getList().stream().filter(u->StringUtils.isNotBlank(u.getAdminStaffId())).map(SocietyOrgListResultDTO::getAdminStaffId).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(staffIdList)){
staffIdList = staffIdList.stream().distinct().collect(Collectors.toList());
dto.setUserIds(staffIdList);
Result<List<StaffSinGridResultDTO>> listResult = epmetUserOpenFeignClient.getStaffInfoList(dto);
if (!listResult.success()) {
throw new RenException("获取工作人员基本信息失败......");
}
result.getList().stream().filter(f->StringUtils.isNotBlank(f.getAdminStaffId())).forEach(r -> listResult.getData().stream().filter(u -> r.getAdminStaffId().equals(u.getStaffId())).forEach(u -> r.setAdminStaffName(u.getStaffName())));
}
result.getList().forEach(r -> listResult.getData().stream().filter(u -> r.getAdminStaffId().equals(u.getStaffId())).forEach(u -> r.setAdminStaffName(u.getStaffName())));
//3.查询被绑定管理员信息
OrgInfoFormDTO org = new OrgInfoFormDTO();
@ -221,53 +254,59 @@ public class IcSocietyOrgServiceImpl extends BaseServiceImpl<IcSocietyOrgDao, Ic
if (CollectionUtils.isEmpty(list)) {
return numList;
}
Map<String, String> map=new HashMap<>();
//2.查询绑定的管理员信息
Set<String> staffNames = list.stream().map(item -> item.getAdminStaffName().trim()).collect(Collectors.toSet());
GetByRealNamesFormDTO dto = new GetByRealNamesFormDTO();
dto.setCustomerId(customerId);
dto.setRealNames(staffNames);
Result<List<CustomerStaffDTO>> staffResult = epmetUserOpenFeignClient.getByRealNames(dto);
if (!staffResult.success()) {
throw new RenException("获取工作人员基础信息失败......");
}
if (null == staffResult.getData()) {
Iterator<IcSocietyOrgExcel> iter = list.iterator();
while (iter.hasNext()) {
IcSocietyOrgExcel obj = iter.next();
numList.add(obj.getRowNum());
iterator.remove();
Set<String> staffNames = list.stream().filter(t -> StringUtils.isNotBlank(t.getAdminStaffName())).map(item -> item.getAdminStaffName().trim()).collect(Collectors.toSet());
if(!CollectionUtils.isEmpty(staffNames)){
GetByRealNamesFormDTO dto = new GetByRealNamesFormDTO();
dto.setCustomerId(customerId);
dto.setRealNames(staffNames);
Result<List<CustomerStaffDTO>> staffResult = epmetUserOpenFeignClient.getByRealNames(dto);
if (!staffResult.success()) {
throw new RenException("获取工作人员基础信息失败......");
}
return numList;
if (null == staffResult.getData()) {
Iterator<IcSocietyOrgExcel> iter = list.iterator();
while (iter.hasNext()) {
IcSocietyOrgExcel obj = iter.next();
numList.add(obj.getRowNum());
iterator.remove();
}
return numList;
}
map= staffResult.getData().stream().collect(Collectors.toMap(CustomerStaffDTO::getRealName, CustomerStaffDTO::getUserId));
}
Map<String, String> map = staffResult.getData().stream().collect(Collectors.toMap(CustomerStaffDTO::getRealName, CustomerStaffDTO::getUserId));
//3.遍历封装有效数据
List<IcSocietyOrgEntity> houseEntityList = new ArrayList<>();
Iterator<IcSocietyOrgExcel> iterator1 = list.iterator();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
while (iterator1.hasNext()) {
IcSocietyOrgExcel icHouseExcel = iterator1.next();
IcSocietyOrgExcel icSocietyOrgExcel = iterator1.next();
IcSocietyOrgEntity entity = new IcSocietyOrgEntity();
entity.setCustomerId(customerId);
entity.setAgencyId(staffInfoCache.getAgencyId());
entity.setPids(staffInfoCache.getAgencyPIds());
entity.setSocietyName(icHouseExcel.getSocietyName());
entity.setServiceMatters(icHouseExcel.getServiceMatters());
entity.setPersonInCharge(icHouseExcel.getPersonInCharge());
entity.setMobile(icHouseExcel.getMobile());
entity.setServiceStartTime(sdf.parse(icHouseExcel.getServiceStartTime()));
entity.setServiceEndTime(sdf.parse(icHouseExcel.getServiceEndTime()));
entity.setAdminStaffId(map.containsKey(icHouseExcel.getAdminStaffName().trim()) ? map.get(icHouseExcel.getAdminStaffName().trim()) : "");
if ("".equals(entity.getAdminStaffId())) {
numList.add(icHouseExcel.getRowNum());
log.warn(String.format("绑定的管理员不存在,管理员名称->%s,行号->%s", icHouseExcel.getAdminStaffName(), icHouseExcel.getRowNum()));
entity.setSocietyName(icSocietyOrgExcel.getSocietyName());
entity.setServiceMatters(icSocietyOrgExcel.getServiceMatters());
//负责人去掉
// entity.setPersonInCharge(icSocietyOrgExcel.getPersonInCharge());
entity.setMobile(icSocietyOrgExcel.getMobile());
//服务时间手动输入
entity.setServiceTimeStr(icSocietyOrgExcel.getServiceTimeStr());
// entity.setServiceStartTime(sdf.parse(icHouseExcel.getServiceStartTime()));
// entity.setServiceEndTime(sdf.parse(icHouseExcel.getServiceEndTime()));
entity.setAdminStaffId(MapUtils.isNotEmpty(map)&&map.containsKey(icSocietyOrgExcel.getAdminStaffName().trim()) ? map.get(icSocietyOrgExcel.getAdminStaffName().trim()) : "");
if (StringUtils.isBlank(entity.getAdminStaffId())) {
numList.add(icSocietyOrgExcel.getRowNum());
log.warn(String.format("绑定的管理员不存在,管理员名称->%s,行号->%s", icSocietyOrgExcel.getAdminStaffName(), icSocietyOrgExcel.getRowNum()));
iterator1.remove();
continue;
}
entity.setAddress(icHouseExcel.getAddress());
entity.setLongitude(icHouseExcel.getLongitude());
entity.setLatitude(icHouseExcel.getLatitude());
entity.setAddress(icSocietyOrgExcel.getAddress());
//经纬度不能导入
// entity.setLongitude(icHouseExcel.getLongitude());
// entity.setLatitude(icHouseExcel.getLatitude());
houseEntityList.add(entity);
}
@ -291,4 +330,115 @@ public class IcSocietyOrgServiceImpl extends BaseServiceImpl<IcSocietyOrgDao, Ic
return ConvertUtils.sourceToTarget(entity,IcSocietyOrgDTO.class);
}
}
/**
* 导入社会组织之前的废弃了
*
* @param filePath
* @param importTaskId
* @param customerId
* @param userId
*/
@Override
public void execAsyncExcelImport(Path filePath, String importTaskId,String customerId,String userId) {
try {
//获取当前登录用户所属组织id
CustomerStaffInfoCacheResult staffInfo= queryCurrentStaff(customerId,userId);
//当前组织下的人
AgencyIdFormDTO agencyIdFormDTO=new AgencyIdFormDTO();
agencyIdFormDTO.setAgencyId(staffInfo.getAgencyId());
Result<List<String>> staffIdsRes=govOrgOpenFeignClient.getAgencyStaffs(agencyIdFormDTO);
if (!staffIdsRes.success() || CollectionUtils.isEmpty(staffIdsRes.getData())) {
String msg = "查询当前组织下工作人员列表异常";
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), msg, msg);
}
Result<CustomerStaffListResultDTO> currentAgencyStaffs=epmetUserOpenFeignClient.getCustomerStaffList(staffIdsRes.getData());
if (!currentAgencyStaffs.success() || null == currentAgencyStaffs.getData() || CollectionUtils.isEmpty(currentAgencyStaffs.getData().getStaffList())) {
String msg = "查询当前组织下工作人员信息异常";
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), msg, msg);
}
List<StaffListResultDTO> staffList=currentAgencyStaffs.getData().getStaffList();
Map<String,String> staffMap=staffList.stream().collect(Collectors.toMap(StaffListResultDTO::getStaffId, StaffListResultDTO::getStaffName));
IcSocietyOrgExcelImportListener listener = new IcSocietyOrgExcelImportListener(customerId,staffInfo, this,staffMap);
EasyExcel.read(filePath.toFile(), IcSocietyOrgImportExcelDTO.class, listener).headRowNumber(1).sheet(0).doRead();
Path errorDescFile = null;
String errorDesFileUrl = null;
List<IcSocietyOrgImportExcelDTO.ErrorRow> errorRows = listener.getErrorRows();
boolean failed = errorRows.size() > 0;
if (failed) {
// 生成并上传错误文件
try {
// 文件生成
Path errorDescDir = FileUtils.getAndCreateDirUnderEpmetFilesDir("ic_enterprise", "import", "error_des");
String fileName = UUID.randomUUID().toString().concat(".xlsx");
errorDescFile = errorDescDir.resolve(fileName);
FileItemFactory factory = new DiskFileItemFactory(16, errorDescDir.toFile());
FileItem fileItem = factory.createItem("file", ContentType.APPLICATION_OCTET_STREAM.toString(), true, fileName);
OutputStream os = fileItem.getOutputStream();
EasyExcel.write(os, IcSocietyOrgImportExcelDTO.ErrorRow.class).sheet("导入失败列表").doWrite(errorRows);
// 文件上传oss
Result<UploadImgResultDTO> errorDesFileUploadResult = ossFeignClient.uploadImportTaskDescFile(new CommonsMultipartFile(fileItem));
if (errorDesFileUploadResult.success()) {
errorDesFileUrl = errorDesFileUploadResult.getData().getUrl();
}
} finally {
if (Files.exists(errorDescFile)) {
Files.delete(errorDescFile);
}
}
}
ImportTaskCommonFormDTO importFinishTaskForm = new ImportTaskCommonFormDTO();
importFinishTaskForm.setTaskId(importTaskId);
importFinishTaskForm.setProcessStatus(failed ? ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL : ImportTaskConstants.PROCESS_STATUS_FINISHED_SUCCESS);
importFinishTaskForm.setOperatorId(userId);
importFinishTaskForm.setResultDesc("");
importFinishTaskForm.setResultDescFilePath(errorDesFileUrl);
Result result = commonServiceOpenFeignClient.finishImportTask(importFinishTaskForm);
if (!result.success()) {
log.error("【社会组织】finishImportTask失败");
}
} catch (Exception e) {
String errorMsg = ExceptionUtils.getErrorStackTrace(e);
log.error("【社会组织】出错:{}", errorMsg);
ImportTaskCommonFormDTO importFinishTaskForm = new ImportTaskCommonFormDTO();
importFinishTaskForm.setTaskId(importTaskId);
importFinishTaskForm.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL);
importFinishTaskForm.setOperatorId(userId);
importFinishTaskForm.setResultDesc("导入失败");
Result result = commonServiceOpenFeignClient.finishImportTask(importFinishTaskForm);
if (!result.success()) {
log.error("【社会组织】导入记录状态修改为'完成'失败");
}
} finally {
// 删除临时文件
if (Files.exists(filePath)) {
try {
Files.delete(filePath);
} catch (IOException e) {
log.error("method exception", e);
}
}
}
}
private CustomerStaffInfoCacheResult queryCurrentStaff(String customerId, String userId) {
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, userId);
if (null == staffInfo) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询工作人员缓存信息异常", EpmetErrorCode.SERVER_ERROR.getMsg());
}
return staffInfo;
}
public List<IcSocietyOrgEntity> selectForUniqueName(String agencyId, String societyName, String id) {
return baseDao.selectListForUniqueName(agencyId,societyName,id);
}
}

13
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcSocietyOrgDao.xml

@ -7,10 +7,12 @@
SELECT
agency_id agencyId,
id societyId,
img_url,
society_name societyName,
service_matters serviceMatters,
person_in_charge personInCharge,
mobile mobile,
service_time_str,
service_start_time serviceStartTime,
service_end_time serviceEndTime,
admin_staff_id adminStaffId,
@ -90,4 +92,13 @@
AND agency_id = #{agencyId}
</select>
</mapper>
<select id="selectListForUniqueName" parameterType="map" resultType="com.epmet.entity.IcSocietyOrgEntity">
select o.* from ic_society_org o
where o.del_flag='0'
and o.agency_id = #{agencyId}
and o.society_name =#{societyName}
<if test="null != id and id != '' ">
and o.id != #{id}
</if>
</select>
</mapper>

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

Binary file not shown.

2
epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/form/SaveOrUpdateParyMemberFormDTO.java

@ -31,7 +31,7 @@ public class SaveOrUpdateParyMemberFormDTO implements Serializable {
@NotBlank(message = "姓名不能为空", groups = {AddUserShowGroup.class})
private String name;
@NotBlank(message = "身份证不能为空", groups = {AddUserShowGroup.class})
@NotBlank(message = "证件号不能为空", groups = {AddUserShowGroup.class})
private String idCard;
@NotBlank(message = "手机号不能为空", groups = {AddUserShowGroup.class})

10
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcNeighborHoodDTO.java

@ -69,6 +69,11 @@ public class IcNeighborHoodDTO implements Serializable {
*/
private String gridId;
/**
* 网格
*/
private String gridName;
/**
* 详细地址
*/
@ -144,4 +149,9 @@ public class IcNeighborHoodDTO implements Serializable {
*/
private Integer realBuilding;
/**
* 楼栋名
*/
private String buildingName;
}

31
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CheckHouseInfoFormDTO.java

@ -0,0 +1,31 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @Description 根据小区楼宇单元名称校验是否存在
* @Author wgf
* @Date 2022/8/24 9:03
*/
@Data
public class CheckHouseInfoFormDTO implements Serializable {
private static final long serialVersionUID = 2636608477324780974L;
private String customerId;
private String gridId;
private String gridName;
private String villageId;
private String buildId;
private String unitId;
private String homeId;
private String villageName;
private String buildName;
private String unitName;
private String homeName;
}

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

@ -11,13 +11,21 @@ import java.io.Serializable;
*/
@Data
public class BuildingResultDTO implements Serializable {
private static final long serialVersionUID = -2129418426919785999L;
private String buildingId;
private String buildingName;
private String gridId;
private String gridName;
private String neighborhoodId;
private String neighborhoodName;
private String buildingName;
private String label;
}

38
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CheckHomeInfoResultInfo.java

@ -0,0 +1,38 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* 房屋信息
*
* @author wgf
* @date 2022/8/23 20:58
*/
@Data
public class CheckHomeInfoResultInfo implements Serializable {
private static final long serialVersionUID = -2797565581047800011L;
// 0:校验成功;1:校验失败;
private String code;
// 提示信息
private String msg;
// 是否新增房屋:0:否;1:是
private String isAdd;
private String gridId;
private String gridName;
private String villageId;
private String villageName;
private String buildId;
private String buildName;
private String unitId;
private String unitName;
private String homeId;
private String homeName;
}

41
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridInfoByNameResultDTO.java

@ -0,0 +1,41 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description 网格所属组织基本信息
* @Author wgf
* @Date 2020/4/26 22:35
*/
@Data
public class GridInfoByNameResultDTO implements Serializable {
private static final long serialVersionUID = 4360690752084258055L;
/**
* 客户ID
*/
private String customerId;
/**
* 网格组织ID
*/
private String deptId;
/**
* 网格名称
*/
private String deptName;
/**
* 网格的上级组织
*/
private String pid;
/**
* 网格的所有上级组织
*/
private String pids;
}

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

@ -475,6 +475,18 @@ public class CustomerAgencyController {
return customerAgencyService.getCommunityInfo(formDTO);
}
/**
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.CommunityInfoResultDTO>
* @Author wgf
* @Description 根据网格名称查询所属组织信息
* @Date 2022/6/21 22:41
**/
@PostMapping("getGridInfoByGridName")
public Result<GridInfoByNameResultDTO> getGridInfoByGridName(@RequestBody GridInfoVaccinePrarmeterFormDTO formDTO) {
return customerAgencyService.getGridInfoByGridName(formDTO);
}
/**
* @param userId
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.CommunityInfoResultDTO>

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

@ -18,11 +18,16 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.dto.form.PageFormDTO;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
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.IcHouseDTO;
import com.epmet.dto.IcVaccinePrarmeterDTO;
import com.epmet.dto.form.CheckHouseInfoFormDTO;
import com.epmet.dto.form.HouseFormDTO;
import com.epmet.dto.form.VaccinePrarmeterListFormDTO;
import com.epmet.dto.result.HouseAgencyInfoResultDTO;
import com.epmet.dto.result.HouseInfoDTO;
import com.epmet.dto.result.HouseListResultDTO;
@ -136,4 +141,19 @@ public class IcHouseController {
public Result<List<HouseInfoDTO>> getOwnerHouseList(@RequestBody IcHouseDTO formDTO){
return new Result<List<HouseInfoDTO>>().ok(icHouseService.getOwnerHouseList(formDTO));
}
/**
* Desc: 根据小区楼宇单元名称校验是否存在
* @param formDTO
* @param tokenDto
* @author wgf
* @date 2022/8/24 13:57
*/
@PostMapping("checkHomeInfo")
public Result checkHomeInfo(@RequestBody CheckHouseInfoFormDTO formDTO, @LoginUser TokenDto tokenDto){
ValidatorUtils.validateEntity(formDTO, PageFormDTO.AddUserInternalGroup.class);
formDTO.setCustomerId(tokenDto.getCustomerId());
return icHouseService.checkHomeInfo(formDTO);
}
}

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

@ -39,6 +39,7 @@ import com.epmet.dto.IcNeighborHoodDTO;
import com.epmet.dto.form.IcNeighborHoodAddFormDTO;
import com.epmet.dto.form.ImportInfoFormDTO;
import com.epmet.dto.form.ImportTaskCommonFormDTO;
import com.epmet.dto.result.BuildingResultDTO;
import com.epmet.dto.result.ImportTaskCommonResultDTO;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.service.IcNeighborHoodService;
@ -150,6 +151,20 @@ public class IcNeighborHoodController {
return new Result<List<OptionResultDTO>>().ok(icNeighborHoodService.getNeighborHoodOptions(dto.getAgencyId(), dto.getGridId(),tokenDto.getUserId(),tokenDto.getCustomerId()));
}
/**
* 获取用户组织下小区列表
*
* @param tokenDto
* @param dto
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.BuildingResultDTO>>
* @author zhy
* @date 2022/8/19 15:56
*/
@PostMapping("neighborhoodlist")
public Result<List<BuildingResultDTO>> getNeighborhoodList(@LoginUser TokenDto tokenDto, @RequestBody IcNeighborHoodDTO dto) {
return new Result<List<BuildingResultDTO>>().ok(icNeighborHoodService.getNeighborhoodList(tokenDto, dto));
}
/**
* @Description 小区信息导入
* @param tokenDTO

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

@ -19,6 +19,7 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.form.GridInfoVaccinePrarmeterFormDTO;
import com.epmet.dto.form.OrgInfoPointFormDTO;
import com.epmet.dto.form.OrgTreeByUserAndTypeFormDTO;
import com.epmet.dto.result.*;
@ -352,6 +353,8 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
CommunityInfoResultDTO getCommunityInfo(OrgInfoPointFormDTO formDTO);
GridInfoByNameResultDTO getGridInfoByGridName(GridInfoVaccinePrarmeterFormDTO formDTO);
CommunityInfoResultDTO getCommunityInfoByUserId(@Param("userId") String userId);
/**

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

@ -19,7 +19,9 @@ package com.epmet.dao;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.IcNeighborHoodDTO;
import com.epmet.dto.ImportGeneralDTO;
import com.epmet.dto.form.CheckHouseInfoFormDTO;
import com.epmet.dto.form.IcBuildingListFormDTO;
import com.epmet.dto.result.*;
import com.epmet.entity.CustomerAgencyEntity;
@ -224,4 +226,22 @@ public interface IcBuildingDao extends BaseDao<IcBuildingEntity> {
IcBuildingEntity selectByCoding(@Param("coding") String coding,
@Param("id") String id);
/**
* 展示所有楼栋和小区信息
*
* @param dto
* @return java.util.List<com.epmet.dto.result.BuildingResultDTO>
* @author zhy
* @date 2022/8/19 17:32
*/
List<BuildingResultDTO> listBuildingInfo(IcNeighborHoodDTO dto);
/**
* 根据楼宇名称查询楼宇信息
* @param formDTO
* @return
*/
IcBuildingEntity getBuildingInfoByName(CheckHouseInfoFormDTO formDTO);
}

8
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingUnitDao.java

@ -18,6 +18,7 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.CheckHouseInfoFormDTO;
import com.epmet.dto.result.HouseInfoResultDTO;
import com.epmet.dto.result.OrganizationCommunityDTO;
import com.epmet.entity.IcBuildingUnitEntity;
@ -78,4 +79,11 @@ public interface IcBuildingUnitDao extends BaseDao<IcBuildingUnitEntity> {
* @return com.epmet.dto.result.OrganizationCommunityDTO
*/
OrganizationCommunityDTO selectCommunityByUnitId(@Param("unitId") String unitId);
/**
* 根据单元名称查询单元信息
* @param formDTO
* @return
*/
IcBuildingUnitEntity getbuildingUnitInfoByName(CheckHouseInfoFormDTO formDTO);
}

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

@ -2,6 +2,7 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.ImportGeneralDTO;
import com.epmet.dto.form.CheckHouseInfoFormDTO;
import com.epmet.dto.form.GetHouseInfoToCollectFormDTO;
import com.epmet.dto.form.IcHouseListFormDTO;
import com.epmet.dto.result.*;
@ -201,4 +202,11 @@ public interface IcHouseDao extends BaseDao<IcHouseEntity> {
*/
IcHouseInfoCollectResultDTO getHouseInfoToCollect(GetHouseInfoToCollectFormDTO formDTO);
/**
* 校验房屋
* @param formDTO
* @return
*/
IcHouseEntity getHouseInfoByName(CheckHouseInfoFormDTO formDTO);
}

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

@ -21,6 +21,7 @@ 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.CheckHouseInfoFormDTO;
import com.epmet.dto.form.HouseInformationFormDTO;
import com.epmet.dto.form.IcNeighborHoodListFormDTO;
import com.epmet.dto.result.*;
@ -211,4 +212,12 @@ public interface IcNeighborHoodDao extends BaseDao<IcNeighborHoodEntity> {
* @Date 2022/6/29 16:48
*/
List<HomeListResultDTO> getHouseList(HouseInformationFormDTO formDTO);
/**
* 根据名称查小区信息
* @param formDTO
* @return
*/
IcNeighborHoodEntity getNeighborHoodInfoByName(CheckHouseInfoFormDTO formDTO);
}

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

@ -327,6 +327,15 @@ public interface CustomerAgencyService extends BaseService<CustomerAgencyEntity>
**/
Result<CommunityInfoResultDTO> getCommunityInfo(OrgInfoPointFormDTO formDTO);
/**
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.CommunityInfoResultDTO>
* @Author wgf
* @Description 根据网格名称查询所属组织信息
* @Date 2022/6/21 22:41
**/
Result<GridInfoByNameResultDTO> getGridInfoByGridName(GridInfoVaccinePrarmeterFormDTO formDTO);
/**
* @param userId
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.CommunityInfoResultDTO>

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

@ -3,8 +3,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.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.IcHouseDTO;
import com.epmet.dto.ImportGeneralDTO;
import com.epmet.dto.form.CheckHouseInfoFormDTO;
import com.epmet.dto.form.HouseFormDTO;
import com.epmet.dto.result.HouseAgencyInfoResultDTO;
import com.epmet.dto.result.HouseInfoDTO;
@ -130,4 +132,11 @@ public interface IcHouseService extends BaseService<IcHouseEntity> {
* @Date 2022/7/19 17:41
*/
List<HouseInfoDTO> getOwnerHouseList(IcHouseDTO formDTO);
/**
* 根据小区楼宇单元名称校验是否存在
* @param formDTO
* @return
*/
Result checkHomeInfo(CheckHouseInfoFormDTO formDTO);
}

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

@ -20,16 +20,19 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.IcNeighborHoodDTO;
import com.epmet.dto.ImportGeneralDTO;
import com.epmet.dto.NeighborHoodAndManagementDTO;
import com.epmet.dto.form.IcNeighborHoodAddFormDTO;
import com.epmet.dto.form.ImportInfoFormDTO;
import com.epmet.dto.result.BuildingResultDTO;
import com.epmet.dto.result.ImportTaskCommonResultDTO;
import com.epmet.entity.IcNeighborHoodEntity;
import com.epmet.entity.IcNeighborHoodPropertyEntity;
import com.epmet.entity.IcPropertyManagementEntity;
import org.springframework.web.bind.annotation.RequestBody;
import java.io.IOException;
import java.io.InputStream;
@ -115,6 +118,17 @@ public interface IcNeighborHoodService extends BaseService<IcNeighborHoodEntity>
*/
List<OptionResultDTO> getNeighborHoodOptions(String agencyId, String gridId,String staffId,String customerId);
/**
* 获取用户组织下小区列表
*
* @param tokenDto
* @param dto
* @return java.util.List<com.epmet.dto.BuildingResultDTO>
* @author zhy
* @date 2022/8/19 15:57
*/
List<BuildingResultDTO> getNeighborhoodList(TokenDto tokenDto, IcNeighborHoodDTO dto);
/**
* @Description 通过ID查询小区信息
* @Param ids

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

@ -1580,6 +1580,13 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
return new Result<CommunityInfoResultDTO>().ok(communityInfoResultDTO);
}
@Override
public Result<GridInfoByNameResultDTO> getGridInfoByGridName(GridInfoVaccinePrarmeterFormDTO formDTO) {
GridInfoByNameResultDTO gridInfoByNameResultDTO = baseDao.getGridInfoByGridName(formDTO);
return new Result<GridInfoByNameResultDTO>().ok(gridInfoByNameResultDTO);
}
@Override
public Result<CommunityInfoResultDTO> getCommunityInfoByUserId(String userId) {
CommunityInfoResultDTO communityInfoResultDTO = baseDao.getCommunityInfoByUserId(userId);

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

@ -264,8 +264,10 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver {
houseChangeRecordCollect(formDTO.getId(), formDTO.getCustomerId(), icHouseDTO);
icHouseDao.updateById(entity);
IcHouseDTO houseDTO = icHouseService.get(formDTO.getId());
//删除房屋缓存
icHouseRedis.delHouseInfo(formDTO.getId(), entity.getCustomerId());
icHouseRedis.delHouseInfo(formDTO.getId(), houseDTO.getCustomerId());
}
/**

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

@ -20,12 +20,9 @@ import com.epmet.dto.IcHouseDTO;
import com.epmet.dto.IcResiCategoryStatsConfigDTO;
import com.epmet.dto.IcResiUserDTO;
import com.epmet.dto.ImportGeneralDTO;
import com.epmet.dto.form.CheckHouseInfoFormDTO;
import com.epmet.dto.form.HouseFormDTO;
import com.epmet.dto.result.HouseAgencyInfoResultDTO;
import com.epmet.dto.result.HomeInfoResultDTO;
import com.epmet.dto.result.HouseInfoDTO;
import com.epmet.dto.result.HouseListResultDTO;
import com.epmet.dto.result.HousesNameResultDTO;
import com.epmet.dto.result.*;
import com.epmet.entity.IcBuildingEntity;
import com.epmet.entity.IcBuildingUnitEntity;
import com.epmet.entity.IcHouseEntity;
@ -339,4 +336,56 @@ public class IcHouseServiceImpl extends BaseServiceImpl<IcHouseDao, IcHouseEntit
}
return list.stream().map(item -> icHouseRedis.getHouseInfo(item.getId(), item.getCustomerId())).collect(Collectors.toList());
}
@Override
public Result<CheckHomeInfoResultInfo> checkHomeInfo(CheckHouseInfoFormDTO formDTO) {
CheckHomeInfoResultInfo checkHomeInfoResultInfo = ConvertUtils.sourceToTarget(formDTO, CheckHomeInfoResultInfo.class);
// 校验小区
IcNeighborHoodEntity icNeighborHoodEntity = icNeighborHoodDao.getNeighborHoodInfoByName(formDTO);
if(icNeighborHoodEntity != null && StringUtils.isNotBlank(icNeighborHoodEntity.getId())){
formDTO.setVillageId(icNeighborHoodEntity.getId());
checkHomeInfoResultInfo.setVillageId(icNeighborHoodEntity.getId());
}else{
checkHomeInfoResultInfo.setCode("1");
checkHomeInfoResultInfo.setMsg("小区名称未匹配到数据");
return new Result<CheckHomeInfoResultInfo>().ok(checkHomeInfoResultInfo);
}
// 校验楼宇
IcBuildingEntity icBuildingEntity = icBuildingDao.getBuildingInfoByName(formDTO);
if(icBuildingEntity != null && StringUtils.isNotBlank(icBuildingEntity.getId())){
formDTO.setBuildId(icBuildingEntity.getId());
checkHomeInfoResultInfo.setBuildId(icBuildingEntity.getId());
}else{
checkHomeInfoResultInfo.setCode("1");
checkHomeInfoResultInfo.setMsg("楼宇名称未匹配到数据");
return new Result<CheckHomeInfoResultInfo>().ok(checkHomeInfoResultInfo);
}
// 校验单元
IcBuildingUnitEntity icBuildingUnitEntity = buildingUnitDao.getbuildingUnitInfoByName(formDTO);
if(icBuildingUnitEntity != null && StringUtils.isNotBlank(icBuildingUnitEntity.getId())){
formDTO.setUnitId(icBuildingUnitEntity.getId());
checkHomeInfoResultInfo.setUnitId(icBuildingUnitEntity.getId());
}else{
checkHomeInfoResultInfo.setCode("1");
checkHomeInfoResultInfo.setMsg("单元名称未匹配到数据");
return new Result<CheckHomeInfoResultInfo>().ok(checkHomeInfoResultInfo);
}
// 校验房屋
IcHouseEntity icHouseEntity = baseDao.getHouseInfoByName(formDTO);
checkHomeInfoResultInfo.setCode("0");
if(icHouseEntity != null && StringUtils.isNotBlank(icHouseEntity.getId())){
checkHomeInfoResultInfo.setHomeId(icHouseEntity.getId());
checkHomeInfoResultInfo.setMsg("该房屋为已存在房屋");
checkHomeInfoResultInfo.setIsAdd("0");
}else{
checkHomeInfoResultInfo.setMsg("该房屋暂不存在");
checkHomeInfoResultInfo.setIsAdd("1");
}
return new Result<CheckHomeInfoResultInfo>().ok(checkHomeInfoResultInfo);
}
}

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

@ -40,6 +40,7 @@ import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.CustomerGridConstant;
@ -49,6 +50,7 @@ import com.epmet.dto.*;
import com.epmet.dto.form.IcNeighborHoodAddFormDTO;
import com.epmet.dto.form.ImportInfoFormDTO;
import com.epmet.dto.form.ImportTaskCommonFormDTO;
import com.epmet.dto.result.BuildingResultDTO;
import com.epmet.dto.result.ImportTaskCommonResultDTO;
import com.epmet.dto.result.InfoByNamesResultDTO;
import com.epmet.dto.result.UploadImgResultDTO;
@ -210,6 +212,20 @@ public class IcNeighborHoodServiceImpl extends BaseServiceImpl<IcNeighborHoodDao
}).collect(Collectors.toList());
}
public List<BuildingResultDTO> getNeighborhoodList(TokenDto tokenDto, IcNeighborHoodDTO dto) {
dto.setCustomerId(tokenDto.getCustomerId());
if (StringUtils.isBlank(dto.getAgencyId()) && StringUtils.isEmpty(dto.getGridId())) {
log.info("agencyId与gridId都为空时,默认查询当前工作人员所属组织下的小区");
CustomerStaffInfoCacheResult result= CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId());
if (null == result || StringUtils.isBlank(result.getAgencyId())) {
log.error(String.format("staffId:%s,工作人员缓存信息查询异常"));
return Collections.emptyList();
}
dto.setAgencyId(result.getAgencyId());
}
return icBuildingDao.listBuildingInfo(dto);
}
/**
* @param ids
* @Description 通过ID查询小区信息

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

@ -916,6 +916,21 @@
limit 1
</select>
<select id="getGridInfoByGridName" resultType="com.epmet.dto.result.GridInfoByNameResultDTO" parameterType="com.epmet.dto.form.GridInfoVaccinePrarmeterFormDTO">
select
ID as deptId,
CUSTOMER_ID,
PID,
PIDS,
GRID_NAME as deptName
from customer_grid
where DEL_FLAG = '0'
and GRID_NAME = #{gridName}
and PID = #{agencyId}
and CUSTOMER_ID = #{customerId}
limit 1
</select>
<select id="getCommunityInfoByUserId" resultType="com.epmet.dto.result.CommunityInfoResultDTO">
select
ca.ID as deptId,

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

@ -450,4 +450,44 @@
</if>
</select>
<select id="listBuildingInfo" resultType="com.epmet.dto.result.BuildingResultDTO">
SELECT
CONCAT( n.NEIGHBOR_HOOD_NAME, b.BUILDING_NAME ) AS label,
b.id AS buildingId,
b.BUILDING_NAME AS buildingName,
n.id AS neighborhoodId,
n.NEIGHBOR_HOOD_NAME AS neighborhoodName,
n.GRID_ID,
g.GRID_NAME
FROM
ic_building b
LEFT JOIN ic_neighbor_hood n ON b.NEIGHBOR_HOOD_ID = n.id
LEFT JOIN customer_grid g ON n.GRID_ID = g.id
WHERE
n.DEL_FLAG = '0'
AND b.DEL_FLAG = '0'
AND g.DEL_FLAG = '0'
AND n.CUSTOMER_ID = #{customerId}
<if test="gridId != null and gridId != ''">
AND n.GRID_ID = #{gridId}
</if>
<if test="buildingName != null and buildingName != ''">
AND (n.NEIGHBOR_HOOD_NAME LIKE CONCAT('%', #{buildingName}, '%') OR b.BUILDING_NAME LIKE CONCAT('%', #{buildingName}, '%'))
</if>
AND (
n.AGENCY_ID = #{agencyId}
OR n.AGENCY_PIDS LIKE CONCAT('%', #{agencyId}, '%'))
</select>
<select id="getBuildingInfoByName" resultType="com.epmet.entity.IcBuildingEntity"
parameterType="com.epmet.dto.form.CheckHouseInfoFormDTO">
select *
from ic_building
where DEL_FLAG = '0'
and CUSTOMER_ID = #{customerId}
and NEIGHBOR_HOOD_ID = #{villageId}
and BUILDING_NAME = #{buildName}
</select>
</mapper>

11
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingUnitDao.xml

@ -59,5 +59,16 @@
and u.id=#{unitId}
</select>
<select id="getbuildingUnitInfoByName" resultType="com.epmet.entity.IcBuildingUnitEntity"
parameterType="com.epmet.dto.form.CheckHouseInfoFormDTO">
select *
from ic_building_unit
where DEL_FLAG = '0'
and CUSTOMER_ID = #{customerId}
and BUILDING_ID = #{buildId}
and UNIT_NAME = #{unitName}
</select>
</mapper>

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

@ -550,5 +550,14 @@
and DOOR_NAME = #{doorName}
</select>
<select id="getHouseInfoByName" resultType="com.epmet.entity.IcHouseEntity">
select *
from ic_house
where del_flag = '0'
and CUSTOMER_ID = #{customerId}
and BUILDING_UNIT_ID = #{unitId}
and DOOR_NAME = #{homeName}
</select>
</mapper>

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

@ -662,6 +662,15 @@
ORDER BY
SORT, DOOR_NAME+0
</select>
<select id="getNeighborHoodInfoByName" resultType="com.epmet.entity.IcNeighborHoodEntity"
parameterType="com.epmet.dto.form.CheckHouseInfoFormDTO">
select *
from ic_neighbor_hood
where DEL_FLAG = '0'
and CUSTOMER_ID = #{customerId}
and GRID_ID = #{gridId}
and NEIGHBOR_HOOD_NAME = #{villageName}
</select>
</mapper>

14
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java

@ -403,7 +403,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
}
if (null != resiGroup && ModuleConstant.GROUP_TYPE_BRANCH.equals(resiGroup.getGroupType())){
UserResiInfoResultDTO data = userResiInfo.getData();
userResiInfo.getData().setShowName(data.getStreet()+"-"+data.getSurname()+data.getName());
userResiInfo.getData().setShowName(data.getSurname()+data.getName());
}
return userResiInfo;
}
@ -931,8 +931,8 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
if("branch".equals(entity.getGroupType())){
//获取组长信息
if (groupLeaderUserInfo.success() && null != groupLeaderUserInfo.getData()) {
String street = groupLeaderUserInfo.getData().getStreet() == null ? "" : groupLeaderUserInfo.getData().getStreet() + "-";
resultDTO.setLeaderName(street + groupLeaderUserInfo.getData().getSurname() + groupLeaderUserInfo.getData().getName());
// String street = groupLeaderUserInfo.getData().getStreet() == null ? "" : groupLeaderUserInfo.getData().getStreet() + "-";
resultDTO.setLeaderName(groupLeaderUserInfo.getData().getSurname() + groupLeaderUserInfo.getData().getName());
} else {
logger.warn("组长注册信息查询失败,msg:{},groupId:{}", groupLeaderUserInfo.getMsg(), formDTO.getGroupId());
}
@ -1022,10 +1022,10 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
//detail.setGroupLeaderName(userInfoResult.getData().get(0).getShowName().split("-")[NumConstant.ONE]);
//姓氏+名称
detail.setGroupLeaderName(userInfoResult.getData().get(0).getSurname() + userInfoResult.getData().get(0).getName());
detail.setStreet(userInfoResult.getData().get(0).getStreet());
StringBuffer buffer = new StringBuffer(detail.getStreet());
buffer.append(StringUtils.isBlank(buffer) ? "" : "-");
detail.setGroupLeaderName(buffer.append(detail.getGroupLeaderName()).toString());
// detail.setStreet(userInfoResult.getData().get(0).getStreet());
// StringBuffer buffer = new StringBuffer(detail.getStreet());
// buffer.append(StringUtils.isBlank(buffer) ? "" : "-");
// detail.setGroupLeaderName(buffer.append(detail.getGroupLeaderName()).toString());
}else{
logger.warn(ModuleConstant.USER_INFO_LIST_NOT_FOUND);
}

12
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java

@ -1559,9 +1559,9 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
resultDTOList.forEach(re->{
if(topicInfo.getPublishedUser().equals(re.getUserId())){
//话题发起人
String street = re.getStreet() == null ? "" : re.getStreet() + "-";
// String street = re.getStreet() == null ? "" : re.getStreet() + "-";
String realName = re.getRealName() == null ? "" : re.getRealName();
topicInfo.setPublishedUser(street + realName);
topicInfo.setPublishedUser(realName);
}
});
} else {
@ -2754,7 +2754,7 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
ui.setReleaseUserHeadPhoto(u.getHeadImgUrl());
ui.setMobile(u.getMobile());
if (groupType.equals(ModuleConstant.GROUP_TYPE_BRANCH)){
ui.setReleaseUserName(u.getStreet() + "-" + u.getRealName());
ui.setReleaseUserName(u.getRealName());
}else {
if (StringUtils.isBlank(u.getGender())) {
//性别为空,默认为未知
@ -2775,9 +2775,9 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
if (StringUtils.isNotBlank(u.getSurname())) {
name = u.getSurname().concat(gender);
}
String street = StringUtils.isNotBlank(u.getStreet()) ? u.getStreet() : StrConstant.EPMETY_STR;
if (StringUtils.isNotBlank(street) && StringUtils.isNotBlank(name)) {
ui.setReleaseUserName(u.getStreet().concat("-").concat(name));
// String street = StringUtils.isNotBlank(u.getStreet()) ? u.getStreet() : StrConstant.EPMETY_STR;
if (StringUtils.isNotBlank(name)) {
ui.setReleaseUserName(name);
} else {
log.warn(String.format("当前userId:%s,缓存信息缺失姓、街道等信息.....;群成员暂时显示昵称", u.getUserId()));
ui.setReleaseUserName(u.getNickname());

2
epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/result/IssueDetailResultDTO.java

@ -43,7 +43,7 @@ public class IssueDetailResultDTO implements Serializable {
private String belongsGridName;
/**
* 议题发起人山东路168-尹女士
* 议题发起人尹女士
*/
private String issueInitiator;

3
epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java

@ -104,9 +104,8 @@ public class IssueServiceImpl implements IssueService {
resultDTOList.forEach(re->{
if(issueResult.getUserId().equals(re.getUserId())){
//话题发起人
String street = re.getStreet() == null ? "" : re.getStreet() + "-";
String realName = re.getRealName() == null ? "" : re.getRealName();
issueDetailResult.setIssueInitiator(street + realName);
issueDetailResult.setIssueInitiator(realName);
}
});
} else {

8
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/controller/ResiMineGridController.java

@ -7,6 +7,7 @@ import com.epmet.dto.form.LatestGridInfoFormDTO;
import com.epmet.dto.result.AllGridsByUserIdResultDTO;
import com.epmet.dto.result.LatestGridInfoResultDTO;
import com.epmet.modules.grid.service.ResiMineGridService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -63,7 +64,12 @@ public class ResiMineGridController {
//formDTO.setAppId(appId);
formDTO.setCustomerId(token.getCustomerId());
formDTO.setUserId(token.getUserId());
return new Result<LatestGridInfoResultDTO>().ok(resiMineGridService.latestGridInfo(formDTO));
LatestGridInfoResultDTO data = resiMineGridService.latestGridInfo(formDTO);
//todo 兼容 一个老的 等删除这个if就行
if ((data == null || StringUtils.isBlank(data.getGridId())&&"c2527f3d5cb8958583cc1348c328a784".equals(token.getCustomerId()))){
return new Result<LatestGridInfoResultDTO>().ok(null);
}
return new Result<LatestGridInfoResultDTO>().ok(data);
}
/**

10
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/mine/controller/PersonalCenterController.java

@ -1,7 +1,10 @@
package com.epmet.modules.mine.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.IdCardRegexUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.EditInfoFormDTO;
@ -10,6 +13,7 @@ import com.epmet.dto.form.SendCodeFormDTO;
import com.epmet.modules.mine.service.PersonalCenterService;
import com.epmet.resi.mine.dto.result.InitInfoResultDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -55,6 +59,12 @@ public class PersonalCenterController {
formDTO.setUserId(tokenDto.getUserId());
formDTO.setCustomerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(formDTO,EditInfoFormDTO.AddUserShowGroup.class,EditInfoFormDTO.AddUserInternalGroup.class);
if (StringUtils.isNotBlank(formDTO.getIdNum())){
boolean b = IdCardRegexUtils.validateIdCard(formDTO.getIdNum());
if (!b){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"请输入正确的证件号","请输入正确的证件号");
}
}
personalCenterService.editInfo(tokenDto, formDTO);
return new Result();
}

9
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartyMemberConfirmServiceImpl.java

@ -10,6 +10,7 @@ import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.IdCardRegexUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.*;
import com.epmet.dto.*;
@ -167,6 +168,14 @@ public class PartyMemberConfirmServiceImpl implements PartyMemberConfirmService
@Transactional(rollbackFor = Exception.class)
public Result submit(PartymemberInfoDTO partyMemberInfoDTO) {
log.info("submit param:{}",JSON.toJSONString(partyMemberInfoDTO));
// 证件类型判断----start----
IdCardRegexUtils regex = IdCardRegexUtils.parse(partyMemberInfoDTO.getIdCard());
if (regex == null) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "证件号解析错误", "证件号解析错误");
}
// 证件类型判断----end----
Result result = new Result();
//校验手机验证码是否正常

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

@ -67,7 +67,7 @@ public class IcFollowUpRecordDTO implements Serializable {
*/
@ColumnWidth(25)
@ExcelProperty("身份证号")
@NotBlank(message = "身份证号不能为空", groups = {AddUserRequired.class})
@NotBlank(message = "证号不能为空", groups = {AddUserRequired.class})
private String idCard;
/**

15
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcVaccinePrarmeterDTO.java

@ -90,6 +90,7 @@ public class IcVaccinePrarmeterDTO implements Serializable {
* 户口性质0户籍 1外来
*/
private String householdType;
private String householdTypeName;
/**
* 姓名
@ -110,6 +111,7 @@ public class IcVaccinePrarmeterDTO implements Serializable {
* 是否接种0否1是
*/
private String isVaccination;
private String isVaccinationName;
/**
* 第一次接种时间
@ -181,4 +183,15 @@ public class IcVaccinePrarmeterDTO implements Serializable {
*/
private Date updatedTime;
}
/**
* 审核状态0待审核 1审核不通过 2审核通过
*/
private String checkState;
private String checkStateName;
/**
* 审核理由
*/
private String checkReason;
}

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

@ -56,7 +56,7 @@ public class AddIcVaccineFormDTO implements Serializable {
/**
* 身份证号
*/
@NotBlank(message = "身份证号不能为空", groups = Vaccine.class)
@NotBlank(message = "证号不能为空", groups = Vaccine.class)
private String idCard;
/**
* 接种时间

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

@ -47,14 +47,14 @@ public class EditInfoFormDTO implements Serializable {
private String name;
//@NotBlank(message = "身份证号不能为空")
@Length(max=18,message = "身份证号不能超过18位",groups = AddUserShowGroup.class)
@Length(max=18,message = "证号不能超过18位",groups = AddUserShowGroup.class)
//别的小程序不统一升级,没办法限制必填。
private String idNum;
/**
* 路牌号
*/
@NotBlank(message = "路牌号不能为空",groups = AddUserShowGroup.class)
// @NotBlank(message = "路牌号不能为空",groups = AddUserShowGroup.class)
private String street;
/**
* 小区名称

36
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/GridInfoVaccinePrarmeterFormDTO.java

@ -0,0 +1,36 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* 所属网格
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-06-20
*/
@Data
public class GridInfoVaccinePrarmeterFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 所属网格名称
*/
private String gridName;
/**
* 当前登录人组织ID
*/
private String agencyId;
}

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

@ -71,8 +71,8 @@ public class IcMoveInAddEditFormDTO implements Serializable {
/**
* 身份证号
*/
@NotBlank(message = "身份证号不能为空", groups = {AddGroup.class})
@Length(min = 15, max = 18, message = "身份证号位数不正确", groups = AddGroup.class)
@NotBlank(message = "证号不能为空", groups = {AddGroup.class})
@Length(min = 9, max = 18, message = "证号位数不正确", groups = AddGroup.class)
private String idCard;
/**
* 性别1男2女0未知

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

@ -17,6 +17,6 @@ public class IcNoticeFormDTO extends PageFormDTO implements Serializable {
private static final long serialVersionUID = 7392894573654015338L;
private String customerId;
private String noticeId;
@NotBlank(message = "身份证号不能为空", groups = DefaultGroup.class)
@NotBlank(message = "证号不能为空", groups = DefaultGroup.class)
private String idCard;
}

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

@ -57,7 +57,7 @@ public class IcTripReportFormDTO implements Serializable {
/**
* 身份证号
*/
@NotBlank(message = "身份证号能为空", groups = {ResiUserRequired.class,PcAddRequired.class,PcUpdateRequired.class})
@NotBlank(message = "证号能为空", groups = {ResiUserRequired.class,PcAddRequired.class,PcUpdateRequired.class})
private String idCard;
/**

79
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcVaccineCheckFormDTO.java

@ -0,0 +1,79 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 新冠病毒疫苗接种人员信息台账-审核入参
*
* @author wgf
* @since v1.0.0 2022-08-25
*/
@Data
public class IcVaccineCheckFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@NotBlank(message = "Id不能为空")
private String id;
/**
* 审核状态0待审核 1未通过 2已通过
*/
@NotBlank(message = "审核状态不能为空")
private String checkState;
/**
* 审核原因
*/
private String checkReason;
/**
* 所属小区ID
*/
private String villageId;
/**
* 所属楼宇Id
*/
private String buildId;
/**
* 单元号
*/
private String unitId;
/**
* 房间ID
*/
private String homeId;
/**
* 房间号
*/
private String homeName;
/**
* 客户ID(审核人)
*/
private String customerId;
/**
* 员工ID(审核人)
*/
private String userId;
/**
* 员工姓名(审核人)
*/
private String realName;
}

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

@ -57,7 +57,7 @@ public class InfoSubmitFromDTO implements Serializable {
private String name;
//@NotBlank(message = "身份证号不能为空")
@Length(max=18,message = "身份证号不能超过18位")
@Length(max=18,message = "证号不能超过18位")
//别的小程序不统一升级,没办法限制必填。
private String idNum;

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

@ -12,10 +12,10 @@ public class PageFollowUpFormDTO extends PageFormDTO {
/**
* 身份证号
*/
@NotBlank(message = "身份证号不能为空", groups = {AddUserShowGroup.class})
@NotBlank(message = "证号不能为空", groups = {AddUserShowGroup.class})
private String idCard;
@NotBlank(message = "身份证号不能为空", groups = {AddUserShowGroup.class})
@NotBlank(message = "证号不能为空", groups = {AddUserShowGroup.class})
private String name;
/**

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

@ -0,0 +1,42 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.dto.form.PageFormDTO;
import lombok.Data;
import java.io.Serializable;
/**
* @Author wgf
* @DateTime 2022/8/22 10:30
* @DESC
*/
@Data
public class VaccinePrarmeterListFormDTO extends PageFormDTO implements Serializable {
private static final long serialVersionUID = -498378993902522370L;
/**
* 手机号
*/
private String mobile;
/**
* 地点名称
*/
private String name;
/**
* 证件号
*/
private String idCard;
private String isVaccination;
private String gridId;
private String villageId;
private String buildId;
private String unitId;
private String homeId;
}

2
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CollectListMemberExcelResultDTO.java

@ -24,7 +24,7 @@ public class CollectListMemberExcelResultDTO implements Serializable {
/**
* 成员身份证
*/
@Excel(name = "成员身份证号", width = 30)
@Excel(name = "成员证号", width = 30)
private String memberIdNum;
/**

16
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectController.java

@ -4,15 +4,19 @@ import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.annotation.MaskResponse;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.IdCardRegexUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.service.IcResiCollectService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -180,6 +184,18 @@ public class IcResiCollectController {
//效验数据
ValidatorUtils.validateEntity(formDTO);
formDTO.setOrigin("internal");//固定为内部
// 证件类型判断----start----
for (IcResiCollectMemFormDTO member : formDTO.getMemberList()) {
if (StringUtils.isNotBlank(member.getIdNum())) {
IdCardRegexUtils regex = IdCardRegexUtils.parse(member.getIdNum());
if (regex == null) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "证件号解析错误", "证件号解析错误");
}
}
}
// 证件类型判断----end----
return icResiCollectService.saveCollectInfo(formDTO);
}

9
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectVisitorController.java

@ -2,9 +2,12 @@ package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.IdCardRegexUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
@ -115,6 +118,12 @@ public class IcResiCollectVisitorController {
public Result saveInfo(@RequestBody SaveCollectVisitorFormDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto);
// 证件类型判断----start----
IdCardRegexUtils regex = IdCardRegexUtils.parse(dto.getIdCard());
if (regex == null) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "证件号解析错误", "证件号解析错误");
}
// 证件类型判断----end----
return icResiCollectVisitorService.saveInfo(dto);
}

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

@ -309,12 +309,30 @@ public class IcResiUserController implements ResultDataResolver {
*/
@PostMapping("rent/updateimage")
public Result updateImage(@LoginUser TokenDto tokenDto, @RequestBody RentTenantFormDTO formDTO) {
// 身份证号验证
if (StringUtils.isNotBlank(formDTO.getUser().getIdCard())) {
checkIdCard(formDTO.getUser().getIdCard());
}
if (StringUtils.isNotBlank(formDTO.getIdCard())) {
checkIdCard(formDTO.getIdCard());
}
String resiUserId = icResiUserService.updateImage(tokenDto, formDTO);
//推送MQ事件
editResiMq(formDTO.getCustomerId(), resiUserId);
return new Result();
}
private void checkIdCard(String idCard) {
// 证件类型判断----start----
IdCardRegexUtils regex = IdCardRegexUtils.parse(idCard);
if (regex == null) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "证件号解析错误", "证件号解析错误");
}
}
private void editResiMq(String customerId, String userId) {
//推送MQ事件
IcResiUserAddMQMsg mqMsg = new IcResiUserAddMQMsg();

7
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java

@ -33,6 +33,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.*;
@ -159,6 +160,12 @@ public class IcTripReportRecordController implements ResultDataResolver {
formDTO.setUserId(tokenDto.getUserId());
formDTO.setUserType(IcResiUserConstant.USER_TYPE_RESI);
ValidatorUtils.validateEntity(formDTO,IcTripReportFormDTO.ResiUserRequired.class,IcTripReportFormDTO.ResiUserInternalGroup.class);
if (StringUtils.isNotBlank(formDTO.getIdCard())){
boolean b = IdCardRegexUtils.validateIdCard(formDTO.getIdCard());
if (!b){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"请输入正确的证件号","请输入正确的证件号");
}
}
return new Result().ok(icTripReportRecordService.resiSave(formDTO));
}

118
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVaccinePrarmeterController.java

@ -1,21 +1,40 @@
package com.epmet.controller;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.annotation.MaskResponse;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.dto.form.PageFormDTO;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ExcelPoiUtils;
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.commons.tools.validator.group.UpdateGroup;
import com.epmet.constants.ImportTaskConstants;
import com.epmet.dao.IcVaccinePrarmeterDao;
import com.epmet.dto.IcVaccinePrarmeterDTO;
import com.epmet.dto.form.IcVaccineCheckFormDTO;
import com.epmet.dto.form.ImportTaskCommonFormDTO;
import com.epmet.dto.form.VaccinePrarmeterListFormDTO;
import com.epmet.dto.result.ImportTaskCommonResultDTO;
import com.epmet.excel.IcVaccinePrarmeterExcel;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.service.IcVaccinePrarmeterService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FilenameUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -28,14 +47,23 @@ import java.util.Map;
*/
@RestController
@RequestMapping("icVaccinePrarmeter")
@Slf4j
public class IcVaccinePrarmeterController {
@Autowired
private IcVaccinePrarmeterService icVaccinePrarmeterService;
@Autowired
private IcVaccinePrarmeterDao icVaccinePrarmeterDao;
@Autowired
private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient;
@RequestMapping("page")
// @MaskResponse(fieldNames = {"MOBILE", "ID_CARD"}, fieldsMaskType = {MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD})
public Result<PageData<IcVaccinePrarmeterDTO>> page(@RequestParam Map<String, Object> params){
PageData<IcVaccinePrarmeterDTO> page = icVaccinePrarmeterService.page(params);
// PageData<IcVaccinePrarmeterDTO> page = icVaccinePrarmeterService.page(params);
PageData<IcVaccinePrarmeterDTO> page = icVaccinePrarmeterService.getPhrasePage(params);
return new Result<PageData<IcVaccinePrarmeterDTO>>().ok(page);
}
@ -55,7 +83,7 @@ public class IcVaccinePrarmeterController {
}
@NoRepeatSubmit
@PutMapping("update")
@PostMapping("update")
public Result update(@RequestBody IcVaccinePrarmeterDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
@ -77,6 +105,90 @@ public class IcVaccinePrarmeterController {
ExcelUtils.exportExcelToTarget(response, null, list, IcVaccinePrarmeterExcel.class);
}
/**
* Desc: 新冠病毒疫苗接种人员信息台账导出
* @param response
* @param formDTO
* @param tokenDto
* @author wgf
* @date 2022/6/24 13:57
*/
@PostMapping("vaccine-export")
public void vaccineExport(HttpServletResponse response, @RequestBody VaccinePrarmeterListFormDTO formDTO, @LoginUser TokenDto tokenDto) throws Exception {
ValidatorUtils.validateEntity(formDTO, PageFormDTO.AddUserInternalGroup.class);
List<IcVaccinePrarmeterDTO> list = icVaccinePrarmeterDao.vaccineExport(formDTO);
ExcelUtils.exportExcelToTarget(response, null, list, IcVaccinePrarmeterExcel.class);
}
/**
* 导出模板
* @param response
* @throws Exception
*/
@PostMapping("exporttemplate")
public void exportTemplate( HttpServletResponse response) throws Exception {
TemplateExportParams templatePath = new TemplateExportParams("excel/ic_vaccine_prarmeter_excel.xls");
ExcelPoiUtils.exportExcel(templatePath ,new HashMap<>(),"新冠病毒疫苗接种人员信息台账",response);
}
/**
* Desc: 新冠病毒疫苗接种人员信息台账导入
* @param
* @author wgf
* @date 2022/8/22 13:40
*/
@PostMapping("importFile")
public Result importFile(@LoginUser TokenDto tokenDto, @RequestParam("file") MultipartFile file){
if (file.isEmpty()) {
throw new EpmetException("请上传文件");
}
// 校验文件类型
String extension = FilenameUtils.getExtension(file.getOriginalFilename());
if (!"xls".equals(extension) && !"xlsx".equals(extension)) {
throw new EpmetException("文件类型不匹配");
}
ImportTaskCommonFormDTO importTaskForm = new ImportTaskCommonFormDTO();
importTaskForm.setOriginFileName(file.getOriginalFilename());
importTaskForm.setOperatorId(tokenDto.getUserId());
importTaskForm.setBizType(ImportTaskConstants.IC_VACCINE_PRARMETER);
Result<ImportTaskCommonResultDTO> result = commonServiceOpenFeignClient.createImportTask(importTaskForm);
if (!result.success()) {
throw new EpmetException(9999,"存在进行中的导入");
}
InputStream inputStream = null;
try {
inputStream = file.getInputStream();
}catch (Exception e){
ImportTaskCommonFormDTO input = new ImportTaskCommonFormDTO();
input.setOperatorId(tokenDto.getUserId());
input.setTaskId(result.getData().getTaskId());
input.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL);
commonServiceOpenFeignClient.finishImportTask(input);
log.error("读取文件失败");
}
icVaccinePrarmeterService.importFile(tokenDto,inputStream,result.getData().getTaskId());
return new Result();
}
/**
* 信息采集-审核
* @param formDTO
* @param tokenDto
* @return
*/
@PostMapping("vaccineCheck")
public Result vaccineCheck(@RequestBody IcVaccineCheckFormDTO formDTO, @LoginUser TokenDto tokenDto) {
formDTO.setUserId(tokenDto.getUserId());
formDTO.setCustomerId(tokenDto.getCustomerId());
icVaccinePrarmeterService.vaccineCheck(formDTO,tokenDto);
return new Result();
}
}

8
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineDao.java

@ -64,4 +64,12 @@ public interface IcVaccineDao extends BaseDao<IcVaccineEntity> {
IcVaccineDTO getVaccineDTO(@Param("customerId") String customerId, @Param("icVaccineId") String icVaccineId, @Param("idCard") String idCard, @Param("inoculateTime") String inoculateTime);
/**
* 根据身份证号以及接种时间查询接种信息
* @param idCard
* @param time
* @return
*/
List<IcVaccineEntity> getVaccineListByIdCard(@Param("idCard") String idCard,@Param("time") String time);
}

19
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccinePrarmeterDao.java

@ -1,9 +1,15 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.IcPointNucleicMonitoringDTO;
import com.epmet.dto.IcVaccinePrarmeterDTO;
import com.epmet.dto.form.VaccinePrarmeterListFormDTO;
import com.epmet.entity.IcVaccinePrarmeterEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
/**
* 新冠病毒疫苗接种人员信息台账
*
@ -12,5 +18,14 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface IcVaccinePrarmeterDao extends BaseDao<IcVaccinePrarmeterEntity> {
}
List<IcVaccinePrarmeterDTO> vaccineExport(VaccinePrarmeterListFormDTO formDTO);
/**
* 条件查询
* @param params
* @return
*/
List<IcVaccinePrarmeterDTO> getPhrasePage(Map<String, Object> params);
}

6
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineRelationDao.java

@ -14,4 +14,8 @@ import org.apache.ibatis.annotations.Param;
@Mapper
public interface IcVaccineRelationDao extends BaseDao<IcVaccineRelationEntity> {
int delRelation(@Param("icVaccineId") String icNatId, @Param("agencyId") String agencyId);
}
void updateRelationInfoByVaccineId(IcVaccineRelationEntity icVaccineRelationEntity);
}

7
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiUserEntity.java

@ -96,10 +96,15 @@ public class IcResiUserEntity extends BaseEpmetEntity {
private String gender;
/**
* 身份证号
*
*/
private String idCard;
/**
* 证件类型1身份证号2护照
*/
private String idCardType;
/**
* 出生日期
*/

10
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcVaccinePrarmeterEntity.java

@ -151,4 +151,14 @@ public class IcVaccinePrarmeterEntity extends BaseEpmetEntity {
*/
private String note;
/**
* 审核状态0待审核 1审核不通过 2审核通过
*/
private String checkState;
/**
* 审核理由
*/
private String checkReason;
}

2
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeDeathExcel.java

@ -23,7 +23,7 @@ public class ChangeDeathExcel {
@Excel(name = "姓名")
private String name;
@Excel(name = "身份证")
@Excel(name = "证件号")
private String idCard;
@Excel(name = "手机号")

2
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeRelocationExcel.java

@ -32,7 +32,7 @@ public class ChangeRelocationExcel {
@Excel(name = "手机号")
private String mobile;
@Excel(name = "身份证号")
@Excel(name = "证号")
private String idCard;
@Excel(name = "性别")

2
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeWelfareExcel.java

@ -24,7 +24,7 @@ public class ChangeWelfareExcel {
@Excel(name = "姓名")
private String name;
@Excel(name = "身份证")
@Excel(name = "证件号")
private String idCard;
@Excel(name = "手机号")

50
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcVaccinePrarmeterExcel.java

@ -14,49 +14,28 @@ import java.util.Date;
@Data
public class IcVaccinePrarmeterExcel {
@Excel(name = "主键")
private String id;
@Excel(name = "客户Id customer.id")
private String customerId;
@Excel(name = "网格ID")
private String gridId;
@Excel(name = "网格名称")
private String gridName;
@Excel(name = "组织Id")
private String agencyId;
@Excel(name = "组织的pids")
private String pids;
@Excel(name = "所属小区ID;")
private String villageId;
@Excel(name = "所属小区名称")
private String villageName;
@Excel(name = "所属楼宇Id")
private String buildId;
@Excel(name = "所属楼宇名称")
private String buildName;
@Excel(name = "单元id")
private String unitId;
@Excel(name = "单元名")
private String unitName;
@Excel(name = "所属家庭Id")
private String homeId;
@Excel(name = "房间名")
private String homeName;
@Excel(name = "户口性质:0户籍 1外来")
@Excel(name = "户口性质", replace = {"户籍_0","外来_1"})
private String householdType;
@Excel(name = "姓名")
@ -65,10 +44,10 @@ public class IcVaccinePrarmeterExcel {
@Excel(name = "联系电话")
private String mobile;
@Excel(name = "身份证号")
@Excel(name = "证号")
private String idCard;
@Excel(name = "是否接种:0否1是")
@Excel(name = "是否接种", replace = {"否_0","是_1"})
private String isVaccination;
@Excel(name = "第一次接种时间")
@ -89,29 +68,18 @@ public class IcVaccinePrarmeterExcel {
@Excel(name = "第三次接种地点")
private String thirdVacSite;
@Excel(name = "原因:禁忌症/拒绝接种/其他原因")
@Excel(name = "原因")
private String reason;
@Excel(name = "备注")
private String note;
@Excel(name = "删除标识 0.未删除 1.已删除")
private Integer delFlag;
@Excel(name = "乐观锁")
private Integer revision;
@Excel(name = "创建人")
private String createdBy;
@Excel(name = "创建时间")
private Date createdTime;
@Excel(name = "审核状态", replace = {"待审核_0","审核不通过_1","审核通过_2"})
private String checkState;
@Excel(name = "更新人")
private String updatedBy;
@Excel(name = "审核理由")
private String checkReason;
@Excel(name = "更新时间")
private Date updatedTime;
}
}

97
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcVaccinePrarmeterImportExcel.java

@ -0,0 +1,97 @@
package com.epmet.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelIgnore;
import lombok.Data;
import java.util.Date;
/**
* 新冠病毒疫苗接种人员信息台账
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-08-22
*/
@Data
public class IcVaccinePrarmeterImportExcel {
@Excel(name = "所属网格")
private String gridName;
@Excel(name = "所属小区")
private String villageName;
@Excel(name = "所属楼宇")
private String buildName;
@Excel(name = "单元")
private String unitName;
@Excel(name = "所属家庭")
private String homeName;
@Excel(name = "户口性质", replace = {"户籍_0","外来_1"})
private String householdType;
@Excel(name = "姓名")
private String name;
@Excel(name = "联系电话")
private String mobile;
@Excel(name = "证件号")
private String idCard;
@Excel(name = "是否接种", replace = {"否_0","是_1"})
private String isVaccination;
@Excel(name = "第一次接种时间", format = "yyyy-MM-dd HH:mm:ss")
private String firstVacTime;
@Excel(name = "第一次接种地点")
private String firstVacSite;
@Excel(name = "第二次接种时间", format = "yyyy-MM-dd HH:mm:ss")
private String secondVacTime;
@Excel(name = "第二次接种地点")
private String secondVacSite;
@Excel(name = "第三次接种时间", format = "yyyy-MM-dd HH:mm:ss")
private String thirdVacTime;
@Excel(name = "第三次接种地点")
private String thirdVacSite;
@Excel(name = "原因")
private String reason;
@Excel(name = "备注")
private String note;
@ExcelIgnore
private Boolean addStatus = false;
@ExcelIgnore
private Integer num;
/**
* 所属网格ID
*/
@ExcelIgnore
private String gridId;
/**
* 组织ID
*/
@ExcelIgnore
private String agencyId;
/**
* 组织ID所有上级
*/
@ExcelIgnore
private String pids;
}

77
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/error/IcVaccinePrarmeterImportErrorModel.java

@ -0,0 +1,77 @@
package com.epmet.excel.error;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* @Author wgf
* @DateTime 2022/6/21 16:57
* @DESC
*/
@Data
public class IcVaccinePrarmeterImportErrorModel {
@Excel(name = "行号",width = 10)
private Integer num;
@Excel(name = "所属网格",width = 30)
private String gridName;
@Excel(name = "所属小区",width = 30)
private String villageName;
@Excel(name = "所属楼宇",width = 30)
private String buildName;
@Excel(name = "单元",width = 30)
private String unitName;
@Excel(name = "所属家庭",width = 30)
private String homeName;
@Excel(name = "户口性质", width = 30, replace = {"户籍_0","外来_1"})
private String householdType;
@Excel(name = "姓名",width = 30)
private String name;
@Excel(name = "联系电话",width = 30)
private String mobile;
@Excel(name = "证件号",width = 30)
private String idCard;
@Excel(name = "是否接种", width = 30, replace = {"否_0","是_1"})
private String isVaccination;
@Excel(name = "第一次接种时间",width = 30)
private String firstVacTime;
@Excel(name = "第一次接种地点",width = 30)
private String firstVacSite;
@Excel(name = "第二次接种时间",width = 30)
private String secondVacTime;
@Excel(name = "第二次接种地点",width = 30)
private String secondVacSite;
@Excel(name = "第三次接种时间",width = 30)
private String thirdVacTime;
@Excel(name = "第三次接种地点",width = 30)
private String thirdVacSite;
@Excel(name = "原因",width = 30)
private String reason;
@Excel(name = "备注",width = 30)
private String note;
@Excel(name = "错误信息", width = 200)
private String errorMsg;
}

11
epmet-user/epmet-user-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java

@ -5,6 +5,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.CommunityInfoResultDTO;
import com.epmet.dto.result.GridInfoByNameResultDTO;
import com.epmet.dto.result.GridInfoResultDTO;
import com.epmet.dto.result.IcHouseInfoCollectResultDTO;
import com.epmet.feign.fallback.GovOrgFeignClientFallBack;
@ -74,6 +75,16 @@ public interface GovOrgFeignClient {
@PostMapping("/gov/org/customeragency/getCommunityInfo")
Result<CommunityInfoResultDTO> getCommunityInfo(OrgInfoPointFormDTO formDTO);
/**
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.CommunityInfoResultDTO>
* @Author wgf
* @Description 根据网格名称查询所属网格信息
* @Date 2020/4/26 23:16
**/
@PostMapping("/gov/org/customeragency/getGridInfoByGridName")
Result<GridInfoByNameResultDTO> getGridInfoByGridName(GridInfoVaccinePrarmeterFormDTO formDTO);
/**
* @param userId
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.CommunityInfoResultDTO>

6
epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java

@ -6,6 +6,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.CommunityInfoResultDTO;
import com.epmet.dto.result.GridInfoByNameResultDTO;
import com.epmet.dto.result.GridInfoResultDTO;
import com.epmet.dto.result.IcHouseInfoCollectResultDTO;
import com.epmet.feign.GovOrgFeignClient;
@ -46,6 +47,11 @@ public class GovOrgFeignClientFallBack implements GovOrgFeignClient {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getCommunityInfo",formDTO);
}
@Override
public Result<GridInfoByNameResultDTO> getGridInfoByGridName(GridInfoVaccinePrarmeterFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getGridInfoByGridName",formDTO);
}
@Override
public Result<CommunityInfoResultDTO> getCommunityInfoByUserId(String userId) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getCommunityInfoByUserId",userId);

2
epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBaseInfoRedis.java

@ -135,7 +135,7 @@ public class UserBaseInfoRedis {
&& StringUtils.isNotBlank(gridResult.getData().getBelongsGridName())){
String gridFullName = gridResult.getData().getBelongsGridName();
baseInfo.setRegisteredGridName(gridFullName);
StringBuffer buffer = new StringBuffer(gridFullName.split(ModuleConstant.DASH)[NumConstant.ONE]).append(ModuleConstant.DASH).append(baseInfo.getSurname());
StringBuffer buffer = new StringBuffer(baseInfo.getSurname());
switch (baseInfo.getGender()) {
case NumConstant.ONE_STR:
buffer.append(ModuleConstant.RESI_USER_NICKNAME_SUFFIX_MALE);

4
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcPointNucleicMonitoringService.java

@ -91,8 +91,8 @@ public interface IcPointNucleicMonitoringService extends BaseService<IcPointNucl
* Desc: 核酸检测点导入
* @param tokenDto
* @param inputStream
* @author zxc
* @date 2022/3/29 15:35
* @author wgf
* @date 2022/6/21 15:35
*/
void importFile(TokenDto tokenDto, InputStream inputStream, String taskId);

29
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcVaccinePrarmeterService.java

@ -2,9 +2,13 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dto.IcVaccinePrarmeterDTO;
import com.epmet.dto.form.IcResiCollectCheckFormDTO;
import com.epmet.dto.form.IcVaccineCheckFormDTO;
import com.epmet.entity.IcVaccinePrarmeterEntity;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
@ -26,6 +30,13 @@ public interface IcVaccinePrarmeterService extends BaseService<IcVaccinePrarmete
*/
PageData<IcVaccinePrarmeterDTO> page(Map<String, Object> params);
/**
* 分页条件查询
* @param params
* @return
*/
PageData<IcVaccinePrarmeterDTO> getPhrasePage(Map<String, Object> params);
/**
* 默认查询
*
@ -75,4 +86,20 @@ public interface IcVaccinePrarmeterService extends BaseService<IcVaccinePrarmete
* @date 2022-08-22
*/
void delete(String[] ids);
}
/**
* Desc: 新冠病毒疫苗接种人员信息台账导入
* @param tokenDto
* @param inputStream
* @author wgf
* @date 2022/8/22 15:35
*/
void importFile(TokenDto tokenDto, InputStream inputStream, String taskId);
/**
* 新冠病毒疫苗接种人员信息台账审核
* @param formDTO
* @return
*/
void vaccineCheck(IcVaccineCheckFormDTO formDTO, TokenDto tokenDto);
}

34
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java

@ -617,25 +617,23 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
List<StaffSinGridResultDTO> staffInfoList = new ArrayList<>();
userIds.forEach(staffId -> {
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), staffId);
if (staffInfo == null) {
log.error("getStaffInfoList fail customerId:{}, staffId:{} not exist in db", formDTO.getCustomerId(), staffId);
return;
if (null != staffInfo) {
StaffSinGridResultDTO resultDTO = new StaffSinGridResultDTO();
resultDTO.setStaffId(staffId);
resultDTO.setStaffName(staffInfo.getRealName());
resultDTO.setHeadPhoto(staffInfo.getHeadPhoto());
resultDTO.setGender(staffInfo.getGender());
List<RoleResultDTO> roleInfoList = new ArrayList<>();
staffInfo.getRoleMap().forEach((key, value) -> {
RoleResultDTO dto = new RoleResultDTO();
dto.setRoleKey(key);
dto.setRoleName(value);
roleInfoList.add(dto);
});
resultDTO.setRoleList(roleInfoList);
staffInfoList.add(resultDTO);
}
StaffSinGridResultDTO resultDTO = new StaffSinGridResultDTO();
resultDTO.setStaffId(staffId);
resultDTO.setStaffName(staffInfo.getRealName());
resultDTO.setHeadPhoto(staffInfo.getHeadPhoto());
resultDTO.setGender(staffInfo.getGender());
List<RoleResultDTO> roleInfoList = new ArrayList<>();
staffInfo.getRoleMap().forEach((key, value) -> {
RoleResultDTO dto = new RoleResultDTO();
dto.setRoleKey(key);
dto.setRoleName(value);
roleInfoList.add(dto);
});
resultDTO.setRoleList(roleInfoList);
staffInfoList.add(resultDTO);
});
/*List<StaffSinGridResultDTO> staffInfoList = customerStaffDao.getStaffInfoList(userIds);

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

@ -7,12 +7,15 @@ import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.enums.GenderEnum;
import com.epmet.commons.tools.enums.IcResiUserSubStatusEnum;
import com.epmet.commons.tools.enums.IdCardTypeEnum;
import com.epmet.commons.tools.enums.RelationshipEnum;
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.CustomerStaffRedis;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.IdCardRegexUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.IcBirthRecordDao;
import com.epmet.dao.IcResiUserDao;
@ -144,6 +147,15 @@ public class IcBirthRecordServiceImpl extends BaseServiceImpl<IcBirthRecordDao,
userEntity.setStatus(NumConstant.ZERO_STR);
userEntity.setSubStatus(IcResiUserSubStatusEnum.BIRTH.getSubStatus());
// 证件类型判断----start----
IdCardRegexUtils regex = IdCardRegexUtils.parse(dto.getIdCard());
if (regex == null) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "证件号解析错误", "证件号解析错误");
}
IdCardTypeEnum typeEnum = regex.getTypeEnum();
userEntity.setIdCardType(typeEnum.getType());
// 证件类型判断----end----
//判断是否有所属组织,如果有,判断是否属于当前组织,没有的话则直接新增
if (StringUtils.isNotEmpty(sync.getIcResiUserId())) {
userEntity.setId(sync.getIcResiUserId());

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

@ -5,6 +5,7 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.enums.DictTypeEnum;
import com.epmet.commons.tools.enums.IcResiUserSubStatusEnum;
import com.epmet.commons.tools.enums.IdCardTypeEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.page.PageData;
@ -12,6 +13,7 @@ import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.IdCardRegexUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.IcMoveInRecordDao;
import com.epmet.dto.ChangeWelfareDTO;
@ -168,6 +170,16 @@ public class IcMoveInRecordServiceImpl extends BaseServiceImpl<IcMoveInRecordDao
IcResiUserEntity entity = ConvertUtils.sourceToTarget(formDTO, IcResiUserEntity.class);
//状态改为0正常
entity.setStatus(NumConstant.ZERO_STR);
// 证件类型判断----start----
IdCardRegexUtils regex = IdCardRegexUtils.parse(formDTO.getIdCard());
if (regex == null) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "证件号解析错误", "证件号解析错误");
}
IdCardTypeEnum typeEnum = regex.getTypeEnum();
entity.setIdCardType(typeEnum.getType());
// 证件类型判断----end----
//4-1.本社区下正常状态居民且房屋不一样并选择了更新【只更新居民信息,插入调动记录,生成变更记录,不生成变更明细】
if (StringUtils.isNotBlank(resiDTO.getResiAgencyId()) && staffInfo.getAgencyId().equals(resiDTO.getResiAgencyId())
&& "0".equals(resiDTO.getStatus()) && !resiDTO.getResiHomeId().equals(formDTO.getHomeId())

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

@ -18,6 +18,7 @@ import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.enums.IcResiUserSubStatusEnum;
import com.epmet.commons.tools.enums.IdCardTypeEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.ExceptionUtils;
@ -89,15 +90,6 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
public static final List<String> controlGroup1 = Arrays.asList("input", "textarea", "datepicker", "daterange");
public static final List<String> controlGroup2 = Arrays.asList("select", "radio", "cascader");
/**
* 15位身份证号的正则表达式
*/
private final Pattern PATTERN_15_ID = Pattern.compile("^\\d{6}(?<year>\\d{2})(?<month>0[1-9]|1[0-2])(?<day>[0-2][0-9]|3[0-1])\\d{2}(?<sex>\\d)$");
/**
* 18位身份证号的正则表达式
*/
private final Pattern PATTERN_18_ID = Pattern.compile("^\\d{6}(?<year>\\d{4})(?<month>0[1-9]|1[0-2])(?<day>[0-2][0-9]|3[0-1])\\d{2}(?<sex>\\d)[0-9a-xA-X]$");
/**
* 日期解析不含时间
*/
@ -233,7 +225,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
private String tableName;
@Excel(name = "身份证号", width = 40)
@Excel(name = "证号", width = 40)
private String idCard;
@Excel(name = "姓名", width = 25)
@ -623,14 +615,10 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
if (StringUtils.isBlank(idCard)) {
log.debug("【居民信息导入】specifiedCheck身份证号为空的:{},{}", mobile, name);
String errorMsg = "身份证号不能为空";
String errorMsg = "证号不能为空";
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), errorMsg, errorMsg);
}
if (idCard.length() != 18 && idCard.length() != 15) {
errors.add("身份证号长度错误");
}
if (StringUtils.isNotBlank(mobile) && mobile.length() > 15) {
errors.add("手机号长度错误");
}
@ -642,52 +630,48 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
}
// ================== 数据补充 ===================
String year;
String month;
String day;
String sex;
IdCardRegexUtils regexUtilInstance = IdCardRegexUtils.parse(idCard);
if (regexUtilInstance == null) {
String s = "证件号解析错误,或不支持的证件类型。(请使用身份证号或者护照号)";
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), s, s);
}
if (idCard.length() == 15) {
Matcher matcher = PATTERN_15_ID.matcher(idCard);
if (matcher.matches()) {
year = "19".concat(matcher.group("year"));
month = matcher.group("month");
day = matcher.group("day");
sex = matcher.group("sex");
} else {
String s = "身份证号解析错误";
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), s, s);
}
} else if (idCard.length() == 18) {
Matcher matcher = PATTERN_18_ID.matcher(idCard);
if (matcher.matches()) {
year = matcher.group("year");
month = matcher.group("month");
day = matcher.group("day");
sex = matcher.group("sex");
} else {
String s = "身份证号解析错误";
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), s, s);
}
} else {
String s = "身份证号位数错误";
IdCardTypeEnum idCardType = regexUtilInstance.getTypeEnum();
if (idCardType == null || IdCardTypeEnum.OTHERS == idCardType) {
String s = "证件号解析错误,或不支持的证件类型。(请使用身份证号或者护照号)";
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), s, s);
}
// 出生日期 & 年龄
LocalDate birthday = null;
try {
birthday = LocalDate.of(Integer.parseInt(year), Integer.parseInt(month), Integer.parseInt(day));
} catch (DateTimeException e) {
throw new EpmetException("身份证号中日期信息错误");
IdCardRegexUtils.ParsedContent parsedResult = regexUtilInstance.getParsedResult();
String year = null, month = null, day = null, sex = null;
if (parsedResult != null) {
year = parsedResult.getBirthdayYear();
month = parsedResult.getBirthdayMonth();
day = parsedResult.getBirthdayDay();
sex = parsedResult.getSex();
}
int age = Period.between(birthday, LocalDate.now()).getYears();
// 性别 & 生日 & 老年人
Boolean isMale = (Integer.parseInt(sex) % 2) == 1;
columnAndValues.put("BIRTHDAY", String.join("-", Arrays.asList(year, month,day)));
columnAndValues.put("GENDER", isMale ? "1" : "2");
columnAndValues.put("IS_OLD_PEOPLE", age >= 60 ? "1" : "0");
// 存储证件类型
columnAndValues.put("ID_CARD_TYPE", idCardType.getType());
if (idCardType == IdCardTypeEnum.SFZH) {
//只有证件类型是身份证号才做相关解析
// 出生日期 & 年龄
LocalDate birthday = null;
try {
birthday = LocalDate.of(Integer.parseInt(year), Integer.parseInt(month), Integer.parseInt(day));
} catch (DateTimeException e) {
throw new EpmetException("身份证号中日期信息错误");
}
int age = Period.between(birthday, LocalDate.now()).getYears();
// 性别 & 生日 & 老年人
Boolean isMale = (Integer.parseInt(sex) % 2) == 1;
columnAndValues.put("BIRTHDAY", String.join("-", Arrays.asList(year, month, day)));
columnAndValues.put("GENDER", isMale ? "1" : "2");
columnAndValues.put("IS_OLD_PEOPLE", age >= 60 ? "1" : "0");
}
}
/**

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

@ -259,7 +259,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
if (map.containsKey("ID_CARD")) {
IcResiUserDTO userDTO = baseDao.getResiUserByIdCard(map.get("ID_CARD"), tokenDto.getCustomerId());
if (null != userDTO && null != userDTO.getIdCard()) {
String errorMsg = "新增居民信息失败,身份证号已存在!";
String errorMsg = "新增居民信息失败,证号已存在!";
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), errorMsg, errorMsg);
}
}
@ -295,6 +295,16 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
if (isDyzxh) {
map.put("IS_VOLUNTEER", NumConstant.ONE_STR);
}
// 证件类型判断----start----
IdCardRegexUtils regex = IdCardRegexUtils.parse(map.get("ID_CARD"));
if (regex == null) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "证件号解析错误", "证件号解析错误");
}
IdCardTypeEnum typeEnum = regex.getTypeEnum();
map.put("ID_CARD_TYPE", typeEnum.getType());
// 证件类型判断----end----
//新增主表数据
baseDao.add(d.getTableName(), map);
@ -506,7 +516,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
wrapper.ne(IcResiUserEntity::getId, map.get("ID"));
List<IcResiUserEntity> entityList = baseDao.selectList(wrapper);
if (CollectionUtils.isNotEmpty(entityList)) {
String errorMsg = "修改居民信息失败,身份证号已存在!";
String errorMsg = "修改居民信息失败,证号已存在!";
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), errorMsg, errorMsg);
}
}
@ -621,6 +631,17 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
map.put("IS_VOLUNTEER", NumConstant.ONE_STR);
}
map.put("updated_by", tokenDto.getUserId());
if (StringUtils.isNotBlank(map.get("ID_CARD"))) {
// 证件类型判断----start----
IdCardRegexUtils regex = IdCardRegexUtils.parse(map.get("ID_CARD"));
if (regex == null) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "证件号解析错误", "证件号解析错误");
}
IdCardTypeEnum typeEnum = regex.getTypeEnum();
map.put("ID_CARD_TYPE", typeEnum.getType());
// 证件类型判断----end----
}
baseDao.upTable("ic_resi_user", resiUserId, map);
}

744
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVaccinePrarmeterServiceImpl.java

@ -1,24 +1,75 @@
package com.epmet.service.impl;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
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.constant.ServiceConstant;
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.ExceptionUtils;
import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.ExcelPoiUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constants.ImportTaskConstants;
import com.epmet.dao.IcResiUserDao;
import com.epmet.dao.IcVaccineDao;
import com.epmet.dao.IcVaccinePrarmeterDao;
import com.epmet.dao.IcVaccineRelationDao;
import com.epmet.dto.IcVaccinePrarmeterDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.GridInfoByNameResultDTO;
import com.epmet.dto.result.IcHouseInfoCollectResultDTO;
import com.epmet.dto.result.LoginUserDetailsResultDTO;
import com.epmet.dto.result.UploadImgResultDTO;
import com.epmet.entity.*;
import com.epmet.entity.IcResiUserEntity;
import com.epmet.entity.IcUserChangeRecordEntity;
import com.epmet.entity.IcVaccinePrarmeterEntity;
import com.epmet.excel.IcVaccinePrarmeterImportExcel;
import com.epmet.excel.error.IcVaccinePrarmeterImportErrorModel;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovOrgFeignClient;
import com.epmet.feign.OssFeignClient;
import com.epmet.redis.IcVaccinePrarmeterRedis;
import com.epmet.service.IcUserChangeRecordService;
import com.epmet.service.IcVaccinePrarmeterService;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.entity.ContentType;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 新冠病毒疫苗接种人员信息台账
@ -27,11 +78,37 @@ import java.util.Map;
* @since v1.0.0 2022-08-22
*/
@Service
public class IcVaccinePrarmeterServiceImpl extends BaseServiceImpl<IcVaccinePrarmeterDao, IcVaccinePrarmeterEntity> implements IcVaccinePrarmeterService {
@Slf4j
public class IcVaccinePrarmeterServiceImpl extends BaseServiceImpl<IcVaccinePrarmeterDao, IcVaccinePrarmeterEntity> implements IcVaccinePrarmeterService,ResultDataResolver {
@Autowired
@Resource
private IcVaccinePrarmeterRedis icVaccinePrarmeterRedis;
@Resource
private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient;
@Resource
private OssFeignClient ossFeignClient;
@Resource
private GovOrgFeignClient govOrgFeignClient;
@Resource
private IcResiUserDao icResiUserDao;
@Resource
private IcUserChangeRecordService icUserChangeRecordService;
@Resource
private IcVaccineDao icVaccineDao;
@Resource
private IcVaccineRelationDao icVaccineRelationDao;
@Autowired
private EpmetUserOpenFeignClient userOpenFeignClient;
@Override
public PageData<IcVaccinePrarmeterDTO> page(Map<String, Object> params) {
IPage<IcVaccinePrarmeterEntity> page = baseDao.selectPage(
@ -41,6 +118,18 @@ public class IcVaccinePrarmeterServiceImpl extends BaseServiceImpl<IcVaccinePrar
return getPageData(page, IcVaccinePrarmeterDTO.class);
}
/**
* 条件查询
* @param params
* @return
*/
@Override
public PageData<IcVaccinePrarmeterDTO> getPhrasePage(Map<String, Object> params) {
IPage<IcVaccinePrarmeterDTO> page = getPage(params);
List<IcVaccinePrarmeterDTO> list = baseDao.getPhrasePage(params);
return new PageData<>(list, page.getTotal());
}
@Override
public List<IcVaccinePrarmeterDTO> list(Map<String, Object> params) {
List<IcVaccinePrarmeterEntity> entityList = baseDao.selectList(getWrapper(params));
@ -66,14 +155,26 @@ public class IcVaccinePrarmeterServiceImpl extends BaseServiceImpl<IcVaccinePrar
@Override
@Transactional(rollbackFor = Exception.class)
public void save(IcVaccinePrarmeterDTO dto) {
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(dto.getGridId());
if (null == gridInfo) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取网格信息失败", "获取网格信息失败");
}
IcVaccinePrarmeterEntity entity = ConvertUtils.sourceToTarget(dto, IcVaccinePrarmeterEntity.class);
entity.setCustomerId(gridInfo.getCustomerId());
entity.setPids(gridInfo.getPids());
entity.setCheckState(NumConstant.ZERO_STR);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(IcVaccinePrarmeterDTO dto) {
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(dto.getGridId());
if (null == gridInfo) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取网格信息失败", "获取网格信息失败");
}
IcVaccinePrarmeterEntity entity = ConvertUtils.sourceToTarget(dto, IcVaccinePrarmeterEntity.class);
entity.setPids(gridInfo.getPids());
updateById(entity);
}
@ -84,4 +185,633 @@ public class IcVaccinePrarmeterServiceImpl extends BaseServiceImpl<IcVaccinePrar
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}
/**
* Desc: 新冠病毒疫苗接种人员信息台账导入
* @param tokenDto
* @param inputStream
* @param taskId
* @author wgf
* @date 2022/8/22 15:35
*/
@Override
@Async
public void importFile(TokenDto tokenDto, InputStream inputStream, String taskId) {
List<IcVaccinePrarmeterImportErrorModel> errorInfo = new ArrayList<>();
try {
List<IcVaccinePrarmeterImportExcel> list = ExcelPoiUtils.importExcel(inputStream, 0,1, IcVaccinePrarmeterImportExcel.class);
if (CollectionUtils.isEmpty(list)){
closeTask(taskId,tokenDto.getUserId(), ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL,"");
return;
}
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId());
if (null == staffInfo){
throw new EpmetException("未查询到工作人员信息"+tokenDto.getUserId());
}
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(staffInfo.getAgencyId());
if (null == agencyInfo){
throw new EpmetException("未查询到组织信息"+staffInfo.getAgencyId());
}
// 校验空单元格以及网格名称是否正确
checkInfo(list,errorInfo,tokenDto);
if (list.size() > errorInfo.size()){
Map<String, Long> groupByName = list.stream().collect(Collectors.groupingBy(IcVaccinePrarmeterImportExcel::getName, Collectors.counting()));
groupByName.forEach((name,count) -> {
if (Integer.valueOf(count.toString()).compareTo(1) != 0){
for (IcVaccinePrarmeterImportExcel i : list) {
if (name.equals(i.getName()) && !i.getAddStatus()){
errorInfo.add(getErrorInfo(i,"数据重复",i.getNum()));
i.setAddStatus(true);
}
}
}
});
}
Map<Boolean, List<IcVaccinePrarmeterImportExcel>> groupByStatus = list.stream().collect(Collectors.groupingBy(IcVaccinePrarmeterImportExcel::getAddStatus));
List<IcVaccinePrarmeterImportExcel> needInsert = groupByStatus.get(false);
if (CollectionUtils.isNotEmpty(needInsert)){
List<IcVaccinePrarmeterEntity> entities = ConvertUtils.sourceToTarget(needInsert, IcVaccinePrarmeterEntity.class);
entities.forEach(e -> {
// 设置客户ID
e.setCustomerId(tokenDto.getCustomerId());
// 设置审核状态为待审核
e.setCheckState("0");
});
insertBatch(entities);
}
if (CollectionUtils.isNotEmpty(errorInfo)){
String url = importOssUpload(errorInfo, IcVaccinePrarmeterImportErrorModel.class);
closeTask(taskId,tokenDto.getUserId(), ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL,url);
}else {
closeTask(taskId,tokenDto.getUserId(),ImportTaskConstants.PROCESS_STATUS_FINISHED_SUCCESS,"");
}
}catch (Exception e){
log.error(e.getMessage());
closeTask(taskId,tokenDto.getUserId(),ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL,"");
}
}
/**
* 校验空单元格以及网格名称是否正确
* @param list
* @param errorInfo
* @param tokenDto
*/
public void checkInfo(List<IcVaccinePrarmeterImportExcel> list, List<IcVaccinePrarmeterImportErrorModel> errorInfo, TokenDto tokenDto){
LoginUserDetailsFormDTO form = new LoginUserDetailsFormDTO();
form.setUserId(tokenDto.getUserId());
form.setClient(tokenDto.getClient());
form.setApp(tokenDto.getApp());
LoginUserDetailsResultDTO userDetailsResultDTO = getResultDataOrThrowsException(userOpenFeignClient.getLoginUserDetails(form), ServiceConstant.EPMET_USER_SERVER,
EpmetErrorCode.SERVER_ERROR.getCode(),
"获取当前登录人组织id失败",
null);
for (int i = 0; i < list.size(); i++) {
list.get(i).setNum(i+1);
if (StringUtils.isBlank(list.get(i).getGridName()) && !list.get(i).getAddStatus()){
errorInfo.add(getErrorInfo(list.get(i), "所属网格不能为空",i+1));
list.get(i).setAddStatus(true);
continue;
}
if (StringUtils.isBlank(list.get(i).getVillageName()) && !list.get(i).getAddStatus()){
errorInfo.add(getErrorInfo(list.get(i), "所属小区不能为空",i+1));
list.get(i).setAddStatus(true);
continue;
}
if (StringUtils.isBlank(list.get(i).getBuildName()) && !list.get(i).getAddStatus()){
errorInfo.add(getErrorInfo(list.get(i), "所属楼宇不能为空",i+1));
list.get(i).setAddStatus(true);
continue;
}
if (StringUtils.isBlank(list.get(i).getUnitName()) && !list.get(i).getAddStatus()){
errorInfo.add(getErrorInfo(list.get(i), "单元不能为空",i+1));
list.get(i).setAddStatus(true);
continue;
}
if (StringUtils.isBlank(list.get(i).getHomeName()) && !list.get(i).getAddStatus()){
errorInfo.add(getErrorInfo(list.get(i), "门牌号不能为空",i+1));
list.get(i).setAddStatus(true);
continue;
}
if (StringUtils.isBlank(list.get(i).getName()) && !list.get(i).getAddStatus()){
errorInfo.add(getErrorInfo(list.get(i), "姓名不能为空",i+1));
list.get(i).setAddStatus(true);
continue;
}
if (StringUtils.isBlank(list.get(i).getIdCard()) && !list.get(i).getAddStatus()){
errorInfo.add(getErrorInfo(list.get(i), "证件号不能为空",i+1));
list.get(i).setAddStatus(true);
continue;
}
if (StringUtils.isBlank(list.get(i).getMobile()) && !list.get(i).getAddStatus()){
errorInfo.add(getErrorInfo(list.get(i), "咨询电话不能为空",i+1));
list.get(i).setAddStatus(true);
continue;
}
if (StringUtils.isBlank(list.get(i).getIsVaccination()) && !list.get(i).getAddStatus()){
errorInfo.add(getErrorInfo(list.get(i), "是否接种不能为空",i+1));
list.get(i).setAddStatus(true);
continue;
}
if("0".equals(list.get(i).getIsVaccination())){
// 未接种 判断是否填写原因
if (StringUtils.isBlank(list.get(i).getReason()) && !list.get(i).getAddStatus()){
errorInfo.add(getErrorInfo(list.get(i), "选择未接种时,原因不能为空",i+1));
list.get(i).setAddStatus(true);
continue;
}
if("其他原因".equals(list.get(i).getReason())){
// 未接种原因选择其他,判断是否填写备注
if (StringUtils.isBlank(list.get(i).getNote()) && !list.get(i).getAddStatus()){
errorInfo.add(getErrorInfo(list.get(i), "选择其他原因时,备注不能为空",i+1));
list.get(i).setAddStatus(true);
continue;
}
}
}else{
// 已接种 判断是否填写接种时间地点
if (StringUtils.isBlank(list.get(i).getFirstVacTime()) && !list.get(i).getAddStatus()){
errorInfo.add(getErrorInfo(list.get(i), "第一次接种时间不能为空",i+1));
list.get(i).setAddStatus(true);
continue;
}
if (StringUtils.isBlank(list.get(i).getFirstVacSite()) && !list.get(i).getAddStatus()){
errorInfo.add(getErrorInfo(list.get(i), "第一次接种地点不能为空",i+1));
list.get(i).setAddStatus(true);
continue;
}
if (StringUtils.isBlank(list.get(i).getSecondVacTime()) && !list.get(i).getAddStatus()){
errorInfo.add(getErrorInfo(list.get(i), "第二次接种时间不能为空",i+1));
list.get(i).setAddStatus(true);
continue;
}
if (StringUtils.isBlank(list.get(i).getSecondVacSite()) && !list.get(i).getAddStatus()){
errorInfo.add(getErrorInfo(list.get(i), "第二次接种地点不能为空",i+1));
list.get(i).setAddStatus(true);
continue;
}
if (StringUtils.isBlank(list.get(i).getThirdVacTime()) && !list.get(i).getAddStatus()){
errorInfo.add(getErrorInfo(list.get(i), "第三次接种时间不能为空",i+1));
list.get(i).setAddStatus(true);
continue;
}
if (StringUtils.isBlank(list.get(i).getThirdVacSite()) && !list.get(i).getAddStatus()){
errorInfo.add(getErrorInfo(list.get(i), "第三次接种地点不能为空",i+1));
list.get(i).setAddStatus(true);
continue;
}
}
// 校验所属网格通过名称能否匹配到ID
GridInfoVaccinePrarmeterFormDTO formDTO = new GridInfoVaccinePrarmeterFormDTO();
formDTO.setGridName(list.get(i).getGridName());
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setAgencyId(userDetailsResultDTO.getAgencyId());
Result<GridInfoByNameResultDTO> resultDTOResult = govOrgFeignClient.getGridInfoByGridName(formDTO);
GridInfoByNameResultDTO gridInfoByNameResultDTO = resultDTOResult.getData();
if(gridInfoByNameResultDTO == null && !list.get(i).getAddStatus()){
errorInfo.add(getErrorInfo(list.get(i), "所属网格匹配失败",i+1));
list.get(i).setAddStatus(true);
continue;
}else{
list.get(i).setGridId(gridInfoByNameResultDTO.getDeptId());
list.get(i).setAgencyId(gridInfoByNameResultDTO.getPid());
list.get(i).setPids(gridInfoByNameResultDTO.getPids());
}
}
}
/**
* Desc: 文件上传并返回url
* @param errorRows
* @param tClass
* @author wgf
* @date 2022/8/23 09:16
*/
public <T> String importOssUpload(Collection<?> errorRows, Class<T> tClass) throws IOException {
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("导入失败的数据列表","导入失败的数据列表"),
tClass, errorRows);
// 文件名
String resultDescFileName = UUID.randomUUID().toString().concat(".xls");
FileItemFactory factory = new DiskFileItemFactory(16, null);
FileItem fileItem = factory.createItem("file", ContentType.APPLICATION_OCTET_STREAM.toString(), true, resultDescFileName);
OutputStream os = fileItem.getOutputStream();
Result<UploadImgResultDTO> uploadResult = null;
try {
workbook.write(os);
uploadResult = ossFeignClient.uploadImportTaskDescFile(new CommonsMultipartFile(fileItem));
} catch (Exception e) {
String errormsg = ExceptionUtils.getErrorStackTrace(e);
log.error("上传错误描述文件:{}", errormsg);
} finally {
try {
os.close();
} catch (IOException e) {
String errormsg = ExceptionUtils.getErrorStackTrace(e);
log.error("上传错误描述文件关闭输出流:{}", errormsg);
}
try {
fileItem.delete();
} catch (Exception e) {
String errormsg = ExceptionUtils.getErrorStackTrace(e);
log.error("上传错误描述文件删除临时文件:{}", errormsg);
}
}
if (uploadResult == null || !uploadResult.success()) {
log.error("调用OSS上传结果描述文件失败");
return null;
}
return uploadResult.getData().getUrl();
}
/**
* Desc: 关闭任务
* @param taskId
* @param userId
* @param status
* @param url
* @author wgf
* @date 2022/8/23 09:05
*/
public void closeTask(String taskId,String userId,String status,String url){
ImportTaskCommonFormDTO input = new ImportTaskCommonFormDTO();
input.setOperatorId(userId);
input.setTaskId(taskId);
input.setProcessStatus(status);
input.setResultDescFilePath(url);
commonServiceOpenFeignClient.finishImportTask(input);
}
/**
* Desc: 构造错误信息
* @param dto
* @param info
* @param num
* @author wgf
* @date 2022/8/23 17:17
*/
public IcVaccinePrarmeterImportErrorModel getErrorInfo(IcVaccinePrarmeterImportExcel dto, String info, Integer num){
IcVaccinePrarmeterImportErrorModel result = ConvertUtils.sourceToTarget(dto, IcVaccinePrarmeterImportErrorModel.class);
result.setErrorMsg(info);
result.setNum(num);
return result;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void vaccineCheck(IcVaccineCheckFormDTO formDTO, TokenDto tokenDto) {
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(),tokenDto.getUserId());
formDTO.setRealName(staffInfo.getRealName());
// 获取新冠病毒疫苗接种人员信息台账表信息
IcVaccinePrarmeterEntity icVaccinePrarmeterEntity = baseDao.selectById(formDTO.getId());
// 更新审核信息
icVaccinePrarmeterEntity.setCheckState(formDTO.getCheckState());
icVaccinePrarmeterEntity.setCheckReason(formDTO.getCheckReason());
icVaccinePrarmeterEntity.setVillageId(formDTO.getVillageId());
icVaccinePrarmeterEntity.setBuildId(formDTO.getBuildId());
icVaccinePrarmeterEntity.setUnitId(formDTO.getUnitId());
icVaccinePrarmeterEntity.setHomeId(formDTO.getHomeId());
baseDao.updateById(icVaccinePrarmeterEntity);
// 审核状态:0待审核 1未通过 2已通过
if("2".equals(formDTO.getCheckState())){
String icResiUserId = "";
// 根据身份证号和房屋ID获取人员信息
IcResiUserEntity userIdCardEntity = queryOriginUserByIdCard(icVaccinePrarmeterEntity.getIdCard(),icVaccinePrarmeterEntity.getCustomerId());
if(StringUtils.isBlank(icVaccinePrarmeterEntity.getHomeId())){
// 新增房屋(新增房屋操作已在审核接口之前,前端调用新增接口实现)
// 更新登记表房屋ID
icVaccinePrarmeterEntity = updateHomeId(icVaccinePrarmeterEntity,formDTO);
if(userIdCardEntity != null){
icResiUserId = userIdCardEntity.getId();
// 已存在人员 人员房屋不一致(更新人员信息和变更记录)
updateUserInfo(icVaccinePrarmeterEntity,true,formDTO,userIdCardEntity);
}else{
// 不存在人员
icResiUserId = insertUserInfo(icVaccinePrarmeterEntity,formDTO);
}
}else{
// 更新房屋
updateHouseInfo(icVaccinePrarmeterEntity);
Map<String, IcResiUserEntity> userMap = queryOriginUserByHomeId(icVaccinePrarmeterEntity.getHomeId(),icVaccinePrarmeterEntity.getCustomerId());
if(userIdCardEntity != null){
icResiUserId = userIdCardEntity.getId();
// 已存在人员
if(userMap.containsKey(icVaccinePrarmeterEntity.getIdCard())){
// 人员房屋一致(只更新人员信息)
updateUserInfo(icVaccinePrarmeterEntity,false,formDTO,userIdCardEntity);
}else{
// 人员房屋不一致(更新人员信息和变更记录)
updateUserInfo(icVaccinePrarmeterEntity,true,formDTO,userIdCardEntity);
}
}else{
// 不存在人员
icResiUserId = insertUserInfo(icVaccinePrarmeterEntity,formDTO);
}
}
// 同步接种记录 and 疫苗接种记录关系
synchronizationVaccineInfo(icVaccinePrarmeterEntity,icResiUserId);
}
}
/**
* 同步接种记录 and 疫苗接种记录关系
* @param icVaccinePrarmeterEntity
* @param icResiUserId
*/
@SneakyThrows
private void synchronizationVaccineInfo(IcVaccinePrarmeterEntity icVaccinePrarmeterEntity,String icResiUserId){
if(!"1".equals(icVaccinePrarmeterEntity.getIsVaccination())){
return;
}
// 同步接种记录
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
// 处理第一次接种时间格式
String firstTime = icVaccinePrarmeterEntity.getFirstVacTime();
if(StringUtils.isBlank(firstTime)){
return;
}
Date firstDate = sdf.parse(firstTime);
icVaccinePrarmeterEntity.setFirstVacTime(sdf.format(firstDate));
// 查询第一次接种信息
List<IcVaccineEntity> icVaccineEntityFirstList = icVaccineDao.getVaccineListByIdCard(icVaccinePrarmeterEntity.getIdCard(),sdf.format(firstDate));
if(icVaccineEntityFirstList.size() > 0){
// 更新疫苗接种记录 and 疫苗接种记录关系
for(IcVaccineEntity entity : icVaccineEntityFirstList){
updateVaccineInfo(entity,icVaccinePrarmeterEntity);
}
}else{
// 新增疫苗接种记录 and 疫苗接种记录关系
insertVaccineInfo(icVaccinePrarmeterEntity,icResiUserId,firstDate);
}
// 处理第二次接种时间格式
String secondTime = icVaccinePrarmeterEntity.getSecondVacTime();
if(StringUtils.isBlank(secondTime)){
return;
}
Date secondDate = sdf.parse(secondTime);
icVaccinePrarmeterEntity.setSecondVacTime(sdf.format(secondDate));
// 查询第二次接种信息
List<IcVaccineEntity> icVaccineEntitySecondList = icVaccineDao.getVaccineListByIdCard(icVaccinePrarmeterEntity.getIdCard(),sdf.format(secondDate));
if(icVaccineEntitySecondList.size() > 0){
// 更新疫苗接种记录 and 疫苗接种记录关系
for(IcVaccineEntity entity : icVaccineEntitySecondList){
updateVaccineInfo(entity,icVaccinePrarmeterEntity);
}
}else{
// 新增疫苗接种记录 and 疫苗接种记录关系
insertVaccineInfo(icVaccinePrarmeterEntity,icResiUserId,firstDate);
}
// 处理第三次接种时间格式
String thirdTime = icVaccinePrarmeterEntity.getThirdVacTime();
if(StringUtils.isBlank(thirdTime)){
return;
}
Date thirdDate = sdf.parse(thirdTime);
icVaccinePrarmeterEntity.setThirdVacTime(sdf.format(thirdDate));
// 查询第三次接种信息
List<IcVaccineEntity> icVaccineEntityThirdList = icVaccineDao.getVaccineListByIdCard(icVaccinePrarmeterEntity.getIdCard(),sdf.format(thirdDate));
if(icVaccineEntityThirdList.size() > 0){
// 更新疫苗接种记录 and 疫苗接种记录关系
for(IcVaccineEntity entity : icVaccineEntityThirdList){
updateVaccineInfo(entity,icVaccinePrarmeterEntity);
}
}else{
// 新增疫苗接种记录 and 疫苗接种记录关系
insertVaccineInfo(icVaccinePrarmeterEntity,icResiUserId,firstDate);
}
}
/**
* 更新疫苗接种记录 and 疫苗接种记录关系
* @param entity
* @param icVaccinePrarmeterEntity
*/
private void updateVaccineInfo(IcVaccineEntity entity,IcVaccinePrarmeterEntity icVaccinePrarmeterEntity){
// 更新疫苗接种记录
entity.setInoculateAddress(icVaccinePrarmeterEntity.getFirstVacSite());
entity.setUserType("prarmeter");
entity.setCustomerId(icVaccinePrarmeterEntity.getCustomerId());
icVaccineDao.updateById(entity);
// 更新疫苗接种记录关系
IcVaccineRelationEntity icVaccineRelationEntity = new IcVaccineRelationEntity();
icVaccineRelationEntity.setIcVaccineId(entity.getId());
icVaccineRelationEntity.setUserType("prarmeter");
icVaccineRelationEntity.setCustomerId(icVaccinePrarmeterEntity.getCustomerId());
icVaccineRelationDao.updateRelationInfoByVaccineId(icVaccineRelationEntity);
}
/**
* 新增疫苗接种记录 and 疫苗接种记录关系
* @param icVaccinePrarmeterEntity
* @param icResiUserId
* @param time
*/
private void insertVaccineInfo(IcVaccinePrarmeterEntity icVaccinePrarmeterEntity,String icResiUserId,Date time){
IcVaccineEntity icVaccineEntity = new IcVaccineEntity();
icVaccineEntity.setCustomerId(icVaccinePrarmeterEntity.getCustomerId());
icVaccineEntity.setName(icVaccinePrarmeterEntity.getName());
icVaccineEntity.setMobile(icVaccinePrarmeterEntity.getMobile());
icVaccineEntity.setIdCard(icVaccinePrarmeterEntity.getIdCard());
icVaccineEntity.setIsResiUser("1");
icVaccineEntity.setUserType("prarmeter");
icVaccineEntity.setUserId(icResiUserId);
icVaccineEntity.setInoculateTime(time);
icVaccineEntity.setInoculateAddress(icVaccinePrarmeterEntity.getFirstVacSite());
icVaccineDao.insert(icVaccineEntity);
// 新增关系
IcVaccineRelationEntity icVaccineRelationEntity = new IcVaccineRelationEntity();
icVaccineRelationEntity.setCustomerId(icVaccinePrarmeterEntity.getCustomerId());
icVaccineRelationEntity.setAgencyId(icVaccinePrarmeterEntity.getAgencyId());
icVaccineRelationEntity.setPids(icVaccinePrarmeterEntity.getPids());
icVaccineRelationEntity.setIcVaccineId(icVaccineEntity.getId());
icVaccineRelationEntity.setUserType("prarmeter");
icVaccineRelationDao.insert(icVaccineRelationEntity);
}
/**
* 更新新冠病毒疫苗接种人员信息台账表房屋ID
* @param icVaccinePrarmeterEntity
* @param formDTO
* @return
*/
private IcVaccinePrarmeterEntity updateHomeId(IcVaccinePrarmeterEntity icVaccinePrarmeterEntity,IcVaccineCheckFormDTO formDTO){
// fegin获取房屋信息
GetHouseInfoToCollectFormDTO getHouseInfoToCollectFormDTO = new GetHouseInfoToCollectFormDTO();
getHouseInfoToCollectFormDTO.setBuildingUnitId(formDTO.getUnitId());
getHouseInfoToCollectFormDTO.setDoorName(formDTO.getHomeName());
Result<IcHouseInfoCollectResultDTO> resultDTOResult = govOrgFeignClient.getHouseInfoToCollect(getHouseInfoToCollectFormDTO);
IcHouseInfoCollectResultDTO icHouseInfoCollectResultDTO = resultDTOResult.getData();
// 新增房屋后需要collect更新上房屋ID
// log
icVaccinePrarmeterEntity.setHomeId(icHouseInfoCollectResultDTO.getId());
baseDao.updateById(icVaccinePrarmeterEntity);
return icVaccinePrarmeterEntity;
}
/**
* 更新房屋信息
* @param icVaccinePrarmeterEntity
*/
private void updateHouseInfo(IcVaccinePrarmeterEntity icVaccinePrarmeterEntity){
CollectHouseFormDTO collectHouseFormDTO = new CollectHouseFormDTO();
collectHouseFormDTO.setId(icVaccinePrarmeterEntity.getHomeId());
// fegin获取房屋信息
GetHouseInfoToCollectFormDTO getHouseInfoToCollectFormDTO = new GetHouseInfoToCollectFormDTO();
getHouseInfoToCollectFormDTO.setBuildingUnitId(icVaccinePrarmeterEntity.getUnitId());
getHouseInfoToCollectFormDTO.setDoorName(icVaccinePrarmeterEntity.getHomeName());
Result<IcHouseInfoCollectResultDTO> resultDTOResult = govOrgFeignClient.getHouseInfoToCollect(getHouseInfoToCollectFormDTO);
IcHouseInfoCollectResultDTO icHouseInfoCollectResultDTO = resultDTOResult.getData();
collectHouseFormDTO.setCustomerId(icVaccinePrarmeterEntity.getCustomerId());
collectHouseFormDTO.setResiNumber((icHouseInfoCollectResultDTO.getResiNumber() + 1));
collectHouseFormDTO.setRentFlag(icHouseInfoCollectResultDTO.getRentFlag());
collectHouseFormDTO.setOwnerName(icHouseInfoCollectResultDTO.getOwnerName());
govOrgFeignClient.updateCollect(collectHouseFormDTO);
}
/**
* 获取人员信息
* @param idCard
* @return
*/
private IcResiUserEntity queryOriginUserByIdCard(String idCard,String customerId) {
LambdaQueryWrapper<IcResiUserEntity> query = new LambdaQueryWrapper<>();
query.eq(IcResiUserEntity::getIdCard, idCard);
query.eq(IcResiUserEntity::getCustomerId, customerId);
IcResiUserEntity originUser = icResiUserDao.selectOne(query);
return originUser;
}
private Map<String, IcResiUserEntity> queryOriginUserByHomeId(String homeId,String customerId) {
LambdaQueryWrapper<IcResiUserEntity> query = new LambdaQueryWrapper<>();
query.eq(IcResiUserEntity::getHomeId, homeId);
query.eq(IcResiUserEntity::getCustomerId, customerId);
List<IcResiUserEntity> originUserList = icResiUserDao.selectList(query);
Map<String, IcResiUserEntity> memMap = originUserList.stream().collect(Collectors.toMap(IcResiUserEntity::getIdCard, Function.identity()));
return memMap;
}
/**
* 更新人员信息
* @param icVaccinePrarmeterEntity 登记信息
* @param isUpdateLog 是否更新记录
* @param formDTO 入参
* @param userEntity 根据身份证号查询到的user信息
*/
private void updateUserInfo(IcVaccinePrarmeterEntity icVaccinePrarmeterEntity,Boolean isUpdateLog,
IcVaccineCheckFormDTO formDTO,IcResiUserEntity userEntity){
userEntity.setPids(icVaccinePrarmeterEntity.getPids()); // ic_resi_user表的组织的pids 含agencyId本身
userEntity.setAgencyId(icVaccinePrarmeterEntity.getAgencyId());
userEntity.setGridId(icVaccinePrarmeterEntity.getGridId());
userEntity.setVillageId(icVaccinePrarmeterEntity.getVillageId());
userEntity.setBuildId(icVaccinePrarmeterEntity.getBuildId());
userEntity.setUnitId(icVaccinePrarmeterEntity.getUnitId());
userEntity.setHomeId(icVaccinePrarmeterEntity.getHomeId());
userEntity.setName(icVaccinePrarmeterEntity.getName());
userEntity.setMobile(icVaccinePrarmeterEntity.getMobile());
userEntity.setIdCard(icVaccinePrarmeterEntity.getIdCard());
icResiUserDao.updateById(userEntity);
// 判断是否需要更新记录
if(isUpdateLog){
//变更记录表
IcUserChangeRecordEntity changeRecordEntity = new IcUserChangeRecordEntity();
changeRecordEntity.setCustomerId(icVaccinePrarmeterEntity.getCustomerId());
changeRecordEntity.setOperatorId(formDTO.getUserId());
changeRecordEntity.setIcUserId(userEntity.getId());
changeRecordEntity.setOperatorName(formDTO.getRealName());
changeRecordEntity.setIcUserName(userEntity.getName());
changeRecordEntity.setType("update");
changeRecordEntity.setTypeName("修改");
changeRecordEntity.setBeforeChangeName("-");
changeRecordEntity.setAfterChangeName("-");
changeRecordEntity.setChangeTime(new java.util.Date());
icUserChangeRecordService.insert(changeRecordEntity);
}
}
/**
* 新增人员信息
* @param icVaccinePrarmeterEntity
* @param formDTO
*/
private String insertUserInfo(IcVaccinePrarmeterEntity icVaccinePrarmeterEntity,IcVaccineCheckFormDTO formDTO){
// 新增人员
IcResiUserEntity userEntity = new IcResiUserEntity();
userEntity.setPids(icVaccinePrarmeterEntity.getPids()); // ic_resi_user表的组织的pids 含agencyId本身
userEntity.setAgencyId(icVaccinePrarmeterEntity.getAgencyId());
userEntity.setGridId(icVaccinePrarmeterEntity.getGridId());
userEntity.setVillageId(icVaccinePrarmeterEntity.getVillageId());
userEntity.setBuildId(icVaccinePrarmeterEntity.getBuildId());
userEntity.setUnitId(icVaccinePrarmeterEntity.getUnitId());
userEntity.setHomeId(icVaccinePrarmeterEntity.getHomeId());
userEntity.setName(icVaccinePrarmeterEntity.getName());
userEntity.setMobile(icVaccinePrarmeterEntity.getMobile());
userEntity.setIdCard(icVaccinePrarmeterEntity.getIdCard());
userEntity.setCustomerId(icVaccinePrarmeterEntity.getCustomerId());
icResiUserDao.insert(userEntity);
//变更记录表
IcUserChangeRecordEntity changeRecordEntity = new IcUserChangeRecordEntity();
changeRecordEntity.setCustomerId(icVaccinePrarmeterEntity.getCustomerId());
changeRecordEntity.setOperatorId(formDTO.getUserId());
changeRecordEntity.setIcUserId(userEntity.getId());
changeRecordEntity.setOperatorName(formDTO.getRealName());
changeRecordEntity.setIcUserName(userEntity.getName());
changeRecordEntity.setType("add");
changeRecordEntity.setTypeName("新增");
changeRecordEntity.setBeforeChangeName("-");
changeRecordEntity.setAfterChangeName("-");
changeRecordEntity.setChangeTime(new java.util.Date());
icUserChangeRecordService.insert(changeRecordEntity);
return userEntity.getId();
}
}

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

@ -37,10 +37,10 @@ import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.RegisterRelationDTO;
import com.epmet.dto.UserResiInfoDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.NewUserRoleResultDTO;
import com.epmet.dto.result.UserBaseInfoResultDTO;
import com.epmet.dto.result.UserInfoOnEnterGridResultDTO;
import com.epmet.dto.result.UserResiInfoResultDTO;
import com.epmet.dto.result.NewUserRoleResultDTO;
import com.epmet.entity.RegisterRelationEntity;
import com.epmet.entity.UserCustomerEntity;
import com.epmet.feign.GovOrgFeignClient;
@ -212,8 +212,14 @@ public class RegisterRelationServiceImpl extends BaseServiceImpl<RegisterRelatio
registerRelationToSave.setFirstRegister(NumConstant.ZERO_STR);
registerRelationToSave.setRegister(NumConstant.ZERO_STR);
registerRelationToSave.setParticipation(NumConstant.ONE_STR);
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(gridId);
if(gridInfo != null){
//将要进入的网格id 对应的组织信息放进去
registerRelationToSave.setAgencyId(gridInfo.getPid());
registerRelationToSave.setAgencyIdPath(gridInfo.getPids());
baseDao.insert(registerRelationToSave);
}
baseDao.insert(registerRelationToSave);
}else{
//不存在相同客户不同网格的注册记录(既在这个客户下没有过register_relation记录,没有进过这个客户的网格,这是第一次进入这个客户下的网格)
Optional<RegisterRelationEntity> registerRecordWithDiffCustAndGrid =

8
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java

@ -194,16 +194,16 @@ public class UserBaseInfoServiceImpl extends BaseServiceImpl<UserBaseInfoDao, Us
if(null!=baseInfo){
//为了保证传过来的user数量与返回的一致,就算查出的用户信息为空也要添加进集合里
//if(null != baseInfo && StringUtils.isNotBlank(baseInfo.getId())){
if (StringUtils.isNotBlank(baseInfo.getStreet()) && StringUtils.isNotBlank(baseInfo.getSurname())) {
if (StringUtils.isNotBlank(baseInfo.getSurname())) {
if ("1".equals(baseInfo.getGender())) {
// 男
baseInfo.setUserShowName(baseInfo.getStreet().concat(StrConstant.HYPHEN).concat(baseInfo.getSurname().concat("先生")));
baseInfo.setUserShowName(baseInfo.getSurname().concat("先生"));
} else if ("2".equals(baseInfo.getGender())) {
// 女
baseInfo.setUserShowName(baseInfo.getStreet().concat(StrConstant.HYPHEN).concat(baseInfo.getSurname().concat("女士")));
baseInfo.setUserShowName(baseInfo.getSurname().concat("女士"));
} else {
// 0 未知
baseInfo.setUserShowName(baseInfo.getStreet().concat(StrConstant.HYPHEN).concat(baseInfo.getSurname().concat("女士/先生")));
baseInfo.setUserShowName(baseInfo.getSurname().concat("女士/先生"));
}
} else {
// 社会为微信昵称

19
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java

@ -26,10 +26,13 @@ import com.epmet.commons.tools.constant.EpmetRoleKeyConstant;
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.enums.IdCardTypeEnum;
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.utils.ConvertUtils;
import com.epmet.commons.tools.utils.IdCardRegexUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.SmsTemplateConstant;
import com.epmet.constant.UserConstant;
@ -173,8 +176,8 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, Us
resultDTO.setBuildingAddress(userBaseInfoResultDTO.getBuildingAddress());
resultDTO.setNickName(userBaseInfoResultDTO.getNickname());
resultDTO.setShowName(StrConstant.EPMETY_STR);
if (StringUtils.isNotBlank(userBaseInfoResultDTO.getStreet()) && StringUtils.isNotBlank(userBaseInfoResultDTO.getSurname())){
String gender = null;
if (StringUtils.isNotBlank(userBaseInfoResultDTO.getSurname())){
String gender;
if (NumConstant.ONE_STR.equals(userBaseInfoResultDTO.getGender())) {
gender = UserConstant.MAN;
} else if (NumConstant.TWO_STR.equals(userBaseInfoResultDTO.getGender())) {
@ -182,7 +185,7 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, Us
} else {
gender = UserConstant.MAN_WOMAN;
}
String leaderName = userBaseInfoResultDTO.getStreet().concat(StrConstant.HYPHEN).concat(userBaseInfoResultDTO.getSurname()).concat(gender);
String leaderName = userBaseInfoResultDTO.getSurname().concat(gender);
resultDTO.setShowName(leaderName);
}
@ -243,6 +246,16 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, Us
*/
@Transactional(rollbackFor = Exception.class)
public void saveUserResiInfo(UserResiInfoDTO userResiInfoDTO) {
if (StringUtils.isNotBlank(userResiInfoDTO.getIdNum())) {
// 证件类型判断----start----
IdCardRegexUtils regex = IdCardRegexUtils.parse(userResiInfoDTO.getIdNum());
if (regex == null) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "证件号解析错误", "证件号解析错误");
}
// 证件类型判断----end----
}
//1:注册信息表新增数据
baseDao.insert(ConvertUtils.sourceToTarget(userResiInfoDTO, UserResiInfoEntity.class));
//更新该用户在该客户下的注册状态

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

Loading…
Cancel
Save