Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gk
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
micro_app
gk
Commits
006e5085
Commit
006e5085
authored
Aug 01, 2022
by
chenlin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
绑定流程修改手机号+姓名
parent
5782fc13
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
138 additions
and
35 deletions
+138
-35
CmptVo.java
...main/java/com/dlbridge/jadp/plugins/cmpt/bean/CmptVo.java
+4
-0
EnrollInfo.java
.../java/com/dlbridge/jadp/plugins/cmpt/bean/EnrollInfo.java
+2
-0
CmptMapper.xml
.../com/dlbridge/jadp/plugins/cmpt/dao/mapper/CmptMapper.xml
+12
-6
UserCmpt.java
...va/com/dlbridge/jadp/plugins/cmpt/dao/model/UserCmpt.java
+4
-0
CmptService.java
...a/com/dlbridge/jadp/plugins/cmpt/service/CmptService.java
+30
-6
RemoteService.java
...com/dlbridge/jadp/plugins/cmpt/service/RemoteService.java
+14
-14
MicroApiController.java
...om/dlbridge/jadp/plugins/cmpt/web/MicroApiController.java
+72
-9
No files found.
src/main/java/com/dlbridge/jadp/plugins/cmpt/bean/CmptVo.java
View file @
006e5085
...
@@ -23,4 +23,8 @@ public class CmptVo {
...
@@ -23,4 +23,8 @@ public class CmptVo {
private
String
cmptbgColor
;
// 赛事背景颜色
private
String
cmptbgColor
;
// 赛事背景颜色
@ApiModelProperty
(
value
=
"项目Id"
,
notes
=
"项目Id"
)
@ApiModelProperty
(
value
=
"项目Id"
,
notes
=
"项目Id"
)
private
Integer
roadId
;
// 赛事背景颜色
private
Integer
roadId
;
// 赛事背景颜色
@ApiModelProperty
(
value
=
"官网团队ID"
,
notes
=
"官网团队ID"
)
private
Integer
gTeamId
;
@ApiModelProperty
(
value
=
"官网报名记录ID"
,
notes
=
"官网报名记录ID"
)
private
Integer
userMapId
;
}
}
src/main/java/com/dlbridge/jadp/plugins/cmpt/bean/EnrollInfo.java
View file @
006e5085
...
@@ -38,6 +38,8 @@ public class EnrollInfo {
...
@@ -38,6 +38,8 @@ public class EnrollInfo {
private
int
userMapId
;
private
int
userMapId
;
private
int
teamId
;
@ApiModelProperty
(
value
=
"自选号码牌"
)
@ApiModelProperty
(
value
=
"自选号码牌"
)
private
String
manualMarkNo
;
private
String
manualMarkNo
;
...
...
src/main/java/com/dlbridge/jadp/plugins/cmpt/dao/mapper/CmptMapper.xml
View file @
006e5085
...
@@ -104,18 +104,24 @@
...
@@ -104,18 +104,24 @@
update gk_user_cmpt_map
update gk_user_cmpt_map
<set>
<set>
<if
test=
"cmpt.enrollId != null"
>
<if
test=
"cmpt.enrollId != null"
>
mark_no = #{cmpt.enrollId}
,
mark_no = #{cmpt.enrollId}
</if>
</if>
<if
test=
"cmpt.manualMarkNo != null"
>
<if
test=
"cmpt.manualMarkNo != null"
>
manual_mark_no = #{cmpt.manualMarkNo}
,manual_mark_no = #{cmpt.manualMarkNo}
</if>
<if
test=
"cmpt.gTeamId > 0 "
>
,gTeamId = #{cmpt.gTeamId}
</if>
<if
test=
"cmpt.userMapId > 0 "
>
,userMapId = #{cmpt.userMapId}
</if>
</if>
</set>
</set>
where id=#{cmpt.id}
where id=#{cmpt.id}
</update>
</update>
<insert
id=
"saveUserCmpt"
>
<insert
id=
"saveUserCmpt"
>
insert gk_user_cmpt_map(user_id ,cmpt_id ,mark_no,status,create_time)
insert gk_user_cmpt_map(user_id ,cmpt_id ,mark_no,status,create_time
, gTeamId, userMapId
)
values (#{user.userId},#{user.cmptId},#{user.enrollId},1,now())
values (#{user.userId},#{user.cmptId},#{user.enrollId},1,now()
, #{user.gTeamId}, #{user.userMapId}
)
</insert>
</insert>
<update
id=
"unbind"
>
<update
id=
"unbind"
>
...
@@ -125,7 +131,7 @@
...
@@ -125,7 +131,7 @@
<select
id=
"queryUserCmptList"
resultType=
"com.dlbridge.jadp.plugins.cmpt.bean.CmptVo"
>
<select
id=
"queryUserCmptList"
resultType=
"com.dlbridge.jadp.plugins.cmpt.bean.CmptVo"
>
select a.id,a.cmpt_id cmptId,b.cmpt_name name,
select a.id,a.cmpt_id cmptId,b.cmpt_name name,
b.logo cmptLogo,b.bg_color cmptbgColor,a.mark_no markNo
b.logo cmptLogo,b.bg_color cmptbgColor,a.mark_no markNo
, a.gTeamId, a.userMapId
from gksite.gk_user_cmpt_map a
from gksite.gk_user_cmpt_map a
inner join gksite.gk_cmpt b on a.cmpt_id = b.cmpt_id and b.template=0
inner join gksite.gk_cmpt b on a.cmpt_id = b.cmpt_id and b.template=0
left join common.neucmpt c on b.cmpt_id=c.gtCmptId
left join common.neucmpt c on b.cmpt_id=c.gtCmptId
...
@@ -357,7 +363,7 @@
...
@@ -357,7 +363,7 @@
<select
id=
"getEnrollUsersByUserMapId"
resultType=
"java.util.HashMap"
>
<select
id=
"getEnrollUsersByUserMapId"
resultType=
"java.util.HashMap"
>
select a.callPhone mobileNum,a.gender,ifnull(a.IDNumber,'111111111111111111') idCardNo,
select a.callPhone mobileNum,a.gender,ifnull(a.IDNumber,'111111111111111111') idCardNo,
a.userName name,b.timerRoadId roadId,a.registerId
a.userName name,b.timerRoadId roadId,a.registerId
,concat(a.teamId,'') teamId
from raceenroll.competitionusermap a
from raceenroll.competitionusermap a
inner join raceenroll.competitionroadmap b on a.roadId=b.roadId
inner join raceenroll.competitionroadmap b on a.roadId=b.roadId
where a.userMapId=#{userMapId}
where a.userMapId=#{userMapId}
...
...
src/main/java/com/dlbridge/jadp/plugins/cmpt/dao/model/UserCmpt.java
View file @
006e5085
...
@@ -17,6 +17,10 @@ public class UserCmpt {
...
@@ -17,6 +17,10 @@ public class UserCmpt {
private
int
cmptId
;
private
int
cmptId
;
private
int
gTeamId
=
-
1
;
private
int
userMapId
=
-
1
;
private
String
enrollId
;
private
String
enrollId
;
private
int
status
;
private
int
status
;
...
...
src/main/java/com/dlbridge/jadp/plugins/cmpt/service/CmptService.java
View file @
006e5085
...
@@ -7,6 +7,7 @@ import com.dlbridge.jadp.plugins.cmpt.dao.model.UserCmpt;
...
@@ -7,6 +7,7 @@ import com.dlbridge.jadp.plugins.cmpt.dao.model.UserCmpt;
import
com.dlbridge.jadp.plugins.cmpt.utils.Page
;
import
com.dlbridge.jadp.plugins.cmpt.utils.Page
;
import
com.dlbridge.jadp.plugins.cmpt.utils.PageFactory
;
import
com.dlbridge.jadp.plugins.cmpt.utils.PageFactory
;
import
lombok.extern.log4j.Log4j2
;
import
lombok.extern.log4j.Log4j2
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.redis.core.ValueOperations
;
import
org.springframework.data.redis.core.ValueOperations
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -85,26 +86,49 @@ public class CmptService {
...
@@ -85,26 +86,49 @@ public class CmptService {
cmptMapper
.
save
(
cmpt
);
cmptMapper
.
save
(
cmpt
);
}
}
public
EnrollInfo
getUserInfoByPhone
(
String
phone
,
Integer
cmptId
)
{
public
EnrollInfo
getUserInfoByPhone
(
String
phone
,
Integer
cmptId
,
String
name
)
{
return
remoteService
.
getUserInfoByPhone
(
phone
,
cmptId
);
return
remoteService
.
getUserInfoByPhone
(
phone
,
cmptId
,
name
);
}
}
public
EnrollInfo
bind
(
Integer
userId
,
String
phone
,
Integer
cmptId
)
{
/**
EnrollInfo
info
=
getUserInfoByPhone
(
phone
,
cmptId
);
* 小程序绑定报名记录方法
* @param userId 账号ID
* @param phone 手机号
* @param cmptId 计时系统赛事ID
* @param userMapId 官网报名记录ID
* @return
*/
public
EnrollInfo
bind
(
Integer
userId
,
String
phone
,
Integer
cmptId
,
Integer
userMapId
)
{
String
name
=
""
;
String
teamId
=
"-1"
;
if
(
userMapId
!=
null
&&
userMapId
>
0
){
// 用userMapId查报名记录
Map
<
String
,
String
>
enrollUser
=
remoteService
.
getEnrollUsersByUserMapId
(
userMapId
);
phone
=
enrollUser
.
get
(
"mobileNum"
);
name
=
enrollUser
.
get
(
"name"
);
teamId
=
enrollUser
.
get
(
"teamId"
);
}
// 根据手机号和姓名查计时名单
EnrollInfo
info
=
getUserInfoByPhone
(
phone
,
cmptId
,
name
);
if
(
info
!=
null
)
{
// 找到报名信息
if
(
info
!=
null
)
{
// 找到报名信息
if
(
StringUtils
.
isNotBlank
(
teamId
)){
info
.
setTeamId
(
Integer
.
parseInt
(
teamId
));
}
UserCmpt
cmpt
=
queryUserCmpt
(
cmptId
,
userId
,
info
.
getMarkNo
());
UserCmpt
cmpt
=
queryUserCmpt
(
cmptId
,
userId
,
info
.
getMarkNo
());
if
(
cmpt
!=
null
&&
cmpt
.
getStatus
()
==
1
)
{
// 已经绑定
if
(
cmpt
!=
null
&&
cmpt
.
getStatus
()
==
1
)
{
// 已经绑定
log
.
info
(
"已绑定数据,需更新:"
+
cmpt
);
log
.
info
(
"已绑定数据,需更新:"
+
cmpt
);
cmpt
.
setEnrollId
(
info
.
getMarkNo
());
cmpt
.
setEnrollId
(
info
.
getMarkNo
());
cmpt
.
setGTeamId
(
Integer
.
parseInt
(
teamId
));
cmpt
.
setUserMapId
(
userMapId
);
cmptMapper
.
updateUserCmptById
(
cmpt
);
cmptMapper
.
updateUserCmptById
(
cmpt
);
info
.
setManualMarkNo
(
cmpt
.
getManualMarkNo
());
info
.
setManualMarkNo
(
cmpt
.
getManualMarkNo
());
return
info
;
return
info
;
}
else
{
}
else
{
UserCmpt
userCmpt
=
new
UserCmpt
().
setCmptId
(
cmptId
)
UserCmpt
userCmpt
=
new
UserCmpt
().
setCmptId
(
cmptId
)
.
setEnrollId
(
info
.
getMarkNo
()).
setUserId
(
userId
)
.
setEnrollId
(
info
.
getMarkNo
()).
setUserId
(
userId
)
.
setStatus
(
1
);
.
setStatus
(
1
)
.
setGTeamId
(
Integer
.
parseInt
(
teamId
)).
setUserMapId
(
userMapId
)
;
log
.
info
(
"插入绑定内容:"
+
userCmpt
);
log
.
info
(
"插入绑定内容:"
+
userCmpt
);
saveUserCmpt
(
userCmpt
);
saveUserCmpt
(
userCmpt
);
return
info
;
return
info
;
}
}
...
...
src/main/java/com/dlbridge/jadp/plugins/cmpt/service/RemoteService.java
View file @
006e5085
...
@@ -67,9 +67,9 @@ public class RemoteService {
...
@@ -67,9 +67,9 @@ public class RemoteService {
return
cmpt
;
return
cmpt
;
}
}
public
EnrollInfo
getUserInfoByPhone
(
String
phone
,
Integer
cmptId
)
{
public
EnrollInfo
getUserInfoByPhone
(
String
phone
,
Integer
cmptId
,
String
name
)
{
String
url
=
timerURL
+
"getEnrollInfo.do?cmptId="
String
url
=
timerURL
+
"getEnrollInfo.do?cmptId="
+
cmptId
+
"&phone="
+
phone
;
+
cmptId
+
"&phone="
+
phone
+
"&name="
+
name
;
ResponseEntity
<
String
>
forEntity
=
restTemplate
.
getForEntity
(
url
,
String
.
class
);
ResponseEntity
<
String
>
forEntity
=
restTemplate
.
getForEntity
(
url
,
String
.
class
);
log
.
info
(
"requet get url:"
+
url
);
log
.
info
(
"requet get url:"
+
url
);
if
(
forEntity
.
getStatusCode
()
==
HttpStatus
.
OK
)
{
if
(
forEntity
.
getStatusCode
()
==
HttpStatus
.
OK
)
{
...
@@ -82,7 +82,7 @@ public class RemoteService {
...
@@ -82,7 +82,7 @@ public class RemoteService {
}
else
{
}
else
{
JSONObject
content
=
object
.
getJSONObject
(
"content"
);
JSONObject
content
=
object
.
getJSONObject
(
"content"
);
if
(
content
!=
null
&&
!
content
.
isEmpty
())
{
if
(
content
!=
null
&&
!
content
.
isEmpty
())
{
if
(
content
.
getString
(
"itemName"
)
==
null
)
return
null
;
if
(
content
.
getString
(
"itemName"
)
==
null
)
{
return
null
;}
EnrollInfo
info
=
new
EnrollInfo
();
EnrollInfo
info
=
new
EnrollInfo
();
info
.
setRoadName
(
content
.
getString
(
"itemName"
));
info
.
setRoadName
(
content
.
getString
(
"itemName"
));
info
.
setMarkNo
(
content
.
getString
(
"markNo"
));
info
.
setMarkNo
(
content
.
getString
(
"markNo"
));
...
@@ -221,7 +221,7 @@ public class RemoteService {
...
@@ -221,7 +221,7 @@ public class RemoteService {
public
int
getEnrollCmptAuditStatus
(
String
cmptId
)
{
public
int
getEnrollCmptAuditStatus
(
String
cmptId
)
{
Integer
cid
=
cmptSettingService
.
getCommonEnrollCmptId
(
Integer
.
valueOf
(
cmptId
));
Integer
cid
=
cmptSettingService
.
getCommonEnrollCmptId
(
Integer
.
valueOf
(
cmptId
));
if
(
cid
==
null
)
return
0
;
if
(
cid
==
null
)
{
return
0
;}
ResponseEntity
<
String
>
forEntity
=
restTemplate
.
getForEntity
(
geexekURL
+
"competition/getCmptById.do?cmptId="
ResponseEntity
<
String
>
forEntity
=
restTemplate
.
getForEntity
(
geexekURL
+
"competition/getCmptById.do?cmptId="
+
cid
,
String
.
class
);
+
cid
,
String
.
class
);
...
@@ -240,7 +240,7 @@ public class RemoteService {
...
@@ -240,7 +240,7 @@ public class RemoteService {
// 根据计时系统的赛事ID查询关联的报名系统赛事ID
// 根据计时系统的赛事ID查询关联的报名系统赛事ID
Integer
cid
=
cmptSettingService
.
getCommonEnrollCmptId
(
Integer
.
valueOf
(
cmptId
));
Integer
cid
=
cmptSettingService
.
getCommonEnrollCmptId
(
Integer
.
valueOf
(
cmptId
));
log
.
info
(
"请求的路径1:"
+
geexekURL
+
"enrollUser/queryEnrollInfo/"
+
cid
+
"/"
+
userId
);
log
.
info
(
"请求的路径1:"
+
geexekURL
+
"enrollUser/queryEnrollInfo/"
+
cid
+
"/"
+
userId
);
if
(
cid
==
null
)
return
null
;
if
(
cid
==
null
)
{
return
null
;}
ResponseEntity
<
String
>
forEntity
=
restTemplate
.
getForEntity
(
geexekURL
+
"enrollUser/queryEnrollInfo/"
+
cid
+
"/"
+
userId
,
String
.
class
);
ResponseEntity
<
String
>
forEntity
=
restTemplate
.
getForEntity
(
geexekURL
+
"enrollUser/queryEnrollInfo/"
+
cid
+
"/"
+
userId
,
String
.
class
);
if
(
forEntity
.
getStatusCode
()
==
HttpStatus
.
OK
)
{
if
(
forEntity
.
getStatusCode
()
==
HttpStatus
.
OK
)
{
...
@@ -249,7 +249,7 @@ public class RemoteService {
...
@@ -249,7 +249,7 @@ public class RemoteService {
log
.
info
(
"报名的信息:"
+
resultString
);
log
.
info
(
"报名的信息:"
+
resultString
);
JSONObject
object
=
JSONObject
.
parseObject
(
resultString
);
JSONObject
object
=
JSONObject
.
parseObject
(
resultString
);
JSONArray
result
=
object
.
getJSONArray
(
"result"
);
JSONArray
result
=
object
.
getJSONArray
(
"result"
);
if
(
result
.
isEmpty
())
return
null
;
if
(
result
.
isEmpty
())
{
return
null
;}
// 查询赛事分配的号码牌map
// 查询赛事分配的号码牌map
Map
<
String
,
String
>
markNoMap
=
new
HashMap
<
String
,
String
>();
Map
<
String
,
String
>
markNoMap
=
new
HashMap
<
String
,
String
>();
...
@@ -338,7 +338,7 @@ public class RemoteService {
...
@@ -338,7 +338,7 @@ public class RemoteService {
log
.
info
(
"报名的信息:"
+
resultString
);
log
.
info
(
"报名的信息:"
+
resultString
);
JSONObject
object
=
JSONObject
.
parseObject
(
resultString
);
JSONObject
object
=
JSONObject
.
parseObject
(
resultString
);
JSONArray
result
=
object
.
getJSONArray
(
"content"
);
JSONArray
result
=
object
.
getJSONArray
(
"content"
);
if
(
result
==
null
||
result
.
isEmpty
())
return
null
;
if
(
result
==
null
||
result
.
isEmpty
())
{
return
null
;}
for
(
int
i
=
0
;
i
<
result
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
result
.
size
();
i
++)
{
RoadStatistic
user
=
new
RoadStatistic
();
RoadStatistic
user
=
new
RoadStatistic
();
...
@@ -417,12 +417,12 @@ public class RemoteService {
...
@@ -417,12 +417,12 @@ public class RemoteService {
JSONObject
object
=
JSONObject
.
parseObject
(
resultString
);
JSONObject
object
=
JSONObject
.
parseObject
(
resultString
);
JSONObject
roadJsonObject
=
object
.
getJSONObject
(
"road"
);
JSONObject
roadJsonObject
=
object
.
getJSONObject
(
"road"
);
JSONArray
segsResult
=
roadJsonObject
.
getJSONArray
(
"segs"
);
JSONArray
segsResult
=
roadJsonObject
.
getJSONArray
(
"segs"
);
if
(
segsResult
==
null
||
segsResult
.
isEmpty
())
return
null
;
if
(
segsResult
==
null
||
segsResult
.
isEmpty
())
{
return
null
;}
//支持多日赛
//支持多日赛
for
(
int
j
=
0
;
j
<
segsResult
.
size
();
j
++)
{
for
(
int
j
=
0
;
j
<
segsResult
.
size
();
j
++)
{
JSONObject
resultObject
=
(
JSONObject
)
segsResult
.
get
(
j
);
JSONObject
resultObject
=
(
JSONObject
)
segsResult
.
get
(
j
);
JSONArray
result
=
resultObject
.
getJSONArray
(
"segCps"
);
JSONArray
result
=
resultObject
.
getJSONArray
(
"segCps"
);
if
(
result
==
null
||
result
.
isEmpty
())
return
null
;
if
(
result
==
null
||
result
.
isEmpty
())
{
return
null
;}
//获取每个打卡点的信息
//获取每个打卡点的信息
for
(
int
i
=
0
;
i
<
result
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
result
.
size
();
i
++)
{
RoadsGpsCheckpointMap
roadsGpsCheckpointMap
=
new
RoadsGpsCheckpointMap
();
RoadsGpsCheckpointMap
roadsGpsCheckpointMap
=
new
RoadsGpsCheckpointMap
();
...
@@ -476,7 +476,7 @@ public class RemoteService {
...
@@ -476,7 +476,7 @@ public class RemoteService {
String
resultString
=
forEntity
.
getBody
();
String
resultString
=
forEntity
.
getBody
();
JSONObject
object
=
JSONObject
.
parseObject
(
resultString
);
JSONObject
object
=
JSONObject
.
parseObject
(
resultString
);
JSONArray
segsResult
=
object
.
getJSONArray
(
"segs"
);
JSONArray
segsResult
=
object
.
getJSONArray
(
"segs"
);
if
(
segsResult
==
null
||
segsResult
.
isEmpty
())
return
0L
;
if
(
segsResult
==
null
||
segsResult
.
isEmpty
())
{
return
0L
;}
for
(
int
i
=
0
;
i
<
segsResult
.
size
();
i
++){
for
(
int
i
=
0
;
i
<
segsResult
.
size
();
i
++){
JSONObject
resultObject
=
(
JSONObject
)
segsResult
.
get
(
i
);
JSONObject
resultObject
=
(
JSONObject
)
segsResult
.
get
(
i
);
String
segTimespan
=
resultObject
.
getString
(
"segTimespan"
);
String
segTimespan
=
resultObject
.
getString
(
"segTimespan"
);
...
@@ -507,12 +507,12 @@ public class RemoteService {
...
@@ -507,12 +507,12 @@ public class RemoteService {
log
.
info
(
"计时打卡点:"
+
resultString
);
log
.
info
(
"计时打卡点:"
+
resultString
);
JSONObject
object
=
JSONObject
.
parseObject
(
resultString
);
JSONObject
object
=
JSONObject
.
parseObject
(
resultString
);
JSONArray
segsResult
=
object
.
getJSONArray
(
"segs"
);
JSONArray
segsResult
=
object
.
getJSONArray
(
"segs"
);
if
(
segsResult
==
null
||
segsResult
.
isEmpty
())
return
null
;
if
(
segsResult
==
null
||
segsResult
.
isEmpty
())
{
return
null
;}
//支持多日赛
//支持多日赛
for
(
int
j
=
0
;
j
<
segsResult
.
size
();
j
++)
{
for
(
int
j
=
0
;
j
<
segsResult
.
size
();
j
++)
{
JSONObject
resultObject
=
(
JSONObject
)
segsResult
.
get
(
j
);
JSONObject
resultObject
=
(
JSONObject
)
segsResult
.
get
(
j
);
JSONArray
result
=
resultObject
.
getJSONArray
(
"cps"
);
JSONArray
result
=
resultObject
.
getJSONArray
(
"cps"
);
if
(
result
==
null
||
result
.
isEmpty
())
return
null
;
if
(
result
==
null
||
result
.
isEmpty
())
{
return
null
;}
//获取每个打卡点的信息
//获取每个打卡点的信息
for
(
int
i
=
0
;
i
<
result
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
result
.
size
();
i
++)
{
RoadTimerCheckpoint
roadTimerCheckpoint
=
new
RoadTimerCheckpoint
();
RoadTimerCheckpoint
roadTimerCheckpoint
=
new
RoadTimerCheckpoint
();
...
@@ -624,9 +624,9 @@ public class RemoteService {
...
@@ -624,9 +624,9 @@ public class RemoteService {
log
.
info
(
"计时打卡点:"
+
resultString
);
log
.
info
(
"计时打卡点:"
+
resultString
);
JSONObject
object
=
JSONObject
.
parseObject
(
resultString
);
JSONObject
object
=
JSONObject
.
parseObject
(
resultString
);
JSONObject
roadJsonObject
=
object
.
getJSONObject
(
"road"
);
JSONObject
roadJsonObject
=
object
.
getJSONObject
(
"road"
);
if
(
roadJsonObject
==
null
||
roadJsonObject
.
isEmpty
())
return
null
;
if
(
roadJsonObject
==
null
||
roadJsonObject
.
isEmpty
())
{
return
null
;}
JSONArray
segsResult
=
roadJsonObject
.
getJSONArray
(
"segs"
);
JSONArray
segsResult
=
roadJsonObject
.
getJSONArray
(
"segs"
);
if
(
segsResult
==
null
||
segsResult
.
isEmpty
())
return
null
;
if
(
segsResult
==
null
||
segsResult
.
isEmpty
())
{
return
null
;}
//支持多日赛
//支持多日赛
for
(
int
j
=
0
;
j
<
segsResult
.
size
();
j
++)
{
for
(
int
j
=
0
;
j
<
segsResult
.
size
();
j
++)
{
JSONObject
resultObject
=
(
JSONObject
)
segsResult
.
get
(
j
);
JSONObject
resultObject
=
(
JSONObject
)
segsResult
.
get
(
j
);
...
...
src/main/java/com/dlbridge/jadp/plugins/cmpt/web/MicroApiController.java
View file @
006e5085
...
@@ -140,14 +140,24 @@ public class MicroApiController {
...
@@ -140,14 +140,24 @@ public class MicroApiController {
@ApiOperation
(
value
=
"绑定赛事"
,
notes
=
"用户与赛事绑定功能"
,
tags
=
"赛事页面"
)
@ApiOperation
(
value
=
"绑定赛事"
,
notes
=
"用户与赛事绑定功能"
,
tags
=
"赛事页面"
)
public
Result
<
EnrollInfo
>
bind
(
@RequestParam
(
"phone"
)
String
phone
,
public
Result
<
EnrollInfo
>
bind
(
@RequestParam
(
"phone"
)
String
phone
,
@RequestParam
(
"cmptId"
)
Integer
cmptId
,
@RequestParam
(
"cmptId"
)
Integer
cmptId
,
@RequestParam
(
name
=
"userMapId"
,
defaultValue
=
"-1"
,
required
=
false
)
Integer
userMapId
,
HttpServletRequest
request
)
{
HttpServletRequest
request
)
{
int
userId
=
org
.
apache
.
commons
.
lang
.
math
.
NumberUtils
.
toInt
(
request
.
getParameter
(
"userId"
),-
1
);
int
userId
=
org
.
apache
.
commons
.
lang
.
math
.
NumberUtils
.
toInt
(
request
.
getParameter
(
"userId"
),-
1
);
if
(
userId
==
-
1
){
if
(
userId
==
-
1
){
return
Result
.
fail
().
setMsg
(
"入参错误"
);
return
Result
.
fail
().
setMsg
(
"入参错误"
);
}
}
log
.
info
(
"userId:"
+
userId
+
",phone:"
+
phone
+
",cmptId:"
+
cmptId
);
log
.
info
(
"userId:"
+
userId
+
",userMapId:"
+
userMapId
+
",cmptId:"
+
cmptId
);
EnrollInfo
info
=
cmptService
.
bind
(
userId
,
phone
,
cmptId
);
EnrollInfo
info
=
cmptService
.
bind
(
userId
,
phone
,
cmptId
,
userMapId
);
// // 根据手机号+姓名,没有查到计时系统的名单
// if (info == null) {
// return Result.fail().setMsg("报名成功,未查询到组委会分配的号码牌!");
// }else {
// // 查到名单但是计时系统没有号码牌
// if(StringUtils.isBlank(info.getMarkNo())){
// return Result.fail().setMsg("报名成功,未查询到组委会分配的号码牌!");
// }
// }
if
(
info
==
null
)
{
if
(
info
==
null
)
{
int
count
=
cmptService
.
getEnrollInfoCount
(
cmptId
,
phone
);
int
count
=
cmptService
.
getEnrollInfoCount
(
cmptId
,
phone
);
if
(
count
==
0
){
if
(
count
==
0
){
...
@@ -161,12 +171,12 @@ public class MicroApiController {
...
@@ -161,12 +171,12 @@ public class MicroApiController {
info
.
setUserMapId
(
user
.
getUserMapId
());
info
.
setUserMapId
(
user
.
getUserMapId
());
}
}
info
.
setUserMapId
(
userMapId
);
return
Result
.
success
().
setMsg
(
"绑定成功!"
).
setContent
(
info
);
return
Result
.
success
().
setMsg
(
"绑定成功!"
).
setContent
(
info
);
}
}
/**
/**
* 微信手机信息绑定赛事
* 微信手机信息绑定赛事
*
* @return
* @return
*/
*/
@PostMapping
(
value
=
"/bindCmptV2"
)
@PostMapping
(
value
=
"/bindCmptV2"
)
...
@@ -174,7 +184,7 @@ public class MicroApiController {
...
@@ -174,7 +184,7 @@ public class MicroApiController {
@ApiResponse
(
code
=
200
,
message
=
"成功"
),
@ApiResponse
(
code
=
200
,
message
=
"成功"
),
@ApiResponse
(
code
=
-
1
,
message
=
"失败"
),
@ApiResponse
(
code
=
-
1
,
message
=
"失败"
),
@ApiResponse
(
code
=
200
,
message
=
"成功"
,
response
=
Result
.
class
)})
@ApiResponse
(
code
=
200
,
message
=
"成功"
,
response
=
Result
.
class
)})
@ApiOperation
(
value
=
"
微信手机信息绑定赛事"
,
notes
=
"微信手机信息绑定赛事
"
,
tags
=
"赛事页面"
)
@ApiOperation
(
value
=
"
返回本机手机号码"
,
notes
=
"返回本机手机号码
"
,
tags
=
"赛事页面"
)
public
Result
<
EnrollInfo
>
bind
(
HttpServletRequest
request
,
public
Result
<
EnrollInfo
>
bind
(
HttpServletRequest
request
,
Integer
userId
,
Integer
cmptId
,
Integer
userId
,
Integer
cmptId
,
String
encryptedData
,
String
iv
,
String
code
)
{
String
encryptedData
,
String
iv
,
String
code
)
{
...
@@ -212,7 +222,7 @@ public class MicroApiController {
...
@@ -212,7 +222,7 @@ public class MicroApiController {
JSONObject
json
=
JSONObject
.
parseObject
(
result
);
JSONObject
json
=
JSONObject
.
parseObject
(
result
);
String
purePhoneNumber
=
json
.
getString
(
"purePhoneNumber"
);
String
purePhoneNumber
=
json
.
getString
(
"purePhoneNumber"
);
log
.
info
(
"获取的手机是:"
+
purePhoneNumber
);
log
.
info
(
"获取的手机是:"
+
purePhoneNumber
);
EnrollInfo
info
=
cmptService
.
bind
(
userId
,
purePhoneNumber
,
cmptId
);
EnrollInfo
info
=
cmptService
.
bind
(
userId
,
purePhoneNumber
,
cmptId
,
-
1
);
if
(
info
==
null
)
{
if
(
info
==
null
)
{
int
count
=
cmptService
.
getEnrollInfoCount
(
cmptId
,
purePhoneNumber
);
int
count
=
cmptService
.
getEnrollInfoCount
(
cmptId
,
purePhoneNumber
);
if
(
count
==
0
){
if
(
count
==
0
){
...
@@ -234,6 +244,59 @@ public class MicroApiController {
...
@@ -234,6 +244,59 @@ public class MicroApiController {
return
Result
.
fail
();
return
Result
.
fail
();
}
}
/**
* 获取本机手机号方法
* by Linc 2022/08/01
* @return
*/
@PostMapping
(
value
=
"/localPhone"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"成功"
),
@ApiResponse
(
code
=
-
1
,
message
=
"失败"
),
@ApiResponse
(
code
=
200
,
message
=
"成功"
,
response
=
Result
.
class
)})
@ApiOperation
(
value
=
"返回本机手机号码"
,
notes
=
"返回本机手机号码"
,
tags
=
"赛事页面"
)
public
Result
<
EnrollInfo
>
localPhone
(
HttpServletRequest
request
,
Integer
userId
,
String
encryptedData
,
String
iv
,
String
code
)
{
try
{
Object
session_key
=
valueOperations
.
get
(
KEY
+
userId
);
if
(
session_key
==
null
)
{
log
.
info
(
"session_key:"
+
session_key
);
if
(
StringUtils
.
isNotBlank
(
code
))
{
String
partnerId
=
request
.
getParameter
(
"partnerId"
);
JSONObject
json
=
weixinInfoService
.
getOpenIdAndSessionKey
(
code
,
partnerId
);
if
(
null
!=
json
)
{
if
(
json
.
containsKey
(
"errcode"
))
{
//是否有错误
return
Result
.
fail
().
setMsg
(
json
.
getString
(
"errcode"
)
+
" == "
+
json
.
getString
(
"errmsg"
));
}
else
{
//用户的唯一标识(openid)
//获取会话密钥(session_key)
session_key
=
json
.
getString
(
"session_key"
);
log
.
info
(
"session_key:"
+
session_key
);
valueOperations
.
set
(
KEY
+
userId
,
session_key
);
}
}
else
{
return
Result
.
fail
().
setMsg
(
"获取授权失败"
);
}
}
else
{
valueOperations
.
getOperations
().
delete
(
KEY
+
userId
);
return
Result
.
fail
().
setMsg
(
"session失效请重新登录"
).
setCode
(
301
);
}
}
String
result
=
AesUtil
.
decrypt
(
encryptedData
,
(
String
)
session_key
,
iv
,
"UTF-8"
);
log
.
info
(
"result:"
+
result
);
if
(
result
==
null
)
{
valueOperations
.
getOperations
().
delete
(
KEY
+
userId
);
return
Result
.
fail
().
setMsg
(
"session失效请重新登录"
).
setCode
(
301
);
}
JSONObject
json
=
JSONObject
.
parseObject
(
result
);
String
purePhoneNumber
=
json
.
getString
(
"purePhoneNumber"
);
log
.
info
(
"获取的手机是:"
+
purePhoneNumber
);
return
Result
.
success
().
setMsg
(
"绑定成功!"
).
setContent
(
purePhoneNumber
);
}
catch
(
Exception
e
)
{
log
.
info
(
e
.
getMessage
(),
e
);
}
return
Result
.
fail
();
}
@RequestMapping
(
"bindPhone"
)
@RequestMapping
(
"bindPhone"
)
public
Result
bindPhone
(
HttpServletRequest
request
,
public
Result
bindPhone
(
HttpServletRequest
request
,
int
userId
,
int
userId
,
...
@@ -655,7 +718,7 @@ public class MicroApiController {
...
@@ -655,7 +718,7 @@ public class MicroApiController {
@ApiOperation
(
value
=
"获取赛事资讯"
,
notes
=
"获取赛事资讯"
,
response
=
Result
.
class
,
tags
=
"获取赛事资讯"
)
@ApiOperation
(
value
=
"获取赛事资讯"
,
notes
=
"获取赛事资讯"
,
response
=
Result
.
class
,
tags
=
"获取赛事资讯"
)
public
Result
news
(
@PathVariable
(
"cmptId"
)
Integer
cmptId
)
{
public
Result
news
(
@PathVariable
(
"cmptId"
)
Integer
cmptId
)
{
List
<
News
>
news
=
newsService
.
queryNewsByCmptId
(
cmptId
);
List
<
News
>
news
=
newsService
.
queryNewsByCmptId
(
cmptId
);
if
(
news
==
null
)
return
Result
.
fail
();
if
(
news
==
null
)
{
return
Result
.
fail
();}
news
.
forEach
(
newsObj
->
{
news
.
forEach
(
newsObj
->
{
newsObj
.
setUrl
(
serverURL
+
"gk/news/page/"
+
newsObj
.
getId
());
newsObj
.
setUrl
(
serverURL
+
"gk/news/page/"
+
newsObj
.
getId
());
newsObj
.
setContent
(
""
);
newsObj
.
setContent
(
""
);
...
@@ -998,7 +1061,7 @@ public class MicroApiController {
...
@@ -998,7 +1061,7 @@ public class MicroApiController {
log
.
info
(
score
);
log
.
info
(
score
);
//接受前端提交的成绩,校验是否符合规则,并取出本条规则
//接受前端提交的成绩,校验是否符合规则,并取出本条规则
CmptScoreRule
rule
=
cmptScoreRuleService
.
getCmptScoreRulesByCmptIdAndIndex
(
score
.
getCmptId
(),
score
.
getIndexId
());
CmptScoreRule
rule
=
cmptScoreRuleService
.
getCmptScoreRulesByCmptIdAndIndex
(
score
.
getCmptId
(),
score
.
getIndexId
());
if
(
rule
==
null
)
return
Result
.
fail
().
setMsg
(
"未找到规则"
);
if
(
rule
==
null
)
{
return
Result
.
fail
().
setMsg
(
"未找到规则"
);}
//判断此条规则是否提交过成绩
//判断此条规则是否提交过成绩
Integer
scoreId
=
cmptScoreRuleScoreInfoService
.
getCmptScoreRuleScoreInfoIdByruleIdAndMarkNo
(
score
.
getCmptId
(),
score
.
getMarkNo
(),
rule
.
getId
());
Integer
scoreId
=
cmptScoreRuleScoreInfoService
.
getCmptScoreRuleScoreInfoIdByruleIdAndMarkNo
(
score
.
getCmptId
(),
score
.
getMarkNo
(),
rule
.
getId
());
...
@@ -1071,7 +1134,7 @@ public class MicroApiController {
...
@@ -1071,7 +1134,7 @@ public class MicroApiController {
public
Result
getScore
(
UserScore
score
)
{
public
Result
getScore
(
UserScore
score
)
{
log
.
info
(
"用户提交的成绩信息:"
+
score
.
toString
());
log
.
info
(
"用户提交的成绩信息:"
+
score
.
toString
());
CmptScoreRule
rule
=
cmptScoreRuleService
.
getCmptScoreRulesByCmptIdAndIndex
(
score
.
getCmptId
(),
score
.
getIndexId
());
CmptScoreRule
rule
=
cmptScoreRuleService
.
getCmptScoreRulesByCmptIdAndIndex
(
score
.
getCmptId
(),
score
.
getIndexId
());
if
(
rule
==
null
)
return
Result
.
fail
().
setContent
(
"未找到匹配的规则"
);
if
(
rule
==
null
)
{
return
Result
.
fail
().
setContent
(
"未找到匹配的规则"
);}
EnrollInfo
userInfo
=
remoteService
.
getUserInfoByMarkNo
(
score
.
getMarkNo
(),
score
.
getCmptId
());
EnrollInfo
userInfo
=
remoteService
.
getUserInfoByMarkNo
(
score
.
getMarkNo
(),
score
.
getCmptId
());
if
(
userInfo
==
null
){
if
(
userInfo
==
null
){
return
Result
.
fail
().
setMsg
(
"未查询到用户信息,请重新绑定!"
);
return
Result
.
fail
().
setMsg
(
"未查询到用户信息,请重新绑定!"
);
...
...
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