WANG 5 gadi atpakaļ
vecāks
revīzija
94a8bc37ca

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

@@ -637,10 +637,7 @@ public class OrgController extends ControllerSupport {
 		return properties;
 	}
 
-	@ApiOperation(value = "上传机构属性集合至upyun")
-	@PostMapping("uploadOrgProperties2Upyun/{orgId}/{propertyGroupId}")
-	public List<String> uploadOrgProperties2Upyun(@PathVariable Long orgId,
-			@PathVariable String propertyGroupId) {
+	private List<String> uploadOrgProperties2Upyun(Long orgId, String propertyGroupId) {
 		Map<String, String> properties = getOrgPropertiesByGroup(orgId, propertyGroupId);
 
 		OrgEntity orgEntity = GlobalHelper.getEntity(orgRepo, orgId, OrgEntity.class);
@@ -1024,12 +1021,22 @@ public class OrgController extends ControllerSupport {
 	public void saveOrgProperties(@RequestBody SaveOrgPropertiesDomain domain) {
 		Long orgId = domain.getOrgId();
 		Map<String, String> properties = domain.getProperties();
+		List<String> relatedPropertyGroupIdList = domain.getRelatedPropertyGroupIdList();
 
 		OrgEntity orgEntity = GlobalHelper.getPresentEntity(orgRepo, orgId, OrgEntity.class);
 
 		validateRootOrgIsolation(orgEntity.getRootId());
 
 		orgService.saveOrgProperties(orgEntity.getId(), properties);
+
+		for (String propertyGroupId : relatedPropertyGroupIdList) {
+			// 删除缓存
+			String redisKey = "PROPERTIES_BY_GROUP:" + orgId + ":" + propertyGroupId;
+			redisClient.delete(redisKey);
+
+			// 上传upyun
+			uploadOrgProperties2Upyun(orgId, propertyGroupId);
+		}
 	}
 
 	/**

+ 11 - 0
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/bean/SaveOrgPropertiesDomain.java

@@ -1,5 +1,6 @@
 package cn.com.qmth.examcloud.core.basic.api.controller.bean;
 
+import java.util.List;
 import java.util.Map;
 
 import cn.com.qmth.examcloud.api.commons.exchange.JsonSerializable;
@@ -19,6 +20,8 @@ public class SaveOrgPropertiesDomain implements JsonSerializable {
 
 	private Map<String, String> properties;
 
+	private List<String> relatedPropertyGroupIdList;
+
 	public Long getOrgId() {
 		return orgId;
 	}
@@ -35,4 +38,12 @@ public class SaveOrgPropertiesDomain implements JsonSerializable {
 		this.properties = properties;
 	}
 
+	public List<String> getRelatedPropertyGroupIdList() {
+		return relatedPropertyGroupIdList;
+	}
+
+	public void setRelatedPropertyGroupIdList(List<String> relatedPropertyGroupIdList) {
+		this.relatedPropertyGroupIdList = relatedPropertyGroupIdList;
+	}
+
 }