Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
10c1174f
提交
10c1174f
authored
3月 30, 2023
作者:
zjm
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改上联bug
上级
dbfa0db4
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
41 行增加
和
22 行删除
+41
-22
DeviceCheckController.java
...device/confirmcheck/controller/DeviceCheckController.java
+1
-1
CheckBlockServiceImpl.java
...vice/confirmcheck/service/impl/CheckBlockServiceImpl.java
+20
-8
CheckTimedTask.java
...com/tykj/dev/device/confirmcheck/task/CheckTimedTask.java
+13
-8
ObjTransUtil.java
.../com/tykj/dev/device/confirmcheck/utils/ObjTransUtil.java
+1
-1
ScrapServiceImpl.java
.../tykj/dev/device/scrap/service/impl/ScrapServiceImpl.java
+2
-1
application-dev.properties
dev-union/src/main/resources/application-dev.properties
+4
-3
没有找到文件。
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/controller/DeviceCheckController.java
浏览文件 @
10c1174f
...
@@ -351,7 +351,7 @@ public class DeviceCheckController {
...
@@ -351,7 +351,7 @@ public class DeviceCheckController {
Task
task
=
taskRepo
.
findByBillIdAndBusinessType
(
id
,
8
).
orElseThrow
(()
->
new
ApiException
(
"给出的bill id 不存在"
));
Task
task
=
taskRepo
.
findByBillIdAndBusinessType
(
id
,
8
).
orElseThrow
(()
->
new
ApiException
(
"给出的bill id 不存在"
));
if
(
task
.
getBillStatus
()
==
140
||
task
.
getBillStatus
()
==
160
)
{
if
(
task
.
getBillStatus
()
==
140
||
task
.
getBillStatus
()
==
160
)
{
log
.
info
(
"[核查] 刷新在库/不在库,bill id :{}"
,
id
);
//
log.info("[核查] 刷新在库/不在库,bill id :{}", id);
refreshDetail
(
id
);
refreshDetail
(
id
);
}
}
DeviceCheckDetail
byId
=
detailRepo
.
findById
(
id
).
orElse
(
new
DeviceCheckDetail
());
DeviceCheckDetail
byId
=
detailRepo
.
findById
(
id
).
orElse
(
new
DeviceCheckDetail
());
...
...
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/service/impl/CheckBlockServiceImpl.java
浏览文件 @
10c1174f
...
@@ -17,6 +17,7 @@ import com.tykj.dev.device.file.entity.FileRet;
...
@@ -17,6 +17,7 @@ import com.tykj.dev.device.file.entity.FileRet;
import
com.tykj.dev.device.file.util.FileMD5Util
;
import
com.tykj.dev.device.file.util.FileMD5Util
;
import
com.tykj.dev.misc.base.BlockBusinessEnum
;
import
com.tykj.dev.misc.base.BlockBusinessEnum
;
import
com.tykj.dev.misc.base.BusinessEnum
;
import
com.tykj.dev.misc.base.BusinessEnum
;
import
com.tykj.dev.misc.exception.ApiException
;
import
com.tykj.dev.misc.utils.JacksonUtil
;
import
com.tykj.dev.misc.utils.JacksonUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -26,6 +27,7 @@ import org.springframework.stereotype.Service;
...
@@ -26,6 +27,7 @@ import org.springframework.stereotype.Service;
import
java.io.BufferedWriter
;
import
java.io.BufferedWriter
;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileWriter
;
import
java.io.FileWriter
;
import
java.io.IOException
;
import
java.nio.file.Files
;
import
java.nio.file.Files
;
import
java.nio.file.Paths
;
import
java.nio.file.Paths
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
...
@@ -42,8 +44,9 @@ import java.util.List;
...
@@ -42,8 +44,9 @@ import java.util.List;
public
class
CheckBlockServiceImpl
implements
CheckBlockService
{
public
class
CheckBlockServiceImpl
implements
CheckBlockService
{
@Value
(
"${check.time.last}"
)
@Value
(
"${file.path}"
)
private
String
checkTimeLastFile
;
private
String
checkTimeLastFilePath
;
@Autowired
@Autowired
private
DeviceCheckDetailDao
detailDao
;
private
DeviceCheckDetailDao
detailDao
;
...
@@ -55,15 +58,19 @@ public class CheckBlockServiceImpl implements CheckBlockService {
...
@@ -55,15 +58,19 @@ public class CheckBlockServiceImpl implements CheckBlockService {
BlockDataService
blockDataService
;
BlockDataService
blockDataService
;
@Override
@Override
public
void
detailToChain
()
throws
Exception
{
public
void
detailToChain
()
throws
IO
Exception
{
String
checkTimeLastFile
=
checkTimeLastFilePath
+
"check"
;
LocalDateTime
lastTime
=
LocalDateTime
.
now
().
minusYears
(
2
);
LocalDateTime
lastTime
=
LocalDateTime
.
now
().
minusYears
(
2
);
DateTimeFormatter
fmt
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss:SSS"
);
DateTimeFormatter
fmt
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss:SSS"
);
File
file
=
new
File
(
checkTimeLastFile
);
File
file
=
new
File
(
checkTimeLastFile
);
if
(
file
.
exists
())
{
if
(
file
.
exists
())
{
List
<
String
>
strings
=
Files
.
readAllLines
(
Paths
.
get
(
checkTimeLastFile
));
List
<
String
>
strings
=
Files
.
readAllLines
(
Paths
.
get
(
checkTimeLastFile
));
lastTime
=
LocalDateTime
.
parse
(
strings
.
get
(
0
),
fmt
);
if
(
strings
.
size
()
==
1
)
{
lastTime
=
LocalDateTime
.
parse
(
strings
.
get
(
0
),
fmt
);
}
}
else
{
file
.
createNewFile
();
}
}
List
<
DeviceCheckDetail
>
details
=
detailDao
.
findAllByUpdateTimeAfter
(
lastTime
);
List
<
DeviceCheckDetail
>
details
=
detailDao
.
findAllByUpdateTimeAfter
(
lastTime
);
...
@@ -93,9 +100,10 @@ public class CheckBlockServiceImpl implements CheckBlockService {
...
@@ -93,9 +100,10 @@ public class CheckBlockServiceImpl implements CheckBlockService {
BusinessEnum
.
CONFIRM_CHECK_DETAIL
.
id
,
BusinessEnum
.
CONFIRM_CHECK_DETAIL
.
id
,
detail
.
getId
(),
detail
.
getId
(),
detail
.
getCheckUnit
());
detail
.
getCheckUnit
());
log
.
info
(
"[CHECK] 上链id:{}"
,
detail
.
getId
());
}
}
FileWriter
fileWritter
=
new
FileWriter
(
file
.
getName
()
);
FileWriter
fileWritter
=
new
FileWriter
(
file
);
BufferedWriter
bufferWritter
=
new
BufferedWriter
(
fileWritter
);
BufferedWriter
bufferWritter
=
new
BufferedWriter
(
fileWritter
);
bufferWritter
.
write
(
updateTime
.
format
(
fmt
).
toString
());
bufferWritter
.
write
(
updateTime
.
format
(
fmt
).
toString
());
bufferWritter
.
close
();
bufferWritter
.
close
();
...
@@ -106,8 +114,12 @@ public class CheckBlockServiceImpl implements CheckBlockService {
...
@@ -106,8 +114,12 @@ public class CheckBlockServiceImpl implements CheckBlockService {
@Override
@Override
public
BlockTraceabilityParsing
findADifference
(
Integer
detailId
)
{
public
BlockTraceabilityParsing
findADifference
(
Integer
detailId
)
{
BlockData
blockData
=
blockDataService
.
findBillTypeAndBillId
(
BusinessEnum
.
CONFIRM_CHECK_DETAIL
.
id
,
detailId
);
BlockData
blockData
=
blockDataService
.
findBillTypeAndBillId
(
BusinessEnum
.
CONFIRM_CHECK_DETAIL
.
id
,
detailId
);
BcRecord
bcRecord
=
blockService
.
fetchRecord
(
BlockBusinessEnum
.
ALLOT
.
subCode
,
blockData
.
getRecordID
());
BcRecordData
bcRecordData
=
bcRecord
.
getData
();
if
(
blockData
.
getId
()
==
null
)
{
throw
new
ApiException
(
"数据上链中,请稍后再试"
);
}
BcRecord
bcRecord
=
blockService
.
fetchRecord
(
BlockBusinessEnum
.
CONFIRM_CHECK_DETAIL
.
subCode
,
blockData
.
getRecordID
());
CheckDetailVo
remoteDetail
=
JSON
.
parseObject
(
bcRecord
.
getData
().
getContent
(),
CheckDetailVo
.
class
);
CheckDetailVo
remoteDetail
=
JSON
.
parseObject
(
bcRecord
.
getData
().
getContent
(),
CheckDetailVo
.
class
);
CheckDetailVo
localDetail
=
deviceCheckController
.
findDetail
(
detailId
).
getBody
().
getData
();
CheckDetailVo
localDetail
=
deviceCheckController
.
findDetail
(
detailId
).
getBody
().
getData
();
...
...
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/task/CheckTimedTask.java
浏览文件 @
10c1174f
...
@@ -3,6 +3,7 @@ package com.tykj.dev.device.confirmcheck.task;
...
@@ -3,6 +3,7 @@ package com.tykj.dev.device.confirmcheck.task;
import
com.tykj.dev.device.confirmcheck.service.CheckBlockService
;
import
com.tykj.dev.device.confirmcheck.service.CheckBlockService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -20,19 +21,23 @@ public class CheckTimedTask {
...
@@ -20,19 +21,23 @@ public class CheckTimedTask {
private
boolean
run
=
false
;
private
boolean
run
=
false
;
@Scheduled
(
cron
=
"0 * * * * ? "
)
@Scheduled
(
cron
=
"0 * * * * ? "
)
@Async
public
void
onChain
()
{
public
void
onChain
()
{
log
.
info
(
"[check] 开始上链任务"
);
log
.
info
(
"[check] 开始上链任务"
);
if
(
run
)
{
if
(
run
)
{
log
.
warn
(
"[check] 上次任务未结束,终止"
);
log
.
warn
(
"[check] 上次任务未结束,终止"
);
return
;
}
try
{
checkBlockService
.
detailToChain
();
run
=
false
;
}
catch
(
Exception
e
)
{
}
else
{
log
.
error
(
"[check] 上链是啊比:{}"
,
e
.
toString
());
run
=
true
;
run
=
false
;
try
{
checkBlockService
.
detailToChain
();
run
=
false
;
log
.
info
(
"[check] 上链任务结束"
);
}
catch
(
Exception
e
)
{
run
=
false
;
log
.
error
(
"[check] 上链错误处理:"
);
e
.
printStackTrace
();
}
}
}
}
}
...
...
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/utils/ObjTransUtil.java
浏览文件 @
10c1174f
...
@@ -392,7 +392,7 @@ public class ObjTransUtil {
...
@@ -392,7 +392,7 @@ public class ObjTransUtil {
}
}
long
end
=
System
.
currentTimeMillis
();
long
end
=
System
.
currentTimeMillis
();
log
.
info
(
"[性能测试] 装备搜索耗时 {} ms"
,
end
-
start
);
//
log.info("[性能测试] 装备搜索耗时 {} ms", end - start);
// detailDo -> detailVo
// detailDo -> detailVo
ModelMapper
modelMapper
=
BeanHelper
.
getUserMapper
();
ModelMapper
modelMapper
=
BeanHelper
.
getUserMapper
();
...
...
dev-scrap/src/main/java/com/tykj/dev/device/scrap/service/impl/ScrapServiceImpl.java
浏览文件 @
10c1174f
...
@@ -254,12 +254,13 @@ public class ScrapServiceImpl implements ScrapService {
...
@@ -254,12 +254,13 @@ public class ScrapServiceImpl implements ScrapService {
List
<
ScriptSaveVo
>
scriptSaveVos
=
JacksonUtil
.
List
<
ScriptSaveVo
>
scriptSaveVos
=
JacksonUtil
.
readValue
(
scrap
.
getScriptJson
(),
new
TypeReference
<
List
<
ScriptSaveVo
>>()
{
readValue
(
scrap
.
getScriptJson
(),
new
TypeReference
<
List
<
ScriptSaveVo
>>()
{
});
});
scrap
.
setScripts
(
scriptSaveVos
);
}
}
scrap
.
setBillFiles
(
FilesUtil
.
stringFileToList
(
scrap
.
getBillFile
()));
scrap
.
setBillFiles
(
FilesUtil
.
stringFileToList
(
scrap
.
getBillFile
()));
scrap
.
setOutboundFiles
(
FilesUtil
.
stringFileToList
(
scrap
.
getOutboundFile
()));
scrap
.
setOutboundFiles
(
FilesUtil
.
stringFileToList
(
scrap
.
getOutboundFile
()));
scrap
.
setReplyFileList
(
FilesUtil
.
stringFileToList
(
scrap
.
getReplyFiles
()));
scrap
.
setReplyFileList
(
FilesUtil
.
stringFileToList
(
scrap
.
getReplyFiles
()));
scrap
.
setApplyFileList
(
FilesUtil
.
stringFileToList
(
scrap
.
getApplyFiles
()));
scrap
.
setApplyFileList
(
FilesUtil
.
stringFileToList
(
scrap
.
getApplyFiles
()));
scrap
.
setScripts
(
scrap
.
getScripts
());
//
scrap.setScripts(scrap.getScripts());
scrap
.
setFileMd5
(
FileMD5Util
.
fileRetToMd5
(
scrap
.
getOutboundFiles
()));
scrap
.
setFileMd5
(
FileMD5Util
.
fileRetToMd5
(
scrap
.
getOutboundFiles
()));
return
scrap
;
return
scrap
;
}
else
{
}
else
{
...
...
dev-union/src/main/resources/application-dev.properties
浏览文件 @
10c1174f
...
@@ -13,7 +13,8 @@ spring.jpa.hibernate.ddl-auto=update
...
@@ -13,7 +13,8 @@ spring.jpa.hibernate.ddl-auto=update
#spring.jpa.hibernate.ddl-auto=update
#spring.jpa.hibernate.ddl-auto=update
#file.path=C:/Users/dengdiyi/Documents/file/
#file.path=C:/Users/dengdiyi/Documents/file/
# spring boot admin
# spring boot admin
file.path
=
/Users/zjm/code/test-tu/
#file.path=/Users/zjm/code/test-tu/
file.path
=
C:/file/
preview.path
=
http://192.168.0.14:8090/file/
preview.path
=
http://192.168.0.14:8090/file/
spring.boot.admin.client.url
=
http://localhost:8769
spring.boot.admin.client.url
=
http://localhost:8769
spring.boot.admin.client.instance.serviceBaseUrl
=
http://localhost:8087
spring.boot.admin.client.instance.serviceBaseUrl
=
http://localhost:8087
...
@@ -25,4 +26,4 @@ block.carrier.ip=http://192.168.0.147:8088
...
@@ -25,4 +26,4 @@ block.carrier.ip=http://192.168.0.147:8088
carrier.url
=
http://192.168.0.101:8087/configuration/saveConfiguration
carrier.url
=
http://192.168.0.101:8087/configuration/saveConfiguration
file.matching.excel
=
/Users/zhoushaopan/excel/
file.matching.excel
=
/Users/zhoushaopan/excel/
check.time.last
=
C:/file/CHECKTIME.txt
check.time.last
=
C:/file/CHECKTIME2.txt
\ No newline at end of file
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论