获取附件10/9
This commit is contained in:
parent
950dffedcd
commit
716ac6c1a3
|
|
@ -7,16 +7,12 @@ import kd.bos.form.events.AfterDoOperationEventArgs;
|
||||||
import kd.bos.orm.query.QFilter;
|
import kd.bos.orm.query.QFilter;
|
||||||
import kd.bos.servicehelper.AttachmentServiceHelper;
|
import kd.bos.servicehelper.AttachmentServiceHelper;
|
||||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
import kd.bos.util.HttpClientUtils;
|
|
||||||
import kd.sdk.plugin.Plugin;
|
import kd.sdk.plugin.Plugin;
|
||||||
import tqq9.lc123.cloud.app.api.utils.HttpClient;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class ScsGetUPLPlugin extends AbstractBillPlugIn implements Plugin {
|
public class ScsGetUPLPlugin extends AbstractBillPlugIn implements Plugin {
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -36,10 +32,8 @@ public class ScsGetUPLPlugin extends AbstractBillPlugIn implements Plugin {
|
||||||
String url = (String) att.get("url");
|
String url = (String) att.get("url");
|
||||||
fj.add(url);
|
fj.add(url);
|
||||||
}
|
}
|
||||||
String collect = fj.stream()
|
String[] collectArray = fj.toArray(new String[0]);
|
||||||
.map(url -> "\"" + url + "\"")
|
this.getModel().setValue("tqq9_fjurl_tag", collectArray);
|
||||||
.collect(Collectors.joining(",", "[", "]"));
|
|
||||||
this.getModel().setValue("tqq9_fjurl_tag", collect);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,66 @@
|
||||||
|
package tqq9.lc123.cloud.app.plugin.operate.sys;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import kd.bos.bill.AbstractBillPlugIn;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.form.events.AfterDoOperationEventArgs;
|
||||||
|
import kd.bos.orm.query.QCP;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.AttachmentServiceHelper;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.sdk.plugin.Plugin;
|
||||||
|
import tqq9.lc123.cloud.app.plugin.utils.HttpRequestUtils;
|
||||||
|
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class ScsPostApi extends AbstractBillPlugIn implements Plugin {
|
||||||
|
@Override
|
||||||
|
public void afterDoOperation(AfterDoOperationEventArgs eventArgs) {
|
||||||
|
super.afterDoOperation(eventArgs);
|
||||||
|
DynamicObject BJURL = BusinessDataServiceHelper.loadSingle("tqq9_thirdconfig", "name",
|
||||||
|
new QFilter[]{new QFilter("number", QCP.equals, "BJ_POSTURL")});
|
||||||
|
String BJ_URL = (String) BJURL.getString("name");
|
||||||
|
DynamicObject GZURL = BusinessDataServiceHelper.loadSingle("tqq9_thirdconfig", "name",
|
||||||
|
new QFilter[]{new QFilter("number", QCP.equals, "GZ_POSTURL")});
|
||||||
|
String GZ_URL = GZURL.getString("name");
|
||||||
|
|
||||||
|
String operateKey = eventArgs.getOperateKey();
|
||||||
|
if ("audit".equals(operateKey)){
|
||||||
|
HashMap<String, Object> body = new HashMap<>();
|
||||||
|
List<String> fj = new ArrayList<>();
|
||||||
|
String number = (String) this.getModel().getValue("number");
|
||||||
|
//获取单据信息,并查询单据中的附件字段
|
||||||
|
DynamicObject file = BusinessDataServiceHelper.loadSingle("tqq9_proxyandfactory", "*",
|
||||||
|
new QFilter[]{new QFilter("number", QFilter.equals, number)});
|
||||||
|
//获取单据中附件面板信息
|
||||||
|
List<Map<String, Object>> atts = AttachmentServiceHelper.getAttachments("tqq9_proxyandfactory", file.getPkValue().toString(), "tqq9_attachmentpanelap");
|
||||||
|
for (Map<String, Object> att : atts) {
|
||||||
|
String url = (String) att.get("url");
|
||||||
|
fj.add(url);
|
||||||
|
}
|
||||||
|
String[] collectArray = fj.toArray(new String[0]);
|
||||||
|
String fname = file.getString("name");
|
||||||
|
body.put("MFCode",number);
|
||||||
|
body.put("MFName",fname);
|
||||||
|
body.put("lstImageUrls",collectArray);
|
||||||
|
String jsonBody = JSON.toJSONString(body);
|
||||||
|
HashMap<String, String> headMap = new HashMap<>();
|
||||||
|
try {
|
||||||
|
String s1 = HttpRequestUtils.postJson(BJ_URL+"/api/BA/Manufacturer", jsonBody, headMap);
|
||||||
|
String s2 = HttpRequestUtils.postJson(GZ_URL+"/api/BA/Manufacturer", jsonBody, headMap);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package tqq9.lc123.cloud.app.plugin.operate.sys;
|
package tqq9.lc123.cloud.app.plugin.operate.sys;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import kd.bos.bill.AbstractBillPlugIn;
|
import kd.bos.bill.AbstractBillPlugIn;
|
||||||
import kd.bos.dataentity.entity.DynamicObject;
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
import kd.bos.form.events.AfterDoOperationEventArgs;
|
import kd.bos.form.events.AfterDoOperationEventArgs;
|
||||||
|
|
@ -8,12 +7,10 @@ import kd.bos.orm.query.QFilter;
|
||||||
import kd.bos.servicehelper.AttachmentServiceHelper;
|
import kd.bos.servicehelper.AttachmentServiceHelper;
|
||||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
import kd.sdk.plugin.Plugin;
|
import kd.sdk.plugin.Plugin;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 动态表单插件
|
* 动态表单插件
|
||||||
|
|
@ -42,9 +39,7 @@ public class ZczGetURLPlugin extends AbstractBillPlugIn implements Plugin {
|
||||||
String url = (String) att.get("url");
|
String url = (String) att.get("url");
|
||||||
sh.add(url);
|
sh.add(url);
|
||||||
}
|
}
|
||||||
String shcollect = sh.stream()
|
String[] shcollect = sh.toArray(new String[0]);
|
||||||
.map(url -> "\"" + url + "\"")
|
|
||||||
.collect(Collectors.joining(",", "[", "]"));
|
|
||||||
this.getModel().setValue("tqq9_shfjurl_tag", shcollect);
|
this.getModel().setValue("tqq9_shfjurl_tag", shcollect);
|
||||||
//北京
|
//北京
|
||||||
DynamicObject bj_file = BusinessDataServiceHelper.loadSingle("tqq9_registration", "id,tqq9_attachmentpanelbj",
|
DynamicObject bj_file = BusinessDataServiceHelper.loadSingle("tqq9_registration", "id,tqq9_attachmentpanelbj",
|
||||||
|
|
@ -55,10 +50,7 @@ public class ZczGetURLPlugin extends AbstractBillPlugIn implements Plugin {
|
||||||
String url = (String) att.get("url");
|
String url = (String) att.get("url");
|
||||||
bj.add(url);
|
bj.add(url);
|
||||||
}
|
}
|
||||||
String bjcollect = bj.stream()
|
String[] bjcollect = bj.toArray(new String[0]);
|
||||||
.map(url -> "\"" + url + "\"")
|
|
||||||
.collect(Collectors.joining(",", "[", "]"));
|
|
||||||
System.out.println("bjcollect:"+bjcollect);
|
|
||||||
this.getModel().setValue("tqq9_bjfjurl_tag", bjcollect);
|
this.getModel().setValue("tqq9_bjfjurl_tag", bjcollect);
|
||||||
//广州
|
//广州
|
||||||
//获取单据信息,并查询单据中的附件字段
|
//获取单据信息,并查询单据中的附件字段
|
||||||
|
|
@ -70,9 +62,7 @@ public class ZczGetURLPlugin extends AbstractBillPlugIn implements Plugin {
|
||||||
String url = (String) att.get("url");
|
String url = (String) att.get("url");
|
||||||
gz.add(url);
|
gz.add(url);
|
||||||
}
|
}
|
||||||
String gzcollect = gz.stream()
|
String[] gzcollect = gz.toArray(new String[0]);
|
||||||
.map(url -> "\"" + url + "\"")
|
|
||||||
.collect(Collectors.joining(",", "[", "]"));
|
|
||||||
this.getModel().setValue("tqq9_gzfjurl_tag", gzcollect);
|
this.getModel().setValue("tqq9_gzfjurl_tag", gzcollect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue