fix: 修正问题

dev
huangfeng 1 year ago
parent 85dc63d918
commit b245a7e71b

@ -45,9 +45,9 @@ public class MntnUploadController extends BaseController {
@PostMapping("uploadLog") @PostMapping("uploadLog")
@ApiOperation("上传日志") @ApiOperation("上传日志")
public ResponseReult uploadLog(@RequestParam("file") MultipartFile file, public ResponseReult uploadLog(@RequestParam("file") MultipartFile file,
@RequestParam(value = "termId", required = true) Integer termId) throws Exception { @RequestParam(value = "termId", required = false) Integer termId) throws Exception {
if (file == null) { if (termId == null) {
throw new ApiException("缺少上传的文件"); termId = 0;
} }
service.uploadLog(termId, file); service.uploadLog(termId, file);
ResponseReult result = new ResponseReult(); ResponseReult result = new ResponseReult();

@ -19,7 +19,7 @@ public class MultipartConfig {
String os = System.getProperty("os.name"); String os = System.getProperty("os.name");
// 兼容windows // 兼容windows
if (os.toLowerCase().startsWith("win")) { if (os.toLowerCase().startsWith("win")) {
fileTempDir = "D:" + fileTempDir; fileTempDir = fileTempDir;
} }
log.info("fileTempDir:{}", fileTempDir); log.info("fileTempDir:{}", fileTempDir);
MultipartConfigFactory factory = new MultipartConfigFactory(); MultipartConfigFactory factory = new MultipartConfigFactory();

@ -59,7 +59,9 @@ public class MntnUploadServiceImpl implements MntnUploadService {
@Override @Override
public void delete(Integer id) throws Exception { public void delete(Integer id) throws Exception {
MntnUploads record = mapper.selectByPrimaryKey(id);
mapper.deleteByPrimaryKey(id); mapper.deleteByPrimaryKey(id);
new File(termlog + record.getPath()).delete();
} }
@Override @Override

Loading…
Cancel
Save