lazhaoqian преди 3 години
родител
ревизия
c273626911

+ 13 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/shipping/finance/FinancialController.java

@@ -197,5 +197,18 @@ public class FinancialController  extends BaseController {
     public AjaxResult queryRemoveTFeeDo(@PathVariable("fId") Long fId) {
         return toAjax(tFeeDoService.deleteTFeeDoById(fId));
     }
+    /**
+     * 导出对账数据
+     */
+    @PreAuthorize("@ss.hasPermi('finance:contrast:export')")
+    @Log(title = "导出财务对账", businessType = BusinessType.EXPORT)
+    @DataScope(deptAlias = "d", userAlias = "u")
+    @GetMapping("/export/financial/{fId}")
+    public AjaxResult exportFinancial(@PathVariable("fId") Long fId) throws Exception {
+        if (fId == null){
+            return AjaxResult.error("缺少必要的参数");
+        }
+        return tFeeService.exportFinancial(fId);
+    }
 
 }

+ 65 - 3
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtils.java

@@ -24,7 +24,7 @@ public class ExcelUtils {
         cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
         cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
         //背景颜色
-        //cellStyle.setFillForegroundColor(IndexedColors.GREY_40_PERCENT.getIndex());
+        cellStyle.setFillForegroundColor(IndexedColors.WHITE.getIndex());
 
         HSSFFont headerFont1 = (HSSFFont) wb.createFont();
         //字体加粗
@@ -32,8 +32,41 @@ public class ExcelUtils {
         //字体类型
         headerFont1.setFontName("黑体");
         //字体大小
-        headerFont1.setFontHeightInPoints((short)15);
+        headerFont1.setFontHeightInPoints((short)16);
         cellStyle.setFont(headerFont1);
+        cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
+        cellStyle.setBorderLeft(BorderStyle.THIN);//左边框
+        cellStyle.setBorderTop(BorderStyle.THIN);//上边框
+        cellStyle.setBorderRight(BorderStyle.THIN);//右边框
+        return cellStyle;
+    }
+    /**
+     * 创建副标题标题样式
+     * @param wb
+     * @return
+     */
+    public static HSSFCellStyle createSubheadingStyle(HSSFWorkbook wb){
+        HSSFCellStyle cellStyle = wb.createCellStyle();
+        //水平居中
+        cellStyle.setAlignment(HorizontalAlignment.CENTER);
+        //垂直对齐
+        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+        cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
+        //背景颜色
+        cellStyle.setFillForegroundColor(IndexedColors.WHITE.getIndex());
+
+        HSSFFont headerFont1 = (HSSFFont) wb.createFont();
+        //字体加粗
+        headerFont1.setBold(true);
+        //字体类型
+        headerFont1.setFontName("黑体");
+        //字体大小
+        headerFont1.setFontHeightInPoints((short)14);
+        cellStyle.setFont(headerFont1);
+        cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
+        cellStyle.setBorderLeft(BorderStyle.THIN);//左边框
+        cellStyle.setBorderTop(BorderStyle.THIN);//上边框
+        cellStyle.setBorderRight(BorderStyle.THIN);//右边框
         return cellStyle;
     }
 
@@ -102,7 +135,36 @@ public class ExcelUtils {
         //设置字体
         HSSFFont font = (HSSFFont)wb.createFont();
         font.setColor((short)8);
-        font.setFontHeightInPoints((short)12);
+        font.setFontHeightInPoints((short)11);
+
+        return cellStyle;
+    }
+    /**
+     *  设置表格内容样式
+     * @param wb
+     * @return
+     */
+    public static HSSFCellStyle createEndStyle(HSSFWorkbook wb){
+        HSSFCellStyle cellStyle = wb.createCellStyle();
+        //水平居中
+        cellStyle.setAlignment(HorizontalAlignment.CENTER);
+        //垂直居中
+        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+        //设置自动换行
+        cellStyle.setWrapText(true);
+        //上边框
+        cellStyle.setBorderTop(BorderStyle.THIN);
+        //下边框
+        cellStyle.setBorderBottom(BorderStyle.THIN);
+        //左边框
+        cellStyle.setBorderLeft(BorderStyle.THIN);
+        //右边框
+        cellStyle.setBorderRight(BorderStyle.THIN);
+
+        //设置字体
+        HSSFFont font = (HSSFFont)wb.createFont();
+        font.setColor((short)8);
+        font.setFontHeightInPoints((short)14);
 
         return cellStyle;
     }

+ 133 - 0
ruoyi-shipping/src/main/java/com/ruoyi/shipping/excel/ExportFinancial.java

@@ -0,0 +1,133 @@
+package com.ruoyi.shipping.excel;
+
+import java.math.BigDecimal;
+
+/**
+ * 凯和导出对账明细
+ */
+public class ExportFinancial {
+    private static final long serialVersionUID = 1L;
+    /**
+     * 序号
+     */
+    private Long rankNo;
+    /**
+     * 提单号
+     */
+    private String fMblNo;
+    /**
+     * 始发港
+     */
+    private String portOfDeparture;
+    /**
+     * 目的港
+     */
+    private String destinationPort;
+    /**
+     * 货名
+     */
+    private String goodName;
+    /**
+     * 箱量
+     */
+    private Long fCnTrCount;
+    /**
+     * 规格
+     */
+    private String specification ;
+    /**
+     * 单价
+     */
+    private BigDecimal fUnitPrice;
+    /**
+     * 合计
+     */
+    private BigDecimal fAmount;
+
+    public Long getRankNo() {
+        return rankNo;
+    }
+
+    public void setRankNo(Long rankNo) {
+        this.rankNo = rankNo;
+    }
+
+    public String getfMblNo() {
+        return fMblNo;
+    }
+
+    public void setfMblNo(String fMblNo) {
+        this.fMblNo = fMblNo;
+    }
+
+    public String getPortOfDeparture() {
+        return portOfDeparture;
+    }
+
+    public void setPortOfDeparture(String portOfDeparture) {
+        this.portOfDeparture = portOfDeparture;
+    }
+
+    public String getDestinationPort() {
+        return destinationPort;
+    }
+
+    public void setDestinationPort(String destinationPort) {
+        this.destinationPort = destinationPort;
+    }
+
+    public String getGoodName() {
+        return goodName;
+    }
+
+    public void setGoodName(String goodName) {
+        this.goodName = goodName;
+    }
+
+    public Long getfCnTrCount() {
+        return fCnTrCount;
+    }
+
+    public void setfCnTrCount(Long fCnTrCount) {
+        this.fCnTrCount = fCnTrCount;
+    }
+
+    public String getSpecification() {
+        return specification;
+    }
+
+    public void setSpecification(String specification) {
+        this.specification = specification;
+    }
+
+    public BigDecimal getfUnitPrice() {
+        return fUnitPrice;
+    }
+
+    public void setfUnitPrice(BigDecimal fUnitPrice) {
+        this.fUnitPrice = fUnitPrice;
+    }
+
+    public BigDecimal getfAmount() {
+        return fAmount;
+    }
+
+    public void setfAmount(BigDecimal fAmount) {
+        this.fAmount = fAmount;
+    }
+
+    @Override
+    public String toString() {
+        return "ExportFinancial{" +
+                "rankNo=" + rankNo +
+                ", fMblNo='" + fMblNo + '\'' +
+                ", portOfDeparture='" + portOfDeparture + '\'' +
+                ", destinationPort='" + destinationPort + '\'' +
+                ", goodName='" + goodName + '\'' +
+                ", fCnTrCount=" + fCnTrCount +
+                ", specification='" + specification + '\'' +
+                ", fUnitPrice=" + fUnitPrice +
+                ", fAmount=" + fAmount +
+                '}';
+    }
+}

+ 8 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/finance/mapper/TFeeMapper.java

@@ -5,6 +5,7 @@ import com.ruoyi.finance.domain.TWareHouseFees;
 import com.ruoyi.finance.excel.Detailed;
 import com.ruoyi.finance.shipping.FinancialTFee;
 import com.ruoyi.reportManagement.dto.TWarehousebill;
+import com.ruoyi.shipping.excel.ExportFinancial;
 import com.ruoyi.warehouseBusiness.excel.TWareHouseExcelItem;
 import org.apache.ibatis.annotations.Param;
 
@@ -139,4 +140,11 @@ public interface TFeeMapper {
      */
     FinancialTFee selectFinancialTFeeId (Long fId);
 
+    /**
+     * 凯和查询对账信息
+     * @param id
+     * @return
+     */
+    List<ExportFinancial> exportFinancial(@Param("id") Long id);
+
 }

+ 7 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/finance/service/ITFeeService.java

@@ -273,5 +273,12 @@ public interface ITFeeService {
      */
     public List<FinancialTFeeDoExcel>  FinancialTFeeDoExcel(Long fId);
 
+    /**
+     * 导出财务对账数据
+     * @param fId
+     * @return
+     */
+    public AjaxResult exportFinancial(Long fId);
+
 
 }

+ 288 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/finance/service/impl/TFeeServiceImpl.java

@@ -9,6 +9,7 @@ import com.ruoyi.basicData.domain.TCorps;
 import com.ruoyi.basicData.domain.TFees;
 import com.ruoyi.basicData.mapper.TCorpsMapper;
 import com.ruoyi.basicData.mapper.TFeesMapper;
+import com.ruoyi.common.config.RuoYiConfig;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.entity.SysDictData;
 import com.ruoyi.common.core.domain.model.LoginUser;
@@ -16,6 +17,7 @@ import com.ruoyi.common.exception.WarehouseException;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.DictUtils;
 import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.poi.ExcelUtils;
 import com.ruoyi.finance.domain.TFee;
 import com.ruoyi.finance.domain.TFeeDo;
 import com.ruoyi.finance.domain.TWareHouseFees;
@@ -34,8 +36,14 @@ import com.ruoyi.reportManagement.excel.Profit;
 import com.ruoyi.reportManagement.excel.Receivable;
 import com.ruoyi.shipping.domain.TAccount;
 import com.ruoyi.shipping.domain.TFeeInvoice;
+import com.ruoyi.shipping.domain.TVessel;
+import com.ruoyi.shipping.domain.TVoyage;
 import com.ruoyi.shipping.excel.Account;
+import com.ruoyi.shipping.excel.DeriveInventoryExcel;
+import com.ruoyi.shipping.excel.ExportFinancial;
 import com.ruoyi.shipping.mapper.TFeeInvoiceMapper;
+import com.ruoyi.shipping.mapper.TVesselMapper;
+import com.ruoyi.shipping.mapper.TVoyageMapper;
 import com.ruoyi.system.domain.SysConfig;
 import com.ruoyi.system.mapper.SysConfigMapper;
 import com.ruoyi.system.mapper.SysDictDataMapper;
@@ -52,13 +60,20 @@ import com.ruoyi.warehouseBusiness.mapper.TWarehouseBillsMapper;
 import com.ruoyi.warehouseBusiness.mapper.TWarehousebillsfeesMapper;
 import com.ruoyi.warehouseBusiness.service.impl.BillnoSerialServiceImpl;
 import org.apache.commons.compress.utils.Lists;
+import org.apache.poi.hssf.usermodel.*;
+import org.apache.poi.ss.util.CellRangeAddress;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStream;
 import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 财务数据主Service业务层处理
@@ -106,6 +121,10 @@ public class TFeeServiceImpl implements ITFeeService {
 
     @Autowired
     private TFeeInvoiceMapper tFeeInvoiceMapper;
+    @Autowired
+    private TVesselMapper tVesselMapper;
+    @Autowired
+    private TVoyageMapper tVoyageMapper;
 
     private final String ST_IN_TYPE = "st_in_type";
     private final String ST_OUT_TYPE = "st_out_type";
@@ -1703,5 +1722,274 @@ public class TFeeServiceImpl implements ITFeeService {
         }
     }
 
+    /**
+     * 导出财务对账数据
+     * @param fId
+     * @return
+     */
+    @Override
+    public AjaxResult exportFinancial(Long fId) {
+        //获取数据
+        String shipsName = "";//船名
+        String voyage = "";//航次
+        String corpName = "";//客户
+        String fFromDate = "";//离港日期开始
+        String fToDate = "";//离港日期结束
+        BigDecimal fAmount = new BigDecimal(0);//合计
+        //查询财务主数据
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        TFee fee = tFeeMapper.selectTFeeById(fId);
+        if (fee != null){
+            corpName = fee.getfCtrlcorpid();
+            if (fee.getfFromDate() != null){
+                fFromDate = simpleDateFormat.format(fee.getfFromDate());
+            }
+            if (fee.getfToDate() != null){
+                fToDate = simpleDateFormat.format(fee.getfToDate());
+            }
+            if (fee.getfVslid() != null){
+                TVessel vessel = tVesselMapper.selectTVesselById(fee.getfVslid());
+                if (vessel != null && StringUtils.isNotEmpty(vessel.getfName())){
+                    shipsName = vessel.getfName();
+                }
+            }
+            if (fee.getfVoyid() != null){
+                TVoyage tVoyage = tVoyageMapper.selectTVoyageById(fee.getfVoyid());
+                if (tVoyage != null && StringUtils.isNotEmpty(tVoyage.getfNo())){
+                    voyage = tVoyage.getfNo();
+                }
+            }
+        }
+        //样式设置
+        //1.创建一个workbook,对应一个excel文件
+        HSSFWorkbook wb = new HSSFWorkbook();
+        //2.在workbook中添加一个sheet,对应Excel中的sheet
+        HSSFSheet sheet = wb.createSheet("对账");
+        //设置每一列的列宽
+        sheet.setColumnWidth(0, 256 * 15);
+        sheet.setColumnWidth(1, 256 * 20);
+        sheet.setColumnWidth(2, 256 * 20);
+        sheet.setColumnWidth(3, 256 * 20);
+        sheet.setColumnWidth(4, 256 * 15);
+        sheet.setColumnWidth(5, 256 * 15);
+        sheet.setColumnWidth(6, 256 * 15);
+        sheet.setColumnWidth(7, 100 * 35);
+        sheet.setColumnWidth(8, 256 * 15);
+        //3.设置样式以及字体样式
+        HSSFCellStyle titleStyle = ExcelUtils.createTitleCellStyle(wb);
+        HSSFCellStyle contentStyle = ExcelUtils.createContentCellStyle(wb);
+        HSSFCellStyle subheadingStyle = ExcelUtils.createSubheadingStyle(wb);
+        HSSFCellStyle endStyle = ExcelUtils.createEndStyle(wb);
+        //4.创建标题,合并标题单元格
+        //行号
+        int rowNum = 0;
+        //创建第一行,索引从0开始(标题行)
+        HSSFRow row0 = sheet.createRow(rowNum++);
+        row0.setHeight((short) 800);// 设置行高
+        for (int i = 0; i < 9; i++) {
+            HSSFCell tempCell = row0.createCell(i);
+            tempCell.setCellStyle(contentStyle);
+        }
+        String title = "青岛凯和志诚物流有限公司";
+        HSSFCell c00 = row0.createCell(0);
+        c00.setCellValue(title);
+        c00.setCellStyle(titleStyle);
+        // 合并单元格,参数依次为起始行,结束行,起始列,结束列 (索引0开始)
+        sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 8));//标题合并单元格操作,总列数为9
+        //第2行
+        HSSFRow row1 = sheet.createRow(rowNum++);
+        row1.setHeight((short) 500);
+        String message1 = "客户确认单";
+        for (int i = 0; i < 9; i++) {
+            HSSFCell tempCell = row1.createCell(i);
+            tempCell.setCellStyle(contentStyle);
+        }
+        HSSFCell c01 = row1.createCell(0);
+        c01.setCellValue(message1);
+        c01.setCellStyle(subheadingStyle);
+        sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, 8));//标题合并单元格操作,总列数为9
+
+        //第3行
+        HSSFRow row2 = sheet.createRow(rowNum++);
+        row2.setHeight((short) 500);
+        String message2 = "尊敬的客户";
+        HSSFCell c02 = row2.createCell(0);
+        c02.setCellValue(message2);
+        c02.setCellStyle(contentStyle);
+        //第3行
+        for (int i = 1; i < 9; i++) {
+            HSSFCell tempCell = row2.createCell(i);
+            tempCell.setCellStyle(contentStyle);
+        }
+        HSSFCell c03 = row2.createCell(1);
+        c03.setCellValue(corpName);
+        c03.setCellStyle(contentStyle);
+        sheet.addMergedRegion(new CellRangeAddress(2, 2, 1, 8));//标题合并单元格操作,总列数为9
+        //合并单元格
+        sheet.addMergedRegion(new CellRangeAddress(3, 3, 1, 2));
+        sheet.addMergedRegion(new CellRangeAddress(3, 3, 3, 4));
+        sheet.addMergedRegion(new CellRangeAddress(3, 3, 5, 8));
+        //第4行
+        HSSFRow row3 = sheet.createRow(rowNum++);
+        for (int i = 0; i < 1; i++) {
+            HSSFCell tempCell = row3.createCell(i);
+            tempCell.setCellStyle(contentStyle);
+        }
+        for (int i = 1; i < 3; i++) {
+            HSSFCell tempCell = row3.createCell(i);
+            tempCell.setCellStyle(contentStyle);
+        }
+        for (int i = 3; i < 5; i++) {
+            HSSFCell tempCell = row3.createCell(i);
+            tempCell.setCellStyle(contentStyle);
+        }
+        for (int i = 5; i < 9; i++) {
+            HSSFCell tempCell = row3.createCell(i);
+            tempCell.setCellStyle(contentStyle);
+        }
+        row3.setHeight((short) 500);
+        HSSFCell c05 = row3.createCell(0);
+        c05.setCellValue("船名航次:");
+        c05.setCellStyle(contentStyle);
+        HSSFCell c051 = row3.createCell(1);
+        c051.setCellValue(shipsName+voyage);
+        c051.setCellStyle(contentStyle);
+        HSSFCell c052 = row3.createCell(3);
+        c052.setCellValue("离港日期:");
+        c052.setCellStyle(contentStyle);
+        String message = "";
+        HSSFCell c053 = row3.createCell(5);
+        if (StringUtils.isNotEmpty(fFromDate)){
+            if (StringUtils.isNotEmpty(fFromDate)){
+                message = fFromDate+"-"+fToDate;
+            }else {
+                message = fFromDate;
+            }
+        }else if (StringUtils.isNotEmpty(fToDate)){
+            message = fToDate;
+        }
+        c053.setCellValue(message);
+        c053.setCellStyle(contentStyle);
+        //第5行
+        HSSFRow row4 = sheet.createRow(rowNum++);
+        for (int i = 0; i < 9; i++) {
+            HSSFCell tempCell = row4.createCell(i);
+            tempCell.setCellStyle(contentStyle);
+        }
+        row4.setHeight((short) 500);
+        String message4 = "费用明细";
+        HSSFCell c04 = row4.createCell(0);
+        c04.setCellValue(message4);
+        c04.setCellStyle(contentStyle);
+        sheet.addMergedRegion(new CellRangeAddress(4, 4, 0, 8));//标题合并单元格操作,总列数为9
+        //第四行
+        HSSFRow row5 = sheet.createRow(rowNum++);
+        row5.setHeight((short) 500);
+        String[] row_third = {"序号", "提单号", "始发港", "目的港", "货名", "箱量", "规格", "单价", "合计"};
+        for (int i = 0; i < row_third.length; i++) {
+            HSSFCell tempCell = row5.createCell(i);
+            tempCell.setCellValue(row_third[i]);
+            tempCell.setCellStyle(contentStyle);
+        }
+        //查询费用明细数据
+        List<ExportFinancial> list = tFeeMapper.exportFinancial(fId);
+        if (CollectionUtils.isNotEmpty(list)){
+            for (int i = 0; i < list.size(); i++) {
+                HSSFRow tempRow = sheet.createRow(rowNum++);
+                tempRow.setHeight((short) 500);
+                //循环单元格填入数据
+                for (int j = 0; j < 9; j++) {
+                    HSSFCell tempCell = tempRow.createCell(j);
+                    tempCell.setCellStyle(contentStyle);
+                    String cellValue = "";
+                    if (j == 0) {
+                        //序号
+                        cellValue = list.get(i).getRankNo().toString();
+                    } else if (j == 1) {
+                        //提单号
+                        cellValue = list.get(i).getfMblNo();
+                    } else if (j == 2) {
+                        //始发港
+                        cellValue = list.get(i).getPortOfDeparture();
+                    } else if (j == 3) {
+                        //目的港
+                        cellValue = list.get(i).getDestinationPort();
+                    } else if (j == 4) {
+                        //货名
+                        cellValue = list.get(i).getGoodName();
+                    } else if (j == 5) {
+                        //箱量
+                        cellValue = list.get(i).getfCnTrCount().toString();
+                    } else if (j == 6) {
+                        //规格
+                        cellValue = list.get(i).getSpecification();
+                    } else if (j == 7) {
+                        //单价
+                        cellValue = list.get(i).getfUnitPrice().toString();
+                    } else if (j == 8) {
+                        //合计
+                        cellValue = list.get(i).getfAmount().toString();
+                    }
+                    tempCell.setCellValue(cellValue);
+                }
+            }
+            fAmount = list.stream().map(ExportFinancial::getfAmount).reduce(BigDecimal.ZERO, BigDecimal::add);//求所有和的合计
+        }
+        //倒数第二行
+        HSSFRow row6 = sheet.createRow(rowNum++);
+        for (int i = 0; i < 9; i++) {
+            HSSFCell tempCell = row6.createCell(i);
+            tempCell.setCellStyle(contentStyle);
+        }
+        row6.setHeight((short) 500);
+        String message6 = "合计:";
+        HSSFCell c06 = row6.createCell(0);
+        c06.setCellValue(message6);
+        c06.setCellStyle(contentStyle);
+        HSSFCell c061 = row6.createCell(8);
+        c061.setCellValue(fAmount.toString());
+        c061.setCellStyle(contentStyle);
+        //最后一行
+        HSSFRow row7 = sheet.createRow(rowNum++);
+        for (int i = 0; i < 9; i++) {
+            HSSFCell tempCell = row7.createCell(i);
+            tempCell.setCellStyle(contentStyle);
+        }
+        row7.setHeight((short) 1500);
+        String message7 = "纳税人识别号:91370202MA3UG1T04A\n" +
+                "人民币账号:3803020309100171855\n" +
+                "人民币开户行:工商银行青岛分行营业部";
+        HSSFCell c07 = row7.createCell(0);
+        c07.setCellValue(message7);
+        c07.setCellStyle(endStyle);
+        sheet.addMergedRegion(new CellRangeAddress(rowNum-1, rowNum-1, 0, 8));//标题合并单元格操作,总列数为9
+        //导出excel
+
+        String fileName = "客户对账单.xls";
+        try {
+            OutputStream out = null;
+            out = new FileOutputStream(getAbsoluteFile(fileName));
+            wb.write(out);
+            if (null != wb && null != out) {
+                wb.write(out);
+                wb.close();
+                out.close();
+            }
+            return AjaxResult.success(fileName);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return AjaxResult.error("导出Excel失败");
+        }
+    }
+    //下载路径
+    private String getAbsoluteFile(String fileName) {
+        String downloadPath = RuoYiConfig.getDownloadPath() + fileName;
+        File desc = new File(downloadPath);
+        if (!desc.getParentFile().exists()) {
+            desc.getParentFile().mkdirs();
+        }
+        return downloadPath;
+    }
+
 
 }

+ 13 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/finance/shipping/FinancialTFeeDoExcel.java

@@ -204,6 +204,10 @@ public class FinancialTFeeDoExcel implements Serializable {
      * 金额
      */
     private BigDecimal fAmount;
+    /**
+     * 商品名
+     */
+    private String goodName;
 
     public String getSrcBillNo() {
         return srcBillNo;
@@ -525,6 +529,14 @@ public class FinancialTFeeDoExcel implements Serializable {
         this.fAmount = fAmount;
     }
 
+    public String getGoodName() {
+        return goodName;
+    }
+
+    public void setGoodName(String goodName) {
+        this.goodName = goodName;
+    }
+
     @Override
     public String toString() {
         return "FinancialTFeeDoExcel{" +
@@ -568,6 +580,7 @@ public class FinancialTFeeDoExcel implements Serializable {
                 ", fLoadportid=" + fLoadportid +
                 ", fDestportid=" + fDestportid +
                 ", fAmount=" + fAmount +
+                ", goodName=" + goodName +
                 '}';
     }
 }

+ 3 - 1
ruoyi-warehouse/src/main/resources/mapper/finance/TFeeDoMapper.xml

@@ -272,7 +272,8 @@ CASE
 	ti.f_cntrcount AS fCntrCount,
 	tw.f_qty AS fQty,
 	tw.f_unitprice AS fUnitPrice,
-	tw.f_amount AS fAmount
+	tw.f_amount AS fAmount,
+	tg.f_name AS goodName
 FROM
 	t_fee_do tf
 	LEFT JOIN t_fees td ON tf.f_feeid = td.f_id
@@ -286,6 +287,7 @@ FROM
 	LEFT JOIN t_corps AS c ON te.f_corpid = c.f_id
 	LEFT JOIN t_warehousebills_cntr ti ON ti.f_pid = th.f_id
 	LEFT JOIN t_cntr tn ON tn.f_id = ti.f_cntrid
+	LEFT JOIN t_goods tg ON ti.f_goodsid = tg.f_id
 	LEFT JOIN sys_dict_data pr ON pr.dict_value = tw.f_feeUnitid
 	AND pr.dict_type = 'data_unitfees'
         where tf.f_pid = #{fPid}

+ 260 - 205
ruoyi-warehouse/src/main/resources/mapper/finance/TFeeMapper.xml

@@ -39,14 +39,14 @@
         <result property="fApplyMoney" column="f_apply_money"/>
         <result property="fAccountId" column="f_account_id"/>
         <result property="fMake" column="f_make"/>
-        <result property="fVslid"    column="f_vslid"    />
-        <result property="fVoyid"    column="f_voyid"    />
-        <result property="fLoadportid"    column="f_loadportid"    />
-        <result property="fDestportid"    column="f_destportid"    />
-        <result property="fDc"    column="f_dc"    />
-        <result property="fBankNumber"    column="f_bank_number"    />
-        <result property="fReconciliation"    column="f_reconciliation"    />
-        <result property="invoiceRemarks"    column="invoice_remarks"    />
+        <result property="fVslid" column="f_vslid"/>
+        <result property="fVoyid" column="f_voyid"/>
+        <result property="fLoadportid" column="f_loadportid"/>
+        <result property="fDestportid" column="f_destportid"/>
+        <result property="fDc" column="f_dc"/>
+        <result property="fBankNumber" column="f_bank_number"/>
+        <result property="fReconciliation" column="f_reconciliation"/>
+        <result property="invoiceRemarks" column="invoice_remarks"/>
     </resultMap>
 
     <sql id="selectTFeeVo">
@@ -148,7 +148,7 @@
             <if test="fAmtcr != null ">and ware.f_amtcr = #{fAmtcr}</if>
             <if test="fBilltype != null  and fBilltype != ''">and ware.f_billtype = #{fBilltype}</if>
             <if test="fBillstatus != null  and fBillstatus != ''">and ware.f_billstatus = #{fBillstatus}</if>
-            <if test="fRemarks != null  and fRemarks != ''">and ware.f_remarks like concat('%', #{fRemarks}, '%') </if>
+            <if test="fRemarks != null  and fRemarks != ''">and ware.f_remarks like concat('%', #{fRemarks}, '%')</if>
             <if test="fFromDate != null ">and ware.f_from_date = #{fFromDate}</if>
             <if test="fAccbilldate != null ">and ware.f_accbilldate = #{fAccbilldate}</if>
             <if test="fToDate != null ">and ware.f_to_date = #{fToDate}</if>
@@ -226,7 +226,7 @@
             <if test="fAmtcr != null ">and f.f_amtcr = #{fAmtcr}</if>
             <if test="fBilltype != null  and fBilltype != ''">and f.f_billtype = #{fBilltype}</if>
             <if test="fBillstatus != null  and fBillstatus != ''">and f.f_billstatus = #{fBillstatus}</if>
-            <if test="fRemarks != null  and fRemarks != ''">and ware.f_remarks like concat('%', #{fRemarks}, '%') </if>
+            <if test="fRemarks != null  and fRemarks != ''">and ware.f_remarks like concat('%', #{fRemarks}, '%')</if>
             <if test="fAccbilldate != null ">and f.f_accbilldate = #{fAccbilldate}</if>
             <if test="fDeptid != null ">and f.f_deptid = #{fDeptid}</if>
             <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
@@ -271,7 +271,7 @@
         f.f_ctrlcorpid AS fCtrlcorpid,
         pro.dict_label AS chargingMethod,
         f.invoice_no AS invoiceNo,
-        f.bank AS  fBank,
+        f.bank AS fBank,
         f.water_bill_no AS waterBillNo,
         f.f_corpid AS fCorpid,
         c.f_name AS fCorpidName,
@@ -333,7 +333,7 @@
             <if test="fAmtcr != null ">and f.f_amtcr = #{fAmtcr}</if>
             <if test="fBilltype != null  and fBilltype != ''">and f.f_billtype = #{fBilltype}</if>
             <if test="fBillstatus != null  and fBillstatus != ''">and f.f_billstatus = #{fBillstatus}</if>
-            <if test="fRemarks != null  and fRemarks != ''">and ware.f_remarks like concat('%', #{fRemarks}, '%') </if>
+            <if test="fRemarks != null  and fRemarks != ''">and ware.f_remarks like concat('%', #{fRemarks}, '%')</if>
             <if test="fAccbilldate != null ">and f.f_accbilldate = #{fAccbilldate}</if>
             <if test="fDeptid != null ">and f.f_deptid = #{fDeptid}</if>
             <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
@@ -361,18 +361,20 @@
                 and f.create_time &lt;= #{applyTime[1]}
             </if>
             <if test="chargingMethod != null ">and f.charging_method = #{chargingMethod}</if>
-            <if test="invoiceNo != null ">and f.invoice_no like concat('%', #{invoiceNo}, '%') </if>
+            <if test="invoiceNo != null ">and f.invoice_no like concat('%', #{invoiceNo}, '%')</if>
             <if test="bank != null ">and f.bank like concat('%', #{bank}, '%')</if>
-            <if test="waterBillNo != null ">and f.water_bill_no like concat('%', #{waterBillNo}, '%') </if>
+            <if test="waterBillNo != null ">and f.water_bill_no like concat('%', #{waterBillNo}, '%')</if>
             <if test="fSystemType != null and fSystemType != ''">and f.f_system_type = #{fSystemType}</if>
             <if test="createBy != null and createBy != ''">and f.create_by = #{createBy}</if>
-            <if test="fVslid != null "> and f.f_vslid = #{fVslid}</if>
-            <if test="fVoyid != null "> and f.f_voyid = #{fVoyid}</if>
-            <if test="fLoadportid != null "> and f.f_loadportid = #{fLoadportid}</if>
-            <if test="fDestportid != null "> and f.f_destportid = #{fDestportid}</if>
-            <if test="fDc != null  and fDc != ''"> and f.f_dc = #{fDc}</if>
-            <if test="fBankNumber != null  and fBankNumber != ''"> and f.f_bank_number like concat('%', #{fBankNumber}, '%')</if>
-            <if test="fReconciliation != null "> and f.f_reconciliation = #{fReconciliation}</if>
+            <if test="fVslid != null ">and f.f_vslid = #{fVslid}</if>
+            <if test="fVoyid != null ">and f.f_voyid = #{fVoyid}</if>
+            <if test="fLoadportid != null ">and f.f_loadportid = #{fLoadportid}</if>
+            <if test="fDestportid != null ">and f.f_destportid = #{fDestportid}</if>
+            <if test="fDc != null  and fDc != ''">and f.f_dc = #{fDc}</if>
+            <if test="fBankNumber != null  and fBankNumber != ''">and f.f_bank_number like concat('%', #{fBankNumber},
+                '%')
+            </if>
+            <if test="fReconciliation != null ">and f.f_reconciliation = #{fReconciliation}</if>
         </where>
         ORDER BY f.f_id desc
     </select>
@@ -639,42 +641,42 @@
 
     <select id="warehouseBillsFeesList" resultType="java.util.Map">
         SELECT
-            w.f_id AS fSrcid,
-            t.f_id AS fSrcpid,
-            t.f_corpid AS fCorpid,
-            c.f_name AS fName,
-            c.f_id AS fId,
-            c.f_name AS fFeesName,
-            t.f_bscorpno AS fBscorpno,
-            w.f_mblno AS fMblno,
-            w.f_product_name AS fProductName,
-            w.f_bsdate AS fBsdate,
-            t.f_billtype AS fBilltype,
-            t.f_review_date AS fReviewDate,
-            w.f_feeid AS fFeeid,
-            w.src_bill_no AS srcBillNo,
-            w.f_marks AS fMarks,
-            w.f_chargedate AS fChargedate,
-            w.f_billing_days AS fBillingDays,
-            w.f_billing_deadline AS fBillingDeadline,
-            w.f_inventory_days AS fInventoryDays,
-            w.f_originalbilldate AS fOriginalbilldate,
-            f.f_name AS fFeeName,
-            w.f_dc AS fSrcdc,
-            CASE
-            WHEN w.f_dc = 'D' THEN
-            '收'
-            WHEN w.f_dc = 'C' THEN
-            '付'
-            END AS fSrcdcName,
-            ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmtdr,
-            ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmt,
-            w.f_business_type AS fBusinessType
+        w.f_id AS fSrcid,
+        t.f_id AS fSrcpid,
+        t.f_corpid AS fCorpid,
+        c.f_name AS fName,
+        c.f_id AS fId,
+        c.f_name AS fFeesName,
+        t.f_bscorpno AS fBscorpno,
+        w.f_mblno AS fMblno,
+        w.f_product_name AS fProductName,
+        w.f_bsdate AS fBsdate,
+        t.f_billtype AS fBilltype,
+        t.f_review_date AS fReviewDate,
+        w.f_feeid AS fFeeid,
+        w.src_bill_no AS srcBillNo,
+        w.f_marks AS fMarks,
+        w.f_chargedate AS fChargedate,
+        w.f_billing_days AS fBillingDays,
+        w.f_billing_deadline AS fBillingDeadline,
+        w.f_inventory_days AS fInventoryDays,
+        w.f_originalbilldate AS fOriginalbilldate,
+        f.f_name AS fFeeName,
+        w.f_dc AS fSrcdc,
+        CASE
+        WHEN w.f_dc = 'D' THEN
+        '收'
+        WHEN w.f_dc = 'C' THEN
+        '付'
+        END AS fSrcdcName,
+        ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmtdr,
+        ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmt,
+        w.f_business_type AS fBusinessType
         FROM
-            t_warehousebillsfees w
-            LEFT JOIN t_warehousebills t ON t.f_id = w.f_pid
-            LEFT JOIN t_corps c ON c.f_id = w.f_corpid
-            LEFT JOIN t_fees f ON w.f_feeid = f.f_id
+        t_warehousebillsfees w
+        LEFT JOIN t_warehousebills t ON t.f_id = w.f_pid
+        LEFT JOIN t_corps c ON c.f_id = w.f_corpid
+        LEFT JOIN t_fees f ON w.f_feeid = f.f_id
         <where>
             <if test="map.tWareHouseFees.fCorpid != null  and map.tWareHouseFees.fCorpid != ''">and w.f_corpid =
                 #{map.tWareHouseFees.fCorpid}
@@ -1164,45 +1166,45 @@
 
     <select id="warehouseBillsFeesListAccamount" resultType="java.util.Map">
         SELECT
-            w.f_id AS fSrcid,
-            t.f_id AS fSrcpid,
-            t.f_corpid AS fCorpid,
-            c.f_name AS fName,
-            c.f_name AS fFeesName,
-            t.f_bscorpno AS fBscorpno,
-            w.f_mblno AS fMblno,
-            w.f_product_name AS fProductName,
-            w.f_bsdate AS fBsdate,
-            t.f_billtype AS fBilltype,
-            t.f_review_date AS fReviewDate,
-            w.f_marks AS fMarks,
-            w.f_feeid AS fFeeid,
-            w.f_billtype AS fBilltype,
-            w.f_chargedate AS fChargedate,
-            w.f_originalbilldate AS fOriginalbilldate,
-            w.f_billing_deadline AS fBillingDeadline,
-            w.f_billing_days AS fBillingDays,
-            w.f_inventory_days AS fInventoryDays,
-            f.f_name AS fFeeName,
-            w.f_dc AS fSrcdc,
-            CASE
-            WHEN w.f_dc = 'D' THEN
-            '收'
-            WHEN w.f_dc = 'C' THEN
-            '付'
-            END AS fSrcdcName,
-            ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmtdr,
-            ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmt,
-            dict.dict_label AS fFeeunitid,
-            w.f_qty AS fQty,
-            w.f_unitprice AS fUnitprice,
-            w.f_business_type AS fBusinessType
+        w.f_id AS fSrcid,
+        t.f_id AS fSrcpid,
+        t.f_corpid AS fCorpid,
+        c.f_name AS fName,
+        c.f_name AS fFeesName,
+        t.f_bscorpno AS fBscorpno,
+        w.f_mblno AS fMblno,
+        w.f_product_name AS fProductName,
+        w.f_bsdate AS fBsdate,
+        t.f_billtype AS fBilltype,
+        t.f_review_date AS fReviewDate,
+        w.f_marks AS fMarks,
+        w.f_feeid AS fFeeid,
+        w.f_billtype AS fBilltype,
+        w.f_chargedate AS fChargedate,
+        w.f_originalbilldate AS fOriginalbilldate,
+        w.f_billing_deadline AS fBillingDeadline,
+        w.f_billing_days AS fBillingDays,
+        w.f_inventory_days AS fInventoryDays,
+        f.f_name AS fFeeName,
+        w.f_dc AS fSrcdc,
+        CASE
+        WHEN w.f_dc = 'D' THEN
+        '收'
+        WHEN w.f_dc = 'C' THEN
+        '付'
+        END AS fSrcdcName,
+        ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmtdr,
+        ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmt,
+        dict.dict_label AS fFeeunitid,
+        w.f_qty AS fQty,
+        w.f_unitprice AS fUnitprice,
+        w.f_business_type AS fBusinessType
         FROM
-            t_warehousebillsfees w
-            LEFT JOIN t_warehousebills t ON t.f_id = w.f_pid
-            LEFT JOIN t_corps c ON c.f_id = w.f_corpid
-            LEFT JOIN t_fees f ON w.f_feeid = f.f_id
-            LEFT JOIN sys_dict_data dict ON dict.dict_value = w.f_feeUnitid
+        t_warehousebillsfees w
+        LEFT JOIN t_warehousebills t ON t.f_id = w.f_pid
+        LEFT JOIN t_corps c ON c.f_id = w.f_corpid
+        LEFT JOIN t_fees f ON w.f_feeid = f.f_id
+        LEFT JOIN sys_dict_data dict ON dict.dict_value = w.f_feeUnitid
         <where>
             dict.status = '0'
             AND dict.dict_type = 'data_unitfees'
@@ -2050,122 +2052,126 @@
             '%')
         </if>
         <if test="fBillno != null  and fBillno != ''">and tf.f_billno like concat('%', #{fBillno}, '%')</if>
-        <if test="fBillstatus != null and fBillstatus != '' and fBillstatus != 'null' ">and tf.f_billstatus = #{fBillstatus}</if>
+        <if test="fBillstatus != null and fBillstatus != '' and fBillstatus != 'null' ">and tf.f_billstatus =
+            #{fBillstatus}
+        </if>
         ORDER BY tf.f_id desc
     </select>
 
     <!--凯和检索费用信息-->
     <select id="FinancialFeesList" resultType="java.util.Map">
-    SELECT
-    w.f_id AS fSrcid,
-    t.f_id AS fSrcpid,
-    w.f_corpid AS fCorpid,
-    w.fName AS fName,
-    t.f_mblno AS fMblno,
-    w.f_bsdate AS fBsdate,
-    t.f_billtype AS fBilltype,
-    t.f_review_date AS fReviewDate,
-    w.f_feeid AS fFeeid,
-    w.src_bill_no AS srcBillNo,
-    w.f_marks AS fMarks,
-    f.f_name AS fFeeName,
-    w.f_dc AS fSrcdc,
-    w.f_qty AS fQty,
-    w.f_unitprice AS fUnitPrice,
-    w.f_amount AS fAmount,
-    w.f_feeUnitid AS fFeeUnitId,
-    pr.dict_label AS fFeeUnitName,
-    t.f_vslid AS fVslid,
-    t.f_voyid AS fVoyid,
-    tv.f_name AS fvslName,
-    ty.f_no AS fvoyName,
-    tre.f_name AS fLoadPortName,
-    ts.f_name As fDestPortName,
-    w.f_billstatus AS fBillStatus,
-    t.f_loadportid AS fLoadportid,
-    t.f_destportid AS fDestportid,
-    tn.f_name AS cntrName,
-    ti.f_cntrcount AS fCntrCount,
-    <if test='map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype != "" and map.tWareHouseFees.fBilltype == "KHDZ" '>
-        ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmtdr,
-        ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmt,
-    </if>
-    <if test='map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype != "" and map.tWareHouseFees.fBilltype == "KHSF" '>
-        ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmtdr,
-        ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmt,
-    </if>
-    <if test='map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype != "" and map.tWareHouseFees.fBilltype == "KHFF" '>
-        ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmtdr,
-        ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmt,
-    </if>
-    CASE
-    WHEN w.f_dc = 'D' THEN '收'
-    WHEN w.f_dc = 'C' THEN '付'
-    END AS fSrcdcName,
-    CASE
-    WHEN w.f_billstatus = '1' THEN '新建'
-    WHEN w.f_billstatus = '2' THEN '暂存'
-    WHEN w.f_billstatus = '3' THEN '驳回'
-    WHEN w.f_billstatus = '4' THEN '提交'
-    WHEN w.f_billstatus = '5' THEN '审批中'
-    WHEN w.f_billstatus = '6' THEN '通过'
-    END AS fBillStatusName
-    FROM
-    t_warehousebills t
-    LEFT JOIN (
-    SELECT
-    f.f_id AS f_id,
-    f.f_pid AS f_pid,
-    f.f_lineno AS f_lineno,
-    f.f_corpid,
-    f.f_feeid,
-    f.f_feeUnitid,
-    f.f_qty,
-    f.f_unitprice,
-    f.f_amount,
-    f.f_currency,
-    f.f_exrate,
-    f.f_taxrate,
-    f.f_dc,
-    f.f_billstatus,
-    f.f_statement_no,
-    f.f_accamount,
-    f.f_accamount_date,
-    f.f_stlamount_no,
-    f.f_stlamount,
-    f.f_stlamount_date,
-    f.f_invnos,
-    f.f_invamount,
-    f.f_askamount,
-    f.f_chargedate,
-    f.f_status,
-    f.remark,
-    f.f_mblno,
-    f.f_product_name,
-    f.src_bill_no,
-    f.f_billing_days,
-    f.f_inventory_days,
-    f.f_marks,
-    f.f_billing_deadline,
-    f.f_originalbilldate,
-    f.f_billtype,
-    f.f_business_type,
-    f.f_bsdate,
-    c.f_id AS fId,
-    c.f_name AS fName
-    FROM
-    t_warehousebillsfees AS f
-    LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
-    ) w ON w.f_pid = t.f_id
-    LEFT JOIN t_fees f ON w.f_feeid = f.f_id
-    LEFT JOIN sys_dict_data pr ON pr.dict_value = w.f_feeUnitid
-    AND pr.dict_type = 'data_unitfees'
-    LEFT JOIN t_vessel tv ON t.f_vslid = tv.f_id
-    LEFT JOIN t_voyage ty ON t.f_voyid = ty.f_id
-    LEFT JOIN t_address tre ON tre.f_id = t.f_loadportid
-    LEFT JOIN t_address ts ON ts.f_id = t.f_destportid
-    LEFT JOIN t_warehousebills_cntr ti ON ti.f_pid = t.f_id
-    LEFT JOIN t_cntr tn ON tn.f_id = ti.f_cntrid
+        SELECT
+        w.f_id AS fSrcid,
+        t.f_id AS fSrcpid,
+        w.f_corpid AS fCorpid,
+        w.fName AS fName,
+        t.f_mblno AS fMblno,
+        w.f_bsdate AS fBsdate,
+        t.f_billtype AS fBilltype,
+        t.f_review_date AS fReviewDate,
+        w.f_feeid AS fFeeid,
+        w.src_bill_no AS srcBillNo,
+        w.f_marks AS fMarks,
+        f.f_name AS fFeeName,
+        w.f_dc AS fSrcdc,
+        w.f_qty AS fQty,
+        w.f_unitprice AS fUnitPrice,
+        w.f_amount AS fAmount,
+        w.f_feeUnitid AS fFeeUnitId,
+        pr.dict_label AS fFeeUnitName,
+        t.f_vslid AS fVslid,
+        t.f_voyid AS fVoyid,
+        tv.f_name AS fvslName,
+        ty.f_no AS fvoyName,
+        tre.f_name AS fLoadPortName,
+        ts.f_name As fDestPortName,
+        w.f_billstatus AS fBillStatus,
+        t.f_loadportid AS fLoadportid,
+        t.f_destportid AS fDestportid,
+        tn.f_name AS cntrName,
+        ti.f_cntrcount AS fCntrCount,
+        <if test='map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype != "" and map.tWareHouseFees.fBilltype == "KHDZ" '>
+            ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmtdr,
+            ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmt,
+        </if>
+        <if test='map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype != "" and map.tWareHouseFees.fBilltype == "KHSF" '>
+            ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmtdr,
+            ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmt,
+        </if>
+        <if test='map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype != "" and map.tWareHouseFees.fBilltype == "KHFF" '>
+            ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmtdr,
+            ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmt,
+        </if>
+        CASE
+        WHEN w.f_dc = 'D' THEN '收'
+        WHEN w.f_dc = 'C' THEN '付'
+        END AS fSrcdcName,
+        CASE
+        WHEN w.f_billstatus = '1' THEN '新建'
+        WHEN w.f_billstatus = '2' THEN '暂存'
+        WHEN w.f_billstatus = '3' THEN '驳回'
+        WHEN w.f_billstatus = '4' THEN '提交'
+        WHEN w.f_billstatus = '5' THEN '审批中'
+        WHEN w.f_billstatus = '6' THEN '通过'
+        END AS fBillStatusName,
+        tg.f_name AS goodName
+        FROM
+        t_warehousebills t
+        LEFT JOIN (
+        SELECT
+        f.f_id AS f_id,
+        f.f_pid AS f_pid,
+        f.f_lineno AS f_lineno,
+        f.f_corpid,
+        f.f_feeid,
+        f.f_feeUnitid,
+        f.f_qty,
+        f.f_unitprice,
+        f.f_amount,
+        f.f_currency,
+        f.f_exrate,
+        f.f_taxrate,
+        f.f_dc,
+        f.f_billstatus,
+        f.f_statement_no,
+        f.f_accamount,
+        f.f_accamount_date,
+        f.f_stlamount_no,
+        f.f_stlamount,
+        f.f_stlamount_date,
+        f.f_invnos,
+        f.f_invamount,
+        f.f_askamount,
+        f.f_chargedate,
+        f.f_status,
+        f.remark,
+        f.f_mblno,
+        f.f_product_name,
+        f.src_bill_no,
+        f.f_billing_days,
+        f.f_inventory_days,
+        f.f_marks,
+        f.f_billing_deadline,
+        f.f_originalbilldate,
+        f.f_billtype,
+        f.f_business_type,
+        f.f_bsdate,
+        c.f_id AS fId,
+        c.f_name AS fName
+        FROM
+        t_warehousebillsfees AS f
+        LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
+        ) w ON w.f_pid = t.f_id
+        LEFT JOIN t_fees f ON w.f_feeid = f.f_id
+        LEFT JOIN sys_dict_data pr ON pr.dict_value = w.f_feeUnitid
+        AND pr.dict_type = 'data_unitfees'
+        LEFT JOIN t_vessel tv ON t.f_vslid = tv.f_id
+        LEFT JOIN t_voyage ty ON t.f_voyid = ty.f_id
+        LEFT JOIN t_address tre ON tre.f_id = t.f_loadportid
+        LEFT JOIN t_address ts ON ts.f_id = t.f_destportid
+        LEFT JOIN t_warehousebills_cntr ti ON ti.f_pid = t.f_id
+        LEFT JOIN t_cntr tn ON tn.f_id = ti.f_cntrid
+        LEFT JOIN t_goods tg ON ti.f_goodsid = tg.f_id
         <where>
             t.f_typeid = 1
             and w.f_billstatus = 6
@@ -2281,5 +2287,54 @@
         where
         f.f_id = #{fId}
     </select>
+    <select id="exportFinancial" parameterType="TFee" resultType="com.ruoyi.shipping.excel.ExportFinancial">
+        SELECT
+        @rank:=@rank + 1 AS rankNo,
+        tp.fMblNo AS fMblNo,
+        tp.portOfDeparture AS portOfDeparture,
+        tp.destinationPort AS destinationPort,
+        tp.goodName AS goodName,
+        IFNULL(tp.fCnTrCount,0) AS fCnTrCount,
+        tp.specification AS specification,
+        IFNULL(tp.fUnitPrice,0) AS fUnitPrice,
+        IFNULL(tp.fAmount,0) AS fAmount
+        FROM
+        (
+            SELECT
+	        tw.f_mblno AS fMblNo,
+	        ts.f_name AS portOfDeparture,
+	        ty.f_name AS destinationPort,
+	        tg.f_name AS goodName,
+	        IFNULL(temp.fCnTrCount,0) AS fCnTrCount,
+	        tr.f_name AS specification,
+	        CASE
+	            WHEN temp.fCnTrCount != 0 THEN temp.fAmount/temp.fCnTrCount
+	        ELSE 0
+	        END AS fUnitPrice,
+	        IFNULL(temp.fAmount,0) AS fAmount
+            FROM
+            (
+                SELECT
+	            td.f_srcpid AS pId,
+	            IFNULL(SUM(tr.f_cntrcount),0) AS fCnTrCount,
+	            IFNULL(SUM(tf.f_amount),0) AS fAmount
+                FROM
+	            t_fee_do td
+	            LEFT JOIN
+	            t_warehousebills tw ON tw.f_id = td.f_srcpid
+	            LEFT JOIN t_warehousebillsfees tf ON tf.f_id = td.f_srcid
+	            LEFT JOIN t_warehousebills_cntr tr ON tr.f_pid = tw.f_id
+	            WHERE td.f_pid = #{id}
+	            GROUP BY td.f_srcpid
+            )temp
+            LEFT JOIN t_warehousebills tw ON tw.f_id = temp.pId
+            LEFT JOIN t_address ts ON tw.f_loadportid = ts.f_id
+            LEFT JOIN t_address ty ON tw.f_destportid = ty.f_id
+            LEFT JOIN t_warehousebills_cntr tc ON tc.f_pid = tw.f_id
+            LEFT JOIN t_cntr tr ON tr.f_id = tc.f_cntrid
+            LEFT JOIN t_goods tg ON tc.f_goodsid = tg.f_id
+        )tp,
+        (SELECT @rank:= 0) b
+    </select>
 
 </mapper>