From 4a982963742e933cf63be9f7ec7f9773e3a802ad Mon Sep 17 00:00:00 2001 From: zengweihai Date: Thu, 24 Oct 2024 15:33:48 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=AC=BE=E9=83=A8=E9=97=A8=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E6=8A=A5=E9=94=80=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../formplugin/ReconPayreqFormPlugin.java | 52 ++++++++++++++++--- 1 file changed, 46 insertions(+), 6 deletions(-) diff --git a/fi/shkd-fi-fi/src/main/java/shkd/repc/recon/formplugin/ReconPayreqFormPlugin.java b/fi/shkd-fi-fi/src/main/java/shkd/repc/recon/formplugin/ReconPayreqFormPlugin.java index 5c65802..fa55164 100644 --- a/fi/shkd-fi-fi/src/main/java/shkd/repc/recon/formplugin/ReconPayreqFormPlugin.java +++ b/fi/shkd-fi-fi/src/main/java/shkd/repc/recon/formplugin/ReconPayreqFormPlugin.java @@ -36,6 +36,9 @@ import kd.bos.form.events.AfterDoOperationEventArgs; import kd.bos.form.events.BeforeDoOperationEventArgs; import kd.bos.form.events.ClientCallBackEvent; import kd.bos.form.events.ClosedCallBackEvent; +import kd.bos.form.field.BasedataEdit; +import kd.bos.form.field.events.BeforeF7SelectEvent; +import kd.bos.form.field.events.BeforeF7SelectListener; import kd.bos.form.operate.FormOperate; import kd.bos.form.plugin.AbstractFormPlugin; import kd.bos.imageplatform.axis.IScanWebServiceImplServiceStub; @@ -78,16 +81,22 @@ import java.util.stream.Collectors; * 发票识别,发票验真验重 * qeug_recon_payreqbill_ext && qeug_recon_connotextb_ext */ -public class ReconPayreqFormPlugin extends AbstractFormPlugin implements UploadListener { +public class ReconPayreqFormPlugin extends AbstractFormPlugin implements BeforeF7SelectListener { private static final Log logger = LogFactory.getLog(OAUtils.class); + List fileExtendList = new ArrayList(Arrays.asList("png","jpg","jpeg","ofd","pdf","xml"));//发票文件后缀集合 @Override public void registerListener(EventObject e) { super.registerListener(e); - AttachmentPanel attachmentPanel = getControl("qeug_attachmentpanelap"); - attachmentPanel.addUploadListener(this); + String billtype = this.getModel().getDataEntity().getDynamicObjectType().getName();//获取单据标识 + if ("recon_connotextbill".equals(billtype)){//当单据为费用登记单时,对该控件进行过滤监听。 + BasedataEdit edit = this.getView().getControl("qeug_personbank");//获取报销人控件 + edit.addBeforeF7SelectListener(this); + } + + } /** @@ -637,7 +646,7 @@ public class ReconPayreqFormPlugin extends AbstractFormPlugin implements UploadL linkBody.put("loginName",loginName); String token = ""; try { - String linkPostjson = HttpClientUtils.postjson(linkUrl, null, linkBody.toJSONString()); + String linkPostjson = HttpClientUtils.postjson(linkUrl, null, linkBody.toJSONString(),3*60*1000,3*60*1000); logger.info("获取OaToken接口返回结果:\n{}", linkPostjson); if (StringUtils.isNotEmpty(linkPostjson)) { @@ -665,7 +674,7 @@ public class ReconPayreqFormPlugin extends AbstractFormPlugin implements UploadL base64Header.put("Content-Type", "application/json"); base64Header.put("token", token); try { - String linkPostjson = HttpClientUtils.postjson(linkUrl, base64Header,strJson); + String linkPostjson = HttpClientUtils.postjson(linkUrl, base64Header,strJson,3*60*1000,3*60*1000); logger.info("获取parseOCRData接口返回结果:\n{}", linkPostjson); if (StringUtils.isNotEmpty(linkPostjson)) { JSONObject jsonObject = JSONObject.parseObject(linkPostjson); @@ -691,7 +700,7 @@ public class ReconPayreqFormPlugin extends AbstractFormPlugin implements UploadL saveCheckHeader.put("token", token); try { - String linkPostjson = HttpClientUtils.postjson(linkUrl, saveCheckHeader,strJson); + String linkPostjson = HttpClientUtils.postjson(linkUrl, saveCheckHeader,strJson,3*60*1000,3*60*1000); logger.info("获取saveOutInvoice接口返回结果:\n{}", linkPostjson); if (StringUtils.isNotEmpty(linkPostjson)) { JSONObject jsonObject = JSONObject.parseObject(linkPostjson); @@ -749,5 +758,36 @@ public class ReconPayreqFormPlugin extends AbstractFormPlugin implements UploadL String baseStr = new String(Base64.getEncoder().encode(bytes)); return baseStr; } + + + /** + * 报销人根据用款部门过滤 + * @param beforeF7SelectEvent + */ + @Override + public void beforeF7Select(BeforeF7SelectEvent beforeF7SelectEvent) { + String name = beforeF7SelectEvent.getProperty().getName(); + if ("qeug_personbank".equals(name)){ + DynamicObject dataEntity = this.getModel().getDataEntity(); + DynamicObject usedepart = dataEntity.getDynamicObject("usedepart");//获取用款部门数据 + if (usedepart != null){ + Long departId = usedepart.getLong("id");//用款部门id + List allUsersOfOrg = UserServiceHelper.getAllUsersOfOrg(departId);//得到当前组织的全部人员,包括直属员工和下属组织的员工 + QFilter qFilter = new QFilter("id", QCP.in, allUsersOfOrg); + DynamicObject[] bos_users = BusinessDataServiceHelper.load("bos_user", "id,number", qFilter.toArray()); + List userNumbers = new ArrayList();//构建人员工号容器 + for (DynamicObject bos_user : bos_users) { + String number = bos_user.getString("number"); + userNumbers.add(number); + } + QFilter qfByNumber = new QFilter("number", QCP.in, userNumbers); + ListShowParameter formShowParameter = (ListShowParameter) beforeF7SelectEvent.getFormShowParameter(); + formShowParameter.getListFilterParameter().setFilter(qfByNumber); + }else { + beforeF7SelectEvent.setCancel(true); + this.getView().showTipNotification("请先选择用款部门"); + } + } + } } // CodeRuleInfo codeRule = CodeRuleServiceHelper.getCodeRule("recon_invoicebill", recon_invoicebill, null); \ No newline at end of file