Browse Source

事件评价同步项目、需求评价结果

dev
sunyuchao 3 years ago
parent
commit
cb6fbb6f99
  1. 20
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/IcEventCommentToDemandFromDTO.java
  2. 8
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java
  3. 6
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java
  4. 10
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java
  5. 6
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcUserDemandRecService.java
  6. 41
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java
  7. 6
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectSatisfactionDetailService.java
  8. 21
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/IcEventServiceImpl.java
  9. 25
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSatisfactionDetailServiceImpl.java

20
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/IcEventCommentToDemandFromDTO.java

@ -0,0 +1,20 @@
package com.epmet.dto.form.demand;
import lombok.Data;
import java.io.Serializable;
@Data
public class IcEventCommentToDemandFromDTO implements Serializable {
private static final long serialVersionUID = 591380873862126679L;
//客户Id
private String customerId;
//需求Id
private String demandRecId;
//评价满意度【 不满意:bad、基本满意:good、非常满意:perfect 】
private String satisfaction;
//当前操作工作人员Id
private String staffId;
}

8
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java

@ -10,6 +10,7 @@ import com.epmet.dto.form.CommonCustomerFormDTO;
import com.epmet.dto.form.IcDemandFormDTO; import com.epmet.dto.form.IcDemandFormDTO;
import com.epmet.dto.form.PartyUnitListFormDTO; import com.epmet.dto.form.PartyUnitListFormDTO;
import com.epmet.dto.form.demand.DemandRecId; import com.epmet.dto.form.demand.DemandRecId;
import com.epmet.dto.form.demand.IcEventCommentToDemandFromDTO;
import com.epmet.dto.form.demand.UserDemandNameQueryFormDTO; import com.epmet.dto.form.demand.UserDemandNameQueryFormDTO;
import com.epmet.dto.form.resi.VolunteerCommonFormDTO; import com.epmet.dto.form.resi.VolunteerCommonFormDTO;
import com.epmet.dto.result.PartyUnitListResultDTO; import com.epmet.dto.result.PartyUnitListResultDTO;
@ -126,4 +127,11 @@ public interface EpmetHeartOpenFeignClient {
**/ **/
@PostMapping("/heart/residemand/iceventtodemand") @PostMapping("/heart/residemand/iceventtodemand")
Result<DemandRecId> icEventToDemand(@RequestBody IcDemandFormDTO formDTO); Result<DemandRecId> icEventToDemand(@RequestBody IcDemandFormDTO formDTO);
/**
* @description 事件评价时同步=评价结果到需求
**/
@PostMapping("/heart/userdemand/iceventcomment")
Result icEventComment(@RequestBody IcEventCommentToDemandFromDTO formDTO);
} }

6
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java

@ -11,6 +11,7 @@ import com.epmet.dto.form.CommonCustomerFormDTO;
import com.epmet.dto.form.IcDemandFormDTO; import com.epmet.dto.form.IcDemandFormDTO;
import com.epmet.dto.form.PartyUnitListFormDTO; import com.epmet.dto.form.PartyUnitListFormDTO;
import com.epmet.dto.form.demand.DemandRecId; import com.epmet.dto.form.demand.DemandRecId;
import com.epmet.dto.form.demand.IcEventCommentToDemandFromDTO;
import com.epmet.dto.form.demand.UserDemandNameQueryFormDTO; import com.epmet.dto.form.demand.UserDemandNameQueryFormDTO;
import com.epmet.dto.form.resi.VolunteerCommonFormDTO; import com.epmet.dto.form.resi.VolunteerCommonFormDTO;
import com.epmet.dto.result.PartyUnitListResultDTO; import com.epmet.dto.result.PartyUnitListResultDTO;
@ -122,4 +123,9 @@ public class EpmetHeartOpenFeignClientFallback implements EpmetHeartOpenFeignCli
public Result<DemandRecId> icEventToDemand(IcDemandFormDTO formDTO) { public Result<DemandRecId> icEventToDemand(IcDemandFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "icEventToDemand", formDTO); return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "icEventToDemand", formDTO);
} }
@Override
public Result icEventComment(IcEventCommentToDemandFromDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "icEventComment", formDTO);
}
} }

10
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java

@ -380,5 +380,15 @@ public class IcUserDemandRecController implements ResultDataResolver {
return new Result<PointRecordResultDTO>().ok(result); return new Result<PointRecordResultDTO>().ok(result);
} }
/**
* @Author sun
* @Description 事件评价时同步=评价结果到需求
**/
@PostMapping("iceventcomment")
public Result icEventComment(@RequestBody IcEventCommentToDemandFromDTO formDTO) {
icUserDemandRecService.icEventComment(formDTO);
return new Result();
}
} }

6
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcUserDemandRecService.java

