Commit 717a6d44 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 937ebf07 0c880de2
......@@ -13,6 +13,7 @@ public enum PressurePumpRelateEnum {
ONE_HOUR_MINUTE("60", "60分钟"),
IOT_INDEX_VALUE_TRUE("true", "物联指标值:true"),
IOT_INDEX_VALUE_FALSE("false", "物联指标值:false"),
ONE_TIME("1", "物联指标最近1条数据"),
HALF_HOUR("0.5", "半小时"),
ONE_HOUR("1.0", "1小时"),
TWO_HOUR("2.0", "2小时"),
......
......@@ -21,4 +21,6 @@ public interface ISupervisionVideoService extends IService<SupervisionVideo> {
List<String> queryVideoAllId(String bizOrgCode);
Page<Map<String, Object>> queryPumpInfo(Page page, String bizOrgCode);
List<Map<String, Object>> selectPressureDetails(String bizOrgCode);
}
......@@ -25,6 +25,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
......@@ -280,7 +281,8 @@ public class EmergencyServiceImpl implements IEmergencyService {
}
}
}
PressurePumpAnalysisEnum.PRESSURE_PUMP_DAY_AVG.setValue(Math.round(dayAvgFrequency.get() / Math.abs(Integer.parseInt(PressurePumpRelateEnum.DAY_AVG.getValue()))));
DecimalFormat df = new DecimalFormat("0.0");
PressurePumpAnalysisEnum.PRESSURE_PUMP_DAY_AVG.setValue(df.format(Double.valueOf(dayAvgFrequency.get()) / Double.valueOf(Math.abs(Integer.parseInt(PressurePumpRelateEnum.DAY_AVG.getValue())))));
// 6. 管网压力状态
double pressureDiff = pressurePumpService.getAllPressurePumpPipePressureDiff(dataList, dataPipeList, PressurePumpRelateEnum.PRESSURE_PUMP_START_BEFORE_MINUTE.getValue());
PressurePumpAnalysisEnum.PRESSURE_PUMP_PIPE.setValue(pressureDiff > Double.parseDouble(PressurePumpRelateEnum.PIPE_PRESSURE_DIFF.getValue()) ? PressurePumpRelateEnum.PIPE_PRESSURE_ABNORMAL_STATUS.getValue() : PressurePumpRelateEnum.PIPE_PRESSURE_NORMAL_STATUS.getValue());
......
......@@ -148,28 +148,10 @@ public class PressurePumpServiceImpl implements IPressurePumpService {
public long getAllPressurePumpStartStopInterval(List<IotDataVO> dataList, List<IotDataVO> dataListFilterTrue, List<IotDataVO> dataListFilterFalse, String nowStrLong) {
String intervalTime1 = nowStrLong;
String intervalTime2 = nowStrLong;
if (CollectionUtils.isNotEmpty(dataList)) {
IotDataVO iotDataVO = dataList.get(0);
String value = iotDataVO.getValue().toString();
String createdTime = iotDataVO.getCreatedTime();
if (PressurePumpRelateEnum.IOT_INDEX_VALUE_TRUE.getValue().equalsIgnoreCase(value)) {
intervalTime1 = createdTime;
if (CollectionUtils.isNotEmpty(dataListFilterFalse)) {
// 获取最新的停止时间
intervalTime2 = dataListFilterFalse.get(0).getCreatedTime();
}
} else {
if (CollectionUtils.isNotEmpty(dataListFilterFalse) && CollectionUtils.isNotEmpty(dataListFilterTrue)) {
// 获取最新的启动时间
intervalTime1 = dataListFilterTrue.get(0).getCreatedTime();
// 获取大于启动信号,且最近停止信号的时间
String finalIntervalTime = intervalTime1;
List<IotDataVO> timeList = dataListFilterFalse.stream().filter(x -> DateUtils.getDurationSeconds(finalIntervalTime, x.getCreatedTime(), DateUtils.DATE_TIME_PATTERN) >= 0).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(timeList)) {
intervalTime2 = timeList.get(timeList.size() - 1).getCreatedTime();
}
}
}
if (!ObjectUtils.isEmpty(dataListFilterTrue) && dataListFilterTrue.size() > 2) {
//获取启动列表中
intervalTime1 = dataListFilterTrue.get(0).getCreatedTime();
intervalTime2 = dataListFilterTrue.get(1).getCreatedTime();
}
// 结果向上取整
double ceil = Math.ceil(Math.abs(DateUtils.getDurationSeconds(intervalTime1, intervalTime2, DateUtils.DATE_TIME_PATTERN)) * 1.0 / Double.parseDouble(PressurePumpRelateEnum.ONE_HOUR_MINUTE.getValue()));
......
......@@ -23,7 +23,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -128,7 +128,8 @@ public class SupervisionVideoServiceImpl extends ServiceImpl<SupervisionVideoMap
} catch (ParseException e) {
log.error("近3天平均启动次数获取失败-->dayAvgFrequency:{}", e.getMessage());
}
int dayAvgStartNum = Math.round(dayAvgFrequency.get() / Math.abs(Integer.parseInt(PressurePumpRelateEnum.DAY_AVG.getValue())));
DecimalFormat df = new DecimalFormat("0.0");
String dayAvgStartNum = df.format(Double.valueOf(dayAvgFrequency.get()) / Double.valueOf(Math.abs(Integer.parseInt(PressurePumpRelateEnum.DAY_AVG.getValue()))));
pressurePumpInfo = fireFightingSystemMapper.getPressurePumpInfo(page, bizOrgCode, null);
String prefix = null;
for (Map<String, Object> item : pressurePumpInfo.getRecords()) {
......@@ -228,4 +229,35 @@ public class SupervisionVideoServiceImpl extends ServiceImpl<SupervisionVideoMap
return pressurePumpInfo;
}
@Override
public List<Map<String, Object>> selectPressureDetails(String bizOrgCode) {
List<Map<String, Object>> pressurePumpInfo = fireFightingSystemMapper.selectAllPressurePumpInfo(bizOrgCode);
pressurePumpInfo.stream().map(item -> {
String prefix = null;
String suffix = null;
String iotCode = item.get("iot_code").toString();
if (iotCode.length() > 8) {
prefix = iotCode.substring(0, 8);
suffix = iotCode.substring(8);
} else {
throw new BadRequest("装备物联编码错误,请确认!");
}
//通过iot最近一次的启动和停止时间
List<Map<String, String>> trueData = pressurePumpService.getIotTopSingleField(PressurePumpRelateEnum.ONE_TIME.getValue(), prefix, suffix, PressurePumpRelateEnum.IOT_INDEX_VALUE_TRUE.getValue(), pressurePumpStart);
List<Map<String, String>> falseData = pressurePumpService.getIotTopSingleField(PressurePumpRelateEnum.ONE_TIME.getValue(), prefix, suffix, PressurePumpRelateEnum.IOT_INDEX_VALUE_FALSE.getValue(), pressurePumpStart);
if(!ObjectUtils.isEmpty(trueData)){
item.put("startTime", trueData.get(0).get("createdTime"));
} else {
item.put("startTime", "");
}
if(!ObjectUtils.isEmpty(falseData)){
item.put("stopTime", falseData.get(0).get("createdTime"));
} else {
item.put("stopTime", "");
}
return item;
}).collect(Collectors.toList());
return pressurePumpInfo;
}
}
......@@ -1864,7 +1864,17 @@
(
0 <![CDATA[<>]]> find_in_set(`fs`.`id`, `s`.`system_id`)
)
) AS `fightSysName`
) AS `fightSysName`,
(
SELECT
charge_person_name
FROM
`f_fire_fighting_system` `fs`
WHERE
(
0 <![CDATA[<>]]> find_in_set(`fs`.`id`, `s`.`system_id`)
)
) AS `chargePersonName`
FROM
`wl_equipment_specific_index` `si`
JOIN `wl_equipment_specific` `s`
......
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