2 Komitmen 76a02fc6b7 ... b20092738c

Pembuat SHA1 Pesan Tanggal
  18782137998 b20092738c 关联关系完善 1 tahun lalu
  18782137998 3d633d8019 流程完成 1 tahun lalu
20 mengubah file dengan 452 tambahan dan 24 penghapusan
  1. 11 4
      src/main/java/com/sckw/freight/controller/LedgerController.java
  2. 126 0
      src/main/java/com/sckw/freight/entity/kll/KllOrderLogisticConfig.java
  3. 110 0
      src/main/java/com/sckw/freight/entity/saas/SaasLogisticCustomer.java
  4. 2 1
      src/main/java/com/sckw/freight/mapper/freight/KwpLedgerLogisticsMapper.java
  5. 19 0
      src/main/java/com/sckw/freight/mapper/kll/KllOrderLogisticConfigMapper.java
  6. 6 2
      src/main/java/com/sckw/freight/mapper/kll/KllOrderMapper.java
  7. 19 0
      src/main/java/com/sckw/freight/mapper/saas/SaasLogisticCustomerMapper.java
  8. 5 1
      src/main/java/com/sckw/freight/model/vo/request/RequestLedgerLogisticsPageInfo.java
  9. 11 0
      src/main/java/com/sckw/freight/model/vo/response/ResponseKllOrderTask.java
  10. 1 1
      src/main/java/com/sckw/freight/service/freight/IKwpLedgerLogisticsService.java
  11. 41 13
      src/main/java/com/sckw/freight/service/freight/impl/KwpLedgerLogisticsServiceImpl.java
  12. 16 0
      src/main/java/com/sckw/freight/service/kll/IKllOrderLogisticConfigService.java
  13. 20 0
      src/main/java/com/sckw/freight/service/kll/impl/KllOrderLogisticConfigServiceImpl.java
  14. 16 0
      src/main/java/com/sckw/freight/service/saas/ISaasLogisticCustomerService.java
  15. 20 0
      src/main/java/com/sckw/freight/service/saas/impl/SaasLogisticCustomerServiceImpl.java
  16. 4 0
      src/main/resources/application-pro.yml
  17. 4 2
      src/main/resources/com/sckw/freight/mapper/freight/KwpLedgerLogisticsMapper.xml
  18. 5 0
      src/main/resources/com/sckw/freight/mapper/kll/KllOrderLogisticConfigMapper.xml
  19. 11 0
      src/main/resources/com/sckw/freight/mapper/kll/KllOrderMapper.xml
  20. 5 0
      src/main/resources/com/sckw/freight/mapper/saas/SaasLogisticCustomerMapper.xml

+ 11 - 4
src/main/java/com/sckw/freight/controller/LedgerController.java

