|
|
@@ -30,7 +30,6 @@ import com.sckw.freight.util.SnowflakeIdUtil;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.time.LocalDateTime;
|
|
|
@@ -271,7 +270,7 @@ public class KwpLedgerLogisticsServiceImpl extends ServiceImpl<KwpLedgerLogistic
|
|
|
* @since 2025-01-09
|
|
|
*/
|
|
|
@Override
|
|
|
- @Transactional
|
|
|
+ //@Transactional
|
|
|
public R<String> saveLedgerLogistics(RequestSaveLedgerLogisticsInfo requestSaveLedgerSettlementInfo) {
|
|
|
/**
|
|
|
* 1:数据验证
|
|
|
@@ -306,7 +305,7 @@ public class KwpLedgerLogisticsServiceImpl extends ServiceImpl<KwpLedgerLogistic
|
|
|
if (requestSaveLedgerSettlementInfo == null) {
|
|
|
throw new RuntimeException("对账单参数为空");
|
|
|
}
|
|
|
- if (requestSaveLedgerSettlementInfo.getOrderIds() == null || requestSaveLedgerSettlementInfo.getOrderIds().size() == 0) {
|
|
|
+ if (requestSaveLedgerSettlementInfo.getOrderIds() == null || requestSaveLedgerSettlementInfo.getOrderIds().isEmpty()) {
|
|
|
throw new RuntimeException("对账单的订单为空");
|
|
|
}
|
|
|
if (requestSaveLedgerSettlementInfo.getEntId() == null) {
|
|
|
@@ -329,13 +328,11 @@ public class KwpLedgerLogisticsServiceImpl extends ServiceImpl<KwpLedgerLogistic
|
|
|
wrapper.eq(KllOrder::getExecutionStatus, KllOrderExecutionStatusEnum.Finished.getCode());
|
|
|
wrapper.eq(KllOrder::getLedgerStatus, KllOrderLedgerStatusEnum.NoLedger.getCode());
|
|
|
List<KllOrder> list = iKllOrderService.list(wrapper);
|
|
|
- if (list == null || list.size() == 0 || list.size() != requestSaveLedgerSettlementInfo.getOrderIds().size()) {
|
|
|
- if (list.size() == 0) {
|
|
|
- throw new RuntimeException("保存对账单的物流订单不存在,请检查物流单状态。");
|
|
|
- }
|
|
|
- if (list.size() != requestSaveLedgerSettlementInfo.getOrderIds().size()) {
|
|
|
- throw new RuntimeException("保存对账单的物流订单数量和参数数量不一致,请检查物流单所属企业和状态。");
|
|
|
- }
|
|
|
+ if (list == null || list.isEmpty()) {
|
|
|
+ throw new RuntimeException("保存对账单的物流订单不存在,请检查物流单状态。");
|
|
|
+ }
|
|
|
+ if (list.size() != requestSaveLedgerSettlementInfo.getOrderIds().size()) {
|
|
|
+ throw new RuntimeException("保存对账单的物流订单数量和参数数量不一致,请检查物流单所属企业和状态。");
|
|
|
}
|
|
|
//扣减金额不能大于 总金额
|
|
|
if (requestSaveLedgerSettlementInfo.getDeductPrice().compareTo(list.stream().map(KllOrder::getTotalPrice).reduce(BigDecimal.ZERO, BigDecimal::add)) > 0) {
|