| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | @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 |
| | |
| | | @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}) |
| | |
| | | */ |
| | | 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); |
| | |
| | | //权限校验 |
| | | 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()); |
| | |
| | | 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) { |
| | | // 删除 备份 覆盖 原有的 |
| | |
| | | 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) { |
| | |
| | | |
| | | //获取文件 |
| | | 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(), |