| | |
| | | import org.springblade.core.tool.utils.FileUtil; |
| | | import org.springblade.mdm.basesetting.machine.MachineService; |
| | | import org.springblade.mdm.basesetting.machine.entity.Machine; |
| | | import org.springblade.mdm.commons.service.ParamService; |
| | | import org.springblade.mdm.gkw.programnode.entity.MachineFile; |
| | | import org.springblade.mdm.gkw.programnode.service.MachineFileService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | private MachineFileService machineFileService; |
| | | @Autowired |
| | | private MachineService machineService; |
| | | @Autowired |
| | | private ParamService paramService; |
| | | // 每5秒执行一次 |
| | | //@Scheduled(fixedRate = 1000000) |
| | | //@Scheduled(cron = "0 1 0 * * ?") // 每天上午0点1分执行 |
| | | @Scheduled(cron = "0 */5 * * * ?") |
| | | //@Scheduled(cron = "0 15 19 * * ?") //test |
| | | public void executeEvery5Seconds() { |
| | | scanMachineFile(); |
| | | String networkType = paramService.getParamValue(ParamService.NETWORK_TYPE,ParamService.NETWORK_TYPE_SHEMI); |
| | | |
| | | if(!ParamService.NETWORK_TYPE_SHEMI.equals(networkType)){ |
| | | //非涉密网,才扫描目录文件 |
| | | scanMachineFile(); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | if(existFileInDb == null) { |
| | | machineFileService.save(mf); |
| | | }else{ |
| | | log.info("文件已如果掠过:{}",filePath.getFileName()); |
| | | log.info("文件已存在掠过:{}",filePath.getFileName()); |
| | | //已存在咋整。 |
| | | existFileInDb.setFileSize(mf.getFileSize()); |
| | | |