|
@@ -76,6 +76,7 @@ public class WebsitSalesLogic {
|
|
|
private final AllInPayLogic allInPayLogic;
|
|
|
private final AdminWebsitPayConfigService adminWebsitPayConfigService;
|
|
|
private final WorkerGoodsRelaService workerGoodsRelaService;
|
|
|
+ private final MaterialConfigService materialConfigService;
|
|
|
|
|
|
public IPage<WebsitSalesVO> page(WebsitSalesParamBean zfireParamBean) {
|
|
|
AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
@@ -175,13 +176,15 @@ public class WebsitSalesLogic {
|
|
|
.setSaleAmount(item.getPrice().multiply(item.getSalesQty()).setScale(2, BigDecimal.ROUND_HALF_UP));
|
|
|
|
|
|
itemList.add(item);
|
|
|
+ }
|
|
|
+
|
|
|
+ this.goodsConditionHandle(sales, itemList);
|
|
|
|
|
|
+ for (WebsitSalesItem item : itemList) {
|
|
|
totalAmount = totalAmount.add(item.getSaleAmount());
|
|
|
}
|
|
|
sales.setTotalAmount(totalAmount);
|
|
|
|
|
|
- this.goodsConditionHandle(sales, itemList);
|
|
|
-
|
|
|
websitSalesItemService.saveBatch(itemList);
|
|
|
}
|
|
|
|
|
@@ -245,6 +248,28 @@ public class WebsitSalesLogic {
|
|
|
.setConvertBitScale(1)
|
|
|
.setManageWorkerStock(goods.getManageWorkerStock());
|
|
|
|
|
|
+ // 商品类型为配件时单价要先乘倍率
|
|
|
+ if (sales.getGoodsType().equals(WebsitGoodsTypeEnum.P.getKey())) {
|
|
|
+ final MaterialConfig config = materialConfigService.lambdaQuery()
|
|
|
+ .eq(MaterialConfig::getCompanyWechatId, goods.getCompanyWechatId())
|
|
|
+ .one();
|
|
|
+ BigDecimal afterPrice;
|
|
|
+ switch (goods.getPartType()) {
|
|
|
+ case "空调":
|
|
|
+ afterPrice = goods.getMarketPrice().multiply(config.getPriceRate1());
|
|
|
+ break;
|
|
|
+ case "冰箱":
|
|
|
+ afterPrice = goods.getMarketPrice().multiply(config.getPriceRate2());
|
|
|
+ break;
|
|
|
+ case "生活电器":
|
|
|
+ afterPrice = goods.getMarketPrice().multiply(config.getPriceRate3());
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ throw new RemoteServiceException("未找到对应配件类型倍率");
|
|
|
+ }
|
|
|
+ item.setPrice(afterPrice);
|
|
|
+ }
|
|
|
+
|
|
|
BigDecimal convertQty = item.getSalesQty().divide(goods.getGoodsSalesConvertQty(), 1, BigDecimal.ROUND_UP);
|
|
|
BigDecimal totalSaleValue = item.getSalesQty().multiply(item.getPrice());
|
|
|
BigDecimal convertPrice = totalSaleValue.divide(convertQty, 2, BigDecimal.ROUND_DOWN);
|
|
@@ -252,6 +277,7 @@ public class WebsitSalesLogic {
|
|
|
if (sales.getGoodsType().equals(WebsitGoodsTypeEnum.P.getKey()) || goods.getGoodsSalesConvertQty().compareTo(BigDecimal.ONE) == 0) {
|
|
|
convertQty = item.getSalesQty();
|
|
|
convertPrice = item.getPrice();
|
|
|
+ item.setSaleAmount(totalSaleValue);
|
|
|
}
|
|
|
|
|
|
// 类型为辅材时注入师傅辅材id
|
|
@@ -321,13 +347,15 @@ public class WebsitSalesLogic {
|
|
|
.setGoodsType(sales.getGoodsType())
|
|
|
.setSaleAmount(item.getPrice().multiply(item.getSalesQty()).setScale(2, BigDecimal.ROUND_HALF_UP));
|
|
|
itemList.add(item);
|
|
|
+ }
|
|
|
|
|
|
+ this.goodsConditionHandle(sales, itemList);
|
|
|
+
|
|
|
+ for (WebsitSalesItem item : itemList) {
|
|
|
totalAmount = totalAmount.add(item.getSaleAmount());
|
|
|
}
|
|
|
sales.setTotalAmount(totalAmount);
|
|
|
|
|
|
- this.goodsConditionHandle(sales, itemList);
|
|
|
-
|
|
|
websitSalesItemService.saveBatch(itemList);
|
|
|
}
|
|
|
|