|
@@ -3,7 +3,6 @@ package cn.com.qmth.examcloud.core.basic.api.provider;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Iterator;
|
|
|
import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
|
|
|
import javax.persistence.criteria.Predicate;
|
|
|
|
|
@@ -21,21 +20,14 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import com.google.common.collect.Lists;
|
|
|
-import com.google.common.collect.Maps;
|
|
|
|
|
|
import cn.com.qmth.examcloud.commons.exception.StatusException;
|
|
|
-import cn.com.qmth.examcloud.commons.helpers.DynamicEnum;
|
|
|
-import cn.com.qmth.examcloud.commons.helpers.DynamicEnumManager;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.OrgCloudService;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.bean.OrgBean;
|
|
|
-import cn.com.qmth.examcloud.core.basic.api.request.GetAllOrgPropertiesReq;
|
|
|
-import cn.com.qmth.examcloud.core.basic.api.request.GetOrgPropertyReq;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.request.GetOrgReq;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.request.GetOrgsByIdListReq;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.request.GetOrgsReq;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.request.SaveOrgReq;
|
|
|
-import cn.com.qmth.examcloud.core.basic.api.response.GetAllOrgPropertiesResp;
|
|
|
-import cn.com.qmth.examcloud.core.basic.api.response.GetOrgPropertyResp;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.response.GetOrgResp;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.response.GetOrgsByIdListResp;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.response.GetOrgsResp;
|
|
@@ -43,8 +35,6 @@ import cn.com.qmth.examcloud.core.basic.api.response.SaveOrgResp;
|
|
|
import cn.com.qmth.examcloud.core.basic.dao.OrgPropertyRepo;
|
|
|
import cn.com.qmth.examcloud.core.basic.dao.OrgRepo;
|
|
|
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.impl.OrgServiceImpl;
|
|
|
import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
|
|
@@ -215,62 +205,4 @@ public class OrgCloudServiceProvider extends ControllerSupport implements OrgClo
|
|
|
return resp;
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value = "获取所有机构属性")
|
|
|
- @PostMapping("getAllOrgProperties")
|
|
|
- @Override
|
|
|
- public GetAllOrgPropertiesResp getAllOrgProperties(@RequestBody GetAllOrgPropertiesReq req) {
|
|
|
- Long orgId = req.getOrgId();
|
|
|
-
|
|
|
- OrgEntity orgEntity = GlobalHelper.getEntity(orgRepo, orgId, OrgEntity.class);
|
|
|
- if (null == orgEntity) {
|
|
|
- throw new StatusException("001250", "orgId is wrong");
|
|
|
- }
|
|
|
-
|
|
|
- Map<String, String> map = Maps.newHashMap();
|
|
|
- List<OrgPropertyEntity> list = orgPropertyRepo.findByOrgId(orgId);
|
|
|
- DynamicEnumManager manager = OrgProperty.getDynamicEnumManager();
|
|
|
- for (OrgPropertyEntity cur : list) {
|
|
|
- DynamicEnum de = manager.getById(cur.getKeyId());
|
|
|
- map.put(de.getName(), cur.getValue());
|
|
|
- }
|
|
|
-
|
|
|
- GetAllOrgPropertiesResp resp = new GetAllOrgPropertiesResp();
|
|
|
- resp.setProps(map);
|
|
|
-
|
|
|
- return resp;
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "获取机构属性")
|
|
|
- @PostMapping("getOrgProperty")
|
|
|
- @Override
|
|
|
- public GetOrgPropertyResp getOrgProperty(@RequestBody GetOrgPropertyReq req) {
|
|
|
- Long orgId = req.getOrgId();
|
|
|
- Long keyId = req.getKeyId();
|
|
|
- String keyName = req.getKeyName();
|
|
|
-
|
|
|
- OrgEntity orgEntity = GlobalHelper.getEntity(orgRepo, orgId, OrgEntity.class);
|
|
|
- if (null == orgEntity) {
|
|
|
- throw new StatusException("001250", "orgId is wrong");
|
|
|
- }
|
|
|
-
|
|
|
- DynamicEnumManager manager = OrgProperty.getDynamicEnumManager();
|
|
|
- DynamicEnum de = null;
|
|
|
- if (null != keyId) {
|
|
|
- de = manager.getById(keyId);
|
|
|
- } else if (null != keyName) {
|
|
|
- de = manager.getByName(keyName);
|
|
|
- } else {
|
|
|
- throw new StatusException("001252", "keyId,keyName can not be all null");
|
|
|
- }
|
|
|
-
|
|
|
- OrgPropertyEntity one = orgPropertyRepo.findByOrgIdAndKeyId(orgId, de.getId());
|
|
|
- if (null == one) {
|
|
|
- return null;
|
|
|
- }
|
|
|
- String value = one.getValue();
|
|
|
-
|
|
|
- GetOrgPropertyResp resp = new GetOrgPropertyResp();
|
|
|
- resp.setValue(value);
|
|
|
- return resp;
|
|
|
- }
|
|
|
}
|