dev_xds
姜玉琦 2023-08-26 18:08:37 +08:00
commit f31d243dcf
10 changed files with 153 additions and 0 deletions

View File

@ -0,0 +1,42 @@
package com.yanzhu.jh.bigscreen.web.controller;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.redis.RedisCache;
import com.yanzhu.jh.project.domain.SurProjectCheckDetection;
import com.yanzhu.jh.project.service.ISurProjectCheckDetectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.concurrent.TimeUnit;
@RestController
@RequestMapping("/bgscreen/checkDetection")
public class ProjectCheckDetectionController {
@Autowired
ISurProjectCheckDetectionService checkDetectionService;
@Autowired
private RedisCache redisCache;
/**
*
* @param where checkType deptId projectId
* @return
*/
@PostMapping("groupByCheckType")
public AjaxResult groupByCheckType(@RequestBody SurProjectCheckDetection where){
String key="bgscreen_checkDetection_groupMeasureInfo_"+where.getCheckType()+"_"+where.getDeptId()+"_"+where.getProjectId();
Object obj=redisCache.getCacheObject(key);
if(obj!=null){
return AjaxResult.success(obj);
}
List<SurProjectCheckDetection> list=checkDetectionService.groupByCheckType(where);
redisCache.setCacheObject(key, list, Constants.BIGSCREEN_QUERY_CACHE, TimeUnit.MINUTES);
return AjaxResult.success(list);
}
}

View File

@ -0,0 +1,40 @@
package com.yanzhu.jh.bigscreen.web.controller;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.redis.RedisCache;
import com.yanzhu.jh.project.domain.SurProjectMeasure;
import com.yanzhu.jh.project.service.ISurProjectMeasureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.concurrent.TimeUnit;
@RestController
@RequestMapping("/bgscreen/measure")
public class ProjectMeasureController {
@Autowired
ISurProjectMeasureService measureService;
@Autowired
private RedisCache redisCache;
/**
*
* @param where measureType deptId projectId
* @return
*/
@PostMapping("groupMeasureInfo")
public AjaxResult groupMeasureInfo(@RequestBody SurProjectMeasure where){
String key="bgscreen_measure_groupMeasureInfo_"+where.getMeasureType()+"_"+where.getDeptId()+"_"+where.getProjectId();
//Object obj=redisCache.getCacheObject(key);
// if(obj!=null){
// return AjaxResult.success(obj);
// }
List<SurProjectMeasure> list=measureService.groupMeasureInfo(where);
//redisCache.setCacheObject(key, list, Constants.BIGSCREEN_QUERY_CACHE, TimeUnit.MINUTES);
return AjaxResult.success(list);
}
}

View File

@ -58,4 +58,6 @@ public interface SurProjectCheckDetectionMapper
* @return
*/
public int deleteSurProjectCheckDetectionByIds(Long[] ids);
public List<SurProjectCheckDetection> groupByCheckType(SurProjectCheckDetection where);
}

View File

@ -58,4 +58,6 @@ public interface SurProjectMeasureMapper
* @return
*/
public int deleteSurProjectMeasureByIds(Long[] ids);
public List<SurProjectMeasure> groupMeasureInfo(SurProjectMeasure where);
}

View File

@ -58,4 +58,6 @@ public interface ISurProjectCheckDetectionService
* @return
*/
public int deleteSurProjectCheckDetectionById(Long id);
public List<SurProjectCheckDetection> groupByCheckType(SurProjectCheckDetection where);
}

View File

@ -58,4 +58,6 @@ public interface ISurProjectMeasureService
* @return
*/
public int deleteSurProjectMeasureById(Long id);
public List<SurProjectMeasure> groupMeasureInfo(SurProjectMeasure where);
}

View File

@ -95,4 +95,9 @@ public class SurProjectCheckDetectionServiceImpl implements ISurProjectCheckDete
{
return surProjectCheckDetectionMapper.deleteSurProjectCheckDetectionById(id);
}
@Override
public List<SurProjectCheckDetection> groupByCheckType(SurProjectCheckDetection where) {
return surProjectCheckDetectionMapper.groupByCheckType(where);
}
}

View File

@ -100,4 +100,9 @@ public class SurProjectMeasureServiceImpl implements ISurProjectMeasureService
{
return surProjectMeasureMapper.deleteSurProjectMeasureById(id);
}
@Override
public List<SurProjectMeasure> groupMeasureInfo(SurProjectMeasure where) {
return surProjectMeasureMapper.groupMeasureInfo(where);
}
}

View File

@ -103,4 +103,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<select id="groupByCheckType" parameterType="SurProjectCheckDetection" resultMap="SurProjectCheckDetectionResult">
SELECT 1 id,COUNT(1) project_id,'送检数' check_type
FROM sur_project_check_detection WHERE check_type= #{checkType}
<if test="deptId !=null and deptId>0">
and project_id IN (SELECT id FROM sur_project WHERE deptid=#{deptId})
</if>
<if test="projectId !=null">
and project_id=#{projectId}
</if>
UNION
SELECT 2 id,COUNT(1) project_id,'待检数' check_type
FROM sur_project_check_detection WHERE check_type= #{checkType} AND check_state='1'
<if test="deptId !=null and deptId>0">
and project_id IN (SELECT id FROM sur_project WHERE deptid=#{deptId})
</if>
<if test="projectId !=null">
and project_id=#{projectId}
</if>
UNION
SELECT 3 id,COUNT(1) project_id,'合格数' check_type
FROM sur_project_check_detection WHERE check_type= #{checkType} AND detection_result='1'
<if test="deptId !=null and deptId>0">
and project_id IN (SELECT id FROM sur_project WHERE deptid=#{deptId})
</if>
<if test="projectId !=null">
and project_id=#{projectId}
</if>
</select>
</mapper>

View File

@ -163,4 +163,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<select id="groupMeasureInfo" parameterType="SurProjectMeasure" resultMap="SurProjectMeasureResult">
SELECT a.dict_label measure_info,IF(b.cnt IS NULL,0,b.cnt) id FROM (
SELECT * FROM sys_dict_data WHERE dict_type='project_measure_info_type') a
LEFT JOIN
(
SELECT measure_info,COUNT(1) cnt
FROM sur_project_measure
WHERE measure_type = #{measureType} AND IF(is_del IS NULL,0,is_del)=0
<if test="deptId !=null and deptId>0">
AND project_id IN (SELECT id FROM sur_project WHERE deptid=#{deptId})
</if>
<if test="projectId !=null">
AND project_id=#{projectId}
</if>
GROUP BY measure_info
) b
ON a.dict_value=b.measure_info
</select>
</mapper>