Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
sc_media
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
注册表
注册表
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
svn
sc_media
Commits
a387f194
提交
a387f194
authored
10月 09, 2019
作者:
renjiancai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
上级
041a636a
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
97 行增加
和
19 行删除
+97
-19
ArticleLibraryController.java
...ource/bg/controller/content/ArticleLibraryController.java
+61
-9
ArticleLibraryMapper.java
...source/bg/mapper/articlelibrary/ArticleLibraryMapper.java
+3
-0
UserAccountRelationMapper.java
...qx/resource/bg/mapper/user/UserAccountRelationMapper.java
+1
-1
ResourceLibrarySerivceImpl.java
...g/service/resourcelibrary/ResourceLibrarySerivceImpl.java
+32
-9
没有找到文件。
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/controller/content/ArticleLibraryController.java
浏览文件 @
a387f194
package
com
.
zrqx
.
resource
.
bg
.
controller
.
content
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
java.io.IOException
;
import
java.io.UnsupportedEncodingException
;
import
java.text.ParseException
;
...
...
@@ -27,8 +24,6 @@ import org.springframework.web.bind.annotation.RequestBody;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
tk.mybatis.mapper.entity.Example.Criteria
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
...
...
@@ -57,6 +52,10 @@ import com.zrqx.resource.bg.service.resourcelibrary.ResourceLibraryService;
import
com.zrqx.resource.bg.service.user.UserAccountRelationService
;
import
com.zrqx.resource.commons.Redis
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
tk.mybatis.mapper.entity.Example.Criteria
;
/**
* 内容管理Controller
*/
...
...
@@ -72,8 +71,6 @@ public class ArticleLibraryController {
private
ArticleRelationService
articleRelationService
;
@Autowired
private
UserAccountRelationService
userAccountRelationService
;
@Autowired
private
Redis
redis
;
@ApiOperation
(
value
=
"新增"
,
notes
=
"新增一个"
)
@PostMapping
(
value
=
ResourceRequestPath
.
SAVE
)
...
...
@@ -107,8 +104,8 @@ public class ArticleLibraryController {
res
.
setObjectId
(
entity
.
getId
());
articleRelationService
.
delete
(
res
);
}
//添加图片素材
if
(
form
.
getResourceType
().
equals
(
2
)){
//添加图片
/视频
素材
if
(
form
.
getResourceType
().
equals
(
2
)
||
form
.
getResourceType
().
equals
(
3
)
){
resourceService
.
saveOrUpdate
(
form
);
}
//添加资源和用户关联信息
...
...
@@ -418,6 +415,9 @@ public class ArticleLibraryController {
}
else
if
(
form
.
getResourceType
().
equals
(
2
)){
//发布图组内容
tencentAtlas
(
library
,
user
,
form
);
}
else
if
(
form
.
getResourceType
().
equals
(
2
)){
//发布视频内容
tencentVideo
(
library
,
user
,
form
);
}
}
else
if
(
form
.
getOriginal_author
().
get
(
i
).
equals
(
"2"
)){
//微信公众号
//上传图文消息内的图片获取URL
...
...
@@ -611,6 +611,58 @@ public class ArticleLibraryController {
articleService
.
updateByPrimaryKeySelective
(
library
);
return
CallBack
.
success
();
}
private
CallBack
<
String
>
tencentVideo
(
ArticleLibrary
library
,
UserAccountRelation
user
,
ContetPublishForm
form
)
throws
ParseException
{
JSONObject
jsonobj_token
=
null
;
jsonobj_token
=
JSON
.
parseObject
(
user
.
getAccess_token
());
String
token
=
jsonobj_token
.
getJSONObject
(
"data"
).
getString
(
"access_token"
);
//获取用户id
String
openid
=
jsonobj_token
.
getJSONObject
(
"data"
).
getString
(
"openid"
);
JSONArray
ja
=
JSON
.
parseArray
(
library
.
getText
());
String
[]
cmds
=
{
"curl"
,
"-H"
,
"Content-Type: application/x-www-form-urlencoded; charset=utf-8"
,
"-F"
,
"media=@"
+
library
.
getCover
()+
""
,
"access_token="
+
token
+
"&title="
+
library
.
getTitle
()+
""
+
"&tags="
+
library
.
getTags
()+
"&cat="
+
library
.
getCover_type
()+
"&md5="
+
12
+
"&desc="
+
library
.
getText
()+
""
,
"\"http://api.om.qq.com/articlev2/clientpubvid"
};
String
excute
=
HttpClientUtil
.
execCurl
(
cmds
);
JSONObject
jsonobj_aid
=
JSON
.
parseObject
(
excute
);
//成功结果:{"code":"0","msg": "success","data": {"transaction_id":TRANSACTION_ID,"article_id":article_id //企鹅媒体平台内容唯一id }}
String
transaction_id
=
jsonobj_aid
.
getJSONObject
(
"data"
).
getString
(
"transaction_id"
);
//上传视频封面
String
param_res
=
"access_token="
+
token
+
"&transaction_id="
+
transaction_id
;
String
url_res
=
"https://api.om.qq.com/transaction/infoclient?"
+
param_res
;
String
status
=
HttpClientUtil
.
doGet
(
url_res
,
"utf-8"
);
JSONObject
jsonobj_status
=
JSON
.
parseObject
(
status
);
//获取审核状态
String
article_Status
=
jsonobj_status
.
getJSONObject
(
"data"
).
getJSONObject
(
"article_info"
).
getString
(
"article_pub_flag"
);
//获取发布时间
String
pub_time
=
jsonobj_status
.
getJSONObject
(
"data"
).
getJSONObject
(
"article_info"
).
getString
(
"article_pub_time"
);
//获取发布内容id
String
article_id
=
jsonobj_status
.
getJSONObject
(
"data"
).
getJSONObject
(
"article_info"
).
getString
(
"article_id"
);
Criteria
criteria
=
articleRelationService
.
createCriteria
();
criteria
.
andEqualTo
(
"objectId"
,
library
.
getId
());
criteria
.
andEqualTo
(
"original_author"
,
1
);
ArticleRelation
res
=
articleRelationService
.
selectOneByCriteria
();
if
(
article_Status
!=
null
&&
article_Status
!=
""
){
if
(
article_Status
.
equals
(
"发布成功"
)){
res
.
setExamineStatus
(
1
);
}
else
if
(
article_Status
.
equals
(
"审核中"
)){
res
.
setReason
(
"内容审核中"
);
res
.
setExamineStatus
(
0
);
}
else
if
(
article_Status
.
contains
(
"审核未通过"
)){
res
.
setExamineStatus
(
2
);
res
.
setReason
(
"内容不符合平台规范提示"
);
}
else
if
(
article_Status
.
equals
(
"未发布"
)){
res
.
setReason
(
"内容不符合平台规范提示"
);
res
.
setExamineStatus
(
6
);
}
res
.
setArticle_id
(
article_id
);
articleRelationService
.
updateByCriteriaSelective
(
res
);
}
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
library
.
setExamineTime
(
sdf
.
parse
(
pub_time
));
library
.
setPublishStatus
(
1
);
articleService
.
updateByPrimaryKeySelective
(
library
);
return
CallBack
.
success
();
}
/***
* 获取企鹅号,查看发布文章状态
* @param access_token
...
...
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/mapper/articlelibrary/ArticleLibraryMapper.java
浏览文件 @
a387f194
...
...
@@ -47,6 +47,9 @@ public interface ArticleLibraryMapper extends BaseMapper<ArticleLibrary> {
+
"<if test='form.publishStatus != null'>"
+
" and a.publishStatus = #{form.publishStatus}"
+
"</if>"
+
"<if test='form.resourceType != null'>"
+
" and a.resourceType = #{form.resourceType}"
+
"</if>"
+
"</script>"
)
List
<
ArticleLibraryListVO
>
query
(
@Param
(
"form"
)
QueryArticleLibraryForm
form
);
/**
...
...
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/mapper/user/UserAccountRelationMapper.java
浏览文件 @
a387f194
...
...
@@ -25,7 +25,7 @@ public interface UserAccountRelationMapper extends BaseMapper<UserAccountRelatio
+
"</script>"
)
Integer
countByfav
();
@Select
(
"<script>"
+
"SELECT count(share) from user_account_relation "
+
"SELECT count(share
s
) from user_account_relation "
+
"</script>"
)
Integer
countByShare
();
@Select
(
"<script>"
...
...
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/service/resourcelibrary/ResourceLibrarySerivceImpl.java
浏览文件 @
a387f194
...
...
@@ -36,20 +36,43 @@ public class ResourceLibrarySerivceImpl extends BaseServiceImpl<ResourceLibrary,
public
boolean
saveOrUpdate
(
SaveUpdateArticleLibraryForm
form
)
throws
ParseException
{
List
<
ResourceLibrary
>
list
=
new
ArrayList
<
ResourceLibrary
>();
if
(
form
.
getText
()!=
null
){
String
[]
text
=
form
.
getText
().
split
(
","
);
for
(
String
str
:
text
)
{
//添加图片
if
(
form
.
getResourceType
().
equals
(
2
))
{
String
[]
text
=
form
.
getText
().
split
(
","
);
for
(
String
str
:
text
)
{
ResourceLibrary
res
=
new
ResourceLibrary
();
JSONObject
jsonObject
=
JSON
.
parseObject
(
str
);
String
image
=
jsonObject
.
getString
(
"image"
);
String
desc
=
jsonObject
.
getString
(
"desc"
);
res
.
setTitle
(
form
.
getTitle
());
if
(
form
.
getResourceType
().
equals
(
2
))
{
res
.
setResourceType
(
1
);
}
res
.
setPath
(
image
);
res
.
setIntro
(
desc
);
res
.
setIsDelete
(
0
);
res
.
setUploadTime
(
new
Date
());
res
.
setSize
(
form
.
getSize
());
list
.
add
(
res
);
}
resourceMapper
.
insertUuidList
(
list
);
}
if
(
form
.
getResourceType
().
equals
(
3
))
{
ResourceLibrary
res
=
new
ResourceLibrary
();
JSONObject
jsonObject
=
JSON
.
parseObject
(
str
);
String
image
=
jsonObject
.
getString
(
"image"
);
String
desc
=
jsonObject
.
getString
(
"desc"
);
res
.
setTitle
(
form
.
getTitle
());
res
.
setPath
(
image
);
res
.
setIntro
(
desc
);
if
(
form
.
getResourceType
().
equals
(
3
))
{
res
.
setResourceType
(
2
);
}
res
.
setPath
(
form
.
getCover
());
res
.
setIntro
(
form
.
getText
());
res
.
setUploadTime
(
new
Date
());
res
.
setSize
(
form
.
getSize
());
res
.
setTimeLength
(
form
.
getTimeLength
());
res
.
setIsDelete
(
0
);
list
.
add
(
res
);
resourceMapper
.
insert
(
res
);
}
}
resourceMapper
.
insertUuidList
(
list
);
return
true
;
}
/**
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论