提交 5f62dcd8 编写于 作者: O o2sword

新版应用市场优化1

上级 d817b468
......@@ -64,7 +64,7 @@ class ActionInstallOrUpdate extends BaseAction {
if(BooleanUtils.isTrue(Config.collect().getEnable())) {
String token = business.loginCollect();
if(StringUtils.isNotEmpty(token)){
byte[] bytes = ConnectionAction.getFile(Config.collect().url(Collect.ADDRESS_COLLECT_APPLICATION_DOWN),
byte[] bytes = ConnectionAction.getFile(Config.collect().url(Collect.ADDRESS_COLLECT_APPLICATION_DOWN + "/" + id),
ListTools.toList(new NameValuePair(Collect.COLLECT_TOKEN, token)));
if(bytes!=null){
WrapModule module = this.install(bytes);
......
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.WrapStringList;
import com.x.program.center.core.entity.Application;
import com.x.program.center.core.entity.Application_;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;
import java.util.List;
class ActionListCategory extends BaseAction {
ActionResult<Wo> execute(EffectivePerson effectivePerson) throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<Wo> result = new ActionResult<>();
EntityManager em = emc.get(Application.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<Application> root = cq.from(Application.class);
cq.select(root.get(Application_.category)).distinct(true);
List<String> categoryList = em.createQuery(cq).getResultList();
Wo wo = new Wo();
wo.setValueList(categoryList);
result.setData(wo);
return result;
}
}
public static class Wo extends WrapStringList {
}
}
\ No newline at end of file
......@@ -134,4 +134,21 @@ public class MarketAction extends StandardJaxrsAction {
asyncResponse.resume(ResponseFactory.getDefaultActionResultResponse(result));
}
@JaxrsMethodDescribe(value = "列示所有的应用类型.", action = ActionListCategory.class)
@GET
@Path("list/category")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void installOrUpdate(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request) {
ActionResult<ActionListCategory.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionListCategory().execute(effectivePerson);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册