diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CommunityListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CommunityListResultDTO.java new file mode 100644 index 0000000000..2e080d97db --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CommunityListResultDTO.java @@ -0,0 +1,20 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2022/3/21 15:11 + * @DESC + */ +@Data +public class CommunityListResultDTO implements Serializable { + + private static final long serialVersionUID = 4336149113821131764L; + + private String orgId; + + private String orgName; +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java index c751b04274..c30fb33556 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java @@ -447,6 +447,14 @@ public class AgencyController { } } - - + /** + * Desc: 查询工作人员所属组织下的所有社区 + * @param tokenDto + * @author zxc + * @date 2022/3/21 15:13 + */ + @PostMapping("community-list") + public Result> getCommunityList(@LoginUser TokenDto tokenDto){ + return new Result>().ok(agencyService.getCommunityList(tokenDto)); + } } 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 fafb2d474d..5e7cd8713a 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 @@ -306,5 +306,15 @@ public interface CustomerAgencyDao extends BaseDao { OrgMobileResultDTO getAgencyMobile(@Param("gridId") String gridId); int updateSubAgencyAreaCodeById(@Param("customerId")String customerId, @Param("agencyId")String agencyId, @Param("operateUserId") String operateUserId); + + /** + * Desc: 查询组织下的社区 + * @param customerId + * @param agencyId + * @author zxc + * @date 2022/3/21 15:23 + */ + List getCommunityList(@Param("customerId")String customerId, @Param("agencyId")String agencyId); + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java index bacb45d855..629adcc17a 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java @@ -1,20 +1,3 @@ -/** - * Copyright 2018 人人开源 https://www.renren.io - *

- * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - *

- * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - *

- * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - package com.epmet.service; import com.epmet.commons.tools.security.dto.TokenDto; @@ -156,4 +139,12 @@ public interface AgencyService { */ List getSonAgencyId(String orgId,String type); + /** + * Desc: 查询工作人员所属组织下的所有社区 + * @param tokenDto + * @author zxc + * @date 2022/3/21 15:13 + */ + List getCommunityList(TokenDto tokenDto); + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java index c20fd83965..00dc182535 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java @@ -798,6 +798,22 @@ public class AgencyServiceImpl implements AgencyService { return new ArrayList<>(); } + /** + * Desc: 查询工作人员所属组织下的所有社区 + * @param tokenDto + * @author zxc + * @date 2022/3/21 15:13 + */ + @Override + public List getCommunityList(TokenDto tokenDto) { + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); + if (null == staffInfo){ + throw new EpmetException("未查询到工作人员信息"+staffInfo.getStaffId()); + } + String agencyId = staffInfo.getAgencyId(); + return customerAgencyDao.getCommunityList(tokenDto.getCustomerId(), agencyId); + } + private CustomerAgencyEntity constructInsertEntity(AddAgencyV2FormDTO formDTO, CustomerAgencyDTO parent) { CustomerAgencyEntity insertEntity = ConvertUtils.sourceToTarget(formDTO, CustomerAgencyEntity.class); insertEntity.setOrganizationName(formDTO.getAgencyName()); 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 2cd7210dc5..1e8792cab6 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 @@ -733,6 +733,18 @@ AND cg.id = #{gridId} + + + UPDATE customer_agency SET AREA_CODE = '', 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 index 8c089ae331..368db969c4 100644 --- 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 @@ -1,28 +1,20 @@ package com.epmet.dto.form; +import com.epmet.commons.tools.dto.form.PageFormDTO; 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 { +public class CollectListFormDTO extends PageFormDTO { 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 address; diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CollectListExcelResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CollectListExcelResultDTO.java new file mode 100644 index 0000000000..f74e042b77 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CollectListExcelResultDTO.java @@ -0,0 +1,48 @@ +package com.epmet.dto.result; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import cn.afterturn.easypoi.excel.annotation.ExcelCollection; +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 CollectListExcelResultDTO implements Serializable { + + private static final long serialVersionUID = -5659769436514116680L; + /** + * 户主姓名 + */ + @Excel(name = "户主姓名",width = 30, needMerge = true) + private String houseHolderName; + + /** + * 居住地址 + */ + @Excel(name = "居住地址",width = 40, needMerge = true) + private String address; + + /** + * 房屋类型,1:自有, 0:租住 + */ + @Excel(name = "房屋类型",replace = { "自有_1", "租住_2"}, width = 30, needMerge = true) + private String houseType; + + /** + * 居住人数 + */ + @Excel(name = "居住成员人数",width = 30, needMerge = true) + private Integer totalResi; + + @ExcelCollection(name="家庭成员") + private List listP = new ArrayList<>(); + + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CollectListMemberExcelResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CollectListMemberExcelResultDTO.java new file mode 100644 index 0000000000..319d11b8f0 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CollectListMemberExcelResultDTO.java @@ -0,0 +1,48 @@ +package com.epmet.dto.result; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.io.Serializable; + +/** + * desc: + * + * @author: LiuJanJun + * @date: 2022/3/21 5:09 下午 + * @version: 1.0 + */ +@Data +public class CollectListMemberExcelResultDTO implements Serializable { + private static final long serialVersionUID = -4290962585956172531L; + /** + * 成员名字 + */ + @Excel(name = "成员姓名", width = 30) + private String memberName; + + /** + * 成员身份证 + */ + @Excel(name = "成员身份证号", width = 30) + private String memberIdNum; + + /** + * 成员电话 + */ + @Excel(name = "成员手机号", width = 30) + private String memberMobile; + + /** + * 核酸检测次数 + */ + @Excel(name = "参加几轮核酸检测", width = 30) + private String heSuanCount = "0"; + + /** + * 疫苗是否全程接种,1:全程接种,2:未全程接种,3:为接种 + */ + @Excel(name = "疫苗接种情况",replace = { "全程接种_1", "未全程接种_2", "未接种_3" }, width = 30) + private String ymjz; + +} 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 index 9edcfa4d8d..1d61469165 100644 --- 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 @@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; -import java.util.ArrayList; import java.util.List; /** @@ -42,13 +41,6 @@ public class CollectListResultDTO implements Serializable { private List list; - public CollectListResultDTO() { - this.houseHolderName = ""; - this.address = ""; - this.houseType = "0"; - this.totalResi = 0; - this.list = new ArrayList<>(); - } @Data public static class CollectListMemberResultDTO{ @@ -77,12 +69,6 @@ public class CollectListResultDTO implements Serializable { */ 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 ed1227c01e..fbe82fc561 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 @@ -2,12 +2,17 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.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.CollectListExcelResultDTO; +import com.epmet.dto.result.CollectListMemberExcelResultDTO; import com.epmet.dto.result.CollectListResultDTO; import com.epmet.service.IcResiCollectService; import org.springframework.beans.factory.annotation.Autowired; @@ -16,6 +21,8 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; import java.util.List; @@ -68,4 +75,37 @@ public class IcResiCollectController { return new Result>().ok(icResiCollectService.getCollectList(formDTO)); } + /** + * Desc: 查询采集居民信息 + * @param formDTO + * @param tokenDto + * @author zxc + * @date 2022/3/18 19:23 + */ + @PostMapping("export") + public void export(@RequestBody CollectListFormDTO formDTO, @LoginUser TokenDto tokenDto, HttpServletResponse response) throws Exception { + //ValidatorUtils.validateEntity(formDTO,CollectListFormDTO.CollectListForm.class); + //tokenDto.setUserId("73ae6280e46a6653a5605d51d5462725"); + //tokenDto.setCustomerId("45687aa479955f9d06204d415238f7cc"); + formDTO.setUserId(tokenDto.getUserId()); + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setPage(false); + PageData collectList = icResiCollectService.getCollectList(formDTO); + List list = ConvertUtils.sourceToTarget(collectList.getList(),CollectListExcelResultDTO.class); + + collectList.getList().forEach(o->{ + List children = new ArrayList<>(); + o.getList().forEach(item->{ + CollectListMemberExcelResultDTO resultDTO = ConvertUtils.sourceToTarget(item, CollectListMemberExcelResultDTO.class); + resultDTO.setYmjz(item.getYmjz() == null? StrConstant.EPMETY_STR:String.valueOf(item.getYmjz())); + children.add(resultDTO); + }); + CollectListExcelResultDTO resultDTO = ConvertUtils.sourceToTarget(o, CollectListExcelResultDTO.class); + resultDTO.setListP(children); + list.add(resultDTO); + }); + + ExcelUtils.exportExcelToTarget(response, null, list, CollectListExcelResultDTO.class); + } + } 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 fc714f2912..b1895b608a 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 @@ -63,8 +63,11 @@ public class IcResiCollectServiceImpl extends BaseServiceImpl memberList = ConvertUtils.sourceToTarget(formDTO.getMemberList(), IcResiMemberEntity.class); memberList.forEach(mem -> { - mem.setIcResiCollectId(insert.getId()); - icResiMemberDao.insert(mem); + if (StringUtils.isNotBlank(mem.getName()) || StringUtils.isNotBlank(mem.getIdNum())) { + //姓名或份身份证号不为空时插入 + mem.setIcResiCollectId(insert.getId()); + icResiMemberDao.insert(mem); + } }); } else { //更新主表 @@ -95,9 +98,14 @@ public class IcResiCollectServiceImpl extends BaseServiceImpl pageList = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.getCollectList(formDTO)); - result.setList(pageList.getList()); - result.setTotal(Integer.valueOf(String.valueOf(pageList.getTotal()))); + if (formDTO.isPage()){ + PageInfo pageList = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.getCollectList(formDTO)); + result.setList(pageList.getList()); + result.setTotal(Integer.parseInt(String.valueOf(pageList.getTotal()))); + }else { + List collectList = baseDao.getCollectList(formDTO); + result.setList(collectList); + } return result; } @@ -120,16 +128,21 @@ public class IcResiCollectServiceImpl extends BaseServiceImpl newMemberList, Map memMap, String originIcResiCollectId) { for (IcResiMemberEntity entity : newMemberList) { - if (MapUtils.isNotEmpty(memMap) && memMap.containsKey(entity.getIdNum())) { + if(StringUtils.isNotBlank(entity.getIdNum())){ + if (MapUtils.isNotEmpty(memMap) && memMap.containsKey(entity.getIdNum())) { + entity.setIcResiCollectId(originIcResiCollectId); + entity.setCustomerId(memMap.get(entity.getIdNum()).getCustomerId()); + entity.setId(memMap.get(entity.getIdNum()).getId()); + icResiMemberDao.updateById(entity); + continue; + } + } + //与之前历史成员没有匹配到 + if (StringUtils.isNotBlank(entity.getName()) || StringUtils.isNotBlank(entity.getIdNum())) { + //姓名或份身份证号不为空时插入 entity.setIcResiCollectId(originIcResiCollectId); - entity.setCustomerId(memMap.get(entity.getIdNum()).getCustomerId()); - entity.setId(memMap.get(entity.getIdNum()).getId()); - icResiMemberDao.updateById(entity); - continue; + icResiMemberDao.insert(entity); } - //没有插入 - entity.setIcResiCollectId(originIcResiCollectId); - icResiMemberDao.insert(entity); } } -} \ No newline at end of file +}