diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/DemandDetailFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/DemandDetailFormDTO.java new file mode 100644 index 0000000000..25ec764f3f --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/DemandDetailFormDTO.java @@ -0,0 +1,20 @@ +package com.epmet.dto.form.demand; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +@Data +public class DemandDetailFormDTO implements Serializable { + private static final long serialVersionUID = 514538389753713095L; + public interface AddUserInternalGroup { + } + + @NotBlank(message = "demandRecId不能为空", groups = AddUserInternalGroup.class) + private String demandRecId; + + + @NotBlank(message = "tokenDto获取客户id不能为空", groups = IcResiUserDemandFromDTO.AddUserInternalGroup.class) + private String customerId; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/IcResiUserDemandFromDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/IcResiUserDemandFromDTO.java index a10a81667f..0a3382d3d3 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/IcResiUserDemandFromDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/IcResiUserDemandFromDTO.java @@ -21,4 +21,8 @@ public class IcResiUserDemandFromDTO implements Serializable { private Integer pageNo; @NotNull(message = "pageSize不能为空", groups = AddUserInternalGroup.class) private Integer pageSize; + + + @NotBlank(message = "tokenDto获取客户id不能为空", groups = AddUserInternalGroup.class) + private String customerId; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java index 27b340c61c..9ce587e7b3 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java @@ -184,13 +184,33 @@ public class IcUserDemandRecController { /** - * 数据分析-个人档案,居民需求列表 - * @param fromDTO + * 数据分析-个人档案,居民需求列表table + * + * @param formDTO * @return */ @PostMapping("mydemand") - public Result> queryMyDemand(@RequestBody IcResiUserDemandFromDTO fromDTO){ - ValidatorUtils.validateEntity(fromDTO,IcResiUserDemandFromDTO.AddUserInternalGroup.class); - return null; + public Result> queryMyDemand(@LoginUser TokenDto tokenDto,@RequestBody IcResiUserDemandFromDTO formDTO){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + ValidatorUtils.validateEntity(formDTO,IcResiUserDemandFromDTO.AddUserInternalGroup.class); + return new Result>().ok(icUserDemandRecService.queryMyDemand(formDTO)); } + + /** + * 数据分析-个人档案、居民需求列表-查看需求详情 + * + * @param formDTO + * @return + */ + @PostMapping("demandDetail") + public Result queryDemandDetail(@LoginUser TokenDto tokenDto, @RequestBody DemandDetailFormDTO formDTO){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + ValidatorUtils.validateEntity(formDTO,DemandDetailFormDTO.AddUserInternalGroup.class); + return new Result().ok(icUserDemandRecService.queryDemandDetail(formDTO)); + } + + + + + } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcResiDemandDictDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcResiDemandDictDao.java index cf2625d680..ed09bfd858 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcResiDemandDictDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcResiDemandDictDao.java @@ -65,4 +65,5 @@ public interface IcResiDemandDictDao extends BaseDao { List selectSecondCodes(@Param("customerId") String customerId, @Param("cateogryCodes") List categoryCodes); + String selectNameByCode(@Param("customerId")String customerId, @Param("categoryCode") String categoryCode); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcUserDemandRecDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcUserDemandRecDao.java index 12bc2f68b4..a06f831778 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcUserDemandRecDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcUserDemandRecDao.java @@ -18,10 +18,13 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.demand.IcResiUserDemandFromDTO; import com.epmet.dto.form.demand.UserDemandPageFormDTO; import com.epmet.dto.result.demand.DemandRecResultDTO; +import com.epmet.dto.result.demand.IcResiUserReportDemandRes; import com.epmet.entity.IcUserDemandRecEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -36,4 +39,21 @@ public interface IcUserDemandRecDao extends BaseDao { List pageSelect(UserDemandPageFormDTO formDTO); + + /** + * 数据分析-个人档案,居民需求列表table + * + * @param formDTO + * @return + */ + List selectUserDemand(IcResiUserDemandFromDTO formDTO); + + /** + * 数据分析-个人档案,居民需求详情 + * + * @param customerId + * @param demandRecId + * @return + */ + DemandRecResultDTO selectDemandRecDetail(@Param("customerId") String customerId, @Param("demandRecId") String demandRecId); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcResiDemandDictService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcResiDemandDictService.java index 3836539181..ce9c4741a7 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcResiDemandDictService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcResiDemandDictService.java @@ -109,4 +109,13 @@ public interface IcResiDemandDictService extends BaseService listByCodes(String customerId, List categoryCodes); + + /** + * 查询当前分类的名称 + * + * @param customerId + * @param categoryCode + * @return + */ + String getCategoryName(String customerId, String categoryCode); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcUserDemandRecService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcUserDemandRecService.java index a0b3799d4e..e3b719615e 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcUserDemandRecService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcUserDemandRecService.java @@ -22,6 +22,7 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.dto.IcUserDemandRecDTO; import com.epmet.dto.form.demand.*; import com.epmet.dto.result.demand.DemandRecResultDTO; +import com.epmet.dto.result.demand.IcResiUserReportDemandRes; import com.epmet.entity.IcUserDemandRecEntity; import java.util.List; @@ -127,4 +128,20 @@ public interface IcUserDemandRecService extends BaseService queryMyDemand(IcResiUserDemandFromDTO formDTO); + + /** + * 数据分析-个人档案、居民需求列表-查看需求详情 + * + * @param formDTO + * @return + */ + DemandRecResultDTO queryDemandDetail(DemandDetailFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcResiDemandDictServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcResiDemandDictServiceImpl.java index 4fd9a2b193..520e367177 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcResiDemandDictServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcResiDemandDictServiceImpl.java @@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; @@ -227,5 +228,18 @@ public class IcResiDemandDictServiceImpl extends BaseServiceImpl queryMyDemand(IcResiUserDemandFromDTO formDTO) { + PageInfo pageInfo = PageHelper.startPage(formDTO.getPageNo(), + formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.selectUserDemand(formDTO)); + List list = pageInfo.getList(); + if (CollectionUtils.isNotEmpty(list)) { + // 1、状态字典 + Result> statusRes = adminOpenFeignClient.dictMap(DictTypeEnum.USER_DEMAND_STATUS.getCode()); + Map statusMap = statusRes.success() && MapUtils.isNotEmpty(statusRes.getData()) ? statusRes.getData() : new HashMap<>(); + //2、查询分类名称 + List categoryCodes = list.stream().map(IcResiUserReportDemandRes::getCategoryCode).collect(Collectors.toList()); + List dictList = demandDictService.listByCodes(formDTO.getCustomerId(), categoryCodes); + Map dictMap = dictList.stream().collect(Collectors.toMap(IcResiDemandDictEntity::getCategoryCode, IcResiDemandDictEntity::getCategoryName)); + + for (IcResiUserReportDemandRes resDto : list) { + resDto.setStatusName(statusMap.containsKey(resDto.getStatus()) ? statusMap.get(resDto.getStatus()) : StrConstant.EPMETY_STR); + if (null != dictMap && dictMap.containsKey(resDto.getCategoryCode())) { + resDto.setCategoryName(dictMap.get(resDto.getCategoryCode())); + } + } + } + return new PageData<>(list, pageInfo.getTotal()); + } + + /** + * 数据分析-个人档案、居民需求列表-查看需求详情 + * + * @param formDTO + * @return + */ + @Override + public DemandRecResultDTO queryDemandDetail(DemandDetailFormDTO formDTO) { + DemandRecResultDTO res = baseDao.selectDemandRecDetail(formDTO.getCustomerId(), formDTO.getDemandRecId()); + if (null != res) { + CustomerGridFormDTO customerGridFormDTO = new CustomerGridFormDTO(); + customerGridFormDTO.setGridId(res.getGridId()); + Result gridInfoRes = govOrgOpenFeignClient.getGridBaseInfoByGridId(customerGridFormDTO); + res.setGridName(gridInfoRes.success() && null != gridInfoRes.getData() ? gridInfoRes.getData().getGridNamePath() : StrConstant.EPMETY_STR); + + res.setCategoryName(demandDictService.getCategoryName(formDTO.getCustomerId(), res.getCategoryCode())); + if (UserDemandConstant.VOLUNTEER.equals(res.getServiceType())) { + // 如果服务方是志愿者,需要查询小程序端的志愿者姓名 + List userIdList = Arrays.asList(res.getServerId()); + Result> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(userIdList); + if (!userInfoRes.success() || CollectionUtils.isEmpty(userInfoRes.getData())) { + throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "查询志愿者信息异常"); + } + res.setServiceName(userInfoRes.getData().get(NumConstant.ZERO).getRealName()); + } + //查询字典表 + Result> reportTypeRes = adminOpenFeignClient.dictMap(DictTypeEnum.USER_DEMAND_REPORT_TYPE.getCode()); + Map reportTypeMap = reportTypeRes.success() && MapUtils.isNotEmpty(reportTypeRes.getData()) ? reportTypeRes.getData() : new HashMap<>(); + + Result> statusRes = adminOpenFeignClient.dictMap(DictTypeEnum.USER_DEMAND_STATUS.getCode()); + Map statusMap = statusRes.success() && MapUtils.isNotEmpty(statusRes.getData()) ? statusRes.getData() : new HashMap<>(); + + Result> serviceTypeRes = adminOpenFeignClient.dictMap(DictTypeEnum.USER_DEMAND_SERVICE_TYPE.getCode()); + Map serviceTypeMap = serviceTypeRes.success() && MapUtils.isNotEmpty(serviceTypeRes.getData()) ? serviceTypeRes.getData() : new HashMap<>(); + + //社区帮办:community;楼长帮办:building_caption;党员帮办:party;自身上报:self_help + res.setReportTypeName(reportTypeMap.containsKey(res.getReportType()) ? reportTypeMap.get(res.getReportType()) : StrConstant.EPMETY_STR); + + //待处理:pending;已取消canceled;已派单:assigned;已接单:have_order;已完成:finished + res.setStatusName(statusMap.containsKey(res.getStatus()) ? statusMap.get(res.getStatus()) : StrConstant.EPMETY_STR); + + //服务方类型:志愿者:volunteer;社会组织:social_org;社区自组织:community_org;区域党建单位:party_unit; + res.setServiceShowName(serviceTypeMap.containsKey(res.getServiceType()) ? res.getServiceName().concat(serviceTypeMap.get(res.getServiceType())) : StrConstant.EPMETY_STR); + } + return res; + } + + + + + + + } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcResiDemandDictDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcResiDemandDictDao.xml index 6b49401adf..0e6293002d 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcResiDemandDictDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcResiDemandDictDao.xml @@ -223,4 +223,17 @@ + + + \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml index 72ac018284..67eab8c3f4 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml @@ -116,4 +116,67 @@ order by r.WANT_SERVICE_TIME desc,r.CREATED_TIME asc + + + + \ No newline at end of file