| | |
| | | import org.activiti.engine.task.Task; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.activiti.entity.AssignFileStream; |
| | | import org.jeecg.modules.activiti.entity.ToEquipmentTask; |
| | |
| | | import org.jeecg.modules.dnc.utils.ValidateUtil; |
| | | import org.jeecg.modules.dnc.utils.date.DateUtil; |
| | | import org.jeecg.modules.dnc.utils.file.FileUtilS; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipment; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentService; |
| | | import org.jeecg.modules.system.service.IMdcProductionService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.data.redis.core.StringRedisTemplate; |
| | |
| | | private IDncPassLogService dncPassLogService; |
| | | @Autowired |
| | | private IDeviceCharactersService iDeviceCharactersService; |
| | | |
| | | @Autowired |
| | | private IMdcEquipmentService iMdcEquipmentService; |
| | | @Autowired |
| | | private IMdcProductionService iMdcProductionService; |
| | | @Autowired |
| | | private StringRedisTemplate redisTemplate; |
| | | |
| | |
| | | * 设备ID,文件ID |
| | | */ |
| | | public String getDeviceSpecialChar(String deviceId, String fileId){ |
| | | DeviceInfo deviceInfo = deviceInfoService.getById(deviceId); |
| | | if(deviceInfo == null) |
| | | //替换为mdc设备表 |
| | | // DeviceInfo deviceInfo = deviceInfoService.getById(deviceId); |
| | | MdcEquipment mdcEquipment = iMdcEquipmentService.getById(deviceId); |
| | | if(mdcEquipment == null) |
| | | ExceptionCast.cast(ActivitiCode.ACT_ASSIGN_DEVICE_NONE); |
| | | // DocFile docFile = docFileService.getById(fileId); |
| | | DocInfo docInfo = docInfoService.getOne(new QueryWrapper<DocInfo>().eq("publish_file_id",fileId)); |
| | | if(docInfo == null) |
| | | ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); |
| | | List<DeviceCharacters> deviceCharactersList=iDeviceCharactersService.list( |
| | | new LambdaQueryWrapper<DeviceCharacters>().eq(DeviceCharacters::getDeviceNo,deviceInfo.getDeviceNo())); |
| | | new LambdaQueryWrapper<DeviceCharacters>().eq(DeviceCharacters::getDeviceNo,mdcEquipment.getEquipmentId())); |
| | | if (deviceCharactersList.isEmpty()){ |
| | | return ""; |
| | | }else { |
| | |
| | | ExceptionCast.cast(CommonCode.INVALID_PARAM); |
| | | if(!ValidateUtil.validateString(stream.getDeviceId())) |
| | | ExceptionCast.cast(ActivitiCode.ACT_ASSIGN_DEVICE_NONE); |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | String userId = user.getId(); |
| | | if(!ValidateUtil.validateString(userId)) |
| | | ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); |
| | |
| | | if(docInfo == null || docInfo.getDocStatus() == 3) |
| | | ExceptionCast.cast(ActivitiCode.ACT_DOC_ERROR); |
| | | |
| | | DeviceInfo deviceInfo = deviceInfoService.getById(stream.getDeviceId()); |
| | | if(deviceInfo == null) |
| | | MdcEquipment mdcEquipment = iMdcEquipmentService.getById(stream.getDeviceId()); |
| | | // DeviceInfo deviceInfo = deviceInfoService.getById(stream.getDeviceId()); |
| | | if(mdcEquipment == null) |
| | | ExceptionCast.cast(ActivitiCode.ACT_ASSIGN_DEVICE_NONE); |
| | | DocFile docFile = docFileService.getById(stream.getFileId()); |
| | | if(docFile == null) |
| | |
| | | DocInfo deviceDoc = docInfoService.getByDocAttrAndDocId(stream.getDocId(), 4, stream.getDeviceId()); |
| | | if(deviceDoc != null) { |
| | | // 删除 备份 覆盖 原有的 |
| | | List<String> strings = deviceGroupService.findListParentTreeAll(deviceInfo.getGroupId()); |
| | | List<String> strings=iMdcProductionService.findListParentTreeAll(mdcEquipment.getId()); |
| | | if (strings != null && !strings.isEmpty()) { |
| | | String path = StringUtils.join(strings.toArray(), "/"); |
| | | boolean copyFileNc = FileUtilS.copyFileNcToBak(path + "/"+ deviceInfo.getDeviceNo(), |
| | | boolean copyFileNc = FileUtilS.copyFileNcToBak(path + "/"+ mdcEquipment.getEquipmentId(), |
| | | docFile.getFileName(), docFile.getFileSuffix()); |
| | | } |
| | | } |
| | |
| | | |
| | | //TODO |
| | | //插入文件传输任务表 |
| | | List<String> strings = deviceGroupService.findListParentTreeAll(deviceInfo.getGroupId()); |
| | | List<String> strings=iMdcProductionService.findListParentTreeAll(mdcEquipment.getId()); |
| | | if (strings != null && !strings.isEmpty()) { |
| | | String path = StringUtils.join(strings.toArray(), "/"); |
| | | boolean copyFileNc = FileUtilS.copyFileNc(docFile.getFilePath(),path + "/"+ deviceInfo.getDeviceNo(), |
| | | boolean copyFileNc = FileUtilS.copyFileNc(docFile.getFilePath(),path + "/"+ mdcEquipment.getEquipmentId(), |
| | | docFile.getFileEncodeName(), |
| | | docFile.getFileName(),docFile.getFileSuffix()); |
| | | if (!copyFileNc) { |
| | | ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); |
| | | } else { |
| | | FileUtilS.deleteZipFromToSend(path + "/"+ deviceInfo.getDeviceNo(), |
| | | FileUtilS.deleteZipFromToSend(path + "/"+ mdcEquipment.getEquipmentId(), |
| | | docFile.getFileName(),docFile.getFileSuffix()); |
| | | |
| | | } |
| | |
| | | dncPassLogService.save(passInfoNc); |
| | | |
| | | NcTxtFilePathInfo ncTxt = new NcTxtFilePathInfo(); |
| | | ncTxt.setEquipmentId(deviceInfo.getDeviceNo()); |
| | | ncTxt.setEquipmentId(mdcEquipment.getEquipmentId()); |
| | | ncTxt.setFileNcName("02A"+DateUtil.format(dateFirst,DateUtil.STR_YEARMONTHDAY)+sequenceNc); |
| | | ncTxt.setFileTxtName("02A"+DateUtil.format(dateFirst,DateUtil.STR_YEARMONTHDAY)+sequence); |
| | | ncTxt.setFilePath(path + "/"+ deviceInfo.getDeviceNo() + "/" ); |
| | | ncTxt.setFilePath(path + "/"+ mdcEquipment.getEquipmentId() + "/" ); |
| | | ncTxt.setOrigFileName(docFile.getFileName()); |
| | | ncTxt.setOrigFileSuffix(docFile.getFileSuffix()); |
| | | ncTxt.setFileAddOrDelete(1); |
| | |
| | | localFilePath + "\\" + ncTxt.getFileNcName(), |
| | | docFile.getFileSuffix()); |
| | | */ |
| | | boolean copyFileNc = FileUtilS.copyFileUpName(path + "/"+ deviceInfo.getDeviceNo() +"/send/" + |
| | | boolean copyFileNc = FileUtilS.copyFileUpName(path + "/"+ mdcEquipment.getEquipmentId() +"/send/" + |
| | | docFile.getFileName(), |
| | | localFilePath + ncTxt.getFileNcName(), |
| | | // localFilePath + "\\" + ncTxt.getFileNcName(), |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<ActTaskExt> getUndoTaskList() { |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | public IPage<ActTaskExt> getUndoTaskList(Integer pageNo,Integer pageSize) { |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | String userId = user.getId(); |
| | | if(!ValidateUtil.validateString(userId)) |
| | | return null; |
| | |
| | | ext.setAssignFileStream(streamDetail); |
| | | extList.add(ext); |
| | | }); |
| | | return extList; |
| | | //封装Page |
| | | IPage<ActTaskExt> page = new Page<>(pageNo,pageSize); |
| | | page.setRecords(extList); |
| | | return page; |
| | | } |
| | | |
| | | @Override |
| | |
| | | public boolean approveAssignFile(String taskId, String streamId, AssignFileStream stream) { |
| | | if(!ValidateUtil.validateString(taskId) || !ValidateUtil.validateString(streamId) || stream == null) |
| | | ExceptionCast.cast(CommonCode.INVALID_PARAM); |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | String userId = user.getId(); |
| | | if(!ValidateUtil.validateString(userId)) |
| | | ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public QueryPageResponseResult<AssignFileStreamExt> findPageList(int page, int size, AssignFileStreamQueryRequest request) { |
| | | public Result<?> findPageList(int page, int size, AssignFileStreamQueryRequest request) { |
| | | if(page < 1 || size < 1) { |
| | | ExceptionCast.cast(CommonCode.INVALID_PAGE); |
| | | } |
| | |
| | | } |
| | | } |
| | | IPage<AssignFileStreamExt> streamExtIPage = super.getBaseMapper().findByPage(pageData, lambdaQueryWrapper); |
| | | return new QueryPageResponseResult<>(CommonCode.SUCCESS, streamExtIPage); |
| | | return Result.ok(streamExtIPage); |
| | | } |
| | | |
| | | @Override |