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