|
@ -22,12 +22,14 @@ 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.AppClientConstant; |
|
|
import com.epmet.commons.tools.constant.AppClientConstant; |
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
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.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.EpmetException; |
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
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.page.PageData; |
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
import com.epmet.commons.tools.scan.param.TextScanParamDTO; |
|
|
import com.epmet.commons.tools.scan.param.TextScanParamDTO; |
|
@ -77,7 +79,7 @@ import java.util.stream.Collectors; |
|
|
*/ |
|
|
*/ |
|
|
@Slf4j |
|
|
@Slf4j |
|
|
@Service |
|
|
@Service |
|
|
public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecDao, IcUserDemandRecEntity> implements IcUserDemandRecService { |
|
|
public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecDao, IcUserDemandRecEntity> implements IcUserDemandRecService, ResultDataResolver { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private IcUserDemandOperateLogDao operateLogDao; |
|
|
private IcUserDemandOperateLogDao operateLogDao; |
|
|
@Autowired |
|
|
@Autowired |
|
@ -792,67 +794,76 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
list=baseDao.pageListAnalysis(formDTO); |
|
|
list=baseDao.pageListAnalysis(formDTO); |
|
|
} |
|
|
} |
|
|
if(CollectionUtils.isNotEmpty(list)){ |
|
|
if(CollectionUtils.isNotEmpty(list)){ |
|
|
//1、查询网格信息
|
|
|
fillDemandsInfo(list, formDTO.getCustomerId()); |
|
|
List<String> gridIds=list.stream().map(DemandRecResultDTO::getGridId).collect(Collectors.toList()); |
|
|
} |
|
|
Result<List<AllGridsByUserIdResultDTO>> gridInfoRes=govOrgOpenFeignClient.getGridListByGridIds(gridIds); |
|
|
return new PageData<>(list, total); |
|
|
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<>(); |
|
|
* @param demandList 需求列表 |
|
|
Set<String> userIdList=list.stream().filter(item->null!=item.getServiceType()&&item.getServiceType().equals(UserDemandConstant.VOLUNTEER)).map(DemandRecResultDTO::getServerId).collect(Collectors.toSet()); |
|
|
* @param customerId 客户id |
|
|
if(CollectionUtils.isNotEmpty(userIdList)){ |
|
|
*/ |
|
|
Result<List<UserBaseInfoResultDTO>> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(new ArrayList<>(userIdList)); |
|
|
public void fillDemandsInfo(List<DemandRecResultDTO> demandList, String customerId) { |
|
|
if(!userInfoRes.success()||CollectionUtils.isEmpty(userInfoRes.getData())){ |
|
|
//1、查询网格信息
|
|
|
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(),"查询志愿者信息异常"); |
|
|
List<String> gridIds=demandList.stream().map(DemandRecResultDTO::getGridId).collect(Collectors.toList()); |
|
|
} |
|
|
Result<List<AllGridsByUserIdResultDTO>> gridInfoRes=govOrgOpenFeignClient.getGridListByGridIds(gridIds); |
|
|
userInfoMap=userInfoRes.getData().stream().collect(Collectors.toMap(UserBaseInfoResultDTO::getUserId, UserBaseInfoResultDTO::getRealName)); |
|
|
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=demandList.stream().map(DemandRecResultDTO::getCategoryCode).collect(Collectors.toList()); |
|
|
|
|
|
List<IcResiDemandDictEntity> dictList=demandDictService.listByCodes(customerId,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<>(); |
|
|
|
|
|
Set<String> userIdList=demandList.stream().filter(item->null!=item.getServiceType()&&item.getServiceType().equals(UserDemandConstant.VOLUNTEER)).map(DemandRecResultDTO::getServerId).collect(Collectors.toSet()); |
|
|
|
|
|
if(CollectionUtils.isNotEmpty(userIdList)){ |
|
|
|
|
|
Result<List<UserBaseInfoResultDTO>> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(new ArrayList<>(userIdList)); |
|
|
|
|
|
if(!userInfoRes.success()||CollectionUtils.isEmpty(userInfoRes.getData())){ |
|
|
|
|
|
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(),"查询志愿者信息异常"); |
|
|
} |
|
|
} |
|
|
|
|
|
userInfoMap=userInfoRes.getData().stream().collect(Collectors.toMap(UserBaseInfoResultDTO::getUserId, UserBaseInfoResultDTO::getRealName)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
for(DemandRecResultDTO res:list){ |
|
|
for(DemandRecResultDTO res:demandList){ |
|
|
if (null != gridInfoMap && gridInfoMap.containsKey(res.getGridId())) { |
|
|
if (null != gridInfoMap && gridInfoMap.containsKey(res.getGridId())) { |
|
|
res.setGridName(gridInfoMap.get(res.getGridId()).getGridName()); |
|
|
res.setGridName(gridInfoMap.get(res.getGridId()).getGridName()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (null != dictMap && dictMap.containsKey(res.getCategoryCode())) { |
|
|
if (null != dictMap && dictMap.containsKey(res.getCategoryCode())) { |
|
|
res.setCategoryName(dictMap.get(res.getCategoryCode())); |
|
|
res.setCategoryName(dictMap.get(res.getCategoryCode())); |
|
|
} |
|
|
} |
|
|
res.setFirstCategoryName(demandDictService.getCategoryName(formDTO.getCustomerId(), res.getFirstCategoryCode())); |
|
|
res.setFirstCategoryName(demandDictService.getCategoryName(customerId, res.getFirstCategoryCode())); |
|
|
if (null != userInfoMap && userInfoMap.containsKey(res.getServerId())) { |
|
|
if (null != userInfoMap && userInfoMap.containsKey(res.getServerId())) { |
|
|
res.setServiceName(userInfoMap.get(res.getServerId())); |
|
|
res.setServiceName(userInfoMap.get(res.getServerId())); |
|
|
} |
|
|
|
|
|
//社区帮办:community;楼长帮办:building_caption;党员帮办:party;自身上报:self_help
|
|
|
|
|
|
//待处理:pending;已取消canceled;已派单:assigned;已接单:have_order;已完成:finished
|
|
|
|
|
|
//服务方类型:志愿者:volunteer;社会组织:social_org;社区自组织:community_org;区域党建单位:party_unit;
|
|
|
|
|
|
switch (res.getServiceType()) |
|
|
|
|
|
{ |
|
|
|
|
|
case UserDemandConstant.PARTY_UNIT: |
|
|
|
|
|
res.setServiceShowName(res.getServiceName().concat("(区域化党建单位)")); |
|
|
|
|
|
break; |
|
|
|
|
|
case UserDemandConstant.SOCIAL_ORG: |
|
|
|
|
|
res.setServiceShowName(res.getServiceName().concat("(社会组织)")); |
|
|
|
|
|
break; |
|
|
|
|
|
case UserDemandConstant.COMMUNITY_ORG: |
|
|
|
|
|
res.setServiceShowName(res.getServiceName().concat("(社区自组织)")); |
|
|
|
|
|
break; |
|
|
|
|
|
case UserDemandConstant.VOLUNTEER: |
|
|
|
|
|
res.setServiceShowName(res.getServiceName().concat("(志愿者)")); |
|
|
|
|
|
break; |
|
|
|
|
|
default: |
|
|
|
|
|
res.setServiceShowName(res.getServiceName()); |
|
|
|
|
|
log.warn("serviceType 错误"); |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
res.setServiceShowFlag(StringUtils.isNotBlank(res.getServerId())); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
//社区帮办:community;楼长帮办:building_caption;党员帮办:party;自身上报:self_help
|
|
|
|
|
|
//待处理:pending;已取消canceled;已派单:assigned;已接单:have_order;已完成:finished
|
|
|
|
|
|
//服务方类型:志愿者:volunteer;社会组织:social_org;社区自组织:community_org;区域党建单位:party_unit;
|
|
|
|
|
|
switch (res.getServiceType()) |
|
|
|
|
|
{ |
|
|
|
|
|
case UserDemandConstant.PARTY_UNIT: |
|
|
|
|
|
res.setServiceShowName(res.getServiceName().concat("(区域化党建单位)")); |
|
|
|
|
|
break; |
|
|
|
|
|
case UserDemandConstant.SOCIAL_ORG: |
|
|
|
|
|
res.setServiceShowName(res.getServiceName().concat("(社会组织)")); |
|
|
|
|
|
break; |
|
|
|
|
|
case UserDemandConstant.COMMUNITY_ORG: |
|
|
|
|
|
res.setServiceShowName(res.getServiceName().concat("(社区自组织)")); |
|
|
|
|
|
break; |
|
|
|
|
|
case UserDemandConstant.VOLUNTEER: |
|
|
|
|
|
res.setServiceShowName(res.getServiceName().concat("(志愿者)")); |
|
|
|
|
|
break; |
|
|
|
|
|
default: |
|
|
|
|
|
res.setServiceShowName(res.getServiceName()); |
|
|
|
|
|
log.warn("serviceType 错误"); |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
res.setServiceShowFlag(StringUtils.isNotBlank(res.getServerId())); |
|
|
} |
|
|
} |
|
|
return new PageData<>(list, total); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -1603,7 +1614,35 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
return res; |
|
|
return res; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public PageData<DemandRecResultDTO> search(String customerId, String agencyId, String keyword, Integer pageNo, Integer pageSize) { |
|
|
|
|
|
CustomerAgencyDTO agency = getResultDataOrThrowsException(govOrgOpenFeignClient.getAgencyById(agencyId), ServiceConstant.GOV_ORG_SERVER, |
|
|
|
|
|
EpmetErrorCode.SERVER_ERROR.getCode(), "【社区查询-查询需求列表】查询当前staff所属组织信息失败", null); |
|
|
|
|
|
|
|
|
|
|
|
if (agency == null) { |
|
|
|
|
|
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "【社区查询-查询需求列表】查询当前staff所属组织信息失败"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
String gridPids; |
|
|
|
|
|
|
|
|
|
|
|
if(NumConstant.ZERO_STR.equals(agency.getPid())){ |
|
|
|
|
|
gridPids = agencyId; |
|
|
|
|
|
}else{ |
|
|
|
|
|
gridPids = agency.getPids().concat(StrConstant.COLON).concat(agencyId); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
PageListAnalysisFormDTO queryForm = new PageListAnalysisFormDTO(); |
|
|
|
|
|
queryForm.setCustomerId(customerId); |
|
|
|
|
|
queryForm.setGridPids(gridPids); |
|
|
|
|
|
queryForm.setKeyword(keyword); |
|
|
|
|
|
|
|
|
|
|
|
PageHelper.startPage(pageNo, pageSize); |
|
|
|
|
|
List<DemandRecResultDTO> list = baseDao.pageListAnalysis(queryForm); |
|
|
|
|
|
|
|
|
|
|
|
// 填充信息
|
|
|
|
|
|
fillDemandsInfo(list, customerId); |
|
|
|
|
|
|
|
|
|
|
|
return new PageData<>(list, new PageInfo<>(list).getTotal()); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|