Parcourir la source

首页一层当月明细分页问题优化

sl il y a 1 an
Parent
commit
51d3fa5323

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

@@ -2,6 +2,7 @@ package org.jeecg.modules.Index.controller;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.metadata.OrderItem;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;

+ 26 - 54
module_kzks/src/main/java/org/jeecg/modules/Index/service/impl/IndexServiceImpl.java

@@ -2,6 +2,7 @@ package org.jeecg.modules.Index.service.impl;
 
 import com.alibaba.fastjson2.JSONObject;
 import com.alibaba.fastjson2.TypeReference;
+import com.baomidou.mybatisplus.core.metadata.OrderItem;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.ObjectUtils;
@@ -27,6 +28,8 @@ import org.jeecg.modules.kyTaskInfo.service.IKyTaskInfoService;
 import org.jeecg.modules.projectCost.entity.ProjectCost;
 import org.jeecg.modules.projectCost.mapper.ProjectCostMapper;
 import org.jeecg.modules.projectCost.service.IProjectCostService;
+import org.jeecg.modules.projectCostHuiji.entity.ProjectCostHuiji;
+import org.jeecg.modules.projectCostHuiji.vo.ProjectCostHuijiListVO;
 import org.jeecg.modules.system.mapper.SysDepartMapper;
 import org.jeecg.modules.system.service.ISysDepartService;
 import org.jeecg.modules.system.service.ISysUserDepartService;
@@ -345,6 +348,15 @@ public class IndexServiceImpl implements IndexService {
         List<ComContractInfoExchange> comContractInfoExchangeList = new ArrayList<>();
         String depart = null;
         ArrayList<String> tasknoList = new ArrayList<>();
+        //当年合同额,例:>= 2023-01-01 00:00:00   < 2024-01-01 00:00:00
+        Calendar instance = Calendar.getInstance();
+        //当月合同额,例:>= 2023-12-01 00:00:00   < 2024-01-01 00:00:00
+        instance.setTime(new Date());
+        setZeroMonth(instance);
+        Date currentMothBginDate = instance.getTime();
+        instance.add(Calendar.MONTH, 1);
+        Date currentMothEndDate = instance.getTime();
+
         if (AuthMark.DEPT_LEADER.equals(role)) {
             List<String> departNames = null;
             if (departNameList != null && !departNameList.isEmpty()) {
@@ -360,46 +372,20 @@ public class IndexServiceImpl implements IndexService {
                 stringBuilder.append(departName).append("|");
             }
             depart = stringBuilder.toString();
-            List<ComContractInfoExchange> cacheObject = (List<ComContractInfoExchange>) redisUtil.get(CacheKey.INCOMEDETAIL_DATA_REDIS_KEY + ":" + depart + ":" + role);
-            if (ObjectUtils.isNotEmpty(cacheObject)) {
-                comContractInfoExchangeList = cacheObject;
-                return comContractInfoExchangeList;
-            }
 
             List<String> ZrbmTasknoList = projectCostMapper.queryZrbmTasknoListbydepartNames(departNames);
             List<String> XdbmTasknoList = projectCostMapper.queryXdbmTasknoListbydepartNames(departNames);
             tasknoList.addAll(ZrbmTasknoList);
             tasknoList.addAll(XdbmTasknoList);
             if (tasknoList.isEmpty()) return comContractInfoExchangeList;
+            comContractInfoExchangeList = exchangeMapper.getIncomeDetailByTasknoListAndByQsrqRange(page, tasknoList, currentMothBginDate, currentMothEndDate);
+
         }
 
         if (depart == null) {
             depart = "Boss";
-//            return comContractInfoExchangeList;
-            List<ComContractInfoExchange> cacheObject = (List<ComContractInfoExchange>) redisUtil.get(CacheKey.INCOMEDETAIL_DATA_REDIS_KEY + ":" + depart + ":" + role);
-            if (ObjectUtils.isNotEmpty(cacheObject)) {
-                comContractInfoExchangeList = cacheObject;
-                return comContractInfoExchangeList;
-            }
-        }
-
-        //当年合同额,例:>= 2023-01-01 00:00:00   < 2024-01-01 00:00:00
-        Calendar instance = Calendar.getInstance();
-        //当月合同额,例:>= 2023-12-01 00:00:00   < 2024-01-01 00:00:00
-        instance.setTime(new Date());
-        setZeroMonth(instance);
-        Date currentMothBginDate = instance.getTime();
-        instance.add(Calendar.MONTH, 1);
-        Date currentMothEndDate = instance.getTime();
-
-        if (AuthMark.DEPT_LEADER.equals(role)) {
-            comContractInfoExchangeList = exchangeMapper.getIncomeDetailByTasknoListAndByQsrqRange(page, tasknoList, currentMothBginDate, currentMothEndDate);
-        } else if (AuthMark.BOSS.equals(role)) {
             comContractInfoExchangeList = exchangeMapper.getIncomeDetailByTasknoListAndByQsrqRangeIfBoss(page, tasknoList, currentMothBginDate, currentMothEndDate);
         }
-
-        redisUtil.set(CacheKey.INCOMEDETAIL_DATA_REDIS_KEY + ":" + depart + ":" + role, comContractInfoExchangeList, 1000L * 60 * 60 * 10);
-
         return comContractInfoExchangeList;
     }
 
@@ -632,6 +618,14 @@ public class IndexServiceImpl implements IndexService {
         String depart = null;
         ArrayList<String> tasknoList = new ArrayList<>();
 
+        Calendar instance = Calendar.getInstance();
+        //当月已收款,例:>= 2023-12-01 00:00:00   < 2024-01-01 00:00:00
+        instance.setTime(new Date());
+        setZeroMonth(instance);
+        Date currentMothBginDate = instance.getTime();
+        instance.add(Calendar.MONTH, 1);
+        Date currentMothEndDate = instance.getTime();
+
         if (AuthMark.DEPT_LEADER.equals(role)) {
             List<String> departNames = null;
             if (departNameList != null && !departNameList.isEmpty()) {
@@ -647,42 +641,20 @@ public class IndexServiceImpl implements IndexService {
                 stringBuilder.append(departName).append("|");
             }
             depart = stringBuilder.toString();
-            List<ComContractInfoExchange> cacheObject = (List<ComContractInfoExchange>) redisUtil.get(CacheKey.RECEIVEDDETAIL_DATA_REDIS_KEY + ":" + depart + ":" + role);
-            if (ObjectUtils.isNotEmpty(cacheObject)) {
-                comContractInfoExchangeList = cacheObject;
-                return comContractInfoExchangeList;
-            }
+
             List<String> ZrbmTasknoList = projectCostMapper.queryZrbmTasknoListbydepartNames(departNames);
             List<String> XdbmTasknoList = projectCostMapper.queryXdbmTasknoListbydepartNames(departNames);
             tasknoList.addAll(ZrbmTasknoList);
             tasknoList.addAll(XdbmTasknoList);
             if (tasknoList.isEmpty()) return comContractInfoExchangeList;
+
+            comContractInfoExchangeList = exchangeMapper.getReceivedDetailByTasknoListAndByQsrqRange(page, tasknoList, currentMothBginDate, currentMothEndDate);
+
         }
         if (depart == null) {
             depart = "Boss";
-            List<ComContractInfoExchange> cacheObject = (List<ComContractInfoExchange>) redisUtil.get(CacheKey.RECEIVEDDETAIL_DATA_REDIS_KEY + ":" + depart + ":" + role);
-            if (ObjectUtils.isNotEmpty(cacheObject)) {
-                comContractInfoExchangeList = cacheObject;
-                return comContractInfoExchangeList;
-            }
-        }
-
-        Calendar instance = Calendar.getInstance();
-        //当月已收款,例:>= 2023-12-01 00:00:00   < 2024-01-01 00:00:00
-        instance.setTime(new Date());
-        setZeroMonth(instance);
-        Date currentMothBginDate = instance.getTime();
-        instance.add(Calendar.MONTH, 1);
-        Date currentMothEndDate = instance.getTime();
-
-        if (AuthMark.DEPT_LEADER.equals(role)) {
-            comContractInfoExchangeList = exchangeMapper.getReceivedDetailByTasknoListAndByQsrqRange(page, tasknoList, currentMothBginDate, currentMothEndDate);
-        } else if (AuthMark.BOSS.equals(role)) {
             comContractInfoExchangeList = exchangeMapper.getReceivedDetailByTasknoListAndByQsrqRangeIfBoss(page, tasknoList, currentMothBginDate, currentMothEndDate);
         }
-
-        redisUtil.set(CacheKey.RECEIVEDDETAIL_DATA_REDIS_KEY + ":" + depart + ":" + role, comContractInfoExchangeList, 1000L * 60 * 60 * 10);
-
         return comContractInfoExchangeList;
     }