多条件过滤

多条件过滤_第1张图片

 多条件过滤_第2张图片

 多条件过滤_第3张图片

 

	getExamList:function(semester, timeStart, timeEnd, examType, subCode, callback){
		var json = JSON.parse($.cookie('user'))
		if (subCode === undefined) {
			subCode = '0';
		}
		if (timeStart === null || timeStart === undefined || timeStart === '') {
			timeStart = 0;
			timeEnd = 0;
		}
		var url = "../xqfx/multi/dkfx/kslb/list/" + json.schCode+ "/"+ json.yearIn + "/"+json.clzCode + "/"+subCode + "/"+semester + "/"+timeStart + "/"+timeEnd + "/"+examType;
		Tomd.wait();
		$.get(url, function(response){
         	if (0 != response.code)
         		return;
			Tomd.waitok();
         	callback(response.data);
		});
	},
	/**
	 * 考试(试卷列表)
	 */
	@ResponseBody
	@GetMapping("/list/{schCode}/{yearIn}/{clzCode}/{subCode}/{semester}/{timeStart}/{timeEnd}/{examType}")
	public JSONObject findPapers(@NonNull @PathVariable Long schCode,
			@NonNull @PathVariable Integer yearIn,
			@NonNull @PathVariable Long clzCode,
			@NonNull @PathVariable String subCode,
			@NonNull @PathVariable Integer semester,
			@PathVariable Long timeStart,
			@PathVariable Long timeEnd,
			@NonNull @PathVariable Integer examType) {
		JSONObject result = service.findPapers(subCode, schCode, yearIn, clzCode, semester, timeStart, timeEnd, examType);
		return result;
	}
@Override
	public JSONObject findPapers(String subCode, Long schCode, Integer yearIn, Long clzCode, Integer semester, Long timeStart, Long timeEnd, Integer examType) {
		JSONObject result = findClzPapers(schCode, yearIn, clzCode, subCode);
		JSONArray array = new JSONArray();
		for (int i=0;i= timeStart && examDate <= timeEnd){
				 	json.put("examType", examTypeName);
					json.put("examCode", examCode);
					json.put("examName", examName);
					json.put("paperCode", paperCode);
					json.put("subCode", subject);
					array.add(json);
				}else if(examTypeCode == examType && examDate >= timeStart && examDate <= timeEnd){
				 	json.put("examType", examTypeName);
					json.put("examCode", examCode);
					json.put("examName", examName);
					json.put("paperCode", paperCode);
					json.put("subCode", subject);
					array.add(json);
				}
			}else if(semester != 0 && semester != -1){
				 long recent = getRecent(semester); 
				 if(examType == 0 && examDate > recent){
					 json.put("examType", examTypeName);
						json.put("examCode", examCode);
						json.put("examName", examName);
						json.put("paperCode", paperCode);
						json.put("subCode", subject);
						array.add(json);
				 }else if(examTypeCode == examType && examDate > recent){
					 	json.put("examType", examTypeName);
						json.put("examCode", examCode);
						json.put("examName", examName);
						json.put("paperCode", paperCode);
						json.put("subCode", subject);
						array.add(json);
				 }
				 
			}	
		}
		result.put("data", array);
		return result;
	}
	
	@Override
	public JSONObject getPaper(Long paperCode, Long schCode, Integer yearIn, Integer includeAbsent, Integer includeTransient, Integer examCategory) {
		JSONObject result = getSglSchRis(paperCode, schCode, yearIn, 0L, AnalyzeConstant.ALL, includeAbsent, includeTransient, examCategory);
		return result;
	}
	
	//获取最近日期
	public long getRecent(Integer semester){
		long recent = 0;
		 Calendar c = Calendar.getInstance();
	        //过去七天
	        c.setTime(new Date());
	        c.add(Calendar.DATE, - 7);
	        long week = c.getTimeInMillis();
	        
	        //过去一月
	        c.setTime(new Date());
	        c.add(Calendar.MONTH, -1);
	        long mon = c.getTimeInMillis();
	         
	        //过去六个月
	        c.setTime(new Date());
	        c.add(Calendar.MONTH, -6);
	        long mon6 = c.getTimeInMillis();
	         
	        //过去一年
	        c.setTime(new Date());
	        c.add(Calendar.YEAR, -1);
	        long year = c.getTimeInMillis();
		
	        if(semester == 1){
	        	recent = year;
	        }else if(semester == 2){
	        	recent = mon6;
	        }else if(semester == 3){
	        	recent = mon;
	        }else if(semester == 4){
	        	recent = week;
	        }
		
		return recent;
		
	}

 

SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Calendar c = Calendar.getInstance();
         
        //过去七天
        c.setTime(new Date());
        c.add(Calendar.DATE, - 7);
        Date d = c.getTime();
        String day = format.format(d);
        System.out.println("过去七天:"+day);
         
        //过去一月
        c.setTime(new Date());
        c.add(Calendar.MONTH, -1);
        Date m = c.getTime();
        String mon = format.format(m);
        System.out.println("过去一个月:"+mon);
         
        //过去三个月
        c.setTime(new Date());
        c.add(Calendar.MONTH, -3);
        Date m3 = c.getTime();
        String mon3 = format.format(m3);
        System.out.println("过去三个月:"+mon3);
         
        //过去一年
        c.setTime(new Date());
        c.add(Calendar.YEAR, -1);
        Date y = c.getTime();
        String year = format.format(y);
        System.out.println("过去一年:"+year);

 

你可能感兴趣的:(java)