Prechádzať zdrojové kódy

1.贸易订单列表、合同关联订单列表、对账关联订单列表增加待分配运输量字段
2.贸易订单导出字段调整
3.贸易订单价格和量相关的加上默认值0

yzc 2 rokov pred
rodič
commit
8df02fd593

+ 1 - 1
sckw-common/sckw-common-core/src/main/java/com/sckw/core/common/enums/enums/DictEnum.java

@@ -45,7 +45,7 @@ public enum DictEnum {
     DELIVERY_TYPE_0("delivery_type", "0", "签发交付"),
     DELIVERY_TYPE_1("delivery_type", "1", "签收交付"),
     TORDER_SOURCE_1("tOrder_source", "1", "采购下单"),
-    TORDER_SOURCE_2("tOrder_source", "2", "销售代客下单"),
+    TORDER_SOURCE_2("tOrder_source", "2", "代客下单"),
     TORDER_STATUS_0("tOrder_status", "0", "已保存"),
     TORDER_STATUS_1("tOrder_status", "1", "待受理"),
     TORDER_STATUS_2("tOrder_status", "2", "已退回"),

+ 25 - 0
sckw-modules/sckw-contract/src/main/resources/bootstrap-local.yml

@@ -0,0 +1,25 @@
+spring:
+  cloud:
+    nacos:
+      discovery:
+        # 服务注册地址
+        server-addr: 10.10.10.230:8848
+        # 命名空间
+        namespace: sckw-yzc
+        # 共享配置
+        group: sckw-service-platform
+      config:
+        # 配置中心地址
+        server-addr: 10.10.10.230:8848
+        # 配置文件格式
+        file-extension: yaml
+        # 命名空间
+        namespace: sckw-yzc
+        # 共享配置
+        group: sckw-service-platform
+        #可以读多个配置文件  需要在同一个命名空间下面可以是不同的组
+        extension-configs:
+          - dataId: sckw-common.yml
+            group: sckw-service-platform
+            refresh: true
+

+ 8 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/KwoTradeOrder.java

@@ -25,6 +25,14 @@ import java.time.LocalDate;
 @TableName("kwo_trade_order")
 public class KwoTradeOrder extends BaseModel implements Serializable {
 
+    public KwoTradeOrder(){
+        this.amount = new BigDecimal("0.00");
+        this.price = new BigDecimal("0.00");
+        this.entrustAmount = new BigDecimal("0.00");
+        this.actualAmount = new BigDecimal("0.00");
+        this.associateStatement = 0;
+    }
+
     @Serial
     private static final long serialVersionUID = -4156986025493740589L;
 

+ 4 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/req/GoodsInfo.java

@@ -20,6 +20,10 @@ import java.math.BigDecimal;
 @ToString
 @Accessors(chain = true)
 public class GoodsInfo {
+
+    public GoodsInfo(){
+        this.unitPrice = new BigDecimal("0.00");
+    }
     /**
      * 商品id
      */

+ 4 - 1
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/req/PurchaseOrderDraftParam.java

@@ -20,7 +20,10 @@ import java.util.List;
 @Setter
 @ToString
 public class PurchaseOrderDraftParam {
-
+    public PurchaseOrderDraftParam(){
+        this.amount = new BigDecimal("0.00");
+        this.price = new BigDecimal("0.00");
+    }
     /**
      * 商品信息
      */

+ 3 - 1
sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoTradeOrderService.java

@@ -139,7 +139,9 @@ public class KwoTradeOrderService {
             order.setGoodsId(goodsDetail.getId()).setUnit(goodsDetail.getUnit()).setUnitPrice(goods.getUnitPrice())
                     .setGoodsName(goodsDetail.getName()).setGoodsType(goodsDetail.getGoodsType()).setGoodsCode(goodsDetail.getCode())
                     .setGoodsTaxRate(goodsDetail.getTaxRate()).setGoodsSpec(goodsDetail.getSpec()).setGoodsThumb(goodsDetail.getThumb());
-            BeanUtils.copyProperties(goodsInfo, order);
+        }
+        if (Objects.isNull(order.getUnitPrice())){
+            order.setUnitPrice(new BigDecimal("0.00"));
         }
         //单位信息
         kwoTradeOrderUnitService.delByOrderId(id);

+ 40 - 16
sckw-modules/sckw-report/src/main/java/com/sckw/report/service/KwOrderService.java

@@ -12,7 +12,6 @@ import com.sckw.core.utils.StringUtils;
 import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.excel.utils.DateUtil;
 import com.sckw.mongo.model.SckwTradeOrder;
-import com.sckw.report.dao.SckwTradeOrderRepository;
 import com.sckw.report.service.param.*;
 import com.sckw.report.service.vo.OrderListRes;
 import com.sckw.report.service.vo.TradeOrderAppStatisticVO;
@@ -24,6 +23,7 @@ import org.springframework.data.mongodb.core.query.Criteria;
 import org.springframework.data.mongodb.core.query.Query;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.regex.Pattern;
@@ -39,8 +39,6 @@ import java.util.stream.Collectors;
 @AllArgsConstructor
 public class KwOrderService {
 
-    private final SckwTradeOrderRepository sckwOrderRepository;
-
     private final MongoTemplate mongoTemplate;
 
     /**
@@ -100,14 +98,28 @@ public class KwOrderService {
                     .setPickupTypeLabel(DictEnum.getLabel(DictTypeEnum.PICKUP_TYPE.getType(), e.getPickupType()))
                     .setLoadDetailAddressInfo(loadCityName + loadDetailAddress)
                     .setUnloadDetailAddressInfo(unloadCityName + unloadDetailAddress)
-                    .setConsignmentStatus(Objects.isNull(e.getEntrustAmount()) || Objects.isNull(e.getAmount())
-                            || e.getEntrustAmount().compareTo(e.getAmount()) < 0 ? "待托运" : "已托运")
+                    .setWaitEntrustAmount(getWaitEntrustAmount(e.getAmount(), e.getEntrustAmount()))
                     .setSource(DictEnum.getLabel(DictTypeEnum.TORDER_SOURCE.getType(), e.getSource()));
             result.add(order);
         });
         return PageResult.build(page, pageSize, count, result);
     }
 
+    /**
+     * @desc: 获取订单待分配运输量
+     * @author: yzc
+     * @date: 2023-08-25 10:32
+     * @Param amount:
+     * @Param entrustAmount:
+     * @return: java.math.BigDecimal
+     */
+    private BigDecimal getWaitEntrustAmount(BigDecimal amount, BigDecimal entrustAmount) {
+        if (Objects.isNull(amount) || Objects.isNull(entrustAmount)) {
+            return amount;
+        }
+        return amount.subtract(entrustAmount);
+    }
+
     /**
      * @desc: 组装query
      * @author: yzc
@@ -285,20 +297,28 @@ public class KwOrderService {
         List<TradeOrderListExport> list = new ArrayList<>();
         AtomicInteger i = new AtomicInteger(1);
         orders.forEach(e -> {
+            BigDecimal waitEntrustAmount = getWaitEntrustAmount(e.getAmount(), e.getEntrustAmount());
+            String loadCityName = Objects.isNull(e.getLoadCityName()) ? "" : e.getLoadCityName();
+            String loadDetailAddress = Objects.isNull(e.getLoadDetailAddress()) ? "" : e.getLoadDetailAddress();
+            String unloadCityName = Objects.isNull(e.getUnloadCityName()) ? "" : e.getUnloadCityName();
+            String unloadDetailAddress = Objects.isNull(e.getUnloadDetailAddress()) ? "" : e.getUnloadDetailAddress();
             TradeOrderListExport export = BeanUtils.copyProperties(e, TradeOrderListExport.class);
             export.setSerialNumber(String.valueOf(i.getAndIncrement()))
                     .setStatus(DictEnum.getLabel(DictTypeEnum.TORDER_STATUS.getType(), String.valueOf(e.getStatus())))
-                    .setTrading(DictEnum.getLabel(DictTypeEnum.TRADE_TYPE.getType(), e.getTrading()))
-                    .setDeliveryType(DictEnum.getLabel(DictTypeEnum.DELIVERY_TYPE.getType(), e.getDeliveryType()))
+                    .setUnitPrice(Objects.isNull(e.getUnitPrice()) ? "0.00" : String.valueOf(e.getUnitPrice()))
+                    .setAmount(Objects.isNull(e.getAmount()) ? "0.00" : String.valueOf(e.getAmount()))
+                    .setPrice(Objects.isNull(e.getPrice()) ? "0.00" : String.valueOf(e.getPrice()))
+                    .setEntrustAmount(Objects.isNull(e.getEntrustAmount()) ? "0.00" : String.valueOf(e.getEntrustAmount()))
+                    .setActualAmount(Objects.isNull(e.getActualAmount()) ? "0.00" : String.valueOf(e.getActualAmount()))
+                    .setWaitEntrustAmount(Objects.isNull(waitEntrustAmount) ? "0.00" : String.valueOf(waitEntrustAmount))
                     .setPickupType(DictEnum.getLabel(DictTypeEnum.PICKUP_TYPE.getType(), e.getPickupType()))
-                    .setConsignmentStatus(Objects.equals(e.getAmount(), e.getEntrustAmount()) ? "待托运" : "已托运")
+                    .setDeliveryType(DictEnum.getLabel(DictTypeEnum.DELIVERY_TYPE.getType(), e.getDeliveryType()))
                     .setSource(DictEnum.getLabel(DictTypeEnum.TORDER_SOURCE.getType(), e.getSource()))
-                    .setUnitPrice(String.valueOf(e.getUnitPrice())).setPrice(String.valueOf(e.getPrice()))
-                    .setAmount(String.valueOf(e.getAmount())).setActualAmount(String.valueOf(e.getActualAmount()))
-                    .setLoadDetailAddressInfo(e.getLoadCityName() + e.getUnloadDetailAddress())
-                    .setUnloadDetailAddressInfo(e.getUnloadCityName() + e.getUnloadDetailAddress())
-                    .setActualAmount(Objects.isNull(e.getActualAmount()) ? "0.00" : String.valueOf(e.getActualAmount()))
+                    .setTrading(DictEnum.getLabel(DictTypeEnum.TRADE_TYPE.getType(), e.getTrading()))
+                    .setLoadDetailAddressInfo(loadCityName + loadDetailAddress)
+                    .setUnloadDetailAddressInfo(unloadCityName + unloadDetailAddress)
                     .setStartTime(Objects.isNull(e.getStartTime()) ? null : DateUtil.dateToStr(e.getStartTime()))
+                    .setEndTime(Objects.isNull(e.getEndTime()) ? null : DateUtil.dateToStr(e.getEndTime()))
                     .setCreateTime(DateUtil.getDateTime(e.getCreateTime()));
             list.add(export);
         });
@@ -371,14 +391,18 @@ public class KwOrderService {
         List<SckwTradeOrder> list = mongoTemplate.find(query, SckwTradeOrder.class);
         List<OrderListRes> result = new ArrayList<>();
         list.forEach(e -> {
+            String loadCityName = Objects.isNull(e.getLoadCityName()) ? "" : e.getLoadCityName();
+            String loadDetailAddress = Objects.isNull(e.getLoadDetailAddress()) ? "" : e.getLoadDetailAddress();
+            String unloadCityName = Objects.isNull(e.getUnloadCityName()) ? "" : e.getUnloadCityName();
+            String unloadDetailAddress = Objects.isNull(e.getUnloadDetailAddress()) ? "" : e.getUnloadDetailAddress();
             OrderListRes order = BeanUtils.copyProperties(e, OrderListRes.class);
             order.setStatusLabel(DictEnum.getLabel(DictTypeEnum.TORDER_STATUS.getType(), String.valueOf(e.getStatus())))
                     .setTrading(DictEnum.getLabel(DictTypeEnum.TRADE_TYPE.getType(), e.getTrading()))
                     .setDeliveryType(DictEnum.getLabel(DictTypeEnum.DELIVERY_TYPE.getType(), e.getDeliveryType()))
                     .setPickupTypeLabel(DictEnum.getLabel(DictTypeEnum.PICKUP_TYPE.getType(), e.getPickupType()))
-                    .setLoadDetailAddressInfo(e.getLoadCityName() + e.getUnloadDetailAddress())
-                    .setUnloadDetailAddressInfo(e.getUnloadCityName() + e.getUnloadDetailAddress())
-                    .setConsignmentStatus(Objects.isNull(e.getEntrustAmount()) || e.getEntrustAmount().compareTo(e.getAmount()) < 0 ? "待托运" : "已托运")
+                    .setLoadDetailAddressInfo(loadCityName + loadDetailAddress)
+                    .setUnloadDetailAddressInfo(unloadCityName + unloadDetailAddress)
+                    .setWaitEntrustAmount(getWaitEntrustAmount(e.getAmount(), e.getActualAmount()))
                     .setSource(DictEnum.getLabel(DictTypeEnum.TORDER_SOURCE.getType(), e.getSource()));
             result.add(order);
         });

+ 33 - 30
sckw-modules/sckw-report/src/main/java/com/sckw/report/service/param/TradeOrderListExport.java

@@ -23,7 +23,7 @@ public class TradeOrderListExport implements Serializable {
     @ExcelProperty(value = "序号" )
     private String serialNumber;
 
-    @ExcelProperty(value = "上架状态" )
+    @ExcelProperty(value = "状态" )
     private String status;
 
     @ExcelProperty(value = "订单编号" )
@@ -35,27 +35,6 @@ public class TradeOrderListExport implements Serializable {
     @ExcelProperty(value = "销售单位")
     private String supplyFirmName;
 
-    @ExcelProperty(value = "提货方式" )
-    private String pickupType;
-
-    @ExcelProperty(value = "托运状态")
-    private String consignmentStatus;
-
-    @ExcelProperty(value = "交付类型" )
-    private String deliveryType;
-
-    @ExcelProperty(value = "下单方式" )
-    private String source;
-
-    @ExcelProperty(value = "支付方式")
-    private String trading;
-
-    @ExcelProperty(value = "关联合同")
-    private String contractNo;
-
-    @ExcelProperty(value = "签约方式")
-    private String contractSigningWay;
-
     @ExcelProperty(value = "商品名称")
     private String goodsName;
 
@@ -65,36 +44,60 @@ public class TradeOrderListExport implements Serializable {
     @ExcelProperty(value = "单价/元")
     private String unitPrice;
 
+    @ExcelProperty(value = "订单总量")
+    private String amount;
+
     @ExcelProperty(value = "订单金额")
     private String price;
 
-    @ExcelProperty(value = "订单总量")
-    private String amount;
+    @ExcelProperty(value = "已分配运输量")
+    private String entrustAmount;
 
     @ExcelProperty(value = "已履约量")
     private String actualAmount;
 
-    @ExcelProperty(value = "归属项目")
-    private String projectName;
+    @ExcelProperty(value = "待分配运输量")
+    private String waitEntrustAmount;
+
+    @ExcelProperty(value = "提货方式" )
+    private String pickupType;
+
+    @ExcelProperty(value = "交付类型" )
+    private String deliveryType;
+
+    @ExcelProperty(value = "下单方式" )
+    private String source;
+
+    @ExcelProperty(value = "支付方式")
+    private String trading;
 
     @ExcelProperty(value = "装货地址名称")
     private String loadName;
 
-    @ExcelProperty(value = "装货地址明细")
+    @ExcelProperty(value = "地址明细")
     private String loadDetailAddressInfo;
 
     @ExcelProperty(value = "卸货地址名称")
     private String unloadName;
 
-    @ExcelProperty(value = "卸货地址明细")
+    @ExcelProperty(value = "地址明细")
     private String unloadDetailAddressInfo;
 
-    @ExcelProperty(value = "计划开始时间")
+    @ExcelProperty(value = "计划开始日期")
     private String startTime;
 
-    @ExcelProperty(value = "计划结束时间")
+    @ExcelProperty(value = "计划结束日期")
     private String endTime;
 
+    @ExcelProperty(value = "关联合同")
+    private String contractNo;
+
+    @ExcelProperty(value = "签约方式")
+    private String contractSigningWay;
+
+    @ExcelProperty(value = "归属项目")
+    private String projectName;
+
     @ExcelProperty(value = "备注")
     private String remark;
 

+ 4 - 4
sckw-modules/sckw-report/src/main/java/com/sckw/report/service/vo/OrderListRes.java

@@ -74,10 +74,6 @@ public class OrderListRes {
      * 提货方式label
      */
     private String pickupTypeLabel;
-    /**
-     * 托运状态
-     */
-    private String consignmentStatus;
     /**
      * 下单方式(自主下单/代客下单)
      */
@@ -137,6 +133,10 @@ public class OrderListRes {
      * 已委托量
      */
     private BigDecimal entrustAmount;
+    /**
+     * 待委托量
+     */
+    private BigDecimal waitEntrustAmount;
     /**
      * 实际交付量
      */

+ 1 - 2
sckw-modules/sckw-report/src/main/resources/bootstrap.yml

@@ -5,9 +5,8 @@ spring:
   application:
     name: sckw-report
   profiles:
-#    active: @profiles.active@
+    active: @profiles.active@
 #    active: test
-    active: ${DEPLOY_MODE:dev}
   main:
     allow-bean-definition-overriding: true
     allow-circular-references: true