diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java index 34e6b42..c9e2c24 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java @@ -8,10 +8,8 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.NullSerializer; import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; import org.springblade.core.mp.support.QueryField; import org.springblade.core.tenant.mp.TenantEntity; import org.springblade.core.tool.utils.DateUtil; @@ -191,4 +189,7 @@ public class StationEntity extends TenantEntity implements Serializable { @ApiModelProperty("删除记录ID") private Long deletedId; + + @ApiModelProperty("站点在线状态 0-在线 1-离线") + private Integer onLine; } diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/electric/service/impl/RunTemplateServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/electric/service/impl/RunTemplateServiceImpl.java index b727720..32dce82 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/electric/service/impl/RunTemplateServiceImpl.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/electric/service/impl/RunTemplateServiceImpl.java @@ -1,11 +1,16 @@ package com.hnac.hzims.electric.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hnac.hzims.electric.entity.RunTemplateEntity; import com.hnac.hzims.electric.mapper.RunTemplateMapper; import com.hnac.hzims.electric.service.IRunTemplateService; +import com.hnac.hzims.history.entity.HistoryTemplateEntity; import com.hnac.hzims.history.vo.HistoryTemplateParamVo; +import org.springblade.core.secure.utils.AuthUtil; +import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.core.tool.utils.StringUtil; import org.springframework.stereotype.Service; /** @@ -23,6 +28,12 @@ public class RunTemplateServiceImpl extends ServiceImpl pageCondition(HistoryTemplateParamVo params, IPage page) { - return null; + LambdaQueryWrapper wrapper = new LambdaQueryWrapper(); + wrapper.eq(RunTemplateEntity::getCreateUser, AuthUtil.getUserId()); + wrapper.orderByDesc(RunTemplateEntity::getCreateTime); + if(StringUtil.isNotBlank(params.getStationId())){ + wrapper.eq(RunTemplateEntity::getStationId,params.getStationId()); + } + return super.page(page,wrapper); } } diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryTemplateServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryTemplateServiceImpl.java index 6a0244e..cbac715 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryTemplateServiceImpl.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryTemplateServiceImpl.java @@ -7,6 +7,7 @@ import com.hnac.hzims.history.entity.HistoryTemplateEntity; import com.hnac.hzims.history.mapper.HistoryTemplateMapper; import com.hnac.hzims.history.service.IHistoryTemplateService; import com.hnac.hzims.history.vo.HistoryTemplateParamVo; +import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.StringUtil; import org.springframework.stereotype.Service; @@ -26,13 +27,11 @@ public class HistoryTemplateServiceImpl extends ServiceImpl pageCondition(HistoryTemplateParamVo params, IPage page) { LambdaQueryWrapper wrapper = new LambdaQueryWrapper(); + wrapper.eq(HistoryTemplateEntity::getCreateUser,AuthUtil.getUserId()); wrapper.orderByDesc(HistoryTemplateEntity::getCreateTime); if(StringUtil.isNotBlank(params.getStationId())){ wrapper.eq(HistoryTemplateEntity::getStationId,params.getStationId()); } - if(ObjectUtil.isNotEmpty(params.getCreateUser())){ - wrapper.eq(HistoryTemplateEntity::getCreateUser,params.getCreateUser()); - } return super.page(page,wrapper); } diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/vo/DeviceModelData.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/vo/DeviceModelData.java index 9385b1f..7bebc16 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/vo/DeviceModelData.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/vo/DeviceModelData.java @@ -139,23 +139,23 @@ public class DeviceModelData { /** * 类型,0:属性,1:功能,2:事件 */ - private Integer type; + private String type; public static DeviceModelData of(ModelAttrVO data) { DeviceModelData deviceModelData = Func.copyProperties(data, DeviceModelData.class); - deviceModelData.setType(0); + deviceModelData.setType("0"); return deviceModelData; } public static DeviceModelData of(ModelFuncVO data) { DeviceModelData deviceModelData = Func.copyProperties(data, DeviceModelData.class); - deviceModelData.setType(1); + deviceModelData.setType("1"); return deviceModelData; } public static DeviceModelData of(ModelEventVO data) { DeviceModelData deviceModelData = Func.copyProperties(data, DeviceModelData.class); - deviceModelData.setType(2); + deviceModelData.setType("2"); return deviceModelData; } } diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java index 6e962f2..3d6cb16 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java @@ -56,6 +56,22 @@ public class MonitorScheduledTask { } /** + * 站点在线状态同步 + * @return ReturnT + */ + //@XxlJob(REAL_TIME_DATA) + @Scheduled(cron = "0/40 * * * * ? ") + public ReturnT loadStationOnLine() { + String param = ""; + if (Func.isBlank(param)) { + param = DateUtil.format(new Date(), "yyyy-MM"); + } + service.loadStationOnLine(param); + return new ReturnT<>("SUCCESS"); + } + + + /** * 集中监控数据处理 * @return ReturnT */ diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java index 71337ab..12db9f1 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java @@ -257,7 +257,7 @@ public class AlarmServiceImpl implements AlarmService { } // 批量保存中断告警数据 this.interruptionAlarmService.saveBatch(entities); - // FIXME 发送HZ3000中通讯告警 + // 发送HZ3000中通讯告警 this.sendInterruptionMsg(entities); } @@ -284,7 +284,6 @@ public class AlarmServiceImpl implements AlarmService { }); } - /** * 查询当天数据中断告警记录 * @param stations diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/MonitorService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/MonitorService.java index dcfaae7..8394f20 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/MonitorService.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/MonitorService.java @@ -12,6 +12,9 @@ public interface MonitorService { // 实时数据刷新 void loadRealData(String param); + // 站点在线状态刷新 + void loadStationOnLine(String param); + // 集中监控数据处理 void loadMonitoring(String param); } diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java index 0dfd7c4..919ae93 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java @@ -83,6 +83,8 @@ public class MonitorServiceImpl implements MonitorService { private final IAnalyseDataSearchClient analyseDataSearchClient; + private static final String STATION_ON_LINE_KEY = "iot:real:data:"; + private static final ExecutorService pool = new ThreadPoolExecutor(20, 20, 2L, TimeUnit.MINUTES, new LinkedBlockingQueue<>(256), new ThreadFactoryBuilder().setNameFormat("load-monitoring-pool-%d").build(), new ThreadPoolExecutor.CallerRunsPolicy()); private static boolean isSendMail = true; @@ -247,6 +249,37 @@ public class MonitorServiceImpl implements MonitorService { } /** + * 站点在线状态刷新 + * @param param + */ + @Override + public void loadStationOnLine(String param) { + // 查询接入站点 + List stations = stationService.list(Wrappers.lambdaQuery() + .eq(StationEntity::getDataOrigin,0) + ); + if(CollectionUtil.isEmpty(stations)){ + return; + } + stations.forEach(station->{ + // 在线 + if(redisTemplate.hasKey(STATION_ON_LINE_KEY + station.getCode()) && station.getOnLine() == 1){ + stationService.update(Wrappers.lambdaUpdate() + .set(StationEntity::getOnLine,0) + .eq(StationEntity::getId,station.getId()) + ); + // 离线 + }else if(!redisTemplate.hasKey(STATION_ON_LINE_KEY + station.getCode()) && station.getOnLine() == 0){ + stationService.update(Wrappers.lambdaUpdate() + .set(StationEntity::getOnLine,1) + .eq(StationEntity::getId,station.getId()) + ); + } + }); + } + + + /** * 计算切分次数 */ private static Integer countStep(Integer size) { diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/allTicket/controller/TicketInfoEvaluateController.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/allTicket/controller/TicketInfoEvaluateController.java index e1df885..38adb11 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/allTicket/controller/TicketInfoEvaluateController.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/allTicket/controller/TicketInfoEvaluateController.java @@ -43,6 +43,7 @@ public class TicketInfoEvaluateController extends BladeController { private final IWorkTicketInfoService workTicketInfoService; private final IStandardTicketInfoService standardTicketInfoService; + @PostMapping("/save") @ApiOperationSupport(order = 20) @ApiOperation(value = "新增")