Commit 6043849c by wang_jiaxing

版本更新文件上传修改

parent eb16b7fe
...@@ -92,29 +92,31 @@ public class AppBbgxServiceImpl extends ServiceImpl<AppBbgxMapper, AppBbgx> impl ...@@ -92,29 +92,31 @@ public class AppBbgxServiceImpl extends ServiceImpl<AppBbgxMapper, AppBbgx> impl
} }
} }
File oldFile = new File(bbgxfjPath + File.separator + fileName); File oldFile = new File(bbgxfjPath + File.separator + fileName);
if (oldFile.exists()) { // String suffix = "." + FilenameUtils.getExtension(fileName);
// String suffix = "." + FilenameUtils.getExtension(fileName); String dzwjmc = DateUtil.getSysDateStr() + "_" + fileName;
String dzwjmc = DateUtil.getSysDateStr() + "_" + fileName; String dzwjwz = bbgxfjPath + File.separator + dzwjmc;
String dzwjwz = bbgxfjPath + File.separator + dzwjmc; File newFile = new File(bbgxfjPath + File.separator + dzwjmc);
File newFile = new File(bbgxfjPath + File.separator + dzwjmc); if (!newFile.exists()) {
if (!newFile.exists()) { int insert;
boolean b = oldFile.renameTo(newFile); try {
insert = appBbgxMapper.insert(bbgx);
boolean b = true;
if (oldFile.exists()) {
b = oldFile.renameTo(newFile);
}
if (b) { if (b) {
file.transferTo(new File(bbgxfjPath + File.separator, fileName)); file.transferTo(new File(bbgxfjPath + File.separator, fileName));
bbgx.setAppGxwjwz(dzwjwz); bbgx.setAppGxwjwz(dzwjwz);
bbgx.setFilename(dzwjmc); bbgx.setFilename(dzwjmc);
int insert;
try {
insert = appBbgxMapper.insert(bbgx);
} catch (Exception e) {
e.printStackTrace();
insert = 0;
}
if (insert == 0) {
return null;
}
} }
} catch (Exception e) {
e.printStackTrace();
insert = 0;
}
if (insert == 0) {
return null;
} }
} }
return version; return version;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment