|
@@ -22,7 +22,6 @@ import com.google.common.collect.Maps;
|
|
import cn.com.qmth.examcloud.commons.base.exception.StatusException;
|
|
import cn.com.qmth.examcloud.commons.base.exception.StatusException;
|
|
import cn.com.qmth.examcloud.commons.base.util.HttpClientUtil;
|
|
import cn.com.qmth.examcloud.commons.base.util.HttpClientUtil;
|
|
import cn.com.qmth.examcloud.commons.base.util.ZipUtil;
|
|
import cn.com.qmth.examcloud.commons.base.util.ZipUtil;
|
|
-import cn.com.qmth.examcloud.commons.web.security.bean.User;
|
|
|
|
import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
|
|
import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
|
|
import cn.com.qmth.examcloud.exchange.outer.api.FaceOuterService;
|
|
import cn.com.qmth.examcloud.exchange.outer.api.FaceOuterService;
|
|
import cn.com.qmth.examcloud.exchange.outer.service.FaceService;
|
|
import cn.com.qmth.examcloud.exchange.outer.service.FaceService;
|
|
@@ -69,6 +68,10 @@ public class FaceOuterServiceProvider extends ControllerSupport implements FaceO
|
|
@RequestParam @ApiParam(value = "照片地址", required = true) String photoUrl,
|
|
@RequestParam @ApiParam(value = "照片地址", required = true) String photoUrl,
|
|
@RequestParam @ApiParam(value = "操作者", required = true) String operator) {
|
|
@RequestParam @ApiParam(value = "操作者", required = true) String operator) {
|
|
|
|
|
|
|
|
+ if (!getSecurityRootOrgId().equals(rootOrgId)) {
|
|
|
|
+ throw new StatusException("EX-1000001", "rootOrgId is wrong");
|
|
|
|
+ }
|
|
|
|
+
|
|
if (photoUrl.startsWith("http")) {
|
|
if (photoUrl.startsWith("http")) {
|
|
byte[] bs = HttpClientUtil.get(photoUrl);
|
|
byte[] bs = HttpClientUtil.get(photoUrl);
|
|
|
|
|
|
@@ -98,9 +101,14 @@ public class FaceOuterServiceProvider extends ControllerSupport implements FaceO
|
|
@PostMapping("addPhoto")
|
|
@PostMapping("addPhoto")
|
|
@Override
|
|
@Override
|
|
public void addPhoto(
|
|
public void addPhoto(
|
|
|
|
+ @RequestParam @ApiParam(value = "顶级机构ID", example = "1", required = true) Long rootOrgId,
|
|
|
|
+ @RequestParam @ApiParam(value = "身份证", required = true) String identityNumber,
|
|
|
|
+ @RequestParam @ApiParam(value = "操作者", required = true) String operator,
|
|
@RequestParam @ApiParam(value = "学生照片文件(文件名称=身份证号码+文件后缀) 如:xxxxxxxxxx.jpg", required = true) CommonsMultipartFile file) {
|
|
@RequestParam @ApiParam(value = "学生照片文件(文件名称=身份证号码+文件后缀) 如:xxxxxxxxxx.jpg", required = true) CommonsMultipartFile file) {
|
|
- User accessUser = getAccessUser();
|
|
|
|
- Long rootOrgId = accessUser.getRootOrgId();
|
|
|
|
|
|
+
|
|
|
|
+ if (!getSecurityRootOrgId().equals(rootOrgId)) {
|
|
|
|
+ throw new StatusException("EX-1000001", "rootOrgId is wrong");
|
|
|
|
+ }
|
|
|
|
|
|
DiskFileItem item = (DiskFileItem) file.getFileItem();
|
|
DiskFileItem item = (DiskFileItem) file.getFileItem();
|
|
File storeLocation = item.getStoreLocation();
|
|
File storeLocation = item.getStoreLocation();
|
|
@@ -113,21 +121,22 @@ public class FaceOuterServiceProvider extends ControllerSupport implements FaceO
|
|
if (!fileName.matches("[^\\.\\s]+\\.[^\\.\\s]+")) {
|
|
if (!fileName.matches("[^\\.\\s]+\\.[^\\.\\s]+")) {
|
|
throw new StatusException("EX-600101", "文件名不合法");
|
|
throw new StatusException("EX-600101", "文件名不合法");
|
|
}
|
|
}
|
|
- String identityNumber = fileName.substring(0, fileName.lastIndexOf("."));
|
|
|
|
String fileSuffix = fileName.substring(fileName.lastIndexOf("."));
|
|
String fileSuffix = fileName.substring(fileName.lastIndexOf("."));
|
|
|
|
|
|
- faceService.processFace(rootOrgId, identityNumber, fileSuffix, storeLocation,
|
|
|
|
- accessUser.getDisplayName());
|
|
|
|
|
|
+ faceService.processFace(rootOrgId, identityNumber, fileSuffix, storeLocation, operator);
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "导入学生照片", httpMethod = "POST")
|
|
@ApiOperation(value = "导入学生照片", httpMethod = "POST")
|
|
@PostMapping("importPhotos")
|
|
@PostMapping("importPhotos")
|
|
@Override
|
|
@Override
|
|
public List<Map<String, String>> importPhotos(
|
|
public List<Map<String, String>> importPhotos(
|
|
|
|
+ @RequestParam @ApiParam(value = "顶级机构ID", example = "1", required = true) Long rootOrgId,
|
|
|
|
+ @RequestParam @ApiParam(value = "操作者", required = true) String operator,
|
|
@RequestParam @ApiParam(value = "学生照片文件(身份证号码+文件后缀)压缩包(ZIP文件,压缩包内不含目录)", required = true) CommonsMultipartFile file) {
|
|
@RequestParam @ApiParam(value = "学生照片文件(身份证号码+文件后缀)压缩包(ZIP文件,压缩包内不含目录)", required = true) CommonsMultipartFile file) {
|
|
|
|
|
|
- User accessUser = getAccessUser();
|
|
|
|
- Long rootOrgId = accessUser.getRootOrgId();
|
|
|
|
|
|
+ if (!getSecurityRootOrgId().equals(rootOrgId)) {
|
|
|
|
+ throw new StatusException("EX-1000001", "rootOrgId is wrong");
|
|
|
|
+ }
|
|
|
|
|
|
DiskFileItem item = (DiskFileItem) file.getFileItem();
|
|
DiskFileItem item = (DiskFileItem) file.getFileItem();
|
|
File storeLocation = item.getStoreLocation();
|
|
File storeLocation = item.getStoreLocation();
|
|
@@ -181,7 +190,7 @@ public class FaceOuterServiceProvider extends ControllerSupport implements FaceO
|
|
String fileSuffix = fileName.substring(fileName.lastIndexOf("."));
|
|
String fileSuffix = fileName.substring(fileName.lastIndexOf("."));
|
|
|
|
|
|
faceService.processFace(rootOrgId, identityNumber, fileSuffix, storeLocation,
|
|
faceService.processFace(rootOrgId, identityNumber, fileSuffix, storeLocation,
|
|
- accessUser.getDisplayName());
|
|
|
|
|
|
+ operator);
|
|
|
|
|
|
map.put("statusCode", "200");
|
|
map.put("statusCode", "200");
|
|
map.put("statusDesc", "成功");
|
|
map.put("statusDesc", "成功");
|