|  | @ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 | 
	
		
			
				|  |  | import com.fasterxml.jackson.databind.node.ArrayNode;
 | 
	
		
			
				|  |  | import com.yihu.hos.common.Services;
 | 
	
		
			
				|  |  | import com.yihu.hos.core.datatype.CollectionUtil;
 | 
	
		
			
				|  |  | import com.yihu.hos.core.datatype.StringUtil;
 | 
	
		
			
				|  |  | import com.yihu.hos.datacollect.model.RsJobConfig;
 | 
	
		
			
				|  |  | import com.yihu.hos.datacollect.service.DatacollectManager;
 | 
	
		
			
				|  |  | import com.yihu.hos.resource.service.StdService;
 | 
	
	
		
			
				|  | @ -14,6 +15,9 @@ import com.yihu.hos.web.framework.model.ActionResult;
 | 
	
		
			
				|  |  | import com.yihu.hos.web.framework.model.Result;
 | 
	
		
			
				|  |  | import com.yihu.hos.web.framework.util.controller.BaseController;
 | 
	
		
			
				|  |  | import org.apache.commons.beanutils.BeanUtils;
 | 
	
		
			
				|  |  | import org.joda.time.DateTime;
 | 
	
		
			
				|  |  | import org.joda.time.format.DateTimeFormat;
 | 
	
		
			
				|  |  | import org.joda.time.format.DateTimeFormatter;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | import org.springframework.stereotype.Controller;
 | 
	
		
			
				|  |  | import org.springframework.ui.Model;
 | 
	
	
		
			
				|  | @ -80,7 +84,7 @@ public class DataCollectController extends BaseController {
 | 
	
		
			
				|  |  |             //获取方案列表
 | 
	
		
			
				|  |  |             List data = stdService.getSchemeVersion();
 | 
	
		
			
				|  |  |             String jsonlist = objectMapper.writeValueAsString(data);
 | 
	
		
			
				|  |  |             ArrayNode jsonArray = objectMapper.readValue(jsonlist,ArrayNode.class);
 | 
	
		
			
				|  |  |             ArrayNode jsonArray = objectMapper.readValue(jsonlist, ArrayNode.class);
 | 
	
		
			
				|  |  |             model.addAttribute("schemeList", "{\"detailModelList\":" + (CollectionUtil.isEmpty(data) ? "[]" : jsonArray) + "}");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             model.addAttribute("contentPage", "/datacollect/editorJob");
 | 
	
	
		
			
				|  | @ -108,16 +112,15 @@ public class DataCollectController extends BaseController {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @RequestMapping("compareServeTime")
 | 
	
		
			
				|  |  |     @ResponseBody
 | 
	
		
			
				|  |  |     public Result getJob(String time){
 | 
	
		
			
				|  |  |     public Result getJob(String time) {
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 | 
	
		
			
				|  |  |             if(df.parse(time).before(new Date())) {
 | 
	
		
			
				|  |  |             if (df.parse(time).before(new Date())) {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 return Result.success("beforeServeTime");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             else
 | 
	
		
			
				|  |  |             } else
 | 
	
		
			
				|  |  |                 return Result.error("afterServeTime");
 | 
	
		
			
				|  |  |         }catch (Exception ex){
 | 
	
		
			
				|  |  |         } catch (Exception ex) {
 | 
	
		
			
				|  |  |             return Result.error(ex.getMessage());
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
	
		
			
				|  | @ -161,9 +164,9 @@ public class DataCollectController extends BaseController {
 | 
	
		
			
				|  |  |             BeanUtils.populate(obj, request.getParameterMap());
 | 
	
		
			
				|  |  |             obj.setValid("1");
 | 
	
		
			
				|  |  |             obj.setJobCron(cron);
 | 
	
		
			
				|  |  |             String time=request.getParameter("jobNextTime");
 | 
	
		
			
				|  |  |             String time = request.getParameter("jobNextTime");
 | 
	
		
			
				|  |  |             SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 | 
	
		
			
				|  |  |             if(df.parse(time).before(new Date())) {
 | 
	
		
			
				|  |  |             if (df.parse(time).before(new Date())) {
 | 
	
		
			
				|  |  |                 return Result.error("任务开始时间不能小于当前时间");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -188,12 +191,26 @@ public class DataCollectController extends BaseController {
 | 
	
		
			
				|  |  |             obj.setJobCron(cron);
 | 
	
		
			
				|  |  | //            ConvertUtils.register(new DateLocaleConverter(), Date.class);
 | 
	
		
			
				|  |  |             BeanUtils.populate(obj, request.getParameterMap());
 | 
	
		
			
				|  |  |             String time=request.getParameter("jobNextTime");
 | 
	
		
			
				|  |  |             String time = request.getParameter("jobNextTime");
 | 
	
		
			
				|  |  |             SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 | 
	
		
			
				|  |  |             if(df.parse(time).before(new Date())) {
 | 
	
		
			
				|  |  |             if (df.parse(time).before(new Date())) {
 | 
	
		
			
				|  |  |                 return Result.error("任务开始时间不能小于当前时间");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             String delayTime = request.getParameter("delayTime");//延迟时间
 | 
	
		
			
				|  |  |             String startTime = request.getParameter("repeatStartTime");
 | 
	
		
			
				|  |  |             String endTime = request.getParameter("repeatEndTime");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             DateTimeFormatter dateTimeFormat = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
 | 
	
		
			
				|  |  |             if (StringUtil.isBlank(endTime)) {
 | 
	
		
			
				|  |  |                 endTime = DateTime.now().toString(dateTimeFormat);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             DateTime beginDate = DateTime.parse(startTime, dateTimeFormat);
 | 
	
		
			
				|  |  |             DateTime endDate = DateTime.parse(endTime, dateTimeFormat);
 | 
	
		
			
				|  |  |             beginDate = beginDate.plusDays(Integer.valueOf(delayTime));//开始时间+延迟时间
 | 
	
		
			
				|  |  |             if (beginDate.isAfter(endDate)) {
 | 
	
		
			
				|  |  |                 return Result.error("任务开始时间加延迟时间不能大于结束时间");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             return datacollect.updateJob(obj, cron, jobDataset);
 | 
	
		
			
				|  |  |         } catch (Exception ex) {
 | 
	
		
			
				|  |  |             ex.printStackTrace();
 |