Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
H
huazheng-project-flink
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
huazheng
huazheng-project-flink
Commits
5703a8cb
提交
5703a8cb
authored
2月 23, 2021
作者:
think
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
vbep任务
上级
4d947ced
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
80 行增加
和
0 行删除
+80
-0
GPMapper.java
.../java/com/huazheng/project/greenplum/mapper/GPMapper.java
+1
-0
DeleteUpdateJobServiceImpl.java
...ct/greenplum/service/impl/DeleteUpdateJobServiceImpl.java
+65
-0
GPMapper_greenplum.xml
src/main/resources/mapper/greenplum/GPMapper_greenplum.xml
+4
-0
spring-init.xml
src/main/resources/spring-init.xml
+10
-0
没有找到文件。
src/main/java/com/huazheng/project/greenplum/mapper/GPMapper.java
浏览文件 @
5703a8cb
...
@@ -342,6 +342,7 @@ public interface GPMapper {
...
@@ -342,6 +342,7 @@ public interface GPMapper {
@CacheEvict
(
key
=
"'selectVbep'+':'+#p0.vbeln+','+#p0.posnr+','+#p0.etenr+','+#p0.mandt"
)
@CacheEvict
(
key
=
"'selectVbep'+':'+#p0.vbeln+','+#p0.posnr+','+#p0.etenr+','+#p0.mandt"
)
public
void
deleteVbep
(
Vbep
vbep
);
public
void
deleteVbep
(
Vbep
vbep
);
public
List
<
Vbep
>
selectVbepCheck
(
Vbep
build
);
public
List
<
Vbep
>
selectVbepCheck
(
Vbep
build
);
public
Long
selectVbepMaxRowNum
();
@Cacheable
(
key
=
"#root.method.name+':'+#p0.vbeln+','+#p0.posnr+','+#p0.mandt+','+#p0.parvw"
,
unless
=
"#result == null"
)
@Cacheable
(
key
=
"#root.method.name+':'+#p0.vbeln+','+#p0.posnr+','+#p0.mandt+','+#p0.parvw"
,
unless
=
"#result == null"
)
public
Vbpa
selectVbpa
(
Vbpa
vbpa
);
// 查询替代删除
public
Vbpa
selectVbpa
(
Vbpa
vbpa
);
// 查询替代删除
...
...
src/main/java/com/huazheng/project/greenplum/service/impl/DeleteUpdateJobServiceImpl.java
浏览文件 @
5703a8cb
...
@@ -31,6 +31,7 @@ import com.huazheng.project.hana.model.Tspat;
...
@@ -31,6 +31,7 @@ import com.huazheng.project.hana.model.Tspat;
import
com.huazheng.project.hana.model.Tvkbt
;
import
com.huazheng.project.hana.model.Tvkbt
;
import
com.huazheng.project.hana.model.Vbak
;
import
com.huazheng.project.hana.model.Vbak
;
import
com.huazheng.project.hana.model.Vbap
;
import
com.huazheng.project.hana.model.Vbap
;
import
com.huazheng.project.hana.model.Vbep
;
import
com.huazheng.project.hana.model.Zsd06
;
import
com.huazheng.project.hana.model.Zsd06
;
import
com.huazheng.project.mssql.mapper.CrmMapper
;
import
com.huazheng.project.mssql.mapper.CrmMapper
;
import
com.huazheng.project.mssql.model.SalesContractProcessMX
;
import
com.huazheng.project.mssql.model.SalesContractProcessMX
;
...
@@ -1658,4 +1659,68 @@ public class DeleteUpdateJobServiceImpl {
...
@@ -1658,4 +1659,68 @@ public class DeleteUpdateJobServiceImpl {
}
}
}
}
public
void
selectVbepCheck
()
{
try
{
ValueOperations
<
String
,
String
>
opsForValue
=
redis1Template
.
opsForValue
();
opsForValue
.
setIfAbsent
(
"huazheng:check:Vbep:rowNum"
,
"0"
);
String
rowNum
=
opsForValue
.
get
(
"huazheng:check:Vbep:rowNum"
);
// 一次性任务的终止位
if
(
redis1Template
.
hasKey
(
"huazheng:check:Vbep:stopNum"
)
==
false
)
{
// 查询最大计数器
String
maxRowNum
=
gpMapper
.
selectVbepMaxRowNum
().
toString
();
opsForValue
.
setIfAbsent
(
"huazheng:check:Vbep:stopNum"
,
maxRowNum
);
}
Long
stopNum
=
Long
.
parseLong
(
opsForValue
.
get
(
"huazheng:check:Vbep:stopNum"
));
if
(
stopNum
<
Long
.
parseLong
(
rowNum
))
{
JobKey
jobKey
=
JobKey
.
jobKey
(
"selectVbepCheck_once"
,
"DEFAULT"
);
// 删除任务
quartzScheduler
.
deleteJob
(
jobKey
);
return
;
}
Vbep
build
=
Vbep
.
builder
().
rowNum
(
rowNum
).
build
();
List
<
Vbep
>
list
=
gpMapper
.
selectVbepCheck
(
build
);
// 从数仓中查询一组数据
if
(
list
.
size
()
==
0
)
{
JobKey
jobKey
=
JobKey
.
jobKey
(
"selectVbepCheck_once"
,
"DEFAULT"
);
// 删除任务
quartzScheduler
.
deleteJob
(
jobKey
);
return
;
}
list
.
forEach
(
target
->
{
// 遍历要检查的数据
Vbep
source
=
sapMapper
.
selectVbepById
(
target
);
// 根据主键查询源库中的数据
String
operator
=
"none"
;
if
(
source
==
null
)
{
// 如果源库中没有数据
gpMapper
.
deleteVbep
(
target
);
// 删除数仓中的数据
operator
=
"delete"
;
}
else
{
// 源库中有数据
String
shash
=
SecureUtil
.
md5
(
JSONUtil
.
toJsonStr
(
source
));
// 源库中数据的hash结果
String
thash
=
target
.
getHashResult
();
// 数仓中数据的hash结果
if
(!
shash
.
equals
(
thash
))
{
// 如果hash结果不一致
source
.
setHashResult
(
shash
);
// ===============================
if
(
source
.
getEdatu
()
!=
null
)
{
String
erdat2
=
new
StringBuffer
(
source
.
getEdatu
()).
insert
(
4
,
"-"
).
insert
(
7
,
"-"
).
toString
();
Date
date
=
DateUtil
.
parse
(
erdat2
);
source
.
setEdatu1
(
date
);
}
// ===============================
while
(
true
)
{
try
{
gpMapper
.
updateVbep
(
source
);
// 更新数据到数仓中
break
;
}
catch
(
RuntimeException
e
)
{
log
.
error
(
e
.
getMessage
());
ThreadUtil
.
safeSleep
(
500
);
}
}
ThreadUtil
.
safeSleep
(
500
);
}
}
redis1Template
.
opsForValue
().
set
(
"huazheng:check:Vbep:rowNum"
,
target
.
getRowNum
());
if
(!
operator
.
equals
(
"none"
))
{
log
.
info
(
String
.
format
(
"selectVbepCheck --> rowNum:%s, operator:%s"
,
target
.
getRowNum
(),
operator
));
}
});
}
catch
(
Exception
e
)
{
redis1Template
.
opsForValue
().
set
(
"huazheng:checkError:Vbep:rowNum"
,
getErrorInfoFromException
(
e
));
}
}
}
}
src/main/resources/mapper/greenplum/GPMapper_greenplum.xml
浏览文件 @
5703a8cb
...
@@ -1194,6 +1194,10 @@
...
@@ -1194,6 +1194,10 @@
<select
id=
"selectVbepCheck"
parameterType=
"com.huazheng.project.hana.model.Vbep"
resultType=
"com.huazheng.project.hana.model.Vbep"
>
<select
id=
"selectVbepCheck"
parameterType=
"com.huazheng.project.hana.model.Vbep"
resultType=
"com.huazheng.project.hana.model.Vbep"
>
select * from Vbep where rownum
>
#{rowNum} order by rownum limit 20
select * from Vbep where rownum
>
#{rowNum} order by rownum limit 20
</select>
</select>
<select
id=
"selectVbepMaxRowNum"
resultType=
"long"
>
select max(rowNum) from Zsd06
</select>
<select
id=
"selectVbpa"
parameterType=
"com.huazheng.project.hana.model.Vbpa"
resultType=
"com.huazheng.project.hana.model.Vbpa"
>
<select
id=
"selectVbpa"
parameterType=
"com.huazheng.project.hana.model.Vbpa"
resultType=
"com.huazheng.project.hana.model.Vbpa"
>
select * from Vbpa
select * from Vbpa
...
...
src/main/resources/spring-init.xml
浏览文件 @
5703a8cb
...
@@ -1635,6 +1635,16 @@
...
@@ -1635,6 +1635,16 @@
</property>
</property>
<property
name=
"cronExpression"
value=
"* * * * * ?"
/>
<property
name=
"cronExpression"
value=
"* * * * * ?"
/>
</bean>
</bean>
<bean
class=
"org.springframework.scheduling.quartz.CronTriggerFactoryBean"
>
<property
name=
"jobDetail"
>
<bean
parent=
"methodJobDetail"
>
<property
name=
"name"
value=
"selectVbepCheck_once"
/>
<property
name=
"targetObject"
ref=
"deleteUpdateJobServiceImpl"
/>
<property
name=
"targetMethod"
value=
"selectVbepCheck"
/>
</bean>
</property>
<property
name=
"cronExpression"
value=
"* * * * * ?"
/>
</bean>
</list>
</list>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论