WANG 6 år sedan
förälder
incheckning
d712740b22

+ 8 - 1
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/StudentController.java

@@ -27,6 +27,7 @@ import org.springframework.web.bind.annotation.RestController;
 import com.google.common.collect.Lists;
 
 import cn.com.qmth.examcloud.commons.base.exception.StatusException;
+import cn.com.qmth.examcloud.commons.base.util.PropertiesUtil;
 import cn.com.qmth.examcloud.commons.web.helpers.page.PageInfo;
 import cn.com.qmth.examcloud.commons.web.security.bean.User;
 import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
@@ -119,6 +120,12 @@ public class StudentController extends ControllerSupport {
 
 		List<StudentDomain> studentDomainList = Lists.newArrayList();
 
+		String urlPrefix = PropertiesUtil.getString("$upyun.studentPhoto.url.prefix");
+		if (StringUtils.isBlank(urlPrefix)) {
+			throw new StatusException("B-560111",
+					"property[$upyun.studentPhoto.url.prefix] is not configured");
+		}
+
 		while (iterator.hasNext()) {
 			StudentEntity next = iterator.next();
 			StudentDomain bean = new StudentDomain();
@@ -130,7 +137,7 @@ public class StudentController extends ControllerSupport {
 			bean.setEnable(next.getEnable());
 			bean.setStudentCode(next.getStudentCode());
 			bean.setIdentityNumber(next.getIdentityNumber());
-			bean.setPhotoPath(next.getPhotoPath());
+			bean.setPhotoPath(urlPrefix + next.getPhotoPath());
 			bean.setPhoneNumber(next.getPhoneNumber());
 			bean.setSecurityPhone(next.getSecurityPhone());
 			bean.setRemark(next.getRemark());