update code

dev_xds
haha 2023-10-22 23:45:32 +08:00
parent c52ea9d74e
commit 0fe04687f7
10 changed files with 278 additions and 4 deletions

View File

@ -60,4 +60,10 @@ public interface IFlowBusinessKeyService {
public List<FlowTaskEntity> listByUnit(FlowTaskEntity where);
public List<FlowTaskEntity> listByState(FlowTaskEntity where);
public List<FlowTaskEntity> groupByUnitTotal(FlowTaskEntity where);
public List<FlowTaskEntity> groupByUnitFinish(FlowTaskEntity where);
public List<FlowTaskEntity> groupByProject();
}

View File

@ -118,4 +118,19 @@ public class FlowBusinessKeyServiceImpl implements IFlowBusinessKeyService {
public List<FlowTaskEntity> listByState(FlowTaskEntity where) {
return flowBusinessKeyMapper.listByState(where);
}
@Override
public List<FlowTaskEntity> groupByUnitTotal(FlowTaskEntity where) {
return flowBusinessKeyMapper.groupByUnitTotal(where);
}
@Override
public List<FlowTaskEntity> groupByUnitFinish(FlowTaskEntity where) {
return flowBusinessKeyMapper.groupByUnitFinish(where);
}
@Override
public List<FlowTaskEntity> groupByProject() {
return flowBusinessKeyMapper.groupByProject();
}
}

View File

@ -52,4 +52,10 @@ public interface FlowBusinessKeyMapper {
public List<FlowTaskEntity> listByUnit(FlowTaskEntity where);
public List<FlowTaskEntity> listByState(FlowTaskEntity where);
public List<FlowTaskEntity> groupByUnitTotal(FlowTaskEntity where);
public List<FlowTaskEntity> groupByUnitFinish(FlowTaskEntity where);
public List<FlowTaskEntity> groupByProject();
}

View File

@ -188,6 +188,115 @@
) a
GROUP BY cat
</select>
<select id="groupByUnitFinish" parameterType="com.ruoyi.system.domain.FlowTaskEntity" resultType="com.ruoyi.system.domain.FlowTaskEntity">
SELECT cat taskName, COUNT(1) assigneeId FROM (
SELECT *,'总包单位' cat FROM vw_flow_all WHERE taskName LIKE '总包%' AND taskName!='提交申请' and finishTime IS not NULL
<if test="deployId !=null and deployId!=''">and businessDeptId=#{deployId}</if>
<if test="businessKey !=null and businessKey!=''">and businessKey=#{businessKey}</if>
<if test="prjIds !=null and prjIds.size()>0">
and businessKey in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
UNION
SELECT *,'监理单位' cat FROM vw_flow_all WHERE taskName LIKE '监理%' AND taskName!='提交申请' and finishTime IS not NULL
<if test="deployId !=null and deployId!=''">and businessDeptId=#{deployId}</if>
<if test="businessKey !=null and businessKey!=''">and businessKey=#{businessKey}</if>
<if test="prjIds !=null and prjIds.size()>0">
and businessKey in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
UNION
SELECT *,'设计单位' cat FROM vw_flow_all WHERE taskName LIKE '设计%' AND taskName!='提交申请' and finishTime IS not NULL
<if test="deployId !=null and deployId!=''">and businessDeptId=#{deployId}</if>
<if test="businessKey !=null and businessKey!=''">and businessKey=#{businessKey}</if>
<if test="prjIds !=null and prjIds.size()>0">
and businessKey in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
UNION
SELECT *,'甲方代表' cat FROM vw_flow_all WHERE taskName LIKE '甲方%' AND taskName!='提交申请' and finishTime IS not NULL
<if test="deployId !=null and deployId!=''">and businessDeptId=#{deployId}</if>
<if test="businessKey !=null and businessKey!=''">and businessKey=#{businessKey}</if>
<if test="prjIds !=null and prjIds.size()>0">
and businessKey in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
UNION
SELECT *,'子公司' cat FROM vw_flow_all WHERE taskName LIKE '工程%' AND taskName!='提交申请' and finishTime IS not NULL
<if test="deployId !=null and deployId!=''">and businessDeptId=#{deployId}</if>
<if test="businessKey !=null and businessKey!=''">and businessKey=#{businessKey}</if>
<if test="prjIds !=null and prjIds.size()>0">
and businessKey in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
) a
GROUP BY cat
</select>
<select id="groupByUnitTotal" parameterType="com.ruoyi.system.domain.FlowTaskEntity" resultType="com.ruoyi.system.domain.FlowTaskEntity">
SELECT cat taskName, COUNT(1) assigneeId FROM (
SELECT *,'总包单位' cat FROM vw_flow_all WHERE taskName LIKE '总包%' AND taskName!='提交申请'
<if test="deployId !=null and deployId!=''">and businessDeptId=#{deployId}</if>
<if test="businessKey !=null and businessKey!=''">and businessKey=#{businessKey}</if>
<if test="prjIds !=null and prjIds.size()>0">
and businessKey in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
UNION
SELECT *,'监理单位' cat FROM vw_flow_all WHERE taskName LIKE '监理%' AND taskName!='提交申请'
<if test="deployId !=null and deployId!=''">and businessDeptId=#{deployId}</if>
<if test="businessKey !=null and businessKey!=''">and businessKey=#{businessKey}</if>
<if test="prjIds !=null and prjIds.size()>0">
and businessKey in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
UNION
SELECT *,'设计单位' cat FROM vw_flow_all WHERE taskName LIKE '设计%' AND taskName!='提交申请'
<if test="deployId !=null and deployId!=''">and businessDeptId=#{deployId}</if>
<if test="businessKey !=null and businessKey!=''">and businessKey=#{businessKey}</if>
<if test="prjIds !=null and prjIds.size()>0">
and businessKey in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
UNION
SELECT *,'甲方代表' cat FROM vw_flow_all WHERE taskName LIKE '甲方%' AND taskName!='提交申请'
<if test="deployId !=null and deployId!=''">and businessDeptId=#{deployId}</if>
<if test="businessKey !=null and businessKey!=''">and businessKey=#{businessKey}</if>
<if test="prjIds !=null and prjIds.size()>0">
and businessKey in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
UNION
SELECT *,'子公司' cat FROM vw_flow_all WHERE taskName LIKE '工程%' AND taskName!='提交申请'
<if test="deployId !=null and deployId!=''">and businessDeptId=#{deployId}</if>
<if test="businessKey !=null and businessKey!=''">and businessKey=#{businessKey}</if>
<if test="prjIds !=null and prjIds.size()>0">
and businessKey in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
) a
GROUP BY cat
</select>
<select id="listByUnit" parameterType="com.ruoyi.system.domain.FlowTaskEntity" resultType="com.ruoyi.system.domain.FlowTaskEntity">
SELECT * FROM vw_flow_all WHERE finishTime IS NULL
<if test="taskId!=null">
@ -224,4 +333,12 @@
</if>
</where>
</select>
<select id="groupByProject" resultType="com.ruoyi.system.domain.FlowTaskEntity">
SELECT a.businessKey,a.cnt duration ,b.projectName businessKeyName FROM (
SELECT businessKey,COUNT(1) cnt FROM vw_flow_all WHERE taskName!='提交申请'
GROUP BY businessKey ) a,sur_project b WHERE a.businessKey=b.id
ORDER BY a.cnt DESC
</select>
</mapper>

