|
@@ -5,6 +5,7 @@ import java.math.RoundingMode;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
|
|
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
|
|
|
import com.github.pagehelper.Page;
|
|
import com.github.pagehelper.Page;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
@@ -34,6 +35,7 @@ import com.sckw.core.web.constant.HttpStatus;
|
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
|
import com.sckw.core.web.response.HttpResult;
|
|
import com.sckw.core.web.response.HttpResult;
|
|
|
import com.sckw.fleet.api.feign.DriverScoreFeignService;
|
|
import com.sckw.fleet.api.feign.DriverScoreFeignService;
|
|
|
|
|
+import com.sckw.fleet.api.model.dto.DriverScoreQuery;
|
|
|
import com.sckw.fleet.api.model.dto.UpdateDriverScoreDto;
|
|
import com.sckw.fleet.api.model.dto.UpdateDriverScoreDto;
|
|
|
import com.sckw.redis.constant.RedisConstant;
|
|
import com.sckw.redis.constant.RedisConstant;
|
|
|
import com.sckw.redis.utils.RedissonUtils;
|
|
import com.sckw.redis.utils.RedissonUtils;
|
|
@@ -394,12 +396,20 @@ public class KwcContractLogisticsScoreServiceImpl implements IKwcContractLogisti
|
|
|
//1、更新企业评分
|
|
//1、更新企业评分
|
|
|
BigDecimal score = logisticsScore.getScore();
|
|
BigDecimal score = logisticsScore.getScore();
|
|
|
//查询物流企业下所有的司机
|
|
//查询物流企业下所有的司机
|
|
|
- HttpResult result = driverScoreFeignService.countDriver(detailDto.getLogisticsEntId());
|
|
|
|
|
- if(result.getCode() == HttpStatus.SUCCESS_CODE && (Integer)result.getData()>0){
|
|
|
|
|
- Integer driverCount =(Integer)result.getData();
|
|
|
|
|
- //企业变动评分
|
|
|
|
|
- BigDecimal entScoreChange = detailDto.getScoreChange().divide(new BigDecimal(driverCount),2, RoundingMode.HALF_UP);
|
|
|
|
|
- BigDecimal resultScore = score.add(entScoreChange);
|
|
|
|
|
|
|
+ HttpResult driverCountRes = driverScoreFeignService.countDriver(detailDto.getLogisticsEntId());
|
|
|
|
|
+ if(driverCountRes.getCode() == HttpStatus.SUCCESS_CODE && (Integer)driverCountRes.getData()>0){
|
|
|
|
|
+ //查询物流企业下的所有司机的总分
|
|
|
|
|
+ HttpResult scoreCountRes = driverScoreFeignService.countDriverScore(new DriverScoreQuery(detailDto.getProviderEntId(),detailDto.getLogisticsEntId()));
|
|
|
|
|
+ if(scoreCountRes.getCode() != HttpStatus.SUCCESS_CODE){
|
|
|
|
|
+ log.error("查询物流企业下的所有司机的总分失败,响应信息如下:{}", JSON.toJSONString(scoreCountRes));
|
|
|
|
|
+ throw new BusinessException("系统修改评分失败,请稍后再试");
|
|
|
|
|
+ }
|
|
|
|
|
+ BigDecimal driverScoreCount = (BigDecimal)scoreCountRes.getData();
|
|
|
|
|
+ Integer driverCount =(Integer)driverCountRes.getData();
|
|
|
|
|
+ //计算物流企业最新评分
|
|
|
|
|
+ BigDecimal resultScore = driverScoreCount.divide(new BigDecimal(driverCount),2, RoundingMode.HALF_UP);
|
|
|
|
|
+ //企业变动评分
|
|
|
|
|
+ BigDecimal entScoreChange = resultScore.subtract(score);
|
|
|
logisticsScore.setScore(resultScore);
|
|
logisticsScore.setScore(resultScore);
|
|
|
logisticsScore.setUpdateBy(LoginUserHolder.getUserId());
|
|
logisticsScore.setUpdateBy(LoginUserHolder.getUserId());
|
|
|
logisticsScore.setUpdateTime(new Date());
|
|
logisticsScore.setUpdateTime(new Date());
|