bug修改
This commit is contained in:
parent
e5cc60231e
commit
c156b3a9fd
@ -1286,6 +1286,7 @@ public class HikvisionCall {
|
||||
* @param carInfo
|
||||
*/
|
||||
public void addCarInfoFromHikvision(CarInfo carInfo) throws Exception {
|
||||
deleteCarInfoForHikvision(carInfo);
|
||||
Project project = projectMapper.selectOne(new LambdaQueryWrapper<Project>().eq(Project::getProjectSn, carInfo.getProjectSn()));
|
||||
if (project == null || !Objects.equals(project.getSyncHikvision(), 1)) {
|
||||
return;
|
||||
@ -1442,6 +1443,7 @@ public class HikvisionCall {
|
||||
if (project == null || !Objects.equals(project.getSyncHikvision(), 1)) {
|
||||
return;
|
||||
}
|
||||
deleteCarInfoForHikvision(carInfo);
|
||||
//先删除再新增
|
||||
deleteCarInfoForHikvision(old);
|
||||
addCarInfoFromHikvision(carInfo);
|
||||
|
||||
@ -30,7 +30,7 @@ public class Notice implements Serializable {
|
||||
private java.lang.Long id;
|
||||
@ApiModelProperty(value = "类型,1考勤提醒,2人员报警,3车辆,4混凝土监测,5卸料平台,6配电箱,7扬尘,8视频,9标养室,10安全检查,11质量检查,12塔吊,13升降机," +
|
||||
"14电表,15水表,16访客,17,防疫人员通知,18访客通知,19巡检点,20人员的资质证书即将到期,21人员的合同信息即将到期,22人员的保险信息即将到期," +
|
||||
"23同步人员到海康isc,24同步车辆到海康isc,25同步组织到海康isc 30工作流审批通知,31大屏的安全和质量")
|
||||
"23同步人员到海康isc,24同步车辆到海康isc,25同步组织到海康isc 30工作流审批通知,31大屏的安全和质量,32大屏的危大")
|
||||
private java.lang.String type;
|
||||
/**
|
||||
* 消息内容
|
||||
|
||||
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.xmgl.modules.dangerous.entity.DangerousEngineeringRecord;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zhgd.xmgl.modules.xz.security.entity.XzSecurityQualityInspectionRecord;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
@ -23,6 +24,8 @@ public interface IDangerousEngineeringRecordService extends IService<DangerousEn
|
||||
|
||||
void saveDangerousEngineeringRecord(DangerousEngineeringRecord dangerousEngineeringRecord);
|
||||
|
||||
void noticeBigScreen(String projectSn, String time, Boolean isSuperDanger, String format);
|
||||
|
||||
void edit(DangerousEngineeringRecord dangerousEngineeringRecord);
|
||||
|
||||
void endEngineer(Map<String, Object> paramMap);
|
||||
|
||||
@ -2,14 +2,19 @@ package com.zhgd.xmgl.modules.dangerous.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.gexin.fastjson.JSON;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.Notice;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
||||
import com.zhgd.xmgl.modules.basicdata.mapper.SystemUserMapper;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.INoticeService;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.impl.SystemUserServiceImpl;
|
||||
import com.zhgd.xmgl.modules.dangerous.entity.*;
|
||||
import com.zhgd.xmgl.modules.dangerous.mapper.*;
|
||||
@ -19,6 +24,7 @@ import com.zhgd.xmgl.modules.dangerous.service.IDangerousEngineeringSideStationS
|
||||
import com.zhgd.xmgl.modules.dangerous.service.IHiddenDangerInspectRecordService;
|
||||
import com.zhgd.xmgl.modules.worker.mapper.EnterpriseInfoMapper;
|
||||
import com.zhgd.xmgl.security.util.SecurityUtils;
|
||||
import com.zhgd.xmgl.util.MapBuilder;
|
||||
import com.zhgd.xmgl.util.MessageUtil;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -39,6 +45,10 @@ import java.util.stream.Collectors;
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class DangerousEngineeringRecordServiceImpl extends ServiceImpl<DangerousEngineeringRecordMapper, DangerousEngineeringRecord> implements IDangerousEngineeringRecordService {
|
||||
@Autowired
|
||||
SystemUserMapper systemUserMapper;
|
||||
@Autowired
|
||||
INoticeService noticeService;
|
||||
@Autowired
|
||||
private DangerousEngineeringAcceptanceCheckMapper dangerousEngineeringAcceptanceCheckMapper;
|
||||
@Autowired
|
||||
@ -61,11 +71,9 @@ public class DangerousEngineeringRecordServiceImpl extends ServiceImpl<Dangerous
|
||||
private DangerousEngineeringControlItemMapper dangerousEngineeringControlItemMapper;
|
||||
@Autowired
|
||||
private IHiddenDangerInspectRecordService hiddenDangerInspectRecordService;
|
||||
|
||||
@Autowired
|
||||
private IDangerousEngineeringSideStationService dangerousEngineeringSideStationService;
|
||||
|
||||
|
||||
@Override
|
||||
public IPage<EntityMap> queryDangerousEngineeringPageList(Map<String, Object> map) {
|
||||
int pageNo = Integer.parseInt(map.getOrDefault("pageNo", 1).toString());
|
||||
@ -106,10 +114,27 @@ public class DangerousEngineeringRecordServiceImpl extends ServiceImpl<Dangerous
|
||||
@Override
|
||||
public void saveDangerousEngineeringRecord(DangerousEngineeringRecord dangerousEngineeringRecord) {
|
||||
dangerousEngineeringRecord.setCreateTime(new Date());
|
||||
Boolean isSuperDanger = dangerousEngineeringTypeDescribeMapper.isSuperDangerByEngineeringId(String.valueOf(dangerousEngineeringRecord.getId()));
|
||||
dangerousEngineeringRecord.setDangerType(2);
|
||||
dangerousEngineeringRecordMapper.insert(dangerousEngineeringRecord);
|
||||
replaceTypeDescribeAndControllerContent(dangerousEngineeringRecord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void noticeBigScreen(String projectSn, String time, Boolean isSuperDanger, String format) {
|
||||
List<SystemUser> systemUsers = systemUserMapper.getSystemUsers(new MapBuilder<String, Object>().put("sn", projectSn).put("type", 3).build());
|
||||
for (SystemUser systemUser : systemUsers) {
|
||||
Notice notice = new Notice();
|
||||
notice.setType("32");
|
||||
notice.setMsg(format);
|
||||
notice.setAccountId(systemUser.getUserId());
|
||||
notice.setTitle("大屏通知");
|
||||
notice.setSendTime(DateUtil.now());
|
||||
notice.setPayload(JSON.toJSONString(new MapBuilder<String, Object>().put("isSuperDanger", isSuperDanger).put("time", time).build()));
|
||||
noticeService.addNotice(notice, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void replaceTypeDescribeAndControllerContent(DangerousEngineeringRecord dangerousEngineeringRecord) {
|
||||
Long id = dangerousEngineeringRecord.getId();
|
||||
dangerousEngineeringChooseTypeDescribeMapper.delete(new LambdaQueryWrapper<DangerousEngineeringChooseTypeDescribe>()
|
||||
@ -141,6 +166,9 @@ public class DangerousEngineeringRecordServiceImpl extends ServiceImpl<Dangerous
|
||||
}
|
||||
dangerousEngineeringControlItemService.saveBatch(itemList);
|
||||
}
|
||||
noticeBigScreen(dangerousEngineeringRecord.getProjectSn(), dangerousEngineeringRecord.getPlanStartTime() + " - " + dangerousEngineeringRecord.getPlanEndTime(), Objects.equals(dangerousEngineeringRecord.getDangerType(), 2),
|
||||
StrUtil.format("{}发起了一条{}危大工程作业,请注意加强相关风险要点安全管控!", dangerousEngineeringRecord.getResponsibilityCompany(), dangerousEngineeringRecord.getEngineeringName()));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -348,6 +348,7 @@ public class XzSecurityQualityInspectionRecordController {
|
||||
@ApiImplicitParam(name = "isOverdueRectification", value = "是否超期未整改1是", paramType = "body", required = false, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "inspectTime_begin", value = "检查开始时间", paramType = "body", required = false, dataType = "String"),
|
||||
@ApiImplicitParam(name = "inspectTime_end", value = "检查结束时间", paramType = "body", required = false, dataType = "String"),
|
||||
@ApiImplicitParam(name = "enumType", value = "问题等级,1重大隐患,2较大隐患,3一般隐患,4低隐患", paramType = "body", required = false, dataType = "Integer"),
|
||||
})
|
||||
@PostMapping(value = "/countQualityInspectionRecordRegion")
|
||||
public Result<List<TrendOneVo>> countQualityInspectionRecordRegion(@ApiIgnore @RequestBody HashMap<String, Object> paramMap) {
|
||||
@ -477,4 +478,14 @@ public class XzSecurityQualityInspectionRecordController {
|
||||
resultMap.put("radio", subtract);
|
||||
return Result.success(resultMap);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "风险走势图", notes = "风险走势图", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"),
|
||||
})
|
||||
@PostMapping(value = "/riskChart")
|
||||
public Result<List<XzSecurityQualityInspectionRecordTotalVo>> riskChart(@RequestBody Map<String, Object> map) {
|
||||
return Result.success(qualityInspectionRecordService.riskChart(map));
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,7 +12,9 @@ public class XzSecurityQualityInspectionRecordTotalVo {
|
||||
private Double rectificationRatio;
|
||||
@ApiModelProperty("合格(已闭合)")
|
||||
private Integer closeNum;
|
||||
@ApiModelProperty("待复查")
|
||||
private Integer reviewNum;
|
||||
@ApiModelProperty("排查记录")
|
||||
private Integer investigateNum;
|
||||
@ApiModelProperty("超期未关闭")
|
||||
private Integer overdueNotCloseNum;
|
||||
@ -54,6 +56,11 @@ public class XzSecurityQualityInspectionRecordTotalVo {
|
||||
private Integer whichWeekOfMonth;
|
||||
@ApiModelProperty(value = "周日期区间")
|
||||
private String weekBetweenStr;
|
||||
|
||||
@ApiModelProperty(value = "年月")
|
||||
private String yearMonth;
|
||||
@ApiModelProperty(value = "上个月名称")
|
||||
private String lastMonth;
|
||||
@ApiModelProperty(value = "月环比")
|
||||
private Double monthlyBasis;
|
||||
|
||||
}
|
||||
|
||||
@ -35,6 +35,8 @@ public interface XzSecurityQualityInspectionRecordMapper extends BaseMapper<XzSe
|
||||
|
||||
List<XzSecurityQualityInspectionRecordTotalVo> selectQualityInspectionRecordPageTotal(@Param("param") Map<String, Object> map, @Param("o") Object o);
|
||||
|
||||
List<XzSecurityQualityInspectionRecordTotalVo> riskChart(@Param("param") Map<String, Object> map);
|
||||
|
||||
List<Map<String, Object>> selectQualityInspectionRecordCountByDay(Map<String, Object> map);
|
||||
|
||||
List<Map<String, Object>> selectDangerTypeQualityCount(Map<String, Object> map);
|
||||
@ -74,4 +76,5 @@ public interface XzSecurityQualityInspectionRecordMapper extends BaseMapper<XzSe
|
||||
Page<StatsByEnterpriseVo> statsByEnterprise(@Param("param") Map<String, Object> paramMap, Page page);
|
||||
|
||||
List<SectorOneVo> statsDangerType(@Param("param") Map<String, Object> paramMap);
|
||||
|
||||
}
|
||||
|
||||
@ -2,6 +2,18 @@
|
||||
<!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.security.mapper.XzSecurityQualityInspectionRecordMapper">
|
||||
<sql id="whereCondition">
|
||||
<if test="param.inspectTime_begin != null and param.inspectTime_begin != ''">
|
||||
and t.inspect_time <![CDATA[>=]]> #{param.inspectTime_begin}
|
||||
</if>
|
||||
<if test="param.inspectTime_end != null and param.inspectTime_end != ''">
|
||||
and t.inspect_time <![CDATA[<=]]> if(LENGTH(#{param.inspectTime_end}) = 10,
|
||||
CONCAT(DATE_FORMAT(
|
||||
#{param.inspectTime_end}, '%Y-%m-%d'), ' 23:59:59'),
|
||||
#{param.inspectTime_end})
|
||||
</if>
|
||||
<if test="param.enumType != null and param.enumType != ''">
|
||||
and t.level = #{param.enumType}
|
||||
</if>
|
||||
<if test="param.isOverdueRectification == '1'.toString()">
|
||||
and (t.status = 2 AND now() > t.change_limit_time)
|
||||
</if>
|
||||
@ -13,8 +25,161 @@
|
||||
</if>
|
||||
<if test="param.inspectEndTime != null and param.inspectEndTime != ''">
|
||||
and t.inspect_time <= if(LENGTH(#{param.inspectEndTime}) = 10,
|
||||
CONCAT(DATE_FORMAT(#{param.inspectEndTime},'%Y-%m-%d'),' 23:59:59'), #{param.inspectEndTime})
|
||||
CONCAT(DATE_FORMAT(
|
||||
#{param.inspectEndTime}, '%Y-%m-%d'), ' 23:59:59'),
|
||||
#{param.inspectEndTime})
|
||||
</if>
|
||||
<if test="param.regionId != null and param.regionId != ''">
|
||||
and t.region_id = #{param.regionId}
|
||||
</if>
|
||||
<if test="param.changeId != null and param.changeId != ''">
|
||||
and t.change_id = #{param.changeId}
|
||||
</if>
|
||||
<if test="param.reviewId != null and param.reviewId != ''">
|
||||
and t.review_id = #{param.reviewId}
|
||||
</if>
|
||||
<if test="param.verifyManId != null and param.verifyManId != ''">
|
||||
and t.verify_man_id = #{param.verifyManId}
|
||||
</if>
|
||||
<if test="param.creatorId != null and param.creatorId != ''">
|
||||
and t.creator_id = #{param.creatorId}
|
||||
</if>
|
||||
<if test="param.inspectManId != null and param.inspectManId != ''">
|
||||
and t.inspect_man_id = #{param.inspectManId}
|
||||
</if>
|
||||
<if test="param.level != null and param.level != ''">
|
||||
and t.level = #{param.level}
|
||||
</if>
|
||||
<if test="param.status != null and param.status != ''">
|
||||
and t.status = #{param.status}
|
||||
</if>
|
||||
<if test="param.urgentLevel != null and param.urgentLevel != ''">
|
||||
and t.urgent_level = #{param.urgentLevel}
|
||||
</if>
|
||||
<if test="param.recordStatus == '1'.toString()">
|
||||
and t.record_type = 2
|
||||
</if>
|
||||
<if test="param.recordStatus == '2'.toString()">
|
||||
and t.status = 5
|
||||
</if>
|
||||
<if test="param.recordStatus == '3'.toString()">
|
||||
and t.status in (1, 2, 3, 4, 6)
|
||||
</if>
|
||||
<if test="param.recordStatus == '4'.toString()">
|
||||
and t.status in (1, 2, 3, 4, 6)
|
||||
and t.change_limit_time > DATE_FORMAT(now(), "%Y-%m-%d")
|
||||
</if>
|
||||
<if test="param.recordStatus == '5'.toString()">
|
||||
and t.status = 2
|
||||
</if>
|
||||
<if test="param.recordStatus == '6'.toString()">
|
||||
and t.status = 3
|
||||
</if>
|
||||
<if test="param.recordStatus == '7'.toString()">
|
||||
and t.status = 4
|
||||
</if>
|
||||
<if test="param.isDangerousEngineering == '1'.toString()">
|
||||
and t.engineering_id is not null
|
||||
</if>
|
||||
<if test="param.recordType != null and param.recordType != ''">
|
||||
and t.record_type =
|
||||
#{param.recordType}
|
||||
</if>
|
||||
<if test="param.changeId != null and param.changeId != ''">
|
||||
and t.change_id = #{param.changeId}
|
||||
</if>
|
||||
<if test="param.reviewId != null and param.reviewId != ''">
|
||||
and t.review_id = #{param.reviewId}
|
||||
</if>
|
||||
<if test="param.verifyManId != null and param.verifyManId != ''">
|
||||
and t.verify_man_id = #{param.verifyManId}
|
||||
</if>
|
||||
<if test="param.creatorId != null and param.creatorId != ''">
|
||||
and t.creator_id = #{param.creatorId}
|
||||
</if>
|
||||
<if test="param.inspectManId != null and param.inspectManId != ''">
|
||||
and t.inspect_man_id = #{param.inspectManId}
|
||||
</if>
|
||||
<if test="param.operatorId != null and param.operatorId != ''">
|
||||
and ((t.change_id = #{param.operatorId} and t.status = 2) or (t.review_id = #{param.operatorId} and t.status
|
||||
= 3) or (t.verify_man_id = #{param.operatorId} and t.status = 4))
|
||||
</if>
|
||||
<if test="param.status != null and param.status != '' and param.status != '7'.toString()">
|
||||
and t.status = #{param.status}
|
||||
</if>
|
||||
<if test="param.status == '7'.toString()">
|
||||
and t.change_limit_time <![CDATA[<]]> current_date and t.status != 5
|
||||
</if>
|
||||
<if test="param.search != null and param.search != ''">
|
||||
and ( t.region_name like concat('%',
|
||||
#{param.search}, '%')
|
||||
or t.danger_item_content like concat('%',
|
||||
#{param.search}, '%')
|
||||
or t.danger_desc like concat('%',
|
||||
#{param.search}, '%')
|
||||
or t.remark like concat('%',
|
||||
#{param.search}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="param.itemId != null and param.itemId != ''">
|
||||
and t.item_id =
|
||||
#{param.itemId}
|
||||
</if>
|
||||
<if test="param.engineeringId != null and param.engineeringId != ''">
|
||||
and t.engineering_id = #{param.engineeringId}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<sql id="selectTotal">
|
||||
select tp.*,
|
||||
round(IFNULL(TRUNCATE(IFNULL(closeNum, 0) / IFNULL(totalNum, 0), 4), 0) * 100,
|
||||
2) completeRatio,<!--闭合率-->
|
||||
round(IFNULL(TRUNCATE(IFNULL(totalNum - rectificationNum, 0) / IFNULL(totalNum, 0), 4), 0) * 100, 2)
|
||||
rectificationRatio, <!--整改率-->
|
||||
round(IFNULL(TRUNCATE(IFNULL(overdueRectificationNum, 0) / IFNULL(totalNum, 0), 4), 0) * 100, 2)
|
||||
overdueRectificationNumRatio
|
||||
from (
|
||||
SELECT count(1) totalNum,
|
||||
IFNULL(SUM((CASE WHEN t.record_type = 2 THEN 1 ELSE 0 END)), 0) investigateNum,
|
||||
IFNULL(SUM((CASE WHEN t.status = 5 THEN 1 ELSE 0 END)), 0) closeNum,
|
||||
IFNULL(SUM((CASE
|
||||
WHEN t.status = 1 OR t.status = 2 OR t.status = 3 OR t.status = 4 THEN 1
|
||||
ELSE 0 END)), 0) notCloseNum,
|
||||
IFNULL(SUM((CASE
|
||||
WHEN t.status != 5 AND now() > t.change_limit_time THEN 1
|
||||
ELSE 0 END)), 0) overdueNotCloseNum,
|
||||
IFNULL(SUM((CASE
|
||||
WHEN t.status = 2 AND now() > t.change_limit_time THEN 1
|
||||
ELSE 0 END)), 0) overdueRectificationNum,
|
||||
IFNULL(SUM((CASE WHEN t.status = 2 THEN 1 ELSE 0 END)), 0) rectificationNum,
|
||||
IFNULL(SUM((CASE WHEN t.status != 2 THEN 1 ELSE 0 END)), 0) alreadyRectificationNum,
|
||||
IFNULL(SUM((CASE WHEN t.status = 3 THEN 1 ELSE 0 END)), 0) reviewNum,
|
||||
IFNULL(SUM((CASE WHEN t.status = 4 THEN 1 ELSE 0 END)), 0) verificationNum,
|
||||
IFNULL(SUM((CASE WHEN t.urgent_level = 1 THEN 1 ELSE 0 END)), 0) ybUrgentLevelNum,
|
||||
IFNULL(SUM((CASE WHEN t.urgent_level = 2 THEN 1 ELSE 0 END)), 0) yzUrgentLevelNum,
|
||||
IFNULL(SUM((CASE WHEN t.urgent_level = 3 THEN 1 ELSE 0 END)), 0) jyUrgentLevelNum,
|
||||
IFNULL(SUM((CASE WHEN t.record_type = 1 THEN 1 ELSE 0 END)), 0) dangerNum,
|
||||
IFNULL(SUM((CASE WHEN t.level = 1 THEN 1 ELSE 0 END)), 0) greatFaultLevelNum,
|
||||
IFNULL(SUM((CASE WHEN t.level = 2 THEN 1 ELSE 0 END)), 0) largerRiskNum,
|
||||
IFNULL(SUM((CASE WHEN t.level = 3 THEN 1 ELSE 0 END)), 0) generalRiskNum,
|
||||
IFNULL(SUM((CASE WHEN t.level = 4 THEN 1 ELSE 0 END)), 0) lowRiskNum,
|
||||
if(FLOOR((DAYOFMONTH(t.create_time) - 1) / 7) > 3, 3,
|
||||
FLOOR((DAYOFMONTH(t.create_time) - 1) / 7)) as whichWeekOfMonth,
|
||||
date_format(t.create_time, '%Y-%m') as yearMonth,
|
||||
year(t.create_time) as year,
|
||||
month(t.create_time) as month
|
||||
from xz_security_quality_inspection_record t
|
||||
WHERE t.project_sn = #{param.projectSn}
|
||||
and t.status != 6
|
||||
<include refid="whereCondition">
|
||||
</include>
|
||||
<if test="param.isStatsByWeek == '1'.toString()">
|
||||
group by whichWeekOfMonth
|
||||
</if>
|
||||
<if test="param.groupby == 'yearmonth'.toString()">
|
||||
group by yearMonth
|
||||
</if>
|
||||
) tp
|
||||
</sql>
|
||||
<select id="selectQualityInspectionRecordById"
|
||||
resultType="com.zhgd.xmgl.modules.xz.security.entity.vo.XzSecurityQualityInspectionRecordVo">
|
||||
@ -193,115 +358,8 @@
|
||||
</select>
|
||||
<select id="selectQualityInspectionRecordPageTotal"
|
||||
resultType="com.zhgd.xmgl.modules.xz.security.entity.vo.XzSecurityQualityInspectionRecordTotalVo">
|
||||
select tp.*,
|
||||
round(IFNULL(TRUNCATE(IFNULL(closeNum, 0) / IFNULL(totalNum, 0), 4), 0) * 100,
|
||||
2) completeRatio,<!--闭合率-->
|
||||
round(IFNULL(TRUNCATE(IFNULL(totalNum - rectificationNum, 0) / IFNULL(totalNum, 0), 4), 0) * 100, 2)
|
||||
rectificationRatio, <!--整改率-->
|
||||
round(IFNULL(TRUNCATE(IFNULL(overdueRectificationNum, 0) / IFNULL(totalNum, 0), 4), 0) * 100, 2)
|
||||
overdueRectificationNumRatio
|
||||
from (
|
||||
SELECT count(1) totalNum,
|
||||
IFNULL(SUM((CASE WHEN t.record_type = 2 THEN 1 ELSE 0 END)), 0) investigateNum,
|
||||
IFNULL(SUM((CASE WHEN t.status = 5 THEN 1 ELSE 0 END)), 0) closeNum,
|
||||
IFNULL(SUM((CASE
|
||||
WHEN t.status = 1 OR t.status = 2 OR t.status = 3 OR t.status = 4 THEN 1
|
||||
ELSE 0 END)), 0) notCloseNum,
|
||||
IFNULL(SUM((CASE
|
||||
WHEN t.status != 5 AND now() > t.change_limit_time THEN 1
|
||||
ELSE 0 END)), 0) overdueNotCloseNum,
|
||||
IFNULL(SUM((CASE
|
||||
WHEN t.status = 2 AND now() > t.change_limit_time THEN 1
|
||||
ELSE 0 END)), 0) overdueRectificationNum,
|
||||
IFNULL(SUM((CASE WHEN t.status = 2 THEN 1 ELSE 0 END)), 0) rectificationNum,
|
||||
IFNULL(SUM((CASE WHEN t.status != 2 THEN 1 ELSE 0 END)), 0) alreadyRectificationNum,
|
||||
IFNULL(SUM((CASE WHEN t.status = 3 THEN 1 ELSE 0 END)), 0) reviewNum,
|
||||
IFNULL(SUM((CASE WHEN t.status = 4 THEN 1 ELSE 0 END)), 0) verificationNum,
|
||||
IFNULL(SUM((CASE WHEN t.urgent_level = 1 THEN 1 ELSE 0 END)), 0) ybUrgentLevelNum,
|
||||
IFNULL(SUM((CASE WHEN t.urgent_level = 2 THEN 1 ELSE 0 END)), 0) yzUrgentLevelNum,
|
||||
IFNULL(SUM((CASE WHEN t.urgent_level = 3 THEN 1 ELSE 0 END)), 0) jyUrgentLevelNum,
|
||||
IFNULL(SUM((CASE WHEN t.record_type = 1 THEN 1 ELSE 0 END)), 0) dangerNum,
|
||||
IFNULL(SUM((CASE WHEN t.level = 1 THEN 1 ELSE 0 END)), 0) greatFaultLevelNum,
|
||||
IFNULL(SUM((CASE WHEN t.level = 2 THEN 1 ELSE 0 END)), 0) largerRiskNum,
|
||||
IFNULL(SUM((CASE WHEN t.level = 3 THEN 1 ELSE 0 END)), 0) generalRiskNum,
|
||||
IFNULL(SUM((CASE WHEN t.level = 4 THEN 1 ELSE 0 END)), 0) lowRiskNum,
|
||||
if(FLOOR((DAYOFMONTH(t.create_time) - 1) / 7) > 3, 3,
|
||||
FLOOR((DAYOFMONTH(t.create_time) - 1) / 7)) whichWeekOfMonth
|
||||
from xz_security_quality_inspection_record t
|
||||
WHERE t.project_sn = #{param.projectSn}
|
||||
and t.status != 6
|
||||
<if test="param.isDangerousEngineering == '1'.toString()">
|
||||
and t.engineering_id is not null
|
||||
</if>
|
||||
<if test="param.regionId != null and param.regionId != ''">
|
||||
and t.region_id = #{param.regionId}
|
||||
</if>
|
||||
<if test="param.recordType != null and param.recordType != ''">
|
||||
and t.record_type = #{param.recordType}
|
||||
</if>
|
||||
<if test="param.level != null and param.level != ''">
|
||||
and t.level = #{param.level}
|
||||
</if>
|
||||
<if test="param.changeId != null and param.changeId != ''">
|
||||
and t.change_id = #{param.changeId}
|
||||
</if>
|
||||
<if test="param.reviewId != null and param.reviewId != ''">
|
||||
and t.review_id = #{param.reviewId}
|
||||
</if>
|
||||
<if test="param.verifyManId != null and param.verifyManId != ''">
|
||||
and t.verify_man_id = #{param.verifyManId}
|
||||
</if>
|
||||
<if test="param.creatorId != null and param.creatorId != ''">
|
||||
and t.creator_id = #{param.creatorId}
|
||||
</if>
|
||||
<if test="param.inspectManId != null and param.inspectManId != ''">
|
||||
and t.inspect_man_id = #{param.inspectManId}
|
||||
</if>
|
||||
<if test="param.operatorId != null and param.operatorId != ''">
|
||||
and ((t.change_id = #{param.operatorId} and t.status = 2) or
|
||||
(t.review_id = #{param.operatorId} and t.status = 3) or
|
||||
(t.verify_man_id = #{param.operatorId} and t.status = 4))
|
||||
</if>
|
||||
<if test="param.status != null and param.status != '' and param.status != '7'.toString()">
|
||||
and t.status = #{param.status}
|
||||
</if>
|
||||
<if test="param.status == '7'.toString()">
|
||||
and t.change_limit_time <![CDATA[<]]> current_date
|
||||
and t.status != 5
|
||||
</if>
|
||||
<if test="param.urgentLevel != null and param.urgentLevel != ''">
|
||||
and t.urgent_level = #{param.urgentLevel}
|
||||
</if>
|
||||
<if test="param.inspectStartTime != null and param.inspectStartTime != ''">
|
||||
and t.inspect_time >= #{param.inspectStartTime}
|
||||
</if>
|
||||
<if test="param.inspectEndTime != null and param.inspectEndTime != ''">
|
||||
and t.inspect_time <= if(LENGTH(#{param.inspectEndTime}) = 10,
|
||||
CONCAT(DATE_FORMAT(#{param.inspectEndTime},
|
||||
'%Y-%m-%d'),
|
||||
' 23:59:59'), #{param.inspectEndTime})
|
||||
</if>
|
||||
<if test="param.regionId != null and param.regionId != ''">
|
||||
and t.region_id = #{param.regionId}
|
||||
</if>
|
||||
<if test="param.search != null and param.search != ''">
|
||||
and (
|
||||
t.region_name like concat('%', #{param.search}, '%')
|
||||
or t.danger_item_content like concat('%', #{param.search}, '%')
|
||||
or t.danger_desc like concat('%', #{param.search}, '%')
|
||||
or t.remark like concat('%', #{param.search}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="param.itemId != null and param.itemId != ''">
|
||||
and t.item_id = #{param.itemId}
|
||||
</if>
|
||||
<if test="param.engineeringId != null and param.engineeringId != ''">
|
||||
and t.engineering_id = #{param.engineeringId}
|
||||
</if>
|
||||
<if test="param.isStatsByWeek == '1'.toString()">
|
||||
group by whichWeekOfMonth
|
||||
</if>
|
||||
) tp
|
||||
<include refid="selectTotal">
|
||||
</include>
|
||||
</select>
|
||||
<select id="selectQualityInspectionRecordCountByDay" resultType="java.util.Map" parameterType="java.util.Map">
|
||||
select DATE_FORMAT(a.inspect_time, "%Y-%m-%d") titleName, count(1) num
|
||||
@ -370,7 +428,7 @@
|
||||
</select>
|
||||
<select id="selectExportExcelQualityInspectionRecordList"
|
||||
resultType="com.zhgd.jeecg.common.mybatis.EntityMap">
|
||||
SELECT a.*,
|
||||
SELECT t.*,
|
||||
b.enterprise_name,
|
||||
c.full_name,
|
||||
d.real_name change_name,
|
||||
@ -381,77 +439,21 @@
|
||||
h.check_name routine_check_name,
|
||||
(SELECT GROUP_CONCAT(real_name)
|
||||
FROM system_user
|
||||
WHERE FIND_IN_SET(system_user.user_id, a.notify_person)) notify_person_name
|
||||
from xz_security_quality_inspection_record a
|
||||
LEFT JOIN enterprise_info b ON a.enterprise_sn = b.enterprise_sn
|
||||
LEFT JOIN xz_security_danger_type_record c ON a.danger_type_id = c.id
|
||||
LEFT JOIN system_user d ON a.change_id = d.user_id
|
||||
LEFT JOIN system_user e ON a.review_id = e.user_id
|
||||
LEFT JOIN system_user f ON a.verify_man_id = f.user_id
|
||||
LEFT JOIN system_user g ON a.inspect_man_id = g.user_id
|
||||
LEFT JOIN routine_inspect h ON a.routine_id = h.id
|
||||
WHERE FIND_IN_SET(system_user.user_id, t.notify_person)) notify_person_name
|
||||
from xz_security_quality_inspection_record t
|
||||
LEFT JOIN enterprise_info b ON t.enterprise_sn = b.enterprise_sn
|
||||
LEFT JOIN xz_security_danger_type_record c ON t.danger_type_id = c.id
|
||||
LEFT JOIN system_user d ON t.change_id = d.user_id
|
||||
LEFT JOIN system_user e ON t.review_id = e.user_id
|
||||
LEFT JOIN system_user f ON t.verify_man_id = f.user_id
|
||||
LEFT JOIN system_user g ON t.inspect_man_id = g.user_id
|
||||
LEFT JOIN routine_inspect h ON t.routine_id = h.id
|
||||
LEFT JOIN worker_info wk ON wk.id = g.worker_id
|
||||
LEFT JOIN enterprise_info en ON en.id = wk.enterprise_id
|
||||
WHERE a.project_sn = #{projectSn}
|
||||
<if test="regionId != null and regionId != ''">
|
||||
and a.region_id = #{regionId}
|
||||
</if>
|
||||
<if test="changeId != null and changeId != ''">
|
||||
and a.change_id = #{changeId}
|
||||
</if>
|
||||
<if test="reviewId != null and reviewId != ''">
|
||||
and a.review_id = #{reviewId}
|
||||
</if>
|
||||
<if test="verifyManId != null and verifyManId != ''">
|
||||
and a.verify_man_id = #{verifyManId}
|
||||
</if>
|
||||
<if test="creatorId != null and creatorId != ''">
|
||||
and a.creator_id = #{creatorId}
|
||||
</if>
|
||||
<if test="inspectManId != null and inspectManId != ''">
|
||||
and a.inspect_man_id = #{inspectManId}
|
||||
</if>
|
||||
<if test="level != null and level != ''">
|
||||
and a.level = #{level}
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
and a.status = #{status}
|
||||
</if>
|
||||
<if test="urgentLevel != null and urgentLevel != ''">
|
||||
and a.urgent_level = #{urgentLevel}
|
||||
</if>
|
||||
<if test="inspectStartTime != null and inspectStartTime != ''">
|
||||
and a.inspect_time >= #{inspectStartTime}
|
||||
</if>
|
||||
<if test="inspectEndTime != null and inspectEndTime != ''">
|
||||
and a.inspect_time <= #{inspectEndTime}
|
||||
</if>
|
||||
<if test="regionId != null and regionId != ''">
|
||||
and a.region_id = #{regionId}
|
||||
</if>
|
||||
<if test="recordStatus == '1'.toString()">
|
||||
and a.record_type = 2
|
||||
</if>
|
||||
<if test="recordStatus == '2'.toString()">
|
||||
and a.status = 5
|
||||
</if>
|
||||
<if test="recordStatus == '3'.toString()">
|
||||
and a.status in (1, 2, 3, 4, 6)
|
||||
</if>
|
||||
<if test="recordStatus == '4'.toString()">
|
||||
and a.status in (1, 2, 3, 4, 6)
|
||||
and a.change_limit_time > DATE_FORMAT(now(), "%Y-%m-%d")
|
||||
</if>
|
||||
<if test="recordStatus == '5'.toString()">
|
||||
and a.status = 2
|
||||
</if>
|
||||
<if test="recordStatus == '6'.toString()">
|
||||
and a.status = 3
|
||||
</if>
|
||||
<if test="recordStatus == '7'.toString()">
|
||||
and a.status = 4
|
||||
</if>
|
||||
order by a.create_time desc
|
||||
WHERE t.project_sn = #{param.projectSn}
|
||||
<include refid="whereCondition">
|
||||
</include>
|
||||
order by t.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="getRectificationAndNoNum" resultType="com.zhgd.jeecg.common.mybatis.EntityMap">
|
||||
@ -528,10 +530,10 @@
|
||||
</select>
|
||||
|
||||
<select id="countQualityInspectionRecordEnterprise" resultType="com.zhgd.xmgl.base.entity.vo.TrendOneVo">
|
||||
select ei.enterprise_name x, ifnull(sum(if(qir.id is not null, 1, 0)), 0) y
|
||||
select ei.enterprise_name x, ifnull(sum(if(t.id is not null, 1, 0)), 0) y
|
||||
from enterprise_info ei
|
||||
LEFT JOIN project_enterprise pe ON pe.enterprise_id = ei.id
|
||||
Left join xz_security_quality_inspection_record qir on ei.enterprise_sn = qir.enterprise_sn
|
||||
Left join xz_security_quality_inspection_record t on ei.enterprise_sn = t.enterprise_sn
|
||||
where 1 = 1
|
||||
and pe.project_sn = #{projectSn}
|
||||
GROUP BY ei.id
|
||||
@ -561,30 +563,14 @@
|
||||
<select id="countQualityInspectionRecordRegion" resultType="com.zhgd.xmgl.base.entity.vo.TrendOneVo">
|
||||
select qr.region_name x, ifnull(sum(if(t.id is not null, 1, 0)), 0) y
|
||||
from quality_region qr
|
||||
left join xz_security_quality_inspection_record t on qr.id = t.region_id
|
||||
join xz_security_quality_inspection_record t on qr.id = t.region_id
|
||||
where 1 = 1
|
||||
and qr.project_sn = #{param.projectSn}
|
||||
and t.status != 6
|
||||
and t.record_type = 1
|
||||
<if test="param.isNotQualified == '1'.toString()">
|
||||
and t.status != 5
|
||||
</if>
|
||||
<if test="param.isOverdueRectification == '1'.toString()">
|
||||
and (t.status = 2 AND now() > t.change_limit_time)
|
||||
</if>
|
||||
<if test="param.inspectStartTime != null and param.param.inspectStartTime != ''">
|
||||
and t.inspect_time >= #{param.inspectStartTime}
|
||||
</if>
|
||||
<if test="param.inspectEndTime != null and param.param.inspectEndTime != ''">
|
||||
and t.inspect_time <= if(LENGTH(#{param.inspectEndTime}) = 10,
|
||||
CONCAT(DATE_FORMAT(#{param.inspectEndTime},
|
||||
'%Y-%m-%d'),
|
||||
' 23:59:59'), #{param.inspectEndTime})
|
||||
</if>
|
||||
<if test="param.enumType != null and param.enumType != ''">
|
||||
and t.level = #{param.enumType}
|
||||
</if>
|
||||
group by qr.id
|
||||
<include refid="whereCondition">
|
||||
</include>
|
||||
group by t.region_id
|
||||
order by y desc
|
||||
</select>
|
||||
|
||||
@ -595,28 +581,22 @@
|
||||
round(IFNULL(TRUNCATE(IFNULL(t.rectifiedNumTimely, 0) / IFNULL(totalNum, 0), 4), 0) * 100, 2)
|
||||
rectifiedNumRatioTimely
|
||||
from (SELECT count(*) totalNum,
|
||||
IFNULL(SUM((CASE WHEN hdir.status != 2 THEN 1 ELSE 0 END)), 0) rectifiedNum,
|
||||
IFNULL(SUM((CASE WHEN hdir.status != 2 and change_limit_time > now() THEN 1 ELSE 0 END)), 0)
|
||||
IFNULL(SUM((CASE WHEN t.status != 2 THEN 1 ELSE 0 END)), 0) rectifiedNum,
|
||||
IFNULL(SUM((CASE WHEN t.status != 2 and change_limit_time > now() THEN 1 ELSE 0 END)), 0)
|
||||
rectifiedNumTimely,
|
||||
IFNULL(SUM((CASE WHEN hdir.status != 2 and change_limit_time < now() THEN 1 ELSE 0 END)), 0)
|
||||
IFNULL(SUM((CASE WHEN t.status != 2 and change_limit_time < now() THEN 1 ELSE 0 END)), 0)
|
||||
overTimeRectifiedNum,
|
||||
IFNULL(SUM((CASE WHEN hdir.status = 2 and change_limit_time < now() THEN 1 ELSE 0 END)), 0)
|
||||
IFNULL(SUM((CASE WHEN t.status = 2 and change_limit_time < now() THEN 1 ELSE 0 END)), 0)
|
||||
overTimeNotRectifiedNum,
|
||||
su.real_name as workerName
|
||||
from xz_security_quality_inspection_record hdir
|
||||
left join system_user su on su.user_id = hdir.change_id
|
||||
from xz_security_quality_inspection_record t
|
||||
left join system_user su on su.user_id = t.change_id
|
||||
WHERE record_type = 1
|
||||
and hdir.status != 6
|
||||
and t.status != 6
|
||||
and project_sn = #{param.projectSn}
|
||||
<if test="param.inspectTime_begin != null and param.inspectTime_begin != ''">
|
||||
and hdir.inspect_time <![CDATA[>=]]> #{param.inspectTime_begin}
|
||||
</if>
|
||||
<if test="param.inspectTime_end != null and param.inspectTime_end != ''">
|
||||
and hdir.inspect_time <![CDATA[<=]]> if(LENGTH(#{param.inspectTime_end}) = 10,
|
||||
CONCAT(DATE_FORMAT(#{param.inspectTime_end}, '%Y-%m-%d'), ' 23:59:59'),
|
||||
#{param.inspectTime_end})
|
||||
</if>
|
||||
group by hdir.change_id
|
||||
<include refid="whereCondition">
|
||||
</include>
|
||||
group by t.change_id
|
||||
order by rectifiedNum desc) t
|
||||
</select>
|
||||
|
||||
@ -666,9 +646,9 @@
|
||||
2) rectifiedNumRatio,
|
||||
round(IFNULL(TRUNCATE(IFNULL(t.rectifiedNumTimely, 0) / IFNULL(totalNum, 0), 4), 0) * 100, 2)
|
||||
rectifiedNumRatioTimely
|
||||
from (SELECT count(*) totalNum,
|
||||
IFNULL(SUM((CASE WHEN t.status != 2 THEN 1 ELSE 0 END)), 0) rectifiedNum,
|
||||
IFNULL(SUM((CASE WHEN t.status != 2 and change_limit_time > now() THEN 1 ELSE 0 END)), 0)
|
||||
from (SELECT count(*) as totalNum,
|
||||
IFNULL(SUM((CASE WHEN t.status != 2 THEN 1 ELSE 0 END)), 0) as rectifiedNum,
|
||||
IFNULL(SUM((CASE WHEN t.status != 2 and change_limit_time > now() THEN 1 ELSE 0 END)), 0) as
|
||||
rectifiedNumTimely,
|
||||
ei.enterprise_name
|
||||
from xz_security_quality_inspection_record t
|
||||
@ -676,23 +656,8 @@
|
||||
WHERE record_type = 1
|
||||
and t.status != 6
|
||||
and project_sn = #{param.projectSn}
|
||||
<if test="param.inspectTime_begin != null and param.inspectTime_begin != ''">
|
||||
and t.inspect_time <![CDATA[>=]]> #{param.inspectTime_begin}
|
||||
</if>
|
||||
<if test="param.inspectTime_end != null and param.inspectTime_end != ''">
|
||||
and t.inspect_time <![CDATA[<=]]> if(LENGTH(#{param.inspectTime_end}) = 10,
|
||||
CONCAT(DATE_FORMAT(#{param.inspectTime_end}, '%Y-%m-%d'), ' 23:59:59'),
|
||||
#{param.inspectTime_end})
|
||||
</if>
|
||||
<if test="param.isNotQualified == '1'.toString()">
|
||||
and t.status != 5
|
||||
</if>
|
||||
<if test="param.enumType != null and param.enumType != ''">
|
||||
and t.level = #{param.enumType}
|
||||
</if>
|
||||
<if test="param.isOverdueRectification == '1'.toString()">
|
||||
and (t.status = 2 AND now() > t.change_limit_time)
|
||||
</if>
|
||||
<include refid="whereCondition">
|
||||
</include>
|
||||
group by t.enterprise_id
|
||||
order by rectifiedNum desc) t
|
||||
</select>
|
||||
@ -703,24 +668,23 @@
|
||||
where project_sn = #{param.projectSn}
|
||||
and t.record_type = 1
|
||||
and t.status != 6
|
||||
<if test="param.isOverdueRectification == '1'.toString()">
|
||||
and (t.status = 2 AND now() > t.change_limit_time)
|
||||
</if>
|
||||
<if test="param.isNotQualified == '1'.toString()">
|
||||
and t.status != 5
|
||||
</if>
|
||||
<if test="param.inspectStartTime != null and param.inspectStartTime != ''">
|
||||
and t.inspect_time >= #{param.inspectStartTime}
|
||||
</if>
|
||||
<if test="param.inspectEndTime != null and param.inspectEndTime != ''">
|
||||
and t.inspect_time <= if(LENGTH(#{param.inspectEndTime}) = 10,
|
||||
CONCAT(DATE_FORMAT(#{param.inspectEndTime},
|
||||
'%Y-%m-%d'),
|
||||
' 23:59:59'), #{param.inspectEndTime})
|
||||
</if>
|
||||
<if test="param.enumType != null and param.enumType != ''">
|
||||
and t.level = #{param.enumType}
|
||||
</if>
|
||||
<include refid="whereCondition">
|
||||
</include>
|
||||
group by name
|
||||
</select>
|
||||
|
||||
<select id="riskChart"
|
||||
resultType="com.zhgd.xmgl.modules.xz.security.entity.vo.XzSecurityQualityInspectionRecordTotalVo">
|
||||
select
|
||||
ifnull(round((t2.dangerNum-t1.dangerNum)/t1.dangerNum*100,2),0) as monthlyBasis,
|
||||
t2.*
|
||||
from (
|
||||
<include refid="selectTotal">
|
||||
</include>
|
||||
)t1 right join (
|
||||
<include refid="selectTotal">
|
||||
</include>
|
||||
)t2 on t1.year = t2.year and t1.month + 1 = t2.month or (t1.year + 1 = t2.year and t1.month = 12 and t2.month =
|
||||
1)
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -93,4 +93,6 @@ public interface IXzSecurityQualityInspectionRecordService extends IService<XzSe
|
||||
|
||||
|
||||
void noticeBigScreen(XzSecurityQualityInspectionRecord tempQualityInspectionRecord, String rectifyTime, String format);
|
||||
|
||||
List<XzSecurityQualityInspectionRecordTotalVo> riskChart(Map<String, Object> map);
|
||||
}
|
||||
|
||||
@ -66,6 +66,7 @@ import java.math.RoundingMode;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -280,31 +281,43 @@ public class XzSecurityXzSecurityQualityInspectionRecordServiceImpl extends Serv
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveQualityInspectionRecord(XzSecurityQualityInspectionRecord qualityInspectionRecord) {
|
||||
public void saveQualityInspectionRecord(XzSecurityQualityInspectionRecord record) {
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
qualityInspectionRecord.setCreateTime(df.format(new Date()));
|
||||
if (Objects.equals(qualityInspectionRecord.getRecordType(), 2)) {
|
||||
qualityInspectionRecord.setStatus(5);
|
||||
record.setCreateTime(df.format(new Date()));
|
||||
if (Objects.equals(record.getRecordType(), 2)) {
|
||||
record.setStatus(5);
|
||||
}
|
||||
|
||||
String enterpriseSn = qualityInspectionRecord.getEnterpriseSn();
|
||||
String enterpriseSn = record.getEnterpriseSn();
|
||||
if (StrUtil.isNotBlank(enterpriseSn)) {
|
||||
EnterpriseInfo enterpriseInfo = enterpriseInfoMapper.selectOne(new LambdaQueryWrapper<EnterpriseInfo>()
|
||||
.eq(EnterpriseInfo::getEnterpriseSn, enterpriseSn));
|
||||
qualityInspectionRecord.setEnterpriseId(enterpriseInfo.getId());
|
||||
record.setEnterpriseId(enterpriseInfo.getId());
|
||||
}
|
||||
EnterpriseInfo enterpriseInfo = enterpriseInfoMapper.selectById(qualityInspectionRecord.getEnterpriseId());
|
||||
xzSecurityQualityInspectionRecordMapper.insert(qualityInspectionRecord);
|
||||
if (qualityInspectionRecord.getRecordType() == 1 && qualityInspectionRecord.getStatus() == 2) {
|
||||
noticeService.addUserNoticeAndApp(qualityInspectionRecord.getChangeId(), "您有一条安全检查待整改,问题:" + qualityInspectionRecord.getDangerItemContent(), "安全管理待整改", "10",
|
||||
PushPayloads.buildPushPayload(10, qualityInspectionRecord));
|
||||
noticeBigScreen(qualityInspectionRecord, qualityInspectionRecord.getInspectTime(), StrUtil.format("{}检查到一条{}的{}安全隐患问题,请注意监督整改!",
|
||||
qualityInspectionRecord.getRegionName(), enterpriseInfo.getEnterpriseName(), StrUtil.subAfter(qualityInspectionRecord.getDangerItemContent(), "/", true)));
|
||||
} else if (qualityInspectionRecord.getRecordType() == 2) {
|
||||
noticeBigScreen(qualityInspectionRecord, qualityInspectionRecord.getInspectTime(), StrUtil.format("{}已排查了{}的安全隐患问题,今日排查暂无次安全隐患!",
|
||||
qualityInspectionRecord.getRegionName(), StrUtil.subAfter(qualityInspectionRecord.getDangerItemContent(), "/", true)));
|
||||
EnterpriseInfo enterpriseInfo = enterpriseInfoMapper.selectById(record.getEnterpriseId());
|
||||
xzSecurityQualityInspectionRecordMapper.insert(record);
|
||||
if (record.getRecordType() == 1 && record.getStatus() == 2) {
|
||||
noticeService.addUserNoticeAndApp(record.getChangeId(), "您有一条安全检查待整改,问题:" + record.getDangerItemContent(), "安全管理待整改", "10",
|
||||
PushPayloads.buildPushPayload(10, record));
|
||||
if (record.getEngineeringId() == null) {
|
||||
noticeBigScreen(record, record.getInspectTime(), StrUtil.format("{}检查到一条{}的{}安全隐患问题,请注意监督整改!",
|
||||
record.getRegionName(), enterpriseInfo.getEnterpriseName(), StrUtil.subAfter(record.getDangerItemContent(), "/", true)));
|
||||
} else {
|
||||
DangerousEngineeringRecord d = dangerousEngineeringRecordMapper.selectById(record.getEngineeringId());
|
||||
noticeBigScreen(record, record.getInspectTime(), StrUtil.format("{}的{}的{}发现一条{},请注意监督整改!",
|
||||
enterpriseInfo.getEnterpriseName(), d.getEngineeringName(), record.getRegionName(), record.getDangerItemContent()));
|
||||
}
|
||||
} else if (record.getRecordType() == 2) {
|
||||
if (record.getEngineeringId() == null) {
|
||||
noticeBigScreen(record, record.getInspectTime(), StrUtil.format("{}已排查了{}的安全隐患问题,今日排查暂无次安全隐患!",
|
||||
record.getRegionName(), StrUtil.subAfter(record.getDangerItemContent(), "/", true)));
|
||||
} else {
|
||||
DangerousEngineeringRecord d = dangerousEngineeringRecordMapper.selectById(record.getEngineeringId());
|
||||
noticeBigScreen(record, record.getInspectTime(), StrUtil.format("{}的{}的{}今日排查暂无隐患",
|
||||
enterpriseInfo.getEnterpriseName(), d.getEngineeringName(), record.getRegionName()));
|
||||
}
|
||||
}
|
||||
deductScoreIf(qualityInspectionRecord);
|
||||
deductScoreIf(record);
|
||||
}
|
||||
|
||||
private void deductScoreIf(XzSecurityQualityInspectionRecord hiddenDangerInspectRecord) {
|
||||
@ -731,6 +744,52 @@ public class XzSecurityXzSecurityQualityInspectionRecordServiceImpl extends Serv
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<XzSecurityQualityInspectionRecordTotalVo> riskChart(Map<String, Object> map) {
|
||||
map.put("groupby", "yearmonth");
|
||||
List<XzSecurityQualityInspectionRecordTotalVo> datas = baseMapper.riskChart(map);
|
||||
List<XzSecurityQualityInspectionRecordTotalVo> rsList = new ArrayList<>();
|
||||
Map<String, XzSecurityQualityInspectionRecordTotalVo> ymMap = datas.stream().collect(Collectors.toMap(XzSecurityQualityInspectionRecordTotalVo::getYearMonth, Function.identity(), (k1, k2) -> k1));
|
||||
List<String> dateTimeStrList = DateUtils.getDateTimeStrList(93, "yyyy-MM");
|
||||
for (String month : dateTimeStrList) {
|
||||
XzSecurityQualityInspectionRecordTotalVo vo = ymMap.get(month);
|
||||
if (vo == null) {
|
||||
vo = new XzSecurityQualityInspectionRecordTotalVo();
|
||||
vo.setYearMonth(month);
|
||||
vo.setVerificationNum(0);
|
||||
vo.setRectificationRatio(0.0D);
|
||||
vo.setCloseNum(0);
|
||||
vo.setReviewNum(0);
|
||||
vo.setInvestigateNum(0);
|
||||
vo.setOverdueNotCloseNum(0);
|
||||
vo.setRectificationNum(0);
|
||||
vo.setYbUrgentLevelNum(0);
|
||||
vo.setYzUrgentLevelNum(0);
|
||||
vo.setTotalNum("0");
|
||||
vo.setCompleteRatio(0.0D);
|
||||
vo.setAlreadyRectificationNum(0);
|
||||
vo.setJyUrgentLevelNum(0);
|
||||
vo.setOverdueRectificationNum(0);
|
||||
vo.setOverdueRectificationNumRatio(0.0D);
|
||||
vo.setNotCloseNum(0);
|
||||
vo.setTotalNumDifferYesterday(0);
|
||||
vo.setOverdueNotCloseNumDifferYesterday(0);
|
||||
vo.setCloseNumDifferYesterday(0);
|
||||
vo.setNotCloseNumDifferYesterday(0);
|
||||
vo.setGreatFaultLevelNum(0);
|
||||
vo.setDangerNum(0);
|
||||
vo.setLowRiskNum(0);
|
||||
vo.setGeneralRiskNum(0);
|
||||
vo.setLargerRiskNum(0);
|
||||
vo.setWhichWeekOfMonth(0);
|
||||
vo.setMonthlyBasis(0.0D);
|
||||
}
|
||||
vo.setLastMonth(DateUtil.month(DateUtil.parse(month, "yyyy-MM")) + "月");
|
||||
rsList.add(vo);
|
||||
}
|
||||
return rsList;
|
||||
}
|
||||
|
||||
private void recoverScore(XzSecurityQualityInspectionRecord hiddenDangerInspectRecord) {
|
||||
if (hiddenDangerInspectRecord.getRecordType() == null || hiddenDangerInspectRecord.getRecordType() == 2) {
|
||||
return;
|
||||
|
||||
@ -0,0 +1,46 @@
|
||||
package com.zhgd.xmgl.task;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.zhgd.xmgl.modules.dangerous.entity.DangerousEngineeringRecord;
|
||||
import com.zhgd.xmgl.modules.dangerous.service.impl.DangerousEngineeringRecordServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.javacrumbs.shedlock.core.SchedulerLock;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/xmgl/task")
|
||||
public class DangerousEngineeringRecordTask {
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
DangerousEngineeringRecordServiceImpl dangerousEngineeringRecordService;
|
||||
|
||||
/**
|
||||
* 计划开始时间和结束时间内,定时每天早上6点时,发送一条通知
|
||||
*/
|
||||
@Scheduled(cron = "0 0 6 * * ?")
|
||||
@SchedulerLock(name = "sendDangerousEngineeringRecordBigScreen", lockAtMostFor = 1000 * 60 * 2, lockAtLeastFor = 1000 * 60 * 1)
|
||||
@RequestMapping("sendDangerousEngineeringRecordBigScreen")
|
||||
public void sendDangerousEngineeringRecordBigScreen() {
|
||||
List<DangerousEngineeringRecord> list = dangerousEngineeringRecordService.list(new LambdaQueryWrapper<DangerousEngineeringRecord>()
|
||||
.ge(DangerousEngineeringRecord::getPlanEndTime, DateUtil.format(new Date(), "yyyy-MM-dd"))
|
||||
.le(DangerousEngineeringRecord::getPlanStartTime, DateUtil.format(new Date(), "yyyy-MM-dd"))
|
||||
);
|
||||
for (DangerousEngineeringRecord dangerousEngineeringRecord : list) {
|
||||
dangerousEngineeringRecordService.noticeBigScreen(dangerousEngineeringRecord.getProjectSn(), dangerousEngineeringRecord.getPlanStartTime() + " - " + dangerousEngineeringRecord.getPlanEndTime(), Objects.equals(dangerousEngineeringRecord.getDangerType(), 2),
|
||||
StrUtil.format("{}的{}正处于重大风险施工作业阶段,请注意进行相关风险类型安全管控! ", dangerousEngineeringRecord.getResponsibilityCompany(), dangerousEngineeringRecord.getEngineeringName()));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user