|
|
@@ -40,13 +40,17 @@ import org.springblade.los.basic.corps.entity.BCorps;
|
|
|
import org.springblade.los.basic.corps.entity.BCorpsAttn;
|
|
|
import org.springblade.los.basic.corps.mapper.CorpsAttnMapper;
|
|
|
import org.springblade.los.basic.corps.mapper.CorpsMapper;
|
|
|
+import org.springblade.los.basic.corps.service.IBCorpsService;
|
|
|
import org.springblade.los.basic.cur.entity.BCurExrate;
|
|
|
+import org.springblade.los.basic.fees.entity.BFees;
|
|
|
+import org.springblade.los.basic.fees.service.IBFeesService;
|
|
|
import org.springblade.los.basic.vessels.entity.BVessels;
|
|
|
import org.springblade.los.basic.vessels.mapper.VesselsMapper;
|
|
|
import org.springblade.los.billno.entity.BusinessBillNo;
|
|
|
import org.springblade.los.billno.service.IBusinessBillNoService;
|
|
|
import org.springblade.los.business.files.entity.FilesCenter;
|
|
|
import org.springblade.los.business.files.service.IFilesCenterService;
|
|
|
+import org.springblade.los.business.mktSlot.entity.MktSlotQuotation;
|
|
|
import org.springblade.los.business.release.entity.SeaReleaseBillItems;
|
|
|
import org.springblade.los.business.sea.dto.WaitingBox;
|
|
|
import org.springblade.los.business.sea.entity.*;
|
|
|
@@ -145,6 +149,10 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
|
|
|
private final CurrencyUtils currencyUtils;
|
|
|
|
|
|
+ private final IBFeesService bFeesService;
|
|
|
+
|
|
|
+ private final IBCorpsService bCorpsService;
|
|
|
+
|
|
|
@Override
|
|
|
public IPage<BillsVO> selectBillsPage(IPage<BillsVO> page, BillsVO bills) {
|
|
|
return page.setRecords(baseMapper.selectBillsPage(page, bills));
|
|
|
@@ -750,6 +758,13 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
if (ObjectUtils.isNotNull(bills.getContainersList())) {
|
|
|
for (Containers item : bills.getContainersList()) {
|
|
|
item.setPid(bills.getId());
|
|
|
+ if ("MH".equals(bills.getBillType())) {
|
|
|
+ item.setHblno(bills.getHblno());
|
|
|
+ } else {
|
|
|
+ if (ObjectUtils.isNull(item.getHblno())) {
|
|
|
+ item.setHblno(bills.getBookingNo());
|
|
|
+ }
|
|
|
+ }
|
|
|
if (item.getId() == null) {
|
|
|
item.setCreateTime(new Date());
|
|
|
item.setCreateUser(AuthUtil.getUserId());
|
|
|
@@ -1201,6 +1216,18 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
if (ObjectUtils.isNull(bills.getPolId())) {
|
|
|
throw new RuntimeException("装货港不能为空,操作失败");
|
|
|
}
|
|
|
+ BigDecimal grossWeight = new BigDecimal("0.00");
|
|
|
+ BigDecimal quantity = new BigDecimal("0.00");
|
|
|
+ BigDecimal measurement = new BigDecimal("0.00");
|
|
|
+ List<Bills> billsListF = baseMapper.selectList(new LambdaQueryWrapper<Bills>()
|
|
|
+ .eq(Bills::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(Bills::getIsDeleted, 0)
|
|
|
+ .eq(Bills::getMasterId, id));
|
|
|
+ if (!billsListF.isEmpty()) {
|
|
|
+ grossWeight = grossWeight.add(billsListF.stream().map(Bills::getGrossWeight).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ quantity = quantity.add(billsListF.stream().map(Bills::getQuantity).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ measurement = measurement.add(billsListF.stream().map(Bills::getMeasurement).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ }
|
|
|
List<Bills> billsList = baseMapper.selectList(new LambdaQueryWrapper<Bills>()
|
|
|
.eq(Bills::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(Bills::getIsDeleted, 0)
|
|
|
@@ -1288,9 +1315,6 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
BigDecimal amountDrLoc = bills.getAmountDrLoc();
|
|
|
BigDecimal amountCrLoc = bills.getAmountCrLoc();
|
|
|
BigDecimal amountProfitLoc = bills.getAmountProfitLoc();*/
|
|
|
- BigDecimal grossWeight = new BigDecimal("0.00");
|
|
|
- BigDecimal quantity = new BigDecimal("0.00");
|
|
|
- BigDecimal measurement = new BigDecimal("0.00");
|
|
|
Integer teuTotal = bills.getTeuTotal();
|
|
|
String marks = "";
|
|
|
String commodityDescr = "";
|
|
|
@@ -1322,15 +1346,6 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
bills.setAmountDrLoc(amountDrLoc);
|
|
|
bills.setAmountCrLoc(amountCrLoc);
|
|
|
bills.setAmountProfitLoc(amountProfitLoc);*/
|
|
|
- List<Bills> billsListF = baseMapper.selectList(new LambdaQueryWrapper<Bills>()
|
|
|
- .eq(Bills::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(Bills::getIsDeleted, 0)
|
|
|
- .eq(Bills::getMasterId, id));
|
|
|
- if (!billsListF.isEmpty()){
|
|
|
- grossWeight = grossWeight.add(billsListF.stream().map(Bills::getGrossWeight).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
- quantity = quantity.add(billsListF.stream().map(Bills::getQuantity).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
- measurement = measurement.add(billsListF.stream().map(Bills::getMeasurement).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
- }
|
|
|
bills.setGrossWeight(grossWeight);
|
|
|
bills.setQuantity(quantity);
|
|
|
bills.setMeasurement(measurement);
|
|
|
@@ -1677,6 +1692,10 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
if (ObjectUtils.isNull(declare.getActualEta())) {
|
|
|
throw new RuntimeException("实际到港日期不能为空");
|
|
|
}
|
|
|
+ } else if ("KHTS".equals(declare.getBusinessType())) {
|
|
|
+ actId = 1131;
|
|
|
+ processType = "客户托书审核";
|
|
|
+ checkType = "KHTS";
|
|
|
}
|
|
|
//审批数据
|
|
|
LosAuditProecessDTO auditProecessDTO = new LosAuditProecessDTO();
|
|
|
@@ -1756,59 +1775,62 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
}
|
|
|
declare.setStatus(1);
|
|
|
baseMapper.updateById(declare);
|
|
|
- List<Long> idList = new ArrayList<>();
|
|
|
- idList.add(declare.getId());
|
|
|
- if ("MM".equals(declare.getBillType())) {
|
|
|
- List<Bills> billsList = baseMapper.selectList(new LambdaQueryWrapper<Bills>()
|
|
|
- .eq(Bills::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(Bills::getIsDeleted, 0)
|
|
|
- .eq(Bills::getMasterId, declare.getId())
|
|
|
- .eq(Bills::getBillType, "MH"));
|
|
|
- if (!billsList.isEmpty()) {
|
|
|
- for (Bills item : billsList) {
|
|
|
- item.setStatus(1);
|
|
|
- item.setUpdateTime(new Date());
|
|
|
- item.setUpdateUserName(AuthUtil.getUserName());
|
|
|
- item.setUpdateUser(AuthUtil.getUserId());
|
|
|
- }
|
|
|
- this.updateBatchById(billsList);
|
|
|
- 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()) {
|
|
|
- throw new RuntimeException("未查到分单费用明细,先维护分单费用");
|
|
|
- }
|
|
|
- for (Bills item : billsList) {
|
|
|
- List<FeeCenter> feeCenters = feeCenterList.stream().filter(e -> e.getPid().equals(item.getId()))
|
|
|
- .collect(Collectors.toList());
|
|
|
- if (feeCenters.isEmpty()) {
|
|
|
- throw new RuntimeException("未查到分单编号:" + item.getBillNo() + "费用明细,先维护分单费用");
|
|
|
+ if ("KHTS".equals(declare.getBusinessType())) {
|
|
|
+ return declare;
|
|
|
+ } else {
|
|
|
+ List<Long> idList = new ArrayList<>();
|
|
|
+ idList.add(declare.getId());
|
|
|
+ if ("MM".equals(declare.getBillType())) {
|
|
|
+ List<Bills> billsList = baseMapper.selectList(new LambdaQueryWrapper<Bills>()
|
|
|
+ .eq(Bills::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(Bills::getIsDeleted, 0)
|
|
|
+ .eq(Bills::getMasterId, declare.getId())
|
|
|
+ .eq(Bills::getBillType, "MH"));
|
|
|
+ if (!billsList.isEmpty()) {
|
|
|
+ for (Bills item : billsList) {
|
|
|
+ item.setStatus(1);
|
|
|
+ item.setUpdateTime(new Date());
|
|
|
+ item.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ item.setUpdateUser(AuthUtil.getUserId());
|
|
|
}
|
|
|
+ this.updateBatchById(billsList);
|
|
|
+ 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()) {
|
|
|
+ throw new RuntimeException("未查到分单费用明细,先维护分单费用");
|
|
|
+ }
|
|
|
+ for (Bills item : billsList) {
|
|
|
+ List<FeeCenter> feeCenters = feeCenterList.stream().filter(e -> e.getPid().equals(item.getId()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (feeCenters.isEmpty()) {
|
|
|
+ throw new RuntimeException("未查到分单编号:" + item.getBillNo() + "费用明细,先维护分单费用");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ idList.addAll(billsList.stream().map(Bills::getId).collect(Collectors.toList()));
|
|
|
}
|
|
|
- idList.addAll(billsList.stream().map(Bills::getId).collect(Collectors.toList()));
|
|
|
}
|
|
|
- }
|
|
|
- List<FeeCenter> feeCenterList = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
|
|
|
- .eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(FeeCenter::getIsDeleted, 0)
|
|
|
- .in(FeeCenter::getPid, idList)
|
|
|
- .eq(FeeCenter::getAccStatus, "0")
|
|
|
- .eq(FeeCenter::getAuditStatus, "0"));
|
|
|
- if (!feeCenterList.isEmpty()) {
|
|
|
- for (FeeCenter item : feeCenterList) {
|
|
|
- item.setUpdateTime(new Date());
|
|
|
- item.setUpdateUser(AuthUtil.getUserId());
|
|
|
- item.setUpdateUserName(AuthUtil.getUserName());
|
|
|
- item.setAuditStatus("1");
|
|
|
- item.setApplyId(AuthUtil.getUserId());
|
|
|
- item.setApplyName(AuthUtil.getUserName());
|
|
|
- item.setApplyTime(new Date());
|
|
|
+ List<FeeCenter> feeCenterList = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
|
|
|
+ .eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(FeeCenter::getIsDeleted, 0)
|
|
|
+ .in(FeeCenter::getPid, idList)
|
|
|
+ .eq(FeeCenter::getAccStatus, "0")
|
|
|
+ .eq(FeeCenter::getAuditStatus, "0"));
|
|
|
+ if (!feeCenterList.isEmpty()) {
|
|
|
+ for (FeeCenter item : feeCenterList) {
|
|
|
+ item.setUpdateTime(new Date());
|
|
|
+ item.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ item.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ item.setAuditStatus("1");
|
|
|
+ item.setApplyId(AuthUtil.getUserId());
|
|
|
+ item.setApplyName(AuthUtil.getUserName());
|
|
|
+ item.setApplyTime(new Date());
|
|
|
+ }
|
|
|
+ feeCenterService.updateBatchById(feeCenterList);
|
|
|
}
|
|
|
- feeCenterService.updateBatchById(feeCenterList);
|
|
|
+ return declare;
|
|
|
}
|
|
|
-
|
|
|
- return declare;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -1824,44 +1846,48 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
}
|
|
|
declare.setStatus(0);
|
|
|
baseMapper.updateById(declare);
|
|
|
- List<Long> idList = new ArrayList<>();
|
|
|
- idList.add(declare.getId());
|
|
|
- if ("MM".equals(declare.getBillType())) {
|
|
|
- List<Bills> billsList = baseMapper.selectList(new LambdaQueryWrapper<Bills>()
|
|
|
- .eq(Bills::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(Bills::getIsDeleted, 0)
|
|
|
- .eq(Bills::getMasterId, declare.getId())
|
|
|
- .eq(Bills::getBillType, "MH"));
|
|
|
- if (!billsList.isEmpty()) {
|
|
|
- for (Bills item : billsList) {
|
|
|
- item.setStatus(0);
|
|
|
+ if ("KHTS".equals(declare.getBusinessType())) {
|
|
|
+ return declare;
|
|
|
+ } else {
|
|
|
+ List<Long> idList = new ArrayList<>();
|
|
|
+ idList.add(declare.getId());
|
|
|
+ if ("MM".equals(declare.getBillType())) {
|
|
|
+ List<Bills> billsList = baseMapper.selectList(new LambdaQueryWrapper<Bills>()
|
|
|
+ .eq(Bills::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(Bills::getIsDeleted, 0)
|
|
|
+ .eq(Bills::getMasterId, declare.getId())
|
|
|
+ .eq(Bills::getBillType, "MH"));
|
|
|
+ if (!billsList.isEmpty()) {
|
|
|
+ for (Bills item : billsList) {
|
|
|
+ item.setStatus(0);
|
|
|
+ item.setUpdateTime(new Date());
|
|
|
+ item.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ item.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ }
|
|
|
+ this.updateBatchById(billsList);
|
|
|
+ idList.addAll(billsList.stream().map(Bills::getId).collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<FeeCenter> feeCenterList = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
|
|
|
+ .eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(FeeCenter::getIsDeleted, 0)
|
|
|
+ .in(FeeCenter::getPid, idList)
|
|
|
+ .eq(FeeCenter::getAccStatus, "0")
|
|
|
+ .eq(FeeCenter::getAuditStatus, "1"));
|
|
|
+ if (!feeCenterList.isEmpty()) {
|
|
|
+ for (FeeCenter item : feeCenterList) {
|
|
|
item.setUpdateTime(new Date());
|
|
|
- item.setUpdateUserName(AuthUtil.getUserName());
|
|
|
item.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ item.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ item.setAuditStatus("0");
|
|
|
+ item.setApplyId(AuthUtil.getUserId());
|
|
|
+ item.setApplyName(AuthUtil.getUserName());
|
|
|
+ item.setApplyTime(new Date());
|
|
|
}
|
|
|
- this.updateBatchById(billsList);
|
|
|
- idList.addAll(billsList.stream().map(Bills::getId).collect(Collectors.toList()));
|
|
|
- }
|
|
|
- }
|
|
|
- List<FeeCenter> feeCenterList = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
|
|
|
- .eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(FeeCenter::getIsDeleted, 0)
|
|
|
- .in(FeeCenter::getPid, idList)
|
|
|
- .eq(FeeCenter::getAccStatus, "0")
|
|
|
- .eq(FeeCenter::getAuditStatus, "1"));
|
|
|
- if (!feeCenterList.isEmpty()) {
|
|
|
- for (FeeCenter item : feeCenterList) {
|
|
|
- item.setUpdateTime(new Date());
|
|
|
- item.setUpdateUser(AuthUtil.getUserId());
|
|
|
- item.setUpdateUserName(AuthUtil.getUserName());
|
|
|
- item.setAuditStatus("0");
|
|
|
- item.setApplyId(AuthUtil.getUserId());
|
|
|
- item.setApplyName(AuthUtil.getUserName());
|
|
|
- item.setApplyTime(new Date());
|
|
|
+ feeCenterService.updateBatchById(feeCenterList);
|
|
|
}
|
|
|
- feeCenterService.updateBatchById(feeCenterList);
|
|
|
+ return declare;
|
|
|
}
|
|
|
- return declare;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -4121,6 +4147,13 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
.eq(FilesCenter::getIsDeleted, 0)
|
|
|
.eq(FilesCenter::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(FilesCenter::getPid, detail.getId())));
|
|
|
+ detail.setFeeCenterListC(new ArrayList<>());
|
|
|
+ detail.setFeeCenterListD(new ArrayList<>());
|
|
|
+ detail.setFeeCenterList(new ArrayList<>());
|
|
|
+ detail.setContainersList(new ArrayList<>());
|
|
|
+ detail.setContainersReportsList(new ArrayList<>());
|
|
|
+ detail.setWaitingBoxList(new ArrayList<>());
|
|
|
+ detail.setFeeCenterAmendList(new ArrayList<>());
|
|
|
return detail;
|
|
|
}
|
|
|
|
|
|
@@ -4136,13 +4169,40 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
}
|
|
|
detail.setIssueStatus("1");
|
|
|
baseMapper.updateById(detail);
|
|
|
+ boolean type = false;
|
|
|
+ String billType = "";
|
|
|
+ if ("YDC".equals(detail.getBusinessType())) {
|
|
|
+ billType = "MM";
|
|
|
+ } else if ("KHTS".equals(detail.getBusinessType())) {
|
|
|
+ billType = "MH";
|
|
|
+ type = true;
|
|
|
+ } else {
|
|
|
+ throw new RuntimeException("业务类型错误,请联系管理员");
|
|
|
+ }
|
|
|
SeaBillsDetail seaBillsDetail = seaBillsDetailService.getOne(new LambdaQueryWrapper<SeaBillsDetail>()
|
|
|
.eq(SeaBillsDetail::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(SeaBillsDetail::getPid, detail.getId()));
|
|
|
- List<PreContainers> preContainers = preContainersService.list(new LambdaQueryWrapper<PreContainers>()
|
|
|
+ List<PreContainers> preContainersList = preContainersService.list(new LambdaQueryWrapper<PreContainers>()
|
|
|
.eq(PreContainers::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(PreContainers::getIsDeleted, 0)
|
|
|
.eq(PreContainers::getPid, detail.getId()));
|
|
|
+ List<Containers> containersList = new ArrayList<>();
|
|
|
+ List<FeeCenter> feeCenterList = new ArrayList<>();
|
|
|
+ List<FilesCenter> filesCenterList = new ArrayList<>();
|
|
|
+ if (type) {
|
|
|
+ containersList = containersService.list(new LambdaQueryWrapper<Containers>()
|
|
|
+ .eq(Containers::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(Containers::getIsDeleted, 0)
|
|
|
+ .eq(Containers::getPid, detail.getId()));
|
|
|
+ feeCenterList = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
|
|
|
+ .eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(FeeCenter::getIsDeleted, 0)
|
|
|
+ .eq(FeeCenter::getPid, detail.getId()));
|
|
|
+ filesCenterList = filesCenterService.list(new LambdaQueryWrapper<FilesCenter>()
|
|
|
+ .eq(FilesCenter::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(FilesCenter::getIsDeleted, 0)
|
|
|
+ .eq(FilesCenter::getPid, detail.getId()));
|
|
|
+ }
|
|
|
BusinessType businessType = bBusinessTypeService.getOne(new LambdaQueryWrapper<BusinessType>()
|
|
|
.select(BusinessType::getId)
|
|
|
.eq(BusinessType::getTenantId, AuthUtil.getTenantId())
|
|
|
@@ -4169,6 +4229,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
copyBills.setBusinessType("SE");
|
|
|
copyBills.setBusinessTypes("HYCK");
|
|
|
copyBills.setSeaType("E");
|
|
|
+ copyBills.setBillType(billType);
|
|
|
copyBills.setBillNo((String) clientBillNo.getData());
|
|
|
copyBills.setCarrierId(detail.getActualShippingCompanyId());
|
|
|
copyBills.setCarrierCnName(detail.getActualShippingCompanyCname());
|
|
|
@@ -4224,7 +4285,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
copyBills.setCfsQuantity(new BigDecimal("0.00"));
|
|
|
copyBills.setCfsGrossWeight(new BigDecimal("0.00"));
|
|
|
copyBills.setCfsMeasurement(new BigDecimal("0.00"));
|
|
|
- copyBills.setBillType("MM");
|
|
|
+ copyBills.setBoxBelongsTo("SOC");
|
|
|
this.save(copyBills);
|
|
|
if (seaBillsDetail != null) {
|
|
|
seaBillsDetail.setId(null);
|
|
|
@@ -4236,8 +4297,8 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
seaBillsDetail.setCreateTime(new Date());
|
|
|
seaBillsDetailService.save(seaBillsDetail);
|
|
|
}
|
|
|
- if (!preContainers.isEmpty()) {
|
|
|
- for (PreContainers containers : preContainers) {
|
|
|
+ if (!preContainersList.isEmpty()) {
|
|
|
+ for (PreContainers containers : preContainersList) {
|
|
|
containers.setId(null);
|
|
|
containers.setPid(copyBills.getId());
|
|
|
containers.setCreateUser(AuthUtil.getUserId());
|
|
|
@@ -4247,7 +4308,91 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
containers.setCreateTime(new Date());
|
|
|
containers.setContainerNumberStatus("录入");
|
|
|
}
|
|
|
- preContainersService.saveBatch(preContainers);
|
|
|
+ preContainersService.saveBatch(preContainersList);
|
|
|
+ if (type) {
|
|
|
+ BFees fees = bFeesService.getOne(new LambdaQueryWrapper<BFees>()
|
|
|
+ .eq(BFees::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(BFees::getIsDeleted, 0)
|
|
|
+ .eq(BFees::getCode, "HYF"));
|
|
|
+ if (fees == null) {
|
|
|
+ throw new RuntimeException("未查到海运费信息,请先维护基础资料");
|
|
|
+ }
|
|
|
+ BFees feesD = bFeesService.getOne(new LambdaQueryWrapper<BFees>()
|
|
|
+ .eq(BFees::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(BFees::getIsDeleted, 0)
|
|
|
+ .eq(BFees::getCode, "XSJ"));
|
|
|
+ if (feesD == null) {
|
|
|
+ throw new RuntimeException("未查到销售价信息,请先维护基础资料");
|
|
|
+ }
|
|
|
+ String deptName = copyBills.getBranchName();
|
|
|
+ String branchId = copyBills.getBranchId();
|
|
|
+ List<FeeCenter> feeCenters = new ArrayList<>();
|
|
|
+ Date date = bills.getEtd();
|
|
|
+ String exrateType = currencyUtils.standardCurrency(branchId);
|
|
|
+ List<BCurExrate> curExrateList = currencyUtils.obtainRate(date, "1", branchId);
|
|
|
+ int count = 1;
|
|
|
+ for (PreContainers item : preContainersList) {
|
|
|
+ FeeCenter feeCenter = this.addFeeCenterQuotation(bills, "D", count, fees, item,
|
|
|
+ curExrateList, exrateType, "1");
|
|
|
+ if (feeCenter != null) {
|
|
|
+ feeCenter.setUnitNo(item.getCntrTypeCode());
|
|
|
+ feeCenter.setBranchId(branchId);
|
|
|
+ feeCenter.setBranchName(deptName);
|
|
|
+ feeCenters.add(feeCenter);
|
|
|
+ count++;
|
|
|
+ }
|
|
|
+ FeeCenter feeCenterD = this.addFeeCenterQuotation(bills, "C", count, feesD, item,
|
|
|
+ curExrateList, exrateType, "2");
|
|
|
+ if (feeCenterD != null) {
|
|
|
+ feeCenterD.setUnitNo(item.getCntrTypeCode());
|
|
|
+ feeCenterD.setBranchId(branchId);
|
|
|
+ feeCenterD.setBranchName(deptName);
|
|
|
+ feeCenters.add(feeCenterD);
|
|
|
+ count++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!feeCenters.isEmpty()) {
|
|
|
+ feeCenterService.saveBatch(feeCenters);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (type) {
|
|
|
+ if (!containersList.isEmpty()) {
|
|
|
+ for (Containers containers : containersList) {
|
|
|
+ containers.setId(null);
|
|
|
+ containers.setPid(copyBills.getId());
|
|
|
+ containers.setCreateUser(AuthUtil.getUserId());
|
|
|
+ containers.setCreateUserName(AuthUtil.getUserName());
|
|
|
+ containers.setCreateDept(copyBills.getCreateDept());
|
|
|
+ containers.setCreateDeptName(copyBills.getCreateDeptName());
|
|
|
+ containers.setCreateTime(new Date());
|
|
|
+ }
|
|
|
+ containersService.saveBatch(containersList);
|
|
|
+ }
|
|
|
+ if (!feeCenterList.isEmpty()) {
|
|
|
+ for (FeeCenter containers : feeCenterList) {
|
|
|
+ containers.setId(null);
|
|
|
+ containers.setPid(copyBills.getId());
|
|
|
+ containers.setCreateUser(AuthUtil.getUserId());
|
|
|
+ containers.setCreateUserName(AuthUtil.getUserName());
|
|
|
+ containers.setCreateDept(copyBills.getCreateDept());
|
|
|
+ containers.setCreateDeptName(copyBills.getCreateDeptName());
|
|
|
+ containers.setCreateTime(new Date());
|
|
|
+ }
|
|
|
+ feeCenterService.saveBatch(feeCenterList);
|
|
|
+ }
|
|
|
+ if (!filesCenterList.isEmpty()) {
|
|
|
+ for (FilesCenter containers : filesCenterList) {
|
|
|
+ containers.setId(null);
|
|
|
+ containers.setPid(copyBills.getId());
|
|
|
+ containers.setCreateUser(AuthUtil.getUserId());
|
|
|
+ containers.setCreateUserName(AuthUtil.getUserName());
|
|
|
+ containers.setCreateDept(copyBills.getCreateDept());
|
|
|
+ containers.setCreateDeptName(copyBills.getCreateDeptName());
|
|
|
+ containers.setCreateTime(new Date());
|
|
|
+ }
|
|
|
+ filesCenterService.saveBatch(filesCenterList);
|
|
|
+ }
|
|
|
}
|
|
|
R<User> res = userClient.userInfoById(copyBills.getOperatorId());
|
|
|
if (res.isSuccess() && ObjectUtils.isNotNull(res.getData())) {
|
|
|
@@ -4732,4 +4877,90 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ 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.getCorpCnName());
|
|
|
+ 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.getSalesPrice());
|
|
|
+ } 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(bCorps.getId());
|
|
|
+ feeCenter.setCorpCnName(bCorps.getCnName());
|
|
|
+ feeCenter.setCorpEnName(bCorps.getEnName());
|
|
|
+ feeCenter.setShortName(bCorps.getShortName());
|
|
|
+ feeCenter.setPrice(items.getCostPrice());
|
|
|
+ }
|
|
|
+ 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"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (new BigDecimal("0").compareTo(feeCenter.getAmount()) == 0) {
|
|
|
+ return null;
|
|
|
+ } else {
|
|
|
+ return feeCenter;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|