Browse Source

八项成本柱状图v3.0,更改统计查询的逻辑

丁治程 1 year ago
parent
commit
5dc4ff0d52

+ 9 - 9
module_kzks/src/main/java/org/jeecg/modules/Index/controller/IndexController.java

@@ -73,7 +73,7 @@ public class IndexController {
             });
             CompletableFuture<IndexTotalVo> zceFuture = CompletableFuture.supplyAsync(() -> {
                 // 支出额
-                return indexZcbService.getZhiChuTotalList().get(0);
+                return indexZcbService.getZhiChuTotalList(request).get(0);
             });
             CompletableFuture<Void> allFutures = CompletableFuture.allOf(hteFuture, skeFuture, lreFuture, zceFuture);
             allFutures.join();
@@ -120,15 +120,15 @@ public class IndexController {
 
     @ApiOperation("领导驾驶舱---支出模块")
     @GetMapping("/getZcb")
-    public List<IndexTotalVo> getZhiChuTotalList() {
-        List<IndexTotalVo> zhiChuTotalList = indexZcbService.getZhiChuTotalList();
+    public List<IndexTotalVo> getZhiChuTotalList(HttpServletRequest request) {
+        List<IndexTotalVo> zhiChuTotalList = indexZcbService.getZhiChuTotalList(request);
         return zhiChuTotalList;
     }
 
     @ApiOperation("领导驾驶舱---支出模块下的统计")
     @GetMapping("/getEightCost")
-    public List<IndexChartInfoVo> getEightCost(IndexInfoParamDto indexInfoParamDto) {
-        List<IndexChartInfoVo> resultList = indexZcbService.getEightCostsList(indexInfoParamDto);
+    public List<EightCostChartInfoVo> getEightCost(IndexInfoParamDto indexInfoParamDto,HttpServletRequest request) {
+        List<EightCostChartInfoVo> resultList = indexZcbService.getEightCostsList(indexInfoParamDto,request);
         return resultList;
     }
 
@@ -175,15 +175,15 @@ public class IndexController {
 
     @ApiOperation("领导驾驶舱---支出模块下的八项成本排行统计")
     @GetMapping("/getSumEightCosts")
-    public List<ResultEightCost> getSumEightCosts(IndexInfoParamDto indexInfoParamDto){
-        List<ResultEightCost> sumEightCostsList = indexZcbService.getSumEightCosts(indexInfoParamDto);
+    public List<ResultEightCost> getSumEightCosts(IndexInfoParamDto indexInfoParamDto,HttpServletRequest request){
+        List<ResultEightCost> sumEightCostsList = indexZcbService.getSumEightCosts(indexInfoParamDto,request);
         return sumEightCostsList;
     }
 
     @ApiOperation("领导驾驶舱---支出模块下二级汇总")
     @GetMapping("/getEightCostsInfo")
-    public Result<List<ZhiChuCost>> getEightCostsInfo(IndexInfoParamDto indexInfoParamDto){
-        List<ZhiChuCost> list = indexZcbService.getEightCostsInfo(indexInfoParamDto);
+    public Result<List<ZhiChuCost>> getEightCostsInfo(IndexInfoParamDto indexInfoParamDto,HttpServletRequest request){
+        List<ZhiChuCost> list = indexZcbService.getEightCostsInfo(indexInfoParamDto,request);
         return Result.ok(list);
     }
 

+ 29 - 0
module_kzks/src/main/java/org/jeecg/modules/Index/entity/vo/EightCostChartInfoVo.java

@@ -0,0 +1,29 @@
+package org.jeecg.modules.Index.entity.vo;
+
+import lombok.Data;
+import org.apache.poi.ss.formula.functions.T;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * @author dzc
+ * @date 2023/10/16 15:27
+ * @package org.jeecg.modules.Index.entity.vo
+ * @project yecai_server
+ * @des 八项成本二层图表折柱混合
+ */
+@Data
+public class EightCostChartInfoVo<T> implements Serializable {
+
+    /*横坐标集合*/
+    private List<String> xAxisData;
+
+    /*总成本折线集合*/
+    private List<BigDecimal> sumZcbData;
+
+    /*纵坐标集合*/
+    private List<T> seriesData;
+
+}

+ 1 - 1
module_kzks/src/main/java/org/jeecg/modules/Index/entity/vo/ZhiChuCost.java

@@ -21,7 +21,7 @@ public class ZhiChuCost implements Serializable {
     private final static long serialVersionUID = 1L;
 
     /** 图表的集合 */
-    private List<IndexChartInfoVo> chartInfoList;
+    private List<EightCostChartInfoVo> chartInfoList;
 
     /** 排行榜的集合*/
     private List<ResultEightCost> eightCostPaiHang;

+ 46 - 111
module_kzks/src/main/java/org/jeecg/modules/Index/mapper/IndexZcbMapper.java

@@ -3,6 +3,7 @@ package org.jeecg.modules.Index.mapper;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.jeecg.modules.Index.entity.vo.EightCosts;
+import org.jeecg.modules.wzOutboundOrder.entity.WzOutboundOrderB;
 
 import java.math.BigDecimal;
 import java.util.List;
@@ -16,21 +17,26 @@ import java.util.List;
  */
 @Mapper
 public interface IndexZcbMapper {
+
+
     /**
-     *   author: dzc
-     *   version: 1.0
-     *   des: 统计总成本根据当前用户的部门和日期 部门根据下达部门
-     *   date: 2023/9/21
-     */
-    public BigDecimal getZcbByXdDepartAndDate(@Param("dep") List<String> dep, @Param("nowDate") String nowDate);
+    *   author: dzc
+    *   version: 1.0
+    *   des: 统计总成本根据当前用户的部门和日期 根据部门 年
+    *   date: 2023/10/16
+    */
+    public BigDecimal getZcbByDepartAndYear(@Param("dep") List<String> dep, @Param("nowDate") String nowDate);
+
+
 
     /**
      *   author: dzc
      *   version: 1.0
-     *   des: 统计总成本根据当前用户的部门和日期 部门根据责任部门
+     *   des: 统计总成本根据当前用户的部门和日期 根据部门 年月
      *   date: 2023/9/21
      */
-    public BigDecimal getZcbByZrDepartAndDate(@Param("dep") List<String> dep, @Param("nowDate") String nowDate);
+    public BigDecimal getZcbByDepartAndYearMonth(@Param("dep") List<String> dep, @Param("nowDate") String nowDate);
+
 
     /**
      *   author: dzc
@@ -52,19 +58,10 @@ public interface IndexZcbMapper {
     /**
      *   author: dzc
      *   version: 1.0
-     *   des: 查询去年同期总成本  部门根据下达部门
+     *   des: 查询去年同期总成本  根据部门
      *   date: 2023/9/21
      */
-    public BigDecimal getZcbByXdDepartAndUpDate(@Param("dep") List<String> dep,@Param("upDateFirst") String upDateFirst, @Param("upDate") String upDate);
-
-
-    /**
-     *   author: dzc
-     *   version: 1.0
-     *   des: 查询去年同期总成本  部门根据责任部门
-     *   date: 2023/9/21
-     */
-    public BigDecimal getZcbByZrDepartAndUpDate(@Param("dep") List<String> dep,@Param("upDateFirst") String upDateFirst, @Param("upDate") String upDate);
+    public BigDecimal getZcbByDepartAndUpDate(@Param("dep") List<String> dep,@Param("upDateFirst") String upDateFirst, @Param("upDate") String upDate);
 
 
     /**
@@ -78,31 +75,6 @@ public interface IndexZcbMapper {
     /**
      *   author: dzc
      *   version: 1.0
-     *   des: 查询指定时间段内的八项成本  部门根据下达部门
-     *   date: 2023/9/22
-     */
-    public List<EightCosts> getEightCostXdDepartByDate(@Param("dep") List<String> dep,@Param("startDate") String startDate,@Param("endDate") String endDate);
-
-    /**
-     *   author: dzc
-     *   version: 1.0
-     *   des: 查询指定时间段内的八项成本 部门根据责任部门
-     *   date: 2023/9/22
-     */
-    public List<EightCosts> getEightCostZrDepartByDate(@Param("dep") List<String> dep,@Param("startDate") String startDate,@Param("endDate") String endDate);
-
-    /**
-     *   author: dzc
-     *   version: 1.0
-     *   des: 查询指定时间段内的八项成本 全部部门
-     *   date: 2023/9/24
-     */
-    public List<EightCosts> getEightCostDepartByDate(@Param("startDate") String startDate,@Param("endDate") String endDate);
-
-
-    /**
-     *   author: dzc
-     *   version: 1.0
      *   des: 查询出 所有状态为 1 的pccode所对应的任务号(去重)
      *   date: 2023/9/24
      */
@@ -116,28 +88,6 @@ public interface IndexZcbMapper {
      */
     public List<String> getPcTasknoSonList();
 
-    /**
-    *   author: dzc
-    *   version: 1.0
-    *   des: 根据年月查询所有的部门的总成本
-    *   date: 2023/10/7
-    */
-    public BigDecimal getZcbByYearMonth(String nowDate);
-    /**
-    *   author: dzc
-    *   version: 1.0
-    *   des: 根据年月查询下达部门的总成本
-    *   date: 2023/10/7
-    */
-    public BigDecimal getZcbByXdDepartByYearMonth(@Param("nowDate") String nowDate,@Param("dep") List<String> dep);
-
-    /**
-    *   author: dzc
-    *   version: 1.0
-    *   des: 根据年月查询责任部门的总成本
-    *   date: 2023/10/7
-    */
-    public BigDecimal getZcbByZrDepartByYearMonth(@Param("nowDate") String nowDate,@Param("dep") List<String> dep);
 
     /**
     *   author: dzc
@@ -147,21 +97,6 @@ public interface IndexZcbMapper {
     */
     public BigDecimal getZcbByYear(String nowDate);
 
-    /**
-    *   author: dzc
-    *   version: 1.0
-    *   des: 根据年查询下达部门的总成本
-    *   date: 2023/10/7
-    */
-    public BigDecimal getZcbByXdDepartByYear(@Param("nowDate") String nowDate,@Param("dep") List<String> dep);
-
-    /**
-    *   author: dzc
-    *   version: 1.0
-    *   des: 根据年查询责任部门的总成本
-    *   date: 2023/10/7
-    */
-    public BigDecimal getZcbByZrDepartByYear(@Param("nowDate") String nowDate,@Param("dep") List<String> dep);
 
 
     /**
@@ -175,19 +110,10 @@ public interface IndexZcbMapper {
     /**
     *   author: dzc
     *   version: 1.0
-    *   des: 根据时间段(年月) 获取八项成本  (下达部门)
-    *   date: 2023/10/8
-    */
-    public List<EightCosts> getXdbmEightCostByYearMonth(@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("dep") List<String> dep);
-
-    /**
-    *   author: dzc
-    *   version: 1.0
-    *   des: 根据时间段(年月) 获取八项成本  (责任部门)
+    *   des: 根据时间段(年月) 获取八项成本  (根据部门)
     *   date: 2023/10/8
     */
-    public List<EightCosts> getZrbmEightCostByYearMonth(@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("dep") List<String> dep);
-
+    public List<EightCosts> getDepartEightCostByYearMonth(@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("dep") List<String> dep);
 
     /**
     *   author: dzc
@@ -203,62 +129,71 @@ public interface IndexZcbMapper {
     *   des: 判断当前时间段内(年月) 数据库中有几个 (下达部门)
     *   date: 2023/10/8
     */
-    public List<String> getXdbmYearMonth(@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("dep") List<String> dep);
+    public List<String> getDepartYearMonth(@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("dep") List<String> dep);
 
     /**
     *   author: dzc
     *   version: 1.0
-    *   des: 判断当前时间段内(年月) 数据库中有几个 (责任部门部门)
+    *   des: 根据年 获取八项成本 (全部部门)
     *   date: 2023/10/8
     */
-    public List<String> getZrbmYearMonth(@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("dep") List<String> dep);
+    public List<EightCosts> getEightCostByYear(@Param("startDate") String startDate,@Param("endDate") String endDate);
 
     /**
     *   author: dzc
     *   version: 1.0
-    *   des: 根据年 获取八项成本 (全部部门)
+    *   des: 根据年 获取八项成本 (根据部门)
     *   date: 2023/10/8
     */
-    public List<EightCosts> getEightCostByYear(@Param("startDate") String startDate,@Param("endDate") String endDate);
-
+    public List<EightCosts> getDepartEightCostByYear(@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("dep") List<String> dep);
     /**
     *   author: dzc
     *   version: 1.0
-    *   des: 根据年 获取八项成本 (下达部门)
+    *   des: 判断当前时间段内 (年) 数据库中有几个 (全部部门)
     *   date: 2023/10/8
     */
-    public List<EightCosts> getXdbmEightCostByYear(@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("dep") List<String> dep);
+    public List<String> getYear(@Param("startDate") String startDate,@Param("endDate") String endDate);
 
     /**
     *   author: dzc
     *   version: 1.0
-    *   des: 根据年 获取八项成本 (责任部门)
+    *   des: 判断当前时间段内 (年) 数据库中有几个 (下达部门)
     *   date: 2023/10/8
     */
-    public List<EightCosts> getZrbmEightCostByYear(@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("dep") List<String> dep);
+    public List<String> getYearByBm(@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("dep") List<String> dep);
+
+
+    /**
+     *   author: dzc
+     *   version: 1.0
+     *   des: 查询指定时间段内(年)的八项成本 全部部门
+     *   date: 2023/9/24
+     */
+    public List<EightCosts> getSumEightCostByYear(@Param("startDate") String startDate,@Param("endDate") String endDate);
+
 
     /**
     *   author: dzc
     *   version: 1.0
-    *   des: 判断当前时间段内 (年) 数据库中有几个 (全部部门)
-    *   date: 2023/10/8
+    *   des: 查询指定时间段内(年)的八项成本 根据部门
+    *   date: 2023/10/16
     */
-    public List<String> getYear(@Param("startDate") String startDate,@Param("endDate") String endDate);
+    public List<EightCosts> getDepartSumEightCostByYear(@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("dep") List<String> dep);
 
     /**
     *   author: dzc
     *   version: 1.0
-    *   des: 判断当前时间段内 (年) 数据库中有几个 (下达部门)
-    *   date: 2023/10/8
+    *   des: 查询指定时间段内(年月)的八项成本 全部部门
+    *   date: 2023/10/16
     */
-    public List<String> getXdbmYear(@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("dep") List<String> dep);
+    public List<EightCosts> getSumEightCostByYearMonth(@Param("startDate") String startDate,@Param("endDate") String endDate);
 
     /**
     *   author: dzc
     *   version: 1.0
-    *   des: 判断当前时间段内 (年) 数据库中有几个 (责任部门)
-    *   date: 2023/10/8
+    *   des: 查询指定时间段内(年月)的八项成本 根据部门
+    *   date: 2023/10/16
     */
-    public List<String> getZrbmYear(@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("dep") List<String> dep);
+    public List<EightCosts> getDepartSumEightCostByYearMonth(@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("dep") List<String> dep);
 
 }

+ 211 - 321
module_kzks/src/main/java/org/jeecg/modules/Index/mapper/xml/IndexZcbMapper.xml

@@ -3,101 +3,52 @@
 <mapper namespace="org.jeecg.modules.Index.mapper.IndexZcbMapper">
 
 
-
-    <!-- 统计总成本(支出) 部门根据下达部门 -->
-    <select id="getZcbByXdDepartAndDate" resultType="BigDecimal">
-        select sum(c.zcb)
-        from kzks_project_cost c
-        left join ky_task_info k
-        on c.taskno = k.taskno
-        where k.jycs in
+    <select id="getZcbByDepartAndYear" resultType="BigDecimal">
+        SELECT
+        sum( zcb )
+        FROM
+        kzks_project_cost_cb
+        WHERE
+        YEAR = #{nowDate}
+        AND zrbm IN
         <foreach collection="dep" item="item" index="index" separator="," open="(" close=")">
             #{item}
         </foreach>
-        and k.sjwcsj like CONCAT('%',#{nowDate},'%')
-        AND c.status in ("0","3")
     </select>
 
-    <!-- 统计总成本(支出) 部门根据责任部门 -->
-    <select id="getZcbByZrDepartAndDate" resultType="BigDecimal">
-        select sum(c.zcb)
-        from kzks_project_cost c
-        left join ky_task_info k
-        on c.taskno = k.taskno
-        where k.zrbm in
-        <foreach collection="dep" item="item" index="index" separator="," open="(" close=")">
-            #{item}
-        </foreach>
-        and k.sjwcsj like CONCAT('%',#{nowDate},'%')
-        AND c.status in ("0","3")
+    <!-- 统计总成本(支出) 根据部门 年月-->
+    <select id="getZcbByDepartAndYearMonth" resultType="BigDecimal">
+        SELECT
+            sum( zcb )
+        FROM
+            kzks_project_cost_cb
+        WHERE
+            YEARMONTH = #{nowDate}
+        AND zrbm IN
+            <foreach collection="dep" item="item" index="index" separator="," open="(" close=")">
+                #{item}
+            </foreach>
     </select>
 
     <!-- 统计总成本根据当前用户的部门和日期 全部部门 -->
     <select id="getZcbByDate" resultType="BigDecimal">
-        SELECT SUM(c.zcb)
-        FROM kzks_project_cost c
-                 LEFT JOIN ky_task_info k
-                           ON c.taskno = k.taskno
-        WHERE k.sjwcsj LIKE CONCAT('%',#{nowDate},'%')
-          AND c.status in ("0","3")
+        SELECT
+            sum( zcb )
+        FROM
+            kzks_project_cost_cb
+        WHERE
+            yearmonth = #{nowDate}
     </select>
 
-    <!-- 根据年月查询所有的部门的总成本 -->
-    <select id="getZcbByYearMonth" resultType="BigDecimal">
-        SELECT SUM(ZCB)
-        FROM kzks_project_cost
-        WHERE TASKNO IN (SELECT TASKNO FROM ky_task_info WHERE yearmonth = #{nowDate}) and status in ("0","3")
-    </select>
-    <!-- 根据年月查询下达部门的总成本 -->
-    <select id="getZcbByXdDepartByYearMonth" resultType="BigDecimal">
-        SELECT SUM(ZCB)
-        FROM kzks_project_cost
-        WHERE TASKNO IN
-        (SELECT TASKNO FROM ky_task_info WHERE yearmonth = #{nowDate} AND jycs in
-        <foreach collection="dep" item="item" index="index" separator="," open="(" close=")">
-            #{item}
-        </foreach>
-        ) and status in ("0","3")
-    </select>
-    <!-- 根据年月查询责任部门的总成本 -->
-    <select id="getZcbByZrDepartByYearMonth" resultType="BigDecimal">
-        SELECT SUM(ZCB)
-        FROM kzks_project_cost
-        WHERE TASKNO IN
-        (SELECT TASKNO FROM ky_task_info WHERE yearmonth = #{nowDate} AND zrbm in
-        <foreach collection="dep" item="item" index="index" separator="," open="(" close=")">
-            #{item}
-        </foreach>
-        ) and status in ("0","3")
-    </select>
 
     <!-- 根据年查询所有部门的总成本 -->
     <select id="getZcbByYear" resultType="BigDecimal">
-        SELECT SUM(ZCB)
-        FROM kzks_project_cost
-        WHERE TASKNO IN (SELECT TASKNO FROM ky_task_info WHERE year = #{nowDate}) and status in ("0","3")
-    </select>
-    <!-- 根据年查询下达部门的总成本 -->
-    <select id="getZcbByXdDepartByYear" resultType="BigDecimal">
-        SELECT SUM(ZCB)
-        FROM kzks_project_cost
-        WHERE TASKNO IN
-        (SELECT TASKNO FROM ky_task_info WHERE year = #{nowDate} AND jycs in
-        <foreach collection="dep" item="item" index="index" separator="," open="(" close=")">
-            #{item}
-        </foreach>
-        ) and status in ("0","3")
-    </select>
-    <!-- 根据年查询责任部门的总成本 -->
-    <select id="getZcbByZrDepartByYear" resultType="BigDecimal">
-        SELECT SUM(ZCB)
-        FROM kzks_project_cost
-        WHERE TASKNO IN
-        (SELECT TASKNO FROM ky_task_info WHERE year = #{nowDate} AND zrbm in
-        <foreach collection="dep" item="item" index="index" separator="," open="(" close=")">
-            #{item}
-        </foreach>
-        ) and status in ("0","3")
+        SELECT
+            sum( zcb )
+        FROM
+            kzks_project_cost_cb
+        WHERE
+            YEAR = #{nowDate}
     </select>
 
     <resultMap id="DepartMap" type="String">
@@ -109,48 +60,51 @@
         FROM sys_depart
         WHERE id IN
               (SELECT dep_id FROM sys_user_depart WHERE user_id IN
-                                                        (SELECT id FROM sys_user WHERE username = #{username})
+                (SELECT id FROM sys_user WHERE username = #{username})
               )
     </select>
 
-    <!-- 查询去年同期总成本 部门根据下达部门 -->
-    <select id="getZcbByXdDepartAndUpDate" resultType="BigDecimal">
-        SELECT sum(c.zcb)
-        FROM kzks_project_cost c
-        LEFT JOIN ky_task_info k
-        ON c.taskno = k.taskno
-        WHERE k.jycs IN
-        <foreach collection="dep" item="item" index="index" separator="," open="(" close=")">
-            #{item}
-        </foreach>
-        AND k.sjwcsj >= #{upDateFirst} AND k.sjwcsj <![CDATA[ <= ]]> #{upDate}
-        AND c.status in ("0","3")
-    </select>
-
-    <!-- 查询去年同期总成本 部门根据责任部门部门 -->
-    <select id="getZcbByZrDepartAndUpDate" resultType="BigDecimal">
-        SELECT sum(c.zcb)
-        FROM kzks_project_cost c
-        LEFT JOIN ky_task_info k
-        ON c.taskno = k.taskno
-        WHERE k.zrbm IN
+    <!-- 查询去年同期总成本 根据部门 -->
+    <select id="getZcbByDepartAndUpDate" resultType="BigDecimal">
+        SELECT
+            sum( zcb )
+        FROM
+            kzks_project_cost_cb
+        WHERE
+            yearmonth >= #{upDateFirst} AND yearmonth <![CDATA[ <= ]]> #{upDate}
+        AND
+            zrbm IN
         <foreach collection="dep" item="item" index="index" separator="," open="(" close=")">
             #{item}
         </foreach>
-        AND k.sjwcsj >= #{upDateFirst} AND k.sjwcsj <![CDATA[ <= ]]> #{upDate}
-        AND c.status in ("0","3")
     </select>
 
     <!-- 查询去年同期总成本 全部部门 -->
     <select id="getZcbByUpdate" resultType="BigDecimal">
-        SELECT sum(c.zcb)
-        FROM kzks_project_cost c
-                 LEFT JOIN ky_task_info k
-                           ON c.taskno = k.taskno
-        WHERE k.sjwcsj >= #{upDateFirst} AND k.sjwcsj <![CDATA[ <= ]]> #{upDate}
-          AND c.status in ("0","3")
+        SELECT
+            sum( zcb )
+        FROM
+            kzks_project_cost_cb
+        WHERE
+            yearmonth >= #{upDateFirst} AND yearmonth <![CDATA[ <= ]]> #{upDate}
+    </select>
+
+
+    <resultMap id="PcCodeTasknoList" type="String">
+        <result column="taskno"/>
+    </resultMap>
+    <select id="getPcTasknoList" resultMap="PcCodeTasknoList">
+        SELECT DISTINCT(pcCode) AS taskno FROM kzks_project_cost WHERE status = "1"
     </select>
 
+    <select id="getPcTasknoSonList" resultMap="PcCodeTasknoList">
+        SELECT taskno FROM kzks_project_cost
+        WHERE reftaskno
+            IN (SELECT DISTINCT(pcCode) FROM kzks_project_cost WHERE status = "1")
+          AND status IN ("0","3")
+    </select>
+
+
     <!-- 查询规定时间段内的 材料费、专用费、事务费、外协费、燃料动力费、固定资产折旧费、工资及劳务费、管理费 之和 部门根据下达部门 -->
     <resultMap id="EigthCostList" type="org.jeecg.modules.Index.entity.vo.EightCosts">
         <result property="clf" column="clf"/>
@@ -162,117 +116,126 @@
         <result property="gzjlwf" column="gzjlwf"/>
         <result property="glf" column="glf"/>
     </resultMap>
-    <select id="getEightCostXdDepartByDate" resultMap="EigthCostList">
+    <!-- 查询规定时间段内(年)的 材料费、专用费、事务费、外协费、燃料动力费、固定资产折旧费、工资及劳务费、管理费 之和 全部部门 -->
+    <select id="getSumEightCostByYear" resultMap="EigthCostList">
         SELECT
-        sum( c.clf ) AS clf,sum(c.zyf) AS zyf,sum(c.swf) AS swf,sum(c.wxf) AS wxf,
-        sum(c.rldlf) AS rldlf,sum(c.gdzczj) AS gdzczj,sum(c.gzjlwf) AS gzjlwf,sum(c.glf) AS glf
+        sum( clf ) AS clf,
+        sum( zyf ) AS zyf,
+        sum( swf ) AS swf,
+        sum( wxf ) AS wxf,
+        sum( rldlf ) AS rldlf,
+        sum( gdzczj ) AS gdzczj,
+        sum( gzjlwf ) AS gzjlwf,
+        sum( glf ) AS glf
         FROM
-        kzks_project_cost c
-        LEFT JOIN ky_task_info k
-        ON c.taskno = k.taskno
-        WHERE k.jycs IN
-        <foreach collection="dep" item="item" index="index" separator="," open="(" close=")">
-            #{item}
-        </foreach>
-        AND k.sjwcsj >= #{startDate} AND k.sjwcsj <![CDATA[ < ]]> #{endDate}
-        AND c.status in ("0","3")
+        kzks_project_cost_cb
+        WHERE
+        year >= #{startDate} AND year <![CDATA[ <= ]]>  #{endDate}
     </select>
 
-    <!-- 查询规定时间段内的 材料费、专用费、事务费、外协费、燃料动力费、固定资产折旧费、工资及劳务费、管理费 之和 部门根据责任部门 -->
-    <select id="getEightCostZrDepartByDate" resultMap="EigthCostList">
+    <!-- 查询规定时间段内(年)的 材料费、专用费、事务费、外协费、燃料动力费、固定资产折旧费、工资及劳务费、管理费 之和 根据部门 -->
+    <select id="getDepartSumEightCostByYear" resultMap="EigthCostList">
         SELECT
-        sum( c.clf ) AS clf,sum(c.zyf) AS zyf,sum(c.swf) AS swf,sum(c.wxf) AS wxf,
-        sum(c.rldlf) AS rldlf,sum(c.gdzczj) AS gdzczj,sum(c.gzjlwf) AS gzjlwf,sum(c.glf) AS glf
+        sum( clf ) AS clf,
+        sum( zyf ) AS zyf,
+        sum( swf ) AS swf,
+        sum( wxf ) AS wxf,
+        sum( rldlf ) AS rldlf,
+        sum( gdzczj ) AS gdzczj,
+        sum( gzjlwf ) AS gzjlwf,
+        sum( glf ) AS glf
         FROM
-        kzks_project_cost c
-        LEFT JOIN ky_task_info k
-        ON c.taskno = k.taskno
-        WHERE k.zrbm IN
+        kzks_project_cost_cb
+        WHERE
+        year >= #{startDate} AND year <![CDATA[ <= ]]>  #{endDate}
+        AND zrbm IN
         <foreach collection="dep" item="item" index="index" separator="," open="(" close=")">
             #{item}
         </foreach>
-        AND k.sjwcsj >= #{startDate} AND k.sjwcsj <![CDATA[ < ]]> #{endDate}
-        AND c.status in ("0","3")
     </select>
 
-    <!-- 查询规定时间段内的 材料费、专用费、事务费、外协费、燃料动力费、固定资产折旧费、工资及劳务费、管理费 之和 全部部门 -->
-    <select id="getEightCostDepartByDate" resultMap="EigthCostList">
+    <!-- 查询规定时间段内(年月)的 材料费、专用费、事务费、外协费、燃料动力费、固定资产折旧费、工资及劳务费、管理费 之和 全部部门 -->
+    <select id="getSumEightCostByYearMonth" resultMap="EigthCostList">
         SELECT
-            sum( c.clf ) AS clf,sum(c.zyf) AS zyf,sum(c.swf) AS swf,sum(c.wxf) AS wxf,
-            sum(c.rldlf) AS rldlf,sum(c.gdzczj) AS gdzczj,sum(c.gzjlwf) AS gzjlwf,sum(c.glf) AS glf
+        sum( clf ) AS clf,
+        sum( zyf ) AS zyf,
+        sum( swf ) AS swf,
+        sum( wxf ) AS wxf,
+        sum( rldlf ) AS rldlf,
+        sum( gdzczj ) AS gdzczj,
+        sum( gzjlwf ) AS gzjlwf,
+        sum( glf ) AS glf
         FROM
-            kzks_project_cost c
-                LEFT JOIN ky_task_info k
-                          ON c.taskno = k.taskno
-        WHERE k.sjwcsj >= #{startDate} AND k.sjwcsj <![CDATA[ < ]]> #{endDate}
-          AND c.status in ("0","3")
+        kzks_project_cost_cb
+        WHERE
+        yearmonth >= #{startDate} AND yearmonth <![CDATA[ <= ]]>  #{endDate}
     </select>
 
-    <resultMap id="PcCodeTasknoList" type="String">
-        <result column="taskno"/>
-    </resultMap>
-    <select id="getPcTasknoList" resultMap="PcCodeTasknoList">
-        SELECT DISTINCT(pcCode) AS taskno FROM kzks_project_cost WHERE status = "1"
+    <!-- 查询规定时间段内(年月)的 材料费、专用费、事务费、外协费、燃料动力费、固定资产折旧费、工资及劳务费、管理费 之和 根据部门 -->
+    <select id="getDepartSumEightCostByYearMonth" resultMap="EigthCostList">
+        SELECT
+            sum( clf ) AS clf,
+            sum( zyf ) AS zyf,
+            sum( swf ) AS swf,
+            sum( wxf ) AS wxf,
+            sum( rldlf ) AS rldlf,
+            sum( gdzczj ) AS gdzczj,
+            sum( gzjlwf ) AS gzjlwf,
+            sum( glf ) AS glf
+        FROM
+            kzks_project_cost_cb
+        WHERE
+            yearmonth >= #{startDate} AND yearmonth <![CDATA[ <= ]]>  #{endDate}
+        AND zrbm IN
+        <foreach collection="dep" item="item" index="index" separator="," open="(" close=")">
+            #{item}
+        </foreach>
     </select>
 
-    <select id="getPcTasknoSonList" resultMap="PcCodeTasknoList">
-        SELECT taskno FROM kzks_project_cost
-        WHERE reftaskno
-            IN (SELECT DISTINCT(pcCode) FROM kzks_project_cost WHERE status = "1")
-          AND status IN ("0","3")
-    </select>
+
+
+
 
     <!-- 根据时间段(年月) 获取八项成本  (所有部门) -->
     <select id="getEightCostByYearMonth" resultMap="EigthCostList">
         SELECT
-        sum( c.clf ) AS clf,sum(c.zyf) AS zyf,sum(c.swf) AS swf,sum(c.wxf) AS wxf,
-        sum(c.rldlf) AS rldlf,sum(c.gdzczj) AS gdzczj,sum(c.gzjlwf) AS gzjlwf,sum(c.glf) AS glf
+        sum( clf ) AS clf,
+        sum( zyf ) AS zyf,
+        sum( swf ) AS swf,
+        sum( wxf ) AS wxf,
+        sum( rldlf ) AS rldlf,
+        sum( gdzczj ) AS gdzczj,
+        sum( gzjlwf ) AS gzjlwf,
+        sum( glf ) AS glf
         FROM
-        kzks_project_cost c
-        LEFT JOIN ky_task_info k
-        ON c.taskno = k.taskno
-        WHERE k.yearmonth >= #{startDate} AND k.yearmonth  <![CDATA[ <= ]]> #{endDate}
-        AND c.status IN ("0","3")
-        GROUP BY k.yearmonth
-        ORDER BY k.yearmonth
+        kzks_project_cost_cb
+        WHERE
+        yearmonth >= #{startDate} AND yearmonth <![CDATA[ <= ]]> #{endDate}
+        GROUP BY yearmonth
+        ORDER BY yearmonth
     </select>
 
     <!-- 根据时间段(年月) 获取八项成本  (下达部门) -->
-    <select id="getXdbmEightCostByYearMonth" resultMap="EigthCostList">
-        SELECT
-        sum( c.clf ) AS clf,sum(c.zyf) AS zyf,sum(c.swf) AS swf,sum(c.wxf) AS wxf,
-        sum(c.rldlf) AS rldlf,sum(c.gdzczj) AS gdzczj,sum(c.gzjlwf) AS gzjlwf,sum(c.glf) AS glf
-        FROM
-        kzks_project_cost c
-        LEFT JOIN ky_task_info k
-        ON c.taskno = k.taskno
-        WHERE k.yearmonth >= #{startDate} AND k.yearmonth  <![CDATA[ <= ]]> #{endDate}
-        AND c.status IN ("0","3")
-        AND k.jycs in
-        <foreach collection="dep" item="item" index="index" separator="," open="(" close=")">
-            #{item}
-        </foreach>
-        GROUP BY k.yearmonth
-        ORDER BY k.yearmonth
-    </select>
-
-    <!-- 根据时间段(年月) 获取八项成本  (责任部门) -->
-    <select id="getZrbmEightCostByYearMonth" resultMap="EigthCostList">
+    <select id="getDepartEightCostByYearMonth" resultMap="EigthCostList">
         SELECT
-        sum( c.clf ) AS clf,sum(c.zyf) AS zyf,sum(c.swf) AS swf,sum(c.wxf) AS wxf,
-        sum(c.rldlf) AS rldlf,sum(c.gdzczj) AS gdzczj,sum(c.gzjlwf) AS gzjlwf,sum(c.glf) AS glf
+        sum( clf ) AS clf,
+        sum( zyf ) AS zyf,
+        sum( swf ) AS swf,
+        sum( wxf ) AS wxf,
+        sum( rldlf ) AS rldlf,
+        sum( gdzczj ) AS gdzczj,
+        sum( gzjlwf ) AS gzjlwf,
+        sum( glf ) AS glf
         FROM
-        kzks_project_cost c
-        LEFT JOIN ky_task_info k
-        ON c.taskno = k.taskno
-        WHERE k.yearmonth >= #{startDate} AND k.yearmonth  <![CDATA[ <= ]]> #{endDate}
-        AND c.status IN ("0","3")
-        AND k.zrbm in
+        kzks_project_cost_cb
+        WHERE
+        yearmonth >= #{startDate} AND yearmonth <![CDATA[ <= ]]> #{endDate}
+        AND zrbm in
         <foreach collection="dep" item="item" index="index" separator="," open="(" close=")">
             #{item}
         </foreach>
-        GROUP BY k.yearmonth
-        ORDER BY k.yearmonth
+        GROUP BY yearmonth
+        ORDER BY yearmonth
     </select>
 
 
@@ -282,171 +245,98 @@
     </resultMap>
     <!-- 判断当前时间段内(年月) 数据库中有几个 (所有部门) -->
     <select id="getYearMonth" resultMap="yearMonthList">
-        SELECT
-        k.yearmonth AS yearmonth
-        FROM
-        kzks_project_cost c
-        LEFT JOIN ky_task_info k ON c.taskno = k.taskno
-        WHERE
-        k.yearmonth >= #{startDate} AND k.yearmonth  <![CDATA[ <= ]]> #{endDate}
-        AND c.STATUS IN ( "0", "3" )
+        SELECT yearmonth
+        FROM kzks_project_cost_cb
+        WHERE yearmonth >= #{startDate} AND yearmonth <![CDATA[ <= ]]> #{endDate}
         GROUP BY
-        k.yearmonth
+        yearmonth
         ORDER BY
-        k.yearmonth
+        yearmonth
     </select>
 
     <!-- 判断当前时间段内(年月) 数据库中有几个 (下达部门) -->
-    <select id="getXdbmYearMonth" resultMap="yearMonthList">
-        SELECT
-        k.yearmonth AS yearmonth
-        FROM
-        kzks_project_cost c
-        LEFT JOIN ky_task_info k ON c.taskno = k.taskno
-        WHERE
-        k.yearmonth >= #{startDate} AND k.yearmonth  <![CDATA[ <= ]]> #{endDate}
-        AND c.STATUS IN ( "0", "3" )
-        AND k.jycs in
+    <select id="getDepartYearMonth" resultMap="yearMonthList">
+        SELECT yearmonth
+        FROM kzks_project_cost_cb
+        WHERE yearmonth >= #{startDate} AND yearmonth <![CDATA[ <= ]]> #{endDate}
+        AND zrbm in
         <foreach collection="dep" item="item" index="index" separator="," open="(" close=")">
             #{item}
         </foreach>
-        GROUP BY
-        k.yearmonth
-        ORDER BY
-        k.yearmonth
-    </select>
-
-    <!-- 判断当前时间段内 数据库中有几个 (责任部门部门) -->
-    <select id="getZrbmYearMonth" resultMap="yearMonthList">
-        SELECT
-        k.yearmonth AS yearmonth
-        FROM
-        kzks_project_cost c
-        LEFT JOIN ky_task_info k ON c.taskno = k.taskno
-        WHERE
-        k.yearmonth >= #{startDate} AND k.yearmonth  <![CDATA[ <= ]]> #{endDate}
-        AND c.STATUS IN ( "0", "3" )
-        AND k.zrbm in
-        <foreach collection="dep" item="item" index="index" separator="," open="(" close=")">
-            #{item}
-        </foreach>
-        GROUP BY
-        k.yearmonth
-        ORDER BY
-        k.yearmonth
+        GROUP BY yearmonth
+        ORDER BY yearmonth
     </select>
 
 
     <!-- 根据年 获取八项成本 (全部部门) -->
     <select id="getEightCostByYear" resultMap="EigthCostList">
         SELECT
-        sum( c.clf ) AS clf,sum(c.zyf) AS zyf,sum(c.swf) AS swf,sum(c.wxf) AS wxf,
-        sum(c.rldlf) AS rldlf,sum(c.gdzczj) AS gdzczj,sum(c.gzjlwf) AS gzjlwf,sum(c.glf) AS glf
+        sum( clf ) AS clf,
+        sum( zyf ) AS zyf,
+        sum( swf ) AS swf,
+        sum( wxf ) AS wxf,
+        sum( rldlf ) AS rldlf,
+        sum( gdzczj ) AS gdzczj,
+        sum( gzjlwf ) AS gzjlwf,
+        sum( glf ) AS glf
         FROM
-        kzks_project_cost c
-        LEFT JOIN ky_task_info k
-        ON c.taskno = k.taskno
-        WHERE k.year >= #{startDate} AND k.year  <![CDATA[ <= ]]> #{endDate}
-        AND c.status IN ("0","3")
-        GROUP BY k.year
-        ORDER BY k.year
+        kzks_project_cost_cb
+        WHERE
+        YEAR >= #{startDate} AND year <![CDATA[ <= ]]> #{endDate}
+        GROUP BY
+        YEAR
+        ORDER BY
+        YEAR
     </select>
 
-    <!-- 根据年 获取八项成本 (下达部门) -->
-    <select id="getXdbmEightCostByYear" resultMap="EigthCostList">
+    <!-- 根据年 获取八项成本 (根据部门) -->
+    <select id="getDepartEightCostByYear" resultMap="EigthCostList">
         SELECT
-        sum( c.clf ) AS clf,sum(c.zyf) AS zyf,sum(c.swf) AS swf,sum(c.wxf) AS wxf,
-        sum(c.rldlf) AS rldlf,sum(c.gdzczj) AS gdzczj,sum(c.gzjlwf) AS gzjlwf,sum(c.glf) AS glf
+        sum( clf ) AS clf,
+        sum( zyf ) AS zyf,
+        sum( swf ) AS swf,
+        sum( wxf ) AS wxf,
+        sum( rldlf ) AS rldlf,
+        sum( gdzczj ) AS gdzczj,
+        sum( gzjlwf ) AS gzjlwf,
+        sum( glf ) AS glf
         FROM
-        kzks_project_cost c
-        LEFT JOIN ky_task_info k
-        ON c.taskno = k.taskno
-        WHERE k.year >= #{startDate} AND k.year  <![CDATA[ <= ]]> #{endDate}
-        AND c.status IN ("0","3")
-        AND k.jycs in
+        kzks_project_cost_cb
+        WHERE
+        YEAR >= #{startDate} AND YEAR <![CDATA[ <= ]]> #{endDate}
+        AND zrbm IN
         <foreach collection="dep" item="item" index="index" separator="," open="(" close=")">
             #{item}
         </foreach>
-        GROUP BY k.year
-        ORDER BY k.year
+        GROUP BY YEAR
+        ORDER BY YEAR
     </select>
 
-    <!-- 根据年 获取八项成本 (责任部门) -->
-    <select id="getZrbmEightCostByYear" resultMap="EigthCostList">
-        SELECT
-        sum( c.clf ) AS clf,sum(c.zyf) AS zyf,sum(c.swf) AS swf,sum(c.wxf) AS wxf,
-        sum(c.rldlf) AS rldlf,sum(c.gdzczj) AS gdzczj,sum(c.gzjlwf) AS gzjlwf,sum(c.glf) AS glf
-        FROM
-        kzks_project_cost c
-        LEFT JOIN ky_task_info k
-        ON c.taskno = k.taskno
-        WHERE k.year >= #{startDate} AND k.year  <![CDATA[ <= ]]> #{endDate}
-        AND c.status IN ("0","3")
-        AND k.zrbm in
-        <foreach collection="dep" item="item" index="index" separator="," open="(" close=")">
-            #{item}
-        </foreach>
-        GROUP BY k.year
-        ORDER BY k.year
-    </select>
 
     <resultMap id="yearList" type="String">
         <result column="year"></result>
     </resultMap>
     <!-- 判断当前时间段内 (年) 数据库中有几个 (全部部门) -->
     <select id="getYear" resultMap="yearList">
-        SELECT
-        k.year AS year
-        FROM
-        kzks_project_cost c
-        LEFT JOIN ky_task_info k ON c.taskno = k.taskno
-        WHERE
-        k.year >= #{startDate} AND k.year  <![CDATA[ <= ]]> #{endDate}
-        AND c.STATUS IN ( "0", "3" )
-        GROUP BY
-        k.year
-        ORDER BY
-        k.year
+        SELECT YEAR
+        FROM kzks_project_cost_cb
+        WHERE YEAR >= #{startDate} AND YEAR <![CDATA[ <= ]]> #{endDate}
+        GROUP BY YEAR
+        ORDER BY YEAR
     </select>
 
-    <!-- 判断当前时间段内 (年) 数据库中有几个 (下达部门) -->
-    <select id="getXdbmYear" resultMap="yearList">
-        SELECT
-        k.year AS year
-        FROM
-        kzks_project_cost c
-        LEFT JOIN ky_task_info k ON c.taskno = k.taskno
-        WHERE
-        k.year >= #{startDate} AND k.year  <![CDATA[ <= ]]> #{endDate}
-        AND c.STATUS IN ( "0", "3" )
-        AND k.jycs in
+    <!-- 判断当前时间段内 (年) 数据库中有几个 (根据 部门) -->
+    <select id="getYearByBm" resultMap="yearList">
+        SELECT YEAR
+        FROM kzks_project_cost_cb
+        WHERE YEAR >= #{startDate} AND YEAR <![CDATA[ <= ]]> #{endDate}
+        AND zrbm IN
         <foreach collection="dep" item="item" index="index" separator="," open="(" close=")">
             #{item}
         </foreach>
-        GROUP BY
-        k.year
-        ORDER BY
-        k.year
+        GROUP BY YEAR
+        ORDER BY YEAR
     </select>
 
-    <!-- 判断当前时间段内 (年) 数据库中有几个 (责任部门) -->
-    <select id="getZrbmYear" resultMap="yearList">
-        SELECT
-        k.year AS year
-        FROM
-        kzks_project_cost c
-        LEFT JOIN ky_task_info k ON c.taskno = k.taskno
-        WHERE
-        k.year >= #{startDate} AND k.year  <![CDATA[ <= ]]> #{endDate}
-        AND c.STATUS IN ( "0", "3" )
-        AND k.zrbm in
-        <foreach collection="dep" item="item" index="index" separator="," open="(" close=")">
-            #{item}
-        </foreach>
-        GROUP BY
-        k.year
-        ORDER BY
-        k.year
-    </select>
 
 </mapper>

+ 6 - 8
module_kzks/src/main/java/org/jeecg/modules/Index/service/IndexZcbService.java

@@ -1,11 +1,9 @@
 package org.jeecg.modules.Index.service;
 
-import org.jeecg.modules.Index.entity.vo.ResultEightCost;
-import org.jeecg.modules.Index.entity.vo.IndexTotalVo;
+import org.jeecg.modules.Index.entity.vo.*;
 import org.jeecg.modules.Index.entity.dto.IndexInfoParamDto;
-import org.jeecg.modules.Index.entity.vo.IndexChartInfoVo;
-import org.jeecg.modules.Index.entity.vo.ZhiChuCost;
 
+import javax.servlet.http.HttpServletRequest;
 import java.time.LocalDate;
 import java.time.YearMonth;
 import java.util.List;
@@ -25,7 +23,7 @@ public interface IndexZcbService {
      *   des: 获取 支出相关信息(给前端的数据) 的service方法
      *   date: 2023/9/22
      */
-    public List<IndexTotalVo> getZhiChuTotalList();
+    public List<IndexTotalVo> getZhiChuTotalList(HttpServletRequest request);
 
 
     /**
@@ -34,7 +32,7 @@ public interface IndexZcbService {
      *   des: 获取 八项成本相关信息 的service方法
      *   date: 2023/9/22
      */
-    public List<IndexChartInfoVo> getEightCostsList(IndexInfoParamDto indexInfoParamDto);
+    public List<EightCostChartInfoVo> getEightCostsList(IndexInfoParamDto indexInfoParamDto,HttpServletRequest request);
 
     /**
      *   author: dzc
@@ -42,7 +40,7 @@ public interface IndexZcbService {
      *   des: 指定日期范围内 八项成本各自之和 并排序
      *   date: 2023/9/23
      */
-    public List<ResultEightCost> getSumEightCosts(IndexInfoParamDto indexInfoParamDto);
+    public List<ResultEightCost> getSumEightCosts(IndexInfoParamDto indexInfoParamDto,HttpServletRequest request);
 
     /**
      *   author: dzc
@@ -106,5 +104,5 @@ public interface IndexZcbService {
      *   des: 支出统计二级汇总
      *   date: 2023/9/24
      */
-    public List<ZhiChuCost> getEightCostsInfo(IndexInfoParamDto indexInfoParamDto);
+    public List<ZhiChuCost> getEightCostsInfo(IndexInfoParamDto indexInfoParamDto, HttpServletRequest request);
 }

File diff suppressed because it is too large
+ 299 - 766
module_kzks/src/main/java/org/jeecg/modules/Index/service/impl/IndexZcbServiceImpl.java