Commit 359d290c authored by KeYong's avatar KeYong

Merge branch 'develop_dl' of http://39.98.45.134:8090/moa/amos-boot-biz into develop_dl

parents 35e3e6f3 b52ca6c3
...@@ -52,6 +52,15 @@ public class EmergencyController extends AbstractBaseController { ...@@ -52,6 +52,15 @@ public class EmergencyController extends AbstractBaseController {
return CommonResponseUtil.success(iEmergencyService.getSystemState(bizOrgCode)); return CommonResponseUtil.success(iEmergencyService.getSystemState(bizOrgCode));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("系统告警统计")
@GetMapping(value = "/system/alarm")
public ResponseModel getSystemAlarmCount(@RequestParam(required = false) String status) {
ReginParams reginParams = getSelectedOrgInfo();
String bizOrgCode = reginParams.getPersonIdentity().getBizOrgCode();
return CommonResponseUtil.success(iEmergencyService.getSystemAlarmCount(bizOrgCode,status));
}
/** /**
* CAFS-消防水箱信息 * CAFS-消防水箱信息
*/ */
......
...@@ -58,6 +58,7 @@ public interface EmergencyMapper extends BaseMapper{ ...@@ -58,6 +58,7 @@ public interface EmergencyMapper extends BaseMapper{
List<Map<String, Object>> getSystemState(@Param("bizOrgCode") String bizOrgCode); List<Map<String, Object>> getSystemState(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> getSystemAlarmCount(@Param("bizOrgCode") String bizOrgCode,@Param("status") String status);
List<Map<String, Object>> getCAFSWaterTankInfo(); List<Map<String, Object>> getCAFSWaterTankInfo();
......
...@@ -18,6 +18,8 @@ public interface IEmergencyService { ...@@ -18,6 +18,8 @@ public interface IEmergencyService {
*/ */
List<Map<String, Object>> getSystemState(String bizOrgCode); List<Map<String, Object>> getSystemState(String bizOrgCode);
List<Map<String, Object>> getSystemAlarmCount(String bizOrgCode, String status);
/** /**
* @return * @return
*/ */
......
...@@ -84,6 +84,27 @@ public class EmergencyServiceImpl implements IEmergencyService { ...@@ -84,6 +84,27 @@ public class EmergencyServiceImpl implements IEmergencyService {
return list; return list;
} }
@Override
public List<Map<String, Object>> getSystemAlarmCount(String bizOrgCode, String status) {
List<Map<String, Object>> list = emergencyMapper.getSystemAlarmCount(bizOrgCode,status);
if (0 < list.size()) {
list.forEach(x -> {
List<Map<String, Object>> list1 = new ArrayList();
Map<String, Object> map = new HashMap<>();
map.put("name", x.get("status"));
if ("正常".equals(String.valueOf(x.get("status")))) {
map.put("level", "success");
} else {
map.put("level", "warning");
}
list1.add(map);
x.put("status", list1);
});
}
return list;
}
@Override @Override
public List<Map<String, Object>> getCAFSWaterTankInfo() { public List<Map<String, Object>> getCAFSWaterTankInfo() {
List<Map<String, Object>> list = emergencyMapper.getCAFSWaterTankInfo(); List<Map<String, Object>> list = emergencyMapper.getCAFSWaterTankInfo();
......
...@@ -83,6 +83,22 @@ public class SafetyPreCtrlController extends AbstractBaseController { ...@@ -83,6 +83,22 @@ public class SafetyPreCtrlController extends AbstractBaseController {
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "巡检点统计", notes = "巡检点统计")
@RequestMapping(value = "/countPointData", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public HashMap<String, Object> countPointData() {
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = reginParams.getPersonIdentity().getCompanyBizOrgCode();
Map<String,Object> List= pointService.countPointData(loginOrgCode);
HashMap<String, Object> temph = new HashMap<>();
temph.put("result",List);
temph.put("status",200);
temph.put("message","");
return temph;
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "巡检情况统计", notes = "巡检情况统计") @ApiOperation(value = "巡检情况统计", notes = "巡检情况统计")
@RequestMapping(value = "/countMonthNew", produces = "application/json;charset=UTF-8", method = RequestMethod.GET) @RequestMapping(value = "/countMonthNew", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public HashMap<String, Object> countMonthCheckByIdNew() { public HashMap<String, Object> countMonthCheckByIdNew() {
......
...@@ -79,6 +79,8 @@ public interface PointMapper extends BaseMapper { ...@@ -79,6 +79,8 @@ public interface PointMapper extends BaseMapper {
List<HashMap<String, Object>> getSumPtForDeptNew(@Param(value = "orgCode") String loginOrgCode); List<HashMap<String, Object>> getSumPtForDeptNew(@Param(value = "orgCode") String loginOrgCode);
List<HashMap<String, Object>> getSumPtForAdmin(@Param(value = "orgCode") String orgCode); List<HashMap<String, Object>> getSumPtForAdmin(@Param(value = "orgCode") String orgCode);
Map<String, Object> countPointData(@Param(value = "orgCode") String orgCode);
long getCheckPointCount(CheckPtListPageParam param); long getCheckPointCount(CheckPtListPageParam param);
long getCheckPointCountNew(CheckPtListPageParam param); long getCheckPointCountNew(CheckPtListPageParam param);
......
...@@ -58,6 +58,7 @@ import javax.persistence.criteria.Predicate; ...@@ -58,6 +58,7 @@ import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root; import javax.persistence.criteria.Root;
import java.beans.PropertyDescriptor; import java.beans.PropertyDescriptor;
import java.math.BigInteger; import java.math.BigInteger;
import java.text.NumberFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -1430,6 +1431,35 @@ public class PointServiceImpl implements IPointService { ...@@ -1430,6 +1431,35 @@ public class PointServiceImpl implements IPointService {
return rContent; return rContent;
} }
@Override
public Map<String, Object> countPointData(String orgCode) {
Map<String, Object> maps = pointMapper.countPointData(orgCode);
int over_num = Integer.parseInt(maps.get("over_num").toString());
int today_num = Integer.parseInt(maps.get("today_num").toString());
int miss_num = Integer.parseInt(maps.get("miss_num").toString());
String passRate = "";
if (over_num == 0) {
passRate = 0+"";
}else {
passRate = getPercent(over_num, today_num);
}
today_num = miss_num+today_num;
String passMiss = getPercent(miss_num, today_num);
maps.put("passRate",passRate);
maps.put("passMiss",passMiss);
return maps;
}
public String getPercent(int x, int y) {
double d1 = x * 1.0;
double d2 = y * 1.0;
NumberFormat percentInstance = NumberFormat.getPercentInstance();
// 设置保留几位小数,这里设置的是保留两位小数
percentInstance.setMinimumFractionDigits(2);
return percentInstance.format(d1 / d2);
}
@Override @Override
public List<HashMap<String, Object>> getSumPtByRoleNew(String orgcode) { public List<HashMap<String, Object>> getSumPtByRoleNew(String orgcode) {
......
...@@ -250,6 +250,7 @@ public interface IPointService { ...@@ -250,6 +250,7 @@ public interface IPointService {
List<HashMap<String, Object>> getSumPtByRole(HashMap<String, Object> paramMap); List<HashMap<String, Object>> getSumPtByRole(HashMap<String, Object> paramMap);
Map<String, Object> countPointData(String orgCode);
List<HashMap<String, Object>> getSumPtByRoleNew(String orgCode); List<HashMap<String, Object>> getSumPtByRoleNew(String orgCode);
/** /**
* 导入导入巡检点数据 * 导入导入巡检点数据
......
...@@ -52,7 +52,8 @@ ...@@ -52,7 +52,8 @@
(SELECT GROUP_CONCAT(fem.name) FROM `f_fire_fighting_system` fem WHERE find_in_set(fem.id,spe.system_id)) as systemName, (SELECT GROUP_CONCAT(fem.name) FROM `f_fire_fighting_system` fem WHERE find_in_set(fem.id,spe.system_id)) as systemName,
if(ala.clean_time is null, '未消除', '已消除') AS cleanStatus, if(ala.clean_time is null, '未消除', '已消除') AS cleanStatus,
ala.clean_time, ala.clean_time,
ala.defect_batch_id ala.defect_batch_id,
spe.biz_org_name AS bizOrgName
from from
wl_equipment_specific_alarm_log as ala wl_equipment_specific_alarm_log as ala
left join wl_equipment_specific as spe on spe.id = ala.equipment_specific_id left join wl_equipment_specific as spe on spe.id = ala.equipment_specific_id
......
...@@ -36,6 +36,43 @@ ...@@ -36,6 +36,43 @@
`fs`.`sort` `fs`.`sort`
</select> </select>
<select id="getSystemAlarmCount" resultType="Map">
SELECT * FROM
(SELECT
`fs`.`id` AS `key`,
`fs`.`name` AS `name`,
`fs`.system_type_code AS systemTypeCode,
`fs`.`code` AS code,
( select count(*) FROM (select id FROM wl_equipment_specific_alarm_log WHERE system_codes = fs.code and clean_time is null GROUP BY equipment_specific_id) b) as alarmNum ,
IF
(((
SELECT
count( `wesa`.`equipment_specific_id` )
FROM
`wl_equipment_specific_alarm` `wesa`
WHERE
( 0 <![CDATA[<>]]> find_in_set( `fs`.`id`, `wesa`.`system_ids` ) AND `wesa`.`status` = 1)) > 0),
'异常',
'正常'
) AS `status`
FROM
`f_fire_fighting_system` `fs`
where
fs.system_type_code IS NOT NULL AND LENGTH(TRIM(fs.system_type_code)) > 0 AND fs.system_type_code != 'otherSys'
AND fs.biz_org_code like concat('LSHLZ1yOrS3WfXqzjn', '%')
GROUP BY
`fs`.`id`
ORDER BY
`fs`.`sort`) sys
<where>
<if test="status != null and status != ''">
sys.status = #{status}
</if>
</where>
</select>
<select id="getCAFSWaterTankInfo" resultType="Map"> <select id="getCAFSWaterTankInfo" resultType="Map">
SELECT SELECT
wes.id AS specificId, wes.id AS specificId,
......
...@@ -211,7 +211,8 @@ ...@@ -211,7 +211,8 @@
where fefe.fire_equipment_id = wlesal.equipment_specific_id where fefe.fire_equipment_id = wlesal.equipment_specific_id
) as equipmentName, ) as equipmentName,
wlesal.equipment_specific_name as equipmentSpecificName, wlesal.equipment_specific_name as equipmentSpecificName,
wles.position wles.position,
wles.biz_org_name as bizOrgName
FROM wl_equipment_specific_alarm_log wlesal FROM wl_equipment_specific_alarm_log wlesal
LEFT JOIN wl_equipment_specific wles ON wlesal.equipment_specific_id = wles.id LEFT JOIN wl_equipment_specific wles ON wlesal.equipment_specific_id = wles.id
LEFT JOIN wl_equipment_detail wled ON wles.equipment_detail_id = wled.id LEFT JOIN wl_equipment_detail wled ON wles.equipment_detail_id = wled.id
......
...@@ -5137,7 +5137,7 @@ ...@@ -5137,7 +5137,7 @@
( (
max( CASE WHEN fi.field_name = 'maxLevel' THEN fi.field_value END ) = '' max( CASE WHEN fi.field_name = 'maxLevel' THEN fi.field_value END ) = ''
OR max( CASE WHEN fi.field_name = 'maxLevel' THEN fi.field_value END ) IS NULL, OR max( CASE WHEN fi.field_name = 'maxLevel' THEN fi.field_value END ) IS NULL,
0, 1000,
max( CASE WHEN fi.field_name = 'maxLevel' THEN fi.field_value END )) AS maxValues max( CASE WHEN fi.field_name = 'maxLevel' THEN fi.field_value END )) AS maxValues
FROM FROM
wl_form_instance_equip fi wl_form_instance_equip fi
...@@ -5158,7 +5158,7 @@ ...@@ -5158,7 +5158,7 @@
max( CASE WHEN fi.field_name = 'maxPressure' THEN fi.field_value END ) = '' max( CASE WHEN fi.field_name = 'maxPressure' THEN fi.field_value END ) = ''
OR max( CASE WHEN fi.field_name = 'maxPressure' THEN fi.field_value END ) IS NULL OR max( CASE WHEN fi.field_name = 'maxPressure' THEN fi.field_value END ) IS NULL
OR max( CASE WHEN fi.field_name = 'maxPressure' THEN fi.field_value END ) = 'null', OR max( CASE WHEN fi.field_name = 'maxPressure' THEN fi.field_value END ) = 'null',
0, 1000,
max( CASE WHEN fi.field_name = 'maxPressure' THEN fi.field_value END )) AS maxValues max( CASE WHEN fi.field_name = 'maxPressure' THEN fi.field_value END )) AS maxValues
FROM FROM
wl_form_instance_equip fi wl_form_instance_equip fi
......
...@@ -212,7 +212,7 @@ ...@@ -212,7 +212,7 @@
a.id, a.id,
a.org_code, a.org_code,
a.point_id pointId, a.point_id pointId,
b.name point_name, a.point_name,
b.is_fixed, b.is_fixed,
b.point_no pointNo, b.point_no pointNo,
a.user_id, a.user_id,
...@@ -249,7 +249,7 @@ ...@@ -249,7 +249,7 @@
END END
) as is_ok, ) as is_ok,
a.score, a.score,
d.`name` AS `route_name`, a.`route_name`,
( (
CASE CASE
WHEN a.check_mode = 'QR' WHEN a.check_mode = 'QR'
...@@ -288,19 +288,19 @@ ...@@ -288,19 +288,19 @@
<if test="beginDate!=null and beginDate!= ''">and a.check_time >= #{beginDate} </if> <if test="beginDate!=null and beginDate!= ''">and a.check_time >= #{beginDate} </if>
<if test="endDate!=null and endDate!= ''">and #{endDate} >= a.check_time</if> <if test="endDate!=null and endDate!= ''">and #{endDate} >= a.check_time</if>
<!-- <if test="endDate!=null"> and #{endDate} <![CDATA[>=]]> a.check_time </if> --> <!-- <if test="endDate!=null"> and #{endDate} <![CDATA[>=]]> a.check_time </if> -->
<if test="userName!=null">and a.user_name like concat(concat("%",#{userName}),"%")</if> <if test="userName!=null and userName!=''">and a.user_name like concat(concat("%",#{userName}),"%")</if>
<if test="pointName!=null">and b.name like concat(concat("%",#{pointName}),"%")</if> <if test="pointName!=null and pointName!= ''">and b.name like concat(concat("%",#{pointName}),"%")</if>
<if test="pointNo!=null">and b.point_no like concat('%',#{pointNo},'%')</if> <if test="pointNo!=null and pointNo!=''">and b.point_no like concat('%',#{pointNo},'%')</if>
<if test="isFixed!=null">and b.is_fixed = #{isFixed}</if> <if test="isFixed!=null and isFixed!=''">and b.is_fixed = #{isFixed}</if>
<if test="isOK!=null and isOK!=''">and a.is_OK = #{isOK}</if> <if test="isOK!=null and isOK!=''">and a.is_OK = #{isOK}</if>
<if test="planId!=null">and a.plan_Id = #{planId}</if> <if test="planId!=null and planId!='' ">and a.plan_Id = #{planId}</if>
<if test="planTaskId!=null">and a.plan_task_id = #{planTaskId}</if> <if test="planTaskId!=null and planTaskId!=''">and a.plan_task_id = #{planTaskId}</if>
<if test="userId!=null">and find_in_set(#{userId}, a.user_id) > 0</if> <if test="userId!=null and userId!=''">and find_in_set(#{userId}, a.user_id) > 0</if>
<if test="routeId!=null">and a.route_Id = #{routeId}</if> <if test="routeId!=null and routeId!=''">and a.route_Id = #{routeId}</if>
<if test="catalogId!=null">and b.Catalog_Id = #{catalogId}</if> <if test="catalogId!=null and catalogId!=''">and b.Catalog_Id = #{catalogId}</if>
<if test="orgCode!=null">and (a.org_Code like concat (#{orgCode},"-%")or a.org_Code= #{orgCode})</if> <if test="orgCode!=null and orgCode!=''">and (a.org_Code like concat (#{orgCode},"-%")or a.org_Code= #{orgCode})</if>
<if test="pointId!=null">and a.point_id = #{pointId}</if> <if test="pointId!=null and pointId!=''">and a.point_id = #{pointId}</if>
<if test="checkTime!=null">and TO_DAYS(a.check_time) = TO_DAYS('${checkTime}')</if> <if test="checkTime!=null and checkTime!=''">and TO_DAYS(a.check_time) = TO_DAYS('${checkTime}')</if>
<if test="departmentId!=null and departmentId!='-1'"> and find_in_set(#{departmentId}, a.dep_id) > 0</if> <if test="departmentId!=null and departmentId!='-1'"> and find_in_set(#{departmentId}, a.dep_id) > 0</if>
<if test="checkType == '计划检查'">and a.plan_task_id &gt; 0</if> <if test="checkType == '计划检查'">and a.plan_task_id &gt; 0</if>
<if test="checkType == '无计划检查'">and a.plan_task_id &lt;= 0</if> <if test="checkType == '无计划检查'">and a.plan_task_id &lt;= 0</if>
......
...@@ -490,6 +490,59 @@ ...@@ -490,6 +490,59 @@
) vp ) vp
) tt group by tt.RealTimeStatus,tt.status order by status ) tt group by tt.RealTimeStatus,tt.status order by status
</select> </select>
<select id="countPointData" resultType="java.util.HashMap">
SELECT
(
SELECT
IFNULL( count( * ), 0 )
FROM
`p_check`
WHERE
check_time LIKE CONCAT( DATE_FORMAT( now( ), '%Y-%m-%d' ), '%' )
<if test="orgCode!=null">
and (org_code LIKE CONCAT('%',#{orgCode},'%' ))
</if>
AND is_ok = 1
) AS `over_num`,
(
SELECT
IFNULL( count( * ), 0 )
FROM
`p_check`
WHERE
check_time LIKE CONCAT( DATE_FORMAT( now( ), '%Y-%m-%d' ), '%' )
<if test="orgCode!=null">
and (org_code LIKE CONCAT('%',#{orgCode},'%' ))
</if>
AND is_ok = 2
) AS `unfinish_num`,
(
SELECT
IFNULL( count( * ), 0 )
FROM
`p_check`
WHERE
check_time LIKE CONCAT( DATE_FORMAT( now( ), '%Y-%m-%d' ), '%' )
<if test="orgCode!=null">
and (org_code LIKE CONCAT('%',#{orgCode},'%' ))
</if>
AND is_ok = 3
) AS `miss_num`,
(
SELECT
IFNULL( count( * ), 0 )
FROM
`p_check`
WHERE
check_time LIKE CONCAT( DATE_FORMAT( now( ), '%Y-%m-%d' ), '%' )
AND is_ok != 3
<if test="orgCode!=null">
and (org_code LIKE CONCAT('%',#{orgCode},'%' ))
</if>
) AS `today_num`
</select>
<!-- 巡检点统计 --> <!-- 巡检点统计 -->
<select id="getSumPtForDept" resultType="java.util.HashMap"> <select id="getSumPtForDept" resultType="java.util.HashMap">
SELECT RealTimeStatus as name,status,count(1) as value SELECT RealTimeStatus as name,status,count(1) as value
......
...@@ -33,5 +33,10 @@ ...@@ -33,5 +33,10 @@
"code": "risk", "code": "risk",
"emqTopic": "emq.risk.created", "emqTopic": "emq.risk.created",
"akkaTopic": "JKXT2BP-RISK-Topic" "akkaTopic": "JKXT2BP-RISK-Topic"
},
{
"code": "patrol",
"emqTopic": "emq.patrol.created",
"akkaTopic": "JKXT2BP-RISK-Topic"
} }
] ]
\ 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