WANG 5 yıl önce
ebeveyn
işleme
eab20c2eec

+ 15 - 5
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/OrgController.java

@@ -640,10 +640,11 @@ public class OrgController extends ControllerSupport {
 	@Naked
 	@ApiOperation(value = "上传机构属性集合至upyun")
 	@GetMapping("uploadOrgProperties2Upyun/{orgId}/{propertyGroupId}")
-	public String uploadOrgProperties2Upyun(@PathVariable Long orgId,
+	public List<String> uploadOrgProperties2Upyun(@PathVariable Long orgId,
 			@PathVariable String propertyGroupId) {
 		Map<String, String> properties = getOrgPropertiesByGroup(orgId, propertyGroupId);
 
+		OrgEntity orgEntity = GlobalHelper.getEntity(orgRepo, orgId, OrgEntity.class);
 		String fileSuffix = ".json";
 
 		String filePath = systemConfig.getTempDataDir() + File.separator + "orgProperties"
@@ -652,6 +653,7 @@ public class OrgController extends ControllerSupport {
 		File file = new File(filePath);
 		String prettyJson = JsonUtil.toPrettyJson(properties);
 
+		List<String> urlList = Lists.newArrayList();
 		try {
 			FileUtils.write(file, prettyJson, "UTF-8");
 
@@ -661,13 +663,21 @@ public class OrgController extends ControllerSupport {
 			formFilePartList.add(part);
 
 			req.setFormFilePartList(formFilePartList);
-			req.setSiteId("orgProperties");
+			req.setSiteId("orgPropertiesByOrgId");
 			req.setFileSuffix(".json");
-			req.setRootOrgId(orgId);
+			req.setRootOrgId(orgEntity.getId());
+			req.setRootOrgDomain(orgEntity.getDomainName());
 			req.setExt1(propertyGroupId);
+
 			PutFileResp putFileResp = upyunCloudService.putFile(req);
-			String url = putFileResp.getUrl();
-			return url;
+			urlList.add(putFileResp.getUrl());
+
+			req.setSiteId("orgPropertiesByOrgDomain");
+			putFileResp = upyunCloudService.putFile(req);
+			urlList.add(putFileResp.getUrl());
+
+			return urlList;
+
 		} catch (IOException e) {
 			throw new ExamCloudRuntimeException(e);
 		} finally {