Commit b52ca6c3 authored by chenzhao's avatar chenzhao

修改代码

parent 04b3f871
......@@ -52,6 +52,15 @@ public class EmergencyController extends AbstractBaseController {
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-消防水箱信息
*/
......
......@@ -58,6 +58,7 @@ public interface EmergencyMapper extends BaseMapper{
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();
......
......@@ -18,6 +18,8 @@ public interface IEmergencyService {
*/
List<Map<String, Object>> getSystemState(String bizOrgCode);
List<Map<String, Object>> getSystemAlarmCount(String bizOrgCode, String status);
/**
* @return
*/
......
......@@ -84,6 +84,27 @@ public class EmergencyServiceImpl implements IEmergencyService {
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
public List<Map<String, Object>> getCAFSWaterTankInfo() {
List<Map<String, Object>> list = emergencyMapper.getCAFSWaterTankInfo();
......
......@@ -83,6 +83,22 @@ public class SafetyPreCtrlController extends AbstractBaseController {
}
@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 = "巡检情况统计")
@RequestMapping(value = "/countMonthNew", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public HashMap<String, Object> countMonthCheckByIdNew() {
......
......@@ -79,6 +79,8 @@ public interface PointMapper extends BaseMapper {
List<HashMap<String, Object>> getSumPtForDeptNew(@Param(value = "orgCode") String loginOrgCode);
List<HashMap<String, Object>> getSumPtForAdmin(@Param(value = "orgCode") String orgCode);
Map<String, Object> countPointData(@Param(value = "orgCode") String orgCode);
long getCheckPointCount(CheckPtListPageParam param);
long getCheckPointCountNew(CheckPtListPageParam param);
......
......@@ -58,6 +58,7 @@ import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import java.beans.PropertyDescriptor;
import java.math.BigInteger;
import java.text.NumberFormat;
import java.util.*;
import java.util.stream.Collectors;
......@@ -1430,6 +1431,35 @@ public class PointServiceImpl implements IPointService {
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
public List<HashMap<String, Object>> getSumPtByRoleNew(String orgcode) {
......
......@@ -250,6 +250,7 @@ public interface IPointService {
List<HashMap<String, Object>> getSumPtByRole(HashMap<String, Object> paramMap);
Map<String, Object> countPointData(String orgCode);
List<HashMap<String, Object>> getSumPtByRoleNew(String orgCode);
/**
* 导入导入巡检点数据
......
......@@ -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,
if(ala.clean_time is null, '未消除', '已消除') AS cleanStatus,
ala.clean_time,
ala.defect_batch_id
ala.defect_batch_id,
spe.biz_org_name AS bizOrgName
from
wl_equipment_specific_alarm_log as ala
left join wl_equipment_specific as spe on spe.id = ala.equipment_specific_id
......
......@@ -36,6 +36,43 @@
`fs`.`sort`
</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
wes.id AS specificId,
......
......@@ -211,7 +211,8 @@
where fefe.fire_equipment_id = wlesal.equipment_specific_id
) as equipmentName,
wlesal.equipment_specific_name as equipmentSpecificName,
wles.position
wles.position,
wles.biz_org_name as bizOrgName
FROM wl_equipment_specific_alarm_log wlesal
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
......
......@@ -490,6 +490,59 @@
) vp
) tt group by tt.RealTimeStatus,tt.status order by status
</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 RealTimeStatus as name,status,count(1) as value
......
......@@ -33,5 +33,10 @@
"code": "risk",
"emqTopic": "emq.risk.created",
"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