| Line 21... |
Line 21... |
| 21 |
|
21 |
|
| 22 |
import org.apache.commons.csv.CSVFormat;
|
22 |
import org.apache.commons.csv.CSVFormat;
|
| 23 |
import org.apache.commons.csv.CSVParser;
|
23 |
import org.apache.commons.csv.CSVParser;
|
| 24 |
import org.apache.commons.csv.CSVRecord;
|
24 |
import org.apache.commons.csv.CSVRecord;
|
| 25 |
import org.apache.commons.lang3.StringUtils;
|
25 |
import org.apache.commons.lang3.StringUtils;
|
| - |
|
26 |
import org.apache.logging.log4j.LogManager;
|
| - |
|
27 |
import org.apache.logging.log4j.Logger;
|
| 26 |
import org.springframework.beans.factory.annotation.Autowired;
|
28 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 27 |
import org.springframework.stereotype.Controller;
|
29 |
import org.springframework.stereotype.Controller;
|
| 28 |
import org.springframework.ui.Model;
|
30 |
import org.springframework.ui.Model;
|
| 29 |
import org.springframework.web.bind.annotation.GetMapping;
|
31 |
import org.springframework.web.bind.annotation.GetMapping;
|
| 30 |
import org.springframework.web.bind.annotation.PostMapping;
|
32 |
import org.springframework.web.bind.annotation.PostMapping;
|
| Line 83... |
Line 85... |
| 83 |
|
85 |
|
| 84 |
private static final String THUMBNAIL = "thumbnail";
|
86 |
private static final String THUMBNAIL = "thumbnail";
|
| 85 |
private static final String ICON = "icon";
|
87 |
private static final String ICON = "icon";
|
| 86 |
private static final String DEFAULT = "default";
|
88 |
private static final String DEFAULT = "default";
|
| 87 |
private static final String NONE = "";
|
89 |
private static final String NONE = "";
|
| - |
|
90 |
|
| - |
|
91 |
private static final Logger LOGGER = LogManager.getLogger(ContentController.class);
|
| 88 |
|
92 |
|
| 89 |
private String getFileName(int entityId, String description, String extension) {
|
93 |
private String getFileName(int entityId, String description, String extension) {
|
| 90 |
List<Item> items = itemRepository.selectAllByCatalogItemId(entityId);
|
94 |
List<Item> items = itemRepository.selectAllByCatalogItemId(entityId);
|
| 91 |
String imageString = items.get(0).getItemDescriptionNoColor() + " " + description + " "
|
95 |
String imageString = items.get(0).getItemDescriptionNoColor() + " " + description + " "
|
| 92 |
+ LocalDateTime.now().toEpochSecond(ZoneOffset.ofHoursMinutes(5, 30));
|
96 |
+ LocalDateTime.now().toEpochSecond(ZoneOffset.ofHoursMinutes(5, 30));
|
| Line 107... |
Line 111... |
| 107 |
@PostMapping(value = "/content/media/upload")
|
111 |
@PostMapping(value = "/content/media/upload")
|
| 108 |
public String uploadMediaContent(HttpServletRequest request, @RequestBody EntityMediaPojo entityMediaPojo,
|
112 |
public String uploadMediaContent(HttpServletRequest request, @RequestBody EntityMediaPojo entityMediaPojo,
|
| 109 |
Model model) throws Exception {
|
113 |
Model model) throws Exception {
|
| 110 |
ContentPojo contentPojo = mongoClient.getEntityById(entityMediaPojo.getEntityId());
|
114 |
ContentPojo contentPojo = mongoClient.getEntityById(entityMediaPojo.getEntityId());
|
| 111 |
Map<String, InputStream> fileStreamsMap = getStreamFileMap(contentPojo, entityMediaPojo);
|
115 |
Map<String, InputStream> fileStreamsMap = getStreamFileMap(contentPojo, entityMediaPojo);
|
| - |
|
116 |
LOGGER.info("fileStreamsMap {}, " + fileStreamsMap.keySet());
|
| 112 |
uploadFiles(fileStreamsMap, entityMediaPojo.getEntityId());
|
117 |
uploadFiles(fileStreamsMap, entityMediaPojo.getEntityId());
|
| 113 |
mongoClient.persistEntity(contentPojo);
|
118 |
mongoClient.persistEntity(contentPojo);
|
| 114 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
119 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| 115 |
return "response";
|
120 |
return "response";
|
| 116 |
}
|
121 |
}
|