|
@ -19,16 +19,13 @@ package com.epmet.service.impl; |
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
|
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.NumConstant; |
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
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.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.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
@ -49,9 +46,7 @@ import com.epmet.entity.*; |
|
|
import com.epmet.feign.EpmetAdminOpenFeignClient; |
|
|
import com.epmet.feign.EpmetAdminOpenFeignClient; |
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
import com.epmet.feign.GovOrgOpenFeignClient; |
|
|
import com.epmet.feign.GovOrgOpenFeignClient; |
|
|
import com.epmet.service.IcResiDemandDictService; |
|
|
import com.epmet.service.*; |
|
|
import com.epmet.service.IcUserDemandRecService; |
|
|
|
|
|
import com.epmet.service.VolunteerInfoService; |
|
|
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
import com.github.pagehelper.PageHelper; |
|
|
import com.github.pagehelper.PageInfo; |
|
|
import com.github.pagehelper.PageInfo; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
@ -91,31 +86,12 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
private EpmetAdminOpenFeignClient adminOpenFeignClient; |
|
|
private EpmetAdminOpenFeignClient adminOpenFeignClient; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private VolunteerInfoService volunteerInfoService; |
|
|
private VolunteerInfoService volunteerInfoService; |
|
|
|
|
|
@Autowired |
|
|
@Override |
|
|
private IcPartyUnitService partyUnitService; |
|
|
public PageData<IcUserDemandRecDTO> page(Map<String, Object> params) { |
|
|
@Autowired |
|
|
IPage<IcUserDemandRecEntity> page = baseDao.selectPage( |
|
|
private IcSocietyOrgService societyOrgService; |
|
|
getPage(params, FieldConstant.CREATED_TIME, false), |
|
|
@Autowired |
|
|
getWrapper(params) |
|
|
private IcCommunitySelfOrganizationService communitySelfOrganizationService; |
|
|
); |
|
|
|
|
|
return getPageData(page, IcUserDemandRecDTO.class); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public List<IcUserDemandRecDTO> list(Map<String, Object> params) { |
|
|
|
|
|
List<IcUserDemandRecEntity> entityList = baseDao.selectList(getWrapper(params)); |
|
|
|
|
|
|
|
|
|
|
|
return ConvertUtils.sourceToTarget(entityList, IcUserDemandRecDTO.class); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private QueryWrapper<IcUserDemandRecEntity> getWrapper(Map<String, Object> params){ |
|
|
|
|
|
String id = (String)params.get(FieldConstant.ID_HUMP); |
|
|
|
|
|
|
|
|
|
|
|
QueryWrapper<IcUserDemandRecEntity> wrapper = new QueryWrapper<>(); |
|
|
|
|
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|
|
|
|
|
|
|
|
|
|
|
return wrapper; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public IcUserDemandRecDTO get(String id) { |
|
|
public IcUserDemandRecDTO get(String id) { |
|
@ -123,29 +99,22 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
return ConvertUtils.sourceToTarget(entity, IcUserDemandRecDTO.class); |
|
|
return ConvertUtils.sourceToTarget(entity, IcUserDemandRecDTO.class); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
|
public void save(IcUserDemandRecDTO dto) { |
|
|
|
|
|
IcUserDemandRecEntity entity = ConvertUtils.sourceToTarget(dto, IcUserDemandRecEntity.class); |
|
|
|
|
|
insert(entity); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public DemandRecId update(DemandAddFromDTO dto) { |
|
|
public DemandRecId update(DemandAddFromDTO dto) { |
|
|
IcUserDemandRecEntity origin = baseDao.selectById(dto.getDemandRecId()); |
|
|
IcUserDemandRecEntity origin = baseDao.selectById(dto.getDemandRecId()); |
|
|
if (null == origin) { |
|
|
if (null == origin) { |
|
|
throw new RenException(EpmetErrorCode.DEMAND_NOT_EXITS.getCode(), EpmetErrorCode.DEMAND_NOT_EXITS.getMsg()); |
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "需求不存在", EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getMsg()); |
|
|
} |
|
|
} |
|
|
if(!UserDemandConstant.PENDING.equals(origin.getStatus())){ |
|
|
if(!UserDemandConstant.PENDING.equals(origin.getStatus())){ |
|
|
//待处理的才可以修改需求
|
|
|
//待处理的才可以修改需求
|
|
|
throw new RenException(EpmetErrorCode.DEMAND_CAN_NOT_UPDATE.getCode(),EpmetErrorCode.DEMAND_CAN_NOT_UPDATE.getMsg()); |
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), String.format("需求当前状态为【%s】,不允许重新编辑", origin.getStatus()), "需求已处理,不允许重新编辑"); |
|
|
} |
|
|
} |
|
|
CustomerGridFormDTO customerGridFormDTO=new CustomerGridFormDTO(); |
|
|
CustomerGridFormDTO customerGridFormDTO=new CustomerGridFormDTO(); |
|
|
customerGridFormDTO.setGridId(dto.getGridId()); |
|
|
customerGridFormDTO.setGridId(dto.getGridId()); |
|
|
Result<CustomerGridDTO> gridInfoRes=govOrgOpenFeignClient.getGridBaseInfoByGridId(customerGridFormDTO); |
|
|
Result<CustomerGridDTO> gridInfoRes=govOrgOpenFeignClient.getGridBaseInfoByGridId(customerGridFormDTO); |
|
|
if(!gridInfoRes.success()||null==gridInfoRes.getData()){ |
|
|
if(!gridInfoRes.success()||null==gridInfoRes.getData()){ |
|
|
throw new RenException("查询网格信息失败"); |
|
|
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(),"查询网格信息失败"); |
|
|
} |
|
|
} |
|
|
IcUserDemandRecEntity updateEntity=ConvertUtils.sourceToTarget(dto,IcUserDemandRecEntity.class); |
|
|
IcUserDemandRecEntity updateEntity=ConvertUtils.sourceToTarget(dto,IcUserDemandRecEntity.class); |
|
|
updateEntity.setAgencyId(gridInfoRes.getData().getPid()); |
|
|
updateEntity.setAgencyId(gridInfoRes.getData().getPid()); |
|
@ -215,7 +184,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
customerGridFormDTO.setGridId(fromDTO.getGridId()); |
|
|
customerGridFormDTO.setGridId(fromDTO.getGridId()); |
|
|
Result<CustomerGridDTO> gridInfoRes=govOrgOpenFeignClient.getGridBaseInfoByGridId(customerGridFormDTO); |
|
|
Result<CustomerGridDTO> gridInfoRes=govOrgOpenFeignClient.getGridBaseInfoByGridId(customerGridFormDTO); |
|
|
if(!gridInfoRes.success()||null==gridInfoRes.getData()){ |
|
|
if(!gridInfoRes.success()||null==gridInfoRes.getData()){ |
|
|
throw new RenException("查询网格信息失败"); |
|
|
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(),"查询网格信息失败"); |
|
|
} |
|
|
} |
|
|
IcUserDemandRecEntity insertEntity=ConvertUtils.sourceToTarget(fromDTO,IcUserDemandRecEntity.class); |
|
|
IcUserDemandRecEntity insertEntity=ConvertUtils.sourceToTarget(fromDTO,IcUserDemandRecEntity.class); |
|
|
insertEntity.setAgencyId(gridInfoRes.getData().getPid()); |
|
|
insertEntity.setAgencyId(gridInfoRes.getData().getPid()); |
|
@ -267,7 +236,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
public PageData<DemandRecResultDTO> pageList(UserDemandPageFormDTO formDTO) { |
|
|
public PageData<DemandRecResultDTO> pageList(UserDemandPageFormDTO formDTO) { |
|
|
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getCurrentStaffId()); |
|
|
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getCurrentStaffId()); |
|
|
if (null == staffInfo) { |
|
|
if (null == staffInfo) { |
|
|
throw new RenException("工作人员所属组织信息查询异常"); |
|
|
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(),"工作人员所属组织信息查询异常"); |
|
|
} |
|
|
} |
|
|
if (StringUtils.isBlank(staffInfo.getAgencyPIds())|| NumConstant.ZERO_STR.equals(staffInfo.getAgencyPIds())) { |
|
|
if (StringUtils.isBlank(staffInfo.getAgencyPIds())|| NumConstant.ZERO_STR.equals(staffInfo.getAgencyPIds())) { |
|
|
//当前用户属于根组织下的人
|
|
|
//当前用户属于根组织下的人
|
|
@ -297,7 +266,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
if(CollectionUtils.isNotEmpty(userIdList)){ |
|
|
if(CollectionUtils.isNotEmpty(userIdList)){ |
|
|
Result<List<UserBaseInfoResultDTO>> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(new ArrayList<>(userIdList)); |
|
|
Result<List<UserBaseInfoResultDTO>> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(new ArrayList<>(userIdList)); |
|
|
if(!userInfoRes.success()||CollectionUtils.isEmpty(userInfoRes.getData())){ |
|
|
if(!userInfoRes.success()||CollectionUtils.isEmpty(userInfoRes.getData())){ |
|
|
throw new RenException("查询志愿者信息异常"); |
|
|
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(),"查询志愿者信息异常"); |
|
|
} |
|
|
} |
|
|
userInfoMap=userInfoRes.getData().stream().collect(Collectors.toMap(UserBaseInfoResultDTO::getUserId, UserBaseInfoResultDTO::getRealName)); |
|
|
userInfoMap=userInfoRes.getData().stream().collect(Collectors.toMap(UserBaseInfoResultDTO::getUserId, UserBaseInfoResultDTO::getRealName)); |
|
|
} |
|
|
} |
|
@ -326,55 +295,10 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
} |
|
|
} |
|
|
//社区帮办:community;楼长帮办:building_caption;党员帮办:party;自身上报:self_help
|
|
|
//社区帮办:community;楼长帮办:building_caption;党员帮办:party;自身上报:self_help
|
|
|
res.setReportTypeName(reportTypeMap.containsKey(res.getReportType())?reportTypeMap.get(res.getReportType()):StrConstant.EPMETY_STR); |
|
|
res.setReportTypeName(reportTypeMap.containsKey(res.getReportType())?reportTypeMap.get(res.getReportType()):StrConstant.EPMETY_STR); |
|
|
/*switch(res.getReportType()){ |
|
|
|
|
|
case UserDemandConstant.COMMUNITY_REPORT : |
|
|
|
|
|
res.setReportTypeName("社区帮办"); |
|
|
|
|
|
break; |
|
|
|
|
|
case UserDemandConstant.BUILDING_CAPTION_REPORT : |
|
|
|
|
|
res.setReportTypeName("楼长帮办"); |
|
|
|
|
|
break; |
|
|
|
|
|
case UserDemandConstant.PARTY_REPORT : |
|
|
|
|
|
res.setReportTypeName("党员帮办"); |
|
|
|
|
|
break; |
|
|
|
|
|
case UserDemandConstant.SELF_HELP_REPORT : |
|
|
|
|
|
res.setReportTypeName("自身上报"); |
|
|
|
|
|
break; |
|
|
|
|
|
}*/ |
|
|
|
|
|
//待处理:pending;已取消canceled;已派单:assigned;已接单:have_order;已完成:finished
|
|
|
//待处理:pending;已取消canceled;已派单:assigned;已接单:have_order;已完成:finished
|
|
|
res.setStatusName(statusMap.containsKey(res.getStatus())?statusMap.get(res.getStatus()):StrConstant.EPMETY_STR); |
|
|
res.setStatusName(statusMap.containsKey(res.getStatus())?statusMap.get(res.getStatus()):StrConstant.EPMETY_STR); |
|
|
/*switch(res.getStatus()){ |
|
|
|
|
|
case UserDemandConstant.PENDING : |
|
|
|
|
|
res.setStatusName("待处理"); |
|
|
|
|
|
break; |
|
|
|
|
|
case UserDemandConstant.CANCELED : |
|
|
|
|
|
res.setStatusName("已取消"); |
|
|
|
|
|
break; |
|
|
|
|
|
case UserDemandConstant.ASSIGNED : |
|
|
|
|
|
res.setStatusName("已指派"); |
|
|
|
|
|
break; |
|
|
|
|
|
case UserDemandConstant.HAVE_ORDER : |
|
|
|
|
|
res.setStatusName("已接单"); |
|
|
|
|
|
break; |
|
|
|
|
|
case UserDemandConstant.FINISHED : |
|
|
|
|
|
res.setStatusName("已完成"); |
|
|
|
|
|
break; |
|
|
|
|
|
}*/ |
|
|
|
|
|
//服务方类型:志愿者:volunteer;社会组织:social_org;社区自组织:community_org;区域党建单位:party_unit;
|
|
|
//服务方类型:志愿者: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); |
|
|
res.setServiceShowName(serviceTypeMap.containsKey(res.getServiceType())?res.getServiceName().concat("(").concat(serviceTypeMap.get(res.getServiceType())).concat(")"):StrConstant.EPMETY_STR); |
|
|
/*switch(res.getServiceType()){ |
|
|
|
|
|
case UserDemandConstant.VOLUNTEER : |
|
|
|
|
|
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.PARTY_UNIT : |
|
|
|
|
|
res.setServiceShowName(res.getServiceName().concat("(区域化党建单位)")); |
|
|
|
|
|
break; |
|
|
|
|
|
}*/ |
|
|
|
|
|
res.setServiceShowFlag(StringUtils.isNotBlank(res.getServerId()) ? true : false); |
|
|
res.setServiceShowFlag(StringUtils.isNotBlank(res.getServerId()) ? true : false); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -391,11 +315,11 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
public void cancel(CancelDemandFormDTO formDTO) { |
|
|
public void cancel(CancelDemandFormDTO formDTO) { |
|
|
IcUserDemandRecEntity entity = baseDao.selectById(formDTO.getDemandRecId()); |
|
|
IcUserDemandRecEntity entity = baseDao.selectById(formDTO.getDemandRecId()); |
|
|
if (null == entity) { |
|
|
if (null == entity) { |
|
|
throw new RenException(EpmetErrorCode.DEMAND_NOT_EXITS.getCode(), EpmetErrorCode.DEMAND_NOT_EXITS.getMsg()); |
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "需求不存在", EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getMsg()); |
|
|
} |
|
|
} |
|
|
if (UserDemandConstant.FINISH.equals(entity.getStatus())) { |
|
|
if (UserDemandConstant.FINISH.equals(entity.getStatus()) || UserDemandConstant.CANCELED.equals(entity.getStatus())) { |
|
|
//需求已完成,不可取消
|
|
|
//需求已完成,不可取消
|
|
|
throw new RenException(EpmetErrorCode.DEMAND_CAN_NOT_CANCEL.getCode(),EpmetErrorCode.DEMAND_CAN_NOT_CANCEL.getMsg()); |
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), String.format("需求当前状态为【%s】,不可取消需求", entity.getStatus()), "当前状态,不可取消"); |
|
|
} |
|
|
} |
|
|
//1、修改主表
|
|
|
//1、修改主表
|
|
|
//置为取消状态、设置取消时间
|
|
|
//置为取消状态、设置取消时间
|
|
@ -422,11 +346,11 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
public void assign(AssignFormDTO formDTO) { |
|
|
public void assign(AssignFormDTO formDTO) { |
|
|
IcUserDemandRecEntity entity = baseDao.selectById(formDTO.getDemandRecId()); |
|
|
IcUserDemandRecEntity entity = baseDao.selectById(formDTO.getDemandRecId()); |
|
|
if (null == entity) { |
|
|
if (null == entity) { |
|
|
throw new RenException(EpmetErrorCode.DEMAND_NOT_EXITS.getCode(), EpmetErrorCode.DEMAND_NOT_EXITS.getMsg()); |
|
|
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "需求不存在", EpmetErrorCode.SERVER_ERROR.getMsg()); |
|
|
} |
|
|
} |
|
|
if (!UserDemandConstant.PENDING.equals(entity.getStatus()) && !UserDemandConstant.ASSIGNED.equals(entity.getStatus())) { |
|
|
if (!UserDemandConstant.PENDING.equals(entity.getStatus()) && !UserDemandConstant.ASSIGNED.equals(entity.getStatus())) { |
|
|
//待处理+已派单才可以指派
|
|
|
//待处理+已派单才可以指派
|
|
|
throw new RenException(EpmetErrorCode.DEMAND_CAN_NOT_ASSIGN.getCode(), EpmetErrorCode.DEMAND_CAN_NOT_ASSIGN.getMsg()); |
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), String.format("需求当前状态为【%s】,不可指派",entity.getStatus()),"当前状态,不可指派"); |
|
|
} |
|
|
} |
|
|
//1、修改主表
|
|
|
//1、修改主表
|
|
|
//置为已派单
|
|
|
//置为已派单
|
|
@ -474,11 +398,10 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
//2、更新服务记录,记录实际开始,实际结束时间
|
|
|
//2、更新服务记录,记录实际开始,实际结束时间
|
|
|
IcUserDemandServiceEntity serviceEntity=demandServiceDao.selectById(formDTO.getServiceId()); |
|
|
IcUserDemandServiceEntity serviceEntity=demandServiceDao.selectById(formDTO.getServiceId()); |
|
|
if(null==serviceEntity){ |
|
|
if(null==serviceEntity){ |
|
|
throw new RenException(EpmetErrorCode.DEMAND_SERVICE_NOT_EXITS.getCode(), EpmetErrorCode.DEMAND_SERVICE_NOT_EXITS.getMsg()); |
|
|
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "服务记录不存在", EpmetErrorCode.SERVER_ERROR.getMsg()); |
|
|
} |
|
|
} |
|
|
serviceEntity.setServiceStartTime(formDTO.getServiceStartTime()); |
|
|
serviceEntity.setServiceStartTime(formDTO.getServiceStartTime()); |
|
|
serviceEntity.setServiceEndTime(formDTO.getServiceEndTime()); |
|
|
serviceEntity.setServiceEndTime(formDTO.getServiceEndTime()); |
|
|
serviceEntity.setFinishDesc(StringUtils.isNotBlank(formDTO.getFinishDesc())?formDTO.getFinishDesc():StrConstant.EPMETY_STR); |
|
|
|
|
|
demandServiceDao.updateById(serviceEntity); |
|
|
demandServiceDao.updateById(serviceEntity); |
|
|
|
|
|
|
|
|
// 3、pc完成情况:完成+评价
|
|
|
// 3、pc完成情况:完成+评价
|
|
@ -486,6 +409,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
//3.1、插入评价得分记录
|
|
|
//3.1、插入评价得分记录
|
|
|
IcUserDemandSatisfactionEntity satisfactionEntity=ConvertUtils.sourceToTarget(formDTO,IcUserDemandSatisfactionEntity.class); |
|
|
IcUserDemandSatisfactionEntity satisfactionEntity=ConvertUtils.sourceToTarget(formDTO,IcUserDemandSatisfactionEntity.class); |
|
|
satisfactionEntity.setEvaluateTime(logEntity.getOperateTime()); |
|
|
satisfactionEntity.setEvaluateTime(logEntity.getOperateTime()); |
|
|
|
|
|
satisfactionEntity.setRemark(StringUtils.isNotBlank(formDTO.getFinishDesc())?formDTO.getFinishDesc():StrConstant.EPMETY_STR); |
|
|
demandSatisfactionDao.insert(satisfactionEntity); |
|
|
demandSatisfactionDao.insert(satisfactionEntity); |
|
|
|
|
|
|
|
|
// 3.2插入评价操作日志
|
|
|
// 3.2插入评价操作日志
|
|
@ -518,15 +442,15 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
private IcUserDemandRecEntity checkFinishPreCondition(String demandRecId) { |
|
|
private IcUserDemandRecEntity checkFinishPreCondition(String demandRecId) { |
|
|
IcUserDemandRecEntity entity=baseDao.selectById(demandRecId); |
|
|
IcUserDemandRecEntity entity=baseDao.selectById(demandRecId); |
|
|
if (null == entity) { |
|
|
if (null == entity) { |
|
|
throw new RenException(EpmetErrorCode.DEMAND_NOT_EXITS.getCode(), EpmetErrorCode.DEMAND_NOT_EXITS.getMsg()); |
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "需求不存在", EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getMsg()); |
|
|
} |
|
|
|
|
|
if (UserDemandConstant.PENDING.equals(entity.getStatus()) ||UserDemandConstant.CANCELED.equals(entity.getStatus())) { |
|
|
|
|
|
//待处理或者已取消的不能评价
|
|
|
|
|
|
throw new RenException(EpmetErrorCode.DEMAND_CAN_NOT_FINISH.getCode(), EpmetErrorCode.DEMAND_CAN_NOT_FINISH.getMsg()); |
|
|
|
|
|
} |
|
|
} |
|
|
if(UserDemandConstant.FINISHED.equals(entity.getStatus()) ){ |
|
|
if(UserDemandConstant.FINISHED.equals(entity.getStatus()) ){ |
|
|
//已经完成
|
|
|
//已经完成
|
|
|
throw new RenException(EpmetErrorCode.DEMAND_FINISHED.getCode(), EpmetErrorCode.DEMAND_FINISHED.getMsg()); |
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "服务已完成,不可重复提交", "服务已完成,不可重复提交"); |
|
|
|
|
|
} |
|
|
|
|
|
if (!UserDemandConstant.ASSIGNED.equals(entity.getStatus()) && !UserDemandConstant.HAVE_ORDER.equals(entity.getStatus())) { |
|
|
|
|
|
//已指派、已抢单的才可以完成
|
|
|
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), String.format("需求当前状态为【%s】,不可点击服务完成",entity.getStatus()), "当前状态,不能确认服务完成"); |
|
|
} |
|
|
} |
|
|
return entity; |
|
|
return entity; |
|
|
} |
|
|
} |
|
@ -659,7 +583,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
resiUserFormDTO.setIcResiUserId(formDTO.getIcResiUserId()); |
|
|
resiUserFormDTO.setIcResiUserId(formDTO.getIcResiUserId()); |
|
|
Result<ResiUserResDTO> resiRes = epmetUserOpenFeignClient.findEpmetUser(resiUserFormDTO); |
|
|
Result<ResiUserResDTO> resiRes = epmetUserOpenFeignClient.findEpmetUser(resiUserFormDTO); |
|
|
if (!resiRes.success()) { |
|
|
if (!resiRes.success()) { |
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询小程序用户异常"); |
|
|
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "查询小程序用户异常"); |
|
|
} |
|
|
} |
|
|
if (null != resiRes.getData() && CollectionUtils.isNotEmpty(resiRes.getData().getEpmetUserIdList())) { |
|
|
if (null != resiRes.getData() && CollectionUtils.isNotEmpty(resiRes.getData().getEpmetUserIdList())) { |
|
|
formDTO.setEpmetUserIdList(resiRes.getData().getEpmetUserIdList()); |
|
|
formDTO.setEpmetUserIdList(resiRes.getData().getEpmetUserIdList()); |
|
@ -675,7 +599,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
} |
|
|
} |
|
|
if(StringUtils.isBlank(formDTO.getIcResiUserId())&&CollectionUtils.isEmpty(formDTO.getEpmetUserIdList())){ |
|
|
if(StringUtils.isBlank(formDTO.getIcResiUserId())&&CollectionUtils.isEmpty(formDTO.getEpmetUserIdList())){ |
|
|
//需求人不能为空
|
|
|
//需求人不能为空
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "需求人不能为空,icResiUserId与epmetUserIdList不能同时为空"); |
|
|
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "需求人不能为空,icResiUserId与epmetUserIdList不能同时为空"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -724,13 +648,13 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
HouseMemResDTO houseMemResDTO=new HouseMemResDTO(); |
|
|
HouseMemResDTO houseMemResDTO=new HouseMemResDTO(); |
|
|
if(StringUtils.isBlank(formDTO.getIcResiUserId())&&CollectionUtils.isEmpty(formDTO.getEpmetUserIdList())){ |
|
|
if(StringUtils.isBlank(formDTO.getIcResiUserId())&&CollectionUtils.isEmpty(formDTO.getEpmetUserIdList())){ |
|
|
//需求人不能为空
|
|
|
//需求人不能为空
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "需求人不能为空,icResiUserId与epmetUserIdList不能同时为空"); |
|
|
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "需求人不能为空,icResiUserId与epmetUserIdList不能同时为空"); |
|
|
} |
|
|
} |
|
|
//服务措施分析点击了PC录入的需求,或者个人档案进来的(这两种情况肯定会有icResiUserId)
|
|
|
//服务措施分析点击了PC录入的需求,或者个人档案进来的(这两种情况肯定会有icResiUserId)
|
|
|
if(StringUtils.isNotBlank(formDTO.getIcResiUserId())){ |
|
|
if(StringUtils.isNotBlank(formDTO.getIcResiUserId())){ |
|
|
Result<IcResiUserBriefDTO> userRes = epmetUserOpenFeignClient.findFamilyMem(formDTO.getIcResiUserId()); |
|
|
Result<IcResiUserBriefDTO> userRes = epmetUserOpenFeignClient.findFamilyMem(formDTO.getIcResiUserId()); |
|
|
if (!userRes.success() || null == userRes.getData()) { |
|
|
if (!userRes.success() || null == userRes.getData()) { |
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取居民信息接口异常"); |
|
|
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "获取居民信息接口异常"); |
|
|
} |
|
|
} |
|
|
houseMemResDTO=ConvertUtils.sourceToTarget(userRes.getData(),HouseMemResDTO.class); |
|
|
houseMemResDTO=ConvertUtils.sourceToTarget(userRes.getData(),HouseMemResDTO.class); |
|
|
} |
|
|
} |
|
@ -743,7 +667,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
findIcUserFormDTO.setEpmetUserId(formDTO.getEpmetUserIdList().get(NumConstant.ZERO)); |
|
|
findIcUserFormDTO.setEpmetUserId(formDTO.getEpmetUserIdList().get(NumConstant.ZERO)); |
|
|
Result<EpmetUserFamilyDTO> epmetUserFamilyDTOResult=epmetUserOpenFeignClient.findIcUser(findIcUserFormDTO); |
|
|
Result<EpmetUserFamilyDTO> epmetUserFamilyDTOResult=epmetUserOpenFeignClient.findIcUser(findIcUserFormDTO); |
|
|
if (!epmetUserFamilyDTOResult.success() || null == epmetUserFamilyDTOResult.getData()) { |
|
|
if (!epmetUserFamilyDTOResult.success() || null == epmetUserFamilyDTOResult.getData()) { |
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "根据小程序用户id,获取ic居民信息接口异常"); |
|
|
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "根据小程序用户id,获取ic居民信息接口异常"); |
|
|
} |
|
|
} |
|
|
houseMemResDTO=ConvertUtils.sourceToTarget(epmetUserFamilyDTOResult.getData(),HouseMemResDTO.class); |
|
|
houseMemResDTO=ConvertUtils.sourceToTarget(epmetUserFamilyDTOResult.getData(),HouseMemResDTO.class); |
|
|
formDTO.setEpmetUserIdList(epmetUserFamilyDTOResult.getData().getEpmetUserIdList()); |
|
|
formDTO.setEpmetUserIdList(epmetUserFamilyDTOResult.getData().getEpmetUserIdList()); |
|
@ -763,7 +687,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
//找到当前组织的所有上级,再拼接上自己
|
|
|
//找到当前组织的所有上级,再拼接上自己
|
|
|
Result<CustomerAgencyDTO> customerAgencyDTOResult=govOrgOpenFeignClient.getAgencyById(formDTO.getOrgId()); |
|
|
Result<CustomerAgencyDTO> customerAgencyDTOResult=govOrgOpenFeignClient.getAgencyById(formDTO.getOrgId()); |
|
|
if(!customerAgencyDTOResult.success()||null==customerAgencyDTOResult.getData()){ |
|
|
if(!customerAgencyDTOResult.success()||null==customerAgencyDTOResult.getData()){ |
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取组织信息异常govOrgOpenFeignClient.getAgencyById"); |
|
|
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "获取组织信息异常govOrgOpenFeignClient.getAgencyById"); |
|
|
} |
|
|
} |
|
|
if(NumConstant.ZERO_STR.equals(customerAgencyDTOResult.getData().getPid())){ |
|
|
if(NumConstant.ZERO_STR.equals(customerAgencyDTOResult.getData().getPid())){ |
|
|
//当前传入的组织id=客户的根组织
|
|
|
//当前传入的组织id=客户的根组织
|
|
@ -801,7 +725,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
if(CollectionUtils.isNotEmpty(userIdList)){ |
|
|
if(CollectionUtils.isNotEmpty(userIdList)){ |
|
|
Result<List<UserBaseInfoResultDTO>> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(new ArrayList<>(userIdList)); |
|
|
Result<List<UserBaseInfoResultDTO>> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(new ArrayList<>(userIdList)); |
|
|
if(!userInfoRes.success()||CollectionUtils.isEmpty(userInfoRes.getData())){ |
|
|
if(!userInfoRes.success()||CollectionUtils.isEmpty(userInfoRes.getData())){ |
|
|
throw new RenException("查询志愿者信息异常"); |
|
|
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(),"查询志愿者信息异常"); |
|
|
} |
|
|
} |
|
|
userInfoMap=userInfoRes.getData().stream().collect(Collectors.toMap(UserBaseInfoResultDTO::getUserId, UserBaseInfoResultDTO::getRealName)); |
|
|
userInfoMap=userInfoRes.getData().stream().collect(Collectors.toMap(UserBaseInfoResultDTO::getUserId, UserBaseInfoResultDTO::getRealName)); |
|
|
} |
|
|
} |
|
@ -859,7 +783,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
//2、没有服务类型直接退出
|
|
|
//2、没有服务类型直接退出
|
|
|
Result<Map<String, String>> serviceTypeRes=adminOpenFeignClient.dictMap(DictTypeEnum.USER_DEMAND_SERVICE_TYPE.getCode()); |
|
|
Result<Map<String, String>> serviceTypeRes=adminOpenFeignClient.dictMap(DictTypeEnum.USER_DEMAND_SERVICE_TYPE.getCode()); |
|
|
if(!serviceTypeRes.success()||MapUtils.isEmpty(serviceTypeRes.getData())){ |
|
|
if(!serviceTypeRes.success()||MapUtils.isEmpty(serviceTypeRes.getData())){ |
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"查询服务方类型异常,请检查是否已经配置字典信息"); |
|
|
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(),"查询服务方类型异常,请检查是否已经配置字典信息"); |
|
|
} |
|
|
} |
|
|
List<LegendDTO> legend=new ArrayList<>(); |
|
|
List<LegendDTO> legend=new ArrayList<>(); |
|
|
serviceTypeRes.getData().forEach((code,name)->{ |
|
|
serviceTypeRes.getData().forEach((code,name)->{ |
|
@ -875,7 +799,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
//找到当前组织的所有上级,再拼接上自己
|
|
|
//找到当前组织的所有上级,再拼接上自己
|
|
|
Result<CustomerAgencyDTO> customerAgencyDTOResult=govOrgOpenFeignClient.getAgencyById(formDTO.getOrgId()); |
|
|
Result<CustomerAgencyDTO> customerAgencyDTOResult=govOrgOpenFeignClient.getAgencyById(formDTO.getOrgId()); |
|
|
if(!customerAgencyDTOResult.success()||null==customerAgencyDTOResult.getData()){ |
|
|
if(!customerAgencyDTOResult.success()||null==customerAgencyDTOResult.getData()){ |
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取组织信息异常govOrgOpenFeignClient.getAgencyById"); |
|
|
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "获取组织信息异常govOrgOpenFeignClient.getAgencyById"); |
|
|
} |
|
|
} |
|
|
if(NumConstant.ZERO_STR.equals(customerAgencyDTOResult.getData().getPid())){ |
|
|
if(NumConstant.ZERO_STR.equals(customerAgencyDTOResult.getData().getPid())){ |
|
|
//当前传入的组织id=客户的根组织
|
|
|
//当前传入的组织id=客户的根组织
|
|
@ -1025,11 +949,11 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
public TakeOrderResultDTO takeOrder(TakeOrderFormDTO formDTO) { |
|
|
public TakeOrderResultDTO takeOrder(TakeOrderFormDTO formDTO) { |
|
|
IcUserDemandRecEntity entity = baseDao.selectById(formDTO.getDemandRecId()); |
|
|
IcUserDemandRecEntity entity = baseDao.selectById(formDTO.getDemandRecId()); |
|
|
if (null == entity) { |
|
|
if (null == entity) { |
|
|
throw new RenException(EpmetErrorCode.DEMAND_NOT_EXITS.getCode(), EpmetErrorCode.DEMAND_NOT_EXITS.getMsg()); |
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "需求不存在", EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getMsg()); |
|
|
} |
|
|
} |
|
|
if (!UserDemandConstant.PENDING.equals(entity.getStatus())) { |
|
|
if (!UserDemandConstant.PENDING.equals(entity.getStatus())) { |
|
|
//待处理的才可以抢单
|
|
|
//待处理的才可以抢单
|
|
|
throw new RenException(EpmetErrorCode.DEMAND_CAN_NOT_TAKE_ORDER.getCode(), EpmetErrorCode.DEMAND_CAN_NOT_TAKE_ORDER.getMsg()); |
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), String.format("需求当前状态为【%s】,不可接单",entity.getStatus()), "当前状态不可接单"); |
|
|
} |
|
|
} |
|
|
TakeOrderResultDTO takeOrderResultDTO=new TakeOrderResultDTO(); |
|
|
TakeOrderResultDTO takeOrderResultDTO=new TakeOrderResultDTO(); |
|
|
//只有志愿者才可以接单
|
|
|
//只有志愿者才可以接单
|
|
@ -1085,11 +1009,10 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
public FinishResultDTO evaluate(EvaluateDemandFormDTO formDTO) { |
|
|
public FinishResultDTO evaluate(EvaluateDemandFormDTO formDTO) { |
|
|
IcUserDemandRecEntity entity = baseDao.selectById(formDTO.getDemandRecId()); |
|
|
IcUserDemandRecEntity entity = baseDao.selectById(formDTO.getDemandRecId()); |
|
|
if (null == entity) { |
|
|
if (null == entity) { |
|
|
throw new RenException(EpmetErrorCode.DEMAND_NOT_EXITS.getCode(), EpmetErrorCode.DEMAND_NOT_EXITS.getMsg()); |
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "需求不存在", EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getMsg()); |
|
|
} |
|
|
} |
|
|
if (!UserDemandConstant.FINISHED.equals(entity.getStatus())) { |
|
|
if (!UserDemandConstant.FINISHED.equals(entity.getStatus())) { |
|
|
// 已完成的可以评价
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "服务未完成,不可评价", "服务未完成,不可评价"); |
|
|
throw new RenException(EpmetErrorCode.DEMAND_CAN_NOT_EVALUATE.getCode(), EpmetErrorCode.DEMAND_CAN_NOT_EVALUATE.getMsg()); |
|
|
|
|
|
} |
|
|
} |
|
|
// todo 只有需求人才可以评价
|
|
|
// todo 只有需求人才可以评价
|
|
|
|
|
|
|
|
@ -1120,5 +1043,135 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
return finishResultDTO; |
|
|
return finishResultDTO; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 居民端,我有需求,最近预约,显示最近预约过的五个需求,按照预约时间倒 |
|
|
|
|
|
* 查询最近预约的5个编码 |
|
|
|
|
|
* |
|
|
|
|
|
* @param userId |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
@Override |
|
|
|
|
|
public List<String> getLatestRegCode(String userId) { |
|
|
|
|
|
QueryWrapper<IcUserDemandRecEntity> queryWrapper=new QueryWrapper<>(); |
|
|
|
|
|
queryWrapper.eq("DEMAND_USER_ID",userId); |
|
|
|
|
|
queryWrapper.orderByDesc("WANT_SERVICE_TIME"); |
|
|
|
|
|
queryWrapper.last("limit 5"); |
|
|
|
|
|
queryWrapper.select("DISTINCT CATEGORY_CODE"); |
|
|
|
|
|
return baseDao.selectList(queryWrapper).stream().map(o->o.toString()).collect(Collectors.toList()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 居民端-我的需求(待处理,处理中,已完成,已取消) |
|
|
|
|
|
* 待处理:unprocessed;处理中:processing;已完成:finished;已取消:canceled |
|
|
|
|
|
* |
|
|
|
|
|
* @param formDTO |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
@Override |
|
|
|
|
|
public List<ResiClientMyDemandResDTO> queryMyDemandForResiClient(ResiClientMyDemandFormDTO formDTO) { |
|
|
|
|
|
PageInfo<ResiClientMyDemandResDTO> result = PageHelper.startPage(formDTO.getPageNo(), |
|
|
|
|
|
formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.queryMyDemandForResiClient(formDTO.getGridId(), |
|
|
|
|
|
formDTO.getType(), formDTO.getUserId())); |
|
|
|
|
|
List<ResiClientMyDemandResDTO> list=result.getList(); |
|
|
|
|
|
if (CollectionUtils.isNotEmpty(list)) { |
|
|
|
|
|
//1、服务方(社会组织、社区自组织、区域化党建单位)单位名称,负责人姓名,负责人手机号
|
|
|
|
|
|
List<String> partyUnitIds = result.getList().stream().filter(l -> l.getServiceType().equals(UserDemandConstant.PARTY_UNIT)).map(ResiClientMyDemandResDTO::getServerId).collect(Collectors.toList()); |
|
|
|
|
|
Map<String, IcPartyUnitEntity> partyUnitMap =getPartyUnitMap(partyUnitIds); |
|
|
|
|
|
|
|
|
|
|
|
List<String> socialOrgIds = result.getList().stream().filter(l -> l.getServiceType().equals(UserDemandConstant.SOCIAL_ORG)).map(ResiClientMyDemandResDTO::getServerId).collect(Collectors.toList()); |
|
|
|
|
|
Map<String, IcSocietyOrgEntity> socialOrgMap=getSocialOrgMap(socialOrgIds); |
|
|
|
|
|
|
|
|
|
|
|
List<String> communityOrgIds = result.getList().stream().filter(l -> l.getServiceType().equals(UserDemandConstant.COMMUNITY_ORG)).map(ResiClientMyDemandResDTO::getServerId).collect(Collectors.toList()); |
|
|
|
|
|
Map<String, IcCommunitySelfOrganizationEntity> communityOrgMap=getCommunityOrgMap(communityOrgIds); |
|
|
|
|
|
|
|
|
|
|
|
//2、志愿者姓名、手机号
|
|
|
|
|
|
Set<String> userIdList=list.stream().filter(item->item.getServiceType().equals(UserDemandConstant.VOLUNTEER)).map(ResiClientMyDemandResDTO::getServerId).collect(Collectors.toSet()); |
|
|
|
|
|
Map<String,UserBaseInfoResultDTO> userInfoMap=getVolunteerMap(userIdList); |
|
|
|
|
|
|
|
|
|
|
|
for (ResiClientMyDemandResDTO resDto : list) { |
|
|
|
|
|
//3、查询分类名称
|
|
|
|
|
|
IcResiDemandDictEntity demandDict = demandDictService.getByCode(formDTO.getCustomerId(), resDto.getCategoryCode()); |
|
|
|
|
|
resDto.setCategoryName(null != demandDict ? demandDict.getCategoryName() : StrConstant.EPMETY_STR); |
|
|
|
|
|
switch (resDto.getServiceType()) |
|
|
|
|
|
{ |
|
|
|
|
|
case UserDemandConstant.PARTY_UNIT: |
|
|
|
|
|
resDto.setServiceUnitName(partyUnitMap.get(resDto.getServerId()).getUnitName()); |
|
|
|
|
|
resDto.setServiceUserName(partyUnitMap.get(resDto.getServerId()).getContact()); |
|
|
|
|
|
resDto.setServiceUserMobile(partyUnitMap.get(resDto.getServerId()).getContactMobile()); |
|
|
|
|
|
break; |
|
|
|
|
|
case UserDemandConstant.SOCIAL_ORG: |
|
|
|
|
|
resDto.setServiceUnitName(socialOrgMap.get(resDto.getServerId()).getSocietyName()); |
|
|
|
|
|
resDto.setServiceUserName(socialOrgMap.get(resDto.getServerId()).getPersonInCharge()); |
|
|
|
|
|
resDto.setServiceUserMobile(socialOrgMap.get(resDto.getServerId()).getMobile()); |
|
|
|
|
|
break; |
|
|
|
|
|
case UserDemandConstant.COMMUNITY_ORG: |
|
|
|
|
|
resDto.setServiceUnitName(communityOrgMap.get(resDto.getServerId()).getOrganizationName()); |
|
|
|
|
|
resDto.setServiceUserName(communityOrgMap.get(resDto.getServerId()).getPrincipalName()); |
|
|
|
|
|
resDto.setServiceUserMobile(communityOrgMap.get(resDto.getServerId()).getPrincipalPhone()); |
|
|
|
|
|
break; |
|
|
|
|
|
case UserDemandConstant.VOLUNTEER: |
|
|
|
|
|
resDto.setServiceUnitName(StrConstant.EPMETY_STR); |
|
|
|
|
|
resDto.setServiceUserName(userInfoMap.get(resDto.getServerId()).getRealName()); |
|
|
|
|
|
resDto.setServiceUserMobile(userInfoMap.get(resDto.getServerId()).getMobile()); |
|
|
|
|
|
break; |
|
|
|
|
|
default: |
|
|
|
|
|
log.warn("serviceType 错误"); |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return list; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 获取党建单位基本信息 |
|
|
|
|
|
* @param partyUnitIds |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
private Map<String, IcPartyUnitEntity> getPartyUnitMap(List<String> partyUnitIds) { |
|
|
|
|
|
List<IcPartyUnitEntity> partyUnitList=partyUnitService.queryListById(partyUnitIds); |
|
|
|
|
|
Map<String, IcPartyUnitEntity> partyUnitMap = partyUnitList.stream().collect(Collectors.toMap(IcPartyUnitEntity::getId, o -> o, (o1, o2) -> o1)); |
|
|
|
|
|
return partyUnitMap; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 获取社会组织基本信息 |
|
|
|
|
|
* @param socialOrgIds |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
private Map<String, IcSocietyOrgEntity> getSocialOrgMap(List<String> socialOrgIds) { |
|
|
|
|
|
List<IcSocietyOrgEntity> socialOrgList=societyOrgService.queryListById(socialOrgIds); |
|
|
|
|
|
Map<String, IcSocietyOrgEntity> socialOrgMap = socialOrgList.stream().collect(Collectors.toMap(IcSocietyOrgEntity::getId, o -> o, (o1, o2) -> o1)); |
|
|
|
|
|
return socialOrgMap; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 获取社区自组织基本信息 |
|
|
|
|
|
* @param communityOrgIds |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
private Map<String, IcCommunitySelfOrganizationEntity> getCommunityOrgMap(List<String> communityOrgIds) { |
|
|
|
|
|
List<IcCommunitySelfOrganizationEntity> communityOrgList=communitySelfOrganizationService.queryListById(communityOrgIds); |
|
|
|
|
|
Map<String, IcCommunitySelfOrganizationEntity> communityOrgMap = communityOrgList.stream().collect(Collectors.toMap(IcCommunitySelfOrganizationEntity::getId, o -> o, (o1, o2) -> o1)); |
|
|
|
|
|
return communityOrgMap; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 获取志愿者基本信息 |
|
|
|
|
|
* @param userIdList |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
private Map<String, UserBaseInfoResultDTO> getVolunteerMap(Set<String> userIdList) { |
|
|
|
|
|
Map<String,UserBaseInfoResultDTO> userInfoMap=new HashMap<>(); |
|
|
|
|
|
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, o -> o, (o1, o2) -> o1)); |
|
|
|
|
|
} |
|
|
|
|
|
return userInfoMap; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |