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
提交
9a2f5bbf
提交
9a2f5bbf
编写于
10月 25, 2018
作者:
minghao.wu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feature: cat集成到方法内部
上级
fa9bdbc5
变更
1
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
121 行增加
和
47 行删除
+121
-47
AnalysisController.java
...e/exam/analysis/server/controller/AnalysisController.java
+121
-47
未找到文件。
server/src/main/java/com/pica/cloud/online/exam/analysis/server/controller/AnalysisController.java
浏览文件 @
9a2f5bbf
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.alibaba.fastjson.JSONObject
;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.message.Transaction
;
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
;
...
@@ -82,6 +84,8 @@ public class AnalysisController {
...
@@ -82,6 +84,8 @@ public class AnalysisController {
@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
,
@RequestHeader
(
required
=
false
)
String
token
)
{
@RequestHeader
(
required
=
false
)
String
token
)
{
Transaction
t
=
Cat
.
newTransaction
(
"Link"
,
"/activityDetail"
);
PicaResponse
.
Builder
<
CHCAnalysisDto
>
builder
=
new
PicaResponse
.
Builder
<>();
PicaResponse
.
Builder
<
CHCAnalysisDto
>
builder
=
new
PicaResponse
.
Builder
<>();
/**
/**
...
@@ -122,19 +126,24 @@ public class AnalysisController {
...
@@ -122,19 +126,24 @@ public class AnalysisController {
analysisDto
.
setRoundList
(
roundList
);
analysisDto
.
setRoundList
(
roundList
);
builder
.
setData
(
analysisDto
);
builder
.
setData
(
analysisDto
);
t
.
setStatus
(
Transaction
.
SUCCESS
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
t
.
setStatus
(
e
);
Cat
.
logError
(
e
);
e
.
printStackTrace
();
e
.
printStackTrace
();
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_INNER_ERROR
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_INNER_ERROR
);
}
}
return
builder
.
build
();
return
builder
.
build
();
}
}
@ApiOperation
(
value
=
"获取活动详情"
,
response
=
PicaResponse
.
class
)
@ApiOperation
(
value
=
"获取活动详情"
,
response
=
PicaResponse
.
class
)
@RequestMapping
(
value
=
"/psaActivityDetail"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
@RequestMapping
(
value
=
"/psaActivityDetail"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
public
PicaResponse
<
CHCAnalysisDto
>
getPSAActivityDetail
(
@RequestParam
(
required
=
false
)
Integer
id
)
{
public
PicaResponse
<
CHCAnalysisDto
>
getPSAActivityDetail
(
@RequestParam
(
required
=
false
)
Integer
id
)
{
PicaResponse
.
Builder
<
CHCAnalysisDto
>
builder
=
new
PicaResponse
.
Builder
<>(
);
Transaction
t
=
Cat
.
newTransaction
(
"Link"
,
"/psaActivityDetail"
);
PicaResponse
.
Builder
<
CHCAnalysisDto
>
builder
=
new
PicaResponse
.
Builder
<>();
/**
/**
* 如果不传活动id进来,活动id就用1
* 如果不传活动id进来,活动id就用1
*/
*/
...
@@ -146,7 +155,12 @@ public class AnalysisController {
...
@@ -146,7 +155,12 @@ public class AnalysisController {
analysisDto
.
setRoundList
(
roundList
);
analysisDto
.
setRoundList
(
roundList
);
builder
.
setData
(
analysisDto
);
builder
.
setData
(
analysisDto
);
t
.
setStatus
(
Transaction
.
SUCCESS
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
t
.
setStatus
(
e
);
Cat
.
logError
(
e
);
e
.
printStackTrace
();
e
.
printStackTrace
();
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_INNER_ERROR
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_INNER_ERROR
);
}
}
...
@@ -157,8 +171,9 @@ public class AnalysisController {
...
@@ -157,8 +171,9 @@ 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
)
{
logger
.
info
(
"roundDetail: roundId"
+
roundId
);
Transaction
t
=
Cat
.
newTransaction
(
"Link"
,
"/roundDetail"
);
logger
.
info
(
"roundDetail: roundId"
+
roundId
);
PicaResponse
.
Builder
<
RoundExamTitleDto
>
builder
=
new
PicaResponse
.
Builder
<>();
PicaResponse
.
Builder
<
RoundExamTitleDto
>
builder
=
new
PicaResponse
.
Builder
<>();
try
{
try
{
...
@@ -167,7 +182,12 @@ public class AnalysisController {
...
@@ -167,7 +182,12 @@ public class AnalysisController {
roundExamTitleDto
.
setExamTitleList
(
examTitleDtoList
);
roundExamTitleDto
.
setExamTitleList
(
examTitleDtoList
);
builder
.
setData
(
roundExamTitleDto
);
builder
.
setData
(
roundExamTitleDto
);
t
.
setStatus
(
Transaction
.
SUCCESS
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
t
.
setStatus
(
e
);
Cat
.
logError
(
e
);
e
.
printStackTrace
();
e
.
printStackTrace
();
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_INNER_ERROR
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_INNER_ERROR
);
}
}
...
@@ -179,8 +199,9 @@ public class AnalysisController {
...
@@ -179,8 +199,9 @@ 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
)
{
PicaUser
user
=
null
;
Transaction
t
=
Cat
.
newTransaction
(
"Link"
,
"/replyList"
)
;
PicaUser
user
=
null
;
if
(
token
!=
null
)
{
if
(
token
!=
null
)
{
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
}
}
...
@@ -230,7 +251,12 @@ public class AnalysisController {
...
@@ -230,7 +251,12 @@ public class AnalysisController {
examTitleReplyDto
.
setType
(
analysis
.
getType
().
intValue
());
examTitleReplyDto
.
setType
(
analysis
.
getType
().
intValue
());
builder
.
setData
(
examTitleReplyDto
);
builder
.
setData
(
examTitleReplyDto
);
t
.
setStatus
(
Transaction
.
SUCCESS
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
t
.
setStatus
(
e
);
Cat
.
logError
(
e
);
e
.
printStackTrace
();
e
.
printStackTrace
();
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_INNER_ERROR
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_INNER_ERROR
);
}
}
...
@@ -242,8 +268,9 @@ public class AnalysisController {
...
@@ -242,8 +268,9 @@ 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
)
{
PicaUser
user
=
null
;
Transaction
t
=
Cat
.
newTransaction
(
"Link"
,
"/replyDetail"
)
;
PicaUser
user
=
null
;
if
(
token
!=
null
)
{
if
(
token
!=
null
)
{
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
}
}
...
@@ -286,7 +313,12 @@ public class AnalysisController {
...
@@ -286,7 +313,12 @@ public class AnalysisController {
examTitleReplyDetailDto
.
setType
(
analysis
.
getType
().
intValue
());
examTitleReplyDetailDto
.
setType
(
analysis
.
getType
().
intValue
());
builder
.
setData
(
examTitleReplyDetailDto
);
builder
.
setData
(
examTitleReplyDetailDto
);
t
.
setStatus
(
Transaction
.
SUCCESS
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
t
.
setStatus
(
e
);
Cat
.
logError
(
e
);
e
.
printStackTrace
();
e
.
printStackTrace
();
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_INNER_ERROR
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_INNER_ERROR
);
}
}
...
@@ -298,6 +330,9 @@ public class AnalysisController {
...
@@ -298,6 +330,9 @@ 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
)
{
Transaction
t
=
Cat
.
newTransaction
(
"Link"
,
"/replyDetailByExamTitleId"
);
logger
.
info
(
"replyDetailByExamTitleId: examTitleId == "
+
examTitleId
.
toString
()
+
", token="
+
token
);
logger
.
info
(
"replyDetailByExamTitleId: examTitleId == "
+
examTitleId
.
toString
()
+
", token="
+
token
);
PicaUser
user
=
null
;
PicaUser
user
=
null
;
...
@@ -347,7 +382,12 @@ public class AnalysisController {
...
@@ -347,7 +382,12 @@ public class AnalysisController {
examTitleReplyDetailDto
.
setType
(
analysis
.
getType
().
intValue
());
examTitleReplyDetailDto
.
setType
(
analysis
.
getType
().
intValue
());
builder
.
setData
(
examTitleReplyDetailDto
);
builder
.
setData
(
examTitleReplyDetailDto
);
t
.
setStatus
(
Transaction
.
SUCCESS
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
t
.
setStatus
(
e
);
Cat
.
logError
(
e
);
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
@@ -431,6 +471,8 @@ public class AnalysisController {
...
@@ -431,6 +471,8 @@ 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
)
{
Transaction
t
=
Cat
.
newTransaction
(
"Link"
,
"/nextExamTitle"
);
PicaUser
user
=
null
;
PicaUser
user
=
null
;
if
(
token
!=
null
)
{
if
(
token
!=
null
)
{
...
@@ -472,7 +514,12 @@ public class AnalysisController {
...
@@ -472,7 +514,12 @@ public class AnalysisController {
examTitleReplyDto
.
setType
(
analysis
.
getType
().
intValue
());
examTitleReplyDto
.
setType
(
analysis
.
getType
().
intValue
());
builder
.
setData
(
examTitleReplyDto
);
builder
.
setData
(
examTitleReplyDto
);
t
.
setStatus
(
Transaction
.
SUCCESS
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
t
.
setStatus
(
e
);
Cat
.
logError
(
e
);
e
.
printStackTrace
();
e
.
printStackTrace
();
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_INNER_ERROR
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_INNER_ERROR
);
}
}
...
@@ -485,6 +532,8 @@ public class AnalysisController {
...
@@ -485,6 +532,8 @@ 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
)
{
Transaction
t
=
Cat
.
newTransaction
(
"Link"
,
"/nextReply"
);
PicaUser
user
=
null
;
PicaUser
user
=
null
;
if
(
token
!=
null
)
{
if
(
token
!=
null
)
{
...
@@ -529,7 +578,12 @@ public class AnalysisController {
...
@@ -529,7 +578,12 @@ public class AnalysisController {
examTitleReplyDetailDto
.
setType
(
analysis
.
getType
().
intValue
());
examTitleReplyDetailDto
.
setType
(
analysis
.
getType
().
intValue
());
builder
.
setData
(
examTitleReplyDetailDto
);
builder
.
setData
(
examTitleReplyDetailDto
);
t
.
setStatus
(
Transaction
.
SUCCESS
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
t
.
setStatus
(
e
);
Cat
.
logError
(
e
);
e
.
printStackTrace
();
e
.
printStackTrace
();
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_INNER_ERROR
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_INNER_ERROR
);
}
}
...
@@ -543,6 +597,9 @@ public class AnalysisController {
...
@@ -543,6 +597,9 @@ public class AnalysisController {
@RequestBody
String
content
,
@RequestBody
String
content
,
@RequestHeader
String
sysCode
,
@RequestHeader
String
sysCode
,
@RequestHeader
String
token
)
{
@RequestHeader
String
token
)
{
Transaction
t
=
Cat
.
newTransaction
(
"Link"
,
"/reply"
);
if
(
token
==
null
)
{
if
(
token
==
null
)
{
PicaResponse
picaResponse
=
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_NO_TOKEN
);
PicaResponse
picaResponse
=
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_NO_TOKEN
);
picaResponse
.
setData
(
""
);
picaResponse
.
setData
(
""
);
...
@@ -579,7 +636,12 @@ public class AnalysisController {
...
@@ -579,7 +636,12 @@ public class AnalysisController {
*/
*/
try
{
try
{
analysisService
.
insertReply
(
examTitleId
,
content
,
user
.
getId
());
analysisService
.
insertReply
(
examTitleId
,
content
,
user
.
getId
());
t
.
setStatus
(
Transaction
.
SUCCESS
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
t
.
setStatus
(
e
);
Cat
.
logError
(
e
);
PicaResponse
picaResponse
=
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
INTERFACE_INVOKE_EXCEPTION
);
PicaResponse
picaResponse
=
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
INTERFACE_INVOKE_EXCEPTION
);
picaResponse
.
setData
(
""
);
picaResponse
.
setData
(
""
);
return
picaResponse
;
return
picaResponse
;
...
@@ -627,6 +689,9 @@ public class AnalysisController {
...
@@ -627,6 +689,9 @@ 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
)
{
Transaction
t
=
Cat
.
newTransaction
(
"Link"
,
"/roundDetail/v2/"
);
logger
.
info
(
"roundDetail: roundId"
+
roundId
);
logger
.
info
(
"roundDetail: roundId"
+
roundId
);
PicaResponse
.
Builder
<
RoundExamTitleV2Dto
>
builder
=
new
PicaResponse
.
Builder
<>();
PicaResponse
.
Builder
<
RoundExamTitleV2Dto
>
builder
=
new
PicaResponse
.
Builder
<>();
...
@@ -680,7 +745,12 @@ public class AnalysisController {
...
@@ -680,7 +745,12 @@ public class AnalysisController {
List
<
ExamTitleDto
>
examTitleDtoList
=
analysisService
.
getExamTitleListByRoundId
(
roundId
);
List
<
ExamTitleDto
>
examTitleDtoList
=
analysisService
.
getExamTitleListByRoundId
(
roundId
);
roundExamTitleV2Dto
.
setExamTitleList
(
examTitleDtoList
);
roundExamTitleV2Dto
.
setExamTitleList
(
examTitleDtoList
);
builder
.
setData
(
roundExamTitleV2Dto
);
builder
.
setData
(
roundExamTitleV2Dto
);
t
.
setStatus
(
Transaction
.
SUCCESS
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
t
.
setStatus
(
e
);
Cat
.
logError
(
e
);
e
.
printStackTrace
();
e
.
printStackTrace
();
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_INNER_ERROR
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_INNER_ERROR
);
}
}
...
@@ -692,6 +762,8 @@ public class AnalysisController {
...
@@ -692,6 +762,8 @@ public class AnalysisController {
@RequestMapping
(
value
=
{
"/myStar/{roundId}"
,
"/myStar/"
},
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
@RequestMapping
(
value
=
{
"/myStar/{roundId}"
,
"/myStar/"
},
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
public
PicaResponse
<
MyStarDto
>
myStar
(
@PathVariable
(
value
=
"roundId"
,
required
=
false
)
Integer
roundId
,
public
PicaResponse
<
MyStarDto
>
myStar
(
@PathVariable
(
value
=
"roundId"
,
required
=
false
)
Integer
roundId
,
@RequestHeader
(
required
=
false
)
String
token
)
{
@RequestHeader
(
required
=
false
)
String
token
)
{
Transaction
t
=
Cat
.
newTransaction
(
"Link"
,
"/roundDetail/v2/"
);
if
(
token
==
null
)
{
if
(
token
==
null
)
{
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_NO_TOKEN
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_NO_TOKEN
);
}
}
...
@@ -701,59 +773,61 @@ public class AnalysisController {
...
@@ -701,59 +773,61 @@ public class AnalysisController {
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
LOGIN_FAILE
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
LOGIN_FAILE
);
}
}
/**
if
(
roundId
!=
null
)
{
* TODO: test,生产环境中打开,判断权限
logger
.
info
(
"myStar: roundId="
+
roundId
.
toString
()
+
" token="
+
token
);
*/
/*if (!rankingListService.isRankingInTop200(user.getId())) {
return ReturnUtil.getPicaResponse(PicaResultCode.PERMISSION_NO_ACCESS);
}
}
*/
if
(
roundId
!=
null
)
logger
.
info
(
"myStar: roundId="
+
roundId
.
toString
()
+
" token="
+
token
);
PicaResponse
.
Builder
<
MyStarDto
>
builder
=
new
PicaResponse
.
Builder
<>();
PicaResponse
.
Builder
<
MyStarDto
>
builder
=
new
PicaResponse
.
Builder
<>();
try
{
MyStarDto
myStarDto
=
new
MyStarDto
();
myStarDto
.
setDoctor
(
doctorService
.
getDoctorDtoById
(
user
.
getId
()));
myStarDto
.
setRoundList
(
new
ArrayList
<>());
if
(
roundId
==
null
)
{
List
<
AnalysisRoundDto
>
roundDtoList
=
analysisService
.
getCHCHistoryRound
(
CHC_ANALYSIS_ID
);
roundId
=
roundDtoList
.
get
(
0
).
getRoundId
();
myStarDto
.
setRoundList
(
roundDtoList
);
}
MyStarDto
myStarDto
=
new
MyStarDto
();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy.M.d"
);
myStarDto
.
setDoctor
(
doctorService
.
getDoctorDtoById
(
user
.
getId
()));
AnalysisRound
analysisRound
=
analysisService
.
getRoundInfoById
(
roundId
);
myStarDto
.
setRoundList
(
new
ArrayList
<>());
myStarDto
.
setStartTime
(
sdf
.
format
(
analysisRound
.
getStartTime
()));
if
(
roundId
==
null
)
{
myStarDto
.
setEndTime
(
sdf
.
format
(
analysisRound
.
getEndTime
()));
List
<
AnalysisRoundDto
>
roundDtoList
=
analysisService
.
getCHCHistoryRound
(
CHC_ANALYSIS_ID
);
myStarDto
.
setRemainingTime
(
DateUtils
.
remainingTime
(
analysisRound
.
getEndTime
()));
roundId
=
roundDtoList
.
get
(
0
).
getRoundId
();
/**
myStarDto
.
setRoundList
(
roundDtoList
);
* 设置结束状态
}
*/
if
((
new
Date
()).
getTime
()
>
analysisRound
.
getEndTime
().
getTime
())
{
myStarDto
.
setIsFinished
(
1
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy.M.d"
);
/**
AnalysisRound
analysisRound
=
analysisService
.
getRoundInfoById
(
roundId
);
* 设置我是否当选
myStarDto
.
setStartTime
(
sdf
.
format
(
analysisRound
.
getStartTime
()));
*/
myStarDto
.
setEndTime
(
sdf
.
format
(
analysisRound
.
getEndTime
()));
Integer
electedDoctorId
=
analysisService
.
getElectedDoctorIdByRoundId
(
roundId
);
myStarDto
.
setRemainingTime
(
DateUtils
.
remainingTime
(
analysisRound
.
getEndTime
()));
myStarDto
.
setIsElected
(
electedDoctorId
.
intValue
()
==
user
.
getId
().
intValue
()
?
1
:
0
);
/**
}
else
{
* 设置结束状态
myStarDto
.
setIsFinished
(
0
);
*/
myStarDto
.
setIsElected
(
0
);
if
((
new
Date
()).
getTime
()
>
analysisRound
.
getEndTime
().
getTime
())
{
}
myStarDto
.
setIsFinished
(
1
);
/**
/**
* 设置我
是否当选
* 设置我
的得赞数
*/
*/
Integer
electedDoctorId
=
analysisService
.
getElectedDoctorIdByRoundId
(
roundId
);
myStarDto
.
setMyStarCount
(
analysisService
.
getStarCountByRoundIdAndDoctorId
(
roundId
,
user
.
getId
()));
myStarDto
.
setIsElected
(
electedDoctorId
.
intValue
()
==
user
.
getId
().
intValue
()
?
1
:
0
);
}
else
{
myStarDto
.
setIsFinished
(
0
);
myStarDto
.
setIsElected
(
0
);
}
/**
/**
* 设置我的得赞数
* 我的解析得赞记录
*/
*/
myStarDto
.
setMyStarCount
(
analysisService
.
getStarCount
ByRoundIdAndDoctorId
(
roundId
,
user
.
getId
()));
myStarDto
.
setMyExamTitleList
(
analysisService
.
getMyStarRecord
ByRoundIdAndDoctorId
(
roundId
,
user
.
getId
()));
/**
builder
.
setData
(
myStarDto
);
* 我的解析得赞记录
*/
myStarDto
.
setMyExamTitleList
(
analysisService
.
getMyStarRecordByRoundIdAndDoctorId
(
roundId
,
user
.
getId
()));
builder
.
setData
(
myStarDto
);
t
.
setStatus
(
Transaction
.
SUCCESS
);
}
catch
(
Exception
e
)
{
t
.
setStatus
(
e
);
Cat
.
logError
(
e
);
e
.
printStackTrace
();
}
return
builder
.
build
();
return
builder
.
build
();
}
}
...
...
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录