Преглед изворни кода

Merge remote-tracking branch 'origin/dbdx' into dbdx

xuxiaofei пре 2 година
родитељ
комит
c7893a504f

+ 2 - 12
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabExitLineVertexServiceImpl.java

@@ -120,14 +120,6 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
      */
     @Override
     public int getCalculationLine(LabExitLineVertex labExitLineVertex) {
-//        List<LabExitLineVertex> labExitLineVOList = labExitLineVertexMapper.selectLabExitLineVertexList(labExitLineVertex);
-//        if(labExitLineVOList.size()>0){
-//            String relationData = labExitLineVOList.get(0).getRelationalData();
-//            List <LabExitLineJoinPointVO> relationalData = JSONArray.parseArray(relationData, LabExitLineJoinPointVO.class);
-//            V=relationalData.size();
-//            ArrayList <Integer[][]> list=flody(relationalData);
-//            display_path(list,relationalData);
-//        }
         return 1;
     }
 
@@ -740,10 +732,8 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
                     a.setSubBottle(Boolean.FALSE);
                     //这里查询一下实验室是否有气瓶
                     ResultData <List <Map<String,Object>>> beaconData = remoteAirBottleService.findBySubId(b.getId());
-                    if(beaconData.getCode()==200){
-                        if(beaconData.getData().size()>0){
-                            a.setSubBottle(Boolean.TRUE);
-                        }
+                    if(beaconData.getCode()==200 && beaconData.getData().size()>0){
+                        a.setSubBottle(Boolean.TRUE);
                     }
                 }));
         //实验室下的在线人员

+ 0 - 16
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabHaikangUserServiceImpl.java

@@ -72,12 +72,7 @@ public class LabHaikangUserServiceImpl implements LabHaikangUserService {
     @Override
     public boolean deleteByIds(Long... id) {
         for (Long i : id) {
-            LabHaikangUser haikangUser = labHaikangUserMapper.queryById(i);
             this.labHaikangUserMapper.deleteById(i);
-
-           /* if(haikangUser.isState()){
-                haiKangDoorService.deleteUserDoorByHardId(haikangUser.getHardId(), haikangUser, tokenService.getLoginUser());
-            }*/
         }
         return true;
     }
@@ -120,10 +115,6 @@ public class LabHaikangUserServiceImpl implements LabHaikangUserService {
                 SaveUtil.setCommonAttr(entitie);
                 entities.add(entitie);
             }
-//            int count = labHaikangUserMapper.insertBatch(entities);
-//            if(count > 0){
-//                haiKangDoorService.addUserDoorByHardId(haikangAddUserVo.getHardId(), entities, tokenService.getLoginUser());
-//            }
             return 1;
         }
         return 0;
@@ -151,12 +142,6 @@ public class LabHaikangUserServiceImpl implements LabHaikangUserService {
         });
 
         if(entities.size() > 0){
-
-            LabHaikangUser haikangUser = new LabHaikangUser();
-            haikangUser.setIds(entities.stream().map(LabHaikangUser::getId).collect(Collectors.toList()));
-
-            List<LabHaikangUser> list = labHaikangUserMapper.queryAll(haikangUser);
-            //haiKangDoorService.updateUserInfo(list);
             return 1;
         }
 
@@ -180,7 +165,6 @@ public class LabHaikangUserServiceImpl implements LabHaikangUserService {
             if(list.size() != ids.size()){
                 throw new ServiceException("参数异常!请重试!");
             }
-            //haiKangDoorService.addUserDoorByHardId(haikangAddUserVo.getHardId(), list, tokenService.getLoginUser());
             return list.size();
         }
         return 0;

+ 8 - 39
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabHardwareServiceImpl.java

@@ -6,7 +6,6 @@ import com.zd.common.core.annotation.DataScope;
 import com.zd.common.core.exception.NoRollException;
 import com.zd.common.core.exception.ServiceException;
 import com.zd.common.core.redis.RedisService;
