|
|
@@ -527,23 +527,6 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
@Override
|
|
|
public IPage<BoxPoolContainerNumberDTO> listContainerNumber(BoxPoolDTO boxPoolDTO, IPage<BoxPoolContainerNumberDTO> page) {
|
|
|
boxPoolDTO.setTenantId(AuthUtil.getTenantId());
|
|
|
- LambdaQueryWrapper<PutBox> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
- lambdaQueryWrapper.eq(PutBox::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(PutBox::getIsDeleted, 0)
|
|
|
- .eq(ObjectUtils.isNotNull(boxPoolDTO.getBoxType()), PutBox::getBoxType, boxPoolDTO.getBoxType())
|
|
|
- .apply(ObjectUtils.isNotNull(boxPoolDTO.getBusType()), "find_in_set(bus_type,'" + boxPoolDTO.getBusType() + "')")
|
|
|
- .like(ObjectUtils.isNotNull(boxPoolDTO.getContainerNumber()), PutBox::getContainerNumber, boxPoolDTO.getContainerNumber())
|
|
|
- .like(ObjectUtils.isNotNull(boxPoolDTO.getPodId()), PutBox::getPodId, boxPoolDTO.getPodId())
|
|
|
- .like(ObjectUtils.isNotNull(boxPoolDTO.getPodName()), PutBox::getPodCname, boxPoolDTO.getPodName())
|
|
|
- .like(ObjectUtils.isNotNull(boxPoolDTO.getPolId()), PutBox::getPolId, boxPoolDTO.getPolId())
|
|
|
- .like(ObjectUtils.isNotNull(boxPoolDTO.getPolName()), PutBox::getPolCname, boxPoolDTO.getPolName())
|
|
|
- .like(ObjectUtils.isNotNull(boxPoolDTO.getBoxEastId()), PutBox::getBoxEastId, boxPoolDTO.getBoxEastId())
|
|
|
- .like(ObjectUtils.isNotNull(boxPoolDTO.getBoxEastName()), PutBox::getBoxEastName, boxPoolDTO.getBoxEastName())
|
|
|
- .like(ObjectUtils.isNotNull(boxPoolDTO.getStationId()), PutBox::getPolStationId, boxPoolDTO.getStationId());
|
|
|
- if (ObjectUtils.isNotNull(boxPoolDTO.getWhetherLoseEfficacy())) {
|
|
|
- lambdaQueryWrapper.ge(PutBox::getEffectiveStartDate, new Date())
|
|
|
- .le(PutBox::getEffectiveEndDate, new Date());
|
|
|
- }
|
|
|
List<BoxPoolContainerNumberDTO> putBoxList = baseMapper.selectPutBoxPage(page, boxPoolDTO);
|
|
|
if (!putBoxList.isEmpty()) {
|
|
|
List<Long> ids = putBoxList.stream().map(BoxPoolContainerNumberDTO::getId).collect(Collectors.toList());
|
|
|
@@ -553,10 +536,10 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
.in(PutBoxItems::getPid, ids));
|
|
|
for (BoxPoolContainerNumberDTO item : putBoxList) {
|
|
|
if ("OW(拿),OW(放)".contains(item.getBusType())) {
|
|
|
- item.setGood(item.getRemainingNum());
|
|
|
- item.setTotal(item.getRemainingNum());
|
|
|
+ item.setGood(item.getTotalNum());
|
|
|
+ item.setTotal(item.getTotalNum());
|
|
|
item.setOccupyNum(item.getOccupyNum());
|
|
|
- item.setRemainingTotal(item.getTotalNum());
|
|
|
+ item.setRemainingTotal(item.getRemainingNum());
|
|
|
} else {
|
|
|
if (!boxItemsList.isEmpty()) {
|
|
|
List<PutBoxItems> itemsList = boxItemsList.stream().filter(e -> e.getPid().equals(item.getId())).collect(Collectors.toList());
|
|
|
@@ -565,7 +548,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
item.setBad(itemsList.stream().filter(e -> "坏".equals(e.getBoxStatus()) && item.getBoxType().equals(e.getBoxType())).count());
|
|
|
item.setTotal(item.getGood() + item.getBad());
|
|
|
item.setOccupyNum(item.getOccupyNum());
|
|
|
- item.setRemainingTotal(item.getTotal());
|
|
|
+ item.setRemainingTotal(item.getRemainingNum());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -784,10 +767,8 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
//箱档案数据处理
|
|
|
Archives archives = archivesList.stream().filter(e -> e.getCode().equals(item.getBoxCode())).findFirst().orElse(null);
|
|
|
if (archives != null) {
|
|
|
- if ("OW(放)".equals(putBoxData.getBusType())) {
|
|
|
- archives.setContainerNumberOw(item.getContainerNumber());
|
|
|
- archives.setContainerNumberTypeOw("OW(放)");
|
|
|
- }
|
|
|
+ archives.setContainerNumberOw(item.getContainerNumber());
|
|
|
+ archives.setContainerNumberTypeOw(putBoxData.getBusType());
|
|
|
if (!archives.getTypeName().equals(item.getBoxType())) {
|
|
|
throw new RemoteException("箱号:" + item.getBoxCode() + "与箱档案中箱型不符");
|
|
|
}
|
|
|
@@ -823,6 +804,8 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
archives.setBoxBelongsTo("SOC");
|
|
|
archives.setContainerNumber(item.getContainerNumber());
|
|
|
archives.setContainerNumberType(putBoxData.getBusType());
|
|
|
+ archives.setContainerNumberOw(item.getContainerNumber());
|
|
|
+ archives.setContainerNumberTypeOw(putBoxData.getBusType());
|
|
|
archives.setTypeId(cntrTypes.getId());
|
|
|
archives.setTypeName(cntrTypes.getCnName());
|
|
|
archives.setBoxType(putBoxData.getBusType());
|
|
|
@@ -839,11 +822,23 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
if (ObjectUtils.isNotNull(putBoxData.getBoxType()) && !putBoxData.getBoxType().equals(item.getBoxType())) {
|
|
|
throw new RemoteException("放箱号:" + item.getContainerNumber() + "箱型不符合");
|
|
|
}
|
|
|
+ Bills bills = null;
|
|
|
+ if (!containersList.isEmpty()) {
|
|
|
+ List<Containers> containerItemList = containersList.stream().filter(e -> item.getMblno().equals(e.getMblno())
|
|
|
+ && item.getBoxCode().equals(e.getCntrNo())).collect(Collectors.toList());
|
|
|
+ if (!containerItemList.isEmpty()) {
|
|
|
+ List<Long> billsIds = containerItemList.stream().map(Containers::getPid).distinct().collect(Collectors.toList());
|
|
|
+ bills = billsList.stream().filter(e -> "MH".equals(e.getBillType()) && billsIds.contains(e.getId())).findFirst().orElse(null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (bills == null) {
|
|
|
+ throw new RuntimeException("未查到提单号:" + item.getMblno() + "对应海运出口单据");
|
|
|
+ }
|
|
|
//放箱号明细数据处理
|
|
|
PutBoxItems putBoxItem;
|
|
|
if (!putBoxItemsList.isEmpty()) {
|
|
|
putBoxItem = putBoxItemsList.stream().filter(e -> e.getBoxCode().equals(item.getBoxCode()) &&
|
|
|
- e.getPid().equals(putBoxData.getId())).findFirst().orElse(null);
|
|
|
+ e.getPid().equals(putBoxData.getId())).findFirst().orElse(null);
|
|
|
if (putBoxItem != null) {
|
|
|
putBoxItem.setPid(putBoxData.getId());
|
|
|
putBoxItem.setMblno(item.getMblno());
|
|
|
@@ -852,6 +847,15 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
putBoxItem.setPolCyCode(corps.getCode());
|
|
|
putBoxItem.setPolCyCname(corps.getCnName());
|
|
|
putBoxItem.setPolCyEname(corps.getEnName());
|
|
|
+ putBoxItem.setCorpId(bills.getCorpId());
|
|
|
+ putBoxItem.setCorpName(bills.getCorpCnName());
|
|
|
+ putBoxItem.setHblno(bills.getHblno());
|
|
|
+ putBoxItem.setVoyage(bills.getVoyageNo());
|
|
|
+ putBoxItem.setShipNameId(bills.getVesselId());
|
|
|
+ putBoxItem.setShipCname(bills.getVesselCnName());
|
|
|
+ putBoxItem.setShipEname(bills.getVesselEnName());
|
|
|
+ putBoxItem.setPolFreeBoxUseDays(bills.getPolFreeBoxUseDays());
|
|
|
+ putBoxItem.setEtd(bills.getEtd());
|
|
|
putBoxItem.setStatus("使用中");
|
|
|
putBoxItem.setPolStationEmptyContainerExitDate(item.getBoxStatusDate());
|
|
|
} else {
|
|
|
@@ -872,6 +876,15 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
putBoxItem.setPolCyCname(corps.getCnName());
|
|
|
putBoxItem.setPolCyEname(corps.getEnName());
|
|
|
putBoxItem.setPolStationEmptyContainerExitDate(item.getBoxStatusDate());
|
|
|
+ putBoxItem.setCorpId(bills.getCorpId());
|
|
|
+ putBoxItem.setCorpName(bills.getCorpCnName());
|
|
|
+ putBoxItem.setHblno(bills.getHblno());
|
|
|
+ putBoxItem.setVoyage(bills.getVoyageNo());
|
|
|
+ putBoxItem.setShipNameId(bills.getVesselId());
|
|
|
+ putBoxItem.setShipCname(bills.getVesselCnName());
|
|
|
+ putBoxItem.setShipEname(bills.getVesselEnName());
|
|
|
+ putBoxItem.setPolFreeBoxUseDays(bills.getPolFreeBoxUseDays());
|
|
|
+ putBoxItem.setEtd(bills.getEtd());
|
|
|
}
|
|
|
} else {
|
|
|
putBoxItem = new PutBoxItems();
|
|
|
@@ -891,6 +904,15 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
putBoxItem.setPolCyCname(corps.getCnName());
|
|
|
putBoxItem.setPolCyEname(corps.getEnName());
|
|
|
putBoxItem.setPolStationEmptyContainerExitDate(item.getBoxStatusDate());
|
|
|
+ putBoxItem.setCorpId(bills.getCorpId());
|
|
|
+ putBoxItem.setCorpName(bills.getCorpCnName());
|
|
|
+ putBoxItem.setHblno(bills.getHblno());
|
|
|
+ putBoxItem.setVoyage(bills.getVoyageNo());
|
|
|
+ putBoxItem.setShipNameId(bills.getVesselId());
|
|
|
+ putBoxItem.setShipCname(bills.getVesselCnName());
|
|
|
+ putBoxItem.setShipEname(bills.getVesselEnName());
|
|
|
+ putBoxItem.setPolFreeBoxUseDays(bills.getPolFreeBoxUseDays());
|
|
|
+ putBoxItem.setEtd(bills.getEtd());
|
|
|
}
|
|
|
if (ObjectUtils.isNotNull(putBoxData.getBoxEastId()) && !"null".equals(putBoxData.getBoxEastId())) {
|
|
|
putBoxItem.setBoxEastId(Long.parseLong(putBoxData.getBoxEastId()));
|
|
|
@@ -935,6 +957,15 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
tradingBoxItem.setPolStationEmptyContainerExitDate(new Date());
|
|
|
}
|
|
|
tradingBoxItem.setStatus("待使用");
|
|
|
+ tradingBoxItem.setCorpId(bills.getCorpId());
|
|
|
+ tradingBoxItem.setCorpName(bills.getCorpCnName());
|
|
|
+ tradingBoxItem.setHblno(bills.getHblno());
|
|
|
+ tradingBoxItem.setVoyage(bills.getVoyageNo());
|
|
|
+ tradingBoxItem.setShipNameId(bills.getVesselId());
|
|
|
+ tradingBoxItem.setShipCname(bills.getVesselCnName());
|
|
|
+ tradingBoxItem.setShipEname(bills.getVesselEnName());
|
|
|
+ tradingBoxItem.setPolFreeBoxUseDays(bills.getPolFreeBoxUseDays());
|
|
|
+ tradingBoxItem.setEtd(bills.getEtd());
|
|
|
} else {
|
|
|
tradingBoxItem = new TradingBoxItem();
|
|
|
tradingBoxItem.setBoxBelongsTo("SOC");
|
|
|
@@ -972,6 +1003,15 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
tradingBoxItem.setPolStationEmptyContainerExitDate(new Date());
|
|
|
}
|
|
|
tradingBoxItem.setStatus("待使用");
|
|
|
+ tradingBoxItem.setCorpId(bills.getCorpId());
|
|
|
+ tradingBoxItem.setCorpName(bills.getCorpCnName());
|
|
|
+ tradingBoxItem.setHblno(bills.getHblno());
|
|
|
+ tradingBoxItem.setVoyage(bills.getVoyageNo());
|
|
|
+ tradingBoxItem.setShipNameId(bills.getVesselId());
|
|
|
+ tradingBoxItem.setShipCname(bills.getVesselCnName());
|
|
|
+ tradingBoxItem.setShipEname(bills.getVesselEnName());
|
|
|
+ tradingBoxItem.setPolFreeBoxUseDays(bills.getPolFreeBoxUseDays());
|
|
|
+ tradingBoxItem.setEtd(bills.getEtd());
|
|
|
}
|
|
|
} else {
|
|
|
tradingBoxItem = new TradingBoxItem();
|
|
|
@@ -1009,6 +1049,15 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
tradingBoxItem.setPolStationEmptyContainerExitDate(new Date());
|
|
|
}
|
|
|
tradingBoxItem.setStatus("待使用");
|
|
|
+ tradingBoxItem.setCorpId(bills.getCorpId());
|
|
|
+ tradingBoxItem.setCorpName(bills.getCorpCnName());
|
|
|
+ tradingBoxItem.setHblno(bills.getHblno());
|
|
|
+ tradingBoxItem.setVoyage(bills.getVoyageNo());
|
|
|
+ tradingBoxItem.setShipNameId(bills.getVesselId());
|
|
|
+ tradingBoxItem.setShipCname(bills.getVesselCnName());
|
|
|
+ tradingBoxItem.setShipEname(bills.getVesselEnName());
|
|
|
+ tradingBoxItem.setPolFreeBoxUseDays(bills.getPolFreeBoxUseDays());
|
|
|
+ tradingBoxItem.setEtd(bills.getEtd());
|
|
|
}
|
|
|
tradingBoxItem.setBoxEastId(tradingBox.getPurchaseCompanyId());
|
|
|
tradingBoxItem.setBoxEastName(tradingBox.getPurchaseCompanyName());
|
|
|
@@ -1207,7 +1256,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- this.countOverdueFee(tradingBoxList, tradingBoxItems);
|
|
|
+ this.countOverdueFee(tradingBoxList, tradingBoxItems, containersListNew, putBoxItems);
|
|
|
return R.data("操作成功");
|
|
|
}
|
|
|
|
|
|
@@ -1564,21 +1613,24 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
if (!containersListNew.isEmpty()) {
|
|
|
containersService.updateBatchById(containersListNew);
|
|
|
}
|
|
|
- if (!putBoxItemsOldList.isEmpty()) {
|
|
|
+ /*if (!putBoxItemsOldList.isEmpty()) {
|
|
|
putBoxItemsService.updateBatchById(putBoxItemsOldList);
|
|
|
- }
|
|
|
- if (!tradingBoxItemOldList.isEmpty()) {
|
|
|
+ }*/
|
|
|
+ /*if (!tradingBoxItemOldList.isEmpty()) {
|
|
|
tradingBoxItemService.updateBatchById(tradingBoxItemOldList);
|
|
|
- }
|
|
|
+ }*/
|
|
|
//计算超期箱使费
|
|
|
if (!billsList.isEmpty()) {
|
|
|
- this.countOverdueFee(tradingBoxList, tradingBoxItemOldList);
|
|
|
+ this.countOverdueFee(tradingBoxList, tradingBoxItemOldList, containersListNew,putBoxItemsOldList);
|
|
|
}
|
|
|
return R.data("操作成功");
|
|
|
}
|
|
|
|
|
|
- private void countOverdueFee(List<TradingBox> tradingBoxList, List<TradingBoxItem> tradingBoxItemOldList) {
|
|
|
+ private void countOverdueFee(List<TradingBox> tradingBoxList, List<TradingBoxItem> tradingBoxItemOldList,
|
|
|
+ List<Containers> containersListNew, List<PutBoxItems> putBoxItems) {
|
|
|
List<FeeCenter> feeCenterList = new ArrayList<>();
|
|
|
+ List<PutBoxItems> putBoxItemsList = new ArrayList<>();
|
|
|
+ List<TradingBoxItem> tradingBoxItemList = new ArrayList<>();
|
|
|
List<String> mblnoList = tradingBoxItemOldList.stream().map(TradingBoxItem::getMblno).collect(Collectors.toList());
|
|
|
if (!mblnoList.isEmpty()) {
|
|
|
//海运进出口单据
|
|
|
@@ -1586,6 +1638,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
.eq(Bills::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(Bills::getIsDeleted, 0)
|
|
|
.in(Bills::getMblno, mblnoList)
|
|
|
+ .eq(Bills::getBusinessType, "SE")
|
|
|
.apply("find_in_set(bill_type,'DD,MH')")
|
|
|
);
|
|
|
if (billsList.isEmpty()) {
|
|
|
@@ -1634,11 +1687,16 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
if (tradingBox == null) {
|
|
|
throw new RuntimeException("未查到OW单据");
|
|
|
}
|
|
|
- if ("OW-F".equals(tradingBox.getType())){
|
|
|
+ if ("OW-F".equals(tradingBox.getType())) {
|
|
|
continue;
|
|
|
}
|
|
|
+ Containers containers = containersListNew.stream().filter(e -> e.getCntrNo().equals(item.getCode())).findFirst().orElse(null);
|
|
|
+ if (containers == null) {
|
|
|
+ throw new RuntimeException("箱号未在配箱信息中查到");
|
|
|
+ }
|
|
|
//查找OW明细提单号对应海运进出口单据
|
|
|
- Bills bills = billsList.stream().filter(e -> e.getMblno().equals(item.getMblno())).findFirst().orElse(null);
|
|
|
+ Bills bills = billsList.stream().filter(e -> e.getMblno().equals(item.getMblno()) && e.getId().equals(containers.getPid()))
|
|
|
+ .findFirst().orElse(null);
|
|
|
if (bills == null) {
|
|
|
throw new RuntimeException("未查到提单号:" + item.getMblno() + "海运进出口单据");
|
|
|
}
|
|
|
@@ -1670,7 +1728,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
long days = ChronoUnit.DAYS.between(ldt2, ldt1);
|
|
|
//超期天数
|
|
|
int overdueDays = 0;
|
|
|
- if (ObjectUtils.isNull(bills.getPolFreeBoxUseDays()) || 0 == bills.getPolFreeBoxUseDays() ||
|
|
|
+ if (ObjectUtils.isNotNull(bills.getPolFreeBoxUseDays()) || 0 == bills.getPolFreeBoxUseDays() ||
|
|
|
days > bills.getPolFreeBoxUseDays()) {
|
|
|
overdueDays = (int) (days - bills.getPolFreeBoxUseDays());
|
|
|
}
|
|
|
@@ -1681,21 +1739,38 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
FeeCenter feeCenterC = new FeeCenter();
|
|
|
BeanUtil.copyProperties(feeCenter, feeCenterC);
|
|
|
feeCenterC.setDc("C");
|
|
|
- feeCenter.setCorpType("国内直接客户");
|
|
|
- feeCenter.setCorpId(bCorps.getId());
|
|
|
- feeCenter.setCorpCnName(bCorps.getCnName());
|
|
|
- feeCenter.setCorpEnName(bCorps.getEnName());
|
|
|
- feeCenter.setShortName(bCorps.getShortName());
|
|
|
+ feeCenterC.setCorpType("国内直接客户");
|
|
|
+ feeCenterC.setCorpId(bCorps.getId());
|
|
|
+ feeCenterC.setCorpCnName(bCorps.getCnName());
|
|
|
+ feeCenterC.setCorpEnName(bCorps.getEnName());
|
|
|
+ feeCenterC.setShortName(bCorps.getShortName());
|
|
|
feeCenterC.setPrice(feeCenterC.getPrice().multiply(new BigDecimal(overdueProportion))
|
|
|
- .divide(new BigDecimal("100"),2,RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ .divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP));
|
|
|
feeCenterC.setAmount(feeCenterC.getQuantity().multiply(feeCenterC.getPrice()));
|
|
|
feeCenterC.setAmountLoc(feeCenterC.getAmount().multiply(feeCenter.getExrate()));
|
|
|
feeCenterList.add(feeCenterC);
|
|
|
}
|
|
|
+ item.setPolOverdueBoxUseDays(overdueDays);
|
|
|
+ PutBoxItems putBoxItems1 = putBoxItems.stream().filter(e -> e.getBoxCode().equals(item.getCode())).findFirst().orElse(null);
|
|
|
+ if (putBoxItems1 != null) {
|
|
|
+ putBoxItems1.setPolOverdueBoxUseDays(overdueDays);
|
|
|
+ putBoxItemsList.add(putBoxItems1);
|
|
|
+ }
|
|
|
+ tradingBoxItemList.add(item);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ if (!putBoxItemsList.isEmpty()) {
|
|
|
+ putBoxItemsService.saveOrUpdateBatch(putBoxItemsList);
|
|
|
+ } else {
|
|
|
+ putBoxItemsService.saveOrUpdateBatch(putBoxItems);
|
|
|
+ }
|
|
|
+ if (!tradingBoxItemList.isEmpty()) {
|
|
|
+ tradingBoxItemService.saveOrUpdateBatch(tradingBoxItemList);
|
|
|
+ } else {
|
|
|
+ tradingBoxItemService.saveOrUpdateBatch(tradingBoxItemOldList);
|
|
|
+ }
|
|
|
if (!feeCenterList.isEmpty()) {
|
|
|
feeCenterService.saveBatch(feeCenterList);
|
|
|
}
|
|
|
@@ -1735,6 +1810,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
feeCenter.setCreateTime(new Date());
|
|
|
feeCenter.setCreateUser(AuthUtil.getUserId());
|
|
|
feeCenter.setCreateUserName(AuthUtil.getUserName());
|
|
|
+ feeCenter.setPaymode(bills.getMpaymode());
|
|
|
feeCenter.setPid(bills.getId());
|
|
|
feeCenter.setDc("D");
|
|
|
feeCenter.setFeeId(fees.getId());
|
|
|
@@ -2569,10 +2645,8 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
//箱档案数据处理
|
|
|
Archives archives = archivesList.stream().filter(e -> e.getCode().equals(item.getBoxCode())).findFirst().orElse(null);
|
|
|
if (archives != null) {
|
|
|
- if ("OW(放)".equals(putBox.getBusType())) {
|
|
|
- archives.setContainerNumberOw(item.getContainerNumber());
|
|
|
- archives.setContainerNumberTypeOw("OW(放)");
|
|
|
- }
|
|
|
+ archives.setContainerNumberOw(item.getContainerNumber());
|
|
|
+ archives.setContainerNumberTypeOw(putBox.getBusType());
|
|
|
if (!archives.getTypeName().equals(item.getBoxType())) {
|
|
|
throw new RemoteException("箱号:" + item.getBoxCode() + "与箱档案中箱型不符");
|
|
|
}
|
|
|
@@ -2608,6 +2682,8 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
archives.setBoxBelongsTo("SOC");
|
|
|
archives.setContainerNumber(item.getContainerNumber());
|
|
|
archives.setContainerNumberType(putBox.getBusType());
|
|
|
+ archives.setContainerNumberOw(item.getContainerNumber());
|
|
|
+ archives.setContainerNumberTypeOw(putBox.getBusType());
|
|
|
archives.setTypeId(cntrTypes.getId());
|
|
|
archives.setTypeName(cntrTypes.getCnName());
|
|
|
archives.setBoxType(putBox.getBusType());
|
|
|
@@ -2630,8 +2706,8 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
putBoxItem = putBoxItemsList.stream().filter(e -> e.getBoxCode().equals(item.getBoxCode()))
|
|
|
.findFirst().orElse(null);
|
|
|
if (putBoxItem != null) {
|
|
|
- throw new RemoteException("箱号:" + item.getBoxCode() + "在放箱号:" + item.getContainerNumber() + "单据中已存在,不能重复导入");
|
|
|
- /*putBoxItem.setPid(putBox.getId());
|
|
|
+// throw new RemoteException("箱号:" + item.getBoxCode() + "在放箱号:" + item.getContainerNumber() + "单据中已存在,不能重复导入");
|
|
|
+ putBoxItem.setPid(putBox.getId());
|
|
|
putBoxItem.setMblno(item.getMblno());
|
|
|
putBoxItem.setBoxDynamics("空箱提箱进场");
|
|
|
putBoxItem.setPolCyId(corps.getId());
|
|
|
@@ -2639,7 +2715,8 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
putBoxItem.setPolCyCname(corps.getCnName());
|
|
|
putBoxItem.setPolCyEname(corps.getEnName());
|
|
|
putBoxItem.setStatus("待使用");
|
|
|
- putBoxItem.setPolPickUpDate(item.getBoxStatusDate());*/
|
|
|
+ putBoxItem.setPolPickUpDate(item.getBoxStatusDate());
|
|
|
+ putBoxItem.setPolPreAppearanceDate(item.getBoxStatusDate());
|
|
|
} else {
|
|
|
putBoxItem = new PutBoxItems();
|
|
|
putBoxItem.setBoxClass(putBox.getBusType());
|
|
|
@@ -2658,6 +2735,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
putBoxItem.setPolCyCname(corps.getCnName());
|
|
|
putBoxItem.setPolCyEname(corps.getEnName());
|
|
|
putBoxItem.setPolPickUpDate(item.getBoxStatusDate());
|
|
|
+ putBoxItem.setPolPreAppearanceDate(item.getBoxStatusDate());
|
|
|
}
|
|
|
} else {
|
|
|
putBoxItem = new PutBoxItems();
|
|
|
@@ -2677,6 +2755,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
putBoxItem.setPolCyCname(corps.getCnName());
|
|
|
putBoxItem.setPolCyEname(corps.getEnName());
|
|
|
putBoxItem.setPolPickUpDate(item.getBoxStatusDate());
|
|
|
+ putBoxItem.setPolPreAppearanceDate(item.getBoxStatusDate());
|
|
|
}
|
|
|
if (ObjectUtils.isNotNull(putBox.getBoxEastId()) && !"null".equals(putBox.getBoxEastId())) {
|
|
|
putBoxItem.setBoxEastId(Long.parseLong(putBox.getBoxEastId()));
|
|
|
@@ -2700,8 +2779,8 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
tradingBoxItem = tradingBoxItemList.stream().filter(e -> e.getCode().equals(item.getBoxCode()))
|
|
|
.findFirst().orElse(null);
|
|
|
if (tradingBoxItem != null) {
|
|
|
- throw new RemoteException("箱号:" + item.getBoxCode() + "在放箱号:" + item.getContainerNumber() + "单据中已存在,不能重复导入");
|
|
|
- /*tradingBoxItem.setPid(tradingBox.getId());
|
|
|
+// throw new RemoteException("箱号:" + item.getBoxCode() + "在放箱号:" + item.getContainerNumber() + "单据中已存在,不能重复导入");
|
|
|
+ tradingBoxItem.setPid(tradingBox.getId());
|
|
|
tradingBoxItem.setMblno(item.getMblno());
|
|
|
tradingBoxItem.setBoxDynamics("空箱提箱进场");
|
|
|
tradingBoxItem.setPortId(ports.getId());
|
|
|
@@ -2719,11 +2798,13 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
if (ObjectUtils.isNotNull(item.getBoxStatusDate())) {
|
|
|
tradingBoxItem.setRentEndDate(item.getBoxStatusDate());
|
|
|
tradingBoxItem.setPolPickUpDate(item.getBoxStatusDate());
|
|
|
+ tradingBoxItem.setPolPreAppearanceDate(item.getBoxStatusDate());
|
|
|
} else {
|
|
|
tradingBoxItem.setRentEndDate(new Date());
|
|
|
tradingBoxItem.setPolPickUpDate(new Date());
|
|
|
+ tradingBoxItem.setPolPreAppearanceDate(new Date());
|
|
|
}
|
|
|
- tradingBoxItem.setStatus("待使用");*/
|
|
|
+ tradingBoxItem.setStatus("待使用");
|
|
|
} else {
|
|
|
tradingBoxItem = new TradingBoxItem();
|
|
|
tradingBoxItem.setBoxBelongsTo("SOC");
|
|
|
@@ -2758,9 +2839,11 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
if (ObjectUtils.isNotNull(item.getBoxStatusDate())) {
|
|
|
tradingBoxItem.setRentEndDate(item.getBoxStatusDate());
|
|
|
tradingBoxItem.setPolPickUpDate(item.getBoxStatusDate());
|
|
|
+ tradingBoxItem.setPolPreAppearanceDate(item.getBoxStatusDate());
|
|
|
} else {
|
|
|
tradingBoxItem.setRentEndDate(new Date());
|
|
|
tradingBoxItem.setPolPickUpDate(new Date());
|
|
|
+ tradingBoxItem.setPolPreAppearanceDate(new Date());
|
|
|
}
|
|
|
tradingBoxItem.setStatus("待使用");
|
|
|
}
|
|
|
@@ -2797,9 +2880,11 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
if (ObjectUtils.isNotNull(item.getBoxStatusDate())) {
|
|
|
tradingBoxItem.setRentEndDate(item.getBoxStatusDate());
|
|
|
tradingBoxItem.setPolPickUpDate(item.getBoxStatusDate());
|
|
|
+ tradingBoxItem.setPolPreAppearanceDate(item.getBoxStatusDate());
|
|
|
} else {
|
|
|
tradingBoxItem.setRentEndDate(new Date());
|
|
|
tradingBoxItem.setPolPickUpDate(new Date());
|
|
|
+ tradingBoxItem.setPolPreAppearanceDate(new Date());
|
|
|
}
|
|
|
tradingBoxItem.setStatus("待使用");
|
|
|
}
|
|
|
@@ -3018,7 +3103,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
.in(Containers::getPid, idHYJKList)
|
|
|
.in(Containers::getCntrNo, boxNum));
|
|
|
List<Containers> containersListNew = new ArrayList<>();
|
|
|
- for (Bills billsHYJK : billsHYJKListFD){
|
|
|
+ for (Bills billsHYJK : billsHYJKListFD) {
|
|
|
//目的港生成新放箱号单据
|
|
|
List<PutBox> putBoxNewList = new ArrayList<>();
|
|
|
//目的港生成新放箱号单据明细数据
|
|
|
@@ -3031,13 +3116,18 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
List<Archives> archivesArrayList = new ArrayList<>();
|
|
|
//OW(拿)、代理箱-箱档案数据删除
|
|
|
List<Long> archivesDateleList = new ArrayList<>();
|
|
|
- List<Containers> containersList = containersHYJKList.stream().filter(e-> e.getPid().equals(billsHYJK.getId()))
|
|
|
+ List<Containers> containersList = containersHYJKList.stream().filter(e -> e.getPid().equals(billsHYJK.getId()))
|
|
|
.collect(Collectors.toList());
|
|
|
for (Containers item : containersList) {
|
|
|
+ if (ObjectUtils.isNull(item.getHblno())) {
|
|
|
+ throw new RuntimeException("分单号不能为空");
|
|
|
+ }
|
|
|
item.setPodStationId(podStationR.getPodStationId());
|
|
|
item.setPodStationCname(podStationR.getPodStationCname());
|
|
|
item.setPodStationEname(podStationR.getPodStationEname());
|
|
|
item.setPodStationCode(podStationR.getPodStationCode());
|
|
|
+ item.setPodEmptyContainerReturnDate(podStationR.getReturnEmptyTime());
|
|
|
+ item.setWhetherFee("1");
|
|
|
item.setUpdateTime(new Date());
|
|
|
item.setUpdateUser(AuthUtil.getUserId());
|
|
|
item.setUpdateUserName(AuthUtil.getUserName());
|
|
|
@@ -3051,9 +3141,11 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
containers.setPodStationCname(podStationR.getPodStationCname());
|
|
|
containers.setPodStationEname(podStationR.getPodStationEname());
|
|
|
containers.setPodStationCode(podStationR.getPodStationCode());
|
|
|
+ containers.setPodEmptyContainerReturnDate(podStationR.getReturnEmptyTime());
|
|
|
containers.setUpdateTime(new Date());
|
|
|
containers.setUpdateUser(AuthUtil.getUserId());
|
|
|
containers.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ item.setWhetherFee("1");
|
|
|
containersListNew.add(containers);
|
|
|
}
|
|
|
}
|
|
|
@@ -3094,6 +3186,8 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
putBoxItem.setPodStationCname(podStationR.getPodStationEname());
|
|
|
putBoxItem.setPodStationEname(podStationR.getPodStationCode());
|
|
|
putBoxItem.setPodEmptyContainerReturnDate(podStationR.getReturnEmptyTime());
|
|
|
+ putBoxItem.setPodFreeBoxUseDays(billsHYJK.getPodFreeBoxUseDays());
|
|
|
+ putBoxItem.setEta(billsHYJK.getEta());
|
|
|
putBoxItem.setStatus("待使用");
|
|
|
putBoxItem.setBoxDynamics("空箱进场");
|
|
|
putBoxItemsOldList.add(putBoxItem);
|
|
|
@@ -3129,6 +3223,8 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
tradingBoxItem.setStationCode(podStationR.getPodStationCname());
|
|
|
tradingBoxItem.setStationCname(podStationR.getPodStationEname());
|
|
|
tradingBoxItem.setStationEname(podStationR.getPodStationCode());
|
|
|
+ tradingBoxItem.setPodFreeBoxUseDays(billsHYJK.getPodFreeBoxUseDays());
|
|
|
+ tradingBoxItem.setEta(billsHYJK.getEta());
|
|
|
tradingBoxItemOldList.add(tradingBoxItem);
|
|
|
} else {
|
|
|
throw new RuntimeException("未查到原OW单据-放箱号:" + archives.getContainerNumber() + "中箱号是:" + item.getCntrNo() + "数据");
|
|
|
@@ -3266,6 +3362,8 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
putBoxItem.setPodStationCname(podStationR.getPodStationEname());
|
|
|
putBoxItem.setPodStationEname(podStationR.getPodStationCode());
|
|
|
putBoxItem.setPodEmptyContainerReturnDate(podStationR.getReturnEmptyTime());
|
|
|
+ putBoxItem.setPodFreeBoxUseDays(billsHYJK.getPodFreeBoxUseDays());
|
|
|
+ putBoxItem.setEta(billsHYJK.getEta());
|
|
|
putBoxItem.setStatus("待使用");
|
|
|
putBoxItem.setBoxDynamics("空箱进场");
|
|
|
putBoxItemsOldList.add(putBoxItem);
|
|
|
@@ -3300,6 +3398,8 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
tradingBoxItem.setStationCode(podStationR.getPodStationCname());
|
|
|
tradingBoxItem.setStationCname(podStationR.getPodStationEname());
|
|
|
tradingBoxItem.setStationEname(podStationR.getPodStationCode());
|
|
|
+ tradingBoxItem.setPodFreeBoxUseDays(billsHYJK.getPodFreeBoxUseDays());
|
|
|
+ tradingBoxItem.setEta(billsHYJK.getEta());
|
|
|
tradingBoxItemOldList.add(tradingBoxItem);
|
|
|
} else {
|
|
|
throw new RuntimeException("未查到原OW单据-放箱号:" + archives.getContainerNumber() + "中箱号是:" + item.getCntrNo() + "数据");
|
|
|
@@ -3325,9 +3425,9 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
if (!putBoxItemsOldList.isEmpty()) {
|
|
|
putBoxItemsService.updateBatchById(putBoxItemsOldList);
|
|
|
}
|
|
|
- if (!tradingBoxItemOldList.isEmpty()) {
|
|
|
+ /*if (!tradingBoxItemOldList.isEmpty()) {
|
|
|
tradingBoxItemService.updateBatchById(tradingBoxItemOldList);
|
|
|
- }
|
|
|
+ }*/
|
|
|
if (!archivesArrayList.isEmpty()) {
|
|
|
archivesService.updateBatchById(archivesArrayList);
|
|
|
}
|
|
|
@@ -3461,7 +3561,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
}
|
|
|
}
|
|
|
//计算超期箱使费
|
|
|
- this.countOverdueFeeV1(billsHYJK, tradingBoxList, tradingBoxItemOldList);
|
|
|
+ this.countOverdueFeeV1(billsHYJK, tradingBoxList, tradingBoxItemOldList,putBoxItemsOldList);
|
|
|
}
|
|
|
} else {
|
|
|
for (Containers item : containersHYJKList) {
|
|
|
@@ -3509,6 +3609,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public R emptyContainerEntryAnalysis(MultipartFile file) throws IOException {
|
|
|
List<EmptyContainerAppearanceAnalysis> analysisList = new ArrayList<>();
|
|
|
//导入数据
|
|
|
@@ -3716,6 +3817,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public R emptyContainerAppearanceAnalysis(MultipartFile file) throws IOException {
|
|
|
List<EmptyContainerAppearanceAnalysis> analysisList = new ArrayList<>();
|
|
|
//导入数据
|
|
|
@@ -3764,6 +3866,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
billsList = billsMapper.selectList(new LambdaQueryWrapper<Bills>()
|
|
|
.eq(Bills::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(Bills::getIsDeleted, 0)
|
|
|
+ .eq(Bills::getBusinessType, "SE")
|
|
|
.in(Bills::getMblno, mblno));
|
|
|
if (!billsList.isEmpty()) {
|
|
|
containersList = containersService.list(new LambdaQueryWrapper<Containers>()
|
|
|
@@ -5031,13 +5134,16 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
}
|
|
|
}
|
|
|
//计算超期箱使费
|
|
|
- this.countOverdueFeeV1(billsHYJK, tradingBoxList, tradingBoxItemOldList);
|
|
|
+ this.countOverdueFeeV1(billsHYJK, tradingBoxList, tradingBoxItemOldList,putBoxItemsOldList);
|
|
|
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- private void countOverdueFeeV1(Bills billsHYJK, List<TradingBox> tradingBoxList, List<TradingBoxItem> tradingBoxItemOldList) {
|
|
|
+ private void countOverdueFeeV1(Bills billsHYJK, List<TradingBox> tradingBoxList,
|
|
|
+ List<TradingBoxItem> tradingBoxItemOldList,List<PutBoxItems> putBoxItemsOldList) {
|
|
|
List<FeeCenter> feeCenterList = new ArrayList<>();
|
|
|
+ List<PutBoxItems> putBoxItemsList = new ArrayList<>();
|
|
|
+ List<TradingBoxItem> tradingBoxItemList = new ArrayList<>();
|
|
|
//超期标准
|
|
|
List<StorageFees> storageFeesList = storageFeesService.list(new LambdaQueryWrapper<StorageFees>()
|
|
|
.eq(StorageFees::getTenantId, AuthUtil.getTenantId())
|
|
|
@@ -5103,7 +5209,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
long days = ChronoUnit.DAYS.between(ldt2, ldt1);
|
|
|
//超期天数
|
|
|
int overdueDays = 0;
|
|
|
- if (ObjectUtils.isNull(billsHYJK.getPodFreeBoxUseDays()) || 0 == billsHYJK.getPodFreeBoxUseDays() ||
|
|
|
+ if (ObjectUtils.isNotNull(billsHYJK.getPodFreeBoxUseDays()) || 0 == billsHYJK.getPodFreeBoxUseDays() ||
|
|
|
days > billsHYJK.getPodFreeBoxUseDays()) {
|
|
|
overdueDays = (int) (days - billsHYJK.getPodFreeBoxUseDays());
|
|
|
}
|
|
|
@@ -5120,14 +5226,31 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
|
|
|
feeCenterC.setCorpEnName(bCorps.getEnName());
|
|
|
feeCenterC.setShortName(bCorps.getShortName());
|
|
|
feeCenterC.setPrice(feeCenterC.getPrice().multiply(new BigDecimal(overdueProportion))
|
|
|
- .divide(new BigDecimal("100"),2,RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ .divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP));
|
|
|
feeCenterC.setAmount(feeCenterC.getQuantity().multiply(feeCenterC.getPrice()));
|
|
|
feeCenterC.setAmountLoc(feeCenterC.getAmount().multiply(feeCenter.getExrate()));
|
|
|
feeCenterList.add(feeCenterC);
|
|
|
}
|
|
|
+ item.setPodBoxUseDays(overdueDays);
|
|
|
+ PutBoxItems putBoxItems1 = putBoxItemsOldList.stream().filter(e -> e.getBoxCode().equals(item.getCode())).findFirst().orElse(null);
|
|
|
+ if (putBoxItems1 != null) {
|
|
|
+ putBoxItems1.setPodBoxUseDays(overdueDays);
|
|
|
+ putBoxItemsList.add(putBoxItems1);
|
|
|
+ }
|
|
|
+ tradingBoxItemList.add(item);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ if (!putBoxItemsList.isEmpty()) {
|
|
|
+ putBoxItemsService.saveOrUpdateBatch(putBoxItemsList);
|
|
|
+ } else {
|
|
|
+ putBoxItemsService.saveOrUpdateBatch(putBoxItemsOldList);
|
|
|
+ }
|
|
|
+ if (!tradingBoxItemList.isEmpty()) {
|
|
|
+ tradingBoxItemService.saveOrUpdateBatch(tradingBoxItemList);
|
|
|
+ } else {
|
|
|
+ tradingBoxItemService.saveOrUpdateBatch(tradingBoxItemOldList);
|
|
|
+ }
|
|
|
if (!feeCenterList.isEmpty()) {
|
|
|
feeCenterService.saveBatch(feeCenterList);
|
|
|
}
|