Commit 6043849c by wang_jiaxing

版本更新文件上传修改

parent eb16b7fe
...@@ -92,20 +92,23 @@ public class AppBbgxServiceImpl extends ServiceImpl<AppBbgxMapper, AppBbgx> impl ...@@ -92,20 +92,23 @@ 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()) {
boolean b = oldFile.renameTo(newFile); int insert;
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) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
insert = 0; insert = 0;
...@@ -113,8 +116,7 @@ public class AppBbgxServiceImpl extends ServiceImpl<AppBbgxMapper, AppBbgx> impl ...@@ -113,8 +116,7 @@ public class AppBbgxServiceImpl extends ServiceImpl<AppBbgxMapper, AppBbgx> impl
if (insert == 0) { if (insert == 0) {
return null; 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