浏览代码

2022年11月1日 18:34

wangzhuo 3 年之前
父节点
当前提交
3c86b266ea
共有 13 个文件被更改,包括 1441 次插入51 次删除
  1. 25 0
      blade-service-api/blade-purchase-sales-api/src/main/java/org/springblade/purchase/sales/entity/Order.java
  2. 31 1
      blade-service-api/blade-purchase-sales-api/src/main/java/org/springblade/purchase/sales/vo/OrderStatisticsVo.java
  3. 160 0
      blade-service-api/blade-purchase-sales-api/src/main/java/org/springblade/purchase/sales/vo/TotalSummaryVo.java
  4. 3 0
      blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/service/impl/DeliveryServiceImpl.java
  5. 89 0
      blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/excel/BrandProfitExcel.java
  6. 1 1
      blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/excel/CustomerProfitExcel.java
  7. 65 0
      blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/excel/SpecificationsProfitExcel.java
  8. 173 0
      blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/excel/TotalSummaryExcel.java
  9. 65 0
      blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/export/ExportOrderController.java
  10. 39 9
      blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/mapper/OrderMapper.java
  11. 704 32
      blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/mapper/OrderMapper.xml
  12. 30 0
      blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/service/IOrderService.java
  13. 56 8
      blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/service/impl/OrderServiceImpl.java

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

@@ -871,6 +871,31 @@ public class Order implements Serializable {
 	private Date createFreightTime;
 
 	/**
+	 * 生成发货
+	 */
+	@ApiModelProperty(value = "生成发货")
+	private Integer createDeliver;
+
+	/**
+	 * 是否生成发货
+	 */
+	@TableField(exist = false)
+	private Integer createDeliverName;
+
+	/**
+	 * 生成发货用户
+	 */
+	@ApiModelProperty(value = "生成发货用户")
+	private String createDeliverUser;
+
+	/**
+	 * 生成发货时间
+	 */
+	@ApiModelProperty(value = "生成发货时间")
+	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+	private Date createDeliverTime;
+
+	/**
 	 * 发货数量
 	 */
 	@ApiModelProperty(value = "发货数量")

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

@@ -13,7 +13,7 @@ import java.math.BigDecimal;
  */
 
 @Data
-public class OrderStatisticsVo  implements Serializable {
+public class OrderStatisticsVo implements Serializable {
 
 	private static final long serialVersionUID = 1L;
 
@@ -83,6 +83,36 @@ public class OrderStatisticsVo  implements Serializable {
 	private BigDecimal grossProfitRate;
 
 	/**
+	 * 平均单价
+	 */
+	private BigDecimal price;
+
+	/**
+	 *  单条毛利
+	 */
+	private BigDecimal singleGrossProfit;
+
+	/**
+	 * 品号
+	 */
+	private String code;
+
+	/**
+	 * 规格
+	 */
+	private String typeNo;
+
+	/**
+	 * 花纹
+	 */
+	private String brandItem;
+
+	/**
+	 * 数量占比排名
+	 */
+	private String rankNo;
+
+	/**
 	 * 开始时间
 	 */
 	private String beginTime;

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

@@ -0,0 +1,160 @@
+package org.springblade.purchase.sales.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * 统计分析 数量金额汇总表
+ *
+ * @author BladeX
+ * @since 2022-10-28
+ */
+
+@Data
+public class TotalSummaryVo implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * 租户
+	 */
+	private String tenantId;
+
+	/**
+	 * 品牌
+	 */
+	private String brand;
+
+	/**
+	 * 一月数量
+	 */
+	private BigDecimal quantity1;
+
+	/**
+	 * 一月金额
+	 */
+	private BigDecimal amount1;
+
+	/**
+	 * 二月数量
+	 */
+	private BigDecimal quantity2;
+
+	/**
+	 * 二月金额
+	 */
+	private BigDecimal amount2;
+
+	/**
+	 * 三月数量
+	 */
+	private BigDecimal quantity3;
+
+	/**
+	 * 三月金额
+	 */
+	private BigDecimal amount3;
+
+	/**
+	 * 四月数量
+	 */
+	private BigDecimal quantity4;
+
+	/**
+	 * 四月金额
+	 */
+	private BigDecimal amount4;
+
+	/**
+	 * 五月数量
+	 */
+	private BigDecimal quantity5;
+
+	/**
+	 * 五月金额
+	 */
+	private BigDecimal amount5;
+
+	/**
+	 * 六月数量
+	 */
+	private BigDecimal quantity6;
+
+	/**
+	 * 六月金额
+	 */
+	private BigDecimal amount6;
+
+	/**
+	 * 七月数量
+	 */
+	private BigDecimal quantity7;
+
+	/**
+	 * 七月金额
+	 */
+	private BigDecimal amount7;
+
+	/**
+	 * 八月数量
+	 */
+	private BigDecimal quantity8;
+
+	/**
+	 * 八月金额
+	 */
+	private BigDecimal amount8;
+
+	/**
+	 * 九月数量
+	 */
+	private BigDecimal quantity9;
+
+	/**
+	 * 九月金额
+	 */
+	private BigDecimal amount9;
+
+	/**
+	 * 十月数量
+	 */
+	private BigDecimal quantity10;
+
+	/**
+	 * 十月金额
+	 */
+	private BigDecimal amount10;
+
+	/**
+	 * 十一月数量
+	 */
+	private BigDecimal quantity11;
+
+	/**
+	 * 十一月金额
+	 */
+	private BigDecimal amount11;
+
+	/**
+	 * 十二月数量
+	 */
+	private BigDecimal quantity12;
+
+	/**
+	 * 十二月金额
+	 */
+	private BigDecimal amount12;
+
+	/**
+	 * 年份
+	 */
+	private String year;
+
+	/**
+	 * 含未发货订单状态
+	 */
+	private String status;
+
+}

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

@@ -802,6 +802,9 @@ public class DeliveryServiceImpl extends ServiceImpl<DeliveryMapper, Delivery> i
 			Order orderTemp = new Order();
 			orderTemp.setId(select.getSrcId());//销售主表id
 			orderTemp.setOrderStatus("待收货");
+			orderTemp.setCreateDeliver(1);
+			orderTemp.setCreateDeliverUser(AuthUtil.getUserId().toString());
+			orderTemp.setCreateDeliverTime(date);
 			orderTemp.setActualDeliveryDate(select.getBusinessDate());
 			if (select.getTotalQuantity().compareTo(BigDecimal.ZERO) == 0){
 				orderTemp.setDeliverQuantity(select.getTotalQuantity());

+ 89 - 0
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/excel/BrandProfitExcel.java

@@ -0,0 +1,89 @@
+package org.springblade.purchase.sales.excel;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
+import com.alibaba.excel.annotation.write.style.ContentRowHeight;
+import com.alibaba.excel.annotation.write.style.HeadRowHeight;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * 统计分析 分品牌利润对比导出
+ */
+@Data
+@ColumnWidth(25)
+@HeadRowHeight(20)
+@ContentRowHeight(18)
+public class BrandProfitExcel implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * 品牌
+	 */
+	@ExcelProperty(value = "品牌")
+	private String brand;
+
+	/**
+	 * 销售收入
+	 */
+	@ExcelProperty(value = "销售收入")
+	private BigDecimal amount;
+
+	/**
+	 * 销售成本
+	 */
+	@ExcelProperty(value = "销售成本")
+	private BigDecimal purchaseAmount;
+
+	/**
+	 * 发货数量
+	 */
+	@ExcelProperty(value = "发货数量")
+	private BigDecimal quantity;
+
+	/**
+	 * 返利
+	 */
+	@ExcelProperty(value = "返利")
+	private BigDecimal thisUsedProfit;
+
+	/**
+	 * 平均单价
+	 */
+	@ExcelProperty(value = "平均单价")
+	private BigDecimal price;
+
+	/**
+	 *  单条毛利
+	 */
+	@ExcelProperty(value = "单条毛利")
+	private BigDecimal singleGrossProfit;
+
+	/**
+	 * 订单运费
+	 */
+	@ExcelProperty(value = "订单运费")
+	private BigDecimal predictOceanFreight;
+
+	/**
+	 * 毛利额(不含返利)
+	 */
+	@ExcelProperty(value = "毛利额(不含返利)")
+	private BigDecimal netGrossProfit;
+
+	/**
+	 * 毛利额(含返利)
+	 */
+	@ExcelProperty(value = "毛利额(含返利)")
+	private BigDecimal grossProfit;
+
+	/**
+	 * 订单毛利率(含返利)
+	 */
+	@ExcelProperty(value = "订单毛利率(含返利)")
+	private BigDecimal grossProfitRate;
+
+}

+ 1 - 1
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/excel/CustomerProfitExcel.java

@@ -65,7 +65,7 @@ public class CustomerProfitExcel implements Serializable {
 	/**
 	 * 净毛利额
 	 */
-	@ExcelProperty(value = "净毛利额")
+	@ExcelProperty(value = "营业净利润")
 	private BigDecimal netGrossProfit;
 
 	/**

+ 65 - 0
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/excel/SpecificationsProfitExcel.java

@@ -0,0 +1,65 @@
+package org.springblade.purchase.sales.excel;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
+import com.alibaba.excel.annotation.write.style.ContentRowHeight;
+import com.alibaba.excel.annotation.write.style.HeadRowHeight;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * 统计分析 发货规格统计导出
+ */
+@Data
+@ColumnWidth(25)
+@HeadRowHeight(20)
+@ContentRowHeight(18)
+public class SpecificationsProfitExcel implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * 品号
+	 */
+	@ExcelProperty(value = "品号")
+	private String code;
+
+	/**
+	 * 规格
+	 */
+	@ExcelProperty(value = "规格")
+	private String typeNo;
+
+	/**
+	 * 品牌
+	 */
+	@ExcelProperty(value = "品牌")
+	private String brand;
+
+	/**
+	 * 花纹
+	 */
+	@ExcelProperty(value = "花纹")
+	private String brandItem;
+
+	/**
+	 * 数量
+	 */
+	@ExcelProperty(value = "数量")
+	private BigDecimal quantity;
+
+	/**
+	 * 数量占比排名
+	 */
+	@ExcelProperty(value = "数量占比排名")
+	private String rankNo;
+
+	/**
+	 * 金额
+	 */
+	@ExcelProperty(value = "金额")
+	private BigDecimal amount;
+
+}

+ 173 - 0
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/excel/TotalSummaryExcel.java

@@ -0,0 +1,173 @@
+package org.springblade.purchase.sales.excel;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
+import com.alibaba.excel.annotation.write.style.ContentRowHeight;
+import com.alibaba.excel.annotation.write.style.HeadRowHeight;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * 统计分析 数量金额汇总对比统计导出
+ */
+@Data
+@ColumnWidth(25)
+@HeadRowHeight(20)
+@ContentRowHeight(18)
+public class TotalSummaryExcel implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * 品牌
+	 */
+	@ExcelProperty(value = "品牌")
+	private String brand;
+
+	/**
+	 * 一月数量
+	 */
+	@ExcelProperty(value = "一月数量")
+	private BigDecimal quantity1;
+
+	/**
+	 * 一月金额
+	 */
+	@ExcelProperty(value = "一月金额")
+	private BigDecimal amount1;
+
+	/**
+	 * 二月数量
+	 */
+	@ExcelProperty(value = "二月数量")
+	private BigDecimal quantity2;
+
+	/**
+	 * 二月金额
+	 */
+	@ExcelProperty(value = "二月金额")
+	private BigDecimal amount2;
+
+	/**
+	 * 三月数量
+	 */
+	@ExcelProperty(value = "三月数量")
+	private BigDecimal quantity3;
+
+	/**
+	 * 三月金额
+	 */
+	@ExcelProperty(value = "三月金额")
+	private BigDecimal amount3;
+
+	/**
+	 * 四月数量
+	 */
+	@ExcelProperty(value = "四月数量")
+	private BigDecimal quantity4;
+
+	/**
+	 * 四月金额
+	 */
+	@ExcelProperty(value = "四月金额")
+	private BigDecimal amount4;
+
+	/**
+	 * 五月数量
+	 */
+	@ExcelProperty(value = "五月数量")
+	private BigDecimal quantity5;
+
+	/**
+	 * 五月金额
+	 */
+	@ExcelProperty(value = "五月金额")
+	private BigDecimal amount5;
+
+	/**
+	 * 六月数量
+	 */
+	@ExcelProperty(value = "六月数量")
+	private BigDecimal quantity6;
+
+	/**
+	 * 六月金额
+	 */
+	@ExcelProperty(value = "六月金额")
+	private BigDecimal amount6;
+
+	/**
+	 * 七月数量
+	 */
+	@ExcelProperty(value = "七月数量")
+	private BigDecimal quantity7;
+
+	/**
+	 * 七月金额
+	 */
+	@ExcelProperty(value = "七月金额")
+	private BigDecimal amount7;
+
+	/**
+	 * 八月数量
+	 */
+	@ExcelProperty(value = "八月数量")
+	private BigDecimal quantity8;
+
+	/**
+	 * 八月金额
+	 */
+	@ExcelProperty(value = "八月金额")
+	private BigDecimal amount8;
+
+	/**
+	 * 九月数量
+	 */
+	@ExcelProperty(value = "九月数量")
+	private BigDecimal quantity9;
+
+	/**
+	 * 九月金额
+	 */
+	@ExcelProperty(value = "九月金额")
+	private BigDecimal amount9;
+
+	/**
+	 * 十月数量
+	 */
+	@ExcelProperty(value = "十月数量")
+	private BigDecimal quantity10;
+
+	/**
+	 * 十月金额
+	 */
+	@ExcelProperty(value = "十月金额")
+	private BigDecimal amount10;
+
+	/**
+	 * 十一月数量
+	 */
+	@ExcelProperty(value = "十一月数量")
+	private BigDecimal quantity11;
+
+	/**
+	 * 十一月金额
+	 */
+	@ExcelProperty(value = "十一月金额")
+	private BigDecimal amount11;
+
+	/**
+	 * 十二月数量
+	 */
+	@ExcelProperty(value = "十二月数量")
+	private BigDecimal quantity12;
+
+	/**
+	 * 十二月金额
+	 */
+	@ExcelProperty(value = "十二月金额")
+	private BigDecimal amount12;
+
+}

+ 65 - 0
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/export/ExportOrderController.java

@@ -1065,4 +1065,69 @@ public class ExportOrderController extends BladeController {
 		ExcelUtil.export(response, "客户利润统计", "客户利润统计", list, CustomerProfitExcel.class);
 	}
 
+	/**
+	 * 统计分析 品牌利润对比统计
+	 */
+	@GetMapping("/brandProfit")
+	@ApiOperation(value = "分品牌利润对比统计", notes = "分品牌利润对比统计")
+	public R brandProfit(OrderStatisticsVo statisticsVo, Query query){
+		statisticsVo.setTenantId(AuthUtil.getTenantId());
+		IPage<OrderStatisticsVo> pages = orderService.brandProfit(Condition.getPage(query), statisticsVo);
+		return R.data(pages);
+	}
+
+	/**
+	 * 统计分析 品牌利润对比导出
+	 */
+	@GetMapping("/brandProfitExport")
+	@ApiOperation(value = "分品牌利润对比导出", notes = "分品牌利润对比导出")
+	public void brandProfitExport(OrderStatisticsVo statisticsVo, HttpServletResponse response){
+		statisticsVo.setTenantId(SecureUtil.getTenantId());
+		List<BrandProfitExcel> list = orderService.brandProfitExport(statisticsVo);
+		ExcelUtil.export(response, "分品牌利润对比导出", "分品牌利润对比导出", list, BrandProfitExcel.class);
+	}
+
+	/**
+	 * 统计分析 发货规格统计
+	 */
+	@GetMapping("/specificationsProfit")
+	@ApiOperation(value = "发货规格统计", notes = "发货规格统计")
+	public R specificationsProfit(OrderStatisticsVo statisticsVo, Query query){
+		statisticsVo.setTenantId(AuthUtil.getTenantId());
+		IPage<OrderStatisticsVo> pages = orderService.specificationsProfit(Condition.getPage(query), statisticsVo);
+		return R.data(pages);
+	}
+
+	/**
+	 * 统计分析 发货规格统计导出
+	 */
+	@GetMapping("/specificationsProfitExport")
+	@ApiOperation(value = "发货规格统计导出", notes = "发货规格统计导出")
+	public void specificationsProfitExport(OrderStatisticsVo statisticsVo, HttpServletResponse response){
+		statisticsVo.setTenantId(SecureUtil.getTenantId());
+		List<SpecificationsProfitExcel> list = orderService.specificationsProfitExport(statisticsVo);
+		ExcelUtil.export(response, "发货规格统计导出", "发货规格统计导出", list, SpecificationsProfitExcel.class);
+	}
+
+	/**
+	 * 统计分析 数量金额汇总对比统计
+	 */
+	@GetMapping("/totalSummary")
+	@ApiOperation(value = "数量金额汇总对比统计", notes = "数量金额汇总对比统计")
+	public R totalSummary(TotalSummaryVo totalSummaryVo, Query query){
+		totalSummaryVo.setTenantId(AuthUtil.getTenantId());
+		IPage<TotalSummaryVo> pages = orderService.totalSummary(Condition.getPage(query), totalSummaryVo);
+		return R.data(pages);
+	}
+
+	/**
+	 * 统计分析 数量金额汇总对比统计导出
+	 */
+	@GetMapping("/totalSummaryExport")
+	@ApiOperation(value = "数量金额汇总对比统计导出", notes = "数量金额汇总对比统计导出")
+	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);
+	}
 }

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

@@ -230,42 +230,72 @@ public interface OrderMapper extends BaseMapper<Order> {
 	/**
 	 * 发货客户统计
 	 */
-	List<OrderStatisticsVo> corpStatistics(IPage<OrderStatisticsVo> page,@Param("statisticsVo") OrderStatisticsVo statisticsVo);
+	List<OrderStatisticsVo> corpStatistics(IPage<OrderStatisticsVo> page,@Param("statisticsVo") OrderStatisticsVo statisticsVo, @Param("brand") String brand, @Param("chargeMember") String chargeMember);
 
 	/**
 	 * 发货客户统计导出
 	 */
-	List<CorpStatisticsExcel> corpStatisticsExport(@Param("statisticsVo") OrderStatisticsVo statisticsVo);
+	List<CorpStatisticsExcel> corpStatisticsExport(@Param("statisticsVo") OrderStatisticsVo statisticsVo, @Param("brand") String brand, @Param("chargeMember") String chargeMember);
 
 	/**
 	 * 发货业务员统计
 	 */
-	List<OrderStatisticsVo> salesmanStatistics(IPage<OrderStatisticsVo> page,@Param("statisticsVo") OrderStatisticsVo statisticsVo);
+	List<OrderStatisticsVo> salesmanStatistics(IPage<OrderStatisticsVo> page,@Param("statisticsVo") OrderStatisticsVo statisticsVo, @Param("brand") String brand, @Param("chargeMember") String chargeMember);
 
 	/**
-	 * 发货客户统计导出
+	 * 发货业务员统计导出
 	 */
-	List<SalesmanStatisticsExcel> salesmanStatisticsExport(@Param("statisticsVo") OrderStatisticsVo statisticsVo);
+	List<SalesmanStatisticsExcel> salesmanStatisticsExport(@Param("statisticsVo") OrderStatisticsVo statisticsVo, @Param("brand") String brand, @Param("chargeMember") String chargeMember);
 
 	/**
 	 * 业务员利润统计
 	 */
-	List<OrderStatisticsVo> salesmanProfit(IPage<OrderStatisticsVo> page,@Param("statisticsVo") OrderStatisticsVo statisticsVo);
+	List<OrderStatisticsVo> salesmanProfit(IPage<OrderStatisticsVo> page,@Param("statisticsVo") OrderStatisticsVo statisticsVo, @Param("brand") String brand);
 
 	/**
 	 * 业务员利润导出
 	 */
-	List<SalesmanProfitExcel> salesmanProfitExport(@Param("statisticsVo") OrderStatisticsVo statisticsVo);
+	List<SalesmanProfitExcel> salesmanProfitExport(@Param("statisticsVo") OrderStatisticsVo statisticsVo, @Param("brand") String brand);
 
 	/**
 	 * 客户利润统计
 	 */
-	List<OrderStatisticsVo> customerProfit(IPage<OrderStatisticsVo> page,@Param("statisticsVo") OrderStatisticsVo statisticsVo);
+	List<OrderStatisticsVo> customerProfit(IPage<OrderStatisticsVo> page,@Param("statisticsVo") OrderStatisticsVo statisticsVo, @Param("brand") String brand);
 
 	/**
 	 * 客户利润导出
 	 */
-	List<CustomerProfitExcel> customerProfitExport(@Param("statisticsVo") OrderStatisticsVo statisticsVo);
+	List<CustomerProfitExcel> customerProfitExport(@Param("statisticsVo") OrderStatisticsVo statisticsVo, @Param("brand") String brand);
+
+	/**
+	 * 分品牌利润对比统计
+	 */
+	List<OrderStatisticsVo> brandProfit(IPage<OrderStatisticsVo> page,@Param("statisticsVo") OrderStatisticsVo statisticsVo, @Param("brand") String brand);
+
+	/**
+	 * 分品牌利润对比统计导出
+	 */
+	List<BrandProfitExcel> brandProfitExport(@Param("statisticsVo") OrderStatisticsVo statisticsVo, @Param("brand") String brand);
+
+	/**
+	 * 发货规格统计统计
+	 */
+	List<OrderStatisticsVo> specificationsProfit(IPage<OrderStatisticsVo> page,@Param("statisticsVo") OrderStatisticsVo statisticsVo, @Param("brand") String brand);
+
+	/**
+	 * 发货规格统计导出
+	 */
+	List<SpecificationsProfitExcel> specificationsProfitExport(@Param("statisticsVo") OrderStatisticsVo statisticsVo, @Param("brand") String brand);
+
+	/**
+	 * 数量金额汇总对比统计
+	 */
+	List<TotalSummaryVo> totalSummary(IPage<TotalSummaryVo> page,@Param("totalSummaryVo") TotalSummaryVo totalSummaryVo, @Param("brand") String brand);
+
+	/**
+	 * 数量金额汇总对比统计导出
+	 */
+	List<TotalSummaryExcel> totalSummaryExport(@Param("totalSummaryVo") TotalSummaryVo totalSummaryVo, @Param("brand") String brand);
 
 	int updateStockGoods(StockGoods stockGoods);
 

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

@@ -1372,12 +1372,18 @@ ORDER BY
             and BO.is_deleted = 0
             and BO.bill_type = 'XS'
             <if test="statisticsVo.brand != null and statisticsVo.brand != ''">
-                and BGD.brand in #{statisticsVo.brand}
-            </if>
-            <if test="statisticsVo.chargeMember != null statisticsVo.chargeMember != ''">
-                BO.charge_member in #{statisticsVo.chargeMember}
-            </if>
-            <if test="statisticsVo.beginTime !=null and order.beginTime != ''">
+                and BGD.brand in
+                <foreach item="item" index="index" collection="brand.split(',')" open="(" separator="," close=")">
+                    '${item}'
+                </foreach>
+            </if>
+            <if test="statisticsVo.chargeMember != null and 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}
             </if>
             <if test="statisticsVo.endTime !=null and statisticsVo.endTime != ''">
@@ -1413,12 +1419,18 @@ ORDER BY
             and BO.is_deleted = 0
             and BO.bill_type = 'XS'
             <if test="statisticsVo.brand != null and statisticsVo.brand != ''">
-                and BGD.brand in #{statisticsVo.brand}
-            </if>
-            <if test="statisticsVo.chargeMember != null statisticsVo.chargeMember != ''">
-                BO.charge_member in #{statisticsVo.chargeMember}
-            </if>
-            <if test="statisticsVo.beginTime !=null and order.beginTime != ''">
+                and BGD.brand in
+                <foreach item="item" index="index" collection="brand.split(',')" open="(" separator="," close=")">
+                    '${item}'
+                </foreach>
+            </if>
+            <if test="statisticsVo.chargeMember != null and 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}
             </if>
             <if test="statisticsVo.endTime !=null and statisticsVo.endTime != ''">
@@ -1452,12 +1464,18 @@ ORDER BY
             and BO.is_deleted = 0
             and BO.bill_type = 'XS'
             <if test="statisticsVo.brand != null and statisticsVo.brand != ''">
-                and BGD.brand in #{statisticsVo.brand}
-            </if>
-            <if test="statisticsVo.chargeMember != null statisticsVo.chargeMember != ''">
-                BO.charge_member in #{statisticsVo.chargeMember}
-            </if>
-            <if test="statisticsVo.beginTime !=null and order.beginTime != ''">
+                and BGD.brand in
+                <foreach item="item" index="index" collection="brand.split(',')" open="(" separator="," close=")">
+                    '${item}'
+                </foreach>
+            </if>
+            <if test="statisticsVo.chargeMember != null and 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}
             </if>
             <if test="statisticsVo.endTime !=null and statisticsVo.endTime != ''">
@@ -1491,13 +1509,16 @@ ORDER BY
             and BO.is_deleted = 0
             and BO.bill_type = 'XS'
             <if test="statisticsVo.brand != null and statisticsVo.brand != ''">
-                and BGD.brand in #{statisticsVo.brand}
+                and BGD.brand in
+                <foreach item="item" index="index" collection="brand.split(',')" open="(" separator="," close=")">
+                    '${item}'
+                </foreach>
             </if>
-            <if test="statisticsVo.chargeMember != null statisticsVo.chargeMember != ''">
-                BO.charge_member in #{statisticsVo.chargeMember}
-            </if>
-            <if test="statisticsVo.beginTime !=null and order.beginTime != ''">
-                and BO.actual_delivery_date &gt;= #{statisticsVo.beginTime}
+            <if test="statisticsVo.chargeMember != null and statisticsVo.chargeMember != ''">
+                and BO.charge_member in
+                <foreach item="member" index="index" collection="chargeMember.split(',')" open="(" separator="," close=")">
+                    '${member}'
+                </foreach>
             </if>
             <if test="statisticsVo.endTime !=null and statisticsVo.endTime != ''">
                 and BO.actual_delivery_date &lt;= #{statisticsVo.endTime}
@@ -1536,9 +1557,12 @@ ORDER BY
             and BO.is_deleted = 0
             and BO.bill_type = 'XS'
             <if test="statisticsVo.brand != null and statisticsVo.brand != ''">
-                and BGD.brand in #{statisticsVo.brand}
+                and BGD.brand in
+                <foreach item="item" index="index" collection="brand.split(',')" open="(" separator="," close=")">
+                    '${item}'
+                </foreach>
             </if>
-            <if test="statisticsVo.beginTime !=null and order.beginTime != ''">
+            <if test="statisticsVo.beginTime !=null and statisticsVo.beginTime != ''">
                 and BO.actual_delivery_date &gt;= #{statisticsVo.beginTime}
             </if>
             <if test="statisticsVo.endTime !=null and statisticsVo.endTime != ''">
@@ -1578,9 +1602,12 @@ ORDER BY
             and BO.is_deleted = 0
             and BO.bill_type = 'XS'
             <if test="statisticsVo.brand != null and statisticsVo.brand != ''">
-                and BGD.brand in #{statisticsVo.brand}
+                and BGD.brand in
+                <foreach item="item" index="index" collection="brand.split(',')" open="(" separator="," close=")">
+                    '${item}'
+                </foreach>
             </if>
-            <if test="statisticsVo.beginTime !=null and order.beginTime != ''">
+            <if test="statisticsVo.beginTime !=null and statisticsVo.beginTime != ''">
                 and BO.actual_delivery_date &gt;= #{statisticsVo.beginTime}
             </if>
             <if test="statisticsVo.endTime !=null and statisticsVo.endTime != ''">
@@ -1614,15 +1641,19 @@ ORDER BY
         GROUP BY
         pid
         ) BOI ON BOI.pid = BO.id
+        LEFT JOIN basic_corps_desc BCD ON BCD.id = BO.corp_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'
             <if test="statisticsVo.brand != null and statisticsVo.brand != ''">
-                and BGD.brand in #{statisticsVo.brand}
+                and BGD.brand in
+                <foreach item="item" index="index" collection="brand.split(',')" open="(" separator="," close=")">
+                    '${item}'
+                </foreach>
             </if>
-            <if test="statisticsVo.beginTime !=null and order.beginTime != ''">
+            <if test="statisticsVo.beginTime !=null and statisticsVo.beginTime != ''">
                 and BO.actual_delivery_date &gt;= #{statisticsVo.beginTime}
             </if>
             <if test="statisticsVo.endTime !=null and statisticsVo.endTime != ''">
@@ -1656,15 +1687,19 @@ ORDER BY
             GROUP BY
             pid
         ) BOI ON BOI.pid = BO.id
+        LEFT JOIN basic_corps_desc BCD ON BCD.id = BO.corp_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'
             <if test="statisticsVo.brand != null and statisticsVo.brand != ''">
-                and BGD.brand in #{statisticsVo.brand}
+                and BGD.brand in
+                <foreach item="item" index="index" collection="brand.split(',')" open="(" separator="," close=")">
+                    '${item}'
+                </foreach>
             </if>
-            <if test="statisticsVo.beginTime !=null and order.beginTime != ''">
+            <if test="statisticsVo.beginTime !=null and statisticsVo.beginTime != ''">
                 and BO.actual_delivery_date &gt;= #{statisticsVo.beginTime}
             </if>
             <if test="statisticsVo.endTime !=null and statisticsVo.endTime != ''">
@@ -1674,6 +1709,643 @@ ORDER BY
         GROUP BY BCD.cname
         order by quantity desc
     </select>
