瀏覽代碼

异味处理

linft 2 年之前
父節點
當前提交
8757440ae5

+ 4 - 59
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabSubjectAccessRecordServiceImpl.java

@@ -1,15 +1,12 @@
 package com.zd.laboratory.service.impl;
 
-import com.zd.algorithm.api.smartlock.feign.fallback.RemoteSmartlockFallbackFactory;
 import com.zd.common.core.utils.StringUtils;
 import com.zd.exam.api.feign.RemoteExamService;
 import com.zd.laboratory.domain.*;
 import com.zd.laboratory.domain.vo.ElPassConfigdetailVO;
 import com.zd.laboratory.domain.vo.ViolationNewVo;
-import com.zd.laboratory.mapper.LabNegativeListRecordsMapper;
 import com.zd.laboratory.mapper.LabViolationScoreSiteMapper;
 import com.zd.laboratory.service.ILabBlacklistService;
-import com.zd.model.constant.SecurityConstants;
 import com.zd.model.domain.R;
 import com.zd.model.domain.ResultData;
 import com.zd.model.domain.per.PerPrefix;
@@ -17,18 +14,12 @@ import com.zd.common.core.exception.ServiceException;
 import com.zd.common.core.utils.DateUtils;
 import com.zd.common.core.utils.SecurityUtils;
 import com.zd.common.core.annotation.DataScope;
-import com.zd.common.core.security.TokenService;
 import com.zd.laboratory.domain.vo.LabSubjectAccessRecordVo;
 import com.zd.laboratory.mapper.LabSubjectAccessRecordMapper;
-import com.zd.laboratory.mapper.LabViolationMapper;
 import com.zd.laboratory.mqtt.enums.BigViewDataType;
 import com.zd.laboratory.mqtt.service.impl.SubMessageSendManager;
 import com.zd.laboratory.service.ILabOnepcService;
-import com.zd.laboratory.service.ILabPhotoInspectionService;
 import com.zd.laboratory.service.ILabSubjectAccessRecordService;
-import com.zd.system.api.feign.RemoteUserService;
-import com.zd.model.entity.SysUser;
-import org.apache.ibatis.annotations.Param;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -49,31 +40,17 @@ public class LabSubjectAccessRecordServiceImpl implements ILabSubjectAccessRecor
     private LabSubjectAccessRecordMapper labSubjectAccessRecordMapper;
 
     @Autowired
-    private ILabPhotoInspectionService labPhotoInspectionService;
-
-    @Autowired
     private ILabOnepcService labOnepcService;
     @Autowired
-    private TokenService tokenService;
-
-    @Autowired
-    private LabViolationMapper labViolationMapper;
-    @Autowired
     private SubMessageSendManager subMessageSendManager;
 
     @Autowired
-    private RemoteUserService userService;
-
-    @Autowired
     private LabViolationScoreSiteMapper scoreSiteMapper;
 
     @Autowired
     private RemoteExamService remoteExamService;
 
     @Autowired
-    private LabNegativeListRecordsMapper negativeListRecordsMapper;
-
-    @Autowired
     private LabViolationServiceImpl labViolationServiceImpl;
 
     @Autowired
