wangzhuo 2 лет назад
Родитель
Сommit
8635612f58

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

@@ -174,4 +174,9 @@ public class OrderStatisticsVo implements Serializable {
 	 */
 	private List<String> date;
 
+	/**
+	 * 明细标识
+	 */
+	private String identification;
+
 }

+ 35 - 11
blade-service/blade-client/src/main/java/org/springblade/client/corps/controller/CorpsDescController.java

@@ -632,18 +632,42 @@ public class CorpsDescController extends BladeController {
 	@ApiOperationSupport(order = 11)
 	@ApiOperation(value = "所有客户信息", notes = "获得客户信息")
 	public R<List<CorpsDesc>> bidingCorpsList(CorpsDescVO corpsDesc) {
-		redisClient.basicData("corps");
-		LambdaQueryWrapper<CorpsDesc> lambdaQueryWrapper = new LambdaQueryWrapper<>();
-		lambdaQueryWrapper.eq(CorpsDesc::getIsDeleted, 0);
-		lambdaQueryWrapper.eq(CorpsDesc::getTenantId, SecureUtil.getTenantId());
-		lambdaQueryWrapper.eq(CorpsDesc::getCorpType, "KH");
-		if (!"234557".equals(AuthUtil.getTenantId())){
-			lambdaQueryWrapper.orderByAsc(CorpsDesc::getCname);
-		}
-
-		List<CorpsDesc> corpsDescList = corpsDescService.list(lambdaQueryWrapper);
+		if (ObjectUtils.isNotNull(corpsDesc.getCorpsTypeName())){
+			LambdaQueryWrapper<CorpsType> corpsTypeLambdaQueryWrapper = new LambdaQueryWrapper<>();
+			corpsTypeLambdaQueryWrapper.eq(CorpsType::getIsDeleted, 0);
+			corpsTypeLambdaQueryWrapper.eq(CorpsType::getTenantId, SecureUtil.getTenantId());
+			corpsTypeLambdaQueryWrapper.eq(CorpsType::getCname, corpsDesc.getCorpsTypeName());
+			CorpsType corpsType = corpsTypeService.getOne(corpsTypeLambdaQueryWrapper);
+
+			LambdaQueryWrapper<CorpsDesc> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+			lambdaQueryWrapper.eq(CorpsDesc::getIsDeleted, 0);
+			lambdaQueryWrapper.eq(CorpsDesc::getTenantId, SecureUtil.getTenantId());
+			lambdaQueryWrapper.eq(CorpsDesc::getCorpType, "KH");
+
+			if (!"234557".equals(AuthUtil.getTenantId())){
+				lambdaQueryWrapper.orderByAsc(CorpsDesc::getCname);
+			}
 
-		return R.data(corpsDescList);
+			if (ObjectUtils.isNotNull(corpsType)) {
+				//获取客户类别对应的id
+				LambdaQueryWrapper<CorpsTypeDesc> typeDescLambdaQueryWrapper = new LambdaQueryWrapper<>();
+				typeDescLambdaQueryWrapper.eq(CorpsTypeDesc::getTenantId, SecureUtil.getTenantId());
+				typeDescLambdaQueryWrapper.eq(CorpsTypeDesc::getCorpTypeId, corpsType.getId());
+				List<CorpsTypeDesc> list = corpsTypeDescService.list(typeDescLambdaQueryWrapper);
+				if (CollectionUtils.isNotEmpty(list)) {
+					corpsDesc.setTypeList(list.stream().filter(e -> e.getCorpId() != null).map(CorpsTypeDesc::getCorpId).collect(Collectors.toList()));
+				}else{
+					return R.data(new ArrayList<>());
+				}
+				lambdaQueryWrapper.in(CollectionUtils.isNotEmpty(corpsDesc.getTypeList()), CorpsDesc::getId, corpsDesc.getTypeList());
+				List<CorpsDesc> corpsDescList = corpsDescService.list(lambdaQueryWrapper);
+				return R.data(corpsDescList);
+			} else {
+				return R.data(new ArrayList<>());
+			}
+		}else{
+			return R.data(new ArrayList<>());
+		}
 	}
 
 	/**

+ 60 - 0
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/excel/OrderStatisticsOneExcel.java

@@ -0,0 +1,60 @@
+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;
+import java.util.Date;
+
+/**
+ * 统计分析 数量金额汇总明细,发货客户明细,发货规格明细导出统一实体类
+ */
+@Data
+@ColumnWidth(25)
+@HeadRowHeight(20)
+@ContentRowHeight(18)
+public class OrderStatisticsOneExcel implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * 日期
+	 */
+	@ExcelProperty(value = "日期")
+	private Date createTime;
+
+	/**
+	 * 销售单号
+	 */
+	@ExcelProperty(value = "销售单号")
+	private String orderNo;
+
+	/**
+	 * 数量
+	 */
+	@ExcelProperty(value = "数量")
+	private Integer quantity;
+
+	/**
+	 * 金额
+	 */
+	@ExcelProperty(value = "金额")
+	private BigDecimal amount;
+
+	/**
+	 * 到货数量
+	 */
+	@ExcelProperty(value = "到货数量")
+	private BigDecimal actualQuantity;
+
+	/**
+	 * 到货金额
+	 */
+	@ExcelProperty(value = "到货金额")
+	private BigDecimal arrivalAmount;
+
+}

