Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
有来技术
youlai-mall
提交
10868fb2
Y
youlai-mall
项目概览
有来技术
/
youlai-mall
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
youlai-mall
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
10868fb2
编写于
1月 13, 2022
作者:
郝
郝先瑞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: 代码优化
上级
e845ed5b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
6 addition
and
131 deletion
+6
-131
mall-ums/ums-boot/src/main/java/com/youlai/mall/ums/config/SwaggerConfiguration.java
...java/com/youlai/mall/ums/config/SwaggerConfiguration.java
+2
-4
mall-ums/ums-boot/src/main/java/com/youlai/mall/ums/controller/admin/MemberController.java
...om/youlai/mall/ums/controller/admin/MemberController.java
+4
-4
mall-ums/ums-boot/src/main/java/com/youlai/mall/ums/controller/admin/RechargeController.java
.../youlai/mall/ums/controller/admin/RechargeController.java
+0
-122
mall-ums/ums-boot/src/main/java/com/youlai/mall/ums/mapper/UmsUserMapper.java
...c/main/java/com/youlai/mall/ums/mapper/UmsUserMapper.java
+0
-1
未找到文件。
mall-ums/ums-boot/src/main/java/com/youlai/mall/ums/config/SwaggerConfiguration.java
浏览文件 @
10868fb2
...
...
@@ -19,16 +19,14 @@ import java.util.ArrayList;
import
java.util.List
;
/**
* @Author haoxr
* @Date 2021-02-25 15:36
* @Version 1.0.0
* @author haoxr
* @date 2021/02/25 15:36
*/
@Configuration
@EnableSwagger2WebMvc
@Import
(
BeanValidatorPluginsConfiguration
.
class
)
public
class
SwaggerConfiguration
{
@Bean
public
Docket
restApi
()
{
//schema
...
...
mall-ums/ums-boot/src/main/java/com/youlai/mall/ums/controller/admin/MemberController.java
浏览文件 @
10868fb2
...
...
@@ -3,6 +3,7 @@ package com.youlai.mall.ums.controller.admin;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.youlai.common.constant.GlobalConstants
;
import
com.youlai.common.result.Result
;
import
com.youlai.mall.ums.pojo.entity.UmsMember
;
import
com.youlai.mall.ums.service.IUmsMemberService
;
...
...
@@ -12,11 +13,9 @@ import io.swagger.annotations.ApiOperation;
import
io.swagger.annotations.ApiParam
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Arrays
;
import
java.util.List
;
import
static
com
.
youlai
.
common
.
constant
.
GlobalConstants
.
STATUS_YES
;
@Api
(
tags
=
"系统管理_会员中心"
)
@RestController
...
...
@@ -73,10 +72,11 @@ public class MemberController {
@ApiOperation
(
value
=
"删除会员"
)
@DeleteMapping
(
"/{ids}"
)
public
<
T
>
Result
<
T
>
delete
(
@ApiParam
(
"会员ID,多个以英文逗号(,)拼接"
)
@PathVariable
String
ids
)
{
@ApiParam
(
"会员ID,多个以英文逗号(,)拼接"
)
@PathVariable
String
ids
)
{
boolean
status
=
iUmsMemberService
.
update
(
new
LambdaUpdateWrapper
<
UmsMember
>()
.
in
(
UmsMember:
:
getId
,
Arrays
.
asList
(
ids
.
split
(
","
)))
.
set
(
UmsMember:
:
getDeleted
,
STATUS_YES
));
.
set
(
UmsMember:
:
getDeleted
,
GlobalConstants
.
STATUS_YES
));
return
Result
.
judge
(
status
);
}
}
mall-ums/ums-boot/src/main/java/com/youlai/mall/ums/controller/admin/RechargeController.java
已删除
100644 → 0
浏览文件 @
e845ed5b
package
com.youlai.mall.ums.controller.admin
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONUtil
;
import
com.youlai.common.result.Result
;
import
com.youlai.mall.ums.pojo.entity.UmsMember
;
import
com.youlai.mall.ums.pojo.dto.RechargeDTO
;
import
com.youlai.mall.ums.pojo.dto.ResultPayDTO
;
import
com.youlai.mall.ums.service.IUmsMemberService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.http.HttpStatus
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.HttpEntity
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.client.RestTemplate
;
import
java.util.HashMap
;
import
java.util.Map
;
@Api
(
tags
=
"系统管理端-会员充值"
)
@RestController
(
"AdminRechargeController"
)
@RequestMapping
(
"/api/v1/recharge-orders"
)
@Slf4j
public
class
RechargeController
{
@Autowired
private
RestTemplate
restTemplate
;
@Value
(
"${zzf.CreateOrderURL}"
)
private
String
createOrderURL
;
@Value
(
"${zzf.FindOrderURL}"
)
private
String
findOrderURL
;
@Value
(
"${zzf.AppKey}"
)
private
String
appKey
;
@Value
(
"${zzf.AppSecret}"
)
private
String
appSecret
;
@ApiOperation
(
value
=
"账户余额充值订单"
)
@PostMapping
public
Result
recharge
(
@RequestBody
RechargeDTO
rechargeDTO
)
{
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
set
(
HttpHeaders
.
CONTENT_TYPE
,
MediaType
.
APPLICATION_FORM_URLENCODED_VALUE
);
headers
.
set
(
"Payment-Key"
,
appKey
);
headers
.
set
(
"Payment-Secret"
,
appSecret
);
HttpEntity
<
Map
>
httpEntity
=
new
HttpEntity
<>(
null
,
headers
);
String
url
=
createOrderURL
+
"?price="
+
rechargeDTO
.
getPrice
()
+
"&name="
+
rechargeDTO
.
getName
()
+
"&thirduid="
+
rechargeDTO
.
getThirduid
();
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
postForEntity
(
url
,
httpEntity
,
String
.
class
);
int
statusCode
=
responseEntity
.
getStatusCode
().
value
();
if
(
statusCode
==
HttpStatus
.
SC_OK
)
{
String
responseBody
=
responseEntity
.
getBody
();
JSONObject
jsonObject
=
JSONUtil
.
parseObj
(
responseBody
);
if
(
jsonObject
.
getStr
(
"code"
).
equals
(
"10001"
))
{
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
resultMap
.
put
(
"name"
,
jsonObject
.
getStr
(
"name"
));
resultMap
.
put
(
"price"
,
jsonObject
.
getStr
(
"price"
));
resultMap
.
put
(
"orderId"
,
jsonObject
.
getStr
(
"orderId"
));
return
Result
.
success
(
resultMap
);
}
else
{
return
Result
.
failed
(
jsonObject
.
getStr
(
"msg"
));
}
}
return
Result
.
failed
();
}
/**
* 订单支付状态查询
*/
@ResponseBody
@GetMapping
(
"/{id}"
)
public
Object
findOrderState
(
@PathVariable
String
id
)
{
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
set
(
HttpHeaders
.
CONTENT_TYPE
,
MediaType
.
APPLICATION_FORM_URLENCODED_VALUE
);
headers
.
set
(
"Payment-Key"
,
appKey
);
headers
.
set
(
"Payment-Secret"
,
appSecret
);
String
url
=
findOrderURL
+
"?orderId="
+
id
;
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
getForEntity
(
url
,
String
.
class
);
int
statusCode
=
responseEntity
.
getStatusCode
().
value
();
if
(
statusCode
==
HttpStatus
.
SC_OK
)
{
String
responseBody
=
responseEntity
.
getBody
();
JSONObject
jsonObject
=
JSONUtil
.
parseObj
(
responseBody
);
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
resultMap
.
put
(
"code"
,
jsonObject
.
getStr
(
"code"
));
resultMap
.
put
(
"msg"
,
jsonObject
.
getStr
(
"msg"
));
return
Result
.
success
(
resultMap
);
}
return
Result
.
failed
();
}
private
IUmsMemberService
iUmsMemberService
;
@PostMapping
(
value
=
"/callback"
)
public
void
receiveCallBack
(
@RequestBody
ResultPayDTO
resultPay
)
{
log
.
info
(
"recharge callback:{}"
,
resultPay
.
toString
());
//处理自己的业务逻辑
//例如开通会员、用户充值等等。。。
String
thirduid
=
resultPay
.
getThirduid
();
UmsMember
user
=
iUmsMemberService
.
getById
(
thirduid
);
if
(
user
!=
null
)
{
user
.
setBalance
((
long
)
(
user
.
getBalance
()
+
Float
.
valueOf
(
resultPay
.
getPrice
())
*
100
*
10000
));
}
iUmsMemberService
.
updateById
(
user
);
}
}
mall-ums/ums-boot/src/main/java/com/youlai/mall/ums/mapper/UmsUserMapper.java
浏览文件 @
10868fb2
...
...
@@ -15,7 +15,6 @@ import java.util.List;
@Mapper
public
interface
UmsUserMapper
extends
BaseMapper
<
UmsMember
>
{
@Select
(
"<script>"
+
" SELECT * from ums_member "
+
" <if test ='nickname !=null and nickname.trim() neq \"\" ' >"
+
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录