hecheng 3 年之前
父節點
當前提交
7d76a7f65d

+ 6 - 3
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabAbnormalServiceImpl.java

@@ -87,14 +87,17 @@ public class LabAbnormalServiceImpl implements ILabAbnormalService {
         List<LabAbnormalVO> labAbnormalList = labAbnormalMapper.getEquipmentList(labAbnormal);
         for(LabAbnormalVO labAbnormalVO:labAbnormalList){
             LabAbnormalVO labAbnormalVO1 = new LabAbnormalVO();
-            if(labAbnormalVO.getEquipmentType()==1){
+            Integer equipmentType = labAbnormalVO.getEquipmentType();
+            if(equipmentType!=null && labAbnormalVO.getEquipmentType()==1){
                 labAbnormalVO1.setHardwareId(labAbnormalVO.getId());
             }else{
                 labAbnormalVO1.setSensorId(labAbnormalVO.getId());
             }
             LabAbnormalVO newLabAbnormalVO = labAbnormalMapper.getEquipmentVo(labAbnormalVO1);
-            labAbnormalVO.setAbnormalReason(newLabAbnormalVO.getAbnormalReason());
-            labAbnormalVO.setLastAbnormalTime(newLabAbnormalVO.getCreateTime());
+            if (newLabAbnormalVO!=null){
+                labAbnormalVO.setAbnormalReason(newLabAbnormalVO.getAbnormalReason());
+                labAbnormalVO.setLastAbnormalTime(newLabAbnormalVO.getCreateTime());
+            }
         }
         return labAbnormalList;
     }

+ 2 - 3
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabBuildingServiceImpl.java

@@ -176,8 +176,8 @@ public class LabBuildingServiceImpl implements ILabBuildingService {
                 return newFloorList;
             } else {
                 List<LabSubjectLayout> oldLayoutList = labSubjectLayoutMapper.selectLayoutListByIds(ids);
-                List<Map<String, Object>> newFloorList = oldFloorList.stream().map(a -> {
-                    List<LabSubjectLayout> newLayoutList = oldLayoutList.stream().filter(h -> h.getFloorId().equals(a.getId())).collect(Collectors.toList());
+                return oldFloorList.stream().map(a -> {
+                    List<LabSubjectLayout> newLayoutList = oldLayoutList.stream().filter(h->h.getFloorId()!=null).filter(h -> h.getFloorId().equals(a.getId())).collect(Collectors.toList());
                     Map<String, Object> floorMap = new HashMap<>();
                     floorMap.put("id", a.getId());
                     floorMap.put("name", a.getName());
@@ -186,7 +186,6 @@ public class LabBuildingServiceImpl implements ILabBuildingService {
                     floorMap.put("list", newLayoutList);
                     return floorMap;
                 }).collect(Collectors.toList());
-                return newFloorList;
             }
         }
         return new ArrayList<>();

+ 2 - 0
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabSensorMapper.xml

@@ -32,6 +32,8 @@
 
     <resultMap type="com.zd.laboratory.domain.vo.LabSensorVO" id="LabSensorVOResult">
         <result property="subjectName" column="subject_name"/>
+        <result property="type" column="type" typeHandler="org.apache.ibatis.type.EnumOrdinalTypeHandler"/>
+        <result property="senseState" column="sense_state" typeHandler="org.apache.ibatis.type.EnumOrdinalTypeHandler"/>
     </resultMap>
 
     <!--   select id, name, factory, type, sense_data, data_upper, data_lower, mac_add, subject_id, dept_id, create_time, dept_name, user_id, create_by, update_time, update_by, remark from lab_sensor-->