Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ghsby
o2oa
提交
c86d8e4f
o2oa
项目概览
ghsby
/
o2oa
落后 Fork 源项目 2880 个版本
Fork自
浙江兰德纵横网络技术股份有限公司 / o2oa
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
o2oa
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c86d8e4f
编写于
5月 05, 2022
作者:
O
o2sword
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
新版应用市场开发3
上级
1705a242
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
237 addition
and
0 deletion
+237
-0
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/market/ActionInstallOffline.java
...m/x/program/center/jaxrs/market/ActionInstallOffline.java
+2
-0
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/market/ActionInstallOrUpdate.java
.../x/program/center/jaxrs/market/ActionInstallOrUpdate.java
+2
-0
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/market/ActionListByCategoryPaging.java
...ogram/center/jaxrs/market/ActionListByCategoryPaging.java
+100
-0
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/market/ActionTopThree.java
...ava/com/x/program/center/jaxrs/market/ActionTopThree.java
+96
-0
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/market/MarketAction.java
.../java/com/x/program/center/jaxrs/market/MarketAction.java
+37
-0
未找到文件。
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/market/ActionInstallOffline.java
浏览文件 @
c86d8e4f
...
...
@@ -4,6 +4,7 @@ import com.x.base.core.container.EntityManagerContainer;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.entity.enums.CommonStatus
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.cache.CacheManager
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
...
...
@@ -56,6 +57,7 @@ class ActionInstallOffline extends BaseAction {
emc
.
persist
(
installLog
);
}
emc
.
commit
();
CacheManager
.
notify
(
InstallLog
.
class
);
}
result
.
setData
(
wo
);
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/market/ActionInstallOrUpdate.java
浏览文件 @
c86d8e4f
...
...
@@ -5,6 +5,7 @@ import com.x.base.core.container.factory.EntityManagerContainerFactory;
import
com.x.base.core.entity.enums.CommonStatus
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.bean.NameValuePair
;
import
com.x.base.core.project.cache.CacheManager
;
import
com.x.base.core.project.config.Collect
;
import
com.x.base.core.project.config.Config
;
import
com.x.base.core.project.connection.ActionResponse
;
...
...
@@ -82,6 +83,7 @@ class ActionInstallOrUpdate extends BaseAction {
emc
.
persist
(
installLog
);
}
emc
.
commit
();
CacheManager
.
notify
(
InstallLog
.
class
);
}
result
.
setData
(
wo
);
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/market/ActionListByCategoryPaging.java
0 → 100644
浏览文件 @
c86d8e4f
package
com.x.program.center.jaxrs.market
;
import
com.google.gson.JsonObject
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.entity.enums.CommonStatus
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.bean.NameValuePair
;
import
com.x.base.core.project.cache.Cache
;
import
com.x.base.core.project.cache.CacheManager
;
import
com.x.base.core.project.config.Collect
;
import
com.x.base.core.project.config.Config
;
import
com.x.base.core.project.connection.ActionResponse
;
import
com.x.base.core.project.connection.ConnectionAction
;
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.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.program.center.Business
;
import
com.x.program.center.core.entity.InstallLog
;
import
org.apache.commons.lang3.StringUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Optional
;
class
ActionListByCategoryPaging
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionListByCategoryPaging
.
class
);
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
Integer
page
,
Integer
size
,
String
category
)
throws
Exception
{
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
List
<
Wo
>
wos
=
new
ArrayList
<>();
Cache
.
CacheKey
cacheKey
=
new
Cache
.
CacheKey
(
ActionListByCategoryPaging
.
class
,
page
,
size
,
category
);
Optional
<?>
optional
=
CacheManager
.
get
(
cacheCategory
,
cacheKey
);
if
(
optional
.
isPresent
())
{
wos
=
(
List
<
Wo
>)
optional
.
get
();
}
else
{
String
token
=
Business
.
loginCollect
();
if
(
StringUtils
.
isNotEmpty
(
token
))
{
try
{
JsonObject
jsonObject
=
new
JsonObject
();
jsonObject
.
addProperty
(
"orderBy"
,
"createTime"
);
jsonObject
.
addProperty
(
"isAsc"
,
Boolean
.
FALSE
);
if
(!
EMPTY_SYMBOL
.
equals
(
category
)){
jsonObject
.
addProperty
(
"category"
,
category
);
}
jsonObject
.
addProperty
(
"status"
,
"publish"
);
String
url
=
StringUtils
.
replaceEach
(
COLLECT_MARKET_LIST_INFO
,
new
String
[]{
"{page}"
,
"{size}"
},
new
String
[]{
String
.
valueOf
(
page
),
String
.
valueOf
(
size
)});
ActionResponse
response
=
ConnectionAction
.
post
(
Config
.
collect
().
url
(
url
),
ListTools
.
toList
(
new
NameValuePair
(
Collect
.
COLLECT_TOKEN
,
token
)),
jsonObject
);
wos
=
response
.
getDataAsList
(
Wo
.
class
);
result
.
setCount
(
response
.
getCount
());
}
catch
(
Exception
e
)
{
logger
.
warn
(
"list market form o2cloud error: {}."
,
e
.
getMessage
());
}
}
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
for
(
Wo
wo
:
wos
)
{
InstallLog
installLog
=
emc
.
find
(
wo
.
getId
(),
InstallLog
.
class
);
if
(
installLog
!=
null
&&
CommonStatus
.
VALID
.
getValue
().
equals
(
installLog
.
getStatus
()))
{
wo
.
setInstalledVersion
(
installLog
.
getVersion
());
}
else
{
wo
.
setInstalledVersion
(
""
);
}
}
}
if
(
ListTools
.
isNotEmpty
(
wos
)){
CacheManager
.
put
(
cacheCategory
,
cacheKey
,
wos
);
}
}
result
.
setData
(
wos
);
return
result
;
}
public
static
class
Wo
extends
Application2
{
@FieldDescribe
(
"已安装的版本,空表示未安装"
)
private
String
installedVersion
;
public
String
getInstalledVersion
()
{
return
installedVersion
;
}
public
void
setInstalledVersion
(
String
installedVersion
)
{
this
.
installedVersion
=
installedVersion
;
}
}
}
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/market/ActionTopThree.java
0 → 100644
浏览文件 @
c86d8e4f
package
com.x.program.center.jaxrs.market
;
import
com.google.gson.JsonObject
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.entity.enums.CommonStatus
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.bean.NameValuePair
;
import
com.x.base.core.project.cache.Cache
;
import
com.x.base.core.project.cache.CacheManager
;
import
com.x.base.core.project.config.Collect
;
import
com.x.base.core.project.config.Config
;
import
com.x.base.core.project.connection.ActionResponse
;
import
com.x.base.core.project.connection.ConnectionAction
;
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.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.program.center.Business
;
import
com.x.program.center.core.entity.InstallLog
;
import
org.apache.commons.lang3.StringUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Optional
;
class
ActionTopThree
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionTopThree
.
class
);
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
)
throws
Exception
{
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
List
<
Wo
>
wos
=
new
ArrayList
<>();
Cache
.
CacheKey
cacheKey
=
new
Cache
.
CacheKey
(
ActionTopThree
.
class
);
Optional
<?>
optional
=
CacheManager
.
get
(
cacheCategory
,
cacheKey
);
if
(
optional
.
isPresent
())
{
wos
=
(
List
<
Wo
>)
optional
.
get
();
}
else
{
String
token
=
Business
.
loginCollect
();
if
(
StringUtils
.
isNotEmpty
(
token
))
{
try
{
JsonObject
jsonObject
=
new
JsonObject
();
jsonObject
.
addProperty
(
"orderBy"
,
"recommend"
);
jsonObject
.
addProperty
(
"isAsc"
,
Boolean
.
TRUE
);
jsonObject
.
addProperty
(
"status"
,
"publish"
);
String
url
=
StringUtils
.
replaceEach
(
COLLECT_MARKET_LIST_INFO
,
new
String
[]{
"{page}"
,
"{size}"
},
new
String
[]{
"1"
,
"3"
});
ActionResponse
response
=
ConnectionAction
.
post
(
Config
.
collect
().
url
(
url
),
ListTools
.
toList
(
new
NameValuePair
(
Collect
.
COLLECT_TOKEN
,
token
)),
jsonObject
);
wos
=
response
.
getDataAsList
(
Wo
.
class
);
result
.
setCount
(
response
.
getCount
());
}
catch
(
Exception
e
)
{
logger
.
warn
(
"list market form o2cloud error: {}."
,
e
.
getMessage
());
}
}
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
for
(
Wo
wo
:
wos
)
{
InstallLog
installLog
=
emc
.
find
(
wo
.
getId
(),
InstallLog
.
class
);
if
(
installLog
!=
null
&&
CommonStatus
.
VALID
.
getValue
().
equals
(
installLog
.
getStatus
()))
{
wo
.
setInstalledVersion
(
installLog
.
getVersion
());
}
else
{
wo
.
setInstalledVersion
(
""
);
}
}
}
if
(
ListTools
.
isNotEmpty
(
wos
)){
CacheManager
.
put
(
cacheCategory
,
cacheKey
,
wos
);
}
}
result
.
setData
(
wos
);
return
result
;
}
public
static
class
Wo
extends
Application2
{
@FieldDescribe
(
"已安装的版本,空表示未安装"
)
private
String
installedVersion
;
public
String
getInstalledVersion
()
{
return
installedVersion
;
}
public
void
setInstalledVersion
(
String
installedVersion
)
{
this
.
installedVersion
=
installedVersion
;
}
}
}
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/market/MarketAction.java
浏览文件 @
c86d8e4f
...
...
@@ -47,6 +47,26 @@ public class MarketAction extends StandardJaxrsAction {
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
,
jsonElement
));
}
@JaxrsMethodDescribe
(
value
=
"根据分类查找应用应用."
,
action
=
ActionListByCategoryPaging
.
class
)
@GET
@Path
(
"list/paging/{page}/size/{size}/category/{category}"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
listByCategoryPaging
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"分页"
)
@PathParam
(
"page"
)
Integer
page
,
@JaxrsParameterDescribe
(
"每页数量"
)
@PathParam
(
"size"
)
Integer
size
,
@JaxrsParameterDescribe
(
"分类((0)表示全部分类)"
)
@PathParam
(
"category"
)
String
category
)
{
ActionResult
<
List
<
ActionListByCategoryPaging
.
Wo
>>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionListByCategoryPaging
().
execute
(
effectivePerson
,
page
,
size
,
category
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"获取对象."
,
action
=
ActionGet
.
class
)
@GET
@Path
(
"{flag}"
)
...
...
@@ -137,6 +157,23 @@ public class MarketAction extends StandardJaxrsAction {
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"列示推荐的3个应用."
,
action
=
ActionTopThree
.
class
)
@GET
@Path
(
"list/top/three"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
listTopThree
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
)
{
ActionResult
<
List
<
ActionTopThree
.
Wo
>>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionTopThree
().
execute
(
effectivePerson
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"获取指定应用安装记录."
,
action
=
ActionGetInstallLog
.
class
)
@GET
@Path
(
"{flag}/install/log"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录