|
|
@@ -747,6 +747,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
List<PjOrderItems> pjOrderItemsList = new ArrayList<>();
|
|
|
List<PjStockDesc> pjStockDescArrayList = new ArrayList<>();
|
|
|
String status = sysClient.getParamService("whether.financing");
|
|
|
+ String financingBrand = sysClient.getParamService("financing.brand");
|
|
|
if (CollectionUtils.isNotEmpty(ship.getShipItemsList())) {
|
|
|
List<Long> goodIds = ship.getShipItemsList().stream().map(PjShipItems::getGoodsId).distinct().collect(Collectors.toList());
|
|
|
List<PjGoodsDesc> pjGoodsDescList = goodsDescMapper.selectList(new LambdaQueryWrapper<PjGoodsDesc>()
|
|
|
@@ -938,8 +939,8 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
.orderByAsc(PjOrder::getBusinesDate)
|
|
|
);
|
|
|
List<Long> ordIds = orderList.stream().map(PjOrder::getId).collect(Collectors.toList());
|
|
|
- List<Long> goodsList = shipItemsList.stream().map(PjShipItems::getGoodsId).filter(Objects::nonNull)
|
|
|
- .distinct().collect(Collectors.toList());
|
|
|
+ List<Long> goodsList = shipItemsList.stream().filter(e -> ObjectUtils.isNotNull(financingBrand) && financingBrand.contains(e.getBrandName()))
|
|
|
+ .map(PjShipItems::getGoodsId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
List<PjOrderItems> orderItemsList = orderItemsService.list(new LambdaQueryWrapper<PjOrderItems>()
|
|
|
.eq(PjOrderItems::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(PjOrderItems::getIsDeleted, 0)
|
|
|
@@ -951,12 +952,12 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
);
|
|
|
if (!orderItemsList.isEmpty()) {
|
|
|
List<PjOrder> orders = orderList.stream().filter(e -> e.getWhetherRedeem().equals("0")).distinct().collect(Collectors.toList());
|
|
|
- if (!orders.isEmpty()){
|
|
|
+ if (!orders.isEmpty()) {
|
|
|
if (pjpfFunding.getBondAmount().compareTo(pjpfFunding.getPaidAlreadyBondAmount()) > 0) {
|
|
|
throw new RuntimeException("已缴保证金不足,出库失败");
|
|
|
}
|
|
|
- BigDecimal amount = shipItemsList.stream().map(PjShipItems::getCostprie)
|
|
|
- .filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ BigDecimal amount = shipItemsList.stream().filter(e -> ObjectUtils.isNotNull(financingBrand) && financingBrand.contains(e.getBrandName()))
|
|
|
+ .map(PjShipItems::getCostprie).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
if (pjpfFunding.getAvailableAmount().compareTo(amount) < 0) {
|
|
|
throw new RuntimeException("剩余可用资金:" + pjpfFunding.getAvailableAmount() + "小于本次出库金额:" + amount + ",出库失败");
|
|
|
}
|
|
|
@@ -979,64 +980,66 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
List<FinancingShipItemDto> allList = new ArrayList<>();
|
|
|
List<ShipItemsRecord> recordList = new ArrayList<>();
|
|
|
for (PjShipItems shipItems : shipItemsList) {
|
|
|
- BigDecimal number = shipItems.getSendNum();
|
|
|
- List<PjOrderItems> orderItemList = orderItemsList.stream().filter(e -> e.getGoodsId().equals(shipItems.getGoodsId())).collect(Collectors.toList());
|
|
|
- List<FinancingShipItemDto> mapList = new ArrayList<>();
|
|
|
- for (PjOrderItems orderItems1 : orderItemList) {
|
|
|
- if (number.compareTo(new BigDecimal("0.00")) > 0) {
|
|
|
- ShipItemsRecord shipItemsRecord = new ShipItemsRecord();
|
|
|
- shipItemsRecord.setBillNo(ship.getBillno());
|
|
|
- shipItemsRecord.setPid(shipItems.getPid());
|
|
|
- shipItemsRecord.setItemId(shipItems.getId());
|
|
|
- shipItemsRecord.setSrcId(orderItems1.getPid());
|
|
|
- shipItemsRecord.setSrcItemId(orderItems1.getId());
|
|
|
- shipItemsRecord.setSrcOrd(orderItems1.getBillNo());
|
|
|
- shipItemsRecord.setCreateUser(AuthUtil.getUserId());
|
|
|
- shipItemsRecord.setCreateUserName(AuthUtil.getUserName());
|
|
|
- shipItemsRecord.setCreateTime(new Date());
|
|
|
- FinancingShipItemDto financingShipItemDto = new FinancingShipItemDto();
|
|
|
- financingShipItemDto.setId(orderItems1.getId());
|
|
|
- financingShipItemDto.setPid(orderItems1.getPid());
|
|
|
- financingShipItemDto.setItemId(shipItems.getId());
|
|
|
- BigDecimal subNum = orderItems1.getSendNum().subtract(orderItems1.getOutGoodsTotalShipNum());
|
|
|
- if (number.compareTo(subNum) > 0) {
|
|
|
- financingShipItemDto.setNum(subNum);
|
|
|
- financingShipItemDto.setAmount(subNum.multiply(orderItems1.getPrice()));
|
|
|
- shipItemsRecord.setNum(subNum);
|
|
|
- shipItemsRecord.setAmount(subNum.multiply(orderItems1.getPrice()));
|
|
|
- orderItems1.setOutGoodsTotalShipNum(orderItems1.getSendNum());
|
|
|
- orderItems1.setOutGoodsTotalShipAmount(orderItems1.getOutGoodsTotalShipNum().multiply(orderItems1.getPrice()));
|
|
|
- number = number.subtract(subNum);
|
|
|
- } else if (number.compareTo(subNum) == 0) {
|
|
|
- financingShipItemDto.setNum(subNum);
|
|
|
- financingShipItemDto.setAmount(subNum.multiply(orderItems1.getPrice()));
|
|
|
- shipItemsRecord.setNum(subNum);
|
|
|
- shipItemsRecord.setAmount(subNum.multiply(orderItems1.getPrice()));
|
|
|
- orderItems1.setOutGoodsTotalShipNum(orderItems1.getSendNum());
|
|
|
- orderItems1.setOutGoodsTotalShipAmount(orderItems1.getOutGoodsTotalShipNum().multiply(orderItems1.getPrice()));
|
|
|
- number = new BigDecimal("0.00");
|
|
|
- } else {
|
|
|
- financingShipItemDto.setNum(number);
|
|
|
- financingShipItemDto.setAmount(number.multiply(orderItems1.getPrice()));
|
|
|
- shipItemsRecord.setNum(number);
|
|
|
- shipItemsRecord.setAmount(number.multiply(orderItems1.getPrice()));
|
|
|
- orderItems1.setOutGoodsTotalShipNum(orderItems1.getOutGoodsTotalShipNum().add(number));
|
|
|
- orderItems1.setOutGoodsTotalShipAmount(orderItems1.getOutGoodsTotalShipNum().multiply(orderItems1.getPrice()));
|
|
|
- number = new BigDecimal("0.00");
|
|
|
+ if (ObjectUtils.isNotNull(financingBrand) && financingBrand.contains(shipItems.getBrandName())) {
|
|
|
+ BigDecimal number = shipItems.getSendNum();
|
|
|
+ List<PjOrderItems> orderItemList = orderItemsList.stream().filter(e -> e.getGoodsId().equals(shipItems.getGoodsId())).collect(Collectors.toList());
|
|
|
+ List<FinancingShipItemDto> mapList = new ArrayList<>();
|
|
|
+ for (PjOrderItems orderItems1 : orderItemList) {
|
|
|
+ if (number.compareTo(new BigDecimal("0.00")) > 0) {
|
|
|
+ ShipItemsRecord shipItemsRecord = new ShipItemsRecord();
|
|
|
+ shipItemsRecord.setBillNo(ship.getBillno());
|
|
|
+ shipItemsRecord.setPid(shipItems.getPid());
|
|
|
+ shipItemsRecord.setItemId(shipItems.getId());
|
|
|
+ shipItemsRecord.setSrcId(orderItems1.getPid());
|
|
|
+ shipItemsRecord.setSrcItemId(orderItems1.getId());
|
|
|
+ shipItemsRecord.setSrcOrd(orderItems1.getBillNo());
|
|
|
+ shipItemsRecord.setCreateUser(AuthUtil.getUserId());
|
|
|
+ shipItemsRecord.setCreateUserName(AuthUtil.getUserName());
|
|
|
+ shipItemsRecord.setCreateTime(new Date());
|
|
|
+ FinancingShipItemDto financingShipItemDto = new FinancingShipItemDto();
|
|
|
+ financingShipItemDto.setId(orderItems1.getId());
|
|
|
+ financingShipItemDto.setPid(orderItems1.getPid());
|
|
|
+ financingShipItemDto.setItemId(shipItems.getId());
|
|
|
+ BigDecimal subNum = orderItems1.getSendNum().subtract(orderItems1.getOutGoodsTotalShipNum());
|
|
|
+ if (number.compareTo(subNum) > 0) {
|
|
|
+ financingShipItemDto.setNum(subNum);
|
|
|
+ financingShipItemDto.setAmount(subNum.multiply(orderItems1.getPrice()));
|
|
|
+ shipItemsRecord.setNum(subNum);
|
|
|
+ shipItemsRecord.setAmount(subNum.multiply(orderItems1.getPrice()));
|
|
|
+ orderItems1.setOutGoodsTotalShipNum(orderItems1.getSendNum());
|
|
|
+ orderItems1.setOutGoodsTotalShipAmount(orderItems1.getOutGoodsTotalShipNum().multiply(orderItems1.getPrice()));
|
|
|
+ number = number.subtract(subNum);
|
|
|
+ } else if (number.compareTo(subNum) == 0) {
|
|
|
+ financingShipItemDto.setNum(subNum);
|
|
|
+ financingShipItemDto.setAmount(subNum.multiply(orderItems1.getPrice()));
|
|
|
+ shipItemsRecord.setNum(subNum);
|
|
|
+ shipItemsRecord.setAmount(subNum.multiply(orderItems1.getPrice()));
|
|
|
+ orderItems1.setOutGoodsTotalShipNum(orderItems1.getSendNum());
|
|
|
+ orderItems1.setOutGoodsTotalShipAmount(orderItems1.getOutGoodsTotalShipNum().multiply(orderItems1.getPrice()));
|
|
|
+ number = new BigDecimal("0.00");
|
|
|
+ } else {
|
|
|
+ financingShipItemDto.setNum(number);
|
|
|
+ financingShipItemDto.setAmount(number.multiply(orderItems1.getPrice()));
|
|
|
+ shipItemsRecord.setNum(number);
|
|
|
+ shipItemsRecord.setAmount(number.multiply(orderItems1.getPrice()));
|
|
|
+ orderItems1.setOutGoodsTotalShipNum(orderItems1.getOutGoodsTotalShipNum().add(number));
|
|
|
+ orderItems1.setOutGoodsTotalShipAmount(orderItems1.getOutGoodsTotalShipNum().multiply(orderItems1.getPrice()));
|
|
|
+ number = new BigDecimal("0.00");
|
|
|
+ }
|
|
|
+ mapList.add(financingShipItemDto);
|
|
|
+ recordList.add(shipItemsRecord);
|
|
|
}
|
|
|
- mapList.add(financingShipItemDto);
|
|
|
- recordList.add(shipItemsRecord);
|
|
|
}
|
|
|
- }
|
|
|
- if (!mapList.isEmpty()) {
|
|
|
- ObjectMapper mapper = new ObjectMapper();
|
|
|
- try {
|
|
|
- String jsonString = mapper.writeValueAsString(mapList);
|
|
|
- shipItems.setSrcFinancing(jsonString);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
+ if (!mapList.isEmpty()) {
|
|
|
+ ObjectMapper mapper = new ObjectMapper();
|
|
|
+ try {
|
|
|
+ String jsonString = mapper.writeValueAsString(mapList);
|
|
|
+ shipItems.setSrcFinancing(jsonString);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ allList.addAll(mapList);
|
|
|
}
|
|
|
- allList.addAll(mapList);
|
|
|
}
|
|
|
}
|
|
|
if (!recordList.isEmpty()) {
|
|
|
@@ -1067,8 +1070,10 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
if (currentDate.compareTo(thirtyDayAgo) > 0) {
|
|
|
if (!shipItemsList.isEmpty()) {
|
|
|
for (PjShipItems shipItems1 : shipItemsList) {
|
|
|
- if (!itemIdList.isEmpty() && itemIdList.contains(shipItems1.getId())) {
|
|
|
- shipItems1.setProportion(firstProportion);
|
|
|
+ if (ObjectUtils.isNotNull(financingBrand) && financingBrand.contains(shipItems1.getBrandName())) {
|
|
|
+ if (!itemIdList.isEmpty() && itemIdList.contains(shipItems1.getId())) {
|
|
|
+ shipItems1.setProportion(firstProportion);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1127,10 +1132,12 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
.setScale(2, RoundingMode.HALF_UP));
|
|
|
pjpfFundingService.updateById(pjpfFunding);
|
|
|
for (PjShipItems shipItems : shipItemsList) {
|
|
|
- List<PjOrderItems> orderItems = pjOrderItemsList.stream().filter(e -> e.getId().equals(shipItems.getSrcItemId())).collect(Collectors.toList());
|
|
|
- for (PjOrderItems items : orderItems) {
|
|
|
- items.setProportion(shipItems.getProportion());
|
|
|
- items.setSrcFinancing(shipItems.getSrcFinancing());
|
|
|
+ if (ObjectUtils.isNotNull(financingBrand) && financingBrand.contains(shipItems.getBrandName())) {
|
|
|
+ List<PjOrderItems> orderItems = pjOrderItemsList.stream().filter(e -> e.getId().equals(shipItems.getSrcItemId())).collect(Collectors.toList());
|
|
|
+ for (PjOrderItems items : orderItems) {
|
|
|
+ items.setProportion(shipItems.getProportion());
|
|
|
+ items.setSrcFinancing(shipItems.getSrcFinancing());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1159,6 +1166,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
List<PjOrderItems> pjOrderItemsList = new ArrayList<>();
|
|
|
List<PjStockDesc> pjStockDescArrayList = new ArrayList<>();
|
|
|
String status = sysClient.getParamService("whether.financing");
|
|
|
+ String financingBrand = sysClient.getParamService("financing.brand");
|
|
|
if (CollectionUtils.isNotEmpty(ship.getShipItemsList())) {
|
|
|
List<Long> goodIds = ship.getShipItemsList().stream().map(PjShipItems::getGoodsId).distinct().collect(Collectors.toList());
|
|
|
List<PjGoodsDesc> pjGoodsDescList = goodsDescMapper.selectList(new LambdaQueryWrapper<PjGoodsDesc>()
|
|
|
@@ -1327,8 +1335,8 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
if (pjpfFunding == null) {
|
|
|
throw new RuntimeException("未找到融资总账");
|
|
|
}
|
|
|
- List<String> srcFinancingList = itemsList.stream().map(PjShipItems::getSrcFinancing).filter(Objects::nonNull)
|
|
|
- .distinct().collect(Collectors.toList());
|
|
|
+ List<String> srcFinancingList = itemsList.stream().filter(e -> ObjectUtils.isNotNull(financingBrand) && financingBrand.contains(e.getBrandName()))
|
|
|
+ .map(PjShipItems::getSrcFinancing).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
List<FinancingShipItemDto> financingShipItemDtoList = new ArrayList<>();
|
|
|
for (String item : srcFinancingList) {
|
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
|
@@ -1364,8 +1372,8 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
}
|
|
|
}
|
|
|
orderItemsService.updateBatchById(orderItemsList);
|
|
|
- BigDecimal amount = itemsList.stream().map(PjShipItems::getCostprie)
|
|
|
- .filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ BigDecimal amount = itemsList.stream().filter(e -> ObjectUtils.isNotNull(financingBrand) && financingBrand.contains(e.getBrandName()))
|
|
|
+ .map(PjShipItems::getCostprie).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
pjpfFunding.setAvailableAmount(pjpfFunding.getAvailableAmount().add(amount));
|
|
|
PjpfFundingItem item = new PjpfFundingItem();
|
|
|
item.setPid(pjpfFunding.getId());
|
|
|
@@ -1474,7 +1482,9 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
if (currentDate.compareTo(thirtyDayAgo) > 0) {
|
|
|
if (!shipItems.isEmpty()) {
|
|
|
for (PjShipItems shipItems1 : itemsList) {
|
|
|
- shipItems1.setProportion(firstProportion);
|
|
|
+ if (ObjectUtils.isNotNull(financingBrand) && financingBrand.contains(shipItems1.getBrandName())) {
|
|
|
+ shipItems1.setProportion(firstProportion);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
String[] arr = firstProportion.split(":");
|
|
|
@@ -1497,7 +1507,9 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
} else {
|
|
|
if (!shipItems.isEmpty()) {
|
|
|
for (PjShipItems shipItems1 : shipItems) {
|
|
|
- shipItems1.setProportion(secondProportion);
|
|
|
+ if (ObjectUtils.isNotNull(financingBrand) && financingBrand.contains(shipItems1.getBrandName())) {
|
|
|
+ shipItems1.setProportion(secondProportion);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
String[] arr = secondProportion.split(":");
|
|
|
@@ -1988,6 +2000,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
}
|
|
|
}
|
|
|
String status = sysClient.getParamService("whether.financing");
|
|
|
+ String financingBrand = sysClient.getParamService("financing.brand");
|
|
|
if (ObjectUtils.isNotNull(status) && "1".equals(status) && ship.getBizTypeName().equals(OrderTypeEnum.TKSHGD.getType())) {
|
|
|
List<ShipItemsRecord> recordList = shipItemsRecordService.list(new LambdaQueryWrapper<ShipItemsRecord>()
|
|
|
.eq(ShipItemsRecord::getIsDeleted, 0)
|
|
|
@@ -2001,12 +2014,13 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
String secondProportion = sysClient.getParamService("second.month.proportion");
|
|
|
PjpfFunding pjpfFunding = pjpfFundingService.getOne(new LambdaQueryWrapper<PjpfFunding>()
|
|
|
.eq(PjpfFunding::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(PjpfFunding::getFundingPartyId, order.getFundingPartyId())
|
|
|
.eq(PjpfFunding::getIsDeleted, 0));
|
|
|
if (pjpfFunding == null) {
|
|
|
throw new RuntimeException("未找到融资总账");
|
|
|
}
|
|
|
- List<String> srcFinancingList = shipItemsList.stream().map(PjShipItems::getSrcFinancing).filter(Objects::nonNull)
|
|
|
- .distinct().collect(Collectors.toList());
|
|
|
+ List<String> srcFinancingList = shipItemsList.stream().filter(e -> ObjectUtils.isNotNull(financingBrand) && financingBrand.contains(e.getBrandName()))
|
|
|
+ .map(PjShipItems::getSrcFinancing).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
List<FinancingShipItemDto> financingShipItemDtoList = new ArrayList<>();
|
|
|
for (String item : srcFinancingList) {
|
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
|
@@ -2042,8 +2056,8 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
}
|
|
|
}
|
|
|
orderItemsService.updateBatchById(orderItemsList);
|
|
|
- BigDecimal amount = shipItemsList.stream().map(PjShipItems::getSubTotalMoney)
|
|
|
- .filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ BigDecimal amount = shipItemsList.stream().filter(e -> ObjectUtils.isNotNull(financingBrand) && financingBrand.contains(e.getBrandName()))
|
|
|
+ .map(PjShipItems::getSubTotalMoney).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
pjpfFunding.setAvailableAmount(pjpfFunding.getAvailableAmount().add(amount));
|
|
|
PjpfFundingItem item = new PjpfFundingItem();
|
|
|
item.setPid(pjpfFunding.getId());
|
|
|
@@ -2152,7 +2166,9 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
if (currentDate.compareTo(thirtyDayAgo) > 0) {
|
|
|
if (!shipItems.isEmpty()) {
|
|
|
for (PjShipItems shipItems1 : shipItemsList) {
|
|
|
- shipItems1.setProportion(firstProportion);
|
|
|
+ if (ObjectUtils.isNotNull(financingBrand) && financingBrand.contains(shipItems1.getBrandName())) {
|
|
|
+ shipItems1.setProportion(firstProportion);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
String[] arr = firstProportion.split(":");
|
|
|
@@ -2175,7 +2191,9 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
} else {
|
|
|
if (!shipItems.isEmpty()) {
|
|
|
for (PjShipItems shipItems1 : shipItems) {
|
|
|
- shipItems1.setProportion(secondProportion);
|
|
|
+ if (ObjectUtils.isNotNull(financingBrand) && financingBrand.contains(shipItems1.getBrandName())) {
|
|
|
+ shipItems1.setProportion(secondProportion);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
String[] arr = secondProportion.split(":");
|
|
|
@@ -2595,11 +2613,13 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
throw new RuntimeException("数据异常请联系管理员");
|
|
|
}
|
|
|
String status = sysClient.getParamService("whether.financing");
|
|
|
+ String financingBrand = sysClient.getParamService("financing.brand");
|
|
|
if (ObjectUtils.isNotNull(status) && "1".equals(status) && ship.getBizTypeName().equals(OrderTypeEnum.TKSHGD.getType())) {
|
|
|
String firstProportion = sysClient.getParamService("first.month.proportion");
|
|
|
String secondProportion = sysClient.getParamService("second.month.proportion");
|
|
|
PjpfFunding pjpfFunding = pjpfFundingService.getOne(new LambdaQueryWrapper<PjpfFunding>()
|
|
|
.eq(PjpfFunding::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(PjpfFunding::getFundingPartyId, order.getFundingPartyId())
|
|
|
.eq(PjpfFunding::getIsDeleted, 0));
|
|
|
if (pjpfFunding == null) {
|
|
|
throw new RuntimeException("未找到融资总账");
|
|
|
@@ -2619,8 +2639,8 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
.orderByAsc(PjOrder::getBusinesDate)
|
|
|
);
|
|
|
List<Long> ordIds = orderList.stream().map(PjOrder::getId).collect(Collectors.toList());
|
|
|
- List<Long> goodsList = ship.getShipItemsList().stream().map(PjShipItems::getGoodsId).filter(Objects::nonNull)
|
|
|
- .distinct().collect(Collectors.toList());
|
|
|
+ List<Long> goodsList = ship.getShipItemsList().stream().filter(e -> ObjectUtils.isNotNull(financingBrand) && financingBrand.contains(e.getBrandName()))
|
|
|
+ .map(PjShipItems::getGoodsId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
List<PjOrderItems> orderItemsList = orderItemsService.list(new LambdaQueryWrapper<PjOrderItems>()
|
|
|
.eq(PjOrderItems::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(PjOrderItems::getIsDeleted, 0)
|
|
|
@@ -2634,8 +2654,8 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
if (pjpfFunding.getBondAmount().compareTo(pjpfFunding.getPaidAlreadyBondAmount()) > 0) {
|
|
|
throw new RuntimeException("已缴保证金不足,出库失败");
|
|
|
}
|
|
|
- BigDecimal amount = ship.getShipItemsList().stream().map(PjShipItems::getSubTotalMoney)
|
|
|
- .filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ BigDecimal amount = ship.getShipItemsList().stream().filter(e -> ObjectUtils.isNotNull(financingBrand) && financingBrand.contains(e.getBrandName()))
|
|
|
+ .map(PjShipItems::getSubTotalMoney).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
if (pjpfFunding.getAvailableAmount().compareTo(amount) < 0) {
|
|
|
throw new RuntimeException("剩余可用资金:" + pjpfFunding.getAvailableAmount() + "小于本次出库金额:" + amount + ",出库失败");
|
|
|
}
|
|
|
@@ -2657,64 +2677,66 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
List<FinancingShipItemDto> allList = new ArrayList<>();
|
|
|
List<ShipItemsRecord> recordList = new ArrayList<>();
|
|
|
for (PjShipItems shipItems : ship.getShipItemsList()) {
|
|
|
- BigDecimal number1 = shipItems.getSendNum();
|
|
|
- List<PjOrderItems> orderItemList = orderItemsList.stream().filter(e -> e.getGoodsId().equals(shipItems.getGoodsId())).collect(Collectors.toList());
|
|
|
- List<FinancingShipItemDto> mapList = new ArrayList<>();
|
|
|
- for (PjOrderItems orderItems1 : orderItemList) {
|
|
|
- if (number1.compareTo(new BigDecimal("0.00")) > 0) {
|
|
|
- ShipItemsRecord shipItemsRecord = new ShipItemsRecord();
|
|
|
- shipItemsRecord.setBillNo(ship.getBillno());
|
|
|
- shipItemsRecord.setPid(shipItems.getPid());
|
|
|
- shipItemsRecord.setItemId(shipItems.getId());
|
|
|
- shipItemsRecord.setSrcId(orderItems1.getPid());
|
|
|
- shipItemsRecord.setSrcItemId(orderItems1.getId());
|
|
|
- shipItemsRecord.setSrcOrd(orderItems1.getBillNo());
|
|
|
- shipItemsRecord.setCreateUser(AuthUtil.getUserId());
|
|
|
- shipItemsRecord.setCreateUserName(AuthUtil.getUserName());
|
|
|
- shipItemsRecord.setCreateTime(new Date());
|
|
|
- FinancingShipItemDto financingShipItemDto = new FinancingShipItemDto();
|
|
|
- financingShipItemDto.setId(orderItems1.getId());
|
|
|
- financingShipItemDto.setPid(orderItems1.getPid());
|
|
|
- financingShipItemDto.setItemId(shipItems.getId());
|
|
|
- BigDecimal subNum = orderItems1.getSendNum().subtract(orderItems1.getOutGoodsTotalShipNum());
|
|
|
- if (number1.compareTo(subNum) > 0) {
|
|
|
- financingShipItemDto.setNum(subNum);
|
|
|
- financingShipItemDto.setAmount(subNum.multiply(orderItems1.getPrice()));
|
|
|
- shipItemsRecord.setNum(subNum);
|
|
|
- shipItemsRecord.setAmount(subNum.multiply(orderItems1.getPrice()));
|
|
|
- orderItems1.setOutGoodsTotalShipNum(orderItems1.getSendNum());
|
|
|
- orderItems1.setOutGoodsTotalShipAmount(orderItems1.getOutGoodsTotalShipNum().multiply(orderItems1.getPrice()));
|
|
|
- number1 = number1.subtract(subNum);
|
|
|
- } else if (number1.compareTo(subNum) == 0) {
|
|
|
- financingShipItemDto.setNum(subNum);
|
|
|
- financingShipItemDto.setAmount(subNum.multiply(orderItems1.getPrice()));
|
|
|
- shipItemsRecord.setNum(subNum);
|
|
|
- shipItemsRecord.setAmount(subNum.multiply(orderItems1.getPrice()));
|
|
|
- orderItems1.setOutGoodsTotalShipNum(orderItems1.getSendNum());
|
|
|
- orderItems1.setOutGoodsTotalShipAmount(orderItems1.getOutGoodsTotalShipNum().multiply(orderItems1.getPrice()));
|
|
|
- number1 = new BigDecimal("0.00");
|
|
|
- } else {
|
|
|
- financingShipItemDto.setNum(number1);
|
|
|
- financingShipItemDto.setAmount(number1.multiply(orderItems1.getPrice()));
|
|
|
- shipItemsRecord.setNum(number1);
|
|
|
- shipItemsRecord.setAmount(number1.multiply(orderItems1.getPrice()));
|
|
|
- orderItems1.setOutGoodsTotalShipNum(orderItems1.getOutGoodsTotalShipNum().add(number1));
|
|
|
- orderItems1.setOutGoodsTotalShipAmount(orderItems1.getOutGoodsTotalShipNum().multiply(orderItems1.getPrice()));
|
|
|
- number1 = new BigDecimal("0.00");
|
|
|
+ if (ObjectUtils.isNotNull(financingBrand) && financingBrand.contains(shipItems.getBrandName())) {
|
|
|
+ BigDecimal number1 = shipItems.getSendNum();
|
|
|
+ List<PjOrderItems> orderItemList = orderItemsList.stream().filter(e -> e.getGoodsId().equals(shipItems.getGoodsId())).collect(Collectors.toList());
|
|
|
+ List<FinancingShipItemDto> mapList = new ArrayList<>();
|
|
|
+ for (PjOrderItems orderItems1 : orderItemList) {
|
|
|
+ if (number1.compareTo(new BigDecimal("0.00")) > 0) {
|
|
|
+ ShipItemsRecord shipItemsRecord = new ShipItemsRecord();
|
|
|
+ shipItemsRecord.setBillNo(ship.getBillno());
|
|
|
+ shipItemsRecord.setPid(shipItems.getPid());
|
|
|
+ shipItemsRecord.setItemId(shipItems.getId());
|
|
|
+ shipItemsRecord.setSrcId(orderItems1.getPid());
|
|
|
+ shipItemsRecord.setSrcItemId(orderItems1.getId());
|
|
|
+ shipItemsRecord.setSrcOrd(orderItems1.getBillNo());
|
|
|
+ shipItemsRecord.setCreateUser(AuthUtil.getUserId());
|
|
|
+ shipItemsRecord.setCreateUserName(AuthUtil.getUserName());
|
|
|
+ shipItemsRecord.setCreateTime(new Date());
|
|
|
+ FinancingShipItemDto financingShipItemDto = new FinancingShipItemDto();
|
|
|
+ financingShipItemDto.setId(orderItems1.getId());
|
|
|
+ financingShipItemDto.setPid(orderItems1.getPid());
|
|
|
+ financingShipItemDto.setItemId(shipItems.getId());
|
|
|
+ BigDecimal subNum = orderItems1.getSendNum().subtract(orderItems1.getOutGoodsTotalShipNum());
|
|
|
+ if (number1.compareTo(subNum) > 0) {
|
|
|
+ financingShipItemDto.setNum(subNum);
|
|
|
+ financingShipItemDto.setAmount(subNum.multiply(orderItems1.getPrice()));
|
|
|
+ shipItemsRecord.setNum(subNum);
|
|
|
+ shipItemsRecord.setAmount(subNum.multiply(orderItems1.getPrice()));
|
|
|
+ orderItems1.setOutGoodsTotalShipNum(orderItems1.getSendNum());
|
|
|
+ orderItems1.setOutGoodsTotalShipAmount(orderItems1.getOutGoodsTotalShipNum().multiply(orderItems1.getPrice()));
|
|
|
+ number1 = number1.subtract(subNum);
|
|
|
+ } else if (number1.compareTo(subNum) == 0) {
|
|
|
+ financingShipItemDto.setNum(subNum);
|
|
|
+ financingShipItemDto.setAmount(subNum.multiply(orderItems1.getPrice()));
|
|
|
+ shipItemsRecord.setNum(subNum);
|
|
|
+ shipItemsRecord.setAmount(subNum.multiply(orderItems1.getPrice()));
|
|
|
+ orderItems1.setOutGoodsTotalShipNum(orderItems1.getSendNum());
|
|
|
+ orderItems1.setOutGoodsTotalShipAmount(orderItems1.getOutGoodsTotalShipNum().multiply(orderItems1.getPrice()));
|
|
|
+ number1 = new BigDecimal("0.00");
|
|
|
+ } else {
|
|
|
+ financingShipItemDto.setNum(number1);
|
|
|
+ financingShipItemDto.setAmount(number1.multiply(orderItems1.getPrice()));
|
|
|
+ shipItemsRecord.setNum(number1);
|
|
|
+ shipItemsRecord.setAmount(number1.multiply(orderItems1.getPrice()));
|
|
|
+ orderItems1.setOutGoodsTotalShipNum(orderItems1.getOutGoodsTotalShipNum().add(number1));
|
|
|
+ orderItems1.setOutGoodsTotalShipAmount(orderItems1.getOutGoodsTotalShipNum().multiply(orderItems1.getPrice()));
|
|
|
+ number1 = new BigDecimal("0.00");
|
|
|
+ }
|
|
|
+ mapList.add(financingShipItemDto);
|
|
|
+ recordList.add(shipItemsRecord);
|
|
|
}
|
|
|
- mapList.add(financingShipItemDto);
|
|
|
- recordList.add(shipItemsRecord);
|
|
|
}
|
|
|
- }
|
|
|
- if (!mapList.isEmpty()) {
|
|
|
- ObjectMapper mapper = new ObjectMapper();
|
|
|
- try {
|
|
|
- String jsonString = mapper.writeValueAsString(mapList);
|
|
|
- shipItems.setSrcFinancing(jsonString);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
+ if (!mapList.isEmpty()) {
|
|
|
+ ObjectMapper mapper = new ObjectMapper();
|
|
|
+ try {
|
|
|
+ String jsonString = mapper.writeValueAsString(mapList);
|
|
|
+ shipItems.setSrcFinancing(jsonString);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ allList.addAll(mapList);
|
|
|
}
|
|
|
- allList.addAll(mapList);
|
|
|
}
|
|
|
}
|
|
|
if (!recordList.isEmpty()) {
|
|
|
@@ -2749,7 +2771,9 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
if (currentDate.compareTo(thirtyDayAgo) > 0) {
|
|
|
if (!shipItems.isEmpty()) {
|
|
|
for (PjShipItems shipItems1 : ship.getShipItemsList()) {
|
|
|
- shipItems1.setProportion(firstProportion);
|
|
|
+ if (ObjectUtils.isNotNull(financingBrand) && financingBrand.contains(shipItems1.getBrandName())) {
|
|
|
+ shipItems1.setProportion(firstProportion);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
String[] arr = firstProportion.split(":");
|
|
|
@@ -2772,7 +2796,9 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
} else {
|
|
|
if (!shipItems.isEmpty()) {
|
|
|
for (PjShipItems shipItems1 : shipItems) {
|
|
|
- shipItems1.setProportion(secondProportion);
|
|
|
+ if (ObjectUtils.isNotNull(financingBrand) && financingBrand.contains(shipItems1.getBrandName())) {
|
|
|
+ shipItems1.setProportion(secondProportion);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
String[] arr = secondProportion.split(":");
|