Pārlūkot izejas kodu

付款记录添加、查询

18782137998 1 gadu atpakaļ
vecāks
revīzija
8955242563
21 mainītis faili ar 630 papildinājumiem un 39 dzēšanām
  1. 18 0
      pom.xml
  2. 74 0
      src/main/java/com/sckw/freight/config/JacksonConfig.java
  3. 5 6
      src/main/java/com/sckw/freight/controller/LedgerController.java
  4. 73 0
      src/main/java/com/sckw/freight/controller/SettlementLogisticsController.java
  5. 6 5
      src/main/java/com/sckw/freight/entity/freight/KwpLedgerLogistics.java
  6. 3 3
      src/main/java/com/sckw/freight/model/enums/KwpLedgerLogisticsStatusEnum.java
  7. 40 0
      src/main/java/com/sckw/freight/model/enums/SettlementLogisticsStatusEnum.java
  8. 9 0
      src/main/java/com/sckw/freight/model/vo/request/RequestLedgerLogisticsPageInfo.java
  9. 7 1
      src/main/java/com/sckw/freight/model/vo/request/RequestPageInfo.java
  10. 9 0
      src/main/java/com/sckw/freight/model/vo/request/RequestSaveLedgerLogisticsInfo.java
  11. 27 0
      src/main/java/com/sckw/freight/model/vo/request/RequestSettlementLogisticsPageInfo.java
  12. 18 5
      src/main/java/com/sckw/freight/model/vo/response/ResponseKllOrderTask.java
  13. 14 4
      src/main/java/com/sckw/freight/model/vo/response/ResponseLedgerLogistics.java
  14. 8 1
      src/main/java/com/sckw/freight/model/vo/response/ResponsePageData.java
  15. 74 0
      src/main/java/com/sckw/freight/model/vo/response/ResponseSettlementLogistics.java
  16. 15 2
      src/main/java/com/sckw/freight/service/freight/IKwpLedgerLogisticsService.java
  17. 10 2
      src/main/java/com/sckw/freight/service/freight/IKwpSettlementLogisticsService.java
  18. 58 7
      src/main/java/com/sckw/freight/service/freight/impl/KwpLedgerLogisticsServiceImpl.java
  19. 153 1
      src/main/java/com/sckw/freight/service/freight/impl/KwpSettlementLogisticsServiceImpl.java
  20. 4 0
      src/main/java/com/sckw/freight/util/R.java
  21. 5 2
      src/main/resources/application-dev.yml

+ 18 - 0
pom.xml

@@ -143,6 +143,24 @@
             <artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
             <version>4.4.0</version>
         </dependency>
+        <!-- https://mvnrepository.com/artifact/io.swagger.core.v3/swagger-annotations -->
+<!--        <dependency>-->
+<!--            <groupId>io.swagger.core.v3</groupId>-->
+<!--            <artifactId>swagger-annotations</artifactId>-->
+<!--            <version>2.2.19</version>-->
+<!--        </dependency>-->
+
+        <!-- https://mvnrepository.com/artifact/io.swagger/swagger-annotations -->
+        <dependency>
+            <groupId>io.swagger</groupId>
+            <artifactId>swagger-annotations</artifactId>
+            <version>1.6.14</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.fasterxml.jackson.datatype</groupId>
+            <artifactId>jackson-datatype-jsr310</artifactId>
+        </dependency>
     </dependencies>
 
 

+ 74 - 0
src/main/java/com/sckw/freight/config/JacksonConfig.java

@@ -0,0 +1,74 @@
+package com.sckw.freight.config;
+
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
+import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
+import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer;
+import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
+import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
+import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.format.DateTimeFormatter;
+
+/**
+ * @BelongsProject: Freight-Settlement-Backend
+ * @BelongsPackage: com.sckw.freight.config
+ * @Author: xj
+ * @CreateTime: 2025-01-12  14:01
+ * @Description: 日期格式处理
+ * @Version: 1.0
+ */
+@Configuration
+public class JacksonConfig {
+    @Bean
+    public ObjectMapper getObjectMapper() {
+
+        ObjectMapper om = new ObjectMapper();
+        om.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
+        om.disable(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE);
+
+        JavaTimeModule javaTimeModule = new JavaTimeModule();
+
+        //日期序列化
+        javaTimeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+        javaTimeModule.addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
+        javaTimeModule.addSerializer(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
+
+        //日期反序列化
+        javaTimeModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+        javaTimeModule.addDeserializer(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
+        javaTimeModule.addDeserializer(LocalTime.class, new LocalTimeDeserializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
+
+        om.registerModule(javaTimeModule);
+        return om;
+    }
+
+
+//    private static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
+//
+//    @Bean
+//    public ObjectMapper objectMapper(Jackson2ObjectMapperBuilder builder) {
+//        ObjectMapper objectMapper = builder.createXmlMapper(false).build();
+//
+//        // 注册Java 8日期时间模块
+//        JavaTimeModule javaTimeModule = new JavaTimeModule();
+//        javaTimeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(DATE_TIME_FORMAT)));
+//        javaTimeModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern(DATE_TIME_FORMAT)));
+//
+//        objectMapper.registerModule(javaTimeModule);
+//
+//        // 设置日期时间序列化时的格式
+//        objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
+//
+//        return objectMapper;
+//    }
+}

+ 5 - 6
src/main/java/com/sckw/freight/controller/LedgerController.java

@@ -11,7 +11,6 @@ import com.sckw.freight.service.freight.IKwpLedgerLogisticsService;
 import com.sckw.freight.util.R;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
-import lombok.Getter;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -35,12 +34,12 @@ public class LedgerController {
     IKwpLedgerLogisticsService iKwpLedgerLogisticsService;
 
     /**
-     * 保存对账结算 并发起支付
+     * 保存对账结算
      *
      * @return
      */
     @PostMapping("/add")
-    @Operation(summary = "保存对账物流单并发起支付")
+    @Operation(summary = "新建物流对账单")
     public R<String> add(@RequestBody RequestSaveLedgerLogisticsInfo requestSaveLedgerSettlementInfo) {
         return iKwpLedgerLogisticsService.saveLedgerLogistics(requestSaveLedgerSettlementInfo);
     }
@@ -63,9 +62,9 @@ public class LedgerController {
      */
     @GetMapping("/queryOrderTaskListByLedgerLogisticsId")
     @Operation(summary = "根据对账单id查询运单列表信息")
-    @DynamicResponseParameters(name = "queryOrderTaskListByLedgerLogisticsId",properties = {
-            @DynamicParameter(name = "ledgerLogisticsId",value = "对账单id"),
-            @DynamicParameter(name = "entId",value = "企业id"),
+    @DynamicResponseParameters(name = "queryOrderTaskListByLedgerLogisticsId", properties = {
+            @DynamicParameter(name = "ledgerLogisticsId", value = "对账单id"),
+            @DynamicParameter(name = "entId", value = "企业id"),
     })
     public R<List<ResponseKllOrderTask>> queryOrderTaskListByLedgerLogisticsId(
             @RequestParam(value = "ledgerLogisticsId", required = true) Long ledgerLogisticsId,

+ 73 - 0
src/main/java/com/sckw/freight/controller/SettlementLogisticsController.java

@@ -0,0 +1,73 @@
+package com.sckw.freight.controller;
+
+import com.github.xiaoymin.knife4j.annotations.DynamicParameter;
+import com.github.xiaoymin.knife4j.annotations.DynamicResponseParameters;
+import com.sckw.freight.model.vo.request.RequestSettlementLogisticsPageInfo;
+import com.sckw.freight.model.vo.response.ResponsePageData;
+import com.sckw.freight.model.vo.response.ResponseSettlementLogistics;
+import com.sckw.freight.service.freight.IKwpSettlementLogisticsService;
+import com.sckw.freight.util.R;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.springframework.web.bind.annotation.*;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+/**
+ * @BelongsProject: Freight-Settlement-Backend
+ * @BelongsPackage: com.sckw.freight.controller
+ * @Author: xj
+ * @CreateTime: 2025-01-12  13:21
+ * @Description: 收款记录
+ * @Version: 1.0
+ */
+@RestController
+@RequestMapping("/settlement")
+@Slf4j
+@Tag(name = "收款")
+public class SettlementLogisticsController {
+    @Autowired
+    IKwpSettlementLogisticsService iKwpSettlementLogisticsService;
+
+    /**
+     * @description:添加收款明细(用于支付完成后,支付中台回调)
+     * @author: xj
+     * @date: 2025/1/12 星期日 13:19
+     * @param:
+     * @return: null
+     **/
+    @GetMapping("/add")
+    @Operation(summary = "添加收款")
+    @DynamicResponseParameters(name = "addSettlementLogistics", properties = {
+            @DynamicParameter(name = "lLedgerId", value = "对账单id"),
+            @DynamicParameter(name = "price", value = "付款金额"),
+            @DynamicParameter(name = "slOrderNo", value = "付款单号"),
+            @DynamicParameter(name = "payTime", value = "支付时间"),
+            @DynamicParameter(name = "userid", value = "用户id"),
+    })
+    public R<String> addSettlementLogistics(
+            @RequestParam(value = "lLedgerId", required = true)Long lLedgerId,
+            @RequestParam(value = "price", required = true) BigDecimal price,
+            @RequestParam(value = "slOrderNo", required = true)String slOrderNo,
+            @RequestParam(value = "payTime", required = true)@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime payTime,
+            @RequestParam(value = "userid", required = true)Long userid) {
+        iKwpSettlementLogisticsService.addSettlementLogistics(lLedgerId, price, slOrderNo, payTime, userid);
+        return R.ok();
+    }
+    /**
+     * @description:分页查询收款
+     * @author: xj
+     * @date: 2025/1/12 星期日 13:49
+     * @param:
+     * @return: null
+     **/
+    @PostMapping("/list")
+    @Operation(summary = "分页查询收款")
+    public R<ResponsePageData<ResponseSettlementLogistics>> list(@RequestBody RequestSettlementLogisticsPageInfo requestPageInfo) {
+        return iKwpSettlementLogisticsService.list(requestPageInfo);
+    }
+}

+ 6 - 5
src/main/java/com/sckw/freight/entity/freight/KwpLedgerLogistics.java

@@ -1,15 +1,16 @@
 package com.sckw.freight.entity.freight;
 
-import java.math.BigDecimal;
-import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.IdType;
-import java.time.LocalDateTime;
 import com.baomidou.mybatisplus.annotation.TableId;
-import java.io.Serializable;
+import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
 /**
  * <p>
  * 对账-物流订单
@@ -149,7 +150,7 @@ public class KwpLedgerLogistics implements Serializable {
 
     /**
      * 4.0 状态(1-已保存、2-待对账、3-已对账、4-已完成、5-已退回 6-已撤回)
-     * 数货运结 (1-待支付,2-部分支付,3-已支付)
+     * 数货运结 (0-待支付,1-部分支付,2-已支付)
      */
     private Integer status;
 

+ 3 - 3
src/main/java/com/sckw/freight/model/enums/KwpLedgerLogisticsStatusEnum.java

@@ -21,9 +21,9 @@ import java.util.stream.Collectors;
 @AllArgsConstructor
 public enum KwpLedgerLogisticsStatusEnum {
 
-    Unpaid (1, "待支付"),
-    PartialPaid (2, "部分支付"),
-    Paid (3, "已支付");
+    Unpaid (0, "待支付"),
+    PartialPaid (1, "部分支付"),
+    Paid (2, "已支付");
     private final Integer code;
     private final String msg;
 

+ 40 - 0
src/main/java/com/sckw/freight/model/enums/SettlementLogisticsStatusEnum.java

@@ -0,0 +1,40 @@
+package com.sckw.freight.model.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.List;
+import java.util.stream.Collectors;
+/**
+ * @description:结算单(收款记录) 状态(1 待结算 2 部分结算 3 全部结算)
+ * @author: xj
+ * @date: 2025/1/12 星期日 11:09
+ * @param:
+ * @return: null
+ **/
+@Getter
+@AllArgsConstructor
+public enum SettlementLogisticsStatusEnum {
+
+    ToSettled(1, "待结算"),
+    PartialSettlement (2, "部分结算"),
+    FullSettlement (3, "全部结算");
+    private final Integer code;
+    private final String msg;
+
+    public static String getMsg(Integer code) {
+        for (SettlementLogisticsStatusEnum ele : SettlementLogisticsStatusEnum.values()) {
+            if (ele.getCode().equals(code)) {
+                return ele.getMsg();
+            }
+        }
+        return null;
+    }
+
+    public static List<SettlementLogisticsStatusEnum> getSortList() {
+        SettlementLogisticsStatusEnum[] enums = SettlementLogisticsStatusEnum.values();
+        return Arrays.stream(enums).sorted(Comparator.comparingInt(SettlementLogisticsStatusEnum::getCode)).collect(Collectors.toList());
+    }
+}

+ 9 - 0
src/main/java/com/sckw/freight/model/vo/request/RequestLedgerLogisticsPageInfo.java

@@ -1,5 +1,7 @@
 package com.sckw.freight.model.vo.request;
 
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.time.LocalDateTime;
@@ -13,31 +15,38 @@ import java.time.LocalDateTime;
  * @Version: 1.0
  */
 @Data
+@ApiModel(value = "物流对账单-分页查询参数",description = "物流对账单-分页查询参数")
 public class RequestLedgerLogisticsPageInfo extends RequestPageInfo {
 
     /**
      * 物流对账单编号
      */
+    @ApiModelProperty(value = "物流对账单编号")
     private String lLedgerNo;
 
     /**
      * 对账单名称
      */
+    @ApiModelProperty(value = "对账单名称")
     private String name;
     /**
      * 对账单状态
      */
+    @ApiModelProperty(value = "对账单状态", allowableValues = "0-待支付,1-部分支付,2-已支付")
     private Integer status;
     /**
      * 创建时间 ["2025-01-09","2025-01-09"]
      */
+    @ApiModelProperty(value = "创建时间", allowableValues = "[2025-01-09,2025-01-09]")
     private LocalDateTime[] createTime;
     /**
      * 更新时间 ["2025-01-09","2025-01-09"]
      */
+    @ApiModelProperty(value = "更新时间", allowableValues = "[2025-01-09,2025-01-09]")
     private LocalDateTime[] updateTime;
     /**
      * 企业id
      */
+    @ApiModelProperty(value = "企业id")
     private Long entId;
 }

+ 7 - 1
src/main/java/com/sckw/freight/model/vo/request/RequestPageInfo.java

@@ -1,7 +1,8 @@
 package com.sckw.freight.model.vo.request;
 
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
-
 /**
  * @BelongsProject: Freight-Settlement-Backend
  * @BelongsPackage: com.sckw.freight.model.vo.request
@@ -11,22 +12,27 @@ import lombok.Data;
  * @Version: 1.0
  */
 @Data
+@ApiModel(value = "分页查询参数",description = "分页查询参数")
 public class RequestPageInfo {
     private static final long serialVersionUID = 1L;
     /**
      * 当前页码
      */
+    @ApiModelProperty(value = "当前页码",allowableValues = "1,2,3,4,5",example = "1")
     private long page=1;
     /**
      * 每页数量
      */
+    @ApiModelProperty(value = "每页数量",allowableValues = "1,10,20,50,100")
     private long pageSize=10;
     /**
      * 排序字段
      */
+    @ApiModelProperty(value = "排序字段")
     private String sortField;
     /**
      * 排序方式
      */
+    @ApiModelProperty(value = "排序方式", allowableValues = "asc,desc")
     private String sortOrder;
 }

+ 9 - 0
src/main/java/com/sckw/freight/model/vo/request/RequestSaveLedgerLogisticsInfo.java

@@ -1,5 +1,7 @@
 package com.sckw.freight.model.vo.request;
 
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.math.BigDecimal;
@@ -14,30 +16,37 @@ import java.util.List;
  * @Version: 1.0
  */
 @Data
+@ApiModel(value = "新建对账单信息",description = "新建对账单信息")
 public class RequestSaveLedgerLogisticsInfo {
     /**
      * 物流订单ID
      */
+    @ApiModelProperty(value = "物流订单ID",allowableValues ="[123,234]" )
     private List<Long> orderIds;
     /**
      * 对账单名称
      */
+    @ApiModelProperty(value = "对账单名称" )
     private String name;
     /**
      * 扣款金额
      */
+    @ApiModelProperty(value = "扣款金额" )
     private BigDecimal deductPrice;
     /**
      * 企业id
      */
+    @ApiModelProperty(value = "企业id" )
     private Long entId;
     /**
      * 备注
      */
+    @ApiModelProperty(value = "备注" )
     private String remark;
     /**
      * 当前登录用户id
      */
+    @ApiModelProperty(value = "当前登录用户id" )
     private Long userId;
 
 }

+ 27 - 0
src/main/java/com/sckw/freight/model/vo/request/RequestSettlementLogisticsPageInfo.java

@@ -0,0 +1,27 @@
+package com.sckw.freight.model.vo.request;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * @BelongsProject: Freight-Settlement-Backend
+ * @BelongsPackage: com.sckw.freight.model.vo.request
+ * @Author: xj
+ * @CreateTime: 2025-01-12  13:24
+ * @Description: 物流对账单-收款记录-分页查询参数
+ * @Version: 1.0
+ */
+@Data
+@ApiModel(value = "物流对账单-收款记录-分页查询参数", description = "物流对账单-收款记录-分页查询参数")
+public class RequestSettlementLogisticsPageInfo extends RequestPageInfo {
+    @ApiModelProperty(value = "对账单 id")
+    private Long lLedgerId;
+    @ApiModelProperty(value = "收款单号")
+    private String slOrderNo;
+    @ApiModelProperty(value = "收款时间", allowableValues = "[2025-01-09,2025-01-09]")
+    private List<LocalDateTime> payTime;
+}

+ 18 - 5
src/main/java/com/sckw/freight/model/vo/response/ResponseKllOrderTask.java

@@ -1,11 +1,10 @@
 package com.sckw.freight.model.vo.response;
 
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.math.BigDecimal;
-import java.time.LocalDateTime;
 
 /**
  * @BelongsProject: Freight-Settlement-Backend
@@ -16,24 +15,32 @@ import java.time.LocalDateTime;
  * @Version: 1.0
  */
 @Data
+@ApiModel(value = "运单信息")
 public class ResponseKllOrderTask {
     private static final long serialVersionUID = 1L;
 
+    /**
+     * 运单ID
+     */
+    @ApiModelProperty(value = "运单ID")
     private Integer id;
     /**
      * 运单号
      */
+    @ApiModelProperty(value = "运单号")
     private String taskNo;
 
     /**
      * 订单ID
      */
+    @ApiModelProperty(value = "物流订单ID")
     private Integer orderId;
 
     /**
      * 物流公司ID
      */
-    private Integer logisticId;
+//    @ApiModelProperty(value = "物流公司ID")
+//    private Integer logisticId;
 
     /**
      * 卡车ID
@@ -43,6 +50,7 @@ public class ResponseKllOrderTask {
     /**
      * 卡车车牌
      */
+    @ApiModelProperty(value = "卡车车牌")
     private String truckLicensePlate;
 
     /**
@@ -68,16 +76,19 @@ public class ResponseKllOrderTask {
     /**
      * 卡车司机
      */
-    private Integer driverId;
+//    @ApiModelProperty(value = "卡车司机")
+//    private Integer driverId;
 
     /**
      * 卡车司机名
      */
+    @ApiModelProperty(value = "卡车司机名")
     private String driverName;
 
     /**
      * 卡车司机电话
      */
+    @ApiModelProperty(value = "卡车司机电话")
     private String driverPhone;
 
     /**
@@ -108,6 +119,7 @@ public class ResponseKllOrderTask {
     /**
      * 首次称重
      */
+    @ApiModelProperty(value = "装货量")
     private BigDecimal firstWeight;
 
     /**
@@ -118,5 +130,6 @@ public class ResponseKllOrderTask {
     /**
      * 二次称重
      */
+    @ApiModelProperty(value = "卸货量")
     private BigDecimal secondWeight;
 }

+ 14 - 4
src/main/java/com/sckw/freight/model/vo/response/ResponseLedgerLogistics.java

@@ -1,12 +1,10 @@
 package com.sckw.freight.model.vo.response;
 
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.math.BigDecimal;
-import java.time.LocalDateTime;
-import java.util.List;
 
 /**
  * @BelongsProject: Freight-Settlement-Backend
@@ -17,52 +15,64 @@ import java.util.List;
  * @Version: 1.0
  */
 @Data
+@ApiModel(value = "物流对账单信息")
 public class ResponseLedgerLogistics {
     /**
      * 主键
      */
+    @ApiModelProperty(value = "物流对账单id")
     private Long id;
     /**
      * 物流对账单编号
      */
+    @ApiModelProperty(value = "物流对账单编号")
     private String lLedgerNo;
 
     /**
      * 对账单名称
      */
+    @ApiModelProperty(value = "对账单名称")
     private String name;
 
     /**
      * 4.0 状态(1-已保存、2-待对账、3-已对账、4-已完成、5-已退回 6-已撤回)
      * 数货运结 (1-待支付,2-部分支付,3-已支付)
      */
+    @ApiModelProperty(value = "物流对账单状态")
     private Integer status;
     /**
      * 状态名称
      */
+    @ApiModelProperty(value = "物流对账单状态名称")
     private String statusName;
     /**
      * 支付比例
      */
+    @ApiModelProperty(value = "支付比例")
     private String payRatio;
     /**
      * 已收款/元
      */
+    @ApiModelProperty(value = "已收款/元")
     private BigDecimal actualPrice;
     /**
      * 总应收/元
      */
+    @ApiModelProperty(value = "账单总金额")
     private BigDecimal totalPrice;
     /**
      * 创建时间
      */
+    @ApiModelProperty(value = "创建时间")
     private String createTime;
     /**
      * 更新时间
      */
+    @ApiModelProperty(value = "更新时间")
     private String updateTime;
     /**
      * 备注
      */
+    @ApiModelProperty(value = "备注")
     private String remark;
 }

+ 8 - 1
src/main/java/com/sckw/freight/model/vo/response/ResponsePageData.java

@@ -1,6 +1,7 @@
 package com.sckw.freight.model.vo.response;
 
-import com.github.xiaoymin.knife4j.annotations.DynamicParameter;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.util.List;
@@ -14,26 +15,32 @@ import java.util.List;
  * @Version: 1.0
  */
 @Data
+@ApiModel(value = "分页数据")
 public class ResponsePageData<T> {
     private static final long serialVersionUID = 7367318386929321066L;
     /**
      * 当前页码
      */
+    @ApiModelProperty(value = "当前页码")
     private long page;
     /**
      * 每页数量
      */
+    @ApiModelProperty(value = "每页数量")
     private long pageSize;
     /**
      * 总页数
      */
+    @ApiModelProperty(value = "总页数")
     private long pages;
     /**
      *总条数
      */
+    @ApiModelProperty(value = "总条数")
     private long total;
     /**
      * 数据列表
      */
+    @ApiModelProperty(value = "数据列表")
     private List<T> list;
 }

+ 74 - 0
src/main/java/com/sckw/freight/model/vo/response/ResponseSettlementLogistics.java

@@ -0,0 +1,74 @@
+package com.sckw.freight.model.vo.response;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * @BelongsProject: Freight-Settlement-Backend
+ * @BelongsPackage: com.sckw.freight.model.vo.response
+ * @Author: xj
+ * @CreateTime: 2025-01-12  13:25
+ * @Description: 物流对账单-付款记录
+ * @Version: 1.0
+ */
+@Data
+@ApiModel(value = "物流对账单-付款记录")
+public class ResponseSettlementLogistics {
+
+    /**
+     * 主键
+     */
+    @ApiModelProperty(value = "主键")
+    private Long id;
+
+    /**
+     * 企业id
+     */
+    @ApiModelProperty(value = "企业id")
+    private Long entId;
+
+    /**
+     * 物流订单对账id
+     */
+    @ApiModelProperty(value = "物流订单对账id")
+    private Long lLedgerId;
+
+    /**
+     * 付款单号
+     */
+    @ApiModelProperty(value = "付款单号")
+    private String slOrderNo;
+
+    /**
+     * 对账金额
+     */
+    @ApiModelProperty(value = "对账金额")
+    private BigDecimal totalPrice;
+
+    /**
+     * 收款日期
+     */
+    @ApiModelProperty(value = "收款日期")
+    private String receiptTime;
+    /**
+     * 生成日期
+     */
+    @ApiModelProperty(value = "生成日期")
+    private String createdTime;
+
+    /**
+     * 备注
+     */
+    @ApiModelProperty(value = "备注")
+    private String remark;
+
+    /**
+     * 状态(1待结算2部分结算3全部结算)
+     */
+    private Integer status;
+    @ApiModelProperty(value = "状态(1待结算2部分结算3全部结算)")
+    private String statusName;
+}

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

@@ -1,7 +1,7 @@
 package com.sckw.freight.service.freight;
 
-import com.sckw.freight.entity.freight.KwpLedgerLogistics;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.sckw.freight.entity.freight.KwpLedgerLogistics;
 import com.sckw.freight.model.vo.request.RequestLedgerLogisticsPageInfo;
 import com.sckw.freight.model.vo.request.RequestSaveLedgerLogisticsInfo;
 import com.sckw.freight.model.vo.response.ResponseKllOrderTask;
@@ -9,7 +9,6 @@ import com.sckw.freight.model.vo.response.ResponseLedgerLogistics;
 import com.sckw.freight.model.vo.response.ResponsePageData;
 import com.sckw.freight.util.R;
 import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestParam;
 
 import java.util.List;
 
@@ -25,6 +24,7 @@ public interface IKwpLedgerLogisticsService extends IService<KwpLedgerLogistics>
     /**
      * 保存对账-物流订单
      *
+     * @author: xj
      * @param requestSaveLedgerSettlementInfo
      * @return
      */
@@ -33,6 +33,7 @@ public interface IKwpLedgerLogisticsService extends IService<KwpLedgerLogistics>
     /**
      * 查询对账-物流订单
      *
+     * @author: xj
      * @param requestPageInfo
      * @return
      */
@@ -40,9 +41,21 @@ public interface IKwpLedgerLogisticsService extends IService<KwpLedgerLogistics>
 
     /**
      * 根据对账单ID查询运单
+     *
+     * @author: xj
      * @param ledgerLogisticsId
      * @param entId
      * @return
      */
     R<List<ResponseKllOrderTask>> queryOrderTaskListByLedgerLogisticsId(Long ledgerLogisticsId, Long entId);
+
+    /**
+     *  更改物流对账单状态(每一次收款后调用)
+     *
+     * @author: xj
+     * @date: 2025/1/12 星期日 11:18
+     * @param: 物流对账单
+     * @return: null
+     **/
+    void updateLedgerLogisticsStatus(KwpLedgerLogistics ledgerLogistics, Long userId);
 }

+ 10 - 2
src/main/java/com/sckw/freight/service/freight/IKwpSettlementLogisticsService.java

@@ -1,7 +1,14 @@
 package com.sckw.freight.service.freight;
 
-import com.sckw.freight.entity.freight.KwpSettlementLogistics;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.sckw.freight.entity.freight.KwpSettlementLogistics;
+import com.sckw.freight.model.vo.request.RequestSettlementLogisticsPageInfo;
+import com.sckw.freight.model.vo.response.ResponsePageData;
+import com.sckw.freight.model.vo.response.ResponseSettlementLogistics;
+import com.sckw.freight.util.R;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
 
 /**
  * <p>
@@ -12,5 +19,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * @since 2025-01-09
  */
 public interface IKwpSettlementLogisticsService extends IService<KwpSettlementLogistics> {
-
+    void addSettlementLogistics(Long lLedgerId, BigDecimal price, String slOrderNo, LocalDateTime payTime, Long userid);
+    R<ResponsePageData<ResponseSettlementLogistics>> list( RequestSettlementLogisticsPageInfo requestPageInfo);
 }

+ 58 - 7
src/main/java/com/sckw/freight/service/freight/impl/KwpLedgerLogisticsServiceImpl.java

@@ -2,12 +2,15 @@ package com.sckw.freight.service.freight.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.sckw.freight.entity.freight.KwpLedgerLogistics;
 import com.sckw.freight.entity.freight.KwpLedgerLogisticsOrder;
 import com.sckw.freight.entity.freight.KwpLedgerLogisticsTrack;
+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.mapper.freight.KwpLedgerLogisticsMapper;
+import com.sckw.freight.mapper.freight.KwpSettlementLogisticsMapper;
 import com.sckw.freight.mapper.kll.KllOrderTaskMapper;
 import com.sckw.freight.model.enums.*;
 import com.sckw.freight.model.vo.request.RequestLedgerLogisticsPageInfo;
@@ -17,16 +20,15 @@ import com.sckw.freight.model.vo.response.ResponseLedgerLogistics;
 import com.sckw.freight.model.vo.response.ResponsePageData;
 import com.sckw.freight.service.freight.IKwpLedgerLogisticsOrderService;
 import com.sckw.freight.service.freight.IKwpLedgerLogisticsService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.sckw.freight.service.freight.IKwpLedgerLogisticsTrackService;
 import com.sckw.freight.service.kll.IKllOrderService;
 import com.sckw.freight.util.DateTimeUtil;
 import com.sckw.freight.util.R;
 import com.sckw.freight.util.SnowflakeIdUtil;
 import org.apache.commons.lang3.StringUtils;
-import org.jetbrains.annotations.NotNull;
 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;
@@ -52,10 +54,56 @@ public class KwpLedgerLogisticsServiceImpl extends ServiceImpl<KwpLedgerLogistic
     @Autowired
     IKwpLedgerLogisticsTrackService iKwpLedgerLogisticsTrackService;
     @Autowired
+    KwpSettlementLogisticsMapper kwpSettlementLogisticsMapper;
+    @Autowired
     KwpLedgerLogisticsMapper kwpLedgerLogisticsMapper;
     @Autowired
     KllOrderTaskMapper kllOrderTaskMapper;
 
+
+    /**
+     * @description:更改物流对账单状态(每一次收款后调用)
+     * @author: xj
+     * @date: 2025/1/12 星期日 11:20
+     * @param: ledgerLogisticsId 物流对账单id
+     * @return: null
+     **/
+    @Override
+    public void updateLedgerLogisticsStatus(KwpLedgerLogistics ledgerLogistics, Long userId) {
+        /**
+         * 1:查询 对账单单下的 所有结算单(收款记录)
+         * 2:如果全部收款,则对账单状态为已收款
+         * 3:如果部分收款,则对账单状态为部分收款
+         * 4:添加状态变更记录
+         */
+        KwpLedgerLogistics newLedgerLogistics = new KwpLedgerLogistics();
+        newLedgerLogistics.setId(ledgerLogistics.getId());
+
+        LambdaQueryWrapper<KwpSettlementLogistics> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(KwpSettlementLogistics::getLLedgerId, ledgerLogistics.getId());
+        wrapper.eq(KwpSettlementLogistics::getStatus, SettlementLogisticsStatusEnum.FullSettlement.getCode());
+        List<KwpSettlementLogistics> kwpSettlementLogistics = kwpSettlementLogisticsMapper.selectList(wrapper);
+        if (kwpSettlementLogistics == null) kwpSettlementLogistics = new ArrayList<>();
+        BigDecimal totalPrice = kwpSettlementLogistics.stream().map(KwpSettlementLogistics::getActualPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
+        newLedgerLogistics.setActualPrice(totalPrice);
+        KwpLedgerLogisticsStatusEnum status = KwpLedgerLogisticsStatusEnum.Unpaid;
+        if (totalPrice.compareTo(ledgerLogistics.getSettlePrice()) < 0) {
+            status = KwpLedgerLogisticsStatusEnum.PartialPaid;
+        } else {
+            status = KwpLedgerLogisticsStatusEnum.Paid;
+        }
+        newLedgerLogistics.setStatus(status.getCode());
+        newLedgerLogistics.setUpdateBy(userId);
+        newLedgerLogistics.setUpdateTime(LocalDateTime.now());
+        newLedgerLogistics.setId(ledgerLogistics.getId());
+        boolean update = updateById(newLedgerLogistics);
+        if (!update) throw new RuntimeException("更新对账单状态失败");
+        //添加状态变更记录
+        this.savaKwpLedgerLogisticsTrack(ledgerLogistics, status);
+
+
+    }
+
     /**
      * 根骨对账单id查询运单
      *
@@ -95,9 +143,9 @@ public class KwpLedgerLogisticsServiceImpl extends ServiceImpl<KwpLedgerLogistic
             orderTask.setId(task.getId().intValue());
             orderTask.setTaskNo(task.getTaskNo());
             orderTask.setOrderId(task.getOrderId().intValue());
-            orderTask.setLogisticId(task.getLogisticId().intValue());
+            //orderTask.setLogisticId(task.getLogisticId().intValue());
             orderTask.setTruckLicensePlate(task.getTruckLicensePlate());
-            orderTask.setDriverId(task.getDriverId().intValue());
+            //orderTask.setDriverId(task.getDriverId().intValue());
             orderTask.setDriverName(task.getDriverName());
             orderTask.setDriverPhone(task.getDriverPhone());
             orderTask.setFirstWeight(task.getFirstWeight());
@@ -108,6 +156,7 @@ public class KwpLedgerLogisticsServiceImpl extends ServiceImpl<KwpLedgerLogistic
         return R.ok(responseKllOrderTasks);
     }
 
+
     /**
      * 查询对账-物流订单
      *
@@ -190,6 +239,7 @@ public class KwpLedgerLogisticsServiceImpl extends ServiceImpl<KwpLedgerLogistic
      * @since 2025-01-09
      */
     @Override
+    @Transactional
     public R<String> saveLedgerLogistics(RequestSaveLedgerLogisticsInfo requestSaveLedgerSettlementInfo) {
         /**
          * 1:数据验证
@@ -206,7 +256,7 @@ public class KwpLedgerLogisticsServiceImpl extends ServiceImpl<KwpLedgerLogistic
         //3:保存对账订单
         List<KwpLedgerLogisticsOrder> kwpLedgerLogisticsOrders = savaKwpLedgerLogisticsOrder(kwpLedgerLogistics, kllOrders);
         //4:保存对账状态
-        savaKwpLedgerLogisticsTrack(kwpLedgerLogistics);
+        savaKwpLedgerLogisticsTrack(kwpLedgerLogistics, KwpLedgerLogisticsStatusEnum.Unpaid);
         //5:改订单状态
         updateKllOrderStatus(kllOrders);
         return R.ok(kwpLedgerLogistics.getLLedgerNo());
@@ -289,6 +339,7 @@ public class KwpLedgerLogisticsServiceImpl extends ServiceImpl<KwpLedgerLogistic
         //创建人
         kwpLedgerLogistics.setCreateBy(requestSaveLedgerSettlementInfo.getUserId());
         kwpLedgerLogistics.setUpdateBy(requestSaveLedgerSettlementInfo.getUserId());
+        kwpLedgerLogistics.setGenerateTime(LocalDateTime.now());
         kwpLedgerLogistics.setCreateTime(LocalDateTime.now());
         kwpLedgerLogistics.setUpdateTime(LocalDateTime.now());
         kwpLedgerLogistics.setDelFlag(DelFlagEnum.NotDelete.getCode());
@@ -337,11 +388,11 @@ public class KwpLedgerLogisticsServiceImpl extends ServiceImpl<KwpLedgerLogistic
      * @author xj
      * @since 2025-01-09
      */
-    private KwpLedgerLogisticsTrack savaKwpLedgerLogisticsTrack(KwpLedgerLogistics kwpLedgerLogistics) {
+    private KwpLedgerLogisticsTrack savaKwpLedgerLogisticsTrack(KwpLedgerLogistics kwpLedgerLogistics, KwpLedgerLogisticsStatusEnum ledgerLogisticsStatusEnum) {
         KwpLedgerLogisticsTrack kwpLedgerLogisticsTrack = new KwpLedgerLogisticsTrack();
         kwpLedgerLogisticsTrack.setId(SnowflakeIdUtil.getInstance().nextId());
         kwpLedgerLogisticsTrack.setLLedgerId(kwpLedgerLogistics.getId());
-        kwpLedgerLogisticsTrack.setStatus(0);
+        kwpLedgerLogisticsTrack.setStatus(ledgerLogisticsStatusEnum.getCode());
         kwpLedgerLogisticsTrack.setCreateBy(kwpLedgerLogistics.getCreateBy());
         kwpLedgerLogisticsTrack.setUpdateBy(kwpLedgerLogistics.getUpdateBy());
         kwpLedgerLogisticsTrack.setCreateTime(kwpLedgerLogistics.getCreateTime());

+ 153 - 1
src/main/java/com/sckw/freight/service/freight/impl/KwpSettlementLogisticsServiceImpl.java

@@ -1,10 +1,30 @@
 package com.sckw.freight.service.freight.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.sckw.freight.entity.freight.KwpLedgerLogistics;
 import com.sckw.freight.entity.freight.KwpSettlementLogistics;
 import com.sckw.freight.mapper.freight.KwpSettlementLogisticsMapper;
+import com.sckw.freight.model.enums.DelFlagEnum;
+import com.sckw.freight.model.enums.SettlementLogisticsStatusEnum;
+import com.sckw.freight.model.vo.request.RequestSettlementLogisticsPageInfo;
+import com.sckw.freight.model.vo.response.ResponsePageData;
+import com.sckw.freight.model.vo.response.ResponseSettlementLogistics;
+import com.sckw.freight.service.freight.IKwpLedgerLogisticsService;
 import com.sckw.freight.service.freight.IKwpSettlementLogisticsService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.sckw.freight.util.DateTimeUtil;
+import com.sckw.freight.util.R;
+import com.sckw.freight.util.SnowflakeIdUtil;
+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;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -17,4 +37,136 @@ import org.springframework.stereotype.Service;
 @Service
 public class KwpSettlementLogisticsServiceImpl extends ServiceImpl<KwpSettlementLogisticsMapper, KwpSettlementLogistics> implements IKwpSettlementLogisticsService {
 
+    @Autowired
+    IKwpLedgerLogisticsService iKwpLedgerLogisticsService;
+    @Autowired
+    KwpSettlementLogisticsMapper kwpSettlementLogisticsMapper;
+
+    /**
+     * @description: 添加物流结算单   由支付后的回调添加支付记录
+     * 注意: 这儿的结算单如同 只是一条收款明细。
+     * <p>
+     * 步骤
+     * 先进性数据验证
+     * 1:根据 lLedgerId  查询物流单对账单信息
+     * 2:插入结算单信息(插入支付记录)
+     * 3:修改物流单对账单状态(如果支付总额已超过对账单)
+     * @author: xj
+     * @date: 2025/1/12 星期日 10:44
+     * @param: lLedgerId 物流单对账单id
+     * @param: price 支付金额
+     * @param: payTime 支付时间
+     * @param: slOrderNo 付款单单号
+     * @param: userid 操作用户id
+     * @return: void
+     **/
+    @Transactional
+    public void addSettlementLogistics(Long lLedgerId, BigDecimal price, String slOrderNo, LocalDateTime payTime, Long userid) {
+        //先进性数据验证
+        KwpLedgerLogistics logistics = verifySettlementLogistics(lLedgerId, price, payTime, userid);
+        //插入结算单信息(插入支付记录)
+        saveSettlementLogistics(logistics, price, slOrderNo, payTime, userid);
+        //修改物流单对账单状态(如果支付总额已超过对账单)
+        iKwpLedgerLogisticsService.updateLedgerLogisticsStatus(logistics, userid);
+
+    }
+
+    /**
+     * @description:分页查询收款记录
+     * @author: xj
+     * @date: 2025/1/12 星期日 13:48
+     * @param:
+     * @return: null
+     **/
+    @Override
+    public R<ResponsePageData<ResponseSettlementLogistics>> list(RequestSettlementLogisticsPageInfo requestPageInfo) {
+        //分页查询
+        LambdaQueryWrapper<KwpSettlementLogistics> wrapper = new LambdaQueryWrapper<>();
+        if (requestPageInfo.getLLedgerId() != null) {
+            wrapper.eq(KwpSettlementLogistics::getLLedgerId, requestPageInfo.getLLedgerId());
+        }
+        if (requestPageInfo.getSlOrderNo() != null) {
+            wrapper.like(KwpSettlementLogistics::getSlOrderNo, requestPageInfo.getSlOrderNo());
+        }
+        if (requestPageInfo.getPayTime() != null && requestPageInfo.getPayTime().size() == 2) {
+            wrapper.ge(KwpSettlementLogistics::getReceiptTime, requestPageInfo.getPayTime().get(0));
+            wrapper.le(KwpSettlementLogistics::getReceiptTime, requestPageInfo.getPayTime().get(1));
+        }
+        wrapper.orderByDesc(KwpSettlementLogistics::getCreateTime);
+        Page<KwpSettlementLogistics> page = new Page<>(requestPageInfo.getPage(), requestPageInfo.getPageSize());
+        Page<KwpSettlementLogistics> selectPage = kwpSettlementLogisticsMapper.selectPage(page, wrapper);
+
+        if (selectPage.getRecords() == null) selectPage.setRecords(new ArrayList<>());
+        List<ResponseSettlementLogistics> responseSettlementLogisticsStream = selectPage.getRecords().stream().map(item -> {
+
+            ResponseSettlementLogistics responseSettlementLogistics = new ResponseSettlementLogistics();
+            responseSettlementLogistics.setId(item.getId());
+            responseSettlementLogistics.setEntId(item.getEntId());
+            responseSettlementLogistics.setLLedgerId(item.getLLedgerId());
+            responseSettlementLogistics.setSlOrderNo(item.getSlOrderNo());
+            responseSettlementLogistics.setTotalPrice(item.getTotalPrice());
+            responseSettlementLogistics.setReceiptTime(DateTimeUtil.format(item.getReceiptTime(), "YYYY-MM-dd HH:mm:ss"));
+            responseSettlementLogistics.setCreatedTime(DateTimeUtil.format(item.getCreateTime(), "YYYY-MM-dd HH:mm:ss"));
+            responseSettlementLogistics.setRemark(item.getRemark());
+            responseSettlementLogistics.setStatus(item.getStatus());
+            responseSettlementLogistics.setStatusName(SettlementLogisticsStatusEnum.getMsg(item.getStatus()));
+            return responseSettlementLogistics;
+        }).collect(Collectors.toList());
+
+        //返回分页数据
+        ResponsePageData<ResponseSettlementLogistics> responsePageData = new ResponsePageData<>();
+        responsePageData.setList(responseSettlementLogisticsStream);
+        responsePageData.setTotal(selectPage.getTotal());
+        responsePageData.setPages(selectPage.getPages());
+        responsePageData.setPage(selectPage.getCurrent());
+        responsePageData.setPageSize(selectPage.getSize());
+        return R.ok(responsePageData);
+    }
+
+    /**
+     * @description:验证参数并返回 物流单对账单信息
+     * @author: xj
+     * @date: 2025/1/12 星期日 11:03
+     * @return: KwpLedgerLogistics
+     **/
+    private KwpLedgerLogistics verifySettlementLogistics(Long lLedgerId, BigDecimal price, LocalDateTime payTime, Long userid) {
+        if (lLedgerId == null) throw new RuntimeException("lLedgerId不能为空");
+        if (price == null) throw new RuntimeException("price不能为空");
+        if (payTime == null) throw new RuntimeException("payTime不能为空");
+        if (userid == null) throw new RuntimeException("userid不能为空");
+        if (price.compareTo(BigDecimal.ZERO) <= 0) throw new RuntimeException("price不能小于等于0");
+        KwpLedgerLogistics logistics = iKwpLedgerLogisticsService.getById(lLedgerId);
+        if (logistics == null) throw new RuntimeException("物流对账单" + lLedgerId + "不存在");
+        return logistics;
+    }
+
+    /**
+     * @description: 保存结算单信息(收款记录)
+     * @author: xj
+     * @date: 2025/1/12 星期日 11:14
+     * @param:
+     * @return: null
+     **/
+    private void saveSettlementLogistics(KwpLedgerLogistics logistics, BigDecimal price, String slOrderNo, LocalDateTime payTime, Long userid) {
+        KwpSettlementLogistics settlementLogistics = new KwpSettlementLogistics();
+        settlementLogistics.setId(SnowflakeIdUtil.getInstance().nextId());
+        settlementLogistics.setEntId(logistics.getEntId());
+        settlementLogistics.setLLedgerId(logistics.getId());
+        settlementLogistics.setSlOrderNo(slOrderNo);
+        settlementLogistics.setName(logistics.getName());
+        settlementLogistics.setTotalPrice(price);
+        settlementLogistics.setActualPrice(price);
+        settlementLogistics.setReceiptTime(payTime);
+        settlementLogistics.setStatus(SettlementLogisticsStatusEnum.FullSettlement.getCode());
+        settlementLogistics.setCreateBy(userid);
+        settlementLogistics.setUpdateBy(userid);
+        settlementLogistics.setCreateTime(LocalDateTime.now());
+        settlementLogistics.setUpdateTime(LocalDateTime.now());
+        settlementLogistics.setDelFlag(DelFlagEnum.NotDelete.getCode());
+
+        boolean save = save(settlementLogistics);
+        if (!save) throw new RuntimeException("保存结算单失败");
+
+    }
+
 }

+ 4 - 0
src/main/java/com/sckw/freight/util/R.java

@@ -1,5 +1,6 @@
 package com.sckw.freight.util;
 
+import io.swagger.annotations.ApiModelProperty;
 import lombok.*;
 import lombok.experimental.Accessors;
 
@@ -20,13 +21,16 @@ public class R<T> implements Serializable {
 
     @Getter
     @Setter
+    @ApiModelProperty(value = "返回信息")
     private String msg;
     @Getter
     @Setter
+    @ApiModelProperty(value = "返回状态")
     private Boolean status;
 
     @Getter
     @Setter
+    @ApiModelProperty(value = "返回数据")
     private T data;
 
     public static <T> R<T> ok() {

+ 5 - 2
src/main/resources/application-dev.yml

@@ -51,12 +51,15 @@ springdoc:
     operations-sorter: alpha
   api-docs:
     path: /v3/api-docs
+    version: openapi_3_1
   group-configs:
     - group: 'default'
       paths-to-match: '/**'
       packages-to-scan: com.sckw.freight.controller
+
 # knife4j的增强配置,不需要增强可以不配
 knife4j:
   enable: true
-  setting:
-    language: zh_cn
+#  setting:
+#    language: zh_cn
+    #swagger-model-name: 物流单对账结算-Api