caifc 3 years ago
parent
commit
4e3a7d071e

+ 163 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/finance/TInvoiceController.java

@@ -0,0 +1,163 @@
+package com.ruoyi.web.controller.warehouse.finance;
+
+import com.ruoyi.common.annotation.DataScope;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.annotation.RepeatSubmit;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.model.LoginUser;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.ServletUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.utils.spring.SpringUtils;
+import com.ruoyi.finance.domain.TFee;
+import com.ruoyi.finance.domain.TWareHouseFees;
+import com.ruoyi.finance.excel.Charge;
+import com.ruoyi.finance.excel.Detailed;
+import com.ruoyi.finance.service.ITFeeService;
+import com.ruoyi.framework.web.service.TokenService;
+import com.ruoyi.warehouseBusiness.domain.enums.FeesTypeEnum;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 财务发票数据主Controller
+ *
+ * @author ruoyi
+ * @date 2021-01-18
+ */
+@RestController
+@RequestMapping("/finance/invoice")
+public class TInvoiceController extends BaseController {
+    @Autowired
+    private ITFeeService tFeeService;
+
+    /**
+     * 查询财务数据主列表
+     */
+    @PreAuthorize("@ss.hasPermi('finance:charge:list')")
+    @DataScope(deptAlias = "d", userAlias = "u")
+    @GetMapping("/list")
+    public TableDataInfo list(TFee tFee) {
+        if (StringUtils.isEmpty(tFee.getfBilltype())) {
+            tFee.setfBilltype(FeesTypeEnum.INVOICE.getType());
+        }
+        startPage();
+        List<TFee> list = tFeeService.selectTFeeList(tFee);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出财务数据主列表
+     */
+    @PreAuthorize("@ss.hasPermi('finance:charge:export')")
+    @Log(title = "财务数据主", businessType = BusinessType.EXPORT)
+    @DataScope(deptAlias = "d", userAlias = "u")
+    @GetMapping("/export")
+    public AjaxResult export(TFee tFee) throws Exception {
+        if (StringUtils.isEmpty(tFee.getfBilltype())) {
+            tFee.setfBilltype(FeesTypeEnum.INVOICE.getType());
+        }
+        List<Charge> list = tFeeService.chargeExport(tFee);
+        ExcelUtil<Charge> util = new ExcelUtil<Charge>(Charge.class);
+        return util.exportExcel(list, FeesTypeEnum.INVOICE.getName());
+    }
+
+    /**
+     * 获取财务数据主详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('finance:charge:query')")
+    @GetMapping(value = "/{fId}")
+    public AjaxResult getInfo(@PathVariable("fId") Long fId) {
+        return AjaxResult.success(tFeeService.selectTFeeById(fId));
+    }
+
+    /**
+     * 新增财务数据主
+     */
+    @PreAuthorize("@ss.hasPermi('finance:charge:add')")
+    @Log(title = "财务数据主", businessType = BusinessType.INSERT)
+    @PostMapping(value = "/add")
+    @RepeatSubmit
+    public AjaxResult add(@RequestParam("tFee") String tFee,
+                          @RequestParam("tFeeDo") String tFeeDo) {
+        // 获取当前的用户
+        LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
+        return tFeeService.insertTFeeTFeeDo(tFee, tFeeDo, loginUser, FeesTypeEnum.INVOICE.getType());
+    }
+
+    /**
+     * 删除财务数据主
+     */
+    @PreAuthorize("@ss.hasPermi('finance:charge:remove')")
+    @Log(title = "财务数据主", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{fIds}")
+    public AjaxResult remove(@PathVariable Long[] fIds) {
+        return toAjax(tFeeService.deleteTFeeByIds(fIds));
+    }
+
+    @PreAuthorize("@ss.hasPermi('finance:charge:remove')")
+    @Log(title = "财务数据主", businessType = BusinessType.DELETE)
+    @DeleteMapping("/queryRemove/{fId}")
+    public AjaxResult queryRemove(@PathVariable("fId") Long fId) {
+        return tFeeService.queryRemove(fId);
+    }
+
+    /**
+     * 发票查询
+     */
+    @PreAuthorize("@ss.hasPermi('finance:charge:list')")
+    @GetMapping("/invoiceList")
+    public TableDataInfo chargeList(TWareHouseFees tWareHouseFees) {
+        startPage();
+        List<Map<String, Object>> list = tFeeService.warehouseBillsFeesList(tWareHouseFees, FeesTypeEnum.INVOICE.getType());
+        return getDataTable(list);
+    }
+
+    /**
+     * 确认收费
+     */
+    @PreAuthorize("@ss.hasPermi('finance:charge:add')")
+    @Log(title = "财务数据主", businessType = BusinessType.INSERT)
+    @PostMapping(value = "/confirm")
+    @RepeatSubmit
+    public AjaxResult confirm(@RequestParam("tFee") String tFee,
+                              @RequestParam("tFeeDo") String tFeeDo) {
+        // 获取当前的用户
+        LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
+        return tFeeService.confirm(tFee, tFeeDo, loginUser, FeesTypeEnum.INVOICE.getType());
+    }
+
+
+    /**
+     * 撤销收费
+     */
+    @PreAuthorize("@ss.hasPermi('finance:charge:add')")
+    @Log(title = "财务数据主", businessType = BusinessType.INSERT)
+    @PostMapping(value = "/revoke")
+    @RepeatSubmit
+    public AjaxResult revoke(@RequestParam("tFee") String tFee,
+                             @RequestParam("tFeeDo") String tFeeDo) {
+        // 获取当前的用户
+        LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
+        return tFeeService.revoke(tFee, tFeeDo, loginUser, FeesTypeEnum.INVOICE_REVOKE.getType());
+    }
+
+    /**
+     * 导出入库详情主表列表
+     */
+    @GetMapping("/exportItems/{fId}")
+    public AjaxResult exportItems(@PathVariable("fId") Long fId) {
+        List<Detailed> list = tFeeService.selectDetailedList(fId);
+        String exportName = tFeeService.findCtrlcorpid(fId);
+        ExcelUtil<Detailed> util = new ExcelUtil<Detailed>(Detailed.class);
+        return util.exportExcel(list, exportName);
+    }
+
+}

+ 32 - 3
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/reportManagement/PayableController.java

@@ -8,8 +8,13 @@ import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.finance.domain.TWareHouseFees;
+import com.ruoyi.finance.domain.dto.FeeDTO;
+import com.ruoyi.finance.domain.excel.GeneralLedgerDetailExcel;
+import com.ruoyi.finance.domain.excel.GeneralLedgerExcel;
+import com.ruoyi.finance.domain.vo.FeeVO;
 import com.ruoyi.finance.service.ITFeeService;
 import com.ruoyi.reportManagement.excel.Payable;
+import org.aspectj.weaver.loadtime.Aj;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -41,11 +46,21 @@ public class PayableController extends BaseController {
     public TableDataInfo chargeList(TWareHouseFees tWareHouseFees) {
         startPage();
         tWareHouseFees.setfDc("C");
-        List<Map<String, Object>> list = tFeeService.warehouseBillsFeesList(tWareHouseFees);
+        List<FeeVO> list = tFeeService.warehouseBillsFeesList(tWareHouseFees);
         return getDataTable(list);
     }
 
     /**
+     * 根据结算单位、费用状态、审核日期查询应付总帐明细
+     */
+    @DataScope(deptAlias = "d", userAlias = "u")
+    @GetMapping("/generalLedgerList")
+    public AjaxResult financialLedgerDetails(FeeDTO feeDTO) {
+        feeDTO.setFDc("C");
+        return tFeeService.financialLedgerDetails(feeDTO);
+    }
+
+    /**
      * 应付总账列表
      */
     @PreAuthorize("@ss.hasPermi('warehouseBusiness:payable:export')")
@@ -54,9 +69,23 @@ public class PayableController extends BaseController {
     @GetMapping("/export")
     public AjaxResult export(TWareHouseFees tWareHouseFees) throws Exception {
         tWareHouseFees.setfDc("C");
-        List<Payable> list = tFeeService.payableExport(tWareHouseFees);
-        ExcelUtil<Payable> util = new ExcelUtil<Payable>(Payable.class);
+        List<GeneralLedgerExcel> list = tFeeService.payableExport(tWareHouseFees);
+        ExcelUtil<GeneralLedgerExcel> util = new ExcelUtil<GeneralLedgerExcel>(GeneralLedgerExcel.class);
         return util.exportExcel(list, "应付总账");
     }
 
+    /**
+     * 应付总账列表
+     */
+    @PreAuthorize("@ss.hasPermi('warehouseBusiness:payable:export')")
+    @Log(title = "库存总账明细", businessType = BusinessType.EXPORT)
+    @DataScope(deptAlias = "d", userAlias = "u")
+    @GetMapping("/export/detail")
+    public AjaxResult exportDetail(FeeDTO feeDTO) throws Exception {
+        feeDTO.setFDc("C");
+        List<GeneralLedgerDetailExcel> list = tFeeService.financialLedgerDetailsExport(feeDTO);
+        ExcelUtil<GeneralLedgerDetailExcel> util = new ExcelUtil<GeneralLedgerDetailExcel>(GeneralLedgerDetailExcel.class);
+        return util.exportExcel(list, "应付总账明细");
+    }
+
 }

+ 33 - 3
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/reportManagement/ReceivableController.java

@@ -8,6 +8,10 @@ import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.finance.domain.TWareHouseFees;
+import com.ruoyi.finance.domain.dto.FeeDTO;
+import com.ruoyi.finance.domain.excel.GeneralLedgerDetailExcel;
+import com.ruoyi.finance.domain.excel.GeneralLedgerExcel;
+import com.ruoyi.finance.domain.vo.FeeVO;
 import com.ruoyi.finance.service.ITFeeService;
 import com.ruoyi.reportManagement.dto.TWarehousebill;
 import com.ruoyi.reportManagement.excel.Receivable;
@@ -42,11 +46,21 @@ public class ReceivableController extends BaseController {
     public TableDataInfo chargeList(TWareHouseFees tWareHouseFees) {
         startPage();
         tWareHouseFees.setfDc("D");
-        List<Map<String, Object>> list = tFeeService.warehouseBillsFeesList(tWareHouseFees);
+        List<FeeVO> list = tFeeService.warehouseBillsFeesList(tWareHouseFees);
         return getDataTable(list);
     }
 
     /**
+     * 根据结算单位、费用状态、审核日期查询应付总帐明细
+     */
+    @DataScope(deptAlias = "d", userAlias = "u")
+    @GetMapping("/generalLedgerList")
+    public AjaxResult financialLedgerDetails(FeeDTO feeDTO) {
+        feeDTO.setFDc("D");
+        return tFeeService.financialLedgerDetails(feeDTO);
+    }
+
+    /**
      * 应收总账列表
      */
     @PreAuthorize("@ss.hasPermi('warehouseBusiness:receivable:export')")
@@ -55,12 +69,28 @@ public class ReceivableController extends BaseController {
     @GetMapping("/export")
     public AjaxResult export(TWareHouseFees tWareHouseFees) throws Exception {
         tWareHouseFees.setfDc("D");
-        List<Receivable> list = tFeeService.receivableExport(tWareHouseFees);
-        ExcelUtil<Receivable> util = new ExcelUtil<Receivable>(Receivable.class);
+        List<GeneralLedgerExcel> list = tFeeService.payableExport(tWareHouseFees);
+        ExcelUtil<GeneralLedgerExcel> util = new ExcelUtil<GeneralLedgerExcel>(GeneralLedgerExcel.class);
         return util.exportExcel(list, "应收总账");
     }
 
     /**
+     * 应收总账列表
+     */
+    @PreAuthorize("@ss.hasPermi('warehouseBusiness:payable:export')")
+    @Log(title = "库存总账明细", businessType = BusinessType.EXPORT)
+    @DataScope(deptAlias = "d", userAlias = "u")
+    @GetMapping("/export/detail")
+    public AjaxResult exportDetail(FeeDTO feeDTO) throws Exception {
+        feeDTO.setFDc("D");
+        List<GeneralLedgerDetailExcel> list = tFeeService.financialLedgerDetailsExport(feeDTO);
+        ExcelUtil<GeneralLedgerDetailExcel> util = new ExcelUtil<GeneralLedgerDetailExcel>(GeneralLedgerDetailExcel.class);
+        return util.exportExcel(list, "应付总账明细");
+    }
+
+
+
+    /**
      *  明细帐
      */
     @DataScope(deptAlias = "d", userAlias = "u")

+ 37 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/finance/domain/dto/FeeDTO.java

@@ -0,0 +1,37 @@
+package com.ruoyi.finance.domain.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author caifc
+ * @date 2021-11-23 14:19
+ */
+@Data
+public class FeeDTO {
+    private static final long serialVersionUID = 1L;
+
+    // 费用id
+    private Long feesId;
+
+    // 收费、付费
+    private String fDc;
+
+    // 提单号
+    private String fMblNo;
+
+    // 业务类型
+    private String fBillType;
+
+    // 结算单位
+    private Long fCorpId;
+
+    // 费用状态
+    private Long fBillstatus;
+
+    // 审核时间集合
+    private List<String> fAuditList;
+
+}

+ 43 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/finance/domain/excel/GeneralLedgerDetailExcel.java

@@ -0,0 +1,43 @@
+package com.ruoyi.finance.domain.excel;
+
+import com.ruoyi.common.annotation.Excel;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+@Data
+public class GeneralLedgerDetailExcel implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    @Excel(name = "结算单位")
+    private String fFeesName;
+
+    @Excel(name = "提单号")
+    private String fMblno;
+
+    @Excel(name = "货物名称")
+    private String fProductName;
+
+    @Excel(name = "品牌")
+    private String fMarks;
+
+    @Excel(name = "业务类型")
+    private String fBilltype;
+
+    @Excel(name = "仓储费")
+    private BigDecimal storageFee;
+
+    @Excel(name = "其他费用")
+    private BigDecimal otherFee;
+
+    @Excel(name = "应付金额")
+    private BigDecimal fAmount;
+
+    @Excel(name = "实付金额")
+    private BigDecimal fStlamount;
+
+    @Excel(name = "未付金额")
+    private BigDecimal nnfinished;
+
+}

+ 28 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/finance/domain/excel/GeneralLedgerExcel.java

@@ -0,0 +1,28 @@
+package com.ruoyi.finance.domain.excel;
+
+import com.ruoyi.common.annotation.Excel;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+@Data
+public class GeneralLedgerExcel implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    @Excel(name = "结算单位")
+    private String fFeesName;
+
+    @Excel(name = "提单号")
+    private String fMblno;
+
+    @Excel(name = "应付金额")
+    private BigDecimal fAmount;
+
+    @Excel(name = "实付金额")
+    private BigDecimal fStlamount;
+
+    @Excel(name = "未付金额")
+    private BigDecimal nnfinished;
+
+}

+ 55 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/finance/domain/vo/FeeVO.java

@@ -0,0 +1,55 @@
+package com.ruoyi.finance.domain.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.finance.domain.TFee;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @author caifc
+ * @date 2021-11-23 13:48
+ */
+@Data
+public class FeeVO extends TFee {
+    private static final long serialVersionUID = 1L;
+
+
+    // 唛头
+    private String fMarks;
+
+    // 提单号
+    private String fMblno;
+
+    // 来源id
+    private Long fSrcpid;
+
+    // 审核时间
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    private Date fReviewDate;
+
+    // 总金额
+    private BigDecimal fAmount;
+
+    // 结算单位名称
+    private String fFeesName;
+
+    // 费用名称
+    private String fProductName;
+
+    // 仓储费金额
+    private BigDecimal storageFee;
+
+    // 其他金额
+    private BigDecimal otherFee;
+
+    // 总结算金额
+    private BigDecimal fStlamount;
+
+    // 应结总金额
+    private BigDecimal nnfinished;
+
+}

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

@@ -2,6 +2,8 @@ package com.ruoyi.finance.mapper;
 
 import com.ruoyi.finance.domain.TFee;
 import com.ruoyi.finance.domain.TWareHouseFees;
+import com.ruoyi.finance.domain.dto.FeeDTO;
+import com.ruoyi.finance.domain.vo.FeeVO;
 import com.ruoyi.finance.excel.Detailed;
 import com.ruoyi.finance.shipping.FinancialTFee;
 import com.ruoyi.reportManagement.dto.TWarehousebill;
@@ -106,6 +108,13 @@ public interface TFeeMapper {
 
     public List<Map<String, Object>> warehouseBillsFeesList1(TWareHouseFees tWareHouseFees);
 
+    /**
+     *  查询应收、应付总帐
+     * @param tWareHouseFees
+     * @return
+     */
+    List<FeeVO> selectFinancialLedgerList(TWareHouseFees tWareHouseFees);
+
     public List<Map<String, Object>> warehouseBillsFeesProfitList(TWareHouseFees tWareHouseFees);
 
     /**
@@ -147,4 +156,18 @@ public interface TFeeMapper {
      */
     List<ExportFinancial> exportFinancial(@Param("id") Long id);
 
+    /**
+     * 查询发票数据
+     * @param map
+     * @return
+     */
+    List<Map<String, Object>> queryApplyInvoiceFeesList(@Param("map") Map<String, Object> map);
+
+    /**
+     *  根据结算单位、费用状态、审核日期查询应付总帐明细
+     * @param feeDTO
+     * @return
+     */
+    List<FeeVO> selectFinancialLedgerDetails(FeeDTO feeDTO);
+
 }

+ 75 - 27
ruoyi-warehouse/src/main/java/com/ruoyi/finance/service/ITFeeService.java

@@ -4,6 +4,10 @@ import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.model.LoginUser;
 import com.ruoyi.finance.domain.TFee;
 import com.ruoyi.finance.domain.TWareHouseFees;
+import com.ruoyi.finance.domain.dto.FeeDTO;
+import com.ruoyi.finance.domain.excel.GeneralLedgerDetailExcel;
+import com.ruoyi.finance.domain.excel.GeneralLedgerExcel;
+import com.ruoyi.finance.domain.vo.FeeVO;
 import com.ruoyi.finance.excel.Charge;
 import com.ruoyi.finance.excel.Contrast;
 import com.ruoyi.finance.excel.Detailed;
@@ -11,7 +15,6 @@ import com.ruoyi.finance.excel.Payment;
 import com.ruoyi.finance.shipping.FinancialTFee;
 import com.ruoyi.finance.shipping.FinancialTFeeDoExcel;
 import com.ruoyi.reportManagement.dto.TWarehousebill;
-import com.ruoyi.reportManagement.excel.Payable;
 import com.ruoyi.reportManagement.excel.Profit;
 import com.ruoyi.reportManagement.excel.Receivable;
 import com.ruoyi.shipping.domain.TAccount;
@@ -36,6 +39,7 @@ public interface ITFeeService {
      * @return 财务数据主
      */
     public Map<String, Object> selectTFeeById(Long fId);
+
     /**
      * 查询财务数据主
      *
@@ -53,26 +57,34 @@ public interface ITFeeService {
     public List<TFee> selectTFeeList(TFee tFee);
 
     public List<Map<String, Object>> selectTFeeList1(TFee tFee);
+
     /**
      * 凯和确认账单查询
+     *
      * @param tFee
      * @return
      */
     public List<Map<String, Object>> webVersionTFee(TFee tFee);
+
     /**
      * 网页版对账查询明细
+     *
      * @param tAccount
      * @return
      */
-    public List<Map<String,Object>> webVersionDetail(TAccount tAccount);
+    public List<Map<String, Object>> webVersionDetail(TAccount tAccount);
+
     /**
      * 网页版发票查询
+     *
      * @param tFee
      * @return
      */
     public List<Map<String, Object>> webVersionInvoice(TFee tFee);
+
     /**
      * 网页版发票查询明细
+     *
      * @param tFee
      * @return
      */
@@ -80,6 +92,7 @@ public interface ITFeeService {
 
     /**
      * 网页版查询数据
+     *
      * @param tAccount
      * @return
      */
@@ -95,31 +108,36 @@ public interface ITFeeService {
 
 
     /**
-     *  保存对账、收款
+     * 保存对账、收款
+     *
      * @param tfee
      * @param tfeeDo
      * @param loginUser
      * @param fBilltype
      * @return
      */
-    public AjaxResult insertTFeeTFeeDo(String tfee, String tfeeDo ,LoginUser loginUser,String fBilltype);
+    public AjaxResult insertTFeeTFeeDo(String tfee, String tfeeDo, LoginUser loginUser, String fBilltype);
+
     /**
-     *  保存对账、收款
+     * 保存对账、收款
+     *
      * @param tfee
      * @param loginUser
      * @param fBilltype
      * @return
      */
-    public AjaxResult insertWebVersion(String tfee, String tfeeDo ,LoginUser loginUser,String fBilltype);
+    public AjaxResult insertWebVersion(String tfee, String tfeeDo, LoginUser loginUser, String fBilltype);
+
     /**
-     *  保存对账、收款
+     * 保存对账、收款
+     *
      * @param tfee
      * @param tfeeDo
      * @param loginUser
      * @param fBilltype
      * @return
      */
-    public AjaxResult insertKHTFeeTFeeDo(String tfee, String tfeeDo,String tFeeInvoice,LoginUser loginUser,String fBilltype);
+    public AjaxResult insertKHTFeeTFeeDo(String tfee, String tfeeDo, String tFeeInvoice, LoginUser loginUser, String fBilltype);
 
     /**
      * 修改财务数据主
@@ -136,6 +154,7 @@ public interface ITFeeService {
      * @return 结果
      */
     public int deleteTFeeByIds(Long[] fIds);
+
     /**
      * 批量删除财务数据主
      *
@@ -153,35 +172,37 @@ public interface ITFeeService {
     public int deleteTFeeById(Long fId);
 
     /**
-     *   对账、收费、付费
+     * 对账、收费、付费
+     *
      * @param tWareHouseFees
      * @return
      */
-    public List<Map<String, Object>> warehouseBillsFeesList(TWareHouseFees tWareHouseFees,String billsType);
+    public List<Map<String, Object>> warehouseBillsFeesList(TWareHouseFees tWareHouseFees, String billsType);
 
-    public List<Map<String, Object>> warehouseBillsFeesList(TWareHouseFees tWareHouseFees);
+    public List<FeeVO> warehouseBillsFeesList(TWareHouseFees tWareHouseFees);
 
     public List<Map<String, Object>> warehouseBillsFeesProfitList(TWareHouseFees tWareHouseFees);
 
     /**
-     *  财务: 对账、收费、付费   流程确认
+     * 财务: 对账、收费、付费   流程确认
+     *
      * @param tfee
      * @param tfeeDo
      * @param loginUser
      * @param fBilltype
      * @return
      */
-    public AjaxResult confirm(String tfee, String tfeeDo ,LoginUser loginUser,String fBilltype);
+    public AjaxResult confirm(String tfee, String tfeeDo, LoginUser loginUser, String fBilltype);
 
     /**
-     *
      * @param fIds
      * @return
      */
-    public AjaxResult webVersionConfirm(Long[] fIds,String billsType,LoginUser loginUser);
+    public AjaxResult webVersionConfirm(Long[] fIds, String billsType, LoginUser loginUser);
 
     /**
      * 凯和
+     *
      * @param tfee
      * @param tfeeDo
      * @param tFeeInvoice
@@ -189,26 +210,27 @@ public interface ITFeeService {
      * @param fBilltype
      * @return
      */
-    public AjaxResult confirmKaiHe(String tfee, String tfeeDo,String tFeeInvoice,LoginUser loginUser,String fBilltype);
+    public AjaxResult confirmKaiHe(String tfee, String tfeeDo, String tFeeInvoice, LoginUser loginUser, String fBilltype);
 
-    public AjaxResult revoke(String tfee, String tfeeDo ,LoginUser loginUser,String fBilltype);
+    public AjaxResult revoke(String tfee, String tfeeDo, LoginUser loginUser, String fBilltype);
 
     public AjaxResult queryRemove(Long fId);
 
     public AjaxResult remove(Long fId);
 
     /**
-     *  导出计算明细
+     * 导出计算明细
+     *
      * @param fId
      * @return
      */
-    public List<TWareHouseExcelItem> selectTWarehousebillsItemsList(Long  fId);
+    public List<TWareHouseExcelItem> selectTWarehousebillsItemsList(Long fId);
 
-    public  String  findCtrlcorpid (Long  fId);
+    public String findCtrlcorpid(Long fId);
 
     public List<Receivable> receivableExport(TWareHouseFees tWareHouseFees) throws Exception;
 
-    public List<Payable> payableExport(TWareHouseFees tWareHouseFees) throws Exception;
+    public List<GeneralLedgerExcel> payableExport(TWareHouseFees tWareHouseFees) throws Exception;
 
     public List<Profit> profitExport(TWareHouseFees tWareHouseFees) throws Exception;
 
@@ -220,43 +242,52 @@ public interface ITFeeService {
 
     /**
      * 凯和网页版对账下载
+     *
      * @param tFee
      * @return
      * @throws Exception
      */
     public List<Account> accountExport(TFee tFee) throws Exception;
 
-    public List<Detailed> selectDetailedList(Long  fId);
+    public List<Detailed> selectDetailedList(Long fId);
 
     List<Map<String, Object>> selectdetailedList(TWarehousebill tWarehousebill);
 
     /**
      * 网页版申请发票审核
+     *
      * @param tFee
      * @return
      */
     public AjaxResult webVersionApplyFP(TFee tFee, LoginUser loginUser, String billType, TFeeInvoice tFeeInvoice);
+
     /**
      * 网页版申请发票提交
+     *
      * @param tFee
      * @return
      */
-    public AjaxResult webVersionSubmitApplyFP(TFee tFee,LoginUser loginUser,String billType);
+    public AjaxResult webVersionSubmitApplyFP(TFee tFee, LoginUser loginUser, String billType);
+
     /**
      * 网页版申请发票提交
+     *
      * @param tFee
      * @return
      */
-    public AjaxResult webVersionUpdateApplyFP(TFee tFee,LoginUser loginUser,String billType);
+    public AjaxResult webVersionUpdateApplyFP(TFee tFee, LoginUser loginUser, String billType);
 
     /**
      * 凯和查询财务信息列表
+     *
      * @param tFee
      * @return
      */
     public List<FinancialTFee> selectFinancialTFeeList(TFee tFee);
+
     /**
-     *   对账、收费、付费
+     * 对账、收费、付费
+     *
      * @param tWareHouseFees
      * @return
      */
@@ -264,21 +295,38 @@ public interface ITFeeService {
 
     /**
      * 凯和获取财务数据详情
+     *
      * @param fId
      * @return
      */
-    public Map<String, Object>  selectFinancialTFeeId(Long fId);
+    public Map<String, Object> selectFinancialTFeeId(Long fId);
+
     /**
      * 导出费用明细
      */
-    public List<FinancialTFeeDoExcel>  FinancialTFeeDoExcel(Long fId);
+    public List<FinancialTFeeDoExcel> FinancialTFeeDoExcel(Long fId);
 
     /**
      * 导出财务对账数据
+     *
      * @param fId
      * @return
      */
     public AjaxResult exportFinancial(Long fId);
 
+    /**
+     * 根据结算单位、费用状态、审核日期查询应付总帐明细
+     *
+     * @param feeDTO
+     * @return
+     */
+    AjaxResult financialLedgerDetails(FeeDTO feeDTO);
 
+    /**
+     * 查询应付总帐明细
+     *
+     * @param feeDTO
+     * @return
+     */
+    List<GeneralLedgerDetailExcel> financialLedgerDetailsExport(FeeDTO feeDTO);
 }

+ 99 - 35
ruoyi-warehouse/src/main/java/com/ruoyi/finance/service/impl/TFeeServiceImpl.java

@@ -21,6 +21,10 @@ 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;
+import com.ruoyi.finance.domain.dto.FeeDTO;
+import com.ruoyi.finance.domain.excel.GeneralLedgerDetailExcel;
+import com.ruoyi.finance.domain.excel.GeneralLedgerExcel;
+import com.ruoyi.finance.domain.vo.FeeVO;
 import com.ruoyi.finance.excel.Charge;
 import com.ruoyi.finance.excel.Contrast;
 import com.ruoyi.finance.excel.Detailed;
@@ -596,7 +600,7 @@ public class TFeeServiceImpl implements ITFeeService {
             if (tFee.getfAccountId() != null) {
                 TFee fee = tFeeMapper.selectTFeeById(tFee.getfAccountId());
                 fee.setfMake(0);
-                int updateTFee = tFeeMapper.updateTFee(fee);
+                tFeeMapper.updateTFee(fee);
             }
         }
         return tFeeMapper.deleteTFeeByIds(fIds);
@@ -617,7 +621,7 @@ public class TFeeServiceImpl implements ITFeeService {
     public List<Map<String, Object>> warehouseBillsFeesList(TWareHouseFees tWareHouseFees, String billsType) {
         Map<String, Object> map = new HashMap<>();
         map.put("tWareHouseFees", tWareHouseFees);
-        List<Map<String, Object>> mapList = new ArrayList<>();
+        List<Map<String, Object>> mapList;
         if (billsType.equals("DZ") || billsType.equals("KHDZ")) {
             mapList = tFeeMapper.warehouseBillsFeesListAccamount(map);
             updateBillTypeName(mapList, tWareHouseFees.getfBilltype());
@@ -628,6 +632,10 @@ public class TFeeServiceImpl implements ITFeeService {
         } else if (billsType.equals("ApplyFP")) {
             mapList = tFeeMapper.warehouseApplyFPFeesList(map);
             return mapList;
+        } else if (FeesTypeEnum.INVOICE.getType().equals(billsType)) {
+            // 查询发票
+            mapList = tFeeMapper.queryApplyInvoiceFeesList(map);
+            return mapList;
         } else {
             mapList = tFeeMapper.warehouseBillsFeesList(map);
             updateBillTypeName(mapList, tWareHouseFees.getfBilltype());
@@ -677,10 +685,9 @@ public class TFeeServiceImpl implements ITFeeService {
         }
     }
 
-
     @Override
-    public List<Map<String, Object>> warehouseBillsFeesList(TWareHouseFees tWareHouseFees) {
-        return tFeeMapper.warehouseBillsFeesList1(tWareHouseFees);
+    public List<FeeVO> warehouseBillsFeesList(TWareHouseFees tWareHouseFees) {
+        return tFeeMapper.selectFinancialLedgerList(tWareHouseFees);
     }
 
     @Override
@@ -722,11 +729,11 @@ public class TFeeServiceImpl implements ITFeeService {
             key = "warehouse.kaiHePayment.ApprovalFlow";
         }
         SysConfig sysConfig = sysConfigMapper.checkConfigKeyUnique(key);
-        if (StringUtils.isNull(sysConfig)) {
+        if (StringUtils.isNull(sysConfig) && !fBilltype.equals(FeesTypeEnum.INVOICE.getType())) {
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
             return AjaxResult.error("系统参数异常,未找到开启审批流参数");
         }
-        if ("0".equals(sysConfig.getConfigValue())) {
+        if ("0".equals(sysConfig.getConfigValue()) && !fBilltype.equals(FeesTypeEnum.INVOICE.getType())) {
             isApprove = true;
         }
         TFee tFee = JSONArray.parseObject(tfee, TFee.class);
@@ -762,8 +769,7 @@ public class TFeeServiceImpl implements ITFeeService {
             List<TFeeDo> tFeeDoList = JSONObject.parseArray(jsonDrArray.toJSONString(), TFeeDo.class);
             for (TFeeDo tFeeDo : tFeeDoList) {
                 Map<String, Object> map = this.judgeMoney(tFeeDo.getfSrcid(), tFeeDo.getfAmt(), fBilltype, tFeeDo.getfFeeid());
-                boolean b = (Boolean) map.get("flag");
-                if (b == false) {
+                if (!(Boolean) map.get("flag")) {
                     TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                     return AjaxResult.error(map.get("message").toString());
                 }
@@ -1268,10 +1274,19 @@ public class TFeeServiceImpl implements ITFeeService {
     }
 
     @Override
-    public List<Payable> payableExport(TWareHouseFees tWareHouseFees) throws Exception {
-        List<Map<String, Object>> list = tFeeMapper.warehouseBillsFeesList1(tWareHouseFees);
-        List<Payable> list1 = ListMapToBeanUtils.castMapToBean(list, Payable.class);
-        return list1;
+    public List<GeneralLedgerExcel> payableExport(TWareHouseFees tWareHouseFees) throws Exception {
+        List<GeneralLedgerExcel> ledgerExcelList = new ArrayList<>();
+        List<FeeVO> feeVOList = tFeeMapper.selectFinancialLedgerList(tWareHouseFees);
+        feeVOList.forEach(vo -> {
+            GeneralLedgerExcel ledgerExcel = new GeneralLedgerExcel();
+            ledgerExcel.setFMblno(vo.getFMblno());
+            ledgerExcel.setFAmount(vo.getFAmount());
+            ledgerExcel.setFFeesName(vo.getFFeesName());
+            ledgerExcel.setNnfinished(vo.getNnfinished());
+            ledgerExcel.setFStlamount(vo.getFStlamount());
+            ledgerExcelList.add(ledgerExcel);
+        });
+        return ledgerExcelList;
     }
 
     @Override
@@ -1291,22 +1306,19 @@ public class TFeeServiceImpl implements ITFeeService {
     @Override
     public List<Payment> paymentExport(TFee tFee) throws Exception {
         List<Map<String, Object>> list = tFeeMapper.selectFeeList(tFee);
-        List<Payment> list1 = ListMapToBeanUtils.castMapToBean(list, Payment.class);
-        return list1;
+        return ListMapToBeanUtils.castMapToBean(list, Payment.class);
     }
 
     @Override
     public List<Charge> chargeExport(TFee tFee) throws Exception {
         List<Map<String, Object>> list = tFeeMapper.selectFeeList(tFee);
-        List<Charge> list1 = ListMapToBeanUtils.castMapToBean(list, Charge.class);
-        return list1;
+        return ListMapToBeanUtils.castMapToBean(list, Charge.class);
     }
 
     @Override
     public List<Account> accountExport(TFee tFee) throws Exception {
         List<Map<String, Object>> list = tFeeMapper.webVersionTFee(tFee);
-        List<Account> accountList = ListMapToBeanUtils.castMapToBean(list, Account.class);
-        return accountList;
+        return ListMapToBeanUtils.castMapToBean(list, Account.class);
     }
 
     @Override
@@ -1333,7 +1345,7 @@ public class TFeeServiceImpl implements ITFeeService {
                     sysDictData.setStatus("0");
                     sysDictDataListIn = iSysDictDataService.selectDictDataList(sysDictData);
                 }
-                if (null != sysDictDataListIn && sysDictDataListIn.size() > 0) {
+                if (CollectionUtils.isNotEmpty(sysDictDataListIn)) {
                     tWareHouseExcelItem.setfBusinessType(sysDictDataListIn.get(0).getDictLabel());
                 }
             }
@@ -1722,6 +1734,7 @@ public class TFeeServiceImpl implements ITFeeService {
 
     /**
      * 导出财务对账数据
+     *
      * @param fId
      * @return
      */
@@ -1737,23 +1750,23 @@ public class TFeeServiceImpl implements ITFeeService {
         //查询财务主数据
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
         TFee fee = tFeeMapper.selectTFeeById(fId);
-        if (fee != null){
+        if (fee != null) {
             corpName = fee.getfCtrlcorpid();
-            if (fee.getfFromDate() != null){
+            if (fee.getfFromDate() != null) {
                 fFromDate = simpleDateFormat.format(fee.getfFromDate());
             }
-            if (fee.getfToDate() != null){
+            if (fee.getfToDate() != null) {
                 fToDate = simpleDateFormat.format(fee.getfToDate());
             }
-            if (fee.getfVslid() != null){
+            if (fee.getfVslid() != null) {
                 TVessel vessel = tVesselMapper.selectTVesselById(fee.getfVslid());
-                if (vessel != null && StringUtils.isNotEmpty(vessel.getfName())){
+                if (vessel != null && StringUtils.isNotEmpty(vessel.getfName())) {
                     shipsName = vessel.getfName();
                 }
             }
-            if (fee.getfVoyid() != null){
+            if (fee.getfVoyid() != null) {
                 TVoyage tVoyage = tVoyageMapper.selectTVoyageById(fee.getfVoyid());
-                if (tVoyage != null && StringUtils.isNotEmpty(tVoyage.getfNo())){
+                if (tVoyage != null && StringUtils.isNotEmpty(tVoyage.getfNo())) {
                     voyage = tVoyage.getfNo();
                 }
             }
@@ -1850,20 +1863,20 @@ public class TFeeServiceImpl implements ITFeeService {
         c05.setCellValue("船名航次:");
         c05.setCellStyle(contentStyle);
         HSSFCell c051 = row3.createCell(1);
-        c051.setCellValue(shipsName+voyage);
+        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 {
+        if (StringUtils.isNotEmpty(fFromDate)) {
+            if (StringUtils.isNotEmpty(fFromDate)) {
+                message = fFromDate + "-" + fToDate;
+            } else {
                 message = fFromDate;
             }
-        }else if (StringUtils.isNotEmpty(fToDate)){
+        } else if (StringUtils.isNotEmpty(fToDate)) {
             message = fToDate;
         }
         c053.setCellValue(message);
@@ -1891,7 +1904,7 @@ public class TFeeServiceImpl implements ITFeeService {
         }
         //查询费用明细数据
         List<ExportFinancial> list = tFeeMapper.exportFinancial(fId);
-        if (CollectionUtils.isNotEmpty(list)){
+        if (CollectionUtils.isNotEmpty(list)) {
             for (int i = 0; i < list.size(); i++) {
                 HSSFRow tempRow = sheet.createRow(rowNum++);
                 tempRow.setHeight((short) 500);
@@ -1960,7 +1973,7 @@ public class TFeeServiceImpl implements ITFeeService {
         HSSFCell c07 = row7.createCell(0);
         c07.setCellValue(message7);
         c07.setCellStyle(endStyle);
-        sheet.addMergedRegion(new CellRangeAddress(rowNum-1, rowNum-1, 0, 8));//标题合并单元格操作,总列数为9
+        sheet.addMergedRegion(new CellRangeAddress(rowNum - 1, rowNum - 1, 0, 8));//标题合并单元格操作,总列数为9
         //导出excel
 
         String fileName = "客户对账单.xls";
@@ -1979,6 +1992,57 @@ public class TFeeServiceImpl implements ITFeeService {
             return AjaxResult.error("导出Excel失败");
         }
     }
+
+    /**
+     * 根据结算单位、费用状态、审核日期查询应付总帐明细
+     *
+     * @param feeDTO
+     * @return
+     */
+    @Override
+    public AjaxResult financialLedgerDetails(FeeDTO feeDTO) {
+        TFees ccf = tFeesMapper.seletFeesByCCF();
+        if (Objects.isNull(ccf)) {
+            throw new WarehouseException("未找到仓储费费用信息");
+        }
+        feeDTO.setFeesId(ccf.getfId());
+        List<FeeVO> feeVOList = tFeeMapper.selectFinancialLedgerDetails(feeDTO);
+        feeVOList.forEach(vo -> {
+            WarehouseTypeEnum storageType = WarehouseTypeEnum.fromTypeAndBusinessType(vo.getfBilltype(), "storageType");
+            vo.setfBilltype(storageType.getName());
+        });
+        return AjaxResult.success(feeVOList);
+    }
+
+    /**
+     * 查询应付总帐明细
+     *
+     * @param feeDTO
+     * @return
+     */
+    @Override
+    public List<GeneralLedgerDetailExcel> financialLedgerDetailsExport(FeeDTO feeDTO) {
+        List<GeneralLedgerDetailExcel> detailExcelList = new ArrayList<>();
+        List<FeeVO> feeVOList = tFeeMapper.selectFinancialLedgerDetails(feeDTO);
+        feeVOList.forEach(vo -> {
+            GeneralLedgerDetailExcel detailExcel = new GeneralLedgerDetailExcel();
+            WarehouseTypeEnum storageType = WarehouseTypeEnum.fromTypeAndBusinessType(vo.getfBilltype(), "storageType");
+            detailExcel.setFMblno(vo.getFMblno());
+            detailExcel.setFMarks(vo.getFMarks());
+            detailExcel.setFAmount(vo.getFAmount());
+            detailExcel.setOtherFee(vo.getOtherFee());
+            detailExcel.setFFeesName(vo.getFFeesName());
+            detailExcel.setNnfinished(vo.getNnfinished());
+            detailExcel.setFStlamount(vo.getFStlamount());
+            detailExcel.setStorageFee(vo.getStorageFee());
+            detailExcel.setFBilltype(storageType.getName());
+            detailExcel.setFProductName(vo.getFProductName());
+            detailExcel.setFProductName(vo.getFProductName());
+            detailExcelList.add(detailExcel);
+        });
+        return detailExcelList;
+    }
+
     //下载路径
     private String getAbsoluteFile(String fileName) {
         String downloadPath = RuoYiConfig.getDownloadPath() + fileName;

+ 9 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/enums/FeesTypeEnum.java

@@ -33,6 +33,15 @@ public enum FeesTypeEnum {
     BOOKING("2", "凯和订舱"),
     FEE_CHANGES("10", "费用变更"),
 
+    // 类型
+    CHARGE("SF", "收费"),
+    CHARGE_REVOKE("SFRevoke", "撤销收费"),
+    CONTRAST("DZ", "对账"),
+    CONTRAST_REVOKE("DZRevoke", "撤销对账"),
+    PAYMENT("FF", "付费"),
+    PAYMENT_REVOKE("FFRevoke", "撤销付费"),
+    INVOICE("FP", "发票"),
+    INVOICE_REVOKE("FPRevoke", "撤销发票"),
 
     ;
 

+ 1 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/enums/WarehouseActIdEnum.java

@@ -34,6 +34,7 @@ public enum WarehouseActIdEnum {
     RECONCILIATION(210, "", "对账"),
     TOLL(220, "", "收费"),
     PAID(230, "", "付费"),
+    INVOICE(260, "", "发票"),
 
     //仓储计划活动号
     STORAGE_FEE(310, "", "仓储费"),

+ 2 - 2
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/enums/WarehouseTypeEnum.java

@@ -30,6 +30,8 @@ public enum WarehouseTypeEnum {
 
     HWTG("HWTG", "货物通关", "storageType"),
 
+    JSCCF("JSCCF", "计算仓储费", "storageType"),
+
     SJRK_REVOKE("SJRKRevoke", "撤销入库", "storageType"),
 
     SJCK_REVOKE("SJCKRevoke", "撤销出库", "storageType"),
@@ -40,14 +42,12 @@ public enum WarehouseTypeEnum {
 
     HQZY_REVOKE("HQZYRevoke", "撤销货权转移", "storageType"),
 
-
     //是否已计算仓储费
 
     CALCULATE("T", "已计算", "storageFee"),
 
     NOT_CALCULATE("F", "未计算", "storageFee"),
 
-    JSCCF("JSCCF", "计算仓储费", "storageFee"),
 
 
     // 状态

+ 303 - 26
ruoyi-warehouse/src/main/resources/mapper/finance/TFeeMapper.xml

@@ -49,6 +49,62 @@
         <result property="invoiceRemarks" column="invoice_remarks"/>
     </resultMap>
 
+    <resultMap type="FeeVO" id="feeVOResult">
+        <result property="fId" column="f_id"/>
+        <result property="fBillno" column="f_billno"/>
+        <result property="fCtrlcorpid" column="f_ctrlcorpid"/>
+        <result property="fActId" column="f_act_id"/>
+        <result property="fCorpid" column="f_corpid"/>
+        <result property="tMblno" column="t_mblno"/>
+        <result property="fTransActId" column="f_trans_act_id"/>
+        <result property="fAmtdr" column="f_amtdr"/>
+        <result property="fAmtcr" column="f_amtcr"/>
+        <result property="fBilltype" column="f_billtype"/>
+        <result property="fBillstatus" column="f_billstatus"/>
+        <result property="fRemarks" column="f_remarks"/>
+        <result property="fFromDate" column="f_from_date"/>
+        <result property="fToDate" column="f_to_date"/>
+        <result property="fAccbilldate" column="f_accbilldate"/>
+        <result property="fRefNo" column="f_ref_no"/>
+        <result property="delFlag" column="del_flag"/>
+        <result property="createBy" column="create_by"/>
+        <result property="fDeptid" column="f_deptid"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="chargingMethod" column="charging_method"/>
+        <result property="invoiceNo" column="invoice_no"/>
+        <result property="bank" column="bank"/>
+        <result property="waterBillNo" column="water_bill_no"/>
+        <result property="fSystemType" column="f_system_type"/>
+        <result property="fTrackingNumber" column="f_tracking_number"/>
+        <result property="fInvoiceRise" column="f_invoice_rise"/>
+        <result property="fSign" column="f_sign"/>
+        <result property="fSendTime" column="f_send_Time"/>
+        <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="invoiceRemarks" column="invoice_remarks"/>
+        <result property="fFeesName" column="f_fees_name"/>
+        <result property="fAmount" column="f_amount"/>
+        <result property="fStlamount" column="f_stlamount"/>
+        <result property="storageFee" column="storage_fee"/>
+        <result property="otherFee" column="other_fee"/>
+        <result property="fSrcpid" column="f_srcpid"/>
+        <result property="fMblno" column="f_mblno"/>
+        <result property="fMarks" column="f_marks"/>
+        <result property="fProductName" column="f_product_name"/>
+        <result property="fReviewDate" column="f_review_date"/>
+    </resultMap>
+
     <sql id="selectTFeeVo">
         select f_id,
                f_billno,
@@ -1856,33 +1912,33 @@
     </select>
     <select id="selectFeeList" resultType="java.util.Map">
         select
-        ware.create_by AS createBy,
-        ware.f_billno AS fBillno,
-        ware.f_ctrlcorpid AS fCtrlcorpid,
-        ware.create_time AS createTime,
-        ware.f_accbilldate AS fAccbilldate,
-        ware.t_mblno AS tMblno,
-        dict.dict_label AS chargingMethod,
-        ware.invoice_no AS invoiceNo,
-        ware.bank AS bank,
-        ware.water_bill_no AS waterBillNo,
-        ware.f_amtdr AS fAmtdr,
-        ware.f_amtcr AS fAmtcr,
-        ware.f_remarks AS fRemarks,
-        CASE
-        WHEN ware.f_billstatus = '1' THEN '新建'
-        WHEN ware.f_billstatus = '2' THEN '暂存'
-        WHEN ware.f_billstatus = '3' THEN '审批驳回'
-        WHEN ware.f_billstatus = '4' THEN '提交审核'
-        WHEN ware.f_billstatus = '5' THEN '审核中'
-        WHEN ware.f_billstatus = '6' THEN '审核完成'
-        END
-        AS fBillstatus
+            ware.create_by AS createBy,
+            ware.f_billno AS fBillno,
+            ware.f_ctrlcorpid AS fCtrlcorpid,
+            ware.create_time AS createTime,
+            ware.f_accbilldate AS fAccbilldate,
+            ware.t_mblno AS tMblno,
+            dict.dict_label AS chargingMethod,
+            ware.invoice_no AS invoiceNo,
+            ware.bank AS bank,
+            ware.water_bill_no AS waterBillNo,
+            ware.f_amtdr AS fAmtdr,
+            ware.f_amtcr AS fAmtcr,
+            ware.f_remarks AS fRemarks,
+            CASE
+            WHEN ware.f_billstatus = '1' THEN '新建'
+            WHEN ware.f_billstatus = '2' THEN '暂存'
+            WHEN ware.f_billstatus = '3' THEN '审批驳回'
+            WHEN ware.f_billstatus = '4' THEN '提交审核'
+            WHEN ware.f_billstatus = '5' THEN '审核中'
+            WHEN ware.f_billstatus = '6' THEN '审核完成'
+            END
+            AS fBillstatus
         from
-        t_fee ware
-        left join sys_user u on ware.create_by = u.user_name
-        left join sys_dept d on ware.f_deptid = d.dept_id
-        LEFT JOIN sys_dict_data dict ON dict.dict_value = ware.charging_method
+            t_fee ware
+            left join sys_user u on ware.create_by = u.user_name
+            left join sys_dept d on ware.f_deptid = d.dept_id
+            LEFT JOIN sys_dict_data dict ON dict.dict_value = ware.charging_method
         <where>
             dict.status = '0'
             AND dict.dict_type = 'data_settlement_type'
@@ -2330,4 +2386,225 @@
         (SELECT @rank:= 0) b
     </select>
 
+    <select id="queryApplyInvoiceFeesList" 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
+        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
+        <where>
+            dict.status = '0'
+            AND dict.dict_type = 'data_unitfees'
+            <if test="map.tWareHouseFees.stlTypeid != null">and w.f_stltypeid = #{map.tWareHouseFees.stlTypeid}</if>
+            <if test="map.tWareHouseFees.fCorpid != null  and map.tWareHouseFees.fCorpid != ''">and w.f_corpid =
+                #{map.tWareHouseFees.fCorpid}
+            </if>
+            <if test="map.tWareHouseFees.fTypeid != null ">and t.f_typeid = #{map.tWareHouseFees.fTypeid}</if>
+            <if test="map.tWareHouseFees.fTypeid == null ">and t.f_typeid IS NULL</if>
+            <if test="map.tWareHouseFees.fToCorpid != null  and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
+                #{map.tWareHouseFees.fToCorpid}
+            </if>
+            <if test="map.tWareHouseFees.fMblno != null  and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
+                concat('%', #{map.tWareHouseFees.fMblno}, '%')
+            </if>
+            <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
+                w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%')
+            </if>
+
+            <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
+                and w.f_accamount_date IS NOT NULL
+            </if>
+            <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
+                and w.f_accamount_date IS NULL
+            </if>
+
+            <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
+                and w.f_dc = #{map.tWareHouseFees.fDc}
+            </if>
+            <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
+                and w.f_dc = #{map.tWareHouseFees.fDc}
+            </if>
+            <if test="map.tWareHouseFees.fFeeid != null  and  map.tWareHouseFees.fFeeid != '' ">
+                and w.f_feeid in
+                <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")"
+                         separator=",">
+                    #{id}
+                </foreach>
+            </if>
+            <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
+                and w.f_review_date &gt;= #{map.tWareHouseFees.timeExamine[0]}
+            </if>
+            <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
+                and w.f_review_date &lt;= #{map.tWareHouseFees.timeExamine[1]}
+            </if>
+            <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
+                and w.f_bsdate &gt;= #{map.tWareHouseFees.timeInterval[0]}
+            </if>
+            <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
+                and w.f_bsdate &lt;= #{map.tWareHouseFees.timeInterval[1]}
+            </if>
+            <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
+                and w.f_accamount_date &gt;= #{map.tWareHouseFees.timeReconci[0]}
+            </if>
+            <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
+                and w.f_accamount_date &lt;= #{map.tWareHouseFees.timeReconci[1]}
+            </if>
+            <if test="map.tWareHouseFees.fBilltype != null  and map.tWareHouseFees.fBilltype == 'SJRK'">
+                and w.f_billtype = #{map.tWareHouseFees.fBilltype}
+            </if>
+            <if test="map.tWareHouseFees.fBilltype != null  and map.tWareHouseFees.fBilltype == 'SJCK'">
+                and w.f_billtype = #{map.tWareHouseFees.fBilltype}
+            </if>
+            <if test="map.tWareHouseFees.fBilltype != null  and map.tWareHouseFees.fBilltype == 'HQZY'">
+                and w.f_billtype = #{map.tWareHouseFees.fBilltype}
+            </if>
+
+            <if test="map.tWareHouseFees.fBilltype != null  and map.tWareHouseFees.fBilltype == 'KHDD'">
+                and w.f_billtype = #{map.tWareHouseFees.fBilltype}
+            </if>
+            <if test="map.tWareHouseFees.fBusinessType != null  and map.tWareHouseFees.fBusinessType != '' ">
+                and w.f_business_type in
+                <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
+                    #{id}
+                </foreach>
+            </if>
+            <if test="map.tWareHouseFees.fSrcidList != null  and  map.tWareHouseFees.fSrcidList != '' ">
+                and w.f_id in
+                <foreach collection="map.tWareHouseFees.fSrcidList" item="id" index="index" open="(" close=")"
+                         separator=",">
+                    #{id}
+                </foreach>
+            </if>
+            <if test="map.tWareHouseFees.fSrcpidList != null  and  map.tWareHouseFees.fSrcpidList != '' ">
+                and t.f_id in
+                <foreach collection="map.tWareHouseFees.fSrcpidList" item="id" index="index" open="(" close=")"
+                         separator=",">
+                    #{id}
+                </foreach>
+            </if>
+            <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
+            </if>
+            <if test='map.tWareHouseFees.createBy != null and map.tWareHouseFees.createBy != ""'>
+                and w.create_by = #{map.tWareHouseFees.createBy}
+            </if>
+            and w.f_review_date IS NOT NULL
+            and abs(IFNULL(w.f_amount, 0) - IFNULL(w.f_invamount, 0)) &gt; 0
+            GROUP BY w.f_id
+        </where>
+    </select>
+
+    <select id="selectFinancialLedgerList" resultMap="feeVOResult">
+        SELECT
+            c.f_name AS f_fees_name, w.f_corpid, w.f_mblno, w.f_billstatus,
+            SUM( w.f_amount ) AS f_amount, SUM( w.f_stlamount ) AS f_stlamount,
+            ifnull( SUM( w.f_amount ), 0 ) - ifnull( SUM( w.f_stlamount ), 0 ) AS nnfinished
+        FROM
+            t_warehousebills t
+            LEFT JOIN t_warehousebillsfees w ON w.f_pid = t.f_id
+            LEFT JOIN sys_user u ON t.create_by = u.user_name
+            LEFT JOIN sys_dept d ON t.f_bsdeptid = d.dept_id
+            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="fCorpid != null  and fCorpid != ''">and t.f_corpid = #{fCorpid}</if>
+            <if test="fToCorpid != null  and fToCorpid != ''">and w.f_corpid = #{fToCorpid}</if>
+            <if test="fMblno != null  and fMblno != ''">and w.f_mblno like concat('%', #{fMblno}, '%')</if>
+            <if test="fMarks != null and fMarks != ''">and w.f_marks like concat('%', #{fMarks}, '%')</if>
+            <if test="fProductName != null and fProductName != ''">and w.f_product_name like concat('%',
+                #{fProductName}, '%')
+            </if>
+            <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "0" '>
+                and w.f_billstatus != 6
+            </if>
+            <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "1" '>
+                and w.f_billstatus = 6
+            </if>
+            <if test='fDc != null and fDc != "" and fDc == "D" '>
+                and w.f_dc = #{fDc}
+            </if>
+            <if test='fDc != null and fDc != "" and fDc == "C" '>
+                and w.f_dc = #{fDc}
+            </if>
+            <if test='timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ""'>
+                and t.f_review_date &gt;= #{timeExamine[0]}
+            </if>
+            <if test='timeExamine != null and timeExamine[1] != null and timeExamine[1]!= ""'>
+                and t.f_review_date &lt;= #{timeExamine[1]}
+            </if>
+            <if test='fReconciliation!= null and fReconciliation != "" and fReconciliation == "0" '>
+                and ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) != 0
+            </if>
+            and w.f_review_date IS NOT NULL
+            ${params.dataScope}
+        </where>
+        GROUP BY
+            w.f_corpid,
+            w.f_dc
+    </select>
+
+    <select id="selectFinancialLedgerDetails" resultMap="feeVOResult">
+        SELECT t.f_id AS f_srcpid, c.f_name AS f_fees_name, w.f_mblno AS f_mblno,
+            w.f_product_name, w.f_marks, t.f_billtype,
+            t.f_review_date,
+            IF ( w.f_feeid = #{feesId}, w.f_amount, 0.00 ) storage_fee,
+            IF ( w.f_feeid != #{feesId}, w.f_amount, 0.00 ) other_fee,
+            w.f_amount, w.f_stlamount AS fStlamount,
+            ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS nnfinished
+        FROM t_warehousebills t
+            LEFT JOIN t_warehousebillsfees w ON w.f_pid = t.f_id
+            LEFT JOIN sys_user u ON t.create_by = u.user_name
+            LEFT JOIN sys_dept d ON t.f_bsdeptid = d.dept_id
+            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
+            w.f_dc = #{fDc}
+            <if test="fCorpId != null and fCorpId != ''">and t.f_corpid = #{fCorpId}</if>
+            <if test='fAuditList != null and fAuditList[0] != null'>
+                and t.f_review_date BETWEEN #{fAuditList[0]} and #{fAuditList[1]}
+            </if>
+            <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "0" '>
+                and w.f_billstatus != 6
+            </if>
+            <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "1" '>
+                and w.f_billstatus = 6
+            </if>
+        GROUP BY
+        w.f_id
+    </select>
+
 </mapper>

+ 10 - 0
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsfeesMapper.xml

@@ -530,6 +530,16 @@
                 f_accamount = f_accamount - #{map.tFeeDo.fAmt},
                 f_accamount_date = #{map.tFee.fAccbilldate}
             </if>
+            /*判断确认仓库发票*/
+            <if test="map.billType == 'FP'">
+                f_invnos = #{map.tFee.fBillno},
+                f_invamount = f_invamount + #{map.tFeeDo.fAmt},
+            </if>
+            /*判断撤销仓库发票*/
+            <if test="map.billType == 'FPRevoke'">
+                f_invnos = #{map.tFee.fBillno},
+                f_invamount = f_invamount - #{map.tFeeDo.fAmt},
+            </if>
         </trim>
         where f_id = #{map.tFeeDo.fSrcid}
     </update>