|
|
@@ -762,7 +762,6 @@ 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>()
|
|
|
@@ -1214,7 +1213,11 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
}
|
|
|
}
|
|
|
}*/
|
|
|
- if (ObjectUtils.isNotNull(status) && "1".equals(status)) {
|
|
|
+ PjStorageDesc storageDesc = storageDescMapper.selectById(ship.getStorageId());
|
|
|
+ if (storageDesc == null) {
|
|
|
+ throw new RuntimeException("未找到仓库信息");
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotNull(status) && "1".equals(status) && "1".equals(storageDesc.getWhetherFinancing())) {
|
|
|
String firstProportion = sysClient.getParamService("first.month.proportion");
|
|
|
String secondProportion = sysClient.getParamService("second.month.proportion");
|
|
|
PjpfFunding pjpfFunding = pjpfFundingService.getOne(new LambdaQueryWrapper<PjpfFunding>()
|
|
|
@@ -1239,8 +1242,7 @@ 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().filter(e -> ObjectUtils.isNotNull(financingBrand) && financingBrand.contains(e.getBrandName()))
|
|
|
- .map(PjShipItems::getGoodsId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
+ List<Long> goodsList = shipItemsList.stream().map(PjShipItems::getGoodsId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
//获取融资采购单明细数据
|
|
|
List<PjOrderItems> orderItemsList = orderItemsService.list(new LambdaQueryWrapper<PjOrderItems>()
|
|
|
.eq(PjOrderItems::getTenantId, AuthUtil.getTenantId())
|
|
|
@@ -1258,8 +1260,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
if (pjpfFunding.getBondAmount().compareTo(pjpfFunding.getPaidAlreadyBondAmount()) > 0) {
|
|
|
throw new RuntimeException("已缴保证金不足,出库失败");
|
|
|
}
|
|
|
- BigDecimal amount = shipItemsList.stream().filter(e -> ObjectUtils.isNotNull(financingBrand) && financingBrand.contains(e.getBrandName()))
|
|
|
- .map(PjShipItems::getCostprie).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ BigDecimal amount = shipItemsList.stream().map(PjShipItems::getCostprie).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
if (pjpfFunding.getAvailableAmount().subtract(pjpfFunding.getInterest()).compareTo(amount) < 0) {
|
|
|
throw new RuntimeException("剩余可用资金:" + pjpfFunding.getAvailableAmount().subtract(pjpfFunding.getInterest()) + "小于本次出库金额:" + amount + ",出库失败");
|
|
|
}
|
|
|
@@ -1277,87 +1278,85 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
if (ObjectUtils.isNull(shipItems.getCostprie()) || shipItems.getCostprie().compareTo(new BigDecimal("0.00")) == 0) {
|
|
|
throw new RuntimeException("获取数据失败,请重新生成出库工单");
|
|
|
}
|
|
|
- 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<>();
|
|
|
- if (number.compareTo(new BigDecimal("0.00")) > 0) {
|
|
|
- //采购商品明细循环
|
|
|
- for (PjOrderItems orderItems1 : orderItemList) {
|
|
|
- if (orderItems1.getGoodsId().equals(shipItems.getGoodsId())) {
|
|
|
- //记录出库明细对应融资采购单据
|
|
|
- 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 (new BigDecimal("0.00").compareTo(subNum) != 0) {
|
|
|
- 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.setThisOutGoodsTotalShipNum(subNum);
|
|
|
- orderItems1.setOutGoodsTotalShipAmount(orderItems1.getOutGoodsTotalShipNum().multiply(orderItems1.getPrice()));
|
|
|
- orderItems1.setThisOutGoodsTotalShipAmount(subNum.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.setThisOutGoodsTotalShipNum(subNum);
|
|
|
- orderItems1.setOutGoodsTotalShipAmount(orderItems1.getOutGoodsTotalShipNum().multiply(orderItems1.getPrice()));
|
|
|
- orderItems1.setThisOutGoodsTotalShipAmount(subNum.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.setThisOutGoodsTotalShipNum(number);
|
|
|
- orderItems1.setOutGoodsTotalShipAmount(orderItems1.getOutGoodsTotalShipNum().multiply(orderItems1.getPrice()));
|
|
|
- orderItems1.setThisOutGoodsTotalShipAmount(number.multiply(orderItems1.getPrice()));
|
|
|
- number = new BigDecimal("0.00");
|
|
|
- }
|
|
|
- mapList.add(financingShipItemDto);
|
|
|
- recordList.add(shipItemsRecord);
|
|
|
+ BigDecimal number = shipItems.getSendNum();
|
|
|
+ //获取出库明细商品对应融资采购商品明细
|
|
|
+ List<PjOrderItems> orderItemList = orderItemsList.stream().filter(e -> e.getGoodsId().equals(shipItems.getGoodsId())).collect(Collectors.toList());
|
|
|
+ List<FinancingShipItemDto> mapList = new ArrayList<>();
|
|
|
+ if (number.compareTo(new BigDecimal("0.00")) > 0) {
|
|
|
+ //采购商品明细循环
|
|
|
+ for (PjOrderItems orderItems1 : orderItemList) {
|
|
|
+ if (orderItems1.getGoodsId().equals(shipItems.getGoodsId())) {
|
|
|
+ //记录出库明细对应融资采购单据
|
|
|
+ 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 (new BigDecimal("0.00").compareTo(subNum) != 0) {
|
|
|
+ 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.setThisOutGoodsTotalShipNum(subNum);
|
|
|
+ orderItems1.setOutGoodsTotalShipAmount(orderItems1.getOutGoodsTotalShipNum().multiply(orderItems1.getPrice()));
|
|
|
+ orderItems1.setThisOutGoodsTotalShipAmount(subNum.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.setThisOutGoodsTotalShipNum(subNum);
|
|
|
+ orderItems1.setOutGoodsTotalShipAmount(orderItems1.getOutGoodsTotalShipNum().multiply(orderItems1.getPrice()));
|
|
|
+ orderItems1.setThisOutGoodsTotalShipAmount(subNum.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.setThisOutGoodsTotalShipNum(number);
|
|
|
+ orderItems1.setOutGoodsTotalShipAmount(orderItems1.getOutGoodsTotalShipNum().multiply(orderItems1.getPrice()));
|
|
|
+ orderItems1.setThisOutGoodsTotalShipAmount(number.multiply(orderItems1.getPrice()));
|
|
|
+ number = new BigDecimal("0.00");
|
|
|
}
|
|
|
+ mapList.add(financingShipItemDto);
|
|
|
+ recordList.add(shipItemsRecord);
|
|
|
}
|
|
|
- orderItemList1.add(orderItems1);
|
|
|
}
|
|
|
+ orderItemList1.add(orderItems1);
|
|
|
}
|
|
|
- if (!mapList.isEmpty()) {
|
|
|
- ObjectMapper mapper = new ObjectMapper();
|
|
|
- try {
|
|
|
- String jsonString = mapper.writeValueAsString(mapList);
|
|
|
- shipItems.setSrcFinancing(jsonString);
|
|
|
- } catch (Exception e) {
|
|
|
- System.err.println(e.getMessage());
|
|
|
- throw new RuntimeException(e);
|
|
|
- }
|
|
|
- allList.addAll(mapList);
|
|
|
+ }
|
|
|
+ if (!mapList.isEmpty()) {
|
|
|
+ ObjectMapper mapper = new ObjectMapper();
|
|
|
+ try {
|
|
|
+ String jsonString = mapper.writeValueAsString(mapList);
|
|
|
+ shipItems.setSrcFinancing(jsonString);
|
|
|
+ } catch (Exception e) {
|
|
|
+ System.err.println(e.getMessage());
|
|
|
+ throw new RuntimeException(e);
|
|
|
}
|
|
|
+ allList.addAll(mapList);
|
|
|
}
|
|
|
}
|
|
|
if (!recordList.isEmpty()) {
|
|
|
@@ -1384,7 +1383,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
items.setOutGoodsTotalShipNum(items.getOutGoodsTotalShipNum().add(thisSendSum));
|
|
|
items.setOutGoodsTotalShipAmount(items.getOutGoodsTotalShipAmount().add(thisSendAmount));
|
|
|
- if (ObjectUtils.isNotNull(items.getSalesAmount()) && new BigDecimal("0.00").compareTo(items.getSalesAmount()) != 0){
|
|
|
+ if (ObjectUtils.isNotNull(items.getSalesAmount()) && new BigDecimal("0.00").compareTo(items.getSalesAmount()) != 0) {
|
|
|
//重新计算所有未赎回融资采购,保证金,融资金额
|
|
|
if (!"1".equals(items.getWhetherRedeem())) {
|
|
|
Date currentDate = new Date();
|
|
|
@@ -1399,10 +1398,8 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
if (currentDate.compareTo(thirtyDayAgo) > 0) {
|
|
|
if (!shipItemsList.isEmpty()) {
|
|
|
for (PjShipItems shipItems1 : shipItemsList) {
|
|
|
- if (ObjectUtils.isNotNull(financingBrand) && financingBrand.contains(shipItems1.getBrandName())) {
|
|
|
- if (!itemIdList.isEmpty() && itemIdList.contains(shipItems1.getId())) {
|
|
|
- shipItems1.setProportion(firstProportion);
|
|
|
- }
|
|
|
+ if (!itemIdList.isEmpty() && itemIdList.contains(shipItems1.getId())) {
|
|
|
+ shipItems1.setProportion(firstProportion);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1475,12 +1472,10 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
item.setBondAmount(bondAmountSum);
|
|
|
pjpfFundingItemService.save(item);
|
|
|
for (PjShipItems shipItems : shipItemsList) {
|
|
|
- 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());
|
|
|
- }
|
|
|
+ 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());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1509,7 +1504,6 @@ 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>()
|
|
|
@@ -1904,7 +1898,11 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
item.setBondAmount(availableAmountSum.abs());
|
|
|
pjpfFundingItemService.save(item);
|
|
|
}*/
|
|
|
- if (ObjectUtils.isNotNull(status) && "1".equals(status)) {
|
|
|
+ PjStorageDesc storageDesc = storageDescMapper.selectById(ship.getStorageId());
|
|
|
+ if (storageDesc == null) {
|
|
|
+ throw new RuntimeException("未找到仓库信息");
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotNull(status) && "1".equals(status) && "1".equals(storageDesc.getWhetherFinancing())) {
|
|
|
List<ShipItemsRecord> recordList = shipItemsRecordService.list(new LambdaQueryWrapper<ShipItemsRecord>()
|
|
|
.eq(ShipItemsRecord::getIsDeleted, 0)
|
|
|
.eq(ShipItemsRecord::getTenantId, AuthUtil.getTenantId())
|
|
|
@@ -1920,8 +1918,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
if (pjpfFunding == null) {
|
|
|
throw new RuntimeException("未找到融资总账");
|
|
|
}
|
|
|
- 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<String> srcFinancingList = itemsList.stream().map(PjShipItems::getSrcFinancing).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
List<FinancingShipItemDto> financingShipItemDtoList = new ArrayList<>();
|
|
|
for (String item : srcFinancingList) {
|
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
|
@@ -1962,8 +1959,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
}
|
|
|
}
|
|
|
orderItemsService.updateBatchById(orderItemsList);
|
|
|
- BigDecimal amount = itemsList.stream().filter(e -> ObjectUtils.isNotNull(financingBrand) && financingBrand.contains(e.getBrandName()))
|
|
|
- .map(PjShipItems::getCostprie).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ BigDecimal amount = itemsList.stream().map(PjShipItems::getCostprie).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
pjpfFunding.setAvailableAmount(pjpfFunding.getAvailableAmount().add(amount));
|
|
|
BigDecimal bondAmountSum = new BigDecimal("0.00");
|
|
|
BigDecimal fundingAmountSum = new BigDecimal("0.00");
|
|
|
@@ -1980,7 +1976,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
items.setOutGoodsTotalShipNum(items.getOutGoodsTotalShipNum().subtract(thisSendSum));
|
|
|
items.setOutGoodsTotalShipAmount(items.getOutGoodsTotalShipAmount().subtract(thisSendAmount));
|
|
|
- if (ObjectUtils.isNotNull(items.getSalesAmount()) && new BigDecimal("0.00").compareTo(items.getSalesAmount()) != 0){
|
|
|
+ if (ObjectUtils.isNotNull(items.getSalesAmount()) && new BigDecimal("0.00").compareTo(items.getSalesAmount()) != 0) {
|
|
|
if (orderIdsList.contains(items.getId())) {
|
|
|
if (!"1".equals(items.getWhetherRedeem())) {
|
|
|
Date currentDate = new Date();
|
|
|
@@ -2048,9 +2044,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
if (currentDate.compareTo(thirtyDayAgo) > 0) {
|
|
|
if (!shipItems.isEmpty()) {
|
|
|
for (PjShipItems shipItems1 : itemsList) {
|
|
|
- if (ObjectUtils.isNotNull(financingBrand) && financingBrand.contains(shipItems1.getBrandName())) {
|
|
|
- shipItems1.setProportion(firstProportion);
|
|
|
- }
|
|
|
+ shipItems1.setProportion(firstProportion);
|
|
|
}
|
|
|
}
|
|
|
String[] arr = firstProportion.split(":");
|
|
|
@@ -2068,9 +2062,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
} else {
|
|
|
if (!shipItems.isEmpty()) {
|
|
|
for (PjShipItems shipItems1 : shipItems) {
|
|
|
- if (ObjectUtils.isNotNull(financingBrand) && financingBrand.contains(shipItems1.getBrandName())) {
|
|
|
- shipItems1.setProportion(secondProportion);
|
|
|
- }
|
|
|
+ shipItems1.setProportion(secondProportion);
|
|
|
}
|
|
|
}
|
|
|
String[] arr = secondProportion.split(":");
|
|
|
@@ -2584,7 +2576,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- String status = sysClient.getParamService("whether.financing");
|
|
|
+ /*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");
|
|
|
@@ -2652,7 +2644,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
items.setOutGoodsTotalShipNum(items.getOutGoodsTotalShipNum().subtract(thisSendSum));
|
|
|
items.setOutGoodsTotalShipAmount(items.getOutGoodsTotalShipAmount().subtract(thisSendAmount));
|
|
|
- if (ObjectUtils.isNotNull(items.getSalesAmount()) && new BigDecimal("0.00").compareTo(items.getSalesAmount()) != 0){
|
|
|
+ if (ObjectUtils.isNotNull(items.getSalesAmount()) && new BigDecimal("0.00").compareTo(items.getSalesAmount()) != 0) {
|
|
|
if (orderIdsList.contains(items.getId())) {
|
|
|
if (!"1".equals(items.getWhetherRedeem())) {
|
|
|
Date currentDate = new Date();
|
|
|
@@ -2754,7 +2746,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
item.setBondAmount(bondAmountSum);
|
|
|
item.setFundingAmount(fundingAmountSum);
|
|
|
pjpfFundingItemService.save(item);
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
return R.data(ship);
|
|
|
}
|
|
|
@@ -3164,7 +3156,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
} else {
|
|
|
throw new RuntimeException("数据异常请联系管理员");
|
|
|
}
|
|
|
- String status = sysClient.getParamService("whether.financing");
|
|
|
+ /*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())) {
|
|
|
@@ -3332,7 +3324,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
items.setOutGoodsTotalShipNum(items.getOutGoodsTotalShipNum().add(thisSendSum));
|
|
|
items.setOutGoodsTotalShipAmount(items.getOutGoodsTotalShipAmount().add(thisSendAmount));
|
|
|
- if (ObjectUtils.isNotNull(items.getSalesAmount()) && new BigDecimal("0.00").compareTo(items.getSalesAmount()) != 0){
|
|
|
+ if (ObjectUtils.isNotNull(items.getSalesAmount()) && new BigDecimal("0.00").compareTo(items.getSalesAmount()) != 0) {
|
|
|
//重新计算所有未赎回融资采购,保证金,融资金额
|
|
|
if (!"1".equals(items.getWhetherRedeem())) {
|
|
|
Date currentDate = new Date();
|
|
|
@@ -3413,7 +3405,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
return R.data(ship);
|
|
|
}
|
|
|
|
|
|
@@ -4208,7 +4200,11 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
saveHistory(ship.getId(), OrderTypeEnum.OURTBOUND.getType());
|
|
|
String status = sysClient.getParamService("whether.financing");
|
|
|
//融资流程
|
|
|
- if (ObjectUtils.isNotNull(status) && "1".equals(status)) {
|
|
|
+ PjStorageDesc storageDesc = storageDescMapper.selectById(ship.getStorageId());
|
|
|
+ if (storageDesc == null) {
|
|
|
+ throw new RuntimeException("未找到仓库信息");
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotNull(status) && "1".equals(status) && "1".equals(storageDesc.getWhetherFinancing())) {
|
|
|
String firstProportion = sysClient.getParamService("first.month.proportion");
|
|
|
String secondProportion = sysClient.getParamService("second.month.proportion");
|
|
|
PjpfFunding pjpfFunding = pjpfFundingService.getOne(new LambdaQueryWrapper<PjpfFunding>()
|
|
|
@@ -4374,7 +4370,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
items.setOutGoodsTotalShipNum(items.getOutGoodsTotalShipNum().add(thisSendSum));
|
|
|
items.setOutGoodsTotalShipAmount(items.getOutGoodsTotalShipAmount().add(thisSendAmount));
|
|
|
- if (ObjectUtils.isNotNull(items.getSalesAmount()) && new BigDecimal("0.00").compareTo(items.getSalesAmount()) != 0){
|
|
|
+ if (ObjectUtils.isNotNull(items.getSalesAmount()) && new BigDecimal("0.00").compareTo(items.getSalesAmount()) != 0) {
|
|
|
//重新计算所有未赎回融资采购,保证金,融资金额
|
|
|
if (!"1".equals(items.getWhetherRedeem())) {
|
|
|
Date currentDate = new Date();
|
|
|
@@ -4622,8 +4618,11 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
//生成出库工单历史记录
|
|
|
saveHistory(ship.getId(), OrderTypeEnum.TOBESHIPPEDOUT.getType());
|
|
|
String status = sysClient.getParamService("whether.financing");
|
|
|
- String financingBrand = sysClient.getParamService("financing.brand");
|
|
|
- if (ObjectUtils.isNotNull(status) && "1".equals(status)) {
|
|
|
+ PjStorageDesc storageDesc = storageDescMapper.selectById(ship.getStorageId());
|
|
|
+ if (storageDesc == null) {
|
|
|
+ throw new RuntimeException("未找到仓库信息");
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotNull(status) && "1".equals(status) && "1".equals(storageDesc.getWhetherFinancing())) {
|
|
|
List<ShipItemsRecord> recordList = shipItemsRecordService.list(new LambdaQueryWrapper<ShipItemsRecord>()
|
|
|
.eq(ShipItemsRecord::getIsDeleted, 0)
|
|
|
.eq(ShipItemsRecord::getTenantId, AuthUtil.getTenantId())
|
|
|
@@ -4639,8 +4638,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
if (pjpfFunding == null) {
|
|
|
throw new RuntimeException("未找到融资总账");
|
|
|
}
|
|
|
- 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<String> srcFinancingList = itemsList.stream().map(PjShipItems::getSrcFinancing).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
List<FinancingShipItemDto> financingShipItemDtoList = new ArrayList<>();
|
|
|
for (String item : srcFinancingList) {
|
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
|
@@ -4681,8 +4679,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
}
|
|
|
}
|
|
|
orderItemsService.updateBatchById(orderItemsList);
|
|
|
- BigDecimal amount = itemsList.stream().filter(e -> ObjectUtils.isNotNull(financingBrand) && financingBrand.contains(e.getBrandName()))
|
|
|
- .map(PjShipItems::getCostprie).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ BigDecimal amount = itemsList.stream().map(PjShipItems::getCostprie).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
pjpfFunding.setAvailableAmount(pjpfFunding.getAvailableAmount().add(amount));
|
|
|
BigDecimal bondAmountSum = new BigDecimal("0.00");
|
|
|
BigDecimal fundingAmountSum = new BigDecimal("0.00");
|
|
|
@@ -4697,7 +4694,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
items.setOutGoodsTotalShipNum(items.getOutGoodsTotalShipNum().subtract(thisSendSum));
|
|
|
items.setOutGoodsTotalShipAmount(items.getOutGoodsTotalShipAmount().subtract(thisSendAmount));
|
|
|
- if (ObjectUtils.isNotNull(items.getSalesAmount()) && new BigDecimal("0.00").compareTo(items.getSalesAmount()) != 0){
|
|
|
+ if (ObjectUtils.isNotNull(items.getSalesAmount()) && new BigDecimal("0.00").compareTo(items.getSalesAmount()) != 0) {
|
|
|
if (!"1".equals(items.getWhetherRedeem())) {
|
|
|
Date currentDate = new Date();
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
@@ -5212,7 +5209,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
orderRecord.setStatus(ship.getStatusName());
|
|
|
orderRecordService.save(orderRecord);
|
|
|
}
|
|
|
- String status = sysClient.getParamService("whether.financing");
|
|
|
+ /*String status = sysClient.getParamService("whether.financing");
|
|
|
if (ObjectUtils.isNotNull(status) && "1".equals(status)) {
|
|
|
String firstProportion = sysClient.getParamService("first.month.proportion");
|
|
|
String secondProportion = sysClient.getParamService("second.month.proportion");
|
|
|
@@ -5275,7 +5272,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
items.setOutGoodsTotalShipNum(items.getOutGoodsTotalShipNum().subtract(thisSendSum));
|
|
|
items.setOutGoodsTotalShipAmount(items.getOutGoodsTotalShipAmount().subtract(thisSendAmount));
|
|
|
- if (ObjectUtils.isNotNull(items.getSalesAmount()) && new BigDecimal("0.00").compareTo(items.getSalesAmount()) != 0){
|
|
|
+ if (ObjectUtils.isNotNull(items.getSalesAmount()) && new BigDecimal("0.00").compareTo(items.getSalesAmount()) != 0) {
|
|
|
if (!"1".equals(items.getWhetherRedeem())) {
|
|
|
Date currentDate = new Date();
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
@@ -5340,7 +5337,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
item.setBondAmount(bondAmountSum);
|
|
|
item.setFundingAmount(fundingAmountSum);
|
|
|
pjpfFundingItemService.save(item);
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
return R.data(ship);
|
|
|
}
|
|
|
@@ -5522,7 +5519,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
} else {
|
|
|
throw new RuntimeException("数据异常请联系管理员");
|
|
|
}
|
|
|
- String status = sysClient.getParamService("whether.financing");
|
|
|
+ /*String status = sysClient.getParamService("whether.financing");
|
|
|
if (ObjectUtils.isNotNull(status) && "1".equals(status)) {
|
|
|
String firstProportion = sysClient.getParamService("first.month.proportion");
|
|
|
String secondProportion = sysClient.getParamService("second.month.proportion");
|
|
|
@@ -5684,7 +5681,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
items.setOutGoodsTotalShipNum(items.getOutGoodsTotalShipNum().add(thisSendSum));
|
|
|
items.setOutGoodsTotalShipAmount(items.getOutGoodsTotalShipAmount().add(thisSendAmount));
|
|
|
- if (ObjectUtils.isNotNull(items.getSalesAmount()) && new BigDecimal("0.00").compareTo(items.getSalesAmount()) != 0){
|
|
|
+ if (ObjectUtils.isNotNull(items.getSalesAmount()) && new BigDecimal("0.00").compareTo(items.getSalesAmount()) != 0) {
|
|
|
//重新计算所有未赎回融资采购,保证金,融资金额
|
|
|
if (!"1".equals(items.getWhetherRedeem())) {
|
|
|
Date currentDate = new Date();
|
|
|
@@ -5763,7 +5760,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
return R.data(ship);
|
|
|
}
|
|
|
|