From e5bd30e774dba285e0e22bbfa5e4e0d936d88e6b Mon Sep 17 00:00:00 2001
From: lyh <925863403@qq.com>
Date: 星期四, 12 三月 2026 10:32:26 +0800
Subject: [PATCH] 430代码 SQL server
---
src/main/java/com/lxzn/auth/config/WebSecurityConfig.java | 2
src/main/java/com/lxzn/framework/utils/file/FileUtil.java | 237 +++++++++++++++++++
src/main/resources/scheduled.properties | 6
src/main/java/com/lxzn/framework/domain/plm/PdmProgramSource.java | 4
src/main/java/com/lxzn/activiti/service/IToEquipmentTaskService.java | 19 +
src/main/java/com/lxzn/activiti/service/IAssignFileStreamService.java | 3
src/main/java/com/lxzn/plm/service/impl/PdmProgramSourceServiceImpl.java | 13
src/main/java/com/lxzn/nc/service/impl/DeviceGroupServiceImpl.java | 43 +++
pom.xml | 20
src/main/java/com/lxzn/activiti/service/impl/AssignFileStreamServiceImpl.java | 148 ++++++++++++
src/main/java/com/lxzn/framework/domain/activiti/response/ActivitiCode.java | 2
src/main/java/com/lxzn/framework/domain/plm/ext/PdmProgramInfoExt.java | 8
src/main/java/com/lxzn/activiti/service/impl/ToEquipmentTaskServiceImpl.java | 112 +++++++++
src/main/java/com/lxzn/framework/utils/date/DateUtil.java | 1
src/main/java/com/lxzn/plm/service/impl/QueryNcProgramLogServiceImpl.java | 4
src/main/resources/application.yml | 16
src/main/java/com/lxzn/config/SwaggerConfig.java | 20 +
src/main/java/com/lxzn/nc/service/IDeviceGroupService.java | 15 +
18 files changed, 645 insertions(+), 28 deletions(-)
diff --git a/pom.xml b/pom.xml
index d88fd40..b6b7025 100644
--- a/pom.xml
+++ b/pom.xml
@@ -71,22 +71,22 @@
<!--spring boot 缁撴潫-->
<!--鎸佷箙灞� 鏁版嵁搴� 杩炴帴姹� 寮�濮�-->
<!--鏁版嵁搴撹繛鎺ュ湪springboot涓畾涔変簡锛屾墍浠ュ彲浠ョ鐞嗗寘鐨勭増鏈�-->
-<!-- <dependency>-->
-<!-- <groupId>com.microsoft.sqlserver</groupId>-->
-<!-- <artifactId>mssql-jdbc</artifactId>-->
-<!-- <scope>runtime</scope>-->
-<!-- </dependency>-->
+ <dependency>
+ <groupId>com.microsoft.sqlserver</groupId>
+ <artifactId>mssql-jdbc</artifactId>
+ <scope>runtime</scope>
+ </dependency>
<!-- <dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql-connector-java.version}</version>
</dependency>-->
<!-- 杈炬ⅵ鏁版嵁搴� -->
- <dependency>
- <groupId>com.dameng</groupId>
- <artifactId>DmJdbcDriver18</artifactId>
- <version>8.1.1.193</version>
- </dependency>
+<!-- <dependency>-->
+<!-- <groupId>com.dameng</groupId>-->
+<!-- <artifactId>DmJdbcDriver18</artifactId>-->
+<!-- <version>8.1.1.193</version>-->
+<!-- </dependency>-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
diff --git a/src/main/java/com/lxzn/activiti/service/IAssignFileStreamService.java b/src/main/java/com/lxzn/activiti/service/IAssignFileStreamService.java
index fec2dbb..b8db0b6 100644
--- a/src/main/java/com/lxzn/activiti/service/IAssignFileStreamService.java
+++ b/src/main/java/com/lxzn/activiti/service/IAssignFileStreamService.java
@@ -8,6 +8,8 @@
import com.lxzn.framework.domain.activiti.request.AssignFileRequest;
import com.lxzn.framework.domain.activiti.request.AssignFileStreamQueryRequest;
import com.lxzn.framework.domain.activiti.response.ActivitiCode;
+import com.lxzn.framework.domain.nc.DocInfo;
+import com.lxzn.framework.domain.plm.PdmProgramSource;
import com.lxzn.framework.model.response.QueryPageResponseResult;
import com.lxzn.framework.model.response.ResponseResult;
@@ -117,4 +119,5 @@
String partsCode, String processCode,
String description,String id);
+ boolean saveListNcFromPdm(DocInfo docInfo, PdmProgramSource source);
}
diff --git a/src/main/java/com/lxzn/activiti/service/IToEquipmentTaskService.java b/src/main/java/com/lxzn/activiti/service/IToEquipmentTaskService.java
index ccf49fb..18c2204 100644
--- a/src/main/java/com/lxzn/activiti/service/IToEquipmentTaskService.java
+++ b/src/main/java/com/lxzn/activiti/service/IToEquipmentTaskService.java
@@ -3,5 +3,24 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.lxzn.framework.domain.activiti.ToEquipmentTask;
+import java.util.List;
+
public interface IToEquipmentTaskService extends IService<ToEquipmentTask> {
+
+ //鍙戦�佹枃浠跺埌瀵嗘爣鏂囦欢澶�
+ void updateNcFileFromTask();
+
+ /**
+ * 鏌ヨ鏌愪竴绫绘枃浠�
+ * @param syncFlag
+ * @return
+ */
+ List<ToEquipmentTask> selectTaskSyncFlag(Integer syncFlag);
+
+ /**
+ * 閫氳繃鏂囦欢鍚嶇О涓庣姸鎬佺‘瀹氭槸鍚﹀彲浠ュ垹闄�
+ * @param filePath,fileEncodeName,yncFlag
+ * @return
+ */
+ List<ToEquipmentTask> selectTaskByNameAndSyncFlag(String filePath,String fileEncodeName,Integer syncFlag);
}
diff --git a/src/main/java/com/lxzn/activiti/service/impl/AssignFileStreamServiceImpl.java b/src/main/java/com/lxzn/activiti/service/impl/AssignFileStreamServiceImpl.java
index d2535a8..1213b9c 100644
--- a/src/main/java/com/lxzn/activiti/service/impl/AssignFileStreamServiceImpl.java
+++ b/src/main/java/com/lxzn/activiti/service/impl/AssignFileStreamServiceImpl.java
@@ -7,6 +7,8 @@
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
import com.lxzn.activiti.dao.AssignFileStreamMapper;
import com.lxzn.activiti.service.IActivitiDefinitionService;
import com.lxzn.activiti.service.IAssignFileStreamService;
@@ -27,6 +29,7 @@
import com.lxzn.framework.domain.nc.*;
import com.lxzn.framework.domain.nc.response.DeviceCode;
import com.lxzn.framework.domain.nc.response.DocumentCode;
+import com.lxzn.framework.domain.plm.PdmProgramSource;
import com.lxzn.framework.domain.ucenter.Department;
import com.lxzn.framework.domain.ucenter.response.UcenterCode;
import com.lxzn.framework.exception.ExceptionCast;
@@ -52,6 +55,8 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import java.io.File;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -107,6 +112,10 @@
private String serverIp;
@Value("${securedoc.serverPort}")
private int serverPort;
+ @Value("${ncPdm.file_path}")
+ private String localFilePath;
+ @Value("${fileHomePath}")
+ private String fileHomePath;
@Override
@Transactional(rollbackFor = {Exception.class})
@@ -764,6 +773,7 @@
dncLogService.save(dncLog);
return false;
}
+ //宸ュ簭澶╁姞閫昏緫
processCode = processCode.split("_")[0];
ProcessStream stream = processStreamService.findByProcessEquipment(equipmentId,
processCode,description,compTotal.getComponentId(),part.getPartsId());
@@ -857,4 +867,142 @@
dncLogService.save(dncLog);
return synchronizedFlagService.updateFlag(0);
}
+
+ /**
+ *
+ * @param docInfo
+ * @param source
+ * @return
+ */
+ @Override
+ @Transactional(rollbackFor = {Exception.class})
+ public boolean saveListNcFromPdm(DocInfo docInfo, PdmProgramSource source) {
+
+ DncLog dncLog = new DncLog();
+ DeviceInfo deviceInfo = deviceInfoService.getByDeviceNo("PDMMES");
+ if(deviceInfo == null) {
+ dncLog.setRemarks("DNC涓澶囦笉瀛樺湪,鏃犳璁惧鐨勭▼搴忎笅鍙慱PDMMES" );
+ dncLogService.save(dncLog);
+ return false;
+ }
+ DocFile docFile = docFileService.getById(docInfo.getPublishFileId());
+ if(docFile == null) {
+ return false;
+ }
+ String id = IdWorker.getIdStr();
+ String name = DateUtil.format(DateUtil.getNow(),DateUtil.STR_YEARMONTHDAY);
+ String newPath = "/securedoc" + docFile.getFilePath();
+ String loFilePath = fileHomePath + newPath + "\\" + name +"_" + id;
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ String json = mapper.writeValueAsString(source);
+ try {
+ FileUtil.fileWriterSql(loFilePath,json);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ //鎻掑叆鏂囨。鍒拌澶囧彂閫佹枃妗�
+ DocClassification classification = classificationService.getByCode(SEND_CODE);
+ if(classification == null)
+ return false;
+ DocRelative docRelative = new DocRelative();
+ docRelative.setDocId(docInfo.getDocId());
+ docRelative.setClassificationId(classification.getClassificationId());
+ docRelative.setAttributionType(4);
+ docRelative.setAttributionId(deviceInfo.getDeviceId());
+ boolean b = docRelativeService.save(docRelative);
+ if(!b) {
+ return false;
+ }
+
+ //澶嶅埗鏂囦欢锛岃繘琛岄瀹氬瘑
+ b = FileUtil.copyFile(docFile.getFilePath(), newPath, docFile.getFileEncodeName());
+ if(!b){
+ return false;
+ }
+
+ String absPath = FileUtil.getFileAbsPath(newPath, docFile.getFileEncodeName());
+ if(absPath == null){
+ return false;
+ }
+ try {
+ secureDocService.binByFileLable(absPath);
+ } catch (Exception e) {
+ return false;
+ }
+ try {
+ secureDocService.editLabelByPath(absPath);
+ }catch (Exception e) {
+ return false;
+ }
+ //鎻掑叆鏂囦欢浼犺緭浠诲姟琛�
+ ToEquipmentTask equipmentTask = new ToEquipmentTask();
+ //涓嶈兘鐩存帴浠巇oc涓嬁fileId 鍜寁ersion 鍙兘浼氬瓨鍦ㄥ彉鏇�
+
+ //equipmentTask.setFileId(docInfo.getPublishFileId());
+ //equipmentTask.setDocVersion(docInfo.getPublishVersion());
+ equipmentTask.setDocId(docInfo.getDocId());
+ equipmentTask.setSyncFlag(1);
+ equipmentTask.setDeviceNo(deviceInfo.getDeviceNo());
+ equipmentTask.setDeviceId(deviceInfo.getDeviceId());
+ equipmentTask.setDepartId(deviceInfo.getDepartId());
+ //鏂囦欢鐩稿叧淇℃伅
+ equipmentTask.setFileId(docFile.getFileId());
+ equipmentTask.setDocVersion(docFile.getDocVersion());
+ equipmentTask.setFileName(docInfo.getDocName());
+ equipmentTask.setFileEncodeName(docFile.getFileEncodeName());
+ equipmentTask.setFilePath(docFile.getFilePath());
+ equipmentTask.setFileSuffix(docFile.getFileSuffix());
+ equipmentTask.setFileSize(docFile.getFileSize());
+ b = equipmentTaskService.save(equipmentTask);
+ if(!b) {
+ return false;
+ }
+
+
+ //TODO
+ //澶嶅埗鏂囦欢锛岃繘琛岄瀹氬瘑
+ String absPathTxt = FileUtil.getFileAbsPathTxt(loFilePath);
+ if(absPathTxt == null){
+ return false;
+ }
+ try {
+ secureDocService.binByFileLable(absPathTxt);
+ } catch (Exception e) {
+ return false;
+ }
+ try {
+ secureDocService.editLabelByPath(absPathTxt);
+ }catch (Exception e) {
+ return false;
+ }
+
+ ToEquipmentTask equipmentTaskTxt = new ToEquipmentTask();
+ /*equipmentTaskTxt.setDocId(docInfo.getDocId());*/
+ equipmentTaskTxt.setSyncFlag(1);
+ equipmentTaskTxt.setDeviceNo(deviceInfo.getDeviceNo());
+ equipmentTaskTxt.setDeviceId(deviceInfo.getDeviceId());
+ equipmentTaskTxt.setDepartId(deviceInfo.getDepartId());
+ //鏂囦欢鐩稿叧淇℃伅
+ /*equipmentTaskTxt.setFileId(docFile.getFileId());*/
+ equipmentTaskTxt.setDocVersion("a.1");
+ equipmentTaskTxt.setFileName( name +"_" + id);
+ equipmentTaskTxt.setFileEncodeName( name +"_" + id);
+ equipmentTaskTxt.setFilePath(docFile.getFilePath());
+ equipmentTaskTxt.setFileSuffix("txt");
+ equipmentTaskTxt.setFileSize(FileUtil.selectFileSize(new File(loFilePath)));
+ boolean txt = equipmentTaskService.save(equipmentTaskTxt);
+ if(!txt) {
+ return false;
+ }
+
+ dncLog.setIsSuccess(LogCodeUtil.success_is_true);
+ dncLog.setRemarks("涓嬪彂鎴愬姛");
+ dncLogService.save(dncLog);
+ return synchronizedFlagService.updateFlag(0);
+ }
}
diff --git a/src/main/java/com/lxzn/activiti/service/impl/ToEquipmentTaskServiceImpl.java b/src/main/java/com/lxzn/activiti/service/impl/ToEquipmentTaskServiceImpl.java
index 092ebe4..2c7a38a 100644
--- a/src/main/java/com/lxzn/activiti/service/impl/ToEquipmentTaskServiceImpl.java
+++ b/src/main/java/com/lxzn/activiti/service/impl/ToEquipmentTaskServiceImpl.java
@@ -4,8 +4,120 @@
import com.lxzn.activiti.dao.ToEquipmentTaskMapper;
import com.lxzn.activiti.service.IToEquipmentTaskService;
import com.lxzn.framework.domain.activiti.ToEquipmentTask;
+import com.lxzn.framework.domain.activiti.response.ActivitiCode;
+import com.lxzn.framework.domain.nc.DeviceInfo;
+import com.lxzn.framework.exception.ExceptionCast;
+import com.lxzn.framework.utils.ValidateUtil;
+import com.lxzn.framework.utils.file.FileUtil;
+import com.lxzn.nc.service.IDeviceGroupService;
+import com.lxzn.nc.service.IDeviceInfoService;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.security.core.parameters.P;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
@Service
public class ToEquipmentTaskServiceImpl extends ServiceImpl<ToEquipmentTaskMapper, ToEquipmentTask> implements IToEquipmentTaskService {
+
+ @Autowired
+ private IDeviceInfoService deviceInfoService;
+ @Autowired
+ private IDeviceGroupService deviceGroupService;
+
+ @Override
+ @Scheduled(cron = "${taskSync}")
+ public void updateNcFileFromTask() {
+ List<ToEquipmentTask> taskList = this.selectTaskSyncFlag(1);
+ if (taskList == null || taskList.isEmpty()) {
+ return;
+ }
+ List<ToEquipmentTask> successTasks = new ArrayList<>();
+
+ for (ToEquipmentTask task : taskList) {
+ DeviceInfo deviceInfo = deviceInfoService.getByDeviceNo(task.getDeviceNo());
+ if (deviceInfo == null) {
+ continue;
+ }
+ List<String> pathList = deviceGroupService.findListParentTreeAll(deviceInfo.getGroupId());
+ if (pathList == null || pathList.isEmpty()) {
+ continue;
+ }
+ String targetPath = StringUtils.join(pathList.toArray(), "/")
+ + "/" + deviceInfo.getDeviceNo()
+ + "/send/"
+ + task.getFileName();
+ String sourceFilePath = task.getFilePath() + "/" + task.getFileEncodeName();
+ Boolean copySuccess = FileUtil.copyFileUpName(sourceFilePath, targetPath, task.getFileSuffix());
+ if (copySuccess) {
+ task.setSyncFlag(2);
+ successTasks.add(task);
+ }
+ }
+ if (!successTasks.isEmpty()) {
+ super.saveOrUpdateBatch(successTasks);
+ }
+ deleteSourceFilesAfterBatchUpdate(taskList);
+ }
+
+ /**
+ * 鎵归噺鏇存柊鍚庢鏌ュ苟鍒犻櫎婧愭枃浠�
+ */
+ private void deleteSourceFilesAfterBatchUpdate(List<ToEquipmentTask> allTasks) {
+ Map<String, String> filePathMap = new HashMap<>();
+
+ for (ToEquipmentTask task : allTasks) {
+ if (task.getSyncFlag() == 2) {
+ String key = task.getFilePath() + "_" + task.getFileEncodeName();
+ if (!filePathMap.containsKey(key)) {
+ filePathMap.put(key, task.getFilePath() + "/" + task.getFileEncodeName());
+ }
+ }
+ }
+ for (Map.Entry<String, String> entry : filePathMap.entrySet()) {
+ String[] parts = entry.getKey().split("_");
+ if (parts.length >= 2) {
+ String filePath = parts[0];
+ String fileEncodeName = parts[1];
+ List<ToEquipmentTask> remainingTasks = this.selectTaskByNameAndSyncFlag(
+ filePath,
+ fileEncodeName,
+ 1
+ );
+ if (remainingTasks == null || remainingTasks.isEmpty()) {
+ FileUtil.deleteNcFile(entry.getValue());
+ }
+ }
+ }
+ }
+
+ @Override
+ public List<ToEquipmentTask> selectTaskSyncFlag(Integer syncFlag) {
+ if (!ValidateUtil.validateInteger(syncFlag)) {
+ return null;
+ }
+ return super.lambdaQuery()
+ .eq(ToEquipmentTask::getSyncFlag, syncFlag)
+ .list();
+ }
+
+ @Override
+ public List<ToEquipmentTask> selectTaskByNameAndSyncFlag(String filePath, String fileEncodeName, Integer syncFlag) {
+ if (!ValidateUtil.validateInteger(syncFlag)
+ || !ValidateUtil.validateString(filePath)
+ || !ValidateUtil.validateString(fileEncodeName)) {
+ return null;
+ }
+ return super.lambdaQuery()
+ .eq(ToEquipmentTask::getSyncFlag, syncFlag)
+ .eq(ToEquipmentTask::getFilePath, filePath)
+ .eq(ToEquipmentTask::getFileEncodeName, fileEncodeName)
+ .list();
+ }
}
diff --git a/src/main/java/com/lxzn/auth/config/WebSecurityConfig.java b/src/main/java/com/lxzn/auth/config/WebSecurityConfig.java
index 0b425ad..caf71cc 100644
--- a/src/main/java/com/lxzn/auth/config/WebSecurityConfig.java
+++ b/src/main/java/com/lxzn/auth/config/WebSecurityConfig.java
@@ -17,7 +17,7 @@
@Override
public void configure(WebSecurity web) {
- web.ignoring().antMatchers("/auth/user/login","/auth/user/logout","/auth/user/jwt", "/services/**","/auth//user/updatePd");
+ web.ignoring().antMatchers("/auth/user/login","/auth/user/logout","/auth/user/jwt", "/services/**","/auth/user/updatePd");
}
diff --git a/src/main/java/com/lxzn/config/SwaggerConfig.java b/src/main/java/com/lxzn/config/SwaggerConfig.java
index e082e92..cb588c5 100644
--- a/src/main/java/com/lxzn/config/SwaggerConfig.java
+++ b/src/main/java/com/lxzn/config/SwaggerConfig.java
@@ -15,6 +15,7 @@
import java.util.Arrays;
import java.util.Collections;
+import java.util.List;
/**
* @author joetao
@@ -43,6 +44,7 @@
.paths(PathSelectors.any())
.build()
.apiInfo(apiInfo())
+ //.securitySchemes(Arrays.asList(apiKey()))
.securitySchemes(Collections.singletonList(securityScheme()))
.securityContexts(Collections.singletonList(securityContext()));
}
@@ -80,6 +82,7 @@
.build();
}
+
/**
* 杩欓噷鏄啓鍏佽璁よ瘉鐨剆cope
*/
@@ -88,4 +91,21 @@
new AuthorizationScope("all", "All scope is trusted!")
};
}
+
+ private ApiKey apiKey() {
+ return new ApiKey("apiKey", "api_key", "header");
+ }
+ /*private SecurityContext securityContext() {
+ return SecurityContext.builder()
+ .securityReferences(defaultAuth())
+ .forPaths(PathSelectors.any())
+ .build();
+ }*/
+
+ List<SecurityReference> defaultAuth() {
+ AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
+ AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
+ authorizationScopes[0] = authorizationScope;
+ return Arrays.asList(new SecurityReference("apiKey", authorizationScopes));
+ }
}
diff --git a/src/main/java/com/lxzn/framework/domain/activiti/response/ActivitiCode.java b/src/main/java/com/lxzn/framework/domain/activiti/response/ActivitiCode.java
index 5c5766c..c8bcaa6 100644
--- a/src/main/java/com/lxzn/framework/domain/activiti/response/ActivitiCode.java
+++ b/src/main/java/com/lxzn/framework/domain/activiti/response/ActivitiCode.java
@@ -23,7 +23,7 @@
ACT_DOC_ID_NONE(false, 21014, "鏂囨。缂栧彿涓嶅瓨鍦紒"),
ACT_DOC_ERROR(false,21015,"鍚姩娴佺▼澶辫触锛屾枃妗d俊鎭敊璇紒"),
ACT_DEVICE_DOC_ERROR(false,21016,"鍚姩娴佺▼澶辫触锛岃澶囧凡瀛樺湪璇ユ枃妗o紒"),
- ACT_DEVICE_DOC_FILELABLE(false,21016,"瀵嗘爣绯荤粺寮傚父锛�");
+ ACT_DEVICE_DOC_FILELABLE(false,21017,"瀵嗘爣绯荤粺寮傚父,锛�");
//鎿嶄綔浠g爜
@ApiModelProperty(value = "鎿嶄綔鏄惁鎴愬姛", example = "true", required = true)
diff --git a/src/main/java/com/lxzn/framework/domain/plm/PdmProgramSource.java b/src/main/java/com/lxzn/framework/domain/plm/PdmProgramSource.java
index 6ce8fa2..c9dde36 100644
--- a/src/main/java/com/lxzn/framework/domain/plm/PdmProgramSource.java
+++ b/src/main/java/com/lxzn/framework/domain/plm/PdmProgramSource.java
@@ -66,6 +66,10 @@
private String ae8ncModelNo;
@TableField(value = "SQZT")
private String sqzt;
+ /**/
+ @TableField(exist = false)
+ private String fileName;
+
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
diff --git a/src/main/java/com/lxzn/framework/domain/plm/ext/PdmProgramInfoExt.java b/src/main/java/com/lxzn/framework/domain/plm/ext/PdmProgramInfoExt.java
new file mode 100644
index 0000000..e397d04
--- /dev/null
+++ b/src/main/java/com/lxzn/framework/domain/plm/ext/PdmProgramInfoExt.java
@@ -0,0 +1,8 @@
+package com.lxzn.framework.domain.plm.ext;
+
+/**
+ * @author clown
+ * * @date 2024/3/25
+ */
+public class PdmProgramInfoExt {
+}
diff --git a/src/main/java/com/lxzn/framework/utils/date/DateUtil.java b/src/main/java/com/lxzn/framework/utils/date/DateUtil.java
index 8482a2c..c25bdca 100644
--- a/src/main/java/com/lxzn/framework/utils/date/DateUtil.java
+++ b/src/main/java/com/lxzn/framework/utils/date/DateUtil.java
@@ -22,6 +22,7 @@
public static final String STR_DATE_TIME_FULL = "yyyyMMddHHmmssSSS";
public static final String STR_DATE_TIME_SHE = "yyyyMMddHHmmss";
public static final String STR_YEARMONTH = "yyyyMM";
+ public static final String STR_YEARMONTHDAY = "yyyyMMdd";
public static final String STR_YEAR = "yyyy";
/**
diff --git a/src/main/java/com/lxzn/framework/utils/file/FileUtil.java b/src/main/java/com/lxzn/framework/utils/file/FileUtil.java
index a7994d9..979ebf4 100644
--- a/src/main/java/com/lxzn/framework/utils/file/FileUtil.java
+++ b/src/main/java/com/lxzn/framework/utils/file/FileUtil.java
@@ -5,7 +5,6 @@
import com.lxzn.framework.exception.ExceptionCast;
import com.lxzn.framework.utils.SHA256Util;
import com.lxzn.framework.utils.date.DateUtil;
-import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
@@ -17,7 +16,9 @@
import java.net.URLEncoder;
import java.nio.channels.FileChannel;
import java.nio.file.Files;
+import java.nio.file.Path;
import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
import java.security.MessageDigest;
import java.util.ArrayList;
import java.util.Date;
@@ -28,6 +29,11 @@
public class FileUtil {
private static String fileUploadFolder;
+ private static String fileNcGateway;
+ @Value("${fileNcGateway}")
+ public void setFileNcGateway(String fileNcGateway) {
+ FileUtil.fileNcGateway = fileNcGateway;
+ }
@Value("${fileHomePath}")
public void setFileUploadFolder(String fileUploadFolder) {
@@ -62,6 +68,179 @@
dto.setFileSize(fileSize);
dto.setFileSuffix(suffix);
return dto;
+ }
+
+ /**
+ * 鏂规硶涓�:浣跨敤 FileWriter 鍐欐枃浠�
+ * @param filepath 鏂囦欢鐩綍
+ * @param content 寰呭啓鍏ュ唴瀹�
+ * @throws IOException
+ */
+ public static void fileWriterSql(String filepath, String content) throws IOException {
+ OutputStreamWriter outputStreamWriter = null;
+ try {
+ File file = new File(filepath);
+ if (!file.exists()){
+ file.createNewFile();
+ }
+ FileOutputStream outputStream = new FileOutputStream(file);
+ if (outputStream != null){
+ outputStreamWriter = new OutputStreamWriter(outputStream, "utf-8");
+ outputStreamWriter.write(content);
+ outputStreamWriter.flush();
+ }
+ try {
+ if (outputStreamWriter != null){
+ outputStreamWriter.close();
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ catch (IOException e) {
+ e.getMessage();
+ }
+ finally {
+ try {
+ if (outputStreamWriter != null){
+ outputStreamWriter.close();
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * 鍒犻櫎鏂囦欢
+ *
+ * @param filePath
+ * @return
+ */
+ public static boolean deleteNcFile(String filePath) {
+ String lastFileReName = fileUploadFolder + "/" + filePath ;
+ boolean flag = false;
+ File file = new File(lastFileReName);
+ if (!file.exists()) {
+ return flag;
+ }
+ boolean b = file.delete();
+ if (!b) {
+ System.out.println("鏂囦欢鍒犻櫎澶辫触锛� " + filePath);
+ }
+ return true;
+ }
+
+ /**
+ * 澶嶅埗鏂囦欢锛堝甫閲嶈瘯銆佸ぇ灏忔牎楠屽拰MD5鏍¢獙锛岀‘淇濆鍒跺畬鏁存�т笌鍙潬鎬э級
+ * 浠� fileUploadFolder 涓嬬殑婧愯矾寰勫鍒跺埌 fileNcGateway 涓嬬殑鐩爣璺緞锛屽彲鎸囧畾鏂扮殑鏂囦欢鎵╁睍鍚�
+ * @param lastFile 婧愭枃浠剁殑鐩稿璺緞锛堢浉瀵逛簬 fileUploadFolder锛�
+ * @param newFile 鐩爣鏂囦欢鐨勭浉瀵硅矾寰勶紙鐩稿浜� fileNcGateway锛�
+ * @param ncFix 锛堝彲閫夛級鐩爣鏂囦欢鐨勬柊鎵╁睍鍚嶏紙涓嶅甫鐐癸紝濡� "txt"锛夛紝浼犲叆 null 鎴栫┖瀛楃涓插垯涓嶄慨鏀瑰師鎵╁睍鍚�
+ * @return 澶嶅埗鎴愬姛杩斿洖 true锛屽惁鍒欒繑鍥� false
+ */
+ public static boolean copyFileUpName(String lastFile, String newFile, String ncFix) {
+ // 1. 鏋勫缓婧愭枃浠跺拰鐩爣鏂囦欢鐨勭粷瀵硅矾寰�
+ String sourceFilePath = fileUploadFolder + "/" + lastFile;
+ String targetFilePath = fileNcGateway + "/" + newFile;
+
+ // 2. 濡傛灉鎸囧畾浜嗘柊鐨勬墿灞曞悕锛屽垯闄勫姞鍒扮洰鏍囨枃浠跺悕
+ if (StringUtils.isNotBlank(ncFix)) {
+ targetFilePath = targetFilePath + "." + ncFix;
+ }
+
+ // 3. 鍒涘缓鐩爣鏂囦欢澶�
+ File targetFile = new File(targetFilePath);
+ File targetParentDir = targetFile.getParentFile();
+ if (!targetParentDir.exists() && !targetParentDir.mkdirs()) {
+ log.error("鏃犳硶鍒涘缓鐩爣鏂囦欢澶�: {}", targetParentDir.getAbsolutePath());
+ return false;
+ }
+
+ // 4. 鑾峰彇婧愭枃浠堕鏈熷ぇ灏�
+ long expectedSize = -1;
+ File sourceFile = new File(sourceFilePath);
+ if (!sourceFile.exists()) {
+ log.error("婧愭枃浠朵笉瀛樺湪: {}", sourceFilePath);
+ return false;
+ }
+ try {
+ expectedSize = sourceFile.length();
+ log.info("鏂囦欢澶嶅埗: 婧�={}, 鐩爣={}, 澶у皬={}瀛楄妭", sourceFilePath, targetFilePath, expectedSize);
+ } catch (SecurityException e) {
+ log.error("鏃犳硶璁块棶婧愭枃浠�: {}", sourceFilePath, e);
+ return false;
+ }
+
+ // 5. 澶嶅埗鎿嶄綔锛堟渶澶氶噸璇�3娆★級
+ int maxRetries = 3;
+ int attempt = 0;
+ boolean copySuccess = false;
+
+ while (attempt < maxRetries && !copySuccess) {
+ attempt++;
+ try {
+ log.info("---- 寮�濮嬬{}娆″鍒跺皾璇� ----", attempt);
+
+ // 6. 鎵ц澶嶅埗鎿嶄綔锛堜娇鐢∟IO FileChannel浠ユ彁楂樻晥鐜囷級
+ long startTime = System.currentTimeMillis();
+ try (FileChannel in = new FileInputStream(sourceFilePath).getChannel();
+ FileChannel out = new FileOutputStream(targetFilePath).getChannel()) {
+ out.transferFrom(in, 0, in.size());
+ }
+ long endTime = System.currentTimeMillis();
+ log.info("鏂囦欢浼犺緭瀹屾垚锛岃�楁椂: {}姣", (endTime - startTime));
+
+ // 7. 鏂囦欢澶у皬楠岃瘉
+ File copiedFile = new File(targetFilePath);
+ long actualSize = copiedFile.length();
+
+ if (expectedSize != actualSize) {
+ log.warn("澶у皬涓嶄竴鑷�! 棰勬湡: {}B, 瀹為檯: {}B (宸��: {}B)",
+ expectedSize, actualSize, Math.abs(actualSize - expectedSize));
+ } else {
+ log.info("鏂囦欢澶у皬楠岃瘉鎴愬姛: {}B", actualSize);
+ copySuccess = true;
+ }
+
+ // 8. MD5鏍¢獙
+ if (copySuccess) {
+ String sourceMd5 = calculateMD5(sourceFilePath);
+ String targetMd5 = calculateMD5(targetFilePath);
+
+ if (!sourceMd5.equals(targetMd5)) {
+ log.warn("MD5涓嶄竴鑷�! 婧�: {}, 鐩爣: {}", sourceMd5, targetMd5);
+ copySuccess = false;
+ } else {
+ log.info("MD5楠岃瘉鎴愬姛");
+ }
+ }
+
+ } catch (IOException | SecurityException e) {
+ log.error("绗瑊}娆″鍒跺け璐�", attempt, e);
+ }
+
+ // 9. 閲嶈瘯闂撮殧澶勭悊
+ if (!copySuccess && attempt < maxRetries) {
+ try {
+ int delay = 200 * attempt; // 閫掑寤惰繜锛�200ms, 400ms
+ log.info("绛夊緟 {}ms 鍚庨噸璇�", delay);
+ Thread.sleep(delay);
+ } catch (InterruptedException ie) {
+ Thread.currentThread().interrupt();
+ log.warn("閲嶈瘯绛夊緟琚腑鏂�", ie);
+ break; // 濡傛灉绾跨▼琚腑鏂紝鍒欓��鍑洪噸璇曞惊鐜�
+ }
+ }
+ }
+
+ if (copySuccess) {
+ log.info("鏂囦欢澶嶅埗瀹屾垚: {}", targetFilePath);
+ } else {
+ log.error("鏂囦欢澶嶅埗澶辫触锛屽凡灏濊瘯{}娆°�傛簮鏂囦欢: {}, 鐩爣鏂囦欢: {}", maxRetries, sourceFilePath, targetFilePath);
+ }
+
+ return copySuccess;
}
public static FileUploadResult uploadFile(String fileName, InputStream fis) {
@@ -179,6 +358,54 @@
log.error(e.getMessage());
}
return -1;
+ }
+
+
+
+ /**
+ * 鍒犻櫎鏂囦欢
+ *
+ * @param filePath
+ * @return
+ */
+ public static boolean deleteFile(String filePath) {
+ boolean flag = false;
+ File file = new File(filePath);
+ if (!file.exists()) {
+ return flag;
+ }
+ boolean b = file.delete();
+ if (!b) {
+ try {
+ System.gc();
+ Path path = Paths.get(filePath);
+ Files.deleteIfExists(path);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ return true;
+ }
+
+
+ /**
+ *
+ * @param file
+ * @return
+ */
+ public static long selectFileSize(File file) {
+ try (FileInputStream fis = new FileInputStream(file)) {
+ long size = 0;
+ int read;
+ byte[] buffer = new byte[1024];
+ while ((read = fis.read(buffer)) != -1) {
+ size += read;
+ }
+ return size;
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return 0;
}
/**
@@ -438,7 +665,6 @@
}
}
-
public static String getFileAbsPath(String path, String fileName){
path = fileUploadFolder + path;
File file = new File(path, fileName);
@@ -448,5 +674,12 @@
return null;
}
+ public static String getFileAbsPathTxt(String path){
+ File file = new File(path);
+ if(file.exists()){
+ return file.getAbsolutePath();
+ }
+ return null;
+ }
}
diff --git a/src/main/java/com/lxzn/nc/service/IDeviceGroupService.java b/src/main/java/com/lxzn/nc/service/IDeviceGroupService.java
index dde33ca..a0c6c70 100644
--- a/src/main/java/com/lxzn/nc/service/IDeviceGroupService.java
+++ b/src/main/java/com/lxzn/nc/service/IDeviceGroupService.java
@@ -33,6 +33,21 @@
boolean editDeviceGroup(String id, DeviceGroup deviceGroup);
/**
+ * 鏌ヨ鎵�鏈夌埗鑺傜偣鍜屾湰鑺傜偣鍚嶇О
+ * @param groupId
+ * @return
+ */
+ List<String> findListParentTreeAll(String groupId);
+
+ /**
+ * 鏌ヨ鎵�鏈夌埗鑺傜偣鍚嶇О
+ * @param parentId
+ * @param stringList
+ * @return
+ */
+ List<String> findListParentTree(String parentId,List<String> stringList);
+
+ /**
* 鍒犻櫎璁惧鍒嗙粍
* @param id
* @return
diff --git a/src/main/java/com/lxzn/nc/service/impl/DeviceGroupServiceImpl.java b/src/main/java/com/lxzn/nc/service/impl/DeviceGroupServiceImpl.java
index ccb5eb7..8db3d0b 100644
--- a/src/main/java/com/lxzn/nc/service/impl/DeviceGroupServiceImpl.java
+++ b/src/main/java/com/lxzn/nc/service/impl/DeviceGroupServiceImpl.java
@@ -14,6 +14,7 @@
import com.lxzn.nc.dao.DeviceGroupMapper;
import com.lxzn.nc.service.*;
import com.lxzn.ucenter.service.IDepartmentService;
+import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -128,6 +129,48 @@
}
@Override
+ public List<String> findListParentTreeAll(String groupId) {
+ if ( StringUtils.isEmpty(groupId)) {
+ return null;
+ }
+ List<String> strings = new ArrayList<>();
+ DeviceGroup en = super.getById(groupId);
+ if (en == null) {
+ return null;
+ }
+ strings.add(en.getGroupName());
+ if (StringUtils.isEmpty(en.getParentId())) {
+ return strings;
+ } else {
+ return findListParentTree(en.getParentId(),strings);
+ }
+ }
+ @Override
+ public List<String> findListParentTree(String parentId,List<String> stringList){
+ if (StringUtils.isEmpty(parentId)) {
+ return null;
+ }
+ if (stringList == null || stringList.isEmpty()) {
+ stringList = new ArrayList<>();
+ }
+ boolean p = true;
+ if (p) {
+ DeviceGroup en = super.getById(parentId);
+ if (en != null) {
+ stringList.add(0,en.getGroupName());
+ }
+ if (StringUtils.isNotBlank(en.getParentId())) {
+ parentId = en.getParentId();
+ findListParentTree(parentId,stringList);
+ } else {
+ p = false;
+ return stringList;
+ }
+ }
+ return stringList;
+ }
+
+ @Override
@Transactional(rollbackFor = {Exception.class})
public boolean deleteDeviceGroup(String id) {
if(!ValidateUtil.validateString(id))
diff --git a/src/main/java/com/lxzn/plm/service/impl/PdmProgramSourceServiceImpl.java b/src/main/java/com/lxzn/plm/service/impl/PdmProgramSourceServiceImpl.java
index 900fbcd..88e4d71 100644
--- a/src/main/java/com/lxzn/plm/service/impl/PdmProgramSourceServiceImpl.java
+++ b/src/main/java/com/lxzn/plm/service/impl/PdmProgramSourceServiceImpl.java
@@ -7,6 +7,7 @@
import com.baomidou.mybatisplus.extension.service.additional.query.impl.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fasterxml.jackson.core.type.TypeReference;
+import com.lxzn.activiti.service.IAssignFileStreamService;
import com.lxzn.base.service.IDncLogService;
import com.lxzn.base.service.IEquipmentClassService;
import com.lxzn.framework.domain.base.DncLog;
@@ -88,6 +89,8 @@
private IDncLogService dncLogService;
@Autowired
private IEquipmentClassService equipmentClassService;
+ @Autowired
+ private IAssignFileStreamService assignFileStreamService;
@Value("${ncPdm.file_path}")
@@ -116,7 +119,7 @@
JsonMapper mapper = new JsonMapper();
try {
Object[] objects = new Object[]{ncLog.getSkgxId(),ncLog.getSkgxRevId(),ncLog.getSqzt(),"",""};
- //String program = "{\"code\":1,\"message\":\"\",\"response\":[{\"skgx_id\":\"CX淇℃伅涓績10000070\",\"skgx_rev_id\":\"1\",\"skgx_name\":\"鐒婃帴鏁版帶绋嬪簭\",\"sqzt\":\"S鐘舵�乗",\"ae8nc_cxno\":\"CX淇℃伅涓績10000070\",\"ae8nc_gfrev\":\"1\",\"ae8nc_sbno\":\"2240080\",\"ae8nc_jcid\":\"QJK006\",\"ae8nc_os\":\"鍗庝腑鏁版帶-HNC848C\",\"ae8nc_filename\":\"107052PA5\",\"ae8nc_cxfz\":\"璁$畻鏈轰豢鐪焅",\"ae8nc_operator\":\"\",\"ae8nc_inspect\":\"\",\"ae8nc_acceptview\":\"\",\"ae8nc_cxno_unit\":\"淇℃伅涓績\",\"ae8nc_filename_unit\":\"PA\",\"ae8gallery\":\"\",\"ae8nc_plant\":\"淇℃伅涓績\",\"ae8nc_modelno\":\"jx\",\"ae8nc_batchno\":\"\",\"meop_id\":\"OPHJ000000000049108\",\"meop_rev_id\":\"A\",\"meop_name\":\"鐒婃帴\",\"meop_type\":\"AE8Operation Revision\",\"ae8gx_no\":\"5\",\"process_id\":\"JZG2022008107653\",\"process_rev_id\":\"1\",\"process_name\":\"107052\",\"ae8part_no\":\"107052\",\"ae8stageidentifying\":\"L\",\"ae8gy_type\":\"鏈哄姞宸ヨ壓璁捐\",\"ae8plant\":\"淇℃伅涓績\",\"part_id\":\"1047051\",\"part_rev_id\":\"01\",\"part_name\":\"闆嗘垚娴嬭瘯浠禱",\"create_by\":\"鐢ㄦ埛2(user2)\",\"create_date\":\"02-9鏈�-22 17:15:14\",\"filename\":\"DNC-CX淇℃伅涓績10000070-1.zip\",\"filepath\":\"http://192.168.2.234:8081/ncprogram/202209/DNC-CX淇℃伅涓績10000070-1.zip\"}]}\n";
+ //String program = "{\"code\":1,\"message\":\"\",\"response\":[{\"skgx_id\":\"CX淇℃伅涓績10000070\",\"skgx_rev_id\":\"1\",\"skgx_name\":\"鐒婃帴鏁版帶绋嬪簭\",\"sqzt\":\"S鐘舵�乗",\"ae8nc_cxno\":\"CX淇℃伅涓績10000070\",\"ae8nc_gfrev\":\"1\",\"ae8nc_sbno\":\"2240080\",\"ae8nc_jcid\":\"QJK006\",\"ae8nc_os\":\"鍗庝腑鏁版帶-HNC848C\",\"ae8nc_filename\":\"107052PA5\",\"ae8nc_cxfz\":\"璁$畻鏈轰豢鐪焅",\"ae8nc_operator\":\"\",\"ae8nc_inspect\":\"\",\"ae8nc_acceptview\":\"\",\"ae8nc_cxno_unit\":\"淇℃伅涓績\",\"ae8nc_filename_unit\":\"PA\",\"ae8gallery\":\"\",\"ae8nc_plant\":\"淇℃伅涓績\",\"ae8nc_modelno\":\"jx\",\"ae8nc_batchno\":\"\",\"meop_id\":\"OPHJ000000000049108\",\"meop_rev_id\":\"A\",\"meop_name\":\"鐒婃帴\",\"meop_type\":\"AE8Operation Revision\",\"ae8gx_no\":\"5\",\"process_id\":\"JZG2022008107653\",\"process_rev_id\":\"1\",\"process_name\":\"107052\",\"ae8part_no\":\"107052\",\"ae8stageidentifying\":\"L\",\"ae8gy_type\":\"鏈哄姞宸ヨ壓璁捐\",\"ae8plant\":\"淇℃伅涓績\",\"part_id\":\"1047051\",\"part_rev_id\":\"01\",\"part_name\":\"闆嗘垚娴嬭瘯浠禱",\"create_by\":\"鐢ㄦ埛2(user2)\",\"create_date\":\"02-9鏈�-22 17:15:14\",\"filename\":\"DNC-CX淇℃伅涓績10000070-1.zip\",\"filepath\":\"http://localhost:9099/resources/images/login/bj_bak.png\"}]}\n";
String program =pdmWebClientApi.queryNcProgramAttrInfo(objects);
if (StringUtils.isEmpty(program)) {
log.error("======= 鏃� "+ ncLog.getSkgxId() +" 鏂板璁板綍=======");
@@ -301,8 +304,8 @@
PdmProgramSource source = new PdmProgramSource();
try {
Object[] objects = new Object[]{ncLog.getSkgxId(),ncLog.getSkgxRevId(),ncLog.getSqzt(),"",""};
- //String program = "{\"code\":1,\"message\":\"\",\"response\":[{\"skgx_id\":\"CX淇℃伅涓績10000070\",\"skgx_rev_id\":\"1\",\"skgx_name\":\"鐒婃帴鏁版帶绋嬪簭\",\"sqzt\":\"S鐘舵�乗",\"ae8nc_cxno\":\"CX淇℃伅涓績10000070\",\"ae8nc_gfrev\":\"1\",\"ae8nc_sbno\":\"2240080\",\"ae8nc_jcid\":\"QJK006\",\"ae8nc_os\":\"鍗庝腑鏁版帶-HNC848C\",\"ae8nc_filename\":\"107052PA5\",\"ae8nc_cxfz\":\"璁$畻鏈轰豢鐪焅",\"ae8nc_operator\":\"\",\"ae8nc_inspect\":\"\",\"ae8nc_acceptview\":\"\",\"ae8nc_cxno_unit\":\"401\",\"ae8nc_filename_unit\":\"PA\",\"ae8gallery\":\"\",\"ae8nc_plant\":\"401\",\"ae8nc_modelno\":\"jx\",\"ae8nc_batchno\":\"\",\"meop_id\":\"OPHJ000000000049108\",\"meop_rev_id\":\"A\",\"meop_name\":\"鐒婃帴\",\"meop_type\":\"AE8Operation Revision\",\"ae8gx_no\":\"5\",\"process_id\":\"JZG2022008107653\",\"process_rev_id\":\"1\",\"process_name\":\"107052\",\"ae8part_no\":\"107052\",\"ae8stageidentifying\":\"L\",\"ae8gy_type\":\"鏈哄姞宸ヨ壓璁捐\",\"ae8plant\":\"淇℃伅涓績\",\"part_id\":\"1047051\",\"part_rev_id\":\"01\",\"part_name\":\"闆嗘垚娴嬭瘯浠禱",\"create_by\":\"鐢ㄦ埛2(user2)\",\"create_date\":\"02-9鏈�-22 17:15:14\",\"filename\":\"DNC-CX淇℃伅涓績10000070-1.zip\",\"filepath\":\"http://192.168.2.234:8081/ncprogram/202209/DNC-CX淇℃伅涓績10000070-1.zip\"}]}\n";
- String program =pdmWebClientApi.queryNcProgramAttrInfo(objects);
+ String program = "{\"code\":1,\"message\":\"\",\"response\":[{\"skgx_id\":\"CX淇℃伅涓績10000070\",\"skgx_rev_id\":\"1\",\"skgx_name\":\"鐒婃帴鏁版帶绋嬪簭\",\"sqzt\":\"S鐘舵�乗",\"ae8nc_cxno\":\"CX淇℃伅涓績10000070\",\"ae8nc_gfrev\":\"1\",\"ae8nc_sbno\":\"2240080\",\"ae8nc_jcid\":\"QJK006\",\"ae8nc_os\":\"鍗庝腑鏁版帶-HNC848C\",\"ae8nc_filename\":\"107052PA5\",\"ae8nc_cxfz\":\"璁$畻鏈轰豢鐪焅",\"ae8nc_operator\":\"\",\"ae8nc_inspect\":\"\",\"ae8nc_acceptview\":\"\",\"ae8nc_cxno_unit\":\"淇℃伅涓績\",\"ae8nc_filename_unit\":\"PA\",\"ae8gallery\":\"\",\"ae8nc_plant\":\"淇℃伅涓績\",\"ae8nc_modelno\":\"jx\",\"ae8nc_batchno\":\"\",\"meop_id\":\"OPHJ000000000049108\",\"meop_rev_id\":\"A\",\"meop_name\":\"鐒婃帴\",\"meop_type\":\"AE8Operation Revision\",\"ae8gx_no\":\"5\",\"process_id\":\"JZG2022008107653\",\"process_rev_id\":\"1\",\"process_name\":\"107052\",\"ae8part_no\":\"107052\",\"ae8stageidentifying\":\"L\",\"ae8gy_type\":\"鏈哄姞宸ヨ壓璁捐\",\"ae8plant\":\"淇℃伅涓績\",\"part_id\":\"1047051\",\"part_rev_id\":\"01\",\"part_name\":\"闆嗘垚娴嬭瘯浠禱",\"create_by\":\"鐢ㄦ埛2(user2)\",\"create_date\":\"02-9鏈�-22 17:15:14\",\"filename\":\"DNC-CX淇℃伅涓績10000070-1.zip\",\"filepath\":\"http://localhost:9099/outer/test/download.xhtml\"}]}\n";
+ //String program =pdmWebClientApi.queryNcProgramAttrInfo(objects);
if (StringUtils.isEmpty(program)) {
log.error("======= 鏃� "+ ncLog.getSkgxId() +" 鏂板璁板綍=======");
return false;
@@ -592,6 +595,7 @@
if (suffix.contentEquals("docx") || suffix.contentEquals("pdf") ) {
continue;
}
+ source.setFileName(entry.getKey());
DocInfo docInfo = docInfoService.findByAttrAndDocName(FileUtil.getFilenameNonSuffix(entry.getKey()), 5,
stream.getProcessId(),suffix);
//鏂板
@@ -632,6 +636,7 @@
docInfo.setPublishVersion(docFile.getDocVersion());
docInfo.setPublishFileId(docFile.getFileId());
b = docInfoService.save(docInfo);
+ boolean pdm = assignFileStreamService.saveListNcFromPdm(docInfo,source);
if(!b){
return false;
}
@@ -651,6 +656,8 @@
docInfo.setPublishVersion(docFile.getDocVersion());
docInfo.setPublishFileId(docFile.getFileId());
b = docInfoService.updateById(docInfo);
+ //
+ boolean pdm = assignFileStreamService.saveListNcFromPdm(docInfo,source);
if(!b) {
return false;
}
diff --git a/src/main/java/com/lxzn/plm/service/impl/QueryNcProgramLogServiceImpl.java b/src/main/java/com/lxzn/plm/service/impl/QueryNcProgramLogServiceImpl.java
index aec36fe..5ba8c0c 100644
--- a/src/main/java/com/lxzn/plm/service/impl/QueryNcProgramLogServiceImpl.java
+++ b/src/main/java/com/lxzn/plm/service/impl/QueryNcProgramLogServiceImpl.java
@@ -57,8 +57,8 @@
try {
Map<String,String> map = new HashMap<>();
Object[] objects = new Object[]{returnLog.getStartDateNum(),returnLog.getEndDateNum(),"","","",""};
- //String name = "{\"code\": 1, \"message\": \"\", \"response\": [{ \"log_id\": \"20230213080002\", \"skgx_id\": \"CX408-1545\", \"skgx_rev_id\": \"1\", \"sqzt\": \"S鐘舵�乗" }]}" ;
- String name = pdmWebClientApi.pdmDncProgram(objects);
+ String name = "{\"code\": 1, \"message\": \"\", \"response\": [{ \"log_id\": \"20230213080002\", \"skgx_id\": \"CX408-1545\", \"skgx_rev_id\": \"1\", \"sqzt\": \"S鐘舵�乗" }]}" ;
+ //String name = pdmWebClientApi.pdmDncProgram(objects);
if (StringUtils.isEmpty(name)) {
log.error("鏃犳暟鎹甠__绌烘暟鎹�");
return null;
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index a1f1af8..2fc728d 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -10,10 +10,11 @@
dialect: org.hibernate.dialect.Oracle10gDialect
show-sql: ture
datasource:
- driver-class-name: dm.jdbc.driver.DmDriver
- url: jdbc:dm://LOCALHOST:5236?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8&schema=LXZN_NC_ADMIN_430
- username: SYSDBA
- password: Lyh10225217
+ url: ${MSSQL_URL:jdbc:sqlserver://127.0.0.1:1433;databaseName=lxzn_nc_430}
+ username: sa
+ password:
+ type: com.alibaba.druid.pool.DruidDataSource
+ driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
initialSize: 5 #鍒濆寤虹珛杩炴帴鏁伴噺
minIdle: 5 #鏈�灏忚繛鎺ユ暟閲�
maxActive: 20 #鏈�澶ц繛鎺ユ暟閲�
@@ -83,6 +84,7 @@
#鏂囦欢涓婁紶鐩綍锛堟敞鎰廘inux鍜學indows涓婄殑鐩綍缁撴瀯涓嶅悓锛�
#file.uploadFolder=/root/uploadFiles/
fileHomePath: ${UPLOAD_FOLDER:d://lxzn_storage}
+fileNcGateway: ${UPLOAD_FOLDER:d://abc}
#staticAccessPath: /api/file/** # 褰撳墠椤圭洰鐨勯潤鎬佽祫婧愯闂厤缃湪nginx涓�
activiti:
enable: true # true 鍚敤瀹℃壒 false 涓嶅惎鐢ㄥ鎵�
@@ -99,8 +101,8 @@
uri: http://192.168.2.234:8081/YZHTCNCProgram/PLMServices?wsdl
ncPdm:
file_path:
- d://lxzn_storage/plm
+ dnc//lxzn_storage/plm
product:
- root: 1580366134186582017
+ root: 1583346581232537602
user:
- userIdYml: 1254966905669160962
+ userIdYml: 1583346581232537602
diff --git a/src/main/resources/scheduled.properties b/src/main/resources/scheduled.properties
index c462327..89d5c1b 100644
--- a/src/main/resources/scheduled.properties
+++ b/src/main/resources/scheduled.properties
@@ -1,2 +1,4 @@
-####鍚屾瀹氭椂浠诲姟鎵ц鍣ㄥ弬鏁�
-plmCron=0 */2 * * * ?
\ No newline at end of file
+####??????????? 0*/2***?
+plmCron=0 */2 * * * ?
+####??????????? 20m
+taskSync=0/20 * * * * ?
--
Gitblit v1.9.3