Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
P
pica-cloud-analysis
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
Close sidebar
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
com.pica.cloud.online.exam
pica-cloud-analysis
提交
e4fec645
提交
e4fec645
编写于
12月 28, 2018
作者:
minghao.wu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: controller->service
上级
901372ef
流水线
#3083
已通过 于阶段
in 10 second
变更
5
流水线
1
展开全部
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
501 行增加
和
863 行删除
+501
-863
AnalysisController.java
...e/exam/analysis/server/controller/AnalysisController.java
+38
-576
AntiSpamController.java
...e/exam/analysis/server/controller/AntiSpamController.java
+16
-45
CHCAnalysisService.java
...line/exam/analysis/server/service/CHCAnalysisService.java
+55
-141
CHCAnalysisServiceImpl.java
.../analysis/server/service/impl/CHCAnalysisServiceImpl.java
+391
-100
bootstrap-dev.properties
server/src/main/resources/bootstrap-dev.properties
+1
-1
未找到文件。
server/src/main/java/com/pica/cloud/online/exam/analysis/server/controller/AnalysisController.java
浏览文件 @
e4fec645
此差异已折叠。
点击以展开。
server/src/main/java/com/pica/cloud/online/exam/analysis/server/controller/AntiSpamController.java
浏览文件 @
e4fec645
...
@@ -9,8 +9,8 @@ import com.pica.cloud.foundation.utils.controller.BaseController;
...
@@ -9,8 +9,8 @@ import com.pica.cloud.foundation.utils.controller.BaseController;
import
com.pica.cloud.foundation.utils.entity.PicaUser
;
import
com.pica.cloud.foundation.utils.entity.PicaUser
;
import
com.pica.cloud.online.exam.analysis.common.util.ReturnUtil
;
import
com.pica.cloud.online.exam.analysis.common.util.ReturnUtil
;
import
com.pica.cloud.online.exam.analysis.server.service.AntiSpamService
;
import
com.pica.cloud.online.exam.analysis.server.service.AntiSpamService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.tuple.Pair
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -36,31 +36,16 @@ public class AntiSpamController extends BaseController {
...
@@ -36,31 +36,16 @@ public class AntiSpamController extends BaseController {
@RequestHeader
String
sysCode
,
@RequestHeader
String
sysCode
,
@RequestHeader
String
token
)
{
@RequestHeader
String
token
)
{
PicaUser
user
=
fetchPicaUser
();
PicaUser
user
=
fetchPicaUser
();
if
(
user
==
null
||
user
.
getId
().
intValue
()
==
0
)
{
Pair
<
String
,
Integer
>
params
;
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
LOGIN_FAILE
);
}
StringBuilder
sbContent
=
new
StringBuilder
();
/**
* type:0 不检测广告 其他: 检测广告, 默认不检测
*/
Integer
type
=
0
;
try
{
try
{
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
content
);
params
=
parseContentAndType
(
content
);
sbContent
.
append
(
jsonObject
.
get
(
"content"
).
toString
());
type
=
(
jsonObject
.
get
(
"type"
)
!=
null
?
Integer
.
parseInt
(
jsonObject
.
get
(
"type"
).
toString
())
:
0
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
PARAM_IS_INVALID
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
PARAM_IS_INVALID
);
}
}
return
antiSpamService
.
processString
(
user
.
getId
(),
sysCode
,
params
.
getLeft
(),
params
.
getRight
()
!=
0
);
return
antiSpamService
.
processString
(
user
.
getId
(),
sysCode
,
sbContent
.
toString
(),
type
!=
0
);
}
}
@LoginPermission
@ApiOperation
(
value
=
"内容检测"
,
response
=
PicaResponse
.
class
)
@ApiOperation
(
value
=
"内容检测"
,
response
=
PicaResponse
.
class
)
@RequestMapping
(
value
=
"/text/v1"
,
method
=
RequestMethod
.
POST
,
produces
=
"application/json;charset=UTF-8"
)
@RequestMapping
(
value
=
"/text/v1"
,
method
=
RequestMethod
.
POST
,
produces
=
"application/json;charset=UTF-8"
)
public
PicaResponse
processTextV1
(
@RequestBody
String
content
,
public
PicaResponse
processTextV1
(
@RequestBody
String
content
,
...
@@ -69,35 +54,21 @@ public class AntiSpamController extends BaseController {
...
@@ -69,35 +54,21 @@ public class AntiSpamController extends BaseController {
return
processText
(
content
,
sysCode
,
token
);
return
processText
(
content
,
sysCode
,
token
);
}
}
@LoginPermission
@ApiOperation
(
value
=
"内容检测"
,
response
=
PicaResponse
.
class
)
@ApiOperation
(
value
=
"内容检测"
,
response
=
PicaResponse
.
class
)
@RequestMapping
(
value
=
"/text/v2"
,
method
=
RequestMethod
.
POST
,
produces
=
"application/json;charset=UTF-8"
)
@RequestMapping
(
value
=
"/text/v2"
,
method
=
RequestMethod
.
POST
,
produces
=
"application/json;charset=UTF-8"
)
public
PicaResponse
processTextV2
(
@RequestBody
String
content
,
public
PicaResponse
processTextV2
(
@RequestBody
String
content
,
@RequestHeader
String
sysCode
,
@RequestHeader
String
sysCode
,
@RequestHeader
String
token
)
{
@RequestHeader
String
token
)
{
PicaUser
user
=
fetchPicaUser
();
PicaUser
user
=
fetchPicaUser
();
if
(
user
==
null
||
user
.
getId
().
intValue
()
==
0
)
{
Pair
<
String
,
Integer
>
params
;
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
LOGIN_FAILE
);
}
StringBuilder
sbContent
=
new
StringBuilder
();
/**
* type:0 不检测广告 其他: 检测广告, 默认不检测
*/
Integer
type
=
0
;
try
{
try
{
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
content
);
params
=
parseContentAndType
(
content
);
sbContent
.
append
(
jsonObject
.
get
(
"content"
).
toString
());
type
=
(
jsonObject
.
get
(
"type"
)
!=
null
?
Integer
.
parseInt
(
jsonObject
.
get
(
"type"
).
toString
())
:
0
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
PARAM_IS_INVALID
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
PARAM_IS_INVALID
);
}
}
return
antiSpamService
.
processStringV2
(
return
antiSpamService
.
processStringV2
(
user
.
getId
(),
sysCode
,
params
.
getLeft
(),
params
.
getRight
()
!=
0
);
user
.
getId
(),
sysCode
,
sbContent
.
toString
(),
type
!=
0
);
}
}
@LoginPermission
@LoginPermission
...
@@ -106,14 +77,7 @@ public class AntiSpamController extends BaseController {
...
@@ -106,14 +77,7 @@ public class AntiSpamController extends BaseController {
public
PicaResponse
processImage
(
@RequestBody
String
content
,
public
PicaResponse
processImage
(
@RequestBody
String
content
,
@RequestHeader
String
sysCode
,
@RequestHeader
String
sysCode
,
@RequestHeader
String
token
)
{
@RequestHeader
String
token
)
{
if
(
token
==
null
)
{
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_NO_TOKEN
);
}
PicaUser
user
=
fetchPicaUser
();
PicaUser
user
=
fetchPicaUser
();
if
(
user
==
null
||
user
.
getId
().
intValue
()
==
0
)
{
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
LOGIN_FAILE
);
}
StringBuilder
sbContent
=
new
StringBuilder
();
StringBuilder
sbContent
=
new
StringBuilder
();
try
{
try
{
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
content
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
content
);
...
@@ -128,4 +92,11 @@ public class AntiSpamController extends BaseController {
...
@@ -128,4 +92,11 @@ public class AntiSpamController extends BaseController {
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SUCCESS
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SUCCESS
);
}
}
public
Pair
<
String
,
Integer
>
parseContentAndType
(
String
content
)
{
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
content
);
return
Pair
.
of
(
jsonObject
.
get
(
"content"
).
toString
(),
jsonObject
.
get
(
"type"
)
!=
null
?
Integer
.
parseInt
(
jsonObject
.
get
(
"type"
).
toString
())
:
0
);
}
}
}
server/src/main/java/com/pica/cloud/online/exam/analysis/server/service/CHCAnalysisService.java
浏览文件 @
e4fec645
package
com
.
pica
.
cloud
.
online
.
exam
.
analysis
.
server
.
service
;
package
com
.
pica
.
cloud
.
online
.
exam
.
analysis
.
server
.
service
;
import
com.pica.cloud.foundation.entity.PicaResponse
;
import
com.pica.cloud.foundation.utils.entity.PicaUser
;
import
com.pica.cloud.foundation.utils.entity.PicaUser
;
import
com.pica.cloud.online.exam.analysis.common.dto.*
;
import
com.pica.cloud.online.exam.analysis.common.dto.*
;
import
com.pica.cloud.online.exam.analysis.server.entity.AnalysisRound
;
import
com.pica.cloud.online.exam.analysis.server.entity.AnalysisRound
;
import
com.pica.cloud.online.exam.analysis.server.entity.AnalysisRoundExamTitle
;
import
com.pica.cloud.online.exam.analysis.server.entity.AnalysisRoundExamTitle
;
import
com.pica.cloud.online.exam.analysis.server.entity.CHCAnalysis
;
import
com.pica.cloud.online.exam.analysis.server.entity.CHCAnalysis
;
import
com.pica.cloud.online.exam.analysis.server.entity.Reply
;
import
com.pica.cloud.online.exam.analysis.server.entity.Reply
;
import
io.swagger.models.auth.In
;
import
org.omg.CORBA.INTERNAL
;
import
org.omg.CORBA.INTERNAL
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Optional
;
/**
/**
* @author wuminghao
* @author wuminghao
...
@@ -17,198 +20,109 @@ import java.util.List;
...
@@ -17,198 +20,109 @@ import java.util.List;
public
interface
CHCAnalysisService
{
public
interface
CHCAnalysisService
{
/**
/**
* 获取消息详情
* 获取CHC活动详情
* @param analysisId
* @param analysisId 活动id
* @param user
* @return
* @return
*/
*/
CHCAnalysisDto
getActivityDetail
(
Integer
analysisId
,
PicaUser
user
);
CHCAnalysisDto
get
CHC
ActivityDetail
(
Integer
analysisId
,
PicaUser
user
);
/**
/**
*
根据活动id获取
活动详情
*
获取PSA
活动详情
* @param analysisId
* @param analysisId
活动id
* @return
* @return
*/
*/
CHCAnalysis
getAnalysisById
(
Integer
analysisId
);
CHCAnalysis
Dto
getPSAActivityDetail
(
Integer
analysisId
);
/**
/**
*
根据活动id获取活动
详情
*
获取轮
详情
* @param
analysisI
d
* @param
roundId 轮i
d
* @return
* @return
*/
*/
CHCAnalysisDto
getCHCAnalysisDtoById
(
Integer
analysis
Id
);
RoundExamTitleDto
getRoundDetail
(
Integer
round
Id
);
/**
/**
* 根据活动id获取活动详情
* 获取轮详情V2
* @param analysisId
* @return
*/
CHCAnalysisDto
getPSAAnalysisDtoById
(
Integer
analysisId
);
/**
* 根据活动id获取活动的轮数
* @param analysisId
* @return
*/
List
<
AnalysisRoundDto
>
getRoundListByAnalysisId
(
Integer
analysisId
);
/**
* 根据轮的id获取信息
* @param roundId
* @return
*/
RoundExamTitleDto
getRoundExamTitleDtoById
(
Integer
roundId
);
/**
* 根据轮的id获取信息
* @param roundId
* @return
*/
AnalysisRound
getRoundInfoById
(
Integer
roundId
);
/**
* 根据轮的id获取题目信息
* @param roundId
* @param roundId
* @return
* @return
*/
*/
List
<
ExamTitleDto
>
getExamTitleListByRoundId
(
Integer
roundId
);
RoundExamTitleV2Dto
getRoundDetailV2
(
Integer
roundId
);
/**
* 获取当前的活动-轮-题目关联表
* @param analysisRoundExamTitleId
* @return
*/
AnalysisRoundExamTitle
getAnanlysisRoundExamTitleById
(
Integer
analysisRoundExamTitleId
);
/**
* 获取考题信息
* @param analysisRoundExamTitleId
* @return
*/
ExamTitleDto
getExamTitleDtoById
(
Integer
analysisRoundExamTitleId
);
/**
/**
* 获取当前题目的下一题目
* 获取题目的回复列表
* @param roundId 当前轮的id
* @param analysisRoundExamTitleId 当前题目的id
* @return 下一题目的id
*/
ExamTitleDto
getNextExamTitleDtoById
(
Integer
roundId
,
Integer
analysisRoundExamTitleId
);
/**
* 根据题目id获取回复信息
* @param analysisRoundExamTitleId
* @param userId
* @return
*/
List
<
ReplyDto
>
getReplyListDtoByExamTitleId
(
Integer
analysisRoundExamTitleId
,
Integer
userId
);
/**
* 根据id获取reply
* @param replyId
* @return
*/
Reply
getReplyById
(
Integer
replyId
);
/**
* 根据id获取下一条reply
* @param replyId
* @return
*/
Reply
getNextReplyById
(
Integer
replyId
);
/**
* 根据reply获取replydto
* @param reply
* @param userId
* @return
*/
ReplyDto
getReplyDtoByReply
(
Reply
reply
,
Integer
userId
);
/**
* 插入点赞记录
* @param analysisId
* @param roundId
* @param examTitleId
* @param examTitleId
* @param
replyId
* @param
user
* @return
* @return
*/
*/
Integer
insertStarRecord
(
Integer
analysisId
,
Integer
roundId
,
Integer
examTitleId
,
Integer
replyId
,
Integer
userId
);
ExamTitleReplyDto
getReplyListByExamTitleId
(
Integer
examTitleId
,
PicaUser
user
);
/**
/**
* 取消点赞记录
* 获取下一题的回复列表
* @param replyId
* @param userId
* @return
*/
Integer
removeStarRecord
(
Integer
replyId
,
Integer
userId
);
/**
* 增加解析
* @param examTitleId
* @param content
* @param userId
* @return
*/
Integer
insertReply
(
Integer
examTitleId
,
String
content
,
Integer
userId
);
/**
* 获取我的评论状态
* @param examTitleId
* @param examTitleId
* @param user
Id
* @param user
* @return
* @return
*/
*/
Integer
getReplyStatus
(
Integer
examTitleId
,
Integer
userId
);
ExamTitleReplyDto
getNextReplyListByExamTitleId
(
Integer
examTitleId
,
PicaUser
user
);
/**
/**
* 获取
我的评论
详情
* 获取
回复的
详情
* @param
examTitleI
d
* @param
replyId 回复i
d
* @param user
Id
* @param user
用户
* @return
* @return
*/
*/
Reply
getReplyByExamTitleId
(
Integer
examTitleId
,
Integer
userId
);
ExamTitleReplyDetailDto
getReplyDetailByReplyId
(
Integer
replyId
,
PicaUser
user
);
/**
/**
* 根据考试id获取评论列表
* 获取下一回复的详情
* @param examTitleId
* @param replyId
* @param user
* @return
* @return
*/
*/
List
<
Reply
>
getReplyList
(
Integer
examTitleId
);
ExamTitleReplyDetailDto
getNextReplyDetailByReplyId
(
Integer
replyId
,
PicaUser
user
);
/**
/**
* 获取所有的历史轮详情
* 获取回复的详情
* @param analysisId
* @param examTitleId 题目id
* @param user 用户
* @return
* @return
*/
*/
List
<
AnalysisRoundDto
>
getCHCHistoryRound
(
Integer
analysisId
);
ExamTitleReplyDetailDto
getReplyDetailByExamTitleId
(
Integer
examTitleId
,
PicaUser
user
);
/**
/**
* 获取某一轮的最多得票数
* 点赞
* @param roundId
* @param user 用户
* @param analysisId 活动id
* @param roundId 轮id
* @param examTitleId 题目id
* @param replyId 回复id
* @return
* @return
*/
*/
Integer
getElectedStarCountByRoundId
(
Integer
round
Id
);
PicaResponse
starReply
(
PicaUser
user
,
Integer
analysisId
,
Integer
roundId
,
Integer
examTitleId
,
Integer
reply
Id
);
/**
/**
* 获取被选中的医生id
* 解析/回复某一个题目
* @param roundId
* @param user 用户
* @param sysCode
* @param examTitleId 题目
* @param content 内容
* @param isAdFilterOpen 广告检测
* @return
* @return
*/
*/
Integer
getElectedDoctorIdByRoundId
(
Integer
roundId
);
PicaResponse
reply
(
PicaUser
user
,
String
sysCode
,
Integer
examTitleId
,
String
content
,
Boolean
isAdFilterOpen
);
/**
/**
*
根据医生id和轮id获取得赞数
*
获取我的赞
* @param
roundId
* @param
user 用户
* @param
doctorI
d
* @param
roundId 某轮的i
d
* @return
* @return
*/
*/
Integer
getStarCountByRoundIdAndDoctorId
(
Integer
roundId
,
Integer
doctor
Id
);
MyStarDto
myStar
(
PicaUser
user
,
Optional
<
Integer
>
round
Id
);
/**
/**
*
根据医生id和轮id获取得赞记录
*
取消点赞
* @param r
oundI
d
* @param r
eplyId 活动i
d
* @param
doctorId
* @param
user 用户
* @return
* @return
*/
*/
List
<
UserExamTitleDto
>
getMyStarRecordByRoundIdAndDoctorId
(
Integer
roundId
,
Integer
doctorId
);
Integer
removeStarRecord
(
Integer
replyId
,
PicaUser
user
);
}
}
server/src/main/java/com/pica/cloud/online/exam/analysis/server/service/impl/CHCAnalysisServiceImpl.java
浏览文件 @
e4fec645
此差异已折叠。
点击以展开。
server/src/main/resources/bootstrap-dev.properties
浏览文件 @
e4fec645
server.port
=
10902
server.port
=
10902
server.context-path
=
/analysis
server.context-path
=
/analysis
spring.application.name
=
${server.port}-pica-cloud-analysis
spring.application.name
=
${server.port}-pica-cloud-analysis
_local
#config server settings
#config server settings
spring.cloud.config.name
=
com.pica.cloud.online.exam
spring.cloud.config.name
=
com.pica.cloud.online.exam
...
...
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录