提交 3264b81a 编写于 作者: O o2sword

新版应用市场优化2

上级 5f62dcd8
......@@ -10,6 +10,7 @@ import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.program.center.core.entity.Application;
import com.x.program.center.core.entity.Attachment;
import com.x.program.center.core.entity.InstallLog;
import java.util.ArrayList;
import java.util.List;
......@@ -25,6 +26,13 @@ class ActionGet extends BaseAction {
}
Wo wo = Wo.copier.copy(app);
wo.setAttList(emc.listEqual(Attachment.class, Attachment.application_FIELDNAME, wo.getId()));
InstallLog installLog = emc.find(id, InstallLog.class);
if(installLog!=null){
wo.setInstalledVersion(installLog.getVersion());
}else{
wo.setInstalledVersion("");
}
result.setData(wo);
return result;
}
......@@ -38,6 +46,9 @@ class ActionGet extends BaseAction {
@FieldDescribe("图片列表")
private List<Attachment> attList = new ArrayList<>();
@FieldDescribe("已安装的版本,空表示未安装")
private String installedVersion;
public List<Attachment> getAttList() {
return attList;
}
......@@ -45,5 +56,13 @@ class ActionGet extends BaseAction {
public void setAttList(List<Attachment> attList) {
this.attList = attList;
}
public String getInstalledVersion() {
return installedVersion;
}
public void setInstalledVersion(String installedVersion) {
this.installedVersion = installedVersion;
}
}
}
\ No newline at end of file
package com.x.program.center.jaxrs.market;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
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.program.center.core.entity.InstallLog;
class ActionGetInstallLog extends BaseAction {
ActionResult<Wo> execute(EffectivePerson effectivePerson, String id) throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<Wo> result = new ActionResult<>();
InstallLog installLog = emc.find(id, InstallLog.class);
if(installLog==null){
throw new ExceptionEntityNotExist(id, InstallLog.class);
}
Wo wo = Wo.copier.copy(installLog);
result.setData(wo);
return result;
}
}
public static class Wo extends InstallLog {
private static final long serialVersionUID = 7332385892650739407L;
static WrapCopier<InstallLog, Wo> copier = WrapCopierFactory.wo(InstallLog.class, Wo.class, null, Wo.FieldsInvisible);
}
}
\ No newline at end of file
package com.x.program.center.jaxrs.market;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.jaxrs.WrapString;
import com.x.program.center.core.entity.InstallLog;
class ActionGetInstalledVersion extends BaseAction {
ActionResult<Wo> execute(EffectivePerson effectivePerson, String id) throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<Wo> result = new ActionResult<>();
InstallLog installLog = emc.find(id, InstallLog.class);
Wo wo = new Wo();
if(installLog==null){
wo.setValue("");
}else{
wo.setValue(installLog.getVersion());
}
result.setData(wo);
return result;
}
}
public static class Wo extends WrapString {
}
}
\ No newline at end of file
......@@ -144,6 +144,7 @@ class ActionInstallOrUpdate extends BaseAction {
.putQuery(x_processplatform_assemble_designer.class,
Applications.joinQueryUri("input", "cover"), obj)
.getData(WoId.class).getId());
obj.setIcon(null);
obj.setApplicationDictList(null);
obj.setFileList(null);
obj.setFormList(null);
......@@ -156,6 +157,7 @@ class ActionInstallOrUpdate extends BaseAction {
.putQuery(x_cms_assemble_control.class,
Applications.joinQueryUri("input", "cover"), obj)
.getData(WoId.class).getId());
obj.setAppIcon(null);
obj.setAppDictList(null);
obj.setCategoryInfoList(null);
obj.setFileList(null);
......@@ -168,6 +170,7 @@ class ActionInstallOrUpdate extends BaseAction {
.putQuery(x_portal_assemble_designer.class,
Applications.joinQueryUri("input", "cover"), obj)
.getData(WoId.class).getId());
obj.setIcon(null);
obj.setFileList(null);
obj.setPageList(null);
obj.setScriptList(null);
......@@ -180,6 +183,7 @@ class ActionInstallOrUpdate extends BaseAction {
.putQuery(x_query_assemble_designer.class,
Applications.joinQueryUri("input", "cover"), obj)
.getData(WoId.class).getId());
obj.setIcon(null);
obj.setRevealList(null);
obj.setViewList(null);
obj.setStatementList(null);
......
......@@ -139,7 +139,7 @@ public class MarketAction extends StandardJaxrsAction {
@Path("list/category")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void installOrUpdate(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request) {
public void listCategory(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request) {
ActionResult<ActionListCategory.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -151,4 +151,40 @@ public class MarketAction extends StandardJaxrsAction {
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "获取指定应用安装记录.", action = ActionGetInstallLog.class)
@GET
@Path("{flag}/install/log")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void getInstallLog(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("应用标识") @PathParam("flag") String flag) {
ActionResult<ActionGetInstallLog.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionGetInstallLog().execute(effectivePerson, flag);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "获取指定应用已安装的版本,返回空表示未安装.", action = ActionGetInstalledVersion.class)
@GET
@Path("{flag}/installed/version")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void getInstalledVersion(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("应用标识") @PathParam("flag") String flag) {
ActionResult<ActionGetInstalledVersion.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionGetInstalledVersion().execute(effectivePerson, flag);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
}
\ No newline at end of file
......@@ -71,7 +71,7 @@ public class InstallLog extends SliceJpaObject {
@FieldDescribe("安装概要内容.")
@Lob
@Basic(fetch = FetchType.EAGER)
@Column(length = JpaObject.length_2K, name = ColumnNamePrefix + data_FIELDNAME)
@Column(length = JpaObject.length_4K, name = ColumnNamePrefix + data_FIELDNAME)
private String data;
public static final String installPerson_FIELDNAME = "installPerson";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册