提交 247a2513 编写于 作者: O o2null

Merge branch '人员组织查询缓存修改' into 'wrdp'

人员组织查询缓存修改

See merge request o2oa/o2oa!6268
......@@ -41,13 +41,15 @@ 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);
CacheManager.put(cache, cacheKey, o);
if (null != o) {
CacheManager.put(cache, cacheKey, o);
}
}
return o;
}
......@@ -55,7 +57,7 @@ public class GroupFactory extends AbstractFactory {
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());
......@@ -258,4 +260,4 @@ public class GroupFactory extends AbstractFactory {
return this.entityManagerContainer().list(Group.class, ids);
}
}
\ No newline at end of file
}
......@@ -37,13 +37,15 @@ 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);
CacheManager.put(cache, cacheKey, o);
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,13 +36,15 @@ 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);
CacheManager.put(cache, cacheKey, o);
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,13 +36,15 @@ 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);
CacheManager.put(cache, cacheKey, o);
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);
}
}
......@@ -103,4 +105,4 @@ public class UnitDutyFactory extends AbstractFactory {
.collect(Collectors.toList());
return list;
}
}
\ No newline at end of file
}
......@@ -42,13 +42,15 @@ 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);
CacheManager.put(cache, cacheKey, o);
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);
}
}
......@@ -343,4 +345,4 @@ public class UnitFactory extends AbstractFactory {
}
}
}
\ No newline at end of file
}
......@@ -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());
......@@ -210,4 +210,4 @@ public class PersonFactory extends AbstractFactory {
List<String> values = ListTools.extractProperty(list, JpaObject.DISTINGUISHEDNAME, String.class, true, true);
return values;
}
}
\ No newline at end of file
}
......@@ -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());
......@@ -105,4 +108,4 @@ public class UnitDutyFactory extends AbstractFactory {
.collect(Collectors.toList());
return list;
}
}
\ No newline at end of file
}
......@@ -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());
......@@ -307,4 +307,4 @@ public class UnitFactory extends AbstractFactory {
List<String> values = ListTools.extractProperty(list, JpaObject.DISTINGUISHEDNAME, String.class, true, true);
return values;
}
}
\ No newline at end of file
}
......@@ -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.
先完成此消息的编辑!
想要评论请 注册