增加供应商同步更新插件
This commit is contained in:
parent
e43c8d6ac5
commit
543abfd826
|
@ -58,7 +58,7 @@ public class WsCustomerSynchronizationEventPluginInitializer extends PluginBaseE
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
logger.info("======客商档案同步失败:{}========",e.getMessage());
|
logger.info("======客商档案同步失败:{}========",e.getMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
return BaseResult.getFailureMessageEntity("======客商档案同步失败:{}========",e.getMessage());
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,6 @@ public class WsCustomerSynchronizationEventServiceImpl extends BaseService<WsCus
|
||||||
String field0007 = formBean.getString("field0007");
|
String field0007 = formBean.getString("field0007");
|
||||||
JSONObject requestJson = new JSONObject();
|
JSONObject requestJson = new JSONObject();
|
||||||
requestJson.put("custname",field0006);
|
requestJson.put("custname",field0006);
|
||||||
requestJson.put("taxpayer",field0007);
|
|
||||||
String body = requestApi("validateCustomerName",requestJson, "800054","8000540095",null);
|
String body = requestApi("validateCustomerName",requestJson, "800054","8000540095",null);
|
||||||
JSONObject req = JSON.parseObject(body);
|
JSONObject req = JSON.parseObject(body);
|
||||||
boolean flag = req.getBoolean("flag");
|
boolean flag = req.getBoolean("flag");
|
||||||
|
@ -85,9 +84,30 @@ public class WsCustomerSynchronizationEventServiceImpl extends BaseService<WsCus
|
||||||
JSONObject detailsData = attribute.getJSONObject("data");
|
JSONObject detailsData = attribute.getJSONObject("data");
|
||||||
Integer allcount = detailsData.getInteger("allcount");
|
Integer allcount = detailsData.getInteger("allcount");
|
||||||
if(allcount>0){
|
if(allcount>0){
|
||||||
return BaseResult.getFailureMessageEntity("客商名称+纳税人识别号重复!");
|
return BaseResult.getFailureMessageEntity("客商名称重复!");
|
||||||
}else{
|
}else{
|
||||||
return BaseResult.getSuccessMessageEntity("客商未重复!");
|
requestJson = new JSONObject();
|
||||||
|
requestJson.put("taxpayer",field0007);
|
||||||
|
body = requestApi("validateCustomerName",requestJson, "800054","8000540095",null);
|
||||||
|
req = JSON.parseObject(body);
|
||||||
|
flag = req.getBoolean("flag");
|
||||||
|
if(flag){
|
||||||
|
attribute = req.getJSONObject("attribute");
|
||||||
|
status = attribute.getString("status");
|
||||||
|
if("success".equals(status)){
|
||||||
|
detailsData = attribute.getJSONObject("data");
|
||||||
|
allcount = detailsData.getInteger("allcount");
|
||||||
|
if(allcount>0){
|
||||||
|
return BaseResult.getFailureMessageEntity("纳税人识别号重复!");
|
||||||
|
}else{
|
||||||
|
return BaseResult.getSuccessMessageEntity("客商未重复!");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return BaseResult.getFailureMessageEntity("转发失败!");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return BaseResult.getFailureMessageEntity("转发失败!"+req.getString("msg"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
return BaseResult.getFailureMessageEntity("转发失败!");
|
return BaseResult.getFailureMessageEntity("转发失败!");
|
||||||
|
@ -97,6 +117,10 @@ public class WsCustomerSynchronizationEventServiceImpl extends BaseService<WsCus
|
||||||
return BaseResult.getFailureMessageEntity("转发失败!"+req.getString("msg"));
|
return BaseResult.getFailureMessageEntity("转发失败!"+req.getString("msg"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -131,7 +155,7 @@ public class WsCustomerSynchronizationEventServiceImpl extends BaseService<WsCus
|
||||||
pk_cubasdoc = returnData.getJSONObject(0).getJSONObject("parentvo").getString("pk_cubasdoc");
|
pk_cubasdoc = returnData.getJSONObject(0).getJSONObject("parentvo").getString("pk_cubasdoc");
|
||||||
String custcode = returnData.getJSONObject(0).getJSONObject("parentvo").getString("custcode");
|
String custcode = returnData.getJSONObject(0).getJSONObject("parentvo").getString("custcode");
|
||||||
//执行客商档案编码回传OA
|
//执行客商档案编码回传OA
|
||||||
updateCustomerCode(custcode);
|
updateCustomerCode(formBean.getString("id"),custcode);
|
||||||
|
|
||||||
}
|
}
|
||||||
logger.info("客商新增成功!返回数据",body);
|
logger.info("客商新增成功!返回数据",body);
|
||||||
|
@ -169,8 +193,8 @@ public class WsCustomerSynchronizationEventServiceImpl extends BaseService<WsCus
|
||||||
* @param
|
* @param
|
||||||
* @return com.alibaba.fastjson.JSONObject
|
* @return com.alibaba.fastjson.JSONObject
|
||||||
**/
|
**/
|
||||||
private JSONObject updateCustomerCode(String code) {
|
private JSONObject updateCustomerCode(String id,String custcode) {
|
||||||
String sql="update formmain_0013 set field0002 = '222' where id = '-1747569164838812797' ";
|
String sql="update formmain_4389 set field0005 = '"+custcode+"' where id = "+id;
|
||||||
String md5 = SecureUtil.md5(sql);
|
String md5 = SecureUtil.md5(sql);
|
||||||
System.out.println("明文摘要"+md5);
|
System.out.println("明文摘要"+md5);
|
||||||
String key = "`o7eotan9ws8c:aj";
|
String key = "`o7eotan9ws8c:aj";
|
||||||
|
@ -178,8 +202,8 @@ public class WsCustomerSynchronizationEventServiceImpl extends BaseService<WsCus
|
||||||
JSONObject requestJson = new JSONObject();
|
JSONObject requestJson = new JSONObject();
|
||||||
requestJson.put("userName","hzya_rest");
|
requestJson.put("userName","hzya_rest");
|
||||||
requestJson.put("password","45562434-8459-47b4-8df0-78fad8405bc4");
|
requestJson.put("password","45562434-8459-47b4-8df0-78fad8405bc4");
|
||||||
requestJson.put("data",md5);
|
requestJson.put("data",encrypt);
|
||||||
requestJson.put("sign",encrypt);
|
requestJson.put("sign",md5);
|
||||||
String tokenRest = requestApi("获取token", requestJson,"800055", "8000550010",null);
|
String tokenRest = requestApi("获取token", requestJson,"800055", "8000550010",null);
|
||||||
String token = JSON.parseObject(tokenRest).getJSONObject("attribute").getString("id");
|
String token = JSON.parseObject(tokenRest).getJSONObject("attribute").getString("id");
|
||||||
String result = requestApi("更新A8客商档案", requestJson,"800055", "8000550000",token);
|
String result = requestApi("更新A8客商档案", requestJson,"800055", "8000550000",token);
|
||||||
|
@ -205,52 +229,10 @@ public class WsCustomerSynchronizationEventServiceImpl extends BaseService<WsCus
|
||||||
//客商档案
|
//客商档案
|
||||||
JSONObject customer = new JSONObject();
|
JSONObject customer = new JSONObject();
|
||||||
//币种类别
|
//币种类别
|
||||||
String pk_currtype = formBean.getString("field0028");
|
String pk_currtype = formBean.getString("field0057");
|
||||||
switch (pk_currtype){
|
|
||||||
case "-4050088431526461175":
|
|
||||||
//欧元
|
|
||||||
pk_currtype = "EUR";
|
|
||||||
break;
|
|
||||||
case "-715249687436703161":
|
|
||||||
//港币
|
|
||||||
pk_currtype = "HKD";
|
|
||||||
break;
|
|
||||||
case "-608291659984190122":
|
|
||||||
//日元
|
|
||||||
pk_currtype = "IPY";
|
|
||||||
break;
|
|
||||||
case "-7769974812583704757":
|
|
||||||
//英镑
|
|
||||||
pk_currtype = "GBP";
|
|
||||||
break;
|
|
||||||
case "169453635852845727":
|
|
||||||
//新台币
|
|
||||||
pk_currtype = "NTD";
|
|
||||||
break;
|
|
||||||
case "-4870779097911440184":
|
|
||||||
//比素
|
|
||||||
pk_currtype = "MXN";
|
|
||||||
break;
|
|
||||||
case "-3124898727237565150":
|
|
||||||
//人民币
|
|
||||||
pk_currtype = "CNY";
|
|
||||||
break;
|
|
||||||
case "-7439566099063946667":
|
|
||||||
//美元
|
|
||||||
pk_currtype = "USD.";
|
|
||||||
break;
|
|
||||||
case "-5937286571420073707":
|
|
||||||
//泰铢
|
|
||||||
pk_currtype = "THB";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
pk_currtype = null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
customer.put("pk_currtype1",pk_currtype);
|
customer.put("pk_currtype1",pk_currtype);
|
||||||
//公司 TODO 修改为取编码 pk_corp
|
//分配公司
|
||||||
// customer.put("pk_corp",formBean.getString("field0056"));
|
customer.put("pk_corp",formBean.getString("field0064"));
|
||||||
customer.put("pk_corp",formBean.getString("field0056"));
|
|
||||||
String custprop = formBean.getString("field0027");
|
String custprop = formBean.getString("field0027");
|
||||||
//客商属性 0:客户,1:供应商,2 :客商
|
//客商属性 0:客户,1:供应商,2 :客商
|
||||||
switch (custprop){
|
switch (custprop){
|
||||||
|
@ -303,7 +285,7 @@ public class WsCustomerSynchronizationEventServiceImpl extends BaseService<WsCus
|
||||||
}
|
}
|
||||||
|
|
||||||
/****
|
/****
|
||||||
* 绑定OA和U8C客商参数
|
* 绑定客商新增OA和U8C客商参数
|
||||||
* @content:
|
* @content:
|
||||||
* @author 👻👻👻👻👻👻👻👻 gjh
|
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||||
* @date 2025-03-04 10:53
|
* @date 2025-03-04 10:53
|
||||||
|
@ -328,57 +310,18 @@ public class WsCustomerSynchronizationEventServiceImpl extends BaseService<WsCus
|
||||||
//开户银行
|
//开户银行
|
||||||
bank.put("pk_bankdoc", formBean.getString("field0013"));
|
bank.put("pk_bankdoc", formBean.getString("field0013"));
|
||||||
//银行类别 TODO 修改为取编码
|
//银行类别 TODO 修改为取编码
|
||||||
bank.put("banktypename", formBean.getString("field0014"));
|
// bank.put("banktypename", formBean.getString("field0014"));
|
||||||
//公司 TODO 修改为取编码 pk_corp
|
bank.put("banktypename", formBean.getString("field0036"));
|
||||||
bank.put("pk_corp",formBean.getString("field0056"));
|
//新增固定传递集团
|
||||||
|
bank.put("pk_corp",formBean.getString("0001"));
|
||||||
//币种类别
|
//币种类别
|
||||||
String pk_currtype = formBean.getString("field0028");
|
String pk_currtype = formBean.getString("field0057");
|
||||||
switch (pk_currtype){
|
|
||||||
case "-4050088431526461175":
|
|
||||||
//欧元
|
|
||||||
pk_currtype = "EUR";
|
|
||||||
break;
|
|
||||||
case "-715249687436703161":
|
|
||||||
//港币
|
|
||||||
pk_currtype = "HKD";
|
|
||||||
break;
|
|
||||||
case "-608291659984190122":
|
|
||||||
//日元
|
|
||||||
pk_currtype = "IPY";
|
|
||||||
break;
|
|
||||||
case "-7769974812583704757":
|
|
||||||
//英镑
|
|
||||||
pk_currtype = "GBP";
|
|
||||||
break;
|
|
||||||
case "169453635852845727":
|
|
||||||
//新台币
|
|
||||||
pk_currtype = "NTD";
|
|
||||||
break;
|
|
||||||
case "-4870779097911440184":
|
|
||||||
//比素
|
|
||||||
pk_currtype = "MXN";
|
|
||||||
break;
|
|
||||||
case "-3124898727237565150":
|
|
||||||
//人民币
|
|
||||||
pk_currtype = "CNY";
|
|
||||||
break;
|
|
||||||
case "-7439566099063946667":
|
|
||||||
//美元
|
|
||||||
pk_currtype = "USD.";
|
|
||||||
break;
|
|
||||||
case "-5937286571420073707":
|
|
||||||
//泰铢
|
|
||||||
pk_currtype = "THB";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
pk_currtype = null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
bank.put("pk_currtype",pk_currtype);
|
bank.put("pk_currtype",pk_currtype);
|
||||||
banks.add(bank);
|
banks.add(bank);
|
||||||
JSONObject parentvo = new JSONObject();
|
JSONObject parentvo = new JSONObject();
|
||||||
//创建人 TODO 修改为取编码
|
//创建人 TODO 修改为取编码
|
||||||
parentvo.put("creator",formBean.getString("field0019"));
|
// parentvo.put("creator",formBean.getString("field0019"));
|
||||||
|
parentvo.put("creator","20200124");
|
||||||
//客商名称
|
//客商名称
|
||||||
parentvo.put("custname",formBean.getString("field0006"));
|
parentvo.put("custname",formBean.getString("field0006"));
|
||||||
|
|
||||||
|
@ -406,7 +349,7 @@ public class WsCustomerSynchronizationEventServiceImpl extends BaseService<WsCus
|
||||||
//客商简称
|
//客商简称
|
||||||
parentvo.put("custshortname",formBean.getString("field0001"));
|
parentvo.put("custshortname",formBean.getString("field0001"));
|
||||||
//币种
|
//币种
|
||||||
parentvo.put("def1111",formBean.getString("field0028"));
|
parentvo.put("def1111",formBean.getString("field0057"));
|
||||||
//邮箱
|
//邮箱
|
||||||
parentvo.put("email",formBean.getString("field0052"));
|
parentvo.put("email",formBean.getString("field0052"));
|
||||||
//联系人1
|
//联系人1
|
||||||
|
@ -415,11 +358,9 @@ public class WsCustomerSynchronizationEventServiceImpl extends BaseService<WsCus
|
||||||
//手机
|
//手机
|
||||||
parentvo.put("mobilephone1",formBean.getString("field0008"));
|
parentvo.put("mobilephone1",formBean.getString("field0008"));
|
||||||
//所属地区编码 TODO 修改为取编码
|
//所属地区编码 TODO 修改为取编码
|
||||||
parentvo.put("pk_areacl",formBean.getString("field0034"));
|
parentvo.put("pk_areacl",formBean.getString("field0062"));
|
||||||
//对应公司
|
|
||||||
parentvo.put("pk_corp1",formBean.getString("field0056"));
|
|
||||||
//总公司名称 TODO 修改为取编码
|
//总公司名称 TODO 修改为取编码
|
||||||
parentvo.put("pk_cubasdoc1",formBean.getString("field0022"));
|
parentvo.put("pk_cubasdoc1",formBean.getString("field0034"));
|
||||||
//纳税人识别号
|
//纳税人识别号
|
||||||
parentvo.put("taxpayerid",formBean.getString("field0007"));
|
parentvo.put("taxpayerid",formBean.getString("field0007"));
|
||||||
customer.put("parentvo",parentvo);
|
customer.put("parentvo",parentvo);
|
||||||
|
|
Loading…
Reference in New Issue