Pārlūkot izejas kodu

1.成本中心批量复制接口逻辑修改
2.决策分析分组条件修改
3.增加换单列表接口
4.增加申请换单接口
5.增加撤销换单接口
6.增加电子提货单接口
7.增加撤销电子提货单接口
8.增加确认换单接口
9.增加确认设备单接口
10.增加确认收押箱款接口
11.增加确认退押箱款接口
12.增加换单文件保存接口
13.增加换单文件列表接口
14.增加财务检索账单数据导出接口
15.海运进出口报表打印增加字段

纪新园 10 mēneši atpakaļ
vecāks
revīzija
c964cb8483
15 mainītis faili ar 1024 papildinājumiem un 27 dzēšanām
  1. 6 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/basic/commodity/entity/BCommodity.java
  2. 6 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/basic/corps/entity/BCorps.java
  3. 61 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/business/sea/entity/Bills.java
  4. 117 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/finance/fee/vo/AccBillExcel.java
  5. 37 1
      blade-service/blade-los/src/main/java/org/springblade/los/basic/reports/service/impl/ReportsServiceImpl.java
  6. 11 6
      blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/RouteCostServiceImpl.java
  7. 2 2
      blade-service/blade-los/src/main/java/org/springblade/los/business/sea/controller/BillsController.java
  8. 188 0
      blade-service/blade-los/src/main/java/org/springblade/los/business/sea/controller/ChangeOrderController.java
  9. 1 1
      blade-service/blade-los/src/main/java/org/springblade/los/business/sea/mapper/BillsMapper.java
  10. 32 1
      blade-service/blade-los/src/main/java/org/springblade/los/business/sea/mapper/BillsMapper.xml
  11. 25 1
      blade-service/blade-los/src/main/java/org/springblade/los/business/sea/service/IBillsService.java
  12. 352 3
      blade-service/blade-los/src/main/java/org/springblade/los/business/sea/service/impl/BillsServiceImpl.java
  13. 169 0
      blade-service/blade-los/src/main/java/org/springblade/los/finance/fee/controller/FinAccBillsController.java
  14. 12 12
      blade-service/blade-los/src/main/java/org/springblade/los/finance/fee/mapper/FinAccBillsMapper.xml
  15. 5 0
      blade-service/blade-los/src/main/java/org/springblade/los/finance/operatingExpenses/controller/OperatingExpensesController.java

+ 6 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/basic/commodity/entity/BCommodity.java

@@ -146,5 +146,11 @@ public class BCommodity implements Serializable {
 	@ApiModelProperty(value = "税率")
 	private BigDecimal taxRate;
 
+	/**
+	 * 授信等级,A=A级,B=B级,B+=B+级,B-=B-级,C=C级,D=黑名单
+	 */
+	@ApiModelProperty(value = "授信等级,A=A级,B=B级,B+=B+级,B-=B-级,C=C级,D=黑名单")
+	private String creditLevel;
+
 
 }

+ 6 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/basic/corps/entity/BCorps.java

@@ -652,6 +652,12 @@ public class BCorps implements Serializable {
 	private String carrierArgreementNo;
 
 	/**
+	 * ftp端口
+	 */
+	@ApiModelProperty(value = "ftp端口")
+	private String portFtp;
+
+	/**
 	 * 场站ids
 	 */
 	@TableField(exist = false)

+ 61 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/business/sea/entity/Bills.java

@@ -36,6 +36,7 @@ import org.springblade.los.utils.LosSpecialHandle;
 import org.springblade.system.entity.Dept;
 import org.springframework.format.annotation.DateTimeFormat;
 
+import javax.validation.constraints.NotEmpty;
 import java.io.Serializable;
 import java.math.BigDecimal;
 import java.util.Date;
@@ -1653,6 +1654,50 @@ public class Bills implements Serializable {
 	private String reason;
 
 	/**
+	 * 换单状态
+	 */
+	@ApiModelProperty(value = "换单状态")
+	private String changeOrderStatus;
+
+	/**
+	 * 提货单状态
+	 */
+	@ApiModelProperty(value = "提货单状态")
+	private String deliveryNoteStatus;
+
+	/**
+	 * 设备单状态
+	 */
+	@ApiModelProperty(value = "设备单状态")
+	private String equipmentSingleStatus;
+	/**
+	 * 押箱金额
+	 */
+	@ApiModelProperty(value = "押箱金额")
+	private BigDecimal boxPackingAmount;
+	/**
+	 * 收押箱款日期
+	 */
+	@ApiModelProperty(value = "收押箱款日期")
+	private Date harvestBoxPackingDate;
+	/**
+	 * 退押箱款日期
+	 */
+	@ApiModelProperty(value = "退押箱款日期")
+	private Date retreatBoxPackingDate;
+
+	/**
+	 * 本位币实收
+	 */
+	@TableField(exist = false)
+	private BigDecimal receivedAmountDr;
+	/**
+	 * 外币实收
+	 */
+	@TableField(exist = false)
+	private BigDecimal receivedAmountDrUsd;
+
+	/**
 	 * 到港日期
 	 */
 	@TableField(exist = false)
@@ -2210,6 +2255,11 @@ public class Bills implements Serializable {
 	@TableField(exist = false)
 	private String corpAddressEn;
 	/**
+	 * 统一社会信用代码
+	 */
+	@TableField(exist = false)
+	private String uscc;
+	/**
 	 * Swift Code
 	 */
 	@TableField(exist = false)
@@ -2557,4 +2607,15 @@ public class Bills implements Serializable {
 	 */
 	@TableField(exist = false)
 	private String attached;
+	/**
+	 * 操作电话
+	 */
+	@TableField(exist = false)
+	private String operatorTel;
+	/**
+	 * 操作邮箱
+	 */
+	@TableField(exist = false)
+	private String operatorEmail;
+
 }

+ 117 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/finance/fee/vo/AccBillExcel.java

@@ -0,0 +1,117 @@
+package org.springblade.los.finance.fee.vo;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
+import com.alibaba.excel.annotation.write.style.ContentRowHeight;
+import com.alibaba.excel.annotation.write.style.HeadRowHeight;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @author :jixinyuan
+ * @date : 2025/9/8
+ */
+@Data
+@ColumnWidth(25)
+@HeadRowHeight(20)
+@ContentRowHeight(18)
+public class AccBillExcel {
+
+	/**
+	 * 所属公司
+	 */
+	@ExcelProperty(value = "所属公司")
+	private String branchName;
+
+	/**
+	 * 客户中文名称
+	 */
+	@ExcelProperty(value = "客户中文名称")
+	private String corpCnName;
+
+	/**
+	 * JOB NO
+	 */
+	@ExcelProperty(value = "JOB NO")
+	private String businessBillNo;
+
+	/**
+	 * MB/L NO
+	 */
+	@ExcelProperty(value = "MB/L NO")
+	private String mblno;
+	/**
+	 * HB/L NO
+	 */
+	@ExcelProperty(value = "HB/L NO")
+	private String hblno;
+
+	/**
+	 * 币别
+	 */
+	@ExcelProperty(value = "币别")
+	private String curCode;
+
+	/**
+	 * 收付
+	 */
+	@ExcelProperty(value = "收付")
+	private String accountDc;
+
+	/**
+	 * 收付
+	 */
+	@ExcelProperty(value = "金额")
+	private BigDecimal amount;
+
+	/**
+	 * 汇率
+	 */
+	@ExcelProperty(value = "汇率")
+	private BigDecimal exrate;
+
+	/**
+	 * 起运港
+	 */
+	@ExcelProperty(value = "起运港")
+	private String polCnName;
+
+	/**
+	 * 目的港
+	 */
+	@ExcelProperty(value = "目的港")
+	private String podCnName;
+
+	/**
+	 * 箱型箱量
+	 */
+	@ExcelProperty(value = "箱型箱量")
+	private String quantityCntrDescr;
+
+	/**
+	 * 业务类型
+	 */
+	@ExcelProperty(value = "业务类型")
+	private String businessType;
+
+	/**
+	 * 船名
+	 */
+	@ExcelProperty(value = "船名")
+	private String vesselCnName;
+
+	/**
+	 * 航次
+	 */
+	@ExcelProperty(value = "航次")
+	private String voyageNo;
+
+	/**
+	 * 业务日期
+	 */
+	@ExcelProperty(value = "业务日期")
+	private Date businessDate;
+
+}

+ 37 - 1
blade-service/blade-los/src/main/java/org/springblade/los/basic/reports/service/impl/ReportsServiceImpl.java

@@ -1512,6 +1512,19 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 				bills = this.assignmentSeaBillsDetail(bills);
 //				bills.setFM(MagicValues.FM);
 				bills.setVesselCnName(bills.getVesselEnName() + "/" + bills.getVoyageNo());
+				if (ObjectUtils.isNotNull(bills.getOperatorId())){
+					R<User> userR = userClient.userInfoById(bills.getOperatorId());
+					if (userR.isSuccess() && ObjectUtils.isNotNull(userR.getData())){
+						bills.setOperatorTel(userR.getData().getPhone());
+						bills.setOperatorEmail(userR.getData().getEmail());
+					}
+				}
+				BCorps bCorps = bCorpsService.getById(bills.getCorpId());
+				if (bCorps != null) {
+					bills.setCorpAddress(bCorps.getCnAddr());
+					bills.setCorpAddressEn(bCorps.getEnAddr());
+					bills.setUscc(bCorps.getUscc());
+				}
 				bills.setDept(dept);
 				map.put(MagicValues.DATA, bills);
 			} else {
@@ -1592,7 +1605,19 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 				if (bCorps != null) {
 					bills.setCorpAddress(bCorps.getCnAddr());
 					bills.setCorpAddressEn(bCorps.getEnAddr());
+					bills.setUscc(bCorps.getUscc());
+				}
+				List<Containers> containersList = containersService.list(new LambdaQueryWrapper<Containers>()
+					.eq(Containers::getTenantId, AuthUtil.getTenantId())
+					.eq(Containers::getIsDeleted, 0)
+					.eq(Containers::getPid, bills.getId()));
+				StringBuilder cntrSealNo = new StringBuilder();
+				for (Containers item : containersList) {
+					if (ObjectUtils.isNotNull(item.getCntrNo()) || ObjectUtils.isNotNull(item.getSealNo())) {
+						cntrSealNo.append(item.getCntrNo()).append("/").append(item.getSealNo()).append("<br/>");
+					}
 				}
+				bills.setCntrSealNo(cntrSealNo.toString());
 				bills.setDept(dept);
 				map.put(MagicValues.DATA, bills);
 			} else {
@@ -1615,7 +1640,6 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 				List<BCurExrate> curExrateList = currencyUtils.obtainRate(date, "1", bills.getBranchId());
 				bills = this.dictionaryConversion(bills);
 				bills = this.assignmentSeaBillsDetail(bills);
-//				bills.setFM(MagicValues.FM);
 				bills.setVesselCnName(bills.getVesselEnName() + "/" + bills.getVoyageNo());
 				List<FeeCenter> feeCenterList;
 				List<Long> ids = new ArrayList<>();
@@ -1663,7 +1687,19 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 				if (bCorps != null) {
 					bills.setCorpAddress(bCorps.getCnAddr());
 					bills.setCorpAddressEn(bCorps.getEnAddr());
+					bills.setUscc(bCorps.getUscc());
+				}
+				List<Containers> containersList = containersService.list(new LambdaQueryWrapper<Containers>()
+					.eq(Containers::getTenantId, AuthUtil.getTenantId())
+					.eq(Containers::getIsDeleted, 0)
+					.eq(Containers::getPid, bills.getId()));
+				StringBuilder cntrSealNo = new StringBuilder();
+				for (Containers item : containersList) {
+					if (ObjectUtils.isNotNull(item.getCntrNo()) || ObjectUtils.isNotNull(item.getSealNo())) {
+						cntrSealNo.append(item.getCntrNo()).append("/").append(item.getSealNo()).append("<br/>");
+					}
 				}
+				bills.setCntrSealNo(cntrSealNo.toString());
 				map.put(MagicValues.DATA, bills);
 			} else {
 				map.put(MagicValues.DATA, null);

+ 11 - 6
blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/RouteCostServiceImpl.java

@@ -974,7 +974,7 @@ public class RouteCostServiceImpl extends ServiceImpl<RouteCostMapper, RouteCost
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public R batchCopy(String ids, BigDecimal exrate, Date effectiveStartDate, Date effectiveEndDate,String type,String curCode) {
+	public R batchCopy(String ids, BigDecimal exrate, Date effectiveStartDate, Date effectiveEndDate,String type,String s) {
 		if (ObjectUtils.isNull(ids) || ObjectUtils.isNull(exrate) || ObjectUtils.isNull(effectiveStartDate)
 			|| ObjectUtils.isNull(effectiveEndDate)) {
 			throw new RuntimeException("缺少必要参数");
@@ -1004,6 +1004,7 @@ public class RouteCostServiceImpl extends ServiceImpl<RouteCostMapper, RouteCost
 			.eq(RouteCostItem::getIsDeleted, 0)
 			.in(RouteCostItem::getPid, Func.toLongList(ids)));
 		List<RouteCost> routeCostListNew = new ArrayList<>();
+		String exrateType = currencyUtils.standardCurrency(AuthUtil.getDeptId());
 		for (RouteCost item : routeCostList) {
 			item.setCopyId(item.getId());
 			item.setId(null);
@@ -1046,8 +1047,9 @@ public class RouteCostServiceImpl extends ServiceImpl<RouteCostMapper, RouteCost
 						costFeeItem.setUpdateUser(null);
 						costFeeItem.setUpdateTime(null);
 						costFeeItem.setUpdateUserName(null);
-						costFeeItem.setExrate(exrate);
-						costFeeItem.setCurCode(curCode);
+						if (!exrateType.equals(costFeeItem.getCurCode())){
+							costFeeItem.setExrate(exrate);
+						}
 						costFeesListNew.add(costFeeItem);
 						costFeesListNews.add(costFeeItem);
 					}
@@ -1065,8 +1067,9 @@ public class RouteCostServiceImpl extends ServiceImpl<RouteCostMapper, RouteCost
 						costItem.setUpdateUser(null);
 						costItem.setUpdateTime(null);
 						costItem.setUpdateUserName(null);
-						costItem.setExrate(exrate);
-						costItem.setCurCode(curCode);
+						if (!exrateType.equals(costItem.getCurCode())){
+							costItem.setExrate(exrate);
+						}
 						costItemListNews.add(costItem);
 					}
 					item.setCostItemList(costItemListNews.isEmpty() ? new ArrayList<>() : costItemListNews);
@@ -1075,7 +1078,9 @@ public class RouteCostServiceImpl extends ServiceImpl<RouteCostMapper, RouteCost
 					int days = item.getNavigateDay() + item.getExistStationDay();
 					List<RouteCostFee> costFeeList = item.getCostFeeList();
 					for (RouteCostItem routeCostItem : item.getCostItemList()) {
-						routeCostItem.setExrate(exrate);
+						if (!exrateType.equals(routeCostItem.getCurCode())){
+							routeCostItem.setExrate(exrate);
+						}
 						//一程POL杂费成本
 						routeCostItem.setPolCost(computationalCost(costFeeList, "POL", routeCostItem.getBoxType(), routeCostItem.getExrate(), "0"));
 						//一程POL杂费收入

+ 2 - 2
blade-service/blade-los/src/main/java/org/springblade/los/business/sea/controller/BillsController.java

@@ -343,8 +343,8 @@ public class BillsController extends BladeController {
 	@GetMapping("/page")
 	@ApiOperationSupport(order = 3)
 	@ApiOperation(value = "分页", notes = "传入bills")
-	public R<IPage<BillsVO>> page(BillsVO bills, Query query) {
-		IPage<BillsVO> pages = billsService.selectBillsPage(Condition.getPage(query), bills);
+	public R<IPage<Bills>> page(Bills bills, Query query) {
+		IPage<Bills> pages = billsService.selectBillsPage(Condition.getPage(query), bills);
 		return R.data(pages);
 	}
 

+ 188 - 0
blade-service/blade-los/src/main/java/org/springblade/los/business/sea/controller/ChangeOrderController.java

@@ -0,0 +1,188 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.business.sea.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.api.R;
+import org.springblade.los.Util.CurrencyUtils;
+import org.springblade.los.business.files.entity.FilesCenter;
+import org.springblade.los.business.sea.entity.Bills;
+import org.springblade.los.business.sea.service.IBillsService;
+import org.springblade.los.finance.fee.entity.FeeCenter;
+import org.springblade.los.finance.fee.service.IFeeCenterService;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 业务-进口换单 控制器
+ *
+ * @author BladeX
+ * @since 2023-10-16
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/changeOrder")
+@Api(value = "业务-进口换单", tags = "业务-进口换单接口")
+public class ChangeOrderController extends BladeController {
+
+	private final IBillsService billsService;
+
+	private final IFeeCenterService feeCenterService;
+
+	private final CurrencyUtils currencyUtils;
+
+	/**
+	 * 分页 业务-进口换单
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入bills")
+	public R<IPage<Bills>> list(Bills bills, Query query) {
+		LambdaQueryWrapper<Bills> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+		lambdaQueryWrapper.eq(Bills::getIsDeleted, 0)
+			.orderByDesc(Bills::getCreateTime);
+		bills.setTenantId(AuthUtil.getTenantId());
+		if (!AuthUtil.getUserRole().contains("总部") && !AuthUtil.getUserRole().contains("admin")) {
+			bills.setBranchId(AuthUtil.getDeptId());
+		}
+		IPage<Bills> pages = billsService.selectBillsPage(Condition.getPage(query), bills);
+		if (!pages.getRecords().isEmpty()) {
+			List<Long> ids = pages.getRecords().stream().map(Bills::getId).collect(Collectors.toList());
+			List<FeeCenter> feeCenterList = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
+				.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
+				.eq(FeeCenter::getIsDeleted, 0)
+				.eq(FeeCenter::getDc, "D")
+				.eq(FeeCenter::getAccStatus, "1")
+				.in(FeeCenter::getPid, ids)
+				.apply("stl_ttl_amount != 0"));
+			for (Bills item : pages.getRecords()) {
+				List<FeeCenter> feeCenters = new ArrayList<>();
+				if (!feeCenterList.isEmpty()) {
+					feeCenters = feeCenterList.stream().filter(e -> e.getPid().equals(item.getId()))
+						.collect(Collectors.toList());
+				}
+				if (!feeCenters.isEmpty()) {
+					String exrateType = currencyUtils.standardCurrency(item.getBranchId());
+					item.setReceivedAmountDr(feeCenterList.stream().filter(e -> exrateType.equals(e.getCurCode())).map(FeeCenter::getStlTtlAmount)
+						.reduce(BigDecimal.ZERO, BigDecimal::add));
+					item.setReceivedAmountDrUsd(feeCenterList.stream().filter(e -> exrateType.equals(e.getCurCode())).map(FeeCenter::getStlTtlAmount)
+						.reduce(BigDecimal.ZERO, BigDecimal::add));
+				} else {
+					item.setReceivedAmountDr(new BigDecimal("0.00"));
+					item.setReceivedAmountDrUsd(new BigDecimal("0.00"));
+				}
+			}
+		}
+		return R.data(pages);
+	}
+
+	/**
+	 * 申请换单
+	 */
+	@GetMapping("/applySwitch")
+	public R applySwitch(@RequestParam("id") Long id, @RequestParam("boxPackingAmount") BigDecimal boxPackingAmount) {
+		return billsService.applySwitch(id, boxPackingAmount);
+	}
+
+	/**
+	 * 撤销换单
+	 */
+	@GetMapping("/revokeSwitch")
+	public R revokeSwitch(@RequestParam("id") Long id) {
+		return billsService.revokeSwitch(id);
+	}
+
+	/**
+	 * 电子提货单
+	 */
+	@GetMapping("/electronBillOfLading")
+	public R electronBillOfLading(@RequestParam("id") Long id) {
+		return billsService.electronBillOfLading(id);
+	}
+
+	/**
+	 * 撤销电子提货单
+	 */
+	@GetMapping("/revokeElectronBillOfLading")
+	public R revokeElectronBillOfLading(@RequestParam("id") Long id) {
+		return billsService.revokeElectronBillOfLading(id);
+	}
+
+	/**
+	 * 确认换单
+	 */
+	@GetMapping("/confirmExchangeOrder")
+	public R confirmExchangeOrder(@RequestParam("id") Long id) {
+		return billsService.confirmExchangeOrder(id);
+	}
+
+	/**
+	 * 确认设备单
+	 */
+	@GetMapping("/confirmEquipmentList")
+	public R confirmEquipmentList(@RequestParam("ids") String ids) {
+		return billsService.confirmEquipmentList(ids);
+	}
+
+	/**
+	 * 确认收押箱款
+	 */
+	@PostMapping("/confirmPaymentCollection")
+	public R confirmPaymentCollection(@Valid @RequestBody Bills bills) {
+		return billsService.confirmPaymentCollection(bills);
+	}
+
+	/**
+	 * 确认退押箱款
+	 */
+	@PostMapping("/confirmRefund")
+	public R confirmRefund(@Valid @RequestBody Bills bills) {
+		return billsService.confirmRefund(bills);
+	}
+
+	/**
+	 * 换单文件保存
+	 */
+	@PostMapping("/changeOrderFile")
+	public R changeOrderFile(@Valid @RequestBody List<FilesCenter> filesCenterList) {
+		return billsService.changeOrderFile(filesCenterList);
+	}
+
+	/**
+	 * 换单文件列表
+	 */
+	@GetMapping("/changeOrderList")
+	public R changeOrderList(@RequestParam("id") String id, @RequestParam("type") String type) {
+		return billsService.changeOrderList(id, type);
+	}
+
+}
+

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

@@ -44,7 +44,7 @@ public interface BillsMapper extends BaseMapper<Bills> {
 	 * @param bills
 	 * @return
 	 */
-	List<BillsVO> selectBillsPage(IPage page, BillsVO bills);
+	List<Bills> selectBillsPage(IPage page, @Param("data")Bills bills);
 
 	List<FinAccBillsVO> listAccBill(@Param("acc") ListAccBillVO finAccBills);
 

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

@@ -264,10 +264,35 @@
     </resultMap>
 
 
-    <select id="selectBillsPage" resultMap="billsResultMap">
+    <select id="selectBillsPage" resultType="org.springblade.los.business.sea.entity.Bills">
         select *
         from los_sea_bills
         where is_deleted = 0
+        and business_type = 'SI'
+        and tenant_id = #{data.tenantId}
+        <if test='data.branchId != null and data.branchId != ""'>
+            and branch_id = #{data.branchId}
+        </if>
+        <if test="data.mblno != null and data.mblno != ''">
+            and mblno like concat('%', #{data.mblno}, '%')
+        </if>
+        <if test="data.hblno != null and data.hblno != ''">
+            and hblno like concat('%', #{data.hblno}, '%')
+        </if>
+        <if test="data.corpCnName != null and data.corpCnName != ''">
+            and (corp_cn_name like concat('%', #{data.corpCnName}, '%') or
+            corp_en_name like concat('%', #{data.corpCnName}, '%')or
+            short_name like concat('%', #{data.corpCnName}, '%'))
+        </if>
+        <if test='data.changeOrderStatus != null and data.changeOrderStatus != ""'>
+            and change_order_status = #{data.changeOrderStatus}
+        </if>
+        <if test='data.deliveryNoteStatus != null and data.deliveryNoteStatus != ""'>
+            and delivery_note_status = #{data.deliveryNoteStatus}
+        </if>
+        <if test='data.equipmentSingleStatus != null and data.equipmentSingleStatus != ""'>
+            and equipment_single_status = #{data.equipmentSingleStatus}
+        </if>
     </select>
     <select id="listAccBill" resultType="org.springblade.los.finance.fee.vo.FinAccBillsVO">
         SELECT DISTINCT
@@ -379,6 +404,9 @@
                 and fee.corp_id = #{acc.corpCnName}
             </if>
         </if>
+        <if test="acc.operatorName != null and acc.operatorName != ''">
+            and acc.operator_name like concat('%', #{acc.operatorName}, '%')
+        </if>
         <if test="acc.isSignfor != null">
             and fee.is_signfor = #{acc.isSignfor}
         </if>
@@ -1110,6 +1138,9 @@
         <if test="acc.voyageNo != null and acc.voyageNo != ''">
             and acc.voyage_no like concat('%', #{acc.voyageNo}, '%')
         </if>
+        <if test="acc.operatorName != null and acc.operatorName != ''">
+            and acc.operator_name like concat('%', #{acc.operatorName}, '%')
+        </if>
         <if test="acc.threeInspectionsNo != null and acc.threeInspectionsNo != ''">
             and acc.three_inspections_no like concat('%', #{acc.threeInspectionsNo}, '%')
         </if>

+ 25 - 1
blade-service/blade-los/src/main/java/org/springblade/los/business/sea/service/IBillsService.java

@@ -19,11 +19,13 @@ package org.springblade.los.business.sea.service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.springblade.core.tool.api.R;
+import org.springblade.los.business.files.entity.FilesCenter;
 import org.springblade.los.business.release.entity.SeaReleaseBillItems;
 import org.springblade.los.business.sea.entity.Bills;
 import org.springblade.los.business.sea.vo.BillsVO;
 import org.springblade.los.check.entity.LosAuditPathsLevels;
 
+import java.math.BigDecimal;
 import java.util.List;
 
 /**
@@ -41,7 +43,7 @@ public interface IBillsService extends IService<Bills> {
 	 * @param bills
 	 * @return
 	 */
-	IPage<BillsVO> selectBillsPage(IPage<BillsVO> page, BillsVO bills);
+	IPage<Bills> selectBillsPage(IPage<Bills> page, Bills bills);
 
 	/**
 	 * 新增或修改 业务-海运进出口
@@ -215,4 +217,26 @@ public interface IBillsService extends IService<Bills> {
 	R refundCabin(Bills bills);
 
 	R rejectBooking(Bills bills);
+
+	R applySwitch(Long id, BigDecimal boxPackingAmount);
+
+	R revokeSwitch(Long id);
+
+	R electronBillOfLading(Long id);
+
+	R confirmExchangeOrder(Long id);
+
+	R confirmEquipmentList(String ids);
+
+	R confirmPaymentCollection(Bills bills);
+
+	R confirmRefund(Bills bills);
+
+	R changeOrderFile(List<FilesCenter> filesCenterList);
+
+	R changeOrderList(String id, String type);
+
+	R revokeElectronBillOfLading(Long id);
+
+	IPage<Bills> selectChangeOrder(IPage<Object> page, Bills bills);
 }

+ 352 - 3
blade-service/blade-los/src/main/java/org/springblade/los/business/sea/service/impl/BillsServiceImpl.java

@@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.AllArgsConstructor;
 import org.springblade.client.entity.Message;
@@ -37,6 +38,8 @@ import org.springblade.los.Util.StringTools;
 import org.springblade.los.Util.ZrUtil;
 import org.springblade.los.basic.business.entity.BusinessType;
 import org.springblade.los.basic.business.service.IBusinessTypeService;
+import org.springblade.los.basic.commodity.entity.BCommodity;
+import org.springblade.los.basic.commodity.mapper.CommodityMapper;
 import org.springblade.los.basic.corps.entity.BCorps;
 import org.springblade.los.basic.corps.mapper.CorpsMapper;
 import org.springblade.los.basic.corps.service.IBCorpsService;
@@ -56,7 +59,6 @@ import org.springblade.los.business.sea.dto.WaitingBox;
 import org.springblade.los.business.sea.entity.*;
 import org.springblade.los.business.sea.mapper.BillsMapper;
 import org.springblade.los.business.sea.service.*;
-import org.springblade.los.business.sea.vo.BillsVO;
 import org.springblade.los.check.dto.LosAuditProecessDTO;
 import org.springblade.los.check.entity.LosAuditPathsActs;
 import org.springblade.los.check.entity.LosAuditPathsLevels;
@@ -133,6 +135,8 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 
 	private final CorpsMapper corpsMapper;
 
+	private final CommodityMapper commodityMapper;
+
 	private final IHmmEdiService hmmEdiService;
 
 	private final ZrUtil zrUtil;
@@ -154,7 +158,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 	private final AmendsMapper amendsMapper;
 
 	@Override
-	public IPage<BillsVO> selectBillsPage(IPage<BillsVO> page, BillsVO bills) {
+	public IPage<Bills> selectBillsPage(IPage<Bills> page, Bills bills) {
 		return page.setRecords(baseMapper.selectBillsPage(page, bills));
 	}
 
@@ -216,6 +220,22 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 				}
 			}
 		}
+		if (ObjectUtils.isNotNull(bills.getCorpId())) {
+			BCorps bCorps = corpsMapper.selectById(bills.getCorpId());
+			if ("D".equals(bCorps.getCreditLevel())) {
+				throw new RuntimeException("该客户为黑名单客户,保存失败");
+			}
+		}
+		if (ObjectUtils.isNotNull(bills.getHscode())) {
+			BCommodity commodity = commodityMapper.selectOne(new LambdaQueryWrapper<BCommodity>()
+				.eq(BCommodity::getTenantId, AuthUtil.getTenantId())
+				.eq(BCommodity::getIsDeleted, 0)
+				.eq(BCommodity::getHsCode, bills.getHscode())
+				.last("limit 1"));
+			if ("D".equals(commodity.getCreditLevel())) {
+				throw new RuntimeException("该商品为黑名单商品,保存失败");
+			}
+		}
 		if (bills.getId() == null) {
 			if (!"MH".equals(bills.getBillType())) {
 				if (ObjectUtils.isNotNull(bills.getMblno())) {
@@ -452,7 +472,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 					PreContainers preContainers = bills.getPreContainersList().stream().filter(e -> e.getCntrTypeCode().equals(item.getUnitNo()))
 						.findFirst().orElse(null);
 					if (preContainers != null && item.getQuantity().compareTo(new BigDecimal(preContainers.getQuantity() + "")) != 0 &&
-						ObjectUtils.isNotNull(item.getAuditStatus()) &&"0,1".contains(item.getAuditStatus())) {
+						ObjectUtils.isNotNull(item.getAuditStatus()) && "0,1".contains(item.getAuditStatus())) {
 						item.setQuantity(new BigDecimal(preContainers.getQuantity() + ""));
 						item.setAmount(item.getPrice().multiply(item.getQuantity()));
 						item.setAmountLoc(item.getAmount().multiply(item.getExrate()));
@@ -6145,6 +6165,335 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 		return R.data(bills);
 	}
 
+	@Override
+	public R applySwitch(Long id,BigDecimal boxPackingAmount) {
+		if (id == null) {
+			throw new RuntimeException("缺少必要参数");
+		}
+		Bills bills = baseMapper.selectById(id);
+		if (bills == null) {
+			throw new RuntimeException("未查到单据信息");
+		}
+		if ("申请".equals(bills.getChangeOrderStatus())) {
+			throw new RuntimeException("已提交申请,请勿重复申请");
+		}
+		if ("已换单".equals(bills.getChangeOrderStatus())) {
+			throw new RuntimeException("已换单,请勿重复申请");
+		}
+		List<FeeCenter> feeCenterList = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
+			.eq(FeeCenter::getPid, id)
+			.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
+			.eq(FeeCenter::getIsDeleted, 0)
+			.eq(FeeCenter::getDc, "D"));
+		if (!feeCenterList.isEmpty()) {
+			BigDecimal amount = feeCenterList.stream().map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
+			BigDecimal amountStl = feeCenterList.stream().map(FeeCenter::getStlTtlAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
+			if (amount.compareTo(amountStl) != 0) {
+				throw new RuntimeException("应收金额:" + amount + "实收金额:" + amountStl + "不等,申请失败");
+			}
+		}
+		LocalDateTime now = LocalDateTime.now();
+		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+		String formatted = now.format(formatter);
+		//发送消息
+		R<String> clientDeptIds = sysClient.getRoleIds(AuthUtil.getTenantId(), "前台");
+		if (clientDeptIds.isSuccess() && StringUtils.isNotBlank(clientDeptIds.getData())) {
+			R<List<User>> userList = userClient.listUserByRoleId(clientDeptIds.getData(), AuthUtil.getTenantId(), bills.getBranchId());
+			if (userList.isSuccess() && CollectionUtils.isNotEmpty(userList.getData())) {
+				for (User datum : userList.getData()) {
+					//循环发送消息
+					Message sendMessage = new Message();
+					sendMessage.setParameter(bills.getId() + "");
+					sendMessage.setUserName(AuthUtil.getUserName());
+					sendMessage.setUserId(null);
+					sendMessage.setToUserId(datum.getId());
+					sendMessage.setToUserName(datum.getName());
+					sendMessage.setMessageType(1);
+					sendMessage.setTenantId(AuthUtil.getTenantId());
+					sendMessage.setCreateUser(null);
+					sendMessage.setCreateTime(new Date());
+					sendMessage.setUrl("/iosBasicData/ImportExchange/index");
+					sendMessage.setPageLabel("进口换单");
+					sendMessage.setMessageBody("分单号:" + bills.getHblno() + "已申请换单,请及时处理!" + "时间:" + formatted);
+					R save = messageClient.save(sendMessage);
+					if (!save.isSuccess()) {
+						throw new SecurityException("发送消息失败");
+					}
+				}
+			}
+		}
+		bills.setChangeOrderStatus("申请");
+		bills.setBoxPackingAmount(boxPackingAmount);
+		bills.setUpdateTime(new Date());
+		bills.setUpdateUser(AuthUtil.getUserId());
+		bills.setUpdateUserName(AuthUtil.getUserName());
+		baseMapper.updateById(bills);
+		return R.data(bills);
+	}
+
+	@Override
+	public R revokeSwitch(Long id) {
+		if (id == null) {
+			throw new RuntimeException("缺少必要参数");
+		}
+		Bills bills = baseMapper.selectById(id);
+		if (bills == null) {
+			throw new RuntimeException("未查到单据信息");
+		}
+		if ("已换单".equals(bills.getChangeOrderStatus())) {
+			throw new RuntimeException("已确认换单,撤销失败");
+		}
+		if ("录入".equals(bills.getChangeOrderStatus())) {
+			throw new RuntimeException("未申请换单,撤销失败");
+		}
+		bills.setChangeOrderStatus("录入");
+		bills.setUpdateTime(new Date());
+		bills.setUpdateUser(AuthUtil.getUserId());
+		bills.setUpdateUserName(AuthUtil.getUserName());
+		baseMapper.updateById(bills);
+		return R.data(bills);
+	}
+
+	@Override
+	public R electronBillOfLading(Long id) {
+		if (id == null) {
+			throw new RuntimeException("缺少必要参数");
+		}
+		Bills bills = baseMapper.selectById(id);
+		if (bills == null) {
+			throw new RuntimeException("未查到单据信息");
+		}
+		if ("已发送".equals(bills.getDeliveryNoteStatus())) {
+			throw new RuntimeException("已发送提货单,请勿重复确认");
+		}
+		bills.setDeliveryNoteStatus("已发送");
+		bills.setUpdateTime(new Date());
+		bills.setUpdateUser(AuthUtil.getUserId());
+		bills.setUpdateUserName(AuthUtil.getUserName());
+		baseMapper.updateById(bills);
+		return R.data(bills);
+	}
+
+	@Override
+	public R confirmExchangeOrder(Long id) {
+		if (id == null) {
+			throw new RuntimeException("缺少必要参数");
+		}
+		Bills bills = baseMapper.selectById(id);
+		if (bills == null) {
+			throw new RuntimeException("未查到单据信息");
+		}
+		if ("已换单".equals(bills.getChangeOrderStatus())) {
+			throw new RuntimeException("已换单,请勿重复确认");
+		}
+		LocalDateTime now = LocalDateTime.now();
+		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+		String formatted = now.format(formatter);
+		//发送消息
+		if (ObjectUtils.isNotNull(bills.getOperatorId())) {
+			R<User> userR = userClient.userInfoById(bills.getOperatorId());
+			if (userR.isSuccess() && ObjectUtils.isNotNull(userR.getData())) {
+				User datum = userR.getData();
+				Message sendMessage = new Message();
+				sendMessage.setParameter(bills.getId() + "");
+				sendMessage.setUserName(AuthUtil.getUserName());
+				sendMessage.setUserId(null);
+				sendMessage.setToUserId(datum.getId());
+				sendMessage.setToUserName(datum.getName());
+				sendMessage.setMessageType(1);
+				sendMessage.setTenantId(AuthUtil.getTenantId());
+				sendMessage.setCreateUser(null);
+				sendMessage.setCreateTime(new Date());
+				sendMessage.setUrl("/iosBasicData/OceanFreightImport/bills/index");
+				sendMessage.setPageLabel("海运进口");
+				sendMessage.setMessageBody("您的海运进口已换单,请及时待处理!分单号:" + bills.getHblno() + "时间:" + formatted);
+				R save = messageClient.save(sendMessage);
+				if (!save.isSuccess()) {
+					throw new SecurityException("发送消息失败");
+				}
+			}
+		}
+		bills.setChangeOrderStatus("已换单");
+		bills.setUpdateTime(new Date());
+		bills.setUpdateUser(AuthUtil.getUserId());
+		bills.setUpdateUserName(AuthUtil.getUserName());
+		baseMapper.updateById(bills);
+		return R.data(bills);
+	}
+
+	@Override
+	public R confirmEquipmentList(String ids) {
+		if (ObjectUtils.isNull(ids)) {
+			throw new RuntimeException("缺少必要参数");
+		}
+		List<Bills> billsList = baseMapper.selectList(new LambdaQueryWrapper<Bills>()
+			.eq(Bills::getTenantId, AuthUtil.getTenantId())
+			.eq(Bills::getIsDeleted, 0)
+			.in(Bills::getId, Func.toLongList(ids)));
+		if (billsList.isEmpty()) {
+			throw new RuntimeException("未查到单据信息");
+		}
+		for (Bills item : billsList) {
+			if ("已提交".equals(item.getEquipmentSingleStatus())) {
+				throw new RuntimeException("已提交设备单,请勿重复提交");
+			}
+			item.setEquipmentSingleStatus("已提交");
+			item.setUpdateTime(new Date());
+			item.setUpdateUser(AuthUtil.getUserId());
+			item.setUpdateUserName(AuthUtil.getUserName());
+		}
+		this.updateBatchById(billsList);
+		return R.data("操作成功");
+	}
+
+	@Override
+	public R confirmPaymentCollection(Bills bills) {
+		if (bills.getId() == null) {
+			throw new RuntimeException("缺少必要参数");
+		}
+		Bills detail = baseMapper.selectById(bills.getId());
+		if (detail == null) {
+			throw new RuntimeException("未查到单据信息");
+		}
+		LocalDateTime now = LocalDateTime.now();
+		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+		String formatted = now.format(formatter);
+		//发送消息
+		if (ObjectUtils.isNotNull(bills.getOperatorId())) {
+			R<User> userR = userClient.userInfoById(bills.getOperatorId());
+			if (userR.isSuccess() && ObjectUtils.isNotNull(userR.getData())) {
+				User datum = userR.getData();
+				Message sendMessage = new Message();
+				sendMessage.setParameter(bills.getId() + "");
+				sendMessage.setUserName(AuthUtil.getUserName());
+				sendMessage.setUserId(null);
+				sendMessage.setToUserId(datum.getId());
+				sendMessage.setToUserName(datum.getName());
+				sendMessage.setMessageType(1);
+				sendMessage.setTenantId(AuthUtil.getTenantId());
+				sendMessage.setCreateUser(null);
+				sendMessage.setCreateTime(new Date());
+				sendMessage.setUrl("/iosBasicData/OceanFreightImport/bills/index");
+				sendMessage.setPageLabel("海运进口");
+				sendMessage.setMessageBody("您的海运进口换单押箱款已收款,请及时待处理!分单号:" + bills.getHblno() + "时间:" + formatted);
+				R save = messageClient.save(sendMessage);
+				if (!save.isSuccess()) {
+					throw new SecurityException("发送消息失败");
+				}
+			}
+		}
+		detail.setHarvestBoxPackingDate(bills.getHarvestBoxPackingDate());
+		detail.setUpdateTime(new Date());
+		detail.setUpdateUser(AuthUtil.getUserId());
+		detail.setUpdateUserName(AuthUtil.getUserName());
+		baseMapper.updateById(detail);
+		return R.data(detail);
+	}
+
+	@Override
+	public R confirmRefund(Bills bills) {
+		if (bills.getId() == null) {
+			throw new RuntimeException("缺少必要参数");
+		}
+		Bills detail = baseMapper.selectById(bills.getId());
+		if (detail == null) {
+			throw new RuntimeException("未查到单据信息");
+		}
+		LocalDateTime now = LocalDateTime.now();
+		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+		String formatted = now.format(formatter);
+		//发送消息
+		if (ObjectUtils.isNotNull(bills.getOperatorId())) {
+			R<User> userR = userClient.userInfoById(bills.getOperatorId());
+			if (userR.isSuccess() && ObjectUtils.isNotNull(userR.getData())) {
+				User datum = userR.getData();
+				Message sendMessage = new Message();
+				sendMessage.setParameter(bills.getId() + "");
+				sendMessage.setUserName(AuthUtil.getUserName());
+				sendMessage.setUserId(null);
+				sendMessage.setToUserId(datum.getId());
+				sendMessage.setToUserName(datum.getName());
+				sendMessage.setMessageType(1);
+				sendMessage.setTenantId(AuthUtil.getTenantId());
+				sendMessage.setCreateUser(null);
+				sendMessage.setCreateTime(new Date());
+				sendMessage.setUrl("/iosBasicData/OceanFreightImport/bills/index");
+				sendMessage.setPageLabel("海运进口");
+				sendMessage.setMessageBody("您的海运进口换单押箱款已退款,请及时待处理!分单号:" + bills.getHblno() + "时间:" + formatted);
+				R save = messageClient.save(sendMessage);
+				if (!save.isSuccess()) {
+					throw new SecurityException("发送消息失败");
+				}
+			}
+		}
+		detail.setRetreatBoxPackingDate(bills.getRetreatBoxPackingDate());
+		detail.setUpdateTime(new Date());
+		detail.setUpdateUser(AuthUtil.getUserId());
+		detail.setUpdateUserName(AuthUtil.getUserName());
+		baseMapper.updateById(detail);
+		return R.data(detail);
+	}
+
+	@Override
+	public R changeOrderFile(List<FilesCenter> filesCenterList) {
+		if (ObjectUtils.isNull(filesCenterList) || filesCenterList.isEmpty()) {
+			throw new RuntimeException("缺少必要参数");
+		}
+		for (FilesCenter item : filesCenterList) {
+			if (item.getId() == null) {
+				item.setCreateTime(new Date());
+				item.setCreateUser(AuthUtil.getUserId());
+				item.setCreateUserName(AuthUtil.getUserName());
+			} else {
+				item.setUpdateUser(AuthUtil.getUserId());
+				item.setUpdateTime(new Date());
+				item.setUpdateUserName(AuthUtil.getUserName());
+			}
+		}
+		filesCenterService.saveOrUpdateBatch(filesCenterList);
+		return R.data(filesCenterList);
+	}
+
+	@Override
+	public R changeOrderList(String id, String type) {
+		LambdaQueryWrapper<FilesCenter> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+		lambdaQueryWrapper.eq(FilesCenter::getIsDeleted, 0)
+			.eq(FilesCenter::getTenantId, AuthUtil.getTenantId())
+			.eq(FilesCenter::getPid, id);
+		if ("1".equals(type)) {
+			lambdaQueryWrapper.eq(FilesCenter::getClassifyCode, "换单");
+		} else {
+			lambdaQueryWrapper.eq(FilesCenter::getClassifyCode, "设备单");
+		}
+		List<FilesCenter> filesCenterList = filesCenterService.list(lambdaQueryWrapper);
+		return R.data(filesCenterList);
+	}
+
+	@Override
+	public R revokeElectronBillOfLading(Long id) {
+		if (id == null) {
+			throw new RuntimeException("缺少必要参数");
+		}
+		Bills bills = baseMapper.selectById(id);
+		if (bills == null) {
+			throw new RuntimeException("未查到单据信息");
+		}
+		if ("录入".equals(bills.getDeliveryNoteStatus())) {
+			throw new RuntimeException("提货单未发送,撤销失败");
+		}
+		bills.setDeliveryNoteStatus("录入");
+		bills.setUpdateTime(new Date());
+		bills.setUpdateUser(AuthUtil.getUserId());
+		bills.setUpdateUserName(AuthUtil.getUserName());
+		baseMapper.updateById(bills);
+		return R.data(bills);
+	}
+
+	@Override
+	public IPage<Bills> selectChangeOrder(IPage<Object> page, Bills bills) {
+		return null;
+	}
+
 	/**
 	 * 删除海运进出口明细表
 	 *

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

@@ -42,7 +42,10 @@ import org.springblade.los.excel.FeeCountByCorpExcel;
 import org.springblade.los.finance.fee.entity.FinAccBills;
 import org.springblade.los.finance.fee.entity.ListAccBillVO;
 import org.springblade.los.finance.fee.service.IFinAccBillsService;
+import org.springblade.los.finance.fee.vo.AccBillExcel;
 import org.springblade.los.finance.fee.vo.FinAccBillsVO;
+import org.springblade.los.statisticAnalysis.FeeSummaryDetailNotRC;
+import org.springblade.los.statisticAnalysis.FeeSummaryDetailNotRD;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletResponse;
@@ -546,6 +549,172 @@ public class FinAccBillsController extends BladeController {
 	/**
 	 * 财务账单(对账)
 	 */
+	@GetMapping("/listAccBillExport")
+	public void listAccBillExport(ListAccBillVO listAccBillVO, HttpServletResponse response) {
+		String type = listAccBillVO.getType();
+		if ("2".equals(listAccBillVO.getType())) {
+			//收
+			if ("D".equals(listAccBillVO.getDc())) {
+				listAccBillVO.setType("2");
+			} else if ("C".equals(listAccBillVO.getDc())) {
+				//付
+				listAccBillVO.setType("3");
+			} else {
+				listAccBillVO.setType(null);
+			}
+		} else if ("3".equals(listAccBillVO.getType())) {
+			listAccBillVO.setType("4");
+		}
+		if (ObjectUtils.isNotNull(listAccBillVO.getIsCleared()) && 0 == listAccBillVO.getIsCleared()) {
+			listAccBillVO.setIsCleared(null);
+		}
+		if (ObjectUtils.isNotNull(listAccBillVO.getIsSignfor()) && 0 == listAccBillVO.getIsSignfor()) {
+			listAccBillVO.setIsSignfor(null);
+		}
+		if (ObjectUtils.isNotNull(listAccBillVO.getInvoiceStatus()) && 0 == listAccBillVO.getInvoiceStatus()) {
+			listAccBillVO.setInvoiceStatus(null);
+		}
+		if (ObjectUtils.isNotNull(listAccBillVO.getAuditStatus()) && "0".equals(listAccBillVO.getAuditStatus())) {
+			listAccBillVO.setAuditStatus(null);
+		}
+		if (ObjectUtils.isNotNull(listAccBillVO.getHblno()) && listAccBillVO.getHblno().contains(",")) {
+			listAccBillVO.setVagueH("1");
+		}
+		if (ObjectUtils.isNotNull(listAccBillVO.getMblno()) && listAccBillVO.getMblno().contains(",")) {
+			listAccBillVO.setVagueM("1");
+		}
+		if (ObjectUtils.isNotNull(listAccBillVO.getCheckBillNo()) && listAccBillVO.getCheckBillNo().contains(",")) {
+			listAccBillVO.setVagueCh("1");
+		}
+		List<FinAccBillsVO> finAccBillsVOPage = new ArrayList<>();
+		List<FinAccBillsVO> list = finAccBillsService.listAccBillV2(listAccBillVO);
+		List<FinAccBillsVO> listAll = finAccBillsService.listAccBill(listAccBillVO);
+		for (FinAccBillsVO item : list) {
+			item.setBusinessType(BusinessTypeEnums.getName(item.getBusinessType()));
+			List<FinAccBillsVO> accBillsVOList = listAll.stream().filter(e -> e.getBranchId().equals(item.getBranchId()) &&
+				e.getCorpId().equals(item.getCorpId()) && e.getBusinessBillId().equals(item.getBusinessBillId()) &&
+				e.getAccountDc().equals(item.getAccountDc()) && e.getMblno().equals(item.getMblno()) &&
+				e.getHblno().equals(item.getHblno()) && e.getCurCode().equals(item.getCurCode())).collect(Collectors.toList());
+			if (!accBillsVOList.isEmpty()) {
+				List<FinAccBillsVO> finAccBillsVOList = new ArrayList<>();
+				for (FinAccBillsVO accBillsVO : accBillsVOList) {
+					accBillsVO.setQuantityCntrTypesDescr(accBillsVO.getQuantityCntrDescr());
+					BigDecimal amount = accBillsVO.getAppliedAmount().subtract(accBillsVO.getAppliedAmountStl());
+					accBillsVO.setAppliedCurrentStlAmount(accBillsVO.getAmount().subtract(amount).subtract(accBillsVO.getStlTtlAmount()));
+					accBillsVO.setAppliedCurrentStlAmountOriginal(accBillsVO.getAmount().subtract(amount).subtract(accBillsVO.getStlTtlAmount()));
+
+					accBillsVO.setAppliedInvoiceCurrentStlAmount(accBillsVO.getAmount().subtract(accBillsVO.getStlTtlAmount()));
+					accBillsVO.setAppliedInvoiceCurrentStlAmountOriginal(accBillsVO.getAmount().subtract(accBillsVO.getStlTtlAmount()));
+
+					accBillsVO.setReconciliationCurrentAmount(accBillsVO.getAmount().subtract(accBillsVO.getReconciliationAmount()));
+					accBillsVO.setReconciliationCurrentAmountOriginal(accBillsVO.getAmount().subtract(accBillsVO.getReconciliationAmount()));
+
+					BigDecimal invoice = accBillsVO.getAppliedInvoiceAmount().subtract(accBillsVO.getAppliedInvoiceAmountStl());
+					accBillsVO.setAppliedInvoiceCurrentAmount(accBillsVO.getAmount().subtract(invoice).subtract(accBillsVO.getUninvoicedAmount()));
+					accBillsVO.setAppliedInvoiceCurrentAmountOriginal(accBillsVO.getAmount().subtract(invoice).subtract(accBillsVO.getUninvoicedAmount()));
+					if ("2".equals(type)) {
+						//收
+						if ("D".equals(listAccBillVO.getDc())) {
+							if (new BigDecimal("0.00").compareTo(accBillsVO.getAppliedInvoiceCurrentStlAmount()) != 0) {
+								finAccBillsVOList.add(accBillsVO);
+							}
+						} else if ("C".equals(listAccBillVO.getDc())) {
+							if (new BigDecimal("0.00").compareTo(accBillsVO.getAppliedCurrentStlAmount()) != 0) {
+								finAccBillsVOList.add(accBillsVO);
+							}
+						} else {
+							if (new BigDecimal("0.00").compareTo(accBillsVO.getAppliedInvoiceCurrentStlAmount()) != 0) {
+								finAccBillsVOList.add(accBillsVO);
+								continue;
+							}
+							if (new BigDecimal("0.00").compareTo(accBillsVO.getAppliedCurrentStlAmount()) != 0) {
+								finAccBillsVOList.add(accBillsVO);
+								continue;
+							}
+						}
+					} else if ("3".equals(type)) {
+						if (new BigDecimal("0.00").compareTo(accBillsVO.getAppliedInvoiceCurrentAmount()) != 0) {
+							finAccBillsVOList.add(accBillsVO);
+						}
+					} else if ("1".equals(type)) {
+						if (new BigDecimal("0.00").compareTo(accBillsVO.getReconciliationCurrentAmount()) != 0) {
+							finAccBillsVOList.add(accBillsVO);
+						}
+					} else if ("5".equals(type)) {
+						finAccBillsVOList.add(accBillsVO);
+					}
+				}
+				if (!finAccBillsVOList.isEmpty()) {
+					item.setFinAccBillsVOList(finAccBillsVOList);
+					item.setAppliedCurrentStlAmount(finAccBillsVOList.stream().map(FinAccBillsVO::getAppliedCurrentStlAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
+					item.setAppliedInvoiceCurrentStlAmount(finAccBillsVOList.stream().map(FinAccBillsVO::getAppliedInvoiceCurrentStlAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
+					item.setReconciliationCurrentAmount(finAccBillsVOList.stream().map(FinAccBillsVO::getReconciliationCurrentAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
+					item.setAppliedInvoiceCurrentAmount(finAccBillsVOList.stream().map(FinAccBillsVO::getAppliedInvoiceCurrentAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
+				}
+				if ("2".equals(type)) {
+					//收
+					if ("D".equals(listAccBillVO.getDc())) {
+						if (ObjectUtils.isNotNull(item.getAppliedInvoiceCurrentStlAmount()) && new BigDecimal("0.00").compareTo(item.getAppliedInvoiceCurrentStlAmount()) != 0) {
+							finAccBillsVOPage.add(item);
+						}
+					} else if ("C".equals(listAccBillVO.getDc())) {
+						if (ObjectUtils.isNotNull(item.getAppliedCurrentStlAmount()) && new BigDecimal("0.00").compareTo(item.getAppliedCurrentStlAmount()) != 0) {
+							finAccBillsVOPage.add(item);
+						}
+					} else {
+						if (ObjectUtils.isNotNull(item.getAppliedInvoiceCurrentStlAmount()) && new BigDecimal("0.00").compareTo(item.getAppliedInvoiceCurrentStlAmount()) != 0) {
+							finAccBillsVOPage.add(item);
+							continue;
+						}
+						if (ObjectUtils.isNotNull(item.getAppliedCurrentStlAmount()) && new BigDecimal("0.00").compareTo(item.getAppliedCurrentStlAmount()) != 0) {
+							finAccBillsVOPage.add(item);
+							continue;
+						}
+					}
+				} else if ("3".equals(type)) {
+					if (ObjectUtils.isNotNull(item.getAppliedInvoiceCurrentAmount()) && new BigDecimal("0.00").compareTo(item.getAppliedInvoiceCurrentAmount()) != 0) {
+						finAccBillsVOPage.add(item);
+					}
+				} else if ("1".equals(type)) {
+					if (ObjectUtils.isNotNull(item.getReconciliationCurrentAmount()) && new BigDecimal("0.00").compareTo(item.getReconciliationCurrentAmount()) != 0) {
+						finAccBillsVOPage.add(item);
+					}
+				} else if ("5".equals(type)) {
+					finAccBillsVOPage.add(item);
+				}
+			}
+		}
+		List<AccBillExcel> accBillExcelList = new ArrayList<>();
+		for (FinAccBillsVO item : finAccBillsVOPage){
+			AccBillExcel accBillExcel = new AccBillExcel();
+			BeanUtil.copyProperties(item,accBillExcel);
+			if ("2".equals(type)) {
+				//收
+				if ("D".equals(listAccBillVO.getDc())) {
+					accBillExcel.setAmount(item.getAppliedInvoiceCurrentStlAmount());
+				} else if ("C".equals(listAccBillVO.getDc())) {
+					accBillExcel.setAmount(item.getAppliedCurrentStlAmount());
+				} else {
+					if (ObjectUtils.isNotNull(item.getAppliedInvoiceCurrentStlAmount()) && new BigDecimal("0.00").compareTo(item.getAppliedInvoiceCurrentStlAmount()) != 0) {
+						accBillExcel.setAmount(item.getAppliedInvoiceCurrentStlAmount());
+					}
+					if (ObjectUtils.isNotNull(item.getAppliedCurrentStlAmount()) && new BigDecimal("0.00").compareTo(item.getAppliedCurrentStlAmount()) != 0) {
+						accBillExcel.setAmount(item.getAppliedCurrentStlAmount());
+					}
+				}
+			} else if ("3".equals(type)) {
+				accBillExcel.setAmount(item.getAppliedInvoiceCurrentAmount());
+			} else if ("1".equals(type)) {
+				accBillExcel.setAmount(item.getReconciliationCurrentAmount());
+			}
+			accBillExcelList.add(accBillExcel);
+		}
+		ExcelUtil.export(response, "账单明细", "账单明细",accBillExcelList, AccBillExcel.class);
+	}
+
+	/**
+	 * 财务账单(对账)
+	 */
 	@GetMapping("/listAccBillByCorp")
 	@ApiOperationSupport(order = 2)
 	@ApiOperation(value = "类别", notes = "传入finAccBills")

+ 12 - 12
blade-service/blade-los/src/main/java/org/springblade/los/finance/fee/mapper/FinAccBillsMapper.xml

@@ -246,16 +246,16 @@
             </if>
         </if>
         <if test='fee.type != null and fee.type != "" and fee.type == "1"'>
-            GROUP BY acc.corp_id, acc.branch_id
+            GROUP BY acc.corp_id, acc.branch_id,acc.mblno,acc.hblno
         </if>
         <if test='fee.type != null and fee.type != "" and fee.type == "2"'>
-            GROUP BY acc.bill_corp_id, acc.branch_id
+            GROUP BY acc.bill_corp_id, acc.branch_id,acc.mblno,acc.hblno
         </if>
         <if test='fee.type != null and fee.type != "" and fee.type == "3"'>
-            GROUP BY acc.src_id, acc.branch_id
+            GROUP BY acc.src_id, acc.branch_id,acc.mblno,acc.hblno
         </if>
         <if test='fee.type == null or fee.type == ""'>
-            GROUP BY acc.corp_id, acc.branch_id
+            GROUP BY acc.corp_id, acc.branch_id,acc.mblno,acc.hblno
         </if>
     </select>
     <select id="feeSummaryExportList" resultType="org.springblade.los.statisticAnalysis.FeeSummaryRD">
@@ -330,16 +330,16 @@
             </if>
         </if>
         <if test='fee.type != null and fee.type != "" and fee.type == "1"'>
-            GROUP BY acc.corp_id, acc.branch_id
+            GROUP BY acc.corp_id, acc.branch_id,acc.mblno,acc.hblno
         </if>
         <if test='fee.type != null and fee.type != "" and fee.type == "2"'>
-            GROUP BY acc.bill_corp_id, acc.branch_id
+            GROUP BY acc.bill_corp_id, acc.branch_id,acc.mblno,acc.hblno
         </if>
         <if test='fee.type != null and fee.type != "" and fee.type == "3"'>
-            GROUP BY acc.src_id, acc.branch_id
+            GROUP BY acc.src_id, acc.branch_id,acc.mblno,acc.hblno
         </if>
         <if test='fee.type == null or fee.type == ""'>
-            GROUP BY acc.corp_id, acc.branch_id
+            GROUP BY acc.corp_id, acc.branch_id,acc.mblno,acc.hblno
         </if>
     </select>
     <select id="feeSummaryDetailList" resultType="org.springblade.los.statisticAnalysis.FeeSummaryDetailRD">
@@ -444,10 +444,10 @@
             </if>
         </if>
         <if test='fee.type != null and fee.type != "" and fee.type == "1"'>
-            GROUP BY acc.corp_id, acc.branch_id
+            GROUP BY acc.corp_id, acc.branch_id,acc.mblno,acc.hblno
         </if>
         <if test='fee.type != null and fee.type != "" and fee.type == "2"'>
-            GROUP BY acc.bill_corp_id, acc.branch_id
+            GROUP BY acc.bill_corp_id, acc.branch_id,acc.mblno,acc.hblno
         </if>
         <if test='fee.type != null and fee.type != "" and fee.type == "3"'>
             GROUP BY acc.mblno,acc.hblno, acc.branch_id
@@ -559,10 +559,10 @@
             </if>
         </if>
         <if test='fee.type != null and fee.type != "" and fee.type == "1"'>
-            GROUP BY acc.corp_id, acc.branch_id
+            GROUP BY acc.corp_id, acc.branch_id,acc.mblno,acc.hblno
         </if>
         <if test='fee.type != null and fee.type != "" and fee.type == "2"'>
-            GROUP BY acc.bill_corp_id, acc.branch_id
+            GROUP BY acc.bill_corp_id, acc.branch_id,acc.mblno,acc.hblno
         </if>
         <if test='fee.type != null and fee.type != "" and fee.type == "3"'>
             GROUP BY acc.mblno,acc.hblno, acc.branch_id

+ 5 - 0
blade-service/blade-los/src/main/java/org/springblade/los/finance/operatingExpenses/controller/OperatingExpensesController.java

@@ -93,6 +93,11 @@ public class OperatingExpensesController extends BladeController {
 			lambdaQueryWrapper.ge(OperatingExpenses::getSettlementDate, operatingExpenses.getSettlementDateList().get(0));
 			lambdaQueryWrapper.le(OperatingExpenses::getSettlementDate, operatingExpenses.getSettlementDateList().get(1));
 		}
+		if (!AuthUtil.getUserRole().contains("总部") && !AuthUtil.getUserRole().contains("admin")  ) {
+			lambdaQueryWrapper.eq(OperatingExpenses::getBranchId, AuthUtil.getDeptId());
+		} else {
+			lambdaQueryWrapper.eq(ObjectUtils.isNotNull(operatingExpenses.getBranchId()), OperatingExpenses::getBranchId, operatingExpenses.getBranchId());
+		}
 		IPage<OperatingExpenses> pages = operatingExpensesService.page(Condition.getPage(query), lambdaQueryWrapper);
 		return R.data(pages);
 	}