|
|
@@ -9,14 +9,18 @@ import com.zd.laboratory.api.entity.SensorFunctionStatus;
|
|
|
import com.zd.laboratory.api.vo.SubFunction;
|
|
|
import com.zd.laboratory.config.HardwareFunctionStatusConfig;
|
|
|
import com.zd.laboratory.domain.LabHardware;
|
|
|
+import com.zd.laboratory.domain.LabRiskPlanAbnormalDesc;
|
|
|
import com.zd.laboratory.domain.LabRiskPlanAbnormalGroup;
|
|
|
import com.zd.laboratory.domain.LabRiskPlanAbnormalLog;
|
|
|
import com.zd.laboratory.domain.vo.LabRiskPlanAbnormalGroupVO;
|
|
|
import com.zd.laboratory.mapper.LabHardwareMapper;
|
|
|
+import com.zd.laboratory.mapper.LabHardwareStateMapper;
|
|
|
import com.zd.laboratory.mapper.LabRiskPlanAbnormalGroupMapper;
|
|
|
import com.zd.laboratory.mapper.LabRiskPlanAbnormalLogMapper;
|
|
|
import com.zd.laboratory.service.ILabExitLineService;
|
|
|
+import com.zd.laboratory.service.ILabRiskPlanAbnormalDescService;
|
|
|
import com.zd.laboratory.service.ILabRiskPlanAbnormalGroupService;
|
|
|
+import com.zd.model.entity.SysUser;
|
|
|
import com.zd.model.enums.HardwareTypeEnum;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
@@ -24,10 +28,7 @@ import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Collections;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Optional;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
@@ -44,19 +45,25 @@ public class LabRiskPlanAbnormalGroupServiceImpl implements ILabRiskPlanAbnormal
|
|
|
private LabRiskPlanAbnormalGroupMapper labRiskPlanAbnormalGroupMapper;
|
|
|
|
|
|
@Autowired
|
|
|
- HardwareFunctionStatusConfig hardwareFunctionStatusConfig;
|
|
|
+ private HardwareFunctionStatusConfig hardwareFunctionStatusConfig;
|
|
|
@Autowired
|
|
|
private LabHardwareMapper labHardwareMapper;
|
|
|
@Autowired
|
|
|
private LabRiskPlanAbnormalLogMapper labRiskPlanAbnormalLogMapper;
|
|
|
|
|
|
@Autowired
|
|
|
+ private LabHardwareStateMapper hardwareStateMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
private ILabExitLineService labExitLineService;
|
|
|
|
|
|
@Autowired
|
|
|
private LabSubjectManagerService labSubjectManagerService;
|
|
|
|
|
|
@Autowired
|
|
|
+ private ILabRiskPlanAbnormalDescService labRiskPlanAbnormalDescService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
private RedisService redisService;
|
|
|
|
|
|
|
|
|
@@ -64,7 +71,6 @@ public class LabRiskPlanAbnormalGroupServiceImpl implements ILabRiskPlanAbnormal
|
|
|
// @DataScope(deptAlias = "t")
|
|
|
public List <LabRiskPlanAbnormalGroupVO> selectLabRiskPlanAbnormalGroupList(LabRiskPlanAbnormalGroup labRiskPlanAbnormalGroup) {
|
|
|
List <LabRiskPlanAbnormalGroupVO> groupList = labRiskPlanAbnormalGroupMapper.selectLabRiskPlanAbnormalGroupListByDept(labRiskPlanAbnormalGroup);
|
|
|
-
|
|
|
Optional.ofNullable(groupList).filter(a->a.size()>0).orElseGet(Collections::emptyList).stream().forEach(a->{
|
|
|
LabRiskPlanAbnormalLog labRiskPlanAbnormalLog = new LabRiskPlanAbnormalLog();
|
|
|
labRiskPlanAbnormalLog.setGroupId(a.getId());
|
|
|
@@ -83,7 +89,6 @@ public class LabRiskPlanAbnormalGroupServiceImpl implements ILabRiskPlanAbnormal
|
|
|
}
|
|
|
});
|
|
|
a.setSensorStr(sensorStr.toString());
|
|
|
-
|
|
|
//根据实验室id和设备类型查询硬件列表
|
|
|
LabHardware labHardware = new LabHardware();
|
|
|
labHardware.setSubjectId(a.getSubjectId());
|
|
|
@@ -98,12 +103,10 @@ public class LabRiskPlanAbnormalGroupServiceImpl implements ILabRiskPlanAbnormal
|
|
|
}catch (Exception e){
|
|
|
a.setWhetherRoute(false);
|
|
|
}
|
|
|
-
|
|
|
});
|
|
|
return groupList;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 查询实验室当前预警测点功能
|
|
|
*
|
|
|
@@ -118,23 +121,9 @@ public class LabRiskPlanAbnormalGroupServiceImpl implements ILabRiskPlanAbnormal
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
logger.info("一体机预案异常类型:" + JSONUtil.toJsonStr(strings) + ", 实验室ID------" + subId);
|
|
|
-
|
|
|
-// final Map<String, SensorFunctionStatus> mapFunNum = hardwareFunctionStatusConfig.getMapFunNum();
|
|
|
-
|
|
|
- /*return Optional.ofNullable(strings)
|
|
|
- .filter(a -> a.size() > 0)
|
|
|
- .orElseGet(Collections::emptyList)
|
|
|
- .stream()
|
|
|
- .distinct()
|
|
|
- .map(a -> mapFunNum.get(a))
|
|
|
- .collect(Collectors.toList());*/
|
|
|
-
|
|
|
List<SensorFunctionStatus> list = labSubjectManagerService.querySenseNewFunctionBySubId(subId);
|
|
|
logger.info("一体机预案实验室数据:" + JSONUtil.toJsonStr(list));
|
|
|
-
|
|
|
list = list.stream().filter( s -> strings.stream().filter(f -> f.equals(s.getFunNum())).findAny().isPresent()).collect(Collectors.toList());
|
|
|
-
|
|
|
-
|
|
|
if(strings.stream().filter(m->m.equals("huoyan")).findAny().isPresent()){
|
|
|
|
|
|
SubFunction subFunction = redisService.getCacheObject("subjectByHuoyan"+subId);
|
|
|
@@ -143,10 +132,58 @@ public class LabRiskPlanAbnormalGroupServiceImpl implements ILabRiskPlanAbnormal
|
|
|
list.addAll(subFunction.getFunctionStatuses());
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
logger.info("一体机预案过滤结果:" + JSONUtil.toJsonStr(list));
|
|
|
-
|
|
|
return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<LabRiskPlanAbnormalGroup> queryRiskExeRecordList(LabRiskPlanAbnormalGroup group) {
|
|
|
+ return labRiskPlanAbnormalGroupMapper.queryRiskExeRecordList(group);
|
|
|
+ }
|
|
|
|
|
|
+ @Override
|
|
|
+ public boolean addRiskExeRecord(String riskPlanName, long subjectId, String subjectName, Integer riskAttribute, String riskReason, int riskLevel) {
|
|
|
+ LabRiskPlanAbnormalGroup group = new LabRiskPlanAbnormalGroup();
|
|
|
+ group.setGroupName(riskPlanName);
|
|
|
+ group.setSubjectId(subjectId);
|
|
|
+ group.setSubjectName(subjectName);
|
|
|
+ group.setRiskAttribute(riskAttribute);
|
|
|
+ group.setStatus(1L);
|
|
|
+ Date now = new Date();
|
|
|
+ group.setCreateTime(now);
|
|
|
+ if(labRiskPlanAbnormalGroupMapper.insertLabRiskPlanAbnormalGroup(group) > 0) {
|
|
|
+ //获取实验室内人员
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+ params.put("subId",subjectId);
|
|
|
+ List<SysUser> users = hardwareStateMapper.querySubOnlineUserByOnepc(params);
|
|
|
+ String internalPerson = null;
|
|
|
+ if (users != null && users.size() > 0) {
|
|
|
+ internalPerson = users.stream().map(SysUser::getUserName).collect(Collectors.joining(","));
|
|
|
+ }
|
|
|
+ if(labRiskPlanAbnormalDescService.addLabRiskPlanAbnormalDesc(group.getId(), riskReason, riskLevel, internalPerson) > 0){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean doneRiskExeRecord(long groupId, String handledPerson, String recordVideo) {
|
|
|
+ LabRiskPlanAbnormalGroup group = new LabRiskPlanAbnormalGroup();
|
|
|
+ group.setId(groupId);
|
|
|
+ group.setStatus(0l);
|
|
|
+ group.setUpdateTime(new Date());
|
|
|
+ int result = labRiskPlanAbnormalGroupMapper.updateLabRiskPlanAbnormalGroup(group);
|
|
|
+ if (result > 0) {
|
|
|
+ LabRiskPlanAbnormalDesc desc = new LabRiskPlanAbnormalDesc();
|
|
|
+ desc.setGroupId(groupId);
|
|
|
+ List<LabRiskPlanAbnormalDesc> list = labRiskPlanAbnormalDescService.selectByList(desc);
|
|
|
+ if (list != null && list.size() >0
|
|
|
+ && labRiskPlanAbnormalDescService.updateLabRiskPlanAbnormalDesc(list.get(0).getDescId(),handledPerson, recordVideo) > 0) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return false;
|
|
|
}
|
|
|
}
|