危险特殊作业统计危大工程数量+特殊作业数量
安全教育统计入场安全教育+培训计划数量
This commit is contained in:
parent
f69d4a8a53
commit
b144036dda
@ -1,13 +1,10 @@
|
||||
package com.zhgd.xmgl.modules.exam.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.zhgd.annotation.DataScope;
|
||||
import com.zhgd.xmgl.modules.exam.entity.ExamCourse;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.zhgd.xmgl.modules.exam.entity.ExamTrain;
|
||||
@ -23,4 +20,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
public interface ExamTrainMapper extends BaseMapper<ExamTrain> {
|
||||
|
||||
Page<ExamTrain> pageList(Page page, @Param(Constants.WRAPPER) Wrapper<ExamTrain> wrapper);
|
||||
|
||||
Integer count(@Param("projectSn") String projectSn, @Param("list") Set<Long> trainIds);
|
||||
}
|
||||
|
||||
@ -11,4 +11,17 @@
|
||||
left join system_user u on et.create_by = u.user_id) a
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
<select id="count" resultType="java.lang.Integer">
|
||||
select count(*) from (select et.*, s.name as subjectName, u.real_name createByName, cc.course_name courseName, pp.name paperName from exam_train et
|
||||
left join exam_subject s on et.subject_id = s.id
|
||||
left join exam_course cc on et.course_id = cc.id
|
||||
left join exam_paper pp on et.exam_paper_id = pp.id
|
||||
left join system_user u on et.create_by = u.user_id) a
|
||||
where a.project_sn=#{projectSn} and a.id in
|
||||
<foreach item="item" index="index" collection="list"
|
||||
open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
@ -14,10 +14,32 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
* @version: V1.0
|
||||
*/
|
||||
public interface IExamTrainService extends IService<ExamTrain> {
|
||||
/**
|
||||
* 统计培训计划数量
|
||||
* @param projectSn
|
||||
* @return
|
||||
*/
|
||||
int count(String projectSn);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param page
|
||||
* @param wrapper
|
||||
* @return
|
||||
*/
|
||||
Page<ExamTrain> pageList(Page page, QueryWrapper<ExamTrain> wrapper);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param examTrain
|
||||
* @return
|
||||
*/
|
||||
boolean saveInfo(ExamTrain examTrain);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param examTrain
|
||||
* @return
|
||||
*/
|
||||
boolean delInfo(ExamTrain examTrain);
|
||||
}
|
||||
|
||||
@ -2,21 +2,15 @@ package com.zhgd.xmgl.modules.exam.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService;
|
||||
import com.zhgd.xmgl.modules.exam.entity.*;
|
||||
import com.zhgd.xmgl.modules.exam.mapper.ExamTrainMapper;
|
||||
import com.zhgd.xmgl.modules.exam.service.*;
|
||||
import com.zhgd.xmgl.modules.exam.vo.ExamTrainRecordVo;
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
||||
import com.zhgd.xmgl.modules.worker.service.IWorkerInfoService;
|
||||
import com.zhgd.xmgl.security.entity.UserInfo;
|
||||
import com.zhgd.xmgl.security.util.SecurityUtils;
|
||||
import com.zhgd.xmgl.util.DateUtils;
|
||||
import com.zhgd.xmgl.util.EmailUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -29,7 +23,6 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* @Description: 教育培训信息
|
||||
@ -58,6 +51,15 @@ public class ExamTrainServiceImpl extends ServiceImpl<ExamTrainMapper, ExamTrain
|
||||
@Autowired
|
||||
private IExamCourseRecordService examCourseRecordService;
|
||||
|
||||
@Override
|
||||
public int count(String projectSn) {
|
||||
Set<Long> trainIds = examTrainRecordService.list().stream().map(e -> e.getTrainId()).collect(Collectors.toSet());
|
||||
if (trainIds.size() == 0) {
|
||||
return 0;
|
||||
}
|
||||
return baseMapper.count(projectSn,trainIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ExamTrain> pageList(Page page, QueryWrapper<ExamTrain> wrapper) {
|
||||
Set<Long> trainIds = examTrainRecordService.list().stream().map(e -> e.getTrainId()).collect(Collectors.toSet());
|
||||
|
||||
@ -5,10 +5,10 @@ import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class StatsDirectorateBigscreenVo {
|
||||
@ApiModelProperty("危大工程数量")
|
||||
@ApiModelProperty("危大工程数量+特殊作业数量")
|
||||
private Integer dangerousEngineeringRecordNum;
|
||||
|
||||
@ApiModelProperty("人员登记培训数量")
|
||||
@ApiModelProperty("入场安全教育+培训计划数量")
|
||||
private Integer workerInfoAuditRecordNum;
|
||||
|
||||
@ApiModelProperty("影响进度数量")
|
||||
|
||||
@ -28,6 +28,7 @@ import com.zhgd.xmgl.modules.basicdata.service.INoticeService;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.impl.SystemUserServiceImpl;
|
||||
import com.zhgd.xmgl.modules.dangerous.entity.DangerousEngineeringRecord;
|
||||
import com.zhgd.xmgl.modules.dangerous.mapper.DangerousEngineeringRecordMapper;
|
||||
import com.zhgd.xmgl.modules.exam.service.IExamTrainService;
|
||||
import com.zhgd.xmgl.modules.quality.entity.QualityInspectionRecord;
|
||||
import com.zhgd.xmgl.modules.quality.entity.QualityRegion;
|
||||
import com.zhgd.xmgl.modules.quality.mapper.QualityInspectionRecordMapper;
|
||||
@ -58,6 +59,7 @@ import com.zhgd.xmgl.modules.xz.security.service.IXzSecurityInspectTaskItemRecor
|
||||
import com.zhgd.xmgl.modules.xz.security.service.IXzSecurityInspectTaskRecordService;
|
||||
import com.zhgd.xmgl.modules.xz.security.service.IXzSecurityQualityInspectionRecordService;
|
||||
import com.zhgd.xmgl.modules.xz.service.IXzWorkerSafeWatchConfigService;
|
||||
import com.zhgd.xmgl.modules.xz.special.service.CountApiService;
|
||||
import com.zhgd.xmgl.push.config.PushPayloads;
|
||||
import com.zhgd.xmgl.util.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -65,6 +67,7 @@ import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -110,8 +113,15 @@ public class XzSecurityQualityInspectionRecordServiceImpl extends ServiceImpl<Xz
|
||||
XzSecurityDangerItemRecordMapper dangerItemRecordMapper;
|
||||
@Autowired
|
||||
WorkerInfoServiceImpl workerInfoService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
SystemUserServiceImpl systemUserService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
CountApiService countApiService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
IExamTrainService examTrainService;
|
||||
@Autowired
|
||||
private QualityRegionMapper qualityRegionMapper;
|
||||
@Autowired
|
||||
@ -685,9 +695,11 @@ public class XzSecurityQualityInspectionRecordServiceImpl extends ServiceImpl<Xz
|
||||
String projectSn = MapUtils.getString(paramMap, "projectSn");
|
||||
Integer dc = dangerousEngineeringRecordMapper.selectCount(new LambdaQueryWrapper<DangerousEngineeringRecord>()
|
||||
.eq(DangerousEngineeringRecord::getProjectSn, projectSn));
|
||||
dc += countApiService.countSpecial(projectSn);
|
||||
vo.setDangerousEngineeringRecordNum(dc);
|
||||
Integer arc = workerInfoAuditRecordMapper.selectCount(new LambdaQueryWrapper<WorkerInfoAuditRecord>()
|
||||
.eq(WorkerInfoAuditRecord::getProjectSn, projectSn));
|
||||
arc += examTrainService.count(projectSn);
|
||||
vo.setWorkerInfoAuditRecordNum(arc);
|
||||
Integer cc = xzTaskProgressContentMapper.selectCount(new LambdaQueryWrapper<XzTaskProgressContent>()
|
||||
.eq(XzTaskProgressContent::getProjectSn, projectSn)
|
||||
|
||||
@ -32,33 +32,44 @@ import java.util.*;
|
||||
@Slf4j
|
||||
@Api(tags = "星纵-特种作业统计Api")
|
||||
public class CountApiController {
|
||||
@Lazy
|
||||
@Autowired
|
||||
IXzBlindPlatePlugSafeService xzBlindPlatePlugSafeService;
|
||||
@Lazy
|
||||
@Resource
|
||||
IXzGroundSafetService iXzGroundSafetService;
|
||||
@Lazy
|
||||
@Resource
|
||||
IXzHighJobSafeService iXzHighJobSafeService;
|
||||
@Lazy
|
||||
@Resource
|
||||
IXzHoistSafetyWorkService iXzHoistSafetyWorkService;
|
||||
@Lazy
|
||||
@Resource
|
||||
IXzLimitSpaceSafeService iXzLimitSpaceSafeService;
|
||||
@Lazy
|
||||
@Resource
|
||||
IXzOpenCircuitSafeService iXzOpenCircuitSafeService;
|
||||
@Lazy
|
||||
@Resource
|
||||
IXzSpecialOperationFireSafetyService iXzSpecialOperationFireSafetyService;
|
||||
@Lazy
|
||||
@Resource
|
||||
IXzTemporaryElectricitySafeService xzTemporaryElectricitySafeService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private UserEnterpriseServiceImpl userEnterpriseService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private CountApiService countApiService;
|
||||
|
||||
@ApiOperation(value = "统计特殊作业数量", notes = "统计特殊作业数量", httpMethod = "POST")
|
||||
@ApiOperation(value = "统计过去一周每天的特殊作业数量", notes = "统计过去一周每天的特殊作业数量", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"),
|
||||
})
|
||||
@PostMapping(value = "/countAllSpecial")
|
||||
public Result<List<CountSpecialVo>> countAllSpecial(@ApiIgnore @RequestBody Map<String, Object> param) {
|
||||
return Result.success(xzBlindPlatePlugSafeService.countAllSpecial(param));
|
||||
return Result.success(countApiService.countAllSpecial(param));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "统计特殊作业情况", notes = "统计特殊作业情况", httpMethod = "POST")
|
||||
|
||||
@ -0,0 +1,28 @@
|
||||
package com.zhgd.xmgl.modules.xz.special.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zhgd.xmgl.modules.xz.special.entity.XzGasAnalyze;
|
||||
import com.zhgd.xmgl.modules.xz.special.entity.vo.CountSpecialVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 星纵-气体分析
|
||||
* @author: pds
|
||||
* @date: 2024-05-14
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface CountApiMapper {
|
||||
|
||||
/**
|
||||
* 统计过去一周每天的特殊作业数量
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<CountSpecialVo> countAllSpecial(@Param("param") Map<String, Object> param);
|
||||
}
|
||||
@ -49,11 +49,4 @@ public interface XzBlindPlatePlugSafeMapper extends BaseMapper<XzBlindPlatePlugS
|
||||
*/
|
||||
XzBlindPlatePlugSafe queryById(@Param("param") Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* 统计特殊作业数量
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<CountSpecialVo> countAllSpecial(@Param("param") Map<String, Object> param);
|
||||
}
|
||||
|
||||
@ -0,0 +1,110 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhgd.xmgl.modules.xz.special.mapper.CountApiMapper">
|
||||
<select id="countAllSpecial" resultType="com.zhgd.xmgl.modules.xz.special.entity.vo.CountSpecialVo">
|
||||
select
|
||||
t.date,
|
||||
ifnull(sum(if(type=1,num,0)),0) as xzBlindPlatePlugSafeNum,
|
||||
ifnull(sum(if(type=2,num,0)),0) as xzGroundSafetNum,
|
||||
ifnull(sum(if(type=3,num,0)),0) as xzHighJobSafeNum,
|
||||
ifnull(sum(if(type=4,num,0)),0) as xzHoistSafetyWorkNum,
|
||||
ifnull(sum(if(type=5,num,0)),0) as xzLimitSpaceSafeNum,
|
||||
ifnull(sum(if(type=6,num,0)),0) as xzOpenCircuitSafeNum,
|
||||
ifnull(sum(if(type=7,num,0)),0) as xzSpecialOperationFireSafetyNum,
|
||||
ifnull(sum(if(type=8,num,0)),0) as xzTemporaryElectricitySafeNum,
|
||||
ifnull(sum(num),0) as totalNum
|
||||
from
|
||||
(
|
||||
select
|
||||
t.DT as date,
|
||||
count(*) as num,
|
||||
1 as type
|
||||
from xz_blind_plate_plug_safe
|
||||
join (<include refid="lastWeek"/>) as t on IF(work_execution_begin_time is not null and work_execution_end_time is not null,t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') and t.DT<=date_format(work_execution_end_time,'%Y-%m-%d'), IF((work_execution_begin_time is not null and work_execution_end_time is null) or (work_execution_begin_time is null and work_execution_end_time is not null),t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') or t.DT<=date_format(work_execution_end_time,'%Y-%m-%d'),0))
|
||||
where project_sn = #{param.projectSn}
|
||||
group by date
|
||||
union all
|
||||
|
||||
select
|
||||
t.DT as date,
|
||||
count(*) as num,
|
||||
2 as type
|
||||
from xz_ground_safet
|
||||
join (<include refid="lastWeek"/>) as t on IF(work_execution_begin_time is not null and work_execution_end_time is not null,t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') and t.DT<=date_format(work_execution_end_time,'%Y-%m-%d'), IF((work_execution_begin_time is not null and work_execution_end_time is null) or (work_execution_begin_time is null and work_execution_end_time is not null),t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') or t.DT<=date_format(work_execution_end_time,'%Y-%m-%d'),0))
|
||||
where project_sn = #{param.projectSn}
|
||||
group by date
|
||||
union all
|
||||
|
||||
select
|
||||
t.DT as date,
|
||||
count(*) as num,
|
||||
3 as type
|
||||
from xz_high_job_safe
|
||||
join (<include refid="lastWeek"/>) as t on IF(work_execution_begin_time is not null and work_execution_end_time is not null,t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') and t.DT<=date_format(work_execution_end_time,'%Y-%m-%d'), IF((work_execution_begin_time is not null and work_execution_end_time is null) or (work_execution_begin_time is null and work_execution_end_time is not null),t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') or t.DT<=date_format(work_execution_end_time,'%Y-%m-%d'),0))
|
||||
where project_sn = #{param.projectSn}
|
||||
group by date
|
||||
union all
|
||||
|
||||
select
|
||||
t.DT as date,
|
||||
count(*) as num,
|
||||
4 as type
|
||||
from xz_hoist_safety_work
|
||||
join (<include refid="lastWeek"/>) as t on IF(work_execution_begin_time is not null and work_execution_end_time is not null,t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') and t.DT<=date_format(work_execution_end_time,'%Y-%m-%d'), IF((work_execution_begin_time is not null and work_execution_end_time is null) or (work_execution_begin_time is null and work_execution_end_time is not null),t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') or t.DT<=date_format(work_execution_end_time,'%Y-%m-%d'),0))
|
||||
where project_sn = #{param.projectSn}
|
||||
group by date
|
||||
union all
|
||||
|
||||
select
|
||||
t.DT as date,
|
||||
count(*) as num,
|
||||
5 as type
|
||||
from xz_limit_space_safe
|
||||
join (<include refid="lastWeek"/>) as t on IF(work_execution_begin_time is not null and work_execution_end_time is not null,t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') and t.DT<=date_format(work_execution_end_time,'%Y-%m-%d'), IF((work_execution_begin_time is not null and work_execution_end_time is null) or (work_execution_begin_time is null and work_execution_end_time is not null),t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') or t.DT<=date_format(work_execution_end_time,'%Y-%m-%d'),0))
|
||||
where project_sn = #{param.projectSn}
|
||||
group by date
|
||||
union all
|
||||
|
||||
select
|
||||
t.DT as date,
|
||||
count(*) as num,
|
||||
6 as type
|
||||
from xz_open_circuit_safe
|
||||
join (<include refid="lastWeek"/>) as t on IF(work_execution_begin_time is not null and work_execution_end_time is not null,t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') and t.DT<=date_format(work_execution_end_time,'%Y-%m-%d'), IF((work_execution_begin_time is not null and work_execution_end_time is null) or (work_execution_begin_time is null and work_execution_end_time is not null),t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') or t.DT<=date_format(work_execution_end_time,'%Y-%m-%d'),0))
|
||||
where project_sn = #{param.projectSn}
|
||||
group by date
|
||||
union all
|
||||
|
||||
select
|
||||
t.DT as date,
|
||||
count(*) as num,
|
||||
7 as type
|
||||
from xz_special_operation_fire_safety
|
||||
join (<include refid="lastWeek"/>) as t on IF(hot_work_execution_begin_time is not null and hot_work_execution_end_time is not null,t.DT>=date_format(hot_work_execution_begin_time,'%Y-%m-%d') and t.DT<=date_format(hot_work_execution_end_time,'%Y-%m-%d'), IF((hot_work_execution_begin_time is not null and hot_work_execution_end_time is null) or (hot_work_execution_begin_time is null and hot_work_execution_end_time is not null),t.DT>=date_format(hot_work_execution_begin_time,'%Y-%m-%d') or t.DT<=date_format(hot_work_execution_end_time,'%Y-%m-%d'),0))
|
||||
where project_sn = #{param.projectSn}
|
||||
group by date
|
||||
union all
|
||||
|
||||
select
|
||||
t.DT as date,
|
||||
count(*) as num,
|
||||
8 as type
|
||||
from xz_temporary_electricity_safe
|
||||
join (<include refid="lastWeek"/>) as t on IF(work_execution_begin_time is not null and work_execution_end_time is not null,t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') and t.DT<=date_format(work_execution_end_time,'%Y-%m-%d'), IF((work_execution_begin_time is not null and work_execution_end_time is null) or (work_execution_begin_time is null and work_execution_end_time is not null),t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') or t.DT<=date_format(work_execution_end_time,'%Y-%m-%d'),0))
|
||||
where project_sn = #{param.projectSn}
|
||||
group by date
|
||||
)t
|
||||
group by date
|
||||
</select>
|
||||
<sql id="lastWeek">
|
||||
SELECT
|
||||
DATE_FORMAT( DATE_ADD( CONCAT( date_sub(current_date,interval 7 day) ), INTERVAL ( help_topic_id ) DAY ), '%Y-%m-%d' ) DT
|
||||
FROM
|
||||
mysql.help_topic
|
||||
WHERE
|
||||
help_topic_id <= TIMESTAMPDIFF(
|
||||
DAY,
|
||||
CONCAT( date_sub(current_date,interval 7 day) ),
|
||||
CONCAT( current_date ))
|
||||
</sql>
|
||||
</mapper>
|
||||
@ -51,110 +51,4 @@
|
||||
</include>
|
||||
where t.id = #{param.id}
|
||||
</select>
|
||||
<sql id="lastWeek">
|
||||
SELECT
|
||||
DATE_FORMAT( DATE_ADD( CONCAT( date_sub(current_date,interval 7 day) ), INTERVAL ( help_topic_id ) DAY ), '%Y-%m-%d' ) DT
|
||||
FROM
|
||||
mysql.help_topic
|
||||
WHERE
|
||||
help_topic_id <= TIMESTAMPDIFF(
|
||||
DAY,
|
||||
CONCAT( date_sub(current_date,interval 7 day) ),
|
||||
CONCAT( current_date ))
|
||||
</sql>
|
||||
<select id="countAllSpecial" resultType="com.zhgd.xmgl.modules.xz.special.entity.vo.CountSpecialVo">
|
||||
select
|
||||
t.date,
|
||||
ifnull(sum(if(type=1,num,0)),0) as xzBlindPlatePlugSafeNum,
|
||||
ifnull(sum(if(type=2,num,0)),0) as xzGroundSafetNum,
|
||||
ifnull(sum(if(type=3,num,0)),0) as xzHighJobSafeNum,
|
||||
ifnull(sum(if(type=4,num,0)),0) as xzHoistSafetyWorkNum,
|
||||
ifnull(sum(if(type=5,num,0)),0) as xzLimitSpaceSafeNum,
|
||||
ifnull(sum(if(type=6,num,0)),0) as xzOpenCircuitSafeNum,
|
||||
ifnull(sum(if(type=7,num,0)),0) as xzSpecialOperationFireSafetyNum,
|
||||
ifnull(sum(if(type=8,num,0)),0) as xzTemporaryElectricitySafeNum,
|
||||
ifnull(sum(num),0) as totalNum
|
||||
from
|
||||
(
|
||||
select
|
||||
t.DT as date,
|
||||
count(*) as num,
|
||||
1 as type
|
||||
from xz_blind_plate_plug_safe
|
||||
join (<include refid="lastWeek"/>) as t on IF(work_execution_begin_time is not null and work_execution_end_time is not null,t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') and t.DT<=date_format(work_execution_end_time,'%Y-%m-%d'), IF((work_execution_begin_time is not null and work_execution_end_time is null) or (work_execution_begin_time is null and work_execution_end_time is not null),t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') or t.DT<=date_format(work_execution_end_time,'%Y-%m-%d'),0))
|
||||
where project_sn = #{param.projectSn}
|
||||
group by date
|
||||
union all
|
||||
|
||||
select
|
||||
t.DT as date,
|
||||
count(*) as num,
|
||||
2 as type
|
||||
from xz_ground_safet
|
||||
join (<include refid="lastWeek"/>) as t on IF(work_execution_begin_time is not null and work_execution_end_time is not null,t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') and t.DT<=date_format(work_execution_end_time,'%Y-%m-%d'), IF((work_execution_begin_time is not null and work_execution_end_time is null) or (work_execution_begin_time is null and work_execution_end_time is not null),t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') or t.DT<=date_format(work_execution_end_time,'%Y-%m-%d'),0))
|
||||
where project_sn = #{param.projectSn}
|
||||
group by date
|
||||
union all
|
||||
|
||||
select
|
||||
t.DT as date,
|
||||
count(*) as num,
|
||||
3 as type
|
||||
from xz_high_job_safe
|
||||
join (<include refid="lastWeek"/>) as t on IF(work_execution_begin_time is not null and work_execution_end_time is not null,t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') and t.DT<=date_format(work_execution_end_time,'%Y-%m-%d'), IF((work_execution_begin_time is not null and work_execution_end_time is null) or (work_execution_begin_time is null and work_execution_end_time is not null),t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') or t.DT<=date_format(work_execution_end_time,'%Y-%m-%d'),0))
|
||||
where project_sn = #{param.projectSn}
|
||||
group by date
|
||||
union all
|
||||
|
||||
select
|
||||
t.DT as date,
|
||||
count(*) as num,
|
||||
4 as type
|
||||
from xz_hoist_safety_work
|
||||
join (<include refid="lastWeek"/>) as t on IF(work_execution_begin_time is not null and work_execution_end_time is not null,t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') and t.DT<=date_format(work_execution_end_time,'%Y-%m-%d'), IF((work_execution_begin_time is not null and work_execution_end_time is null) or (work_execution_begin_time is null and work_execution_end_time is not null),t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') or t.DT<=date_format(work_execution_end_time,'%Y-%m-%d'),0))
|
||||
where project_sn = #{param.projectSn}
|
||||
group by date
|
||||
union all
|
||||
|
||||
select
|
||||
t.DT as date,
|
||||
count(*) as num,
|
||||
5 as type
|
||||
from xz_limit_space_safe
|
||||
join (<include refid="lastWeek"/>) as t on IF(work_execution_begin_time is not null and work_execution_end_time is not null,t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') and t.DT<=date_format(work_execution_end_time,'%Y-%m-%d'), IF((work_execution_begin_time is not null and work_execution_end_time is null) or (work_execution_begin_time is null and work_execution_end_time is not null),t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') or t.DT<=date_format(work_execution_end_time,'%Y-%m-%d'),0))
|
||||
where project_sn = #{param.projectSn}
|
||||
group by date
|
||||
union all
|
||||
|
||||
select
|
||||
t.DT as date,
|
||||
count(*) as num,
|
||||
6 as type
|
||||
from xz_open_circuit_safe
|
||||
join (<include refid="lastWeek"/>) as t on IF(work_execution_begin_time is not null and work_execution_end_time is not null,t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') and t.DT<=date_format(work_execution_end_time,'%Y-%m-%d'), IF((work_execution_begin_time is not null and work_execution_end_time is null) or (work_execution_begin_time is null and work_execution_end_time is not null),t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') or t.DT<=date_format(work_execution_end_time,'%Y-%m-%d'),0))
|
||||
where project_sn = #{param.projectSn}
|
||||
group by date
|
||||
union all
|
||||
|
||||
select
|
||||
t.DT as date,
|
||||
count(*) as num,
|
||||
7 as type
|
||||
from xz_special_operation_fire_safety
|
||||
join (<include refid="lastWeek"/>) as t on IF(hot_work_execution_begin_time is not null and hot_work_execution_end_time is not null,t.DT>=date_format(hot_work_execution_begin_time,'%Y-%m-%d') and t.DT<=date_format(hot_work_execution_end_time,'%Y-%m-%d'), IF((hot_work_execution_begin_time is not null and hot_work_execution_end_time is null) or (hot_work_execution_begin_time is null and hot_work_execution_end_time is not null),t.DT>=date_format(hot_work_execution_begin_time,'%Y-%m-%d') or t.DT<=date_format(hot_work_execution_end_time,'%Y-%m-%d'),0))
|
||||
where project_sn = #{param.projectSn}
|
||||
group by date
|
||||
union all
|
||||
|
||||
select
|
||||
t.DT as date,
|
||||
count(*) as num,
|
||||
8 as type
|
||||
from xz_temporary_electricity_safe
|
||||
join (<include refid="lastWeek"/>) as t on IF(work_execution_begin_time is not null and work_execution_end_time is not null,t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') and t.DT<=date_format(work_execution_end_time,'%Y-%m-%d'), IF((work_execution_begin_time is not null and work_execution_end_time is null) or (work_execution_begin_time is null and work_execution_end_time is not null),t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') or t.DT<=date_format(work_execution_end_time,'%Y-%m-%d'),0))
|
||||
where project_sn = #{param.projectSn}
|
||||
group by date
|
||||
)t
|
||||
group by date
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -0,0 +1,134 @@
|
||||
package com.zhgd.xmgl.modules.xz.special.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.zhgd.xmgl.modules.xz.special.entity.*;
|
||||
import com.zhgd.xmgl.modules.xz.special.entity.vo.CountSpecialVo;
|
||||
import com.zhgd.xmgl.modules.xz.special.mapper.CountApiMapper;
|
||||
import com.zhgd.xmgl.util.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class CountApiService {
|
||||
@Autowired
|
||||
CountApiMapper countApiMapper;
|
||||
@Lazy
|
||||
@Autowired
|
||||
IXzBlindPlatePlugSafeService xzBlindPlatePlugSafeService;
|
||||
@Lazy
|
||||
@Resource
|
||||
IXzGroundSafetService iXzGroundSafetService;
|
||||
@Lazy
|
||||
@Resource
|
||||
IXzHighJobSafeService iXzHighJobSafeService;
|
||||
@Lazy
|
||||
@Resource
|
||||
IXzHoistSafetyWorkService iXzHoistSafetyWorkService;
|
||||
@Lazy
|
||||
@Resource
|
||||
IXzLimitSpaceSafeService iXzLimitSpaceSafeService;
|
||||
@Lazy
|
||||
@Resource
|
||||
IXzOpenCircuitSafeService iXzOpenCircuitSafeService;
|
||||
@Lazy
|
||||
@Resource
|
||||
IXzSpecialOperationFireSafetyService iXzSpecialOperationFireSafetyService;
|
||||
@Lazy
|
||||
@Resource
|
||||
IXzTemporaryElectricitySafeService xzTemporaryElectricitySafeService;
|
||||
|
||||
/**
|
||||
* 统计过去一周每天的特殊作业数量
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
public List<CountSpecialVo> countAllSpecial(Map<String, Object> param) {
|
||||
List<CountSpecialVo> rtList = new ArrayList<>();
|
||||
List<CountSpecialVo> list = countApiMapper.countAllSpecial(param);
|
||||
Map<String, CountSpecialVo> dateMap = list.stream().collect(Collectors.toMap(CountSpecialVo::getDate, Function.identity(), (countSpecialVo, countSpecialVo2) -> countSpecialVo2));
|
||||
List<String> dateList = DateUtils.getDateTimeStrList(60, "yyyy-MM-dd");
|
||||
for (String date : dateList) {
|
||||
CountSpecialVo vo = dateMap.get(date);
|
||||
if (vo == null) {
|
||||
vo = new CountSpecialVo();
|
||||
}
|
||||
fillEmtpy(vo);
|
||||
vo.setDate(date);
|
||||
rtList.add(vo);
|
||||
}
|
||||
return rtList;
|
||||
}
|
||||
|
||||
private void fillEmtpy(CountSpecialVo vo) {
|
||||
if (vo.getTotalNum() == null) {
|
||||
vo.setTotalNum(0);
|
||||
}
|
||||
if (vo.getXzBlindPlatePlugSafeNum() == null) {
|
||||
vo.setXzBlindPlatePlugSafeNum(0);
|
||||
}
|
||||
if (vo.getXzGroundSafetNum() == null) {
|
||||
vo.setXzGroundSafetNum(0);
|
||||
}
|
||||
if (vo.getXzHighJobSafeNum() == null) {
|
||||
vo.setXzHighJobSafeNum(0);
|
||||
}
|
||||
if (vo.getXzHoistSafetyWorkNum() == null) {
|
||||
vo.setXzHoistSafetyWorkNum(0);
|
||||
}
|
||||
if (vo.getXzLimitSpaceSafeNum() == null) {
|
||||
vo.setXzLimitSpaceSafeNum(0);
|
||||
}
|
||||
if (vo.getXzOpenCircuitSafeNum() == null) {
|
||||
vo.setXzOpenCircuitSafeNum(0);
|
||||
}
|
||||
if (vo.getXzSpecialOperationFireSafetyNum() == null) {
|
||||
vo.setXzSpecialOperationFireSafetyNum(0);
|
||||
}
|
||||
if (vo.getXzTemporaryElectricitySafeNum() == null) {
|
||||
vo.setXzTemporaryElectricitySafeNum(0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计特殊作业数量
|
||||
*
|
||||
* @param projectSn
|
||||
* @return
|
||||
*/
|
||||
public Integer countSpecial(String projectSn) {
|
||||
int n1 = xzBlindPlatePlugSafeService.count(new LambdaQueryWrapper<XzBlindPlatePlugSafe>()
|
||||
.eq(XzBlindPlatePlugSafe::getProjectSn, projectSn)
|
||||
);
|
||||
int n2 = iXzGroundSafetService.count(new LambdaQueryWrapper<XzGroundSafet>()
|
||||
.eq(XzGroundSafet::getProjectSn, projectSn)
|
||||
);
|
||||
int n3 = iXzHighJobSafeService.count(new LambdaQueryWrapper<XzHighJobSafe>()
|
||||
.eq(XzHighJobSafe::getProjectSn, projectSn)
|
||||
);
|
||||
int n4 = iXzHoistSafetyWorkService.count(new LambdaQueryWrapper<XzHoistSafetyWork>()
|
||||
.eq(XzHoistSafetyWork::getProjectSn, projectSn)
|
||||
);
|
||||
int n5 = iXzLimitSpaceSafeService.count(new LambdaQueryWrapper<XzLimitSpaceSafe>()
|
||||
.eq(XzLimitSpaceSafe::getProjectSn, projectSn)
|
||||
);
|
||||
int n6 = iXzOpenCircuitSafeService.count(new LambdaQueryWrapper<XzOpenCircuitSafe>()
|
||||
.eq(XzOpenCircuitSafe::getProjectSn, projectSn)
|
||||
);
|
||||
int n7 = iXzSpecialOperationFireSafetyService.count(new LambdaQueryWrapper<XzSpecialOperationFireSafety>()
|
||||
.eq(XzSpecialOperationFireSafety::getProjectSn, projectSn)
|
||||
);
|
||||
int n8 = xzTemporaryElectricitySafeService.count(new LambdaQueryWrapper<XzTemporaryElectricitySafe>()
|
||||
.eq(XzTemporaryElectricitySafe::getProjectSn, projectSn)
|
||||
);
|
||||
return n1 + n2 + n3 + n4 + n5 + n6 + n7 + n8;
|
||||
}
|
||||
}
|
||||
@ -68,12 +68,5 @@ public interface IXzBlindPlatePlugSafeService extends IService<XzBlindPlatePlugS
|
||||
*/
|
||||
void finish(Long engineeringId);
|
||||
|
||||
/**
|
||||
* 统计特殊作业数量
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<CountSpecialVo> countAllSpecial(Map<String, Object> param);
|
||||
|
||||
}
|
||||
|
||||
@ -161,53 +161,4 @@ public class XzBlindPlatePlugSafeServiceImpl extends ServiceImpl<XzBlindPlatePlu
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CountSpecialVo> countAllSpecial(Map<String, Object> param) {
|
||||
List<CountSpecialVo> rtList = new ArrayList<>();
|
||||
List<CountSpecialVo> list = baseMapper.countAllSpecial(param);
|
||||
Map<String, CountSpecialVo> dateMap = list.stream().collect(Collectors.toMap(CountSpecialVo::getDate, Function.identity(), (countSpecialVo, countSpecialVo2) -> countSpecialVo2));
|
||||
List<String> dateList = DateUtils.getDateTimeStrList(60, "yyyy-MM-dd");
|
||||
for (String date : dateList) {
|
||||
CountSpecialVo vo = dateMap.get(date);
|
||||
if (vo == null) {
|
||||
vo = new CountSpecialVo();
|
||||
}
|
||||
fillEmtpy(vo);
|
||||
vo.setDate(date);
|
||||
rtList.add(vo);
|
||||
}
|
||||
return rtList;
|
||||
}
|
||||
|
||||
|
||||
private void fillEmtpy(CountSpecialVo vo) {
|
||||
if (vo.getTotalNum() == null) {
|
||||
vo.setTotalNum(0);
|
||||
}
|
||||
if (vo.getXzBlindPlatePlugSafeNum() == null) {
|
||||
vo.setXzBlindPlatePlugSafeNum(0);
|
||||
}
|
||||
if (vo.getXzGroundSafetNum() == null) {
|
||||
vo.setXzGroundSafetNum(0);
|
||||
}
|
||||
if (vo.getXzHighJobSafeNum() == null) {
|
||||
vo.setXzHighJobSafeNum(0);
|
||||
}
|
||||
if (vo.getXzHoistSafetyWorkNum() == null) {
|
||||
vo.setXzHoistSafetyWorkNum(0);
|
||||
}
|
||||
if (vo.getXzLimitSpaceSafeNum() == null) {
|
||||
vo.setXzLimitSpaceSafeNum(0);
|
||||
}
|
||||
if (vo.getXzOpenCircuitSafeNum() == null) {
|
||||
vo.setXzOpenCircuitSafeNum(0);
|
||||
}
|
||||
if (vo.getXzSpecialOperationFireSafetyNum() == null) {
|
||||
vo.setXzSpecialOperationFireSafetyNum(0);
|
||||
}
|
||||
if (vo.getXzTemporaryElectricitySafeNum() == null) {
|
||||
vo.setXzTemporaryElectricitySafeNum(0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user