Przeglądaj źródła

1.达沃特问题修改
2.增加返利参数

纪新园 1 miesiąc temu
rodzic
commit
040644c1c8

+ 20 - 22
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/mapper/OrderMapper.xml

@@ -457,30 +457,28 @@
     </select>
     <select id="orderInventory"  resultType="org.springblade.purchase.sales.vo.OrderVO">
         SELECT
-            bo.id,
-            bo.order_no,
-            bo.busines_date,
-            item.corp_id,
-            SUM(item.order_quantity) as orderQuantity
+        bo.id,
+        bo.order_no,
+        bo.busines_date,
+        item.corp_id,
+        SUM(item.order_quantity) as orderQuantity
         FROM
-            business_order bo
-            LEFT JOIN business_order_items item ON bo.id = item.pid
+        business_order bo
+        LEFT JOIN business_order_items item ON bo.id = item.pid
         WHERE
-            bo.is_deleted = '0'
-            AND bo.`status` != '0'
-            AND item.is_deleted = '0'
-            AND bo.tenant_id = #{tenantId}
-            AND bo.trade_type = #{tradeType}
-            AND bo.bill_type = #{billType}
-            AND item.item_id = #{itemId}
-            AND item.corp_id = #{corpId}
-            <if test='storageId != null'>
-                AND item.storage_id = #{storageId}
-            </if>
-            <if test='tenantId != null and tenantId != "" and tenantId == tenantId'>
-                and bo.actual_delivery_date is NULL
-                AND bo.order_status NOT IN ('录入')
-            </if>
+        bo.is_deleted = '0'
+        AND bo.`status` != '0'
+        AND item.is_deleted = '0'
+        AND bo.tenant_id = #{tenantId}
+        AND bo.trade_type = #{tradeType}
+        AND bo.bill_type = #{billType}
+        AND item.item_id = #{itemId}
+        AND item.corp_id = #{corpId}
+        <if test='storageId != null'>
+            AND item.storage_id = #{storageId}
+        </if>
+        and bo.actual_delivery_date is NULL
+        AND bo.order_status NOT IN ('录入')
         GROUP BY bo.id,
         bo.actual_delivery_date,
         bo.order_no,

+ 11 - 4
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/service/impl/OrderServiceImpl.java

@@ -586,10 +586,17 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 				//有销售政策:产生返利=销售明细中的(特价-真实特价)X 条数 的明细和
 				correctCreateProfit = list.stream().filter(e -> ObjectUtils.isNotNull(e.getPriceType())).
 					reduce(BigDecimal.ZERO, (x, y) -> x.add((y.getPrice().subtract(y.getRealSpecialOffer() == null ? BigDecimal.ZERO : y.getRealSpecialOffer())).multiply(y.getOrderQuantity())), BigDecimal::add);
-
-				//无销售政策:产生返利=(单价*数量)* (2%+1%+1%)
-				faultCreateProfit = list.stream().filter(e -> ObjectUtils.isNull(e.getPriceType())).
-					reduce(BigDecimal.ZERO, (x, y) -> x.add((y.getPrice().multiply(y.getOrderQuantity())).multiply(new BigDecimal(0.04))), BigDecimal::add);
+				String interestRate = sysClient.getParamService("interest.rate");
+				if(ObjectUtils.isNotNull(interestRate) && !"681169".equals(AuthUtil.getTenantId())){
+					BigDecimal rate = new BigDecimal(interestRate).divide(new BigDecimal("100"),2,RoundingMode.HALF_DOWN);
+					//无销售政策:产生返利=(单价*数量)* (2%+1%+1%)
+					faultCreateProfit = list.stream().filter(e -> ObjectUtils.isNull(e.getPriceType())).
+						reduce(BigDecimal.ZERO, (x, y) -> x.add((y.getPrice().multiply(y.getOrderQuantity())).multiply(rate)), BigDecimal::add);
+				}else{
+					//无销售政策:产生返利=(单价*数量)* (2%+1%+1%)
+					faultCreateProfit = list.stream().filter(e -> ObjectUtils.isNull(e.getPriceType())).
+						reduce(BigDecimal.ZERO, (x, y) -> x.add((y.getPrice().multiply(y.getOrderQuantity())).multiply(new BigDecimal(0.04))), BigDecimal::add);
+				}
 
 				//最终销售订单中产生返利=有销售政策:产生返利+无销售政策:产生返利
 				order.setCreateProfit(correctCreateProfit.add(faultCreateProfit));

+ 3 - 4
blade-service/blade-stock/src/main/java/org/springblade/stock/mapper/StockGoodsMapper.xml

@@ -668,10 +668,9 @@
         <if test='corpId != null'>
             and item.corp_id = #{corpId}
         </if>
-        <if test='tenantId != null and tenantId != "" and tenantId == tenantId'>
-            and bo.actual_delivery_date is NULL
-            AND bo.order_status NOT IN ('录入')
-        </if>
+        and bo.actual_delivery_date is NULL
+        AND bo.order_status NOT IN ('录入')
+
         GROUP BY bo.id,
         bo.actual_delivery_date,
         bo.order_no,