|
@@ -6,6 +6,7 @@ import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
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.UrlUtil;
|
|
import cn.com.qmth.examcloud.exchange.outer.service.UpyunService;
|
|
import cn.com.qmth.examcloud.exchange.outer.service.UpyunService;
|
|
import main.java.com.UpYun;
|
|
import main.java.com.UpYun;
|
|
|
|
|
|
@@ -53,6 +54,7 @@ public class UpyunServiceImpl implements UpyunService {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public String getStudentPhotoUrl(String identityNumber, Long rootOrgId, String fileName) {
|
|
public String getStudentPhotoUrl(String identityNumber, Long rootOrgId, String fileName) {
|
|
|
|
+ identityNumber = UrlUtil.encode(identityNumber);
|
|
String url = "http://" + bucket + ".b0.upaiyun.com" + path + "/" + rootOrgId + "/"
|
|
String url = "http://" + bucket + ".b0.upaiyun.com" + path + "/" + rootOrgId + "/"
|
|
+ identityNumber + "/" + fileName;
|
|
+ identityNumber + "/" + fileName;
|
|
return url;
|
|
return url;
|
|
@@ -70,6 +72,7 @@ public class UpyunServiceImpl implements UpyunService {
|
|
@Override
|
|
@Override
|
|
public String saveStudentPhoto(String identityNumber, Long rootOrgId, String fileName,
|
|
public String saveStudentPhoto(String identityNumber, Long rootOrgId, String fileName,
|
|
File file) {
|
|
File file) {
|
|
|
|
+ identityNumber = UrlUtil.encode(identityNumber);
|
|
String filePath = path + "/" + rootOrgId + "/" + identityNumber + "/" + fileName;
|
|
String filePath = path + "/" + rootOrgId + "/" + identityNumber + "/" + fileName;
|
|
try {
|
|
try {
|
|
getUpyun().writeFile(filePath, file, true);
|
|
getUpyun().writeFile(filePath, file, true);
|