View File

@ -65,6 +65,49 @@ public class FloweController extends BaseController {
}
@GetMapping("/groupByUnitFinish")
public AjaxResult groupByUnitFinish(long deptId,long projectId){
String key="bgscreen_flow_groupByUnitFinish_"+deptId+"_"+projectId;
Object obj=redisCache.getCacheObject(key);
if(obj!=null){
return AjaxResult.success(obj);
}
FlowTaskEntity where=new FlowTaskEntity();
if(deptId<=0){
if (SecurityUtils.isUserB()) {
where.setPrjIds(getProjectIds());
}
}
where.setDeployId(deptId<1?"":""+deptId);
where.setBusinessKey(projectId<1?"":""+projectId);
List<FlowTaskEntity> list=flowBusinessKeyService.groupByUnitFinish(where);
redisCache.setCacheObject(key, list, Constants.BIGSCREEN_QUERY_CACHE, TimeUnit.MINUTES);
return AjaxResult.success(list);
}
@GetMapping("/groupByUnitTotal")
public AjaxResult groupByUnitTotal(long deptId,long projectId){
String key="bgscreen_flow_groupByUnitTotal_"+deptId+"_"+projectId;
Object obj=redisCache.getCacheObject(key);
if(obj!=null){
return AjaxResult.success(obj);
}
FlowTaskEntity where=new FlowTaskEntity();
if(deptId<=0){
if (SecurityUtils.isUserB()) {
where.setPrjIds(getProjectIds());
}
}
where.setDeployId(deptId<1?"":""+deptId);
where.setBusinessKey(projectId<1?"":""+projectId);
List<FlowTaskEntity> list=flowBusinessKeyService.groupByUnitTotal(where);
redisCache.setCacheObject(key, list, Constants.BIGSCREEN_QUERY_CACHE, TimeUnit.MINUTES);
return AjaxResult.success(list);
}
@PostMapping("/listByUnit")
public TableDataInfo listByUnit(@RequestBody FlowTaskEntity where){
startPage();
@ -89,4 +132,10 @@ public class FloweController extends BaseController {
return getDataTable(list);
}
@GetMapping("/groupByProject")
public AjaxResult groupByProject(){
List<FlowTaskEntity> list=flowBusinessKeyService.groupByProject();
return AjaxResult.success(list);
}
}

View File

@ -1,21 +1,22 @@
package com.yanzhu.jh.bigscreen.web.controller;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.SecurityUtils;
import com.yanzhu.jh.project.domain.SurProjectStandard;
import com.yanzhu.jh.project.service.ISurProjectStandardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.concurrent.TimeUnit;
@RestController
@RequestMapping("/bgscreen/standard")
public class ProjectStandardController {
public class ProjectStandardController extends BaseController {
@Autowired
ISurProjectStandardService standardService;
@ -36,4 +37,32 @@ public class ProjectStandardController {
redisCache.setCacheObject(key, list, Constants.BIGSCREEN_QUERY_CACHE, TimeUnit.MINUTES);
return AjaxResult.success(list);
}
@PostMapping("/groupByType")
public AjaxResult groupByType(@RequestBody SurProjectStandard where){
String key="bgscreen_standard_groupByType_"+where.getProjectId()+"_"+where.getDeptId();
Object obj=redisCache.getCacheObject(key);
if(obj!=null){
return AjaxResult.success(obj);
}
Long deptId= where.getDeptId();
if(deptId==null || deptId<=0){
if (SecurityUtils.isUserB()) {
where.setPrjIds(getProjectIds());
}
}
List<SysDictData> list=standardService.groupByType(where);
redisCache.setCacheObject(key, list, Constants.BIGSCREEN_QUERY_CACHE, TimeUnit.MINUTES);
return AjaxResult.success(list);
}
@GetMapping("/groupByProject")
public AjaxResult groupByProject() {
List<SurProjectStandard> list=standardService.groupByProject();
return AjaxResult.success(list);
}
}

View File

@ -1,6 +1,8 @@
package com.yanzhu.jh.project.mapper;
import java.util.List;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.yanzhu.jh.project.domain.SurProjectStandard;
/**
@ -58,4 +60,8 @@ public interface SurProjectStandardMapper
* @return
*/
public int deleteSurProjectStandardByIds(Long[] ids);
public List<SysDictData> groupByType(SurProjectStandard where);
List<SurProjectStandard> groupByProject();
}

View File

@ -1,6 +1,8 @@
package com.yanzhu.jh.project.service;
import java.util.List;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.yanzhu.jh.project.domain.SurProjectStandard;
/**
@ -60,4 +62,8 @@ public interface ISurProjectStandardService
public int deleteSurProjectStandardById(Long id);
public int insertSurProjectStandards(SurProjectStandard surProjectStandard);
public List<SysDictData> groupByType(SurProjectStandard where);
public List<SurProjectStandard> groupByProject();
}

View File

@ -1,6 +1,8 @@
package com.yanzhu.jh.project.service.impl;
import java.util.List;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.utils.DateUtils;
import org.apache.logging.log4j.util.Strings;
import org.springframework.beans.factory.annotation.Autowired;
@ -111,4 +113,14 @@ public class SurProjectStandardServiceImpl implements ISurProjectStandardService
}
return n;
}
@Override
public List<SysDictData> groupByType(SurProjectStandard where) {
return surProjectStandardMapper.groupByType(where);
}
@Override
public List<SurProjectStandard> groupByProject() {
return surProjectStandardMapper.groupByProject();
}
}

View File

@ -100,4 +100,32 @@
#{id}
</foreach>
</delete>
<select id="groupByType" parameterType="SurProjectStandard" resultMap="com.ruoyi.system.mapper.SysDictDataMapper.SysDictDataResult">
select b.dict_value,b.dict_label,a.cnt STATUS from (select * from sys_dict_data where dict_type='prj_standard_type') b left join (
select a.standard_type,count(1) cnt
from sur_project_standard a
where a.is_del =0
<if test="projectId!=null and projectId>0"> and a.project_id=#{projectId}</if>
<if test="deptId!=null and deptId>0">
and a.project_id in (SELECT id FROM sur_project WHERE deptid= #{deptId})
</if>
<if test="prjIds !=null and prjIds.size()>0">
and a.project_id in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
group by a.standard_type ) a on b.dict_value=a.standard_type
order by b.dict_value
</select>
<select id="groupByProject" resultMap="SurProjectStandardResult">
select a.project_id,a.cnt dept_id,b.projectName standard_desc from (
select a.project_id,count(1) cnt
from sur_project_standard a where a.is_del=0
group by a.project_id )a,
sur_project b where a.project_id=b.id
order by a.cnt desc
</select>
</mapper>