|
@@ -232,12 +232,23 @@ public class AppendixController implements InitializingBean {
|
|
String companyId = request.getParameter("companyId");
|
|
String companyId = request.getParameter("companyId");
|
|
for (MultipartFile file : files) {
|
|
for (MultipartFile file : files) {
|
|
String fileName = file.getOriginalFilename();
|
|
String fileName = file.getOriginalFilename();
|
|
- fileName = fileName.substring(0, fileName.lastIndexOf("."));
|
|
|
|
|
|
+ if (fileName.contains(".")){
|
|
|
|
+ fileName = fileName.substring(0, fileName.lastIndexOf("."));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String path = "";
|
|
try {
|
|
try {
|
|
CommonAppendix appendix = new CommonAppendix();
|
|
CommonAppendix appendix = new CommonAppendix();
|
|
- appendix.setAppendixName(
|
|
|
|
- fileName + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")));
|
|
|
|
- String path = upload(file,file.getOriginalFilename(),companyId);
|
|
|
|
|
|
+ if (file.getOriginalFilename().contains(".")){
|
|
|
|
+ appendix.setAppendixName(
|
|
|
|
+ fileName + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")));
|
|
|
|
+ path = upload(file,file.getOriginalFilename(),companyId);
|
|
|
|
+ }else {
|
|
|
|
+ appendix.setAppendixName(
|
|
|
|
+ fileName + ".png");
|
|
|
|
+ path = upload(file,file.getOriginalFilename() + ".png",companyId);
|
|
|
|
+ }
|
|
|
|
+
|
|
appendix.setAppendixPath(path);
|
|
appendix.setAppendixPath(path);
|
|
int size = (int) file.getSize();
|
|
int size = (int) file.getSize();
|
|
appendix.setAppendixSize(GtAppendixUtil.getFileSize(size));
|
|
appendix.setAppendixSize(GtAppendixUtil.getFileSize(size));
|