Commit 8645f62d authored by KeYong's avatar KeYong

Merge branch 'develop_dl_plan6_temp' of…

Merge branch 'develop_dl_plan6_temp' of http://39.98.45.134:8090/moa/amos-boot-biz into develop_dl_plan6_temp
parents cd8710a7 1a6a52de
...@@ -21,4 +21,6 @@ public class IotDataVO { ...@@ -21,4 +21,6 @@ public class IotDataVO {
* iot数据上报唯一id * iot数据上报唯一id
*/ */
private String traceId; private String traceId;
private String createdTime;
} }
...@@ -40,23 +40,6 @@ ...@@ -40,23 +40,6 @@
'当值值长' AS name UNION '当值值长' AS name UNION
( (
SELECT SELECT
(
SELECT
count( 1 ) AS num
FROM
cb_org_usr cou
LEFT JOIN cb_dynamic_form_instance cdfi ON cou.sequence_nbr = cdfi.instance_id
WHERE
cou.biz_org_type = 'PERSON'
AND cdfi.field_code = 'peopleType'
AND field_value = '1601'
AND cou.is_delete = 0
AND cou.biz_org_code LIKE CONCAT( #{bizOrgCode}, '%' )
) AS `value`,
'驻站消防队' AS name
) UNION
(
SELECT
( SELECT COUNT( 1 ) FROM cb_organization_user cou WHERE cou.emergency_team_id = co.sequence_nbr ) AS ( SELECT COUNT( 1 ) FROM cb_organization_user cou WHERE cou.emergency_team_id = co.sequence_nbr ) AS
value value
, ,
...@@ -66,7 +49,7 @@ ...@@ -66,7 +49,7 @@
WHERE co.is_delete = 0 WHERE co.is_delete = 0
ORDER BY ORDER BY
co.sort desc co.sort desc
LIMIT 4 LIMIT 5
) )
</select> </select>
<select id="getOrganizationList" resultType="java.util.Map"> <select id="getOrganizationList" resultType="java.util.Map">
......
...@@ -10,6 +10,7 @@ import com.yeejoin.equipmanage.common.utils.*; ...@@ -10,6 +10,7 @@ import com.yeejoin.equipmanage.common.utils.*;
import com.yeejoin.equipmanage.config.PersonIdentify; import com.yeejoin.equipmanage.config.PersonIdentify;
import com.yeejoin.equipmanage.fegin.IotFeign; import com.yeejoin.equipmanage.fegin.IotFeign;
import com.yeejoin.equipmanage.mapper.FireFightingSystemMapper; import com.yeejoin.equipmanage.mapper.FireFightingSystemMapper;
import com.yeejoin.equipmanage.service.IEmergencyService;
import com.yeejoin.equipmanage.service.IEquipmentSpecificAlarmService; import com.yeejoin.equipmanage.service.IEquipmentSpecificAlarmService;
import com.yeejoin.equipmanage.service.IFireFightingSystemService; import com.yeejoin.equipmanage.service.IFireFightingSystemService;
import com.yeejoin.equipmanage.service.ISupervisionVideoService; import com.yeejoin.equipmanage.service.ISupervisionVideoService;
...@@ -23,7 +24,6 @@ import org.springframework.util.CollectionUtils; ...@@ -23,7 +24,6 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.DateTimeUtil;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
...@@ -55,6 +55,9 @@ public class SupervisionConfigureController extends AbstractBaseController { ...@@ -55,6 +55,9 @@ public class SupervisionConfigureController extends AbstractBaseController {
@Autowired @Autowired
private ISupervisionVideoService supervisionVideoService; private ISupervisionVideoService supervisionVideoService;
@Autowired
private IEmergencyService emergencyService;
@Value("${equipment.pressurepump.start}") @Value("${equipment.pressurepump.start}")
private String pressurePumpStart; private String pressurePumpStart;
...@@ -276,14 +279,14 @@ public class SupervisionConfigureController extends AbstractBaseController { ...@@ -276,14 +279,14 @@ public class SupervisionConfigureController extends AbstractBaseController {
Page<Map<String, Object>> pressurePumpInfo = fireFightingSystemMapper.getPressurePumpInfo(page, bizOrgCode, null); Page<Map<String, Object>> pressurePumpInfo = fireFightingSystemMapper.getPressurePumpInfo(page, bizOrgCode, null);
List<Long> startTimeList = new ArrayList(); List<Long> startTimeList = new ArrayList();
List<Long> stopTimeList = new ArrayList(); List<Long> stopTimeList = new ArrayList();
pressurePumpInfo.getRecords().stream().map(item -> { String prefix = null;
for (Map<String, Object> item : pressurePumpInfo.getRecords()) {
item.put("monthStartNum", 0); item.put("monthStartNum", 0);
item.put("halfHourStartNum", 0); item.put("halfHourStartNum", 0);
item.put("twoHourStartNum", 0); item.put("twoHourStartNum", 0);
item.put("fourHourStartNum", 0); item.put("fourHourStartNum", 0);
item.put("update_time", "--"); item.put("update_time", "--");
item.put("equipment_index_name", "--"); item.put("equipment_index_name", "--");
String prefix = null;
String suffix = null; String suffix = null;
String iotCode = item.get("iot_code").toString(); String iotCode = item.get("iot_code").toString();
if (iotCode.length() > 8) { if (iotCode.length() > 8) {
...@@ -385,6 +388,7 @@ public class SupervisionConfigureController extends AbstractBaseController { ...@@ -385,6 +388,7 @@ public class SupervisionConfigureController extends AbstractBaseController {
Date stopDate = null; Date stopDate = null;
if (ObjectUtils.isEmpty(item.get("start")) && ObjectUtils.isEmpty(item.get("stop"))) { if (ObjectUtils.isEmpty(item.get("start")) && ObjectUtils.isEmpty(item.get("stop"))) {
item.put("equipment_index_name", "无信号"); item.put("equipment_index_name", "无信号");
item.put("update_time", false);
} else { } else {
if (!ObjectUtils.isEmpty(item.get("start"))) { if (!ObjectUtils.isEmpty(item.get("start"))) {
startTime = item.get("start").toString().substring(0, 19).replace("T", " "); startTime = item.get("start").toString().substring(0, 19).replace("T", " ");
...@@ -404,35 +408,19 @@ public class SupervisionConfigureController extends AbstractBaseController { ...@@ -404,35 +408,19 @@ public class SupervisionConfigureController extends AbstractBaseController {
} else { } else {
item.put("stopTime", 0); item.put("stopTime", 0);
} }
if (!"0".equals(item.get("startTime"))) { if (start_time - stop_time > 0) {
if ("0".equals(item.get("stopTime"))) { long res = nowDateTime - start_time;
long res = nowDateTime - start_time; long diffMinute = res / 1000 / 60;
long diffMinute = res / 1000 / 60; if (diffMinute > 5) {
if (diffMinute > 5) { time = false;
time = false;
}
item.put("upTime", diffMinute);
item.put("equipment_index_name", "启动");
item.put("update_time", startDate);
} else {
String startOrStop = start_time - stop_time > 0 ? "start" : " stop";
if ("start".equals(startOrStop)) {
long res = nowDateTime - start_time;
long diffMinute = res / 1000 / 60;
if (diffMinute > 5) {
time = false;
}
item.put("upTime", diffMinute);
item.put("equipment_index_name", "启动");
item.put("update_time", startDate);
} else {
item.put("upTime", 0);
item.put("equipment_index_name", "停止");
item.put("update_time", stopDate);
}
} }
item.put("upTime", diffMinute);
item.put("equipment_index_name", "启动");
item.put("update_time", startDate);
} else { } else {
item.put("upTime", 0); item.put("upTime", 0);
item.put("equipment_index_name", "停止");
item.put("update_time", stopDate);
} }
} }
item.put("stateDesc", Integer.parseInt(String.valueOf(item.get("isAlarm"))) == 0 && time ? "正常" : "异常"); item.put("stateDesc", Integer.parseInt(String.valueOf(item.get("isAlarm"))) == 0 && time ? "正常" : "异常");
...@@ -441,17 +429,18 @@ public class SupervisionConfigureController extends AbstractBaseController { ...@@ -441,17 +429,18 @@ public class SupervisionConfigureController extends AbstractBaseController {
} else { } else {
item.put("sort",1); item.put("sort",1);
} }
return item; }
}).collect(Collectors.toList()); // List<Long> startCollect = startTimeList.stream().sorted(Comparator.reverseOrder()).limit(1).collect(Collectors.toList());
List<Long> startCollect = startTimeList.stream().sorted(Comparator.reverseOrder()).limit(1).collect(Collectors.toList()); // List<Long> stopCollect = stopTimeList.stream().sorted(Comparator.reverseOrder()).limit(1).collect(Collectors.toList());
List<Long> stopCollect = stopTimeList.stream().sorted(Comparator.reverseOrder()).limit(1).collect(Collectors.toList()); // long res = 0L;
long res = 0L; // if (startCollect.size() > 0 && stopCollect.size() > 0) {
if (startCollect.size() > 0 && stopCollect.size() > 0) { // res = Math.abs(startCollect.get(0) - stopCollect.get(0));
res = Math.abs(startCollect.get(0) - stopCollect.get(0)); // }
} // long diffMinute = 0L;
long diffMinute = 0L; // diffMinute = res / 1000 / 60;
diffMinute = res / 1000 / 60; // long finalDiffMinute = diffMinute;
long finalDiffMinute = diffMinute;
double finalDiffMinute = emergencyService.getPressurePumpIntervalTime(prefix, getAppKey(), getProduct(), getToken());
pressurePumpInfo.getRecords().stream( pressurePumpInfo.getRecords().stream(
).map(item -> { ).map(item -> {
item.put("startAndStopInterval", finalDiffMinute); item.put("startAndStopInterval", finalDiffMinute);
......
...@@ -58,5 +58,7 @@ public interface IEmergencyService { ...@@ -58,5 +58,7 @@ public interface IEmergencyService {
List<Map<String, Object>> getPressurePumpDiagnosticAnalysis(String equipmentCode, String nameKeys, String fieldKey, String bizOrgCode, String appKey, String product, String token); List<Map<String, Object>> getPressurePumpDiagnosticAnalysis(String equipmentCode, String nameKeys, String fieldKey, String bizOrgCode, String appKey, String product, String token);
double getPressurePumpIntervalTime(String prefix, String appKey, String product, String token);
Page<Map<String, Object>> alarmList(Page<Map<String, Object>> page,String bizOrgCode, List<String> types, List<String> emergencyLevels, String name, Integer cleanStatus, Integer handleStatus); Page<Map<String, Object>> alarmList(Page<Map<String, Object>> page,String bizOrgCode, List<String> types, List<String> emergencyLevels, String name, Integer cleanStatus, Integer handleStatus);
} }
package com.yeejoin.equipmanage.service;
import com.yeejoin.equipmanage.common.vo.IotDataVO;
import java.util.List;
import java.util.Map;
/**
* @author GaoJianqiang
* @date 2023/02/15 16:20
*/
public interface IPressurePumpService {
/**
* redis缓存物联采集数据,内部读取JSON配置指定有效期
* @param message
* @param iotDatalist
*/
void saveDataToRedis(List<IotDataVO> iotDatalist);
/**
* 根据key,模糊查询所有的redis缓存数据
* @param key
* @return
*/
List<IotDataVO> getDataToRedis(String key);
/**
* 获取指标配置JSON信息集合
* @return
*/
List<Map> getNameKeyInfoList();
}
...@@ -393,16 +393,14 @@ public class EmergencyServiceImpl implements IEmergencyService { ...@@ -393,16 +393,14 @@ public class EmergencyServiceImpl implements IEmergencyService {
String value = intervalDataList.get(0).get(pressurePumpStart); String value = intervalDataList.get(0).get(pressurePumpStart);
List<Map<String, String>> falseDataList = intervalDataList.stream().filter(x -> x.containsKey("createdTime") && "false".equalsIgnoreCase(x.get(pressurePumpStart))).collect(Collectors.toList()); List<Map<String, String>> falseDataList = intervalDataList.stream().filter(x -> x.containsKey("createdTime") && "false".equalsIgnoreCase(x.get(pressurePumpStart))).collect(Collectors.toList());
List<Map<String, String>> trueDataList = intervalDataList.stream().filter(x -> x.containsKey("createdTime") && "true".equalsIgnoreCase(x.get(pressurePumpStart))).collect(Collectors.toList()); List<Map<String, String>> trueDataList = intervalDataList.stream().filter(x -> x.containsKey("createdTime") && "true".equalsIgnoreCase(x.get(pressurePumpStart))).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(falseDataList) && !CollectionUtils.isEmpty(trueDataList)) { if (!CollectionUtils.isEmpty(trueDataList)) {
intervalTime1 = falseDataList.get(0).get("createdTime");
intervalTime2 = trueDataList.get(0).get("createdTime"); intervalTime2 = trueDataList.get(0).get("createdTime");
} }
if ("true".equalsIgnoreCase(value)) { if ("true".equalsIgnoreCase(value)) {
if (!CollectionUtils.isEmpty(trueDataList)) {
durationTime = intervalTime2;
}
if (!CollectionUtils.isEmpty(falseDataList)) { if (!CollectionUtils.isEmpty(falseDataList)) {
try { try {
durationTime = intervalTime2;
intervalTime1 = falseDataList.get(0).get("createdTime");
String stop5BeforeTime = DateUtils.convertDateToString(DateUtils.dateAddMinutes(DateUtils.convertStrToDate(intervalTime1, "yyyy-MM-dd HH:mm:ss"), -5), "yyyy-MM-dd HH:mm:ss"); String stop5BeforeTime = DateUtils.convertDateToString(DateUtils.dateAddMinutes(DateUtils.convertStrToDate(intervalTime1, "yyyy-MM-dd HH:mm:ss"), -5), "yyyy-MM-dd HH:mm:ss");
ResponseModel pipeResponseModel = iotFeign.selectListNew(appKey, product, token, prefix, null, stop5BeforeTime, intervalTime2, null, "FHS_PipePressureDetector_PipePressure"); ResponseModel pipeResponseModel = iotFeign.selectListNew(appKey, product, token, prefix, null, stop5BeforeTime, intervalTime2, null, "FHS_PipePressureDetector_PipePressure");
if (200 == pipeResponseModel.getStatus()) { if (200 == pipeResponseModel.getStatus()) {
...@@ -423,6 +421,10 @@ public class EmergencyServiceImpl implements IEmergencyService { ...@@ -423,6 +421,10 @@ public class EmergencyServiceImpl implements IEmergencyService {
if (!CollectionUtils.isEmpty(falseDataList) && !CollectionUtils.isEmpty(trueDataList)) { if (!CollectionUtils.isEmpty(falseDataList) && !CollectionUtils.isEmpty(trueDataList)) {
durationTime = trueDataList.get(0).get("createdTime"); durationTime = trueDataList.get(0).get("createdTime");
nowStrLong = falseDataList.get(0).get("createdTime"); nowStrLong = falseDataList.get(0).get("createdTime");
// 获取最接近最新启动信号,且时间大于启动信号的停止信号时间值
String finalIntervalTime = intervalTime2;
List<Map<String, String>> timeList = falseDataList.stream().filter(x -> DateUtils.getDurationSecconds(finalIntervalTime, x.get("createdTime"), "yyyy-MM-dd HH:mm:ss") >= 0).collect(Collectors.toList());
intervalTime1 = timeList.get(timeList.size() - 1).get("createdTime");
} }
} }
} }
...@@ -457,6 +459,41 @@ public class EmergencyServiceImpl implements IEmergencyService { ...@@ -457,6 +459,41 @@ public class EmergencyServiceImpl implements IEmergencyService {
} }
@Override @Override
public double getPressurePumpIntervalTime(String prefix, String appKey, String product, String token) {
Map<String, Object> map = new HashMap<>();
ResponseModel intervalResponseModel = iotFeign.topSingleField(appKey, product, token, "100", prefix, null, null, pressurePumpStart);
String nowStrLong = DateUtils.getNowStrLong();
String intervalTime1 = nowStrLong;
String intervalTime2 = nowStrLong;
if (200 == intervalResponseModel.getStatus()) {
String json = JSON.toJSONString(intervalResponseModel.getResult());
List<Map<String, String>> intervalDataList = (List<Map<String, String>>) JSONArray.parse(json);
if (!CollectionUtils.isEmpty(intervalDataList)) {
String value = intervalDataList.get(0).get(pressurePumpStart);
List<Map<String, String>> falseDataList = intervalDataList.stream().filter(x -> x.containsKey("createdTime") && "false".equalsIgnoreCase(x.get(pressurePumpStart))).collect(Collectors.toList());
List<Map<String, String>> trueDataList = intervalDataList.stream().filter(x -> x.containsKey("createdTime") && "true".equalsIgnoreCase(x.get(pressurePumpStart))).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(trueDataList)) {
intervalTime2 = trueDataList.get(0).get("createdTime");
}
if ("true".equalsIgnoreCase(value)) {
if (!CollectionUtils.isEmpty(falseDataList)) {
intervalTime1 = falseDataList.get(0).get("createdTime");
}
} else {
if (!CollectionUtils.isEmpty(falseDataList) && !CollectionUtils.isEmpty(trueDataList)) {
nowStrLong = falseDataList.get(0).get("createdTime");
// 获取最接近最新启动信号,且时间大于启动信号的停止信号时间值
String finalIntervalTime = intervalTime2;
List<Map<String, String>> timeList = falseDataList.stream().filter(x -> DateUtils.getDurationSecconds(finalIntervalTime, x.get("createdTime"), "yyyy-MM-dd HH:mm:ss") >= 0).collect(Collectors.toList());
intervalTime1 = timeList.get(timeList.size() - 1).get("createdTime");
}
}
}
}
return Math.ceil((double) Math.abs(DateUtils.getDurationSecconds(intervalTime1, intervalTime2, "yyyy-MM-dd HH:mm:ss")) / 60);
}
@Override
public Page<Map<String, Object>> alarmList(Page<Map<String, Object>> page,String bizOrgCode, List<String> types, List<String> emergencyLevels, String name, Integer cleanStatus, Integer handleStatus) { public Page<Map<String, Object>> alarmList(Page<Map<String, Object>> page,String bizOrgCode, List<String> types, List<String> emergencyLevels, String name, Integer cleanStatus, Integer handleStatus) {
return emergencyMapper.alarmList(page, bizOrgCode, types, emergencyLevels, name, cleanStatus, handleStatus); return emergencyMapper.alarmList(page, bizOrgCode, types, emergencyLevels, name, cleanStatus, handleStatus);
} }
......
...@@ -193,6 +193,9 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -193,6 +193,9 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
@Autowired @Autowired
private IEquipmentService equipmentService; private IEquipmentService equipmentService;
@Autowired
private IPressurePumpService pressurePumpService;
@Value("${equipManage.name}") @Value("${equipManage.name}")
private String serverName; private String serverName;
...@@ -313,6 +316,9 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -313,6 +316,9 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
log.info(String.format("发送eqm转kafka消息失败:%s", e.getMessage())); log.info(String.format("发送eqm转kafka消息失败:%s", e.getMessage()));
} }
// redis缓存指定指标、指定时长物联数据
pressurePumpService.saveDataToRedis(iotDatalist);
if (!StringUtils.isEmpty(traceId)) { if (!StringUtils.isEmpty(traceId)) {
String finalTraceId = traceId; String finalTraceId = traceId;
List<IotDataVO> collect = iotDatalist.stream().map(x -> { List<IotDataVO> collect = iotDatalist.stream().map(x -> {
......
package com.yeejoin.equipmanage.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.equipmanage.common.vo.IotDataVO;
import com.yeejoin.equipmanage.service.IPressurePumpService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
@Slf4j
@Service
public class PressurePumpServiceImpl implements IPressurePumpService {
@Autowired
private RedisUtils redisUtils;
@Value("classpath:/json/nameKeyInfo.json")
private Resource nameKeyInfo;
// 稳压泵标识
private static final String PRESSURE_PUMP = "PressurePump";
@Override
@Async
public void saveDataToRedis(List<IotDataVO> iotDatalist) {
// 获取配置JSON信息集合
List<Map> infoList = getNameKeyInfoList();
if (CollectionUtils.isNotEmpty(infoList)) {
// 过滤出稳压泵标识的信息集合
List<Map> pumpInfoList = infoList.stream().filter(x -> PRESSURE_PUMP.equals(x.get("code"))).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(pumpInfoList)) {
Map map = pumpInfoList.get(0);
String nameKey = map.get("nameKey").toString();
int expire = Integer.parseInt(map.get("expire").toString());
String nowString = DateUtils.getDateNowString();
long timeMillis = System.currentTimeMillis();
for (IotDataVO vo : iotDatalist) {
String key = vo.getKey();
if (nameKey.contains(vo.getKey())) {
vo.setCreatedTime(nowString);
redisUtils.set(String.join(":", PRESSURE_PUMP, key, String.valueOf(timeMillis)), JSONObject.toJSONString(vo), expire);
}
List<IotDataVO> dataToRedis = getDataToRedis(key);
}
}
}
}
@Override
public List<IotDataVO> getDataToRedis(String key) {
List<IotDataVO> list = new ArrayList<>();
Set<String> keys = redisUtils.getKeys(String.join(":", PRESSURE_PUMP, key));
if (CollectionUtils.isNotEmpty(keys)) {
keys.forEach(x -> {
list.add(JSON.parseObject(redisUtils.get(x).toString(), IotDataVO.class));
});
// 时间倒序排序
list.sort((t1, t2) -> t2.getCreatedTime().compareTo(t1.getCreatedTime()));
}
return list;
}
@Override
public List<Map> getNameKeyInfoList() {
String json = null;
try {
json = IOUtils.toString(nameKeyInfo.getInputStream(), java.lang.String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) {
log.error("获取指标JSON配置信息失败:{}", e.getMessage());
}
return JSONObject.parseArray(json, Map.class);
}
}
...@@ -9,6 +9,8 @@ import java.util.Date; ...@@ -9,6 +9,8 @@ import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.xml.transform.Result; import javax.xml.transform.Result;
...@@ -19,7 +21,11 @@ import javax.xml.transform.TransformerFactory; ...@@ -19,7 +21,11 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource; import javax.xml.transform.stream.StreamSource;
import com.yeejoin.amos.patrol.business.service.intfc.*;
import com.yeejoin.amos.patrol.business.util.*;
import com.yeejoin.amos.patrol.core.async.TaskExecutorPoolConfig;
import com.yeejoin.amos.patrol.core.enums.QueryOperatorEnum; import com.yeejoin.amos.patrol.core.enums.QueryOperatorEnum;
import com.yeejoin.amos.patrol.feign.RemoteSecurityService;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -42,18 +48,6 @@ import com.yeejoin.amos.patrol.business.dto.CheckDto; ...@@ -42,18 +48,6 @@ import com.yeejoin.amos.patrol.business.dto.CheckDto;
import com.yeejoin.amos.patrol.business.param.CheckInfoPageParam; import com.yeejoin.amos.patrol.business.param.CheckInfoPageParam;
import com.yeejoin.amos.patrol.business.param.CheckRecordParam; import com.yeejoin.amos.patrol.business.param.CheckRecordParam;
import com.yeejoin.amos.patrol.business.param.CheckStatisticalParam; import com.yeejoin.amos.patrol.business.param.CheckStatisticalParam;
import com.yeejoin.amos.patrol.business.service.intfc.ICheckService;
import com.yeejoin.amos.patrol.business.service.intfc.IPlanTaskService;
import com.yeejoin.amos.patrol.business.service.intfc.IPointService;
import com.yeejoin.amos.patrol.business.service.intfc.ISafety3DDataSendService;
import com.yeejoin.amos.patrol.business.util.CheckPageParamUtil;
import com.yeejoin.amos.patrol.business.util.CheckParamUtil;
import com.yeejoin.amos.patrol.business.util.CommonResponse;
import com.yeejoin.amos.patrol.business.util.CommonResponseUtil;
import com.yeejoin.amos.patrol.business.util.DaoCriteria;
import com.yeejoin.amos.patrol.business.util.FileHelper;
import com.yeejoin.amos.patrol.business.util.Toke;
import com.yeejoin.amos.patrol.business.util.ToolUtils;
import com.yeejoin.amos.patrol.business.vo.CheckAnalysisVo; import com.yeejoin.amos.patrol.business.vo.CheckAnalysisVo;
import com.yeejoin.amos.patrol.business.vo.CheckInfoVo; import com.yeejoin.amos.patrol.business.vo.CheckInfoVo;
import com.yeejoin.amos.patrol.common.enums.PlanTaskFinishStatusEnum; import com.yeejoin.amos.patrol.common.enums.PlanTaskFinishStatusEnum;
...@@ -62,6 +56,8 @@ import com.yeejoin.amos.patrol.core.common.request.CommonPageable; ...@@ -62,6 +56,8 @@ import com.yeejoin.amos.patrol.core.common.request.CommonPageable;
import com.yeejoin.amos.patrol.core.common.request.CommonRequest; import com.yeejoin.amos.patrol.core.common.request.CommonRequest;
import com.yeejoin.amos.patrol.core.common.response.AppPointCheckRespone; import com.yeejoin.amos.patrol.core.common.response.AppPointCheckRespone;
import com.yeejoin.amos.patrol.core.common.response.GraphInitDataResponse; import com.yeejoin.amos.patrol.core.common.response.GraphInitDataResponse;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import com.yeejoin.amos.patrol.core.util.DateUtil; import com.yeejoin.amos.patrol.core.util.DateUtil;
import com.yeejoin.amos.patrol.core.util.StringUtil; import com.yeejoin.amos.patrol.core.util.StringUtil;
...@@ -93,6 +89,12 @@ public class CheckController extends AbstractBaseController { ...@@ -93,6 +89,12 @@ public class CheckController extends AbstractBaseController {
@Autowired @Autowired
private ISafety3DDataSendService is; private ISafety3DDataSendService is;
@Autowired
private RemoteSecurityService remoteSecurityService;
@Autowired
private IMessageService messageService;
@Value("${windows.img.path}") @Value("${windows.img.path}")
private String winImgPath; private String winImgPath;
...@@ -240,7 +242,21 @@ public class CheckController extends AbstractBaseController { ...@@ -240,7 +242,21 @@ public class CheckController extends AbstractBaseController {
CheckDto checkDto = checkService.saveCheckRecordNew(requestParam,token); CheckDto checkDto = checkService.saveCheckRecordNew(requestParam,token);
if(StringUtil.isNotEmpty(checkDto)){ if(StringUtil.isNotEmpty(checkDto)){
asyncTaskf(checkDto.getCheckId());
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
CompletableFuture<Void> getAddressTask = CompletableFuture.runAsync(() -> {
// 解决异步任务拿不到ThreadLocal里的数据
RequestContextHolder.setRequestAttributes(requestAttributes);
// asyncTaskf(checkDto.getCheckId());
try {
asyncTask.pushCheckInfoTo3D(checkDto.getCheckId());
} catch (InterruptedException e) {
e.printStackTrace();
}
Toke toke= remoteSecurityService.getServerToken();
messageService.pushCheckMessage(toke.getToke(),toke.getProduct(),toke.getAppKey(),checkDto.getCheckId());
});
} }
is.pointCheckInfoPushToB(checkDto.getCheckId()); is.pointCheckInfoPushToB(checkDto.getCheckId());
//数字换流站页面刷新 //数字换流站页面刷新
......
package com.yeejoin.amos.patrol.business.controller;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.patrol.business.service.intfc.IPlanTaskService;
import com.yeejoin.amos.patrol.business.util.CommonResponse;
import com.yeejoin.amos.patrol.business.util.CommonResponseUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import javax.annotation.Resource;
@RestController
@RequestMapping("/api/controlScreen")
@Api(value = "管控屏API", tags = "管控屏API")
public class ControlScreenController extends AbstractBaseController {
@Resource
private IPlanTaskService iPlanTaskService;
@GetMapping("/firePatrolStatics")
@ApiOperation(value = "消防巡检信息统计")
@TycloudOperation(ApiLevel = UserType.AGENCY)
public CommonResponse firePatrolStatics(@RequestParam(required = false) String bizOrgCode) {
if (StringUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
bizOrgCode = reginParams.getPersonIdentity().getCompanyBizOrgCode();
}
return CommonResponseUtil.success(iPlanTaskService.firePatrolStatics(bizOrgCode));
}
}
...@@ -191,4 +191,11 @@ public interface PlanTaskMapper extends BaseMapper { ...@@ -191,4 +191,11 @@ public interface PlanTaskMapper extends BaseMapper {
List<Plan> getPlanIdsByDate(@Param("date") Date date); List<Plan> getPlanIdsByDate(@Param("date") Date date);
List<PlanTask> getPlanTaskList(@Param("date") Date date); List<PlanTask> getPlanTaskList(@Param("date") Date date);
/**
* 消防巡检信息统计
* @param bizOrgCode 业务公司编码
* @return 消防巡检信息统计
*/
List<Map<String, Object>> firePatrolStatics(@Param("bizOrgCode") String bizOrgCode);
} }
...@@ -28,11 +28,11 @@ public class FeignBasicAuthRequestInterceptor implements RequestInterceptor { ...@@ -28,11 +28,11 @@ public class FeignBasicAuthRequestInterceptor implements RequestInterceptor {
token = request.getHeader("X-Access-Token"); token = request.getHeader("X-Access-Token");
} }
String product = request.getHeader("product"); template.header("X-Access-Token", token);
String appKey = request.getHeader("appKey");
template.header("token", token); template.header("token", token);
template.header("product", product); template.header("appKey", request.getHeader("appKey"));
template.header("appKey", appKey); template.header("product", request.getHeader("product"));
template.header("clientType", "feignClient");
} }
} }
...@@ -107,6 +107,8 @@ public class CheckInfoPageParam extends CommonPageable{ ...@@ -107,6 +107,8 @@ public class CheckInfoPageParam extends CommonPageable{
private String searchDay; private String searchDay;
private String isExecute;
......
...@@ -1811,4 +1811,9 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -1811,4 +1811,9 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
} }
return result; return result;
} }
@Override
public List<Map<String, Object>> firePatrolStatics(String bizOrgCode) {
return planTaskMapper.firePatrolStatics(bizOrgCode);
}
} }
...@@ -178,4 +178,11 @@ public interface IPlanTaskService { ...@@ -178,4 +178,11 @@ public interface IPlanTaskService {
List<Map<String,Object>> queryPlanTaskTimeAxis(Long userId,Integer createDate); List<Map<String,Object>> queryPlanTaskTimeAxis(Long userId,Integer createDate);
List<Map<String,Object>> queryTimeAxis(Long userId,Integer createDate); List<Map<String,Object>> queryTimeAxis(Long userId,Integer createDate);
/**
* 消防巡检信息统计
* @param bizOrgCode 业务公司编码
* @return 消防巡检信息统计
*/
List<Map<String,Object>> firePatrolStatics(String bizOrgCode);
} }
[
{
"name": "稳压泵",
"code": "PressurePump",
"nameKey": "FHS_PressurePump_Start",
"expire": 14400
}
]
\ No newline at end of file
...@@ -122,6 +122,7 @@ ...@@ -122,6 +122,7 @@
END) ELSE wesi.value_label END FROM wl_equipment_specific_index wesi END) ELSE wesi.value_label END FROM wl_equipment_specific_index wesi
LEFT JOIN wl_equipment_index wei on wesi.equipment_index_id = wei.id LEFT JOIN wl_equipment_index wei on wesi.equipment_index_id = wei.id
WHERE wesi.equipment_specific_id = temp.id AND wei.is_trend = 0 WHERE wesi.equipment_specific_id = temp.id AND wei.is_trend = 0
AND wesi.value is NOT NULL AND wesi.value <![CDATA[<>]]> ''
ORDER BY wesi.update_date desc LIMIT 1),'--') AS status, ORDER BY wesi.update_date desc LIMIT 1),'--') AS status,
'0' AS flow '0' AS flow
FROM( FROM(
...@@ -973,7 +974,7 @@ ...@@ -973,7 +974,7 @@
<select id="getSystemAndCarCount" resultType="java.util.Map"> <select id="getSystemAndCarCount" resultType="java.util.Map">
SELECT SELECT
(SELECT count(*) FROM f_fire_fighting_system) fireSystem, (SELECT count(*) FROM f_fire_fighting_system fs where fs.system_type_code <![CDATA[<>]]> 'otherSys') fireSystem,
(SELECT count(*) FROM wl_car) fireCar (SELECT count(*) FROM wl_car) fireCar
</select> </select>
<select id="getEquipExpiryStatistics" resultType="java.util.Map"> <select id="getEquipExpiryStatistics" resultType="java.util.Map">
......
...@@ -114,6 +114,7 @@ ...@@ -114,6 +114,7 @@
'%Y-%m-%d' '%Y-%m-%d'
) = curdate() ) = curdate()
</if> </if>
<if test="isExecute!=null and isExecute!='' and isExecute = '3'">and a.is_OK != #{isExecute}</if>
</trim> </trim>
</select> </select>
...@@ -323,6 +324,7 @@ ...@@ -323,6 +324,7 @@
'%Y-%m-%d' '%Y-%m-%d'
) = curdate() ) = curdate()
</if> </if>
<if test="isExecute!=null and isExecute!='' and isExecute = 3">and a.is_OK != #{isExecute}</if>
</trim> </trim>
order by ${orderBy} order by ${orderBy}
<choose> <choose>
......
...@@ -1126,4 +1126,52 @@ ...@@ -1126,4 +1126,52 @@
and finish_status in (0,1) and finish_status in (0,1)
and status = 0 and status = 0
</select> </select>
<select id="firePatrolStatics" resultType="java.util.Map">
SELECT
ifnull( sum( `p_plan_task`.`point_num` ), 0 ) AS `value`,
'个' AS unit,
'今日应巡查点' AS `name`,
'currentDayTotal' AS `indexKey`,
'xfxc' AS type,
'1' AS `key`
FROM
`p_plan_task`
WHERE
DATE_FORMAT( check_date, '%Y-%m-%d' ) = CURRENT_DATE ()
<if test="bizOrgCode != null and bizOrgCode != ''">
AND org_code LIKE CONCAT(#{bizOrgCode}, '%')
</if>
UNION ALL
SELECT
ifnull( sum( `p_plan_task`.`point_num` ), 0 ) AS `value`,
'个' AS unit,
'今日漏查点位' AS `name`,
'currentDayMiss' AS `indexKey`,
'xfxc' AS type,
'2' AS `key`
FROM
`p_plan_task`
WHERE
`finish_status` = 3
AND DATE_FORMAT( check_date, '%Y-%m-%d' ) = CURRENT_DATE ()
<if test="bizOrgCode != null and bizOrgCode != ''">
AND org_code LIKE CONCAT(#{bizOrgCode}, '%')
</if>
UNION ALL
SELECT
ifnull( sum( `p_plan_task`.`finish_num` ), 0 ) AS `value`,
'个' AS unit,
'今日已巡查点' AS `name`,
'currentDayPass' AS `indexKey`,
'xfxc' AS type,
'3' AS `key`
FROM
`p_plan_task`
WHERE
DATE_FORMAT( check_date, '%Y-%m-%d' ) = CURRENT_DATE ()
<if test="bizOrgCode != null and bizOrgCode != ''">
AND org_code LIKE CONCAT(#{bizOrgCode}, '%')
</if>
</select>
</mapper> </mapper>
\ No newline at end of file
#注册中心地址 #注册中心地址
eureka.client.service-url.defaultZone =http://172.16.11.201:10001/eureka/ eureka.client.service-url.defaultZone =http://172.16.10.215:10001/eureka/
eureka.instance.prefer-ip-address=true eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=* management.endpoints.web.exposure.include=*
...@@ -14,6 +14,7 @@ spring.kafka.bootstrap-servers=172.16.3.100:9092 ...@@ -14,6 +14,7 @@ spring.kafka.bootstrap-servers=172.16.3.100:9092
# 生产者配置 # 生产者配置
# 设置大于0的值,则客户端会将发送失败的记录重新发送 # 重试次数 # 设置大于0的值,则客户端会将发送失败的记录重新发送 # 重试次数
spring.kafka.producer.retries=1 spring.kafka.producer.retries=1
spring.kafka.producer.bootstrap-servers=172.16.10.215:9092
#16K #16K
spring.kafka.producer.batch-size=16384 spring.kafka.producer.batch-size=16384
spring.kafka.producer.buffer-memory=33554432 spring.kafka.producer.buffer-memory=33554432
...@@ -41,6 +42,7 @@ spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.Str ...@@ -41,6 +42,7 @@ spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.Str
# latest:重置为分区中最新的offset(消费分区中新产生的数据) # latest:重置为分区中最新的offset(消费分区中新产生的数据)
# none:只要有一个分区不存在已提交的offset,就抛出异常 # none:只要有一个分区不存在已提交的offset,就抛出异常
spring.kafka.consumer.group-id=zhTestGroup spring.kafka.consumer.group-id=zhTestGroup
spring.kafka.consumer.bootstrap-servers=172.16.10.215:9092
spring.kafka.consumer.enable-auto-commit=false spring.kafka.consumer.enable-auto-commit=false
# 当各分区下有已提交的offset时,从提交的offset开始消费;无提交的offset时,从头开始消费 # 当各分区下有已提交的offset时,从提交的offset开始消费;无提交的offset时,从头开始消费
# # 自动提交的频率 单位 ms # # 自动提交的频率 单位 ms
...@@ -72,7 +74,7 @@ management.health.redis.enabled=false ...@@ -72,7 +74,7 @@ management.health.redis.enabled=false
## emqx ## emqx
emqx.clean-session=true emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]} emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.11.201:1883 emqx.broker=tcp://172.16.10.215:1883
emqx.client-user-name=admin emqx.client-user-name=admin
emqx.client-password=public emqx.client-password=public
emqx.max-inflight=1000 emqx.max-inflight=1000
...@@ -81,7 +83,7 @@ emqx.max-inflight=1000 ...@@ -81,7 +83,7 @@ emqx.max-inflight=1000
# 下面个配置默认站端 中心级系统的时候注释掉上边 放开下边 # 下面个配置默认站端 中心级系统的时候注释掉上边 放开下边
#站端配置 #站端配置
#需要监听得kafka消息主题 根据是否是中心极和站端选择需要监听得主题进行配置 #需要监听得kafka消息主题 根据是否是中心极和站端选择需要监听得主题进行配置
kafka.topics=null.topic kafka.topics=null
#需要监听得eqm消息主题 根据是否是中心极和站端选择需要监听得主题进行配置 emq.iot.created, #需要监听得eqm消息主题 根据是否是中心极和站端选择需要监听得主题进行配置 emq.iot.created,
emq.topic=emq.xf.created,emq.iot.created,emq.patrol.created,emq.sign.created,emq.bussSign.created,emq.user.created emq.topic=emq.xf.created,emq.iot.created,emq.patrol.created,emq.sign.created,emq.bussSign.created,emq.user.created
......
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