1014
This commit is contained in:
parent
5702895885
commit
1b3781e6ca
|
|
@ -61,7 +61,6 @@ public class ScsPostApi extends AbstractBillPlugIn implements Plugin {
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,173 @@
|
||||||
|
package tqq9.lc123.cloud.app.plugin.operate.sys;
|
||||||
|
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.entity.datamodel.IDataModel;
|
||||||
|
import kd.bos.form.events.AfterDoOperationEventArgs;
|
||||||
|
import kd.bos.form.plugin.AbstractFormPlugin;
|
||||||
|
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 WmsScspostApi extends AbstractFormPlugin implements Plugin {
|
||||||
|
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");
|
||||||
|
DynamicObject WMSURL = BusinessDataServiceHelper.loadSingle("tqq9_thirdconfig", "name",
|
||||||
|
new QFilter[]{new QFilter("number", QCP.equals, "Ttx_MainURL")});
|
||||||
|
String WMS_URL = WMSURL.getString("name");
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterDoOperation(AfterDoOperationEventArgs e) {
|
||||||
|
super.afterDoOperation(e);
|
||||||
|
String operateKey = e.getOperateKey();
|
||||||
|
IDataModel model = this.getModel();
|
||||||
|
|
||||||
|
DynamicObject dataEntity = model.getDataEntity();
|
||||||
|
String number = dataEntity.getString("number");
|
||||||
|
if ("aduit".equals(operateKey)){
|
||||||
|
DynamicObject file = BusinessDataServiceHelper.loadSingle("tqq9_proxyandfactory", "id",
|
||||||
|
new QFilter[]{new QFilter("number", QFilter.equals, number)});
|
||||||
|
//获取url路径信息
|
||||||
|
List<Map<String, String>> urlPathsArray = new ArrayList<>();
|
||||||
|
List<Map<String, Object>> wms_atts = AttachmentServiceHelper.getAttachments("tqq9_proxyandfactory", file.getPkValue().toString(), "tqq9_attachmentpanelap");
|
||||||
|
for (Map<String, Object> att : wms_atts) {
|
||||||
|
HashMap<String, String> map = new HashMap<>();
|
||||||
|
String url = (String) att.get("url");
|
||||||
|
map.put("urlPath", url);
|
||||||
|
urlPathsArray.add(map);
|
||||||
|
}
|
||||||
|
Map<String, Object> urlPathList = new HashMap<>();
|
||||||
|
urlPathList.put("urlPaths", urlPathsArray);
|
||||||
|
|
||||||
|
//其他入参:
|
||||||
|
String number1 = dataEntity.getString("number");//生产厂商编码
|
||||||
|
String name = dataEntity.getString("name");//生产厂商名称
|
||||||
|
String tqq9_address = dataEntity.getString("tqq9_address");//地址1,string(50)
|
||||||
|
String tqq9_proaddress = dataEntity.getString("tqq9_proaddress");//地址2,string(50)
|
||||||
|
// <actionType>add|update, 必填</actionType>
|
||||||
|
// <manufactoryCode>生产厂商编码, string (50) , 必填</ manufactoryCode>
|
||||||
|
// <manufactoryName>生产厂商名称, string (200) </ manufactoryName>
|
||||||
|
//<manufactoryLicense>生产企业许可证/备案凭证号, string (50) </ manufactoryLicense >
|
||||||
|
//<permitType>准证类型, string (50) </ permitType >
|
||||||
|
//<urlPath>url链接地址, string(200), 必填</ urlPath>
|
||||||
|
//<status>是否有效,Y/N(默认为Y)</status>
|
||||||
|
//<address1>地址1,string(50)</address1>
|
||||||
|
//<address2>地址2,string(50)</address2>
|
||||||
|
//<state>省份,string(50)</state>
|
||||||
|
//<city>城市,string(50)</city>
|
||||||
|
//<district>区县,string(50)</district>
|
||||||
|
//<town>镇,string(50)</town>
|
||||||
|
//<country>国家,string(50)</country>
|
||||||
|
//<countryCode>国家编码,string(50)</countryCode>
|
||||||
|
//<stateCode>省份编码,string(50)</stateCode>
|
||||||
|
//<cityCode>城市编码,string(50)</cityCode>
|
||||||
|
//<districtCode>区/县编码,string(50)</districtCode>
|
||||||
|
//<townCode>镇编码,string(50)</townCode>
|
||||||
|
//<postalCode>邮编,string(50)</postalCode>
|
||||||
|
//<attentionTo>联系人,string(50)</attentionTo>
|
||||||
|
//<phoneNum>电话,string(50)</phoneNum>
|
||||||
|
//<mobile>手机,string(50)</mobile>
|
||||||
|
//<faxNum>传真,string(50)</faxNum>
|
||||||
|
//<email>E-mail,string(200)</email>
|
||||||
|
//<remark>备注,string(500)</remark>
|
||||||
|
|
||||||
|
//开始封装
|
||||||
|
Map<String, Object> request = new HashMap<>();
|
||||||
|
request.put("actionType","update");
|
||||||
|
request.put("manufactoryCode",number1);
|
||||||
|
request.put("manufactoryName",name);
|
||||||
|
request.put("address1",tqq9_address);
|
||||||
|
request.put("address2",tqq9_proaddress);
|
||||||
|
request.put("urlPathList",urlPathList);
|
||||||
|
// 最终的外层Map
|
||||||
|
Map<String, Object> finalMap = new HashMap<>();
|
||||||
|
finalMap.put("request", request);
|
||||||
|
StringBuilder xmlBuilder = new StringBuilder();
|
||||||
|
xmlBuilder.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
|
||||||
|
buildXml(xmlBuilder, finalMap, 0);
|
||||||
|
System.out.println("xmlBuilder:"+xmlBuilder);
|
||||||
|
|
||||||
|
HashMap<String, String> headMap = new HashMap<>();
|
||||||
|
try {
|
||||||
|
String s = HttpRequestUtils.postXml(WMS_URL+ "?method=manufacturer.create&v=2.0&format=xml&customerId=123", xmlBuilder.toString(), headMap);
|
||||||
|
System.out.println(s);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new RuntimeException(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private static void buildXml(StringBuilder xmlBuilder, Map<String, Object> map, int indent) {
|
||||||
|
String indentStr = createIndent(indent);
|
||||||
|
|
||||||
|
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
||||||
|
String key = entry.getKey();
|
||||||
|
Object value = entry.getValue();
|
||||||
|
|
||||||
|
if (value instanceof Map) {
|
||||||
|
// 处理嵌套Map
|
||||||
|
xmlBuilder.append(indentStr).append("<").append(key).append(">\n");
|
||||||
|
buildXml(xmlBuilder, (Map<String, Object>) value, indent + 1);
|
||||||
|
xmlBuilder.append(indentStr).append("</").append(key).append(">\n");
|
||||||
|
} else if (value instanceof List) {
|
||||||
|
// 处理List
|
||||||
|
List<?> list = (List<?>) value;
|
||||||
|
for (Object item : list) {
|
||||||
|
if (item instanceof Map) {
|
||||||
|
xmlBuilder.append(indentStr).append("<").append(key).append(">\n");
|
||||||
|
buildXml(xmlBuilder, (Map<String, Object>) item, indent + 1);
|
||||||
|
xmlBuilder.append(indentStr).append("</").append(key).append(">\n");
|
||||||
|
} else {
|
||||||
|
xmlBuilder.append(indentStr).append("<").append(key).append(">")
|
||||||
|
.append(escapeXml(item.toString()))
|
||||||
|
.append("</").append(key).append(">\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 处理普通值
|
||||||
|
if (value == null) {
|
||||||
|
xmlBuilder.append(indentStr).append("<").append(key).append("/>\n");
|
||||||
|
} else {
|
||||||
|
xmlBuilder.append(indentStr).append("<").append(key).append(">")
|
||||||
|
.append(escapeXml(value.toString()))
|
||||||
|
.append("</").append(key).append(">\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* XML特殊字符转义
|
||||||
|
*/
|
||||||
|
private static String escapeXml(String text) {
|
||||||
|
if (text == null) return "";
|
||||||
|
return text.replace("&", "&")
|
||||||
|
.replace("<", "<")
|
||||||
|
.replace(">", ">")
|
||||||
|
.replace("\"", """)
|
||||||
|
.replace("'", "'");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 自定义缩进方法
|
||||||
|
private static String createIndent(int indent) {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (int i = 0; i < indent; i++) {
|
||||||
|
sb.append(" "); // 4个空格
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -55,7 +55,6 @@ public class ZczPostApi extends AbstractBillPlugIn implements Plugin {
|
||||||
DynamicObjectCollection tqq9_entry = file.getDynamicObjectCollection("tqq9_entry");
|
DynamicObjectCollection tqq9_entry = file.getDynamicObjectCollection("tqq9_entry");
|
||||||
//分录
|
//分录
|
||||||
ArrayList<HashMap<String, String>> bglist = new ArrayList<>();
|
ArrayList<HashMap<String, String>> bglist = new ArrayList<>();
|
||||||
ArrayList<HashMap<String, String>> wmslist = new ArrayList<>();
|
|
||||||
for (DynamicObject entry : tqq9_entry) {
|
for (DynamicObject entry : tqq9_entry) {
|
||||||
DynamicObject tqq9_e_supplier = entry.getDynamicObject("tqq9_e_supplier");
|
DynamicObject tqq9_e_supplier = entry.getDynamicObject("tqq9_e_supplier");
|
||||||
if (tqq9_e_supplier != null) {
|
if (tqq9_e_supplier != null) {
|
||||||
|
|
|
||||||
|
|
@ -86,8 +86,16 @@ public class wmsZczPostApi extends AbstractBillPlugIn implements Plugin {
|
||||||
// <expireDate>有效期至, string (10) , YYYY-MM-DD , 必填</expireDate>
|
// <expireDate>有效期至, string (10) , YYYY-MM-DD , 必填</expireDate>
|
||||||
// <threeLevelClass >三级分类, string(50)</threeLevelClass >
|
// <threeLevelClass >三级分类, string(50)</threeLevelClass >
|
||||||
// <status>是否有效, Y/N (默认为Y) </ status>
|
// <status>是否有效, Y/N (默认为Y) </ status>
|
||||||
String tqq9_startdate = sdf.format(dataEntity.getDate("tqq9_startdate"));//有效期至
|
String yxqs = "";
|
||||||
|
Date tqq9_startdate = dataEntity.getDate("tqq9_startdate");
|
||||||
|
if (tqq9_startdate !=null){
|
||||||
|
yxqs = sdf.format(dataEntity.getDate("tqq9_startdate"));//有效期至
|
||||||
|
}
|
||||||
|
String yxqz = "";
|
||||||
String tqq9_enddate = sdf.format(dataEntity.getDate("tqq9_enddate"));//有效期至
|
String tqq9_enddate = sdf.format(dataEntity.getDate("tqq9_enddate"));//有效期至
|
||||||
|
if (tqq9_enddate != null) {
|
||||||
|
yxqs = sdf.format(dataEntity.getDate("tqq9_enddate"));//有效期至
|
||||||
|
}
|
||||||
String cRemark = dataEntity.getString("tqq9_remark");//备注
|
String cRemark = dataEntity.getString("tqq9_remark");//备注
|
||||||
String modifytime = sdf.format(dataEntity.getDate("modifytime"));//修改时间
|
String modifytime = sdf.format(dataEntity.getDate("modifytime"));//修改时间
|
||||||
String IsImportation = dataEntity.getString("tqq9_type").equals("A") ? "Y" : "N";//是否进口
|
String IsImportation = dataEntity.getString("tqq9_type").equals("A") ? "Y" : "N";//是否进口
|
||||||
|
|
@ -95,8 +103,8 @@ public class wmsZczPostApi extends AbstractBillPlugIn implements Plugin {
|
||||||
request.put("actionType", "update");
|
request.put("actionType", "update");
|
||||||
request.put("regNo", number);
|
request.put("regNo", number);
|
||||||
request.put("imported", IsImportation);
|
request.put("imported", IsImportation);
|
||||||
request.put("productDate", tqq9_startdate);
|
request.put("productDate", yxqs);
|
||||||
request.put("expireDate", tqq9_enddate);
|
request.put("expireDate", yxqz);
|
||||||
//request.put("threeLevelClass", "【三类】口腔科器械(17)");
|
//request.put("threeLevelClass", "【三类】口腔科器械(17)");
|
||||||
request.put("status", "Y");
|
request.put("status", "Y");
|
||||||
request.put("updateTime", modifytime);
|
request.put("updateTime", modifytime);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue