Commit a3a90362 authored by litengwei's avatar litengwei

Merge branch 'develop_dl_plan6' into develop_dl_plan6_temp

# Conflicts: # README.md # amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/utils/DateUtils.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/fegin/IotFeign.java
parents 1b96529e e42c19db
...@@ -7,6 +7,9 @@ import java.text.DateFormat; ...@@ -7,6 +7,9 @@ import java.text.DateFormat;
import java.text.ParseException; import java.text.ParseException;
import java.text.ParsePosition; import java.text.ParsePosition;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
/** /**
...@@ -86,7 +89,19 @@ public class DateUtils { ...@@ -86,7 +89,19 @@ public class DateUtils {
} }
return returnValue; 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 * @return
...@@ -1015,6 +1030,115 @@ public class DateUtils { ...@@ -1015,6 +1030,115 @@ public class DateUtils {
return now; 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() { public static Date getBeginDayOfWeek() {
Date date = new Date(); Date date = new Date();
if (date == null) { if (date == null) {
......
...@@ -19,19 +19,14 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -19,19 +19,14 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
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.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.*; 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 { ...@@ -583,4 +578,42 @@ public class EmergencyController extends AbstractBaseController {
return CommonResponseUtil.success(iEmergencyService.getStockEquipStatistics()); 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()));
}
} }
...@@ -323,7 +323,7 @@ public class SupervisionConfigureController extends AbstractBaseController { ...@@ -323,7 +323,7 @@ public class SupervisionConfigureController extends AbstractBaseController {
fourHourEntity = iotFeign.selectList(getAppKey(), getProduct(), getToken(), four, nowStrLong, prefix, suffix, pressurePumpStart); fourHourEntity = iotFeign.selectList(getAppKey(), getProduct(), getToken(), four, nowStrLong, prefix, suffix, pressurePumpStart);
oneHourEntity = iotFeign.selectList(getAppKey(), getProduct(), getToken(), one, 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); 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) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -42,4 +42,6 @@ public interface EquipmentSpecificAlarmLogMapper extends BaseMapper<EquipmentSpe ...@@ -42,4 +42,6 @@ public interface EquipmentSpecificAlarmLogMapper extends BaseMapper<EquipmentSpe
Map<String, Object> alarmEquipLink(String date, String pattern, String cleanFlag); Map<String, Object> alarmEquipLink(String date, String pattern, String cleanFlag);
Map<String, Object> unCleanAlarmEquipLink(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);
} }
...@@ -240,6 +240,8 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> { ...@@ -240,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>> 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); Integer getAllEquipNum(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> normalIndexInfoList(@Param("startDate") String startDate, @Param("endDate") String endDate); List<Map<String, Object>> normalIndexInfoList(@Param("startDate") String startDate, @Param("endDate") String endDate);
......
...@@ -53,4 +53,8 @@ public interface IEmergencyService { ...@@ -53,4 +53,8 @@ public interface IEmergencyService {
List<Map<String, String>> getEquipExpiryList(Integer expiryDayNum); List<Map<String, String>> getEquipExpiryList(Integer expiryDayNum);
Map<String, Integer> getStockEquipStatistics(); 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 ...@@ -37,4 +37,15 @@ public interface IEquipmentSpecificAlarmLogService extends IService<EquipmentSpe
* @return * @return
*/ */
Map<String, Object> equipAlarmLink(String date); 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> { ...@@ -230,6 +230,13 @@ public interface IEquipmentSpecificSerivce extends IService<EquipmentSpecific> {
List<Map<String, Object>> getListByEquipmentCode(String code,String bizOrgCode); List<Map<String, Object>> getListByEquipmentCode(String code,String bizOrgCode);
List<Map<String, Object>> getFirePumpInfoEQ(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获取物联日志 * 根据装备id获取物联日志
* @param iotCode code * @param iotCode code
* @param entity 日志 * @param entity 日志
......
...@@ -66,4 +66,9 @@ public class EquipmentSpecificAlarmLogServiceImpl extends ServiceImpl<EquipmentS ...@@ -66,4 +66,9 @@ public class EquipmentSpecificAlarmLogServiceImpl extends ServiceImpl<EquipmentS
map.put("unCleanAlarmEquipMonthLink", unCleanAlarmEquipMonthLink); map.put("unCleanAlarmEquipMonthLink", unCleanAlarmEquipMonthLink);
return map; 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);
}
} }
...@@ -1852,6 +1852,16 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -1852,6 +1852,16 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
} }
@Override @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) { public List<IotIndexInfoVo> getIndexInfoList(String iotCode, ResponseModel entity, Integer isTrend, String fieldKey) {
List<IotIndexInfoVo> infoVoList = new ArrayList<>(); List<IotIndexInfoVo> infoVoList = new ArrayList<>();
String json = JSON.toJSONString(entity.getResult()); String json = JSON.toJSONString(entity.getResult());
......
...@@ -243,4 +243,34 @@ ...@@ -243,4 +243,34 @@
ORDER BY ORDER BY
ta.`date` ta.`date`
</select> </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> </mapper>
\ No newline at end of file
...@@ -1744,6 +1744,29 @@ ...@@ -1744,6 +1744,29 @@
</where> </where>
ORDER BY realtiemIotIndexUpdateDate DESC ORDER BY realtiemIotIndexUpdateDate DESC
</select> </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>
......
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