瀏覽代碼

Merge remote-tracking branch 'origin/dev' into dev

liyuan 8 月之前
父節點
當前提交
d75c3d4475
共有 22 個文件被更改,包括 480 次插入260 次删除
  1. 6 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/finance/fee/entity/FeeCenter.java
  2. 6 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/finance/fee/entity/FinAccBills.java
  3. 4 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/finance/invoices/entity/FinInvoicesItems.java
  4. 11 1
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/trade/entity/InOutStorage.java
  5. 5 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/trade/entity/PayableStorageFees.java
  6. 23 5
      blade-service/blade-los/src/main/java/org/springblade/los/basic/units/service/impl/BUnitsServiceImpl.java
  7. 1 1
      blade-service/blade-los/src/main/java/org/springblade/los/business/sea/mapper/BillsMapper.xml
  8. 9 11
      blade-service/blade-los/src/main/java/org/springblade/los/business/sea/service/impl/PreContainersServiceImpl.java
  9. 1 0
      blade-service/blade-los/src/main/java/org/springblade/los/finance/fee/controller/FinAccBillsController.java
  10. 24 6
      blade-service/blade-los/src/main/java/org/springblade/los/finance/fee/service/impl/FinAccBillsServiceImpl.java
  11. 17 2
      blade-service/blade-los/src/main/java/org/springblade/los/finance/invoices/controller/FinInvoicesController.java
  12. 13 3
      blade-service/blade-los/src/main/java/org/springblade/los/finance/invoices/service/impl/FinInvoicesServiceImpl.java
  13. 25 31
      blade-service/blade-los/src/main/java/org/springblade/los/finance/stl/service/impl/FinStlBillsServiceImpl.java
  14. 91 62
      blade-service/blade-los/src/main/java/org/springblade/los/statisticAnalysis/service/impl/StatisticAnalysisServiceImpl.java
  15. 2 2
      blade-service/blade-los/src/main/java/org/springblade/los/trade/controller/PayableStorageFeesController.java
  16. 6 7
      blade-service/blade-los/src/main/java/org/springblade/los/trade/service/impl/InOutStorageServiceImpl.java
  17. 84 12
      blade-service/blade-los/src/main/java/org/springblade/los/trade/service/impl/PayableStorageFeesServiceImpl.java
  18. 1 1
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/controller/OrderController.java
  19. 25 16
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/ship/service/impl/ShipServiceImpl.java
  20. 116 97
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/shoppingCart/service/impl/ShoppingCartServiceImpl.java
  21. 8 1
      blade-service/blade-system/src/main/java/org/springblade/system/controller/PostController.java
  22. 2 2
      blade-service/trade-finance/src/main/java/org/springblade/finance/service/impl/SettlementServiceImpl.java

+ 6 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/finance/fee/entity/FeeCenter.java

