|
@@ -10,6 +10,7 @@ import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
|
|
|
import org.apache.commons.collections4.ListUtils;
|
|
|
import org.apache.commons.lang3.time.DateUtils;
|
|
|
|
|
|
+import org.jeecg.config.JeecgBaseConfig;
|
|
|
import org.jeecg.modules.baogao.common.BGType;
|
|
|
import org.jeecg.modules.baogao.common.BGXsType;
|
|
|
import org.jeecg.modules.baogao.dto.ItdmBaogaoCreateDTO;
|
|
@@ -19,6 +20,7 @@ import org.jeecg.modules.weituo.entity.ItdmWeituoInfo;
|
|
|
import org.jeecg.modules.weituo.entity.ItdmWeituoYangpin;
|
|
|
import org.jeecg.modules.weituo.entity.ItdmWeituoYangpinExtend;
|
|
|
|
|
|
+import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
import java.io.OutputStream;
|
|
|
import java.text.ParseException;
|
|
@@ -107,17 +109,33 @@ public class PoiTiUtils {
|
|
|
}
|
|
|
|
|
|
|
|
|
- public static Map<String, Object> getBaogaoImage(List<String> list) {
|
|
|
+ public static Map<String, Object> getBaogaoImage(List<String> list, JeecgBaseConfig jeecgBaseConfig) {
|
|
|
|
|
|
- List<Map<String, Object>> mapList = list.stream().map(
|
|
|
- i -> {
|
|
|
- Map<String, Object> map1 = new HashMap<>();
|
|
|
- map1.put("path", i);
|
|
|
- map1.put("name", FileUtil.mainName(i));
|
|
|
- return map1;
|
|
|
- }
|
|
|
+ List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
+
|
|
|
+
|
|
|
+ for (String i : list) {
|
|
|
+
|
|
|
+
|
|
|
+ StringBuilder filename = new StringBuilder();
|
|
|
+ String[] filenames = i.split("\\/" );
|
|
|
+
|
|
|
+ for (String s : filenames) {
|
|
|
+ filename.append(s).append(File.separator);
|
|
|
+ }
|
|
|
+ filename = new StringBuilder(filename.substring(0, filename.length() - File.separator.length()));
|
|
|
+ String filePath = jeecgBaseConfig.getPath().getUpload() + File.separator + filename;
|
|
|
|
|
|
- ).collect(Collectors.toList());
|
|
|
+
|
|
|
+ if (FileUtil.exist(filePath)) {
|
|
|
+ Map<String, Object> map1 = new HashMap<>();
|
|
|
+ map1.put("path", filePath);
|
|
|
+ map1.put("name", FileUtil.mainName(i));
|
|
|
+ mapList.add(map1);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
@@ -301,14 +319,11 @@ public class PoiTiUtils {
|
|
|
|
|
|
public static void main(String[] args) throws ParseException, IOException {
|
|
|
|
|
|
- List<Map<String, Object>> list = new ArrayList<>();
|
|
|
- for (int i = 0; i < 72; i++) {
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
- map.put("key", "key" + i);
|
|
|
- map.put("value", "value" + i);
|
|
|
- list.add(map);
|
|
|
- }
|
|
|
+ String i = "temp/a.jpg";
|
|
|
+
|
|
|
+ String filename = i.replaceAll("\\/", "_");
|
|
|
|
|
|
+ System.out.println(filename);
|
|
|
|
|
|
}
|
|
|
|