15 changed files with 797 additions and 2 deletions
			
			
		| @ -0,0 +1,41 @@ | |||
| package com.epmet.dto.form; | |||
| 
 | |||
| import lombok.Data; | |||
| 
 | |||
| import javax.validation.constraints.NotNull; | |||
| import java.io.Serializable; | |||
| 
 | |||
| /** | |||
|  * @Author zxc | |||
|  * @DateTime 2022/3/18 19:00 | |||
|  * @DESC | |||
|  */ | |||
| @Data | |||
| public class CollectListFormDTO implements Serializable { | |||
| 
 | |||
|     private static final long serialVersionUID = 2106773724057183577L; | |||
| 
 | |||
|     public interface CollectListForm{} | |||
| 
 | |||
|     @NotNull(message = "pageNo不能为空", groups = CollectListForm.class) | |||
|     private Integer pageNo; | |||
| 
 | |||
|     @NotNull(message = "pageSize不能为空", groups = CollectListForm.class) | |||
|     private Integer pageSize; | |||
| 
 | |||
|     private String orgId; | |||
|     private String neighborHoodId; | |||
|     private String buildingId; | |||
|     private String houseId; | |||
|     private String address; | |||
| 
 | |||
|     /** | |||
|      * 格式:yyyy-mm-dd | |||
|      */ | |||
|     private String startDate; | |||
|     private String endDate; | |||
| 
 | |||
|     private String userId; | |||
|     private String customerId; | |||
| 
 | |||
| } | |||
| @ -0,0 +1,105 @@ | |||
| package com.epmet.dto.form; | |||
| 
 | |||
| import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; | |||
| import lombok.Data; | |||
| 
 | |||
| import javax.validation.Valid; | |||
| import javax.validation.constraints.NotBlank; | |||
| import javax.validation.constraints.NotEmpty; | |||
| import javax.validation.constraints.NotNull; | |||
| import java.io.Serializable; | |||
| import java.util.List; | |||
| 
 | |||
| /** | |||
|  * 收集居民信息入参 | |||
|  */ | |||
| @Data | |||
| public class IcResiCollectFormDTO implements Serializable { | |||
|     public interface AddUserInternalGroup { | |||
|     } | |||
| 
 | |||
|     public interface InternalShowGroup extends CustomerClientShowGroup { | |||
|     } | |||
| 
 | |||
|     public interface ExternalShowGroup extends CustomerClientShowGroup { | |||
|     } | |||
| 
 | |||
|     /** | |||
|      * 客户Id customer.id | |||
|      */ | |||
|     @NotBlank(message = "customerId不能为空", groups = AddUserInternalGroup.class) | |||
|     private String customerId; | |||
| 
 | |||
|     /** | |||
|      * 内部:internal;外部:external | |||
|      */ | |||
|     @NotBlank(message = "兴德路社区:internal;其他社区:external", groups = AddUserInternalGroup.class) | |||
|     private String origin; | |||
| 
 | |||
|     /** | |||
|      * 网格ID_后端接口赋值 | |||
|      */ | |||
|     private String gridId; | |||
| 
 | |||
|     /** | |||
|      * 组织Id_后端接口赋值 | |||
|      */ | |||
|     private String agencyId; | |||
| 
 | |||
|     /** | |||
|      * 组织的pid_后端接口赋值 | |||
|      */ | |||
|     private String pids; | |||
| 
 | |||
|     /** | |||
|      * 所属小区ID | |||
|      */ | |||
|     @NotBlank(message = "小区不能为空", groups = InternalShowGroup.class) | |||
|     private String villageId; | |||
| 
 | |||
|     /** | |||
|      * 所属楼宇Id | |||
|      */ | |||
|     @NotBlank(message = "楼栋不能为空", groups = InternalShowGroup.class) | |||
|     private String buildId; | |||
| 
 | |||
|     /** | |||
|      * 单元id | |||
|      */ | |||
|     @NotBlank(message = "单元不能为空", groups = InternalShowGroup.class) | |||
|     private String unitId; | |||
| 
 | |||
|     /** | |||
|      * 所属家庭Id | |||
|      */ | |||
|     @NotBlank(message = "家庭不能为空", groups = InternalShowGroup.class) | |||
|     private String homeId; | |||
| 
 | |||
|     /** | |||
|      * 详细地址 | |||
|      */ | |||
|     @NotBlank(message = "家庭地址不能为空", groups = {InternalShowGroup.class, ExternalShowGroup.class}) | |||
|     private String address; | |||
| 
 | |||
|     /** | |||
|      * 1自由0租住 | |||
|      */ | |||
|     @NotNull(message = "房子属于自由还是组织?", groups = {InternalShowGroup.class, ExternalShowGroup.class}) | |||
|     private Integer houseType; | |||
| 
 | |||
|     /** | |||
|      * 户主姓名 | |||
|      */ | |||
|     @NotBlank(message = "户主姓名不能为空", groups = {InternalShowGroup.class, ExternalShowGroup.class}) | |||
|     private String houseHolderName; | |||
| 
 | |||
|     /** | |||
|      * 居住成员人数 | |||
|      */ | |||
|     @NotNull(message = "居住成员人数不能为空", groups = {InternalShowGroup.class, ExternalShowGroup.class}) | |||
|     private Integer totalResi; | |||
| 
 | |||
|     @Valid | |||
|     @NotEmpty(message = "成员信息不能为空", groups = {InternalShowGroup.class, ExternalShowGroup.class}) | |||
|     private List<IcResiCollectMemFormDTO> memberList; | |||
| } | |||
| @ -0,0 +1,37 @@ | |||
| package com.epmet.dto.form; | |||
| 
 | |||
| import lombok.Data; | |||
| 
 | |||
| import java.io.Serializable; | |||
| 
 | |||
| @Data | |||
| public class IcResiCollectMemFormDTO implements Serializable { | |||
|     /** | |||
|      * 客户Id customer.id | |||
|      */ | |||
|     private String customerId; | |||
|     /** | |||
|      * 居住成员1姓名 | |||
|      */ | |||
|     private String name; | |||
| 
 | |||
|     /** | |||
|      * 居住成员1身份证号 | |||
|      */ | |||
|     private String idNum; | |||
| 
 | |||
|     /** | |||
|      * 居住成员1手机号 | |||
|      */ | |||
|     private String mobile; | |||
| 
 | |||
|     /** | |||
|      * 居住成员1是否参加几轮全员核算检测,数字1-10 | |||
|      */ | |||
|     private Integer heSuanCount; | |||
| 
 | |||
|     /** | |||
|      * 居住成员1新冠疫苗接种情况;1:已全程接种;2:未全程接种;0未接种; | |||
|      */ | |||
|     private Integer ymjz; | |||
| } | |||
| @ -0,0 +1,87 @@ | |||
| package com.epmet.dto.result; | |||
| 
 | |||
| import com.fasterxml.jackson.annotation.JsonIgnore; | |||
| import lombok.Data; | |||
| 
 | |||
| import java.io.Serializable; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| 
 | |||
| /** | |||
|  * @Author zxc | |||
|  * @DateTime 2022/3/18 19:00 | |||
|  * @DESC | |||
|  */ | |||
| @Data | |||
| public class CollectListResultDTO implements Serializable { | |||
| 
 | |||
|     private static final long serialVersionUID = -6692672375850864451L; | |||
| 
 | |||
|     /** | |||
|      * 户主姓名 | |||
|      */ | |||
|     private String houseHolderName; | |||
| 
 | |||
|     private String id; | |||
| 
 | |||
|     /** | |||
|      * 居住地址 | |||
|      */ | |||
|     private String address; | |||
| 
 | |||
|     /** | |||
|      * 房屋类型,1:自有, 0:租住 | |||
|      */ | |||
|     private Integer houseType; | |||
| 
 | |||
|     /** | |||
|      * 居住人数 | |||
|      */ | |||
|     private Integer totalResi; | |||
| 
 | |||
|     private List<CollectListMemberResultDTO> list; | |||
| 
 | |||
|     public CollectListResultDTO() { | |||
|         this.houseHolderName = ""; | |||
|         this.address = ""; | |||
|         this.houseType = 0; | |||
|         this.totalResi = 0; | |||
|         this.list = new ArrayList<>(); | |||
|     } | |||
| 
 | |||
|     @Data | |||
|     public static class CollectListMemberResultDTO{ | |||
|         /** | |||
|          * 成员名字 | |||
|          */ | |||
|         private String memberName; | |||
| 
 | |||
|         /** | |||
|          * 成员身份证 | |||
|          */ | |||
|         private String memberIdNum; | |||
| 
 | |||
|         /** | |||
|          * 成员电话 | |||
|          */ | |||
|         private String memberMobile; | |||
| 
 | |||
|         /** | |||
|          * 核酸检测次数 | |||
|          */ | |||
|         private Integer heSuanCount; | |||
| 
 | |||
|         /** | |||
|          * 疫苗是否全程接种,1:全程接种,2:未全程接种,3:为接种 | |||
|          */ | |||
|         private Integer ymjz; | |||
| 
 | |||
|         public CollectListMemberResultDTO() { | |||
|             this.memberName = ""; | |||
|             this.memberIdNum = ""; | |||
|             this.memberMobile = ""; | |||
|             this.heSuanCount = 0; | |||
|             this.ymjz = 0; | |||
|         } | |||
|     } | |||
| } | |||
| @ -0,0 +1,72 @@ | |||
| package com.epmet.controller; | |||
| 
 | |||
| import com.epmet.commons.tools.annotation.LoginUser; | |||
| import com.epmet.commons.tools.aop.NoRepeatSubmit; | |||
| import com.epmet.commons.tools.page.PageData; | |||
| import com.epmet.commons.tools.security.dto.TokenDto; | |||
| import com.epmet.commons.tools.utils.Result; | |||
| import com.epmet.commons.tools.validator.ValidatorUtils; | |||
| import com.epmet.dto.form.CollectListFormDTO; | |||
| import com.epmet.dto.form.IcResiCollectFormDTO; | |||
| import com.epmet.dto.result.CollectListResultDTO; | |||
| import com.epmet.service.IcResiCollectService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.PostMapping; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| 
 | |||
| import java.util.List; | |||
| 
 | |||
| 
 | |||
| /** | |||
|  * 居民信息采集表 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-03-18 | |||
|  */ | |||
| @RestController | |||
| @RequestMapping("icresicollect") | |||
| public class IcResiCollectController { | |||
| 
 | |||
|     @Autowired | |||
|     private IcResiCollectService icResiCollectService; | |||
| 
 | |||
|     /** | |||
|      * 居民信息采集_提交 | |||
|      * | |||
|      * @param formDTO | |||
|      * @return | |||
|      */ | |||
|     @NoRepeatSubmit | |||
|     @PostMapping("save") | |||
|     public Result save(@RequestBody IcResiCollectFormDTO formDTO) { | |||
|         //效验数据
 | |||
|         ValidatorUtils.validateEntity(formDTO, IcResiCollectFormDTO.AddUserInternalGroup.class); | |||
|         // 内部:internal;外部:external
 | |||
|         if ("internal".equals(formDTO.getOrigin())) { | |||
|             ValidatorUtils.validateEntity(formDTO, IcResiCollectFormDTO.InternalShowGroup.class); | |||
|         } else if ("external".equals(formDTO.getOrigin())) { | |||
|             ValidatorUtils.validateEntity(formDTO, IcResiCollectFormDTO.ExternalShowGroup.class); | |||
|         } | |||
|         icResiCollectService.save(formDTO); | |||
|         return new Result(); | |||
|     } | |||
| 
 | |||
|     /** | |||
|      * Desc: 查询采集居民信息 | |||
|      * @param formDTO | |||
|      * @param tokenDto | |||
|      * @author zxc | |||
|      * @date 2022/3/18 19:23 | |||
|      */ | |||
|     @PostMapping("list") | |||
| //    public Result<PageData<CollectListResultDTO>> getCollectList(@RequestBody CollectListFormDTO formDTO, @LoginUser TokenDto tokenDto){
 | |||
|     public Result<PageData<CollectListResultDTO>> getCollectList(@RequestBody CollectListFormDTO formDTO){ | |||
|         ValidatorUtils.validateEntity(formDTO,CollectListFormDTO.CollectListForm.class); | |||
|         formDTO.setUserId("ebcef7c1c63a87a226e59f1e0149d331"); | |||
|         formDTO.setCustomerId("45687aa479955f9d06204d415238f7cc"); | |||
|         return new Result<PageData<CollectListResultDTO>>().ok(icResiCollectService.getCollectList(formDTO)); | |||
|     } | |||
| 
 | |||
| } | |||
| @ -0,0 +1,36 @@ | |||
| package com.epmet.dao; | |||
| 
 | |||
| import com.epmet.commons.mybatis.dao.BaseDao; | |||
| import com.epmet.dto.form.CollectListFormDTO; | |||
| import com.epmet.dto.result.CollectListResultDTO; | |||
| import com.epmet.entity.IcResiCollectEntity; | |||
| import org.apache.ibatis.annotations.Mapper; | |||
| import org.apache.ibatis.annotations.Param; | |||
| 
 | |||
| import java.util.List; | |||
| 
 | |||
| /** | |||
|  * 居民信息采集表 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-03-18 | |||
|  */ | |||
| @Mapper | |||
| public interface IcResiCollectDao extends BaseDao<IcResiCollectEntity> { | |||
| 
 | |||
|     IcResiCollectEntity selectByAddress(String address); | |||
| 
 | |||
|     int updateRec(@Param("id") String id, | |||
|                   @Param("houseType") Integer houseType, | |||
|                   @Param("houseHolderName") String houseHolderName, | |||
|                   @Param("totalResi") Integer totalResi); | |||
| 
 | |||
|     /** | |||
|      * Desc: 查询采集居民信息 | |||
|      * @param formDTO | |||
|      * @author zxc | |||
|      * @date 2022/3/18 19:41 | |||
|      */ | |||
|     List<CollectListResultDTO> getCollectList(CollectListFormDTO formDTO); | |||
| 
 | |||
| } | |||
| @ -0,0 +1,16 @@ | |||
| package com.epmet.dao; | |||
| 
 | |||
| import com.epmet.commons.mybatis.dao.BaseDao; | |||
| import com.epmet.entity.IcResiMemberEntity; | |||
| import org.apache.ibatis.annotations.Mapper; | |||
| 
 | |||
| /** | |||
|  * 居民信息成员表 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-03-18 | |||
|  */ | |||
| @Mapper | |||
| public interface IcResiMemberDao extends BaseDao<IcResiMemberEntity> { | |||
| 	 | |||
| } | |||
| @ -0,0 +1,86 @@ | |||
| package com.epmet.entity; | |||
| 
 | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.epmet.commons.mybatis.entity.BaseEpmetEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| 
 | |||
| /** | |||
|  * 居民信息采集表 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-03-18 | |||
|  */ | |||
| @Data | |||
| @EqualsAndHashCode(callSuper=false) | |||
| @TableName("ic_resi_collect") | |||
| public class IcResiCollectEntity extends BaseEpmetEntity { | |||
| 
 | |||
| 	private static final long serialVersionUID = 1L; | |||
| 
 | |||
|     /** | |||
|      * 客户Id customer.id | |||
|      */ | |||
| 	private String customerId; | |||
| 
 | |||
|     /** | |||
|      * 内部:internal;外部:external | |||
|      */ | |||
| 	private String origin; | |||
| 
 | |||
|     /** | |||
|      * 网格ID | |||
|      */ | |||
| 	private String gridId; | |||
| 
 | |||
|     /** | |||
|      * 组织Id | |||
|      */ | |||
| 	private String agencyId; | |||
| 
 | |||
|     /** | |||
|      * 组织的pids | |||
|      */ | |||
| 	private String pids; | |||
| 
 | |||
|     /** | |||
|      * 所属小区ID | |||
|      */ | |||
| 	private String villageId; | |||
| 
 | |||
|     /** | |||
|      * 所属楼宇Id | |||
|      */ | |||
| 	private String buildId; | |||
| 
 | |||
|     /** | |||
|      * 单元id | |||
|      */ | |||
| 	private String unitId; | |||
| 
 | |||
|     /** | |||
|      * 所属家庭Id | |||
|      */ | |||
| 	private String homeId; | |||
| 
 | |||
|     /** | |||
|      * 详细地址 | |||
|      */ | |||
| 	private String address; | |||
| 
 | |||
|     /** | |||
|      * 1自由0租住 | |||
|      */ | |||
| 	private Integer houseType; | |||
| 
 | |||
|     /** | |||
|      * 户主姓名 | |||
|      */ | |||
| 	private String houseHolderName; | |||
| 
 | |||
|     /** | |||
|      * 居住成员人数 | |||
|      */ | |||
| 	private Integer totalResi; | |||
| 
 | |||
| } | |||
| @ -0,0 +1,56 @@ | |||
| package com.epmet.entity; | |||
| 
 | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.epmet.commons.mybatis.entity.BaseEpmetEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| 
 | |||
| /** | |||
|  * 居民信息成员表 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-03-18 | |||
|  */ | |||
| @Data | |||
| @EqualsAndHashCode(callSuper=false) | |||
| @TableName("ic_resi_member") | |||
| public class IcResiMemberEntity extends BaseEpmetEntity { | |||
| 
 | |||
| 	private static final long serialVersionUID = 1L; | |||
| 
 | |||
|     /** | |||
|      * 客户Id customer.id | |||
|      */ | |||
| 	private String customerId; | |||
| 
 | |||
|     /** | |||
|      * ic_resi_colllect.id | |||
|      */ | |||
| 	private String icResiCollectId; | |||
| 
 | |||
|     /** | |||
|      * 居住成员1姓名 | |||
|      */ | |||
| 	private String name; | |||
| 
 | |||
|     /** | |||
|      * 居住成员1身份证号 | |||
|      */ | |||
| 	private String idNum; | |||
| 
 | |||
|     /** | |||
|      * 居住成员1手机号 | |||
|      */ | |||
| 	private String mobile; | |||
| 
 | |||
|     /** | |||
|      * 居住成员1是否参加几轮全员核算检测,数字1-10 | |||
|      */ | |||
| 	private Integer heSuanCount; | |||
| 
 | |||
|     /** | |||
|      * 居住成员1新冠疫苗接种情况;1:已全程接种;2:未全程接种;0未接种; | |||
|      */ | |||
| 	private Integer ymjz; | |||
| 
 | |||
| } | |||
| @ -0,0 +1,39 @@ | |||
| package com.epmet.service; | |||
| 
 | |||
| import com.epmet.commons.mybatis.service.BaseService; | |||
| import com.epmet.commons.tools.page.PageData; | |||
| import com.epmet.dto.form.CollectListFormDTO; | |||
| import com.epmet.dto.form.IcResiCollectFormDTO; | |||
| import com.epmet.dto.result.CollectListResultDTO; | |||
| import com.epmet.entity.IcResiCollectEntity; | |||
| 
 | |||
| import java.util.List; | |||
| 
 | |||
| /** | |||
|  * 居民信息采集表 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-03-18 | |||
|  */ | |||
| public interface IcResiCollectService extends BaseService<IcResiCollectEntity> { | |||
| 
 | |||
| 
 | |||
|     /** | |||
|      * 默认保存 | |||
|      * | |||
|      * @param dto | |||
|      * @return void | |||
|      * @author generator | |||
|      * @date 2022-03-18 | |||
|      */ | |||
|     void save(IcResiCollectFormDTO dto); | |||
| 
 | |||
|     /** | |||
|      * Desc: 查询采集居民信息 | |||
|      * @param formDTO | |||
|      * @author zxc | |||
|      * @date 2022/3/18 19:23 | |||
|      */ | |||
|     PageData<CollectListResultDTO> getCollectList(CollectListFormDTO formDTO); | |||
| 
 | |||
| } | |||
| @ -0,0 +1,137 @@ | |||
| package com.epmet.service.impl; | |||
| 
 | |||
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
| import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | |||
| import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; | |||
| import com.epmet.commons.tools.exception.EpmetErrorCode; | |||
| import com.epmet.commons.tools.exception.EpmetException; | |||
| import com.epmet.commons.tools.page.PageData; | |||
| import com.epmet.commons.tools.redis.common.CustomerStaffRedis; | |||
| import com.epmet.commons.tools.utils.ConvertUtils; | |||
| import com.epmet.commons.tools.utils.Result; | |||
| import com.epmet.dao.IcResiCollectDao; | |||
| import com.epmet.dao.IcResiMemberDao; | |||
| import com.epmet.dto.IcNeighborHoodDTO; | |||
| import com.epmet.dto.form.CollectListFormDTO; | |||
| import com.epmet.dto.form.IcResiCollectFormDTO; | |||
| import com.epmet.dto.result.CollectListResultDTO; | |||
| import com.epmet.entity.IcResiCollectEntity; | |||
| import com.epmet.entity.IcResiMemberEntity; | |||
| import com.epmet.feign.GovOrgOpenFeignClient; | |||
| import com.epmet.service.IcResiCollectService; | |||
| import org.apache.commons.collections4.MapUtils; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| 
 | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.function.Function; | |||
| import java.util.stream.Collectors; | |||
| 
 | |||
| /** | |||
|  * 居民信息采集表 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-03-18 | |||
|  */ | |||
| @Service | |||
| public class IcResiCollectServiceImpl extends BaseServiceImpl<IcResiCollectDao, IcResiCollectEntity> implements IcResiCollectService { | |||
|     @Autowired | |||
|     private GovOrgOpenFeignClient govOrgOpenFeignClient; | |||
|     @Autowired | |||
|     private IcResiMemberDao icResiMemberDao; | |||
| 
 | |||
|     @Override | |||
|     @Transactional(rollbackFor = Exception.class) | |||
|     public void save(IcResiCollectFormDTO formDTO) { | |||
|         IcResiCollectEntity origin = baseDao.selectByAddress(formDTO.getAddress()); | |||
|         if (null == origin) { | |||
|             //插入主表、成员表
 | |||
|             IcResiCollectEntity insert = ConvertUtils.sourceToTarget(formDTO, IcResiCollectEntity.class); | |||
|             if ("internal".equals(formDTO.getOrigin())) { | |||
|                 //根据小区id查询网格相关信息
 | |||
|                 IcNeighborHoodDTO neighborHoodDTO = queryIcNeighborHood(formDTO.getVillageId()); | |||
|                 insert.setGridId(neighborHoodDTO.getGridId()); | |||
|                 insert.setAgencyId(neighborHoodDTO.getAgencyId()); | |||
|                 insert.setPids(neighborHoodDTO.getAgencyPids()); | |||
|             } | |||
|             baseDao.insert(insert); | |||
|             List<IcResiMemberEntity> memberList = ConvertUtils.sourceToTarget(formDTO.getMemberList(), IcResiMemberEntity.class); | |||
|             memberList.forEach(mem -> { | |||
|                 mem.setIcResiCollectId(insert.getId()); | |||
|                 icResiMemberDao.insert(mem); | |||
|             }); | |||
|         } else { | |||
|             //更新主表
 | |||
|             baseDao.updateRec(origin.getId(), formDTO.getHouseType(), formDTO.getHouseHolderName(), formDTO.getTotalResi()); | |||
|             List<IcResiMemberEntity> newMemberList = ConvertUtils.sourceToTarget(formDTO.getMemberList(), IcResiMemberEntity.class); | |||
|             //查询之前录入的成员表
 | |||
|             Map<String, IcResiMemberEntity> memMap = queryOriginMem(origin.getId()); | |||
|             saveOrUpdateMem(newMemberList, memMap,origin.getId()); | |||
|         } | |||
|     } | |||
| 
 | |||
|     /** | |||
|      * Desc: 查询采集居民信息 | |||
|      * @param formDTO | |||
|      * @author zxc | |||
|      * @date 2022/3/18 19:23 | |||
|      */ | |||
|     @Override | |||
|     public PageData<CollectListResultDTO> getCollectList(CollectListFormDTO formDTO) { | |||
|         PageData<CollectListResultDTO> result = new PageData<>(new ArrayList<>(), 0); | |||
|         if (StringUtils.isBlank(formDTO.getOrgId()) && | |||
|                 StringUtils.isBlank(formDTO.getNeighborHoodId()) && | |||
|                 StringUtils.isBlank(formDTO.getBuildingId()) && | |||
|                 StringUtils.isBlank(formDTO.getHouseId()) && | |||
|                 StringUtils.isBlank(formDTO.getAddress()) && | |||
|                 StringUtils.isBlank(formDTO.getStartDate()) && | |||
|                 StringUtils.isBlank(formDTO.getEndDate()) ){ | |||
|             CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); | |||
|             if (null == staffInfo){ | |||
|                 throw new EpmetException("查询人员信息失败"+formDTO.getUserId()); | |||
|             } | |||
|             formDTO.setOrgId(staffInfo.getAgencyId()); | |||
|         } | |||
|         PageInfo<CollectListResultDTO> pageList = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.getCollectList(formDTO)); | |||
|         result.setList(pageList.getList()); | |||
|         result.setTotal(Integer.valueOf(String.valueOf(pageList.getTotal()))); | |||
|         return result; | |||
|     } | |||
| 
 | |||
| 
 | |||
|     private IcNeighborHoodDTO queryIcNeighborHood(String villageId) { | |||
|         Result<IcNeighborHoodDTO> res = govOrgOpenFeignClient.getIcNeighbordhoodById(villageId); | |||
|         if (!res.success() || null == res.getData()) { | |||
|             throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "小区信息查询异常", "小区信息查询异常"); | |||
|         } | |||
|         return res.getData(); | |||
|     } | |||
| 
 | |||
|     private Map<String, IcResiMemberEntity> queryOriginMem(String icResiCollectId) { | |||
|         LambdaQueryWrapper<IcResiMemberEntity> query = new LambdaQueryWrapper<>(); | |||
|         query.eq(IcResiMemberEntity::getIcResiCollectId, icResiCollectId); | |||
|         List<IcResiMemberEntity> originMemberList = icResiMemberDao.selectList(query); | |||
|         Map<String, IcResiMemberEntity> memMap = originMemberList.stream().collect(Collectors.toMap(IcResiMemberEntity::getIdNum, Function.identity())); | |||
|         return memMap; | |||
|     } | |||
| 
 | |||
|     private void saveOrUpdateMem(List<IcResiMemberEntity> newMemberList, Map<String, IcResiMemberEntity> memMap, String originIcResiCollectId) { | |||
|         for (IcResiMemberEntity entity : newMemberList) { | |||
|             if (MapUtils.isNotEmpty(memMap) && memMap.containsKey(entity.getIdNum())) { | |||
|                 entity.setIcResiCollectId(originIcResiCollectId); | |||
|                 entity.setCustomerId(memMap.get(entity.getIdNum()).getCustomerId()); | |||
|                 icResiMemberDao.updateById(entity); | |||
|                 continue; | |||
|             } | |||
|             //没有插入
 | |||
|             entity.setIcResiCollectId(originIcResiCollectId); | |||
|             icResiMemberDao.insert(entity); | |||
|         } | |||
|     } | |||
| } | |||
| @ -0,0 +1,74 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| 
 | |||
| <mapper namespace="com.epmet.dao.IcResiCollectDao"> | |||
| 
 | |||
|     <select id="selectByAddress" parameterType="java.lang.String" resultType="com.epmet.entity.IcResiCollectEntity"> | |||
|         select c.id from ic_resi_collect c | |||
|         where  c.address=#{address} | |||
|         and c.DEL_FLAG='0' | |||
|     </select> | |||
| 
 | |||
|     <!-- 查询采集居民信息 --> | |||
|     <resultMap id="getCollectListMap" type="com.epmet.dto.result.CollectListResultDTO"> | |||
|         <result property="houseHolderName" column="houseHolderName"/> | |||
|         <result property="id" column="id"/> | |||
|         <result property="address" column="address"/> | |||
|         <result property="houseType" column="houseType"/> | |||
|         <result property="totalResi" column="totalResi"/> | |||
|         <collection property="list" ofType="com.epmet.dto.result.CollectListResultDTO$CollectListMemberResultDTO" column="id" select="selectMemberList"/> | |||
|     </resultMap> | |||
|     <select id="getCollectList" resultMap="getCollectListMap"> | |||
|         SELECT | |||
|             c.id as id, | |||
|             c.HOUSE_HOLDER_NAME AS houseHolderName, | |||
|             c.ADDRESS AS address, | |||
|             c.HOUSE_TYPE AS houseType, | |||
|             c.TOTAL_RESI AS totalResi | |||
|         FROM ic_resi_collect c | |||
|         WHERE c.DEL_FLAG = 0 | |||
|         <if test='orgId != null and orgId != "" '> | |||
|             AND CONCAT(c.PIDS,':',c.AGENCY_ID) LIKE CONCAT('%',#{orgId},'%') | |||
|         </if> | |||
|         <if test='neighborHoodId != null and neighborHoodId != "" '> | |||
|             AND c.VILLAGE_ID = #{neighborHoodId} | |||
|         </if> | |||
|         <if test='buildingId != null and buildingId != "" '> | |||
|             AND c.BUILD_ID = #{buildingId} | |||
|         </if> | |||
|         <if test='houseId != null and houseId != "" '> | |||
|             AND c.HOME_ID = #{houseId} | |||
|         </if> | |||
|         <if test='address != null and address != "" '> | |||
|             AND c.ADDRESS LIKE CONCAT('%',#{address},'%') | |||
|         </if> | |||
|         <if test='startDate != null and startDate != "" '> | |||
|             AND DATE_FORMAT(c.CREATED_TIME,'%Y-%m-%d') >= #{startDate} | |||
|         </if> | |||
|         <if test='endDate != null and endDate != "" '> | |||
|             AND DATE_FORMAT(c.CREATED_TIME,'%Y-%m-%d') <![CDATA[ <= ]]> #{endDate} | |||
|         </if> | |||
|         ORDER BY c.CREATED_TIME DESC | |||
|     </select> | |||
|     <select id="selectMemberList" resultType="com.epmet.dto.result.CollectListResultDTO$CollectListMemberResultDTO"> | |||
|         select | |||
|             m.`NAME` AS memberName, | |||
|             m.ID_NUM AS memberIdNum, | |||
|             m.MOBILE AS memberMobile, | |||
|             m.HESUAN_COUNT AS heSuanCount, | |||
|             m.YMJZ AS ymjz | |||
|         from ic_resi_member m | |||
|         where m.DEL_FLAG = 0 | |||
|         and m.IC_RESI_COLLECT_ID = #{id} | |||
|     </select> | |||
| 
 | |||
|     <update id="updateRec" parameterType="map"> | |||
|         UPDATE ic_resi_collect | |||
|         SET UPDATED_TIME = NOW(), | |||
|         HOUSE_TYPE = #{houseType}, | |||
|         HOUSE_HOLDER_NAME = #{houseHolderName}, | |||
|         TOTAL_RESI = #{totalResi} | |||
|         WHERE | |||
|             id = #{id} | |||
|     </update> | |||
| </mapper> | |||
| @ -0,0 +1,8 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| 
 | |||
| <mapper namespace="com.epmet.dao.IcResiMemberDao"> | |||
| 
 | |||
| 
 | |||
| 
 | |||
| </mapper> | |||
					Loading…
					
					
				
		Reference in new issue