deason 2 هفته پیش
والد
کامیت
5a35d46ef3

+ 9 - 3
examcloud-exchange-api-provider/src/main/java/cn/com/qmth/examcloud/exchange/outer/api/provider/FaceOuterServiceProvider.java

@@ -19,10 +19,10 @@ 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.apache.commons.lang3.StringUtils;
 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;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
@@ -71,11 +71,17 @@ public class FaceOuterServiceProvider extends ControllerSupport implements Enter
     @ApiOperation(value = "获取学生照片URL", hidden = true)
     @PostMapping("getPhotoUrl")
     public String getPhotoUrl(
-            @RequestParam @ApiParam(value = "顶级机构ID", example = "123", required = true) Long rootOrgId,
+            @RequestParam @ApiParam(value = "顶级机构ID", example = "123") Long rootOrgId,
             @RequestParam @ApiParam(value = "学生证件号") String identityNumber,
             @RequestParam @ApiParam(value = "学号") String studentCode) {
+        if (rootOrgId == null) {
+            throw new StatusException("参数rootOrgId的值不能为空!");
+        }
+        if (StringUtils.isBlank(identityNumber) || StringUtils.isBlank(studentCode)) {
+            throw new StatusException("参数identityNumber和studentCode的值不能同时为空,至少传一个值!");
+        }
         if (!getEnterpriseRootOrgId().equals(rootOrgId)) {
-            throw new StatusException("1000001", "rootOrgId is wrong");
+            throw new StatusException("1000001", "参数rootOrgId的值无效!");
         }
 
         GetStudentReq req = new GetStudentReq();