ActionListNextWithApplication.java 2.5 KB
Newer Older
R
roo00 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14
package com.x.processplatform.assemble.surface.jaxrs.task;

import java.util.List;

import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.entity.JpaObject;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.exception.ExceptionEntityNotExist;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.jaxrs.EqualsTerms;
Z
zhourui 已提交
15 16
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
R
roo00 已提交
17 18 19 20
import com.x.processplatform.assemble.surface.Business;
import com.x.processplatform.core.entity.content.Task;
import com.x.processplatform.core.entity.element.Application;

Z
zhourui 已提交
21 22
import io.swagger.v3.oas.annotations.media.Schema;

R
roo00 已提交
23 24
class ActionListNextWithApplication extends BaseAction {

Z
zhourui 已提交
25 26
	private static final Logger LOGGER = LoggerFactory.getLogger(ActionListNextWithApplication.class);

R
roo00 已提交
27 28
	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, String id, Integer count, String applicationFlag)
			throws Exception {
Z
zhourui 已提交
29
		LOGGER.debug("execute:{}, id:{}, count:{}.", effectivePerson::getDistinguishedName, () -> id, () -> count);
R
roo00 已提交
30 31 32 33 34 35 36 37 38
		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
			Business business = new Business(emc);
			Application application = business.application().pick(applicationFlag);
			if (null == application) {
				throw new ExceptionEntityNotExist(applicationFlag, Application.class);
			}
			EqualsTerms equals = new EqualsTerms();
			equals.put(Task.person_FIELDNAME, effectivePerson.getDistinguishedName());
			equals.put(Task.application_FIELDNAME, application.getId());
Z
zhourui 已提交
39 40
			return this.standardListNext(Wo.copier, id, count, JpaObject.sequence_FIELDNAME, equals, null, null, null,
					null, null, null, null, true, DESC);
R
roo00 已提交
41 42 43
		}
	}

Z
zhourui 已提交
44
	@Schema(name = "com.x.processplatform.assemble.surface.jaxrs.task.ActionListNextWithApplication.Wo")
R
roo00 已提交
45 46 47 48 49 50 51 52
	public static class Wo extends Task {

		private static final long serialVersionUID = 2279846765261247910L;

		static WrapCopier<Task, Wo> copier = WrapCopierFactory.wo(Task.class, Wo.class, null,
				JpaObject.FieldsInvisible);

		@FieldDescribe("排序号")
Z
zhourui 已提交
53
		@Schema(description = "排序号")
R
roo00 已提交
54 55 56 57 58 59 60 61 62 63 64 65
		private Long rank;

		public Long getRank() {
			return rank;
		}

		public void setRank(Long rank) {
			this.rank = rank;
		}

	}
}