Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
df721376
提交
df721376
authored
1月 05, 2022
作者:
zjm
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(区块链): 修改了装备以及装备日志,原本的hash上链,修改成文本上链
修改了装备以及装备日志,原本的hash上链,修改成文本上链
上级
8856482d
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
9 行增加
和
6 行删除
+9
-6
DeviceChangeServiceImpl.java
.../device/library/service/impl/DeviceChangeServiceImpl.java
+2
-1
DeviceLibraryServiceImpl.java
...device/library/service/impl/DeviceLibraryServiceImpl.java
+3
-2
DeviceLogServiceImpl.java
...dev/device/library/service/impl/DeviceLogServiceImpl.java
+4
-3
没有找到文件。
dev-library/src/main/java/com/tykj/dev/device/library/service/impl/DeviceChangeServiceImpl.java
浏览文件 @
df721376
package
com
.
tykj
.
dev
.
device
.
library
.
service
.
impl
;
package
com
.
tykj
.
dev
.
device
.
library
.
service
.
impl
;
import
com.tykj.dev.blockcha.subject.entity.BcHash
;
import
com.tykj.dev.blockcha.subject.entity.BcHash
;
import
com.tykj.dev.blockcha.subject.entity.BcText
;
import
com.tykj.dev.blockcha.subject.service.BlockChainUtil
;
import
com.tykj.dev.blockcha.subject.service.BlockChainUtil
;
import
com.tykj.dev.config.TaskBeanConfig
;
import
com.tykj.dev.config.TaskBeanConfig
;
import
com.tykj.dev.device.library.repository.DeviceChangeDao
;
import
com.tykj.dev.device.library.repository.DeviceChangeDao
;
...
@@ -34,7 +35,7 @@ public class DeviceChangeServiceImpl implements DeviceChangeService {
...
@@ -34,7 +35,7 @@ public class DeviceChangeServiceImpl implements DeviceChangeService {
DeviceChange
deviceChange1
=
deviceChangeDao
.
save
(
deviceChange
);
DeviceChange
deviceChange1
=
deviceChangeDao
.
save
(
deviceChange
);
CompletableFuture
.
runAsync
(()->{
CompletableFuture
.
runAsync
(()->{
DeviceChange
deviceChange2
=
getOne
(
deviceChange1
.
getId
());
DeviceChange
deviceChange2
=
getOne
(
deviceChange1
.
getId
());
Bc
Hash
bcText
=
blockChainUtil
.
sendHash
(
1000
,
JacksonUtil
.
toJSon
(
deviceChange2
));
Bc
Text
bcText
=
blockChainUtil
.
sendText
(
1000
,
JacksonUtil
.
toJSon
(
deviceChange2
));
String
recordId
=
bcText
.
getData
().
getRecordID
();
String
recordId
=
bcText
.
getData
().
getRecordID
();
deviceChange2
.
setRecordId
(
recordId
);
deviceChange2
.
setRecordId
(
recordId
);
deviceChangeDao
.
save
(
deviceChange2
);
deviceChangeDao
.
save
(
deviceChange2
);
...
...
dev-library/src/main/java/com/tykj/dev/device/library/service/impl/DeviceLibraryServiceImpl.java
浏览文件 @
df721376
...
@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
...
@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
import
com.github.wenhao.jpa.PredicateBuilder
;
import
com.github.wenhao.jpa.PredicateBuilder
;
import
com.github.wenhao.jpa.Specifications
;
import
com.github.wenhao.jpa.Specifications
;
import
com.tykj.dev.blockcha.subject.entity.BcHash
;
import
com.tykj.dev.blockcha.subject.entity.BcHash
;
import
com.tykj.dev.blockcha.subject.entity.BcText
;
import
com.tykj.dev.blockcha.subject.service.BlockChainUtil
;
import
com.tykj.dev.blockcha.subject.service.BlockChainUtil
;
import
com.tykj.dev.config.TaskBeanConfig
;
import
com.tykj.dev.config.TaskBeanConfig
;
import
com.tykj.dev.config.UpdateCache
;
import
com.tykj.dev.config.UpdateCache
;
...
@@ -93,7 +94,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
...
@@ -93,7 +94,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
DeviceLibrary
deviceLibrary
=
deviceLibraryDao
.
save
(
deviceLibraryEntity
);
DeviceLibrary
deviceLibrary
=
deviceLibraryDao
.
save
(
deviceLibraryEntity
);
CompletableFuture
.
runAsync
(()->{
CompletableFuture
.
runAsync
(()->{
DeviceLibrary
deviceLibrary1
=
getOne
(
deviceLibrary
.
getId
());
DeviceLibrary
deviceLibrary1
=
getOne
(
deviceLibrary
.
getId
());
Bc
Hash
bcText
=
blockChainUtil
.
sendHash
(
1000
,
JacksonUtil
.
toJSon
(
deviceLibrary1
));
Bc
Text
bcText
=
blockChainUtil
.
sendText
(
1000
,
JacksonUtil
.
toJSon
(
deviceLibrary1
));
String
recordId
=
bcText
.
getData
().
getRecordID
();
String
recordId
=
bcText
.
getData
().
getRecordID
();
deviceLibrary1
.
setRecordId
(
recordId
);
deviceLibrary1
.
setRecordId
(
recordId
);
deviceLibraryDao
.
save
(
deviceLibrary1
);
deviceLibraryDao
.
save
(
deviceLibrary1
);
...
@@ -108,7 +109,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
...
@@ -108,7 +109,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
@Async
@Async
public
void
sendHash
(
List
<
DeviceLibrary
>
deviceLibraries
)
{
public
void
sendHash
(
List
<
DeviceLibrary
>
deviceLibraries
)
{
deviceLibraries
.
forEach
(
deviceLibrary
->
{
deviceLibraries
.
forEach
(
deviceLibrary
->
{
Bc
Hash
bcText
=
blockChainUtil
.
sendHash
(
1000
,
JacksonUtil
.
toJSon
(
deviceLibrary
));
Bc
Text
bcText
=
blockChainUtil
.
sendText
(
1000
,
JacksonUtil
.
toJSon
(
deviceLibrary
));
String
recordId
=
bcText
.
getData
().
getRecordID
();
String
recordId
=
bcText
.
getData
().
getRecordID
();
deviceLibrary
.
setRecordId
(
recordId
);
deviceLibrary
.
setRecordId
(
recordId
);
update
(
deviceLibrary
);
update
(
deviceLibrary
);
...
...
dev-library/src/main/java/com/tykj/dev/device/library/service/impl/DeviceLogServiceImpl.java
浏览文件 @
df721376
package
com
.
tykj
.
dev
.
device
.
library
.
service
.
impl
;
package
com
.
tykj
.
dev
.
device
.
library
.
service
.
impl
;
import
com.tykj.dev.blockcha.subject.entity.BcHash
;
import
com.tykj.dev.blockcha.subject.entity.BcHash
;
import
com.tykj.dev.blockcha.subject.entity.BcText
;
import
com.tykj.dev.blockcha.subject.service.BlockChainUtil
;
import
com.tykj.dev.blockcha.subject.service.BlockChainUtil
;
import
com.tykj.dev.config.TaskBeanConfig
;
import
com.tykj.dev.config.TaskBeanConfig
;
import
com.tykj.dev.device.library.repository.DeviceLogDao
;
import
com.tykj.dev.device.library.repository.DeviceLogDao
;
...
@@ -37,7 +38,7 @@ public class DeviceLogServiceImpl implements DeviceLogService {
...
@@ -37,7 +38,7 @@ public class DeviceLogServiceImpl implements DeviceLogService {
DeviceLog
deviceLog
=
deviceLogDao
.
save
(
deviceLogDto
.
toDo
());
DeviceLog
deviceLog
=
deviceLogDao
.
save
(
deviceLogDto
.
toDo
());
CompletableFuture
.
runAsync
(()->{
CompletableFuture
.
runAsync
(()->{
DeviceLog
deviceLog1
=
deviceLogDao
.
findById
(
deviceLog
.
getId
()).
get
();
DeviceLog
deviceLog1
=
deviceLogDao
.
findById
(
deviceLog
.
getId
()).
get
();
Bc
Hash
bcText
=
blockChainUtil
.
sendHash
(
1000
,
JacksonUtil
.
toJSon
(
deviceLog1
));
Bc
Text
bcText
=
blockChainUtil
.
sendText
(
1000
,
JacksonUtil
.
toJSon
(
deviceLog1
));
String
recordId
=
bcText
.
getData
().
getRecordID
();
String
recordId
=
bcText
.
getData
().
getRecordID
();
deviceLog1
.
setRecordId
(
recordId
);
deviceLog1
.
setRecordId
(
recordId
);
deviceLogDao
.
save
(
deviceLog1
);
deviceLogDao
.
save
(
deviceLog1
);
...
@@ -52,7 +53,7 @@ public class DeviceLogServiceImpl implements DeviceLogService {
...
@@ -52,7 +53,7 @@ public class DeviceLogServiceImpl implements DeviceLogService {
CompletableFuture
.
runAsync
(()->{
CompletableFuture
.
runAsync
(()->{
deviceLogs
.
forEach
(
deviceLog
->
{
deviceLogs
.
forEach
(
deviceLog
->
{
DeviceLog
deviceLog1
=
deviceLogDao
.
findById
(
deviceLog
.
getId
()).
get
();
DeviceLog
deviceLog1
=
deviceLogDao
.
findById
(
deviceLog
.
getId
()).
get
();
Bc
Hash
bcText
=
blockChainUtil
.
sendHash
(
1000
,
JacksonUtil
.
toJSon
(
deviceLog1
));
Bc
Text
bcText
=
blockChainUtil
.
sendText
(
1000
,
JacksonUtil
.
toJSon
(
deviceLog1
));
String
recordId
=
bcText
.
getData
().
getRecordID
();
String
recordId
=
bcText
.
getData
().
getRecordID
();
deviceLog1
.
setRecordId
(
recordId
);
deviceLog1
.
setRecordId
(
recordId
);
deviceLogDao
.
save
(
deviceLog1
);
deviceLogDao
.
save
(
deviceLog1
);
...
@@ -77,7 +78,7 @@ public class DeviceLogServiceImpl implements DeviceLogService {
...
@@ -77,7 +78,7 @@ public class DeviceLogServiceImpl implements DeviceLogService {
public
void
sendHash
(
List
<
DeviceLogDto
>
deviceLogDtos
)
{
public
void
sendHash
(
List
<
DeviceLogDto
>
deviceLogDtos
)
{
deviceLogDtos
.
forEach
(
deviceLogDto
->
{
deviceLogDtos
.
forEach
(
deviceLogDto
->
{
DeviceLog
deviceLogEntity
=
deviceLogDto
.
toDo
();
DeviceLog
deviceLogEntity
=
deviceLogDto
.
toDo
();
Bc
Hash
bcText
=
blockChainUtil
.
sendHash
(
1000
,
JacksonUtil
.
toJSon
(
deviceLogEntity
));
Bc
Text
bcText
=
blockChainUtil
.
sendText
(
1000
,
JacksonUtil
.
toJSon
(
deviceLogEntity
));
String
recordId
=
bcText
.
getData
().
getRecordID
();
String
recordId
=
bcText
.
getData
().
getRecordID
();
deviceLogEntity
.
setRecordId
(
recordId
);
deviceLogEntity
.
setRecordId
(
recordId
);
deviceLogDao
.
save
(
deviceLogEntity
);
deviceLogDao
.
save
(
deviceLogEntity
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论