会计科目直接存库,不走保存操作
This commit is contained in:
parent
a216e84095
commit
b9db1f424c
|
|
@ -20,7 +20,6 @@ import kd.bos.logging.Log;
|
||||||
import kd.bos.logging.LogFactory;
|
import kd.bos.logging.LogFactory;
|
||||||
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.operation.OperationServiceHelper;
|
|
||||||
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.utils.JhzjUtils;
|
import shjh.jhzj7.fi.fi.utils.JhzjUtils;
|
||||||
|
|
@ -48,7 +47,7 @@ public class InitAccountFormPlugin extends AbstractFormPlugin {
|
||||||
Map<String, DynamicObject> accountMaps = new HashMap<>();//将科目编号与对象关联
|
Map<String, DynamicObject> accountMaps = new HashMap<>();//将科目编号与对象关联
|
||||||
Map<String, DynamicObject> parentMaps = new HashMap<>();//将父级科目编号与对象关联
|
Map<String, DynamicObject> parentMaps = new HashMap<>();//将父级科目编号与对象关联
|
||||||
|
|
||||||
private DynamicObject grouporginfo = EsbUtils.getGroupOrg();//获取默认科目表
|
private DynamicObject grouporginfo = EsbUtils.getGroupOrg();//获取默认组织
|
||||||
DynamicObject tableinfo = EsbUtils.getTable();//获取默认科目表
|
DynamicObject tableinfo = EsbUtils.getTable();//获取默认科目表
|
||||||
|
|
||||||
private DynamicObject getParentAcct(String number,String name,String acctType,DynamicObject acctTypeInfo){
|
private DynamicObject getParentAcct(String number,String name,String acctType,DynamicObject acctTypeInfo){
|
||||||
|
|
@ -99,10 +98,10 @@ public class InitAccountFormPlugin extends AbstractFormPlugin {
|
||||||
acctInfo.set("id", kmId);
|
acctInfo.set("id", kmId);
|
||||||
acctInfo.set("masterid", kmId);//主数据内码,系统不会根据id自动生成,需要手动设置
|
acctInfo.set("masterid", kmId);//主数据内码,系统不会根据id自动生成,需要手动设置
|
||||||
//必须调用保存操作,否则不符合受控基础资料开发规范
|
//必须调用保存操作,否则不符合受控基础资料开发规范
|
||||||
// SaveServiceHelper.save(new DynamicObject[]{acctInfo});
|
SaveServiceHelper.save(new DynamicObject[]{acctInfo});
|
||||||
OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{acctInfo}, OperateOption.create());
|
// 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);
|
parentMaps.put(parentnumber,acctInfo);
|
||||||
}
|
}
|
||||||
return parentMaps.get(parentnumber);
|
return parentMaps.get(parentnumber);
|
||||||
|
|
@ -196,10 +195,10 @@ public class InitAccountFormPlugin extends AbstractFormPlugin {
|
||||||
acctInfo.set("id", kmId);
|
acctInfo.set("id", kmId);
|
||||||
acctInfo.set("masterid", kmId);//主数据内码,系统不会根据id自动生成,需要手动设置
|
acctInfo.set("masterid", kmId);//主数据内码,系统不会根据id自动生成,需要手动设置
|
||||||
//必须调用保存操作,否则不符合受控基础资料开发规范
|
//必须调用保存操作,否则不符合受控基础资料开发规范
|
||||||
// SaveServiceHelper.save(new DynamicObject[]{acctInfo});
|
SaveServiceHelper.save(new DynamicObject[]{acctInfo});
|
||||||
OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{acctInfo}, oop);
|
// 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"));
|
acctids.put(number,acctInfo.getLong("id"));
|
||||||
accountMaps.put(number,acctInfo);
|
accountMaps.put(number,acctInfo);
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,10 @@ import com.alibaba.fastjson.util.TypeUtils;
|
||||||
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.dataentity.entity.DynamicObjectCollection;
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
import kd.bos.db.DB;
|
import kd.bos.db.DB;
|
||||||
import kd.bos.db.DBRoute;
|
import kd.bos.db.DBRoute;
|
||||||
import kd.bos.entity.operate.OperateOptionConst;
|
|
||||||
import kd.bos.entity.operate.result.OperationResult;
|
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;
|
||||||
|
|
@ -25,7 +23,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.operation.OperationServiceHelper;
|
|
||||||
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.utils.JhzjUtils;
|
import shjh.jhzj7.fi.fi.utils.JhzjUtils;
|
||||||
|
|
@ -92,8 +89,8 @@ public class AspAccountControler {
|
||||||
DynamicObject acctTypeInfo;
|
DynamicObject acctTypeInfo;
|
||||||
DynamicObject parentAcctInfo;
|
DynamicObject parentAcctInfo;
|
||||||
JSONObject json_body;
|
JSONObject json_body;
|
||||||
OperateOption oop = OperateOption.create();
|
// OperateOption oop = OperateOption.create();
|
||||||
oop.setVariableValue(OperateOptionConst.IGNOREWARN, String.valueOf(false)); // 不执行警告级别校验器
|
// oop.setVariableValue(OperateOptionConst.IGNOREWARN, String.valueOf(false)); // 不执行警告级别校验器
|
||||||
OperationResult operResult;
|
OperationResult operResult;
|
||||||
Map<String, Long> acctids = new HashMap<>();//科目编号和ID对应关系
|
Map<String, Long> acctids = new HashMap<>();//科目编号和ID对应关系
|
||||||
Map<String, DynamicObject> accountMaps = new HashMap<>();//将科目编号与对象关联
|
Map<String, DynamicObject> accountMaps = new HashMap<>();//将科目编号与对象关联
|
||||||
|
|
@ -134,7 +131,8 @@ public class AspAccountControler {
|
||||||
acctInfo.set("enable", 0);//科目禁用处理
|
acctInfo.set("enable", 0);//科目禁用处理
|
||||||
acctInfo.set("name", name);
|
acctInfo.set("name", name);
|
||||||
// acctInfo.set("fullname", name);
|
// acctInfo.set("fullname", name);
|
||||||
OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{acctInfo}, oop);
|
SaveServiceHelper.save(new DynamicObject[]{acctInfo});
|
||||||
|
// OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{acctInfo}, oop);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
acctTypeInfo = BusinessDataServiceHelper.loadSingleFromCache(acctTypeName,new QFilter[]{new QFilter("number","=",acctType)});
|
acctTypeInfo = BusinessDataServiceHelper.loadSingleFromCache(acctTypeName,new QFilter[]{new QFilter("number","=",acctType)});
|
||||||
|
|
@ -197,17 +195,17 @@ public class AspAccountControler {
|
||||||
acctInfo.set("id", kmId);
|
acctInfo.set("id", kmId);
|
||||||
acctInfo.set("masterid", kmId);//主数据内码,系统不会根据id自动生成,需要手动设置
|
acctInfo.set("masterid", kmId);//主数据内码,系统不会根据id自动生成,需要手动设置
|
||||||
//保存数据:直接保存入库,不走操作校验
|
//保存数据:直接保存入库,不走操作校验
|
||||||
// SaveServiceHelper.save(new DynamicObject[]{acctInfo});
|
SaveServiceHelper.save(new DynamicObject[]{acctInfo});
|
||||||
operResult = OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{acctInfo}, oop);
|
// operResult = OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{acctInfo}, oop);
|
||||||
if(!operResult.isSuccess()){
|
// if(!operResult.isSuccess()){
|
||||||
log.error(String.format("科目保存失败:%s", json_body.toJSONString()));
|
// log.error(String.format("科目保存失败:%s", json_body.toJSONString()));
|
||||||
itemInfo = new JSONObject();
|
// itemInfo = new JSONObject();
|
||||||
itemInfo.put("code",number);
|
// itemInfo.put("code",number);
|
||||||
itemInfo.put("error","科目保存失败"+operResult.getMessage());
|
// itemInfo.put("error","科目保存失败"+operResult.getMessage());
|
||||||
itemsJson.add(itemInfo);
|
// itemsJson.add(itemInfo);
|
||||||
}
|
// }
|
||||||
//处理科目使用范围
|
//处理科目使用范围
|
||||||
// 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"));
|
acctids.put(number,acctInfo.getLong("id"));
|
||||||
accountMaps.put(number,acctInfo);
|
accountMaps.put(number,acctInfo);
|
||||||
|
|
@ -523,14 +521,14 @@ public class AspAccountControler {
|
||||||
acctInfo.set("id", kmId);
|
acctInfo.set("id", kmId);
|
||||||
acctInfo.set("masterid", kmId);//主数据内码,系统不会根据id自动生成,需要手动设置
|
acctInfo.set("masterid", kmId);//主数据内码,系统不会根据id自动生成,需要手动设置
|
||||||
//保存数据:直接保存入库,不走操作校验
|
//保存数据:直接保存入库,不走操作校验
|
||||||
// SaveServiceHelper.save(new DynamicObject[]{acctInfo});
|
SaveServiceHelper.save(new DynamicObject[]{acctInfo});
|
||||||
OperationResult operResult = OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{acctInfo}, OperateOption.create());
|
// OperationResult operResult = OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{acctInfo}, OperateOption.create());
|
||||||
if(!operResult.isSuccess()){
|
// if(!operResult.isSuccess()){
|
||||||
log.error(String.format(number+"父级科目保存失败:%s", operResult.getMessage()));
|
// log.error(String.format(number+"父级科目保存失败:%s", operResult.getMessage()));
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
//处理科目使用范围
|
//处理科目使用范围
|
||||||
// DB.update(DBRoute.of("fi"), insertSql, new Object[]{kmId,JhzjUtils.GROUPID});
|
DB.update(DBRoute.of("fi"), insertSql, new Object[]{kmId,JhzjUtils.GROUPID});
|
||||||
}
|
}
|
||||||
return acctInfo;
|
return acctInfo;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue