Commit 42a577ae authored by 吴江's avatar 吴江

Merge branch 'dev_upgrade' of http://172.16.10.76/station/YeeAmosFireAutoSysRoot into dev_upgrade

parents 15db6f25 bc956768
...@@ -7,6 +7,7 @@ public class SafetyExecuteBo { ...@@ -7,6 +7,7 @@ public class SafetyExecuteBo {
private String label; private String label;
private String pointId; private String pointId;
private String type; private String type;
private String status;//指标状态
private String changeDate; private String changeDate;
public Long getId() { public Long getId() {
return id; return id;
...@@ -44,4 +45,10 @@ public class SafetyExecuteBo { ...@@ -44,4 +45,10 @@ public class SafetyExecuteBo {
public void setChangeDate(String changeDate) { public void setChangeDate(String changeDate) {
this.changeDate = changeDate; this.changeDate = changeDate;
} }
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
} }
...@@ -100,7 +100,7 @@ public class FireEquimtPointController extends BaseController { ...@@ -100,7 +100,7 @@ public class FireEquimtPointController extends BaseController {
@ApiParam(value = "监测点编号或者监测点名称模糊匹配") @RequestParam(required = false) String searchValue, @ApiParam(value = "监测点编号或者监测点名称模糊匹配") @RequestParam(required = false) String searchValue,
@ApiParam(value = "类型(模拟量:ANALOGUE;开关量:SWITCH)") @RequestParam(required = false) String type) { @ApiParam(value = "类型(模拟量:ANALOGUE;开关量:SWITCH)") @RequestParam(required = false) String type) {
Map<String, Object> queryMap = Maps.newHashMap(); Map<String, Object> queryMap = Maps.newHashMap();
queryMap.put("pageNumber", pageNumber); queryMap.put("offset", pageNumber*pageSize);
queryMap.put("pageSize", pageSize); queryMap.put("pageSize", pageSize);
if (isBindDevice != null && isBindDevice == 0) { if (isBindDevice != null && isBindDevice == 0) {
queryMap.put("fireEquipmentId", 0); queryMap.put("fireEquipmentId", 0);
......
...@@ -12,6 +12,8 @@ import com.yeejoin.amos.fas.core.util.CommonResponseUtil; ...@@ -12,6 +12,8 @@ import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import io.swagger.annotations.Authorization;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
......
...@@ -74,6 +74,14 @@ public interface View3dMapper extends BaseMapper{ ...@@ -74,6 +74,14 @@ public interface View3dMapper extends BaseMapper{
*/ */
List<CheckErrorBo> getAllErrorPatrolPoint(Map<String, Object> params); List<CheckErrorBo> getAllErrorPatrolPoint(Map<String, Object> params);
/**
* 今日安全指数故障告警详情
* @param params orgCode,date
* @return list
*/
List<CheckErrorBo> getAllFaultAlarm(Map<String, Object> params);
/** /**
* 今日巡检统计接口 * 今日巡检统计接口
* @param orgCode * @param orgCode
...@@ -96,6 +104,20 @@ public interface View3dMapper extends BaseMapper{ ...@@ -96,6 +104,20 @@ public interface View3dMapper extends BaseMapper{
List<SafetyExecuteBo> getCheckErrorTop5(String orgCode); List<SafetyExecuteBo> getCheckErrorTop5(String orgCode);
/** /**
* 火灾告警最新5条
* @param orgCode
* @return
*/
List<SafetyExecuteBo> getFireAlarmTop5(String orgCode);
/**
* 设备状态最新5条
* @param orgCode
* @return
*/
List<SafetyExecuteBo> getEquipStatusTop5(String orgCode);
/**
* 按照类型查询点 * 按照类型查询点
* @param params {orgCode,type} * @param params {orgCode,type}
* @return 列表 * @return 列表
......
...@@ -307,8 +307,7 @@ public class View3dServiceImpl implements IView3dService { ...@@ -307,8 +307,7 @@ public class View3dServiceImpl implements IView3dService {
Long checkExceptionNum = this.getCheckExceptionNum(orgCode,date); Long checkExceptionNum = this.getCheckExceptionNum(orgCode,date);
vo.setCheckExceptionNum(checkExceptionNum); vo.setCheckExceptionNum(checkExceptionNum);
//4.统计故障数量-日期+机构 //4.统计故障数量-日期+机构
//TODO:待毛颖确认调整完成后继续 vo.setFireExceptionNum(getFireExceptionNum(orgCode,date));
vo.setFireExceptionNum(0L);
} else { } else {
throw new YeeException("机构:"+orgCode+" 不存在"); throw new YeeException("机构:"+orgCode+" 不存在");
} }
...@@ -350,6 +349,15 @@ public class View3dServiceImpl implements IView3dService { ...@@ -350,6 +349,15 @@ public class View3dServiceImpl implements IView3dService {
}); });
} else if(StatisticsErrorTypeEum.equip.getCode().equals(type)){ } else if(StatisticsErrorTypeEum.equip.getCode().equals(type)){
//TODO:待毛颖确认调整完成后继续 //TODO:待毛颖确认调整完成后继续
List<CheckErrorBo> checkErrorBoList = view3dMapper.getAllFaultAlarm(params);
Map<String,List<CheckErrorBo>> map = checkErrorBoList.stream().collect(Collectors.groupingBy(CheckErrorBo::getStatus));
map.forEach((k,v)->{
SafetyIndexDetailVo safetyIndexDetailVo = new SafetyIndexDetailVo();
safetyIndexDetailVo.setTypeCode(k);
safetyIndexDetailVo.setTypeName(k);
safetyIndexDetailVo.setContent(getErrorContentVos(v));
resultList.add(safetyIndexDetailVo);
});
} }
return resultList; return resultList;
} }
...@@ -411,9 +419,8 @@ public class View3dServiceImpl implements IView3dService { ...@@ -411,9 +419,8 @@ public class View3dServiceImpl implements IView3dService {
if (optional.isPresent()) { if (optional.isPresent()) {
List<RiskSource> regionList = iRiskSourceDao.findByParentIdAndIsRegion(optional.get().getId(),RiskSourceRegionEum.TRUE.getCode()); List<RiskSource> regionList = iRiskSourceDao.findByParentIdAndIsRegion(optional.get().getId(),RiskSourceRegionEum.TRUE.getCode());
exceptionList = regionList.stream().filter(riskSource -> { exceptionList = regionList.stream().filter(riskSource -> {
//TODO:待毛颖确认,增加判断故障的规则(统计数据:故障或者rpn上升) BigDecimal rpn = riskSource.getRpn() == null ? new BigDecimal("0") : riskSource.getRpn();
BigDecimal rpnBig = riskSource.getRpn() == null ? new BigDecimal("0") : riskSource.getRpn(); return rpn.subtract(riskSource.getRpni()).doubleValue() > 0;
return rpnBig.subtract(riskSource.getRpni()).doubleValue() > 0;
}).map(riskSource -> { }).map(riskSource -> {
ExceptionRegionVo regionVo = new ExceptionRegionVo(); ExceptionRegionVo regionVo = new ExceptionRegionVo();
regionVo.setId(riskSource.getId()); regionVo.setId(riskSource.getId());
...@@ -421,7 +428,8 @@ public class View3dServiceImpl implements IView3dService { ...@@ -421,7 +428,8 @@ public class View3dServiceImpl implements IView3dService {
regionVo.setUe4Rotation(getInitJSONArray(riskSource.getUe4Rotation())); regionVo.setUe4Rotation(getInitJSONArray(riskSource.getUe4Rotation()));
regionVo.setUe4Extent(getInitJSONArray(riskSource.getUe4Extent())); regionVo.setUe4Extent(getInitJSONArray(riskSource.getUe4Extent()));
regionVo.setSafetyIndex(changeRpnToSafetyIndex(riskSource.getRpn())); regionVo.setSafetyIndex(changeRpnToSafetyIndex(riskSource.getRpn()));
regionVo.setBreakdown(isBreakDown(riskSource.getId())); regionVo.setBreakdown(isBreakDown(riskSource.getId()));//待后期去掉,前端图标显示统一不在细分
regionVo.setRoutePath(this.changeStringToJson(riskSource.getRoutePath()));
return regionVo; return regionVo;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
...@@ -436,8 +444,15 @@ public class View3dServiceImpl implements IView3dService { ...@@ -436,8 +444,15 @@ public class View3dServiceImpl implements IView3dService {
} }
} }
private JSONObject changeStringToJson(String str){
if(StringUtil.isNotEmpty(str)){
return JSON.parseObject(str);
}else {
return new JSONObject();
}
}
private Boolean isBreakDown(Long id){ private Boolean isBreakDown(Long id){
//TODO:判断是否故障,待毛颖确认
return true; return true;
} }
...@@ -471,23 +486,24 @@ public class View3dServiceImpl implements IView3dService { ...@@ -471,23 +486,24 @@ public class View3dServiceImpl implements IView3dService {
case "check"://巡检异常 case "check"://巡检异常
return view3dMapper.getCheckErrorTop5(orgCode); return view3dMapper.getCheckErrorTop5(orgCode);
case "fire": case "fire":
return JSON.parseArray(" [\r\n" + return view3dMapper.getFireAlarmTop5(orgCode);
" {\r\n" + // return JSON.parseArray(" [\r\n" +
" \"id\": 35781,\r\n" + // " {\r\n" +
" \"code\": \"s001\",\r\n" + // " \"id\": 35781,\r\n" +
" \"label\": \"设备test\",\r\n" + // " \"code\": \"s001\",\r\n" +
" \"pointId\": \"1\",\r\n" + // " \"label\": \"设备test\",\r\n" +
" \"type\": \"check\",\r\n" + // " \"pointId\": \"1\",\r\n" +
" \"changeDate\": \"2020-04-23 14:31:31\"\r\n" + // " \"type\": \"check\",\r\n" +
" },\r\n" + // " \"changeDate\": \"2020-04-23 14:31:31\"\r\n" +
" {\r\n" + // " },\r\n" +
" \"id\": 35780,\r\n" + // " {\r\n" +
" \"code\": \"s002\",\r\n" + // " \"id\": 35780,\r\n" +
" \"label\": \"设备002\",\r\n" + // " \"code\": \"s002\",\r\n" +
" \"pointId\": \"23123\",\r\n" + // " \"label\": \"设备002\",\r\n" +
" \"type\": \"check\",\r\n" + // " \"pointId\": \"23123\",\r\n" +
" \"changeDate\": \"2020-04-23 14:31:27\"\r\n" + // " \"type\": \"check\",\r\n" +
" }]", SafetyExecuteBo.class); // " \"changeDate\": \"2020-04-23 14:31:27\"\r\n" +
// " }]", SafetyExecuteBo.class);
default: default:
throw new YeeException("不支持的类型 -->"+ type); throw new YeeException("不支持的类型 -->"+ type);
} }
...@@ -503,9 +519,10 @@ public class View3dServiceImpl implements IView3dService { ...@@ -503,9 +519,10 @@ public class View3dServiceImpl implements IView3dService {
} }
@Override @Override
public Object getEquipStatusList(String orgCode) { public List<SafetyExecuteBo> getEquipStatusList(String orgCode) {
return JSON.parseArray("[{\"id\":1,\"label\":\"设备1 label\",\"changeDate\":\"2020-04-26 10:00:00\"}" return view3dMapper.getEquipStatusTop5(orgCode);
+ ",{\"id\":2,\"label\":\"设备2 label\",\"changeDate\":\"2020-04-25 10:00:00\"}]"); // return JSON.parseArray("[{\"id\":1,\"label\":\"设备1 label\",\"changeDate\":\"2020-04-26 10:00:00\"}"
// + ",{\"id\":2,\"label\":\"设备2 label\",\"changeDate\":\"2020-04-25 10:00:00\"}]");
} }
@Override @Override
......
...@@ -112,7 +112,7 @@ public interface IView3dService { ...@@ -112,7 +112,7 @@ public interface IView3dService {
* @param orgCode * @param orgCode
* @return * @return
*/ */
Object getEquipStatusList(String orgCode); List<SafetyExecuteBo> getEquipStatusList(String orgCode);
/** /**
* 左侧菜单(异常点) * 左侧菜单(异常点)
......
package com.yeejoin.amos.fas.business.vo; package com.yeejoin.amos.fas.business.vo;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import springfox.documentation.spring.web.json.Json;
/** /**
* @author suhg * @author suhg
*/ */
...@@ -32,6 +36,11 @@ public class ExceptionRegionVo { ...@@ -32,6 +36,11 @@ public class ExceptionRegionVo {
*/ */
private JSONArray ue4Extent; private JSONArray ue4Extent;
/**
* 自研3维区域参数
*/
private JSONObject routePath;
public Long getId() { public Long getId() {
return id; return id;
} }
...@@ -68,6 +77,14 @@ public class ExceptionRegionVo { ...@@ -68,6 +77,14 @@ public class ExceptionRegionVo {
return ue4Extent; return ue4Extent;
} }
public JSONObject getRoutePath() {
return routePath;
}
public void setRoutePath(JSONObject routePath) {
this.routePath = routePath;
}
public void setUe4Extent(JSONArray ue4Extent) { public void setUe4Extent(JSONArray ue4Extent) {
this.ue4Extent = ue4Extent; this.ue4Extent = ue4Extent;
} }
......
...@@ -62,14 +62,15 @@ public class StringUtil { ...@@ -62,14 +62,15 @@ public class StringUtil {
*/ */
public static boolean isNumeric(String str) { public static boolean isNumeric(String str) {
// 该正则表达式可以匹配所有的数字 包括负数 // 该正则表达式可以匹配所有的数字 包括负数
Pattern pattern = Pattern.compile("-?[0-9]+(\\.[0-9]+)?");
String bigStr; String bigStr;
try { try {
bigStr = new BigDecimal(str).toString(); bigStr = new BigDecimal(str).toString();
} catch (Exception e) { } catch (Exception e) {
return false;// 异常 说明包含非数字。 return false;//异常 说明包含非数字。
} }
Matcher isNum = numericPattern.matcher(bigStr); // matcher是全匹配 Matcher isNum = pattern.matcher(bigStr); // matcher是全匹配
if (!isNum.matches()) { if (!isNum.matches()) {
return false; return false;
} }
......
...@@ -152,8 +152,8 @@ ...@@ -152,8 +152,8 @@
</if> </if>
</where> </where>
order by a.create_date desc order by a.create_date desc
<if test="pageSize!=null and pageSize!=-1 and pageNumber!=null"> <if test="pageSize!=null and pageSize!=-1 and offset!=null">
limit #{pageNumber},#{pageSize} limit #{offset},#{pageSize}
</if> </if>
</select> </select>
......
...@@ -609,7 +609,8 @@ ...@@ -609,7 +609,8 @@
wr.max_level, wr.max_level,
wr.area, wr.area,
ep.CODE, ep.CODE,
wr.`name` wr.`name`,
ep.value
FROM FROM
f_fire_equipment_point ep f_fire_equipment_point ep
INNER JOIN f_water_resource_equipment wre ON wre.fire_equipment_id = ep.fire_equipment_id AND ep.type = 'ANALOGUE' INNER JOIN f_water_resource_equipment wre ON wre.fire_equipment_id = ep.fire_equipment_id AND ep.type = 'ANALOGUE'
......
...@@ -438,7 +438,15 @@ ...@@ -438,7 +438,15 @@
</select> </select>
<select id="countFireException" resultType="long"> <select id="countFireException" resultType="long">
SELECT
count(1)
FROM
f_alarm a
WHERE
`status` = TRUE
AND org_code = #{orgCode}
AND type = 'alarm_type_trouble'
AND date_format(a.update_date, '%Y-%m-%d') = #{date}
</select> </select>
<select id="getAllErrorRiskPoint" resultType="com.yeejoin.amos.fas.business.bo.RiskPointRpnChangeBo" > <select id="getAllErrorRiskPoint" resultType="com.yeejoin.amos.fas.business.bo.RiskPointRpnChangeBo" >
...@@ -473,6 +481,23 @@ ...@@ -473,6 +481,23 @@
and a.org_code = #{orgCode} and a.org_code = #{orgCode}
</select> </select>
<select id="getAllFaultAlarm" resultType="com.yeejoin.amos.fas.business.bo.CheckErrorBo">
SELECT
a.id,
a.fire_equipment_point_name as `name`,
fe.equip_type as status,
a.update_date as changeDate
FROM
f_alarm a
LEFT JOIN f_fire_equipment fe ON fe.id = a.fire_equipment_id
WHERE
`status` = TRUE
AND type = 'alarm_type_trouble'
AND a.org_code = #{orgCode}
AND date_format(a.update_date, '%Y-%m-%d') =#{date}
</select>
<select id="getStatisticsCheck" resultType="java.util.HashMap"> <select id="getStatisticsCheck" resultType="java.util.HashMap">
<![CDATA[ <![CDATA[
SELECT d.status as type, count(1) as value SELECT d.status as type, count(1) as value
...@@ -503,11 +528,42 @@ ...@@ -503,11 +528,42 @@
left join p_point I ON I.id = p.point_id left join p_point I ON I.id = p.point_id
where p.is_ok IN ('2', '3') where p.is_ok IN ('2', '3')
AND I.is_delete = 0 AND I.is_delete = 0
AND p.org_code = #{org_code} or p.org_code like CONCAT(#{orgCode},'-','%') AND p.org_code = #{orgCode} or p.org_code like CONCAT(#{orgCode},'-','%')
ORDER BY p.check_time desc ORDER BY p.check_time desc
limit 0,5 limit 0,5
</select> </select>
<select id="getFireAlarmTop5" resultType="com.yeejoin.amos.fas.business.bo.SafetyExecuteBo">
SELECT
a.fire_equipment_id id,
a.fire_equipment_code code,
a.fire_equipment_point_name as `label`,
a.update_date as changeDate,
"monitorEquipment" type
FROM
f_alarm a
WHERE
a.org_code = #{orgCode}
AND a.`status` = TRUE
AND a.type = 'alarm_type_fire'
ORDER BY a.update_date DESC
limit 0,5
</select>
<select id="getEquipStatusTop5" resultType="com.yeejoin.amos.fas.business.bo.SafetyExecuteBo">
SELECT
fed.id,
fed.eq_point_name label,
fed.e_value status,
fed.create_date changeDate
FROM
f_fire_equipment_data fed
WHERE
fed.org_code = #{orgCode}
ORDER BY fed.create_date DESC
limit 0,5
</select>
<select id="getPintsByType" resultType="hashmap"> <select id="getPintsByType" resultType="hashmap">
select CONCAT(type,'-',id) as `key`,sp.* from select CONCAT(type,'-',id) as `key`,sp.* from
(select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'riskSource' as type,org_code as orgCode, (select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'riskSource' as type,org_code as orgCode,
......
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