-import com.zd.common.core.security.TokenService;
 import com.zd.common.core.utils.DateUtils;
 import com.zd.common.core.utils.SaveUtil;
 import com.zd.common.core.utils.StringUtils;
@@ -78,9 +77,6 @@ public class LabHardwareServiceImpl implements ILabHardwareService {
     @Autowired
     private RemoteCabinetService remoteCabinetService;
 
-    @Autowired
-    private TokenService tokenService;
-
     /**
      * 查询硬件
      *
@@ -162,15 +158,6 @@ public class LabHardwareServiceImpl implements ILabHardwareService {
     @DataScope(deptAlias = "xx" , userAlias = "xx", permi = PerPrefix.LABORATORY_HARDWARE)
     public List<LabHardwareVO> selectLabHardwareList(LabHardware labHardware) {
         List<LabHardwareVO> list = labHardwareMapper.selectLabHardwareList(labHardware);
-
-        /*Map<String, Object> map;
-        for (LabHardwareVO labHardwareVO : list) {
-            map = socketService.getRelayData(labHardwareVO.getRelayCode());
-            if(map != null && labHardwareVO.getBit() != null){
-                int status = Integer.parseInt(map.get("reverseBit").toString().substring(labHardwareVO.getBit() -1, labHardwareVO.getBit()));
-                labHardwareVO.setStatus(status);
-            }
-        }*/
         for (LabHardwareVO labHardwareVO : list) {
             if(labHardwareVO.getHardwareType()==2){
                 Integer code=redisService.getCacheObject(CacheConstants.RELAY_STATUS_KEY+labHardwareVO.getId());
@@ -241,20 +228,16 @@ public class LabHardwareServiceImpl implements ILabHardwareService {
             LabHardware labHardware2 = new LabHardware();
             labHardware2.setHardwareNum(labHardware.getHardwareNum());
             Predicate<List<LabHardwareVO>> p = x->x.size()>0;
-            if(StringUtils.isNotBlank(labHardware2.getHardwareNum())){
-                if(p.test(labHardwareMapper.selectLabHardwareList(labHardware2))){
-                    throw new ServiceException("设备编号重复,请重新输入。");
-                }
+            if(StringUtils.isNotBlank(labHardware2.getHardwareNum())
+                    && p.test(labHardwareMapper.selectLabHardwareList(labHardware2))){
+                throw new ServiceException("设备编号重复,请重新输入。");
             }
             int id;
             try{
                 id = labHardwareMapper.insertLabHardware(labHardware);
-
-                if(HardwareTypeEnum.HK_DOOR.equals(labHardware.getType())){
-                    if(labHardwareMapper.selectCountByType(labHardware) > 3){
-                        throw new ServiceException("添加失败:同一实验室最多添加3台门禁设备");
-                    }
-                    //haiKangDoorService.addUserAuthorizeDoor(true, labHardware, tokenService.getLoginUser());
+                if(HardwareTypeEnum.HK_DOOR.equals(labHardware.getType())
+                        && labHardwareMapper.selectCountByType(labHardware) > 3){
+                    throw new ServiceException("添加失败:同一实验室最多添加3台门禁设备");
                 }
 
             }catch (DuplicateKeyException e){
@@ -347,11 +330,6 @@ public class LabHardwareServiceImpl implements ILabHardwareService {
             }
             try{
                 id=labHardwareMapper.updateLabHardware(labHardware);
-
-                /*if(HardwareTypeEnum.HK_DOOR.equals(old.getType()) && !old.getControlScope().equals(labHardware.getControlScope())){
-                    haiKangDoorService.updateUserAuthorizeDoor(old, labHardware);
-                }*/
-
             }catch (DuplicateKeyException e){
                 throw new ServiceException("继电器编号位置重复,请重新输入。");
             }
@@ -453,7 +431,6 @@ public class LabHardwareServiceImpl implements ILabHardwareService {
         }catch (DuplicateKeyException e){
             throw new ServiceException("该硬件绑定的传感器位置已被使用,绑定失败");
         }
-
         return id;
     }
 
@@ -466,8 +443,7 @@ public class LabHardwareServiceImpl implements ILabHardwareService {
     @Override
     @Transactional(rollbackFor = Exception.class)
     public int setLock(LabHardwareVO labHardwareVO) {
-        int flag = labHardwareMapper.setLock(labHardwareVO);
-        return flag;
+        return labHardwareMapper.setLock(labHardwareVO);
     }
 
     /**
@@ -479,15 +455,8 @@ public class LabHardwareServiceImpl implements ILabHardwareService {
     @Override
     @Transactional(noRollbackFor = {NoRollException.class})
     public int deleteLabHardwareByIds(Long[] ids) {
-        LabHardwareVO labHardware = labHardwareMapper.selectLabHardwareById(ids[0]);
-
         labSubjectHardwarePostionMapper.deleteLabSubjectHardwarePositionByHardId(ids[0]);
-        int flag = labHardwareMapper.deleteLabHardwareByIds(ids);
-
-        /*if(HardwareTypeEnum.HK_DOOR.equals(labHardware.getType())){
-            haiKangDoorService.deleteUserAuthorizeDoor(labHardware);
-        }*/
-        return flag;
+        return  labHardwareMapper.deleteLabHardwareByIds(ids);
     }
 
     /**

+ 1 - 1
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabPhotoNoteServiceImpl.java

@@ -133,7 +133,7 @@ public class LabPhotoNoteServiceImpl implements ILabPhotoNoteService {
         LabSubject subjectPo = labSubjectMapper.selectLabSubjectById(labPhotoNote.getSubjectId());
         List<LabSecurityApplyVO> applist = new ArrayList<>();
         if(subjectPo!=null){
-            StringBuffer usersStr = new StringBuffer();
+            StringBuilder usersStr = new StringBuilder();
             if(subjectPo.getAdminId()!=null){
                 usersStr.append(subjectPo.getAdminId()+",");
             }

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

@@ -80,7 +80,7 @@ public class LabRiskPlanAbnormalGroupServiceImpl implements ILabRiskPlanAbnormal
             LabRiskPlanAbnormalLog labRiskPlanAbnormalLog = new LabRiskPlanAbnormalLog();
             labRiskPlanAbnormalLog.setGroupId(a.getId());
             List<LabRiskPlanAbnormalLog> abnormalLogList = labRiskPlanAbnormalLogMapper.selectLabRiskPlanAbnormalLogOrderByList(labRiskPlanAbnormalLog);
-            StringBuffer sensorStr = new StringBuffer();
+            StringBuilder sensorStr = new StringBuilder();
             Optional.ofNullable(abnormalLogList).orElseGet(Collections::emptyList).stream().filter(b->b.getRiskStatus()==1).forEach(b->{
                 JSONArray sensorList = JSONObject.parseArray(b.getSensorJson());
                 for(int x=0;x<sensorList.size();x++){
@@ -91,11 +91,8 @@ public class LabRiskPlanAbnormalGroupServiceImpl implements ILabRiskPlanAbnormal
                     }else{
                         sensorStr.append(jsonObj.getString("describe")+":"+jsonObj.getString("value"));
                     }
-//                    sensorStr.append(jsonObj.get("describe")+":"+jsonObj.get("value")+""+jsonObj.get("unit")==null?"":jsonObj.get("unit")+"  ");
-                    if(StringUtils.isNotNull(jsonObj.getString("funNum")) && (jsonObj.getString("funNum")).equals("huoyan")){
-                        if(!a.getClosePlan()){
-                            a.setClosePlan(true);
-                        }
+                    if(StringUtils.isNotNull(jsonObj.getString("funNum")) && (jsonObj.getString("funNum")).equals("huoyan") && !a.getClosePlan()){
+                        a.setClosePlan(true);
                     }
                 }
             });

+ 0 - 19
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabRiskPlanAbnormalLogServiceImpl.java

@@ -7,7 +7,6 @@ import com.zd.common.core.annotation.DataScope;
 import com.zd.common.core.redis.RedisService;
 import com.zd.common.core.utils.DateUtils;
 import com.zd.common.core.utils.SecurityUtils;
-import com.zd.laboratory.api.entity.SensorFunctionStatus;
 import com.zd.laboratory.config.HardwareFunctionStatusConfig;
 import com.zd.laboratory.domain.*;
 import com.zd.laboratory.domain.vo.LabRiskPlanAbnormalLogVO;
@@ -249,23 +248,6 @@ public class LabRiskPlanAbnormalLogServiceImpl implements ILabRiskPlanAbnormalLo
         result.put("sevenDays", dataMap);
 
         /** ----------------------- 30天数据,暂时不要--------------------------- */
-        /*dataMap = new HashMap<>();
-
-        // 风险数
-        params.put("type", 2);
-        maps = labRiskPlanAbnormalLogMapper.queryRiskTrend(params);
-        dataMap.put("risks", maps);
-
-        // 故障数
-        maps = labAbnormalMapper.queryFailures(params);
-        dataMap.put("failures", maps);
-
-        // 隐患数
-        maps = labPhotoNoteMapper.selectDangers(params);
-        dataMap.put("dangers", maps);
-
-        // 近30天数据
-        result.put("oneMonth", dataMap);*/
         return result;
     }
 
@@ -330,7 +312,6 @@ public class LabRiskPlanAbnormalLogServiceImpl implements ILabRiskPlanAbnormalLo
                         if(subDiy.size()>0){
                             appVo.setSubDiyVo(subDiy.get(0));
                         }
-//                        appVo.setSubDiyVo(Optional.ofNullable(subDiy).filter(p->p.size()>0).orElseGet(Collections::emptyList).get(0));
                         appVo.setTodayHappenCount(todayHappenCount);
                         longAdder.add(todayHappenCount);
                         //加入实验室信息

+ 2 - 8
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabSensorServiceImpl.java

@@ -32,7 +32,6 @@ import java.util.concurrent.TimeUnit;
  */
 @Service
 public class LabSensorServiceImpl implements ILabSensorService {
-    private static Logger logger = LoggerFactory.getLogger(LabSensorServiceImpl.class);
     @Autowired
     private LabSensorMapper labSensorMapper;
     @Autowired
@@ -140,7 +139,6 @@ public class LabSensorServiceImpl implements ILabSensorService {
         Object subjectStr=redisService.getCacheObject(getKey(GatewayNum));
         Long subId=null;
         if(null!=subjectStr && !"".equals(subjectStr) ){
-            //logger.error("num:"+GatewayNum+"subjectStr:"+subjectStr);
             subId=Long.parseLong(subjectStr.toString());
         }
 
@@ -166,7 +164,6 @@ public class LabSensorServiceImpl implements ILabSensorService {
             subId=aLong;
             redisService.setCacheObject(getKey(GatewayNum),aLong,5L, TimeUnit.MINUTES);
         }
-        //logger.error("num:"+GatewayNum+"subId:"+subId);
         return subId;
     }
 
@@ -182,13 +179,10 @@ public class LabSensorServiceImpl implements ILabSensorService {
         labSensor.setUpdateTime(DateUtils.getNowDate());
         LabSensor old = labSensorMapper.selectLabSensorById(labSensor.getId());
         int i = labSensorMapper.updateLabSensor(labSensor);
-        if(i==1)
+        if(i==1 && old.getGatewayId()!=null)
         //需要删除旧的key
         {
-            if(old.getGatewayId()!=null)
-            {
-                redisService.deleteObject(getKey(old.getGatewayId()));
-            }
+            redisService.deleteObject(getKey(old.getGatewayId()));
         }
         return i;
     }