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){ @ApiParam(value="方向", name="direction", required=true) @RequestParam ("direction") String direction){
return dcDeviceService.selectNearBoard(stakeMark,direction); return dcDeviceService.selectNearBoard(stakeMark,direction);
} }
@OperationLog(operUrl = "/business/device/batchFunctions")
public void batchInvokedFunction(Object object) throws HttpException, IOException, InterruptedException { public void batchInvokedFunction(Object object) throws HttpException, IOException, InterruptedException {
Map<String, Object> map = new ObjectMapper().convertValue(object, Map.class); Map<String, Object> map = new ObjectMapper().convertValue(object, Map.class);
batchInvokedFunction(map); 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 { public class DcBatchFunctionsJob {
//@TableId(value = "jobId", type = IdType.AUTO) //@TableId(value = "jobId", type = IdType.AUTO)
private Integer jobId; private Long jobId;
@ApiModelProperty("任务组ID") @ApiModelProperty("任务组ID")
private String jobGroup; private String jobGroup;
//@Excel(name = "任务名称")
@TableField(exist = false)
private String jobName;
@ApiModelProperty("调用目标字符串") @ApiModelProperty("调用目标字符串")
private String invokeTarget; private String invokeTarget;
@ApiModelProperty("调用参数") @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)); dcBatchFunctionsJobGroup.setDetailedConfiguration(String.valueOf(detailedConfigurations));
dcBatchFunctionsJobGroupService.editDcBatchFunctionsJobGroup(dcBatchFunctionsJobGroup); dcBatchFunctionsJobGroupService.editDcBatchFunctionsJobGroup(dcBatchFunctionsJobGroup);
dcBatchFunctionsJob.setJobId(id); dcBatchFunctionsJob.setJobId(Long.valueOf(id));
dcBatchFunctionsJob.setCreateTime(new Date()); dcBatchFunctionsJob.setCreateTime(new Date());
createScheduleJob(dcBatchFunctionsJob); createScheduleJob(dcBatchFunctionsJob);
boolean save = save(dcBatchFunctionsJob); boolean save = save(dcBatchFunctionsJob);
@ -150,7 +150,7 @@ public class DcBatchFunctionsJobServiceImpl extends ServiceImpl<DcBatchFunctions
public boolean removeDcBatchFunctionsJob(List<String> ids) throws SchedulerException, TaskException { public boolean removeDcBatchFunctionsJob(List<String> ids) throws SchedulerException, TaskException {
for (String id : ids) { for (String id : ids) {
DcBatchFunctionsJob job = new DcBatchFunctionsJob(); DcBatchFunctionsJob job = new DcBatchFunctionsJob();
job.setJobId(Integer.valueOf(id)); job.setJobId(Long.valueOf(id));
List<DcBatchFunctionsJob> dcBatchFunctionsJobs = listDcBatchFunctionsJob(job); List<DcBatchFunctionsJob> dcBatchFunctionsJobs = listDcBatchFunctionsJob(job);
if (dcBatchFunctionsJobs.size() == 0) { if (dcBatchFunctionsJobs.size() == 0) {
return false; return false;
@ -247,11 +247,7 @@ public class DcBatchFunctionsJobServiceImpl extends ServiceImpl<DcBatchFunctions
}); });
dcBatchFunctionsJobGroup.setDetailedConfiguration(detailedConfiguration.toString()); dcBatchFunctionsJobGroup.setDetailedConfiguration(detailedConfiguration.toString());
DcBatchFunctionsJobGroup dcBatchFunctionsJobGroup1 = dcBatchFunctionsJobGroupService.editDcBatchFunctionsJobGroup(dcBatchFunctionsJobGroup); DcBatchFunctionsJobGroup dcBatchFunctionsJobGroup1 = dcBatchFunctionsJobGroupService.editDcBatchFunctionsJobGroup(dcBatchFunctionsJobGroup);
if (dcBatchFunctionsJobGroup1 != null) { return dcBatchFunctionsJobGroup1 != null;
return true;
} else {
return false;
}
} }
} }

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 { protected void doExecute(JobExecutionContext context, SysJob sysJob) throws Exception {
ScheduledTaskSchedulingTask scheduledTaskSchedulingTask = new ScheduledTaskSchedulingTask(); ScheduledTaskSchedulingTask scheduledTaskSchedulingTask = new ScheduledTaskSchedulingTask();
DcBatchFunctionsJob dcBatchFunctionsJob = new DcBatchFunctionsJob(); DcBatchFunctionsJob dcBatchFunctionsJob = new DcBatchFunctionsJob();
dcBatchFunctionsJob.setJobId(Math.toIntExact(sysJob.getJobId())); dcBatchFunctionsJob.setJobId(sysJob.getJobId());
scheduledTaskSchedulingTask.invokeTarget(dcBatchFunctionsJob); scheduledTaskSchedulingTask.invokeTarget(dcBatchFunctionsJob);
} }
} }

Loading…
Cancel
Save