Browse Source

[CODE]: 财务查询费用明细

maxianghua 4 years ago
parent
commit
88f3503422

+ 2 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/finance/TChargeController.java

@@ -116,7 +116,8 @@ public class TChargeController extends BaseController {
     public TableDataInfo chargeList(TWareHouseFees tWareHouseFees) {
         tWareHouseFees.setfDc("D");
         startPage();
-        List<Map<String, Object>> list = tFeeService.warehouseBillsFeesList(tWareHouseFees);
+        String billsType = "SF";
+        List<Map<String, Object>> list = tFeeService.warehouseBillsFeesList(tWareHouseFees,billsType);
         return getDataTable(list);
     }
 

+ 2 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/finance/TContrastController.java

@@ -115,7 +115,8 @@ public class TContrastController extends BaseController {
     @GetMapping("/contrastList")
     public TableDataInfo chargeList(TWareHouseFees tWareHouseFees) {
         startPage();
-        List<Map<String, Object>> list = tFeeService.warehouseBillsFeesList(tWareHouseFees);
+        String billsType = "DZ";
+        List<Map<String, Object>> list = tFeeService.warehouseBillsFeesList(tWareHouseFees,billsType);
         return getDataTable(list);
     }
 

+ 2 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/finance/TPaymentController.java

@@ -116,7 +116,8 @@ public class TPaymentController extends BaseController {
     public TableDataInfo chargeList(TWareHouseFees tWareHouseFees) {
         tWareHouseFees.setfDc("C");
         startPage();
-        List<Map<String, Object>> list = tFeeService.warehouseBillsFeesList(tWareHouseFees);
+        String billsType = "FF";
+        List<Map<String, Object>> list = tFeeService.warehouseBillsFeesList(tWareHouseFees,billsType);
         return getDataTable(list);
     }
 

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

@@ -68,4 +68,6 @@ public interface TFeeMapper {
      * @return
      */
     public List<Map<String, Object>> warehouseBillsFeesList(@Param("map") Map<String, Object> map);
+
+    public List<Map<String, Object>> warehouseBillsFeesListAccamount(@Param("map") Map<String, Object> map);
 }

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

@@ -77,11 +77,11 @@ public interface ITFeeService {
     public int deleteTFeeById(Long fId);
 
     /**
-     *   对账、收费
+     *   对账、收费、付费
      * @param tWareHouseFees
      * @return
      */
-    public List<Map<String, Object>> warehouseBillsFeesList(TWareHouseFees tWareHouseFees);
+    public List<Map<String, Object>> warehouseBillsFeesList(TWareHouseFees tWareHouseFees,String billsType);
 
     /**
      *  财务: 对账、收费、付费   流程确认

+ 7 - 23
ruoyi-warehouse/src/main/java/com/ruoyi/finance/service/impl/TFeeServiceImpl.java

@@ -274,33 +274,17 @@ public class TFeeServiceImpl implements ITFeeService {
     }
 
     @Override
-    public List<Map<String, Object>> warehouseBillsFeesList(TWareHouseFees tWareHouseFees) {
+    public List<Map<String, Object>> warehouseBillsFeesList(TWareHouseFees tWareHouseFees,String billsType) {
         List<Map<String, Object>> maps =new ArrayList<Map<String, Object>>();
         Map<String, Object> map = new HashMap<>();
         map.put("tWareHouseFees", tWareHouseFees);
-        List<Map<String, Object>> mapList = tFeeMapper.warehouseBillsFeesList(map);
-        if (mapList != null && mapList.size() > 0) {
-            String fAmtdr = null; // 金额
-            String fAmt = null; // 结算
-            for (Map<String, Object> m : mapList) {
-                for (String k : m.keySet()) {
-                    if (k.equals("fAmtdr")) {
-                        fAmtdr = m.get(k).toString();
-                    }
-                    if (k.equals("fAmt")) {
-                        fAmt = m.get(k).toString();
-                    }
-                }
-                BigDecimal result = calculation1(fAmtdr, fAmt);
-                m.put("fAmtdr",result);
-                m.put("fAmt",result);
-                maps.add(m);/*if(result.compareTo(BigDecimal.ZERO) > 0) {
-                    maps.add(m);
-                }*/
-
-            }
+        List<Map<String, Object>> mapList =new ArrayList<>();
+        if(billsType.equals("DZ")){
+            mapList = tFeeMapper.warehouseBillsFeesListAccamount(map);
+        } else{
+            mapList = tFeeMapper.warehouseBillsFeesList(map);
         }
-        return maps;
+        return mapList;
     }
 
     public static BigDecimal calculation1(String fTotalgross, String fGrossweightblc) {

+ 106 - 2
ruoyi-warehouse/src/main/resources/mapper/finance/TFeeMapper.xml

@@ -177,11 +177,11 @@
         t.f_bsdate AS fBsdate,
         t.f_billtype AS fBilltype,
         t.f_review_date AS fReviewDate,
-        w.f_amount AS fAmtdr,
         w.f_feeid AS fFeeid,
         f.f_name AS fFeeName,
         w.f_dc AS fSrcdc,
-        w.f_stlamount AS fAmt
+        ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) AS fAmtdr,
+        ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) AS fAmt
         FROM
         t_warehousebills t
         LEFT JOIN t_corps c ON c.f_id = t.f_corpid
@@ -262,8 +262,112 @@
             <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>
+            and  t.f_review_date IS NOT NULL
+            and  ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) > 0
+        </where>
+    </select>
 
+    <select id="warehouseBillsFeesListAccamount" resultType="java.util.Map">
+        SELECT
+        w.f_id AS  fSrcid,
+        t.f_id AS  fSrcpid,
+        t.f_corpid AS fCorpid,
+        c.f_name AS fName,
+        w.fId AS fId,
+        w.fName AS fFeesName,
+        t.f_bscorpno AS fBscorpno,
+        t.f_mblno AS fMblno,
+        t.f_product_name AS fProductName,
+        t.f_bsdate AS fBsdate,
+        t.f_billtype AS fBilltype,
+        t.f_review_date AS fReviewDate,
+        w.f_feeid AS fFeeid,
+        f.f_name AS fFeeName,
+        w.f_dc AS fSrcdc,
+        ifnull(w.f_amount, 0) - ifnull(w.f_accamount, 0) AS fAmtdr,
+        ifnull(w.f_amount, 0) - ifnull(w.f_accamount, 0) AS fAmt
+        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_status,
+        f.remark,
+        c.f_id AS fId,
+        c.f_name AS fName
+        FROM
+        t_warehousebillsfees AS f
+        LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
+        ) w ON w.f_pid = t.f_id
+        LEFT JOIN t_fees f ON w.f_feeid = f.f_id
+        <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.fMblno != null  and map.tWareHouseFees.fMblno != ''">and t.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.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>
             and  t.f_review_date IS NOT NULL
+            and  ifnull(w.f_amount, 0) - ifnull(w.f_accamount, 0) > 0
         </where>
     </select>