质量接口copy

This commit is contained in:
guoshengxiong 2024-05-13 16:09:39 +08:00
parent 6f576c48c8
commit 994bfa12ef
10 changed files with 745 additions and 313 deletions

View File

@ -16,7 +16,6 @@ import com.zhgd.xmgl.modules.electrical.mapper.ElectricalDevMapper;
import com.zhgd.xmgl.modules.environment.mapper.EnvironmentAlarmMapper;
import com.zhgd.xmgl.modules.environment.mapper.EnvironmentDevMapper;
import com.zhgd.xmgl.modules.project.mapper.ProjectMapper;
import com.zhgd.xmgl.modules.quality.entity.vo.QualityInspectionRecordTotalVo;
import com.zhgd.xmgl.modules.quality.mapper.QualityInspectionRecordMapper;
import com.zhgd.xmgl.modules.security.mapper.SecurityManageMapper;
import com.zhgd.xmgl.modules.standard.mapper.StandardDevMapper;
@ -24,6 +23,7 @@ import com.zhgd.xmgl.modules.video.mapper.VideoAlarmMapper;
import com.zhgd.xmgl.modules.water.mapper.WaterMeterMapper;
import com.zhgd.xmgl.modules.worker.mapper.WorkerAttendanceMapper;
import com.zhgd.xmgl.modules.worker.mapper.WorkerInfoMapper;
import com.zhgd.xmgl.modules.xz.security.entity.vo.XzSecurityQualityInspectionRecordTotalVo;
import com.zhgd.xmgl.util.DateUtils;
import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -218,7 +218,7 @@ public class CompanyBigScreenStatisticsServiceImpl implements ICompanyBigScreenS
data.put("securityCount", securityCount);
//查询质量检查
QualityInspectionRecordTotalVo qualityCount = qualityInspectionRecordMapper.selectQualityInspectionRecordPageTotal(map);
XzSecurityQualityInspectionRecordTotalVo qualityCount = qualityInspectionRecordMapper.selectQualityInspectionRecordPageTotal(map);
data.put("qualityCount", qualityCount);
Integer totalPerson = workerInfoMapper.selectWorkerTotalCount(map);
Map<String, Object> attendancePerson = workerInfoMapper.selectAttendanceWorkerPersonTypeTotal(map);

View File

@ -1,14 +1,20 @@
package com.zhgd.xmgl.modules.quality.controller;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.annotation.OperLog;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.mybatis.EntityMap;
import com.zhgd.xmgl.base.entity.vo.SectorVo;
import com.zhgd.xmgl.base.entity.vo.TrendOneVo;
import com.zhgd.xmgl.modules.dangerous.service.IDangerousEngineeringRecordService;
import com.zhgd.xmgl.modules.quality.entity.QualityInspectionRecord;
import com.zhgd.xmgl.modules.quality.entity.dto.DepartmentRectifiedRankDto;
import com.zhgd.xmgl.modules.quality.entity.vo.*;
import com.zhgd.xmgl.modules.quality.service.IQualityInspectionRecordService;
import com.zhgd.xmgl.modules.video.service.IAiAnalyseHardWareAlarmRecordService;
import com.zhgd.xmgl.modules.xz.security.entity.dto.XzSecurityDepartmentRectifiedRankDto;
import com.zhgd.xmgl.modules.xz.security.entity.vo.*;
import com.zhgd.xmgl.util.MessageUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@ -21,6 +27,8 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -41,6 +49,9 @@ public class QualityInspectionRecordController {
@Autowired
private IQualityInspectionRecordService qualityInspectionRecordService;
@Autowired
private IAiAnalyseHardWareAlarmRecordService aiAnalyseHardWareAlarmRecordService;
/**
* 分页列表查询
*
@ -67,8 +78,14 @@ public class QualityInspectionRecordController {
@ApiImplicitParam(name = "search", value = "搜索(检查部位、问题分类、问题描述、补充说明、整改要求)", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "body", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "body", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "isDangerousEngineering", value = "是否危大1是", paramType = "body", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "enumType", value = "问题等级1重大隐患2较大隐患3一般隐患4低隐患", paramType = "body", required = false, dataType = "Integer"),
@ApiImplicitParam(name = "isNotQualified", value = "是否未销项", paramType = "body", required = false, dataType = "Integer"),
@ApiImplicitParam(name = "isOverdueRectification", value = "是否超期未整改1是", paramType = "body", required = false, dataType = "Integer"),
@ApiImplicitParam(name = "enterpriseId", value = "合作单位id", paramType = "body", required = false, dataType = "String"),
})
@PostMapping(value = "/list")
@PostMapping(value = {"/list", "/page"})
public Result<RecordVo> queryPageList(@RequestBody Map<String, Object> map) {
return Result.success(qualityInspectionRecordService.selectQualityInspectionRecordPage(map));
}
@ -104,7 +121,7 @@ public class QualityInspectionRecordController {
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String")
})
@GetMapping(value = "/getQualityAcceptanceAndRectificationNum")
public Result<AllAndTodayDataVO> getQualityAcceptanceAndRectificationNum(String projectSn) {
public Result<XzSecurityXzSecurityAllAndTodayDataVO> getQualityAcceptanceAndRectificationNum(String projectSn) {
return Result.success(qualityInspectionRecordService.getQualityAcceptanceAndRectificationNum(projectSn));
}
@ -118,7 +135,7 @@ public class QualityInspectionRecordController {
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String")
})
@GetMapping(value = "/getQualityAcceptanceAndRectificationNumThisWeek")
public Result<AllAndThisWeekDataVO> getQualityAcceptanceAndRectificationNumThisWeek(String projectSn) {
public Result<XzSecurityXzSecurityAllAndThisWeekDataVO> getQualityAcceptanceAndRectificationNumThisWeek(String projectSn) {
return Result.success(qualityInspectionRecordService.getQualityAcceptanceAndRectificationNumThisWeek(projectSn));
}
@ -149,7 +166,7 @@ public class QualityInspectionRecordController {
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String")
})
@GetMapping(value = "/getAllAndWeekData")
public Result<AllAndWeekDataVO> getAllAndWeekData(String projectSn) {
public Result<XzSecurityAllAndWeekDataVO> getAllAndWeekData(String projectSn) {
return Result.success(qualityInspectionRecordService.getAllAndWeekData(projectSn));
}
@ -245,7 +262,7 @@ public class QualityInspectionRecordController {
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"),
})
@PostMapping(value = "/selectQualityStatistics")
public Result<SelectQualityStatisticsVo> selectQualityStatistics(@RequestBody Map<String, Object> map) {
public Result<XzSecuritySelectQualityStatisticsVo> selectQualityStatistics(@RequestBody Map<String, Object> map) {
return Result.success(qualityInspectionRecordService.selectQualityStatistics(map));
}
@ -271,7 +288,7 @@ public class QualityInspectionRecordController {
@ApiOperation(value = "PC端按部门进行整改排名已整改数量", notes = "PC端按部门进行整改排名已整改数量", httpMethod = "GET")
@GetMapping(value = "/department/rectified/rank")
public Result<List<DepartmentRectifiedRankVo>> getDepartmentRectifiedRank(@Validated DepartmentRectifiedRankDto rectifiedRank) {
public Result<List<XzSecurityDepartmentRectifiedRankVo>> getDepartmentRectifiedRank(@Validated XzSecurityDepartmentRectifiedRankDto rectifiedRank) {
return qualityInspectionRecordService.getDepartmentRectifiedRank(rectifiedRank);
}
@ -299,6 +316,13 @@ public class QualityInspectionRecordController {
@ApiOperation(value = "责任区城分析", notes = "责任区城分析", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "enumType", value = "问题等级1重大隐患2较大隐患3一般隐患4低隐患", paramType = "body", required = false, dataType = "Integer"),
@ApiImplicitParam(name = "isNotQualified", value = "是否未销项", paramType = "body", required = false, dataType = "Integer"),
@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) {
@ -306,4 +330,98 @@ public class QualityInspectionRecordController {
}
@ApiOperation(value = "整改人统计", notes = "整改人统计", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "inspectTime_begin", value = "检查开始时间", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "inspectTime_end", value = "检查结束时间", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "body", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "body", required = true, dataType = "Integer"),
})
@PostMapping(value = "/statsByChangeId")
public Result<Page<StatsByChangeIdVo>> statsByChangeId(@ApiIgnore @RequestBody Map<String, Object> paramMap) {
return Result.success(qualityInspectionRecordService.statsByChangeId(paramMap));
}
@ApiOperation(value = "安全问题统计数量列表", notes = "安全问题统计数量列表", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "inspectStartTime", value = "检查开始时间", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "inspectEndTime", value = "检查结束时间", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "isStatsByWeek", value = "按周统计统计一个月1-7号算一周类推1是", paramType = "body", required = false, dataType = "Integer"),
})
@PostMapping(value = "/selectQualityStatisticsNumList")
public Result<List<XzSecurityQualityInspectionRecordTotalVo>> selectQualityStatisticsNumList(@RequestBody Map<String, Object> map) {
return Result.success(qualityInspectionRecordService.selectQualityStatisticsNumList(map));
}
@ApiOperation(value = "统计隐患等级", notes = "统计隐患等级", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "isNotQualified", value = "是否未销项1是", paramType = "body", required = false, dataType = "Integer"),
@ApiImplicitParam(name = "isOverdueRectification", value = "是否超期未整改1是", paramType = "body", required = false, dataType = "Integer"),
@ApiImplicitParam(name = "inspectStartTime", value = "检查开始时间", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "inspectEndTime", value = "检查结束时间", paramType = "body", required = false, dataType = "String"),
})
@PostMapping(value = "/countDangerLevel")
public Result<SectorVo> countDangerLevel(@ApiIgnore @RequestBody Map<String, Object> paramMap) {
return Result.success(qualityInspectionRecordService.countDangerLevel(paramMap));
}
@ApiOperation(value = "检查人统计", notes = "检查人统计", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "inspectTime_begin", value = "检查开始时间", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "inspectTime_end", value = "检查结束时间", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "body", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "body", required = true, dataType = "Integer"),
})
@PostMapping(value = "/statsByInspectMan")
public Result<Page<StatsByInspectManVo>> statsByInspectMan(@ApiIgnore @RequestBody Map<String, Object> paramMap) {
return Result.success(qualityInspectionRecordService.statsByInspectMan(paramMap));
}
@ApiOperation(value = "按分包单位统计", notes = "按分包单位统计", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "inspectTime_begin", value = "检查开始时间", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "inspectTime_end", value = "检查结束时间", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "notQualified", value = "未销项", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "body", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "body", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "isNotQualified", value = "是否未销项", paramType = "body", required = false, dataType = "Integer"),
@ApiImplicitParam(name = "isOverdueRectification", value = "是否超期未整改1是", paramType = "body", required = false, dataType = "Integer"),
@ApiImplicitParam(name = "enumType", value = "问题等级1重大隐患2较大隐患3一般隐患4低隐患", paramType = "body", required = false, dataType = "Integer"),
})
@PostMapping(value = "/statsByEnterprise")
public Result<Page<StatsByEnterpriseVo>> statsByEnterprise(@ApiIgnore @RequestBody Map<String, Object> paramMap) {
return Result.success(qualityInspectionRecordService.statsByEnterprise(paramMap));
}
@ApiOperation(value = "隐患类型分析", notes = "隐患类型分析", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "enumType", value = "问题等级1重大隐患2较大隐患3一般隐患4低隐患", paramType = "body", required = false, dataType = "Integer"),
@ApiImplicitParam(name = "isNotQualified", value = "是否未销项", paramType = "body", required = false, dataType = "Integer"),
@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"),
})
@PostMapping(value = "/statsDangerType")
public Result<SectorVo> statsDangerType(@ApiIgnore @RequestBody Map<String, Object> paramMap) {
return Result.success(qualityInspectionRecordService.statsDangerType(paramMap));
}
@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));
}
}

View File

@ -1,40 +0,0 @@
package com.zhgd.xmgl.modules.quality.entity.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class QualityInspectionRecordTotalVo {
private Integer verificationNum;
private Double rectificationRatio;
@ApiModelProperty("合格(已闭合)")
private Integer closeNum;
private Integer reviewNum;
private Integer investigateNum;
@ApiModelProperty("超期未关闭")
private Integer overdueNotCloseNum;
@ApiModelProperty("未整改数")
private Integer rectificationNum;
private Integer ybUrgentLevelNum;
private Integer yzUrgentLevelNum;
@ApiModelProperty("总数")
private String totalNum;
private Double completeRatio;
@ApiModelProperty("已整改数")
private Integer alreadyRectificationNum;
private Integer jyUrgentLevelNum;
private Integer overdueRectificationNum;
@ApiModelProperty("未闭合")
private Integer notCloseNum;
@ApiModelProperty("今日较昨日总数")
private Integer totalNumDifferYesterday;
@ApiModelProperty("今日较昨日超期未关闭")
private Integer overdueNotCloseNumDifferYesterday;
@ApiModelProperty("今日较昨日已闭合")
private Integer closeNumDifferYesterday;
@ApiModelProperty("今日较昨日未闭合")
private Integer notCloseNumDifferYesterday;
}

View File

@ -25,5 +25,7 @@ public class QualityInspectionRecordVo extends QualityInspectionRecord {
private String problemDescription;
private String dangerName;
private String dangerItemName;
@ApiModelProperty(value = "危大工程名称")
private java.lang.String engineeringName;
}

View File

@ -2,10 +2,11 @@ package com.zhgd.xmgl.modules.quality.entity.vo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.jeecg.common.mybatis.EntityMap;
import com.zhgd.xmgl.modules.xz.security.entity.vo.XzSecurityQualityInspectionRecordTotalVo;
import lombok.Data;
@Data
public class RecordVo {
private Page<QualityInspectionRecordVo> page;
private QualityInspectionRecordTotalVo total;
private XzSecurityQualityInspectionRecordTotalVo total;
}

View File

@ -1,14 +0,0 @@
package com.zhgd.xmgl.modules.quality.entity.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Data
public class SelectQualityStatisticsVo {
@ApiModelProperty("统计")
private QualityInspectionRecordTotalVo total;
private List<Map<String, Object>> monthList;
}

View File

@ -9,10 +9,13 @@ import com.zhgd.xmgl.base.entity.vo.TrendOneVo;
import com.zhgd.xmgl.modules.quality.entity.QualityInspectionRecord;
import com.zhgd.xmgl.modules.quality.entity.dto.DepartmentRectifiedRankDto;
import com.zhgd.xmgl.modules.quality.entity.vo.*;
import com.zhgd.xmgl.modules.xz.security.entity.dto.XzSecurityDepartmentRectifiedRankDto;
import com.zhgd.xmgl.modules.xz.security.entity.vo.*;
import lombok.Data;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -31,7 +34,11 @@ public interface QualityInspectionRecordMapper extends BaseMapper<QualityInspect
List<QualityInspectionRecordVo> selectQualityInspectionRecordPage(Page<QualityInspectionRecordVo> page, @Param("param") Map<String, Object> map);
QualityInspectionRecordTotalVo selectQualityInspectionRecordPageTotal(Map<String, Object> map);
XzSecurityQualityInspectionRecordTotalVo selectQualityInspectionRecordPageTotal(@Param("param") Map<String, Object> map);
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);
@ -49,17 +56,29 @@ public interface QualityInspectionRecordMapper extends BaseMapper<QualityInspect
EntityMap getRectificationAndNoNum(@Param("projectSn") String projectSn);
AllAndTodayDataVO getQualityAcceptanceAndRectificationNum(@Param("projectSn") String projectSn);
XzSecurityXzSecurityAllAndTodayDataVO getQualityAcceptanceAndRectificationNum(@Param("projectSn") String projectSn);
AllAndWeekDataVO getAllAndWeekData(String projectSn);
XzSecurityAllAndWeekDataVO getAllAndWeekData(String projectSn);
AllAndThisWeekDataVO getQualityAcceptanceAndRectificationNumThisWeek(String projectSn);
XzSecurityXzSecurityAllAndThisWeekDataVO getQualityAcceptanceAndRectificationNumThisWeek(String projectSn);
List<DepartmentRectifiedRankVo> getDepartmentRectifiedRank(DepartmentRectifiedRankDto rectifiedRank);
List<XzSecurityDepartmentRectifiedRankVo> getDepartmentRectifiedRank(XzSecurityDepartmentRectifiedRankDto rectifiedRank);
List<TrendOneVo> countQualityInspectionRecordEnterprise(HashMap<String, Object> paramMap);
List<SectorOneVo> countQualityInspectionRecordUrgentLevel(HashMap<String, Object> paramMap);
List<TrendOneVo> countQualityInspectionRecordRegion(HashMap<String, Object> paramMap);
List<TrendOneVo> countQualityInspectionRecordRegion(@Param("param") HashMap<String, Object> paramMap);
Page<StatsByChangeIdVo> statsByChangeId(@Param("param") Map<String, Object> paramMap, Page page);
ArrayList<SectorOneVo> countDangerLevel(@Param("param") Map<String, Object> paramMap);
Page<StatsByInspectManVo> statsByInspectManVo(@Param("param") Map<String, Object> paramMap, Page page);
Page<StatsByEnterpriseVo> statsByEnterprise(@Param("param") Map<String, Object> paramMap, Page page);
List<SectorOneVo> statsDangerType(@Param("param") Map<String, Object> paramMap);
}

View File

@ -1,6 +1,186 @@
<?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.quality.mapper.QualityInspectionRecordMapper">
<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>
<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 &lt;= 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.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 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.quality.entity.vo.QualityInspectionRecordVo">
SELECT a.*,
@ -50,8 +230,12 @@
ifnull((CASE
WHEN a.status = 5 THEN (select rectify_time
from quality_rectify_record
where quality_id = a.id and type = 3 and status = 2 ORDER BY create_time desc LIMIT 1) > a.change_limit_time
ELSE a.change_limit_time <![CDATA[<]]> now() END),0) overTime
where quality_id = a.id
and type = 3
and status = 2
ORDER BY create_time desc
LIMIT 1) > a.change_limit_time
ELSE a.change_limit_time <![CDATA[<]]> now() END), 0) overTime,
from quality_inspection_record a
LEFT JOIN enterprise_info b ON a.enterprise_sn = b.enterprise_sn
LEFT JOIN danger_type_record c ON a.danger_type_id = c.id
@ -65,6 +249,18 @@
LEFT join subdivision_project subsection on subsection.id = a.subsection_id
LEFT join subdivision_project subentry on subentry.id = a.subentry_id
WHERE a.project_sn = #{param.projectSn}
<if test="param.enterpriseId != null and param.enterpriseId != ''">
and a.enterprise_id = #{param.enterpriseId}
</if>
<if test="param.isOverdueRectification == '1'.toString()">
and (a.status = 2 AND now() > a.change_limit_time)
</if>
<if test="param.isNotQualified == '1'.toString()">
and a.status != 5
</if>
<if test="param.enumType != null and param.enumType != ''">
and a.level = #{param.enumType}
</if>
<if test="param.regionId != null and param.regionId != '' and param.regionId.size > 0">
and a.region_id in
<foreach item="item" index="index" collection="param.regionId"
@ -109,7 +305,10 @@
and a.inspect_time >= #{param.inspectStartTime}
</if>
<if test="param.inspectEndTime != null and param.inspectEndTime != ''">
and a.inspect_time &lt;= #{param.inspectEndTime}
and a.inspect_time &lt;= if(LENGTH(#{param.inspectEndTime}) = 10,
CONCAT(DATE_FORMAT(#{param.inspectEndTime},
'%Y-%m-%d'),
' 23:59:59'), #{param.inspectEndTime})
</if>
<if test="param.recordStatus == '1'.toString()">
and a.record_type = 2
@ -150,101 +349,16 @@
order by a.inspect_time desc, a.id desc
</select>
<select id="selectQualityInspectionRecordPageTotal"
resultType="com.zhgd.xmgl.modules.quality.entity.vo.QualityInspectionRecordTotalVo">
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 <!--整改率-->
from (
SELECT count(1) totalNum,
IFNULL(SUM((CASE WHEN a.record_type = 2 THEN 1 ELSE 0 END)), 0) investigateNum,
IFNULL(SUM((CASE WHEN a.status = 5 THEN 1 ELSE 0 END)), 0) closeNum,
IFNULL(SUM((CASE
WHEN a.status = 1 OR a.status = 2 OR a.status = 3 OR a.status = 4 OR a.status = 6 THEN 1
ELSE 0 END)), 0) notCloseNum,
IFNULL(SUM((CASE
WHEN a.status != 5 AND now() > a.change_limit_time THEN 1
ELSE 0 END)), 0) overdueNotCloseNum,
IFNULL(SUM((CASE
WHEN a.status = 2 AND now() > a.change_limit_time THEN 1
ELSE 0 END)), 0) overdueRectificationNum,
IFNULL(SUM((CASE WHEN a.status = 2 THEN 1 ELSE 0 END)), 0) rectificationNum,
IFNULL(SUM((CASE WHEN a.status != 2 THEN 1 ELSE 0 END)), 0) alreadyRectificationNum,
IFNULL(SUM((CASE WHEN a.status = 3 THEN 1 ELSE 0 END)), 0) reviewNum,
IFNULL(SUM((CASE WHEN a.status = 4 THEN 1 ELSE 0 END)), 0) verificationNum,
IFNULL(SUM((CASE WHEN a.urgent_level = 1 THEN 1 ELSE 0 END)), 0) ybUrgentLevelNum,
IFNULL(SUM((CASE WHEN a.urgent_level = 2 THEN 1 ELSE 0 END)), 0) yzUrgentLevelNum,
IFNULL(SUM((CASE WHEN a.urgent_level = 3 THEN 1 ELSE 0 END)), 0) jyUrgentLevelNum
from quality_inspection_record a
WHERE a.project_sn = #{projectSn}
<if test="regionId != null and regionId != ''">
and a.region_id = #{regionId}
</if>
<if test="recordType != null and recordType != ''">
and a.record_type = #{recordType}
</if>
<if test="level != null and level != ''">
and a.level = #{level}
</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="operatorId != null and operatorId != ''">
and ((a.change_id = #{operatorId} and a.status = 2) or
(a.review_id = #{operatorId} and a.status = 3) or
(a.verify_man_id = #{operatorId} and a.status = 4))
</if>
<if test="status != null and status != '' and status != '7'.toString()">
and a.status = #{status}
</if>
<if test="status == '7'.toString()">
and a.change_limit_time <![CDATA[<]]> current_date
and a.status != 5
</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 &lt;= #{inspectEndTime}
</if>
<if test="regionId != null and regionId != ''">
and a.region_id = #{regionId}
</if>
<if test="search != null and search != ''">
and (
a.region_name like concat('%', #{search}, '%')
or a.danger_item_content like concat('%', #{search}, '%')
or a.danger_desc like concat('%', #{search}, '%')
or a.remark like concat('%', #{search}, '%')
)
</if>
<if test="itemId != null and itemId != ''">
and a.item_id = #{itemId}
</if>
) tp
resultType="com.zhgd.xmgl.modules.xz.security.entity.vo.XzSecurityQualityInspectionRecordTotalVo">
<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
from quality_inspection_record a
WHERE a.project_sn = #{projectSn}
and a.record_type = 1
and a.create_time >= CONCAT(DATE_FORMAT(DATE_ADD(NOW(), INTERVAL -30 DAY), '%Y-%m-%d'), ' 00:00:00')
and a.record_type = 1
and a.create_time >= CONCAT(DATE_FORMAT(DATE_ADD(NOW(), INTERVAL -30 DAY), '%Y-%m-%d'), ' 00:00:00')
group by titleName
</select>
<select id="selectDangerTypeQualityCount" resultType="java.util.Map" parameterType="java.util.Map">
@ -256,10 +370,10 @@
, c.danger_name dangerName
</if>
from quality_inspection_record a
LEFT JOIN danger_type_record b ON a.danger_type_id = b.id
LEFT JOIN danger_type_record c ON a.danger_item_id = c.id
LEFT JOIN danger_type_record b ON a.danger_type_id = b.id
LEFT JOIN danger_type_record c ON a.danger_item_id = c.id
WHERE a.project_sn = #{projectSn}
and a.record_type = 1
and a.record_type = 1
<if test="selectType == '2'.toString()">
and a.create_time >= CONCAT(DATE_FORMAT(DATE_ADD(NOW(), INTERVAL -30 DAY), '%Y-%m-%d'), ' 00:00:00')
</if>
@ -272,26 +386,26 @@
and c.id is not Null
group by a.danger_item_id
order by num DESC
LIMIT 10
LIMIT 10
</if>
</select>
<select id="selectInspectTaskCount" resultType="java.util.Map">
SELECT IFNULL(SUM((CASE WHEN status = 1 or status = 5 THEN 1 ELSE 0 END)), 0) closeNum,
IFNULL(SUM((CASE WHEN status = 2 THEN 1 ELSE 0 END)), 0) rectifyNum,
IFNULL(SUM((CASE WHEN status = 3 THEN 1 ELSE 0 END)), 0) reviewNum,
IFNULL(SUM((CASE WHEN status = 4 THEN 1 ELSE 0 END)), 0) checkNum
IFNULL(SUM((CASE WHEN status = 2 THEN 1 ELSE 0 END)), 0) rectifyNum,
IFNULL(SUM((CASE WHEN status = 3 THEN 1 ELSE 0 END)), 0) reviewNum,
IFNULL(SUM((CASE WHEN status = 4 THEN 1 ELSE 0 END)), 0) checkNum
from quality_inspection_record
WHERE task_id = #{taskId}
</select>
<select id="selectDangerInspectCountByTask" resultType="java.util.Map">
SELECT COUNT(1) inspectNum,
IFNULL(SUM((CASE WHEN status = 1 or status = 5 THEN 0 ELSE 1 END)), 0) notEndNum
SELECT COUNT(1) inspectNum,
IFNULL(SUM((CASE WHEN status = 1 or status = 5 THEN 0 ELSE 1 END)), 0) notEndNum
from quality_inspection_record
where task_id = #{taskId}
</select>
<select id="selectDangerInspectCountByItemTask" resultType="java.util.Map">
SELECT COUNT(1) inspectNum,
IFNULL(SUM((CASE WHEN status = 1 or status = 5 THEN 0 ELSE 1 END)), 0) notEndNum
SELECT COUNT(1) inspectNum,
IFNULL(SUM((CASE WHEN status = 1 or status = 5 THEN 0 ELSE 1 END)), 0) notEndNum
from quality_inspection_record
where item_id = #{itemId}
</select>
@ -299,108 +413,52 @@
resultType="com.zhgd.jeecg.common.mybatis.EntityMap">
SELECT a.inspect_man_id, d.real_name inspect_man_name, COUNT(1) num
from quality_inspection_record a
INNER JOIN system_user d ON a.inspect_man_id = d.user_id
INNER JOIN system_user d ON a.inspect_man_id = d.user_id
WHERE a.project_sn = #{projectSn}
AND a.record_type = 1
AND a.record_type = 1
GROUP BY a.inspect_man_id
</select>
<select id="selectExportExcelQualityInspectionRecordList"
resultType="com.zhgd.jeecg.common.mybatis.EntityMap">
SELECT a.*,
b.enterprise_name,
c.full_name,
d.real_name change_name,
e.real_name review_name,
en.enterprise_name create_enterprise_name,
f.real_name verify_man_name,
g.real_name inspect_man_name,
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 quality_inspection_record a
LEFT JOIN enterprise_info b ON a.enterprise_sn = b.enterprise_sn
LEFT JOIN 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
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 &lt;= #{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
SELECT t.*,
b.enterprise_name,
c.full_name,
d.real_name change_name,
e.real_name review_name,
en.enterprise_name create_enterprise_name,
f.real_name verify_man_name,
g.real_name inspect_man_name,
h.check_name routine_check_name,
(SELECT GROUP_CONCAT(real_name)
FROM system_user
WHERE FIND_IN_SET(system_user.user_id, t.notify_person)) notify_person_name
from quality_inspection_record t
LEFT JOIN enterprise_info b ON t.enterprise_sn = b.enterprise_sn
LEFT JOIN 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 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">
SELECT count(1) total_num,
IFNULL(SUM((CASE WHEN status = 5 or status = 1 THEN 1 ELSE 0 END)), 0) rectification_num,
IFNULL(SUM((CASE WHEN !(status = 5 or status = 1) or status is null THEN 1 ELSE 0 END)),
0) no_rectification_num
SELECT count(1) total_num,
IFNULL(SUM((CASE WHEN status = 5 or status = 1 THEN 1 ELSE 0 END)), 0) rectification_num,
IFNULL(SUM((CASE WHEN !(status = 5 or status = 1) or status is null THEN 1 ELSE 0 END)),
0) no_rectification_num
from quality_inspection_record
WHERE project_sn = #{projectSn}
</select>
<select id="getQualityAcceptanceAndRectificationNum"
resultType="com.zhgd.xmgl.modules.quality.entity.vo.AllAndTodayDataVO">
resultType="com.zhgd.xmgl.modules.xz.security.entity.vo.XzSecurityXzSecurityAllAndTodayDataVO">
select
<!-- 所有 -->
COUNT(1) allTotal,
@ -416,7 +474,7 @@
WHERE a.project_sn = #{projectSn}
</select>
<select id="getQualityAcceptanceAndRectificationNumThisWeek"
resultType="com.zhgd.xmgl.modules.quality.entity.vo.AllAndThisWeekDataVO">
resultType="com.zhgd.xmgl.modules.xz.security.entity.vo.XzSecurityXzSecurityAllAndThisWeekDataVO">
select
<!-- 所有 -->
COUNT(1) allTotal,
@ -432,7 +490,7 @@
WHERE a.project_sn = #{projectSn}
</select>
<select id="getAllAndWeekData" resultType="com.zhgd.xmgl.modules.quality.entity.vo.AllAndWeekDataVO">
<select id="getAllAndWeekData" resultType="com.zhgd.xmgl.modules.xz.security.entity.vo.XzSecurityAllAndWeekDataVO">
select
<!-- 所有 -->
COUNT(1) allTotal,
@ -450,8 +508,8 @@
WHERE a.project_sn = #{projectSn}
</select>
<select id="getDepartmentRectifiedRank"
resultType="com.zhgd.xmgl.modules.quality.entity.vo.DepartmentRectifiedRankVo"
parameterType="com.zhgd.xmgl.modules.quality.entity.dto.DepartmentRectifiedRankDto">
resultType="com.zhgd.xmgl.modules.xz.security.entity.vo.XzSecurityDepartmentRectifiedRankVo"
parameterType="com.zhgd.xmgl.modules.xz.security.entity.dto.XzSecurityDepartmentRectifiedRankDto">
SELECT di.department_name,
count(qir.id) AS rectified_number
FROM department_info di
@ -464,10 +522,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 quality_inspection_record qir on ei.enterprise_sn = qir.enterprise_sn
LEFT JOIN project_enterprise pe ON pe.enterprise_id = ei.id
Left join quality_inspection_record t on ei.enterprise_sn = t.enterprise_sn
where 1 = 1
and pe.project_sn = #{projectSn}
GROUP BY ei.id
@ -475,27 +533,150 @@
</select>
<select id="countQualityInspectionRecordUrgentLevel" resultType="com.zhgd.xmgl.base.entity.vo.SectorOneVo">
select urgent_level enumType,count(*) count from quality_inspection_record
where 1=1 and project_sn=#{projectSn}
select urgent_level enumType, count(*) count
from quality_inspection_record
where 1 = 1
and project_sn = #{projectSn}
<if test="type == '1'.toString()">
and create_time >= date_sub(CURRENT_DATE,interval 6 day)
and create_time >= date_sub(CURRENT_DATE, interval 6 day)
</if>
<if test="type == '2'.toString()">
and create_time >= date_sub(CURRENT_DATE,interval 29 day)
and create_time >= date_sub(CURRENT_DATE, interval 29 day)
</if>
<if test="type == '3'.toString()">
and create_time >= #{createTime_begin}
and create_time <![CDATA[<=]]> if(LENGTH(#{createTime_end}) = 10, CONCAT(DATE_FORMAT(#{createTime_end},
'%Y-%m-%d'), ' 23:59:59'), #{createTime_end})
'%Y-%m-%d'), ' 23:59:59'),
#{createTime_end})
</if>
group by urgent_level
</select>
<select id="countQualityInspectionRecordRegion" resultType="com.zhgd.xmgl.base.entity.vo.TrendOneVo">
select qr.region_name x,ifnull(sum(if(qir.id is not null,1,0)),0) y from quality_region qr
left join quality_inspection_record qir on qr.id = qir.region_id
where 1=1 and qr.project_sn=#{projectSn}
group by qr.id
select qr.region_name x, ifnull(sum(if(t.id is not null, 1, 0)), 0) y
from quality_region qr
join 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
<include refid="whereCondition">
</include>
group by t.region_id
order by y desc
</select>
<select id="statsByChangeId" resultType="com.zhgd.xmgl.modules.xz.security.entity.vo.StatsByChangeIdVo">
select t.*,
round(IFNULL(TRUNCATE(IFNULL(t.rectifiedNum, 0) / IFNULL(totalNum, 0), 4), 0) * 100,
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)
rectifiedNumTimely,
IFNULL(SUM((CASE WHEN t.status != 2 and change_limit_time &lt; now() THEN 1 ELSE 0 END)), 0)
overTimeRectifiedNum,
IFNULL(SUM((CASE WHEN t.status = 2 and change_limit_time &lt; now() THEN 1 ELSE 0 END)), 0)
overTimeNotRectifiedNum,
su.real_name as workerName
from quality_inspection_record t
left join system_user su on su.user_id = t.change_id
WHERE record_type = 1
and t.status != 6
and project_sn = #{param.projectSn}
<include refid="whereCondition">
</include>
group by t.change_id
order by rectifiedNum desc) t
</select>
<select id="countDangerLevel" resultType="com.zhgd.xmgl.base.entity.vo.SectorOneVo">
select count(*) count, t.level as enumType
from quality_inspection_record t
where project_sn = #{param.projectSn}
and t.record_type = 1
and t.status != 6
<include refid="whereCondition">
</include>
group by enumType
</select>
<select id="statsByInspectManVo" resultType="com.zhgd.xmgl.modules.xz.security.entity.vo.StatsByInspectManVo">
select t.*,
round(IFNULL(TRUNCATE(IFNULL(t.rectifiedNum, 0) / IFNULL(totalNum, 0), 4), 0) * 100,
2) rectifiedNumRatio,
round(IFNULL(TRUNCATE(IFNULL(t.rectifiedNumTimely, 0) / IFNULL(totalNum, 0), 4), 0) * 100, 2)
rectifiedNumRatioTimely
from (SELECT count(*) totalNum,
count(*) createDangerNum,
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)
rectifiedNumTimely,
su.real_name as workerName
from quality_inspection_record hdir
left join system_user su on su.user_id = hdir.inspect_man_id
WHERE record_type = 1
and hdir.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.inspect_man_id
order by rectifiedNum desc) t
</select>
<select id="statsByEnterprise" resultType="com.zhgd.xmgl.modules.xz.security.entity.vo.StatsByEnterpriseVo">
select t.*,
round(IFNULL(TRUNCATE(IFNULL(t.rectifiedNum, 0) / IFNULL(totalNum, 0), 4), 0) * 100,
2) rectifiedNumRatio,
round(IFNULL(TRUNCATE(IFNULL(t.rectifiedNumTimely, 0) / IFNULL(totalNum, 0), 4), 0) * 100, 2)
rectifiedNumRatioTimely
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 quality_inspection_record t
left join enterprise_info ei on ei.id = t.enterprise_id
WHERE record_type = 1
and t.status != 6
and project_sn = #{param.projectSn}
<include refid="whereCondition">
</include>
group by t.enterprise_id
order by rectifiedNum desc) t
</select>
<select id="statsDangerType" resultType="com.zhgd.xmgl.base.entity.vo.SectorOneVo">
select count(*) count, SUBSTRING_INDEX(t.danger_item_content, '/', 1) as name
from quality_inspection_record t
where project_sn = #{param.projectSn}
and t.record_type = 1
and t.status != 6
<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>

View File

@ -1,5 +1,6 @@
package com.zhgd.xmgl.modules.quality.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.mybatis.EntityMap;
@ -8,8 +9,12 @@ import com.zhgd.xmgl.base.entity.vo.TrendOneVo;
import com.zhgd.xmgl.modules.quality.entity.QualityInspectionRecord;
import com.zhgd.xmgl.modules.quality.entity.dto.DepartmentRectifiedRankDto;
import com.zhgd.xmgl.modules.quality.entity.vo.*;
import com.zhgd.xmgl.modules.xz.security.entity.dto.XzSecurityDepartmentRectifiedRankDto;
import com.zhgd.xmgl.modules.xz.security.entity.vo.*;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -26,7 +31,7 @@ public interface IQualityInspectionRecordService extends IService<QualityInspect
RecordVo selectQualityInspectionRecordPage(Map<String, Object> map);
SelectQualityStatisticsVo selectQualityStatistics(Map<String, Object> map);
XzSecuritySelectQualityStatisticsVo selectQualityStatistics(Map<String, Object> map);
Map<String, Object> selectDangerTypeQualityCount(Map<String, Object> map);
@ -40,7 +45,7 @@ public interface IQualityInspectionRecordService extends IService<QualityInspect
List<EntityMap> selectPersonChargeQualityInspectionCountList(Map<String, Object> map);
void saveQualityInspectionRecord(QualityInspectionRecord qualityInspectionRecord);
void saveQualityInspectionRecord(QualityInspectionRecord xzSecurityQualityInspectionRecord);
void noticeBigScreen(QualityInspectionRecord qualityInspectionRecord, String time, String format);
@ -48,15 +53,15 @@ public interface IQualityInspectionRecordService extends IService<QualityInspect
EntityMap getRectificationAndNoNum(String projectSn);
AllAndTodayDataVO getQualityAcceptanceAndRectificationNum(String projectSn);
XzSecurityXzSecurityAllAndTodayDataVO getQualityAcceptanceAndRectificationNum(String projectSn);
AllAndThisWeekDataVO getQualityAcceptanceAndRectificationNumThisWeek(String projectSn);
XzSecurityXzSecurityAllAndThisWeekDataVO getQualityAcceptanceAndRectificationNumThisWeek(String projectSn);
AllAndWeekDataVO getAllAndWeekData(String projectSn);
XzSecurityAllAndWeekDataVO getAllAndWeekData(String projectSn);
List<QualityInspectionRecord> limitListBySubdivision(String projectSn, Long subsectionId, Long subentryId, Integer size);
Result<List<DepartmentRectifiedRankVo>> getDepartmentRectifiedRank(DepartmentRectifiedRankDto rectifiedRank);
Result<List<XzSecurityDepartmentRectifiedRankVo>> getDepartmentRectifiedRank(XzSecurityDepartmentRectifiedRankDto rectifiedRank);
List<TrendOneVo> countQualityInspectionRecordEnterprise(HashMap<String, Object> paramMap);
@ -64,7 +69,24 @@ public interface IQualityInspectionRecordService extends IService<QualityInspect
List<TrendOneVo> countQualityInspectionRecordRegion(HashMap<String, Object> paramMap);
Page<StatsByChangeIdVo> statsByChangeId(Map<String, Object> paramMap);
void revocation(QualityInspectionRecord xzSecurityQualityInspectionRecord);
void edit(QualityInspectionRecord qualityInspectionRecord);
void edit(QualityInspectionRecord xzSecurityQualityInspectionRecord);
XzSecurityQualityInspectionRecordTotalVo selectQualityStatisticsNum(Map<String, Object> map);
List<XzSecurityQualityInspectionRecordTotalVo> selectQualityStatisticsNumList(Map<String, Object> map);
SectorVo countDangerLevel(Map<String, Object> paramMap);
Page<StatsByInspectManVo> statsByInspectMan(Map<String, Object> paramMap);
Page<StatsByEnterpriseVo> statsByEnterprise(Map<String, Object> paramMap);
SectorVo statsDangerType(Map<String, Object> paramMap);
List<XzSecurityQualityInspectionRecordTotalVo> riskChart(Map<String, Object> map);
}

View File

@ -28,7 +28,6 @@ import com.zhgd.xmgl.modules.quality.entity.DangerItemRecord;
import com.zhgd.xmgl.modules.quality.entity.QualityInspectionRecord;
import com.zhgd.xmgl.modules.quality.entity.QualityRectifyRecord;
import com.zhgd.xmgl.modules.quality.entity.QualityRegion;
import com.zhgd.xmgl.modules.quality.entity.dto.DepartmentRectifiedRankDto;
import com.zhgd.xmgl.modules.quality.entity.vo.*;
import com.zhgd.xmgl.modules.quality.mapper.DangerItemRecordMapper;
import com.zhgd.xmgl.modules.quality.mapper.QualityInspectionRecordMapper;
@ -41,11 +40,10 @@ import com.zhgd.xmgl.modules.worker.mapper.EnterpriseInfoMapper;
import com.zhgd.xmgl.modules.worker.mapper.WorkerInfoMapper;
import com.zhgd.xmgl.modules.xz.entity.XzDeductScoreRecord;
import com.zhgd.xmgl.modules.xz.mapper.XzDeductScoreRecordMapper;
import com.zhgd.xmgl.modules.xz.security.entity.dto.XzSecurityDepartmentRectifiedRankDto;
import com.zhgd.xmgl.modules.xz.security.entity.vo.*;
import com.zhgd.xmgl.push.config.PushPayloads;
import com.zhgd.xmgl.util.JxlExcelUtils;
import com.zhgd.xmgl.util.MapBuilder;
import com.zhgd.xmgl.util.MessageUtil;
import com.zhgd.xmgl.util.NumberUtils;
import com.zhgd.xmgl.util.*;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
@ -57,6 +55,8 @@ import javax.servlet.http.HttpServletResponse;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* @Description: 质量检查记录
@ -153,7 +153,7 @@ public class QualityInspectionRecordServiceImpl extends ServiceImpl<QualityInspe
setProblemDescription(vo);
}
page.setRecords(list);
QualityInspectionRecordTotalVo total = qualityInspectionRecordMapper.selectQualityInspectionRecordPageTotal(map);
XzSecurityQualityInspectionRecordTotalVo total = qualityInspectionRecordMapper.selectQualityInspectionRecordPageTotal(map);
setDifferYesterday(map, total);
data.setPage(page);
data.setTotal(total);
@ -166,8 +166,8 @@ public class QualityInspectionRecordServiceImpl extends ServiceImpl<QualityInspe
}
@Override
public SelectQualityStatisticsVo selectQualityStatistics(Map<String, Object> map) {
SelectQualityStatisticsVo selectQualityStatisticsVo = new SelectQualityStatisticsVo();
public XzSecuritySelectQualityStatisticsVo selectQualityStatistics(Map<String, Object> map) {
XzSecuritySelectQualityStatisticsVo selectQualityStatisticsVo = new XzSecuritySelectQualityStatisticsVo();
/*
xmgl/qualityInspectionRecord/selectQualityStatistics
totalNum: '',问题总数
@ -178,7 +178,7 @@ public class QualityInspectionRecordServiceImpl extends ServiceImpl<QualityInspe
Map<String, Object> data = new HashMap<>();
map.put("recordType", "1");
QualityInspectionRecordTotalVo total = qualityInspectionRecordMapper.selectQualityInspectionRecordPageTotal(map);
XzSecurityQualityInspectionRecordTotalVo total = qualityInspectionRecordMapper.selectQualityInspectionRecordPageTotal(map);
setDifferYesterday(map, total);
List<Map<String, Object>> monthList = qualityInspectionRecordMapper.selectQualityInspectionRecordCountByDay(map);
List<String> dayList = getDayList();
@ -206,11 +206,11 @@ public class QualityInspectionRecordServiceImpl extends ServiceImpl<QualityInspe
return selectQualityStatisticsVo;
}
private void setDifferYesterday(Map<String, Object> map, QualityInspectionRecordTotalVo total) {
private void setDifferYesterday(Map<String, Object> map, XzSecurityQualityInspectionRecordTotalVo total) {
Date date = new Date();
map.put("inspectStartTime", DateUtil.today());
map.put("inspectEndTime", DateUtil.format(DateUtil.endOfDay(new Date()), "yyyy-MM-dd HH:mm:ss"));
QualityInspectionRecordTotalVo todayTotal = qualityInspectionRecordMapper.selectQualityInspectionRecordPageTotal(map);
XzSecurityQualityInspectionRecordTotalVo todayTotal = qualityInspectionRecordMapper.selectQualityInspectionRecordPageTotal(map);
total.setTotalNumDifferYesterday(Integer.parseInt(todayTotal.getTotalNum()));
total.setCloseNumDifferYesterday(todayTotal.getCloseNum());
total.setNotCloseNumDifferYesterday(todayTotal.getNotCloseNum());
@ -425,24 +425,24 @@ public class QualityInspectionRecordServiceImpl extends ServiceImpl<QualityInspe
}
@Override
public AllAndTodayDataVO getQualityAcceptanceAndRectificationNum(String projectSn) {
AllAndTodayDataVO allAndTodayDataVO = qualityInspectionRecordMapper.getQualityAcceptanceAndRectificationNum(projectSn);
public XzSecurityXzSecurityAllAndTodayDataVO getQualityAcceptanceAndRectificationNum(String projectSn) {
XzSecurityXzSecurityAllAndTodayDataVO allAndTodayDataVO = qualityInspectionRecordMapper.getQualityAcceptanceAndRectificationNum(projectSn);
setAllRatio(allAndTodayDataVO);
setTodayRatio(allAndTodayDataVO);
return allAndTodayDataVO;
}
@Override
public AllAndThisWeekDataVO getQualityAcceptanceAndRectificationNumThisWeek(String projectSn) {
AllAndThisWeekDataVO vo = qualityInspectionRecordMapper.getQualityAcceptanceAndRectificationNumThisWeek(projectSn);
public XzSecurityXzSecurityAllAndThisWeekDataVO getQualityAcceptanceAndRectificationNumThisWeek(String projectSn) {
XzSecurityXzSecurityAllAndThisWeekDataVO vo = qualityInspectionRecordMapper.getQualityAcceptanceAndRectificationNumThisWeek(projectSn);
setAllRatio(vo);
setWeekRatio(vo);
return vo;
}
@Override
public AllAndWeekDataVO getAllAndWeekData(String projectSn) {
AllAndWeekDataVO allAndWeekDataVO = qualityInspectionRecordMapper.getAllAndWeekData(projectSn);
public XzSecurityAllAndWeekDataVO getAllAndWeekData(String projectSn) {
XzSecurityAllAndWeekDataVO allAndWeekDataVO = qualityInspectionRecordMapper.getAllAndWeekData(projectSn);
setAllRatio(allAndWeekDataVO);
setWeekRatioData(allAndWeekDataVO);
return allAndWeekDataVO;
@ -460,8 +460,8 @@ public class QualityInspectionRecordServiceImpl extends ServiceImpl<QualityInspe
}
@Override
public Result<List<DepartmentRectifiedRankVo>> getDepartmentRectifiedRank(DepartmentRectifiedRankDto rectifiedRank) {
List<DepartmentRectifiedRankVo> voList = qualityInspectionRecordMapper.getDepartmentRectifiedRank(rectifiedRank);
public Result<List<XzSecurityDepartmentRectifiedRankVo>> getDepartmentRectifiedRank(XzSecurityDepartmentRectifiedRankDto rectifiedRank) {
List<XzSecurityDepartmentRectifiedRankVo> voList = qualityInspectionRecordMapper.getDepartmentRectifiedRank(rectifiedRank);
return Result.success(voList);
}
@ -564,7 +564,7 @@ public class QualityInspectionRecordServiceImpl extends ServiceImpl<QualityInspe
);
}
private void setWeekRatioData(AllAndWeekDataVO allAndWeekDataVO) {
private void setWeekRatioData(XzSecurityAllAndWeekDataVO allAndWeekDataVO) {
long weekClose = allAndWeekDataVO.getWeekClose();
long weekNoClose = allAndWeekDataVO.getWeekNoClose();
long l = weekClose + weekNoClose;
@ -573,7 +573,7 @@ public class QualityInspectionRecordServiceImpl extends ServiceImpl<QualityInspe
allAndWeekDataVO.setWeekTotal(l);
}
private void setWeekRatio(AllAndThisWeekDataVO allAndThisWeekDataVO) {
private void setWeekRatio(XzSecurityXzSecurityAllAndThisWeekDataVO allAndThisWeekDataVO) {
long weekClose = allAndThisWeekDataVO.getWeekClose();
long weekNoClose = allAndThisWeekDataVO.getWeekNoClose();
long l = weekClose + weekNoClose;
@ -582,7 +582,7 @@ public class QualityInspectionRecordServiceImpl extends ServiceImpl<QualityInspe
allAndThisWeekDataVO.setWeekTotal(l);
}
private void setTodayRatio(AllAndTodayDataVO allAndTodayDataVO) {
private void setTodayRatio(XzSecurityXzSecurityAllAndTodayDataVO allAndTodayDataVO) {
long todayClose = allAndTodayDataVO.getTodayClose();
long todayNoClose = allAndTodayDataVO.getTodayNoClose();
long todayTotal = todayClose + todayNoClose;
@ -591,13 +591,156 @@ public class QualityInspectionRecordServiceImpl extends ServiceImpl<QualityInspe
allAndTodayDataVO.setTodayTotal(todayTotal);
}
private void setAllRatio(AllDataVO allDataVO) {
long allClose = allDataVO.getAllClose();
long allNoClose = allDataVO.getAllNoClose();
long allTotal = allDataVO.getAllTotal();
allDataVO.setAllCloseRatio(allTotal != 0 ? NumberUtil.div(NumberUtil.mul(allClose, 100), allTotal, 2) : 0);
allDataVO.setAllNoCloseRatio(allTotal != 0 ? NumberUtil.div(NumberUtil.mul(allNoClose, 100), allTotal, 2) : 0);
private void setAllRatio(XzSecurityAllDataVO xzSecurityAllDataVO) {
long allClose = xzSecurityAllDataVO.getAllClose();
long allNoClose = xzSecurityAllDataVO.getAllNoClose();
long allTotal = xzSecurityAllDataVO.getAllTotal();
xzSecurityAllDataVO.setAllCloseRatio(allTotal != 0 ? NumberUtil.div(NumberUtil.mul(allClose, 100), allTotal, 2) : 0);
xzSecurityAllDataVO.setAllNoCloseRatio(allTotal != 0 ? NumberUtil.div(NumberUtil.mul(allNoClose, 100), allTotal, 2) : 0);
}
@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;
}
@Override
public Page<StatsByChangeIdVo> statsByChangeId(Map<String, Object> paramMap) {
Page page = PageUtil.getPage(paramMap);
return baseMapper.statsByChangeId(paramMap, page);
}
private XzSecurityQualityInspectionRecordTotalVo getXzSecurityQualityInspectionRecordTotalVo(Map<String, Object> map) {
XzSecurityQualityInspectionRecordTotalVo total = qualityInspectionRecordMapper.selectQualityInspectionRecordPageTotal(map);
setDifferYesterday(map, total);
return total;
}
@Override
public XzSecurityQualityInspectionRecordTotalVo selectQualityStatisticsNum(Map<String, Object> map) {
return getXzSecurityQualityInspectionRecordTotalVo(map);
}
private XzSecurityQualityInspectionRecordTotalVo getWeekCountInitial(Integer whichWeekOfMonth) {
XzSecurityQualityInspectionRecordTotalVo e = new XzSecurityQualityInspectionRecordTotalVo();
e.setDangerNum(0);
e.setLowRiskNum(0);
e.setGeneralRiskNum(0);
e.setLargerRiskNum(0);
e.setGreatFaultLevelNum(0);
e.setRectificationNum(0);
e.setNotCloseNum(0);
e.setWhichWeekOfMonth(whichWeekOfMonth);
return e;
}
@Override
public List<XzSecurityQualityInspectionRecordTotalVo> selectQualityStatisticsNumList(Map<String, Object> map) {
Integer isStatsByWeek = MapUtils.getInteger(map, "isStatsByWeek");
List<XzSecurityQualityInspectionRecordTotalVo> vos = qualityInspectionRecordMapper.selectQualityInspectionRecordPageTotal(map, "");
Map<Integer, XzSecurityQualityInspectionRecordTotalVo> whichMap = vos.stream().collect(Collectors.toMap(XzSecurityQualityInspectionRecordTotalVo::getWhichWeekOfMonth, v -> v, (t, t2) -> t));
if (Objects.equals(isStatsByWeek, 1)) {
ArrayList<XzSecurityQualityInspectionRecordTotalVo> allList = new ArrayList<>();
allList.add(getWeekCountInitial(0));
allList.add(getWeekCountInitial(1));
allList.add(getWeekCountInitial(2));
allList.add(getWeekCountInitial(3));
ArrayList<XzSecurityQualityInspectionRecordTotalVo> rtList = new ArrayList<>();
for (XzSecurityQualityInspectionRecordTotalVo vo : allList) {
Integer whichWeekOfMonth = vo.getWhichWeekOfMonth();
XzSecurityQualityInspectionRecordTotalVo dataVo = whichMap.get(whichWeekOfMonth);
if (dataVo != null) {
vo = dataVo;
}
if (Objects.equals(whichWeekOfMonth, 0)) {
String w1b = DateUtil.format(new Date(), "yyyy-MM-") + "01";
String w1e = DateUtil.format(new Date(), "yyyy-MM-") + "07";
vo.setWeekBetweenStr(w1b + " - " + w1e);
} else if (Objects.equals(whichWeekOfMonth, 1)) {
String w1b = DateUtil.format(new Date(), "yyyy-MM-") + "08";
String w1e = DateUtil.format(new Date(), "yyyy-MM-") + "14";
vo.setWeekBetweenStr(w1b + " - " + w1e);
} else if (Objects.equals(whichWeekOfMonth, 2)) {
String w1b = DateUtil.format(new Date(), "yyyy-MM-") + "15";
String w1e = DateUtil.format(new Date(), "yyyy-MM-") + "21";
vo.setWeekBetweenStr(w1b + " - " + w1e);
} else if (Objects.equals(whichWeekOfMonth, 3)) {
String w1b = DateUtil.format(new Date(), "yyyy-MM-") + "22";
String w1e = DateUtil.format(DateUtil.endOfMonth(new Date()), "yyyy-MM-dd");
vo.setWeekBetweenStr(w1b + " - " + w1e);
}
rtList.add(vo);
}
vos = rtList;
}
return vos;
}
@Override
public SectorVo countDangerLevel(Map<String, Object> paramMap) {
ArrayList<SectorOneVo> list = baseMapper.countDangerLevel(paramMap);
return SectorVo.getSectorVoByEnum(list, ParamEnum.QualityInspectionRecordLevel.values(), false);
}
@Override
public Page<StatsByInspectManVo> statsByInspectMan(Map<String, Object> paramMap) {
Page page = PageUtil.getPage(paramMap);
return baseMapper.statsByInspectManVo(paramMap, page);
}
@Override
public Page<StatsByEnterpriseVo> statsByEnterprise(Map<String, Object> paramMap) {
Page page = PageUtil.getPage(paramMap);
return baseMapper.statsByEnterprise(paramMap, page);
}
@Override
public SectorVo statsDangerType(Map<String, Object> paramMap) {
List<SectorOneVo> data = baseMapper.statsDangerType(paramMap);
return SectorVo.getSectorVo(data);
}
}