From b60ad07a83da6348729b439cb0b8d7ba99f3b779 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9C=E7=8E=89=E7=90=A6?= <7507756+jiang_yuqi@user.noreply.gitee.com> Date: Mon, 15 Apr 2024 22:39:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ProjectViewController.java | 21 +++++++++++++++++-- .../mapper/project/ProjectViewMapper.xml | 3 +-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/yanzhu-jh/src/main/java/com/yanzhu/jh/project/controller/ProjectViewController.java b/yanzhu-jh/src/main/java/com/yanzhu/jh/project/controller/ProjectViewController.java index 14aa05e3..0527ba4f 100644 --- a/yanzhu-jh/src/main/java/com/yanzhu/jh/project/controller/ProjectViewController.java +++ b/yanzhu-jh/src/main/java/com/yanzhu/jh/project/controller/ProjectViewController.java @@ -2,6 +2,7 @@ package com.yanzhu.jh.project.controller; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.SysRoleEnum; @@ -32,6 +33,7 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.concurrent.TimeUnit; /** * ProjectViewController @@ -43,6 +45,9 @@ import java.util.List; @RequestMapping("/statistics/project") public class ProjectViewController extends BaseBuildNodeController{ + @Autowired + private RedisCache redisCache; + @Autowired private ISysDeptService sysDeptService; @@ -57,7 +62,13 @@ public class ProjectViewController extends BaseBuildNodeController{ if(SysRoleEnum.ZGS.getCode().equals(surProject.getNowRole())){ surProject.setDeptId(sysDeptService.getZGSDeptId(getDeptId())); } - List list = projectViewService.selectStatisticsProjectList(surProject); + String key = "statistics.project.selectStatisticsProjectList-"+surProject.getProjectName()+"-"+surProject.getDeptId()+"-"+surProject.getProjectType()+"-"+surProject.getProjectNature(); + List list = redisCache.getCacheObject(key); + if(list!=null){ + return getDataTable(list); + } + list = projectViewService.selectStatisticsProjectList(surProject); + redisCache.setCacheObject(key,list,5, TimeUnit.MINUTES); return getDataTable(list); } @@ -628,7 +639,13 @@ public class ProjectViewController extends BaseBuildNodeController{ if(SysRoleEnum.ZGS.getCode().equals(surProject.getNowRole())){ surProject.setDeptId(sysDeptService.getZGSDeptId(getDeptId())); } - List list = projectViewService.selectStatisticsJlProjectList(surProject); + String key = "statistics.project.selectStatisticsJlProjectList-"+surProject.getProjectName()+"-"+surProject.getDeptId()+"-"+surProject.getProjectType()+"-"+surProject.getProjectNature(); + List list = redisCache.getCacheObject(key); + if(list!=null){ + return getDataTable(list); + } + list = projectViewService.selectStatisticsJlProjectList(surProject); + redisCache.setCacheObject(key,list,5, TimeUnit.MINUTES); return getDataTable(list); } diff --git a/yanzhu-jh/src/main/resources/mapper/project/ProjectViewMapper.xml b/yanzhu-jh/src/main/resources/mapper/project/ProjectViewMapper.xml index c870ca2f..2cbe3831 100644 --- a/yanzhu-jh/src/main/resources/mapper/project/ProjectViewMapper.xml +++ b/yanzhu-jh/src/main/resources/mapper/project/ProjectViewMapper.xml @@ -38,7 +38,7 @@ (select count(1) from dev_ai_project_config a where a.project_id = sp.id and a.dept_id = pui.unitId and a.is_del=0)as aijk, (select count(1) from dev_ai_project_data a where a.project_id = sp.id and a.dept_id = pui.unitId and a.is_del=0)as aiyjs, (select count(1) from sur_project_attendance_cfg a where a.project_id = sp.id and a.sub_dept_id = pui.unitId and a.state=0)as lwsm, - (select count(1) from sur_project_attendance_user a left join sur_project_attendance_cfg b on a.cfgid = b.id where b.project_id = sp.id and b.sub_dept_id = pui.unitId and b.state=0)as lwry, + (select count(1) from sur_project_attendance_user a left join sur_project_attendance_cfg b on a.cfgid = b.id where b.project_id = sp.id and b.sub_dept_id = pui.unitId and b.state=0 and and a.state=0 and b.is_del=0)as lwry, (select count(1) from vw_flow_all a where a.businessKey = sp.id and a.startDeptName = pui.unitName and a.finishTime is null)as gcsq, (select count(1) from vw_flow_all a where a.businessKey = sp.id and a.startDeptName = pui.unitName and a.finishTime is not null)as gcsp, (select count(1) from sur_project_standard a where a.project_id = sp.id and a.dept_id = pui.unitId and a.is_del=0)as bzh, @@ -78,7 +78,6 @@ (select count(1) from sur_project_measure a where a.project_id = sp.id and a.is_del=0 and approve_status=4)as csclwc, (select count(1) from sur_project_material_seal a where a.project_id = sp.id and a.is_del=0 and approve_status=1)as clfy, (select count(1) from sur_project_material_seal a where a.project_id = sp.id and a.is_del=0 and approve_status=4)as clfywc, - (select count(DISTINCT a.procInsId) from vw_flow_await a where a.businessKey = sp.id and a.taskName like '%监理%')as gcsq, (select count(DISTINCT a.procInsId) from vw_flow_finished a where a.businessKey = sp.id and a.taskName like '%监理%')as gcsp from sur_project sp