提交 eca73892 编写于 作者: O o2null

Merge branch 'fix/formv2getworkorworkcompleted' into 'wrdp'

完成表单的V2GetWorkOrWorkCompleted,在WorkCompleted中存储表单数据到Properties中,废弃formData和formMobileData

See merge request o2oa/o2oa!1946
......@@ -13,7 +13,7 @@
"statExclusions": "*.js,*.gif,*.jpg,*.png,*.css,*.ico",
"maxFormContent": 20.0,
"exposeJest": true,
"persistentConnectionsEnable": false,
"persistentConnectionsEnable": true,
"###enable": "是否启用###",
"###order": "center节点顺序,顺序排列0,1,2...###",
"###sslEnable": "是否启用ssl传输加密,如果启用将使用config/keystore文件作为密钥文件.使用config/token.json文件中的sslKeyStorePassword字段为密钥密码,sslKeyManagerPassword为管理密码.###",
......
......@@ -16,7 +16,7 @@
"statExclusions": "*.js,*.gif,*.jpg,*.png,*.css,*.ico",
"maxFormContent": 20.0,
"exposeJest": true,
"persistentConnectionsEnable": false,
"persistentConnectionsEnable": true,
"###enable": "是否启用###",
"###order": "center节点顺序,顺序排列0,1,2...###",
"###sslEnable": "是否启用ssl传输加密,如果启用将使用config/keystore文件作为密钥文件.使用config/token.json文件中的sslKeyStorePassword字段为密钥密码,sslKeyManagerPassword为管理密码.###",
......@@ -50,7 +50,7 @@
"statExclusions": "*.js,*.gif,*.jpg,*.png,*.css,*.ico",
"maxFormContent": 20.0,
"exposeJest": true,
"persistentConnectionsEnable": false,
"persistentConnectionsEnable": true,
"###enable": "是否启用###",
"###port": "http/https端口,负责向前端提供数据访问接口.默认为20020端口.###",
"###sslEnable": "是否启用ssl传输加密,如果启用将使用config/keystore文件作为密钥文件.使用config/token.json文件中的sslKeyStorePassword字段为密钥密码,sslKeyManagerPassword为管理密码.###",
......
{
"mocks": [],
"###mocks": "使用Post模拟Put,Get模拟Delete的模块.###"
"mock": {},
"###mock": "使用Post模拟Put,Get模拟Delete的模块.###"
}
\ No newline at end of file
......@@ -23,6 +23,14 @@ public class Web extends ConfigObject {
}
public Mock getMock() {
return mock;
}
public void setMock(Mock mock) {
this.mock = mock;
}
public static class MockItem {
private MockItemObject put;
private MockItemObject delete;
......
package com.x.server.console;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.TreeMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.eclipse.jetty.plus.jndi.Resource;
import org.eclipse.jetty.util.RolloverFileOutputStream;
import com.alibaba.druid.pool.DruidDataSourceC3P0Adapter;
import com.google.gson.JsonElement;
import com.x.base.core.container.factory.SlicePropertiesBuilder;
import com.x.base.core.entity.Storage;
import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.project.annotation.Module;
import com.x.base.core.project.config.CenterServer;
import com.x.base.core.project.config.Config;
import com.x.base.core.project.config.DataServer;
import com.x.base.core.project.config.ExternalDataSource;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.base.core.project.tools.ClassLoaderTools;
import com.x.base.core.project.tools.DefaultCharset;
import com.x.base.core.project.tools.ListTools;
import com.x.server.console.node.EventQueueExecutor;
import io.github.classgraph.ClassGraph;
import io.github.classgraph.ClassInfo;
import io.github.classgraph.ScanResult;
public class ResourceFactory {
private static Logger logger = LoggerFactory.getLogger(ResourceFactory.class);
private ResourceFactory() {
// nothing
}
public static void bind() throws Exception {
try (ScanResult sr = new ClassGraph()
.addClassLoader(ClassLoaderTools.urlClassLoader(true, false, true, true, true)).enableAnnotationInfo()
.scan()) {
node(sr);
containerEntities(sr);
containerEntityNames(sr);
stroageContainerEntityNames(sr);
}
if (BooleanUtils.isTrue(Config.logLevel().audit().enable())) {
auditLog();
}
if (BooleanUtils.isTrue(Config.externalDataSources().enable())) {
external();
} else {
internal();
}
processPlatformExecutors();
}
private static void node(ScanResult sr) throws Exception {
LinkedBlockingQueue<JsonElement> eventQueue = new LinkedBlockingQueue<>();
EventQueueExecutor eventQueueExecutor = new EventQueueExecutor(eventQueue);
eventQueueExecutor.start();
new Resource(Config.RESOURCE_NODE_EVENTQUEUE, eventQueue);
new Resource(Config.RESOURCE_NODE_EVENTQUEUEEXECUTOR, eventQueueExecutor);
new Resource(Config.RESOURCE_NODE_APPLICATIONS, null);
new Resource(Config.RESOURCE_NODE_APPLICATIONSTIMESTAMP, null);
Entry<String, CenterServer> entry = Config.nodes().centerServers().first();
new Resource(Config.RESOURCE_NODE_CENTERSPRIMARYNODE, entry.getKey());
new Resource(Config.RESOURCE_NODE_CENTERSPRIMARYPORT, entry.getValue().getPort());
new Resource(Config.RESOURCE_NODE_CENTERSPRIMARYSSLENABLE, entry.getValue().getSslEnable());
}
private static void external() throws Exception {
external_druid_c3p0();
}
private static void external_druid_c3p0() throws Exception {
for (ExternalDataSource ds : Config.externalDataSources()) {
if (BooleanUtils.isNotTrue(ds.getEnable())) {
continue;
}
DruidDataSourceC3P0Adapter dataSource = new DruidDataSourceC3P0Adapter();
dataSource.setJdbcUrl(ds.getUrl());
dataSource.setDriverClass(ds.getDriverClassName());
dataSource.setPreferredTestQuery(SlicePropertiesBuilder.validationQueryOfUrl(ds.getUrl()));
dataSource.setUser(ds.getUsername());
dataSource.setPassword(ds.getPassword());
dataSource.setMaxPoolSize(ds.getMaxTotal());
dataSource.setMinPoolSize(ds.getMaxIdle());
// 增加校验
dataSource.setTestConnectionOnCheckin(true);
dataSource.setTestConnectionOnCheckout(true);
dataSource.setAcquireIncrement(2);
if (BooleanUtils.isTrue(ds.getStatEnable())) {
dataSource.setFilters(ds.getStatFilter());
Properties properties = new Properties();
properties.setProperty("druid.stat.slowSqlMillis", ds.getSlowSqlMillis().toString());
dataSource.setProperties(properties);
}
String name = Config.externalDataSources().name(ds);
new Resource(Config.RESOURCE_JDBC_PREFIX + name, dataSource);
}
}
private static void internal() throws Exception {
internal_driud_c3p0();
}
private static void internal_driud_c3p0() throws Exception {
for (Entry<String, DataServer> entry : Config.nodes().dataServers().entrySet()) {
DruidDataSourceC3P0Adapter dataSource = new DruidDataSourceC3P0Adapter();
String url = "jdbc:h2:tcp://" + entry.getKey() + ":" + entry.getValue().getTcpPort()
+ "/X;LOCK_MODE=0;DEFAULT_LOCK_TIMEOUT=" + entry.getValue().getLockTimeout() + ";JMX="
+ (BooleanUtils.isTrue(entry.getValue().getJmxEnable()) ? "TRUE" : "FALSE") + ";CACHE_SIZE="
+ (entry.getValue().getCacheSize() * 1024);
dataSource.setJdbcUrl(url);
dataSource.setDriverClass(SlicePropertiesBuilder.driver_h2);
dataSource.setPreferredTestQuery(SlicePropertiesBuilder.validationQueryOfUrl(url));
dataSource.setUser("sa");
dataSource.setPassword(Config.token().getPassword());
dataSource.setMaxPoolSize(entry.getValue().getMaxTotal());
dataSource.setMinPoolSize(entry.getValue().getMaxIdle());
dataSource.setAcquireIncrement(2);
if (BooleanUtils.isTrue(entry.getValue().getStatEnable())) {
dataSource.setFilters(entry.getValue().getStatFilter());
Properties properties = new Properties();
properties.setProperty("druid.stat.slowSqlMillis", entry.getValue().getSlowSqlMillis().toString());
dataSource.setProperties(properties);
}
String name = Config.nodes().dataServers().name(entry.getValue());
new Resource(Config.RESOURCE_JDBC_PREFIX + name, dataSource);
}
}
private static void containerEntityNames(ScanResult sr) throws Exception {
List<String> list = new ArrayList<>();
for (ClassInfo info : sr.getClassesWithAnnotation(ContainerEntity.class.getName())) {
list.add(info.getName());
}
list = ListTools.trim(list, true, true);
new Resource(Config.RESOURCE_CONTAINERENTITYNAMES, ListUtils.unmodifiableList(list));
}
private static void stroageContainerEntityNames(ScanResult sr) throws Exception {
List<String> list = new ArrayList<>();
for (ClassInfo info : sr.getClassesWithAnnotation(Storage.class.getName())) {
list.add(info.getName());
}
list = ListTools.trim(list, true, true);
new Resource(Config.RESOURCE_STORAGECONTAINERENTITYNAMES, ListUtils.unmodifiableList(list));
}
private static void containerEntities(ScanResult sr) throws Exception {
Map<String, List<String>> map = new TreeMap<>();
for (ClassInfo info : sr.getClassesWithAnnotation(Module.class.getName())) {
Class<?> cls = Class.forName(info.getName());
List<String> os = ListTools.toList(cls.getAnnotation(Module.class).containerEntities());
map.put(info.getName(), ListUtils.unmodifiableList(os));
}
new Resource(Config.RESOURCE_CONTAINERENTITIES, MapUtils.unmodifiableMap(map));
}
private static void auditLog() throws Exception {
RolloverFileOutputStream rolloverFileOutputStream = new RolloverFileOutputStream(
Config.dir_logs(true).getAbsolutePath() + "/yyyy_mm_dd.audit.log", true,
Config.logLevel().audit().logSize());
new Resource(Config.RESOURCE_AUDITLOGPRINTSTREAM,
new PrintStream(rolloverFileOutputStream, true, DefaultCharset.name_iso_utf_8));
}
private static void processPlatformExecutors() throws Exception {
ExecutorService[] services = new ExecutorService[Config.processPlatform().getExecutorCount()];
for (int i = 0; i < Config.processPlatform().getExecutorCount(); i++) {
services[i] = Executors.newFixedThreadPool(1);
}
new Resource(Config.RESOURCE_NODE_PROCESSPLATFORMEXECUTORS, services);
}
}
......@@ -54,8 +54,6 @@ public class WebServerTools extends JettySeverTools {
public static Server start(WebServer webServer) throws Exception {
// 创建Web.json
updateWeb();
// 更新x_desktop的center指向
updateCenterConfigJson();
// 更新 favicon.ico
......@@ -252,7 +250,7 @@ public class WebServerTools extends JettySeverTools {
publicKey = new String(Base64.encodeBase64(publicKeyB));
map.put("publicKey", publicKey);
}
map.put("mock", Config.web().getMock());
FileUtils.writeStringToFile(file, gson.toJson(map), DefaultCharset.charset);
}
}
......
......@@ -41,11 +41,11 @@ class V2LookupWorkOrWorkCompleted extends BaseAction {
Work work = emc.fetch(workOrWorkCompleted, Work.class, ListTools.toList(JpaObject.id_FIELDNAME,
Work.form_FIELDNAME, Work.activity_FIELDNAME, Work.activityType_FIELDNAME));
if (null != work) {
this.work(business, work, wo);
wo = this.work(business, work);
} else {
WorkCompleted workCompleted = emc.flag(workOrWorkCompleted, WorkCompleted.class);
if (null != workCompleted) {
this.workCompleted(business, workCompleted, wo);
wo = this.workCompleted(business, workCompleted);
}
}
} catch (Exception e) {
......@@ -73,23 +73,27 @@ class V2LookupWorkOrWorkCompleted extends BaseAction {
}
}
private void work(Business business, Work work, Wo wo) throws Exception {
private Wo work(Business business, Work work) throws Exception {
Wo wo = new Wo();
if (null != business.form().pick(work.getForm())) {
wo.setId(work.getForm());
} else {
Activity activity = business.getActivity(work);
wo.setId(PropertyTools.getOrElse(activity, Activity.form_FIELDNAME, String.class, ""));
}
return wo;
}
private void workCompleted(Business business, WorkCompleted workCompleted, Wo wo) throws Exception {
private Wo workCompleted(Business business, WorkCompleted workCompleted) throws Exception {
// 先使用当前库的表单,如果不存在使用储存的表单.
Wo wo = new Wo();
if (null != business.form().pick(workCompleted.getForm())) {
wo.setId(workCompleted.getForm());
} else if (null != workCompleted.getProperties().getForm()) {
AdaptForm adapt = workCompleted.getProperties().adaptForm(false);
wo = XGsonBuilder.convert(adapt, Wo.class);
}
return wo;
}
public static class Wo extends AbstractWo {
......
......@@ -17,6 +17,7 @@ import com.x.base.core.project.logger.LoggerFactory;
import com.x.base.core.project.tools.ListTools;
import com.x.base.core.project.tools.PropertyTools;
import com.x.processplatform.assemble.surface.Business;
import com.x.processplatform.assemble.surface.jaxrs.form.V2LookupWorkOrWorkCompleted.Wo;
import com.x.processplatform.core.entity.content.Work;
import com.x.processplatform.core.entity.content.WorkCompleted;
import com.x.processplatform.core.entity.content.WorkCompletedProperties.AdaptForm;
......@@ -37,11 +38,11 @@ class V2LookupWorkOrWorkCompletedMobile extends BaseAction {
Work work = emc.fetch(workOrWorkCompleted, Work.class, ListTools.toList(JpaObject.id_FIELDNAME,
Work.form_FIELDNAME, Work.activity_FIELDNAME, Work.activityType_FIELDNAME));
if (null != work) {
this.work(business, work, wo);
wo = this.work(business, work);
} else {
WorkCompleted workCompleted = emc.flag(workOrWorkCompleted, WorkCompleted.class);
if (null != workCompleted) {
this.workCompleted(business, workCompleted, wo);
wo = this.workCompleted(business, workCompleted);
}
}
} catch (Exception e) {
......@@ -69,23 +70,27 @@ class V2LookupWorkOrWorkCompletedMobile extends BaseAction {
}
}
private void work(Business business, Work work, Wo wo) throws Exception {
private Wo work(Business business, Work work) throws Exception {
Wo wo = new Wo();
if (null != business.form().pick(work.getForm())) {
wo.setId(work.getForm());
} else {
Activity activity = business.getActivity(work);
wo.setId(PropertyTools.getOrElse(activity, Activity.form_FIELDNAME, String.class, ""));
}
return wo;
}
private void workCompleted(Business business, WorkCompleted workCompleted, Wo wo) throws Exception {
private Wo workCompleted(Business business, WorkCompleted workCompleted) throws Exception {
// 先使用当前库的表单,如果不存在使用储存的表单.
Wo wo = new Wo();
if (null != business.form().pick(workCompleted.getForm())) {
wo.setId(workCompleted.getForm());
} else if (null != workCompleted.getProperties().getForm()) {
AdaptForm adapt = workCompleted.getProperties().adaptForm(true);
wo = XGsonBuilder.convert(adapt, Wo.class);
}
return wo;
}
public static class Wo extends AbstractWo {
......
......@@ -295,8 +295,7 @@ class ActionGetWithWorkOrWorkCompleted extends BaseAction {
private static final long serialVersionUID = -1772642962691214007L;
static WrapCopier<WorkCompleted, WoWorkCompleted> copier = WrapCopierFactory.wo(WorkCompleted.class,
WoWorkCompleted.class, null, ListTools.toList(JpaObject.FieldsInvisible,
WorkCompleted.formData_FIELDNAME, WorkCompleted.formMobileData_FIELDNAME));
WoWorkCompleted.class, null, JpaObject.FieldsInvisible);
}
public static class WoTask extends Task {
......
......@@ -570,8 +570,7 @@ class V2GetWorkOrWorkCompleted extends BaseAction {
private static final long serialVersionUID = -1772642962691214007L;
static WrapCopier<WorkCompleted, WoWorkCompleted> copier = WrapCopierFactory.wo(WorkCompleted.class,
WoWorkCompleted.class, null, ListTools.toList(JpaObject.FieldsInvisibleIncludeProperites,
WorkCompleted.formData_FIELDNAME, WorkCompleted.formMobileData_FIELDNAME));
WoWorkCompleted.class, null, JpaObject.FieldsInvisibleIncludeProperites);
}
public static class WoTask extends Task {
......
package com.x.processplatform.assemble.surface.jaxrs.workcompleted;
import org.apache.commons.lang3.BooleanUtils;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
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.processplatform.assemble.surface.Business;
import com.x.processplatform.assemble.surface.WorkCompletedControl;
import com.x.processplatform.core.entity.content.WorkCompleted;
class ActionComplexSnapForm extends BaseAction {
ActionResult<Wo> execute(String id, EffectivePerson effectivePerson) throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<Wo> result = new ActionResult<>();
Business business = new Business(emc);
WorkCompleted workCompleted = emc.find(id, WorkCompleted.class);
if (null == workCompleted) {
throw new ExceptionEntityNotExist(id, WorkCompleted.class);
}
Wo wo = this.get(business, effectivePerson, workCompleted, Wo.class);
wo.setForm(this.getForm(business, workCompleted));
WorkCompletedControl control = wo.getControl();
if (BooleanUtils.isNotTrue(control.getAllowVisit())) {
throw new ExceptionWorkCompletedAccessDenied(effectivePerson.getDistinguishedName(), id);
}
result.setData(wo);
return result;
}
}
public static class Wo extends AbstractWo {
}
private WoForm getForm(Business business, WorkCompleted workCompleted) throws Exception {
WoForm wo = new WoForm();
wo.setData(workCompleted.getFormData());
return wo;
}
}
package com.x.processplatform.assemble.surface.jaxrs.workcompleted;
import org.apache.commons.lang3.BooleanUtils;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
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.processplatform.assemble.surface.Business;
import com.x.processplatform.assemble.surface.WorkCompletedControl;
import com.x.processplatform.core.entity.content.WorkCompleted;
class ActionComplexSnapFormMobile extends BaseAction {
ActionResult<Wo> execute(String id, EffectivePerson effectivePerson) throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<Wo> result = new ActionResult<>();
Business business = new Business(emc);
WorkCompleted workCompleted = emc.find(id, WorkCompleted.class);
if (null == workCompleted) {
throw new ExceptionEntityNotExist(id, WorkCompleted.class);
}
Wo wo = this.get(business, effectivePerson, workCompleted, Wo.class);
wo.setForm(this.getForm(business, workCompleted));
WorkCompletedControl control = wo.getControl();
if (BooleanUtils.isNotTrue(control.getAllowVisit())) {
throw new ExceptionWorkCompletedAccessDenied(effectivePerson.getDistinguishedName(), id);
}
result.setData(wo);
return result;
}
}
public static class Wo extends AbstractWo {
}
private WoForm getForm(Business business, WorkCompleted workCompleted) throws Exception {
WoForm wo = new WoForm();
wo.setData(workCompleted.getFormMobileData());
return wo;
}
}
......@@ -131,41 +131,41 @@ public class WorkCompletedAction extends StandardJaxrsAction {
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "获取复合的WorkCompleted,使用最后记录的表单。", action = ActionComplexSnapForm.class)
@GET
@Path("{id}/complex/snap/form")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void getComplexSnapForm(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("标识") @PathParam("id") String id) {
ActionResult<ActionComplexSnapForm.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionComplexSnapForm().execute(id, effectivePerson);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "获取复合的WorkCompleted,使用最后记录的Mobile表单。", action = ActionComplexSnapForm.class)
@GET
@Path("{id}/complex/snap/form/mobile")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void getComplexMobileSnapForm(@Suspended final AsyncResponse asyncResponse,
@Context HttpServletRequest request, @JaxrsParameterDescribe("标识") @PathParam("id") String id) {
ActionResult<ActionComplexSnapForm.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionComplexSnapForm().execute(id, effectivePerson);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
// @JaxrsMethodDescribe(value = "获取复合的WorkCompleted,使用最后记录的表单。", action = ActionComplexSnapForm.class)
// @GET
// @Path("{id}/complex/snap/form")
// @Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
// @Consumes(MediaType.APPLICATION_JSON)
// public void getComplexSnapForm(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
// @JaxrsParameterDescribe("标识") @PathParam("id") String id) {
// ActionResult<ActionComplexSnapForm.Wo> result = new ActionResult<>();
// EffectivePerson effectivePerson = this.effectivePerson(request);
// try {
// result = new ActionComplexSnapForm().execute(id, effectivePerson);
// } catch (Exception e) {
// logger.error(e, effectivePerson, request, null);
// result.error(e);
// }
// asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
// }
// @JaxrsMethodDescribe(value = "获取复合的WorkCompleted,使用最后记录的Mobile表单。", action = ActionComplexSnapForm.class)
// @GET
// @Path("{id}/complex/snap/form/mobile")
// @Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
// @Consumes(MediaType.APPLICATION_JSON)
// public void getComplexMobileSnapForm(@Suspended final AsyncResponse asyncResponse,
// @Context HttpServletRequest request, @JaxrsParameterDescribe("标识") @PathParam("id") String id) {
// ActionResult<ActionComplexSnapForm.Wo> result = new ActionResult<>();
// EffectivePerson effectivePerson = this.effectivePerson(request);
// try {
// result = new ActionComplexSnapForm().execute(id, effectivePerson);
// } catch (Exception e) {
// logger.error(e, effectivePerson, request, null);
// result.error(e);
// }
// asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
// }
@JaxrsMethodDescribe(value = "根据WorkCompleted Id获取组装的WorkCompleted内容同时返回指定的Form.", action = ActionComplexAppointForm.class)
@GET
......
......@@ -98,7 +98,7 @@ public class WorkCompleted extends SliceJpaObject implements ProjectionInterface
/**
* 通过Work创建WorkCompleted
*/
public WorkCompleted(Work work, Date completedTime, Long duration, String formData, String formMobileData) {
public WorkCompleted(Work work, Date completedTime, Long duration) {
this();
this.job = work.getJob();
this.setTitle(work.getTitle());
......@@ -117,8 +117,8 @@ public class WorkCompleted extends SliceJpaObject implements ProjectionInterface
this.processAlias = work.getProcessAlias();
this.serial = work.getSerial();
this.form = work.getForm();
this.formData = formData;
this.formMobileData = formMobileData;
// this.formData = formData;
// this.formMobileData = formMobileData;
this.work = work.getId();
this.expireTime = work.getExpireTime();
if ((null != expireTime) && (completedTime.after(expireTime))) {
......@@ -281,21 +281,21 @@ public class WorkCompleted extends SliceJpaObject implements ProjectionInterface
@CheckPersist(allowEmpty = true)
private String form;
public static final String formData_FIELDNAME = "formData";
@FieldDescribe("文本内容.")
@Lob
@Basic(fetch = FetchType.EAGER)
@Column(length = JpaObject.length_10M, name = ColumnNamePrefix + formData_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String formData;
public static final String formMobileData_FIELDNAME = "formMobileData";
@FieldDescribe("移动端文本内容.")
@Lob
@Basic(fetch = FetchType.EAGER)
@Column(length = JpaObject.length_10M, name = ColumnNamePrefix + formMobileData_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String formMobileData;
// public static final String formData_FIELDNAME = "formData";
// @FieldDescribe("文本内容.")
// @Lob
// @Basic(fetch = FetchType.EAGER)
// @Column(length = JpaObject.length_10M, name = ColumnNamePrefix + formData_FIELDNAME)
// @CheckPersist(allowEmpty = true)
// private String formData;
// public static final String formMobileData_FIELDNAME = "formMobileData";
// @FieldDescribe("移动端文本内容.")
// @Lob
// @Basic(fetch = FetchType.EAGER)
// @Column(length = JpaObject.length_10M, name = ColumnNamePrefix + formMobileData_FIELDNAME)
// @CheckPersist(allowEmpty = true)
// private String formMobileData;
public static final String work_FIELDNAME = "work";
@Flag
......@@ -714,21 +714,21 @@ public class WorkCompleted extends SliceJpaObject implements ProjectionInterface
this.completedTimeMonth = completedTimeMonth;
}
public String getFormData() {
return formData;
}
public void setFormData(String formData) {
this.formData = formData;
}
public String getFormMobileData() {
return formMobileData;
}
public void setFormMobileData(String formMobileData) {
this.formMobileData = formMobileData;
}
// public String getFormData() {
// return formData;
// }
//
// public void setFormData(String formData) {
// this.formData = formData;
// }
//
// public String getFormMobileData() {
// return formMobileData;
// }
//
// public void setFormMobileData(String formMobileData) {
// this.formMobileData = formMobileData;
// }
public Long getDuration() {
return duration;
......
......@@ -184,7 +184,7 @@ public class WorkCompletedProperties extends JsonProperties {
return adapt;
}
public static class AdaptForm {
public static class AdaptForm extends GsonPropertyObject {
private Form form;
......
......@@ -76,7 +76,6 @@ class ActionCreate extends BaseAction {
workCompleted.setExpired(false);
workCompleted.setExpireTime(null);
workCompleted.setForm(wi.getForm());
workCompleted.setFormData(wi.getFormData());
workCompleted.setJob(StringTools.uniqueToken());
workCompleted.setProcess(process.getId());
workCompleted.setProcessAlias(process.getAlias());
......@@ -121,9 +120,6 @@ class ActionCreate extends BaseAction {
@FieldDescribe("指定表单.")
private String form;
@FieldDescribe("指定表单数据.")
private String formData;
@FieldDescribe("启动人员身份.")
private String identity;
......@@ -176,14 +172,6 @@ class ActionCreate extends BaseAction {
this.form = form;
}
public String getFormData() {
return formData;
}
public void setFormData(String formData) {
this.formData = formData;
}
public String getSerial() {
return serial;
}
......
......@@ -12,7 +12,6 @@ import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.project.config.Config;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.base.core.project.tools.ListTools;
import com.x.processplatform.core.entity.content.Work;
import com.x.processplatform.core.entity.content.WorkCompleted;
import com.x.processplatform.core.entity.element.End;
......@@ -171,21 +170,16 @@ public class EndProcessor extends AbstractEndProcessor {
private WorkCompleted createWorkCompleted(Work work, End end) throws Exception {
Date completedTime = new Date();
Long duration = Config.workTime().betweenMinutes(work.getStartTime(), completedTime);
String formString = "";
String formMobileString = "";
if (StringUtils.isNotEmpty(work.getForm())) {
Form form = this.entityManagerContainer().fetch(work.getForm(), Form.class,
ListTools.toList(Form.data_FIELDNAME, Form.mobileData_FIELDNAME));
if (null != form) {
formString = form.getData();
formMobileString = form.getMobileData();
}
}
WorkCompleted workCompleted = new WorkCompleted(work, completedTime, duration, formString, formMobileString);
WorkCompleted workCompleted = new WorkCompleted(work, completedTime, duration);
workCompleted.setActivity(end.getId());
workCompleted.setActivityAlias(end.getAlias());
workCompleted.setActivityDescription(end.getDescription());
workCompleted.setActivityName(end.getName());
if (StringUtils.isNotEmpty(work.getForm())) {
Form form = this.entityManagerContainer().find(work.getForm(), Form.class);
this.entityManagerContainer().get(Form.class).detach(form);
workCompleted.getProperties().setForm(form);
}
return workCompleted;
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册