wangwei преди 6 години
родител
ревизия
8629ff05ba

+ 8 - 3
examcloud-core-basic-base/src/main/java/cn/com/qmth/examcloud/core/basic/base/constants/PropKeys.java

@@ -7,15 +7,20 @@ package cn.com.qmth.examcloud.core.basic.base.constants;
  * @date 2018年6月21日
  * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
  */
-public class PropKeys {
+public interface PropKeys {
 
 	/**
 	 * 学校logo路径
 	 */
-	public static final String SCHOOL_LOGO_PATH = "$croe.basic.resource.schoolLogoPath";
+	String SCHOOL_LOGO_PATH = "$croe.basic.resource.schoolLogoPath";
 
 	/**
 	 * session过期时长
 	 */
-	public static final String SESSION_TIMEOUT = "$core.basic.sessionTimeout";
+	String SESSION_TIMEOUT = "$core.basic.sessionTimeout";
+
+	/**
+	 * 又拍云学生底照路径
+	 */
+	String UPYUN_STUDENT_PHOTO_PATH = "$upyun.studentPhotoPath";
 }

+ 13 - 1
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/StudentServiceImpl.java

@@ -18,6 +18,8 @@ import org.springframework.stereotype.Service;
 
 import cn.com.qmth.examcloud.commons.base.exception.StatusException;
 import cn.com.qmth.examcloud.commons.base.util.ErrorMsg;
+import cn.com.qmth.examcloud.commons.base.util.PropertiesUtil;
+import cn.com.qmth.examcloud.core.basic.base.constants.PropKeys;
 import cn.com.qmth.examcloud.core.basic.dao.OrgRepo;
 import cn.com.qmth.examcloud.core.basic.dao.StudentRepo;
 import cn.com.qmth.examcloud.core.basic.dao.UserRepo;
@@ -304,7 +306,17 @@ public class StudentServiceImpl implements StudentService {
 			}
 		}
 		info.setPhoneNumber(s.getPhoneNumber());
-		info.setPhotoPath(s.getPhotoPath());
+
+		if (StringUtils.isNotBlank(s.getPhotoPath())) {
+			String basePath = PropertiesUtil.getString(PropKeys.UPYUN_STUDENT_PHOTO_PATH);
+			if (StringUtils.isBlank(basePath)) {
+				throw new StatusException("B-160212", "照片根路径未配置");
+			}
+			String path = basePath + "/" + s.getPhotoPath();
+			path = StringUtils.replaceAll(path, "//", "/");
+			info.setPhotoPath(s.getPhotoPath());
+		}
+
 		info.setRemark(s.getRemark());
 		info.setRootOrgId(s.getRootOrgId());
 		Org rootOrg = orgRepo.findOne(s.getRootOrgId());

+ 3 - 1
examcloud-core-basic-starter/src/main/resources/application-dev.properties

@@ -14,4 +14,6 @@ $core.basic.sessionTimeout=3600
 $sendVerificationCode.sign=\u8003\u8BD5\u4E91\u5E73\u53F0
 $sendVerificationCode.templatecode=SMS_138073780
 $sendVerificationCode.effectivetime=120
-$sendVerificationCode.intervalseconds=90
+$sendVerificationCode.intervalseconds=90
+
+$upyun.studentPhotoPath=http://exam-cloud-test.b0.upaiyun.com/student_base_photo/

+ 1 - 0
examcloud-core-basic-starter/src/main/resources/application-prod.properties

@@ -20,3 +20,4 @@ $sendVerificationCode.templatecode=SMS_138073780
 $sendVerificationCode.effectivetime=120
 $sendVerificationCode.intervalseconds=90
 
+$upyun.studentPhotoPath=http://exam-cloud.b0.upaiyun.com/student_base_photo/

+ 2 - 0
examcloud-core-basic-starter/src/main/resources/application-test.properties

@@ -17,3 +17,5 @@ $sendVerificationCode.sign=\u8003\u8BD5\u4E91\u5E73\u53F0
 $sendVerificationCode.templatecode=SMS_138073780
 $sendVerificationCode.effectivetime=120
 $sendVerificationCode.intervalseconds=90
+
+$upyun.studentPhotoPath=http://exam-cloud-test.b0.upaiyun.com/student_base_photo/