Merge branch 'dev' of http://62.234.3.186:3000/sxyanzhu/jhprjv2 into dev
commit
f31d243dcf
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -58,4 +58,6 @@ public interface SurProjectCheckDetectionMapper
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteSurProjectCheckDetectionByIds(Long[] ids);
|
||||
|
||||
public List<SurProjectCheckDetection> groupByCheckType(SurProjectCheckDetection where);
|
||||
}
|
||||
|
|
|
@ -58,4 +58,6 @@ public interface SurProjectMeasureMapper
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteSurProjectMeasureByIds(Long[] ids);
|
||||
|
||||
public List<SurProjectMeasure> groupMeasureInfo(SurProjectMeasure where);
|
||||
}
|
||||
|
|
|
@ -58,4 +58,6 @@ public interface ISurProjectCheckDetectionService
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteSurProjectCheckDetectionById(Long id);
|
||||
|
||||
public List<SurProjectCheckDetection> groupByCheckType(SurProjectCheckDetection where);
|
||||
}
|
||||
|
|
|
@ -58,4 +58,6 @@ public interface ISurProjectMeasureService
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteSurProjectMeasureById(Long id);
|
||||
|
||||
public List<SurProjectMeasure> groupMeasureInfo(SurProjectMeasure where);
|
||||
}
|
||||
|
|
|
@ -95,4 +95,9 @@ public class SurProjectCheckDetectionServiceImpl implements ISurProjectCheckDete
|
|||
{
|
||||
return surProjectCheckDetectionMapper.deleteSurProjectCheckDetectionById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SurProjectCheckDetection> groupByCheckType(SurProjectCheckDetection where) {
|
||||
return surProjectCheckDetectionMapper.groupByCheckType(where);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,4 +100,9 @@ public class SurProjectMeasureServiceImpl implements ISurProjectMeasureService
|
|||
{
|
||||
return surProjectMeasureMapper.deleteSurProjectMeasureById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SurProjectMeasure> groupMeasureInfo(SurProjectMeasure where) {
|
||||
return surProjectMeasureMapper.groupMeasureInfo(where);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>
|
|
@ -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>
|
Loading…
Reference in New Issue