Przeglądaj źródła

[CODE]: 利润汇总

maxianghua 4 lat temu
rodzic
commit
d404face8c

+ 54 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/reportManagement/ProfitController.java

@@ -0,0 +1,54 @@
+package com.ruoyi.web.controller.warehouse.reportManagement;
+
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.finance.domain.TWareHouseFees;
+import com.ruoyi.finance.service.ITFeeService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 利润总账Controller
+ *
+ * @author ruoyi
+ * @date 2020-12-23
+ */
+@RestController
+@RequestMapping("/warehouseBusiness/profit")
+public class ProfitController extends BaseController {
+
+    @Autowired
+    private ITFeeService tFeeService;
+
+    /**
+     * 查询应收总账列表
+     */
+    @PreAuthorize("@ss.hasPermi('warehouseBusiness:profit:list')")
+    @GetMapping("/list")
+    public TableDataInfo chargeList(TWareHouseFees tWareHouseFees) {
+        startPage();
+        List<Map<String, Object>> list = tFeeService.warehouseBillsFeesProfitList(tWareHouseFees);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出库存总账列表
+     *//*
+    @PreAuthorize("@ss.hasPermi('warehouseBusiness:receivable:export')")
+    @Log(title = "库存总账", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(TWhgenleg tWhgenleg) {
+        List<TWhgenleg> list = tWhgenlegService.selectTWhgenlegList(tWhgenleg);
+        ExcelUtil<TWhgenleg> util = new ExcelUtil<TWhgenleg>(TWhgenleg.class);
+        return util.exportExcel(list, "whgenleg");
+    }*/
+
+
+
+}

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

@@ -86,6 +86,8 @@ public interface ITFeeService {
 
     public List<Map<String, Object>> warehouseBillsFeesList(TWareHouseFees tWareHouseFees);
 
+    public List<Map<String, Object>> warehouseBillsFeesProfitList(TWareHouseFees tWareHouseFees);
+
     /**
      *  财务: 对账、收费、付费   流程确认
      * @param tfee

+ 97 - 1
ruoyi-warehouse/src/main/resources/mapper/finance/TFeeMapper.xml

@@ -650,5 +650,101 @@
             AND dict.dict_type = 'data_unitfees'
             AND w.f_pid = #{fId}
     </select>
-
+    <select id="warehouseBillsFeesProfitList" resultType="java.util.Map">
+        SELECT
+        a.*,
+        ifnull( a.fAmount, 0 ) - ifnull( a.fStlamount, 0 ) AS nnfinished
+        FROM
+        (
+        SELECT
+        t.f_id AS fSrcpid,
+        c.f_name AS fName,
+        w.fId AS fId,
+        w.fName AS fFeesName,
+        w.f_mblno AS fMblno,
+        w.f_product_name AS fProductName,
+        w.f_marks AS fMarks,
+        t.f_billtype AS fBilltype,
+        t.f_review_date AS fReviewDate,
+        SUM( w.fAmount ) AS fAmount,
+        SUM( w.fStlamount ) AS fStlamount
+        FROM
+        t_warehousebills t
+        LEFT JOIN t_corps c ON c.f_id = t.f_corpid
+        LEFT JOIN (
+        SELECT
+        a.*,
+        MAX( CASE f_dc WHEN 'D' THEN f_amount ELSE 0 END ) fAmount,
+        MAX( CASE f_dc WHEN 'C' THEN f_amount ELSE 0 END ) fStlamount
+        FROM
+        (
+        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_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,
+        f.f_mblno,
+        f.f_product_name,
+        f.f_marks,
+        c.f_id AS fId,
+        c.f_name AS fName,
+        sum( f.f_amount ) AS f_amount
+        FROM
+        t_warehousebillsfees AS f
+        LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
+        GROUP BY
+        f.f_mblno,
+        f.f_dc
+        ) AS a
+        GROUP BY
+        f_mblno
+        ) w ON w.f_pid = t.f_id
+        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='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  t.f_review_date IS NOT NULL
+            GROUP BY
+            w.f_mblno
+        </where>
+        ) a
+    </select>
 </mapper>