| | |
| | | import org.springblade.core.log.exception.ServiceException; |
| | | import org.springblade.mdm.basesetting.machine.entity.Machine; |
| | | import org.springblade.mdm.basesetting.machine.service.MachineService; |
| | | import org.springblade.mdm.commons.contants.RegExpConstants; |
| | | import org.springblade.mdm.commons.service.ParamService; |
| | | import org.springblade.mdm.gkw.programnode.vo.ProgramNameVO; |
| | | import org.springblade.mdm.machinefile.entity.FileSendRecord; |
| | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | import java.util.regex.Matcher; |
| | | |
| | | @Slf4j |
| | | @Component |
| | |
| | | //非文本 |
| | | machineFile.setExceptionType(MachineFile.EXCEPTION_NOT_TEXT); |
| | | }else{ |
| | | ProgramNameVO progNameVO = ProgramFileNameParser.parseProgramName(machineFile.getName()); |
| | | if(!progNameVO.isValidFilename()){ |
| | | Matcher matcher = RegExpConstants.PROGRAM_FILE_PATTERN.matcher(machineFile.getName()); |
| | | |
| | | boolean filenameValid = matcher.find(); |
| | | if(!filenameValid){ |
| | | machineFile.setExceptionType(MachineFile.EXCEPTION_BAD_FILENAME); |
| | | }else { |
| | | ProgramNameVO progNameVO = ProgramFileNameParser.parseProgramName(machineFile.getName()); |
| | | String prefix = progNameVO.logicProgramName()+"-"; |
| | | long matchCount = allFilesInDir.stream().filter(file -> file.getName().startsWith(prefix)).count(); |
| | | if(matchCount != progNameVO.getSegmentCount()){//文件段数缺失 |