提交 0a5e4a63 编写于 作者: O o2null

Merge branch 'fix/recordCompleted' into 'develop'

record已经完成workCompleted判断

See merge request o2oa/o2oa!1007

(cherry picked from commit b012d42e)

415961b7 record已经完成workCompleted判断
上级 94eb58f1
......@@ -631,6 +631,18 @@ public class EntityManagerContainer extends EntityManagerContainerBasic {
return os.isEmpty() ? null : os.get(0);
}
public <T extends JpaObject> T firstEqualOrEqual(Class<T> cls, String attribute, Object value,
String otherAttribute, Object otherValue) throws Exception {
EntityManager em = this.get(cls);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<T> cq = cb.createQuery(cls);
Root<T> root = cq.from(cls);
cq.select(root)
.where(cb.or(cb.equal(root.get(attribute), value), cb.equal(root.get(otherAttribute), otherValue)));
List<T> os = em.createQuery(cq).setMaxResults(1).getResultList();
return os.stream().findFirst().orElse(null);
}
public <T extends JpaObject> Long count(Class<T> cls) throws Exception {
EntityManager em = this.get(cls);
CriteriaBuilder cb = em.getCriteriaBuilder();
......
......@@ -35,24 +35,23 @@ class ActionReference extends BaseAction {
ActionResult<Wo> result = new ActionResult<>();
Task task = emc.find(id, Task.class);
if (null == task) {
throw new ExceptionEntityNotExist(id,Task.class);
throw new ExceptionEntityNotExist(id, Task.class);
}
if (effectivePerson.isNotPerson(effectivePerson.getDistinguishedName()) && effectivePerson.isNotManager()) {
throw new ExceptionAccessDenied(effectivePerson, task);
}
Wo wo = new Wo();
/** 组装 Task 信息 */
// 组装 Task 信息
wo.setTask(WoTask.copier.copy(task));
Work work = emc.find(task.getWork(), Work.class);
/** 组装 Work */
// 组装 Work
if (null != work) {
wo.setWork(WoWork.copier.copy(work));
// wrap.put("work", workOutCopier.copy(work));
/** 组装 Attachment */
// 组装 Attachment
wo.setAttachmentList(this.listAttachment(business, work));
}
wo.setWorkCompletedList(this.listWorkCompleted(business, task));
/** 装载WorkLog 信息 */
// 装载WorkLog 信息
wo.setWorkLogList(this.listWorkLog(business, task));
result.setData(wo);
return result;
......
......@@ -4,11 +4,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import com.x.base.core.project.logger.Audit;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import com.google.gson.JsonElement;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
......@@ -23,6 +18,7 @@ import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.jaxrs.WoId;
import com.x.base.core.project.jaxrs.WrapBoolean;
import com.x.base.core.project.logger.Audit;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.base.core.project.tools.ListTools;
......@@ -35,6 +31,7 @@ import com.x.processplatform.core.entity.content.RecordProperties.NextManual;
import com.x.processplatform.core.entity.content.Task;
import com.x.processplatform.core.entity.content.TaskCompleted;
import com.x.processplatform.core.entity.content.Work;
import com.x.processplatform.core.entity.content.WorkCompleted;
import com.x.processplatform.core.entity.content.WorkLog;
import com.x.processplatform.core.express.ProcessingAttributes;
import com.x.processplatform.core.express.service.processing.jaxrs.task.V2ResetWi;
......@@ -42,6 +39,10 @@ import com.x.processplatform.core.express.service.processing.jaxrs.task.WrapProc
import com.x.processplatform.core.express.service.processing.jaxrs.task.WrapUpdatePrevTaskIdentity;
import com.x.processplatform.core.express.service.processing.jaxrs.taskcompleted.WrapUpdateNextTaskIdentity;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
public class V2Reset extends BaseAction {
private static Logger logger = LoggerFactory.getLogger(V2Reset.class);
......@@ -184,6 +185,13 @@ public class V2Reset extends BaseAction {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
final List<String> nextTaskIdentities = new ArrayList<>();
this.record = new Record(workLog, task);
// 校验workCompleted,如果存在,那么说明工作已经完成,标识状态为已经完成.
WorkCompleted workCompleted = emc.firstEqual(WorkCompleted.class, WorkCompleted.job_FIELDNAME,
task.getJob());
if (null != workCompleted) {
record.setCompleted(true);
record.setWorkCompleted(workCompleted.getId());
}
record.setPerson(effectivePerson.getDistinguishedName());
record.setType(Record.TYPE_RESET);
List<String> ids = emc.idsEqual(Task.class, Task.job_FIELDNAME, work.getJob());
......@@ -192,19 +200,19 @@ public class V2Reset extends BaseAction {
ListTools.toList(Task.identity_FIELDNAME, Task.job_FIELDNAME, Task.work_FIELDNAME,
Task.activity_FIELDNAME, Task.activityAlias_FIELDNAME, Task.activityName_FIELDNAME,
Task.activityToken_FIELDNAME, Task.activityType_FIELDNAME, Task.identity_FIELDNAME));
if (wi.getKeep()) {
/* 不排除自己,那么把自己再加进去 */
if (BooleanUtils.isTrue(wi.getKeep())) {
// 不排除自己,那么把自己再加进去
list.add(task);
}
list.stream().collect(Collectors.groupingBy(Task::getActivity, Collectors.toList())).entrySet().stream()
.forEach(o -> {
Task task = o.getValue().get(0);
Task next = o.getValue().get(0);
NextManual nextManual = new NextManual();
nextManual.setActivity(task.getActivity());
nextManual.setActivityAlias(task.getActivityAlias());
nextManual.setActivityName(task.getActivityName());
nextManual.setActivityToken(task.getActivityToken());
nextManual.setActivityType(task.getActivityType());
nextManual.setActivity(next.getActivity());
nextManual.setActivityAlias(next.getActivityAlias());
nextManual.setActivityName(next.getActivityName());
nextManual.setActivityToken(next.getActivityToken());
nextManual.setActivityType(next.getActivityType());
for (Task t : o.getValue()) {
nextManual.getTaskIdentityList().add(t.getIdentity());
nextTaskIdentities.add(t.getIdentity());
......
......@@ -158,8 +158,6 @@ class V2AddSplit extends BaseAction {
ProcessingAttributes processingAttributes = new ProcessingAttributes();
processingAttributes.setType(ProcessingAttributes.TYPE_ADDSPLIT);
processingAttributes.setSeries(series);
// 不需要从arrived开始,已经设置好全部状态.
// processingAttributes.setForceJoinAtArrive(true);
WoId processingResp = ThisApplication.context().applications()
.putQuery(x_processplatform_service_processing.class,
Applications.joinQueryUri("work", id, "processing"), processingAttributes, work.getJob())
......
......@@ -4,11 +4,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import com.x.base.core.project.logger.Audit;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import com.google.gson.JsonElement;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
......@@ -23,6 +18,7 @@ import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.jaxrs.WoId;
import com.x.base.core.project.jaxrs.WrapBoolean;
import com.x.base.core.project.logger.Audit;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.base.core.project.tools.ListTools;
......@@ -35,12 +31,17 @@ import com.x.processplatform.core.entity.content.RecordProperties.NextManual;
import com.x.processplatform.core.entity.content.Task;
import com.x.processplatform.core.entity.content.TaskCompleted;
import com.x.processplatform.core.entity.content.Work;
import com.x.processplatform.core.entity.content.WorkCompleted;
import com.x.processplatform.core.entity.content.WorkLog;
import com.x.processplatform.core.entity.element.Activity;
import com.x.processplatform.core.entity.element.ActivityType;
import com.x.processplatform.core.express.ProcessingAttributes;
import com.x.processplatform.core.express.service.processing.jaxrs.work.V2RerouteWi;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
class V2Reroute extends BaseAction {
private static Logger logger = LoggerFactory.getLogger(V2Reroute.class);
......@@ -127,6 +128,13 @@ class V2Reroute extends BaseAction {
Business business = new Business(emc);
final List<String> nextTaskIdentities = new ArrayList<>();
record = new Record(workLog);
// 校验workCompleted,如果存在,那么说明工作已经完成,标识状态为已经完成.
WorkCompleted workCompleted = emc.firstEqual(WorkCompleted.class, WorkCompleted.job_FIELDNAME,
workLog.getJob());
if (null != workCompleted) {
record.setCompleted(true);
record.setWorkCompleted(workCompleted.getId());
}
record.setPerson(effectivePerson.getDistinguishedName());
record.setType(Record.TYPE_REROUTE);
record.setArrivedActivity(destinationActivity.getId());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册