客户接口优化2
This commit is contained in:
parent
f52ba0e883
commit
81a066a120
|
|
@ -10,6 +10,7 @@ import kd.bos.context.RequestContext;
|
|||
import kd.bos.dataentity.OperateOption;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.entity.operate.result.OperationResult;
|
||||
import kd.bos.id.ID;
|
||||
import kd.bos.logging.Log;
|
||||
import kd.bos.logging.LogFactory;
|
||||
|
|
@ -79,6 +80,7 @@ public class CustomerControler {
|
|||
Map<String, Long> cusids = new HashMap<>();//客户编号和ID对应关系
|
||||
OperateOption oop = OperateOption.create();
|
||||
DynamicObject grouporginfo = EsbUtils.getGroupOrg();
|
||||
OperationResult operResult;
|
||||
for (int i = 0; i < detailsJson.size(); i++) {
|
||||
json_body = detailsJson.getJSONObject(i);
|
||||
cusnumber = json_body.getString("code");
|
||||
|
|
@ -120,8 +122,8 @@ public class CustomerControler {
|
|||
currentCus.set("org", grouporginfo);//管理组织 默认为集团
|
||||
currentCus.set("ctrlstrategy","1");//控制策略 默认逐级分配1 自由分配2
|
||||
currentCus.set("group",custype.getLong("id"));//客户分组
|
||||
// currentCus.set("bitindex",1);//位图
|
||||
currentCus.set("customerstatus",EsbUtils.CUSTOMERSTATUS);//客户状态
|
||||
// currentCus.set("bitindex",1);//位图-保存自动填充
|
||||
// currentCus.set("customerstatus",EsbUtils.CUSTOMERSTATUS);//客户状态-保存自动填充
|
||||
currentCus.set("name",cusname);//客户名称
|
||||
currentCus.set("tx_register_no",taxno);//税务登记号
|
||||
currentCus.set("societycreditcode",taxno);//统一社会信用代码
|
||||
|
|
@ -143,7 +145,14 @@ public class CustomerControler {
|
|||
|
||||
//保存客户-必须调用保存操作,否则不符合受控基础资料开发规范
|
||||
// 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.set("createorg",JhzjUtils.GROUPID);//创建组织
|
||||
|
|
@ -165,7 +174,14 @@ public class CustomerControler {
|
|||
if(!"M400".equals(type)){
|
||||
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);
|
||||
}
|
||||
|
|
@ -240,6 +256,12 @@ public class CustomerControler {
|
|||
for (int i = 0; i < banksJson.size(); i++) {
|
||||
json_body = banksJson.getJSONObject(i);
|
||||
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 = getBankInfo(doc_bank,json_body.getString("banknumber"));
|
||||
if(bankinfo == null){
|
||||
bankinfo = doc_bank.addNew();
|
||||
|
|
@ -251,11 +273,8 @@ public class CustomerControler {
|
|||
}else{
|
||||
bankinfo.set("accountname",json_body.getString("acctname"));//账户名称
|
||||
}
|
||||
//根据详细分机银行 查找对应的行名行号
|
||||
bebankinfo = BusinessDataServiceHelper.loadSingleFromCache(bebankName,"id,name",new QFilter[]{new QFilter("name","=",json_body.getString("bankname"))});
|
||||
if(bebankinfo != null){
|
||||
bankinfo.set("bank",bebankinfo.getLong("id"));//开户银行-行名行号 根据入参查找
|
||||
}
|
||||
|
||||
bankinfo.set("bank",bebankinfo);//开户银行-行名行号 根据入参查找
|
||||
bankinfo.set("currency", JhzjUtils.CNY);//币别 默认人民币
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue