获取附件
This commit is contained in:
		
							parent
							
								
									7e5f90ccae
								
							
						
					
					
						commit
						950dffedcd
					
				|  | @ -1,16 +1,19 @@ | |||
| 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.dataentity.entity.DynamicObject; | ||||
| import kd.bos.form.events.AfterDoOperationEventArgs; | ||||
| import kd.bos.orm.query.QFilter; | ||||
| import kd.bos.servicehelper.AttachmentServiceHelper; | ||||
| import kd.bos.servicehelper.BusinessDataServiceHelper; | ||||
| import kd.bos.util.HttpClientUtils; | ||||
| import kd.sdk.plugin.Plugin; | ||||
| import tqq9.lc123.cloud.app.api.utils.HttpClient; | ||||
| 
 | ||||
| import java.io.IOException; | ||||
| import java.util.ArrayList; | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.stream.Collectors; | ||||
|  | @ -19,10 +22,11 @@ public class ScsGetUPLPlugin extends AbstractBillPlugIn implements Plugin { | |||
|     @Override | ||||
|     public void afterDoOperation(AfterDoOperationEventArgs eventArgs) { | ||||
|         super.afterDoOperation(eventArgs); | ||||
|         HashMap<String, Object> map = new HashMap<>(); | ||||
|         List<String> fj = new ArrayList<>(); | ||||
|         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", | ||||
|                     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"); | ||||
|                 fj.add(url); | ||||
|             } | ||||
|             String fj_urls = ""; | ||||
|             try { | ||||
|                 fj_urls = new ObjectMapper().writeValueAsString(fj); | ||||
|             } catch (JsonProcessingException e) { | ||||
|                 throw new RuntimeException(e); | ||||
|             } | ||||
|             ; | ||||
|             this.getModel().setValue("tqq9_fjurl_tag", fj_urls); | ||||
|         } | ||||
|             String collect = fj.stream() | ||||
|                     .map(url -> "\"" + url + "\"") | ||||
|                     .collect(Collectors.joining(",", "[", "]")); | ||||
|             this.getModel().setValue("tqq9_fjurl_tag", collect); | ||||
| 
 | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -31,7 +31,6 @@ public class ZczGetURLPlugin extends AbstractBillPlugIn implements Plugin  { | |||
|         String operateKey = eventArgs.getOperateKey(); | ||||
|         System.out.println("operateKey:" + operateKey); | ||||
|         if ("submit".equals(operateKey)) { | ||||
| 
 | ||||
|             //上海 | ||||
|             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"); | ||||
|             for (Map<String, Object> att : sh_atts) { | ||||
|                 String url = (String) att.get("url"); | ||||
|                 bj.add(url); | ||||
|                 sh.add(url); | ||||
|             } | ||||
|             String sh_urls = ""; | ||||
|             try { | ||||
|                 sh_urls = new ObjectMapper().writeValueAsString(sh); | ||||
|             } catch (JsonProcessingException e) { | ||||
|                 throw new RuntimeException(e); | ||||
|             } | ||||
|             this.getModel().setValue("tqq9_shfjurl_tag", sh_urls); | ||||
|             String shcollect = sh.stream() | ||||
|                     .map(url -> "\"" + url + "\"") | ||||
|                     .collect(Collectors.joining(",", "[", "]")); | ||||
|             this.getModel().setValue("tqq9_shfjurl_tag", shcollect); | ||||
|             //北京 | ||||
|             DynamicObject bj_file = BusinessDataServiceHelper.loadSingle("tqq9_registration", "id,tqq9_attachmentpanelbj", | ||||
|                     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"); | ||||
|                 bj.add(url); | ||||
|             } | ||||
|             String bj_urls = ""; | ||||
|             try { | ||||
|                 bj_urls = new ObjectMapper().writeValueAsString(bj); | ||||
|             } catch (JsonProcessingException e) { | ||||
|                 throw new RuntimeException(e); | ||||
|             } | ||||
|             this.getModel().setValue("tqq9_bjfjurl_tag", bj_urls); | ||||
|             String bjcollect = bj.stream() | ||||
|                     .map(url -> "\"" + url + "\"") | ||||
|                     .collect(Collectors.joining(",", "[", "]")); | ||||
|             System.out.println("bjcollect:"+bjcollect); | ||||
|             this.getModel().setValue("tqq9_bjfjurl_tag", bjcollect); | ||||
|             //广州 | ||||
|             //获取单据信息,并查询单据中的附件字段 | ||||
|             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"); | ||||
|             for (Map<String, Object> att : gz_atts) { | ||||
|                 String url = (String) att.get("url"); | ||||
|                 bj.add(url); | ||||
|                 gz.add(url); | ||||
|             } | ||||
|             String gz_urls = ""; | ||||
|             try { | ||||
|                 gz_urls = new ObjectMapper().writeValueAsString(gz); | ||||
|             } catch (JsonProcessingException e) { | ||||
|                 throw new RuntimeException(e); | ||||
|             } | ||||
|             ; | ||||
|             this.getModel().setValue("tqq9_gzfjurl_tag", gz_urls); | ||||
|             String gzcollect = gz.stream() | ||||
|                     .map(url -> "\"" + url + "\"") | ||||
|                     .collect(Collectors.joining(",", "[", "]")); | ||||
|             this.getModel().setValue("tqq9_gzfjurl_tag", gzcollect); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue