|
|
@@ -33,13 +33,9 @@ import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.BeanUtil;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
import org.springblade.core.tool.utils.StringUtil;
|
|
|
-import org.springblade.los.Util.BoxNumUtils;
|
|
|
-import org.springblade.los.Util.CurrencyUtils;
|
|
|
-import org.springblade.los.Util.StringTools;
|
|
|
-import org.springblade.los.Util.ZrUtil;
|
|
|
+import org.springblade.los.Util.*;
|
|
|
import org.springblade.los.basic.business.entity.BusinessType;
|
|
|
import org.springblade.los.basic.business.service.IBusinessTypeService;
|
|
|
-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;
|
|
|
@@ -67,6 +63,7 @@ import org.springblade.los.check.entity.LosAuditPathsLevels;
|
|
|
import org.springblade.los.check.service.IAuditPathsActsService;
|
|
|
import org.springblade.los.check.service.IAuditPathsLevelsService;
|
|
|
import org.springblade.los.check.service.IAuditProecessService;
|
|
|
+import org.springblade.los.excel.DeliveryPaperExcel;
|
|
|
import org.springblade.los.finance.fee.entity.FeeCenter;
|
|
|
import org.springblade.los.finance.fee.entity.FinAccBills;
|
|
|
import org.springblade.los.finance.fee.service.IFeeCenterService;
|
|
|
@@ -139,8 +136,6 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
|
|
|
private final CorpsMapper corpsMapper;
|
|
|
|
|
|
- private final CommodityMapper commodityMapper;
|
|
|
-
|
|
|
private final IHmmEdiService hmmEdiService;
|
|
|
|
|
|
private final ZrUtil zrUtil;
|
|
|
@@ -163,6 +158,8 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
|
|
|
private final IReceiptService receiptService;
|
|
|
|
|
|
+ private final IBillUtils billUtils;
|
|
|
+
|
|
|
@Override
|
|
|
public IPage<Bills> selectBillsPage(IPage<Bills> page, Bills bills) {
|
|
|
return page.setRecords(baseMapper.selectBillsPage(page, bills));
|
|
|
@@ -1490,7 +1487,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
measurement = measurement.add(billsList.stream().map(Bills::getMeasurement).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
marks = billsList.stream().map(Bills::getMarks).filter(Objects::nonNull).collect(Collectors.joining("&|&"));
|
|
|
commodityDescr = billsList.stream().map(Bills::getCommodityDescr).filter(Objects::nonNull).collect(Collectors.joining("&|&"));
|
|
|
- this.itemCopy(bills, billsList, false);
|
|
|
+ billUtils.itemCopy(bills, billsList, false);
|
|
|
}
|
|
|
bills.setTeuTotal(teuTotal);
|
|
|
bills.setGrossWeight(grossWeight);
|
|
|
@@ -1509,225 +1506,6 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
return R.data("操作成功");
|
|
|
}
|
|
|
|
|
|
- private void itemCopy(Bills bills, List<Bills> billsList, boolean status) {
|
|
|
- List<Containers> containersList = containersService.list(new LambdaQueryWrapper<Containers>()
|
|
|
- .eq(Containers::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(Containers::getIsDeleted, 0)
|
|
|
- .in(Containers::getPid, billsList.stream().map(Bills::getId).collect(Collectors.toList())));
|
|
|
- if (!containersList.isEmpty()) {
|
|
|
- StringBuilder hblno = new StringBuilder();
|
|
|
- for (Bills item : billsList) {
|
|
|
- List<Containers> containers = containersList.stream().filter(e -> e.getPid().equals(item.getId()))
|
|
|
- .collect(Collectors.toList());
|
|
|
- if (containers.isEmpty()) {
|
|
|
- hblno.append(item.getHblno()).append(",");
|
|
|
- } else {
|
|
|
- BigDecimal quantity = containers.stream().map(Containers::getQuantity).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- BigDecimal grossWeight = containers.stream().map(Containers::getGrossWeight).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- BigDecimal measurement = containers.stream().map(Containers::getMeasurement).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- if (quantity.compareTo(new BigDecimal("0.00")) == 0 && grossWeight.compareTo(new BigDecimal("0.00")) == 0 &&
|
|
|
- measurement.compareTo(new BigDecimal("0.00")) == 0) {
|
|
|
- hblno.append(item.getHblno()).append(",");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- /*if (status && ObjectUtils.isNotNull(hblno.toString())) {
|
|
|
- throw new RuntimeException("分单号:" + hblno + "未分配件重尺,同步失败");
|
|
|
- }*/
|
|
|
- for (Containers item : containersList) {
|
|
|
- item.setMblno(bills.getMblno());
|
|
|
- }
|
|
|
- containersService.updateBatchById(containersList);
|
|
|
- List<Containers> containersListNew = new ArrayList<>();
|
|
|
- for (Containers item : containersList) {
|
|
|
- item.setSrcSplitOrderId(item.getPid());
|
|
|
- item.setSrcId(item.getId());
|
|
|
- item.setId(null);
|
|
|
- item.setPid(bills.getId());
|
|
|
- item.setCreateTime(new Date());
|
|
|
- item.setCreateUser(AuthUtil.getUserId());
|
|
|
- item.setCreateUserName(AuthUtil.getUserName());
|
|
|
- item.setBranchId(bills.getBranchId());
|
|
|
- item.setUpdateUser(null);
|
|
|
- item.setUpdateTime(null);
|
|
|
- item.setUpdateUserName(null);
|
|
|
- containersListNew.add(item);
|
|
|
- }
|
|
|
- containersService.saveBatch(containersListNew);
|
|
|
- List<ContainersCommodity> containersCommodityList = containersCommodityService.list(new LambdaQueryWrapper<ContainersCommodity>()
|
|
|
- .eq(ContainersCommodity::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(ContainersCommodity::getIsDeleted, 0)
|
|
|
- .in(ContainersCommodity::getPpId, billsList.stream().map(Bills::getId).collect(Collectors.toList())));
|
|
|
- if (!containersCommodityList.isEmpty()) {
|
|
|
- List<ContainersCommodity> containersCommodityListNew = new ArrayList<>();
|
|
|
- for (ContainersCommodity item : containersCommodityList) {
|
|
|
- Containers containers = containersListNew.stream().filter(e -> e.getSrcId().equals(item.getPid())).findFirst().orElse(null);
|
|
|
- if (containers != null) {
|
|
|
- item.setSrcSplitOrderId(item.getPid());
|
|
|
- item.setId(null);
|
|
|
- item.setCreateTime(new Date());
|
|
|
- item.setCreateUser(AuthUtil.getUserId());
|
|
|
- item.setCreateUserName(AuthUtil.getUserName());
|
|
|
- item.setBranchId(bills.getBranchId());
|
|
|
- item.setUpdateUser(null);
|
|
|
- item.setUpdateTime(null);
|
|
|
- item.setUpdateUserName(null);
|
|
|
- item.setPid(containers.getId());
|
|
|
- item.setPpId(bills.getId());
|
|
|
- }
|
|
|
- containersCommodityListNew.add(item);
|
|
|
- }
|
|
|
- containersCommodityService.saveBatch(containersCommodityListNew);
|
|
|
- }
|
|
|
-/*
|
|
|
- List<ContainersBills> containersBillsList = containersBillsService.list(new LambdaQueryWrapper<ContainersBills>()
|
|
|
- .eq(ContainersBills::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(ContainersBills::getIsDeleted, 0)
|
|
|
- .in(ContainersBills::getPpId, billsList.stream().map(Bills::getId).collect(Collectors.toList())));
|
|
|
- if (!containersBillsList.isEmpty()) {
|
|
|
- List<ContainersBills> containersBillsListNew = new ArrayList<>();
|
|
|
- for (ContainersBills item : containersBillsList) {
|
|
|
- Containers containers = containersListNew.stream().filter(e -> e.getSrcId().equals(item.getPid())).findFirst().orElse(null);
|
|
|
- if (containers != null) {
|
|
|
- item.setSrcSplitOrderId(item.getPid());
|
|
|
- item.setId(null);
|
|
|
- item.setCreateTime(new Date());
|
|
|
- item.setCreateUser(AuthUtil.getUserId());
|
|
|
- item.setCreateUserName(AuthUtil.getUserName());
|
|
|
- item.setBranchId(bills.getBranchId());
|
|
|
- item.setUpdateUser(null);
|
|
|
- item.setUpdateTime(null);
|
|
|
- item.setUpdateUserName(null);
|
|
|
- item.setPid(containers.getId());
|
|
|
- item.setPpId(bills.getId());
|
|
|
- }
|
|
|
- containersBillsListNew.add(item);
|
|
|
- }
|
|
|
- containersBillsService.saveBatch(containersBillsListNew);
|
|
|
- }
|
|
|
-*/
|
|
|
- } /*else {
|
|
|
- if (status) {
|
|
|
- throw new RuntimeException("分单号:" + billsList.stream().map(Bills::getHblno).collect(Collectors.joining(","))
|
|
|
- + "未分配件重尺,同步失败");
|
|
|
- }
|
|
|
- }*/
|
|
|
- List<FeeCenter> feeCenterList = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
|
|
|
- .eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(FeeCenter::getIsDeleted, 0)
|
|
|
- .in(FeeCenter::getPid, billsList.stream().map(Bills::getId).collect(Collectors.toList())));
|
|
|
- if (!feeCenterList.isEmpty()) {
|
|
|
- List<FinAccBills> finAccBillsList = finAccBillsService.list(new LambdaQueryWrapper<FinAccBills>()
|
|
|
- .eq(FinAccBills::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(FinAccBills::getIsDeleted, 0)
|
|
|
- .in(FinAccBills::getBusinessBillId, billsList.stream().map(Bills::getId).collect(Collectors.toList())));
|
|
|
- List<FeeCenter> FeeCenterListNew = new ArrayList<>();
|
|
|
- List<FinAccBills> finAccBillsListNew = new ArrayList<>();
|
|
|
- for (FeeCenter item : feeCenterList) {
|
|
|
- Bills bill = billsList.stream().filter(e -> e.getId().equals(item.getPid())).findFirst().orElse(null);
|
|
|
- if (bill != null) {
|
|
|
- item.setBillNo(bill.getBillNo());
|
|
|
- item.setBusinessType(bill.getBusinessType());
|
|
|
- item.setBillType(bill.getBillType());
|
|
|
- item.setBillDate(bill.getBillDate());
|
|
|
- item.setSrcType(bill.getSrcType());
|
|
|
- item.setSrcId(bill.getSrcId());
|
|
|
- item.setBookingAgentId(bill.getBookingAgentId());
|
|
|
- item.setBookingAgentCnName(bill.getBookingAgentCnName());
|
|
|
- item.setBookingAgentEnName(bill.getBookingAgentEnName());
|
|
|
- item.setSrcCnName(bill.getSrcCnName());
|
|
|
- item.setSrcEnName(bill.getSrcEnName());
|
|
|
- item.setBillCorpId(bill.getCorpId());
|
|
|
- item.setBillCorpCnName(bill.getCorpCnName());
|
|
|
- item.setBillCorpEnName(bill.getCorpEnName());
|
|
|
- item.setBillShortName(bill.getShortName());
|
|
|
- item.setLineId(bill.getLineId());
|
|
|
- item.setLineCnName(bill.getLineCnName());
|
|
|
- item.setLineEnName(bill.getLineEnName());
|
|
|
- item.setVesselId(bill.getVesselId());
|
|
|
- item.setVesselEnName(bill.getVesselEnName());
|
|
|
- item.setVesselCnName(bill.getVesselCnName());
|
|
|
- item.setVoyageNo(bill.getVoyageNo());
|
|
|
- item.setMblno(bill.getMblno());
|
|
|
- item.setHblno(bill.getHblno());
|
|
|
- item.setEtd(bill.getEtd());
|
|
|
- item.setEta(bill.getEta());
|
|
|
- item.setPolId(bill.getPolId());
|
|
|
- item.setPolCode(bill.getPolCode());
|
|
|
- item.setPolCnName(bill.getPolCnName());
|
|
|
- item.setPolEnName(bill.getPolEnName());
|
|
|
- item.setPodId(bill.getPodId());
|
|
|
- item.setPodCode(bill.getPodCode());
|
|
|
- item.setPodCnName(bill.getPodCnName());
|
|
|
- item.setPodEnName(bill.getPodEnName());
|
|
|
- item.setPaymode(bill.getMpaymode());
|
|
|
- item.setPayplace(bill.getMpayplace());
|
|
|
- item.setRefno(bill.getRefno());
|
|
|
- item.setBookingNo(bill.getBookingNo());
|
|
|
- item.setCntrNo(bill.getQuantityCntrTypesDescr());
|
|
|
- item.setQuantityCntrDescr(bill.getQuantityCntrDescr());
|
|
|
- item.setTeu(bill.getTeu());
|
|
|
- }
|
|
|
- FeeCenterListNew.add(item);
|
|
|
- if (!finAccBillsList.isEmpty()) {
|
|
|
- List<FinAccBills> finAccBills = finAccBillsList.stream().filter(e -> e.getId().equals(item.getAccBillId())).collect(Collectors.toList());
|
|
|
- for (FinAccBills data : finAccBills) {
|
|
|
- data.setBillDate(item.getBillDate());
|
|
|
- data.setBusinessDate(item.getBillDate());
|
|
|
- data.setBookingAgentId(item.getBookingAgentId());
|
|
|
- data.setBookingAgentCnName(item.getBookingAgentCnName());
|
|
|
- data.setBookingAgentEnName(item.getBookingAgentEnName());
|
|
|
- data.setQuantityCntrDescr(item.getQuantityCntrDescr());
|
|
|
- data.setTeu(item.getTeu());
|
|
|
- data.setWarehousingDate(item.getStorageDate());
|
|
|
- data.setOutboundDate(item.getOutboundDate());
|
|
|
- data.setSrcId(item.getSrcId());
|
|
|
- data.setSrcCnName(item.getSrcCnName());
|
|
|
- data.setSrcEnName(item.getSrcEnName());
|
|
|
- data.setSrcType(item.getSrcType());
|
|
|
- data.setPaymode(item.getPaymode());
|
|
|
- data.setCorpId(item.getCorpId());
|
|
|
- data.setCorpCnName(item.getCorpCnName());
|
|
|
- data.setCorpEnName(item.getCorpEnName());
|
|
|
- data.setBillCorpId(item.getBillCorpId());
|
|
|
- data.setBillCorpCnName(item.getBillCorpCnName());
|
|
|
- data.setBillCorpEnName(item.getBillCorpEnName());
|
|
|
- data.setVesselId(item.getVesselId());
|
|
|
- data.setVesselCnName(item.getVesselCnName());
|
|
|
- data.setVesselEnName(item.getVesselEnName());
|
|
|
- data.setVoyageNo(item.getVoyageNo());
|
|
|
- data.setMblno(item.getMblno());
|
|
|
- data.setHblno(item.getHblno());
|
|
|
- data.setRefno(item.getRefno());
|
|
|
- data.setBookingNo(item.getBookingNo());
|
|
|
- data.setEtd(item.getEtd());
|
|
|
- data.setEta(item.getEta());
|
|
|
- data.setPolId(item.getPolId());
|
|
|
- data.setPolCnName(item.getPolCnName());
|
|
|
- data.setPolEnName(item.getPolEnName());
|
|
|
- data.setPodId(item.getPodId());
|
|
|
- data.setPodCnName(item.getPodCnName());
|
|
|
- data.setPodCode(item.getPodCode());
|
|
|
- data.setPodEnName(item.getPodEnName());
|
|
|
- finAccBillsListNew.add(data);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- feeCenterService.updateBatchById(FeeCenterListNew);
|
|
|
- if (!finAccBillsListNew.isEmpty()) {
|
|
|
- finAccBillsService.updateBatchById(finAccBillsListNew);
|
|
|
- }
|
|
|
- }
|
|
|
- for (Bills item : billsList) {
|
|
|
- item.setEta(bills.getEta());
|
|
|
- item.setActualEta(bills.getActualEta());
|
|
|
-
|
|
|
- }
|
|
|
- if (!billsList.isEmpty()) {
|
|
|
- this.updateBatchById(billsList);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public R revokeReinsurancePolicy(String ids, String id) {
|
|
|
@@ -1777,7 +1555,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
grossWeight = grossWeight.subtract(billsList.stream().map(Bills::getGrossWeight).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
quantity = quantity.subtract(billsList.stream().map(Bills::getQuantity).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
measurement = measurement.subtract(billsList.stream().map(Bills::getMeasurement).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
- this.itemRevoke(bills, billsList);
|
|
|
+ billUtils.itemRevoke(bills, billsList);
|
|
|
}
|
|
|
List<Bills> billsList1 = baseMapper.selectList(new LambdaQueryWrapper<Bills>()
|
|
|
.eq(Bills::getTenantId, AuthUtil.getTenantId())
|
|
|
@@ -1826,35 +1604,6 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
return R.data("操作成功");
|
|
|
}
|
|
|
|
|
|
- private void itemRevoke(Bills bills, List<Bills> billsList) {
|
|
|
- List<Containers> containersList = containersService.list(new LambdaQueryWrapper<Containers>()
|
|
|
- .eq(Containers::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(Containers::getIsDeleted, 0)
|
|
|
- .eq(Containers::getPid, bills.getId())
|
|
|
- .in(Containers::getSrcSplitOrderId, billsList.stream().map(Bills::getId).collect(Collectors.toList()))
|
|
|
- );
|
|
|
- if (!containersList.isEmpty()) {
|
|
|
- containersService.removeByIds(containersList.stream().map(Containers::getId).collect(Collectors.toList()));
|
|
|
- List<ContainersCommodity> containersCommodityList = containersCommodityService.list(new LambdaQueryWrapper<ContainersCommodity>()
|
|
|
- .eq(ContainersCommodity::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(ContainersCommodity::getPpId, bills.getId())
|
|
|
- .in(ContainersCommodity::getSrcSplitOrderId, billsList.stream().map(Bills::getId).collect(Collectors.toList()))
|
|
|
- );
|
|
|
- if (!containersCommodityList.isEmpty()) {
|
|
|
- containersCommodityService.removeByIds(containersCommodityList.stream().map(ContainersCommodity::getId).collect(Collectors.toList()));
|
|
|
- }
|
|
|
- List<ContainersBills> containersBillsList = containersBillsService.list(new LambdaQueryWrapper<ContainersBills>()
|
|
|
- .eq(ContainersBills::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(ContainersBills::getIsDeleted, 0)
|
|
|
- .eq(ContainersBills::getPpId, bills.getId())
|
|
|
- .in(ContainersBills::getSrcSplitOrderId, billsList.stream().map(Bills::getId).collect(Collectors.toList()))
|
|
|
- );
|
|
|
- if (!containersBillsList.isEmpty()) {
|
|
|
- containersBillsService.removeByIds(containersBillsList.stream().map(ContainersBills::getId).collect(Collectors.toList()));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void removeIds(List<Long> ids) {
|
|
|
@@ -1984,12 +1733,6 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
return R.data("操作成功");
|
|
|
}
|
|
|
|
|
|
- private void revokeSelectedContainerNumber(Bills bills, List<PreContainers> preContainers) {
|
|
|
- for (PreContainers item : preContainers) {
|
|
|
- seaContainerNumberItemService.revokeSelectedContainerNumber(item.getCntrTypeCode(), bills.getId() + "");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Bills checkBills(Bills bills) {
|
|
|
@@ -3822,7 +3565,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
if (billsJk == null) {
|
|
|
throw new RuntimeException("未找到进口单据");
|
|
|
}
|
|
|
- this.removeItemList(billsJk.getId());
|
|
|
+ billUtils.removeItemList(billsJk.getId());
|
|
|
baseMapper.deleteById(billsJk.getId());
|
|
|
//主单应加上分单费用
|
|
|
if ("MM".equals(detail.getBillType())) {
|
|
|
@@ -3847,7 +3590,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
.eq(Bills::getMasterId, billsJk.getId()));
|
|
|
if (!details.isEmpty()) {
|
|
|
for (Bills item : details) {
|
|
|
- this.removeItemList(item.getId());
|
|
|
+ billUtils.removeItemList(item.getId());
|
|
|
}
|
|
|
this.removeByIds(details.stream().map(Bills::getId).collect(Collectors.toList()));
|
|
|
}
|
|
|
@@ -4920,7 +4663,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
List<BCurExrate> curExrateList = currencyUtils.obtainRate(date, "1", branchId);
|
|
|
int count = 1;
|
|
|
for (PreContainers item : preContainersList) {
|
|
|
- FeeCenter feeCenter = this.addFeeCenterQuotation(copyBills, "D", count, fees, item,
|
|
|
+ FeeCenter feeCenter = billUtils.addFeeCenterQuotation(copyBills, "D", count, fees, item,
|
|
|
curExrateList, exrateType, "1");
|
|
|
if (feeCenter != null) {
|
|
|
feeCenter.setUnitNo(item.getCntrTypeCode());
|
|
|
@@ -4930,7 +4673,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
feeCenterListSum.add(feeCenter);
|
|
|
}
|
|
|
if (!"SOC".equals(copyBills.getBoxBelongsTo())) {
|
|
|
- FeeCenter feeCenterD = this.addFeeCenterQuotation(copyBills, "C", count, fees, item,
|
|
|
+ FeeCenter feeCenterD = billUtils.addFeeCenterQuotation(copyBills, "C", count, fees, item,
|
|
|
curExrateList, exrateType, "2");
|
|
|
if (feeCenterD != null) {
|
|
|
feeCenterD.setUnitNo(item.getCntrTypeCode());
|
|
|
@@ -5289,7 +5032,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
measurement = measurement.add(billsList.stream().map(Bills::getMeasurement).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
marks = billsList.stream().map(Bills::getMarks).filter(Objects::nonNull).collect(Collectors.joining("&|&"));
|
|
|
commodityDescr = billsList.stream().map(Bills::getCommodityDescr).filter(Objects::nonNull).collect(Collectors.joining("&|&"));
|
|
|
- this.itemCopy(bills, billsList, true);
|
|
|
+ billUtils.itemCopy(bills, billsList, true);
|
|
|
}
|
|
|
bills.setTeuTotal(teuTotal);
|
|
|
bills.setGrossWeight(grossWeight);
|
|
|
@@ -6829,170 +6572,193 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 删除海运进出口明细表
|
|
|
- *
|
|
|
- * @param id 主表id
|
|
|
- */
|
|
|
- private void removeItemList(Long id) {
|
|
|
- SeaBillsDetail seaBillsDetail = seaBillsDetailService.getOne(new LambdaQueryWrapper<SeaBillsDetail>()
|
|
|
- .eq(SeaBillsDetail::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(SeaBillsDetail::getPid, id));
|
|
|
- if (seaBillsDetail != null) {
|
|
|
- seaBillsDetailService.removeById(seaBillsDetail.getId());
|
|
|
+ @Override
|
|
|
+ public R verificationPrompt(Bills bills) {
|
|
|
+ if (bills.getId() == null) {
|
|
|
+ throw new SecurityException("缺少必要参数");
|
|
|
+ }
|
|
|
+ Bills detail = baseMapper.selectById(bills.getId());
|
|
|
+ if (detail == null) {
|
|
|
+ throw new SecurityException("未查到单据信息");
|
|
|
}
|
|
|
List<PreContainers> preContainersList = preContainersService.list(new LambdaQueryWrapper<PreContainers>()
|
|
|
.eq(PreContainers::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(PreContainers::getIsDeleted, 0)
|
|
|
- .eq(PreContainers::getPid, id));
|
|
|
- if (!preContainersList.isEmpty()) {
|
|
|
- preContainersService.removeByIds(preContainersList.stream().map(PreContainers::getId).collect(Collectors.toList()));
|
|
|
+ .eq(PreContainers::getPid, detail.getId()));
|
|
|
+ StringBuilder texts = new StringBuilder();
|
|
|
+ for (PreContainers containers : preContainersList) {
|
|
|
+ if (ObjectUtils.isNull(containers.getSrcCostNo())) {
|
|
|
+ texts.append(containers.getCntrTypeCode()).append("未提取到成本价,请先提取成本!");
|
|
|
+ }
|
|
|
}
|
|
|
- List<Containers> containersList = containersService.list(new LambdaQueryWrapper<Containers>()
|
|
|
- .eq(Containers::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(Containers::getIsDeleted, 0)
|
|
|
- .eq(Containers::getPid, id));
|
|
|
- if (!containersList.isEmpty()) {
|
|
|
- containersService.removeByIds(containersList.stream().map(Containers::getId).collect(Collectors.toList()));
|
|
|
+ if (ObjectUtils.isNotNull(texts.toString())) {
|
|
|
+ return R.success(texts.toString());
|
|
|
}
|
|
|
- List<ContainersCommodity> containersCommodityList = containersCommodityService.list(new LambdaQueryWrapper<ContainersCommodity>()
|
|
|
- .eq(ContainersCommodity::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(ContainersCommodity::getIsDeleted, 0)
|
|
|
- .eq(ContainersCommodity::getPpId, id));
|
|
|
- if (!containersCommodityList.isEmpty()) {
|
|
|
- containersCommodityService.removeByIds(containersCommodityList.stream().map(ContainersCommodity::getId).collect(Collectors.toList()));
|
|
|
+ StringBuilder text = new StringBuilder();
|
|
|
+ for (PreContainers containers : preContainersList) {
|
|
|
+ if (containers.getSalesPrice().compareTo(containers.getCostPrice()) > 0) {
|
|
|
+ text.append(containers.getCntrTypeCode()).append("销售价大于成本中心销售价,是否继续!");
|
|
|
+ }
|
|
|
}
|
|
|
- List<ContainersBills> containersBillsList = containersBillsService.list(new LambdaQueryWrapper<ContainersBills>()
|
|
|
- .eq(ContainersBills::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(ContainersBills::getIsDeleted, 0)
|
|
|
- .eq(ContainersBills::getPpId, id));
|
|
|
- if (!containersBillsList.isEmpty()) {
|
|
|
- containersBillsService.removeByIds(containersBillsList.stream().map(ContainersBills::getId).collect(Collectors.toList()));
|
|
|
+ if (ObjectUtils.isNotNull(text.toString())) {
|
|
|
+ return R.success(text.toString());
|
|
|
+ } else {
|
|
|
+ return R.success("操作成功");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public R sendVerificationPrompt(String ids) {
|
|
|
+ if (ObjectUtils.isNull(ids)) {
|
|
|
+ throw new RuntimeException("缺少必要参数,发送失败!");
|
|
|
+ }
|
|
|
+ List<Long> idList = Func.toLongList(ids);
|
|
|
+ List<Bills> billsList = baseMapper.selectList(new LambdaQueryWrapper<Bills>()
|
|
|
+ .eq(Bills::getIsDeleted, 0)
|
|
|
+ .in(Bills::getId, idList));
|
|
|
+ if (billsList.isEmpty()) {
|
|
|
+ throw new RuntimeException("未查到海运出口单据,发送失败!");
|
|
|
+ }
|
|
|
+ List<PreContainers> preContainersList = preContainersService.list(new LambdaQueryWrapper<PreContainers>()
|
|
|
+ .eq(PreContainers::getIsDeleted, 0)
|
|
|
+ .in(PreContainers::getPid, idList));
|
|
|
+ if (preContainersList.isEmpty()) {
|
|
|
+ throw new RuntimeException("未查到预配箱型信息,发送失败!");
|
|
|
+ }
|
|
|
+ List<SeaContainerNumberItem> containerNumberItemList = seaContainerNumberItemService.list(new LambdaQueryWrapper<SeaContainerNumberItem>()
|
|
|
+ .eq(SeaContainerNumberItem::getIsDeleted, 0)
|
|
|
+ .in(SeaContainerNumberItem::getPid, idList)
|
|
|
+ .in(SeaContainerNumberItem::getBoxType, preContainersList.stream().map(PreContainers::getCntrTypeCode)
|
|
|
+ .distinct().collect(Collectors.toList())));
|
|
|
+ if (containerNumberItemList.isEmpty()) {
|
|
|
+ throw new RuntimeException("未选择放箱号,发送失败!");
|
|
|
}
|
|
|
List<FeeCenter> feeCenterList = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
|
|
|
- .eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(FeeCenter::getIsDeleted, 0)
|
|
|
- .eq(FeeCenter::getPid, id));
|
|
|
- if (!feeCenterList.isEmpty()) {
|
|
|
- for (FeeCenter item : feeCenterList) {
|
|
|
- if (1 == item.getAccStatus()) {
|
|
|
- throw new RuntimeException("费用:" + item.getFeeCnName() + "已生成账单");
|
|
|
- }
|
|
|
- if (item.getStlPid() != null) {
|
|
|
- throw new RuntimeException("费用:" + item.getFeeCnName() + "已申请");
|
|
|
+ .eq(FeeCenter::getDc, "D")
|
|
|
+ .eq(FeeCenter::getFeeCode, "HYF")
|
|
|
+ .in(FeeCenter::getPid, idList));
|
|
|
+ if (feeCenterList.isEmpty()) {
|
|
|
+ throw new RuntimeException("未查到应收海运费,发送失败!");
|
|
|
+ }
|
|
|
+ String boxBusinessConnectionTime = sysClient.getParamService("box.business.connection.time");
|
|
|
+ Date date = null;
|
|
|
+ DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ if (ObjectUtils.isNotNull(boxBusinessConnectionTime)) {
|
|
|
+ try {
|
|
|
+ date = dateFormat.parse(boxBusinessConnectionTime);
|
|
|
+ } catch (ParseException e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ StringBuilder text = new StringBuilder();
|
|
|
+ for (Bills item : billsList) {
|
|
|
+ boolean status = true;
|
|
|
+ if (item.getEtd().compareTo(date) < 0) {
|
|
|
+ status = false;
|
|
|
+ }
|
|
|
+ if (status) {
|
|
|
+ List<PreContainers> preContainers = preContainersList.stream().filter(e -> e.getPid().equals(item.getId()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ for (PreContainers containers : preContainers) {
|
|
|
+ if (feeCenterList.stream().anyMatch(e -> e.getPid().equals(item.getId()) &&
|
|
|
+ containers.getCntrTypeCode().equals(e.getUnitNo()) && e.getPrice().compareTo(containers.getCostPrice()) > 0)) {
|
|
|
+ text.append("提单号:").append(item.getMblno()).append("箱型:").append(containers.getCntrTypeCode()).append("应收海运费用大于成本中心销售价,发送失败!");
|
|
|
+ }
|
|
|
+ if (containerNumberItemList.stream().filter(e -> e.getPid().equals(containers.getPid()))
|
|
|
+ .mapToInt(SeaContainerNumberItem::getOccupyNum).sum() != containers.getQuantity()) {
|
|
|
+ text.append("提单号:").append(item.getMblno()).append("箱型:").append(containers.getCntrTypeCode()).append("箱量与所选放箱号数量不等,发送失败!");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- feeCenterService.removeByIds(feeCenterList.stream().map(FeeCenter::getId).collect(Collectors.toList()));
|
|
|
}
|
|
|
-
|
|
|
- List<FilesCenter> filesList = filesCenterService.list(new LambdaQueryWrapper<FilesCenter>()
|
|
|
- .eq(FilesCenter::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(FilesCenter::getIsDeleted, 0)
|
|
|
- .eq(FilesCenter::getPid, id));
|
|
|
- if (!filesList.isEmpty()) {
|
|
|
- filesCenterService.removeByIds(filesList.stream().map(FilesCenter::getId).collect(Collectors.toList()));
|
|
|
+ if (ObjectUtils.isNotNull(text.toString())) {
|
|
|
+ LocalDateTime now = LocalDateTime.now();
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
+ String formatted = now.format(formatter);
|
|
|
+ R<String> res = sysClient.getRoleIds(AuthUtil.getTenantId(), "成本中心");
|
|
|
+ if (res.isSuccess() && ObjectUtils.isNotNull()) {
|
|
|
+ R<List<User>> userListR = userClient.listUserByRoleIds(res.getData());
|
|
|
+ if (userListR.isSuccess() && ObjectUtils.isNotNull(userListR.getData())) {
|
|
|
+ for (User item : userListR.getData()) {
|
|
|
+ Message sendMessage = new Message();
|
|
|
+ sendMessage.setUserName(AuthUtil.getUserName());
|
|
|
+ sendMessage.setUserId(null);
|
|
|
+ sendMessage.setToUserId(item.getId());
|
|
|
+ sendMessage.setToUserName(item.getName());
|
|
|
+ sendMessage.setMessageType(1);
|
|
|
+ sendMessage.setTenantId(AuthUtil.getTenantId());
|
|
|
+ sendMessage.setCreateUser(null);
|
|
|
+ sendMessage.setCreateTime(new Date());
|
|
|
+ sendMessage.setPageLabel("海运出口");
|
|
|
+ sendMessage.setMessageBody("发送下货纸:" + text + ";时间:" + formatted + ";");
|
|
|
+ R save = messageClient.save(sendMessage);
|
|
|
+ if (!save.isSuccess()) {
|
|
|
+ throw new SecurityException("发送消息失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return R.success(text.toString());
|
|
|
+ } else {
|
|
|
+ return R.success("操作成功");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private FeeCenter addFeeCenterQuotation(Bills bills, String dc, int count, BFees fees,
|
|
|
- PreContainers items, List<BCurExrate> curExrateList, String exrateType, String type) {
|
|
|
- FeeCenter feeCenter = new FeeCenter();
|
|
|
- feeCenter.setBranchId(bills.getBranchId());
|
|
|
- feeCenter.setBranchName(bills.getBranchName());
|
|
|
- feeCenter.setPid(bills.getId());
|
|
|
- feeCenter.setCntrNo(bills.getQuantityCntrTypesDescr());
|
|
|
- feeCenter.setBillNo(bills.getBillNo());
|
|
|
- feeCenter.setBusinessType(bills.getBusinessType());
|
|
|
- feeCenter.setBillType(bills.getBillType());
|
|
|
- feeCenter.setBillDate(bills.getBillDate());
|
|
|
- feeCenter.setBillCorpId(bills.getCorpId());
|
|
|
- feeCenter.setBillCorpCnName(bills.getCorpCnName());
|
|
|
- feeCenter.setBillCorpEnName(bills.getCorpEnName());
|
|
|
- feeCenter.setBillShortName(bills.getShortName());
|
|
|
- feeCenter.setBillBranchId(bills.getBranchId());
|
|
|
- feeCenter.setBillBranchName(bills.getBranchName());
|
|
|
- feeCenter.setLineId(bills.getLineId());
|
|
|
- feeCenter.setLineCnName(bills.getLineCnName());
|
|
|
- feeCenter.setLineEnName(bills.getLineEnName());
|
|
|
- feeCenter.setVesselId(bills.getVesselId());
|
|
|
- feeCenter.setVesselCnName(bills.getVesselCnName());
|
|
|
- feeCenter.setVesselEnName(bills.getVesselEnName());
|
|
|
- feeCenter.setVoyageNo(bills.getVoyageNo());
|
|
|
- feeCenter.setMblno(bills.getMblno());
|
|
|
- feeCenter.setHblno(bills.getHblno());
|
|
|
- feeCenter.setEtd(bills.getEtd());
|
|
|
- feeCenter.setEta(bills.getEta());
|
|
|
- feeCenter.setPolId(bills.getPolId());
|
|
|
- feeCenter.setPolCode(bills.getPolCode());
|
|
|
- feeCenter.setPolCnName(bills.getPolCnName());
|
|
|
- feeCenter.setPolEnName(bills.getPolEnName());
|
|
|
- feeCenter.setPodId(bills.getPodId());
|
|
|
- feeCenter.setPodCode(bills.getPodCode());
|
|
|
- feeCenter.setPodCnName(bills.getPodCnName());
|
|
|
- feeCenter.setPodEnName(bills.getPodEnName());
|
|
|
- feeCenter.setDc(dc);
|
|
|
- feeCenter.setPaymode(bills.getMpaymode());
|
|
|
- feeCenter.setSort(count);
|
|
|
- feeCenter.setFeeId(fees.getId());
|
|
|
- feeCenter.setCorpType("国内直接客户");
|
|
|
- feeCenter.setFeeCode(fees.getCode());
|
|
|
- feeCenter.setFeeCnName(fees.getCnName());
|
|
|
- feeCenter.setFeeEnName(fees.getEnName());
|
|
|
- feeCenter.setUnitNo(fees.getUnitNo());
|
|
|
- feeCenter.setCurCode("USD");
|
|
|
- feeCenter.setExrate(currencyUtils.obtainExrate(feeCenter.getDc(), curExrateList, feeCenter.getCurCode(), "1"));
|
|
|
- feeCenter.setQuantity(new BigDecimal(items.getQuantity() + ""));
|
|
|
- if ("1".equals(type)) {
|
|
|
- feeCenter.setCorpId(bills.getCorpId());
|
|
|
- feeCenter.setCorpCnName(bills.getCorpCnName());
|
|
|
- feeCenter.setCorpEnName(bills.getCorpEnName());
|
|
|
- feeCenter.setShortName(bills.getShortName());
|
|
|
- feeCenter.setPrice(items.getOceanFreight());
|
|
|
- BCorps bCorps = bCorpsService.getById(bills.getCorpId());
|
|
|
- if (bCorps != null) {
|
|
|
- feeCenter.setGenerationCorpId(bCorps.getBookingAgentId());
|
|
|
- feeCenter.setGenerationCorpCnName(bCorps.getBookingAgentCnName());
|
|
|
- feeCenter.setGenerationCorpEnName(bCorps.getBookingAgentEnName());
|
|
|
- }
|
|
|
- } else if ("2".equals(type)) {
|
|
|
- /* BCorps bCorps = bCorpsService.getOne(new LambdaQueryWrapper<BCorps>()
|
|
|
- .eq(BCorps::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(BCorps::getIsDeleted, 0)
|
|
|
- .eq(BCorps::getCode, "ZBYF"));
|
|
|
- if (bCorps == null) {
|
|
|
- throw new RuntimeException("基础资料未查到编码为‘ZBYF’往来单位");
|
|
|
- }*/
|
|
|
- feeCenter.setCorpId(bills.getCarrierId());
|
|
|
- feeCenter.setCorpCnName(bills.getCarrierCnName());
|
|
|
- feeCenter.setCorpEnName(bills.getCarrierEnName());
|
|
|
- feeCenter.setShortName(bills.getCarrierShortName());
|
|
|
- feeCenter.setPrice(items.getCostPrice());
|
|
|
- BCorps bCorps = bCorpsService.getById(bills.getCarrierId());
|
|
|
- if (bCorps != null) {
|
|
|
- feeCenter.setGenerationCorpId(bCorps.getBookingAgentId());
|
|
|
- feeCenter.setGenerationCorpCnName(bCorps.getBookingAgentCnName());
|
|
|
- feeCenter.setGenerationCorpEnName(bCorps.getBookingAgentEnName());
|
|
|
- }
|
|
|
- }
|
|
|
- feeCenter.setAmount(feeCenter.getPrice().multiply(feeCenter.getQuantity()));
|
|
|
- if (ObjectUtils.isNull(feeCenter.getAmount())) {
|
|
|
- feeCenter.setAmount(new BigDecimal("0"));
|
|
|
- }
|
|
|
- if (exrateType.equals(feeCenter.getCurCode())) {
|
|
|
- feeCenter.setAmountLoc(feeCenter.getAmount());
|
|
|
- } else {
|
|
|
- if (new BigDecimal("0").compareTo(feeCenter.getAmount()) != 0) {
|
|
|
- feeCenter.setAmountLoc(feeCenter.getAmount().multiply(feeCenter.getExrate()));
|
|
|
- } else {
|
|
|
- feeCenter.setAmountLoc(new BigDecimal("0"));
|
|
|
- }
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public R sendDeliveryPaper(String ids) {
|
|
|
+ if (ObjectUtils.isNull(ids)) {
|
|
|
+ throw new RuntimeException("缺少必要参数");
|
|
|
}
|
|
|
- feeCenter.setUnsettledAmount(feeCenter.getAmount());
|
|
|
- if (new BigDecimal("0").compareTo(feeCenter.getAmount()) == 0) {
|
|
|
- return null;
|
|
|
- } else {
|
|
|
- return feeCenter;
|
|
|
+ List<Long> idList = Func.toLongList(ids);
|
|
|
+ List<Bills> billsList = baseMapper.selectList(new LambdaQueryWrapper<Bills>()
|
|
|
+ .eq(Bills::getIsDeleted, 0)
|
|
|
+ .in(Bills::getId, idList));
|
|
|
+ if (billsList.isEmpty()) {
|
|
|
+ throw new RuntimeException("未查到海运出口单据,发送失败!");
|
|
|
+ }
|
|
|
+ List<PreContainers> preContainersList = preContainersService.list(new LambdaQueryWrapper<PreContainers>()
|
|
|
+ .eq(PreContainers::getIsDeleted, 0)
|
|
|
+ .in(PreContainers::getPid, idList));
|
|
|
+ if (preContainersList.isEmpty()) {
|
|
|
+ throw new RuntimeException("未查到预配箱型信息,发送失败!");
|
|
|
+ }
|
|
|
+ List<SeaContainerNumberItem> containerNumberItemList = seaContainerNumberItemService.list(new LambdaQueryWrapper<SeaContainerNumberItem>()
|
|
|
+ .eq(SeaContainerNumberItem::getIsDeleted, 0)
|
|
|
+ .in(SeaContainerNumberItem::getPid, idList)
|
|
|
+ .in(SeaContainerNumberItem::getBoxType, preContainersList.stream().map(PreContainers::getCntrTypeCode)
|
|
|
+ .distinct().collect(Collectors.toList())));
|
|
|
+ if (containerNumberItemList.isEmpty()) {
|
|
|
+ throw new RuntimeException("未选择放箱号,发送失败!");
|
|
|
}
|
|
|
+ List<DeliveryPaperExcel> excelList = new ArrayList<>();
|
|
|
+ for (Bills item : billsList) {
|
|
|
+ DeliveryPaperExcel excel = new DeliveryPaperExcel();
|
|
|
+ excel.setEtd(item.getEtd());
|
|
|
+ excel.setPodEnName(item.getPodEnName());
|
|
|
+ excel.setVesselCnName(item.getVesselEnName());
|
|
|
+ excel.setVoyageNo(item.getVoyageNo());
|
|
|
+ excel.setBoxOwner("WFL");
|
|
|
+ excel.setInboundContainerOwner(item.getCarrierEnName());
|
|
|
+ excel.setPotEnName(item.getPotEnName());
|
|
|
+ excel.setMblno(item.getMblno());
|
|
|
+ excel.setHblno(item.getHblno());
|
|
|
+ excel.setQuantityCntrDescr(item.getQuantityCntrDescr());
|
|
|
+ excel.setGrossWeight(item.getGrossWeight());
|
|
|
+ List<PreContainers> preContainers = preContainersList.stream().filter(e -> e.getPid().equals(item.getId()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (!preContainers.isEmpty()) {
|
|
|
+ List<Long> preContainersId = preContainers.stream().map(PreContainers::getId).collect(Collectors.toList());
|
|
|
+ List<SeaContainerNumberItem> containerNumberItems = containerNumberItemList.stream().filter(e ->
|
|
|
+ preContainersId.contains(e.getPid())).collect(Collectors.toList());
|
|
|
+ if (!containerNumberItems.isEmpty()) {
|
|
|
+ excel.setContainerNumber(containerNumberItems.stream().map(SeaContainerNumberItem::getContainerNumber)
|
|
|
+ .collect(Collectors.joining(",")));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ excelList.add(excel);
|
|
|
+ }
|
|
|
+ return R.data(excelList);
|
|
|
}
|
|
|
-
|
|
|
}
|