diff --git a/main/java/shjh/jhzj7/fi/fi/plugin/form/InitAccountFormPlugin.java b/main/java/shjh/jhzj7/fi/fi/plugin/form/InitAccountFormPlugin.java index ca8f8bc..43ae8f5 100644 --- a/main/java/shjh/jhzj7/fi/fi/plugin/form/InitAccountFormPlugin.java +++ b/main/java/shjh/jhzj7/fi/fi/plugin/form/InitAccountFormPlugin.java @@ -5,11 +5,10 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.util.TypeUtils; import kd.bos.context.RequestContext; +import kd.bos.dataentity.OperateOption; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObjectCollection; import kd.bos.dataentity.utils.StringUtils; -import kd.bos.db.DB; -import kd.bos.db.DBRoute; import kd.bos.entity.datamodel.events.BeforeImportEntryEventArgs; import kd.bos.form.control.Control; import kd.bos.form.plugin.AbstractFormPlugin; @@ -19,7 +18,7 @@ import kd.bos.logging.Log; import kd.bos.logging.LogFactory; import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.BusinessDataServiceHelper; -import kd.bos.servicehelper.operation.SaveServiceHelper; +import kd.bos.servicehelper.operation.OperationServiceHelper; import shjh.jhzj7.fi.fi.utils.EsbUtils; import shjh.jhzj7.fi.fi.utils.JhzjUtils; @@ -39,7 +38,7 @@ public class InitAccountFormPlugin extends AbstractFormPlugin { private static final String bbName = "bd_currency";//币别 private static final Map mapObject = new HashMap<>();//公司对象集合 private static final Map hsxmMaps = new HashMap<>();//核算维度对象集合 - private static final String insertSql = "insert into T_BD_Account_U (fdataid,fuseorgid) values (?,?);"; +// private static final String insertSql = "insert into T_BD_Account_U (fdataid,fuseorgid) values (?,?);"; //处理科目在每个公司生成 Map companyAcctMaps = null; Map acctids = new HashMap<>();//科目编号和ID对应关系 @@ -93,10 +92,11 @@ public class InitAccountFormPlugin extends AbstractFormPlugin { long kmId = ID.genLongId(); acctInfo.set("id", kmId); acctInfo.set("masterid", kmId);//主数据内码,系统不会根据id自动生成,需要手动设置 - //保存数据:直接保存入库,不走操作校验 - SaveServiceHelper.save(new DynamicObject[]{acctInfo}); + //必须调用保存操作,否则不符合受控基础资料开发规范 +// SaveServiceHelper.save(new DynamicObject[]{acctInfo}); + OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{acctInfo}, OperateOption.create()); //处理科目使用范围 - DB.update(DBRoute.of("fi"), insertSql, new Object[]{kmId,JhzjUtils.GROUPID}); +// DB.update(DBRoute.of("fi"), insertSql, new Object[]{kmId,JhzjUtils.GROUPID}); parentMaps.put(parentnumber,acctInfo); } return parentMaps.get(parentnumber); @@ -121,6 +121,7 @@ public class InitAccountFormPlugin extends AbstractFormPlugin { String name;//科目名称 String acctType;//科目类型 资产负债类 损益类 DynamicObject acctTypeInfo; + OperateOption oop = OperateOption.create(); //先根据基础信息在集团层面生成科目,不考虑核算维度,使用逐级分配 //再根据公司信息进行科目分配 //最后处理每个公司下科目的核算维度和禁用状态 @@ -188,10 +189,11 @@ public class InitAccountFormPlugin extends AbstractFormPlugin { long kmId = ID.genLongId(); acctInfo.set("id", kmId); acctInfo.set("masterid", kmId);//主数据内码,系统不会根据id自动生成,需要手动设置 - //保存数据:直接保存入库,不走操作校验 - SaveServiceHelper.save(new DynamicObject[]{acctInfo}); + //必须调用保存操作,否则不符合受控基础资料开发规范 +// SaveServiceHelper.save(new DynamicObject[]{acctInfo}); + OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{acctInfo}, oop); //处理科目使用范围 - DB.update(DBRoute.of("fi"), insertSql, new Object[]{kmId,JhzjUtils.GROUPID}); +// DB.update(DBRoute.of("fi"), insertSql, new Object[]{kmId,JhzjUtils.GROUPID}); acctids.put(number,acctInfo.getLong("id")); accountMaps.put(number,acctInfo); @@ -255,6 +257,7 @@ public class InitAccountFormPlugin extends AbstractFormPlugin { String companynum; DynamicObject checkitementryInfo = null; JSONObject json_body; + OperateOption oop = OperateOption.create(); for (int i = 0; i < asstacttypesJson.size(); i++) { json_body = asstacttypesJson.getJSONObject(i); hsxm = json_body.getString("shjh_asstactname"); @@ -296,7 +299,9 @@ public class InitAccountFormPlugin extends AbstractFormPlugin { checkitementryInfo.set("isrequire", false);//必录 } acctInfo.set("isassist", true);//主表的isassist是否包含核算项目为是 - SaveServiceHelper.save(new DynamicObject[]{acctInfo}); + //必须调用保存操作,否则不符合受控基础资料开发规范 +// SaveServiceHelper.save(new DynamicObject[]{acctInfo}); + OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{acctInfo}, oop); companyAcctMaps.put(number+companynum,acctInfo); } } @@ -487,9 +492,11 @@ public class InitAccountFormPlugin extends AbstractFormPlugin { //手动指定科目的金蝶id newAcctInfo.set("id", ID.genLongId()); newAcctInfo.set("masterid", olddo.getLong("id"));//主数据内码,系统不会根据id自动生成,需要手动设置 - SaveServiceHelper.save(new DynamicObject[]{newAcctInfo}); + //必须调用保存操作,否则不符合受控基础资料开发规范 +// SaveServiceHelper.save(new DynamicObject[]{acctInfo}); + OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{newAcctInfo}, OperateOption.create()); //处理科目使用范围 - DB.update(DBRoute.of("fi"), insertSql, new Object[]{newAcctInfo.getLong("id"),hsorgInfo.getLong("id")}); +// DB.update(DBRoute.of("fi"), insertSql, new Object[]{newAcctInfo.getLong("id"),hsorgInfo.getLong("id")}); return newAcctInfo; } diff --git a/main/java/shjh/jhzj7/fi/fi/plugin/operate/ClearAccountBillOperation.java b/main/java/shjh/jhzj7/fi/fi/plugin/operate/ClearAccountBillOperation.java index b83b060..b893672 100644 --- a/main/java/shjh/jhzj7/fi/fi/plugin/operate/ClearAccountBillOperation.java +++ b/main/java/shjh/jhzj7/fi/fi/plugin/operate/ClearAccountBillOperation.java @@ -595,16 +595,24 @@ public class ClearAccountBillOperation extends AbstractOperationServicePlugIn im JSONObject clear;//从清账单分录获取应收的凭证数据 for (int i = 0; i < docolls.size(); i++) { entryinfo = docolls.get(i); - clear = new JSONObject(); - clear.put("BUKRS",companyCode);//公司代码 - clear.put("BELNR",entryinfo.getString("shjh_e_pzh"));//应收会计凭证编号 - clear.put("GJAHR",entryinfo.getString("shjh_e_year"));//会计年度 - clear.put("BUZEI",entryinfo.getString("shjh_e_pzhh"));//行编号 - clear.put("KUNNR",customerCode);//客户编号 - clear.put("HKONT",entryinfo.getString("shjh_e_account"));//总账科目编号 - clear.put("UMSKZ", JhzjUtils.getUMSKZ(entryinfo.getString("shjh_e_account")));//特殊总账标识 - clear.put("DMBTR1",entryinfo.getBigDecimal("shjh_e_cursettle").abs());//清账金额--sap接收的正数金额 - IT_CLEAR.add(clear); + //先从IT_CLEAR集合中查找,如果找不到,则新增 + clear = getClearJsonObj(IT_CLEAR,entryinfo); + if(clear == null){ + clear = new JSONObject(); + clear.put("BUKRS",companyCode);//公司代码 + clear.put("BELNR",entryinfo.getString("shjh_e_pzh"));//应收会计凭证编号 + clear.put("GJAHR",entryinfo.getString("shjh_e_year"));//会计年度 + clear.put("BUZEI",entryinfo.getString("shjh_e_pzhh"));//行编号 + clear.put("KUNNR",customerCode);//客户编号 + clear.put("HKONT",entryinfo.getString("shjh_e_account"));//总账科目编号 + clear.put("UMSKZ", JhzjUtils.getUMSKZ(entryinfo.getString("shjh_e_account")));//特殊总账标识 + clear.put("DMBTR1",entryinfo.getBigDecimal("shjh_e_cursettle").abs());//清账金额--sap接收的正数金额 + IT_CLEAR.add(clear); + }else{ + //将当前清账分录对象中的清账金额与clear对象合并 + clear.put("DMBTR1",JhzjUtils.addTwoAmount(clear.getBigDecimal("DMBTR1"), + entryinfo.getBigDecimal("shjh_e_cursettle").abs())); + } } //从收款单cas_recbill获取实收的凭证数据 //先根据关系表找到收款单id和收款分录id,再将收款单对象查出来 @@ -650,6 +658,21 @@ public class ClearAccountBillOperation extends AbstractOperationServicePlugIn im return null; } + private JSONObject getClearJsonObj(JSONArray IT_CLEAR, DynamicObject entryinfo){ + //根据清账单分录和json集合查找对应json对象 + JSONObject jsonobj; + for (int i = 0; i < IT_CLEAR.size(); i++) { + jsonobj = IT_CLEAR.getJSONObject(i); + if(jsonobj.getString("BELNR").equals(entryinfo.getString("shjh_e_pzh")) && + jsonobj.getString("GJAHR").equals(entryinfo.getString("shjh_e_year")) && + jsonobj.getString("BUZEI").equals(entryinfo.getString("shjh_e_pzhh")) && + jsonobj.getString("HKONT").equals(entryinfo.getString("shjh_e_account"))){ + return jsonobj; + } + } + return null; + } + private String getAccountNumber(Long recebillid){ //根据收款单ID获取对应金蝶凭证的贷方科目编号 DynamicObject gl_voucher = BusinessDataServiceHelper.loadSingle(voucherName, diff --git a/main/java/shjh/jhzj7/fi/fi/plugin/operate/ClearDetailBillOperation.java b/main/java/shjh/jhzj7/fi/fi/plugin/operate/ClearDetailBillOperation.java index 616bfb2..65bf3a5 100644 --- a/main/java/shjh/jhzj7/fi/fi/plugin/operate/ClearDetailBillOperation.java +++ b/main/java/shjh/jhzj7/fi/fi/plugin/operate/ClearDetailBillOperation.java @@ -1,6 +1,7 @@ package shjh.jhzj7.fi.fi.plugin.operate; import com.sap.db.jdbc.packet.ErrorLevel; +import kd.bos.context.RequestContext; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObjectCollection; import kd.bos.db.DB; @@ -291,6 +292,7 @@ public class ClearDetailBillOperation extends AbstractOperationServicePlugIn imp clearEntryInfo.set("shjh_e_detailentryid",detailEntryInfo.getString("id"));// 明细单分录ID clearEntryInfo.set("shjh_e_detailbillid",detailBillInfo.getString("id"));// 明细单ID clearEntryInfo.set("shjh_e_detailbillno",detailBillInfo.getString("billno"));// 明细单编号 + clearEntryInfo.set("shjh_submituser", RequestContext.get().getCurrUserId());// 明细单提交用户 } //处理清账单账扣 BigDecimal q1 = JhzjUtils.addTwoAmount(clearBillInfo.getBigDecimal("shjh_deductionamount"), diff --git a/main/java/shjh/jhzj7/fi/fi/plugin/operate/CustomerInitOperation.java b/main/java/shjh/jhzj7/fi/fi/plugin/operate/CustomerInitOperation.java index 183f01c..d9941c3 100644 --- a/main/java/shjh/jhzj7/fi/fi/plugin/operate/CustomerInitOperation.java +++ b/main/java/shjh/jhzj7/fi/fi/plugin/operate/CustomerInitOperation.java @@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONException; import com.alibaba.fastjson.JSONObject; import com.sap.db.jdbc.packet.ErrorLevel; import kd.bos.context.RequestContext; +import kd.bos.dataentity.OperateOption; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObjectCollection; import kd.bos.entity.operate.result.OperateErrorInfo; @@ -15,6 +16,7 @@ import kd.bos.logging.Log; import kd.bos.logging.LogFactory; import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.bos.servicehelper.operation.OperationServiceHelper; import kd.bos.servicehelper.operation.SaveServiceHelper; import kd.sdk.plugin.Plugin; import shjh.jhzj7.fi.fi.utils.EsbUtils; @@ -51,6 +53,7 @@ public class CustomerInitOperation extends AbstractOperationServicePlugIn implem JSONObject json_body; Long currentSupId; DynamicObject custgroupdetail; + OperateOption oop = OperateOption.create(); for (DynamicObject pzinfo : dos) { pzinfo = BusinessDataServiceHelper.loadSingle(pzinfo.getPkValue(), pzinfo.getDataEntityType().getName()); try{ @@ -114,7 +117,7 @@ public class CustomerInitOperation extends AbstractOperationServicePlugIn implem currentCus.set("org", JhzjUtils.GROUPID);//管理组织 默认为集团 currentCus.set("ctrlstrategy","1");//控制策略 默认逐级分配1 自由分配2 currentCus.set("group",custype.getLong("id"));//客户分组 - currentCus.set("bitindex",1);//位图 +// currentCus.set("bitindex",1);//位图 currentCus.set("customerstatus",EsbUtils.CUSTOMERSTATUS);//客户状态 currentCus.set("name",cusname);//客户名称 currentCus.set("tx_register_no",taxno);//税务登记号 @@ -135,7 +138,10 @@ public class CustomerInitOperation extends AbstractOperationServicePlugIn implem //处理 客户组5 handleFive(customerfivesJson,currentCus.getDynamicObjectCollection("shjh_entry_five"),cusnumber); - SaveServiceHelper.save(new DynamicObject[]{currentCus}); +// SaveServiceHelper.save(new DynamicObject[]{currentCus}); + //保存客户-必须调用保存操作,否则不符合受控基础资料开发规范 +// SaveServiceHelper.save(new DynamicObject[]{currentCus}); + OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{currentCus}, oop); //处理分类 custgroupdetail = BusinessDataServiceHelper.newDynamicObject(gdName); custgroupdetail.set("createorg",JhzjUtils.GROUPID);//创建组织 @@ -157,7 +163,7 @@ public class CustomerInitOperation extends AbstractOperationServicePlugIn implem if(!"M400".equals(type)){ handleBank(banksJson,currentCus.getDynamicObjectCollection("entry_bank"),cusnumber,cusname); } - SaveServiceHelper.save(new DynamicObject[]{currentCus}); + OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{currentCus}, oop); } cusids.put(cusnumber,currentSupId); } diff --git a/main/java/shjh/jhzj7/fi/fi/plugin/operate/SupplierInitOperation.java b/main/java/shjh/jhzj7/fi/fi/plugin/operate/SupplierInitOperation.java index dafab4f..aaac18b 100644 --- a/main/java/shjh/jhzj7/fi/fi/plugin/operate/SupplierInitOperation.java +++ b/main/java/shjh/jhzj7/fi/fi/plugin/operate/SupplierInitOperation.java @@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONException; import com.alibaba.fastjson.JSONObject; import com.sap.db.jdbc.packet.ErrorLevel; import kd.bos.context.RequestContext; +import kd.bos.dataentity.OperateOption; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObjectCollection; import kd.bos.entity.operate.result.OperateErrorInfo; @@ -15,6 +16,7 @@ import kd.bos.logging.Log; import kd.bos.logging.LogFactory; import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.bos.servicehelper.operation.OperationServiceHelper; import kd.bos.servicehelper.operation.SaveServiceHelper; import kd.sdk.plugin.Plugin; import shjh.jhzj7.fi.fi.utils.EsbUtils; @@ -73,6 +75,7 @@ public class SupplierInitOperation extends AbstractOperationServicePlugIn implem JSONObject json_bank; Long currentSupId; DynamicObject suppliergroupdetail; + OperateOption oop = OperateOption.create(); Map cusids = new HashMap<>();//供应商编号和ID对应关系 for (int i = 0; i < detailsJson.size(); i++) { json_body = detailsJson.getJSONObject(i); @@ -115,7 +118,7 @@ public class SupplierInitOperation extends AbstractOperationServicePlugIn implem currentSup.set("source","SELF");//来源 默认自建 currentSup.set("ctrlstrategy","1");//控制策略 默认逐级分配 currentSup.set("group",suptype.getLong("id"));//供应商分组 - currentSup.set("bitindex",6);//位图 +// currentSup.set("bitindex",6);//位图 currentSup.set("supplier_status",EsbUtils.SUPPLIERSTATUS);//供应商状态 默认合格 //设置id和masterid 不然不能进行分配动作 currentSupId = ID.genLongId(); @@ -179,9 +182,9 @@ public class SupplierInitOperation extends AbstractOperationServicePlugIn implem } //处理 sap公司信息 结算方式 统驭科目 handleSAPCompany(companysJson,currentSup.getDynamicObjectCollection("shjh_entry_sap"),supnumber); - //保存供应商 - SaveServiceHelper.save(new DynamicObject[]{currentSup}); -// OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{currentSup}, OperateOption.create()); + //保存供应商-必须调用保存操作,否则不符合受控基础资料开发规范 +// SaveServiceHelper.save(new DynamicObject[]{currentSup}); + OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{currentSup}, oop); cusids.put(supnumber,currentSup.getLong("id")); } diff --git a/main/java/shjh/jhzj7/fi/fi/webapi/AspAccountControler.java b/main/java/shjh/jhzj7/fi/fi/webapi/AspAccountControler.java index 664d4f9..ac76b76 100644 --- a/main/java/shjh/jhzj7/fi/fi/webapi/AspAccountControler.java +++ b/main/java/shjh/jhzj7/fi/fi/webapi/AspAccountControler.java @@ -9,10 +9,9 @@ import com.alibaba.fastjson.util.TypeUtils; import com.drew.lang.annotations.NotNull; import kd.bos.api.client.ApiResult; import kd.bos.context.RequestContext; +import kd.bos.dataentity.OperateOption; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObjectCollection; -import kd.bos.db.DB; -import kd.bos.db.DBRoute; import kd.bos.id.ID; import kd.bos.logging.Log; import kd.bos.logging.LogFactory; @@ -22,7 +21,7 @@ import kd.bos.openapi.common.custom.annotation.ApiRequestBody; import kd.bos.openapi.common.result.CustomApiResult; import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.BusinessDataServiceHelper; -import kd.bos.servicehelper.operation.SaveServiceHelper; +import kd.bos.servicehelper.operation.OperationServiceHelper; import shjh.jhzj7.fi.fi.utils.EsbUtils; import shjh.jhzj7.fi.fi.utils.JhzjUtils; import shjh.jhzj7.fi.fi.webapi.model.AccountModel; @@ -45,7 +44,7 @@ public class AspAccountControler { private static final Map mapObject = new HashMap<>();//公司对象集合 private static final Map hsxmMaps = new HashMap<>();//核算维度对象集合 - private static final String insertSql = "insert into T_BD_Account_U (fdataid,fuseorgid) values (?,?);"; +// private static final String insertSql = "insert into T_BD_Account_U (fdataid,fuseorgid) values (?,?);"; /** * @param bizParam 入参json格式数据 @@ -86,7 +85,7 @@ public class AspAccountControler { DynamicObject acctTypeInfo; DynamicObject parentAcctInfo; JSONObject json_body; - + OperateOption oop = OperateOption.create(); Map acctids = new HashMap<>();//科目编号和ID对应关系 Map accountMaps = new HashMap<>();//将科目编号与对象关联 //先根据基础信息在集团层面生成科目,不考虑核算维度,使用逐级分配 @@ -125,7 +124,7 @@ public class AspAccountControler { acctInfo.set("enable", 0);//科目禁用处理 acctInfo.set("name", name); acctInfo.set("fullname", name); - SaveServiceHelper.save(new DynamicObject[]{acctInfo}); + OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{acctInfo}, oop); } }else{ acctTypeInfo = BusinessDataServiceHelper.loadSingleFromCache(acctTypeName,new QFilter[]{new QFilter("number","=",acctType)}); @@ -181,9 +180,10 @@ public class AspAccountControler { acctInfo.set("id", kmId); acctInfo.set("masterid", kmId);//主数据内码,系统不会根据id自动生成,需要手动设置 //保存数据:直接保存入库,不走操作校验 - SaveServiceHelper.save(new DynamicObject[]{acctInfo}); +// SaveServiceHelper.save(new DynamicObject[]{acctInfo}); + OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{acctInfo}, oop); //处理科目使用范围 - DB.update(DBRoute.of("fi"), insertSql, new Object[]{kmId,JhzjUtils.GROUPID}); +// DB.update(DBRoute.of("fi"), insertSql, new Object[]{kmId,JhzjUtils.GROUPID}); } acctids.put(number,acctInfo.getLong("id")); accountMaps.put(number,acctInfo); @@ -250,7 +250,8 @@ public class AspAccountControler { checkitementryInfo.set("isrequire", false);//必录 } acctInfo.set("isassist", true);//主表的isassist是否包含核算项目为是 - SaveServiceHelper.save(new DynamicObject[]{acctInfo}); +// SaveServiceHelper.save(new DynamicObject[]{acctInfo}); + OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{acctInfo}, oop); companyAcctMaps.put(number+companynum,acctInfo); } } @@ -387,9 +388,10 @@ public class AspAccountControler { //手动指定科目的金蝶id newAcctInfo.set("id", ID.genLongId()); newAcctInfo.set("masterid", olddo.getLong("id"));//主数据内码,系统不会根据id自动生成,需要手动设置 - SaveServiceHelper.save(new DynamicObject[]{newAcctInfo}); +// SaveServiceHelper.save(new DynamicObject[]{newAcctInfo}); + OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{newAcctInfo}, OperateOption.create()); //处理科目使用范围 - DB.update(DBRoute.of("fi"), insertSql, new Object[]{newAcctInfo.getLong("id"),hsorgInfo.getLong("id")}); +// DB.update(DBRoute.of("fi"), insertSql, new Object[]{newAcctInfo.getLong("id"),hsorgInfo.getLong("id")}); return newAcctInfo; } @@ -476,9 +478,10 @@ public class AspAccountControler { acctInfo.set("id", kmId); acctInfo.set("masterid", kmId);//主数据内码,系统不会根据id自动生成,需要手动设置 //保存数据:直接保存入库,不走操作校验 - SaveServiceHelper.save(new DynamicObject[]{acctInfo}); +// SaveServiceHelper.save(new DynamicObject[]{acctInfo}); + OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{acctInfo}, OperateOption.create()); //处理科目使用范围 - DB.update(DBRoute.of("fi"), insertSql, new Object[]{kmId,JhzjUtils.GROUPID}); +// DB.update(DBRoute.of("fi"), insertSql, new Object[]{kmId,JhzjUtils.GROUPID}); } return acctInfo; } diff --git a/main/java/shjh/jhzj7/fi/fi/webapi/CostCenterControler.java b/main/java/shjh/jhzj7/fi/fi/webapi/CostCenterControler.java index 523a91b..3877be2 100644 --- a/main/java/shjh/jhzj7/fi/fi/webapi/CostCenterControler.java +++ b/main/java/shjh/jhzj7/fi/fi/webapi/CostCenterControler.java @@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONObject; import com.drew.lang.annotations.NotNull; import kd.bos.api.client.ApiResult; import kd.bos.context.RequestContext; +import kd.bos.dataentity.OperateOption; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.id.ID; import kd.bos.logging.Log; @@ -18,7 +19,7 @@ import kd.bos.openapi.common.result.CustomApiResult; import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.QueryServiceHelper; -import kd.bos.servicehelper.operation.SaveServiceHelper; +import kd.bos.servicehelper.operation.OperationServiceHelper; import shjh.jhzj7.fi.fi.utils.EsbUtils; import shjh.jhzj7.fi.fi.webapi.model.CostCenterModel; @@ -69,6 +70,7 @@ public class CostCenterControler { DynamicObject currentOrg; DynamicObject companyInfo; JSONObject json_body; + OperateOption oop = OperateOption.create(); for (int i = 0; i < detailsJson.size(); i++) { json_body = detailsJson.getJSONObject(i); orgNumber = json_body.getString("code");//成本中心编号 @@ -140,7 +142,9 @@ public class CostCenterControler { if("X".equals(json_body.getString("sjcjcb"))){ currentOrg.set("enable",0); } - SaveServiceHelper.save(new DynamicObject[]{currentOrg}); + //保存成本中心-必须调用保存操作,否则不符合受控基础资料开发规范 +// SaveServiceHelper.save(new DynamicObject[]{currentOrg}); + OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{currentOrg}, oop); // itemInfo = new JSONObject(); // itemInfo.put("pkId",orgNumber); // itemInfo.put("status","1"); diff --git a/main/java/shjh/jhzj7/fi/fi/webapi/CustomerControler.java b/main/java/shjh/jhzj7/fi/fi/webapi/CustomerControler.java index 939c3fb..a33552c 100644 --- a/main/java/shjh/jhzj7/fi/fi/webapi/CustomerControler.java +++ b/main/java/shjh/jhzj7/fi/fi/webapi/CustomerControler.java @@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONObject; import com.drew.lang.annotations.NotNull; import kd.bos.api.client.ApiResult; import kd.bos.context.RequestContext; +import kd.bos.dataentity.OperateOption; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObjectCollection; import kd.bos.id.ID; @@ -18,6 +19,7 @@ import kd.bos.openapi.common.custom.annotation.ApiRequestBody; import kd.bos.openapi.common.result.CustomApiResult; import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.bos.servicehelper.operation.OperationServiceHelper; import kd.bos.servicehelper.operation.SaveServiceHelper; import shjh.jhzj7.fi.fi.utils.EsbUtils; import shjh.jhzj7.fi.fi.utils.JhzjUtils; @@ -75,7 +77,7 @@ public class CustomerControler { Long currentSupId; DynamicObject custgroupdetail; Map cusids = new HashMap<>();//客户编号和ID对应关系 - + OperateOption oop = OperateOption.create(); for (int i = 0; i < detailsJson.size(); i++) { json_body = detailsJson.getJSONObject(i); cusnumber = json_body.getString("code"); @@ -117,7 +119,7 @@ public class CustomerControler { currentCus.set("org", JhzjUtils.GROUPID);//管理组织 默认为集团 currentCus.set("ctrlstrategy","1");//控制策略 默认逐级分配1 自由分配2 currentCus.set("group",custype.getLong("id"));//客户分组 - currentCus.set("bitindex",1);//位图 +// currentCus.set("bitindex",1);//位图 currentCus.set("customerstatus",EsbUtils.CUSTOMERSTATUS);//客户状态 currentCus.set("name",cusname);//客户名称 currentCus.set("tx_register_no",taxno);//税务登记号 @@ -138,7 +140,9 @@ public class CustomerControler { //处理 客户组5 handleFive(customerfivesJson,currentCus.getDynamicObjectCollection("shjh_entry_five"),cusnumber); - SaveServiceHelper.save(new DynamicObject[]{currentCus}); + //保存客户-必须调用保存操作,否则不符合受控基础资料开发规范 +// SaveServiceHelper.save(new DynamicObject[]{currentCus}); + OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{currentCus}, oop); //处理分类 custgroupdetail = BusinessDataServiceHelper.newDynamicObject(gdName); custgroupdetail.set("createorg",JhzjUtils.GROUPID);//创建组织 @@ -160,7 +164,7 @@ public class CustomerControler { if(!"M400".equals(type)){ handleBank(banksJson,currentCus.getDynamicObjectCollection("entry_bank"),cusnumber,cusname); } - SaveServiceHelper.save(new DynamicObject[]{currentCus}); + OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{currentCus}, oop); } cusids.put(cusnumber,currentSupId); } diff --git a/main/java/shjh/jhzj7/fi/fi/webapi/SupplierControler.java b/main/java/shjh/jhzj7/fi/fi/webapi/SupplierControler.java index e447913..540bb8e 100644 --- a/main/java/shjh/jhzj7/fi/fi/webapi/SupplierControler.java +++ b/main/java/shjh/jhzj7/fi/fi/webapi/SupplierControler.java @@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONObject; import com.drew.lang.annotations.NotNull; import kd.bos.api.client.ApiResult; import kd.bos.context.RequestContext; +import kd.bos.dataentity.OperateOption; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObjectCollection; import kd.bos.id.ID; @@ -18,6 +19,7 @@ import kd.bos.openapi.common.custom.annotation.ApiRequestBody; import kd.bos.openapi.common.result.CustomApiResult; import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.bos.servicehelper.operation.OperationServiceHelper; import kd.bos.servicehelper.operation.SaveServiceHelper; import shjh.jhzj7.fi.fi.utils.EsbUtils; import shjh.jhzj7.fi.fi.utils.JhzjUtils; @@ -81,6 +83,7 @@ public class SupplierControler { DynamicObject suppliergroupdetail; // DynamicObject parterInfo; Map cusids = new HashMap<>();//供应商编号和ID对应关系 + OperateOption oop = OperateOption.create(); for (int i = 0; i < detailsJson.size(); i++) { json_body = detailsJson.getJSONObject(i); supnumber = json_body.getString("code"); @@ -122,7 +125,7 @@ public class SupplierControler { currentSup.set("source","SELF");//来源 默认自建 currentSup.set("ctrlstrategy","1");//控制策略 默认逐级分配 currentSup.set("group",suptype.getLong("id"));//供应商分组 - currentSup.set("bitindex",6);//位图 +// currentSup.set("bitindex",6);//位图 currentSup.set("supplier_status",EsbUtils.SUPPLIERSTATUS);//供应商状态 默认合格 //设置id和masterid 不然不能进行分配动作 currentSupId = ID.genLongId(); @@ -205,8 +208,9 @@ public class SupplierControler { } //处理 sap公司信息 结算方式 统驭科目 handleSAPCompany(companysJson,currentSup.getDynamicObjectCollection("shjh_entry_sap"),supnumber); - //保存供应商 - SaveServiceHelper.save(new DynamicObject[]{currentSup}); + //保存供应商-必须调用保存操作,否则不符合受控基础资料开发规范 +// SaveServiceHelper.save(new DynamicObject[]{currentSup}); + OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{currentSup}, oop); cusids.put(supnumber,currentSup.getLong("id")); //处理商务伙伴,先判断是否已经生成了伙伴,没有则新增一个伙伴 // parterInfo = BusinessDataServiceHelper.loadSingle(parterName,new QFilter[]{new QFilter("number","=",supnumber)});