|
|
@@ -9,13 +9,17 @@ import com.uas.platform.b2b.support.HttpUtils;
|
|
|
import com.uas.platform.b2b.support.SystemSession;
|
|
|
import com.uas.platform.b2b.temporary.model.FileUrl;
|
|
|
import com.uas.platform.core.util.FileUtils;
|
|
|
+import org.apache.log4j.Logger;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
-import java.io.File;
|
|
|
-import java.io.IOException;
|
|
|
-import java.util.*;
|
|
|
+import java.io.*;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* 文件服务
|
|
|
@@ -33,6 +37,11 @@ public class AttachServiceImpl implements AttachService {
|
|
|
*/
|
|
|
private final Integer MAX_FILE_SIZE = 100 * 1024 * 1024;
|
|
|
|
|
|
+ /**
|
|
|
+ * 记录日志
|
|
|
+ */
|
|
|
+ private static final Logger LOGGER = org.apache.log4j.Logger.getLogger(AttachServiceImpl.class);
|
|
|
+
|
|
|
@Override
|
|
|
public Attach getAttach(Long id) {
|
|
|
return attachDao.findOne(id);
|
|
|
@@ -62,8 +71,10 @@ public class AttachServiceImpl implements AttachService {
|
|
|
String path = null;
|
|
|
try {
|
|
|
path = HttpUtils.upload(FileUrl.FILE_UPLOAD, uploadItem.getFile(), null);
|
|
|
+ LOGGER.info("上传附件:" + FileUrl.FILE_UPLOAD + "成功");
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
+ LOGGER.error("上传附件:" + FileUrl.FILE_UPLOAD + "失败, " + e.getMessage());
|
|
|
}
|
|
|
Attach attach = new Attach(filename, path, description, size, new Date());
|
|
|
return attach;
|