anomalyCheckController.java
1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
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
41
42
43
44
45
46
47
48
49
50
package com.bsth.controller.realcontrol;
import com.bsth.data.schedule.DayOfSchedule;
import com.bsth.entity.realcontrol.ScheduleRealInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* 相关数据异常检测
* Created by panzhao on 2017/4/14.
*/
@RestController
@RequestMapping("anomalyCheck")
public class anomalyCheckController {
Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
DayOfSchedule dayOfSchedule;
/**
* 出现重复班次的车辆
* @param nbbm
*/
@RequestMapping(value = "/schRepeat", method = RequestMethod.POST)
public void schRepeat(@RequestParam String nbbm){
logger.info("前端通知,车辆 " + nbbm + "出现重复班次,开始检测...");
List<ScheduleRealInfo> list = dayOfSchedule.findByNbbm(nbbm);
Set<ScheduleRealInfo> set = new HashSet<>();
for(ScheduleRealInfo sch : list){
if(!set.add(sch)){
logger.info("出现一次重复班次,班次ID:" + sch.getId());
}
}
if(set.size() > 0){
dayOfSchedule.replaceByNbbm(nbbm, set);
}
}
}