Pārlūkot izejas kodu

安品财务中心开发

lazhaoqian 4 gadi atpakaļ
vecāks
revīzija
5386123779

+ 145 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/anpin/FinanceCenter.java

@@ -0,0 +1,145 @@
+package com.ruoyi.web.controller.anpin;
+
+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.spring.SpringUtils;
+import com.ruoyi.finance.domain.TFee;
+import com.ruoyi.finance.domain.TWareHouseFees;
+import com.ruoyi.finance.service.ITFeeService;
+import com.ruoyi.framework.web.service.TokenService;
+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;
+
+/**
+ * 安品财务管理
+ */
+@RestController
+@RequestMapping("/anpin/financeCenter")
+public class FinanceCenter extends BaseController {
+    @Autowired
+    private ITFeeService tFeeService;
+
+    /**
+     * 查询财务数据 对账 DZ 收费 SF 付费 FF 申请发票  SQFP 销项发票 XXFP 进项发票 JXFP
+     */
+    @PreAuthorize("@ss.hasPermi('financeCenter:invoiceApplyFor:list')")
+    //@DataScope(deptAlias = "d", userAlias = "u")
+    @GetMapping("/list")
+    public TableDataInfo list(TFee tFee) {
+        startPage();
+        List<Map<String, Object>> list = tFeeService.anPinSelectTFeeList(tFee);
+        return getDataTable(list);
+    }
+
+    /**
+     * 获取财务信息信息
+     */
+    @PreAuthorize("@ss.hasPermi('financeCenter:invoiceApplyFor:query')")
+    @GetMapping(value = "/{fId}")
+    public AjaxResult getInfo(@PathVariable("fId") Long fId) {
+        return AjaxResult.success(tFeeService.selectTFeeByIdNew(fId));
+    }
+
+    /**
+     * 新增财务数据
+     *
+     * @param tFee
+     * @param tFeeDo
+     * @return
+     */
+    @PreAuthorize("@ss.hasPermi('financeCenter:invoiceApplyFor:add')")
+    @Log(title = "财务数据主", businessType = BusinessType.INSERT)
+    @PostMapping(value = "/add")
+    @RepeatSubmit
+    public AjaxResult add(@RequestParam("tFee") String tFee,
+                          @RequestParam("tFeeDo") String tFeeDo,
+                          @RequestParam(value = "tFeeInvoice",required = false) String tFeeInvoice,
+                          @RequestParam("billsType") String billsType) {
+        if (StringUtils.isEmpty(tFee)){
+            return AjaxResult.error("财务主表信息不能为空");
+        }
+        if (StringUtils.isEmpty(tFeeDo)) {
+            return AjaxResult.error("财务明细表信息不能为空");
+        }
+        if (StringUtils.isEmpty(billsType)){
+            return AjaxResult.error("单据类型不能为空");
+        }
+        // 获取当前的用户
+        LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
+        return tFeeService.insertKHTFeeTFeeDo(tFee, tFeeDo, tFeeInvoice, loginUser, billsType);
+    }
+
+    /**
+     * 财务数据
+     */
+    @PreAuthorize("@ss.hasPermi('financeCenter:invoiceApplyFor:confirm')")
+    @Log(title = "财务数据主", businessType = BusinessType.INSERT)
+    @PostMapping(value = "/confirm")
+    @RepeatSubmit
+    public AjaxResult confirm(@RequestParam("tFee") String tFee,
+                              @RequestParam("tFeeDo") String tFeeDo,
+                              @RequestParam(value = "tFeeInvoice",required = false) String tFeeInvoice,
+                              @RequestParam("billsType") String billsType) {
+        // String billsType = "ApplyFP";
+        // 获取当前的用户
+        LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
+        return tFeeService.confirmKaiHe(tFee, tFeeDo, tFeeInvoice, loginUser, billsType);
+    }
+
+    /**
+     * 删除财务数据
+     */
+    @PreAuthorize("@ss.hasPermi('financeCenter:invoiceApplyFor:remove')")
+    @Log(title = "财务数据主", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{fIds}")
+    public AjaxResult remove(@PathVariable Long[] fIds) {
+        return toAjax(tFeeService.deleteTFeeByIds(fIds));
+    }
+
+    @PreAuthorize("@ss.hasPermi('financeCenter:invoiceApplyFor:remove')")
+    @Log(title = "财务数据主", businessType = BusinessType.DELETE)
+    @DeleteMapping("/queryRemove/{fId}")
+    public AjaxResult queryRemove(@PathVariable("fId") Long fId) {
+        return tFeeService.remove(fId);
+    }
+
+    /**
+     *   撤销财务信息
+     */
+    @PreAuthorize("@ss.hasPermi('financeCenter:invoiceApplyFor:add')")
+    @Log(title = "财务数据主", businessType = BusinessType.INSERT)
+    @PostMapping(value = "/revoke")
+    @RepeatSubmit
+    public AjaxResult revoke(@RequestParam("tFee") String tFee,
+                             @RequestParam("tFeeDo") String tFeeDo,
+                             @RequestParam(value = "billsType",required = false) String billsType) {
+        if (StringUtils.isEmpty(billsType)){
+           return AjaxResult.error("请选择撤销类型");
+        }
+        // 获取当前的用户
+        LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
+        return tFeeService.revoke(tFee,tFeeDo,loginUser,billsType);
+    }
+    /**
+     * 财务信息查询
+     */
+    //@PreAuthorize("@ss.hasPermi('financeCenter:invoiceApplyFor:list')")
+    @GetMapping("/contrastList")
+    public TableDataInfo chargeList(TWareHouseFees tWareHouseFees) {
+        startPage();
+        List<Map<String, Object>> list = tFeeService.warehouseBillsFeesList(tWareHouseFees, tWareHouseFees.getfBilltype());
+        return getDataTable(list);
+    }
+
+}

+ 48 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/finance/domain/TFee.java

@@ -201,6 +201,10 @@ public class TFee extends BaseEntity {
      */
     private List<String> applyTime;
     /**
+     * 查询出入库时间区间
+     */
+    private List<String> fBsDateTime;
+    /**
      * 申请单位
      */
     private String createName;
@@ -222,6 +226,50 @@ public class TFee extends BaseEntity {
      *金额查询区间
      */
     private List<BigDecimal> amount;
+    /**
+     * 项目ID
+     */
+    private Long projectId;
+    /**
+     * 项目名称
+     */
+    private String projectName;
+    /**
+     * 出入库日期
+     */
+    private Date fBsDate;
+
+    public Date getfBsDate() {
+        return fBsDate;
+    }
+
+    public void setfBsDate(Date fBsDate) {
+        this.fBsDate = fBsDate;
+    }
+
+    public String getProjectName() {
+        return projectName;
+    }
+
+    public void setProjectName(String projectName) {
+        this.projectName = projectName;
+    }
+
+    public List<String> getfBsDateTime() {
+        return fBsDateTime;
+    }
+
+    public void setfBsDateTime(List<String> fBsDateTime) {
+        this.fBsDateTime = fBsDateTime;
+    }
+
+    public Long getProjectId() {
+        return projectId;
+    }
+
+    public void setProjectId(Long projectId) {
+        this.projectId = projectId;
+    }
 
     public Long getfAccountId() {
         return fAccountId;

+ 61 - 1
ruoyi-warehouse/src/main/java/com/ruoyi/finance/domain/TFeeDo.java

@@ -111,7 +111,7 @@ public class TFeeDo extends BaseEntity {
      */
     @Excel(name = "备注")
     private String fRemarks;
-    //币别
+    //币别/规格
     private String fCurrency;
     //汇率
     private String fExrate;
@@ -140,6 +140,66 @@ public class TFeeDo extends BaseEntity {
      * 数据是否可修改
      */
     private Integer updateMessage = 1;
+    /**
+     * 税务代码
+     */
+    private String fTaxCode;
+    /**
+     * 物料类别
+     */
+    private String fFeetype;
+    /**
+     * 业务编号
+     */
+    private String fBillno;
+    /**
+     * 项目名称
+     */
+    private String projectName;
+    /**
+     * 单价
+     */
+    private BigDecimal fUnitprice;
+
+    public String getfTaxCode() {
+        return fTaxCode;
+    }
+
+    public void setfTaxCode(String fTaxCode) {
+        this.fTaxCode = fTaxCode;
+    }
+
+    public String getfFeetype() {
+        return fFeetype;
+    }
+
+    public void setfFeetype(String fFeetype) {
+        this.fFeetype = fFeetype;
+    }
+
+    public String getfBillno() {
+        return fBillno;
+    }
+
+    public void setfBillno(String fBillno) {
+        this.fBillno = fBillno;
+    }
+
+    public String getProjectName() {
+        return projectName;
+    }
+
+    public void setProjectName(String projectName) {
+        this.projectName = projectName;
+    }
+
+    public BigDecimal getfUnitprice() {
+        return fUnitprice;
+    }
+
+    public void setfUnitprice(BigDecimal fUnitprice) {
+        this.fUnitprice = fUnitprice;
+    }
 
     public Integer getUpdateMessage() {
         return updateMessage;

+ 7 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/finance/mapper/TFeeDoMapper.java

@@ -36,6 +36,13 @@ public interface TFeeDoMapper {
     public List<TFeeDo> selectTFeeDoByfPid(@Param("fPid") Long fPid);
 
     /**
+     * 安品查询财务明细
+     * @param fPid
+     * @return
+     */
+    public List<TFeeDo> anPinSelectTFeeDoByfPid(@Param("fPid") Long fPid);
+
+    /**
      * 新增财务数据明细
      *
      * @param tFeeDo 财务数据明细

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

@@ -33,6 +33,13 @@ public interface TFeeMapper {
     public TFee selectTFeeByIdNew(Long fId);
 
     /**
+     * 安品查询财务数据
+     * @param fId
+     * @return
+     */
+    public TFee anPinSelectTFeeById(Long fId);
+
+    /**
      * 查询财务数据主列表
      *
      * @param tFee 财务数据主
@@ -43,6 +50,13 @@ public interface TFeeMapper {
     public List<Map<String, Object>> selectTFeeList1(TFee tFee);
 
     /**
+     * 安品查询财务中心
+     * @param tFee
+     * @return
+     */
+    public List<Map<String, Object>> anPinSelectTFeeList(TFee tFee);
+
+    /**
      * 凯和确认账单查询
      * @param tFee
      * @return
@@ -93,6 +107,13 @@ public interface TFeeMapper {
     //开发票查询
     public List<Map<String, Object>> warehouseInvoiceFPFeesList(@Param("map") Map<String, Object> map);
 
+    /**
+     * 安品财务中心  fBilltype 对账 DZ 收费 SF 付费 FF 申请发票   SQFP 销项发票 XXFP 进项发票 JXFP
+     * @param map
+     * @return
+     */
+    public List<Map<String, Object>> anPinFinanceCenter(@Param("map") Map<String, Object> map);
+
     public List<Map<String, Object>> warehouseBillsKHFeesListAccamount(@Param("map") Map<String, Object> map);
 
     public List<Map<String, Object>> warehouseBillsFeesList1(TWareHouseFees tWareHouseFees);

+ 19 - 9
ruoyi-warehouse/src/main/java/com/ruoyi/finance/service/impl/TFeeServiceImpl.java

@@ -234,8 +234,8 @@ public class TFeeServiceImpl implements ITFeeService {
     @Override
     public Map<String, Object> selectTFeeByIdNew(Long fId) {
         Map<String, Object> map = new HashMap<>();
-        TFee tFee = tFeeMapper.selectTFeeByIdNew(fId);
-        List<TFeeDo> feeDoList = tFeeDoMapper.selectTFeeDoByfPid(fId);
+        TFee tFee = tFeeMapper.anPinSelectTFeeById(fId);
+        List<TFeeDo> feeDoList = tFeeDoMapper.anPinSelectTFeeDoByfPid(fId);
         TFeeInvoice tFeeInvoice = new TFeeInvoice();
         tFeeInvoice.setfPid(fId);
         List<TFeeInvoice> tFeeInvoiceList = tFeeInvoiceMapper.selectTFeeInvoiceList(tFeeInvoice);
@@ -427,9 +427,9 @@ public class TFeeServiceImpl implements ITFeeService {
         Long fPid = null;
         Map<String, Object> map = new HashMap<>();
         String billStatus = "2";
-        if (fBilltype.equals("INV")){
+        /*if (fBilltype.equals("INV")){
             billStatus = "6";
-        }
+        }*/
         TFee tFee = JSONArray.parseObject(tfee, TFee.class);
         if (StringUtils.isNull(tFee.getfId())) {
             // 如果是新数据
@@ -570,8 +570,13 @@ public class TFeeServiceImpl implements ITFeeService {
         Map<String, Object> map = new HashMap<>();
         map.put("tWareHouseFees", tWareHouseFees);
         List<Map<String, Object>> mapList = new ArrayList<>();
-        if (billsType.equals("DZ") || billsType.equals("KHDZ")) {
-            mapList = tFeeMapper.warehouseBillsFeesListAccamount(map);
+        if (billsType.equals("DZ")
+                || billsType.equals("SF")
+                || billsType.equals("FF")
+                || billsType.equals("SQFP")
+                || billsType.equals("XXFP")
+                || billsType.equals("JXFP")) {
+            mapList = tFeeMapper.anPinFinanceCenter(map);
         } else if (billsType.equals("invoiceFP")) {
             mapList = tFeeMapper.warehouseInvoiceFPFeesList(map);
         } else if (billsType.equals("ApplyFP")) {
@@ -850,16 +855,16 @@ public class TFeeServiceImpl implements ITFeeService {
         } else if ("FF".equals(fBilltype)) {
             actId = 230L;
             key = "warehouse.payment.ApprovalFlow";
-        } else if ("KHDZ".equals(fBilltype)) {
+        } else if ("XXFP".equals(fBilltype)) {
             actId = 430L;
             key = "warehouse.kaiHeContrast.ApprovalFlow";
-        } else if ("KHSF".equals(fBilltype)) {
+        } else if ("JXFP".equals(fBilltype)) {
             actId = 440L;
             key = "warehouse.kaiHeCharge.ApprovalFlow";
         } else if ("KHFF".equals(fBilltype)) {
             actId = 450L;
             key = "warehouse.kaiHePayment.ApprovalFlow";
-        } else if ("ApplyFP".equals(fBilltype)) {
+        } else if ("SQFP".equals(fBilltype)) {
             actId = 470L;
             key = "warehouse.kaiHeApplyFP.ApprovalFlow";
         }
@@ -1426,6 +1431,11 @@ public class TFeeServiceImpl implements ITFeeService {
     }
 
     @Override
+    public List<Map<String, Object>> anPinSelectTFeeList(TFee tFee) {
+        return tFeeMapper.anPinSelectTFeeList(tFee);
+    }
+
+    @Override
     @Transactional
     public AjaxResult webVersionApplyFP(TFee tFee, LoginUser loginUser, String fBilltype, TFeeInvoice tFeeInvoice) {
         Long fPid = null;

+ 6 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/BillnoSerialServiceImpl.java

@@ -119,6 +119,12 @@ public class BillnoSerialServiceImpl implements IBillnoSerialService {
             billNo = "CK" + billNo;
         }else if ("XS".equals(billType)) {
             billNo = "XS" + billNo;
+        }else if ("SQFP".equals(billType)) {
+            billNo = "SQFP" + billNo;
+        }else if ("XXFP".equals(billType)) {
+            billNo = "XXFP" + billNo;
+        }else if ("JXFP".equals(billType)) {
+            billNo = "JXFP" + billNo;
         }
         return billNo;
     }

+ 67 - 0
ruoyi-warehouse/src/main/resources/mapper/finance/TFeeDoMapper.xml

@@ -208,5 +208,72 @@
         where
             f_pid = #{fPid}
     </update>
+    <select id="anPinSelectTFeeDoByfPid" parameterType="Long" resultMap="TFeeDoResult">
+        SELECT
+            td.f_id,
+            td.f_pid,
+            td.f_act_id,
+            td.f_lineno,
+            td.f_srcid,
+            td.f_srclineno,
+            td.f_srcpid,
+            td.f_srcdc,
+            CASE
+
+                WHEN td.f_srcdc = 'D' THEN
+                    '收'
+                WHEN td.f_srcdc = 'C' THEN
+                    '付'
+                END AS fSrcdcName,
+            td.f_feeid,
+            tf.f_name fFeeName,
+            tf.f_currency fCurrency,
+            tf.f_tax_code fTaxCode,
+            pro.dict_label fFeetype,
+            td.f_amtdr,
+            td.f_amt,
+            td.f_status,
+            CASE
+
+                WHEN td.f_status = '1' THEN
+                    '保存'
+                WHEN td.f_status = '2' THEN
+                    '暂存'
+                WHEN td.f_status = '3' THEN
+                    '审批驳回'
+                WHEN td.f_status = '4' THEN
+                    '提交审核'
+                WHEN td.f_status = '5' THEN
+                    '审核中'
+                WHEN td.f_status = '6' THEN
+                    '审核完成'
+                END AS fStatusName,
+            td.del_flag,
+            td.create_by,
+            td.f_amt_stl,
+            td.create_time,
+            td.f_amt_blc,
+            td.update_by,
+            td.update_time,
+            td.f_remarks,
+            tw.f_exrate fExrate,
+            tw.src_bill_no srcBillNo,
+            tw.f_mblno fMblno,
+            te.f_billtype fBilltype,
+            tw.f_statement_no accountBillno,
+            tw.f_unitprice fUnitprice,
+            tp.f_name projectName,
+            th.f_billno fBillno
+        FROM
+            t_fee_do td
+                LEFT JOIN t_fees tf ON td.f_feeid = tf.f_id
+                LEFT JOIN t_warehousebillsfees tw ON td.f_srcid = tw.f_id
+                LEFT JOIN t_warehousebills th ON td.f_srcpid = th.f_id
+                LEFT JOIN t_fee te ON te.f_id = td.f_pid
+                LEFT JOIN t_project tp ON tp.f_id = th.f_goodsid
+                LEFT JOIN sys_dict_data pro ON pro.dict_value = tf.f_feetype
+                AND pro.dict_type = 'data_cost_attribute'
+        where td.f_pid = #{fPid}
+    </select>
 
 </mapper>

+ 350 - 0
ruoyi-warehouse/src/main/resources/mapper/finance/TFeeMapper.xml

@@ -1809,4 +1809,354 @@
         <if test="fBillstatus != null and fBillstatus != '' and fBillstatus != 'null' ">and tf.f_billstatus = #{fBillstatus}</if>
         ORDER BY tf.f_id desc
     </select>
+    <select id="anPinFinanceCenter" resultType="java.util.Map">
+        SELECT
+        t.f_billno AS fBillno,
+        t.f_goodsid AS fGoodsid ,
+        tp.f_name AS projectName,
+        t.f_sbu AS fSbu,
+        tc.f_name AS fSbuName,
+        w.f_id AS fSrcid,
+        t.f_id AS fSrcpid,
+        t.f_corpid AS fCorpid,
+        c.f_name AS fName,
+        w.fName AS fFeesName,
+        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,
+        f.f_name AS fFeeName,
+        f.f_tax_code AS fTaxCode,
+        w.f_dc AS fSrcdcs,
+        CASE
+
+        WHEN t.f_billtype = 'XS' THEN
+        'D'
+        WHEN t.f_billtype = 'SQ' THEN
+        'C'
+        END AS fSrcdc,
+        CASE
+
+        WHEN t.f_billtype = 'XS' THEN
+        '收'
+        WHEN t.f_billtype = 'SQ' THEN
+        '付'
+        END AS fSrcdcName,
+        <if test="map.tWareHouseFees.fBilltype != null  and map.tWareHouseFees.fBilltype != '' and map.tWareHouseFees.fBilltype == 'XXFP'">
+            ifnull( w.f_amount, 0 ) - ifnull( w.f_invamount, 0 ) AS fAmtdr,
+            ifnull( w.f_amount, 0 ) - ifnull( w.f_invamount, 0 ) AS fAmt,
+        </if>
+        <if test="map.tWareHouseFees.fBilltype != null  and map.tWareHouseFees.fBilltype != '' and map.tWareHouseFees.fBilltype == 'JXFP'">
+            ifnull( w.f_amount, 0 ) - ifnull( w.f_invamount, 0 ) AS fAmtdr,
+            ifnull( w.f_amount, 0 ) - ifnull( w.f_invamount, 0 ) AS fAmt,
+        </if>
+        dict.dict_label AS fFeeunitid,
+        w.f_qty AS fQty,
+        w.f_unitprice AS fUnitprice,
+        w.f_currency AS fCurreny,
+        w.f_taxrate AS fTaxrate,
+        w.remark AS remark,
+        w.create_time createTime,
+        CASE
+
+        WHEN t.f_billstatus = '1' THEN
+        '新建'
+        WHEN t.f_billstatus = '2' THEN
+        '暂存'
+        WHEN t.f_billstatus = '3' THEN
+        '驳回'
+        WHEN t.f_billstatus = '4' THEN
+        '提交'
+        WHEN t.f_billstatus = '5' THEN
+        '审批中'
+        WHEN t.f_billstatus = '6' THEN
+        '审批通过'
+        END AS fBillstatus
+        FROM
+        t_warehousebills t
+        LEFT JOIN t_corps c ON c.f_id = t.f_corpid
+        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,
+        f.create_time
+        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 dict ON dict.dict_value = w.f_feeUnitid
+        AND dict.dict_type = 'data_unitfees'
+        AND dict.STATUS = '0'
+        LEFT JOIN t_project tp ON tp.f_id = t.f_goodsid
+        LEFT JOIN t_corps AS tc ON tc.f_id = t.f_sbu
+        <where>
+            <if test="map.tWareHouseFees.fCorpid != null  and map.tWareHouseFees.fCorpid != ''">and t.f_corpid =
+                #{map.tWareHouseFees.fCorpid}
+            </if>
+            <if test="map.tWareHouseFees.fToCorpid != null  and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
+                #{map.tWareHouseFees.fToCorpid}
+            </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.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 t.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 t.f_review_date &lt;= #{map.tWareHouseFees.timeExamine[1]}
+            </if>
+            <if test='map.tWareHouseFees.createTimeList != null and map.tWareHouseFees.createTimeList[0] != null and map.tWareHouseFees.createTimeList[0]!= ""'>
+                and w.create_time &gt;= #{map.tWareHouseFees.createTimeList[0]}
+            </if>
+            <if test='map.tWareHouseFees.createTimeList != null and map.tWareHouseFees.createTimeList[1] != null and map.tWareHouseFees.createTimeList[1]!= ""'>
+                and w.create_time &lt;= #{map.tWareHouseFees.createTimeList[1]}
+            </if>
+            <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
+                and t.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 t.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.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.fName != null and map.tWareHouseFees.fName != ''">and c.f_name = like
+                concat('%', #{map.tWareHouseFees.fName}, '%')
+            </if>
+            <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
+            </if>
+            <if test="map.tWareHouseFees.fBilltype != null  and map.tWareHouseFees.fBilltype != '' and map.tWareHouseFees.fBilltype == 'XXFP'">
+                and ifnull(w.f_amount, 0) - ifnull(w.f_invamount, 0) > 0
+                and t.f_billtype = 'XS'
+            </if>
+            <if test="map.tWareHouseFees.fBilltype != null  and map.tWareHouseFees.fBilltype != '' and map.tWareHouseFees.fBilltype == 'JXFP'">
+                and ifnull(w.f_amount, 0) - ifnull(w.f_invamount, 0) > 0
+                and t.f_billtype = 'SQ'
+            </if>
+            <if test="map.tWareHouseFees.fBillstatus != null  and map.tWareHouseFees.fBillstatus != '' and map.tWareHouseFees.fBillstatus == 6 ">
+                and t.f_review_date IS NOT NULL
+            </if>
+            GROUP BY w.f_id
+        </where>
+    </select>
+    <select id="anPinSelectTFeeList" parameterType="TFee" resultType="Map">
+        SELECT
+        f.f_id AS fId,
+        f.f_billno AS fBillno,
+        f.f_ctrlcorpid AS fCtrlcorpid,
+        pro.dict_label AS chargingMethod,
+        f.invoice_no AS invoiceNo,
+        f.bank AS fBank,
+        f.water_bill_no AS waterBillNo,
+        f.f_corpid AS fCorpid,
+        c.f_name AS fCorpidName,
+        f.f_accbilldate AS fAccbilldate,
+        f.t_mblno AS tMblno,
+        f.f_amtdr AS fAmtdr,
+        f.f_amtcr AS fAmtcr,
+        f.f_billtype AS fBilltype,
+        f.f_system_type AS fSystemType,
+        CASE
+        WHEN f.f_billstatus = '1' THEN '保存'
+        WHEN f.f_billstatus = '2' THEN '暂存'
+        WHEN f.f_billstatus = '3' THEN '审批驳回'
+        WHEN f.f_billstatus = '4' THEN '提交审核'
+        WHEN f.f_billstatus = '5' THEN '审核中'
+        WHEN f.f_billstatus = '6' THEN '审核完成'
+        END
+        AS fBillstatus,
+        f.f_remarks AS fRemarks,
+        f.create_by AS createBy,
+        tp.f_name AS createName,
+        f.create_time AS createTime,
+        f.update_by AS updateBy,
+        f.update_time AS updateTime,
+        tj.f_name AS projectName
+        FROM
+        t_fee AS f
+        LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
+        left join sys_user u on f.create_by = u.user_name
+        left join sys_dept d on f.f_deptid = d.dept_id
+        LEFT JOIN t_customer_contact tc ON tc.f_tel = u.phonenumber
+        LEFT JOIN t_corps tp ON tp.f_id = tc.f_pid
+        LEFT JOIN sys_dict_data pro ON pro.dict_value = f.charging_method and pro.dict_type = 'data_settlement_type'
+        LEFT JOIN t_project tj ON f.f_act_id = tj.f_id
+        <where>
+            <if test="fId != null ">and f.f_id = #{fId}</if>
+            <if test="projectId != null ">and tj.f_id = #{projectId}</if>
+            <if test="fBillno != null  and fBillno != ''">and f.f_billno = #{fBillno}</if>
+            <if test="fCtrlcorpid != null ">and f.f_ctrlcorpid = #{fCtrlcorpid}</if>
+            <if test="fCorpid != null ">and f.f_corpid = #{fCorpid}</if>
+            <if test="tMblno != null  and tMblno != ''">and f.t_mblno = #{tMblno}</if>
+            <if test="fAmtdr != null ">and f.f_amtdr = #{fAmtdr}</if>
+            <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 f.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='fBsDateTime != null and fBsDateTime[0] != null and fBsDateTime[0]!= ""'>
+                and tw.f_bsdate &gt;= #{fBsDateTime[0]}
+            </if>
+            <if test='fBsDateTime != null and fBsDateTime[1] != null and fBsDateTime[1]!= ""'>
+                and tw.f_bsdate &lt;= #{fBsDateTime[1]}
+            </if>
+            <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
+                and f.f_accbilldate &gt;= #{timeInterval[0]}
+            </if>
+            <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
+                and f.f_accbilldate &lt;= #{timeInterval[1]}
+            </if>
+            <if test='money != null and money[0] != null and money[0]!= ""'>
+                and f.f_amtdr &gt;= #{money[0]}
+            </if>
+            <if test='money != null and money[1] != null and money[1]!= ""'>
+                and f.f_amtdr &lt;= #{money[1]}
+            </if>
+            <if test='amount != null and amount[0] != null and amount[0]!= ""'>
+                and f.f_amtdr &gt;= #{amount[0]}
+            </if>
+            <if test='amount != null and amount[1] != null and amount[1]!= ""'>
+                and f.f_amtdr &lt;= #{amount[1]}
+            </if>
+            <if test='applyTime != null and applyTime[0] != null and applyTime[0]!= ""'>
+                and f.create_time &gt;= #{applyTime[0]}
+            </if>
+            <if test='applyTime != null and applyTime[1] != null and applyTime[1]!= ""'>
+                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 = #{invoiceNo}</if>
+            <if test="bank != null ">and f.bank = #{bank}</if>
+            <if test="waterBillNo != null ">and f.water_bill_no = #{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>
+        </where>
+        ORDER BY f.f_id desc
+    </select>
+    <select id="anPinSelectTFeeById" parameterType="Long" resultMap="TFeeResult">
+        SELECT f.f_id,
+               f.f_billno,
+               f.f_ctrlcorpid,
+               f.f_corpid,
+               c.f_name     AS fCorpidName,
+               f.f_accbilldate,
+               f.t_mblno,
+               f.f_amtdr,
+               f.f_amtcr,
+               f.f_billtype,
+               f.f_system_type,
+               f.f_billstatus,
+               f.f_remarks,
+               f.create_by,
+               tp.f_name    AS createName,
+               f.create_time,
+               f.update_by,
+               f.update_time,
+               tn.f_taxrate AS fTaxrate,
+               f.charging_method,
+               f.invoice_no,
+               f.bank,
+               f.water_bill_no,
+               tj.f_name AS projectName
+        FROM t_fee AS f
+                 LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
+                 left join sys_user u on f.create_by = u.user_name
+                 left join sys_dept d on f.f_deptid = d.dept_id
+                 LEFT JOIN t_customer_contact tc ON tc.f_tel = u.phonenumber
+                 LEFT JOIN t_corps tp ON tp.f_id = tc.f_pid
+                 LEFT JOIN(SELECT ti.f_pid, ti.f_taxrate FROM t_fee_invoice ti LIMIT 1) tn ON tn.f_pid = f.f_id
+                 LEFT JOIN t_project tj ON f.f_act_id  = tj.f_id
+        where f.f_id = #{fId}
+    </select>
 </mapper>