Index: ssts-maintain/src/main/java/com/forgon/disinfectsystem/maintain/device/service/SteriVac3MManagerImpl.java =================================================================== diff -u -r37558 -r38409 --- ssts-maintain/src/main/java/com/forgon/disinfectsystem/maintain/device/service/SteriVac3MManagerImpl.java (.../SteriVac3MManagerImpl.java) (revision 37558) +++ ssts-maintain/src/main/java/com/forgon/disinfectsystem/maintain/device/service/SteriVac3MManagerImpl.java (.../SteriVac3MManagerImpl.java) (revision 38409) @@ -86,7 +86,7 @@ }else if(file.getName().endsWith(".xml")){ return true; } - logger.debug("只处理***.xml文件"); + logger.debug("只处理***.xml文件,跳过"+file.getName()); return false; } }; @@ -116,13 +116,19 @@ }else{ name = shareList[i]; if(!(name.endsWith(".xml"))){ + logger.debug("只处理***.xml文件,不处理本文件【"+name+"】"); continue; } smbForm = session.createSmbFileObject(rootPath + File.separator + name); if(smbForm == null || smbForm.isDirectory()){ continue; } } + if(enableDetailedDeviceInformation){ + appLogManager.saveLog(loginUserData, + Log.MODEL_DEVICE_INTERFACE, Log.TYPE_QUERY, + devInterface.getName() + "开始解析【"+ name +"】"); + } SteriVac3MSterilizerRecord record = sterilizerDataReadAndSave(smbForm,devInterface, remoteType, ftp, ftpFile, enableDetailedDeviceInformation, loginUserData); if(DatabaseUtil.isPoIdValid(record.getSterilizationRecordId())){ String xmlName = name.replace(".xml", ".png"); @@ -131,20 +137,39 @@ if(DeviceInterface.INTERFACETYPE_FTP.equals(remoteType)){ ftpFileXml = ftpFileManager.getFileByFileName(xmlName, ftpFileManager.getCurrentPath(ftp), ftp,false); if(ftpFileXml == null){ + if(enableDetailedDeviceInformation){ + appLogManager.saveLog(loginUserData, + Log.MODEL_DEVICE_INTERFACE, Log.TYPE_QUERY, + devInterface.getName() + "读取【"+ name +"】文件失败,原因:找不到对应的png文件"); + } continue; } }else{ smbFormXml = session.createSmbFileObject(rootPath + File.separator + xmlName); if(smbFormXml == null){ + appLogManager.saveLog(loginUserData, + Log.MODEL_DEVICE_INTERFACE, Log.TYPE_QUERY, + devInterface.getName() + "读取【"+ name +"】文件失败,原因:找不到对应的png文件"); continue; } } + if(enableDetailedDeviceInformation){ + appLogManager.saveLog(loginUserData, + Log.MODEL_DEVICE_INTERFACE, Log.TYPE_QUERY, + devInterface.getName() + "开始转移【"+ name +"】的xml和png文件,更新灭菌记录图标"); + } readedFileAmount++; copyPng(smbFormXml, devInterface, remoteType, ftp, ftpFileXml, enableDetailedDeviceInformation, loginUserData); objectDao.save(record); objectDao.excuteSQL(" update " + SterilizationRecord.class.getSimpleName() + " set sterilizationParaType=" + SterilizationRecord.STERILIZATIONPARATYPE_STERIVAC3M_GS8_1D + " where id="+record.getSterilizationRecordId()); commonFileManager.moveFile(remoteType, xmlName, ftp, ftpFileManager.getCurrentPath(ftp), backUpPath, session, smbFormXml,false); commonFileManager.moveFile(remoteType, name, ftp, ftpFileManager.getCurrentPath(ftp), backUpPath, session, smbForm,false); + }else{ + if(enableDetailedDeviceInformation){ + appLogManager.saveLog(loginUserData, + Log.MODEL_DEVICE_INTERFACE, Log.TYPE_QUERY, + devInterface.getName() + "解析【"+ name +"】文件失败,原因:找不到匹配的灭菌记录"); + } } } } catch (Exception e) { @@ -193,9 +218,15 @@ da.setTime(remoteFile.getDate()); fileName = remoteFile.getName(); } + if(enableDetailedDeviceInformation){ + appLogManager.saveLog(loginUserData, Log.MODEL_DEVICE_INTERFACE, Log.TYPE_QUERY, "开始获取文件["+ fileName +"]的输入流"); + } inputStream = commonFileManager.getInputStream(remoteType, ftp, fileName, remoteFile, out,false); isr = new InputStreamReader(inputStream,"GBK"); br = new BufferedReader(isr); + if(enableDetailedDeviceInformation){ + appLogManager.saveLog(loginUserData, Log.MODEL_DEVICE_INTERFACE, Log.TYPE_QUERY, "完成获取文件["+ fileName +"]的输入流"); + } String line = ""; String serialNumber = null; Date startTime = null; @@ -242,26 +273,44 @@ if(enableDetailedDeviceInformation && DatabaseUtil.isPoIdValid(sterilizationRecordId)){ appLogManager.saveLog(loginUserData, Log.MODEL_DEVICE_INTERFACE, Log.TYPE_QUERY, String.format("机器号[%s],开始时间 [%s],需要更新温度压力数据的灭菌记录id[%s]",serialNumber,startTimeStr,sterilizationRecordId)); } - if(DatabaseUtil.isPoIdValid(sterilizationRecordId) && objectDao.countBySql("select count(*) from " - + SteriVac3MSterilizerRecord.class.getSimpleName() + " where sterilizationRecordId="+sterilizationRecordId) == 0){ - record.setPngFileName(fileName.replace(".xml", ".png")); - record.setSterilizationRecordId(sterilizationRecordId); + if(DatabaseUtil.isPoIdValid(sterilizationRecordId)){ + if(objectDao.countBySql("select count(*) from " + + SteriVac3MSterilizerRecord.class.getSimpleName() + " where sterilizationRecordId="+sterilizationRecordId) == 0){ + record.setPngFileName(fileName.replace(".xml", ".png")); + record.setSterilizationRecordId(sterilizationRecordId); + }else{ + appLogManager.saveLog(loginUserData, + Log.MODEL_DEVICE_INTERFACE, Log.TYPE_READ, + devInterface.getName() + "解析【"+ fileName +"】文件异常,原因:数据库已存在灭菌记录id【"+ sterilizationRecordId +"】的灭菌参数"); + } } + }else{ + if(enableDetailedDeviceInformation){ + if(StringUtils.isNotBlank(serialNumber)){ + appLogManager.saveLog(loginUserData, + Log.MODEL_DEVICE_INTERFACE, Log.TYPE_READ, + devInterface.getName() + "解析【"+ fileName +"】文件失败,原因:SerialNumber异常"); + } + if(record.getEndDate() == null){ + appLogManager.saveLog(loginUserData, + Log.MODEL_DEVICE_INTERFACE, Log.TYPE_READ, + devInterface.getName() + "解析【"+ fileName +"】文件失败,原因:EndTime异常"); + } + if(record.getStartDate() == null){ + appLogManager.saveLog(loginUserData, + Log.MODEL_DEVICE_INTERFACE, Log.TYPE_READ, + devInterface.getName() + "解析【"+ fileName +"】文件失败,原因:StartTime异常"); + } + } } - } catch (FileNotFoundException e) { + } catch(Exception e){ logger.warn(e.getMessage()); e.printStackTrace(); - } catch (IOException e) { - logger.warn(e.getMessage()); - e.printStackTrace(); if(enableDetailedDeviceInformation){ appLogManager.saveLog(loginUserData, - Log.MODEL_DEVICE_INTERFACE, Log.TYPE_ADD, - devInterface.getName() + "设备接口连接异常," + e.getMessage()); + Log.MODEL_DEVICE_INTERFACE, Log.TYPE_READ, + devInterface.getName() + "解析【"+ fileName +"】文件异常,原因:" + e.getMessage()); } - } catch(Exception e){ - logger.warn(e.getMessage()); - e.printStackTrace(); }finally{ FileSystemHelper.closeInputStream(inputStream, br, isr, out); } @@ -294,20 +343,14 @@ File file = new File(propFilePath); Files.copy(inputStream, file.toPath()); inputStream.close(); - } catch (FileNotFoundException e) { + } catch(Exception e){ logger.warn(e.getMessage()); e.printStackTrace(); - } catch (IOException e) { - logger.warn(e.getMessage()); - e.printStackTrace(); if(enableDetailedDeviceInformation){ appLogManager.saveLog(loginUserData, - Log.MODEL_DEVICE_INTERFACE, Log.TYPE_ADD, - devInterface.getName() + "设备接口连接异常," + e.getMessage()); + Log.MODEL_DEVICE_INTERFACE, Log.TYPE_QUERY, + devInterface.getName() + "拷贝【"+ fileName +"】异常"+e.getMessage()); } - } catch(Exception e){ - logger.warn(e.getMessage()); - e.printStackTrace(); }finally{ FileSystemHelper.closeInputStream(inputStream, null, null, out); }