Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
fec4d3f0
提交
fec4d3f0
authored
1月 11, 2023
作者:
zjm
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(单位模块): 添加了单位逻辑注释
添加了单位逻辑注释
上级
20129fff
隐藏空白字符变更
内嵌
并排
正在显示
37 个修改的文件
包含
783 行增加
和
114 行删除
+783
-114
2021-04-27T124856.403.json
.idea/httpRequests/2021-04-27T124856.403.json
+0
-4
http-requests-log.http
.idea/httpRequests/http-requests-log.http
+0
-59
pom.xml
dev-allot/pom.xml
+4
-0
AllotBillSelectController.java
...ev/device/allot/controller/AllotBillSelectController.java
+18
-0
BackController.java
.../com/tykj/dev/device/allot/controller/BackController.java
+18
-0
AllotBackBillService.java
...m/tykj/dev/device/allot/service/AllotBackBillService.java
+21
-0
AllotBillService.java
...a/com/tykj/dev/device/allot/service/AllotBillService.java
+22
-0
AllotBackBillServiceImpl.java
...v/device/allot/service/impl/AllotBackBillServiceImpl.java
+114
-12
AllotBillServiceImpl.java
...j/dev/device/allot/service/impl/AllotBillServiceImpl.java
+113
-12
TraceabilityParsingData.java
...j/dev/device/block/entity/vo/TraceabilityParsingData.java
+8
-0
DeviceDecommissioningDetail.java
...e/decommissioning/entity/DeviceDecommissioningDetail.java
+4
-0
DeviceDecommissioningDetailService.java
...issioning/service/DeviceDecommissioningDetailService.java
+14
-1
DeviceDecommissioningDetailServiceImpl.java
.../service/impl/DeviceDecommissioningDetailServiceImpl.java
+21
-0
DeviceDestroyBill.java
...j/dev/device/destroy/entity/domain/DeviceDestroyBill.java
+3
-0
DeviceDestroyBillService.java
.../dev/device/destroy/service/DeviceDestroyBillService.java
+5
-0
DeviceDestroyBillServiceImpl.java
...ce/destroy/service/Impl/DeviceDestroyBillServiceImpl.java
+17
-4
FileMD5Util.java
.../main/java/com/tykj/dev/device/file/util/FileMD5Util.java
+11
-6
DeviceLoss.java
...va/com/tykj/dev/device/loss/entity/domain/DeviceLoss.java
+5
-0
DeviceLossService.java
...a/com/tykj/dev/device/loss/service/DeviceLossService.java
+5
-0
DeviceLossServiceImpl.java
...j/dev/device/loss/service/impl/DeviceLossServiceImpl.java
+24
-1
BlockBusinessEnum.java
...c/main/java/com/tykj/dev/misc/base/BlockBusinessEnum.java
+3
-1
ScrapService.java
.../java/com/tykj/dev/device/scrap/service/ScrapService.java
+5
-0
ScrapServiceImpl.java
.../tykj/dev/device/scrap/service/impl/ScrapServiceImpl.java
+22
-11
Scrap.java
...n/java/com/tykj/dev/device/scrap/subject/domin/Scrap.java
+6
-0
DeviceRepelDetail.java
.../dev/device/sendback/entity/domain/DeviceRepelDetail.java
+5
-0
DeviceRepelDetailService.java
...dev/device/sendback/service/DeviceRepelDetailService.java
+5
-0
DeviceRepelDetailServiceImpl.java
...e/sendback/service/impl/DeviceRepelDetailServiceImpl.java
+20
-0
pom.xml
dev-train/pom.xml
+6
-1
TrainApp.java
...ain/src/main/java/com/tykj/dev/device/train/TrainApp.java
+1
-1
HandoverController.java
.../tykj/dev/device/train/controller/HandoverController.java
+17
-0
TrainJobController.java
.../tykj/dev/device/train/controller/TrainJobController.java
+85
-0
WorkHandover.java
...n/java/com/tykj/dev/device/train/entity/WorkHandover.java
+12
-0
TrainDetailsVo.java
...a/com/tykj/dev/device/train/entity/vo/TrainDetailsVo.java
+5
-0
WorkHandoverService.java
...om/tykj/dev/device/train/service/WorkHandoverService.java
+11
-0
WorkHandoverServiceImpl.java
...ev/device/train/service/impl/WorkHandoverServiceImpl.java
+111
-1
RunController.java
...union/src/main/java/com/tykj/dev/union/RunController.java
+36
-0
pom.xml
pom.xml
+6
-0
没有找到文件。
.idea/httpRequests/2021-04-27T124856.403.json
deleted
100644 → 0
浏览文件 @
20129fff
{
"code"
:
403
,
"msg"
:
"用户未登陆"
}
.idea/httpRequests/http-requests-log.http
deleted
100644 → 0
浏览文件 @
20129fff
GET http://127.0.0.1:8087/actuator
Accept: application/vnd.spring-boot.actuator.v2+json
<> 2021-09-03T192754.200.json
###
GET http://127.0.0.1:8087/actuator
Accept: application/vnd.spring-boot.actuator.v2+json
<> 2021-09-03T192650.403.json
###
GET http://127.0.0.1:8087/actuator
Accept: application/vnd.spring-boot.actuator.v2+json
<> 2021-09-03T192615.403.json
###
GET http://127.0.0.1:8087/printDocuments1
<> 2021-04-27T124856.403.json
###
GET http://127.0.0.1:8087/printDocuments1
<> 2021-03-17T074418.403.json
###
GET http://127.0.0.1:8087/blockcha/sendHash/{code}/{content}
###
GET http://127.0.0.1:8087/blockcha/sendHash/{code}/{content}
###
GET http://127.0.0.1:8087/blockcha/sendHash/{code}/{content}
###
POST http://127.0.0.1:8087/units/save
###
POST http://127.0.0.1:8087/units/save
###
POST http://127.0.0.1:8087/units/save
<> 2020-11-05T102636.403.json
###
dev-allot/pom.xml
浏览文件 @
fec4d3f0
...
...
@@ -24,6 +24,10 @@
<groupId>
com.tykj
</groupId>
<artifactId>
dev-task
</artifactId>
</dependency>
<dependency>
<groupId>
com.tykj
</groupId>
<artifactId>
dev-block
</artifactId>
</dependency>
<dependency>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
misc
</artifactId>
...
...
dev-allot/src/main/java/com/tykj/dev/device/allot/controller/AllotBillSelectController.java
浏览文件 @
fec4d3f0
...
...
@@ -230,4 +230,22 @@ public class AllotBillSelectController {
return
ResponseEntity
.
ok
(
list
);
}
/**
* 区块验证
*/
@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/controller/BackController.java
浏览文件 @
fec4d3f0
...
...
@@ -1005,4 +1005,22 @@ public class BackController {
return
ResponseEntity
.
ok
(
"撤回成功"
);
}
/**
* 区块验证
*/
@GetMapping
(
value
=
"/checkTrueData/{billId}"
)
@ApiOperation
(
value
=
"根据业务id进行对应业务的验证"
,
notes
=
"根据业务id进行对应业务的验证"
)
public
ResponseEntity
checkTrueData
(
@PathVariable
Integer
billId
){
return
ResponseEntity
.
ok
(
allotBackBillService
.
checkTrueData
(
billId
));
}
/**
* 区块溯源
*/
@GetMapping
(
value
=
"/traceabilityParsing/{billId}"
)
@ApiOperation
(
value
=
"根据业务id进行对应业务的溯源"
,
notes
=
"根据业务id进行对应业务的溯源"
)
public
ResponseEntity
traceabilityParsing
(
@PathVariable
Integer
billId
){
return
ResponseEntity
.
ok
(
allotBackBillService
.
traceabilityParsing
(
billId
));
}
}
dev-allot/src/main/java/com/tykj/dev/device/allot/service/AllotBackBillService.java
浏览文件 @
fec4d3f0
...
...
@@ -2,6 +2,7 @@ package com.tykj.dev.device.allot.service;
import
com.tykj.dev.device.allot.subject.domin.AllotBackBill
;
import
com.tykj.dev.device.allot.subject.vo.AllotBillSelectVo
;
import
com.tykj.dev.device.block.entity.vo.BlockTraceabilityParsing
;
import
com.tykj.dev.device.file.entity.FileRet
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Pageable
;
...
...
@@ -38,4 +39,24 @@ public interface AllotBackBillService {
* @return
*/
Map
<
String
,
List
<
FileRet
>>
getFileList
(
Integer
taskId
);
/**
* 验证接口
* @param billId 业务id
* @return 正确与否
*/
boolean
checkTrueData
(
Integer
billId
);
/**
* 溯源接口
* @param billId 业务id
* @return 溯源信息实体
*/
BlockTraceabilityParsing
traceabilityParsing
(
Integer
billId
);
/**
* 历史数据上链
*/
void
historyUpperChain
();
}
dev-allot/src/main/java/com/tykj/dev/device/allot/service/AllotBillService.java
浏览文件 @
fec4d3f0
...
...
@@ -3,6 +3,7 @@ package com.tykj.dev.device.allot.service;
import
com.tykj.dev.device.allot.subject.domin.AllotBill
;
import
com.tykj.dev.device.allot.subject.vo.AllotBillSelectVo
;
import
com.tykj.dev.device.allot.subject.vo.UpdateFilesVO
;
import
com.tykj.dev.device.block.entity.vo.BlockTraceabilityParsing
;
import
com.tykj.dev.device.file.entity.FileRet
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Pageable
;
...
...
@@ -74,4 +75,25 @@ public interface AllotBillService {
* @return
*/
AllotBill
updateFiles
(
UpdateFilesVO
updateFilesVO
);
/**
* 验证接口
* @param billId 业务id
* @return 正确与否
*/
boolean
checkTrueData
(
Integer
billId
);
/**
* 溯源接口
* @param billId 业务id
* @return 溯源信息实体
*/
BlockTraceabilityParsing
traceabilityParsing
(
Integer
billId
);
/**
* 历史数据上链
*/
void
historyUpperChain
();
}
dev-allot/src/main/java/com/tykj/dev/device/allot/service/impl/AllotBackBillServiceImpl.java
浏览文件 @
fec4d3f0
package
com
.
tykj
.
dev
.
device
.
allot
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.github.wenhao.jpa.PredicateBuilder
;
import
com.github.wenhao.jpa.Specifications
;
import
com.tykj.dev.blockcha.subject.entity.BcHash
;
...
...
@@ -8,16 +10,29 @@ import com.tykj.dev.config.TaskBeanConfig;
import
com.tykj.dev.config.base.FileName
;
import
com.tykj.dev.device.allot.repository.AllotBackBillDao
;
import
com.tykj.dev.device.allot.service.AllotBackBillService
;
import
com.tykj.dev.device.allot.service.AllotBillService
;
import
com.tykj.dev.device.allot.subject.domin.AllotBackBill
;
import
com.tykj.dev.device.allot.subject.domin.AllotBill
;
import
com.tykj.dev.device.allot.subject.vo.AllotBillSelectVo
;
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.library.subject.vo.ScriptSaveVo
;
import
com.tykj.dev.device.task.service.TaskService
;
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.utils.DateUtil
;
import
com.tykj.dev.misc.utils.JacksonUtil
;
import
com.tykj.dev.misc.utils.ResultUtil
;
import
com.tykj.dev.misc.utils.StringSplitUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Pageable
;
...
...
@@ -32,6 +47,7 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.stream.Collectors
;
/**
* @author dengdiyi
...
...
@@ -39,6 +55,12 @@ import java.util.concurrent.CompletableFuture;
@Service
public
class
AllotBackBillServiceImpl
implements
AllotBackBillService
{
@Autowired
BlockService
blockService
;
@Autowired
BlockDataService
blockDataService
;
@Autowired
private
AllotBackBillDao
allotBackBillDao
;
...
...
@@ -60,18 +82,7 @@ public class AllotBackBillServiceImpl implements AllotBackBillService {
//异步上链
CompletableFuture
.
runAsync
(()->{
//延迟2s防止同时写入
try
{
Thread
.
sleep
(
2000
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
//获取最新数据
AllotBackBill
allotBackBill2
=
getOne
(
allotBackBill1
.
getId
());
//上链获得recordId并存入表中
BcHash
bcText
=
blockChainUtil
.
sendHash
(
1000
,
JacksonUtil
.
toJSon
(
allotBackBill2
));
String
recordId
=
bcText
.
getData
().
getRecordID
();
allotBackBill2
.
setRecordId
(
recordId
);
allotBackBillDao
.
save
(
allotBackBill2
);
sendText
(
allotBackBill1
.
getId
());
},
TaskBeanConfig
.
getThreadPoolTaskScheduler
());
return
allotBackBill1
;
}
...
...
@@ -150,6 +161,97 @@ public class AllotBackBillServiceImpl implements AllotBackBillService {
return
map
;
}
@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
.
ALLOT
.
id
,
billId
);
BcRecord
bcRecord
=
blockService
.
fetchRecord
(
BlockBusinessEnum
.
ALLOT
.
subCode
,
billTypeAndBillId
.
getRecordID
());
AllotBackBill
allotBackBill
=
queryAllotBill
(
billId
);
AllotBackBill
allotBackBill1
=
JSON
.
parseObject
(
bcRecord
.
getData
().
getContent
(),
AllotBackBill
.
class
);
BlockTraceabilityParsing
blockTraceabilityParsing
=
bcRecord
.
getData
().
toBlockTraceabilityParsing
();
blockTraceabilityParsing
.
setBusinessTraceabilityParsingData
(
TraceabilityParsingData
.
builder
()
.
billTypeName
(
"退回"
)
//业务名称
.
applyNumber
(
allotBackBill
.
getApplyNumber
())
//申请文号
.
replayNumber
(
allotBackBill
.
getReplayNumber
())
//批复文号
// .fileMd5(deviceDecommissioningDetail.getFileMd5())
.
carrierIds
(
StringSplitUtil
.
stringListToString
(
allotBackBill
.
getScripts
().
stream
().
map
(
ScriptSaveVo:
:
getSeqNumber
).
collect
(
Collectors
.
toList
())))
//序列号信息
.
initiateUnitName
(
allotBackBill
.
getSendUnit
())
//发起单位
.
receiveUnitName
(
allotBackBill
.
getReceiveUnit
())
//接收单位
.
documentNo
(
allotBackBill
.
getNum
())
//单据号
.
operationTime
(
DateUtil
.
getLocalDateTime
(
allotBackBill
.
getSendTime
()))
//发起时间
.
operatorUserName
(
operatorName
(
allotBackBill
))
//相关人员
.
build
());
blockTraceabilityParsing
.
setBlockTraceabilityParsingData
(
TraceabilityParsingData
.
builder
()
.
billTypeName
(
"退回"
)
.
applyNumber
(
allotBackBill1
.
getApplyNumber
())
.
replayNumber
(
allotBackBill1
.
getReplayNumber
())
// .fileMd5(deviceDecommissioningDetail.getFileMd5())
.
carrierIds
(
StringSplitUtil
.
stringListToString
(
allotBackBill1
.
getScripts
().
stream
().
map
(
ScriptSaveVo:
:
getSeqNumber
).
collect
(
Collectors
.
toList
())))
.
initiateUnitName
(
allotBackBill1
.
getSendUnit
())
.
receiveUnitName
(
allotBackBill1
.
getReceiveUnit
())
.
documentNo
(
allotBackBill1
.
getNum
())
.
operationTime
(
DateUtil
.
getLocalDateTime
(
allotBackBill1
.
getSendTime
()))
.
operatorUserName
(
operatorName
(
allotBackBill1
))
.
build
());
blockTraceabilityParsing
.
setBlockData
(
allotBackBill1
);
blockTraceabilityParsing
.
setCurrentData
(
allotBackBill
);
return
blockTraceabilityParsing
;
}
@Override
public
void
historyUpperChain
()
{
//历史数据 循环查询数据上链
}
/**
* 拼写相关人员字符
*/
private
String
operatorName
(
AllotBackBill
allotBill
)
{
StringBuffer
buf
=
new
StringBuffer
();
buf
.
append
(
allotBill
.
getSenderUserA
())
.
append
(
","
)
.
append
(
allotBill
.
getSenderUserB
())
.
append
(
","
)
.
append
(
allotBill
.
getReceiveUserA
())
.
append
(
","
)
.
append
(
allotBill
.
getReceiveUserB
());
return
buf
.
toString
();
}
/**
* 文本上链接口
* @param billId 业务id
*/
private
void
sendText
(
Integer
billId
){
AllotBackBill
allotBackBill
=
queryAllotBill
(
billId
);
// 区块业务状态码,上链json数据,业务类型,业务id,发起单位
blockService
.
sendText
(
BlockBusinessEnum
.
ALLOT_BACK
.
subCode
,
JacksonUtil
.
toJSon
(
allotBackBill
),
BusinessEnum
.
ALLOT_BACK
.
id
,
billId
,
allotBackBill
.
getSendUnit
());
}
private
AllotBackBill
queryAllotBill
(
Integer
allotBillId
){
AllotBackBill
allotBackBill
=
allotBackBillDao
.
findById
(
allotBillId
).
get
();
allotBackBill
.
setReplyFileList
(
FilesUtil
.
stringFileToList
(
allotBackBill
.
getReplyFiles
()));
allotBackBill
.
setApplyFileList
(
FilesUtil
.
stringFileToList
(
allotBackBill
.
getApplyFiles
()));
allotBackBill
.
setSendFileList
(
FilesUtil
.
stringFileToList
(
allotBackBill
.
getSendFiles
()));
allotBackBill
.
setReceiveFileList
(
FilesUtil
.
stringFileToList
(
allotBackBill
.
getReceiveFiles
()));
allotBackBill
.
setScripts
(
JacksonUtil
.
readValue
(
allotBackBill
.
getScriptJson
(),
new
TypeReference
<
List
<
ScriptSaveVo
>>()
{
}));
return
allotBackBill
;
}
/**
* @param allotBillSelectVo 查询vo
* 查询统一筛选器
...
...
dev-allot/src/main/java/com/tykj/dev/device/allot/service/impl/AllotBillServiceImpl.java
浏览文件 @
fec4d3f0
package
com
.
tykj
.
dev
.
device
.
allot
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.github.wenhao.jpa.PredicateBuilder
;
import
com.github.wenhao.jpa.Specifications
;
import
com.tykj.dev.blockcha.subject.entity.BcHash
;
...
...
@@ -11,8 +13,15 @@ import com.tykj.dev.device.allot.service.AllotBillService;
import
com.tykj.dev.device.allot.subject.domin.AllotBill
;
import
com.tykj.dev.device.allot.subject.vo.AllotBillSelectVo
;
import
com.tykj.dev.device.allot.subject.vo.UpdateFilesVO
;
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.library.subject.vo.ScriptSaveVo
;
import
com.tykj.dev.device.task.service.TaskLogService
;
import
com.tykj.dev.device.task.service.TaskService
;
import
com.tykj.dev.device.task.subject.bto.TaskBto
;
...
...
@@ -20,7 +29,12 @@ import com.tykj.dev.device.task.subject.bto.TaskLogBto;
import
com.tykj.dev.device.task.subject.vo.TaskFileRet
;
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.utils.DateUtil
;
import
com.tykj.dev.misc.utils.JacksonUtil
;
import
com.tykj.dev.misc.utils.StringSplitUtil
;
import
org.aspectj.util.FileUtil
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -35,6 +49,7 @@ import javax.persistence.Transient;
import
java.lang.reflect.Field
;
import
java.util.*
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.stream.Collectors
;
/**
* @author dengdiyi
...
...
@@ -57,6 +72,12 @@ public class AllotBillServiceImpl implements AllotBillService {
@Autowired
TaskService
taskService
;
@Autowired
BlockService
blockService
;
@Autowired
BlockDataService
blockDataService
;
@Resource
private
TaskLogService
taskLogService
;
...
...
@@ -66,18 +87,7 @@ public class AllotBillServiceImpl implements AllotBillService {
//异步上链
CompletableFuture
.
runAsync
(()
->{
//延迟2s防止同时写入
try
{
Thread
.
sleep
(
2000
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
//获取最新数据
AllotBill
allotBill1
=
getOne
(
allotBill
.
getId
());
//上链获得recordId并存入表中
BcHash
bcText
=
blockChainUtil
.
sendHash
(
1000
,
JacksonUtil
.
toJSon
(
allotBill1
));
String
recordId
=
bcText
.
getData
().
getRecordID
();
allotBill1
.
setRecordId
(
recordId
);
allotBillDao
.
save
(
allotBill1
);
sendText
(
allotBill
.
getId
());
},
TaskBeanConfig
.
getThreadPoolTaskScheduler
());
return
allotBill
;
}
...
...
@@ -228,6 +238,97 @@ public class AllotBillServiceImpl implements AllotBillService {
return
update
;
}
@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
.
ALLOT
.
id
,
billId
);
BcRecord
bcRecord
=
blockService
.
fetchRecord
(
BlockBusinessEnum
.
ALLOT
.
subCode
,
billTypeAndBillId
.
getRecordID
());
AllotBill
allotBill
=
queryAllotBill
(
billId
);
AllotBill
allotBill1
=
JSON
.
parseObject
(
bcRecord
.
getData
().
getContent
(),
AllotBill
.
class
);
BlockTraceabilityParsing
blockTraceabilityParsing
=
bcRecord
.
getData
().
toBlockTraceabilityParsing
();
blockTraceabilityParsing
.
setBusinessTraceabilityParsingData
(
TraceabilityParsingData
.
builder
()
.
billTypeName
(
"配发"
)
//业务名称
.
applyNumber
(
allotBill
.
getApplyNumber
())
//申请文号
.
replayNumber
(
allotBill
.
getReplayNumber
())
//批复文号
// .fileMd5(deviceDecommissioningDetail.getFileMd5())
.
carrierIds
(
StringSplitUtil
.
stringListToString
(
allotBill
.
getScripts
().
stream
().
map
(
ScriptSaveVo:
:
getSeqNumber
).
collect
(
Collectors
.
toList
())))
//序列号信息
.
initiateUnitName
(
allotBill
.
getSendUnit
())
//发起单位
.
receiveUnitName
(
allotBill
.
getReceiveUnit
())
//接收单位
.
documentNo
(
allotBill
.
getNum
())
//单据号
.
operationTime
(
DateUtil
.
getLocalDateTime
(
allotBill
.
getSendTime
()))
//发起时间
.
operatorUserName
(
operatorName
(
allotBill
))
//相关人员
.
build
());
blockTraceabilityParsing
.
setBlockTraceabilityParsingData
(
TraceabilityParsingData
.
builder
()
.
billTypeName
(
"配发"
)
.
applyNumber
(
allotBill1
.
getApplyNumber
())
.
replayNumber
(
allotBill1
.
getReplayNumber
())
// .fileMd5(deviceDecommissioningDetail.getFileMd5())
.
carrierIds
(
StringSplitUtil
.
stringListToString
(
allotBill1
.
getScripts
().
stream
().
map
(
ScriptSaveVo:
:
getSeqNumber
).
collect
(
Collectors
.
toList
())))
.
initiateUnitName
(
allotBill1
.
getSendUnit
())
.
receiveUnitName
(
allotBill1
.
getReceiveUnit
())
.
documentNo
(
allotBill1
.
getNum
())
.
operationTime
(
DateUtil
.
getLocalDateTime
(
allotBill1
.
getSendTime
()))
.
operatorUserName
(
operatorName
(
allotBill1
))
.
build
());
blockTraceabilityParsing
.
setBlockData
(
allotBill1
);
blockTraceabilityParsing
.
setCurrentData
(
allotBill
);
return
blockTraceabilityParsing
;
}
@Override
public
void
historyUpperChain
()
{
//历史数据 循环查询数据上链
}
/**
* 拼写相关人员字符
*/
private
String
operatorName
(
AllotBill
allotBill
)
{
StringBuffer
buf
=
new
StringBuffer
();
buf
.
append
(
allotBill
.
getSenderUserA
())
.
append
(
","
)
.
append
(
allotBill
.
getSenderUserB
())
.
append
(
","
)
.
append
(
allotBill
.
getReceiveUserA
())
.
append
(
","
)
.
append
(
allotBill
.
getReceiveUserB
());
return
buf
.
toString
();
}
/**
* 文本上链接口
* @param billId 业务id
*/
private
void
sendText
(
Integer
billId
){
AllotBill
allotBill
=
queryAllotBill
(
billId
);
// 区块业务状态码,上链json数据,业务类型,业务id,发起单位
blockService
.
sendText
(
BlockBusinessEnum
.
ALLOT
.
subCode
,
JacksonUtil
.
toJSon
(
allotBill
),
BusinessEnum
.
ALLOT
.
id
,
billId
,
allotBill
.
getSendUnit
());
}
private
AllotBill
queryAllotBill
(
Integer
allotBillId
){
AllotBill
allotBill
=
allotBillDao
.
findById
(
allotBillId
).
get
();
allotBill
.
setReplyFileList
(
FilesUtil
.
stringFileToList
(
allotBill
.
getReplyFiles
()));
allotBill
.
setApplyFileList
(
FilesUtil
.
stringFileToList
(
allotBill
.
getApplyFiles
()));
allotBill
.
setSendFileList
(
FilesUtil
.
stringFileToList
(
allotBill
.
getSendFiles
()));
allotBill
.
setReceiveFileList
(
FilesUtil
.
stringFileToList
(
allotBill
.
getReceiveFiles
()));
allotBill
.
setScripts
(
JacksonUtil
.
readValue
(
allotBill
.
getScriptJson
(),
new
TypeReference
<
List
<
ScriptSaveVo
>>()
{
}));
return
allotBill
;
}
/**
* @param allotBillSelectVo 查询vo
* 查询统一筛选器
...
...
dev-block/src/main/java/com/tykj/dev/device/block/entity/vo/TraceabilityParsingData.java
浏览文件 @
fec4d3f0
...
...
@@ -55,5 +55,13 @@ public class TraceabilityParsingData {
@ApiModelProperty
(
value
=
"对应业务创建时间"
)
private
String
time
;
@ApiModelProperty
(
value
=
"文件md5"
)
private
String
fileMd5
;
@ApiModelProperty
(
value
=
"申请文号"
)
private
String
applyNumber
;
@ApiModelProperty
(
value
=
"批复文号"
)
private
String
replayNumber
;
}
dev-decommissioning/src/main/java/com/tykj/dev/device/decommissioning/entity/DeviceDecommissioningDetail.java
浏览文件 @
fec4d3f0
...
...
@@ -238,6 +238,10 @@ public class DeviceDecommissioningDetail extends BaseEntity {
@ApiModelProperty
(
value
=
"任务id"
)
private
Integer
taskId
;
@Transient
@ApiModelProperty
(
value
=
"文件md5"
)
private
String
fileMd5
;
public
Documents
toDoc
(){
return
new
Documents
(
num
,
"装备清退单据"
,
receiveUnit
,
replayNumber
,
sendUnit
,
null
,
null
,
senderUserA
,
senderUserB
,
receiveUserA
,
receiveUserB
,
null
);
}
...
...
dev-decommissioning/src/main/java/com/tykj/dev/device/decommissioning/service/DeviceDecommissioningDetailService.java
浏览文件 @
fec4d3f0
...
...
@@ -47,10 +47,23 @@ public interface DeviceDecommissioningDetailService {
Map
<
String
,
List
<
FileRet
>>
findByIdToFileMapList
(
Integer
id
);
/**
* 验证接口
* @param billId 业务id
* @return 正确与否
*/
boolean
checkTrueData
(
Integer
billId
);
/**
* 溯源接口
* @param billId 业务id
* @return 溯源信息实体
*/
BlockTraceabilityParsing
traceabilityParsing
(
Integer
billId
);
/**
* 历史数据上链
*/
void
historyUpperChain
();
}
dev-decommissioning/src/main/java/com/tykj/dev/device/decommissioning/service/impl/DeviceDecommissioningDetailServiceImpl.java
浏览文件 @
fec4d3f0
...
...
@@ -20,6 +20,7 @@ import com.tykj.dev.device.decommissioning.repository.DeviceDecommissioningDetai
import
com.tykj.dev.device.decommissioning.service.DeviceDecommissioningDetailService
;
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.repository.DeviceLibraryDao
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
com.tykj.dev.device.library.subject.vo.ScriptSaveVo
;
...
...
@@ -199,6 +200,9 @@ public class DeviceDecommissioningDetailServiceImpl implements DeviceDecommissio
BlockTraceabilityParsing
blockTraceabilityParsing
=
bcRecord
.
getData
().
toBlockTraceabilityParsing
();
blockTraceabilityParsing
.
setBusinessTraceabilityParsingData
(
TraceabilityParsingData
.
builder
()
.
billTypeName
(
"退役"
)
.
applyNumber
(
deviceDecommissioningDetail
.
getApplyNumber
())
.
replayNumber
(
deviceDecommissioningDetail
.
getReplayNumber
())
.
fileMd5
(
deviceDecommissioningDetail
.
getFileMd5
())
.
carrierIds
(
StringSplitUtil
.
stringListToString
(
deviceDecommissioningDetail
.
getScripts
().
stream
().
map
(
ScriptSaveVo:
:
getSeqNumber
).
collect
(
Collectors
.
toList
())))
.
initiateUnitName
(
deviceDecommissioningDetail
.
getSendUnit
())
.
receiveUnitName
(
deviceDecommissioningDetail
.
getReceiveUnit
())
...
...
@@ -209,6 +213,9 @@ public class DeviceDecommissioningDetailServiceImpl implements DeviceDecommissio
blockTraceabilityParsing
.
setBlockTraceabilityParsingData
(
TraceabilityParsingData
.
builder
()
.
billTypeName
(
"退役"
)
.
applyNumber
(
deviceDecommissioningDetail1
.
getApplyNumber
())
.
replayNumber
(
deviceDecommissioningDetail1
.
getReplayNumber
())
.
fileMd5
(
deviceDecommissioningDetail1
.
getFileMd5
())
.
carrierIds
(
StringSplitUtil
.
stringListToString
(
deviceDecommissioningDetail1
.
getScripts
().
stream
().
map
(
ScriptSaveVo:
:
getSeqNumber
).
collect
(
Collectors
.
toList
())))
.
initiateUnitName
(
deviceDecommissioningDetail1
.
getSendUnit
())
.
receiveUnitName
(
deviceDecommissioningDetail1
.
getReceiveUnit
())
...
...
@@ -221,6 +228,14 @@ public class DeviceDecommissioningDetailServiceImpl implements DeviceDecommissio
return
blockTraceabilityParsing
;
}
@Override
public
void
historyUpperChain
()
{
deviceDecommissioningDetailDao
.
findAll
().
forEach
(
deviceDecommissioningDetail
->
sendText
(
deviceDecommissioningDetail
.
getId
())
);
}
private
String
operatorName
(
DeviceDecommissioningDetail
deviceDecommissioningDetail
)
{
StringBuffer
buf
=
new
StringBuffer
();
...
...
@@ -260,6 +275,12 @@ public class DeviceDecommissioningDetailServiceImpl implements DeviceDecommissio
DeviceDecommissioningDetail
deviceDecommissioningDetail
=
optional
.
get
();
deviceDecommissioningDetail
.
setScripts
(
JacksonUtil
.
readValue
(
deviceDecommissioningDetail
.
getScriptJson
(),
new
TypeReference
<
List
<
ScriptSaveVo
>>()
{
}));
deviceDecommissioningDetail
.
setBillFiles
(
FilesUtil
.
stringFileToList
(
deviceDecommissioningDetail
.
getBillFile
()));
deviceDecommissioningDetail
.
setOutboundFiles
(
FilesUtil
.
stringFileToList
(
deviceDecommissioningDetail
.
getOutboundFile
()));
deviceDecommissioningDetail
.
setInFiles
(
FilesUtil
.
stringFileToList
(
deviceDecommissioningDetail
.
getInFile
()));
deviceDecommissioningDetail
.
setReplyFileList
(
FilesUtil
.
stringFileToList
(
deviceDecommissioningDetail
.
getReplyFiles
()));
deviceDecommissioningDetail
.
setApplyFileList
(
FilesUtil
.
stringFileToList
(
deviceDecommissioningDetail
.
getApplyFiles
()));
deviceDecommissioningDetail
.
setFileMd5
(
FileMD5Util
.
fileRetToMd5
(
deviceDecommissioningDetail
.
getReplyFileList
()));
deviceDecommissioningDetail
.
setScriptJson
(
null
);
return
deviceDecommissioningDetail
;
}
else
{
...
...
dev-destroy/src/main/java/com/tykj/dev/device/destroy/entity/domain/DeviceDestroyBill.java
浏览文件 @
fec4d3f0
...
...
@@ -115,4 +115,7 @@ public class DeviceDestroyBill extends BaseEntity {
@Transient
private
String
unitName
;
@Transient
@ApiModelProperty
(
value
=
"文件md5"
)
private
String
fileMd5
;
}
dev-destroy/src/main/java/com/tykj/dev/device/destroy/service/DeviceDestroyBillService.java
浏览文件 @
fec4d3f0
...
...
@@ -48,4 +48,9 @@ public interface DeviceDestroyBillService {
boolean
checkTrueData
(
Integer
billId
);
BlockTraceabilityParsing
traceabilityParsing
(
Integer
billId
);
/**
* 历史数据上链
*/
void
historyUpperChain
();
}
dev-destroy/src/main/java/com/tykj/dev/device/destroy/service/Impl/DeviceDestroyBillServiceImpl.java
浏览文件 @
fec4d3f0
...
...
@@ -19,6 +19,7 @@ import com.tykj.dev.device.destroy.repository.DeviceDestroyBillDao;
import
com.tykj.dev.device.destroy.service.DeviceDestroyBillService
;
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.repository.DeviceLibraryDao
;
import
com.tykj.dev.device.library.service.DeviceLibraryService
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
...
...
@@ -94,11 +95,14 @@ public class DeviceDestroyBillServiceImpl implements DeviceDestroyBillService {
if
(
byId
.
isPresent
()){
DeviceDestroyBill
deviceDestroyBill
=
byId
.
get
();
deviceDestroyBill
.
setScripts
(
JacksonUtil
.
readValue
(
deviceDestroyBill
.
getScriptJson
(),
new
TypeReference
<
List
<
ScriptSaveVo
>>()
{}));
deviceDestroyBill
.
setApplyFileList
(
FilesUtil
.
stringFileToList
(
deviceDestroyBill
.
getApplyFiles
()));
deviceDestroyBill
.
setDestructionFileList
(
FilesUtil
.
stringFileToList
(
deviceDestroyBill
.
getDestructionFiles
()));
deviceDestroyBill
.
setReplayFileList
(
FilesUtil
.
stringFileToList
(
deviceDestroyBill
.
getReplayFiles
()));
deviceDestroyBill
.
setFileMd5
(
FileMD5Util
.
fileRetToMd5
(
deviceDestroyBill
.
getDestructionFileList
()));
return
deviceDestroyBill
;
}
else
{
throw
new
ApiException
(
"[销毁] 根据id查询上链信息失败:"
+
scrapId
);
}
}
@Override
...
...
@@ -190,6 +194,8 @@ public class DeviceDestroyBillServiceImpl implements DeviceDestroyBillService {
BlockTraceabilityParsing
blockTraceabilityParsing
=
bcRecord
.
getData
().
toBlockTraceabilityParsing
();
blockTraceabilityParsing
.
setBusinessTraceabilityParsingData
(
TraceabilityParsingData
.
builder
()
.
billTypeName
(
"销毁"
)
.
applyNumber
(
deviceDestroyBill
.
getApplyNumber
())
.
replayNumber
(
deviceDestroyBill
.
getReplayNumber
())
.
carrierIds
(
StringSplitUtil
.
stringListToString
(
deviceDestroyBill
.
getScripts
().
stream
().
map
(
ScriptSaveVo:
:
getSeqNumber
).
collect
(
Collectors
.
toList
())))
.
unitName
(
deviceDestroyBill
.
getUnitName
())
.
documentNo
(
deviceDestroyBill
.
getNum
())
...
...
@@ -199,6 +205,8 @@ public class DeviceDestroyBillServiceImpl implements DeviceDestroyBillService {
blockTraceabilityParsing
.
setBlockTraceabilityParsingData
(
TraceabilityParsingData
.
builder
()
.
billTypeName
(
"销毁"
)
.
applyNumber
(
deviceDestroyBill1
.
getApplyNumber
())
.
replayNumber
(
deviceDestroyBill1
.
getReplayNumber
())
.
carrierIds
(
StringSplitUtil
.
stringListToString
(
deviceDestroyBill1
.
getScripts
().
stream
().
map
(
ScriptSaveVo:
:
getSeqNumber
).
collect
(
Collectors
.
toList
())))
.
unitName
(
deviceDestroyBill1
.
getUnitName
())
.
documentNo
(
deviceDestroyBill1
.
getNum
())
...
...
@@ -210,6 +218,13 @@ public class DeviceDestroyBillServiceImpl implements DeviceDestroyBillService {
return
blockTraceabilityParsing
;
}
@Override
public
void
historyUpperChain
()
{
deviceDestroyBillDao
.
findAll
().
forEach
(
deviceDestroyBill
->
sendText
(
deviceDestroyBill
.
getId
())
);
}
private
String
operatorName
(
DeviceDestroyBill
deviceDestroyBill
)
{
StringBuffer
buf
=
new
StringBuffer
();
...
...
@@ -221,7 +236,6 @@ public class DeviceDestroyBillServiceImpl implements DeviceDestroyBillService {
.
append
(
","
)
.
append
(
deviceDestroyBill
.
getAgent
());
return
buf
.
toString
();
}
//验真
...
...
@@ -233,12 +247,11 @@ public class DeviceDestroyBillServiceImpl implements DeviceDestroyBillService {
return
contrast
;
}
/**
* 上链接口
*/
public
void
sendText
(
Integer
id
){
DeviceDestroyBill
deviceDestroyBill
=
queryScrapId
(
id
);
blockService
.
sendText
(
BlockBusinessEnum
.
DESTROY
.
subCode
,
JSON
.
toJSONStringWithDateFormat
(
deviceDestroyBill
,
"yyyy-MM-dd HH:mm:ss"
,
SerializerFeature
.
WriteDateUseDateFormat
),
BusinessEnum
.
DESTROY
.
id
,
id
,
deviceDestroyBill
.
getUnitName
());
blockService
.
sendText
(
BlockBusinessEnum
.
DESTROY
.
subCode
,
JacksonUtil
.
toJSon
(
deviceDestroyBill
),
BusinessEnum
.
DESTROY
.
id
,
id
,
deviceDestroyBill
.
getUnitName
());
}
}
dev-file/src/main/java/com/tykj/dev/device/file/util/FileMD5Util.java
浏览文件 @
fec4d3f0
...
...
@@ -40,13 +40,18 @@ public class FileMD5Util {
*/
public
static
String
fileRetToMd5
(
List
<
FileRet
>
fileRets
){
StringBuffer
stringBuffer
=
new
StringBuffer
();
if
(
fileRets
!=
null
)
{
fileRets
.
forEach
(
fileRet
->
{
stringBuffer
.
append
(
getFileMD5
(
new
File
(
fileRet
.
getFilePath
()))).
append
(
","
);
}
);
return
stringBuffer
.
toString
();
}
else
{
return
""
;
}
fileRets
.
forEach
(
fileRet
->
{
stringBuffer
.
append
(
getFileMD5
(
new
File
(
fileRet
.
getFilePath
()))).
append
(
","
);
}
);
return
stringBuffer
.
toString
();
}
...
...
dev-loss/src/main/java/com/tykj/dev/device/loss/entity/domain/DeviceLoss.java
浏览文件 @
fec4d3f0
...
...
@@ -132,6 +132,11 @@ public class DeviceLoss extends BaseEntity {
private
List
<
DeviceLossVo
>
deviceLossVoList
;
@Transient
@ApiModelProperty
(
value
=
"文件md5"
)
private
String
fileMd5
;
// public String getDevIds() {
// return devIds;
// }
...
...
dev-loss/src/main/java/com/tykj/dev/device/loss/service/DeviceLossService.java
浏览文件 @
fec4d3f0
...
...
@@ -30,4 +30,9 @@ public interface DeviceLossService {
boolean
checkTrueData
(
Integer
billId
);
BlockTraceabilityParsing
traceabilityParsing
(
Integer
billId
);
/**
* 历史数据上链
*/
void
historyUpperChain
();
}
dev-loss/src/main/java/com/tykj/dev/device/loss/service/impl/DeviceLossServiceImpl.java
浏览文件 @
fec4d3f0
...
...
@@ -2,6 +2,7 @@ package com.tykj.dev.device.loss.service.impl;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.serializer.SerializerFeature
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.tykj.dev.blockcha.subject.service.BlockChainUtil
;
import
com.tykj.dev.device.block.entity.BlockData
;
import
com.tykj.dev.device.block.entity.bc.BcRecord
;
...
...
@@ -9,6 +10,9 @@ 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.repository.DeviceLibraryDao
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
com.tykj.dev.device.library.subject.vo.ScriptSaveVo
;
...
...
@@ -17,6 +21,8 @@ import com.tykj.dev.device.loss.entity.vo.DeviceLossVo;
import
com.tykj.dev.device.loss.repository.LossDao
;
import
com.tykj.dev.device.loss.service.DeviceLossService
;
import
com.tykj.dev.device.loss.util.StringUtils
;
import
com.tykj.dev.device.user.cache.UserCache
;
import
com.tykj.dev.device.user.subject.entity.User
;
import
com.tykj.dev.misc.base.BeanHelper
;
import
com.tykj.dev.misc.base.BlockBusinessEnum
;
import
com.tykj.dev.misc.base.BusinessEnum
;
...
...
@@ -28,6 +34,7 @@ import org.modelmapper.ModelMapper;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.stream.Collectors
;
...
...
@@ -42,6 +49,9 @@ import java.util.stream.Collectors;
@Service
@Slf4j
public
class
DeviceLossServiceImpl
implements
DeviceLossService
{
@Autowired
UserCache
userCache
;
@Autowired
LossDao
lossDao
;
@Autowired
...
...
@@ -58,6 +68,7 @@ public class DeviceLossServiceImpl implements DeviceLossService {
@Override
public
DeviceLoss
save
(
DeviceLoss
deviceLoss
)
{
deviceLoss
.
setLossDate
(
new
Date
());
DeviceLoss
save
=
lossDao
.
save
(
deviceLoss
);
sendText
(
save
.
getId
());
return
save
;
...
...
@@ -90,6 +101,7 @@ public class DeviceLossServiceImpl implements DeviceLossService {
BlockTraceabilityParsing
blockTraceabilityParsing
=
bcRecord
.
getData
().
toBlockTraceabilityParsing
();
blockTraceabilityParsing
.
setBusinessTraceabilityParsingData
(
TraceabilityParsingData
.
builder
()
.
billTypeName
(
toBillName
(
deviceLoss
.
getType
()))
.
fileMd5
(
deviceLoss
.
getFileMd5
())
.
carrierIds
(
StringSplitUtil
.
stringListToString
(
deviceLoss
.
getDeviceLossVoList
().
stream
().
map
(
DeviceLossVo:
:
getSeqNumber
).
collect
(
Collectors
.
toList
())))
.
unitName
(
deviceLoss
.
getUnitName
())
.
documentNo
(
String
.
valueOf
(
deviceLoss
.
getId
()))
...
...
@@ -99,6 +111,7 @@ public class DeviceLossServiceImpl implements DeviceLossService {
blockTraceabilityParsing
.
setBlockTraceabilityParsingData
(
TraceabilityParsingData
.
builder
()
.
billTypeName
(
toBillName
(
deviceLoss1
.
getType
()))
.
fileMd5
(
deviceLoss1
.
getFileMd5
())
.
carrierIds
(
StringSplitUtil
.
stringListToString
(
deviceLoss1
.
getDeviceLossVoList
().
stream
().
map
(
DeviceLossVo:
:
getSeqNumber
).
collect
(
Collectors
.
toList
())))
.
unitName
(
deviceLoss1
.
getUnitName
())
.
documentNo
(
String
.
valueOf
(
deviceLoss1
.
getId
()))
...
...
@@ -110,6 +123,13 @@ public class DeviceLossServiceImpl implements DeviceLossService {
return
blockTraceabilityParsing
;
}
@Override
public
void
historyUpperChain
()
{
lossDao
.
findAll
().
forEach
(
deviceLoss
->
sendText
(
deviceLoss
.
getId
())
);
}
private
String
toBillName
(
Integer
flag
){
if
(
flag
==
1
){
// 丢失
...
...
@@ -122,7 +142,8 @@ public class DeviceLossServiceImpl implements DeviceLossService {
private
String
operatorName
(
DeviceLoss
deviceLoss
)
{
StringBuffer
buf
=
new
StringBuffer
();
// buf.append(deviceLoss.())
User
byId
=
userCache
.
findById
(
deviceLoss
.
getCreateUserId
());
buf
.
append
(
byId
.
getName
());
// .append(",")
// .append(deviceDestroyBill.getLeader())
// .append(",")
...
...
@@ -156,8 +177,10 @@ public class DeviceLossServiceImpl implements DeviceLossService {
private
DeviceLoss
queryDeviceLossId
(
Integer
deviceLossId
){
DeviceLoss
byDeviceLoss
=
findByDeviceLoss
(
deviceLossId
);
byDeviceLoss
.
setFileRetList
(
FilesUtil
.
stringFileToList
(
byDeviceLoss
.
getLossFile
()));
byDeviceLoss
.
setDeviceLossVoList
(
deviceLibraryDao
.
findAllById
(
StringUtils
.
stringToList
(
byDeviceLoss
.
getDevIds
()))
.
stream
().
map
(
this
::
toDeviceLossVo
).
collect
(
Collectors
.
toList
()));
byDeviceLoss
.
setFileMd5
(
FileMD5Util
.
fileRetToMd5
(
byDeviceLoss
.
getFileRetList
()));
return
byDeviceLoss
;
}
...
...
dev-misc/src/main/java/com/tykj/dev/misc/base/BlockBusinessEnum.java
浏览文件 @
fec4d3f0
...
...
@@ -98,7 +98,9 @@ public enum BlockBusinessEnum {
/**
* 重新入库
*/
AGAINSTORAGE
(
1038
,
"装备状态转换业务"
);
AGAINSTORAGE
(
1038
,
"装备状态转换业务"
),
TRAIN
(
1039
,
"培训业务"
);
public
Integer
subCode
;
...
...
dev-scrap/src/main/java/com/tykj/dev/device/scrap/service/ScrapService.java
浏览文件 @
fec4d3f0
...
...
@@ -49,4 +49,9 @@ public interface ScrapService {
boolean
checkTrueData
(
Integer
billId
);
BlockTraceabilityParsing
traceabilityParsing
(
Integer
billId
);
/**
* 历史数据上链
*/
void
historyUpperChain
();
}
dev-scrap/src/main/java/com/tykj/dev/device/scrap/service/impl/ScrapServiceImpl.java
浏览文件 @
fec4d3f0
...
...
@@ -15,6 +15,7 @@ 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.repository.DeviceLibraryDao
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
com.tykj.dev.device.library.subject.vo.ScriptSaveVo
;
...
...
@@ -68,17 +69,9 @@ public class ScrapServiceImpl implements ScrapService {
@Override
public
Scrap
saveScrap
(
Scrap
scrap
)
{
CompletableFuture
.
runAsync
(()->
{
if
(
scrap
.
getRecordId
()
==
null
||
scrap
.
getRecordId
().
equals
(
""
))
{
scrap
.
setRecordId
(
blockChainUtil
.
sendText
(
1000
,
JacksonUtil
.
toJSon
(
scrap
)).
getData
().
getRecordID
());
scrapDao
.
save
(
scrap
);
log
.
info
(
"[销毁]上链数据时间本次"
);
}
else
{
scrap
.
setRecordId
(
blockChainUtil
.
appendText
(
JacksonUtil
.
toJSon
(
scrap
),
scrap
.
getRecordId
()).
getData
().
getRecordID
());
scrapDao
.
save
(
scrap
);
}
});
return
scrapDao
.
save
(
scrap
);
Scrap
save
=
scrapDao
.
save
(
scrap
);
sendText
(
save
.
getId
());
return
save
;
}
@Override
...
...
@@ -186,7 +179,10 @@ public class ScrapServiceImpl implements ScrapService {
blockTraceabilityParsing
.
setBusinessTraceabilityParsingData
(
TraceabilityParsingData
.
builder
()
.
billTypeName
(
"报废"
)
.
carrierIds
(
StringSplitUtil
.
stringListToString
(
scrap
.
getScripts
().
stream
().
map
(
ScriptSaveVo:
:
getSeqNumber
).
collect
(
Collectors
.
toList
())))
.
applyNumber
(
scrap
.
getApplyNumber
())
.
replayNumber
(
scrap
.
getReplayNumber
())
.
initiateUnitName
(
scrap
.
getSendUnit
())
.
fileMd5
(
scrap
.
getFileMd5
())
.
receiveUnitName
(
scrap
.
getReceiveUnit
())
.
documentNo
(
scrap
.
getNum
())
.
operationTime
(
DateUtil
.
getLocalDateTime
(
scrap
.
getSendTime
()))
...
...
@@ -195,6 +191,9 @@ public class ScrapServiceImpl implements ScrapService {
blockTraceabilityParsing
.
setBlockTraceabilityParsingData
(
TraceabilityParsingData
.
builder
()
.
billTypeName
(
"报废"
)
.
applyNumber
(
scrap1
.
getApplyNumber
())
.
replayNumber
(
scrap1
.
getReplayNumber
())
.
fileMd5
(
scrap1
.
getFileMd5
())
.
carrierIds
(
StringSplitUtil
.
stringListToString
(
scrap1
.
getScripts
().
stream
().
map
(
ScriptSaveVo:
:
getSeqNumber
).
collect
(
Collectors
.
toList
())))
.
initiateUnitName
(
scrap1
.
getSendUnit
())
.
receiveUnitName
(
scrap1
.
getReceiveUnit
())
...
...
@@ -207,6 +206,13 @@ public class ScrapServiceImpl implements ScrapService {
return
blockTraceabilityParsing
;
}
@Override
public
void
historyUpperChain
()
{
scrapDao
.
findAll
().
forEach
(
scrap
->
sendText
(
scrap
.
getId
())
);
}
private
String
operatorName
(
Scrap
scrap
)
{
StringBuffer
buf
=
new
StringBuffer
();
...
...
@@ -246,7 +252,12 @@ public class ScrapServiceImpl implements ScrapService {
Scrap
scrap
=
optional
.
get
();
List
<
ScriptSaveVo
>
scriptSaveVos
=
JacksonUtil
.
readValue
(
scrap
.
getScriptJson
(),
new
TypeReference
<
List
<
ScriptSaveVo
>>()
{
});
scrap
.
setBillFiles
(
FilesUtil
.
stringFileToList
(
scrap
.
getBillFile
()));
scrap
.
setOutboundFiles
(
FilesUtil
.
stringFileToList
(
scrap
.
getOutboundFile
()));
scrap
.
setReplyFileList
(
FilesUtil
.
stringFileToList
(
scrap
.
getReplyFiles
()));
scrap
.
setApplyFileList
(
FilesUtil
.
stringFileToList
(
scrap
.
getApplyFiles
()));
scrap
.
setScripts
(
scriptSaveVos
);
scrap
.
setFileMd5
(
FileMD5Util
.
fileRetToMd5
(
scrap
.
getOutboundFiles
()));
return
scrap
;
}
else
{
log
.
info
(
"[报废] 详情查看错误,id没有找到{}"
,
scrapId
);
...
...
dev-scrap/src/main/java/com/tykj/dev/device/scrap/subject/domin/Scrap.java
浏览文件 @
fec4d3f0
...
...
@@ -155,4 +155,10 @@ public class Scrap extends BaseEntity {
private
List
<
FileRet
>
outboundFiles
;
@Transient
@ApiModelProperty
(
value
=
"文件md5"
)
private
String
fileMd5
;
}
dev-sendback/src/main/java/com/tykj/dev/device/sendback/entity/domain/DeviceRepelDetail.java
浏览文件 @
fec4d3f0
...
...
@@ -240,6 +240,11 @@ public class DeviceRepelDetail extends BaseEntity {
private
List
<
FileRet
>
outboundFiles
;
@Transient
@ApiModelProperty
(
value
=
"文件md5"
)
private
String
fileMd5
;
public
Documents
toDoc
(){
return
new
Documents
(
num
,
"装备清退单据"
,
receiveUnit
,
replayNumber
,
sendUnit
,
null
,
null
,
senderUserA
,
senderUserB
,
receiveUserA
,
receiveUserB
,
null
);
}
...
...
dev-sendback/src/main/java/com/tykj/dev/device/sendback/service/DeviceRepelDetailService.java
浏览文件 @
fec4d3f0
...
...
@@ -57,4 +57,9 @@ public interface DeviceRepelDetailService {
boolean
checkTrueData
(
Integer
billId
);
BlockTraceabilityParsing
traceabilityParsing
(
Integer
billId
);
/**
* 历史数据上链
*/
void
historyUpperChain
();
}
dev-sendback/src/main/java/com/tykj/dev/device/sendback/service/impl/DeviceRepelDetailServiceImpl.java
浏览文件 @
fec4d3f0
...
...
@@ -14,6 +14,7 @@ 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.repository.DeviceLibraryDao
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
com.tykj.dev.device.library.subject.vo.ScriptSaveVo
;
...
...
@@ -217,6 +218,9 @@ public class DeviceRepelDetailServiceImpl implements DeviceRepelDetailService {
BlockTraceabilityParsing
blockTraceabilityParsing
=
bcRecord
.
getData
().
toBlockTraceabilityParsing
();
blockTraceabilityParsing
.
setBusinessTraceabilityParsingData
(
TraceabilityParsingData
.
builder
()
.
billTypeName
(
"清退"
)
.
applyNumber
(
deviceRepelDetail
.
getApplyNumber
())
.
replayNumber
(
deviceRepelDetail
.
getReplayNumber
())
.
fileMd5
(
deviceRepelDetail
.
getFileMd5
())
.
carrierIds
(
StringSplitUtil
.
stringListToString
(
deviceRepelDetail
.
getScripts
().
stream
().
map
(
ScriptSaveVo:
:
getSeqNumber
).
collect
(
Collectors
.
toList
())))
.
initiateUnitName
(
deviceRepelDetail
.
getSendUnit
())
.
receiveUnitName
(
deviceRepelDetail
.
getReceiveUnit
())
...
...
@@ -227,6 +231,9 @@ public class DeviceRepelDetailServiceImpl implements DeviceRepelDetailService {
blockTraceabilityParsing
.
setBlockTraceabilityParsingData
(
TraceabilityParsingData
.
builder
()
.
billTypeName
(
"清退"
)
.
applyNumber
(
deviceRepelDetail1
.
getApplyNumber
())
.
replayNumber
(
deviceRepelDetail1
.
getReplayNumber
())
.
fileMd5
(
deviceRepelDetail1
.
getFileMd5
())
.
carrierIds
(
StringSplitUtil
.
stringListToString
(
deviceRepelDetail1
.
getScripts
().
stream
().
map
(
ScriptSaveVo:
:
getSeqNumber
).
collect
(
Collectors
.
toList
())))
.
initiateUnitName
(
deviceRepelDetail1
.
getSendUnit
())
.
receiveUnitName
(
deviceRepelDetail1
.
getReceiveUnit
())
...
...
@@ -239,6 +246,13 @@ public class DeviceRepelDetailServiceImpl implements DeviceRepelDetailService {
return
blockTraceabilityParsing
;
}
@Override
public
void
historyUpperChain
()
{
deviceRepelDetailDao
.
findAll
().
forEach
(
deviceRepelDetail
->
sendText
(
deviceRepelDetail
.
getId
())
);
}
private
String
operatorName
(
DeviceRepelDetail
deviceRepelDetail
)
{
StringBuffer
buf
=
new
StringBuffer
();
...
...
@@ -278,6 +292,12 @@ public class DeviceRepelDetailServiceImpl implements DeviceRepelDetailService {
DeviceRepelDetail
deviceRepelDetail
=
optional
.
get
();
deviceRepelDetail
.
setScripts
(
JacksonUtil
.
readValue
(
deviceRepelDetail
.
getScriptJson
(),
new
TypeReference
<
List
<
ScriptSaveVo
>>()
{
}));
deviceRepelDetail
.
setBillFiles
(
FilesUtil
.
stringFileToList
(
deviceRepelDetail
.
getBillFile
()));
deviceRepelDetail
.
setOutboundFiles
(
FilesUtil
.
stringFileToList
(
deviceRepelDetail
.
getOutboundFile
()));
deviceRepelDetail
.
setInFiles
(
FilesUtil
.
stringFileToList
(
deviceRepelDetail
.
getInFile
()));
deviceRepelDetail
.
setApplyFileList
(
FilesUtil
.
stringFileToList
(
deviceRepelDetail
.
getApplyFiles
()));
deviceRepelDetail
.
setReplyFileList
(
FilesUtil
.
stringFileToList
(
deviceRepelDetail
.
getReplyFiles
()));
deviceRepelDetail
.
setFileMd5
(
FileMD5Util
.
fileRetToMd5
(
deviceRepelDetail
.
getOutboundFiles
()));
deviceRepelDetail
.
setDeviceIds
(
null
);
deviceRepelDetail
.
setScriptJson
(
null
);
return
deviceRepelDetail
;
...
...
dev-train/pom.xml
浏览文件 @
fec4d3f0
...
...
@@ -15,7 +15,6 @@
<dependency>
<groupId>
com.tykj
</groupId>
<artifactId>
dev-user
</artifactId>
</dependency>
<dependency>
...
...
@@ -35,6 +34,12 @@
<groupId>
com.tykj
</groupId>
<artifactId>
dev-questionbank
</artifactId>
</dependency>
<dependency>
<groupId>
com.tykj
</groupId>
<artifactId>
dev-block
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
config
</artifactId>
...
...
dev-train/src/main/java/com/tykj/dev/device/train/TrainApp.java
浏览文件 @
fec4d3f0
...
...
@@ -11,7 +11,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
* @createTime 2020年09月01日 14:32:00
*/
@SpringBootApplication
(
scanBasePackages
=
{
"com.tykj.
dev.*"
,
"com.tykj.
*"
}
)
public
class
TrainApp
{
...
...
dev-train/src/main/java/com/tykj/dev/device/train/controller/HandoverController.java
浏览文件 @
fec4d3f0
...
...
@@ -82,5 +82,22 @@ public class HandoverController {
return
ResponseEntity
.
ok
(
userService
.
findByUniteId1
(
securityUser
.
getCurrentUserInfo
().
getUnitsId
()).
stream
().
filter
(
userShenRe
->
userShenRe
.
getTrainStatus
()!=
5
).
collect
(
Collectors
.
toList
()));
}
/**
* 区块验证
*/
@GetMapping
(
value
=
"/checkTrueData/{billId}"
)
@ApiOperation
(
value
=
"根据业务id进行对应业务的验证"
,
notes
=
"根据业务id进行对应业务的验证"
)
public
ResponseEntity
checkTrueData
(
@PathVariable
Integer
billId
){
return
ResponseEntity
.
ok
(
workHandoverService
.
checkTrueData
(
billId
));
}
/**
* 区块溯源
*/
@GetMapping
(
value
=
"/traceabilityParsing/{billId}"
)
@ApiOperation
(
value
=
"根据业务id进行对应业务的溯源"
,
notes
=
"根据业务id进行对应业务的溯源"
)
public
ResponseEntity
traceabilityParsing
(
@PathVariable
Integer
billId
){
return
ResponseEntity
.
ok
(
workHandoverService
.
traceabilityParsing
(
billId
));
}
}
dev-train/src/main/java/com/tykj/dev/device/train/controller/TrainJobController.java
浏览文件 @
fec4d3f0
package
com
.
tykj
.
dev
.
device
.
train
.
controller
;
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.entity.BcText
;
import
com.tykj.dev.blockcha.subject.service.BlockChainUtil
;
import
com.tykj.dev.config.swagger.AutoDocument
;
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.service.FilesUtil
;
import
com.tykj.dev.device.file.util.FileMD5Util
;
import
com.tykj.dev.device.task.service.TaskLogService
;
import
com.tykj.dev.device.task.service.TaskService
;
import
com.tykj.dev.device.task.subject.bto.TaskBto
;
...
...
@@ -30,9 +38,12 @@ import com.tykj.dev.device.user.subject.service.UnitsService;
import
com.tykj.dev.device.user.subject.service.UserLogService
;
import
com.tykj.dev.device.user.subject.service.UserService
;
import
com.tykj.dev.misc.base.BeanHelper
;
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.DateUtil
;
import
com.tykj.dev.misc.utils.JacksonUtil
;
import
com.tykj.dev.misc.utils.StringSplitUtil
;
import
com.tykj.dev.misc.utils.TaskDisposeUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -122,6 +133,12 @@ public class TrainJobController {
@Autowired
GenerateTestPaperService
generateTestPaperService
;
@Autowired
BlockService
blockService
;
@Autowired
BlockDataService
blockDataService
;
/**
* 新建培训信息
* 首先创建task(发起人task) 在创建状态为新建(id_done为1)以及报名中待job,在给所有的专管员发起一个job(待报名)
...
...
@@ -646,6 +663,7 @@ public class TrainJobController {
);
}
trainThemeService
.
save
(
trainTheme
);
sendText
(
trainTheme
.
getTrainId
());
TaskLogBto
taskLogBto
=
new
TaskLogBto
(
taskBto
.
getId
(),
"审核通过"
,
null
);
taskLogService
.
addLog
(
taskLogBto
);
return
ResponseEntity
.
ok
(
trainTheme
);
...
...
@@ -777,4 +795,71 @@ public class TrainJobController {
TaskBto
taskBto
=
new
TaskBto
(
StatusEnum
.
TRAIN1009
.
id
,
title
,
parentTaskId
,
"."
,
trainId
,
BusinessEnum
.
TRAIN_STUDY
.
id
,
ownUnitId
,
0
,
"online"
,
list
);
return
taskService
.
start
(
taskBto
);
}
/**
* 上链接口
*/
public
void
sendText
(
Integer
trainId
){
TrainDetailsVo
selectDetailsVo
=
trainThemeService
.
findSelectDetailsVo
(
trainId
);
selectDetailsVo
.
setFileMd5
(
FileMD5Util
.
fileRetToMd5
(
selectDetailsVo
.
getTrainDataFileList
()));
blockService
.
sendText
(
BlockBusinessEnum
.
TRAIN
.
subCode
,
JacksonUtil
.
toJSon
(
selectDetailsVo
),
BusinessEnum
.
TRAIN
.
id
,
selectDetailsVo
.
getTrainId
(),
selectDetailsVo
.
getUnitsName
());
}
@GetMapping
(
value
=
"/traceabilityParsing/{billId}"
)
@ApiOperation
(
value
=
"根据业务id进行对应业务的溯源"
,
notes
=
"根据业务id进行对应业务的溯源"
)
public
BlockTraceabilityParsing
traceabilityParsing
(
Integer
billId
)
{
BlockData
billTypeAndBillId
=
blockDataService
.
findBillTypeAndBillId
(
BusinessEnum
.
TRAIN
.
id
,
billId
);
BcRecord
bcRecord
=
blockService
.
fetchRecord
(
BlockBusinessEnum
.
TRAIN
.
subCode
,
billTypeAndBillId
.
getRecordID
());
TrainDetailsVo
trainDetailsVo
=
trainThemeService
.
findSelectDetailsVo
(
billId
);
trainDetailsVo
.
setFileMd5
(
FileMD5Util
.
fileRetToMd5
(
trainDetailsVo
.
getTrainDataFileList
()));
TrainDetailsVo
trainDetailsVo1
=
JSON
.
parseObject
(
bcRecord
.
getData
().
getContent
(),
TrainDetailsVo
.
class
);
BlockTraceabilityParsing
blockTraceabilityParsing
=
bcRecord
.
getData
().
toBlockTraceabilityParsing
();
blockTraceabilityParsing
.
setBusinessTraceabilityParsingData
(
TraceabilityParsingData
.
builder
()
.
billTypeName
(
"培训"
)
// .carrierIds(StringSplitUtil.stringListToString(workHandover.getWorkHandoverDevs().stream().map(WorkHandoverDev::getSeqs).collect(Collectors.toList())))
.
fileMd5
(
trainDetailsVo
.
getFileMd5
())
.
unitName
(
trainDetailsVo
.
getUnitsName
())
.
operationTime
(
DateUtil
.
getLocalDateTime
(
trainDetailsVo
.
getTrainTime
()))
.
operatorUserName
(
operatorName
(
trainDetailsVo
))
.
build
());
blockTraceabilityParsing
.
setBlockTraceabilityParsingData
(
TraceabilityParsingData
.
builder
()
.
billTypeName
(
"培训"
)
.
fileMd5
(
trainDetailsVo1
.
getFileMd5
())
.
unitName
(
trainDetailsVo1
.
getUnitsName
())
.
operationTime
(
DateUtil
.
getLocalDateTime
(
trainDetailsVo1
.
getTrainTime
()))
.
operatorUserName
(
operatorName
(
trainDetailsVo1
))
.
build
());
blockTraceabilityParsing
.
setBlockData
(
trainDetailsVo1
);
blockTraceabilityParsing
.
setCurrentData
(
trainDetailsVo
);
return
blockTraceabilityParsing
;
}
public
void
historyUpperChain
()
{
trainThemeService
.
findAllStatus
(
9999
).
forEach
(
trainTheme
->
sendText
(
trainTheme
.
getTrainId
())
);
}
private
String
operatorName
(
TrainDetailsVo
trainDetailsVo
)
{
StringBuffer
buf
=
new
StringBuffer
();
buf
.
append
(
trainDetailsVo
.
getOriginatorName
());
return
buf
.
toString
();
}
//验真
@GetMapping
(
value
=
"/checkTrueData/{billId}"
)
@ApiOperation
(
value
=
"根据业务id进行对应业务的验证"
,
notes
=
"根据业务id进行对应业务的验证"
)
public
boolean
checkTrueData
(
Integer
billId
)
{
BlockTraceabilityParsing
blockTraceabilityParsing
=
traceabilityParsing
(
billId
);
boolean
contrast
=
blockDataService
.
contrast
(
blockTraceabilityParsing
);
return
contrast
;
}
}
dev-train/src/main/java/com/tykj/dev/device/train/entity/WorkHandover.java
浏览文件 @
fec4d3f0
...
...
@@ -86,4 +86,16 @@ public class WorkHandover {
*/
@Transient
private
List
<
WorkHandoverDev
>
workHandoverDevs
;
@Transient
@ApiModelProperty
(
value
=
"文件md5"
)
private
String
fileMd5
;
@Transient
@ApiModelProperty
(
value
=
"单位名称"
)
private
String
unitName
;
}
dev-train/src/main/java/com/tykj/dev/device/train/entity/vo/TrainDetailsVo.java
浏览文件 @
fec4d3f0
...
...
@@ -161,4 +161,9 @@ public class TrainDetailsVo {
@Transient
private
GenerateTestPaper
generateTestPaper
;
@Transient
@ApiModelProperty
(
value
=
"文件md5"
)
private
String
fileMd5
;
}
dev-train/src/main/java/com/tykj/dev/device/train/service/WorkHandoverService.java
浏览文件 @
fec4d3f0
package
com
.
tykj
.
dev
.
device
.
train
.
service
;
import
com.tykj.dev.device.block.entity.vo.BlockTraceabilityParsing
;
import
com.tykj.dev.device.train.entity.WorkHandover
;
import
com.tykj.dev.device.train.entity.vo.WorkHandoverAddVo
;
import
com.tykj.dev.device.train.entity.vo.WorkHandoverEndAddVo
;
...
...
@@ -41,4 +42,14 @@ public interface WorkHandoverService {
* 交接人
*/
List
<
User
>
handover
(
List
<
Integer
>
userIds
);
boolean
checkTrueData
(
Integer
billId
);
BlockTraceabilityParsing
traceabilityParsing
(
Integer
billId
);
/**
* 历史数据上链
*/
void
historyUpperChain
();
}
dev-train/src/main/java/com/tykj/dev/device/train/service/impl/WorkHandoverServiceImpl.java
浏览文件 @
fec4d3f0
package
com
.
tykj
.
dev
.
device
.
train
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.fasterxml.jackson.core.type.TypeReference
;
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.service.FilesUtil
;
import
com.tykj.dev.device.file.util.FileMD5Util
;
import
com.tykj.dev.device.library.subject.vo.ScriptSaveVo
;
import
com.tykj.dev.device.task.service.TaskService
;
import
com.tykj.dev.device.task.subject.bto.TaskBto
;
import
com.tykj.dev.device.train.dao.WorkHandoverDao
;
...
...
@@ -17,15 +26,19 @@ import com.tykj.dev.device.user.cache.UserCache;
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.entity.SecurityUser
;
import
com.tykj.dev.device.user.subject.entity.Units
;
import
com.tykj.dev.device.user.subject.entity.User
;
import
com.tykj.dev.device.user.subject.entity.UserLog
;
import
com.tykj.dev.device.user.subject.service.UnitsService
;
import
com.tykj.dev.device.user.subject.service.UserLogService
;
import
com.tykj.dev.device.user.subject.service.UserService
;
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.exception.ApiException
;
import
com.tykj.dev.misc.utils.DateUtil
;
import
com.tykj.dev.misc.utils.JacksonUtil
;
import
com.tykj.dev.misc.utils.StringSplitUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
...
...
@@ -72,9 +85,16 @@ public class WorkHandoverServiceImpl implements WorkHandoverService {
@Autowired
WorkHandoverDevDao
workHandoverDevDao
;
@Autowired
BlockService
blockService
;
@Autowired
BlockDataService
blockDataService
;
@Autowired
UserCache
userCache
;
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
WorkHandover
createWorkHandover
(
WorkHandoverAddVo
workHandoverAddVo
,
SecurityUser
securityUser
)
{
...
...
@@ -99,6 +119,7 @@ public class WorkHandoverServiceImpl implements WorkHandoverService {
Integer
userId
=
workHandoverAddVo
.
getWorkHandoverUserVoList
().
get
(
0
).
getHandoverUserIds
().
get
(
0
);
User
user
=
userCache
.
findById
(
userId
);
addMessage
(
new
MessageBto
(
taskBto
.
getId
(),
taskBto
.
getBusinessType
(),
"发起 工作交接业务:【接交人:"
+
user
.
getName
()+
"】"
,
gainThisUser
(
securityUser
.
getCurrentUserInfo
().
getUserId
(),
securityUser
.
getCurrentUserInfo
().
getUnitsId
()),
workHandover
.
getWorkHandoverId
().
toString
()));
sendText
(
workHandover
.
getWorkHandoverId
());
return
workHandover
;
}
...
...
@@ -152,7 +173,7 @@ public class WorkHandoverServiceImpl implements WorkHandoverService {
);
workHandoverDevDao
.
saveAll
(
workHandoverDevs
);
userService
.
saveAll
(
users
);
sendText
(
workHandover
.
getWorkHandoverId
());
return
workHandover
;
}
...
...
@@ -187,6 +208,66 @@ public class WorkHandoverServiceImpl implements WorkHandoverService {
return
userService
.
findAllUserIdInUser
(
userIds
);
}
@Override
public
BlockTraceabilityParsing
traceabilityParsing
(
Integer
billId
)
{
BlockData
billTypeAndBillId
=
blockDataService
.
findBillTypeAndBillId
(
BusinessEnum
.
WORK_HANDOVER
.
id
,
billId
);
BcRecord
bcRecord
=
blockService
.
fetchRecord
(
BlockBusinessEnum
.
WORK_HANDOVER
.
subCode
,
billTypeAndBillId
.
getRecordID
());
WorkHandover
workHandover
=
queryWorkHandover
(
billId
);
WorkHandover
workHandover1
=
JSON
.
parseObject
(
bcRecord
.
getData
().
getContent
(),
WorkHandover
.
class
);
BlockTraceabilityParsing
blockTraceabilityParsing
=
bcRecord
.
getData
().
toBlockTraceabilityParsing
();
blockTraceabilityParsing
.
setBusinessTraceabilityParsingData
(
TraceabilityParsingData
.
builder
()
.
billTypeName
(
"工作交接"
)
.
fileMd5
(
workHandover
.
getFileMd5
())
.
carrierIds
(
StringSplitUtil
.
stringListToString
(
workHandover
.
getWorkHandoverDevs
().
stream
().
map
(
WorkHandoverDev:
:
getSeqs
).
collect
(
Collectors
.
toList
())))
.
unitName
(
workHandover
.
getUnitName
())
// .operationTime(DateUtil.getLocalDateTime(workHandover.getDestroyTime()))
.
operatorUserName
(
operatorName
(
workHandover
))
.
build
());
blockTraceabilityParsing
.
setBlockTraceabilityParsingData
(
TraceabilityParsingData
.
builder
()
.
billTypeName
(
"工作交接"
)
.
fileMd5
(
workHandover1
.
getFileMd5
())
.
carrierIds
(
StringSplitUtil
.
stringListToString
(
workHandover1
.
getWorkHandoverDevs
().
stream
().
map
(
WorkHandoverDev:
:
getSeqs
).
collect
(
Collectors
.
toList
())))
.
unitName
(
workHandover1
.
getUnitName
())
// .operationTime(DateUtil.getLocalDateTime(workHandover.getDestroyTime()))
.
operatorUserName
(
operatorName
(
workHandover1
))
.
build
());
blockTraceabilityParsing
.
setBlockData
(
workHandover1
);
blockTraceabilityParsing
.
setCurrentData
(
workHandover
);
return
blockTraceabilityParsing
;
}
@Override
public
void
historyUpperChain
()
{
workHandoverDao
.
findAll
().
forEach
(
deviceDestroyBill
->
sendText
(
deviceDestroyBill
.
getWorkHandoverId
())
);
}
private
String
operatorName
(
WorkHandover
workHandover
)
{
StringBuffer
buf
=
new
StringBuffer
();
List
<
User
>
handoverUsers
=
workHandover
.
getWorkHandoverUserVoList
().
get
(
0
).
getHandoverUsers
();
handoverUsers
.
forEach
(
user
->
buf
.
append
(
user
.
getName
())
.
append
(
","
)
);
buf
.
append
(
workHandover
.
getLeadershipName
())
.
append
(
","
)
.
append
(
workHandover
.
getInUserName
());
return
buf
.
toString
();
}
//验真
@Override
public
boolean
checkTrueData
(
Integer
billId
)
{
BlockTraceabilityParsing
blockTraceabilityParsing
=
traceabilityParsing
(
billId
);
boolean
contrast
=
blockDataService
.
contrast
(
blockTraceabilityParsing
);
return
contrast
;
}
private
void
addMessage
(
MessageBto
messageBto
){
messageService
.
add
(
messageBto
);
}
...
...
@@ -209,4 +290,33 @@ public class WorkHandoverServiceImpl implements WorkHandoverService {
private
List
<
Integer
>
findUnitId
(
Integer
unitId
){
return
userService
.
findAllByUnite
(
unitId
).
stream
().
map
(
User:
:
getUserId
).
collect
(
Collectors
.
toList
());
}
public
WorkHandover
queryWorkHandover
(
Integer
workHandoverId
)
{
Optional
<
WorkHandover
>
optionalWorkHandover
=
workHandoverDao
.
findById
(
workHandoverId
);
if
(
optionalWorkHandover
.
isPresent
())
{
WorkHandover
workHandover
=
optionalWorkHandover
.
get
();
workHandover
.
setFileRets
(
FilesUtil
.
stringFileToList
(
workHandover
.
getFile
()));
workHandover
.
setWorkHandoverDevs
(
workHandoverDevDao
.
findAllByWordId
(
workHandover
.
getWorkHandoverId
()));
workHandover
.
setWorkHandoverUserVoList
(
JacksonUtil
.
readValue
(
workHandover
.
getWorkHandoverUsers
(),
new
TypeReference
<
List
<
WorkHandoverUserVo
>>()
{}));
workHandover
.
getWorkHandoverUserVoList
().
forEach
(
workHandoverUserVo
->
{
workHandoverUserVo
.
setTurnOverUser
(
userService
.
findByUser
(
workHandoverUserVo
.
getTurnOverUserIds
()));
workHandoverUserVo
.
setHandoverUsers
(
userService
.
findAllUserIdInUser
(
workHandoverUserVo
.
getHandoverUserIds
()));
}
);
workHandover
.
setFileMd5
(
FileMD5Util
.
fileRetToMd5
(
workHandover
.
getFileRets
()));
Integer
unitsId
=
userService
.
findByUser
(
workHandover
.
getInitiateUserId
()).
getUnitsId
();
Units
byId
=
unitsService
.
findById
(
unitsId
);
workHandover
.
setUnitName
(
byId
.
getName
());
return
workHandover
;
}
else
{
throw
new
ApiException
(
ResponseEntity
.
status
(
500
).
body
(
"没有这个id:"
+
workHandoverId
));
}
}
public
void
sendText
(
Integer
id
){
WorkHandover
workHandover
=
queryWorkHandover
(
id
);
blockService
.
sendText
(
BlockBusinessEnum
.
WORK_HANDOVER
.
subCode
,
JacksonUtil
.
toJSon
(
workHandover
),
BusinessEnum
.
WORK_HANDOVER
.
id
,
id
,
workHandover
.
getLeadershipName
());
}
}
dev-union/src/main/java/com/tykj/dev/union/RunController.java
浏览文件 @
fec4d3f0
...
...
@@ -10,11 +10,16 @@ package com.tykj.dev.union;
import
com.tykj.dev.config.swagger.AutoDocument
;
import
com.tykj.dev.device.confirmcheck.service.HistoryCheckDeviceService
;
import
com.tykj.dev.device.decommissioning.service.DeviceDecommissioningDetailService
;
import
com.tykj.dev.device.destroy.service.DeviceDestroyBillService
;
import
com.tykj.dev.device.library.service.DeviceLibraryService
;
import
com.tykj.dev.device.library.subject.vo.UpdateUnitVo
;
import
com.tykj.dev.device.loss.service.DeviceLossService
;
import
com.tykj.dev.device.matching.service.MatchingDeviceBillService
;
import
com.tykj.dev.device.matching.service.MatchingDeviceLibraryService
;
import
com.tykj.dev.device.matching.subject.vo.MatchingUnitVo
;
import
com.tykj.dev.device.scrap.service.ScrapService
;
import
com.tykj.dev.device.sendback.service.DeviceRepelDetailService
;
import
com.tykj.dev.device.user.cache.UnitsCache
;
import
com.tykj.dev.device.user.subject.dao.AreaDao
;
import
com.tykj.dev.device.user.subject.entity.Area
;
...
...
@@ -46,6 +51,21 @@ import java.util.concurrent.CompletableFuture;
@AutoDocument
public
class
RunController
{
@Autowired
DeviceDecommissioningDetailService
deviceDecommissioningDetailService
;
@Autowired
ScrapService
scrapService
;
@Autowired
DeviceLossService
deviceLossService
;
@Autowired
DeviceDestroyBillService
deviceDestroyBillService
;
@Autowired
DeviceRepelDetailService
deviceRepelDetailService
;
@Resource
UnitsCache
unitsCache
;
...
...
@@ -112,4 +132,20 @@ public class RunController {
}
@ApiOperation
(
value
=
"历史数据上链接口初始化"
,
notes
=
"历史数据上链接口初始化"
)
@GetMapping
(
"/historyUpperChain"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
historyUpperChain
()
{
log
.
info
(
"[区块] 历史数据上链接口初始化"
);
scrapService
.
historyUpperChain
();
deviceDestroyBillService
.
historyUpperChain
();
deviceRepelDetailService
.
historyUpperChain
();
deviceLossService
.
historyUpperChain
();
deviceDecommissioningDetailService
.
historyUpperChain
();
log
.
info
(
"[区块] 历史数据上链接口结束"
);
}
}
pom.xml
浏览文件 @
fec4d3f0
...
...
@@ -127,6 +127,12 @@
<version>
1.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
com.tykj
</groupId>
<artifactId>
dev-block
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
com.tykj
</groupId>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论