diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/FinancialSituationDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/FinancialSituationDTO.java new file mode 100644 index 0000000000..4a1607748d --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/FinancialSituationDTO.java @@ -0,0 +1,31 @@ +package com.epmet.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/11/3 10:24 上午 + * @DESC + */ +@Data +public class FinancialSituationDTO implements Serializable { + + private static final long serialVersionUID = -3984106138099267996L; + + /** + * 月收入 + */ + private String monthlyIncome; + + /** + * 退休金额 + */ + private String retirementAmount; + + public FinancialSituationDTO() { + this.monthlyIncome = ""; + this.retirementAmount = ""; + } +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PersonDataFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PersonDataFormDTO.java new file mode 100644 index 0000000000..52d96870a2 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PersonDataFormDTO.java @@ -0,0 +1,22 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/11/2 5:16 下午 + * @DESC + */ +@Data +public class PersonDataFormDTO implements Serializable { + + private static final long serialVersionUID = 3238490888792654922L; + + public interface PersonDataForm{} + + @NotBlank(message = "userId不能为空",groups = PersonDataForm.class) + private String userId; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SearchByNameFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SearchByNameFormDTO.java new file mode 100644 index 0000000000..8f4abca17f --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SearchByNameFormDTO.java @@ -0,0 +1,30 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/11/3 1:34 下午 + * @DESC + */ +@Data +public class SearchByNameFormDTO implements Serializable { + + private static final long serialVersionUID = -5017695783909884799L; + + public interface SearchByNameForm{} + + @NotBlank(message = "name不能为空",groups = SearchByNameForm.class) + private String name; + + @NotNull(message = "pageSize不能为空",groups = SearchByNameForm.class) + private Integer pageSize; + + @NotNull(message = "pageNo不能为空",groups = SearchByNameForm.class) + private Integer pageNo; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PersonDataResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PersonDataResultDTO.java new file mode 100644 index 0000000000..22a6fc3c41 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PersonDataResultDTO.java @@ -0,0 +1,72 @@ +package com.epmet.dto.result; + +import com.epmet.dto.FinancialSituationDTO; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * @Author zxc + * @DateTime 2021/11/2 5:34 下午 + * @DESC + */ +@Data +public class PersonDataResultDTO implements Serializable { + + private static final long serialVersionUID = 5210308218052783909L; + + /** + * 工作单位 + */ + private String workUnit; + + /** + * 人员类别 + */ + private String personCategory; + + /** + * 网格名 + */ + private String gridName; + + /** + * 姓名 + */ + private String name; + + /** + * 经济状况:包括 月收入:monthlyIncome 和 退休金额:retirementAmount + */ + private FinancialSituationDTO financialSituation; + + /** + * 房屋信息 + */ + private List houseInfo; + + /** + * 志愿者类别 + */ + private String volunteerCategory; + + public PersonDataResultDTO() { + this.workUnit = ""; + this.personCategory = ""; + this.gridName = ""; + this.name = ""; + this.financialSituation = new FinancialSituationDTO(); + this.houseInfo = new ArrayList<>(); + this.volunteerCategory = ""; + } + + /** + * 身份证 + */ + @JsonIgnore + private String idCard; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/SearchByNameResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/SearchByNameResultDTO.java new file mode 100644 index 0000000000..0451dafaf0 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/SearchByNameResultDTO.java @@ -0,0 +1,66 @@ +package com.epmet.dto.result; + +import com.epmet.commons.tools.constant.NumConstant; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/11/3 1:36 下午 + * @DESC + */ +@Data +public class SearchByNameResultDTO implements Serializable { + + private static final long serialVersionUID = 8783929181468322960L; + + /** + * 排序 + */ + private Integer sort; + + /** + * 姓名 + */ + private String name; + + /** + * 网格名 + */ + private String gridName; + + @JsonIgnore + private String gridId; + + /** + * 小区名 + */ + private String neighborHoodName; + + @JsonIgnore + private String neighborHoodId; + + /** + * 楼号 + */ + private String buildNum; + + @JsonIgnore + private String buildId; + + /** + * 用户ID + */ + private String userId; + + public SearchByNameResultDTO() { + this.sort = NumConstant.ZERO; + this.name = ""; + this.gridName = ""; + this.neighborHoodName = ""; + this.buildNum = ""; + this.userId = ""; + } +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserConstant.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserConstant.java index 31d86dadf7..87278ba55f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserConstant.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserConstant.java @@ -102,5 +102,8 @@ public interface UserConstant { String GENDER="GENDER"; String HOUSE_TYPE_KEY="HOUSE_TYPE"; String HOME_ID = "HOME_ID"; - + /** + * 居民信息 子表中的主表id + */ + String IC_RESI_USER = "IC_RESI_USER"; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java index eacd60c613..bc1472c954 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java @@ -29,6 +29,7 @@ import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; 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; @@ -327,32 +328,84 @@ public class IcResiUserController { @RequestMapping(value = "/exportExcel") public void exportExcel(/*@LoginUser TokenDto tokenDto,*/ @RequestBody IcResiUserPageFormDTO pageFormDTO, HttpServletResponse response) throws IOException { + + pageFormDTO.setCustomerId("45687aa479955f9d06204d415238f7cc"); pageFormDTO.setPageFlag(false); - //PageData> mapPageData = icResiUserService.pageResiMap(pageFormDTO); - //List> list = mapPageData.getList(); - List> list = icResiUserService.getDataForExport(pageFormDTO.getCustomerId(), pageFormDTO.getFormCode(), BASE_TABLE_NAME, pageFormDTO.getConditions()); - //list = (List>)JSON.parse("[{\"IS_BDHJ\":\"1\",\"IS_SPECIAL\":\"1\",\"IS_XFRY\":\"0\",\"REMARKS\":\"beizhu\",\"IS_PARTY\":\"1\",\"icResiUserId\":\"yzmtest2\",\"HOME_ID\":\"中海国际社区一里城1号楼1单元101\",\"HOUSE_TYPE\":\"平房\",\"UNIT_NAME\":\"1单元\",\"GRID_ID\":\"市北区-市北区第三网格3\",\"IS_DB\":\"0\",\"GENDER\":\"男\",\"BIRTHDAY\":\"2021-10-04\",\"IS_VETERANS\":\"0\",\"IS_MB\":\"0\",\"IS_UNEMPLOYED\":\"0\",\"DEMAND_NAME\":null,\"IS_KC\":\"0\",\"IS_ENSURE_HOUSE\":\"0\",\"IS_SD\":\"0\",\"NAME\":\"尹作梅\",\"RDSJ\":null,\"IS_VOLUNTEER\":\"1\",\"GRID_ID_VALUE\":\"e74829ffc43d5470eba6b5e060c11e63\",\"IS_SZ\":\"0\",\"IS_CJ\":\"0\",\"HOME_ID_VALUE\":\"200\",\"DEMAND_CATEGORY_IDS\":null,\"VILLAGE_NAME\":\"中海国际社区一里城\",\"IS_DBH\":\"0\",\"IS_SN\":\"0\",\"BUILD_NAME\":\"1号楼\",\"IS_YLFN\":\"0\",\"IS_UNITED_FRONT\":\"0\",\"ID_CARD\":\"371325199310260529\",\"MOBILE\":\"15764229697\",\"IS_OLD_PEOPLE\":\"0\",\"DOOR_NAME\":\"101\"},{\"IS_SPECIAL\":\"1\",\"IS_XFRY\":\"0\",\"REMARKS\":\"beizhu\",\"IS_PARTY\":\"1\",\"icResiUserId\":\"yzmtest\",\"HOME_ID\":\"中海国际社区一里城1号楼1单元101\",\"HOUSE_TYPE\":\"平房\",\"UNIT_NAME\":\"1单元\",\"GRID_ID\":\"市北区-市北区第三网格3\",\"IS_DB\":\"0\",\"GENDER\":\"男\",\"BIRTHDAY\":\"2021-10-04\",\"IS_VETERANS\":\"0\",\"IS_MB\":\"0\",\"IS_UNEMPLOYED\":\"0\",\"DEMAND_NAME\":\"心理咨询\",\"IS_KC\":\"0\",\"IS_ENSURE_HOUSE\":\"0\",\"IS_SD\":\"0\",\"NAME\":\"尹作梅\",\"RDSJ\":\"2021-10-28 00:00:00\",\"IS_VOLUNTEER\":\"1\",\"GRID_ID_VALUE\":\"e74829ffc43d5470eba6b5e060c11e63\",\"IS_SZ\":\"0\",\"IS_CJ\":\"0\",\"HOME_ID_VALUE\":\"200\",\"DEMAND_CATEGORY_IDS\":\"10180002\",\"VILLAGE_NAME\":\"中海国际社区一里城\",\"IS_DBH\":\"0\",\"IS_SN\":\"0\",\"BUILD_NAME\":\"1号楼\",\"IS_YLFN\":\"0\",\"IS_UNITED_FRONT\":\"0\",\"ID_CARD\":\"371325199310260529\",\"MOBILE\":\"15764229697\",\"IS_OLD_PEOPLE\":\"0\",\"DOOR_NAME\":\"101\"}]"); - log.info("list:{}", JSON.toJSONString(list)); + CustomerFormResultDTO resiFormItems = getResiFormItems(pageFormDTO.getCustomerId()); + /* Map> checkListMap = new HashMap<>(); + for (FormItem item : resiFormItems.getItemList()) { + if ("checkbox".equals(item.getItemType())) { + List options = null; + if ("remote".equals(item.getOptionSourceType())) { + } else if ("local".equals(item.getOptionSourceType())) { + options = item.getOptions(); + } + checkListMap.put(item.getColumnName().concat(item.getColumnNum().equals(0) ? "" : item.getColumnNum().toString()), options); + } + }*/ - CustomerFormResultDTO resiFormItems = getResiFormItems(pageFormDTO.getCustomerId()); + //PageData> mapPageData = icResiUserService.pageResiMap(pageFormDTO); + //List> resiMainList = mapPageData.getList(); + Map itemMap = new HashMap<>(); + for (FormItem formItem : resiFormItems.getItemList()) { + if (StringUtils.isNotBlank(formItem.getColumnName())){ + itemMap.put(formItem.getColumnName().concat(formItem.getColumnNum() == 0 ? "" : formItem.getColumnNum().toString()), formItem); + } + if (formItem.getChildGroup() != null) { + for (FormItem2 item2 : formItem.getChildGroup().getItemList()) { + if (item2.getItemType().equals("checkbox")) { + itemMap.put(item2.getColumnName().concat(item2.getColumnNum() == 0 ? "" : item2.getColumnNum().toString()), ConvertUtils.sourceToTarget(item2,FormItem.class)); + } + } + + } + } + for (FormGroupDTO groupItem : resiFormItems.getGroupList()) { + if (groupItem.getItemList() != null) { + for (FormItem2 item : groupItem.getItemList()) { + if (StringUtils.isBlank(item.getColumnName())){ + continue; + } + System.out.println(item.getColumnName()+item.getColumnNum()); + itemMap.put(item.getColumnName().concat(item.getColumnNum() == 0 ? "" : item.getColumnNum().toString()), ConvertUtils.sourceToTarget(item,FormItem.class)); + } + } + } + Map> resiMainList = icResiUserService.getDataForExport(itemMap,pageFormDTO.getCustomerId(), pageFormDTO.getFormCode(), BASE_TABLE_NAME, pageFormDTO.getConditions()); + //resiMainList = (List>)JSON.parse("[{\"IS_BDHJ\":\"1\",\"IS_SPECIAL\":\"1\",\"IS_XFRY\":\"0\",\"REMARKS\":\"beizhu\",\"IS_PARTY\":\"1\",\"icResiUserId\":\"yzmtest2\",\"HOME_ID\":\"中海国际社区一里城1号楼1单元101\",\"HOUSE_TYPE\":\"平房\",\"UNIT_NAME\":\"1单元\",\"GRID_ID\":\"市北区-市北区第三网格3\",\"IS_DB\":\"0\",\"GENDER\":\"男\",\"BIRTHDAY\":\"2021-10-04\",\"IS_VETERANS\":\"0\",\"IS_MB\":\"0\",\"IS_UNEMPLOYED\":\"0\",\"DEMAND_NAME\":null,\"IS_KC\":\"0\",\"IS_ENSURE_HOUSE\":\"0\",\"IS_SD\":\"0\",\"NAME\":\"尹作梅\",\"RDSJ\":null,\"IS_VOLUNTEER\":\"1\",\"GRID_ID_VALUE\":\"e74829ffc43d5470eba6b5e060c11e63\",\"IS_SZ\":\"0\",\"IS_CJ\":\"0\",\"HOME_ID_VALUE\":\"200\",\"DEMAND_CATEGORY_IDS\":null,\"VILLAGE_NAME\":\"中海国际社区一里城\",\"IS_DBH\":\"0\",\"IS_SN\":\"0\",\"BUILD_NAME\":\"1号楼\",\"IS_YLFN\":\"0\",\"IS_UNITED_FRONT\":\"0\",\"ID_CARD\":\"371325199310260529\",\"MOBILE\":\"15764229697\",\"IS_OLD_PEOPLE\":\"0\",\"DOOR_NAME\":\"101\"},{\"IS_SPECIAL\":\"1\",\"IS_XFRY\":\"0\",\"REMARKS\":\"beizhu\",\"IS_PARTY\":\"1\",\"icResiUserId\":\"yzmtest\",\"HOME_ID\":\"中海国际社区一里城1号楼1单元101\",\"HOUSE_TYPE\":\"平房\",\"UNIT_NAME\":\"1单元\",\"GRID_ID\":\"市北区-市北区第三网格3\",\"IS_DB\":\"0\",\"GENDER\":\"男\",\"BIRTHDAY\":\"2021-10-04\",\"IS_VETERANS\":\"0\",\"IS_MB\":\"0\",\"IS_UNEMPLOYED\":\"0\",\"DEMAND_NAME\":\"心理咨询\",\"IS_KC\":\"0\",\"IS_ENSURE_HOUSE\":\"0\",\"IS_SD\":\"0\",\"NAME\":\"尹作梅\",\"RDSJ\":\"2021-10-28 00:00:00\",\"IS_VOLUNTEER\":\"1\",\"GRID_ID_VALUE\":\"e74829ffc43d5470eba6b5e060c11e63\",\"IS_SZ\":\"0\",\"IS_CJ\":\"0\",\"HOME_ID_VALUE\":\"200\",\"DEMAND_CATEGORY_IDS\":\"10180002\",\"VILLAGE_NAME\":\"中海国际社区一里城\",\"IS_DBH\":\"0\",\"IS_SN\":\"0\",\"BUILD_NAME\":\"1号楼\",\"IS_YLFN\":\"0\",\"IS_UNITED_FRONT\":\"0\",\"ID_CARD\":\"371325199310260529\",\"MOBILE\":\"15764229697\",\"IS_OLD_PEOPLE\":\"0\",\"DOOR_NAME\":\"101\"}]"); + log.info("resiMainList:{}", JSON.toJSONString(resiMainList)); String templatePath = "excel/ic_resi_info_cid.xls"; TemplateExportParams params = new TemplateExportParams(templatePath,true); Map> sheetMap = new HashMap<>(); Map mapData = new HashMap<>(); - mapData.put("list", list); + mapData.put("list", resiMainList.values()); sheetMap.put(0,mapData); AtomicInteger n = new AtomicInteger(); - resiFormItems.getItemList().forEach(item->{ - if (item.getChildGroup() != null){ + for (FormItem item : resiFormItems.getItemList()) { + + + if (item.getChildGroup() != null) { if (!item.getChildGroup().getTableName().equals(BASE_TABLE_NAME)) { - sheetMap.put(n.incrementAndGet() ,mapData); + //itemMap = item.getChildGroup().getItemList().stream().filter(o -> o.getItemType().equals("checkbox")).collect(Collectors.toMap(o -> o.getColumnName().concat(o.getColumnNum() == 0 ? "" : o.getColumnNum().toString()), o -> ConvertUtils.sourceToTarget(o,FormItem.class))); + + + + Map> resiChildMap = icResiUserService.getDataForExport(itemMap, pageFormDTO.getCustomerId(), pageFormDTO.getFormCode(), item.getChildGroup().getTableName(), pageFormDTO.getConditions()); + resiChildMap.forEach((key,value)->{ + value.putAll(resiMainList.get(key)); + }); + + Map mapData2 = new HashMap<>(); + mapData2.put("list", resiChildMap.values()); + System.out.println("========="+item.getChildGroup().getTableName()+" data:"+resiChildMap.size()); + sheetMap.put(n.incrementAndGet(),mapData2); } } - }); + } Workbook workbook = ExcelExportUtil.exportExcel(sheetMap, params); workbook.setActiveSheet(0); @@ -392,4 +445,29 @@ public class IcResiUserController { formDTO.getResultTableName(), formDTO.getConditions())); } + + /** + * @Description 查询个人数据 + * @param formDTO + * @author zxc + * @date 2021/11/3 9:21 上午 + */ + @PostMapping("persondata") + public Result personData(@RequestBody PersonDataFormDTO formDTO){ + return new Result().ok(icResiUserService.personData(formDTO)); + } + + /** + * @Description 根据名字搜索 + * @param formDTO + * @param tokenDto + * @author zxc + * @date 2021/11/3 1:42 下午 + */ + @PostMapping("searchbyname") + public Result> searchByName(@RequestBody SearchByNameFormDTO formDTO, @LoginUser TokenDto tokenDto){ + ValidatorUtils.validateEntity(formDTO, SearchByNameFormDTO.SearchByNameForm.class); + return new Result>().ok(icResiUserService.searchByName(formDTO,tokenDto)); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java index 1d4f66a4cb..329447a24f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java @@ -20,6 +20,8 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.form.ResiUserQueryValueDTO; import com.epmet.dto.result.IcFormResColumnDTO; +import com.epmet.dto.result.PersonDataResultDTO; +import com.epmet.dto.result.SearchByNameResultDTO; import com.epmet.entity.IcResiUserEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -95,4 +97,22 @@ public interface IcResiUserDao extends BaseDao { @Param("resultTableName")String resultTableName, @Param("conditions") List conditions, @Param("subTables") List subTables); + + /** + * @Description 查询个人信息 + * @param userId + * @author zxc + * @date 2021/11/3 10:28 上午 + */ + PersonDataResultDTO personData(@Param("userId") String userId); + + /** + * @Description 根据名字,组织查询人 + * @param name + * @param agencyId + * @author zxc + * @date 2021/11/3 2:05 下午 + */ + List searchByName(@Param("name")String name, @Param("agencyId")String agencyId,@Param("pageNo")Integer pageNo); + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiUserEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiUserEntity.java index 603b530781..6f9f7d4068 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiUserEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiUserEntity.java @@ -44,12 +44,12 @@ public class IcResiUserEntity extends BaseEpmetEntity { private String customerId; /** - * + * */ private String agencyId; /** - * + * */ private String pids; @@ -373,11 +373,6 @@ public class IcResiUserEntity extends BaseEpmetEntity { */ private String ysr; - /** - * 是否经济低保 - */ - private String isJjdb; - /** * 籍贯 */ diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java index 8391e0967e..0363899e8a 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java @@ -22,9 +22,11 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.dto.IcResiUserDTO; import com.epmet.dto.form.*; +import com.epmet.dto.result.FormItem; import com.epmet.dto.result.HomeUserResultDTO; +import com.epmet.dto.result.PersonDataResultDTO; +import com.epmet.dto.result.SearchByNameResultDTO; import com.epmet.entity.IcResiUserEntity; -import com.epmet.service.impl.IcResiUserServiceImpl; import java.util.List; import java.util.Map; @@ -135,14 +137,34 @@ public interface IcResiUserService extends BaseService { String resultTableName, List conditions); + /** + * @Description 查询个人数据 + * @param formDTO + * @author zxc + * @date 2021/11/3 9:21 上午 + */ + PersonDataResultDTO personData(PersonDataFormDTO formDTO); + + /** + * @Description 根据名字搜索 + * @param formDTO + * @param tokenDto + * @author zxc + * @date 2021/11/3 1:42 下午 + */ + List searchByName(SearchByNameFormDTO formDTO,TokenDto tokenDto); + + /** * desc:条件导出 + * + * @param itemList * @param customerId * @param formCode * @param baseTableName * @param conditions * @return */ - List> getDataForExport(String customerId, String formCode, String baseTableName, List conditions); + Map> getDataForExport(Map itemList, String customerId, String formCode, String baseTableName, List conditions); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java index b572a781e4..93cca15d0a 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java @@ -27,6 +27,7 @@ import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.enums.GenderEnum; import com.epmet.commons.tools.enums.HouseTypeEnum; @@ -34,6 +35,7 @@ import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.feign.ResultDataResolver; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; @@ -76,7 +78,7 @@ import java.util.stream.Collectors; @Slf4j @Service public class IcResiUserServiceImpl extends BaseServiceImpl implements IcResiUserService, ResultDataResolver { - private Logger logger = LogManager.getLogger(IcResiUserServiceImpl.class); + private final Logger logger = LogManager.getLogger(IcResiUserServiceImpl.class); @Autowired private IcResiUserRedis icResiUserRedis; @Autowired @@ -488,15 +490,15 @@ public class IcResiUserServiceImpl extends BaseServiceImpl headerColumnWrapper, List> dataRows, + private void persist(Map headerColumnWrapper, List> dataRows, String currUserAgencyId, Map checkBoxOptionColumnIdxAndLabel, String tableName) { for (Map row : dataRows) { // 当前行的列们 // List columnsOfCurrRow = new ArrayList<>(); - - List columnNames = new ArrayList<>(); - List columnValues = new ArrayList<>(); + + List columnNames = new ArrayList<>(); + List columnValues = new ArrayList<>(); for (Map.Entry columnWrapperEntry : headerColumnWrapper.entrySet()) { @@ -647,8 +649,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl optionValues = colIndexs.stream().filter(i -> { String cellContent = dataRow.get(i); - if (StringUtils.isNotBlank(cellContent) && cellContent.equals("是")) return true; - return false; + return StringUtils.isNotBlank(cellContent) && cellContent.equals("是"); }).map(i -> { String checkboxOptionLabel = checkboxOptions.get(i); return options.get(checkboxOptionLabel); @@ -666,7 +667,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl searchByName(SearchByNameFormDTO formDTO, TokenDto tokenDto) { + // 查询工作人员所属组织 + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); + if (null == staffInfo){ + throw new RenException("未查询到当前工作人员所属组织"); + } + Integer no = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(); + PageInfo pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.searchByName(formDTO.getName(), staffInfo.getAgencyId(), no)); + List result = pageInfo.getList(); + // 查询小区,楼号,网格 + // TODO + if (CollectionUtils.isEmpty(result)){ + return new ArrayList<>(); + } + return result; + } + /** * desc:条件导出 * + * + * @param formItemMap * @param customerId * @param formCode * @param baseTableName @@ -910,9 +951,34 @@ public class IcResiUserServiceImpl extends BaseServiceImpl> getDataForExport(String customerId, String formCode, String baseTableName, List conditions) { + public Map> getDataForExport(Map formItemMap, String customerId, String formCode, String baseTableName, List conditions) { List> mapList = this.dynamicQuery(customerId, formCode, baseTableName, conditions); - mapList.parallelStream().forEach(map -> { + + Map> result = new LinkedHashMap<>(); + mapList.stream().filter(Objects::nonNull).forEach(map -> { + String resiId = (String) map.getOrDefault(UserConstant.IC_RESI_USER, ""); + formItemMap.forEach((k, v)->{ + Object temp = map.get(k); + if (temp != null){ + if (v.getOptionSourceType().equals("remote")){ + //todo 获取 options + } + v.getOptions().forEach(optionDTO -> { + map.put(optionDTO.getValue(),temp.toString().contains(optionDTO.getValue())?"是":"否"); + }); + } + }); + if ("ic_resi_user".equals(baseTableName)) { + resiId = (String) map.get("ID"); + } + if (StringUtils.isBlank(resiId)){ + log.error("getDataForExport error,resiId:{}",resiId); + return; + } + result.put(resiId, map); + if (!"ic_resi_user".equals(baseTableName)) { + return; + } Object gridId = map.get(UserConstant.GRID_ID); if (gridId != null) { CustomerGridFormDTO formDTO = new CustomerGridFormDTO(); @@ -927,14 +993,15 @@ public class IcResiUserServiceImpl extends BaseServiceImpl houseIds = new HashSet<>(); houseIds.add(homeId.toString()); Result> houseInfoRes = govOrgOpenFeignClient.queryListHouseInfo(houseIds); - if (houseInfoRes != null && houseInfoRes.success() && CollectionUtils.isNotEmpty(houseInfoRes.getData())){ + if (houseInfoRes != null && houseInfoRes.success() && CollectionUtils.isNotEmpty(houseInfoRes.getData())) { HouseInfoDTO houseInfoDTO = houseInfoRes.getData().get(NumConstant.ZERO); map.put("VILLAGE_NAME", houseInfoDTO.getNeighborHoodName()); map.put("BUILD_NAME", houseInfoDTO.getBuildingName()); map.put("HOME_ID", houseInfoDTO.getDoorName()); } } + }); - return mapList; + return result; } } diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_info_cid.xls b/epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_info_cid.xls index f40d855531..33a4346d5b 100644 Binary files a/epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_info_cid.xls and b/epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_info_cid.xls differ diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml index 616d55e711..12b430d2f3 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml @@ -122,4 +122,42 @@ group by IC_RESI_USER.id order by ic_resi_user.CREATED_TIME desc + + + + + + + + + + + + + + \ No newline at end of file