Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
H
huazheng-project-flink
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
huazheng
huazheng-project-flink
Commits
26c86407
提交
26c86407
authored
1月 13, 2021
作者:
think
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
表zsd06一次性任务,将crt_datum1,cha_datum1字段的内容进行修改
上级
38ed6c6a
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
130 行增加
和
4 行删除
+130
-4
GPMapper.java
.../java/com/huazheng/project/greenplum/mapper/GPMapper.java
+2
-0
CheckUpdateServiceImpl.java
...roject/greenplum/service/impl/CheckUpdateServiceImpl.java
+19
-2
DeleteUpdateJobServiceImpl.java
...ct/greenplum/service/impl/DeleteUpdateJobServiceImpl.java
+74
-0
GPServiceImpl.java
...uazheng/project/greenplum/service/impl/GPServiceImpl.java
+20
-2
GPMapper_greenplum.xml
src/main/resources/mapper/greenplum/GPMapper_greenplum.xml
+5
-0
spring-init.xml
src/main/resources/spring-init.xml
+10
-0
没有找到文件。
src/main/java/com/huazheng/project/greenplum/mapper/GPMapper.java
浏览文件 @
26c86407
...
...
@@ -403,6 +403,8 @@ public interface GPMapper {
@CacheEvict
(
key
=
"'selectZsd06'+':'+#p0.vbeln+','+#p0.posnr+','+#p0.mandt"
)
public
void
deleteZsd06
(
Zsd06
item
);
public
List
<
Zsd06
>
selectZsd06Check
(
Zsd06
build
);
public
Long
selectZsd06MaxRowNum
();
@Cacheable
(
key
=
"#root.method.name+':'+#p0.vbeln+','+#p0.posnr+','+#p0.mandt"
,
unless
=
"#result == null"
)
public
Zsdfhzl
selectZsdfhzl
(
Zsdfhzl
zsdfhzl
);
// 查询替代删除
...
...
src/main/java/com/huazheng/project/greenplum/service/impl/CheckUpdateServiceImpl.java
浏览文件 @
26c86407
...
...
@@ -423,8 +423,25 @@ public class CheckUpdateServiceImpl {
Date
date
=
DateUtil
.
parse
(
erdat2
);
source
.
setDatum1
(
date
);
}
source
.
setCrt_datum1
(
SomeUtils
.
caDate
(
source
.
getCrt_datum
()));
source
.
setCha_datum1
(
SomeUtils
.
caDate
(
source
.
getCha_datum
()));
// source.setCrt_datum1(SomeUtils.caDate(source.getCrt_datum()));
// source.setCha_datum1(SomeUtils.caDate(source.getCha_datum()));
String
crtdatum
=
source
.
getCrt_datum
();
String
crttime
=
source
.
getCrt_time
();
if
(
"00000000"
.
equals
(
crtdatum
))
{
source
.
setCrt_datum1
(
null
);
}
else
{
Date
date
=
DateUtil
.
parse
(
crtdatum
+
crttime
,
"yyyyMMddHHmmss"
);
source
.
setCrt_datum1
(
date
);
}
String
chadatum
=
source
.
getCha_datum
();
String
chatime
=
source
.
getCha_time
();
if
(
"00000000"
.
equals
(
chadatum
))
{
source
.
setCha_datum1
(
null
);
}
else
{
Date
date
=
DateUtil
.
parse
(
chadatum
+
chatime
,
"yyyyMMddHHmmss"
);
source
.
setCha_datum1
(
date
);
}
// ===============================
while
(
true
)
{
try
{
...
...
src/main/java/com/huazheng/project/greenplum/service/impl/DeleteUpdateJobServiceImpl.java
浏览文件 @
26c86407
...
...
@@ -31,6 +31,7 @@ import com.huazheng.project.hana.model.Tspat;
import
com.huazheng.project.hana.model.Tvkbt
;
import
com.huazheng.project.hana.model.Vbak
;
import
com.huazheng.project.hana.model.Vbap
;
import
com.huazheng.project.hana.model.Zsd06
;
import
com.huazheng.project.mssql.mapper.CrmMapper
;
import
com.huazheng.project.mssql.model.SalesContractProcessMX
;
import
com.huazheng.project.mssql.model.SampleApplicationProcess
;
...
...
@@ -1578,4 +1579,77 @@ public class DeleteUpdateJobServiceImpl {
}
}
public
void
selectZsd06Check
()
{
try
{
ValueOperations
<
String
,
String
>
opsForValue
=
redis1Template
.
opsForValue
();
opsForValue
.
setIfAbsent
(
"huazheng:check:Zsd06:rowNum"
,
"0"
);
String
rowNum
=
opsForValue
.
get
(
"huazheng:check:Zsd06:rowNum"
);
// 一次性任务的终止位
if
(
redis1Template
.
hasKey
(
"huazheng:check:Zsd06:stopNum"
)
==
false
)
{
// 查询最大计数器
String
maxRowNum
=
gpMapper
.
selectZsd06MaxRowNum
().
toString
();
opsForValue
.
setIfAbsent
(
"huazheng:check:Zsd06:stopNum"
,
maxRowNum
);
}
Long
stopNum
=
Long
.
parseLong
(
opsForValue
.
get
(
"huazheng:check:Zsd06:stopNum"
));
if
(
stopNum
<
Long
.
parseLong
(
rowNum
))
{
JobKey
jobKey
=
JobKey
.
jobKey
(
"selectZsd06Check_once"
,
"DEFAULT"
);
// 删除任务
quartzScheduler
.
deleteJob
(
jobKey
);
return
;
}
Zsd06
build
=
Zsd06
.
builder
().
rowNum
(
rowNum
).
build
();
List
<
Zsd06
>
list
=
gpMapper
.
selectZsd06Check
(
build
);
// 从数仓中查询一组数据
if
(
list
.
size
()
==
0
)
{
JobKey
jobKey
=
JobKey
.
jobKey
(
"selectZsd06Check_once"
,
"DEFAULT"
);
// 删除任务
quartzScheduler
.
deleteJob
(
jobKey
);
return
;
}
list
.
forEach
(
target
->
{
// 遍历要检查的数据
Zsd06
source
=
sapMapper
.
selectZsd06ById
(
target
);
// 根据主键查询源库中的数据
String
operator
=
"none"
;
if
(
source
==
null
)
{
// 如果源库中没有数据
gpMapper
.
deleteZsd06
(
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
);
while
(
true
)
{
try
{
String
crtdatum
=
source
.
getCrt_datum
();
String
crttime
=
source
.
getCrt_time
();
if
(
"00000000"
.
equals
(
crtdatum
))
{
source
.
setCrt_datum1
(
null
);
}
else
{
Date
date
=
DateUtil
.
parse
(
crtdatum
+
crttime
,
"yyyyMMddHHmmss"
);
source
.
setCrt_datum1
(
date
);
}
String
chadatum
=
source
.
getCha_datum
();
String
chatime
=
source
.
getCha_time
();
if
(
"00000000"
.
equals
(
chadatum
))
{
source
.
setCha_datum1
(
null
);
}
else
{
Date
date
=
DateUtil
.
parse
(
chadatum
+
chatime
,
"yyyyMMddHHmmss"
);
source
.
setCha_datum1
(
date
);
}
gpMapper
.
updateZsd06
(
source
);
// 更新数据到数仓中
break
;
}
catch
(
RuntimeException
e
)
{
log
.
error
(
e
.
getMessage
());
ThreadUtil
.
safeSleep
(
500
);
}
}
ThreadUtil
.
safeSleep
(
500
);
}
}
redis1Template
.
opsForValue
().
set
(
"huazheng:check:Zsd06:rowNum"
,
target
.
getRowNum
());
if
(!
operator
.
equals
(
"none"
))
{
log
.
info
(
String
.
format
(
"selectZsd06Check --> rowNum:%s, operator:%s"
,
target
.
getRowNum
(),
operator
));
}
});
}
catch
(
Exception
e
)
{
redis1Template
.
opsForValue
().
set
(
"huazheng:checkError:Zsd06:rowNum"
,
getErrorInfoFromException
(
e
));
}
}
}
src/main/java/com/huazheng/project/greenplum/service/impl/GPServiceImpl.java
浏览文件 @
26c86407
...
...
@@ -900,8 +900,26 @@ public class GPServiceImpl {
redis1Template
.
opsForHash
().
put
(
"huazheng:Zsd06:error"
,
"processZsd061"
,
getErrorInfoFromException
(
e
));
log
.
error
(
e
.
getMessage
());
}
data
.
setCrt_datum1
(
caDate
(
data
.
getCrt_datum
()));
data
.
setCha_datum1
(
caDate
(
data
.
getCha_datum
()));
// data.setCrt_datum1(caDate(data.getCrt_datum()));
// data.setCha_datum1(caDate(data.getCha_datum()));
String
crtdatum
=
data
.
getCrt_datum
();
String
crttime
=
data
.
getCrt_time
();
if
(
"00000000"
.
equals
(
crtdatum
))
{
data
.
setCrt_datum1
(
null
);
}
else
{
Date
date
=
DateUtil
.
parse
(
crtdatum
+
crttime
,
"yyyyMMddHHmmss"
);
data
.
setCrt_datum1
(
date
);
}
String
chadatum
=
data
.
getCha_datum
();
String
chatime
=
data
.
getCha_time
();
if
(
"00000000"
.
equals
(
chadatum
))
{
data
.
setCha_datum1
(
null
);
}
else
{
Date
date
=
DateUtil
.
parse
(
chadatum
+
chatime
,
"yyyyMMddHHmmss"
);
data
.
setCha_datum1
(
date
);
}
}
out
.
collect
(
data
);
}
catch
(
Exception
e
)
{
...
...
src/main/resources/mapper/greenplum/GPMapper_greenplum.xml
浏览文件 @
26c86407
...
...
@@ -1332,6 +1332,11 @@
<select
id=
"selectZsd06Check"
parameterType=
"com.huazheng.project.hana.model.Zsd06"
resultType=
"com.huazheng.project.hana.model.Zsd06"
>
select * from Zsd06 where rownum
>
#{rowNum} order by rownum limit 20
</select>
<select
id=
"selectZsd06MaxRowNum"
resultType=
"long"
>
select max(rowNum) from Zsd06
</select>
<select
id=
"selectZsdfhzl"
parameterType=
"com.huazheng.project.hana.model.Zsdfhzl"
resultType=
"com.huazheng.project.hana.model.Zsdfhzl"
>
select * from Zsdfhzl
...
...
src/main/resources/spring-init.xml
浏览文件 @
26c86407
...
...
@@ -1576,6 +1576,16 @@
</property>
<property
name=
"cronExpression"
value=
"* * * * * ?"
/>
</bean>
<bean
class=
"org.springframework.scheduling.quartz.CronTriggerFactoryBean"
>
<property
name=
"jobDetail"
>
<bean
parent=
"methodJobDetail"
>
<property
name=
"name"
value=
"selectZsd06Check_once"
/>
<property
name=
"targetObject"
ref=
"deleteUpdateJobServiceImpl"
/>
<property
name=
"targetMethod"
value=
"selectZsd06Check"
/>
</bean>
</property>
<property
name=
"cronExpression"
value=
"* * * * * ?"
/>
</bean>
</list>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论