Browse Source

评价+取消需求

dev_shibei_match
yinzuomei 4 years ago
parent
commit
d53b89219c
  1. 4
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  2. 13
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/CancelDemandFormDTO.java
  3. 44
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/EvaluateDemandFormDTO.java
  4. 6
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/FinishResultDTO.java
  5. 18
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java
  6. 83
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiDemandController.java
  7. 12
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcUserDemandRecService.java
  8. 119
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java

4
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -93,8 +93,8 @@ public enum EpmetErrorCode {
DEMAND_CAN_NOT_UPDATE(8223,"当前状态,不可更新需求"),
DEMAND_NOT_EXITS(8224,"需求不存在"),
DEMAND_SERVICE_NOT_EXITS(8225,"服务记录不存在"),
DEMAND_CAN_NOT_TAKE_ORDER(8226, "当前状态,不可指派"),
DEMAND_CAN_NOT_TAKE_ORDER(8226, "当前状态,不可接单"),
DEMAND_CAN_NOT_EVALUATE(8227, "当前状态,不可评价"),
REQUIRE_PERMISSION(8301, "您没有足够的操作权限"),
THIRD_PLAT_REQUEST_ERROR(8302, "请求第三方平台错误"),

13
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/StaffCancelFormDTO.java → epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/CancelDemandFormDTO.java

@ -4,8 +4,11 @@ import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* 取消需求入参dto
*/
@Data
public class StaffCancelFormDTO {
public class CancelDemandFormDTO {
public interface AddUserInternalGroup {}
@NotBlank(message = "需求id不能为空",groups = AddUserInternalGroup.class)
private String demandRecId;
@ -14,4 +17,12 @@ public class StaffCancelFormDTO {
private String userId;
@NotBlank(message = "customerId不能为空", groups = AddUserInternalGroup.class)
private String customerId;
/**
* staff:pc工作人员取消
* resi:居民端用户主动需求
* 代码里写死的UserDemandConstant.RESI/STAFF
*/
private String userType;
}

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

@ -0,0 +1,44 @@
package com.epmet.dto.form.demand;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 居民端-需求-服务评价入参
*/
@Data
public class EvaluateDemandFormDTO implements Serializable {
public interface AddUserInternalGroup {
}
public interface ShowGroup extends CustomerClientShowGroup {
}
@NotBlank(message = "需求id不能为空", groups = AddUserInternalGroup.class)
private String demandRecId;
@NotBlank(message = "服务id不能为空", groups = AddUserInternalGroup.class)
private String serviceId;
@NotBlank(message = "完成结果不能为空", groups = ShowGroup.class)
private String finishResult;
@Length(max = 1000,message = "最多输入1000字",groups = {ShowGroup.class})
private String finishDesc;
@NotNull(message = "得分不能为空", groups = ShowGroup.class)
private BigDecimal score;
@NotBlank(message = "userId不能为空", groups = AddUserInternalGroup.class)
private String userId;
@NotBlank(message = "customerId不能为空", groups = AddUserInternalGroup.class)
private String customerId;
}

6
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/FinishResultDTO.java

@ -10,6 +10,8 @@ import java.io.Serializable;
*/
@Data
public class FinishResultDTO implements Serializable {
private Boolean sendCalStatisfaction;
private String partyUnitId;
private String serverId;
private String serviceType;
private Boolean grantPoint;
private Integer awardPoint;
}

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

@ -19,6 +19,7 @@ package com.epmet.controller;
import com.epmet.commons.rocketmq.messages.CalPartyUnitSatisfactionFormDTO;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ExcelUtils;
@ -29,10 +30,6 @@ import com.epmet.constant.UserDemandConstant;
import com.epmet.dto.form.SystemMsgFormDTO;
import com.epmet.dto.form.demand.*;
import com.epmet.dto.result.demand.*;
import com.epmet.dto.result.demand.DemandRecResultDTO;
import com.epmet.dto.result.demand.FinishResultDTO;
import com.epmet.dto.result.demand.IcResiUserReportDemandRes;
import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.service.*;
import lombok.extern.slf4j.Slf4j;
@ -150,10 +147,11 @@ public class IcUserDemandRecController {
* @return
*/
@PostMapping("cancel")
public Result cancel(@LoginUser TokenDto tokenDto,@RequestBody StaffCancelFormDTO formDTO){
public Result cancel(@LoginUser TokenDto tokenDto,@RequestBody CancelDemandFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
ValidatorUtils.validateEntity(formDTO,StaffCancelFormDTO.AddUserInternalGroup.class);
formDTO.setUserType(UserDemandConstant.STAFF);
ValidatorUtils.validateEntity(formDTO,CancelDemandFormDTO.AddUserInternalGroup.class);
icUserDemandRecService.cancel(formDTO);
return new Result();
}
@ -191,14 +189,18 @@ public class IcUserDemandRecController {
formDTO.setUserType(UserDemandConstant.STAFF);
ValidatorUtils.validateEntity(formDTO,FinishStaffFromDTO.IcShowGroup.class,FinishStaffFromDTO.AddUserInternalGroup.class);
FinishResultDTO finishResultDTO=icUserDemandRecService.finish(formDTO);
if(finishResultDTO.getSendCalStatisfaction()){
//如果服务方是区域化党建单位,需要实时去计算他的群众满意度=服务过的需求的评价分数相加➗ 需求的总个数。
if(UserDemandConstant.PARTY_UNIT.equals(finishResultDTO.getServiceType())){
CalPartyUnitSatisfactionFormDTO mqMsg = new CalPartyUnitSatisfactionFormDTO();
mqMsg.setCustomerId(formDTO.getCustomerId());
mqMsg.setPartyUnitId(finishResultDTO.getPartyUnitId());
mqMsg.setPartyUnitId(finishResultDTO.getServerId());
SystemMsgFormDTO form = new SystemMsgFormDTO();
form.setMessageType(SystemMessageType.CAL_PARTY_UNIT_SATISFACTION);
form.setContent(mqMsg);
epmetMessageOpenFeignClient.sendSystemMsgByMQ(form);
} else if (UserDemandConstant.VOLUNTEER.equals(finishResultDTO.getServiceType()) && finishResultDTO.getAwardPoint() > NumConstant.ZERO) {
// todo
// 志愿者发放积分
}
return new Result();
}

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

@ -1,19 +1,22 @@
package com.epmet.controller;
import com.epmet.commons.rocketmq.messages.CalPartyUnitSatisfactionFormDTO;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.dto.form.PageFormDTO;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.constant.SystemMessageType;
import com.epmet.constant.UserDemandConstant;
import com.epmet.dto.form.demand.DemandDetailFormDTO;
import com.epmet.dto.form.demand.FinishStaffFromDTO;
import com.epmet.dto.form.demand.ListHallFormDTO;
import com.epmet.dto.form.demand.TakeOrderFormDTO;
import com.epmet.dto.form.SystemMsgFormDTO;
import com.epmet.dto.form.demand.*;
import com.epmet.dto.result.demand.DemandDetailResDTO;
import com.epmet.dto.result.demand.DemandHallResultDTO;
import com.epmet.dto.result.demand.FinishResultDTO;
import com.epmet.dto.result.demand.TakeOrderResultDTO;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.service.IcUserDemandRecService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -37,18 +40,21 @@ import java.util.List;
public class ResiDemandController {
@Autowired
private IcUserDemandRecService icUserDemandRecService;
@Autowired
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient;
/**
* 居民端-需求大厅未处理处理中已完成
*
* @param tokenDto
* @param formDTO
* @return
*/
@PostMapping("list-hall")
public Result<List<DemandHallResultDTO>> listHall(@LoginUser TokenDto tokenDto, @RequestBody ListHallFormDTO formDTO){
public Result<List<DemandHallResultDTO>> listHall(@LoginUser TokenDto tokenDto, @RequestBody ListHallFormDTO formDTO) {
formDTO.setCurrentUserId(tokenDto.getUserId());
formDTO.setCustomerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(formDTO, PageFormDTO.AddUserInternalGroup.class,ListHallFormDTO.AddUserInternalGroup.class);
ValidatorUtils.validateEntity(formDTO, PageFormDTO.AddUserInternalGroup.class, ListHallFormDTO.AddUserInternalGroup.class);
return new Result<List<DemandHallResultDTO>>().ok(icUserDemandRecService.listHall(formDTO));
}
@ -60,38 +66,91 @@ public class ResiDemandController {
* @return
*/
@PostMapping("detail-hall")
public Result<DemandDetailResDTO> queryDetailHall(@LoginUser TokenDto tokenDto, @RequestBody DemandDetailFormDTO formDTO){
public Result<DemandDetailResDTO> queryDetailHall(@LoginUser TokenDto tokenDto, @RequestBody DemandDetailFormDTO formDTO) {
formDTO.setCustomerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(formDTO,DemandDetailFormDTO.AddUserInternalGroup.class);
ValidatorUtils.validateEntity(formDTO, DemandDetailFormDTO.AddUserInternalGroup.class);
return new Result<DemandDetailResDTO>().ok(icUserDemandRecService.queryDetailHall(formDTO));
}
/**
* 需求大厅-我要接单
*
* @param tokenDto
* @return
*/
@PostMapping("takeorder")
public Result<TakeOrderResultDTO> takeOrder(@LoginUser TokenDto tokenDto, @RequestBody TakeOrderFormDTO formDTO){
public Result<TakeOrderResultDTO> takeOrder(@LoginUser TokenDto tokenDto, @RequestBody TakeOrderFormDTO formDTO) {
formDTO.setUserId(tokenDto.getUserId());
ValidatorUtils.validateEntity(formDTO,TakeOrderFormDTO.AddUserInternalGroup.class);
ValidatorUtils.validateEntity(formDTO, TakeOrderFormDTO.AddUserInternalGroup.class);
return new Result<TakeOrderResultDTO>().ok(icUserDemandRecService.takeOrder(formDTO));
}
/**
* 需求大厅-完成需求
*
* @param tokenDto
* @param formDTO
* @return
*/
@PostMapping("finish")
public Result finish(@LoginUser TokenDto tokenDto, @RequestBody FinishStaffFromDTO formDTO){
public Result finish(@LoginUser TokenDto tokenDto, @RequestBody FinishStaffFromDTO formDTO) {
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
formDTO.setType(UserDemandConstant.FINISHED);
formDTO.setUserType(UserDemandConstant.RESI);
ValidatorUtils.validateEntity(formDTO,FinishStaffFromDTO.ResiShowGroup.class,FinishStaffFromDTO.AddUserInternalGroup.class);
ValidatorUtils.validateEntity(formDTO, FinishStaffFromDTO.ResiShowGroup.class, FinishStaffFromDTO.AddUserInternalGroup.class);
icUserDemandRecService.finish(formDTO);
return new Result();
}
/**
* 我的需求-服务评价
* 已经完成的可以评价
*
* @param tokenDto
* @param formDTO
* @return
*/
@PostMapping("evaluate")
public Result evaluate(@LoginUser TokenDto tokenDto, @RequestBody EvaluateDemandFormDTO formDTO) {
formDTO.setUserId(tokenDto.getUserId());
formDTO.setCustomerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(formDTO, EvaluateDemandFormDTO.ShowGroup.class, EvaluateDemandFormDTO.AddUserInternalGroup.class);
FinishResultDTO finishResultDTO = icUserDemandRecService.evaluate(formDTO);
//如果服务方是区域化党建单位,需要实时去计算他的群众满意度=服务过的需求的评价分数相加➗ 需求的总个数。
if (UserDemandConstant.PARTY_UNIT.equals(finishResultDTO.getServiceType())) {
CalPartyUnitSatisfactionFormDTO mqMsg = new CalPartyUnitSatisfactionFormDTO();
mqMsg.setCustomerId(formDTO.getCustomerId());
mqMsg.setPartyUnitId(finishResultDTO.getServerId());
SystemMsgFormDTO form = new SystemMsgFormDTO();
form.setMessageType(SystemMessageType.CAL_PARTY_UNIT_SATISFACTION);
form.setContent(mqMsg);
epmetMessageOpenFeignClient.sendSystemMsgByMQ(form);
} else if (UserDemandConstant.VOLUNTEER.equals(finishResultDTO.getServiceType()) && finishResultDTO.getAwardPoint() > NumConstant.ZERO) {
// todo
// 志愿者发放积分
}
return new Result();
}
/**
* 我的需求-取消需求
* 取消未完成之前都可以取消,pc和居民端小程序内部通用
*
* @param tokenDto
* @param formDTO
* @return
*/
@PostMapping("cancel")
public Result cancel(@LoginUser TokenDto tokenDto,@RequestBody CancelDemandFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
formDTO.setUserType(UserDemandConstant.RESI);
ValidatorUtils.validateEntity(formDTO,CancelDemandFormDTO.AddUserInternalGroup.class);
icUserDemandRecService.cancel(formDTO);
return new Result();
}
}

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

@ -106,11 +106,11 @@ public interface IcUserDemandRecService extends BaseService<IcUserDemandRecEntit
PageData<DemandRecResultDTO> pageList(UserDemandPageFormDTO formDTO);
/**
* 未完成之前都可以取消
* 未完成之前都可以取消,pc和居民端小程序内部通用
*
* @param formDTO
*/
void cancel(StaffCancelFormDTO formDTO);
void cancel(CancelDemandFormDTO formDTO);
/**
* 指派
@ -196,4 +196,12 @@ public interface IcUserDemandRecService extends BaseService<IcUserDemandRecEntit
* @return
*/
TakeOrderResultDTO takeOrder(TakeOrderFormDTO formDTO);
/**
* 居民端-我的需求-服务评价
*
* @param formDTO
* @return
*/
FinishResultDTO evaluate(EvaluateDemandFormDTO formDTO);
}

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

@ -382,13 +382,13 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
}
/**
* 未完成之前都可以取消
* 未完成之前都可以取消,pc和居民端小程序内部通用
*
* @param formDTO
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void cancel(StaffCancelFormDTO formDTO) {
public void cancel(CancelDemandFormDTO formDTO) {
IcUserDemandRecEntity entity = baseDao.selectById(formDTO.getDemandRecId());
if (null == entity) {
throw new RenException(EpmetErrorCode.DEMAND_NOT_EXITS.getCode(), EpmetErrorCode.DEMAND_NOT_EXITS.getMsg());
@ -403,11 +403,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
entity.setCancelTime(new Date());
baseDao.updateById(entity);
//2、插入操作日志
IcUserDemandOperateLogEntity logEntity = new IcUserDemandOperateLogEntity();
logEntity.setCustomerId(formDTO.getCustomerId());
logEntity.setDemandRecId(formDTO.getDemandRecId());
logEntity.setUserType(UserDemandConstant.STAFF);
logEntity.setUserId(formDTO.getUserId());
IcUserDemandOperateLogEntity logEntity = ConvertUtils.sourceToTarget(formDTO,IcUserDemandOperateLogEntity.class);
logEntity.setActionCode(UserDemandConstant.CANCEL);
logEntity.setOperateTime(entity.getCancelTime());
operateLogDao.insert(logEntity);
@ -466,25 +462,10 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
@Transactional(rollbackFor = Exception.class)
@Override
public FinishResultDTO finish(FinishStaffFromDTO formDTO) {
IcUserDemandRecEntity entity = baseDao.selectById(formDTO.getDemandRecId());
if (null == entity) {
throw new RenException(EpmetErrorCode.DEMAND_NOT_EXITS.getCode(), EpmetErrorCode.DEMAND_NOT_EXITS.getMsg());
}
if (UserDemandConstant.PENDING.equals(entity.getStatus()) ||UserDemandConstant.CANCELED.equals(entity.getStatus())) {
//待处理或者已取消的不能评价
throw new RenException(EpmetErrorCode.DEMAND_CAN_NOT_FINISH.getCode(), EpmetErrorCode.DEMAND_CAN_NOT_FINISH.getMsg());
}
if(UserDemandConstant.FINISHED.equals(entity.getStatus()) ){
//已经完成
throw new RenException(EpmetErrorCode.DEMAND_FINISHED.getCode(), EpmetErrorCode.DEMAND_FINISHED.getMsg());
}
IcUserDemandRecEntity entity = checkFinishPreCondition(formDTO.getDemandRecId());
//1、插入完成操作日志
IcUserDemandOperateLogEntity logEntity = new IcUserDemandOperateLogEntity();
logEntity.setCustomerId(formDTO.getCustomerId());
logEntity.setDemandRecId(formDTO.getDemandRecId());
logEntity.setUserType(formDTO.getUserType());
logEntity.setUserId(formDTO.getUserId());
IcUserDemandOperateLogEntity logEntity = ConvertUtils.sourceToTarget(formDTO,IcUserDemandOperateLogEntity.class);
logEntity.setActionCode(UserDemandConstant.FINISH);
logEntity.setOperateTime(new Date());
operateLogDao.insert(logEntity);
@ -500,20 +481,11 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
serviceEntity.setFinishDesc(StringUtils.isNotBlank(formDTO.getFinishDesc())?formDTO.getFinishDesc():StrConstant.EPMETY_STR);
demandServiceDao.updateById(serviceEntity);
FinishResultDTO finishResultDTO=new FinishResultDTO();
finishResultDTO.setPartyUnitId(serviceEntity.getServerId());
finishResultDTO.setSendCalStatisfaction(false);
// 3、pc完成情况:完成+评价
if(UserDemandConstant.FINISH_AND_EVALUATE.equals(formDTO.getType())){
//3.1、插入评价得分记录
IcUserDemandSatisfactionEntity satisfactionEntity=new IcUserDemandSatisfactionEntity();
satisfactionEntity.setCustomerId(formDTO.getCustomerId());
satisfactionEntity.setDemandRecId(formDTO.getDemandRecId());
satisfactionEntity.setUserType(formDTO.getUserType());
satisfactionEntity.setUserId(formDTO.getUserId());
IcUserDemandSatisfactionEntity satisfactionEntity=ConvertUtils.sourceToTarget(formDTO,IcUserDemandSatisfactionEntity.class);
satisfactionEntity.setEvaluateTime(logEntity.getOperateTime());
satisfactionEntity.setScore(formDTO.getScore());
demandSatisfactionDao.insert(satisfactionEntity);
// 3.2插入评价操作日志
@ -521,11 +493,6 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
evaluateEntity.setActionCode(UserDemandConstant.EVALUATE);
operateLogDao.insert(evaluateEntity);
//3.3、如果服务方区域化党建单位,需求重新计算当前这个单位的满意度。
//如果服务方是区域化党建单位,需要实时去计算他的群众满意度=服务过的需求的评价分数相加➗ 需求的总个数。
if(UserDemandConstant.PARTY_UNIT.equals(serviceEntity.getServiceType())){
finishResultDTO.setSendCalStatisfaction(true);
}
//3.4更新主表已评价标识,是否解决标识。
entity.setEvaluateFlag(true);
entity.setFinishResult(formDTO.getFinishResult());
@ -535,9 +502,35 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
entity.setStatus(UserDemandConstant.FINISHED);
baseDao.updateById(entity);
FinishResultDTO finishResultDTO=new FinishResultDTO();
finishResultDTO.setServerId(serviceEntity.getServerId());
finishResultDTO.setServiceType(serviceEntity.getServiceType());
finishResultDTO.setAwardPoint(entity.getAwardPoint());
return finishResultDTO;
}
/**
* 校验需求是否可以点击完成
*
* @param demandRecId
* @return
*/
private IcUserDemandRecEntity checkFinishPreCondition(String demandRecId) {
IcUserDemandRecEntity entity=baseDao.selectById(demandRecId);
if (null == entity) {
throw new RenException(EpmetErrorCode.DEMAND_NOT_EXITS.getCode(), EpmetErrorCode.DEMAND_NOT_EXITS.getMsg());
}
if (UserDemandConstant.PENDING.equals(entity.getStatus()) ||UserDemandConstant.CANCELED.equals(entity.getStatus())) {
//待处理或者已取消的不能评价
throw new RenException(EpmetErrorCode.DEMAND_CAN_NOT_FINISH.getCode(), EpmetErrorCode.DEMAND_CAN_NOT_FINISH.getMsg());
}
if(UserDemandConstant.FINISHED.equals(entity.getStatus()) ){
//已经完成
throw new RenException(EpmetErrorCode.DEMAND_FINISHED.getCode(), EpmetErrorCode.DEMAND_FINISHED.getMsg());
}
return entity;
}
/**
* 数据分析-个人档案居民需求列表table
*
@ -1022,10 +1015,12 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
/**
* 需求大厅-我要接单
* 未处理列表中不包含自己提出的需求不会存在自己提的需求自己接单
*
* @param formDTO
* @return
*/
@Transactional(rollbackFor = Exception.class)
@Override
public TakeOrderResultDTO takeOrder(TakeOrderFormDTO formDTO) {
IcUserDemandRecEntity entity = baseDao.selectById(formDTO.getDemandRecId());
@ -1079,5 +1074,51 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
return takeOrderResultDTO;
}
/**
* 居民端-我的需求-服务评价
*
* @param formDTO
* @return
*/
@Transactional(rollbackFor = Exception.class)
@Override
public FinishResultDTO evaluate(EvaluateDemandFormDTO formDTO) {
IcUserDemandRecEntity entity = baseDao.selectById(formDTO.getDemandRecId());
if (null == entity) {
throw new RenException(EpmetErrorCode.DEMAND_NOT_EXITS.getCode(), EpmetErrorCode.DEMAND_NOT_EXITS.getMsg());
}
if (!UserDemandConstant.FINISHED.equals(entity.getStatus())) {
// 已完成的可以评价
throw new RenException(EpmetErrorCode.DEMAND_CAN_NOT_EVALUATE.getCode(), EpmetErrorCode.DEMAND_CAN_NOT_EVALUATE.getMsg());
}
// todo 只有需求人才可以评价
// 1、插入评价得分记录
IcUserDemandSatisfactionEntity satisfactionEntity = ConvertUtils.sourceToTarget(formDTO, IcUserDemandSatisfactionEntity.class);
satisfactionEntity.setEvaluateTime(new Date());
satisfactionEntity.setUserType(UserDemandConstant.RESI);
demandSatisfactionDao.insert(satisfactionEntity);
// 2、插入评价操作日志
IcUserDemandOperateLogEntity evaluateEntity = ConvertUtils.sourceToTarget(formDTO, IcUserDemandOperateLogEntity.class);
evaluateEntity.setActionCode(UserDemandConstant.EVALUATE);
evaluateEntity.setOperateTime(satisfactionEntity.getEvaluateTime());
evaluateEntity.setUserType(UserDemandConstant.RESI);
operateLogDao.insert(evaluateEntity);
// 3、更新主表已评价标识,是否解决标识。
entity.setEvaluateFlag(true);
entity.setFinishResult(formDTO.getFinishResult());
baseDao.updateById(entity);
//4、返回服务方,志愿者发放积分,区域化党建单位,计算群众满意度
IcUserDemandServiceEntity serviceEntity = demandServiceDao.selectById(formDTO.getServiceId());
FinishResultDTO finishResultDTO = new FinishResultDTO();
finishResultDTO.setServerId(serviceEntity.getServerId());
finishResultDTO.setServiceType(serviceEntity.getServiceType());
finishResultDTO.setAwardPoint(entity.getAwardPoint());
return finishResultDTO;
}
}
Loading…
Cancel
Save