Browse Source

修改服务措施列表查询,需求详情

dev
yinzuomei 4 years ago
parent
commit
42dc117de6
  1. 20
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/DemandDetailFormDTO.java
  2. 4
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/IcResiUserDemandFromDTO.java
  3. 30
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java
  4. 1
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcResiDemandDictDao.java
  5. 20
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcUserDemandRecDao.java
  6. 9
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcResiDemandDictService.java
  7. 17
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcUserDemandRecService.java
  8. 14
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcResiDemandDictServiceImpl.java
  9. 87
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java
  10. 13
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcResiDemandDictDao.xml
  11. 63
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml

20
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;
}

4
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; private Integer pageNo;
@NotNull(message = "pageSize不能为空", groups = AddUserInternalGroup.class) @NotNull(message = "pageSize不能为空", groups = AddUserInternalGroup.class)
private Integer pageSize; private Integer pageSize;
@NotBlank(message = "tokenDto获取客户id不能为空", groups = AddUserInternalGroup.class)
private String customerId;
} }

30
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java

@ -184,13 +184,33 @@ public class IcUserDemandRecController {
/** /**
* 数据分析-个人档案居民需求列表 * 数据分析-个人档案居民需求列表table
* @param fromDTO *
* @param formDTO
* @return * @return
*/ */
@PostMapping("mydemand") @PostMapping("mydemand")
public Result<PageData<IcResiUserReportDemandRes>> queryMyDemand(@RequestBody IcResiUserDemandFromDTO fromDTO){ public Result<PageData<IcResiUserReportDemandRes>> queryMyDemand(@LoginUser TokenDto tokenDto,@RequestBody IcResiUserDemandFromDTO formDTO){
ValidatorUtils.validateEntity(fromDTO,IcResiUserDemandFromDTO.AddUserInternalGroup.class); formDTO.setCustomerId(tokenDto.getCustomerId());
return null; ValidatorUtils.validateEntity(formDTO,IcResiUserDemandFromDTO.AddUserInternalGroup.class);
return new Result<PageData<IcResiUserReportDemandRes>>().ok(icUserDemandRecService.queryMyDemand(formDTO));
} }
/**
* 数据分析-个人档案居民需求列表-查看需求详情
*
* @param formDTO
* @return
*/
@PostMapping("demandDetail")
public Result<DemandRecResultDTO> queryDemandDetail(@LoginUser TokenDto tokenDto, @RequestBody DemandDetailFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(formDTO,DemandDetailFormDTO.AddUserInternalGroup.class);
return new Result<DemandRecResultDTO>().ok(icUserDemandRecService.queryDemandDetail(formDTO));
}
} }

1
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcResiDemandDictDao.java

@ -65,4 +65,5 @@ public interface IcResiDemandDictDao extends BaseDao<IcResiDemandDictEntity> {
List<IcResiDemandDictEntity> selectSecondCodes(@Param("customerId") String customerId, @Param("cateogryCodes") List<String> categoryCodes); List<IcResiDemandDictEntity> selectSecondCodes(@Param("customerId") String customerId, @Param("cateogryCodes") List<String> categoryCodes);
String selectNameByCode(@Param("customerId")String customerId, @Param("categoryCode") String categoryCode);
} }

20
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcUserDemandRecDao.java

@ -18,10 +18,13 @@
package com.epmet.dao; package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao; 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.form.demand.UserDemandPageFormDTO;
import com.epmet.dto.result.demand.DemandRecResultDTO; import com.epmet.dto.result.demand.DemandRecResultDTO;
import com.epmet.dto.result.demand.IcResiUserReportDemandRes;
import com.epmet.entity.IcUserDemandRecEntity; import com.epmet.entity.IcUserDemandRecEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -36,4 +39,21 @@ public interface IcUserDemandRecDao extends BaseDao<IcUserDemandRecEntity> {
List<DemandRecResultDTO> pageSelect(UserDemandPageFormDTO formDTO); List<DemandRecResultDTO> pageSelect(UserDemandPageFormDTO formDTO);
/**
* 数据分析-个人档案居民需求列表table
*
* @param formDTO
* @return
*/
List<IcResiUserReportDemandRes> selectUserDemand(IcResiUserDemandFromDTO formDTO);
/**
* 数据分析-个人档案居民需求详情
*
* @param customerId
* @param demandRecId
* @return
*/
DemandRecResultDTO selectDemandRecDetail(@Param("customerId") String customerId, @Param("demandRecId") String demandRecId);
} }

9
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcResiDemandDictService.java

@ -109,4 +109,13 @@ public interface IcResiDemandDictService extends BaseService<IcResiDemandDictEnt
* @return * @return
*/ */
List<IcResiDemandDictEntity> listByCodes(String customerId, List<String> categoryCodes); List<IcResiDemandDictEntity> listByCodes(String customerId, List<String> categoryCodes);
/**
* 查询当前分类的名称
*
* @param customerId
* @param categoryCode
* @return
*/
String getCategoryName(String customerId, String categoryCode);
} }

17
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.IcUserDemandRecDTO;
import com.epmet.dto.form.demand.*; import com.epmet.dto.form.demand.*;
import com.epmet.dto.result.demand.DemandRecResultDTO; import com.epmet.dto.result.demand.DemandRecResultDTO;
import com.epmet.dto.result.demand.IcResiUserReportDemandRes;
import com.epmet.entity.IcUserDemandRecEntity; import com.epmet.entity.IcUserDemandRecEntity;
import java.util.List; import java.util.List;
@ -127,4 +128,20 @@ public interface IcUserDemandRecService extends BaseService<IcUserDemandRecEntit
* @param formDTO * @param formDTO
*/ */
void finish(FinishStaffFromDTO formDTO); void finish(FinishStaffFromDTO formDTO);
/**
* 数据分析-个人档案居民需求列表table
*
* @param formDTO
* @return
*/
PageData<IcResiUserReportDemandRes> queryMyDemand(IcResiUserDemandFromDTO formDTO);
/**
* 数据分析-个人档案居民需求列表-查看需求详情
*
* @param formDTO
* @return
*/
DemandRecResultDTO queryDemandDetail(DemandDetailFormDTO formDTO);
} }

14
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.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant; 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.dto.result.OptionResultDTO;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
@ -227,5 +228,18 @@ public class IcResiDemandDictServiceImpl extends BaseServiceImpl<IcResiDemandDic
return baseDao.selectSecondCodes(customerId,categoryCodes); return baseDao.selectSecondCodes(customerId,categoryCodes);
} }
/**
* 查询当前分类的名称
*
* @param customerId
* @param categoryCode
* @return
*/
@Override
public String getCategoryName(String customerId, String categoryCode) {
String categoryName=baseDao.selectNameByCode(customerId,categoryCode);
return StringUtils.isNotBlank(categoryName)?categoryName: StrConstant.EPMETY_STR;
}
} }

87
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java

@ -26,6 +26,7 @@ import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.enums.DictTypeEnum; import com.epmet.commons.tools.enums.DictTypeEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
@ -43,6 +44,7 @@ import com.epmet.dto.form.demand.*;
import com.epmet.dto.result.AllGridsByUserIdResultDTO; import com.epmet.dto.result.AllGridsByUserIdResultDTO;
import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.dto.result.UserBaseInfoResultDTO;
import com.epmet.dto.result.demand.DemandRecResultDTO; import com.epmet.dto.result.demand.DemandRecResultDTO;
import com.epmet.dto.result.demand.IcResiUserReportDemandRes;
import com.epmet.entity.*; import com.epmet.entity.*;
import com.epmet.feign.EpmetAdminOpenFeignClient; import com.epmet.feign.EpmetAdminOpenFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient;
@ -301,7 +303,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
break; break;
}*/ }*/
//服务方类型:志愿者:volunteer;社会组织:social_org;社区自组织:community_org;区域党建单位:party_unit; //服务方类型:志愿者:volunteer;社会组织:social_org;社区自组织:community_org;区域党建单位:party_unit;
res.setServiceShowName(serviceTypeMap.containsKey(res.getServiceType())?serviceTypeMap.get(res.getServiceType()):StrConstant.EPMETY_STR); res.setServiceShowName(serviceTypeMap.containsKey(res.getServiceType())?res.getServiceName().concat(serviceTypeMap.get(res.getServiceType())):StrConstant.EPMETY_STR);
/*switch(res.getServiceType()){ /*switch(res.getServiceType()){
case UserDemandConstant.VOLUNTEER : case UserDemandConstant.VOLUNTEER :
res.setServiceShowName(res.getServiceName().concat("(志愿者)")); res.setServiceShowName(res.getServiceName().concat("(志愿者)"));
@ -455,4 +457,87 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
demandSatisfactionDao.insert(satisfactionEntity); demandSatisfactionDao.insert(satisfactionEntity);
} }
/**
* 数据分析-个人档案居民需求列表table
*
* @param formDTO
* @return
*/
@Override
public PageData<IcResiUserReportDemandRes> queryMyDemand(IcResiUserDemandFromDTO formDTO) {
PageInfo<IcResiUserReportDemandRes> pageInfo = PageHelper.startPage(formDTO.getPageNo(),
formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.selectUserDemand(formDTO));
List<IcResiUserReportDemandRes> list = pageInfo.getList();
if (CollectionUtils.isNotEmpty(list)) {
// 1、状态字典
Result<Map<String, String>> statusRes = adminOpenFeignClient.dictMap(DictTypeEnum.USER_DEMAND_STATUS.getCode());
Map<String, String> statusMap = statusRes.success() && MapUtils.isNotEmpty(statusRes.getData()) ? statusRes.getData() : new HashMap<>();
//2、查询分类名称
List<String> categoryCodes = list.stream().map(IcResiUserReportDemandRes::getCategoryCode).collect(Collectors.toList());
List<IcResiDemandDictEntity> dictList = demandDictService.listByCodes(formDTO.getCustomerId(), categoryCodes);
Map<String, String> 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<CustomerGridDTO> 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<String> userIdList = Arrays.asList(res.getServerId());
Result<List<UserBaseInfoResultDTO>> 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<Map<String, String>> reportTypeRes = adminOpenFeignClient.dictMap(DictTypeEnum.USER_DEMAND_REPORT_TYPE.getCode());
Map<String, String> reportTypeMap = reportTypeRes.success() && MapUtils.isNotEmpty(reportTypeRes.getData()) ? reportTypeRes.getData() : new HashMap<>();
Result<Map<String, String>> statusRes = adminOpenFeignClient.dictMap(DictTypeEnum.USER_DEMAND_STATUS.getCode());
Map<String, String> statusMap = statusRes.success() && MapUtils.isNotEmpty(statusRes.getData()) ? statusRes.getData() : new HashMap<>();
Result<Map<String, String>> serviceTypeRes = adminOpenFeignClient.dictMap(DictTypeEnum.USER_DEMAND_SERVICE_TYPE.getCode());
Map<String, String> 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;
}
} }

13
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcResiDemandDictDao.xml

@ -223,4 +223,17 @@
</foreach> </foreach>
</if> </if>
</select> </select>
<select id="selectNameByCode" parameterType="map" resultType="java.lang.String">
SELECT
( CASE WHEN m.PARENT_CODE != '0' THEN concat( p.CATEGORY_NAME, '-', m.CATEGORY_NAME ) ELSE m.CATEGORY_NAME END ) AS categoryName
FROM
ic_resi_demand_dict m
LEFT JOIN ic_resi_demand_dict p ON ( m.PARENT_CODE = p.CATEGORY_CODE AND p.DEL_FLAG = '0' AND m.CUSTOMER_ID = p.CUSTOMER_ID )
WHERE
m.DEL_FLAG = '0'
AND m.CUSTOMER_ID = #{customerId}
AND m.CATEGORY_CODE = #{categoryCode}
</select>
</mapper> </mapper>

63
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml

@ -116,4 +116,67 @@
</if> </if>
order by r.WANT_SERVICE_TIME desc,r.CREATED_TIME asc order by r.WANT_SERVICE_TIME desc,r.CREATED_TIME asc
</select> </select>
<select id="selectUserDemand" parameterType="com.epmet.dto.form.demand.IcResiUserDemandFromDTO" resultType="com.epmet.dto.result.demand.IcResiUserReportDemandRes">
SELECT
r.id as demandRecId,
r.CATEGORY_CODE as categoryCode,
r.PARENT_CODE as parentCode,
r.CONTENT,
r.`STATUS`,
r.WANT_SERVICE_TIME as wantServiceTime
FROM
ic_user_demand_rec r
WHERE
r.DEL_FLAG = '0'
AND r.DEMAND_USER_ID = #{userId}
ORDER BY
r.WANT_SERVICE_TIME DESC
</select>
<select id="selectDemandRecDetail" parameterType="java.lang.String" resultType="com.epmet.dto.result.demand.DemandRecResultDTO">
SELECT
r.ID as demandRecId,
r.GRID_ID as gridId,
r.agency_id as agencyId,
r.CATEGORY_CODE as categoryCode,
r.PARENT_CODE as parentCode,
r.CONTENT,
r.REPORT_TYPE as reportType,
r.REPORT_TIME as reportTime,
r.REPORT_USER_NAME as reportUserName,
r.REPORT_USER_MOBILE as reportUserMobile,
r.`STATUS` as status,
r.DEMAND_USER_ID as demandUserId,
r.DEMAND_USER_NAME as demandUserName,
r.DEMAND_USER_MOBILE as demandUserMobile,
concat(r.DEMAND_USER_NAME,'(',r.DEMAND_USER_MOBILE,')') as demandUser,
r.WANT_SERVICE_TIME as wantServiceTime,
IFNULL(r.FINISH_RESULT,'') as finishResult,
r.CANCEL_TIME as cancelTime,
r.EVALUATE_FLAG as evaluateFlag,
IFNULL(sa.SCORE,0) as score,
IFNULL( s.SERVICE_TYPE, '' ) AS serviceType,
IFNULL( s.SERVER_ID, '' ) AS serverId,
(
CASE WHEN s.SERVICE_TYPE='social_org' then (select m1.SOCIETY_NAME as socialOrgName from ic_society_org m1 where m1.id=s.SERVER_ID)
WHEN s.SERVICE_TYPE='community_org' then (select m2.ORGANIZATION_NAME as communityName from ic_community_self_organization m2 where m2.id=s.SERVER_ID)
WHEN s.SERVICE_TYPE='party_unit' then (select m3.UNIT_NAME as partyUnitName from ic_party_unit m3 where m3.id=s.SERVER_ID)
else ''
end
) as serviceName,
s.SERVICE_START_TIME as serviceStartTime,
s.SERVICE_END_TIME as serviceEndTime,
IFNULL(s.FINISH_DESC,'') as finishDesc,
'' AS serviceShowName,
s.id as serviceId
FROM
ic_user_demand_rec r
left JOIN ic_user_demand_service s ON ( r.id = s.DEMAND_REC_ID AND s.DEL_FLAG = '0' )
left join ic_user_demand_satisfaction sa on(r.id=sa.DEMAND_REC_ID AND sa.DEL_FLAG = '0')
WHERE
r.DEL_FLAG = '0'
AND r.CUSTOMER_ID = #{customerId}
and r.id=#{demandRecId}
</select>
</mapper> </mapper>
Loading…
Cancel
Save