+ 77 - 0
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/excel/OrderStatisticsThreeExcel.java

@@ -0,0 +1,77 @@
+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;
+import java.util.Date;
+
+/**
+ * 统计分析 客户利润明细,业务员利润明细,品牌利润明细导出统一实体类
+ */
+@Data
+@ColumnWidth(25)
+@HeadRowHeight(20)
+@ContentRowHeight(18)
+public class OrderStatisticsThreeExcel implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * 日期
+	 */
+	@ExcelProperty(value = "日期")
+	private Date createTime;
+
+	/**
+	 * 销售单号
+	 */
+	@ExcelProperty(value = "销售单号")
+	private String orderNo;
+
+	/**
+	 * 数量
+	 */
+	@ExcelProperty(value = "数量")
+	private Integer quantity;
+
+	/**
+	 * 金额
+	 */
+	@ExcelProperty(value = "金额")
+	private BigDecimal amount;
+
+	/**
+	 * 到货数量
+	 */
+	@ExcelProperty(value = "到货数量")
+	private BigDecimal actualQuantity;
+
+	/**
+	 * 到货金额
+	 */
+	@ExcelProperty(value = "到货金额")
+	private BigDecimal arrivalAmount;
+
+	/**
+	 * 返利
+	 */
+	@ExcelProperty(value = "返利")
+	private BigDecimal thisUsedProfit;
+
+	/**
+	 * 毛利额
+	 */
+	@ExcelProperty(value = "毛利额")
+	private BigDecimal netGrossProfit;
+
+	/**
+	 * 订单运费
+	 */
+	@ExcelProperty(value = "订单运费")
+	private BigDecimal predictOceanFreight;
+}

+ 65 - 0
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/excel/OrderStatisticsTwoExcel.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;
+import java.util.Date;
+
+/**
+ * 统计分析 发货业务员明细导出实体类
+ */
+@Data
+@ColumnWidth(25)
+@HeadRowHeight(20)
+@ContentRowHeight(18)
+public class OrderStatisticsTwoExcel implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * 日期
+	 */
+	@ExcelProperty(value = "日期")
+	private Date createTime;
+
+	/**
+	 * 销售单号
+	 */
+	@ExcelProperty(value = "销售单号")
+	private String orderNo;
+
+	/**
+	 * 数量
+	 */
+	@ExcelProperty(value = "数量")
+	private Integer quantity;
+
+	/**
+	 * 金额
+	 */
+	@ExcelProperty(value = "金额")
+	private BigDecimal amount;
+
+	/**
+	 * 到货数量
+	 */
+	@ExcelProperty(value = "到货数量")
+	private BigDecimal actualQuantity;
+
+	/**
+	 * 到货金额
+	 */
+	@ExcelProperty(value = "到货金额")
+	private BigDecimal arrivalAmount;
+
+	/**
+	 * 毛利额
+	 */
+	@ExcelProperty(value = "毛利额")
+	private BigDecimal grossProfit;
+}

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

@@ -23,10 +23,12 @@ import org.springblade.core.mp.support.Query;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.secure.utils.SecureUtil;
 import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.BeanUtil;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.core.tool.utils.ObjectUtil;
 import org.springblade.deliver.goods.entity.Delivery;
 import org.springblade.deliver.goods.feign.IDeliveryClient;
+import org.springblade.finance.excel.PayExcel;
 import org.springblade.finance.feign.IFinanceClient;
 import org.springblade.finance.vojo.Acc;
 import org.springblade.purchase.sales.entity.Order;
@@ -1223,5 +1225,51 @@ public class ExportOrderController extends BladeController {
 		}
 	}
 
+	/**
+	 * 统计分析明细导出统一接口
+	 */
+	@GetMapping("/统计分析明细导出统一接口")
+	@ApiOperation(value = "统计分析明细导出统一接口", notes = "统计分析明细导出统一接口")
+	public void timeUnifiedExport(OrderStatisticsVo statisticsVo, HttpServletResponse response){
+		statisticsVo.setTenantId(SecureUtil.getTenantId());
+		List<OrderStatisticsVo> list = new ArrayList<>();
+
+		if ("totalSummaryItem".equals(statisticsVo.getIdentification())){//数据金额明细导出
+			list = orderService.totalSummaryItemExport(statisticsVo);
+			List<OrderStatisticsOneExcel> excelList = BeanUtil.copy(list, OrderStatisticsOneExcel.class);
+			if (ObjectUtil.isNotEmpty(statisticsVo.getYear())){
+				ExcelUtil.export(response, statisticsVo.getYear() + "年" + statisticsVo.getMonth() + "月数量金额汇总明细统计",
+					statisticsVo.getYear() + "年" + statisticsVo.getMonth() + "月数量金额汇总明细统计", excelList, OrderStatisticsOneExcel.class);
+			}else {
+				ExcelUtil.export(response, "数量金额汇总明细统计", "数量金额汇总明细统计", excelList, OrderStatisticsOneExcel.class);
+			}
+		}else if ("corpStatisticsItem".equals(statisticsVo.getIdentification())){//发货客户明细导出
+			list = orderService.corpStatisticsItemExport(statisticsVo);
+			List<OrderStatisticsOneExcel> excelList = BeanUtil.copy(list, OrderStatisticsOneExcel.class);
+			ExcelUtil.export(response, "发货客户明细统计", "发货客户明细统计", excelList, OrderStatisticsOneExcel.class);
+		}else if ("specificationsProfitItem".equals(statisticsVo.getIdentification())){//发货规格明细导出
+			list = orderService.specificationsProfitItemExport(statisticsVo);
+			List<OrderStatisticsOneExcel> excelList = BeanUtil.copy(list, OrderStatisticsOneExcel.class);
+			ExcelUtil.export(response, "发货规格明细统计", "发货客户明细统计", excelList, OrderStatisticsOneExcel.class);
+		}else if ("salesmanStatisticsItem".equals(statisticsVo.getIdentification())){//发货业务员明细导出
+			list = orderService.salesmanStatisticsItemExport(statisticsVo);
+			List<OrderStatisticsTwoExcel> excelList = BeanUtil.copy(list, OrderStatisticsTwoExcel.class);
+			ExcelUtil.export(response, "发货业务员明细统计", "发货客户明细统计", excelList, OrderStatisticsTwoExcel.class);
+		}else if ("customerProfitItem".equals(statisticsVo.getIdentification())){//客户利润明细导出
+			list = orderService.customerProfitItemExport(statisticsVo);
+			List<OrderStatisticsThreeExcel> excelList = BeanUtil.copy(list, OrderStatisticsThreeExcel.class);
+			ExcelUtil.export(response, "客户利润明细统计", "客户利润明细统计", excelList, OrderStatisticsThreeExcel.class);
+		}else if ("salesmanProfitItem".equals(statisticsVo.getIdentification())){//业务员利润明细导出
+			list = orderService.salesmanProfitItemExport(statisticsVo);
+			List<OrderStatisticsThreeExcel> excelList = BeanUtil.copy(list, OrderStatisticsThreeExcel.class);
+			ExcelUtil.export(response, "业务员利润明细统计", "业务员利润明细统计", excelList, OrderStatisticsThreeExcel.class);
+		}else if ("brandProfitItem".equals(statisticsVo.getIdentification())){//品牌利润明细导出
+			list = orderService.brandProfitItemExport(statisticsVo);
+			List<OrderStatisticsThreeExcel> excelList = BeanUtil.copy(list, OrderStatisticsThreeExcel.class);
+			ExcelUtil.export(response, "品牌利润明细统计", "品牌利润明细统计", excelList, OrderStatisticsThreeExcel.class);
+		}
+
+	}
+
 
 }

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

@@ -2762,17 +2762,26 @@ ORDER BY
         business_order BO
         LEFT JOIN (
             SELECT
-                pid,
-                item_id,
-                IFNULL( sum( order_quantity ), 0 ) AS quantity,
-                IFNULL( sum( actual_quantity ), 0 ) AS actualQuantity,
-                IFNULL( SUM( actual_quantity * price ), 0 ) AS arrivalAmount
+                b.pid,
+                b.item_id,
+                IFNULL( sum( b.order_quantity ), 0 ) AS quantity,
+                IFNULL( sum( b.actual_quantity ), 0 ) AS actualQuantity,
+                IFNULL( sum( b.actual_quantity * b.price ), 0 ) AS arrivalAmount
             FROM
-                business_order_items
+                business_order_items b
+            LEFT JOIN basic_goods_desc BGD ON b.Item_id = BGD.id
             WHERE
-                is_deleted = 0
+                b.is_deleted = 0
+                AND b.tenant_id = '681169'
+                AND BGD.brand 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=")">
+                        '${item}'
+                    </foreach>
+                </if>
             GROUP BY
-            pid
+                b.pid
         ) BOI ON BOI.pid = BO.id
         LEFT JOIN basic_goods_desc BGD ON BOI.Item_id = BGD.id
         <where>

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

@@ -304,6 +304,11 @@ public interface IOrderService extends IService<Order> {
 	List<CorpStatisticsExcel> corpStatisticsExport(OrderStatisticsVo statisticsVo);
 
 	/**
+	 * 发货客户明细导出
+	 */
+	List<OrderStatisticsVo> corpStatisticsItemExport(OrderStatisticsVo statisticsVo);
+
+	/**
 	 * 发货业务员统计
 	 */
 	IPage<OrderStatisticsVo> salesmanStatistics(IPage<OrderStatisticsVo> page, OrderStatisticsVo statisticsVo);
@@ -319,6 +324,11 @@ public interface IOrderService extends IService<Order> {
 	List<SalesmanStatisticsExcel> salesmanStatisticsExport(OrderStatisticsVo statisticsVo);
 
 	/**
+	 * 发货业务员明细导出
+	 */
+	List<OrderStatisticsVo> salesmanStatisticsItemExport(OrderStatisticsVo statisticsVo);
+
+	/**
 	 * 业务员利润统计
 	 */
 	IPage<OrderStatisticsVo> salesmanProfit(IPage<OrderStatisticsVo> page, OrderStatisticsVo statisticsVo);
@@ -334,6 +344,11 @@ public interface IOrderService extends IService<Order> {
 	List<SalesmanProfitExcel> salesmanProfitExport(OrderStatisticsVo statisticsVo);
 
 	/**
+	 * 业务员利润明细导出
+	 */
+	List<OrderStatisticsVo> salesmanProfitItemExport(OrderStatisticsVo statisticsVo);
+
+	/**
 	 * 客户利润统计
 	 */
 	IPage<OrderStatisticsVo> customerProfit(IPage<OrderStatisticsVo> page, OrderStatisticsVo statisticsVo);
@@ -349,6 +364,11 @@ public interface IOrderService extends IService<Order> {
 	List<CustomerProfitExcel> customerProfitExport(OrderStatisticsVo statisticsVo);
 
 	/**
+	 * 客户利润明细导出
+	 */
+	List<OrderStatisticsVo> customerProfitItemExport(OrderStatisticsVo statisticsVo);
+
+	/**
 	 * 品牌利润对比统计
 	 */
 	IPage<OrderStatisticsVo> brandProfit(IPage<OrderStatisticsVo> page, OrderStatisticsVo statisticsVo);
@@ -364,6 +384,11 @@ public interface IOrderService extends IService<Order> {
 	List<BrandProfitExcel> brandProfitExport(OrderStatisticsVo statisticsVo);
 
 	/**
+	 * 品牌利润明细导出
+	 */
+	List<OrderStatisticsVo> brandProfitItemExport(OrderStatisticsVo statisticsVo);
+
+	/**
 	 * 发货规格统计
 	 */
 	IPage<OrderStatisticsVo> specificationsProfit(IPage<OrderStatisticsVo> page, OrderStatisticsVo statisticsVo);
@@ -379,6 +404,11 @@ public interface IOrderService extends IService<Order> {
 	List<SpecificationsProfitExcel> specificationsProfitExport(OrderStatisticsVo statisticsVo);
 
 	/**
+	 * 发货规格明细导出
+	 */
+	List<OrderStatisticsVo> specificationsProfitItemExport(OrderStatisticsVo statisticsVo);
+
+	/**
 	 * 数量金额汇总对比统计
 	 */
 	IPage<TotalSummaryVo> totalSummary(IPage<TotalSummaryVo> page, TotalSummaryVo totalSummaryVo);
@@ -394,6 +424,11 @@ public interface IOrderService extends IService<Order> {
 	List<TotalSummaryExcel> totalSummaryExport(TotalSummaryVo totalSummaryVo);
 
 	/**
+	 * 数量金额明细导出
+	 */
+	List<OrderStatisticsVo> totalSummaryItemExport(OrderStatisticsVo statisticsVo);
+
+	/**
 	 * 计算国内费用
 	 */
 	Map<String,Object> calculationDomesticFees(Order order);

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

@@ -15,8 +15,7 @@ import org.springblade.purchase.sales.mapper.BidingAgentMapper;
 import org.springblade.purchase.sales.service.IBidingAgentService;
 import org.springframework.stereotype.Service;
 
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 
 /**
  * 标书代理信息表 服务实现类
@@ -38,6 +37,10 @@ public class BidingAgentServiceImpl extends ServiceImpl<BidingAgentMapper, Bidin
 	 * @return
 	 */
 	public List<BidingAgent> saveBidingAgentMassage(List<BidingAgent> list, Long pid) {
+		Boolean msg = knowledgeIsRepeat(list);
+		if (msg){
+			throw new SecurityException("代理重复,请检查代理信息");
+		}
 		list.forEach(item -> {
 			if (item.getId() == null){//id为空 新增
 				item.setTenantId(SecureUtil.getTenantId());
@@ -96,4 +99,24 @@ public class BidingAgentServiceImpl extends ServiceImpl<BidingAgentMapper, Bidin
 
 		return bidingAgent;
 	}
+
+	/**
+	 * 判断List<BidingAgent>的对象agentId是否有重复,有重复true
+	 *
+	 * @param list
+	 * @return
+	 */
+	private Boolean knowledgeIsRepeat(List<BidingAgent> list) {
+		Set<BidingAgent> set = new TreeSet<BidingAgent>(new Comparator<BidingAgent>() {
+			public int compare(BidingAgent a, BidingAgent b) {
+				// 字符串则按照asicc码升序排列
+				return a.getAgentId().compareTo(b.getAgentId());
+			}
+		});
+		set.addAll(list);
+		if (set.size() < list.size()) {
+			return true;
+		}
+		return false;
+	}
 }

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

@@ -2017,6 +2017,14 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 	}
 
 	/**
+	 * 发货客户明细导出
+	 */
+	@Override
+	public List<OrderStatisticsVo> corpStatisticsItemExport(OrderStatisticsVo statisticsVo) {
+		return baseMapper.corpStatisticsItem(null, statisticsVo, statisticsVo.getBrand(), statisticsVo.getChargeMember());
+	}
+
+	/**
 	 * 发货业务员统计
 	 */
 	@Override
@@ -2041,6 +2049,14 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 	}
 
 	/**
+	 * 发货业务员明细导出
+	 */
+	@Override
+	public List<OrderStatisticsVo> salesmanStatisticsItemExport(OrderStatisticsVo statisticsVo) {
+		return baseMapper.salesmanStatisticsItem(null, statisticsVo, statisticsVo.getBrand(), statisticsVo.getChargeMember());
+	}
+
+	/**
 	 * 业务员利润统计
 	 */
 	@Override
@@ -2065,6 +2081,14 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 	}
 
 	/**
+	 * 业务员利润明细导出
+	 */
+	@Override
+	public List<OrderStatisticsVo> salesmanProfitItemExport(OrderStatisticsVo statisticsVo) {
+		return baseMapper.salesmanProfitItem(null, statisticsVo, statisticsVo.getBrand(), statisticsVo.getChargeMember());
+	}
+
+	/**
 	 * 客户利润统计
 	 */
 	@Override
@@ -2089,6 +2113,14 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 	}
 
 	/**
+	 * 客户利润明细导出
+	 */
+	@Override
+	public List<OrderStatisticsVo> customerProfitItemExport(OrderStatisticsVo statisticsVo) {
+		return baseMapper.customerProfitItem(null, statisticsVo, statisticsVo.getBrand());
+	}
+
+	/**
 	 * 品牌利润对比统计
 	 */
 	@Override
@@ -2113,6 +2145,14 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 	}
 
 	/**
+	 * 品牌利润对比明细导出
+	 */
+	@Override
+	public List<OrderStatisticsVo> brandProfitItemExport(OrderStatisticsVo statisticsVo) {
+		return baseMapper.brandProfitItem(null, statisticsVo, statisticsVo.getBrand());
+	}
+
+	/**
 	 * 发货规格统计
 	 */
 	@Override
@@ -2137,6 +2177,14 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 	}
 
 	/**
+	 * 发货规格明细导出
+	 */
+	@Override
+	public List<OrderStatisticsVo> specificationsProfitItemExport(OrderStatisticsVo statisticsVo) {
+		return baseMapper.specificationsProfitItem(null, statisticsVo, statisticsVo.getBrand(), statisticsVo.getChargeMember());
+	}
+
+	/**
 	 * 数量金额汇总对比统计
 	 */
 	@Override
@@ -2161,6 +2209,14 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 	}
 
 	/**
+	 * 数量金额汇总对比统计导出
+	 */
+	@Override
+	public List<OrderStatisticsVo> totalSummaryItemExport(OrderStatisticsVo statisticsVo) {
+		return baseMapper.totalSummaryItem(null, statisticsVo, statisticsVo.getBrand());
+	}
+
+	/**
 	 * 计算国内费用
 	 *
 	 * @param order

+ 43 - 41
blade-service/trade-finance/src/main/java/org/springblade/finance/mapper/AccMapper.xml

@@ -69,54 +69,56 @@
         IFNULL( BC.amount, 0 ) AS amount,
         IFNULL( FS.settlementAmount, 0 ) AS settlementAmount,
         IFNULL( IFNULL( BC.amount, 0 ) - IFNULL( FS.settlementAmount, 0 ), 0 ) AS balance,
-        IFNULL( BO.in_overpayment, 0 ) AS inOverpayment,
+        IFNULL( FS.caseOverPayment, 0 ) AS caseOverPayment,
+        IFNULL( BO.balance_overpaymen, 0 ) AS inOverpayment,
         BCD.opening_amount AS openingAmount
         FROM finance_acc FC
         LEFT JOIN basic_corps_desc BCD ON BCD.id = FC.Corpid
         LEFT JOIN business_overpayment BO ON BO.corp_id = FC.Corpid
         LEFT JOIN (
-        SELECT
-        FC.Corpid AS corpId,
-        SUM( FC.Amount ) AS amount
-        FROM finance_acc FC
-        <where>
-            FC.tenant_id = #{acc.tenantId}
-            and FC.is_deleted = 0
-            and FC.bill_type = #{acc.billType}
-            <if test='acc.createDateList != null and acc.createDateList[0] != null and acc.createDateList[0]!= ""'>
-                and FC.create_time &gt;= #{acc.createDateList[0]}
-            </if>
-            <if test='acc.createDateList != null and acc.createDateList[1] != null and acc.createDateList[1]!= ""'>
-                and FC.create_time &lt;= #{acc.createDateList[1]}
-            </if>
-        </where>
-        GROUP BY
-        FC.Corpid
+            SELECT
+                FC.Corpid AS corpId,
+                SUM( FC.Amount ) AS amount
+            FROM finance_acc FC
+            <where>
+                FC.tenant_id = #{acc.tenantId}
+                and FC.is_deleted = 0
+                and FC.bill_type = #{acc.billType}
+                <if test='acc.createDateList != null and acc.createDateList[0] != null and acc.createDateList[0]!= ""'>
+                    and FC.create_time &gt;= #{acc.createDateList[0]}
+                </if>
+                <if test='acc.createDateList != null and acc.createDateList[1] != null and acc.createDateList[1]!= ""'>
+                    and FC.create_time &lt;= #{acc.createDateList[1]}
+                </if>
+            </where>
+            GROUP BY
+            FC.Corpid
         ) BC ON BC.corpId = FC.Corpid
         LEFT JOIN (
-        SELECT
-        FS.Corp_id AS corpId,
-        sum( FS.Amount ) AS settlementAmount
-        FROM finance_settlement FS
-        <where>
-            FS.tenant_id = #{acc.tenantId}
-            AND FS.is_deleted = 0
-            AND FS.finance_status = '结算完成'
-            <if test='acc.billType != null and acc.billType != "" and acc.billType == "申请"'>
-                AND FS.bill_type = '付费'
-            </if>
-            <if test='acc.billType != null and acc.billType != "" and acc.billType == "收费"'>
-                AND FS.bill_type = #{acc.billType}
-            </if>
-            <if test='acc.createDateList != null and acc.createDateList[0] != null and acc.createDateList[0]!= ""'>
-                and FS.completion_time &gt;= #{acc.createDateList[0]}
-            </if>
-            <if test='acc.createDateList != null and acc.createDateList[1] != null and acc.createDateList[1]!= ""'>
-                and FS.completion_time &lt;= #{acc.createDateList[1]}
-            </if>
-        </where>
-        GROUP BY
-        FS.Corp_id
+            SELECT
+                FS.Corp_id AS corpId,
+                sum( FS.Amount ) AS settlementAmount,
+                sum( case_over_payment ) AS caseOverPayment
+            FROM finance_settlement FS
+            <where>
+                FS.tenant_id = #{acc.tenantId}
+                AND FS.is_deleted = 0
+                AND FS.finance_status = '结算完成'
+                <if test='acc.billType != null and acc.billType != "" and acc.billType == "申请"'>
+                    AND FS.bill_type = '付费'
+                </if>
+                <if test='acc.billType != null and acc.billType != "" and acc.billType == "收费"'>
+                    AND FS.bill_type = #{acc.billType}
+                </if>
+                <if test='acc.createDateList != null and acc.createDateList[0] != null and acc.createDateList[0]!= ""'>
+                    and FS.completion_time &gt;= #{acc.createDateList[0]}
+                </if>
+                <if test='acc.createDateList != null and acc.createDateList[1] != null and acc.createDateList[1]!= ""'>
+                    and FS.completion_time &lt;= #{acc.createDateList[1]}
+                </if>
+            </where>
+            GROUP BY
+            FS.Corp_id
         ) FS ON FS.corpId = FC.Corpid
         <where>
             FC.tenant_id = #{acc.tenantId}