feat: There is no way the, 自动发起企标复审 自动存入草稿
This commit is contained in:
@@ -203,6 +203,11 @@
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.8.6</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.ydw.bat.wkflow.business_main.datas.dto.WG.NewsFeed;
|
||||
import com.ydw.bat.wkflow.business_main.datas.dto.WG.ProductDeptIssue;
|
||||
import com.ydw.bat.wkflow.business_main.datas.dto.WG.WgWorkGroupShowDTO;
|
||||
import com.ydw.bat.wkflow.business_main.datas.entity.*;
|
||||
import com.ydw.bat.wkflow.business_main.datas.entity.standState.ModelData;
|
||||
import com.ydw.bat.wkflow.business_slrs.dao.*;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
@@ -31,6 +32,16 @@ public interface LawsUserInfoService {
|
||||
@GetMapping("sys/org/getOrgByUserId")
|
||||
public ResponseMessage<String> getOrgByUserId(@RequestParam("userId") String userId);
|
||||
|
||||
/**
|
||||
* 废止(企标复审)
|
||||
* @param
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/lawss/sarBussionessStandState/getSarBussionessStandStateProcessList")
|
||||
public List<ModelData> getSarBussionessStandStateProcessList(SarBussionessStandStatePage page);
|
||||
|
||||
|
||||
/**
|
||||
* 废止(企标复审)
|
||||
* @param
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.ydw.bat.wkflow.business_main.datas.controller;
|
||||
|
||||
|
||||
import com.ydw.bat.wkflow.business_main.datas.entity.TbTask;
|
||||
import com.ydw.bat.wkflow.business_main.datas.service.ITbTaskService;
|
||||
import com.ydw.bat.wkflow.config.SchedulerConf;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 动态定时任务表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author super_liu
|
||||
* @since 2022-05-27
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "动态定时任务表")
|
||||
@RequestMapping("/tsTask")
|
||||
public class TbTaskController{
|
||||
|
||||
@Autowired
|
||||
private SchedulerConf schedulerConf;
|
||||
|
||||
@Autowired
|
||||
private ITbTaskService iTbTaskService;
|
||||
|
||||
/**
|
||||
* 启动一个动态定时任务
|
||||
* http://localhost:10085/tbTask/start/2
|
||||
*/
|
||||
@GetMapping("start/{taskId}")
|
||||
public String start(@PathVariable("taskId") String taskId){
|
||||
schedulerConf.start(taskId);
|
||||
return "操作成功";
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止一个动态定时任务
|
||||
* http://localhost:10085/tbTask/stop/2
|
||||
*/
|
||||
@GetMapping("stop/{taskId}")
|
||||
public String stop(@PathVariable("taskId") String taskId){
|
||||
schedulerConf.stop(taskId);
|
||||
return "操作成功";
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新一个动态定时任务
|
||||
* http://localhost:10085/tbTask/save?taskId=2&taskExp=0/2 * * * * ?&taskClass=cn.huanzi.qch.springboottimer.task.MyRunnable3
|
||||
*/
|
||||
@PostMapping("save")
|
||||
public String save(TbTask task) throws IllegalAccessException {
|
||||
//先更新表数据
|
||||
TbTask tbTask = iTbTaskService.getById(task.getId());
|
||||
|
||||
//null值忽略
|
||||
List<String> ignoreProperties = new ArrayList<>(7);
|
||||
|
||||
//反射获取Class的属性(Field表示类中的成员变量)
|
||||
for (Field field : task.getClass().getDeclaredFields()) {
|
||||
//获取授权
|
||||
field.setAccessible(true);
|
||||
//属性名称
|
||||
String fieldName = field.getName();
|
||||
//属性的值
|
||||
Object fieldValue = field.get(task);
|
||||
|
||||
//找出值为空的属性,我们复制的时候不进行赋值
|
||||
if(null == fieldValue){
|
||||
ignoreProperties.add(fieldName);
|
||||
}
|
||||
}
|
||||
|
||||
//org.springframework.beans BeanUtils.copyProperties(A,B):A中的值付给B
|
||||
BeanUtils.copyProperties(task, tbTask,ignoreProperties.toArray(new String[0]));
|
||||
iTbTaskService.updateById(tbTask);
|
||||
schedulerConf.tasks.clear();
|
||||
|
||||
//停止旧任务
|
||||
schedulerConf.stop(tbTask.getId());
|
||||
|
||||
//重新启动
|
||||
schedulerConf.start(tbTask.getId());
|
||||
return "操作成功";
|
||||
}
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
package com.ydw.bat.wkflow.business_main.datas.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 企业标准信息复审表
|
||||
* </p>
|
||||
*
|
||||
* @author super_liu
|
||||
* @since 2022-01-23
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value="SarBussionessStandStatePage对象", description="企业标准信息复审表分页")
|
||||
public class SarBussionessStandStatePage{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "主键/企业标准信息主键")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "企标ID")
|
||||
private String standId;
|
||||
|
||||
@ApiModelProperty(value = "名称")
|
||||
private String standName;
|
||||
|
||||
@ApiModelProperty(value = "企标编号")
|
||||
private String standCode;
|
||||
|
||||
@ApiModelProperty(value = "复审时间")
|
||||
private Date reviewTime;
|
||||
|
||||
@ApiModelProperty(value = "发布日期")
|
||||
private Date issueTime;
|
||||
|
||||
@ApiModelProperty(value = "复审结果 1 修订、2 废止、3 继续有效")
|
||||
private Integer reviewResults;
|
||||
|
||||
@ApiModelProperty(value = "复审关联流程编号")
|
||||
private String reviewProcessNum;
|
||||
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private Date creationTime;
|
||||
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private Date modifyTime;
|
||||
|
||||
private Integer validFlag;
|
||||
|
||||
@ApiModelProperty(value = "参数1")
|
||||
private Integer param1;
|
||||
|
||||
@ApiModelProperty(value = "参数2")
|
||||
private String param2;
|
||||
|
||||
private String reviewTimeStart;
|
||||
private String reviewTimeEnd;
|
||||
|
||||
private String issueTimeStart;
|
||||
private String issueTimeEnd;
|
||||
|
||||
private String QCDW;
|
||||
private String QCRBUSS;
|
||||
private String standSort;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.ydw.bat.wkflow.business_main.datas.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 动态定时任务表
|
||||
* </p>
|
||||
*
|
||||
* @author super_liu
|
||||
* @since 2022-05-27
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="TbTask对象", description="动态定时任务表")
|
||||
public class TbTask implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "定时任务id")
|
||||
@TableId("ID")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "定时任务名称")
|
||||
private String taskName;
|
||||
|
||||
@ApiModelProperty(value = "定时任务描述")
|
||||
private String taskDesc;
|
||||
|
||||
@ApiModelProperty(value = "定时任务Cron表达式")
|
||||
private String taskExp;
|
||||
|
||||
@ApiModelProperty(value = "定时任务状态,0停用 1启用")
|
||||
private Integer taskStatus;
|
||||
|
||||
@ApiModelProperty(value = "定时任务的Runnable任务类完整路径")
|
||||
private String taskClass;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
private Date createTime;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Copyright 2022 bejson.com
|
||||
*/
|
||||
package com.ydw.bat.wkflow.business_main.datas.entity.standState;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Auto-generated: 2022-06-23 15:31:2
|
||||
*
|
||||
* @author bejson.com (i@bejson.com)
|
||||
* @website http://www.bejson.com/java2pojo/
|
||||
*/
|
||||
@Data
|
||||
public class ModelData {
|
||||
|
||||
private String id;
|
||||
private String standId;
|
||||
private String standName;
|
||||
private String standCode;
|
||||
private Date reviewTime;
|
||||
private Date issueTime;
|
||||
private String reviewResults;
|
||||
private String reviewProcessNum;
|
||||
private Date creationTime;
|
||||
private Date modifyTime;
|
||||
private int validFlag;
|
||||
private String param1;
|
||||
private String param2;
|
||||
private Date putTime;
|
||||
private String standSort;
|
||||
private String qcdw;
|
||||
private String fsrqbuss;
|
||||
private String qcrbuss;
|
||||
private String processStatus;
|
||||
private String bussFsSubUser1;
|
||||
private String bussFsSubUser1Name;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
/**
|
||||
* Copyright 2022 bejson.com
|
||||
*/
|
||||
package com.ydw.bat.wkflow.business_main.datas.entity.standState;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Auto-generated: 2022-06-23 15:31:2
|
||||
*
|
||||
* @author bejson.com (i@bejson.com)
|
||||
* @website http://www.bejson.com/java2pojo/
|
||||
*/
|
||||
public class QbfsForm {
|
||||
|
||||
private List<ModelData> modelData;
|
||||
private String entNumber= "";
|
||||
private String cnName= "";
|
||||
private String enName= "";
|
||||
private String entCategory= "";
|
||||
private String replaceNumber= "";
|
||||
private String replacedNumber= "";
|
||||
private String releaseDate= "";
|
||||
private String implementDate= "";
|
||||
private String reviewDate= "";
|
||||
public void setModelData(List<ModelData> modelData) {
|
||||
this.modelData = modelData;
|
||||
}
|
||||
public List<ModelData> getModelData() {
|
||||
return modelData;
|
||||
}
|
||||
|
||||
public void setEntNumber(String entNumber) {
|
||||
this.entNumber = entNumber;
|
||||
}
|
||||
public String getEntNumber() {
|
||||
return entNumber;
|
||||
}
|
||||
|
||||
public void setCnName(String cnName) {
|
||||
this.cnName = cnName;
|
||||
}
|
||||
public String getCnName() {
|
||||
return cnName;
|
||||
}
|
||||
|
||||
public void setEnName(String enName) {
|
||||
this.enName = enName;
|
||||
}
|
||||
public String getEnName() {
|
||||
return enName;
|
||||
}
|
||||
|
||||
public void setEntCategory(String entCategory) {
|
||||
this.entCategory = entCategory;
|
||||
}
|
||||
public String getEntCategory() {
|
||||
return entCategory;
|
||||
}
|
||||
|
||||
public void setReplaceNumber(String replaceNumber) {
|
||||
this.replaceNumber = replaceNumber;
|
||||
}
|
||||
public String getReplaceNumber() {
|
||||
return replaceNumber;
|
||||
}
|
||||
|
||||
public void setReplacedNumber(String replacedNumber) {
|
||||
this.replacedNumber = replacedNumber;
|
||||
}
|
||||
public String getReplacedNumber() {
|
||||
return replacedNumber;
|
||||
}
|
||||
|
||||
public void setReleaseDate(String releaseDate) {
|
||||
this.releaseDate = releaseDate;
|
||||
}
|
||||
public String getReleaseDate() {
|
||||
return releaseDate;
|
||||
}
|
||||
|
||||
public void setImplementDate(String implementDate) {
|
||||
this.implementDate = implementDate;
|
||||
}
|
||||
public String getImplementDate() {
|
||||
return implementDate;
|
||||
}
|
||||
|
||||
public void setReviewDate(String reviewDate) {
|
||||
this.reviewDate = reviewDate;
|
||||
}
|
||||
public String getReviewDate() {
|
||||
return reviewDate;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
/**
|
||||
* Copyright 2022 bejson.com
|
||||
*/
|
||||
package com.ydw.bat.wkflow.business_main.datas.entity.standState;
|
||||
|
||||
/**
|
||||
* Auto-generated: 2022-06-23 15:31:2
|
||||
*
|
||||
* @author bejson.com (i@bejson.com)
|
||||
* @website http://www.bejson.com/java2pojo/
|
||||
*/
|
||||
public class RoleForm {
|
||||
|
||||
private String prcCreateUserName = "";
|
||||
private String prcCreateUser= "";
|
||||
private String dockUser= "";
|
||||
private String dockUserName= "";
|
||||
private String bussFsSubUser2= "";
|
||||
private String bussFsSubUser2Name= "";
|
||||
private String bussFsUser2= "";
|
||||
private String bussFsUser2Name= "";
|
||||
private String bussFsUserC2= "";
|
||||
private String bussFsUserC2Name= "";
|
||||
private String bussFsUser3= "";
|
||||
private String bussFsUser3Name= "";
|
||||
public void setPrcCreateUserName(String prcCreateUserName) {
|
||||
this.prcCreateUserName = prcCreateUserName;
|
||||
}
|
||||
public String getPrcCreateUserName() {
|
||||
return prcCreateUserName;
|
||||
}
|
||||
|
||||
public void setPrcCreateUser(String prcCreateUser) {
|
||||
this.prcCreateUser = prcCreateUser;
|
||||
}
|
||||
public String getPrcCreateUser() {
|
||||
return prcCreateUser;
|
||||
}
|
||||
|
||||
public void setDockUser(String dockUser) {
|
||||
this.dockUser = dockUser;
|
||||
}
|
||||
public String getDockUser() {
|
||||
return dockUser;
|
||||
}
|
||||
|
||||
public void setDockUserName(String dockUserName) {
|
||||
this.dockUserName = dockUserName;
|
||||
}
|
||||
public String getDockUserName() {
|
||||
return dockUserName;
|
||||
}
|
||||
|
||||
public void setBussFsSubUser2(String bussFsSubUser2) {
|
||||
this.bussFsSubUser2 = bussFsSubUser2;
|
||||
}
|
||||
public String getBussFsSubUser2() {
|
||||
return bussFsSubUser2;
|
||||
}
|
||||
|
||||
public void setBussFsSubUser2Name(String bussFsSubUser2Name) {
|
||||
this.bussFsSubUser2Name = bussFsSubUser2Name;
|
||||
}
|
||||
public String getBussFsSubUser2Name() {
|
||||
return bussFsSubUser2Name;
|
||||
}
|
||||
|
||||
public void setBussFsUser2(String bussFsUser2) {
|
||||
this.bussFsUser2 = bussFsUser2;
|
||||
}
|
||||
public String getBussFsUser2() {
|
||||
return bussFsUser2;
|
||||
}
|
||||
|
||||
public void setBussFsUser2Name(String bussFsUser2Name) {
|
||||
this.bussFsUser2Name = bussFsUser2Name;
|
||||
}
|
||||
public String getBussFsUser2Name() {
|
||||
return bussFsUser2Name;
|
||||
}
|
||||
|
||||
public void setBussFsUserC2(String bussFsUserC2) {
|
||||
this.bussFsUserC2 = bussFsUserC2;
|
||||
}
|
||||
public String getBussFsUserC2() {
|
||||
return bussFsUserC2;
|
||||
}
|
||||
|
||||
public void setBussFsUserC2Name(String bussFsUserC2Name) {
|
||||
this.bussFsUserC2Name = bussFsUserC2Name;
|
||||
}
|
||||
public String getBussFsUserC2Name() {
|
||||
return bussFsUserC2Name;
|
||||
}
|
||||
|
||||
public void setBussFsUser3(String bussFsUser3) {
|
||||
this.bussFsUser3 = bussFsUser3;
|
||||
}
|
||||
public String getBussFsUser3() {
|
||||
return bussFsUser3;
|
||||
}
|
||||
|
||||
public void setBussFsUser3Name(String bussFsUser3Name) {
|
||||
this.bussFsUser3Name = bussFsUser3Name;
|
||||
}
|
||||
public String getBussFsUser3Name() {
|
||||
return bussFsUser3Name;
|
||||
}
|
||||
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* Copyright 2022 bejson.com
|
||||
*/
|
||||
package com.ydw.bat.wkflow.business_main.datas.entity.standState;
|
||||
|
||||
/**
|
||||
* Auto-generated: 2022-06-23 15:31:2
|
||||
*
|
||||
* @author bejson.com (i@bejson.com)
|
||||
* @website http://www.bejson.com/java2pojo/
|
||||
*/
|
||||
public class StandStateDraft {
|
||||
|
||||
private String taskInfo="起草";
|
||||
private RoleForm roleForm;
|
||||
private QbfsForm qbfsForm;
|
||||
private String commentText= "";
|
||||
public void setTaskInfo(String taskInfo) {
|
||||
this.taskInfo = taskInfo;
|
||||
}
|
||||
public String getTaskInfo() {
|
||||
return taskInfo;
|
||||
}
|
||||
|
||||
public void setRoleForm(RoleForm roleForm) {
|
||||
this.roleForm = roleForm;
|
||||
}
|
||||
public RoleForm getRoleForm() {
|
||||
return roleForm;
|
||||
}
|
||||
|
||||
public void setQbfsForm(QbfsForm qbfsForm) {
|
||||
this.qbfsForm = qbfsForm;
|
||||
}
|
||||
public QbfsForm getQbfsForm() {
|
||||
return qbfsForm;
|
||||
}
|
||||
|
||||
public void setCommentText(String commentText) {
|
||||
this.commentText = commentText;
|
||||
}
|
||||
public String getCommentText() {
|
||||
return commentText;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.ydw.bat.wkflow.business_main.datas.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ydw.bat.wkflow.business_main.datas.entity.TbTask;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 动态定时任务表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author super_liu
|
||||
* @since 2022-05-27
|
||||
*/
|
||||
@Repository
|
||||
public interface TbTaskMapper extends BaseMapper<TbTask> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.ydw.bat.wkflow.business_main.datas.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ydw.bat.wkflow.business_main.datas.entity.TbTask;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 动态定时任务表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author super_liu
|
||||
* @since 2022-05-27
|
||||
*/
|
||||
public interface ITbTaskService extends IService<TbTask> {
|
||||
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.ydw.bat.wkflow.business_main.datas.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ydw.bat.wkflow.business_main.datas.entity.TbTask;
|
||||
import com.ydw.bat.wkflow.business_main.datas.mapper.TbTaskMapper;
|
||||
import com.ydw.bat.wkflow.business_main.datas.service.ITbTaskService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 动态定时任务表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author super_liu
|
||||
* @since 2022-05-27
|
||||
*/
|
||||
@Service
|
||||
public class TbTaskServiceImpl extends ServiceImpl<TbTaskMapper, TbTask> implements ITbTaskService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.ydw.bat.wkflow.config;
|
||||
|
||||
/**
|
||||
* @Description: TODO
|
||||
* @author: super_liu
|
||||
* @date: 2022年05月27日 14:26
|
||||
*/
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class GetBeanUtil implements ApplicationContextAware {
|
||||
private static ApplicationContext applicationContext;
|
||||
|
||||
public void setApplicationContext(ApplicationContext context) {
|
||||
GetBeanUtil.applicationContext = context;
|
||||
}
|
||||
|
||||
public static Object getBean(String name) {
|
||||
return applicationContext.getBean(name);
|
||||
}
|
||||
|
||||
public static ApplicationContext getApplicationContext() {
|
||||
return applicationContext;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.ydw.bat.wkflow.config;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.ydw.bat.wkflow.business_auth.LawsUserInfoService;
|
||||
import com.ydw.bat.wkflow.business_main.datas.entity.*;
|
||||
import com.ydw.bat.wkflow.business_main.datas.entity.standState.ModelData;
|
||||
import com.ydw.bat.wkflow.business_main.datas.entity.standState.QbfsForm;
|
||||
import com.ydw.bat.wkflow.business_main.datas.entity.standState.RoleForm;
|
||||
import com.ydw.bat.wkflow.business_main.datas.entity.standState.StandStateDraft;
|
||||
import com.ydw.bat.wkflow.business_main.datas.service.IBusProcessNameService;
|
||||
import com.ydw.bat.wkflow.business_main.datas.service.IOaTaskExecService;
|
||||
import com.ydw.bat.wkflow.business_mq.service.CreateMQService;
|
||||
import com.ydw.bat.wkflow.business_oa.webService.service.WebServiceOAService;
|
||||
import com.ydw.bat.wkflow.util.SpringContextUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.activiti.engine.HistoryService;
|
||||
import org.activiti.engine.TaskService;
|
||||
import org.activiti.engine.history.HistoricTaskInstance;
|
||||
import org.activiti.engine.history.HistoricTaskInstanceQuery;
|
||||
import org.activiti.engine.task.Task;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Slf4j
|
||||
public class ScheduledJobStandState implements Runnable {
|
||||
|
||||
Logger logger = LoggerFactory.getLogger(ScheduledJobStandState.class);
|
||||
|
||||
/**
|
||||
* 根据配置文件设置是否开启定时器
|
||||
*
|
||||
*/
|
||||
|
||||
private LawsUserInfoService lawsUserInfoService;
|
||||
|
||||
private IBusProcessNameService iBusProcessNameService;
|
||||
|
||||
@Value("${isNotScheduled}")
|
||||
private boolean isNotScheduled; //是否开启定时器
|
||||
|
||||
|
||||
public ScheduledJobStandState(){
|
||||
lawsUserInfoService = GetBeanUtil.getApplicationContext().getBean(LawsUserInfoService.class);
|
||||
iBusProcessNameService = GetBeanUtil.getApplicationContext().getBean(IBusProcessNameService.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
/**
|
||||
* 创建草稿参数 buss3 复审流程
|
||||
* id:
|
||||
* createUser:
|
||||
* createUserName:
|
||||
* prcType: buss3
|
||||
* json:
|
||||
*/
|
||||
try{
|
||||
Thread.sleep(2000);
|
||||
logger.info("每天0点1分执行 自动发起复审流程自动存入草稿:"+Thread.currentThread().getName() + " cron=0 1 0 * * ? --- " + new Date()+"---START-01");
|
||||
|
||||
StandStateDraft standStateDraft = new StandStateDraft();
|
||||
RoleForm roleForm = new RoleForm();
|
||||
QbfsForm qbfsForm = new QbfsForm();
|
||||
SarBussionessStandStatePage page = new SarBussionessStandStatePage();
|
||||
List<ModelData> modelDataList = lawsUserInfoService.getSarBussionessStandStateProcessList(page);
|
||||
qbfsForm.setModelData(modelDataList);
|
||||
standStateDraft.setQbfsForm(qbfsForm);
|
||||
standStateDraft.setRoleForm(roleForm);
|
||||
String json = toJson(standStateDraft);
|
||||
System.out.println(json);
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String time = sdf.format(new Date());
|
||||
BusProcessName busProcessName = new BusProcessName();
|
||||
busProcessName.setPrcType("buss3");
|
||||
busProcessName.setCreatUser("chenchunmei");
|
||||
busProcessName.setCreatTime(time);
|
||||
busProcessName.setMes(json);
|
||||
busProcessName.setCreatUserName("陈春梅");
|
||||
iBusProcessNameService.save(busProcessName);
|
||||
|
||||
logger.info("每天0点1分执行 自动发起复审流程自动存入草稿:"+Thread.currentThread().getName() + " cron=0 1 0 * * ? --- " + new Date()+"---End-01");
|
||||
}catch(Exception e){
|
||||
logger.info(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static String toJson(StandStateDraft standStateDraft){
|
||||
GsonBuilder gsonBuilder = getGsonBuilder();
|
||||
Gson json = gsonBuilder.create();
|
||||
return json.toJson(standStateDraft);
|
||||
}
|
||||
|
||||
private static GsonBuilder getGsonBuilder() {
|
||||
return new GsonBuilder().disableHtmlEscaping().serializeNulls().enableComplexMapKeySerialization().serializeSpecialFloatingPointValues().setLenient();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package com.ydw.bat.wkflow.config;
|
||||
|
||||
/**
|
||||
* @Description: TODO
|
||||
* @author: super_liu
|
||||
* @date: 2022年05月27日 10:17
|
||||
*/
|
||||
|
||||
import com.ydw.bat.wkflow.business_main.datas.entity.TbTask;
|
||||
import com.ydw.bat.wkflow.business_main.datas.mapper.TbTaskMapper;
|
||||
import com.ydw.bat.wkflow.business_main.datas.service.ITbTaskService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
||||
import org.springframework.scheduling.support.CronTrigger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
|
||||
/**
|
||||
* 动态定时器
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class SchedulerConf {
|
||||
|
||||
//数据库的任务
|
||||
public static ConcurrentHashMap<String, TbTask> tasks = new ConcurrentHashMap<>(50);
|
||||
|
||||
//正在运行的任务
|
||||
public static ConcurrentHashMap<String, ScheduledFuture> runTasks = new ConcurrentHashMap<>(50);
|
||||
|
||||
//线程池任务调度
|
||||
private ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
|
||||
|
||||
@Autowired
|
||||
TbTaskMapper tbTaskDao;
|
||||
|
||||
@Autowired
|
||||
ITbTaskService iTbTaskService;
|
||||
|
||||
/**
|
||||
* 初始化线程池任务调度
|
||||
*/
|
||||
@Autowired
|
||||
public SchedulerConf(){
|
||||
this.threadPoolTaskScheduler.setPoolSize(50);
|
||||
this.threadPoolTaskScheduler.setThreadNamePrefix("task-thread-");
|
||||
this.threadPoolTaskScheduler.setWaitForTasksToCompleteOnShutdown(true);
|
||||
this.threadPoolTaskScheduler.initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有数据库里的定时任务
|
||||
*/
|
||||
private void getAllTbTask(){
|
||||
//查询所有,并put到tasks
|
||||
SchedulerConf.tasks.clear();
|
||||
List<TbTask> list = iTbTaskService.list();
|
||||
list.forEach((task)-> SchedulerConf.tasks.put(task.getId(),task));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据定时任务id,启动定时任务
|
||||
*/
|
||||
public void start(String taskId){
|
||||
try {
|
||||
//重新获取最新执行任务周期
|
||||
this.getAllTbTask();
|
||||
|
||||
TbTask tbTask = SchedulerConf.tasks.get(taskId);
|
||||
|
||||
//获取并实例化Runnable任务类
|
||||
Class<?> clazz = Class.forName(tbTask.getTaskClass());
|
||||
Runnable runnable = (Runnable)clazz.newInstance();
|
||||
|
||||
//Cron表达式
|
||||
CronTrigger cron = new CronTrigger(tbTask.getTaskExp());
|
||||
|
||||
//执行,并put到runTasks
|
||||
SchedulerConf.runTasks.put(taskId, Objects.requireNonNull(this.threadPoolTaskScheduler.schedule(runnable, cron)));
|
||||
|
||||
this.updateTaskStatus(taskId,1);
|
||||
|
||||
log.info("{},任务启动!",taskId);
|
||||
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
|
||||
log.error("{},任务启动失败...",taskId);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据定时任务id,停止定时任务
|
||||
*/
|
||||
public void stop(String taskId){
|
||||
SchedulerConf.runTasks.get(taskId).cancel(true);
|
||||
|
||||
SchedulerConf.runTasks.remove(taskId);
|
||||
|
||||
this.updateTaskStatus(taskId,0);
|
||||
|
||||
log.info("{},任务停止...",taskId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新数据库动态定时任务状态
|
||||
*/
|
||||
private void updateTaskStatus(String taskId,int status){
|
||||
TbTask task = iTbTaskService.getById(taskId);
|
||||
task.setTaskStatus(status);
|
||||
task.setUpdateTime(new Date());
|
||||
iTbTaskService.updateById(task);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user