客户接口优化
This commit is contained in:
parent
024ea6e161
commit
c304a7e581
|
|
@ -7,7 +7,7 @@ import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
import kd.sdk.plugin.Plugin;
|
import kd.sdk.plugin.Plugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单据操作插件
|
* 支付信息变更单据操作插件
|
||||||
*/
|
*/
|
||||||
public class PayinfoChangeOperation extends AbstractOperationServicePlugIn implements Plugin {
|
public class PayinfoChangeOperation extends AbstractOperationServicePlugIn implements Plugin {
|
||||||
|
|
||||||
|
|
@ -24,7 +24,7 @@ public class PayinfoChangeOperation extends AbstractOperationServicePlugIn imple
|
||||||
DynamicObject[] dos = e.getDataEntities();
|
DynamicObject[] dos = e.getDataEntities();
|
||||||
DynamicObject prinfo = null;
|
DynamicObject prinfo = null;
|
||||||
for (int i = 0; i < dos.length; i++) {
|
for (int i = 0; i < dos.length; i++) {
|
||||||
//TODO反审核操作之前系统未把info对象所有属性加载出来,尤其是二开的字段,需要在此处重新load一下
|
//TODO 反审核操作之前系统未把info对象所有属性加载出来,尤其是二开的字段,需要在此处重新load一下
|
||||||
prinfo = BusinessDataServiceHelper.loadSingle(dos[i].getPkValue(),dos[i].getDataEntityType().getName());
|
prinfo = BusinessDataServiceHelper.loadSingle(dos[i].getPkValue(),dos[i].getDataEntityType().getName());
|
||||||
if("".equals(prinfo.getString(""))){
|
if("".equals(prinfo.getString(""))){
|
||||||
e.setCancelMessage(prinfo.getString("billno")+"为费控推送的单据,不能发起收款信息变更");
|
e.setCancelMessage(prinfo.getString("billno")+"为费控推送的单据,不能发起收款信息变更");
|
||||||
|
|
|
||||||
|
|
@ -39,23 +39,22 @@ public class EsbUtils {
|
||||||
|
|
||||||
//处理分配
|
//处理分配
|
||||||
public static void handleAssign(JSONArray companysJson, Map<String, Long> cusids, String entityName) {
|
public static void handleAssign(JSONArray companysJson, Map<String, Long> cusids, String entityName) {
|
||||||
if(companysJson == null){
|
if(companysJson == null || cusids.isEmpty()){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
JSONObject json_body;
|
JSONObject json_body;
|
||||||
String compnum;
|
String compnum;
|
||||||
String cusnumber = "";
|
String cusnumber = "";//当前编号
|
||||||
|
String firstnumber = "firstnumber";//初始化编号
|
||||||
|
Long curid;//当前数据id
|
||||||
DynamicObject compinfo;
|
DynamicObject compinfo;
|
||||||
List<Long> dataList = new ArrayList<>();
|
List<Long> dataList = new ArrayList<>();
|
||||||
List<Long> orgList = new ArrayList<>();
|
List<Long> orgList = new ArrayList<>();
|
||||||
for (int i = 0; i < companysJson.size(); i++) {
|
for (int i = 0; i < companysJson.size(); i++) {
|
||||||
json_body = companysJson.getJSONObject(i);
|
json_body = companysJson.getJSONObject(i);
|
||||||
if(i == 0){
|
cusnumber = json_body.getString("code");//客户-供应商编号
|
||||||
//初始化
|
|
||||||
cusnumber = json_body.getString("code");//客户-供应商编号
|
|
||||||
}
|
|
||||||
compnum = json_body.getString("companynum");//公司编号
|
compnum = json_body.getString("companynum");//公司编号
|
||||||
if(EsbUtils.isEmpty(compnum) || "0".equals(json_body.getString("companystatus"))){
|
if(EsbUtils.isEmpty(cusnumber) || EsbUtils.isEmpty(compnum) || "0".equals(json_body.getString("companystatus"))){
|
||||||
//公司编号为空 或者 公司层面使用状态-禁用的 不处理
|
//公司编号为空 或者 公司层面使用状态-禁用的 不处理
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -64,49 +63,61 @@ public class EsbUtils {
|
||||||
if(compinfo == null){
|
if(compinfo == null){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(cusnumber.equals(json_body.getString("code"))){
|
if("firstnumber".equals(firstnumber)){
|
||||||
|
//初始化,改变初始化值
|
||||||
|
firstnumber = cusnumber;
|
||||||
|
orgList.add(compinfo.getLong("id"));
|
||||||
|
}else if(firstnumber.equals(cusnumber)){
|
||||||
//还是同一个客户
|
//还是同一个客户
|
||||||
orgList.add(compinfo.getLong("id"));
|
orgList.add(compinfo.getLong("id"));
|
||||||
}else{
|
}else{
|
||||||
//另一个客户,先处理上一个客户的分配
|
//另一个客户,先处理上一个客户的分配
|
||||||
if(!orgList.isEmpty()){
|
if(!orgList.isEmpty()){
|
||||||
|
curid = cusids.get(cusnumber);
|
||||||
|
if(curid == null){
|
||||||
|
//当前编号对应的id不存在,即上一个数据没有保存成功 不处理分配,上一个组织数据清空,增加当前组织
|
||||||
|
orgList.clear();
|
||||||
|
orgList.add(compinfo.getLong("id"));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
dataList.clear();
|
dataList.clear();
|
||||||
dataList.add(cusids.get(cusnumber));
|
dataList.add(curid);
|
||||||
BaseDataServiceHelper.batchAssignWithDetail(entityName,JhzjUtils.GROUPID,dataList,orgList);
|
BaseDataServiceHelper.batchAssignWithDetail(entityName,JhzjUtils.GROUPID,dataList,orgList);
|
||||||
//处理完成后,清空组织列表
|
//处理完成后,清空组织列表
|
||||||
orgList.clear();
|
orgList.clear();
|
||||||
orgList.add(compinfo.getLong("id"));
|
orgList.add(compinfo.getLong("id"));
|
||||||
}
|
}
|
||||||
cusnumber = json_body.getString("code");
|
firstnumber = cusnumber;
|
||||||
|
orgList.add(compinfo.getLong("id"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
curid = cusids.get(cusnumber);
|
||||||
//考虑最后一个客户的分配情况
|
//考虑最后一个客户的分配情况
|
||||||
if(!orgList.isEmpty()){
|
if(!orgList.isEmpty() && curid != null){
|
||||||
dataList.clear();
|
dataList.clear();
|
||||||
dataList.add(cusids.get(cusnumber));
|
dataList.add(curid);
|
||||||
BaseDataServiceHelper.batchAssignWithDetail(entityName,JhzjUtils.GROUPID,dataList,orgList);
|
BaseDataServiceHelper.batchAssignWithDetail(entityName,JhzjUtils.GROUPID,dataList,orgList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//处理取消分配
|
//处理取消分配
|
||||||
public static void handleUnAssign(JSONArray companysJson, Map<String, Long> cusids, String entityName) {
|
public static void handleUnAssign(JSONArray companysJson, Map<String, Long> cusids, String entityName) {
|
||||||
if(companysJson == null){
|
if(companysJson == null || cusids.isEmpty()){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
JSONObject json_body;
|
JSONObject json_body;
|
||||||
String compnum;
|
String compnum;
|
||||||
String cusnumber = "";
|
String cusnumber = "";//当前编号
|
||||||
|
String firstnumber = "firstnumber";//初始化编号
|
||||||
|
Long curid;//当前数据id
|
||||||
DynamicObject compinfo;
|
DynamicObject compinfo;
|
||||||
Set<Long> dataList = new HashSet<>();
|
Set<Long> dataList = new HashSet<>();
|
||||||
Set<Long> orgList = new HashSet<>();
|
Set<Long> orgList = new HashSet<>();
|
||||||
for (int i = 0; i < companysJson.size(); i++) {
|
for (int i = 0; i < companysJson.size(); i++) {
|
||||||
json_body = companysJson.getJSONObject(i);
|
json_body = companysJson.getJSONObject(i);
|
||||||
if(i == 0){
|
cusnumber = json_body.getString("code");//客户-供应商编号
|
||||||
//初始化
|
|
||||||
cusnumber = json_body.getString("code");//客户-供应商编号
|
|
||||||
}
|
|
||||||
compnum = json_body.getString("companynum");//公司编号
|
compnum = json_body.getString("companynum");//公司编号
|
||||||
if(EsbUtils.isEmpty(compnum) || "1".equals(json_body.getString("companystatus"))){
|
if(EsbUtils.isEmpty(cusnumber) || EsbUtils.isEmpty(compnum) || "1".equals(json_body.getString("companystatus"))){
|
||||||
//公司编号为空 或者 公司层面使用状态-启用的 不处理
|
//公司编号为空 或者 公司层面使用状态-启用的 不处理
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -115,26 +126,39 @@ public class EsbUtils {
|
||||||
if(compinfo == null){
|
if(compinfo == null){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(cusnumber.equals(json_body.getString("code"))){
|
if("firstnumber".equals(firstnumber)){
|
||||||
|
//初始化,改变初始化值
|
||||||
|
firstnumber = cusnumber;
|
||||||
|
orgList.add(compinfo.getLong("id"));
|
||||||
|
}else if(firstnumber.equals(cusnumber)){
|
||||||
//还是同一个客户
|
//还是同一个客户
|
||||||
orgList.add(compinfo.getLong("id"));
|
orgList.add(compinfo.getLong("id"));
|
||||||
}else{
|
}else{
|
||||||
//另一个客户,先处理上一个客户的取消分配
|
//另一个客户,先处理上一个客户的取消分配
|
||||||
if(!orgList.isEmpty()){
|
if(!orgList.isEmpty()){
|
||||||
|
curid = cusids.get(cusnumber);
|
||||||
|
if(curid == null){
|
||||||
|
//当前编号对应的id不存在,即上一个数据没有保存成功 不处理取消分配,上一个组织数据清空,增加当前组织
|
||||||
|
orgList.clear();
|
||||||
|
orgList.add(compinfo.getLong("id"));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
dataList.clear();
|
dataList.clear();
|
||||||
dataList.add(cusids.get(cusnumber));
|
dataList.add(curid);
|
||||||
BaseDataServiceHelper.cancelAssign(entityName,dataList,orgList);
|
BaseDataServiceHelper.cancelAssign(entityName,dataList,orgList);
|
||||||
//处理完成后,清空组织列表
|
//处理完成后,清空上一个组织列表,增加当前组织
|
||||||
orgList.clear();
|
orgList.clear();
|
||||||
orgList.add(compinfo.getLong("id"));
|
orgList.add(compinfo.getLong("id"));
|
||||||
}
|
}
|
||||||
cusnumber = json_body.getString("code");
|
firstnumber = cusnumber;
|
||||||
|
orgList.add(compinfo.getLong("id"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
curid = cusids.get(cusnumber);
|
||||||
//考虑最后一个客户的取消分配情况
|
//考虑最后一个客户的取消分配情况
|
||||||
if(!orgList.isEmpty()){
|
if(!orgList.isEmpty() && curid != null){
|
||||||
dataList.clear();
|
dataList.clear();
|
||||||
dataList.add(cusids.get(cusnumber));
|
dataList.add(curid);
|
||||||
BaseDataServiceHelper.cancelAssign(entityName,dataList,orgList);
|
BaseDataServiceHelper.cancelAssign(entityName,dataList,orgList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -157,6 +157,9 @@ public class CustomerControler {
|
||||||
//处理 客户组5
|
//处理 客户组5
|
||||||
handleFive(customerfivesJson,currentCus.getDynamicObjectCollection("shjh_entry_five"),cusnumber);
|
handleFive(customerfivesJson,currentCus.getDynamicObjectCollection("shjh_entry_five"),cusnumber);
|
||||||
//TODO 银行信息
|
//TODO 银行信息
|
||||||
|
if(!"M400".equals(type)){
|
||||||
|
handleBank(banksJson,currentCus.getDynamicObjectCollection("entry_bank"),cusnumber);
|
||||||
|
}
|
||||||
SaveServiceHelper.save(new DynamicObject[]{currentCus});
|
SaveServiceHelper.save(new DynamicObject[]{currentCus});
|
||||||
}
|
}
|
||||||
cusids.put(cusnumber,currentSupId);
|
cusids.put(cusnumber,currentSupId);
|
||||||
|
|
@ -186,8 +189,12 @@ public class CustomerControler {
|
||||||
json_body = customerfivesJson.getJSONObject(i);
|
json_body = customerfivesJson.getJSONObject(i);
|
||||||
if(cusnumber.equals(json_body.getString("code"))){
|
if(cusnumber.equals(json_body.getString("code"))){
|
||||||
fiveinfo = doc_five.addNew();
|
fiveinfo = doc_five.addNew();
|
||||||
|
fiveinfo.set("shjh_channelnum",json_body.getString("channelnum"));//渠道编号
|
||||||
|
fiveinfo.set("shjh_channelname",json_body.getString("channelname"));//渠道名称
|
||||||
|
fiveinfo.set("shjh_salecompanynum",json_body.getString("salecompanynum"));//公司编号
|
||||||
fiveinfo.set("shjh_entryfive_number",json_body.getString("customerfivecode"));//编号
|
fiveinfo.set("shjh_entryfive_number",json_body.getString("customerfivecode"));//编号
|
||||||
fiveinfo.set("shjh_entryfive_name",json_body.getString("customerfivename"));//名称
|
fiveinfo.set("shjh_entryfive_name",json_body.getString("customerfivename"));//名称
|
||||||
|
fiveinfo.set("shjh_status",json_body.getString("customerfivestatus"));//状态
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -196,6 +203,7 @@ public class CustomerControler {
|
||||||
if(banksJson == null){
|
if(banksJson == null){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
doc_bank.clear();
|
||||||
JSONObject json_body;
|
JSONObject json_body;
|
||||||
DynamicObject bankinfo;
|
DynamicObject bankinfo;
|
||||||
DynamicObject bebankinfo;
|
DynamicObject bebankinfo;
|
||||||
|
|
|
||||||
|
|
@ -183,6 +183,14 @@ public class CustomerModel implements Serializable {
|
||||||
private String customerfivecode;
|
private String customerfivecode;
|
||||||
@ApiParam(value="客户组5名称",position=3)
|
@ApiParam(value="客户组5名称",position=3)
|
||||||
private String customerfivename;
|
private String customerfivename;
|
||||||
|
@ApiParam(value="分销渠道编号",position=4)
|
||||||
|
private String channelnum;
|
||||||
|
@ApiParam(value="分销渠道名称",position=5)
|
||||||
|
private String channelname;
|
||||||
|
@ApiParam(value="销售公司编号",position=6)
|
||||||
|
private String salecompanynum;
|
||||||
|
@ApiParam(value="客户组5使用状态",position=7)
|
||||||
|
private String customerfivestatus;
|
||||||
|
|
||||||
public String getCode() {
|
public String getCode() {
|
||||||
return code;
|
return code;
|
||||||
|
|
@ -207,6 +215,38 @@ public class CustomerModel implements Serializable {
|
||||||
public void setCustomerfivename(String customerfivename) {
|
public void setCustomerfivename(String customerfivename) {
|
||||||
this.customerfivename = customerfivename;
|
this.customerfivename = customerfivename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getChannelnum() {
|
||||||
|
return channelnum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChannelnum(String channelnum) {
|
||||||
|
this.channelnum = channelnum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getChannelname() {
|
||||||
|
return channelname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChannelname(String channelname) {
|
||||||
|
this.channelname = channelname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSalecompanynum() {
|
||||||
|
return salecompanynum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSalecompanynum(String salecompanynum) {
|
||||||
|
this.salecompanynum = salecompanynum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCustomerfivestatus() {
|
||||||
|
return customerfivestatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCustomerfivestatus(String customerfivestatus) {
|
||||||
|
this.customerfivestatus = customerfivestatus;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiModel
|
@ApiModel
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue