|
@@ -4,6 +4,10 @@ import cn.com.qmth.examcloud.api.commons.EnterpriseService;
|
|
|
import cn.com.qmth.examcloud.commons.exception.StatusException;
|
|
|
import cn.com.qmth.examcloud.commons.util.HttpClientUtil;
|
|
|
import cn.com.qmth.examcloud.commons.util.ZipUtil;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.StudentCloudService;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.bean.StudentBean;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.request.GetStudentReq;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.response.GetStudentResp;
|
|
|
import cn.com.qmth.examcloud.exchange.outer.service.FaceService;
|
|
|
import cn.com.qmth.examcloud.support.util.IdUtil;
|
|
|
import cn.com.qmth.examcloud.web.config.SystemProperties;
|
|
@@ -15,6 +19,8 @@ import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import org.apache.commons.fileupload.disk.DiskFileItem;
|
|
|
import org.apache.commons.io.FileUtils;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
@@ -33,17 +39,15 @@ import java.util.Map;
|
|
|
*
|
|
|
* @author WANGWEI
|
|
|
* @date 2018年11月14日
|
|
|
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
|
|
|
*/
|
|
|
@Api(tags = "学生照片相关接口")
|
|
|
@RestController
|
|
|
@RequestMapping("${$rmp.cloud.exchange.outer}/face")
|
|
|
public class FaceOuterServiceProvider extends ControllerSupport implements EnterpriseService {
|
|
|
|
|
|
- private static final long serialVersionUID = -6268268043341270752L;
|
|
|
+ private static final Logger log = LoggerFactory.getLogger(FaceOuterServiceProvider.class);
|
|
|
|
|
|
- @Autowired
|
|
|
- private SystemProperties systemConfig;
|
|
|
+ private static final long serialVersionUID = -6268268043341270752L;
|
|
|
|
|
|
/**
|
|
|
* ZIP最大50M
|
|
@@ -55,9 +59,34 @@ public class FaceOuterServiceProvider extends ControllerSupport implements Enter
|
|
|
*/
|
|
|
private static final int MAX_SIZE = 500;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SystemProperties systemConfig;
|
|
|
+
|
|
|
@Autowired
|
|
|
private FaceService faceService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private StudentCloudService studentCloudService;
|
|
|
+
|
|
|
+ @ApiOperation(value = "获取学生照片URL", hidden = true)
|
|
|
+ @PostMapping("getPhotoUrl")
|
|
|
+ public String getPhotoUrl(
|
|
|
+ @RequestParam @ApiParam(value = "顶级机构ID", example = "123", required = true) Long rootOrgId,
|
|
|
+ @RequestParam @ApiParam(value = "学生证件号") String identityNumber,
|
|
|
+ @RequestParam @ApiParam(value = "学号") String studentCode) {
|
|
|
+ if (!getEnterpriseRootOrgId().equals(rootOrgId)) {
|
|
|
+ throw new StatusException("1000001", "rootOrgId is wrong");
|
|
|
+ }
|
|
|
+
|
|
|
+ GetStudentReq req = new GetStudentReq();
|
|
|
+ req.setRootOrgId(rootOrgId);
|
|
|
+ req.setIdentityNumber(identityNumber);
|
|
|
+ req.setStudentCode(studentCode);
|
|
|
+ GetStudentResp resp = studentCloudService.getStudent(req);
|
|
|
+ StudentBean student = resp.getStudentInfo();
|
|
|
+ return student.getPhotoPath();
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation(value = "保存学生照片(图片URL)")
|
|
|
@PostMapping("addPhotoByUrl")
|
|
|
public void addPhotoByUrl(
|
|
@@ -97,9 +126,9 @@ public class FaceOuterServiceProvider extends ControllerSupport implements Enter
|
|
|
@ApiOperation(value = "保存学生照片(图片文件)")
|
|
|
@PostMapping("addPhoto")
|
|
|
public void addPhoto(@RequestParam @ApiParam(value = "顶级机构ID", example = "123", required = true) Long rootOrgId,
|
|
|
- @RequestParam @ApiParam(value = "学生证件号", required = true) String identityNumber,
|
|
|
- @RequestParam @ApiParam(value = "操作者", required = true) String operator,
|
|
|
- @RequestParam @ApiParam(value = "学生照片文件(文件名称=证件号+图片后缀)", required = true) CommonsMultipartFile file) {
|
|
|
+ @RequestParam @ApiParam(value = "学生证件号", required = true) String identityNumber,
|
|
|
+ @RequestParam @ApiParam(value = "操作者", required = true) String operator,
|
|
|
+ @RequestParam @ApiParam(value = "学生照片文件(文件名称=证件号+图片后缀)", required = true) CommonsMultipartFile file) {
|
|
|
|
|
|
if (!getEnterpriseRootOrgId().equals(rootOrgId)) {
|
|
|
throw new StatusException("1000001", "rootOrgId is wrong");
|