|
@@ -2,6 +2,7 @@ package com.x.organization.assemble.control.jaxrs.identity;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
+import java.util.Optional;
|
|
|
|
|
|
|
|
import javax.persistence.EntityManager;
|
|
import javax.persistence.EntityManager;
|
|
|
import javax.persistence.criteria.CriteriaBuilder;
|
|
import javax.persistence.criteria.CriteriaBuilder;
|
|
@@ -9,7 +10,6 @@ import javax.persistence.criteria.CriteriaQuery;
|
|
|
import javax.persistence.criteria.Predicate;
|
|
import javax.persistence.criteria.Predicate;
|
|
|
import javax.persistence.criteria.Root;
|
|
import javax.persistence.criteria.Root;
|
|
|
|
|
|
|
|
-import org.apache.commons.collections.ListUtils;
|
|
|
|
|
import org.apache.commons.collections4.set.ListOrderedSet;
|
|
import org.apache.commons.collections4.set.ListOrderedSet;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
|
@@ -20,7 +20,6 @@ import com.x.base.core.entity.JpaObject;
|
|
|
import com.x.base.core.project.annotation.FieldDescribe;
|
|
import com.x.base.core.project.annotation.FieldDescribe;
|
|
|
import com.x.base.core.project.bean.WrapCopier;
|
|
import com.x.base.core.project.bean.WrapCopier;
|
|
|
import com.x.base.core.project.bean.WrapCopierFactory;
|
|
import com.x.base.core.project.bean.WrapCopierFactory;
|
|
|
-import com.x.base.core.project.cache.ApplicationCache;
|
|
|
|
|
import com.x.base.core.project.gson.GsonPropertyObject;
|
|
import com.x.base.core.project.gson.GsonPropertyObject;
|
|
|
import com.x.base.core.project.http.ActionResult;
|
|
import com.x.base.core.project.http.ActionResult;
|
|
|
import com.x.base.core.project.http.EffectivePerson;
|
|
import com.x.base.core.project.http.EffectivePerson;
|
|
@@ -30,8 +29,8 @@ import com.x.organization.assemble.control.Business;
|
|
|
import com.x.organization.core.entity.Identity;
|
|
import com.x.organization.core.entity.Identity;
|
|
|
import com.x.organization.core.entity.Identity_;
|
|
import com.x.organization.core.entity.Identity_;
|
|
|
import com.x.organization.core.entity.UnitDuty;
|
|
import com.x.organization.core.entity.UnitDuty;
|
|
|
-
|
|
|
|
|
-import net.sf.ehcache.Element;
|
|
|
|
|
|
|
+import com.x.base.core.project.cache.Cache.CacheKey;
|
|
|
|
|
+import com.x.base.core.project.cache.CacheManager;
|
|
|
|
|
|
|
|
class ActionListLikePinyin extends BaseAction {
|
|
class ActionListLikePinyin extends BaseAction {
|
|
|
|
|
|
|
@@ -40,16 +39,16 @@ class ActionListLikePinyin extends BaseAction {
|
|
|
ActionResult<List<Wo>> result = new ActionResult<>();
|
|
ActionResult<List<Wo>> result = new ActionResult<>();
|
|
|
Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
|
|
Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
|
|
|
Business business = new Business(emc);
|
|
Business business = new Business(emc);
|
|
|
- String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(), wi.getKey(),
|
|
|
|
|
|
|
+ CacheKey cacheKey = new CacheKey(this.getClass(), wi.getKey(),
|
|
|
StringUtils.join(wi.getUnitList(), ","),
|
|
StringUtils.join(wi.getUnitList(), ","),
|
|
|
StringUtils.join(wi.getUnitDutyList(), ","),
|
|
StringUtils.join(wi.getUnitDutyList(), ","),
|
|
|
StringUtils.join(wi.getGroupList(), ","));
|
|
StringUtils.join(wi.getGroupList(), ","));
|
|
|
- Element element = business.cache().get(cacheKey);
|
|
|
|
|
- if (null != element && (null != element.getObjectValue())) {
|
|
|
|
|
- result.setData((List<Wo>) element.getObjectValue());
|
|
|
|
|
|
|
+ Optional<?> optional = CacheManager.get(business.cache(), cacheKey);
|
|
|
|
|
+ if (optional.isPresent()) {
|
|
|
|
|
+ result.setData((List<Wo>) optional.get());
|
|
|
} else {
|
|
} else {
|
|
|
List<Wo> wos = this.list(business, wi);
|
|
List<Wo> wos = this.list(business, wi);
|
|
|
- business.cache().put(new Element(cacheKey, wos));
|
|
|
|
|
|
|
+ CacheManager.put(business.cache(), cacheKey, wos);
|
|
|
result.setData(wos);
|
|
result.setData(wos);
|
|
|
}
|
|
}
|
|
|
return result;
|
|
return result;
|