@@ -495,6 +495,7 @@ public class FeeCenter implements Serializable {
 	@ApiModelProperty(value = "对账单日期")
 	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
 	@DateTimeFormat(pattern = "yyyy-MM-dd")
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
 	private Date checkDate;
 	/**
 	 * 对账单金额
@@ -610,6 +611,7 @@ public class FeeCenter implements Serializable {
 	@ApiModelProperty(value = "凭证日期")
 	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
 	@DateTimeFormat(pattern = "yyyy-MM-dd")
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
 	private Date voucherDate;
 	/**
 	 * 凭证状态 0 = 未开 1=已开
@@ -687,6 +689,7 @@ public class FeeCenter implements Serializable {
 	 * 发票日期
 	 */
 	@ApiModelProperty(value = "发票日期")
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
 	private Date invoiceDate;
 
 	/**
@@ -759,6 +762,7 @@ public class FeeCenter implements Serializable {
 	 * 签收日期
 	 */
 	@ApiModelProperty(value = "签收日期")
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
 	private Date signforDate;
 
 	/**
@@ -777,6 +781,7 @@ public class FeeCenter implements Serializable {
 	 * 请核时间
 	 */
 	@ApiModelProperty(value = "请核时间")
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
 	private Date applyTime;
 
 	/**
@@ -795,6 +800,7 @@ public class FeeCenter implements Serializable {
 	 * 审核时间
 	 */
 	@ApiModelProperty(value = "审核时间")
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
 	private Date approveTime;
 
 	/**

+ 6 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/finance/fee/entity/FinAccBills.java

@@ -105,6 +105,7 @@ public class FinAccBills implements Serializable {
 	@ApiModelProperty(value = "账单日期")
 	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
 	@DateTimeFormat(pattern = "yyyy-MM-dd")
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
 	private Date billDate;
 
 	/**
@@ -128,6 +129,7 @@ public class FinAccBills implements Serializable {
 	@ApiModelProperty(value = "财务日期")
 	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
 	@DateTimeFormat(pattern = "yyyy-MM-dd")
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
 	private Date accountDate;
 
 	/**
@@ -311,6 +313,7 @@ public class FinAccBills implements Serializable {
 	@ApiModelProperty(value = "开船日期")
 	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
 	@DateTimeFormat(pattern = "yyyy-MM-dd")
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
 	private Date etd;
 	/**
 	 * 到港日期
@@ -318,6 +321,7 @@ public class FinAccBills implements Serializable {
 	@ApiModelProperty(value = "到港日期")
 	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
 	@DateTimeFormat(pattern = "yyyy-MM-dd")
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
 	private Date eta;
 	/**
 	 * 装货港 id
@@ -478,6 +482,7 @@ public class FinAccBills implements Serializable {
 	@ApiModelProperty(value = "发票日期")
 	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
 	@DateTimeFormat(pattern = "yyyy-MM-dd")
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
 	private Date invoiceDate;
 	/**
 	 * 发票状态 0 = 未开 9=已开 2 待开 3 不开
@@ -606,6 +611,7 @@ public class FinAccBills implements Serializable {
 	@ApiModelProperty(value = "审核日期")
 	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
 	@DateTimeFormat(pattern = "yyyy-MM-dd")
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
 	private Date approvedDate;
 
 	/**

+ 4 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/finance/invoices/entity/FinInvoicesItems.java

@@ -16,6 +16,8 @@
  */
 package org.springblade.los.finance.invoices.entity;
 
+import com.baomidou.mybatisplus.annotation.FieldStrategy;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;
@@ -122,6 +124,7 @@ public class FinInvoicesItems implements Serializable {
 	@ApiModelProperty(value = "对账/结算日期")
 	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
 	@DateTimeFormat(pattern = "yyyy-MM-dd")
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
 	private Date billDate;
 	/**
 	 * 业务财务日期
@@ -129,6 +132,7 @@ public class FinInvoicesItems implements Serializable {
 	@ApiModelProperty(value = "业务财务日期")
 	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
 	@DateTimeFormat(pattern = "yyyy-MM-dd")
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
 	private Date accountDate;
 	/**
 	 * 财务年

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

@@ -275,6 +275,17 @@ public class InOutStorage implements Serializable {
 	 */
 	@ApiModelProperty(value = "是否已生成入出库")
 	private String whetherInOutStorage;
+	/**
+	 * 规格型号
+	 */
+	@ApiModelProperty(value = "规格型号")
+	private String specificationModel;
+
+	/**
+	 * 计费规则
+	 */
+	@ApiModelProperty(value = "计费规则")
+	private String billingRules;
 
 	/**
 	 * 计费日期
@@ -296,5 +307,4 @@ public class InOutStorage implements Serializable {
 	private BigDecimal storageFeePriceC;
 
 
-
 }

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

@@ -52,6 +52,11 @@ public class PayableStorageFees implements Serializable {
 	@ApiModelProperty(value = "仓库名称")
 	private String warehouseName;
 	/**
+	 * 计费规则
+	 */
+	@ApiModelProperty(value = "计费规则")
+	private String billingRules;
+	/**
 	 * 计费起始时间
 	 */
 	@ApiModelProperty(value = "计费起始时间")

+ 23 - 5
blade-service/blade-los/src/main/java/org/springblade/los/basic/units/service/impl/BUnitsServiceImpl.java

@@ -25,6 +25,7 @@ import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.BeanUtil;
 import org.springblade.los.Util.IDeptUtils;
+import org.springblade.los.basic.fees.entity.LosBFeesTemplate;
 import org.springblade.los.basic.units.entity.BUnits;
 import org.springblade.los.basic.units.mapper.UnitsMapper;
 import org.springblade.los.basic.units.service.IBUnitsService;
@@ -69,13 +70,22 @@ public class BUnitsServiceImpl extends ServiceImpl<UnitsMapper, BUnits> implemen
 	}
 
 	@Override
+	@Transactional(rollbackFor = Exception.class)
 	public R submit(BUnits bUnits) {
+		List<BUnits> list = baseMapper.selectList(new LambdaQueryWrapper<BUnits>()
+			.eq(BUnits::getTenantId, AuthUtil.getTenantId())
+			.eq(BUnits::getIsDeleted, 0)
+			.eq(BUnits::getCode, bUnits.getCode()));
+		List<BUnits> nameList = baseMapper.selectList(new LambdaQueryWrapper<BUnits>()
+			.eq(BUnits::getTenantId, AuthUtil.getTenantId())
+			.eq(BUnits::getIsDeleted, 0)
+			.eq(BUnits::getCnName, bUnits.getCnName()));
 		if (bUnits.getId() == null) {
-			if (baseMapper.selectCount(new LambdaQueryWrapper<BUnits>()
-				.eq(BUnits::getTenantId, AuthUtil.getTenantId())
-				.eq(BUnits::getIsDeleted, 0)
-				.eq(BUnits::getCnName, bUnits.getCnName())) > 0) {
-				throw new RuntimeException("名称已存在");
+			if (!list.isEmpty()) {
+				throw new RuntimeException("编码不允许重复");
+			}
+			if (!nameList.isEmpty()) {
+				throw new RuntimeException("中文名称不允许重复");
 			}
 			bUnits.setCreateTime(new Date());
 			bUnits.setCreateUser(AuthUtil.getUserId());
@@ -89,6 +99,14 @@ public class BUnitsServiceImpl extends ServiceImpl<UnitsMapper, BUnits> implemen
 				}
 			}
 		} else {
+			List<Long> ids = list.stream().map(BUnits::getId).filter(e -> !e.equals(bUnits.getId())).collect(Collectors.toList());
+			if (!ids.isEmpty()) {
+				throw new RuntimeException("编码不允许重复");
+			}
+			List<Long> idList = nameList.stream().map(BUnits::getId).filter(e -> !e.equals(bUnits.getId())).collect(Collectors.toList());
+			if (!idList.isEmpty()) {
+				throw new RuntimeException("中文名称不允许重复");
+			}
 			bUnits.setUpdateUser(AuthUtil.getUserId());
 			bUnits.setUpdateTime(new Date());
 			bUnits.setUpdateUserName(AuthUtil.getUserName());

+ 1 - 1
blade-service/blade-los/src/main/java/org/springblade/los/business/sea/mapper/BillsMapper.xml

@@ -328,7 +328,7 @@
         fee.signfor_id as signforId,
         fee.signfor_name as signforName,
         fee.signfor_date as signforDate,
-
+        acc.quantity_cntr_descr as quantityCntrDescr,
         corp.account_period_type as accountPeriodType
         FROM
         los_fee_center fee

+ 9 - 11
blade-service/blade-los/src/main/java/org/springblade/los/business/sea/service/impl/PreContainersServiceImpl.java

@@ -482,18 +482,16 @@ public class PreContainersServiceImpl extends ServiceImpl<PreContainersMapper, P
 				throw new RuntimeException("未找到派车信息");
 			}
 		} else {
-			if (1 == preContainers.getWhetherWarehousing()) {
-				DispatchVehicles dispatchVehicles = dispatchVehiclesService.getOne(new LambdaQueryWrapper<DispatchVehicles>()
-					.eq(DispatchVehicles::getBoxItemsId, preContainers.getId())
-					.eq(DispatchVehicles::getPid, preContainers.getPid()));
-				if (dispatchVehicles != null) {
-					if ("1".equals(dispatchVehicles.getWhetherDispatchVehicles())) {
-						throw new RuntimeException("已确认派车,撤销失败");
-					}
-					dispatchVehiclesService.removeById(dispatchVehicles.getId());
-				} else {
-					throw new RuntimeException("未找到派车信息");
+			DispatchVehicles dispatchVehicles = dispatchVehiclesService.getOne(new LambdaQueryWrapper<DispatchVehicles>()
+				.eq(DispatchVehicles::getBoxItemsId, preContainers.getId())
+				.eq(DispatchVehicles::getPid, preContainers.getPid()));
+			if (dispatchVehicles != null) {
+				if ("1".equals(dispatchVehicles.getWhetherDispatchVehicles())) {
+					throw new RuntimeException("已确认派车,撤销失败");
 				}
+				dispatchVehiclesService.removeById(dispatchVehicles.getId());
+			} else {
+				throw new RuntimeException("未找到派车信息");
 			}
 		}
 		Bills bills = billsMapper.selectById(preContainers.getPid());

+ 1 - 0
blade-service/blade-los/src/main/java/org/springblade/los/finance/fee/controller/FinAccBillsController.java

@@ -347,6 +347,7 @@ public class FinAccBillsController extends BladeController {
 		List<FinAccBillsVO> finAccBillsVOList = new ArrayList<>();
 		List<FinAccBillsVO> list = finAccBillsService.listAccBill(listAccBillVO);
 		for (FinAccBillsVO item : list) {
+			item.setQuantityCntrTypesDescr(item.getQuantityCntrDescr());
 			BigDecimal amount = item.getAppliedAmount().subtract(item.getAppliedAmountStl());
 			item.setAppliedCurrentStlAmount(item.getAmount().subtract(amount).subtract(item.getStlTtlAmount()));
 			item.setAppliedInvoiceCurrentStlAmount(item.getAmount().subtract(item.getStlTtlAmount()));

+ 24 - 6
blade-service/blade-los/src/main/java/org/springblade/los/finance/fee/service/impl/FinAccBillsServiceImpl.java

@@ -141,16 +141,27 @@ public class FinAccBillsServiceImpl extends ServiceImpl<FinAccBillsMapper, FinAc
 		}
 		List<Bills> billsList = new ArrayList<>();
 		List<Long> ids = finAccBills.getFeeCenterList().stream().map(FeeCenter::getPid).collect(Collectors.toList());
+		String status = sysClient.getParamService("generate.billing.rules");
 		for (FeeCenter item : finAccBills.getFeeCenterList()) {
 			if (1 == item.getAccStatus()) {
 				throw new RuntimeException("费用:" + item.getFeeCnName() + "已生成账单");
 			}
-			if (ObjectUtils.isNotNull(item.getPid()) && ObjectUtils.isNotNull(item.getCorpId()) &&
-				ObjectUtils.isNotNull(item.getDc()) && ObjectUtils.isNotNull(item.getElementsId()) && ObjectUtils.isNotNull(item.getCurCode())) {
-				item.setBillKey(item.getPid() + "-" + item.getCorpId() + "-" + item.getDc() + "-" + item.getElementsCode() + "-" + item.getCurCode());
-			} else {
-				throw new RuntimeException("单据号、单位、费用类型、核算要素不能为空");
+			if ("1".equals(status)){
+				if (ObjectUtils.isNotNull(item.getPid()) && ObjectUtils.isNotNull(item.getCorpId()) &&
+					ObjectUtils.isNotNull(item.getDc()) && ObjectUtils.isNotNull(item.getElementsId()) && ObjectUtils.isNotNull(item.getCurCode())) {
+					item.setBillKey(item.getPid() + "-" + item.getCorpId() + "-" + item.getDc() + "-" + item.getElementsCode() + "-" + item.getCurCode());
+				} else {
+					throw new RuntimeException("单据号、单位、费用类型、核算要素不能为空");
+				}
+			}else{
+				if (ObjectUtils.isNotNull(item.getPid()) && ObjectUtils.isNotNull(item.getCorpId()) &&
+					ObjectUtils.isNotNull(item.getDc()) && ObjectUtils.isNotNull(item.getFeeId()) && ObjectUtils.isNotNull(item.getCurCode())) {
+					item.setBillKey(item.getPid() + "-" + item.getCorpId() + "-" + item.getDc() + "-" + item.getFeeCode() + "-" + item.getCurCode());
+				} else {
+					throw new RuntimeException("单据号、单位、费用类型、费用名称不能为空");
+				}
 			}
+
 		}
 		BusinessType businessType = bBusinessTypeService.getOne(new LambdaQueryWrapper<BusinessType>()
 			.eq(BusinessType::getTenantId, AuthUtil.getTenantId())
@@ -208,13 +219,13 @@ public class FinAccBillsServiceImpl extends ServiceImpl<FinAccBillsMapper, FinAc
 			data.setAccountDate(item.getBillDate());
 			data.setBillKey(item.getBillKey());
 			data.setBusinessType(item.getBusinessType());
+			Bills bills = billsList.stream().filter(e -> e.getId().equals(item.getPid())).findFirst().orElse(new Bills());
 			if ("MH".equals(item.getBusinessType())) {
 				//分单
 				data.setBusinessBillDivideId(item.getPid());
 				data.setBusinessBillDivideNo(item.getBillNo());
 				data.setBusinessDivideDate(item.getEtd());
 				//主单
-				Bills bills = billsList.stream().filter(e -> e.getId().equals(item.getPid())).findFirst().orElse(new Bills());
 				if (ObjectUtils.isNotNull(bills.getMasterId())) {
 					data.setBusinessBillId(bills.getMasterId());
 					data.setBusinessBillNo(bills.getMasterBillNo());
@@ -225,6 +236,13 @@ public class FinAccBillsServiceImpl extends ServiceImpl<FinAccBillsMapper, FinAc
 				data.setBusinessBillNo(item.getBillNo());
 				data.setBusinessDate(item.getBillDate());
 			}
+			data.setSrcId(item.getSrcId());
+			data.setSrcCnName(item.getSrcCnName());
+			data.setSrcEnName(item.getSrcEnName());
+			data.setSrcType(item.getSrcType());
+			data.setOperatorId(bills.getOperatorId());
+			data.setOperatorName(bills.getOperatorName());
+			data.setQuantityCntrDescr(bills.getQuantityCntrDescr());
 			data.setPaymode(item.getPaymode());
 			data.setAccelementid(item.getElementsId());
 			data.setAccelementname(item.getElementsCnName());

+ 17 - 2
blade-service/blade-los/src/main/java/org/springblade/los/finance/invoices/controller/FinInvoicesController.java

@@ -31,6 +31,7 @@ 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.business.sea.entity.Bills;
 import org.springblade.los.finance.invoices.entity.FinInvoices;
 import org.springblade.los.finance.invoices.service.IFinInvoicesService;
 import org.springblade.los.finance.invoices.vo.FinInvoicesVO;
@@ -74,12 +75,26 @@ public class FinInvoicesController extends BladeController {
 		LambdaQueryWrapper<FinInvoices> lambdaQueryWrapper = new LambdaQueryWrapper<>();
 		lambdaQueryWrapper.eq(FinInvoices::getTenantId, AuthUtil.getTenantId())
 			.eq(FinInvoices::getIsDeleted, 0)
-			.eq(ObjectUtils.isNotNull(finInvoices.getBillNo()), FinInvoices::getBillNo, finInvoices.getBillNo())
+			.like(ObjectUtils.isNotNull(finInvoices.getBillNo()), FinInvoices::getBillNo, finInvoices.getBillNo())
+			.and(ObjectUtils.isNotNull(finInvoices.getCorpCnName()), i -> i.like(FinInvoices::getCorpCnName, finInvoices.getCorpCnName()).or()
+				.like(FinInvoices::getCorpEnName, finInvoices.getCorpCnName()))
+			.and(ObjectUtils.isNotNull(finInvoices.getInvCorpCnName()), i -> i.like(FinInvoices::getInvCorpCnName, finInvoices.getInvCorpCnName()).or()
+				.like(FinInvoices::getInvCorpEnName, finInvoices.getInvCorpCnName()))
+			.like(ObjectUtils.isNotNull(finInvoices.getInvoiceNo()), FinInvoices::getInvoiceNo, finInvoices.getInvoiceNo())
+			.eq(ObjectUtils.isNotNull(finInvoices.getTaxType()), FinInvoices::getTaxType, finInvoices.getTaxType())
+			.like(ObjectUtils.isNotNull(finInvoices.getBusinessNo()), FinInvoices::getBusinessNo, finInvoices.getBusinessNo())
+			.like(ObjectUtils.isNotNull(finInvoices.getMblno()), FinInvoices::getMblno, finInvoices.getMblno())
+			.like(ObjectUtils.isNotNull(finInvoices.getHblno()), FinInvoices::getHblno, finInvoices.getHblno())
+			.like(ObjectUtils.isNotNull(finInvoices.getCheckNo()), FinInvoices::getCheckNo, finInvoices.getCheckNo())
+			.and(ObjectUtils.isNotNull(finInvoices.getVesselCnName()), i -> i.like(FinInvoices::getVesselCnName, finInvoices.getVesselCnName()).or()
+				.like(FinInvoices::getVesselEnName, finInvoices.getVesselCnName()))
+			.like(ObjectUtils.isNotNull(finInvoices.getVoyageNo()), FinInvoices::getVoyageNo, finInvoices.getVoyageNo())
 			.eq(ObjectUtils.isNotNull(finInvoices.getType()), FinInvoices::getType, finInvoices.getType())
 			.eq(ObjectUtils.isNotNull(finInvoices.getStatus()), FinInvoices::getStatus, finInvoices.getStatus())
-			.like(ObjectUtils.isNotNull(finInvoices.getMblno()), FinInvoices::getMblno, finInvoices.getMblno())
 			.like(ObjectUtils.isNotNull(finInvoices.getFeeCnName()), FinInvoices::getFeeCnName, finInvoices.getFeeCnName())
+			.like(ObjectUtils.isNotNull(finInvoices.getBookingNo()), FinInvoices::getBookingNo, finInvoices.getBookingNo())
 			.eq(ObjectUtils.isNotNull(finInvoices.getBillStatus()), FinInvoices::getBillStatus, finInvoices.getBillStatus())
+			.eq(ObjectUtils.isNotNull(finInvoices.getInvCurCode()), FinInvoices::getInvCurCode, finInvoices.getInvCurCode())
 			.ge(ObjectUtils.isNotNull(finInvoices.getInvoiceDateStart()), FinInvoices::getBillDate, finInvoices.getInvoiceDateStart())
 			.le(ObjectUtils.isNotNull(finInvoices.getInvoiceDateEnd()), FinInvoices::getBillDate, finInvoices.getInvoiceDateEnd())
 			.ge(ObjectUtils.isNotNull(finInvoices.getAccountDateFrom()), FinInvoices::getAccountDateFrom, finInvoices.getAccountDateFrom())

+ 13 - 3
blade-service/blade-los/src/main/java/org/springblade/los/finance/invoices/service/impl/FinInvoicesServiceImpl.java

@@ -48,6 +48,7 @@ import org.springblade.los.finance.invoices.service.IFinInvoiceItemDetailService
 import org.springblade.los.finance.invoices.service.IFinInvoicesItemsService;
 import org.springblade.los.finance.invoices.service.IFinInvoicesService;
 import org.springblade.los.finance.invoices.vo.FinInvoicesVO;
+import org.springblade.los.finance.stl.entity.FinStlBillsItems;
 import org.springblade.system.feign.ISysClient;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -147,9 +148,6 @@ public class FinInvoicesServiceImpl extends ServiceImpl<FinInvoicesMapper, FinIn
 		}
 		this.saveOrUpdate(finInvoices);
 		if (ObjectUtils.isNotNull(finInvoices.getFinInvoicesItemsList())) {
-			finInvoices.setBusinessNo(finInvoices.getFinInvoicesItemsList().stream().map(FinInvoicesItems::getBillNo).distinct().collect(Collectors.joining(",")));
-			finInvoices.setMblno(finInvoices.getFinInvoicesItemsList().stream().map(FinInvoicesItems::getMblno).distinct().collect(Collectors.joining(",")));
-			finInvoices.setHblno(finInvoices.getFinInvoicesItemsList().stream().map(FinInvoicesItems::getHblno).distinct().collect(Collectors.joining(",")));
 			for (FinInvoicesItems item : finInvoices.getFinInvoicesItemsList()) {
 				//计算字段null值处理
 				item.setCurrentAmount(ObjectUtils.isNotNull(item.getCurrentAmount()) ? item.getCurrentAmount() : new BigDecimal("0.00"));
@@ -289,6 +287,12 @@ public class FinInvoicesServiceImpl extends ServiceImpl<FinInvoicesMapper, FinIn
 		}
 		FinInvoices detail = baseMapper.selectById(finInvoices.getId());
 		if (ObjectUtils.isNotNull(finInvoices.getFinInvoicesItemsList())) {
+			detail.setBusinessNo(finInvoices.getFinInvoicesItemsList().stream().map(FinInvoicesItems::getBillNo).distinct().collect(Collectors.joining(",")));
+			detail.setMblno(finInvoices.getFinInvoicesItemsList().stream().map(FinInvoicesItems::getMblno).distinct().collect(Collectors.joining(",")));
+			detail.setHblno(finInvoices.getFinInvoicesItemsList().stream().map(FinInvoicesItems::getHblno).distinct().collect(Collectors.joining(",")));
+			detail.setFeeCnName(finInvoices.getFinInvoicesItemsList().stream().map(FinInvoicesItems::getFeeCnName).distinct().collect(Collectors.joining(",")));
+			detail.setFeeEnName(finInvoices.getFinInvoicesItemsList().stream().map(FinInvoicesItems::getFeeEnName).distinct().collect(Collectors.joining(",")));
+			detail.setFeeCode(finInvoices.getFinInvoicesItemsList().stream().map(FinInvoicesItems::getFeeCode).distinct().collect(Collectors.joining(",")));
 			//明细状态修改  已开发票
 			List<FinAccBills> finAccBillsList = new ArrayList<>();
 			List<FeeCenter> feeCenterList = new ArrayList<>();
@@ -889,6 +893,12 @@ public class FinInvoicesServiceImpl extends ServiceImpl<FinInvoicesMapper, FinIn
 		List<FeeCenter> feeCenterList = new ArrayList<>();
 		List<FinAccBills> finAccBillsList = new ArrayList<>();
 		if (ObjectUtils.isNotNull(finInvoices.getFinInvoicesItemsList())) {
+			detail.setBusinessNo(finInvoices.getFinInvoicesItemsList().stream().map(FinInvoicesItems::getBillNo).distinct().collect(Collectors.joining(",")));
+			detail.setMblno(finInvoices.getFinInvoicesItemsList().stream().map(FinInvoicesItems::getMblno).distinct().collect(Collectors.joining(",")));
+			detail.setHblno(finInvoices.getFinInvoicesItemsList().stream().map(FinInvoicesItems::getHblno).distinct().collect(Collectors.joining(",")));
+			detail.setFeeCnName(finInvoices.getFinInvoicesItemsList().stream().map(FinInvoicesItems::getFeeCnName).distinct().collect(Collectors.joining(",")));
+			detail.setFeeEnName(finInvoices.getFinInvoicesItemsList().stream().map(FinInvoicesItems::getFeeEnName).distinct().collect(Collectors.joining(",")));
+			detail.setFeeCode(finInvoices.getFinInvoicesItemsList().stream().map(FinInvoicesItems::getFeeCode).distinct().collect(Collectors.joining(",")));
 			for (FinInvoicesItems item : finInvoices.getFinInvoicesItemsList()) {
 				FinAccBills finAccBills = finAccBillsService.getById(item.getAccBillId());
 				if (finAccBills == null) {

+ 25 - 31
blade-service/blade-los/src/main/java/org/springblade/los/finance/stl/service/impl/FinStlBillsServiceImpl.java

@@ -243,11 +243,6 @@ public class FinStlBillsServiceImpl extends ServiceImpl<FinStlBillsMapper, FinSt
 		}
 		this.saveOrUpdate(finStlBills);
 		if (ObjectUtils.isNotNull(finStlBills.getFinStlBillsItemsList())) {
-			finStlBills.setBusinessNo(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getBillNo).distinct().collect(Collectors.joining(",")));
-			finStlBills.setAccountNo(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getAccBillNo).distinct().collect(Collectors.joining(",")));
-			finStlBills.setMblno(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getMblno).distinct().collect(Collectors.joining(",")));
-			finStlBills.setHblno(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getHblno).distinct().collect(Collectors.joining(",")));
-			finStlBills.setInvoiceNo(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getInvoiceNo).distinct().collect(Collectors.joining(",")));
 			List<FinStlBillsItems> finStlBillsItemsList = new ArrayList<>();
 			for (FinStlBillsItems item : finStlBills.getFinStlBillsItemsList()) {
 				//计算字段null值处理
@@ -355,6 +350,12 @@ public class FinStlBillsServiceImpl extends ServiceImpl<FinStlBillsMapper, FinSt
 		}
 		FinStlBills detail = baseMapper.selectById(finStlBills.getId());
 		if (ObjectUtils.isNotNull(finStlBills.getFinStlBillsItemsList())) {
+			detail.setBusinessNo(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getBillNo).distinct().collect(Collectors.joining(",")));
+			detail.setAccountNo(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getAccBillNo).distinct().collect(Collectors.joining(",")));
+			detail.setMblno(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getMblno).distinct().collect(Collectors.joining(",")));
+			detail.setHblno(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getHblno).distinct().collect(Collectors.joining(",")));
+			detail.setInvoiceNo(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getInvoiceNo).distinct().collect(Collectors.joining(",")));
+
 			List<FinAccBills> finAccBillsList = new ArrayList<>();
 			List<FeeCenter> feeCenterList = new ArrayList<>();
 			//对账明细状态修改  已对账
@@ -966,6 +967,14 @@ public class FinStlBillsServiceImpl extends ServiceImpl<FinStlBillsMapper, FinSt
 		}
 		FinStlBills detail = baseMapper.selectById(finStlBills.getId());
 		if (ObjectUtils.isNotNull(finStlBills.getFinStlBillsItemsList())) {
+			detail.setBusinessNo(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getBillNo).distinct().collect(Collectors.joining(",")));
+			detail.setAccountNo(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getAccBillNo).distinct().collect(Collectors.joining(",")));
+			detail.setMblno(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getMblno).distinct().collect(Collectors.joining(",")));
+			detail.setHblno(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getHblno).distinct().collect(Collectors.joining(",")));
+			detail.setInvoiceNo(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getInvoiceNo).distinct().collect(Collectors.joining(",")));
+			detail.setFeeCnName(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getFeeCnName).distinct().collect(Collectors.joining(",")));
+			detail.setFeeEnName(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getFeeEnName).distinct().collect(Collectors.joining(",")));
+			detail.setFeeCode(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getFeeCode).distinct().collect(Collectors.joining(",")));
 			List<Long> ids = finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getSrcIdInvoices).filter(Objects::nonNull).collect(Collectors.toList());
 			if (!ids.isEmpty()) {
 				if ("D".equals(finStlBills.getDc())) {
@@ -1373,7 +1382,6 @@ public class FinStlBillsServiceImpl extends ServiceImpl<FinStlBillsMapper, FinSt
 				finAccBills.setStlAmountCrUsd(ObjectUtils.isNotNull(finAccBills.getStlAmountCrUsd()) ? finAccBills.getStlAmountCrUsd() : new BigDecimal("0.00"));
 				item.setStlTtlAmount(item.getStlTtlAmount().subtract(item.getCurrentStlAmount().subtract(item.getCurrentStlDiscount())));
 				item.setUnsettledAmount(item.getAmount().subtract(item.getStlTtlAmount()));
-				/*-----------------------账单数据处理 收--------------------------- */
 				if ("D".equals(item.getDc())) {
 					if ("CNY".equals(item.getCurCode())) {
 						finAccBills.setStlAmountDr(finAccBills.getStlAmountDr().subtract(item.getCurrentStlAmount().subtract(item.getCurrentStlDiscount())));
@@ -1402,8 +1410,6 @@ public class FinStlBillsServiceImpl extends ServiceImpl<FinStlBillsMapper, FinSt
 					}
 
 				}
-				/*-----------------------账单数据处理 收--------------------------- */
-				/*-----------------------账单数据处理 付--------------------------- */
 				else if ("C".equals(item.getDc())) {
 					if ("CNY".equals(item.getCurCode())) {
 						finAccBills.setStlAmountCr(finAccBills.getStlAmountCr().subtract(item.getCurrentStlAmount().subtract(item.getCurrentStlDiscount())));
@@ -1437,7 +1443,6 @@ public class FinStlBillsServiceImpl extends ServiceImpl<FinStlBillsMapper, FinSt
 						}
 					}
 				}
-				/*-----------------------账单数据处理 付--------------------------- */
 
 				finAccBills.setStlBillId(0L);
 				finAccBills.setStlBillNo("");
@@ -1446,7 +1451,6 @@ public class FinStlBillsServiceImpl extends ServiceImpl<FinStlBillsMapper, FinSt
 				finAccBills.setUpdateTime(new Date());
 				finAccBills.setUpdateUserName(AuthUtil.getUserName());
 				finAccBillsList.add(finAccBills);
-				/*-----------------------费用中心数据处理--------------------------- */
 				List<FeeCenter> feeCenters = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
 					.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
 					.eq(FeeCenter::getIsDeleted, 0)
@@ -1455,11 +1459,6 @@ public class FinStlBillsServiceImpl extends ServiceImpl<FinStlBillsMapper, FinSt
 					.apply("stl_ttl_amount != 0")
 					.orderByDesc(FeeCenter::getCreateTime));
 				BigDecimal currentStlAmount = item.getCurrentStlAmount().abs();
