2025-10-10 09:33:02 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								package tqq9.lc123.cloud.app.plugin.operate.sys;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								import com.alibaba.fastjson.JSON;
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-13 10:00:56 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import com.alibaba.fastjson.JSONObject;
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-10 09:33:02 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								import kd.bos.bill.AbstractBillPlugIn;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								import kd.bos.dataentity.entity.DynamicObject;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								import kd.bos.dataentity.entity.DynamicObjectCollection;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								import kd.bos.entity.datamodel.IDataModel;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								import kd.bos.form.events.AfterDoOperationEventArgs;
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-13 10:00:56 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import kd.bos.isc.util.script.feature.tool.string.Json2Xml;
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-10 09:33:02 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								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;
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-13 10:00:56 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import org.json.XML;
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-10 09:33:02 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								import tqq9.lc123.cloud.app.plugin.utils.HttpRequestUtils;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-13 10:00:56 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-10 09:33:02 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								import java.io.IOException;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								import java.util.ArrayList;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								import java.util.HashMap;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								import java.util.List;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								import java.util.Map;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/**
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * 动态表单插件
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								public class ZczPostApi extends AbstractBillPlugIn 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");
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-13 10:00:56 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    DynamicObject WMSURL = BusinessDataServiceHelper.loadSingle("tqq9_thirdconfig", "name",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            new QFilter[]{new QFilter("number", QCP.equals, "Ttx_MainURL")});
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    String WMS_URL = WMSURL.getString("name");
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-10 09:33:02 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    @Override
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    public void afterDoOperation(AfterDoOperationEventArgs e) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        super.afterDoOperation(e);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        String operateKey = e.getOperateKey();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        IDataModel model = this.getModel();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        DynamicObject dataEntity = model.getDataEntity();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        HashMap<String, Object> bj_map = new HashMap<>();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        HashMap<String, Object> gz_map = new HashMap<>();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        List<String> bj = new ArrayList<>();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        List<String> gz = new ArrayList<>();
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-13 10:00:56 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-10 09:33:02 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        String number = dataEntity.getString("number");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if ("audit".equals(operateKey)) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            DynamicObject file = BusinessDataServiceHelper.loadSingle("tqq9_registration", "id,tqq9_attachmentpanelbj,tqq9_supplier.number,tqq9_supplier.tqq9_prolicense,tqq9_entry,tqq9_entry.tqq9_e_supplier",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                    new QFilter[]{new QFilter("number", QFilter.equals, number)});
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            DynamicObjectCollection tqq9_entry = file.getDynamicObjectCollection("tqq9_entry");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            //分录
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-13 10:00:56 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            ArrayList<HashMap<String, String>> bglist = new ArrayList<>();
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-10 09:33:02 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            for (DynamicObject entry : tqq9_entry) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                DynamicObject tqq9_e_supplier = entry.getDynamicObject("tqq9_e_supplier");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                if (tqq9_e_supplier != null) {
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-13 10:00:56 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                    //北广map
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-10 09:33:02 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                    HashMap<String, String> scsmap = new HashMap<>();
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-13 10:00:56 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-10 09:33:02 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                    String number2 = tqq9_e_supplier.getString("number");
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-13 10:00:56 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                    DynamicObject file2 = BusinessDataServiceHelper.loadSingle("tqq9_proxyandfactory", "id,number,name,tqq9_prolicense",
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-10 09:33:02 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                            new QFilter[]{new QFilter("number", QFilter.equals, number2)});
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                    String MFCode = file2.getString("number");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                    String ProLicenceCode = file2.getString("tqq9_prolicense");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                    scsmap.put("MFCode", MFCode);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                    scsmap.put("ProLicenceCode", ProLicenceCode);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                    scsmap.put("IsAgent", "0");
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-13 10:00:56 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                    scsmap.put("isAgent", "Y");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                    bglist.add(scsmap);
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-10 09:33:02 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            }
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-14 10:26:30 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            //123564
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-10 09:33:02 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            //北京
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            //获取单据中附件面板信息
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            List<Map<String, Object>> bj_atts = AttachmentServiceHelper.getAttachments("tqq9_registration", file.getPkValue().toString(), "tqq9_attachmentpanelbj");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            for (Map<String, Object> att : bj_atts) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                String url = (String) att.get("url");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                bj.add(url);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            String[] bjcollect = bj.toArray(new String[0]);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            //广州
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            //获取单据中附件面板信息
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            List<Map<String, Object>> gz_atts = AttachmentServiceHelper.getAttachments("tqq9_registration", file.getPkValue().toString(), "tqq9_attachmentpanelgz1");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            for (Map<String, Object> att : gz_atts) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                String url = (String) att.get("url");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                gz.add(url);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            String[] gzcollect = gz.toArray(new String[0]);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            //post请求body
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            String dEndDate = dataEntity.getString("tqq9_enddate");//有效期至
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            String cRemark = dataEntity.getString("tqq9_remark");//备注
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            String IsImportation = dataEntity.getString("tqq9_type").equals("A") ? "1" : "0";//是否进口
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            bj_map.put("cRegNo", number);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            bj_map.put("dEndDate", dEndDate);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            bj_map.put("cRemark", cRemark);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            bj_map.put("lstImageUrls", bjcollect);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            bj_map.put("IsImportation", IsImportation);
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-13 10:00:56 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            bj_map.put("lstManufacturer", bglist);//成产商
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-10 09:33:02 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            String bjjsonBody = JSON.toJSONString(bj_map);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            gz_map.put("cRegNo", number);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            gz_map.put("dEndDate", dEndDate);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            gz_map.put("cRemark", cRemark);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            gz_map.put("lstImageUrls", gzcollect);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            gz_map.put("IsImportation", IsImportation);
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-13 10:00:56 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            gz_map.put("lstManufacturer", bglist);
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-10 09:33:02 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            String gzjsonBody = JSON.toJSONString(bj_map);
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-13 10:00:56 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-10 09:33:02 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            //北京
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            try {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                String s1 = HttpRequestUtils.postJson(BJ_URL + "/api/BA/Registration", bjjsonBody, null);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            } catch (IOException ex) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                throw new RuntimeException(ex);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            //广州
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            try {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                String s2 = HttpRequestUtils.postJson(GZ_URL + "/api/BA/Registration", gzjsonBody, null);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            } catch (IOException ex) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                throw new RuntimeException(ex);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            }
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-13 10:00:56 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-10 09:33:02 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-13 10:00:56 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-10-10 09:33:02 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 |