Browse Source

新增新增定时任务组接口

develop
zhaoxianglong 4 months ago
parent
commit
08757b5cab
  1. 16
      zc-business/src/main/java/com/zc/business/controller/DcBatchFunctionsJobGroupController.java
  2. 5
      zc-business/src/main/java/com/zc/business/domain/DcBatchFunctionsJobGroup.java
  3. 2
      zc-business/src/main/java/com/zc/business/service/IDcBatchFunctionsJobGroupService.java
  4. 24
      zc-business/src/main/java/com/zc/business/service/impl/DcBatchFunctionsJobGroupServiceImpl.java

16
zc-business/src/main/java/com/zc/business/controller/DcBatchFunctionsJobGroupController.java

@ -86,6 +86,22 @@ public class DcBatchFunctionsJobGroupController extends BaseController {
return AjaxResult.success(dcBatchFunctionsJobGroupService.addDcBatchFunctionsJobGroup(dcBatchFunctionsJobGroup));
}
/**
* 新增
*
* @param dcBatchFunctionsJobGroup 新增参数
* @return 新增操作结果
*/
@ApiOperation("新增")
//@PreAuthorize("@ss.hasPermi('iot:facility:add')")
@Log(title = "新增", businessType = BusinessType.INSERT)
@PostMapping("/add")
public AjaxResult adddcBatchFunctionsJobGroupAnddcBatchFunctionsJob(@Valid @RequestBody DcBatchFunctionsJobGroup dcBatchFunctionsJobGroup) throws SchedulerException, TaskException {
return AjaxResult.success(dcBatchFunctionsJobGroupService.adddcBatchFunctionsJobGroupAnddcBatchFunctionsJob(dcBatchFunctionsJobGroup));
}
/**
* 修改
*

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

@ -1,12 +1,15 @@
package com.zc.business.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Data
@ApiModel(value = "DcBatchFunctionsJobGroup", description = "定时任务组实体")
@ -30,4 +33,6 @@ public class DcBatchFunctionsJobGroup {
private Date updateBy;
@ApiModelProperty("修改时间")
private Date updateTime;
@TableField(exist = false)
private List<DcBatchFunctionsJob> dcBatchFunctionsJobList;
}

2
zc-business/src/main/java/com/zc/business/service/IDcBatchFunctionsJobGroupService.java

@ -50,4 +50,6 @@ public interface IDcBatchFunctionsJobGroupService extends IService<DcBatchFuncti
List<DcBatchFunctionsJobGroup> listDcBatchFunctionsJobGroup(DcBatchFunctionsJobGroup dcBatchFunctionsJobGroup);
boolean changeStatus(DcBatchFunctionsJobGroup dcBatchFunctionsJobGroup) throws SchedulerException, TaskException;
DcBatchFunctionsJobGroup adddcBatchFunctionsJobGroupAnddcBatchFunctionsJob(DcBatchFunctionsJobGroup dcBatchFunctionsJobGroup) throws SchedulerException, TaskException;
}

24
zc-business/src/main/java/com/zc/business/service/impl/DcBatchFunctionsJobGroupServiceImpl.java

@ -1,5 +1,6 @@
package com.zc.business.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -13,11 +14,14 @@ import com.zc.business.service.IDcBatchFunctionsJobGroupService;
import com.zc.business.service.IDcBatchFunctionsJobService;
import org.quartz.SchedulerException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
* 定时任务组Service业务层处理
@ -134,5 +138,25 @@ public class DcBatchFunctionsJobGroupServiceImpl extends ServiceImpl<DcBatchFunc
DcBatchFunctionsJobGroup dcBatchFunctionsJobGroup1 = editDcBatchFunctionsJobGroup(dcBatchFunctionsJobGroup);
return dcBatchFunctionsJobGroup1 != null;
}
@Override
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public DcBatchFunctionsJobGroup adddcBatchFunctionsJobGroupAnddcBatchFunctionsJob(DcBatchFunctionsJobGroup dcBatchFunctionsJobGroup) throws SchedulerException, TaskException {
List<DcBatchFunctionsJob> dcBatchFunctionsJobList = dcBatchFunctionsJobGroup.getDcBatchFunctionsJobList();
DcBatchFunctionsJobGroup dcBatchFunctionsJobGroup1 = addDcBatchFunctionsJobGroup(dcBatchFunctionsJobGroup);
if (dcBatchFunctionsJobGroup1 == null) {
throw new NullPointerException();
}
for (DcBatchFunctionsJob job : dcBatchFunctionsJobList) {
job.setJobGroup(String.valueOf(dcBatchFunctionsJobGroup1.getId()));
DcBatchFunctionsJob dcBatchFunctionsJob = dcBatchFunctionsJobService.addDcBatchFunctionsJob(job);
if (dcBatchFunctionsJob == null) {
throw new NullPointerException();
}
}
return dcBatchFunctionsJobGroup1;
}
}

Loading…
Cancel
Save