|
@@ -413,7 +413,7 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
|
|
|
List<TopCostTpItem> tpItems = new ArrayList<>();
|
|
|
for (TopCostTpItem x : items) {
|
|
|
BigDecimal price = goodsPrice;
|
|
|
- if (x.getDockStatus() == 1){
|
|
|
+ if (ObjectUtil.isNotNull(x.getDockStatus()) && x.getDockStatus() == 1){
|
|
|
//启用成本扣除项
|
|
|
switch (x.getDockType()){
|
|
|
case 1://百分比
|
|
@@ -440,41 +440,46 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
|
|
|
//匹配不到成本项阶梯值
|
|
|
continue;
|
|
|
}
|
|
|
- if (tpItems.size() > 1) {
|
|
|
- //匹配到多个成本项
|
|
|
- throw new CustomException(String.format("成本项阶梯匹配有误!(有多个)请检查【%s,价格:%s】", orderGoods.getBusinessFullName(), goodsPrice.toString()));
|
|
|
- }
|
|
|
- //换算订单成本和盈亏
|
|
|
+// if (tpItems.size() > 1) {
|
|
|
+// //匹配到多个成本项
|
|
|
+// throw new CustomException(String.format("成本项阶梯匹配有误!(有多个)请检查【%s,价格:%s】", orderGoods.getBusinessFullName(), goodsPrice.toString()));
|
|
|
+// }
|
|
|
+
|
|
|
BigDecimal cost = new BigDecimal("0.00");//成本
|
|
|
BigDecimal bigDecimal = new BigDecimal("100");
|
|
|
- TopCostTpItem topCostTpItem = tpItems.stream().findFirst().get();
|
|
|
- if (topCostTpItem.getDockStatus() == 1){
|
|
|
- //启用成本扣除项
|
|
|
- switch (topCostTpItem.getDockType()){
|
|
|
+ for (TopCostTpItem tpItem : tpItems) {
|
|
|
+ BigDecimal goodsPriceDecimal = goodsPrice;
|
|
|
+ //换算订单成本和盈亏
|
|
|
+ TopCostTpItem topCostTpItem = tpItem;
|
|
|
+ if (ObjectUtil.isNotNull(topCostTpItem.getDockStatus()) && topCostTpItem.getDockStatus() == 1){
|
|
|
+ //启用成本扣除项
|
|
|
+ switch (topCostTpItem.getDockType()){
|
|
|
+ case 1://百分比
|
|
|
+ //成本扣除金额
|
|
|
+ BigDecimal divide1 = topCostTpItem.getDockValue().divide(bigDecimal);
|
|
|
+ BigDecimal multiply = goodsPriceDecimal.multiply(divide1);
|
|
|
+ goodsPriceDecimal = goodsPriceDecimal.subtract(multiply);
|
|
|
+ break;
|
|
|
+ case 2://固定金额
|
|
|
+ goodsPriceDecimal = goodsPriceDecimal.subtract(topCostTpItem.getDockValue());
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ switch (topCostTpItem.getItemType()) {
|
|
|
case 1://百分比
|
|
|
- //成本扣除金额
|
|
|
- BigDecimal divide1 = topCostTpItem.getDockValue().divide(bigDecimal);
|
|
|
- BigDecimal multiply = goodsPrice.multiply(divide1);
|
|
|
- goodsPrice = goodsPrice.subtract(multiply);
|
|
|
+ BigDecimal divide = topCostTpItem.getTypeValue().divide(bigDecimal);
|
|
|
+ BigDecimal multiply = goodsPriceDecimal.multiply(divide);
|
|
|
+ cost = cost.add(multiply);
|
|
|
break;
|
|
|
case 2://固定金额
|
|
|
- goodsPrice = goodsPrice.subtract(topCostTpItem.getDockValue());
|
|
|
+ cost = cost.add(topCostTpItem.getTypeValue());
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- switch (topCostTpItem.getItemType()) {
|
|
|
- case 1://百分比
|
|
|
- BigDecimal divide = topCostTpItem.getTypeValue().divide(bigDecimal);
|
|
|
- cost = goodsPrice.multiply(divide);
|
|
|
- break;
|
|
|
- case 2://固定金额
|
|
|
- cost = topCostTpItem.getTypeValue();
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
costTotal = costTotal.add(cost);
|
|
|
}
|
|
|
|
|
@@ -684,7 +689,7 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
|
|
|
List<TopCostTpItemVo> tpItems = new ArrayList<>();
|
|
|
for (TopCostTpItemVo x : items) {
|
|
|
BigDecimal price = goodsPrice;
|
|
|
- if (x.getDockStatus() == 1){
|
|
|
+ if (ObjectUtil.isNotNull(x.getDockStatus()) && x.getDockStatus() == 1){
|
|
|
//启用成本扣除项
|
|
|
switch (x.getDockType()){
|
|
|
case 1://百分比
|
|
@@ -711,41 +716,45 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
|
|
|
//匹配不到成本项阶梯值
|
|
|
continue;
|
|
|
}
|
|
|
- if (tpItems.size() > 1) {
|
|
|
- //匹配到多个成本项
|
|
|
- throw new CustomException(String.format("成本项阶梯匹配有误!(有多个)请检查【%s,价格:%s】", orderGoods.getBusinessFullName(), goodsPrice.toString()));
|
|
|
- }
|
|
|
- //换算订单成本和盈亏
|
|
|
- TopCostTpItemVo topCostTpItem = tpItems.stream().findFirst().get();
|
|
|
+// if (tpItems.size() > 1) {
|
|
|
+// //匹配到多个成本项
|
|
|
+// throw new CustomException(String.format("成本项阶梯匹配有误!(有多个)请检查【%s,价格:%s】", orderGoods.getBusinessFullName(), goodsPrice.toString()));
|
|
|
+// }
|
|
|
BigDecimal cost = new BigDecimal("0.00");//成本
|
|
|
BigDecimal bigDecimal = new BigDecimal("100");
|
|
|
- if (topCostTpItem.getDockStatus() == 1){
|
|
|
- //启用成本扣除项
|
|
|
- switch (topCostTpItem.getDockType()){
|
|
|
+ for (TopCostTpItemVo tpItem : tpItems) {
|
|
|
+ BigDecimal goodsPriceDecimal = goodsPrice;
|
|
|
+ //换算订单成本和盈亏
|
|
|
+ TopCostTpItemVo topCostTpItem = tpItem;
|
|
|
+ if (ObjectUtil.isNotNull(topCostTpItem.getDockStatus()) && topCostTpItem.getDockStatus() == 1){
|
|
|
+ //启用成本扣除项
|
|
|
+ switch (topCostTpItem.getDockType()){
|
|
|
+ case 1://百分比
|
|
|
+ //成本扣除金额
|
|
|
+ BigDecimal divide1 = topCostTpItem.getDockValue().divide(bigDecimal);
|
|
|
+ BigDecimal multiply = goodsPriceDecimal.multiply(divide1);
|
|
|
+ goodsPriceDecimal = goodsPriceDecimal.subtract(multiply);
|
|
|
+ break;
|
|
|
+ case 2://固定金额
|
|
|
+ goodsPriceDecimal = goodsPriceDecimal.subtract(topCostTpItem.getDockValue());
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ switch (topCostTpItem.getItemType()) {
|
|
|
case 1://百分比
|
|
|
- //成本扣除金额
|
|
|
- BigDecimal divide1 = topCostTpItem.getDockValue().divide(bigDecimal);
|
|
|
- BigDecimal multiply = goodsPrice.multiply(divide1);
|
|
|
- goodsPrice = goodsPrice.subtract(multiply);
|
|
|
+ BigDecimal divide = topCostTpItem.getTypeValue().divide(bigDecimal);
|
|
|
+ BigDecimal multiply = goodsPriceDecimal.multiply(divide);
|
|
|
+ cost = cost.add(multiply);
|
|
|
break;
|
|
|
case 2://固定金额
|
|
|
- goodsPrice = goodsPrice.subtract(topCostTpItem.getDockValue());
|
|
|
+ cost = cost.add(topCostTpItem.getTypeValue());
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- switch (topCostTpItem.getItemType()) {
|
|
|
- case 1://百分比
|
|
|
- BigDecimal divide = topCostTpItem.getTypeValue().divide(bigDecimal);
|
|
|
- cost = goodsPrice.multiply(divide);
|
|
|
- break;
|
|
|
- case 2://固定金额
|
|
|
- cost = topCostTpItem.getTypeValue();
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
costTotal = costTotal.add(cost);
|
|
|
}
|
|
|
BigDecimal cost = costTotal.add(brokerage);
|
|
@@ -2929,7 +2938,7 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
|
|
|
List<TopCostTpItemVo> tpItems = new ArrayList<>();
|
|
|
for (TopCostTpItemVo x : items) {
|
|
|
BigDecimal price = goodsPrice;
|
|
|
- if (x.getDockStatus() == 1){
|
|
|
+ if (ObjectUtil.isNotNull(x.getDockStatus()) && x.getDockStatus() == 1){
|
|
|
//启用成本扣除项
|
|
|
switch (x.getDockType()){
|
|
|
case 1://百分比
|
|
@@ -2956,41 +2965,45 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
|
|
|
//匹配不到成本项阶梯值
|
|
|
continue;
|
|
|
}
|
|
|
- if (tpItems.size() > 1) {
|
|
|
- //匹配到多个成本项
|
|
|
- throw new CustomException(String.format("成本项阶梯匹配有误!(有多个)请检查【%s,价格:%s】", businessName, goodsPrice.toString()));
|
|
|
- }
|
|
|
- //换算订单成本和盈亏
|
|
|
- TopCostTpItemVo topCostTpItem = tpItems.stream().findFirst().get();
|
|
|
+// if (tpItems.size() > 1) {
|
|
|
+// //匹配到多个成本项
|
|
|
+// throw new CustomException(String.format("成本项阶梯匹配有误!(有多个)请检查【%s,价格:%s】", businessName, goodsPrice.toString()));
|
|
|
+// }
|
|
|
BigDecimal cost = new BigDecimal("0.00");//成本
|
|
|
BigDecimal bigDecimal = new BigDecimal("100");
|
|
|
- if (topCostTpItem.getDockStatus() == 1){
|
|
|
- //启用成本扣除项
|
|
|
- switch (topCostTpItem.getDockType()){
|
|
|
+ for (TopCostTpItemVo tpItem : tpItems) {
|
|
|
+ BigDecimal goodsPriceDecimal = goodsPrice;
|
|
|
+ //换算订单成本和盈亏
|
|
|
+ TopCostTpItemVo topCostTpItem = tpItem;
|
|
|
+ if (ObjectUtil.isNotNull(topCostTpItem.getDockStatus()) && topCostTpItem.getDockStatus() == 1){
|
|
|
+ //启用成本扣除项
|
|
|
+ switch (topCostTpItem.getDockType()){
|
|
|
+ case 1://百分比
|
|
|
+ //成本扣除金额
|
|
|
+ BigDecimal divide1 = topCostTpItem.getDockValue().divide(bigDecimal);
|
|
|
+ BigDecimal multiply = goodsPriceDecimal.multiply(divide1);
|
|
|
+ goodsPriceDecimal = goodsPriceDecimal.subtract(multiply);
|
|
|
+ break;
|
|
|
+ case 2://固定金额
|
|
|
+ goodsPriceDecimal = goodsPriceDecimal.subtract(topCostTpItem.getDockValue());
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ switch (topCostTpItem.getItemType()) {
|
|
|
case 1://百分比
|
|
|
- //成本扣除金额
|
|
|
- BigDecimal divide1 = topCostTpItem.getDockValue().divide(bigDecimal);
|
|
|
- BigDecimal multiply = goodsPrice.multiply(divide1);
|
|
|
- goodsPrice = goodsPrice.subtract(multiply);
|
|
|
+ BigDecimal divide = topCostTpItem.getTypeValue().divide(bigDecimal);
|
|
|
+ BigDecimal multiply = goodsPriceDecimal.multiply(divide);
|
|
|
+ cost = cost.add(multiply);
|
|
|
break;
|
|
|
case 2://固定金额
|
|
|
- goodsPrice = goodsPrice.subtract(topCostTpItem.getDockValue());
|
|
|
+ cost = cost.add(topCostTpItem.getTypeValue());
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- switch (topCostTpItem.getItemType()) {
|
|
|
- case 1://百分比
|
|
|
- BigDecimal divide = topCostTpItem.getTypeValue().divide(bigDecimal);
|
|
|
- cost = goodsPrice.multiply(divide);
|
|
|
- break;
|
|
|
- case 2://固定金额
|
|
|
- cost = topCostTpItem.getTypeValue();
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
costTotal = costTotal.add(cost);
|
|
|
}
|
|
|
|
|
@@ -3068,7 +3081,7 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
|
|
|
List<TopCostTpItemVo> tpItems = new ArrayList<>();
|
|
|
for (TopCostTpItemVo x : items) {
|
|
|
BigDecimal price = goodsPrice;
|
|
|
- if (x.getDockStatus() == 1){
|
|
|
+ if (ObjectUtil.isNotNull(x.getDockStatus()) && x.getDockStatus() == 1){
|
|
|
//启用成本扣除项
|
|
|
switch (x.getDockType()){
|
|
|
case 1://百分比
|
|
@@ -3095,41 +3108,45 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
|
|
|
//匹配不到成本项阶梯值
|
|
|
continue;
|
|
|
}
|
|
|
- if (tpItems.size() > 1) {
|
|
|
- //匹配到多个成本项
|
|
|
- throw new CustomException(String.format("成本项阶梯匹配有误!(有多个)请检查【%s,价格:%s】", businessName, goodsPrice.toString()));
|
|
|
- }
|
|
|
- //换算订单成本和盈亏
|
|
|
- TopCostTpItemVo topCostTpItem = tpItems.stream().findFirst().get();
|
|
|
+// if (tpItems.size() > 1) {
|
|
|
+// //匹配到多个成本项
|
|
|
+// throw new CustomException(String.format("成本项阶梯匹配有误!(有多个)请检查【%s,价格:%s】", businessName, goodsPrice.toString()));
|
|
|
+// }
|
|
|
BigDecimal cost = new BigDecimal("0.00");//成本
|
|
|
BigDecimal bigDecimal = new BigDecimal("100");
|
|
|
- if (topCostTpItem.getDockStatus() == 1){
|
|
|
- //启用成本扣除项
|
|
|
- switch (topCostTpItem.getDockType()){
|
|
|
+ for (TopCostTpItemVo tpItem : tpItems) {
|
|
|
+ BigDecimal goodsPriceDecimal = goodsPrice;
|
|
|
+ //换算订单成本和盈亏
|
|
|
+ TopCostTpItemVo topCostTpItem = tpItem;
|
|
|
+ if (ObjectUtil.isNotNull(topCostTpItem.getDockStatus()) && topCostTpItem.getDockStatus() == 1){
|
|
|
+ //启用成本扣除项
|
|
|
+ switch (topCostTpItem.getDockType()){
|
|
|
+ case 1://百分比
|
|
|
+ //成本扣除金额
|
|
|
+ BigDecimal divide1 = topCostTpItem.getDockValue().divide(bigDecimal);
|
|
|
+ BigDecimal multiply = goodsPriceDecimal.multiply(divide1);
|
|
|
+ goodsPriceDecimal = goodsPriceDecimal.subtract(multiply);
|
|
|
+ break;
|
|
|
+ case 2://固定金额
|
|
|
+ goodsPriceDecimal = goodsPriceDecimal.subtract(topCostTpItem.getDockValue());
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ switch (topCostTpItem.getItemType()) {
|
|
|
case 1://百分比
|
|
|
- //成本扣除金额
|
|
|
- BigDecimal divide1 = topCostTpItem.getDockValue().divide(bigDecimal);
|
|
|
- BigDecimal multiply = goodsPrice.multiply(divide1);
|
|
|
- goodsPrice = goodsPrice.subtract(multiply);
|
|
|
+ BigDecimal divide = topCostTpItem.getTypeValue().divide(bigDecimal);
|
|
|
+ BigDecimal multiply = goodsPriceDecimal.multiply(divide);
|
|
|
+ cost = cost.add(multiply);
|
|
|
break;
|
|
|
case 2://固定金额
|
|
|
- goodsPrice = goodsPrice.subtract(topCostTpItem.getDockValue());
|
|
|
+ cost = cost.add(topCostTpItem.getTypeValue());
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- switch (topCostTpItem.getItemType()) {
|
|
|
- case 1://百分比
|
|
|
- BigDecimal divide = topCostTpItem.getTypeValue().divide(bigDecimal);
|
|
|
- cost = goodsPrice.multiply(divide);
|
|
|
- break;
|
|
|
- case 2://固定金额
|
|
|
- cost = topCostTpItem.getTypeValue();
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
costTotal = costTotal.add(cost);
|
|
|
}
|
|
|
BigDecimal cost = costTotal.add(brokerage);
|