|
@@ -14,6 +14,7 @@ import javax.persistence.criteria.Predicate;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
import org.apache.commons.fileupload.FileItem;
|
|
import org.apache.commons.fileupload.FileItem;
|
|
import org.apache.commons.io.FileUtils;
|
|
import org.apache.commons.io.FileUtils;
|
|
import org.apache.commons.io.IOUtils;
|
|
import org.apache.commons.io.IOUtils;
|
|
@@ -44,6 +45,7 @@ import cn.com.qmth.examcloud.commons.base.exception.StatusException;
|
|
import cn.com.qmth.examcloud.commons.base.helpers.DynamicEnum;
|
|
import cn.com.qmth.examcloud.commons.base.helpers.DynamicEnum;
|
|
import cn.com.qmth.examcloud.commons.base.helpers.DynamicEnumManager;
|
|
import cn.com.qmth.examcloud.commons.base.helpers.DynamicEnumManager;
|
|
import cn.com.qmth.examcloud.commons.base.util.PropertiesUtil;
|
|
import cn.com.qmth.examcloud.commons.base.util.PropertiesUtil;
|
|
|
|
+import cn.com.qmth.examcloud.commons.base.util.RegExpUtil;
|
|
import cn.com.qmth.examcloud.commons.web.helpers.page.PageInfo;
|
|
import cn.com.qmth.examcloud.commons.web.helpers.page.PageInfo;
|
|
import cn.com.qmth.examcloud.commons.web.security.bean.User;
|
|
import cn.com.qmth.examcloud.commons.web.security.bean.User;
|
|
import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
|
|
import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
|
|
@@ -91,7 +93,8 @@ public class OrgController extends ControllerSupport {
|
|
public PageInfo<OrgDomain> getRootOrgPage(@PathVariable Integer curPage,
|
|
public PageInfo<OrgDomain> getRootOrgPage(@PathVariable Integer curPage,
|
|
@PathVariable Integer pageSize, @RequestParam(required = false) String code,
|
|
@PathVariable Integer pageSize, @RequestParam(required = false) String code,
|
|
@RequestParam(required = false) String domainName,
|
|
@RequestParam(required = false) String domainName,
|
|
- @RequestParam(required = false) String name) {
|
|
|
|
|
|
+ @RequestParam(required = false) String name,
|
|
|
|
+ @RequestParam(required = false) String propertyKeys) {
|
|
|
|
|
|
Pageable pageable = new PageRequest(curPage, pageSize, Sort.Direction.DESC, "updateTime");
|
|
Pageable pageable = new PageRequest(curPage, pageSize, Sort.Direction.DESC, "updateTime");
|
|
|
|
|
|
@@ -114,6 +117,11 @@ public class OrgController extends ControllerSupport {
|
|
List<OrgDomain> list = Lists.newArrayList();
|
|
List<OrgDomain> list = Lists.newArrayList();
|
|
Iterator<OrgEntity> iterator = page.iterator();
|
|
Iterator<OrgEntity> iterator = page.iterator();
|
|
|
|
|
|
|
|
+ List<String> propertyKeyList = null;
|
|
|
|
+ if (StringUtils.isNotBlank(propertyKeys)) {
|
|
|
|
+ propertyKeyList = RegExpUtil.findAll(propertyKeys, "\\w+");
|
|
|
|
+ }
|
|
|
|
+
|
|
while (iterator.hasNext()) {
|
|
while (iterator.hasNext()) {
|
|
OrgEntity next = iterator.next();
|
|
OrgEntity next = iterator.next();
|
|
OrgDomain d = new OrgDomain();
|
|
OrgDomain d = new OrgDomain();
|
|
@@ -131,6 +139,11 @@ public class OrgController extends ControllerSupport {
|
|
d.setDomainName(next.getDomainName());
|
|
d.setDomainName(next.getDomainName());
|
|
d.setCreationTime(next.getCreationTime());
|
|
d.setCreationTime(next.getCreationTime());
|
|
d.setUpdateTime(next.getUpdateTime());
|
|
d.setUpdateTime(next.getUpdateTime());
|
|
|
|
+
|
|
|
|
+ if (CollectionUtils.isNotEmpty(propertyKeyList)) {
|
|
|
|
+ Map<String, String> properties = getProperties(d.getId(), propertyKeyList);
|
|
|
|
+ d.setProperties(properties);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
PageInfo<OrgDomain> ret = new PageInfo<OrgDomain>();
|
|
PageInfo<OrgDomain> ret = new PageInfo<OrgDomain>();
|
|
@@ -139,6 +152,28 @@ public class OrgController extends ControllerSupport {
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 方法注释
|
|
|
|
+ *
|
|
|
|
+ * @author WANGWEI
|
|
|
|
+ * @param orgId
|
|
|
|
+ * @param propertyKeys
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private Map<String, String> getProperties(Long orgId, List<String> propertyKeys) {
|
|
|
|
+ DynamicEnumManager manager = OrgProperty.getDynamicEnumManager();
|
|
|
|
+ Map<String, String> map = Maps.newHashMap();
|
|
|
|
+ for (String key : propertyKeys) {
|
|
|
|
+ DynamicEnum de = manager.getByName(key);
|
|
|
|
+ OrgPropertyEntity one = orgPropertyRepo.findByOrgIdAndKeyId(orgId, de.getId());
|
|
|
|
+ if (null != one) {
|
|
|
|
+ map.put(key, one.getValue());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return map;
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 方法注释
|
|
* 方法注释
|
|
*
|
|
*
|
|
@@ -455,11 +490,11 @@ public class OrgController extends ControllerSupport {
|
|
validateRootOrgIsolation(orgEntity.getRootId());
|
|
validateRootOrgIsolation(orgEntity.getRootId());
|
|
|
|
|
|
OrgInfo info = new OrgInfo();
|
|
OrgInfo info = new OrgInfo();
|
|
-
|
|
|
|
|
|
+
|
|
info.setCode(orgEntity.getCode());
|
|
info.setCode(orgEntity.getCode());
|
|
info.setParentId(orgEntity.getParentId());
|
|
info.setParentId(orgEntity.getParentId());
|
|
info.setRootId(orgEntity.getRootId());
|
|
info.setRootId(orgEntity.getRootId());
|
|
-
|
|
|
|
|
|
+
|
|
info.setName(domain.getName());
|
|
info.setName(domain.getName());
|
|
info.setContacts(domain.getContacts());
|
|
info.setContacts(domain.getContacts());
|
|
info.setTelephone(domain.getTelephone());
|
|
info.setTelephone(domain.getTelephone());
|