zxl
115 分钟以前 3b0516a2959e25576e4f3fda697a3b025d06c8c9
ycl-server/src/main/java/com/ycl/task/MonitorTask.java
@@ -29,6 +29,7 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
@@ -61,7 +62,10 @@
    private YwPointMapper ywPointMapper;
    @Autowired
    private RedisTemplate redisTemplate;
    @Value("${DH.userName}")
    public String userName;
    @Value("${DH.password}")
    public String password;
    //同步点位在线率到mongo(弃用)
//    public void siteOnline() {
//        log.info("开始同步点位在线率到mongo");
@@ -104,7 +108,6 @@
            //准备插入点位表的数据
            List<YwPoint> ywPointList = new ArrayList<>();
            //全年留存
            for (MonitorQualifyResult result : oneMachineFileResults) {
                TMonitor monitor = getMonitor(result, monitorVOMap, osdMap);
@@ -112,6 +115,7 @@
                monitorList.add(monitor);
                ywPointList.add(point);
            }
            //添加老数据
            List<String> numbers = CollectionUtils.isEmpty(monitorList) ? new ArrayList<>() : monitorList.stream().map(TMonitor::getSerialNumber).collect(Collectors.toList());
            monitorVOMap.forEach((key, value) -> {
@@ -123,16 +127,17 @@
                    if (osdCheckResult != null) {
                        monitor.setDeviceType(osdCheckResult.getDeviceBrand());
                    }
                    monitorList.add(monitor);
                }
            });
            //转换
            List<String> points = CollectionUtils.isEmpty(ywPointList) ? new ArrayList<>() : ywPointList.stream().map(YwPoint::getSerialNumber).collect(Collectors.toList());
            //pointMap点位旧数据 设备码map
            pointMap.forEach((key, value) -> {
                //老设备状态改为不参与考核
                if (!points.contains(key)) {
                    value.setExamineStatus(Boolean.FALSE);
                    //单位设置为空(TODO:为啥)
                    //单位设置为空
                    value.setUnitId(null);
                    ywPointList.add(value);
                }
@@ -158,6 +163,10 @@
        YwPoint ywPoint = new YwPoint();
        if (pointMap.containsKey(result.getSerialNumber().getValue())) {
            ywPoint = pointMap.get(result.getSerialNumber().getValue());
            //更新定位名
            if (ywPoint != null) {
                ywPoint.setPointName(result.getName().getValue());
            }
        } else {
            ywPoint.setPointName(result.getName().getValue());
            ywPoint.setStatus(PointStatus.WAIT.getDesc());
@@ -170,6 +179,8 @@
            ywPoint.setCreateTime(new Date());
            ywPoint.setUpdateTime(new Date());
            ywPoint.setOnline(ApiConstants.UY_OnlineSite_Unknown);
            ywPoint.setUsername(userName);
            ywPoint.setPassword(password);
        }
        //状态设置为考核设备
        ywPoint.setExamineStatus(Boolean.TRUE);