-				/*BigDecimal stlTtlAmount = feeCenters.stream().map(FeeCenter::getStlTtlAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
-				if (item.getCurrentStlAmount().compareTo(new BigDecimal("0.00")) == 0 ||
-					item.getCurrentStlAmount().compareTo(stlTtlAmount) > 0) {
-					throw new RuntimeException("本次结算金额不能为零或大于已结算金额");
-				}*/
 				for (FeeCenter e : feeCenters) {
 					if (currentStlAmount.compareTo(new BigDecimal("0.00")) == 0) {
 						break;
@@ -1482,18 +1481,6 @@ public class FinStlBillsServiceImpl extends ServiceImpl<FinStlBillsMapper, FinSt
 						e.setStlById(0L);
 						e.setStlByName("");
 						if (!ids.isEmpty()) {
-							/*if ("D".equals(e.getDc())) {
-								if (e.getStlTtlAmount().compareTo(currentStlAmount) > 0) {
-									e.setStlTtlAmount(e.getStlTtlAmount().subtract(currentStlAmount));
-									currentStlAmount = new BigDecimal("0.00");
-								} else if (e.getStlTtlAmount().compareTo(currentStlAmount) == 0) {
-									e.setStlTtlAmount(new BigDecimal("0.00"));
-									currentStlAmount = new BigDecimal("0.00");
-								} else {
-									e.setStlTtlAmount(new BigDecimal("0.00"));
-									currentStlAmount = currentStlAmount.subtract(e.getAmount());
-								}
-							} else {*/
 							if (e.getStlTtlAmount().compareTo(currentStlAmount) > 0) {
 								e.setStlTtlAmount(e.getStlTtlAmount().subtract(currentStlAmount));
 								e.setUnsettledAmount(e.getAmount().subtract(e.getStlTtlAmount()));
@@ -1510,7 +1497,6 @@ public class FinStlBillsServiceImpl extends ServiceImpl<FinStlBillsMapper, FinSt
 								e.setAppliedAmountStl(new BigDecimal("0.00"));
 								currentStlAmount = currentStlAmount.subtract(e.getAmount());
 							}
-//							}
 						} else {
 							if (e.getStlTtlAmount().compareTo(currentStlAmount) > 0) {
 								e.setStlTtlAmount(e.getStlTtlAmount().subtract(currentStlAmount));
@@ -1532,7 +1518,6 @@ public class FinStlBillsServiceImpl extends ServiceImpl<FinStlBillsMapper, FinSt
 				if (currentStlAmount.compareTo(new BigDecimal("0.00")) != 0) {
 					throw new RuntimeException("撤销金额计算错误,操作失败");
 				}
-				/*-----------------------费用中心数据处理--------------------------- */
 			}
 			feeCenterService.saveOrUpdateBatch(feeCenterList);
 			finStlBillsItemsService.saveOrUpdateBatch(finStlBills.getFinStlBillsItemsList());
@@ -1818,6 +1803,15 @@ public class FinStlBillsServiceImpl extends ServiceImpl<FinStlBillsMapper, FinSt
 		detail.setStatus(1);
 		detail.setAuditDateFrom(new Date());
 		if (ObjectUtils.isNotNull(finStlBills.getFinStlBillsItemsList())) {
+			detail.setBusinessNo(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getBillNo).distinct().collect(Collectors.joining(",")));
+			detail.setAccountNo(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getAccBillNo).distinct().collect(Collectors.joining(",")));
+			detail.setMblno(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getMblno).distinct().collect(Collectors.joining(",")));
+			detail.setHblno(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getHblno).distinct().collect(Collectors.joining(",")));
+			detail.setInvoiceNo(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getInvoiceNo).distinct().collect(Collectors.joining(",")));
+			detail.setFeeCnName(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getFeeCnName).distinct().collect(Collectors.joining(",")));
+			detail.setFeeEnName(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getFeeEnName).distinct().collect(Collectors.joining(",")));
+			detail.setFeeCode(finStlBills.getFinStlBillsItemsList().stream().map(FinStlBillsItems::getFeeCode).distinct().collect(Collectors.joining(",")));
+
 			List<FeeCenter> feeCenterList = new ArrayList<>();
 			List<FinAccBills> finAccBillsList = new ArrayList<>();
 			for (FinStlBillsItems item : finStlBills.getFinStlBillsItemsList()) {
@@ -1942,7 +1936,6 @@ public class FinStlBillsServiceImpl extends ServiceImpl<FinStlBillsMapper, FinSt
 				item.setUnsettledAmount(ObjectUtils.isNotNull(item.getUnsettledAmount()) ? item.getUnsettledAmount() : new BigDecimal("0.00"));
 				item.setCurrentStlAmount(ObjectUtils.isNotNull(item.getCurrentStlAmount()) ? item.getCurrentStlAmount() : new BigDecimal("0.00"));
 				item.setCurrentStlDiscount(ObjectUtils.isNotNull(item.getCurrentStlDiscount()) ? item.getCurrentStlDiscount() : new BigDecimal("0.00"));
-				/*-----------------------费用中心数据处理--------------------------- */
 				List<FeeCenter> feeCenters = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
 					.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
 					.eq(FeeCenter::getIsDeleted, 0)
@@ -1976,7 +1969,6 @@ public class FinStlBillsServiceImpl extends ServiceImpl<FinStlBillsMapper, FinSt
 				if (currentStlAmount.compareTo(new BigDecimal("0.00")) != 0) {
 					throw new RuntimeException("撤销金额计算错误,操作失败");
 				}
-				/*-----------------------费用中心数据处理--------------------------- */
 			}
 			feeCenterService.saveOrUpdateBatch(feeCenterList);
 			finAccBillsService.saveOrUpdateBatch(finAccBillsList);
@@ -2193,6 +2185,7 @@ public class FinStlBillsServiceImpl extends ServiceImpl<FinStlBillsMapper, FinSt
 			}
 			feeCenterService.saveOrUpdateBatch(feeCenterList);
 			finAccBillsService.saveOrUpdateBatch(finAccBillsList);
+			finStlBillsItemsService.updateBatchById(finStlBills.getFinStlBillsItemsList());
 		} else {
 			throw new RuntimeException("请选择明细");
 		}
@@ -2230,6 +2223,7 @@ public class FinStlBillsServiceImpl extends ServiceImpl<FinStlBillsMapper, FinSt
 			}
 			feeCenterService.saveOrUpdateBatch(feeCenterList);
 			finAccBillsService.saveOrUpdateBatch(finAccBillsList);
