Commit aa6eccaf authored by 麻笑宇's avatar 麻笑宇

安全追溯大屏提交

1.问题类型主体统计 2.设备问题近30天统计 3.企业问题近30天统计 4.人员问题近30天统计 5.气瓶问题近30天统计 6.按月统计近12个月的问题数量趋势 7.按月统计近30天的问题数量趋势
parent ab457eb6
package com.yeejoin.amos.boot.module.common.api.enums;
import lombok.Getter;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
@Getter
public enum IssueMainBodyEnum {
//个人
PERSON("个人","1"),
//企业
COMPANY("企业","2"),
//设备
EQUIPMENT("设备","3"),
//气瓶
CYLINDER("气瓶","4"),
;
String name;
String code;
private IssueMainBodyEnum(String name, String code) {
this.name = name;
this.code = code;
}
public static List<HashMap<String,String>> getEnumList() {
List<HashMap<String, String>> list = new ArrayList<>();
for (IssueMainBodyEnum testEnum : EnumSet.allOf(IssueMainBodyEnum.class)) {
HashMap<String, String> map = new HashMap<>();
map.put(testEnum.name,testEnum.code.toString());
list.add(map);
}
return list;
}
public static List<String> getEnumNameList() {
List<String> list = new ArrayList<>();
for (IssueMainBodyEnum testEnum : EnumSet.allOf(IssueMainBodyEnum.class)) {
list.add(testEnum.getName());
}
return list;
}
}
package com.yeejoin.amos.boot.module.common.api.enums;
import lombok.Getter;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
@Getter
public enum IssueTypeEnum {
//检验超期(设备)
CHECK_OVERDUE_EQUMENT("检验超期","2","3"),
//维保超期(设备)
MAINTENANCE_OVERDUE_EQUMENT("维保超期","1","3"),
//资质超期(设备)
QUALIFICATION_OVERDUE_EQUMENT("资质超期","3","3"),
//检验不合格(设备)
CHECK_UNQUALIFIED_EQUMENT("检验不合格","4","3"),
//超设计使用年限(设备)
DESIGN_OVERDUE_EQUMENT("超设计使用年限","5","3"),
//电梯困人(设备)
ELEVATOR_TRAPPED_EQUMENT("电梯困人","6","3"),
//电梯故障(设备)
ELEVATOR_FAULT_EQUMENT("电梯故障","7","3"),
//许可临期(公司)
LICENSE_EXPIRY_COMPANY("许可临期","8","2"),
//许可超期(公司)
LICENSE_OVERDUE_COMPANY("许可超期","9","2"),
//维保备案超期(公司)
MAINTENANCE_RECORD_OVERDUE_COMPANY("维保备案超期","10","2"),
//许可临期(个人)
LICENSE_EXPIRY_PERSON("许可临期","11","1"),
//许可超期(个人)
LICENSE_OVERDUE_PERSON("许可超期","12","1"),
//许可超期(气瓶)
LICENSE_OVERDUE_CYLINDER("许可超期","13","4"),
//检验超期(气瓶)
CHECK_OVERDUE_CYLINDER("检验超期","14","4"),
//检验不合格(气瓶)
CHECK_UNQUALIFIED_CYLINDER("检验不合格","15","4"),
//操作人员资质超期(气瓶)
OPERATOR_QUALIFICATION_OVERDUE_CYLINDER("操作人员资质超期","16","1"),
//充装异常(气瓶)
CHARGE_EXCEPTION_CYLINDER("充装异常","17","4"),
;
String name;
String code;
String mainBody;
private IssueTypeEnum(String name, String code, String mainBody) {
this.name = name;
this.code = code;
this.mainBody = mainBody;
}
public static List<HashMap<String,String>> getEnumList() {
List<HashMap<String, String>> list = new ArrayList<>();
for (IssueTypeEnum testEnum : EnumSet.allOf(IssueTypeEnum.class)) {
HashMap<String, String> map = new HashMap<>();
map.put(testEnum.name,testEnum.code.toString());
list.add(map);
}
return list;
}
public static List<String> getEnumNameListByMainBody(String mainBody) {
List<String> list = new ArrayList<>();
for (IssueTypeEnum testEnum : EnumSet.allOf(IssueTypeEnum.class)) {
if(mainBody.equals(testEnum.getMainBody())){
list.add(testEnum.getName());
}
}
return list;
}
}
package com.yeejoin.amos.boot.module.cylinder.api.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@Mapper
public interface DPStatisticsMapper {
String getOrgCodeByCompanyCode(@Param("cityCode") String cityCode);
List<Map<String, Object>> selectByOrgAndMainBody(@Param("orgCode") String orgCode, @Param("mainBodyNameList") List<String> mainBodyNameList,
@Param("startDate") String startDate, @Param("status") String status);
List<Map<String, Object>> selectByOrgAndProblemType(@Param("orgCode") String orgCode, @Param("enumNameList") List<String> enumNameList,
@Param("startDate") String startDate, @Param("sourceType") String sourceType);
List<Map<String, Object>> getIssueCountByMonth(@Param("orgCode") String orgCode, @Param("year") String year, @Param("status") String status);
List<Map<String, Object>> getIssueCountByDate(@Param("orgCode") String orgCode, @Param("year") String year, @Param("status") String status);
}
<?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.yeejoin.amos.boot.module.cylinder.api.mapper.DPStatisticsMapper">
<select id="getOrgCodeByCompanyCode" resultType="java.lang.String">
select org_code from privilege_company where company_code = #{cityCode} limit 1
</select>
<select id="selectByOrgAndMainBody" resultType="java.util.Map">
SELECT COUNT
( 1 ),
source_type AS sourceType
FROM
tzs_safety_problem_tracing
WHERE
governing_body_org_code LIKE concat ( #{orgCode}, '%' )
AND create_date &gt;= #{startDate}
AND source_type IN
<foreach collection="mainBodyNameList" item="item" separator="," open="(" close=")">
#{item}
</foreach>
<if test="null != status">
AND problem_status_code = #{status}
</if>
GROUP BY
source_type
</select>
<select id="selectByOrgAndProblemType" resultType="java.util.Map">
SELECT COUNT
( 1 ),
problem_type AS problemType
FROM
tzs_safety_problem_tracing
WHERE
governing_body_org_code LIKE concat ( #{orgCode}, '%' )
AND create_date &gt;= #{startDate}
AND source_type = #{sourceType}
AND problem_type IN
<foreach collection="enumNameList" item="item" separator="," open="(" close=")">
#{item}
</foreach>
GROUP BY
problem_type
</select>
<select id="getIssueCountByMonth" resultType="java.util.Map">
SELECT COUNT
( 1 ),
DATE_FORMAT(create_date,'%Y-%m') AS time
FROM
tzs_safety_problem_tracing
WHERE
governing_body_org_code LIKE concat ( #{orgCode}, '%' )
AND DATE_FORMAT(create_date,'%Y') = #{year}
<if test="null != status">
AND problem_status_code = #{status}
</if>
GROUP BY
DATE_FORMAT(create_date,'%Y-%m')
</select>
<select id="getIssueCountByDate" resultType="java.util.Map">
SELECT COUNT
( 1 ),
DATE_FORMAT(create_date,'%Y-%m-%d') AS time
FROM
tzs_safety_problem_tracing
WHERE
governing_body_org_code LIKE concat ( #{orgCode}, '%' )
AND DATE_FORMAT(create_date,'%Y-%m-%d') &gt;= #{year}
<if test="null != status">
AND problem_status_code = #{status}
</if>
GROUP BY
DATE_FORMAT(create_date,'%Y-%m-%d')
</select>
</mapper>
...@@ -74,4 +74,88 @@ public class CylinderStatisticsController { ...@@ -74,4 +74,88 @@ public class CylinderStatisticsController {
Map<String, Object> result = service.getsecurityIndex(regionCode.toString()); Map<String, Object> result = service.getsecurityIndex(regionCode.toString());
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
}; };
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "问题类型主体统计")
@PostMapping(value = "/mainBodyCount")
public ResponseModel<Map<String, Object>> mainBodyCount(@RequestBody Map<String, Object> map ) throws Exception {
Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000";
}
Map<String, Object> result = service.mainBodyCount(regionCode.toString());
return ResponseHelper.buildResponse(result);
};
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "设备问题近30天统计")
@PostMapping(value = "/equipmentCount")
public ResponseModel<Map<String, Object>> equipmentCount(@RequestBody Map<String, Object> map ) throws Exception {
Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000";
}
Map<String, Object> result = service.equipmentCount(regionCode.toString());
return ResponseHelper.buildResponse(result);
};
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "企业问题近30天统计")
@PostMapping(value = "/companyCount")
public ResponseModel<List<Map<String, Object>>> companyCount(@RequestBody Map<String, Object> map ) throws Exception {
Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000";
}
List<Map<String, Object>> result = service.companyCount(regionCode.toString());
return ResponseHelper.buildResponse(result);
};
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "人员问题近30天统计")
@PostMapping(value = "/personCount")
public ResponseModel<Map<String, Object>> personCount(@RequestBody Map<String, Object> map ) throws Exception {
Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000";
}
Map<String, Object> result = service.personCount(regionCode.toString());
return ResponseHelper.buildResponse(result);
};
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "气瓶问题近30天统计")
@PostMapping(value = "/cylinderCount")
public ResponseModel<Map<String, Object>> cylinderCount(@RequestBody Map<String, Object> map ) throws Exception {
Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000";
}
Map<String, Object> result = service.cylinderCount(regionCode.toString());
return ResponseHelper.buildResponse(result);
};
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "按月统计近12个月的问题数量趋势")
@PostMapping(value = "/issueCountByMonth")
public ResponseModel<Map<String, Object>> issueCountByMonth(@RequestBody Map<String, Object> map ) throws Exception {
Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000";
}
Map<String, Object> result = service.issueCountByMonth(regionCode.toString());
return ResponseHelper.buildResponse(result);
};
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "按月统计近30天的问题数量趋势")
@PostMapping(value = "/issueCountByDay")
public ResponseModel<Map<String, Object>> issueCountByDay(@RequestBody Map<String, Object> map ) throws Exception {
Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000";
}
Map<String, Object> result = service.issueCountByDay(regionCode.toString());
return ResponseHelper.buildResponse(result);
};
} }
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