|
|
@@ -6,10 +6,12 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.skyversation.xjcy.bean.*;
|
|
|
import com.skyversation.xjcy.util.HttpUtil;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.core.io.FileSystemResource;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.LinkedMultiValueMap;
|
|
|
import org.springframework.util.MultiValueMap;
|
|
|
|
|
|
+import java.io.File;
|
|
|
import java.time.LocalDate;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
@@ -21,7 +23,7 @@ public class DMSService {
|
|
|
|
|
|
private JSONObject sendQueryToDms(DMSRequest request) {
|
|
|
JSONObject jsonObject;
|
|
|
- MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
|
|
|
+ MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
|
|
|
request.params.forEach(params::add);
|
|
|
params.add("search", request.where.toJSONString());
|
|
|
try {
|
|
|
@@ -50,11 +52,25 @@ public class DMSService {
|
|
|
return jsonObject;
|
|
|
}
|
|
|
|
|
|
- public void updateToDms(List<JSONObject> objs,String token,DMSColumn column) {
|
|
|
-
|
|
|
+ public String updateToDms(List<JSONObject> objs,String token,DMSColumn column) {
|
|
|
+ MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
|
|
|
+ params.add("modelId",column.getModelId());
|
|
|
+ params.add("json",JSON.toJSONString(objs));
|
|
|
+ Map<String,String> headers = new HashMap<>();
|
|
|
+ headers.put("token", token);
|
|
|
+ return HttpUtil.requestPost(path+"/content/updateContentByJson",params,headers);
|
|
|
}
|
|
|
- public void importToDms(List<JSONObject> objs,String token,DMSColumn column) {
|
|
|
-
|
|
|
+ public String importToDms(FileSystemResource file, String token, DMSImport importType) {
|
|
|
+ MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
|
|
|
+ params.add("columnId",importType.getColumn().getId());
|
|
|
+ params.add("length", importType.getLength());
|
|
|
+ params.add("contentParam",importType.getContent());
|
|
|
+ params.add("titleParam",importType.getTitle());
|
|
|
+ params.add("content",importType.getRelation());
|
|
|
+ params.add("file",file);
|
|
|
+ Map<String,String> headers = new HashMap<>();
|
|
|
+ headers.put("token", token);
|
|
|
+ return HttpUtil.requestPost(path+"/content/contentImportExcelJsonFileData",params,headers);
|
|
|
}
|
|
|
|
|
|
private List<JSONObject> queryDmsList(DMSRequest request, String token, String columnId) {
|