提交 28b52838 authored 作者: 刘海泉's avatar 刘海泉

Merge remote-tracking branch 'origin/master' into v20.8_add_sub_weight_20240805

# Conflicts: # performance-api/src/main/java/com/clx/performance/feign/PerformanceSDKFeign.java # performance-api/src/main/java/com/clx/performance/vo/pc/OrderGoodsVO.java # performance-web/src/main/java/com/clx/performance/controller/feign/PerformanceSdkFeignController.java # performance-web/src/main/java/com/clx/performance/service/impl/OrderChildServiceImpl.java # performance-web/src/main/java/com/clx/performance/service/impl/OrderGoodsServiceImpl.java # performance-web/src/main/java/com/clx/performance/service/impl/PerformanceProgressServiceImpl.java
......@@ -6,7 +6,7 @@
<groupId>com.clx.cy</groupId>
<artifactId>performance-api</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>${clx-performance-api.version}</version>
<name>performance-api</name>
<parent>
......
package com.clx.performance.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
import java.util.Optional;
public enum OrderGoodsEnum {
;
@Getter
@AllArgsConstructor
public enum SendWaitModeEnum {
// 发货-排队系统形式 1:小程序 2:app
WECHAT_PROGRAM(1, "微信小程序"),
APP(2, "app");
private final Integer code;
private final String msg;
public static Optional<SendWaitModeEnum> getByCode(Integer code) {
if (code == null) {
return Optional.empty();
}
return Arrays.stream(values()).filter(e -> e.code.equals(code)).findFirst();
}
public static String getMsgByCode(Integer code) {
return getByCode(code).map(SendWaitModeEnum::getMsg).orElse(null);
}
}
@Getter
@AllArgsConstructor
public enum SendWaitSystemMsgEnum {
YES(1, "需要"),
NO(0, "不需要");
private final Integer code;
private final String msg;
public static Optional<SendWaitSystemMsgEnum> getByCode(Integer code) {
if (code == null) {
return Optional.empty();
}
return Arrays.stream(values()).filter(e -> e.code.equals(code)).findFirst();
}
public static String getMsgByCode(Integer code) {
return getByCode(code).map(SendWaitSystemMsgEnum::getMsg).orElse(null);
}
}
public static void main(String[] args) {
System.out.println(SendWaitModeEnum.getMsgByCode(null));
}
}
......@@ -101,6 +101,20 @@ public enum PerformanceResultEnum implements ResultEnum {
APP_POP_UP_DRIVER_RESIDUE_ERROR(-500, "app弹窗提示"),
/**车主提示语 **/
APP_POP_UP_OWNER_RESIDUE_ERROR(-499, "app弹窗提示"),
/**司机未绑卡提示语 **/
APP_POP_UP_DRIVER_NO_BANKCARD_ERROR(-498, "司机未绑卡"),
/**车主未绑卡提示语 **/
APP_POP_UP_OWNER_NO_BANKCARD_ERROR(-497, "车主未绑卡"),
/**司机钱包不存在提示语 **/
APP_POP_UP_DRIVER_WALLET_NULL_NOT_EXIST_ERROR(-494, "司机钱包不存在"),
/**车主钱包不存在提示语 **/
APP_POP_UP_OWNER_WALLET_NULL_NOT_EXIST_ERROR(-493, "车主钱包不存在"),
/**司机未实名 **/
APP_POP_UP_DRIVER_NOT_AUTH(-496, "司机钱包不存在"),
/**车主未实名 **/
APP_POP_UP_OWNER_NOT_AUTH(-495, "车主钱包不存在"),
WALLET_CODE_IS_NULL(1704, "用户钱包不存在"),
ORDER_GOODS_SAVE_FAIL(1801, "保存货单失败,请稍后再试"),
......
......@@ -2,9 +2,13 @@ package com.clx.performance.feign;
import com.clx.open.sdk.request.action.GetOrderBreakContractOwnerRuleFileAction;
import com.clx.open.sdk.request.dto.OrderCanExtractWeightDTO;
import com.clx.open.sdk.request.action.QueryPerformanceProgressAction;
import com.clx.open.sdk.request.action.QueryPerformanceProgressLogAction;
import com.clx.open.sdk.request.dto.OwnerCancelResidueWeightDTO;
import com.clx.performance.param.pc.OrderCancelParam;
import com.clx.performance.vo.pc.OwnerAccountAllVO;
import com.clx.performance.vo.pc.PerformanceProgressOperationLogVO;
import com.clx.performance.vo.pc.PerformanceProgressVO;
import com.clx.performance.vo.pc.breakcontract.carrier.BreakContractOwnerRuleFileVO;
import com.msl.common.result.Result;
import org.springframework.cloud.openfeign.FeignClient;
......@@ -13,6 +17,8 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@FeignClient(name = "clx-performance", configuration = PerformanceClientConfiguration.class)
public interface PerformanceSDKFeign {
......@@ -34,6 +40,11 @@ public interface PerformanceSDKFeign {
@PostMapping("clx-performance/feign/sdk/getOwnerRuleFile")
Result<BreakContractOwnerRuleFileVO> getOwnerRuleFile(@RequestBody GetOrderBreakContractOwnerRuleFileAction action);
@GetMapping("clx-performance/feign/sdk/queryPerformanceProgress")
Result<List<PerformanceProgressVO>> queryPerformanceProgress(@RequestBody QueryPerformanceProgressAction action);
@GetMapping("clx-performance/feign/sdk/queryPerformanceProgressLog")
Result<List<PerformanceProgressOperationLogVO>> queryPerformanceProgressLog(@RequestBody QueryPerformanceProgressLogAction action);
......
package com.clx.performance.vo.app;
import com.clx.performance.enums.OrderChildEnum;
import com.clx.performance.enums.OrderGoodsEnum;
import com.msl.common.convertor.type.MoneyOutConvert;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -230,4 +231,31 @@ public class OrderChildVO {
@ApiModelProperty("接单保证金 平台服务费费率 弹窗和文案显示 0 不显示 1 显示")
private Integer goodsOrderDetailShow = 0;
}
\ No newline at end of file
/* 20240730 增加货源地信息 */
@ApiModelProperty(value = "货源地现场联系人")
private String sendContact;
@ApiModelProperty(value = "货源地联系人手机号")
private String sendContactPhone;
@ApiModelProperty(value = "发货-是否需要系统排队 0 否 1 是")
private Integer sendWaitSystem;
@ApiModelProperty(value = "发货-是否需要系统排队 描述: 需要 不需要")
public String getSendWaitSystemMsg() {
return OrderGoodsEnum.SendWaitSystemMsgEnum.getMsgByCode(sendWaitSystem);
}
@ApiModelProperty(value = "发货-排队系统名称")
private String sendWaitSystemName;
@ApiModelProperty(value = "发货-排队系统形式 1:小程序 2:app")
private Integer sendWaitMode;
@ApiModelProperty(value = "发货-排队系统形式 描述: 微信小程序 app")
public String getSendWaitModeMsg() {
return OrderGoodsEnum.SendWaitModeEnum.getMsgByCode(sendWaitMode);
}
}
package com.clx.performance.vo.pc;
import com.clx.performance.enums.OrderGoodsEnum;
import com.msl.common.convertor.type.MoneyOutConvert;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
......@@ -170,6 +171,33 @@ public class OrderGoodsVO {
@ApiModelProperty("已派单数")
private Integer dispatchedOrders;
/* 20240730 增加货源地信息 */
@ApiModelProperty(value = "货源地现场联系人")
private String sendContact;
@ApiModelProperty(value = "货源地联系人手机号")
private String sendContactPhone;
@ApiModelProperty(value = "发货-是否需要系统排队 0 否 1 是")
private Integer sendWaitSystem;
@ApiModelProperty(value = "发货-是否需要系统排队 描述: 需要 不需要")
public String getSendWaitSystemMsg() {
return OrderGoodsEnum.SendWaitSystemMsgEnum.getMsgByCode(sendWaitSystem);
}
@ApiModelProperty(value = "发货-排队系统名称")
private String sendWaitSystemName;
@ApiModelProperty(value = "发货-排队系统形式 1:小程序 2:app")
private Integer sendWaitMode;
@ApiModelProperty(value = "发货-排队系统形式 描述: 微信小程序 app")
public String getSendWaitModeMsg() {
return OrderGoodsEnum.SendWaitModeEnum.getMsgByCode(sendWaitMode);
}
@ApiModelProperty("当前货单总吨数是否超过总拉运量 1:超过 ")
private Integer overOrderWeight;
......
......@@ -2,15 +2,21 @@ package com.clx.performance.controller.feign;
import com.clx.open.sdk.request.action.GetOrderBreakContractOwnerRuleFileAction;
import com.clx.open.sdk.request.dto.OrderCanExtractWeightDTO;
import com.clx.open.sdk.request.action.GetOwnerAccountInfoAction;
import com.clx.open.sdk.request.action.QueryPerformanceProgressAction;
import com.clx.open.sdk.request.action.QueryPerformanceProgressLogAction;
import com.clx.open.sdk.request.dto.OwnerCancelResidueWeightDTO;
import com.clx.performance.param.pc.OrderCancelParam;
import com.clx.performance.service.OrderCancelService;
import com.clx.performance.service.OrderGoodsService;
import com.clx.performance.service.OrderWeightService;
import com.clx.performance.service.OwnerAccountService;
import com.clx.performance.service.PerformanceProgressService;
import com.clx.performance.service.breakcontract.BreakContractOwnerRuleService;
import com.clx.performance.vo.feign.OrderExtractWeightVO;
import com.clx.performance.vo.pc.OwnerAccountAllVO;
import com.clx.performance.vo.pc.PerformanceProgressOperationLogVO;
import com.clx.performance.vo.pc.PerformanceProgressVO;
import com.clx.performance.vo.pc.breakcontract.carrier.BreakContractOwnerRuleFileVO;
import com.msl.common.result.Result;
import com.msl.user.utils.TokenUtil;
......@@ -22,6 +28,10 @@ import org.springframework.beans.BeanUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.util.List;
import static com.clx.performance.enums.PerformanceProgressEnum.LogType.PERFORMANCE_ABNORMAL_REASON;
import javax.validation.constraints.NotBlank;
@Slf4j
......@@ -45,6 +55,8 @@ public class PerformanceSdkFeignController {
private final PerformanceProgressService performanceProgressService;
@ApiOperation(value = "货主端取消订单", notes = "<br>By:胡宇帆")
@PostMapping("/ownCancelOrderPre")
......@@ -74,6 +86,17 @@ public class PerformanceSdkFeignController {
return Result.ok(breakContractOwnerRuleService.getRuleFile(action.getId()));
}
@ApiOperation(value = "查询履约进度", notes = "<br>By:杨启发")
@GetMapping("/queryPerformanceProgress")
Result<List<PerformanceProgressVO>> queryPerformanceProgress(@RequestBody QueryPerformanceProgressAction action){
return Result.ok(performanceProgressService.queryPerformanceProgress(action.getOrderNoList()));
}
@ApiOperation(value = "查询履约进度操作日志", notes = "<br>By:杨启发")
@GetMapping("/queryPerformanceProgressLog")
Result<List<PerformanceProgressOperationLogVO>> queryPerformanceProgressLog(@RequestBody QueryPerformanceProgressLogAction action){
return Result.ok(performanceProgressService.getOperationLog(action.getOrderNo(),PERFORMANCE_ABNORMAL_REASON.getCode()));
}
@ApiOperation(value = "获取当前订单的可提取吨数", notes = "<br>By:刘海泉")
@GetMapping("/getOrderCanExtractWeight")
public Result<OrderCanExtractWeightDTO> getOrderCanExtractWeight(@RequestParam(value = "orderNo")
......
......@@ -75,7 +75,7 @@ public class CarrierPerformanceProgressController {
@ApiOperation(value = "获取履约进度编辑日志列表",notes = "<br>By:刘海泉")
@GetMapping("/getOperationLog")
public Result<List<PerformanceProgressOperationLogVO>> getOperationLog(@RequestParam("orderNo") @NotBlank(message = "订单编号不能为空") String orderNo) {
List<PerformanceProgressOperationLogVO> list = performanceProgressService.getOperationLog(orderNo);
List<PerformanceProgressOperationLogVO> list = performanceProgressService.getOperationLog(orderNo,null);
return Result.ok(list);
}
......
......@@ -12,5 +12,5 @@ import java.util.List;
* Time 16:02
*/
public interface PerformanceProgressLogDao extends BaseDao<PerformanceProgressLogMapper, PerformanceProgressLog, Integer> {
List<PerformanceProgressLog> getOperationLog(String orderNo);
List<PerformanceProgressLog> getOperationLog(String orderNo,Integer operateType);
}
......@@ -8,6 +8,7 @@ import com.msl.common.dao.impl.BaseDaoImpl;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Objects;
/**
* @author kavin
......@@ -17,9 +18,10 @@ import java.util.List;
@Repository
public class PerformanceProgressLogDaoImpl extends BaseDaoImpl<PerformanceProgressLogMapper, PerformanceProgressLog, Integer> implements PerformanceProgressLogDao {
@Override
public List<PerformanceProgressLog> getOperationLog(String orderNo) {
public List<PerformanceProgressLog> getOperationLog(String orderNo,Integer operateType) {
LambdaQueryWrapper<PerformanceProgressLog> query = new LambdaQueryWrapper<>();
query.eq(PerformanceProgressLog :: getOrderNo,orderNo);
query.eq(Objects.nonNull(operateType),PerformanceProgressLog :: getOperateType,operateType);
query.orderByDesc(PerformanceProgressLog :: getId);
return baseMapper.selectList(query);
}
......
......@@ -30,11 +30,11 @@ public interface PerformanceProgressService {
PerformanceProgressDetailVO getPerformanceProgressDetail(Integer id);
List<PerformanceProgressOperationLogVO> getOperationLog(String orderNo);
List<PerformanceProgressOperationLogVO> getOperationLog(String orderNo,Integer operateType);
void dealPerformanceProgress4OrderInfo(OrderInfoMessage data);
List<PerformanceProgressVO> queryPerformanceProgress(List<String> orderNoList);
void dealPerformanceProgress4OrderGoods(OrderGoods data);
......
......@@ -63,10 +63,13 @@ import com.clx.performance.vo.app.owner.OwnerOrderChildVO;
import com.clx.performance.vo.pc.*;
import com.clx.performance.vo.pc.child.UpdateCarrierBatchCancelVO;
import com.clx.user.enums.driver.DriverInfoEnum;
import com.clx.user.enums.idcard.IdCardEnum;
import com.clx.user.feign.DocumentFeign;
import com.clx.user.param.feign.BatchUpdateDriverAndTruckParam;
import com.clx.user.feign.UserClxFeign;
import com.clx.user.vo.feign.DriverTruckInfoFeignVo;
import com.clx.user.vo.feign.OwnerInfoFeignVO;
import com.clx.user.vo.pc.auth.AuthVo;
import com.msl.common.base.Optional;
import com.msl.common.base.PageParam;
import com.msl.common.enums.ResultCodeEnum;
......@@ -84,6 +87,8 @@ import com.tencentcloudapi.ocr.v20181119.models.GroupInfo;
import com.tencentcloudapi.ocr.v20181119.models.ItemInfo;
import com.tencentcloudapi.ocr.v20181119.models.SmartStructuralOCRV2Request;
import com.tencentcloudapi.ocr.v20181119.models.SmartStructuralOCRV2Response;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.exception.ExceptionUtils;
......@@ -242,6 +247,8 @@ public class OrderChildServiceImpl implements OrderChildService {
private DocumentFeign documentFeign;
@Autowired
private OrderWeightService orderWeightService;
@Autowired
private UserClxFeign userClxFeign;
@PostConstruct
public void init(){
......@@ -328,6 +335,15 @@ public class OrderChildServiceImpl implements OrderChildService {
param.getTruckId()).orElseThrow(ResultCodeEnum.FAIL);
BigDecimal truckLoad = driverTruckInfo.getLoad();
String truckNo = driverTruckInfo.getTruckNo();
Long truckOwnerUserNo = driverTruckInfo.getTruckOwnUserNo();
boolean isOwner = Objects.equals(userNo, truckOwnerUserNo);
// 司机实名认证校验
// 这里之所以在check后再次增加较验,是为了避免老版本的应用无法识别新的错误码导致无法正常校验的问题
PerformanceResultEnum checkRealName = checkRealName(param.getDriverUserNo(), isOwner);
if (Objects.nonNull(checkRealName)) {
throw new ServiceSystemException(checkRealName);
}
// 司机接单限制
driverTakeOrderLimit(driverTruckInfo.getUserNo());
......@@ -351,7 +367,7 @@ public class OrderChildServiceImpl implements OrderChildService {
deposit = orderGoods.getDeposit();//接单保证金
}
//接单钱包限制
driverTakeOrderPaymentLimit(driverTruckInfo.getWalletCode(),driverTruckInfo.getTruckOwnWalletCode(),deposit);
driverTakeOrderPaymentLimit(driverTruckInfo.getWalletCode(),driverTruckInfo.getTruckOwnWalletCode(),deposit, isOwner);
// 状态验证
if (!Objects.equals(orderGoods.getOrderGoodsStatus(), OrderGoodsStatusEnum.Status.PAYING.getCode()) &&
......@@ -1704,6 +1720,13 @@ public class OrderChildServiceImpl implements OrderChildService {
result.setLoadBeginTime(orderInfoFeign.getLoadBeginTime());
result.setLoadEndTime(orderInfoFeign.getLoadEndTime());
//货源地信息
result.setSendContact(orderInfoFeign.getSendContact());
result.setSendContactPhone(orderInfoFeign.getSendContactPhone());
result.setSendWaitSystem(orderInfoFeign.getSendWaitSystem());
result.setSendWaitSystemName(orderInfoFeign.getSendWaitSystemName());
result.setSendWaitMode(orderInfoFeign.getSendWaitMode());
//查询结算信息
Optional<SettlementOwnerDetail> optional = settlementOwnerDetailDao.getByChildNo(childNo);
if(optional.isPresent()){
......@@ -1806,6 +1829,31 @@ public class OrderChildServiceImpl implements OrderChildService {
}
private int check(OrderChildCheckParam param) {
UserSessionData loginUserInfo = TokenUtil.getLoginUserInfo();
Long loginUserNo = loginUserInfo.getUserNo();
// 查询司机车辆信息
DriverTruckInfoFeignVo driverTruckInfo = driverService.getUserDetailInfo(param.getDriverUserNo(),
param.getTruckId()).orElseThrow(ResultCodeEnum.FAIL);
Long truckOwnerUserNo = driverTruckInfo.getTruckOwnUserNo();
Integer driverWalletCode = driverTruckInfo.getWalletCode();
Integer truckWalletCode = driverTruckInfo.getTruckOwnWalletCode();
log.info("司机钱包信息:{}-{},driverWalletCode:{},truckWalletCode:{}", driverTruckInfo.getUserNo(), driverTruckInfo.getName(), driverWalletCode, truckWalletCode);
//是否车主
boolean isOwner = Objects.equals(loginUserNo, truckOwnerUserNo);
//验证是否实名认证
PerformanceResultEnum checkRealName = checkRealName(param.getDriverUserNo(), isOwner);
if (Objects.nonNull(checkRealName)) {
return checkRealName.getCode();
}
// 验证是否绑卡
PerformanceResultEnum checkBankCard = checkBankCard(param, driverWalletCode, truckWalletCode, isOwner);
if (Objects.nonNull(checkBankCard)) {
return checkBankCard.getCode();
}
OrderGoods orderGoods = orderGoodsDao.getByOrderGoodsNo(param.getOrderGoodsNo()).get();
BigDecimal sendLatitude = orderGoods.getSendLatitude();
BigDecimal sendLongitude = orderGoods.getSendLongitude();
......@@ -1849,13 +1897,89 @@ public class OrderChildServiceImpl implements OrderChildService {
if (localDateTime.isAfter(beginLocalDateTime) && localDateTime.isBefore(endLocalDateTime)) {
log.info("不用弹");
return 0;
return CheckResult.OK.code;
} else {
log.info("需要弹");
return 1;
return CheckResult.FAIL.code;
}
}
return 0;
return CheckResult.OK.code;
}
/**
* 校验实名认证
* @param param
* @param driverWallCode
* @param truckWalletCode
* @return
*/
private PerformanceResultEnum checkBankCard(OrderChildCheckParam param, Integer driverWallCode, Integer truckWalletCode, boolean isOwner) {
//接单校验 必须两个都有钱包
if (Objects.isNull(driverWallCode)) {
log.info("{}-{}司机没有钱包", param.getDriverUserNo(), param.getTruckId());
return PerformanceResultEnum.APP_POP_UP_DRIVER_WALLET_NULL_NOT_EXIST_ERROR;
}
if (Objects.isNull(truckWalletCode)) {
log.info("{}-{}车主没有钱包", param.getDriverUserNo(), param.getTruckId());
return PerformanceResultEnum.APP_POP_UP_OWNER_WALLET_NULL_NOT_EXIST_ERROR;
}
//判断是司机还是车主
boolean truckOwnerFlag = Objects.equals(driverWallCode, truckWalletCode);
Integer checkWalletCode = truckOwnerFlag ? driverWallCode : truckWalletCode;
Result<WalletResidueCardDTO> result = feignPaymentService.getWallet(checkWalletCode);
if (result != null && Objects.equals(result.getCode(), 0) && result.getData() != null) {
WalletResidueCardDTO data = result.getData();
//有效银行卡数量 不能为空
if (data.getCardCount() <= 0) {
PerformanceResultEnum returnResult = isOwner ? PerformanceResultEnum.APP_POP_UP_DRIVER_NO_BANKCARD_ERROR
: PerformanceResultEnum.APP_POP_UP_OWNER_NO_BANKCARD_ERROR;
log.info("{}", returnResult.getMsg());
return returnResult;
}
} else {
log.info("获取钱包信息失败:{}", checkWalletCode);
//用户钱包不存在
return isOwner ? PerformanceResultEnum.APP_POP_UP_DRIVER_WALLET_NULL_NOT_EXIST_ERROR
: PerformanceResultEnum.APP_POP_UP_OWNER_WALLET_NULL_NOT_EXIST_ERROR;
}
return null;
}
@Getter
@AllArgsConstructor
public enum CheckResult {
OK(0, "不用弹窗"),
FAIL(1, "需要弹"),
DRIVER_NOT_REAL_NAME(APP_POP_UP_DRIVER_NOT_AUTH.getCode(), "未实名认证"),
OWENR_NOT_REAL_NAME(APP_POP_UP_OWNER_NOT_AUTH.getCode(), "未实名认证"),
DRIVER_WALLET_NOT_EXIST(APP_POP_UP_DRIVER_WALLET_NULL_NOT_EXIST_ERROR.getCode(), "司机未绑卡"),
OWNER_WALLET_NOT_EXIST(APP_POP_UP_OWNER_WALLET_NULL_NOT_EXIST_ERROR.getCode(), "车主未绑卡"),
DRIVER_NO_BANKCARD(APP_POP_UP_DRIVER_NO_BANKCARD_ERROR.getCode(), "司机未绑卡"),
OWNER_NO_BANKCARD(APP_POP_UP_OWNER_NO_BANKCARD_ERROR.getCode(), "车主未绑卡");
private final int code;
private final String msg;
}
/**
* 校验实名认证
*
* @param
* @return
*/
private PerformanceResultEnum checkRealName(Long driverUserNo, boolean isOwner) {
//判断当前账号是否车主
Result<AuthVo> authResult = userClxFeign.getAuthInfo(driverUserNo);
if (!authResult.succeed()) {
log.info("获取司机{}实名认证信息失败", driverUserNo);
return isOwner ? PerformanceResultEnum.APP_POP_UP_DRIVER_NOT_AUTH : PerformanceResultEnum.APP_POP_UP_OWNER_NOT_AUTH;
} else {
AuthVo authVo = authResult.getData();
if (!Objects.equals(authVo.getAuthStatus(), IdCardEnum.AuthStatus.ALREADY_REAL_NAME.getCode())) {
log.info("司机{}实名状态非已实名:{}", driverUserNo, authVo.getAuthStatus());
return isOwner ? PerformanceResultEnum.APP_POP_UP_DRIVER_NOT_AUTH : PerformanceResultEnum.APP_POP_UP_OWNER_NOT_AUTH;
}
}
return null;
}
//计算亏吨吨数
......@@ -2104,10 +2228,13 @@ public class OrderChildServiceImpl implements OrderChildService {
/**
* 司机接单支付校验
*/
private void driverTakeOrderPaymentLimit(Integer driverWallCode, Integer truckWalletCode,BigDecimal deposit) {
private void driverTakeOrderPaymentLimit(Integer driverWallCode, Integer truckWalletCode,BigDecimal deposit, boolean isOwner) {
//判断是司机还是车主 接单校验 必须两个都有钱包
if (Objects.isNull(driverWallCode) || Objects.isNull(truckWalletCode)) {
throw new ServiceSystemException(PerformanceResultEnum.WALLET_CODE_IS_NULL);
if (Objects.isNull(driverWallCode)) {
throw new ServiceSystemException(PerformanceResultEnum.APP_POP_UP_DRIVER_WALLET_NULL_NOT_EXIST_ERROR);
}
if (Objects.isNull(truckWalletCode)) {
throw new ServiceSystemException(PerformanceResultEnum.APP_POP_UP_OWNER_WALLET_NULL_NOT_EXIST_ERROR);
}
boolean truckOwnerFlag = Objects.equals(driverWallCode, truckWalletCode);
......@@ -2129,7 +2256,7 @@ public class OrderChildServiceImpl implements OrderChildService {
//判断余额是否能够缴纳保证金
if (data.getResidue() < deposit.longValue()) {
String remark = truckOwnerFlag ? "账户可用余额不足,接单保证金冻结失败,请尽快充值,本次需充值"+deposit.movePointLeft(2) +"元" : "车主钱包余额不足,保证金冻结失败请联系车主充值";
if(truckOwnerFlag){
if(isOwner){
throw new ServiceSystemException(PerformanceResultEnum.APP_POP_UP_OWNER_RESIDUE_ERROR, remark);
}else{
throw new ServiceSystemException(PerformanceResultEnum.APP_POP_UP_DRIVER_RESIDUE_ERROR, remark);
......@@ -2137,14 +2264,18 @@ public class OrderChildServiceImpl implements OrderChildService {
}
//有效银行卡数量 不能为空
if (Objects.isNull(data.getCardCount()) || data.getCardCount() <= 0) {
if (data.getCardCount() <= 0) {
String remark = truckOwnerFlag ? "还没有绑定银行卡,请先绑定银行卡" : "车主还没有绑定银行卡,请先绑定银行卡";
throw new ServiceSystemException(PerformanceResultEnum.APP_POP_UP_ERROR, remark);
if (isOwner) {
throw new ServiceSystemException(PerformanceResultEnum.APP_POP_UP_DRIVER_NO_BANKCARD_ERROR, remark);
} else {
throw new ServiceSystemException(PerformanceResultEnum.APP_POP_UP_OWNER_NO_BANKCARD_ERROR, remark);
}
}
//必须设置交易密码 是否设置交易密码0没有1有
if (Objects.isNull(data.getPwd()) || Objects.equals(data.getPwd(), "0")) {
String remark = truckOwnerFlag ? "还没有设置交易密码,请先设置交易密码" : "车主还没有设置交易密码,请先设置交易密码";
String remark = isOwner ? "还没有设置交易密码,请先设置交易密码" : "车主还没有设置交易密码,请先设置交易密码";
throw new ServiceSystemException(PerformanceResultEnum.APP_POP_UP_ERROR, remark);
}
} else {
......
......@@ -122,7 +122,7 @@ public class OrderGoodsServiceImpl implements OrderGoodsService, InitializingBea
@Autowired
private OrderGoodsFleetOpenTruckDao orderGoodsFleetOpenTruckDao;
@Autowired
OrderWeightService orderWeightService;
......@@ -170,6 +170,12 @@ public class OrderGoodsServiceImpl implements OrderGoodsService, InitializingBea
orderGoodsVO.setLoadBeginTime(orderInfoFeign.getLoadBeginTime());
orderGoodsVO.setLoadEndTime(orderInfoFeign.getLoadEndTime());
orderGoodsVO.setResidueTransportWeight(residueWeight);
//货源地信息
orderGoodsVO.setSendContact(orderInfoFeign.getSendContact());
orderGoodsVO.setSendContactPhone(orderInfoFeign.getSendContactPhone());
orderGoodsVO.setSendWaitSystem(orderInfoFeign.getSendWaitSystem());
orderGoodsVO.setSendWaitSystemName(orderInfoFeign.getSendWaitSystemName());
orderGoodsVO.setSendWaitMode(orderInfoFeign.getSendWaitMode());
//获取订单配置的违约金方案
OwnerQuotationDetailVO quotationDetailVO = quotationService.getQuotationByOrderNo(orderNo).orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
......@@ -184,7 +190,6 @@ public class OrderGoodsServiceImpl implements OrderGoodsService, InitializingBea
InvoicingCompanyEnum.TaxType.TAX_EXCLUDED.getCode())) {
orderGoodsVO.setGoodsOrderDetailShow(1);
}
return orderGoodsVO;
}
......
package com.clx.performance.service.impl;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.clx.open.sdk.callback.OpenCallBackClient;
import com.clx.open.sdk.callback.message.OrderInfoMessage;
import com.clx.open.sdk.callback.message.TransportExceptionReportMessage;
import com.clx.order.enums.SyncPlatformEnum;
import com.clx.order.feign.OrderFeign;
import com.clx.order.vo.feign.FeignAddressVO;
import com.clx.order.vo.feign.FeignOrderInfoVO;
import com.clx.order.vo.feign.FeignOrderVO;
import com.clx.order.vo.feign.SystemAddressVO;
import com.clx.performance.config.ThirdAppConfig;
import com.clx.performance.constant.BusinessConstants;
import com.clx.performance.dao.OrderChildDao;
import com.clx.performance.dao.OrderGoodsDao;
import com.clx.performance.dao.PerformanceProgressDao;
......@@ -35,7 +43,13 @@ import com.clx.performance.vo.pc.PerformanceProgressVO;
import com.google.common.base.Joiner;
import com.msl.common.base.Optional;
import com.msl.common.exception.ServiceSystemException;
import com.msl.common.result.Result;
import com.msl.common.utils.DateUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.util.*;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
......@@ -44,10 +58,6 @@ import org.apache.commons.lang.exception.ExceptionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.util.*;
/**
* @author kavin
......@@ -69,7 +79,8 @@ public class PerformanceProgressServiceImpl implements PerformanceProgressServi
private final OrderGoodsDao orderGoodsDao;
private final OrderChildDao orderChildDao;
private final OrderService orderService;
private final ThirdAppConfig thirdAppConfig;
private final OrderFeign orderFeign;
public static List<Integer> inProcessStatusList;
public static List<Integer> endStatusList ;
......@@ -129,7 +140,10 @@ public class PerformanceProgressServiceImpl implements PerformanceProgressServi
item.setSeniorLogisticsManagerName(Joiner.on(",")
.join(JSON.parseArray(item.getSeniorLogisticsManagerName())));
}
if(Objects.nonNull(item.getPendingWeight()) && Objects.nonNull(item.getOrderedWeight())){
if(Objects.nonNull(item.getPendingWeight())
&& item.getPendingWeight().compareTo(BigDecimal.ZERO) != 0
&& Objects.nonNull(item.getOrderedWeight())
&& item.getOrderedWeight().compareTo(BigDecimal.ZERO) != 0){
item.setOrderedRate(calcOrderedRate(item.getOrderedWeight(),item.getPendingWeight()));
}
if(Objects.nonNull(item.getTaskWeight()) && Objects.nonNull(item.getSumUnloadWeight())){
......@@ -267,11 +281,30 @@ public class PerformanceProgressServiceImpl implements PerformanceProgressServi
change = true;
}
if(!StringUtils.equals(item.getPerformanceAbnormalReason(),param.getPerformanceAbnormalReason())){
PerformanceProgressLog log = performanceProgressLogService.generateLog(item.getOrderNo(),
PerformanceProgressLog progressLog = performanceProgressLogService.generateLog(item.getOrderNo(),
PerformanceProgressEnum.LogType.PERFORMANCE_ABNORMAL_REASON,
param.getPerformanceAbnormalReason(),userNo,userName);
logs.add(log);
logs.add(progressLog);
change = true;
//上报履约异常
if (StringUtils.isNotBlank(param.getPerformanceAbnormalReason())) {
FeignOrderVO orderVO = orderFeign.getOrderInfoFeign(item.getOrderNo());
if (orderVO != null && Objects.equals(orderVO.getOrderSource(), SyncPlatformEnum.Source.NEW_OWNER_CLIENT.getCode())) {
OpenCallBackClient openCallBackClient = thirdAppConfig.getOpenCallBackClient(SyncPlatformEnum.Source.NEW_OWNER_CLIENT.getCode().toString());
TransportExceptionReportMessage message = new TransportExceptionReportMessage();
message.setOrderNo(item.getOrderNo());
message.setCreateName(progressLog.getCreateName());
message.setOperateContent(param.getPerformanceAbnormalReason());
message.setReportTime(LocalDateTime.now());
Result<?> result = openCallBackClient.encryptPost(JSONUtil.parse(message).toString(), message.topic());
if (result.succeed()) {
log.info("上报履约异常成功,响应信息:{}", JSONUtil.parse(result));
} else {
log.info("上报履约异常失败,响应信息:{}", JSONUtil.parse(result));
}
}
}
}
if(!StringUtils.equals(item.getDispatchFollow(),param.getDispatchFollow())){
PerformanceProgressLog log = performanceProgressLogService.generateLog(item.getOrderNo(),
......@@ -296,8 +329,8 @@ public class PerformanceProgressServiceImpl implements PerformanceProgressServi
}
@Override
public List<PerformanceProgressOperationLogVO> getOperationLog(String orderNo) {
List<PerformanceProgressLog> list = performanceProgressLogDao.getOperationLog(orderNo);
public List<PerformanceProgressOperationLogVO> getOperationLog(String orderNo,Integer operateType) {
List<PerformanceProgressLog> list = performanceProgressLogDao.getOperationLog(orderNo,operateType);
return performanceProgressLogStruct.convertList(list);
}
......@@ -494,6 +527,10 @@ public class PerformanceProgressServiceImpl implements PerformanceProgressServi
performanceProgressDao.updateEntityByKey(update);
}
@Override
public List<PerformanceProgressVO> queryPerformanceProgress(List<String> orderNoList) {
return performanceProgressStruct.convertList(performanceProgressDao.listInField(PerformanceProgress::getOrderNo, orderNoList));
}
// 计算接单率
public BigDecimal calcOrderedRate(BigDecimal orderedWeight,BigDecimal pendingWeight){
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论