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/controller/IcResiUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java index eacd60c613..8bd5d64f1c 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 @@ -392,4 +392,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/service/IcResiUserService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java index 8391e0967e..2d132a988b 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 @@ -23,6 +23,8 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.dto.IcResiUserDTO; import com.epmet.dto.form.*; 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; @@ -135,6 +137,24 @@ 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 customerId 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..e7b968123c 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:条件导出 * 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