|
@@ -61,14 +61,17 @@ import cn.com.qmth.examcloud.core.basic.dao.entity.OrgEntity;
|
|
|
import cn.com.qmth.examcloud.core.basic.dao.entity.OrgPropertyEntity;
|
|
|
import cn.com.qmth.examcloud.core.basic.dao.enums.OrgProperty;
|
|
|
import cn.com.qmth.examcloud.core.basic.service.bean.OrgInfo;
|
|
|
+import cn.com.qmth.examcloud.core.basic.service.cache.SystemPropertyCache;
|
|
|
import cn.com.qmth.examcloud.core.basic.service.impl.OrgServiceImpl;
|
|
|
import cn.com.qmth.examcloud.exchange.inner.api.UpyunCloudService;
|
|
|
import cn.com.qmth.examcloud.exchange.inner.api.request.PutFileReq;
|
|
|
import cn.com.qmth.examcloud.exchange.inner.api.response.PutFileResp;
|
|
|
+import cn.com.qmth.examcloud.support.cache.bean.SysPropertyCacheBean;
|
|
|
import cn.com.qmth.examcloud.task.api.DataSyncCloudService;
|
|
|
import cn.com.qmth.examcloud.task.api.request.SyncOrgReq;
|
|
|
import cn.com.qmth.examcloud.web.config.SystemConfig;
|
|
|
import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
|
|
|
+import cn.com.qmth.examcloud.web.redis.RedisClient;
|
|
|
import cn.com.qmth.examcloud.web.support.ApiId;
|
|
|
import cn.com.qmth.examcloud.web.support.ControllerSupport;
|
|
|
import cn.com.qmth.examcloud.web.support.Naked;
|
|
@@ -88,6 +91,9 @@ import io.swagger.annotations.ApiOperation;
|
|
|
@RequestMapping("${$rmp.ctr.basic}/org")
|
|
|
public class OrgController extends ControllerSupport {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ RedisClient redisClient;
|
|
|
+
|
|
|
@Autowired
|
|
|
OrgRepo orgRepo;
|
|
|
|
|
@@ -106,6 +112,9 @@ public class OrgController extends ControllerSupport {
|
|
|
@Autowired
|
|
|
UpyunCloudService upyunCloudService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ SystemPropertyCache systemPropertyCache;
|
|
|
+
|
|
|
@ApiOperation(value = "分页查询所有机构")
|
|
|
@GetMapping("fullOrgPage/{curPage}/{pageSize}")
|
|
|
public PageInfo<OrgDomain> getFullOrgPage(@PathVariable Integer curPage,
|
|
@@ -598,6 +607,44 @@ public class OrgController extends ControllerSupport {
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
+ @Naked
|
|
|
+ @ApiOperation(value = "按属性组查询机构属性集合")
|
|
|
+ @GetMapping("propertiesByGroup/{orgId}/{propertyGroupId}")
|
|
|
+ public Map<String, String> getPropertiesByGroup(@PathVariable Long orgId,
|
|
|
+ @PathVariable String propertyGroupId) {
|
|
|
+
|
|
|
+ OrgEntity orgEntity = GlobalHelper.getEntity(orgRepo, orgId, OrgEntity.class);
|
|
|
+ if (null == orgEntity) {
|
|
|
+ throw new StatusException("001250", "orgId is wrong");
|
|
|
+ }
|
|
|
+ validateRootOrgIsolation(orgEntity.getRootId());
|
|
|
+
|
|
|
+ String key = "propertyGroup." + propertyGroupId;
|
|
|
+ String redisKey = "PROPERTIES_BY_GROUP:" + key;
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ Map<String, String> properties = redisClient.get(redisKey, Map.class);
|
|
|
+ if (null != properties) {
|
|
|
+ return properties;
|
|
|
+ }
|
|
|
+
|
|
|
+ SysPropertyCacheBean groupCacheBean = systemPropertyCache.get(key);
|
|
|
+
|
|
|
+ if (null == groupCacheBean) {
|
|
|
+ throw new StatusException("001280", "unknown propertyGroupId");
|
|
|
+ }
|
|
|
+
|
|
|
+ Object value = groupCacheBean.getValue();
|
|
|
+ if (null == value || StringUtils.isBlank(String.valueOf(value))) {
|
|
|
+ throw new StatusException("001281", "value of [" + key + "] is blank");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> keys = RegExpUtil.findAll(String.valueOf(value), "[^\\,]+");
|
|
|
+ properties = getProperties(orgEntity.getId(), keys);
|
|
|
+
|
|
|
+ redisClient.set(redisKey, properties, 120);
|
|
|
+ return properties;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 方法注释
|
|
|
*
|