Browse Source

居民端发布需求内容+服务评价输入的完成情况走内容审核

dev_shibei_match
yinzuomei 4 years ago
parent
commit
781c85a445
  1. 3
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/EvaluateDemandFormDTO.java
  2. 1
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiDemandController.java
  3. 49
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java

3
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/EvaluateDemandFormDTO.java

@ -41,4 +41,7 @@ public class EvaluateDemandFormDTO implements Serializable {
private String userId; private String userId;
@NotBlank(message = "customerId不能为空", groups = AddUserInternalGroup.class) @NotBlank(message = "customerId不能为空", groups = AddUserInternalGroup.class)
private String customerId; private String customerId;
// 政府端:gov、居民端:resi、运营端:oper
@NotBlank(message = "app不能为空", groups = AddUserInternalGroup.class)
private String app;
} }

1
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiDemandController.java

@ -117,6 +117,7 @@ public class ResiDemandController {
public Result evaluate(@LoginUser TokenDto tokenDto, @RequestBody EvaluateDemandFormDTO formDTO) { public Result evaluate(@LoginUser TokenDto tokenDto, @RequestBody EvaluateDemandFormDTO formDTO) {
formDTO.setUserId(tokenDto.getUserId()); formDTO.setUserId(tokenDto.getUserId());
formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setApp(tokenDto.getApp());
ValidatorUtils.validateEntity(formDTO, EvaluateDemandFormDTO.ShowGroup.class, EvaluateDemandFormDTO.AddUserInternalGroup.class); ValidatorUtils.validateEntity(formDTO, EvaluateDemandFormDTO.ShowGroup.class, EvaluateDemandFormDTO.AddUserInternalGroup.class);
FinishResultDTO finishResultDTO = icUserDemandRecService.evaluate(formDTO); FinishResultDTO finishResultDTO = icUserDemandRecService.evaluate(formDTO);
//如果服务方是区域化党建单位,需要实时去计算他的群众满意度=服务过的需求的评价分数相加➗ 需求的总个数。 //如果服务方是区域化党建单位,需要实时去计算他的群众满意度=服务过的需求的评价分数相加➗ 需求的总个数。

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

@ -27,10 +27,15 @@ 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.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.ConvertUtils;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.ScanContentUtils;
import com.epmet.constant.ReadFlagConstant; import com.epmet.constant.ReadFlagConstant;
import com.epmet.constant.UserDemandConstant; import com.epmet.constant.UserDemandConstant;
import com.epmet.constant.UserMessageTypeConstant; 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.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -96,6 +102,10 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
private IcCommunitySelfOrganizationService communitySelfOrganizationService; private IcCommunitySelfOrganizationService communitySelfOrganizationService;
@Autowired @Autowired
private EpmetMessageOpenFeignClient messageOpenFeignClient; private EpmetMessageOpenFeignClient messageOpenFeignClient;
@Value("${openapi.scan.server.url}")
private String scanApiUrl;
@Value("${openapi.scan.method.textSyncScan}")
private String textSyncScanMethod;
@Override @Override
public IcUserDemandRecDTO get(String id) { public IcUserDemandRecDTO get(String id) {
@ -1028,19 +1038,27 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
if (!UserDemandConstant.FINISHED.equals(entity.getStatus())) { if (!UserDemandConstant.FINISHED.equals(entity.getStatus())) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "服务未完成,不可评价", "服务未完成,不可评价"); 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、插入评价得分记录 // 1、插入评价得分记录
IcUserDemandSatisfactionEntity satisfactionEntity = ConvertUtils.sourceToTarget(formDTO, IcUserDemandSatisfactionEntity.class); IcUserDemandSatisfactionEntity satisfactionEntity = ConvertUtils.sourceToTarget(formDTO, IcUserDemandSatisfactionEntity.class);
satisfactionEntity.setEvaluateTime(new Date()); satisfactionEntity.setEvaluateTime(new Date());
satisfactionEntity.setUserType(UserDemandConstant.RESI); satisfactionEntity.setUserType(userType);
satisfactionEntity.setRemark(formDTO.getFinishDesc());
demandSatisfactionDao.insert(satisfactionEntity); demandSatisfactionDao.insert(satisfactionEntity);
// 2、插入评价操作日志 // 2、插入评价操作日志
IcUserDemandOperateLogEntity evaluateEntity = ConvertUtils.sourceToTarget(formDTO, IcUserDemandOperateLogEntity.class); IcUserDemandOperateLogEntity evaluateEntity = ConvertUtils.sourceToTarget(formDTO, IcUserDemandOperateLogEntity.class);
evaluateEntity.setActionCode(UserDemandConstant.EVALUATE); evaluateEntity.setActionCode(UserDemandConstant.EVALUATE);
evaluateEntity.setOperateTime(satisfactionEntity.getEvaluateTime()); evaluateEntity.setOperateTime(satisfactionEntity.getEvaluateTime());
evaluateEntity.setUserType(UserDemandConstant.RESI); evaluateEntity.setUserType(userType);
operateLogDao.insert(evaluateEntity); operateLogDao.insert(evaluateEntity);
// 3、更新主表已评价标识,是否解决标识。 // 3、更新主表已评价标识,是否解决标识。
@ -1054,7 +1072,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
finishResultDTO.setServerId(serviceEntity.getServerId()); finishResultDTO.setServerId(serviceEntity.getServerId());
finishResultDTO.setServiceType(serviceEntity.getServiceType()); finishResultDTO.setServiceType(serviceEntity.getServiceType());
finishResultDTO.setAwardPoint(entity.getAwardPoint()); finishResultDTO.setAwardPoint(entity.getAwardPoint());
//5、我的需求-评价:如果服务方是志愿者,通知它: 您收到来自山东路-张先生的评价,请查看。 //5、我的需求-评价:如果服务方是志愿者,通知它: 您收到来自XXX(需求人姓名)的评价,请查看。
sendVolunnterEvaluated(entity); sendVolunnterEvaluated(entity);
return finishResultDTO; return finishResultDTO;
} }
@ -1255,7 +1273,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
@Override @Override
public DemandRecId saveOrUpdateDemand(ReportDemandFormDTO formDTO) { public DemandRecId saveOrUpdateDemand(ReportDemandFormDTO formDTO) {
//需求内容走内容审核 //需求内容走内容审核
textScan(formDTO.getContent());
Date now = new Date(); Date now = new Date();
DemandRecId resultDto = new DemandRecId(); DemandRecId resultDto = new DemandRecId();
resultDto.setDemandRecId(formDTO.getDemandRecId()); resultDto.setDemandRecId(formDTO.getDemandRecId());
@ -1318,6 +1336,25 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
return resultDto; 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());
}
}
}
/** /**
* 我的需求被抢单->您提出的需求将由青岛亿联科技有限公司为您解决请查看 * 我的需求被抢单->您提出的需求将由青岛亿联科技有限公司为您解决请查看

Loading…
Cancel
Save