|
|
@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.sckw.core.exception.BusinessException;
|
|
|
+import com.sckw.core.model.constant.NumberConstant;
|
|
|
import com.sckw.core.utils.CollectionUtils;
|
|
|
import com.sckw.core.utils.StringUtils;
|
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
|
@@ -30,7 +31,10 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
-import java.util.*;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
+import java.util.Set;
|
|
|
|
|
|
/**
|
|
|
* @desc: 订单dubbo实现
|
|
|
@@ -144,7 +148,7 @@ public class TradeOrderInfoServiceImpl implements TradeOrderInfoService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public HttpResult createOrCancelLogisticsOrderV1(Long updateBy,String updateByName,Long tOrderId, List<GoodsLoadingParam> loading) {
|
|
|
+ public HttpResult createOrCancelLogisticsOrderV1(Long updateBy, String updateByName, Long tOrderId, List<GoodsLoadingParam> loading) {
|
|
|
/*1、数据校验*/
|
|
|
// Long updateBy = LoginUserHolder.getUserId();
|
|
|
// String updateByName = LoginUserHolder.getUserName();
|
|
|
@@ -154,7 +158,7 @@ public class TradeOrderInfoServiceImpl implements TradeOrderInfoService {
|
|
|
if (CollectionUtils.isEmpty(loading)) {
|
|
|
return HttpResult.error("任务量不能为空!");
|
|
|
}
|
|
|
- for (GoodsLoadingParam goodsLoading:loading) {
|
|
|
+ for (GoodsLoadingParam goodsLoading : loading) {
|
|
|
if (StringUtils.isBlank(goodsLoading.getUnit()) || goodsLoading.getAmount() == null) {
|
|
|
return HttpResult.error("任务量不能为空!");
|
|
|
}
|
|
|
@@ -175,10 +179,10 @@ public class TradeOrderInfoServiceImpl implements TradeOrderInfoService {
|
|
|
}
|
|
|
|
|
|
//更新贸易订单/商品辅助单位
|
|
|
- for (GoodsLoadingParam goodsLoading:loading) {
|
|
|
+ for (GoodsLoadingParam goodsLoading : loading) {
|
|
|
//差值
|
|
|
BigDecimal differenceAmount = goodsLoading.getLoadAmount().subtract(goodsLoading.getAmount());
|
|
|
- BigDecimal totalEntrustAmount = Objects.isNull(order.getEntrustAmount()) ? differenceAmount : differenceAmount.add(order.getEntrustAmount());
|
|
|
+ BigDecimal totalEntrustAmount = NumberConstant.ZERO_TWO.compareTo(order.getEntrustAmount()) == 0 ? differenceAmount.abs() : differenceAmount.add(order.getEntrustAmount());
|
|
|
if (goodsLoading.getUnit().equals(order.getUnit())) {
|
|
|
order.setEntrustAmount(totalEntrustAmount).setUpdateBy(updateBy);
|
|
|
kwoTradeOrderService.updateById(order);
|
|
|
@@ -252,7 +256,7 @@ public class TradeOrderInfoServiceImpl implements TradeOrderInfoService {
|
|
|
if (CollectionUtils.isEmpty(loading)) {
|
|
|
return HttpResult.error("任务量不能为空!");
|
|
|
}
|
|
|
- for (GoodsLoadingV1Param goodsLoading:loading) {
|
|
|
+ for (GoodsLoadingV1Param goodsLoading : loading) {
|
|
|
if (StringUtils.isBlank(goodsLoading.getUnit())
|
|
|
|| goodsLoading.getActualLoadAmount() == null
|
|
|
|| goodsLoading.getActualUnloadAmount() == null) {
|
|
|
@@ -274,7 +278,7 @@ public class TradeOrderInfoServiceImpl implements TradeOrderInfoService {
|
|
|
}
|
|
|
try {
|
|
|
//更新贸易订单/商品辅助单位
|
|
|
- for (GoodsLoadingV1Param goodsLoading:loading) {
|
|
|
+ for (GoodsLoadingV1Param goodsLoading : loading) {
|
|
|
BigDecimal actualLoadAmount = goodsLoading.getActualLoadAmount();
|
|
|
BigDecimal actualUnloadAmount = goodsLoading.getActualUnloadAmount();
|
|
|
|