MainController.java
2.5 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package com.viontech.match.controller;
import com.viontech.match.entity.vo.RequestVo;
import com.viontech.match.entity.vo.ResponseVo;
import com.viontech.match.service.PersonService;
import com.viontech.match.service.PoolService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.List;
/**
* .
*
* @author 谢明辉
* @version 0.0.1
*/
@RestController
@RequestMapping("/alg")
@Slf4j
public class MainController {
@Resource
private PersonService personService;
@Resource
private PoolService poolService;
@PostMapping
public ResponseVo all(@RequestBody RequestVo requestVo) throws Exception {
String rid = requestVo.getRid();
try {
switch (requestVo.getCommand()) {
case AddPersonPool:
return poolService.createPool(requestVo);
case DelPersonPool:
return poolService.deletePool(requestVo);
case ModifyPersonPool:
return poolService.modifyPool(requestVo);
case QueryPersonPool:
return poolService.queryPool(requestVo);
case MatchPerson:
return personService.matchPerson(requestVo);
case UpdatePerson:
return personService.updatePerson(requestVo);
case CountMatchPerson:
return personService.countMatchPerson(requestVo);
default:
return ResponseVo.commandNotFound(rid);
}
} catch (Exception e) {
log.error("match exception", e);
return ResponseVo.error(rid, e.getMessage());
}
}
@GetMapping("/pools")
public Object getPools() {
try {
return poolService.queryPoolInfo(null);
} catch (IOException e) {
return ResponseVo.error("error", e.getMessage());
}
}
@GetMapping("/compare")
public Object compare(@RequestParam(name = "poolId")List<String> poolId, @RequestParam(name = "unid")String unid, @RequestParam(name = "mallId")Long mallId, @RequestParam(name = "zoneId", required = false)List<Long> zoneId, @RequestParam(name = "gateId")List<Long> gateId, @RequestParam(name = "direction")List<Integer> direction, @RequestParam(name = "size")Integer size) throws IOException {
return personService.compare(poolId, unid, mallId, zoneId, gateId, direction,size);
}
}