供应商、客户接口优化3
This commit is contained in:
parent
81a066a120
commit
ecca256aed
|
|
@ -31,7 +31,7 @@ import java.util.*;
|
||||||
*/
|
*/
|
||||||
public class FeeControlApiPlugin extends AbstractFormPlugin implements Plugin {
|
public class FeeControlApiPlugin extends AbstractFormPlugin implements Plugin {
|
||||||
private final static Log logger = LogFactory.getLog(FeeControlApiPlugin.class);
|
private final static Log logger = LogFactory.getLog(FeeControlApiPlugin.class);
|
||||||
private static final DynamicObjectCollection PARAM_LIST = new DynamicObjectCollection();
|
private DynamicObjectCollection PARAM_LIST = new DynamicObjectCollection();
|
||||||
private static final String QUERY_BUTTON_KEY = "shjh_btnquery";
|
private static final String QUERY_BUTTON_KEY = "shjh_btnquery";
|
||||||
private static final String SELECTED_BUTTON_KEY = "shjh_btnok";
|
private static final String SELECTED_BUTTON_KEY = "shjh_btnok";
|
||||||
private static final String ENTRY_KEY = "shjh_entryentity";
|
private static final String ENTRY_KEY = "shjh_entryentity";
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ 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.entity.operate.result.OperateErrorInfo;
|
import kd.bos.entity.operate.result.OperateErrorInfo;
|
||||||
|
import kd.bos.entity.operate.result.OperationResult;
|
||||||
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||||
import kd.bos.entity.plugin.args.AfterOperationArgs;
|
import kd.bos.entity.plugin.args.AfterOperationArgs;
|
||||||
import kd.bos.id.ID;
|
import kd.bos.id.ID;
|
||||||
|
|
@ -54,6 +55,8 @@ public class CustomerInitOperation extends AbstractOperationServicePlugIn implem
|
||||||
Long currentSupId;
|
Long currentSupId;
|
||||||
DynamicObject custgroupdetail;
|
DynamicObject custgroupdetail;
|
||||||
OperateOption oop = OperateOption.create();
|
OperateOption oop = OperateOption.create();
|
||||||
|
DynamicObject grouporginfo = EsbUtils.getGroupOrg();
|
||||||
|
OperationResult operResult;
|
||||||
for (DynamicObject pzinfo : dos) {
|
for (DynamicObject pzinfo : dos) {
|
||||||
pzinfo = BusinessDataServiceHelper.loadSingle(pzinfo.getPkValue(), pzinfo.getDataEntityType().getName());
|
pzinfo = BusinessDataServiceHelper.loadSingle(pzinfo.getPkValue(), pzinfo.getDataEntityType().getName());
|
||||||
try{
|
try{
|
||||||
|
|
@ -113,12 +116,12 @@ public class CustomerInitOperation extends AbstractOperationServicePlugIn implem
|
||||||
currentCus.set("enable",1);//默认可用
|
currentCus.set("enable",1);//默认可用
|
||||||
currentCus.set("type","1");//伙伴类型 默认法人企业
|
currentCus.set("type","1");//伙伴类型 默认法人企业
|
||||||
currentCus.set("bizfunction",",1,2,3,4,");//业务职能 默认全选
|
currentCus.set("bizfunction",",1,2,3,4,");//业务职能 默认全选
|
||||||
currentCus.set("createorg", JhzjUtils.GROUPID);//创建组织 默认为集团
|
currentCus.set("createorg", grouporginfo);//创建组织 默认为集团
|
||||||
currentCus.set("org", JhzjUtils.GROUPID);//管理组织 默认为集团
|
currentCus.set("org", grouporginfo);//管理组织 默认为集团
|
||||||
currentCus.set("ctrlstrategy","1");//控制策略 默认逐级分配1 自由分配2
|
currentCus.set("ctrlstrategy","1");//控制策略 默认逐级分配1 自由分配2
|
||||||
currentCus.set("group",custype.getLong("id"));//客户分组
|
currentCus.set("group",custype.getLong("id"));//客户分组
|
||||||
// currentCus.set("bitindex",1);//位图
|
// currentCus.set("bitindex",1);//位图
|
||||||
currentCus.set("customerstatus",EsbUtils.CUSTOMERSTATUS);//客户状态
|
// currentCus.set("customerstatus",EsbUtils.CUSTOMERSTATUS);//客户状态
|
||||||
currentCus.set("name",cusname);//客户名称
|
currentCus.set("name",cusname);//客户名称
|
||||||
currentCus.set("tx_register_no",taxno);//税务登记号
|
currentCus.set("tx_register_no",taxno);//税务登记号
|
||||||
currentCus.set("societycreditcode",taxno);//统一社会信用代码
|
currentCus.set("societycreditcode",taxno);//统一社会信用代码
|
||||||
|
|
@ -141,7 +144,14 @@ public class CustomerInitOperation extends AbstractOperationServicePlugIn implem
|
||||||
// SaveServiceHelper.save(new DynamicObject[]{currentCus});
|
// SaveServiceHelper.save(new DynamicObject[]{currentCus});
|
||||||
//保存客户-必须调用保存操作,否则不符合受控基础资料开发规范
|
//保存客户-必须调用保存操作,否则不符合受控基础资料开发规范
|
||||||
// SaveServiceHelper.save(new DynamicObject[]{currentCus});
|
// SaveServiceHelper.save(new DynamicObject[]{currentCus});
|
||||||
OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{currentCus}, oop);
|
operResult = OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{currentCus}, oop);
|
||||||
|
if(!operResult.isSuccess()){
|
||||||
|
log.error(String.format("客户保存失败:%s", json_body.toJSONString()));
|
||||||
|
itemInfo = new JSONObject();
|
||||||
|
itemInfo.put("code",cusnumber);
|
||||||
|
itemInfo.put("error","客户保存失败"+operResult.getMessage());
|
||||||
|
itemsJson.add(itemInfo);
|
||||||
|
}
|
||||||
//处理分类
|
//处理分类
|
||||||
custgroupdetail = BusinessDataServiceHelper.newDynamicObject(gdName);
|
custgroupdetail = BusinessDataServiceHelper.newDynamicObject(gdName);
|
||||||
custgroupdetail.set("createorg",JhzjUtils.GROUPID);//创建组织
|
custgroupdetail.set("createorg",JhzjUtils.GROUPID);//创建组织
|
||||||
|
|
@ -163,7 +173,14 @@ public class CustomerInitOperation extends AbstractOperationServicePlugIn implem
|
||||||
if(!"M400".equals(type)){
|
if(!"M400".equals(type)){
|
||||||
handleBank(banksJson,currentCus.getDynamicObjectCollection("entry_bank"),cusnumber,cusname);
|
handleBank(banksJson,currentCus.getDynamicObjectCollection("entry_bank"),cusnumber,cusname);
|
||||||
}
|
}
|
||||||
OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{currentCus}, oop);
|
operResult = OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{currentCus}, oop);
|
||||||
|
if(!operResult.isSuccess()){
|
||||||
|
log.error(String.format("客户保存失败:%s", json_body.toJSONString()));
|
||||||
|
itemInfo = new JSONObject();
|
||||||
|
itemInfo.put("code",cusnumber);
|
||||||
|
itemInfo.put("error","客户保存失败"+operResult.getMessage());
|
||||||
|
itemsJson.add(itemInfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cusids.put(cusnumber,currentSupId);
|
cusids.put(cusnumber,currentSupId);
|
||||||
}
|
}
|
||||||
|
|
@ -224,6 +241,11 @@ public class CustomerInitOperation extends AbstractOperationServicePlugIn implem
|
||||||
for (int i = 0; i < banksJson.size(); i++) {
|
for (int i = 0; i < banksJson.size(); i++) {
|
||||||
json_body = banksJson.getJSONObject(i);
|
json_body = banksJson.getJSONObject(i);
|
||||||
if(cusnumber.equals(json_body.getString("code"))){
|
if(cusnumber.equals(json_body.getString("code"))){
|
||||||
|
//根据详细分机银行 查找对应的行名行号
|
||||||
|
bebankinfo = BusinessDataServiceHelper.loadSingleFromCache(bebankName,"id,name",new QFilter[]{new QFilter("name","=",json_body.getString("bankname"))});
|
||||||
|
if(bebankinfo == null){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
bankinfo = doc_bank.addNew();
|
bankinfo = doc_bank.addNew();
|
||||||
bankinfo.set("bankaccount",json_body.getString("banknumber"));//银行账号
|
bankinfo.set("bankaccount",json_body.getString("banknumber"));//银行账号
|
||||||
if(EsbUtils.isEmpty(json_body.getString("acctname"))){
|
if(EsbUtils.isEmpty(json_body.getString("acctname"))){
|
||||||
|
|
@ -232,11 +254,8 @@ public class CustomerInitOperation extends AbstractOperationServicePlugIn implem
|
||||||
}else{
|
}else{
|
||||||
bankinfo.set("accountname",json_body.getString("acctname"));//账户名称
|
bankinfo.set("accountname",json_body.getString("acctname"));//账户名称
|
||||||
}
|
}
|
||||||
//根据详细分机银行 查找对应的行名行号
|
|
||||||
bebankinfo = BusinessDataServiceHelper.loadSingleFromCache(bebankName,"id,name",new QFilter[]{new QFilter("name","=",json_body.getString("bankname"))});
|
bankinfo.set("bank",bebankinfo.getLong("id"));//开户银行-行名行号 根据入参查找
|
||||||
if(bebankinfo != null){
|
|
||||||
bankinfo.set("bank",bebankinfo.getLong("id"));//开户银行-行名行号 根据入参查找
|
|
||||||
}
|
|
||||||
bankinfo.set("currency", JhzjUtils.CNY);//币别 默认人民币
|
bankinfo.set("currency", JhzjUtils.CNY);//币别 默认人民币
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ 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.entity.operate.result.OperateErrorInfo;
|
import kd.bos.entity.operate.result.OperateErrorInfo;
|
||||||
|
import kd.bos.entity.operate.result.OperationResult;
|
||||||
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||||
import kd.bos.entity.plugin.args.AfterOperationArgs;
|
import kd.bos.entity.plugin.args.AfterOperationArgs;
|
||||||
import kd.bos.id.ID;
|
import kd.bos.id.ID;
|
||||||
|
|
@ -76,6 +77,8 @@ public class SupplierInitOperation extends AbstractOperationServicePlugIn implem
|
||||||
Long currentSupId;
|
Long currentSupId;
|
||||||
DynamicObject suppliergroupdetail;
|
DynamicObject suppliergroupdetail;
|
||||||
OperateOption oop = OperateOption.create();
|
OperateOption oop = OperateOption.create();
|
||||||
|
DynamicObject grouporginfo = EsbUtils.getGroupOrg();
|
||||||
|
OperationResult operResult;
|
||||||
Map<String, Long> cusids = new HashMap<>();//供应商编号和ID对应关系
|
Map<String, Long> cusids = new HashMap<>();//供应商编号和ID对应关系
|
||||||
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);
|
||||||
|
|
@ -113,13 +116,13 @@ public class SupplierInitOperation extends AbstractOperationServicePlugIn implem
|
||||||
currentSup.set("enable",1);//默认可用
|
currentSup.set("enable",1);//默认可用
|
||||||
currentSup.set("type","1");//伙伴类型 默认法人企业
|
currentSup.set("type","1");//伙伴类型 默认法人企业
|
||||||
currentSup.set("bizfunction",",1,2,3,4,");//业务职能 默认全选
|
currentSup.set("bizfunction",",1,2,3,4,");//业务职能 默认全选
|
||||||
currentSup.set("createorg", JhzjUtils.GROUPID);//创建组织 默认为集团
|
currentSup.set("createorg", grouporginfo);//创建组织 默认为集团
|
||||||
currentSup.set("org", JhzjUtils.GROUPID);//管理组织 默认为集团
|
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.getLong("id"));//供应商分组
|
||||||
// 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);
|
||||||
|
|
@ -184,7 +187,14 @@ public class SupplierInitOperation extends AbstractOperationServicePlugIn implem
|
||||||
handleSAPCompany(companysJson,currentSup.getDynamicObjectCollection("shjh_entry_sap"),supnumber);
|
handleSAPCompany(companysJson,currentSup.getDynamicObjectCollection("shjh_entry_sap"),supnumber);
|
||||||
//保存供应商-必须调用保存操作,否则不符合受控基础资料开发规范
|
//保存供应商-必须调用保存操作,否则不符合受控基础资料开发规范
|
||||||
// SaveServiceHelper.save(new DynamicObject[]{currentSup});
|
// SaveServiceHelper.save(new DynamicObject[]{currentSup});
|
||||||
OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{currentSup}, oop);
|
operResult = OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{currentSup}, 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"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import kd.bos.context.RequestContext;
|
||||||
import kd.bos.dataentity.OperateOption;
|
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.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;
|
||||||
|
|
@ -84,6 +85,8 @@ public class SupplierControler {
|
||||||
// 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();
|
||||||
|
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);
|
||||||
supnumber = json_body.getString("code");
|
supnumber = json_body.getString("code");
|
||||||
|
|
@ -120,13 +123,13 @@ public class SupplierControler {
|
||||||
currentSup.set("enable",1);//默认可用
|
currentSup.set("enable",1);//默认可用
|
||||||
currentSup.set("type","1");//伙伴类型 默认法人企业
|
currentSup.set("type","1");//伙伴类型 默认法人企业
|
||||||
currentSup.set("bizfunction",",1,2,3,4,");//业务职能 默认全选
|
currentSup.set("bizfunction",",1,2,3,4,");//业务职能 默认全选
|
||||||
currentSup.set("createorg", JhzjUtils.GROUPID);//创建组织 默认为集团
|
currentSup.set("createorg", grouporginfo);//创建组织 默认为集团
|
||||||
currentSup.set("org", JhzjUtils.GROUPID);//管理组织 默认为集团
|
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.getLong("id"));//供应商分组
|
||||||
// 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);
|
||||||
|
|
@ -210,7 +213,14 @@ public class SupplierControler {
|
||||||
handleSAPCompany(companysJson,currentSup.getDynamicObjectCollection("shjh_entry_sap"),supnumber);
|
handleSAPCompany(companysJson,currentSup.getDynamicObjectCollection("shjh_entry_sap"),supnumber);
|
||||||
//保存供应商-必须调用保存操作,否则不符合受控基础资料开发规范
|
//保存供应商-必须调用保存操作,否则不符合受控基础资料开发规范
|
||||||
// SaveServiceHelper.save(new DynamicObject[]{currentSup});
|
// SaveServiceHelper.save(new DynamicObject[]{currentSup});
|
||||||
OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{currentSup}, oop);
|
operResult = OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{currentSup}, 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)});
|
// parterInfo = BusinessDataServiceHelper.loadSingle(parterName,new QFilter[]{new QFilter("number","=",supnumber)});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue