diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/RealVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/RealVo.java
new file mode 100644
index 0000000..64f18ef
--- /dev/null
+++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/RealVo.java
@@ -0,0 +1,20 @@
+package com.hnac.hzims.operational.census.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @author ysj
+ */
+@Data
+public class RealVo {
+
+ @ApiModelProperty("realId")
+ private String realId;
+
+ @ApiModelProperty("值")
+ private String value;
+
+ @ApiModelProperty("质量值")
+ private String quality;
+}
diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml
index e8f9b95..b876795 100644
--- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml
+++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml
@@ -77,10 +77,10 @@
and t1.`TICKET_ID` is null
-
+
and t1.`PLAN_START_TIME` > #{req.startTime}
-
+
and t1.`PLAN_START_TIME` < #{req.endTime}
diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessTaskV4ServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessTaskV4ServiceImpl.java
index 3dff7ec..209ae0f 100644
--- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessTaskV4ServiceImpl.java
+++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessTaskV4ServiceImpl.java
@@ -179,10 +179,10 @@ public class AccessTaskV4ServiceImpl implements AccessTaskV4Service {
if(ObjectUtil.isNotEmpty(variables.get("examine")) && (Boolean) variables.get("examine")){
entity.setTaskName("流程结束");
entity.setNextStepOperator("流程结束,无需人员处理");
- // 更新任务数据
- this.taskService.updateById(entity);
// 检修台账保存
this.statiticsSave(entity);
+ // 更新任务数据
+ return this.taskService.updateById(entity);
}else if(ObjectUtil.isEmpty(variables.get("examine")) && !(Boolean) variables.get("examine")){
String content = "您有一条检修任务待处理!检修任务名称:".concat(entity.getName())
.concat(",当前环节:")
@@ -235,13 +235,13 @@ public class AccessTaskV4ServiceImpl implements AccessTaskV4Service {
* 检修台账保存
* @param entity
*/
- private void statiticsSave(AccessTaskV4DTO entity) {
+ private boolean statiticsSave(AccessTaskV4DTO entity) {
// 查询台账记录
List statistics = statisticsService.list(new LambdaQueryWrapper() {{
eq(OperAccessStatisticsEntity::getTaskId, entity.getId());
}});
if(CollectionUtil.isEmpty(statistics)){
- return;
+ return true;
}
OperAccessStatisticsDTO statisticsDTO = BeanUtil.copy(entity, OperAccessStatisticsDTO.class);
statisticsDTO.setId(null);
@@ -251,6 +251,6 @@ public class AccessTaskV4ServiceImpl implements AccessTaskV4Service {
if (ObjectUtil.isNotEmpty(content)) {
statisticsDTO.setPid(content.getLibraryId());
}
- statisticsService.doSave(statisticsDTO);
+ return statisticsService.save(statisticsDTO);
}
}
\ No newline at end of file
diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/DeviceDataController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/DeviceDataController.java
new file mode 100644
index 0000000..34bfe68
--- /dev/null
+++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/DeviceDataController.java
@@ -0,0 +1,42 @@
+package com.hnac.hzims.operational.census.controller;
+
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import com.hnac.hzims.operational.census.service.DeviceDataService;
+import com.hnac.hzims.operational.census.vo.RealVo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import org.springblade.core.tool.api.R;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+
+/**
+ * @author ysj
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/device")
+@Api(value = "设备数据查询", tags = "设备数据查询")
+public class DeviceDataController {
+
+ private final DeviceDataService service;
+
+ @ApiOperation("实时数据查询")
+ @PostMapping("/real")
+ @ApiOperationSupport(order = 1)
+ public R real(@RequestParam(value = "code") String code,
+ @RequestParam(value = "signages") String signages) {
+ return R.data(service.real(code,signages));
+ }
+
+ @ApiOperation("实时数据查询")
+ @PostMapping("/history")
+ @ApiOperationSupport(order = 1)
+ public R history(@RequestParam(value = "code") String code,
+ @RequestParam(value = "signages") String signages) {
+ return R.data(service.real(code,signages));
+ }
+}
\ No newline at end of file
diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/DeviceDataService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/DeviceDataService.java
new file mode 100644
index 0000000..f9aaa2d
--- /dev/null
+++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/DeviceDataService.java
@@ -0,0 +1,12 @@
+package com.hnac.hzims.operational.census.service;
+
+
+import com.hnac.hzims.operational.census.vo.RealVo;
+
+/**
+ * @author ysj
+ */
+public interface DeviceDataService {
+
+ RealVo real(String code, String signages);
+}
\ No newline at end of file
diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/DeviceDataServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/DeviceDataServiceImpl.java
new file mode 100644
index 0000000..6f284f5
--- /dev/null
+++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/DeviceDataServiceImpl.java
@@ -0,0 +1,75 @@
+package com.hnac.hzims.operational.census.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.TypeReference;
+import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
+import com.hnac.hzims.operational.census.service.DeviceDataService;
+import com.hnac.hzims.operational.census.vo.RealVo;
+import lombok.RequiredArgsConstructor;
+import org.apache.commons.collections4.MapUtils;
+import org.springblade.core.log.exception.ServiceException;
+import org.springblade.core.tool.utils.CollectionUtil;
+import org.springblade.core.tool.utils.StringUtil;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @author ysj
+ */
+@Service
+@RequiredArgsConstructor
+public class DeviceDataServiceImpl implements DeviceDataService {
+
+ private final RedisTemplate redisTemplate;
+
+ @Value("${hzims.operation.realIdKey}")
+ public String real_id_cofig_final;
+
+ public String device_cache_cofig_final = "hzims:equipment:emInfo:deviceCode.emInfoList";
+
+ @Override
+ public RealVo real(String code, String signages) {
+ // 缓存设备数据
+ List devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_cofig_final).toString(), new TypeReference>() {
+ });
+ if(CollectionUtil.isEmpty(devices)){
+ throw new ServiceException("不存在设备!");
+ }
+ List filters = devices.stream().filter(device->device.getEmCode().equals(code)).collect(Collectors.toList());
+ if(CollectionUtil.isEmpty(filters)){
+ throw new ServiceException("不存在设备!");
+ }
+ // 设备标识
+ Map point = filters.get(0).getPoint();
+ if(MapUtils.isEmpty(point)){
+ throw new ServiceException("设备未绑定模型实列监测点位!");
+ }
+ if(!point.containsKey(signages)){
+ throw new ServiceException("设备未绑定模型实列监测点位!");
+ }
+ // 查找realId数据
+ RealVo real = new RealVo();
+ real.setRealId(point.get(signages));
+ real.setValue(this.getRealMap().get(real.getRealId()));
+ real.setQuality("0");
+ return real;
+ }
+
+
+ /**
+ * 获取实时数据
+ * @return
+ */
+ private Map getRealMap() {
+ String json = (String) redisTemplate.opsForValue().get(real_id_cofig_final);
+ if(StringUtil.isBlank(json)){
+ return null;
+ }
+ return JSONObject.parseObject(json, new TypeReference