| | |
| | | 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; |
| | |
| | | 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"); |
| | |
| | | // Date yesterday = DateUtils.addDays(new Date(), -1); |
| | | Query query = new Query(Criteria.where("mongoCreateTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date()))); |
| | | List<MonitorQualifyResult> oneMachineFileResults = mongoTemplate.find(query, MonitorQualifyResult.class); |
| | | if(!CollectionUtils.isEmpty(oneMachineFileResults)) { |
| | | //mongo品牌数据 |
| | | Query OSDQuery = new Query(Criteria.where("mongoCreateTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date()))); |
| | | Map<String, OsdCheckResult> osdMap = mongoTemplate.find(query, OsdCheckResult.class).stream().collect(Collectors.toMap(OsdCheckResult::getDeviceNo, Function.identity())); |
| | |
| | | List<TMonitor> monitorList = new ArrayList<>(); |
| | | //准备插入点位表的数据 |
| | | List<YwPoint> ywPointList = new ArrayList<>(); |
| | | |
| | | |
| | | //全年留存 |
| | | for (MonitorQualifyResult result : oneMachineFileResults) { |
| | |
| | | } |
| | | //新的数据放入Redis中等待考核指标任务使用(弃用,改为标签形式) |
| | | // redisTemplate.opsForValue().set(RedisConstant.New_Monitor_Set, JSONArray.toJSONString(newMonitorList)); |
| | | } |
| | | log.info("结束同步mongodb一机一档到数据库"); |
| | | } |
| | | |
| | |
| | | ywPoint.setStatus(PointStatus.WAIT.getDesc()); |
| | | ywPoint.setSerialNumber(result.getSerialNumber().getValue()); |
| | | ywPoint.setImportantTag(Boolean.FALSE); |
| | | ywPoint.setProvinceTag(Boolean.FALSE); |
| | | ywPoint.setProvinceTagVideo(Boolean.FALSE); |
| | | ywPoint.setProvinceTagCar(Boolean.FALSE); |
| | | ywPoint.setProvinceTagFace(Boolean.FALSE); |
| | | ywPoint.setImportantCommandImageTag(Boolean.FALSE); |
| | | ywPoint.setCreateTime(new Date()); |
| | | ywPoint.setUpdateTime(new Date()); |
| | | ywPoint.setOnline(ApiConstants.UY_OnlineSite_Unknown); |
| | | ywPoint.setUsername(userName); |
| | | ywPoint.setPassword(password); |
| | | } |
| | | //状态设置为考核设备 |
| | | ywPoint.setExamineStatus(Boolean.TRUE); |