| | |
| | | import com.alibaba.excel.util.StringUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.codec.digest.DigestUtils; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | 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.springframework.scheduling.annotation.EnableScheduling; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.nio.file.Files; |
| | |
| | | // 每5秒执行一次 |
| | | //@Scheduled(fixedRate = 1000000) |
| | | //@Scheduled(cron = "0 1 0 * * ?") // 每天上午0点1分执行 |
| | | @Scheduled(cron = "0 */5 * * * ?") |
| | | //@Scheduled(cron = "0 */5 * * * ?") |
| | | //@Scheduled(cron = "0 15 19 * * ?") //test |
| | | public void executeEvery5Seconds() { |
| | | @Scheduled(cron = "${task.cron.machine_file_scan:0 1 * * * ?}") |
| | | public void execute() { |
| | | String networkType = paramService.getParamValue(ParamService.NETWORK_TYPE,ParamService.NETWORK_TYPE_SHEMI); |
| | | |
| | | if(!ParamService.NETWORK_TYPE_SHEMI.equals(networkType)){ |
| | |
| | | if(existFileInDb == null) { |
| | | machineFileService.save(mf); |
| | | }else{ |
| | | log.info("文件已如果掠过:{}",filePath.getFileName()); |
| | | log.info("文件已存在掠过:{}",filePath.getFileName()); |
| | | //已存在咋整。 |
| | | existFileInDb.setFileSize(mf.getFileSize()); |
| | | |