+			finStlBillsItemsService.updateBatchById(finStlBills.getFinStlBillsItemsList());
 		} else {
 			throw new RuntimeException("请选择明细");
 		}

+ 91 - 62
blade-service/blade-los/src/main/java/org/springblade/los/statisticAnalysis/service/impl/StatisticAnalysisServiceImpl.java

@@ -36,6 +36,7 @@ import org.springblade.los.trade.entity.DispatchVehicles;
 import org.springblade.los.trade.mapper.AgentMapper;
 import org.springblade.los.trade.mapper.DispatchVehiclesMapper;
 import org.springblade.los.view.entity.BoxNumberProfit;
+import org.springblade.los.view.entity.FinanceProfit;
 import org.springblade.los.view.mapper.BoxNumberProfitMapper;
 import org.springblade.los.view.mapper.FinanceProfitMapper;
 import org.springblade.system.feign.ISysClient;
@@ -109,19 +110,19 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
 					financeProfit.setSelecType("1");
 					financeProfit.setSelecTypeId(AuthUtil.getDeptId());
 				} else if (AuthUtil.getUserRole().contains("操作员")) {
-					financeProfit.setSelecTypeId(AuthUtil.getUserId()+"");
+					financeProfit.setSelecTypeId(AuthUtil.getUserId() + "");
 					financeProfit.setSelecType("2");
 				} else if (AuthUtil.getUserRole().contains("销售经理")) {
 					financeProfit.setSelecTypeId(AuthUtil.getDeptId());
 					financeProfit.setSelecType("3");
 				} else if (AuthUtil.getUserRole().contains("业务员")) {
-					financeProfit.setSelecTypeId(AuthUtil.getUserId()+"");
+					financeProfit.setSelecTypeId(AuthUtil.getUserId() + "");
 					financeProfit.setSelecType("4");
 				} else {
-					financeProfit.setSelecTypeId(AuthUtil.getUserId()+"");
+					financeProfit.setSelecTypeId(AuthUtil.getUserId() + "");
 					financeProfit.setSelecType("5");
 				}
-			}else{
+			} else {
 				financeProfit.setSelecType("0");
 			}
 		}
@@ -297,15 +298,29 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
 			}
 			financeProfitList = financeProfitMapper.financeProfit(financeProfit, page);
 		}
+		List<FinanceProfit> financeProfitDataList = new ArrayList<>();
+		if (!financeProfitList.isEmpty()) {
+			String mblNo = financeProfitList.stream().map(FinanceProfitDtoList::getMblNo).distinct().collect(Collectors.joining(","));
+			financeProfitDataList = financeProfitMapper.selectList(new LambdaQueryWrapper<FinanceProfit>()
+				.apply("find_in_set(mblno,'" + mblNo + "')")
+				.apply("find_in_set(business_type,'SE,SI,AE,AI')")
+			);
+		}
 		for (FinanceProfitDtoList item : financeProfitList) {
-			if (null != item) {
-				item.setAmountCrLoc(item.getAmountCrUsd().multiply(exrateC).add(item.getAmountCr()).setScale(2, RoundingMode.HALF_UP));
-				item.setRealAmountCrLoc(item.getRealAmountCrUsd().multiply(exrateC).add(item.getRealAmountCr()).setScale(2, RoundingMode.HALF_UP));
-				item.setAmountDrLoc(item.getAmountDrUsd().multiply(exrateC).add(item.getAmountDr()).setScale(2, RoundingMode.HALF_UP));
-				item.setRealAmountDrLoc(item.getRealAmountDrUsd().multiply(exrateC).add(item.getRealAmountDr()).setScale(2, RoundingMode.HALF_UP));
-				item.setAmountProfitLoc(item.getAmountDrLoc().subtract(item.getAmountCrLoc()).setScale(2, RoundingMode.HALF_UP));
-				item.setRealAmountProfitLoc(item.getRealAmountDrLoc().subtract(item.getRealAmountCrLoc()).setScale(2, RoundingMode.HALF_UP));
+			if ("SEA,SIA,AEA,AIA".contains(item.getBillType()) && !financeProfitDataList.isEmpty()) {
+				FinanceProfit profit = financeProfitDataList.stream().filter(e -> e.getMblno().equals(item.getMblNo())).findFirst().orElse(null);
+				if (profit != null) {
+					item.setSalesman(profit.getSrcCnName());
+					item.setAccDeptName(profit.getAccDeptName());
+					item.setLineCnName(profit.getLineCnName());
+				}
 			}
+			item.setAmountCrLoc(item.getAmountCrUsd().multiply(exrateC).add(item.getAmountCr()).setScale(2, RoundingMode.HALF_UP));
+			item.setRealAmountCrLoc(item.getRealAmountCrUsd().multiply(exrateC).add(item.getRealAmountCr()).setScale(2, RoundingMode.HALF_UP));
+			item.setAmountDrLoc(item.getAmountDrUsd().multiply(exrateC).add(item.getAmountDr()).setScale(2, RoundingMode.HALF_UP));
+			item.setRealAmountDrLoc(item.getRealAmountDrUsd().multiply(exrateC).add(item.getRealAmountDr()).setScale(2, RoundingMode.HALF_UP));
+			item.setAmountProfitLoc(item.getAmountDrLoc().subtract(item.getAmountCrLoc()).setScale(2, RoundingMode.HALF_UP));
+			item.setRealAmountProfitLoc(item.getRealAmountDrLoc().subtract(item.getRealAmountCrLoc()).setScale(2, RoundingMode.HALF_UP));
 		}
 		return R.data(page.setRecords(financeProfitList));
 	}
@@ -758,12 +773,12 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
 			.ge(CustomsDeclaration::getDeclareDate, dateStart)
 			.le(CustomsDeclaration::getDeclareDate, dateEnd)
 			.apply("find_in_set(status,'1,2')");
-			if (!AuthUtil.getUserRole().contains("admin") && !AuthUtil.getUserRole().contains("财务")) {
-				customsDeclarationLambdaQueryWrapper.apply("find_in_set(team_id,'" + AuthUtil.getPostId() + "')");
-			}
-			if (!AuthUtil.getUserRole().contains("admin")) {
-				customsDeclarationLambdaQueryWrapper.eq(CustomsDeclaration::getBranchId, deptUtils.getDeptPid());
-			}
+		if (!AuthUtil.getUserRole().contains("admin") && !AuthUtil.getUserRole().contains("财务")) {
+			customsDeclarationLambdaQueryWrapper.apply("find_in_set(team_id,'" + AuthUtil.getPostId() + "')");
+		}
+		if (!AuthUtil.getUserRole().contains("admin")) {
+			customsDeclarationLambdaQueryWrapper.eq(CustomsDeclaration::getBranchId, deptUtils.getDeptPid());
+		}
 		customsDeclarationLambdaQueryWrapper.eq(CustomsDeclaration::getBusinessType, "BGSE");
 		BGSE = customsDeclarationMapper.selectCount(customsDeclarationLambdaQueryWrapper);
 		LambdaQueryWrapper<CustomsDeclaration> customsDeclarationLambdaQueryWrapperBGSI = new LambdaQueryWrapper<>();
@@ -772,12 +787,12 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
 			.ge(CustomsDeclaration::getDeclareDate, dateStart)
 			.le(CustomsDeclaration::getDeclareDate, dateEnd)
 			.apply("find_in_set(status,'1,2')");
-			if (!AuthUtil.getUserRole().contains("admin") && !AuthUtil.getUserRole().contains("财务")) {
-				customsDeclarationLambdaQueryWrapperBGSI.apply("find_in_set(team_id,'" + AuthUtil.getPostId() + "')");
-			}
-			if (!AuthUtil.getUserRole().contains("admin")) {
-				customsDeclarationLambdaQueryWrapperBGSI.eq(CustomsDeclaration::getBranchId, deptUtils.getDeptPid());
-			}
+		if (!AuthUtil.getUserRole().contains("admin") && !AuthUtil.getUserRole().contains("财务")) {
+			customsDeclarationLambdaQueryWrapperBGSI.apply("find_in_set(team_id,'" + AuthUtil.getPostId() + "')");
+		}
+		if (!AuthUtil.getUserRole().contains("admin")) {
+			customsDeclarationLambdaQueryWrapperBGSI.eq(CustomsDeclaration::getBranchId, deptUtils.getDeptPid());
+		}
 		customsDeclarationLambdaQueryWrapperBGSI.eq(CustomsDeclaration::getBusinessType, "BGSI");
 		BGSI = customsDeclarationMapper.selectCount(customsDeclarationLambdaQueryWrapperBGSI);
 		LambdaQueryWrapper<CustomsDeclaration> customsDeclarationLambdaQueryWrapperBGAE = new LambdaQueryWrapper<>();
@@ -786,12 +801,12 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
 			.ge(CustomsDeclaration::getDeclareDate, dateStart)
 			.le(CustomsDeclaration::getDeclareDate, dateEnd)
 			.apply("find_in_set(status,'1,2')");
-			if (!AuthUtil.getUserRole().contains("admin") && !AuthUtil.getUserRole().contains("财务")) {
-				customsDeclarationLambdaQueryWrapperBGAE.apply("find_in_set(team_id,'" + AuthUtil.getPostId() + "')");
-			}
-			if (!AuthUtil.getUserRole().contains("admin")) {
-				customsDeclarationLambdaQueryWrapperBGAE.eq(CustomsDeclaration::getBranchId, deptUtils.getDeptPid());
-			}
+		if (!AuthUtil.getUserRole().contains("admin") && !AuthUtil.getUserRole().contains("财务")) {
+			customsDeclarationLambdaQueryWrapperBGAE.apply("find_in_set(team_id,'" + AuthUtil.getPostId() + "')");
+		}
+		if (!AuthUtil.getUserRole().contains("admin")) {
+			customsDeclarationLambdaQueryWrapperBGAE.eq(CustomsDeclaration::getBranchId, deptUtils.getDeptPid());
+		}
 		customsDeclarationLambdaQueryWrapperBGAE.eq(CustomsDeclaration::getBusinessType, "BGAE");
 		BGAE = customsDeclarationMapper.selectCount(customsDeclarationLambdaQueryWrapperBGAE);
 		LambdaQueryWrapper<CustomsDeclaration> customsDeclarationLambdaQueryWrapperBGAI = new LambdaQueryWrapper<>();
@@ -800,12 +815,12 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
 			.ge(CustomsDeclaration::getDeclareDate, dateStart)
 			.le(CustomsDeclaration::getDeclareDate, dateEnd)
 			.apply("find_in_set(status,'1,2')");
-			if (!AuthUtil.getUserRole().contains("admin") && !AuthUtil.getUserRole().contains("财务")) {
-				customsDeclarationLambdaQueryWrapperBGAI.apply("find_in_set(team_id,'" + AuthUtil.getPostId() + "')");
-			}
-			if (!AuthUtil.getUserRole().contains("admin")) {
-				customsDeclarationLambdaQueryWrapperBGAI.eq(CustomsDeclaration::getBranchId, deptUtils.getDeptPid());
-			}
+		if (!AuthUtil.getUserRole().contains("admin") && !AuthUtil.getUserRole().contains("财务")) {
+			customsDeclarationLambdaQueryWrapperBGAI.apply("find_in_set(team_id,'" + AuthUtil.getPostId() + "')");
+		}
+		if (!AuthUtil.getUserRole().contains("admin")) {
+			customsDeclarationLambdaQueryWrapperBGAI.eq(CustomsDeclaration::getBranchId, deptUtils.getDeptPid());
+		}
 		customsDeclarationLambdaQueryWrapperBGAI.eq(CustomsDeclaration::getBusinessType, "BGAI");
 		BGAI = customsDeclarationMapper.selectCount(customsDeclarationLambdaQueryWrapperBGAI);
 
@@ -1041,19 +1056,19 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
 					financeProfit.setSelecType("1");
 					financeProfit.setSelecTypeId(AuthUtil.getDeptId());
 				} else if (AuthUtil.getUserRole().contains("操作员")) {
-					financeProfit.setSelecTypeId(AuthUtil.getUserId()+"");
+					financeProfit.setSelecTypeId(AuthUtil.getUserId() + "");
 					financeProfit.setSelecType("2");
 				} else if (AuthUtil.getUserRole().contains("销售经理")) {
 					financeProfit.setSelecTypeId(AuthUtil.getDeptId());
 					financeProfit.setSelecType("3");
 				} else if (AuthUtil.getUserRole().contains("业务员")) {
-					financeProfit.setSelecTypeId(AuthUtil.getUserId()+"");
+					financeProfit.setSelecTypeId(AuthUtil.getUserId() + "");
 					financeProfit.setSelecType("4");
 				} else {
-					financeProfit.setSelecTypeId(AuthUtil.getUserId()+"");
+					financeProfit.setSelecTypeId(AuthUtil.getUserId() + "");
 					financeProfit.setSelecType("5");
 				}
-			}else{
+			} else {
 				financeProfit.setSelecType("0");
 			}
 		}
@@ -1270,19 +1285,19 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
 					financeProfit.setSelecType("1");
 					financeProfit.setSelecTypeId(AuthUtil.getDeptId());
 				} else if (AuthUtil.getUserRole().contains("操作员")) {
-					financeProfit.setSelecTypeId(AuthUtil.getUserId()+"");
+					financeProfit.setSelecTypeId(AuthUtil.getUserId() + "");
 					financeProfit.setSelecType("2");
 				} else if (AuthUtil.getUserRole().contains("销售经理")) {
 					financeProfit.setSelecTypeId(AuthUtil.getDeptId());
 					financeProfit.setSelecType("3");
 				} else if (AuthUtil.getUserRole().contains("业务员")) {
-					financeProfit.setSelecTypeId(AuthUtil.getUserId()+"");
+					financeProfit.setSelecTypeId(AuthUtil.getUserId() + "");
 					financeProfit.setSelecType("4");
 				} else {
-					financeProfit.setSelecTypeId(AuthUtil.getUserId()+"");
+					financeProfit.setSelecTypeId(AuthUtil.getUserId() + "");
 					financeProfit.setSelecType("5");
 				}
-			}else{
+			} else {
 				financeProfit.setSelecType("0");
 			}
 		}
@@ -1456,15 +1471,29 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
 			financeProfit.setBillType(financeProfit.getBillType() + ",SEA,SIA,AEA,AIA");
 			financeProfitList = financeProfitMapper.financeProfitSum(financeProfit);
 		}
+		List<FinanceProfit> financeProfitDataList = new ArrayList<>();
+		if (!financeProfitList.isEmpty()) {
+			String mblNo = financeProfitList.stream().map(FinanceProfitDtoList::getMblNo).distinct().collect(Collectors.joining(","));
+			financeProfitDataList = financeProfitMapper.selectList(new LambdaQueryWrapper<FinanceProfit>()
+				.apply("find_in_set(mblno,'" + mblNo + "')")
+				.apply("find_in_set(business_type,'SE,SI,AE,AI')")
+			);
+		}
 		for (FinanceProfitDtoList item : financeProfitList) {
-			if (null != item) {
-				item.setAmountCrLoc(item.getAmountCrUsd().multiply(exrateC).add(item.getAmountCr()).setScale(2, RoundingMode.HALF_UP));
-				item.setRealAmountCrLoc(item.getRealAmountCrUsd().multiply(exrateC).add(item.getRealAmountCr()).setScale(2, RoundingMode.HALF_UP));
-				item.setAmountDrLoc(item.getAmountDrUsd().multiply(exrateC).add(item.getAmountDr()).setScale(2, RoundingMode.HALF_UP));
-				item.setRealAmountDrLoc(item.getRealAmountDrUsd().multiply(exrateC).add(item.getRealAmountDr()).setScale(2, RoundingMode.HALF_UP));
-				item.setAmountProfitLoc(item.getAmountDrLoc().subtract(item.getAmountCrLoc()).setScale(2, RoundingMode.HALF_UP));
-				item.setRealAmountProfitLoc(item.getRealAmountDrLoc().subtract(item.getRealAmountCrLoc()).setScale(2, RoundingMode.HALF_UP));
+			if ("SEA,SIA,AEA,AIA".contains(item.getBillType()) && !financeProfitDataList.isEmpty()) {
+				FinanceProfit profit = financeProfitDataList.stream().filter(e -> e.getMblno().equals(item.getMblNo())).findFirst().orElse(null);
+				if (profit != null) {
+					item.setSalesman(profit.getSrcCnName());
+					item.setAccDeptName(profit.getAccDeptName());
+					item.setLineCnName(profit.getLineCnName());
+				}
 			}
+			item.setAmountCrLoc(item.getAmountCrUsd().multiply(exrateC).add(item.getAmountCr()).setScale(2, RoundingMode.HALF_UP));
+			item.setRealAmountCrLoc(item.getRealAmountCrUsd().multiply(exrateC).add(item.getRealAmountCr()).setScale(2, RoundingMode.HALF_UP));
+			item.setAmountDrLoc(item.getAmountDrUsd().multiply(exrateC).add(item.getAmountDr()).setScale(2, RoundingMode.HALF_UP));
+			item.setRealAmountDrLoc(item.getRealAmountDrUsd().multiply(exrateC).add(item.getRealAmountDr()).setScale(2, RoundingMode.HALF_UP));
+			item.setAmountProfitLoc(item.getAmountDrLoc().subtract(item.getAmountCrLoc()).setScale(2, RoundingMode.HALF_UP));
+			item.setRealAmountProfitLoc(item.getRealAmountDrLoc().subtract(item.getRealAmountCrLoc()).setScale(2, RoundingMode.HALF_UP));
 		}
 		return financeProfitList;
 	}
@@ -1482,19 +1511,19 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
 					boxNumberProfit.setSelecType("1");
 					boxNumberProfit.setSelecTypeId(AuthUtil.getDeptId());
 				} else if (AuthUtil.getUserRole().contains("操作员")) {
-					boxNumberProfit.setSelecTypeId(AuthUtil.getUserId()+"");
+					boxNumberProfit.setSelecTypeId(AuthUtil.getUserId() + "");
 					boxNumberProfit.setSelecType("2");
 				} else if (AuthUtil.getUserRole().contains("销售经理")) {
 					boxNumberProfit.setSelecTypeId(AuthUtil.getDeptId());
 					boxNumberProfit.setSelecType("3");
 				} else if (AuthUtil.getUserRole().contains("业务员")) {
-					boxNumberProfit.setSelecTypeId(AuthUtil.getUserId()+"");
+					boxNumberProfit.setSelecTypeId(AuthUtil.getUserId() + "");
 					boxNumberProfit.setSelecType("4");
 				} else {
-					boxNumberProfit.setSelecTypeId(AuthUtil.getUserId()+"");
+					boxNumberProfit.setSelecTypeId(AuthUtil.getUserId() + "");
 					boxNumberProfit.setSelecType("5");
 				}
-			}else{
+			} else {
 				boxNumberProfit.setSelecType("0");
 			}
 		}
@@ -1555,19 +1584,19 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
 					boxNumberProfit.setSelecType("1");
 					boxNumberProfit.setSelecTypeId(AuthUtil.getDeptId());
 				} else if (AuthUtil.getUserRole().contains("操作员")) {
-					boxNumberProfit.setSelecTypeId(AuthUtil.getUserId()+"");
+					boxNumberProfit.setSelecTypeId(AuthUtil.getUserId() + "");
 					boxNumberProfit.setSelecType("2");
 				} else if (AuthUtil.getUserRole().contains("销售经理")) {
 					boxNumberProfit.setSelecTypeId(AuthUtil.getDeptId());
 					boxNumberProfit.setSelecType("3");
 				} else if (AuthUtil.getUserRole().contains("业务员")) {
-					boxNumberProfit.setSelecTypeId(AuthUtil.getUserId()+"");
+					boxNumberProfit.setSelecTypeId(AuthUtil.getUserId() + "");
 					boxNumberProfit.setSelecType("4");
 				} else {
-					boxNumberProfit.setSelecTypeId(AuthUtil.getUserId()+"");
+					boxNumberProfit.setSelecTypeId(AuthUtil.getUserId() + "");
 					boxNumberProfit.setSelecType("5");
 				}
-			}else{
+			} else {
 				boxNumberProfit.setSelecType("0");
 			}
 		}
@@ -1668,19 +1697,19 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
 					boxNumberProfit.setSelecType("1");
 					boxNumberProfit.setSelecTypeId(AuthUtil.getDeptId());
 				} else if (AuthUtil.getUserRole().contains("操作员")) {
-					boxNumberProfit.setSelecTypeId(AuthUtil.getUserId()+"");
+					boxNumberProfit.setSelecTypeId(AuthUtil.getUserId() + "");
 					boxNumberProfit.setSelecType("2");
 				} else if (AuthUtil.getUserRole().contains("销售经理")) {
 					boxNumberProfit.setSelecTypeId(AuthUtil.getDeptId());
 					boxNumberProfit.setSelecType("3");
 				} else if (AuthUtil.getUserRole().contains("业务员")) {
-					boxNumberProfit.setSelecTypeId(AuthUtil.getUserId()+"");
+					boxNumberProfit.setSelecTypeId(AuthUtil.getUserId() + "");
 					boxNumberProfit.setSelecType("4");
 				} else {
-					boxNumberProfit.setSelecTypeId(AuthUtil.getUserId()+"");
+					boxNumberProfit.setSelecTypeId(AuthUtil.getUserId() + "");
 					boxNumberProfit.setSelecType("5");
 				}
-			}else{
+			} else {
 				boxNumberProfit.setSelecType("0");
 			}
 		}

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

@@ -82,8 +82,8 @@ public class PayableStorageFeesController extends BladeController {
 			.eq(ObjectUtils.isNotNull(payableStorageFees.getWarehouseId()), PayableStorageFees::getWarehouseId, payableStorageFees.getWarehouseId())
 			.like(ObjectUtils.isNotNull(payableStorageFees.getWarehouseName()), PayableStorageFees::getWarehouseName, payableStorageFees.getWarehouseName())
 			.like(ObjectUtils.isNotNull(payableStorageFees.getStatus()), PayableStorageFees::getStatus, payableStorageFees.getStatus())
-			.orderByDesc(PayableStorageFees::getChargingEndDate);
-		IPage<PayableStorageFees> pages = payableStorageFeesService.page(Condition.getPage(query), Condition.getQueryWrapper(payableStorageFees));
+			.orderByDesc(PayableStorageFees::getCreateTime);
+		IPage<PayableStorageFees> pages = payableStorageFeesService.page(Condition.getPage(query), lambdaQueryWrapper);
 		if (!pages.getRecords().isEmpty()) {
 			List<User> userList = userClient.userListGetByIds(pages.getRecords().stream().map(PayableStorageFees::getCreateUser).collect(Collectors.toList()));
 			for (PayableStorageFees item : pages.getRecords()) {

+ 6 - 7
blade-service/blade-los/src/main/java/org/springblade/los/trade/service/impl/InOutStorageServiceImpl.java

@@ -866,7 +866,7 @@ public class InOutStorageServiceImpl extends ServiceImpl<InOutStorageMapper, InO
 			.eq(InOutStorage::getTenantId, AuthUtil.getTenantId())
 			.eq(InOutStorage::getIsDeleted, 0)
 			.eq(InOutStorage::getBillType, "RK")
-			.eq(InOutStorage::getPid, pidList));
+			.in(InOutStorage::getPid, pidList));
 		List<FeeCenter> feeCenterList = feeCenterMapper.selectList(new LambdaQueryWrapper<FeeCenter>()
 			.in(FeeCenter::getPid, pidList)
 			.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
@@ -879,15 +879,14 @@ public class InOutStorageServiceImpl extends ServiceImpl<InOutStorageMapper, InO
 		if (!feeCenterList.isEmpty()) {
 			amount = feeCenterList.stream().map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
 		}
-		if (!feeCenterList.isEmpty()) {
+		if (!inOutStorageList.isEmpty()) {
 			surplusGoodsAmount = inOutStorageList.stream().map(InOutStorage::getSurplusGoodsAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
 		}
-		BigDecimal thisGoodsAmount = outGoodsAmount.multiply(inStorage.getPrice());
-		if (amount.compareTo(surplusGoodsAmount.subtract(thisGoodsAmount)) >= 0) {
+		if (amount.compareTo(surplusGoodsAmount.subtract(outGoodsAmount)) >= 0) {
 			map.put("status", true);
-			map.put("content", "客户未收金额:" + amount + "大于剩余货值:" + surplusGoodsAmount.subtract(thisGoodsAmount) + "(" +
-				(surplusGoodsAmount.subtract(thisGoodsAmount)).divide(surplusGoodsAmount, 2, RoundingMode.HALF_UP) + "%)" +
-				",本次出库货值:" + thisGoodsAmount + "(" + thisGoodsAmount.divide(surplusGoodsAmount, 2, RoundingMode.HALF_UP) + ")");
+			map.put("content", "客户未收金额:" + amount + "大于剩余货值:" + surplusGoodsAmount.subtract(outGoodsAmount) + "(" +
+				(surplusGoodsAmount.subtract(outGoodsAmount)).divide(surplusGoodsAmount, 2, RoundingMode.HALF_UP) + "%)" +
+				",本次出库货值:" + outGoodsAmount + "(" + outGoodsAmount.divide(surplusGoodsAmount, 2, RoundingMode.HALF_UP) + ")");
 			map.put("feeCenterList", feeCenterList);
 		} else {
 			map.put("status", false);

+ 84 - 12
blade-service/blade-los/src/main/java/org/springblade/los/trade/service/impl/PayableStorageFeesServiceImpl.java

@@ -26,6 +26,8 @@ import org.springblade.core.tool.api.R;
 import org.springblade.los.Util.IDeptUtils;
 import org.springblade.los.basic.business.entity.BusinessType;
 import org.springblade.los.basic.business.service.IBusinessTypeService;
+import org.springblade.los.basic.corps.entity.BCorps;
+import org.springblade.los.basic.corps.service.IBCorpsService;
 import org.springblade.los.basic.fees.entity.BFees;
 import org.springblade.los.basic.fees.service.IBFeesService;
 import org.springblade.los.billno.entity.BusinessBillNo;
@@ -88,6 +90,8 @@ public class PayableStorageFeesServiceImpl extends ServiceImpl<PayableStorageFee
 
 	private final IFinAccBillsService finAccBillsService;
 
+	private final IBCorpsService corpsService;
+
 	@Override
 	public IPage<PayableStorageFeesVO> selectPayableStorageFeesPage(IPage<PayableStorageFeesVO> page, PayableStorageFeesVO payableStorageFees) {
 		return page.setRecords(baseMapper.selectPayableStorageFeesPage(page, payableStorageFees));
@@ -177,6 +181,9 @@ public class PayableStorageFeesServiceImpl extends ServiceImpl<PayableStorageFee
 				throw new RuntimeException("未找到到进口单据信息");
 			}
 			for (InOutStorage inOutStorage : inOutStorageList) {
+				if ("CK".equals(inOutStorage.getBillType()) && inOutStorage.getOutStorageDate().compareTo(inOutStorage.getChargingDate()) == 0) {
+					continue;
+				}
 				PayableStorageFeesItems storageFeesItems = new PayableStorageFeesItemsVO();
 				Bills bills = billsList.stream().filter(e -> e.getId().equals(inOutStorage.getPid())).findFirst().orElse(null);
 				if (bills == null) {
@@ -187,10 +194,17 @@ public class PayableStorageFeesServiceImpl extends ServiceImpl<PayableStorageFee
 				storageFeesItems.setBillType(inOutStorage.getBillType());
 				storageFeesItems.setContractNumber(bills.getBookingNo());
 				storageFeesItems.setBillNo(bills.getMblno());
-				storageFeesItems.setStorageDate(inOutStorage.getStorageDate());
-				storageFeesItems.setSurplusQuantity(inOutStorage.getSurplusQuantity());
-				storageFeesItems.setSurplusNetWeight(inOutStorage.getSurplusNetWeight());
-				storageFeesItems.setSurplusWeight(inOutStorage.getSurplusWeight());
+				if ("CK".equals(inOutStorage.getBillType())) {
+					storageFeesItems.setStorageDate(inOutStorage.getOutStorageDate());
+					storageFeesItems.setSurplusQuantity(inOutStorage.getOutQuantity());
+					storageFeesItems.setSurplusNetWeight(inOutStorage.getOutNetWeight());
+					storageFeesItems.setSurplusWeight(inOutStorage.getOutWeight());
+				} else {
+					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());
@@ -206,18 +220,24 @@ public class PayableStorageFeesServiceImpl extends ServiceImpl<PayableStorageFee
 					} else {
 						dateEnd = payableStorageFees.getChargingEndDate();
 					}
-					diff = dateEnd.getTime() - calendar.getTime().getTime();
+				/*	if (inOutStorage.getChargingDate().compareTo(inOutStorage.getOutStorageDate()) != 0) {
+						inOutStorage.setChargingDate(calendar.getTime());
+					}*/
+					diff = dateEnd.getTime() - inOutStorage.getChargingDate().getTime();
 				} else {
 					if (new BigDecimal("0.00").compareTo(inOutStorage.getSurplusQuantity()) == 0) {
 						continue;
 					}
+					if (inOutStorage.getChargingDate().compareTo(inOutStorage.getStorageDate()) != 0) {
+						inOutStorage.setChargingDate(calendar.getTime());
+					}
 					dateEnd = payableStorageFees.getChargingEndDate();
-					diff = dateEnd.getTime() - calendar.getTime().getTime();
+					diff = dateEnd.getTime() - inOutStorage.getChargingDate().getTime();
 				}
 				// 计算差多少天
 				long day = diff / nd + 1L;
 				storageFeesItems.setChargingDay((int) day);
-				storageFeesItems.setChargingStartDate(calendar.getTime());
+				storageFeesItems.setChargingStartDate(inOutStorage.getChargingDate());
 				storageFeesItems.setChargingEndDate(dateEnd);
 				StorageFeeItems storageFeeItems = storageFeeItemsList.stream().filter(e -> e.getGoodsType().equals(inOutStorage.getGoodsType())).findFirst().orElse(null);
 				if (storageFeeItems == null) {
@@ -226,9 +246,17 @@ public class PayableStorageFeesServiceImpl extends ServiceImpl<PayableStorageFee
 				BigDecimal weight;
 				BigDecimal amountSum;
 				if (billingRules) {
-					weight = inOutStorage.getSurplusNetWeight().divide(new BigDecimal("1000"), 4, RoundingMode.HALF_UP);
+					if ("CK".equals(inOutStorage.getBillType())) {
+						weight = inOutStorage.getOutNetWeight().divide(new BigDecimal("1000"), 4, RoundingMode.HALF_UP);
+					} else {
+						weight = inOutStorage.getSurplusNetWeight().divide(new BigDecimal("1000"), 4, RoundingMode.HALF_UP);
+					}
 				} else {
-					weight = inOutStorage.getSurplusWeight().divide(new BigDecimal("1000"), 4, RoundingMode.HALF_UP);
+					if ("CK".equals(inOutStorage.getBillType())) {
+						weight = inOutStorage.getOutWeight().divide(new BigDecimal("1000"), 4, RoundingMode.HALF_UP);
+					} else {
+						weight = inOutStorage.getSurplusWeight().divide(new BigDecimal("1000"), 4, RoundingMode.HALF_UP);
+					}
 				}
 				BigDecimal dayDecimal = new BigDecimal(day);
 				amountSum = dayDecimal.multiply(storageFeeItems.getPriceC()).multiply(weight);
@@ -244,6 +272,15 @@ public class PayableStorageFeesServiceImpl extends ServiceImpl<PayableStorageFee
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public R confirmSettlement(PayableStorageFees payableStorageFees) {
+		List<PayableStorageFees> lastFeesList = baseMapper.selectList(new LambdaQueryWrapper<PayableStorageFees>()
+			.eq(PayableStorageFees::getTenantId, AuthUtil.getTenantId())
+			.eq(PayableStorageFees::getIsDeleted, 0)
+			.eq(PayableStorageFees::getWarehouseId, payableStorageFees.getWarehouseId())
+			.eq(PayableStorageFees::getStatus, "录入")
+			.ne(PayableStorageFees::getId, payableStorageFees.getId()));
+		if (!lastFeesList.isEmpty()) {
+			throw new RuntimeException("操作失败,为了仓储费计算精准,每个仓库只允许存在一个录入单据。");
+		}
 		if (payableStorageFees.getStorageFeesItemsList().isEmpty()) {
 			throw new RuntimeException("明细不能为空");
 		}
@@ -255,6 +292,13 @@ public class PayableStorageFeesServiceImpl extends ServiceImpl<PayableStorageFee
 		if (storage == null) {
 			throw new RuntimeException("未查到仓库信息");
 		}
+		BCorps corps = corpsService.getOne(new LambdaQueryWrapper<BCorps>()
+			.eq(BCorps::getTenantId, AuthUtil.getTenantId())
+			.eq(BCorps::getIsDeleted, 0)
+			.eq(BCorps::getCode, storage.getCode()));
+		if (corps == null) {
+			throw new RuntimeException("请先维护仓库" + storage.getCname() + "对应往来单位信息");
+		}
 		boolean billingRules = true;
 		if ("1".equals(storage.getBillingRules())) {
 			billingRules = false;
@@ -313,8 +357,10 @@ public class PayableStorageFeesServiceImpl extends ServiceImpl<PayableStorageFee
 				feeCenter.setLineNo(1L);
 				feeCenter.setBillNo(bills.getBillNo());
 				feeCenter.setBillDate(bills.getBillDate());
-				feeCenter.setCorpId(bills.getCorpId());
-				feeCenter.setCorpCnName(bills.getCorpCnName());
+				feeCenter.setCorpId(corps.getId());
+				feeCenter.setCorpCnName(corps.getCnName());
+				feeCenter.setShortName(corps.getShortName());
+				feeCenter.setCorpEnName(corps.getEnName());
 				feeCenter.setBillCorpId(bills.getCorpId());
 				feeCenter.setBillCorpCnName(bills.getCorpCnName());
 				feeCenter.setMblno(bills.getMblno());
@@ -425,6 +471,13 @@ public class PayableStorageFeesServiceImpl extends ServiceImpl<PayableStorageFee
 						data.setBusinessBillNo(item.getBillNo());
 						data.setBusinessDate(item.getBillDate());
 					}
+					data.setSrcId(bills.getSrcId());
+					data.setSrcCnName(bills.getSrcCnName());
+					data.setSrcEnName(bills.getSrcEnName());
+					data.setSrcType(bills.getSrcType());
+					data.setOperatorId(bills.getOperatorId());
+					data.setOperatorName(bills.getOperatorName());
+					data.setQuantityCntrDescr(bills.getQuantityCntrDescr());
 					data.setPaymode(item.getPaymode());
 					data.setAccelementid(item.getElementsId());
 					data.setAccelementname(item.getElementsCnName());
@@ -524,6 +577,18 @@ public class PayableStorageFeesServiceImpl extends ServiceImpl<PayableStorageFee
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public R revokeSettlement(PayableStorageFees payableStorageFees) {
+		List<PayableStorageFees> lastFeesList = baseMapper.selectList(new LambdaQueryWrapper<PayableStorageFees>()
+			.eq(PayableStorageFees::getTenantId, AuthUtil.getTenantId())
+			.eq(PayableStorageFees::getIsDeleted, 0)
+			.eq(PayableStorageFees::getWarehouseId, payableStorageFees.getWarehouseId())
+			.ne(PayableStorageFees::getId, payableStorageFees.getId()));
+		if (!lastFeesList.isEmpty()) {
+			for (PayableStorageFees item : lastFeesList) {
+				if (payableStorageFees.getChargingEndDate().compareTo(item.getChargingEndDate()) < 0) {
+					throw new RuntimeException("撤销失败,请按仓储费计费截止时间操作");
+				}
+			}
+		}
 		if (payableStorageFees.getStorageFeesItemsList().isEmpty()) {
 			throw new RuntimeException("明细不能为空");
 		}
@@ -546,7 +611,14 @@ public class PayableStorageFeesServiceImpl extends ServiceImpl<PayableStorageFee
 		for (PayableStorageFeesItems item : payableStorageFees.getStorageFeesItemsList()) {
 			InOutStorage inOutStorage = inOutStorageList.stream().filter(e -> e.getId().equals(item.getItemId())).findFirst().orElse(null);
 			if (inOutStorage != null) {
-				inOutStorage.setChargingDate(item.getChargingStartDate());
+				if (item.getChargingStartDate().compareTo(inOutStorage.getStorageDate()) > 0) {
+					Calendar calendar = Calendar.getInstance();
+					calendar.setTime(item.getChargingStartDate());
+					calendar.add(Calendar.DATE, -1);
+					inOutStorage.setChargingDate(calendar.getTime());
+				} else {
+					inOutStorage.setChargingDate(inOutStorage.getStorageDate());
+				}
 				inOutStorage.setUpdateTime(new Date());
 				inOutStorage.setUpdateUser(AuthUtil.getUserId());
 				inOutStorage.setUpdateUserName(AuthUtil.getUserName());

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

@@ -1469,7 +1469,7 @@ public class OrderController extends BladeController {
 		LambdaQueryWrapper<PjOrder> lambdaQueryWrapper = new LambdaQueryWrapper<>();
 		lambdaQueryWrapper.eq(PjOrder::getTenantId, AuthUtil.getTenantId())
 			.eq(PjOrder::getIsDeleted, 0)
-			.eq(PjOrder::getBsType, "XS")
+			.apply("FIND_IN_SET( bs_type, 'XS,GX' )")
 			.eq(PjOrder::getCustomerId, order.getCustomerId())
 			.eq(PjOrder::getBusinessSource, "额度支付")
 			.apply("FIND_IN_SET( actual_payment_status, '0,1,2,3,4' )")

+ 25 - 16
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/ship/service/impl/ShipServiceImpl.java

@@ -60,7 +60,6 @@ import org.springblade.salesPart.order.service.IOrderItemsService;
 import org.springblade.salesPart.order.service.IOrderRecordService;
 import org.springblade.salesPart.productLaunch.service.IProductLaunchService;
 import org.springblade.salesPart.serial.service.IPjpfSerialService;
-import org.springblade.salesPart.share.entity.SharePutOnShelves;
 import org.springblade.salesPart.share.service.ISharePutOnShelvesService;
 import org.springblade.salesPart.ship.mapper.ShipMapper;
 import org.springblade.salesPart.ship.service.IShipItemsRecordService;
@@ -941,15 +940,15 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 				order.setLogisticsCorpId(ship.getLogisticsCorpId());
 				order.setLogisticsCorpName(ship.getLogisticsCorpName());
 				order.setExpressNo(ship.getExpressNo());
-				System.err.println("=============出库完成-"+order.getOrdNo()+"==============");
+				System.err.println("=============出库完成-" + order.getOrdNo() + "==============");
 				if (goodsNum.compareTo(sendNum) == 0) {//数量等于发货数量修改销售订单状态
-					System.err.println("=============数量等于发货数量-"+order.getOrdNo()+"==============");
+					System.err.println("=============数量等于发货数量-" + order.getOrdNo() + "==============");
 					order.setDeliveryBusinesDate(new Date());
-					System.err.println("=============出库时间赋值-"+order.getDeliveryBusinesDate()+"==============");
+					System.err.println("=============出库时间赋值-" + order.getDeliveryBusinesDate() + "==============");
 					order.setStatus(OrderTypeEnum.SHIPED.getType());
 					order.setXcxStatus(OrderTypeEnum.GOODSRECEIVED.getType());
 					orderMapper.updateById(order);
-					System.err.println("=============出库时间修改成功后-"+order.getDeliveryBusinesDate()+"==============");
+					System.err.println("=============出库时间修改成功后-" + order.getDeliveryBusinesDate() + "==============");
 				} else {
 					order.setStorageId(ship.getStorageId());
 					order.setStorageName(ship.getStorageName());
@@ -964,6 +963,11 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 				if (new BigDecimal("0.00").compareTo(sendNumFinancing) != 0) {
 					String firstProportion = sysClient.getParamService("first.month.proportion");
 					String secondProportion = sysClient.getParamService("second.month.proportion");
+					String financingDays = sysClient.getParamService("financing.days");
+					int days = -90;
+					if(ObjectUtils.isNotNull(financingDays) && !"获取数据失败".equals(financingDays)){
+						days = -Integer.parseInt(financingDays);
+					}
 					PjpfFunding pjpfFunding = pjpfFundingService.getOne(new LambdaQueryWrapper<PjpfFunding>()
 						.eq(PjpfFunding::getTenantId, AuthUtil.getTenantId())
 						.eq(PjpfFunding::getIsDeleted, 0));
@@ -973,7 +977,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 					Date date = new Date();
 					Calendar calendarDate = Calendar.getInstance();
 					calendarDate.setTime(date);
-					calendarDate.add(Calendar.DAY_OF_MONTH, -90);
+					calendarDate.add(Calendar.DAY_OF_MONTH, days);
 					Date dateTime = calendarDate.getTime();
 					//获取融资采购单主表数据
 					List<PjOrder> orderList = orderMapper.selectList(new LambdaQueryWrapper<PjOrder>()
@@ -1008,9 +1012,6 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 						if (!orderItemsList.isEmpty()) {
 							List<PjOrder> orders = orderList.stream().filter(e -> e.getWhetherRedeem().equals("0")).distinct().collect(Collectors.toList());
 							if (!orders.isEmpty()) {
-						/*if (pjpfFunding.getBondAmount().compareTo(pjpfFunding.getPaidAlreadyBondAmount()) > 0) {
-							throw new RuntimeException("已缴保证金不足,出库失败");
-						}*/
 								if (pjpfFunding.getAvailableAmount().subtract(pjpfFunding.getInterest()).compareTo(amountSum) < 0) {
 									throw new RuntimeException("剩余可用资金:" + pjpfFunding.getAvailableAmount().subtract(pjpfFunding.getInterest()) + "小于本次出库金额:" + amountSum + ",出库失败");
 								}
@@ -1029,6 +1030,9 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 							BigDecimal number = shipItems.getSendNumFinancing();
 							//获取出库明细商品对应融资采购商品明细
 							List<PjOrderItems> orderItemList = orderItemsList.stream().filter(e -> e.getGoodsId().equals(shipItems.getGoodsId())).collect(Collectors.toList());
+							if (orderItemList.isEmpty()) {
+								throw new RuntimeException("商品:" + shipItems.getGoodsName() + "超过90天未赎回,请确认在出库");
+							}
 							List<FinancingShipItemDto> mapList = new ArrayList<>();
 							if (number.compareTo(new BigDecimal("0.00")) > 0) {
 								//采购商品明细循环
@@ -2053,7 +2057,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 				throw new RuntimeException(res.getMsg());
 			}
 			String stata = sysClient.paramServiceValue(AuthUtil.getTenantId(), "whether.open.share");
-			if (!pjProductLaunchList.isEmpty() && "1".equals(stata)){
+			if (!pjProductLaunchList.isEmpty() && "1".equals(stata)) {
 				sharePutOnShelvesService.updateShareInventory(pjProductLaunchList);
 			}
 			ship.setShipItemsList(ship.getShipItemsList());
@@ -2677,7 +2681,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 				throw new RuntimeException(res.getMsg());
 			}
 			String stata = sysClient.paramServiceValue(AuthUtil.getTenantId(), "whether.open.share");
-			if (!pjProductLaunchList.isEmpty() && "1".equals(stata)){
+			if (!pjProductLaunchList.isEmpty() && "1".equals(stata)) {
 				sharePutOnShelvesService.updateShareInventory(pjProductLaunchList);
 			}
 			ship.setShipItemsList(ship.getShipItemsList());
@@ -3830,7 +3834,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 				throw new RuntimeException(res1.getMsg());
 			}
 			String stata = sysClient.paramServiceValue(AuthUtil.getTenantId(), "whether.open.share");
-			if (!pjProductLaunchList.isEmpty() && "1".equals(stata)){
+			if (!pjProductLaunchList.isEmpty() && "1".equals(stata)) {
 				sharePutOnShelvesService.updateShareInventory(pjProductLaunchList);
 			}
 			ship.setShipItemsList(ship.getShipItemsList());
@@ -3893,6 +3897,11 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 		if (ObjectUtils.isNotNull(status) && "1".equals(status) && "1".equals(storageDesc.getWhetherFinancing())) {
 			String firstProportion = sysClient.getParamService("first.month.proportion");
 			String secondProportion = sysClient.getParamService("second.month.proportion");
+			String financingDays = sysClient.getParamService("financing.days");
+			int days = -90;
+			if(ObjectUtils.isNotNull(financingDays) && !"获取数据失败".equals(financingDays)){
+				days = -Integer.parseInt(financingDays);
+			}
 			PjpfFunding pjpfFunding = pjpfFundingService.getOne(new LambdaQueryWrapper<PjpfFunding>()
 				.eq(PjpfFunding::getTenantId, AuthUtil.getTenantId())
 				.eq(PjpfFunding::getIsDeleted, 0));
@@ -3902,7 +3911,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 			Date date = new Date();
 			Calendar calendarDate = Calendar.getInstance();
 			calendarDate.setTime(date);
-			calendarDate.add(Calendar.DAY_OF_MONTH, -90);
+			calendarDate.add(Calendar.DAY_OF_MONTH, days);
 			Date dateTime = calendarDate.getTime();
 			//获取融资采购单主表数据
 			List<PjOrder> orderList = orderMapper.selectList(new LambdaQueryWrapper<PjOrder>()
@@ -4278,7 +4287,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 				throw new RuntimeException(res1.getMsg());
 			}
 			String stata = sysClient.paramServiceValue(AuthUtil.getTenantId(), "whether.open.share");
-			if (!pjProductLaunchList.isEmpty() && "1".equals(stata)){
+			if (!pjProductLaunchList.isEmpty() && "1".equals(stata)) {
 				sharePutOnShelvesService.updateShareInventory(pjProductLaunchList);
 			}
 			//修改任务发货数量
@@ -4852,7 +4861,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 				throw new RuntimeException(res.getMsg());
 			}
 			String stata = sysClient.paramServiceValue(AuthUtil.getTenantId(), "whether.open.share");
-			if (!pjProductLaunchList.isEmpty() && "1".equals(stata)){
+			if (!pjProductLaunchList.isEmpty() && "1".equals(stata)) {
 				sharePutOnShelvesService.updateShareInventory(pjProductLaunchList);
 			}
 			ship.setShipItemsList(ship.getShipItemsList());
@@ -5178,7 +5187,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 				throw new RuntimeException(res.getMsg());
 			}
 			String stata = sysClient.paramServiceValue(AuthUtil.getTenantId(), "whether.open.share");
-			if (!pjProductLaunchList.isEmpty() && "1".equals(stata)){
+			if (!pjProductLaunchList.isEmpty() && "1".equals(stata)) {
 				sharePutOnShelvesService.updateShareInventory(pjProductLaunchList);
 			}
 			ship.setShipItemsList(ship.getShipItemsList());

+ 116 - 97
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/shoppingCart/service/impl/ShoppingCartServiceImpl.java

@@ -1375,20 +1375,6 @@ public class ShoppingCartServiceImpl extends ServiceImpl<ShoppingCartMapper, PjS
 			TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
 			throw new RuntimeException("生成系统编号失败");
 		}
-		R<List<User>> res = userSearchClient.getWarehouseKeeper("业务员", AuthUtil.getDeptId());
-		List<PjOrder> pjOrderList = new ArrayList<>();
-		List<PjOrderItems> orderItemsList = new ArrayList<>();
-		List<PjOrderItems> orderItemsListShare = new ArrayList<>();
-		//保存销售主表信息-本地销售单
-		PjOrder order = new PjOrder();
-		if (list.size() == 1) {//如果只有一个公司,订单编号和主编号一致
-			order.setOrdNo(SrcOrdNo);
-		} else {
-			order.setOrdNo(SrcOrdNo + "-" + 1);
-		}
-		order.setBusinesDate(new Date());
-		order.setSrcOrdNo(billNo);
-		order.setCreateUser(AuthUtil.getUserId());
 		//处理部门
 		int index = AuthUtil.getDeptId().indexOf(",");
 		Long deptId = null;
@@ -1397,44 +1383,11 @@ public class ShoppingCartServiceImpl extends ServiceImpl<ShoppingCartMapper, PjS
 		} else {
 			deptId = (Long.valueOf(AuthUtil.getDeptId()));
 		}
-		//根据客户账期计算应结日期
-		if (ObjectUtil.isNotEmpty(corpsDesc.getAccountPeriod())) {
-			Date now = new Date(); // 获取当前时间
-			long sevenDays = corpsDesc.getAccountPeriod() * 24 * 60 * 60 * 1000L;
-			Date afterSevenDays = new Date(now.getTime() + sevenDays);
-			order.setDueDate(afterSevenDays);
-		} else {
-			order.setDueDate(new Date());
-		}
-		order.setCreateTime(new Date());
-		order.setCreateDept(deptId);
-		order.setTenantId(AuthUtil.getTenantId());
-		order.setCustomerId(corpsDesc.getId());
-		order.setCustomerName(corpsDesc.getCname());
-		if (ObjectUtils.isNotNull(corpsDesc.getSalesmanId())) {
-			order.setSalerId(corpsDesc.getSalesmanId());
-			order.setSalerName(corpsDesc.getSalesmanName());
-		} else {
-			if (res.isSuccess() && ObjectUtils.isNotNull(res.getData()) && !res.getData().isEmpty()) {
-				order.setSalerId(res.getData().get(0).getId());
-				order.setSalerName(res.getData().get(0).getAccount());
-			}
-		}
-		if (ObjectUtils.isNotNull(corpsDesc.getDeliveryWarehouseId())) {
-			order.setStorageId(corpsDesc.getDeliveryWarehouseId());
-			order.setStorageName(corpsDesc.getDeliveryWarehouseName());
-		}
-		order.setSalesCompanyId(deptId);
-		order.setSalesCompanyName(sysClient.getDeptName(deptId).getData());
-		order.setRecAddress(address);
-		order.setContacts(corpsAttn.getCname());
-		order.setPhone(corpsAttn.getTel());
-		order.setBsType(OrderTypeEnum.SALES.getType());
-		order.setBusinessSource("额度支付");
-		order.setReceivableType("网络支付");
-		order.setBillType(0);
-		orderService.save(order);
-		pjOrderList.add(order);
+		R<List<User>> res = userSearchClient.getWarehouseKeeper("业务员", AuthUtil.getDeptId());
+		List<PjOrder> pjOrderList = new ArrayList<>();
+		List<PjOrderItems> orderItemsList = new ArrayList<>();
+		List<PjOrderItems> orderItemsListShare = new ArrayList<>();
+
 		for (PjShoppingCart item : list) {
 			if (item.getInventory().compareTo(item.getGoodsNum()) < 0) {
 				throw new RuntimeException("库存不足");
@@ -1451,17 +1404,15 @@ public class ShoppingCartServiceImpl extends ServiceImpl<ShoppingCartMapper, PjS
 				orderItems.setId(null);
 				orderItems.setSendNum(new BigDecimal("0.00"));
 				orderItems.setCreateUser(AuthUtil.getUserId());
-				orderItems.setCreateDept(order.getCreateDept());
+				orderItems.setCreateDept(deptId);
 				orderItems.setCreateTime(new Date());
-				orderItems.setPid(order.getId());
 				orderItems.setTenantId(AuthUtil.getTenantId());
-				orderItems.setBillNo(order.getOrdNo());
-				orderItems.setBizType(order.getBsType());
+				orderItems.setBillNo(billNo);
+				orderItems.setBizType("XS");
 				orderItems.setInventory(item.getInventory());
 				orderItems.setTotalAmount(orderItems.getGoodsNum().multiply(orderItems.getPrice()));
 				orderItems.setUrl(ObjectUtils.isNotNull(item.getFilesList()) && !item.getFilesList().isEmpty() ? item.getFilesList().get(0).getUrl() : "");
 				orderItems.setGoodsName(item.getGoodsName());
-				orderItemsMapper.insert(orderItems);
 				orderItemsList.add(orderItems);
 				productLaunch.setInventory(productLaunch.getInventory().subtract(orderItems.getGoodsNum()));
 				productLaunchMapper.updateById(productLaunch);
@@ -1472,7 +1423,7 @@ public class ShoppingCartServiceImpl extends ServiceImpl<ShoppingCartMapper, PjS
 					items.setUpdateUser(AuthUtil.getUserId());
 					sharePutOnShelvesMapper.updateSharePutOnShelves(items);
 				}
-			} else {
+			} else {//共享销售
 				//保存销售明细信息
 				PjOrderItems orderItems = new PjOrderItems();
 				BeanUtils.copyProperties(item, orderItems);
@@ -1482,12 +1433,11 @@ public class ShoppingCartServiceImpl extends ServiceImpl<ShoppingCartMapper, PjS
 				orderItems.setId(null);
 				orderItems.setSendNum(new BigDecimal("0.00"));
 				orderItems.setCreateUser(AuthUtil.getUserId());
-				orderItems.setCreateDept(order.getCreateDept());
+				orderItems.setCreateDept(deptId);
 				orderItems.setCreateTime(new Date());
-				orderItems.setPid(order.getId());
 				orderItems.setTenantId(AuthUtil.getTenantId());
-				orderItems.setBillNo(order.getOrdNo());
-				orderItems.setBizType(order.getBsType());
+				orderItems.setBillNo(billNo);
+				orderItems.setBizType("GX");
 				orderItems.setUrl(ObjectUtils.isNotNull(item.getFilesList()) && !item.getFilesList().isEmpty() ? item.getFilesList().get(0).getUrl() : "");
 				orderItems.setGoodsName(item.getGoodsName());
 
@@ -1500,10 +1450,10 @@ public class ShoppingCartServiceImpl extends ServiceImpl<ShoppingCartMapper, PjS
 				orderItemsShare.setId(null);
 				orderItemsShare.setSendNum(new BigDecimal("0.00"));
 				orderItemsShare.setCreateUser(AuthUtil.getUserId());
-				orderItemsShare.setCreateDept(order.getCreateDept());
+				orderItemsShare.setCreateDept(deptId);
 				orderItemsShare.setCreateTime(new Date());
 				orderItemsShare.setTenantId(AuthUtil.getTenantId());
-				orderItemsShare.setBillNo(order.getOrdNo());
+				orderItemsShare.setBillNo(billNo);
 				orderItemsShare.setBizType("GX");
 				orderItemsShare.setUrl(ObjectUtils.isNotNull(item.getFilesList()) && !item.getFilesList().isEmpty() ? item.getFilesList().get(0).getUrl() : "");
 				orderItemsShare.setGoodsName(item.getGoodsName());
@@ -1512,8 +1462,16 @@ public class ShoppingCartServiceImpl extends ServiceImpl<ShoppingCartMapper, PjS
 					orderItems.setGoodsNum(productLaunch.getInventory());
 					orderItems.setTotalAmount(orderItems.getGoodsNum().multiply(orderItems.getPrice()));
 					orderItems.setNextDayNum(item.getGoodsNum().subtract(productLaunch.getInventory()));
-					orderItemsMapper.insert(orderItems);
 					orderItemsList.add(orderItems);
+					productLaunch.setInventory(productLaunch.getInventory().subtract(orderItems.getGoodsNum()));
+					productLaunchMapper.updateById(productLaunch);
+					List<SharePutOnShelves> sharePutOnShelvesList = sharePutOnShelvesMapper.selectListShare(productLaunch.getId() + "");
+					for (SharePutOnShelves items : sharePutOnShelvesList) {
+						items.setInventory(productLaunch.getInventory());
+						items.setUpdateTime(new Date());
+						items.setUpdateUser(AuthUtil.getUserId());
+						sharePutOnShelvesMapper.updateSharePutOnShelves(items);
+					}
 					orderItemsShare.setInventory(item.getInventory());
 					orderItemsShare.setGoodsNum(item.getGoodsNum().subtract(productLaunch.getInventory()));
 					orderItemsShare.setTotalAmount(orderItems.getGoodsNum().multiply(orderItems.getPrice()));
@@ -1582,50 +1540,111 @@ public class ShoppingCartServiceImpl extends ServiceImpl<ShoppingCartMapper, PjS
 			}, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
 			orderShare.setSalesAmount(totalMoney);
 			orderShare.setTotalMoney(totalMoney);
+			orderShare.setPaymentAmountTl(orderShare.getTotalMoney());
+			orderShare.setActualPaymentStatus(2);
+			orderShare.setPaymentDate(new Date());
+			orderShare.setStatus(OrderTypeEnum.XSDQR.getType());
+			orderShare.setXcxStatus(OrderTypeEnum.XSDFH.getType());
 			orderShare.setGoodsNameJoin(orderItemsListShare.stream().map(PjOrderItems::getGoodsName).collect(Collectors.joining(",")));
 			orderShare.setShortcutJoin(orderItemsListShare.stream().map(PjOrderItems::getCnameInt).collect(Collectors.joining(",")));
-			corpsDesc.setLimitAmount(corpsDesc.getLimitAmount().subtract(totalMoney));
 			pjOrderList.add(orderShare);
 			orderService.save(orderShare);
-			pjOrderList.add(orderShare);
 			for (PjOrderItems item : orderItemsListShare) {
 				item.setPid(orderShare.getId());
 				orderItemsMapper.insert(item);
 			}
+			corpsDesc.setLimitAmount(corpsDesc.getLimitAmount().subtract(totalMoney));
+			corpsDescService.updateById(corpsDesc);
 		}
-		BigDecimal totalMoney = BigDecimal.ZERO;
-		order.setNumberRows(orderItemsList.size());//行数
-		//明细总数量
-		order.setGoodsTotalNum(orderItemsList.stream().map(PjOrderItems::getGoodsNum).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
-		//明细总金额
-		totalMoney = orderItemsList.stream().reduce(BigDecimal.ZERO, (x, y) -> {
-			return x.add(y.getGoodsNum().multiply(y.getPrice()));
-		}, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
-		order.setSalesAmount(totalMoney);
-		order.setTotalMoney(totalMoney);
-		if (order.getGoodsTotalNum().compareTo(new BigDecimal(1)) == 0) {
-			String freight = sysClient.getParamServiceDWT("freight", corpsDesc.getTenantId());
-			if (ObjectUtils.isNotNull(freight)) {
-				try {
-					BigDecimal freightAmount = new BigDecimal(freight);
-					order.setTotalMoney(totalMoney.add(freightAmount));
-					order.setFreight(freightAmount);
-				} catch (Exception ignored) {
-					order.setFreight(new BigDecimal(0));
+		if (!orderItemsList.isEmpty()){
+			//保存销售主表信息-本地销售单
+			PjOrder order = new PjOrder();
+			if (list.size() == 1) {//如果只有一个公司,订单编号和主编号一致
+				order.setOrdNo(SrcOrdNo);
+			} else {
+				order.setOrdNo(SrcOrdNo + "-" + 1);
+			}
+			order.setBusinesDate(new Date());
+			order.setSrcOrdNo(billNo);
+			order.setCreateUser(AuthUtil.getUserId());
+			//根据客户账期计算应结日期
+			if (ObjectUtil.isNotEmpty(corpsDesc.getAccountPeriod())) {
+				Date now = new Date(); // 获取当前时间
+				long sevenDays = corpsDesc.getAccountPeriod() * 24 * 60 * 60 * 1000L;
+				Date afterSevenDays = new Date(now.getTime() + sevenDays);
+				order.setDueDate(afterSevenDays);
+			} else {
+				order.setDueDate(new Date());
+			}
+			order.setCreateTime(new Date());
+			order.setCreateDept(deptId);
+			order.setTenantId(AuthUtil.getTenantId());
+			order.setCustomerId(corpsDesc.getId());
+			order.setCustomerName(corpsDesc.getCname());
+			if (ObjectUtils.isNotNull(corpsDesc.getSalesmanId())) {
+				order.setSalerId(corpsDesc.getSalesmanId());
+				order.setSalerName(corpsDesc.getSalesmanName());
+			} else {
+				if (res.isSuccess() && ObjectUtils.isNotNull(res.getData()) && !res.getData().isEmpty()) {
+					order.setSalerId(res.getData().get(0).getId());
+					order.setSalerName(res.getData().get(0).getAccount());
+				}
+			}
+			if (ObjectUtils.isNotNull(corpsDesc.getDeliveryWarehouseId())) {
+				order.setStorageId(corpsDesc.getDeliveryWarehouseId());
+				order.setStorageName(corpsDesc.getDeliveryWarehouseName());
+			}
+			order.setSalesCompanyId(deptId);
+			order.setSalesCompanyName(sysClient.getDeptName(deptId).getData());
+			order.setRecAddress(address);
+			order.setContacts(corpsAttn.getCname());
+			order.setPhone(corpsAttn.getTel());
+			order.setBsType(OrderTypeEnum.SALES.getType());
+			order.setBusinessSource("额度支付");
+			order.setReceivableType("网络支付");
+			order.setBillType(0);
+			BigDecimal totalMoney = BigDecimal.ZERO;
+			order.setNumberRows(orderItemsList.size());//行数
+			//明细总数量
+			order.setGoodsTotalNum(orderItemsList.stream().map(PjOrderItems::getGoodsNum).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
+			//明细总金额
+			totalMoney = orderItemsList.stream().reduce(BigDecimal.ZERO, (x, y) -> {
+				return x.add(y.getGoodsNum().multiply(y.getPrice()));
+			}, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
+			order.setSalesAmount(totalMoney);
+			order.setTotalMoney(totalMoney);
+			if (order.getGoodsTotalNum().compareTo(new BigDecimal(1)) == 0) {
+				String freight = sysClient.getParamServiceDWT("freight", corpsDesc.getTenantId());
+				if (ObjectUtils.isNotNull(freight)) {
+					try {
+						BigDecimal freightAmount = new BigDecimal(freight);
+						order.setTotalMoney(totalMoney.add(freightAmount));
+						order.setFreight(freightAmount);
+					} catch (Exception ignored) {
+						order.setFreight(new BigDecimal(0));
+					}
 				}
 			}
+			order.setGoodsNameJoin(orderItemsList.stream().map(PjOrderItems::getGoodsName).collect(Collectors.joining(",")));
+			order.setShortcutJoin(orderItemsList.stream().map(PjOrderItems::getCnameInt).collect(Collectors.joining(",")));
+			order.setPaymentDate(new Date());
+			order.setActualPaymentStatus(2);
+			order.setPaymentAmountTl(order.getTotalMoney());
+			order.setPaymentDate(new Date());
+			order.setStatus(OrderTypeEnum.XSDQR.getType());
+			order.setXcxStatus(OrderTypeEnum.XSDFH.getType());
+			corpsDesc.setLimitAmount(corpsDesc.getLimitAmount().subtract(order.getTotalMoney()));
+			orderService.save(order);
+			pjOrderList.add(order);
+			corpsDescService.updateById(corpsDesc);
+			for (PjOrderItems item : orderItemsList) {
+				item.setCreateDept(order.getCreateDept());
+				item.setPid(order.getId());
+				item.setBillNo(order.getOrdNo());
+				item.setBizType(order.getBsType());
+				orderItemsMapper.insert(item);
+			}
 		}
-		order.setGoodsNameJoin(orderItemsList.stream().map(PjOrderItems::getGoodsName).collect(Collectors.joining(",")));
-		order.setShortcutJoin(orderItemsList.stream().map(PjOrderItems::getCnameInt).collect(Collectors.joining(",")));
-		order.setPaymentDate(new Date());
-		order.setActualPaymentStatus(1);
-		order.setPaymentAmountTl(order.getTotalMoney());
-		order.setStatus(OrderTypeEnum.XSDQR.getType());
-		order.setXcxStatus(OrderTypeEnum.XSDFH.getType());
-		corpsDesc.setLimitAmount(corpsDesc.getLimitAmount().subtract(order.getTotalMoney()));
-		pjOrderList.add(order);
-		orderService.updateBatchById(pjOrderList);
-		corpsDescService.updateById(corpsDesc);
 		for (PjOrder item : pjOrderList) {
 			LocalDateTime now = LocalDateTime.now();
 			DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");

+ 8 - 1
blade-service/blade-system/src/main/java/org/springblade/system/controller/PostController.java

@@ -18,6 +18,7 @@ package org.springblade.system.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.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.annotations.Api;
@@ -81,7 +82,13 @@ public class PostController extends BladeController {
 	@ApiOperationSupport(order = 2)
 	@ApiOperation(value = "分页", notes = "传入post")
 	public R<IPage<PostVO>> list(Post post, Query query) {
-		IPage<Post> pages = postService.page(Condition.getPage(query), Condition.getQueryWrapper(post));
+		LambdaQueryWrapper<Post> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+		lambdaQueryWrapper.eq(Post::getTenantId,AuthUtil.getTenantId())
+			.eq(Post::getIsDeleted,0)
+			.eq(ObjectUtils.isNotNull(post.getPostCode()),Post::getPostCode,post.getPostCode())
+			.eq(ObjectUtils.isNotNull(post.getCategory()),Post::getCategory,post.getCategory())
+			.eq(ObjectUtils.isNotNull(post.getPostName()),Post::getPostName,post.getPostName());
+		IPage<Post> pages = postService.page(Condition.getPage(query), lambdaQueryWrapper);
 		return R.data(PostWrapper.build().pageVO(pages));
 	}
 

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

@@ -4043,9 +4043,9 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
 		if (!itemsList.isEmpty()) {
 			model.setBillNo(itemsList.stream().map(Items::getSrcBillNo).distinct().collect(Collectors.joining(",")));
 			model.setSrcOrderno(itemsList.stream().map(Items::getSrcOrderno).distinct().collect(Collectors.joining(",")));
-			model.setForeignAmount(itemsList.stream().filter(e -> e.getAmount() != null && !"1".equals(e.getCurrency()))
+			model.setForeignAmount(itemsList.stream().filter(e -> e.getThisAmount() != null && !"1".equals(e.getCurrency()))
 				.map(Items::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
-			model.setAmount(itemsList.stream().filter(e -> e.getAmount() != null && "1".equals(e.getCurrency()))
+			model.setAmount(itemsList.stream().filter(e -> e.getThisAmount() != null && "1".equals(e.getCurrency()))
 				.map(Items::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
 		}
 		//如果id=null, 无论主表还是从表, 必然都是新增