Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qa-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
QA
qa-platform
Commits
8622d7f2
Commit
8622d7f2
authored
May 17, 2021
by
黎博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增羊小咩清除数据接口
parent
74657651
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
130 additions
and
0 deletions
+130
-0
ClearDataController.java
...qaplatform/zdata/controller/xyqb/ClearDataController.java
+27
-0
ClearDataService.java
...cn/qg/qaplatform/zdata/service/xyqb/ClearDataService.java
+8
-0
ClearDataServiceImpl.java
...latform/zdata/service/xyqb/impl/ClearDataServiceImpl.java
+95
-0
No files found.
src/main/java/cn/qg/qaplatform/zdata/controller/xyqb/ClearDataController.java
0 → 100644
View file @
8622d7f2
package
cn
.
qg
.
qaplatform
.
zdata
.
controller
.
xyqb
;
import
cn.qg.qaplatform.utils.JsonResult
;
import
cn.qg.qaplatform.zdata.service.xyqb.ClearDataService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.CrossOrigin
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@CrossOrigin
@RestController
public
class
ClearDataController
{
@Autowired
ClearDataService
clearDataService
;
/**
* 清除用户数据
* @param namespace 环境
* @param phoneNo 手机号
* @return
*/
@GetMapping
(
"/cleardata"
)
public
JsonResult
clearData
(
String
namespace
,
String
phoneNo
)
{
return
JsonResult
.
success
(
clearDataService
.
clearData
(
namespace
,
phoneNo
));
}
}
src/main/java/cn/qg/qaplatform/zdata/service/xyqb/ClearDataService.java
0 → 100644
View file @
8622d7f2
package
cn
.
qg
.
qaplatform
.
zdata
.
service
.
xyqb
;
/**
* 清除羊小咩数据
*/
public
interface
ClearDataService
{
boolean
clearData
(
String
namespace
,
String
phoneNo
);
}
src/main/java/cn/qg/qaplatform/zdata/service/xyqb/impl/ClearDataServiceImpl.java
0 → 100644
View file @
8622d7f2
package
cn
.
qg
.
qaplatform
.
zdata
.
service
.
xyqb
.
impl
;
import
cn.qg.qaplatform.config.SwitchDataSource
;
import
cn.qg.qaplatform.zdata.entity.XjfqGenProcessVo
;
import
cn.qg.qaplatform.zdata.service.xyqb.ClearDataService
;
import
cn.qg.qaplatform.zdata.service.xyqb.XyqbBasicQueryService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.Map
;
@Slf4j
@Service
public
class
ClearDataServiceImpl
implements
ClearDataService
{
@Autowired
XyqbBasicQueryService
xyqbBasicQueryService
;
@Autowired
JdbcTemplate
jdbcTemplate
;
@Override
public
boolean
clearData
(
String
namespace
,
String
phoneNo
)
{
XjfqGenProcessVo
xjfqGenProcessVo
=
xyqbBasicQueryService
.
getUserInfoByPhoneNo
(
namespace
,
phoneNo
);
String
userId
=
xjfqGenProcessVo
.
getUserId
();
String
uuid
=
xjfqGenProcessVo
.
getUuid
();
log
.
info
(
"开始删除{}环境{}用户xyqb_user中的数据!"
,
namespace
,
phoneNo
);
SwitchDataSource
.
dataSourceSwitch
(
namespace
,
"xyqb_user"
);
jdbcTemplate
.
execute
(
"DELETE FROM `user` WHERE id = "
+
userId
);
jdbcTemplate
.
execute
(
"DELETE FROM `user_detail` WHERE user_id = "
+
userId
);
jdbcTemplate
.
execute
(
"DELETE FROM `wechat_userinfo` WHERE user_id = "
+
userId
);
jdbcTemplate
.
execute
(
"DELETE FROM `address` WHERE user_id = "
+
userId
);
log
.
info
(
"开始删除{}环境{}用户kdsp中的数据!"
,
namespace
,
phoneNo
);
SwitchDataSource
.
dataSourceSwitch
(
namespace
,
"kdsp"
);
List
<
Map
<
String
,
Object
>>
orderList
=
jdbcTemplate
.
queryForList
(
"SELECT * FROM `t_order_info` WHERE user_id = "
+
userId
);
if
(
orderList
.
size
()
>
0
)
{
for
(
Map
<
String
,
Object
>
map:
orderList
)
{
String
orderNo
=
map
.
get
(
"order_no"
).
toString
();
jdbcTemplate
.
execute
(
"DELETE FROM `t_order_sku` WHERE order_no = "
+
orderNo
);
jdbcTemplate
.
execute
(
"DELETE FROM `t_order_coupon` WHERE order_no = "
+
orderNo
);
jdbcTemplate
.
execute
(
"DELETE FROM `t_order_refund_apply` WHERE order_no = "
+
orderNo
);
jdbcTemplate
.
execute
(
"DELETE FROM `t_order_refund_proof` WHERE order_no = "
+
orderNo
);
}
}
jdbcTemplate
.
execute
(
"DELETE FROM `t_user_shop_cart` WHERE user_id = "
+
userId
);
jdbcTemplate
.
execute
(
"DELETE FROM `t_user_receiver_addr` WHERE user_id = "
+
userId
);
jdbcTemplate
.
execute
(
"DELETE FROM `t_user_points_detail` WHERE `user_id` = "
+
userId
);
jdbcTemplate
.
execute
(
"DELETE FROM `t_user_points` WHERE user_id = "
+
userId
);
jdbcTemplate
.
execute
(
"DELETE FROM `t_order_info` WHERE user_id = "
+
userId
);
jdbcTemplate
.
execute
(
"DELETE FROM `t_order_sku_coupon` WHERE user_id = "
+
userId
);
jdbcTemplate
.
execute
(
"DELETE FROM `t_order_sku_activity` WHERE user_id = "
+
userId
);
jdbcTemplate
.
execute
(
"DELETE FROM `t_ka_process_record` WHERE user_id = "
+
userId
);
jdbcTemplate
.
execute
(
"DELETE FROM `t_coupon_user` WHERE user_id = "
+
userId
);
jdbcTemplate
.
execute
(
"DELETE FROM `t_comment_info` WHERE user_id = "
+
userId
);
log
.
info
(
"开始删除{}环境{}用户vcc_talos中的数据!"
,
namespace
,
phoneNo
);
SwitchDataSource
.
dataSourceSwitch
(
namespace
,
"vcc_talos"
);
jdbcTemplate
.
execute
(
"DELETE FROM `account` WHERE user_id = "
+
userId
);
jdbcTemplate
.
execute
(
"DELETE FROM `risk_record` WHERE user_id = "
+
userId
);
jdbcTemplate
.
execute
(
"DELETE FROM `auth_record` WHERE user_id = "
+
userId
);
jdbcTemplate
.
execute
(
"DELETE FROM `contract_record` WHERE user_id = "
+
userId
);
jdbcTemplate
.
execute
(
"DELETE FROM `credit_trade_record` WHERE user_id = "
+
userId
);
jdbcTemplate
.
execute
(
"DELETE FROM `debit_account` WHERE user_id = "
+
userId
);
jdbcTemplate
.
execute
(
"DELETE FROM `debit_record` WHERE user_id = "
+
userId
);
jdbcTemplate
.
execute
(
"DELETE FROM `msg_record` WHERE phone_no = "
+
phoneNo
);
jdbcTemplate
.
execute
(
"DELETE FROM `order_record` WHERE user_id = "
+
userId
);
jdbcTemplate
.
execute
(
"DELETE FROM `trade_record` WHERE user_id = "
+
userId
);
log
.
info
(
"开始删除{}环境{}用户acsdb中的数据!"
,
namespace
,
phoneNo
);
SwitchDataSource
.
dataSourceSwitch
(
namespace
,
"acsdb"
);
jdbcTemplate
.
execute
(
"DELETE FROM `acs_account` WHERE user_id = "
+
userId
);
jdbcTemplate
.
execute
(
"DELETE FROM `acs_bill` WHERE user_id = "
+
userId
);
jdbcTemplate
.
execute
(
"DELETE FROM `acs_cash_account` WHERE user_id = "
+
userId
);
jdbcTemplate
.
execute
(
"DELETE FROM `acs_cash_account_record` WHERE user_id = "
+
userId
);
jdbcTemplate
.
execute
(
"DELETE FROM `acs_capital_transfer_plan` WHERE user_id = "
+
userId
);
jdbcTemplate
.
execute
(
"DELETE FROM `acs_commodity` WHERE user_id = "
+
userId
);
jdbcTemplate
.
execute
(
"DELETE FROM `acs_customer` WHERE uuid = '"
+
uuid
+
"'"
);
jdbcTemplate
.
execute
(
"DELETE FROM `acs_pay_order` WHERE user_id = "
+
userId
);
jdbcTemplate
.
execute
(
"DELETE FROM `acs_payment_order` WHERE user_id = "
+
userId
);
jdbcTemplate
.
execute
(
"DELETE FROM `acs_plan` WHERE user_id = "
+
userId
);
jdbcTemplate
.
execute
(
"DELETE FROM `acs_sms` WHERE mobile_no = "
+
phoneNo
);
jdbcTemplate
.
execute
(
"DELETE FROM `acs_trans` WHERE user_id = "
+
userId
);
log
.
info
(
"开始删除{}环境{}用户vcc_quota中的数据!"
,
namespace
,
phoneNo
);
SwitchDataSource
.
dataSourceSwitch
(
namespace
,
"vcc_quota"
);
jdbcTemplate
.
execute
(
"DELETE FROM `user_quota_locker` WHERE user_id = "
+
userId
);
jdbcTemplate
.
execute
(
"DELETE FROM `user_quota_log` WHERE user_id = "
+
userId
);
jdbcTemplate
.
execute
(
"DELETE FROM `user_quota_record` WHERE user_id = "
+
userId
);
return
true
;
}
}
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