@@ -209,10 +186,6 @@ public class LabSubjectAccessRecordServiceImpl implements ILabSubjectAccessRecor
     @Override
     public LabSubjectAccessRecordVo myAccessDetail(Long id) {
         LabSubjectAccessRecordVo accessVo = labSubjectAccessRecordMapper.myAccessDetail(id);
-//        LabPhotoInspection inspection = new LabPhotoInspection();
-//        inspection.setAccessId(accessVo.getId());
-//        List<LabPhotoInspection> inspectionList = labPhotoInspectionService.selectLabPhotoInspectionList(inspection);
-//        accessVo.setPhotoList(inspectionList);
         LabOnepc onePc = new LabOnepc();
         onePc.setAccessId(accessVo.getId());
         List<LabOnepc> onePcList = labOnepcService.selectLabOnepcList(onePc);
@@ -240,8 +213,6 @@ public class LabSubjectAccessRecordServiceImpl implements ILabSubjectAccessRecor
     public int outTimeRecord() {
         //查询超过24小时违规人员列表
         List<LabSubjectAccessRecordVo> subAccessRecordList = labSubjectAccessRecordMapper.selOutTimeRecord();
-
-//        labSubjectAccessRecordMapper.outTimeRecord();
         int i = 0;
         if(subAccessRecordList.size()>0)
         {
@@ -356,11 +327,9 @@ public class LabSubjectAccessRecordServiceImpl implements ILabSubjectAccessRecor
         subjectAccessRecord.setJoinUserId(userId);
         subjectAccessRecord.setInitFlag(false);
         LabSubjectAccessRecord labSubjectAccessRecordVo = labSubjectAccessRecordMapper.queryLastByUserId(subjectAccessRecord);
-        if (labSubjectAccessRecordVo != null) {
-            if (labSubjectAccessRecordVo.getAccessStatus().equals(1L) && labSubjectAccessRecordVo.getOutTime() == null) {
-                return true;
-            }
-
+        if (labSubjectAccessRecordVo != null
+                && labSubjectAccessRecordVo.getAccessStatus().equals(1L) && labSubjectAccessRecordVo.getOutTime() == null) {
+            return true;
         }
 
         return false;
@@ -433,23 +402,7 @@ public class LabSubjectAccessRecordServiceImpl implements ILabSubjectAccessRecor
         List<LabSubjectAccessRecordVo> accessList = labSubjectAccessRecordMapper.selectLabSubjectAccessRecordList(labSubjectAccessRecord);
         long i = 0;
         if (accessList.size() > 0) {
-//            throw new ServiceException("当前用户已经签到成功,不能重复签到");
-            //这里不要了,因为现在实验室需求要求,可以不同实验室打卡进入,要求当前实验室不能重复打卡
-//            List<SysDictData> dictDataList = DictUtils.getDictCache(BaseConstants.SYS_DICT_KEY + "lab_violation_rules");
-//            LabSubjectAccessRecord access = accessList.get(0);
-//            LabViolation labViolation = new LabViolation();
-//            labViolation.setJoinUserId(access.getJoinUserId());
-//            labViolation.setViolationType(1L);
-//            labViolation.setViolationContent(DictUtils.getDictCacheLable("lab_violation_rules","1"));
-//            labViolation.setSubjectId(access.getSubjectId());
-//            labViolation.setCreateTime(new Date());
-//            labViolation.setDeptName(access.getDeptName());
-//            labViolation.setDeptId(access.getDeptId());
-//            labViolation.setUserId(access.getUserId());
-//            labViolation.setCreateBy(access.getCreateBy());
-//            labViolationMapper.insertLabViolation(labViolation);
-//            access.setAccessStatus(3L);
-//            labSubjectAccessRecordMapper.updateLabSubjectAccessRecord(access);
+            log.info("");
         }else{
             labSubjectAccessRecord.setInTime(new Date());
             subMessageSendManager.SendBigViewUpdate(BigViewDataType.SUB_ONLINE);
@@ -472,14 +425,6 @@ public class LabSubjectAccessRecordServiceImpl implements ILabSubjectAccessRecor
     @Override
     @Transactional
     public ResultData addRecord(Map map) {
-       Long userId = Long.valueOf(map.get("userId").toString());
-        R<SysUser> user = userService.getUserInfoByUserId(userId, SecurityConstants.FROM_SOURCE);
-      /*  LabSubjectAccessRecord record = new LabSubjectAccessRecord();
-        record.setAccessStatus();
-        record.setSubjectId();
-        record.setOutTime();
-        record.setSubjectId(map.get(""));
-        record*/
         return null;
     }
 

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

@@ -122,7 +122,6 @@ public class LabSubjectDengerRelationServiceImpl implements ILabSubjectDengerRel
             relation.setDangerName(DictUtils.getDictCacheLable("hidden_danger", relation.getDangerId()));
             relation.setSubDept(DictUtils.getDictCacheLable("subject_class",relation.getSubDept()));
             // 风险等级
-            //relation.setSubClassVO(labSubjectManagerService.getSubClassVO(relation.getSubjectId()));
             relation.setSubClassVO(null);
         }
         return list;

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

@@ -59,7 +59,6 @@ public class LabSubjectHardwarePositionServiceImpl implements ILabSubjectHardwar
     public int insertLabSubjectHardwarePosition(LabSubjectHardwarePosition labSubjectHardwarePosition) {
         labSubjectHardwarePosition.setCreateTime(DateUtils.getNowDate());
         labSubjectHardwarePosition.setCreateBy(SecurityUtils.getUsername());
-        //labSubjectHardwarePosition.setUserId(SecurityUtils.getUserId());
         SysUser sysUser = SpringUtils.getBean(TokenService.class).getLoginUser().getSysUser();
         labSubjectHardwarePosition.setDeptId(sysUser.getDeptId());
         labSubjectHardwarePosition.setDeptName(sysUser.getDeptName());

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

@@ -115,8 +115,6 @@ public class LabSubjectManagerService {
     /**
      * 最低危险等级
      */
-//    @Autowired
-//    private LabSubClassVO getNONELabSubClassVO;
     @Autowired
     private FunctionMapperUtil functionMapperUtil;
     @Autowired
@@ -189,10 +187,6 @@ public class LabSubjectManagerService {
 
         logger.info("预案调用硬件,硬件id={},硬件名称={},硬件指令={}",labHardware.getId(), JSON.toJSONString(labHardware.getName()),JSON.toJSONString(command));
         return ResultData.success(riskControl(labHardware.getId(), command));
-
-        //老继电器调用方法
-//        return controlService.execution(labHardware, functionStatus);
-
     }
 
     public void test(Long id){
@@ -313,9 +307,6 @@ public class LabSubjectManagerService {
                         alarmUpMap.put("handlingUserId",SecurityUtils.getUserId()+"");
                         alarmUpMap.put("handlingContent","关闭智能声光报警");
                         remoteChemicalAlarmService.updateStatus(alarmUpMap);
-//                        if(!updateAlarm.getData()){
-//                            logger.error("智能声光报警日志处理失败,报警设备编号:"+labHardwareVO.getHardwareNum());
-//                        }
                     });
         }
 
@@ -487,8 +478,6 @@ public class LabSubjectManagerService {
         //设置负责人
         subSimpleVO.setAdminName(subject.getAdminName());
         subSimpleVO.setAdminPhone(subject.getAdminPhone());
-        //获取危险等级
-        //LabSubClassVO subclassVo = getSubClassVO(subject);
 
         //设置危险等级名称
         subSimpleVO.setDangerName(subject.getTypeName());
@@ -503,8 +492,6 @@ public class LabSubjectManagerService {
                 .map(SubAddrr::addrrPlus)
                 .orElseGet(() -> StrUtil.EMPTY));
         //设置安全联系信息
-//        subSimpleVO.setSafeUserPhone(subject.getSafeUserPhone());
-//        subSimpleVO.setSafeUserName(subject.getSafeUserName());
         subSimpleVO.setAdminUserDesc(subject.getAdminName()+" "+subject.getAdminPhone());
         subSimpleVO.setSafeUserDesc(labSubjectMapper.queryUserNameBySafeUserByOnepc(subject.getSafeUserId()));
         subSimpleVO.setSafeUserName(labSubjectMapper.queryUserNameBySafeUserId(subject.getSafeUserId()));
@@ -562,11 +549,6 @@ public class LabSubjectManagerService {
 
     public LabSubClassVO getSubClassVO(Long id) {
         List<LabSubClassVO> labSubClassVOS = subjectService.querySubClassesByIds(id);
-//        LabSubClassVO subclassVo = Optional.ofNullable(labSubClassVOS)
-//                .filter(a -> a.size() > 0)
-//                .map(a -> a.get(0))
-//                .orElse(getNONELabSubClassVO);
-//        return subclassVo;
         if (labSubClassVOS.size() > 0) {
             return labSubClassVOS.get(0);
         }
@@ -641,13 +623,10 @@ public class LabSubjectManagerService {
 
             }
         }catch (Exception e){
-
+            logger.error("异常信息:",e);
         }
-
         // 2.5 页面改变,接口加分页,并拆成两部分
         return labSubjects;
-
-//         return createSubControllerVO(labSubjects, true, true, true, true, true);
     }
 
     public LabSubjectControllerVO querySubById(Long id, Integer type,Long[] typeCollection) {
@@ -822,7 +801,6 @@ public class LabSubjectManagerService {
         LabSubject subject = new LabSubject();
         subject.setAdminId(SecurityUtils.getUserId());
         //不展示禁用数据
-//        subject.setIsDel(false);
         List<LabSubjectVO> labSubjects = labSubjectMapper.selectLabSubjectVOList(subject);
         return createSubControllerVO(labSubjects, false, true, true, false, true);
     }
@@ -863,9 +841,7 @@ public class LabSubjectManagerService {
     public List<SensorFunctionStatus> querySenseNewFunctionBySubId(Long subjectId) {
         List<LabSensor> labSensors = sensorMapper.selectSensorBySubIds(subjectId);
         updateLabHardwareFunctionStatuses(subjectId);
-
         return getSensorFunctionStatuses(labSensors, true);
-//        return getSensorNewFunctionStatuses(labSensors, subjectId);
     }
 
     /**
@@ -1379,7 +1355,6 @@ public class LabSubjectManagerService {
             List<LabHardware> labHardwares = null;
             if (iflabHardwares) {
                 //1.可控设备
-                //labHardwares = hardwareMapper.selectLabHardwareBySubIds(longs);
                 LabHardware hardware = new LabHardware();
                 hardware.setSubIds(longs);
                 hardware.setTypeCollection(typeCollection);
@@ -1407,7 +1382,6 @@ public class LabSubjectManagerService {
             if (flag) {
                 // 实验权限覆盖后面做(已完成)
                 LabSubject subject = new LabSubject();
-//                subject.setAdminId(SecurityUtils.getUserIdEx());
                 //获取我的实验室
                 labSubjectsDataScope = subjectService.selectLabSubjectListDataScope(subject);
             }
@@ -1505,7 +1479,6 @@ public class LabSubjectManagerService {
     @Async("labExecutor")
     public CompletableFuture<Integer> queryHardwares(Long[] typeCollection,Map<Long, SubDiyVO> subDiyVOMap, Long... longs) {
         int re = 0;
-        //List<LabHardware> labHardwares = hardwareMapper.selectLabHardwareBySubIds(longs);
         LabHardware lhd = new LabHardware();
         lhd.setSubIds(longs);
         lhd.setTypeCollection(typeCollection);
@@ -1592,7 +1565,6 @@ public class LabSubjectManagerService {
 
     private LabSubClassVO getLabSubClassVO(LabSubClassVO subClassVO) {
         return subClassVO;
-        //return Optional.ofNullable(subClassVO).orElseGet(() -> this.getNONELabSubClassVO);
     }
 
     /**
@@ -1606,8 +1578,6 @@ public class LabSubjectManagerService {
         senseValVO.setSubId(a.getSubjectId());
         senseValVO.setHardwareName(a.getName());
         senseValVO.setSenseType(a.getType());
-        // 这里需要考虑设备唯一码从哪里来
-//                senseValVO.setHardwareNUM();
         return senseValVO;
     }
 
@@ -1619,7 +1589,6 @@ public class LabSubjectManagerService {
      */
     public HardwareCVO getHardwareCVO(LabHardware a) {
         // 这里需要考虑设备唯一码从哪里来
-        // hardware.setHardwareNUM();
         HardwareCVO hardware = new HardwareCVO();
         hardware.setId(a.getId().toString());
         hardware.setHardwareName(a.getName());

+ 0 - 32
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabSubjectServiceImpl.java

@@ -235,37 +235,6 @@ public class LabSubjectServiceImpl implements ILabSubjectService {
     @Transactional
     public int updateLabSubject(LabSubject labSubject) {
         labSubject.setUpdateTime(DateUtils.getNowDate());
-//        if(CollectionUtils.isNotEmpty(labSubject.getHazardRelations())){
-//            // 修改危险源
-//            List<LabHazardSubjectRelation> hazardRelations = labSubject.getHazardRelations();
-//            for (LabHazardSubjectRelation hazardRelation : hazardRelations) {
-//                hazardRelation.setSubjectId(labSubject.getId());
-//                if(hazardRelation.getHazardId() == null){
-//                    throw new ServiceException("危险源ID 不能为空!");
-//                }
-//                hazardRelation.setHazardType(HazardTypeEnum.HAZARD);
-//                hazardRelation.setxPoint(0L);
-//                hazardRelation.setyPoint(0L);
-//                hazardRelation.setId(null);
-//            }
-//
-//            labHazardSubjectRelationService.updateBySubId(hazardRelations, labSubject.getId());
-//        }else {
-//            labHazardSubjectRelationMapper.deleteBySubId(labSubject.getId());
-//        }
-
-        //安全类目信息修改
-       /* List<XxpClassifySubject> classifySubjectList = labSubject.getClassifySubjectList();
-        if(classifySubjectList!=null && classifySubjectList.size()>0){
-            //删除关系
-            classifySubjectService.deleteBySubjectId(labSubject.getId());
-            //安全类目关系入库
-            for (XxpClassifySubject cs:classifySubjectList) {
-                //XxpClassifySubject classifySubject = classifySubjectService.selectClassifySubjectById(cs.getId());
-                    classifySubjectService.insertClassifySubject(cs);
-
-            }
-        }*/
 
         //实验室类目信息处理
         List<XxpClassify> classifyList = labSubject.getClassifyList();
@@ -781,7 +750,6 @@ public class LabSubjectServiceImpl implements ILabSubjectService {
         return labSubjectMapper.getCollegeSubIds(deptIds);
     }
 
-//    @DataScope(deptAlias = "s", permi = PerPrefix.LABORATORY_SUBJECT)
     @Override
     public List <LabSubject> buildBySub(LabSubject labSubject) {
         return labSubjectMapper.buildBySub(labSubject);

+ 8 - 19
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabViolationServiceImpl.java

@@ -407,7 +407,6 @@ public class LabViolationServiceImpl implements ILabViolationService {
         Integer total = 0;
         Integer creditScore = 0;
         if (list != null && list.size() > 0) {
-            total = Integer.valueOf(list.get(0).get("totalPoints").toString());
             creditScore = Integer.valueOf(list.get(0).get("creditScore").toString());
         }
         if (r.getData() == null || ((List) r.getData()).size() < 1) {
@@ -473,7 +472,6 @@ public class LabViolationServiceImpl implements ILabViolationService {
             }
             negativelistHistoryMapper.insertLabNegativelistHistory(history);
 
-
             //对比进入负面清单的次数如果达到直接进入黑名单
             if (labViolation.getNegativeListNum() + 1 >= getCount()) {
                 labViolation.setStatus(3);
@@ -482,7 +480,6 @@ public class LabViolationServiceImpl implements ILabViolationService {
                 comperAndExitsBlackList(vo.getUserId());
                 return ResultData.success(200, "达到负面清单设定次数,直接加入黑名单成功");
             } else if (score <= hmdval) {//积分达到黑名单设定分值进入黑名单
-//                comperAndExitsBlackList(vo.getUserId());
                 labViolation.setCreditScore(labViolation.getCreditScore());
                 labViolation.setViolationNum(labViolation.getViolationNum() + 1);
                 if (records != null) {
@@ -759,8 +756,6 @@ public class LabViolationServiceImpl implements ILabViolationService {
         if (history.getTreatmentMethod() != null && !"".equals(history.getTreatmentMethod())) {
             history.setTreatmentMethod(history.getTreatmentMethod().substring(0, history.getTreatmentMethod().length() - 1));
         }
-
-
         //将天数转为时间
         history.setHandleDay(getExpireDate(vo.getHandleDay()));
         history.setLaboratoryId(vo.getLaboratoryId());
@@ -816,7 +811,6 @@ public class LabViolationServiceImpl implements ILabViolationService {
         LabNegativelistVO labNegativelistHistoryVo = new LabNegativelistVO();
         labNegativelistHistoryVo.setBlackId(vo.getId());
         List<LabNegativelistHistory> negativelistHistoryList = labNegativelistHistoryMapper.selectLabNegativelistHistoryList(labNegativelistHistoryVo);
-//        int limit = 0;
         for (LabNegativelistHistory history : negativelistHistoryList) {
             if (history.getLearnStatus().equals(0)) {
                 history.setLearnStatus(1);
@@ -856,7 +850,6 @@ public class LabViolationServiceImpl implements ILabViolationService {
         LabNegativelistVO labNegativelistHistoryVo = new LabNegativelistVO();
         labNegativelistHistoryVo.setBlackId(vo.getId());
         List<LabNegativelistHistory> negativelistHistoryList = labNegativelistHistoryMapper.selectLabNegativelistHistoryList(labNegativelistHistoryVo);
-//        int limit = 0;
         for (LabNegativelistHistory history : negativelistHistoryList) {
             if (history.getLearnStatus().equals(0)) {
                 history.setLearnStatus(2);
@@ -870,7 +863,6 @@ public class LabViolationServiceImpl implements ILabViolationService {
             history.setUserId(null);
             history.setOverStatus(2);
             labNegativelistHistoryMapper.updateLabNegativelistHistory(history);
-//            limit++;
         }
 
         //更改状态,恢复信用分(如果此时信用分大于0,恢复时是否要累加,目前未累加)
@@ -922,17 +914,14 @@ public class LabViolationServiceImpl implements ILabViolationService {
             if (code.equals("200")) {
                 Map<String, Object> pointsConfig = (Map<String, Object>) data.getData();
                 Long deducPoints = violation.getCreditScore() - Long.parseLong(pointsConfig.get("blackScore") + "");
-                if (deducPoints > 0) {
-                    //这里扣减信用分
-                    if (deducPointsFun(violation.getUserId(), deducPoints, reason)) {
-                        //这里移入黑名单
-                        LabBlacklistVO labBlacklistVO = new LabBlacklistVO();
-                        labBlacklistVO.setJoinUserId(violation.getUserId());
-                        labBlacklistVO.setCreditScore(deducPoints + "");
-                        labBlacklistVO.setSurplusCreditScore((violation.getCreditScore() - deducPoints) + "");
-                        labBlacklistVO.setReason("从负面清单移入到黑名单");
-                        labBlacklistService.addBlacklist(labBlacklistVO);
-                    }
+                if (deducPoints > 0 && deducPointsFun(violation.getUserId(), deducPoints, reason)) {
+                    //这里移入黑名单
+                    LabBlacklistVO labBlacklistVO = new LabBlacklistVO();
+                    labBlacklistVO.setJoinUserId(violation.getUserId());
+                    labBlacklistVO.setCreditScore(deducPoints + "");
+                    labBlacklistVO.setSurplusCreditScore((violation.getCreditScore() - deducPoints) + "");
+                    labBlacklistVO.setReason("从负面清单移入到黑名单");
+                    labBlacklistService.addBlacklist(labBlacklistVO);
                 }
             }
         }