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
提交
53b8d266
提交
53b8d266
编写于
11月 01, 2018
作者:
minghao.wu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
style: 格式调整
上级
76bc782f
流水线
#342
已通过 于阶段
in 22 second
变更
7
流水线
1
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
33 行增加
和
35 行删除
+33
-35
AnalysisController.java
...e/exam/analysis/server/controller/AnalysisController.java
+11
-18
AntiSpamController.java
...e/exam/analysis/server/controller/AntiSpamController.java
+2
-2
Reply.java
.../pica/cloud/online/exam/analysis/server/entity/Reply.java
+5
-0
AntiSpamServiceImpl.java
...xam/analysis/server/service/impl/AntiSpamServiceImpl.java
+5
-7
CHCAnalysisServiceImpl.java
.../analysis/server/service/impl/CHCAnalysisServiceImpl.java
+4
-3
DateUtils.java
...ca/cloud/online/exam/analysis/server/utils/DateUtils.java
+1
-1
HttpClient4Utils.java
...d/online/exam/analysis/server/utils/HttpClient4Utils.java
+5
-4
未找到文件。
server/src/main/java/com/pica/cloud/online/exam/analysis/server/controller/AnalysisController.java
浏览文件 @
53b8d266
...
@@ -129,9 +129,9 @@ public class AnalysisController {
...
@@ -129,9 +129,9 @@ public class AnalysisController {
t
.
setStatus
(
Transaction
.
SUCCESS
);
t
.
setStatus
(
Transaction
.
SUCCESS
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"getActivityDetail"
,
e
);
t
.
setStatus
(
e
);
t
.
setStatus
(
e
);
Cat
.
logError
(
e
);
Cat
.
logError
(
e
);
e
.
printStackTrace
();
}
}
t
.
complete
();
t
.
complete
();
return
builder
.
build
();
return
builder
.
build
();
...
@@ -157,9 +157,9 @@ public class AnalysisController {
...
@@ -157,9 +157,9 @@ public class AnalysisController {
t
.
setStatus
(
Transaction
.
SUCCESS
);
t
.
setStatus
(
Transaction
.
SUCCESS
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"getPSAActivityDetail"
,
e
);
t
.
setStatus
(
e
);
t
.
setStatus
(
e
);
Cat
.
logError
(
e
);
Cat
.
logError
(
e
);
e
.
printStackTrace
();
}
}
t
.
complete
();
t
.
complete
();
return
builder
.
build
();
return
builder
.
build
();
...
@@ -182,9 +182,9 @@ public class AnalysisController {
...
@@ -182,9 +182,9 @@ public class AnalysisController {
t
.
setStatus
(
Transaction
.
SUCCESS
);
t
.
setStatus
(
Transaction
.
SUCCESS
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"getRoundDetail"
,
e
);
t
.
setStatus
(
e
);
t
.
setStatus
(
e
);
Cat
.
logError
(
e
);
Cat
.
logError
(
e
);
e
.
printStackTrace
();
}
}
t
.
complete
();
t
.
complete
();
...
@@ -250,10 +250,9 @@ public class AnalysisController {
...
@@ -250,10 +250,9 @@ public class AnalysisController {
t
.
setStatus
(
Transaction
.
SUCCESS
);
t
.
setStatus
(
Transaction
.
SUCCESS
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"getReplyList"
,
e
);
t
.
setStatus
(
e
);
t
.
setStatus
(
e
);
Cat
.
logError
(
e
);
Cat
.
logError
(
e
);
e
.
printStackTrace
();
}
}
t
.
complete
();
t
.
complete
();
return
builder
.
build
();
return
builder
.
build
();
...
@@ -311,10 +310,9 @@ public class AnalysisController {
...
@@ -311,10 +310,9 @@ public class AnalysisController {
t
.
setStatus
(
Transaction
.
SUCCESS
);
t
.
setStatus
(
Transaction
.
SUCCESS
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"getReplyDetail"
,
e
);
t
.
setStatus
(
e
);
t
.
setStatus
(
e
);
Cat
.
logError
(
e
);
Cat
.
logError
(
e
);
e
.
printStackTrace
();
}
}
t
.
complete
();
t
.
complete
();
return
builder
.
build
();
return
builder
.
build
();
...
@@ -379,10 +377,9 @@ public class AnalysisController {
...
@@ -379,10 +377,9 @@ public class AnalysisController {
t
.
setStatus
(
Transaction
.
SUCCESS
);
t
.
setStatus
(
Transaction
.
SUCCESS
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"getReplyDetailByExamTitleId"
,
e
);
t
.
setStatus
(
e
);
t
.
setStatus
(
e
);
Cat
.
logError
(
e
);
Cat
.
logError
(
e
);
e
.
printStackTrace
();
}
}
t
.
complete
();
t
.
complete
();
return
builder
.
build
();
return
builder
.
build
();
...
@@ -511,10 +508,9 @@ public class AnalysisController {
...
@@ -511,10 +508,9 @@ public class AnalysisController {
t
.
setStatus
(
Transaction
.
SUCCESS
);
t
.
setStatus
(
Transaction
.
SUCCESS
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"nextReplyList"
,
e
);
t
.
setStatus
(
e
);
t
.
setStatus
(
e
);
Cat
.
logError
(
e
);
Cat
.
logError
(
e
);
e
.
printStackTrace
();
}
}
t
.
complete
();
t
.
complete
();
return
builder
.
build
();
return
builder
.
build
();
...
@@ -574,10 +570,9 @@ public class AnalysisController {
...
@@ -574,10 +570,9 @@ public class AnalysisController {
t
.
setStatus
(
Transaction
.
SUCCESS
);
t
.
setStatus
(
Transaction
.
SUCCESS
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"nextReplyDetail"
,
e
);
t
.
setStatus
(
e
);
t
.
setStatus
(
e
);
Cat
.
logError
(
e
);
Cat
.
logError
(
e
);
e
.
printStackTrace
();
}
}
t
.
complete
();
t
.
complete
();
return
builder
.
build
();
return
builder
.
build
();
...
@@ -615,7 +610,7 @@ public class AnalysisController {
...
@@ -615,7 +610,7 @@ public class AnalysisController {
/**
/**
* 如果判断检测的数据中有垃圾 直接返回
* 如果判断检测的数据中有垃圾 直接返回
*/
*/
PicaResponse
response
=
antiSpamService
.
processString
(
user
!=
null
?
user
.
getId
()
:
0
,
sysCode
,
content
,
false
);
PicaResponse
response
=
antiSpamService
.
processString
(
user
.
getId
()
,
sysCode
,
content
,
false
);
if
(!
response
.
getCode
().
equals
(
PicaResultCode
.
SUCCESS
.
code
()))
{
if
(!
response
.
getCode
().
equals
(
PicaResultCode
.
SUCCESS
.
code
()))
{
response
.
setData
(
""
);
response
.
setData
(
""
);
return
response
;
return
response
;
...
@@ -739,10 +734,9 @@ public class AnalysisController {
...
@@ -739,10 +734,9 @@ public class AnalysisController {
t
.
setStatus
(
Transaction
.
SUCCESS
);
t
.
setStatus
(
Transaction
.
SUCCESS
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"getRoundDetailV2"
,
e
);
t
.
setStatus
(
e
);
t
.
setStatus
(
e
);
Cat
.
logError
(
e
);
Cat
.
logError
(
e
);
e
.
printStackTrace
();
}
}
t
.
complete
();
t
.
complete
();
return
builder
.
build
();
return
builder
.
build
();
...
@@ -813,10 +807,9 @@ public class AnalysisController {
...
@@ -813,10 +807,9 @@ public class AnalysisController {
t
.
setStatus
(
Transaction
.
SUCCESS
);
t
.
setStatus
(
Transaction
.
SUCCESS
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"myStar"
,
e
);
t
.
setStatus
(
e
);
t
.
setStatus
(
e
);
Cat
.
logError
(
e
);
Cat
.
logError
(
e
);
e
.
printStackTrace
();
}
}
t
.
complete
();
t
.
complete
();
return
builder
.
build
();
return
builder
.
build
();
...
...
server/src/main/java/com/pica/cloud/online/exam/analysis/server/controller/AntiSpamController.java
浏览文件 @
53b8d266
...
@@ -58,7 +58,7 @@ public class AntiSpamController {
...
@@ -58,7 +58,7 @@ public class AntiSpamController {
}
}
return
antiSpamService
.
processString
(
return
antiSpamService
.
processString
(
user
!=
null
?
user
.
getId
()
:
0
,
user
.
getId
()
,
sysCode
,
sysCode
,
sbContent
.
toString
(),
sbContent
.
toString
(),
type
!=
0
type
!=
0
...
@@ -88,7 +88,7 @@ public class AntiSpamController {
...
@@ -88,7 +88,7 @@ public class AntiSpamController {
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
PARAM_IS_INVALID
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
PARAM_IS_INVALID
);
}
}
if
(!
antiSpamService
.
processImageContent
(
user
!=
null
?
user
.
getId
()
:
0
,
sysCode
,
sbContent
.
toString
()))
{
if
(!
antiSpamService
.
processImageContent
(
user
.
getId
()
,
sysCode
,
sbContent
.
toString
()))
{
return
ReturnUtil
.
getPicaResponse
(
"400002"
,
"图片包含违禁内容,请修改后重新输入"
,
""
);
return
ReturnUtil
.
getPicaResponse
(
"400002"
,
"图片包含违禁内容,请修改后重新输入"
,
""
);
}
}
...
...
server/src/main/java/com/pica/cloud/online/exam/analysis/server/entity/Reply.java
浏览文件 @
53b8d266
...
@@ -162,4 +162,9 @@ public class Reply {
...
@@ -162,4 +162,9 @@ public class Reply {
return
false
;
return
false
;
return
true
;
return
true
;
}
}
@Override
public
int
hashCode
()
{
return
1
;
}
}
}
\ No newline at end of file
server/src/main/java/com/pica/cloud/online/exam/analysis/server/service/impl/AntiSpamServiceImpl.java
浏览文件 @
53b8d266
...
@@ -77,7 +77,7 @@ public class AntiSpamServiceImpl implements AntiSpamService {
...
@@ -77,7 +77,7 @@ public class AntiSpamServiceImpl implements AntiSpamService {
String
signature
=
SignatureUtils
.
genSignature
(
properties
.
getNeteaseAntispamSecretKey
(),
params
);
String
signature
=
SignatureUtils
.
genSignature
(
properties
.
getNeteaseAntispamSecretKey
(),
params
);
params
.
put
(
"signature"
,
signature
);
params
.
put
(
"signature"
,
signature
);
}
catch
(
UnsupportedEncodingException
e
)
{
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
(
);
logger
.
error
(
"processString"
,
e
);
}
}
/**
/**
...
@@ -115,6 +115,7 @@ public class AntiSpamServiceImpl implements AntiSpamService {
...
@@ -115,6 +115,7 @@ public class AntiSpamServiceImpl implements AntiSpamService {
if
(
action
==
0
)
{
if
(
action
==
0
)
{
insertRecord
(
userId
,
sysCode
,
content
,
response
,
(
byte
)
action
,
0
,
""
);
insertRecord
(
userId
,
sysCode
,
content
,
response
,
(
byte
)
action
,
0
,
""
);
}
else
{
}
else
{
StringBuilder
hint
=
new
StringBuilder
();
for
(
JsonElement
labelElement
:
labelArray
)
{
for
(
JsonElement
labelElement
:
labelArray
)
{
JsonObject
lObject
=
labelElement
.
getAsJsonObject
();
JsonObject
lObject
=
labelElement
.
getAsJsonObject
();
int
label
=
lObject
.
get
(
"label"
).
getAsInt
();
int
label
=
lObject
.
get
(
"label"
).
getAsInt
();
...
@@ -129,7 +130,6 @@ public class AntiSpamServiceImpl implements AntiSpamService {
...
@@ -129,7 +130,6 @@ public class AntiSpamServiceImpl implements AntiSpamService {
else
if
(
label
==
600
)
msg
=
"输入内容包含谩骂词汇,请修改后重新输入"
;
else
if
(
label
==
600
)
msg
=
"输入内容包含谩骂词汇,请修改后重新输入"
;
else
if
(
label
==
700
)
msg
=
"输入内容包含灌水词汇,请修改后重新输入"
;
else
if
(
label
==
700
)
msg
=
"输入内容包含灌水词汇,请修改后重新输入"
;
StringBuilder
hint
=
new
StringBuilder
();
for
(
JsonElement
eleHint
:
hintArray
)
{
for
(
JsonElement
eleHint
:
hintArray
)
{
hint
.
append
(
eleHint
.
getAsString
()).
append
(
","
);
hint
.
append
(
eleHint
.
getAsString
()).
append
(
","
);
}
}
...
@@ -138,15 +138,13 @@ public class AntiSpamServiceImpl implements AntiSpamService {
...
@@ -138,15 +138,13 @@ public class AntiSpamServiceImpl implements AntiSpamService {
}
}
insertRecord
(
userId
,
sysCode
,
content
,
response
,
(
byte
)
action
,
label
,
hint
.
toString
());
insertRecord
(
userId
,
sysCode
,
content
,
response
,
(
byte
)
action
,
label
,
hint
.
toString
());
return
ReturnUtil
.
getPicaResponse
(
"400002"
,
msg
,
hint
.
toString
())
;
break
;
}
}
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
DATA_IS_WRONG
.
code
(),
msg
,
hint
.
toString
());
}
}
}
else
{
}
else
{
return
ReturnUtil
.
getPicaResponse
(
jObject
.
get
(
"code"
).
getAsString
(),
msg
,
""
);
return
ReturnUtil
.
getPicaResponse
(
jObject
.
get
(
"code"
).
getAsString
(),
msg
,
""
);
}
}
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SUCCESS
,
""
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SUCCESS
,
""
);
}
}
...
@@ -212,7 +210,7 @@ public class AntiSpamServiceImpl implements AntiSpamService {
...
@@ -212,7 +210,7 @@ public class AntiSpamServiceImpl implements AntiSpamService {
String
signature
=
SignatureUtils
.
genSignature
(
properties
.
getNeteaseAntispamSecretKey
(),
params
);
String
signature
=
SignatureUtils
.
genSignature
(
properties
.
getNeteaseAntispamSecretKey
(),
params
);
params
.
put
(
"signature"
,
signature
);
params
.
put
(
"signature"
,
signature
);
}
catch
(
UnsupportedEncodingException
e
)
{
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
(
);
logger
.
error
(
"processImage"
,
e
);
}
}
/**
/**
...
...
server/src/main/java/com/pica/cloud/online/exam/analysis/server/service/impl/CHCAnalysisServiceImpl.java
浏览文件 @
53b8d266
package
com
.
pica
.
cloud
.
online
.
exam
.
analysis
.
server
.
service
.
impl
;
package
com
.
pica
.
cloud
.
online
.
exam
.
analysis
.
server
.
service
.
impl
;
import
com.pica.cloud.online.exam.analysis.common.CommonUtils
;
import
com.pica.cloud.online.exam.analysis.common.constants.CommonConstants
;
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.configuration.PropertiesConfiguration
;
import
com.pica.cloud.online.exam.analysis.server.configuration.PropertiesConfiguration
;
import
com.pica.cloud.online.exam.analysis.server.entity.*
;
import
com.pica.cloud.online.exam.analysis.server.entity.*
;
...
@@ -9,6 +7,8 @@ import com.pica.cloud.online.exam.analysis.server.mapper.*;
...
@@ -9,6 +7,8 @@ import com.pica.cloud.online.exam.analysis.server.mapper.*;
import
com.pica.cloud.online.exam.analysis.server.service.CHCAnalysisService
;
import
com.pica.cloud.online.exam.analysis.server.service.CHCAnalysisService
;
import
com.pica.cloud.online.exam.analysis.server.utils.DateUtils
;
import
com.pica.cloud.online.exam.analysis.server.utils.DateUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -22,6 +22,7 @@ import java.util.*;
...
@@ -22,6 +22,7 @@ import java.util.*;
@Service
@Service
public
class
CHCAnalysisServiceImpl
implements
CHCAnalysisService
{
public
class
CHCAnalysisServiceImpl
implements
CHCAnalysisService
{
static
final
String
[]
OPTIONS
=
{
"A"
,
"B"
,
"C"
,
"D"
,
"E"
,
"F"
,
"G"
,
"H"
};
static
final
String
[]
OPTIONS
=
{
"A"
,
"B"
,
"C"
,
"D"
,
"E"
,
"F"
,
"G"
,
"H"
};
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
CHCAnalysisServiceImpl
.
class
);
@Autowired
@Autowired
CHCAnalysisMapper
analysisMapper
;
CHCAnalysisMapper
analysisMapper
;
...
@@ -261,7 +262,7 @@ public class CHCAnalysisServiceImpl implements CHCAnalysisService {
...
@@ -261,7 +262,7 @@ public class CHCAnalysisServiceImpl implements CHCAnalysisService {
*/
*/
replyDtoList
.
add
(
getReplyDtoByReply
(
reply
,
userId
));
replyDtoList
.
add
(
getReplyDtoByReply
(
reply
,
userId
));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
logger
.
error
(
"getReplyListDtoByExamTitleId"
,
e
);
}
}
}
}
...
...
server/src/main/java/com/pica/cloud/online/exam/analysis/server/utils/DateUtils.java
浏览文件 @
53b8d266
...
@@ -14,7 +14,7 @@ public class DateUtils {
...
@@ -14,7 +14,7 @@ public class DateUtils {
private
static
final
long
ONE_DAY
=
86400
;
private
static
final
long
ONE_DAY
=
86400
;
private
static
final
long
THREE_DAY
=
259200
;
private
static
final
long
THREE_DAY
=
259200
;
public
static
Calendar
calendar
=
Calendar
.
getInstance
();
public
static
final
Calendar
calendar
=
Calendar
.
getInstance
();
public
static
String
fromNow
(
Date
date
)
{
public
static
String
fromNow
(
Date
date
)
{
calendar
.
setTime
(
date
);
calendar
.
setTime
(
date
);
...
...
server/src/main/java/com/pica/cloud/online/exam/analysis/server/utils/HttpClient4Utils.java
浏览文件 @
53b8d266
...
@@ -11,6 +11,8 @@ import org.apache.http.impl.client.HttpClients;
...
@@ -11,6 +11,8 @@ import org.apache.http.impl.client.HttpClients;
import
org.apache.http.impl.conn.PoolingHttpClientConnectionManager
;
import
org.apache.http.impl.conn.PoolingHttpClientConnectionManager
;
import
org.apache.http.message.BasicNameValuePair
;
import
org.apache.http.message.BasicNameValuePair
;
import
org.apache.http.util.EntityUtils
;
import
org.apache.http.util.EntityUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.nio.charset.Charset
;
import
java.nio.charset.Charset
;
...
@@ -24,6 +26,7 @@ import java.util.Map;
...
@@ -24,6 +26,7 @@ import java.util.Map;
* @date 2018/8/23 15:44
* @date 2018/8/23 15:44
*/
*/
public
class
HttpClient4Utils
{
public
class
HttpClient4Utils
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
HttpClient4Utils
.
class
);
/**
/**
* 实例化HttpClient
* 实例化HttpClient
* @param maxTotal
* @param maxTotal
...
@@ -71,15 +74,13 @@ public class HttpClient4Utils {
...
@@ -71,15 +74,13 @@ public class HttpClient4Utils {
response
=
(
CloseableHttpResponse
)
httpClient
.
execute
(
httpPost
);
response
=
(
CloseableHttpResponse
)
httpClient
.
execute
(
httpPost
);
resp
=
EntityUtils
.
toString
(
response
.
getEntity
(),
encoding
);
resp
=
EntityUtils
.
toString
(
response
.
getEntity
(),
encoding
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
// log
logger
.
error
(
"sendPost"
,
e
);
e
.
printStackTrace
();
}
finally
{
}
finally
{
if
(
response
!=
null
)
{
if
(
response
!=
null
)
{
try
{
try
{
response
.
close
();
response
.
close
();
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
// log
logger
.
error
(
"sendPost"
,
e
);
e
.
printStackTrace
();
}
}
}
}
}
}
...
...
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录