+    <select id="brandProfit" resultType="org.springblade.purchase.sales.vo.OrderStatisticsVo">
+        SELECT
+            BGD.brand AS brand,
+            SUM( BO.debit_amount ) AS amount,
+            SUM( BOI.purchaseAmount ) AS purchaseAmount,
+            SUM( BOI.quantity ) AS quantity,
+            SUM( BO.this_used_profit ) AS thisUsedProfit,
+            (SUM( BO.debit_amount ) / SUM( BOI.quantity )) AS price,
+            (SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount )) / SUM( BOI.quantity ) AS singleGrossProfit,
+            SUM( BO.predict_ocean_freight ) AS predictOceanFreight,
+            SUM( BO.gross_profit ) - SUM( BO.this_used_profit ) AS netGrossProfit,
+            SUM( BO.gross_profit ) AS grossProfit,
+            SUM( BO.gross_profit_rate ) AS grossProfitRate
+        FROM
+            business_order BO
+                LEFT JOIN (
+                SELECT
+                    pid,
+                    item_id,
+                    IFNULL( SUM( actual_quantity ), 0 ) AS quantity,
+                    IFNULL( SUM( purchase_amount ), 0 ) AS purchaseAmount
+                FROM
+                    business_order_items
+                GROUP BY
+                    pid
+            ) 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'
+            <if test="statisticsVo.brand != null and statisticsVo.brand != ''">
+                and BGD.brand in
+                <foreach item="item" index="index" collection="brand.split(',')" open="(" separator="," close=")">
+                    '${item}'
+                </foreach>
+            </if>
+            <if test="statisticsVo.beginTime !=null and statisticsVo.beginTime != ''">
+                and BO.actual_delivery_date &gt;= #{statisticsVo.beginTime}
+            </if>
+            <if test="statisticsVo.endTime !=null and statisticsVo.endTime != ''">
+                and BO.actual_delivery_date &lt;= #{statisticsVo.endTime}
+            </if>
+        </where>
+        GROUP BY
+            BGD.brand
+        ORDER BY
+            quantity DESC
+    </select>
+    <select id="brandProfitExport" resultType="org.springblade.purchase.sales.excel.BrandProfitExcel">
+        SELECT
+            BGD.brand AS brand,
+            SUM( BO.debit_amount ) AS amount,
+            SUM( BOI.purchaseAmount ) AS purchaseAmount,
+            SUM( BOI.quantity ) AS quantity,
+            SUM( BO.this_used_profit ) AS thisUsedProfit,
+            (SUM( BO.debit_amount ) / SUM( BOI.quantity )) AS price,
+            (SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount )) / SUM( BOI.quantity ) AS singleGrossProfit,
+            SUM( BO.predict_ocean_freight ) AS predictOceanFreight,
+            SUM( BO.gross_profit ) - SUM( BO.this_used_profit ) AS netGrossProfit,
+            SUM( BO.gross_profit ) AS grossProfit,
+            SUM( BO.gross_profit_rate ) AS grossProfitRate
+        FROM
+            business_order BO
+        LEFT JOIN (
+            SELECT
+                pid,
+                item_id,
+                IFNULL( SUM( actual_quantity ), 0 ) AS quantity,
+                IFNULL( SUM( purchase_amount ), 0 ) AS purchaseAmount
+            FROM
+                business_order_items
+            GROUP BY pid
+        ) 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'
+            <if test="statisticsVo.brand != null and statisticsVo.brand != ''">
+                and BGD.brand in
+                <foreach item="item" index="index" collection="brand.split(',')" open="(" separator="," close=")">
+                    '${item}'
+                </foreach>
+            </if>
+            <if test="statisticsVo.beginTime !=null and statisticsVo.beginTime != ''">
+                and BO.actual_delivery_date &gt;= #{statisticsVo.beginTime}
+            </if>
+            <if test="statisticsVo.endTime !=null and statisticsVo.endTime != ''">
+                and BO.actual_delivery_date &lt;= #{statisticsVo.endTime}
+            </if>
+        </where>
+        GROUP BY BGD.brand
+        ORDER BY quantity DESC
+    </select>
+    <select id="specificationsProfit" resultType="org.springblade.purchase.sales.vo.OrderStatisticsVo">
+        SELECT
+            @rank := @rank + 1 AS rankNo,
+            temp.*
+        FROM
+            (
+                SELECT
+                    BGD.CODE AS code,
+                    BGD.Typeno AS typeNo,
+                    BGD.brand AS brand,
+                    BGD.brand_item AS brandItem,
+                    SUM( BOI.quantity ) AS quantity,
+                    SUM( BO.debit_amount ) AS amount
+                FROM
+                    business_order BO
+                        LEFT JOIN (
+                        SELECT
+                            pid,
+                            item_id,
+                            IFNULL( SUM( actual_quantity ), 0 ) AS quantity,
+                            IFNULL( SUM( purchase_amount ), 0 ) AS purchaseAmount
+                        FROM
+                            business_order_items
+                        GROUP BY
+                            pid
+                    ) 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'
+                    <if test="statisticsVo.brand != null and statisticsVo.brand != ''">
+                        and BGD.brand in
+                        <foreach item="item" index="index" collection="brand.split(',')" open="(" separator="," close=")">
+                            '${item}'
+                        </foreach>
+                    </if>
+                    <if test="statisticsVo.chargeMember != null and statisticsVo.chargeMember != ''">
+                        BO.charge_member in #{statisticsVo.chargeMember}
+                    </if>
+                    <if test="statisticsVo.beginTime !=null and statisticsVo.beginTime != ''">
+                        and BO.actual_delivery_date &gt;= #{statisticsVo.beginTime}
+                    </if>
+                    <if test="statisticsVo.endTime !=null and statisticsVo.endTime != ''">
+                        and BO.actual_delivery_date &lt;= #{statisticsVo.endTime}
+                    </if>
+                </where>
+                GROUP BY
+                    BGD.Typeno
+                ORDER BY
+                    quantity DESC
+            ) temp,
+        ( SELECT @rank := 0 ) b
+    </select>
+    <select id="specificationsProfitExport" resultType="org.springblade.purchase.sales.excel.SpecificationsProfitExcel">
+        SELECT
+            @rank := @rank + 1 AS rankNo,
+            temp.*
+        FROM
+            (
+                SELECT
+                    BGD.CODE AS code,
+                    BGD.Typeno AS typeNo,
+                    BGD.brand AS brand,
+                    BGD.brand_item AS brandItem,
+                    SUM( BOI.quantity ) AS quantity,
+                    SUM( BO.debit_amount ) AS amount
+                FROM
+                    business_order BO
+                        LEFT JOIN (
+                        SELECT
+                            pid,
+                            item_id,
+                            IFNULL( SUM( actual_quantity ), 0 ) AS quantity,
+                            IFNULL( SUM( purchase_amount ), 0 ) AS purchaseAmount
+                        FROM
+                            business_order_items
+                        GROUP BY
+                            pid
+                    ) 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'
+                    <if test="statisticsVo.brand != null and statisticsVo.brand != ''">
+                        and BGD.brand in
+                        <foreach item="item" index="index" collection="brand.split(',')" open="(" separator="," close=")">
+                            '${item}'
+                        </foreach>
+                    </if>
+                    <if test="statisticsVo.chargeMember != null and statisticsVo.chargeMember != ''">
+                        BO.charge_member in #{statisticsVo.chargeMember}
+                    </if>
+                    <if test="statisticsVo.beginTime !=null and statisticsVo.beginTime != ''">
+                        and BO.actual_delivery_date &gt;= #{statisticsVo.beginTime}
+                    </if>
+                    <if test="statisticsVo.endTime !=null and statisticsVo.endTime != ''">
+                        and BO.actual_delivery_date &lt;= #{statisticsVo.endTime}
+                    </if>
+                </where>
+                GROUP BY
+                    BGD.Typeno
+                ORDER BY
+                    quantity DESC
+            ) temp,
+            ( SELECT @rank := 0 ) b
+    </select>
+    <select id="totalSummary" resultType="org.springblade.purchase.sales.vo.TotalSummaryVo">
+        SELECT
+            BGD.Brand AS brand,
+            SUM( BOI1.quantity ) AS quantity1,
+            SUM( BOI1.amount ) AS amount1,
+            SUM( BOI2.quantity ) AS quantity2,
+            SUM( BOI2.amount ) AS amount2,
+            SUM( BOI3.quantity ) AS quantity3,
+            SUM( BOI3.amount ) AS amount3,
+            SUM( BOI4.quantity ) AS quantity4,
+            SUM( BOI4.amount ) AS amount4,
+            SUM( BOI5.quantity ) AS quantity5,
+            SUM( BOI5.amount ) AS amount5,
+            SUM( BOI6.quantity ) AS quantity6,
+            SUM( BOI6.amount ) AS amount6,
+            SUM( BOI7.quantity ) AS quantity7,
+            SUM( BOI7.amount ) AS amount7,
+            SUM( BOI8.quantity ) AS quantity8,
+            SUM( BOI8.amount ) AS amount8,
+            SUM( BOI9.quantity ) AS quantity9,
+            SUM( BOI9.amount ) AS amount9,
+            SUM( BOI10.quantity ) AS quantity10,
+            SUM( BOI10.amount ) AS amount10,
+            SUM( BOI11.quantity ) AS quantity11,
+            SUM( BOI11.amount ) AS amount11,
+            SUM( BOI12.quantity ) AS quantity12,
+            SUM( BOI12.amount ) AS amount12
+        FROM
+            business_order BO
+                LEFT JOIN (
+                SELECT
+                    pid,
+                    item_id,
+                    IFNULL( SUM( order_quantity ), 0 ) AS quantity,
+                    IFNULL( SUM( amount ), 0 ) AS amount
+                FROM
+                    business_order_items
+                WHERE
+                    MONTH ( create_time ) = 1
+                GROUP BY
+                    pid
+            ) BOI1 ON BOI1.pid = BO.id
+                LEFT JOIN (
+                SELECT
+                    pid,
+                    item_id,
+                    IFNULL( SUM( order_quantity ), 0 ) AS quantity,
+                    IFNULL( SUM( amount ), 0 ) AS amount
+                FROM
+                    business_order_items
+                WHERE
+                    MONTH ( create_time ) = 2
+                GROUP BY
+                    pid
+            ) BOI2 ON BOI2.pid = BO.id
+                LEFT JOIN (
+                SELECT
+                    pid,
+                    item_id,
+                    IFNULL( SUM( order_quantity ), 0 ) AS quantity,
+                    IFNULL( SUM( amount ), 0 ) AS amount
+                FROM
+                    business_order_items
+                WHERE
+                    MONTH ( create_time ) = 3
+                GROUP BY
+                    pid
+            ) BOI3 ON BOI3.pid = BO.id
+                LEFT JOIN (
+                SELECT
+                    pid,
+                    item_id,
+                    IFNULL( SUM( order_quantity ), 0 ) AS quantity,
+                    IFNULL( SUM( amount ), 0 ) AS amount
+                FROM
+                    business_order_items
+                WHERE
+                    MONTH ( create_time ) = 4
+                GROUP BY
+                    pid
+            ) BOI4 ON BOI4.pid = BO.id
+                LEFT JOIN (
+                SELECT
+                    pid,
+                    item_id,
+                    IFNULL( SUM( order_quantity ), 0 ) AS quantity,
+                    IFNULL( SUM( amount ), 0 ) AS amount
+                FROM
+                    business_order_items
+                WHERE
+                    MONTH ( create_time ) = 5
+                GROUP BY
+                    pid
+            ) BOI5 ON BOI5.pid = BO.id
+                LEFT JOIN (
+                SELECT
+                    pid,
+                    item_id,
+                    IFNULL( SUM( order_quantity ), 0 ) AS quantity,
+                    IFNULL( SUM( amount ), 0 ) AS amount
+                FROM
+                    business_order_items
+                WHERE
+                    MONTH ( create_time ) = 6
+                GROUP BY
+                    pid
+            ) BOI6 ON BOI6.pid = BO.id
+                LEFT JOIN (
+                SELECT
+                    pid,
+                    item_id,
+                    IFNULL( SUM( order_quantity ), 0 ) AS quantity,
+                    IFNULL( SUM( amount ), 0 ) AS amount
+                FROM
+                    business_order_items
+                WHERE
+                    MONTH ( create_time ) = 7
+                GROUP BY
+                    pid
+            ) BOI7 ON BOI7.pid = BO.id
+                LEFT JOIN (
+                SELECT
+                    pid,
+                    item_id,
+                    IFNULL( SUM( order_quantity ), 0 ) AS quantity,
+                    IFNULL( SUM( amount ), 0 ) AS amount
+                FROM
+                    business_order_items
+                WHERE
+                    MONTH ( create_time ) = 8
+                GROUP BY
+                    pid
+            ) BOI8 ON BOI8.pid = BO.id
+                LEFT JOIN (
+                SELECT
+                    pid,
+                    item_id,
+                    IFNULL( SUM( order_quantity ), 0 ) AS quantity,
+                    IFNULL( SUM( amount ), 0 ) AS amount
+                FROM
+                    business_order_items
+                WHERE
+                    MONTH ( create_time ) = 9
+                GROUP BY
+                    pid
+            ) BOI9 ON BOI9.pid = BO.id
+                LEFT JOIN (
+                SELECT
+                    pid,
+                    item_id,
+                    IFNULL( SUM( order_quantity ), 0 ) AS quantity,
+                    IFNULL( SUM( amount ), 0 ) AS amount
+                FROM
+                    business_order_items
+                WHERE
+                    MONTH ( create_time ) = 10
+                GROUP BY
+                    pid
+            ) BOI10 ON BOI10.pid = BO.id
+                LEFT JOIN (
+                SELECT
+                    pid,
+                    item_id,
+                    IFNULL( SUM( order_quantity ), 0 ) AS quantity,
+                    IFNULL( SUM( amount ), 0 ) AS amount
+                FROM
+                    business_order_items
+                WHERE
+                    MONTH ( create_time ) = 11
+                GROUP BY
+                    pid
+            ) BOI11 ON BOI11.pid = BO.id
+                LEFT JOIN (
+                SELECT
+                    pid,
+                    item_id,
+                    IFNULL( SUM( order_quantity ), 0 ) AS quantity,
+                    IFNULL( SUM( amount ), 0 ) AS amount
+                FROM
+                    business_order_items
+                WHERE
+                    MONTH ( create_time ) = 12
+                GROUP BY
+                    pid
+            ) BOI12 ON BOI12.pid = BO.id
+                LEFT JOIN basic_goods_desc BGD ON BOI1.Item_id = BGD.id
+                OR BOI2.Item_id = BGD.id
+                OR BOI3.Item_id = BGD.id
+                OR BOI4.Item_id = BGD.id
+                OR BOI5.Item_id = BGD.id
+                OR BOI6.Item_id = BGD.id
+                OR BOI7.Item_id = BGD.id
+                OR BOI8.Item_id = BGD.id
+                OR BOI9.Item_id = BGD.id
+                OR BOI10.Item_id = BGD.id
+                OR BOI11.Item_id = BGD.id
+                OR BOI12.Item_id = BGD.id
+        <where>
+            BO.tenant_id = #{totalSummaryVo.tenantId}
+            and BO.is_deleted = 0
+            and BO.bill_type = 'XS'
+            <if test="totalSummaryVo.brand != null and totalSummaryVo.brand != ''">
+                and BGD.brand in
+                <foreach item="item" index="index" collection="brand.split(',')" open="(" separator="," close=")">
+                    '${item}'
+                </foreach>
+            </if>
+            <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'">
+                AND BO.create_deliver not in (#{totalSummaryVo.status})
+            </if>
+        </where>
+        GROUP BY
+            BGD.Brand
+    </select>
+    <select id="totalSummaryExport" resultType="org.springblade.purchase.sales.excel.TotalSummaryExcel">
+        SELECT
+        BGD.Brand AS brand,
+        SUM( BOI1.quantity ) AS quantity1,
+        SUM( BOI1.amount ) AS amount1,
+        SUM( BOI2.quantity ) AS quantity2,
+        SUM( BOI2.amount ) AS amount2,
+        SUM( BOI3.quantity ) AS quantity3,
+        SUM( BOI3.amount ) AS amount3,
+        SUM( BOI4.quantity ) AS quantity4,
+        SUM( BOI4.amount ) AS amount4,
+        SUM( BOI5.quantity ) AS quantity5,
+        SUM( BOI5.amount ) AS amount5,
+        SUM( BOI6.quantity ) AS quantity6,
+        SUM( BOI6.amount ) AS amount6,
+        SUM( BOI7.quantity ) AS quantity7,
+        SUM( BOI7.amount ) AS amount7,
+        SUM( BOI8.quantity ) AS quantity8,
+        SUM( BOI8.amount ) AS amount8,
+        SUM( BOI9.quantity ) AS quantity9,
+        SUM( BOI9.amount ) AS amount9,
+        SUM( BOI10.quantity ) AS quantity10,
+        SUM( BOI10.amount ) AS amount10,
+        SUM( BOI11.quantity ) AS quantity11,
+        SUM( BOI11.amount ) AS amount11,
+        SUM( BOI12.quantity ) AS quantity12,
+        SUM( BOI12.amount ) AS amount12
+        FROM
+        business_order BO
+        LEFT JOIN (
+        SELECT
+        pid,
+        item_id,
+        IFNULL( SUM( order_quantity ), 0 ) AS quantity,
+        IFNULL( SUM( amount ), 0 ) AS amount
+        FROM
+        business_order_items
+        WHERE
+        MONTH ( create_time ) = 1
+        GROUP BY
+        pid
+        ) BOI1 ON BOI1.pid = BO.id
+        LEFT JOIN (
+        SELECT
+        pid,
+        item_id,
+        IFNULL( SUM( order_quantity ), 0 ) AS quantity,
+        IFNULL( SUM( amount ), 0 ) AS amount
+        FROM
+        business_order_items
+        WHERE
+        MONTH ( create_time ) = 2
+        GROUP BY
+        pid
+        ) BOI2 ON BOI2.pid = BO.id
+        LEFT JOIN (
+        SELECT
+        pid,
+        item_id,
+        IFNULL( SUM( order_quantity ), 0 ) AS quantity,
+        IFNULL( SUM( amount ), 0 ) AS amount
+        FROM
+        business_order_items
+        WHERE
+        MONTH ( create_time ) = 3
+        GROUP BY
+        pid
+        ) BOI3 ON BOI3.pid = BO.id
+        LEFT JOIN (
+        SELECT
+        pid,
+        item_id,
+        IFNULL( SUM( order_quantity ), 0 ) AS quantity,
+        IFNULL( SUM( amount ), 0 ) AS amount
+        FROM
+        business_order_items
+        WHERE
+        MONTH ( create_time ) = 4
+        GROUP BY
+        pid
+        ) BOI4 ON BOI4.pid = BO.id
+        LEFT JOIN (
+        SELECT
+        pid,
+        item_id,
+        IFNULL( SUM( order_quantity ), 0 ) AS quantity,
+        IFNULL( SUM( amount ), 0 ) AS amount
+        FROM
+        business_order_items
+        WHERE
+        MONTH ( create_time ) = 5
+        GROUP BY
+        pid
+        ) BOI5 ON BOI5.pid = BO.id
+        LEFT JOIN (
+        SELECT
+        pid,
+        item_id,
+        IFNULL( SUM( order_quantity ), 0 ) AS quantity,
+        IFNULL( SUM( amount ), 0 ) AS amount
+        FROM
+        business_order_items
+        WHERE
+        MONTH ( create_time ) = 6
+        GROUP BY
+        pid
+        ) BOI6 ON BOI6.pid = BO.id
+        LEFT JOIN (
+        SELECT
+        pid,
+        item_id,
+        IFNULL( SUM( order_quantity ), 0 ) AS quantity,
+        IFNULL( SUM( amount ), 0 ) AS amount
+        FROM
+        business_order_items
+        WHERE
+        MONTH ( create_time ) = 7
+        GROUP BY
+        pid
+        ) BOI7 ON BOI7.pid = BO.id
+        LEFT JOIN (
+        SELECT
+        pid,
+        item_id,
+        IFNULL( SUM( order_quantity ), 0 ) AS quantity,
+        IFNULL( SUM( amount ), 0 ) AS amount
+        FROM
+        business_order_items
+        WHERE
+        MONTH ( create_time ) = 8
+        GROUP BY
+        pid
+        ) BOI8 ON BOI8.pid = BO.id
+        LEFT JOIN (
+        SELECT
+        pid,
+        item_id,
+        IFNULL( SUM( order_quantity ), 0 ) AS quantity,
+        IFNULL( SUM( amount ), 0 ) AS amount
+        FROM
+        business_order_items
+        WHERE
+        MONTH ( create_time ) = 9
+        GROUP BY
+        pid
+        ) BOI9 ON BOI9.pid = BO.id
+        LEFT JOIN (
+        SELECT
+        pid,
+        item_id,
+        IFNULL( SUM( order_quantity ), 0 ) AS quantity,
+        IFNULL( SUM( amount ), 0 ) AS amount
+        FROM
+        business_order_items
+        WHERE
+        MONTH ( create_time ) = 10
+        GROUP BY
+        pid
+        ) BOI10 ON BOI10.pid = BO.id
+        LEFT JOIN (
+        SELECT
+        pid,
+        item_id,
+        IFNULL( SUM( order_quantity ), 0 ) AS quantity,
+        IFNULL( SUM( amount ), 0 ) AS amount
+        FROM
+        business_order_items
+        WHERE
+        MONTH ( create_time ) = 11
+        GROUP BY
+        pid
+        ) BOI11 ON BOI11.pid = BO.id
+        LEFT JOIN (
+        SELECT
+        pid,
+        item_id,
+        IFNULL( SUM( order_quantity ), 0 ) AS quantity,
+        IFNULL( SUM( amount ), 0 ) AS amount
+        FROM
+        business_order_items
+        WHERE
+        MONTH ( create_time ) = 12
+        GROUP BY
+        pid
+        ) BOI12 ON BOI12.pid = BO.id
+        LEFT JOIN basic_goods_desc BGD ON BOI1.Item_id = BGD.id
+        OR BOI2.Item_id = BGD.id
+        OR BOI3.Item_id = BGD.id
+        OR BOI4.Item_id = BGD.id
+        OR BOI5.Item_id = BGD.id
+        OR BOI6.Item_id = BGD.id
+        OR BOI7.Item_id = BGD.id
+        OR BOI8.Item_id = BGD.id
+        OR BOI9.Item_id = BGD.id
+        OR BOI10.Item_id = BGD.id
+        OR BOI11.Item_id = BGD.id
+        OR BOI12.Item_id = BGD.id
+        <where>
+            BO.tenant_id = #{totalSummaryVo.tenantId}
+            and BO.is_deleted = 0
+            and BO.bill_type = 'XS'
+            <if test="totalSummaryVo.brand != null and totalSummaryVo.brand != ''">
+                and BGD.brand in
+                <foreach item="item" index="index" collection="brand.split(',')" open="(" separator="," close=")">
+                    '${item}'
+                </foreach>
+            </if>
+            <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'">
+                AND BO.create_deliver not in (#{totalSummaryVo.status})
+            </if>
+        </where>
+        GROUP BY
+        BGD.Brand
+    </select>
     <update id="updateOrderMessage" parameterType="org.springblade.purchase.sales.entity.Order">
         update  business_order
         <trim prefix="SET" suffixOverrides=",">

+ 30 - 0
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/service/IOrderService.java

@@ -305,6 +305,36 @@ public interface IOrderService extends IService<Order> {
 	List<CustomerProfitExcel> customerProfitExport(OrderStatisticsVo statisticsVo);
 
 	/**
+	 * 分品牌利润对比统计
+	 */
+	IPage<OrderStatisticsVo> brandProfit(IPage<OrderStatisticsVo> page, OrderStatisticsVo statisticsVo);
+
+	/**
+	 * 分品牌利润对比统计导出
+	 */
+	List<BrandProfitExcel> brandProfitExport(OrderStatisticsVo statisticsVo);
+
+	/**
+	 * 发货规格统计统计
+	 */
+	IPage<OrderStatisticsVo> specificationsProfit(IPage<OrderStatisticsVo> page, OrderStatisticsVo statisticsVo);
+
+	/**
+	 * 发货规格统计导出
+	 */
+	List<SpecificationsProfitExcel> specificationsProfitExport(OrderStatisticsVo statisticsVo);
+
+	/**
+	 * 数量金额汇总对比统计
+	 */
+	IPage<TotalSummaryVo> totalSummary(IPage<TotalSummaryVo> page, TotalSummaryVo totalSummaryVo);
+
+	/**
+	 * 数量金额汇总对比统计导出
+	 */
+	List<TotalSummaryExcel> totalSummaryExport(TotalSummaryVo totalSummaryVo);
+
+	/**
 	 * 计算国内费用
 	 */
 	Map<String,Object> calculationDomesticFees(Order order);

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

@@ -1696,7 +1696,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 	 */
 	@Override
 	public IPage<OrderStatisticsVo> corpStatistics(IPage<OrderStatisticsVo> page, OrderStatisticsVo statisticsVo) {
-		return page.setRecords(baseMapper.corpStatistics(page, statisticsVo));
+		return page.setRecords(baseMapper.corpStatistics(page, statisticsVo, statisticsVo.getBrand(), statisticsVo.getChargeMember()));
 	}
 
 	/**
@@ -1704,7 +1704,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 	 */
 	@Override
 	public List<CorpStatisticsExcel> corpStatisticsExport(OrderStatisticsVo statisticsVo) {
-		return baseMapper.corpStatisticsExport(statisticsVo);
+		return baseMapper.corpStatisticsExport(statisticsVo, statisticsVo.getBrand(), statisticsVo.getChargeMember());
 	}
 
 	/**
@@ -1712,7 +1712,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 	 */
 	@Override
 	public IPage<OrderStatisticsVo> salesmanStatistics(IPage<OrderStatisticsVo> page, OrderStatisticsVo statisticsVo) {
-		return page.setRecords(baseMapper.salesmanStatistics(page, statisticsVo));
+		return page.setRecords(baseMapper.salesmanStatistics(page, statisticsVo, statisticsVo.getBrand(), statisticsVo.getChargeMember()));
 	}
 
 	/**
@@ -1720,7 +1720,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 	 */
 	@Override
 	public List<SalesmanStatisticsExcel> salesmanStatisticsExport(OrderStatisticsVo statisticsVo) {
-		return baseMapper.salesmanStatisticsExport(statisticsVo);
+		return baseMapper.salesmanStatisticsExport(statisticsVo, statisticsVo.getBrand(), statisticsVo.getChargeMember());
 	}
 
 	/**
@@ -1728,7 +1728,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 	 */
 	@Override
 	public IPage<OrderStatisticsVo> salesmanProfit(IPage<OrderStatisticsVo> page, OrderStatisticsVo statisticsVo) {
-		return page.setRecords(baseMapper.salesmanProfit(page, statisticsVo));
+		return page.setRecords(baseMapper.salesmanProfit(page, statisticsVo, statisticsVo.getBrand()));
 	}
 
 	/**
@@ -1736,7 +1736,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 	 */
 	@Override
 	public List<SalesmanProfitExcel> salesmanProfitExport(OrderStatisticsVo statisticsVo) {
-		return baseMapper.salesmanProfitExport(statisticsVo);
+		return baseMapper.salesmanProfitExport(statisticsVo, statisticsVo.getBrand());
 	}
 
 	/**
@@ -1744,7 +1744,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 	 */
 	@Override
 	public IPage<OrderStatisticsVo> customerProfit(IPage<OrderStatisticsVo> page, OrderStatisticsVo statisticsVo) {
-		return page.setRecords(baseMapper.customerProfit(page, statisticsVo));
+		return page.setRecords(baseMapper.customerProfit(page, statisticsVo, statisticsVo.getBrand()));
 	}
 
 	/**
@@ -1752,7 +1752,55 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 	 */
 	@Override
 	public List<CustomerProfitExcel> customerProfitExport(OrderStatisticsVo statisticsVo) {
-		return baseMapper.customerProfitExport(statisticsVo);
+		return baseMapper.customerProfitExport(statisticsVo, statisticsVo.getBrand());
+	}
+
+	/**
+	 * 分品牌利润对比统计
+	 */
+	@Override
+	public IPage<OrderStatisticsVo> brandProfit(IPage<OrderStatisticsVo> page, OrderStatisticsVo statisticsVo){
+		return page.setRecords(baseMapper.brandProfit(page, statisticsVo,statisticsVo.getBrand()));
+	}
+
+	/**
+	 * 分品牌利润对比统计导出
+	 */
+	@Override
+	public List<BrandProfitExcel> brandProfitExport(OrderStatisticsVo statisticsVo){
+		return baseMapper.brandProfitExport(statisticsVo,statisticsVo.getBrand());
+	}
+
+	/**
+	 * 发货规格统计统计
+	 */
+	@Override
+	public IPage<OrderStatisticsVo> specificationsProfit(IPage<OrderStatisticsVo> page, OrderStatisticsVo statisticsVo){
+		return page.setRecords(baseMapper.specificationsProfit(page, statisticsVo,statisticsVo.getBrand()));
+	}
+
+	/**
+	 * 发货规格统计导出
+	 */
+	@Override
+	public List<SpecificationsProfitExcel> specificationsProfitExport(OrderStatisticsVo statisticsVo){
+		return baseMapper.specificationsProfitExport(statisticsVo,statisticsVo.getBrand());
+	}
+
+	/**
+	 * 数量金额汇总对比统计
+	 */
+	@Override
+	public IPage<TotalSummaryVo> totalSummary(IPage<TotalSummaryVo> page, TotalSummaryVo totalSummaryVo){
+		return page.setRecords(baseMapper.totalSummary(page, totalSummaryVo, totalSummaryVo.getBrand()));
+	}
+
+	/**
+	 * 数量金额汇总对比统计导出
+	 */
+	@Override
+	public List<TotalSummaryExcel> totalSummaryExport(TotalSummaryVo totalSummaryVo){
+		return baseMapper.totalSummaryExport(totalSummaryVo, totalSummaryVo.getBrand());
 	}
 
 	/**