Commit 27808e9a authored by maoying's avatar maoying

解决冲突

parents 6ac375ae a3a90362
# 电力3.7+版本及中心级系统开发分支
电力3.7+版本及中心级系统开发分支develop_dl_plan6_temp
------2023-02-02-----------------------
------2023-02-02-17:31合并-----------------------
电力总部系统;旧巡检功能现场版本,次版本对应现场韶山数字1.0;兼容数字化2.0非双月报功能(对应平台1.7.14版本)
------2023-02-03-17:31合并-----------------------
电力总部系统;旧巡检功能现场版本,次版本对应现场韶山数字1.0;兼容数字化2.0非双月报功能(对应平台1.7.14版本)
......@@ -57,11 +57,17 @@ public enum PressurePumpEnum {
this.tips = tips;
}
public static List<PressurePumpEnum> getEnumListByCode(String code) {
public static List<PressurePumpEnum> getEnumListByCode(String value) {
List<PressurePumpEnum> list = new ArrayList<>();
for(PressurePumpEnum e : PressurePumpEnum.values()) {
if (e.getCode().startsWith(code)) {
list.add(e);
if (value.equals("false")) {
if (e.getCode().startsWith("FHS_PressurePump_Stop")) {
list.add(e);
}
} else {
if (e.getCode().startsWith("FHS_PressurePump_Start")) {
list.add(e);
}
}
}
return list;
......
......@@ -7,6 +7,9 @@ import java.text.DateFormat;
import java.text.ParseException;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
/**
......@@ -86,7 +89,19 @@ public class DateUtils {
}
return returnValue;
}
/**
* 将字符换转换为日期
* @param date
* @param pattern
* @return
* @throws ParseException
*/
public static Date convertStrToDate(String date, String pattern) throws ParseException {
SimpleDateFormat formatter = new SimpleDateFormat(pattern);
return formatter.parse(date);
}
/**
* 获取当前时间任意
* @return
......@@ -1015,6 +1030,115 @@ public class DateUtils {
return now;
}
public static List<String> getTimeStrListByStartAndEnd(String startTime, String endTime, String pattern) {
try {
List<String> list = new ArrayList<>();
Date startDate = convertStrToDate(startTime, DATE_TIME_PATTERN);
Date endDate = convertStrToDate(endTime, DATE_TIME_PATTERN);
list.add(convertDateToString(startDate, pattern));
Date date = startDate;
while (true) {
date = dateAddMinutes(date, 1);
if (dateCompare(endDate, date) == 1) {
list.add(convertDateToString(date, pattern));
} else {
list.add(convertDateToString(endDate, pattern));
break;
}
}
return list;
} catch (ParseException e) {
throw new RuntimeException(e);
}
}
/**
* 获取两个时间段之间的秒数
*
* @param startTime 开始时间
* @param endTime 结束时间
* @param pattern 时间格式
* @return 秒数
*/
public static Long getDurationSecconds(String startTime, String endTime, String pattern) {
final LocalDateTime start = LocalDateTime.parse(startTime, DateTimeFormatter.ofPattern(pattern));
final LocalDateTime end = LocalDateTime.parse(endTime, DateTimeFormatter.ofPattern(pattern));
return Duration.between(start, end).getSeconds();
}
/**
* 获取两个时间段之间的秒数
*
* @param startTime 开始时间
* @param endTime 结束时间
* @param pattern 时间格式
* @return 秒数
*/
public static Long getDurationSecconds(Date startTime, Date endTime, String pattern) {
final SimpleDateFormat sdf = new SimpleDateFormat(pattern);
final LocalDateTime start = LocalDateTime.parse(sdf.format(startTime), DateTimeFormatter.ofPattern(pattern));
final LocalDateTime end = LocalDateTime.parse(sdf.format(endTime), DateTimeFormatter.ofPattern(pattern));
return Duration.between(start, end).getSeconds();
}
/**
* 获取两个时间段之间的分钟数
*
* @param startTime 开始时间
* @param endTime 结束时间
* @param pattern 时间格式
* @return 分钟数
*/
public static Long getDurationMinutes(String startTime, String endTime, String pattern) {
final LocalDateTime start = LocalDateTime.parse(startTime, DateTimeFormatter.ofPattern(pattern));
final LocalDateTime end = LocalDateTime.parse(endTime, DateTimeFormatter.ofPattern(pattern));
return Duration.between(start, end).toMinutes();
}
/**
* 获取两个时间段之间的分钟数
*
* @param startTime 开始时间
* @param endTime 结束时间
* @param pattern 时间格式
* @return 分钟数
*/
public static Long getDurationMinutes(Date startTime, Date endTime, String pattern) {
final SimpleDateFormat sdf = new SimpleDateFormat(pattern);
final LocalDateTime start = LocalDateTime.parse(sdf.format(startTime), DateTimeFormatter.ofPattern(pattern));
final LocalDateTime end = LocalDateTime.parse(sdf.format(endTime), DateTimeFormatter.ofPattern(pattern));
return Duration.between(start, end).toMinutes();
}
/**
* 获取两个时间段之间的小时数
*
* @param startTime 开始时间
* @param endTime 结束时间
* @param pattern 时间格式
* @return 小时
*/
public static Long getDurationHours(String startTime, String endTime, String pattern) {
final LocalDateTime start = LocalDateTime.parse(startTime, DateTimeFormatter.ofPattern(pattern));
final LocalDateTime end = LocalDateTime.parse(endTime, DateTimeFormatter.ofPattern(pattern));
return Duration.between(start, end).toHours();
}
/**
* 获取两个时间段之间的小时数
*
* @param startTime 开始时间
* @param endTime 结束时间
* @param pattern 时间格式
* @return 小时
*/
public static Long getDurationHours(Date startTime, Date endTime, String pattern) {
final SimpleDateFormat sdf = new SimpleDateFormat(pattern);
final LocalDateTime start = LocalDateTime.parse(sdf.format(startTime), DateTimeFormatter.ofPattern(pattern));
final LocalDateTime end = LocalDateTime.parse(sdf.format(endTime), DateTimeFormatter.ofPattern(pattern));
return Duration.between(start, end).toHours();
}
public static Date getBeginDayOfWeek() {
Date date = new Date();
if (date == null) {
......
......@@ -52,8 +52,6 @@ public class BigScreenController extends AbstractBaseController {
@Value("${equipment.pressurepump.start}")
private String pressurePumpStart;
@Value("${equipment.pressurepump.stop}")
private String pressurePumpStop;
@GetMapping(value = "/list")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "系统、消防水池、工业水池、水源总容积、消防车辆(接口弃用)", notes = "系统、消防水池、工业水池、水源总容积、消防车辆")
......@@ -116,8 +114,8 @@ public class BigScreenController extends AbstractBaseController {
ResponseModel entity1 = null;
ResponseModel entity2 = null;
try {
entity1 = iotFeign.selectList(getAppKey(), getProduct(), getToken(), startDateStr, nowStrLong, prefix, suffix, pressurePumpStart);
entity2 = iotFeign.selectList(getAppKey(), getProduct(), getToken(), startDateStr, nowStrLong, prefix, suffix, pressurePumpStop);
entity1 = iotFeign.selectListNew(getAppKey(), getProduct(), getToken(),iotCode, startDateStr, nowStrLong, "true", pressurePumpStart);
entity2 = iotFeign.selectListNew(getAppKey(), getProduct(), getToken(),iotCode, startDateStr, nowStrLong, "false", pressurePumpStart);
} catch (Exception e) {
e.printStackTrace();
}
......@@ -127,7 +125,7 @@ public class BigScreenController extends AbstractBaseController {
String json2 = JSON.toJSONString(entity2.getResult());
List<Map<String, String>> listObject2 = (List<Map<String, String>>) JSONArray.parse(json2);
listObject1.addAll(listObject2);
List<Map<String, String>> collect = listObject1.stream().filter(t -> (t.containsKey(pressurePumpStart) && t.get(pressurePumpStart).equals("true")) || (t.containsKey(pressurePumpStop) && t.get(pressurePumpStop).equals("true"))).collect(Collectors.toList());
List<Map<String, String>> collect = listObject1.stream().filter(t -> (t.containsKey(pressurePumpStart) && t.get(pressurePumpStart).equals("true")) || (t.containsKey(pressurePumpStart) && t.get(pressurePumpStart).equals("false"))).collect(Collectors.toList());
int num = collect.size();
item.put("startAndStopNum", num);
}
......
......@@ -62,8 +62,6 @@ public class ConfigureController extends AbstractBaseController {
@Value("${equipment.pressurepump.start}")
private String pressurePumpStart;
@Value("${equipment.pressurepump.stop}")
private String pressurePumpStop;
@Value("${stationCode}")
private String stationCode;
......@@ -334,8 +332,8 @@ public class ConfigureController extends AbstractBaseController {
ResponseModel entity1 = null;
ResponseModel entity2 = null;
try {
entity1 = iotFeign.selectList(getAppKey(), getProduct(), getToken(), startDateStr, nowStrLong, prefix, suffix, pressurePumpStart);
entity2 = iotFeign.selectList(getAppKey(), getProduct(), getToken(), startDateStr, nowStrLong, prefix, suffix, pressurePumpStop);
entity1 = iotFeign.selectListNew(getAppKey(), getProduct(), getToken(),iotCode, startDateStr, nowStrLong, "true", pressurePumpStart);
entity2 = iotFeign.selectListNew(getAppKey(), getProduct(), getToken(),iotCode, startDateStr, nowStrLong, "false", pressurePumpStart);
} catch (Exception e) {
e.printStackTrace();
}
......@@ -345,7 +343,7 @@ public class ConfigureController extends AbstractBaseController {
String json2 = JSON.toJSONString(entity2.getResult());
List<Map<String, String>> listObject2 = (List<Map<String, String>>) JSONArray.parse(json2);
listObject1.addAll(listObject2);
List<Map<String, String>> collect = listObject1.stream().filter(t -> (t.containsKey(pressurePumpStart) && t.get(pressurePumpStart).equals("true")) || (t.containsKey(pressurePumpStop) && t.get(pressurePumpStop).equals("true"))).collect(Collectors.toList());
List<Map<String, String>> collect = listObject1.stream().filter(t -> (t.containsKey(pressurePumpStart) && t.get(pressurePumpStart).equals("true")) || (t.containsKey(pressurePumpStart) && t.get(pressurePumpStart).equals("false"))).collect(Collectors.toList());
int num = collect.size();
item.put("startAndStopNum", num);
}
......@@ -395,8 +393,8 @@ public class ConfigureController extends AbstractBaseController {
ResponseModel entity1 = null;
ResponseModel entity2 = null;
try {
entity1 = iotFeign.selectList(getAppKey(), getProduct(), getToken(), startDateStr, nowStrLong, prefix, suffix, pressurePumpStart);
entity2 = iotFeign.selectList(getAppKey(), getProduct(), getToken(), startDateStr, nowStrLong, prefix, suffix, pressurePumpStop);
entity1 = iotFeign.selectListNew(getAppKey(), getProduct(), getToken(),iotCode, startDateStr, nowStrLong, "true", pressurePumpStart);
entity2 = iotFeign.selectListNew(getAppKey(), getProduct(), getToken(),iotCode, startDateStr, nowStrLong, "false", pressurePumpStart);
} catch (Exception e) {
e.printStackTrace();
}
......@@ -406,7 +404,7 @@ public class ConfigureController extends AbstractBaseController {
String json2 = JSON.toJSONString(entity2.getResult());
List<Map<String, String>> listObject2 = (List<Map<String, String>>) JSONArray.parse(json2);
listObject1.addAll(listObject2);
List<Map<String, String>> collect = listObject1.stream().filter(t -> (t.containsKey(pressurePumpStart) && t.get(pressurePumpStart).equals("true")) || (t.containsKey(pressurePumpStop) && t.get(pressurePumpStop).equals("true"))).collect(Collectors.toList());
List<Map<String, String>> collect = listObject1.stream().filter(t -> (t.containsKey(pressurePumpStart) && t.get(pressurePumpStart).equals("true")) || (t.containsKey(pressurePumpStart) && t.get(pressurePumpStart).equals("false"))).collect(Collectors.toList());
int num = collect.size();
item.put("startAndStopNum", num);
}
......
......@@ -19,19 +19,14 @@ 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.foundation.utils.DateTimeUtil;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.*;
import static org.typroject.tyboot.core.foundation.utils.DateTimeUtil.ISO8601_DATE_HOUR_MIN_SEC;
/**
*
* 四横八纵应急模块接口
......@@ -583,4 +578,42 @@ public class EmergencyController extends AbstractBaseController {
return CommonResponseUtil.success(iEmergencyService.getStockEquipStatistics());
}
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getPressurePumpStatusChart")
@ApiOperation(httpMethod = "GET", value = "四横八纵-稳压泵启停状态图", notes = "四横八纵-稳压泵启停状态图")
public ResponseModel getPressurePumpStatusChart(@RequestParam String equipmentCode, @RequestParam String startTime, @RequestParam String endTime,
@RequestParam(required = false) String bizOrgCode) {
if(StringUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
bizOrgCode = personIdentity.getBizOrgCode();
if (bizOrgCode == null) {
return CommonResponseUtil.success(Collections.EMPTY_MAP);
}
}
}
return CommonResponseUtil.success(iEmergencyService.getPressurePumpStatusChart(equipmentCode, startTime, endTime, bizOrgCode, getAppKey(), getProduct(), getToken()));
}
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getPressurePumpDiagnosticAnalysis")
@ApiOperation(httpMethod = "GET", value = "四横八纵-稳压泵诊断分析", notes = "四横八纵-稳压泵诊断分析")
public ResponseModel getPressurePumpDiagnosticAnalysis(@RequestParam String equipmentCode, @RequestParam(required = false) String nameKeys,
@RequestParam(required = false) String fieldKey, @RequestParam(required = false) String bizOrgCode) {
if(StringUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
bizOrgCode = personIdentity.getBizOrgCode();
if (bizOrgCode == null) {
return CommonResponseUtil.success(Collections.EMPTY_MAP);
}
}
}
return CommonResponseUtil.success(iEmergencyService.getPressurePumpDiagnosticAnalysis(equipmentCode, nameKeys, fieldKey, bizOrgCode, getAppKey(), getProduct(), getToken()));
}
}
......@@ -58,8 +58,6 @@ public class SupervisionConfigureController extends AbstractBaseController {
@Value("${equipment.pressurepump.start}")
private String pressurePumpStart;
@Value("${equipment.pressurepump.stop}")
private String pressurePumpStop;
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
......@@ -325,7 +323,7 @@ public class SupervisionConfigureController extends AbstractBaseController {
fourHourEntity = iotFeign.selectList(getAppKey(), getProduct(), getToken(), four, nowStrLong, prefix, suffix, pressurePumpStart);
oneHourEntity = iotFeign.selectList(getAppKey(), getProduct(), getToken(), one, nowStrLong, prefix, suffix, pressurePumpStart);
start = iotFeign.selectOne(getAppKey(), getProduct(), getToken(), "1", prefix, suffix, "true", pressurePumpStart);
stop = iotFeign.selectOne(getAppKey(), getProduct(), getToken(), "1", prefix, suffix, "flase", pressurePumpStart);
stop = iotFeign.selectOne(getAppKey(), getProduct(), getToken(), "1", prefix, suffix, "false", pressurePumpStart);
} catch (Exception e) {
e.printStackTrace();
}
......
......@@ -47,8 +47,19 @@ public interface IotFeign {
@RequestHeader("token") String token,
@RequestParam(value = "top") String top,
@RequestParam(value = "productKey") String productKey,
@RequestParam(value = "deviceName") String deviceName,
@RequestParam("FHS_FirePump_RunStatus") String key,
@RequestParam( required = false, value = "deviceName") String deviceName,
@RequestParam("FHS_PressurePump_Start") String key,
@RequestParam(required = false, value = "fieldKey") String fieldKey);
@RequestMapping(value = "v1/livedata/common/list", method = RequestMethod.GET, consumes = "application/json")
ResponseModel selectListNew(
@RequestHeader("appKey") String appKey,
@RequestHeader("product") String product,
@RequestHeader("token") String token,
@RequestParam(value = "measurement") String measurement,
@RequestParam(value = "timeStart") String beginDate,
@RequestParam(value = "timeEnd") String endDate,
@RequestParam("FHS_PressurePump_Start") String key,
@RequestParam(required = false, value = "fieldKey") String fieldKey);
......
......@@ -42,4 +42,6 @@ public interface EquipmentSpecificAlarmLogMapper extends BaseMapper<EquipmentSpe
Map<String, Object> alarmEquipLink(String date, String pattern, String cleanFlag);
Map<String, Object> unCleanAlarmEquipLink(String date, String pattern, String cleanFlag);
List<EquipmentSpecificAlarmLog> getAlarmLogInfoList(String equipmentCode, String nameKeys, String value, String isCleanTime, String bizOrgCode);
}
......@@ -48,6 +48,13 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
List<EquipmentSpecificVo> getEquipmentSpecificIotCode();
/**
* 获取稳压泵 iot_code
*
* @return
*/
List<EquipmentSpecificVo> getEquipmentSpecificIotCodeWYB();
/**
* @Return: List<String>
* @Throws
* @Date 2020/11/13 9:19
......@@ -233,6 +240,8 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
List<Map<String, Object>> getFirePumpInfoEQ(@Param("list") String[] strings,@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> getListByEquipmentCode(@Param("list") String[] strings, @Param("bizOrgCode") String bizOrgCode);
Integer getAllEquipNum(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> normalIndexInfoList(@Param("startDate") String startDate, @Param("endDate") String endDate);
......
......@@ -53,4 +53,8 @@ public interface IEmergencyService {
List<Map<String, String>> getEquipExpiryList(Integer expiryDayNum);
Map<String, Integer> getStockEquipStatistics();
Map<String, Object> getPressurePumpStatusChart(String equipmentCode, String startTime, String endTime, 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);
}
......@@ -37,4 +37,15 @@ public interface IEquipmentSpecificAlarmLogService extends IService<EquipmentSpe
* @return
*/
Map<String, Object> equipAlarmLink(String date);
/**
* 获取告警Log未消除信息集合
* @param equipmentCode
* @param nameKey
* @param value
* @param isCleanTime
* @param bizOrgCode
* @return
*/
List<EquipmentSpecificAlarmLog> getAlarmLogInfoList(String equipmentCode, String nameKeys, String value, String isCleanTime, String bizOrgCode);
}
......@@ -230,6 +230,13 @@ public interface IEquipmentSpecificSerivce extends IService<EquipmentSpecific> {
List<Map<String, Object>> getListByEquipmentCode(String code,String bizOrgCode);
List<Map<String, Object>> getFirePumpInfoEQ(String code,String bizOrgCode);
/**
* 根据装备分类code获取装备列表,id 升序
* @param code 装备分类逗号隔开
* @return 装备list
*/
List<Map<String, Object>> getListByEquipmentCode(String code, String bizOrgCode);
/**
* 根据装备id获取物联日志
* @param iotCode code
* @param entity 日志
......
......@@ -66,4 +66,9 @@ public class EquipmentSpecificAlarmLogServiceImpl extends ServiceImpl<EquipmentS
map.put("unCleanAlarmEquipMonthLink", unCleanAlarmEquipMonthLink);
return map;
}
@Override
public List<EquipmentSpecificAlarmLog> getAlarmLogInfoList(String equipmentCode, String nameKeys, String value, String isCleanTime, String bizOrgCode) {
return equipmentSpecificAlarmLogMapper.getAlarmLogInfoList(equipmentCode, nameKeys, value, isCleanTime, bizOrgCode);
}
}
package com.yeejoin.equipmanage.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -13,12 +15,14 @@ import com.yeejoin.equipmanage.common.dto.OrgUsrDto;
import com.yeejoin.equipmanage.common.entity.*;
import com.yeejoin.equipmanage.common.entity.dto.AlarmDTO;
import com.yeejoin.equipmanage.common.entity.dto.EquipSpecificAlarmDTO;
import com.yeejoin.equipmanage.common.entity.vo.EquipmentSpecificVo;
import com.yeejoin.equipmanage.common.entity.vo.VideoVO;
import com.yeejoin.equipmanage.common.enums.*;
import com.yeejoin.equipmanage.common.utils.CommonPageInfoParam;
import com.yeejoin.equipmanage.common.utils.DateUtils;
import com.yeejoin.equipmanage.common.utils.StringUtil;
import com.yeejoin.equipmanage.common.vo.*;
import com.yeejoin.equipmanage.fegin.IotFeign;
import com.yeejoin.equipmanage.fegin.JcsFeign;
import com.yeejoin.equipmanage.fegin.SystemctlFeign;
import com.yeejoin.equipmanage.mapper.*;
......@@ -31,6 +35,7 @@ import org.springframework.data.domain.PageImpl;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
import java.net.Inet4Address;
......@@ -90,10 +95,17 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
@Value("${window.vedioFormat}")
String vedioFormat;
@Value("${equipment.pressurepump.start}")
private String pressurePumpStart;
@Autowired
JcsFeign jcsFeign;
@Autowired
private IotFeign iotFeign;
@Autowired
MqttSendGateway mqttSendGateway;
@Override
......@@ -772,9 +784,21 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
@Override
public Map<String, Object> pressureMessage(String orgCode, String startTime, String endTime) {
Map<String, Object> stringObjectMap = equipmentSpecificAlarmMapper.pressureMessage(orgCode, startTime, endTime);
EquipmentSpecificVo vo = null;
if(equipmentSpecificMapper.getEquipmentSpecificIotCodeWYB().get(0) != null) {
vo = equipmentSpecificMapper.getEquipmentSpecificIotCodeWYB().get(0);
}
int startNum = Integer.parseInt(stringObjectMap.get("startNum").toString());
ResponseModel start = iotFeign.selectListNew(remoteSecurityService.getServerToken().getAppKey(), remoteSecurityService.getServerToken().getProduct(), remoteSecurityService.getServerToken().getToke(), vo.getIotCode().substring(0,8), startTime, endTime,"true", pressurePumpStart);
if (200 == start.getStatus() && !ObjectUtils.isEmpty(start.getResult())) {
String json1 = JSON.toJSONString(start.getResult());
List<Map<String, String>> listObject1 = (List<Map<String, String>>) JSONArray.parse(json1);
startNum = listObject1.size();
}
Map<String, Object> retMap = new HashMap<>();
int allNum = Integer.parseInt(stringObjectMap.get("allNum").toString());
int startNum = Integer.parseInt(stringObjectMap.get("startNum").toString());
// 计算平均每小时打压频率
try {
int hour = DateUtils.dateBetweenNew(DateUtils.dateParse(startTime, null),DateUtils.dateParse(endTime, null));
......@@ -790,11 +814,17 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
} else {
retMap.put("status","正常");
}
retMap.put("name", stringObjectMap.get("name").toString());
String frequency = "稳压泵总数"+stringObjectMap.get("allEqu").toString()+"台,平均近半小时启动"+startNum/hafHour+"次,"+
"平均2小时启动"+startNum/twoHour+"次,"+"平均4小时启动"+startNum/fourHour+"次";
retMap.put("frequency",frequency);
if(startNum != 0) {
retMap.put("name", stringObjectMap.get("name").toString());
String frequency = "稳压泵总数"+stringObjectMap.get("allEqu").toString()+"台,平均近半小时启动"+(startNum/hafHour < 1 ? 1 : startNum/hafHour)+"次,"+
"平均2小时启动"+(startNum/twoHour < 1 ? 1 : startNum/twoHour)+"次,"+"平均4小时启动"+(startNum/fourHour < 1 ? 1 : startNum/fourHour)+"次";
retMap.put("frequency",frequency);
} else {
retMap.put("name", stringObjectMap.get("name").toString());
String frequency = "稳压泵总数"+stringObjectMap.get("allEqu").toString()+"台,平均近半小时启动0次,"+
"平均2小时启动0次,"+"平均4小时启动0次";
retMap.put("frequency",frequency);
}
} catch (ParseException e) {
e.printStackTrace();
}
......
......@@ -1852,6 +1852,16 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
}
@Override
public List<Map<String, Object>> getListByEquipmentCode(String code, String bizOrgCode) {
List<Map<String, Object>> list = new ArrayList<>();
if (StringUtil.isNotEmpty(code)) {
String[] strings = code.split(",");
list = equipmentSpecificMapper.getListByEquipmentCode(strings, bizOrgCode);
}
return list;
}
@Override
public List<IotIndexInfoVo> getIndexInfoList(String iotCode, ResponseModel entity, Integer isTrend, String fieldKey) {
List<IotIndexInfoVo> infoVoList = new ArrayList<>();
String json = JSON.toJSONString(entity.getResult());
......
......@@ -19,6 +19,7 @@ import com.yeejoin.equipmanage.common.utils.DateUtils;
import com.yeejoin.equipmanage.common.utils.StringUtil;
import com.yeejoin.equipmanage.common.utils.UUIDUtils;
import com.yeejoin.equipmanage.common.vo.*;
import com.yeejoin.equipmanage.fegin.IotFeign;
import com.yeejoin.equipmanage.fegin.SystemctlFeign;
import com.yeejoin.equipmanage.mapper.*;
import com.yeejoin.equipmanage.quartz.PumpSendMessage;
......@@ -41,7 +42,10 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
......@@ -101,6 +105,9 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
EquipmentSpecificIndexMapper equipmentSpecificIndexMapper;
@Autowired
private IotFeign iotFeign;
@Autowired
MarqueeDataMapper marqueeDataMapper;
//消防泵
@Value("${equipment.plan.pump}")
......@@ -238,10 +245,6 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
@Value("${equipment.pressurepump.start}")
private String pressurePumpStart;
@Value("${equipment.pressurepump.stop}")
private String pressurePumpStop;
@Value("${emergency.disposal.indicators}")
private String emergencyDisposalIndicators;
......@@ -364,9 +367,10 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
iotDataListToCacheMap(iotDatalist);
iotDatalist.forEach(iotDataVO -> {
String indexKey = iotDataVO.getKey();
String indexValue = iotDataVO.getValue().toString();
// 稳压泵启停信号处理
if (indexKey.equals(pressurePumpStart) || indexKey.equals(pressurePumpStop)) {
pressurePump(indexKey, iotDatalist, topicEntity);
if (indexKey.equals(pressurePumpStart)) {
pressurePump(indexKey,indexValue, iotDatalist, topicEntity);
}
for (EquipmentSpecificIndex equipmentSpecificIndex : indexList) {
if (!ObjectUtils.isEmpty(equipmentSpecificIndex.getNameKey())
......@@ -1489,13 +1493,12 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
}
}
private void pressurePump(String indexKey, List<IotDataVO> iotDatalist, TopicEntityVo topicEntity) {
private void pressurePump(String indexKey, String indexValue, List<IotDataVO> iotDatalist, TopicEntityVo topicEntity) {
List<String> listIndex = new ArrayList<>();
listIndex.add(pressurePumpStart);
listIndex.add(pressurePumpStop);
// 获取全部启停泵信号
List<EquipmentSpecificIndex> equipmentSpeIndexList = equipmentSpecificIndexService.getEquipmentSpeIndexByIndex(listIndex);
List<PressurePumpEnum> enumListByCode = PressurePumpEnum.getEnumListByCode(indexKey);
List<PressurePumpEnum> enumListByCode = PressurePumpEnum.getEnumListByCode(indexValue);
if (!CollectionUtils.isEmpty(enumListByCode)) {
enumListByCode.forEach(pressurePumpEnum -> {
......@@ -1516,15 +1519,23 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
private EquipmentSpecificIndex getPressurePumpDateByType(String indexKey, PressurePumpValueEnum valueEnum, TopicEntityVo topicEntity, List<EquipmentSpecificIndex> equipmentSpeIndexList, PressurePumpEnum pressurePumpEnum) {
String iotCode = topicEntity.getIotCode();
EquipmentSpecificIndex equipmentSpecificIndex = null;
String prefix = null;
String suffix = null;
if (iotCode.length() > 8) {
prefix = iotCode.substring(0, 8);
suffix = iotCode.substring(8);
} else {
throw new BadRequest("装备物联编码错误,请确认!");
}
String jobName = topicEntity.getIotCode()+"_"+indexKey;
String triggerName = PUMP_TRIGGER_NAME+"-"+topicEntity.getIotCode();
switch (valueEnum) {
case LAST_STOP:
List<EquipmentSpecificIndex> lastStop = equipmentSpeIndexList.stream().filter(e ->
StringUtil.isNotEmpty(e.getValue()) && e.getIotCode().equals(iotCode) && pressurePumpStop.equals(e.getEquipmentIndexKey())).sorted(Comparator.comparing(EquipmentSpecificIndex::getUpdateDate).reversed())
StringUtil.isNotEmpty(e.getValue()) && e.getIotCode().equals(iotCode) && pressurePumpStart.equals(e.getEquipmentIndexKey())).sorted(Comparator.comparing(EquipmentSpecificIndex::getUpdateDate).reversed())
.collect(Collectors.toList());
if (!CollectionUtils.isEmpty(lastStop)) {
equipmentSpecificIndex = lastStop.get(0);
getIotDate(equipmentSpecificIndex, lastStop, prefix, suffix , "false");
}
break;
case LAST_START:
......@@ -1538,15 +1549,15 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
StringUtil.isNotEmpty(e.getValue()) && e.getIotCode().equals(iotCode) && pressurePumpStart.equals(e.getEquipmentIndexKey())).sorted(Comparator.comparing(EquipmentSpecificIndex::getUpdateDate).reversed())
.collect(Collectors.toList());
if (!CollectionUtils.isEmpty(lastStart)) {
equipmentSpecificIndex = lastStart.get(0);
getIotDate(equipmentSpecificIndex, lastStart, prefix, suffix, "true");
}
break;
case LATELY_STOP:
List<EquipmentSpecificIndex> latelyStop = equipmentSpeIndexList.stream().filter(e ->
StringUtil.isNotEmpty(e.getValue()) && pressurePumpStop.equals(e.getEquipmentIndexKey())).sorted(Comparator.comparing(EquipmentSpecificIndex::getUpdateDate).reversed())
StringUtil.isNotEmpty(e.getValue()) && pressurePumpStart.equals(e.getEquipmentIndexKey())).sorted(Comparator.comparing(EquipmentSpecificIndex::getUpdateDate).reversed())
.collect(Collectors.toList());
if (!CollectionUtils.isEmpty(latelyStop)) {
equipmentSpecificIndex = latelyStop.get(0);
getIotDate(equipmentSpecificIndex, latelyStop, prefix, null, "false");
}
break;
case LATELY_START:
......@@ -1554,7 +1565,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
StringUtil.isNotEmpty(e.getValue()) && pressurePumpStart.equals(e.getEquipmentIndexKey())).sorted(Comparator.comparing(EquipmentSpecificIndex::getUpdateDate).reversed())
.collect(Collectors.toList());
if (!CollectionUtils.isEmpty(latelyStart)) {
equipmentSpecificIndex = latelyStart.get(0);
getIotDate(equipmentSpecificIndex, latelyStart, prefix, null, "true");
}
break;
case PUMP_START_TIME:
......@@ -1566,6 +1577,21 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
return equipmentSpecificIndex;
}
private void getIotDate(EquipmentSpecificIndex equipmentSpecificIndex, List<EquipmentSpecificIndex> listData, String prefix, String suffix, String flag) {
ResponseModel start = iotFeign.selectOne(remoteSecurityService.getServerToken().getAppKey(), remoteSecurityService.getServerToken().getProduct(), remoteSecurityService.getServerToken().getToke(), "1", prefix, suffix, flag, pressurePumpStart);
if (200 == start.getStatus() && !ObjectUtils.isEmpty(start.getResult())) {
String json1 = JSON.toJSONString(start.getResult());
List<Map<String, String>> listObject1 = (List<Map<String, String>>) JSONArray.parse(json1);
List<Map<String, String>> collect = listObject1.stream().filter(t -> (t.containsKey("time"))).collect(Collectors.toList());
String startTime = collect.get(0).get("time").substring(0, 19).replace("T", " ");
Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTime), +8);
listData.get(0).setUpdateDate(startDate);
equipmentSpecificIndex = listData.get(0);
}
}
private void checkValueByDate(EquipmentSpecificIndex data, Date newDate, PressurePumpEnum pressurePumpEnum) {
String operator = pressurePumpEnum.getOperator();
PressurePumpCheckEnum pumpCheckEnum = PressurePumpCheckEnum.getByCode(operator);
......@@ -1695,8 +1721,6 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
cron = pressurePumpEnum.getLeftValue();
}
EquipmentSpecific equipmentSpecific = null;
try {
LambdaQueryWrapper<EquipmentSpecific> wrapper = new LambdaQueryWrapper<>();
......
......@@ -9,7 +9,7 @@ import java.util.List;
import java.util.Map;
//装备
@FeignClient(name ="${equip.fegin.name}")
@FeignClient(name ="${equip.fegin.name}", configuration = FeignConfiguration.class)
public interface EquipFeign {
@RequestMapping(value = "${equip.fegin.prefix}"+"/equipSpecific/getSourceNameByEquipSpeId", method = RequestMethod.GET ,consumes="application/json")
LinkedHashMap<String,Object> getEquipDetail(@RequestParam(value = "id", required = true) Long id);
......
......@@ -115,9 +115,8 @@ equipment.scrap.day=30
equipment.scrap.cron=0 0 9 * * ?
# 稳压泵启动信号
equipment.pressurepump.start=FHS_FirePump_RunStatus
# 稳压泵停止信号
equipment.pressurepump.stop=FHS_PressurePump_Stop
equipment.pressurepump.start=FHS_PressurePump_Start
# 站端标识
state.code=GW190301
......
......@@ -243,4 +243,34 @@
ORDER BY
ta.`date`
</select>
<select id="getAlarmLogInfoList" resultType="com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarmLog">
SELECT
*
FROM
wl_equipment_specific_alarm_log wesal
<where>
<if test="equipmentCode != null and equipmentCode != ''">
AND wesal.equipment_code LIKE CONCAT( #{equipmentCode},'%')
</if>
<if test="nameKeys != null and nameKeys.split(',').length >0">
AND wesal.equipment_specific_index_key IN
<foreach collection="nameKeys.split(',')" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="value != null and value != ''">
AND wesal.equipment_specific_index_value = #{value}
</if>
<if test="isCleanTime != null and isCleanTime = 'false'">
AND wesal.clean_time IS NULL
</if>
<if test="isCleanTime != null and isCleanTime = 'true'">
AND wesal.clean_time IS NOT NULL
</if>
<if test="bizOrgCode != null and bizOrgCode != ''">
AND wesal.biz_org_code LIKE CONCAT( #{bizOrgCode},'%')
</if>
</where>
ORDER BY wesal.create_date DESC
</select>
</mapper>
\ No newline at end of file
......@@ -1744,6 +1744,29 @@
</where>
ORDER BY realtiemIotIndexUpdateDate DESC
</select>
<select id="getListByEquipmentCode" resultType="Map">
SELECT
wes.id,
wes.name,
wes.code,
wes.equipment_code equipmentCode,
wes.realtime_iot_index_name realtimeIotIndexName,
wes.realtime_iot_index_key realtimeIotIndexKey,
wes.iot_code iotCode
FROM
wl_equipment_specific wes
<where>
<if test="list != null and list.length > 0">
<foreach collection="list" item="item" index="index" open="(" close=")" separator="OR">
wes.equipment_code LIKE <![CDATA[CONCAT(#{item},'%')]]>
</foreach>
</if>
<if test="bizOrgCode != null and bizOrgCode != ''">
AND wes.biz_org_code LIKE concat(#{bizOrgCode}, '%')
</if>
</where>
ORDER BY wes.id
</select>
......@@ -2206,5 +2229,10 @@
where s.`code` = b.`code`) u
where LOCATE(u.biz_org_code, (SELECT wl_equipment_specific.biz_org_code FROM wl_equipment_specific WHERE wl_equipment_specific.id=#{id})) > 0
</select>
<select id="getEquipmentSpecificIotCodeWYB"
resultType="com.yeejoin.equipmanage.common.entity.vo.EquipmentSpecificVo">
select iot_code from wl_equipment_specific where equipment_code = '92010800KAL44' and iot_code is not null
</select>
</mapper>
\ No newline at end of file
......@@ -92,4 +92,7 @@ emqx.user-name=admin
emqx.password=public
emqx.max-inflight=1000
file.url=http://172.16.11.201:9000/
\ No newline at end of file
file.url=http://172.16.11.201:9000/
##代码中有部分逻辑冲突需要处理 为区分机场和电力逻辑 增加开关 若为true 则为机场逻辑 为false 则为电力逻辑
logic=false
\ No newline at end of file
......@@ -886,7 +886,8 @@
LEFT JOIN p_point_inputitem ppi ON ppi.id = prpi.point_input_item_id
LEFT JOIN p_input_item pii ON pii.id = ppi.input_item_id
<where>
<if test="routeId != null">prp.route_id = #{routeId}</if>
!FIND_IN_SET(ppi.id, IFNULL(prp.exclude_items,0))
<if test="routeId != null">and prp.route_id = #{routeId}</if>
<if test="pointId != null">and prp.point_id = #{pointId}</if>
</where>
<!--
......
......@@ -12,7 +12,8 @@
LEFT JOIN p_route_point_item prpi ON prpi.point_input_item_id = pii.id,
(
SELECT
id AS route_point_id
id AS route_point_id,
exclude_items
FROM
p_route_point rp
<where>
......@@ -22,7 +23,8 @@
) prp
WHERE
prp.route_point_id = prpi.route_point_id
</select>
and !FIND_IN_SET(pii.id, ifnull(prp.exclude_items, 0))
</select>
<resultMap id="routePointInputItemMap" type="com.yeejoin.amos.patrol.dao.entity.PointInputItem">
<result property="id" column="id" />
......
......@@ -40,9 +40,9 @@ public class KafkaConsumerService {
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (Exception e) {
log.info("单条消息 ====> message: {}", message);
// log.info("单条消息 ====> message: {}", message);
}
log.info("单条消息 ====> message: {}", message);
// log.info("单条消息 ====> message: {}", message);
ack.acknowledge();
}
......
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