@@ -14,6 +14,7 @@ import io.swagger.v3.oas.annotations.Parameter;
 import io.swagger.v3.oas.annotations.Parameters;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -80,8 +81,12 @@ public class LedgerController {
     @Parameters(value = {
             @Parameter(name = "entId", description = "企业id")
     })
-    public R<ResponseLedgerLogisticsStatistics> queryLedgerLogisticsStatistics(@RequestParam(value = "entId", required = true) Long entId) {
-        return iKwpLedgerLogisticsService.queryLedgerLogisticsStatistics(entId);
+    public R<ResponseLedgerLogisticsStatistics> queryLedgerLogisticsStatistics(@RequestParam(value = "entId") String entId) {
+        //非数字则置空
+        if(!StringUtils.isNumeric(entId)){
+            entId=null;
+        }
+        return iKwpLedgerLogisticsService.queryLedgerLogisticsStatistics(entId );
     }
 
     /**
@@ -99,7 +104,9 @@ public class LedgerController {
     })
     public R<PayIndex> applyPayment(
             @RequestParam(value = "ledgerLogisticsId", required = true) Long ledgerLogisticsId,
-            @RequestParam(value = "entId", required = true) Long entId) {
-        return iKwpLedgerLogisticsService.applyPayment(ledgerLogisticsId, entId);
+            @RequestParam(value = "entId", required = true) String entId) {
+        if (StringUtils.isBlank(entId)|| !StringUtils.isNumeric(entId)) return R.failed("企业id不能为空");
+        Long dEntId = Long.valueOf(entId);
+        return iKwpLedgerLogisticsService.applyPayment(ledgerLogisticsId, dEntId);
     }
 }

+ 126 - 0
src/main/java/com/sckw/freight/entity/kll/KllOrderLogisticConfig.java

@@ -0,0 +1,126 @@
+package com.sckw.freight.entity.kll;
+
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 物流商订单选项配置表
+ * </p>
+ *
+ * @author xj
+ * @since 2025-01-16
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("kll_order_logistic_config")
+public class KllOrderLogisticConfig implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 物流商ID
+     */
+    private Integer logisticId;
+
+    /**
+     * 物流订单ID
+     */
+    private Integer orderId;
+
+    /**
+     * 预计里程(公里)
+     */
+    private BigDecimal expectedMileage;
+
+    /**
+     * 车辆类型要求
+     */
+    private String truckRequired;
+
+    /**
+     * 运输单价
+     */
+    private BigDecimal transFee;
+
+    /**
+     * 运输单价单位
+     */
+    private Integer transFeeUnit;
+
+    /**
+     * 是否开启路损约定0-否1-是
+     */
+    private Integer lostStatus;
+
+    /**
+     * 路损比例百分比
+     */
+    private BigDecimal lostPercent;
+
+    /**
+     * 路损比例计算单价
+     */
+    private BigDecimal lostPerPrice;
+
+    /**
+     * 是否开启装货电子围栏0-否1-是
+     */
+    private Integer loadFenceStatus;
+
+    /**
+     * 装货电子围栏半径
+     */
+    private Integer loadFenceRadius;
+
+    /**
+     * 是否开启上传装货重量0-否1-是
+     */
+    private Integer uploadLoadWeightStatus;
+
+    /**
+     * 是否开启上传装货磅单0-否1-是
+     */
+    private Integer uploadLoadPicStatus;
+
+    /**
+     * 是否开启卸货电子围栏0-否1-是
+     */
+    private Integer unloadFenceStatus;
+
+    /**
+     * 卸货电子围栏半径
+     */
+    private Integer unloadFenceRadius;
+
+    /**
+     * 是否开启上传卸货重量0-否1-是
+     */
+    private Integer uploadUnloadWeightStatus;
+
+    /**
+     * 是否开启上传卸货磅单0-否1-是
+     */
+    private Integer uploadUnloadPicStatus;
+
+    /**
+     * 记录时间
+     */
+    private LocalDateTime createTime;
+
+
+}

+ 110 - 0
src/main/java/com/sckw/freight/entity/saas/SaasLogisticCustomer.java

@@ -0,0 +1,110 @@
+package com.sckw.freight.entity.saas;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 物流贸易商客户信息
+ * </p>
+ *
+ * @author xj
+ * @since 2025-01-17
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("saas_logistic_customer")
+public class SaasLogisticCustomer implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 物流公司ID
+     */
+    private Integer logisticId;
+
+    /**
+     * 客户名称
+     */
+    private String name;
+
+    /**
+     * 社会统一信用代码
+     */
+    private String uscCode;
+
+    /**
+     * 联系地址
+     */
+    private String address;
+
+    /**
+     * 银行开户行
+     */
+    private String bankName;
+
+    /**
+     * 银行账户
+     */
+    private String bankAccount;
+
+    /**
+     * 联系人
+     */
+    private String contactName;
+
+    /**
+     * 联系人电话
+     */
+    private String contactMobile;
+
+    /**
+     * 创建人
+     */
+    private Long creatorId;
+
+    /**
+     * 营业执照
+     */
+    private String businessLicense;
+
+    /**
+     * 状态1-正常2-删除
+     */
+    private Integer status;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createdAt;
+
+    /**
+     * 更新时间
+     */
+    private LocalDateTime updatedAt;
+
+    /**
+     * 删除时间
+     */
+    private LocalDateTime deletedAt;
+
+    /**
+     * saas_company表id
+     */
+    private Integer companyId;
+
+
+}

+ 2 - 1
src/main/java/com/sckw/freight/mapper/freight/KwpLedgerLogisticsMapper.java

@@ -6,6 +6,7 @@ import com.sckw.freight.config.DataSourceNames;
 import com.sckw.freight.entity.freight.KwpLedgerLogistics;
 import com.sckw.freight.model.po.LedgerLogisticsAndBuySellInfo;
 import com.sckw.freight.model.po.LedgerLogisticsStatistics;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -19,6 +20,6 @@ import java.util.List;
  */
 @DS(DataSourceNames.FREIGHT)
 public interface KwpLedgerLogisticsMapper extends BaseMapper<KwpLedgerLogistics> {
-    List<LedgerLogisticsStatistics> queryLedgerLogisticsStatistics(Long entId);
+    List<LedgerLogisticsStatistics> queryLedgerLogisticsStatistics(@Param("entId") String entId);
     List<LedgerLogisticsAndBuySellInfo> queryLedgerLogisticsAndBuySellInfoNopaid();
 }

+ 19 - 0
src/main/java/com/sckw/freight/mapper/kll/KllOrderLogisticConfigMapper.java

@@ -0,0 +1,19 @@
+package com.sckw.freight.mapper.kll;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import com.sckw.freight.config.DataSourceNames;
+import com.sckw.freight.entity.kll.KllOrderLogisticConfig;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 物流商订单选项配置表 Mapper 接口
+ * </p>
+ *
+ * @author xj
+ * @since 2025-01-16
+ */
+@DS(DataSourceNames.KLL)
+public interface KllOrderLogisticConfigMapper extends BaseMapper<KllOrderLogisticConfig> {
+
+}

+ 6 - 2
src/main/java/com/sckw/freight/mapper/kll/KllOrderMapper.java

@@ -1,9 +1,13 @@
 package com.sckw.freight.mapper.kll;
 
 import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.sckw.freight.config.DataSourceNames;
 import com.sckw.freight.entity.kll.KllOrder;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.math.BigDecimal;
+import java.util.List;
 
 /**
  * <p>
@@ -15,5 +19,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 @DS(DataSourceNames.KLL)
 public interface KllOrderMapper extends BaseMapper<KllOrder> {
-
+    BigDecimal getOrderTotalPrice(@Param("orderIds") List<Long> orderIds, @Param("companyId")  Long companyId);
 }

+ 19 - 0
src/main/java/com/sckw/freight/mapper/saas/SaasLogisticCustomerMapper.java

@@ -0,0 +1,19 @@
+package com.sckw.freight.mapper.saas;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import com.sckw.freight.config.DataSourceNames;
+import com.sckw.freight.entity.saas.SaasLogisticCustomer;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 物流贸易商客户信息 Mapper 接口
+ * </p>
+ *
+ * @author xj
+ * @since 2025-01-17
+ */
+@DS(DataSourceNames.SAAS)
+public interface SaasLogisticCustomerMapper extends BaseMapper<SaasLogisticCustomer> {
+
+}

+ 5 - 1
src/main/java/com/sckw/freight/model/vo/request/RequestLedgerLogisticsPageInfo.java

@@ -48,5 +48,9 @@ public class RequestLedgerLogisticsPageInfo extends RequestPageInfo {
      * 企业id
      */
     @Schema(description = "企业id")
-    private Long entId;
+    private String entId;
+
+    public String getEntId() {
+        return entId;
+    }
 }

+ 11 - 0
src/main/java/com/sckw/freight/model/vo/response/ResponseKllOrderTask.java

@@ -34,6 +34,11 @@ public class ResponseKllOrderTask {
      */
     @Schema(description = "物流订单ID")
     private Integer orderId;
+    /**
+     * 所属订单
+     */
+    @Schema(description = "所属订单")
+    private String orderNo;
 
     /**
      * 物流公司ID
@@ -131,4 +136,10 @@ public class ResponseKllOrderTask {
      */
     @Schema(description = "卸货量")
     private BigDecimal secondWeight;
+
+    @Schema(description = "装货时间")
+    private String firstWeightTime;
+
+    @Schema(description = "卸货时间")
+    private String secondWeightTime;
 }

+ 1 - 1
src/main/java/com/sckw/freight/service/freight/IKwpLedgerLogisticsService.java

@@ -68,7 +68,7 @@ public interface IKwpLedgerLogisticsService extends IService<KwpLedgerLogistics>
      * @param: entId 企业id
      * @return: null
      **/
-    R<ResponseLedgerLogisticsStatistics> queryLedgerLogisticsStatistics(Long entId);
+    R<ResponseLedgerLogisticsStatistics> queryLedgerLogisticsStatistics(String entId);
 
 
     /**

+ 41 - 13
src/main/java/com/sckw/freight/service/freight/impl/KwpLedgerLogisticsServiceImpl.java

@@ -10,10 +10,13 @@ import com.sckw.freight.entity.freight.KwpSettlementLogistics;
 import com.sckw.freight.entity.kll.KllOrder;
 import com.sckw.freight.entity.kll.KllOrderTask;
 import com.sckw.freight.entity.saas.SaasCompany;
+import com.sckw.freight.entity.saas.SaasLogisticCustomer;
 import com.sckw.freight.mapper.freight.KwpLedgerLogisticsMapper;
 import com.sckw.freight.mapper.freight.KwpSettlementLogisticsMapper;
+import com.sckw.freight.mapper.kll.KllOrderMapper;
 import com.sckw.freight.mapper.kll.KllOrderTaskMapper;
 import com.sckw.freight.mapper.saas.SaasCompanyMapper;
+import com.sckw.freight.mapper.saas.SaasLogisticCustomerMapper;
 import com.sckw.freight.model.dto.PayIndex;
 import com.sckw.freight.model.enums.*;
 import com.sckw.freight.model.po.LedgerLogisticsStatistics;
@@ -76,6 +79,10 @@ public class KwpLedgerLogisticsServiceImpl extends ServiceImpl<KwpLedgerLogistic
     //@Lazy
     @Autowired
     IKwpSettlementLogisticsService iKwpSettlementLogisticsService;
+    @Autowired
+    KllOrderMapper kllOrderMapper;
+    @Autowired
+    SaasLogisticCustomerMapper saasLogisticCustomerMapper;
 
     /**
      * @description: 物流对账统计信息
@@ -85,7 +92,7 @@ public class KwpLedgerLogisticsServiceImpl extends ServiceImpl<KwpLedgerLogistic
      * @return: null
      **/
     @Override
