Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
Z
zhmes-agecal
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
耿迪迪
zhmes-agecal
Commits
55fd6f3e
Commit
55fd6f3e
authored
Sep 25, 2025
by
wanghao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1 指令指令完成,但是 没有检测到机械臂完成。
parent
fc08911c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
104 additions
and
1 deletion
+104
-1
QuartzTestController.java
...zehong/web/controller/equipment/QuartzTestController.java
+66
-0
TestEmptyJob.java
...va/com/zehong/system/task/DeviceCommJob/TestEmptyJob.java
+33
-0
robotArmCommand.js
zhmes-agecal-web/src/api/robotArm/robotArmCommand.js
+5
-1
No files found.
zhmes-agecal-admin/src/main/java/com/zehong/web/controller/equipment/QuartzTestController.java
0 → 100644
View file @
55fd6f3e
package
com
.
zehong
.
web
.
controller
.
equipment
;
import
com.zehong.system.task.DeviceCommJob.TestEmptyJob
;
import
org.quartz.*
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
import
java.time.Instant
;
import
java.util.Date
;
/**
* @author lenovo
* @date 2025/9/25
* @description TODO
*/
@RestController
@RequestMapping
(
"/test/quartz"
)
public
class
QuartzTestController
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
QuartzTestController
.
class
);
@Resource
private
Scheduler
scheduler
;
@GetMapping
(
"/runEmptyJob"
)
public
String
runEmptyJob
()
{
try
{
// 1. 定义JobKey和TriggerKey(确保唯一,避免冲突)
String
jobId
=
"TEST_EMPTY_JOB_"
+
System
.
currentTimeMillis
();
String
triggerId
=
"TEST_EMPTY_TRIGGER_"
+
System
.
currentTimeMillis
();
JobKey
jobKey
=
new
JobKey
(
jobId
,
"TEST_GROUP"
);
TriggerKey
triggerKey
=
new
TriggerKey
(
triggerId
,
"TEST_GROUP"
);
// 2. 创建无依赖的JobDetail(不传递任何参数)
JobDetail
jobDetail
=
JobBuilder
.
newJob
(
TestEmptyJob
.
class
)
.
withIdentity
(
jobKey
)
.
storeDurably
(
false
)
// 非持久化,执行完可删除
.
build
();
// 3. 创建Trigger(延迟10秒执行,仅1次)
Date
triggerTime
=
Date
.
from
(
Instant
.
now
().
plus
(
2
,
java
.
time
.
temporal
.
ChronoUnit
.
SECONDS
));
SimpleTrigger
trigger
=
TriggerBuilder
.
newTrigger
()
.
withIdentity
(
triggerKey
)
.
forJob
(
jobKey
)
.
startAt
(
triggerTime
)
.
withSchedule
(
SimpleScheduleBuilder
.
simpleSchedule
()
.
withRepeatCount
(
0
)
.
withMisfireHandlingInstructionFireNow
())
.
build
();
// 4. 提交调度并打印日志
scheduler
.
scheduleJob
(
jobDetail
,
trigger
);
log
.
info
(
"最小化测试Job提交成功:jobId={}, triggerId={}, startAt={}"
,
jobId
,
triggerId
,
triggerTime
);
return
"测试Job提交成功,10秒后执行,查看日志"
;
}
catch
(
SchedulerException
e
)
{
log
.
error
(
"最小化测试Job提交失败:"
,
e
);
return
"测试Job提交失败:"
+
e
.
getMessage
();
}
}
}
zhmes-agecal-system/src/main/java/com/zehong/system/task/DeviceCommJob/TestEmptyJob.java
0 → 100644
View file @
55fd6f3e
package
com
.
zehong
.
system
.
task
.
DeviceCommJob
;
import
org.quartz.Job
;
import
org.quartz.JobExecutionContext
;
import
org.quartz.JobExecutionException
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Component
;
/**
* @author lenovo
* @date 2025/9/25
* @description TODO
*/
@Component
public
class
TestEmptyJob
implements
Job
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
TestEmptyJob
.
class
);
// 无依赖注入,仅打印日志
@Override
public
void
execute
(
JobExecutionContext
context
)
throws
JobExecutionException
{
try
{
log
.
info
(
"=== 最小化测试Job开始执行 ==="
);
log
.
info
(
"JobKey: {}"
,
context
.
getJobDetail
().
getKey
());
log
.
info
(
"TriggerKey: {}"
,
context
.
getTrigger
().
getKey
());
log
.
info
(
"当前时间: {}"
,
new
java
.
util
.
Date
());
log
.
info
(
"=== 最小化测试Job执行完成 ==="
);
}
catch
(
Throwable
e
)
{
log
.
error
(
"最小化测试Job异常:"
,
e
);
// 主动抛出异常,观察是否影响状态(用于测试)
throw
new
JobExecutionException
(
"测试异常"
,
e
);
}
}
}
zhmes-agecal-web/src/api/robotArm/robotArmCommand.js
View file @
55fd6f3e
...
@@ -55,8 +55,12 @@ export function sendStopCommand() {
...
@@ -55,8 +55,12 @@ export function sendStopCommand() {
// 停止当前指令
// 停止当前指令
export
function
sendWriteHour
(
ipAndPort
)
{
export
function
sendWriteHour
(
ipAndPort
)
{
// return request({
// url: '/equipmentData/trigger/' + ipAndPort,
// method: 'get'
// })
return
request
({
return
request
({
url
:
'/
equipmentData/trigger/'
+
ipAndPort
,
url
:
'/
test/quartz/runEmptyJob'
,
method
:
'get'
method
:
'get'
})
})
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment