Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
appApi
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
antaile
appApi
Commits
4e72dfb7
Commit
4e72dfb7
authored
Sep 13, 2021
by
XiaHou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
云应用相关的业务代码
parent
12ac5402
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
3 deletions
+70
-3
AppleController.java
...java/com/hwstudio/antaile/controller/AppleController.java
+7
-0
QueryRandomAtlTimeParam.java
.../hwstudio/antaile/queryparam/QueryRandomAtlTimeParam.java
+18
-0
AtlAppleService.java
...in/java/com/hwstudio/antaile/service/AtlAppleService.java
+45
-3
AtlUserMapper.xml
src/main/resources/mapping/AtlUserMapper.xml
+0
-0
No files found.
src/main/java/com/hwstudio/antaile/controller/AppleController.java
View file @
4e72dfb7
...
...
@@ -35,4 +35,11 @@ public class AppleController extends BaseController {
public
JsonResult
appleInsertUserParam
(
@ApiParam
(
value
=
"传入对象"
)
@RequestBody
AppleInsertUserParam
appleInsertUserParam
)
{
return
this
.
atlAppleService
.
appleInsertUserParam
(
appleInsertUserParam
);
}
@ApiOperation
(
"通过identityToken解析 不绑定手机号登录 可能会导致业务失效,慎用"
)
@RequestMapping
(
value
=
"/identityTokenLoginNotBindMobile"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
JsonResult
identityTokenLoginNotBindMobile
(
@ApiParam
(
value
=
"苹果identityToken"
,
required
=
true
)
@RequestParam
(
value
=
"identityToken"
,
required
=
true
)
String
identityToken
)
{
return
atlAppleService
.
identityTokenLoginNotBindMobile
(
identityToken
);
}
}
src/main/java/com/hwstudio/antaile/queryparam/QueryRandomAtlTimeParam.java
0 → 100644
View file @
4e72dfb7
package
com
.
hwstudio
.
antaile
.
queryparam
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @Author xh
* @Date 2021/8/26
* description:
*/
@Data
public
class
QueryRandomAtlTimeParam
implements
Serializable
{
}
src/main/java/com/hwstudio/antaile/service/AtlAppleService.java
View file @
4e72dfb7
...
...
@@ -6,7 +6,6 @@ import com.hwstudio.antaile.common.Constants;
import
com.hwstudio.antaile.dto.AppleInsertUserParam
;
import
com.hwstudio.antaile.dto.AppleLoginDTO
;
import
com.hwstudio.antaile.dto.LoginUserDto
;
import
com.hwstudio.antaile.dto.WxInsertUserParam
;
import
com.hwstudio.antaile.entity.AtlUser
;
import
com.hwstudio.antaile.entity.Sms
;
import
com.hwstudio.antaile.exception.BusinessException
;
...
...
@@ -17,6 +16,7 @@ import com.hwstudio.antaile.utils.JsonResult;
import
com.hwstudio.antaile.utils.RedisUtil
;
import
org.apache.commons.codec.digest.DigestUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
java.util.Date
;
...
...
@@ -90,9 +90,9 @@ public class AtlAppleService {
atlUser
.
setAppleSub
(
appleInsertUserParam
.
getAppleSub
());
this
.
atlUserMapper
.
updateUser
(
atlUser
);
//赋值给insertAtlUser对象
BeanUtils
.
copyProperties
(
atlUser
,
insertAtlUser
);
BeanUtils
.
copyProperties
(
atlUser
,
insertAtlUser
);
}
else
{
String
nickName
=
appleInsertUserParam
.
getMobilePhone
().
substring
(
0
,
3
)
+
"****"
+
appleInsertUserParam
.
getMobilePhone
().
substring
(
7
,
appleInsertUserParam
.
getMobilePhone
().
length
());
;
String
nickName
=
appleInsertUserParam
.
getMobilePhone
().
substring
(
0
,
3
)
+
"****"
+
appleInsertUserParam
.
getMobilePhone
().
substring
(
7
,
appleInsertUserParam
.
getMobilePhone
().
length
());
insertAtlUser
.
setAvaterImageUrl
(
nickName
);
insertAtlUser
.
setState
(
1
);
insertAtlUser
.
setMobilePhone
(
appleInsertUserParam
.
getMobilePhone
());
...
...
@@ -117,6 +117,48 @@ public class AtlAppleService {
}
/**
* 通过identityToken解析 不绑定手机号登录 可能会导致业务失效,慎用
*
* @param identityToken
* @return
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
JsonResult
identityTokenLoginNotBindMobile
(
String
identityToken
)
{
JSONObject
object
=
AppleUtil
.
parserIdentityToken
(
identityToken
);
AppleLoginDTO
appleLoginDTO
=
object
.
toJavaObject
(
AppleLoginDTO
.
class
);
if
(
appleLoginDTO
==
null
)
{
return
JsonResult
.
failed
(
"获取apple Sub异常"
);
}
if
(
appleLoginDTO
.
getSub
()
==
null
||
appleLoginDTO
.
getSub
().
isEmpty
())
{
return
JsonResult
.
failed
(
"传入苹果token有误,获取sub失败"
);
}
AtlUser
atlUser
=
atlUserMapper
.
getByAppleSub
(
appleLoginDTO
.
getSub
());
//登录返回对象
LoginUserDto
loginUserDto
=
new
LoginUserDto
();
String
token
=
UUID
.
randomUUID
().
toString
();
if
(
atlUser
==
null
)
{
//如果为空 需要插入登录
atlUser
=
new
AtlUser
();
String
nickName
=
"atl"
+
token
.
substring
(
0
,
10
);
atlUser
.
setNickName
(
nickName
);
atlUser
.
setState
(
1
);
atlUser
.
setAppleSub
(
appleLoginDTO
.
getSub
());
atlUser
.
setLoginDate
(
new
Date
());
this
.
atlUserMapper
.
insert
(
atlUser
);
}
else
{
//否则有查询到 就登录成功
loginUserDto
.
setAvatarUrl
(
atlUser
.
getAvaterImageUrl
());
loginUserDto
.
setNickName
(
atlUser
.
getNickName
());
loginUserDto
.
setPhone
(
atlUser
.
getMobilePhone
());
}
redisUtil
.
set
(
token
,
atlUser
,
Long
.
valueOf
(
604800
));
loginUserDto
.
setToken
(
token
);
loginUserDto
.
setUserId
(
atlUser
.
getId
());
loginUserDto
.
setAppleSub
(
atlUser
.
getAppleSub
());
return
JsonResult
.
success
(
"登录成功"
,
loginUserDto
);
}
/**
* 校验传入参数
*
* @param appleInsertUserParam
...
...
src/main/resources/mapping/AtlUserMapper.xml
View file @
4e72dfb7
This diff is collapsed.
Click to expand it.
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