|
|
@ -65,6 +65,7 @@ import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.util.*; |
|
|
|
import java.util.function.Function; |
|
|
|
import java.util.stream.Collectors; |
|
|
@ -1769,6 +1770,46 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
|
return new PageData<>(pageInfo.getList(), pageInfo.getTotal()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Author sun |
|
|
|
* @Description 事件评价时同步=评价结果到需求 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public void icEventComment(IcEventCommentToDemandFromDTO formDTO) { |
|
|
|
//1.校验需求是否存在且是否已评价
|
|
|
|
IcUserDemandRecEntity entity = baseDao.selectById(formDTO.getDemandRecId()); |
|
|
|
if (null == entity || NumConstant.ONE_STR.equals(entity.getEvaluateFlag())) { |
|
|
|
log.warn(String.format("需求不存在或已完成评价,需求Id->%s", formDTO.getDemandRecId())); |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "需求不存在或评价"); |
|
|
|
} |
|
|
|
|
|
|
|
//2.新增评价记录
|
|
|
|
IcUserDemandSatisfactionEntity satisfactionEntity = new IcUserDemandSatisfactionEntity(); |
|
|
|
satisfactionEntity.setCustomerId(formDTO.getCustomerId()); |
|
|
|
satisfactionEntity.setDemandRecId(formDTO.getDemandRecId()); |
|
|
|
satisfactionEntity.setUserType("staff"); |
|
|
|
satisfactionEntity.setUserId(formDTO.getStaffId()); |
|
|
|
satisfactionEntity.setEvaluateTime(new Date()); |
|
|
|
satisfactionEntity.setScore(("perfect".equals(formDTO.getSatisfaction()) ? new BigDecimal(5) : ("good".equals(formDTO.getSatisfaction()) ? new BigDecimal(3) : ("bad".equals(formDTO.getSatisfaction()) ? BigDecimal.ONE : BigDecimal.ZERO)))); |
|
|
|
demandSatisfactionDao.insert(satisfactionEntity); |
|
|
|
|
|
|
|
//3.新增操作日志记录
|
|
|
|
IcUserDemandOperateLogEntity logEntity = new IcUserDemandOperateLogEntity(); |
|
|
|
logEntity.setCustomerId(formDTO.getCustomerId()); |
|
|
|
logEntity.setDemandRecId(formDTO.getDemandRecId()); |
|
|
|
logEntity.setUserType("staff"); |
|
|
|
logEntity.setUserId(formDTO.getStaffId()); |
|
|
|
logEntity.setActionCode(""); |
|
|
|
logEntity.setOperateTime(new Date()); |
|
|
|
operateLogDao.insert(logEntity); |
|
|
|
|
|
|
|
//4.更新需求主表数据状态
|
|
|
|
entity.setStatus("finished"); |
|
|
|
entity.setFinishResult("resolved"); |
|
|
|
entity.setEvaluateFlag(true); |
|
|
|
baseDao.updateById(entity); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|