提交 af3d66f7 编写于 作者: O o2sword

人员组织查询缓存修改

上级 0e2595bd
......@@ -41,21 +41,23 @@ public class GroupFactory extends AbstractFactory {
}
Group o = null;
CacheKey cacheKey = new CacheKey(flag);
CacheKey cacheKey = new CacheKey(Group.class.getName(), flag);
Optional<?> optional = CacheManager.get(cache, cacheKey);
if (optional.isPresent()) {
o = (Group) optional.get();
} else {
o = this.pickObject(flag);
if (null != o) {
CacheManager.put(cache, cacheKey, o);
}
}
return o;
}
public List<Group> pick(List<String> flags) throws Exception {
List<Group> list = new ArrayList<>();
for (String str : flags) {
CacheKey cacheKey = new CacheKey(str);
CacheKey cacheKey = new CacheKey(Group.class.getName(), str);
Optional<?> optional = CacheManager.get(cache, cacheKey);
if (optional.isPresent()) {
list.add((Group) optional.get());
......
......@@ -37,14 +37,16 @@ public class IdentityFactory extends AbstractFactory {
return null;
}
Identity o = null;
CacheKey cacheKey = new CacheKey(flag);
CacheKey cacheKey = new CacheKey(Identity.class.getName(), flag);
Optional<?> optional = CacheManager.get(cache, cacheKey);
if (optional.isPresent()) {
o = (Identity) optional.get();
} else {
o = this.pickObject(flag);
if (null != o) {
CacheManager.put(cache, cacheKey, o);
}
}
return o;
}
......@@ -82,14 +84,14 @@ public class IdentityFactory extends AbstractFactory {
public List<Identity> pick(List<String> flags) throws Exception {
List<Identity> list = new ArrayList<>();
for (String str : flags) {
CacheKey cacheKey = new CacheKey(str);
CacheKey cacheKey = new CacheKey(Identity.class.getName(), str);
Optional<?> optional = CacheManager.get(cache, cacheKey);
if (optional.isPresent()) {
list.add((Identity) optional.get());
} else {
Identity o = this.pickObject(str);
CacheManager.put(cache, cacheKey, o);
if (null != o) {
CacheManager.put(cache, cacheKey, o);
list.add(o);
}
}
......
......@@ -36,14 +36,16 @@ public class PersonFactory extends AbstractFactory {
return null;
}
Person o = null;
CacheKey cacheKey = new CacheKey(flag);
CacheKey cacheKey = new CacheKey(Person.class.getName(), flag);
Optional<?> optional = CacheManager.get(cache, cacheKey);
if (optional.isPresent()) {
o = (Person) optional.get();
} else {
o = this.pickObject(flag);
if (null != o) {
CacheManager.put(cache, cacheKey, o);
}
}
return o;
}
......@@ -81,14 +83,14 @@ public class PersonFactory extends AbstractFactory {
public List<Person> pick(List<String> flags) throws Exception {
List<Person> list = new ArrayList<>();
for (String str : flags) {
CacheKey cacheKey = new CacheKey(str);
CacheKey cacheKey = new CacheKey(Person.class.getName(), str);
Optional<?> optional = CacheManager.get(cache, cacheKey);
if (optional.isPresent()) {
list.add((Person) optional.get());
} else {
Person o = this.pickObject(str);
CacheManager.put(cache, cacheKey, o);
if (null != o) {
CacheManager.put(cache, cacheKey, o);
list.add(o);
}
}
......
......@@ -36,14 +36,16 @@ public class UnitDutyFactory extends AbstractFactory {
return null;
}
UnitDuty o = null;
CacheKey cacheKey = new CacheKey(flag);
CacheKey cacheKey = new CacheKey(UnitDuty.class.getName(), flag);
Optional<?> optional = CacheManager.get(cache, cacheKey);
if (optional.isPresent()) {
o = (UnitDuty) optional.get();
} else {
o = this.pickObject(flag);
if (null != o) {
CacheManager.put(cache, cacheKey, o);
}
}
return o;
}
......@@ -81,14 +83,14 @@ public class UnitDutyFactory extends AbstractFactory {
public List<UnitDuty> pick(List<String> flags) throws Exception {
List<UnitDuty> list = new ArrayList<>();
for (String str : flags) {
CacheKey cacheKey = new CacheKey(str);
CacheKey cacheKey = new CacheKey(UnitDuty.class.getName(), str);
Optional<?> optional = CacheManager.get(cache, cacheKey);
if (optional.isPresent()) {
list.add((UnitDuty) optional.get());
} else {
UnitDuty o = this.pickObject(str);
CacheManager.put(cache, cacheKey, o);
if (null != o) {
CacheManager.put(cache, cacheKey, o);
list.add(o);
}
}
......
......@@ -42,14 +42,16 @@ public class UnitFactory extends AbstractFactory {
return null;
}
Unit o = null;
CacheKey cacheKey = new CacheKey(flag);
CacheKey cacheKey = new CacheKey(Unit.class.getName(), flag);
Optional<?> optional = CacheManager.get(cache, cacheKey);
if (optional.isPresent()) {
o = (Unit) optional.get();
} else {
o = this.pickObject(flag);
if (null != o) {
CacheManager.put(cache, cacheKey, o);
}
}
return o;
}
......@@ -104,14 +106,14 @@ public class UnitFactory extends AbstractFactory {
public List<Unit> pick(List<String> flags) throws Exception {
List<Unit> list = new ArrayList<>();
for (String str : flags) {
CacheKey cacheKey = new CacheKey(str);
CacheKey cacheKey = new CacheKey(Unit.class.getName(), str);
Optional<?> optional = CacheManager.get(cache, cacheKey);
if (optional.isPresent()) {
list.add((Unit) optional.get());
} else {
Unit o = this.pickObject(str);
CacheManager.put(cache, cacheKey, o);
if (null != o) {
CacheManager.put(cache, cacheKey, o);
list.add(o);
}
}
......
......@@ -42,7 +42,7 @@ public class IdentityFactory extends AbstractFactory {
return null;
}
Identity o = null;
CacheKey cacheKey = new CacheKey(flag);
CacheKey cacheKey = new CacheKey(Identity.class.getName(), flag);
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
if (optional.isPresent()) {
o = (Identity) optional.get();
......@@ -89,7 +89,7 @@ public class IdentityFactory extends AbstractFactory {
public List<Identity> pick(List<String> flags) throws Exception {
List<Identity> list = new ArrayList<>();
for (String str : flags) {
CacheKey cacheKey = new CacheKey(str);
CacheKey cacheKey = new CacheKey(Identity.class.getName(), str);
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
if (optional.isPresent()) {
list.add((Identity) optional.get());
......
......@@ -40,7 +40,7 @@ public class PersonFactory extends AbstractFactory {
return null;
}
Person o = null;
CacheKey cacheKey = new CacheKey(flag);
CacheKey cacheKey = new CacheKey(Person.class.getName(), flag);
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
if (optional.isPresent()) {
o = (Person) optional.get();
......@@ -90,7 +90,7 @@ public class PersonFactory extends AbstractFactory {
public List<Person> pick(List<String> flags) throws Exception {
List<Person> list = new ArrayList<>();
for (String str : ListTools.trim(flags, true, false)) {
CacheKey cacheKey = new CacheKey(str);
CacheKey cacheKey = new CacheKey(Person.class.getName(), str);
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
if (optional.isPresent()) {
list.add((Person) optional.get());
......
......@@ -23,6 +23,9 @@ import com.x.organization.assemble.express.Business;
import com.x.organization.core.entity.UnitDuty;
import com.x.organization.core.entity.UnitDuty_;
/**
* @author sword
*/
public class UnitDutyFactory extends AbstractFactory {
private CacheCategory cacheCategory = new CacheCategory(UnitDuty.class);
......@@ -36,7 +39,7 @@ public class UnitDutyFactory extends AbstractFactory {
return null;
}
UnitDuty o = null;
CacheKey cacheKey = new CacheKey(flag);
CacheKey cacheKey = new CacheKey(UnitDuty.class.getSimpleName(), flag);
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
if (optional.isPresent()) {
o = (UnitDuty) optional.get();
......@@ -83,7 +86,7 @@ public class UnitDutyFactory extends AbstractFactory {
public List<UnitDuty> pick(List<String> flags) throws Exception {
List<UnitDuty> list = new ArrayList<>();
for (String str : flags) {
CacheKey cacheKey = new CacheKey(str);
CacheKey cacheKey = new CacheKey(UnitDuty.class.getSimpleName(), str);
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
if (optional.isPresent()) {
list.add((UnitDuty) optional.get());
......
......@@ -42,7 +42,7 @@ public class UnitFactory extends AbstractFactory {
return null;
}
Unit o = null;
CacheKey cacheKey = new CacheKey(flag);
CacheKey cacheKey = new CacheKey(Unit.class.getName(), flag);
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
if (optional.isPresent()) {
o = (Unit) optional.get();
......@@ -106,7 +106,7 @@ public class UnitFactory extends AbstractFactory {
public List<Unit> pick(List<String> flags) throws Exception {
List<Unit> list = new ArrayList<>();
for (String str : flags) {
CacheKey cacheKey = new CacheKey(str);
CacheKey cacheKey = new CacheKey(Unit.class.getName(), str);
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
if (optional.isPresent()) {
list.add((Unit) optional.get());
......
......@@ -68,13 +68,7 @@ class ActionListWithUnitSubDirectObject extends BaseAction {
private List<Wo> list(Business business, Wi wi) throws Exception {
List<Wo> wos = new ArrayList<>();
List<Unit> os = business.unit().pick(wi.getUnitList());
List<String> unitIds = new ArrayList<>();
for (Unit o : os) {
if(!unitIds.contains(o.getId())) {
unitIds.add(o.getId());
}
}
unitIds = ListTools.trim(unitIds, true, true);
List<String> unitIds = ListTools.extractField(os, Unit.id_FIELDNAME, String.class, true, true);
List<Identity> list = new ArrayList<>();
if(ListTools.isNotEmpty(unitIds)) {
list = business.entityManagerContainer().fetchIn(Identity.class,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册