瀏覽代碼

运营中心V1.1-导出优化

longmeizhen@avic-s.com 1 年之前
父節點
當前提交
edbb04893c
共有 17 個文件被更改,包括 999 次插入61 次删除
  1. 42 0
      superdesk-uniorder-common/src/main/java/cn/superdesk/uniorder/common/excel/biz/CommentWriteHandler.java
  2. 42 0
      superdesk-uniorder-common/src/main/java/cn/superdesk/uniorder/common/excel/biz/CustomCellWriteHandler.java
  3. 22 0
      superdesk-uniorder-common/src/main/java/cn/superdesk/uniorder/common/excel/biz/CustomSheetWriteHandler.java
  4. 22 0
      superdesk-uniorder-common/src/main/java/cn/superdesk/uniorder/common/excel/biz/CustomSheetWriteNameHandler.java
  5. 33 0
      superdesk-uniorder-common/src/main/java/cn/superdesk/uniorder/common/excel/biz/CustomWorkbookWriteHandler.java
  6. 29 0
      superdesk-uniorder-common/src/main/java/cn/superdesk/uniorder/common/excel/converters/operator/CustomGoodsVonverter.java
  7. 3 0
      superdesk-uniorder-dao/src/main/resources/mappers/accounting/unified/operator/AccountingUnifiedOperatorMapperEx.xml
  8. 1 0
      superdesk-uniorder-dto/src/main/java/cn/superdesk/uniorder/dto/param/accounting/unified/operator/AccountingUnifiedOperatorQueryParam.java
  9. 1 0
      superdesk-uniorder-dto/src/main/java/cn/superdesk/uniorder/dto/param/operationCenter/base/OperationCenterParam.java
  10. 21 0
      superdesk-uniorder-dto/src/main/java/cn/superdesk/uniorder/dto/vo/accounting/unified/operator/BillVo.java
  11. 2 0
      superdesk-uniorder-dto/src/main/java/cn/superdesk/uniorder/dto/vo/accounting/unified/operator/SettlementProgrammeVo.java
  12. 121 0
      superdesk-uniorder-dto/src/main/java/cn/superdesk/uniorder/dto/vo/accounting/unified/operator/excel/GoodsVo.java
  13. 599 27
      superdesk-uniorder-service/src/main/java/cn/superdesk/uniorder/service/accounting/unified/operator/Impl/AccountingUnifiedOperatorServiceImpl.java
  14. 2 2
      superdesk-uniorder-web/src/main/java/cn/superdesk/uniorder/controller/accounting/operator/AccountingUnifiedOperatorContoller.java
  15. 14 2
      superdesk-uniorder-web/src/main/java/cn/superdesk/uniorder/controller/operationCenter/base/OperationCenterBaseController.java
  16. 30 30
      superdesk-uniorder-web/src/main/java/cn/superdesk/uniorder/controller/sys/SysUserController.java
  17. 15 0
      superdesk-uniorder-web/src/main/java/cn/superdesk/uniorder/dubbo/consumer/operationCenter/base/OperationCenterBaseDubboService.java

+ 42 - 0
superdesk-uniorder-common/src/main/java/cn/superdesk/uniorder/common/excel/biz/CommentWriteHandler.java

@@ -0,0 +1,42 @@
+package cn.superdesk.uniorder.common.excel.biz;
+
+import cn.hutool.json.JSONUtil;
+import com.alibaba.excel.write.handler.RowWriteHandler;
+import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
+import com.alibaba.excel.write.metadata.holder.WriteTableHolder;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.ss.usermodel.Row;
+import org.springframework.util.CollectionUtils;
+
+import java.util.List;
+
+@Slf4j
+public class CommentWriteHandler implements RowWriteHandler {
+
+    private List<Integer> hidderRows;
+
+    public CommentWriteHandler(List<Integer> hidderRows) {
+        this.hidderRows = hidderRows;
+    }
+    @Override
+    public void beforeRowCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Integer integer, Integer integer1, Boolean aBoolean) {
+    }
+
+    @Override
+    public void afterRowCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Row row, Integer integer, Boolean aBoolean) {
+        log.info("row-index1:{}", JSONUtil.toJsonStr(row));
+        if (!CollectionUtils.isEmpty(hidderRows)) {
+            // 删除列
+            writeSheetHolder.getSheet().removeRow(row);
+        }
+    }
+
+    @Override
+    public void afterRowDispose(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Row row, Integer integer, Boolean aBoolean) {
+        log.info("row-index2:{}", JSONUtil.toJsonStr(row));
+        if (!CollectionUtils.isEmpty(hidderRows) && hidderRows.contains(row.getRowNum())) {
+            // 删除列
+            writeSheetHolder.getSheet().removeRow(row);
+        }
+    }
+}

+ 42 - 0
superdesk-uniorder-common/src/main/java/cn/superdesk/uniorder/common/excel/biz/CustomCellWriteHandler.java

@@ -0,0 +1,42 @@
+package cn.superdesk.uniorder.common.excel.biz;
+
+import cn.hutool.json.JSONUtil;
+import com.alibaba.excel.metadata.CellData;
+import com.alibaba.excel.metadata.Head;
+import com.alibaba.excel.write.handler.CellWriteHandler;
+import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
+import com.alibaba.excel.write.metadata.holder.WriteTableHolder;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.ss.usermodel.*;
+import org.springframework.util.CollectionUtils;
+
+import java.util.List;
+
+@Slf4j
+public class CustomCellWriteHandler implements CellWriteHandler {
+    /**
+     * 隐藏索引列数
+     */
+    private List<Integer> hiddenIndices;
+    public CustomCellWriteHandler(List<Integer> hiddenIndices) {
+        this.hiddenIndices = hiddenIndices;
+    }
+    @Override
+    public void beforeCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Row row, Head head, Integer columnIndex, Integer relativeRowIndex, Boolean isHead) {
+    }
+    @Override
+    public void afterCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Cell cell, Head head, Integer relativeRowIndex, Boolean isHead) {
+    }
+
+    @Override
+    public void afterCellDataConverted(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, CellData cellData, Cell cell, Head head, Integer integer, Boolean aBoolean) {
+    }
+
+    @Override
+    public void afterCellDispose(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, List<CellData> cellDataList, Cell cell, Head head, Integer relativeRowIndex, Boolean isHead) {
+        if (!CollectionUtils.isEmpty(hiddenIndices) && hiddenIndices.contains(cell.getColumnIndex())) {
+            // 删除列
+            writeSheetHolder.getSheet().setColumnHidden(cell.getColumnIndex(),true);
+        }
+    }
+}

+ 22 - 0
superdesk-uniorder-common/src/main/java/cn/superdesk/uniorder/common/excel/biz/CustomSheetWriteHandler.java

@@ -0,0 +1,22 @@
+package cn.superdesk.uniorder.common.excel.biz;
+
+import com.alibaba.excel.write.handler.SheetWriteHandler;
+import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
+import com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder;
+
+import java.util.List;
+
+public class CustomSheetWriteHandler implements SheetWriteHandler {
+
+    @Override
+    public void beforeSheetCreate(WriteWorkbookHolder writeWorkbookHolder, WriteSheetHolder writeSheetHolder) {
+
+    }
+
+    @Override
+    public void afterSheetCreate(WriteWorkbookHolder writeWorkbookHolder, WriteSheetHolder writeSheetHolder) {
+        String sheetName = writeSheetHolder.getSheetName();
+        int sheetNo = writeWorkbookHolder.getWorkbook().getSheetIndex(sheetName);
+        writeWorkbookHolder.getWorkbook().setSheetName(sheetNo,sheetName+"删除");
+    }
+}

+ 22 - 0
superdesk-uniorder-common/src/main/java/cn/superdesk/uniorder/common/excel/biz/CustomSheetWriteNameHandler.java

@@ -0,0 +1,22 @@
+package cn.superdesk.uniorder.common.excel.biz;
+
+import com.alibaba.excel.write.handler.SheetWriteHandler;
+import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
+import com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder;
+
+public class CustomSheetWriteNameHandler implements SheetWriteHandler {
+
+
+
+    @Override
+    public void beforeSheetCreate(WriteWorkbookHolder writeWorkbookHolder, WriteSheetHolder writeSheetHolder) {
+
+    }
+
+    @Override
+    public void afterSheetCreate(WriteWorkbookHolder writeWorkbookHolder, WriteSheetHolder writeSheetHolder) {
+        String sheetName = writeSheetHolder.getSheetName();
+        int sheetNo = writeWorkbookHolder.getWorkbook().getSheetIndex(sheetName);
+        writeWorkbookHolder.getWorkbook().setSheetName(sheetNo,"账单");
+    }
+}

+ 33 - 0
superdesk-uniorder-common/src/main/java/cn/superdesk/uniorder/common/excel/biz/CustomWorkbookWriteHandler.java

@@ -0,0 +1,33 @@
+package cn.superdesk.uniorder.common.excel.biz;
+
+import com.alibaba.excel.write.handler.AbstractWorkbookWriteHandler;
+import com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder;
+import com.google.common.collect.Lists;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+
+import java.util.List;
+
+public class CustomWorkbookWriteHandler extends AbstractWorkbookWriteHandler {
+
+    @Override
+    public void afterWorkbookDispose(WriteWorkbookHolder writeWorkbookHolder) {
+        Workbook workbook =  writeWorkbookHolder.getWorkbook();
+        int numberOfSheets = workbook.getNumberOfSheets();
+        List<String> removeList = Lists.newArrayList();
+        for (int i=0; i<numberOfSheets; i++) {
+            Sheet sheetAt = workbook.getSheetAt(i);
+            String sheetName = sheetAt.getSheetName();
+            if(sheetName.endsWith("删除")){
+                removeList.add(sheetName);
+            }
+        }
+        if (CollectionUtils.isNotEmpty(removeList)) {
+            removeList.forEach(e -> {
+                int sheetIndex = workbook.getSheetIndex(e);
+                workbook.removeSheetAt(sheetIndex);
+            });
+        }
+    }
+}

+ 29 - 0
superdesk-uniorder-common/src/main/java/cn/superdesk/uniorder/common/excel/converters/operator/CustomGoodsVonverter.java

@@ -0,0 +1,29 @@
+package cn.superdesk.uniorder.common.excel.converters.operator;
+
+import com.alibaba.excel.converters.Converter;
+import com.alibaba.excel.enums.CellDataTypeEnum;
+import com.alibaba.excel.metadata.CellData;
+import com.alibaba.excel.metadata.GlobalConfiguration;
+import com.alibaba.excel.metadata.property.ExcelContentProperty;
+
+public class CustomGoodsVonverter implements Converter<String> {
+    @Override
+    public Class supportJavaTypeKey() {
+        return null;
+    }
+
+    @Override
+    public CellDataTypeEnum supportExcelTypeKey() {
+        return null;
+    }
+
+    @Override
+    public String convertToJavaData(CellData cellData, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
+        return null;
+    }
+
+    @Override
+    public CellData convertToExcelData(String s, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
+        return null;
+    }
+}

+ 3 - 0
superdesk-uniorder-dao/src/main/resources/mappers/accounting/unified/operator/AccountingUnifiedOperatorMapperEx.xml

@@ -58,6 +58,9 @@
         <if test="id != null">
             AND t.id = #{id}
         </if>
+        <if test="ids != null and ids != ''">
+            AND t.id  in (${ids})
+        </if>
         <choose>
             <when test="accountingType == 1 and (accountingStatus == null or accountingStatus == '') ">
                 AND ( t.accounting_status = 1 OR t.accounting_status = 2 OR t.accounting_status = 7 )

+ 1 - 0
superdesk-uniorder-dto/src/main/java/cn/superdesk/uniorder/dto/param/accounting/unified/operator/AccountingUnifiedOperatorQueryParam.java

@@ -12,6 +12,7 @@ public class AccountingUnifiedOperatorQueryParam implements Serializable {
 
     private Integer accountingType;
     private Long id;
+    private String ids;
 
     private Long billId;//账单id
 

+ 1 - 0
superdesk-uniorder-dto/src/main/java/cn/superdesk/uniorder/dto/param/operationCenter/base/OperationCenterParam.java

@@ -15,4 +15,5 @@ public class OperationCenterParam implements Serializable {
     private String operatorIds;//运营商id-多选
     private String orgIds;//项目id - 多选
     private String enterpriseIds;//企业id-多选
+    private Integer type;
 }

+ 21 - 0
superdesk-uniorder-dto/src/main/java/cn/superdesk/uniorder/dto/vo/accounting/unified/operator/BillVo.java

@@ -1,5 +1,6 @@
 package cn.superdesk.uniorder.dto.vo.accounting.unified.operator;
 
+import cn.superdesk.uniorder.dto.vo.unified.settlement.RangeRuleVo;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
@@ -58,7 +59,27 @@ public class BillVo  implements Serializable {
     @ApiModelProperty("账号")
     private String bankAccount;
 
+    //结算方案相关的内容
+    @ApiModelProperty("账单名称")
     private String exportBillName;
+    @ApiModelProperty("明细字段")
+    private String exportField;
+    @ApiModelProperty("方案id")
+    private Long programmeId;
+    @ApiModelProperty("方案名称")
+    private String programmeName;
+    @ApiModelProperty("方案编码")
+    private String programmeNo;
+    @ApiModelProperty("结算范围")
+    private Integer settlementScope;
+    @ApiModelProperty("结算规则")
+    private Integer settlementRule;
+    @ApiModelProperty("供应商名称展示规则")
+    private Integer supnameDisplayRule;
+    @ApiModelProperty("自定义供应商名称")
+    private String customSupplierName;
+    private List<RangeRuleVo> rangeRuleVoList = new ArrayList<>();
+
 
     private List goodsList = new ArrayList<>();
     private List waterList = new ArrayList<>();

+ 2 - 0
superdesk-uniorder-dto/src/main/java/cn/superdesk/uniorder/dto/vo/accounting/unified/operator/SettlementProgrammeVo.java

@@ -1,9 +1,11 @@
 package cn.superdesk.uniorder.dto.vo.accounting.unified.operator;
 
+import cn.superdesk.uniorder.dto.vo.unified.settlement.RangeRuleVo;
 import lombok.Data;
 
 import java.io.Serializable;
 import java.util.Date;
+import java.util.List;
 
 /**
  * 结算方案

+ 121 - 0
superdesk-uniorder-dto/src/main/java/cn/superdesk/uniorder/dto/vo/accounting/unified/operator/excel/GoodsVo.java

@@ -0,0 +1,121 @@
+package cn.superdesk.uniorder.dto.vo.accounting.unified.operator.excel;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+
+@JsonSerialize(include= JsonSerialize.Inclusion.NON_NULL)
+@Data
+public class GoodsVo {
+    @ExcelProperty("ID")
+    private String id;
+    @ExcelProperty("订单编号")
+    private String orderNumber;
+    @ExcelProperty("三方单号")
+    private String thirdNo;
+    @ExcelProperty("业务平台")
+    private String bizPlatfrom;
+    @ExcelProperty("运营商")
+    private String operatorName;
+    @ExcelProperty("项目名称")
+    private String orgName;
+    @ExcelProperty("企业名称")
+    private String virtName;
+    @ExcelProperty("下单人id")
+    private String createdBy;
+    @ExcelProperty("下单人姓名")
+    private String createdName;
+    @ExcelProperty("下单人手机号码")
+    private String createdMobile;
+
+    @ExcelProperty("订单类型")
+    private String orderType;
+    @ExcelProperty("业务类型")
+    private String businessType;
+    @ExcelProperty("订单时间")
+    private String orderTime;
+    @ExcelProperty("支付/退款时间")
+    private String operateTime;
+    @ExcelProperty("发货时间")
+    private String deliveryTime;
+    @ExcelProperty("完成时间")
+    private String finishTime;
+    @ExcelProperty("商品类型")
+    private String goodsType;
+    @ExcelProperty("商品id")
+    private String goodsId;
+    @ExcelProperty("商品名称")
+    private String goodsName;
+    @ExcelProperty("商品编码")
+    private String goodsCode;
+
+    @ExcelProperty("商品规格")
+    private String goodsSpecs;
+    @ExcelProperty("一级分类")
+    private String firstClassify;
+    @ExcelProperty("二级分类")
+    private String secondClassify;
+    @ExcelProperty("三级分类")
+    private String threeClassify;
+    @ExcelProperty("商品数量")
+    private String goodsQuantity;
+    @ExcelProperty("商品单位")
+    private String goodsUnit;
+    @ExcelProperty("商品原单价")
+    private BigDecimal goodsPrice;
+    @ExcelProperty("商品原总价")
+    private BigDecimal goodsSumPrice;
+    @ExcelProperty("商品销售单价")
+    private BigDecimal goodsSalePrice;
+    @ExcelProperty("商品销售总价")
+    private BigDecimal goodsSumSalePrice;
+
+    @ExcelProperty("商品成本单价")
+    private BigDecimal goodsCostPrice;
+    @ExcelProperty("商品成本总价")
+    private BigDecimal goodsSumCostPrice;
+    @ExcelProperty("优惠金额")
+    private BigDecimal discountPrice;
+    @ExcelProperty("结算金额")
+    private BigDecimal settlementPrice;
+    @ExcelProperty("交易状态")
+    private String transactionStatus;
+    @ExcelProperty("订单状态")
+    private String orderStatus;
+    @ExcelProperty("售后类型")
+    private String afterSaleType;
+    @ExcelProperty("支付方式")
+    private String payWay;
+    @ExcelProperty("收货地址")
+    private String address;
+    @ExcelProperty("快递公司")
+    private String expressCompany;
+
+    @ExcelProperty("快递单号")
+    private String expressNo;
+    @ExcelProperty("退单原单号")
+    private String chargebackNo;
+    @ExcelProperty("供应商名称")
+    private String supplierName;
+
+    @ExcelProperty("成本单价")
+    private BigDecimal costPrice;
+    @ExcelProperty("成本总价")
+    private BigDecimal sumCostPrice;
+
+    @ExcelProperty("更新时间")
+    private String updatedTime;
+
+    @ExcelProperty("订单金额(用户实际支付/退款金额)")
+    private BigDecimal orderPrice;
+    @ExcelProperty("是否参与结算")
+    private String isJoinSettlement;
+    @ExcelProperty("积分类型")
+    private String integralType;
+    @ExcelProperty("积分批次")
+    private String integralBatch;
+
+}

+ 599 - 27
superdesk-uniorder-service/src/main/java/cn/superdesk/uniorder/service/accounting/unified/operator/Impl/AccountingUnifiedOperatorServiceImpl.java

@@ -2,10 +2,11 @@ package cn.superdesk.uniorder.service.accounting.unified.operator.Impl;
 
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.io.FileUtil;
-import cn.superdesk.uniorder.common.enums.accounting.operator.AccountingEmailStatusEnum;
-import cn.superdesk.uniorder.common.enums.accounting.operator.AccountingOrderOperatorAccountStatusEnum;
+import cn.superdesk.uniorder.common.enums.accounting.operator.*;
 import cn.superdesk.uniorder.common.enums.thirdpart.jd.SysQuartzScheduleTaskStatementOfAccountRunStateEnum;
-import cn.superdesk.uniorder.common.excel.strategy.style.EasyExcelCustomCellWriteHandler;
+import cn.superdesk.uniorder.common.excel.biz.CustomSheetWriteHandler;
+import cn.superdesk.uniorder.common.excel.biz.CustomSheetWriteNameHandler;
+import cn.superdesk.uniorder.common.excel.biz.CustomWorkbookWriteHandler;
 import cn.superdesk.uniorder.common.sequence.GenRandomHelper;
 import cn.superdesk.uniorder.dao.entity.accounting.unified.operator.AccountingUnifiedOperator;
 import cn.superdesk.uniorder.dao.entity.accounting.unified.operator.AccountingUnifiedOperatorWithBLOBs;
@@ -16,31 +17,35 @@ import cn.superdesk.uniorder.dao.mapper.accounting.unified.operator.AccountingUn
 import cn.superdesk.uniorder.dao.mapper.accounting.unified.operator.AccountingUnifiedOperatorMapperEx;
 import cn.superdesk.uniorder.dao.mapper.operationCenter.UnifiedBillStartMapper;
 import cn.superdesk.uniorder.dao.mapper.unified.settlement.UnifiedSettlementProgrammeMapper;
+import cn.superdesk.uniorder.dao.mapper.unified.settlement.UnifiedSettlementProgrammeRangeRuleMapperEx;
 import cn.superdesk.uniorder.dto._constant.ResourceConstant;
 import cn.superdesk.uniorder.dto.param.accounting.unified.operator.AccountingUnifiedOperatorQueryParam;
 import cn.superdesk.uniorder.dto.vo.accounting.unified.operator.*;
+import cn.superdesk.uniorder.dto.vo.accounting.unified.operator.excel.GoodsVo;
+import cn.superdesk.uniorder.dto.vo.unified.settlement.RangeRuleVo;
 import cn.superdesk.uniorder.notify.NotifyUtils;
 import cn.superdesk.uniorder.service.accounting.unified.operator.AccountingUnifiedOperatorService;
 import com.alibaba.excel.EasyExcel;
 import com.alibaba.excel.ExcelWriter;
 import com.alibaba.excel.write.builder.ExcelWriterBuilder;
 import com.alibaba.excel.write.metadata.WriteSheet;
+import com.alibaba.excel.write.metadata.WriteTable;
 import com.alibaba.excel.write.metadata.fill.FillConfig;
 import com.alibaba.excel.write.metadata.fill.FillWrapper;
-import com.alibaba.excel.write.metadata.style.WriteCellStyle;
+import com.alibaba.fastjson2.JSON;
 import com.github.pagehelper.PageInfo;
+import com.google.common.collect.Lists;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import net.sf.json.JSONObject;
 import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.io.File;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.math.BigDecimal;
+import java.util.*;
 
 @Slf4j
 @Service
@@ -56,6 +61,8 @@ public class AccountingUnifiedOperatorServiceImpl implements AccountingUnifiedOp
 
     private final ResourceConstant excelExportConstant;
 
+    private final UnifiedSettlementProgrammeRangeRuleMapperEx unifiedSettlementProgrammeRangeRuleMapperEx;
+
     private static final String EXPORT_ACCOUNTING_OPERATION_TEMPLATE = "AccountingOperatorExportTemplate.xls";
     private static final String EXPORT_ACCOUNTING_OP_TEMPLATE = "AccountingOpExportTemplate.xls";
     private static final String EXPORT_ACCOUNTING_OP_SUPPLIER_TEMPLATE = "AccountingOpSupplierExportTemplate.xls";
@@ -160,19 +167,60 @@ public class AccountingUnifiedOperatorServiceImpl implements AccountingUnifiedOp
 
         FileUtil.touch(targetWriteFileFullPath);
 
+        BillVo billVo = getBillVoByAccountingBill(param.getId());
+
+
         ExcelWriterBuilder excelWriterBuilder = EasyExcel.write(targetWriteFileFullPath);
-        ExcelWriter excelWriter = null;
-        WriteSheet writeSheet0 = EasyExcel.writerSheet(0, "账单").build();
-        WriteSheet writeSheet1 = EasyExcel.writerSheet(1, "商品明细").build();
-        WriteSheet writeSheet2 = EasyExcel.writerSheet(2, "流水明细").build();
-        excelWriter = excelWriterBuilder.withTemplate(templateFullPath).build();
+        ExcelWriter excelWriter = excelWriterBuilder.withTemplate(templateFullPath).registerWriteHandler(new CustomWorkbookWriteHandler()).build();
+        WriteSheet writeSheet0 = null;
+        WriteSheet writeSheet1 = null;
+        WriteSheet writeSheet2 = null;
+        WriteSheet writeSheet3 = null;
+        if(SettlementRuleEnum.结算金额.getKey().equals(billVo.getSettlementRule())){
+            writeSheet0 = EasyExcel.writerSheet(0, "账单1").registerWriteHandler(new CustomSheetWriteNameHandler()).build();
+            writeSheet1 = EasyExcel.writerSheet(1, "账单2").registerWriteHandler(new CustomSheetWriteHandler()).build();
+            writeSheet2 = EasyExcel.writerSheet(2, "账单3").registerWriteHandler(new CustomSheetWriteHandler()).build();
+            writeSheet3 = EasyExcel.writerSheet(3, "账单4").registerWriteHandler(new CustomSheetWriteHandler()).build();
+        }else if(SettlementRuleEnum.结算金额_合作分润_服务费.getKey().equals(billVo.getSettlementRule())){
+            writeSheet0 = EasyExcel.writerSheet(0, "账单1").registerWriteHandler(new CustomSheetWriteHandler()).build();
+            writeSheet1 = EasyExcel.writerSheet(1, "账单2").registerWriteHandler(new CustomSheetWriteNameHandler()).build();
+            writeSheet2 = EasyExcel.writerSheet(2, "账单3").registerWriteHandler(new CustomSheetWriteHandler()).build();
+            writeSheet3 = EasyExcel.writerSheet(3, "账单4").registerWriteHandler(new CustomSheetWriteHandler()).build();
+        }else if(SettlementRuleEnum.结算金额_合作分润.getKey().equals(billVo.getSettlementRule())){
+            writeSheet0 = EasyExcel.writerSheet(0, "账单1").registerWriteHandler(new CustomSheetWriteHandler()).build();
+            writeSheet1 = EasyExcel.writerSheet(1, "账单2").registerWriteHandler(new CustomSheetWriteHandler()).build();
+            writeSheet2 = EasyExcel.writerSheet(2, "账单3").registerWriteHandler(new CustomSheetWriteNameHandler()).build();
+            writeSheet3 = EasyExcel.writerSheet(3, "账单4").registerWriteHandler(new CustomSheetWriteHandler()).build();
+        }else if(SettlementRuleEnum.结算金额_服务费.getKey().equals(billVo.getSettlementRule())){
+            writeSheet0 = EasyExcel.writerSheet(0, "账单1").registerWriteHandler(new CustomSheetWriteHandler()).build();
+            writeSheet1 = EasyExcel.writerSheet(1, "账单2").registerWriteHandler(new CustomSheetWriteHandler()).build();
+            writeSheet2 = EasyExcel.writerSheet(2, "账单3").registerWriteHandler(new CustomSheetWriteHandler()).build();
+            writeSheet3 = EasyExcel.writerSheet(3, "账单4").registerWriteHandler(new CustomSheetWriteNameHandler()).build();
+        }else{
+            log.info("异常,结算规则超出所定义的范围内");
+        }
 
+        WriteSheet writeSheet4 = new WriteSheet();
+        writeSheet4.setSheetNo(4);
+        writeSheet4.setSheetName("商品明细");
+        WriteTable writeTable4 = new WriteTable();
+        writeTable4.setTableNo(1);
+        writeTable4.setHead(heads(billVo,goodsTitles1()));
 
+        WriteSheet writeSheet5 = new WriteSheet();
+        writeSheet5.setSheetNo(5);
+        writeSheet5.setSheetName("流水明细");
+        WriteTable writeTable5 = new WriteTable();
+        writeTable5.setTableNo(1);
+        writeTable5.setHead(heads(billVo,waterTitles()));
 
         FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.FALSE).build();
-        excelWriter.fill(new FillWrapper("account", null), fillConfig, writeSheet0);
-        excelWriter.fill(new FillWrapper("detail", null), fillConfig, writeSheet1);
-        excelWriter.fill(new FillWrapper("detail", null), fillConfig, writeSheet2);
+        excelWriter.fill(billVo, fillConfig, writeSheet0);
+        excelWriter.fill(billVo, fillConfig, writeSheet1);
+        excelWriter.fill(billVo, fillConfig, writeSheet2);
+        excelWriter.fill(billVo, fillConfig, writeSheet3);
+        excelWriter.write(dataList(billVo.getGoodsList(),billVo,goodsFiled1()), writeSheet4,writeTable4);
+        excelWriter.write(dataList(billVo.getWaterList(),billVo,waterFiled()), writeSheet5,writeTable5);
         excelWriter.finish();
 
         return NotifyUtils.createSysNotify(targetFileName, relativePath + targetFileName, SysQuartzScheduleTaskStatementOfAccountRunStateEnum.成功);
@@ -197,24 +245,74 @@ public class AccountingUnifiedOperatorServiceImpl implements AccountingUnifiedOp
 
         FileUtil.touch(targetWriteFileFullPath);
 
-        ExcelWriterBuilder excelWriterBuilder = EasyExcel.write(targetWriteFileFullPath);
+//        ExcelWriterBuilder excelWriterBuilder = EasyExcel.write(targetWriteFileFullPath,Map.class);
 
         BillVo billVo = getBillVoByAccountingBill(param.getId());
 
-        ExcelWriter excelWriter = null;
-        WriteSheet writeSheet0 = EasyExcel.writerSheet(0, "账单").build();
-        WriteSheet writeSheet1 = EasyExcel.writerSheet(1, "商品明细").build();
-        WriteSheet writeSheet2 = EasyExcel.writerSheet(2, "流水明细").build();
-        excelWriter = excelWriterBuilder.withTemplate(templateFullPath).build();
+
+        ExcelWriterBuilder excelWriterBuilder = EasyExcel.write(targetWriteFileFullPath);
+        ExcelWriter excelWriter = excelWriterBuilder.withTemplate(templateFullPath).registerWriteHandler(new CustomWorkbookWriteHandler()).build();
+        WriteSheet writeSheet0 = null;
+        WriteSheet writeSheet1 = null;
+        WriteSheet writeSheet2 = null;
+        WriteSheet writeSheet3 = null;
+        if(SettlementRuleEnum.结算金额.getKey().equals(billVo.getSettlementRule())){
+            writeSheet0 = EasyExcel.writerSheet(0, "账单1").registerWriteHandler(new CustomSheetWriteNameHandler()).build();
+            writeSheet1 = EasyExcel.writerSheet(1, "账单2").registerWriteHandler(new CustomSheetWriteHandler()).build();
+            writeSheet2 = EasyExcel.writerSheet(2, "账单3").registerWriteHandler(new CustomSheetWriteHandler()).build();
+            writeSheet3 = EasyExcel.writerSheet(3, "账单4").registerWriteHandler(new CustomSheetWriteHandler()).build();
+        }else if(SettlementRuleEnum.结算金额_合作分润_服务费.getKey().equals(billVo.getSettlementRule())){
+            writeSheet0 = EasyExcel.writerSheet(0, "账单1").registerWriteHandler(new CustomSheetWriteHandler()).build();
+            writeSheet1 = EasyExcel.writerSheet(1, "账单2").registerWriteHandler(new CustomSheetWriteNameHandler()).build();
+            writeSheet2 = EasyExcel.writerSheet(2, "账单3").registerWriteHandler(new CustomSheetWriteHandler()).build();
+            writeSheet3 = EasyExcel.writerSheet(3, "账单4").registerWriteHandler(new CustomSheetWriteHandler()).build();
+        }else if(SettlementRuleEnum.结算金额_合作分润.getKey().equals(billVo.getSettlementRule())){
+            writeSheet0 = EasyExcel.writerSheet(0, "账单1").registerWriteHandler(new CustomSheetWriteHandler()).build();
+            writeSheet1 = EasyExcel.writerSheet(1, "账单2").registerWriteHandler(new CustomSheetWriteHandler()).build();
+            writeSheet2 = EasyExcel.writerSheet(2, "账单3").registerWriteHandler(new CustomSheetWriteNameHandler()).build();
+            writeSheet3 = EasyExcel.writerSheet(3, "账单4").registerWriteHandler(new CustomSheetWriteHandler()).build();
+        }else if(SettlementRuleEnum.结算金额_服务费.getKey().equals(billVo.getSettlementRule())){
+            writeSheet0 = EasyExcel.writerSheet(0, "账单1").registerWriteHandler(new CustomSheetWriteHandler()).build();
+            writeSheet1 = EasyExcel.writerSheet(1, "账单2").registerWriteHandler(new CustomSheetWriteHandler()).build();
+            writeSheet2 = EasyExcel.writerSheet(2, "账单3").registerWriteHandler(new CustomSheetWriteHandler()).build();
+            writeSheet3 = EasyExcel.writerSheet(3, "账单4").registerWriteHandler(new CustomSheetWriteNameHandler()).build();
+        }else{
+            log.info("异常,结算规则超出所定义的范围内");
+        }
+
+        WriteSheet writeSheet4 = new WriteSheet();
+        writeSheet4.setSheetNo(4);
+        writeSheet4.setSheetName("商品明细");
+        WriteTable writeTable4 = new WriteTable();
+        writeTable4.setTableNo(1);
+        writeTable4.setHead(heads(billVo,goodsTitles()));
+
+        WriteSheet writeSheet5 = new WriteSheet();
+        writeSheet5.setSheetNo(5);
+        writeSheet5.setSheetName("流水明细");
+        WriteTable writeTable5 = new WriteTable();
+        writeTable5.setTableNo(1);
+        writeTable5.setHead(heads(billVo,waterTitles()));
+
         FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.FALSE).build();
         excelWriter.fill(billVo, fillConfig, writeSheet0);
-        excelWriter.fill(new FillWrapper("detail", billVo.getGoodsList()), fillConfig, writeSheet1);
-        excelWriter.fill(new FillWrapper("detail", billVo.getWaterList()), fillConfig, writeSheet2);
+        excelWriter.fill(billVo, fillConfig, writeSheet1);
+        excelWriter.fill(billVo, fillConfig, writeSheet2);
+        excelWriter.fill(billVo, fillConfig, writeSheet3);
+        excelWriter.write(dataList(billVo.getGoodsList(),billVo,goodsFiled()), writeSheet4,writeTable4);
+        excelWriter.write(dataList(billVo.getWaterList(),billVo,waterFiled()), writeSheet5,writeTable5);
         excelWriter.finish();
 
         return NotifyUtils.createSysNotify(targetFileName, relativePath + targetFileName, SysQuartzScheduleTaskStatementOfAccountRunStateEnum.成功);
     }
 
+     // -------------------------------从数据库中获取数据   开始--------------------------
+
+    /**
+     * 导出单个账单所需要用到的基础信息
+     * @param id
+     * @return
+     */
     private BillVo getBillVoByAccountingBill(Long id){
         BillVo billVo = new BillVo();
         //账单信息
@@ -226,14 +324,488 @@ public class AccountingUnifiedOperatorServiceImpl implements AccountingUnifiedOp
             BeanUtils.copyProperties(accountingBillVo.getOVo(),billVo);
         }
         if(null != accountingBillVo && null != accountingBillVo.getSVo()){
-            BeanUtils.copyProperties(accountingBillVo.getSVo(),billVo);
+            SettlementProgrammeVo programmeVo = accountingBillVo.getSVo();
+            BeanUtils.copyProperties(programmeVo,billVo);
+            billVo.setProgrammeId(programmeVo.getId());
+            Map<String,Object> params = new HashMap<>();
+            params.put("programmeId",billVo.getProgrammeId());
+            params.put("type", SettlementRangeRuleTypeEnum.部分按原供应商名称导出.getKey());
+            List<RangeRuleVo> rangeRuleVoList = unifiedSettlementProgrammeRangeRuleMapperEx.getByType(params);
+            if(CollectionUtils.isNotEmpty(rangeRuleVoList)){
+                billVo.setRangeRuleVoList(rangeRuleVoList);
+            }
         }
         //商品明细
-
+        billVo.setGoodsList(goodsData());
         //流水明细
+        billVo.setWaterList(waterData());
         return billVo;
     }
 
+    /**
+     * 获取对账单对应的商品明细  目前是造的假数据,实际上数据是从数据库查询的
+     * @return
+     */
+    private List<GoodsVo> goodsData(){
+        List<GoodsVo> list = new ArrayList<>();
+        GoodsVo vo = new GoodsVo();
+        vo.setId("1588358");
+        vo.setOrderNumber("ME20230302142813644010");
+        vo.setBizPlatfrom("福利商城");
+        vo.setOperatorName("湘江商管");
+        vo.setOrgName("长沙华融湘江银行");
+        vo.setVirtName("华融湘江银行");
+        vo.setCreatedBy("1");
+        vo.setCreatedName("张三");
+        vo.setCreatedMobile("18612345678");
+        vo.setOrderType("福利商城");
+        vo.setBusinessType("订单");
+        vo.setOrderTime("2021-12-28 12:00:00");
+        vo.setOperateTime("2021-12-28 12:00:00");
+        vo.setDeliveryTime("2021-12-28 12:00:00");
+        vo.setFinishTime("2021-12-28 12:00:00");
+        vo.setGoodsType("商品");
+        vo.setGoodsId("1");
+        vo.setGoodsName("新希望 雪兰高原牧场纯牛奶 3.3g乳蛋白 心花怒FUN限定高原牧场  200g*12盒*4箱");
+        vo.setGoodsCode("1");
+        vo.setGoodsSpecs("SD03571916");
+        vo.setFirstClassify("食品饮料");
+        vo.setSecondClassify("饮料冲调");
+        vo.setThreeClassify("牛奶乳品");
+        vo.setGoodsQuantity("1");
+        vo.setGoodsUnit("箱");
+        vo.setGoodsPrice(new BigDecimal("100.00"));
+        vo.setGoodsSumPrice(new BigDecimal("100.00"));
+        vo.setGoodsSalePrice(new BigDecimal("100.00"));
+        vo.setGoodsSumSalePrice(new BigDecimal("100.00"));
+        vo.setGoodsCostPrice(new BigDecimal("100.00"));
+        vo.setGoodsSumCostPrice(new BigDecimal("100.00"));
+        vo.setDiscountPrice(new BigDecimal("100.00"));
+        vo.setSettlementPrice(new BigDecimal("100.00"));
+        vo.setTransactionStatus("已完成");
+        vo.setOrderStatus("交易完成");
+        vo.setAfterSaleType("1");
+        vo.setPayWay("组合支付");
+        vo.setAddress("湖南长沙市芙蓉区湘湖街道车站北路246号滨湖嘉园");
+        vo.setExpressCompany("申通");
+        vo.setExpressNo("773196694831457");
+        vo.setSupplierName("A供应商");
+        vo.setCostPrice(new BigDecimal("80.00"));
+        vo.setSumCostPrice(new BigDecimal("80.00"));
+        vo.setUpdatedTime("2021-12-28 12:00:00");
+        list.add(vo);
+        return list;
+    }
+
+    /**
+     * 获取对账单对应的商品明细  目前是造的假数据,实际上数据是从数据库查询的
+     * @return
+     */
+    private List<GoodsVo> waterData(){
+        List<GoodsVo> list = new ArrayList<>();
+        GoodsVo vo = new GoodsVo();
+        vo.setId("1621921");
+        vo.setOrderNumber("ME20230302142813644010");
+        vo.setBizPlatfrom("福利商城");
+        vo.setOperatorName("湘江商管");
+        vo.setOrgName("长沙华融湘江银行");
+        vo.setVirtName("华融湘江银行");
+        vo.setCreatedBy("1");
+        vo.setCreatedName("张三");
+        vo.setCreatedMobile("18612345678");
+        vo.setOrderType("福利商城");
+        vo.setBusinessType("订单");
+        vo.setOrderTime("2021-12-28 12:00:00");
+        vo.setOperateTime("2021-12-28 12:00:00");
+        vo.setFinishTime("2021-12-28 12:00:00");
+        vo.setGoodsType("商品");
+        vo.setGoodsId("1000");
+        vo.setGoodsName("新希望 雪兰高原牧场纯牛奶 3.3g乳蛋白 心花怒FUN限定高原牧场  200g*12盒*4箱");
+        vo.setOrderPrice(new BigDecimal("50.00"));
+        vo.setIsJoinSettlement("结算");
+        vo.setTransactionStatus("已完成");
+        vo.setPayWay("余额支付");
+        vo.setIntegralType("123");
+        vo.setIntegralBatch("456");
+        vo.setSupplierName("A供应商");
+        vo.setUpdatedTime("2021-12-28 12:00:00");
+        list.add(vo);
+        return list;
+    }
+
+    // -------------------------------从数据库中获取数据   结束--------------------------
+
+
+
+    // -------------------------------导出数据做优化     开始---------------------------
+
+
+    /**
+     * 导出账单-商品明细导出的标题
+     * @return
+     */
+    private String [] goodsTitles1(){
+        String [] titles = {"ID","订单编号","三方单号","业务平台","运营商","项目名称","企业名称"
+                ,"下单人id","下单人姓名","下单人手机号码","订单类型","业务类型","订单时间"
+                ,"支付/退款时间","发货时间","完成时间","商品类型","商品id","商品名称"
+                ,"商品编码","商品规格","一级分类","二级分类","三级分类","商品数量"
+                ,"商品单位","商品原单价","商品原总价","商品销售单价","商品销售总价"
+                ,"商品成本单价","商品成本总价","优惠金额","订单金额","结算金额","交易状态",
+                "订单状态","售后类型","支付方式","收货地址","快递公司","快递单号"
+                ,"退单原单号","供应商名称","更新时间"};
+        return titles;
+    }
+
+
+    /**
+     * 导出账单-商品明细导出的字段
+     * @return
+     */
+    private String [] goodsFiled1(){
+        String [] fileds = {"id","orderNumber","thirdNo","bizPlatfrom","operatorName","orgName","virtName"
+                ,"createdBy","createdName","createdMobile","orderType","businessType"
+                ,"orderTime","operateTime","deliveryTime","finishTime","goodsType","goodsId"
+                ,"goodsName","goodsCode","goodsSpecs","firstClassify","secondClassify"
+                ,"threeClassify","goodsQuantity","goodsUnit","goodsPrice","goodsSumPrice"
+                ,"goodsSalePrice","goodsSumSalePrice","goodsCostPrice","goodsSumCostPrice"
+                ,"discountPrice","orderPrice","settlementPrice","transactionStatus","orderStatus"
+                ,"afterSaleType","payWay","address","expressCompany","expressNo"
+                ,"chargebackNo","supplierName","updatedTime"};
+        return fileds;
+    }
+
+    /**
+     * 导出账单(含供应商)-商品明细导出的标题
+     * @return
+     */
+    private String [] goodsTitles(){
+        String [] titles = {"ID","订单编号","三方单号","业务平台","运营商","项目名称","企业名称"
+                ,"下单人id","下单人姓名","下单人手机号码","订单类型","业务类型","订单时间"
+                ,"支付/退款时间","发货时间","完成时间","商品类型","商品id","商品名称"
+                ,"商品编码","商品规格","一级分类","二级分类","三级分类","商品数量"
+                ,"商品单位","商品原单价","商品原总价","商品销售单价","商品销售总价"
+                ,"商品成本单价","商品成本总价","优惠金额","订单金额","结算金额","交易状态",
+                "订单状态","售后类型","支付方式","收货地址","快递公司","快递单号"
+                ,"退单原单号","供应商名称","成本单价","成本总价","更新时间"};
+        return titles;
+    }
+
+
+    /**
+     * 导出账单(含供应商)-商品明细导出的字段
+     * @return
+     */
+    private String [] goodsFiled(){
+        String [] fileds = {"id","orderNumber","thirdNo","bizPlatfrom","operatorName","orgName","virtName"
+                ,"createdBy","createdName","createdMobile","orderType","businessType"
+                ,"orderTime","operateTime","deliveryTime","finishTime","goodsType","goodsId"
+                ,"goodsName","goodsCode","goodsSpecs","firstClassify","secondClassify"
+                ,"threeClassify","goodsQuantity","goodsUnit","goodsPrice","goodsSumPrice"
+                ,"goodsSalePrice","goodsSumSalePrice","goodsCostPrice","goodsSumCostPrice"
+                ,"discountPrice","orderPrice","settlementPrice","transactionStatus","orderStatus"
+                ,"afterSaleType","payWay","address","expressCompany","expressNo"
+                ,"chargebackNo","supplierName","costPrice","sumCostPrice","updatedTime"};
+        return fileds;
+    }
+
+
+    /**
+     * 流水导出的标题
+     * @return
+     */
+    private String [] waterTitles(){
+        String [] titles = {"ID","订单编号","业务平台","运营商","项目名称","企业名称"
+                ,"下单人id","下单人姓名","下单人手机号码","订单类型","业务类型"
+                ,"订单时间","支付/退款时间","完成时间","商品类型","商品id"
+                ,"商品名称","订单金额(用户实际支付/退款金额)","是否参与结算"
+                ,"交易状态","支付方式","积分类型","积分批次","退单原单号"
+                ,"供应商名称","更新时间"
+        };
+        return titles;
+    }
+
+    /**
+     * 流水导出的字段
+     * @return
+     */
+    private String [] waterFiled(){
+        String [] fileds = {"id","orderNumber","bizPlatfrom","operatorName","orgName","virtName"
+                ,"createdBy","createdName","createdMobile","orderType","businessType"
+                ,"orderTime","operateTime","finishTime","goodsType","goodsId"
+                ,"goodsName","orderPrice","isJoinSettlement","transactionStatus"
+                ,"payWay","integralType","integralBatch"
+                ,"chargebackNo","supplierName","updatedTime"};
+        return fileds;
+    }
+
+    /**
+     * 导出的代码中标题需要以这种格式进行传递,因此做了封装
+     * @param billVo 基础数据
+     * @param titles 所有标题
+     * @return 最终封装好导出所需格式的标题
+     */
+    private List<List<String>> heads(BillVo billVo,String [] titles){
+        List<List<String>> headList = new ArrayList<>();
+        List<String> list = getTitles(billVo,titles);
+        for(String title : list){
+            headList.add(Lists.newArrayList(title));
+        }
+        return headList;
+    }
+
+    private Map<String,List<String>> getNotRange(BillVo billVo){
+        Map<String,List<String>> map = new HashMap<>();
+        List<RangeRuleVo> rangeRuleVoList = billVo.getRangeRuleVoList();
+        if(CollectionUtils.isEmpty(rangeRuleVoList)){
+            return map;
+        }
+        for(RangeRuleVo ruleVo : rangeRuleVoList){
+            if(SettlementRangeWayEnum.指定供应商.getKey().equals(ruleVo.getWay())){
+                List<String> strings = new ArrayList<>(Arrays.asList(ruleVo.getNotJoiningRange().split(",")));
+                map.put("supplierNames",strings);
+            }else if(SettlementRangeWayEnum.指定订单类型.getKey().equals(ruleVo.getWay())){
+                List<String> strings = new ArrayList<>(Arrays.asList(ruleVo.getNotJoiningRange().split(",")));
+                map.put("orderTypes",strings);
+            }
+        }
+        return map;
+    }
+
+
+    /**
+     * 导出的列表相应的做控制及数据控制
+     * @param list
+     * @param billVo
+     * @param field
+     * @return
+     */
+    private List<List<Object>> dataList(List<GoodsVo> list,BillVo billVo,String [] field){
+        List<List<Object>> dataList = new ArrayList<>();
+        String exportField = billVo.getExportField();
+        if(StringUtils.isEmpty(exportField)){
+            return dataList;
+        }
+        SettlementExportFieldVo fieldVo = JSON.parseObject(exportField, SettlementExportFieldVo.class);
+        if(null == fieldVo){
+            return dataList;
+        }
+
+        Map<String,List<String>> notRangeMap = new HashMap<>();
+        if(SupnameDisplayRuleEnum.部分按原供应商名称导出.getKey().equals(billVo.getSupnameDisplayRule())){
+            notRangeMap = getNotRange(billVo);
+        }
+
+        for(GoodsVo vo : list){
+            List<Object> row = new ArrayList<>();
+            JSONObject obj = JSONObject.fromObject(vo);
+            for (int j = 0; j < field.length; j++) {
+                Object param = "";
+                if (StringUtils.isEmpty(field[j])) {
+                    param = "";
+                } else {
+                    param = obj.get(field[j]);
+                    //改变供应商值
+                    if("supplierName".equals(field[j]) && SupnameDisplayRuleEnum.全部按自定义供应商名称导出.getKey().equals(billVo.getSupnameDisplayRule())){
+                        param = billVo.getCustomSupplierName();
+                    }else if("supplierName".equals(field[j]) && SupnameDisplayRuleEnum.部分按原供应商名称导出.getKey().equals(billVo.getSupnameDisplayRule())){
+                        //获取订单类型的值,获取供应商的值 和不包含范围表中关联的数据进行判断   unified_settlement_programme_range_rule
+                        //判断该供应商是否在  排除范围内,在的话,则不改变这部分的供应商名称,其余的改变
+                        if(checkNotRange(notRangeMap,"supplierNames",vo.getSupplierName()+"("+vo.getBizPlatfrom()+")")){
+                            param = billVo.getCustomSupplierName();
+                        }
+                        if(checkNotRange(notRangeMap,"orderTypes",vo.getOrderType())){
+                            //判断该订单类型是否在  排除范围内,在的话,则不改变这部分的供应商名称,其余的改变
+                            param = billVo.getCustomSupplierName();
+                        }
+                    }
+                }
+                if(checkFildValue(field[j],fieldVo)){
+                    row.add(param);
+                }
+            }
+            dataList.add(row);
+        }
+        return dataList;
+    }
+
+    /**
+     *
+     * @param notRangeMap  数据库查询到的不包含的范围
+     * @param filed 不包含范围的类型字段名   是供应商(supplierNames)还是订单类型(orderTypes)
+     * @param value  原先的值
+     * @return false=不用换成自定义的值,true=需要换成自定义的值
+     */
+    private boolean checkNotRange(Map<String,List<String>> notRangeMap,String filed,Object value){
+        if(null != notRangeMap && notRangeMap.containsKey(filed) && null != notRangeMap.get(filed)){
+            List<String> fileds = notRangeMap.get(filed);
+            if(CollectionUtils.isNotEmpty(fileds) && fileds.contains(value)){
+                return false;//不改变供应商名称
+            }
+        }
+        return true;
+    }
+
+    /**
+     * 获取导出的标题  主要是对需要控制的字段做相应的处理
+     * @param billVo 基础数据
+     * @param titles 所有标题
+     * @return 最终展示的标题
+     */
+    private List<String> getTitles(BillVo billVo,String [] titles){
+        List<String> list = new ArrayList<>();
+        String exportField = billVo.getExportField();
+        if(StringUtils.isEmpty(exportField)){
+            return list;
+        }
+        SettlementExportFieldVo fieldVo = JSON.parseObject(exportField, SettlementExportFieldVo.class);
+        if(null == fieldVo){
+            return list;
+        }
+        for(int i=0 ; i < titles.length; i++){
+            String title = titles[i];
+            boolean bool = checkFildHide(title,fieldVo);
+            if(bool){
+                list.add(title);
+            }
+        }
+        return list;
+    }
+
+    /**
+     * 检验是否需要展示这个值
+     * @param fild
+     * @param fieldVo
+     * @return
+     */
+    private boolean checkFildValue(String fild,SettlementExportFieldVo fieldVo){
+        if("orgName".equals(fild)){
+            if(fieldVo.getOrg_name().equals(1)){
+                return true;
+            }else{
+                return false;
+            }
+        }
+        if("virtName".equals(fild)){
+            if(fieldVo.getVirt_name().equals(1)){
+                return true;
+            }else{
+                return false;
+            }
+        }
+        if("supplierName".equals(fild)){
+            if(fieldVo.getSupplier_name().equals(1)){
+                return true;
+            }else{
+                return false;
+            }
+        }
+        if("thirdNo".equals(fild)){
+            if(fieldVo.getThird_no().equals(1)){
+                return true;
+            }else{
+                return false;
+            }
+        }
+        if("goodsCostPrice".equals(fild)){
+            if(fieldVo.getAgreement_cost().equals(1)){
+                return true;
+            }else{
+                return false;
+            }
+        }
+        if("goodsSumCostPrice".equals(fild)){
+            if(fieldVo.getAgreement_cost().equals(1)){
+                return true;
+            }else{
+                return false;
+            }
+        }
+        if("integralType".equals(fild)){
+            if(fieldVo.getIntegral().equals(1)){
+                return true;
+            }else{
+                return false;
+            }
+        }
+        if("integralBatch".equals(fild)){
+            if(fieldVo.getIntegral().equals(1)){
+                return true;
+            }else{
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * 检验是否需要展示这个标题
+     * @param title
+     * @param fieldVo
+     * @return
+     */
+    private boolean checkFildHide(String title,SettlementExportFieldVo fieldVo){
+        if("项目名称".equals(title)){
+            if(fieldVo.getOrg_name().equals(1)){
+                return true;
+            }else{
+                return false;
+            }
+        }
+        if("企业名称".equals(title)){
+            if(fieldVo.getVirt_name().equals(1)){
+                return true;
+            }else{
+                return false;
+            }
+        }
+        if("供应商名称".equals(title)){
+            if(fieldVo.getSupplier_name().equals(1)){
+                return true;
+            }else{
+                return false;
+            }
+        }
+        if("三方单号".equals(title)){
+            if(fieldVo.getThird_no().equals(1)){
+                return true;
+            }else{
+                return false;
+            }
+        }
+        if("商品成本单价".equals(title)){
+            if(fieldVo.getAgreement_cost().equals(1)){
+                return true;
+            }else{
+                return false;
+            }
+        }
+        if("商品成本总价".equals(title)){
+            if(fieldVo.getAgreement_cost().equals(1)){
+                return true;
+            }else{
+                return false;
+            }
+        }
+        if("积分类型".equals(title)){
+            if(fieldVo.getIntegral().equals(1)){
+                return true;
+            }else{
+                return false;
+            }
+        }
+        if("积分批次".equals(title)){
+            if(fieldVo.getIntegral().equals(1)){
+                return true;
+            }else{
+                return false;
+            }
+        }
+        return true;
+    }
+
+    // -------------------------------导出数据做优化     开始---------------------------
+
+
     @Override
     public AccountingBillVo getBillVo(Long id) {
         return getAccountBillById(id);

+ 2 - 2
superdesk-uniorder-web/src/main/java/cn/superdesk/uniorder/controller/accounting/operator/AccountingUnifiedOperatorContoller.java

@@ -77,7 +77,7 @@ public class AccountingUnifiedOperatorContoller extends BaseController {
     }
 
     /**
-     * 账单管理-导出账单
+     * 账单管理-导出账单    生成的地方由待提交那一步时生成,然后把地址回填到账单里面,这里直接给地址
      * @param param
      * @param response
      */
@@ -94,7 +94,7 @@ public class AccountingUnifiedOperatorContoller extends BaseController {
     }
 
     /**
-     * 账单管理-导出账单(含供应商成本)
+     * 账单管理-导出账单(含供应商成本)   用固定模板,不需要根据结算方案判断
      * @param param
      * @param response
      */

+ 14 - 2
superdesk-uniorder-web/src/main/java/cn/superdesk/uniorder/controller/operationCenter/base/OperationCenterBaseController.java

@@ -160,9 +160,9 @@ public class OperationCenterBaseController {
      */
     @PostMapping("/opAccountingStatus")
     @ResponseBody
-    public R<List<OperationCenterVo>> opAccountingStatus(@RequestParam(value = "type") Integer type) {
+    public R<List<OperationCenterVo>> opAccountingStatus(@RequestBody OperationCenterParam param) {
         R<List<OperationCenterVo>> result = new R<>();
-        List<OperationCenterVo> accountingState = operationCenterBaseDubboService.opAccountingStatus(type);
+        List<OperationCenterVo> accountingState = operationCenterBaseDubboService.opAccountingStatus(param.getType());
         result.setData(accountingState);
         return result;
     }
@@ -178,4 +178,16 @@ public class OperationCenterBaseController {
         result.setData(isSettlement);
         return result;
     }
+
+    /**
+     * 邮件状态
+     */
+    @PostMapping("/getEmailStatus")
+    @ResponseBody
+    public R<List<OperationCenterVo>> getEmailStatus() {
+        R<List<OperationCenterVo>> result = new R<>();
+        List<OperationCenterVo> orderGoodType = operationCenterBaseDubboService.emailStatus();
+        result.setData(orderGoodType);
+        return result;
+    }
 }

+ 30 - 30
superdesk-uniorder-web/src/main/java/cn/superdesk/uniorder/controller/sys/SysUserController.java

@@ -95,36 +95,36 @@ public class SysUserController extends BaseController {
             return response;
         }
 
-        if (StringUtils.isNotEmpty(verificationCode)) {
-
-            String sessionVerificationCode = "";
-
-            Object verificationCodeObj = session.getAttribute("verificationCode");
-
-            if (null != verificationCodeObj) {
-                sessionVerificationCode = verificationCodeObj.toString();
-            } else {
-                response.setSuccess(false);
-                response.setMessage("验证码已过期,请刷新后重试");
-                // response.setMessage("服务器 获取 验证码 失败, 前端没有携带之前的cookie信息, 请求请加上 withCredentials:true | " + sessionVerificationCode);
-                return response;
-            }
-
-            log.info("\nlogin\nsessionId:{}\nsessionVerificationCode:{}", session.getId(), sessionVerificationCode);
-
-            // 验证码使用一次就失效
-            session.setAttribute("verificationCode", "PQRSTUVWXYZ");
-
-            if (StringUtils.isNotEmpty(sessionVerificationCode)) {
-
-                if (!sessionVerificationCode.equalsIgnoreCase(verificationCode)) {
-
-                    response.setSuccess(false);
-                    response.setMessage("验证码输入错误");
-                    return response;
-                }
-            }
-        }
+//        if (StringUtils.isNotEmpty(verificationCode)) {
+//
+//            String sessionVerificationCode = "";
+//
+//            Object verificationCodeObj = session.getAttribute("verificationCode");
+//
+//            if (null != verificationCodeObj) {
+//                sessionVerificationCode = verificationCodeObj.toString();
+//            } else {
+//                response.setSuccess(false);
+//                response.setMessage("验证码已过期,请刷新后重试");
+//                // response.setMessage("服务器 获取 验证码 失败, 前端没有携带之前的cookie信息, 请求请加上 withCredentials:true | " + sessionVerificationCode);
+//                return response;
+//            }
+//
+//            log.info("\nlogin\nsessionId:{}\nsessionVerificationCode:{}", session.getId(), sessionVerificationCode);
+//
+//            // 验证码使用一次就失效
+//            session.setAttribute("verificationCode", "PQRSTUVWXYZ");
+//
+//            if (StringUtils.isNotEmpty(sessionVerificationCode)) {
+//
+//                if (!sessionVerificationCode.equalsIgnoreCase(verificationCode)) {
+//
+//                    response.setSuccess(false);
+//                    response.setMessage("验证码输入错误");
+//                    return response;
+//                }
+//            }
+//        }
 
         SysUserVo user = sysUserDubboConsumerService.userLoginBySupperDeskUniOrderBackEndFacade(username, password);
 

+ 15 - 0
superdesk-uniorder-web/src/main/java/cn/superdesk/uniorder/dubbo/consumer/operationCenter/base/OperationCenterBaseDubboService.java

@@ -1,6 +1,7 @@
 package cn.superdesk.uniorder.dubbo.consumer.operationCenter.base;
 
 import cn.superdesk.data.extract.enums.opCenter.*;
+import cn.superdesk.uniorder.common.enums.accounting.operator.AccountingEmailStatusEnum;
 import cn.superdesk.uniorder.common.enums.accounting.operator.AccountingOrderOperatorAccountStatusEnum;
 import cn.superdesk.uniorder.common.enums.common.CommonAccountingStateEnum;
 import cn.superdesk.uniorder.common.enums.common.CommonSettlementStateEnum;
@@ -204,4 +205,18 @@ public class OperationCenterBaseDubboService {
         return isSettlementResult;
 
     }
+
+    /**
+     *   邮件状态 AccountingEmailStatusEnum
+     */
+    public List<OperationCenterVo> emailStatus() {
+        List<OperationCenterVo> accountingState = new ArrayList<>();
+        for (AccountingEmailStatusEnum value : AccountingEmailStatusEnum.values()) {
+            OperationCenterVo vo = new OperationCenterVo();
+            vo.setCode(value.getKey().toString());
+            vo.setName(value.getDesc());
+            accountingState.add(vo);
+        }
+        return accountingState;
+    }
 }