干燥机配套车间生产管理系统/云平台服务端
zhuguifei
6 天以前 8870ea2ebf66b589c83f1d515faeec9bc4c6431e
jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/service/impl/DryRealTimeDataServiceImpl.java
@@ -180,11 +180,12 @@
            DryOrderVo orderVo = (DryOrderVo) redisUtil.hget(CacheConstants.RedisKeyEnum.WORK_ORDER.getCode(),
                    realTimeDataParentVo.getTenantid() + "_" + realTimeDataParentVo.getMachineid());
            // 1.2 如果有缓存记录
            if (orderVo != null && orderVo.getCode().equals(realTimeDataParentVo.getWorkorder())) {
            if (orderVo != null && orderVo.getCode() != null && orderVo.getCode().equals(realTimeDataParentVo.getWorkorder())) {
                // 1.3 没有缓存记录再查询数据库
            } else {
                // 根据租户id和工单号查询数据库是否有记录,有则返回,没有则新增一条再返回
                realTimeDataVo.setWorkorder(realTimeDataParentVo.getWorkorder());
                orderVo = getOrSaveDryOrderVoDB(realTimeDataVo);
            }
            if (orderVo == null) {
@@ -819,10 +820,16 @@
        //2检测已结束的故障
        //2.1如果实时数据不存在redis存在则代表故障结束,存入数据库
        Map<Object, Object> curFauMap = redisUtil.hmget(String.format(MqttConstant.MQTT_REAL_FAULT, tenantId));
        curFauMap.keySet().stream()
        Map<Object, DryFaultRecordVo> collect = curFauMap.keySet().stream()
                .filter(key -> {
                    String[] split = key.toString().split("_");
                    return split[0].equals(tenantId + "") && split[1].equals(machineId);
                })
                //特别注意,多个报警类型共用方法需要区分类型
                .filter(key -> !realFauMap.containsKey(key) && ((DryFaultRecordVo) curFauMap.get(key)).getFaultType() == faultType)
                .forEach(key -> {
                .filter(key -> !realFauMap.containsKey(key) && (Objects.equals(((DryFaultRecordVo) curFauMap.get(key)).getFaultType(), faultType)))
                .collect(Collectors.toMap(key -> key,  // 保留原键
                        key -> (DryFaultRecordVo) curFauMap.get(key)));
        collect.keySet().forEach(key -> {
                    DryFaultRecordVo vo = (DryFaultRecordVo) redFauMap.get(key);
                    vo.setECount(vo.getECount() + 1);
                    if (redisUtil.hget(String.format(MqttConstant.MQTT_REAL_FAULT, tenantId), key.toString()) != null) {