Browse Source

Merge remote-tracking branch 'origin/develop' into release_temp

dev_shibei_match
zxc 4 years ago
parent
commit
ec9dd3a2f6
  1. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  2. 50
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/PageListAnalysisFormDTO.java
  3. 14
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java
  4. 9
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcUserDemandRecDao.java
  5. 8
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcUserDemandRecService.java
  6. 80
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java
  7. 69
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml

2
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -163,7 +163,7 @@ public enum EpmetErrorCode {
EXISTS_SAME_PHONE_ERROR(8529, "%s存在重复"),
COMMUNITY_SELF_ORGANIZATION_LIST_REPART_ERROR(8530, "%s社区自组织名称已存在"),
MATTER_NAME_EXISTS_APPOINTMENT_ERROR(8531, "存在重复预约事项"),
MATTER_NAME_EXISTS_APPOINTMENT_ERROR(8532, "存在重复预约事项"),
// 该错误不会提示给前端,只是后端传输错误信息用。
ACCESS_SQL_FILTER_MISSION_ARGS(8701, "缺少生成权限过滤SQL所需参数"),

50
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/PageListAnalysisFormDTO.java

@ -0,0 +1,50 @@
package com.epmet.dto.form.demand;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* 数据分析-服务措施分析-分页查询接口入参
*/
@Data
public class PageListAnalysisFormDTO implements Serializable {
private static final long serialVersionUID = 4993949289966075260L;
public interface AddUserInternalGroup {
}
public interface AddUserShowGroup extends CustomerClientShowGroup {
}
@NotNull(message = "页码不能为空", groups = AddUserInternalGroup.class)
private Integer pageNo;
@NotNull(message = "每页数量不能为空", groups = AddUserInternalGroup.class)
private Integer pageSize;
@NotBlank(message = "先选择组织或网格", groups = AddUserShowGroup.class)
private String orgId;
@NotBlank(message = "组织或网格的上级", groups = AddUserShowGroup.class)
private String pid;
@NotBlank(message = "orgType=grid或者agency,不能为空", groups = AddUserInternalGroup.class)
private String orgType;
@NotBlank(message = "分类编码不能为空", groups = AddUserInternalGroup.class)
private String categoryCode;
@NotBlank(message = "上报时间起始日期不能为空,格式yyyyMMdd", groups = AddUserInternalGroup.class)
private String startDateId;
@NotBlank(message = "上报时间截止日期不能为空,格式yyyyMMdd", groups = AddUserInternalGroup.class)
private String endDateId;
@NotBlank(message = "tokenDto中的customerId不能为空",groups = AddUserInternalGroup.class)
private String customerId;
/**
* orgType=agency时pid拼接上orgId
*/
private String gridPids;
}

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

@ -224,5 +224,17 @@ public class IcUserDemandRecController {
return new Result<DemandResearchAnalysisResultDTO>().ok(icUserDemandRecService.queryDemandResearchAnalysis(formDTO));
}
/**
* 数分析-服务措施分析-分页查询
*
* @param tokenDto
* @param formDTO
* @return
*/
@PostMapping("pagelist-analysis")
public Result<PageData<DemandRecResultDTO>> pageListAnalysis(@LoginUser TokenDto tokenDto,@RequestBody PageListAnalysisFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(formDTO,PageListAnalysisFormDTO.AddUserShowGroup.class,PageListAnalysisFormDTO.AddUserInternalGroup.class);
return new Result<PageData<DemandRecResultDTO>>().ok(icUserDemandRecService.pageListAnalysis(formDTO));
}
}

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

@ -19,6 +19,7 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.demand.IcResiUserDemandFromDTO;
import com.epmet.dto.form.demand.PageListAnalysisFormDTO;
import com.epmet.dto.form.demand.UserDemandPageFormDTO;
import com.epmet.dto.result.demand.DemandRecResultDTO;
import com.epmet.dto.result.demand.IcResiUserReportDemandRes;
@ -56,4 +57,12 @@ public interface IcUserDemandRecDao extends BaseDao<IcUserDemandRecEntity> {
* @return
*/
DemandRecResultDTO selectDemandRecDetail(@Param("customerId") String customerId, @Param("demandRecId") String demandRecId);
/**
* 数分析-服务措施分析-分页查询
*
* @param formDTO
* @return
*/
List<DemandRecResultDTO> pageListAnalysis(PageListAnalysisFormDTO formDTO);
}

8
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcUserDemandRecService.java

@ -153,4 +153,12 @@ public interface IcUserDemandRecService extends BaseService<IcUserDemandRecEntit
* @return
*/
DemandResearchAnalysisResultDTO queryDemandResearchAnalysis(DemandResearchAnalysisFormDTO formDTO);
/**
* 数分析-服务措施分析-分页查询
*
* @param formDTO
* @return
*/
PageData<DemandRecResultDTO> pageListAnalysis(PageListAnalysisFormDTO formDTO);
}

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

@ -37,6 +37,7 @@ import com.epmet.dao.IcUserDemandOperateLogDao;
import com.epmet.dao.IcUserDemandRecDao;
import com.epmet.dao.IcUserDemandSatisfactionDao;
import com.epmet.dao.IcUserDemandServiceDao;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.IcUserDemandRecDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
@ -607,7 +608,86 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
return resultDTO;
}
/**
* 数分析-服务措施分析-分页查询
*
* @param formDTO
* @return
*/
@Override
public PageData<DemandRecResultDTO> pageListAnalysis(PageListAnalysisFormDTO formDTO) {
if("agency".equals(formDTO.getOrgType())){
if(NumConstant.ZERO_STR.equals(formDTO.getPid())){
//当前传入的组织id=客户的根组织
formDTO.setGridPids(formDTO.getOrgId());
}else{
//找到当前组织的所有上级,再拼接上自己
Result<CustomerAgencyDTO> customerAgencyDTOResult=govOrgOpenFeignClient.getAgencyById(formDTO.getOrgId());
if(!customerAgencyDTOResult.success()||null==customerAgencyDTOResult.getData()){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取组织信息异常govOrgOpenFeignClient.getAgencyById");
}
formDTO.setGridPids(customerAgencyDTOResult.getData().getPids().concat(StrConstant.COLON).concat(formDTO.getOrgId()));
}
}
PageInfo<DemandRecResultDTO> pageInfo= PageHelper.startPage(formDTO.getPageNo(),
formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.pageListAnalysis(formDTO));
List<DemandRecResultDTO> list=pageInfo.getList();
if(CollectionUtils.isNotEmpty(list)){
//1、查询网格信息
List<String> gridIds=list.stream().map(DemandRecResultDTO::getGridId).collect(Collectors.toList());
Result<List<AllGridsByUserIdResultDTO>> gridInfoRes=govOrgOpenFeignClient.getGridListByGridIds(gridIds);
List<AllGridsByUserIdResultDTO> gridInfoList = gridInfoRes.success() && !CollectionUtils.isEmpty(gridInfoRes.getData()) ? gridInfoRes.getData() : new ArrayList<>();
Map<String, AllGridsByUserIdResultDTO> gridInfoMap = gridInfoList.stream().collect(Collectors.toMap(AllGridsByUserIdResultDTO::getGridId, Function.identity()));
//2、查询分类名称
List<String> categoryCodes=list.stream().map(DemandRecResultDTO::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));
//3、查询志愿者
// 服务方类型:志愿者:volunteer;社会组织:social_org;社区自组织:community_org;区域党建单位:party_unit;
Map<String,String> userInfoMap=new HashMap<>();
List<String> userIdList=list.stream().filter(item->item.getServiceType().equals(UserDemandConstant.VOLUNTEER)).map(DemandRecResultDTO::getServerId).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(userIdList)){
Result<List<UserBaseInfoResultDTO>> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(userIdList);
if(!userInfoRes.success()||CollectionUtils.isEmpty(userInfoRes.getData())){
throw new RenException("查询志愿者信息异常");
}
userInfoMap=userInfoRes.getData().stream().collect(Collectors.toMap(UserBaseInfoResultDTO::getUserId, UserBaseInfoResultDTO::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<>();
for(DemandRecResultDTO res:list){
if (null != gridInfoMap && gridInfoMap.containsKey(res.getGridId())) {
res.setGridName(gridInfoMap.get(res.getGridId()).getGridName());
}
if (null != dictMap && dictMap.containsKey(res.getCategoryCode())) {
res.setCategoryName(dictMap.get(res.getCategoryCode()));
}
res.setFirstCategoryName(demandDictService.getCategoryName(formDTO.getCustomerId(), res.getFirstCategoryCode()));
if (null != userInfoMap && userInfoMap.containsKey(res.getServerId())) {
res.setServiceName(userInfoMap.get(res.getServerId()));
}
//社区帮办: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("(").concat(serviceTypeMap.get(res.getServiceType())).concat(")"):StrConstant.EPMETY_STR);
}
}
return new PageData<>(list, pageInfo.getTotal());
}
}

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

@ -192,4 +192,73 @@
AND r.CUSTOMER_ID = #{customerId}
and r.id=#{demandRecId}
</select>
<!-- 列表查询 -->
<select id="pageListAnalysis" parameterType="com.epmet.dto.form.demand.PageListAnalysisFormDTO" 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,
(
case when r.PARENT_CODE !='0' then r.PARENT_CODE
ELSE R.CATEGORY_CODE
END
) as firstCategoryCode
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}
<if test="null != orgType and orgType == 'grid' ">
and r.GRID_ID=#{orgId}
</if>
<if test="null != orgType or orgType == 'agency' ">
AND r.GRID_PIDS LIKE concat(#{gridPids},'%')
</if>
<if test="null != categoryCode and categoryCode !='' ">
and r.CATEGORY_CODE LIKE CONCAT(#{categoryCode},'%')
</if>
<if test=" null != startDateId and startDateId != '' ">
AND DATE_FORMAT(r.REPORT_TIME,'%Y%m%d') <![CDATA[ >= ]]> #{startDateId}
</if>
<if test="null != endDateId and endDateId != '' ">
AND DATE_FORMAT(r.REPORT_TIME,'%Y%m%d') <![CDATA[ <= ]]> #{endDateId}
</if>
order by r.WANT_SERVICE_TIME desc,r.REPORT_TIME asc
</select>
</mapper>
Loading…
Cancel
Save