Ver código fonte

新增 数据源切换后使用通配符批量删除redis缓存

longw 1 ano atrás
pai
commit
5cdac083c1

+ 141 - 154
module_kzks/src/main/java/org/jeecg/modules/Index/service/impl/IndexServiceImpl.java

@@ -94,7 +94,6 @@ public class IndexServiceImpl implements IndexService {
     private IProjectCostService projectCostService;
 
 
-
     private static final String YEAR = "year";
 
     private static final String MONTH = "month";
@@ -127,7 +126,7 @@ public class IndexServiceImpl implements IndexService {
                 stringBuilder.append(departName).append("|");
             }
             depart = stringBuilder.toString();
-            IndexTotalVo cacheObject = (IndexTotalVo) redisUtil.get(CacheKey.INCOME_DATA_REDIS_KEY + depart + ":" + role);
+            IndexTotalVo cacheObject = (IndexTotalVo) redisUtil.get(CacheKey.INCOME_DATA_REDIS_KEY + ":" + depart + ":" + role);
             if (ObjectUtils.isNotEmpty(cacheObject)) {
                 incomeDataInfoVO = cacheObject;
                 return incomeDataInfoVO;
@@ -142,7 +141,7 @@ public class IndexServiceImpl implements IndexService {
 
         if (depart == null) {
             depart = "Boss";
-            IndexTotalVo cacheObject = (IndexTotalVo) redisUtil.get(CacheKey.INCOME_DATA_REDIS_KEY + depart + ":" + role);
+            IndexTotalVo cacheObject = (IndexTotalVo) redisUtil.get(CacheKey.INCOME_DATA_REDIS_KEY + ":" + depart + ":" + role);
             if (ObjectUtils.isNotEmpty(cacheObject)) {
                 incomeDataInfoVO = cacheObject;
                 return incomeDataInfoVO;
@@ -248,9 +247,9 @@ public class IndexServiceImpl implements IndexService {
         BigDecimal lastMothTqTotal = lastMothTqTotalFuture.join();
         BigDecimal lastYearMonthTqTotal = lastYearMonthTqTotalFuture.join();
 
-        incomeDataInfoVO.setYearTotal(currentYearTotal.setScale(2,RoundingMode.HALF_UP));
-        incomeDataInfoVO.setYearTq(lastYearTqTotal.setScale(2,RoundingMode.HALF_UP));
-        incomeDataInfoVO.setMonthTotal(currentMonthTotal.setScale(2,RoundingMode.HALF_UP));
+        incomeDataInfoVO.setYearTotal(currentYearTotal.setScale(2, RoundingMode.HALF_UP));
+        incomeDataInfoVO.setYearTq(lastYearTqTotal.setScale(2, RoundingMode.HALF_UP));
+        incomeDataInfoVO.setMonthTotal(currentMonthTotal.setScale(2, RoundingMode.HALF_UP));
 
 
         CompletableFuture<BigDecimal> incomeYearTbFuture = CompletableFuture.supplyAsync(() -> {
@@ -283,11 +282,11 @@ public class IndexServiceImpl implements IndexService {
         BigDecimal incomeYearTb = incomeYearTbFuture.join();
         BigDecimal incomeMothHb = incomeMothHbFuture.join();
         BigDecimal incomeYearMothTb = incomeYearMothTbFuture.join();
-        incomeDataInfoVO.setYearTb(incomeYearTb.setScale(2,RoundingMode.HALF_UP));
-        incomeDataInfoVO.setMonthTb(incomeYearMothTb.setScale(2,RoundingMode.HALF_UP));
-        incomeDataInfoVO.setMonthHb(incomeMothHb.setScale(2,RoundingMode.HALF_UP));
+        incomeDataInfoVO.setYearTb(incomeYearTb.setScale(2, RoundingMode.HALF_UP));
+        incomeDataInfoVO.setMonthTb(incomeYearMothTb.setScale(2, RoundingMode.HALF_UP));
+        incomeDataInfoVO.setMonthHb(incomeMothHb.setScale(2, RoundingMode.HALF_UP));
 
-        redisUtil.set(CacheKey.INCOME_DATA_REDIS_KEY + depart + ":" + role, incomeDataInfoVO, 1000L * 60 * 60 * 2);
+        redisUtil.set(CacheKey.INCOME_DATA_REDIS_KEY + ":" + depart + ":" + role, incomeDataInfoVO, 1000L * 60 * 60 * 10);
 
         return incomeDataInfoVO;
     }
@@ -323,7 +322,7 @@ public class IndexServiceImpl implements IndexService {
                 stringBuilder.append(departName).append("|");
             }
             depart = stringBuilder.toString();
-            IndexTotalVo cacheObject = (IndexTotalVo) redisUtil.get(CacheKey.CONTRACT_DATA_REDIS_KEY + depart + ":" + role);
+            IndexTotalVo cacheObject = (IndexTotalVo) redisUtil.get(CacheKey.CONTRACT_DATA_REDIS_KEY + ":" + depart + ":" + role);
             if (ObjectUtils.isNotEmpty(cacheObject)) {
                 totalContractNumInfoVO = cacheObject;
                 return totalContractNumInfoVO;
@@ -337,7 +336,7 @@ public class IndexServiceImpl implements IndexService {
         }
         if (depart == null) {
             depart = "Boss";
-            IndexTotalVo cacheObject = (IndexTotalVo) redisUtil.get(CacheKey.CONTRACT_DATA_REDIS_KEY + depart + ":" + role);
+            IndexTotalVo cacheObject = (IndexTotalVo) redisUtil.get(CacheKey.CONTRACT_DATA_REDIS_KEY + ":" + depart + ":" + role);
             if (ObjectUtils.isNotEmpty(cacheObject)) {
                 totalContractNumInfoVO = cacheObject;
                 return totalContractNumInfoVO;
@@ -443,9 +442,9 @@ public class IndexServiceImpl implements IndexService {
         BigDecimal lastMothTqTotal = lastMothTqTotalFuture.join();
         BigDecimal lastYearMonthTqTotal = lastYearMonthTqTotalFuture.join();
 
-        totalContractNumInfoVO.setYearTotal(currentYearTotal.setScale(2,RoundingMode.HALF_UP));
-        totalContractNumInfoVO.setYearTq(lastYearTqTotal.setScale(2,RoundingMode.HALF_UP));
-        totalContractNumInfoVO.setMonthTotal(currentMonthTotal.setScale(2,RoundingMode.HALF_UP));
+        totalContractNumInfoVO.setYearTotal(currentYearTotal.setScale(2, RoundingMode.HALF_UP));
+        totalContractNumInfoVO.setYearTq(lastYearTqTotal.setScale(2, RoundingMode.HALF_UP));
+        totalContractNumInfoVO.setMonthTotal(currentMonthTotal.setScale(2, RoundingMode.HALF_UP));
 
 
         CompletableFuture<BigDecimal> yearTbFuture = CompletableFuture.supplyAsync(() -> {
@@ -478,11 +477,11 @@ public class IndexServiceImpl implements IndexService {
         BigDecimal yearTb = yearTbFuture.join();
         BigDecimal mothHb = mothHbFuture.join();
         BigDecimal yearMothTb = yearMothTbFuture.join();
-        totalContractNumInfoVO.setYearTb(yearTb.setScale(2,RoundingMode.HALF_UP));
-        totalContractNumInfoVO.setMonthTb(yearMothTb.setScale(2,RoundingMode.HALF_UP));
-        totalContractNumInfoVO.setMonthHb(mothHb.setScale(2,RoundingMode.HALF_UP));
+        totalContractNumInfoVO.setYearTb(yearTb.setScale(2, RoundingMode.HALF_UP));
+        totalContractNumInfoVO.setMonthTb(yearMothTb.setScale(2, RoundingMode.HALF_UP));
+        totalContractNumInfoVO.setMonthHb(mothHb.setScale(2, RoundingMode.HALF_UP));
 
-        redisUtil.set(CacheKey.CONTRACT_DATA_REDIS_KEY + depart + ":" + role, totalContractNumInfoVO, 1000L * 60 * 60 * 2);
+        redisUtil.set(CacheKey.CONTRACT_DATA_REDIS_KEY + ":" + depart + ":" + role, totalContractNumInfoVO, 1000L * 60 * 60 * 10);
 
         return totalContractNumInfoVO;
     }
@@ -517,7 +516,7 @@ public class IndexServiceImpl implements IndexService {
                 stringBuilder.append(departName).append("|");
             }
             depart = stringBuilder.toString();
-            IndexTotalVo cacheObject = (IndexTotalVo) redisUtil.get(CacheKey.RECEIVED_DATA_REDIS_KEY + depart + ":" + role);
+            IndexTotalVo cacheObject = (IndexTotalVo) redisUtil.get(CacheKey.RECEIVED_DATA_REDIS_KEY + ":" + depart + ":" + role);
             if (ObjectUtils.isNotEmpty(cacheObject)) {
                 indexTotalVo = cacheObject;
                 return indexTotalVo;
@@ -532,7 +531,7 @@ public class IndexServiceImpl implements IndexService {
         }
         if (depart == null) {
             depart = "Boss";
-            IndexTotalVo cacheObject = (IndexTotalVo) redisUtil.get(CacheKey.RECEIVED_DATA_REDIS_KEY + depart + ":" + role);
+            IndexTotalVo cacheObject = (IndexTotalVo) redisUtil.get(CacheKey.RECEIVED_DATA_REDIS_KEY + ":" + depart + ":" + role);
             if (ObjectUtils.isNotEmpty(cacheObject)) {
                 indexTotalVo = cacheObject;
                 return indexTotalVo;
@@ -636,9 +635,9 @@ public class IndexServiceImpl implements IndexService {
         BigDecimal lastMothTqTotal = lastMothTqTotalFuture.join();
         BigDecimal lastYearMonthTqTotal = lastYearMonthTqTotalFuture.join();
 
-        indexTotalVo.setYearTotal(currentYearTotal.setScale(2,RoundingMode.HALF_UP));
-        indexTotalVo.setYearTq(lastYearTqTotal.setScale(2,RoundingMode.HALF_UP));
-        indexTotalVo.setMonthTotal(currentMonthTotal.setScale(2,RoundingMode.HALF_UP));
+        indexTotalVo.setYearTotal(currentYearTotal.setScale(2, RoundingMode.HALF_UP));
+        indexTotalVo.setYearTq(lastYearTqTotal.setScale(2, RoundingMode.HALF_UP));
+        indexTotalVo.setMonthTotal(currentMonthTotal.setScale(2, RoundingMode.HALF_UP));
 
 
         CompletableFuture<BigDecimal> yearTbFuture = CompletableFuture.supplyAsync(() -> {
@@ -671,11 +670,11 @@ public class IndexServiceImpl implements IndexService {
         BigDecimal yearTb = yearTbFuture.join();
         BigDecimal mothHb = mothHbFuture.join();
         BigDecimal yearMothTb = yearMothTbFuture.join();
-        indexTotalVo.setYearTb(yearTb.setScale(2,RoundingMode.HALF_UP));
-        indexTotalVo.setMonthTb(yearMothTb.setScale(2,RoundingMode.HALF_UP));
-        indexTotalVo.setMonthHb(mothHb.setScale(2,RoundingMode.HALF_UP));
+        indexTotalVo.setYearTb(yearTb.setScale(2, RoundingMode.HALF_UP));
+        indexTotalVo.setMonthTb(yearMothTb.setScale(2, RoundingMode.HALF_UP));
+        indexTotalVo.setMonthHb(mothHb.setScale(2, RoundingMode.HALF_UP));
 
-        redisUtil.set(CacheKey.RECEIVED_DATA_REDIS_KEY + depart + ":" + role, indexTotalVo, 1000L * 60 * 60 * 2);
+        redisUtil.set(CacheKey.RECEIVED_DATA_REDIS_KEY + ":" + depart + ":" + role, indexTotalVo, 1000L * 60 * 60 * 10);
 
         return indexTotalVo;
     }
@@ -766,7 +765,7 @@ public class IndexServiceImpl implements IndexService {
                 stringBuilder.append(departName).append("|");
             }
             depart = stringBuilder.toString();
-            Object cacheObject = redisUtil.get(CacheKey.CONTRACT_CHART_INFO_DATA_REDIS_KEY + depart + ":" + role +":"+string);
+            Object cacheObject = redisUtil.get(CacheKey.CONTRACT_CHART_INFO_DATA_REDIS_KEY + ":" + depart + ":" + role + ":" + string);
             ContractChartInfoVo Object = JSONObject.parseObject(JSONObject.toJSONString(cacheObject), new TypeReference<ContractChartInfoVo>() {
             });
             if (ObjectUtils.isNotEmpty(cacheObject)) {
@@ -783,7 +782,7 @@ public class IndexServiceImpl implements IndexService {
 
         if (depart == null) {
             depart = "Boss";
-            Object cacheObject = redisUtil.get(CacheKey.CONTRACT_CHART_INFO_DATA_REDIS_KEY + depart + ":" + role+":"+string);
+            Object cacheObject = redisUtil.get(CacheKey.CONTRACT_CHART_INFO_DATA_REDIS_KEY + ":" + depart + ":" + role + ":" + string);
             ContractChartInfoVo Object = JSONObject.parseObject(JSONObject.toJSONString(cacheObject), new TypeReference<ContractChartInfoVo>() {
             });
             if (ObjectUtils.isNotEmpty(cacheObject)) {
@@ -809,7 +808,7 @@ public class IndexServiceImpl implements IndexService {
         ContractChartInfoVo newResVo = new ContractChartInfoVo();
         for (ContractAmount amount : contractAmountList) {
             String dateResult = amount.getDate();
-            BigDecimal contractAmountResult = amount.getContractAmount().setScale(2,RoundingMode.HALF_UP);
+            BigDecimal contractAmountResult = amount.getContractAmount().setScale(2, RoundingMode.HALF_UP);
             Long contractTotalResult = amount.getContractTotal();
 
             for (int i = 0; i < xAxisData.size(); i++) {
@@ -826,7 +825,7 @@ public class IndexServiceImpl implements IndexService {
         newResVo.setContractAmount(contractAmount);
         newResVo.setContractTotal(contractTotal);
 
-        redisUtil.set(CacheKey.CONTRACT_CHART_INFO_DATA_REDIS_KEY + depart + ":" + role +":" + string, newResVo, 1000L * 60 * 60 * 2);
+        redisUtil.set(CacheKey.CONTRACT_CHART_INFO_DATA_REDIS_KEY + ":" + depart + ":" + role + ":" + string, newResVo, 1000L * 60 * 60 * 10);
         return newResVo;
     }
 
@@ -1113,7 +1112,7 @@ public class IndexServiceImpl implements IndexService {
      *
      * @return
      */
-    public List<String> getTaskNoListFDepTime2(String timeType, String timeRange){
+    public List<String> getTaskNoListFDepTime2(String timeType, String timeRange) {
         //2.根据部门名称(zrbm、jycs)和实际完成时间查询taskno
         List<String> taskNoList = new ArrayList<>();
         switch (timeType) {
@@ -1261,7 +1260,7 @@ public class IndexServiceImpl implements IndexService {
      *
      * @return
      */
-    public IndexTotalVo countLreAll(){
+    public IndexTotalVo countLreAll() {
         BigDecimal initValue = BigDecimal.valueOf(0);
         IndexTotalVo lreDataInfoVo = new IndexTotalVo();
         lreDataInfoVo.setYearTotal(initValue);
@@ -1282,7 +1281,7 @@ public class IndexServiceImpl implements IndexService {
         BigDecimal sumLreYear = countLreByTaskNo(taskNoListNew);
         System.out.println("当年的利润额为:");
         System.out.println(sumLreYear);
-        if(sumLreYear == null){
+        if (sumLreYear == null) {
             sumLreYear = initValue;
         }
         lreDataInfoVo.setYearTotal(sumLreYear);
@@ -1295,7 +1294,7 @@ public class IndexServiceImpl implements IndexService {
         BigDecimal sumLreLastYear = countLreByTaskNo(taskNoListNew2);
         System.out.println("上一年的利润额为:");
         System.out.println(sumLreLastYear);
-        if(sumLreLastYear == null){
+        if (sumLreLastYear == null) {
             sumLreLastYear = initValue;
         }
         lreDataInfoVo.setYearTq(sumLreLastYear);
@@ -1319,7 +1318,7 @@ public class IndexServiceImpl implements IndexService {
         BigDecimal sumLreCurrMonth = countLreByTaskNo(taskNoListNew3);
         System.out.println("当月的利润额为:");
         System.out.println(sumLreCurrMonth);
-        if(sumLreCurrMonth == null){
+        if (sumLreCurrMonth == null) {
             sumLreCurrMonth = initValue;
         }
         lreDataInfoVo.setMonthTotal(sumLreCurrMonth);
@@ -1332,7 +1331,7 @@ public class IndexServiceImpl implements IndexService {
         BigDecimal sumLreLastMonth = countLreByTaskNo(taskNoListNew4);
         System.out.println("上个月的利润额为:");
         System.out.println(sumLreLastMonth);
-        if(sumLreLastMonth == null){
+        if (sumLreLastMonth == null) {
             sumLreLastMonth = initValue;
         }
         System.out.println("----------------------------------------------------");
@@ -1355,7 +1354,7 @@ public class IndexServiceImpl implements IndexService {
         BigDecimal sumLreTqMonth = countLreByTaskNo(taskNoListNew5);
         System.out.println("去年同期月份的利润额为:");
         System.out.println(sumLreTqMonth);
-        if(sumLreTqMonth == null){
+        if (sumLreTqMonth == null) {
             sumLreTqMonth = initValue;
         }
         System.out.println("----------------------------------------------------");
@@ -1403,7 +1402,7 @@ public class IndexServiceImpl implements IndexService {
      * @param indexInfoParamDto
      * @return IndexChartInfoVo<BigDecimal>
      */
-    public IndexChartInfoVo<BigDecimal> countTotalReceivedByDate(IndexInfoParamDto indexInfoParamDto){
+    public IndexChartInfoVo<BigDecimal> countTotalReceivedByDate(IndexInfoParamDto indexInfoParamDto) {
         //1.创建一个IndexChartInfoVo实例用来存储最后返回前端的信息
         IndexChartInfoVo<BigDecimal> indexChartInfoVo = new IndexChartInfoVo<>();
         BigDecimal initValue = BigDecimal.valueOf(0); //某年或某月没有任务,已收款为0
@@ -1454,18 +1453,17 @@ public class IndexServiceImpl implements IndexService {
 
         //4.计算该时间列表中某年或某月对应的总利润额
         List<BigDecimal> seriesDataList2 = new ArrayList<>();
-        for(String timeRange2:timeRangeList){
+        for (String timeRange2 : timeRangeList) {
             //根据日期和当前部门对应的任务号查询,部门某年或某月的年收入
-            if(timeType.equals("year")){
+            if (timeType.equals("year")) {
                 BigDecimal yearTotal = exchangeMapper.getReceivedByYear(tasknoList, timeRange2);
-                if(yearTotal == null){
+                if (yearTotal == null) {
                     yearTotal = initValue;
                 }
                 seriesDataList2.add(yearTotal);
-            }
-            else if(timeType.equals("month")){
+            } else if (timeType.equals("month")) {
                 BigDecimal yearTotal = exchangeMapper.getReceivedByYMonth(tasknoList, timeRange2);
-                if(yearTotal == null){
+                if (yearTotal == null) {
                     yearTotal = initValue;
                 }
                 seriesDataList2.add(yearTotal);
@@ -1484,7 +1482,7 @@ public class IndexServiceImpl implements IndexService {
      * @param indexInfoParamDto
      * @return IndexChartInfoVo<BigDecimal>
      */
-    public IndexChartInfoVo<BigDecimal> countTotalReceivedAllByDate(IndexInfoParamDto indexInfoParamDto){
+    public IndexChartInfoVo<BigDecimal> countTotalReceivedAllByDate(IndexInfoParamDto indexInfoParamDto) {
         //1.创建一个IndexChartInfoVo实例用来存储最后返回前端的信息
         IndexChartInfoVo<BigDecimal> indexChartInfoVo = new IndexChartInfoVo<>();
         BigDecimal initValue = BigDecimal.valueOf(0); //某年或某月没有任务,已收款为0
@@ -1502,17 +1500,16 @@ public class IndexServiceImpl implements IndexService {
         String startString = indexInfoParamDto.getBeginDate();
         //结束时间
         String endString = indexInfoParamDto.getEndDate();
-        if(timeType.equals("year")){
+        if (timeType.equals("year")) {
             timeRangeList = getDateList(timeRangeList, startString, endString, "yyyy", timeType);
-        }
-        else if (timeType.equals("month")){
+        } else if (timeType.equals("month")) {
             timeRangeList = getDateList(timeRangeList, startString, endString, "yyyy-MM", timeType);
         }
 //        System.out.println("获取的日期列表为:");
 //        System.out.println(timeRangeList);
         if (timeRangeList.isEmpty()) return indexChartInfoVo;//日期为空,直接传回两个空list
         //根据日期长度初始化纵坐标值 0
-        for(String timeRange:timeRangeList){
+        for (String timeRange : timeRangeList) {
             seriesDataList.add(initValue);
         }
         //添加横坐标列表
@@ -1556,7 +1553,7 @@ public class IndexServiceImpl implements IndexService {
      *
      * @return
      */
-    public IndexChartInfoVo<BigDecimal> countLreByDate(IndexInfoParamDto indexInfoParamDto){
+    public IndexChartInfoVo<BigDecimal> countLreByDate(IndexInfoParamDto indexInfoParamDto) {
         //1.创建一个IndexChartInfoVo实例用来存储最后返回前端的信息
         IndexChartInfoVo<BigDecimal> indexChartInfoVo = new IndexChartInfoVo<>();
         BigDecimal initValue = BigDecimal.valueOf(0); //某年或某月没有任务,利润额为0
@@ -1628,7 +1625,7 @@ public class IndexServiceImpl implements IndexService {
      *
      * @return
      */
-    public IndexChartInfoVo<BigDecimal> countLreAllByDate(IndexInfoParamDto indexInfoParamDto){
+    public IndexChartInfoVo<BigDecimal> countLreAllByDate(IndexInfoParamDto indexInfoParamDto) {
         //1.创建一个IndexChartInfoVo实例用来存储最后返回前端的信息
         IndexChartInfoVo<BigDecimal> indexChartInfoVo = new IndexChartInfoVo<>();
         BigDecimal initValue = BigDecimal.valueOf(0); //某年或某月没有任务,利润额为0
@@ -1648,10 +1645,9 @@ public class IndexServiceImpl implements IndexService {
         //结束时间
         String endString = indexInfoParamDto.getEndDate();
 
-        if(timeType.equals("year")){
+        if (timeType.equals("year")) {
             timeRangeList = getDateList(timeRangeList, startString, endString, "yyyy", timeType);
-        }
-        else if (timeType.equals("month")){
+        } else if (timeType.equals("month")) {
             timeRangeList = getDateList(timeRangeList, startString, endString, "yyyy-MM", timeType);
         }
         System.out.println("获取的日期列表为:");
@@ -1659,7 +1655,7 @@ public class IndexServiceImpl implements IndexService {
 
         if (timeRangeList.isEmpty()) return indexChartInfoVo;//日期为空,直接传回两个空list
         //根据日期长度初始化纵坐标值 0
-        for(String timeRange:timeRangeList){
+        for (String timeRange : timeRangeList) {
             seriesDataList.add(initValue);
         }
         //初始化横坐标有日期时,相应的纵坐标先赋一个0
@@ -1670,7 +1666,7 @@ public class IndexServiceImpl implements IndexService {
 
         //4.计算该时间列表中某年或某月对应的总利润额
         List<BigDecimal> seriesDataList2 = new ArrayList<>();
-        for(String timeRange:timeRangeList) {
+        for (String timeRange : timeRangeList) {
             //根据时间和部门去查找任务号
             List<String> taskNoListNew = getTaskNoListFDepTime2(timeType, timeRange);
             System.out.println(timeRange + "的任务号列表:");
@@ -1724,7 +1720,7 @@ public class IndexServiceImpl implements IndexService {
      *
      * @return
      */
-    public List<String> testSl(){
+    public List<String> testSl() {
         List<String> tasknoList = new ArrayList<>();
         System.out.println(tasknoList);
 
@@ -1732,14 +1728,10 @@ public class IndexServiceImpl implements IndexService {
     }
 
 
-
-
-
-
     /**
      * 首页一层利润额参数类 IndexTotalVo 初始化
      */
-    public IndexTotalVo indexTotalVoInit(){
+    public IndexTotalVo indexTotalVoInit() {
         IndexTotalVo indexTotalVo = new IndexTotalVo();
         BigDecimal initValue = BigDecimal.valueOf(0);
         indexTotalVo.setYearTotal(initValue);
@@ -1755,70 +1747,70 @@ public class IndexServiceImpl implements IndexService {
      * 首页一层获取利润额  所长权限
      * 年总利润、上一年同期总利润、年同比、当月总利润、当月同比、当月环比
      */
-    public IndexTotalVo getLreOne(List<String> departNames){
+    public IndexTotalVo getLreOne(List<String> departNames) {
         //初始化
         IndexTotalVo indexTotalVo = indexTotalVoInit();
 
         //起线程 同时查找当年上一年当月上个月去年同期月份的任务号并计算利润额
-        CompletableFuture<BigDecimal> futureCurrYear = CompletableFuture.supplyAsync(() ->{
+        CompletableFuture<BigDecimal> futureCurrYear = CompletableFuture.supplyAsync(() -> {
             BigDecimal lreinit = BigDecimal.valueOf(0);
             //1.根据实际时间查询任务列表
             List<String> taskNoListCurrYear = indexMapper.getTaskNoByDepSjCurrYear(departNames);
             System.out.println("当年的任务列表为:");
             System.out.println(taskNoListCurrYear);
-            if(taskNoListCurrYear.isEmpty()) return lreinit;
+            if (taskNoListCurrYear.isEmpty()) return lreinit;
             BigDecimal lreCurrYear = indexMapper.getLreByTaskNoStatus(taskNoListCurrYear);
             System.out.println("当年的利润额为:");
             System.out.println(lreCurrYear);
-            if(ObjectUtils.isEmpty(lreCurrYear)) return lreinit;
+            if (ObjectUtils.isEmpty(lreCurrYear)) return lreinit;
             return lreCurrYear;
         });
-        CompletableFuture<BigDecimal> futureLastYear = CompletableFuture.supplyAsync(() ->{
+        CompletableFuture<BigDecimal> futureLastYear = CompletableFuture.supplyAsync(() -> {
             BigDecimal lreinit2 = BigDecimal.valueOf(0);
             List<String> taskNoListLastYear = indexMapper.getTaskNoByDepSjLastYear(departNames);
             System.out.println("上一年的任务列表为:");
             System.out.println(taskNoListLastYear);
-            if(taskNoListLastYear.isEmpty()) return lreinit2;
+            if (taskNoListLastYear.isEmpty()) return lreinit2;
             BigDecimal lreLastYear = indexMapper.getLreByTaskNoStatus(taskNoListLastYear);
             System.out.println("上一年的利润额为:");
             System.out.println(lreLastYear);
-            if(ObjectUtils.isEmpty(lreLastYear)) return lreinit2;
+            if (ObjectUtils.isEmpty(lreLastYear)) return lreinit2;
             return lreLastYear;
         });
-        CompletableFuture<BigDecimal> futureCurrMonth = CompletableFuture.supplyAsync(() ->{
+        CompletableFuture<BigDecimal> futureCurrMonth = CompletableFuture.supplyAsync(() -> {
             BigDecimal lreinit3 = BigDecimal.valueOf(0);
             List<String> taskNoListCurrMonth = indexMapper.getTaskNoByDepSjCurrMonth(departNames);
             System.out.println("当月的任务列表为:");
             System.out.println(taskNoListCurrMonth);
-            if(taskNoListCurrMonth.isEmpty()) return lreinit3;
+            if (taskNoListCurrMonth.isEmpty()) return lreinit3;
             BigDecimal lreCurrMonth = indexMapper.getLreByTaskNoStatus(taskNoListCurrMonth);
             System.out.println("当月的利润额为:");
             System.out.println(lreCurrMonth);
-            if(ObjectUtils.isEmpty(lreCurrMonth)) return lreinit3;
+            if (ObjectUtils.isEmpty(lreCurrMonth)) return lreinit3;
             return lreCurrMonth;
         });
-        CompletableFuture<BigDecimal> futureLastMonth = CompletableFuture.supplyAsync(() ->{
+        CompletableFuture<BigDecimal> futureLastMonth = CompletableFuture.supplyAsync(() -> {
             BigDecimal lreinit4 = BigDecimal.valueOf(0);
             List<String> taskNoListLastMonth = indexMapper.getTaskNoByDepSjLastMonth(departNames);
             System.out.println("上个月的任务列表为:");
             System.out.println(taskNoListLastMonth);
-            if(taskNoListLastMonth.isEmpty()) return lreinit4;
+            if (taskNoListLastMonth.isEmpty()) return lreinit4;
             BigDecimal lreLastMonth = indexMapper.getLreByTaskNoStatus(taskNoListLastMonth);
             System.out.println("上个月的利润额为:");
             System.out.println(lreLastMonth);
-            if(ObjectUtils.isEmpty(lreLastMonth)) return lreinit4;
+            if (ObjectUtils.isEmpty(lreLastMonth)) return lreinit4;
             return lreLastMonth;
         });
-        CompletableFuture<BigDecimal> futureTqMonth = CompletableFuture.supplyAsync(() ->{
+        CompletableFuture<BigDecimal> futureTqMonth = CompletableFuture.supplyAsync(() -> {
             BigDecimal lreinit5 = BigDecimal.valueOf(0);
             List<String> taskNoListTqMonth = indexMapper.getTaskNoByDepSjTqMonth(departNames);
             System.out.println("去年同期月份的任务列表为:");
             System.out.println(taskNoListTqMonth);
-            if(taskNoListTqMonth.isEmpty()) return lreinit5;
+            if (taskNoListTqMonth.isEmpty()) return lreinit5;
             BigDecimal lreTqMonth = indexMapper.getLreByTaskNoStatus(taskNoListTqMonth);
             System.out.println("去年同期月份的利润额为:");
             System.out.println(lreTqMonth);
-            if(ObjectUtils.isEmpty(lreTqMonth)) return lreinit5;
+            if (ObjectUtils.isEmpty(lreTqMonth)) return lreinit5;
             return lreTqMonth;
         });
         CompletableFuture<Void> future = CompletableFuture.allOf(futureCurrYear, futureLastYear, futureCurrMonth, futureLastMonth, futureTqMonth);
@@ -1829,9 +1821,9 @@ public class IndexServiceImpl implements IndexService {
         BigDecimal lreLastMonth = futureLastMonth.join();
         BigDecimal lreTqMonth = futureTqMonth.join();
 
-        indexTotalVo.setYearTotal(lreCurrYear.setScale(2,RoundingMode.HALF_UP));
-        indexTotalVo.setYearTq(lreLastYear.setScale(2,RoundingMode.HALF_UP));
-        indexTotalVo.setMonthTotal(lreCurrMonth.setScale(2,RoundingMode.HALF_UP));
+        indexTotalVo.setYearTotal(lreCurrYear.setScale(2, RoundingMode.HALF_UP));
+        indexTotalVo.setYearTq(lreLastYear.setScale(2, RoundingMode.HALF_UP));
+        indexTotalVo.setMonthTotal(lreCurrMonth.setScale(2, RoundingMode.HALF_UP));
 
         //起线程 同时计算年同比、月环比、月同比
         CompletableFuture<BigDecimal> futureTbYear = CompletableFuture.supplyAsync(() -> {
@@ -1863,9 +1855,9 @@ public class IndexServiceImpl implements IndexService {
         BigDecimal tbGrowthYear = futureTbYear.join();
         BigDecimal hbGrowthMonth = futureHbMonth.join();
         BigDecimal tbGrowthMonth = futureTbMonth.join();
-        indexTotalVo.setYearTb(tbGrowthYear.setScale(2,RoundingMode.HALF_UP));
-        indexTotalVo.setMonthHb(hbGrowthMonth.setScale(2,RoundingMode.HALF_UP));
-        indexTotalVo.setMonthTb(tbGrowthMonth.setScale(2,RoundingMode.HALF_UP));
+        indexTotalVo.setYearTb(tbGrowthYear.setScale(2, RoundingMode.HALF_UP));
+        indexTotalVo.setMonthHb(hbGrowthMonth.setScale(2, RoundingMode.HALF_UP));
+        indexTotalVo.setMonthTb(tbGrowthMonth.setScale(2, RoundingMode.HALF_UP));
 
         return indexTotalVo;
     }
@@ -1874,70 +1866,70 @@ public class IndexServiceImpl implements IndexService {
      * 首页一层获取利润额  部门领导权限
      * 年总利润、上一年同期总利润、年同比、当月总利润、当月同比、当月环比
      */
-    public IndexTotalVo getLreAllOne(){
+    public IndexTotalVo getLreAllOne() {
         //初始化
         IndexTotalVo indexTotalVo = indexTotalVoInit();
 
         //起线程 同时查找当年上一年当月上个月去年同期月份的任务号并计算利润额
-        CompletableFuture<BigDecimal> futureCurrYear = CompletableFuture.supplyAsync(() ->{
+        CompletableFuture<BigDecimal> futureCurrYear = CompletableFuture.supplyAsync(() -> {
             BigDecimal lreinit = BigDecimal.valueOf(0);
             //1.根据实际时间查询任务列表
             List<String> taskNoListCurrYear = indexMapper.getTaskNoBySjCurrYear();
             System.out.println("当年的任务列表为:");
             System.out.println(taskNoListCurrYear);
-            if(taskNoListCurrYear.isEmpty()) return lreinit;
+            if (taskNoListCurrYear.isEmpty()) return lreinit;
             BigDecimal lreCurrYear = indexMapper.getLreByTaskNoStatus(taskNoListCurrYear);
             System.out.println("当年的利润额为:");
             System.out.println(lreCurrYear);
-            if(ObjectUtils.isEmpty(lreCurrYear)) return lreinit;
+            if (ObjectUtils.isEmpty(lreCurrYear)) return lreinit;
             return lreCurrYear;
         });
-        CompletableFuture<BigDecimal> futureLastYear = CompletableFuture.supplyAsync(() ->{
+        CompletableFuture<BigDecimal> futureLastYear = CompletableFuture.supplyAsync(() -> {
             BigDecimal lreinit2 = BigDecimal.valueOf(0);
             List<String> taskNoListLastYear = indexMapper.getTaskNoBySjLastYear();
             System.out.println("上一年的任务列表为:");
             System.out.println(taskNoListLastYear);
-            if(taskNoListLastYear.isEmpty()) return lreinit2;
+            if (taskNoListLastYear.isEmpty()) return lreinit2;
             BigDecimal lreLastYear = indexMapper.getLreByTaskNoStatus(taskNoListLastYear);
             System.out.println("上一年的利润额为:");
             System.out.println(lreLastYear);
-            if(ObjectUtils.isEmpty(lreLastYear)) return lreinit2;
+            if (ObjectUtils.isEmpty(lreLastYear)) return lreinit2;
             return lreLastYear;
         });
-        CompletableFuture<BigDecimal> futureCurrMonth = CompletableFuture.supplyAsync(() ->{
+        CompletableFuture<BigDecimal> futureCurrMonth = CompletableFuture.supplyAsync(() -> {
             BigDecimal lreinit3 = BigDecimal.valueOf(0);
             List<String> taskNoListCurrMonth = indexMapper.getTaskNoBySjCurrMonth();
             System.out.println("当月的任务列表为:");
             System.out.println(taskNoListCurrMonth);
-            if(taskNoListCurrMonth.isEmpty()) return lreinit3;
+            if (taskNoListCurrMonth.isEmpty()) return lreinit3;
             BigDecimal lreCurrMonth = indexMapper.getLreByTaskNoStatus(taskNoListCurrMonth);
             System.out.println("当月的利润额为:");
             System.out.println(lreCurrMonth);
-            if(ObjectUtils.isEmpty(lreCurrMonth)) return lreinit3;
+            if (ObjectUtils.isEmpty(lreCurrMonth)) return lreinit3;
             return lreCurrMonth;
         });
-        CompletableFuture<BigDecimal> futureLastMonth = CompletableFuture.supplyAsync(() ->{
+        CompletableFuture<BigDecimal> futureLastMonth = CompletableFuture.supplyAsync(() -> {
             BigDecimal lreinit4 = BigDecimal.valueOf(0);
             List<String> taskNoListLastMonth = indexMapper.getTaskNoBySjLastMonth();
             System.out.println("上个月的任务列表为:");
             System.out.println(taskNoListLastMonth);
-            if(taskNoListLastMonth.isEmpty()) return lreinit4;
+            if (taskNoListLastMonth.isEmpty()) return lreinit4;
             BigDecimal lreLastMonth = indexMapper.getLreByTaskNoStatus(taskNoListLastMonth);
             System.out.println("上个月的利润额为:");
             System.out.println(lreLastMonth);
-            if(ObjectUtils.isEmpty(lreLastMonth)) return lreinit4;
+            if (ObjectUtils.isEmpty(lreLastMonth)) return lreinit4;
             return lreLastMonth;
         });
-        CompletableFuture<BigDecimal> futureTqMonth = CompletableFuture.supplyAsync(() ->{
+        CompletableFuture<BigDecimal> futureTqMonth = CompletableFuture.supplyAsync(() -> {
             BigDecimal lreinit5 = BigDecimal.valueOf(0);
             List<String> taskNoListTqMonth = indexMapper.getTaskNoBySjTqMonth();
             System.out.println("去年同期月份的任务列表为:");
             System.out.println(taskNoListTqMonth);
-            if(taskNoListTqMonth.isEmpty()) return lreinit5;
+            if (taskNoListTqMonth.isEmpty()) return lreinit5;
             BigDecimal lreTqMonth = indexMapper.getLreByTaskNoStatus(taskNoListTqMonth);
             System.out.println("去年同期月份的利润额为:");
             System.out.println(lreTqMonth);
-            if(ObjectUtils.isEmpty(lreTqMonth)) return lreinit5;
+            if (ObjectUtils.isEmpty(lreTqMonth)) return lreinit5;
             return lreTqMonth;
         });
         CompletableFuture<Void> future = CompletableFuture.allOf(futureCurrYear, futureLastYear, futureCurrMonth, futureLastMonth, futureTqMonth);
@@ -1948,9 +1940,9 @@ public class IndexServiceImpl implements IndexService {
         BigDecimal lreLastMonth = futureLastMonth.join();
         BigDecimal lreTqMonth = futureTqMonth.join();
 
-        indexTotalVo.setYearTotal(lreCurrYear.setScale(2,RoundingMode.HALF_UP));
-        indexTotalVo.setYearTq(lreLastYear.setScale(2,RoundingMode.HALF_UP));
-        indexTotalVo.setMonthTotal(lreCurrMonth.setScale(2,RoundingMode.HALF_UP));
+        indexTotalVo.setYearTotal(lreCurrYear.setScale(2, RoundingMode.HALF_UP));
+        indexTotalVo.setYearTq(lreLastYear.setScale(2, RoundingMode.HALF_UP));
+        indexTotalVo.setMonthTotal(lreCurrMonth.setScale(2, RoundingMode.HALF_UP));
 
         //起线程 同时计算年同比、月环比、月同比
         CompletableFuture<BigDecimal> futureTbYear = CompletableFuture.supplyAsync(() -> {
@@ -1982,9 +1974,9 @@ public class IndexServiceImpl implements IndexService {
         BigDecimal tbGrowthYear = futureTbYear.join();
         BigDecimal hbGrowthMonth = futureHbMonth.join();
         BigDecimal tbGrowthMonth = futureTbMonth.join();
-        indexTotalVo.setYearTb(tbGrowthYear.setScale(2,RoundingMode.HALF_UP));
-        indexTotalVo.setMonthHb(hbGrowthMonth.setScale(2,RoundingMode.HALF_UP));
-        indexTotalVo.setMonthTb(tbGrowthMonth.setScale(2,RoundingMode.HALF_UP));
+        indexTotalVo.setYearTb(tbGrowthYear.setScale(2, RoundingMode.HALF_UP));
+        indexTotalVo.setMonthHb(hbGrowthMonth.setScale(2, RoundingMode.HALF_UP));
+        indexTotalVo.setMonthTb(tbGrowthMonth.setScale(2, RoundingMode.HALF_UP));
 
         return indexTotalVo;
     }
@@ -1992,7 +1984,7 @@ public class IndexServiceImpl implements IndexService {
     /**
      * 首页二层参数类的初始化
      */
-    public IndexChartInfoVo<BigDecimal> indexChartInfoVoInit(){
+    public IndexChartInfoVo<BigDecimal> indexChartInfoVoInit() {
         //初始化
         IndexChartInfoVo<BigDecimal> indexChartInfoVo = new IndexChartInfoVo<>();
         //创建一个String列表用来存储横坐标日期
@@ -2042,7 +2034,7 @@ public class IndexServiceImpl implements IndexService {
      * 首页二层获取利润额 所长权限
      * 某段时间内的利润
      */
-    public IndexChartInfoVo<BigDecimal> getLreAllByDate(IndexInfoParamDto indexInfoParamDto){
+    public IndexChartInfoVo<BigDecimal> getLreAllByDate(IndexInfoParamDto indexInfoParamDto) {
         //初始化
         IndexChartInfoVo<BigDecimal> indexChartInfoVo = indexChartInfoVoInit();
         BigDecimal initValue = BigDecimal.valueOf(0); //某年或某月没有任务,已收款为0
@@ -2076,7 +2068,7 @@ public class IndexServiceImpl implements IndexService {
 
         //创建CompletableFuture集合,因为allOf()方法参数可变参数
         List<CompletableFuture<BigDecimal>> futures = new ArrayList<>();
-        for(String timeRange2:timeRangeList){
+        for (String timeRange2 : timeRangeList) {
             CompletableFuture<BigDecimal> future = CompletableFuture.supplyAsync(() -> {
                 // 子线程处理任务
                 BigDecimal lreinit = BigDecimal.valueOf(0);
@@ -2091,11 +2083,11 @@ public class IndexServiceImpl implements IndexService {
 //                    System.out.println(timeRange2 + "月的任务列表为:");
 //                    System.out.println(taskNoListBysj);
                 }
-                if(taskNoListBysj.isEmpty()) return lreinit;
+                if (taskNoListBysj.isEmpty()) return lreinit;
                 BigDecimal lreYear = indexMapper.getLreByTaskNoStatus(taskNoListBysj);
 //                System.out.println(timeRange2 + "的利润额为:");
 //                System.out.println(lreYear);
-                if(ObjectUtils.isEmpty(lreYear)) return lreinit;
+                if (ObjectUtils.isEmpty(lreYear)) return lreinit;
                 return lreYear;
             });
             futures.add(future);
@@ -2105,10 +2097,9 @@ public class IndexServiceImpl implements IndexService {
         futureAll.join();
         List<BigDecimal> seriesDataList2 = new ArrayList<>();
         futures.forEach(i -> {
-            try{
+            try {
                 seriesDataList2.add(i.get());
-            }
-            catch (InterruptedException | ExecutionException e){
+            } catch (InterruptedException | ExecutionException e) {
                 seriesDataList2.add(initValue);//出现异常当前利润额赋为0
                 e.printStackTrace();
             }
@@ -2126,7 +2117,7 @@ public class IndexServiceImpl implements IndexService {
      * 首页二层获取利润额 部门领导权限
      * 某段时间内的利润
      */
-    public IndexChartInfoVo<BigDecimal> getLreByDate(IndexInfoParamDto indexInfoParamDto, String userId){
+    public IndexChartInfoVo<BigDecimal> getLreByDate(IndexInfoParamDto indexInfoParamDto, String userId) {
         //初始化
         IndexChartInfoVo<BigDecimal> indexChartInfoVo = indexChartInfoVoInit();
         BigDecimal initValue = BigDecimal.valueOf(0); //某年或某月没有任务,已收款为0
@@ -2160,11 +2151,11 @@ public class IndexServiceImpl implements IndexService {
 
         //获取部门名称列表
         List<String> departNames = sysDepartMapper.getSysUserOfDepartNameList(userId);
-        if(departNames.isEmpty()) return indexChartInfoVo;
+        if (departNames.isEmpty()) return indexChartInfoVo;
 
         //创建CompletableFuture集合,因为allOf()方法参数可变参数
         List<CompletableFuture<BigDecimal>> futures = new ArrayList<>();
-        for(String timeRange2:timeRangeList){
+        for (String timeRange2 : timeRangeList) {
             CompletableFuture<BigDecimal> future = CompletableFuture.supplyAsync(() -> {
                 // 子线程处理任务
                 BigDecimal lreinit = BigDecimal.valueOf(0);
@@ -2179,11 +2170,11 @@ public class IndexServiceImpl implements IndexService {
 //                    System.out.println(timeRange2 + "月的任务列表为:");
 //                    System.out.println(taskNoListBysj);
                 }
-                if(taskNoListBysj.isEmpty()) return lreinit;
+                if (taskNoListBysj.isEmpty()) return lreinit;
                 BigDecimal lreYear = indexMapper.getLreByTaskNoStatus(taskNoListBysj);
 //                System.out.println(timeRange2 + "的利润额为:");
 //                System.out.println(lreYear);
-                if(ObjectUtils.isEmpty(lreYear)) return lreinit;
+                if (ObjectUtils.isEmpty(lreYear)) return lreinit;
                 return lreYear;
             });
             futures.add(future);
@@ -2193,10 +2184,9 @@ public class IndexServiceImpl implements IndexService {
         futureAll.join();
         List<BigDecimal> seriesDataList2 = new ArrayList<>();
         futures.forEach(i -> {
-            try{
+            try {
                 seriesDataList2.add(i.get());
-            }
-            catch (InterruptedException | ExecutionException e){
+            } catch (InterruptedException | ExecutionException e) {
                 seriesDataList2.add(initValue);//出现异常当前利润额赋为0
                 e.printStackTrace();
             }
@@ -2217,7 +2207,7 @@ public class IndexServiceImpl implements IndexService {
      * @param indexInfoParamDto
      * @return IndexChartInfoVo<BigDecimal>
      */
-    public IndexChartInfoVo<BigDecimal> getTotalReceivedAllByDate(IndexInfoParamDto indexInfoParamDto){
+    public IndexChartInfoVo<BigDecimal> getTotalReceivedAllByDate(IndexInfoParamDto indexInfoParamDto) {
         //1.创建一个IndexChartInfoVo实例用来存储最后返回前端的信息
         IndexChartInfoVo<BigDecimal> indexChartInfoVo = new IndexChartInfoVo<>();
         BigDecimal initValue = BigDecimal.valueOf(0); //某年或某月没有任务,已收款为0
@@ -2235,17 +2225,16 @@ public class IndexServiceImpl implements IndexService {
         String startString = indexInfoParamDto.getBeginDate();
         //结束时间
         String endString = indexInfoParamDto.getEndDate();
-        if(timeType.equals("year")){
+        if (timeType.equals("year")) {
             timeRangeList = getDateList(timeRangeList, startString, endString, "yyyy", timeType);
-        }
-        else if (timeType.equals("month")){
+        } else if (timeType.equals("month")) {
             timeRangeList = getDateList(timeRangeList, startString, endString, "yyyy-MM", timeType);
         }
         System.out.println("获取的日期列表为:");
         System.out.println(timeRangeList);
         if (timeRangeList.isEmpty()) return indexChartInfoVo;//日期为空,直接传回两个空list
         //根据日期长度初始化纵坐标值 0
-        for(String timeRange:timeRangeList){
+        for (String timeRange : timeRangeList) {
             seriesDataList.add(initValue);
         }
         //添加横坐标列表
@@ -2262,25 +2251,25 @@ public class IndexServiceImpl implements IndexService {
         //4.计算该时间列表中某年或某月对应的总收款
         //创建CompletableFuture集合,因为allOf()方法参数可变参数
         List<CompletableFuture<BigDecimal>> futures = new ArrayList<>();
-        for(String timeRange2:timeRangeList){
+        for (String timeRange2 : timeRangeList) {
             CompletableFuture<BigDecimal> future = CompletableFuture.supplyAsync(() -> {
                 // 子线程处理任务
                 BigDecimal yearTotal = initValue;
                 if (timeType.equals("year")) {
                     //1.根据实际时间查询任务列表
                     yearTotal = exchangeMapper.getReceivedAllByYear(timeRange2);
-                    if(yearTotal == null){
+                    if (yearTotal == null) {
                         yearTotal = initValue;
                     }
                 } else if (timeType.equals("month")) {
                     yearTotal = exchangeMapper.getReceivedAllByYMonth(timeRange2);
-                    if(yearTotal == null){
+                    if (yearTotal == null) {
                         yearTotal = initValue;
                     }
                 }
 //                System.out.println(timeRange2 + "的总收款为:");
 //                System.out.println(yearTotal);
-                if(ObjectUtils.isEmpty(yearTotal)) return initValue;
+                if (ObjectUtils.isEmpty(yearTotal)) return initValue;
                 return yearTotal;
             });
             futures.add(future);
@@ -2290,10 +2279,9 @@ public class IndexServiceImpl implements IndexService {
         futureAll.join();
         List<BigDecimal> seriesDataList2 = new ArrayList<>();
         futures.forEach(i -> {
-            try{
+            try {
                 seriesDataList2.add(i.get());
-            }
-            catch (InterruptedException | ExecutionException e){
+            } catch (InterruptedException | ExecutionException e) {
                 seriesDataList2.add(initValue);//出现异常当前利润额赋为0
                 e.printStackTrace();
             }
@@ -2315,7 +2303,7 @@ public class IndexServiceImpl implements IndexService {
      * @param indexInfoParamDto
      * @return IndexChartInfoVo<BigDecimal>
      */
-    public IndexChartInfoVo<BigDecimal> getTotalReceivedByDate(IndexInfoParamDto indexInfoParamDto, String userId){
+    public IndexChartInfoVo<BigDecimal> getTotalReceivedByDate(IndexInfoParamDto indexInfoParamDto, String userId) {
         //1.创建一个IndexChartInfoVo实例用来存储最后返回前端的信息
         IndexChartInfoVo<BigDecimal> indexChartInfoVo = new IndexChartInfoVo<>();
         BigDecimal initValue = BigDecimal.valueOf(0); //某年或某月没有任务,已收款为0
@@ -2353,7 +2341,7 @@ public class IndexServiceImpl implements IndexService {
         //3.通过登录的用户找到相应的部门,可能一个或两个
         //获取部门名称列表
         List<String> sysDepartNames = sysDepartMapper.getSysUserOfDepartNameList(userId);
-        if(sysDepartNames.isEmpty()) return indexChartInfoVo;
+        if (sysDepartNames.isEmpty()) return indexChartInfoVo;
 
         ArrayList<String> tasknoList = new ArrayList<>();
         List<String> ZrbmTasknoList = projectCostMapper.queryZrbmTasknoListbydepartNames(sysDepartNames);
@@ -2368,25 +2356,25 @@ public class IndexServiceImpl implements IndexService {
         //4.计算该时间列表中某年或某月对应的总收款
         //创建CompletableFuture集合,因为allOf()方法参数可变参数
         List<CompletableFuture<BigDecimal>> futures = new ArrayList<>();
-        for(String timeRange2:timeRangeList){
+        for (String timeRange2 : timeRangeList) {
             CompletableFuture<BigDecimal> future = CompletableFuture.supplyAsync(() -> {
                 // 子线程处理任务
                 BigDecimal yearTotal = initValue;
                 if (timeType.equals("year")) {
                     //1.根据实际时间查询任务列表
                     yearTotal = exchangeMapper.getReceivedByYear(tasknoList, timeRange2);
-                    if(yearTotal == null){
+                    if (yearTotal == null) {
                         yearTotal = initValue;
                     }
                 } else if (timeType.equals("month")) {
                     yearTotal = exchangeMapper.getReceivedByYMonth(tasknoList, timeRange2);
-                    if(yearTotal == null){
+                    if (yearTotal == null) {
                         yearTotal = initValue;
                     }
                 }
 //                System.out.println(timeRange2 + "的总收款为:");
 //                System.out.println(yearTotal);
-                if(ObjectUtils.isEmpty(yearTotal)) return initValue;
+                if (ObjectUtils.isEmpty(yearTotal)) return initValue;
                 return yearTotal;
             });
             futures.add(future);
@@ -2396,10 +2384,9 @@ public class IndexServiceImpl implements IndexService {
         futureAll.join();
         List<BigDecimal> seriesDataList2 = new ArrayList<>();
         futures.forEach(i -> {
-            try{
+            try {
                 seriesDataList2.add(i.get());
-            }
-            catch (InterruptedException | ExecutionException e){
+            } catch (InterruptedException | ExecutionException e) {
                 seriesDataList2.add(initValue);//出现异常当前利润额赋为0
                 e.printStackTrace();
             }
@@ -2429,18 +2416,18 @@ public class IndexServiceImpl implements IndexService {
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         String role = commonMethod.getRole(sysUser.getUsername());
 
-        if(role == null){
+        if (role == null) {
             return indexTotalVo;
         }
         //如果是所长,查看所有 部门领导查看本部门  员工后期增加
-        if(role.equals(AuthMark.BOSS)){
+        if (role.equals(AuthMark.BOSS)) {
             System.out.println("当前账户权限:所长");
             indexTotalVo = getLreAllOne();
         } else if (role.equals(AuthMark.DEPT_LEADER)) {
             System.out.println("当前账户权限:部门领导");
             //获取部门名称列表
             List<String> departNames = sysDepartMapper.getSysUserOfDepartNameList(sysUser.getId());
-            if(departNames.isEmpty()) return indexTotalVo;
+            if (departNames.isEmpty()) return indexTotalVo;
             indexTotalVo = getLreOne(departNames);
         }
         return indexTotalVo;
@@ -2460,17 +2447,17 @@ public class IndexServiceImpl implements IndexService {
         // 获取登录人用户信息 V2.0版本:
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         String role = commonMethod.getRole(sysUser.getUsername());
-        if(role == null){
+        if (role == null) {
             return indexChartInfoVo;
         }
         //如果是所长,查看所有 部门领导查看本部门  员工后期增加
-        if(role.equals(AuthMark.BOSS)){
+        if (role.equals(AuthMark.BOSS)) {
             System.out.println("当前账户权限:所长");
             indexChartInfoVo = getLreAllByDate(indexInfoParamDto);
 //            indexChartInfoVo = getLreByDate(indexInfoParamDto,sysUser.getId());
         } else if (role.equals(AuthMark.DEPT_LEADER)) {
             System.out.println("当前账户权限:部门领导");
-            indexChartInfoVo = getLreByDate(indexInfoParamDto,sysUser.getId());
+            indexChartInfoVo = getLreByDate(indexInfoParamDto, sysUser.getId());
         }
 
         return indexChartInfoVo;
@@ -2485,7 +2472,7 @@ public class IndexServiceImpl implements IndexService {
      * @param indexInfoParamDto
      * @return IndexChartInfoVo<BigDecimal>
      */
-    public IndexChartInfoVo<BigDecimal> getReceivedDetailByRoleDate(IndexInfoParamDto indexInfoParamDto){
+    public IndexChartInfoVo<BigDecimal> getReceivedDetailByRoleDate(IndexInfoParamDto indexInfoParamDto) {
         //1.创建一个IndexChartInfoVo实例用来存储最后返回前端的信息
         IndexChartInfoVo<BigDecimal> indexChartInfoVo = new IndexChartInfoVo<>();
         BigDecimal initValue = BigDecimal.valueOf(0); //某年或某月没有任务,已收款为0
@@ -2500,11 +2487,11 @@ public class IndexServiceImpl implements IndexService {
         // 获取登录人用户信息 V2.0版本:
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         String role = commonMethod.getRole(sysUser.getUsername());
-        if(role == null){
+        if (role == null) {
             return indexChartInfoVo;
         }
         //如果是所长,查看所有 部门领导查看本部门  员工后期增加
-        if(role.equals(AuthMark.BOSS)){
+        if (role.equals(AuthMark.BOSS)) {
             System.out.println("当前账户权限:所长");
             indexChartInfoVo = getTotalReceivedAllByDate(indexInfoParamDto);
 //            indexChartInfoVo = getTotalReceivedByDate(indexInfoParamDto, sysUser.getId());

+ 2 - 0
module_kzks/src/main/java/org/jeecg/modules/Index/util/CacheKey.java

@@ -14,5 +14,7 @@ public class CacheKey {
     /*首页图表,合同额与合同数量*/
     public static final String CONTRACT_CHART_INFO_DATA_REDIS_KEY = "ContractChartInfoVoDataRedisKey:";
 
+    /*项目成本*/
     public static final String PROJECT_COST_HUIJI = "projectCosthuiji";
+
 }

+ 21 - 0
module_kzks/src/main/java/org/jeecg/modules/Index/util/RedisCacheMethod.java

@@ -0,0 +1,21 @@
+package org.jeecg.modules.Index.util;
+
+import org.jeecg.common.util.RedisUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class RedisCacheMethod {
+
+    @Autowired
+    private RedisUtil redisUtil;
+
+
+    public void removeAllRedisCache() {
+        redisUtil.removeAll(CacheKey.CONTRACT_CHART_INFO_DATA_REDIS_KEY + ":*");
+        redisUtil.removeAll(CacheKey.CONTRACT_DATA_REDIS_KEY + ":*");
+        redisUtil.removeAll(CacheKey.INCOME_DATA_REDIS_KEY + ":*");
+        redisUtil.removeAll(CacheKey.RECEIVED_DATA_REDIS_KEY + ":*");
+        redisUtil.removeAll(CacheKey.PROJECT_COST_HUIJI + ":*");
+    }
+}

+ 7 - 0
module_kzks/src/main/java/org/jeecg/modules/dataSourceSwitch/service/impl/SwitchDataSourceServiceImpl.java

@@ -2,11 +2,14 @@ package org.jeecg.modules.dataSourceSwitch.service.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.apache.commons.lang3.ObjectUtils;
+import org.jeecg.common.util.RedisUtil;
+import org.jeecg.modules.Index.util.RedisCacheMethod;
 import org.jeecg.modules.dataSourceSwitch.entity.SwitchDataSource;
 import org.jeecg.modules.dataSourceSwitch.mapper.SwitchDataSourceMapper;
 import org.jeecg.modules.dataSourceSwitch.mark.DataSourceMark;
 import org.jeecg.modules.dataSourceSwitch.service.ISwitchDataSourceService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.cache.CacheProperties;
 import org.springframework.stereotype.Service;
 
 import java.util.Objects;
@@ -25,6 +28,9 @@ public class SwitchDataSourceServiceImpl extends ServiceImpl<SwitchDataSourceMap
     @SuppressWarnings("all")
     private SwitchDataSourceMapper switchDataSourceMapper;
 
+    @Autowired
+    private RedisCacheMethod redisCacheMethod;
+
     /**
      * 修改switch
      */
@@ -35,6 +41,7 @@ public class SwitchDataSourceServiceImpl extends ServiceImpl<SwitchDataSourceMap
             DataSourceMark.MARK = 0;
         }
         switchDataSourceMapper.updateSwitchDataSource(type);
+        redisCacheMethod.removeAllRedisCache();
     }
 
     /**

+ 2 - 1
module_kzks/src/main/java/org/jeecg/modules/projectCostHuiji/controller/ProjectCostHuijiController.java

@@ -195,7 +195,7 @@ public class ProjectCostHuijiController extends JeecgController<ProjectCostHuiji
             sumVO.setProjectCostHuijiSum(resultHuiJiVo);
             sumVO.setPageList(pageList1);
 
-            redisUtil.set(CacheKey.PROJECT_COST_HUIJI + ":" + pageNo + "&" + pageSize + ":" + projectCostHuiji.toString(), sumVO, 1000L * 60 * 60 * 2);
+                redisUtil.set(CacheKey.PROJECT_COST_HUIJI + ":" + pageNo + "&" + pageSize + ":" + projectCostHuiji.toString(), sumVO, 1000L * 60 * 60 * 10);
 
             return Result.OK(sumVO);
         } else {
@@ -207,6 +207,7 @@ public class ProjectCostHuijiController extends JeecgController<ProjectCostHuiji
 
             ProjectCostHuiji projectCostHuiji1 = projectCostHuijiService.costHJSumByProjectCost(projectCost);
             Integer yzsl = projectCostHuijiService.costHJYzslByProjectCost(projectCost);
+            if (ObjectUtils.isEmpty(yzsl)) yzsl = 0;
             projectCostHuiji1.setYzsl(yzsl);
             ArrayList<ProjectCostVO> projectCostVOS = new ArrayList<>();