Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
d24a4d7e
提交
d24a4d7e
authored
1月 12, 2023
作者:
zjm
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
上链
上级
d1d6a84f
隐藏空白字符变更
内嵌
并排
正在显示
17 个修改的文件
包含
420 行增加
和
44 行删除
+420
-44
AllotBillController.java
...tykj/dev/device/allot/controller/AllotBillController.java
+19
-0
AllotBackBillServiceImpl.java
...v/device/allot/service/impl/AllotBackBillServiceImpl.java
+7
-2
AllotBillServiceImpl.java
...j/dev/device/allot/service/impl/AllotBillServiceImpl.java
+6
-1
pom.xml
dev-apply/pom.xml
+5
-0
DeviceApplyController.java
...kj/dev/device/apply/controller/DeviceApplyController.java
+19
-0
DeviceApplyBillService.java
...tykj/dev/device/apply/service/DeviceApplyBillService.java
+18
-0
DeviceApplyBillServiceImpl.java
...device/apply/service/impl/DeviceApplyBillServiceImpl.java
+101
-16
DeviceApplyBill.java
.../tykj/dev/device/apply/subject/domin/DeviceApplyBill.java
+5
-0
BlockRun.java
...src/main/java/com/tykj/dev/device/block/run/BlockRun.java
+5
-7
pom.xml
dev-selfcheck/pom.xml
+4
-0
SelfCheckController.java
.../dev/device/selfcheck/controller/SelfCheckController.java
+18
-0
SelfCheckBillService.java
...kj/dev/device/selfcheck/service/SelfCheckBillService.java
+17
-0
SelfCheckBillServiceImpl.java
...vice/selfcheck/service/impl/SelfCheckBillServiceImpl.java
+177
-12
SelfCheckBill.java
...ykj/dev/device/selfcheck/subject/domin/SelfCheckBill.java
+10
-0
TrainJobController.java
.../tykj/dev/device/train/controller/TrainJobController.java
+2
-2
application-prodT.properties
dev-union/src/main/resources/application-prodT.properties
+3
-2
application-test.properties
dev-union/src/main/resources/application-test.properties
+4
-2
没有找到文件。
dev-allot/src/main/java/com/tykj/dev/device/allot/controller/AllotBillController.java
浏览文件 @
d24a4d7e
...
...
@@ -1259,5 +1259,24 @@ public class AllotBillController {
}
/**
* 区块验证
*/
@GetMapping
(
value
=
"/checkTrueData/{billId}"
)
@ApiOperation
(
value
=
"根据业务id进行对应业务的验证"
,
notes
=
"根据业务id进行对应业务的验证"
)
public
ResponseEntity
checkTrueData
(
@PathVariable
Integer
billId
){
return
ResponseEntity
.
ok
(
allotBillService
.
checkTrueData
(
billId
));
}
/**
* 区块溯源
*/
@GetMapping
(
value
=
"/traceabilityParsing/{billId}"
)
@ApiOperation
(
value
=
"根据业务id进行对应业务的溯源"
,
notes
=
"根据业务id进行对应业务的溯源"
)
public
ResponseEntity
traceabilityParsing
(
@PathVariable
Integer
billId
){
return
ResponseEntity
.
ok
(
allotBillService
.
traceabilityParsing
(
billId
));
}
}
dev-allot/src/main/java/com/tykj/dev/device/allot/service/impl/AllotBackBillServiceImpl.java
浏览文件 @
d24a4d7e
...
...
@@ -170,8 +170,8 @@ public class AllotBackBillServiceImpl implements AllotBackBillService {
@Override
public
BlockTraceabilityParsing
traceabilityParsing
(
Integer
billId
)
{
BlockData
billTypeAndBillId
=
blockDataService
.
findBillTypeAndBillId
(
BusinessEnum
.
ALLOT
.
id
,
billId
);
BcRecord
bcRecord
=
blockService
.
fetchRecord
(
BlockBusinessEnum
.
ALLOT
.
subCode
,
billTypeAndBillId
.
getRecordID
());
BlockData
billTypeAndBillId
=
blockDataService
.
findBillTypeAndBillId
(
BusinessEnum
.
ALLOT
_BACK
.
id
,
billId
);
BcRecord
bcRecord
=
blockService
.
fetchRecord
(
BlockBusinessEnum
.
ALLOT
_BACK
.
subCode
,
billTypeAndBillId
.
getRecordID
());
AllotBackBill
allotBackBill
=
queryAllotBill
(
billId
);
AllotBackBill
allotBackBill1
=
JSON
.
parseObject
(
bcRecord
.
getData
().
getContent
(),
AllotBackBill
.
class
);
BlockTraceabilityParsing
blockTraceabilityParsing
=
bcRecord
.
getData
().
toBlockTraceabilityParsing
();
...
...
@@ -245,6 +245,11 @@ public class AllotBackBillServiceImpl implements AllotBackBillService {
allotBackBill
.
setApplyFileList
(
FilesUtil
.
stringFileToList
(
allotBackBill
.
getApplyFiles
()));
allotBackBill
.
setSendFileList
(
FilesUtil
.
stringFileToList
(
allotBackBill
.
getSendFiles
()));
allotBackBill
.
setReceiveFileList
(
FilesUtil
.
stringFileToList
(
allotBackBill
.
getReceiveFiles
()));
allotBackBill
.
setSenderUserA
(
userPublicService
.
getOne
(
allotBackBill
.
getSendUseraId
()).
getName
());
allotBackBill
.
setSenderUserB
(
userPublicService
.
getOne
(
allotBackBill
.
getSendUserbId
()).
getName
());
allotBackBill
.
setReceiveUserA
(
userPublicService
.
getOne
(
allotBackBill
.
getReceiveUseraId
()).
getName
());
allotBackBill
.
setReceiveUserB
(
userPublicService
.
getOne
(
allotBackBill
.
getReceiveUserbId
()).
getName
());
allotBackBill
.
setScripts
(
JacksonUtil
.
readValue
(
allotBackBill
.
getScriptJson
(),
new
TypeReference
<
List
<
ScriptSaveVo
>>()
{
}));
return
allotBackBill
;
...
...
dev-allot/src/main/java/com/tykj/dev/device/allot/service/impl/AllotBillServiceImpl.java
浏览文件 @
d24a4d7e
...
...
@@ -235,7 +235,7 @@ public class AllotBillServiceImpl implements AllotBillService {
taskLogBto
.
setOldStatus
(
taskBto
.
getBillStatus
());
taskLogBto
.
setTaskId
(
taskId
);
taskLogService
.
addLog
(
taskLogBto
);
return
update
;
return
update
;
}
@Override
...
...
@@ -321,6 +321,10 @@ public class AllotBillServiceImpl implements AllotBillService {
allotBill
.
setApplyFileList
(
FilesUtil
.
stringFileToList
(
allotBill
.
getApplyFiles
()));
allotBill
.
setSendFileList
(
FilesUtil
.
stringFileToList
(
allotBill
.
getSendFiles
()));
allotBill
.
setReceiveFileList
(
FilesUtil
.
stringFileToList
(
allotBill
.
getReceiveFiles
()));
allotBill
.
setSenderUserA
(
userPublicService
.
getOne
(
allotBill
.
getSendUseraId
()).
getName
());
allotBill
.
setSenderUserB
(
userPublicService
.
getOne
(
allotBill
.
getSendUserbId
()).
getName
());
allotBill
.
setReceiveUserA
(
userPublicService
.
getOne
(
allotBill
.
getReceiveUseraId
()).
getName
());
allotBill
.
setReceiveUserB
(
userPublicService
.
getOne
(
allotBill
.
getReceiveUserbId
()).
getName
());
allotBill
.
setScripts
(
JacksonUtil
.
readValue
(
allotBill
.
getScriptJson
(),
new
TypeReference
<
List
<
ScriptSaveVo
>>()
{
}));
return
allotBill
;
...
...
@@ -329,6 +333,7 @@ public class AllotBillServiceImpl implements AllotBillService {
/**
* @param allotBillSelectVo 查询vo
* 查询统一筛选器
...
...
dev-apply/pom.xml
浏览文件 @
d24a4d7e
...
...
@@ -24,6 +24,11 @@
<groupId>
com.tykj
</groupId>
<artifactId>
dev-allot
</artifactId>
</dependency>
<dependency>
<groupId>
com.tykj
</groupId>
<artifactId>
dev-block
</artifactId>
</dependency>
<dependency>
<groupId>
com.tykj
</groupId>
<artifactId>
dev-library
</artifactId>
...
...
dev-apply/src/main/java/com/tykj/dev/device/apply/controller/DeviceApplyController.java
浏览文件 @
d24a4d7e
...
...
@@ -980,4 +980,23 @@ public class DeviceApplyController {
// }
/**
* 区块验证
*/
@GetMapping
(
value
=
"/checkTrueData/{billId}"
)
@ApiOperation
(
value
=
"根据业务id进行对应业务的验证"
,
notes
=
"根据业务id进行对应业务的验证"
)
public
ResponseEntity
checkTrueData
(
@PathVariable
Integer
billId
){
return
ResponseEntity
.
ok
(
deviceApplyBillService
.
checkTrueData
(
billId
));
}
/**
* 区块溯源
*/
@GetMapping
(
value
=
"/traceabilityParsing/{billId}"
)
@ApiOperation
(
value
=
"根据业务id进行对应业务的溯源"
,
notes
=
"根据业务id进行对应业务的溯源"
)
public
ResponseEntity
traceabilityParsing
(
@PathVariable
Integer
billId
){
return
ResponseEntity
.
ok
(
deviceApplyBillService
.
traceabilityParsing
(
billId
));
}
}
dev-apply/src/main/java/com/tykj/dev/device/apply/service/DeviceApplyBillService.java
浏览文件 @
d24a4d7e
...
...
@@ -3,6 +3,7 @@ package com.tykj.dev.device.apply.service;
import
com.tykj.dev.device.apply.subject.domin.DeviceApplyBill
;
import
com.tykj.dev.device.apply.subject.vo.*
;
import
com.tykj.dev.device.block.entity.vo.BlockTraceabilityParsing
;
import
com.tykj.dev.device.library.subject.vo.ScriptSaveVo
;
import
java.util.List
;
...
...
@@ -46,4 +47,21 @@ public interface DeviceApplyBillService {
ApplyRemoveSeqVo
removeSameSeq
(
RemoveSameSeqVo
removeSameSeqVo
);
/**
* 溯源接口
* @param billId 业务id
* @return 溯源信息实体
*/
BlockTraceabilityParsing
traceabilityParsing
(
Integer
billId
);
/**
* 历史数据上链
*/
void
historyUpperChain
();
boolean
checkTrueData
(
Integer
billId
);
}
dev-apply/src/main/java/com/tykj/dev/device/apply/service/impl/DeviceApplyBillServiceImpl.java
浏览文件 @
d24a4d7e
package
com
.
tykj
.
dev
.
device
.
apply
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.tykj.dev.blockcha.subject.entity.BcHash
;
import
com.tykj.dev.blockcha.subject.service.BlockChainUtil
;
...
...
@@ -8,6 +9,12 @@ import com.tykj.dev.device.apply.repository.DeviceApplyBillDao;
import
com.tykj.dev.device.apply.service.DeviceApplyBillService
;
import
com.tykj.dev.device.apply.subject.domin.DeviceApplyBill
;
import
com.tykj.dev.device.apply.subject.vo.*
;
import
com.tykj.dev.device.block.entity.BlockData
;
import
com.tykj.dev.device.block.entity.bc.BcRecord
;
import
com.tykj.dev.device.block.entity.vo.BlockTraceabilityParsing
;
import
com.tykj.dev.device.block.entity.vo.TraceabilityParsingData
;
import
com.tykj.dev.device.block.service.BlockDataService
;
import
com.tykj.dev.device.block.service.BlockService
;
import
com.tykj.dev.device.library.service.DeviceLibraryCacheService
;
import
com.tykj.dev.device.library.service.DeviceLibraryService
;
import
com.tykj.dev.device.library.service.impl.CacheLibraryServiceImpl
;
...
...
@@ -21,11 +28,10 @@ import com.tykj.dev.device.user.read.service.MessageService;
import
com.tykj.dev.device.user.read.subject.bto.MessageBto
;
import
com.tykj.dev.device.user.subject.service.UserPublicService
;
import
com.tykj.dev.device.user.util.UserUtils
;
import
com.tykj.dev.misc.base.BlockBusinessEnum
;
import
com.tykj.dev.misc.base.BusinessEnum
;
import
com.tykj.dev.misc.base.StatusEnum
;
import
com.tykj.dev.misc.utils.DeviceSeqUtil
;
import
com.tykj.dev.misc.utils.JacksonUtil
;
import
com.tykj.dev.misc.utils.StringSplitUtil
;
import
com.tykj.dev.misc.utils.StringUtils
;
import
com.tykj.dev.misc.utils.*
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
...
...
@@ -43,6 +49,12 @@ import static java.util.stream.Collectors.groupingBy;
@Service
public
class
DeviceApplyBillServiceImpl
implements
DeviceApplyBillService
{
@Autowired
BlockService
blockService
;
@Autowired
BlockDataService
blockDataService
;
@Autowired
private
DeviceApplyBillDao
deviceApplyBillDao
;
...
...
@@ -73,18 +85,7 @@ public class DeviceApplyBillServiceImpl implements DeviceApplyBillService {
@Override
public
DeviceApplyBill
addEntity
(
DeviceApplyBill
deviceApplyBillEntity
)
{
DeviceApplyBill
deviceApplyBill
=
deviceApplyBillDao
.
save
(
deviceApplyBillEntity
);
CompletableFuture
.
runAsync
(()->{
try
{
Thread
.
sleep
(
2000
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
DeviceApplyBill
deviceApplyBill1
=
getOne
(
deviceApplyBill
.
getId
());
BcHash
bcText
=
blockChainUtil
.
sendHash
(
1000
,
JacksonUtil
.
toJSon
(
deviceApplyBill1
));
String
recordId
=
bcText
.
getData
().
getRecordID
();
deviceApplyBill1
.
setRecordId
(
recordId
);
deviceApplyBillDao
.
save
(
deviceApplyBill1
);
},
TaskBeanConfig
.
getThreadPoolTaskScheduler
());
sendText
(
deviceApplyBill
.
getId
());
return
deviceApplyBill
;
}
...
...
@@ -318,4 +319,88 @@ public class DeviceApplyBillServiceImpl implements DeviceApplyBillService {
applyRemoveSeqVo
.
setCount
(
selectDeviceSeqs
.
size
());
return
applyRemoveSeqVo
;
}
/**
* 验证接口
*/
@Override
public
BlockTraceabilityParsing
traceabilityParsing
(
Integer
billId
)
{
BlockData
billTypeAndBillId
=
blockDataService
.
findBillTypeAndBillId
(
BusinessEnum
.
APPLY
.
id
,
billId
);
BcRecord
bcRecord
=
blockService
.
fetchRecord
(
BlockBusinessEnum
.
APPLY
.
subCode
,
billTypeAndBillId
.
getRecordID
());
DeviceApplyBill
deviceApplyBill
=
queryDeviceApplyBill
(
billId
);
DeviceApplyBill
deviceApplyBill1
=
JSON
.
parseObject
(
bcRecord
.
getData
().
getContent
(),
DeviceApplyBill
.
class
);
BlockTraceabilityParsing
blockTraceabilityParsing
=
bcRecord
.
getData
().
toBlockTraceabilityParsing
();
blockTraceabilityParsing
.
setBusinessTraceabilityParsingData
(
TraceabilityParsingData
.
builder
()
.
billTypeName
(
"申请"
)
.
applyNumber
(
deviceApplyBill
.
getApplyNumber
())
.
replayNumber
(
deviceApplyBill
.
getReplayNumber
())
.
fileMd5
(
deviceApplyBill
.
getFileMd5
())
.
unitName
(
deviceApplyBill
.
getApplyUnit
())
.
operationTime
(
DateUtil
.
getLocalDateTime
(
deviceApplyBill
.
getCreateTime
()))
.
operatorUserName
(
operatorName
(
deviceApplyBill
))
.
build
());
blockTraceabilityParsing
.
setBlockTraceabilityParsingData
(
TraceabilityParsingData
.
builder
()
.
billTypeName
(
"申请"
)
.
applyNumber
(
deviceApplyBill1
.
getApplyNumber
())
.
replayNumber
(
deviceApplyBill1
.
getReplayNumber
())
.
fileMd5
(
deviceApplyBill1
.
getFileMd5
())
.
unitName
(
deviceApplyBill1
.
getApplyUnit
())
.
operationTime
(
DateUtil
.
getLocalDateTime
(
deviceApplyBill1
.
getCreateTime
()))
.
operatorUserName
(
operatorName
(
deviceApplyBill1
))
.
build
());
blockTraceabilityParsing
.
setBlockData
(
deviceApplyBill1
);
blockTraceabilityParsing
.
setCurrentData
(
deviceApplyBill
);
return
blockTraceabilityParsing
;
}
@Override
public
void
historyUpperChain
()
{
}
private
String
operatorName
(
DeviceApplyBill
deviceApplyBill
)
{
StringBuffer
buf
=
new
StringBuffer
();
buf
.
append
(
deviceApplyBill
.
getApplyUser
())
.
append
(
","
)
.
append
(
deviceApplyBill
.
getAgent
());
return
buf
.
toString
();
}
//验真
@Override
public
boolean
checkTrueData
(
Integer
billId
)
{
BlockTraceabilityParsing
blockTraceabilityParsing
=
traceabilityParsing
(
billId
);
boolean
contrast
=
blockDataService
.
contrast
(
blockTraceabilityParsing
);
return
contrast
;
}
/**
* 上链接口
*/
public
void
sendText
(
Integer
id
){
DeviceApplyBill
deviceApplyBill
=
queryDeviceApplyBill
(
id
);
blockService
.
sendText
(
BlockBusinessEnum
.
APPLY
.
subCode
,
JacksonUtil
.
toJSon
(
deviceApplyBill
),
BusinessEnum
.
APPLY
.
id
,
id
,
deviceApplyBill
.
getApplyUnit
());
}
private
DeviceApplyBill
queryDeviceApplyBill
(
Integer
billId
){
//获取账单
DeviceApplyBill
deviceApplyBillEntity
=
getOne
(
billId
);
if
(
deviceApplyBillEntity
.
getApplyUseraId
()
!=
null
)
{
deviceApplyBillEntity
.
setApplyUser
(
userPublicService
.
getOne
(
deviceApplyBillEntity
.
getApplyUseraId
()).
getName
());
}
List
<
ApplyBillDetailVo
>
applyBillDetailVos
=
Objects
.
requireNonNull
(
JacksonUtil
.
readValue
(
deviceApplyBillEntity
.
getApplyStat
(),
new
TypeReference
<
List
<
ApplyBillDetailVo
>>()
{
}));
deviceApplyBillEntity
.
setApplyBillDetailVos
(
applyBillDetailVos
);
return
deviceApplyBillEntity
;
}
}
dev-apply/src/main/java/com/tykj/dev/device/apply/subject/domin/DeviceApplyBill.java
浏览文件 @
d24a4d7e
...
...
@@ -181,4 +181,9 @@ public class DeviceApplyBill {
@ApiModelProperty
(
value
=
"申请装备序列号信息vo"
)
@Transient
private
List
<
ApplyBillDetailVo
>
applyBillDetailVos
=
new
ArrayList
<>();
@Transient
@ApiModelProperty
(
value
=
"文件md5"
)
private
String
fileMd5
;
}
dev-block/src/main/java/com/tykj/dev/device/block/run/BlockRun.java
浏览文件 @
d24a4d7e
...
...
@@ -21,12 +21,10 @@ public class BlockRun implements CommandLineRunner {
BlockService
blockService
;
@Override
public
void
run
(
String
...
args
)
throws
Exception
{
// log.info("添加区块业务类型开始");
//// for (BlockBusinessEnum value : BlockBusinessEnum.values()) {
//// if (value.subCode>19) {
//// blockService.subRegister(value.name);
//// }
//// }
// log.info("添加区块业务类型结束");
log
.
info
(
"添加区块业务类型开始"
);
for
(
BlockBusinessEnum
value
:
BlockBusinessEnum
.
values
())
{
blockService
.
subRegister
(
value
.
name
);
}
log
.
info
(
"添加区块业务类型结束"
);
}
}
dev-selfcheck/pom.xml
浏览文件 @
d24a4d7e
...
...
@@ -41,6 +41,10 @@
<groupId>
com.tykj
</groupId>
<artifactId>
dev-file
</artifactId>
</dependency>
<dependency>
<groupId>
com.tykj
</groupId>
<artifactId>
dev-block
</artifactId>
</dependency>
</dependencies>
...
...
dev-selfcheck/src/main/java/com/tykj/dev/device/selfcheck/controller/SelfCheckController.java
浏览文件 @
d24a4d7e
...
...
@@ -1276,4 +1276,22 @@ public class SelfCheckController {
return
ResultUtil
.
success
(
"1"
);
}
/**
* 区块验证
*/
@GetMapping
(
value
=
"/checkTrueData/{billId}"
)
@ApiOperation
(
value
=
"根据业务id进行对应业务的验证"
,
notes
=
"根据业务id进行对应业务的验证"
)
public
ResponseEntity
checkTrueData
(
@PathVariable
Integer
billId
){
return
ResponseEntity
.
ok
(
selfCheckBillService
.
checkTrueData
(
billId
));
}
/**
* 区块溯源
*/
@GetMapping
(
value
=
"/traceabilityParsing/{billId}"
)
@ApiOperation
(
value
=
"根据业务id进行对应业务的溯源"
,
notes
=
"根据业务id进行对应业务的溯源"
)
public
ResponseEntity
traceabilityParsing
(
@PathVariable
Integer
billId
){
return
ResponseEntity
.
ok
(
selfCheckBillService
.
traceabilityParsing
(
billId
));
}
}
dev-selfcheck/src/main/java/com/tykj/dev/device/selfcheck/service/SelfCheckBillService.java
浏览文件 @
d24a4d7e
...
...
@@ -2,6 +2,7 @@ package com.tykj.dev.device.selfcheck.service;
import
com.tykj.dev.config.domin.CheckUnitInfo
;
import
com.tykj.dev.device.block.entity.vo.BlockTraceabilityParsing
;
import
com.tykj.dev.device.file.entity.FileRet
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
com.tykj.dev.device.selfcheck.subject.domin.SelfCheckBill
;
...
...
@@ -68,4 +69,20 @@ public interface SelfCheckBillService {
* 只要2周后未完成
*/
List
<
CheckUnitInfo
>
selectNoFinSh2Weeks
();
/**
* 溯源接口
* @param billId 业务id
* @return 溯源信息实体
*/
BlockTraceabilityParsing
traceabilityParsing
(
Integer
billId
);
/**
* 历史数据上链
*/
void
historyUpperChain
();
boolean
checkTrueData
(
Integer
billId
);
}
dev-selfcheck/src/main/java/com/tykj/dev/device/selfcheck/service/impl/SelfCheckBillServiceImpl.java
浏览文件 @
d24a4d7e
package
com
.
tykj
.
dev
.
device
.
selfcheck
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.github.wenhao.jpa.PredicateBuilder
;
...
...
@@ -9,13 +10,23 @@ import com.tykj.dev.blockcha.subject.service.BlockChainUtil;
import
com.tykj.dev.config.TaskBeanConfig
;
import
com.tykj.dev.config.base.FileName
;
import
com.tykj.dev.config.domin.CheckUnitInfo
;
import
com.tykj.dev.device.block.entity.BlockData
;
import
com.tykj.dev.device.block.entity.bc.BcRecord
;
import
com.tykj.dev.device.block.entity.vo.BlockTraceabilityParsing
;
import
com.tykj.dev.device.block.entity.vo.TraceabilityParsingData
;
import
com.tykj.dev.device.block.service.BlockDataService
;
import
com.tykj.dev.device.block.service.BlockService
;
import
com.tykj.dev.device.file.entity.FileRet
;
import
com.tykj.dev.device.file.service.FilesUtil
;
import
com.tykj.dev.device.file.util.FileMD5Util
;
import
com.tykj.dev.device.library.service.DeviceLibraryCacheService
;
import
com.tykj.dev.device.library.service.DeviceLibraryService
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
com.tykj.dev.device.selfcheck.config.HistoryDeviceBillRun
;
import
com.tykj.dev.device.selfcheck.repository.SelfCheckBillDao
;
import
com.tykj.dev.device.selfcheck.service.HistoryDeviceBillService
;
import
com.tykj.dev.device.selfcheck.service.SelfCheckBillService
;
import
com.tykj.dev.device.selfcheck.subject.domin.HistoryDeviceBill
;
import
com.tykj.dev.device.selfcheck.subject.domin.SelfCheckBill
;
import
com.tykj.dev.device.selfcheck.subject.vo.SelfCheckSelectVo
;
import
com.tykj.dev.device.task.service.TaskLogService
;
...
...
@@ -23,7 +34,9 @@ import com.tykj.dev.device.task.service.TaskService;
import
com.tykj.dev.device.task.subject.bto.TaskBto
;
import
com.tykj.dev.device.task.subject.vo.TaskLogUserVo
;
import
com.tykj.dev.device.task.subject.vo.TaskUserVo
;
import
com.tykj.dev.device.user.subject.service.UserPublicService
;
import
com.tykj.dev.device.user.util.UserUtils
;
import
com.tykj.dev.misc.base.BlockBusinessEnum
;
import
com.tykj.dev.misc.base.BusinessEnum
;
import
com.tykj.dev.misc.exception.ApiException
;
import
com.tykj.dev.misc.qrcode.*
;
...
...
@@ -32,6 +45,7 @@ import com.tykj.dev.misc.qrcode.vo.TaskData;
import
com.tykj.dev.misc.utils.DateUtil
;
import
com.tykj.dev.misc.utils.JacksonUtil
;
import
com.tykj.dev.misc.utils.ResultUtil
;
import
com.tykj.dev.misc.utils.StringSplitUtil
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -69,6 +83,11 @@ public class SelfCheckBillServiceImpl implements SelfCheckBillService {
@Autowired
private
BlockChainUtil
blockChainUtil
;
@Resource
private
HistoryDeviceBillService
historyDeviceBillService
;
@Resource
private
HistoryDeviceBillRun
historyDeviceBillRun
;
@Autowired
private
TaskService
taskService
;
...
...
@@ -81,21 +100,19 @@ public class SelfCheckBillServiceImpl implements SelfCheckBillService {
@Resource
private
TaskLogService
taskLogService
;
@Resource
BlockService
blockService
;
@Resource
BlockDataService
blockDataService
;
@Resource
UserPublicService
userPublicService
;
@Override
public
SelfCheckBill
addEntity
(
SelfCheckBill
selfExaminationBillEntity
)
{
SelfCheckBill
selfCheckBill
=
selfExaminationBillDao
.
save
(
selfExaminationBillEntity
);
CompletableFuture
.
runAsync
(()
->
{
try
{
Thread
.
sleep
(
2000
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
SelfCheckBill
selfCheckBill1
=
getOne
(
selfCheckBill
.
getId
());
BcHash
bcText
=
blockChainUtil
.
sendHash
(
1000
,
JacksonUtil
.
toJSon
(
selfCheckBill1
));
String
recordId
=
bcText
.
getData
().
getRecordID
();
selfCheckBill1
.
setRecordId
(
recordId
);
selfExaminationBillDao
.
save
(
selfCheckBill1
);
},
TaskBeanConfig
.
getThreadPoolTaskScheduler
());
sendText
(
selfCheckBill
.
getId
());
return
selfCheckBill
;
}
...
...
@@ -387,4 +404,152 @@ public class SelfCheckBillServiceImpl implements SelfCheckBillService {
TaskData
taskData
=
JacksonUtil
.
readValue
(
json
,
TaskData
.
class
);
}
@Override
public
boolean
checkTrueData
(
Integer
billId
)
{
BlockTraceabilityParsing
blockTraceabilityParsing
=
traceabilityParsing
(
billId
);
return
blockDataService
.
contrast
(
blockTraceabilityParsing
);
}
@Override
public
BlockTraceabilityParsing
traceabilityParsing
(
Integer
billId
)
{
BlockData
billTypeAndBillId
=
blockDataService
.
findBillTypeAndBillId
(
BusinessEnum
.
SELF_CHECK
.
id
,
billId
);
BcRecord
bcRecord
=
blockService
.
fetchRecord
(
BlockBusinessEnum
.
SELF_CHECK
.
subCode
,
billTypeAndBillId
.
getRecordID
());
SelfCheckBill
selfCheckBill
=
queryDetail
(
billId
);
SelfCheckBill
selfCheckBill1
=
JSON
.
parseObject
(
bcRecord
.
getData
().
getContent
(),
SelfCheckBill
.
class
);
BlockTraceabilityParsing
blockTraceabilityParsing
=
bcRecord
.
getData
().
toBlockTraceabilityParsing
();
StringBuffer
stringBuffer
=
new
StringBuffer
();
stringBuffer
.
append
(
StringSplitUtil
.
stringListToString
(
selfCheckBill
.
getDeviceLibraries
().
stream
().
map
(
DeviceLibrary:
:
getSeqNumber
).
collect
(
Collectors
.
toList
())))
.
append
(
","
)
.
append
(
StringSplitUtil
.
stringListToString
(
selfCheckBill
.
getHistoryDeviceBills
().
stream
().
map
(
HistoryDeviceBill:
:
getSeqNumber
).
collect
(
Collectors
.
toList
())));
StringBuffer
stringBuffer1
=
new
StringBuffer
();
stringBuffer1
.
append
(
StringSplitUtil
.
stringListToString
(
selfCheckBill1
.
getDeviceLibraries
().
stream
().
map
(
DeviceLibrary:
:
getSeqNumber
).
collect
(
Collectors
.
toList
())))
.
append
(
","
)
.
append
(
StringSplitUtil
.
stringListToString
(
selfCheckBill1
.
getHistoryDeviceBills
().
stream
().
map
(
HistoryDeviceBill:
:
getSeqNumber
).
collect
(
Collectors
.
toList
())));
blockTraceabilityParsing
.
setBusinessTraceabilityParsingData
(
TraceabilityParsingData
.
builder
()
.
billTypeName
(
"自查"
)
//业务名称
// .applyNumber(allotBill.getApplyNumber()) //申请文号
// .replayNumber(allotBill.getReplayNumber()) //批复文号
.
fileMd5
(
selfCheckBill
.
getFileMd5
())
.
carrierIds
(
stringBuffer
.
toString
())
//序列号信息
.
unitName
(
selfCheckBill
.
getCheckUnit
())
//发起单位
.
operationTime
(
DateUtil
.
getLocalDateTime
(
selfCheckBill
.
getCreateTime
()))
//发起时间
.
operatorUserName
(
operatorName
(
selfCheckBill
))
//相关人员
.
build
());
blockTraceabilityParsing
.
setBlockTraceabilityParsingData
(
TraceabilityParsingData
.
builder
()
.
billTypeName
(
"自查"
)
.
fileMd5
(
selfCheckBill1
.
getFileMd5
())
.
carrierIds
(
stringBuffer1
.
toString
())
//序列号信息
.
unitName
(
selfCheckBill1
.
getCheckUnit
())
//发起单位
.
operationTime
(
DateUtil
.
getLocalDateTime
(
selfCheckBill1
.
getCreateTime
()))
//发起时间
.
operatorUserName
(
operatorName
(
selfCheckBill1
))
//相关人员
.
build
());
blockTraceabilityParsing
.
setBlockData
(
selfCheckBill1
);
blockTraceabilityParsing
.
setCurrentData
(
selfCheckBill
);
return
blockTraceabilityParsing
;
}
@Override
public
void
historyUpperChain
()
{
//历史数据 循环查询数据上链
}
/**
* 拼写相关人员字符
*/
private
String
operatorName
(
SelfCheckBill
selfCheckBill
)
{
StringBuffer
buf
=
new
StringBuffer
();
buf
.
append
(
selfCheckBill
.
getCheckUser
())
.
append
(
","
)
.
append
(
selfCheckBill
.
getConfirmUser
());
return
buf
.
toString
();
}
/**
* 文本上链接口
* @param billId 业务id
*/
private
void
sendText
(
Integer
billId
){
SelfCheckBill
selfCheckBill
=
queryDetail
(
billId
);
// 区块业务状态码,上链json数据,业务类型,业务id,发起单位
blockService
.
sendText
(
BlockBusinessEnum
.
SELF_CHECK
.
subCode
,
JacksonUtil
.
toJSon
(
selfCheckBill
),
BusinessEnum
.
SELF_CHECK
.
id
,
billId
,
selfCheckBill
.
getCheckUnit
());
}
private
SelfCheckBill
queryDetail
(
Integer
billId
){
SelfCheckBill
selfExaminationBillEntity
=
getOne
(
billId
);
if
(
selfExaminationBillEntity
.
getUseraId
()!=
null
&&
selfExaminationBillEntity
.
getUseraId
()
!=
0
)
{
selfExaminationBillEntity
.
setCheckUser
(
userPublicService
.
getOne
(
selfExaminationBillEntity
.
getUseraId
()).
getName
());
}
if
(
selfExaminationBillEntity
.
getUserbId
()!=
null
&&
selfExaminationBillEntity
.
getUserbId
()
!=
0
)
{
selfExaminationBillEntity
.
setConfirmUser
(
userPublicService
.
getOne
(
selfExaminationBillEntity
.
getUserbId
()).
getName
());
}
selfExaminationBillEntity
.
setCheckFileList
(
FilesUtil
.
stringFileToList
(
selfExaminationBillEntity
.
getCheckFiles
()));
selfExaminationBillEntity
.
setFileMd5
(
FileMD5Util
.
fileRetToMd5
(
selfExaminationBillEntity
.
getCheckFileList
()));
//add
selfExaminationBillEntity
.
setCheckFileList
(
FilesUtil
.
stringFileToList
(
selfExaminationBillEntity
.
getCheckFiles
()));
//1.实体
//获取自查详情
String
str4
=
selfExaminationBillEntity
.
getNewDeviceDetail
();
//添加新增不在系统的装备
List
<
DeviceLibrary
>
newDeviceList
=
new
ArrayList
<>();
if
(
str4
!=
null
)
{
//分隔字符获得rfid卡号
String
[]
split2
=
str4
.
split
(
"\\."
);
newDeviceList
=
new
ArrayList
<>();
for
(
String
rfid:
split2
){
if
(
rfid
.
length
()>
0
){
DeviceLibrary
d
=
new
DeviceLibrary
();
d
.
setCheckResult
(
2
);
d
.
setSeqNumber
(
"-"
);
d
.
setName
(
"-"
);
d
.
setType
(
0
);
d
.
setRfidSurfaceId
(
"-"
);
d
.
setProdNumber
(
"-"
);
d
.
setRfidCardId
(
rfid
);
newDeviceList
.
add
(
d
);
}
}
}
// 2.添加新增不在系统的装备
//根据业务id和业务类型查询
List
<
HistoryDeviceBill
>
historyDeviceBillList
;
Map
<
Integer
,
List
<
HistoryDeviceBill
>>
map1
=
historyDeviceBillRun
.
getMap
();
if
(
map1
.
containsKey
(
billId
)){
historyDeviceBillList
=
map1
.
get
(
billId
);
}
else
{
historyDeviceBillList
=
historyDeviceBillService
.
selectByBillId
(
billId
);
//将数据放在缓存中
map1
.
put
(
billId
,
historyDeviceBillList
);
}
//3.添加自查装备
// list.add(libraryEntities1);
selfExaminationBillEntity
.
setHistoryDeviceBills
(
historyDeviceBillList
);
// 4添加业务日志
if
(
selfExaminationBillEntity
.
getUnStockDetail
()!=
null
){
//5 非在库
newDeviceList
.
addAll
(
Objects
.
requireNonNull
(
JacksonUtil
.
readValue
(
selfExaminationBillEntity
.
getUnStockDetail
(),
new
TypeReference
<
List
<
DeviceLibrary
>>()
{
})));
}
selfExaminationBillEntity
.
setDeviceLibraries
(
newDeviceList
);
//6.添加task
return
selfExaminationBillEntity
;
}
}
dev-selfcheck/src/main/java/com/tykj/dev/device/selfcheck/subject/domin/SelfCheckBill.java
浏览文件 @
d24a4d7e
...
...
@@ -183,4 +183,14 @@ public class SelfCheckBill {
@Transient
private
Integer
taskId
;
@Transient
private
List
<
DeviceLibrary
>
deviceLibraries
;
@Transient
private
List
<
HistoryDeviceBill
>
historyDeviceBills
;
@Transient
@ApiModelProperty
(
value
=
"文件md5"
)
private
String
fileMd5
;
}
dev-train/src/main/java/com/tykj/dev/device/train/controller/TrainJobController.java
浏览文件 @
d24a4d7e
...
...
@@ -809,7 +809,7 @@ public class TrainJobController {
@GetMapping
(
value
=
"/traceabilityParsing/{billId}"
)
@ApiOperation
(
value
=
"根据业务id进行对应业务的溯源"
,
notes
=
"根据业务id进行对应业务的溯源"
)
public
BlockTraceabilityParsing
traceabilityParsing
(
Integer
billId
)
{
public
BlockTraceabilityParsing
traceabilityParsing
(
@PathVariable
Integer
billId
)
{
BlockData
billTypeAndBillId
=
blockDataService
.
findBillTypeAndBillId
(
BusinessEnum
.
TRAIN
.
id
,
billId
);
BcRecord
bcRecord
=
blockService
.
fetchRecord
(
BlockBusinessEnum
.
TRAIN
.
subCode
,
billTypeAndBillId
.
getRecordID
());
TrainDetailsVo
trainDetailsVo
=
trainThemeService
.
findSelectDetailsVo
(
billId
);
...
...
@@ -857,7 +857,7 @@ public class TrainJobController {
@GetMapping
(
value
=
"/checkTrueData/{billId}"
)
@ApiOperation
(
value
=
"根据业务id进行对应业务的验证"
,
notes
=
"根据业务id进行对应业务的验证"
)
public
boolean
checkTrueData
(
Integer
billId
)
{
public
boolean
checkTrueData
(
@PathVariable
Integer
billId
)
{
BlockTraceabilityParsing
blockTraceabilityParsing
=
traceabilityParsing
(
billId
);
boolean
contrast
=
blockDataService
.
contrast
(
blockTraceabilityParsing
);
return
contrast
;
...
...
dev-union/src/main/resources/application-prodT.properties
浏览文件 @
d24a4d7e
...
...
@@ -11,4 +11,5 @@ block.flag=false
qrcode.path
=
/opt/qrcode/
qrcode.preview.path
=
http://10.153.4.11:8088/equipTest/code/
carrier.url
=
http://10.153.4.11:8088/carrierTest/configuration/saveConfiguration
file.matching.excel
=
/data/equipTest/matching/excel/
\ No newline at end of file
file.matching.excel
=
/data/equipTest/matching/excel/
block.carrier.ip
=
http://10.153.4.11:8088/blockTest
\ No newline at end of file
dev-union/src/main/resources/application-test.properties
浏览文件 @
d24a4d7e
...
...
@@ -18,4 +18,6 @@ qrcode.preview.path=http://localhost:8088/equip/code/
carrier.url
=
http://192.168.0.80:8088/carrier/configuration/saveConfiguration
file.matching.excel
=
/data/equip/excel/
\ No newline at end of file
file.matching.excel
=
/data/equip/excel/
block.carrier.ip
=
http://192.168.0.80:8088/block
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论