记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
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
董敬伟
liquidnet-bus-v1
Commits
7136245e
Commit
7136245e
authored
Dec 02, 2021
by
胡佳晨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交同步用户积分
parent
4391e9b6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
33 deletions
+52
-33
InnerController.java
...et/service/platform/controller/stone/InnerController.java
+29
-0
StoneServerImpl.java
.../service/platform/service/impl/stone/StoneServerImpl.java
+23
-33
No files found.
liquidnet-bus-service/liquidnet-service-platform/liquidnet-service-platform-impl/src/main/java/com/liquidnet/service/platform/controller/stone/InnerController.java
0 → 100644
View file @
7136245e
package
com
.
liquidnet
.
service
.
platform
.
controller
.
stone
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.platform.service.impl.stone.StoneServerImpl
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
@Api
(
tags
=
"数据迁移 (会重复)"
)
@RestController
@RequestMapping
(
"stone/inner"
)
public
class
InnerController
{
@Autowired
private
StoneServerImpl
data
;
@PostMapping
(
"initScore"
)
@ApiOperation
(
"会员卡领取积分"
)
public
ResponseDto
<
Boolean
>
initScore
(
@RequestParam
(
"uid"
)
String
uid
)
{
Boolean
result
=
data
.
initScore
(
uid
);
return
ResponseDto
.
success
(
result
);
}
}
liquidnet-bus-service/liquidnet-service-platform/liquidnet-service-platform-impl/src/main/java/com/liquidnet/service/platform/service/impl/stone/StoneServerImpl.java
View file @
7136245e
...
@@ -50,9 +50,6 @@ public class StoneServerImpl {
...
@@ -50,9 +50,6 @@ public class StoneServerImpl {
@Autowired
@Autowired
private
MongoTemplate
mongoTemplate
;
private
MongoTemplate
mongoTemplate
;
@Autowired
private
RedisDataSourceUtil
redisDataSourceUtil
;
private
static
final
List
<
String
>
defaultBackgroundList
=
Arrays
.
asList
(
"https://img.zhengzai.tv/other/2021/07/27/150eeb0e20af4fc88e8a1ec57c46c362.png"
,
"https://img.zhengzai.tv/files/2021/01/13/5ffeab3584b7d.png"
,
"http://pic.zhengzai.tv/default/background.png"
,
"http://img.zhengzai.tv/album/20171027/1509106243302.png"
);
@Autowired
@Autowired
AdamUserMapper
userMapper
;
AdamUserMapper
userMapper
;
...
@@ -69,13 +66,9 @@ public class StoneServerImpl {
...
@@ -69,13 +66,9 @@ public class StoneServerImpl {
private
static
final
String
SQL_USER
=
"java"
;
private
static
final
String
SQL_USER
=
"java"
;
private
static
final
String
SQL_PWD
=
"pOOs9Y3wj#2^"
;
private
static
final
String
SQL_PWD
=
"pOOs9Y3wj#2^"
;
public
boolean
initScore
(
int
page
,
int
size
)
{
public
boolean
initScore
(
String
uid
)
{
try
{
try
{
String
sql
=
"select merchant_id, mm.mobile\n"
+
String
sql
=
"select * from temp_score where uid = +uid"
;
"from kylin_performances kp\n"
+
" inner join kylin_performance_relations kpr on kpr.performance_id = kp.performances_id\n"
+
" left join mall.merchants mm on mm.id = kpr.merchant_id\n"
+
"group by mm.mobile"
;
Connection
connection
=
DriverManager
.
getConnection
(
SQL_URL
,
SQL_USER
,
SQL_PWD
);
Connection
connection
=
DriverManager
.
getConnection
(
SQL_URL
,
SQL_USER
,
SQL_PWD
);
//查询数据
//查询数据
PreparedStatement
preparedStatement
=
connection
.
prepareStatement
(
sql
);
PreparedStatement
preparedStatement
=
connection
.
prepareStatement
(
sql
);
...
@@ -84,7 +77,27 @@ public class StoneServerImpl {
...
@@ -84,7 +77,27 @@ public class StoneServerImpl {
preparedStatement
.
close
();
preparedStatement
.
close
();
//数据迁移
//数据迁移
while
(
row
.
next
())
{
while
(
row
.
next
())
{
int
score
=
row
.
getInt
(
"price_cost"
);
int
isLog
=
stoneScoreLogsMapper
.
selectCount
(
Wrappers
.
lambdaQuery
(
StoneScoreLogs
.
class
).
eq
(
StoneScoreLogs:
:
getUid
,
uid
).
eq
(
StoneScoreLogs:
:
getContent
,
"历史积分"
));
if
(
isLog
>
0
)
{
return
true
;
}
//创建 用户积分数据
int
isExists
=
stoneScoreUserMapper
.
selectCount
(
Wrappers
.
lambdaQuery
(
StoneScoreUser
.
class
).
eq
(
StoneScoreUser:
:
getUid
,
uid
));
if
(
isExists
<=
0
)
{
StoneScoreUser
data
=
StoneScoreUser
.
getNew
();
data
.
setStatus
(
1
);
data
.
setScoreId
(
IDGenerator
.
nextTimeId2
());
data
.
setUid
(
uid
);
data
.
setCreatedAt
(
LocalDateTime
.
now
());
stoneScoreUserMapper
.
insert
(
data
);
StoneUserVo
userTaskVo
=
StoneUserVo
.
getNew
();
userTaskVo
.
getTask
();
userTaskVo
.
setUid
(
uid
);
userTaskVo
.
setStatus
(
1
);
userCreate
(
userTaskVo
);
}
stoneIntegralClient
.
in2111
(
uid
,
score
,
"历史积分"
);
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
info
(
"异常 : {} "
,
e
);
log
.
info
(
"异常 : {} "
,
e
);
...
@@ -103,27 +116,4 @@ public class StoneServerImpl {
...
@@ -103,27 +116,4 @@ public class StoneServerImpl {
private
Object
userCreate
(
StoneUserVo
data
)
{
private
Object
userCreate
(
StoneUserVo
data
)
{
return
mongoTemplate
.
insert
(
data
,
StoneUserVo
.
class
.
getSimpleName
());
return
mongoTemplate
.
insert
(
data
,
StoneUserVo
.
class
.
getSimpleName
());
}
}
private
String
getUnionIdByPhone
(
String
phone
)
{
log
.
info
(
"mobile = "
+
phone
);
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_APPLET_USERS_PHONE
.
concat
(
phone
);
Object
obj
=
redisDataSourceUtil
.
getRedisSweetUtil
().
get
(
redisKey
);
if
(
null
==
obj
)
{
return
null
;
}
SweetAppletUsersVo
sweetAppletUsers
=
(
SweetAppletUsersVo
)
obj
;
String
redisKey2
=
SweetConstant
.
REDIS_KEY_SWEET_WECHAT_USERS_UNIONID
.
concat
(
sweetAppletUsers
.
getUnionId
())
.
concat
(
SweetConstant
.
REDIS_KEY_SWEET_WECHAT_USERS_TYPE
).
concat
(
String
.
valueOf
(
2
));
Object
obj2
=
redisDataSourceUtil
.
getRedisSweetUtil
().
get
(
redisKey2
);
if
(
null
==
obj2
)
{
return
null
;
}
else
{
return
"true"
;
}
}
private
Object
logCreate
(
StoneScoreLogs
data
)
{
return
mongoTemplate
.
insert
(
data
,
StoneScoreLogs
.
class
.
getSimpleName
());
}
}
}
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