@ -254,4 +254,10 @@ public interface IcUserDemandRecService extends BaseService<IcUserDemandRecEntit
* @return * @return
*/ */
PageData<DemandRecResultDTO> queryServiceList(ServiceListFormDTO formDTO); PageData<DemandRecResultDTO> queryServiceList(ServiceListFormDTO formDTO);
/**
* @Author sun
* @Description 事件评价时同步=评价结果到需求
**/
void icEventComment(IcEventCommentToDemandFromDTO formDTO);
} }

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

@ -65,6 +65,7 @@ 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;
import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -1769,6 +1770,46 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
return new PageData<>(pageInfo.getList(), pageInfo.getTotal()); 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);
}
} }

6
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectSatisfactionDetailService.java

@ -136,4 +136,10 @@ public interface ProjectSatisfactionDetailService extends BaseService<ProjectSat
* @date 2021/5/12 10:04 上午 * @date 2021/5/12 10:04 上午
*/ */
void complementedProjectEvaluate(); void complementedProjectEvaluate();
/**
* @Description 事件评价相应的同步项目评价
* @author sun
*/
void comment(String customerId, String projectId, String satisfaction);
} }

21
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/IcEventServiceImpl.java

@ -26,6 +26,7 @@ import com.epmet.dao.IcEventDao;
import com.epmet.dto.*; import com.epmet.dto.*;
import com.epmet.dto.form.*; import com.epmet.dto.form.*;
import com.epmet.dto.form.demand.DemandRecId; import com.epmet.dto.form.demand.DemandRecId;
import com.epmet.dto.form.demand.IcEventCommentToDemandFromDTO;
import com.epmet.dto.result.*; import com.epmet.dto.result.*;
import com.epmet.entity.*; import com.epmet.entity.*;
import com.epmet.enums.EcEventProcessStatusEnum; import com.epmet.enums.EcEventProcessStatusEnum;
@ -92,6 +93,8 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
private ResiEventServiceImpl resiEventService; private ResiEventServiceImpl resiEventService;
@Autowired @Autowired
private EpmetMessageOpenFeignClient messageOpenFeignClient; private EpmetMessageOpenFeignClient messageOpenFeignClient;
@Autowired
private ProjectSatisfactionDetailService projectSatisfactionDetailService;
@Override @Override
@ -976,6 +979,24 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
entity.setSatisfaction(formDTO.getSatisfaction()); entity.setSatisfaction(formDTO.getSatisfaction());
entity.setCommentTime(new Date()); entity.setCommentTime(new Date());
baseDao.updateById(entity); baseDao.updateById(entity);
//4.判断已转项目或已转需求的对应的增加评价记录
if (NumConstant.ONE_STR.equals(entity.getOperationType())) {
//立项
projectSatisfactionDetailService.comment(entity.getCustomerId(), entity.getOperationId(), formDTO.getSatisfaction());
} else if (NumConstant.TWO_STR.equals(entity.getOperationType())) {
//转需求
IcEventCommentToDemandFromDTO dto = new IcEventCommentToDemandFromDTO();
dto.setCustomerId(formDTO.getCustomerId());
dto.setDemandRecId(entity.getOperationId());
dto.setSatisfaction(formDTO.getSatisfaction());
dto.setStaffId(formDTO.getUserId());
Result result = epmetHeartOpenFeignClient.icEventComment(dto);
if (!result.success()) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "评价事件同步服务评价结果失败");
}
}
} }
/** /**

25
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSatisfactionDetailServiceImpl.java

@ -356,4 +356,29 @@ public class ProjectSatisfactionDetailServiceImpl extends BaseServiceImpl<Projec
} }
} }
/**
* @Description 事件评价相应的同步项目评价
* @author sun
*/
@Override
public void comment(String customerId, String projectId, String satisfaction) {
//评价表新增数据
ProjectSatisfactionDetailEntity entity = new ProjectSatisfactionDetailEntity();
entity.setProjectId(projectId);
entity.setComment(("perfect".equals(satisfaction) ? "非常满意" : ("good".equals(satisfaction) ? "基本满意" : ("bad".equals(satisfaction) ? "不满意" : ""))));
entity.setSatisfaction(satisfaction);
entity.setCustomerId(customerId);
baseDao.insert(entity);
//评价统计表新增数据
ProjectSatisfactionStatisticsEntity satisfactionStatisticsEntity = new ProjectSatisfactionStatisticsEntity();
satisfactionStatisticsEntity.setCustomerId(customerId);
satisfactionStatisticsEntity.setProjectId(projectId);
satisfactionStatisticsEntity.setGoodCount("good".equals(satisfaction) ? NumConstant.ONE : NumConstant.ZERO);
satisfactionStatisticsEntity.setPerfectCount("perfect".equals(satisfaction) ? NumConstant.ONE : NumConstant.ZERO);
satisfactionStatisticsEntity.setBadCount("bad".equals(satisfaction) ? NumConstant.ONE : NumConstant.ZERO);
satisfactionStatisticsEntity.setShouldEvaluateCount(NumConstant.ONE);
statisticsDao.insert(satisfactionStatisticsEntity);
}
} }
Loading…
Cancel
Save