获取附件
This commit is contained in:
		
							parent
							
								
									7e5f90ccae
								
							
						
					
					
						commit
						950dffedcd
					
				|  | @ -1,16 +1,19 @@ | ||||||
| package tqq9.lc123.cloud.app.plugin.operate.sys; | package tqq9.lc123.cloud.app.plugin.operate.sys; | ||||||
| 
 | 
 | ||||||
| import com.fasterxml.jackson.core.JsonProcessingException; | 
 | ||||||
| import com.fasterxml.jackson.databind.ObjectMapper; |  | ||||||
| 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; | ||||||
| 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.List; | import java.util.List; | ||||||
| import java.util.Map; | import java.util.Map; | ||||||
| import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||||
|  | @ -19,10 +22,11 @@ public class ScsGetUPLPlugin extends AbstractBillPlugIn implements Plugin { | ||||||
|     @Override |     @Override | ||||||
|     public void afterDoOperation(AfterDoOperationEventArgs eventArgs) { |     public void afterDoOperation(AfterDoOperationEventArgs eventArgs) { | ||||||
|         super.afterDoOperation(eventArgs); |         super.afterDoOperation(eventArgs); | ||||||
|  |         HashMap<String, Object> map = new HashMap<>(); | ||||||
|         List<String> fj = new ArrayList<>(); |         List<String> fj = new ArrayList<>(); | ||||||
|         String operateKey = eventArgs.getOperateKey(); |         String operateKey = eventArgs.getOperateKey(); | ||||||
|         if (operateKey.equals("submit")){ |         String number = (String) this.getModel().getValue("number"); | ||||||
|             String number = (String) this.getModel().getValue("number"); |         if (operateKey.equals("submit")) { | ||||||
|             //获取单据信息,并查询单据中的附件字段 |             //获取单据信息,并查询单据中的附件字段 | ||||||
|             DynamicObject file = BusinessDataServiceHelper.loadSingle("tqq9_proxyandfactory", "id,tqq9_attachmentpanelap", |             DynamicObject file = BusinessDataServiceHelper.loadSingle("tqq9_proxyandfactory", "id,tqq9_attachmentpanelap", | ||||||
|                     new QFilter[]{new QFilter("number", QFilter.equals, number)}); |                     new QFilter[]{new QFilter("number", QFilter.equals, number)}); | ||||||
|  | @ -32,15 +36,11 @@ 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 fj_urls = ""; |             String collect = fj.stream() | ||||||
|             try { |                     .map(url -> "\"" + url + "\"") | ||||||
|                 fj_urls = new ObjectMapper().writeValueAsString(fj); |                     .collect(Collectors.joining(",", "[", "]")); | ||||||
|             } catch (JsonProcessingException e) { |             this.getModel().setValue("tqq9_fjurl_tag", collect); | ||||||
|                 throw new RuntimeException(e); |  | ||||||
|             } |  | ||||||
|             ; |  | ||||||
|             this.getModel().setValue("tqq9_fjurl_tag", fj_urls); |  | ||||||
|         } |  | ||||||
| 
 | 
 | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -31,7 +31,6 @@ public class ZczGetURLPlugin extends AbstractBillPlugIn implements Plugin  { | ||||||
|         String operateKey = eventArgs.getOperateKey(); |         String operateKey = eventArgs.getOperateKey(); | ||||||
|         System.out.println("operateKey:" + operateKey); |         System.out.println("operateKey:" + operateKey); | ||||||
|         if ("submit".equals(operateKey)) { |         if ("submit".equals(operateKey)) { | ||||||
| 
 |  | ||||||
|             //上海 |             //上海 | ||||||
|             String number = (String) this.getModel().getValue("number"); |             String number = (String) this.getModel().getValue("number"); | ||||||
|             //获取单据信息,并查询单据中的附件字段 |             //获取单据信息,并查询单据中的附件字段 | ||||||
|  | @ -41,15 +40,12 @@ public class ZczGetURLPlugin extends AbstractBillPlugIn implements Plugin  { | ||||||
|             List<Map<String, Object>> sh_atts = AttachmentServiceHelper.getAttachments("tqq9_registration", sh_file.getPkValue().toString(), "tqq9_attachmentpanelsh"); |             List<Map<String, Object>> sh_atts = AttachmentServiceHelper.getAttachments("tqq9_registration", sh_file.getPkValue().toString(), "tqq9_attachmentpanelsh"); | ||||||
|             for (Map<String, Object> att : sh_atts) { |             for (Map<String, Object> att : sh_atts) { | ||||||
|                 String url = (String) att.get("url"); |                 String url = (String) att.get("url"); | ||||||
|                 bj.add(url); |                 sh.add(url); | ||||||
|             } |             } | ||||||
|             String sh_urls = ""; |             String shcollect = sh.stream() | ||||||
|             try { |                     .map(url -> "\"" + url + "\"") | ||||||
|                 sh_urls = new ObjectMapper().writeValueAsString(sh); |                     .collect(Collectors.joining(",", "[", "]")); | ||||||
|             } catch (JsonProcessingException e) { |             this.getModel().setValue("tqq9_shfjurl_tag", shcollect); | ||||||
|                 throw new RuntimeException(e); |  | ||||||
|             } |  | ||||||
|             this.getModel().setValue("tqq9_shfjurl_tag", sh_urls); |  | ||||||
|             //北京 |             //北京 | ||||||
|             DynamicObject bj_file = BusinessDataServiceHelper.loadSingle("tqq9_registration", "id,tqq9_attachmentpanelbj", |             DynamicObject bj_file = BusinessDataServiceHelper.loadSingle("tqq9_registration", "id,tqq9_attachmentpanelbj", | ||||||
|                     new QFilter[]{new QFilter("number", QFilter.equals, number)}); |                     new QFilter[]{new QFilter("number", QFilter.equals, number)}); | ||||||
|  | @ -59,13 +55,11 @@ 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 bj_urls = ""; |             String bjcollect = bj.stream() | ||||||
|             try { |                     .map(url -> "\"" + url + "\"") | ||||||
|                 bj_urls = new ObjectMapper().writeValueAsString(bj); |                     .collect(Collectors.joining(",", "[", "]")); | ||||||
|             } catch (JsonProcessingException e) { |             System.out.println("bjcollect:"+bjcollect); | ||||||
|                 throw new RuntimeException(e); |             this.getModel().setValue("tqq9_bjfjurl_tag", bjcollect); | ||||||
|             } |  | ||||||
|             this.getModel().setValue("tqq9_bjfjurl_tag", bj_urls); |  | ||||||
|             //广州 |             //广州 | ||||||
|             //获取单据信息,并查询单据中的附件字段 |             //获取单据信息,并查询单据中的附件字段 | ||||||
|             DynamicObject gz_file = BusinessDataServiceHelper.loadSingle("tqq9_registration", "id,tqq9_attachmentpanelgz1", |             DynamicObject gz_file = BusinessDataServiceHelper.loadSingle("tqq9_registration", "id,tqq9_attachmentpanelgz1", | ||||||
|  | @ -74,16 +68,12 @@ public class ZczGetURLPlugin extends AbstractBillPlugIn implements Plugin  { | ||||||
|             List<Map<String, Object>> gz_atts = AttachmentServiceHelper.getAttachments("tqq9_registration", gz_file.getPkValue().toString(), "tqq9_attachmentpanelgz1"); |             List<Map<String, Object>> gz_atts = AttachmentServiceHelper.getAttachments("tqq9_registration", gz_file.getPkValue().toString(), "tqq9_attachmentpanelgz1"); | ||||||
|             for (Map<String, Object> att : gz_atts) { |             for (Map<String, Object> att : gz_atts) { | ||||||
|                 String url = (String) att.get("url"); |                 String url = (String) att.get("url"); | ||||||
|                 bj.add(url); |                 gz.add(url); | ||||||
|             } |             } | ||||||
|             String gz_urls = ""; |             String gzcollect = gz.stream() | ||||||
|             try { |                     .map(url -> "\"" + url + "\"") | ||||||
|                 gz_urls = new ObjectMapper().writeValueAsString(gz); |                     .collect(Collectors.joining(",", "[", "]")); | ||||||
|             } catch (JsonProcessingException e) { |             this.getModel().setValue("tqq9_gzfjurl_tag", gzcollect); | ||||||
|                 throw new RuntimeException(e); |  | ||||||
|             } |  | ||||||
|             ; |  | ||||||
|             this.getModel().setValue("tqq9_gzfjurl_tag", gz_urls); |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue