deason 2 年之前
父节点
当前提交
db09fe7b01

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

@@ -24,6 +24,7 @@ import cn.com.qmth.examcloud.core.basic.service.SystemPropertyService;
 import cn.com.qmth.examcloud.core.basic.service.UserDataRuleService;
 import cn.com.qmth.examcloud.core.basic.service.bean.OrgInfo;
 import cn.com.qmth.examcloud.core.basic.service.cache.OrgCache;
+import cn.com.qmth.examcloud.core.basic.service.cache.OrgPropertyCache;
 import cn.com.qmth.examcloud.core.basic.service.cache.RootOrgCache;
 import cn.com.qmth.examcloud.core.basic.service.cache.SystemPropertyCache;
 import cn.com.qmth.examcloud.core.basic.service.impl.OrgServiceImpl;
@@ -128,6 +129,9 @@ public class OrgController extends ControllerSupport {
     @Autowired
     UserDataRuleService userDataRuleService;
 
+    @Autowired
+    OrgPropertyCache orgPropertyCache;
+
     @ApiOperation(value = "分页查询所有机构")
     @GetMapping("fullOrgPage/{curPage}/{pageSize}")
     public PageInfo<OrgDomain> getFullOrgPage(@PathVariable Integer curPage,
@@ -1088,7 +1092,6 @@ public class OrgController extends ControllerSupport {
 
     @ApiOperation(value = "保存机构属性", notes = "")
     @PutMapping("saveOrgProperties")
-    @Transactional
     public void saveOrgProperties(@RequestBody SaveOrgPropertiesDomain domain) {
         Long orgId = domain.getOrgId();
         OrgCacheBean org = CacheHelper.getOrg(orgId);
@@ -1120,6 +1123,12 @@ public class OrgController extends ControllerSupport {
         String changeInfo = getChangeInfo(domain);
         orgService.saveOrgProperties(orgEntity.getId(), properties);
 
+        if (null != properties) {
+            for (String key : properties.keySet()) {
+                orgPropertyCache.remove(orgId, key);
+            }
+        }
+
         if (CollectionUtils.isNotEmpty(relatedPropertyGroupIdList)) {
             for (String propertyGroupId : relatedPropertyGroupIdList) {
                 // 删除缓存

+ 2 - 0
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/OrgServiceImpl.java

@@ -34,6 +34,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.jpa.domain.Specification;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import javax.persistence.criteria.Predicate;
 import java.io.File;
@@ -271,6 +272,7 @@ public class OrgServiceImpl implements OrgService {
     }
 
     @Override
+    @Transactional
     public void saveOrgProperties(Long orgId, Map<String, String> properties) {
         if (MapUtils.isNotEmpty(properties)) {
             String clientEnabled = properties.get("PC_CLIENT_ENABLED");