Browse Source

优化定时管控功能

develop
zhaoxianglong 10 months ago
parent
commit
4b81bce467
  1. 2
      zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java
  2. 5
      zc-business/src/main/java/com/zc/business/domain/DcBatchFunctionsJob.java
  3. 10
      zc-business/src/main/java/com/zc/business/service/impl/DcBatchFunctionsJobServiceImpl.java
  4. 2
      zc-business/src/main/java/com/zc/business/utils/ScheduledTaskScheduling.java

2
zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java

@ -604,6 +604,8 @@ public class DcDeviceController extends BaseController {
@ApiParam(value="方向", name="direction", required=true) @RequestParam ("direction") String direction){
return dcDeviceService.selectNearBoard(stakeMark,direction);
}
@OperationLog(operUrl = "/business/device/batchFunctions")
public void batchInvokedFunction(Object object) throws HttpException, IOException, InterruptedException {
Map<String, Object> map = new ObjectMapper().convertValue(object, Map.class);
batchInvokedFunction(map);

5
zc-business/src/main/java/com/zc/business/domain/DcBatchFunctionsJob.java

@ -12,9 +12,12 @@ import java.util.Date;
public class DcBatchFunctionsJob {
//@TableId(value = "jobId", type = IdType.AUTO)
private Integer jobId;
private Long jobId;
@ApiModelProperty("任务组ID")
private String jobGroup;
//@Excel(name = "任务名称")
@TableField(exist = false)
private String jobName;
@ApiModelProperty("调用目标字符串")
private String invokeTarget;
@ApiModelProperty("调用参数")

10
zc-business/src/main/java/com/zc/business/service/impl/DcBatchFunctionsJobServiceImpl.java

@ -99,7 +99,7 @@ public class DcBatchFunctionsJobServiceImpl extends ServiceImpl<DcBatchFunctions
}
dcBatchFunctionsJobGroup.setDetailedConfiguration(String.valueOf(detailedConfigurations));
dcBatchFunctionsJobGroupService.editDcBatchFunctionsJobGroup(dcBatchFunctionsJobGroup);
dcBatchFunctionsJob.setJobId(id);
dcBatchFunctionsJob.setJobId(Long.valueOf(id));
dcBatchFunctionsJob.setCreateTime(new Date());
createScheduleJob(dcBatchFunctionsJob);
boolean save = save(dcBatchFunctionsJob);
@ -150,7 +150,7 @@ public class DcBatchFunctionsJobServiceImpl extends ServiceImpl<DcBatchFunctions
public boolean removeDcBatchFunctionsJob(List<String> ids) throws SchedulerException, TaskException {
for (String id : ids) {
DcBatchFunctionsJob job = new DcBatchFunctionsJob();
job.setJobId(Integer.valueOf(id));
job.setJobId(Long.valueOf(id));
List<DcBatchFunctionsJob> dcBatchFunctionsJobs = listDcBatchFunctionsJob(job);
if (dcBatchFunctionsJobs.size() == 0) {
return false;
@ -247,11 +247,7 @@ public class DcBatchFunctionsJobServiceImpl extends ServiceImpl<DcBatchFunctions
});
dcBatchFunctionsJobGroup.setDetailedConfiguration(detailedConfiguration.toString());
DcBatchFunctionsJobGroup dcBatchFunctionsJobGroup1 = dcBatchFunctionsJobGroupService.editDcBatchFunctionsJobGroup(dcBatchFunctionsJobGroup);
if (dcBatchFunctionsJobGroup1 != null) {
return true;
} else {
return false;
}
return dcBatchFunctionsJobGroup1 != null;
}
}

2
zc-business/src/main/java/com/zc/business/utils/ScheduledTaskScheduling.java

@ -14,7 +14,7 @@ public class ScheduledTaskScheduling extends AbstractQuartzJob {
protected void doExecute(JobExecutionContext context, SysJob sysJob) throws Exception {
ScheduledTaskSchedulingTask scheduledTaskSchedulingTask = new ScheduledTaskSchedulingTask();
DcBatchFunctionsJob dcBatchFunctionsJob = new DcBatchFunctionsJob();
dcBatchFunctionsJob.setJobId(Math.toIntExact(sysJob.getJobId()));
dcBatchFunctionsJob.setJobId(sysJob.getJobId());
scheduledTaskSchedulingTask.invokeTarget(dcBatchFunctionsJob);
}
}

Loading…
Cancel
Save