提交 9e8f3b75 编写于 作者: Z zhourui

x_processplatform_service_processing fixed

上级 481b7c67
......@@ -87,7 +87,7 @@ public class ApplicationFactory extends ElementFactory {
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<Application> root = cq.from(Application.class);
cq.select(root.get(Application_.id)).distinct(true);
cq.select(root.get(Application_.id));
if (effectivePerson.isNotManager() && (!this.business().organization().person().hasRole(effectivePerson,
OrganizationDefinition.Manager, OrganizationDefinition.ProcessPlatformManager))) {
Predicate p = cb.and(cb.isEmpty(root.get(Application_.availableIdentityList)),
......@@ -102,7 +102,7 @@ public class ApplicationFactory extends ElementFactory {
}
cq.where(p);
}
return em.createQuery(cq.distinct(true)).getResultList();
return em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
}
public <T extends Application> List<T> sort(List<T> list) {
......
......@@ -21,26 +21,6 @@ public class FileFactory extends ElementFactory {
return this.pick(flag, File.class);
}
// private File pickObject(String flag) throws Exception {
// File o = this.business().entityManagerContainer().flag(flag, File.class);
// if (o != null) {
// this.entityManagerContainer().get(File.class).detach(o);
// }
// if (null == o) {
// EntityManager em = this.entityManagerContainer().get(File.class);
// CriteriaBuilder cb = em.getCriteriaBuilder();
// CriteriaQuery<File> cq = cb.createQuery(File.class);
// Root<File> root = cq.from(File.class);
// Predicate p = cb.equal(root.get(File_.name), flag);
// List<File> os = em.createQuery(cq.select(root).where(p).distinct(true)).getResultList();
// if (os.size() == 1) {
// o = os.get(0);
// em.detach(o);
// }
// }
// return o;
// }
public <T extends File> List<T> sort(List<T> list) {
list = list.stream()
.sorted(Comparator.comparing(File::getAlias, Comparator.nullsLast(String::compareTo))
......
......@@ -65,47 +65,7 @@ public class ProcessFactory extends ElementFactory {
return o;
}
// private Process pickObject(String flag) throws Exception {
// Process o = this.business().entityManagerContainer().flag(flag, Process.class);
// if (o != null) {
// this.entityManagerContainer().get(Process.class).detach(o);
// }
// if (null == o) {
// EntityManager em = this.entityManagerContainer().get(Process.class);
// CriteriaBuilder cb = em.getCriteriaBuilder();
// CriteriaQuery<Process> cq = cb.createQuery(Process.class);
// Root<Process> root = cq.from(Process.class);
// Predicate p = cb.equal(root.get(Process_.name), flag);
// List<Process> os = em.createQuery(cq.select(root).where(p).distinct(true)).getResultList();
// if (os.size() == 1) {
// o = os.get(0);
// em.detach(o);
// }
// }
// return o;
// }
// public Process pickObject(Application application, String flag) throws Exception {
// if (null == application || StringUtils.isEmpty(flag)) {
// return null;
// }
// Process o = null;
// String cacheKey = ApplicationCache.concreteCacheKey(Process.class, application.getId(), flag);
// Element element = cache.get(cacheKey);
// if (null != element) {
// if (null != element.getObjectValue()) {
// o = (Process) element.getObjectValue();
// }
// } else {
// o = this.restrictProcess(application.getId(), flag);
// if (null != o) {
// cache.put(new Element(cacheKey, o));
// }
// }
// return o;
// }
/* 获取Application下的所有流程 */
// 获取Application下的所有流程
public List<String> listWithApplication(Application application) throws Exception {
EntityManager em = this.entityManagerContainer().get(Process.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
......@@ -113,8 +73,8 @@ public class ProcessFactory extends ElementFactory {
Root<Process> root = cq.from(Process.class);
Predicate p = cb.equal(root.get(Process_.application), application.getId());
p = cb.and(p, cb.or(cb.isTrue(root.get(Process_.editionEnable)), cb.isNull(root.get(Process_.editionEnable))));
cq.select(root.get(Process_.id)).where(p).distinct(true);
return em.createQuery(cq).getResultList();
cq.select(root.get(Process_.id)).where(p);
return em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
}
/* 获取用户可启动的流程,如果applicationId 为空则取到所有可启动流程 */
......@@ -139,8 +99,8 @@ public class ProcessFactory extends ElementFactory {
}
p = cb.and(p, cb.equal(root.get(Process_.application), application.getId()));
p = cb.and(p, cb.or(cb.isTrue(root.get(Process_.editionEnable)), cb.isNull(root.get(Process_.editionEnable))));
cq.select(root.get(Process_.id)).where(p).distinct(true);
return em.createQuery(cq).getResultList();
cq.select(root.get(Process_.id)).where(p);
return em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
}
/* 获取用户可启动的流程,如果applicationId 为空则取到所有可启动流程 */
......
......@@ -2,6 +2,7 @@ package com.x.processplatform.assemble.surface.jaxrs.application;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
......@@ -98,8 +99,8 @@ class ActionListWithPerson extends BaseAction {
}
cq.where(p);
}
list = em.createQuery(cq.select(root.get(Application_.id)).distinct(true)).getResultList();
return list;
return em.createQuery(cq.select(root.get(Application_.id))).getResultList().stream().distinct()
.collect(Collectors.toList());
}
/**
......@@ -126,7 +127,7 @@ class ActionListWithPerson extends BaseAction {
p = cb.or(p, root.get(Process_.startableUnitList).in(units));
}
}
cq.select(root.get(Process_.application)).distinct(true).where(p);
return em.createQuery(cq).getResultList();
cq.select(root.get(Process_.application)).where(p);
return em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
}
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.x.processplatform.assemble.surface.jaxrs.application;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
......@@ -108,7 +109,6 @@ class ActionListWithPersonComplex extends BaseAction {
private List<String> listFromApplication(Business business, EffectivePerson effectivePerson, List<String> roles,
List<String> identities, List<String> units) throws Exception {
List<String> list = new ArrayList<>();
EntityManager em = business.entityManagerContainer().get(Application.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
......@@ -127,8 +127,8 @@ class ActionListWithPersonComplex extends BaseAction {
}
cq.where(p);
}
list = em.createQuery(cq.select(root.get(Application_.id)).distinct(true)).getResultList();
return list;
return em.createQuery(cq.select(root.get(Application_.id))).getResultList().stream().distinct()
.collect(Collectors.toList());
}
/**
......@@ -155,8 +155,8 @@ class ActionListWithPersonComplex extends BaseAction {
p = cb.or(p, root.get(Process_.startableUnitList).in(units));
}
}
cq.select(root.get(Process_.application)).distinct(true).where(p);
return em.createQuery(cq).getResultList();
cq.select(root.get(Process_.application)).where(p);
return em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
}
private List<WoProcess> referenceProcess(Business business, EffectivePerson effectivePerson,
......
......@@ -2,6 +2,7 @@ package com.x.processplatform.assemble.surface.jaxrs.application;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
......@@ -66,7 +67,6 @@ class ActionListWithPersonLike extends BaseAction {
private List<String> listFromApplication(Business business, EffectivePerson effectivePerson, List<String> roles,
List<String> identities, List<String> units) throws Exception {
List<String> list = new ArrayList<>();
EntityManager em = business.entityManagerContainer().get(Application.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
......@@ -85,8 +85,8 @@ class ActionListWithPersonLike extends BaseAction {
}
cq.where(p);
}
list = em.createQuery(cq.select(root.get(Application_.id)).distinct(true)).getResultList();
return list;
return em.createQuery(cq.select(root.get(Application_.id))).getResultList().stream().distinct()
.collect(Collectors.toList());
}
/**
......@@ -116,7 +116,7 @@ class ActionListWithPersonLike extends BaseAction {
p = cb.or(p, root.get(Process_.startableUnitList).in(units));
}
}
cq.select(root.get(Process_.application)).distinct(true).where(p);
return em.createQuery(cq).getResultList();
cq.select(root.get(Process_.application)).where(p);
return em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
}
}
\ No newline at end of file
......@@ -24,6 +24,7 @@ import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
class ActionManageListWithPersonComplex extends BaseAction {
......@@ -33,7 +34,7 @@ class ActionManageListWithPersonComplex extends BaseAction {
List<Wo> wos = new ArrayList<>();
Business business = new Business(emc);
if (effectivePerson.isManager()){
if (effectivePerson.isManager()) {
List<String> identities = business.organization().identity().listWithPerson(person);
/** 去除部门以及上级部门,如果设置了一级部门可用,那么一级部门下属的二级部门也可用 */
List<String> units = business.organization().unit().listWithPersonSupNested(person);
......@@ -127,7 +128,8 @@ class ActionManageListWithPersonComplex extends BaseAction {
}
cq.where(p);
list = em.createQuery(cq.select(root.get(Application_.id)).distinct(true)).getResultList();
list = em.createQuery(cq.select(root.get(Application_.id))).getResultList().stream().distinct()
.collect(Collectors.toList());
return list;
}
......@@ -153,14 +155,13 @@ class ActionManageListWithPersonComplex extends BaseAction {
p = cb.or(p, root.get(Process_.startableUnitList).in(units));
}
cq.select(root.get(Process_.application)).distinct(true).where(p);
return em.createQuery(cq).getResultList();
cq.select(root.get(Process_.application)).where(p);
return em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
}
private List<WoProcess> referenceProcess(Business business, EffectivePerson effectivePerson,
List<String> identities, List<String> units, Application application) throws Exception {
List<String> ids = this.listStartableWithApplication(business,effectivePerson, identities, units,
application);
List<String> ids = this.listStartableWithApplication(business, effectivePerson, identities, units, application);
List<WoProcess> wos = new ArrayList<>();
for (String id : ids) {
WoProcess o = WoProcess.copier.copy(business.process().pick(id));
......@@ -171,9 +172,8 @@ class ActionManageListWithPersonComplex extends BaseAction {
}
/* 获取用户可启动的流程,如果applicationId 为空则取到所有可启动流程 */
private List<String> listStartableWithApplication(Business business, EffectivePerson effectivePerson, List<String> identities,
List<String> units, Application application) throws Exception {
List<String> list = new ArrayList<>();
private List<String> listStartableWithApplication(Business business, EffectivePerson effectivePerson,
List<String> identities, List<String> units, Application application) throws Exception {
EntityManager em = business.entityManagerContainer().get(Process.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
......@@ -191,11 +191,8 @@ class ActionManageListWithPersonComplex extends BaseAction {
}
p = cb.and(p, cb.equal(root.get(Process_.application), application.getId()));
p = cb.and(p, cb.or(cb.isTrue(root.get(Process_.editionEnable)),
cb.isNull(root.get(Process_.editionEnable))));
cq.select(root.get(Process_.id)).where(p).distinct(true);
list = em.createQuery(cq).getResultList();
return list;
p = cb.and(p, cb.or(cb.isTrue(root.get(Process_.editionEnable)), cb.isNull(root.get(Process_.editionEnable))));
cq.select(root.get(Process_.id)).where(p);
return em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
}
}
......@@ -2,6 +2,7 @@ package com.x.processplatform.assemble.surface.jaxrs.process;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
......@@ -98,8 +99,8 @@ class ActionListWithPersonWithApplicationFilter extends BaseAction {
cb.equal(root.get(Process_.startableTerminal), Process.STARTABLETERMINAL_ALL)));
}
cq.select(root.get(Process_.id)).where(p).distinct(true);
return em.createQuery(cq).getResultList();
cq.select(root.get(Process_.id)).where(p);
return em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
}
public static class Wo extends Process {
......
......@@ -2,6 +2,7 @@ package com.x.processplatform.assemble.surface.jaxrs.read;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
......@@ -104,8 +105,8 @@ class ActionFilterAttribute extends BaseAction {
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<Read> root = cq.from(Read.class);
Predicate p = cb.equal(root.get(Read_.person), effectivePerson.getDistinguishedName());
cq.select(root.get(Read_.application)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(Read_.application)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......@@ -132,8 +133,8 @@ class ActionFilterAttribute extends BaseAction {
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<Read> root = cq.from(Read.class);
Predicate p = cb.equal(root.get(Read_.person), effectivePerson.getDistinguishedName());
cq.select(root.get(Read_.process)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(Read_.process)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......@@ -160,8 +161,8 @@ class ActionFilterAttribute extends BaseAction {
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<Read> root = cq.from(Read.class);
Predicate p = cb.equal(root.get(Read_.person), effectivePerson.getDistinguishedName());
cq.select(root.get(Read_.creatorUnit)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(Read_.creatorUnit)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......@@ -182,8 +183,8 @@ class ActionFilterAttribute extends BaseAction {
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<Read> root = cq.from(Read.class);
Predicate p = cb.equal(root.get(Read_.person), effectivePerson.getDistinguishedName());
cq.select(root.get(Read_.activityName)).where(p).distinct(true);
List<String> list = em.createQuery(cq).getResultList();
cq.select(root.get(Read_.activityName)).where(p);
List<String> list = em.createQuery(cq).getResultList().stream().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : list) {
if (StringUtils.isNotEmpty(str)) {
......@@ -204,8 +205,8 @@ class ActionFilterAttribute extends BaseAction {
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<Read> root = cq.from(Read.class);
Predicate p = cb.equal(root.get(Read_.person), effectivePerson.getDistinguishedName());
cq.select(root.get(Read_.startTimeMonth)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(Read_.startTimeMonth)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......
......@@ -187,8 +187,8 @@ class ActionFilterAttributeFilter extends BaseAction {
if (ListTools.isNotEmpty(wi.getActivityNameList())) {
p = cb.and(p, root.get(Read_.activityName).in(wi.getActivityNameList()));
}
cq.select(root.get(Read_.application)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(Read_.application)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......@@ -232,8 +232,8 @@ class ActionFilterAttributeFilter extends BaseAction {
if (ListTools.isNotEmpty(wi.getActivityNameList())) {
p = cb.and(p, root.get(Read_.activityName).in(wi.getActivityNameList()));
}
cq.select(root.get(Read_.process)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(Read_.process)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......@@ -277,8 +277,8 @@ class ActionFilterAttributeFilter extends BaseAction {
if (ListTools.isNotEmpty(wi.getActivityNameList())) {
p = cb.and(p, root.get(Read_.activityName).in(wi.getActivityNameList()));
}
cq.select(root.get(Read_.creatorUnit)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(Read_.creatorUnit)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......@@ -316,8 +316,8 @@ class ActionFilterAttributeFilter extends BaseAction {
if (ListTools.isNotEmpty(wi.getActivityNameList())) {
p = cb.and(p, root.get(Read_.activityName).in(wi.getActivityNameList()));
}
cq.select(root.get(Read_.activityName)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(Read_.activityName)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......@@ -355,8 +355,8 @@ class ActionFilterAttributeFilter extends BaseAction {
if (ListTools.isNotEmpty(wi.getActivityNameList())) {
p = cb.and(p, root.get(Read_.activityName).in(wi.getActivityNameList()));
}
cq.select(root.get(Read_.startTimeMonth)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(Read_.startTimeMonth)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......
......@@ -2,6 +2,7 @@ package com.x.processplatform.assemble.surface.jaxrs.read;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
......@@ -32,8 +33,8 @@ class ActionListCountWithApplication extends BaseAction {
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<Read> root = cq.from(Read.class);
Predicate p = cb.equal(root.get(Read_.person), effectivePerson.getDistinguishedName());
cq.select(root.get(Read_.application)).where(p).distinct(true);
List<String> list = em.createQuery(cq).getResultList();
cq.select(root.get(Read_.application)).where(p);
List<String> list = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
for (String str : list) {
NameValueCountPair o = this.concreteNameValueCountPair(business, effectivePerson, str);
wraps.add(o);
......
......@@ -2,6 +2,7 @@ package com.x.processplatform.assemble.surface.jaxrs.read;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
......@@ -40,8 +41,8 @@ class ActionListCountWithProcess extends BaseAction {
Root<Read> root = cq.from(Read.class);
Predicate p = cb.equal(root.get(Read_.person), effectivePerson.getDistinguishedName());
p = cb.and(p, cb.equal(root.get(Read_.application), application.getId()));
cq.select(root.get(Read_.process)).where(p).distinct(true);
List<String> list = em.createQuery(cq).getResultList();
cq.select(root.get(Read_.process)).where(p);
List<String> list = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
for (String str : list) {
NameValueCountPair o = this.concreteNameValueCountPair(business, effectivePerson, str);
wraps.add(o);
......
......@@ -2,6 +2,7 @@ package com.x.processplatform.assemble.surface.jaxrs.readcompleted;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
......@@ -115,8 +116,8 @@ class ActionFilterAttribute extends BaseAction {
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<ReadCompleted> root = cq.from(ReadCompleted.class);
Predicate p = cb.equal(root.get(ReadCompleted_.person), effectivePerson.getDistinguishedName());
cq.select(root.get(ReadCompleted_.application)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(ReadCompleted_.application)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......@@ -143,8 +144,8 @@ class ActionFilterAttribute extends BaseAction {
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<ReadCompleted> root = cq.from(ReadCompleted.class);
Predicate p = cb.equal(root.get(ReadCompleted_.person), effectivePerson.getDistinguishedName());
cq.select(root.get(ReadCompleted_.process)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(ReadCompleted_.process)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......@@ -171,8 +172,8 @@ class ActionFilterAttribute extends BaseAction {
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<ReadCompleted> root = cq.from(ReadCompleted.class);
Predicate p = cb.equal(root.get(ReadCompleted_.person), effectivePerson.getDistinguishedName());
cq.select(root.get(ReadCompleted_.creatorUnit)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(ReadCompleted_.creatorUnit)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......@@ -193,8 +194,8 @@ class ActionFilterAttribute extends BaseAction {
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<ReadCompleted> root = cq.from(ReadCompleted.class);
Predicate p = cb.equal(root.get(ReadCompleted_.person), effectivePerson.getDistinguishedName());
cq.select(root.get(ReadCompleted_.activityName)).where(p).distinct(true);
List<String> list = em.createQuery(cq).getResultList();
cq.select(root.get(ReadCompleted_.activityName)).where(p);
List<String> list = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : list) {
if (StringUtils.isNotEmpty(str)) {
......@@ -215,8 +216,9 @@ class ActionFilterAttribute extends BaseAction {
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<ReadCompleted> root = cq.from(ReadCompleted.class);
Predicate p = cb.equal(root.get(ReadCompleted_.person), effectivePerson.getDistinguishedName());
cq.select(root.get(ReadCompleted_.completedTimeMonth)).where(p).distinct(true);
List<String> list = em.createQuery(cq).getResultList();
cq.select(root.get(ReadCompleted_.completedTimeMonth)).where(p);
List<String> list = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
;
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : list) {
if (StringUtils.isNotEmpty(str)) {
......@@ -237,8 +239,9 @@ class ActionFilterAttribute extends BaseAction {
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<ReadCompleted> root = cq.from(ReadCompleted.class);
Predicate p = cb.equal(root.get(ReadCompleted_.person), effectivePerson.getDistinguishedName());
cq.select(root.get(ReadCompleted_.startTimeMonth)).where(p).distinct(true);
List<String> list = em.createQuery(cq).getResultList();
cq.select(root.get(ReadCompleted_.startTimeMonth)).where(p);
List<String> list = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
;
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : list) {
if (StringUtils.isNotEmpty(str)) {
......
......@@ -213,8 +213,9 @@ class ActionFilterAttributeFilter extends BaseAction {
if (ListTools.isNotEmpty(wi.getActivityNameList())) {
p = cb.and(p, root.get(ReadCompleted_.activityName).in(wi.getActivityNameList()));
}
cq.select(root.get(ReadCompleted_.application)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(ReadCompleted_.application)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
;
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......@@ -261,8 +262,8 @@ class ActionFilterAttributeFilter extends BaseAction {
if (ListTools.isNotEmpty(wi.getActivityNameList())) {
p = cb.and(p, root.get(ReadCompleted_.activityName).in(wi.getActivityNameList()));
}
cq.select(root.get(ReadCompleted_.process)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(ReadCompleted_.process)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......@@ -309,8 +310,8 @@ class ActionFilterAttributeFilter extends BaseAction {
if (ListTools.isNotEmpty(wi.getActivityNameList())) {
p = cb.and(p, root.get(ReadCompleted_.activityName).in(wi.getActivityNameList()));
}
cq.select(root.get(ReadCompleted_.creatorUnit)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(ReadCompleted_.creatorUnit)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......@@ -351,8 +352,8 @@ class ActionFilterAttributeFilter extends BaseAction {
if (ListTools.isNotEmpty(wi.getActivityNameList())) {
p = cb.and(p, root.get(ReadCompleted_.activityName).in(wi.getActivityNameList()));
}
cq.select(root.get(ReadCompleted_.activityName)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(ReadCompleted_.activityName)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......@@ -393,8 +394,8 @@ class ActionFilterAttributeFilter extends BaseAction {
if (ListTools.isNotEmpty(wi.getActivityNameList())) {
p = cb.and(p, root.get(ReadCompleted_.activityName).in(wi.getActivityNameList()));
}
cq.select(root.get(ReadCompleted_.startTimeMonth)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(ReadCompleted_.startTimeMonth)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......@@ -435,8 +436,8 @@ class ActionFilterAttributeFilter extends BaseAction {
if (ListTools.isNotEmpty(wi.getActivityNameList())) {
p = cb.and(p, root.get(ReadCompleted_.activityName).in(wi.getActivityNameList()));
}
cq.select(root.get(ReadCompleted_.completedTimeMonth)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(ReadCompleted_.completedTimeMonth)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......
......@@ -3,6 +3,7 @@ package com.x.processplatform.assemble.surface.jaxrs.readcompleted;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
......@@ -43,8 +44,8 @@ class ActionListCountWithApplication extends BaseAction {
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<ReadCompleted> root = cq.from(ReadCompleted.class);
Predicate p = cb.equal(root.get(ReadCompleted_.person), effectivePerson.getDistinguishedName());
cq.select(root.get(ReadCompleted_.application)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(ReadCompleted_.application)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
NameValueCountPair o = new NameValueCountPair();
......
......@@ -3,6 +3,7 @@ package com.x.processplatform.assemble.surface.jaxrs.readcompleted;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
......@@ -52,8 +53,8 @@ class ActionListCountWithProcess extends BaseAction {
Root<ReadCompleted> root = cq.from(ReadCompleted.class);
Predicate p = cb.equal(root.get(ReadCompleted_.person), effectivePerson.getDistinguishedName());
p = cb.and(p, cb.equal(root.get(ReadCompleted_.application), application.getId()));
cq.select(root.get(ReadCompleted_.process)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(ReadCompleted_.process)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
for (String str : os) {
NameValueCountPair o = new NameValueCountPair();
Process process = business.process().pick(str);
......
......@@ -14,16 +14,6 @@ import com.x.processplatform.core.entity.content.ReadCompleted_;
abstract class BaseAction extends StandardJaxrsAction {
// static WrapCopier<ReadCompleted, WrapOutReadCompleted> readCompletedOutCopier = WrapCopierFactory
// .wo(ReadCompleted.class, WrapOutReadCompleted.class, null, WrapOutReadCompleted.FieldsInvisible);
//
// static WrapCopier<Work, WrapOutWork> workOutCopier = WrapCopierFactory.wo(Work.class, WrapOutWork.class, null,
// WrapOutWork.Excludes);
//
// static WrapCopier<WorkCompleted, WrapOutWorkCompleted> workCompletedOutCopier = WrapCopierFactory
// .wo(WorkCompleted.class, WrapOutWorkCompleted.class, null, WrapOutWorkCompleted.Excludes);
Long countWithApplication(Business business, EffectivePerson effectivePerson, String id) throws Exception {
EntityManager em = business.entityManagerContainer().get(ReadCompleted.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
......@@ -35,27 +25,6 @@ abstract class BaseAction extends StandardJaxrsAction {
return em.createQuery(cq).getSingleResult();
}
// List<NameValueCountPair> listProcessPair(Business business, EffectivePerson effectivePerson,
// Application application) throws Exception {
// List<NameValueCountPair> wraps = new ArrayList<>();
// EntityManager em = business.entityManagerContainer().get(ReadCompleted.class);
// CriteriaBuilder cb = em.getCriteriaBuilder();
// CriteriaQuery<String> cq = cb.createQuery(String.class);
// Root<ReadCompleted> root = cq.from(ReadCompleted.class);
// Predicate p = cb.equal(root.get(ReadCompleted_.person), effectivePerson.getDistinguishedName());
// p = cb.and(p, cb.equal(root.get(ReadCompleted_.application), application.getId()));
// cq.select(root.get(ReadCompleted_.process)).where(p).distinct(true);
// List<String> list = em.createQuery(cq).getResultList();
// for (String str : list) {
// NameValueCountPair o = new NameValueCountPair();
// o.setValue(str);
// o.setName(business.process().pickName(str, ReadCompleted.class, effectivePerson.getDistinguishedName()));
// wraps.add(o);
// }
// SortTools.asc(wraps, "name");
// return wraps;
// }
Long countWithProcess(Business business, EffectivePerson effectivePerson, String id) throws Exception {
EntityManager em = business.entityManagerContainer().get(ReadCompleted.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
......
......@@ -2,6 +2,7 @@ package com.x.processplatform.assemble.surface.jaxrs.task;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
......@@ -108,8 +109,8 @@ class ActionFilterAttribute extends BaseAction {
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<Task> root = cq.from(Task.class);
Predicate p = cb.equal(root.get(Task_.person), effectivePerson.getDistinguishedName());
cq.select(root.get(Task_.application)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(Task_.application)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......@@ -136,8 +137,8 @@ class ActionFilterAttribute extends BaseAction {
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<Task> root = cq.from(Task.class);
Predicate p = cb.equal(root.get(Task_.person), effectivePerson.getDistinguishedName());
cq.select(root.get(Task_.process)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(Task_.process)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......@@ -164,8 +165,8 @@ class ActionFilterAttribute extends BaseAction {
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<Task> root = cq.from(Task.class);
Predicate p = cb.equal(root.get(Task_.person), effectivePerson.getDistinguishedName());
cq.select(root.get(Task_.creatorUnit)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(Task_.creatorUnit)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......@@ -186,8 +187,8 @@ class ActionFilterAttribute extends BaseAction {
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<Task> root = cq.from(Task.class);
Predicate p = cb.equal(root.get(Task_.person), effectivePerson.getDistinguishedName());
cq.select(root.get(Task_.activityName)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(Task_.activityName)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......@@ -208,8 +209,8 @@ class ActionFilterAttribute extends BaseAction {
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<Task> root = cq.from(Task.class);
Predicate p = cb.equal(root.get(Task_.person), effectivePerson.getDistinguishedName());
cq.select(root.get(Task_.startTimeMonth)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(Task_.startTimeMonth)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......
......@@ -187,8 +187,8 @@ class ActionFilterAttributeFilter extends BaseAction {
if (ListTools.isNotEmpty(wi.getActivityNameList())) {
p = cb.and(p, root.get(Task_.activityName).in(wi.getActivityNameList()));
}
cq.select(root.get(Task_.application)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(Task_.application)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......@@ -232,8 +232,8 @@ class ActionFilterAttributeFilter extends BaseAction {
if (ListTools.isNotEmpty(wi.getActivityNameList())) {
p = cb.and(p, root.get(Task_.activityName).in(wi.getActivityNameList()));
}
cq.select(root.get(Task_.process)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(Task_.process)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......@@ -277,8 +277,8 @@ class ActionFilterAttributeFilter extends BaseAction {
if (ListTools.isNotEmpty(wi.getActivityNameList())) {
p = cb.and(p, root.get(Task_.activityName).in(wi.getActivityNameList()));
}
cq.select(root.get(Task_.creatorUnit)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(Task_.creatorUnit)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......@@ -316,8 +316,8 @@ class ActionFilterAttributeFilter extends BaseAction {
if (ListTools.isNotEmpty(wi.getActivityNameList())) {
p = cb.and(p, root.get(Task_.activityName).in(wi.getActivityNameList()));
}
cq.select(root.get(Task_.activityName)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(Task_.activityName)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......@@ -355,8 +355,8 @@ class ActionFilterAttributeFilter extends BaseAction {
if (ListTools.isNotEmpty(wi.getActivityNameList())) {
p = cb.and(p, root.get(Task_.activityName).in(wi.getActivityNameList()));
}
cq.select(root.get(Task_.startTimeMonth)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(Task_.startTimeMonth)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......
......@@ -2,6 +2,7 @@ package com.x.processplatform.assemble.surface.jaxrs.task;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
......@@ -32,8 +33,8 @@ class ActionListCountWithApplication extends BaseAction {
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<Task> root = cq.from(Task.class);
Predicate p = cb.equal(root.get(Task_.person), effectivePerson.getDistinguishedName());
cq.select(root.get(Task_.application)).where(p).distinct(true);
List<String> list = em.createQuery(cq).getResultList();
cq.select(root.get(Task_.application)).where(p);
List<String> list = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
for (String str : list) {
this.addNameValueCountPair(business, effectivePerson, str, wraps);
}
......
......@@ -2,6 +2,7 @@ package com.x.processplatform.assemble.surface.jaxrs.task;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
......@@ -37,8 +38,8 @@ class ActionListCountWithProcess extends BaseAction {
Root<Task> root = cq.from(Task.class);
Predicate p = cb.equal(root.get(Task_.person), effectivePerson.getDistinguishedName());
p = cb.and(p, cb.equal(root.get(Task_.application), application.getId()));
cq.select(root.get(Task_.process)).where(p).distinct(true);
List<String> list = em.createQuery(cq).getResultList();
cq.select(root.get(Task_.process)).where(p);
List<String> list = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
for (String str : list) {
this.addNameValueCountPair(business, effectivePerson, str, wraps);
}
......
......@@ -230,8 +230,8 @@ class ActionProcessingNeural extends BaseAction {
Root<FormField> root = cq.from(FormField.class);
Predicate p = root.get(FormField_.form).in(formIds);
p = cb.and(p, cb.equal(root.get(FormField_.dataType), "number"));
cq.select(root.get(FormField_.name)).where(p).distinct(true);
return em.createQuery(cq).getResultList();
cq.select(root.get(FormField_.name)).where(p);
return em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
}
private List<String> listForm(Business business, Process process) throws Exception {
......
......@@ -2,6 +2,7 @@ package com.x.processplatform.assemble.surface.jaxrs.taskcompleted;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
......@@ -135,8 +136,8 @@ class ActionFilterAttribute extends BaseAction {
Predicate p = cb.equal(root.get(TaskCompleted_.person), effectivePerson.getDistinguishedName());
p = cb.and(p,
cb.or(cb.equal(root.get(TaskCompleted_.latest), true), cb.isNull(root.get(TaskCompleted_.latest))));
cq.select(root.get(TaskCompleted_.application)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(TaskCompleted_.application)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......@@ -165,8 +166,8 @@ class ActionFilterAttribute extends BaseAction {
Predicate p = cb.equal(root.get(TaskCompleted_.person), effectivePerson.getDistinguishedName());
p = cb.and(p,
cb.or(cb.equal(root.get(TaskCompleted_.latest), true), cb.isNull(root.get(TaskCompleted_.latest))));
cq.select(root.get(TaskCompleted_.process)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(TaskCompleted_.process)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......@@ -195,8 +196,8 @@ class ActionFilterAttribute extends BaseAction {
Predicate p = cb.equal(root.get(TaskCompleted_.person), effectivePerson.getDistinguishedName());
p = cb.and(p,
cb.or(cb.equal(root.get(TaskCompleted_.latest), true), cb.isNull(root.get(TaskCompleted_.latest))));
cq.select(root.get(TaskCompleted_.creatorUnit)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(TaskCompleted_.creatorUnit)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......@@ -219,8 +220,8 @@ class ActionFilterAttribute extends BaseAction {
Predicate p = cb.equal(root.get(TaskCompleted_.person), effectivePerson.getDistinguishedName());
p = cb.and(p,
cb.or(cb.equal(root.get(TaskCompleted_.latest), true), cb.isNull(root.get(TaskCompleted_.latest))));
cq.select(root.get(TaskCompleted_.activityName)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(TaskCompleted_.activityName)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......@@ -243,8 +244,8 @@ class ActionFilterAttribute extends BaseAction {
Predicate p = cb.equal(root.get(TaskCompleted_.person), effectivePerson.getDistinguishedName());
p = cb.and(p,
cb.or(cb.equal(root.get(TaskCompleted_.latest), true), cb.isNull(root.get(TaskCompleted_.latest))));
cq.select(root.get(TaskCompleted_.startTimeMonth)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(TaskCompleted_.startTimeMonth)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......@@ -267,8 +268,8 @@ class ActionFilterAttribute extends BaseAction {
Predicate p = cb.equal(root.get(TaskCompleted_.person), effectivePerson.getDistinguishedName());
p = cb.and(p,
cb.or(cb.equal(root.get(TaskCompleted_.latest), true), cb.isNull(root.get(TaskCompleted_.latest))));
cq.select(root.get(TaskCompleted_.completedTimeMonth)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(TaskCompleted_.completedTimeMonth)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......@@ -292,8 +293,8 @@ class ActionFilterAttribute extends BaseAction {
Predicate p = cb.equal(root.get(TaskCompleted_.person), effectivePerson.getDistinguishedName());
p = cb.and(p,
cb.or(cb.equal(root.get(TaskCompleted_.latest), true), cb.isNull(root.get(TaskCompleted_.latest))));
cq.select(root.get(TaskCompleted_.completed)).where(p).distinct(true);
List<Boolean> os = em.createQuery(cq).getResultList();
cq.select(root.get(TaskCompleted_.completed)).where(p);
List<Boolean> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (Boolean value : os) {
NameValueCountPair o = new NameValueCountPair();
......
......@@ -242,8 +242,8 @@ class ActionFilterAttributeFilter extends BaseAction {
if (ListTools.isNotEmpty(wi.getCompletedList())) {
p = cb.and(p, root.get(TaskCompleted_.completed).in(wi.getCompletedList()));
}
cq.select(root.get(TaskCompleted_.application)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(TaskCompleted_.application)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......@@ -295,8 +295,8 @@ class ActionFilterAttributeFilter extends BaseAction {
if (ListTools.isNotEmpty(wi.getCompletedList())) {
p = cb.and(p, root.get(TaskCompleted_.completed).in(wi.getCompletedList()));
}
cq.select(root.get(TaskCompleted_.process)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(TaskCompleted_.process)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......@@ -348,8 +348,8 @@ class ActionFilterAttributeFilter extends BaseAction {
if (ListTools.isNotEmpty(wi.getCompletedList())) {
p = cb.and(p, root.get(TaskCompleted_.completed).in(wi.getCompletedList()));
}
cq.select(root.get(TaskCompleted_.creatorUnit)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(TaskCompleted_.creatorUnit)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......@@ -395,8 +395,8 @@ class ActionFilterAttributeFilter extends BaseAction {
if (ListTools.isNotEmpty(wi.getCompletedList())) {
p = cb.and(p, root.get(TaskCompleted_.completed).in(wi.getCompletedList()));
}
cq.select(root.get(TaskCompleted_.activityName)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(TaskCompleted_.activityName)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......@@ -442,8 +442,8 @@ class ActionFilterAttributeFilter extends BaseAction {
if (ListTools.isNotEmpty(wi.getCompletedList())) {
p = cb.and(p, root.get(TaskCompleted_.completed).in(wi.getCompletedList()));
}
cq.select(root.get(TaskCompleted_.startTimeMonth)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(TaskCompleted_.startTimeMonth)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......@@ -489,8 +489,8 @@ class ActionFilterAttributeFilter extends BaseAction {
if (ListTools.isNotEmpty(wi.getCompletedList())) {
p = cb.and(p, root.get(TaskCompleted_.completed).in(wi.getCompletedList()));
}
cq.select(root.get(TaskCompleted_.completedTimeMonth)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(TaskCompleted_.completedTimeMonth)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
if (StringUtils.isNotEmpty(str)) {
......@@ -536,8 +536,8 @@ class ActionFilterAttributeFilter extends BaseAction {
if (ListTools.isNotEmpty(wi.getCompletedList())) {
p = cb.and(p, root.get(TaskCompleted_.completed).in(wi.getCompletedList()));
}
cq.select(root.get(TaskCompleted_.completed)).where(p).distinct(true);
List<Boolean> os = em.createQuery(cq).getResultList();
cq.select(root.get(TaskCompleted_.completed)).where(p);
List<Boolean> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (Boolean value : os) {
NameValueCountPair o = new NameValueCountPair();
......
......@@ -3,6 +3,7 @@ package com.x.processplatform.assemble.surface.jaxrs.taskcompleted;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
......@@ -46,8 +47,8 @@ class ActionListCountWithApplication extends BaseAction {
Predicate p = cb.equal(root.get(TaskCompleted_.person), effectivePerson.getDistinguishedName());
p = cb.and(p,
cb.or(cb.equal(root.get(TaskCompleted_.latest), true), cb.isNull(root.get(TaskCompleted_.latest))));
cq.select(root.get(TaskCompleted_.application)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(TaskCompleted_.application)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
for (String str : os) {
NameValueCountPair o = new NameValueCountPair();
Application application = business.application().pick(str);
......
......@@ -3,6 +3,7 @@ package com.x.processplatform.assemble.surface.jaxrs.taskcompleted;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
......@@ -54,8 +55,8 @@ class ActionListCountWithProcess extends BaseAction {
p = cb.and(p,
cb.or(cb.equal(root.get(TaskCompleted_.latest), true), cb.isNull(root.get(TaskCompleted_.latest))));
p = cb.and(p, cb.equal(root.get(TaskCompleted_.application), application.getId()));
cq.select(root.get(TaskCompleted_.process)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(TaskCompleted_.process)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
for (String str : os) {
NameValueCountPair o = new NameValueCountPair();
Process process = business.process().pick(str);
......
......@@ -2,6 +2,7 @@ package com.x.processplatform.assemble.surface.jaxrs.work;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
......@@ -64,7 +65,7 @@ class ActionFilterAttribute extends BaseAction {
private List<NameValueCountPair> activityNameList = new ArrayList<>();
@FieldDescribe("可选择的工作状态")
@FieldTypeDescribe(fieldType="enum",fieldValue="start|processing|hanging",fieldTypeName = "com.x.processplatform.core.entity.content.WorkStatus")
@FieldTypeDescribe(fieldType = "enum", fieldValue = "start|processing|hanging", fieldTypeName = "com.x.processplatform.core.entity.content.WorkStatus")
private List<NameValueCountPair> workStatusList = new ArrayList<>();
public List<NameValueCountPair> getProcessList() {
......@@ -118,8 +119,8 @@ class ActionFilterAttribute extends BaseAction {
Root<Work> root = cq.from(Work.class);
Predicate p = cb.equal(root.get(Work_.application), application.getId());
p = cb.and(p, cb.equal(root.get(Work_.creatorPerson), effectivePerson.getDistinguishedName()));
cq.select(root.get(Work_.process)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(Work_.process)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
for (String str : os) {
NameValueCountPair o = new NameValueCountPair();
Process process = business.process().pick(str);
......@@ -144,8 +145,8 @@ class ActionFilterAttribute extends BaseAction {
Root<Work> root = cq.from(Work.class);
Predicate p = cb.equal(root.get(Work_.application), application.getId());
p = cb.and(p, cb.equal(root.get(Work_.creatorPerson), effectivePerson.getDistinguishedName()));
cq.select(root.get(Work_.creatorUnit)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(Work_.creatorUnit)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
NameValueCountPair o = new NameValueCountPair();
......@@ -166,8 +167,8 @@ class ActionFilterAttribute extends BaseAction {
Root<Work> root = cq.from(Work.class);
Predicate p = cb.equal(root.get(Work_.application), application.getId());
p = cb.and(p, cb.equal(root.get(Work_.creatorPerson), effectivePerson.getDistinguishedName()));
cq.select(root.get(Work_.activityName)).where(p).distinct(true);
List<String> list = em.createQuery(cq).getResultList();
cq.select(root.get(Work_.activityName)).where(p);
List<String> list = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
for (String str : list) {
NameValueCountPair o = new NameValueCountPair();
o.setValue(str);
......@@ -187,8 +188,8 @@ class ActionFilterAttribute extends BaseAction {
Root<Work> root = cq.from(Work.class);
Predicate p = cb.equal(root.get(Work_.application), application.getId());
p = cb.and(p, cb.equal(root.get(Work_.creatorPerson), effectivePerson.getDistinguishedName()));
cq.select(root.get(Work_.startTimeMonth)).where(p).distinct(true);
List<String> list = em.createQuery(cq).getResultList();
cq.select(root.get(Work_.startTimeMonth)).where(p);
List<String> list = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
for (String str : list) {
NameValueCountPair o = new NameValueCountPair();
o.setValue(str);
......@@ -208,8 +209,8 @@ class ActionFilterAttribute extends BaseAction {
Root<Work> root = cq.from(Work.class);
Predicate p = cb.equal(root.get(Work_.application), application.getId());
p = cb.and(p, cb.equal(root.get(Work_.creatorPerson), effectivePerson.getDistinguishedName()));
cq.select(root.get(Work_.workStatus)).where(p).distinct(true);
List<WorkStatus> os = em.createQuery(cq).getResultList();
cq.select(root.get(Work_.workStatus)).where(p);
List<WorkStatus> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
for (WorkStatus status : os) {
NameValueCountPair o = new NameValueCountPair();
o.setValue(status);
......
......@@ -2,6 +2,7 @@ package com.x.processplatform.assemble.surface.jaxrs.work;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
......@@ -68,8 +69,8 @@ class ActionManageFilterAttribute extends BaseAction {
private List<NameValueCountPair> activityNameList = new ArrayList<>();
@FieldDescribe("可选择的工作状态")
@FieldTypeDescribe(fieldType="class",fieldValue="{name='',value='',count=0}",fieldTypeName = "com.x.base.core.project.bean.NameValueCountPair")
@FieldTypeDescribe(fieldType = "class", fieldValue = "{name='',value='',count=0}", fieldTypeName = "com.x.base.core.project.bean.NameValueCountPair")
private List<NameValueCountPair> workStatusList = new ArrayList<>();
public List<NameValueCountPair> getProcessList() {
......@@ -80,15 +81,6 @@ class ActionManageFilterAttribute extends BaseAction {
this.processList = processList;
}
// public List<NameValueCountPair> getCreatorTopUnitList() {
// return creatorTopUnitList;
// }
//
// public void setCreatorTopUnitList(List<NameValueCountPair>
// creatorTopUnitList) {
// this.creatorTopUnitList = creatorTopUnitList;
// }
public List<NameValueCountPair> getCreatorUnitList() {
return creatorUnitList;
}
......@@ -130,8 +122,8 @@ class ActionManageFilterAttribute extends BaseAction {
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<Work> root = cq.from(Work.class);
Predicate p = cb.equal(root.get(Work_.application), application.getId());
cq.select(root.get(Work_.process)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(Work_.process)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
for (String str : os) {
NameValueCountPair o = new NameValueCountPair();
Process process = business.process().pick(str);
......@@ -155,8 +147,8 @@ class ActionManageFilterAttribute extends BaseAction {
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<Work> root = cq.from(Work.class);
Predicate p = cb.equal(root.get(Work_.application), application.getId());
cq.select(root.get(Work_.creatorUnit)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(Work_.creatorUnit)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
for (String str : os) {
NameValueCountPair o = new NameValueCountPair();
o.setValue(str);
......@@ -174,8 +166,8 @@ class ActionManageFilterAttribute extends BaseAction {
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<Work> root = cq.from(Work.class);
Predicate p = cb.equal(root.get(Work_.application), application.getId());
cq.select(root.get(Work_.activityName)).where(p).distinct(true);
List<String> list = em.createQuery(cq).getResultList();
cq.select(root.get(Work_.activityName)).where(p);
List<String> list = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
for (String str : list) {
NameValueCountPair o = new NameValueCountPair();
o.setValue(str);
......@@ -193,8 +185,8 @@ class ActionManageFilterAttribute extends BaseAction {
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<Work> root = cq.from(Work.class);
Predicate p = cb.equal(root.get(Work_.application), application.getId());
cq.select(root.get(Work_.startTimeMonth)).where(p).distinct(true);
List<String> list = em.createQuery(cq).getResultList();
cq.select(root.get(Work_.startTimeMonth)).where(p);
List<String> list = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
for (String str : list) {
NameValueCountPair o = new NameValueCountPair();
o.setValue(str);
......@@ -212,8 +204,8 @@ class ActionManageFilterAttribute extends BaseAction {
CriteriaQuery<WorkStatus> cq = cb.createQuery(WorkStatus.class);
Root<Work> root = cq.from(Work.class);
Predicate p = cb.equal(root.get(Work_.application), application.getId());
cq.select(root.get(Work_.workStatus)).where(p).distinct(true);
List<WorkStatus> list = em.createQuery(cq).getResultList();
cq.select(root.get(Work_.workStatus)).where(p);
List<WorkStatus> list = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
for (WorkStatus status : list) {
NameValueCountPair o = new NameValueCountPair();
o.setValue(status);
......
......@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
......@@ -53,8 +54,8 @@ public class ActionFilterAttribute extends BaseAction {
Root<WorkCompleted> root = cq.from(WorkCompleted.class);
Predicate p = cb.equal(root.get(WorkCompleted_.creatorPerson), effectivePerson.getDistinguishedName());
p = cb.and(p, cb.equal(root.get(WorkCompleted_.application), applicationId));
cq.select(root.get(WorkCompleted_.process)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(WorkCompleted_.process)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
NameValueCountPair o = new NameValueCountPair();
......@@ -80,8 +81,8 @@ public class ActionFilterAttribute extends BaseAction {
Root<WorkCompleted> root = cq.from(WorkCompleted.class);
Predicate p = cb.equal(root.get(WorkCompleted_.creatorPerson), effectivePerson.getDistinguishedName());
p = cb.and(p, cb.equal(root.get(WorkCompleted_.application), applicationId));
cq.select(root.get(WorkCompleted_.startTimeMonth)).where(p).distinct(true);
List<String> list = em.createQuery(cq).getResultList();
cq.select(root.get(WorkCompleted_.startTimeMonth)).where(p);
List<String> list = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wraps = new ArrayList<>();
for (String str : list) {
NameValueCountPair o = new NameValueCountPair();
......@@ -100,8 +101,8 @@ public class ActionFilterAttribute extends BaseAction {
Root<WorkCompleted> root = cq.from(WorkCompleted.class);
Predicate p = cb.equal(root.get(WorkCompleted_.creatorPerson), effectivePerson.getDistinguishedName());
p = cb.and(p, cb.equal(root.get(WorkCompleted_.application), applicationId));
cq.select(root.get(WorkCompleted_.completedTimeMonth)).where(p).distinct(true);
List<String> list = em.createQuery(cq).getResultList();
cq.select(root.get(WorkCompleted_.completedTimeMonth)).where(p);
List<String> list = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wraps = new ArrayList<>();
for (String str : list) {
NameValueCountPair o = new NameValueCountPair();
......
......@@ -2,6 +2,7 @@ package com.x.processplatform.assemble.surface.jaxrs.workcompleted;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
......@@ -30,8 +31,8 @@ class ActionListCountWithApplication extends BaseAction {
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<WorkCompleted> root = cq.from(WorkCompleted.class);
Predicate p = cb.equal(root.get(WorkCompleted_.creatorPerson), effectivePerson.getDistinguishedName());
cq.select(root.get(WorkCompleted_.application)).where(p).distinct(true);
for (String str : em.createQuery(cq).getResultList()) {
cq.select(root.get(WorkCompleted_.application)).where(p);
for (String str : em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList())) {
NameValueCountPair o = new NameValueCountPair();
o.setValue(str);
o.setName(this.getApplicationName(business, effectivePerson, str));
......
......@@ -2,6 +2,7 @@ package com.x.processplatform.assemble.surface.jaxrs.workcompleted;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
......@@ -36,8 +37,8 @@ class ActionListCountWithProcess extends BaseAction {
Root<WorkCompleted> root = cq.from(WorkCompleted.class);
Predicate p = cb.equal(root.get(WorkCompleted_.creatorPerson), effectivePerson.getDistinguishedName());
p = cb.and(p, cb.equal(root.get(WorkCompleted_.application), applicationId));
cq.select(root.get(WorkCompleted_.process)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(WorkCompleted_.process)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
NameValueCountPair o = new NameValueCountPair();
......
......@@ -2,6 +2,7 @@ package com.x.processplatform.assemble.surface.jaxrs.workcompleted;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
......@@ -87,8 +88,8 @@ class ActionManageFilterAttribute extends BaseAction {
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<WorkCompleted> root = cq.from(WorkCompleted.class);
Predicate p = cb.equal(root.get(WorkCompleted_.application), applicationId);
cq.select(root.get(WorkCompleted_.process)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(WorkCompleted_.process)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
NameValueCountPair o = new NameValueCountPair();
......@@ -113,8 +114,8 @@ class ActionManageFilterAttribute extends BaseAction {
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<WorkCompleted> root = cq.from(WorkCompleted.class);
Predicate p = cb.equal(root.get(WorkCompleted_.application), applicationId);
cq.select(root.get(WorkCompleted_.startTimeMonth)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(WorkCompleted_.startTimeMonth)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
NameValueCountPair o = new NameValueCountPair();
......@@ -133,8 +134,8 @@ class ActionManageFilterAttribute extends BaseAction {
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<WorkCompleted> root = cq.from(WorkCompleted.class);
Predicate p = cb.equal(root.get(WorkCompleted_.application), applicationId);
cq.select(root.get(WorkCompleted_.completedTimeMonth)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(WorkCompleted_.completedTimeMonth)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
NameValueCountPair o = new NameValueCountPair();
......
......@@ -2,6 +2,7 @@ package com.x.processplatform.assemble.surface.jaxrs.workcompleted;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
......@@ -37,8 +38,8 @@ class ActionManageListCountWithProcess extends BaseAction {
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<WorkCompleted> root = cq.from(WorkCompleted.class);
Predicate p = cb.equal(root.get(WorkCompleted_.application), applicationId);
cq.select(root.get(WorkCompleted_.process)).where(p).distinct(true);
List<String> os = em.createQuery(cq).getResultList();
cq.select(root.get(WorkCompleted_.process)).where(p);
List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
List<NameValueCountPair> wos = new ArrayList<>();
for (String str : os) {
NameValueCountPair o = new NameValueCountPair();
......
package com.x.processplatform.service.processing.jaxrs.attachment;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
import com.google.gson.JsonElement;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
......@@ -20,10 +24,6 @@ import com.x.processplatform.core.entity.content.Attachment;
import com.x.processplatform.core.entity.content.WorkCompleted;
import com.x.processplatform.service.processing.ThisApplication;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
/**
*
* @author zhour 复制指定的附件到work,仅拷贝内容,并清除其他附带的信息
......@@ -40,7 +40,8 @@ class ActionCopyToWorkCompleted extends BaseAction {
String executorSeed = null;
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
WorkCompleted work = emc.fetch(workCompletedId, WorkCompleted.class, ListTools.toList(WorkCompleted.job_FIELDNAME));
WorkCompleted work = emc.fetch(workCompletedId, WorkCompleted.class,
ListTools.toList(WorkCompleted.job_FIELDNAME));
if (null == work) {
throw new ExceptionEntityNotExist(workCompletedId, WorkCompleted.class);
}
......
......@@ -2,6 +2,7 @@ package com.x.processplatform.service.processing.neural;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
......@@ -143,8 +144,8 @@ public class NeuralAnalyzer {
Root<FormField> root = cq.from(FormField.class);
Predicate p = root.get(FormField_.form).in(formIds);
p = cb.and(p, cb.equal(root.get(FormField_.dataType), "number"));
cq.select(root.get(FormField_.name)).where(p).distinct(true);
return em.createQuery(cq).getResultList();
cq.select(root.get(FormField_.name)).where(p);
return em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
}
private List<TaskCompleted> listTaskCompleted(Business business, String activity, String person) throws Exception {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册