Forráskód Böngészése

首页二层已收款显示

sl 1 éve%!(EXTRA string=óta)
szülő
commit
e7251dd545

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

@@ -107,4 +107,17 @@ public class IndexController {
     public Result<IndexChartInfoVo<BigDecimal>> countLreByDate(IndexInfoParamDto indexInfoParamDto) {
         return indexService.countLreByDate(indexInfoParamDto);
     }
+
+    /**
+     * 首页二层:前端传送IndexInfoParamDto  有三个参数,都是string类型  time 年/月 beginDate 开始日期  endDate结束日期
+     * 跟据time来按月查或按年查
+     *
+     * @param indexInfoParamDto
+     * @return IndexChartInfoVo<BigDecimal>
+     */
+    @ApiOperation(value="首页二层已收款显示", notes="首页二层已收款显示")
+    @GetMapping("countTotalReceivedByDate")
+    public Result<IndexChartInfoVo<BigDecimal>> countTotalReceivedByDate(IndexInfoParamDto indexInfoParamDto) {
+        return indexService.countTotalReceivedByDate(indexInfoParamDto);
+    }
 }

+ 11 - 1
module_kzks/src/main/java/org/jeecg/modules/Index/service/IndexService.java

@@ -1,8 +1,11 @@
 package org.jeecg.modules.Index.service;
 
+import io.swagger.annotations.ApiOperation;
+import org.apache.poi.ss.formula.functions.T;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.modules.Index.entity.dto.IndexInfoParamDto;
 import org.jeecg.modules.Index.entity.vo.*;
+import org.springframework.web.bind.annotation.GetMapping;
 
 import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
@@ -53,6 +56,13 @@ public interface IndexService {
      */
     public Result<IndexChartInfoVo<BigDecimal>> countLreByDate(IndexInfoParamDto indexInfoParamDto);
 
-
+    /**
+     * 首页二层:前端传送IndexInfoParamDto  有三个参数,都是string类型  time 年/月 beginDate 开始日期  endDate结束日期
+     * 跟据time来按月查或按年查
+     *
+     * @param indexInfoParamDto
+     * @return IndexChartInfoVo<BigDecimal>
+     */
+    public Result<IndexChartInfoVo<BigDecimal>> countTotalReceivedByDate(IndexInfoParamDto indexInfoParamDto);
 
 }

+ 93 - 6
module_kzks/src/main/java/org/jeecg/modules/Index/service/impl/IndexServiceImpl.java

@@ -871,10 +871,10 @@ public class IndexServiceImpl implements IndexService {
         for (String sysDepartName : sysDepartNames) {
             List<String> taskNoList1 = new ArrayList<>();
             switch (timeType) {
-                case ""://某年的所有任务
+                case "year"://某年的所有任务
                     taskNoList1 = kyTaskInfoService.getKyTaskNoByYear(sysDepartName, timeRange);
                     break;
-                case ""://某月的所有任务
+                case "month"://某月的所有任务
                     taskNoList1 = kyTaskInfoService.getKyTaskNoByMonth(sysDepartName, timeRange);
                     break;
                 default:
@@ -1040,10 +1040,10 @@ public class IndexServiceImpl implements IndexService {
                 // 设置日期
                 calendar.setTime(startDate);
                 //把日期增加一天
-                if(timeType.equals("")){
+                if(timeType.equals("year")){
                     calendar.add(Calendar.YEAR, 1);
                 }
-                else if(timeType.equals("")){
+                else if(timeType.equals("month")){
                     calendar.add(Calendar.MONTH, 1);
                 }
                 // 获取增加后的日期
@@ -1082,10 +1082,10 @@ public class IndexServiceImpl implements IndexService {
         //结束时间
         String endString = indexInfoParamDto.getEndDate();
 
-        if(timeType.equals("")){
+        if(timeType.equals("year")){
             timeRangeList = getDateList(timeRangeList, startString, endString, "yyyy", timeType);
         }
-        else if (timeType.equals("")){
+        else if (timeType.equals("month")){
             timeRangeList = getDateList(timeRangeList, startString, endString, "yyyy-MM", timeType);
         }
         System.out.println("获取的日期列表为:");
@@ -1122,4 +1122,91 @@ public class IndexServiceImpl implements IndexService {
 
     }
 
+    /**
+     * 首页二层:前端传送IndexInfoParamDto  有三个参数,都是string类型  time 年/月 beginDate 开始日期  endDate结束日期
+     * 跟据time来按月查或按年查
+     *
+     * @param indexInfoParamDto
+     * @return IndexChartInfoVo<BigDecimal>
+     */
+    public Result<IndexChartInfoVo<BigDecimal>> countTotalReceivedByDate(IndexInfoParamDto indexInfoParamDto){
+        //1.创建一个IndexChartInfoVo实例用来存储最后返回前端的信息
+        IndexChartInfoVo<BigDecimal> indexChartInfoVo = new IndexChartInfoVo<>();
+        BigDecimal initValue = BigDecimal.valueOf(0); //某年或某月没有任务,已收款为0
+        //创建一个String列表用来存储横坐标日期
+        List<String> timeRangeList = new ArrayList<>();
+        //创建一个BigDecimal列表用来存储纵坐标利润
+        List<BigDecimal> seriesDataList = new ArrayList<>();
+        //初始化传一个空列表
+        indexChartInfoVo.setXAxisData(timeRangeList);
+        indexChartInfoVo.setSeriesData(seriesDataList);
+        //2.计算时间列表 横坐标时间string列表
+        //年/月
+        String timeType = indexInfoParamDto.getTime();
+        System.out.println(timeType);
+        //起始时间
+        String startString = indexInfoParamDto.getBeginDate();
+        System.out.println(startString);
+        //结束时间
+        String endString = indexInfoParamDto.getEndDate();
+        System.out.println(endString);
+
+        if(timeType.equals("year")){
+            timeRangeList = getDateList(timeRangeList, startString, endString, "yyyy", timeType);
+        }
+        else if (timeType.equals("month")){
+            timeRangeList = getDateList(timeRangeList, startString, endString, "yyyy-MM", timeType);
+        }
+        System.out.println("获取的日期列表为:");
+        System.out.println(timeRangeList);
+        if (timeRangeList.isEmpty()) return Result.OK(indexChartInfoVo);//日期为空,直接传回两个空list
+        //根据日期长度初始化纵坐标值 0
+        for(String timeRange:timeRangeList){
+            seriesDataList.add(initValue);
+        }
+        //添加横坐标列表
+        indexChartInfoVo.setXAxisData(timeRangeList);
+        //添加纵坐标列表
+        indexChartInfoVo.setSeriesData(seriesDataList);
+
+        //3.通过登录的用户找到相应的部门,可能一个或两个
+        List<String> sysDepartNames = getDepNameBySysUser();
+        if (sysDepartNames.isEmpty()) return Result.OK(indexChartInfoVo);
+
+        ArrayList<String> tasknoList = new ArrayList<>();
+        List<String> ZrbmTasknoList = projectCostMapper.queryZrbmTasknoListbydepartNames(sysDepartNames);
+        List<String> XdbmTasknoList = projectCostMapper.queryXdbmTasknoListbydepartNames(sysDepartNames);
+        tasknoList.addAll(ZrbmTasknoList);
+        tasknoList.addAll(XdbmTasknoList);
+        System.out.println("查到的所有部门对应的任务号列表:");
+        System.out.println(tasknoList);
+        if (tasknoList.isEmpty()) return Result.OK(indexChartInfoVo);
+
+        System.out.println(indexChartInfoVo);
+
+        //4.计算该时间列表中某年或某月对应的总利润额
+        List<BigDecimal> seriesDataList2 = new ArrayList<>();
+        for(String timeRange2:timeRangeList){
+            //根据日期和当前部门对应的任务号查询,部门某年或某月的年收入
+            if(timeType.equals("year")){
+                BigDecimal yearTotal = exchangeMapper.getReceivedByYear(tasknoList, timeRange2);
+                if(yearTotal == null){
+                    yearTotal = initValue;
+                }
+                seriesDataList2.add(yearTotal);
+            }
+            else if(timeType.equals("month")){
+                BigDecimal yearTotal = exchangeMapper.getReceivedByYMonth(tasknoList, timeRange2);
+                if(yearTotal == null){
+                    yearTotal = initValue;
+                }
+                seriesDataList2.add(yearTotal);
+            }
+        }
+        //添加纵坐标列表
+        indexChartInfoVo.setSeriesData(seriesDataList2);
+        return Result.OK(indexChartInfoVo);
+
+    }
+
 }

+ 7 - 0
module_kzks/src/main/java/org/jeecg/modules/xmcbDetail/mapper/ComContractInfoExchangeMapper.java

@@ -50,4 +50,11 @@ public interface ComContractInfoExchangeMapper extends BaseMapper<ComContractInf
     List<ContractAmount> getContractAmountandNumByYear(@Param("tasknoList") List<String> tasknoList, @Param("beginDate") Date beginDate, @Param("endDate") Date endDate);
 
     List<ContractAmount> getContractAmountandNumByMonth(@Param("tasknoList") List<String> tasknoList, @Param("beginDate") Date beginDate, @Param("endDate") Date endDate);
+
+    /*按年查询已收款*/
+    BigDecimal getReceivedByYear(@Param("tasknoList") List<String> tasknoList, @Param("year") String year);
+
+    /*按年月查询已收款*/
+    BigDecimal getReceivedByYMonth(@Param("tasknoList") List<String> tasknoList, @Param("ym") String ym);
+
 }

+ 22 - 0
module_kzks/src/main/java/org/jeecg/modules/xmcbDetail/mapper/xml/ComContractInfoExchangeMapper.xml

@@ -67,4 +67,26 @@
         </foreach>
         GROUP BY YEAR(qsrq)
     </select>
+
+    <!--按年查询已收款 -->
+    <select id="getReceivedByYear" resultType="java.math.BigDecimal">
+        select sum(a.rwskje)
+        from (select rwbh,dkhpdqrq,rwskje from com_contract_info_exchange where sjly = 40) a
+        where YEAR(a.dkhpdqrq)=#{year}
+        and a.rwbh in
+        <foreach item='item' index='index' collection='tasknoList' open='(' separator=',' close=')'>
+            #{item}
+        </foreach>
+    </select>
+    <!--按月查询已收款 -->
+    <select id="getReceivedByYMonth" resultType="java.math.BigDecimal">
+        select sum(a.rwskje)
+        from (select rwbh,dkhpdqrq,rwskje from com_contract_info_exchange where sjly = 40) a
+        where DATE_FORMAT(a.dkhpdqrq,"%Y-%m")=#{ym}
+        and a.rwbh in
+        <foreach item='item' index='index' collection='tasknoList' open='(' separator=',' close=')'>
+            #{item}
+        </foreach>
+    </select>
+
 </mapper>