Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cloud-web
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hqzhdj
cloud-web
Commits
f17a9864
Commit
f17a9864
authored
Jan 20, 2025
by
阳浪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
埋点优化
parent
7b910e41
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
7 deletions
+27
-7
cloud-web-student/src/main/java/com/yizhi/application/sign/controller/SignApiController.java
+27
-7
No files found.
cloud-web-student/src/main/java/com/yizhi/application/sign/controller/SignApiController.java
View file @
f17a9864
package
com
.
yizhi
.
application
.
sign
.
controller
;
package
com
.
yizhi
.
application
.
sign
.
controller
;
import
com.baomidou.mybatisplus.plugins.Page
;
import
com.baomidou.mybatisplus.plugins.Page
;
import
com.yizhi.core.application.cache.RedisCache
;
import
com.yizhi.core.application.context.ContextHolder
;
import
com.yizhi.core.application.context.ContextHolder
;
import
com.yizhi.core.application.context.RequestContext
;
import
com.yizhi.core.application.context.RequestContext
;
import
com.yizhi.core.application.event.EventWrapper
;
import
com.yizhi.core.application.event.EventWrapper
;
...
@@ -11,6 +12,7 @@ import com.yizhi.sign.application.feign.SignApiClient;
...
@@ -11,6 +12,7 @@ import com.yizhi.sign.application.feign.SignApiClient;
import
com.yizhi.sign.application.feign.SignRecordApiClient
;
import
com.yizhi.sign.application.feign.SignRecordApiClient
;
import
com.yizhi.sign.application.vo.*
;
import
com.yizhi.sign.application.vo.*
;
import
com.yizhi.sign.application.vo.domain.TrSignAccount
;
import
com.yizhi.sign.application.vo.domain.TrSignAccount
;
import
com.yizhi.site.application.feign.api.EventTrackApiClients
;
import
com.yizhi.system.application.vo.domain.Account
;
import
com.yizhi.system.application.vo.domain.Account
;
import
com.yizhi.training.application.feign.TrainingProjectClient
;
import
com.yizhi.training.application.feign.TrainingProjectClient
;
import
com.yizhi.training.application.vo.domain.TpAuthorizationRangeVo
;
import
com.yizhi.training.application.vo.domain.TpAuthorizationRangeVo
;
...
@@ -31,6 +33,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -31,6 +33,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.*
;
...
@@ -60,13 +63,18 @@ public class SignApiController {
...
@@ -60,13 +63,18 @@ public class SignApiController {
@Autowired
@Autowired
private
CloudEventPublisher
cloudEventPublisher
;
private
CloudEventPublisher
cloudEventPublisher
;
@Autowired
private
EventTrackApiClients
eventTrackApiClients
;
@Autowired
private
RedisCache
redisCache
;
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
SignApiController
.
class
);
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
SignApiController
.
class
);
//2018.09.13添加扫码查看接口
//2018.09.13添加扫码查看接口
@ApiOperation
(
value
=
"签到(扫码进入)"
,
notes
=
"签到(扫码进入)"
)
@ApiOperation
(
value
=
"签到(扫码进入)"
,
notes
=
"签到(扫码进入)"
)
@PostMapping
(
value
=
"/scan"
)
@PostMapping
(
value
=
"/scan"
)
public
Response
<
Object
>
signScan
(
@RequestBody
SignVO
signVO
)
{
public
Response
<
Object
>
signScan
(
HttpServletRequest
request
,
@RequestBody
SignVO
signVO
)
{
RequestContext
requestContext
=
ContextHolder
.
get
();
RequestContext
requestContext
=
ContextHolder
.
get
();
Long
projectId
=
signVO
.
getTrainingProjectId
();
Long
projectId
=
signVO
.
getTrainingProjectId
();
List
<
Long
>
relationIds
=
requestContext
.
getRelationIds
();
List
<
Long
>
relationIds
=
requestContext
.
getRelationIds
();
...
@@ -99,7 +107,7 @@ public class SignApiController {
...
@@ -99,7 +107,7 @@ public class SignApiController {
}
}
}
}
if
(
isPass
)
{
if
(
isPass
)
{
return
sign
(
signVO
);
return
sign
(
request
,
signVO
);
}
else
{
}
else
{
signMap
.
put
(
"code"
,
"6"
);
signMap
.
put
(
"code"
,
"6"
);
signMap
.
put
(
"name"
,
"您没有权限访问该项目"
);
signMap
.
put
(
"name"
,
"您没有权限访问该项目"
);
...
@@ -109,7 +117,7 @@ public class SignApiController {
...
@@ -109,7 +117,7 @@ public class SignApiController {
@ApiOperation
(
value
=
"签到(扫码进入)"
,
notes
=
"签到(扫码进入)"
)
@ApiOperation
(
value
=
"签到(扫码进入)"
,
notes
=
"签到(扫码进入)"
)
@PostMapping
(
value
=
"/custom/scan"
)
@PostMapping
(
value
=
"/custom/scan"
)
public
Response
<
Object
>
customSignScan
(
@RequestBody
SignVO
signVO
)
{
public
Response
<
Object
>
customSignScan
(
HttpServletRequest
request
,
@RequestBody
SignVO
signVO
)
{
RequestContext
requestContext
=
ContextHolder
.
get
();
RequestContext
requestContext
=
ContextHolder
.
get
();
signVO
.
setSignType
(
1
);
signVO
.
setSignType
(
1
);
Long
projectId
=
signVO
.
getTrainingProjectId
();
Long
projectId
=
signVO
.
getTrainingProjectId
();
...
@@ -143,7 +151,7 @@ public class SignApiController {
...
@@ -143,7 +151,7 @@ public class SignApiController {
}
}
}
}
if
(
isPass
)
{
if
(
isPass
)
{
return
sign
(
signVO
);
return
sign
(
request
,
signVO
);
}
else
{
}
else
{
return
Response
.
fail
(
"4001"
,
"签到失败,您不在该项目范围内"
);
return
Response
.
fail
(
"4001"
,
"签到失败,您不在该项目范围内"
);
}
}
...
@@ -151,7 +159,7 @@ public class SignApiController {
...
@@ -151,7 +159,7 @@ public class SignApiController {
@ApiOperation
(
value
=
"签到"
,
notes
=
"签到"
)
@ApiOperation
(
value
=
"签到"
,
notes
=
"签到"
)
@PostMapping
(
value
=
"/"
)
@PostMapping
(
value
=
"/"
)
public
Response
<
Object
>
sign
(
@RequestBody
SignVO
signVO
)
{
public
Response
<
Object
>
sign
(
HttpServletRequest
request
,
@RequestBody
SignVO
signVO
)
{
RequestContext
requestContext
=
ContextHolder
.
get
();
RequestContext
requestContext
=
ContextHolder
.
get
();
Long
accountId
=
requestContext
.
getAccountId
();
Long
accountId
=
requestContext
.
getAccountId
();
Map
<
String
,
String
>
signMap
=
new
HashMap
<
String
,
String
>();
Map
<
String
,
String
>
signMap
=
new
HashMap
<
String
,
String
>();
...
@@ -168,6 +176,10 @@ public class SignApiController {
...
@@ -168,6 +176,10 @@ public class SignApiController {
signMap
.
put
(
"code"
,
"1"
);
signMap
.
put
(
"code"
,
"1"
);
signMap
.
put
(
"name"
,
result
);
signMap
.
put
(
"name"
,
result
);
}
else
if
(
result
.
equals
(
"签到成功"
))
{
}
else
if
(
result
.
equals
(
"签到成功"
))
{
// 添加活动签到埋点
if
(
request
.
getHeader
(
"Cookie"
)!=
null
&&
Objects
.
equals
(
redisCache
.
get
(
request
.
getHeader
(
"Cookie"
).
replace
(
"JSESSIONID="
,
""
)),
"2"
)){
eventTrackApiClients
.
addEvent
(
"activit"
,
accountId
);
}
signMap
.
put
(
"code"
,
"2"
);
signMap
.
put
(
"code"
,
"2"
);
signMap
.
put
(
"name"
,
result
);
signMap
.
put
(
"name"
,
result
);
}
else
if
(
result
.
equals
(
"您已签到成功"
))
{
}
else
if
(
result
.
equals
(
"您已签到成功"
))
{
...
@@ -358,7 +370,7 @@ public class SignApiController {
...
@@ -358,7 +370,7 @@ public class SignApiController {
@ApiOperation
(
value
=
"签到(小程序)"
,
notes
=
"签到(小程序)"
)
@ApiOperation
(
value
=
"签到(小程序)"
,
notes
=
"签到(小程序)"
)
@GetMapping
(
"/public/insert"
)
@GetMapping
(
"/public/insert"
)
public
Response
<
Object
>
insertMini
(
public
Response
<
Object
>
insertMini
(
HttpServletRequest
request
,
@ApiParam
(
name
=
"accountId"
,
value
=
"用户id "
,
required
=
false
)
@RequestParam
(
name
=
"accountId"
,
required
=
false
)
Long
accountId
,
@ApiParam
(
name
=
"accountId"
,
value
=
"用户id "
,
required
=
false
)
@RequestParam
(
name
=
"accountId"
,
required
=
false
)
Long
accountId
,
@ApiParam
(
name
=
"trainingProjectId"
,
value
=
"项目id "
,
required
=
true
)
@RequestParam
(
name
=
"trainingProjectId"
,
required
=
true
)
Long
trainingProjectId
,
@ApiParam
(
name
=
"trainingProjectId"
,
value
=
"项目id "
,
required
=
true
)
@RequestParam
(
name
=
"trainingProjectId"
,
required
=
true
)
Long
trainingProjectId
,
@ApiParam
(
name
=
"signTimeId"
,
value
=
"签到id "
,
required
=
true
)
@RequestParam
(
name
=
"signTimeId"
,
required
=
true
)
Long
signTimeId
,
@ApiParam
(
name
=
"signTimeId"
,
value
=
"签到id "
,
required
=
true
)
@RequestParam
(
name
=
"signTimeId"
,
required
=
true
)
Long
signTimeId
,
...
@@ -374,6 +386,10 @@ public class SignApiController {
...
@@ -374,6 +386,10 @@ public class SignApiController {
signMap
.
put
(
"code"
,
"1"
);
signMap
.
put
(
"code"
,
"1"
);
signMap
.
put
(
"name"
,
result
);
signMap
.
put
(
"name"
,
result
);
}
else
if
(
result
.
equals
(
"签到成功"
))
{
}
else
if
(
result
.
equals
(
"签到成功"
))
{
// 添加活动签到埋点
if
(
request
.
getHeader
(
"Cookie"
)!=
null
&&
Objects
.
equals
(
redisCache
.
get
(
request
.
getHeader
(
"Cookie"
).
replace
(
"JSESSIONID="
,
""
)),
"2"
)){
eventTrackApiClients
.
addEvent
(
"activit"
,
accountId
);
}
signMap
.
put
(
"code"
,
"2"
);
signMap
.
put
(
"code"
,
"2"
);
signMap
.
put
(
"name"
,
result
);
signMap
.
put
(
"name"
,
result
);
signMap
.
put
(
"signDate"
,
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
).
format
(
new
Date
()));
signMap
.
put
(
"signDate"
,
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
).
format
(
new
Date
()));
...
@@ -416,7 +432,7 @@ public class SignApiController {
...
@@ -416,7 +432,7 @@ public class SignApiController {
@ApiOperation
(
value
=
"签到"
,
notes
=
"签到"
)
@ApiOperation
(
value
=
"签到"
,
notes
=
"签到"
)
@GetMapping
(
"/insert"
)
@GetMapping
(
"/insert"
)
public
Response
<
Object
>
insert
(
public
Response
<
Object
>
insert
(
HttpServletRequest
request
,
@ApiParam
(
name
=
"accountId"
,
value
=
"用户id "
,
required
=
false
)
@RequestParam
(
name
=
"accountId"
,
required
=
false
)
Long
accountId
,
@ApiParam
(
name
=
"accountId"
,
value
=
"用户id "
,
required
=
false
)
@RequestParam
(
name
=
"accountId"
,
required
=
false
)
Long
accountId
,
@ApiParam
(
name
=
"trainingProjectId"
,
value
=
"项目id "
,
required
=
true
)
@RequestParam
(
name
=
"trainingProjectId"
,
required
=
true
)
Long
trainingProjectId
,
@ApiParam
(
name
=
"trainingProjectId"
,
value
=
"项目id "
,
required
=
true
)
@RequestParam
(
name
=
"trainingProjectId"
,
required
=
true
)
Long
trainingProjectId
,
@ApiParam
(
name
=
"signTimeId"
,
value
=
"签到id "
,
required
=
true
)
@RequestParam
(
name
=
"signTimeId"
,
required
=
true
)
Long
signTimeId
,
@ApiParam
(
name
=
"signTimeId"
,
value
=
"签到id "
,
required
=
true
)
@RequestParam
(
name
=
"signTimeId"
,
required
=
true
)
Long
signTimeId
,
...
@@ -434,6 +450,10 @@ public class SignApiController {
...
@@ -434,6 +450,10 @@ public class SignApiController {
signMap
.
put
(
"code"
,
"1"
);
signMap
.
put
(
"code"
,
"1"
);
signMap
.
put
(
"name"
,
result
);
signMap
.
put
(
"name"
,
result
);
}
else
if
(
result
.
equals
(
"签到成功"
))
{
}
else
if
(
result
.
equals
(
"签到成功"
))
{
// 添加活动签到埋点
if
(
request
.
getHeader
(
"Cookie"
)!=
null
&&
Objects
.
equals
(
redisCache
.
get
(
request
.
getHeader
(
"Cookie"
).
replace
(
"JSESSIONID="
,
""
)),
"2"
)){
eventTrackApiClients
.
addEvent
(
"activit"
,
accountId
);
}
signMap
.
put
(
"code"
,
"2"
);
signMap
.
put
(
"code"
,
"2"
);
signMap
.
put
(
"name"
,
result
);
signMap
.
put
(
"name"
,
result
);
signMap
.
put
(
"signDate"
,
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
).
format
(
new
Date
()));
signMap
.
put
(
"signDate"
,
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
).
format
(
new
Date
()));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment