diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CollectListFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CollectListFormDTO.java new file mode 100644 index 0000000000..ae5ec4bacb --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CollectListFormDTO.java @@ -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; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CollectListResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CollectListResultDTO.java new file mode 100644 index 0000000000..c9c45c0dba --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CollectListResultDTO.java @@ -0,0 +1,88 @@ +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; + + @JsonIgnore + private String id; + + /** + * 居住地址 + */ + private String address; + + /** + * 房屋类型,1:自有, 0:租住 + */ + private Integer houseType; + + /** + * 居住人数 + */ + private Integer totalResi; + + private List 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; + } + } +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectController.java index 06c8f33f55..ed1227c01e 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectController.java @@ -1,9 +1,14 @@ 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; @@ -11,6 +16,8 @@ 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; + /** * 居民信息采集表 @@ -46,6 +53,19 @@ public class IcResiCollectController { return new Result(); } - + /** + * Desc: 查询采集居民信息 + * @param formDTO + * @param tokenDto + * @author zxc + * @date 2022/3/18 19:23 + */ + @PostMapping("list") + public Result> getCollectList(@RequestBody CollectListFormDTO formDTO, @LoginUser TokenDto tokenDto){ + ValidatorUtils.validateEntity(formDTO,CollectListFormDTO.CollectListForm.class); + formDTO.setUserId(tokenDto.getUserId()); + formDTO.setCustomerId(tokenDto.getCustomerId()); + return new Result>().ok(icResiCollectService.getCollectList(formDTO)); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiCollectDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiCollectDao.java index ffb231902a..72f7edbc7f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiCollectDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiCollectDao.java @@ -1,10 +1,14 @@ 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; + /** * 居民信息采集表 * @@ -20,4 +24,13 @@ public interface IcResiCollectDao extends BaseDao { @Param("houseType") Integer houseType, @Param("houseHolderName") String houseHolderName, @Param("totalResi") Integer totalResi); + + /** + * Desc: 查询采集居民信息 + * @param formDTO + * @author zxc + * @date 2022/3/18 19:41 + */ + List getCollectList(CollectListFormDTO formDTO); + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiCollectService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiCollectService.java index 86d9d046e3..4c0bca4fa5 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiCollectService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiCollectService.java @@ -1,9 +1,14 @@ 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; + /** * 居民信息采集表 * @@ -23,4 +28,12 @@ public interface IcResiCollectService extends BaseService { */ void save(IcResiCollectFormDTO dto); + /** + * Desc: 查询采集居民信息 + * @param formDTO + * @author zxc + * @date 2022/3/18 19:23 + */ + PageData getCollectList(CollectListFormDTO formDTO); + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java index 57164e50c4..eb737b7a2e 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java @@ -2,23 +2,32 @@ 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; @@ -67,6 +76,34 @@ public class IcResiCollectServiceImpl extends BaseServiceImpl getCollectList(CollectListFormDTO formDTO) { + PageData 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 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 res = govOrgOpenFeignClient.getIcNeighbordhoodById(villageId); diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiCollectDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiCollectDao.xml index f2b808c911..b5f538b4f5 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiCollectDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiCollectDao.xml @@ -9,11 +9,64 @@ and c.DEL_FLAG='0' + + + + + + + + + + + + UPDATE ic_resi_collect SET UPDATED_TIME = NOW(), HOUSE_TYPE = #{houseType}, - HOUSE_HOLER_NAME = #{houseHolderName}, + HOUSE_HOLDER_NAME = #{houseHolderName}, TOTAL_RESI = #{totalResi} WHERE id = #{id}