From ec1d61de19f0fe6c3efc781e5d7a6af2ed65ae5d Mon Sep 17 00:00:00 2001
From: lyh <925863403@qq.com>
Date: 星期二, 10 六月 2025 10:51:49 +0800
Subject: [PATCH] DNC 文档导入、回传文档、解析文档、取消原有设备

---
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/service/impl/AssignFileStreamServiceImpl.java |   81 ++++------------------------------------
 1 files changed, 9 insertions(+), 72 deletions(-)

diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/service/impl/AssignFileStreamServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/service/impl/AssignFileStreamServiceImpl.java
index a287e73..70ab35e 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/service/impl/AssignFileStreamServiceImpl.java
+++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/service/impl/AssignFileStreamServiceImpl.java
@@ -25,7 +25,6 @@
 import org.jeecg.modules.dnc.utils.date.DateUtil;
 import org.jeecg.modules.dnc.utils.file.FileUtilS;
 import org.jeecg.modules.dncFlow.entity.AssignFileStream;
-import org.jeecg.modules.dncFlow.entity.ToEquipmentTask;
 import org.jeecg.modules.dncFlow.ext.AssignFileStreamExt;
 import org.jeecg.modules.dncFlow.mapper.AssignFileStreamMapper;
 import org.jeecg.modules.dncFlow.request.ApproveBatchRequest;
@@ -33,7 +32,6 @@
 import org.jeecg.modules.dncFlow.request.AssignFileStreamQueryRequest;
 import org.jeecg.modules.dncFlow.request.TaskRequest;
 import org.jeecg.modules.dncFlow.service.IAssignFileStreamService;
-import org.jeecg.modules.dncFlow.service.IToEquipmentTaskService;
 import org.jeecg.modules.dncFlow.vo.AssignFlowTaskVo;
 import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness;
 import org.jeecg.modules.flowable.apithird.business.service.IFlowMyBusinessService;
@@ -73,13 +71,7 @@
     @Autowired
     private IDocInfoService docInfoService;
     @Autowired
-    private IProcessStreamService processStreamService;
-    @Autowired
     private IDocClassificationService classificationService;
-    @Autowired
-    private IToEquipmentTaskService equipmentTaskService;
-    @Autowired
-    private IDeviceInfoService deviceInfoService;
     @Autowired
     private IDocFileService docFileService;
     @Autowired
@@ -107,11 +99,9 @@
     @Autowired
     private IDncPassLogService dncPassLogService;
     @Value("${deploy.deployType}")
-    //宸ユ帶缃�/娑夊瘑缃戦儴缃� 0涓哄伐鎺х綉 1涓烘秹瀵嗙綉
-    private String deployType;
+    private String deployType;    //宸ユ帶缃�/娑夊瘑缃戦儴缃� 0涓哄伐鎺х綉 1涓烘秹瀵嗙綉
     @Value("${deploy.secretFolder}")
-    //娑夊瘑缃戜紶杈搉c鏂囦欢澶�
-    private String secretFolder;
+    private String secretFolder;    //娑夊瘑缃戜紶杈搉c鏂囦欢澶�
 
     @Override
     @Transactional(rollbackFor = {Exception.class})
@@ -138,7 +128,6 @@
      */
     public String getDeviceSpecialChar(String deviceId, String fileId){
         //鏇挎崲涓簃dc璁惧琛�
-//        DeviceInfo deviceInfo = deviceInfoService.getById(deviceId);
         MdcEquipment mdcEquipment = iMdcEquipmentService.getById(deviceId);
         if(mdcEquipment == null)
             ExceptionCast.cast(ActivitiCode.ACT_ASSIGN_DEVICE_NONE);
@@ -232,6 +221,9 @@
         //鏉冮檺鏍¢獙
         validateParams(stream);
         DocInfo docInfo = getDocInfo(stream);
+        //淇敼鍘熸湁鐘舵��
+        docInfo.setDocDispatchStatus(4);
+        docInfoService.updateById(docInfo);
         MdcEquipment mdcEquipment = getMdcEquipment(stream);
         DocFile docFile = getDocFile(stream);
         DocInfo deviceDoc = docInfoService.getByDocAttrAndDocId(stream.getDocId(), 7, stream.getDeviceId());
@@ -344,6 +336,9 @@
             DocFile docFile = docFileService.getById(en.getFileId());
             if(docFile == null)
                 ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR);
+            //淇敼鍘熸湁鐘舵��
+            docInfo.setDocDispatchStatus(4);
+            docInfoService.updateById(docInfo);
             DocInfo deviceDoc = docInfoService.getByDocAttrAndDocId(en.getDocId(),7, en.getDeviceId());
             if(deviceDoc != null) {
                 // 鍒犻櫎 澶囦唤  瑕嗙洊 鍘熸湁鐨�
@@ -487,64 +482,6 @@
         return false;
     }
 
-    @Override
-    @Transactional(rollbackFor = {Exception.class})
-    public boolean transferDocFile(String pnCode, String deviceNo) {
-        List<ProcessStream> streams = processStreamService.validateDeviceProcessInfo(pnCode, deviceNo);
-        DeviceInfo deviceInfo = deviceInfoService.getByDeviceNo(deviceNo);
-        if(deviceInfo == null)
-            ExceptionCast.cast(DeviceCode.DEVICE_NOT_EXIST);
-        //鍒犻櫎鍘熸潵璁惧涓嬬殑鎵�鏈夋枃妗�
-        docRelativeService.deleteByDocAttr(7, deviceInfo.getDeviceId());
-        List<DocInfo> docInfoList = docInfoService.getByProcessIds(streams);
-        if(docInfoList == null || docInfoList.isEmpty())
-            ExceptionCast.cast(DocumentCode.DOC_NOT_EXIST);
-        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-        String userId = user.getId();
-        if(!ValidateUtil.validateString(userId))
-            ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST);
-        for(DocInfo docInfo : docInfoList) {
-            DocFile docFile = docFileService.getById(docInfo.getPublishFileId());
-            if(docFile == null)
-                ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR);
-            //鎻掑叆鏂囨。鍒拌澶囧彂閫佹枃妗�
-            DocClassification classification = classificationService.getByCode(SEND_CODE);
-            if(classification == null)
-                ExceptionCast.cast(DocumentCode.DOC_CLASS_ERROR);
-            DocRelative docRelative = new DocRelative();
-            docRelative.setDocId(docInfo.getDocId());
-            docRelative.setClassificationId(classification.getClassificationId());
-            docRelative.setAttributionType(7);
-            docRelative.setAttributionId(deviceInfo.getDeviceId());
-            boolean b = docRelativeService.save(docRelative);
-            if(!b)
-                ExceptionCast.cast(ActivitiCode.ACT_APPROVE_ERROR);
-            //鎻掑叆鏂囦欢浼犺緭浠诲姟琛�
-            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) {
-                ExceptionCast.cast(ActivitiCode.ACT_APPROVE_ERROR);
-            }
-        }
-        return synchronizedFlagService.updateFlag(1);
-    }
-
     //浼犲弬楠岃瘉
     private void validateParams(AssignFileStream stream) {
         if (stream == null) {
@@ -575,7 +512,7 @@
 
     //鑾峰彇鏂囦欢
     private void handleExistingDeviceDoc(DocFile docFile, MdcEquipment mdcEquipment, String deviceId) {
-        List<String> strings = iMdcProductionService.findListParentTreeAll(mdcEquipment.getEquipmentId());
+        List<String> strings = iMdcProductionService.findListParentTreeAll(mdcEquipment.getId());
         if (strings != null && !strings.isEmpty()) {
             String path = StringUtils.join(strings.toArray(), "/");
             boolean copyFileNc = FileUtilS.copyFileNcToBak(path + "/" + mdcEquipment.getEquipmentId(),

--
Gitblit v1.9.3