lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DocRelativeController.java
@@ -5,7 +5,6 @@ import lombok.extern.slf4j.Slf4j; import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.modules.dnc.entity.DeviceInfo; import org.jeecg.modules.dnc.entity.DocRelative; import org.jeecg.modules.dnc.response.CommonCode; import org.jeecg.modules.dnc.response.QueryListResponseResult; @@ -30,7 +29,7 @@ @ApiOperation(value = "设备关联文档表-删除设备下的文档接口", notes = "设备关联文档表-删除设备下的文档接口") @DeleteMapping("/delete/device/{docId}/{deviceId}") public ResponseResult deleteDocByDeviceId(@PathVariable("docId") String docId, @PathVariable("deviceId") String deviceId) { boolean b = relativeService.deleteDocByAttr(docId, 4, deviceId); boolean b = relativeService.deleteDocByAttr(docId, 7, deviceId); if(b) return new ResponseResult(CommonCode.SUCCESS); return new ResponseResult(CommonCode.FAIL); lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DocInfoMapper.xml
@@ -66,6 +66,7 @@ ,u.doc_status ,u.publish_file_id ,u.publish_version ,u.doc_dispatch_status ,u.description ,u.CREATE_TIME ,u.create_by lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDocInfoService.java
@@ -14,6 +14,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.FileNotFoundException; import java.util.List; public interface IDocInfoService extends IService<DocInfo> { @@ -47,6 +48,22 @@ */ boolean addDocInfoRec(String pathFile,File fileRec); /** * 解析NC文档通用方法 * @param pathFile,fileRec * @return */ boolean addDocInfoAnalysisNcService(String pathFile,File fileRec) throws FileNotFoundException; /** * 文档解析 * @param equipmentId * @param fileRec * @param fileNameSuffix * @param fileNameNew * @param filePath * @return */ boolean addDocInfoRecService(String equipmentId,File fileRec,String fileNameSuffix,String fileNameNew,String filePath ); /** * 入库操作 文档对应文件升版 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/CutterServiceImpl.java
@@ -182,7 +182,18 @@ List<Cutter> cutterList = extractToolAfterM6(docInfo,list); // 保存刀具 if (!cutterList.isEmpty()) { this.saveBatch(cutterList); List<Cutter> newCutterList = new ArrayList<>(); //验证刀具是否已经存在 cutterList.forEach(item -> { List<Cutter> otherCuttersWithSameNo = checkCutterNo(item); if (otherCuttersWithSameNo == null || otherCuttersWithSameNo.isEmpty()) { newCutterList.add(item); } }); if (newCutterList.isEmpty()) { return Result.error("未发现刀具的参数信息注释,无法提取刀具信息"); } this.saveBatch(newCutterList); //TODO发送刀具管理数据 return Result.OK("提取刀具信息成功"); }else { lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceGroupServiceImpl.java
@@ -1,27 +1,21 @@ package org.jeecg.modules.dnc.service.impl; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.apache.shiro.SecurityUtils; import org.jeecg.common.system.vo.LoginUser; import org.apache.commons.lang3.StringUtils; import org.jeecg.modules.dnc.dto.DeviceGroupExt; import org.jeecg.modules.dnc.entity.DeviceGroup; import org.jeecg.modules.dnc.entity.DeviceGroupPermission; import org.jeecg.modules.dnc.entity.DevicePermissionStream; import org.jeecg.modules.dnc.exception.ExceptionCast; import org.jeecg.modules.dnc.mapper.DeviceGroupMapper; import org.jeecg.modules.dnc.response.CommonCode; import org.jeecg.modules.dnc.response.DeviceGroupCode; import org.jeecg.modules.dnc.response.UcenterCode; import org.jeecg.modules.dnc.service.*; import org.jeecg.modules.dnc.ucenter.Department; import org.jeecg.modules.dnc.service.IDeviceGroupPermissionService; import org.jeecg.modules.dnc.service.IDeviceGroupService; import org.jeecg.modules.dnc.service.IDevicePermissionStreamService; import org.jeecg.modules.dnc.utils.ValidateUtil; import org.jeecg.modules.dnc.entity.*; import org.jeecg.modules.system.entity.SysUser; import org.jeecg.modules.dnc.utils.file.FileUtilS; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -36,9 +30,6 @@ private IDeviceGroupPermissionService groupPermissionService; @Autowired private IDevicePermissionStreamService devicePermissionStreamService; @Autowired @Lazy private IDeviceInfoService deviceInfoService; // 查询所以父节点 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocInfoServiceImpl.java
@@ -16,6 +16,8 @@ import org.jeecg.common.system.vo.LoginUser; import org.jeecg.modules.dnc.entity.*; import org.jeecg.modules.dnc.exception.ExceptionCast; import org.jeecg.modules.dnc.ext.NcTxtFilePathInfo; import org.jeecg.modules.dnc.listener.FileMonitorConfig; import org.jeecg.modules.dnc.mapper.DocInfoMapper; import org.jeecg.modules.dnc.request.DocInfoQueryRequest; import org.jeecg.modules.dnc.request.DocInfoUploadRequest; @@ -27,7 +29,9 @@ import org.jeecg.modules.dncFlow.entity.DispatchFile; import org.jeecg.modules.dncFlow.service.IDispatchFileService; import org.jeecg.modules.mdc.entity.MdcEquipment; import org.jeecg.modules.mdc.service.IMdcEquipmentService; import org.jeecg.modules.system.entity.SysParams; import org.jeecg.modules.system.service.IMdcProductionService; import org.jeecg.modules.system.service.ISysParamsService; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -39,13 +43,22 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Scanner; import java.util.stream.Collectors; @Service public class DocInfoServiceImpl extends ServiceImpl<DocInfoMapper, DocInfo> implements IDocInfoService { @Autowired private FileMonitorConfig config; @Autowired private IMdcEquipmentService iMdcEquipmentService; @Autowired private IMdcProductionService iMdcProductionService; @Autowired private IDocClassificationService docClassificationService; @Autowired @@ -55,11 +68,6 @@ @Autowired @Lazy private IDocRelativeService docRelativeService; @Autowired @Lazy private IDeviceInfoService deviceInfoService; @Autowired private IDeviceGroupService deviceGroupService; @Autowired private IDispatchFileService dispatchFileService; @Autowired @@ -134,28 +142,28 @@ docInfo.setPublishVersion(docFile.getDocVersion()); docInfo.setPublishFileId(docFile.getFileId()); //COPY DeviceInfo deviceInfo= deviceInfoService.getById(uploadRequest.getAttributionId()); if (deviceInfo != null) { List<String> strings = deviceGroupService.findListParentTreeAll(deviceInfo.getGroupId()); MdcEquipment mdcEquipment= iMdcEquipmentService.getById(uploadRequest.getAttributionId()); if (mdcEquipment != null) { List<String> strings = iMdcProductionService.findListParentTreeAll(mdcEquipment.getId()); boolean copyFileNc = false; if (strings != null && !strings.isEmpty()) { String path = org.apache.commons.lang3.StringUtils.join(strings.toArray(), "/"); copyFileNc = FileUtilS.copyFile(fileUploadResult.getFilePath()+"/" + fileUploadResult.getFileEncodeName(), path+ "/" + deviceInfo.getDeviceNo() ,fileNameAll); path+ "/" + mdcEquipment.getEquipmentId() ,fileNameAll); if (!copyFileNc) { ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); } else { FileUtilS.deleteZipFromToSend(path + "/"+ deviceInfo.getDeviceNo(), FileUtilS.deleteZipFromToSend(path + "/"+ mdcEquipment.getEquipmentId(), docFile.getFileName(),docFile.getFileSuffix()); } } else { copyFileNc =FileUtilS.copyFile(fileUploadResult.getFilePath()+"/" + fileUploadResult.getFileEncodeName(), deviceInfo.getDeviceNo() ,fileNameAll); mdcEquipment.getEquipmentId() ,fileNameAll); if (!copyFileNc) { ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); } else { FileUtilS.deleteZipFromToSend(fileUploadResult.getFilePath()+"/" + fileUploadResult.getFileEncodeName() + "/"+ deviceInfo.getDeviceNo(), FileUtilS.deleteZipFromToSend(fileUploadResult.getFilePath()+"/" + fileUploadResult.getFileEncodeName() + "/"+ mdcEquipment.getEquipmentId(), docFile.getFileName(),docFile.getFileSuffix()); } @@ -212,8 +220,8 @@ if (StringUtils.isEmpty(deviceNo)) { return false; } DeviceInfo deviceInfo = deviceInfoService.getByDeviceNo(deviceNo); if (deviceInfo == null) { MdcEquipment mdcEquipment = iMdcEquipmentService.findEquipmentNameByEquipmentId(deviceNo); if (mdcEquipment == null) { return false; } String fileName = FileUtilS.getFilenameNonSuffix(file.getOriginalFilename()); @@ -222,7 +230,7 @@ if(fileUploadResult == null) { return false; } DocInfo en = findByAttrAndDocName(fileName, 4, deviceInfo.getDeviceId()); DocInfo en = findByAttrAndDocName(fileName, 7, mdcEquipment.getId()); if(en != null) { return false; } @@ -235,9 +243,9 @@ docInfo.setDocStatus(1); docInfo.setSyncStatus(2); DocRelative docRelative = new DocRelative(); docRelative.setAttributionId(deviceInfo.getDeviceId()); docRelative.setAttributionId(mdcEquipment.getId()); docRelative.setDocId(docInfo.getDocId()); docRelative.setAttributionType(4); docRelative.setAttributionType(7); docRelative.setClassificationId(docClass.getClassificationId()); boolean b = docRelativeService.save(docRelative); if(!b) { @@ -260,6 +268,72 @@ return saveBool; } /** * 解析NC文档通用方法 * @param pathFile,fileRec * @return */ @Override @Transactional(rollbackFor = {Exception.class}) public boolean addDocInfoAnalysisNcService(String pathFile,File file) throws FileNotFoundException { String line; int count = 0; String loFilePath = config.getPaths().get(0)+"/" + file.getName(); FileInputStream fis = new FileInputStream(loFilePath); NcTxtFilePathInfo result = new NcTxtFilePathInfo(); Scanner sc = new Scanner(fis, "UTF-8"); while (count < 8 && sc.hasNext()) { line = sc.nextLine(); if (count ==0) { result.setFileTxtName(line.trim()); } else if (count ==1) { result.setFileNcName(line.trim()); }else if (count ==2) { result.setOrigFileName(line.trim()); }else if (count ==3) { result.setOrigFileSuffix(line.trim()); }else if (count ==4) { result.setFilePath(line.trim()); }else if (count ==5) { result.setEquipmentId(line.trim()); }else if (count ==6) { result.setFileAddOrDelete(Integer.valueOf(line.trim())); }else if (count == 7) { result.setFileSize(line.trim()); } count++; } sc.close(); if (result.getFileAddOrDelete() != null ) { if ( result.getFileAddOrDelete()==1) { String path = config.getPaths().get(0) +"/" + result.getFileNcName()+ ".NC"; if (org.apache.commons.lang3.StringUtils.isNotBlank(result.getFileNcName()) && result.getFileNcName().equals("null")) { //文件待处理 //备份数据 FileUtilS.deleteFileNewRec(loFilePath); } File ncFile = new File(path); //已经存在文件需要备份 String size = String.valueOf(ncFile.length()); if (!size.equals(result.getFileSize())) { return false; } boolean bool = this.addDocInfoRecService(result.getEquipmentId(), ncFile,result.getOrigFileSuffix(), FileUtilS.getFilenameNonSuffix(result.getOrigFileName()) ,result.getFilePath()); if (bool) { FileUtilS.deleteFileNewRec(path); FileUtilS.deleteFileNewRec(loFilePath); }else { return false; } } } return true; } @Override @Transactional(rollbackFor = {Exception.class}) public boolean addDocInfoRecService(String equipmentId,File fileRec,String fileNameSuffix,String fileNameNew,String filePath ) { @@ -272,12 +346,11 @@ ExceptionCast.cast(DocumentCode.DOC_CLASS_ERROR); } //根据设备编号查询数据 String deviceNo = equipmentId; if (StringUtils.isEmpty(deviceNo)) { if (StringUtils.isEmpty(equipmentId)) { return false; } DeviceInfo deviceInfo = deviceInfoService.getByDeviceNo(deviceNo); if (deviceInfo == null) { MdcEquipment mdcEquipment = iMdcEquipmentService.findEquipmentNameByEquipmentId(equipmentId); if (mdcEquipment == null) { return false; } String fileName = FileUtilS.getFilenameNonSuffix(file.getOriginalFilename()); @@ -286,7 +359,7 @@ if(fileUploadResult == null) { return false; } DocInfo en = findByAttrAndDocName(fileName, 4, deviceInfo.getDeviceId()); DocInfo en = findByAttrAndDocName(fileName, 7, mdcEquipment.getId()); if(en != null) { return false; } @@ -299,9 +372,9 @@ docInfo.setDocStatus(1); docInfo.setSyncStatus(2); DocRelative docRelative = new DocRelative(); docRelative.setAttributionId(deviceInfo.getDeviceId()); docRelative.setAttributionId(mdcEquipment.getId()); docRelative.setDocId(docInfo.getDocId()); docRelative.setAttributionType(4); docRelative.setAttributionType(7); docRelative.setClassificationId(docClass.getClassificationId()); boolean b = docRelativeService.save(docRelative); if(!b) { @@ -678,7 +751,7 @@ public boolean deleteByDeviceId(String deviceId) { if(!ValidateUtil.validateString(deviceId)) ExceptionCast.cast(CommonCode.INVALID_PARAM); Integer attrType = 4; Integer attrType = 7; /*boolean b = docFileService.deleteByDocAttr(attrType, deviceId); if(!b) ExceptionCast.cast(CommonCode.FAIL); lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocRelativeServiceImpl.java
@@ -11,8 +11,6 @@ import org.jeecg.modules.dnc.mapper.DocInfoMapper; import org.jeecg.modules.dnc.mapper.DocRelativeMapper; import org.jeecg.modules.dnc.response.CommonCode; import org.jeecg.modules.dnc.service.IDeviceGroupService; import org.jeecg.modules.dnc.service.IDeviceInfoService; import org.jeecg.modules.dnc.service.IDocRelativeService; import org.jeecg.modules.dnc.utils.ValidateUtil; import org.jeecg.modules.dnc.utils.date.DateUtil; @@ -31,12 +29,6 @@ @Autowired private DocInfoMapper docInfoMapper; @Autowired private IDeviceInfoService deviceInfoService; @Autowired private IDeviceGroupService deviceGroupService; // @Value("${securedoc.localFilePath}") // private String localFilePath; @Autowired private IMdcEquipmentService iMdcEquipmentService; @Autowired lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/GuideCardBatchServiceImpl.java
@@ -83,7 +83,7 @@ } // 拼接完整编号 return yearSuffix + code + user.getUsername() + serialSuffix; return yearSuffix+"-"+ code+"-"+ user.getUsername()+"-"+ serialSuffix; } /** lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessStreamServiceImpl.java
@@ -19,6 +19,8 @@ import org.jeecg.modules.dnc.response.*; import org.jeecg.modules.dnc.service.*; import org.jeecg.modules.dnc.utils.ValidateUtil; import org.jeecg.modules.mdc.entity.MdcEquipment; import org.jeecg.modules.mdc.service.IMdcEquipmentService; import org.jeecg.modules.system.entity.MdcProduction; import org.jeecg.modules.system.entity.SysUser; import org.springframework.beans.factory.annotation.Autowired; @@ -39,8 +41,7 @@ @Autowired private IProcessSpecVersionService processSpecVersionService; @Autowired @Lazy private IDeviceInfoService deviceInfoService; private IMdcEquipmentService mdcEquipmentService; @Autowired private IPermissionStreamNewService permissionStreamNewService; @Autowired @@ -259,8 +260,8 @@ public List<ProcessStream> validateDeviceProcessInfo(String pnCode, String deviceNo) { if(!ValidateUtil.validateString(pnCode) || !ValidateUtil.validateString(deviceNo)) ExceptionCast.cast(CommonCode.INVALID_PARAM); DeviceInfo deviceInfo = deviceInfoService.getByDeviceNo(deviceNo); if(deviceInfo == null) MdcEquipment mdcEquipment = mdcEquipmentService.findEquipmentNameByEquipmentId(deviceNo); if(mdcEquipment == null) ExceptionCast.cast(DeviceCode.DEVICE_NOT_EXIST); PermissionStream stream = componentInfoService.validateComponentOrPartsPnCode(pnCode); if(stream == null) lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/controller/AssignFileStreamController.java
@@ -88,16 +88,6 @@ return new DataResponseResult<>(CommonCode.SUCCESS, b); } @AutoLog(value = "DNC指派设备流程操作-扫码传输程序 不经过审批 文件存在采用覆盖") @ApiOperation(value = "DNC指派设备流程操作-扫码传输程序 不经过审批 文件存在采用覆盖", notes = "DNC指派设备流程操作-扫码传输程序 不经过审批 文件存在采用覆盖") @PostMapping("/transfer/doc") public ResponseResult transferDocFile(String pnCode, String deviceNo) { boolean b = assignFileStreamService.transferDocFile(pnCode, deviceNo); if(b) return new ResponseResult(CommonCode.SUCCESS); return new ResponseResult(CommonCode.FAIL); } @GetMapping(value = "/selectVoById") public Result<AssignFileStream> selectVoById(@RequestParam(name="id") String id){ return Result.OK(assignFileStreamService.getAssignFileStreamDetail(id)); lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/service/IAssignFileStreamService.java
@@ -84,12 +84,4 @@ * @return */ Boolean getFlowableEnable(); /** * 扫码传输程序 不经过审批 文件存在采用覆盖 * @param pnCode * @param deviceNo * @return */ boolean transferDocFile(String pnCode, String deviceNo); } 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}") //涉密网传输nc文件夹 private String secretFolder; private String secretFolder; //涉密网传输nc文件夹 @Override @Transactional(rollbackFor = {Exception.class}) @@ -138,7 +128,6 @@ */ public String getDeviceSpecialChar(String deviceId, String fileId){ //替换为mdc设备表 // 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(); //不能直接从doc中拿fileId 和version 可能会存在斌更 //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(),