From 1a0f5d4b7681d10fb53930e62ff870a8f445f612 Mon Sep 17 00:00:00 2001 From: o2sword <171715986@qq.com> Date: Thu, 3 Mar 2022 13:49:21 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AD=BE=E6=89=B93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../surface/jaxrs/sign/ActionSave.java | 122 ++++++++++++ .../surface/jaxrs/sign/BaseAction.java | 149 ++++++++++++++ .../surface/jaxrs/sign/SignAction.java | 126 ++++++++++++ .../core/entity/PersistenceProperties.java | 4 + .../core/entity/content/DocSign.java | 66 +++++-- .../entity/content/DocSignProperties.java | 3 + .../core/entity/content/DocSignScrawl.java | 186 ++++++++++++++++++ 7 files changed, 638 insertions(+), 18 deletions(-) create mode 100644 o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/sign/ActionSave.java create mode 100644 o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/sign/BaseAction.java create mode 100644 o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/sign/SignAction.java create mode 100644 o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/DocSignScrawl.java diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/sign/ActionSave.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/sign/ActionSave.java new file mode 100644 index 0000000000..8e1618b7d5 --- /dev/null +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/sign/ActionSave.java @@ -0,0 +1,122 @@ +package com.x.processplatform.assemble.surface.jaxrs.sign; + +import com.google.gson.JsonElement; +import com.x.base.core.container.EntityManagerContainer; +import com.x.base.core.container.factory.EntityManagerContainerFactory; +import com.x.base.core.project.annotation.FieldDescribe; +import com.x.base.core.project.exception.ExceptionAccessDenied; +import com.x.base.core.project.exception.ExceptionEntityNotExist; +import com.x.base.core.project.exception.ExceptionFieldEmpty; +import com.x.base.core.project.gson.GsonPropertyObject; +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.logger.Logger; +import com.x.base.core.project.logger.LoggerFactory; +import com.x.processplatform.assemble.surface.Business; +import com.x.processplatform.core.entity.content.DocSign; +import com.x.processplatform.core.entity.content.Task; +import org.apache.commons.lang3.StringUtils; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +class ActionSave extends BaseAction { + + private static Logger logger = LoggerFactory.getLogger(ActionSave.class); + + ActionResult execute(EffectivePerson effectivePerson, String taskId, JsonElement jsonElement) throws Exception { + String job = null; + Wi wi = this.convertToWrapIn(jsonElement, Wi.class); + if(wi.getStatus() == null){ + throw new ExceptionFieldEmpty(DocSign.status_FIELDNAME); + } + if(wi.getStatus().equals(DocSign.STATUS_3) && StringUtils.isBlank(wi.getContent())){ + throw new ExceptionFieldEmpty("content"); + } + Task task = null; + Wo wo = new Wo(); + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + task = emc.fetch(taskId, Task.class); + if(task == null){ + throw new ExceptionEntityNotExist(taskId, Task.class); + } + if(!task.getPerson().equals(effectivePerson.getDistinguishedName())){ + throw new ExceptionAccessDenied(effectivePerson); + } + } + this.saveDocSign(wi, task); + ActionResult result = new ActionResult<>(); + result.setData(wo); + return result; + } + + private String saveDocSign(Wi wi, Task task) throws Exception{ + try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { + boolean flag = false; + DocSign docSign = emc.firstEqual(DocSign.class, DocSign.taskId_FIELDNAME, task.getId()); + if(docSign == null) { + flag = true; + docSign = new DocSign(task); + docSign.setStatus(wi.getStatus()); + } + docSign.getProperties().setInputList(wi.getInputList()); + docSign.getProperties().setScrawlList(wi.getScrawlList()); + if(!wi.getStatus().equals(DocSign.STATUS_1)){ + docSign.setCommitTime(new Date()); + } + } + return ""; + } + + public static class Wi extends GsonPropertyObject { + @FieldDescribe("状态:1(暂存)|2(签批正文不可以修改)|3(签批正文可以修改,正文保存为图片).") + private Integer status; + @FieldDescribe("包含签批的html正文后内容,状态为3时必传.") + private String content; + @FieldDescribe("输入框列表.") + private List inputList = new ArrayList<>(); + @FieldDescribe("涂鸦列表.") + private List scrawlList = new ArrayList<>(); + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public List getInputList() { + return inputList; + } + + public void setInputList(List inputList) { + this.inputList = inputList; + } + + public List getScrawlList() { + return scrawlList; + } + + public void setScrawlList(List scrawlList) { + this.scrawlList = scrawlList; + } + } + + public static class Wo extends WoId { + + private static final long serialVersionUID = -2577413577740827608L; + + } + +} diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/sign/BaseAction.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/sign/BaseAction.java new file mode 100644 index 0000000000..dcdc5a07e0 --- /dev/null +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/sign/BaseAction.java @@ -0,0 +1,149 @@ +package com.x.processplatform.assemble.surface.jaxrs.sign; + +import com.x.base.core.project.annotation.FieldDescribe; +import com.x.base.core.project.http.EffectivePerson; +import com.x.base.core.project.jaxrs.StandardJaxrsAction; +import com.x.base.core.project.tools.ListTools; +import com.x.base.core.project.tools.StringTools; +import com.x.processplatform.assemble.surface.Business; +import com.x.processplatform.core.entity.content.Snap; +import com.x.processplatform.core.entity.content.Snap_; +import com.x.processplatform.core.entity.element.Application; +import com.x.processplatform.core.entity.element.Process; +import org.apache.commons.lang3.StringUtils; + +import javax.persistence.EntityManager; +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.Predicate; +import javax.persistence.criteria.Root; +import java.util.List; + +abstract class BaseAction extends StandardJaxrsAction { + + protected Predicate manageFilter(Business business, FilterWi wi) throws Exception { + EntityManager em = business.entityManagerContainer().get(Snap.class); + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery cq = cb.createQuery(Snap.class); + Root root = cq.from(Snap.class); + Predicate p = cb.conjunction(); + if (ListTools.isNotEmpty(wi.getApplicationList())) { + p = cb.and(p, root.get(Snap_.application).in(wi.getApplicationList())); + } + if (ListTools.isNotEmpty(wi.getProcessList())) { + p = cb.and(p, root.get(Snap_.process).in(business.process().listEditionProcess(wi.getProcessList()))); + } + if (ListTools.isNotEmpty(wi.getPersonList())) { + p = cb.and(p, root.get(Snap_.person).in(business.organization().person().list(wi.getPersonList()))); + } + if (StringUtils.isNoneBlank(wi.getKey())) { + String key = StringTools.escapeSqlLikeKey(wi.getKey()); + p = cb.and(p, + cb.or(cb.like(root.get(Snap_.title), "%" + key + "%", StringTools.SQL_ESCAPE_CHAR), + cb.like(root.get(Snap_.creatorPerson), "%" + key + "%", StringTools.SQL_ESCAPE_CHAR), + cb.like(root.get(Snap_.creatorUnit), "%" + key + "%", StringTools.SQL_ESCAPE_CHAR))); + } + return p; + } + + protected Predicate filter(EffectivePerson effectivePerson, Business business, FilterWi wi) throws Exception { + EntityManager em = business.entityManagerContainer().get(Snap.class); + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery cq = cb.createQuery(Snap.class); + Root root = cq.from(Snap.class); + Predicate p = cb.equal(root.get(Snap_.person), effectivePerson.getDistinguishedName()); + if (ListTools.isNotEmpty(wi.getApplicationList())) { + p = cb.and(p, root.get(Snap_.application).in(wi.getApplicationList())); + } + if (ListTools.isNotEmpty(wi.getProcessList())) { + p = cb.and(p, root.get(Snap_.process).in(business.process().listEditionProcess(wi.getProcessList()))); + } + if (StringUtils.isNoneBlank(wi.getKey())) { + String key = StringTools.escapeSqlLikeKey(wi.getKey()); + p = cb.and(p, + cb.or(cb.like(root.get(Snap_.title), "%" + key + "%", StringTools.SQL_ESCAPE_CHAR), + cb.like(root.get(Snap_.creatorPerson), "%" + key + "%", StringTools.SQL_ESCAPE_CHAR), + cb.like(root.get(Snap_.creatorUnit), "%" + key + "%", StringTools.SQL_ESCAPE_CHAR))); + } + return p; + } + + protected Predicate myFilter(EffectivePerson effectivePerson, Business business) throws Exception { + EntityManager em = business.entityManagerContainer().get(Snap.class); + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery cq = cb.createQuery(Snap.class); + Root root = cq.from(Snap.class); + return cb.equal(root.get(Snap_.person), effectivePerson.getDistinguishedName()); + } + + protected Predicate myApplicationFilter(EffectivePerson effectivePerson, Business business, Application application) + throws Exception { + EntityManager em = business.entityManagerContainer().get(Snap.class); + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery cq = cb.createQuery(Snap.class); + Root root = cq.from(Snap.class); + Predicate p = cb.equal(root.get(Snap_.person), effectivePerson.getDistinguishedName()); + p = cb.and(p, cb.equal(root.get(Snap_.application), application.getId())); + return p; + } + + protected Predicate myProcessFilter(EffectivePerson effectivePerson, Business business, Process process) + throws Exception { + EntityManager em = business.entityManagerContainer().get(Snap.class); + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery cq = cb.createQuery(Snap.class); + Root root = cq.from(Snap.class); + Predicate p = cb.equal(root.get(Snap_.person), effectivePerson.getDistinguishedName()); + p = cb.and(p, cb.equal(root.get(Snap_.process), process.getId())); + return p; + } + + protected class FilterWi { + + @FieldDescribe("应用id") + private List applicationList; + + @FieldDescribe("流程") + private List processList; + + @FieldDescribe("创建人") + private List personList; + + @FieldDescribe("匹配关键字") + private String key; + + public List getApplicationList() { + return applicationList; + } + + public void setApplicationList(List applicationList) { + this.applicationList = applicationList; + } + + public List getProcessList() { + return processList; + } + + public void setProcessList(List processList) { + this.processList = processList; + } + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public List getPersonList() { + return personList; + } + + public void setPersonList(List personList) { + this.personList = personList; + } + + } + +} diff --git a/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/sign/SignAction.java b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/sign/SignAction.java new file mode 100644 index 0000000000..d1fc4348a6 --- /dev/null +++ b/o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/sign/SignAction.java @@ -0,0 +1,126 @@ +package com.x.processplatform.assemble.surface.jaxrs.sign; + +import com.google.gson.JsonElement; +import com.x.base.core.project.annotation.JaxrsDescribe; +import com.x.base.core.project.annotation.JaxrsMethodDescribe; +import com.x.base.core.project.annotation.JaxrsParameterDescribe; +import com.x.base.core.project.http.ActionResult; +import com.x.base.core.project.http.EffectivePerson; +import com.x.base.core.project.http.HttpMediaType; +import com.x.base.core.project.jaxrs.ResponseFactory; +import com.x.base.core.project.jaxrs.StandardJaxrsAction; +import com.x.base.core.project.logger.Logger; +import com.x.base.core.project.logger.LoggerFactory; +import com.x.processplatform.assemble.surface.jaxrs.snap.*; +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.glassfish.jersey.media.multipart.FormDataParam; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.*; +import javax.ws.rs.container.AsyncResponse; +import javax.ws.rs.container.Suspended; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import java.util.List; + +/** + * @author sword + */ +@Path("sign") +@JaxrsDescribe("文档签批") +public class SignAction extends StandardJaxrsAction { + + private static Logger logger = LoggerFactory.getLogger(SignAction.class); + + /*@JaxrsMethodDescribe(value = "获取快照对象.", action = ActionGet.class) + @GET + @Path("{id}") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void get(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("标识") @PathParam("id") String id) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionGet().execute(effectivePerson, id); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "删除快照", action = ActionDelete.class) + @DELETE + @Path("{id}") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void delete(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("标识") @PathParam("id") String id) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionDelete().execute(effectivePerson, id); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + @JaxrsMethodDescribe(value = "删除快照", action = ActionDelete.class) + @GET + @Path("{id}/mockdeletetoget") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void deleteMockGet2Delete(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("标识") @PathParam("id") String id) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionDelete().execute(effectivePerson, id); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + }*/ + + @JaxrsMethodDescribe(value = "保存签批.", action = ActionSave.class) + @POST + @Path("save/task/{taskId}") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.MULTIPART_FORM_DATA) + public void save(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, + @JaxrsParameterDescribe("待办ID") @PathParam("taskId") String taskId, JsonElement jsonElement) { + ActionResult result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionSave().execute(effectivePerson, taskId, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, null); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result)); + } + + /*@JaxrsMethodDescribe(value = "按条件对快照分页显示.", action = ActionManageListFilterPaging.class) + @POST + @Path("list/filter/{page}/size/{size}/manage") + @Produces(HttpMediaType.APPLICATION_JSON_UTF_8) + @Consumes(MediaType.APPLICATION_JSON) + public void manageListFilterPaging(@Suspended final AsyncResponse asyncResponse, + @Context HttpServletRequest request, @JaxrsParameterDescribe("分页") @PathParam("page") Integer page, + @JaxrsParameterDescribe("数量") @PathParam("size") Integer size, JsonElement jsonElement) { + ActionResult> result = new ActionResult<>(); + EffectivePerson effectivePerson = this.effectivePerson(request); + try { + result = new ActionManageListFilterPaging().execute(effectivePerson, page, size, jsonElement); + } catch (Exception e) { + logger.error(e, effectivePerson, request, jsonElement); + result.error(e); + } + asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result, jsonElement)); + }*/ + +} diff --git a/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/PersistenceProperties.java b/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/PersistenceProperties.java index ecbbc0f23e..afb9f71ef6 100644 --- a/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/PersistenceProperties.java +++ b/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/PersistenceProperties.java @@ -21,6 +21,10 @@ public final class PersistenceProperties extends AbstractPersistenceProperties { public static final String table = "PP_C_DOC_SIGN"; } + public static class DocSignScrawl { + public static final String table = "PP_C_DOC_SIGN_SCRAWL"; + } + public static class TaskCompleted { public static final String table = "PP_C_TASKCOMPLETED"; } diff --git a/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/DocSign.java b/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/DocSign.java index 83c0b5b5dd..758da785cd 100644 --- a/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/DocSign.java +++ b/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/DocSign.java @@ -15,6 +15,10 @@ import org.apache.openjpa.persistence.jdbc.Strategy; import javax.persistence.*; import java.util.Date; +/** + * 签批信息 + * @author sword + */ @Entity @ContainerEntity(dumpSize = 5, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong) @Table(name = PersistenceProperties.Content.DocSign.table, uniqueConstraints = { @@ -28,6 +32,10 @@ public class DocSign extends SliceJpaObject { private static final String TABLE = PersistenceProperties.Content.DocSign.table; + public static final Integer STATUS_1 = 1; + public static final Integer STATUS_2 = 3; + public static final Integer STATUS_3 = 3; + @Override public String getId() { return id; @@ -71,7 +79,16 @@ public class DocSign extends SliceJpaObject { } public DocSign() { - // nothing + } + + public DocSign(Task task) { + this.setTitle(task.getTitle()); + this.application = task.getApplication(); + this.process = task.getProcess(); + this.job = task.getJob(); + this.activity = task.getActivity(); + this.activityName = task.getActivityName(); + this.person = task.getPerson(); } public DocSignProperties getProperties() { @@ -88,7 +105,6 @@ public class DocSign extends SliceJpaObject { public static final String title_FIELDNAME = "title"; @FieldDescribe("标题.") @Column(length = length_255B, name = ColumnNamePrefix + title_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + title_FIELDNAME) @CheckPersist(allowEmpty = true) private String title; @@ -107,30 +123,28 @@ public class DocSign extends SliceJpaObject { private String process; public static final String job_FIELDNAME = "job"; - @FieldDescribe("任务.") + @FieldDescribe("工单ID.") @Column(length = JpaObject.length_id, name = ColumnNamePrefix + job_FIELDNAME) @Index(name = TABLE + IndexNameMiddle + job_FIELDNAME) @CheckPersist(allowEmpty = false) private String job; - public static final String work_FIELDNAME = "work"; - @FieldDescribe("工作ID.") - @Column(length = JpaObject.length_id, name = ColumnNamePrefix + work_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + work_FIELDNAME) + public static final String taskId_FIELDNAME = "taskId"; + @FieldDescribe("待办ID.") + @Column(length = JpaObject.length_id, name = ColumnNamePrefix + taskId_FIELDNAME) + @Index(name = TABLE + IndexNameMiddle + taskId_FIELDNAME, unique = true) @CheckPersist(allowEmpty = false) - private String work; + private String taskId; public static final String activity_FIELDNAME = "activity"; @FieldDescribe("活动ID.") @Column(length = JpaObject.length_id, name = ColumnNamePrefix + activity_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + activity_FIELDNAME) @CheckPersist(allowEmpty = false) private String activity; public static final String activityName_FIELDNAME = "activityName"; @FieldDescribe("活动名称.") @Column(length = length_255B, name = ColumnNamePrefix + activityName_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + activityName_FIELDNAME) @CheckPersist(allowEmpty = true) private String activityName; @@ -205,14 +219,6 @@ public class DocSign extends SliceJpaObject { this.job = job; } - public String getWork() { - return work; - } - - public void setWork(String work) { - this.work = work; - } - public String getActivity() { return activity; } @@ -236,4 +242,28 @@ public class DocSign extends SliceJpaObject { public void setCommitTime(Date commitTime) { this.commitTime = commitTime; } + + public String getSignPicAttId() { + return signPicAttId; + } + + public void setSignPicAttId(String signPicAttId) { + this.signPicAttId = signPicAttId; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } } diff --git a/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/DocSignProperties.java b/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/DocSignProperties.java index 2437ea6cd0..97198f10dd 100644 --- a/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/DocSignProperties.java +++ b/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/DocSignProperties.java @@ -1,6 +1,7 @@ package com.x.processplatform.core.entity.content; import com.x.base.core.entity.JsonProperties; +import com.x.base.core.project.annotation.FieldDescribe; import java.util.ArrayList; import java.util.List; @@ -15,8 +16,10 @@ public class DocSignProperties extends JsonProperties { private String title; + @FieldDescribe("输入框列表.") private List inputList = new ArrayList<>(); + @FieldDescribe("涂鸦列表.") private List scrawlList = new ArrayList<>(); public Data getData() { diff --git a/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/DocSignScrawl.java b/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/DocSignScrawl.java new file mode 100644 index 0000000000..8ed88dd5a5 --- /dev/null +++ b/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/content/DocSignScrawl.java @@ -0,0 +1,186 @@ +package com.x.processplatform.core.entity.content; + +import com.x.base.core.entity.JpaObject; +import com.x.base.core.entity.SliceJpaObject; +import com.x.base.core.entity.annotation.CheckPersist; +import com.x.base.core.entity.annotation.ContainerEntity; +import com.x.base.core.project.annotation.FieldDescribe; +import com.x.processplatform.core.entity.PersistenceProperties; +import org.apache.openjpa.persistence.jdbc.Index; + +import javax.persistence.*; +import java.util.Date; + +/** + * 签批涂鸦列表 + * @author sword + */ +@Entity +@ContainerEntity(dumpSize = 5, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong) +@Table(name = PersistenceProperties.Content.DocSignScrawl.table, uniqueConstraints = { + @UniqueConstraint(name = PersistenceProperties.Content.DocSignScrawl.table + JpaObject.IndexNameMiddle + + JpaObject.DefaultUniqueConstraintSuffix, columnNames = { JpaObject.IDCOLUMN, + JpaObject.CREATETIMECOLUMN, JpaObject.UPDATETIMECOLUMN, JpaObject.SEQUENCECOLUMN }) }) +@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) +public class DocSignScrawl extends SliceJpaObject { + + private static final long serialVersionUID = -8648872600208475747L; + + private static final String TABLE = PersistenceProperties.Content.DocSignScrawl.table; + + @Override + public String getId() { + return id; + } + + @Override + public void setId(String id) { + this.id = id; + } + + @FieldDescribe("数据库主键,自动生成.") + @Id + @Column(length = length_id, name = ColumnNamePrefix + id_FIELDNAME) + private String id = createId(); + + @Override + public void onPersist() throws Exception { + } + + public DocSignScrawl() { + // nothing + } + + public DocSignScrawl(DocSign docSign, String data) { + this.signId = docSign.getId(); + this.job = docSign.getJob(); + this.activity = docSign.getActivity(); + this.activityName = docSign.getActivityName(); + this.person = docSign.getPerson(); + this.commitTime = new Date(); + this.data = data; + } + + public static final String signId_FIELDNAME = "signId"; + @FieldDescribe("签批ID.") + @Column(length = JpaObject.length_id, name = ColumnNamePrefix + signId_FIELDNAME) + @Index(name = TABLE + IndexNameMiddle + signId_FIELDNAME) + @CheckPersist(allowEmpty = false) + private String signId; + + public static final String job_FIELDNAME = "job"; + @FieldDescribe("任务.") + @Column(length = JpaObject.length_id, name = ColumnNamePrefix + job_FIELDNAME) + @Index(name = TABLE + IndexNameMiddle + job_FIELDNAME) + @CheckPersist(allowEmpty = false) + private String job; + + public static final String activity_FIELDNAME = "activity"; + @FieldDescribe("活动ID.") + @Column(length = JpaObject.length_id, name = ColumnNamePrefix + activity_FIELDNAME) + @CheckPersist(allowEmpty = false) + private String activity; + + public static final String activityName_FIELDNAME = "activityName"; + @FieldDescribe("活动名称.") + @Column(length = length_255B, name = ColumnNamePrefix + activityName_FIELDNAME) + @CheckPersist(allowEmpty = true) + private String activityName; + + public static final String person_FIELDNAME = "person"; + @FieldDescribe("签批人") + @Column(length = length_255B, name = ColumnNamePrefix + person_FIELDNAME) + @Index(name = TABLE + IndexNameMiddle + person_FIELDNAME) + @CheckPersist(allowEmpty = false) + private String person; + + public static final String commitTime_FIELDNAME = "commitTime"; + @Temporal(TemporalType.TIME) + @FieldDescribe("提交时间.") + @Column(name = ColumnNamePrefix + commitTime_FIELDNAME) + @Index(name = TABLE + IndexNameMiddle + commitTime_FIELDNAME) + @CheckPersist(allowEmpty = true) + private Date commitTime; + + public static final String hasScrawlPic_FIELDNAME = "hasScrawlPic"; + @FieldDescribe("是否有涂鸦图片") + @Column(name = ColumnNamePrefix + hasScrawlPic_FIELDNAME) + @CheckPersist(allowEmpty = true) + private Boolean hasScrawlPic = false; + + public static final String data_FIELDNAME = "data"; + @FieldDescribe("涂鸦信息.") + @Lob + @Basic(fetch = FetchType.EAGER) + @Column(length = JpaObject.length_10M, name = ColumnNamePrefix + data_FIELDNAME) + @CheckPersist(allowEmpty = true) + private String data; + + public String getPerson() { + return person; + } + + public void setPerson(String person) { + this.person = person; + } + + public static long getSerialVersionUID() { + return serialVersionUID; + } + + public String getJob() { + return job; + } + + public void setJob(String job) { + this.job = job; + } + + public String getActivity() { + return activity; + } + + public void setActivity(String activity) { + this.activity = activity; + } + + public String getActivityName() { + return activityName; + } + + public void setActivityName(String activityName) { + this.activityName = activityName; + } + + public Date getCommitTime() { + return commitTime; + } + + public void setCommitTime(Date commitTime) { + this.commitTime = commitTime; + } + + public String getSignId() { + return signId; + } + + public void setSignId(String signId) { + this.signId = signId; + } + + public Boolean getHasScrawlPic() { + return hasScrawlPic; + } + + public void setHasScrawlPic(Boolean hasScrawlPic) { + this.hasScrawlPic = hasScrawlPic; + } + + public String getData() { + return data; + } + + public void setData(String data) { + this.data = data; + } +} -- GitLab