Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
open-source
/
chejia-smart-service
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 9e9f18b4
authored
Apr 20, 2021
by
wnb0128
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
车家智能数据服务 用户数据处理--think.wang
1 parent
ec98dbdc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
16 deletions
src/main/java/com/glsx/smart/controller/UserRelationController.java
src/main/java/com/glsx/smart/service/impl/SmartUserRelationServiceImpl.java
src/main/java/com/glsx/smart/controller/UserRelationController.java
View file @
9e9f18b
package
com
.
glsx
.
smart
.
controller
;
package
com
.
glsx
.
smart
.
controller
;
import
cn.hutool.crypto.digest.MD5
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.nacos.common.utils.MD5Utils
;
import
com.glsx.plat.common.utils.HttpUtils
;
import
com.glsx.plat.common.utils.HttpUtils
;
import
com.glsx.plat.common.utils.StringUtils
;
import
com.glsx.plat.common.utils.StringUtils
;
import
com.glsx.plat.core.web.R
;
import
com.glsx.plat.core.web.R
;
import
com.glsx.smart.constant.Constants
;
import
com.glsx.smart.dao.entity.SmartUserRelation
;
import
com.glsx.smart.dao.entity.SmartUserRelation
;
import
com.glsx.smart.service.SmartUserRelationService
;
import
com.glsx.smart.service.SmartUserRelationService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -69,6 +68,8 @@ public class UserRelationController {
...
@@ -69,6 +68,8 @@ public class UserRelationController {
request
.
setChannel
(
userRelation
.
getChannel
());
//涂鸦
request
.
setChannel
(
userRelation
.
getChannel
());
//涂鸦
SmartUserRelation
user
=
userRelationService
.
getSingle
(
request
);
SmartUserRelation
user
=
userRelationService
.
getSingle
(
request
);
request
.
setUserId
(
userRelation
.
getUserId
());
request
.
setUserId
(
userRelation
.
getUserId
());
String
password
=
MD5Utils
.
md5Hex
(
request
.
getPhone
(),
"utf-8"
);
request
.
setPassword
(
password
);
if
(
user
!=
null
){
if
(
user
!=
null
){
String
tuYaId
=
user
.
getThirdId
();
String
tuYaId
=
user
.
getThirdId
();
if
(
StringUtils
.
isEmpty
(
tuYaId
)){
if
(
StringUtils
.
isEmpty
(
tuYaId
)){
...
@@ -81,9 +82,8 @@ public class UserRelationController {
...
@@ -81,9 +82,8 @@ public class UserRelationController {
userRelationService
.
updateByPrimaryKeySelective
(
request
);
userRelationService
.
updateByPrimaryKeySelective
(
request
);
return
R
.
ok
().
data
(
tuYaId
);
return
R
.
ok
().
data
(
tuYaId
);
}
}
String
password
=
MD5
.
create
().
digestHex
(
Constants
.
DEFAULT_PASSWORD
);
//
String password = MD5.create().digestHex(Constants.DEFAULT_PASSWORD);
request
.
setCreateTime
(
new
Date
());
request
.
setCreateTime
(
new
Date
());
request
.
setPassword
(
password
);
if
(
request
.
getChannel
()
==
1
){
//渠道为涂鸦
if
(
request
.
getChannel
()
==
1
){
//渠道为涂鸦
String
tuYaId
=
this
.
syncUser
(
request
.
getPhone
(),
password
);
String
tuYaId
=
this
.
syncUser
(
request
.
getPhone
(),
password
);
request
.
setThirdId
(
tuYaId
);
request
.
setThirdId
(
tuYaId
);
...
...
src/main/java/com/glsx/smart/service/impl/SmartUserRelationServiceImpl.java
View file @
9e9f18b
...
@@ -7,6 +7,7 @@ import com.glsx.smart.exception.ResultEnum;
...
@@ -7,6 +7,7 @@ import com.glsx.smart.exception.ResultEnum;
import
com.glsx.smart.service.SmartUserRelationService
;
import
com.glsx.smart.service.SmartUserRelationService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.List
;
...
@@ -22,22 +23,22 @@ import java.util.List;
...
@@ -22,22 +23,22 @@ import java.util.List;
@Service
@Service
public
class
SmartUserRelationServiceImpl
implements
SmartUserRelationService
{
public
class
SmartUserRelationServiceImpl
implements
SmartUserRelationService
{
@Resource
@Resource
private
SmartUserRelationMapper
smartUserR
elationMapper
;
private
SmartUserRelationMapper
r
elationMapper
;
@Override
@Override
public
int
deleteByPrimaryKey
(
Long
id
)
{
public
int
deleteByPrimaryKey
(
Long
id
)
{
return
smartUserR
elationMapper
.
deleteByPrimaryKey
(
id
);
return
r
elationMapper
.
deleteByPrimaryKey
(
id
);
}
}
@Override
@Override
public
int
insertOrUpdate
(
SmartUserRelation
userRelation
)
{
public
int
insertOrUpdate
(
SmartUserRelation
userRelation
)
{
if
(
userRelation
.
getId
()
==
null
)
{
if
(
userRelation
.
getId
()
==
null
)
{
return
smartUserR
elationMapper
.
insertSelective
(
userRelation
);
return
r
elationMapper
.
insertSelective
(
userRelation
);
}
else
{
}
else
{
SmartUserRelation
record
=
smartUserR
elationMapper
.
selectByPrimaryKey
(
SmartUserRelation
record
=
r
elationMapper
.
selectByPrimaryKey
(
userRelation
.
getId
());
userRelation
.
getId
());
if
(
record
!=
null
)
{
if
(
record
!=
null
)
{
return
smartUserR
elationMapper
.
updateByPrimaryKeySelective
(
userRelation
);
return
r
elationMapper
.
updateByPrimaryKeySelective
(
userRelation
);
}
else
{
}
else
{
throw
new
BusinessException
(
ResultEnum
.
ID_NOT_FOUND
);
throw
new
BusinessException
(
ResultEnum
.
ID_NOT_FOUND
);
}
}
...
@@ -45,34 +46,44 @@ public class SmartUserRelationServiceImpl implements SmartUserRelationService {
...
@@ -45,34 +46,44 @@ public class SmartUserRelationServiceImpl implements SmartUserRelationService {
}
}
@Override
@Override
@Transactional
public
Long
insertSelective
(
SmartUserRelation
record
)
{
public
Long
insertSelective
(
SmartUserRelation
record
)
{
int
i
=
smartUserRelationMapper
.
insertSelective
(
record
);
SmartUserRelation
request
=
new
SmartUserRelation
();
return
i
>
0
?
record
.
getId
()
:
0L
;
request
.
setPhone
(
record
.
getPhone
());
request
.
setChannel
(
record
.
getChannel
());
//涂鸦
SmartUserRelation
user
=
relationMapper
.
getSingle
(
request
);
if
(
user
!=
null
&&
user
.
getId
()
>
0L
){
record
.
setId
(
user
.
getId
());
relationMapper
.
updateByPrimaryKeySelective
(
record
);
}
else
{
relationMapper
.
insertSelective
(
record
);
}
return
record
.
getId
();
}
}
@Override
@Override
public
SmartUserRelation
getSingle
(
SmartUserRelation
record
)
{
public
SmartUserRelation
getSingle
(
SmartUserRelation
record
)
{
return
smartUserR
elationMapper
.
getSingle
(
record
);
return
r
elationMapper
.
getSingle
(
record
);
}
}
@Override
@Override
public
SmartUserRelation
selectByPrimaryKey
(
Long
id
)
{
public
SmartUserRelation
selectByPrimaryKey
(
Long
id
)
{
return
smartUserR
elationMapper
.
selectByPrimaryKey
(
id
);
return
r
elationMapper
.
selectByPrimaryKey
(
id
);
}
}
@Override
@Override
public
int
updateByPrimaryKeySelective
(
SmartUserRelation
record
)
{
public
int
updateByPrimaryKeySelective
(
SmartUserRelation
record
)
{
return
smartUserR
elationMapper
.
updateByPrimaryKeySelective
(
record
);
return
r
elationMapper
.
updateByPrimaryKeySelective
(
record
);
}
}
@Override
@Override
public
int
updateBatchSelective
(
List
<
SmartUserRelation
>
list
)
{
public
int
updateBatchSelective
(
List
<
SmartUserRelation
>
list
)
{
return
smartUserR
elationMapper
.
updateBatchSelective
(
list
);
return
r
elationMapper
.
updateBatchSelective
(
list
);
}
}
@Override
@Override
public
int
batchInsert
(
List
<
SmartUserRelation
>
list
)
{
public
int
batchInsert
(
List
<
SmartUserRelation
>
list
)
{
return
smartUserR
elationMapper
.
batchInsert
(
list
);
return
r
elationMapper
.
batchInsert
(
list
);
}
}
}
}
Write
Preview
Markdown
is supported
Attach a file
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 post a comment