|
|
@@ -85,15 +85,20 @@ public class AttachServiceImpl implements AttachService {
|
|
|
Map<String, String> fileMap = uploadZip(uploadItem, parentDir, description);
|
|
|
if (fileMap != null) {
|
|
|
List<Attach> attachs = new ArrayList<Attach>();
|
|
|
+ String[] sources = null;
|
|
|
for (String entry : fileMap.keySet()) {
|
|
|
if (entryParams.containsKey(entry)) {
|
|
|
File file = new File(fileMap.get(entry));
|
|
|
if (file.exists()) {
|
|
|
Map<String, Object> params = entryParams.get(entry);
|
|
|
- Attach attach = new Attach(String.valueOf(params.get("name")), fileMap.get(entry), description, file.length(), new Date());
|
|
|
- attach = attachDao.save(attach);
|
|
|
- attach.setSourceId(params.get("sourceId").toString());
|
|
|
- attachs.add(attach);
|
|
|
+ sources = params.get("sourceId").toString().split(",");// multi sources
|
|
|
+ for (String sr : sources) {
|
|
|
+ Attach attach = new Attach(String.valueOf(params.get("name")), fileMap.get(entry), description, file.length(),
|
|
|
+ new Date());
|
|
|
+ attach = attachDao.save(attach);
|
|
|
+ attach.setSourceId(sr);
|
|
|
+ attachs.add(attach);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|