Przeglądaj źródła

八项成本占比

丁治程 1 rok temu
rodzic
commit
fe94f941e3

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

@@ -2,6 +2,7 @@ package org.jeecg.modules.Index.controller;
 
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import jdk.nashorn.internal.runtime.linker.LinkerCallSite;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.ObjectUtils;
 import org.jeecg.common.api.vo.Result;
@@ -173,4 +174,11 @@ public class IndexController {
         return sumEightCostsList;
     }
 
+    @ApiOperation("领导驾驶舱---支出模块下二级汇总")
+    @GetMapping("/getEightCostsInfo")
+    public Result<List<ZhiChuCost>> getEightCostsInfo(IndexInfoParamDto indexInfoParamDto){
+        List<ZhiChuCost> list = indexZcbService.getEightCostsInfo(indexInfoParamDto);
+        return Result.ok(list);
+    }
+
 }

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

@@ -0,0 +1,29 @@
+package org.jeecg.modules.Index.entity.vo;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author dzc
+ * @date 2023/9/24 15:43
+ * @package org.jeecg.modules.Index.entity.vo
+ * @project yecai_server
+ * @des 支出模块二级总的实体
+ */
+@Data
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = false)
+public class ZhiChuCost implements Serializable {
+    private final static long serialVersionUID = 1L;
+
+    /** 图表的集合 */
+    private List<IndexChartInfoVo> chartInfoList;
+
+    /** 排行榜的集合*/
+    private List<ResultEightCost> eightCostPaiHang;
+
+}

+ 9 - 0
module_kzks/src/main/java/org/jeecg/modules/Index/service/IndexZcbService.java

@@ -4,6 +4,7 @@ import org.jeecg.modules.Index.entity.vo.ResultEightCost;
 import org.jeecg.modules.Index.entity.vo.IndexTotalVo;
 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 java.time.LocalDate;
 import java.time.YearMonth;
@@ -98,4 +99,12 @@ public interface IndexZcbService {
     *   date: 2023/9/24
     */
     public void getPcTasknoList();
+
+    /**
+     *   author: dzc
+     *   version: 1.0
+     *   des: 支出统计二级汇总
+     *   date: 2023/9/24
+     */
+    public List<ZhiChuCost> getEightCostsInfo(IndexInfoParamDto indexInfoParamDto);
 }

+ 61 - 18
module_kzks/src/main/java/org/jeecg/modules/Index/service/impl/IndexZcbServiceImpl.java

@@ -7,11 +7,8 @@ import org.jeecg.common.system.api.ISysBaseAPI;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.RedisUtil;
-import org.jeecg.modules.Index.entity.vo.ResultEightCost;
-import org.jeecg.modules.Index.entity.vo.EightCosts;
-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.mapper.IndexZcbMapper;
 import org.jeecg.modules.Index.service.IndexZcbService;
 import org.jeecg.modules.Index.util.AuthMark;
@@ -42,10 +39,6 @@ public class IndexZcbServiceImpl implements IndexZcbService {
     @SuppressWarnings("all")
     private IndexZcbMapper indexZcbMapper;
 
-    //@Autowired
-    //@SuppressWarnings("all")
-    //private RedisTemplate<String,String> redisTemplate;
-
     @Autowired
     @SuppressWarnings("all")
     private RedisUtil redisUtil;
@@ -467,6 +460,7 @@ public class IndexZcbServiceImpl implements IndexZcbService {
                 List<EightCosts> e1 = indexZcbMapper.getEightCostDepartByDate(beginDate, endDate, pcList);
                 if (!ObjectUtil.isEmpty(e1)){
                     HashMap<String, BigDecimal> m = new HashMap<>();
+                    BigDecimal sumZcb = BigDecimal.valueOf(0);
                     for (EightCosts e:e1) {
                         m.put("clf",e.getClf());
                         m.put("zyf",e.getZyf());
@@ -476,6 +470,7 @@ public class IndexZcbServiceImpl implements IndexZcbService {
                         m.put("gdzczj",e.getGdzczj());
                         m.put("gzjlwf",e.getGzjlwf());
                         m.put("glf",e.getGlf());
+                        sumZcb = e.getClf().add(e.getZyf()).add(e.getSwf()).add(e.getWxf()).add(e.getRldlf()).add(e.getGdzczj()).add(e.getGzjlwf()).add(e.getGlf());
                     }
                     Map<String, BigDecimal> sortedMap = m.entrySet()
                             .stream()
@@ -484,8 +479,10 @@ public class IndexZcbServiceImpl implements IndexZcbService {
                                     (oldValue, newValue) -> oldValue, LinkedHashMap::new));
 
                     for (Map.Entry<String, BigDecimal> entry : sortedMap.entrySet()) {
+                        BigDecimal divide = entry.getValue().divide(sumZcb, 2, BigDecimal.ROUND_HALF_UP);
+                        BigDecimal mul = divide.multiply(BigDecimal.valueOf(100));
                         ResultEightCost resultEightCost = new ResultEightCost();
-                        resultEightCost.setName(entry.getKey());
+                        resultEightCost.setName(entry.getKey()+"-"+mul+"%");
                         resultEightCost.setValue(entry.getValue());
                         resultList.add(resultEightCost);
                     }
@@ -497,6 +494,7 @@ public class IndexZcbServiceImpl implements IndexZcbService {
                 List<EightCosts> e2 = indexZcbMapper.getEightCostZrDepartByDate(deptList, beginDate, endDate,pcList);
                 if (e1.size() > 0 && e2.size() == 0){
                     HashMap<String, BigDecimal> m = new HashMap<>();
+                    BigDecimal sumZcb = BigDecimal.valueOf(0);
                     for (EightCosts e:e1) {
                         m.put("clf",e.getClf());
                         m.put("zyf",e.getZyf());
@@ -506,6 +504,7 @@ public class IndexZcbServiceImpl implements IndexZcbService {
                         m.put("gdzczj",e.getGdzczj());
                         m.put("gzjlwf",e.getGzjlwf());
                         m.put("glf",e.getGlf());
+                        sumZcb = e.getClf().add(e.getZyf()).add(e.getSwf()).add(e.getWxf()).add(e.getRldlf()).add(e.getGdzczj()).add(e.getGzjlwf()).add(e.getGlf());
                     }
                     Map<String, BigDecimal> sortedMap = m.entrySet()
                             .stream()
@@ -514,14 +513,17 @@ public class IndexZcbServiceImpl implements IndexZcbService {
                                     (oldValue, newValue) -> oldValue, LinkedHashMap::new));
 
                     for (Map.Entry<String, BigDecimal> entry : sortedMap.entrySet()) {
+                        BigDecimal divide = entry.getValue().divide(sumZcb, 2, BigDecimal.ROUND_HALF_UP);
+                        BigDecimal mul = divide.multiply(BigDecimal.valueOf(100));
                         ResultEightCost resultEightCost = new ResultEightCost();
-                        resultEightCost.setName(entry.getKey());
+                        resultEightCost.setName(entry.getKey()+"-"+mul+"%");
                         resultEightCost.setValue(entry.getValue());
                         resultList.add(resultEightCost);
                     }
                 }
                 if (e1.size() == 0 && e2.size() > 0){
                     HashMap<String, BigDecimal> m = new HashMap<>();
+                    BigDecimal sumZcb = BigDecimal.valueOf(0);
                     for (EightCosts e:e2) {
                         m.put("clf",e.getClf());
                         m.put("zyf",e.getZyf());
@@ -531,6 +533,7 @@ public class IndexZcbServiceImpl implements IndexZcbService {
                         m.put("gdzczj",e.getGdzczj());
                         m.put("gzjlwf",e.getGzjlwf());
                         m.put("glf",e.getGlf());
+                        sumZcb = e.getClf().add(e.getZyf()).add(e.getSwf()).add(e.getWxf()).add(e.getRldlf()).add(e.getGdzczj()).add(e.getGzjlwf()).add(e.getGlf());
                     }
                     Map<String, BigDecimal> sortedMap = m.entrySet()
                             .stream()
@@ -539,8 +542,10 @@ public class IndexZcbServiceImpl implements IndexZcbService {
                                     (oldValue, newValue) -> oldValue, LinkedHashMap::new));
 
                     for (Map.Entry<String, BigDecimal> entry : sortedMap.entrySet()) {
+                        BigDecimal divide = entry.getValue().divide(sumZcb, 2, BigDecimal.ROUND_HALF_UP);
+                        BigDecimal mul = divide.multiply(BigDecimal.valueOf(100));
                         ResultEightCost resultEightCost = new ResultEightCost();
-                        resultEightCost.setName(entry.getKey());
+                        resultEightCost.setName(entry.getKey()+"-"+mul+"%");
                         resultEightCost.setValue(entry.getValue());
                         resultList.add(resultEightCost);
                     }
@@ -562,6 +567,7 @@ public class IndexZcbServiceImpl implements IndexZcbService {
                         eightCostsList.add(eightCosts);
                     }
                     HashMap<String, BigDecimal> m = new HashMap<>();
+                    BigDecimal sumZcb = BigDecimal.valueOf(0);
                     for (EightCosts e:eightCostsList) {
                         m.put("clf",e.getClf());
                         m.put("zyf",e.getZyf());
@@ -571,6 +577,7 @@ public class IndexZcbServiceImpl implements IndexZcbService {
                         m.put("gdzczj",e.getGdzczj());
                         m.put("gzjlwf",e.getGzjlwf());
                         m.put("glf",e.getGlf());
+                        sumZcb = e.getClf().add(e.getZyf()).add(e.getSwf()).add(e.getWxf()).add(e.getRldlf()).add(e.getGdzczj()).add(e.getGzjlwf()).add(e.getGlf());
                     }
                     Map<String, BigDecimal> sortedMap = m.entrySet()
                             .stream()
@@ -579,8 +586,10 @@ public class IndexZcbServiceImpl implements IndexZcbService {
                                     (oldValue, newValue) -> oldValue, LinkedHashMap::new));
 
                     for (Map.Entry<String, BigDecimal> entry : sortedMap.entrySet()) {
+                        BigDecimal divide = entry.getValue().divide(sumZcb, 2, BigDecimal.ROUND_HALF_UP);
+                        BigDecimal mul = divide.multiply(BigDecimal.valueOf(100));
                         ResultEightCost resultEightCost = new ResultEightCost();
-                        resultEightCost.setName(entry.getKey());
+                        resultEightCost.setName(entry.getKey()+"-"+mul+"%");
                         resultEightCost.setValue(entry.getValue());
                         resultList.add(resultEightCost);
                     }
@@ -606,7 +615,7 @@ public class IndexZcbServiceImpl implements IndexZcbService {
 
                 for (Map.Entry<String, BigDecimal> entry : sortedMap.entrySet()) {
                     ResultEightCost resultEightCost = new ResultEightCost();
-                    resultEightCost.setName(entry.getKey());
+                    resultEightCost.setName(entry.getKey()+"-0%");
                     resultEightCost.setValue(entry.getValue());
                     resultList.add(resultEightCost);
                 }
@@ -621,6 +630,7 @@ public class IndexZcbServiceImpl implements IndexZcbService {
                 List<EightCosts> e1 = indexZcbMapper.getEightCostDepartByDate(beginDate, endDate, pcList);
                 if (!ObjectUtil.isEmpty(e1)){
                     HashMap<String, BigDecimal> m = new HashMap<>();
+                    BigDecimal sumZcb = BigDecimal.valueOf(0);
                     for (EightCosts e:e1) {
                         m.put("clf",e.getClf());
                         m.put("zyf",e.getZyf());
@@ -630,6 +640,7 @@ public class IndexZcbServiceImpl implements IndexZcbService {
                         m.put("gdzczj",e.getGdzczj());
                         m.put("gzjlwf",e.getGzjlwf());
                         m.put("glf",e.getGlf());
+                        sumZcb = e.getClf().add(e.getZyf()).add(e.getSwf()).add(e.getWxf()).add(e.getRldlf()).add(e.getGdzczj()).add(e.getGzjlwf()).add(e.getGlf());
                     }
                     Map<String, BigDecimal> sortedMap = m.entrySet()
                             .stream()
@@ -638,8 +649,10 @@ public class IndexZcbServiceImpl implements IndexZcbService {
                                     (oldValue, newValue) -> oldValue, LinkedHashMap::new));
 
                     for (Map.Entry<String, BigDecimal> entry : sortedMap.entrySet()) {
+                        BigDecimal divide = entry.getValue().divide(sumZcb, 2, BigDecimal.ROUND_HALF_UP);
+                        BigDecimal mul = divide.multiply(BigDecimal.valueOf(100));
                         ResultEightCost resultEightCost = new ResultEightCost();
-                        resultEightCost.setName(entry.getKey());
+                        resultEightCost.setName(entry.getKey()+"-"+mul+"%");
                         resultEightCost.setValue(entry.getValue());
                         resultList.add(resultEightCost);
                     }
@@ -650,6 +663,7 @@ public class IndexZcbServiceImpl implements IndexZcbService {
                 List<EightCosts> e2 = indexZcbMapper.getEightCostZrDepartByDate(deptList, beginDate, endDate,pcList);
                 if (e1.size() > 0 && e2.size() == 0){
                     HashMap<String, BigDecimal> m = new HashMap<>();
+                    BigDecimal sumZcb = BigDecimal.valueOf(0);
                     for (EightCosts e:e1) {
                         m.put("clf",e.getClf());
                         m.put("zyf",e.getZyf());
@@ -659,6 +673,7 @@ public class IndexZcbServiceImpl implements IndexZcbService {
                         m.put("gdzczj",e.getGdzczj());
                         m.put("gzjlwf",e.getGzjlwf());
                         m.put("glf",e.getGlf());
+                        sumZcb = e.getClf().add(e.getZyf()).add(e.getSwf()).add(e.getWxf()).add(e.getRldlf()).add(e.getGdzczj()).add(e.getGzjlwf()).add(e.getGlf());
                     }
                     Map<String, BigDecimal> sortedMap = m.entrySet()
                             .stream()
@@ -667,14 +682,17 @@ public class IndexZcbServiceImpl implements IndexZcbService {
                                     (oldValue, newValue) -> oldValue, LinkedHashMap::new));
 
                     for (Map.Entry<String, BigDecimal> entry : sortedMap.entrySet()) {
+                        BigDecimal divide = entry.getValue().divide(sumZcb, 2, BigDecimal.ROUND_HALF_UP);
+                        BigDecimal mul = divide.multiply(BigDecimal.valueOf(100));
                         ResultEightCost resultEightCost = new ResultEightCost();
-                        resultEightCost.setName(entry.getKey());
+                        resultEightCost.setName(entry.getKey()+"-"+mul+"%");
                         resultEightCost.setValue(entry.getValue());
                         resultList.add(resultEightCost);
                     }
                 }
                 if (e1.size() == 0 && e2.size() > 0){
                     HashMap<String, BigDecimal> m = new HashMap<>();
+                    BigDecimal sumZcb = BigDecimal.valueOf(0);
                     for (EightCosts e:e2) {
                         m.put("clf",e.getClf());
                         m.put("zyf",e.getZyf());
@@ -684,6 +702,7 @@ public class IndexZcbServiceImpl implements IndexZcbService {
                         m.put("gdzczj",e.getGdzczj());
                         m.put("gzjlwf",e.getGzjlwf());
                         m.put("glf",e.getGlf());
+                        sumZcb = e.getClf().add(e.getZyf()).add(e.getSwf()).add(e.getWxf()).add(e.getRldlf()).add(e.getGdzczj()).add(e.getGzjlwf()).add(e.getGlf());
                     }
                     Map<String, BigDecimal> sortedMap = m.entrySet()
                             .stream()
@@ -692,8 +711,10 @@ public class IndexZcbServiceImpl implements IndexZcbService {
                                     (oldValue, newValue) -> oldValue, LinkedHashMap::new));
 
                     for (Map.Entry<String, BigDecimal> entry : sortedMap.entrySet()) {
+                        BigDecimal divide = entry.getValue().divide(sumZcb, 2, BigDecimal.ROUND_HALF_UP);
+                        BigDecimal mul = divide.multiply(BigDecimal.valueOf(100));
                         ResultEightCost resultEightCost = new ResultEightCost();
-                        resultEightCost.setName(entry.getKey());
+                        resultEightCost.setName(entry.getKey()+"-"+mul+"%");
                         resultEightCost.setValue(entry.getValue());
                         resultList.add(resultEightCost);
                     }
@@ -715,6 +736,7 @@ public class IndexZcbServiceImpl implements IndexZcbService {
                         eightCostsList.add(eightCosts);
                     }
                     HashMap<String, BigDecimal> m = new HashMap<>();
+                    BigDecimal sumZcb = BigDecimal.valueOf(0);
                     for (EightCosts e:eightCostsList) {
                         m.put("clf",e.getClf());
                         m.put("zyf",e.getZyf());
@@ -724,6 +746,7 @@ public class IndexZcbServiceImpl implements IndexZcbService {
                         m.put("gdzczj",e.getGdzczj());
                         m.put("gzjlwf",e.getGzjlwf());
                         m.put("glf",e.getGlf());
+                        sumZcb = e.getClf().add(e.getZyf()).add(e.getSwf()).add(e.getWxf()).add(e.getRldlf()).add(e.getGdzczj()).add(e.getGzjlwf()).add(e.getGlf());
                     }
                     Map<String, BigDecimal> sortedMap = m.entrySet()
                             .stream()
@@ -732,8 +755,10 @@ public class IndexZcbServiceImpl implements IndexZcbService {
                                     (oldValue, newValue) -> oldValue, LinkedHashMap::new));
 
                     for (Map.Entry<String, BigDecimal> entry : sortedMap.entrySet()) {
+                        BigDecimal divide = entry.getValue().divide(sumZcb, 2, BigDecimal.ROUND_HALF_UP);
+                        BigDecimal mul = divide.multiply(BigDecimal.valueOf(100));
                         ResultEightCost resultEightCost = new ResultEightCost();
-                        resultEightCost.setName(entry.getKey());
+                        resultEightCost.setName(entry.getKey()+"-"+mul+"%");
                         resultEightCost.setValue(entry.getValue());
                         resultList.add(resultEightCost);
                     }
@@ -759,7 +784,7 @@ public class IndexZcbServiceImpl implements IndexZcbService {
 
                 for (Map.Entry<String, BigDecimal> entry : sortedMap.entrySet()) {
                     ResultEightCost resultEightCost = new ResultEightCost();
-                    resultEightCost.setName(entry.getKey());
+                    resultEightCost.setName(entry.getKey()+"-0%");
                     resultEightCost.setValue(entry.getValue());
                     resultList.add(resultEightCost);
                 }
@@ -881,4 +906,22 @@ public class IndexZcbServiceImpl implements IndexZcbService {
         pcList.addAll(pcTasknoSonList);
         redisUtil.set("pcList",pcList,1000L * 60 * 60 * 2);
     }
+
+    /**
+     *   author: dzc
+     *   version: 1.0
+     *   des: 支出统计二级汇总
+     *   date: 2023/9/24
+     */
+    @Override
+    public List<ZhiChuCost> getEightCostsInfo(IndexInfoParamDto indexInfoParamDto) {
+        ArrayList<ZhiChuCost> zhiChuCostsList = new ArrayList<>();
+        List<IndexChartInfoVo> chartInfoList = getEightCostsList(indexInfoParamDto);
+        List<ResultEightCost> sumEightCosts = getSumEightCosts(indexInfoParamDto);
+        ZhiChuCost zhiChuCost = new ZhiChuCost();
+        zhiChuCost.setChartInfoList(chartInfoList);
+        zhiChuCost.setEightCostPaiHang(sumEightCosts);
+        zhiChuCostsList.add(zhiChuCost);
+        return zhiChuCostsList;
+    }
 }