From fc3ae614a4c5a2a7cdb9029ecfc4372eb1c28b18 Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期二, 09 九月 2025 11:41:42 +0800
Subject: [PATCH] 补充确认表,审批表模板字段
---
blade-service/blade-mdm/src/main/java/org/springblade/mdm/task/MachineFileScanTask.java | 204 ---------------------------------------------------
1 files changed, 0 insertions(+), 204 deletions(-)
diff --git a/blade-service/blade-mdm/src/main/java/org/springblade/mdm/task/MachineFileScanTask.java b/blade-service/blade-mdm/src/main/java/org/springblade/mdm/task/MachineFileScanTask.java
index ff090f8..c49cee9 100644
--- a/blade-service/blade-mdm/src/main/java/org/springblade/mdm/task/MachineFileScanTask.java
+++ b/blade-service/blade-mdm/src/main/java/org/springblade/mdm/task/MachineFileScanTask.java
@@ -42,208 +42,4 @@
}
- /**
- * 鎵弿鎵�鏈夋満搴婄殑閰嶇疆涔嬬洰褰�
- */
- /*
- public void scanMachineFile() {
- List<Machine> machines = machineService.lambdaQuery().eq(Machine::getStatus,Machine.STATUS_ENABLE).list();
- for (Machine machine : machines) {
-
- //鎵弿鏂版枃浠�
- try {
- scanDir(machine,MachineFile.DIR_TYPE_REC);
- }catch(Exception e) {
- log.error("REC鎵弿鏂囦欢寮傚父,鏈哄簥{}", machine.getCode(), e);
- }
- try {
- scanDir(machine,MachineFile.DIR_TYPE_SEND);
- }catch(Exception e) {
- log.error("SEND鎵弿鏂囦欢寮傚父,鏈哄簥{}", machine.getCode(), e);
- }
- try {
- scanDir(machine,MachineFile.DIR_TYPE_TEMP);
- }catch(Exception e) {
- log.error("TEMP鎵弿鏂囦欢寮傚父,鏈哄簥{}", machine.getCode(), e);
- }
-
- //娓呯悊鏁版嵁搴擄紝鍒犻櫎鏂囦欢涓嶅瓨鍦ㄧ殑鏁版嵁
- try {
- clearDeletedReccords(machine,MachineFile.DIR_TYPE_REC);
- }catch(Exception e) {
- log.error("REC鎵弿鏂囦欢寮傚父,鏈哄簥{}", machine.getCode(), e);
- }
- try {
- clearDeletedReccords(machine,MachineFile.DIR_TYPE_SEND);
- }catch(Exception e) {
- log.error("SEND鎵弿鏂囦欢寮傚父,鏈哄簥{}", machine.getCode(), e);
- }
- try {
- clearDeletedReccords(machine,MachineFile.DIR_TYPE_TEMP);
- }catch(Exception e) {
- log.error("TEMP鎵弿鏂囦欢寮傚父,鏈哄簥{}", machine.getCode(), e);
- }
- }
-
- }
- */
-
- /**
- * 鎵弿鐩綍
- * @param machine 鏈哄簥淇℃伅
- * @param dirType 鐩綍绫诲瀷
- * @throws IOException
- */
- /*
- public void scanDir(Machine machine,String dirType) throws IOException {
- String basePath = MachineFileService.getBasePath(machine,dirType);
- if(basePath == null) {
- log.warn("鐩綍绫诲瀷涓嶅尮閰�:{}",dirType);
- return;
- }
- Path dirPath = Paths.get(basePath);
- if(!dirPath.toFile().exists()){
- log.warn("鎵弿鐩綍:{} 涓嶅瓨鍦�",dirPath);
- return;
- }
- // 鍙寘鍚櫘閫氭枃浠�
- List<Path> files = Files.list(dirPath)
- .filter(Files::isRegularFile).toList();
-
- byte[] buffer = new byte[2048];
-
- MachineFile existFileInDb;
- List<DictBiz> annotatiionList = programAnnotationService.getAnnotionDictList();
- //boolean exists;//鏂囦欢鏄惁瀛樺湪浜庢暟鎹簱涓�
- for (Path filePath : files) {
-
- existFileInDb = null;
- //exists = false;
-
- MachineFile mf = new MachineFile();
-
- mf.setTenantId("000000");
- mf.setName(filePath.toFile().getName());
- mf.setDirType(dirType);
- mf.setMachineCode(machine.getCode());
-
- try {
- //璇诲彇鍐呭锛岀‘瀹氱▼搴忕姸鎬�
- int pstatus = readProgramStatus(filePath,machine.getMachineGroupCode(),annotatiionList);
- mf.setProgramStatus(pstatus);
- BasicFileAttributes attrs = Files.readAttributes(
- filePath,
- BasicFileAttributes.class
- );
-
- FileTime creationTime = attrs.creationTime();
- Date creationDate = new Date(creationTime.toMillis());
- mf.setFileCreateTime(creationDate);
-
- FileTime modifyTime = attrs.lastModifiedTime();
- mf.setFileModifyTime(new Date(modifyTime.toMillis()));
- mf.setFileSize(Files.size(filePath));
- try (InputStream inputStream = Files.newInputStream(filePath)) {
- // 浣跨敤杈撳叆娴佽鍙栨枃浠跺唴瀹�
- int bytesRead = inputStream.read(buffer);
- mf.setMd5(DigestUtils.md5Hex(buffer));
- } catch (IOException e) {
- log.error("璇诲彇鏂囦欢md5澶辫触",e);
- continue;//鏈夐敊璇�,鎺犺繃
- }
-
- //exists = machineFileService.fileExists(mf.getName(),dirType,machine.getCode());
-
- existFileInDb = machineFileService.getExistsFile(mf.getName(),dirType,machine.getCode());
- System.out.println("鏂囦欢鍒涘缓鏃堕棿: " + creationDate);
- } catch (IOException e) {
- log.error("璇诲彇鏂囦欢淇℃伅澶辫触",e);
- }
- if(existFileInDb == null) {
- machineFileService.save(mf);
- }else{
- log.info("鏂囦欢宸插瓨鍦ㄦ帬杩�:{}",filePath.getFileName());
- //宸插瓨鍦ㄥ拫鏁淬��
- existFileInDb.setFileSize(mf.getFileSize());
- existFileInDb.setProgramStatus(mf.getProgramStatus());
- existFileInDb.setFileCreateTime(mf.getFileCreateTime());
- existFileInDb.setFileModifyTime(mf.getFileModifyTime());
- if(!StringUtils.equals(existFileInDb.getMd5(),mf.getMd5())){
- //鏂囦欢鍐呭鍙戠敓鍙樺寲浜�,璁剧疆鐘舵�佷负鍒濆鐘舵��
- existFileInDb.setStatus(MachineFile.STATUS_NORMAL);
- }
- existFileInDb.setMd5(mf.getMd5());
-
-
- machineFileService.updateById(existFileInDb);
-
- }
-
- }
-
-
- }
- */
- /**
- * 璇诲彇鏂囦欢涓殑绋嬪簭鐘舵��
- * @param filePath 鏂囦欢璺緞
- * @param machineGroupCode
- * @param annotatiionList 娉ㄩ噴閰嶇疆瀛楀吀
- * @return 鐘舵�佺殑鏁存暟涔嬪拰
- * @throws IOException
- */
- /*
- int readProgramStatus(Path filePath,String machineGroupCode,List<DictBiz> annotatiionList) throws IOException {
- int programStatus = MachineFile.PROGRAM_STATUS_UNKNOWN;
- try(InputStream ins = Files.newInputStream(filePath)){
- String statusLine = FileContentUtil.readLineAt(ins,ProgramAnnotationService.STATUS_LINE_INDEX);
- if(programAnnotationService.isAnnotation(statusLine,machineGroupCode,annotatiionList)){
- String progStatusTxt = programAnnotationService.removeAnnotation(machineGroupCode,statusLine,annotatiionList);
- if(ProgramAnnotationService.SQ.equals(progStatusTxt)){
- programStatus = MachineFile.PROGRAM_STATUS_TRY;
- }else if(ProgramAnnotationService.GH.equals(progStatusTxt)){
- programStatus = MachineFile.PROGRAM_STATUS_CURED;
- }else if(ProgramAnnotationService.PL.equals(progStatusTxt)){
- programStatus = MachineFile.PROGRAM_STATUS_DIVIASTION;
- }
- }
- }
-
- return programStatus;
- }
- */
- /**
- * 娓呯悊宸茬粡鍒犻櫎浜嗘枃浠剁殑璁板綍
- * @param machine
- * @param dirType
- * @throws IOException
- */
- /*
- void clearDeletedReccords(Machine machine,String dirType) throws IOException {
- List<MachineFile> machineFiles = this.machineFileService.lambdaQuery().eq(MachineFile::getDirType,dirType)
- .eq(MachineFile::getMachineCode,machine.getCode()).list();
-
- String basePath = MachineFileService.getBasePath(machine,dirType);
- if(basePath == null) {
- log.warn("鐩綍绫诲瀷涓嶅尮閰�:{}",dirType);
- return;
- }
- Path dirPath = Paths.get(basePath);
- if(!dirPath.toFile().exists()){
- log.warn("鎵弿鐩綍:{} 涓嶅瓨鍦�",dirPath);
- return;
- }
-
- List<Path> files = Files.list(dirPath)
- .filter(Files::isRegularFile).toList();
-
- for(MachineFile mf : machineFiles){
- long findCount = files.stream().filter(filePath -> filePath.toFile().getName().equals(mf.getName())).count();
- if(findCount == 0){
- //鏂囦欢澶瑰唴娌℃壘鍒帮紝闇�瑕佸垹闄よ褰�
- mf.markFileDeleted();
- this.machineFileService.updateById(mf);
- }
- }
- }*/
}
--
Gitblit v1.9.3