|
|
@ -27,10 +27,15 @@ import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
|
import com.epmet.commons.tools.enums.DictTypeEnum; |
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
|
import com.epmet.commons.tools.scan.param.TextScanParamDTO; |
|
|
|
import com.epmet.commons.tools.scan.param.TextTaskDTO; |
|
|
|
import com.epmet.commons.tools.scan.result.SyncScanResult; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.commons.tools.utils.ScanContentUtils; |
|
|
|
import com.epmet.constant.ReadFlagConstant; |
|
|
|
import com.epmet.constant.UserDemandConstant; |
|
|
|
import com.epmet.constant.UserMessageTypeConstant; |
|
|
@ -56,6 +61,7 @@ import org.apache.commons.collections4.CollectionUtils; |
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
@ -96,6 +102,10 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
|
private IcCommunitySelfOrganizationService communitySelfOrganizationService; |
|
|
|
@Autowired |
|
|
|
private EpmetMessageOpenFeignClient messageOpenFeignClient; |
|
|
|
@Value("${openapi.scan.server.url}") |
|
|
|
private String scanApiUrl; |
|
|
|
@Value("${openapi.scan.method.textSyncScan}") |
|
|
|
private String textSyncScanMethod; |
|
|
|
|
|
|
|
@Override |
|
|
|
public IcUserDemandRecDTO get(String id) { |
|
|
@ -266,7 +276,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
|
//3、查询志愿者
|
|
|
|
// 服务方类型:志愿者:volunteer;社会组织:social_org;社区自组织:community_org;区域党建单位:party_unit;
|
|
|
|
Map<String,String> userInfoMap=new HashMap<>(); |
|
|
|
Set<String> userIdList=list.stream().filter(item->item.getServiceType().equals(UserDemandConstant.VOLUNTEER)).map(DemandRecResultDTO::getServerId).collect(Collectors.toSet()); |
|
|
|
Set<String> userIdList=list.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())){ |
|
|
@ -734,7 +744,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
|
//3、查询志愿者
|
|
|
|
// 服务方类型:志愿者:volunteer;社会组织:social_org;社区自组织:community_org;区域党建单位:party_unit;
|
|
|
|
Map<String,String> userInfoMap=new HashMap<>(); |
|
|
|
Set<String> userIdList=list.stream().filter(item->item.getServiceType().equals(UserDemandConstant.VOLUNTEER)).map(DemandRecResultDTO::getServerId).collect(Collectors.toSet()); |
|
|
|
Set<String> userIdList=list.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())){ |
|
|
@ -1028,19 +1038,27 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
|
if (!UserDemandConstant.FINISHED.equals(entity.getStatus())) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "服务未完成,不可评价", "服务未完成,不可评价"); |
|
|
|
} |
|
|
|
// todo 只有需求人才可以评价
|
|
|
|
|
|
|
|
//用户输入的完成情况,走内容审核
|
|
|
|
textScan(formDTO.getFinishDesc()); |
|
|
|
//当前操作用户是工作端用户还是居民端用户
|
|
|
|
String userType = ""; |
|
|
|
if (AppClientConstant.APP_GOV.equals(formDTO.getApp())) { |
|
|
|
userType = UserDemandConstant.STAFF; |
|
|
|
} else if (AppClientConstant.APP_RESI.equals(formDTO.getApp())) { |
|
|
|
userType = UserDemandConstant.RESI; |
|
|
|
} |
|
|
|
// 1、插入评价得分记录
|
|
|
|
IcUserDemandSatisfactionEntity satisfactionEntity = ConvertUtils.sourceToTarget(formDTO, IcUserDemandSatisfactionEntity.class); |
|
|
|
satisfactionEntity.setEvaluateTime(new Date()); |
|
|
|
satisfactionEntity.setUserType(UserDemandConstant.RESI); |
|
|
|
satisfactionEntity.setUserType(userType); |
|
|
|
satisfactionEntity.setRemark(formDTO.getFinishDesc()); |
|
|
|
demandSatisfactionDao.insert(satisfactionEntity); |
|
|
|
|
|
|
|
// 2、插入评价操作日志
|
|
|
|
IcUserDemandOperateLogEntity evaluateEntity = ConvertUtils.sourceToTarget(formDTO, IcUserDemandOperateLogEntity.class); |
|
|
|
evaluateEntity.setActionCode(UserDemandConstant.EVALUATE); |
|
|
|
evaluateEntity.setOperateTime(satisfactionEntity.getEvaluateTime()); |
|
|
|
evaluateEntity.setUserType(UserDemandConstant.RESI); |
|
|
|
evaluateEntity.setUserType(userType); |
|
|
|
operateLogDao.insert(evaluateEntity); |
|
|
|
|
|
|
|
// 3、更新主表已评价标识,是否解决标识。
|
|
|
@ -1054,7 +1072,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
|
finishResultDTO.setServerId(serviceEntity.getServerId()); |
|
|
|
finishResultDTO.setServiceType(serviceEntity.getServiceType()); |
|
|
|
finishResultDTO.setAwardPoint(entity.getAwardPoint()); |
|
|
|
//5、我的需求-评价:如果服务方是志愿者,通知它: 您收到来自山东路-张先生的评价,请查看。
|
|
|
|
//5、我的需求-评价:如果服务方是志愿者,通知它: 您收到来自XXX(需求人姓名)的评价,请查看。
|
|
|
|
sendVolunnterEvaluated(entity); |
|
|
|
return finishResultDTO; |
|
|
|
} |
|
|
@ -1073,7 +1091,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
|
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()); |
|
|
|
return baseDao.selectObjs(queryWrapper).stream().map(o->o.toString()).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -1091,48 +1109,50 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
|
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()); |
|
|
|
List<String> partyUnitIds = result.getList().stream().filter(l -> null != l.getServiceType() && 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()); |
|
|
|
List<String> socialOrgIds = result.getList().stream().filter(l -> null != l.getServiceType() && 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()); |
|
|
|
List<String> communityOrgIds = result.getList().stream().filter(l -> null != l.getServiceType() && 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()); |
|
|
|
Set<String> userIdList=list.stream().filter(item->null!=item.getServiceType()&&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; |
|
|
|
if(StringUtils.isNotBlank(resDto.getServiceType())){ |
|
|
|
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; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1208,34 +1228,36 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
|
} |
|
|
|
//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; |
|
|
|
if(StringUtils.isNotBlank(resDto.getServiceType())){ |
|
|
|
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; |
|
|
|
} |
|
|
@ -1250,6 +1272,8 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public DemandRecId saveOrUpdateDemand(ReportDemandFormDTO formDTO) { |
|
|
|
//需求内容走内容审核
|
|
|
|
textScan(formDTO.getContent()); |
|
|
|
Date now = new Date(); |
|
|
|
DemandRecId resultDto = new DemandRecId(); |
|
|
|
resultDto.setDemandRecId(formDTO.getDemandRecId()); |
|
|
@ -1312,6 +1336,25 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
|
return resultDto; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 需求内容,服务评价-完成情况走内容审核 |
|
|
|
* @param content |
|
|
|
*/ |
|
|
|
private void textScan(String content) { |
|
|
|
TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); |
|
|
|
TextTaskDTO taskDTO = new TextTaskDTO(); |
|
|
|
taskDTO.setContent(content); |
|
|
|
taskDTO.setDataId(UUID.randomUUID().toString().replace("-", "")); |
|
|
|
textScanParamDTO.getTasks().add(taskDTO); |
|
|
|
Result<SyncScanResult> textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); |
|
|
|
if (!textSyncScanResult.success()) { |
|
|
|
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); |
|
|
|
} else { |
|
|
|
if (!textSyncScanResult.getData().isAllPass()) { |
|
|
|
throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode(), EpmetErrorCode.TEXT_SCAN_FAILED.getMsg()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 我的需求被抢单->您提出的需求将由青岛亿联科技有限公司为您解决,请查看。 |
|
|
|