Commit 30de84de authored by KeYong's avatar KeYong

Merge remote-tracking branch 'origin/develop_dl_plan6_temp' into develop_dl_plan6_temp

parents ba1be8c5 c0bf78b9
package com.yeejoin.equipmanage.common.enums;
/**
* 一天内不同时段个数
*/
public enum DayHourEnum {
hour("小时", 24),
hafHour("半小时个数", 48),
twoHour("两小时个数", 12),
fourHour("四小时个数", 6);
private String name;
private int number;
DayHourEnum(String name, int number ){
this.name = name;
this.number = number;
}
public String getName() {
return name;
}
public int getNumber() {
return number;
}
}
......@@ -473,9 +473,10 @@ public class DateUtils {
* @throws ParseException
*/
public static int dateBetweenNew(Date startDate, Date endDate) throws ParseException {
Date dateStart = dateParse(dateFormat(startDate, DATE_PATTERN), DATE_PATTERN);
Date dateEnd = dateParse(dateFormat(endDate, DATE_PATTERN), DATE_PATTERN);
return (int) ((dateEnd.getTime() - dateStart.getTime()) / 1000 / 60 / 60);
Date dateStart = dateParse(dateFormat(startDate, DATE_TIME_PATTERN), DATE_TIME_PATTERN);
Date dateEnd = dateParse(dateFormat(endDate, DATE_TIME_PATTERN), DATE_TIME_PATTERN);
double ceil = Math.ceil((dateEnd.getTime() - dateStart.getTime()) * 1.0 / 1000 / 60 / 60);
return new Double(ceil).intValue() ;
}
/**
......@@ -487,9 +488,10 @@ public class DateUtils {
* @throws ParseException
*/
public static int dateBetweenNew1(Date startDate, Date endDate) throws ParseException {
Date dateStart = dateParse(dateFormat(startDate, DATE_PATTERN), DATE_PATTERN);
Date dateEnd = dateParse(dateFormat(endDate, DATE_PATTERN), DATE_PATTERN);
return (int) ((dateEnd.getTime() - dateStart.getTime()) / 1000 / 60 / 30);
Date dateStart = dateParse(dateFormat(startDate, DATE_TIME_PATTERN), DATE_TIME_PATTERN);
Date dateEnd = dateParse(dateFormat(endDate, DATE_TIME_PATTERN), DATE_TIME_PATTERN);
double ceil = Math.ceil((dateEnd.getTime() - dateStart.getTime()) * 1.0 / 1000 / 60 / 30);
return new Double(ceil).intValue() ;
}
/**
......@@ -501,9 +503,10 @@ public class DateUtils {
* @throws ParseException
*/
public static int dateBetweenNew2(Date startDate, Date endDate) throws ParseException {
Date dateStart = dateParse(dateFormat(startDate, DATE_PATTERN), DATE_PATTERN);
Date dateEnd = dateParse(dateFormat(endDate, DATE_PATTERN), DATE_PATTERN);
return (int) ((dateEnd.getTime() - dateStart.getTime()) / 1000 / 60 / 120);
Date dateStart = dateParse(dateFormat(startDate, DATE_TIME_PATTERN), DATE_TIME_PATTERN);
Date dateEnd = dateParse(dateFormat(endDate, DATE_TIME_PATTERN), DATE_TIME_PATTERN);
double ceil = Math.ceil((dateEnd.getTime() - dateStart.getTime()) * 1.0 / 1000 / 60 / 120);
return new Double(ceil).intValue() ;
}
/**
......@@ -515,9 +518,10 @@ public class DateUtils {
* @throws ParseException
*/
public static int dateBetweenNew3(Date startDate, Date endDate) throws ParseException {
Date dateStart = dateParse(dateFormat(startDate, DATE_PATTERN), DATE_PATTERN);
Date dateEnd = dateParse(dateFormat(endDate, DATE_PATTERN), DATE_PATTERN);
return (int) ((dateEnd.getTime() - dateStart.getTime()) / 1000 / 60 / 240);
Date dateStart = dateParse(dateFormat(startDate, DATE_TIME_PATTERN), DATE_TIME_PATTERN);
Date dateEnd = dateParse(dateFormat(endDate, DATE_TIME_PATTERN), DATE_TIME_PATTERN);
double ceil = Math.ceil((dateEnd.getTime() - dateStart.getTime()) * 1.0 / 1000 / 60 / 240);
return new Double(ceil).intValue() ;
}
/**
......
......@@ -577,7 +577,7 @@ public class EmergencyController extends AbstractBaseController {
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getPressurePumpStatusChart")
@ApiOperation(httpMethod = "GET", value = "四横八纵-稳压泵启停状态图", notes = "四横八纵-稳压泵启停状态图")
@ApiOperation(httpMethod = "GET", value = "四横八纵-稳压泵启停状态图", notes = "四横八纵-稳压泵启停状态图,取舍补点")
public ResponseModel getPressurePumpStatusChart(@RequestParam String startTime, @RequestParam String endTime,
@RequestParam(required = false) String bizOrgCode) {
if(StringUtils.isEmpty(bizOrgCode)) {
......@@ -595,6 +595,25 @@ public class EmergencyController extends AbstractBaseController {
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getPressurePumpStatusDetailChart")
@ApiOperation(httpMethod = "GET", value = "四横八纵-稳压泵启停状态图", notes = "四横八纵-稳压泵启停状态图,分钟级补点")
public ResponseModel getPressurePumpStatusDetailChart(@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.getPressurePumpStatusDetailChart(startTime, endTime, bizOrgCode));
}
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getPressurePumpDiagnosticAnalysis")
@ApiOperation(httpMethod = "GET", value = "四横八纵-稳压泵诊断分析", notes = "四横八纵-稳压泵诊断分析")
public ResponseModel getPressurePumpDiagnosticAnalysis(@RequestParam(required = false) String bizOrgCode) {
......
......@@ -57,6 +57,8 @@ public interface IEmergencyService {
Map<String, Object> getPressurePumpStatusChart(String startTime, String endTime, String bizOrgCode);
Map<String, Object> getPressurePumpStatusDetailChart(String startTime, String endTime, String bizOrgCode);
List<Map<String, Object>> getPressurePumpDiagnosticAnalysis(String bizOrgCode);
Page<Map<String, Object>> alarmList(Page<Map<String, Object>> page,String bizOrgCode, List<String> types, List<String> emergencyLevels, String name, Integer cleanStatus, Integer handleStatus);
......
......@@ -178,4 +178,11 @@ public interface IPressurePumpService {
* @return
*/
List<OrgUsrDto> getOrgUsrDtoInfo(Map<String, String> map);
/**
* 获取公司顶级bizOrgCode
* @param bizOrgCode
* @return
*/
String getCompanyBizOrgCode(String bizOrgCode);
}
......@@ -812,20 +812,13 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
// 计算平均每小时打压频率
try {
int hour = DateUtils.dateBetweenNew(DateUtils.dateParse(startTime, null),DateUtils.dateParse(endTime, null));
int hour = DateUtils.dateBetweenNew(DateUtils.dateParse(startTime, DateUtils.DATE_TIME_PATTERN),DateUtils.dateParse(endTime, DateUtils.DATE_TIME_PATTERN));
int hafHour = DateUtils.dateBetweenNew1(DateUtils.dateParse(startTime, null),DateUtils.dateParse(endTime, null));
int hafHour = DateUtils.dateBetweenNew1(DateUtils.dateParse(startTime, DateUtils.DATE_TIME_PATTERN),DateUtils.dateParse(endTime, DateUtils.DATE_TIME_PATTERN));
int twoHour = DateUtils.dateBetweenNew2(DateUtils.dateParse(startTime, null),DateUtils.dateParse(endTime, null));
int twoHour = DateUtils.dateBetweenNew2(DateUtils.dateParse(startTime, DateUtils.DATE_TIME_PATTERN),DateUtils.dateParse(endTime, DateUtils.DATE_TIME_PATTERN));
int fourHour = DateUtils.dateBetweenNew3(DateUtils.dateParse(startTime, null),DateUtils.dateParse(endTime, null));
// 开始时间与结束时间为同一天时 给默认值
if (hour == 0){
hour = DayHourEnum.hour.getNumber();
hafHour = DayHourEnum.hafHour.getNumber();
twoHour = DayHourEnum.twoHour.getNumber();
fourHour = DayHourEnum.fourHour.getNumber();
}
int fourHour = DateUtils.dateBetweenNew3(DateUtils.dateParse(startTime, DateUtils.DATE_TIME_PATTERN),DateUtils.dateParse(endTime, DateUtils.DATE_TIME_PATTERN));
if(allNum/hour > 15) {
retMap.put("status","异常");
} else {
......
......@@ -58,13 +58,8 @@ public class PressurePumpServiceImpl implements IPressurePumpService {
@Async
public void saveDataToRedis(List<IotDataVO> iotDatalist, String iotCode, String bizOrgCode) {
// 获取公司顶级bizOrgCode
Map<String, String> params = new HashMap<>();
params.put("bizOrgType", PressurePumpRelateEnum.BIZ_ORG_TYPE_COMPANY.getValue());
params.put("bizOrgCode", bizOrgCode);
List<OrgUsrDto> orgUsrDtoList = getOrgUsrDtoInfo(params);
if (CollectionUtils.isNotEmpty(orgUsrDtoList)) {
bizOrgCode = orgUsrDtoList.get(0).getBizOrgCode();
if (StringUtils.isNotBlank(bizOrgCode)) {
bizOrgCode = getCompanyBizOrgCode(bizOrgCode);
if (StringUtils.isNotBlank(bizOrgCode)) {
String pressurePumpValue = PressurePumpRelateEnum.PRESSURE_PUMP.getValue();
// 获取配置JSON信息集合
List<Map> list = getNameKeyInfoList(pressurePumpValue);
......@@ -84,6 +79,17 @@ public class PressurePumpServiceImpl implements IPressurePumpService {
}
}
}
@Override
public String getCompanyBizOrgCode(String bizOrgCode) {
Map<String, String> params = new HashMap<>();
params.put("bizOrgType", PressurePumpRelateEnum.BIZ_ORG_TYPE_COMPANY.getValue());
params.put("bizOrgCode", bizOrgCode);
List<OrgUsrDto> orgUsrDtoList = getOrgUsrDtoInfo(params);
if (CollectionUtils.isNotEmpty(orgUsrDtoList)) {
bizOrgCode = orgUsrDtoList.get(orgUsrDtoList.size() - 1).getBizOrgCode();
}
return bizOrgCode;
}
@Override
......@@ -303,6 +309,8 @@ public class PressurePumpServiceImpl implements IPressurePumpService {
PressurePumpCountVo countVo = new PressurePumpCountVo();
countVo.setTime(time);
countVo.setValue(dataMap.get(time).size());
// 获取公司顶级bizOrgCode
bizOrgCode = getCompanyBizOrgCode(bizOrgCode);
// 获取的数据存储到redis
String topic = String.join(":", infoCode, bizOrgCode, countRedisKey, fieldKey, iotCode, time);
countVo.setIotCode(topic);
......
......@@ -64,8 +64,9 @@
biz_org_type = #{bizOrgType}
</if>
<if test="bizOrgCode != null and bizOrgCode != ''">
AND locate( #{bizOrgCode}, biz_org_code ) > 0
AND locate( biz_org_code, #{bizOrgCode} ) > 0
</if>
</where>
ORDER BY sequence_nbr
</select>
</mapper>
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