|  |  | @ -20,6 +20,7 @@ package com.epmet.service.impl; | 
			
		
	
		
			
				
					|  |  |  | import com.alibaba.fastjson.JSON; | 
			
		
	
		
			
				
					|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.constant.AppClientConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.constant.NumConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.constant.StrConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; | 
			
		
	
	
		
			
				
					|  |  | @ -30,20 +31,21 @@ import com.epmet.commons.tools.page.PageData; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.redis.common.CustomerStaffRedis; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.ConvertUtils; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.Result; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.constant.ReadFlagConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.constant.UserDemandConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.constant.UserMessageTypeConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dao.IcUserDemandOperateLogDao; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dao.IcUserDemandRecDao; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dao.IcUserDemandSatisfactionDao; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dao.IcUserDemandServiceDao; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.*; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.form.CustomerGridFormDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.form.FindIcUserFormDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.form.ResiUserFormDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.form.*; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.form.demand.*; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.result.*; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.result.demand.*; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.entity.*; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.feign.EpmetAdminOpenFeignClient; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.feign.EpmetMessageOpenFeignClient; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.feign.EpmetUserOpenFeignClient; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.feign.GovOrgOpenFeignClient; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.service.*; | 
			
		
	
	
		
			
				
					|  |  | @ -92,6 +94,8 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD | 
			
		
	
		
			
				
					|  |  |  |     private IcSocietyOrgService societyOrgService; | 
			
		
	
		
			
				
					|  |  |  |     @Autowired | 
			
		
	
		
			
				
					|  |  |  |     private IcCommunitySelfOrganizationService communitySelfOrganizationService; | 
			
		
	
		
			
				
					|  |  |  |     @Autowired | 
			
		
	
		
			
				
					|  |  |  |     private EpmetMessageOpenFeignClient messageOpenFeignClient; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public IcUserDemandRecDTO get(String id) { | 
			
		
	
	
		
			
				
					|  |  | @ -331,6 +335,8 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD | 
			
		
	
		
			
				
					|  |  |  |         logEntity.setActionCode(UserDemandConstant.CANCEL); | 
			
		
	
		
			
				
					|  |  |  |         logEntity.setOperateTime(entity.getCancelTime()); | 
			
		
	
		
			
				
					|  |  |  |         operateLogDao.insert(logEntity); | 
			
		
	
		
			
				
					|  |  |  |         //3、查看是否已经有志愿者接单,或者pc已经指派给志愿者了,通知它需求需求
 | 
			
		
	
		
			
				
					|  |  |  |         sendVolunnterCanceled(entity); | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
	
		
			
				
					|  |  | @ -375,7 +381,8 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD | 
			
		
	
		
			
				
					|  |  |  |             serviceEntity.setUpdatedBy(formDTO.getUserId()); | 
			
		
	
		
			
				
					|  |  |  |             demandServiceDao.updateById(serviceEntity); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         // 4、如果需求是小程序端上报的,提醒需求人,服务已指派
 | 
			
		
	
		
			
				
					|  |  |  |         sendDemandUserHaveOrgService(entity,formDTO.getServerId(),formDTO.getServiceType()); | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
	
		
			
				
					|  |  | @ -421,6 +428,9 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD | 
			
		
	
		
			
				
					|  |  |  |             //3.4更新主表已评价标识,是否解决标识。
 | 
			
		
	
		
			
				
					|  |  |  |             entity.setEvaluateFlag(true); | 
			
		
	
		
			
				
					|  |  |  |             entity.setFinishResult(formDTO.getFinishResult()); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             //3.5如果需求是志愿者完成的,发送消息:您收到来自XXX的评价,请查看。
 | 
			
		
	
		
			
				
					|  |  |  |             sendVolunnterEvaluated(entity); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         //4、修改主表状态为已完成
 | 
			
		
	
	
		
			
				
					|  |  | @ -431,6 +441,8 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD | 
			
		
	
		
			
				
					|  |  |  |         finishResultDTO.setServerId(serviceEntity.getServerId()); | 
			
		
	
		
			
				
					|  |  |  |         finishResultDTO.setServiceType(serviceEntity.getServiceType()); | 
			
		
	
		
			
				
					|  |  |  |         finishResultDTO.setAwardPoint(entity.getAwardPoint()); | 
			
		
	
		
			
				
					|  |  |  |         // 5、如果是居民端用户提出的需求,发消息:您提出的需求已完成,请进行服务评价。
 | 
			
		
	
		
			
				
					|  |  |  |         sendDemandUserFinished(entity); | 
			
		
	
		
			
				
					|  |  |  |         return finishResultDTO; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  | @ -995,6 +1007,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD | 
			
		
	
		
			
				
					|  |  |  |             demandServiceDao.updateById(origin); | 
			
		
	
		
			
				
					|  |  |  |             serviceId=origin.getId(); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         this.sendDemandUserHaveVolunnteerService(entity,formDTO.getUserId()); | 
			
		
	
		
			
				
					|  |  |  |         takeOrderResultDTO.setServiceId(serviceId); | 
			
		
	
		
			
				
					|  |  |  |         return takeOrderResultDTO; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
	
		
			
				
					|  |  | @ -1041,6 +1054,8 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD | 
			
		
	
		
			
				
					|  |  |  |         finishResultDTO.setServerId(serviceEntity.getServerId()); | 
			
		
	
		
			
				
					|  |  |  |         finishResultDTO.setServiceType(serviceEntity.getServiceType()); | 
			
		
	
		
			
				
					|  |  |  |         finishResultDTO.setAwardPoint(entity.getAwardPoint()); | 
			
		
	
		
			
				
					|  |  |  |         //5、我的需求-评价:如果服务方是志愿者,通知它:  您收到来自山东路-张先生的评价,请查看。
 | 
			
		
	
		
			
				
					|  |  |  |         sendVolunnterEvaluated(entity); | 
			
		
	
		
			
				
					|  |  |  |         return finishResultDTO; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  | @ -1175,4 +1190,257 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD | 
			
		
	
		
			
				
					|  |  |  |         return userInfoMap; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * 我的需求-需求详情(待处理,处理中,已完成,已取消) | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @param formDTO | 
			
		
	
		
			
				
					|  |  |  |      * @return | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public DemandDetailResDTO queryMyDetail(DemandDetailFormDTO formDTO) { | 
			
		
	
		
			
				
					|  |  |  |         DemandRecResultDTO demandRecResultDTO = baseDao.selectDemandRecDetail(formDTO.getCustomerId(), formDTO.getDemandRecId()); | 
			
		
	
		
			
				
					|  |  |  |         if (null != demandRecResultDTO) { | 
			
		
	
		
			
				
					|  |  |  |             DemandDetailResDTO resDto = ConvertUtils.sourceToTarget(demandRecResultDTO, DemandDetailResDTO.class); | 
			
		
	
		
			
				
					|  |  |  |             //1、设置分类名称
 | 
			
		
	
		
			
				
					|  |  |  |             IcResiDemandDictEntity demandDictEntity = demandDictService.getByCode(formDTO.getCustomerId(), resDto.getCategoryCode()); | 
			
		
	
		
			
				
					|  |  |  |             if (null != demandDictEntity) { | 
			
		
	
		
			
				
					|  |  |  |                 resDto.setCategoryName(demandDictEntity.getCategoryName()); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |             //2、志愿者(姓名、手机号
 | 
			
		
	
		
			
				
					|  |  |  |             //3、区域化党建单位、社会组织、社区自组织 设置负责人和手机
 | 
			
		
	
		
			
				
					|  |  |  |             switch (resDto.getServiceType()) { | 
			
		
	
		
			
				
					|  |  |  |                 case UserDemandConstant.PARTY_UNIT: | 
			
		
	
		
			
				
					|  |  |  |                     Map<String, IcPartyUnitEntity> partyUnitMap = getPartyUnitMap(Arrays.asList(resDto.getServerId())); | 
			
		
	
		
			
				
					|  |  |  |                     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: | 
			
		
	
		
			
				
					|  |  |  |                     Map<String, IcSocietyOrgEntity> socialOrgMap = getSocialOrgMap(Arrays.asList(resDto.getServerId())); | 
			
		
	
		
			
				
					|  |  |  |                     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: | 
			
		
	
		
			
				
					|  |  |  |                     Map<String, IcCommunitySelfOrganizationEntity> communityOrgMap = getCommunityOrgMap(Arrays.asList(resDto.getServerId())); | 
			
		
	
		
			
				
					|  |  |  |                     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: | 
			
		
	
		
			
				
					|  |  |  |                     Map<String, UserBaseInfoResultDTO> userInfoMap = getVolunteerMap(new HashSet<>(Arrays.asList(resDto.getServerId()))); | 
			
		
	
		
			
				
					|  |  |  |                     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 resDto; | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         return null; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * 居民端-我的需求:提交需求,修改需求 | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @param formDTO | 
			
		
	
		
			
				
					|  |  |  |      * @return | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public DemandRecId saveOrUpdateDemand(ReportDemandFormDTO formDTO) { | 
			
		
	
		
			
				
					|  |  |  |         Date now = new Date(); | 
			
		
	
		
			
				
					|  |  |  |         DemandRecId resultDto = new DemandRecId(); | 
			
		
	
		
			
				
					|  |  |  |         resultDto.setDemandRecId(formDTO.getDemandRecId()); | 
			
		
	
		
			
				
					|  |  |  |         if (StringUtils.isNotBlank(formDTO.getDemandRecId())) { | 
			
		
	
		
			
				
					|  |  |  |             //修改需求
 | 
			
		
	
		
			
				
					|  |  |  |             IcUserDemandRecEntity origin = baseDao.selectById(formDTO.getDemandRecId()); | 
			
		
	
		
			
				
					|  |  |  |             if (null == origin) { | 
			
		
	
		
			
				
					|  |  |  |                 throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "需求不存在", EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getMsg()); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |             if (!UserDemandConstant.PENDING.equals(origin.getStatus())) { | 
			
		
	
		
			
				
					|  |  |  |                 //待处理的才可以修改需求
 | 
			
		
	
		
			
				
					|  |  |  |                 throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), String.format("需求当前状态为【%s】,不允许重新编辑", origin.getStatus()), "需求已处理,不允许重新编辑"); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |             origin.setContent(formDTO.getContent()); | 
			
		
	
		
			
				
					|  |  |  |             origin.setWantServiceTime(formDTO.getWantServiceTime()); | 
			
		
	
		
			
				
					|  |  |  |             origin.setDemandUserName(formDTO.getDemandUserName()); | 
			
		
	
		
			
				
					|  |  |  |             origin.setDemandUserMobile(formDTO.getDemandUserMobile()); | 
			
		
	
		
			
				
					|  |  |  |             origin.setServiceLocation(formDTO.getServiceLocation()); | 
			
		
	
		
			
				
					|  |  |  |             origin.setLatitude(formDTO.getLatitude()); | 
			
		
	
		
			
				
					|  |  |  |             origin.setLongitude(formDTO.getLongitude()); | 
			
		
	
		
			
				
					|  |  |  |             origin.setLocationDetail(formDTO.getLocationDetail()); | 
			
		
	
		
			
				
					|  |  |  |             baseDao.updateById(origin); | 
			
		
	
		
			
				
					|  |  |  |         } else { | 
			
		
	
		
			
				
					|  |  |  |             CustomerGridFormDTO customerGridFormDTO = new CustomerGridFormDTO(); | 
			
		
	
		
			
				
					|  |  |  |             customerGridFormDTO.setGridId(formDTO.getGridId()); | 
			
		
	
		
			
				
					|  |  |  |             Result<CustomerGridDTO> gridInfoRes = govOrgOpenFeignClient.getGridBaseInfoByGridId(customerGridFormDTO); | 
			
		
	
		
			
				
					|  |  |  |             if (!gridInfoRes.success() || null == gridInfoRes.getData()) { | 
			
		
	
		
			
				
					|  |  |  |                 throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "查询网格信息失败"); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |             IcUserDemandRecEntity insertEntity = ConvertUtils.sourceToTarget(formDTO, IcUserDemandRecEntity.class); | 
			
		
	
		
			
				
					|  |  |  |             insertEntity.setAgencyId(gridInfoRes.getData().getPid()); | 
			
		
	
		
			
				
					|  |  |  |             insertEntity.setGridPids(gridInfoRes.getData().getPids()); | 
			
		
	
		
			
				
					|  |  |  |             insertEntity.setDemandUserType(UserDemandConstant.MINI_RESI); | 
			
		
	
		
			
				
					|  |  |  |             insertEntity.setStatus(UserDemandConstant.PENDING); | 
			
		
	
		
			
				
					|  |  |  |             insertEntity.setEvaluateFlag(false); | 
			
		
	
		
			
				
					|  |  |  |             //设置上报人消息
 | 
			
		
	
		
			
				
					|  |  |  |             insertEntity.setReportType(UserDemandConstant.SELF_HELP_REPORT); | 
			
		
	
		
			
				
					|  |  |  |             insertEntity.setReportTime(now); | 
			
		
	
		
			
				
					|  |  |  |             insertEntity.setReportUserId(formDTO.getDemandUserId()); | 
			
		
	
		
			
				
					|  |  |  |             insertEntity.setReportUserMobile(formDTO.getDemandUserMobile()); | 
			
		
	
		
			
				
					|  |  |  |             insertEntity.setReportUserName(formDTO.getDemandUserName()); | 
			
		
	
		
			
				
					|  |  |  |             //记录发放积分
 | 
			
		
	
		
			
				
					|  |  |  |             IcResiDemandDictEntity icResiDemandDictEntity = demandDictService.getByCode(formDTO.getCustomerId(), formDTO.getCategoryCode()); | 
			
		
	
		
			
				
					|  |  |  |             if (null != icResiDemandDictEntity) { | 
			
		
	
		
			
				
					|  |  |  |                 insertEntity.setAwardPoint(icResiDemandDictEntity.getAwardPoint()); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |             baseDao.insert(insertEntity); | 
			
		
	
		
			
				
					|  |  |  |             resultDto.setDemandRecId(insertEntity.getId()); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         //插入操作日志
 | 
			
		
	
		
			
				
					|  |  |  |         IcUserDemandOperateLogEntity logEntity = new IcUserDemandOperateLogEntity(); | 
			
		
	
		
			
				
					|  |  |  |         logEntity.setCustomerId(formDTO.getCustomerId()); | 
			
		
	
		
			
				
					|  |  |  |         logEntity.setDemandRecId(resultDto.getDemandRecId()); | 
			
		
	
		
			
				
					|  |  |  |         logEntity.setUserType(UserDemandConstant.RESI); | 
			
		
	
		
			
				
					|  |  |  |         logEntity.setUserId(formDTO.getDemandUserId()); | 
			
		
	
		
			
				
					|  |  |  |         logEntity.setActionCode(StringUtils.isNotBlank(formDTO.getDemandRecId()) ? UserDemandConstant.UPDATE : UserDemandConstant.CREATE); | 
			
		
	
		
			
				
					|  |  |  |         logEntity.setOperateTime(now); | 
			
		
	
		
			
				
					|  |  |  |         operateLogDao.insert(logEntity); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         return resultDto; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * 我的需求被抢单->您提出的需求将由青岛亿联科技有限公司为您解决,请查看。 | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     private void sendDemandUserHaveVolunnteerService(IcUserDemandRecEntity entity, String volunteerUserId) { | 
			
		
	
		
			
				
					|  |  |  |         // 如果需求人是小程序里的用户,需要通知需求人:
 | 
			
		
	
		
			
				
					|  |  |  |         // 您提出的需求将由青岛亿联科技有限公司为您解决,请查看。
 | 
			
		
	
		
			
				
					|  |  |  |         // 您提出的需求将由张三为您解决,请查看。
 | 
			
		
	
		
			
				
					|  |  |  |         if (UserDemandConstant.MINI_RESI.equals(entity.getDemandUserType())) { | 
			
		
	
		
			
				
					|  |  |  |             UserResiInfoListFormDTO formDTO = new UserResiInfoListFormDTO(); | 
			
		
	
		
			
				
					|  |  |  |             formDTO.setUserIdList(Arrays.asList(volunteerUserId)); | 
			
		
	
		
			
				
					|  |  |  |             Result<List<UserResiInfoResultDTO>> userRes = epmetUserOpenFeignClient.getUserResiInfoList(formDTO); | 
			
		
	
		
			
				
					|  |  |  |             if (userRes.success() && CollectionUtils.isNotEmpty(userRes.getData())) { | 
			
		
	
		
			
				
					|  |  |  |                 String volunteerName=userRes.getData().get(NumConstant.ZERO).getRealName(); | 
			
		
	
		
			
				
					|  |  |  |                 UserMessageFormDTO userMessage = new UserMessageFormDTO(); | 
			
		
	
		
			
				
					|  |  |  |                 userMessage.setApp(AppClientConstant.APP_RESI); | 
			
		
	
		
			
				
					|  |  |  |                 userMessage.setCustomerId(entity.getCustomerId()); | 
			
		
	
		
			
				
					|  |  |  |                 userMessage.setGridId(entity.getGridId()); | 
			
		
	
		
			
				
					|  |  |  |                 String messageContent = String.format(UserDemandConstant.HAVE_SERVICE, volunteerName); | 
			
		
	
		
			
				
					|  |  |  |                 userMessage.setMessageContent(messageContent); | 
			
		
	
		
			
				
					|  |  |  |                 userMessage.setReadFlag(ReadFlagConstant.UN_READ); | 
			
		
	
		
			
				
					|  |  |  |                 userMessage.setTitle(UserDemandConstant.MESSAGE_TITILE); | 
			
		
	
		
			
				
					|  |  |  |                 userMessage.setMessageType(UserMessageTypeConstant.DEMAND); | 
			
		
	
		
			
				
					|  |  |  |                 userMessage.setTargetId(entity.getId()); | 
			
		
	
		
			
				
					|  |  |  |                 //通知需求提出人
 | 
			
		
	
		
			
				
					|  |  |  |                 userMessage.setUserId(entity.getDemandUserId()); | 
			
		
	
		
			
				
					|  |  |  |                 messageOpenFeignClient.saveUserMessage(userMessage); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * 您提出的需求将由青岛亿联科技有限公司为您解决,请查看。 | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     private void sendDemandUserHaveOrgService(IcUserDemandRecEntity entity, String serverId, String serviceType) { | 
			
		
	
		
			
				
					|  |  |  |         // 如果需求人是小程序里的用户,需要通知需求人:
 | 
			
		
	
		
			
				
					|  |  |  |         // 您提出的需求将由青岛亿联科技有限公司为您解决,请查看。
 | 
			
		
	
		
			
				
					|  |  |  |         String serviceName = ""; | 
			
		
	
		
			
				
					|  |  |  |         if (UserDemandConstant.PARTY_UNIT.equals(serviceType)) { | 
			
		
	
		
			
				
					|  |  |  |             IcPartyUnitDTO data = partyUnitService.get(serverId); | 
			
		
	
		
			
				
					|  |  |  |             serviceName = null != data ? data.getUnitName() : StrConstant.EPMETY_STR; | 
			
		
	
		
			
				
					|  |  |  |         } else if (UserDemandConstant.SOCIAL_ORG.equals(serviceType)) { | 
			
		
	
		
			
				
					|  |  |  |             Map<String, IcSocietyOrgEntity> map = getSocialOrgMap(Arrays.asList(serverId)); | 
			
		
	
		
			
				
					|  |  |  |             serviceName = MapUtils.isNotEmpty(map) ? map.get(serverId).getSocietyName() : StrConstant.EPMETY_STR; | 
			
		
	
		
			
				
					|  |  |  |         } else if (UserDemandConstant.COMMUNITY_ORG.equals(serviceType)) { | 
			
		
	
		
			
				
					|  |  |  |             Map<String, IcCommunitySelfOrganizationEntity> communityOrgMap = getCommunityOrgMap(Arrays.asList(serverId)); | 
			
		
	
		
			
				
					|  |  |  |             serviceName = MapUtils.isNotEmpty(communityOrgMap) ? communityOrgMap.get(serverId).getOrganizationName() : StrConstant.EPMETY_STR; | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         if (StringUtils.isNotBlank(serviceName)) { | 
			
		
	
		
			
				
					|  |  |  |             UserMessageFormDTO userMessage = new UserMessageFormDTO(); | 
			
		
	
		
			
				
					|  |  |  |             userMessage.setApp(AppClientConstant.APP_RESI); | 
			
		
	
		
			
				
					|  |  |  |             userMessage.setCustomerId(entity.getCustomerId()); | 
			
		
	
		
			
				
					|  |  |  |             userMessage.setGridId(entity.getGridId()); | 
			
		
	
		
			
				
					|  |  |  |             String messageContent = String.format(UserDemandConstant.HAVE_SERVICE, serviceName); | 
			
		
	
		
			
				
					|  |  |  |             userMessage.setMessageContent(messageContent); | 
			
		
	
		
			
				
					|  |  |  |             userMessage.setReadFlag(ReadFlagConstant.UN_READ); | 
			
		
	
		
			
				
					|  |  |  |             userMessage.setTitle(UserDemandConstant.MESSAGE_TITILE); | 
			
		
	
		
			
				
					|  |  |  |             userMessage.setMessageType(UserMessageTypeConstant.DEMAND); | 
			
		
	
		
			
				
					|  |  |  |             userMessage.setTargetId(entity.getId()); | 
			
		
	
		
			
				
					|  |  |  |             //通知需求提出人
 | 
			
		
	
		
			
				
					|  |  |  |             userMessage.setUserId(entity.getDemandUserId()); | 
			
		
	
		
			
				
					|  |  |  |             messageOpenFeignClient.saveUserMessage(userMessage); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * 我的需求服务完成->您提出的需求已完成,请进行服务评价。 | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     private void sendDemandUserFinished(IcUserDemandRecEntity entity) { | 
			
		
	
		
			
				
					|  |  |  |         if (UserDemandConstant.MINI_RESI.equals(entity.getDemandUserType())) { | 
			
		
	
		
			
				
					|  |  |  |             UserMessageFormDTO userMessage = new UserMessageFormDTO(); | 
			
		
	
		
			
				
					|  |  |  |             userMessage.setApp(AppClientConstant.APP_RESI); | 
			
		
	
		
			
				
					|  |  |  |             userMessage.setCustomerId(entity.getCustomerId()); | 
			
		
	
		
			
				
					|  |  |  |             userMessage.setGridId(entity.getGridId()); | 
			
		
	
		
			
				
					|  |  |  |             String messageContent = UserDemandConstant.FINISH_DEMAND_MESSAGE; | 
			
		
	
		
			
				
					|  |  |  |             userMessage.setMessageContent(messageContent); | 
			
		
	
		
			
				
					|  |  |  |             userMessage.setReadFlag(ReadFlagConstant.UN_READ); | 
			
		
	
		
			
				
					|  |  |  |             userMessage.setTitle(UserDemandConstant.MESSAGE_TITILE); | 
			
		
	
		
			
				
					|  |  |  |             userMessage.setMessageType(UserMessageTypeConstant.DEMAND); | 
			
		
	
		
			
				
					|  |  |  |             userMessage.setTargetId(entity.getId()); | 
			
		
	
		
			
				
					|  |  |  |             //通知需求提出人
 | 
			
		
	
		
			
				
					|  |  |  |             userMessage.setUserId(entity.getDemandUserId()); | 
			
		
	
		
			
				
					|  |  |  |             messageOpenFeignClient.saveUserMessage(userMessage); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      *  我的需求-评价:如果服务方是志愿者,通知TA: 您收到来自张三的评价,请查看。 | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     private void sendVolunnterEvaluated(IcUserDemandRecEntity entity) { | 
			
		
	
		
			
				
					|  |  |  |         IcUserDemandServiceEntity serviceEntity = demandServiceDao.selectByRecId(entity.getId()); | 
			
		
	
		
			
				
					|  |  |  |         if (null != serviceEntity && UserDemandConstant.VOLUNTEER.equals(serviceEntity.getServiceType())) { | 
			
		
	
		
			
				
					|  |  |  |             UserMessageFormDTO userMessage = new UserMessageFormDTO(); | 
			
		
	
		
			
				
					|  |  |  |             userMessage.setApp(AppClientConstant.APP_RESI); | 
			
		
	
		
			
				
					|  |  |  |             userMessage.setCustomerId(entity.getCustomerId()); | 
			
		
	
		
			
				
					|  |  |  |             userMessage.setGridId(entity.getGridId()); | 
			
		
	
		
			
				
					|  |  |  |             String messageContent = String.format(UserDemandConstant.DEMAND_EVALUATED, entity.getDemandUserName()); | 
			
		
	
		
			
				
					|  |  |  |             userMessage.setMessageContent(messageContent); | 
			
		
	
		
			
				
					|  |  |  |             userMessage.setReadFlag(ReadFlagConstant.UN_READ); | 
			
		
	
		
			
				
					|  |  |  |             userMessage.setTitle(UserDemandConstant.MESSAGE_TITILE); | 
			
		
	
		
			
				
					|  |  |  |             userMessage.setMessageType(UserMessageTypeConstant.DEMAND); | 
			
		
	
		
			
				
					|  |  |  |             userMessage.setTargetId(entity.getId()); | 
			
		
	
		
			
				
					|  |  |  |             //通知志愿者
 | 
			
		
	
		
			
				
					|  |  |  |             userMessage.setUserId(serviceEntity.getServerId()); | 
			
		
	
		
			
				
					|  |  |  |             messageOpenFeignClient.saveUserMessage(userMessage); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * 我的需求-取消需求(未完成的都可以取消),如果需求已经被小程序里的志愿者接单通知它->XXX的需求已取消,请查看。 | 
			
		
	
		
			
				
					|  |  |  |      * pc指派给志愿者的,如果取消了也要通知 | 
			
		
	
		
			
				
					|  |  |  |      * @param entity | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     private void sendVolunnterCanceled(IcUserDemandRecEntity entity) { | 
			
		
	
		
			
				
					|  |  |  |         IcUserDemandServiceEntity serviceEntity = demandServiceDao.selectByRecId(entity.getId()); | 
			
		
	
		
			
				
					|  |  |  |         if (null != serviceEntity && UserDemandConstant.VOLUNTEER.equals(serviceEntity.getServiceType())) { | 
			
		
	
		
			
				
					|  |  |  |             UserMessageFormDTO userMessage = new UserMessageFormDTO(); | 
			
		
	
		
			
				
					|  |  |  |             userMessage.setApp(AppClientConstant.APP_RESI); | 
			
		
	
		
			
				
					|  |  |  |             userMessage.setCustomerId(entity.getCustomerId()); | 
			
		
	
		
			
				
					|  |  |  |             userMessage.setGridId(entity.getGridId()); | 
			
		
	
		
			
				
					|  |  |  |             String messageContent = String.format(UserDemandConstant.DEMAND_CANCELED, entity.getDemandUserName()); | 
			
		
	
		
			
				
					|  |  |  |             userMessage.setMessageContent(messageContent); | 
			
		
	
		
			
				
					|  |  |  |             userMessage.setReadFlag(ReadFlagConstant.UN_READ); | 
			
		
	
		
			
				
					|  |  |  |             userMessage.setTitle(UserDemandConstant.MESSAGE_TITILE); | 
			
		
	
		
			
				
					|  |  |  |             userMessage.setMessageType(UserMessageTypeConstant.DEMAND); | 
			
		
	
		
			
				
					|  |  |  |             userMessage.setTargetId(entity.getId()); | 
			
		
	
		
			
				
					|  |  |  |             //通知志愿者
 | 
			
		
	
		
			
				
					|  |  |  |             userMessage.setUserId(serviceEntity.getServerId()); | 
			
		
	
		
			
				
					|  |  |  |             messageOpenFeignClient.saveUserMessage(userMessage); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | } |