Commit b641d4d3 by xmh

1

1 parent e4494cd1
package com.viontech.match.controller; 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.RequestVo;
import com.viontech.match.entity.vo.ResponseVo; import com.viontech.match.entity.vo.ResponseVo;
import com.viontech.match.service.PersonService; import com.viontech.match.service.PersonService;
import com.viontech.match.service.PoolService; import com.viontech.match.service.PoolService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; 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;
/** /**
* . * .
...@@ -31,7 +35,7 @@ public class MainController { ...@@ -31,7 +35,7 @@ public class MainController {
@PostMapping @PostMapping
public ResponseVo all(@RequestBody RequestVo requestVo) throws Exception { public ResponseVo all(@RequestBody RequestVo requestVo) throws Exception {
String rid = requestVo.getRid(); String rid = requestVo.getRid();
try{ try {
switch (requestVo.getCommand()) { switch (requestVo.getCommand()) {
case AddPersonPool: case AddPersonPool:
return poolService.createPool(requestVo); return poolService.createPool(requestVo);
...@@ -48,9 +52,18 @@ public class MainController { ...@@ -48,9 +52,18 @@ public class MainController {
default: default:
return ResponseVo.commandNotFound(rid); return ResponseVo.commandNotFound(rid);
} }
}catch(Exception e){ } catch (Exception e) {
log.error("",e); log.error("", e);
return ResponseVo.error(rid, e.getMessage()); 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());
}
}
} }
...@@ -85,7 +85,9 @@ public class PersonService { ...@@ -85,7 +85,9 @@ public class PersonService {
poolStatus.add(pool); poolStatus.add(pool);
} }
ResponseVo success = ResponseVo.success(rid, "success"); ResponseVo success = ResponseVo.success(rid, "success");
success.setMatchPersons(result); if (result.size() > 0) {
success.setMatchPersons(result);
}
success.setMatch(1); success.setMatch(1);
success.setPersonPoolStatus(poolStatus); success.setPersonPoolStatus(poolStatus);
log.info("人员匹配操作完成,PoolIds:[{}},结果:[{}]", poolIds.toString(), objectMapper.writeValueAsString(success)); log.info("人员匹配操作完成,PoolIds:[{}},结果:[{}]", poolIds.toString(), objectMapper.writeValueAsString(success));
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!