|
|
@ -38,9 +38,7 @@ import com.epmet.dao.IcUserDemandOperateLogDao; |
|
|
|
import com.epmet.dao.IcUserDemandRecDao; |
|
|
|
import com.epmet.dao.IcUserDemandSatisfactionDao; |
|
|
|
import com.epmet.dao.IcUserDemandServiceDao; |
|
|
|
import com.epmet.dto.CustomerAgencyDTO; |
|
|
|
import com.epmet.dto.CustomerGridDTO; |
|
|
|
import com.epmet.dto.IcUserDemandRecDTO; |
|
|
|
import com.epmet.dto.*; |
|
|
|
import com.epmet.dto.form.CustomerGridFormDTO; |
|
|
|
import com.epmet.dto.form.FindIcUserFormDTO; |
|
|
|
import com.epmet.dto.form.ResiUserFormDTO; |
|
|
@ -53,6 +51,7 @@ import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
|
import com.epmet.feign.GovOrgOpenFeignClient; |
|
|
|
import com.epmet.service.IcResiDemandDictService; |
|
|
|
import com.epmet.service.IcUserDemandRecService; |
|
|
|
import com.epmet.service.VolunteerInfoService; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
@ -90,7 +89,8 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
|
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|
|
|
@Autowired |
|
|
|
private EpmetAdminOpenFeignClient adminOpenFeignClient; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private VolunteerInfoService volunteerInfoService; |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<IcUserDemandRecDTO> page(Map<String, Object> params) { |
|
|
@ -154,6 +154,32 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
|
updateEntity.setStatus(UserDemandConstant.PENDING); |
|
|
|
updateEntity.setEvaluateFlag(false); |
|
|
|
updateEntity.setId(dto.getDemandRecId()); |
|
|
|
//记录发放积分
|
|
|
|
IcResiDemandDictEntity icResiDemandDictEntity=demandDictService.getByCode(dto.getCustomerId(),dto.getCategoryCode()); |
|
|
|
if(null!=icResiDemandDictEntity){ |
|
|
|
updateEntity.setAwardPoint(icResiDemandDictEntity.getAwardPoint()); |
|
|
|
} |
|
|
|
//查找需求人居住的房子
|
|
|
|
Result<IcResiUserDTO> demandUserRes=epmetUserOpenFeignClient.getIcResiUserDTO(dto.getDemandUserId()); |
|
|
|
if(!demandUserRes.success()||null==demandUserRes.getData()){ |
|
|
|
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "查询需求人信息异常"); |
|
|
|
} |
|
|
|
updateEntity.setDemandUserHouseId(demandUserRes.getData().getHomeId()); |
|
|
|
// 查询需求人的居住地址
|
|
|
|
Set<String> houseIds=new HashSet<>(); |
|
|
|
houseIds.add(updateEntity.getDemandUserHouseId()); |
|
|
|
Result<List<HouseInfoDTO>> houseInfoRes=govOrgOpenFeignClient.queryListHouseInfo(houseIds); |
|
|
|
if(!houseInfoRes.success()||CollectionUtils.isEmpty(houseInfoRes.getData())){ |
|
|
|
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "查询需求人房屋地址信息异常"+JSON.toJSONString(houseInfoRes)); |
|
|
|
} |
|
|
|
HouseInfoDTO houseInfoDTO=houseInfoRes.getData().get(NumConstant.ZERO); |
|
|
|
updateEntity.setServiceLocation(houseInfoDTO.getNeighborAddress(). |
|
|
|
concat(houseInfoDTO.getNeighborHoodName()) |
|
|
|
.concat(houseInfoDTO.getBuildingName()) |
|
|
|
.concat(houseInfoDTO.getUnitName()) |
|
|
|
.concat(houseInfoDTO.getDoorName())); |
|
|
|
updateEntity.setLongitude(houseInfoDTO.getBuildingLongitude()); |
|
|
|
updateEntity.setLatitude(houseInfoDTO.getBuildingLatitude()); |
|
|
|
baseDao.updateById(updateEntity); |
|
|
|
|
|
|
|
IcUserDemandOperateLogEntity logEntity=new IcUserDemandOperateLogEntity(); |
|
|
@ -197,6 +223,32 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
|
insertEntity.setDemandUserType(UserDemandConstant.IC_RESI_USER); |
|
|
|
insertEntity.setStatus(UserDemandConstant.PENDING); |
|
|
|
insertEntity.setEvaluateFlag(false); |
|
|
|
//记录发放积分
|
|
|
|
IcResiDemandDictEntity icResiDemandDictEntity=demandDictService.getByCode(fromDTO.getCustomerId(),fromDTO.getCategoryCode()); |
|
|
|
if(null!=icResiDemandDictEntity){ |
|
|
|
insertEntity.setAwardPoint(icResiDemandDictEntity.getAwardPoint()); |
|
|
|
} |
|
|
|
//查找需求人居住的房子
|
|
|
|
Result<IcResiUserDTO> demandUserRes=epmetUserOpenFeignClient.getIcResiUserDTO(fromDTO.getDemandUserId()); |
|
|
|
if(!demandUserRes.success()||null==demandUserRes.getData()){ |
|
|
|
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "查询需求人信息异常"+ JSON.toJSONString(demandUserRes)); |
|
|
|
} |
|
|
|
insertEntity.setDemandUserHouseId(demandUserRes.getData().getHomeId()); |
|
|
|
// 查询需求人的居住地址
|
|
|
|
Set<String> houseIds=new HashSet<>(); |
|
|
|
houseIds.add(insertEntity.getDemandUserHouseId()); |
|
|
|
Result<List<HouseInfoDTO>> houseInfoRes=govOrgOpenFeignClient.queryListHouseInfo(houseIds); |
|
|
|
if(!houseInfoRes.success()||CollectionUtils.isEmpty(houseInfoRes.getData())){ |
|
|
|
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "查询需求人房屋地址信息异常"+JSON.toJSONString(houseInfoRes)); |
|
|
|
} |
|
|
|
HouseInfoDTO houseInfoDTO=houseInfoRes.getData().get(NumConstant.ZERO); |
|
|
|
insertEntity.setServiceLocation(houseInfoDTO.getNeighborAddress(). |
|
|
|
concat(houseInfoDTO.getNeighborHoodName()) |
|
|
|
.concat(houseInfoDTO.getBuildingName()) |
|
|
|
.concat(houseInfoDTO.getUnitName()) |
|
|
|
.concat(houseInfoDTO.getDoorName())); |
|
|
|
insertEntity.setLongitude(houseInfoDTO.getBuildingLongitude()); |
|
|
|
insertEntity.setLatitude(houseInfoDTO.getBuildingLatitude()); |
|
|
|
baseDao.insert(insertEntity); |
|
|
|
IcUserDemandOperateLogEntity logEntity=new IcUserDemandOperateLogEntity(); |
|
|
|
logEntity.setCustomerId(fromDTO.getCustomerId()); |
|
|
@ -330,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()); |
|
|
@ -351,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); |
|
|
@ -414,64 +462,75 @@ 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()); |
|
|
|
} |
|
|
|
//1、修改主表
|
|
|
|
entity.setStatus(UserDemandConstant.FINISHED); |
|
|
|
entity.setFinishResult(formDTO.getFinishResult()); |
|
|
|
entity.setEvaluateFlag(true); |
|
|
|
baseDao.updateById(entity); |
|
|
|
IcUserDemandRecEntity entity = checkFinishPreCondition(formDTO.getDemandRecId()); |
|
|
|
|
|
|
|
//2、插入操作日志
|
|
|
|
IcUserDemandOperateLogEntity logEntity = new IcUserDemandOperateLogEntity(); |
|
|
|
logEntity.setCustomerId(formDTO.getCustomerId()); |
|
|
|
logEntity.setDemandRecId(formDTO.getDemandRecId()); |
|
|
|
logEntity.setUserType(UserDemandConstant.STAFF); |
|
|
|
logEntity.setUserId(formDTO.getUserId()); |
|
|
|
//1、插入完成操作日志
|
|
|
|
IcUserDemandOperateLogEntity logEntity = ConvertUtils.sourceToTarget(formDTO,IcUserDemandOperateLogEntity.class); |
|
|
|
logEntity.setActionCode(UserDemandConstant.FINISH); |
|
|
|
logEntity.setOperateTime(new Date()); |
|
|
|
operateLogDao.insert(logEntity); |
|
|
|
|
|
|
|
//3、更新服务记录
|
|
|
|
|
|
|
|
//2、更新服务记录,记录实际开始,实际结束时间
|
|
|
|
IcUserDemandServiceEntity serviceEntity=demandServiceDao.selectById(formDTO.getServiceId()); |
|
|
|
if(null==serviceEntity){ |
|
|
|
throw new RenException(EpmetErrorCode.DEMAND_SERVICE_NOT_EXITS.getCode(), EpmetErrorCode.DEMAND_SERVICE_NOT_EXITS.getMsg()); |
|
|
|
} |
|
|
|
serviceEntity.setServiceStartTime(formDTO.getServiceStartTime()); |
|
|
|
serviceEntity.setServiceEndTime(formDTO.getServiceEndTime()); |
|
|
|
serviceEntity.setFinishDesc(formDTO.getFinishDesc()); |
|
|
|
serviceEntity.setFinishDesc(StringUtils.isNotBlank(formDTO.getFinishDesc())?formDTO.getFinishDesc():StrConstant.EPMETY_STR); |
|
|
|
demandServiceDao.updateById(serviceEntity); |
|
|
|
|
|
|
|
//4、插入评价
|
|
|
|
IcUserDemandSatisfactionEntity satisfactionEntity=new IcUserDemandSatisfactionEntity(); |
|
|
|
satisfactionEntity.setCustomerId(formDTO.getCustomerId()); |
|
|
|
satisfactionEntity.setDemandRecId(formDTO.getDemandRecId()); |
|
|
|
satisfactionEntity.setUserType(UserDemandConstant.STAFF); |
|
|
|
satisfactionEntity.setUserId(formDTO.getUserId()); |
|
|
|
satisfactionEntity.setEvaluateTime(logEntity.getOperateTime()); |
|
|
|
satisfactionEntity.setScore(formDTO.getScore()); |
|
|
|
demandSatisfactionDao.insert(satisfactionEntity); |
|
|
|
FinishResultDTO finishResultDTO=new FinishResultDTO(); |
|
|
|
finishResultDTO.setPartyUnitId(serviceEntity.getServerId()); |
|
|
|
finishResultDTO.setSendCalStatisfaction(false); |
|
|
|
//5、如果服务方区域化党建单位,需求重新计算当前这个单位的满意度。
|
|
|
|
//如果服务方是区域化党建单位,需要实时去计算他的群众满意度=服务过的需求的评价分数相加➗ 需求的总个数。
|
|
|
|
if(UserDemandConstant.PARTY_UNIT.equals(serviceEntity.getServiceType())){ |
|
|
|
finishResultDTO.setSendCalStatisfaction(true); |
|
|
|
// 3、pc完成情况:完成+评价
|
|
|
|
if(UserDemandConstant.FINISH_AND_EVALUATE.equals(formDTO.getType())){ |
|
|
|
//3.1、插入评价得分记录
|
|
|
|
IcUserDemandSatisfactionEntity satisfactionEntity=ConvertUtils.sourceToTarget(formDTO,IcUserDemandSatisfactionEntity.class); |
|
|
|
satisfactionEntity.setEvaluateTime(logEntity.getOperateTime()); |
|
|
|
demandSatisfactionDao.insert(satisfactionEntity); |
|
|
|
|
|
|
|
// 3.2插入评价操作日志
|
|
|
|
IcUserDemandOperateLogEntity evaluateEntity=ConvertUtils.sourceToTarget(logEntity,IcUserDemandOperateLogEntity.class); |
|
|
|
evaluateEntity.setActionCode(UserDemandConstant.EVALUATE); |
|
|
|
operateLogDao.insert(evaluateEntity); |
|
|
|
|
|
|
|
//3.4更新主表已评价标识,是否解决标识。
|
|
|
|
entity.setEvaluateFlag(true); |
|
|
|
entity.setFinishResult(formDTO.getFinishResult()); |
|
|
|
} |
|
|
|
|
|
|
|
//4、修改主表状态为已完成
|
|
|
|
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 |
|
|
|
* |
|
|
@ -912,4 +971,154 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 居民端-需求大厅(未处理、处理中、已完成) |
|
|
|
* 未处理:未指派、未接单;处理中:已指派、已接单给我的 ;已完成:我填写实际服务时间,并点击确认 |
|
|
|
* @param formDTO |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<DemandHallResultDTO> listHall(ListHallFormDTO formDTO) { |
|
|
|
PageInfo<DemandHallResultDTO> result = PageHelper.startPage(formDTO.getPageNo(), |
|
|
|
formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.selectListDemandHall(formDTO.getGridId(), |
|
|
|
formDTO.getType(),formDTO.getCurrentUserId())); |
|
|
|
result.getList().forEach(resultDTO->{ |
|
|
|
//设置分类名称
|
|
|
|
IcResiDemandDictEntity demandDictEntity=demandDictService.getByCode(formDTO.getCustomerId(),resultDTO.getCategoryCode()); |
|
|
|
if(null!=demandDictEntity){ |
|
|
|
resultDTO.setCategoryName(demandDictEntity.getCategoryName()); |
|
|
|
} |
|
|
|
}); |
|
|
|
return result.getList(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 需求大厅-需求详情 |
|
|
|
* |
|
|
|
* @param formDTO |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public DemandDetailResDTO queryDetailHall(DemandDetailFormDTO formDTO) { |
|
|
|
DemandRecResultDTO demandRecResultDTO = baseDao.selectDemandRecDetail(formDTO.getCustomerId(), formDTO.getDemandRecId()); |
|
|
|
if (null != demandRecResultDTO) { |
|
|
|
DemandDetailResDTO result = ConvertUtils.sourceToTarget(demandRecResultDTO, DemandDetailResDTO.class); |
|
|
|
//设置分类名称
|
|
|
|
IcResiDemandDictEntity demandDictEntity = demandDictService.getByCode(formDTO.getCustomerId(), result.getCategoryCode()); |
|
|
|
if (null != demandDictEntity) { |
|
|
|
result.setCategoryName(demandDictEntity.getCategoryName()); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 需求大厅-我要接单 |
|
|
|
* 未处理列表中,不包含自己提出的需求,不会存在自己提的需求,自己接单 |
|
|
|
* |
|
|
|
* @param formDTO |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Override |
|
|
|
public TakeOrderResultDTO takeOrder(TakeOrderFormDTO 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())) { |
|
|
|
//待处理的才可以抢单
|
|
|
|
throw new RenException(EpmetErrorCode.DEMAND_CAN_NOT_TAKE_ORDER.getCode(), EpmetErrorCode.DEMAND_CAN_NOT_TAKE_ORDER.getMsg()); |
|
|
|
} |
|
|
|
TakeOrderResultDTO takeOrderResultDTO=new TakeOrderResultDTO(); |
|
|
|
//只有志愿者才可以接单
|
|
|
|
VolunteerInfoDTO volunteerInfoDTO=volunteerInfoService.queryUserVolunteerInfo(formDTO.getUserId()); |
|
|
|
if(null==volunteerInfoDTO){ |
|
|
|
takeOrderResultDTO.setIsVolunteer(false); |
|
|
|
return takeOrderResultDTO; |
|
|
|
} |
|
|
|
takeOrderResultDTO.setIsVolunteer(true); |
|
|
|
//1、修改主表
|
|
|
|
//置为已接单
|
|
|
|
entity.setStatus(UserDemandConstant.HAVE_ORDER); |
|
|
|
baseDao.updateById(entity); |
|
|
|
//2、插入操作日志
|
|
|
|
IcUserDemandOperateLogEntity logEntity = new IcUserDemandOperateLogEntity(); |
|
|
|
logEntity.setCustomerId(entity.getCustomerId()); |
|
|
|
logEntity.setDemandRecId(formDTO.getDemandRecId()); |
|
|
|
logEntity.setUserType(UserDemandConstant.RESI); |
|
|
|
logEntity.setUserId(formDTO.getUserId()); |
|
|
|
logEntity.setActionCode(UserDemandConstant.TAKE_ORDER); |
|
|
|
logEntity.setOperateTime(new Date()); |
|
|
|
operateLogDao.insert(logEntity); |
|
|
|
//3、插入或更新服务记录
|
|
|
|
IcUserDemandServiceEntity origin=demandServiceDao.selectByRecId(formDTO.getDemandRecId()); |
|
|
|
String serviceId=""; |
|
|
|
if (null == origin) { |
|
|
|
IcUserDemandServiceEntity serviceEntity=new IcUserDemandServiceEntity(); |
|
|
|
serviceEntity.setCustomerId(entity.getCustomerId()); |
|
|
|
serviceEntity.setDemandRecId(entity.getId()); |
|
|
|
serviceEntity.setServiceType(UserDemandConstant.VOLUNTEER); |
|
|
|
serviceEntity.setServerId(formDTO.getUserId()); |
|
|
|
demandServiceDao.insert(serviceEntity); |
|
|
|
serviceId=serviceEntity.getId(); |
|
|
|
}else{ |
|
|
|
origin.setServiceType(UserDemandConstant.VOLUNTEER); |
|
|
|
origin.setServerId(formDTO.getUserId()); |
|
|
|
origin.setUpdatedBy(formDTO.getUserId()); |
|
|
|
demandServiceDao.updateById(origin); |
|
|
|
serviceId=origin.getId(); |
|
|
|
} |
|
|
|
takeOrderResultDTO.setServiceId(serviceId); |
|
|
|
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; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |