部门接口
This commit is contained in:
parent
1d6f17330b
commit
d11f5895dd
|
|
@ -2,6 +2,7 @@ package shjh.jhzj7.fi.fi.plugin.form;
|
||||||
|
|
||||||
import kd.bos.entity.filter.ControlFilters;
|
import kd.bos.entity.filter.ControlFilters;
|
||||||
import kd.bos.form.events.SetFilterEvent;
|
import kd.bos.form.events.SetFilterEvent;
|
||||||
|
import kd.bos.list.IListView;
|
||||||
import kd.bos.list.plugin.AbstractListPlugin;
|
import kd.bos.list.plugin.AbstractListPlugin;
|
||||||
import kd.bos.orm.query.QFilter;
|
import kd.bos.orm.query.QFilter;
|
||||||
|
|
||||||
|
|
@ -16,16 +17,20 @@ public class TestSupplierListPlugin extends AbstractListPlugin {
|
||||||
@Override
|
@Override
|
||||||
public void setFilter(SetFilterEvent e) {
|
public void setFilter(SetFilterEvent e) {
|
||||||
super.setFilter(e);
|
super.setFilter(e);
|
||||||
List<QFilter> lqs = e.getQFilters();
|
// List<QFilter> lqs = e.getQFilters();
|
||||||
for (int i = 0; i < lqs.size(); i++) {
|
// for (int i = 0; i < lqs.size(); i++) {
|
||||||
QFilter qf = lqs.get(i);
|
// QFilter qf = lqs.get(i);
|
||||||
if("ctrlstrategy".equals(qf.getProperty())){
|
// if("ctrlstrategy".equals(qf.getProperty())){
|
||||||
lqs.remove(qf);
|
// lqs.remove(qf);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
lqs.add(new QFilter("createorg.id","=",2116762463713107968l));
|
// ControlFilters cfilters = ((IListView)this.getView()).getControlFilters();
|
||||||
lqs.size();
|
//// cfilters.
|
||||||
|
// lqs.add(new QFilter("createorg.id","=",2116762463713107968l));
|
||||||
|
// lqs.size();
|
||||||
|
// ControlFilters cfilters = ((IListView)this.getView()).getControlFilters();
|
||||||
|
// e.getQFilters().clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -33,6 +38,7 @@ public class TestSupplierListPlugin extends AbstractListPlugin {
|
||||||
return super.getControlFilters();
|
return super.getControlFilters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterBindData(EventObject e) {
|
public void afterBindData(EventObject e) {
|
||||||
super.afterBindData(e);
|
super.afterBindData(e);
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ import kd.bos.servicehelper.QueryServiceHelper;
|
||||||
import kd.bos.servicehelper.org.OrgUnitServiceHelper;
|
import kd.bos.servicehelper.org.OrgUnitServiceHelper;
|
||||||
import kd.bos.servicehelper.org.OrgViewType;
|
import kd.bos.servicehelper.org.OrgViewType;
|
||||||
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.webapi.model.AdminOrgModel;
|
import shjh.jhzj7.fi.fi.webapi.model.AdminOrgModel;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
|
@ -41,7 +42,6 @@ public class AdminOrgControler {
|
||||||
*/
|
*/
|
||||||
@ApiPostMapping(value = apimenthod, desc = "行政组织接口")
|
@ApiPostMapping(value = apimenthod, desc = "行政组织接口")
|
||||||
public CustomApiResult<ApiResult> adminorg_sync (@NotNull @Valid @ApiRequestBody(value="入参json格式") AdminOrgModel bizParam) {
|
public CustomApiResult<ApiResult> adminorg_sync (@NotNull @Valid @ApiRequestBody(value="入参json格式") AdminOrgModel bizParam) {
|
||||||
|
|
||||||
JSONObject json_obj;
|
JSONObject json_obj;
|
||||||
try{
|
try{
|
||||||
//解析入参,如果格式不正确,日志记录,并反馈esb
|
//解析入参,如果格式不正确,日志记录,并反馈esb
|
||||||
|
|
@ -58,8 +58,8 @@ public class AdminOrgControler {
|
||||||
JSONArray itemsJson = new JSONArray();//返回值明细集合
|
JSONArray itemsJson = new JSONArray();//返回值明细集合
|
||||||
JSONObject itemInfo;//返回值明细对象
|
JSONObject itemInfo;//返回值明细对象
|
||||||
JSONArray detailsJson = json_obj.getJSONArray("items");
|
JSONArray detailsJson = json_obj.getJSONArray("items");
|
||||||
//处理入参的排序,按照deptLevel正序
|
// //处理入参的排序,按照deptLevel正序
|
||||||
detailsJson.sort(Comparator.comparingInt(json -> ((JSONObject) json).getIntValue("deptLevel")));
|
// detailsJson.sort(Comparator.comparing(json -> ((JSONObject) json).getString("deptLevel")));
|
||||||
String orgNumber;
|
String orgNumber;
|
||||||
String orgName;
|
String orgName;
|
||||||
String fycc;
|
String fycc;
|
||||||
|
|
@ -76,17 +76,22 @@ public class AdminOrgControler {
|
||||||
OrgDutyView dutyView;
|
OrgDutyView dutyView;
|
||||||
String handleResult;
|
String handleResult;
|
||||||
JSONObject json_body;
|
JSONObject json_body;
|
||||||
|
//MDM目前设置了A-H级
|
||||||
|
String[] levelStr = new String[]{"A","B","C","D","E","F","G","H"};
|
||||||
|
for (int j = 0; j < levelStr.length; j++) {
|
||||||
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);
|
||||||
|
orgLevel = json_body.getString("deptLevel");//组织层级
|
||||||
|
if(!levelStr[j].equals(orgLevel)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
orgNumber = json_body.getString("code");
|
orgNumber = json_body.getString("code");
|
||||||
orgName = json_body.getString("categoryName");
|
orgName = json_body.getString("categoryName");
|
||||||
fycc = json_body.getString("fee_cost_center");//费用成本中心
|
fycc = json_body.getString("fee_cost_center");//费用成本中心
|
||||||
parentCode = json_body.getString("parentCode");//上级组织编号
|
parentCode = json_body.getString("parentCode");//上级组织编号
|
||||||
person_charge = json_body.getString("deptManager");//部门负责人编号
|
person_charge = json_body.getString("deptManager");//部门负责人编号
|
||||||
orgLevel = json_body.getString("deptLevel");//组织层级
|
|
||||||
company = json_body.getString("company");//所属公司编号
|
company = json_body.getString("company");//所属公司编号
|
||||||
if(EsbUtils.isEmpty(orgNumber) || EsbUtils.isEmpty(orgName) || EsbUtils.isEmpty(orgLevel) ||
|
if(EsbUtils.isEmpty(orgNumber) || EsbUtils.isEmpty(orgName) || (j>=1 && EsbUtils.isEmpty(parentCode))){
|
||||||
(Integer.parseInt(orgLevel)>1 && EsbUtils.isEmpty(parentCode))){
|
|
||||||
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",orgNumber);
|
itemInfo.put("code",orgNumber);
|
||||||
|
|
@ -103,7 +108,7 @@ public class AdminOrgControler {
|
||||||
param.setSimpleName(json_body.getString("deptshortname"));//组织简称
|
param.setSimpleName(json_body.getString("deptshortname"));//组织简称
|
||||||
//处理上级组织
|
//处理上级组织
|
||||||
parentOrg = QueryServiceHelper.queryOne(entityName,"id,number",new QFilter[]{new QFilter("number","=",parentCode)});
|
parentOrg = QueryServiceHelper.queryOne(entityName,"id,number",new QFilter[]{new QFilter("number","=",parentCode)});
|
||||||
if(parentOrg == null && Integer.parseInt(orgLevel)>1){
|
if(parentOrg == null && j>=1){
|
||||||
log.error(String.format("根据父级行政组织编号未在金蝶中找到对应组织:%s", parentCode));
|
log.error(String.format("根据父级行政组织编号未在金蝶中找到对应组织:%s", parentCode));
|
||||||
itemInfo = new JSONObject();
|
itemInfo = new JSONObject();
|
||||||
itemInfo.put("code",orgNumber);
|
itemInfo.put("code",orgNumber);
|
||||||
|
|
@ -113,10 +118,13 @@ public class AdminOrgControler {
|
||||||
}
|
}
|
||||||
propertyMap.clear();
|
propertyMap.clear();
|
||||||
//处理费用成本中心
|
//处理费用成本中心
|
||||||
|
if(!EsbUtils.isEmpty(fycc)){
|
||||||
costCenter = QueryServiceHelper.queryOne(ccName,"id,number",new QFilter[]{new QFilter("number","=",fycc)});
|
costCenter = QueryServiceHelper.queryOne(ccName,"id,number",new QFilter[]{new QFilter("number","=",fycc)});
|
||||||
if(costCenter != null){
|
if(costCenter != null){
|
||||||
propertyMap.put("shjh_fycc", costCenter.getLong("id"));//设置成本中心ID
|
propertyMap.put("shjh_fycc", costCenter.getLong("id"));//设置成本中心ID
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
propertyMap.put("shjh_ssgs", company);//设置所属公司编号
|
propertyMap.put("shjh_ssgs", company);//设置所属公司编号
|
||||||
propertyMap.put("shjh_deptmanager", person_charge);//设置部门负责人编号
|
propertyMap.put("shjh_deptmanager", person_charge);//设置部门负责人编号
|
||||||
//处理禁用组织
|
//处理禁用组织
|
||||||
|
|
@ -128,7 +136,12 @@ public class AdminOrgControler {
|
||||||
currentOrg = QueryServiceHelper.queryOne(entityName,"id,number",new QFilter[]{new QFilter("number","=",orgNumber)});
|
currentOrg = QueryServiceHelper.queryOne(entityName,"id,number",new QFilter[]{new QFilter("number","=",orgNumber)});
|
||||||
if(currentOrg == null){
|
if(currentOrg == null){
|
||||||
//新增组织
|
//新增组织
|
||||||
|
if("A".equals(orgLevel)){
|
||||||
|
//如果是A 第一级 则上级为组织的根节点
|
||||||
|
param.setParentId(JhzjUtils.GROUPID);
|
||||||
|
}else{
|
||||||
param.setParentId(parentOrg.getLong("id"));//上级组织的金蝶ID
|
param.setParentId(parentOrg.getLong("id"));//上级组织的金蝶ID
|
||||||
|
}
|
||||||
OrgUnitServiceHelper.add(param);
|
OrgUnitServiceHelper.add(param);
|
||||||
}else{
|
}else{
|
||||||
//更新组织
|
//更新组织
|
||||||
|
|
@ -137,7 +150,12 @@ public class AdminOrgControler {
|
||||||
multiViewMap.clear();
|
multiViewMap.clear();
|
||||||
dutyView = new OrgDutyView();
|
dutyView = new OrgDutyView();
|
||||||
//组织移动时,设置新的上级ID
|
//组织移动时,设置新的上级ID
|
||||||
|
if("A".equals(orgLevel)){
|
||||||
|
//如果是A 第一级 则上级为组织的根节点
|
||||||
|
dutyView.setParentId(JhzjUtils.GROUPID);
|
||||||
|
}else{
|
||||||
dutyView.setParentId(parentOrg.getLong("id"));
|
dutyView.setParentId(parentOrg.getLong("id"));
|
||||||
|
}
|
||||||
//行政组织
|
//行政组织
|
||||||
multiViewMap.put(OrgViewType.Admin, dutyView);
|
multiViewMap.put(OrgViewType.Admin, dutyView);
|
||||||
param.setMultiViewMap(multiViewMap);
|
param.setMultiViewMap(multiViewMap);
|
||||||
|
|
@ -152,6 +170,8 @@ public class AdminOrgControler {
|
||||||
itemsJson.add(itemInfo);
|
itemsJson.add(itemInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//返回最终处理结果,如果上述有单个组织处理失败,则总体状态overallStatus是何值?
|
//返回最终处理结果,如果上述有单个组织处理失败,则总体状态overallStatus是何值?
|
||||||
// json_result.put("overallStatus","1");
|
// json_result.put("overallStatus","1");
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,8 @@ import kd.bos.api.client.ApiResult;
|
||||||
import kd.bos.context.RequestContext;
|
import kd.bos.context.RequestContext;
|
||||||
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.DBRoute;
|
||||||
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;
|
||||||
|
|
@ -20,6 +22,7 @@ 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.basedata.BaseDataServiceHelper;
|
||||||
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;
|
||||||
|
|
@ -85,8 +88,12 @@ public class AspAccountControler {
|
||||||
DynamicObjectCollection docbb;
|
DynamicObjectCollection docbb;
|
||||||
DynamicObject bbInfo;
|
DynamicObject bbInfo;
|
||||||
String bbiso;
|
String bbiso;
|
||||||
|
String insertSql = "insert into T_BD_Account_U(fdataid,fuseorgid) values (?,?);";
|
||||||
|
Map<String, Long> acctids = new HashMap<>();//科目编号和ID对应关系
|
||||||
Map<String, DynamicObject> accountMaps = new HashMap<>();//将科目编号与对象关联
|
Map<String, DynamicObject> accountMaps = new HashMap<>();//将科目编号与对象关联
|
||||||
|
//先根据基础信息在集团层面生成科目,不考虑核算维度,使用逐级分配
|
||||||
|
//再根据公司信息进行科目分配
|
||||||
|
//最后处理每个公司下科目的核算维度和禁用状态
|
||||||
for (int i = 0; i < companysJson.size(); i++) {
|
for (int i = 0; i < companysJson.size(); i++) {
|
||||||
company_body = companysJson.getJSONObject(i);
|
company_body = companysJson.getJSONObject(i);
|
||||||
number = company_body.getString("code");
|
number = company_body.getString("code");
|
||||||
|
|
@ -124,8 +131,6 @@ public class AspAccountControler {
|
||||||
if("0".equals(company_body.getString("companystatus")) || "0".equals(json_body.getString("status"))){
|
if("0".equals(company_body.getString("companystatus")) || "0".equals(json_body.getString("status"))){
|
||||||
acctInfo.set("enable", 0);//科目禁用处理
|
acctInfo.set("enable", 0);//科目禁用处理
|
||||||
}
|
}
|
||||||
// acctInfo.set("ctrlstrategy", "7");
|
|
||||||
// acctInfo.set("pltype", getSY(acctType));
|
|
||||||
acctInfo.set("name", name);
|
acctInfo.set("name", name);
|
||||||
acctInfo.set("fullname", name);
|
acctInfo.set("fullname", name);
|
||||||
acctInfo.set("acctcurrency", bbhs);
|
acctInfo.set("acctcurrency", bbhs);
|
||||||
|
|
@ -196,7 +201,7 @@ public class AspAccountControler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
acctInfo.set("ctrlstrategy", "7");//控制策略 5全局共享 7私有
|
acctInfo.set("ctrlstrategy", "1");//控制策略 5全局共享 7私有 1逐级分配
|
||||||
acctInfo.set("control", "nocontrol");//受控系统 nocontrol 无 应付 应收 资产
|
acctInfo.set("control", "nocontrol");//受控系统 nocontrol 无 应付 应收 资产
|
||||||
//损益类型
|
//损益类型
|
||||||
acctInfo.set("pltype", getSY(acctType));
|
acctInfo.set("pltype", getSY(acctType));
|
||||||
|
|
@ -222,10 +227,15 @@ public class AspAccountControler {
|
||||||
acctInfo.set("masterid", kmId);//主数据内码,系统不会根据id自动生成,需要手动设置
|
acctInfo.set("masterid", kmId);//主数据内码,系统不会根据id自动生成,需要手动设置
|
||||||
//保存数据:直接保存入库,不走操作校验
|
//保存数据:直接保存入库,不走操作校验
|
||||||
SaveServiceHelper.save(new DynamicObject[]{acctInfo});
|
SaveServiceHelper.save(new DynamicObject[]{acctInfo});
|
||||||
|
//处理科目使用范围
|
||||||
|
DB.update(DBRoute.of("sys"), insertSql, new Object[]{kmId,JhzjUtils.GROUPID});
|
||||||
}
|
}
|
||||||
accountMaps.put(number+companynum,acctInfo);
|
accountMaps.put(number+companynum,acctInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//处理科目分配
|
||||||
|
EsbUtils.handleAssign(companysJson, acctids, entityName);
|
||||||
|
|
||||||
//处理核算维度
|
//处理核算维度
|
||||||
JSONArray asstacttypesJson = json_obj.getJSONArray("asstacttypes");
|
JSONArray asstacttypesJson = json_obj.getJSONArray("asstacttypes");
|
||||||
String hsxm;//核算维度名称 基础资料
|
String hsxm;//核算维度名称 基础资料
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,9 @@ import java.util.List;
|
||||||
@ApiModel
|
@ApiModel
|
||||||
public class AdminOrgModel implements Serializable {
|
public class AdminOrgModel implements Serializable {
|
||||||
|
|
||||||
@ApiParam(value="批次id",required=true,position=1)
|
@ApiParam(value="批次id",required=false,position=1)
|
||||||
private String batchId;
|
private String batchId;
|
||||||
@ApiParam(value="明细集合",required=true,position=2)
|
@ApiParam(value="明细集合",required=false,position=2)
|
||||||
private List<AdminOrgModel.EntryBean> items;
|
private List<AdminOrgModel.EntryBean> items;
|
||||||
public void setBatchId(String batchId) {
|
public void setBatchId(String batchId) {
|
||||||
this.batchId = batchId;
|
this.batchId = batchId;
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,9 @@ import java.util.List;
|
||||||
@ApiModel
|
@ApiModel
|
||||||
public class CostCenterModel implements Serializable {
|
public class CostCenterModel implements Serializable {
|
||||||
|
|
||||||
@ApiParam(value="批次id",required=true,position=1)
|
@ApiParam(value="批次id",required=false,position=1)
|
||||||
private String batchId;
|
private String batchId;
|
||||||
@ApiParam(value="明细集合",required=true,position=2)
|
@ApiParam(value="明细集合",required=false,position=2)
|
||||||
private List<EntryBean> items;
|
private List<EntryBean> items;
|
||||||
public void setBatchId(String batchId) {
|
public void setBatchId(String batchId) {
|
||||||
this.batchId = batchId;
|
this.batchId = batchId;
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,11 @@ import java.util.List;
|
||||||
@ApiModel
|
@ApiModel
|
||||||
public class PersonModel implements Serializable {
|
public class PersonModel implements Serializable {
|
||||||
|
|
||||||
@ApiParam(value="批次id",required=true,position=1)
|
@ApiParam(value="批次id",required=false,position=1)
|
||||||
private String batchId;
|
private String batchId;
|
||||||
@ApiParam(value="员工类型",required=true,position=2)
|
@ApiParam(value="员工类型",required=false,position=2)
|
||||||
private String staffType;
|
private String staffType;
|
||||||
@ApiParam(value="明细集合",required=true,position=3)
|
@ApiParam(value="明细集合",required=false,position=3)
|
||||||
private List<PersonModel.EntryBean> items;
|
private List<PersonModel.EntryBean> items;
|
||||||
public void setBatchId(String batchId) {
|
public void setBatchId(String batchId) {
|
||||||
this.batchId = batchId;
|
this.batchId = batchId;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue