|
@@ -455,7 +455,6 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
|
|
|
e.printStackTrace();
|
|
|
} catch (EncoderException e) {
|
|
|
e.printStackTrace();
|
|
|
-
|
|
|
} finally {
|
|
|
try {
|
|
|
if (fis != null) {
|
|
@@ -467,8 +466,6 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -507,15 +504,13 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
|
try {
|
|
|
String type = json.getString("type");
|
|
|
- String url = "";
|
|
|
- if (!Check.isNull(json.getString("url"))) {
|
|
|
- url = "https:" + json.getString("url");
|
|
|
- }
|
|
|
+ String url = json.getString("url");
|
|
|
+ String code = json.getString("code");
|
|
|
MaterialInfo info = new MaterialInfo();
|
|
|
Long projectId = json.getLong("projectId");
|
|
|
Project project = projectService.getById(projectId);
|
|
|
Long productId = project.getProductId();
|
|
|
- String code = MD5Util.md5ByUrl(url);
|
|
|
+
|
|
|
info.setId(UUID.randomUUID().toString().replace("-", ""));
|
|
|
info.setCode(code);
|
|
|
if (!Check.isNull(json.getString("watermarkUrl"))) {
|
|
@@ -621,6 +616,28 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public JSONArray checkArrayCode(JSONArray array) {
|
|
|
+ if(null == array||array.isEmpty()){
|
|
|
+ return new JSONArray();
|
|
|
+ }
|
|
|
+ Map<String,String> codeMap = new HashMap<>();
|
|
|
+ JSONArray resultArray = new JSONArray();
|
|
|
+ for(int i=0;i<array.size();i++){
|
|
|
+ JSONObject data = array.getJSONObject(i);
|
|
|
+ String url = "https:"+data.getString("url");
|
|
|
+ data.put("url",url);
|
|
|
+ String code = MD5Util.md5ByUrl(url);
|
|
|
+ if(codeMap.containsKey(code)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ codeMap.put(code,code);
|
|
|
+ data.put("code",code);
|
|
|
+ resultArray.add(data);
|
|
|
+ }
|
|
|
+ return resultArray;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 素材库关联上传素材 1
|
|
|
*
|