客商和科目的分配和反分配优化
This commit is contained in:
parent
5232a4b1ac
commit
b38efbc98f
|
|
@ -40,27 +40,8 @@ public class CustomerInitOperation extends AbstractOperationServicePlugIn implem
|
|||
String eok = e.getOperationKey();
|
||||
if("customerinit".equals(eok)){
|
||||
DynamicObject[] dos = e.getDataEntities();
|
||||
DynamicObject pzinfo = BusinessDataServiceHelper.loadSingle(dos[0].getPkValue(), dos[0].getDataEntityType().getName());
|
||||
JSONObject json_obj;
|
||||
try{
|
||||
//解析入参,如果格式不正确,日志记录,并反馈esb
|
||||
json_obj = JSONObject.parseObject(pzinfo.getString("shjh_inputs_tag"));
|
||||
}catch (JSONException e1) {
|
||||
String jsonResult = String.format("客户接口入参异常:%s", e1.getMessage());
|
||||
log.error(jsonResult);
|
||||
addErrorInfo(pzinfo,"接口入参异常"+jsonResult);
|
||||
return;
|
||||
}
|
||||
JSONArray itemsJson = new JSONArray();//返回值明细集合
|
||||
JSONObject itemInfo;//返回值明细对象
|
||||
JSONArray detailsJson = json_obj.getJSONArray("items");//客户基本信息
|
||||
if(detailsJson == null){
|
||||
addErrorInfo(pzinfo,"未识别到items参数");
|
||||
return;
|
||||
}
|
||||
JSONArray banksJson = json_obj.getJSONArray("banks");//客户银行
|
||||
JSONArray companysJson = json_obj.getJSONArray("companys");//客户所属公司
|
||||
JSONArray customerfivesJson = json_obj.getJSONArray("customerfives");//客户组5
|
||||
String cusnumber;
|
||||
String cusname;
|
||||
String taxno;
|
||||
|
|
@ -70,105 +51,126 @@ public class CustomerInitOperation extends AbstractOperationServicePlugIn implem
|
|||
JSONObject json_body;
|
||||
Long currentSupId;
|
||||
DynamicObject custgroupdetail;
|
||||
Map<String, Long> cusids = new HashMap<>();//客户编号和ID对应关系
|
||||
|
||||
for (int i = 0; i < detailsJson.size(); i++) {
|
||||
json_body = detailsJson.getJSONObject(i);
|
||||
cusnumber = json_body.getString("code");
|
||||
cusname = json_body.getString("name");
|
||||
taxno = json_body.getString("taxno");
|
||||
type = json_body.getString("type");
|
||||
|
||||
if(EsbUtils.isEmpty(cusnumber) || EsbUtils.isEmpty(cusname) || EsbUtils.isEmpty(type)){
|
||||
log.error(String.format("客户接口入参为空异常:%s", json_body.toJSONString()));
|
||||
itemInfo = new JSONObject();
|
||||
itemInfo.put("code",cusnumber);
|
||||
itemInfo.put("error","code name type入参值为空");
|
||||
itemsJson.add(itemInfo);
|
||||
for (DynamicObject pzinfo : dos) {
|
||||
pzinfo = BusinessDataServiceHelper.loadSingle(pzinfo.getPkValue(), pzinfo.getDataEntityType().getName());
|
||||
try{
|
||||
//解析入参,如果格式不正确,日志记录,并反馈esb
|
||||
json_obj = JSONObject.parseObject(pzinfo.getString("shjh_inputs_tag"));
|
||||
}catch (JSONException e1) {
|
||||
String jsonResult = String.format("客户接口入参异常:%s", e1.getMessage());
|
||||
log.error(jsonResult);
|
||||
addErrorInfo(pzinfo,"接口入参异常"+jsonResult);
|
||||
continue;
|
||||
}
|
||||
currentCus = BusinessDataServiceHelper.loadSingle(entityName,new QFilter[]{new QFilter("number","=",cusnumber)});
|
||||
if(currentCus == null){
|
||||
//判断客户分类
|
||||
custype = BusinessDataServiceHelper.loadSingleFromCache(cusTypeName,"id,number",new QFilter[]{new QFilter("number","=",type)});
|
||||
if(custype == null){
|
||||
log.error(String.format("客户分类未匹配:%s", json_body.toJSONString()));
|
||||
JSONArray detailsJson = json_obj.getJSONArray("items");//客户基本信息
|
||||
if(detailsJson == null){
|
||||
addErrorInfo(pzinfo,"未识别到items参数");
|
||||
continue;
|
||||
}
|
||||
JSONArray banksJson = json_obj.getJSONArray("banks");//客户银行
|
||||
JSONArray companysJson = json_obj.getJSONArray("companys");//客户所属公司
|
||||
JSONArray customerfivesJson = json_obj.getJSONArray("customerfives");//客户组5
|
||||
Map<String, Long> cusids = new HashMap<>();//客户编号和ID对应关系
|
||||
JSONArray itemsJson = new JSONArray();//返回值明细集合
|
||||
|
||||
for (int i = 0; i < detailsJson.size(); i++) {
|
||||
json_body = detailsJson.getJSONObject(i);
|
||||
cusnumber = json_body.getString("code");
|
||||
cusname = json_body.getString("name");
|
||||
taxno = json_body.getString("taxno");
|
||||
type = json_body.getString("type");
|
||||
|
||||
if(EsbUtils.isEmpty(cusnumber) || EsbUtils.isEmpty(cusname) || EsbUtils.isEmpty(type)){
|
||||
log.error(String.format("客户接口入参为空异常:%s", json_body.toJSONString()));
|
||||
itemInfo = new JSONObject();
|
||||
itemInfo.put("code",cusnumber);
|
||||
itemInfo.put("error","客户分类未匹配");
|
||||
itemInfo.put("error","code name type入参值为空");
|
||||
itemsJson.add(itemInfo);
|
||||
continue;
|
||||
}
|
||||
//根据编号找不到客户,则新增
|
||||
currentCus = BusinessDataServiceHelper.newDynamicObject(entityName);
|
||||
currentCus.set("number",cusnumber);
|
||||
currentCus.set("status","C");//数据状态
|
||||
currentCus.set("creator", RequestContext.get().getCurrUserId());//创建人
|
||||
currentCus.set("approverid", RequestContext.get().getCurrUserId());//审核人
|
||||
currentCus.set("approvedate", new Date());//审核时间
|
||||
currentCus.set("enable",1);//默认可用
|
||||
currentCus.set("type","1");//伙伴类型 默认法人企业
|
||||
currentCus.set("bizfunction",",1,2,3,4,");//业务职能 默认全选
|
||||
currentCus.set("createorg", JhzjUtils.GROUPID);//创建组织 默认为集团
|
||||
currentCus.set("org", JhzjUtils.GROUPID);//管理组织 默认为集团
|
||||
currentCus.set("ctrlstrategy","1");//控制策略 默认逐级分配1 自由分配2
|
||||
currentCus.set("group",custype.getLong("id"));//客户分组
|
||||
currentCus.set("bitindex",1);//位图
|
||||
currentCus.set("customerstatus",EsbUtils.CUSTOMERSTATUS);//客户状态
|
||||
currentCus.set("name",cusname);//客户名称
|
||||
currentCus.set("tx_register_no",taxno);//税务登记号
|
||||
currentCus.set("societycreditcode",taxno);//统一社会信用代码
|
||||
currentCus.set("linkman",json_body.getString("contacts"));//联系人
|
||||
currentCus.set("bizpartner_phone",json_body.getString("telnum"));//联系电话
|
||||
//设置id和masterid 不然不能进行分配动作
|
||||
currentSupId = ID.genLongId();
|
||||
currentCus.set("id", currentSupId);
|
||||
currentCus.set("masterid",currentSupId);
|
||||
//处理银行-新增-员工类客户不需要处理
|
||||
if(!"M400".equals(type)){
|
||||
handleBank(banksJson,currentCus.getDynamicObjectCollection("entry_bank"),cusnumber,cusname);
|
||||
}else{
|
||||
//如果是个人,则伙伴类型字段为个人
|
||||
currentCus.set("type","4");//伙伴类型
|
||||
}
|
||||
//处理 客户组5
|
||||
handleFive(customerfivesJson,currentCus.getDynamicObjectCollection("shjh_entry_five"),cusnumber);
|
||||
currentCus = BusinessDataServiceHelper.loadSingle(entityName,new QFilter[]{new QFilter("number","=",cusnumber)});
|
||||
if(currentCus == null){
|
||||
//判断客户分类
|
||||
custype = BusinessDataServiceHelper.loadSingleFromCache(cusTypeName,"id,number",new QFilter[]{new QFilter("number","=",type)});
|
||||
if(custype == null){
|
||||
log.error(String.format("客户分类未匹配:%s", json_body.toJSONString()));
|
||||
itemInfo = new JSONObject();
|
||||
itemInfo.put("code",cusnumber);
|
||||
itemInfo.put("error","客户分类未匹配");
|
||||
itemsJson.add(itemInfo);
|
||||
continue;
|
||||
}
|
||||
//根据编号找不到客户,则新增
|
||||
currentCus = BusinessDataServiceHelper.newDynamicObject(entityName);
|
||||
currentCus.set("number",cusnumber);
|
||||
currentCus.set("status","C");//数据状态
|
||||
currentCus.set("creator", RequestContext.get().getCurrUserId());//创建人
|
||||
currentCus.set("approverid", RequestContext.get().getCurrUserId());//审核人
|
||||
currentCus.set("approvedate", new Date());//审核时间
|
||||
currentCus.set("enable",1);//默认可用
|
||||
currentCus.set("type","1");//伙伴类型 默认法人企业
|
||||
currentCus.set("bizfunction",",1,2,3,4,");//业务职能 默认全选
|
||||
currentCus.set("createorg", JhzjUtils.GROUPID);//创建组织 默认为集团
|
||||
currentCus.set("org", JhzjUtils.GROUPID);//管理组织 默认为集团
|
||||
currentCus.set("ctrlstrategy","1");//控制策略 默认逐级分配1 自由分配2
|
||||
currentCus.set("group",custype.getLong("id"));//客户分组
|
||||
currentCus.set("bitindex",1);//位图
|
||||
currentCus.set("customerstatus",EsbUtils.CUSTOMERSTATUS);//客户状态
|
||||
currentCus.set("name",cusname);//客户名称
|
||||
currentCus.set("tx_register_no",taxno);//税务登记号
|
||||
currentCus.set("societycreditcode",taxno);//统一社会信用代码
|
||||
currentCus.set("linkman",json_body.getString("contacts"));//联系人
|
||||
currentCus.set("bizpartner_phone",json_body.getString("telnum"));//联系电话
|
||||
//设置id和masterid 不然不能进行分配动作
|
||||
currentSupId = ID.genLongId();
|
||||
currentCus.set("id", currentSupId);
|
||||
currentCus.set("masterid",currentSupId);
|
||||
//处理银行-新增-员工类客户不需要处理
|
||||
if(!"M400".equals(type)){
|
||||
handleBank(banksJson,currentCus.getDynamicObjectCollection("entry_bank"),cusnumber,cusname);
|
||||
}else{
|
||||
//如果是个人,则伙伴类型字段为个人
|
||||
currentCus.set("type","4");//伙伴类型
|
||||
}
|
||||
//处理 客户组5
|
||||
handleFive(customerfivesJson,currentCus.getDynamicObjectCollection("shjh_entry_five"),cusnumber);
|
||||
|
||||
SaveServiceHelper.save(new DynamicObject[]{currentCus});
|
||||
//处理分类
|
||||
custgroupdetail = BusinessDataServiceHelper.newDynamicObject(gdName);
|
||||
custgroupdetail.set("createorg",JhzjUtils.GROUPID);//创建组织
|
||||
custgroupdetail.set("standard",EsbUtils.CUSTOMERSTAND);//客户分类标准
|
||||
custgroupdetail.set("group",custype.getLong("id"));//具体分类
|
||||
custgroupdetail.set("customer",currentSupId);//客户
|
||||
SaveServiceHelper.save(new DynamicObject[]{custgroupdetail});
|
||||
}else{
|
||||
//修改客户 名称 税务登记号 联系人 联系电话 银行信息 客户组5
|
||||
currentSupId = currentCus.getLong("id");
|
||||
currentCus.set("name",cusname);//客户名称
|
||||
currentCus.set("tx_register_no",taxno);//税务登记号
|
||||
currentCus.set("societycreditcode",taxno);//统一社会信用代码
|
||||
currentCus.set("linkman",json_body.getString("contacts"));//联系人
|
||||
currentCus.set("bizpartner_phone",json_body.getString("telnum"));//联系电话
|
||||
//处理 客户组5
|
||||
handleFive(customerfivesJson,currentCus.getDynamicObjectCollection("shjh_entry_five"),cusnumber);
|
||||
//处理银行-新增-员工类客户不需要处理
|
||||
if(!"M400".equals(type)){
|
||||
handleBank(banksJson,currentCus.getDynamicObjectCollection("entry_bank"),cusnumber,cusname);
|
||||
SaveServiceHelper.save(new DynamicObject[]{currentCus});
|
||||
//处理分类
|
||||
custgroupdetail = BusinessDataServiceHelper.newDynamicObject(gdName);
|
||||
custgroupdetail.set("createorg",JhzjUtils.GROUPID);//创建组织
|
||||
custgroupdetail.set("standard",EsbUtils.CUSTOMERSTAND);//客户分类标准
|
||||
custgroupdetail.set("group",custype.getLong("id"));//具体分类
|
||||
custgroupdetail.set("customer",currentSupId);//客户
|
||||
SaveServiceHelper.save(new DynamicObject[]{custgroupdetail});
|
||||
}else{
|
||||
//修改客户 名称 税务登记号 联系人 联系电话 银行信息 客户组5
|
||||
currentSupId = currentCus.getLong("id");
|
||||
currentCus.set("name",cusname);//客户名称
|
||||
currentCus.set("tx_register_no",taxno);//税务登记号
|
||||
currentCus.set("societycreditcode",taxno);//统一社会信用代码
|
||||
currentCus.set("linkman",json_body.getString("contacts"));//联系人
|
||||
currentCus.set("bizpartner_phone",json_body.getString("telnum"));//联系电话
|
||||
//处理 客户组5
|
||||
handleFive(customerfivesJson,currentCus.getDynamicObjectCollection("shjh_entry_five"),cusnumber);
|
||||
//处理银行-新增-员工类客户不需要处理
|
||||
if(!"M400".equals(type)){
|
||||
handleBank(banksJson,currentCus.getDynamicObjectCollection("entry_bank"),cusnumber,cusname);
|
||||
}
|
||||
SaveServiceHelper.save(new DynamicObject[]{currentCus});
|
||||
}
|
||||
SaveServiceHelper.save(new DynamicObject[]{currentCus});
|
||||
cusids.put(cusnumber,currentSupId);
|
||||
}
|
||||
cusids.put(cusnumber,currentSupId);
|
||||
}
|
||||
//处理客户分配
|
||||
EsbUtils.handleAssignNew(companysJson, cusids, entityName);
|
||||
//处理客户取消分配--初始化时不需要用
|
||||
//处理客户分配
|
||||
EsbUtils.handleAssignNew(companysJson, cusids, entityName);
|
||||
//处理客户取消分配--初始化时不需要用
|
||||
// EsbUtils.handleUnAssign(companysJson, cusids, entityName);
|
||||
|
||||
if(itemsJson.isEmpty()){
|
||||
this.operationResult.addSuccessPkId(pzinfo.getPkValue());
|
||||
}else{
|
||||
addErrorInfo(pzinfo,"接口处理异常"+itemsJson.toJSONString());
|
||||
if(itemsJson.isEmpty()){
|
||||
this.operationResult.addSuccessPkId(pzinfo.getPkValue());
|
||||
}else{
|
||||
addErrorInfo(pzinfo,"接口处理异常"+itemsJson.toJSONString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -183,10 +183,6 @@ public class SupplierInitOperation extends AbstractOperationServicePlugIn implem
|
|||
SaveServiceHelper.save(new DynamicObject[]{currentSup});
|
||||
// OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{currentSup}, OperateOption.create());
|
||||
cusids.put(supnumber,currentSup.getLong("id"));
|
||||
//先拿1000个供应商试试
|
||||
if(i == 1000){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//处理供应商分配
|
||||
|
|
|
|||
|
|
@ -45,6 +45,17 @@ public class EsbUtils {
|
|||
return null;
|
||||
}
|
||||
|
||||
//获取当前核算组织的编号和id对应关系
|
||||
public static Map<String, Long> getOrgNumberIds(){
|
||||
Map<String, Long> orgids = new HashMap<>();
|
||||
DynamicObject[] orginfos = BusinessDataServiceHelper.load(orgName,"id,number",
|
||||
new QFilter[]{new QFilter("fisaccounting","=",1)});
|
||||
for (DynamicObject orginfo : orginfos) {
|
||||
orgids.put(orginfo.getString("number"),orginfo.getLong("id"));
|
||||
}
|
||||
return orgids;
|
||||
}
|
||||
|
||||
//处理科目初始化时的分配
|
||||
public static void handleAssignInit(JSONArray companysJson, Map<String, Long> cusids, String entityName) {
|
||||
if(companysJson == null || cusids.isEmpty()){
|
||||
|
|
@ -52,72 +63,50 @@ public class EsbUtils {
|
|||
}
|
||||
JSONObject json_body;
|
||||
String compnum;
|
||||
String cusnumber = "";//当前编号
|
||||
String firstnumber = "firstnumber";//初始化编号
|
||||
Long curid;//当前数据id
|
||||
DynamicObject compinfo;
|
||||
String cusnumber;//当前科目编号
|
||||
Long compinfoid;
|
||||
List<Long> dataList = new ArrayList<>();
|
||||
List<Long> orgList = new ArrayList<>();
|
||||
for (int i = 0; i < companysJson.size(); i++) {
|
||||
json_body = companysJson.getJSONObject(i);
|
||||
cusnumber = json_body.getString("shjh_ccode");//客户-供应商编号
|
||||
compnum = json_body.getString("shjh_companynum");//公司编号
|
||||
if(EsbUtils.isEmpty(cusnumber) || EsbUtils.isEmpty(compnum) || "0".equals(json_body.getString("shjh_companystatus"))){
|
||||
//公司编号为空 或者 公司层面使用状态-禁用的 不处理
|
||||
continue;
|
||||
}
|
||||
//还原公司id
|
||||
compinfo = BusinessDataServiceHelper.loadSingleFromCache(orgName,"id,number",new QFilter[]{new QFilter("number","=",compnum)});
|
||||
if(compinfo == null){
|
||||
continue;
|
||||
}
|
||||
if("firstnumber".equals(firstnumber)){
|
||||
//初始化,改变初始化值
|
||||
firstnumber = cusnumber;
|
||||
orgList.add(compinfo.getLong("id"));
|
||||
}else if(firstnumber.equals(cusnumber)){
|
||||
//还是同一个客户
|
||||
orgList.add(compinfo.getLong("id"));
|
||||
}else{
|
||||
//另一个客户,先处理上一个客户的分配
|
||||
if(!orgList.isEmpty()){
|
||||
curid = cusids.get(cusnumber);
|
||||
if(curid == null){
|
||||
//当前编号对应的id不存在,即上一个数据没有保存成功 不处理分配,上一个组织数据清空,增加当前组织
|
||||
orgList.clear();
|
||||
orgList.add(compinfo.getLong("id"));
|
||||
continue;
|
||||
}
|
||||
dataList.clear();
|
||||
dataList.add(curid);
|
||||
BaseDataServiceHelper.batchAssignWithDetail(entityName,JhzjUtils.GROUPID,dataList,orgList);
|
||||
//处理完成后,清空组织列表
|
||||
orgList.clear();
|
||||
orgList.add(compinfo.getLong("id"));
|
||||
Map<String, Long> orgids = getOrgNumberIds();
|
||||
for (Map.Entry<String,Long> entry : cusids.entrySet()) {
|
||||
orgList.clear();
|
||||
for (int i = 0; i < companysJson.size(); i++) {
|
||||
json_body = companysJson.getJSONObject(i);
|
||||
cusnumber = json_body.getString("shjh_ccode");//科目编号
|
||||
compnum = json_body.getString("shjh_companynum");//公司编号
|
||||
if(EsbUtils.isEmpty(cusnumber) || EsbUtils.isEmpty(compnum) || "0".equals(json_body.getString("shjh_companystatus"))){
|
||||
//公司编号为空 或者 公司层面使用状态-禁用的 不处理
|
||||
continue;
|
||||
}
|
||||
//还原公司id
|
||||
compinfoid = orgids.get(compnum);
|
||||
if(compinfoid == null){
|
||||
continue;
|
||||
}
|
||||
if(cusnumber.equals(entry.getKey())){
|
||||
orgList.add(compinfoid);
|
||||
}
|
||||
firstnumber = cusnumber;
|
||||
orgList.add(compinfo.getLong("id"));
|
||||
}
|
||||
}
|
||||
curid = cusids.get(cusnumber);
|
||||
//考虑最后一个客户的分配情况
|
||||
if(!orgList.isEmpty() && curid != null){
|
||||
dataList.clear();
|
||||
dataList.add(curid);
|
||||
BaseDataServiceHelper.batchAssignWithDetail(entityName,JhzjUtils.GROUPID,dataList,orgList);
|
||||
if(!orgList.isEmpty()) {
|
||||
dataList.clear();
|
||||
dataList.add(entry.getValue());
|
||||
BaseDataServiceHelper.batchAssignWithDetail(entityName,JhzjUtils.GROUPID,dataList,orgList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void handleUnAssignNew(JSONArray companysJson, Map<String, Long> cusids, String entityName) {
|
||||
//处理客商 科目分分配
|
||||
if(companysJson == null || cusids.isEmpty()){
|
||||
return;
|
||||
}
|
||||
String cusnumber;
|
||||
String compnum;
|
||||
JSONObject json_body;
|
||||
DynamicObject compinfo;
|
||||
Long compinfoid;
|
||||
Set<Long> dataList = new HashSet<>(1);
|
||||
Set<Long> orgList = new HashSet<>();
|
||||
Map<String, Long> orgids = getOrgNumberIds();
|
||||
for (Map.Entry<String,Long> entry : cusids.entrySet()) {
|
||||
orgList.clear();
|
||||
for (int i = 0; i < companysJson.size(); i++) {
|
||||
|
|
@ -129,33 +118,34 @@ public class EsbUtils {
|
|||
continue;
|
||||
}
|
||||
//还原公司id
|
||||
compinfo = BusinessDataServiceHelper.loadSingleFromCache(orgName,"id,number",new QFilter[]{new QFilter("number","=",compnum)});
|
||||
if(compinfo == null){
|
||||
compinfoid = orgids.get(compnum);
|
||||
if(compinfoid == null){
|
||||
continue;
|
||||
}
|
||||
if(cusnumber.equals(entry.getKey())){
|
||||
orgList.add(compinfo.getLong("id"));
|
||||
orgList.add(compinfoid);
|
||||
}
|
||||
}
|
||||
if(!orgList.isEmpty()){
|
||||
dataList.clear();
|
||||
dataList.add(entry.getValue());
|
||||
// BaseDataServiceHelper.batchAssignWithDetail(entityName,JhzjUtils.GROUPID,dataList,orgList);
|
||||
BaseDataServiceHelper.cancelAssign(entityName,dataList,orgList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void handleAssignNew(JSONArray companysJson, Map<String, Long> cusids, String entityName) {
|
||||
//处理客商 科目分配
|
||||
if(companysJson == null || cusids.isEmpty()){
|
||||
return;
|
||||
}
|
||||
String cusnumber;
|
||||
String compnum;
|
||||
JSONObject json_body;
|
||||
DynamicObject compinfo;
|
||||
Long compinfoid;
|
||||
List<Long> dataList = new ArrayList<>(1);
|
||||
List<Long> orgList = new ArrayList<>();
|
||||
Map<String, Long> orgids = getOrgNumberIds();
|
||||
for (Map.Entry<String,Long> entry : cusids.entrySet()) {
|
||||
orgList.clear();
|
||||
for (int i = 0; i < companysJson.size(); i++) {
|
||||
|
|
@ -167,12 +157,12 @@ public class EsbUtils {
|
|||
continue;
|
||||
}
|
||||
//还原公司id
|
||||
compinfo = BusinessDataServiceHelper.loadSingleFromCache(orgName,"id,number",new QFilter[]{new QFilter("number","=",compnum)});
|
||||
if(compinfo == null){
|
||||
compinfoid = orgids.get(compnum);
|
||||
if(compinfoid == null){
|
||||
continue;
|
||||
}
|
||||
if(cusnumber.equals(entry.getKey())){
|
||||
orgList.add(compinfo.getLong("id"));
|
||||
orgList.add(compinfoid);
|
||||
}
|
||||
}
|
||||
if(!orgList.isEmpty()){
|
||||
|
|
@ -183,7 +173,7 @@ public class EsbUtils {
|
|||
}
|
||||
}
|
||||
|
||||
//处理分配
|
||||
//处理分配-方法弃用
|
||||
public static void handleAssign(JSONArray companysJson, Map<String, Long> cusids, String entityName) {
|
||||
if(companysJson == null || cusids.isEmpty()){
|
||||
return;
|
||||
|
|
@ -246,7 +236,7 @@ public class EsbUtils {
|
|||
}
|
||||
}
|
||||
|
||||
//处理取消分配
|
||||
//处理取消分配-方法弃用
|
||||
public static void handleUnAssign(JSONArray companysJson, Map<String, Long> cusids, String entityName) {
|
||||
if(companysJson == null || cusids.isEmpty()){
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -193,8 +193,8 @@ public class AspAccountControler {
|
|||
//处理科目在每个公司生成
|
||||
Map<String, DynamicObject> companyAcctMaps = handleAccountCompany(accountMaps,companysJson);
|
||||
//处理科目分配和反分配
|
||||
EsbUtils.handleAssign(companysJson, acctids, entityName);
|
||||
EsbUtils.handleUnAssign(companysJson, acctids, entityName);
|
||||
EsbUtils.handleAssignNew(companysJson, acctids, entityName);
|
||||
EsbUtils.handleUnAssignNew(companysJson, acctids, entityName);
|
||||
//处理每个公司下科目的核算维度和禁用状态
|
||||
JSONArray asstacttypesJson = json_obj.getJSONArray("asstacttypes");
|
||||
if(asstacttypesJson != null){
|
||||
|
|
|
|||
|
|
@ -165,9 +165,9 @@ public class CustomerControler {
|
|||
cusids.put(cusnumber,currentSupId);
|
||||
}
|
||||
//处理客户分配
|
||||
EsbUtils.handleAssign(companysJson, cusids, entityName);
|
||||
EsbUtils.handleAssignNew(companysJson, cusids, entityName);
|
||||
//处理客户取消分配
|
||||
EsbUtils.handleUnAssign(companysJson, cusids, entityName);
|
||||
EsbUtils.handleUnAssignNew(companysJson, cusids, entityName);
|
||||
|
||||
if(itemsJson.isEmpty()){
|
||||
EsbUtils.saveLog(apimenthod,"ESB",json_obj.toString(),null,true,"API");
|
||||
|
|
|
|||
|
|
@ -228,9 +228,9 @@ public class SupplierControler {
|
|||
}
|
||||
|
||||
//处理供应商分配
|
||||
EsbUtils.handleAssign(companysJson, cusids, entityName);
|
||||
EsbUtils.handleAssignNew(companysJson, cusids, entityName);
|
||||
//处理供应商取消分配
|
||||
EsbUtils.handleUnAssign(companysJson, cusids, entityName);
|
||||
EsbUtils.handleUnAssignNew(companysJson, cusids, entityName);
|
||||
|
||||
if(itemsJson.isEmpty()){
|
||||
EsbUtils.saveLog(apimenthod,"ESB",json_obj.toString(),null,true,"API");
|
||||
|
|
|
|||
Loading…
Reference in New Issue