Commit 737f8a2c authored by 鲁鸿波's avatar 鲁鸿波

监督检查统计开发

parent 6d1cd8bd
......@@ -10,6 +10,9 @@ import com.testor.module.emergency.model.vo.TContingencyPlanVO;
import com.testor.module.hazard.model.domain.THazardLicenseSignatureRecord;
import com.testor.module.hazard.model.dto.THazardWorkPlanCheckDelParam;
import com.testor.module.hazard.model.dto.THazardWorkPlanCheckParam;
import com.testor.module.hazard.model.vo.HazardWorkPlanCheckComplianceStatisticsVO;
import com.testor.module.hazard.model.vo.HazardWorkPlanCheckProblemCountStatisticsVO;
import com.testor.module.hazard.model.vo.HazardWorkPlanCheckProblemTypeStatisticsVO;
import com.testor.module.safe.model.dto.TSafeHazardOrgParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -173,4 +176,33 @@ public class THazardWorkPlanCheckController extends SuperController
}
return baseResponse;
}
@ApiOperation(value = "PC端监督检查合规率统计", notes = "selectCheckComplianceStatistics")
@PostMapping(value = "/selectCheckComplianceStatistics")
public BaseResponse<List<HazardWorkPlanCheckComplianceStatisticsVO>> selectCheckComplianceStatistics(@RequestBody THazardWorkPlanCheckParam param){
BaseResponse<List<HazardWorkPlanCheckComplianceStatisticsVO>> baseResponse=new BaseResponse<>();
List<HazardWorkPlanCheckComplianceStatisticsVO> resultList = tHazardWorkPlanCheckService.selectCheckComplianceStatistics(param);
baseResponse.setData(resultList);
return baseResponse;
}
@ApiOperation(value = "PC端监督检查问题类型统计", notes = "selectCheckProblemTypeStatistics")
@PostMapping(value = "/selectCheckProblemTypeStatistics")
public BaseResponse<List<HazardWorkPlanCheckProblemTypeStatisticsVO>> selectCheckProblemTypeStatistics(@RequestBody THazardWorkPlanCheckParam param){
BaseResponse<List<HazardWorkPlanCheckProblemTypeStatisticsVO>> baseResponse=new BaseResponse<>();
List<HazardWorkPlanCheckProblemTypeStatisticsVO> resultList = tHazardWorkPlanCheckService.selectCheckProblemTypeStatistics(param);
baseResponse.setData(resultList);
return baseResponse;
}
@ApiOperation(value = "PC端问题数量统计", notes = "selectCheckProblemCountStatistics")
@PostMapping(value = "/selectCheckProblemCountStatistics")
public BaseResponse<List<HazardWorkPlanCheckProblemCountStatisticsVO>> selectCheckProblemCountStatistics(@RequestBody THazardWorkPlanCheckParam param){
BaseResponse<List<HazardWorkPlanCheckProblemCountStatisticsVO>> baseResponse=new BaseResponse<>();
List<HazardWorkPlanCheckProblemCountStatisticsVO> resultList = tHazardWorkPlanCheckService.selectCheckProblemCountStatistics(param);
baseResponse.setData(resultList);
return baseResponse;
}
}
......@@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.testor.module.hazard.model.domain.THazardWorkPlanCheck;
import com.testor.module.hazard.model.dto.THazardWorkPlanCheckParam;
import com.testor.module.hazard.model.vo.HazardWorkPlanCheckComplianceStatisticsVO;
import com.testor.module.hazard.model.vo.HazardWorkPlanCheckProblemCountStatisticsVO;
import com.testor.module.hazard.model.vo.HazardWorkPlanCheckProblemTypeStatisticsVO;
import com.tongtech.tfw.backend.common.models.supers.SuperDao;
import com.tongtech.tfw.workflow.apis.task.model.dto.TodoTask;
import org.apache.ibatis.annotations.Param;
......@@ -66,4 +69,29 @@ public interface THazardWorkPlanCheckDao extends SuperDao<THazardWorkPlanCheck>
@Select("select count(1) from t_hazard_work_plan_check\n" +
"where plan_id = #{planId} and status ='0'")
Integer countByPlanId(String planId);
/**
* 监督检查合规率统计
* @param tHazardWorkPlanCheckParam
* @return
*/
List<HazardWorkPlanCheckComplianceStatisticsVO> selectCheckComplianceStatistics(@Param("param") THazardWorkPlanCheckParam tHazardWorkPlanCheckParam);
/**
* 监督检查问题类型统计
* @param tHazardWorkPlanCheckParam
* @return
*/
List<HazardWorkPlanCheckProblemTypeStatisticsVO> selectCheckProblemTypeStatistics(@Param("param") THazardWorkPlanCheckParam tHazardWorkPlanCheckParam);
/**
*问题数量统计
* @param tHazardWorkPlanCheckParam
* @return
*/
List<HazardWorkPlanCheckProblemCountStatisticsVO> selectCheckProblemCountStatistics(@Param("param") THazardWorkPlanCheckParam tHazardWorkPlanCheckParam);
}
package com.testor.module.hazard.model.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author rsq
* @program zlmy_boot
* @return
**/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class HazardWorkPlanCheckComplianceStatisticsVO {
@ApiModelProperty(value = "组织机构id")
private String orgId;
@ApiModelProperty(value = "组织机构名称")
private String orgName;
@ApiModelProperty(value = "监督检查总数")
private Double checkCount;
@ApiModelProperty(value = "监督检查合格总数")
private Double checkQualifiedCount;
@ApiModelProperty(value = "监督检查合规率")
private Double complianceRatePercent;
}
package com.testor.module.hazard.model.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author rsq
* @program zlmy_boot
* @return
**/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class HazardWorkPlanCheckProblemCountStatisticsVO {
@ApiModelProperty(value = "问题日期")
private String problemDate;
@ApiModelProperty(value = "问题数量")
private Double problemCount;
}
package com.testor.module.hazard.model.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author rsq
* @program zlmy_boot
* @return
**/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class HazardWorkPlanCheckProblemTypeStatisticsVO {
@ApiModelProperty(value = "问题类型名称")
private String problemName;
@ApiModelProperty(value = "问题类型数量")
private Double problemCount;
}
......@@ -6,6 +6,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.testor.module.hazard.model.domain.THazardWorkPlan;
import com.testor.module.hazard.model.domain.THazardWorkPlanCheck;
import com.testor.module.hazard.model.dto.THazardWorkPlanCheckParam;
import com.testor.module.hazard.model.vo.HazardWorkPlanCheckComplianceStatisticsVO;
import com.testor.module.hazard.model.vo.HazardWorkPlanCheckProblemCountStatisticsVO;
import com.testor.module.hazard.model.vo.HazardWorkPlanCheckProblemTypeStatisticsVO;
import com.testor.module.safe.model.dto.TSafeHazardOrgParam;
import com.tongtech.tfw.backend.common.models.supers.SuperService;
import org.apache.ibatis.annotations.Param;
......@@ -68,4 +71,27 @@ public interface THazardWorkPlanCheckService extends SuperService<THazardWorkPla
*/
void exportEntity(THazardWorkPlanCheckParam param, HttpServletResponse response);
/**
* 监督检查合规率统计
* @param tHazardWorkPlanCheckParam
* @return
*/
List<HazardWorkPlanCheckComplianceStatisticsVO> selectCheckComplianceStatistics(THazardWorkPlanCheckParam tHazardWorkPlanCheckParam);
/**
* 监督检查问题类型统计
* @param tHazardWorkPlanCheckParam
* @return
*/
List<HazardWorkPlanCheckProblemTypeStatisticsVO> selectCheckProblemTypeStatistics(THazardWorkPlanCheckParam tHazardWorkPlanCheckParam);
/**
*问题数量统计
* @param tHazardWorkPlanCheckParam
* @return
*/
List<HazardWorkPlanCheckProblemCountStatisticsVO> selectCheckProblemCountStatistics(THazardWorkPlanCheckParam tHazardWorkPlanCheckParam);
}
......@@ -13,6 +13,9 @@ import com.testor.module.hazard.dao.THazardWorkPlanCheckDao;
import com.testor.module.hazard.model.domain.THazardWorkPlan;
import com.testor.module.hazard.model.domain.THazardWorkPlanCheck;
import com.testor.module.hazard.model.dto.THazardWorkPlanCheckParam;
import com.testor.module.hazard.model.vo.HazardWorkPlanCheckComplianceStatisticsVO;
import com.testor.module.hazard.model.vo.HazardWorkPlanCheckProblemCountStatisticsVO;
import com.testor.module.hazard.model.vo.HazardWorkPlanCheckProblemTypeStatisticsVO;
import com.testor.module.hazard.model.vo.HazardWorkPlanCheckVO;
import com.testor.module.hazard.service.THazardWorkPlanCheckService;
import com.testor.module.notice.dao.TSysOrgDao;
......@@ -134,4 +137,18 @@ public class THazardWorkPlanCheckServiceImpl extends SuperServiceImpl<THazardWor
}
@Override
public List<HazardWorkPlanCheckComplianceStatisticsVO> selectCheckComplianceStatistics(THazardWorkPlanCheckParam tHazardWorkPlanCheckParam) {
return this.baseMapper.selectCheckComplianceStatistics(tHazardWorkPlanCheckParam);
}
@Override
public List<HazardWorkPlanCheckProblemTypeStatisticsVO> selectCheckProblemTypeStatistics(THazardWorkPlanCheckParam tHazardWorkPlanCheckParam) {
return this.baseMapper.selectCheckProblemTypeStatistics(tHazardWorkPlanCheckParam);
}
@Override
public List<HazardWorkPlanCheckProblemCountStatisticsVO> selectCheckProblemCountStatistics(THazardWorkPlanCheckParam tHazardWorkPlanCheckParam) {
return this.baseMapper.selectCheckProblemCountStatistics(tHazardWorkPlanCheckParam);
}
}
......@@ -52,6 +52,9 @@ spring:
datasource:
kingbase:
driver-class-name: com.kingbase8.Driver
url: jdbc:kingbase8://101.126.159.207:54322/public?currentSchema=public&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8
#部署用内网
url: jdbc:kingbase8://172.31.0.2:54322/public?currentSchema=public&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8
#开发用外网
#url: jdbc:kingbase8://101.126.159.207:54322/public?currentSchema=public&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8
username: system
password: ZLmy654321
\ No newline at end of file
......@@ -104,7 +104,7 @@
<if test="param.checkName!=null and param.checkName!=''">
and hwpc.check_name like concat('%', #{param.checkName}, '%')
</if>
<if test="param.startTime != null and param.endTime != null">
<if test="param.startTime != null and param.startTime != '' and param.endTime != null and param.endTime != ''">
and hwpc.check_time between #{param.startTime} and #{param.endTime}
</if>
<if test="param.orgIdList != null and param.orgIdList.size()>0">
......@@ -162,7 +162,7 @@
<if test="param.checkName!=null and param.checkName!=''">
and hwpc.check_name like concat('%', #{param.checkName}, '%')
</if>
<if test="param.startTime != null and param.endTime != null">
<if test="param.startTime != null and param.startTime != '' and param.endTime != null and param.endTime != ''">
and hwpc.check_time between #{param.startTime} and #{param.endTime}
</if>
<if test="param.orgIdList != null and param.orgIdList.size()>0">
......@@ -182,4 +182,104 @@
where hwpc.status = '0' and hwpc.id = #{id}
</select>
<select id="selectCheckComplianceStatistics" resultType="com.testor.module.hazard.model.vo.HazardWorkPlanCheckComplianceStatisticsVO">
SELECT
COUNT(*) AS checkCount,
SUM(CASE WHEN hwpc.is_compliant = 1 THEN 1 ELSE 0 END) AS checkQualifiedCount,
ROUND(
SUM(CASE WHEN hwpc.is_compliant = 1 THEN 1 ELSE 0 END) * 100.0 / COUNT(*),
2
) AS complianceRatePercent
FROM t_hazard_work_plan_check hwpc
left join t_hazard_work_plan wpc on hwpc.plan_id = wpc.id
where hwpc.status = '0'
<if test="param.orgIdList != null and param.orgIdList.size()>0">
and (
<foreach item="id" collection="param.orgIdList" separator=" OR ">
hwpc.basic_id LIKE concat('%', #{id}, '%')
</foreach>
)
</if>
<if test="param.workType!=null and param.workType!=''">
and hwp.work_type = #{param.workType}
</if>
<if test="param.workLevel!=null and param.workLevel!=''">
and hwp.work_level = #{param.workLevel}
</if>
<if test="param.stakeholderWork!=null and param.stakeholderWork!=''">
and hwp.stakeholder_work = #{param.stakeholderWork}
</if>
<if test="param.startTime != null and param.startTime != '' and param.endTime != null and param.endTime != ''">
and hwpc.check_time between #{param.startTime} and #{param.endTime}
</if>
</select>
<select id="selectCheckProblemTypeStatistics" resultType="com.testor.module.hazard.model.vo.HazardWorkPlanCheckProblemTypeStatisticsVO">
select dd.dict_value problemName,count(*) problemCount
from t_sys_dict_data dd
left join t_hazard_work_plan_check hwpc on hwpc.problem_type = dd.dict_data_id
where hwpc.status = '0' AND hwpc.is_compliant = 0 AND hwpc.problem_type IS NOT NULL
<if test="param.orgIdList != null and param.orgIdList.size()>0">
and (
<foreach item="id" collection="param.orgIdList" separator=" OR ">
hwpc.basic_id LIKE concat('%', #{id}, '%')
</foreach>
)
</if>
<if test="param.workType!=null and param.workType!=''">
and hwp.work_type = #{param.workType}
</if>
<if test="param.workLevel!=null and param.workLevel!=''">
and hwp.work_level = #{param.workLevel}
</if>
<if test="param.stakeholderWork!=null and param.stakeholderWork!=''">
and hwp.stakeholder_work = #{param.stakeholderWork}
</if>
<if test="param.startTime != null and param.startTime != '' and param.endTime != null and param.endTime != ''">
and hwpc.check_time between #{param.startTime} and #{param.endTime}
</if>
group by dd.dict_value
</select>
<select id="selectCheckProblemCountStatistics" resultType="com.testor.module.hazard.model.vo.HazardWorkPlanCheckProblemCountStatisticsVO">
SELECT
TO_CHAR(dates.timeStr, 'YYYY-MM-DD') AS problemDate,
COUNT(hwpc.id) AS problemCount
FROM
(SELECT generate_series(
#{param.startTime}::timestamp,
#{param.endTime}::timestamp,
'1 day'::interval
)::date AS timeStr) dates
LEFT JOIN
t_hazard_work_plan_check hwpc
ON hwpc.check_time::date = dates.timeStr
AND hwpc.status = '0'
AND hwpc.is_compliant = 0
AND hwpc.problem_type IS NOT NULL
<if test="param.orgIdList != null and param.orgIdList.size()>0">
and (
<foreach item="id" collection="param.orgIdList" separator=" OR ">
hwpc.basic_id LIKE concat('%', #{id}, '%')
</foreach>
)
</if>
<if test="param.workType!=null and param.workType!=''">
and hwp.work_type = #{param.workType}
</if>
<if test="param.workLevel!=null and param.workLevel!=''">
and hwp.work_level = #{param.workLevel}
</if>
<if test="param.stakeholderWork!=null and param.stakeholderWork!=''">
and hwp.stakeholder_work = #{param.stakeholderWork}
</if>
<if test="param.startTime != null and param.startTime != '' and param.endTime != null and param.endTime != ''">
and hwpc.check_time between #{param.startTime} and #{param.endTime}
</if>
GROUP BY
dates.timeStr
ORDER BY
dates.timeStr
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment