From a9bb611d9a2bc550fad82259f557496f198d0f6e Mon Sep 17 00:00:00 2001 From: yuxueliang0813 <407010292@qq.com> Date: Mon, 18 Nov 2024 15:46:32 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=8C=E6=94=BF=E7=BB=84=E7=BB=87=E8=B4=A2?= =?UTF-8?q?=E5=8A=A1=E7=BB=84=E7=BB=87=E5=AF=B9=E5=BA=94=E5=85=B3=E7=B3=BB?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shkd/repc/task/DobeDWorgRelationTask.java | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/main/java/shkd/repc/task/DobeDWorgRelationTask.java b/main/java/shkd/repc/task/DobeDWorgRelationTask.java index 35c81b1..88860e0 100644 --- a/main/java/shkd/repc/task/DobeDWorgRelationTask.java +++ b/main/java/shkd/repc/task/DobeDWorgRelationTask.java @@ -22,7 +22,7 @@ import java.io.IOException; import java.util.Map; /** - * 后台任务插件 + * 行政组织和财务组织对应关系后台任务插件 */ public class DobeDWorgRelationTask extends AbstractTask implements Plugin { @@ -96,7 +96,7 @@ public class DobeDWorgRelationTask extends AbstractTask implements Plugin { for (int i = 0; i < detailsJson.size(); i++) { json_body = detailsJson.getJSONObject(i); - orgNumber = json_body.getString("oaorg_code");//oa组织code + orgNumber = json_body.getString("oaorg_code");//oa组织code oa组织id是oaorg_id orgName = json_body.getString("oaorg_name");//oa组织名称 companyNumber = json_body.getString("corp_code");//财务公司编号 companyName = json_body.getString("corp_name");//财务公司名称 @@ -111,17 +111,19 @@ public class DobeDWorgRelationTask extends AbstractTask implements Plugin { } //根据组织编号查找系统现有数据是否存在 "id,number,name,qeug_companynumber,qeug_companyname,qeug_deptnumber,qeug_deptname", orginfo = BusinessDataServiceHelper.loadSingle(entityName,new QFilter[]{new QFilter("number","=",orgNumber)}); - if(orginfo != null && isNeedUpdate(orginfo,companyNumber,deptNumber,paynumber,taxno)){ + if(orginfo != null){ //QueryServiceHelper.queryOne查出来的对象不是DynamicObject 而是平铺对象plainobject 此对象不能在后续代码中进行修改和更新; - orginfo.set("name", orgName); - orginfo.set("qeug_companynumber", companyNumber); - orginfo.set("qeug_companyname", companyName); - orginfo.set("qeug_deptnumber", deptNumber); - orginfo.set("qeug_deptname", deptName); - orginfo.set("qeug_paybank", paybank); - orginfo.set("qeug_paynumber", paynumber); - orginfo.set("qeug_taxno", taxno); - SaveServiceHelper.update(orginfo); + if(isNeedUpdate(orginfo,companyNumber,deptNumber,paynumber,taxno)){ + orginfo.set("name", orgName); + orginfo.set("qeug_companynumber", companyNumber); + orginfo.set("qeug_companyname", companyName); + orginfo.set("qeug_deptnumber", deptNumber); + orginfo.set("qeug_deptname", deptName); + orginfo.set("qeug_paybank", paybank); + orginfo.set("qeug_paynumber", paynumber); + orginfo.set("qeug_taxno", taxno); + SaveServiceHelper.update(orginfo); + } }else{ //不存在,做新增 根据实体名称创建动态对象 orginfo = BusinessDataServiceHelper.newDynamicObject(entityName); @@ -135,13 +137,14 @@ public class DobeDWorgRelationTask extends AbstractTask implements Plugin { orginfo.set("qeug_paynumber", paynumber); orginfo.set("qeug_taxno", taxno); orginfo.set("enable", 1); + orginfo.set("status", "A");//单据状态 A保存 B已提交 C已审核 orginfo.set("creator", 43007523L);//创建人默认指定为金小蝶 //保存数据:直接保存入库,不走操作校验 SaveServiceHelper.save(new DynamicObject[]{orginfo}); } //根据行政组织编号找到星瀚上的业务单元对象 yworginfo = BusinessDataServiceHelper.loadSingle(orgEntityName,new QFilter[]{new QFilter("number","=",orgNumber)}); - if(yworginfo != null){ + if(yworginfo != null && !companyName.equals(yworginfo.getString("ffirmname"))){ yworginfo.set("ffirmname", companyName);//业务单元-公司名称 yworginfo.set("depositbank", paybank);//业务单元-开户行 yworginfo.set("bankaccount", paynumber);//业务单元-银行账户