Jelajahi Sumber

[CODE]: 财务管理

maxianghua 4 tahun lalu
induk
melakukan
3a69bcd7a9

+ 8 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/fleet/finance/FTmsaccbillsController.java

@@ -40,6 +40,7 @@ public class FTmsaccbillsController extends BaseController {
     @GetMapping("/list")
     public TableDataInfo list(FTmsaccbills fTmsaccbills)
     {
+        fTmsaccbills.setfBilltype("SFDZ");
         startPage();
         List<FTmsaccbills> list = fTmsaccbillsService.selectFTmsaccbillsList(fTmsaccbills);
         return getDataTable(list);
@@ -90,5 +91,12 @@ public class FTmsaccbillsController extends BaseController {
         return toAjax(fTmsaccbillsService.deleteFTmsaccbillsByIds(fIds));
     }
 
+    @PreAuthorize("@ss.hasPermi('finances:contrast:remove')")
+    @Log(title = "财务数据主", businessType = BusinessType.DELETE)
+    @DeleteMapping("/queryRemove/{fId}")
+    public AjaxResult queryRemove(@PathVariable("fId") Long fId) {
+        return fTmsaccbillsService.queryRemove(fId);
+    }
+
 
 }

+ 8 - 4
ruoyi-fleet/src/main/java/com/ruoyi/orderManagement/finance/mapper/FTmsaccbillsMapper.java

@@ -1,11 +1,11 @@
 package com.ruoyi.orderManagement.finance.mapper;
 
+import com.ruoyi.orderManagement.finance.domain.FTmsaccbills;
+import com.ruoyi.orderManagement.finance.domain.FTmsaccbillsFees;
+
 import java.util.List;
 import java.util.Map;
 
-import com.ruoyi.orderManagement.finance.domain.FTmsaccbills;
-import org.apache.ibatis.annotations.Param;
-
 /**
  * 财务主Mapper接口
  * 
@@ -30,6 +30,8 @@ public interface FTmsaccbillsMapper
      */
     public List<FTmsaccbills> selectFTmsaccbillsList(FTmsaccbills fTmsaccbills);
 
+    public List<Map<String, Object>> selectFTmsaccbillsMapList(FTmsaccbills fTmsaccbills);
+
     /**
      * 新增财务主
      * 
@@ -62,6 +64,8 @@ public interface FTmsaccbillsMapper
      */
     public int deleteFTmsaccbillsByIds(Long[] ids);
 
-    public List<Map<String, Object>> fTmsaccbillsListAccamount(@Param("map") Map<String, Object> map);
+    public List<Map<String, Object>> fTmsaccbillsListAccamount(FTmsaccbillsFees fTmsaccbillsFees);
+
+    public List<Map<String, Object>> fTmsaccbillsList(FTmsaccbillsFees fTmsaccbillsFees);
 
 }

+ 7 - 4
ruoyi-fleet/src/main/java/com/ruoyi/orderManagement/finance/service/IFTmsaccbillsService.java

@@ -1,14 +1,13 @@
 package com.ruoyi.orderManagement.finance.service;
 
-import java.util.List;
-import java.util.Map;
-
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.model.LoginUser;
-import com.ruoyi.finance.domain.TWareHouseFees;
 import com.ruoyi.orderManagement.finance.domain.FTmsaccbills;
 import com.ruoyi.orderManagement.finance.domain.FTmsaccbillsFees;
 
+import java.util.List;
+import java.util.Map;
+
 
 /**
  * 财务主Service接口
@@ -36,6 +35,8 @@ public interface IFTmsaccbillsService
      */
     public List<FTmsaccbills> selectFTmsaccbillsList(FTmsaccbills fTmsaccbills);
 
+    public List<Map<String, Object>> selectFTmsaccbillsMapList(FTmsaccbills fTmsaccbills);
+
     /**
      * 新增财务主
      * 
@@ -71,4 +72,6 @@ public interface IFTmsaccbillsService
     public List<Map<String, Object>> fTmsaccbillsList(FTmsaccbillsFees fTmsaccbillsFees, String billsType);
 
     public AjaxResult insertTFeeTFeeDo(String tfee, String tfeeDo , LoginUser loginUser, String fBilltype);
+
+    public AjaxResult queryRemove(Long fId);
 }

+ 47 - 24
ruoyi-fleet/src/main/java/com/ruoyi/orderManagement/finance/service/impl/FTmsaccbillsServiceImpl.java

@@ -1,7 +1,5 @@
 package com.ruoyi.orderManagement.finance.service.impl;
 
-import java.util.*;
-
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.ruoyi.basicData.domain.TCorps;
@@ -29,6 +27,8 @@ import com.ruoyi.warehouseBusiness.service.impl.BillnoSerialServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.*;
+
 
 /**
  * 财务主Service业务层处理
@@ -83,12 +83,10 @@ public class FTmsaccbillsServiceImpl implements IFTmsaccbillsService
         List<Long> corpsId = new ArrayList<>();
         // 费用
         List<Long> feesId = new ArrayList<>();
-
         FTmsaccbills fTmsaccbills = fTmsaccbillsMapper.selectFTmsaccbillsById(fId);
         if (StringUtils.isNotNull(fTmsaccbills.getCorpId())) {
             corpsId.add(fTmsaccbills.getCorpId());
         }
-
         // 查询从表数据
         FTmsaccbillsitems fTmsaccbillsitems = new FTmsaccbillsitems();
         fTmsaccbillsitems.setSrcId(fId);
@@ -97,9 +95,9 @@ public class FTmsaccbillsServiceImpl implements IFTmsaccbillsService
         if (StringUtils.isNotEmpty(fTmsaccbillsitemsList)) {
             for (FTmsaccbillsitems  fees : fTmsaccbillsitemsList) {
                 Map<String, Object> map1 = new HashMap<>();
-                // 主表数据  cars --> bills
-                Ftmsorderbillsfees ftmsorderbillsfees = ftmsorderbillsfeesMapper.selectFTmsorderbillsfeesById(fees.getfSrcid());
+                // 主表数
                 Ftmsorderbills ftmsorderbills = ftmsorderbillsMapper.selectftmsorderbillsById(fees.getfSrcpid());
+                Ftmsorderbillsfees ftmsorderbillsfees = ftmsorderbillsfeesMapper.selectFTmsorderbillsfeesById(fees.getfSrcid());
                 TFees tFees= tFeesMapper.selectTFeesById(ftmsorderbillsfees.getfFeeid());
                 // 字典宝
                 SysDictData sysDictData =new SysDictData();
@@ -108,22 +106,30 @@ public class FTmsaccbillsServiceImpl implements IFTmsaccbillsService
                 sysDictData.setStatus("0");
                 List<SysDictData> sysDictDataList = iSysDictDataService.selectDictDataList(sysDictData);
 
-
-                map1.put("fSrcid",fees.getfSrcid());
-                map1.put("fSrcpid",fees.getfSrcpid());
-                map1.put("fMblno",ftmsorderbills.getMblno());
-                map1.put("fFeeName",tFees.getfName());
-                map1.put("fSrcdc",fees.getDc());
-                map1.put("fFeeunitid",sysDictDataList.get(0).getDictLabel());
-                map1.put("fQty",ftmsorderbillsfees.getfQty()); // 费用表的金额
-                map1.put("amtOrg",fees.getAmtOrg());
-                map1.put("amtStl",fees.getAmtStl());
-
-
+                map1.put("fSrcpid",fees.getfSrcpid());  //  主表ID
+                map1.put("fName",ftmsorderbills.getCorpId());//  客户
+                corpsId.add(ftmsorderbills.getCorpId());
+                map1.put("fSrcid",fees.getfSrcid()); // 费用ID
+                map1.put("fFeesName",ftmsorderbillsfees.getfCorpid());// 结算单位
+                corpsId.add(ftmsorderbillsfees.getfCorpid());
+                map1.put("fMblno",ftmsorderbills.getMblno()); //提单号
+                map1.put("fProductName",ftmsorderbillsfees.getfProductName()); //提单号
+                map1.put("createTime",ftmsorderbillsfees.getCreateTime()); //业务日期
+                map1.put("actId",ftmsorderbillsfees.getActId()); // 业务类型
+                map1.put("billType",ftmsorderbills.getBillType()); // 作业类型
+                map1.put("fFeeName",tFees.getfName()); // 作业类型
+                feesId.add(ftmsorderbillsfees.getfFeeunitid());
+                map1.put("fSrcdc",fees.getDc()); // 收付
+                map1.put("fAmt",fees.getAmtOrg()); // 数量
+                map1.put("fAmtdr",fees.getAmtCur()); // 金额
+                map1.put("fQty",ftmsorderbillsfees.getfQty()); // 数量
+                map1.put("fAmount",fees.getAmtOrg()); // 金额
+                map1.put("fFeeunitid",sysDictDataList.get(0).getDictLabel()); //计价单位
+                map1.put("loadDate",ftmsorderbills.getLoadDate()); // 计费开始日期
+                map1.put("unLoadDate",ftmsorderbills.getUnLoadDate()); //计费截止日期
                 feeDoList.add(map1);
             }
         }
-
         List<TCorps> corpsList = new ArrayList<>();
         List<Long> corpsIdList = StringUtils.integerDeduplication(corpsId);
         for (Long corpId : corpsIdList) {
@@ -159,6 +165,11 @@ public class FTmsaccbillsServiceImpl implements IFTmsaccbillsService
         return fTmsaccbillsMapper.selectFTmsaccbillsList(fTmsaccbills);
     }
 
+    @Override
+    public List<Map<String, Object>> selectFTmsaccbillsMapList(FTmsaccbills fTmsaccbills) {
+        return fTmsaccbillsMapper.selectFTmsaccbillsMapList(fTmsaccbills);
+    }
+
     /**
      * 新增财务主
      * 
@@ -211,14 +222,11 @@ public class FTmsaccbillsServiceImpl implements IFTmsaccbillsService
 
     @Override
     public List<Map<String, Object>> fTmsaccbillsList(FTmsaccbillsFees fTmsaccbillsFees, String billsType) {
-        List<Map<String, Object>> maps =new ArrayList<Map<String, Object>>();
-        Map<String, Object> map = new HashMap<>();
-        map.put("tWareHouseFees", fTmsaccbillsFees);
         List<Map<String, Object>> mapList =new ArrayList<>();
         if(billsType.equals("DZ")){
-            mapList = fTmsaccbillsMapper.fTmsaccbillsListAccamount(map);
+            mapList = fTmsaccbillsMapper.fTmsaccbillsListAccamount(fTmsaccbillsFees);
         } else{
-           // mapList = fTmsaccbillsMapper.warehouseBillsFeesList(map);
+            mapList = fTmsaccbillsMapper.fTmsaccbillsList(fTmsaccbillsFees);
         }
         return mapList;
     }
@@ -261,4 +269,19 @@ public class FTmsaccbillsServiceImpl implements IFTmsaccbillsService
         map.put("tFee", fTmsaccbills);
         return AjaxResult.success("成功", map);
     }
+
+    @Override
+    public AjaxResult queryRemove(Long fId) {
+        FTmsaccbills tFee=fTmsaccbillsMapper.selectFTmsaccbillsById(fId);
+        FTmsaccbillsitems tFeeDo = new FTmsaccbillsitems();
+        tFeeDo.setSrcId(tFee.getId());
+        List<FTmsaccbillsitems> tFeeDoList=  fTmsaccbillsitemsMapper.selectFTmsaccbillsitemsList(tFeeDo);
+        if( StringUtils.isNull(tFee)){
+            return AjaxResult.success("0");
+        } else if(StringUtils.isNotNull(tFee) && StringUtils.isEmpty(tFeeDoList) ){
+            return AjaxResult.success("1");
+        } else {
+            return AjaxResult.success("2");
+        }
+    }
 }

+ 3 - 3
ruoyi-fleet/src/main/java/com/ruoyi/statusTracking/service/impl/FtmsorderbillsfeesServiceImpl.java

@@ -1,7 +1,5 @@
 package com.ruoyi.statusTracking.service.impl;
 
-import java.util.*;
-
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.ruoyi.basicData.domain.TCorps;
@@ -28,6 +26,8 @@ import com.ruoyi.system.mapper.SysUserMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.*;
+
 /**
  * 订单费用Service业务层处理
  *
@@ -162,7 +162,7 @@ public class FtmsorderbillsfeesServiceImpl implements IftmsorderbillsfeesService
             fTmsorderbillsfeesMapper.deleteFTmsorderbillsfeesByPIdAndActId(id);
             for (Ftmsorderbillsfees ftmsorderbillsfees : ftmsorderbillsfeesList) {
                 // 只处理新追加的数据
-                if(null!=ftmsorderbillsfees.getActId() &&  ftmsorderbillsfees.getActId()==1080 ){
+                if(null!=ftmsorderbillsfees.getActId() &&  ftmsorderbillsfees.getActId()==1090 ){
                     ftmsorderbillsfees.setOrgId(ftmsorderbillsfees.getfPid());
                     ftmsorderbillsfees.setCreateBy(SecurityUtils.getUsername());
                     ftmsorderbillsfees.setCreateTime(new Date());

+ 202 - 108
ruoyi-fleet/src/main/resources/mapper/finance/FTmsaccbillsMapper.xml

@@ -153,148 +153,242 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="fTmsaccbillsListAccamount" resultType="java.util.Map">
         SELECT
-            w.f_id AS fSrcid,
             t.id AS fSrcpid,
-            t.corp_id AS fCorpid,
-            c.f_name AS fName,
-            w.fName AS fFeesName,
+            c1.f_name AS  fName,
+            w.f_id AS fSrcid,
+            c.f_name AS fFeesName,
             w.f_mblno AS fMblno,
             w.f_product_name AS fProductName,
-            w.f_bsdate AS fBsdate,
-            t.bill_type AS fBilltype,
-            w.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,
+            w.create_time AS createTime,
+            w.act_id AS actId,
+            dict.dict_label  AS billType,
             ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmtdr,
             ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmt,
+            f.f_name  AS fFeeName,
+            w.f_dc AS fSrcdc,
             w.f_qty AS fQty,
-            w.f_unitprice AS fUnitprice
+            w.f_unitprice AS fUnitprice,
+            w.f_amount AS  fAmount,
+            w.f_feeUnitid AS fFeeUnitid,
+            t.load_date AS loadDate,
+            t.un_load_date AS unLoadDate
         FROM
-            f_tmsorderbills t
-            LEFT JOIN t_corps c ON c.f_id = t.corp_id
-            LEFT JOIN f_tmsorderbillscars car ON car.p_id = t.id
-            LEFT JOIN (
-                SELECT
-                f.f_id,
-                f.f_pid,
-                f.act_id,
-                f.org_id,
-                f.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_review_date,
-                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_status,
-                f.del_flag,
-                f.create_by,
-                f.update_by,
-                f.create_time,
-                f.update_time,
-                f.remark,
-                f.src_id,
-                f.src_bill_no,
-                f.f_mblno,
-                f.f_product_name,
-                f.f_marks,
-                f.f_chargedate,
-                f.f_billing_deadline,
-                f.f_inventory_days,
-                f.f_amt,
-                f.f_billing_days,
-                f.f_billing_qty,
-                f.f_billtype,
-                f.f_billingway,
-                f.f_bsdate,
-                f.f_originalbilldate,
-                f.f_stltypeid,
-                f.remarks,
-                c.f_id AS fId,
-                c.f_name AS fName
-                FROM
-                f_tmsorderbillsfees AS f
-                LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
-                ) w ON w.f_pid = car.id
+            f_tmsorderbillsfees w
             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
+            LEFT JOIN t_corps AS c ON w.f_corpid = c.f_id
+            LEFT JOIN f_tmsorderbills AS t ON w.org_id = t.id
+            LEFT JOIN t_corps AS c1 ON t.corp_id = c1.f_id
+            LEFT JOIN sys_dict_data dict ON dict.dict_value = t.bill_type
         <where>
             dict.status = '0'
-            AND dict.dict_type = 'data_unitfees'
-            <if test="map.tWareHouseFees.fCorpid != null  and map.tWareHouseFees.fCorpid != ''">and t.corp_id = #{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.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>
+            AND dict.dict_type = 'data_billType'
+            <if test="fCorpid != null  and fCorpid != ''">and t.corp_id = #{ 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="fStatementNo != null and fStatementNo != ''">and w.f_statement_no  like concat('%', #{ fStatementNo}, '%') </if>
 
-            <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
+            <if test='fReconciliation != null and fReconciliation != "" and 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" '>
+            <if test=' fReconciliation != null and  fReconciliation != "" and  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 test=' fDc != null and  fDc != "" and  fDc == "D" '>
+                and w.f_dc = #{ 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 test=' fDc != null and  fDc != "" and  fDc == "C" '>
+                and w.f_dc = #{ fDc}
             </if>
-            <if test="map.tWareHouseFees.fFeeid != null  and  map.tWareHouseFees.fFeeid != '' ">
+            <if test=" fFeeid != null  and   fFeeid != '' ">
                 and  w.f_feeid in
-                <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")" separator=",">
+                <foreach collection=" 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 test=' timeExamine != null and  timeExamine[0] != null and  timeExamine[0]!= ""'>
+                and w.f_review_date &gt;= #{ 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 test=' timeExamine != null and  timeExamine[1] != null and  timeExamine[1]!= ""'>
+                and w.f_review_date &lt;= #{ timeExamine[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 test=' timeInterval != null and  timeInterval[0] != null and  timeInterval[0]!= ""'>
+                and t.f_bsdate &gt;= #{ 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 test=' timeInterval != null and  timeInterval[1] != null and  timeInterval[1]!= ""'>
+                and t.f_bsdate &lt;= #{ 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 test=' timeReconci != null and  timeReconci[0] != null and  timeReconci[0]!= ""'>
+                and w.f_accamount_date &gt;= #{ 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 test=' timeReconci != null and  timeReconci[1] != null and  timeReconci[1]!= ""'>
+                and w.f_accamount_date &lt;= #{ timeReconci[1]}
             </if>
-            <if test="map.tWareHouseFees.fBusinessType != null  and map.tWareHouseFees.fBusinessType != '' ">
+            <if test=" fBusinessType != null  and  fBusinessType != '' ">
                 and  w.f_business_type in
-                <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
+                <foreach collection=" fBusinessType" item="id" open="(" close=")" separator=",">
                     #{id}
                 </foreach>
             </if>
-            and  w.f_review_date IS NOT NULL
             and  ifnull(w.f_amount, 0) - ifnull(w.f_accamount, 0) != 0
             GROUP BY  w.f_id
         </where>
     </select>
+
+    <select id="fTmsaccbillsList" resultType="java.util.Map">
+        SELECT
+        w.f_id AS fSrcid,
+        t.id AS fSrcpid,
+        t.corp_id AS fCorpid,
+        c.f_name AS fName,
+        w.fName AS fFeesName,
+        w.f_mblno AS fMblno,
+        w.f_product_name AS fProductName,
+        w.f_bsdate AS fBsdate,
+        t.bill_type AS fBilltype,
+        w.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,
+        f.f_name AS fFeeName,
+        w.f_dc AS fSrcdc,
+        ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmtdr,
+        ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmt,
+        w.f_qty AS fQty,
+        w.f_unitprice AS fUnitprice
+        FROM
+        f_tmsorderbills t
+        LEFT JOIN t_corps c ON c.f_id = t.corp_id
+        LEFT JOIN f_tmsorderbillscars car ON car.p_id = t.id
+        LEFT JOIN (
+        SELECT
+        f.f_id,
+        f.f_pid,
+        f.act_id,
+        f.org_id,
+        f.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_review_date,
+        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_status,
+        f.del_flag,
+        f.create_by,
+        f.update_by,
+        f.create_time,
+        f.update_time,
+        f.remark,
+        f.src_id,
+        f.src_bill_no,
+        f.f_mblno,
+        f.f_product_name,
+        f.f_marks,
+        f.f_chargedate,
+        f.f_billing_deadline,
+        f.f_inventory_days,
+        f.f_amt,
+        f.f_billing_days,
+        f.f_billing_qty,
+        f.f_billtype,
+        f.f_billingway,
+        f.f_bsdate,
+        f.f_originalbilldate,
+        f.f_stltypeid,
+        f.remarks,
+        c.f_id AS fId,
+        c.f_name AS fName
+        FROM
+        f_tmsorderbillsfees AS f
+        LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
+        ) w ON w.f_pid = car.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
+        <where>
+            dict.status = '0'
+            AND dict.dict_type = 'data_unitfees'
+            <if test=" fCorpid != null  and  fCorpid != ''">and t.corp_id = #{ 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=" fStatementNo != null and  fStatementNo != ''">and w.f_statement_no  like concat('%', #{ fStatementNo}, '%') </if>
+
+            <if test=' fReconciliation != null and  fReconciliation != "" and  fReconciliation == "1" '>
+                and w.f_accamount_date IS NOT NULL
+            </if>
+            <if test=' fReconciliation != null and  fReconciliation != "" and  fReconciliation == "0" '>
+                and w.f_accamount_date IS  NULL
+            </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=" fFeeid != null  and   fFeeid != '' ">
+                and  w.f_feeid in
+                <foreach collection=" fFeeid" item="id" index="index" open="(" close=")" separator=",">
+                    #{id}
+                </foreach>
+            </if>
+            <if test=' timeExamine != null and  timeExamine[0] != null and  timeExamine[0]!= ""'>
+                and w.f_review_date &gt;= #{ timeExamine[0]}
+            </if>
+            <if test=' timeExamine != null and  timeExamine[1] != null and  timeExamine[1]!= ""'>
+                and w.f_review_date &lt;= #{ timeExamine[1]}
+            </if>
+            <if test=' timeInterval != null and  timeInterval[0] != null and  timeInterval[0]!= ""'>
+                and t.f_bsdate &gt;= #{ timeInterval[0]}
+            </if>
+            <if test=' timeInterval != null and  timeInterval[1] != null and  timeInterval[1]!= ""'>
+                and t.f_bsdate &lt;= #{ timeInterval[1]}
+            </if>
+            <if test=' timeReconci != null and  timeReconci[0] != null and  timeReconci[0]!= ""'>
+                and w.f_stlamount_date &gt;= #{ timeReconci[0]}
+            </if>
+            <if test=' timeReconci != null and  timeReconci[1] != null and  timeReconci[1]!= ""'>
+                and w.f_stlamount_date &lt;= #{ timeReconci[1]}
+            </if>
+            and  w.f_review_date IS NOT NULL
+            and  ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) != 0
+            GROUP BY  w.f_id
+        </where>
+    </select>
+    <select id="selectFTmsaccbillsMapList" resultType="java.util.Map">
+
+        <where>
+            <if test="accYear != null "> and acc_year = #{accYear}</if>
+            <if test="accMonth != null "> and acc_month = #{accMonth}</if>
+            <if test="actId != null "> and act_id = #{actId}</if>
+            <if test="billNo != null  and billNo != ''"> and bill_no = #{billNo}</if>
+            <if test="corpId != null "> and corp_id = #{corpId}</if>
+            <if test="transactId != null "> and transact_id = #{transactId}</if>
+            <if test="fromDate != null "> and from_date = #{fromDate}</if>
+            <if test="toDate != null "> and to_date = #{toDate}</if>
+            <if test="amt != null "> and amt = #{amt}</if>
+            <if test="refNo != null  and refNo != ''"> and ref_no = #{refNo}</if>
+            <if test="postDate != null "> and post_date = #{postDate}</if>
+            <if test="billStatus != null "> and bill_status = #{billStatus}</if>
+            <if test="remarks != null  and remarks != ''"> and remarks = #{remarks}</if>
+        </where>
+    </select>
 </mapper>