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
提交
8a467c82
提交
8a467c82
编写于
8月 30, 2018
作者:
minghao.wu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 合并代码 发布uat环境
上级
cd72157c
变更
2
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
304 行增加
和
8 行删除
+304
-8
AnalysisController.java
...e/exam/analysis/server/controller/AnalysisController.java
+303
-7
bootstrap.properties
server/src/main/resources/bootstrap.properties
+1
-1
未找到文件。
server/src/main/java/com/pica/cloud/online/exam/analysis/server/controller/AnalysisController.java
浏览文件 @
8a467c82
package
com
.
pica
.
cloud
.
online
.
exam
.
analysis
.
server
.
controller
;
package
com
.
pica
.
cloud
.
online
.
exam
.
analysis
.
server
.
controller
;
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
;
...
@@ -11,10 +12,13 @@ import com.pica.cloud.online.exam.analysis.common.util.ReturnUtil;
...
@@ -11,10 +12,13 @@ import com.pica.cloud.online.exam.analysis.common.util.ReturnUtil;
import
com.pica.cloud.online.exam.analysis.server.client.IConfigServiceClient
;
import
com.pica.cloud.online.exam.analysis.server.client.IConfigServiceClient
;
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.*
;
import
com.pica.cloud.online.exam.analysis.server.service.AntiSpamService
;
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.service.CHCRankingListService
;
import
com.pica.cloud.online.exam.analysis.server.service.DoctorService
;
import
com.pica.cloud.online.exam.analysis.server.service.DoctorService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
javassist.bytecode.ExceptionsAttribute
;
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.*
;
...
@@ -44,6 +48,12 @@ public class AnalysisController {
...
@@ -44,6 +48,12 @@ public class AnalysisController {
@Autowired
@Autowired
private
DoctorService
doctorService
;
private
DoctorService
doctorService
;
@Autowired
private
AntiSpamService
antiSpamService
;
@Autowired
private
CHCRankingListService
rankingListService
;
@ApiOperation
(
value
=
"获取活动详情"
,
response
=
PicaResponse
.
class
)
@ApiOperation
(
value
=
"获取活动详情"
,
response
=
PicaResponse
.
class
)
@RequestMapping
(
value
=
"/activityDetail"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
@RequestMapping
(
value
=
"/activityDetail"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
public
PicaResponse
<
CHCAnalysisDto
>
getActivityDetail
(
@RequestParam
(
required
=
false
)
Integer
id
)
{
public
PicaResponse
<
CHCAnalysisDto
>
getActivityDetail
(
@RequestParam
(
required
=
false
)
Integer
id
)
{
...
@@ -55,7 +65,31 @@ public class AnalysisController {
...
@@ -55,7 +65,31 @@ public class AnalysisController {
id
=
(
id
==
null
?
1
:
id
);
id
=
(
id
==
null
?
1
:
id
);
try
{
try
{
CHCAnalysisDto
analysisDto
=
analysisService
.
getCHCAnalysisById
(
id
);
CHCAnalysisDto
analysisDto
=
analysisService
.
getCHCAnalysisDtoById
(
id
);
List
<
AnalysisRoundDto
>
roundList
=
analysisService
.
getRoundListByAnalysisId
(
id
);
analysisDto
.
setRoundList
(
roundList
);
builder
.
setData
(
analysisDto
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_INNER_ERROR
);
}
return
builder
.
build
();
}
@ApiOperation
(
value
=
"获取活动详情"
,
response
=
PicaResponse
.
class
)
@RequestMapping
(
value
=
"/psaActivityDetail"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
public
PicaResponse
<
CHCAnalysisDto
>
getPSAActivityDetail
(
@RequestParam
(
required
=
false
)
Integer
id
)
{
PicaResponse
.
Builder
<
CHCAnalysisDto
>
builder
=
new
PicaResponse
.
Builder
<>();
/**
* 如果不传活动id进来,活动id就用1
*/
id
=
(
id
==
null
?
2
:
id
);
try
{
CHCAnalysisDto
analysisDto
=
analysisService
.
getPSAAnalysisDtoById
(
id
);
List
<
AnalysisRoundDto
>
roundList
=
analysisService
.
getRoundListByAnalysisId
(
id
);
List
<
AnalysisRoundDto
>
roundList
=
analysisService
.
getRoundListByAnalysisId
(
id
);
analysisDto
.
setRoundList
(
roundList
);
analysisDto
.
setRoundList
(
roundList
);
...
@@ -90,7 +124,7 @@ public class AnalysisController {
...
@@ -90,7 +124,7 @@ public class AnalysisController {
@ApiOperation
(
value
=
"获取某一道题目的回复列表"
,
response
=
PicaResponse
.
class
)
@ApiOperation
(
value
=
"获取某一道题目的回复列表"
,
response
=
PicaResponse
.
class
)
@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
,
@Request
Param
(
required
=
false
)
String
token
)
{
@Request
Header
(
required
=
false
)
String
token
)
{
PICAUser
user
=
null
;
PICAUser
user
=
null
;
...
@@ -112,6 +146,22 @@ public class AnalysisController {
...
@@ -112,6 +146,22 @@ public class AnalysisController {
examTitleReplyDto
.
setExamTitle
(
examTitleDto
);
examTitleReplyDto
.
setExamTitle
(
examTitleDto
);
examTitleReplyDto
.
setReplyList
(
replyDtoList
);
examTitleReplyDto
.
setReplyList
(
replyDtoList
);
/**
* 设置回复状态
*/
examTitleReplyDto
.
setReplyStatus
(
0
);
if
(
user
!=
null
&&
user
.
getId
()
!=
0
)
{
examTitleReplyDto
.
setReplyStatus
(
getReplyStatus
(
analysisRoundExamTitle
.
getAnalysisId
(),
examTitleId
,
user
.
getId
()));
}
/**
* 设置类型
*/
CHCAnalysis
analysis
=
analysisService
.
getAnalysisById
(
analysisRoundExamTitle
.
getAnalysisId
());
examTitleReplyDto
.
setType
(
analysis
.
getType
().
intValue
());
builder
.
setData
(
examTitleReplyDto
);
builder
.
setData
(
examTitleReplyDto
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
@@ -124,7 +174,7 @@ public class AnalysisController {
...
@@ -124,7 +174,7 @@ public class AnalysisController {
@ApiOperation
(
value
=
"查看回复详情"
,
response
=
PicaResponse
.
class
)
@ApiOperation
(
value
=
"查看回复详情"
,
response
=
PicaResponse
.
class
)
@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
,
@Request
Param
(
required
=
false
)
String
token
)
{
@Request
Header
(
required
=
false
)
String
token
)
{
PICAUser
user
=
null
;
PICAUser
user
=
null
;
if
(
token
!=
null
)
{
if
(
token
!=
null
)
{
...
@@ -147,6 +197,22 @@ public class AnalysisController {
...
@@ -147,6 +197,22 @@ public class AnalysisController {
examTitleReplyDetailDto
.
setExamTitle
(
examTitleDto
);
examTitleReplyDetailDto
.
setExamTitle
(
examTitleDto
);
examTitleReplyDetailDto
.
setReply
(
replyDto
);
examTitleReplyDetailDto
.
setReply
(
replyDto
);
/**
* 设置回复状态
*/
examTitleReplyDetailDto
.
setReplyStatus
(
0
);
if
(
user
!=
null
&&
user
.
getId
()
!=
0
)
{
examTitleReplyDetailDto
.
setReplyStatus
(
getReplyStatus
(
analysisRoundExamTitle
.
getAnalysisId
(),
reply
.
getAnalysisRoundExamTitleId
(),
user
.
getId
()));
}
/**
* 设置类型
*/
CHCAnalysis
analysis
=
analysisService
.
getAnalysisById
(
analysisRoundExamTitle
.
getAnalysisId
());
examTitleReplyDetailDto
.
setType
(
analysis
.
getType
().
intValue
());
builder
.
setData
(
examTitleReplyDetailDto
);
builder
.
setData
(
examTitleReplyDetailDto
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
@@ -156,11 +222,50 @@ public class AnalysisController {
...
@@ -156,11 +222,50 @@ public class AnalysisController {
return
builder
.
build
();
return
builder
.
build
();
}
}
@ApiOperation
(
value
=
"查看回复详情"
,
response
=
PicaResponse
.
class
)
@RequestMapping
(
value
=
"/replyDetailByExamTitleId/{examTitleId}"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
public
PicaResponse
<
ExamTitleReplyDetailDto
>
getReplyDetailByExamTitleId
(
@PathVariable
(
"examTitleId"
)
Integer
examTitleId
,
@RequestHeader
(
required
=
false
)
String
token
)
{
System
.
out
.
println
(
"replyDetailByExamTitleId: examTitleId == "
+
examTitleId
.
toString
()
+
", token="
+
token
);
PICAUser
user
=
null
;
if
(
token
!=
null
)
{
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
}
PicaResponse
.
Builder
<
ExamTitleReplyDetailDto
>
builder
=
new
PicaResponse
.
Builder
<>();
try
{
ExamTitleReplyDetailDto
examTitleReplyDetailDto
=
new
ExamTitleReplyDetailDto
();
Reply
reply
=
analysisService
.
getReplyByExamTitleId
(
examTitleId
,
user
!=
null
?
user
.
getId
()
:
0
);
AnalysisRoundExamTitle
analysisRoundExamTitle
=
analysisService
.
getAnanlysisRoundExamTitleById
(
examTitleId
);
ExamTitleDto
examTitleDto
=
analysisService
.
getExamTitleDtoById
(
examTitleId
);
ReplyDto
replyDto
=
new
ReplyDto
();
if
(
null
!=
reply
)
{
replyDto
=
analysisService
.
getReplyDtoByReply
(
reply
,
user
!=
null
?
user
.
getId
()
:
0
);
}
else
{
replyDto
.
setContent
(
""
);
}
examTitleReplyDetailDto
.
setAnalysisId
(
analysisRoundExamTitle
.
getAnalysisId
());
examTitleReplyDetailDto
.
setRoundId
(
analysisRoundExamTitle
.
getRoundId
());
examTitleReplyDetailDto
.
setExamTitle
(
examTitleDto
);
examTitleReplyDetailDto
.
setReply
(
replyDto
);
builder
.
setData
(
examTitleReplyDetailDto
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
builder
.
build
();
}
@ApiOperation
(
value
=
"点赞"
,
response
=
PicaResponse
.
class
)
@ApiOperation
(
value
=
"点赞"
,
response
=
PicaResponse
.
class
)
@RequestMapping
(
value
=
"/starReply/{replyId}/analysis/{analysisId}/round/{roundId}/examTitle/{examTitleId}"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
@RequestMapping
(
value
=
"/starReply/{replyId}/analysis/{analysisId}/round/{roundId}/examTitle/{examTitleId}"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
public
PicaResponse
starReply
(
@PathVariable
(
"analysisId"
)
Integer
analysisId
,
@PathVariable
(
"roundId"
)
Integer
roundId
,
public
PicaResponse
starReply
(
@PathVariable
(
"analysisId"
)
Integer
analysisId
,
@PathVariable
(
"roundId"
)
Integer
roundId
,
@PathVariable
(
"examTitleId"
)
Integer
examTitleId
,
@PathVariable
(
"replyId"
)
Integer
replyId
,
@PathVariable
(
"examTitleId"
)
Integer
examTitleId
,
@PathVariable
(
"replyId"
)
Integer
replyId
,
@Request
Param
(
required
=
false
)
String
token
)
{
@Request
Header
(
required
=
false
)
String
token
)
{
if
(
token
==
null
)
{
if
(
token
==
null
)
{
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_NO_TOKEN
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_NO_TOKEN
);
}
}
...
@@ -168,12 +273,14 @@ public class AnalysisController {
...
@@ -168,12 +273,14 @@ public class AnalysisController {
PICAUser
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
PICAUser
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
);
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
());
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_INVALID_TOKEN
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_INVALID_TOKEN
);
}
}
...
@@ -199,15 +306,17 @@ public class AnalysisController {
...
@@ -199,15 +306,17 @@ public class AnalysisController {
@ApiOperation
(
value
=
"取消点赞"
,
response
=
PicaResponse
.
class
)
@ApiOperation
(
value
=
"取消点赞"
,
response
=
PicaResponse
.
class
)
@RequestMapping
(
value
=
"/cancelStar/{replyId}"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
@RequestMapping
(
value
=
"/cancelStar/{replyId}"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
public
PicaResponse
cancelStar
(
@PathVariable
(
"replyId"
)
Integer
replyId
,
@RequestParam
(
required
=
false
)
String
token
)
{
public
PicaResponse
cancelStar
(
@PathVariable
(
"replyId"
)
Integer
replyId
,
@RequestHeader
(
required
=
false
)
String
token
)
{
if
(
token
==
null
)
{
if
(
token
==
null
)
{
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_NO_TOKEN
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_NO_TOKEN
);
}
}
PICAUser
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
PICAUser
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
if
(
user
==
null
)
{
if
(
user
==
null
||
user
.
getId
().
intValue
()
==
0
)
{
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_INVALID_TOKEN
);
System
.
out
.
println
(
"cancelStar: user == null, token="
+
token
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
LOGIN_FAILE
);
}
}
System
.
out
.
println
(
"cancelStar: replyid="
+
replyId
.
toString
()
+
" token="
+
token
);
System
.
out
.
println
(
"cancelStar: replyid="
+
replyId
.
toString
()
+
" token="
+
token
);
...
@@ -218,4 +327,191 @@ public class AnalysisController {
...
@@ -218,4 +327,191 @@ public class AnalysisController {
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SUCCESS
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SUCCESS
);
}
}
@ApiOperation
(
value
=
"获取某一道题目的下一道题"
,
response
=
PicaResponse
.
class
)
@RequestMapping
(
value
=
"/nextExamTitle/{examTitleId}"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
public
PicaResponse
<
ExamTitleReplyDto
>
nextReplyList
(
@PathVariable
(
"examTitleId"
)
Integer
examTitleId
,
@RequestHeader
(
required
=
false
)
String
token
)
{
PICAUser
user
=
null
;
if
(
token
!=
null
)
{
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
}
PicaResponse
.
Builder
<
ExamTitleReplyDto
>
builder
=
new
PicaResponse
.
Builder
<>();
try
{
AnalysisRoundExamTitle
analysisRoundExamTitle
=
analysisService
.
getAnanlysisRoundExamTitleById
(
examTitleId
);
ExamTitleReplyDto
examTitleReplyDto
=
new
ExamTitleReplyDto
();
ExamTitleDto
examTitleDto
=
analysisService
.
getNextExamTitleDtoById
(
analysisRoundExamTitle
.
getRoundId
(),
examTitleId
);
List
<
ReplyDto
>
replyDtoList
=
analysisService
.
getReplyListDtoByExamTitleId
(
examTitleDto
.
getExamTitleId
(),
user
!=
null
?
user
.
getId
()
:
0
);
examTitleReplyDto
.
setAnalysisId
(
analysisRoundExamTitle
.
getAnalysisId
());
examTitleReplyDto
.
setRoundId
(
analysisRoundExamTitle
.
getRoundId
());
examTitleReplyDto
.
setExamTitle
(
examTitleDto
);
examTitleReplyDto
.
setReplyList
(
replyDtoList
);
/**
* 设置回复状态
*/
examTitleReplyDto
.
setReplyStatus
(
0
);
if
(
user
!=
null
&&
user
.
getId
()
!=
0
)
{
examTitleReplyDto
.
setReplyStatus
(
getReplyStatus
(
analysisRoundExamTitle
.
getAnalysisId
(),
examTitleId
,
user
.
getId
()));
}
/**
* 设置类型
*/
CHCAnalysis
analysis
=
analysisService
.
getAnalysisById
(
analysisRoundExamTitle
.
getAnalysisId
());
examTitleReplyDto
.
setType
(
analysis
.
getType
().
intValue
());
builder
.
setData
(
examTitleReplyDto
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_INNER_ERROR
);
}
return
builder
.
build
();
}
@ApiOperation
(
value
=
"获取某一道题目的下一道题"
,
response
=
PicaResponse
.
class
)
@RequestMapping
(
value
=
"/nextReply/{replyId}"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
public
PicaResponse
<
ExamTitleReplyDto
>
nextReplyDetail
(
@PathVariable
(
"replyId"
)
Integer
replyId
,
@RequestHeader
(
required
=
false
)
String
token
)
{
PICAUser
user
=
null
;
if
(
token
!=
null
)
{
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
}
PicaResponse
.
Builder
<
ExamTitleReplyDetailDto
>
builder
=
new
PicaResponse
.
Builder
<>();
try
{
ExamTitleReplyDetailDto
examTitleReplyDetailDto
=
new
ExamTitleReplyDetailDto
();
Reply
reply
=
analysisService
.
getNextReplyById
(
replyId
);
AnalysisRoundExamTitle
analysisRoundExamTitle
=
analysisService
.
getAnanlysisRoundExamTitleById
(
reply
.
getAnalysisRoundExamTitleId
());
ExamTitleDto
examTitleDto
=
analysisService
.
getExamTitleDtoById
(
reply
.
getAnalysisRoundExamTitleId
());
ReplyDto
replyDto
=
analysisService
.
getReplyDtoByReply
(
reply
,
user
!=
null
?
user
.
getId
()
:
0
);
examTitleReplyDetailDto
.
setAnalysisId
(
analysisRoundExamTitle
.
getAnalysisId
());
examTitleReplyDetailDto
.
setRoundId
(
analysisRoundExamTitle
.
getRoundId
());
examTitleReplyDetailDto
.
setExamTitle
(
examTitleDto
);
examTitleReplyDetailDto
.
setReply
(
replyDto
);
/**
* 设置回复状态
*/
examTitleReplyDetailDto
.
setReplyStatus
(
0
);
if
(
user
!=
null
&&
user
.
getId
()
!=
0
)
{
examTitleReplyDetailDto
.
setReplyStatus
(
getReplyStatus
(
analysisRoundExamTitle
.
getAnalysisId
(),
reply
.
getAnalysisRoundExamTitleId
(),
user
.
getId
()));
}
/**
* 设置类型
*/
CHCAnalysis
analysis
=
analysisService
.
getAnalysisById
(
analysisRoundExamTitle
.
getAnalysisId
());
examTitleReplyDetailDto
.
setType
(
analysis
.
getType
().
intValue
());
builder
.
setData
(
examTitleReplyDetailDto
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_INNER_ERROR
);
}
return
builder
.
build
();
}
@ApiOperation
(
value
=
"回复"
,
response
=
PicaResponse
.
class
)
@RequestMapping
(
value
=
"/reply/{examTitleId}"
,
method
=
RequestMethod
.
POST
,
produces
=
"application/json;charset=UTF-8"
)
public
PicaResponse
reply
(
@PathVariable
(
"examTitleId"
)
Integer
examTitleId
,
@RequestBody
String
content
,
@RequestHeader
String
token
)
{
if
(
token
==
null
)
{
PicaResponse
picaResponse
=
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_NO_TOKEN
);
picaResponse
.
setData
(
""
);
return
picaResponse
;
}
PICAUser
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
if
(
user
==
null
||
user
.
getId
().
intValue
()
==
0
)
{
System
.
out
.
println
(
"reply: user == null, token="
+
token
);
PicaResponse
picaResponse
=
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
LOGIN_FAILE
);
picaResponse
.
setData
(
""
);
return
picaResponse
;
}
try
{
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
content
);
content
=
jsonObject
.
get
(
"content"
).
toString
();
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"parse error: "
+
content
);
}
/**
* 如果判断检测的数据中有垃圾 直接返回
*/
PicaResponse
response
=
antiSpamService
.
processString
(
content
);
if
(!
response
.
getCode
().
equals
(
PicaResultCode
.
SUCCESS
.
code
()))
{
response
.
setData
(
""
);
return
response
;
}
/**
* 插入数据库
*/
try
{
analysisService
.
insertReply
(
examTitleId
,
content
,
user
.
getId
());
}
catch
(
Exception
e
)
{
PicaResponse
picaResponse
=
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
INTERFACE_INVOKE_EXCEPTION
);
picaResponse
.
setData
(
""
);
return
picaResponse
;
}
PicaResponse
picaResponse
=
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SUCCESS
);
picaResponse
.
setMessage
(
"发布成功"
);
return
picaResponse
;
}
Integer
getReplyStatus
(
Integer
analysisId
,
Integer
examTitleId
,
Integer
userId
)
{
Doctor
doctor
=
doctorService
.
getDoctorById
(
userId
);
if
(
doctor
!=
null
)
{
CHCAnalysis
analysis
=
analysisService
.
getAnalysisById
(
analysisId
);
if
(
analysis
.
getType
()
==
1
)
{
/**
* CHC 获取考试前两百名
*/
if
(
rankingListService
.
isRankingInTop200
(
doctor
.
getId
()))
{
return
analysisService
.
getReplyStatus
(
examTitleId
,
userId
);
}
}
else
if
(
analysis
.
getType
()
==
2
)
{
/**
* 如果为认证 不可见
*/
if
(!(
doctor
.
getStatus
().
equals
(
CommonConstants
.
DOCTOR_STATUS_3
)
||
doctor
.
getStatus
().
equals
(
CommonConstants
.
DOCTOR_STATUS_6
)
||
doctor
.
getStatus
().
equals
(
CommonConstants
.
DOCTOR_STATUS_7
)
))
{
return
0
;
}
/**
* PSA 职务职称主任/副主任 院长/副院长 科长/副科长 管理人数100以上
*/
if
(
doctorService
.
isAuth
(
doctor
.
getId
()))
{
return
analysisService
.
getReplyStatus
(
examTitleId
,
userId
);
}
}
}
return
0
;
}
}
}
server/src/main/resources/bootstrap.properties
浏览文件 @
8a467c82
spring.profiles.active
=
prod
spring.profiles.active
=
uat
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录