Browse Source

2025年3月4日16:40:15

纪新园 1 year ago
parent
commit
d20ba8f9b0
39 changed files with 1721 additions and 223 deletions
  1. 8 7
      blade-service-api/blade-land-api/src/main/java/org/springblade/land/entity/ExpenseSettlement.java
  2. 44 0
      blade-service-api/blade-land-api/src/main/java/org/springblade/land/entity/LandOrder.java
  3. 10 0
      blade-service-api/blade-land-api/src/main/java/org/springblade/land/entity/OrderFee.java
  4. 22 0
      blade-service-api/blade-land-api/src/main/java/org/springblade/land/entity/OrderItem.java
  5. 6 0
      blade-service-api/blade-land-api/src/main/java/org/springblade/land/feign/ILandClient.java
  6. 6 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/check/entity/LosAuditProecess.java
  7. 34 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/trade/dto/PayableStorageFeesDTO.java
  8. 34 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/trade/dto/PayableStorageFeesItemsDTO.java
  9. 23 4
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/trade/entity/InOutStorage.java
  10. 109 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/trade/entity/PayableStorageFees.java
  11. 154 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/trade/entity/PayableStorageFeesItems.java
  12. 10 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/trade/entity/Storage.java
  13. 36 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/trade/vo/PayableStorageFeesItemsVO.java
  14. 36 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/trade/vo/PayableStorageFeesVO.java
  15. 0 3
      blade-service-api/trade-finance-api/src/main/java/org/springblade/finance/dto/SettlementDTO.java
  16. 3 0
      blade-service-api/trade-finance-api/src/main/java/org/springblade/finance/vojo/Files.java
  17. 3 0
      blade-service-api/trade-finance-api/src/main/java/org/springblade/finance/vojo/Settlement.java
  18. 24 18
      blade-service/blade-land/src/main/java/org/springblade/land/controller/ExpenseSettlementController.java
  19. 18 0
      blade-service/blade-land/src/main/java/org/springblade/land/controller/OrderController.java
  20. 1 1
      blade-service/blade-land/src/main/java/org/springblade/land/controller/OrderItemController.java
  21. 10 1
      blade-service/blade-los/src/main/java/org/springblade/los/check/controller/AuditProecessController.java
  22. 1 3
      blade-service/blade-los/src/main/java/org/springblade/los/check/service/impl/AuditProecessServiceImpl.java
  23. 146 0
      blade-service/blade-los/src/main/java/org/springblade/los/trade/controller/PayableStorageFeesController.java
  24. 126 0
      blade-service/blade-los/src/main/java/org/springblade/los/trade/controller/PayableStorageFeesItemsController.java
  25. 42 0
      blade-service/blade-los/src/main/java/org/springblade/los/trade/mapper/PayableStorageFeesItemsMapper.java
  26. 33 0
      blade-service/blade-los/src/main/java/org/springblade/los/trade/mapper/PayableStorageFeesItemsMapper.xml
  27. 42 0
      blade-service/blade-los/src/main/java/org/springblade/los/trade/mapper/PayableStorageFeesMapper.java
  28. 26 0
      blade-service/blade-los/src/main/java/org/springblade/los/trade/mapper/PayableStorageFeesMapper.xml
  29. 41 0
      blade-service/blade-los/src/main/java/org/springblade/los/trade/service/IPayableStorageFeesItemsService.java
  30. 50 0
      blade-service/blade-los/src/main/java/org/springblade/los/trade/service/IPayableStorageFeesService.java
  31. 2 1
      blade-service/blade-los/src/main/java/org/springblade/los/trade/service/impl/DispatchVehiclesServiceImpl.java
  32. 79 45
      blade-service/blade-los/src/main/java/org/springblade/los/trade/service/impl/InOutStorageServiceImpl.java
  33. 41 0
      blade-service/blade-los/src/main/java/org/springblade/los/trade/service/impl/PayableStorageFeesItemsServiceImpl.java
  34. 211 0
      blade-service/blade-los/src/main/java/org/springblade/los/trade/service/impl/PayableStorageFeesServiceImpl.java
  35. 1 1
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/controller/OrderController.java
  36. 35 54
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/service/impl/OrderServiceImpl.java
  37. 37 37
      blade-service/blade-sales-part/src/main/resources/log/logback-dev.xml
  38. 8 10
      blade-service/trade-finance/src/main/java/org/springblade/finance/controller/LandExpenseSettlementController.java
  39. 209 38
      blade-service/trade-finance/src/main/java/org/springblade/finance/service/impl/SettlementServiceImpl.java

+ 8 - 7
blade-service-api/blade-land-api/src/main/java/org/springblade/land/entity/ExpenseSettlement.java

@@ -16,17 +16,15 @@
  */
 package org.springblade.land.entity;
 
-import java.math.BigDecimal;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
-import java.time.LocalDateTime;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.util.Date;
 
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-
 /**
  * VIEW实体类
  *
@@ -56,6 +54,7 @@ public class ExpenseSettlement implements Serializable {
 	private String currency;
 	private BigDecimal amount;
 	private BigDecimal settlementAmount;
+	private BigDecimal reconciliationAmount;
 	private Long dc;
 	private Integer isDeleted;
 	private Long srcFeesId;
@@ -66,5 +65,7 @@ public class ExpenseSettlement implements Serializable {
 
 	private String tenantId;
 
+	@TableField(exist = false)
+	private BigDecimal thisAmount;
 
 }

+ 44 - 0
blade-service-api/blade-land-api/src/main/java/org/springblade/land/entity/LandOrder.java

@@ -458,5 +458,49 @@ public class LandOrder implements Serializable {
 	@TableField(exist = false)
 	private String pickUpGoodsUserName;
 
+	/**
+	 * 结算金额-收
+	 */
+	@ApiModelProperty(value = "结算金额-收")
+	private BigDecimal settlementAmountD;
+	/**
+	 * 结算时间-收
+	 */
+	@ApiModelProperty(value = "结算时间-收")
+	private Date settlementDateD;
+
+	/**
+	 * 结算金额-付
+	 */
+	@ApiModelProperty(value = "结算金额-付")
+	private BigDecimal settlementAmountC;
+	/**
+	 * 结算时间-付
+	 */
+	@ApiModelProperty(value = "结算时间-付")
+	private Date settlementDateC;
+
+	/**
+	 * 对账金额-收
+	 */
+	@ApiModelProperty(value = "对账金额-收")
+	private BigDecimal reconciliationAmountD;
+	/**
+	 * 对账时间-收
+	 */
+	@ApiModelProperty(value = "对账时间-收")
+	private Date reconciliationDateD;
+
+	/**
+	 * 对账金额-付
+	 */
+	@ApiModelProperty(value = "对账金额-付")
+	private BigDecimal reconciliationAmountC;
+	/**
+	 * 对账时间-付
+	 */
+	@ApiModelProperty(value = "对账时间-付")
+	private Date reconciliationDateC;
+
 
 }

+ 10 - 0
blade-service-api/blade-land-api/src/main/java/org/springblade/land/entity/OrderFee.java

@@ -212,4 +212,14 @@ public class OrderFee implements Serializable {
 	 */
 	@ApiModelProperty(value = "结算时间")
 	private Date settlementDate;
+	/**
+	 * 对账金额
+	 */
+	@ApiModelProperty(value = "对账金额")
+	private BigDecimal reconciliationAmount;
+	/**
+	 * 对账时间
+	 */
+	@ApiModelProperty(value = "对账时间")
+	private Date reconciliationDate;
 }

+ 22 - 0
blade-service-api/blade-land-api/src/main/java/org/springblade/land/entity/OrderItem.java

@@ -486,4 +486,26 @@ public class OrderItem implements Serializable {
 	@ApiModelProperty(value = "结算时间-付")
 	private Date settlementDateC;
 
+	/**
+	 * 对账金额-收
+	 */
+	@ApiModelProperty(value = "对账金额-收")
+	private BigDecimal reconciliationAmountD;
+	/**
+	 * 对账时间-收
+	 */
+	@ApiModelProperty(value = "对账时间-收")
+	private Date reconciliationDateD;
+
+	/**
+	 * 对账金额-付
+	 */
+	@ApiModelProperty(value = "对账金额-付")
+	private BigDecimal reconciliationAmountC;
+	/**
+	 * 对账时间-付
+	 */
+	@ApiModelProperty(value = "对账时间-付")
+	private Date reconciliationDateC;
+
 }

+ 6 - 0
blade-service-api/blade-land-api/src/main/java/org/springblade/land/feign/ILandClient.java

@@ -49,4 +49,10 @@ public interface ILandClient {
 
 	@PostMapping("/order-fee/updateOrderFeeList")
 	R updateOrderFeeList(@RequestBody List<OrderFee> orderFeeNew);
+
+	@PostMapping("/order/selectOrderList")
+	List<LandOrder> selectOrderList(@RequestBody List<Long> orderIdList);
+
+	@PostMapping("/order/updateOrderList")
+	R updateOrderList(@RequestBody List<LandOrder> orderListNew);
 }

+ 6 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/check/entity/LosAuditProecess.java

@@ -336,5 +336,11 @@ public class LosAuditProecess implements Serializable {
 	@ApiModelProperty(value = "订舱代理中文名称")
 	private String bookingAgentCnName;
 
+	/**
+	 * 审核级别
+	 */
+	@TableField(exist = false)
+	private long level;
+
 
 }

+ 34 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/trade/dto/PayableStorageFeesDTO.java

@@ -0,0 +1,34 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.trade.dto;
+
+import org.springblade.los.trade.entity.PayableStorageFees;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 应付仓储费表数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2025-03-03
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class PayableStorageFeesDTO extends PayableStorageFees {
+	private static final long serialVersionUID = 1L;
+
+}

+ 34 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/trade/dto/PayableStorageFeesItemsDTO.java

@@ -0,0 +1,34 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.trade.dto;
+
+import org.springblade.los.trade.entity.PayableStorageFeesItems;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 应付仓储费明细表数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2025-03-03
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class PayableStorageFeesItemsDTO extends PayableStorageFeesItems {
+	private static final long serialVersionUID = 1L;
+
+}

+ 23 - 4
blade-service-api/blade-los-api/src/main/java/org/springblade/los/trade/entity/InOutStorage.java

@@ -144,6 +144,7 @@ public class InOutStorage implements Serializable {
 	 * 入库时间
 	 */
 	@ApiModelProperty(value = "入库时间")
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
 	private Date storageDate;
 	/**
 	 * 出库时间
@@ -213,11 +214,16 @@ public class InOutStorage implements Serializable {
 	@ApiModelProperty(value = "出库件数")
 	private BigDecimal outQuantity;
 	/**
-	 * 出库重
+	 * 出库
 	 */
-	@ApiModelProperty(value = "出库重")
+	@ApiModelProperty(value = "出库重")
 	private BigDecimal outWeight;
 	/**
+	 * 出库净重
+	 */
+	@ApiModelProperty(value = "出库净重")
+	private BigDecimal outNetWeight;
+	/**
 	 * 存储天数
 	 */
 	@ApiModelProperty(value = "存储天数")
@@ -233,11 +239,16 @@ public class InOutStorage implements Serializable {
 	@ApiModelProperty(value = "剩余件数")
 	private BigDecimal surplusQuantity;
 	/**
-	 * 剩余重
+	 * 剩余
 	 */
-	@ApiModelProperty(value = "剩余重")
+	@ApiModelProperty(value = "剩余重")
 	private BigDecimal surplusWeight;
 	/**
+	 * 剩余净重
+	 */
+	@ApiModelProperty(value = "剩余净重")
+	private BigDecimal surplusNetWeight;
+	/**
 	 * 剩余货值
 	 */
 	@ApiModelProperty(value = "剩余货值")
@@ -266,6 +277,13 @@ public class InOutStorage implements Serializable {
 	private String whetherInOutStorage;
 
 	/**
+	 * 计费日期
+	 */
+	@ApiModelProperty(value = "计费日期")
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
+	private Date chargingDate;
+
+	/**
 	 * 仓储费单价收
 	 */
 	@TableField(exist = false)
@@ -278,4 +296,5 @@ public class InOutStorage implements Serializable {
 	private BigDecimal storageFeePriceC;
 
 
+
 }

+ 109 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/trade/entity/PayableStorageFees.java

@@ -0,0 +1,109 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.trade.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 应付仓储费表实体类
+ *
+ * @author BladeX
+ * @since 2025-03-03
+ */
+@Data
+@TableName("trade_payable_storage_fees")
+@ApiModel(value = "PayableStorageFees对象", description = "应付仓储费表")
+public class PayableStorageFees implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	private Long id;
+	/**
+	 * 仓库
+	 */
+	@ApiModelProperty(value = "仓库")
+	private Long warehouseId;
+	/**
+	 * 仓库名称
+	 */
+	@ApiModelProperty(value = "仓库名称")
+	private String warehouseName;
+	/**
+	 * 计费起始时间
+	 */
+	@ApiModelProperty(value = "计费起始时间")
+	private Date chargingStartDate;
+	/**
+	 * 计费结束时间
+	 */
+	@ApiModelProperty(value = "计费结束时间")
+	private Date chargingEndDate;
+	/**
+	 * 创建人
+	 */
+	@ApiModelProperty(value = "创建人")
+	private Long createUser;
+	/**
+	 * 创建时间
+	 */
+	@ApiModelProperty(value = "创建时间")
+	private Date createTime;
+	/**
+	 * 修改人
+	 */
+	@ApiModelProperty(value = "修改人")
+	private Long updateUser;
+	/**
+	 * 修改时间
+	 */
+	@ApiModelProperty(value = "修改时间")
+	private Date updateTime;
+	/**
+	 * 是否已删除(0 否 1是)
+	 */
+	@ApiModelProperty(value = "是否已删除(0 否 1是)")
+	private Integer isDeleted;
+	/**
+	 * 备注
+	 */
+	@ApiModelProperty(value = "备注")
+	private String remarks;
+	/**
+	 * 合计金额
+	 */
+	@ApiModelProperty(value = "合计金额")
+	private BigDecimal amount;
+	@ApiModelProperty(value = "租户")
+	private String tenantId;
+
+	/**
+	 * 仓储费明细
+	 */
+	@TableField(exist = false)
+	private List<PayableStorageFeesItems> storageFeesItemsList;
+
+
+}

+ 154 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/trade/entity/PayableStorageFeesItems.java

@@ -0,0 +1,154 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.trade.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.util.Date;
+
+/**
+ * 应付仓储费明细表实体类
+ *
+ * @author BladeX
+ * @since 2025-03-03
+ */
+@Data
+@TableName("trade_payable_storage_fees_items")
+@ApiModel(value = "PayableStorageFeesItems对象", description = "应付仓储费明细表")
+public class PayableStorageFeesItems implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	private Long id;
+	private Long pid;
+	/**
+	 * 创建人
+	 */
+	@ApiModelProperty(value = "创建人")
+	private Long createUser;
+	/**
+	 * 创建时间
+	 */
+	@ApiModelProperty(value = "创建时间")
+	private Date createTime;
+	/**
+	 * 修改人
+	 */
+	@ApiModelProperty(value = "修改人")
+	private Long updateUser;
+	/**
+	 * 修改时间
+	 */
+	@ApiModelProperty(value = "修改时间")
+	private Date updateTime;
+	/**
+	 * 是否已删除(0 否 1是)
+	 */
+	@ApiModelProperty(value = "是否已删除(0 否 1是)")
+	private Integer isDeleted;
+	/**
+	 * 备注
+	 */
+	@ApiModelProperty(value = "备注")
+	private String remarks;
+	/**
+	 * 合同号
+	 */
+	@ApiModelProperty(value = "合同号")
+	private String contractNumber;
+	/**
+	 * 提单号
+	 */
+	@ApiModelProperty(value = "提单号")
+	private String billNo;
+	/**
+	 * 入库时间
+	 */
+	@ApiModelProperty(value = "入库时间")
+	private Date storageDate;
+	/**
+	 * 剩余件数
+	 */
+	@ApiModelProperty(value = "剩余件数")
+	private BigDecimal surplusQuantity;
+	/**
+	 * 剩余净重
+	 */
+	@ApiModelProperty(value = "剩余净重")
+	private BigDecimal surplusNetWeight;
+	/**
+	 * 剩余毛重
+	 */
+	@ApiModelProperty(value = "剩余毛重")
+	private BigDecimal surplusWeight;
+	/**
+	 * 仓储费金额
+	 */
+	@ApiModelProperty(value = "仓储费金额")
+	private BigDecimal amount;
+	/**
+	 * 计费起始时间
+	 */
+	@ApiModelProperty(value = "计费起始时间")
+	private Date chargingStartDate;
+	/**
+	 * 计费结束时间
+	 */
+	@ApiModelProperty(value = "计费结束时间")
+	private Date chargingEndDate;
+	/**
+	 * 计费天数
+	 */
+	@ApiModelProperty(value = "计费天数")
+	private Integer chargingDay;
+	/**
+	 * 单据id
+	 */
+	@ApiModelProperty(value = "单据id")
+	private Long documentId;
+	@ApiModelProperty(value = "租户")
+	private String tenantId;
+	/**
+	 * 费用 Id
+	 */
+	@ApiModelProperty(value = "费用 Id")
+	private Long feeId;
+	/**
+	 * 费用中文名称
+	 */
+	@ApiModelProperty(value = "费用中文名称")
+	private String feeCode;
+	/**
+	 * 费用中文名称
+	 */
+	@ApiModelProperty(value = "费用中文名称")
+	private String feeCnName;
+	/**
+	 * 费用英文名称
+	 */
+	@ApiModelProperty(value = "费用英文名称")
+	private String feeEnName;
+
+
+}

+ 10 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/trade/entity/Storage.java

@@ -94,6 +94,16 @@ public class Storage implements Serializable {
 	 */
 	@ApiModelProperty(value = "仓库名称")
 	private String cname;
+	/**
+	 * 计费规则
+	 */
+	@ApiModelProperty(value = "计费规则")
+	private String billingRules;
+	/**
+	 * 库存预警(吨)
+	 */
+	@ApiModelProperty(value = "库存预警(吨)")
+	private String inventoryAlert;
 
 	@TableField(exist = false)
 	private List<StorageFeeItems> storageFeeItemsList;

+ 36 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/trade/vo/PayableStorageFeesItemsVO.java

@@ -0,0 +1,36 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.trade.vo;
+
+import org.springblade.los.trade.entity.PayableStorageFeesItems;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+
+/**
+ * 应付仓储费明细表视图实体类
+ *
+ * @author BladeX
+ * @since 2025-03-03
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "PayableStorageFeesItemsVO对象", description = "应付仓储费明细表")
+public class PayableStorageFeesItemsVO extends PayableStorageFeesItems {
+	private static final long serialVersionUID = 1L;
+
+}

+ 36 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/trade/vo/PayableStorageFeesVO.java

@@ -0,0 +1,36 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.trade.vo;
+
+import org.springblade.los.trade.entity.PayableStorageFees;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+
+/**
+ * 应付仓储费表视图实体类
+ *
+ * @author BladeX
+ * @since 2025-03-03
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "PayableStorageFeesVO对象", description = "应付仓储费表")
+public class PayableStorageFeesVO extends PayableStorageFees {
+	private static final long serialVersionUID = 1L;
+
+}

+ 0 - 3
blade-service-api/trade-finance-api/src/main/java/org/springblade/finance/dto/SettlementDTO.java

@@ -43,9 +43,6 @@ import java.util.List;
 public class SettlementDTO extends Settlement {
 	private static final long serialVersionUID = 1L;
 
-	@ApiModelProperty(value = "收付款文件列表")
-	private List<Files> filesList;
-
 	@ApiModelProperty(value = "收付款明细列表")
 	private List<Items> itemsList;
 

+ 3 - 0
blade-service-api/trade-finance-api/src/main/java/org/springblade/finance/vojo/Files.java

@@ -116,5 +116,8 @@ public class Files implements Serializable {
 	@ApiModelProperty(value = "租户id")
 	private String tenantId;
 
+	@ApiModelProperty(value = "文件属性")
+	private String paymentType;
+
 
 }

+ 3 - 0
blade-service-api/trade-finance-api/src/main/java/org/springblade/finance/vojo/Settlement.java

@@ -345,4 +345,7 @@ public class Settlement implements Serializable {
 	@ApiModelProperty(value = "箱号")
 	private String code;
 
+	@TableField(exist = false)
+	private List<Files> filesList;
+
 }

+ 24 - 18
blade-service/blade-land/src/main/java/org/springblade/land/controller/ExpenseSettlementController.java

@@ -17,25 +17,25 @@
 package org.springblade.land.controller;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
-import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import lombok.AllArgsConstructor;
-import javax.validation.Valid;
-
+import org.springblade.core.boot.ctrl.BladeController;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
-import org.springframework.web.bind.annotation.*;
-import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.springblade.land.entity.ExpenseSettlement;
-import org.springblade.land.vo.ExpenseSettlementVO;
 import org.springblade.land.service.IExpenseSettlementService;
-import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.land.vo.ExpenseSettlementVO;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
 
 /**
  * VIEW 控制器
@@ -70,20 +70,26 @@ public class ExpenseSettlementController extends BladeController {
 	@ApiOperation(value = "分页", notes = "传入expenseSettlement")
 	public R<IPage<ExpenseSettlement>> list(ExpenseSettlement expenseSettlement, Query query) {
 		LambdaQueryWrapper<ExpenseSettlement> lambdaQueryWrapper = new LambdaQueryWrapper<>();
-		lambdaQueryWrapper.eq(ExpenseSettlement::getIsDeleted,0)
+		lambdaQueryWrapper.eq(ExpenseSettlement::getIsDeleted, 0)
 			.eq(ExpenseSettlement::getTenantId, AuthUtil.getTenantId())
-			.eq(ObjectUtils.isNotNull(expenseSettlement.getCorpId()),ExpenseSettlement::getCorpId,expenseSettlement.getCorpId())
-			.eq(ObjectUtils.isNotNull(expenseSettlement.getFeeId()),ExpenseSettlement::getFeeId,expenseSettlement.getFeeId())
-			.eq(ObjectUtils.isNotNull(expenseSettlement.getFleetId()),ExpenseSettlement::getFleetId,expenseSettlement.getFleetId())
-			.like(ObjectUtils.isNotNull(expenseSettlement.getPlateNo()),ExpenseSettlement::getPlateNo,expenseSettlement.getPlateNo())
-			.like(ObjectUtils.isNotNull(expenseSettlement.getSrcBillNo()),ExpenseSettlement::getSrcBillNo,expenseSettlement.getSrcBillNo())
-			.like(ObjectUtils.isNotNull(expenseSettlement.getSrcOrderNo()),ExpenseSettlement::getSrcOrderNo,expenseSettlement.getSrcOrderNo())
-			.like(ObjectUtils.isNotNull(expenseSettlement.getBillNo()),ExpenseSettlement::getBillNo,expenseSettlement.getBillNo())
-			.eq(ObjectUtils.isNotNull(expenseSettlement.getDc()),ExpenseSettlement::getDc,expenseSettlement.getDc())
-			.eq(ObjectUtils.isNotNull(expenseSettlement.getSrcType()),ExpenseSettlement::getSrcType,expenseSettlement.getSrcType())
+			.eq(ObjectUtils.isNotNull(expenseSettlement.getCorpId()), ExpenseSettlement::getCorpId, expenseSettlement.getCorpId())
+			.eq(ObjectUtils.isNotNull(expenseSettlement.getFeeId()), ExpenseSettlement::getFeeId, expenseSettlement.getFeeId())
+			.eq(ObjectUtils.isNotNull(expenseSettlement.getFleetId()), ExpenseSettlement::getFleetId, expenseSettlement.getFleetId())
+			.like(ObjectUtils.isNotNull(expenseSettlement.getPlateNo()), ExpenseSettlement::getPlateNo, expenseSettlement.getPlateNo())
+			.like(ObjectUtils.isNotNull(expenseSettlement.getSrcBillNo()), ExpenseSettlement::getSrcBillNo, expenseSettlement.getSrcBillNo())
+			.like(ObjectUtils.isNotNull(expenseSettlement.getSrcOrderNo()), ExpenseSettlement::getSrcOrderNo, expenseSettlement.getSrcOrderNo())
+			.like(ObjectUtils.isNotNull(expenseSettlement.getBillNo()), ExpenseSettlement::getBillNo, expenseSettlement.getBillNo())
+			.eq(ObjectUtils.isNotNull(expenseSettlement.getDc()), ExpenseSettlement::getDc, expenseSettlement.getDc())
 			.apply("amount - settlement_amount != 0")
-			;
+		;
 		IPage<ExpenseSettlement> pages = expenseSettlementService.page(Condition.getPage(query), lambdaQueryWrapper);
+		for (ExpenseSettlement item : pages.getRecords()) {
+			if ("1".equals(expenseSettlement.getSrcType()) || "2".equals(expenseSettlement.getSrcType())) {
+				item.setThisAmount(item.getAmount().subtract(item.getSettlementAmount()));
+			} else {
+				item.setThisAmount(item.getAmount().subtract(item.getReconciliationAmount()));
+			}
+		}
 		return R.data(pages);
 	}
 

+ 18 - 0
blade-service/blade-land/src/main/java/org/springblade/land/controller/OrderController.java

@@ -396,4 +396,22 @@ public class OrderController extends BladeController {
 		return R.data(orderService.addOrderEstimate(order));
 	}
 
+	/**
+	 * 明细
+	 */
+	@PostMapping("/selectOrderList")
+	public List<LandOrder> selectOrderList(@RequestBody List<Long> orderIdList) {
+		return orderService.list(new LambdaQueryWrapper<LandOrder>()
+			.eq(LandOrder::getIsDeleted, 0)
+			.in(LandOrder::getId, orderIdList));
+	}
+
+	/**
+	 * 明细
+	 */
+	@PostMapping("/updateOrderList")
+	public R updateOrderList(@RequestBody List<LandOrder> orderListNew) {
+		return R.data(orderService.updateBatchById(orderListNew));
+	}
+
 }

+ 1 - 1
blade-service/blade-land/src/main/java/org/springblade/land/controller/OrderItemController.java

@@ -299,7 +299,7 @@ public class OrderItemController extends BladeController {
 	}
 
 	/**
-	 * 费用明细
+	 * 明细
 	 */
 	@PostMapping("/updateOrderItemsList")
 	public R updateOrderItemsList(@RequestBody List<OrderItem> orderItemsNew) {

+ 10 - 1
blade-service/blade-los/src/main/java/org/springblade/los/check/controller/AuditProecessController.java

@@ -101,6 +101,12 @@ public class AuditProecessController extends BladeController {
 		List<LosAuditProecess> auditProecessList = pages.getRecords();
 		if (CollectionUtils.isNotEmpty(auditProecessList)) {
 			List<Long> corpIds = auditProecessList.stream().map(LosAuditProecess::getCorpId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
+			List<Long> billIds = auditProecessList.stream().map(LosAuditProecess::getBillId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
+			List<LosAuditProecess> losAuditProecessList = auditProecessService.list(new LambdaQueryWrapper<LosAuditProecess>()
+				.eq(LosAuditProecess::getTenantId, AuthUtil.getTenantId())
+				.eq(LosAuditProecess::getIsDelete, 0)
+				.in(LosAuditProecess::getBillId, billIds)
+				.eq(LosAuditProecess::getAuditStatus, "A"));
 			List<BCorps> bCorpsList = null;
 			if (!corpIds.isEmpty()) {
 				bCorpsList = bCorpsService.list(new LambdaQueryWrapper<BCorps>()
@@ -135,6 +141,9 @@ public class AuditProecessController extends BladeController {
 						auditOrderVO.setCorpsName(bCorps.getCnName());
 					}
 				}
+				if (!losAuditProecessList.isEmpty()) {
+					auditOrderVO.setLevel(losAuditProecessList.stream().filter(i -> i.getBillId().equals(e.getBillId())).count());
+				}
 				auditOrderVOS.add(auditOrderVO);
 			}
 			pages.setRecords(auditOrderVOS);
@@ -243,7 +252,7 @@ public class AuditProecessController extends BladeController {
 			"aea-approve".equals(proecess.getCheckType()) || "aia-approve".equals(proecess.getCheckType())) {
 			auditProecessService.amendsCheck(auditProecess);
 		} else if ("MYDL".equals(proecess.getCheckType()) || "FFSQ-SK".equals(proecess.getCheckType())
-			|| "FFSQ-WK".equals(proecess.getCheckType())|| "YSQR-D".equals(proecess.getCheckType())
+			|| "FFSQ-WK".equals(proecess.getCheckType()) || "YSQR-D".equals(proecess.getCheckType())
 			|| "YSQR-C".equals(proecess.getCheckType())) {
 			auditProecessService.agentCheck(auditProecess);
 		}

+ 1 - 3
blade-service/blade-los/src/main/java/org/springblade/los/check/service/impl/AuditProecessServiceImpl.java

@@ -204,9 +204,7 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, L
 
 			auditProecess.setPayAmount(auditProecessDTO.getPayAmount());
 			auditProecess.setReceivableAmount(auditProecessDTO.getReceivableAmount());
-			auditProecess.setGrossProfit(auditProecessDTO.getGrossProfit());
-			auditProecess.setGrossProfitUsd(auditProecessDTO.getGrossProfitUsd());
-			auditProecess.setGrossProfitLoc(auditProecessDTO.getGrossProfitLoc());
+			auditProecess.setGrossProfit(auditProecessDTO.getGrossProfitLoc());
 			auditProecess.setReferenceNumber(auditProecessDTO.getReferenceNumber());
 			//除了第一级是待审,其他都N
 			if (e.getLevelId() == 1) {

+ 146 - 0
blade-service/blade-los/src/main/java/org/springblade/los/trade/controller/PayableStorageFeesController.java

@@ -0,0 +1,146 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.trade.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.AllArgsConstructor;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.los.trade.entity.PayableStorageFees;
+import org.springblade.los.trade.entity.PayableStorageFeesItems;
+import org.springblade.los.trade.service.IPayableStorageFeesService;
+import org.springblade.los.trade.vo.PayableStorageFeesVO;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.util.List;
+
+/**
+ * 应付仓储费表 控制器
+ *
+ * @author BladeX
+ * @since 2025-03-03
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/payablestoragefees")
+@Api(value = "应付仓储费表", tags = "应付仓储费表接口")
+public class PayableStorageFeesController extends BladeController {
+
+	private final IPayableStorageFeesService payableStorageFeesService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入payableStorageFees")
+	public R<PayableStorageFees> detail(PayableStorageFees payableStorageFees) {
+		PayableStorageFees detail = payableStorageFeesService.detail(payableStorageFees);
+		return R.data(detail);
+	}
+
+	/**
+	 * 分页 应付仓储费表
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入payableStorageFees")
+	public R<IPage<PayableStorageFees>> list(PayableStorageFees payableStorageFees, Query query) {
+		LambdaQueryWrapper<PayableStorageFees> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+		lambdaQueryWrapper.eq(PayableStorageFees::getTenantId, AuthUtil.getTenantId())
+			.eq(PayableStorageFees::getIsDeleted, 0)
+			.eq(ObjectUtils.isNotNull(payableStorageFees.getWarehouseId()), PayableStorageFees::getWarehouseId, payableStorageFees.getWarehouseId())
+			.like(ObjectUtils.isNotNull(payableStorageFees.getWarehouseId()), PayableStorageFees::getWarehouseName, payableStorageFees.getWarehouseName())
+			.orderByDesc(PayableStorageFees::getChargingEndDate);
+		IPage<PayableStorageFees> pages = payableStorageFeesService.page(Condition.getPage(query), Condition.getQueryWrapper(payableStorageFees));
+		return R.data(pages);
+	}
+
+	/**
+	 * 自定义分页 应付仓储费表
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入payableStorageFees")
+	public R<IPage<PayableStorageFeesVO>> page(PayableStorageFeesVO payableStorageFees, Query query) {
+		IPage<PayableStorageFeesVO> pages = payableStorageFeesService.selectPayableStorageFeesPage(Condition.getPage(query), payableStorageFees);
+		return R.data(pages);
+	}
+
+	/**
+	 * 新增 应付仓储费表
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入payableStorageFees")
+	public R save(@Valid @RequestBody PayableStorageFees payableStorageFees) {
+		return R.status(payableStorageFeesService.save(payableStorageFees));
+	}
+
+	/**
+	 * 修改 应付仓储费表
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入payableStorageFees")
+	public R update(@Valid @RequestBody PayableStorageFees payableStorageFees) {
+		return R.status(payableStorageFeesService.updateById(payableStorageFees));
+	}
+
+	/**
+	 * 新增或修改 应付仓储费表
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入payableStorageFees")
+	public R submit(@Valid @RequestBody PayableStorageFees payableStorageFees) {
+		return payableStorageFeesService.submit(payableStorageFees);
+	}
+
+
+	/**
+	 * 删除 应付仓储费表
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(payableStorageFeesService.removeByIds(Func.toLongList(ids)));
+	}
+
+
+	/**
+	 * 计算仓储费
+	 */
+	@GetMapping("/calculateStorageFees")
+	public R<List<PayableStorageFeesItems>> calculateStorageFees(PayableStorageFeesVO payableStorageFees) {
+		return payableStorageFeesService.calculateStorageFees(payableStorageFees);
+	}
+
+
+}

+ 126 - 0
blade-service/blade-los/src/main/java/org/springblade/los/trade/controller/PayableStorageFeesItemsController.java

@@ -0,0 +1,126 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.trade.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import lombok.AllArgsConstructor;
+import javax.validation.Valid;
+
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.web.bind.annotation.*;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.los.trade.entity.PayableStorageFeesItems;
+import org.springblade.los.trade.vo.PayableStorageFeesItemsVO;
+import org.springblade.los.trade.service.IPayableStorageFeesItemsService;
+import org.springblade.core.boot.ctrl.BladeController;
+
+/**
+ * 应付仓储费明细表 控制器
+ *
+ * @author BladeX
+ * @since 2025-03-03
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/payablestoragefeesitems")
+@Api(value = "应付仓储费明细表", tags = "应付仓储费明细表接口")
+public class PayableStorageFeesItemsController extends BladeController {
+
+	private final IPayableStorageFeesItemsService payableStorageFeesItemsService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入payableStorageFeesItems")
+	public R<PayableStorageFeesItems> detail(PayableStorageFeesItems payableStorageFeesItems) {
+		PayableStorageFeesItems detail = payableStorageFeesItemsService.getOne(Condition.getQueryWrapper(payableStorageFeesItems));
+		return R.data(detail);
+	}
+
+	/**
+	 * 分页 应付仓储费明细表
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入payableStorageFeesItems")
+	public R<IPage<PayableStorageFeesItems>> list(PayableStorageFeesItems payableStorageFeesItems, Query query) {
+		IPage<PayableStorageFeesItems> pages = payableStorageFeesItemsService.page(Condition.getPage(query), Condition.getQueryWrapper(payableStorageFeesItems));
+		return R.data(pages);
+	}
+
+	/**
+	 * 自定义分页 应付仓储费明细表
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入payableStorageFeesItems")
+	public R<IPage<PayableStorageFeesItemsVO>> page(PayableStorageFeesItemsVO payableStorageFeesItems, Query query) {
+		IPage<PayableStorageFeesItemsVO> pages = payableStorageFeesItemsService.selectPayableStorageFeesItemsPage(Condition.getPage(query), payableStorageFeesItems);
+		return R.data(pages);
+	}
+
+	/**
+	 * 新增 应付仓储费明细表
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入payableStorageFeesItems")
+	public R save(@Valid @RequestBody PayableStorageFeesItems payableStorageFeesItems) {
+		return R.status(payableStorageFeesItemsService.save(payableStorageFeesItems));
+	}
+
+	/**
+	 * 修改 应付仓储费明细表
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入payableStorageFeesItems")
+	public R update(@Valid @RequestBody PayableStorageFeesItems payableStorageFeesItems) {
+		return R.status(payableStorageFeesItemsService.updateById(payableStorageFeesItems));
+	}
+
+	/**
+	 * 新增或修改 应付仓储费明细表
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入payableStorageFeesItems")
+	public R submit(@Valid @RequestBody PayableStorageFeesItems payableStorageFeesItems) {
+		return R.status(payableStorageFeesItemsService.saveOrUpdate(payableStorageFeesItems));
+	}
+
+	
+	/**
+	 * 删除 应付仓储费明细表
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(payableStorageFeesItemsService.removeByIds(Func.toLongList(ids)));
+	}
+
+	
+}

+ 42 - 0
blade-service/blade-los/src/main/java/org/springblade/los/trade/mapper/PayableStorageFeesItemsMapper.java

@@ -0,0 +1,42 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.trade.mapper;
+
+import org.springblade.los.trade.entity.PayableStorageFeesItems;
+import org.springblade.los.trade.vo.PayableStorageFeesItemsVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+
+/**
+ * 应付仓储费明细表 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2025-03-03
+ */
+public interface PayableStorageFeesItemsMapper extends BaseMapper<PayableStorageFeesItems> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param payableStorageFeesItems
+	 * @return
+	 */
+	List<PayableStorageFeesItemsVO> selectPayableStorageFeesItemsPage(IPage page, PayableStorageFeesItemsVO payableStorageFeesItems);
+
+}

+ 33 - 0
blade-service/blade-los/src/main/java/org/springblade/los/trade/mapper/PayableStorageFeesItemsMapper.xml

@@ -0,0 +1,33 @@
+<?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="org.springblade.los.trade.mapper.PayableStorageFeesItemsMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="payableStorageFeesItemsResultMap" type="org.springblade.los.trade.entity.PayableStorageFeesItems">
+        <id column="id" property="id"/>
+        <result column="pid" property="pid"/>
+        <result column="create_user" property="createUser"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_user" property="updateUser"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="is_deleted" property="isDeleted"/>
+        <result column="remarks" property="remarks"/>
+        <result column="contract_number" property="contractNumber"/>
+        <result column="bill_no" property="billNo"/>
+        <result column="storage_date" property="storageDate"/>
+        <result column="surplus_quantity" property="surplusQuantity"/>
+        <result column="surplus_net_weight" property="surplusNetWeight"/>
+        <result column="surplus_weight" property="surplusWeight"/>
+        <result column="amount" property="amount"/>
+        <result column="charging_start_date" property="chargingStartDate"/>
+        <result column="charging_end_date" property="chargingEndDate"/>
+        <result column="charging_day" property="chargingDay"/>
+        <result column="document_id" property="documentId"/>
+    </resultMap>
+
+
+    <select id="selectPayableStorageFeesItemsPage" resultMap="payableStorageFeesItemsResultMap">
+        select * from trade_payable_storage_fees_items where is_deleted = 0
+    </select>
+
+</mapper>

+ 42 - 0
blade-service/blade-los/src/main/java/org/springblade/los/trade/mapper/PayableStorageFeesMapper.java

@@ -0,0 +1,42 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.trade.mapper;
+
+import org.springblade.los.trade.entity.PayableStorageFees;
+import org.springblade.los.trade.vo.PayableStorageFeesVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+
+/**
+ * 应付仓储费表 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2025-03-03
+ */
+public interface PayableStorageFeesMapper extends BaseMapper<PayableStorageFees> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param payableStorageFees
+	 * @return
+	 */
+	List<PayableStorageFeesVO> selectPayableStorageFeesPage(IPage page, PayableStorageFeesVO payableStorageFees);
+
+}

+ 26 - 0
blade-service/blade-los/src/main/java/org/springblade/los/trade/mapper/PayableStorageFeesMapper.xml

@@ -0,0 +1,26 @@
+<?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="org.springblade.los.trade.mapper.PayableStorageFeesMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="payableStorageFeesResultMap" type="org.springblade.los.trade.entity.PayableStorageFees">
+        <id column="id" property="id"/>
+        <result column="warehouse_id" property="warehouseId"/>
+        <result column="warehouse_name" property="warehouseName"/>
+        <result column="charging_start_date" property="chargingStartDate"/>
+        <result column="charging_end_date" property="chargingEndDate"/>
+        <result column="create_user" property="createUser"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_user" property="updateUser"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="is_deleted" property="isDeleted"/>
+        <result column="remarks" property="remarks"/>
+        <result column="amount" property="amount"/>
+    </resultMap>
+
+
+    <select id="selectPayableStorageFeesPage" resultMap="payableStorageFeesResultMap">
+        select * from trade_payable_storage_fees where is_deleted = 0
+    </select>
+
+</mapper>

+ 41 - 0
blade-service/blade-los/src/main/java/org/springblade/los/trade/service/IPayableStorageFeesItemsService.java

@@ -0,0 +1,41 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.trade.service;
+
+import org.springblade.los.trade.entity.PayableStorageFeesItems;
+import org.springblade.los.trade.vo.PayableStorageFeesItemsVO;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 应付仓储费明细表 服务类
+ *
+ * @author BladeX
+ * @since 2025-03-03
+ */
+public interface IPayableStorageFeesItemsService extends IService<PayableStorageFeesItems> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param payableStorageFeesItems
+	 * @return
+	 */
+	IPage<PayableStorageFeesItemsVO> selectPayableStorageFeesItemsPage(IPage<PayableStorageFeesItemsVO> page, PayableStorageFeesItemsVO payableStorageFeesItems);
+
+}

+ 50 - 0
blade-service/blade-los/src/main/java/org/springblade/los/trade/service/IPayableStorageFeesService.java

@@ -0,0 +1,50 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.trade.service;
+
+import org.springblade.core.tool.api.R;
+import org.springblade.los.trade.entity.PayableStorageFees;
+import org.springblade.los.trade.entity.PayableStorageFeesItems;
+import org.springblade.los.trade.vo.PayableStorageFeesVO;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+import java.util.List;
+
+/**
+ * 应付仓储费表 服务类
+ *
+ * @author BladeX
+ * @since 2025-03-03
+ */
+public interface IPayableStorageFeesService extends IService<PayableStorageFees> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param payableStorageFees
+	 * @return
+	 */
+	IPage<PayableStorageFeesVO> selectPayableStorageFeesPage(IPage<PayableStorageFeesVO> page, PayableStorageFeesVO payableStorageFees);
+
+	R submit(PayableStorageFees payableStorageFees);
+
+	PayableStorageFees detail(PayableStorageFees payableStorageFees);
+
+	R<List<PayableStorageFeesItems>> calculateStorageFees(PayableStorageFeesVO payableStorageFees);
+}

+ 2 - 1
blade-service/blade-los/src/main/java/org/springblade/los/trade/service/impl/DispatchVehiclesServiceImpl.java

@@ -133,7 +133,8 @@ public class DispatchVehiclesServiceImpl extends ServiceImpl<DispatchVehiclesMap
 		inOutStorage.setTel(dispatchVehicles.getContactInformation());
 		inOutStorage.setBillType("RK");
 		inOutStorage.setSurplusQuantity(dispatchVehicles.getNumber());
-		inOutStorage.setSurplusWeight(dispatchVehicles.getNetWeight());
+		inOutStorage.setSurplusWeight(dispatchVehicles.getGrossWeight());
+		inOutStorage.setSurplusNetWeight(dispatchVehicles.getNetWeight());
 		inOutStorage.setSurplusGoodsAmount(dispatchVehicles.getNetWeight().multiply(dispatchVehicles.getPrice()));
 		inOutStorage.setHsCode(dispatchVehicles.getHsCode());
 		inOutStorage.setGoodsName(dispatchVehicles.getGoodsName());

+ 79 - 45
blade-service/blade-los/src/main/java/org/springblade/los/trade/service/impl/InOutStorageServiceImpl.java

@@ -41,8 +41,6 @@ import org.springblade.los.trade.entity.Storage;
 import org.springblade.los.trade.mapper.AgentItemsMapper;
 import org.springblade.los.trade.mapper.InOutStorageMapper;
 import org.springblade.los.trade.service.IInOutStorageService;
-import org.springblade.los.trade.service.IStorageFeeItemsService;
-import org.springblade.los.trade.service.IStorageFeeService;
 import org.springblade.los.trade.service.IStorageService;
 import org.springblade.los.trade.vo.InOutStorageVO;
 import org.springblade.system.entity.Dept;
@@ -77,10 +75,6 @@ public class InOutStorageServiceImpl extends ServiceImpl<InOutStorageMapper, InO
 
 	private final AgentItemsMapper agentItemsMapper;
 
-	private final IStorageFeeService storageFeeService;
-
-	private final IStorageFeeItemsService storageFeeItemsService;
-
 	private final IBFeesService bFeesService;
 
 	private final FeeCenterMapper feeCenterMapper;
@@ -99,6 +93,14 @@ public class InOutStorageServiceImpl extends ServiceImpl<InOutStorageMapper, InO
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public R confirmWarehouseEntry(InOutStorage inOutStorage) {
+		Storage storage = storageService.getById(inOutStorage.getWarehouseId());
+		if (storage == null) {
+			throw new RuntimeException("未查到仓库信息");
+		}
+		boolean billingRules = true;
+		if ("1".equals(storage.getBillingRules())) {
+			billingRules = false;
+		}
 		inOutStorage.setConfirmDispatchVehicles("1");
 		inOutStorage.setUpdateTime(new Date());
 		inOutStorage.setUpdateUser(AuthUtil.getUserId());
@@ -107,6 +109,7 @@ public class InOutStorageServiceImpl extends ServiceImpl<InOutStorageMapper, InO
 			if (ObjectUtils.isNull(inOutStorage.getStorageDate())) {
 				inOutStorage.setStorageDate(new Date());
 			}
+			inOutStorage.setChargingDate(inOutStorage.getStorageDate());
 			Bills bills = billsMapper.selectById(inOutStorage.getPid());
 			if (ObjectUtils.isNotNull(bills.getMconsigneeCntyName())) {
 				List<FeeCenter> feeCenterList = feeCenterMapper.selectList(new LambdaQueryWrapper<FeeCenter>()
@@ -134,17 +137,6 @@ public class InOutStorageServiceImpl extends ServiceImpl<InOutStorageMapper, InO
 				if (feeCenterTradeList.isEmpty()) {
 					throw new RuntimeException("未查到提单号:" + bills.getMblno() + "对应贸易代理费用信息");
 				}
-				/*List<Long> ids = feeCenterTradeList.stream().map(FeeCenter::getPid).filter(Objects::nonNull)
-					.distinct().collect(Collectors.toList());
-				List<FeeCenter> feeCenterTradeList1 = feeCenterMapper.selectList(new LambdaQueryWrapper<FeeCenter>()
-					.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
-					.eq(FeeCenter::getIsDeleted, 0)
-					.in(FeeCenter::getPid, ids)
-					.eq(FeeCenter::getDc, "C")
-					.apply("find_in_set(fee_code,'SXF,YDF') and (mblno IS NULL or mblno = '')"));
-				if (!feeCenterTradeList1.isEmpty()) {
-					feeCenterTradeList.addAll(feeCenterTradeList1);
-				}*/
 				List<AgentItems> agentItemsList = agentItemsMapper.selectList(new LambdaQueryWrapper<AgentItems>()
 					.eq(AgentItems::getPid, feeCenterTradeList.get(0).getPid())
 					.eq(AgentItems::getTenantId, AuthUtil.getTenantId())
@@ -235,6 +227,11 @@ public class InOutStorageServiceImpl extends ServiceImpl<InOutStorageMapper, InO
 			} else {
 				inOutStorage.setWarehouseUnitPrice(inOutStorage.getPrice());
 			}
+			if (billingRules) {
+				inOutStorage.setSurplusGoodsAmount(inOutStorage.getSurplusNetWeight().multiply(inOutStorage.getPrice()));
+			} else {
+				inOutStorage.setSurplusGoodsAmount(inOutStorage.getSurplusWeight().multiply(inOutStorage.getPrice()));
+			}
 		} else {
 			if (ObjectUtils.isNull(inOutStorage.getOutStorageDate())) {
 				inOutStorage.setOutStorageDate(new Date());
@@ -246,13 +243,23 @@ public class InOutStorageServiceImpl extends ServiceImpl<InOutStorageMapper, InO
 			}
 			BigDecimal grossWeight = inStorage.getSurplusWeight();
 			if (grossWeight.compareTo(inOutStorage.getOutWeight()) < 0) {
-				throw new RuntimeException("剩余重量:" + grossWeight + "小于出库重量:" + inOutStorage.getOutWeight());
+				throw new RuntimeException("剩余毛重:" + grossWeight + "小于出库毛重:" + inOutStorage.getOutWeight());
+			}
+			BigDecimal netWeight = inStorage.getSurplusNetWeight();
+			if (netWeight.compareTo(inOutStorage.getOutNetWeight()) < 0) {
+				throw new RuntimeException("剩余净重:" + netWeight + "小于出库净重:" + inOutStorage.getOutWeight());
 			}
 			inStorage.setOutQuantity(inStorage.getOutQuantity().add(inOutStorage.getOutQuantity()));
 			inStorage.setOutWeight(inStorage.getOutWeight().add(inOutStorage.getOutWeight()));
+			inStorage.setOutNetWeight(inStorage.getOutNetWeight().add(inOutStorage.getOutNetWeight()));
 			inStorage.setSurplusQuantity(quantity.subtract(inOutStorage.getOutQuantity()));
 			inStorage.setSurplusWeight(grossWeight.subtract(inOutStorage.getOutWeight()));
-			inStorage.setSurplusGoodsAmount(inStorage.getSurplusWeight().multiply(inOutStorage.getPrice()));
+			inStorage.setSurplusNetWeight(netWeight.subtract(inOutStorage.getOutNetWeight()));
+			if (billingRules) {
+				inStorage.setSurplusGoodsAmount(inStorage.getSurplusWeight().multiply(inOutStorage.getPrice()));
+			} else {
+				inStorage.setSurplusGoodsAmount(inStorage.getSurplusNetWeight().multiply(inOutStorage.getPrice()));
+			}
 			inStorage.setUpdateTime(new Date());
 			inStorage.setUpdateUser(AuthUtil.getUserId());
 			inStorage.setUpdateUserName(AuthUtil.getUserName());
@@ -260,7 +267,12 @@ public class InOutStorageServiceImpl extends ServiceImpl<InOutStorageMapper, InO
 
 			inOutStorage.setSurplusQuantity(quantity.subtract(inOutStorage.getOutQuantity()));
 			inOutStorage.setSurplusWeight(grossWeight.subtract(inOutStorage.getOutWeight()));
-			inOutStorage.setSurplusGoodsAmount(inStorage.getSurplusWeight().multiply(inOutStorage.getPrice()));
+			inOutStorage.setSurplusNetWeight(netWeight.subtract(inOutStorage.getOutNetWeight()));
+			if (billingRules) {
+				inOutStorage.setSurplusGoodsAmount(inStorage.getSurplusWeight().multiply(inOutStorage.getPrice()));
+			} else {
+				inOutStorage.setSurplusGoodsAmount(inStorage.getSurplusNetWeight().multiply(inOutStorage.getPrice()));
+			}
 			Bills bills = billsMapper.selectById(inOutStorage.getPid());
 			if (bills != null) {
 				BFees fees = bFeesService.getOne(new LambdaQueryWrapper<BFees>()
@@ -275,10 +287,16 @@ public class InOutStorageServiceImpl extends ServiceImpl<InOutStorageMapper, InO
 				// 计算差多少天
 				long day = diff / nd + 1L;
 				StringBuilder remark = new StringBuilder("仓储费:");
-				BigDecimal outWeight = inOutStorage.getOutWeight().divide(new BigDecimal("1000"), 4, RoundingMode.HALF_UP);
+				BigDecimal weight;
+				BigDecimal amountSum;
+				if (billingRules) {
+					weight = inOutStorage.getOutNetWeight().divide(new BigDecimal("1000"), 4, RoundingMode.HALF_UP);
+				} else {
+					weight = inOutStorage.getOutWeight().divide(new BigDecimal("1000"), 4, RoundingMode.HALF_UP);
+				}
 				BigDecimal dayDecimal = new BigDecimal(day);
-				BigDecimal amountSum = dayDecimal.multiply(inOutStorage.getStorageFeePriceD()).multiply(outWeight);
-				remark.append(day).append("天*").append(inOutStorage.getStorageFeePriceD()).append("元*").append(outWeight).append("吨=").append(amountSum).append("元 ");
+				amountSum = dayDecimal.multiply(inOutStorage.getStorageFeePriceD()).multiply(weight);
+				remark.append(day).append("天*").append(inOutStorage.getStorageFeePriceD()).append("元*").append(weight).append("吨=").append(amountSum).append("元 ");
 				FeeCenter feeCenter = new FeeCenter();
 				feeCenter.setCreateTime(new Date());
 				feeCenter.setCreateUser(AuthUtil.getUserId());
@@ -318,7 +336,7 @@ public class InOutStorageServiceImpl extends ServiceImpl<InOutStorageMapper, InO
 				feeCenter.setElementsCnName(fees.getAccElementName());
 				feeCenter.setElementsEnName(fees.getElementsEnName());
 				feeCenter.setUnitNo("JOB");
-				feeCenter.setQuantity(outWeight);
+				feeCenter.setQuantity(weight);
 				feeCenter.setPrice(inOutStorage.getStorageFeePriceD());
 				feeCenter.setAmount(amountSum);
 				feeCenter.setRemarks(remark.toString());
@@ -327,9 +345,9 @@ public class InOutStorageServiceImpl extends ServiceImpl<InOutStorageMapper, InO
 				feeCenter.setOutboundDate(inOutStorage.getOutStorageDate());
 				feeCenter.setSrcItemId(inOutStorage.getId());
 				feeCenterMapper.insert(feeCenter);
-				StringBuilder remarkC = new StringBuilder("仓储费:");
-				BigDecimal amountSumC = dayDecimal.multiply(inOutStorage.getStorageFeePriceC()).multiply(outWeight);
-				remarkC.append(day).append("天*").append(inOutStorage.getStorageFeePriceC()).append("元*").append(outWeight).append("吨=").append(amountSumC).append("元 ");
+//				StringBuilder remarkC = new StringBuilder("仓储费:");
+				BigDecimal amountSumC = dayDecimal.multiply(inOutStorage.getStorageFeePriceC()).multiply(weight);
+				/*remarkC.append(day).append("天*").append(inOutStorage.getStorageFeePriceC()).append("元*").append(outWeight).append("吨=").append(amountSumC).append("元 ");
 				FeeCenter feeCenterC = new FeeCenter();
 				feeCenterC.setCreateTime(new Date());
 				feeCenterC.setCreateUser(AuthUtil.getUserId());
@@ -375,7 +393,7 @@ public class InOutStorageServiceImpl extends ServiceImpl<InOutStorageMapper, InO
 				feeCenterC.setStorageDate(inStorage.getStorageDate());
 				feeCenterC.setOutboundDate(inOutStorage.getOutStorageDate());
 				feeCenterC.setSrcItemId(inOutStorage.getId());
-				feeCenterMapper.insert(feeCenterC);
+				feeCenterMapper.insert(feeCenterC);*/
 				inOutStorage.setStorageDays(Integer.parseInt(day + ""));
 				inOutStorage.setStorageFeesAmount(amountSumC);
 			}
@@ -413,14 +431,25 @@ public class InOutStorageServiceImpl extends ServiceImpl<InOutStorageMapper, InO
 		outStorage.setUpdateUserName(null);
 		outStorage.setBillType("CK");
 		outStorage.setOutQuantity(inOutStorage.getQuantity().subtract(inOutStorage.getOutQuantity()));
-		outStorage.setOutWeight(inOutStorage.getNetWeight().subtract(inOutStorage.getOutWeight()));
+		outStorage.setOutWeight(inOutStorage.getGrossWeight().subtract(inOutStorage.getOutWeight()));
+		outStorage.setOutNetWeight(inOutStorage.getNetWeight().subtract(inOutStorage.getOutNetWeight()));
 		outStorage.setSurplusQuantity(inOutStorage.getQuantity().subtract(inOutStorage.getOutQuantity()));
-		outStorage.setSurplusWeight(inOutStorage.getNetWeight().subtract(inOutStorage.getOutWeight()));
-		outStorage.setSurplusGoodsAmount(inOutStorage.getSurplusWeight().multiply(inOutStorage.getPrice()));
+		outStorage.setSurplusNetWeight(inOutStorage.getNetWeight().subtract(inOutStorage.getOutNetWeight()));
+		outStorage.setSurplusWeight(inOutStorage.getGrossWeight().subtract(inOutStorage.getOutWeight()));
+		Storage storage = storageService.getById(inOutStorage.getWarehouseId());
+		if (storage == null) {
+			throw new RuntimeException("未查到仓库信息");
+		}
+		if ("1".equals(storage.getBillingRules())) {
+			outStorage.setSurplusGoodsAmount(inOutStorage.getSurplusWeight().multiply(inOutStorage.getPrice()));
+		} else {
+			outStorage.setSurplusGoodsAmount(inOutStorage.getSurplusNetWeight().multiply(inOutStorage.getPrice()));
+		}
 		outStorage.setConfirmDispatchVehicles("0");
 		baseMapper.insert(outStorage);
 		if (new BigDecimal("0.00").compareTo(inOutStorage.getSurplusQuantity()) == 0 &&
-			new BigDecimal("0.00").compareTo(inOutStorage.getSurplusWeight()) == 0) {
+			new BigDecimal("0.00").compareTo(inOutStorage.getSurplusWeight()) == 0 &&
+			new BigDecimal("0.00").compareTo(inOutStorage.getSurplusNetWeight()) == 0) {
 			throw new RuntimeException("库存余额为零,生成失败");
 		}
 
@@ -495,17 +524,6 @@ public class InOutStorageServiceImpl extends ServiceImpl<InOutStorageMapper, InO
 				if (feeCenterTradeList.isEmpty()) {
 					throw new RuntimeException("未查到提单号:" + bills.getMblno() + "对应贸易代理费用信息");
 				}
-				/*List<Long> ids = feeCenterTradeList.stream().map(FeeCenter::getPid).filter(Objects::nonNull)
-					.distinct().collect(Collectors.toList());
-				List<FeeCenter> feeCenterTradeList1 = feeCenterMapper.selectList(new LambdaQueryWrapper<FeeCenter>()
-					.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
-					.eq(FeeCenter::getIsDeleted, 0)
-					.in(FeeCenter::getPid, ids)
-					.eq(FeeCenter::getDc, "C")
-					.apply("find_in_set(fee_code,'SXF,YDF') and (mblno IS NULL or mblno = '')"));
-				if (!feeCenterTradeList1.isEmpty()) {
-					feeCenterTradeList.addAll(feeCenterTradeList1);
-				}*/
 				List<AgentItems> agentItemsList = agentItemsMapper.selectList(new LambdaQueryWrapper<AgentItems>()
 					.eq(AgentItems::getPid, feeCenterTradeList.get(0).getPid())
 					.eq(AgentItems::getTenantId, AuthUtil.getTenantId())
@@ -614,6 +632,7 @@ public class InOutStorageServiceImpl extends ServiceImpl<InOutStorageMapper, InO
 			if ("1".equals(inOutStorage.getWhetherInOutStorage())) {
 				throw new RuntimeException("已生成出库信息,撤销失败");
 			}
+			inOutStorage.setChargingDate(null);
 			Bills bills = billsMapper.selectById(inOutStorage.getPid());
 			if (ObjectUtils.isNotNull(bills.getMconsigneeCntyName())) {
 				List<FeeCenter> feeCenterTradeList = feeCenterMapper.selectList(new LambdaQueryWrapper<FeeCenter>()
@@ -644,15 +663,30 @@ public class InOutStorageServiceImpl extends ServiceImpl<InOutStorageMapper, InO
 				}
 			}
 		} else {
+			Storage storage = storageService.getById(inOutStorage.getWarehouseId());
+			if (storage == null) {
+				throw new RuntimeException("未查到仓库信息");
+			}
+			boolean billingRules = true;
+			if ("1".equals(storage.getBillingRules())) {
+				billingRules = false;
+			}
 			inOutStorage.setOutStorageDate(null);
 			InOutStorage inStorage = baseMapper.selectById(inOutStorage.getSrcId());
 			BigDecimal quantity = inStorage.getSurplusQuantity();
 			BigDecimal grossWeight = inStorage.getSurplusWeight();
+			BigDecimal netWeight = inStorage.getSurplusNetWeight();
 			inStorage.setOutQuantity(inStorage.getOutQuantity().subtract(inOutStorage.getOutQuantity()));
 			inStorage.setOutWeight(inStorage.getOutWeight().subtract(inOutStorage.getOutWeight()));
+			inStorage.setOutNetWeight(inStorage.getOutNetWeight().subtract(inOutStorage.getOutNetWeight()));
 			inStorage.setSurplusQuantity(quantity.add(inOutStorage.getOutQuantity()));
 			inStorage.setSurplusWeight(grossWeight.add(inOutStorage.getOutWeight()));
-			inStorage.setSurplusGoodsAmount(inStorage.getSurplusGoodsAmount().add(inStorage.getSurplusWeight().multiply(inOutStorage.getPrice())));
+			inStorage.setSurplusNetWeight(netWeight.add(inOutStorage.getOutNetWeight()));
+			if (billingRules){
+				inStorage.setSurplusGoodsAmount(inStorage.getSurplusGoodsAmount().add(inStorage.getSurplusNetWeight().multiply(inOutStorage.getPrice())));
+			}else{
+				inStorage.setSurplusGoodsAmount(inStorage.getSurplusGoodsAmount().add(inStorage.getSurplusWeight().multiply(inOutStorage.getPrice())));
+			}
 			inStorage.setUpdateTime(new Date());
 			inStorage.setUpdateUser(AuthUtil.getUserId());
 			inStorage.setUpdateUserName(AuthUtil.getUserName());
@@ -664,7 +698,7 @@ public class InOutStorageServiceImpl extends ServiceImpl<InOutStorageMapper, InO
 				.eq(FeeCenter::getPid, inOutStorage.getPid())
 				.eq(FeeCenter::getSrcItemId, inOutStorage.getId()));
 			if (!feeCenter.isEmpty()) {
-				for (FeeCenter item :feeCenter){
+				for (FeeCenter item : feeCenter) {
 					if (1 == item.getAccStatus()) {
 						throw new RuntimeException("仓储费已生成账单,撤销失败");
 					}

+ 41 - 0
blade-service/blade-los/src/main/java/org/springblade/los/trade/service/impl/PayableStorageFeesItemsServiceImpl.java

@@ -0,0 +1,41 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.trade.service.impl;
+
+import org.springblade.los.trade.entity.PayableStorageFeesItems;
+import org.springblade.los.trade.vo.PayableStorageFeesItemsVO;
+import org.springblade.los.trade.mapper.PayableStorageFeesItemsMapper;
+import org.springblade.los.trade.service.IPayableStorageFeesItemsService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 应付仓储费明细表 服务实现类
+ *
+ * @author BladeX
+ * @since 2025-03-03
+ */
+@Service
+public class PayableStorageFeesItemsServiceImpl extends ServiceImpl<PayableStorageFeesItemsMapper, PayableStorageFeesItems> implements IPayableStorageFeesItemsService {
+
+	@Override
+	public IPage<PayableStorageFeesItemsVO> selectPayableStorageFeesItemsPage(IPage<PayableStorageFeesItemsVO> page, PayableStorageFeesItemsVO payableStorageFeesItems) {
+		return page.setRecords(baseMapper.selectPayableStorageFeesItemsPage(page, payableStorageFeesItems));
+	}
+
+}

+ 211 - 0
blade-service/blade-los/src/main/java/org/springblade/los/trade/service/impl/PayableStorageFeesServiceImpl.java

@@ -0,0 +1,211 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.trade.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.AllArgsConstructor;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.api.R;
+import org.springblade.los.basic.fees.entity.BFees;
+import org.springblade.los.basic.fees.service.IBFeesService;
+import org.springblade.los.business.sea.entity.Bills;
+import org.springblade.los.business.sea.mapper.BillsMapper;
+import org.springblade.los.trade.entity.*;
+import org.springblade.los.trade.mapper.PayableStorageFeesMapper;
+import org.springblade.los.trade.service.*;
+import org.springblade.los.trade.vo.PayableStorageFeesItemsVO;
+import org.springblade.los.trade.vo.PayableStorageFeesVO;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 应付仓储费表 服务实现类
+ *
+ * @author BladeX
+ * @since 2025-03-03
+ */
+@Service
+@AllArgsConstructor
+public class PayableStorageFeesServiceImpl extends ServiceImpl<PayableStorageFeesMapper, PayableStorageFees> implements IPayableStorageFeesService {
+
+	private final IPayableStorageFeesItemsService payableStorageFeesItemsService;
+
+	private final IInOutStorageService inOutStorageService;
+
+	private final IStorageService storageService;
+
+	private final IBFeesService bFeesService;
+
+	private final BillsMapper billsMapper;
+
+	private final IStorageFeeItemsService storageFeeItemsService;
+
+	@Override
+	public IPage<PayableStorageFeesVO> selectPayableStorageFeesPage(IPage<PayableStorageFeesVO> page, PayableStorageFeesVO payableStorageFees) {
+		return page.setRecords(baseMapper.selectPayableStorageFeesPage(page, payableStorageFees));
+	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public R submit(PayableStorageFees payableStorageFees) {
+		if (payableStorageFees.getId() == null) {
+			payableStorageFees.setCreateTime(new Date());
+			payableStorageFees.setCreateUser(AuthUtil.getUserId());
+		} else {
+			payableStorageFees.setUpdateUser(AuthUtil.getUserId());
+			payableStorageFees.setUpdateTime(new Date());
+		}
+		this.saveOrUpdate(payableStorageFees);
+		if (ObjectUtils.isNotNull(payableStorageFees.getStorageFeesItemsList()) && !payableStorageFees.getStorageFeesItemsList().isEmpty()) {
+			for (PayableStorageFeesItems item : payableStorageFees.getStorageFeesItemsList()) {
+				item.setPid(payableStorageFees.getId());
+				if (item.getId() == null) {
+					item.setCreateTime(new Date());
+					item.setCreateUser(AuthUtil.getUserId());
+				} else {
+					item.setUpdateUser(AuthUtil.getUserId());
+					item.setUpdateTime(new Date());
+				}
+			}
+			payableStorageFeesItemsService.saveOrUpdateBatch(payableStorageFees.getStorageFeesItemsList());
+		}
+		return R.data(payableStorageFees);
+	}
+
+	@Override
+	public PayableStorageFees detail(PayableStorageFees payableStorageFees) {
+		PayableStorageFees detail = baseMapper.selectById(payableStorageFees.getId());
+		List<PayableStorageFeesItems> storageFeesItemsList = payableStorageFeesItemsService.list(new LambdaQueryWrapper<PayableStorageFeesItems>()
+			.eq(PayableStorageFeesItems::getTenantId, AuthUtil.getTenantId())
+			.eq(PayableStorageFeesItems::getIsDeleted, 0)
+			.eq(PayableStorageFeesItems::getPid, payableStorageFees.getId()));
+		detail.setStorageFeesItemsList(storageFeesItemsList.isEmpty() ? new ArrayList<>() : storageFeesItemsList);
+		return detail;
+	}
+
+	@Override
+	public R<List<PayableStorageFeesItems>> calculateStorageFees(PayableStorageFeesVO payableStorageFees) {
+		Storage storage = storageService.getById(payableStorageFees.getWarehouseId());
+		if (storage == null) {
+			throw new RuntimeException("未查到仓库信息");
+		}
+		List<StorageFeeItems> storageFeeItemsList = storageFeeItemsService.list(new LambdaQueryWrapper<StorageFeeItems>()
+			.eq(StorageFeeItems::getTenantId, AuthUtil.getTenantId())
+			.eq(StorageFeeItems::getIsDeleted, 0)
+			.eq(StorageFeeItems::getPid, storage.getId()));
+		if (storageFeeItemsList.isEmpty()) {
+			throw new RuntimeException("请先维护仓储费单价");
+		}
+		boolean billingRules = true;
+		if ("1".equals(storage.getBillingRules())) {
+			billingRules = false;
+		}
+		LambdaQueryWrapper<InOutStorage> lambdaQueryWrapper = new LambdaQueryWrapper<InOutStorage>()
+			.eq(InOutStorage::getTenantId, AuthUtil.getTenantId())
+			.eq(InOutStorage::getIsDeleted, 0)
+			.eq(InOutStorage::getWarehouseId, payableStorageFees.getWarehouseId())
+			.gt(InOutStorage::getChargingDate, payableStorageFees.getChargingStartDate())
+			.lt(InOutStorage::getChargingDate, payableStorageFees.getChargingEndDate());
+		List<InOutStorage> inOutStorageList = inOutStorageService.list(lambdaQueryWrapper);
+		BFees fees = bFeesService.getOne(new LambdaQueryWrapper<BFees>()
+			.eq(BFees::getTenantId, AuthUtil.getTenantId())
+			.eq(BFees::getIsDeleted, 0)
+			.eq(BFees::getCode, "CCF"));
+		if (fees == null) {
+			throw new RuntimeException("请先维护仓储费用基础信息");
+		}
+		long nd = 1000 * 24 * 60 * 60;
+		List<PayableStorageFeesItems> storageFeesItemsList = new ArrayList<>();
+		if (!inOutStorageList.isEmpty()) {
+			List<Long> idList = inOutStorageList.stream().map(InOutStorage::getPid).distinct().collect(Collectors.toList());
+			List<Bills> billsList = billsMapper.selectList(new LambdaQueryWrapper<Bills>()
+				.eq(Bills::getTenantId, AuthUtil.getTenantId())
+				.eq(Bills::getIsDeleted, 0)
+				.in(Bills::getId, idList));
+			if (billsList.isEmpty()) {
+				throw new RuntimeException("未找到到进口单据信息");
+			}
+			for (InOutStorage inOutStorage : inOutStorageList) {
+				PayableStorageFeesItems storageFeesItems = new PayableStorageFeesItemsVO();
+				Bills bills = billsList.stream().filter(e -> e.getId().equals(inOutStorage.getPid())).findFirst().orElse(null);
+				if (bills == null) {
+					throw new RuntimeException("未找到到进口单据信息");
+				}
+				storageFeesItems.setDocumentId(bills.getId());
+				storageFeesItems.setContractNumber(bills.getBookingNo());
+				storageFeesItems.setBillNo(bills.getMblno());
+				storageFeesItems.setStorageDate(inOutStorage.getStorageDate());
+				storageFeesItems.setSurplusQuantity(inOutStorage.getSurplusQuantity());
+				storageFeesItems.setSurplusNetWeight(inOutStorage.getSurplusNetWeight());
+				storageFeesItems.setSurplusWeight(inOutStorage.getSurplusWeight());
+				storageFeesItems.setFeeId(fees.getId());
+				storageFeesItems.setFeeCode(fees.getCode());
+				storageFeesItems.setFeeCnName(fees.getCnName());
+				storageFeesItems.setFeeEnName(fees.getEnName());
+				long diff;
+				Date dateEnd;
+				if ("CK".equals(inOutStorage.getBillType())) {
+					if (payableStorageFees.getChargingEndDate().compareTo(inOutStorage.getOutStorageDate()) >= 0) {
+						dateEnd = inOutStorage.getOutStorageDate();
+					} else {
+						dateEnd = payableStorageFees.getChargingEndDate();
+					}
+					diff = dateEnd.getTime() - inOutStorage.getChargingDate().getTime();
+				} else {
+					if (new BigDecimal("0.00").compareTo(inOutStorage.getSurplusQuantity()) == 0) {
+						continue;
+					}
+					dateEnd = payableStorageFees.getChargingEndDate();
+					diff = dateEnd.getTime() - inOutStorage.getChargingDate().getTime();
+				}
+				// 计算差多少天
+				long day = diff / nd + 1L;
+				storageFeesItems.setChargingDay((int) day);
+				storageFeesItems.setChargingStartDate(inOutStorage.getChargingDate());
+				storageFeesItems.setChargingEndDate(payableStorageFees.getChargingEndDate());
+				StorageFeeItems storageFeeItems = storageFeeItemsList.stream().filter(e -> e.getGoodsType().equals(inOutStorage.getGoodsType())).findFirst().orElse(null);
+				if (storageFeeItems == null) {
+					throw new RuntimeException("请先维护商品类别" + inOutStorage.getGoodsType() + "仓储费单价");
+				}
+				BigDecimal weight;
+				BigDecimal amountSum;
+				if (billingRules) {
+					weight = inOutStorage.getOutNetWeight().divide(new BigDecimal("1000"), 4, RoundingMode.HALF_UP);
+				} else {
+					weight = inOutStorage.getOutWeight().divide(new BigDecimal("1000"), 4, RoundingMode.HALF_UP);
+				}
+				BigDecimal dayDecimal = new BigDecimal(day);
+				amountSum = dayDecimal.multiply(storageFeeItems.getPriceC()).multiply(weight);
+				storageFeesItems.setRemarks("仓储费:" + day + "天*" + storageFeeItems.getPriceC() + "元*" + weight + "吨=" + amountSum + "元 ");
+				storageFeesItems.setAmount(amountSum);
+				storageFeesItemsList.add(storageFeesItems);
+			}
+		}
+		return R.data(storageFeesItemsList);
+	}
+
+}

+ 1 - 1
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/controller/OrderController.java

@@ -616,7 +616,7 @@ public class OrderController extends BladeController {
 	@ApiOperation(value = "小程序我的订单查询", notes = "传入order")
 	public R<IPage<PjOrder>> appStatusShareList(PjOrder order, Query query) {
 		LambdaQueryWrapper<PjOrder> lambdaQueryWrapper = new LambdaQueryWrapper<>();
-		lambdaQueryWrapper.select(PjOrder::getSrcOrdNo);
+		lambdaQueryWrapper.select(PjOrder::getSrcOrdNo,PjOrder::getCustomerId);
 		lambdaQueryWrapper.eq(PjOrder::getTenantId, AuthUtil.getTenantId())
 			.eq(PjOrder::getIsDeleted, 0)
 			.apply("find_in_set(bs_type,'XS,GX')")

+ 35 - 54
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/service/impl/OrderServiceImpl.java

@@ -4110,7 +4110,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 		if (sharePutOnShelvesList.isEmpty()) {
 			throw new RuntimeException("未找到共享上架商品明细");
 		}
-		List<SharePutOnShelves> sharePutOnShelvesListNew = new ArrayList<>();
+//		List<SharePutOnShelves> sharePutOnShelvesListNew = new ArrayList<>();
 		List<PjOrderItems> orderItemsList = new ArrayList<>();
 		for (PjOrderItems item : order.getOrderItemsList()) {
 			SharePutOnShelves sharePutOnShelves = sharePutOnShelvesList.stream()
@@ -4121,10 +4121,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 			if (item.getOutGoodsTotalShipNum().compareTo(sharePutOnShelves.getInventory()) > 0) {
 				throw new RuntimeException("本次派发数量:大于共享剩余库存");
 			}
-			sharePutOnShelves.setInventory(sharePutOnShelves.getInventory().subtract(item.getOutGoodsTotalShipNum()));
+			/*sharePutOnShelves.setInventory(sharePutOnShelves.getInventory().subtract(item.getOutGoodsTotalShipNum()));
 			sharePutOnShelves.setUpdateUser(AuthUtil.getUserId());
 			sharePutOnShelves.setUpdateTime(new Date());
-			sharePutOnShelvesListNew.add(sharePutOnShelves);
+			sharePutOnShelvesListNew.add(sharePutOnShelves);*/
 			item.setCostprie(item.getCostprie().add(sharePutOnShelves.getShareCost().multiply(item.getOutGoodsTotalShipNum())));
 			BigDecimal sendNum = item.getSendNum().add(item.getOutGoodsTotalShipNum());
 			if (new BigDecimal("0.00").compareTo(item.getCostprie()) != 0 && new BigDecimal("0.00").compareTo(sendNum) != 0) {
@@ -4162,9 +4162,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 		if (!orderItemsList.isEmpty()) {
 			orderItemsService.updateBatchById(orderItemsList);
 		}
-		if (!sharePutOnShelvesListNew.isEmpty()) {
+		/*if (!sharePutOnShelvesListNew.isEmpty()) {
 			sharePutOnShelvesService.updateBatchById(sharePutOnShelvesListNew);
-		}
+		}*/
 		boolean status = generateSharePjOrder(order.getSharedCompanyId(), orderItemsList, pjOrder.getTenantId() + "-" + pjOrder.getOrdNo());
 		if (!status) {
 			throw new RuntimeException("派发失败,请联系管理员");
@@ -4252,9 +4252,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 		if (productLaunchList.isEmpty()) {
 			throw new RuntimeException("未查到对应商品信息");
 		}
-		List<SharePutOnShelves> sharePutOnShelvesSrcList = sharePutOnShelvesService.selectSharePutOnShelvesList(goodsNo, null,null, dept.getTenantId());
+		List<SharePutOnShelves> sharePutOnShelvesSrcList = sharePutOnShelvesService.selectSharePutOnShelvesList(goodsNo, null, null, dept.getTenantId());
 		List<PjProductLaunch> productLaunchListNew = new ArrayList<>();
-		List<SharePutOnShelves> sharePutOnShelvesSrcListNew = new ArrayList<>();
+//		List<SharePutOnShelves> sharePutOnShelvesSrcListNew = new ArrayList<>();
 		List<PjOrderItems> itemsList = new ArrayList<>();
 		for (PjOrderItems items : orderItemsList) {
 			PjOrderItems orderItems = new PjOrderItems();
@@ -4290,12 +4290,15 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 			}
 			SharePutOnShelves sharePutOnShelves = sharePutOnShelvesSrcList.stream().filter(e -> e.getGoodsCode().equals(items.getGoodsNo())).findFirst().orElse(null);
 			if (sharePutOnShelves != null) {
-				if (new BigDecimal("0.00").compareTo(sharePutOnShelves.getInventory()) != 0
+				/*if (new BigDecimal("0.00").compareTo(sharePutOnShelves.getInventory()) != 0
 					&& sharePutOnShelves.getInventory().compareTo(items.getOutGoodsTotalShipNum()) >= 0) {
 					sharePutOnShelves.setInventory(sharePutOnShelves.getInventory().subtract(items.getOutGoodsTotalShipNum()));
 					sharePutOnShelvesSrcListNew.add(sharePutOnShelves);
 				} else {
 					throw new RuntimeException("商品编号:" + items.getGoodsNo() + "库存不足");
+				}*/
+				if (sharePutOnShelves.getInventory().compareTo(items.getOutGoodsTotalShipNum()) < 0) {
+					throw new RuntimeException("商品编号:" + items.getGoodsNo() + "库存不足");
 				}
 			} else {
 				throw new RuntimeException("商品编号:" + items.getGoodsNo() + "未查到上架");
@@ -4321,18 +4324,21 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 			}
 			itemsList.add(orderItems);
 		}
-		for (PjProductLaunch item : productLaunchListNew) {
-			int count = productLaunchService.updateProductLaunch(item);
-			if (count == 0) {
-				throw new RuntimeException("商品:" + item.getCname() + "修改上架库存失败");
+		if (!productLaunchListNew.isEmpty()) {
+			for (PjProductLaunch item : productLaunchListNew) {
+				int count = productLaunchService.updateProductLaunch(item);
+				if (count == 0) {
+					throw new RuntimeException("商品:" + item.getCname() + "修改上架库存失败");
+				}
 			}
+			sharePutOnShelvesService.updateShareInventory(productLaunchListNew);
 		}
-		for (SharePutOnShelves item : sharePutOnShelvesSrcListNew) {
+		/*for (SharePutOnShelves item : sharePutOnShelvesSrcListNew) {
 			int count = sharePutOnShelvesService.updateSharePutOnShelves(item);
 			if (count == 0) {
 				throw new RuntimeException("商品:" + item.getGoodsCode() + "修改上架库存失败");
 			}
-		}
+		}*/
 		BigDecimal amount = itemsList.stream().map(PjOrderItems::getSubTotalMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
 		BigDecimal goodsNum = itemsList.stream().map(PjOrderItems::getGoodsNum).reduce(BigDecimal.ZERO, BigDecimal::add);
 		sharePjOrder.setGoodsTotalNum(goodsNum);
@@ -4452,12 +4458,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 		if (productLaunchList.isEmpty()) {
 			throw new RuntimeException("未查到对应商品信息");
 		}
-		List<SharePutOnShelves> selectSharePutOnShelvesList = sharePutOnShelvesService.selectSharePutOnShelvesList(goodsNo, sharedCompanyName,null, null);
-		if (productLaunchList.isEmpty()) {
-			throw new RuntimeException("未查到对应商品信息");
-		}
-		List<SharePutOnShelves> sharePutOnShelvesListNew = new ArrayList<>();
-		List<SharePutOnShelves> shareSharePutOnShelvesNew = new ArrayList<>();
+//		List<SharePutOnShelves> sharePutOnShelvesListNew = new ArrayList<>();
 		List<PjProductLaunch> productLaunchListNew = new ArrayList<>();
 		for (PjOrderItems item : orderItemsList) {
 			item.setSendNum(new BigDecimal("0.00"));
@@ -4469,7 +4470,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 			item.setUpdateTime(new Date());
 		}
 		for (ShareSalesItems item : shareSalesItemsList) {
-			SharePutOnShelves sharePutOnShelves = sharePutOnShelvesList.stream()
+			/*SharePutOnShelves sharePutOnShelves = sharePutOnShelvesList.stream()
 				.filter(e -> e.getGoodsCode().equals(item.getGoodsCode())).findFirst().orElse(null);
 			if (sharePutOnShelves == null) {
 				throw new RuntimeException("商品:" + item.getGoodsName() + "为在共享上架查到");
@@ -4477,43 +4478,23 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 			sharePutOnShelves.setInventory(sharePutOnShelves.getInventory().add(item.getGoodsNum()));
 			sharePutOnShelves.setUpdateUser(AuthUtil.getUserId());
 			sharePutOnShelves.setUpdateTime(new Date());
-			sharePutOnShelvesListNew.add(sharePutOnShelves);
+			sharePutOnShelvesListNew.add(sharePutOnShelves);*/
 			PjProductLaunch pjProductLaunch = productLaunchList.stream().filter(e -> e.getCode().equals(item.getGoodsCode())).findFirst().orElse(null);
 			if (pjProductLaunch != null) {
-				if (new BigDecimal("0.00").compareTo(pjProductLaunch.getInventory()) != 0
-					&& pjProductLaunch.getInventory().compareTo(item.getGoodsNum()) >= 0) {
-					pjProductLaunch.setInventory(pjProductLaunch.getInventory().add(item.getGoodsNum()));
-					productLaunchListNew.add(pjProductLaunch);
-				} else {
-					throw new RuntimeException("商品编号:" + item.getGoodsCode() + "库存不足");
-				}
-			} else {
-				throw new RuntimeException("商品编号:" + item.getGoodsCode() + "未查到上架");
-			}
-			SharePutOnShelves shelves = selectSharePutOnShelvesList.stream().filter(e -> e.getGoodsCode().equals(item.getGoodsCode())).findFirst().orElse(null);
-			if (shelves != null) {
-				if (new BigDecimal("0.00").compareTo(shelves.getInventory()) != 0
-					&& shelves.getInventory().compareTo(item.getGoodsNum()) >= 0) {
-					shelves.setInventory(shelves.getInventory().add(item.getGoodsNum()));
-					shareSharePutOnShelvesNew.add(shelves);
-				} else {
-					throw new RuntimeException("商品编号:" + item.getGoodsCode() + "库存不足");
-				}
+				pjProductLaunch.setInventory(pjProductLaunch.getInventory().add(item.getGoodsNum()));
+				productLaunchListNew.add(pjProductLaunch);
 			} else {
 				throw new RuntimeException("商品编号:" + item.getGoodsCode() + "未查到上架");
 			}
 		}
-		for (PjProductLaunch item : productLaunchListNew) {
-			int count = productLaunchService.updateProductLaunch(item);
-			if (count == 0) {
-				throw new RuntimeException("商品:" + item.getCname() + "修改上架库存失败");
-			}
-		}
-		for (SharePutOnShelves item : shareSharePutOnShelvesNew) {
-			int count = sharePutOnShelvesService.updateSharePutOnShelves(item);
-			if (count == 0) {
-				throw new RuntimeException("商品:" + item.getGoodsName() + "修改上架库存失败");
+		if (!productLaunchListNew.isEmpty()) {
+			for (PjProductLaunch item : productLaunchListNew) {
+				int count = productLaunchService.updateProductLaunch(item);
+				if (count == 0) {
+					throw new RuntimeException("商品:" + item.getCname() + "修改上架库存失败");
+				}
 			}
+			sharePutOnShelvesService.updateShareInventory(productLaunchListNew);
 		}
 		orderItemsService.updateBatchById(orderItemsList);
 		if (!shareOrderItemsList.isEmpty()) {
@@ -4524,9 +4505,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 			List<Long> shareOrderIds = shareOrderList.stream().map(PjOrder::getId).distinct().collect(Collectors.toList());
 			baseMapper.deleteByIds(shareOrderIds);
 		}
-		if (!sharePutOnShelvesListNew.isEmpty()) {
+		/*if (!sharePutOnShelvesListNew.isEmpty()) {
 			sharePutOnShelvesService.updateBatchById(sharePutOnShelvesListNew);
-		}
+		}*/
 		List<PjOrderItems> orderItemsListNew = orderItemsService.list(new LambdaQueryWrapper<PjOrderItems>()
 			.eq(PjOrderItems::getTenantId, AuthUtil.getTenantId())
 			.eq(PjOrderItems::getIsDeleted, 0)
@@ -5555,7 +5536,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 						throw new RuntimeException("商品:" + e.getGoodsName() + "未上架");
 					}
 				});
-				String stata = sysClient.paramServiceValue(AuthUtil.getTenantId(),"whether.open.share");
+				String stata = sysClient.paramServiceValue(AuthUtil.getTenantId(), "whether.open.share");
 				if (!productLaunchListNew.isEmpty() && "1".equals(stata)) {
 					sharePutOnShelvesService.updateShareInventory(productLaunchListNew);
 				}

+ 37 - 37
blade-service/blade-sales-part/src/main/resources/log/logback-dev.xml

@@ -58,56 +58,56 @@
     </if>
 
     <!-- 日志输出级别 -->
-    <root level="ERROR">
+    <root level="info">
         <appender-ref ref="STDOUT"/>
         <appender-ref ref="${STDOUT_APPENDER}"/>
     </root>
 
-    <logger name="net.sf.ehcache" level="ERROR"/>
-    <logger name="druid.sql" level="ERROR"/>
+    <logger name="net.sf.ehcache" level="info"/>
+    <logger name="druid.sql" level="info"/>
 
 
     <!-- MyBatis log configure -->
-    <logger name="com.apache.ibatis" level="ERROR"/>
-    <logger name="org.mybatis.spring" level="ERROR"/>
-    <logger name="java.sql.Connection" level="ERROR"/>
-    <logger name="java.sql.Statement" level="ERROR"/>
-    <logger name="java.sql.PreparedStatement" level="ERROR"/>
+    <logger name="com.apache.ibatis" level="info"/>
+    <logger name="org.mybatis.spring" level="info"/>
+    <logger name="java.sql.Connection" level="info"/>
+    <logger name="java.sql.Statement" level="info"/>
+    <logger name="java.sql.PreparedStatement" level="info"/>
 
     <!-- 减少部分debug日志 -->
-    <logger name="druid.sql" level="ERROR"/>
-    <logger name="org.apache.shiro" level="ERROR"/>
-    <logger name="org.mybatis.spring" level="ERROR"/>
-    <logger name="org.springframework" level="ERROR"/>
-    <logger name="org.springframework.context" level="ERROR"/>
-    <logger name="org.springframework.beans" level="ERROR"/>
-    <logger name="com.baomidou.mybatisplus" level="ERROR"/>
-    <logger name="org.apache.ibatis.io" level="ERROR"/>
-    <logger name="org.apache.velocity" level="ERROR"/>
-    <logger name="org.eclipse.jetty" level="ERROR"/>
-    <logger name="io.undertow" level="ERROR"/>
-    <logger name="org.xnio.nio" level="ERROR"/>
-    <logger name="org.thymeleaf" level="ERROR"/>
-    <logger name="springfox.documentation" level="ERROR"/>
-    <logger name="org.hibernate.validator" level="ERROR"/>
-    <logger name="com.netflix.loadbalancer" level="ERROR"/>
-    <logger name="com.netflix.hystrix" level="ERROR"/>
-    <logger name="com.netflix.zuul" level="ERROR"/>
-    <logger name="de.codecentric" level="ERROR"/>
-    <!-- cache ERROR -->
-    <logger name="net.sf.ehcache" level="ERROR"/>
-    <logger name="org.springframework.cache" level="ERROR"/>
+    <logger name="druid.sql" level="info"/>
+    <logger name="org.apache.shiro" level="info"/>
+    <logger name="org.mybatis.spring" level="info"/>
+    <logger name="org.springframework" level="info"/>
+    <logger name="org.springframework.context" level="info"/>
+    <logger name="org.springframework.beans" level="info"/>
+    <logger name="com.baomidou.mybatisplus" level="info"/>
+    <logger name="org.apache.ibatis.io" level="info"/>
+    <logger name="org.apache.velocity" level="info"/>
+    <logger name="org.eclipse.jetty" level="info"/>
+    <logger name="io.undertow" level="info"/>
+    <logger name="org.xnio.nio" level="info"/>
+    <logger name="org.thymeleaf" level="info"/>
+    <logger name="springfox.documentation" level="info"/>
+    <logger name="org.hibernate.validator" level="info"/>
+    <logger name="com.netflix.loadbalancer" level="info"/>
+    <logger name="com.netflix.hystrix" level="info"/>
+    <logger name="com.netflix.zuul" level="info"/>
+    <logger name="de.codecentric" level="info"/>
+    <!-- cache info -->
+    <logger name="net.sf.ehcache" level="info"/>
+    <logger name="org.springframework.cache" level="info"/>
     <!-- cloud -->
-    <logger name="org.apache.http" level="ERROR"/>
-    <logger name="com.netflix.discovery" level="ERROR"/>
-    <logger name="com.netflix.eureka" level="ERROR"/>
+    <logger name="org.apache.http" level="info"/>
+    <logger name="com.netflix.discovery" level="info"/>
+    <logger name="com.netflix.eureka" level="info"/>
     <!-- 业务日志 -->
-    <Logger name="org.springblade" level="ERROR"/>
-    <Logger name="org.springblade.core.tenant" level="ERROR"/>
-    <Logger name="org.springblade.core.version" level="ERROR"/>
+    <Logger name="org.springblade" level="info"/>
+    <Logger name="org.springblade.core.tenant" level="info"/>
+    <Logger name="org.springblade.core.version" level="info"/>
 
     <!-- 减少nacos日志 -->
-    <logger name="com.alibaba.nacos" level="ERROR"/>
+    <logger name="com.alibaba.nacos" level="info"/>
 
 
 </configuration>

+ 8 - 10
blade-service/trade-finance/src/main/java/org/springblade/finance/controller/LandExpenseSettlementController.java

@@ -24,7 +24,6 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
 import lombok.AllArgsConstructor;
 import org.springblade.client.entity.CorpsDesc;
 import org.springblade.client.entity.FeesDesc;
@@ -39,13 +38,12 @@ import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.BeanUtil;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.core.tool.utils.ObjectUtil;
-import org.springblade.core.tool.utils.StringUtil;
 import org.springblade.finance.dto.SettlementDTO;
-import org.springblade.finance.entity.InvoiceItem;
 import org.springblade.finance.excel.ExpenseExcel;
-import org.springblade.finance.service.IInvoiceItemService;
+import org.springblade.finance.service.IFilesService;
 import org.springblade.finance.service.IItemsService;
 import org.springblade.finance.service.ISettlementService;
+import org.springblade.finance.vojo.Files;
 import org.springblade.finance.vojo.Items;
 import org.springblade.finance.vojo.Settlement;
 import org.springblade.system.user.entity.User;
@@ -53,7 +51,7 @@ import org.springblade.system.user.feign.IUserClient;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletResponse;
-import javax.validation.Valid;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
@@ -79,7 +77,7 @@ public class LandExpenseSettlementController extends BladeController {
 
 	private final IFeesDescClient iFeesDescClient;
 
-	private final IInvoiceItemService iInvoiceItemService;
+	private final IFilesService filesService;
 
 	/**
 	 * 详情
@@ -104,10 +102,10 @@ public class LandExpenseSettlementController extends BladeController {
 		LambdaQueryWrapper<Items> itemsLambdaQueryWrapper = new LambdaQueryWrapper<>();
 		itemsLambdaQueryWrapper.eq(Items::getPid, detail.getId()).eq(Items::getIsDeleted, 0);
 		List<Items> list = itemsService.list(itemsLambdaQueryWrapper);
-		LambdaQueryWrapper<InvoiceItem> itemLambdaQueryWrapper = new LambdaQueryWrapper<>();
-		itemLambdaQueryWrapper.eq(InvoiceItem::getPid, detail.getId()).eq(InvoiceItem::getIsDeleted, 0);
-		List<InvoiceItem> invoiceItemList = iInvoiceItemService.list(itemLambdaQueryWrapper);
-		detail.setInvoiceItemList(invoiceItemList);
+		LambdaQueryWrapper<Files> itemLambdaQueryWrapper = new LambdaQueryWrapper<>();
+		itemLambdaQueryWrapper.eq(Files::getPid, detail.getId()).eq(Files::getIsDeleted, 0);
+		List<Files> filesList = filesService.list(itemLambdaQueryWrapper);
+		detail.setFilesList(filesList.isEmpty() ? new ArrayList<>() : filesList);
 		if (CollectionUtils.isNotEmpty(list)) {
 			list.forEach(e -> {
 				if (ObjectUtil.isNotEmpty(detail.getUpdateUser())) {

+ 209 - 38
blade-service/trade-finance/src/main/java/org/springblade/finance/service/impl/SettlementServiceImpl.java

@@ -76,6 +76,7 @@ import org.springblade.finance.tool.JdyTool;
 import org.springblade.finance.vo.CollectionPayment;
 import org.springblade.finance.vo.SettlementVO;
 import org.springblade.finance.vojo.*;
+import org.springblade.land.entity.LandOrder;
 import org.springblade.land.entity.OrderFee;
 import org.springblade.land.entity.OrderItem;
 import org.springblade.land.feign.ILandClient;
@@ -108,6 +109,8 @@ import java.net.URLEncoder;
 import java.security.SecureRandom;
 import java.security.cert.X509Certificate;
 import java.text.SimpleDateFormat;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
@@ -125,6 +128,8 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
 
 	private ItemsMapper itemsMapper;
 
+	private FilesMapper filesMapper;
+
 	private final RedisTemplate<String, Object> redisTemplate;
 
 	private final AccMapper accMapper;
@@ -3756,47 +3761,106 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
 		if (!feesItemsIdList.isEmpty()) {
 			orderFeeList = landClient.selectOrderFee(feesItemsIdList);
 		}
+		List<Long> orderIdList = itemsList.stream().filter(e -> 3 == e.getSrcType())
+			.map(Items::getSrcFeesId).collect(Collectors.toList());
+		List<LandOrder> orderList = new ArrayList<>();
+		List<LandOrder> orderListNew = new ArrayList<>();
+		if (!orderIdList.isEmpty()) {
+			orderList = landClient.selectOrderList(orderIdList);
+		}
+		boolean type = true;
+		if ("对账收".equals(settlementDTO.getBillType())||"对账付".equals(settlementDTO.getBillType())) {
+			type = false;
+		}
 		for (Items item : itemsList) {
 			if ((item.getAmount().subtract(item.getSettlementAmount())).compareTo(item.getThisAmount()) < 0) {
 				throw new RuntimeException("单号:" + item.getSrcBillNo() + "本次结算金额大于剩余结算金额");
 			}
-			if (2 == item.getSrcType() && "D".equals(item.getDc()) && !orderItemsList.isEmpty()){
-				OrderItem orderItem = orderItemsList.stream().filter(e-> e.getId().equals(item.getSrcFeesId())).findFirst().orElse(null);
-				if (orderItem != null){
-					orderItem.setSettlementAmountD(orderItem.getSettlementAmountD().add(item.getThisAmount()));
-					orderItem.setSettlementDateD(new Date());
+			if (2 == item.getSrcType() && "1".equals(item.getDc()) && !orderItemsList.isEmpty()) {
+				OrderItem orderItem = orderItemsList.stream().filter(e -> e.getId().equals(item.getSrcFeesId())).findFirst().orElse(null);
+				if (orderItem != null) {
+					if (type) {
+						orderItem.setSettlementAmountD(orderItem.getSettlementAmountD().add(item.getThisAmount()));
+						orderItem.setSettlementDateD(new Date());
+					} else {
+						orderItem.setReconciliationAmountD(orderItem.getReconciliationAmountD().add(item.getThisAmount()));
+						orderItem.setReconciliationDateD(new Date());
+					}
 					orderItemsNew.add(orderItem);
-				}else{
+				} else {
 					throw new RuntimeException("单号:" + item.getSrcBillNo() + "未查到单据信息");
 				}
 			}
-			if (2 == item.getSrcType() && "C".equals(item.getDc()) && !orderItemsList.isEmpty()){
-				OrderItem orderItem = orderItemsList.stream().filter(e-> e.getId().equals(item.getSrcFeesId())).findFirst().orElse(null);
-				if (orderItem != null){
-					orderItem.setSettlementAmountC(orderItem.getSettlementAmountC().add(item.getThisAmount()));
-					orderItem.setSettlementDateC(new Date());
+			if (2 == item.getSrcType() && "2".equals(item.getDc()) && !orderItemsList.isEmpty()) {
+				OrderItem orderItem = orderItemsList.stream().filter(e -> e.getId().equals(item.getSrcFeesId())).findFirst().orElse(null);
+				if (orderItem != null) {
+					if (type) {
+						orderItem.setSettlementAmountC(orderItem.getSettlementAmountC().add(item.getThisAmount()));
+						orderItem.setSettlementDateC(new Date());
+					} else {
+						orderItem.setReconciliationAmountC(orderItem.getReconciliationAmountC().add(item.getThisAmount()));
+						orderItem.setReconciliationDateC(new Date());
+					}
 					orderItemsNew.add(orderItem);
-				}else{
+				} else {
 					throw new RuntimeException("单号:" + item.getSrcBillNo() + "未查到单据信息");
 				}
 			}
-			if (1 == item.getSrcType() && !orderFeeList.isEmpty()){
-				OrderFee orderFee = orderFeeList.stream().filter(e-> e.getId().equals(item.getSrcFeesId())).findFirst().orElse(null);
-				if (orderFee != null){
-					orderFee.setSettlementAmount(orderFee.getSettlementAmount().add(item.getThisAmount()));
-					orderFee.setSettlementDate(new Date());
+			if (1 == item.getSrcType() && !orderFeeList.isEmpty()) {
+				OrderFee orderFee = orderFeeList.stream().filter(e -> e.getId().equals(item.getSrcFeesId())).findFirst().orElse(null);
+				if (orderFee != null) {
+					if (type) {
+						orderFee.setSettlementAmount(orderFee.getSettlementAmount().add(item.getThisAmount()));
+						orderFee.setSettlementDate(new Date());
+					} else {
+						orderFee.setReconciliationAmount(orderFee.getReconciliationAmount().add(item.getThisAmount()));
+						orderFee.setReconciliationDate(new Date());
+					}
 					orderFeeNew.add(orderFee);
-				}else{
+				} else {
+					throw new RuntimeException("单号:" + item.getSrcBillNo() + "未查到单据信息");
+				}
+			}
+			if (3 == item.getSrcType() && "1".equals(item.getDc()) && !orderList.isEmpty()) {
+				LandOrder order = orderList.stream().filter(e -> e.getId().equals(item.getSrcFeesId())).findFirst().orElse(null);
+				if (order != null) {
+					if (type) {
+						order.setSettlementAmountD(order.getSettlementAmountD().add(item.getThisAmount()));
+						order.setSettlementDateD(new Date());
+					} else {
+						order.setReconciliationAmountD(order.getReconciliationAmountD().add(item.getThisAmount()));
+						order.setReconciliationDateD(new Date());
+					}
+					orderListNew.add(order);
+				} else {
+					throw new RuntimeException("单号:" + item.getSrcBillNo() + "未查到单据信息");
+				}
+			}
+			if (3 == item.getSrcType() && "2".equals(item.getDc()) && !orderList.isEmpty()) {
+				LandOrder order = orderList.stream().filter(e -> e.getId().equals(item.getSrcFeesId())).findFirst().orElse(null);
+				if (order != null) {
+					if (type) {
+						order.setSettlementAmountC(order.getSettlementAmountC().add(item.getThisAmount()));
+						order.setSettlementDateC(new Date());
+					} else {
+						order.setReconciliationAmountC(order.getReconciliationAmountC().add(item.getThisAmount()));
+						order.setReconciliationDateC(new Date());
+					}
+					orderListNew.add(order);
+				} else {
 					throw new RuntimeException("单号:" + item.getSrcBillNo() + "未查到单据信息");
 				}
 			}
 		}
-		if (!orderItemsNew.isEmpty()){
+		if (!orderItemsNew.isEmpty()) {
 			landClient.updateOrderItemsList(orderItemsNew);
 		}
-		if (!orderFeeNew.isEmpty()){
+		if (!orderFeeNew.isEmpty()) {
 			landClient.updateOrderFeeList(orderFeeNew);
 		}
+		if (!orderListNew.isEmpty()) {
+			landClient.updateOrderList(orderListNew);
+		}
 		settlement.setItemsList(itemsList);
 		return settlement;
 	}
@@ -3826,41 +3890,106 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
 		if (!feesItemsIdList.isEmpty()) {
 			orderFeeList = landClient.selectOrderFee(feesItemsIdList);
 		}
+		List<Long> orderIdList = itemsList.stream().filter(e -> 3 == e.getSrcType())
+			.map(Items::getSrcFeesId).collect(Collectors.toList());
+		List<LandOrder> orderList = new ArrayList<>();
+		List<LandOrder> orderListNew = new ArrayList<>();
+		if (!orderIdList.isEmpty()) {
+			orderList = landClient.selectOrderList(orderIdList);
+		}
+		boolean type = true;
+		if ("对账收".equals(settlementDTO.getBillType())||"对账付".equals(settlementDTO.getBillType())) {
+			type = false;
+		}
 		for (Items item : itemsList) {
-			if (2 == item.getSrcType() && "D".equals(item.getDc()) && !orderItemsList.isEmpty()){
-				OrderItem orderItem = orderItemsList.stream().filter(e-> e.getId().equals(item.getSrcFeesId())).findFirst().orElse(null);
-				if (orderItem != null){
-					orderItem.setSettlementAmountD(orderItem.getSettlementAmountD().subtract(item.getThisAmount()));
+			if ((item.getAmount().subtract(item.getSettlementAmount())).compareTo(item.getThisAmount()) < 0) {
+				throw new RuntimeException("单号:" + item.getSrcBillNo() + "本次结算金额大于剩余结算金额");
+			}
+			if (2 == item.getSrcType() && "1".equals(item.getDc()) && !orderItemsList.isEmpty()) {
+				OrderItem orderItem = orderItemsList.stream().filter(e -> e.getId().equals(item.getSrcFeesId())).findFirst().orElse(null);
+				if (orderItem != null) {
+					if (type) {
+						orderItem.setSettlementAmountD(orderItem.getSettlementAmountD().subtract(item.getThisAmount()));
+						orderItem.setSettlementDateD(new Date());
+					} else {
+						orderItem.setReconciliationAmountD(orderItem.getReconciliationAmountD().subtract(item.getThisAmount()));
+						orderItem.setReconciliationDateD(new Date());
+					}
 					orderItemsNew.add(orderItem);
-				}else{
+				} else {
 					throw new RuntimeException("单号:" + item.getSrcBillNo() + "未查到单据信息");
 				}
 			}
-			if (2 == item.getSrcType() && "C".equals(item.getDc()) && !orderItemsList.isEmpty()){
-				OrderItem orderItem = orderItemsList.stream().filter(e-> e.getId().equals(item.getSrcFeesId())).findFirst().orElse(null);
-				if (orderItem != null){
-					orderItem.setSettlementAmountC(orderItem.getSettlementAmountC().subtract(item.getThisAmount()));
+			if (2 == item.getSrcType() && "2".equals(item.getDc()) && !orderItemsList.isEmpty()) {
+				OrderItem orderItem = orderItemsList.stream().filter(e -> e.getId().equals(item.getSrcFeesId())).findFirst().orElse(null);
+				if (orderItem != null) {
+					if (type) {
+						orderItem.setSettlementAmountC(orderItem.getSettlementAmountC().subtract(item.getThisAmount()));
+						orderItem.setSettlementDateC(new Date());
+					} else {
+						orderItem.setReconciliationAmountC(orderItem.getReconciliationAmountC().subtract(item.getThisAmount()));
+						orderItem.setReconciliationDateC(new Date());
+					}
 					orderItemsNew.add(orderItem);
-				}else{
+				} else {
 					throw new RuntimeException("单号:" + item.getSrcBillNo() + "未查到单据信息");
 				}
 			}
-			if (1 == item.getSrcType() && !orderFeeList.isEmpty()){
-				OrderFee orderFee = orderFeeList.stream().filter(e-> e.getId().equals(item.getSrcFeesId())).findFirst().orElse(null);
-				if (orderFee != null){
-					orderFee.setSettlementAmount(orderFee.getSettlementAmount().subtract(item.getThisAmount()));
+			if (1 == item.getSrcType() && !orderFeeList.isEmpty()) {
+				OrderFee orderFee = orderFeeList.stream().filter(e -> e.getId().equals(item.getSrcFeesId())).findFirst().orElse(null);
+				if (orderFee != null) {
+					if (type) {
+						orderFee.setSettlementAmount(orderFee.getSettlementAmount().subtract(item.getThisAmount()));
+						orderFee.setSettlementDate(new Date());
+					} else {
+						orderFee.setReconciliationAmount(orderFee.getReconciliationAmount().subtract(item.getThisAmount()));
+						orderFee.setReconciliationDate(new Date());
+					}
 					orderFeeNew.add(orderFee);
-				}else{
+				} else {
+					throw new RuntimeException("单号:" + item.getSrcBillNo() + "未查到单据信息");
+				}
+			}
+			if (3 == item.getSrcType() && "1".equals(item.getDc()) && !orderList.isEmpty()) {
+				LandOrder order = orderList.stream().filter(e -> e.getId().equals(item.getSrcFeesId())).findFirst().orElse(null);
+				if (order != null) {
+					if (type) {
+						order.setSettlementAmountD(order.getSettlementAmountD().subtract(item.getThisAmount()));
+						order.setSettlementDateD(new Date());
+					} else {
+						order.setReconciliationAmountD(order.getReconciliationAmountD().subtract(item.getThisAmount()));
+						order.setReconciliationDateD(new Date());
+					}
+					orderListNew.add(order);
+				} else {
+					throw new RuntimeException("单号:" + item.getSrcBillNo() + "未查到单据信息");
+				}
+			}
+			if (3 == item.getSrcType() && "2".equals(item.getDc()) && !orderList.isEmpty()) {
+				LandOrder order = orderList.stream().filter(e -> e.getId().equals(item.getSrcFeesId())).findFirst().orElse(null);
+				if (order != null) {
+					if (type) {
+						order.setSettlementAmountC(order.getSettlementAmountC().subtract(item.getThisAmount()));
+						order.setSettlementDateC(new Date());
+					} else {
+						order.setReconciliationAmountC(order.getReconciliationAmountC().subtract(item.getThisAmount()));
+						order.setReconciliationDateC(new Date());
+					}
+					orderListNew.add(order);
+				} else {
 					throw new RuntimeException("单号:" + item.getSrcBillNo() + "未查到单据信息");
 				}
 			}
 		}
-		if (!orderItemsNew.isEmpty()){
+		if (!orderItemsNew.isEmpty()) {
 			landClient.updateOrderItemsList(orderItemsNew);
 		}
-		if (!orderFeeNew.isEmpty()){
+		if (!orderFeeNew.isEmpty()) {
 			landClient.updateOrderFeeList(orderFeeNew);
 		}
+		if (!orderListNew.isEmpty()) {
+			landClient.updateOrderList(orderListNew);
+		}
 		return settlementDTO;
 	}
 
@@ -3881,7 +4010,20 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
 		//如果id=null, 无论主表还是从表, 必然都是新增
 		Long id = settlementDTO.getId();
 		if (id == null) {
-			model.setSysNo(String.valueOf(System.currentTimeMillis()));
+			DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
+			LocalDateTime now = LocalDateTime.now();
+			String type = "";
+			if ("收费".equals(model.getBillType())) {
+				type = "SF";
+			} else if ("付费".equals(model.getBillType())) {
+				type = "CF";
+			} else if ("对账收".equals(model.getBillType())) {
+				type = "DZD";
+			}else if ("对账付".equals(model.getBillType())) {
+				type = "DZC";
+			}
+
+			model.setSysNo(type + formatter.format(now));
 			model.setTenantId(AuthUtil.getTenantId());
 			model.setCreateTime(new Date());
 			model.setCreateUser(AuthUtil.getUserId());
@@ -3902,6 +4044,18 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
 					itemsMapper.insert(e);
 				});
 			}
+			if (CollectionUtils.isNotEmpty(settlementDTO.getFilesList())) {
+				settlementDTO.getFilesList().forEach(e -> {
+					e.setSort(1);
+					e.setId(null);
+					e.setPid(model.getId());
+					e.setTenantId(AuthUtil.getTenantId());
+					e.setCreateTime(new Date());
+					e.setCreateUser(AuthUtil.getUserId());
+					e.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
+					filesMapper.insert(e);
+				});
+			}
 		}
 		//主表更新, 从表视情况更新新增
 		else {
@@ -3926,6 +4080,23 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
 					}
 				});
 			}
+			if (CollectionUtils.isNotEmpty(settlementDTO.getFilesList())) {
+				settlementDTO.getFilesList().forEach(e -> {
+					if (e.getId() == null) {
+						e.setSort(1);
+						e.setPid(model.getId());
+						e.setTenantId(AuthUtil.getTenantId());
+						e.setCreateTime(new Date());
+						e.setCreateUser(AuthUtil.getUserId());
+						e.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
+						filesMapper.insert(e);
+					} else {
+						e.setUpdateTime(new Date());
+						e.setUpdateUser(AuthUtil.getUserId());
+						filesMapper.updateById(e);
+					}
+				});
+			}
 		}
 		return settlementDTO;
 	}