Browse Source

1、为定时任务项目新增可视化页面

liutielin 3 years ago
parent
commit
2bf87a2b9a

+ 1 - 0
src/main/java/com/up/sell/interceptor/SchedulerAspect.java

@@ -24,6 +24,7 @@ public class SchedulerAspect implements Ordered {
 	@Around("@annotation(com.up.sell.annotation.SchedulerSwith)")
 	public void schedulerSwitch(ProceedingJoinPoint pjp) throws Throwable {
 		String methodName = pjp.getSignature().getName();
+		logger.info("methodName : "+methodName);
 		SchedulerSwitch schedSwitch = schedulerSwitchService.selectOneByMethodName(methodName);
 		if(schedSwitch == null || schedSwitch.getStatus() == 0) {
 			logger.info("方法被阻止运行……");

+ 20 - 0
src/main/java/com/up/sell/vo/SchedulerSwitch.java

@@ -7,6 +7,10 @@ public class SchedulerSwitch {
 	private int id;
 	//任务名称
 	private String name;
+	//方法名称
+	private String methodName;
+	//备注
+	private String remarks;
 	//任务运行状态
 	private int status;
 
@@ -73,6 +77,22 @@ public class SchedulerSwitch {
 	public void setUpdateUser(int updateUser) {
 		this.updateUser = updateUser;
 	}
+
+	public String getMethodName() {
+		return methodName;
+	}
+
+	public void setMethodName(String methodName) {
+		this.methodName = methodName;
+	}
+
+	public String getRemarks() {
+		return remarks;
+	}
+
+	public void setRemarks(String remarks) {
+		this.remarks = remarks;
+	}
 	
 	
 }

+ 3 - 1
src/main/resources/configs/mybatis/xml/SchedulerSwitchMapper.xml

@@ -5,13 +5,15 @@
   <resultMap id="BaseResultMap" type="com.up.sell.vo.SchedulerSwitch">
   	<id column="id" jdbcType="INTEGER" property="id"/>
   	<result column="name" jdbcType="VARCHAR" property="name" />
+  	<result column="method_name" jdbcType="VARCHAR" property="methodName" />
   	<result column="status" jdbcType="INTEGER" property="status" />
+  	<result column="remarks" jdbcType="VARCHAR" property="remarks" />
   	<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
 	<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />  	
   </resultMap>
   
   <sql id="base_column_list">
-  	id,name,status,create_time,update_time
+  	id,name,method_name,status,remarks,create_time,update_time
   </sql>
   
   <select id="selectOneByFiled" resultMap="BaseResultMap">

+ 8 - 14
src/main/resources/templates/list.html

@@ -53,20 +53,10 @@
 			            field: 'name',
 			            title: '任务名称',
 			        },
-			       /*  {
-			        		field: 'status',
-			            title: '任务状态',
-			            formatter: function(value,row,index){
-			            		if(row.status == 0){
-			            			return "已停止";
-			            		}else if(row.status == 1){
-			            			return "远行中";
-			            		}else{
-			            			return "异常状态";
-			            		}
-			            }
-			        }, */
-			       
+			        {
+			        		field: 'methodName',
+			        		title: '方法名称',
+			        },
 			        {
 			            field: 'status',
 			            title: '状态',
@@ -91,6 +81,10 @@
 									return a;
 								}
 						}
+			        },
+			        {
+			        		field: 'remarks',
+			        		title: '备注',
 			        },]
 		    };
 		    $.table.init(options);