14 changed files with 218 additions and 15 deletions
@ -0,0 +1,15 @@ |
|||||
|
package com.epmet.dto.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 自动评价参数 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class AutoEvaluateDemandFormDTO implements Serializable { |
||||
|
private String customerId; |
||||
|
private Integer exceedDay; |
||||
|
} |
@ -0,0 +1,11 @@ |
|||||
|
package com.epmet.service; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.service.BaseService; |
||||
|
import com.epmet.dto.result.demand.FinishResultDTO; |
||||
|
import com.epmet.entity.IcUserDemandSatisfactionEntity; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface IcUserDemandSatisfactionService extends BaseService<IcUserDemandSatisfactionEntity> { |
||||
|
List<FinishResultDTO> evaluateDemandAuto(String customerId, Integer exceedDay); |
||||
|
} |
@ -0,0 +1,109 @@ |
|||||
|
package com.epmet.service.impl; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
||||
|
import com.epmet.commons.rocketmq.messages.ServerSatisfactionCalFormDTO; |
||||
|
import com.epmet.commons.tools.constant.Constant; |
||||
|
import com.epmet.commons.tools.constant.NumConstant; |
||||
|
import com.epmet.constant.UserDemandConstant; |
||||
|
import com.epmet.dao.IcUserDemandOperateLogDao; |
||||
|
import com.epmet.dao.IcUserDemandRecDao; |
||||
|
import com.epmet.dao.IcUserDemandSatisfactionDao; |
||||
|
import com.epmet.dao.IcUserDemandServiceDao; |
||||
|
import com.epmet.dto.IcUserDemandRecDTO; |
||||
|
import com.epmet.dto.result.demand.FinishResultDTO; |
||||
|
import com.epmet.entity.IcUserDemandOperateLogEntity; |
||||
|
import com.epmet.entity.IcUserDemandSatisfactionEntity; |
||||
|
import com.epmet.entity.IcUserDemandServiceEntity; |
||||
|
import com.epmet.service.IcPartyUnitService; |
||||
|
import com.epmet.service.IcResiDemandDictService; |
||||
|
import com.epmet.service.IcUserDemandSatisfactionService; |
||||
|
import org.apache.commons.collections4.CollectionUtils; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.Collections; |
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
|
||||
|
public class IcUserDemandSatisfactionServiceImpl extends BaseServiceImpl<IcUserDemandSatisfactionDao, IcUserDemandSatisfactionEntity> implements IcUserDemandSatisfactionService { |
||||
|
|
||||
|
@Autowired |
||||
|
private IcUserDemandRecDao icUserDemandRecDao; |
||||
|
@Autowired |
||||
|
private IcUserDemandOperateLogDao operateLogDao; |
||||
|
@Autowired |
||||
|
private IcUserDemandServiceDao demandServiceDao; |
||||
|
@Autowired |
||||
|
private IcResiDemandDictService demandDictService; |
||||
|
@Autowired |
||||
|
private IcPartyUnitService icPartyUnitService; |
||||
|
|
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
@Override |
||||
|
public List<FinishResultDTO> evaluateDemandAuto(String customerId, Integer exceedDay) { |
||||
|
// 查询完成后,超过7天未评价的记录
|
||||
|
List<IcUserDemandRecDTO> list=icUserDemandRecDao.selectNoEvaluate(customerId,exceedDay); |
||||
|
if(CollectionUtils.isEmpty(list)){ |
||||
|
return Collections.EMPTY_LIST; |
||||
|
} |
||||
|
List<FinishResultDTO> resultList=new ArrayList<>(); |
||||
|
Date nowDate=new Date(); |
||||
|
for(IcUserDemandRecDTO demand:list){ |
||||
|
|
||||
|
// 1、插入评价得分记录
|
||||
|
IcUserDemandSatisfactionEntity satisfactionEntity = new IcUserDemandSatisfactionEntity(); |
||||
|
satisfactionEntity.setCustomerId(demand.getCustomerId()); |
||||
|
satisfactionEntity.setDemandRecId(demand.getId()); |
||||
|
satisfactionEntity.setEvaluateTime(nowDate); |
||||
|
satisfactionEntity.setUserType(UserDemandConstant.SYS); |
||||
|
satisfactionEntity.setUserId(Constant.APP_USER_FLAG); |
||||
|
satisfactionEntity.setScore(new BigDecimal(NumConstant.FIVE_STR)); |
||||
|
satisfactionEntity.setRemark(UserDemandConstant.DEFAULT_EVALUATE_REMARK); |
||||
|
baseDao.insert(satisfactionEntity); |
||||
|
|
||||
|
// 2、插入评价操作日志
|
||||
|
IcUserDemandOperateLogEntity evaluateEntity = new IcUserDemandOperateLogEntity(); |
||||
|
evaluateEntity.setCustomerId(demand.getCustomerId()); |
||||
|
evaluateEntity.setDemandRecId(demand.getId()); |
||||
|
evaluateEntity.setUserType(UserDemandConstant.SYS); |
||||
|
evaluateEntity.setUserId(Constant.APP_USER_FLAG); |
||||
|
evaluateEntity.setActionCode(UserDemandConstant.EVALUATE); |
||||
|
evaluateEntity.setOperateTime(nowDate); |
||||
|
operateLogDao.insert(evaluateEntity); |
||||
|
|
||||
|
// 3、更新主表已评价标识,是否解决标识。
|
||||
|
icUserDemandRecDao.evaluate(demand.getId(),UserDemandConstant.RESOLVED); |
||||
|
|
||||
|
//4、返回服务方,志愿者发放积分,区域化党建单位,计算群众满意度
|
||||
|
IcUserDemandServiceEntity serviceEntity = demandServiceDao.selectByRecId(demand.getId()); |
||||
|
if(null==serviceEntity){ |
||||
|
continue; |
||||
|
} |
||||
|
if(UserDemandConstant.PARTY_UNIT.equals(serviceEntity.getServiceType())){ |
||||
|
ServerSatisfactionCalFormDTO satisfactionCalFormDTO=new ServerSatisfactionCalFormDTO(); |
||||
|
satisfactionCalFormDTO.setCustomerId(demand.getCustomerId()); |
||||
|
satisfactionCalFormDTO.setServiceType(serviceEntity.getServiceType()); |
||||
|
satisfactionCalFormDTO.setServerId(serviceEntity.getServerId()); |
||||
|
icPartyUnitService.calPartyUnitSatisfation(satisfactionCalFormDTO); |
||||
|
}else if(UserDemandConstant.VOLUNTEER.equals(serviceEntity.getServiceType())){ |
||||
|
FinishResultDTO finishResultDTO = new FinishResultDTO(); |
||||
|
finishResultDTO.setServerId(serviceEntity.getServerId()); |
||||
|
finishResultDTO.setServiceType(serviceEntity.getServiceType()); |
||||
|
finishResultDTO.setAwardPoint(demand.getAwardPoint()); |
||||
|
finishResultDTO.setEvaluateFlag(true); |
||||
|
if(StringUtils.isBlank(demand.getParentCode())||NumConstant.ZERO_STR.equals(demand.getParentCode())){ |
||||
|
finishResultDTO.setFirstCategoryName(demandDictService.getCategoryName(demand.getCustomerId(),demand.getCategoryCode())); |
||||
|
}else{ |
||||
|
finishResultDTO.setFirstCategoryName(demandDictService.getCategoryName(demand.getCustomerId(),demand.getParentCode())); |
||||
|
} |
||||
|
String content = demand.getContent().length() > 100 ? demand.getContent().substring(0, 99) : demand.getContent(); |
||||
|
finishResultDTO.setRemark(String.format(UserDemandConstant.GRANT_POINT_REMARK,demand.getDemandUserName(),content)); |
||||
|
resultList.add(finishResultDTO) ; |
||||
|
} |
||||
|
} |
||||
|
return resultList; |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue