Browse Source

2022年11月2日 19:24

wangzhuo 3 years ago
parent
commit
a5077f99eb

+ 7 - 0
blade-service-api/blade-purchase-sales-api/src/main/java/org/springblade/purchase/sales/entity/Order.java

@@ -908,6 +908,13 @@ public class Order implements Serializable {
 	private Date deliverTime;
 
 	/**
+	 * 确认收货时间
+	 */
+	@ApiModelProperty(value = "确认收货时间")
+	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+	private Date receiptTime;
+
+	/**
 	 * 收货数量
 	 */
 	@ApiModelProperty(value = "收货数量")

+ 1 - 1
blade-service-api/blade-purchase-sales-api/src/main/java/org/springblade/purchase/sales/vo/OrderStatisticsVo.java

@@ -40,7 +40,7 @@ public class OrderStatisticsVo implements Serializable {
 	/**
 	 * 发货数量
 	 */
-	private BigDecimal quantity;
+	private Integer quantity;
 
 	/**
 	 * 销售收入

+ 12 - 12
blade-service-api/blade-purchase-sales-api/src/main/java/org/springblade/purchase/sales/vo/TotalSummaryVo.java

@@ -30,7 +30,7 @@ public class TotalSummaryVo implements Serializable {
 	/**
 	 * 一月数量
 	 */
-	private BigDecimal quantity1;
+	private Integer quantity1;
 
 	/**
 	 * 一月金额
@@ -40,7 +40,7 @@ public class TotalSummaryVo implements Serializable {
 	/**
 	 * 二月数量
 	 */
-	private BigDecimal quantity2;
+	private Integer quantity2;
 
 	/**
 	 * 二月金额
@@ -50,7 +50,7 @@ public class TotalSummaryVo implements Serializable {
 	/**
 	 * 三月数量
 	 */
-	private BigDecimal quantity3;
+	private Integer quantity3;
 
 	/**
 	 * 三月金额
@@ -60,7 +60,7 @@ public class TotalSummaryVo implements Serializable {
 	/**
 	 * 四月数量
 	 */
-	private BigDecimal quantity4;
+	private Integer quantity4;
 
 	/**
 	 * 四月金额
@@ -70,7 +70,7 @@ public class TotalSummaryVo implements Serializable {
 	/**
 	 * 五月数量
 	 */
-	private BigDecimal quantity5;
+	private Integer quantity5;
 
 	/**
 	 * 五月金额
@@ -80,7 +80,7 @@ public class TotalSummaryVo implements Serializable {
 	/**
 	 * 六月数量
 	 */
-	private BigDecimal quantity6;
+	private Integer quantity6;
 
 	/**
 	 * 六月金额
@@ -90,7 +90,7 @@ public class TotalSummaryVo implements Serializable {
 	/**
 	 * 七月数量
 	 */
-	private BigDecimal quantity7;
+	private Integer quantity7;
 
 	/**
 	 * 七月金额
@@ -100,7 +100,7 @@ public class TotalSummaryVo implements Serializable {
 	/**
 	 * 八月数量
 	 */
-	private BigDecimal quantity8;
+	private Integer quantity8;
 
 	/**
 	 * 八月金额
@@ -110,7 +110,7 @@ public class TotalSummaryVo implements Serializable {
 	/**
 	 * 九月数量
 	 */
-	private BigDecimal quantity9;
+	private Integer quantity9;
 
 	/**
 	 * 九月金额
@@ -120,7 +120,7 @@ public class TotalSummaryVo implements Serializable {
 	/**
 	 * 十月数量
 	 */
-	private BigDecimal quantity10;
+	private Integer quantity10;
 
 	/**
 	 * 十月金额
@@ -130,7 +130,7 @@ public class TotalSummaryVo implements Serializable {
 	/**
 	 * 十一月数量
 	 */
-	private BigDecimal quantity11;
+	private Integer quantity11;
 
 	/**
 	 * 十一月金额
@@ -140,7 +140,7 @@ public class TotalSummaryVo implements Serializable {
 	/**
 	 * 十二月数量
 	 */
-	private BigDecimal quantity12;
+	private Integer quantity12;
 
 	/**
 	 * 十二月金额

+ 1 - 0
blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/service/impl/DeliveryServiceImpl.java

@@ -419,6 +419,7 @@ public class DeliveryServiceImpl extends ServiceImpl<DeliveryMapper, Delivery> i
 				orderTemp.setDeliverQuantity(BigDecimal.ZERO);
 			}
 			baseMapper.updateById(delivery);
+			orderTemp.setReceiptTime(delivery.getBusinessDate());
 			orderDescClient.updateOrder(orderTemp);
 
 			if (delivery.getDeliveryType().equals(DeliveryEnum.REPEAL.getType())) {

+ 5 - 1
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/export/ExportOrderController.java

@@ -1128,6 +1128,10 @@ public class ExportOrderController extends BladeController {
 	public void totalSummaryExport(TotalSummaryVo totalSummaryVo, HttpServletResponse response){
 		totalSummaryVo.setTenantId(SecureUtil.getTenantId());
 		List<TotalSummaryExcel> list = orderService.totalSummaryExport(totalSummaryVo);
-		ExcelUtil.export(response, totalSummaryVo.getYear() + "数量金额汇总对比统计", totalSummaryVo.getYear() + "数量金额汇总对比统计", list, TotalSummaryExcel.class);
+		if (ObjectUtil.isNotEmpty(totalSummaryVo.getYear())){
+			ExcelUtil.export(response, totalSummaryVo.getYear() + "数量金额汇总对比统计", totalSummaryVo.getYear() + "数量金额汇总对比统计", list, TotalSummaryExcel.class);
+		}else {
+			ExcelUtil.export(response, "数量金额汇总对比统计", "数量金额汇总对比统计", list, TotalSummaryExcel.class);
+		}
 	}
 }

+ 1 - 0
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/mapper/OrderItemsMapper.xml

@@ -479,6 +479,7 @@ WHERE
                  left join basic_goods_desc t4 on t2.item_id = t4.id
         <where>
             t1.is_deleted = 0
+            and t2.is_deleted = 0
             and t1.trade_type = 'GN'
             and t1.bill_type = 'XS'
             and t1.tenant_id = #{dataset.tenantId}

+ 2 - 2
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/mapper/OrderMapper.java

@@ -280,12 +280,12 @@ public interface OrderMapper extends BaseMapper<Order> {
 	/**
 	 * 发货规格统计统计
 	 */
-	List<OrderStatisticsVo> specificationsProfit(IPage<OrderStatisticsVo> page,@Param("statisticsVo") OrderStatisticsVo statisticsVo, @Param("brand") String brand);
+	List<OrderStatisticsVo> specificationsProfit(IPage<OrderStatisticsVo> page,@Param("statisticsVo") OrderStatisticsVo statisticsVo, @Param("brand") String brand, @Param("chargeMember") String chargeMember);
 
 	/**
 	 * 发货规格统计导出
 	 */
-	List<SpecificationsProfitExcel> specificationsProfitExport(@Param("statisticsVo") OrderStatisticsVo statisticsVo, @Param("brand") String brand);
+	List<SpecificationsProfitExcel> specificationsProfitExport(@Param("statisticsVo") OrderStatisticsVo statisticsVo, @Param("brand") String brand,  @Param("chargeMember") String chargeMember);
 
 	/**
 	 * 数量金额汇总对比统计

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

@@ -1362,6 +1362,7 @@ ORDER BY
                 IFNULL( SUM( actual_quantity ), 0 ) AS quantity
             FROM
                 business_order_items
+            WHERE is_deleted = 0
             GROUP BY
                 pid
         ) BOI ON BOI.pid = BO.id
@@ -1371,6 +1372,7 @@ ORDER BY
             BO.tenant_id = #{statisticsVo.tenantId}
             and BO.is_deleted = 0
             and BO.bill_type = 'XS'
+            AND BO.receipt_time IS NOT NULL
             <if test="statisticsVo.brand != null and statisticsVo.brand != ''">
                 and BGD.brand in
                 <foreach item="item" index="index" collection="brand.split(',')" open="(" separator="," close=")">
@@ -1384,10 +1386,10 @@ ORDER BY
                 </foreach>
             </if>
             <if test="statisticsVo.beginTime !=null and statisticsVo.beginTime != ''">
-                and BO.actual_delivery_date &gt;= #{statisticsVo.beginTime}
+                and BO.receipt_time &gt;= #{statisticsVo.beginTime}
             </if>
             <if test="statisticsVo.endTime !=null and statisticsVo.endTime != ''">
-                and BO.actual_delivery_date &lt;= #{statisticsVo.endTime}
+                and BO.receipt_time &lt;= #{statisticsVo.endTime}
             </if>
         </where>
         GROUP BY BCD.cname
@@ -1409,6 +1411,7 @@ ORDER BY
                 IFNULL( SUM( actual_quantity ), 0 ) AS quantity
             FROM
                 business_order_items
+            WHERE is_deleted = 0
             GROUP BY
             pid
         ) BOI ON BOI.pid = BO.id
@@ -1418,6 +1421,7 @@ ORDER BY
             BO.tenant_id = #{statisticsVo.tenantId}
             and BO.is_deleted = 0
             and BO.bill_type = 'XS'
+            AND BO.receipt_time IS NOT NULL
             <if test="statisticsVo.brand != null and statisticsVo.brand != ''">
                 and BGD.brand in
                 <foreach item="item" index="index" collection="brand.split(',')" open="(" separator="," close=")">
@@ -1431,10 +1435,10 @@ ORDER BY
                 </foreach>
             </if>
             <if test="statisticsVo.beginTime !=null and statisticsVo.beginTime != ''">
-                and BO.actual_delivery_date &gt;= #{statisticsVo.beginTime}
+                and BO.receipt_time &gt;= #{statisticsVo.beginTime}
             </if>
             <if test="statisticsVo.endTime !=null and statisticsVo.endTime != ''">
-                and BO.actual_delivery_date &lt;= #{statisticsVo.endTime}
+                and BO.receipt_time &lt;= #{statisticsVo.endTime}
             </if>
         </where>
         GROUP BY BCD.cname
@@ -1455,6 +1459,7 @@ ORDER BY
                 IFNULL( SUM( actual_quantity ), 0 ) AS quantity
             FROM
                 business_order_items
+            WHERE is_deleted = 0
             GROUP BY
             pid
         ) BOI ON BOI.pid = BO.id
@@ -1463,6 +1468,7 @@ ORDER BY
             BO.tenant_id = #{statisticsVo.tenantId}
             and BO.is_deleted = 0
             and BO.bill_type = 'XS'
+            AND BO.receipt_time IS NOT NULL
             <if test="statisticsVo.brand != null and statisticsVo.brand != ''">
                 and BGD.brand in
                 <foreach item="item" index="index" collection="brand.split(',')" open="(" separator="," close=")">
@@ -1476,10 +1482,10 @@ ORDER BY
                 </foreach>
             </if>
             <if test="statisticsVo.beginTime !=null and statisticsVo.beginTime != ''">
-                and BO.actual_delivery_date &gt;= #{statisticsVo.beginTime}
+                and BO.receipt_time &gt;= #{statisticsVo.beginTime}
             </if>
             <if test="statisticsVo.endTime !=null and statisticsVo.endTime != ''">
-                and BO.actual_delivery_date &lt;= #{statisticsVo.endTime}
+                and BO.receipt_time &lt;= #{statisticsVo.endTime}
             </if>
         </where>
         GROUP BY BO.charge_member
@@ -1500,6 +1506,7 @@ ORDER BY
                 IFNULL( SUM( actual_quantity ), 0 ) AS quantity
             FROM
                 business_order_items
+            WHERE is_deleted = 0
             GROUP BY
             pid
         ) BOI ON BOI.pid = BO.id
@@ -1508,6 +1515,7 @@ ORDER BY
             BO.tenant_id = #{statisticsVo.tenantId}
             and BO.is_deleted = 0
             and BO.bill_type = 'XS'
+            AND BO.receipt_time IS NOT NULL
             <if test="statisticsVo.brand != null and statisticsVo.brand != ''">
                 and BGD.brand in
                 <foreach item="item" index="index" collection="brand.split(',')" open="(" separator="," close=")">
@@ -1521,7 +1529,7 @@ ORDER BY
                 </foreach>
             </if>
             <if test="statisticsVo.endTime !=null and statisticsVo.endTime != ''">
-                and BO.actual_delivery_date &lt;= #{statisticsVo.endTime}
+                and BO.receipt_time &lt;= #{statisticsVo.endTime}
             </if>
         </where>
         GROUP BY BO.charge_member
@@ -1548,6 +1556,7 @@ ORDER BY
                 IFNULL( SUM( purchase_amount ), 0 ) AS purchaseAmount
             FROM
                 business_order_items
+            WHERE is_deleted = 0
             GROUP BY
             pid
         ) BOI ON BOI.pid = BO.id
@@ -1556,6 +1565,7 @@ ORDER BY
             BO.tenant_id = #{statisticsVo.tenantId}
             and BO.is_deleted = 0
             and BO.bill_type = 'XS'
+            AND BO.receipt_time IS NOT NULL
             <if test="statisticsVo.brand != null and statisticsVo.brand != ''">
                 and BGD.brand in
                 <foreach item="item" index="index" collection="brand.split(',')" open="(" separator="," close=")">
@@ -1563,10 +1573,10 @@ ORDER BY
                 </foreach>
             </if>
             <if test="statisticsVo.beginTime !=null and statisticsVo.beginTime != ''">
-                and BO.actual_delivery_date &gt;= #{statisticsVo.beginTime}
+                and BO.receipt_time &gt;= #{statisticsVo.beginTime}
             </if>
             <if test="statisticsVo.endTime !=null and statisticsVo.endTime != ''">
-                and BO.actual_delivery_date &lt;= #{statisticsVo.endTime}
+                and BO.receipt_time &lt;= #{statisticsVo.endTime}
             </if>
         </where>
         GROUP BY BO.charge_member
@@ -1593,6 +1603,7 @@ ORDER BY
                 IFNULL( SUM( purchase_amount ), 0 ) AS purchaseAmount
             FROM
                 business_order_items
+            WHERE is_deleted = 0
             GROUP BY
             pid
         ) BOI ON BOI.pid = BO.id
@@ -1601,6 +1612,7 @@ ORDER BY
             BO.tenant_id = #{statisticsVo.tenantId}
             and BO.is_deleted = 0
             and BO.bill_type = 'XS'
+            AND BO.receipt_time IS NOT NULL
             <if test="statisticsVo.brand != null and statisticsVo.brand != ''">
                 and BGD.brand in
                 <foreach item="item" index="index" collection="brand.split(',')" open="(" separator="," close=")">
@@ -1608,10 +1620,10 @@ ORDER BY
                 </foreach>
             </if>
             <if test="statisticsVo.beginTime !=null and statisticsVo.beginTime != ''">
-                and BO.actual_delivery_date &gt;= #{statisticsVo.beginTime}
+                and BO.receipt_time &gt;= #{statisticsVo.beginTime}
             </if>
             <if test="statisticsVo.endTime !=null and statisticsVo.endTime != ''">
-                and BO.actual_delivery_date &lt;= #{statisticsVo.endTime}
+                and BO.receipt_time &lt;= #{statisticsVo.endTime}
             </if>
         </where>
         GROUP BY BO.charge_member
@@ -1638,6 +1650,7 @@ ORDER BY
         IFNULL( SUM( purchase_amount ), 0 ) AS purchaseAmount
         FROM
         business_order_items
+        WHERE is_deleted = 0
         GROUP BY
         pid
         ) BOI ON BOI.pid = BO.id
@@ -1647,6 +1660,7 @@ ORDER BY
             BO.tenant_id = #{statisticsVo.tenantId}
             and BO.is_deleted = 0
             and BO.bill_type = 'XS'
+            AND BO.receipt_time IS NOT NULL
             <if test="statisticsVo.brand != null and statisticsVo.brand != ''">
                 and BGD.brand in
                 <foreach item="item" index="index" collection="brand.split(',')" open="(" separator="," close=")">
@@ -1654,10 +1668,10 @@ ORDER BY
                 </foreach>
             </if>
             <if test="statisticsVo.beginTime !=null and statisticsVo.beginTime != ''">
-                and BO.actual_delivery_date &gt;= #{statisticsVo.beginTime}
+                and BO.receipt_time &gt;= #{statisticsVo.beginTime}
             </if>
             <if test="statisticsVo.endTime !=null and statisticsVo.endTime != ''">
-                and BO.actual_delivery_date &lt;= #{statisticsVo.endTime}
+                and BO.receipt_time &lt;= #{statisticsVo.endTime}
             </if>
         </where>
         GROUP BY BCD.cname
@@ -1684,6 +1698,7 @@ ORDER BY
                 IFNULL( SUM( purchase_amount ), 0 ) AS purchaseAmount
             FROM
                 business_order_items
+            WHERE is_deleted = 0
             GROUP BY
             pid
         ) BOI ON BOI.pid = BO.id
@@ -1693,6 +1708,7 @@ ORDER BY
             BO.tenant_id = #{statisticsVo.tenantId}
             and BO.is_deleted = 0
             and BO.bill_type = 'XS'
+            AND BO.receipt_time IS NOT NULL
             <if test="statisticsVo.brand != null and statisticsVo.brand != ''">
                 and BGD.brand in
                 <foreach item="item" index="index" collection="brand.split(',')" open="(" separator="," close=")">
@@ -1700,10 +1716,10 @@ ORDER BY
                 </foreach>
             </if>
             <if test="statisticsVo.beginTime !=null and statisticsVo.beginTime != ''">
-                and BO.actual_delivery_date &gt;= #{statisticsVo.beginTime}
+                and BO.receipt_time &gt;= #{statisticsVo.beginTime}
             </if>
             <if test="statisticsVo.endTime !=null and statisticsVo.endTime != ''">
-                and BO.actual_delivery_date &lt;= #{statisticsVo.endTime}
+                and BO.receipt_time &lt;= #{statisticsVo.endTime}
             </if>
         </where>
         GROUP BY BCD.cname
@@ -1729,9 +1745,10 @@ ORDER BY
                     pid,
                     item_id,
                     IFNULL( SUM( actual_quantity ), 0 ) AS quantity,
-                    IFNULL( SUM( purchase_amount ), 0 ) AS purchaseAmount
+                    IFNULL( SUM( actual_quantity * purchase_amount ), 0 ) AS purchaseAmount
                 FROM
                     business_order_items
+                WHERE is_deleted = 0
                 GROUP BY
                     pid
             ) BOI ON BOI.pid = BO.id
@@ -1740,6 +1757,7 @@ ORDER BY
             BO.tenant_id = #{statisticsVo.tenantId}
             and BO.is_deleted = 0
             and BO.bill_type = 'XS'
+            AND BO.receipt_time IS NOT NULL
             <if test="statisticsVo.brand != null and statisticsVo.brand != ''">
                 and BGD.brand in
                 <foreach item="item" index="index" collection="brand.split(',')" open="(" separator="," close=")">
@@ -1747,10 +1765,10 @@ ORDER BY
                 </foreach>
             </if>
             <if test="statisticsVo.beginTime !=null and statisticsVo.beginTime != ''">
-                and BO.actual_delivery_date &gt;= #{statisticsVo.beginTime}
+                and BO.receipt_time &gt;= #{statisticsVo.beginTime}
             </if>
             <if test="statisticsVo.endTime !=null and statisticsVo.endTime != ''">
-                and BO.actual_delivery_date &lt;= #{statisticsVo.endTime}
+                and BO.receipt_time &lt;= #{statisticsVo.endTime}
             </if>
         </where>
         GROUP BY
@@ -1778,9 +1796,10 @@ ORDER BY
                 pid,
                 item_id,
                 IFNULL( SUM( actual_quantity ), 0 ) AS quantity,
-                IFNULL( SUM( purchase_amount ), 0 ) AS purchaseAmount
+                IFNULL( SUM( actual_quantity * purchase_amount ), 0 ) AS purchaseAmount
             FROM
                 business_order_items
+            WHERE is_deleted = 0
             GROUP BY pid
         ) BOI ON BOI.pid = BO.id
         LEFT JOIN basic_goods_desc BGD ON BGD.id = BOI.item_id
@@ -1788,6 +1807,7 @@ ORDER BY
             BO.tenant_id = #{statisticsVo.tenantId}
             and BO.is_deleted = 0
             and BO.bill_type = 'XS'
+            AND BO.receipt_time IS NOT NULL
             <if test="statisticsVo.brand != null and statisticsVo.brand != ''">
                 and BGD.brand in
                 <foreach item="item" index="index" collection="brand.split(',')" open="(" separator="," close=")">
@@ -1795,10 +1815,10 @@ ORDER BY
                 </foreach>
             </if>
             <if test="statisticsVo.beginTime !=null and statisticsVo.beginTime != ''">
-                and BO.actual_delivery_date &gt;= #{statisticsVo.beginTime}
+                and BO.receipt_time &gt;= #{statisticsVo.beginTime}
             </if>
             <if test="statisticsVo.endTime !=null and statisticsVo.endTime != ''">
-                and BO.actual_delivery_date &lt;= #{statisticsVo.endTime}
+                and BO.receipt_time &lt;= #{statisticsVo.endTime}
             </if>
         </where>
         GROUP BY BGD.brand
@@ -1816,25 +1836,28 @@ ORDER BY
                     BGD.brand AS brand,
                     BGD.brand_item AS brandItem,
                     SUM( BOI.quantity ) AS quantity,
-                    SUM( BO.debit_amount ) AS amount
+                    SUM( BOI.amount ) AS amount
                 FROM
                     business_order BO
                         LEFT JOIN (
                         SELECT
+                            id,
                             pid,
                             item_id,
                             IFNULL( SUM( actual_quantity ), 0 ) AS quantity,
-                            IFNULL( SUM( purchase_amount ), 0 ) AS purchaseAmount
+                            IFNULL( SUM( actual_quantity * price ), 0 ) AS amount
                         FROM
                             business_order_items
+                        WHERE is_deleted = 0
                         GROUP BY
-                            pid
+                            id
                     ) BOI ON BOI.pid = BO.id
-                        LEFT JOIN basic_goods_desc BGD ON BGD.id = BOI.item_id
+                LEFT JOIN basic_goods_desc BGD ON BGD.id = BOI.item_id
                 <where>
                     BO.tenant_id = #{statisticsVo.tenantId}
                     and BO.is_deleted = 0
                     and BO.bill_type = 'XS'
+                    AND BO.receipt_time IS NOT NULL
                     <if test="statisticsVo.brand != null and statisticsVo.brand != ''">
                         and BGD.brand in
                         <foreach item="item" index="index" collection="brand.split(',')" open="(" separator="," close=")">
@@ -1842,17 +1865,20 @@ ORDER BY
                         </foreach>
                     </if>
                     <if test="statisticsVo.chargeMember != null and statisticsVo.chargeMember != ''">
-                        BO.charge_member in #{statisticsVo.chargeMember}
+                        and BO.charge_member in
+                        <foreach item="member" index="index" collection="chargeMember.split(',')" open="(" separator="," close=")">
+                            '${member}'
+                        </foreach>
                     </if>
                     <if test="statisticsVo.beginTime !=null and statisticsVo.beginTime != ''">
-                        and BO.actual_delivery_date &gt;= #{statisticsVo.beginTime}
+                        and BO.receipt_time &gt;= #{statisticsVo.beginTime}
                     </if>
                     <if test="statisticsVo.endTime !=null and statisticsVo.endTime != ''">
-                        and BO.actual_delivery_date &lt;= #{statisticsVo.endTime}
+                        and BO.receipt_time &lt;= #{statisticsVo.endTime}
                     </if>
                 </where>
                 GROUP BY
-                    BGD.Typeno
+                    BGD.code
                 ORDER BY
                     quantity DESC
             ) temp,
@@ -1870,25 +1896,28 @@ ORDER BY
                     BGD.brand AS brand,
                     BGD.brand_item AS brandItem,
                     SUM( BOI.quantity ) AS quantity,
-                    SUM( BO.debit_amount ) AS amount
+                    SUM( BOI.amount ) AS amount
                 FROM
                     business_order BO
                         LEFT JOIN (
                         SELECT
+                            id,
                             pid,
                             item_id,
                             IFNULL( SUM( actual_quantity ), 0 ) AS quantity,
-                            IFNULL( SUM( purchase_amount ), 0 ) AS purchaseAmount
+                            IFNULL( SUM( actual_quantity * price ), 0 ) AS amount
                         FROM
                             business_order_items
+                        WHERE is_deleted = 0
                         GROUP BY
-                            pid
+                            id
                     ) BOI ON BOI.pid = BO.id
                         LEFT JOIN basic_goods_desc BGD ON BGD.id = BOI.item_id
                 <where>
                     BO.tenant_id = #{statisticsVo.tenantId}
                     and BO.is_deleted = 0
                     and BO.bill_type = 'XS'
+                    AND BO.receipt_time IS NOT NULL
                     <if test="statisticsVo.brand != null and statisticsVo.brand != ''">
                         and BGD.brand in
                         <foreach item="item" index="index" collection="brand.split(',')" open="(" separator="," close=")">
@@ -1896,17 +1925,20 @@ ORDER BY
                         </foreach>
                     </if>
                     <if test="statisticsVo.chargeMember != null and statisticsVo.chargeMember != ''">
-                        BO.charge_member in #{statisticsVo.chargeMember}
+                        and BO.charge_member in
+                        <foreach item="member" index="index" collection="chargeMember.split(',')" open="(" separator="," close=")">
+                            '${member}'
+                        </foreach>
                     </if>
                     <if test="statisticsVo.beginTime !=null and statisticsVo.beginTime != ''">
-                        and BO.actual_delivery_date &gt;= #{statisticsVo.beginTime}
+                        and BO.receipt_time &gt;= #{statisticsVo.beginTime}
                     </if>
                     <if test="statisticsVo.endTime !=null and statisticsVo.endTime != ''">
-                        and BO.actual_delivery_date &lt;= #{statisticsVo.endTime}
+                        and BO.receipt_time &lt;= #{statisticsVo.endTime}
                     </if>
                 </where>
                 GROUP BY
-                    BGD.Typeno
+                    BGD.code
                 ORDER BY
                     quantity DESC
             ) temp,
@@ -2113,6 +2145,7 @@ ORDER BY
             BO.tenant_id = #{totalSummaryVo.tenantId}
             and BO.is_deleted = 0
             and BO.bill_type = 'XS'
+            AND BO.receipt_time IS NOT NULL
             <if test="totalSummaryVo.brand != null and totalSummaryVo.brand != ''">
                 and BGD.brand in
                 <foreach item="item" index="index" collection="brand.split(',')" open="(" separator="," close=")">
@@ -2122,7 +2155,7 @@ ORDER BY
             <if test="totalSummaryVo.year !=null and totalSummaryVo.year != ''">
                 AND YEAR ( BO.create_time ) = #{totalSummaryVo.year}
             </if>
-            <if test="totalSummaryVo.status != null and totalSummaryVo.status != '' and totalSummaryVo.status = '0'">
+            <if test="totalSummaryVo.status != null and totalSummaryVo.status != '' and totalSummaryVo.status == 0">
                 AND BO.create_deliver not in (#{totalSummaryVo.status})
             </if>
         </where>
@@ -2330,6 +2363,7 @@ ORDER BY
             BO.tenant_id = #{totalSummaryVo.tenantId}
             and BO.is_deleted = 0
             and BO.bill_type = 'XS'
+            AND BO.receipt_time IS NOT NULL
             <if test="totalSummaryVo.brand != null and totalSummaryVo.brand != ''">
                 and BGD.brand in
                 <foreach item="item" index="index" collection="brand.split(',')" open="(" separator="," close=")">
@@ -2339,7 +2373,7 @@ ORDER BY
             <if test="totalSummaryVo.year !=null and totalSummaryVo.year != ''">
                 AND YEAR ( BO.create_time ) = #{totalSummaryVo.year}
             </if>
-            <if test="totalSummaryVo.status != null and totalSummaryVo.status != '' and totalSummaryVo.status = '0'">
+            <if test="totalSummaryVo.status != null and totalSummaryVo.status != '' and totalSummaryVo.status == 0">
                 AND BO.create_deliver not in (#{totalSummaryVo.status})
             </if>
         </where>

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

@@ -1755,7 +1755,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 	 */
 	@Override
 	public IPage<OrderStatisticsVo> specificationsProfit(IPage<OrderStatisticsVo> page, OrderStatisticsVo statisticsVo){
-		return page.setRecords(baseMapper.specificationsProfit(page, statisticsVo,statisticsVo.getBrand()));
+		return page.setRecords(baseMapper.specificationsProfit(page, statisticsVo,statisticsVo.getBrand(), statisticsVo.getChargeMember()));
 	}
 
 	/**
@@ -1763,7 +1763,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 	 */
 	@Override
 	public List<SpecificationsProfitExcel> specificationsProfitExport(OrderStatisticsVo statisticsVo){
-		return baseMapper.specificationsProfitExport(statisticsVo,statisticsVo.getBrand());
+		return baseMapper.specificationsProfitExport(statisticsVo,statisticsVo.getBrand(), statisticsVo.getChargeMember());
 	}
 
 	/**