From 1a17b0205bd9571acd3573eeee408bfd0fa61979 Mon Sep 17 00:00:00 2001 From: "java_cuibaocheng@163.com" Date: Mon, 13 Nov 2023 16:50:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=BA=E5=8F=A3=E5=9F=BA=E6=9C=AC=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E5=A2=9E=E5=8A=A0=E9=80=80=E4=BC=91=E7=9A=84=E5=B0=B1?= =?UTF-8?q?=E4=B8=9A=E7=8A=B6=E6=80=81=20=E4=BA=BA=E5=8F=A3=E5=9F=BA?= =?UTF-8?q?=E6=9C=AC=E4=BF=A1=E6=81=AF=E5=A2=9E=E5=8A=A0=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E9=80=89=E6=8B=A9=20=E4=BA=BA=E5=8F=A3=E5=9F=BA=E6=9C=AC?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=A2=9E=E5=8A=A0=E5=88=97=E8=A1=A8=E8=84=B1?= =?UTF-8?q?=E6=95=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PopulationInfoController.java | 32 ++++- .../PopulationInfoAppController.java | 29 +++- .../populationinfo/PopulationInfoBaseDTO.java | 21 +++ .../populationinfo/PopulationInfoDTO.java | 23 +++ .../PopulationInfoLabelDTO.java | 65 +++++++++ .../vos/populationinfo/PopulationInfoVO.java | 10 ++ .../IPopulationInfoService.java | 3 + .../impl/PopulationInfoServiceImpl.java | 134 +++++++++++++++++- .../cm/population/utils/IdCardVerifyUtil.java | 35 +++++ .../populationinfo/population-info-mapper.xml | 8 ++ .../templates/populationinfo/importexcel.html | 14 +- .../populationinfo/list-creator.html | 29 ++++ .../templates/populationinfo/list.html | 15 +- .../templates/populationinfo/save.html | 39 ++++- .../templates/populationinfo/update.html | 39 ++++- 15 files changed, 479 insertions(+), 17 deletions(-) create mode 100644 src/main/java/com/cm/population/pojo/dtos/populationinfo/PopulationInfoLabelDTO.java diff --git a/src/main/java/com/cm/population/controller/api/populationinfo/PopulationInfoController.java b/src/main/java/com/cm/population/controller/api/populationinfo/PopulationInfoController.java index 22877a6..159a35f 100644 --- a/src/main/java/com/cm/population/controller/api/populationinfo/PopulationInfoController.java +++ b/src/main/java/com/cm/population/controller/api/populationinfo/PopulationInfoController.java @@ -20,6 +20,7 @@ import com.cm.common.result.SuccessResultList; import com.cm.common.utils.UUIDUtil; import com.cm.population.pojo.dtos.population.PopulationDTO; import com.cm.population.pojo.dtos.populationinfo.PopulationInfoDTO; +import com.cm.population.pojo.dtos.populationinfo.PopulationInfoLabelDTO; import com.cm.population.pojo.vos.populationinfo.PopulationInfoVO; import com.cm.population.service.populationinfo.IPopulationInfoService; import com.cm.population.utils.IdCardVerifyUtil; @@ -54,6 +55,20 @@ public class PopulationInfoController extends AbstractController { @Autowired private IDataDictionaryService iDataDictionaryService; + + @ApiOperation(value = "人口标签", notes = "人口标签") + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("label") + public List getLabel() { + List list = iDataDictionaryService.listDictionaryByParentId("5ea50f00-3d76-492c-8680-9c30d50cce21"); + List dataList = new ArrayList<>(); + for(DataDictionaryDTO dto : list) { + PopulationInfoLabelDTO D = new PopulationInfoLabelDTO(dto.getDictionaryId(), dto.getDictionaryName(), dto.getDictionarySummary(), dto.getDictionarySort()); + dataList.add(D); + } + return dataList; + } + @Autowired private FileProperties fileProperties; @ApiOperation(value = "Excel导入", notes = "Excel导入接口") @@ -261,6 +276,11 @@ public class PopulationInfoController extends AbstractController { }else{ identityMap.put(idcard, currentLineNumber); } + // 验证号码长度 + if (!StringUtil.isEmpty(phone) && phone.length() != 11) { + resultMap.put(currentLineNumber + "", "手机号码错误"); + return; + } // 验证户籍地址 DataAreaDTO dataAreaDTO = populationInfoService.getAreaByCode(domicileAreaCode); if (dataAreaDTO == null) { @@ -476,7 +496,11 @@ public class PopulationInfoController extends AbstractController { public SuccessResultList> listPage(ListPage page) { Map params = requestParams(); page.setParams(params); - return populationInfoService.listPage(page); + SuccessResultList> pageList = populationInfoService.listPage(page); + for(PopulationInfoDTO dto : pageList.getRows()) { + populationInfoService.getTuoMin(dto); + } + return pageList; } @ApiOperation(value = "基础人口信息统计", notes = "基础人口信息统计接口") @@ -494,7 +518,11 @@ public class PopulationInfoController extends AbstractController { @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("list/house-id/{houseId}") public List listByHouseId(@PathVariable("houseId") String houseId) { - return populationInfoService.listByHouseId(houseId); + List list = populationInfoService.listByHouseId(houseId); + for(PopulationInfoDTO dto : list) { + populationInfoService.getTuoMin(dto); + } + return list; } } \ No newline at end of file diff --git a/src/main/java/com/cm/population/controller/app/api/populationinfo/PopulationInfoAppController.java b/src/main/java/com/cm/population/controller/app/api/populationinfo/PopulationInfoAppController.java index a57c21d..c2ec7ac 100644 --- a/src/main/java/com/cm/population/controller/app/api/populationinfo/PopulationInfoAppController.java +++ b/src/main/java/com/cm/population/controller/app/api/populationinfo/PopulationInfoAppController.java @@ -3,17 +3,24 @@ package com.cm.population.controller.app.api.populationinfo; import com.cm.common.annotation.CheckRequestBodyAnnotation; import com.cm.common.base.AbstractController; import com.cm.common.constants.ISystemConstant; +import com.cm.common.plugin.pojo.dtos.datadictionary.DataDictionaryDTO; +import com.cm.common.plugin.service.datadictionary.IDataDictionaryService; import com.cm.common.pojo.ListPage; import com.cm.common.result.ErrorResult; import com.cm.common.result.SuccessResult; import com.cm.common.result.SuccessResultData; import com.cm.common.result.SuccessResultList; import com.cm.population.pojo.dtos.populationinfo.PopulationInfoDTO; +import com.cm.population.pojo.dtos.populationinfo.PopulationInfoLabelDTO; import com.cm.population.pojo.vos.populationinfo.PopulationInfoVO; import com.cm.population.service.populationinfo.IPopulationInfoService; +import com.cm.population.utils.IdCardVerifyUtil; +import com.github.pagehelper.util.StringUtil; import io.swagger.annotations.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; + +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -33,6 +40,22 @@ public class PopulationInfoAppController extends AbstractController { @Autowired private IPopulationInfoService populationInfoService; + @Autowired + private IDataDictionaryService iDataDictionaryService; + + @ApiOperation(value = "人口标签", notes = "人口标签") + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("label" + ISystemConstant.RELEASE_SUFFIX) + public List getLabel() { + List list = iDataDictionaryService.listDictionaryByParentId("5ea50f00-3d76-492c-8680-9c30d50cce21"); + List dataList = new ArrayList<>(); + for(DataDictionaryDTO dto : list) { + PopulationInfoLabelDTO D = new PopulationInfoLabelDTO(dto.getDictionaryId(), dto.getDictionaryName(), dto.getDictionarySummary(), dto.getDictionarySort()); + dataList.add(D); + } + return dataList; + } + @ApiOperation(value = "新增基础人口信息", notes = "新增基础人口信息接口") @ApiImplicitParams({ @ApiImplicitParam(name = "token", value = "token", paramType = "header") @@ -116,7 +139,11 @@ public class PopulationInfoAppController extends AbstractController { public SuccessResultList> listPage(@RequestHeader("token") String token, ListPage page) { Map params = requestParams(); page.setParams(params); - return populationInfoService.listPage(page); + SuccessResultList> pageList = populationInfoService.listPage(page); + for(PopulationInfoDTO dto : pageList.getRows()) { + populationInfoService.getTuoMin(dto); + } + return pageList; } @ApiOperation(value = "基础人口信息分页列表", notes = "基础人口信息分页列表接口") diff --git a/src/main/java/com/cm/population/pojo/dtos/populationinfo/PopulationInfoBaseDTO.java b/src/main/java/com/cm/population/pojo/dtos/populationinfo/PopulationInfoBaseDTO.java index 28977ef..e1f4f4f 100644 --- a/src/main/java/com/cm/population/pojo/dtos/populationinfo/PopulationInfoBaseDTO.java +++ b/src/main/java/com/cm/population/pojo/dtos/populationinfo/PopulationInfoBaseDTO.java @@ -7,6 +7,7 @@ import org.apache.commons.lang3.StringUtils; import java.time.LocalDate; import java.time.Period; +import java.util.List; @ApiModel public class PopulationInfoBaseDTO { @@ -45,6 +46,10 @@ public class PopulationInfoBaseDTO { private String name; @ApiModelProperty(name = "idcard", value = "证件") private String idcard; + @ApiModelProperty(name = "label", value = "标签") + private String label; + @ApiModelProperty(name = "labelList", value = "标签集合") + private List labelList; @ApiModelProperty(name = "healthStatus", value = "健康状况") private String healthStatus; @ApiModelProperty(name = "idcardType", value = "证件类型") @@ -64,6 +69,22 @@ public class PopulationInfoBaseDTO { @ApiModelProperty(name = "创建人", value = "创建人") private String creator; + public List getLabelList() { + return labelList; + } + + public void setLabelList(List labelList) { + this.labelList = labelList; + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + public String getCreator() { return creator; } diff --git a/src/main/java/com/cm/population/pojo/dtos/populationinfo/PopulationInfoDTO.java b/src/main/java/com/cm/population/pojo/dtos/populationinfo/PopulationInfoDTO.java index ce4039e..b005baa 100644 --- a/src/main/java/com/cm/population/pojo/dtos/populationinfo/PopulationInfoDTO.java +++ b/src/main/java/com/cm/population/pojo/dtos/populationinfo/PopulationInfoDTO.java @@ -4,6 +4,9 @@ import com.cm.common.annotation.CheckEmptyAnnotation; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; + /** * * @ClassName: PopulationInfoDTO @@ -19,6 +22,10 @@ public class PopulationInfoDTO { private String populationInfoId; @ApiModelProperty(name = "name", value = "姓名") private String name; + @ApiModelProperty(name = "label", value = "标签") + private String label; + @ApiModelProperty(name = "labelList", value = "标签集合") + private List labelList; @ApiModelProperty(name = "idcard", value = "证件") private String idcard; @ApiModelProperty(name = "idcardType", value = "证件类型") @@ -171,6 +178,22 @@ public class PopulationInfoDTO { @ApiModelProperty(name = "创建人", value = "创建人") private String creator; + public List getLabelList() { + return labelList == null ? new ArrayList() : labelList; + } + + public void setLabelList(List labelList) { + this.labelList = labelList; + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + public String getCreator() { return creator; } diff --git a/src/main/java/com/cm/population/pojo/dtos/populationinfo/PopulationInfoLabelDTO.java b/src/main/java/com/cm/population/pojo/dtos/populationinfo/PopulationInfoLabelDTO.java new file mode 100644 index 0000000..c02ef79 --- /dev/null +++ b/src/main/java/com/cm/population/pojo/dtos/populationinfo/PopulationInfoLabelDTO.java @@ -0,0 +1,65 @@ +package com.cm.population.pojo.dtos.populationinfo; + +import com.cm.common.annotation.CheckEmptyAnnotation; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * + * @ClassName: PopulationInfoLabelDTO + * @Description: 基础人口信息标签(数据字典) + * @Author: CodeFactory + * @Date: 2023-10-24 11:55:46 + * @Version: 3.0 + **/ +@ApiModel +public class PopulationInfoLabelDTO { + + @ApiModelProperty(name = "id", value = "标签Id") + private String id; + @ApiModelProperty(name = "name", value = "标签名称") + private String name; + @ApiModelProperty(name = "color", value = "标签颜色") + private String color; + @ApiModelProperty(name = "order", value = "排序") + private String order; + + public PopulationInfoLabelDTO(String id, String name, String color, String order) { + this.id = id; + this.name = name; + this.color = color; + this.order = order; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getOrder() { + return order; + } + + public void setOrder(String order) { + this.order = order; + } +} diff --git a/src/main/java/com/cm/population/pojo/vos/populationinfo/PopulationInfoVO.java b/src/main/java/com/cm/population/pojo/vos/populationinfo/PopulationInfoVO.java index a36d408..e741886 100644 --- a/src/main/java/com/cm/population/pojo/vos/populationinfo/PopulationInfoVO.java +++ b/src/main/java/com/cm/population/pojo/vos/populationinfo/PopulationInfoVO.java @@ -20,6 +20,8 @@ public class PopulationInfoVO { @ApiModelProperty(name = "name", value = "姓名") @CheckEmptyAnnotation(name = "姓名") private String name; + @ApiModelProperty(name = "label", value = "标签") + private String label; @ApiModelProperty(name = "idcard", value = "证件") @CheckEmptyAnnotation(name = "证件") private String idcard; @@ -180,6 +182,14 @@ public class PopulationInfoVO { @ApiModelProperty(name = "othertext", value = "其他说明") private String othertext; + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + public String getDepartmentType() { return departmentType == null ? "" : departmentType; } diff --git a/src/main/java/com/cm/population/service/populationinfo/IPopulationInfoService.java b/src/main/java/com/cm/population/service/populationinfo/IPopulationInfoService.java index c4c6468..695a49c 100644 --- a/src/main/java/com/cm/population/service/populationinfo/IPopulationInfoService.java +++ b/src/main/java/com/cm/population/service/populationinfo/IPopulationInfoService.java @@ -23,6 +23,9 @@ import java.util.Map; public interface IPopulationInfoService { public List getAreaList(); + void getTuoMin(PopulationInfoDTO dto); + void getTuoMin(PopulationInfoBaseDTO dto); + DataAreaDTO getAreaByCode(String code); DataAreaDTO getAreaById(String id); List listAreaTree(String parentId); diff --git a/src/main/java/com/cm/population/service/populationinfo/impl/PopulationInfoServiceImpl.java b/src/main/java/com/cm/population/service/populationinfo/impl/PopulationInfoServiceImpl.java index b089f46..56b6ec9 100644 --- a/src/main/java/com/cm/population/service/populationinfo/impl/PopulationInfoServiceImpl.java +++ b/src/main/java/com/cm/population/service/populationinfo/impl/PopulationInfoServiceImpl.java @@ -3,7 +3,9 @@ package com.cm.population.service.populationinfo.impl; import com.cm.common.base.AbstractService; import com.cm.common.exception.SaveException; import com.cm.common.plugin.pojo.dtos.dataarea.DataAreaDTO; +import com.cm.common.plugin.pojo.dtos.datadictionary.DataDictionaryDTO; import com.cm.common.plugin.service.dataarea.IDataAreaService; +import com.cm.common.plugin.service.datadictionary.IDataDictionaryService; import com.cm.common.pojo.ListPage; import com.cm.common.result.SuccessResultList; import com.cm.common.token.app.AppTokenManager; @@ -20,6 +22,7 @@ import com.cm.population.pojo.dtos.drug.DrugDTO; import com.cm.population.pojo.dtos.petition.PetitionDTO; import com.cm.population.pojo.dtos.populationinfo.PopulationInfoBaseDTO; import com.cm.population.pojo.dtos.populationinfo.PopulationInfoDTO; +import com.cm.population.pojo.dtos.populationinfo.PopulationInfoLabelDTO; import com.cm.population.pojo.dtos.release.ReleaseDTO; import com.cm.population.pojo.dtos.security.SecurityDTO; import com.cm.population.pojo.vos.populationinfo.PopulationInfoVO; @@ -36,6 +39,7 @@ import com.cm.population.service.security.ISecurityService; import com.cm.population.utils.IdCardVerifyUtil; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.github.pagehelper.util.StringUtil; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -78,6 +82,78 @@ public class PopulationInfoServiceImpl extends AbstractService implements IPopul return list; } + @Override + public void getTuoMin(PopulationInfoDTO dto) { + String idcard = dto.getIdcard(); + String name = dto.getName(); + String phone = dto.getPhone(); + String birthday = dto.getBirthday(); + if (dto.getIdcardType().contains("身份证")) { + String idCardNumber = IdCardVerifyUtil.desensitizeIdCardNumber(idcard); + dto.setIdcard(idCardNumber); + } + if (!StringUtil.isEmpty(phone) && phone.length() == 11) { + if(phone.startsWith("0")) { + String newPhone = phone.substring(0, 4) + "****" + phone.substring(8, 11); + dto.setPhone(newPhone); + }else{ + String newPhone = phone.substring(0, 3) + "****" + phone.substring(7, 11); + dto.setPhone(newPhone); + } + } + if (!StringUtil.isEmpty(birthday)) { + String newBirthday = IdCardVerifyUtil.desensitizeBirthday(birthday); + dto.setBirthday(newBirthday); + } + if (name.length() > 2) { + String xin = ""; + for(int i = 0; i < name.length() - 2; i++) { + xin = xin + "*"; + } + String newName = name.substring(0, 1) + xin + name.substring(name.length()-1, name.length()); + dto.setName(newName); + }else{ + String newName = name.substring(0, 1); + dto.setName(newName); + } + } + + @Override + public void getTuoMin(PopulationInfoBaseDTO dto) { + String idcard = dto.getIdcard(); + String name = dto.getName(); + String phone = dto.getPhone(); + String birthday = dto.getBirthday(); + if (dto.getIdcardType().contains("身份证")) { + String idCardNumber = IdCardVerifyUtil.desensitizeIdCardNumber(idcard); + dto.setIdcard(idCardNumber); + } + if (!StringUtil.isEmpty(phone) && phone.length() == 11) { + if(phone.startsWith("0")) { + String newPhone = phone.substring(0, 4) + "****" + phone.substring(8, 11); + dto.setPhone(newPhone); + }else{ + String newPhone = phone.substring(0, 3) + "****" + phone.substring(7, 11); + dto.setPhone(newPhone); + } + } + if (!StringUtil.isEmpty(birthday)) { + String newBirthday = IdCardVerifyUtil.desensitizeBirthday(birthday); + dto.setBirthday(newBirthday); + } + if (name.length() > 2) { + String xin = ""; + for(int i = 0; i < name.length() - 2; i++) { + xin = xin + "*"; + } + String newName = name.substring(0, 1) + xin + name.substring(name.length()-1, name.length()); + dto.setName(newName); + }else{ + String newName = name.substring(0, 1); + dto.setName(newName); + } + } + @Override public List listAreaTree(String parentId) { Map params = new HashMap<>(); @@ -127,6 +203,17 @@ public class PopulationInfoServiceImpl extends AbstractService implements IPopul dto.setIsPetition(petition.size() > 0 ? "是" : "否"); dto.setIsRelease(release.size() > 0 ? "是" : "否"); dto.setIsSecurity(security.size() > 0 ? "是" : "否"); + if (dto != null && !StringUtil.isEmpty(dto.getLabel()) && dto.getLabel().length() > 0) { + List list = iDataDictionaryService.listDictionaryByParentId("5ea50f00-3d76-492c-8680-9c30d50cce21"); + List dataList = new ArrayList<>(); + for(DataDictionaryDTO dto1 : list) { + if (dto.getLabel().contains(dto1.getDictionaryId())) { + PopulationInfoLabelDTO D = new PopulationInfoLabelDTO(dto1.getDictionaryId(), dto1.getDictionaryName(), dto1.getDictionarySummary(), dto1.getDictionarySort()); + dataList.add(D); + } + } + dto.setLabelList(dataList); + } return dto; } @@ -157,6 +244,9 @@ public class PopulationInfoServiceImpl extends AbstractService implements IPopul throw new SaveException("该证件号码错误"); } } + if (populationInfoVO.getName().length() < 2) { + throw new SaveException("姓名错误"); + } String areaCode = populationInfoVO.getDomicileAreaCode(); if(areaCode.startsWith("150271")) { //包头稀土高新技术产业开发区 populationInfoVO.setDomicileAddressType("3"); @@ -165,6 +255,10 @@ public class PopulationInfoServiceImpl extends AbstractService implements IPopul }else { //非包头市 populationInfoVO.setDomicileAddressType("1"); } + // 验证号码长度 + if (!StringUtil.isEmpty(populationInfoVO.getPhone()) && populationInfoVO.getPhone().length() != 11) { + throw new SaveException("手机号码错误"); + } Map params = HashMapUtil.objectToMap(populationInfoVO); params.put("populationInfoId", populationInfoId); if(StringUtils.isEmpty(token)) { @@ -222,6 +316,9 @@ public class PopulationInfoServiceImpl extends AbstractService implements IPopul throw new SaveException("该证件号码错误"); } } + if (populationInfoVO.getName().length() < 2) { + throw new SaveException("姓名错误"); + } String areaCode = populationInfoVO.getDomicileAreaCode(); if(areaCode.startsWith("150271")) { //包头稀土高新技术产业开发区 populationInfoVO.setDomicileAddressType("3"); @@ -230,6 +327,10 @@ public class PopulationInfoServiceImpl extends AbstractService implements IPopul }else { //非包头市 populationInfoVO.setDomicileAddressType("1"); } + // 验证号码长度 + if (!StringUtil.isEmpty(populationInfoVO.getPhone()) && populationInfoVO.getPhone().length() != 11) { + throw new SaveException("手机号码错误"); + } params.put("populationInfoId", populationInfoId); if(StringUtils.isEmpty(token)) { setUpdateInfo(params); @@ -239,9 +340,24 @@ public class PopulationInfoServiceImpl extends AbstractService implements IPopul populationInfoDao.update(params); } + @Autowired + private IDataDictionaryService iDataDictionaryService; + @Override public PopulationInfoDTO get(Map params) { - return populationInfoDao.get(params); + PopulationInfoDTO populationInfoDTO = populationInfoDao.get(params); + if (populationInfoDTO != null && !StringUtil.isEmpty(populationInfoDTO.getLabel()) && populationInfoDTO.getLabel().length() > 0) { + List list = iDataDictionaryService.listDictionaryByParentId("5ea50f00-3d76-492c-8680-9c30d50cce21"); + List dataList = new ArrayList<>(); + for(DataDictionaryDTO dto : list) { + if (populationInfoDTO.getLabel().contains(dto.getDictionaryId())) { + PopulationInfoLabelDTO D = new PopulationInfoLabelDTO(dto.getDictionaryId(), dto.getDictionaryName(), dto.getDictionarySummary(), dto.getDictionarySort()); + dataList.add(D); + } + } + populationInfoDTO.setLabelList(dataList); + } + return populationInfoDTO; } @Override @@ -284,7 +400,21 @@ public class PopulationInfoServiceImpl extends AbstractService implements IPopul @Override public List list(Map params) { - return populationInfoDao.list(params); + List listList = populationInfoDao.list(params); + List list = iDataDictionaryService.listDictionaryByParentId("5ea50f00-3d76-492c-8680-9c30d50cce21"); + for(PopulationInfoDTO populationInfoDTO : listList) { + if (populationInfoDTO != null && !StringUtil.isEmpty(populationInfoDTO.getLabel()) && populationInfoDTO.getLabel().length() > 0) { + List dataList = new ArrayList<>(); + for(DataDictionaryDTO dto : list) { + if (populationInfoDTO.getLabel().contains(dto.getDictionaryId())) { + PopulationInfoLabelDTO D = new PopulationInfoLabelDTO(dto.getDictionaryId(), dto.getDictionaryName(), dto.getDictionarySummary(), dto.getDictionarySort()); + dataList.add(D); + } + } + populationInfoDTO.setLabelList(dataList); + } + } + return listList; } @Override diff --git a/src/main/java/com/cm/population/utils/IdCardVerifyUtil.java b/src/main/java/com/cm/population/utils/IdCardVerifyUtil.java index 2aa1354..bfa2710 100644 --- a/src/main/java/com/cm/population/utils/IdCardVerifyUtil.java +++ b/src/main/java/com/cm/population/utils/IdCardVerifyUtil.java @@ -60,6 +60,41 @@ public class IdCardVerifyUtil { } + public static String desensitizeBirthday(String birthday) { + if (birthday.length() < 8) { + return birthday; + } + StringBuilder sb = new StringBuilder(); + sb.append(birthday.substring(0, 3)); + sb.append("*"); + sb.append("-"); + sb.append("*"); + sb.append("*"); + sb.append("-"); + sb.append(birthday.substring(birthday.length() - 2)); + return sb.toString(); + } + + public static String desensitizeIdCardNumber(String idCardNumber) { + if (idCardNumber.length() < 15 || idCardNumber.length() > 18) { + return idCardNumber; + } + StringBuilder sb = new StringBuilder(); + sb.append(idCardNumber.substring(0, 6)); + if (idCardNumber.length() == 15) { + for (int i = 0; i < idCardNumber.length() - 8; i++) { + sb.append("*"); + } + sb.append(idCardNumber.substring(idCardNumber.length() - 3)); + }else { + for (int i = 0; i < idCardNumber.length() - 10; i++) { + sb.append("*"); + } + sb.append(idCardNumber.substring(idCardNumber.length() - 4)); + } + return sb.toString(); + } + /** * 身份证验证 *@param certNo 号码内容 diff --git a/src/main/resources/mybatis/mapper/populationinfo/population-info-mapper.xml b/src/main/resources/mybatis/mapper/populationinfo/population-info-mapper.xml index be7ab0e..2b1353e 100644 --- a/src/main/resources/mybatis/mapper/populationinfo/population-info-mapper.xml +++ b/src/main/resources/mybatis/mapper/populationinfo/population-info-mapper.xml @@ -6,6 +6,7 @@ + @@ -24,6 +25,7 @@ + @@ -243,6 +245,7 @@ population_info_id, name, idcard, + label, idcard_type, birthday, sex, @@ -322,6 +325,7 @@ #{populationInfoId}, #{name}, #{idcard}, + #{label}, #{idcardType}, #{birthday}, #{sex}, @@ -426,6 +430,7 @@ name = #{name}, + label = #{label}, idcard = #{idcard}, @@ -653,6 +658,7 @@ SELECT t1.population_info_id, t1.name, + t1.label, t1.idcard, t1.idcard_type, t1.health_status, @@ -686,6 +692,7 @@ SELECT t1.population_info_id, t1.name, + t1.label, t1.idcard, t1.idcard_type, t1.birthday, @@ -938,6 +945,7 @@ t1.population_info_id, t1.name, t1.idcard, + t1.label, t1.idcard_type, t1.birthday, t1.sex, diff --git a/src/main/resources/templates/populationinfo/importexcel.html b/src/main/resources/templates/populationinfo/importexcel.html index 06e6c36..c90fb57 100644 --- a/src/main/resources/templates/populationinfo/importexcel.html +++ b/src/main/resources/templates/populationinfo/importexcel.html @@ -26,11 +26,11 @@ @@ -42,7 +42,7 @@
-

注意  : 导入的Excel文件后缀只支持.xlsx , 带红色*号的是必填项 , 参考选项仅供导入者作为编辑Excel内容的参考 , 导入时不需要选择。

+

注意  : 导入的Excel文件后缀只支持.xlsx , 带红色*号的是必填项 , 参考选项仅供导入者作为编辑Excel内容的参考 , 导入时不需要选择。 * 单次Excel最多支持10000条数据导入

@@ -51,7 +51,7 @@
- +
@@ -59,9 +59,9 @@
- +
- +
@@ -271,7 +271,7 @@ // 初始化证件类型下拉选择 function initIdcardTypeSelect(selectValue) { - top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/360d6062-754d-4d43-95ba-cb9938102050', []), {}, null, function(code, data, args) { + top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/76c5044f-805a-4313-b1e8-79e966b97c0d', []), {}, null, function(code, data, args) { laytpl(document.getElementById('idcardTypeSelectTemplate').innerHTML).render(data, function(html) { document.getElementById('idcardTypeSelectTemplateBox').innerHTML = html; }); diff --git a/src/main/resources/templates/populationinfo/list-creator.html b/src/main/resources/templates/populationinfo/list-creator.html index e824510..5c15857 100644 --- a/src/main/resources/templates/populationinfo/list-creator.html +++ b/src/main/resources/templates/populationinfo/list-creator.html @@ -52,6 +52,9 @@ + + + @@ -192,6 +195,19 @@ } return rowData; } + }, + {field: 'label', width: 380, title: '标签', align:'center', + templet: function(row) { + var rowData = row['labelList']; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + var b = ""; + for(var i = 0 ; i < rowData.length; i++) { + b = b + ''; + } + return b; + } } ] ], @@ -306,6 +322,19 @@ } removeData(ids); } + } else if(layEvent === 'excelEvent') { + top.layer.open({ + type: 2, + title: false, + closeBtn: 1, + area: ['70%', '90%'], + shadeClose: true, + anim: 2, + content: top.restAjax.path('route/populationinfo/importexcel', []), + end: function() { + reloadTable(); + } + }); } else if(layEvent === 'correctEvent') { if(checkDatas.length === 0) { top.dialog.msg(top.dataMessage.table.selectEdit); diff --git a/src/main/resources/templates/populationinfo/list.html b/src/main/resources/templates/populationinfo/list.html index 70f50aa..a839106 100644 --- a/src/main/resources/templates/populationinfo/list.html +++ b/src/main/resources/templates/populationinfo/list.html @@ -52,7 +52,7 @@ - '; + } + return b; + } } ] ], diff --git a/src/main/resources/templates/populationinfo/save.html b/src/main/resources/templates/populationinfo/save.html index af50b71..8b1df46 100644 --- a/src/main/resources/templates/populationinfo/save.html +++ b/src/main/resources/templates/populationinfo/save.html @@ -222,6 +222,7 @@ +
@@ -278,6 +279,19 @@ +
+
+
+ +
+ +
+
+
@@ -1083,7 +1097,7 @@ // 初始化证件类型下拉选择 function initIdcardTypeSelect(selectValue) { - top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/360d6062-754d-4d43-95ba-cb9938102050', []), {}, null, function(code, data, args) { + top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/76c5044f-805a-4313-b1e8-79e966b97c0d', []), {}, null, function(code, data, args) { laytpl(document.getElementById('idcardTypeSelectTemplate').innerHTML).render(data, function(html) { document.getElementById('idcardTypeSelectTemplateBox').innerHTML = html; }); @@ -1129,6 +1143,25 @@ }); } + // 初始化标签 + function initLabelSelect(selectValues) { + top.restAjax.get(top.restAjax.path('api/populationinfo/label', []), {}, null, function(code, data, args) { + laytpl(document.getElementById('labelSelectTemplate').innerHTML).render(data, function(html) { + document.getElementById('labelSelectTemplateBox').innerHTML = html; + }); + form.render('checkbox', 'labelSelectTemplateBox') + + var checkboxValue = selectValues.split(','); + var checkboxObj = {}; + for(var j = 0, checkbox = checkboxValue[j]; checkbox = checkboxValue[j++];) { + checkboxObj['label['+ checkbox +']'] = true; + } + form.val('dataForm', checkboxObj); + }, function(code, data) { + top.dialog.msg(data.msg); + }); + } + // 初始化文化程度下拉选择 function initEducationSelect(selectValue) { top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/d6b9f026-6ea9-456a-b48b-0c18d502523b', []), {}, null, function(code, data, args) { @@ -1436,7 +1469,7 @@ // 身份证号改变时发生 $('#idcard').on("input propertychange", function () { var idCardNo = $(this).val(); - if (idCardNo.length > 15) { + if (idCardNo.length > 15 && idCardNo.length < 18) { if (idCardNoUtil.checkIdCardNo(idCardNo)) { //获取身份证信息 var idCardInfo = idCardNoUtil.getIdCardInfo(idCardNo); @@ -1504,6 +1537,7 @@ initIdcardTypeSelect(data['idcardType']); initSexSelect(data['sex']); initNationSelect(data['nation']); + initLabelSelect(data['label']); initEducationSelect(data['education']); initOrganizationSelect(data['organization']); initReligionSelect(data['religion']); @@ -1554,6 +1588,7 @@ top.dialog.confirm(top.dataMessage.commit, function(index) { top.dialog.close(index); var loadLayerIndex; + formData.field['label'] = top.restAjax.checkBoxToString(formData.field, 'label'); top.restAjax.post(top.restAjax.path('api/populationinfo/save', []), formData.field, null, function(code, data) { var layerIndex = top.dialog.msg(top.dataMessage.commitSuccess, { time: 0, diff --git a/src/main/resources/templates/populationinfo/update.html b/src/main/resources/templates/populationinfo/update.html index 46aa543..af015d4 100644 --- a/src/main/resources/templates/populationinfo/update.html +++ b/src/main/resources/templates/populationinfo/update.html @@ -221,6 +221,7 @@ +
@@ -277,6 +278,19 @@ +
+
+
+ +
+ +
+
+
@@ -995,7 +1009,7 @@ // 初始化证件类型下拉选择 function initIdcardTypeSelect(selectValue) { - top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/360d6062-754d-4d43-95ba-cb9938102050', []), {}, null, function(code, data, args) { + top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/76c5044f-805a-4313-b1e8-79e966b97c0d', []), {}, null, function(code, data, args) { laytpl(document.getElementById('idcardTypeSelectTemplate').innerHTML).render(data, function(html) { document.getElementById('idcardTypeSelectTemplateBox').innerHTML = html; }); @@ -1041,6 +1055,25 @@ }); } + // 初始化标签 + function initLabelSelect(selectValues) { + top.restAjax.get(top.restAjax.path('api/populationinfo/label', []), {}, null, function(code, data, args) { + laytpl(document.getElementById('labelSelectTemplate').innerHTML).render(data, function(html) { + document.getElementById('labelSelectTemplateBox').innerHTML = html; + }); + form.render('checkbox', 'labelSelectTemplateBox') + + var checkboxValue = selectValues.split(','); + var checkboxObj = {}; + for(var j = 0, checkbox = checkboxValue[j]; checkbox = checkboxValue[j++];) { + checkboxObj['label['+ checkbox +']'] = true; + } + form.val('dataForm', checkboxObj); + }, function(code, data) { + top.dialog.msg(data.msg); + }); + } + // 初始化文化程度下拉选择 function initEducationSelect(selectValue) { top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/d6b9f026-6ea9-456a-b48b-0c18d502523b', []), {}, null, function(code, data, args) { @@ -1348,7 +1381,7 @@ // 身份证号改变时发生 $('#idcard').on("input propertychange", function () { var idCardNo = $(this).val(); - if (idCardNo.length > 15) { + if (idCardNo.length > 15 && idCardNo.length < 18) { if (idCardNoUtil.checkIdCardNo(idCardNo)) { //获取身份证信息 var idCardInfo = idCardNoUtil.getIdCardInfo(idCardNo); @@ -1417,6 +1450,7 @@ initIdcardTypeSelect(data['idcardType']); initSexSelect(data['sex']); initNationSelect(data['nation']); + initLabelSelect(data['label']); initEducationSelect(data['education']); initOrganizationSelect(data['organization']); initReligionSelect(data['religion']); @@ -1472,6 +1506,7 @@ top.dialog.confirm(top.dataMessage.commit, function(index) { top.dialog.close(index); var loadLayerIndex; + formData.field['label'] = top.restAjax.checkBoxToString(formData.field, 'label'); top.restAjax.put(top.restAjax.path('api/populationinfo/update/{populationInfoId}', [populationInfoId]), formData.field, null, function(code, data) { var layerIndex = top.dialog.msg(top.dataMessage.updateSuccess, { time: 0,