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);//业务单元-银行账户