├── quartz.sql ├── src └── main │ ├── webapp │ ├── media │ │ ├── img │ │ │ ├── portlet-expand-icon.png │ │ │ ├── portlet-collapse-icon.png │ │ │ ├── portlet-expand-icon-white.png │ │ │ └── portlet-collapse-icon-white.png │ │ ├── js │ │ │ ├── script.js │ │ │ └── jquery.infieldlabel.min.js │ │ └── css │ │ │ ├── detail.css │ │ │ ├── css.css │ │ │ └── default.css │ ├── page │ │ ├── public │ │ │ ├── footer.jsp │ │ │ ├── csslib.jsp │ │ │ └── taglib.jsp │ │ ├── taskErrorsDetail.jsp │ │ ├── quartzDetail.jsp │ │ ├── taskRecordsList.jsp │ │ ├── quartzList.jsp │ │ └── quartzEdit.jsp │ ├── index.jsp │ ├── WEB-INF │ │ └── web.xml │ └── js │ │ └── page.js │ ├── java │ └── com │ │ └── zhongxin │ │ └── quartz │ │ ├── controller │ │ ├── BaseController.java │ │ ├── TaskErrorsController.java │ │ ├── TaskRecordsController.java │ │ └── SchedulerController.java │ │ ├── service │ │ ├── NoticeService.java │ │ ├── TaskErrorsService.java │ │ ├── TaskRecordsService.java │ │ ├── impl │ │ │ ├── TaskErrorsServiceImpl.java │ │ │ ├── TaskRecordsServiceImpl.java │ │ │ ├── NoticeServiceImpl.java │ │ │ └── QuartzServiceImpl.java │ │ └── QuartzService.java │ │ ├── enums │ │ ├── StatusEnum.java │ │ └── TaskStatusEnum.java │ │ ├── util │ │ ├── Const.java │ │ ├── ExceptionUtils.java │ │ ├── SpringContext.java │ │ ├── PageParam.java │ │ ├── JmsClient.java │ │ ├── Page.java │ │ ├── DateUtil.java │ │ ├── HttpClientUtil.java │ │ └── DateUtils.java │ │ ├── dao │ │ ├── TaskErrorsDao.java │ │ ├── BaseDao.java │ │ ├── TaskRecordsDao.java │ │ ├── TaskInformationsDao.java │ │ └── impl │ │ │ ├── TaskErrorsDaoImpl.java │ │ │ ├── TaskInformationsDaoImpl.java │ │ │ └── TaskRecordsDaoImpl.java │ │ ├── entity │ │ ├── Entity.java │ │ ├── TaskErrorsEntity.java │ │ ├── TaskRecordsEntity.java │ │ └── TaskInformationsEntity.java │ │ ├── core │ │ ├── DynamicJobAssembler.java │ │ └── QuartzJobFactory.java │ │ ├── listener │ │ └── TaskReturnListener.java │ │ └── vo │ │ ├── TaskInformationsVo.java │ │ └── TaskInformationsDetailVo.java │ └── resources │ ├── runtimecfg │ └── zx-config.properties │ ├── mybatis │ ├── mybatis-config.xml │ └── mapper │ │ ├── TaskErrorsMapper.xml │ │ ├── TaskRecordsMapper.xml │ │ └── TaskInformationsMapper.xml │ ├── log4j.properties │ └── spring │ ├── spring-mvc.xml │ ├── spring-quartz-dao.xml │ └── spring-quartz-activemq.xml ├── README.md ├── quartz-test ├── .gitignore ├── src │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── demo │ │ │ └── QuartzTestApplicationTests.java │ └── main │ │ ├── resources │ │ └── application.properties │ │ └── java │ │ └── com │ │ └── example │ │ └── demo │ │ ├── QuartzTestApplication.java │ │ └── Consumer.java └── pom.xml ├── .gitignore └── pom.xml /quartz.sql: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiaozg/zx-quartz/HEAD/quartz.sql -------------------------------------------------------------------------------- /src/main/webapp/media/img/portlet-expand-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiaozg/zx-quartz/HEAD/src/main/webapp/media/img/portlet-expand-icon.png -------------------------------------------------------------------------------- /src/main/webapp/media/img/portlet-collapse-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiaozg/zx-quartz/HEAD/src/main/webapp/media/img/portlet-collapse-icon.png -------------------------------------------------------------------------------- /src/main/webapp/media/img/portlet-expand-icon-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiaozg/zx-quartz/HEAD/src/main/webapp/media/img/portlet-expand-icon-white.png -------------------------------------------------------------------------------- /src/main/webapp/media/img/portlet-collapse-icon-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiaozg/zx-quartz/HEAD/src/main/webapp/media/img/portlet-collapse-icon-white.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # zx-quartz 2 | 分布式定时任务调度系统 3 | 4 | 需要先安装activemq 5 | 6 | 通过maven的tomcat插件可以直接运行mvn clean install tomcat7:run 7 | 8 | 9 | 在浏览器中输入 http://localhost:8080/ 访问 10 | 11 | -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/controller/BaseController.java: -------------------------------------------------------------------------------- 1 | package com.zhongxin.quartz.controller; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | 6 | public class BaseController { 7 | 8 | protected Logger logger =LoggerFactory.getLogger(this.getClass()); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/service/NoticeService.java: -------------------------------------------------------------------------------- 1 | package com.zhongxin.quartz.service; 2 | 3 | public interface NoticeService { 4 | 5 | public void sendMQmsg(String targetBeanId,String executorNo,String executeParamter); 6 | 7 | public void httpRequest(String url,String executeParamter); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/enums/StatusEnum.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright: Copyright (c)2014 3 | * Company: 支付通(ICardPay) 4 | */ 5 | package com.zhongxin.quartz.enums; 6 | 7 | /** 8 | * @author:eddysheng 9 | * @since:2014-3-7 下午6:16:18 10 | * @version: 11 | */ 12 | public enum StatusEnum { 13 | 14 | INIT,SUCCESS,FAILED; 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/enums/TaskStatusEnum.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright: Copyright (c)2014 3 | * Company: 支付通(ICardPay) 4 | */ 5 | package com.zhongxin.quartz.enums; 6 | 7 | /** 8 | * @author:eddysheng 9 | * @since:2014-3-7 下午2:53:29 10 | * @version: 11 | */ 12 | public enum TaskStatusEnum { 13 | 14 | INIT, FROZEN, UNFROZEN; 15 | } 16 | -------------------------------------------------------------------------------- /src/main/webapp/page/public/footer.jsp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/service/TaskErrorsService.java: -------------------------------------------------------------------------------- 1 | package com.zhongxin.quartz.service; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | import com.zhongxin.quartz.entity.TaskErrorsEntity; 7 | 8 | public interface TaskErrorsService { 9 | 10 | public List> getErrorsByRecordId(String recordId); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/util/Const.java: -------------------------------------------------------------------------------- 1 | package com.zhongxin.quartz.util; 2 | 3 | public class Const { 4 | 5 | public static String ACTIVE_MQ = "mq"; 6 | public static String URL_REQUEST = "http"; 7 | public static String SUCCESS = "success"; 8 | public static String FAILED = "failed"; 9 | public static String RELOAD = "reload"; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/webapp/page/public/csslib.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | -------------------------------------------------------------------------------- /quartz-test/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | 4 | ### STS ### 5 | .apt_generated 6 | .classpath 7 | .factorypath 8 | .project 9 | .settings 10 | .springBeans 11 | 12 | ### IntelliJ IDEA ### 13 | .idea 14 | *.iws 15 | *.iml 16 | *.ipr 17 | 18 | ### NetBeans ### 19 | nbproject/private/ 20 | build/ 21 | nbbuild/ 22 | dist/ 23 | nbdist/ 24 | .nb-gradle/ -------------------------------------------------------------------------------- /src/main/webapp/page/public/taglib.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 4 | 5 | <% 6 | response.setHeader("Pragma","No-Cache"); 7 | response.setHeader("Cache-Control","No-Cache"); 8 | response.setDateHeader("Expires", 0); 9 | %> -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/dao/TaskErrorsDao.java: -------------------------------------------------------------------------------- 1 | package com.zhongxin.quartz.dao; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | import com.zhongxin.quartz.entity.TaskErrorsEntity; 7 | 8 | public interface TaskErrorsDao { 9 | 10 | public void saveTaskErrors(TaskErrorsEntity taskErrorsEntity); 11 | 12 | public List> getErrorsByTaskExecuteRecordId(String recordId); 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/service/TaskRecordsService.java: -------------------------------------------------------------------------------- 1 | package com.zhongxin.quartz.service; 2 | 3 | import java.util.List; 4 | 5 | import com.zhongxin.quartz.entity.TaskRecordsEntity; 6 | 7 | public interface TaskRecordsService { 8 | 9 | public List getTaskRecordsByTaskNo(String taskNo,int currentPage,String taskStatus); 10 | 11 | public Integer getCountByTaskNo(String taskNo,String taskStatus); 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/entity/Entity.java: -------------------------------------------------------------------------------- 1 | package com.zhongxin.quartz.entity; 2 | 3 | import java.io.Serializable; 4 | 5 | import org.apache.commons.lang.builder.ToStringBuilder; 6 | 7 | public class Entity implements Serializable{ 8 | 9 | /** serialVersionUID*/ 10 | private static final long serialVersionUID = 1L; 11 | 12 | @Override 13 | public String toString() { 14 | return ToStringBuilder.reflectionToString(this); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /quartz-test/src/test/java/com/example/demo/QuartzTestApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.example.demo; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class QuartzTestApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /quartz-test/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=8088 2 | 3 | #如果为True,则是Topic;如果是false或者默认,则是queue 4 | spring.jms.pub-sub-domain=true 5 | 6 | #activemq 7 | spring.activemq.broker-url=failover:(tcp://localhost:61616)?randomize=false&nested.wireFormat.maxInactivityDuration=1000 8 | spring.activemq.user=admin 9 | spring.activemq.password=admin 10 | spring.activemq.pool.max-connections=5 11 | 12 | # 13 | quartz.topic.name=quartzTopic 14 | task.return.queue.name=taskReturnQueue 15 | -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/dao/BaseDao.java: -------------------------------------------------------------------------------- 1 | package com.zhongxin.quartz.dao; 2 | 3 | import javax.annotation.Resource; 4 | 5 | import org.mybatis.spring.SqlSessionTemplate; 6 | 7 | public class BaseDao { 8 | 9 | @Resource 10 | private SqlSessionTemplate sessionTemplate; 11 | 12 | protected SqlSessionTemplate getTemplate(){ 13 | return this.sessionTemplate; 14 | } 15 | 16 | public int getPageNum(int pageNum,int pageSize){ 17 | int num = pageSize*(pageNum-1); 18 | return num; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | 5 | ### STS ### 6 | .apt_generated 7 | .classpath 8 | .factorypath 9 | .project 10 | .settings 11 | .springBeans 12 | .DS_Store 13 | 14 | ### IntelliJ IDEA ### 15 | target 16 | .idea 17 | .mvn 18 | *.iws 19 | *.iml 20 | *.ipr 21 | mvnw 22 | .mvn 23 | mvnw.cmd 24 | .mvn/wrapper/maven-wrapper.properties 25 | .mvn/wrapper/maven-wrapper.jar 26 | 27 | ### NetBeans ### 28 | nbproject/private/ 29 | build/ 30 | nbbuild/ 31 | dist/ 32 | nbdist/ 33 | .nb-gradle/ 34 | -------------------------------------------------------------------------------- /src/main/resources/runtimecfg/zx-config.properties: -------------------------------------------------------------------------------- 1 | #activemq 2 | brokerUrl=failover:(tcp://localhost:61616)?randomize=false&nested.wireFormat.maxInactivityDuration=1000 3 | activemq.userName=admin 4 | activemq.password=admin 5 | pool.MaxConnections=5 6 | quartz.topic.name=quartzTopic 7 | task.return.queue.name=taskReturnQueue 8 | 9 | #config of mysql 10 | quartz.database.driverClassName = com.mysql.jdbc.Driver 11 | quartz.database.url = jdbc:mysql://localhost:3306/quartz?useUnicode=true&characterEncoding=utf-8 12 | quartz.database.username = admin 13 | quartz.database.password = admin 14 | -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/util/ExceptionUtils.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright: Copyright (c)2014 3 | * Company: 支付通(ICardPay) 4 | */ 5 | package com.zhongxin.quartz.util; 6 | 7 | import java.io.PrintWriter; 8 | import java.io.StringWriter; 9 | 10 | /** 11 | * @author:eddysheng 12 | * @since:2014-3-24 下午12:08:52 13 | * @version: 14 | */ 15 | public class ExceptionUtils { 16 | 17 | public static String getStackTrace(Throwable e) { 18 | String estr = null; 19 | StringWriter sw = new StringWriter(); 20 | PrintWriter pw = new PrintWriter(sw); 21 | try { 22 | e.printStackTrace(pw); 23 | estr = sw.toString(); 24 | } finally { 25 | pw.close(); 26 | } 27 | return estr; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/dao/TaskRecordsDao.java: -------------------------------------------------------------------------------- 1 | package com.zhongxin.quartz.dao; 2 | 3 | import java.util.List; 4 | 5 | import com.zhongxin.quartz.entity.TaskRecordsEntity; 6 | 7 | public interface TaskRecordsDao { 8 | 9 | public TaskRecordsEntity getRecordsByTaskNo(String taskNo,String timeKeyValue); 10 | 11 | public Long insert(TaskRecordsEntity taskRecordsEntity); 12 | 13 | public void updateById(TaskRecordsEntity recordsEntity); 14 | 15 | public TaskRecordsEntity selectByTaskNoAndStatus(String taskNo); 16 | 17 | public List getListByTaskNo(String taskNo,int currentPage,String taskStatus); 18 | 19 | public Integer getCountByTaskNo(String taskNo,String taskStatus); 20 | } 21 | -------------------------------------------------------------------------------- /quartz-test/src/main/java/com/example/demo/QuartzTestApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.demo; 2 | 3 | import org.apache.activemq.command.ActiveMQQueue; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.context.annotation.Bean; 7 | 8 | import javax.jms.Queue; 9 | 10 | @SpringBootApplication 11 | public class QuartzTestApplication { 12 | 13 | //处理完成业务逻辑后,向activemq的queue发送执行成功消息Consumer.java 14 | @Bean 15 | public Queue queue() { 16 | return new ActiveMQQueue("taskReturnQueue"); 17 | } 18 | 19 | public static void main(String[] args) { 20 | SpringApplication.run(QuartzTestApplication.class, args); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/service/impl/TaskErrorsServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.zhongxin.quartz.service.impl; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | import javax.annotation.Resource; 7 | 8 | import org.springframework.stereotype.Service; 9 | 10 | import com.zhongxin.quartz.dao.TaskErrorsDao; 11 | import com.zhongxin.quartz.entity.TaskErrorsEntity; 12 | import com.zhongxin.quartz.service.TaskErrorsService; 13 | @Service 14 | public class TaskErrorsServiceImpl implements TaskErrorsService{ 15 | 16 | @Resource 17 | private TaskErrorsDao errorsDao; 18 | 19 | public List> getErrorsByRecordId(String recordId){ 20 | return errorsDao.getErrorsByTaskExecuteRecordId(recordId); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/util/SpringContext.java: -------------------------------------------------------------------------------- 1 | package com.zhongxin.quartz.util; 2 | 3 | import org.springframework.beans.BeansException; 4 | import org.springframework.context.ApplicationContext; 5 | import org.springframework.context.ApplicationContextAware; 6 | import org.springframework.stereotype.Component; 7 | @Component 8 | public class SpringContext implements ApplicationContextAware { 9 | 10 | private static ApplicationContext context; 11 | 12 | public void setApplicationContext(ApplicationContext applicationcontext) 13 | throws BeansException { 14 | SpringContext.context = applicationcontext; 15 | } 16 | 17 | public static Object getBean(String beanName) { 18 | return context.getBean(beanName); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/webapp/index.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" isELIgnored="false" %> 3 | <%@include file="/page/public/taglib.jsp"%> 4 | 5 | 6 | 7 | 8 | 9 | 欢迎页 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 25 | 26 | -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/core/DynamicJobAssembler.java: -------------------------------------------------------------------------------- 1 | package com.zhongxin.quartz.core; 2 | 3 | import javax.annotation.PostConstruct; 4 | import javax.annotation.Resource; 5 | 6 | import org.springframework.stereotype.Component; 7 | 8 | import org.slf4j.Logger; 9 | import org.slf4j.LoggerFactory; 10 | import com.zhongxin.quartz.service.QuartzService; 11 | 12 | @Component 13 | public class DynamicJobAssembler { 14 | 15 | private static Logger logger = LoggerFactory.getLogger(DynamicJobAssembler.class); 16 | @Resource 17 | private QuartzService quartzService; 18 | 19 | @PostConstruct 20 | public void init() { 21 | logger.info("加载定时任务开始"); 22 | try { 23 | quartzService.initScheduler(); 24 | } catch (Exception e) { 25 | logger.info("定时任务加载失败,请手动加载!\n"); 26 | logger.info("定时任务加载异常:", e); 27 | } 28 | logger.info("定时任务加载完成"); 29 | } 30 | 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/dao/TaskInformationsDao.java: -------------------------------------------------------------------------------- 1 | package com.zhongxin.quartz.dao; 2 | 3 | import java.util.List; 4 | 5 | import com.zhongxin.quartz.entity.TaskInformationsEntity; 6 | import com.zhongxin.quartz.vo.TaskInformationsDetailVo; 7 | import com.zhongxin.quartz.vo.TaskInformationsVo; 8 | 9 | public interface TaskInformationsDao { 10 | 11 | public List getTaskList(); 12 | 13 | public TaskInformationsEntity getTaskByTaskNo(String taskNo); 14 | 15 | public int updateById(TaskInformationsEntity entity); 16 | 17 | public List getList(int currentPage); 18 | 19 | public int getTotalCount(); 20 | 21 | public TaskInformationsDetailVo getTaskDetail(String taskNo); 22 | 23 | public int addTaskInformation(TaskInformationsEntity entity); 24 | 25 | public TaskInformationsEntity selectById(long id); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /quartz-test/src/main/java/com/example/demo/Consumer.java: -------------------------------------------------------------------------------- 1 | package com.example.demo; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.jms.annotation.JmsListener; 5 | import org.springframework.jms.core.JmsMessagingTemplate; 6 | import org.springframework.stereotype.Component; 7 | 8 | import javax.jms.Queue; 9 | 10 | /** 11 | * 消息消费者. 12 | */ 13 | @Component 14 | public class Consumer { 15 | 16 | @Autowired 17 | private JmsMessagingTemplate jmsMessagingTemplate; 18 | 19 | @Autowired 20 | private Queue queue; 21 | 22 | @JmsListener(destination = "quartzTopic") 23 | public void receiveQueue(String text) { 24 | //示例输入,可以写入自己的业务逻辑 25 | System.out.println("quartzTopic="+text); 26 | 27 | //返回成功或失败消息 taskNo,result(success|failed) 28 | this.jmsMessagingTemplate.convertAndSend(this.queue, "test,success"); 29 | } 30 | } -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/service/impl/TaskRecordsServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.zhongxin.quartz.service.impl; 2 | 3 | import java.util.List; 4 | 5 | import javax.annotation.Resource; 6 | 7 | import org.springframework.stereotype.Service; 8 | 9 | import com.zhongxin.quartz.dao.TaskRecordsDao; 10 | import com.zhongxin.quartz.entity.TaskRecordsEntity; 11 | import com.zhongxin.quartz.service.TaskRecordsService; 12 | 13 | @Service 14 | public class TaskRecordsServiceImpl implements TaskRecordsService{ 15 | 16 | @Resource 17 | private TaskRecordsDao recordsDao; 18 | 19 | public List getTaskRecordsByTaskNo(String taskNo,int currentPage,String taskStatus){ 20 | return recordsDao.getListByTaskNo(taskNo, currentPage,taskStatus); 21 | } 22 | 23 | public Integer getCountByTaskNo(String taskNo,String taskStatus){ 24 | return recordsDao.getCountByTaskNo(taskNo,taskStatus); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/util/PageParam.java: -------------------------------------------------------------------------------- 1 | package com.zhongxin.quartz.util; 2 | 3 | /** 4 | *@ClassName: PageParam 5 | *@Description: 6 | *@author YY 7 | *@date 2016年1月25日 上午10:45:43 8 | *@version 1.0 9 | */ 10 | public class PageParam{ 11 | 12 | private Integer beginLine; // 起始行 13 | private Integer endLine; // 结束行 14 | private Integer currentPage=1; // 当前页 15 | 16 | public Integer getCurrentPage() { 17 | return currentPage; 18 | } 19 | 20 | public void setCurrentPage(Integer currentPage) { 21 | this.currentPage = currentPage; 22 | } 23 | 24 | public Integer getBeginLine() { 25 | return beginLine; 26 | } 27 | 28 | public void setBeginLine(Integer beginLine) { 29 | this.beginLine = beginLine; 30 | } 31 | 32 | public Integer getEndLine() { 33 | return endLine; 34 | } 35 | 36 | public void setEndLine(Integer endLine) { 37 | this.endLine = endLine; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/dao/impl/TaskErrorsDaoImpl.java: -------------------------------------------------------------------------------- 1 | package com.zhongxin.quartz.dao.impl; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | import org.springframework.stereotype.Service; 7 | 8 | import com.zhongxin.quartz.dao.BaseDao; 9 | import com.zhongxin.quartz.dao.TaskErrorsDao; 10 | import com.zhongxin.quartz.entity.TaskErrorsEntity; 11 | @Service("taskErrorsDao") 12 | public class TaskErrorsDaoImpl extends BaseDao implements TaskErrorsDao{ 13 | 14 | /** 15 | * 保存 16 | * @param taskErrorsEntity 17 | */ 18 | public void saveTaskErrors(TaskErrorsEntity taskErrorsEntity){ 19 | getTemplate().insert("TaskErrorsMapper.insert",taskErrorsEntity); 20 | } 21 | 22 | public List> getErrorsByTaskExecuteRecordId(String recordId){ 23 | List> list = getTemplate().selectList("TaskErrorsMapper.selectByTaskExecuteRecordId",recordId); 24 | return list; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/resources/mybatis/mybatis-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/main/resources/mybatis/mapper/TaskErrorsMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | taskExecuteRecordId,errorKey,errorValue,createTime,lastModifyTime 7 | 8 | 9 | 10 | insert into quartz_task_errors 11 | ( 12 | 13 | ) 14 | values 15 | ( 16 | #{taskExecuteRecordId}, 17 | #{errorKey}, 18 | #{errorValue}, 19 | #{createTime}, 20 | #{lastModifyTime} 21 | ) 22 | 23 | 24 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/controller/TaskErrorsController.java: -------------------------------------------------------------------------------- 1 | package com.zhongxin.quartz.controller; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | import javax.annotation.Resource; 7 | 8 | import org.springframework.stereotype.Controller; 9 | import org.springframework.web.bind.annotation.PathVariable; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.servlet.ModelAndView; 12 | 13 | import com.zhongxin.quartz.entity.TaskErrorsEntity; 14 | import com.zhongxin.quartz.service.TaskErrorsService; 15 | 16 | @Controller 17 | @RequestMapping("/taskErrors") 18 | public class TaskErrorsController extends BaseController{ 19 | 20 | @Resource 21 | private TaskErrorsService errorsService; 22 | 23 | @RequestMapping("/getErrors/{recordId}") 24 | public ModelAndView getErrors(@PathVariable String recordId){ 25 | ModelAndView view = new ModelAndView("/page/taskErrorsDetail.jsp"); 26 | List> list = errorsService.getErrorsByRecordId(recordId); 27 | view.addObject("list",list); 28 | return view; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/util/JmsClient.java: -------------------------------------------------------------------------------- 1 | package com.zhongxin.quartz.util; 2 | 3 | 4 | import javax.jms.Destination; 5 | import javax.jms.JMSException; 6 | import javax.jms.Message; 7 | import javax.jms.Session; 8 | import javax.jms.TextMessage; 9 | 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.jms.core.JmsTemplate; 12 | import org.springframework.jms.core.MessageCreator; 13 | import org.springframework.stereotype.Service; 14 | 15 | 16 | 17 | /** 18 | * 消息生产者,用于发送消息 19 | * @author Mac 20 | * 21 | */ 22 | @Service("jmsClient") 23 | public class JmsClient { 24 | 25 | @Autowired 26 | private JmsTemplate jmsTemplate; 27 | 28 | 29 | public void sendMessage(Destination destination, final String message) { 30 | jmsTemplate.send(destination, new MessageCreator() { 31 | public Message createMessage(Session session) throws JMSException { 32 | TextMessage textMessage = session.createTextMessage(message); 33 | return textMessage; 34 | } 35 | }); 36 | } 37 | 38 | } 39 | 40 | -------------------------------------------------------------------------------- /src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | #log4j.rootLogger = [ level ] , appenderName, appenderName, ... 2 | log4j.logger.org.springframework=INFO 3 | log4j.rootLogger = INFO, console, R 4 | log4j.appender.console = org.apache.log4j.ConsoleAppender 5 | log4j.appender.console.layout = org.apache.log4j.PatternLayout 6 | #define the output type 7 | log4j.appender.console.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss} [%c]-[%p] %m%n 8 | #file is set to output to a extra file 9 | log4j.appender.R=org.apache.log4j.DailyRollingFileAppender 10 | log4j.appender.R.File=/usr/local/zx-runtime/logs/tomcat-business/zx-quartz.log 11 | log4j.appender.R.DatePattern='_'yyyyMMdd'.log' 12 | log4j.appender.R.layout=org.apache.log4j.PatternLayout 13 | log4j.appender.R.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%c]-[%p] - %m%n 14 | 15 | #database access 16 | log4j.logger.com.ibatis = DEBUG 17 | log4j.logger.com.ibatis.common.jdbc.SimpleDataSource = DEBUG 18 | log4j.logger.com.ibatis.common.jdbc.ScriptRunner = DEBUG 19 | log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate = DEBUG 20 | log4j.logger.java.sql.Connection = DEBUG 21 | log4j.logger.java.sql.Statement = DEBUG 22 | log4j.logger.java.sql.PreparedStatement = DEBUG 23 | log4j.logger.java.sql.ResultSet =DEBUG -------------------------------------------------------------------------------- /src/main/webapp/page/taskErrorsDetail.jsp: -------------------------------------------------------------------------------- 1 | <%@ page pageEncoding="UTF-8" isELIgnored ="false" %> 2 | <%@include file="/page/public/taglib.jsp"%> 3 | 4 | 5 | 6 | 定时任务错误信息 7 | <%@include file="/page/public/csslib.jsp"%> 8 | 9 | 10 |
11 |
12 |
13 |
定时任务错误信息详情
14 |
15 |
16 |
17 |
18 | 19 |

errorKey :${errors['errorKey'] }

20 |

errorValue :${errors['errorValue'] }

21 |
22 |
23 |
24 |
25 | 26 |
27 |
28 |
29 | <%@include file="/page/public/footer.jsp"%> 30 | 31 | -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/service/QuartzService.java: -------------------------------------------------------------------------------- 1 | package com.zhongxin.quartz.service; 2 | 3 | import java.util.List; 4 | 5 | import com.zhongxin.quartz.entity.TaskInformationsEntity; 6 | import com.zhongxin.quartz.entity.TaskRecordsEntity; 7 | import com.zhongxin.quartz.vo.TaskInformationsDetailVo; 8 | import com.zhongxin.quartz.vo.TaskInformationsVo; 9 | 10 | public interface QuartzService { 11 | 12 | public void initScheduler(); 13 | 14 | public String resumeScheduler(String key); 15 | 16 | public String resumeSchedulerAll(); 17 | 18 | public String addScheduler(String key); 19 | 20 | public TaskRecordsEntity beforeExecute(String taskNo); 21 | 22 | public void updateTaskInformations(String taskNo); 23 | 24 | public TaskRecordsEntity modifyTaskRecord(int failCount,Long taskRecordsId); 25 | 26 | public void saveTaskErrors(String taskRecordsId,String key,String values); 27 | 28 | public String delScheduler(String key); 29 | 30 | public List getList(int currentPage); 31 | 32 | public int getTotalCount(); 33 | 34 | public TaskInformationsDetailVo getTaskDetail(String taskNo); 35 | 36 | public int editTaskInformation(TaskInformationsEntity entity); 37 | 38 | public TaskInformationsEntity selectTaskInfoById(Long id); 39 | 40 | public String executeOnce(String taskNo); 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/entity/TaskErrorsEntity.java: -------------------------------------------------------------------------------- 1 | package com.zhongxin.quartz.entity; 2 | 3 | public class TaskErrorsEntity extends Entity{ 4 | 5 | private long id; 6 | private String taskExecuteRecordId; 7 | private String errorKey; 8 | private byte[] errorValue; 9 | private String createTime; 10 | private String lastModifyTime; 11 | 12 | public long getId() { 13 | return id; 14 | } 15 | 16 | public void setId(long id) { 17 | this.id = id; 18 | } 19 | 20 | public String getTaskExecuteRecordId() { 21 | return taskExecuteRecordId; 22 | } 23 | 24 | public void setTaskExecuteRecordId(String taskExecuteRecordId) { 25 | this.taskExecuteRecordId = taskExecuteRecordId; 26 | } 27 | 28 | public String getErrorKey() { 29 | return errorKey; 30 | } 31 | 32 | public void setErrorKey(String errorKey) { 33 | this.errorKey = errorKey; 34 | } 35 | 36 | public byte[] getErrorValue() { 37 | return errorValue; 38 | } 39 | 40 | public void setErrorValue(byte[] errorValue) { 41 | this.errorValue = errorValue; 42 | } 43 | 44 | public String getCreateTime() { 45 | return createTime; 46 | } 47 | 48 | public void setCreateTime(String createTime) { 49 | this.createTime = createTime; 50 | } 51 | 52 | public String getLastModifyTime() { 53 | return lastModifyTime; 54 | } 55 | 56 | public void setLastModifyTime(String lastModifyTime) { 57 | this.lastModifyTime = lastModifyTime; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/main/resources/spring/spring-mvc.xml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/main/webapp/media/js/script.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function(){ 2 | 3 | $('.u-text label').inFieldLabels(); 4 | 5 | function tabs(tabsNav, tabsContent, activeClass, eventType){ 6 | $(tabsNav).each(function(){ 7 | $(this).children().eq(0).addClass(activeClass) 8 | }); 9 | $(tabsContent).each(function(){ 10 | $(this).children().eq(0).show(); 11 | }); 12 | $(tabsNav).children().on(eventType, function(){ 13 | $(this).addClass(activeClass).siblings().removeClass(activeClass); 14 | var index = $(tabsNav).children().index(this); 15 | $(tabsContent).children().eq(index).show().siblings().hide(); 16 | }); 17 | }; 18 | 19 | $('.fixed-nav .item-top').on('click', function(){ 20 | $('body, html').animate({scrollTop: 0}); 21 | }); 22 | 23 | $('.u-select').each(function(){ 24 | var value = $(this).find('.value'); 25 | var list = $(this).find('.list'); 26 | var listLi = list.find('li'); 27 | listLi.each(function(){ 28 | if($(this).text()==value.text()){ 29 | $(this).addClass('z-active').siblings().removeClass('z-active'); 30 | } 31 | }); 32 | value.on('click',function(e){ 33 | if(list.is(':hidden')){ 34 | $('.u-select').find('.list').hide(); 35 | list.show(); 36 | e.stopPropagation(); 37 | }else{ 38 | list.hide(); 39 | }; 40 | }); 41 | list.on('click','li',function(){ 42 | $(this).addClass('z-active').siblings().removeClass('z-active'); 43 | value.find('.val').text($(this).text()); 44 | value.find('.val').attr('value',$(this).attr('value')); 45 | list.hide(); 46 | }); 47 | $(document).on('click',function(){ 48 | $('.u-select').find('.list').hide(); 49 | }); 50 | }); 51 | 52 | }); -------------------------------------------------------------------------------- /src/main/webapp/media/js/jquery.infieldlabel.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | * In-Field Label jQuery Plugin 3 | * http://fuelyourcoding.com/scripts/infield.html 4 | * 5 | * Copyright (c) 2009 Doug Neiner 6 | * Dual licensed under the MIT and GPL licenses. 7 | * Uses the same license as jQuery, see: 8 | * http://docs.jquery.com/License 9 | * 10 | * @version 0.1 11 | */ 12 | (function($){$.InFieldLabels=function(b,c,d){var f=this;f.$label=$(b);f.label=b;f.$field=$(c);f.field=c;f.$label.data("InFieldLabels",f);f.showing=true;f.init=function(){f.options=$.extend({},$.InFieldLabels.defaultOptions,d);if(f.$field.val()!=""){f.$label.hide();f.showing=false};f.$field.focus(function(){f.fadeOnFocus()}).blur(function(){f.checkForEmpty(true)}).bind('keydown.infieldlabel',function(e){f.hideOnChange(e)}).change(function(e){f.checkForEmpty()}).bind('onPropertyChange',function(){f.checkForEmpty()})};f.fadeOnFocus=function(){if(f.showing){f.setOpacity(f.options.fadeOpacity)}};f.setOpacity=function(a){f.$label.stop().animate({opacity:a},f.options.fadeDuration);f.showing=(a>0.0)};f.checkForEmpty=function(a){if(f.$field.val()==""){f.prepForShow();f.setOpacity(a?1.0:f.options.fadeOpacity)}else{f.setOpacity(0.0)}};f.prepForShow=function(e){if(!f.showing){f.$label.css({opacity:0.0}).show();f.$field.bind('keydown.infieldlabel',function(e){f.hideOnChange(e)})}};f.hideOnChange=function(e){if((e.keyCode==16)||(e.keyCode==9))return;if(f.showing){f.$label.hide();f.showing=false};f.$field.unbind('keydown.infieldlabel')};f.init()};$.InFieldLabels.defaultOptions={fadeOpacity:0.5,fadeDuration:300};$.fn.inFieldLabels=function(c){return this.each(function(){var a=$(this).attr('for');if(!a)return;var b=$("input#"+a+"[type='text'],"+"input#"+a+"[type='password'],"+"textarea#"+a);if(b.length==0)return;(new $.InFieldLabels(this,b[0],c))})}})(jQuery); -------------------------------------------------------------------------------- /quartz-test/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.example 7 | quartz-test 8 | 0.0.1-SNAPSHOT 9 | jar 10 | 11 | quartz-test 12 | Demo project for Spring Boot 13 | 14 | 15 | org.springframework.boot 16 | spring-boot-starter-parent 17 | 1.5.6.RELEASE 18 | 19 | 20 | 21 | 22 | UTF-8 23 | UTF-8 24 | 1.8 25 | 26 | 27 | 28 | 29 | org.springframework.boot 30 | spring-boot-starter 31 | 32 | 33 | 34 | org.springframework.boot 35 | spring-boot-starter-activemq 36 | 37 | 38 | 39 | org.springframework.boot 40 | spring-boot-starter-test 41 | test 42 | 43 | 44 | 45 | 46 | 47 | 48 | org.springframework.boot 49 | spring-boot-maven-plugin 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | Archetype Created Web Application Remote 7 | 8 | 9 | contextConfigLocation 10 | 11 | classpath*:spring/spring-quartz-*.xml 12 | 13 | 14 | 15 | org.springframework.web.context.ContextLoaderListener 16 | 17 | 18 | 19 | CharacterEncodingFilter 20 | org.springframework.web.filter.CharacterEncodingFilter 21 | 22 | encoding 23 | UTF-8 24 | 25 | 26 | 27 | CharacterEncodingFilter 28 | /* 29 | 30 | 31 | 32 | spring 33 | org.springframework.web.servlet.DispatcherServlet 34 | 35 | contextConfigLocation 36 | 37 | classpath*:spring/spring-mvc.xml 38 | 39 | 40 | 1 41 | 42 | 43 | spring 44 | / 45 | 46 | 47 | 48 | 404 49 | /404.html 50 | 51 | 52 | 53 | 500 54 | /500.html 55 | 56 | 57 | -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/controller/TaskRecordsController.java: -------------------------------------------------------------------------------- 1 | package com.zhongxin.quartz.controller; 2 | 3 | import java.util.List; 4 | 5 | import javax.annotation.Resource; 6 | 7 | import org.apache.commons.lang.StringUtils; 8 | import org.springframework.stereotype.Controller; 9 | import org.springframework.web.bind.annotation.PathVariable; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.servlet.ModelAndView; 12 | 13 | import com.zhongxin.quartz.entity.TaskRecordsEntity; 14 | import com.zhongxin.quartz.service.TaskRecordsService; 15 | import com.zhongxin.quartz.util.Page; 16 | 17 | @Controller 18 | @RequestMapping("/taskRecords") 19 | public class TaskRecordsController extends BaseController{ 20 | 21 | @Resource 22 | private TaskRecordsService recordsService; 23 | 24 | /** 25 | * 定时任务记录列表页面展示 26 | * @param taskNo 27 | * @param currentPage 28 | * @return 29 | */ 30 | @RequestMapping("/getTaskRecordsListByTaskNo/{taskNo}/{currentPage}/{status}") 31 | public ModelAndView getTaskRecordsListByTaskNo(@PathVariable String taskNo,@PathVariable int currentPage,@PathVariable String status){ 32 | ModelAndView view = new ModelAndView("/page/taskRecordsList.jsp"); 33 | String taskStatus = ""; 34 | if(StringUtils.isNotBlank(status)){ 35 | taskStatus = status.substring(6); 36 | } 37 | List recordsList = recordsService.getTaskRecordsByTaskNo(taskNo, currentPage,taskStatus); 38 | Integer count = recordsService.getCountByTaskNo(taskNo,taskStatus); 39 | Page page = new Page(count); 40 | page.setCurrentPage(currentPage); 41 | page.setList(recordsList); 42 | view.addObject("page",page); 43 | view.addObject("taskNo",taskNo); 44 | view.addObject("taskStatus",taskStatus); 45 | return view; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/listener/TaskReturnListener.java: -------------------------------------------------------------------------------- 1 | package com.zhongxin.quartz.listener; 2 | 3 | import javax.jms.Message; 4 | import javax.jms.MessageListener; 5 | import javax.jms.TextMessage; 6 | 7 | import org.slf4j.Logger; 8 | import org.slf4j.LoggerFactory; 9 | import com.zhongxin.quartz.dao.TaskRecordsDao; 10 | import com.zhongxin.quartz.entity.TaskRecordsEntity; 11 | import com.zhongxin.quartz.service.QuartzService; 12 | import com.zhongxin.quartz.util.Const; 13 | import com.zhongxin.quartz.util.SpringContext; 14 | 15 | 16 | public class TaskReturnListener implements MessageListener{ 17 | 18 | protected Logger logger = LoggerFactory.getLogger(this.getClass()); 19 | 20 | @Override 21 | public void onMessage(Message message) { 22 | try { 23 | if (message instanceof TextMessage) { 24 | String msg = ((TextMessage) message).getText(); 25 | logger.info("监听到消息:" + msg); 26 | // taskNo,result(success|failed),failCount,failKey,failReason 27 | String strs[] = msg.split(","); 28 | String taskNo = strs[0]; 29 | String result = strs[1]; 30 | int failCount = 0; 31 | if(!Const.SUCCESS.equals(result)){ 32 | failCount = Integer.parseInt(strs[2]); 33 | } 34 | QuartzService quartzService = (QuartzService) SpringContext.getBean("quartzService"); 35 | TaskRecordsDao taskRecordsDao = (TaskRecordsDao) SpringContext.getBean("taskRecordsDao"); 36 | // 更新 37 | quartzService.updateTaskInformations(taskNo); 38 | TaskRecordsEntity recordsEntity = taskRecordsDao.selectByTaskNoAndStatus(taskNo); 39 | if(null != recordsEntity){ 40 | quartzService.modifyTaskRecord(failCount, recordsEntity.getId()); 41 | if(!Const.SUCCESS.equals(result)){ 42 | quartzService.saveTaskErrors(String.valueOf(recordsEntity.getId()),strs[3], strs[4]); 43 | } 44 | } 45 | } 46 | } catch (Exception e) { 47 | logger.error("异常:", e); 48 | } 49 | 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/entity/TaskRecordsEntity.java: -------------------------------------------------------------------------------- 1 | package com.zhongxin.quartz.entity; 2 | 3 | import com.zhongxin.quartz.enums.StatusEnum; 4 | 5 | public class TaskRecordsEntity extends Entity { 6 | 7 | private Long id; 8 | private String taskNo; 9 | private String timeKeyValue; 10 | private String executeTime; 11 | private StatusEnum taskStatus; 12 | private Integer failcount; 13 | private String failReason; 14 | private String createTime; 15 | private String lastModifyTime; 16 | private String time; 17 | 18 | public String getTime() { 19 | return time; 20 | } 21 | 22 | public void setTime(String time) { 23 | this.time = time; 24 | } 25 | 26 | public Long getId() { 27 | return id; 28 | } 29 | 30 | public void setId(Long id) { 31 | this.id = id; 32 | } 33 | 34 | public String getTaskNo() { 35 | return taskNo; 36 | } 37 | 38 | public void setTaskNo(String taskNo) { 39 | this.taskNo = taskNo; 40 | } 41 | 42 | public String getTimeKeyValue() { 43 | return timeKeyValue; 44 | } 45 | 46 | public void setTimeKeyValue(String timeKeyValue) { 47 | this.timeKeyValue = timeKeyValue; 48 | } 49 | 50 | public String getExecuteTime() { 51 | return executeTime; 52 | } 53 | 54 | public void setExecuteTime(String executeTime) { 55 | this.executeTime = executeTime; 56 | } 57 | 58 | public StatusEnum getTaskStatus() { 59 | return taskStatus; 60 | } 61 | 62 | public void setTaskStatus(StatusEnum taskStatus) { 63 | this.taskStatus = taskStatus; 64 | } 65 | 66 | public Integer getFailcount() { 67 | return failcount; 68 | } 69 | 70 | public void setFailcount(Integer failcount) { 71 | this.failcount = failcount; 72 | } 73 | 74 | public String getFailReason() { 75 | return failReason; 76 | } 77 | 78 | public void setFailReason(String failReason) { 79 | this.failReason = failReason; 80 | } 81 | 82 | public String getCreateTime() { 83 | return createTime; 84 | } 85 | 86 | public void setCreateTime(String createTime) { 87 | this.createTime = createTime; 88 | } 89 | 90 | public String getLastModifyTime() { 91 | return lastModifyTime; 92 | } 93 | 94 | public void setLastModifyTime(String lastModifyTime) { 95 | this.lastModifyTime = lastModifyTime; 96 | } 97 | 98 | } 99 | -------------------------------------------------------------------------------- /src/main/webapp/page/quartzDetail.jsp: -------------------------------------------------------------------------------- 1 | <%@ page pageEncoding="UTF-8" isELIgnored ="false" %> 2 | <%@include file="/page/public/taglib.jsp"%> 3 | 4 | 5 | 6 | 定时任务详情 7 | <%@include file="/page/public/csslib.jsp"%> 8 | 9 | 10 |
11 |
12 |
13 |
定时任务详情
14 |
15 |
16 |
17 |
18 |

任务编号 :${detail.taskNo }

19 |

任务名称 :${detail.taskName }

20 |

定时配置 :${detail.schedulerRule }

21 |

冻结状态 :${detail.frozenStatus }

22 |

执行方 :${detail.executorNo }

23 |

冻结时间 :${detail.frozenTime }

24 |

解冻时间 :${detail.unfrozenTime }

25 |

执行方式 :${detail.sendType }

26 |

url :${detail.url }

27 |

执行参数 :${detail.executeParamter }

28 |

timeKey :${detail.timeKey }

29 |

创建时间 :${detail.createTime }

30 |

修改时间 :${detail.lastModifyTime }

31 |

上一次执行时间 :${detail.preExecuteTime }

32 |

上一次执行状态 :${detail.taskStatus }

33 |
34 |
35 |
36 | 37 |
38 |
39 |
40 | <%@include file="/page/public/footer.jsp"%> 41 | 42 | -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/service/impl/NoticeServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.zhongxin.quartz.service.impl; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | import javax.annotation.Resource; 7 | import javax.jms.Destination; 8 | 9 | import org.apache.commons.lang.StringUtils; 10 | import org.apache.log4j.Logger; 11 | import org.springframework.stereotype.Service; 12 | 13 | import com.zhongxin.quartz.service.NoticeService; 14 | import com.zhongxin.quartz.util.HttpClientUtil; 15 | import com.zhongxin.quartz.util.JmsClient; 16 | 17 | @Service("noticeService") 18 | public class NoticeServiceImpl implements NoticeService{ 19 | 20 | protected Logger logger = Logger.getLogger(this.getClass()); 21 | 22 | @Resource 23 | private JmsClient jmsClient; 24 | @Resource 25 | private Destination quartzTopic; 26 | 27 | /** 28 | * @author ZQ 29 | * @date 2016-2-26 30 | * @param targetBeanId 31 | * @param executorNo 32 | * @param executeParamter 33 | */ 34 | public void sendMQmsg(String targetBeanId,String executorNo,String executeParamter){ 35 | try { 36 | if (StringUtils.isBlank(targetBeanId)|| StringUtils.isBlank(executorNo)) { 37 | logger.error("param is null "); 38 | return; 39 | } 40 | String message = targetBeanId + "," + executorNo + "," + executeParamter; 41 | jmsClient.sendMessage(quartzTopic, message); 42 | logger.info("quartzTopic send succeed"+message); 43 | } catch (Exception e) { 44 | logger.error("sendMQmsg send is failed:", e); 45 | throw e; 46 | } 47 | } 48 | 49 | 50 | 51 | /** 52 | * @author ZQ 53 | * @date 2016-2-26 54 | * @param executeParamter 55 | * @param url 56 | */ 57 | public void httpRequest(String url,String executeParamter){ 58 | try { 59 | if(StringUtils.isBlank(url)){ 60 | logger.error("param is null "); 61 | return; 62 | } 63 | Map map = new HashMap(); 64 | map.put("executeParamter", executeParamter); 65 | //String res = SimpleHttpUtils.httpPost(url,map); 66 | String res = HttpClientUtil.doPost(url,map); 67 | 68 | logger.info("http request result is "+res); 69 | } catch (Exception e) { 70 | // TODO: handle exception 71 | logger.error("http request is failed:",e); 72 | 73 | throw e; 74 | } 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /src/main/resources/spring/spring-quartz-dao.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 42 | 43 | 44 | classpath:runtimecfg/*.properties 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/dao/impl/TaskInformationsDaoImpl.java: -------------------------------------------------------------------------------- 1 | package com.zhongxin.quartz.dao.impl; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.stereotype.Service; 6 | 7 | import com.zhongxin.quartz.dao.BaseDao; 8 | import com.zhongxin.quartz.dao.TaskInformationsDao; 9 | import com.zhongxin.quartz.entity.TaskInformationsEntity; 10 | import com.zhongxin.quartz.util.DateUtil; 11 | import com.zhongxin.quartz.vo.TaskInformationsDetailVo; 12 | import com.zhongxin.quartz.vo.TaskInformationsVo; 13 | 14 | 15 | @Service("taskInformationsDao") 16 | public class TaskInformationsDaoImpl extends BaseDao implements TaskInformationsDao{ 17 | 18 | /** 19 | * 获取任务列表 20 | * @return 21 | */ 22 | public List getTaskList(){ 23 | List taskList = getTemplate().selectList("TaskInformationsMapper.selectTaskInfoList"); 24 | return taskList; 25 | } 26 | 27 | /** 28 | * 根据taskNo获取任务 29 | * @param taskNo 30 | * @return 31 | */ 32 | public TaskInformationsEntity getTaskByTaskNo(String taskNo){ 33 | TaskInformationsEntity entity = getTemplate().selectOne("TaskInformationsMapper.selectByTaskNo",taskNo); 34 | return entity; 35 | } 36 | 37 | /** 38 | * 根据ID更新 39 | * @param entity 40 | */ 41 | public int updateById(TaskInformationsEntity entity){ 42 | int count = getTemplate().update("TaskInformationsMapper.updateById", entity); 43 | return count; 44 | } 45 | 46 | /** 47 | * 列表获取 48 | * @return 49 | */ 50 | public List getList(int currentPage){ 51 | return getTemplate().selectList("TaskInformationsMapper.selectAll",getPageNum(currentPage, 10)); 52 | } 53 | 54 | public int getTotalCount(){ 55 | return getTemplate().selectOne("TaskInformationsMapper.selectTotalCount"); 56 | } 57 | 58 | public TaskInformationsDetailVo getTaskDetail(String taskNo){ 59 | return getTemplate().selectOne("TaskInformationsMapper.selectDetail", taskNo); 60 | } 61 | 62 | public int addTaskInformation(TaskInformationsEntity entity){ 63 | entity.setCreateTime(DateUtil.getLastModifyTime()); 64 | entity.setLastModifyTime(DateUtil.getLastModifyTime()); 65 | entity.setVersion(0); 66 | int count = getTemplate().insert("TaskInformationsMapper.addTaskInfo",entity); 67 | return count; 68 | } 69 | 70 | public TaskInformationsEntity selectById(long id){ 71 | return getTemplate().selectOne("TaskInformationsMapper.selectById",id); 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/vo/TaskInformationsVo.java: -------------------------------------------------------------------------------- 1 | package com.zhongxin.quartz.vo; 2 | 3 | 4 | public class TaskInformationsVo { 5 | 6 | private Long id; 7 | private String taskNo; 8 | private String taskName; 9 | private String schedulerRule; 10 | private String frozenStatus; 11 | private String executorNo; 12 | private String sendType; 13 | private String url; 14 | private String executeParamter; 15 | private String lastModifyTime; 16 | private String timeKey; 17 | 18 | public Long getId() { 19 | return id; 20 | } 21 | 22 | public void setId(Long id) { 23 | this.id = id; 24 | } 25 | 26 | public String getTaskNo() { 27 | return taskNo; 28 | } 29 | 30 | public void setTaskNo(String taskNo) { 31 | this.taskNo = taskNo; 32 | } 33 | 34 | public String getTaskName() { 35 | return taskName; 36 | } 37 | 38 | public void setTaskName(String taskName) { 39 | this.taskName = taskName; 40 | } 41 | 42 | public String getSchedulerRule() { 43 | return schedulerRule; 44 | } 45 | 46 | public void setSchedulerRule(String schedulerRule) { 47 | this.schedulerRule = schedulerRule; 48 | } 49 | 50 | public String getFrozenStatus() { 51 | return frozenStatus; 52 | } 53 | 54 | public void setFrozenStatus(String frozenStatus) { 55 | this.frozenStatus = frozenStatus; 56 | } 57 | 58 | public String getExecutorNo() { 59 | return executorNo; 60 | } 61 | 62 | public void setExecutorNo(String executorNo) { 63 | this.executorNo = executorNo; 64 | } 65 | 66 | public String getSendType() { 67 | return sendType; 68 | } 69 | 70 | public void setSendType(String sendType) { 71 | this.sendType = sendType; 72 | } 73 | 74 | public String getUrl() { 75 | return url; 76 | } 77 | 78 | public void setUrl(String url) { 79 | this.url = url; 80 | } 81 | 82 | public String getExecuteParamter() { 83 | return executeParamter; 84 | } 85 | 86 | public void setExecuteParamter(String executeParamter) { 87 | this.executeParamter = executeParamter; 88 | } 89 | 90 | public String getLastModifyTime() { 91 | return lastModifyTime; 92 | } 93 | 94 | public void setLastModifyTime(String lastModifyTime) { 95 | this.lastModifyTime = lastModifyTime; 96 | } 97 | 98 | public String getTimeKey() { 99 | return timeKey; 100 | } 101 | 102 | public void setTimeKey(String timeKey) { 103 | this.timeKey = timeKey; 104 | } 105 | 106 | } 107 | -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/dao/impl/TaskRecordsDaoImpl.java: -------------------------------------------------------------------------------- 1 | package com.zhongxin.quartz.dao.impl; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import org.apache.commons.lang.StringUtils; 8 | import org.springframework.stereotype.Service; 9 | 10 | import com.zhongxin.quartz.dao.BaseDao; 11 | import com.zhongxin.quartz.dao.TaskRecordsDao; 12 | import com.zhongxin.quartz.entity.TaskRecordsEntity; 13 | @Service("taskRecordsDao") 14 | public class TaskRecordsDaoImpl extends BaseDao implements TaskRecordsDao{ 15 | 16 | /** 17 | * 根据taskNo查询记录表 18 | * @param taskNo 19 | * @return 20 | */ 21 | public TaskRecordsEntity getRecordsByTaskNo(String taskNo,String timeKeyValue){ 22 | Map map = new HashMap(); 23 | map.put("taskNo", taskNo); 24 | map.put("timeKeyValue", timeKeyValue); 25 | TaskRecordsEntity taskRecordsEntity = getTemplate().selectOne("TaskRecordsMapper.selectByTaskNo", map); 26 | return taskRecordsEntity; 27 | } 28 | 29 | /** 30 | * 保存 31 | * @param taskRecordsEntity 32 | */ 33 | public Long insert(TaskRecordsEntity taskRecordsEntity){ 34 | getTemplate().insert("TaskRecordsMapper.insert",taskRecordsEntity); 35 | return taskRecordsEntity.getId(); 36 | } 37 | 38 | /** 39 | * 根据ID修改 40 | * @param recordsEntity 41 | */ 42 | public void updateById(TaskRecordsEntity recordsEntity){ 43 | getTemplate().update("TaskRecordsMapper.updateById",recordsEntity); 44 | } 45 | 46 | public TaskRecordsEntity selectByTaskNoAndStatus(String taskNo){ 47 | List recordsList = getTemplate().selectList("TaskRecordsMapper.selectByTaskNoAndStatus",taskNo); 48 | if(null != recordsList){ 49 | return recordsList.get(0); 50 | }else{ 51 | return null; 52 | } 53 | } 54 | 55 | public List getListByTaskNo(String taskNo,int currentPage,String taskStatus){ 56 | Map paramMap = new HashMap<>(); 57 | paramMap.put("taskNo", taskNo); 58 | paramMap.put("currentPage", getPageNum(currentPage, 10)); 59 | if(StringUtils.isNotBlank(taskStatus)){ 60 | paramMap.put("taskStatus", taskStatus); 61 | } 62 | List list = getTemplate().selectList("TaskRecordsMapper.selectListByTaskNo",paramMap); 63 | return list; 64 | } 65 | 66 | public Integer getCountByTaskNo(String taskNo,String taskStatus){ 67 | Map paramMap = new HashMap<>(); 68 | paramMap.put("taskNo", taskNo); 69 | if(StringUtils.isNotBlank(taskStatus)){ 70 | paramMap.put("taskStatus", taskStatus); 71 | } 72 | Integer count = getTemplate().selectOne("TaskRecordsMapper.selectCountByTaskNo",paramMap); 73 | return count; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/main/webapp/media/css/detail.css: -------------------------------------------------------------------------------- 1 | .order-detail{padding-bottom:40px;min-height:500px;border:1px solid #ececec;background:#fff;border-radius:4px;box-shadow:0 2px 4px -2px rgba(0, 0, 0, .2);} 2 | .m-caption{margin:20px 40px 0;padding-left:20px;height:40px;border-bottom:1px solid #ee1d23;font-size:18px;color:#ee1d23;line-height:40px;} 3 | .m-detail{padding:0 40px;} 4 | .m-detail .item{padding:20px 0;border-bottom:1px solid #e3e3e3;color:#666;} 5 | .m-detail .item .label{padding-left:40px;font-size:18px;line-height:28px;} 6 | .m-detail .item .info{padding-left:200px;} 7 | .m-detail .item .info p{font-size:14px;line-height:28px;} 8 | .m-action{margin-top:40px;font-size:18px;text-align:center;line-height:36px;} 9 | .m-action .u-button{display:inline-block;margin-left:16px;width:82px;height:34px;border:1px solid #e9412d;background:#e9412d;color:#fff;text-align:center;font-size:14px;line-height:34px;vertical-align:top;border-radius:4px;-webkit-transition:all .2s linear;transition:all .2s linear;} 10 | .m-action .u-button:hover{background-color:#ee1d23;text-decoration:none;} 11 | .m-action .u-button.z-disabled{border:1px solid #c8c8c8;background:#c8c8c8;} 12 | .m-aftersale{padding:0 40px;} 13 | .m-aftersale .item{padding:20px 0;border-bottom:1px solid #e3e3e3;color:#666;} 14 | .m-aftersale .item .label{padding-left:60px;font-size:14px;line-height:24px;} 15 | .m-aftersale .item .info{padding-left:140px;} 16 | .step-aftersale{padding-bottom:48px;} 17 | .step-aftersale .step{position:relative;float:left;margin-right:8px;padding-right:120px;height:24px;background:url(../img/line_horizontal_2.png) left center repeat-x;font-size:14px;color:#666;line-height:24px;} 18 | .step-aftersale .step-3{margin-right:0;padding-right:0;background:none;} 19 | .step-aftersale .step strong{position:relative;padding-left:20px;padding-right:10px;background:#fff;font-weight:normal;} 20 | .step-aftersale .step-3 strong{padding-right:0;} 21 | .step-aftersale .step strong .icon{position:absolute;left:0;top:50%;margin-top:-8px;width:16px;height:16px;background:url(../img/icon_invalid_2.png) 0 0 no-repeat;} 22 | .m-refund{padding:0 40px;} 23 | .step-aftersale .step p{position:absolute;left:50%;top:24px;margin-left:-160px;width:200px;text-align:center;} 24 | .step-aftersale .step.z-active{background-image:url(../img/line_horizontal_3.png);} 25 | .step-aftersale .step.z-active strong{color:#ee1d23;} 26 | .step-aftersale .step.z-active strong .icon{background-image:url(../img/icon_valid_2.png);} 27 | .m-refund .item{padding:20px 0;border-bottom:1px solid #e3e3e3;color:#666;} 28 | .m-refund .item .label{padding-left:20px;font-size:18px;line-height:28px;} 29 | .m-refund .item .info{padding-left:60px;} 30 | .m-refund .item .info p{font-size:14px;line-height:28px;} -------------------------------------------------------------------------------- /src/main/resources/mybatis/mapper/TaskRecordsMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | taskNo,timeKeyValue,executeTime,taskStatus,failcount,failReason,createTime,lastModifyTime 7 | 8 | 9 | 18 | 19 | 38 | 39 | 50 | 51 | 61 | 62 | 63 | insert into quartz_task_records 64 | ( 65 | 66 | ) 67 | values 68 | ( 69 | #{taskNo}, 70 | #{timeKeyValue}, 71 | #{executeTime}, 72 | #{taskStatus}, 73 | #{failcount}, 74 | #{failReason}, 75 | #{createTime}, 76 | #{lastModifyTime} 77 | ) 78 | 79 | 80 | 81 | update 82 | quartz_task_records 83 | set 84 | failcount = #{failcount}, 85 | taskStatus = #{taskStatus}, 86 | lastModifyTime = #{lastModifyTime} 87 | where 88 | id = #{id} 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /src/main/resources/spring/spring-quartz-activemq.xml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | 16 | 17 | 18 | ${brokerUrl} 19 | 20 | 21 | ${activemq.userName} 22 | 23 | 24 | ${activemq.password} 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | true 46 | 47 | 48 | 49 | 50 | 51 | ${quartz.topic.name} 52 | 53 | 54 | 55 | 56 | 57 | ${task.return.queue.name} 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/entity/TaskInformationsEntity.java: -------------------------------------------------------------------------------- 1 | package com.zhongxin.quartz.entity; 2 | 3 | import com.zhongxin.quartz.enums.TaskStatusEnum; 4 | 5 | public class TaskInformationsEntity extends Entity{ 6 | 7 | 8 | private static final long serialVersionUID = 1L; 9 | private Long id; 10 | private Integer version; 11 | private String taskNo; 12 | private String taskName; 13 | private String schedulerRule; 14 | private TaskStatusEnum frozenStatus; 15 | private String executorNo; 16 | private String sendType; 17 | private String url; 18 | private String executeParamter; 19 | private Long frozenTime; 20 | private Long unfrozenTime; 21 | private Long createTime; 22 | private Long lastModifyTime; 23 | private String timeKey; 24 | 25 | public String getTimeKey() { 26 | return timeKey; 27 | } 28 | 29 | public void setTimeKey(String timeKey) { 30 | this.timeKey = timeKey; 31 | } 32 | 33 | public Long getFrozenTime() { 34 | return frozenTime; 35 | } 36 | 37 | public void setFrozenTime(Long frozenTime) { 38 | this.frozenTime = frozenTime; 39 | } 40 | 41 | public Long getUnfrozenTime() { 42 | return unfrozenTime; 43 | } 44 | 45 | public void setUnfrozenTime(Long unfrozenTime) { 46 | this.unfrozenTime = unfrozenTime; 47 | } 48 | 49 | public Long getCreateTime() { 50 | return createTime; 51 | } 52 | 53 | public void setCreateTime(Long createTime) { 54 | this.createTime = createTime; 55 | } 56 | 57 | public Long getLastModifyTime() { 58 | return lastModifyTime; 59 | } 60 | 61 | public void setLastModifyTime(Long lastModifyTime) { 62 | this.lastModifyTime = lastModifyTime; 63 | } 64 | 65 | public String getSendType() { 66 | return sendType; 67 | } 68 | 69 | public void setSendType(String sendType) { 70 | this.sendType = sendType; 71 | } 72 | 73 | public String getUrl() { 74 | return url; 75 | } 76 | 77 | public void setUrl(String url) { 78 | this.url = url; 79 | } 80 | 81 | public String getExecuteParamter() { 82 | return executeParamter; 83 | } 84 | 85 | public void setExecuteParamter(String executeParamter) { 86 | this.executeParamter = executeParamter; 87 | } 88 | 89 | public Long getId() { 90 | return id; 91 | } 92 | 93 | public void setId(Long id) { 94 | this.id = id; 95 | } 96 | 97 | public Integer getVersion() { 98 | return version; 99 | } 100 | 101 | public void setVersion(Integer version) { 102 | this.version = version; 103 | } 104 | 105 | public String getTaskNo() { 106 | return taskNo; 107 | } 108 | 109 | public void setTaskNo(String taskNo) { 110 | this.taskNo = taskNo; 111 | } 112 | 113 | public String getTaskName() { 114 | return taskName; 115 | } 116 | 117 | public void setTaskName(String taskName) { 118 | this.taskName = taskName; 119 | } 120 | 121 | public String getSchedulerRule() { 122 | return schedulerRule; 123 | } 124 | 125 | public void setSchedulerRule(String schedulerRule) { 126 | this.schedulerRule = schedulerRule; 127 | } 128 | 129 | public TaskStatusEnum getFrozenStatus() { 130 | return frozenStatus; 131 | } 132 | 133 | public void setFrozenStatus(TaskStatusEnum frozenStatus) { 134 | this.frozenStatus = frozenStatus; 135 | } 136 | 137 | public String getExecutorNo() { 138 | return executorNo; 139 | } 140 | 141 | public void setExecutorNo(String executorNo) { 142 | this.executorNo = executorNo; 143 | } 144 | 145 | } 146 | -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/util/Page.java: -------------------------------------------------------------------------------- 1 | package com.zhongxin.quartz.util; 2 | 3 | import java.io.Serializable; 4 | import java.util.List; 5 | 6 | import org.apache.commons.lang.builder.ToStringBuilder; 7 | 8 | /** 9 | * @Description: 分页数据包装类 10 | * @version v1.0 11 | */ 12 | public class Page implements Serializable{ 13 | private static final long serialVersionUID = 1L; 14 | private int currentPage=1; //当前页数 15 | private int totalPage; //总页数 16 | private int totalNumber; //总记录数 17 | private List list; //数据集 18 | private PageParam param; 19 | private int number = 10; //每页多少条 20 | 21 | public int getNumber() { 22 | return number; 23 | } 24 | public void setNumber(int number) { 25 | this.number = number; 26 | } 27 | 28 | public Page() { 29 | super(); 30 | } 31 | //根据总记录数自动计算出总页数 32 | public Page(int totalNumber) { 33 | super(); 34 | this.totalNumber = totalNumber; 35 | totalPage = totalNumber % number == 0 ? totalNumber 36 | / number : totalNumber / number+ 1; 37 | } 38 | public Page(int totalNumber,int num){ 39 | super(); 40 | this.totalNumber = totalNumber; 41 | totalPage = totalNumber % num == 0 ? totalNumber 42 | / num : totalNumber / num+ 1; 43 | } 44 | public Page(int totalNumber, PageParam baseParam, int pageSize) { 45 | super(); 46 | this.param = baseParam; 47 | if (totalNumber > 0) { 48 | this.totalNumber = totalNumber; 49 | totalPage = totalNumber % pageSize == 0 ? totalNumber/ pageSize : totalNumber / pageSize + 1; 50 | this.currentPage = baseParam.getCurrentPage(); 51 | Integer beginLine = (currentPage - 1) * pageSize; 52 | int t = beginLine + pageSize; 53 | Integer endLine = t > totalNumber ? totalNumber : t; 54 | this.param.setBeginLine(beginLine); 55 | this.param.setEndLine(endLine); 56 | } else { 57 | this.param.setBeginLine(0); 58 | this.param.setEndLine(0); 59 | } 60 | } 61 | //根据总记录数自动计算出总页数 62 | /*public Page(int totalNumber,int currentPage) { 63 | super(); 64 | this.totalNumber = totalNumber; 65 | totalPage = totalNumber % number == 0 ? totalNumber 66 | / number : totalNumber / number+ 1; 67 | this.currentPage = currentPage; 68 | }*/ 69 | public int getCurrentPage() { 70 | return currentPage; 71 | } 72 | public void setCurrentPage(int currentPage) { 73 | this.currentPage = currentPage; 74 | } 75 | public int getTotalPage() { 76 | return totalPage; 77 | } 78 | public void setTotalPage(int totalPage) { 79 | this.totalPage = totalPage; 80 | } 81 | public int getTotalNumber() { 82 | return totalNumber; 83 | } 84 | public void setTotalNumber(int totalNumber) { 85 | this.totalNumber = totalNumber; 86 | } 87 | public List getList() { 88 | return list; 89 | } 90 | public void setList(List list) { 91 | this.list = list; 92 | } 93 | public PageParam getParam() { 94 | return param; 95 | } 96 | public void setParam(PageParam param) { 97 | this.param = param; 98 | } 99 | /** 100 | * 获取查询数据时分页的起始值 101 | * @return 102 | */ 103 | public int getPageBeginData() 104 | { 105 | return (this.getCurrentPage()-1)*this.getNumber(); 106 | } 107 | 108 | /** 109 | * 获取查询数据时分页的结束值 110 | * @return 111 | */ 112 | public int getPageEndData() 113 | { 114 | return ((this.getCurrentPage()-1)*this.getNumber()) + this.getNumber(); 115 | } 116 | 117 | @Override 118 | public String toString() { 119 | return ToStringBuilder.reflectionToString(this); 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/core/QuartzJobFactory.java: -------------------------------------------------------------------------------- 1 | package com.zhongxin.quartz.core; 2 | 3 | 4 | import java.util.concurrent.atomic.AtomicInteger; 5 | 6 | import org.apache.log4j.Logger; 7 | import org.quartz.DisallowConcurrentExecution; 8 | import org.quartz.Job; 9 | import org.quartz.JobExecutionContext; 10 | import org.quartz.JobExecutionException; 11 | 12 | import com.zhongxin.quartz.entity.TaskRecordsEntity; 13 | import com.zhongxin.quartz.enums.StatusEnum; 14 | import com.zhongxin.quartz.service.NoticeService; 15 | import com.zhongxin.quartz.service.QuartzService; 16 | import com.zhongxin.quartz.util.Const; 17 | import com.zhongxin.quartz.util.ExceptionUtils; 18 | import com.zhongxin.quartz.util.SpringContext; 19 | 20 | @DisallowConcurrentExecution 21 | public class QuartzJobFactory implements Job { 22 | 23 | protected Logger logger = Logger.getLogger(this.getClass()); 24 | 25 | AtomicInteger ai = new AtomicInteger(0); 26 | 27 | @Override 28 | public void execute(JobExecutionContext context) throws JobExecutionException { 29 | ai = new AtomicInteger(0); 30 | String targetBeanId = context.getMergedJobDataMap().getString("targetObjectId"); 31 | String executorNo = context.getMergedJobDataMap().getString("executorNo"); 32 | String sendType = context.getMergedJobDataMap().getString("sendType"); 33 | String executeParamter = context.getMergedJobDataMap().getString("executeParamter"); 34 | String url = context.getMergedJobDataMap().getString("url"); 35 | logger.info("targetBeanId:" + targetBeanId + "|executorNo:"+ executorNo+ "|sendType:"+ sendType 36 | + "|executeParamter:"+ executeParamter+ "|url:"+ url); 37 | QuartzService quartzService = (QuartzService) SpringContext.getBean("quartzService"); 38 | TaskRecordsEntity recordsEntity =null; 39 | try { 40 | recordsEntity = quartzService.beforeExecute(targetBeanId); 41 | if(null==recordsEntity || (StatusEnum.INIT!=recordsEntity.getTaskStatus())){ 42 | logger.error("targetBeanId:" + targetBeanId+" record error return"); 43 | return; 44 | } 45 | NoticeService noticeService = (NoticeService) SpringContext.getBean("noticeService"); 46 | if (Const.ACTIVE_MQ.equals(sendType)) { 47 | try { 48 | noticeService.sendMQmsg(targetBeanId,executorNo,executeParamter); 49 | } catch (Exception e) { 50 | // TODO: handle exception 51 | logger.error("sendMQmsg send is failed:", e); 52 | ai.incrementAndGet(); 53 | throw e; 54 | } 55 | } else if(Const.URL_REQUEST.equals(sendType)){ 56 | try { 57 | noticeService.httpRequest(url,executeParamter); 58 | } catch (Exception e) { 59 | logger.error("http request is failed:",e); 60 | ai.incrementAndGet(); 61 | throw e; 62 | } 63 | }else{ 64 | logger.info("不支持改类型任务调度,当前类型为:" + sendType); 65 | } 66 | } catch (Exception e) { 67 | logger.info("QuartzJobFactory-execute thorw:",e); 68 | ai.incrementAndGet(); 69 | quartzService.saveTaskErrors(String.valueOf(recordsEntity.getId()),executorNo+e.getMessage(), ExceptionUtils.getStackTrace(e)); 70 | } 71 | if(ai.get() > 0){ 72 | if(null!=recordsEntity){ 73 | recordsEntity = quartzService.modifyTaskRecord(ai.get(), recordsEntity.getId()); 74 | } 75 | quartzService.updateTaskInformations(targetBeanId); 76 | } 77 | // 接收到执行端返回结果在修改任务为未冻结 78 | /*finally{ 79 | if(null!=recordsEntity){ 80 | recordsEntity = quartzService.modifyTaskRecord(ai.get(), recordsEntity.getId()); 81 | } 82 | quartzService.updateTaskInformations(targetBeanId); 83 | }*/ 84 | } 85 | 86 | 87 | 88 | 89 | 90 | 91 | } 92 | -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/vo/TaskInformationsDetailVo.java: -------------------------------------------------------------------------------- 1 | package com.zhongxin.quartz.vo; 2 | 3 | public class TaskInformationsDetailVo { 4 | 5 | private Long id; 6 | private String taskNo; 7 | private String taskName; 8 | private String schedulerRule; 9 | private String frozenStatus; 10 | private String executorNo; 11 | private String frozenTime; 12 | private String unfrozenTime; 13 | private String sendType; 14 | private String url; 15 | private String executeParamter; 16 | private String createTime; 17 | private String lastModifyTime; 18 | private String timeKey; 19 | private String preExecuteTime; 20 | private String taskStatus; 21 | 22 | public String getFrozenTime() { 23 | return frozenTime; 24 | } 25 | 26 | public void setFrozenTime(String frozenTime) { 27 | this.frozenTime = frozenTime; 28 | } 29 | 30 | public String getUnfrozenTime() { 31 | return unfrozenTime; 32 | } 33 | 34 | public void setUnfrozenTime(String unfrozenTime) { 35 | this.unfrozenTime = unfrozenTime; 36 | } 37 | 38 | public String getCreateTime() { 39 | return createTime; 40 | } 41 | 42 | public void setCreateTime(String createTime) { 43 | this.createTime = createTime; 44 | } 45 | 46 | public String getPreExecuteTime() { 47 | return preExecuteTime; 48 | } 49 | 50 | public void setPreExecuteTime(String preExecuteTime) { 51 | this.preExecuteTime = preExecuteTime; 52 | } 53 | 54 | public String getTaskStatus() { 55 | return taskStatus; 56 | } 57 | 58 | public void setTaskStatus(String taskStatus) { 59 | this.taskStatus = taskStatus; 60 | } 61 | 62 | public Long getId() { 63 | return id; 64 | } 65 | 66 | public void setId(Long id) { 67 | this.id = id; 68 | } 69 | 70 | public String getTaskNo() { 71 | return taskNo; 72 | } 73 | 74 | public void setTaskNo(String taskNo) { 75 | this.taskNo = taskNo; 76 | } 77 | 78 | public String getTaskName() { 79 | return taskName; 80 | } 81 | 82 | public void setTaskName(String taskName) { 83 | this.taskName = taskName; 84 | } 85 | 86 | public String getSchedulerRule() { 87 | return schedulerRule; 88 | } 89 | 90 | public void setSchedulerRule(String schedulerRule) { 91 | this.schedulerRule = schedulerRule; 92 | } 93 | 94 | public String getFrozenStatus() { 95 | return frozenStatus; 96 | } 97 | 98 | public void setFrozenStatus(String frozenStatus) { 99 | this.frozenStatus = frozenStatus; 100 | } 101 | 102 | public String getExecutorNo() { 103 | return executorNo; 104 | } 105 | 106 | public void setExecutorNo(String executorNo) { 107 | this.executorNo = executorNo; 108 | } 109 | 110 | public String getSendType() { 111 | return sendType; 112 | } 113 | 114 | public void setSendType(String sendType) { 115 | this.sendType = sendType; 116 | } 117 | 118 | public String getUrl() { 119 | return url; 120 | } 121 | 122 | public void setUrl(String url) { 123 | this.url = url; 124 | } 125 | 126 | public String getExecuteParamter() { 127 | return executeParamter; 128 | } 129 | 130 | public void setExecuteParamter(String executeParamter) { 131 | this.executeParamter = executeParamter; 132 | } 133 | 134 | public String getLastModifyTime() { 135 | return lastModifyTime; 136 | } 137 | 138 | public void setLastModifyTime(String lastModifyTime) { 139 | this.lastModifyTime = lastModifyTime; 140 | } 141 | 142 | public String getTimeKey() { 143 | return timeKey; 144 | } 145 | 146 | public void setTimeKey(String timeKey) { 147 | this.timeKey = timeKey; 148 | } 149 | 150 | } 151 | -------------------------------------------------------------------------------- /src/main/webapp/js/page.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 加载分页信息 3 | * @param currentPage 4 | * @param totalPage 5 | * @param methodName 6 | */ 7 | function page(currentPage,totalPage,methodName){ 8 | $("#page").html(pageInfo(currentPage,totalPage,methodName)); 9 | } 10 | 11 | function pageInfo(currentPage,totalPage,methodName){ 12 | if(methodName==null||methodName==''){ 13 | methodName='queryListInfo'; 14 | } 15 | var liClass = ""; 16 | var linkItem = ""; 17 | var firClass = ""; 18 | var lasClass = ""; 19 | var flag = "false"; 20 | if(currentPage == 1 && currentPage != totalPage){ 21 | firClass = " z-disable"; 22 | }else if(currentPage == totalPage && currentPage != 1){ 23 | lasClass = " z-disable"; 24 | }else if(currentPage == 1 && currentPage == totalPage){ 25 | firClass = " z-disable"; 26 | lasClass = " z-disable"; 27 | } 28 | if(totalPage == 0){ 29 | firClass = " z-disable"; 30 | lasClass = " z-disable"; 31 | } 32 | linkItem += "第一页"; 33 | if(totalPage>=2&¤tPage!=1) { 34 | linkItem += "<"; 35 | } 36 | if(totalPage < 8){ 37 | for(var i=1;i<=totalPage;i++){ 38 | if(i==currentPage){ 39 | liClass=" class='z-active'"; 40 | }else{ 41 | liClass=" "; 42 | } 43 | linkItem += ""+i+""; 44 | } 45 | }else{ 46 | for(var i=1;i<=totalPage;i++){ 47 | if(i==currentPage){ 48 | liClass=" class='z-active'"; 49 | }else{ 50 | liClass=" "; 51 | } 52 | if(i > 5 && i < totalPage){ 53 | if((i == currentPage)||(i == (parseInt(currentPage,10)+1))||(i == (parseInt(currentPage,10)-1))){ 54 | linkItem += ""+i+""; 55 | }else{ 56 | if(flag=="false"){ 57 | linkItem += "..."; 58 | flag = "true;" 59 | } 60 | } 61 | }else{ 62 | if(i > 2 && i < totalPage){ 63 | if((i == currentPage)||(i == (parseInt(currentPage,10)+1))||(i == (parseInt(currentPage,10)-1))){ 64 | linkItem += ""+i+""; 65 | }else{ 66 | if(flag=="false"){ 67 | linkItem += "..."; 68 | flag = "true;" 69 | } 70 | } 71 | }else{ 72 | linkItem += ""+i+""; 73 | } 74 | } 75 | } 76 | } 77 | 78 | if(totalPage>=2&¤tPage!=totalPage){ 79 | var pgindex=parseInt(currentPage)+1; 80 | linkItem += ">"; 81 | } 82 | if(totalPage == 0){ 83 | linkItem += "最末页" 84 | }else{ 85 | linkItem += "最末页" 86 | } 87 | 88 | return linkItem; 89 | } 90 | 91 | function firstPage(methodName){ 92 | currentPage = 1; 93 | var first = methodName+"(1)"; 94 | return first; 95 | } 96 | 97 | function lastPage(methodName,totalPage){ 98 | currentPage = totalPage; 99 | var last = methodName+"("+totalPage+")"; 100 | return last; 101 | } 102 | 103 | function isEmpty(param){ 104 | if(typeof(param)=='undefined'){ 105 | return ''; 106 | } 107 | return param; 108 | } -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/util/DateUtil.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright: Copyright (c)2014 3 | * Company: 支付通(ICardPay) 4 | */ 5 | package com.zhongxin.quartz.util; 6 | 7 | import java.text.ParseException; 8 | import java.text.SimpleDateFormat; 9 | import java.util.Calendar; 10 | import java.util.Date; 11 | 12 | import org.slf4j.Logger; 13 | import org.slf4j.LoggerFactory; 14 | 15 | /** 16 | * @author:eddysheng 17 | * @since:2014-3-18 上午10:38:36 18 | * @version: 19 | */ 20 | public class DateUtil { 21 | 22 | private static Logger logger = LoggerFactory.getLogger(DateUtil.class); 23 | 24 | /** 25 | * 获取昨日秒数 26 | * 27 | * @return 28 | */ 29 | public static long getDayBefore(int days) { 30 | String format = "yyyy-MM-DD"; 31 | String dayString = DateUtils.toString( 32 | new Date(System.currentTimeMillis() - days * 24 * 60 * 60 33 | * 1000), format); 34 | Date day = null; 35 | try { 36 | day = DateUtils.parseDate(dayString, format); 37 | } catch (ParseException e) { 38 | logger.error("Date parse error:{}", e.getMessage()); 39 | throw new RuntimeException(e); 40 | } 41 | return day.getTime() / 1000; 42 | } 43 | 44 | public static long getToday() { 45 | String format = "yyyy-MM-DD"; 46 | String toDayString = DateUtils.toString( 47 | new Date(System.currentTimeMillis()), format); 48 | Date toDay = null; 49 | try { 50 | toDay = DateUtils.parseDate(toDayString, format); 51 | } catch (ParseException e) { 52 | logger.error("Date parse error:{}", e.getMessage()); 53 | throw new RuntimeException(e); 54 | } 55 | return toDay.getTime() / 1000; 56 | } 57 | 58 | public static long getDayAfter(int days) { 59 | String format = "yyyy-MM-DD"; 60 | String dayString = DateUtils.toString( 61 | new Date(System.currentTimeMillis() + days * 24 * 60 * 60 62 | * 1000), format); 63 | Date day = null; 64 | try { 65 | day = DateUtils.parseDate(dayString, format); 66 | } catch (ParseException e) { 67 | logger.error("Date parse error:{}", e.getMessage()); 68 | throw new RuntimeException(e); 69 | } 70 | return day.getTime() / 1000; 71 | } 72 | 73 | public static long getLastModifyTime() { 74 | return System.currentTimeMillis(); 75 | } 76 | 77 | public static String getTimeKeyValue(String timeKey) { 78 | return DateUtils.toString(new Date(), timeKey); 79 | } 80 | 81 | public static long getGapDays(long time) { 82 | if ((time + "").length() == 10) { 83 | time = time * 1000; 84 | } 85 | return getDaysBetween(new Date(), new Date(time)); 86 | 87 | } 88 | 89 | public static Long getDaysBetween(Date startDate, Date endDate) { 90 | Calendar fromCalendar = Calendar.getInstance(); 91 | fromCalendar.setTime(startDate); 92 | fromCalendar.set(Calendar.HOUR_OF_DAY, 0); 93 | fromCalendar.set(Calendar.MINUTE, 0); 94 | fromCalendar.set(Calendar.SECOND, 0); 95 | fromCalendar.set(Calendar.MILLISECOND, 0); 96 | 97 | Calendar toCalendar = Calendar.getInstance(); 98 | toCalendar.setTime(endDate); 99 | toCalendar.set(Calendar.HOUR_OF_DAY, 0); 100 | toCalendar.set(Calendar.MINUTE, 0); 101 | toCalendar.set(Calendar.SECOND, 0); 102 | toCalendar.set(Calendar.MILLISECOND, 0); 103 | 104 | return (toCalendar.getTime().getTime() - fromCalendar.getTime() 105 | .getTime()) / (1000 * 60 * 60 * 24); 106 | } 107 | 108 | /** 109 | * 将长整形数据格式化为yyyy-MM-dd的字符串样式 110 | * 111 | * @param date 112 | * @return 113 | */ 114 | public static String formatDateToString(Long date) { 115 | if ((date + "").length() == 10) { 116 | date = date * 1000; 117 | } 118 | return DateUtils.toString(new Date(date), "yyyy年MM月dd日"); 119 | } 120 | 121 | public static long formatStringToLong(String dateString) { 122 | try { 123 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 124 | Date date = sdf.parse(dateString); 125 | return date.getTime(); 126 | } catch (ParseException e) { 127 | return 0l; 128 | } 129 | } 130 | 131 | } 132 | -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/util/HttpClientUtil.java: -------------------------------------------------------------------------------- 1 | package com.zhongxin.quartz.util; 2 | 3 | import java.io.IOException; 4 | import java.net.URI; 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | import org.apache.http.NameValuePair; 10 | import org.apache.http.client.entity.UrlEncodedFormEntity; 11 | import org.apache.http.client.methods.CloseableHttpResponse; 12 | import org.apache.http.client.methods.HttpGet; 13 | import org.apache.http.client.methods.HttpPost; 14 | import org.apache.http.client.utils.URIBuilder; 15 | import org.apache.http.entity.ContentType; 16 | import org.apache.http.entity.StringEntity; 17 | import org.apache.http.impl.client.CloseableHttpClient; 18 | import org.apache.http.impl.client.HttpClients; 19 | import org.apache.http.message.BasicNameValuePair; 20 | import org.apache.http.util.EntityUtils; 21 | 22 | /** 23 | * 24 | *

Title:HttpClientUtil.java

25 | *

Description:http工具类

26 | *

Copyright:Copyright (c) 2010

27 | */ 28 | public class HttpClientUtil { 29 | 30 | public static String doGet(String url, Map param) { 31 | 32 | // 创建Httpclient对象 33 | CloseableHttpClient httpclient = HttpClients.createDefault(); 34 | 35 | String resultString = ""; 36 | CloseableHttpResponse response = null; 37 | try { 38 | // 创建uri 39 | URIBuilder builder = new URIBuilder(url); 40 | if (param != null) { 41 | for (String key : param.keySet()) { 42 | builder.addParameter(key, param.get(key)); 43 | } 44 | } 45 | URI uri = builder.build(); 46 | 47 | // 创建http GET请求 48 | HttpGet httpGet = new HttpGet(uri); 49 | 50 | // 执行请求 51 | response = httpclient.execute(httpGet); 52 | // 判断返回状态是否为200 53 | if (response.getStatusLine().getStatusCode() == 200) { 54 | resultString = EntityUtils.toString(response.getEntity(), "UTF-8"); 55 | } 56 | } catch (Exception e) { 57 | e.printStackTrace(); 58 | } finally { 59 | try { 60 | if (response != null) { 61 | response.close(); 62 | } 63 | httpclient.close(); 64 | } catch (IOException e) { 65 | e.printStackTrace(); 66 | } 67 | } 68 | return resultString; 69 | } 70 | 71 | public static String doGet(String url) { 72 | return doGet(url, null); 73 | } 74 | 75 | public static String doPost(String url, Map param) { 76 | // 创建Httpclient对象 77 | CloseableHttpClient httpClient = HttpClients.createDefault(); 78 | CloseableHttpResponse response = null; 79 | String resultString = ""; 80 | try { 81 | // 创建Http Post请求 82 | HttpPost httpPost = new HttpPost(url); 83 | // 创建参数列表 84 | if (param != null) { 85 | List paramList = new ArrayList<>(); 86 | for (String key : param.keySet()) { 87 | paramList.add(new BasicNameValuePair(key, param.get(key))); 88 | } 89 | // 模拟表单 90 | UrlEncodedFormEntity entity = new UrlEncodedFormEntity(paramList); 91 | httpPost.setEntity(entity); 92 | } 93 | // 执行http请求 94 | response = httpClient.execute(httpPost); 95 | resultString = EntityUtils.toString(response.getEntity(), "utf-8"); 96 | } catch (Exception e) { 97 | e.printStackTrace(); 98 | } finally { 99 | try { 100 | response.close(); 101 | } catch (IOException e) { 102 | // TODO Auto-generated catch block 103 | e.printStackTrace(); 104 | } 105 | } 106 | 107 | return resultString; 108 | } 109 | 110 | public static String doPost(String url) { 111 | return doPost(url, null); 112 | } 113 | 114 | public static String doPostJson(String url, String json) { 115 | // 创建Httpclient对象 116 | CloseableHttpClient httpClient = HttpClients.createDefault(); 117 | CloseableHttpResponse response = null; 118 | String resultString = ""; 119 | try { 120 | // 创建Http Post请求 121 | HttpPost httpPost = new HttpPost(url); 122 | // 创建请求内容 123 | StringEntity entity = new StringEntity(json, ContentType.APPLICATION_JSON); 124 | httpPost.setEntity(entity); 125 | // 执行http请求 126 | response = httpClient.execute(httpPost); 127 | resultString = EntityUtils.toString(response.getEntity(), "utf-8"); 128 | } catch (Exception e) { 129 | e.printStackTrace(); 130 | } finally { 131 | try { 132 | response.close(); 133 | } catch (IOException e) { 134 | // TODO Auto-generated catch block 135 | e.printStackTrace(); 136 | } 137 | } 138 | 139 | return resultString; 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /src/main/resources/mybatis/mapper/TaskInformationsMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | version,taskNo,taskName,schedulerRule,frozenStatus,executorNo,sendType,frozenTime,unfrozenTime, 7 | createTime,lastModifyTime,url,executeParamter,timeKey 8 | 9 | 10 | 18 | 19 | 37 | 38 | 61 | 62 | 68 | 69 | 77 | 78 | 86 | 87 | 88 | insert into quartz_task_informations 89 | ( 90 | 91 | ) 92 | values 93 | ( 94 | #{version}, 95 | #{taskNo}, 96 | #{taskName}, 97 | #{schedulerRule}, 98 | #{frozenStatus}, 99 | #{executorNo}, 100 | #{sendType}, 101 | #{frozenTime}, 102 | #{unfrozenTime}, 103 | #{createTime}, 104 | #{lastModifyTime}, 105 | #{url}, 106 | #{executeParamter}, 107 | #{timeKey} 108 | ) 109 | 110 | 111 | 112 | update 113 | quartz_task_informations 114 | set 115 | 116 | frozenStatus = #{frozenStatus}, 117 | 118 | 119 | frozenTime = #{frozenTime}, 120 | 121 | 122 | unfrozenTime = #{unfrozenTime}, 123 | 124 | 125 | taskNo = #{taskNo}, 126 | 127 | 128 | taskName = #{taskName}, 129 | 130 | 131 | schedulerRule = #{schedulerRule}, 132 | 133 | 134 | executorNo = #{executorNo}, 135 | 136 | 137 | sendType = #{sendType}, 138 | 139 | 140 | timeKey = #{timeKey}, 141 | 142 | lastModifyTime = #{lastModifyTime}, 143 | url = #{url}, 144 | executeParamter = #{executeParamter}, 145 | version = #{version}+1 146 | where 147 | id = #{id} and 148 | version = #{version} 149 | 150 | 151 | 152 | -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/controller/SchedulerController.java: -------------------------------------------------------------------------------- 1 | package com.zhongxin.quartz.controller; 2 | 3 | import java.util.List; 4 | 5 | import javax.annotation.Resource; 6 | import javax.servlet.http.HttpServletRequest; 7 | 8 | import org.springframework.stereotype.Controller; 9 | import org.springframework.web.bind.annotation.PathVariable; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.ResponseBody; 12 | import org.springframework.web.servlet.ModelAndView; 13 | 14 | import com.zhongxin.quartz.dao.TaskInformationsDao; 15 | import com.zhongxin.quartz.entity.TaskInformationsEntity; 16 | import com.zhongxin.quartz.service.QuartzService; 17 | import com.zhongxin.quartz.util.Const; 18 | import com.zhongxin.quartz.util.Page; 19 | import com.zhongxin.quartz.vo.TaskInformationsDetailVo; 20 | import com.zhongxin.quartz.vo.TaskInformationsVo; 21 | @Controller 22 | @RequestMapping("/scheduler") 23 | public class SchedulerController extends BaseController{ 24 | 25 | @Resource 26 | private QuartzService quartzServer; 27 | 28 | @Resource 29 | private TaskInformationsDao taskInformationsDao; 30 | 31 | /** 32 | * 重启指定任务 33 | * @param jobKey 34 | * @return 35 | */ 36 | @RequestMapping("/resumeScheduler/{jobKey}") 37 | public @ResponseBody String resumeScheduler(@PathVariable String jobKey){ 38 | logger.info("开始重新调度任务"); 39 | String msg = null; 40 | try { 41 | msg = quartzServer.resumeScheduler(jobKey); 42 | logger.info("重新调度任务完成"); 43 | return msg; 44 | } catch (Exception e) { 45 | logger.info("重新调度任务异常:", e); 46 | return msg; 47 | } 48 | } 49 | 50 | /** 51 | * 增加任务调度 52 | * @return 53 | */ 54 | @RequestMapping("/addScheduler/{jobKey}") 55 | public @ResponseBody String addScheduler(@PathVariable String jobKey){ 56 | logger.info("增加任务调用开始"); 57 | String msg = null; 58 | try { 59 | msg = quartzServer.addScheduler(jobKey); 60 | logger.info("增加任务调度成功"); 61 | return msg; 62 | } catch (Exception e) { 63 | logger.info("异常:",e); 64 | return msg; 65 | } 66 | } 67 | 68 | /** 69 | * 从定时器中删除指定任务 70 | * @param jobKey 71 | * @return 72 | */ 73 | @RequestMapping("/delScheduler/{jobKey}") 74 | public @ResponseBody String delScheduler(@PathVariable String jobKey){ 75 | logger.info("删除任务调用开始"); 76 | String msg = null; 77 | try { 78 | msg = quartzServer.delScheduler(jobKey); 79 | logger.info("删除任务调度成功"); 80 | return msg; 81 | } catch (Exception e) { 82 | logger.info("异常:",e); 83 | return msg; 84 | } 85 | } 86 | 87 | /** 88 | * 全部任务重新调度 89 | * @return 90 | */ 91 | @RequestMapping("/resumeSchedulerAll") 92 | public @ResponseBody String resumeSchedulerAll(){ 93 | logger.info("开始重新调度任务"); 94 | String msg = null; 95 | try { 96 | msg = quartzServer.resumeSchedulerAll(); 97 | logger.info("重新调度任务完成"); 98 | return msg; 99 | } catch (Exception e) { 100 | logger.info("重新调度任务异常:", e); 101 | return msg; 102 | } 103 | } 104 | 105 | @RequestMapping("/testUrl") 106 | public @ResponseBody String testUrl(HttpServletRequest request){ 107 | String param = request.getParameter("executeParamter"); 108 | logger.info("http调用成功:" + "-----参数:" +param); 109 | 110 | return Const.SUCCESS; 111 | } 112 | 113 | @RequestMapping("/list/{currentPage}") 114 | public ModelAndView getTaskInformationsList(@PathVariable int currentPage){ 115 | ModelAndView view = new ModelAndView("/page/quartzList.jsp"); 116 | List voList = quartzServer.getList(currentPage); 117 | int count = quartzServer.getTotalCount(); 118 | Page page = new Page(count); 119 | page.setCurrentPage(currentPage); 120 | page.setList(voList); 121 | view.addObject("page",page); 122 | return view; 123 | } 124 | 125 | @RequestMapping("/detail/{taskNo}") 126 | public ModelAndView getTaskDetail(@PathVariable String taskNo){ 127 | ModelAndView view = new ModelAndView("/page/quartzDetail.jsp"); 128 | TaskInformationsDetailVo detail = quartzServer.getTaskDetail(taskNo); 129 | view.addObject("detail",detail); 130 | return view; 131 | } 132 | 133 | @RequestMapping("/taskEditPage/{id}") 134 | public ModelAndView taskEditPage(@PathVariable long id){ 135 | ModelAndView view = new ModelAndView("/page/quartzEdit.jsp"); 136 | if(0 != id){ 137 | TaskInformationsEntity entity = quartzServer.selectTaskInfoById(id); 138 | view.addObject("taskInfo",entity); 139 | view.addObject("title","编辑定时任务"); 140 | }else{ 141 | view.addObject("title","新建定时任务"); 142 | } 143 | return view; 144 | } 145 | 146 | @RequestMapping("/edit") 147 | @ResponseBody 148 | public String editTaskInfo(TaskInformationsEntity entity){ 149 | int count = quartzServer.editTaskInformation(entity); 150 | if(count == 1){ 151 | return Const.SUCCESS; 152 | }else if(count == 2){ 153 | return Const.RELOAD; 154 | }else{ 155 | return Const.FAILED; 156 | } 157 | } 158 | 159 | @RequestMapping("/executeOnce/{taskNo}") 160 | @ResponseBody 161 | public String executeOnce(@PathVariable String taskNo){ 162 | String msg = quartzServer.executeOnce(taskNo); 163 | return msg; 164 | } 165 | 166 | @RequestMapping("/checkTaskNo/{taskNo}") 167 | @ResponseBody 168 | public String checkTaskNo(@PathVariable String taskNo){ 169 | TaskInformationsEntity entity = taskInformationsDao.getTaskByTaskNo(taskNo); 170 | if(null != entity){ 171 | return Const.FAILED; 172 | }else{ 173 | return Const.SUCCESS; 174 | } 175 | } 176 | 177 | } 178 | -------------------------------------------------------------------------------- /src/main/webapp/page/taskRecordsList.jsp: -------------------------------------------------------------------------------- 1 | <%@ page pageEncoding="UTF-8" isELIgnored ="false" %> 2 | <%@include file="/page/public/taglib.jsp"%> 3 | 4 | 5 | 6 | 定时任务记录列表页面 7 | <%@include file="/page/public/csslib.jsp"%> 8 | 9 | 10 |
11 |
12 | 13 |
14 |
15 | 21 |
22 | 45 |
46 |
47 |
48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 71 | 72 | 73 | 74 | 75 |
任务编号timeKeyValue执行时间时长执行状态失败数
${task.taskNo }${task.timeKeyValue }${task.executeTime }${task.time } 67 | 初始 68 | 成功 69 | 失败 70 | ${task.failcount }
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 | 84 | 85 | 86 | <%@include file="/page/public/footer.jsp"%> 87 | 114 | 115 | -------------------------------------------------------------------------------- /src/main/webapp/page/quartzList.jsp: -------------------------------------------------------------------------------- 1 | <%@ page pageEncoding="UTF-8" isELIgnored ="false" %> 2 | <%@include file="/page/public/taglib.jsp"%> 3 | 4 | 5 | 6 | 定时任务列表页面 7 | <%@include file="/page/public/csslib.jsp"%> 8 | 9 | 10 |
11 |
12 | 13 |
14 |
15 | 26 |
27 |
28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 63 | 64 | 65 | 66 |
任务编号任务名称定时配置冻结状态执行方执行方式最后修改时间操作
${task.taskNo}${task.taskName }${task.schedulerRule }${task.frozenStatus }${task.executorNo }${task.sendType }${task.lastModifyTime } 52 | 53 | 启动 54 | 55 | 56 | <%-- 重启 --%> 57 | 暂停 58 | 59 | 立刻运行 60 | 修改 61 | 详情 62 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 | 75 | 76 | <%@include file="/page/public/footer.jsp"%> 77 | 162 | 163 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | zx-quartz 7 | zx-quartz 8 | war 9 | 1.0-SNAPSHOT 10 | zx-quartz 11 | http://maven.apache.org 12 | 13 | UTF-8 14 | 15 | 4.0.6.RELEASE 16 | 3.2.8 17 | 1.6.1 18 | 19 | 20 | 21 | 22 | 23 | org.springframework 24 | spring-aop 25 | ${org.springframework-version} 26 | 27 | 28 | org.springframework 29 | spring-core 30 | ${org.springframework-version} 31 | 32 | 33 | org.springframework 34 | spring-beans 35 | ${org.springframework-version} 36 | 37 | 38 | org.springframework 39 | spring-context-support 40 | ${org.springframework-version} 41 | 42 | 43 | org.springframework 44 | spring-context 45 | ${org.springframework-version} 46 | 47 | 48 | org.springframework 49 | spring-jdbc 50 | ${org.springframework-version} 51 | 52 | 53 | org.springframework 54 | spring-webmvc 55 | ${org.springframework-version} 56 | 57 | 58 | org.springframework 59 | spring-jms 60 | ${org.springframework-version} 61 | 62 | 63 | 64 | mysql 65 | mysql-connector-java 66 | 5.1.34 67 | 68 | 69 | org.mybatis 70 | mybatis 71 | ${org.mybatis-version} 72 | 73 | 74 | org.mybatis 75 | mybatis-spring 76 | 1.2.2 77 | 78 | 79 | 80 | org.quartz-scheduler 81 | quartz 82 | 2.2.1 83 | 84 | 85 | 86 | org.aspectj 87 | aspectjweaver 88 | 1.8.5 89 | 90 | 91 | 92 | com.alibaba 93 | fastjson 94 | 1.1.39 95 | 96 | 97 | 98 | log4j 99 | log4j 100 | 1.2.16 101 | 102 | 103 | org.slf4j 104 | slf4j-api 105 | ${org.slf4j-version} 106 | 107 | 108 | org.slf4j 109 | slf4j-log4j12 110 | ${org.slf4j-version} 111 | 112 | 113 | commons-logging 114 | commons-logging 115 | 1.2 116 | 117 | 118 | javax.servlet 119 | servlet-api 120 | 2.5 121 | provided 122 | 123 | 124 | 125 | javax.servlet.jsp 126 | jsp-api 127 | 2.0 128 | provided 129 | 130 | 131 | 147 | 148 | commons-lang 149 | commons-lang 150 | 2.5 151 | 152 | 153 | 154 | 155 | org.apache.httpcomponents 156 | httpclient 157 | 4.5.2 158 | 159 | 160 | 161 | 162 | javax.jms 163 | jms-api 164 | 1.1-rev-1 165 | 166 | 167 | org.apache.activemq 168 | activemq-client 169 | 5.9.1 170 | 171 | 172 | org.apache.activemq 173 | activemq-pool 174 | 5.9.1 175 | 176 | 177 | 178 | jstl 179 | jstl 180 | 1.2 181 | 182 | 183 | 184 | 185 | zx-quartz 186 | 187 | 188 | 189 | org.apache.maven.plugins 190 | maven-compiler-plugin 191 | 3.3 192 | 193 | 1.7 194 | 1.7 195 | 196 | 197 | 198 | 199 | 200 | org.apache.tomcat.maven 201 | tomcat7-maven-plugin 202 | 203 | 8080 204 | / 205 | UTF-8 206 | 207 | 208 | 209 | 210 | org.apache.maven.plugins 211 | maven-eclipse-plugin 212 | 213 | [artifactId] 214 | true 215 | true 216 | 2.0 217 | ${basedir}/src/main/resources/META-INF/MANIFEST.MF 218 | 219 | 220 | 221 | 222 | -------------------------------------------------------------------------------- /src/main/webapp/page/quartzEdit.jsp: -------------------------------------------------------------------------------- 1 | <%@ page pageEncoding="UTF-8" isELIgnored ="false" %> 2 | <%@include file="/page/public/taglib.jsp"%> 3 | 4 | 5 | 6 | ${title } 7 | <%@include file="/page/public/csslib.jsp"%> 8 | 9 | 10 |
11 |
12 |
13 |
14 | 17 |
18 |
19 |
20 |
21 |
22 |
任务编号:
23 |
24 |
25 | 26 |
27 |
28 |
29 |
30 |
31 |
任务名称:
32 |
33 |
34 | 35 |
36 |
37 |
38 |
39 |
40 |
定时配置:
41 |
42 |
43 | (如:0 0 12 * * ? 每天中午12点触发) 44 |
45 |
46 |
47 |
48 |
49 |
冻结状态:
50 |
51 |
52 | 58 |
59 |
60 |
61 |
62 |
执行方:
63 |
64 |
65 | 66 |
67 |
68 |
69 |
70 |
71 |
执行方式:
72 |
73 |
74 | 78 |
79 |
80 |
81 |
82 |
url:
83 |
84 |
85 | 86 |
87 |
88 |
89 |
90 |
91 |
参数:
92 |
93 |
94 | 95 |
96 |
97 |
98 |
99 |
timeKey:
100 |
101 |
102 | (如:yyyy-MM-dd HH:mm) 103 |
104 |
105 |
106 |
107 |
108 |
109 |               110 | 111 |
112 |
113 |
114 |
115 | 116 | 117 | 118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 | <%@include file="/page/public/footer.jsp"%> 126 | 244 | 245 | -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/service/impl/QuartzServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.zhongxin.quartz.service.impl; 2 | 3 | import java.util.List; 4 | import java.util.concurrent.atomic.AtomicInteger; 5 | 6 | import javax.annotation.Resource; 7 | 8 | import org.quartz.CronScheduleBuilder; 9 | import org.quartz.CronTrigger; 10 | import org.quartz.JobBuilder; 11 | import org.quartz.JobDetail; 12 | import org.quartz.JobKey; 13 | import org.quartz.Scheduler; 14 | import org.quartz.SchedulerException; 15 | import org.quartz.TriggerBuilder; 16 | import org.quartz.TriggerKey; 17 | import org.springframework.beans.factory.annotation.Autowired; 18 | import org.springframework.scheduling.quartz.SchedulerFactoryBean; 19 | import org.springframework.stereotype.Service; 20 | 21 | import org.slf4j.Logger; 22 | import org.slf4j.LoggerFactory; 23 | import com.zhongxin.quartz.core.QuartzJobFactory; 24 | import com.zhongxin.quartz.dao.TaskErrorsDao; 25 | import com.zhongxin.quartz.dao.TaskInformationsDao; 26 | import com.zhongxin.quartz.dao.TaskRecordsDao; 27 | import com.zhongxin.quartz.entity.TaskErrorsEntity; 28 | import com.zhongxin.quartz.entity.TaskInformationsEntity; 29 | import com.zhongxin.quartz.entity.TaskRecordsEntity; 30 | import com.zhongxin.quartz.enums.StatusEnum; 31 | import com.zhongxin.quartz.enums.TaskStatusEnum; 32 | import com.zhongxin.quartz.service.NoticeService; 33 | import com.zhongxin.quartz.service.QuartzService; 34 | import com.zhongxin.quartz.util.Const; 35 | import com.zhongxin.quartz.util.DateUtil; 36 | import com.zhongxin.quartz.util.ExceptionUtils; 37 | import com.zhongxin.quartz.vo.TaskInformationsDetailVo; 38 | import com.zhongxin.quartz.vo.TaskInformationsVo; 39 | 40 | @Service("quartzService") 41 | public class QuartzServiceImpl implements QuartzService{ 42 | 43 | protected Logger logger = LoggerFactory.getLogger(this.getClass()); 44 | 45 | @Resource 46 | private TaskInformationsDao taskInformationsDao; 47 | @Resource 48 | private TaskRecordsDao recordsDao; 49 | @Resource 50 | private TaskErrorsDao taskErrorsDao; 51 | @Autowired 52 | SchedulerFactoryBean schedulerBean; 53 | @Resource 54 | private NoticeService noticeService; 55 | 56 | AtomicInteger ai = new AtomicInteger(0); 57 | 58 | public void initScheduler(){ 59 | List taskList = taskInformationsDao.getTaskList(); 60 | Scheduler scheduler = schedulerBean.getScheduler(); 61 | for(TaskInformationsEntity task : taskList){ 62 | try { 63 | this.scheduler(task, scheduler); 64 | } catch (Exception e) { 65 | logger.error("定时:" + task.getTaskNo() + "启动失败"); 66 | } 67 | } 68 | } 69 | 70 | /** 71 | * 增加任务到定时器 72 | * @param key 73 | * @return 74 | */ 75 | public String addScheduler(String key){ 76 | TaskInformationsEntity entity = taskInformationsDao.getTaskByTaskNo(key); 77 | if(null != entity){ 78 | Scheduler scheduler = schedulerBean.getScheduler(); 79 | try { 80 | scheduler.deleteJob(new JobKey(key)); 81 | this.scheduler(entity, scheduler); 82 | entity.setFrozenStatus(TaskStatusEnum.UNFROZEN); 83 | entity.setUnfrozenTime(DateUtil.getLastModifyTime()); 84 | entity.setLastModifyTime(DateUtil.getLastModifyTime()); 85 | taskInformationsDao.updateById(entity); 86 | return "任务启动成功"; 87 | } catch (Exception e) { 88 | logger.info("异常:",e); 89 | return "任务启动失败"; 90 | } 91 | }else{ 92 | return "该任务编号不存在"; 93 | } 94 | } 95 | 96 | /** 97 | * 删除任务从定时器中 98 | * @param key 99 | * @return 100 | */ 101 | public String delScheduler(String key){ 102 | TaskInformationsEntity entity = taskInformationsDao.getTaskByTaskNo(key); 103 | if(null != entity && TaskStatusEnum.UNFROZEN == entity.getFrozenStatus()){ 104 | Scheduler scheduler = schedulerBean.getScheduler(); 105 | try { 106 | scheduler.deleteJob(new JobKey(key)); 107 | entity.setFrozenStatus(TaskStatusEnum.FROZEN); 108 | entity.setFrozenTime(DateUtil.getLastModifyTime()); 109 | entity.setLastModifyTime(DateUtil.getLastModifyTime()); 110 | taskInformationsDao.updateById(entity); 111 | return "暂停任务成功"; 112 | } catch (Exception e) { 113 | logger.error("异常:",e); 114 | return "暂停任务异常"; 115 | } 116 | }else{ 117 | return "该任务编号不存在"; 118 | } 119 | } 120 | 121 | /** 122 | * 重启 123 | */ 124 | public String resumeScheduler(String key){ 125 | TaskInformationsEntity entity = taskInformationsDao.getTaskByTaskNo(key); 126 | if(null != entity){ 127 | Scheduler scheduler = schedulerBean.getScheduler(); 128 | try { 129 | scheduler.deleteJob(new JobKey(key)); 130 | this.scheduler(entity, scheduler); 131 | return "重启成功"; 132 | } catch (SchedulerException e) { 133 | logger.info("异常:",e); 134 | return "重启异常"; 135 | } 136 | }else{ 137 | return "该任务编号不存在"; 138 | } 139 | } 140 | 141 | /** 142 | * 全部重启 143 | * @return 144 | */ 145 | public String resumeSchedulerAll(){ 146 | List taskList = taskInformationsDao.getTaskList(); 147 | Scheduler scheduler = schedulerBean.getScheduler(); 148 | try { 149 | scheduler.clear(); 150 | } catch (SchedulerException e1) { 151 | logger.error("异常:",e1); 152 | } 153 | for(TaskInformationsEntity entity : taskList){ 154 | try { 155 | this.scheduler(entity, scheduler); 156 | } catch (Exception e) { 157 | logger.error("异常:",e); 158 | return "重启异常"; 159 | } 160 | } 161 | return "重启成功"; 162 | } 163 | 164 | public void scheduler(TaskInformationsEntity task,Scheduler scheduler){ 165 | TriggerKey triggerKey = TriggerKey.triggerKey(task.getTaskNo(), Scheduler.DEFAULT_GROUP); 166 | JobDetail jobDetail = JobBuilder.newJob(QuartzJobFactory.class).withDescription(task.getTaskName()).withIdentity(task.getTaskNo(), Scheduler.DEFAULT_GROUP).build(); 167 | jobDetail.getJobDataMap().put("targetObjectId", task.getTaskNo()); 168 | jobDetail.getJobDataMap().put("executorNo", task.getExecutorNo()); 169 | jobDetail.getJobDataMap().put("sendType", task.getSendType()); 170 | jobDetail.getJobDataMap().put("url", task.getUrl()); 171 | jobDetail.getJobDataMap().put("executeParamter", task.getExecuteParamter()); 172 | CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(task.getSchedulerRule()); 173 | CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity(triggerKey).withSchedule(scheduleBuilder).build(); 174 | try { 175 | scheduler.scheduleJob(jobDetail, trigger); 176 | logger.info("task "+task.getTaskNo()+" schedulerRule :"+task.getSchedulerRule()+" reload succeed"); 177 | } catch (Exception e) { 178 | logger.error("scheduler--异常:",e); 179 | throw new RuntimeException(); 180 | } 181 | } 182 | 183 | /** 184 | * 执行一次当前任务 185 | * @param taskNo 186 | * @return 187 | */ 188 | public String executeOnce(String taskNo){ 189 | TaskInformationsEntity entity = taskInformationsDao.getTaskByTaskNo(taskNo); 190 | String msg = "执行成功"; 191 | if(null != entity){ 192 | TaskRecordsEntity recordsEntity =null; 193 | try { 194 | recordsEntity = beforeExecute(taskNo); 195 | if(null==recordsEntity || (StatusEnum.INIT!=recordsEntity.getTaskStatus())){ 196 | logger.error("targetBeanId:" + taskNo+" record error return"); 197 | return "执行失败,该任务已冻结或该时间段可能已经执行。"; 198 | } 199 | if(Const.ACTIVE_MQ.equals(entity.getSendType())){ 200 | try { 201 | noticeService.sendMQmsg(taskNo,entity.getExecutorNo(),entity.getExecuteParamter()); 202 | } catch (Exception e) { 203 | // TODO: handle exception 204 | logger.error("sendMQmsg send is failed:", e); 205 | ai.incrementAndGet(); 206 | throw e; 207 | } 208 | }else if (Const.URL_REQUEST.equals(entity.getSendType())){ 209 | try { 210 | noticeService.httpRequest(entity.getUrl(),entity.getExecuteParamter()); 211 | } catch (Exception e) { 212 | logger.error("http request is failed:",e); 213 | ai.incrementAndGet(); 214 | throw e; 215 | } 216 | }else{ 217 | return "不支持当前类型"; 218 | } 219 | } catch (Exception e) { 220 | logger.info("QuartzJobFactory-execute thorw:",e); 221 | saveTaskErrors(String.valueOf(recordsEntity.getId()),entity.getExecutorNo()+e.getMessage(), ExceptionUtils.getStackTrace(e)); 222 | msg = "执行失败"; 223 | } 224 | if(ai.get() > 0){ 225 | if(null!=recordsEntity){ 226 | recordsEntity = modifyTaskRecord(ai.get(), recordsEntity.getId()); 227 | } 228 | updateTaskInformations(taskNo); 229 | } 230 | /*finally{ 231 | if(null!=recordsEntity){ 232 | recordsEntity = modifyTaskRecord(ai.get(), recordsEntity.getId()); 233 | } 234 | updateTaskInformations(taskNo); 235 | }*/ 236 | }else{ 237 | return "当前任务不存在"; 238 | } 239 | return msg; 240 | } 241 | 242 | /** 243 | * 执行前操作 244 | * @return 245 | */ 246 | public TaskRecordsEntity beforeExecute(String taskNo){ 247 | try { 248 | TaskRecordsEntity taskRecordsEntity =null; 249 | TaskInformationsEntity taskInformationsEntity = taskInformationsDao.getTaskByTaskNo(taskNo); 250 | if(null == taskInformationsEntity || TaskStatusEnum.FROZEN == taskInformationsEntity.getFrozenStatus()){ 251 | logger.warn("taskNo :"+taskNo+" is not exits or taskNo is frozed.",taskInformationsEntity); 252 | return null; 253 | } 254 | String timeKeyValue = DateUtil.getTimeKeyValue(taskInformationsEntity.getTimeKey()); 255 | logger.info("timeKeyValue:" + timeKeyValue); 256 | // TaskRecordsEntity recordsEntity = recordsDao.getRecordsByTaskNo(taskNo,timeKeyValue); 257 | // if(null != recordsEntity){ 258 | // logger.info("task no :" + taskNo + " this time " + timeKeyValue + " hava been executed"); 259 | // return null; 260 | // } 261 | 262 | // taskInformationsEntity.setFrozenStatus(TaskStatusEnum.FROZEN); 263 | taskInformationsEntity.setFrozenTime(DateUtil.getLastModifyTime()); 264 | taskInformationsEntity.setLastModifyTime(DateUtil.getLastModifyTime()); 265 | taskInformationsDao.updateById(taskInformationsEntity); 266 | taskRecordsEntity = this.saveTaskRecords(taskNo, timeKeyValue); 267 | return taskRecordsEntity; 268 | } catch (Exception e) { 269 | logger.error("QuartzServiceImpl-beforeExecute is failed",e); 270 | throw e; 271 | } 272 | } 273 | 274 | /** 275 | * 保存定时记录表 276 | * @param taskNo 277 | * @param timeKey 278 | */ 279 | public TaskRecordsEntity saveTaskRecords(String taskNo,String timeKeyValue){ 280 | TaskRecordsEntity entity = new TaskRecordsEntity(); 281 | try { 282 | entity.setCreateTime(String.valueOf(DateUtil.getLastModifyTime())); 283 | entity.setExecuteTime(String.valueOf(DateUtil.getLastModifyTime())); 284 | entity.setFailcount(0); 285 | entity.setLastModifyTime(String.valueOf(DateUtil.getLastModifyTime())); 286 | entity.setTaskNo(taskNo); 287 | entity.setTaskStatus(StatusEnum.INIT); 288 | entity.setTimeKeyValue(timeKeyValue); 289 | recordsDao.insert(entity); 290 | } catch (Exception e) { 291 | logger.error("saveTaskRecords error:",e); 292 | } 293 | return entity; 294 | } 295 | 296 | public void saveTaskErrors(String taskRecordsId,String key,String values){ 297 | TaskErrorsEntity errorsEntity = new TaskErrorsEntity(); 298 | errorsEntity.setCreateTime(String.valueOf(DateUtil.getLastModifyTime())); 299 | errorsEntity.setLastModifyTime(String.valueOf(DateUtil.getLastModifyTime())); 300 | errorsEntity.setErrorKey(key); 301 | errorsEntity.setErrorValue(values.replaceAll("'", "").getBytes()); 302 | errorsEntity.setTaskExecuteRecordId(taskRecordsId); 303 | taskErrorsDao.saveTaskErrors(errorsEntity); 304 | } 305 | 306 | public void updateTaskInformations(String taskNo){ 307 | TaskInformationsEntity taskInformationsEntity = taskInformationsDao.getTaskByTaskNo(taskNo); 308 | if(null != taskInformationsEntity && TaskStatusEnum.FROZEN == taskInformationsEntity.getFrozenStatus()){ 309 | try { 310 | taskInformationsEntity.setFrozenStatus(TaskStatusEnum.UNFROZEN); 311 | taskInformationsEntity.setUnfrozenTime(DateUtil.getLastModifyTime()); 312 | taskInformationsEntity.setLastModifyTime(DateUtil.getLastModifyTime()); 313 | taskInformationsDao.updateById(taskInformationsEntity); 314 | } catch (Exception e) { 315 | logger.error("updateTaskInformations error:",e); 316 | } 317 | } 318 | } 319 | 320 | /** 321 | * 更新任务记录表 322 | * @param failCount 323 | * @param taskRecordsId 324 | */ 325 | public TaskRecordsEntity modifyTaskRecord(int failCount,Long taskRecordsId){ 326 | TaskRecordsEntity entity = new TaskRecordsEntity(); 327 | entity.setId(taskRecordsId); 328 | entity.setFailcount(failCount); 329 | if(failCount > 0){ 330 | entity.setTaskStatus(StatusEnum.FAILED); 331 | }else{ 332 | entity.setTaskStatus(StatusEnum.SUCCESS); 333 | } 334 | entity.setLastModifyTime(String.valueOf(DateUtil.getLastModifyTime())); 335 | recordsDao.updateById(entity); 336 | return entity; 337 | } 338 | 339 | public List getList(int currentPage){ 340 | return taskInformationsDao.getList(currentPage); 341 | } 342 | 343 | public int getTotalCount(){ 344 | return taskInformationsDao.getTotalCount(); 345 | } 346 | 347 | public TaskInformationsDetailVo getTaskDetail(String taskNo){ 348 | return taskInformationsDao.getTaskDetail(taskNo); 349 | } 350 | 351 | public int editTaskInformation(TaskInformationsEntity entity){ 352 | boolean flag = false; 353 | int count = 0; 354 | if(TaskStatusEnum.FROZEN == entity.getFrozenStatus()){ 355 | entity.setFrozenTime(DateUtil.getLastModifyTime()); 356 | }else{ 357 | entity.setUnfrozenTime(DateUtil.getLastModifyTime()); 358 | } 359 | if(null != entity.getId() && 0 != entity.getId()){ 360 | // 修改 361 | entity.setLastModifyTime(DateUtil.getLastModifyTime()); 362 | count = taskInformationsDao.updateById(entity); 363 | if(count > 0){ 364 | // 重新装载定时器 365 | Scheduler scheduler = schedulerBean.getScheduler(); 366 | try { 367 | scheduler.deleteJob(new JobKey(entity.getTaskNo())); 368 | if(TaskStatusEnum.UNFROZEN == entity.getFrozenStatus()){ 369 | this.scheduler(entity, scheduler); 370 | } 371 | } catch (Exception e) { 372 | logger.error("移除任务异常:",e); 373 | flag = true; 374 | } 375 | if(flag){ 376 | entity.setFrozenStatus(TaskStatusEnum.FROZEN); 377 | entity.setLastModifyTime(DateUtil.getLastModifyTime()); 378 | taskInformationsDao.updateById(entity); 379 | return 2; 380 | } 381 | } 382 | }else{ 383 | // 增加 384 | count = taskInformationsDao.addTaskInformation(entity); 385 | } 386 | return count; 387 | } 388 | 389 | public TaskInformationsEntity selectTaskInfoById(Long id){ 390 | return taskInformationsDao.selectById(id); 391 | } 392 | 393 | } 394 | -------------------------------------------------------------------------------- /src/main/webapp/media/css/css.css: -------------------------------------------------------------------------------- 1 | html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;}html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;background-color:#fff;}body{font-family:"Microsoft YaHei";font-size:12px;color:#333;line-height:1;}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block;}audio,canvas,progress,video{display:inline-block;vertical-align:baseline;}audio:not([controls]){display:none;height:0;}[hidden],template{display:none;}a{text-decoration:none;background-color:transparent;}a:hover{text-decoration:underline;}a:active,a:hover{outline:0;}abbr[title]{border-bottom:1px dotted;}b,strong{font-weight:700;}dfn{font-style:italic;}h1,h2,h3,h4,h5,h6,strong,b{font-size:100%;font-weight:bold;}h4,h5,h6{font-weight:normal;}ol,ul{list-style:none;}li{list-style:none;}mark{background:#ff0;color:#000;}small{font-size:80%;}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline;}sup{top:-.5em;}sub{bottom:-.25em;}img{border:0;}svg:not(:root){overflow:hidden;}figure{margin:1em 40px;}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0;}pre{overflow:auto;}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em;}button,input,optgroup,select,textarea{color:inherit;font:inherit;outline:none;margin:0;padding:0;}button{overflow:visible;}button,select{text-transform:none;}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer;}button[disabled],html input[disabled]{cursor:default;}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0;}input{line-height:normal;}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0;}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto;}input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none;}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em;}legend{border:0;padding:0;}textarea{overflow:auto;}optgroup{font-weight:700;}table{border-collapse:collapse;border-spacing:0;}td,th{padding:0;}q,blockquote{quotes:none;}q:before,q:after,blockquote:before,blockquote:after{content:".";content:none;}::-webkit-selection{color:#fff;background-color:#f6796a;}::-moz-selection{color:#fff;background-color:#f6796a;}::selection{color:#fff;background-color:#f6796a;}.f-fl{float:left !important;}.f-fr{float:right !important;}.f-fn{float:none !important;}.f-cf:before,.f-cf:after,.f-cf-bf:before,.f-cf-af:after,.f-cb{height:0;content:".";font-size:0;line-height:0;display:block;overflow:hidden;clear:both;}.f-tal{text-align:left !important;}.f-tac{text-align:center !important;}.f-tar{text-align:right !important;}.f-vam{vertical-align:middle !important;}.f-dn{display:none !important;}.f-di{display:inline !important;}.f-db{display:block !important;}.f-dib{display:inline-block !important;}.f-oh{overflow:hidden !important;}.f-pr{position:relative !important;}.f-ellipsis{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}.f-break{word-break:break-all;word-wrap:break-word;}.f-wma{width:1200px;margin:0 auto;}.f-wma:before,.f-wma:after{height:0;content:".";font-size:0;line-height:0;display:block;overflow:hidden;clear:both;} 2 | .f-wma-2{width:980px;} 3 | .f-fs-12{font-size:12px !important;} 4 | .f-fs-14{font-size:14px !important;} 5 | .f-fs-16{font-size:16px !important;} 6 | .f-fs-18{font-size:18px !important;} 7 | .f-fs-20{font-size:20px !important;} 8 | .f-fs-24{font-size:24px !important;} 9 | .f-fs-36{font-size:36px !important;} 10 | .f-fc-333{color:#333 !important;} 11 | .f-fc-666{color:#666 !important;} 12 | .f-fc-999{color:#999 !important;} 13 | .f-fc-ee1d23{color:#ee1d23 !important;} 14 | .f-fc-71d46a{color:#71d46a !important;} 15 | .f-fc-ff4f2c{color:#ff4f2c !important;} 16 | .f-fc-ff7805{color:#ff7805 !important;} 17 | .f-fc-5ea6e4{color:#5ea6e4 !important;} 18 | .f-bg-f5f5f5{background:#f5f5f5 !important;} 19 | .f-bg-f8f8f8{background:#f8f8f8 !important;} 20 | .f-mt-10{margin-top:10px !important;} 21 | .f-mt-20{margin-top:20px !important;} 22 | .f-mt-30{margin-top:30px !important;} 23 | .f-mt-40{margin-top:40px !important;} 24 | .f-mt-50{margin-top:50px !important;} 25 | .f-mt-60{margin-top:60px !important;} 26 | .f-mt-70{margin-top:70px !important;} 27 | .f-mt-80{margin-top:80px !important;} 28 | .f-mt-90{margin-top:80px !important;} 29 | .f-mt-100{margin-top:80px !important;} 30 | .f-mb-10{margin-bottom:10px !important;} 31 | .f-mb-20{margin-bottom:20px !important;} 32 | .f-mb-30{margin-bottom:30px !important;} 33 | .f-mb-40{margin-bottom:40px !important;} 34 | .f-mb-50{margin-bottom:50px !important;} 35 | .f-mb-60{margin-bottom:60px !important;} 36 | .f-mb-70{margin-bottom:70px !important;} 37 | .f-mb-80{margin-bottom:80px !important;} 38 | .f-mb-90{margin-bottom:90px !important;} 39 | .f-mb-100{margin-bottom:100px !important;} 40 | .page-header-border{border-bottom:3px solid #ee1d23;} 41 | .page-header{position:relative;z-index:2;} 42 | .page-header .logo{float:left;margin-top:20px;} 43 | .page-header .logo img{display:block;height:48px;} 44 | .page-header .nav{float:left;margin-left:120px;} 45 | .page-header .nav li{float:left;margin-left:40px;} 46 | .page-header .nav li a{display:block;width:102px;height:88px;color:#333;text-align:center;text-decoration:none;font-size:16px;line-height:88px;-webkit-transition:all .2s linear;-moz-transition:all .2s linear;-o-transition:all .2s linear;transition:all .2s linear;} 47 | .page-header .nav li a:hover{background:#f5f5f5;color:#e8412f;} 48 | .page-header .nav li a.z-active{background:#f5f5f5;color:#ee1d23;} 49 | .page-header .account{position:relative;float:right;width:120px;height:88px;} 50 | .page-header .account h3{font-weight:normal;} 51 | .page-header .account h3 a{display:block;font-size:16px;color:#333;line-height:88px;text-align:center;-webkit-transition:all .2s linear; 52 | -moz-transition:all .2s linear; 53 | -o-transition:all .2s linear; 54 | transition:all .2s linear; 55 | } 56 | .page-header .account h3 a:hover{color:#ee1d23;text-decoration:none;} 57 | .page-header .account h3 a:after{display:inline-block;margin-top:44px;margin-left:8px;width:8px;height:4px;overflow:hidden;background:url(../img/arrow_down4.png) 0 0 no-repeat;content:".";font-size:0;line-height:0;vertical-align:top;} 58 | .page-header .account:hover h3 a{color:#ee1d23;} 59 | .page-header .account:hover h3 a:after{background-image:url(../img/arrow_up_2.png);} 60 | .page-header .account ul{display:none;position:absolute;left:50%;top:88px;margin-left:-60px;width:118px;border:1px solid #c4c4c4;background:#fff;} 61 | .page-header .account:hover ul{display:block;} 62 | .page-header .account ul:after{position:absolute;left:50%;top:-10px;margin-left:-7px;width:15px;height:10px;overflow:hidden;background:url(../img/arrow_up_3.png) 0 0 no-repeat;content:".";font-size:0;line-height:0;} 63 | .page-header .account ul li{border-bottom:1px dotted #c4c4c4;} 64 | .page-header .account ul li:last-child{border-bottom:none;} 65 | .page-header .account ul li a{display:block;padding:8px;font-size:14px;color:#666;line-height:24px;text-align:center;-webkit-transition:all .2s linear; 66 | -moz-transition:all .2s linear; 67 | -o-transition:all .2s linear; 68 | transition:all .2s linear; 69 | } 70 | .page-header .account ul li a:hover{text-decoration:none;color:#e9412d;} 71 | .page-header .user{float:right;font-size:16px;line-height:88px;text-align:center;} 72 | .page-header .user span{color:#ccc;margin:0 16px;} 73 | .page-header .user a{color:#666;} 74 | .page-header .user .register{color:#e9412d;} 75 | .page-footer{padding:24px 0 32px;background:#3e3a3a;} 76 | .page-footer .main{float:left;width:882px;} 77 | .page-footer .side{float:right;width:286px;} 78 | .page-footer .flink{font-size:14px;line-height:24px;} 79 | .page-footer .flink dt{float:left;color:#fff;} 80 | .page-footer .flink dd{margin-left:56px;word-wrap:break-word;line-height:24px;word-break:normal;} 81 | .page-footer .flink dd a{float:left;margin-left:32px;color:#999;white-space:nowrap;font-size:14px;} 82 | .page-footer .nav{margin-top:44px;color:#999;font-size:14px;line-height:24px;} 83 | .page-footer .nav a{color:#fff;} 84 | .page-footer .corpright{margin-top:8px;color:#999;line-height:24px;} 85 | .page-footer .contact{float:left;margin-top:44px;color:#999;font-size:14px;line-height:24px;} 86 | .page-footer .contact dl{margin-top:16px;font-size:14px;line-height:24px;} 87 | .page-footer .contact dl dt{float:left;width:56px;color:#fff;text-align:right;} 88 | .page-footer .contact dl dd{margin-left:64px;} 89 | .page-footer .qrcode{float:right;} 90 | .page-footer .qrcode dt{color:#999;text-align:center;line-height:24px;} 91 | .page-footer .qrcode dd{overflow:hidden;margin-top:4px;} 92 | .page-footer .qrcode dd img{display:block;width:96px;height:96px;} 93 | .page-container{min-height:500px;} 94 | .page-container:before, 95 | .page-container:after{height:0;content:".";font-size:0;line-height:0;display:block;overflow:hidden;clear:both;} 96 | .fixed-nav{position:fixed;top:50%;right:0;margin-top:-76px;width:48px;} 97 | .fixed-nav .item{position:relative;margin:2px 0;width:48px;height:48px;-webkit-transition:all .2s linear;transition:all .2s linear;} 98 | .fixed-nav .item .icon{position:absolute;left:50%;top:50%;z-index:2;margin-left:-24px;margin-top:-24px;display:block;width:48px;height:48px;background-color:#f6796a;background-image:url(../img/icon_fixed_nav.png);background-position:-9999px -9999px;background-repeat:no-repeat;} 99 | .fixed-nav .item:hover .icon{background-color:#ee1d23;} 100 | .fixed-nav .item-qrcode .icon{background-position:0 0;} 101 | .fixed-nav .item-qrcode .qrcode{position:absolute;right:48px;bottom:0;z-index:1;padding:10px 10px 3px;width:auto;height:auto;border:1px solid #f5f5f5;background-color:#fff;opacity:0;filter:alpha(opacity=0);box-shadow:0 0 2px rgba(0, 0, 0, .08);-webkit-transition:all .2s linear;transition:all .2s linear;-webkit-transform:scale(0);transform:scale(0);transform-origin:100% 100%;} 102 | .fixed-nav .item-qrcode .qrcode li{float:left;font-size:14px;color:#ee1d23;line-height:24px;text-align:center;white-space:nowrap;} 103 | .fixed-nav .item-qrcode .qrcode img{display:block;width:96px;height:96px;} 104 | .fixed-nav .item-qrcode:hover .qrcode{right:56px;opacity:1;filter:alpha(opacity=100);-webkit-transform:scale(1);transform:scale(1);} 105 | .fixed-nav .item-kefu .icon{background-position:0 -48px;} 106 | .fixed-nav .item-kefu .tel{position:absolute;right:48px;bottom:0;z-index:1;padding:3px 10px;width:136px;height:40px;border:1px solid #f5f5f5;background-color:#fff;font-size:20px;color:#ee1d23;line-height:40px;white-space:nowrap;opacity:0;filter:alpha(opacity=0);box-shadow:0 0 2px rgba(0, 0, 0, .08);-webkit-transition:all .2s linear;transition:all .2s linear;-webkit-transform:scale(0);transform:scale(0);transform-origin:100% 50%;} 107 | .fixed-nav .item-kefu:hover .tel{right:56px;opacity:1;filter:alpha(opacity=100);-webkit-transform:scale(1);transform:scale(1);} 108 | .fixed-nav .item-top{cursor:pointer;} 109 | .fixed-nav .item-top .icon{background-position:0 -96px;} 110 | .layer-reserve{position:relative;z-index:9000;display:none;width:440px;background:#fff;border-radius:8px;} 111 | .layer-reserve > .close{position:absolute;right:-32px;top:-32px;width:32px;height:32px;background:url(../img/icon_close.png) center center no-repeat;cursor:pointer;} 112 | .layer-reserve > .title{padding:12px 16px;background:#f3f3f3;font-size:16px;font-weight:normal;line-height:24px;border-radius:8px 8px 0 0;} 113 | .layer-reserve > .content{position:relative;padding:20px 16px 48px;border-radius:0 0 8px 8px;} 114 | .layer-reserve .alert{padding:12px 16px;border:1px solid #faf0d8;background:#ffffe0;font-size:14px;color:#a2742c;line-height:20px;border-radius:4px;} 115 | .form-reserve{margin-left:54px;width:300px;} 116 | .form-reserve .item{margin-top:20px;} 117 | .form-reserve .info{position:relative;} 118 | .form-reserve .u-text{position:relative;display:inline-block;vertical-align:middle;} 119 | .form-reserve .u-text input{padding:7px 11px;width:276px;height:24px;border:1px solid #bdbdbd;font-size:14px;line-height:24px;} 120 | .form-reserve .u-text input.z-error{border-color:#ee1d23;} 121 | .form-reserve .u-text input:focus{border-color:#27b6a0;} 122 | .form-reserve .u-text label{position:absolute;left:0;top:0;z-index:0;margin-left:12px;margin-top:8px;background:#fff;font-size:14px;color:#999;line-height:24px;cursor:text;} 123 | .form-reserve .u-text span{position:absolute;right:0;top:0;margin-top:8px;margin-right:12px;font-size:14px;color:#999;line-height:24px;} 124 | .form-reserve .u-tips{position:absolute;left:0;top:40px;display:none;font-size:12px;color:#ee1d23;line-height:20px;} 125 | .form-reserve .u-button{display:inline-block;width:300px;height:40px;border:1px solid #e9412d;background:#e9412d;color:#fff;font-size:14px;line-height:38px;text-align:center;vertical-align:top;border-radius:4px;-webkit-transition:all .2s linear;transition:all .2s linear;} 126 | .form-reserve .u-button:hover{background-color:#ee1d23;text-decoration:none;} 127 | .form-reserve .u-button.z-disabled{border:1px solid #c8c8c8;background:#c8c8c8;} 128 | .layer-reserve .result{position:absolute;left:50%;top:50%;margin-left:-121px;margin-top:-36px;padding:20px;display:none;width:200px;height:50px;border:1px solid #dcdcdc;background:#fff;box-shadow:0 0 8px rgba(0, 0, 0, .2);} 129 | .layer-reserve .result .icon{float:left;width:50px;height:50px;display:inline-block;background:url(../img/icon_result_success.png) 0 0 no-repeat;} 130 | .layer-reserve .result .content{margin-left:58px;font-size:16px;line-height:50px;} 131 | .layer-imgcode{position:relative;z-index:9000;display:none;width:450px;background:#fff;border-radius:8px;} 132 | .layer-imgcode > .close{position:absolute;right:-32px;top:-32px;width:32px;height:32px;background:url(../img/icon_close.png) center center no-repeat;cursor:pointer;} 133 | .layer-imgcode > .content{padding:10px 30px 36px;border-radius:8px;} 134 | .form-imgcode .item{margin-top:20px;} 135 | .form-imgcode .item:before, 136 | .form-imgcode .item:after{height:0;content:".";font-size:0;line-height:0;display:block;overflow:hidden;clear:both;} 137 | .form-imgcode .info{position:relative;} 138 | .form-imgcode .info:after{height:0;content:".";font-size:0;line-height:0;display:block;overflow:hidden;clear:both;} 139 | .form-imgcode .u-text{position:relative;float:left;display:inline-block;vertical-align:middle;} 140 | .form-imgcode .u-text input{padding:7px 11px;width:166px;height:24px;border:1px solid #bdbdbd;font-size:14px;line-height:24px;} 141 | .form-imgcode .u-text label{position:absolute;left:0;top:0;z-index:0;margin-left:12px;margin-top:8px;background:#fff;font-size:14px;color:#999;line-height:24px;cursor:text;} 142 | .form-imgcode .u-tips{position:absolute;left:0;top:44px;display:none;font-size:12px;color:#ee1d23;line-height:20px;} 143 | .form-imgcode .u-button{margin-right:8px;display:inline-block;width:84px;height:40px;border:1px solid #e9412d;background:#e9412d;color:#fff;font-size:14px;line-height:38px;text-align:center;vertical-align:top;border-radius:4px;-webkit-transition:all .2s linear;transition:all .2s linear;} 144 | .form-imgcode .u-button:hover{background-color:#ee1d23;text-decoration:none;} 145 | .form-imgcode .u-button.z-disabled{border:1px solid #c8c8c8;background:#c8c8c8;} 146 | .form-imgcode .item-imgcode .u-imgcode{float:left;margin-left:4px;margin-top:3px;width:92px;height:32px;border:1px solid #bdbdbd;cursor:pointer;} 147 | .form-imgcode .item-imgcode .u-replace{float:left;margin-left:4px;font-size:14px;color:#666;line-height:40px;} 148 | .form-imgcode .item-imgcode .u-replace a{color:#ee1d23;} 149 | .form-imgcode .item-button{margin-top:30px;} 150 | .form-imgcode .item-button .u-button-2{border:1px solid #c8c8c8;background:#c8c8c8;} 151 | .m-page{text-align:center;} 152 | .m-page a,.m-page span{margin:0 2px;padding:4px 12px;display:inline-block;height:24px;font-size:14px;color:#333;line-height:24px;text-align:center;vertical-align:top;background:#e0e0e0;border-radius:4px;} 153 | .m-page a:hover{text-decoration:none;color:#fff;background:#e34a4a;} 154 | .m-page .z-active{color:#fff;background:#e34a4a;} 155 | .m-page .z-disable{color:#999;cursor:default;background:#e9e9e9;} 156 | .m-page .z-disable:hover{color:#999;background:#e9e9e9;} -------------------------------------------------------------------------------- /src/main/java/com/zhongxin/quartz/util/DateUtils.java: -------------------------------------------------------------------------------- 1 | package com.zhongxin.quartz.util; 2 | 3 | import java.sql.Timestamp; 4 | import java.text.ParseException; 5 | import java.text.SimpleDateFormat; 6 | import java.util.Calendar; 7 | import java.util.Date; 8 | /** 9 | * 时间工具类 10 | * @author chaun.lee 11 | * 12 | */ 13 | public class DateUtils extends org.apache.commons.lang.time.DateUtils{ 14 | public static final String TIME_WITH_MINUTE_PATTERN = "HH:mm"; 15 | public static final long DAY_MILLI = 86400000L; 16 | public static final int LEFT_OPEN_RIGHT_OPEN = 1; 17 | public static String DATE_FORMAT_DATEONLY = "yyyy-MM-dd"; 18 | public static String DATE_FORMAT_DATETIME = "yyyy-MM-dd HH:mm:ss"; 19 | public static SimpleDateFormat sdfDateTime; 20 | public static SimpleDateFormat sdfDateOnly; 21 | public static final SimpleDateFormat SHORTDATEFORMAT; 22 | public static final SimpleDateFormat SHORT_DATE_FORMAT; 23 | public static final SimpleDateFormat LONG_DATE_FORMAT; 24 | public static final SimpleDateFormat HMS_FORMAT; 25 | public static final SimpleDateFormat formatTimestamp; 26 | 27 | static { 28 | sdfDateTime = new SimpleDateFormat(DATE_FORMAT_DATETIME); 29 | sdfDateOnly = new SimpleDateFormat(DATE_FORMAT_DATEONLY); 30 | SHORTDATEFORMAT = new SimpleDateFormat("yyyyMMdd"); 31 | SHORT_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd"); 32 | LONG_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 33 | HMS_FORMAT = new SimpleDateFormat("HH:mm:ss"); 34 | formatTimestamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 35 | } 36 | 37 | public DateUtils() { 38 | } 39 | 40 | public static Date parseDate(String str, String parsePatterns) throws ParseException { 41 | return parseDate(str, new String[]{parsePatterns}); 42 | } 43 | 44 | public static int compareDate(Date date, Date otherDate, int withUnit) { 45 | Calendar dateCal = Calendar.getInstance(); 46 | dateCal.setTime(date); 47 | Calendar otherDateCal = Calendar.getInstance(); 48 | otherDateCal.setTime(otherDate); 49 | switch(withUnit) { 50 | case 1: 51 | dateCal.clear(2); 52 | otherDateCal.clear(2); 53 | case 2: 54 | dateCal.set(5, 1); 55 | otherDateCal.set(5, 1); 56 | case 5: 57 | dateCal.set(11, 0); 58 | otherDateCal.set(11, 0); 59 | case 10: 60 | dateCal.clear(12); 61 | otherDateCal.clear(12); 62 | case 12: 63 | dateCal.clear(13); 64 | otherDateCal.clear(13); 65 | case 13: 66 | dateCal.clear(14); 67 | otherDateCal.clear(14); 68 | case 14: 69 | return dateCal.compareTo(otherDateCal); 70 | case 3: 71 | case 4: 72 | case 6: 73 | case 7: 74 | case 8: 75 | case 9: 76 | case 11: 77 | default: 78 | throw new IllegalArgumentException("withUnit 单位字段 " + withUnit + " 不合法!!"); 79 | } 80 | } 81 | 82 | public static int compareTime(Date date, Date otherDate, int withUnit) { 83 | Calendar dateCal = Calendar.getInstance(); 84 | dateCal.setTime(date); 85 | Calendar otherDateCal = Calendar.getInstance(); 86 | otherDateCal.setTime(otherDate); 87 | dateCal.clear(1); 88 | dateCal.clear(2); 89 | dateCal.set(5, 1); 90 | otherDateCal.clear(1); 91 | otherDateCal.clear(2); 92 | otherDateCal.set(5, 1); 93 | switch(withUnit) { 94 | case 10: 95 | dateCal.clear(12); 96 | otherDateCal.clear(12); 97 | case 12: 98 | dateCal.clear(13); 99 | otherDateCal.clear(13); 100 | case 13: 101 | dateCal.clear(14); 102 | otherDateCal.clear(14); 103 | case 14: 104 | return dateCal.compareTo(otherDateCal); 105 | case 11: 106 | default: 107 | throw new IllegalArgumentException("withUnit 单位字段 " + withUnit + " 不合法!!"); 108 | } 109 | } 110 | 111 | public static long nowTimeMillis() { 112 | return System.currentTimeMillis(); 113 | } 114 | 115 | public static Timestamp nowTimeStamp() { 116 | return new Timestamp(nowTimeMillis()); 117 | } 118 | 119 | public static String getReqDate() { 120 | return SHORTDATEFORMAT.format(new Date()); 121 | } 122 | 123 | public static String getReqDate(Date date) { 124 | return SHORT_DATE_FORMAT.format(date); 125 | } 126 | 127 | public static String TimestampToDateStr(Timestamp tmp) { 128 | return SHORT_DATE_FORMAT.format(tmp); 129 | } 130 | 131 | public static String getReqTime() { 132 | return HMS_FORMAT.format(new Date()); 133 | } 134 | 135 | public static String getTimeStampStr(Date date) { 136 | return LONG_DATE_FORMAT.format(date); 137 | } 138 | 139 | public static String getLongDateStr() { 140 | return LONG_DATE_FORMAT.format(new Date()); 141 | } 142 | 143 | public static String getLongDateStr(Timestamp time) { 144 | return LONG_DATE_FORMAT.format(time); 145 | } 146 | 147 | public static String getShortDateStr(Date date) { 148 | return SHORT_DATE_FORMAT.format(date); 149 | } 150 | 151 | public static String getShortDateStr() { 152 | return SHORT_DATE_FORMAT.format(new Date()); 153 | } 154 | 155 | public static Date addMinute(Date date, int minute) { 156 | Calendar calendar = Calendar.getInstance(); 157 | calendar.setTime(date); 158 | calendar.add(12, minute); 159 | return calendar.getTime(); 160 | } 161 | 162 | public static Date addHour(Date date, int hour) { 163 | Calendar calendar = Calendar.getInstance(); 164 | calendar.setTime(date); 165 | calendar.add(10, hour); 166 | return calendar.getTime(); 167 | } 168 | 169 | public static Date getDayStart(Date date) { 170 | Calendar calendar = Calendar.getInstance(); 171 | calendar.setTime(date); 172 | calendar.set(11, 0); 173 | calendar.set(12, 0); 174 | calendar.set(13, 0); 175 | calendar.set(14, 0); 176 | return calendar.getTime(); 177 | } 178 | 179 | public static Date getDayEnd(Date date) { 180 | Calendar calendar = Calendar.getInstance(); 181 | calendar.setTime(date); 182 | calendar.set(11, 0); 183 | calendar.set(12, 0); 184 | calendar.set(13, 0); 185 | calendar.set(14, 0); 186 | calendar.add(5, 1); 187 | calendar.add(14, -1); 188 | return calendar.getTime(); 189 | } 190 | 191 | public static Date addDay(Date date, int day) { 192 | Calendar calendar = Calendar.getInstance(); 193 | calendar.setTime(date); 194 | calendar.add(5, day); 195 | return calendar.getTime(); 196 | } 197 | 198 | public static Date getMonthEnd(Date date) { 199 | Calendar calendar = Calendar.getInstance(); 200 | calendar.setTime(date); 201 | calendar.set(5, 1); 202 | calendar.set(11, 0); 203 | calendar.set(12, 0); 204 | calendar.set(13, 0); 205 | calendar.set(14, 0); 206 | calendar.add(2, 1); 207 | calendar.add(14, -1); 208 | return calendar.getTime(); 209 | } 210 | 211 | public static Date addYear(Date date, int year) { 212 | Calendar calendar = Calendar.getInstance(); 213 | calendar.setTime(date); 214 | calendar.add(6, 365 * year); 215 | return calendar.getTime(); 216 | } 217 | 218 | public static Timestamp strToTimestamp(String dateStr) { 219 | return Timestamp.valueOf(dateStr); 220 | } 221 | 222 | public static Timestamp strToTimestamp(Date date) { 223 | return Timestamp.valueOf(formatTimestamp.format(date)); 224 | } 225 | 226 | public static Timestamp getCurTimestamp() { 227 | return Timestamp.valueOf(formatTimestamp.format(new Date())); 228 | } 229 | 230 | public static long daysBetween(Timestamp t1, Timestamp t2) { 231 | return (t2.getTime() - t1.getTime()) / 86400000L; 232 | } 233 | 234 | public static Timestamp getSysDateTimestamp() { 235 | return new Timestamp(System.currentTimeMillis()); 236 | } 237 | 238 | public static Timestamp toSqlTimestamp(String sDate) { 239 | return sDate == null?null:(sDate.length() != DATE_FORMAT_DATEONLY.length()?null:toSqlTimestamp(sDate, DATE_FORMAT_DATEONLY)); 240 | } 241 | 242 | public static Timestamp toSqlTimestamp(String sDate, String sFmt) { 243 | String temp = null; 244 | if(sDate != null && sFmt != null) { 245 | if(sDate.length() != sFmt.length()) { 246 | return null; 247 | } else { 248 | if(sFmt.equals(DATE_FORMAT_DATETIME)) { 249 | temp = sDate.replace('/', '-'); 250 | temp = temp + ".000000000"; 251 | } else { 252 | if(!sFmt.equals(DATE_FORMAT_DATEONLY)) { 253 | return null; 254 | } 255 | 256 | temp = sDate.replace('/', '-'); 257 | temp = temp + " 00:00:00.000000000"; 258 | } 259 | 260 | return Timestamp.valueOf(temp); 261 | } 262 | } else { 263 | return null; 264 | } 265 | } 266 | 267 | public static String getSysDateTimeString() { 268 | return toString(new Date(System.currentTimeMillis()), sdfDateTime); 269 | } 270 | 271 | public static String toString(Date dt, String sFmt) { 272 | return dt != null && sFmt != null && !"".equals(sFmt)?toString(dt, new SimpleDateFormat(sFmt)):""; 273 | } 274 | 275 | private static String toString(Date dt, SimpleDateFormat formatter) { 276 | String sRet = null; 277 | 278 | try { 279 | sRet = formatter.format(dt).toString(); 280 | } catch (Exception var4) { 281 | var4.printStackTrace(); 282 | sRet = null; 283 | } 284 | 285 | return sRet; 286 | } 287 | 288 | public static String toSqlTimestampString2(Timestamp dt) { 289 | if(dt == null) { 290 | return null; 291 | } else { 292 | String temp = toSqlTimestampString(dt, DATE_FORMAT_DATETIME); 293 | return temp.substring(0, 16); 294 | } 295 | } 296 | 297 | public static String toString(Timestamp dt) { 298 | return dt == null?"":toSqlTimestampString2(dt); 299 | } 300 | 301 | public static String toSqlTimestampString(Timestamp dt, String sFmt) { 302 | String temp = null; 303 | String out = null; 304 | if(dt != null && sFmt != null) { 305 | temp = dt.toString(); 306 | if(sFmt.equals(DATE_FORMAT_DATETIME) || sFmt.equals(DATE_FORMAT_DATEONLY)) { 307 | temp = temp.substring(0, sFmt.length()); 308 | out = temp.replace('/', '-'); 309 | } 310 | 311 | return out; 312 | } else { 313 | return null; 314 | } 315 | } 316 | 317 | public static int getWeek() { 318 | Calendar cal = Calendar.getInstance(); 319 | cal.setTime(new Date()); 320 | int w = cal.get(7); 321 | return w; 322 | } 323 | 324 | public static String timestampToStringYMD(Timestamp timestamp) { 325 | SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_DATEONLY); 326 | String createTimeStr = sdf.format(timestamp); 327 | return createTimeStr; 328 | } 329 | 330 | public static void main(String[] args) throws ParseException { 331 | Date d = parseDate("2010-12-19 14:16:50", "yyyy-MM-dd HH:mm:ss"); 332 | System.out.println(d); 333 | System.out.println(toString(d, "yyyy/MM/dd")); 334 | Calendar c = Calendar.getInstance(); 335 | System.out.println(c.isSet(11) + "---" + c.getTime()); 336 | System.out.println(compareDate(d, c.getTime(), 13)); 337 | Date startDate = parseDate("2012-12-19 14:16:50", "yyyy-MM-dd HH:mm:ss"); 338 | System.out.println(isOverIntervalLimit((Date)startDate, (Date)startDate, 10)); 339 | } 340 | 341 | public static boolean isBetween(Date now, Date start, Date end, int model) { 342 | if(now != null && start != null && end != null) { 343 | switch(model) { 344 | case 1: 345 | if(now.after(start) && now.before(end)) { 346 | return true; 347 | } 348 | 349 | return false; 350 | default: 351 | return false; 352 | } 353 | } else { 354 | throw new IllegalArgumentException("The scale must be a positive integer or zero"); 355 | } 356 | } 357 | 358 | public static Date getWeekStart(Date date) { 359 | Calendar calendar = Calendar.getInstance(); 360 | calendar.setTime(date); 361 | calendar.get(3); 362 | int firstDay = calendar.getFirstDayOfWeek(); 363 | calendar.set(7, firstDay); 364 | calendar.set(11, 0); 365 | calendar.set(12, 0); 366 | calendar.set(13, 0); 367 | calendar.set(14, 0); 368 | return calendar.getTime(); 369 | } 370 | 371 | public static Date getMonthStart(Date date) { 372 | Calendar calendar = Calendar.getInstance(); 373 | calendar.setTime(date); 374 | calendar.set(5, 1); 375 | calendar.set(11, 0); 376 | calendar.set(12, 0); 377 | calendar.set(13, 0); 378 | calendar.set(14, 0); 379 | return calendar.getTime(); 380 | } 381 | 382 | public static Date getYearStart(Date date) { 383 | Calendar calendar = Calendar.getInstance(); 384 | calendar.setTime(date); 385 | calendar.set(1, calendar.get(1)); 386 | calendar.set(2, 1); 387 | calendar.set(5, 1); 388 | calendar.set(11, 0); 389 | calendar.set(12, 0); 390 | calendar.set(13, 0); 391 | calendar.set(14, 0); 392 | return calendar.getTime(); 393 | } 394 | 395 | public static int getDayOfMonth(Date date) { 396 | Calendar c = Calendar.getInstance(); 397 | c.setTime(date); 398 | return c.getActualMaximum(5); 399 | } 400 | 401 | public static Date getFirstDateOfMonth(Date date) { 402 | Calendar c = Calendar.getInstance(); 403 | c.setTime(date); 404 | c.set(5, c.getActualMinimum(5)); 405 | return c.getTime(); 406 | } 407 | 408 | public static Date getLastDateOfMonth(Date date) { 409 | Calendar c = Calendar.getInstance(); 410 | c.setTime(date); 411 | c.set(5, c.getActualMaximum(5)); 412 | return c.getTime(); 413 | } 414 | 415 | public static Date getSeasonStart(Date date) { 416 | return getDayStart(getFirstDateOfMonth(getSeasonDate(date)[0])); 417 | } 418 | 419 | public static Date getSeasonEnd(Date date) { 420 | return getDayStart(getLastDateOfMonth(getSeasonDate(date)[2])); 421 | } 422 | 423 | public static Date[] getSeasonDate(Date date) { 424 | Date[] season = new Date[3]; 425 | Calendar c = Calendar.getInstance(); 426 | c.setTime(date); 427 | int nSeason = getSeason(date); 428 | if(nSeason == 1) { 429 | c.set(2, 0); 430 | season[0] = c.getTime(); 431 | c.set(2, 1); 432 | season[1] = c.getTime(); 433 | c.set(2, 2); 434 | season[2] = c.getTime(); 435 | } else if(nSeason == 2) { 436 | c.set(2, 3); 437 | season[0] = c.getTime(); 438 | c.set(2, 4); 439 | season[1] = c.getTime(); 440 | c.set(2, 5); 441 | season[2] = c.getTime(); 442 | } else if(nSeason == 3) { 443 | c.set(2, 6); 444 | season[0] = c.getTime(); 445 | c.set(2, 7); 446 | season[1] = c.getTime(); 447 | c.set(2, 8); 448 | season[2] = c.getTime(); 449 | } else if(nSeason == 4) { 450 | c.set(2, 9); 451 | season[0] = c.getTime(); 452 | c.set(2, 10); 453 | season[1] = c.getTime(); 454 | c.set(2, 11); 455 | season[2] = c.getTime(); 456 | } 457 | 458 | return season; 459 | } 460 | 461 | public static int getSeason(Date date) { 462 | byte season = 0; 463 | Calendar c = Calendar.getInstance(); 464 | c.setTime(date); 465 | int month = c.get(2); 466 | switch(month) { 467 | case 0: 468 | case 1: 469 | case 2: 470 | season = 1; 471 | break; 472 | case 3: 473 | case 4: 474 | case 5: 475 | season = 2; 476 | break; 477 | case 6: 478 | case 7: 479 | case 8: 480 | season = 3; 481 | break; 482 | case 9: 483 | case 10: 484 | case 11: 485 | season = 4; 486 | } 487 | 488 | return season; 489 | } 490 | 491 | public static boolean isOverIntervalLimit(Date startDate, Date endDate, int interval, int dateUnit) { 492 | Calendar cal = Calendar.getInstance(); 493 | cal.setTime(new Date()); 494 | cal.add(dateUnit, interval * -1); 495 | Date curDate = getDayStart(cal.getTime()); 496 | return getDayStart(startDate).compareTo(curDate) < 0 || getDayStart(endDate).compareTo(curDate) < 0; 497 | } 498 | 499 | public static boolean isOverIntervalLimit(Date startDate, Date endDate, int interval) { 500 | Calendar cal = Calendar.getInstance(); 501 | cal.setTime(new Date()); 502 | cal.add(5, interval * -1); 503 | Date curDate = getDayStart(cal.getTime()); 504 | return getDayStart(startDate).compareTo(curDate) < 0 || getDayStart(endDate).compareTo(curDate) < 0; 505 | } 506 | 507 | public static boolean isOverIntervalLimit(String startDateStr, String endDateStr, int interval) { 508 | Date startDate = null; 509 | Date endDate = null; 510 | 511 | try { 512 | startDate = parseDate(startDateStr, DATE_FORMAT_DATEONLY); 513 | endDate = parseDate(endDateStr, DATE_FORMAT_DATEONLY); 514 | } catch (ParseException var6) { 515 | var6.printStackTrace(); 516 | return false; 517 | } 518 | 519 | return isOverIntervalLimit(startDate, endDate, interval); 520 | } 521 | 522 | } 523 | -------------------------------------------------------------------------------- /src/main/webapp/media/css/default.css: -------------------------------------------------------------------------------- 1 | 2 | .key{font-weight: bold;} 3 | .page-side{float:left;width:240px;} 4 | .page-main{width:100%} 5 | .m-panel{border:1px solid #ececec;background:#fff;border-radius:4px;box-shadow:0 4px 4px -4px rgba(0, 0, 0, .1);} 6 | .user-info{padding:20px;text-align:center;} 7 | .user-info .name{font-size:16px;line-height:24px;} 8 | .user-info .mobnum{font-size:16px;color:#666;line-height:24px;} 9 | .user-info .pic{margin-top:4px;} 10 | .user-info .pic img{display:block;margin:0 auto;width:72px;height:72px;border-radius:50%;} 11 | .user-info .check{margin-top:8px;height:26px;} 12 | .user-info .check li{display:inline-block;position:relative;margin-left:3px;margin-right:3px;width:26px;height:26px;} 13 | .user-info .check li:hover{z-index:100;} 14 | .user-info .check .icon{position:absolute;left:0;top:0;width:26px;height:26px;background-image:url(../img/user_check.png);background-position:-9999px -9999px;background-repeat:no-repeat;} 15 | .user-info .check .bankcard .icon{background-position:0 0;} 16 | .user-info .check .verified .icon{background-position:-26px 0;} 17 | .user-info .check .investor .icon{background-position:-52px 0;} 18 | .user-info .check .bankcard.z-valid .icon{background-position:0 -26px;} 19 | .user-info .check .verified.z-valid .icon{background-position:-26px -26px;} 20 | .user-info .check .investor.z-valid .icon{background-position:-52px -26px;} 21 | .user-info .check .tips{display:none;position:absolute;left:32px;top:-4px;padding:4px 8px;min-width:48px;border:1px solid #cfcfcf;background:#fff;font-size:12px;color:#666;line-height:24px;white-space:nowrap;border-radius:4px;box-shadow:0 0 2px 0 rgba(0, 0, 0, .1);} 22 | .user-info .check .tips:before{overflow:hidden;position:absolute;left:-6px;top:11px;width:6px;height:10px;content:".";background-image:url(../img/icon_arrow.png);background-position:0 0;background-repeat:no-repeat;font-size:0;line-height:0;} 23 | .user-info .check li:hover .tips{display:block;} 24 | .side-menu{padding-left:72px;padding-right:20px;padding-bottom:40px;border-top:1px dashed #e5e5e5;} 25 | .side-menu .item{margin-top:20px;line-height:30px;} 26 | .side-menu .item dt{padding-left:16px;font-size:16px;} 27 | .side-menu .item dt.z-active{background:url(../img/arrow_right.png) left center no-repeat;} 28 | .side-menu .item dt a{color:#333;} 29 | .side-menu .item dt.z-active a{color:#ee1d23;} 30 | .side-menu .item.z-active dt{color:#ee1d23;} 31 | .side-menu .item.z-active dt a{color:#ee1d23;} 32 | .side-menu .item dd{padding-left:16px;font-size:12px;} 33 | .side-menu .item dd a{color:#333;} 34 | .side-menu .item dd.z-active{background:url(../img/arrow_right.png) left center no-repeat;} 35 | .side-menu .item dd.z-active a{color:#ee1d23;} 36 | .acc-info{padding:40px 32px 20px 32px;height:76px;} 37 | .acc-info .funds{float:left;line-height:28px;} 38 | .acc-info .funds h3{font-size:18px;font-weight:normal;} 39 | .acc-info .funds p{font-size:14px;color:#999;} 40 | .acc-info .action{float:right;margin-top:10px;} 41 | .acc-info .action .buttons{text-align:right;} 42 | .acc-info .action .buttons .u-button{display:inline-block;width:82px;height:34px;border:1px solid #e9412d;background:#e9412d;font-size:14px;color:#fff;text-align:center;line-height:34px;vertical-align:top;border-radius:4px;-webkit-transition:all .2s linear;transition:all .2s linear;} 43 | .acc-info .action .buttons .u-button:hover{background-color:#ee1d23;text-decoration:none;} 44 | .acc-info .action .buttons .u-button-2{margin-left:10px;border-color:#5ea6e4;background-color:#5ea6e4;} 45 | .acc-info .action .buttons .u-button-2:hover{background-color:#519bda;} 46 | .acc-info .action .buttons .u-button.z-disabled{border:1px solid #c8c8c8;background:#c8c8c8;} 47 | .acc-info .action .tips{display:none;font-size:14px;color:#ee1d23;line-height:24px;} 48 | .m-title{height:36px;font-size:16px;line-height:36px;} 49 | .m-title .tit{padding-right:16px;background:url(../img/arrow_down_2.png) right center no-repeat;color:#ee1d23;font-weight:normal;} 50 | .acc-invest{padding:24px 32px;} 51 | .m-count-acc{margin:-24px -32px 0;padding:16px 32px;background-color:#f7f7f7;font-size:14px;line-height:28px;border-radius:4px 4px 0 0;} 52 | .m-count-acc .item-group:before, 53 | .m-count-acc .item-group:after{height:0;content:".";font-size:0;line-height:0;display:block;overflow:hidden;clear:both;} 54 | .m-count-acc .item{position:relative;float:left;width:280px;color:#666;} 55 | .m-title-sub{line-height:24px;} 56 | .m-title-sub .title{float:left;font-size:14px;color:#4195eb;font-weight:normal;} 57 | .m-title-sub .more{float:right;color:#4195eb;} 58 | .m-table table{border-top:1px solid #e3e3e3;} 59 | .m-table tr{border-bottom:1px solid #e3e3e3;} 60 | .m-table thead tr{background:#f8f8f8;} 61 | .m-table tr th, 62 | .m-table tr td{padding:4px;height:40px;font-size:14px;line-height:20px;word-break:break-all;word-wrap:break-word;} 63 | .m-table tr th{font-weight:normal;} 64 | .m-table tr td{color:#999;} 65 | .m-table tr td a{color:#0d638f;} 66 | .m-table tr td a:hover{color:#ee1d23;} 67 | .m-table tr td .u-status{display:inline-block;padding-left:24px;padding-right:24px;background-position:left center;background-repeat:no-repeat;font-size:14px;line-height:20px;} 68 | .m-table tr td .u-status.z-invalid{color:#ee1d23;} 69 | .m-table tr td .u-status.z-valid{background-image:url(../img/icon_valid.png);color:#71d46a;} 70 | .acc-invest-none{padding-top:80px;padding-bottom:80px;font-size:14px;color:#666;line-height:20px;text-align:center;} 71 | .acc-invest-none a{color:#ee1d23;text-decoration:underline;} 72 | .nav-tabs{height:60px;border-bottom:2px solid #ee1d23;font-size:16px;line-height:60px;text-align:center;} 73 | .nav-tabs li{float:left;margin-bottom:-2px;width:188px;} 74 | .nav-tabs .add{float:right} 75 | .nav-tabs .add a{display:inline-block;height:14px;} 76 | .nav-tabs .add > a.expand {width:14px;background-image:url(../img/portlet-expand-icon.png);} 77 | .nav-tabs .add > a.collapse{width:14px;background-image:url(../img/portlet-collapse-icon.png);} 78 | .nav-tabs li.z-active{border-bottom:2px solid #ee1d23;} 79 | .nav-tabs li a{display:block;color:#999;} 80 | .nav-tabs li a:hover{text-decoration:none;color:#ee1d23;} 81 | .nav-tabs li.z-active a{color:#ee1d23;} 82 | .acc-mgmt{padding:32px;} 83 | .toggle-mgmt{border-top:1px solid #e3e3e3;} 84 | .toggle-mgmt .toggle-item{border-bottom:1px solid #e3e3e3;} 85 | .toggle-mgmt .toggle-item.z-active{background:#f5f5f5;} 86 | .toggle-mgmt .caption-toggle{position:relative;padding:31px 24px 11px;height:44px;} 87 | .toggle-mgmt .caption-toggle:before, 88 | .toggle-mgmt .caption-toggle:after{height:0;content:".";font-size:0;line-height:0;display:block;overflow:hidden;clear:both;} 89 | .toggle-mgmt .caption-toggle .title{position:relative;float:left;margin-right:-150px;padding-left:30px;width:120px;} 90 | .toggle-mgmt .caption-toggle .title:before{position:absolute;left:0;top:2px;width:20px;height:20px;content:".";background-image:url(../img/icon_invalid.png);background-position:0 0;background-repeat:no-repeat;font-size:0;line-height:0;display:block;overflow:hidden;clear:both;} 91 | .toggle-mgmt .caption-toggle .title.z-valid:before{background-image:url(../img/icon_valid.png);} 92 | .toggle-mgmt .caption-toggle .title h3{font-size:16px;color:#666;font-weight:normal;line-height:24px;} 93 | .toggle-mgmt .caption-toggle .title p{display:none;color:#999;line-height:20px;} 94 | .toggle-mgmt .caption-toggle .buttons{float:right;margin-left:-128px;margin-top:1px;width:128px;text-align:right;} 95 | .toggle-mgmt .caption-toggle .buttons .u-button{display:inline-block;margin-left:10px;width:52px;height:20px;border:1px solid #6eafbd;background:#6eafbd;color:#fff;text-align:center;line-height:20px;border-radius:4px;-webkit-transition:all .2s linear;transition:all .2s linear;} 96 | .toggle-mgmt .caption-toggle .buttons .u-button:hover{border-color:#32b9d6;background-color:#32b9d6;text-decoration:none;} 97 | .toggle-mgmt .caption-toggle .buttons .u-button.z-disabled{border-color:#c8c8c8;background-color:#c8c8c8;} 98 | .toggle-mgmt .caption-toggle .buttons .u-button.z-active{border-color:#9bbd6e;background-color:#9bbd6e;} 99 | .toggle-mgmt .caption-toggle .buttons .u-button.z-active:hover{border-color:#b5d985;background-color:#b5d985;} 100 | .toggle-mgmt .caption-toggle .info{float:left;margin:0 128px 0 150px;width:550px;font-size:14px;line-height:24px;text-align:center;} 101 | .toggle-mgmt .caption-toggle .tips{display:none;position:absolute;right:24px;top:54px;font-size:14px;color:#ee1d23;line-height:24px;} 102 | .toggle-mgmt .toggle-item.z-active .caption-toggle .title{margin-right:-358px;width:328px;} 103 | .toggle-mgmt .toggle-item.z-active .caption-toggle .title p{display:block;} 104 | .toggle-mgmt .toggle-item.z-active .caption-toggle .info{display:none;margin-left:350px;width:358px;} 105 | .toggle-mgmt .content-toggle{display:none;} 106 | .toggle-mgmt .content-toggle:before, 107 | .toggle-mgmt .content-toggle:after{height:0;content:".";font-size:0;line-height:0;display:block;overflow:hidden;clear:both;} 108 | .wrap-modifypwd{position:relative;padding:20px;} 109 | .form-modifypwd{float:left;margin-left:120px;width:300px;} 110 | .form-modifypwd .item{margin-top:20px;} 111 | .form-modifypwd .item:before, 112 | .form-modifypwd .item:after{height:0;content:".";font-size:0;line-height:0;display:block;overflow:hidden;clear:both;} 113 | .form-modifypwd .info{position:relative;} 114 | .form-modifypwd .info:after{height:0;content:".";font-size:0;line-height:0;display:block;overflow:hidden;clear:both;} 115 | .form-modifypwd .u-text{position:relative;float:left;display:inline-block;vertical-align:top;} 116 | .form-modifypwd .u-text input{padding:7px 11px;width:276px;height:24px;border:1px solid #bdbdbd;font-size:14px;line-height:24px;} 117 | .form-modifypwd .u-text input.z-error{border-color:#ee1d23;} 118 | .form-modifypwd .u-text input:focus{border-color:#27b6a0;} 119 | .form-modifypwd .u-text label{position:absolute;left:0;top:0;z-index:0;margin-left:12px;margin-top:8px;background:#fff;font-size:14px;color:#999;line-height:24px;cursor:text;} 120 | .form-modifypwd .u-tips{position:absolute;left:0;top:40px;display:none;font-size:12px;color:#ee1d23;line-height:20px;} 121 | .form-modifypwd .u-button{display:inline-block;width:84px;height:36px;border:1px solid #e9412d;background:#e9412d;color:#fff;text-align:center;font-size:14px;line-height:34px;vertical-align:top;border-radius:4px;-webkit-transition:all .2s linear;transition:all .2s linear;} 122 | .form-modifypwd .u-button:hover{background-color:#ee1d23;text-decoration:none;} 123 | .form-modifypwd .u-button.z-disabled{border:1px solid #c8c8c8;background:#c8c8c8;} 124 | .tips-modifypwd{float:right;padding-left:40px;padding-top:80px;width:318px;height:176px;border-left:1px solid #e3e3e3;color:#999;line-height:24px;} 125 | .result-form{display:none;position:absolute;padding:10px 10px 10px 20px;width:174px;border:1px solid #dbdbdb;background:#fff;border-radius:4px;box-shadow:0 0 4px rgba(0, 0, 0, .1);} 126 | .result-form .icon{float:left;width:50px;height:50px;display:inline-block;background-position:0 0;background-repeat:no-repeat;} 127 | .result-form .success .icon{background-image:url(../img/icon_result_success.png);} 128 | .result-form .failure .icon{background-image:url(../img/icon_result_failure.png);} 129 | .result-form .content{margin-left:62px;} 130 | .result-form .content p{font-size:14px;color:#666;line-height:50px;} 131 | .result-form-modifypwd{left:192px;top:84px;} 132 | .result-form-resetpwd{left:332px;top:74px;} 133 | .result-form-editinfo{left:236px;top:34px;} 134 | .wrap-resetpwd{padding:20px 20px 40px;} 135 | .step-resetpwd{width:765px;margin:0 auto;} 136 | .step-resetpwd .step{float:left;margin-right:-1px;width:254px;height:42px;border:1px solid #bcbcbc;background:#fff;font-size:14px;color:#6eafbd;line-height:42px;text-align:center;} 137 | .step-resetpwd .step.z-active{background:#6eafbd;color:#fff;} 138 | .content-resetpwd{position:relative;padding-top:40px;} 139 | .form-resetpwd{margin:0 auto;width:300px;} 140 | .form-resetpwd .item{margin-top:20px;} 141 | .form-resetpwd .item:before, 142 | .form-resetpwd .item:after{height:0;content:".";font-size:0;line-height:0;display:block;overflow:hidden;clear:both;} 143 | .form-resetpwd .info{position:relative;} 144 | .form-resetpwd .info:after{height:0;content:".";font-size:0;line-height:0;display:block;overflow:hidden;clear:both;} 145 | .form-resetpwd .u-text{position:relative;float:left;display:inline-block;vertical-align:top;} 146 | .form-resetpwd .u-text input{padding:7px 11px;width:276px;height:24px;border:1px solid #bdbdbd;font-size:14px;line-height:24px;} 147 | .form-resetpwd .u-text input.z-error{border-color:#ee1d23;} 148 | .form-resetpwd .u-text input:focus{border-color:#27b6a0;} 149 | .form-resetpwd .u-text label{position:absolute;left:0;top:0;z-index:0;margin-left:12px;margin-top:8px;background:#fff;font-size:14px;color:#999;line-height:24px;cursor:text;} 150 | .form-resetpwd .u-tips{position:absolute;left:0;top:40px;display:none;font-size:12px;color:#ee1d23;line-height:20px;} 151 | .form-resetpwd .u-button{display:inline-block;width:84px;height:36px;border:1px solid #e9412d;background:#e9412d;color:#fff;text-align:center;font-size:14px;line-height:34px;vertical-align:top;border-radius:4px;-webkit-transition:all .2s linear;transition:all .2s linear;} 152 | .form-resetpwd .u-button:hover{background-color:#ee1d23;text-decoration:none;} 153 | .form-resetpwd .u-button.z-disabled{border:1px solid #c8c8c8;background:#c8c8c8;} 154 | .form-resetpwd .u-field{float:left;font-size:16px;color:#666;line-height:40px;vertical-align:top;} 155 | .form-resetpwd .item-idnum, 156 | .form-resetpwd .item-mobcode{margin-top:10px;} 157 | .form-resetpwd .item-button{text-align:center;margin-top:30px;} 158 | .form-resetpwd .item-normal .u-field{float:none;display:block;color:#333;text-align:center;line-height:24px;} 159 | .form-resetpwd .item-mobcode{margin-top:10px;} 160 | .form-resetpwd .item-mobcode .u-text input{width:188px;} 161 | .form-resetpwd .item-mobcode .u-button{float:left;margin-left:8px;width:80px;height:40px;border-color:#bdbdbd;background:#f0f0f0;color:#333;line-height:38px;vertical-align:top;border-radius:0;} 162 | .form-resetpwd .item-mobcode .u-button.z-disabled{border:1px solid #c8c8c8;background:#c8c8c8;font-size:12px;} 163 | .tips-resetpwd{margin:20px auto 0;width:318px;color:#999;line-height:24px;} 164 | .wrap-editinfo{position:relative;padding:0 20px 40px;} 165 | .form-editinfo{margin-left:164px;} 166 | .form-editinfo .item{margin-top:20px;} 167 | .form-editinfo .item:before, 168 | .form-editinfo .item:after{height:0;content:".";font-size:0;line-height:0;display:block;overflow:hidden;clear:both;} 169 | .form-editinfo .info{position:relative;} 170 | .form-editinfo .info:after{height:0;content:".";font-size:0;line-height:0;display:block;overflow:hidden;clear:both;} 171 | .form-editinfo .u-text{position:relative;float:left;display:inline-block;vertical-align:top;} 172 | .form-editinfo .u-text input{padding:7px 11px;width:276px;height:24px;border:1px solid #bdbdbd;font-size:14px;line-height:24px;} 173 | .form-editinfo .u-text input.z-error{border-color:#ee1d23;} 174 | .form-editinfo .u-text input:focus{border-color:#27b6a0;} 175 | .form-editinfo .u-text label{position:absolute;left:0;top:0;z-index:0;margin-left:12px;margin-top:8px;background:#fff;font-size:14px;color:#999;line-height:24px;cursor:text;} 176 | .form-editinfo .u-tips{position:absolute;left:0;top:40px;display:none;font-size:12px;color:#ee1d23;line-height:20px;} 177 | .form-editinfo .u-button{display:inline-block;width:84px;height:36px;border:1px solid #e9412d;background:#e9412d;color:#fff;text-align:center;font-size:12px;line-height:34px;vertical-align:top;border-radius:4px;-webkit-transition:all .2s linear;transition:all .2s linear;} 178 | .form-editinfo .u-button:hover{background-color:#ee1d23;text-decoration:none;} 179 | .form-editinfo .u-button.z-disabled{border:1px solid #c8c8c8;background:#c8c8c8;} 180 | .form-editinfo .u-field{float:left;font-size:16px;color:#666;line-height:40px;vertical-align:top;} 181 | .form-editinfo .item-normal .u-field{float:none;display:block;width:300px;color:#333;text-align:center;line-height:24px;} 182 | .form-editinfo .item-nickname{margin-top:10px;} 183 | .wrap-bankcard{padding:20px 20px 40px;} 184 | .bankcard-button{margin:0 auto;padding:40px;width:280px;background:#fff;border-radius:4px;box-shadow:0 2px 4px 0 rgba(0, 0, 0, .2);} 185 | .bankcard-button .inner{height:120px;border:1px dashed #e5e5e5;line-height:120px;text-align:center;} 186 | .bankcard-button .inner a{font-size:18px;color:#999;} 187 | .bankcard-bind{background:#f5f5f5;padding:108px 136px;} 188 | .bankcard-bind .show{padding:10px 20px 10px 10px;overflow:hidden;background:#fff;box-shadow:0 0 4px 0 rgba(0, 0, 0, .2);} 189 | .bankcard-bind .show .logo{float:left;margin-right:-146px;width:146px;} 190 | .bankcard-bind .show .logo img{display:block;width:146px;height:48px;} 191 | .bankcard-bind .show .number{float:left;margin-left:156px;margin-right:150px;width:268px;font-size:14px;line-height:48px;text-align:center;} 192 | .bankcard-bind .show .info{float:right;margin-left:-150px;width:150px;font-size:14px;line-height:48px;text-align:right;} 193 | .bankcard-bind .unbind{margin-top:10px;font-size:14px;line-height:24px;text-align:center;} 194 | .bankcard-bind .unbind a{color:#ee1d23;text-decoration:underline;} 195 | .wrap-realname{position:relative;padding:0 20px 40px;} 196 | .realname{display:inline-block;font-size:16px;color:#87c833;line-height:30px;text-align:left;} 197 | .wrap-attest{padding:100px 20px 40px;} 198 | .attest-button{margin:0 auto;padding:40px;width:280px;background:#fff;border-radius:4px;box-shadow:0 2px 4px 0 rgba(0, 0, 0, .2);} 199 | .attest-button .inner{height:80px;border:1px dashed #e5e5e5;line-height:80px;text-align:center;} 200 | .attest-button .inner a{font-size:18px;color:#ee1d23;} 201 | .attest-result-wrap{padding:100px 20px 40px;text-align:center;} 202 | .attest-result{display:inline-block;text-align:left;} 203 | .attest-result .icon{float:left;width:28px;height:28px;display:inline-block;background-position:0 0;background-repeat:no-repeat;} 204 | .attest-result .success .icon{background-image:url(../img/icon_result_success_3.png);} 205 | .attest-result .failure .icon{background-image:url(../img/icon_result_failure_3.png);} 206 | .attest-result .content{margin-left:40px;} 207 | .attest-result .content h3{font-size:20px;font-weight:normal;line-height:28px;} 208 | .attest-result .content p{font-size:14px;color:#666;line-height:28px;} 209 | .attest-result .buttons{margin-top:20px;padding-left:40px;} 210 | .attest-result .buttons .u-button{display:inline-block;width:82px;height:34px;border:1px solid #e9412d;background:#e9412d;font-size:12px;color:#fff;text-align:center;line-height:34px;border-radius:4px;-webkit-transition:all .2s linear;transition:all .2s linear;} 211 | .attest-result .buttons .u-button:hover{background-color:#ee1d23;text-decoration:none;} 212 | .attest-result .buttons .u-button.z-disabled{border:1px solid #c8c8c8;background:#c8c8c8;} 213 | .acc-record{padding-top:32px;} 214 | .acc-record-none{padding-top:80px;font-size:14px;color:#666;line-height:20px;text-align:center;} 215 | .acc-record-none a{color:#ee1d23;text-decoration:underline;} 216 | .m-filter:before, 217 | .m-filter:after{height:0;content:".";font-size:0;line-height:0;display:block;overflow:hidden;clear:both;} 218 | .form-filter{float:right;font-size:14px;color:#666;line-height:36px;} 219 | .form-filter .item{float:left;margin-left:8px;} 220 | .form-filter .item:before, 221 | .form-filter .item:after{height:0;content:".";font-size:0;line-height:0;display:block;overflow:hidden;clear:both;} 222 | .form-filter .item .label{float:left;} 223 | .form-filter .info{position:relative;float:left;margin-left:4px;} 224 | .form-filter .info:after{height:0;content:".";font-size:0;line-height:0;display:block;overflow:hidden;clear:both;} 225 | .form-filter .u-text{position:relative;float:left;margin-left:4px;display:inline-block;vertical-align:top;} 226 | .form-filter .u-text input{padding:5px 9px;width:104px;height:24px;border:1px solid #bdbdbd;font-size:14px;line-height:24px;} 227 | .form-filter .u-text input.z-error{border-color:#ee1d23;} 228 | .form-filter .u-text input:focus{border-color:#27b6a0;} 229 | .form-filter .u-text label{position:absolute;left:0;top:0;z-index:0;margin-left:10px;margin-top:8px;background:#fff;font-size:14px;color:#999;line-height:24px;cursor:text;} 230 | .form-filter .u-tips{position:absolute;left:0;top:40px;display:none;font-size:12px;color:#ee1d23;line-height:20px;} 231 | .form-filter .u-button{display:inline-block;width:84px;height:36px;border:1px solid #e9412d;background:#e9412d;color:#fff;text-align:center;font-size:14px;line-height:34px;vertical-align:top;border-radius:4px;-webkit-transition:all .2s linear;transition:all .2s linear;} 232 | .form-filter .u-button:hover{background-color:#ee1d23;text-decoration:none;} 233 | .form-filter .u-button.z-disabled{border:1px solid #c8c8c8;background:#c8c8c8;} 234 | .form-filter .u-field{float:left;margin-left:4px;font-size:16px;color:#666;line-height:36px;vertical-align:top;} 235 | .item-date .u-text input{width:84px;} 236 | .m-count-project{font-size:14px;color:#666;line-height:20px;} 237 | .m-count-project .item-group{margin-left:-80px;margin-bottom:10px;} 238 | .m-count-project .item{position:relative;margin-left:80px;} 239 | .m-count-project .item-first{padding-left:16px;background:url(../img/icon_dot_2.png) left center no-repeat;} 240 | .table-product tbody tr th, 241 | .table-product tbody tr td{padding:16px 8px;background-color:#eff7ff;} 242 | .table-product tr td, 243 | .table-product tr td a{color:#666;} 244 | .table-product .poster{position:relative;float:left;width:100px;height:100px;border:1px solid #e8e8e8;} 245 | .table-product .poster img{display:block;width:100px;height:100px;} 246 | .table-product .poster .status{position:absolute;left:0;top:0;z-index:100;padding:4px 8px;background:#649feb;font-size:12px;color:#fff;line-height:20px;} 247 | .table-product .wrap{margin-left:112px;} 248 | .table-product .number{font-size:12px;} 249 | .table-product .info{overflow:hidden;margin-top:20px;height:42px;} 250 | .table-product .info li{width:88px;float:left;font-size:12px;line-height:20px;} 251 | .table-product .info h4{font-weight:normal;} 252 | .table-product .info p{color:#999;} 253 | .layer-query{position:relative;z-index:9000;display:none;width:440px;background:#fff;border-radius:8px;} 254 | .layer-query > .close{position:absolute;right:-32px;top:-32px;width:32px;height:32px;background:url(../img/icon_close.png) center center no-repeat;cursor:pointer;} 255 | .layer-query > .title{padding:12px 16px;background:#f3f3f3;font-size:16px;font-weight:normal;line-height:24px;border-radius:8px 8px 0 0;} 256 | .layer-query > .content{position:relative;padding:40px 16px 48px;border-radius:0 0 8px 8px;} 257 | .layer-query .alert{padding:12px 16px;border:1px solid #faf0d8;background:#ffffe0;font-size:14px;color:#a2742c;line-height:20px;border-radius:4px;} 258 | .layer-query .alert h3{font-weight:normal;} 259 | .layer-query .alert p{font-size:12px;} 260 | .layer-query .buttons{margin-top:40px;text-align:center;} 261 | .layer-query .buttons .u-button{display:inline-block;width:82px;height:36px;border:1px solid #e9412d;background:#e9412d;font-size:14px;color:#fff;text-align:center;line-height:34px;vertical-align:top;border-radius:4px;-webkit-transition:all .2s linear;transition:all .2s linear;} 262 | .layer-query .buttons .u-button:hover{background-color:#ee1d23;text-decoration:none;} 263 | .layer-query .buttons .u-button-2{margin-left:10px;border-color:#5ea6e4;background-color:#5ea6e4;} 264 | .layer-query .buttons .u-button-2:hover{background-color:#519bda;} 265 | .layer-query .buttons .u-button.z-disabled{border:1px solid #c8c8c8;background:#c8c8c8;} 266 | .acc-address{padding:8px 32px 32px;} 267 | .m-title2{height:36px;border-bottom:1px solid #ee1d23;font-size:16px;line-height:36px;} 268 | .m-title2 .tit{color:#ee1d23;font-weight:normal;} 269 | .add-address{margin-top:20px;} 270 | .add-address:before, 271 | .add-address:after{height:0;content:".";font-size:0;line-height:0;display:block;overflow:hidden;clear:both;} 272 | .add-address .buttons .u-button{display:inline-block;width:82px;height:34px;border:1px solid #e9412d;background:#e9412d;font-size:12px;color:#fff;text-align:center;line-height:34px;vertical-align:top;border-radius:4px;-webkit-transition:all .2s linear;transition:all .2s linear;} 273 | .add-address .buttons .u-button:hover{background-color:#ee1d23;text-decoration:none;} 274 | .add-address .buttons .u-button-2{margin-left:10px;border-color:#5ea6e4;background-color:#5ea6e4;} 275 | .add-address .buttons .u-button-2:hover{background-color:#519bda;} 276 | .add-address .buttons .u-button.z-disabled{border:1px solid #c8c8c8;background:#c8c8c8;} 277 | .add-address .tips{display:none;margin-top:6px;margin-left:100px;color:#ee1d23;line-height:24px;} 278 | .address-list li{position:relative;margin-top:10px;padding:10px 40px 10px 60px;background:#eff7ff;} 279 | .address-list li .icon{display:none;position:absolute;right:0;top:0;width:24px;height:24px;background:url(../img/icon_select_2.png) 0 0 no-repeat;} 280 | .address-list li.z-active .icon{display:block;} 281 | .address-list .item{font-size:14px;line-height:24px;} 282 | .address-list .item:before, 283 | .address-list .item:after{height:0;content:".";font-size:0;line-height:0;display:block;overflow:hidden;clear:both;} 284 | .address-list .item .label{float:left;} 285 | .address-list .item .info{float:left;color:#666;} 286 | .address-list .buttons{position:absolute;right:40px;bottom:10px;} 287 | .address-list .buttons .u-button{margin-left:12px;font-size:14px;color:#4195eb;line-height:24px;} 288 | .layer-edit-address{position:relative;background:#fff;border-radius:8px;} 289 | .layer-edit-address > .close{position:absolute;right:-32px;top:-32px;width:32px;height:32px;background:url(../img/icon_close.png) center center no-repeat;cursor:pointer;} 290 | .layer-edit-address > .title{padding:12px 16px;background:#f3f3f3;font-size:16px;font-weight:normal;line-height:24px;border-radius:8px 8px 0 0;} 291 | .layer-edit-address > .content{padding-top:40px; padding-left:30%;border-radius:0 0 8px 8px;} 292 | .form-edit-address .item{position:relative;margin-top:0;margin-bottom:20px;} 293 | .form-edit-address .label{float:left;width:120px;font-size:16px;color:#999;line-height:40px;text-align:right;} 294 | .form-edit-address .info{position:relative;margin-left:128px;} 295 | .form-edit-address .info:after{height:0;content:".";font-size:0;line-height:0;display:block;overflow:hidden;clear:both;} 296 | .form-edit-address .u-text{position:relative;float:left;display:inline-block;vertical-align:top;} 297 | .form-edit-address .u-text input{padding:7px 11px;width:216px;height:24px;border:1px solid #bdbdbd;font-size:14px;line-height:24px;} 298 | .form-edit-address .u-text span{padding:7px 11px;width:216px;height:24px;font-size:14px;line-height:24px;} 299 | .form-edit-address .u-text textarea{padding:7px 11px;font-size:14px;} 300 | .form-edit-address .u-text select{padding:7px 11px;width:239px;height:40px;border:1px solid #bdbdbd;font-size:14px;line-height:24px;} 301 | .form-edit-address .u-text input.z-error{border-color:#ee1d23;} 302 | .form-edit-address .u-text input:focus{border-color:#27b6a0;} 303 | .form-edit-address .u-text input.z-disabled{color:#999;background-color:#ffffe0;} 304 | .form-edit-address .u-text label{position:absolute;left:0;top:0;z-index:0;margin-left:12px;margin-top:8px;background:#fff;font-size:14px;color:#999;line-height:24px;cursor:text;} 305 | .form-edit-address .u-tips{position:absolute;left:0;top:40px;display:none;font-size:12px;color:#ee1d23;line-height:20px;} 306 | .form-edit-address .u-button{display:inline-block;width:82px;height:40px;border:1px solid #e9412d;background:#e9412d;color:#fff;text-align:center;font-size:14px;line-height:38px;vertical-align:top;border-radius:4px;-webkit-transition:all .2s linear;transition:all .2s linear;} 307 | .form-edit-address .u-button:hover{background-color:#ee1d23;text-decoration:none;} 308 | .form-edit-address .u-button.z-disabled{border:1px solid #c8c8c8;background:#c8c8c8;} 309 | .form-edit-address .u-select{position:relative;z-index:2;float:left;display:inline-block;width:144px;height:38px;border:1px solid #bdbdbd;background:#fff;vertical-align:top;} 310 | .form-edit-address .u-select .value{position:relative;z-index:2;padding:7px 29px 7px 7px;overflow:hidden;height:24px;font-size:14px;line-height:24px;font-weight:normal;cursor:pointer;} 311 | .form-edit-address .u-select .value .val{display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;} 312 | .form-edit-address .u-select .value:after{position:absolute;top:0;right:0;width:24px;height:38px;content:".";font-size:0;line-height:0;background:#f0f0f0 url(../img/arrow_down.png) center center no-repeat;display:block;overflow:hidden;} 313 | .form-edit-address .u-select .list{position:absolute;left:-1px;top:38px;display:none;overflow-y:auto;width:100%;max-height:180px;border:1px solid #bdbdbd;background:#fff;} 314 | .form-edit-address .u-select .list li{padding:8px 7px;font-size:14px;color:#666;line-height:20px;cursor:pointer;} 315 | .form-edit-address .u-select .list li:hover{background:#f0f0f0;} 316 | .form-edit-address .u-select .list .z-active{background:#e0e0e0;} 317 | .form-edit-address .u-select .list .z-active:hover{background:#e8e8e8;} 318 | .form-edit-address .item-street .u-text input{width:430px;} 319 | .row-fluid{width:100%;float: left;} 320 | .span6{width:48%;float: left;} 321 | .control-group{margin-bottom:20px;} 322 | .control-label{float:left;width:160px;padding-top:5px;text-align:right;color:#999;font-size: 14px;margin-top:5px;} 323 | .controls{margin-left:180px;} 324 | .controls select{width:219px;height:30px;line-height:30px;font-size: 14px;} 325 | .controls input{width:219px;height:25px;line-height:25px;font-size: 14px;} --------------------------------------------------------------------------------