|
|
@ -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; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |