|
|
@@ -3052,7 +3052,51 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
|
|
|
throw new RuntimeException("商品:" + goodsDesc.getCname() + ",请选择批次号");
|
|
|
}
|
|
|
//管理批次号
|
|
|
- PjStockDesc stockOne = null;
|
|
|
+ List<PjStockDesc> stockDescList = new ArrayList<>();
|
|
|
+ if (ObjectUtil.isNotEmpty(goodsDesc.getWhether()) && "1".equals(goodsDesc.getWhether())) {
|
|
|
+ stockDescList = pjStockDescList.stream()
|
|
|
+ .filter(e -> e.getGoodsId().equals(item.getGoodsId())
|
|
|
+ && e.getDot().equals(item.getDot())).collect(Collectors.toList());
|
|
|
+ } else {
|
|
|
+ stockDescList = pjStockDescList.stream()
|
|
|
+ .filter(e -> e.getGoodsId().equals(item.getGoodsId())
|
|
|
+ && ObjectUtils.isNull(e.getDot())).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ if (!stockDescList.isEmpty()) {
|
|
|
+ BigDecimal redeemNum = item.getSendNum().subtract(item.getOutGoodsTotalShipNum());
|
|
|
+ item.setRedeemNum(redeemNum);
|
|
|
+ BigDecimal balanceQuantityFinancing = stockDescList.stream().map(PjStockDesc::getBalanceQuantityFinancing)
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ if (balanceQuantityFinancing.compareTo(redeemNum) < 0) {
|
|
|
+ throw new RuntimeException("商品:" + goodsDesc.getCname() + "剩余融资库存小于融资单剩余融资数量");
|
|
|
+ }
|
|
|
+ BigDecimal count = redeemNum;
|
|
|
+ for (PjStockDesc s : stockDescList) {
|
|
|
+ if (new BigDecimal("0.00").compareTo(count) == 0) {
|
|
|
+ break;
|
|
|
+ } else {
|
|
|
+ if (s.getBalanceQuantityFinancing().compareTo(count) >= 0) {
|
|
|
+ BigDecimal sub = s.getBalanceQuantityFinancing().subtract(count);
|
|
|
+ s.setBalanceQuantityHave(s.getBalanceQuantityHave().add(count));
|
|
|
+ s.setBalanceQuantityFinancing(sub);
|
|
|
+ count = new BigDecimal("0.00");
|
|
|
+ } else if (s.getBalanceQuantityFinancing().compareTo(count) < 0) {
|
|
|
+ BigDecimal sub = count.subtract(s.getBalanceQuantityFinancing());
|
|
|
+ s.setBalanceQuantityHave(s.getBalanceQuantityHave().add(s.getBalanceQuantityFinancing()));
|
|
|
+ s.setBalanceQuantityFinancing(new BigDecimal("0.00"));
|
|
|
+ count = sub;
|
|
|
+ }
|
|
|
+ s.setVersion(s.getVersion());
|
|
|
+ pjStockDescArrayList.add(s);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (new BigDecimal("0.00").compareTo(count) != 0) {
|
|
|
+ throw new RuntimeException("赎回失败,请联系管理员");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw new RuntimeException("商品:" + goodsDesc.getCname() + "未查到库存账");
|
|
|
+ }
|
|
|
+ /*PjStockDesc stockOne = null;
|
|
|
if (ObjectUtil.isNotEmpty(goodsDesc.getWhether()) && "1".equals(goodsDesc.getWhether())) {
|
|
|
stockOne = pjStockDescList.stream()
|
|
|
.filter(e -> e.getGoodsId().equals(item.getGoodsId())
|
|
|
@@ -3074,7 +3118,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
|
|
|
pjStockDescArrayList.add(stockOne);
|
|
|
} else {
|
|
|
throw new RuntimeException("商品:" + goodsDesc.getCname() + "未查到库存账");
|
|
|
- }
|
|
|
+ }*/
|
|
|
}
|
|
|
orderItemsService.saveOrUpdateBatch(orderItemsList);
|
|
|
if (!pjStockDescArrayList.isEmpty()) {
|
|
|
@@ -4665,14 +4709,14 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
|
|
|
.in("pid", brandIds).eq("is_deleted", 0));
|
|
|
}
|
|
|
for (PjOrderItems item : orderItems) {
|
|
|
- if (ObjectUtils.isNotNull(item.getUrl())){
|
|
|
+ if (ObjectUtils.isNotNull(item.getUrl())) {
|
|
|
List<PjGoodsFiles> filesList = new ArrayList<>();
|
|
|
PjGoodsFiles files = new PjGoodsFiles();
|
|
|
files.setUrl(item.getUrl());
|
|
|
files.setVersion("0");
|
|
|
filesList.add(files);
|
|
|
item.setGoodsFilesList(filesList);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
if (!goodsFilesList.isEmpty()) {
|
|
|
item.setGoodsFilesList(goodsFilesList.stream()
|
|
|
.filter(e -> e.getPid().equals(item.getGoodsId()))
|
|
|
@@ -5510,7 +5554,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
|
|
|
}
|
|
|
});
|
|
|
String stata = sysClient.getParamService("whether.open.share");
|
|
|
- if (!productLaunchListNew.isEmpty() && "1".equals(stata)){
|
|
|
+ if (!productLaunchListNew.isEmpty() && "1".equals(stata)) {
|
|
|
sharePutOnShelvesService.updateShareInventory(productLaunchListNew);
|
|
|
}
|
|
|
}
|
|
|
@@ -5815,7 +5859,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
|
|
|
}
|
|
|
});
|
|
|
String stata = sysClient.getParamService("whether.open.share");
|
|
|
- if (!productLaunchListNew.isEmpty() && "1".equals(stata)){
|
|
|
+ if (!productLaunchListNew.isEmpty() && "1".equals(stata)) {
|
|
|
sharePutOnShelvesService.updateShareInventory(productLaunchListNew);
|
|
|
}
|
|
|
}
|
|
|
@@ -5966,14 +6010,14 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
|
|
|
.in("pid", brandIds).eq("is_deleted", 0));
|
|
|
}
|
|
|
for (PjOrderItems item : orderItems) {
|
|
|
- if (ObjectUtils.isNotNull(item.getUrl())){
|
|
|
+ if (ObjectUtils.isNotNull(item.getUrl())) {
|
|
|
List<PjGoodsFiles> filesList = new ArrayList<>();
|
|
|
PjGoodsFiles files = new PjGoodsFiles();
|
|
|
files.setUrl(item.getUrl());
|
|
|
files.setVersion("0");
|
|
|
filesList.add(files);
|
|
|
item.setGoodsFilesList(filesList);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
if (!goodsFilesList.isEmpty()) {
|
|
|
item.setGoodsFilesList(goodsFilesList.stream()
|
|
|
.filter(e -> e.getPid().equals(item.getGoodsId()))
|
|
|
@@ -6086,8 +6130,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
|
|
|
auditProecessDTO.setCorpId(declare.getCustomerId());
|
|
|
if ("1".equals(status) && !pjOrderShareList.isEmpty()) {
|
|
|
List<Long> ids = pjOrderListNew.stream().map(PjOrder::getId).collect(Collectors.toList());
|
|
|
- for (PjOrder item : pjOrderShareList){
|
|
|
- if (!ids.contains(item.getId())){
|
|
|
+ for (PjOrder item : pjOrderShareList) {
|
|
|
+ if (!ids.contains(item.getId())) {
|
|
|
pjOrderListNew.add(item);
|
|
|
}
|
|
|
}
|
|
|
@@ -6176,8 +6220,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
|
|
|
BigDecimal integral = new BigDecimal("0.00");
|
|
|
for (PjOrderItems e : list) {
|
|
|
PjGoodsDesc goodsDesc = pjGoodsDescList.stream().filter(item -> item.getId().equals(e.getGoodsId())).findFirst().orElse(null);
|
|
|
- if (goodsDesc != null&& new BigDecimal("0.00").compareTo(goodsDesc.getIntegral()) != 0) {
|
|
|
- integral= integral.add(goodsDesc.getIntegral().multiply(e.getGoodsNum()));
|
|
|
+ if (goodsDesc != null && new BigDecimal("0.00").compareTo(goodsDesc.getIntegral()) != 0) {
|
|
|
+ integral = integral.add(goodsDesc.getIntegral().multiply(e.getGoodsNum()));
|
|
|
corpsDesc.setPointsBalance(corpsDesc.getPointsBalance().subtract(goodsDesc.getIntegral().multiply(e.getGoodsNum())));
|
|
|
}
|
|
|
}
|
|
|
@@ -6337,7 +6381,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
|
|
|
productLaunchListNew.add(e);
|
|
|
});
|
|
|
String stata = sysClient.getParamService("whether.open.share");
|
|
|
- if (!productLaunchListNew.isEmpty() && "1".equals(stata)){
|
|
|
+ if (!productLaunchListNew.isEmpty() && "1".equals(stata)) {
|
|
|
sharePutOnShelvesService.updateShareInventory(productLaunchListNew);
|
|
|
}
|
|
|
}
|
|
|
@@ -6349,7 +6393,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
|
|
|
}
|
|
|
orderItemsService.updateBatchById(list);
|
|
|
}
|
|
|
- if ("额度支付".equals(order.getBusinessSource())){
|
|
|
+ if ("额度支付".equals(order.getBusinessSource())) {
|
|
|
corpsDesc.setLimitAmount(corpsDesc.getLimitAmount().add(order.getTotalMoney()));
|
|
|
corpsDescMapper.updateById(corpsDesc);
|
|
|
}
|
|
|
@@ -6395,7 +6439,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
|
|
|
item.setPaymentAmountTl(new BigDecimal("0.00"));
|
|
|
order.setActualPaymentStatus(4);
|
|
|
}
|
|
|
- if (new BigDecimal("0.00").compareTo(integral) != 0){
|
|
|
+ if (new BigDecimal("0.00").compareTo(integral) != 0) {
|
|
|
PjIntegralDetail integralDetail = new PjIntegralDetail();
|
|
|
integralDetail.setCreateTime(new Date());
|
|
|
integralDetail.setCreateUserName(AuthUtil.getUserName());
|