客户供应商接口分类标准处理2
This commit is contained in:
parent
468c603d30
commit
c7d8fd3558
|
|
@ -151,6 +151,7 @@ public class CustomerControler {
|
||||||
itemInfo.put("code",cusnumber);
|
itemInfo.put("code",cusnumber);
|
||||||
itemInfo.put("error","客户保存失败"+operResult.getMessage());
|
itemInfo.put("error","客户保存失败"+operResult.getMessage());
|
||||||
itemsJson.add(itemInfo);
|
itemsJson.add(itemInfo);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
//处理分类-客户只有一个分类
|
//处理分类-客户只有一个分类
|
||||||
custgroupdetail = BusinessDataServiceHelper.loadSingle(gdName,new QFilter[]{
|
custgroupdetail = BusinessDataServiceHelper.loadSingle(gdName,new QFilter[]{
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ public class SupplierControler {
|
||||||
private static final String supTypeName = "bd_suppliergroup";//系统库 表名 t_bd_suppliergroup
|
private static final String supTypeName = "bd_suppliergroup";//系统库 表名 t_bd_suppliergroup
|
||||||
private static final String bebankName = "bd_bebank";//系统库 行名行号 表名 t_bd_bebank
|
private static final String bebankName = "bd_bebank";//系统库 行名行号 表名 t_bd_bebank
|
||||||
|
|
||||||
// private static final String gdName = "bd_suppliergroupdetail";//系统库 供应商分组 表名 t_bd_suppliergroupdetail
|
private static final String gdName = "bd_suppliergroupdetail";//系统库 供应商分组 表名 t_bd_suppliergroupdetail
|
||||||
// private static final String parterName = "bd_bizpartner";//系统库 商务伙伴 表名 T_BD_BizPartner
|
// private static final String parterName = "bd_bizpartner";//系统库 商务伙伴 表名 T_BD_BizPartner
|
||||||
private static final Log log = LogFactory.getLog(SupplierControler.class);
|
private static final Log log = LogFactory.getLog(SupplierControler.class);
|
||||||
private static final String apimenthod = "/supplier_sync";
|
private static final String apimenthod = "/supplier_sync";
|
||||||
|
|
@ -80,13 +80,14 @@ public class SupplierControler {
|
||||||
DynamicObject bebankinfo;
|
DynamicObject bebankinfo;
|
||||||
JSONObject json_bank;
|
JSONObject json_bank;
|
||||||
Long currentSupId;
|
Long currentSupId;
|
||||||
// DynamicObject suppliergroupdetail;
|
DynamicObject suppliergroupdetail;
|
||||||
// DynamicObject parterInfo;
|
// DynamicObject parterInfo;
|
||||||
Map<String, Long> cusids = new HashMap<>();//供应商编号和ID对应关系
|
Map<String, Long> cusids = new HashMap<>();//供应商编号和ID对应关系
|
||||||
OperateOption oop = OperateOption.create();
|
OperateOption oop = OperateOption.create();
|
||||||
DynamicObject grouporginfo = EsbUtils.getGroupOrg();
|
DynamicObject grouporginfo = EsbUtils.getGroupOrg();
|
||||||
DynamicObject rmbinfo = EsbUtils.getRmb();
|
DynamicObject rmbinfo = EsbUtils.getRmb();
|
||||||
OperationResult operResult;
|
OperationResult operResult;
|
||||||
|
boolean isNew;
|
||||||
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);
|
||||||
supnumber = json_body.getString("code");
|
supnumber = json_body.getString("code");
|
||||||
|
|
@ -111,6 +112,7 @@ public class SupplierControler {
|
||||||
itemsJson.add(itemInfo);
|
itemsJson.add(itemInfo);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
isNew = false;
|
||||||
currentSup = BusinessDataServiceHelper.loadSingle(entityName,new QFilter[]{new QFilter("number","=",supnumber)});
|
currentSup = BusinessDataServiceHelper.loadSingle(entityName,new QFilter[]{new QFilter("number","=",supnumber)});
|
||||||
if(currentSup == null){
|
if(currentSup == null){
|
||||||
//根据编号找不到供应商,则新增
|
//根据编号找不到供应商,则新增
|
||||||
|
|
@ -127,31 +129,20 @@ public class SupplierControler {
|
||||||
currentSup.set("org", grouporginfo);//管理组织 默认为集团
|
currentSup.set("org", grouporginfo);//管理组织 默认为集团
|
||||||
currentSup.set("source","SELF");//来源 默认自建
|
currentSup.set("source","SELF");//来源 默认自建
|
||||||
currentSup.set("ctrlstrategy","1");//控制策略 默认逐级分配
|
currentSup.set("ctrlstrategy","1");//控制策略 默认逐级分配
|
||||||
currentSup.set("group",suptype.getLong("id"));//供应商分组
|
currentSup.set("group",suptype);//供应商分组
|
||||||
// currentSup.set("bitindex",6);//位图
|
// currentSup.set("bitindex",6);//位图
|
||||||
// currentSup.set("supplier_status",EsbUtils.SUPPLIERSTATUS);//供应商状态 默认合格
|
// currentSup.set("supplier_status",EsbUtils.SUPPLIERSTATUS);//供应商状态 默认合格
|
||||||
//设置id和masterid 不然不能进行分配动作
|
//设置id和masterid 不然不能进行分配动作
|
||||||
currentSupId = ID.genLongId();
|
currentSupId = ID.genLongId();
|
||||||
currentSup.set("id", currentSupId);
|
currentSup.set("id", currentSupId);
|
||||||
currentSup.set("masterid",currentSupId);
|
currentSup.set("masterid",currentSupId);
|
||||||
//处理分类
|
isNew = true;
|
||||||
// suppliergroupdetail = BusinessDataServiceHelper.newDynamicObject(gdName);
|
|
||||||
// suppliergroupdetail.set("createorg",JhzjUtils.GROUPID);//创建组织
|
|
||||||
// suppliergroupdetail.set("standard",EsbUtils.SUPPLIERSTAND);//供应商分类标准
|
|
||||||
// suppliergroupdetail.set("group",suptype.getLong("id"));//具体分类
|
|
||||||
// suppliergroupdetail.set("supplier",currentSupId);//供应商
|
|
||||||
// SaveServiceHelper.save(new DynamicObject[]{suppliergroupdetail});
|
|
||||||
}
|
}
|
||||||
currentSup.set("name",supname);//供应商名称
|
currentSup.set("name",supname);//供应商名称
|
||||||
currentSup.set("tx_register_no",taxno);//税务登记号
|
currentSup.set("tx_register_no",taxno);//税务登记号
|
||||||
currentSup.set("societycreditcode",taxno);//统一社会信用代码
|
currentSup.set("societycreditcode",taxno);//统一社会信用代码
|
||||||
currentSup.set("linkman",json_body.getString("contacts"));//联系人
|
currentSup.set("linkman",json_body.getString("contacts"));//联系人
|
||||||
currentSup.set("bizpartner_phone",json_body.getString("telnum"));//联系电话
|
currentSup.set("bizpartner_phone",json_body.getString("telnum"));//联系电话
|
||||||
// currentSup.set("masterid",2132710265374922752l);//主数据内码
|
|
||||||
// currentSup.set("bizpartner",2133452518301132800l);//商务伙伴
|
|
||||||
// currentSup.set("deliversupplierid",2132710265374922752l);//供货供应商
|
|
||||||
// currentSup.set("invoicesupplierid",2132710265374922752l);//结算供应商
|
|
||||||
// currentSup.set("receivingsupplierid",2132710265374922752l);//收款供应商
|
|
||||||
//处理银行信息-分表
|
//处理银行信息-分表
|
||||||
if(banksJson != null){
|
if(banksJson != null){
|
||||||
doc_bank = currentSup.getDynamicObjectCollection("entry_bank");
|
doc_bank = currentSup.getDynamicObjectCollection("entry_bank");
|
||||||
|
|
@ -207,25 +198,30 @@ public class SupplierControler {
|
||||||
itemInfo.put("code",supnumber);
|
itemInfo.put("code",supnumber);
|
||||||
itemInfo.put("error","供应商保存失败"+operResult.getMessage());
|
itemInfo.put("error","供应商保存失败"+operResult.getMessage());
|
||||||
itemsJson.add(itemInfo);
|
itemsJson.add(itemInfo);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//新增时处理分类-只有一个分类
|
||||||
|
if(isNew){
|
||||||
|
suppliergroupdetail = BusinessDataServiceHelper.loadSingle(gdName,new QFilter[]{
|
||||||
|
new QFilter("supplier.id","=",currentSup.getLong("id"))});
|
||||||
|
if(suppliergroupdetail == null){
|
||||||
|
suppliergroupdetail = BusinessDataServiceHelper.newDynamicObject(gdName);
|
||||||
|
suppliergroupdetail.set("createorg", grouporginfo);//创建组织
|
||||||
|
suppliergroupdetail.set("standard",EsbUtils.SUPPLIERSTAND);//供应商分类标准
|
||||||
|
suppliergroupdetail.set("supplier",currentSup);//供应商
|
||||||
|
}
|
||||||
|
suppliergroupdetail.set("group",suptype);//具体分类
|
||||||
|
// SaveServiceHelper.save(new DynamicObject[]{suppliergroupdetail});
|
||||||
|
operResult = OperationServiceHelper.executeOperate("save", gdName, new DynamicObject[]{suppliergroupdetail}, oop);
|
||||||
|
if(!operResult.isSuccess()){
|
||||||
|
log.error(String.format("供应商分类保存失败:%s", json_body.toJSONString()));
|
||||||
|
itemInfo = new JSONObject();
|
||||||
|
itemInfo.put("code",supnumber);
|
||||||
|
itemInfo.put("error","供应商分类保存失败"+operResult.getMessage());
|
||||||
|
itemsJson.add(itemInfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cusids.put(supnumber,currentSup.getLong("id"));
|
cusids.put(supnumber,currentSup.getLong("id"));
|
||||||
//处理商务伙伴,先判断是否已经生成了伙伴,没有则新增一个伙伴
|
|
||||||
// parterInfo = BusinessDataServiceHelper.loadSingle(parterName,new QFilter[]{new QFilter("number","=",supnumber)});
|
|
||||||
// if(parterInfo == null){
|
|
||||||
// parterInfo = BusinessDataServiceHelper.newDynamicObject(parterName);
|
|
||||||
// parterInfo.set("number",supnumber);
|
|
||||||
// parterInfo.set("status","C");//数据状态
|
|
||||||
// parterInfo.set("creator", RequestContext.get().getCurrUserId());//创建人
|
|
||||||
// parterInfo.set("enable",1);//默认可用
|
|
||||||
// parterInfo.set("issupplier",1);//供应商标记
|
|
||||||
// parterInfo.set("type","1");//伙伴类型 默认法人企业
|
|
||||||
// parterInfo.set("partnerrole",",1,");//伙伴角色 供应商
|
|
||||||
// parterInfo.set("name",supname);//供应商名称
|
|
||||||
// parterInfo.set("tx_register_no",taxno);//税务登记号
|
|
||||||
// parterInfo.set("societycreditcode",taxno);//统一社会信用代码
|
|
||||||
// SaveServiceHelper.save(new DynamicObject[]{parterInfo});
|
|
||||||
// //将伙伴的id更新到供应商上面
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//处理供应商分配
|
//处理供应商分配
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue