Commit 5b82d50b authored by 高建强's avatar 高建强

item:稳压泵诊断分析接口新增

parent 037212d2
......@@ -6,6 +6,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.*;
/**
......@@ -990,4 +993,91 @@ public class DateUtils {
}
}
/**
* 获取两个时间段之间的秒数
*
* @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();
}
}
......@@ -583,7 +583,7 @@ public class EmergencyController extends AbstractBaseController {
@GetMapping(value = "/getPressurePumpStatusChart")
@ApiOperation(httpMethod = "GET", value = "四横八纵-稳压泵启停状态图", notes = "四横八纵-稳压泵启停状态图")
public ResponseModel getPressurePumpStatusChart(@RequestParam String equipmentCode, @RequestParam String startTime, @RequestParam String endTime,
@RequestParam(required = false) String fieldKey, @RequestParam(required = false) String bizOrgCode) {
@RequestParam(required = false) String bizOrgCode) {
if(StringUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
......@@ -594,7 +594,26 @@ public class EmergencyController extends AbstractBaseController {
}
}
}
return CommonResponseUtil.success(iEmergencyService.getPressurePumpStatusChart(equipmentCode, startTime, endTime, fieldKey, bizOrgCode, getAppKey(), getProduct(), getToken()));
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()));
}
}
......@@ -325,7 +325,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();
}
......
package com.yeejoin.equipmanage.fegin;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -39,5 +38,16 @@ public interface IotFeign {
@RequestParam("FHS_FirePump_RunStatus") 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);
}
......@@ -54,5 +54,7 @@ public interface IEmergencyService {
Map<String, Integer> getStockEquipStatistics();
Map<String, Object> getPressurePumpStatusChart(String equipmentCode, String startTime, String endTime, String fieldKey, String bizOrgCode, String appKey, String product, String token);
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);
}
......@@ -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);
}
}
......@@ -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
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