提交 da6d20b6 authored 作者: inroi's avatar inroi

微调

上级 9bfa802b
...@@ -40,6 +40,8 @@ public class CommonHttpApi { ...@@ -40,6 +40,8 @@ public class CommonHttpApi {
public String mallAddress; public String mallAddress;
public String receiveAddress;
public Map<String, Object> header; public Map<String, Object> header;
public boolean flag = false; public boolean flag = false;
...@@ -56,6 +58,8 @@ public class CommonHttpApi { ...@@ -56,6 +58,8 @@ public class CommonHttpApi {
initConnectParam = initConnectParamMapper.selectOne(new QueryWrapper<InitConnectParam>().last("LIMIT 1")); initConnectParam = initConnectParamMapper.selectOne(new QueryWrapper<InitConnectParam>().last("LIMIT 1"));
if (StringUtil.isNotNull(initConnectParam)) { if (StringUtil.isNotNull(initConnectParam)) {
mallAddress = initConnectParam.getMallAddress(); mallAddress = initConnectParam.getMallAddress();
receiveAddress = initConnectParam.getReceiveAddress();
System.out.println(this.receiveAddress);
} }
} }
...@@ -154,13 +158,13 @@ public class CommonHttpApi { ...@@ -154,13 +158,13 @@ public class CommonHttpApi {
} }
} }
public String sendThirdParty(String receiveAddress, String data, int index) { public String sendThirdParty(String data, int index) {
try { try {
return HttpUtil.httpPost(receiveAddress, data).getBody(); return HttpUtil.httpPost(this.receiveAddress, data).getBody();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
if (index != 0) { if (index != 0) {
this.sendThirdParty(receiveAddress, data, index - 1); this.sendThirdParty( data, index - 1);
} else { } else {
//关闭同步 //关闭同步
HttpUtil.httpGet("http://integrate-system:8090/integrate/api/quartz/job/pause?jobClassName=com.system.quartz.job.MallSynchronizationJob"); HttpUtil.httpGet("http://integrate-system:8090/integrate/api/quartz/job/pause?jobClassName=com.system.quartz.job.MallSynchronizationJob");
......
...@@ -57,8 +57,8 @@ public class MallCommonSyncApi { ...@@ -57,8 +57,8 @@ public class MallCommonSyncApi {
/** /**
* 同步至第三方 * 同步至第三方
*/ */
public String sendThirdParty(String receiveAddress, String data) { public String sendThirdParty(String data) {
return commonHttpApi.sendThirdParty(receiveAddress, data, 3); return commonHttpApi.sendThirdParty(data, 1);
} }
......
...@@ -44,6 +44,12 @@ public class InitConnectParam { ...@@ -44,6 +44,12 @@ public class InitConnectParam {
/** /**
* 接收地址
*/
public String receiveAddress;
/**
* 创建时间 * 创建时间
*/ */
private String createTime; private String createTime;
...@@ -98,6 +104,14 @@ public class InitConnectParam { ...@@ -98,6 +104,14 @@ public class InitConnectParam {
this.duration = duration; this.duration = duration;
} }
public String getReceiveAddress() {
return receiveAddress;
}
public void setReceiveAddress(String receiveAddress) {
this.receiveAddress = receiveAddress;
}
public String getCreateTime() { public String getCreateTime() {
return createTime; return createTime;
} }
......
...@@ -52,13 +52,6 @@ public class IMallSyncServiceImpl implements IMallSyncService { ...@@ -52,13 +52,6 @@ public class IMallSyncServiceImpl implements IMallSyncService {
for (Map<String, String> config : configList) { for (Map<String, String> config : configList) {
String queueId = SnowFlakeIdUtil.generateId().toString(); String queueId = SnowFlakeIdUtil.generateId().toString();
//查询同步操作
Map<String, String> operation = synchronizationOperationConstants.get(Integer.valueOf(config.get("productId")), sFormId);
if (com.baomidou.mybatisplus.core.toolkit.CollectionUtils.isEmpty(operation)) {
productLogUtil.productSyncErrorLogCreate(Integer.valueOf(config.get("productId")), queueId, config.get("name") + "的同步取消", config.get("docType"), config.get("direction"), "", "表单标识为: " + sFormId + " 的表单同步操作不存在");
synchronizationRecordsMapper.synchronizationRecordsUpdate(new SynchronizationRecordsUpdateInVo(id, queueId, "sFormId为: " + sFormId + " 的同步操作不存在", 2));
return;
}
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
String customSql = config.get("customSql"); String customSql = config.get("customSql");
...@@ -78,16 +71,16 @@ public class IMallSyncServiceImpl implements IMallSyncService { ...@@ -78,16 +71,16 @@ public class IMallSyncServiceImpl implements IMallSyncService {
} }
} }
this.encapsulationRequest(config, operation, queueId, id, map); this.encapsulationRequest(config, queueId, id, map);
} }
} }
private void encapsulationRequest(Map<String, String> config, Map<String, String> operation, String queueId, Integer id, Map<String, Object> data) { private void encapsulationRequest(Map<String, String> config, String queueId, Integer id, Map<String, Object> data) {
Map<String, Object> request = new HashMap<>(3); Map<String, Object> request = new HashMap<>(3);
request.put("docType", config.get("docType")); request.put("docType", config.get("docType"));
request.put("updateType", "update"); request.put("updateType", "update");
request.put("data", JsonUtil.toList(JsonUtil.toString(data.get(Constants.DATE_NAME)), Object.class)); request.put("data", JsonUtil.toList(JsonUtil.toString(data.get(Constants.DATE_NAME)), Object.class));
String response = mallCommonSyncApi.sendThirdParty(operation.get("receiveAddress"), JsonUtil.toString(request)); String response = mallCommonSyncApi.sendThirdParty(JsonUtil.toString(request));
//记录第三方日志 //记录第三方日志
productLogUtil.productHttpLogCreate(Integer.valueOf(config.get("productId")), queueId, id, config.get("name"), config.get("docType"), config.get("direction"), JsonUtil.toString(request), response); productLogUtil.productHttpLogCreate(Integer.valueOf(config.get("productId")), queueId, id, config.get("name"), config.get("docType"), config.get("direction"), JsonUtil.toString(request), response);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论