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
提交
3050b4a7
提交
3050b4a7
编写于
9月 19, 2018
作者:
minghao.wu
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev_phase3' into release
上级
7bcf9152
da4f87e5
变更
12
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
69 行增加
和
157 行删除
+69
-157
pom.xml
common/pom.xml
+1
-1
CommonUtils.java
...m/pica/cloud/online/exam/analysis.common/CommonUtils.java
+5
-5
pom.xml
pom.xml
+1
-1
pom.xml
server/pom.xml
+14
-2
AnalysisController.java
...e/exam/analysis/server/controller/AnalysisController.java
+32
-26
AntiSpamController.java
...e/exam/analysis/server/controller/AntiSpamController.java
+5
-3
AntiSpamServiceImpl.java
...xam/analysis/server/service/impl/AntiSpamServiceImpl.java
+7
-4
bootstrap-dev.properties
server/src/main/resources/bootstrap-dev.properties
+1
-1
bootstrap-prod.properties
server/src/main/resources/bootstrap-prod.properties
+1
-1
bootstrap-test1.properties
server/src/main/resources/bootstrap-test1.properties
+1
-1
bootstrap-uat.properties
server/src/main/resources/bootstrap-uat.properties
+1
-1
logback.xml
server/src/main/resources/logback.xml
+0
-111
未找到文件。
common/pom.xml
浏览文件 @
3050b4a7
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
<groupId>
com.pica.cloud.online.exam
</groupId>
<groupId>
com.pica.cloud.online.exam
</groupId>
<artifactId>
pica-cloud-analysis-common
</artifactId>
<artifactId>
pica-cloud-analysis-common
</artifactId>
<name>
pica-cloud-analysis-common
</name>
<name>
pica-cloud-analysis-common
</name>
<version>
1.
0.9
</version>
<version>
1.
1.0
</version>
<packaging>
jar
</packaging>
<packaging>
jar
</packaging>
<properties>
<properties>
...
...
common/src/main/java/com/pica/cloud/online/exam/analysis.common/CommonUtils.java
浏览文件 @
3050b4a7
...
@@ -2,7 +2,7 @@ package com.pica.cloud.online.exam.analysis.common;
...
@@ -2,7 +2,7 @@ package com.pica.cloud.online.exam.analysis.common;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.pica.cloud.foundation.redis.RedisClient
;
import
com.pica.cloud.foundation.redis.RedisClient
;
import
com.pica.cloud.foundation.utils.entity.P
ICA
User
;
import
com.pica.cloud.foundation.utils.entity.P
ica
User
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -19,15 +19,15 @@ public class CommonUtils {
...
@@ -19,15 +19,15 @@ public class CommonUtils {
* @param map
* @param map
* @return
* @return
*/
*/
public
static
P
ICA
User
getUser
(
Map
<
String
,
String
>
map
)
{
public
static
P
ica
User
getUser
(
Map
<
String
,
String
>
map
)
{
if
(
map
.
isEmpty
())
{
if
(
map
.
isEmpty
())
{
return
null
;
return
null
;
}
}
return
JSON
.
parseObject
(
JSON
.
toJSONString
(
map
),
P
ICA
User
.
class
);
return
JSON
.
parseObject
(
JSON
.
toJSONString
(
map
),
P
ica
User
.
class
);
}
}
public
static
P
ICA
User
getUserByToken
(
RedisClient
client
,
String
token
)
{
public
static
P
ica
User
getUserByToken
(
RedisClient
client
,
String
token
)
{
P
ICA
User
picaUser
=
null
;
P
ica
User
picaUser
=
null
;
try
{
try
{
picaUser
=
CommonUtils
.
getUser
(
client
.
getToken
(
token
));
picaUser
=
CommonUtils
.
getUser
(
client
.
getToken
(
token
));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
pom.xml
浏览文件 @
3050b4a7
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
<dependency>
<dependency>
<groupId>
com.pica.cloud.foundation
</groupId>
<groupId>
com.pica.cloud.foundation
</groupId>
<artifactId>
pica-cloud-utils
</artifactId>
<artifactId>
pica-cloud-utils
</artifactId>
<version>
1.0.
5
-SNAPSHOT
</version>
<version>
1.0.
7
-SNAPSHOT
</version>
<scope>
compile
</scope>
<scope>
compile
</scope>
</dependency>
</dependency>
</dependencies>
</dependencies>
...
...
server/pom.xml
浏览文件 @
3050b4a7
...
@@ -28,10 +28,22 @@
...
@@ -28,10 +28,22 @@
<dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-actuator
</artifactId>
<artifactId>
spring-boot-starter-actuator
</artifactId>
<exclusions>
<exclusion>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-logging
</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
<artifactId>
spring-boot-starter-web
</artifactId>
<exclusions>
<exclusion>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-logging
</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.mybatis.spring.boot
</groupId>
<groupId>
org.mybatis.spring.boot
</groupId>
...
@@ -138,14 +150,14 @@
...
@@ -138,14 +150,14 @@
<dependency>
<dependency>
<groupId>
com.pica.cloud.online.exam
</groupId>
<groupId>
com.pica.cloud.online.exam
</groupId>
<artifactId>
pica-cloud-analysis-common
</artifactId>
<artifactId>
pica-cloud-analysis-common
</artifactId>
<version>
1.
0.9
</version>
<version>
1.
1.0
</version>
<scope>
compile
</scope>
<scope>
compile
</scope>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.pica.cloud.foundation
</groupId>
<groupId>
com.pica.cloud.foundation
</groupId>
<artifactId>
pica-cloud-utils
</artifactId>
<artifactId>
pica-cloud-utils
</artifactId>
<version>
1.0.
6
-SNAPSHOT
</version>
<version>
1.0.
7
-SNAPSHOT
</version>
</dependency>
</dependency>
</dependencies>
</dependencies>
...
...
server/src/main/java/com/pica/cloud/online/exam/analysis/server/controller/AnalysisController.java
浏览文件 @
3050b4a7
...
@@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSONObject;
...
@@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import
com.pica.cloud.foundation.entity.PicaResponse
;
import
com.pica.cloud.foundation.entity.PicaResponse
;
import
com.pica.cloud.foundation.entity.PicaResultCode
;
import
com.pica.cloud.foundation.entity.PicaResultCode
;
import
com.pica.cloud.foundation.redis.RedisClient
;
import
com.pica.cloud.foundation.redis.RedisClient
;
import
com.pica.cloud.foundation.utils.entity.P
ICA
User
;
import
com.pica.cloud.foundation.utils.entity.P
ica
User
;
import
com.pica.cloud.online.exam.analysis.common.CommonUtils
;
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.constants.CommonConstants
;
import
com.pica.cloud.online.exam.analysis.common.dto.*
;
import
com.pica.cloud.online.exam.analysis.common.dto.*
;
...
@@ -21,6 +21,8 @@ import io.swagger.annotations.Api;
...
@@ -21,6 +21,8 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
javassist.bytecode.ExceptionsAttribute
;
import
javassist.bytecode.ExceptionsAttribute
;
import
org.omg.CORBA.INTERNAL
;
import
org.omg.CORBA.INTERNAL
;
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.cloud.client.loadbalancer.LoadBalancerClient
;
import
org.springframework.cloud.client.loadbalancer.LoadBalancerClient
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -38,6 +40,8 @@ import java.util.List;
...
@@ -38,6 +40,8 @@ import java.util.List;
@RequestMapping
(
"/"
)
@RequestMapping
(
"/"
)
@Api
(
value
=
"题目分析接口"
,
description
=
"查看活动及详情,用户点赞、医生回复"
)
@Api
(
value
=
"题目分析接口"
,
description
=
"查看活动及详情,用户点赞、医生回复"
)
public
class
AnalysisController
{
public
class
AnalysisController
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
AnalysisController
.
class
);
@Autowired
@Autowired
private
RedisClient
redisClient
;
private
RedisClient
redisClient
;
...
@@ -88,7 +92,7 @@ public class AnalysisController {
...
@@ -88,7 +92,7 @@ public class AnalysisController {
try
{
try
{
CHCAnalysisDto
analysisDto
=
analysisService
.
getCHCAnalysisDtoById
(
id
);
CHCAnalysisDto
analysisDto
=
analysisService
.
getCHCAnalysisDtoById
(
id
);
P
ICA
User
user
=
null
;
P
ica
User
user
=
null
;
if
(
token
!=
null
)
{
if
(
token
!=
null
)
{
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
...
@@ -145,7 +149,7 @@ public class AnalysisController {
...
@@ -145,7 +149,7 @@ public class AnalysisController {
@ApiOperation
(
value
=
"获取某一轮的题目"
,
response
=
PicaResponse
.
class
)
@ApiOperation
(
value
=
"获取某一轮的题目"
,
response
=
PicaResponse
.
class
)
@RequestMapping
(
value
=
"/roundDetail/{roundId}"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
@RequestMapping
(
value
=
"/roundDetail/{roundId}"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
public
PicaResponse
<
RoundExamTitleDto
>
getRoundDetail
(
@PathVariable
(
"roundId"
)
Integer
roundId
)
{
public
PicaResponse
<
RoundExamTitleDto
>
getRoundDetail
(
@PathVariable
(
"roundId"
)
Integer
roundId
)
{
System
.
out
.
println
(
"roundDetail: roundId"
+
roundId
);
logger
.
info
(
"roundDetail: roundId"
+
roundId
);
PicaResponse
.
Builder
<
RoundExamTitleDto
>
builder
=
new
PicaResponse
.
Builder
<>();
PicaResponse
.
Builder
<
RoundExamTitleDto
>
builder
=
new
PicaResponse
.
Builder
<>();
...
@@ -167,7 +171,7 @@ public class AnalysisController {
...
@@ -167,7 +171,7 @@ public class AnalysisController {
@RequestMapping
(
value
=
"/replyList/{examTitleId}"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
@RequestMapping
(
value
=
"/replyList/{examTitleId}"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
public
PicaResponse
<
ExamTitleReplyDto
>
getReplyList
(
@PathVariable
(
"examTitleId"
)
Integer
examTitleId
,
public
PicaResponse
<
ExamTitleReplyDto
>
getReplyList
(
@PathVariable
(
"examTitleId"
)
Integer
examTitleId
,
@RequestHeader
(
required
=
false
)
String
token
)
{
@RequestHeader
(
required
=
false
)
String
token
)
{
P
ICA
User
user
=
null
;
P
ica
User
user
=
null
;
if
(
token
!=
null
)
{
if
(
token
!=
null
)
{
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
...
@@ -230,7 +234,7 @@ public class AnalysisController {
...
@@ -230,7 +234,7 @@ public class AnalysisController {
@RequestMapping
(
value
=
"/replyDetail/{replyId}"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
@RequestMapping
(
value
=
"/replyDetail/{replyId}"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
public
PicaResponse
<
ExamTitleReplyDetailDto
>
getReplyDetail
(
@PathVariable
(
"replyId"
)
Integer
replyId
,
public
PicaResponse
<
ExamTitleReplyDetailDto
>
getReplyDetail
(
@PathVariable
(
"replyId"
)
Integer
replyId
,
@RequestHeader
(
required
=
false
)
String
token
)
{
@RequestHeader
(
required
=
false
)
String
token
)
{
P
ICA
User
user
=
null
;
P
ica
User
user
=
null
;
if
(
token
!=
null
)
{
if
(
token
!=
null
)
{
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
...
@@ -286,8 +290,8 @@ public class AnalysisController {
...
@@ -286,8 +290,8 @@ public class AnalysisController {
@RequestMapping
(
value
=
"/replyDetailByExamTitleId/{examTitleId}"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
@RequestMapping
(
value
=
"/replyDetailByExamTitleId/{examTitleId}"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
public
PicaResponse
<
ExamTitleReplyDetailDto
>
getReplyDetailByExamTitleId
(
@PathVariable
(
"examTitleId"
)
Integer
examTitleId
,
public
PicaResponse
<
ExamTitleReplyDetailDto
>
getReplyDetailByExamTitleId
(
@PathVariable
(
"examTitleId"
)
Integer
examTitleId
,
@RequestHeader
(
required
=
false
)
String
token
)
{
@RequestHeader
(
required
=
false
)
String
token
)
{
System
.
out
.
println
(
"replyDetailByExamTitleId: examTitleId == "
+
examTitleId
.
toString
()
+
", token="
+
token
);
logger
.
info
(
"replyDetailByExamTitleId: examTitleId == "
+
examTitleId
.
toString
()
+
", token="
+
token
);
P
ICA
User
user
=
null
;
P
ica
User
user
=
null
;
if
(
token
!=
null
)
{
if
(
token
!=
null
)
{
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
...
@@ -351,17 +355,17 @@ public class AnalysisController {
...
@@ -351,17 +355,17 @@ public class AnalysisController {
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_NO_TOKEN
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_NO_TOKEN
);
}
}
P
ICA
User
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
P
ica
User
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
if
(
user
==
null
||
user
.
getId
().
intValue
()
==
0
)
{
if
(
user
==
null
||
user
.
getId
().
intValue
()
==
0
)
{
System
.
out
.
println
(
"starrecord: user == null, token="
+
token
);
logger
.
info
(
"starrecord: user == null, token="
+
token
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
LOGIN_FAILE
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
LOGIN_FAILE
);
}
}
Doctor
doctor
=
doctorService
.
getDoctorById
(
user
.
getId
());
Doctor
doctor
=
doctorService
.
getDoctorById
(
user
.
getId
());
if
(
doctor
==
null
)
{
if
(
doctor
==
null
)
{
System
.
out
.
println
(
"starrecord: doctor == null, userid="
+
user
.
getId
().
toString
());
logger
.
info
(
"starrecord: doctor == null, userid="
+
user
.
getId
().
toString
());
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_INVALID_TOKEN
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_INVALID_TOKEN
);
}
}
...
@@ -374,7 +378,7 @@ public class AnalysisController {
...
@@ -374,7 +378,7 @@ public class AnalysisController {
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
INTERFACE_FORBID_VISIT
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
INTERFACE_FORBID_VISIT
);
}
}
System
.
out
.
println
(
"starrecord: replyid="
+
replyId
.
toString
()
+
" token="
+
token
+
" roundId="
+
roundId
+
" examTitleId="
+
examTitleId
);
logger
.
info
(
"starrecord: replyid="
+
replyId
.
toString
()
+
" token="
+
token
+
" roundId="
+
roundId
+
" examTitleId="
+
examTitleId
);
AnalysisRound
analysisRound
=
analysisService
.
getRoundInfoById
(
roundId
);
AnalysisRound
analysisRound
=
analysisService
.
getRoundInfoById
(
roundId
);
if
((
new
Date
()).
getTime
()
>
analysisRound
.
getEndTime
().
getTime
())
{
if
((
new
Date
()).
getTime
()
>
analysisRound
.
getEndTime
().
getTime
())
{
...
@@ -398,14 +402,14 @@ public class AnalysisController {
...
@@ -398,14 +402,14 @@ public class AnalysisController {
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_NO_TOKEN
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_NO_TOKEN
);
}
}
P
ICA
User
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
P
ica
User
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
if
(
user
==
null
||
user
.
getId
().
intValue
()
==
0
)
{
if
(
user
==
null
||
user
.
getId
().
intValue
()
==
0
)
{
System
.
out
.
println
(
"cancelStar: user == null, token="
+
token
);
logger
.
info
(
"cancelStar: user == null, token="
+
token
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
LOGIN_FAILE
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
LOGIN_FAILE
);
}
}
System
.
out
.
println
(
"cancelStar: replyid="
+
replyId
.
toString
()
+
" token="
+
token
);
logger
.
info
(
"cancelStar: replyid="
+
replyId
.
toString
()
+
" token="
+
token
);
if
(
0
!=
analysisService
.
removeStarRecord
(
replyId
,
user
.
getId
()))
{
if
(
0
!=
analysisService
.
removeStarRecord
(
replyId
,
user
.
getId
()))
{
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
RESULE_DATA_NONE
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
RESULE_DATA_NONE
);
...
@@ -419,7 +423,7 @@ public class AnalysisController {
...
@@ -419,7 +423,7 @@ public class AnalysisController {
public
PicaResponse
<
ExamTitleReplyDto
>
nextReplyList
(
@PathVariable
(
"examTitleId"
)
Integer
examTitleId
,
public
PicaResponse
<
ExamTitleReplyDto
>
nextReplyList
(
@PathVariable
(
"examTitleId"
)
Integer
examTitleId
,
@RequestHeader
(
required
=
false
)
String
token
)
{
@RequestHeader
(
required
=
false
)
String
token
)
{
P
ICA
User
user
=
null
;
P
ica
User
user
=
null
;
if
(
token
!=
null
)
{
if
(
token
!=
null
)
{
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
...
@@ -473,7 +477,7 @@ public class AnalysisController {
...
@@ -473,7 +477,7 @@ public class AnalysisController {
public
PicaResponse
<
ExamTitleReplyDto
>
nextReplyDetail
(
@PathVariable
(
"replyId"
)
Integer
replyId
,
public
PicaResponse
<
ExamTitleReplyDto
>
nextReplyDetail
(
@PathVariable
(
"replyId"
)
Integer
replyId
,
@RequestHeader
(
required
=
false
)
String
token
)
{
@RequestHeader
(
required
=
false
)
String
token
)
{
P
ICA
User
user
=
null
;
P
ica
User
user
=
null
;
if
(
token
!=
null
)
{
if
(
token
!=
null
)
{
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
...
@@ -537,10 +541,10 @@ public class AnalysisController {
...
@@ -537,10 +541,10 @@ public class AnalysisController {
return
picaResponse
;
return
picaResponse
;
}
}
P
ICA
User
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
P
ica
User
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
if
(
user
==
null
||
user
.
getId
().
intValue
()
==
0
)
{
if
(
user
==
null
||
user
.
getId
().
intValue
()
==
0
)
{
System
.
out
.
println
(
"reply: user == null, token="
+
token
);
logger
.
info
(
"reply: user == null, token="
+
token
);
PicaResponse
picaResponse
=
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
LOGIN_FAILE
);
PicaResponse
picaResponse
=
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
LOGIN_FAILE
);
picaResponse
.
setData
(
""
);
picaResponse
.
setData
(
""
);
return
picaResponse
;
return
picaResponse
;
...
@@ -550,7 +554,7 @@ public class AnalysisController {
...
@@ -550,7 +554,7 @@ public class AnalysisController {
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
content
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
content
);
content
=
jsonObject
.
get
(
"content"
).
toString
();
content
=
jsonObject
.
get
(
"content"
).
toString
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"parse error: "
+
content
);
logger
.
info
(
"parse error: "
+
content
);
}
}
/**
/**
...
@@ -615,7 +619,7 @@ public class AnalysisController {
...
@@ -615,7 +619,7 @@ public class AnalysisController {
@ApiOperation
(
value
=
"获取某一轮的题目V2"
,
response
=
PicaResponse
.
class
)
@ApiOperation
(
value
=
"获取某一轮的题目V2"
,
response
=
PicaResponse
.
class
)
@RequestMapping
(
value
=
"/roundDetail/v2/{roundId}"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
@RequestMapping
(
value
=
"/roundDetail/v2/{roundId}"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
public
PicaResponse
<
RoundExamTitleV2Dto
>
getRoundDetailV2
(
@PathVariable
(
value
=
"roundId"
)
Integer
roundId
)
{
public
PicaResponse
<
RoundExamTitleV2Dto
>
getRoundDetailV2
(
@PathVariable
(
value
=
"roundId"
)
Integer
roundId
)
{
System
.
out
.
println
(
"roundDetail: roundId"
+
roundId
);
logger
.
info
(
"roundDetail: roundId"
+
roundId
);
PicaResponse
.
Builder
<
RoundExamTitleV2Dto
>
builder
=
new
PicaResponse
.
Builder
<>();
PicaResponse
.
Builder
<
RoundExamTitleV2Dto
>
builder
=
new
PicaResponse
.
Builder
<>();
try
{
try
{
...
@@ -629,9 +633,11 @@ public class AnalysisController {
...
@@ -629,9 +633,11 @@ public class AnalysisController {
List
<
AnalysisRoundDto
>
roundDtoList
=
analysisService
.
getCHCHistoryRound
(
CHC_ANALYSIS_ID
);
List
<
AnalysisRoundDto
>
roundDtoList
=
analysisService
.
getCHCHistoryRound
(
CHC_ANALYSIS_ID
);
/**
/**
* 获取list中
第
一个的roundId
* 获取list中
最后
一个的roundId
*/
*/
roundId
=
roundDtoList
.
get
(
0
).
getRoundId
();
if
(
roundDtoList
.
size
()
>
0
)
{
roundId
=
roundDtoList
.
get
(
roundDtoList
.
size
()
-
1
).
getRoundId
();
}
roundExamTitleV2Dto
.
setRoundList
(
roundDtoList
);
roundExamTitleV2Dto
.
setRoundList
(
roundDtoList
);
}
}
...
@@ -656,7 +662,7 @@ public class AnalysisController {
...
@@ -656,7 +662,7 @@ public class AnalysisController {
roundExamTitleV2Dto
.
setElectedStarCount
(
analysisService
.
getElectedStarCountByRoundId
(
roundId
));
roundExamTitleV2Dto
.
setElectedStarCount
(
analysisService
.
getElectedStarCountByRoundId
(
roundId
));
Integer
doctorId
=
analysisService
.
getElectedDoctorIdByRoundId
(
roundId
);
Integer
doctorId
=
analysisService
.
getElectedDoctorIdByRoundId
(
roundId
);
roundExamTitleV2Dto
.
setElectedDoctor
(
doctor
Service
.
getDoctorDtoById
(
doctorId
)
);
roundExamTitleV2Dto
.
setElectedDoctor
(
doctor
Id
!=
null
?
doctorService
.
getDoctorDtoById
(
doctorId
)
:
new
DoctorDto
()
);
}
else
{
}
else
{
roundExamTitleV2Dto
.
setRemainingTime
(
DateUtils
.
remainingTime
(
sdf
.
parse
(
roundExamTitleDto
.
getEndTime
())));
roundExamTitleV2Dto
.
setRemainingTime
(
DateUtils
.
remainingTime
(
sdf
.
parse
(
roundExamTitleDto
.
getEndTime
())));
roundExamTitleV2Dto
.
setIsFinished
(
0
);
roundExamTitleV2Dto
.
setIsFinished
(
0
);
...
@@ -681,9 +687,9 @@ public class AnalysisController {
...
@@ -681,9 +687,9 @@ public class AnalysisController {
if
(
token
==
null
)
{
if
(
token
==
null
)
{
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_NO_TOKEN
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_NO_TOKEN
);
}
}
P
ICA
User
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
P
ica
User
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
if
(
user
==
null
||
user
.
getId
().
intValue
()
==
0
)
{
if
(
user
==
null
||
user
.
getId
().
intValue
()
==
0
)
{
System
.
out
.
println
(
"myStar: user == null, token="
+
token
);
logger
.
info
(
"myStar: user == null, token="
+
token
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
LOGIN_FAILE
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
LOGIN_FAILE
);
}
}
...
@@ -695,7 +701,7 @@ public class AnalysisController {
...
@@ -695,7 +701,7 @@ public class AnalysisController {
}
}
*/
*/
if
(
roundId
!=
null
)
if
(
roundId
!=
null
)
System
.
out
.
println
(
"myStar: roundId="
+
roundId
.
toString
()
+
" token="
+
token
);
logger
.
info
(
"myStar: roundId="
+
roundId
.
toString
()
+
" token="
+
token
);
PicaResponse
.
Builder
<
MyStarDto
>
builder
=
new
PicaResponse
.
Builder
<>();
PicaResponse
.
Builder
<
MyStarDto
>
builder
=
new
PicaResponse
.
Builder
<>();
...
...
server/src/main/java/com/pica/cloud/online/exam/analysis/server/controller/AntiSpamController.java
浏览文件 @
3050b4a7
...
@@ -4,12 +4,14 @@ import com.alibaba.fastjson.JSONObject;
...
@@ -4,12 +4,14 @@ import com.alibaba.fastjson.JSONObject;
import
com.pica.cloud.foundation.entity.PicaResponse
;
import
com.pica.cloud.foundation.entity.PicaResponse
;
import
com.pica.cloud.foundation.entity.PicaResultCode
;
import
com.pica.cloud.foundation.entity.PicaResultCode
;
import
com.pica.cloud.foundation.redis.RedisClient
;
import
com.pica.cloud.foundation.redis.RedisClient
;
import
com.pica.cloud.foundation.utils.entity.P
ICA
User
;
import
com.pica.cloud.foundation.utils.entity.P
ica
User
;
import
com.pica.cloud.online.exam.analysis.common.CommonUtils
;
import
com.pica.cloud.online.exam.analysis.common.CommonUtils
;
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.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
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.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -36,7 +38,7 @@ public class AntiSpamController {
...
@@ -36,7 +38,7 @@ public class AntiSpamController {
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_NO_TOKEN
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_NO_TOKEN
);
}
}
P
ICA
User
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
P
ica
User
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
if
(
user
==
null
||
user
.
getId
().
intValue
()
==
0
)
{
if
(
user
==
null
||
user
.
getId
().
intValue
()
==
0
)
{
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
LOGIN_FAILE
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
LOGIN_FAILE
);
...
@@ -72,7 +74,7 @@ public class AntiSpamController {
...
@@ -72,7 +74,7 @@ public class AntiSpamController {
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_NO_TOKEN
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_NO_TOKEN
);
}
}
P
ICA
User
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
P
ica
User
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
if
(
user
==
null
||
user
.
getId
().
intValue
()
==
0
)
{
if
(
user
==
null
||
user
.
getId
().
intValue
()
==
0
)
{
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
LOGIN_FAILE
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
LOGIN_FAILE
);
...
...
server/src/main/java/com/pica/cloud/online/exam/analysis/server/service/impl/AntiSpamServiceImpl.java
浏览文件 @
3050b4a7
...
@@ -15,6 +15,8 @@ import com.pica.cloud.online.exam.analysis.server.utils.HttpClient4Utils;
...
@@ -15,6 +15,8 @@ import com.pica.cloud.online.exam.analysis.server.utils.HttpClient4Utils;
import
com.pica.cloud.online.exam.analysis.server.utils.SignatureUtils
;
import
com.pica.cloud.online.exam.analysis.server.utils.SignatureUtils
;
import
org.apache.http.Consts
;
import
org.apache.http.Consts
;
import
org.apache.http.client.HttpClient
;
import
org.apache.http.client.HttpClient
;
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
;
...
@@ -28,6 +30,7 @@ import java.util.regex.Pattern;
...
@@ -28,6 +30,7 @@ import java.util.regex.Pattern;
*/
*/
@Service
@Service
public
class
AntiSpamServiceImpl
implements
AntiSpamService
{
public
class
AntiSpamServiceImpl
implements
AntiSpamService
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
AntiSpamServiceImpl
.
class
);
@Autowired
@Autowired
private
PropertiesConfiguration
properties
;
private
PropertiesConfiguration
properties
;
...
@@ -82,7 +85,7 @@ public class AntiSpamServiceImpl implements AntiSpamService {
...
@@ -82,7 +85,7 @@ public class AntiSpamServiceImpl implements AntiSpamService {
*/
*/
String
response
=
HttpClient4Utils
.
sendPost
(
httpClient
,
properties
.
getNeteaseAntispamTextApiUrl
(),
params
,
Consts
.
UTF_8
);
String
response
=
HttpClient4Utils
.
sendPost
(
httpClient
,
properties
.
getNeteaseAntispamTextApiUrl
(),
params
,
Consts
.
UTF_8
);
System
.
out
.
println
(
"content:"
+
content
+
" response="
+
response
);
logger
.
info
(
"content:"
+
content
+
" response="
+
response
);
/**
/**
* 5. 解析返回值
* 5. 解析返回值
...
@@ -231,7 +234,7 @@ public class AntiSpamServiceImpl implements AntiSpamService {
...
@@ -231,7 +234,7 @@ public class AntiSpamServiceImpl implements AntiSpamService {
int
status
=
jObject
.
get
(
"status"
).
getAsInt
();
int
status
=
jObject
.
get
(
"status"
).
getAsInt
();
String
taskId
=
jObject
.
get
(
"taskId"
).
getAsString
();
String
taskId
=
jObject
.
get
(
"taskId"
).
getAsString
();
JsonArray
labelArray
=
jObject
.
get
(
"labels"
).
getAsJsonArray
();
JsonArray
labelArray
=
jObject
.
get
(
"labels"
).
getAsJsonArray
();
System
.
out
.
println
(
String
.
format
(
"taskId=%s,status=%s,name=%s,labels:"
,
taskId
,
status
,
name
));
logger
.
info
(
String
.
format
(
"taskId=%s,status=%s,name=%s,labels:"
,
taskId
,
status
,
name
));
/**
/**
* 检测失败 0:成功 610:图片下载失败 620:图片格式错误 630:其他
* 检测失败 0:成功 610:图片下载失败 620:图片格式错误 630:其他
...
@@ -253,7 +256,7 @@ public class AntiSpamServiceImpl implements AntiSpamService {
...
@@ -253,7 +256,7 @@ public class AntiSpamServiceImpl implements AntiSpamService {
int
level
=
lObject
.
get
(
"level"
).
getAsInt
();
int
level
=
lObject
.
get
(
"level"
).
getAsInt
();
double
rate
=
lObject
.
get
(
"rate"
).
getAsDouble
();
double
rate
=
lObject
.
get
(
"rate"
).
getAsDouble
();
if
(
label
==
100
||
label
==
110
||
label
==
210
)
{
if
(
label
==
100
||
label
==
110
||
label
==
210
)
{
System
.
out
.
println
(
String
.
format
(
"label:%s, level=%s, rate=%s"
,
label
,
level
,
rate
));
logger
.
info
(
String
.
format
(
"label:%s, level=%s, rate=%s"
,
label
,
level
,
rate
));
if
(
level
>
maxLevel
)
{
if
(
level
>
maxLevel
)
{
maxLevel
=
level
;
maxLevel
=
level
;
maxLable
=
label
;
maxLable
=
label
;
...
@@ -268,7 +271,7 @@ public class AntiSpamServiceImpl implements AntiSpamService {
...
@@ -268,7 +271,7 @@ public class AntiSpamServiceImpl implements AntiSpamService {
}
}
}
}
}
else
{
}
else
{
System
.
out
.
println
(
String
.
format
(
"ERROR: code=%s, msg=%s"
,
code
,
msg
));
logger
.
error
(
String
.
format
(
"ERROR: code=%s, msg=%s"
,
code
,
msg
));
}
}
/**
/**
* 成功
* 成功
...
...
server/src/main/resources/bootstrap-dev.properties
浏览文件 @
3050b4a7
...
@@ -31,4 +31,4 @@ management.security.enabled=false
...
@@ -31,4 +31,4 @@ management.security.enabled=false
#spring.zipkin.base-url=http://192.168.110.124:7895
#spring.zipkin.base-url=http://192.168.110.124:7895
#spring.sleuth.sampler.percentage=1.0
#spring.sleuth.sampler.percentage=1.0
#
logging.config=classpath:log4j2-dev.xml
logging.config
=
classpath:log4j2-dev.xml
server/src/main/resources/bootstrap-prod.properties
浏览文件 @
3050b4a7
...
@@ -31,4 +31,4 @@ management.security.enabled=true
...
@@ -31,4 +31,4 @@ management.security.enabled=true
spring.zipkin.base-url
=
http://172.19.137.19:7895
spring.zipkin.base-url
=
http://172.19.137.19:7895
spring.sleuth.sampler.percentage
=
1.0
spring.sleuth.sampler.percentage
=
1.0
#
logging.config
=
classpath:log4j2-prod.xml
logging.config
=
classpath:log4j2-prod.xml
\ No newline at end of file
\ No newline at end of file
server/src/main/resources/bootstrap-test1.properties
浏览文件 @
3050b4a7
...
@@ -31,4 +31,4 @@ management.security.enabled=false
...
@@ -31,4 +31,4 @@ management.security.enabled=false
spring.zipkin.base-url
=
http://192.168.110.133:7895
spring.zipkin.base-url
=
http://192.168.110.133:7895
spring.sleuth.sampler.percentage
=
1.0
spring.sleuth.sampler.percentage
=
1.0
#
logging.config
=
classpath:log4j2-test1.xml
logging.config
=
classpath:log4j2-test1.xml
\ No newline at end of file
\ No newline at end of file
server/src/main/resources/bootstrap-uat.properties
浏览文件 @
3050b4a7
...
@@ -31,4 +31,4 @@ management.security.enabled=false
...
@@ -31,4 +31,4 @@ management.security.enabled=false
spring.zipkin.base-url
=
http://192.168.110.141:7895
spring.zipkin.base-url
=
http://192.168.110.141:7895
spring.sleuth.sampler.percentage
=
1.0
spring.sleuth.sampler.percentage
=
1.0
#
logging.config
=
classpath:log4j2-uat.xml
logging.config
=
classpath:log4j2-uat.xml
\ No newline at end of file
\ No newline at end of file
server/src/main/resources/logback.xml
已删除
100644 → 0
浏览文件 @
7bcf9152
<?xml version="1.0" encoding="UTF-8"?>
<configuration
debug=
"true"
scan=
"true"
scanPeriod=
"30 seconds"
>
<property
name=
"encoder.pattern"
value=
"%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %X{req.xForwardedFor} %X{req.method} %X{req.requestURL} %X{req.queryString} %X{req.userAgent} %-5level %logger{36} - %msg%n"
/>
<property
name=
"rollingPolicy.maxFileSize"
value=
"5MB"
/>
<property
name=
"rollingPolicy.maxHistory"
value=
"30"
/>
<appender
name=
"CONSOLE"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<Target>
System.out
</Target>
<encoder>
<pattern>
${encoder.pattern}
</pattern>
</encoder>
</appender>
<appender
name=
"TRACE"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<encoder>
<pattern>
${encoder.pattern}
</pattern>
<charset>
UTF-8
</charset>
</encoder>
<filter
class=
"ch.qos.logback.classic.filter.LevelFilter"
>
<level>
TRACE
</level>
<onMatch>
ACCEPT
</onMatch>
<onMismatch>
DENY
</onMismatch>
</filter>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"
>
<fileNamePattern>
${LOG_PATH}/%d{yyyy-MM-dd}/trace.%i.log
</fileNamePattern>
<maxHistory>
${rollingPolicy.maxHistory}
</maxHistory>
<maxFileSize>
${rollingPolicy.maxFileSize}
</maxFileSize>
</rollingPolicy>
</appender>
<appender
name=
"INFO"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<encoder>
<pattern>
${encoder.pattern}
</pattern>
<charset>
UTF-8
</charset>
</encoder>
<filter
class=
"ch.qos.logback.classic.filter.LevelFilter"
>
<level>
INFO
</level>
<onMatch>
ACCEPT
</onMatch>
<onMismatch>
DENY
</onMismatch>
</filter>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"
>
<fileNamePattern>
${LOG_PATH}/%d{yyyy-MM-dd}/info.%i.log
</fileNamePattern>
<maxHistory>
${rollingPolicy.maxHistory}
</maxHistory>
<maxFileSize>
${rollingPolicy.maxFileSize}
</maxFileSize>
</rollingPolicy>
</appender>
<appender
name=
"DEBUG"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<encoder>
<pattern>
${encoder.pattern}
</pattern>
<charset>
UTF-8
</charset>
</encoder>
<filter
class=
"ch.qos.logback.classic.filter.LevelFilter"
>
<level>
DEBUG
</level>
<onMatch>
ACCEPT
</onMatch>
<onMismatch>
DENY
</onMismatch>
</filter>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"
>
<fileNamePattern>
${LOG_PATH}/%d{yyyy-MM-dd}/debug.%i.log
</fileNamePattern>
<maxHistory>
${rollingPolicy.maxHistory}
</maxHistory>
<maxFileSize>
${rollingPolicy.maxFileSize}
</maxFileSize>
</rollingPolicy>
</appender>
<appender
name=
"WARN"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<encoder>
<pattern>
${encoder.pattern}
</pattern>
<charset>
UTF-8
</charset>
</encoder>
<filter
class=
"ch.qos.logback.classic.filter.LevelFilter"
>
<level>
WARN
</level>
<onMatch>
ACCEPT
</onMatch>
<onMismatch>
DENY
</onMismatch>
</filter>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"
>
<fileNamePattern>
${LOG_PATH}/%d{yyyy-MM-dd}/warn.%i.log
</fileNamePattern>
<maxHistory>
${rollingPolicy.maxHistory}
</maxHistory>
<maxFileSize>
${rollingPolicy.maxFileSize}
</maxFileSize>
</rollingPolicy>
</appender>
<appender
name=
"ERROR"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<encoder>
<pattern>
${encoder.pattern}
</pattern>
<charset>
UTF-8
</charset>
</encoder>
<filter
class=
"ch.qos.logback.classic.filter.LevelFilter"
>
<level>
ERROR
</level>
<onMatch>
ACCEPT
</onMatch>
<onMismatch>
DENY
</onMismatch>
</filter>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"
>
<fileNamePattern>
${LOG_PATH}/%d{yyyy-MM-dd}/error.%i.log
</fileNamePattern>
<maxHistory>
${rollingPolicy.maxHistory}
</maxHistory>
<maxFileSize>
${rollingPolicy.maxFileSize}
</maxFileSize>
</rollingPolicy>
</appender>
<!--logger-->
<logger
name=
"com.ibatis"
level=
"DEBUG"
/>
<logger
name=
"com.ibatis.common.jdbc.SimpleDataSource"
level=
"DEBUG"
/>
<logger
name=
"com.ibatis.common.jdbc.ScriptRunner"
level=
"DEBUG"
/>
<logger
name=
"com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate"
level=
"DEBUG"
/>
<logger
name=
"java.sql.Connection"
level=
"DEBUG"
/>
<logger
name=
"java.sql.Statement"
level=
"DEBUG"
/>
<logger
name=
"java.sql.PreparedStatement"
level=
"DEBUG"
/>
<!--root-->
<root
level=
"INFO"
>
<appender-ref
ref=
"CONSOLE"
/>
<appender-ref
ref=
"INFO"
/>
<appender-ref
ref=
"ERROR"
/>
</root>
</configuration>
\ No newline at end of file
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录