MainController.java
2.04 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
package com.viontech.match.controller;
import com.viontech.keliu.model.FaceFeature;
import com.viontech.keliu.model.Person;
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.Collections;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
/**
* .
*
* @author 谢明辉
* @date 2020/11/23
*/
@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);
default:
return ResponseVo.commandNotFound(rid);
}
} catch (Exception e) {
log.error("", 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());
}
}
}