成本中心核算组织、长名称和长编号

This commit is contained in:
yuxueliang0813 2025-06-12 16:49:00 +08:00
parent c893e040bc
commit 955b284593
1 changed files with 6 additions and 8 deletions

View File

@ -7,9 +7,7 @@ import com.alibaba.fastjson.JSONObject;
import com.drew.lang.annotations.NotNull; import com.drew.lang.annotations.NotNull;
import kd.bos.api.client.ApiResult; import kd.bos.api.client.ApiResult;
import kd.bos.context.RequestContext; import kd.bos.context.RequestContext;
import kd.bos.dataentity.OperateOption;
import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.entity.operate.result.OperationResult;
import kd.bos.id.ID; import kd.bos.id.ID;
import kd.bos.logging.Log; import kd.bos.logging.Log;
import kd.bos.logging.LogFactory; import kd.bos.logging.LogFactory;
@ -19,7 +17,6 @@ import kd.bos.openapi.common.custom.annotation.ApiRequestBody;
import kd.bos.openapi.common.result.CustomApiResult; import kd.bos.openapi.common.result.CustomApiResult;
import kd.bos.orm.query.QFilter; import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.QueryServiceHelper;
import kd.bos.servicehelper.operation.SaveServiceHelper; import kd.bos.servicehelper.operation.SaveServiceHelper;
import shjh.jhzj7.fi.fi.utils.EsbUtils; import shjh.jhzj7.fi.fi.utils.EsbUtils;
import shjh.jhzj7.fi.fi.webapi.model.CostCenterModel; import shjh.jhzj7.fi.fi.webapi.model.CostCenterModel;
@ -72,8 +69,8 @@ public class CostCenterControler {
DynamicObject currentOrg; DynamicObject currentOrg;
DynamicObject companyInfo; DynamicObject companyInfo;
JSONObject json_body; JSONObject json_body;
OperateOption oop = OperateOption.create(); // OperateOption oop = OperateOption.create();
OperationResult operResult; // OperationResult operResult;
for (int i = 0; i < detailsJson.size(); i++) { for (int i = 0; i < detailsJson.size(); i++) {
json_body = detailsJson.getJSONObject(i); json_body = detailsJson.getJSONObject(i);
orgNumber = json_body.getString("code");//成本中心编号 orgNumber = json_body.getString("code");//成本中心编号
@ -105,7 +102,8 @@ public class CostCenterControler {
currentOrg = BusinessDataServiceHelper.newDynamicObject(entityName); currentOrg = BusinessDataServiceHelper.newDynamicObject(entityName);
currentOrg.set("number",orgNumber); currentOrg.set("number",orgNumber);
//处理所属公司 //处理所属公司
companyInfo = QueryServiceHelper.queryOne(orgEntName,"id,number",new QFilter[]{new QFilter("number","=",company)}); // companyInfo = QueryServiceHelper.queryOne(orgEntName,"id,number",new QFilter[]{new QFilter("number","=",company)});
companyInfo = BusinessDataServiceHelper.loadSingle(orgEntName,new QFilter[]{new QFilter("number","=",company)});
if(companyInfo == null){ if(companyInfo == null){
log.error(String.format("根据所属公司编号未在金蝶中找到对应公司:%s", company)); log.error(String.format("根据所属公司编号未在金蝶中找到对应公司:%s", company));
itemInfo = new JSONObject(); itemInfo = new JSONObject();
@ -124,7 +122,7 @@ public class CostCenterControler {
//处理长编号和长名称 //处理长编号和长名称
if(parentOrg != null){ if(parentOrg != null){
currentOrg.set("parent",parentOrg);//父级 currentOrg.set("parent",parentOrg);//父级
// currentOrg.set("longnumber",parentOrg.getString("number")+"."+orgNumber); currentOrg.set("longnumber",parentOrg.getString("number")+"."+orgNumber);
}else{ }else{
currentOrg.set("longnumber",orgNumber); currentOrg.set("longnumber",orgNumber);
} }
@ -137,7 +135,7 @@ public class CostCenterControler {
currentOrg.set("orgduty",getDuty(typeNum));//类型 currentOrg.set("orgduty",getDuty(typeNum));//类型
currentOrg.set("shjh_comids",json_body.getString("other_company"));//跨公司ID currentOrg.set("shjh_comids",json_body.getString("other_company"));//跨公司ID
if(parentOrg != null){ if(parentOrg != null){
// currentOrg.set("fullname",parentOrg.getString("name")+"."+orgName); currentOrg.set("fullname",parentOrg.getString("name")+"."+orgName);
}else{ }else{
currentOrg.set("fullname",orgName); currentOrg.set("fullname",orgName);
} }