diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java index f3dd1c5833..58109b1b89 100644 --- a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java +++ b/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"; /** * 工作日志导入 */ diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CheckHouseInfoFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CheckHouseInfoFormDTO.java new file mode 100644 index 0000000000..106952e90c --- /dev/null +++ b/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; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CheckHomeInfoResultInfo.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CheckHomeInfoResultInfo.java new file mode 100644 index 0000000000..ab4bc4d963 --- /dev/null +++ b/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; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridInfoByNameResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridInfoByNameResultDTO.java new file mode 100644 index 0000000000..fd91d086b5 --- /dev/null +++ b/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; +} + diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java index 73316bad52..c1aba9bb3c 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java +++ b/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 + * @Author wgf + * @Description 根据网格名称查询所属组织信息 + * @Date 2022/6/21 22:41 + **/ + @PostMapping("getGridInfoByGridName") + public Result getGridInfoByGridName(@RequestBody GridInfoVaccinePrarmeterFormDTO formDTO) { + return customerAgencyService.getGridInfoByGridName(formDTO); + } + /** * @param userId * @return com.epmet.commons.tools.utils.Result diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcHouseController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcHouseController.java index 49e3f15f92..6d828df25a 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcHouseController.java +++ b/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> getOwnerHouseList(@RequestBody IcHouseDTO formDTO){ return new Result>().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); + + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java index b54b4a28b7..37e8d93c98 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java +++ b/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 { CommunityInfoResultDTO getCommunityInfo(OrgInfoPointFormDTO formDTO); + GridInfoByNameResultDTO getGridInfoByGridName(GridInfoVaccinePrarmeterFormDTO formDTO); + CommunityInfoResultDTO getCommunityInfoByUserId(@Param("userId") String userId); /** diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingDao.java index d48d12b987..4e963af722 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingDao.java @@ -21,6 +21,7 @@ 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; @@ -235,4 +236,12 @@ public interface IcBuildingDao extends BaseDao { */ List listBuildingInfo(IcNeighborHoodDTO dto); + + /** + * 根据楼宇名称查询楼宇信息 + * @param formDTO + * @return + */ + IcBuildingEntity getBuildingInfoByName(CheckHouseInfoFormDTO formDTO); + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingUnitDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingUnitDao.java index 09c40920ed..ebc8c2f888 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingUnitDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingUnitDao.java @@ -18,6 +18,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 { * @return com.epmet.dto.result.OrganizationCommunityDTO */ OrganizationCommunityDTO selectCommunityByUnitId(@Param("unitId") String unitId); + + /** + * 根据单元名称查询单元信息 + * @param formDTO + * @return + */ + IcBuildingUnitEntity getbuildingUnitInfoByName(CheckHouseInfoFormDTO formDTO); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java index 3ae10791bf..e8e8157256 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java @@ -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 { */ IcHouseInfoCollectResultDTO getHouseInfoToCollect(GetHouseInfoToCollectFormDTO formDTO); + /** + * 校验房屋 + * @param formDTO + * @return + */ + IcHouseEntity getHouseInfoByName(CheckHouseInfoFormDTO formDTO); + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcNeighborHoodDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcNeighborHoodDao.java index ee7361724d..afe0374247 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcNeighborHoodDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcNeighborHoodDao.java @@ -21,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.*; @@ -212,4 +213,11 @@ public interface IcNeighborHoodDao extends BaseDao { */ List getHouseList(HouseInformationFormDTO formDTO); + + /** + * 根据名称查小区信息 + * @param formDTO + * @return + */ + IcNeighborHoodEntity getNeighborHoodInfoByName(CheckHouseInfoFormDTO formDTO); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java index bec4188167..e71189e0ad 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java @@ -327,6 +327,15 @@ public interface CustomerAgencyService extends BaseService **/ Result getCommunityInfo(OrgInfoPointFormDTO formDTO); + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author wgf + * @Description 根据网格名称查询所属组织信息 + * @Date 2022/6/21 22:41 + **/ + Result getGridInfoByGridName(GridInfoVaccinePrarmeterFormDTO formDTO); + /** * @param userId * @return com.epmet.commons.tools.utils.Result diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcHouseService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcHouseService.java index 522acba117..77a5bdd4ad 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcHouseService.java +++ b/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 { * @Date 2022/7/19 17:41 */ List getOwnerHouseList(IcHouseDTO formDTO); + + /** + * 根据小区,楼宇,单元名称校验是否存在 + * @param formDTO + * @return + */ + Result checkHomeInfo(CheckHouseInfoFormDTO formDTO); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index f2c0392dc7..760f9690ad 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -1580,6 +1580,13 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl().ok(communityInfoResultDTO); } + @Override + public Result getGridInfoByGridName(GridInfoVaccinePrarmeterFormDTO formDTO) { + GridInfoByNameResultDTO gridInfoByNameResultDTO = baseDao.getGridInfoByGridName(formDTO); + + return new Result().ok(gridInfoByNameResultDTO); + } + @Override public Result getCommunityInfoByUserId(String userId) { CommunityInfoResultDTO communityInfoResultDTO = baseDao.getCommunityInfoByUserId(userId); diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java index e8de32ecce..933a07daeb 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java @@ -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()); } /** diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java index d31a2cbb54..76df21476b 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java +++ b/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 icHouseRedis.getHouseInfo(item.getId(), item.getCustomerId())).collect(Collectors.toList()); } + + @Override + public Result 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().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().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().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().ok(checkHomeInfoResultInfo); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml index acf894391f..8493df5d81 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml @@ -916,6 +916,21 @@ limit 1 + + + + diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingUnitDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingUnitDao.xml index fe5a0ef73b..c46c387e01 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingUnitDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingUnitDao.xml @@ -59,5 +59,16 @@ and u.id=#{unitId} + + diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml index 6098775330..5d6fbe270f 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml @@ -550,5 +550,14 @@ and DOOR_NAME = #{doorName} + + diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml index d972dd5e06..96ec0dd57f 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml @@ -662,5 +662,15 @@ ORDER BY SORT, DOOR_NAME+0 + diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcVaccinePrarmeterDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcVaccinePrarmeterDTO.java index 08c5da3ce1..a7d56eeec7 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcVaccinePrarmeterDTO.java +++ b/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; -} \ No newline at end of file + /** + * 审核状态:0待审核 1审核不通过 2审核通过 + */ + private String checkState; + private String checkStateName; + + /** + * 审核理由 + */ + private String checkReason; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/GridInfoVaccinePrarmeterFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/GridInfoVaccinePrarmeterFormDTO.java new file mode 100644 index 0000000000..18e124e529 --- /dev/null +++ b/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; + + + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcVaccineCheckFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcVaccineCheckFormDTO.java new file mode 100644 index 0000000000..7eb317b62e --- /dev/null +++ b/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; + + + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VaccinePrarmeterListFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VaccinePrarmeterListFormDTO.java new file mode 100644 index 0000000000..4fbc71217b --- /dev/null +++ b/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; + + + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVaccinePrarmeterController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVaccinePrarmeterController.java index 102e5e0ea7..674686ca73 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVaccinePrarmeterController.java +++ b/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> page(@RequestParam Map params){ - PageData page = icVaccinePrarmeterService.page(params); +// PageData page = icVaccinePrarmeterService.page(params); + PageData page = icVaccinePrarmeterService.getPhrasePage(params); return new Result>().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 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 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(); + } + + + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineDao.java index d4db61ad5b..55b4591be3 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineDao.java @@ -64,4 +64,12 @@ public interface IcVaccineDao extends BaseDao { IcVaccineDTO getVaccineDTO(@Param("customerId") String customerId, @Param("icVaccineId") String icVaccineId, @Param("idCard") String idCard, @Param("inoculateTime") String inoculateTime); + /** + * 根据身份证号以及接种时间查询接种信息 + * @param idCard + * @param time + * @return + */ + List getVaccineListByIdCard(@Param("idCard") String idCard,@Param("time") String time); + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccinePrarmeterDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccinePrarmeterDao.java index a2e7c17a67..c5bdfcdbf7 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccinePrarmeterDao.java +++ b/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 { - -} \ No newline at end of file + + List vaccineExport(VaccinePrarmeterListFormDTO formDTO); + + /** + * 条件查询 + * @param params + * @return + */ + List getPhrasePage(Map params); + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineRelationDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineRelationDao.java index 60d80b3f61..6d087a1055 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineRelationDao.java +++ b/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 { int delRelation(@Param("icVaccineId") String icNatId, @Param("agencyId") String agencyId); -} \ No newline at end of file + + void updateRelationInfoByVaccineId(IcVaccineRelationEntity icVaccineRelationEntity); + + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcVaccinePrarmeterEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcVaccinePrarmeterEntity.java index c5dde0c103..c6b982f80d 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcVaccinePrarmeterEntity.java +++ b/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; + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcVaccinePrarmeterExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcVaccinePrarmeterExcel.java index dc58b059b3..06cb0b9e15 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcVaccinePrarmeterExcel.java +++ b/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; -} \ No newline at end of file +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcVaccinePrarmeterImportExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcVaccinePrarmeterImportExcel.java new file mode 100644 index 0000000000..3d9ed7a6a7 --- /dev/null +++ b/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; + + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/error/IcVaccinePrarmeterImportErrorModel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/error/IcVaccinePrarmeterImportErrorModel.java new file mode 100644 index 0000000000..8cce05d852 --- /dev/null +++ b/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; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java index be03fdfc96..dd77ffba06 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java +++ b/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 getCommunityInfo(OrgInfoPointFormDTO formDTO); + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author wgf + * @Description 根据网格名称查询所属网格信息 + * @Date 2020/4/26 23:16 + **/ + @PostMapping("/gov/org/customeragency/getGridInfoByGridName") + Result getGridInfoByGridName(GridInfoVaccinePrarmeterFormDTO formDTO); + /** * @param userId * @return com.epmet.commons.tools.utils.Result diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java index 77d306b310..a89cf10924 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java +++ b/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 getGridInfoByGridName(GridInfoVaccinePrarmeterFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getGridInfoByGridName",formDTO); + } + @Override public Result getCommunityInfoByUserId(String userId) { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getCommunityInfoByUserId",userId); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcPointNucleicMonitoringService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcPointNucleicMonitoringService.java index 8aaf21fe7d..70d92655a5 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcPointNucleicMonitoringService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcPointNucleicMonitoringService.java @@ -91,8 +91,8 @@ public interface IcPointNucleicMonitoringService extends BaseService page(Map params); + /** + * 分页条件查询 + * @param params + * @return + */ + PageData getPhrasePage(Map params); + /** * 默认查询 * @@ -75,4 +86,20 @@ public interface IcVaccinePrarmeterService extends BaseService implements IcVaccinePrarmeterService { +@Slf4j +public class IcVaccinePrarmeterServiceImpl extends BaseServiceImpl 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 page(Map params) { IPage page = baseDao.selectPage( @@ -41,6 +118,18 @@ public class IcVaccinePrarmeterServiceImpl extends BaseServiceImpl getPhrasePage(Map params) { + IPage page = getPage(params); + List list = baseDao.getPhrasePage(params); + return new PageData<>(list, page.getTotal()); + } + @Override public List list(Map params) { List entityList = baseDao.selectList(getWrapper(params)); @@ -66,14 +155,26 @@ public class IcVaccinePrarmeterServiceImpl extends BaseServiceImpl errorInfo = new ArrayList<>(); + + try { + List 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 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> groupByStatus = list.stream().collect(Collectors.groupingBy(IcVaccinePrarmeterImportExcel::getAddStatus)); + List needInsert = groupByStatus.get(false); + if (CollectionUtils.isNotEmpty(needInsert)){ + List 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 list, List 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 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 String importOssUpload(Collection errorRows, Class 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 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 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 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 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 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 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 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 query = new LambdaQueryWrapper<>(); + query.eq(IcResiUserEntity::getIdCard, idCard); + query.eq(IcResiUserEntity::getCustomerId, customerId); + IcResiUserEntity originUser = icResiUserDao.selectOne(query); + return originUser; + } + + private Map queryOriginUserByHomeId(String homeId,String customerId) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(IcResiUserEntity::getHomeId, homeId); + query.eq(IcResiUserEntity::getCustomerId, customerId); + List originUserList = icResiUserDao.selectList(query); + Map 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(); + + } + +} diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.67__add_ic_vaccine_prarmeter.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.67__add_ic_vaccine_prarmeter.sql new file mode 100644 index 0000000000..f009d72b0a --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.67__add_ic_vaccine_prarmeter.sql @@ -0,0 +1,38 @@ +CREATE TABLE `ic_vaccine_prarmeter` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户Id customer.id', + `GRID_ID` varchar(64) DEFAULT NULL COMMENT '网格ID', + `GRID_NAME` varchar(255) DEFAULT NULL COMMENT '网格名称', + `AGENCY_ID` varchar(64) DEFAULT NULL COMMENT '组织Id', + `PIDS` varchar(255) DEFAULT NULL COMMENT '组织的pids', + `VILLAGE_ID` varchar(64) DEFAULT NULL COMMENT '所属小区ID;', + `VILLAGE_NAME` varchar(64) DEFAULT NULL COMMENT '所属小区名称', + `BUILD_ID` varchar(64) DEFAULT NULL COMMENT '所属楼宇Id', + `BUILD_NAME` varchar(64) DEFAULT NULL COMMENT '所属楼宇名称', + `UNIT_ID` varchar(64) DEFAULT NULL COMMENT '单元id', + `UNIT_NAME` varchar(64) DEFAULT NULL COMMENT '单元名', + `HOME_ID` varchar(64) DEFAULT NULL COMMENT '所属家庭Id', + `HOME_NAME` varchar(64) DEFAULT NULL COMMENT '房间名', + `HOUSEHOLD_TYPE` varchar(255) DEFAULT NULL COMMENT '户口性质:0户籍 1外来', + `NAME` varchar(64) NOT NULL COMMENT '姓名', + `MOBILE` varchar(15) DEFAULT NULL COMMENT '联系电话', + `ID_CARD` varchar(18) NOT NULL COMMENT '身份证号', + `IS_VACCINATION` varchar(1) DEFAULT NULL COMMENT '是否接种:0否1是', + `FIRST_VAC_TIME` varchar(64) DEFAULT NULL COMMENT '第一次接种时间', + `FIRST_VAC_SITE` varchar(10) DEFAULT NULL COMMENT '第一次接种地点', + `SECOND_VAC_TIME` varchar(64) DEFAULT NULL COMMENT '第二次接种时间', + `SECOND_VAC_SITE` varchar(10) DEFAULT NULL COMMENT '第二次接种地点', + `THIRD_VAC_TIME` varchar(64) DEFAULT NULL COMMENT '第三次接种时间', + `THIRD_VAC_SITE` varchar(10) DEFAULT NULL COMMENT '第三次接种地点', + `REASON` varchar(255) DEFAULT NULL COMMENT '原因:禁忌症/拒绝接种/其他原因', + `NOTE` varchar(255) DEFAULT NULL COMMENT '备注', + `DEL_FLAG` int(11) NOT NULL DEFAULT '0' COMMENT '删除标识 0.未删除 1.已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + `CHECK_STATE` varchar(1) DEFAULT NULL COMMENT '审核状态:0待审核 1审核不通过 2审核通过', + `CHECK_REASON` varchar(255) DEFAULT NULL COMMENT '审核理由', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='新冠病毒疫苗接种人员信息台账'; diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/ic_vaccine_prarmeter_excel.xls b/epmet-user/epmet-user-server/src/main/resources/excel/ic_vaccine_prarmeter_excel.xls new file mode 100644 index 0000000000..539b291220 Binary files /dev/null and b/epmet-user/epmet-user-server/src/main/resources/excel/ic_vaccine_prarmeter_excel.xls differ diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccineDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccineDao.xml index 0ed766fb77..b8113074cf 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccineDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccineDao.xml @@ -174,4 +174,13 @@ m.ID_CARD = t.ID_CARD AND m.DEL_FLAG = '0' + + diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccinePrarmeterDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccinePrarmeterDao.xml index 363554832c..b06633761b 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccinePrarmeterDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccinePrarmeterDao.xml @@ -39,5 +39,147 @@ + - \ No newline at end of file + + + + diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccineRelationDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccineRelationDao.xml index 011c1c7de1..acaf54c95f 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccineRelationDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccineRelationDao.xml @@ -12,5 +12,10 @@ AND AGENCY_ID = #{agencyId} + + update ic_vaccine_relation + set CUSTOMER_ID = #{customerId},USER_TYPE = #{userType} + where IC_VACCINE_ID = #{icVaccineId} + - \ No newline at end of file +