parent
40def8bdcf
commit
c8ca6dbce1
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>jnpf-example</artifactId>
|
||||
<groupId>com.jnpf</groupId>
|
||||
<version>3.5.0-RELEASE</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>jnpf-example-biz</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.jnpf</groupId>
|
||||
<artifactId>jnpf-example-entity</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jnpf</groupId>
|
||||
<artifactId>jnpf-generater-base</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>jnpf-example</artifactId>
|
||||
<groupId>com.jnpf</groupId>
|
||||
<version>3.5.0-RELEASE</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>jnpf-example-controller</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.jnpf</groupId>
|
||||
<artifactId>jnpf-example-biz</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>jnpf-example</artifactId>
|
||||
<groupId>com.jnpf</groupId>
|
||||
<version>3.5.0-RELEASE</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>jnpf-example-entity</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.jnpf</groupId>
|
||||
<artifactId>jnpf-common-all</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>jnpf-scheduletask</artifactId>
|
||||
<groupId>com.jnpf</groupId>
|
||||
<version>3.5.0-RELEASE</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>jnpf-scheduletask-biz</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.jnpf</groupId>
|
||||
<artifactId>jnpf-common-all</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jnpf</groupId>
|
||||
<artifactId>jnpf-common-scheduletask</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jnpf</groupId>
|
||||
<artifactId>jnpf-system-biz</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>jnpf-scheduletask</artifactId>
|
||||
<groupId>com.jnpf</groupId>
|
||||
<version>3.5.0-RELEASE</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>jnpf-scheduletask-controller</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.jnpf</groupId>
|
||||
<artifactId>jnpf-scheduletask-biz</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -0,0 +1,186 @@
|
||||
package jnpf.scheduletask.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import jnpf.base.ActionResult;
|
||||
import jnpf.base.UserInfo;
|
||||
import jnpf.base.Pagination;
|
||||
import jnpf.constant.MsgCode;
|
||||
import jnpf.scheduletask.entity.HandlerNameEntity;
|
||||
import jnpf.scheduletask.entity.TimeTaskEntity;
|
||||
import jnpf.exception.DataException;
|
||||
import jnpf.scheduletask.model.*;
|
||||
import jnpf.scheduletask.rest.RestScheduleTaskUtil;
|
||||
import jnpf.util.JsonUtil;
|
||||
import jnpf.util.JsonUtilEx;
|
||||
import jnpf.util.UserProvider;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 任务调度
|
||||
*
|
||||
* @author JNPF开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 引迈信息技术有限公司
|
||||
* @date 2019年9月27日 上午9:18
|
||||
*/
|
||||
@Tag(name = "任务调度", description = "TimeTask")
|
||||
@RestController
|
||||
@RequestMapping("/api/scheduletask")
|
||||
public class TimeTaskController {
|
||||
|
||||
@Autowired
|
||||
private UserProvider userProvider;
|
||||
|
||||
/**
|
||||
* 获取任务调度列表
|
||||
*
|
||||
* @param pagination
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取任务调度列表")
|
||||
@GetMapping
|
||||
public JSONObject list(Pagination pagination) {
|
||||
UserInfo userInfo = userProvider.get();
|
||||
return RestScheduleTaskUtil.getList(pagination, userInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取本地任务列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取任务调度列表")
|
||||
@GetMapping("/TaskMethods")
|
||||
public ActionResult<List<TaskMethodsVO>> taskMethods() {
|
||||
List<TaskMethodsVO> list = new ArrayList<>(16);
|
||||
// 获取所有handlerName
|
||||
List<HandlerNameEntity> handlerNameEntities = RestScheduleTaskUtil.getHandlerList();
|
||||
for (HandlerNameEntity entity : handlerNameEntities) {
|
||||
TaskMethodsVO taskMethodsVO = new TaskMethodsVO();
|
||||
taskMethodsVO.setId(entity.getId());
|
||||
taskMethodsVO.setFullName(entity.getHandlerName());
|
||||
list.add(taskMethodsVO);
|
||||
}
|
||||
return ActionResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取任务调度日志列表
|
||||
*
|
||||
* @param pagination
|
||||
* @param taskId 任务Id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取任务调度日志列表")
|
||||
@GetMapping("/{id}/TaskLog")
|
||||
public JSONObject list(@PathVariable("id") String taskId, TaskPage pagination) {
|
||||
return RestScheduleTaskUtil.getLogList(taskId, userProvider.get(), pagination);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取任务调度信息
|
||||
*
|
||||
* @param id 主键值
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取任务调度信息")
|
||||
@GetMapping("/Info/{id}")
|
||||
public ActionResult<TaskInfoVO> info(@PathVariable("id") String id) throws DataException {
|
||||
TimeTaskEntity entity = RestScheduleTaskUtil.getInfo(id, userProvider.get());
|
||||
TaskInfoVO vo = JsonUtilEx.getJsonToBeanEx(entity, TaskInfoVO.class);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新建任务调度
|
||||
*
|
||||
* @param taskCrForm
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "新建任务调度")
|
||||
@PostMapping
|
||||
public ActionResult create(@RequestBody @Valid TaskCrForm taskCrForm) {
|
||||
taskCrForm.setUserInfo(userProvider.get());
|
||||
JSONObject jsonObject = RestScheduleTaskUtil.create(taskCrForm);
|
||||
return JsonUtil.getJsonToBean(jsonObject, ActionResult.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改任务调度
|
||||
*
|
||||
* @param id 主键值
|
||||
* @param taskUpForm
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "修改任务调度")
|
||||
@PutMapping("/{id}")
|
||||
public ActionResult update(@PathVariable("id") String id, @RequestBody @Valid TaskUpForm taskUpForm) {
|
||||
taskUpForm.setUserInfo(userProvider.get());
|
||||
JSONObject jsonObject = RestScheduleTaskUtil.update(id, taskUpForm);
|
||||
return JsonUtil.getJsonToBean(jsonObject, ActionResult.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除任务
|
||||
*
|
||||
* @param id 主键值
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "删除任务")
|
||||
@DeleteMapping("/{id}")
|
||||
public ActionResult delete(@PathVariable("id") String id) {
|
||||
JSONObject jsonObject = RestScheduleTaskUtil.delete(id, userProvider.get());
|
||||
return JsonUtil.getJsonToBean(jsonObject, ActionResult.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止任务调度
|
||||
*
|
||||
* @param id 主键值
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "停止任务调度")
|
||||
@PutMapping("/{id}/Actions/Stop")
|
||||
public ActionResult stop(@PathVariable("id") String id) {
|
||||
UpdateTaskModel updateTaskModel = new UpdateTaskModel();
|
||||
TimeTaskEntity entity = RestScheduleTaskUtil.getInfo(id, userProvider.get());
|
||||
if (entity != null) {
|
||||
entity.setEnabledMark(0);
|
||||
entity.setRunCount(entity.getRunCount());
|
||||
updateTaskModel.setEntity(entity);
|
||||
updateTaskModel.setUserInfo(userProvider.get());
|
||||
RestScheduleTaskUtil.updateTask(updateTaskModel);
|
||||
return ActionResult.success(MsgCode.SU005.get());
|
||||
}
|
||||
return ActionResult.fail("操作失败,任务不存在");
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动任务调度
|
||||
*
|
||||
* @param id 主键值
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "启动任务调度")
|
||||
@PutMapping("/{id}/Actions/Enable")
|
||||
public ActionResult enable(@PathVariable("id") String id) {
|
||||
UpdateTaskModel updateTaskModel = new UpdateTaskModel();
|
||||
TimeTaskEntity entity = RestScheduleTaskUtil.getInfo(id, userProvider.get());
|
||||
if (entity != null) {
|
||||
entity.setEnabledMark(1);
|
||||
updateTaskModel.setEntity(entity);
|
||||
updateTaskModel.setUserInfo(userProvider.get());
|
||||
RestScheduleTaskUtil.updateTask(updateTaskModel);
|
||||
return ActionResult.success(MsgCode.SU005.get());
|
||||
}
|
||||
return ActionResult.fail("操作失败,任务不存在");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>jnpf-java-boot</artifactId>
|
||||
<groupId>com.jnpf</groupId>
|
||||
<version>3.5.0-RELEASE</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>jnpf-scheduletask</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>jnpf-scheduletask-controller</module>
|
||||
<module>jnpf-scheduletask-biz</module>
|
||||
</modules>
|
||||
|
||||
|
||||
</project>
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,2 @@
|
||||
const superQueryJson = [{"clearable":true,"maxlength":null,"suffixIcon":"","fullName":"岗位名称","addonAfter":"","__config__":{"formId":101,"visibility":["pc","app"],"jnpfKey":"input","noShow":false,"tipLabel":"","dragDisabled":false,"className":[],"label":"岗位名称","trigger":"blur","showLabel":true,"required":true,"tableName":"yys_post","renderKey":1722837183559,"layout":"colFormItem","tagIcon":"icon-ym icon-ym-generator-input","unique":false,"tag":"JnpfInput","regList":[],"span":8},"readonly":false,"showWordLimit":false,"__vModel__":"postName","showPassword":false,"style":{"width":"100%"},"disabled":false,"id":"postName","placeholder":"请输入","prefixIcon":"","addonBefore":"","on":{"change":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}","blur":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"}},{"clearable":true,"maxlength":null,"suffixIcon":"","fullName":"岗位编码","addonAfter":"","__config__":{"formId":102,"visibility":["pc","app"],"jnpfKey":"input","noShow":false,"tipLabel":"","dragDisabled":false,"className":[],"label":"岗位编码","trigger":"blur","showLabel":true,"required":true,"tableName":"yys_post","renderKey":1722837353100,"layout":"colFormItem","tagIcon":"icon-ym icon-ym-generator-input","unique":false,"tag":"JnpfInput","regList":[],"span":8},"readonly":false,"showWordLimit":false,"__vModel__":"postCode","showPassword":false,"style":{"width":"100%"},"disabled":false,"id":"postCode","placeholder":"请输入","prefixIcon":"","addonBefore":"","on":{"change":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}","blur":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"}},{"clearable":true,"maxlength":null,"suffixIcon":"","fullName":"岗位顺序","addonAfter":"","__config__":{"formId":104,"visibility":["pc","app"],"jnpfKey":"input","noShow":false,"tipLabel":"","dragDisabled":false,"className":[],"label":"岗位顺序","trigger":"blur","showLabel":true,"required":false,"tableName":"yys_post","renderKey":1722837451727,"layout":"colFormItem","tagIcon":"icon-ym icon-ym-generator-input","unique":false,"tag":"JnpfInput","regList":[{"pattern":"/^\\d+$/","message":"请输入正确的数字"}],"span":8},"readonly":false,"showWordLimit":false,"__vModel__":"postSort","showPassword":false,"style":{"width":"100%"},"disabled":false,"id":"postSort","placeholder":"请输入","prefixIcon":"","addonBefore":"","on":{"change":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}","blur":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"}},{"filterable":false,"clearable":true,"multiple":false,"fullName":"岗位状态","props":{"label":"fullName","value":"id"},"__config__":{"formId":103,"visibility":["pc","app"],"jnpfKey":"select","defaultValue":"","noShow":false,"dataType":"static","dictionaryType":"","tipLabel":"","dragDisabled":false,"className":[],"label":"岗位状态","trigger":"change","propsUrl":"","templateJson":[],"showLabel":true,"required":true,"tableName":"yys_post","renderKey":1722837372783,"layout":"colFormItem","tagIcon":"icon-ym icon-ym-generator-select","propsName":"","tag":"JnpfSelect","regList":[],"span":8},"options":[{"fullName":"启用","id":"1"},{"fullName":"不启用","id":"2"}],"__vModel__":"postStatus","style":{"width":"100%"},"disabled":false,"interfaceHasPage":false,"id":"postStatus","placeholder":"请选择","on":{"change":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"}},{"maxlength":null,"fullName":"岗位备注","type":"textarea","autoSize":{"minRows":4,"maxRows":4},"__config__":{"formId":105,"visibility":["pc","app"],"jnpfKey":"textarea","noShow":false,"tipLabel":"","dragDisabled":false,"className":[],"label":"岗位备注","trigger":"blur","showLabel":true,"required":false,"tableName":"yys_post","renderKey":1722837540972,"layout":"colFormItem","tagIcon":"icon-ym icon-ym-generator-textarea","tag":"JnpfTextarea","regList":[],"span":24},"readonly":false,"showWordLimit":true,"__vModel__":"reamrk","style":{"width":"100%"},"disabled":false,"id":"reamrk","placeholder":"请输入","on":{"change":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}","blur":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"}}]
|
||||
export default superQueryJson
|
Loading…
Reference in new issue