-    public R<ResponseLedgerLogisticsStatistics> queryLedgerLogisticsStatistics(Long entId) {
+    public R<ResponseLedgerLogisticsStatistics> queryLedgerLogisticsStatistics(String entId) {
 
         List<LedgerLogisticsStatistics> statistics = kwpLedgerLogisticsMapper.queryLedgerLogisticsStatistics(entId);
         if (statistics == null) {
@@ -176,16 +183,17 @@ public class KwpLedgerLogisticsServiceImpl extends ServiceImpl<KwpLedgerLogistic
         wrapper1.in(KwpLedgerLogisticsOrder::getLLedgerId, records.stream().map(KwpLedgerLogistics::getId).collect(Collectors.toList()));
         List<KwpLedgerLogisticsOrder> orders = iKwpLedgerLogisticsOrderService.list(wrapper1);
         if (orders == null) orders = new ArrayList<>();
-        if (orders.size() == 0) return R.failed("物流对账单[ledgerLogisticsId=" + ledgerLogisticsId + "]下没有运单");
+        if (orders.isEmpty()) return R.failed("物流对账单[ledgerLogisticsId=" + ledgerLogisticsId + "]下没有运单");
 
         //查询运单
         LambdaQueryWrapper<KllOrderTask> wrapperOrderTask = new LambdaQueryWrapper<>();
         wrapperOrderTask.in(KllOrderTask::getOrderId, orders.stream().map(order -> {
-            return order.getId().intValue();
+            return order.getLOrderId().intValue();
         }).collect(Collectors.toList()));
 
         List<KllOrderTask> tasks = kllOrderTaskMapper.selectList(wrapperOrderTask);
         //组装数据
+        List<KwpLedgerLogisticsOrder> finalOrders = orders;
         List<ResponseKllOrderTask> responseKllOrderTasks = tasks.stream().map(task -> {
             ResponseKllOrderTask orderTask = new ResponseKllOrderTask();
             orderTask.setId(task.getId().toString());
@@ -198,6 +206,10 @@ public class KwpLedgerLogisticsServiceImpl extends ServiceImpl<KwpLedgerLogistic
             orderTask.setDriverPhone(task.getDriverPhone());
             orderTask.setFirstWeight(task.getFirstWeight());
             orderTask.setSecondWeight(task.getSecondWeight());
+
+            orderTask.setFirstWeightTime(DateTimeUtil.format(task.getFirstWeightTime(), "yyyy-MM-dd HH:mm:ss"));// task.getFirstWeightTime());
+            orderTask.setSecondWeightTime(DateTimeUtil.format(task.getSecondWeightTime(), "yyyy-MM-dd HH:mm:ss"));
+            orderTask.setOrderNo(finalOrders.stream().filter(order -> order.getLOrderId().intValue() == task.getOrderId().intValue()).toList().get(0).getLOrderNo());//  task.getOrderNo());
             return orderTask;
         }).collect(Collectors.toList());
 
@@ -238,8 +250,10 @@ public class KwpLedgerLogisticsServiceImpl extends ServiceImpl<KwpLedgerLogistic
             wrapper.ge(KwpLedgerLogistics::getUpdateTime, requestPageInfo.getUpdateTime()[0]);
             wrapper.le(KwpLedgerLogistics::getUpdateTime, requestPageInfo.getUpdateTime()[1]);
         }
+        if (requestPageInfo.getEntId() != null) {
+            wrapper.eq(KwpLedgerLogistics::getEntId, requestPageInfo.getEntId());
+        }
         wrapper.eq(KwpLedgerLogistics::getDelFlag, 0);
-        wrapper.eq(KwpLedgerLogistics::getEntId, requestPageInfo.getEntId());
         wrapper.orderByDesc(KwpLedgerLogistics::getCreateTime);
 
         // 创建分页对象
@@ -261,7 +275,7 @@ public class KwpLedgerLogisticsServiceImpl extends ServiceImpl<KwpLedgerLogistic
             responseLedgerLogistics.setTotalPrice(item.getTotalPrice());
             responseLedgerLogistics.setRemark(item.getRemark());
             responseLedgerLogistics.setActualPrice(item.getActualPrice());
-            responseLedgerLogistics.setPayRatio(item.getActualPrice().divide(item.getTotalPrice(), 2).toString() + "%");
+            responseLedgerLogistics.setPayRatio((item.getTotalPrice().compareTo(BigDecimal.ZERO) == 0 ? "100" : item.getActualPrice().divide(item.getTotalPrice(), 2).toString()) + "%");
             responseLedgerLogistics.setCreateTime(DateTimeUtil.format(item.getCreateTime(), "YYYY-MM-dd HH:mm:ss"));
             responseLedgerLogistics.setUpdateTime(DateTimeUtil.format(item.getUpdateTime(), "YYYY-MM-dd HH:mm:ss"));
             responseLedgerLogistics.setStatus(item.getStatus());
@@ -341,30 +355,40 @@ public class KwpLedgerLogisticsServiceImpl extends ServiceImpl<KwpLedgerLogistic
         //验证对应的订单是否在该企业下 ,且状态是完结
         LambdaQueryWrapper<KllOrder> wrapper = new LambdaQueryWrapper<>();
         wrapper.in(KllOrder::getId, requestSaveLedgerSettlementInfo.getOrderIds());
-        //wrapper.eq(KllOrder::getCompanyId, requestSaveLedgerSettlementInfo.getEntId());
-        wrapper.eq(KllOrder::getExecutionStatus, KllOrderExecutionStatusEnum.Finished.getCode());
+        wrapper.eq(KllOrder::getCompanyId, requestSaveLedgerSettlementInfo.getEntId());
+//        List<Integer> statuList=new ArrayList<>();
+//        statuList.add(KllOrderStatusEnum.Finished.getCode());
+//        statuList.add(KllOrderStatusEnum.Pending.getCode());
+        wrapper.in(KllOrder::getExecutionStatus, 1);
+        wrapper.in(KllOrder::getStatus, 1);
         wrapper.eq(KllOrder::getLedgerStatus, KllOrderLedgerStatusEnum.NoLedger.getCode());
         List<KllOrder> list = iKllOrderService.list(wrapper);
 
 
+        //运单总额 = sum(单价*二次称重)
+        BigDecimal totalPrice = kllOrderMapper.getOrderTotalPrice(requestSaveLedgerSettlementInfo.getOrderIds(), requestSaveLedgerSettlementInfo.getEntId());
+
+
         if (list == null || list.isEmpty()) {
             throw new RuntimeException("物流订单不存在或状态为已对账。");
         }
         if (list.size() != requestSaveLedgerSettlementInfo.getOrderIds().size()) {
             throw new RuntimeException("保存对账单的物流订单数量和参数数量不一致,请检查物流单所属企业和状态。");
         }
+        //不能同时对个客户企业对账
         Map<Integer, List<KllOrder>> ageGroup = list.stream()
-                .collect(Collectors.groupingBy(KllOrder::getCompanyId));
+                .collect(Collectors.groupingBy(KllOrder::getCustomerId));
         if (ageGroup.size() != 1) {
-            throw new RuntimeException("保存对账单的物流订单企业id不一致,请检查物流单所属企业。");
+            throw new RuntimeException("保存对账单的物流订单客户id不一致,请检查物流单所属客户企业。");
         }
         //扣减金额不能大于 总金额
-        if (requestSaveLedgerSettlementInfo.getDeductPrice().compareTo(list.stream().map(KllOrder::getTotalPrice).reduce(BigDecimal.ZERO, BigDecimal::add)) > 0) {
+        if (requestSaveLedgerSettlementInfo.getDeductPrice().compareTo(totalPrice) > 0) {
             throw new RuntimeException("保存对账单的物流订单扣减金额不能大于 总金额");
         }
         return list;
     }
 
+
     /**
      * 保存对账单
      *
@@ -379,8 +403,9 @@ public class KwpLedgerLogisticsServiceImpl extends ServiceImpl<KwpLedgerLogistic
         kwpLedgerLogistics.setEntId(requestSaveLedgerSettlementInfo.getEntId());
         kwpLedgerLogistics.setDeductPrice(requestSaveLedgerSettlementInfo.getDeductPrice());
         kwpLedgerLogistics.setOrderCount(orderList.size());
-        //运单总额 = 总应收
-        kwpLedgerLogistics.setTotalPrice(orderList.stream().map(KllOrder::getTotalPrice).reduce(BigDecimal.ZERO, BigDecimal::add));
+        BigDecimal totalPrice = kllOrderMapper.getOrderTotalPrice(requestSaveLedgerSettlementInfo.getOrderIds(), requestSaveLedgerSettlementInfo.getEntId());
+
+        kwpLedgerLogistics.setTotalPrice(totalPrice);
         //不含税金额 = 总应收
         kwpLedgerLogistics.setExTaxPrice(kwpLedgerLogistics.getTotalPrice());
         //账单结算金额 = 总应收 - 款金额
@@ -397,7 +422,10 @@ public class KwpLedgerLogisticsServiceImpl extends ServiceImpl<KwpLedgerLogistic
         kwpLedgerLogistics.setUpdateTime(LocalDateTime.now());
         kwpLedgerLogistics.setDelFlag(DelFlagEnum.NotDelete.getCode());
         kwpLedgerLogistics.setId(SnowflakeIdUtil.getInstance().nextId());
-        kwpLedgerLogistics.setCompanyId(Long.valueOf(orderList.get(0).getCompanyId()));
+        //客户企业id 从saas 的关系里面找
+        SaasLogisticCustomer customer = saasLogisticCustomerMapper.selectById(orderList.get(0).getCustomerId());
+
+        kwpLedgerLogistics.setCompanyId(Long.valueOf(customer.getCompanyId()));
         boolean isSave = this.save(kwpLedgerLogistics);
         if (isSave) return kwpLedgerLogistics;
         throw new RuntimeException("保存对账单失败");

+ 16 - 0
src/main/java/com/sckw/freight/service/kll/IKllOrderLogisticConfigService.java

@@ -0,0 +1,16 @@
+package com.sckw.freight.service.kll;
+
+import com.sckw.freight.entity.kll.KllOrderLogisticConfig;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 物流商订单选项配置表 服务类
+ * </p>
+ *
+ * @author xj
+ * @since 2025-01-16
+ */
+public interface IKllOrderLogisticConfigService extends IService<KllOrderLogisticConfig> {
+
+}

+ 20 - 0
src/main/java/com/sckw/freight/service/kll/impl/KllOrderLogisticConfigServiceImpl.java

@@ -0,0 +1,20 @@
+package com.sckw.freight.service.kll.impl;
+
+import com.sckw.freight.entity.kll.KllOrderLogisticConfig;
+import com.sckw.freight.mapper.kll.KllOrderLogisticConfigMapper;
+import com.sckw.freight.service.kll.IKllOrderLogisticConfigService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 物流商订单选项配置表 服务实现类
+ * </p>
+ *
+ * @author xj
+ * @since 2025-01-16
+ */
+@Service
+public class KllOrderLogisticConfigServiceImpl extends ServiceImpl<KllOrderLogisticConfigMapper, KllOrderLogisticConfig> implements IKllOrderLogisticConfigService {
+
+}

+ 16 - 0
src/main/java/com/sckw/freight/service/saas/ISaasLogisticCustomerService.java

@@ -0,0 +1,16 @@
+package com.sckw.freight.service.saas;
+
+import com.sckw.freight.entity.saas.SaasLogisticCustomer;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 物流贸易商客户信息 服务类
+ * </p>
+ *
+ * @author xj
+ * @since 2025-01-17
+ */
+public interface ISaasLogisticCustomerService extends IService<SaasLogisticCustomer> {
+
+}

+ 20 - 0
src/main/java/com/sckw/freight/service/saas/impl/SaasLogisticCustomerServiceImpl.java

@@ -0,0 +1,20 @@
+package com.sckw.freight.service.saas.impl;
+
+import com.sckw.freight.entity.saas.SaasLogisticCustomer;
+import com.sckw.freight.mapper.saas.SaasLogisticCustomerMapper;
+import com.sckw.freight.service.saas.ISaasLogisticCustomerService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 物流贸易商客户信息 服务实现类
+ * </p>
+ *
+ * @author xj
+ * @since 2025-01-17
+ */
+@Service
+public class SaasLogisticCustomerServiceImpl extends ServiceImpl<SaasLogisticCustomerMapper, SaasLogisticCustomer> implements ISaasLogisticCustomerService {
+
+}

+ 4 - 0
src/main/resources/application-pro.yml

@@ -50,6 +50,10 @@ mybatis-plus:
     log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
 
 
+# knife4j的增强配置,不需要增强可以不配
+knife4j:
+  enable: true
+
 # 支付中心 地址
 payCenter:
   address: http://payment.shyj.sckaiwu.cn/orsimj

+ 4 - 2
src/main/resources/com/sckw/freight/mapper/freight/KwpLedgerLogisticsMapper.xml

@@ -4,9 +4,11 @@
 
     <select id="queryLedgerLogisticsStatistics"
             resultType="com.sckw.freight.model.po.LedgerLogisticsStatistics"
-            parameterType="java.lang.Long">
+            parameterType="java.lang.String">
         SELECT t.`status`,count(*) count FROM `kwp_ledger_logistics` t
-        where t.ent_id=#{entId}
+             <if test="entId != null and entId != '' ">
+                 where t.ent_id=${entId}
+             </if>
         GROUP BY t.`status`
     </select>
     <select id="queryLedgerLogisticsAndBuySellInfoNopaid"

+ 5 - 0
src/main/resources/com/sckw/freight/mapper/kll/KllOrderLogisticConfigMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.sckw.freight.mapper.kll.KllOrderLogisticConfigMapper">
+
+</mapper>

+ 11 - 0
src/main/resources/com/sckw/freight/mapper/kll/KllOrderMapper.xml

@@ -2,4 +2,15 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.sckw.freight.mapper.kll.KllOrderMapper">
 
+    <select id="getOrderTotalPrice" resultType="java.math.BigDecimal">
+        select  sum(t.second_weight*oc.trans_fee)  from  kll_order_task t
+        left join  kll_order o on o.id = t.order_id
+        left join kll_order_logistic_config oc on  oc.order_id=o.id
+        where  o.id in
+        <foreach collection="orderIds" item="orderId" open="(" separator="," close=")">
+            #{orderId}
+        </foreach>
+         and o.ledger_status=0 and o.`status`=1 and o.execution_status=1 and t.state=1 and o.company_id=#{companyId}
+
+    </select>
 </mapper>

+ 5 - 0
src/main/resources/com/sckw/freight/mapper/saas/SaasLogisticCustomerMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.sckw.freight.mapper.saas.SaasLogisticCustomerMapper">
+
+</mapper>