Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
M
mall-adapter
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
inroi
mall-adapter
Commits
da6d20b6
提交
da6d20b6
authored
11月 29, 2022
作者:
inroi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
微调
上级
9bfa802b
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
26 行增加
和
15 行删除
+26
-15
CommonHttpApi.java
src/main/java/com/system/api/CommonHttpApi.java
+7
-3
MallCommonSyncApi.java
src/main/java/com/system/mall/MallCommonSyncApi.java
+2
-2
InitConnectParam.java
src/main/java/com/system/model/InitConnectParam.java
+14
-0
IMallSyncServiceImpl.java
...in/java/com/system/serivce/impl/IMallSyncServiceImpl.java
+3
-10
没有找到文件。
src/main/java/com/system/api/CommonHttpApi.java
浏览文件 @
da6d20b6
...
...
@@ -40,6 +40,8 @@ public class CommonHttpApi {
public
String
mallAddress
;
public
String
receiveAddress
;
public
Map
<
String
,
Object
>
header
;
public
boolean
flag
=
false
;
...
...
@@ -56,6 +58,8 @@ public class CommonHttpApi {
initConnectParam
=
initConnectParamMapper
.
selectOne
(
new
QueryWrapper
<
InitConnectParam
>().
last
(
"LIMIT 1"
));
if
(
StringUtil
.
isNotNull
(
initConnectParam
))
{
mallAddress
=
initConnectParam
.
getMallAddress
();
receiveAddress
=
initConnectParam
.
getReceiveAddress
();
System
.
out
.
println
(
this
.
receiveAddress
);
}
}
...
...
@@ -154,13 +158,13 @@ public class CommonHttpApi {
}
}
public
String
sendThirdParty
(
String
receiveAddress
,
String
data
,
int
index
)
{
public
String
sendThirdParty
(
String
data
,
int
index
)
{
try
{
return
HttpUtil
.
httpPost
(
receiveAddress
,
data
).
getBody
();
return
HttpUtil
.
httpPost
(
this
.
receiveAddress
,
data
).
getBody
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
if
(
index
!=
0
)
{
this
.
sendThirdParty
(
receiveAddress
,
data
,
index
-
1
);
this
.
sendThirdParty
(
data
,
index
-
1
);
}
else
{
//关闭同步
HttpUtil
.
httpGet
(
"http://integrate-system:8090/integrate/api/quartz/job/pause?jobClassName=com.system.quartz.job.MallSynchronizationJob"
);
...
...
src/main/java/com/system/mall/MallCommonSyncApi.java
浏览文件 @
da6d20b6
...
...
@@ -57,8 +57,8 @@ public class MallCommonSyncApi {
/**
* 同步至第三方
*/
public
String
sendThirdParty
(
String
receiveAddress
,
String
data
)
{
return
commonHttpApi
.
sendThirdParty
(
receiveAddress
,
data
,
3
);
public
String
sendThirdParty
(
String
data
)
{
return
commonHttpApi
.
sendThirdParty
(
data
,
1
);
}
...
...
src/main/java/com/system/model/InitConnectParam.java
浏览文件 @
da6d20b6
...
...
@@ -44,6 +44,12 @@ public class InitConnectParam {
/**
* 接收地址
*/
public
String
receiveAddress
;
/**
* 创建时间
*/
private
String
createTime
;
...
...
@@ -98,6 +104,14 @@ public class InitConnectParam {
this
.
duration
=
duration
;
}
public
String
getReceiveAddress
()
{
return
receiveAddress
;
}
public
void
setReceiveAddress
(
String
receiveAddress
)
{
this
.
receiveAddress
=
receiveAddress
;
}
public
String
getCreateTime
()
{
return
createTime
;
}
...
...
src/main/java/com/system/serivce/impl/IMallSyncServiceImpl.java
浏览文件 @
da6d20b6
...
...
@@ -52,13 +52,6 @@ public class IMallSyncServiceImpl implements IMallSyncService {
for
(
Map
<
String
,
String
>
config
:
configList
)
{
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
<>();
String
customSql
=
config
.
get
(
"customSql"
);
...
...
@@ -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
);
request
.
put
(
"docType"
,
config
.
get
(
"docType"
));
request
.
put
(
"updateType"
,
"update"
);
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
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论