Browse Source

#检修流程

zhongwei
yang_shj 1 year ago
parent
commit
7cd5a66be9
  1. 20
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/RealVo.java
  2. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml
  3. 10
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessTaskV4ServiceImpl.java
  4. 42
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/DeviceDataController.java
  5. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/DeviceDataService.java
  6. 75
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/DeviceDataServiceImpl.java

20
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;
}

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml

@ -77,10 +77,10 @@
<if test="req.excludeNullTicket != null and req.excludeNullTicket == 1"> <if test="req.excludeNullTicket != null and req.excludeNullTicket == 1">
and t1.`TICKET_ID` is null and t1.`TICKET_ID` is null
</if> </if>
<if test="req.startTime != null"> <if test="req.startTime != null and req.startTime != ''">
and t1.`PLAN_START_TIME` &gt; #{req.startTime} and t1.`PLAN_START_TIME` &gt; #{req.startTime}
</if> </if>
<if test="req.endTime != null"> <if test="req.endTime != null and req.startTime != '' ">
and t1.`PLAN_START_TIME` &lt; #{req.endTime} and t1.`PLAN_START_TIME` &lt; #{req.endTime}
</if> </if>
<if test="req.deptIds != null"> <if test="req.deptIds != null">

10
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")){ if(ObjectUtil.isNotEmpty(variables.get("examine")) && (Boolean) variables.get("examine")){
entity.setTaskName("流程结束"); entity.setTaskName("流程结束");
entity.setNextStepOperator("流程结束,无需人员处理"); entity.setNextStepOperator("流程结束,无需人员处理");
// 更新任务数据
this.taskService.updateById(entity);
// 检修台账保存 // 检修台账保存
this.statiticsSave(entity); this.statiticsSave(entity);
// 更新任务数据
return this.taskService.updateById(entity);
}else if(ObjectUtil.isEmpty(variables.get("examine")) && !(Boolean) variables.get("examine")){ }else if(ObjectUtil.isEmpty(variables.get("examine")) && !(Boolean) variables.get("examine")){
String content = "您有一条检修任务待处理!检修任务名称:".concat(entity.getName()) String content = "您有一条检修任务待处理!检修任务名称:".concat(entity.getName())
.concat(",当前环节:") .concat(",当前环节:")
@ -235,13 +235,13 @@ public class AccessTaskV4ServiceImpl implements AccessTaskV4Service {
* 检修台账保存 * 检修台账保存
* @param entity * @param entity
*/ */
private void statiticsSave(AccessTaskV4DTO entity) { private boolean statiticsSave(AccessTaskV4DTO entity) {
// 查询台账记录 // 查询台账记录
List<OperAccessStatisticsEntity> statistics = statisticsService.list(new LambdaQueryWrapper<OperAccessStatisticsEntity>() {{ List<OperAccessStatisticsEntity> statistics = statisticsService.list(new LambdaQueryWrapper<OperAccessStatisticsEntity>() {{
eq(OperAccessStatisticsEntity::getTaskId, entity.getId()); eq(OperAccessStatisticsEntity::getTaskId, entity.getId());
}}); }});
if(CollectionUtil.isEmpty(statistics)){ if(CollectionUtil.isEmpty(statistics)){
return; return true;
} }
OperAccessStatisticsDTO statisticsDTO = BeanUtil.copy(entity, OperAccessStatisticsDTO.class); OperAccessStatisticsDTO statisticsDTO = BeanUtil.copy(entity, OperAccessStatisticsDTO.class);
statisticsDTO.setId(null); statisticsDTO.setId(null);
@ -251,6 +251,6 @@ public class AccessTaskV4ServiceImpl implements AccessTaskV4Service {
if (ObjectUtil.isNotEmpty(content)) { if (ObjectUtil.isNotEmpty(content)) {
statisticsDTO.setPid(content.getLibraryId()); statisticsDTO.setPid(content.getLibraryId());
} }
statisticsService.doSave(statisticsDTO); return statisticsService.save(statisticsDTO);
} }
} }

42
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<RealVo> 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<RealVo> history(@RequestParam(value = "code") String code,
@RequestParam(value = "signages") String signages) {
return R.data(service.real(code,signages));
}
}

12
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);
}

75
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<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_cofig_final).toString(), new TypeReference<List<EminfoAndEmParamVo>>() {
});
if(CollectionUtil.isEmpty(devices)){
throw new ServiceException("不存在设备!");
}
List<EminfoAndEmParamVo> filters = devices.stream().filter(device->device.getEmCode().equals(code)).collect(Collectors.toList());
if(CollectionUtil.isEmpty(filters)){
throw new ServiceException("不存在设备!");
}
// 设备标识
Map<String,String> 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<String, String> getRealMap() {
String json = (String) redisTemplate.opsForValue().get(real_id_cofig_final);
if(StringUtil.isBlank(json)){
return null;
}
return JSONObject.parseObject(json, new TypeReference<Map<String, String>>() {});
}
}
Loading…
Cancel
Save