会计科目接口优化组织范围问题

This commit is contained in:
yuxueliang0813 2025-06-15 11:20:37 +08:00
parent acd2b39595
commit 7cb9b432a2
1 changed files with 8 additions and 2 deletions

View File

@ -13,7 +13,6 @@ 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.entity.operate.result.OperationResult;
import kd.bos.id.ID;
import kd.bos.logging.Log;
import kd.bos.logging.LogFactory;
@ -49,6 +48,7 @@ public class AspAccountControler {
DynamicObject tableinfo = EsbUtils.getTable();//获取默认科目表
private static final String insertSql = "insert into T_BD_Account_U (fdataid,fuseorgid) values (?,?);";
private static final String deleteOrgSql = "delete T_BD_Account_U where fdataid in(select fdataid from T_BD_Account_U where fuseorgid=100000) and fuseorgid<>100000;";
/**
* @param bizParam 入参json格式数据
@ -91,9 +91,10 @@ public class AspAccountControler {
JSONObject json_body;
// OperateOption oop = OperateOption.create();
// oop.setVariableValue(OperateOptionConst.IGNOREWARN, String.valueOf(false)); // 不执行警告级别校验器
OperationResult operResult;
// OperationResult operResult;
Map<String, Long> acctids = new HashMap<>();//科目编号和ID对应关系
Map<String, DynamicObject> accountMaps = new HashMap<>();//将科目编号与对象关联
boolean isIncludNew = false;//本次请求是否有新增科目的标记
//先根据基础信息在集团层面生成科目不考虑核算维度使用逐级分配
//再根据公司信息进行科目分配
@ -206,6 +207,7 @@ public class AspAccountControler {
// }
//处理科目使用范围
DB.update(DBRoute.of("fi"), insertSql, new Object[]{kmId,JhzjUtils.GROUPID});
isIncludNew = true;
}
acctids.put(number,acctInfo.getLong("id"));
accountMaps.put(number,acctInfo);
@ -285,6 +287,10 @@ public class AspAccountControler {
}
//最后处理科目的反分配
EsbUtils.handleUnAssignNew(companysJson, acctids, entityName);
//本次包含新增科目的话需要处理一下组织范围集团科目会在下级公司也生成一个范围需要去掉
if(isIncludNew){
DB.update(DBRoute.of("fi"), deleteOrgSql, null);
}
if(itemsJson.isEmpty()){
EsbUtils.saveLog(apimenthod,"ESB",json_obj.toString(),null,true,"API");