Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
payment
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
iuav
payment
Commits
ba450561
提交
ba450561
authored
5月 29, 2023
作者:
张小凤
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
payment(add)
上级
7257442b
隐藏空白字符变更
内嵌
并排
正在显示
19 个修改的文件
包含
1171 行增加
和
611 行删除
+1171
-611
pom.xml
pom.xml
+1
-16
BaseController.java
src/main/java/com/mmc/payment/common/BaseController.java
+13
-2
ResultEnum.java
src/main/java/com/mmc/payment/common/ResultEnum.java
+3
-1
Tenant.java
src/main/java/com/mmc/payment/common/Tenant.java
+80
-0
Audience.java
src/main/java/com/mmc/payment/config/Audience.java
+21
-0
AuthHandler.java
src/main/java/com/mmc/payment/config/AuthHandler.java
+170
-151
TenantContext.java
src/main/java/com/mmc/payment/config/TenantContext.java
+64
-0
RepoCashController.java
...n/java/com/mmc/payment/controller/RepoCashController.java
+61
-55
RepoCashDao.java
src/main/java/com/mmc/payment/dao/RepoCashDao.java
+12
-12
OrderInfoDO.java
src/main/java/com/mmc/payment/entity/OrderInfoDO.java
+148
-0
AuthFilter.java
src/main/java/com/mmc/payment/filter/AuthFilter.java
+19
-0
AuthSignatureFilter.java
...main/java/com/mmc/payment/filter/AuthSignatureFilter.java
+148
-0
BaseAccountDTO.java
src/main/java/com/mmc/payment/model/dto/BaseAccountDTO.java
+17
-43
RepoCashVO.java
src/main/java/com/mmc/payment/model/vo/RepoCashVO.java
+39
-25
RepoAccountServiceImpl.java
.../com/mmc/payment/service/Impl/RepoAccountServiceImpl.java
+50
-44
RepoCashServiceImpl.java
...ava/com/mmc/payment/service/Impl/RepoCashServiceImpl.java
+236
-194
RepoCashService.java
src/main/java/com/mmc/payment/service/RepoCashService.java
+16
-16
application-local.yml
src/main/resources/application-local.yml
+4
-0
RepoCashDao.xml
src/main/resources/mapper/RepoCashDao.xml
+69
-52
没有找到文件。
pom.xml
浏览文件 @
ba450561
...
@@ -19,11 +19,6 @@
...
@@ -19,11 +19,6 @@
<dependencies>
<dependencies>
<dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
<scope>
test
</scope>
</dependency>
</dependency>
...
@@ -76,22 +71,12 @@
...
@@ -76,22 +71,12 @@
<version>
3.0.0
</version>
<version>
3.0.0
</version>
<!--<scope>compile</scope>-->
<!--<scope>compile</scope>-->
</dependency>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
fastjson
</artifactId>
<version>
2.0.32
</version>
</dependency>
<dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-redis
</artifactId>
<artifactId>
spring-boot-starter-data-redis
</artifactId>
</dependency>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
...
src/main/java/com/mmc/payment/common/BaseController.java
浏览文件 @
ba450561
package
com
.
mmc
.
payment
.
common
;
package
com
.
mmc
.
payment
.
common
;
import
com.alibaba.fastjson.JSONObject
;
import
com.mmc.payment.config.AuthHandler
;
import
com.mmc.payment.config.AuthHandler
;
import
com.mmc.payment.exception.BizException
;
import
com.mmc.payment.jwt.JwtConstant
;
import
com.mmc.payment.jwt.JwtConstant
;
import
com.mmc.payment.model.dto.BaseAccountDTO
;
import
com.mmc.payment.model.dto.BaseAccountDTO
;
import
com.mmc.payment.model.dto.CurrentUserDTO
;
import
com.mmc.payment.model.dto.CurrentUserDTO
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
...
@@ -18,6 +22,8 @@ public abstract class BaseController {
...
@@ -18,6 +22,8 @@ public abstract class BaseController {
@Autowired
@Autowired
private
AuthHandler
authHandler
;
private
AuthHandler
authHandler
;
@Autowired
private
StringRedisTemplate
stringRedisTemplate
;
/**
/**
* 获取当前用户
* 获取当前用户
*
*
...
@@ -35,7 +41,12 @@ public abstract class BaseController {
...
@@ -35,7 +41,12 @@ public abstract class BaseController {
* 获取当前登录账号信息
* 获取当前登录账号信息
*/
*/
public
BaseAccountDTO
getCurrentAccount
(
HttpServletRequest
request
)
{
public
BaseAccountDTO
getCurrentAccount
(
HttpServletRequest
request
)
{
String
token
=
request
.
getHeader
(
JwtConstant
.
TOKENKEY
);
String
token
=
request
.
getHeader
(
"token"
);
return
authHandler
.
getCurrentAccount
(
token
);
String
json
=
stringRedisTemplate
.
opsForValue
().
get
(
token
);
if
(
StringUtils
.
isBlank
(
json
)){
throw
new
BizException
(
ResultEnum
.
LOGIN_ACCOUNT_STATUS_ERROR
);
}
BaseAccountDTO
baseAccountDTO
=
JSONObject
.
parseObject
(
json
,
BaseAccountDTO
.
class
);
return
baseAccountDTO
;
}
}
}
}
src/main/java/com/mmc/payment/common/ResultEnum.java
浏览文件 @
ba450561
...
@@ -395,7 +395,9 @@ public enum ResultEnum implements BaseErrorInfoInterface {
...
@@ -395,7 +395,9 @@ public enum ResultEnum implements BaseErrorInfoInterface {
HELP_FAIL_ERROR
(
"2009"
,
"不能给自己助力哦!"
),
HELP_FAIL_ERROR
(
"2009"
,
"不能给自己助力哦!"
),
ALREADY_BINDING_ERROR
(
"2010"
,
"优惠券已被绑定"
),
ALREADY_BINDING_ERROR
(
"2010"
,
"优惠券已被绑定"
),
ALREADY_DIVIDE_ERROR
(
"2011"
,
"订单已分成"
),
ALREADY_DIVIDE_ERROR
(
"2011"
,
"订单已分成"
),
DIVIDE_OBJ_NOT_EXIST
(
"2012"
,
"先点击确认添加分成对象"
);
DIVIDE_OBJ_NOT_EXIST
(
"2012"
,
"先点击确认添加分成对象"
),
THE_REQUEST_IS_NOT_AUTHENTICATED
(
"2013"
,
"请求未经过鉴权"
),
THE_TOKEN_IS_INVALID
(
"2014"
,
"token失效"
)
;;
/**
/**
* 错误码
* 错误码
...
...
src/main/java/com/mmc/payment/common/Tenant.java
0 → 100644
浏览文件 @
ba450561
package
com
.
mmc
.
payment
.
common
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @Author small
* @Date 2023/5/29 10:38
* @Version 1.0
*/
@Data
public
class
Tenant
implements
Serializable
{
/**
* 用户id
*/
private
Integer
userId
;
/**
* 所在机构id
*/
private
Integer
tenantId
;
/**
* 用户名称
*/
private
String
userName
;
/**
* 管理机构id集合
*/
private
String
tenantIds
;
/**
* 菜单路由路径集合
*/
private
String
token
;
/**
* 角色id
*/
private
Integer
roleId
;
/**
* 角色类型,1超管 2其他角色
*/
private
Integer
roleType
;
public
Tenant
(
String
userName
)
{
this
.
userId
=
userId
;
this
.
tenantId
=
tenantId
;
this
.
userName
=
userName
;
this
.
tenantIds
=
tenantIds
;
this
.
token
=
token
;
this
.
roleId
=
roleId
;
this
.
roleType
=
roleType
;
}
/**
* userid相同,认为是同个用户
*
* @param o
* @return
*/
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
{
return
true
;
}
if
(
o
instanceof
Tenant
)
{
Tenant
tenant
=
(
Tenant
)
o
;
return
getUserId
().
equals
(
tenant
.
getUserId
());
}
else
{
return
false
;
}
}
@Override
public
int
hashCode
()
{
int
result
=
17
;
result
=
31
*
result
+
getUserId
().
hashCode
();
return
result
;
}
}
src/main/java/com/mmc/payment/config/Audience.java
0 → 100644
浏览文件 @
ba450561
package
com
.
mmc
.
payment
.
config
;
import
lombok.Data
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.stereotype.Component
;
/**
* @Author small
* @Date 2023/5/29 10:39
* @Version 1.0
*/
@Data
@ConfigurationProperties
(
prefix
=
"audience"
)
@Component
public
class
Audience
{
private
String
clientId
;
private
String
base64Secret
;
private
String
name
;
private
long
expiresSecond
;
}
src/main/java/com/mmc/payment/config/AuthHandler.java
浏览文件 @
ba450561
...
@@ -17,166 +17,185 @@ import java.util.*;
...
@@ -17,166 +17,185 @@ import java.util.*;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeUnit
;
/**
/**
* @Author small
* @Author small @Date 2023/5/23 19:22 @Version 1.0
* @Date 2023/5/23 19:22
* @Version 1.0
*/
*/
@Component
@Component
public
class
AuthHandler
{
public
class
AuthHandler
{
@Autowired
@Autowired
private
StringRedisTemplate
stringRedisTemplate
;
private
StringRedisTemplate
stringRedisTemplate
;
/**
/**
* 获取当前用户
* 获取当前用户
*
*
* @param request
* @param request
* @return
* @return
*/
*/
// public CurrentUserDTO getCurrentUser(HttpServletRequest request) {
// public CurrentUserDTO getCurrentUser(HttpServletRequest request) {
// // 登录未做好-统一通过此方法获取当前用户信息
// // 登录未做好-统一通过此方法获取当前用户信息
// Integer id = Integer.parseInt(request.getHeader(JwtConstant.USERIDKEY).toString());
// Integer id = Integer.parseInt(request.getHeader(JwtConstant.USERIDKEY).toString());
// Integer roleId = Integer.parseInt(request.getHeader(JwtConstant.ROLEIDKEY).toString());
// Integer roleId = Integer.parseInt(request.getHeader(JwtConstant.ROLEIDKEY).toString());
// return CurrentUserDTO.builder().id(id).roleId(roleId).build();
// return CurrentUserDTO.builder().id(id).roleId(roleId).build();
// }
// }
/** 获取当前登录账号信息 */
/**
public
BaseAccountDTO
getCurrentAccount
(
String
token
)
{
* 获取当前登录账号信息
// 获取登录的基本信息
*/
String
json
=
stringRedisTemplate
.
opsForValue
().
get
(
token
);
public
BaseAccountDTO
getCurrentAccount
(
String
token
)
{
if
(
StringUtils
.
isEmpty
(
json
))
{
// 获取登录的基本信息
throw
new
BizException
(
ResultEnum
.
LOGIN_ACCOUNT_STATUS_ERROR
);
String
json
=
stringRedisTemplate
.
opsForValue
().
get
(
token
);
if
(
StringUtils
.
isEmpty
(
json
))
{
throw
new
BizException
(
ResultEnum
.
LOGIN_ACCOUNT_STATUS_ERROR
);
}
BaseAccountDTO
account
=
JsonUtil
.
parseJsonToObj
(
json
,
BaseAccountDTO
.
class
);
// 如果是PC管理端-获取部门缓存信息
if
(
JwtConstant
.
SXTB_ACCOUNT_TOKEN
.
equals
(
account
.
getTokenPort
()))
{
account
.
getCompanyInfo
().
setCompanys
(
this
.
getCompanys
(
account
.
getCompanyInfo
().
getId
()));
}
return
account
;
}
}
BaseAccountDTO
account
=
JsonUtil
.
parseJsonToObj
(
json
,
BaseAccountDTO
.
class
);
public
String
addLoginCache
(
Integer
userId
,
Integer
roleId
,
String
tokenType
,
BaseAccountDTO
loginInfo
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
// 如果是PC管理端-获取部门缓存信息
map
.
put
(
JwtConstant
.
USERIDKEY
,
userId
);
/* if (JwtConstant.SXTB_ACCOUNT_TOKEN.equals(account.getTokenPort())) {
map
.
put
(
JwtConstant
.
ROLEIDKEY
,
roleId
);
account.getCompanyInfo().setCompanys(this.getCompanys(account.getCompanyInfo().getId()));
map
.
put
(
JwtConstant
.
TOKEN_TYPE
,
tokenType
);
}*/
String
token
=
JwtUtil
.
createJwt
(
map
);
return
account
;
loginInfo
.
setTokenPort
(
tokenType
);
}
// 缓存登录token-jwt
public
String
addLoginCache
(
stringRedisTemplate
.
opsForValue
().
set
(
Integer
userId
,
Integer
roleId
,
String
tokenType
,
BaseAccountDTO
loginInfo
)
{
RedisConstant
.
createLoginTokenKey
(
tokenType
,
roleId
.
toString
(),
userId
.
toString
()),
token
,
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
JwtConstant
.
EXPIRATION
,
TimeUnit
.
MILLISECONDS
);
map
.
put
(
JwtConstant
.
USERIDKEY
,
userId
);
map
.
put
(
JwtConstant
.
ROLEIDKEY
,
roleId
);
// 平台PC管理端登录保存-单位的id及无限下级id集合
map
.
put
(
JwtConstant
.
TOKEN_TYPE
,
tokenType
);
if
(
JwtConstant
.
SXTB_ACCOUNT_TOKEN
.
equals
(
tokenType
))
{
String
token
=
JwtUtil
.
createJwt
(
map
);
if
(
loginInfo
.
getCompanyInfo
()
!=
null
&&
!
CollectionUtils
.
isEmpty
(
loginInfo
.
getCompanyInfo
().
getCompanys
()))
{
// loginInfo.setTokenPort(tokenType);
List
<
Integer
>
companys
=
loginInfo
.
getCompanyInfo
().
getCompanys
();
this
.
refreshCompanys
(
companys
,
loginInfo
.
getCompanyInfo
().
getId
());
// 缓存登录token-jwt
// 置为null--省内存
stringRedisTemplate
loginInfo
.
getCompanyInfo
().
setCompanys
(
null
);
.
opsForValue
()
}
.
set
(
}
RedisConstant
.
createLoginTokenKey
(
tokenType
,
roleId
.
toString
(),
userId
.
toString
()),
// 缓存登录对象
token
,
stringRedisTemplate
.
opsForValue
().
set
(
token
,
JsonUtil
.
parseObjToJson
(
loginInfo
),
JwtConstant
.
EXPIRATION
,
JwtConstant
.
EXPIRATION
,
TimeUnit
.
MILLISECONDS
);
TimeUnit
.
MILLISECONDS
);
return
token
;
// 平台PC管理端登录保存-单位的id及无限下级id集合
if
(
JwtConstant
.
SXTB_ACCOUNT_TOKEN
.
equals
(
tokenType
))
{
/* if (loginInfo.getCompanyInfo() != null && !CollectionUtils.isEmpty(loginInfo.getCompanyInfo().getCompanys())) {
List<Integer> companys = loginInfo.getCompanyInfo().getCompanys();
this.refreshCompanys(companys, loginInfo.getCompanyInfo().getId());
// 置为null--省内存
loginInfo.getCompanyInfo().setCompanys(null);
}*/
}
}
// 缓存登录对象
/**
stringRedisTemplate
* 更新单位缓存
.
opsForValue
()
*
.
set
(
* @param companys
token
,
* @param companyId
JsonUtil
.
parseObjToJson
(
loginInfo
),
*/
JwtConstant
.
EXPIRATION
,
public
void
refreshCompanys
(
List
<
Integer
>
companys
,
Integer
companyId
)
{
TimeUnit
.
MILLISECONDS
);
String
key
=
RedisConstant
.
getCompanyChildKey
(
companyId
);
return
token
;
stringRedisTemplate
.
opsForValue
().
set
(
}
key
,
JsonUtil
.
parseObjToJson
(
companys
),
JwtConstant
.
EXPIRATION
,
TimeUnit
.
MILLISECONDS
);
/**
* 更新单位缓存
*
* @param companys
* @param companyId
*/
public
void
refreshCompanys
(
List
<
Integer
>
companys
,
Integer
companyId
)
{
String
key
=
RedisConstant
.
getCompanyChildKey
(
companyId
);
stringRedisTemplate
.
opsForValue
()
.
set
(
key
,
JsonUtil
.
parseObjToJson
(
companys
),
JwtConstant
.
EXPIRATION
,
TimeUnit
.
MILLISECONDS
);
}
public
List
<
Integer
>
getCompanys
(
Integer
companyId
)
{
String
key
=
RedisConstant
.
getCompanyChildKey
(
companyId
);
if
(
stringRedisTemplate
.
hasKey
(
key
))
{
String
json
=
stringRedisTemplate
.
opsForValue
().
get
(
key
);
if
(!
StringUtils
.
isEmpty
(
json
))
{
List
<
Integer
>
list
=
JSONArray
.
parseArray
(
json
,
Integer
.
class
);
return
list
;
}
}
}
return
new
ArrayList
<
Integer
>();
public
List
<
Integer
>
getCompanys
(
Integer
companyId
)
{
}
String
key
=
RedisConstant
.
getCompanyChildKey
(
companyId
);
if
(
stringRedisTemplate
.
hasKey
(
key
))
{
public
void
updateLoginCache
(
String
token
,
BaseAccountDTO
loginInfo
)
{
String
json
=
stringRedisTemplate
.
opsForValue
().
get
(
key
);
stringRedisTemplate
if
(!
StringUtils
.
isEmpty
(
json
))
{
.
opsForValue
()
List
<
Integer
>
list
=
JSONArray
.
parseArray
(
json
,
Integer
.
class
);
.
set
(
return
list
;
token
,
}
JsonUtil
.
parseObjToJson
(
loginInfo
),
}
JwtConstant
.
EXPIRATION
,
return
new
ArrayList
<
Integer
>();
TimeUnit
.
MILLISECONDS
);
}
/**
* 检验缓存token是否存在
*
* @param token
* @return
*/
public
boolean
hasToken
(
String
token
)
{
return
stringRedisTemplate
.
hasKey
(
token
);
}
/**
* 检验token是否进了失效名单 && 检验token是否为最新token
*
* @param token
* @return
*/
public
boolean
isDisableToken
(
String
token
)
{
List
<
String
>
disableTokens
=
stringRedisTemplate
.
opsForList
()
.
range
(
RedisConstant
.
DISABLE_TOKEN_LIST
,
0
,
-
1
);
// 需要强制失效的token
return
(!
CollectionUtils
.
isEmpty
(
disableTokens
)
&&
disableTokens
.
contains
(
token
));
}
/**
* 检测是否为最新的token
*
* @param userId
* @param roleId
* @param tokenType
*/
public
boolean
isLatestToken
(
String
userId
,
String
roleId
,
String
tokenType
,
String
token
)
{
String
key
=
RedisConstant
.
createLoginTokenKey
(
tokenType
,
roleId
,
userId
);
return
(
token
.
equals
(
stringRedisTemplate
.
opsForValue
().
get
(
key
)));
}
public
String
getUserToken
(
Integer
userAccountId
,
Integer
roleId
,
String
tokenType
)
{
String
token
=
stringRedisTemplate
.
opsForValue
()
.
get
(
RedisConstant
.
createLoginTokenKey
(
tokenType
,
roleId
.
toString
(),
userAccountId
.
toString
()));
// 查询他的token
return
token
;
}
public
void
disableOneToken
(
Integer
userAccountId
,
Integer
roleId
,
String
tokenType
)
{
String
token
=
this
.
getUserToken
(
userAccountId
,
roleId
,
tokenType
);
// 查询他的token
if
(!
StringUtils
.
isEmpty
(
token
))
{
stringRedisTemplate
.
opsForList
()
.
leftPush
(
RedisConstant
.
DISABLE_TOKEN_LIST
,
token
);
// 加入token失效列表
}
}
String
cacheLoginKey
=
RedisConstant
.
createLoginCacheKey
(
tokenType
,
userAccountId
);
public
void
updateLoginCache
(
String
token
,
BaseAccountDTO
loginInfo
)
{
stringRedisTemplate
.
delete
(
cacheLoginKey
);
// 删除登录信息
stringRedisTemplate
.
opsForValue
().
set
(
token
,
JsonUtil
.
parseObjToJson
(
loginInfo
),
JwtConstant
.
EXPIRATION
,
}
TimeUnit
.
MILLISECONDS
);
public
void
disableListToken
(
List
<
Integer
>
userAccountIds
,
Integer
roleId
,
String
tokenType
)
{
Set
<
String
>
tokenKeyList
=
stringRedisTemplate
.
keys
(
RedisConstant
.
tokenPreFix
(
tokenType
,
roleId
.
toString
())
+
"*"
);
// 模糊查询所有key
if
(!
CollectionUtils
.
isEmpty
(
tokenKeyList
))
{
List
<
String
>
tokenList
=
stringRedisTemplate
.
opsForValue
().
multiGet
(
tokenKeyList
);
stringRedisTemplate
.
opsForList
().
leftPushAll
(
RedisConstant
.
DISABLE_TOKEN_LIST
,
tokenList
);
}
}
/**
userAccountIds
.
forEach
(
* 检验缓存token是否存在
id
->
{
*
String
cacheLoginKey
=
RedisConstant
.
createLoginCacheKey
(
tokenType
,
id
);
* @param token
stringRedisTemplate
.
delete
(
cacheLoginKey
);
* @return
*/
public
boolean
hasToken
(
String
token
)
{
return
stringRedisTemplate
.
hasKey
(
token
);
}
/**
* 检验token是否进了失效名单 && 检验token是否为最新token
*
* @param token
* @return
*/
public
boolean
isDisableToken
(
String
token
)
{
List
<
String
>
disableTokens
=
stringRedisTemplate
.
opsForList
().
range
(
RedisConstant
.
DISABLE_TOKEN_LIST
,
0
,
-
1
);
// 需要强制失效的token
return
(!
CollectionUtils
.
isEmpty
(
disableTokens
)
&&
disableTokens
.
contains
(
token
));
}
/**
* 检测是否为最新的token
*
* @param userId
* @param roleId
* @param tokenType
*/
public
boolean
isLatestToken
(
String
userId
,
String
roleId
,
String
tokenType
,
String
token
)
{
String
key
=
RedisConstant
.
createLoginTokenKey
(
tokenType
,
roleId
,
userId
);
return
(
token
.
equals
(
stringRedisTemplate
.
opsForValue
().
get
(
key
)));
}
public
String
getUserToken
(
Integer
userAccountId
,
Integer
roleId
,
String
tokenType
)
{
String
token
=
stringRedisTemplate
.
opsForValue
()
.
get
(
RedisConstant
.
createLoginTokenKey
(
tokenType
,
roleId
.
toString
(),
userAccountId
.
toString
()));
// 查询他的token
return
token
;
}
public
void
disableOneToken
(
Integer
userAccountId
,
Integer
roleId
,
String
tokenType
)
{
String
token
=
this
.
getUserToken
(
userAccountId
,
roleId
,
tokenType
);
// 查询他的token
if
(!
StringUtils
.
isEmpty
(
token
))
{
stringRedisTemplate
.
opsForList
().
leftPush
(
RedisConstant
.
DISABLE_TOKEN_LIST
,
token
);
// 加入token失效列表
}
String
cacheLoginKey
=
RedisConstant
.
createLoginCacheKey
(
tokenType
,
userAccountId
);
stringRedisTemplate
.
delete
(
cacheLoginKey
);
// 删除登录信息
}
public
void
disableListToken
(
List
<
Integer
>
userAccountIds
,
Integer
roleId
,
String
tokenType
)
{
Set
<
String
>
tokenKeyList
=
stringRedisTemplate
.
keys
(
RedisConstant
.
tokenPreFix
(
tokenType
,
roleId
.
toString
())
+
"*"
);
// 模糊查询所有key
if
(!
CollectionUtils
.
isEmpty
(
tokenKeyList
))
{
List
<
String
>
tokenList
=
stringRedisTemplate
.
opsForValue
().
multiGet
(
tokenKeyList
);
stringRedisTemplate
.
opsForList
().
leftPushAll
(
RedisConstant
.
DISABLE_TOKEN_LIST
,
tokenList
);
}
userAccountIds
.
forEach
(
id
->
{
String
cacheLoginKey
=
RedisConstant
.
createLoginCacheKey
(
tokenType
,
id
);
stringRedisTemplate
.
delete
(
cacheLoginKey
);
});
});
}
}
}
}
src/main/java/com/mmc/payment/config/TenantContext.java
0 → 100644
浏览文件 @
ba450561
package
com
.
mmc
.
payment
.
config
;
import
com.mmc.payment.common.Tenant
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
/**
* @Author small
* @Date 2023/5/29 10:38
* @Version 1.0
*/
@Slf4j
public
class
TenantContext
{
private
static
ThreadLocal
<
Tenant
>
tenantHolder
=
new
ThreadLocal
<>();
public
static
void
setTenant
(
Tenant
tenant
)
{
tenantHolder
.
set
(
tenant
);
}
public
static
Tenant
getTenant
()
{
return
tenantHolder
.
get
();
}
public
static
Integer
getUserId
()
{
return
getTenant
().
getUserId
();
}
public
static
Integer
getTenantId
()
{
return
getTenant
().
getTenantId
();
}
public
static
Integer
getRoleId
()
{
return
getTenant
().
getRoleId
();
}
public
static
boolean
exists
()
{
return
getTenant
()
!=
null
;
}
public
static
void
clear
()
{
tenantHolder
.
remove
();
}
public
static
Tenant
buildTenant
(
String
accountNo
)
{
if
(
StringUtils
.
isBlank
(
accountNo
))
{
log
.
error
(
"登录信息[accountNo]获取异常"
);
return
null
;
}
return
new
Tenant
(
accountNo
);
}
/**
* valid tenantId is correct
*/
private
static
boolean
validNumeric
(
String
number
)
{
return
StringUtils
.
isNotEmpty
(
number
)
&&
StringUtils
.
isNumeric
(
number
);
}
}
src/main/java/com/mmc/payment/controller/RepoCashController.java
浏览文件 @
ba450561
...
@@ -14,6 +14,7 @@ import io.swagger.annotations.ApiOperation;
...
@@ -14,6 +14,7 @@ import io.swagger.annotations.ApiOperation;
import
io.swagger.annotations.ApiResponse
;
import
io.swagger.annotations.ApiResponse
;
import
io.swagger.annotations.ApiResponses
;
import
io.swagger.annotations.ApiResponses
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
springfox.documentation.annotations.ApiIgnore
;
import
springfox.documentation.annotations.ApiIgnore
;
...
@@ -21,72 +22,77 @@ import javax.servlet.http.HttpServletRequest;
...
@@ -21,72 +22,77 @@ import javax.servlet.http.HttpServletRequest;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
/**
/**
* @Author small
* @Author small @Date 2023/5/24 9:53 @Version 1.0
* @Date 2023/5/24 9:53
* @Version 1.0
*/
*/
@Api
(
tags
=
{
"消耗-现金-接口"
})
@Api
(
tags
=
{
"现金管理"
})
@RestController
@RestController
@RequestMapping
(
"/repocash/"
)
@RequestMapping
(
"/repocash/"
)
public
class
RepoCashController
{
public
class
RepoCashController
extends
BaseController
{
@Autowired
@Autowired
private
RepoCashService
repoCashService
;
private
RepoCashService
repoCashService
;
@Autowired
private
StringRedisTemplate
stringRedisTemplate
;
@ApiOperation
(
value
=
"支付订单-充值扣款"
)
@ApiOperation
(
value
=
"web-订单支付"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
PayCashResultDTO
.
class
)
})
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
PayCashResultDTO
.
class
)})
@ApiIgnore
@PostMapping
(
"orderPayment"
)
@PostMapping
(
"PayCashOrder"
)
public
PayCashResultDTO
orderPayment
(
HttpServletRequest
request
,
@RequestParam
String
orderNo
)
{
public
PayCashResultDTO
feignPayCashOrder
(
@RequestBody
RepoOrderPayVO
orderPay
)
{
return
repoCashService
.
orderPayment
(
this
.
getCurrentAccount
(
request
),
orderNo
);
return
repoCashService
.
payCashOrder
(
orderPay
);
}
}
@ApiIgnore
@ApiOperation
(
value
=
"支付订单-充值扣款"
)
@ApiOperation
(
value
=
"当前用户剩余的余额"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
PayCashResultDTO
.
class
)})
@GetMapping
(
"RemainingBalance"
)
@ApiIgnore
public
BigDecimal
RemainingBalance
(
@RequestParam
(
value
=
"repoAccountId"
,
required
=
true
)
Integer
repoAccountId
)
{
@PostMapping
(
"PayCashOrder"
)
return
repoCashService
.
RemainingBalance
(
repoAccountId
);
public
PayCashResultDTO
feignPayCashOrder
(
@RequestBody
RepoOrderPayVO
orderPay
)
{
}
return
repoCashService
.
payCashOrder
(
orderPay
);
}
@ApiOperation
(
value
=
"余额变更-分页-列表"
)
@ApiOperation
(
value
=
"当前用户剩余的余额"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
RepoCashDTO
.
class
)
})
@GetMapping
(
"RemainingBalance"
)
@PostMapping
(
"listPageCash"
)
public
BigDecimal
RemainingBalance
(
public
ResultBody
listPageCash
(
@RequestBody
RepoCashQO
param
)
{
@RequestParam
(
value
=
"repoAccountId"
,
required
=
true
)
Integer
repoAccountId
)
{
return
ResultBody
.
success
(
repoCashService
.
listPageRepoCash
(
param
));
}
@ApiOperation
(
value
=
"余额变更-修改备注"
)
String
s
=
stringRedisTemplate
.
opsForValue
().
get
(
"R2023052814538712"
);
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)
})
return
repoCashService
.
RemainingBalance
(
repoAccountId
);
@GetMapping
(
"updateCashRemark"
)
}
public
ResultBody
updateCashRemark
(
@RequestParam
Integer
id
,
@RequestParam
()
String
remark
)
{
repoCashService
.
updateCashRemark
(
id
,
remark
);
return
ResultBody
.
success
();
}
@ApiOperation
(
value
=
"v1.0.1-NO现金-充值"
)
@ApiOperation
(
value
=
"余额变更-分页-列表"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)
})
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
RepoCashDTO
.
class
)})
@RepeatSubmit
@PostMapping
(
"listPageCash"
)
@PostMapping
(
"reqCash"
)
public
ResultBody
listPageCash
(
@RequestBody
RepoCashQO
param
)
{
public
ResultBody
reqCash
(
HttpServletRequest
request
,
@RequestBody
RepoCashVO
param
)
{
return
ResultBody
.
success
(
repoCashService
.
listPageRepoCash
(
param
));
return
repoCashService
.
reqCash
(
null
,
param
);
}
//repoCashService.reqCash(this.getCurrentAccount(request), param);
}
@ApiOperation
(
value
=
"v1.0.1-NO现金-手动扣除"
)
@ApiOperation
(
value
=
"余额变更-修改备注"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)
})
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)})
@RepeatSubmit
@GetMapping
(
"updateCashRemark"
)
@PostMapping
(
"dedCash"
)
public
ResultBody
updateCashRemark
(
@RequestParam
Integer
id
,
@RequestParam
()
String
remark
)
{
public
ResultBody
dedCash
(
HttpServletRequest
request
,
@RequestBody
RepoCashVO
param
)
{
repoCashService
.
updateCashRemark
(
id
,
remark
);
//repoCashService.dedCash(this.getCurrentAccount(request), param)
return
ResultBody
.
success
();
return
repoCashService
.
dedCash
(
null
,
param
);
}
}
@ApiOperation
(
value
=
"feign-查询退款金额"
)
@ApiOperation
(
value
=
"v1.0.1Yes-现金-充值"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
RepoCashDTO
.
class
)
})
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)})
@GetMapping
(
"feignRefundInfo"
)
@RepeatSubmit
public
RepoCashDTO
feignRefundInfo
(
@RequestParam
String
refundNo
)
{
@PostMapping
(
"reqCash"
)
return
repoCashService
.
getRefundInfo
(
refundNo
);
public
ResultBody
reqCash
(
HttpServletRequest
request
,
@RequestBody
RepoCashVO
param
)
{
}
return
repoCashService
.
reqCash
(
this
.
getCurrentAccount
(
request
),
param
);
}
@ApiOperation
(
value
=
"v1.0.1-Yes现金-手动扣除"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)})
@RepeatSubmit
@PostMapping
(
"dedCash"
)
public
ResultBody
dedCash
(
HttpServletRequest
request
,
@RequestBody
RepoCashVO
param
)
{
return
repoCashService
.
dedCash
(
this
.
getCurrentAccount
(
request
),
param
);
}
@ApiIgnore
@ApiOperation
(
value
=
"查询退款金额"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
RepoCashDTO
.
class
)})
@GetMapping
(
"feignRefundInfo"
)
public
RepoCashDTO
feignRefundInfo
(
@RequestParam
String
refundNo
)
{
return
repoCashService
.
getRefundInfo
(
refundNo
);
}
}
}
src/main/java/com/mmc/payment/dao/RepoCashDao.java
浏览文件 @
ba450561
...
@@ -9,27 +9,27 @@ import java.math.BigDecimal;
...
@@ -9,27 +9,27 @@ import java.math.BigDecimal;
import
java.util.List
;
import
java.util.List
;
/**
/**
* @Author small
* @Author small @Date 2023/5/24 10:10 @Version 1.0
* @Date 2023/5/24 10:10
* @Version 1.0
*/
*/
@Mapper
@Mapper
public
interface
RepoCashDao
{
public
interface
RepoCashDao
{
RepoCashDO
getRefundCashInfo
(
String
refundNo
);
RepoCashDO
getRefundCashInfo
(
String
refundNo
);
void
insertRepoCash
(
RepoCashDO
rc
);
void
insertRepoCash
(
RepoCashDO
rc
);
void
updateCashRemark
(
Integer
id
,
String
remark
);
void
updateCashRemark
(
Integer
id
,
String
remark
);
List
<
RepoCashDO
>
listPagePFRepoCash
(
RepoCashQO
param
);
List
<
RepoCashDO
>
listPagePFRepoCash
(
RepoCashQO
param
);
int
countPagePFRepoCash
(
RepoCashQO
param
);
int
countPagePFRepoCash
(
RepoCashQO
param
);
RepoWalletDO
getRepoWalletInfo
(
Integer
repoAccountId
);
RepoWalletDO
getRepoWalletInfo
(
Integer
repoAccountId
);
void
updateRepoWalletAmt
(
Integer
repoAccountId
,
BigDecimal
chageAmt
);
void
updateRepoWalletAmt
(
Integer
repoAccountId
,
BigDecimal
chageAmt
);
BigDecimal
RemainingBalance
(
Integer
repoAccountId
);
BigDecimal
RemainingBalance
(
Integer
repoAccountId
);
void
updateWalletAmt
(
Integer
repoAccountId
,
BigDecimal
addAmt
,
BigDecimal
addPaid
);
void
updateWalletAmt
(
Integer
repoAccountId
,
BigDecimal
addAmt
,
BigDecimal
addPaid
);
void
orderPayment
(
RepoCashDO
repoCashDO
);
}
}
src/main/java/com/mmc/payment/entity/OrderInfoDO.java
0 → 100644
浏览文件 @
ba450561
package
com
.
mmc
.
payment
.
entity
;
import
com.mmc.payment.model.dto.KdnExpDTO
;
import
com.mmc.payment.model.dto.OrderReceiptDTO
;
import
com.mmc.payment.model.dto.OrderRefundDTO
;
import
com.mmc.payment.model.dto.OrderVcuDTO
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
/**
* @Author small @Date 2023/5/29 13:55 @Version 1.0
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
// @ApiModel(value = "com.mmc.csf.model.dto.OrderInfoDTO", description = "云仓订单DTO")
public
class
OrderInfoDO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1572467108563651846L
;
@ApiModelProperty
(
value
=
"ID"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"订单编号"
)
private
String
orderNo
;
@ApiModelProperty
(
value
=
"商品ID"
)
private
Integer
wareInfoId
;
@ApiModelProperty
(
value
=
"商品编号"
)
private
String
wareNo
;
@ApiModelProperty
(
value
=
"商品标题"
)
private
String
wareTitle
;
@ApiModelProperty
(
value
=
"商品图片"
)
private
String
wareImg
;
@ApiModelProperty
(
value
=
"套餐(sku)ID"
)
private
Integer
skuInfoId
;
@ApiModelProperty
(
value
=
"套餐(sku)名称"
)
private
String
skuTitle
;
@ApiModelProperty
(
value
=
"购买用户ID"
)
private
Integer
repoAccountId
;
@ApiModelProperty
(
value
=
"用户UID"
)
private
String
uid
;
@ApiModelProperty
(
value
=
"买家name"
)
private
String
buyerName
;
@ApiModelProperty
(
value
=
"买家电话"
)
private
String
buyerPhone
;
@ApiModelProperty
(
value
=
"单价"
)
private
BigDecimal
unitPrice
;
@ApiModelProperty
(
value
=
"购买的商品数量"
)
private
Integer
wareNum
;
@ApiModelProperty
(
value
=
"应付款金额"
)
private
BigDecimal
shouldPay
;
@ApiModelProperty
(
value
=
"实收款金额"
)
private
BigDecimal
actualPay
;
@ApiModelProperty
(
value
=
"订单类型:0租赁 100购买"
)
private
Integer
orderType
;
@ApiModelProperty
(
value
=
"押金"
)
private
BigDecimal
deposit
;
@ApiModelProperty
(
value
=
"租金总金额"
)
private
BigDecimal
rentPrice
;
@ApiModelProperty
(
value
=
"租约开始日"
)
private
Date
startDate
;
@ApiModelProperty
(
value
=
"租约结束日"
)
private
Date
endDate
;
@ApiModelProperty
(
value
=
"付款天数"
)
private
Integer
payDay
;
@ApiModelProperty
(
value
=
"交易状态:查订单状态字典"
)
private
String
tranStatus
;
@ApiModelProperty
(
value
=
"减库方式 0:买家拍下减库存 1:卖家付款减库存"
)
private
Integer
exWare
;
@ApiModelProperty
(
value
=
"用户备注"
)
private
String
remark
;
@ApiModelProperty
(
value
=
"平台人员备注"
)
private
String
pfRemark
;
@ApiModelProperty
(
value
=
"关闭原因"
)
private
String
shutReason
;
@ApiModelProperty
(
value
=
"交易编号"
)
private
String
payNo
;
@ApiModelProperty
(
value
=
"支付时间"
)
private
Date
payTime
;
@ApiModelProperty
(
value
=
"发货时间"
)
private
Date
sendWareTime
;
@ApiModelProperty
(
value
=
"创建时间"
)
private
Date
createTime
;
@ApiModelProperty
(
value
=
"物流信息/收货地址信息"
)
private
OrderReceiptDTO
receipt
;
@ApiModelProperty
(
value
=
"退款单详情信息,无则为null"
)
private
OrderRefundDTO
orderRefund
;
@ApiModelProperty
(
value
=
"发货-物流动态,无则为null"
)
private
KdnExpDTO
express
;
@ApiModelProperty
(
value
=
"退货-物流动态,无则为null"
)
private
KdnExpDTO
refundExpress
;
@ApiModelProperty
(
value
=
"质检详情,无则为null"
)
private
List
<
OrderVcuDTO
>
vcus
;
@ApiModelProperty
(
value
=
"归还时间"
)
private
Date
returnTime
;
@ApiModelProperty
(
value
=
"优惠券id"
,
example
=
"221"
)
private
Integer
couponId
;
@ApiModelProperty
(
value
=
"规格id"
,
example
=
"1"
)
private
Integer
specsId
;
@ApiModelProperty
(
value
=
"余额"
,
example
=
"4"
)
private
BigDecimal
balance
;
}
src/main/java/com/mmc/payment/filter/AuthFilter.java
0 → 100644
浏览文件 @
ba450561
package
com
.
mmc
.
payment
.
filter
;
/**
* @Author small
* @Date 2023/5/29 10:36
* @Version 1.0
*/
import
javax.servlet.Filter
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
/** 登录认证 */
public
interface
AuthFilter
extends
Filter
{
/** 拦截前 */
public
boolean
before
(
HttpServletRequest
request
,
HttpServletResponse
response
);
/** 通过拦截后 */
public
boolean
after
();
}
src/main/java/com/mmc/payment/filter/AuthSignatureFilter.java
0 → 100644
浏览文件 @
ba450561
package
com
.
mmc
.
payment
.
filter
;
import
com.alibaba.fastjson2.JSON
;
import
com.mmc.payment.common.ResultBody
;
import
com.mmc.payment.common.ResultEnum
;
import
com.mmc.payment.common.Tenant
;
import
com.mmc.payment.config.Audience
;
import
com.mmc.payment.config.TenantContext
;
import
com.mmc.payment.model.dto.UserAccountDTO
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.stereotype.Component
;
import
javax.servlet.*
;
import
javax.servlet.annotation.WebFilter
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
/**
* @Author small
* @Date 2023/5/29 10:36
* @Version 1.0
*/
@Slf4j
@Component
@WebFilter
(
filterName
=
"AuthSignatureFilter"
,
urlPatterns
=
"/*"
)
public
class
AuthSignatureFilter
implements
AuthFilter
{
@Autowired
private
Audience
audience
;
@Autowired
private
StringRedisTemplate
stringRedisTemplate
;
/**
* 无需登录白名单
*/
private
static
final
String
[]
IGNORE_URLS
=
{
"/payment/swagger/swagger-resources"
,
"/payment/swagger/v2/api-docs"
,
"/payment/swagger/doc.html"
};
/*无需加密狗无需登录白名单*/
private
static
final
String
[]
USE_KEY
=
{
"/crm/account/loginByUsbKey"
};
/**
* 请求方式预请求方式值
*/
private
static
final
String
REQUEST_METHOD_OPTIONS_VALUE
=
"OPTIONS"
;
public
static
final
String
SWAGGER_URL_PREFIX
=
"/payment/swagger"
;
@Override
public
void
init
(
FilterConfig
filterConfig
)
{
log
.
info
(
" filter name is 'AuthSignatureFilter' init success"
);
}
/**
* 过滤器前置处理
*
* @param request
* @param response
* @return
*/
@Override
public
boolean
before
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
String
url
=
request
.
getRequestURI
();
// 忽略以下url请求,白名单路径以及swagger路径
if
(!
ArrayUtils
.
contains
(
IGNORE_URLS
,
url
)
&&
!
ArrayUtils
.
contains
(
USE_KEY
,
url
)
&&
!
url
.
startsWith
(
"/payment/webjars"
)
&&
!
url
.
startsWith
(
SWAGGER_URL_PREFIX
))
{
if
(
REQUEST_METHOD_OPTIONS_VALUE
.
equals
(
request
.
getMethod
()))
{
response
.
setStatus
(
HttpServletResponse
.
SC_OK
);
return
false
;
}
else
{
String
token
=
request
.
getHeader
(
"token"
);
if
(
null
==
token
){
response
(
response
,
ResultBody
.
error
(
ResultEnum
.
THE_REQUEST_IS_NOT_AUTHENTICATED
));
return
false
;
}
String
s
=
stringRedisTemplate
.
opsForValue
().
get
(
token
);
if
(
null
==
s
){
response
(
response
,
ResultBody
.
error
(
ResultEnum
.
THE_TOKEN_IS_INVALID
));
return
false
;
}
UserAccountDTO
userAccountDTO
=
JSON
.
parseObject
(
s
,
UserAccountDTO
.
class
);
try
{
Tenant
tenant
=
TenantContext
.
buildTenant
(
userAccountDTO
.
getAccountNo
());
if
(
tenant
!=
null
){
TenantContext
.
setTenant
(
tenant
);
return
true
;
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
return
true
;
}
@Override
public
void
doFilter
(
ServletRequest
req
,
ServletResponse
res
,
FilterChain
chain
)
throws
IOException
,
ServletException
{
final
HttpServletRequest
request
=
(
HttpServletRequest
)
req
;
final
HttpServletResponse
response
=
(
HttpServletResponse
)
res
;
if
(!
before
(
request
,
response
))
{
return
;
}
chain
.
doFilter
(
req
,
res
);
after
();
}
/**
* 过滤器后置处理
*
* @return
*/
@Override
public
boolean
after
()
{
TenantContext
.
clear
();
// 上下文清理
return
true
;
}
private
static
final
String
APPLICATION_JSON_UTF8
=
"application/json;charset=UTF-8"
;
public
static
void
response
(
HttpServletResponse
response
,
ResultBody
resultBody
)
{
response
.
setContentType
(
APPLICATION_JSON_UTF8
);
try
{
response
.
getWriter
()
.
write
(
JSON
.
toJSONString
(
ResultBody
.
error
(
resultBody
.
getCode
(),
resultBody
.
getMessage
())));
}
catch
(
IOException
e
)
{
log
.
error
(
e
.
getMessage
());
}
}
private
static
String
toString
(
Object
obj
)
{
if
(
null
==
obj
)
{
return
""
;
}
return
obj
.
toString
();
}
@Override
public
void
destroy
()
{
}
}
src/main/java/com/mmc/payment/model/dto/BaseAccountDTO.java
浏览文件 @
ba450561
package
com
.
mmc
.
payment
.
model
.
dto
;
package
com
.
mmc
.
payment
.
model
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Builder
;
...
@@ -10,59 +9,34 @@ import lombok.NoArgsConstructor;
...
@@ -10,59 +9,34 @@ import lombok.NoArgsConstructor;
import
java.io.Serializable
;
import
java.io.Serializable
;
/**
/**
* @Author small
* @Author small @Date 2023/5/23 19:15 @Version 1.0
* @Date 2023/5/23 19:15
* @Version 1.0
*/
*/
@Builder
@Builder
@Data
@Data
@AllArgsConstructor
@AllArgsConstructor
@NoArgsConstructor
@NoArgsConstructor
//@ApiModel(value = "com.mmc.csf.model.dto.BaseAccountDTO", description = "登录信息DTO")
//
@ApiModel(value = "com.mmc.csf.model.dto.BaseAccountDTO", description = "登录信息DTO")
public
class
BaseAccountDTO
implements
Serializable
{
public
class
BaseAccountDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
2979712090903806216L
;
private
static
final
long
serialVersionUID
=
-
2979712090903806216L
;
private
Integer
id
;
private
String
uid
;
private
String
accountPhone
;
private
String
accountNo
;
private
String
accountName
;
private
String
tokenPort
;
@ApiModelProperty
(
value
=
"角色ID"
)
private
Integer
roleId
;
@ApiModelProperty
(
value
=
"是否为管理角色:0否 1是"
)
private
Integer
admin
;
// 是否为管理角色
@ApiModelProperty
(
value
=
"是否为运营角色:0否 1是"
)
private
Integer
operate
;
@ApiModelProperty
(
value
=
"是否PMC发货专员:0否 1是"
)
private
Integer
pmc
;
@ApiModelProperty
(
value
=
"单位信息"
)
private
CompanyCacheDTO
companyInfo
;
// 单位信息
@ApiModelProperty
(
value
=
"token"
)
private
String
token
;
@ApiModelProperty
(
value
=
"账号id"
)
private
Integer
userAccountId
;
public
BaseAccountDTO
(
RepoAccountDTO
account
)
{
@ApiModelProperty
(
value
=
"账号"
)
this
.
id
=
account
.
getId
();
private
String
accountNo
;
this
.
accountName
=
account
.
getAccountName
();
this
.
uid
=
account
.
getUid
();
this
.
accountPhone
=
account
.
getPhoneNum
();
}
@ApiModelProperty
(
value
=
"账号uid"
)
private
String
uid
;
@ApiModelProperty
(
value
=
"手机号"
)
private
String
phoneNum
;
/**
@ApiModelProperty
(
value
=
"用户名称"
)
* 是否为科比特超级管理员单位(是:无单位资源限制 否:只能看当前和下级单位的资源)
private
String
userName
;
* @return
*/
public
boolean
isManage
()
{
if
(
this
.
getCompanyInfo
()==
null
){
return
false
;
}
if
(
this
.
getCompanyInfo
().
getManage
()==
null
){
return
false
;
}
return
this
.
getCompanyInfo
().
getManage
()
==
1
;
}
@ApiModelProperty
(
value
=
"用户昵称"
)
private
String
nickName
;
}
}
src/main/java/com/mmc/payment/model/vo/RepoCashVO.java
浏览文件 @
ba450561
...
@@ -3,7 +3,6 @@ package com.mmc.payment.model.vo;
...
@@ -3,7 +3,6 @@ package com.mmc.payment.model.vo;
import
com.mmc.payment.common.Create
;
import
com.mmc.payment.common.Create
;
import
com.mmc.payment.common.Refund
;
import
com.mmc.payment.common.Refund
;
import
com.mmc.payment.common.Share
;
import
com.mmc.payment.common.Share
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Builder
;
...
@@ -16,34 +15,49 @@ import java.math.BigDecimal;
...
@@ -16,34 +15,49 @@ import java.math.BigDecimal;
import
java.util.List
;
import
java.util.List
;
/**
/**
* @Author small
* @Author small @Date 2023/5/24 10:04 @Version 1.0
* @Date 2023/5/24 10:04
* @Version 1.0
*/
*/
@Builder
@Builder
@Data
@Data
@AllArgsConstructor
@AllArgsConstructor
@NoArgsConstructor
@NoArgsConstructor
//@ApiModel(value = "com.mmc.csf.model.vo.RepoCashVO", description = "现金变更VO")
//
@ApiModel(value = "com.mmc.csf.model.vo.RepoCashVO", description = "现金变更VO")
public
class
RepoCashVO
implements
Serializable
{
public
class
RepoCashVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1828354753495845609L
;
private
static
final
long
serialVersionUID
=
1828354753495845609L
;
@ApiModelProperty
(
value
=
"用户ID"
)
@NotNull
(
message
=
"用户ID不能为空"
,
groups
=
{
Create
.
class
})
/* @ApiModelProperty(value = "用户ID")
private
Integer
repoAccountId
;
@NotNull(
@ApiModelProperty
(
value
=
"订单ID"
)
message = "用户ID不能为空",
@NotNull
(
message
=
"orderRefundId不能为空"
,
groups
=
{
Refund
.
class
})
groups = {Create.class})
private
Integer
orderRefundId
;
private Integer repoAccountId;*/
@ApiModelProperty
(
value
=
"返租订单ID"
)
@NotNull
(
message
=
"shareOrderId不能为空"
,
groups
=
{
Share
.
class
})
/* @ApiModelProperty(value = "订单ID")
private
Integer
shareOrderId
;
@NotNull(
@ApiModelProperty
(
value
=
"变动金额"
)
message = "orderRefundId不能为空",
@NotNull
(
message
=
"变动金额不能为空"
,
groups
=
{
Create
.
class
,
Refund
.
class
})
groups = {Refund.class})
private
BigDecimal
amtPaid
;
private Integer orderRefundId;
@ApiModelProperty
(
value
=
"凭证图片集合"
)
private
List
<
String
>
voucher
;
@ApiModelProperty(value = "返租订单ID")
@ApiModelProperty
(
value
=
"备注"
)
@NotNull(
private
String
remark
;
message = "shareOrderId不能为空",
@ApiModelProperty
(
value
=
"操作人员密码"
)
groups = {Share.class})
@NotNull
(
message
=
"变动金额不能为空"
,
groups
=
{
Refund
.
class
,
Share
.
class
})
private Integer shareOrderId;*/
private
String
authPwd
;
@ApiModelProperty
(
value
=
"变动金额"
)
@NotNull
(
message
=
"变动金额不能为空"
,
groups
=
{
Create
.
class
,
Refund
.
class
})
private
BigDecimal
amtPaid
;
@ApiModelProperty
(
value
=
"凭证图片集合"
)
private
List
<
String
>
voucher
;
@ApiModelProperty
(
value
=
"备注"
)
private
String
remark
;
@ApiModelProperty
(
value
=
"操作人员密码"
)
@NotNull
(
message
=
"变动金额不能为空"
,
groups
=
{
Refund
.
class
,
Share
.
class
})
private
String
authPwd
;
}
}
src/main/java/com/mmc/payment/service/Impl/RepoAccountServiceImpl.java
浏览文件 @
ba450561
...
@@ -17,54 +17,60 @@ import java.util.Map;
...
@@ -17,54 +17,60 @@ import java.util.Map;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
* @Author small
* @Author small @Date 2023/5/23 19:12 @Version 1.0
* @Date 2023/5/23 19:12
* @Version 1.0
*/
*/
@Service
@Service
public
class
RepoAccountServiceImpl
implements
RepoAccountService
{
public
class
RepoAccountServiceImpl
implements
RepoAccountService
{
@Autowired
@Autowired
private
RepoAccountDao
repoAccountDao
;
private
RepoAccountDao
repoAccountDao
;
@Override
public
PageResult
listPagePayManager
(
RepoAccountQO
param
,
BaseAccountDTO
cuser
)
{
if
(!
cuser
.
isManage
()){
param
.
setCompanys
(
cuser
.
getCompanyInfo
().
getCompanys
());
}
int
count
=
repoAccountDao
.
countPagePayManager
(
param
);
if
(
count
==
0
)
{
return
PageResult
.
buildPage
(
param
.
getPageNo
(),
param
.
getPageSize
(),
count
);
}
Integer
pageNo
=
param
.
getPageNo
();
param
.
buildCurrentPage
();
List
<
RepoAccountDTO
>
data
=
repoAccountDao
.
listPagePayManager
(
param
).
stream
().
map
(
d
->
{
d
.
buildName
();
return
d
.
buildRepoAccountDTO
();
}).
collect
(
Collectors
.
toList
());
List
<
Integer
>
accountIds
=
data
.
stream
().
map
(
RepoAccountDTO:
:
getId
).
collect
(
Collectors
.
toList
());
param
.
setAccountIds
(
accountIds
);
// List<RepoWalletDTO> wallets = repoPayServletClient.feignListWalletInfo(param);
List
<
RepoWalletDTO
>
wallets
=
listWalletInfo
(
param
);
Map
<
Integer
,
RepoWalletDTO
>
mapWallet
=
wallets
.
stream
()
.
collect
(
Collectors
.
toMap
(
RepoWalletDTO:
:
getRepoAccountId
,
wallet
->
wallet
,
(
k1
,
k2
)
->
k2
));
for
(
RepoAccountDTO
ac
:
data
)
{
if
(
mapWallet
.
containsKey
(
ac
.
getId
()))
{
ac
.
setCashAmt
(
mapWallet
.
get
(
ac
.
getId
()).
getCashAmt
());
ac
.
setRemark
(
mapWallet
.
get
(
ac
.
getId
()).
getRemark
());
}
}
return
PageResult
.
buildPage
(
pageNo
,
param
.
getPageSize
(),
count
,
data
);
}
public
List
<
RepoWalletDTO
>
listWalletInfo
(
RepoAccountQO
param
)
{
@Override
if
(
CollectionUtils
.
isEmpty
(
param
.
getAccountIds
())
)
{
public
PageResult
listPagePayManager
(
RepoAccountQO
param
,
BaseAccountDTO
cuser
)
{
return
java
.
util
.
Collections
.
emptyList
();
/*if(!cuser.isManage()){
}
param.setCompanys(cuser.getCompanyInfo().getCompanys());
List
<
RepoWalletDO
>
wallets
=
repoAccountDao
.
listWalletInfo
(
param
);
}*/
return
wallets
.
stream
().
map
(
d
->
{
int
count
=
repoAccountDao
.
countPagePayManager
(
param
);
return
d
.
buildRepoWalletDTO
();
if
(
count
==
0
)
{
}).
collect
(
Collectors
.
toList
()
);
return
PageResult
.
buildPage
(
param
.
getPageNo
(),
param
.
getPageSize
(),
count
);
}
}
Integer
pageNo
=
param
.
getPageNo
();
param
.
buildCurrentPage
();
List
<
RepoAccountDTO
>
data
=
repoAccountDao
.
listPagePayManager
(
param
).
stream
()
.
map
(
d
->
{
d
.
buildName
();
return
d
.
buildRepoAccountDTO
();
})
.
collect
(
Collectors
.
toList
());
List
<
Integer
>
accountIds
=
data
.
stream
().
map
(
RepoAccountDTO:
:
getId
).
collect
(
Collectors
.
toList
());
param
.
setAccountIds
(
accountIds
);
// List<RepoWalletDTO> wallets = repoPayServletClient.feignListWalletInfo(param);
List
<
RepoWalletDTO
>
wallets
=
listWalletInfo
(
param
);
Map
<
Integer
,
RepoWalletDTO
>
mapWallet
=
wallets
.
stream
()
.
collect
(
Collectors
.
toMap
(
RepoWalletDTO:
:
getRepoAccountId
,
wallet
->
wallet
,
(
k1
,
k2
)
->
k2
));
for
(
RepoAccountDTO
ac
:
data
)
{
if
(
mapWallet
.
containsKey
(
ac
.
getId
()))
{
ac
.
setCashAmt
(
mapWallet
.
get
(
ac
.
getId
()).
getCashAmt
());
ac
.
setRemark
(
mapWallet
.
get
(
ac
.
getId
()).
getRemark
());
}
}
return
PageResult
.
buildPage
(
pageNo
,
param
.
getPageSize
(),
count
,
data
);
}
public
List
<
RepoWalletDTO
>
listWalletInfo
(
RepoAccountQO
param
)
{
if
(
CollectionUtils
.
isEmpty
(
param
.
getAccountIds
()))
{
return
java
.
util
.
Collections
.
emptyList
();
}
List
<
RepoWalletDO
>
wallets
=
repoAccountDao
.
listWalletInfo
(
param
);
return
wallets
.
stream
()
.
map
(
d
->
{
return
d
.
buildRepoWalletDTO
();
})
.
collect
(
Collectors
.
toList
());
}
}
}
src/main/java/com/mmc/payment/service/Impl/RepoCashServiceImpl.java
浏览文件 @
ba450561
package
com
.
mmc
.
payment
.
service
.
Impl
;
package
com
.
mmc
.
payment
.
service
.
Impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.mmc.payment.common.*
;
import
com.mmc.payment.common.*
;
import
com.mmc.payment.config.RepoCashMethod
;
import
com.mmc.payment.config.RepoCashMethod
;
import
com.mmc.payment.dao.RepoCashDao
;
import
com.mmc.payment.dao.RepoCashDao
;
...
@@ -14,10 +15,10 @@ import com.mmc.payment.model.vo.RepoOrderPayVO;
...
@@ -14,10 +15,10 @@ import com.mmc.payment.model.vo.RepoOrderPayVO;
import
com.mmc.payment.service.RepoCashService
;
import
com.mmc.payment.service.RepoCashService
;
import
io.jsonwebtoken.lang.Collections
;
import
io.jsonwebtoken.lang.Collections
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
...
@@ -28,219 +29,260 @@ import java.util.Map;
...
@@ -28,219 +29,260 @@ import java.util.Map;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
* @Author small
* @Author small @Date 2023/5/24 10:06 @Version 1.0
* @Date 2023/5/24 10:06
* @Version 1.0
*/
*/
@Service
@Service
public
class
RepoCashServiceImpl
implements
RepoCashService
{
public
class
RepoCashServiceImpl
implements
RepoCashService
{
@Autowired
@Autowired
private
RepoCashDao
repoCashDao
;
private
RepoCashDao
repoCashDao
;
@Autowired
private
RestTemplate
restTemplate
;
@Autowired
@Autowired
private
StringRedisTemplate
stringRedisTemplate
;
private
RestTemplate
restTemplate
;
/* @Autowired
/* @Autowired
private RepoWalletDao repoWalletDao;*/
private RepoWalletDao repoWalletDao;*/
/*@Autowired
/*@Autowired
private UserServletClient userServletClient;
private UserServletClient userServletClient;
@Autowired
@Autowired
private RepoServletClient repoServletClient;*/
private RepoServletClient repoServletClient;*/
@Value
(
"${userapp.url}"
)
@Override
private
String
userAppUrl
;
public
PageResult
listPageRepoCash
(
RepoCashQO
param
)
{
int
count
=
repoCashDao
.
countPagePFRepoCash
(
param
);
@Override
if
(
count
==
0
)
{
public
PageResult
listPageRepoCash
(
RepoCashQO
param
)
{
return
PageResult
.
buildPage
(
param
.
getPageNo
(),
param
.
getPageSize
(),
count
);
int
count
=
repoCashDao
.
countPagePFRepoCash
(
param
);
}
if
(
count
==
0
)
{
Integer
pageNo
=
param
.
getPageNo
();
return
PageResult
.
buildPage
(
param
.
getPageNo
(),
param
.
getPageSize
(),
count
);
param
.
buildCurrentPage
();
}
List
<
RepoCashDO
>
list
=
repoCashDao
.
listPagePFRepoCash
(
param
);
Integer
pageNo
=
param
.
getPageNo
();
List
<
Integer
>
userIds
=
new
ArrayList
<
Integer
>();
param
.
buildCurrentPage
();
for
(
RepoCashDO
d
:
list
)
{
List
<
RepoCashDO
>
list
=
repoCashDao
.
listPagePFRepoCash
(
param
);
if
(
d
.
getCreateUser
()
!=
null
&&
!
userIds
.
contains
(
d
.
getCreateUser
()))
{
List
<
Integer
>
userIds
=
new
ArrayList
<
Integer
>();
userIds
.
add
(
d
.
getCreateUser
());
for
(
RepoCashDO
d
:
list
)
{
}
if
(
d
.
getCreateUser
()
!=
null
&&
!
userIds
.
contains
(
d
.
getCreateUser
()))
{
}
userIds
.
add
(
d
.
getCreateUser
());
List
<
RepoCashDTO
>
data
=
list
.
stream
().
map
(
d
->
{
}
return
d
.
buildRepoCashDTO
();
}
}).
collect
(
Collectors
.
toList
());
List
<
RepoCashDTO
>
data
=
UserAccountQO
uq
=
UserAccountQO
.
builder
().
userIds
(
userIds
).
build
();
list
.
stream
()
List
<
UserAccountDTO
>
users
=
null
;
.
map
(
//批量获取用户信息
d
->
{
return
d
.
buildRepoCashDTO
();
})
.
collect
(
Collectors
.
toList
());
UserAccountQO
uq
=
UserAccountQO
.
builder
().
userIds
(
userIds
).
build
();
List
<
UserAccountDTO
>
users
=
null
;
// 批量获取用户信息
// userServletClient.feignListUserAccountById(uq);
// userServletClient.feignListUserAccountById(uq);
// 远程调用非当前接口
// 远程调用非当前接口
ResponseEntity
<
String
>
response
=
ResponseEntity
<
String
>
response
=
restTemplate
.
getForEntity
(
"http://localhost:35150/userapp/user-account/feignGetUserSimpleInfo?userAccountId=1"
+
userIds
,
String
.
class
);
restTemplate
.
getForEntity
(
String
body
=
response
.
getBody
();
"http://localhost:35150/userapp/user-account/feignGetUserSimpleInfo?userAccountId=1"
Map
<
Integer
,
UserAccountDTO
>
mapUser
=
users
.
stream
()
+
userIds
,
.
collect
(
Collectors
.
toMap
(
UserAccountDTO:
:
getId
,
ud
->
ud
,
(
k1
,
k2
)
->
k2
));
String
.
class
);
data
.
forEach
(
d
->
{
String
body
=
response
.
getBody
();
if
(
mapUser
.
containsKey
(
d
.
getCreateUser
()))
{
Map
<
Integer
,
UserAccountDTO
>
mapUser
=
d
.
setOpNo
(
mapUser
.
get
(
d
.
getCreateUser
()).
getAccountNo
());
users
.
stream
().
collect
(
Collectors
.
toMap
(
UserAccountDTO:
:
getId
,
ud
->
ud
,
(
k1
,
k2
)
->
k2
));
d
.
setOpName
(
mapUser
.
get
(
d
.
getCreateUser
()).
getUserName
());
data
.
forEach
(
}
d
->
{
if
(
mapUser
.
containsKey
(
d
.
getCreateUser
()))
{
d
.
setOpNo
(
mapUser
.
get
(
d
.
getCreateUser
()).
getAccountNo
());
d
.
setOpName
(
mapUser
.
get
(
d
.
getCreateUser
()).
getUserName
());
}
});
});
return
PageResult
.
buildPage
(
pageNo
,
param
.
getPageSize
(),
count
,
data
);
return
PageResult
.
buildPage
(
pageNo
,
param
.
getPageSize
(),
count
,
data
);
}
}
@Override
public
void
updateCashRemark
(
Integer
id
,
String
remark
)
{
@Override
repoCashDao
.
updateCashRemark
(
id
,
remark
);
public
void
updateCashRemark
(
Integer
id
,
String
remark
)
{
}
repoCashDao
.
updateCashRemark
(
id
,
remark
);
@Override
public
ResultBody
reqCash
(
BaseAccountDTO
cuser
,
RepoCashVO
cash
)
{
// 金额范围验证
if
(!
AmtUtil
.
vertifyRepoAmt
(
cash
.
getAmtPaid
()))
{
return
ResultBody
.
error
(
ResultEnum
.
AMT_PAID_VERITY_ERROR
);
}
}
// 密码认证
// getResultBody(cuser, cash);
@Override
// 用户信息
public
ResultBody
reqCash
(
BaseAccountDTO
cuser
,
RepoCashVO
cash
)
{
// RepoAccountDTO account = null;
// 金额范围验证
// repoServletClient.feignAccountSimpleInfo(cash.getRepoAccountId());
if
(!
AmtUtil
.
vertifyRepoAmt
(
cash
.
getAmtPaid
()))
{
ResponseEntity
<
String
>
response
=
return
ResultBody
.
error
(
ResultEnum
.
AMT_PAID_VERITY_ERROR
);
restTemplate
.
getForEntity
(
}
userAppUrl
// 密码认证
+
"user-account/feignGetUserSimpleInfo?userAccountId="
ResultBody
body
=
null
;
+
cuser
.
getUserAccountId
(),
//userServletClient.feignAuthUserPwd(cuser.getId(), cash.getAuthPwd());
String
.
class
);
/*if (!ResultEnum.SUCCESS.getResultCode().equals(body.getCode())) {
UserAccountSimpleDTO
account
=
JSON
.
parseObject
(
response
.
getBody
(),
UserAccountSimpleDTO
.
class
);
return body;
if
(
account
==
null
)
{
}*/
return
ResultBody
.
error
(
ResultEnum
.
FEIGN_REPOUSER_SERVLET_ERROR
);
// 用户信息
}
//RepoAccountDTO account = null;
RepoWalletDO
wallet
=
repoCashDao
.
getRepoWalletInfo
(
cuser
.
getUserAccountId
());
//repoServletClient.feignAccountSimpleInfo(cash.getRepoAccountId());
if
(
wallet
==
null
)
{
ResponseEntity
<
String
>
response
=
return
ResultBody
.
error
(
ResultEnum
.
WALLET_NOT_FIND_ERROR
);
restTemplate
.
getForEntity
(
"http://localhost:35150/userapp/user-account/feignGetUserSimpleInfo?userAccountId=1"
,
String
.
class
);
}
String
body1
=
response
.
getBody
();
// 扣除的金额不能大于余额
UserAccountSimpleDTO
account
=
JSON
.
parseObject
(
body1
,
UserAccountSimpleDTO
.
class
);
if
(
cash
.
getAmtPaid
().
compareTo
(
wallet
.
getCashAmt
())
>
0
)
{
if
(
account
==
null
)
{
return
ResultBody
.
error
(
ResultEnum
.
WALLET_CASH_NOT_ENOUGH_ERROR
);
return
ResultBody
.
error
(
ResultEnum
.
FEIGN_REPOUSER_SERVLET_ERROR
);
}
RepoWalletDO
wallet
=
repoCashDao
.
getRepoWalletInfo
(
cash
.
getRepoAccountId
());
if
(
wallet
==
null
)
{
return
ResultBody
.
error
(
ResultEnum
.
WALLET_NOT_FIND_ERROR
);
}
// 扣除的金额不能大于余额
if
(
cash
.
getAmtPaid
().
compareTo
(
wallet
.
getCashAmt
())
>
0
)
{
return
ResultBody
.
error
(
ResultEnum
.
WALLET_CASH_NOT_ENOUGH_ERROR
);
}
Date
cdate
=
new
Date
();
RepoCashDO
rc
=
new
RepoCashDO
();
rc
.
setRepoAccountId
(
account
.
getId
());
rc
.
setUid
(
account
.
getUid
());
rc
.
setAccountName
(
account
.
getUserName
());
rc
.
setPayNo
(
CodeUtil
.
createRepoCashNo
());
rc
.
setPayMethod
(
RepoCashMethod
.
REG
.
getCode
());
rc
.
setAmtPaid
(
cash
.
getAmtPaid
());
BigDecimal
newCashAmt
=
(
wallet
.
getCashAmt
().
add
(
cash
.
getAmtPaid
())).
setScale
(
2
,
BigDecimal
.
ROUND_DOWN
);
rc
.
setCashAmt
(
newCashAmt
);
rc
.
setPayTime
(
cdate
);
String
voucher
=
Collections
.
isEmpty
(
cash
.
getVoucher
())
?
null
:
String
.
join
(
","
,
cash
.
getVoucher
());
rc
.
setVoucher
(
voucher
);
rc
.
setRemark
(
cash
.
getRemark
());
rc
.
setCreateTime
(
cdate
);
//rc.setCreateUser(cuser.getId());
rc
.
setCreateUser
(
1
);
repoCashDao
.
insertRepoCash
(
rc
);
repoCashDao
.
updateRepoWalletAmt
(
account
.
getId
(),
rc
.
getAmtPaid
());
return
ResultBody
.
success
();
}
}
Date
cdate
=
new
Date
();
RepoCashDO
rc
=
new
RepoCashDO
();
rc
.
setRepoAccountId
(
account
.
getId
());
rc
.
setUid
(
account
.
getUid
());
rc
.
setAccountName
(
account
.
getUserName
());
rc
.
setPayNo
(
CodeUtil
.
createRepoCashNo
());
rc
.
setPayMethod
(
RepoCashMethod
.
REG
.
getCode
());
rc
.
setAmtPaid
(
cash
.
getAmtPaid
());
BigDecimal
newCashAmt
=
(
wallet
.
getCashAmt
().
add
(
cash
.
getAmtPaid
())).
setScale
(
2
,
BigDecimal
.
ROUND_DOWN
);
rc
.
setCashAmt
(
newCashAmt
);
rc
.
setPayTime
(
cdate
);
String
voucher
=
Collections
.
isEmpty
(
cash
.
getVoucher
())
?
null
:
String
.
join
(
","
,
cash
.
getVoucher
());
rc
.
setVoucher
(
voucher
);
rc
.
setRemark
(
cash
.
getRemark
());
rc
.
setCreateTime
(
cdate
);
rc
.
setCreateUser
(
cuser
.
getUserAccountId
());
repoCashDao
.
insertRepoCash
(
rc
);
repoCashDao
.
updateRepoWalletAmt
(
account
.
getId
(),
rc
.
getAmtPaid
());
return
ResultBody
.
success
();
}
@Override
/* private String getResultBody(BaseAccountDTO cuser, RepoCashVO cash) {
public
ResultBody
dedCash
(
BaseAccountDTO
cuser
,
RepoCashVO
cash
)
{
ResponseEntity<String> response =
// 金额范围验证
restTemplate.getForEntity(
if
(!
AmtUtil
.
vertifyRepoAmt
(
cash
.
getAmtPaid
()))
{
userAppUrl
return
ResultBody
.
error
(
ResultEnum
.
AMT_PAID_VERITY_ERROR
);
+ "back-user/feignAuthUserPwd?authPwd="
}
+ cash.getAuthPwd()
// 密码认证
+ "&id="
ResultBody
body
=
null
;
+ +cuser.getUserAccountId(),
//userServletClient.feignAuthUserPwd(cuser.getId(), cash.getAuthPwd());
String.class);
/*if (!ResultEnum.SUCCESS.getResultCode().equals(body.getCode())) {
ResultBody body = JSON.parseObject(response.getBody(), ResultBody.class);
return body;
*/
}*/
/* if (!ResultEnum.SUCCESS.getResultCode().equals(body.getCode())) {
return body;
// 用户信息
}*/
// RepoAccountDTO account =null;
/*
//repoServletClient.feignAccountSimpleInfo(cash.getRepoAccountId());
}*/
ResponseEntity
<
String
>
response
=
restTemplate
.
getForEntity
(
"http://localhost:35150/userapp/user-account/feignGetUserSimpleInfo?userAccountId=1"
,
String
.
class
);
@Override
String
body1
=
response
.
getBody
();
public
ResultBody
dedCash
(
BaseAccountDTO
cuser
,
RepoCashVO
cash
)
{
UserAccountSimpleDTO
account
=
JSON
.
parseObject
(
body1
,
UserAccountSimpleDTO
.
class
);
// 金额范围验证
if
(
account
==
null
)
{
if
(!
AmtUtil
.
vertifyRepoAmt
(
cash
.
getAmtPaid
()))
{
return
ResultBody
.
error
(
ResultEnum
.
FEIGN_REPOUSER_SERVLET_ERROR
);
return
ResultBody
.
error
(
ResultEnum
.
AMT_PAID_VERITY_ERROR
);
}
RepoWalletDO
wallet
=
repoCashDao
.
getRepoWalletInfo
(
cash
.
getRepoAccountId
());
if
(
wallet
==
null
)
{
return
ResultBody
.
error
(
ResultEnum
.
WALLET_NOT_FIND_ERROR
);
}
// 扣除的金额不能大于余额
if
(
cash
.
getAmtPaid
().
compareTo
(
wallet
.
getCashAmt
())
>
0
)
{
return
ResultBody
.
error
(
ResultEnum
.
WALLET_CASH_NOT_ENOUGH_ERROR
);
}
Date
cdate
=
new
Date
();
RepoCashDO
rc
=
new
RepoCashDO
();
rc
.
setRepoAccountId
(
account
.
getId
());
rc
.
setUid
(
account
.
getUid
());
rc
.
setAccountName
(
account
.
getUserName
());
rc
.
setPayNo
(
CodeUtil
.
createRepoCashNo
());
rc
.
setPayMethod
(
RepoCashMethod
.
HANDLER
.
getCode
());
rc
.
setAmtPaid
(
cash
.
getAmtPaid
().
multiply
(
BigDecimal
.
valueOf
(-
1
)));
BigDecimal
newCashAmt
=
(
wallet
.
getCashAmt
().
subtract
(
cash
.
getAmtPaid
())).
setScale
(
2
,
BigDecimal
.
ROUND_DOWN
);
rc
.
setCashAmt
(
newCashAmt
);
rc
.
setPayTime
(
cdate
);
String
voucher
=
Collections
.
isEmpty
(
cash
.
getVoucher
())
?
null
:
String
.
join
(
","
,
cash
.
getVoucher
());
rc
.
setVoucher
(
voucher
);
rc
.
setRemark
(
cash
.
getRemark
());
rc
.
setCreateTime
(
cdate
);
// rc.setCreateUser(cuser.getId());
rc
.
setCreateUser
(
1
);
repoCashDao
.
insertRepoCash
(
rc
);
repoCashDao
.
updateRepoWalletAmt
(
account
.
getId
(),
rc
.
getAmtPaid
());
return
ResultBody
.
success
();
}
}
// 密码认证
ResultBody
body
=
null
;
// userServletClient.feignAuthUserPwd(cuser.getId(), cash.getAuthPwd());
/*if (!ResultEnum.SUCCESS.getResultCode().equals(body.getCode())) {
return body;
}*/
@Override
// 用户信息
public
RepoCashDTO
getRefundInfo
(
String
refundNo
)
{
// RepoAccountDTO account =null;
RepoCashDO
refund
=
repoCashDao
.
getRefundCashInfo
(
refundNo
);
// repoServletClient.feignAccountSimpleInfo(cash.getRepoAccountId());
return
refund
==
null
?
null
:
refund
.
buildRepoCashDTO
();
ResponseEntity
<
String
>
response
=
restTemplate
.
getForEntity
(
userAppUrl
+
"user-account/feignGetUserSimpleInfo?userAccountId="
+
cuser
.
getUserAccountId
(),
String
.
class
);
String
body1
=
response
.
getBody
();
UserAccountSimpleDTO
account
=
JSON
.
parseObject
(
body1
,
UserAccountSimpleDTO
.
class
);
if
(
account
==
null
)
{
return
ResultBody
.
error
(
ResultEnum
.
FEIGN_REPOUSER_SERVLET_ERROR
);
}
}
@Override
RepoWalletDO
wallet
=
repoCashDao
.
getRepoWalletInfo
(
cuser
.
getUserAccountId
());
public
BigDecimal
RemainingBalance
(
Integer
repoAccountId
)
{
if
(
wallet
==
null
)
{
return
repoCashDao
.
RemainingBalance
(
repoAccountId
);
return
ResultBody
.
error
(
ResultEnum
.
WALLET_NOT_FIND_ERROR
);
}
}
// 扣除的金额不能大于余额
if
(
cash
.
getAmtPaid
().
compareTo
(
wallet
.
getCashAmt
())
>
0
)
{
return
ResultBody
.
error
(
ResultEnum
.
WALLET_CASH_NOT_ENOUGH_ERROR
);
}
Date
cdate
=
new
Date
();
RepoCashDO
rc
=
new
RepoCashDO
();
rc
.
setRepoAccountId
(
account
.
getId
());
rc
.
setUid
(
account
.
getUid
());
rc
.
setAccountName
(
account
.
getUserName
());
rc
.
setPayNo
(
CodeUtil
.
createRepoCashNo
());
rc
.
setPayMethod
(
RepoCashMethod
.
HANDLER
.
getCode
());
rc
.
setAmtPaid
(
cash
.
getAmtPaid
().
multiply
(
BigDecimal
.
valueOf
(-
1
)));
BigDecimal
newCashAmt
=
(
wallet
.
getCashAmt
().
subtract
(
cash
.
getAmtPaid
())).
setScale
(
2
,
BigDecimal
.
ROUND_DOWN
);
rc
.
setCashAmt
(
newCashAmt
);
rc
.
setPayTime
(
cdate
);
String
voucher
=
Collections
.
isEmpty
(
cash
.
getVoucher
())
?
null
:
String
.
join
(
","
,
cash
.
getVoucher
());
rc
.
setVoucher
(
voucher
);
rc
.
setRemark
(
cash
.
getRemark
());
rc
.
setCreateTime
(
cdate
);
rc
.
setCreateUser
(
cuser
.
getUserAccountId
());
repoCashDao
.
insertRepoCash
(
rc
);
repoCashDao
.
updateRepoWalletAmt
(
account
.
getId
(),
rc
.
getAmtPaid
());
return
ResultBody
.
success
();
}
@Override
public
RepoCashDTO
getRefundInfo
(
String
refundNo
)
{
RepoCashDO
refund
=
repoCashDao
.
getRefundCashInfo
(
refundNo
);
return
refund
==
null
?
null
:
refund
.
buildRepoCashDTO
();
}
@Override
public
BigDecimal
RemainingBalance
(
Integer
repoAccountId
)
{
return
repoCashDao
.
RemainingBalance
(
repoAccountId
);
}
@Override
@Override
public
PayCashResultDTO
payCashOrder
(
RepoOrderPayVO
orderPay
)
{
public
PayCashResultDTO
orderPayment
(
BaseAccountDTO
currentAccount
,
String
orderNo
)
{
BaseAccountDTO
account
=
orderPay
.
getAccount
();
String
s
=
stringRedisTemplate
.
opsForValue
().
get
(
orderNo
);
OrderInfoDTO
orderInfo
=
orderPay
.
getOrderInfo
();
RepoCashDO
repoCashDO
=
JSONObject
.
parseObject
(
s
,
RepoCashDO
.
class
);
RepoWalletDO
wallet
=
repoCashDao
.
getRepoWalletInfo
(
account
.
getId
());
repoCashDao
.
orderPayment
(
JSONObject
.
parseObject
(
s
,
RepoCashDO
.
class
));
if
(
wallet
==
null
)
{
if
(!
currentAccount
.
getUserAccountId
().
equals
(
currentAccount
.
getUserAccountId
()))
{
return
PayCashResultDTO
.
error
(
ResultEnum
.
WALLET_NOT_FIND_ERROR
.
getResultCode
(),
return
PayCashResultDTO
.
error
(
ResultEnum
.
WALLET_NOT_FIND_ERROR
.
getResultMsg
());
ResultEnum
.
WALLET_NOT_FIND_ERROR
.
getResultCode
(),
}
ResultEnum
.
WALLET_NOT_FIND_ERROR
.
getResultMsg
());
BigDecimal
amtPaid
=
orderInfo
.
getShouldPay
();
if
(
amtPaid
.
compareTo
(
wallet
.
getCashAmt
())
>
0
)
{
return
PayCashResultDTO
.
error
(
ResultEnum
.
WALLET_CASH_NOT_ENOUGH_ERROR
.
getResultCode
(),
ResultEnum
.
WALLET_CASH_NOT_ENOUGH_ERROR
.
getResultMsg
());
}
Date
cdate
=
new
Date
();
RepoCashDO
cash
=
orderInfo
.
buildRepoCashDO
();
cash
.
setRepoAccountId
(
account
.
getId
());
cash
.
setPayNo
(
CodeUtil
.
createRepoCashNo
());
cash
.
setPayMethod
(
RepoCashMethod
.
RENT
.
getCode
());
cash
.
setAmtPaid
(
amtPaid
.
multiply
(
BigDecimal
.
valueOf
(-
1
)));
cash
.
setCashAmt
(
wallet
.
getCashAmt
().
subtract
(
amtPaid
));
cash
.
setPayTime
(
cdate
);
cash
.
setCreateTime
(
cdate
);
repoCashDao
.
insertRepoCash
(
cash
);
repoCashDao
.
updateWalletAmt
(
account
.
getId
(),
cash
.
getAmtPaid
(),
amtPaid
);
return
PayCashResultDTO
.
success
(
amtPaid
,
cash
.
getPayNo
());
}
}
return
null
;
}
@Override
public
PayCashResultDTO
payCashOrder
(
RepoOrderPayVO
orderPay
)
{
BaseAccountDTO
account
=
orderPay
.
getAccount
();
OrderInfoDTO
orderInfo
=
orderPay
.
getOrderInfo
();
RepoWalletDO
wallet
=
repoCashDao
.
getRepoWalletInfo
(
account
.
getUserAccountId
());
if
(
wallet
==
null
)
{
return
PayCashResultDTO
.
error
(
ResultEnum
.
WALLET_NOT_FIND_ERROR
.
getResultCode
(),
ResultEnum
.
WALLET_NOT_FIND_ERROR
.
getResultMsg
());
}
BigDecimal
amtPaid
=
orderInfo
.
getShouldPay
();
if
(
amtPaid
.
compareTo
(
wallet
.
getCashAmt
())
>
0
)
{
return
PayCashResultDTO
.
error
(
ResultEnum
.
WALLET_CASH_NOT_ENOUGH_ERROR
.
getResultCode
(),
ResultEnum
.
WALLET_CASH_NOT_ENOUGH_ERROR
.
getResultMsg
());
}
Date
cdate
=
new
Date
();
RepoCashDO
cash
=
orderInfo
.
buildRepoCashDO
();
cash
.
setRepoAccountId
(
account
.
getUserAccountId
());
cash
.
setPayNo
(
CodeUtil
.
createRepoCashNo
());
cash
.
setPayMethod
(
RepoCashMethod
.
RENT
.
getCode
());
cash
.
setAmtPaid
(
amtPaid
.
multiply
(
BigDecimal
.
valueOf
(-
1
)));
cash
.
setCashAmt
(
wallet
.
getCashAmt
().
subtract
(
amtPaid
));
cash
.
setPayTime
(
cdate
);
cash
.
setCreateTime
(
cdate
);
repoCashDao
.
insertRepoCash
(
cash
);
repoCashDao
.
updateWalletAmt
(
account
.
getUserAccountId
(),
cash
.
getAmtPaid
(),
amtPaid
);
return
PayCashResultDTO
.
success
(
amtPaid
,
cash
.
getPayNo
());
}
}
}
src/main/java/com/mmc/payment/service/RepoCashService.java
浏览文件 @
ba450561
...
@@ -12,28 +12,28 @@ import com.mmc.payment.model.vo.RepoOrderPayVO;
...
@@ -12,28 +12,28 @@ import com.mmc.payment.model.vo.RepoOrderPayVO;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
/**
/**
* @Author small
* @Author small @Date 2023/5/24 10:06 @Version 1.0
* @Date 2023/5/24 10:06
* @Version 1.0
*/
*/
public
interface
RepoCashService
{
public
interface
RepoCashService
{
PageResult
listPageRepoCash
(
RepoCashQO
param
);
PageResult
listPageRepoCash
(
RepoCashQO
param
);
void
updateCashRemark
(
Integer
id
,
String
remark
);
void
updateCashRemark
(
Integer
id
,
String
remark
);
/**
/**
* 充值
* 充值
*
*
* @param cash
* @param cash
* @return
* @return
*/
*/
ResultBody
reqCash
(
BaseAccountDTO
cuser
,
RepoCashVO
cash
);
ResultBody
reqCash
(
BaseAccountDTO
cuser
,
RepoCashVO
cash
);
ResultBody
dedCash
(
BaseAccountDTO
cuser
,
RepoCashVO
cash
);
ResultBody
dedCash
(
BaseAccountDTO
cuser
,
RepoCashVO
cash
);
RepoCashDTO
getRefundInfo
(
String
refundNo
);
RepoCashDTO
getRefundInfo
(
String
refundNo
);
BigDecimal
RemainingBalance
(
Integer
uid
);
BigDecimal
RemainingBalance
(
Integer
uid
);
PayCashResultDTO
payCashOrder
(
RepoOrderPayVO
orderPay
);
PayCashResultDTO
orderPayment
(
BaseAccountDTO
currentAccount
,
String
orderNo
);
PayCashResultDTO
payCashOrder
(
RepoOrderPayVO
orderPay
);
}
}
src/main/resources/application-local.yml
浏览文件 @
ba450561
...
@@ -34,3 +34,7 @@ mount:
...
@@ -34,3 +34,7 @@ mount:
directory
:
D:@javaVolume@
directory
:
D:@javaVolume@
userapp
:
url
:
http://localhost:35150/userapp/
src/main/resources/mapper/RepoCashDao.xml
浏览文件 @
ba450561
...
@@ -6,43 +6,43 @@
...
@@ -6,43 +6,43 @@
<resultMap
id=
"repoWalletResultMap"
<resultMap
id=
"repoWalletResultMap"
type=
"com.mmc.payment.entity.RepoWalletDO"
>
type=
"com.mmc.payment.entity.RepoWalletDO"
>
<id
property=
"id"
column=
"id"
/>
<id
property=
"id"
column=
"id"
/>
<result
property=
"repoAccountId"
column=
"repo_account_id"
/>
<result
property=
"repoAccountId"
column=
"repo_account_id"
/>
<result
property=
"cashAmt"
column=
"cash_amt"
/>
<result
property=
"cashAmt"
column=
"cash_amt"
/>
<result
property=
"cashPaid"
column=
"cash_paid"
/>
<result
property=
"cashPaid"
column=
"cash_paid"
/>
<result
property=
"cashFreeze"
column=
"cash_freeze"
/>
<result
property=
"cashFreeze"
column=
"cash_freeze"
/>
<result
property=
"rcdRebateAmt"
column=
"rcd_rebate_amt"
/>
<result
property=
"rcdRebateAmt"
column=
"rcd_rebate_amt"
/>
<result
property=
"rebateWdl"
column=
"rebate_wdl"
/>
<result
property=
"rebateWdl"
column=
"rebate_wdl"
/>
<result
property=
"rebateFreeze"
column=
"rebate_freeze"
/>
<result
property=
"rebateFreeze"
column=
"rebate_freeze"
/>
<result
property=
"remark"
column=
"remark"
/>
<result
property=
"remark"
column=
"remark"
/>
<result
property=
"updateTime"
column=
"create_time"
/>
<result
property=
"updateTime"
column=
"create_time"
/>
<result
property=
"createTime"
column=
"update_time"
/>
<result
property=
"createTime"
column=
"update_time"
/>
</resultMap>
</resultMap>
<resultMap
id=
"repoCashResultMap"
<resultMap
id=
"repoCashResultMap"
type=
"com.mmc.payment.entity.RepoCashDO"
>
type=
"com.mmc.payment.entity.RepoCashDO"
>
<id
property=
"id"
column=
"id"
/>
<id
property=
"id"
column=
"id"
/>
<result
property=
"repoAccountId"
column=
"repo_account_id"
/>
<result
property=
"repoAccountId"
column=
"repo_account_id"
/>
<result
property=
"uid"
column=
"uid"
/>
<result
property=
"uid"
column=
"uid"
/>
<result
property=
"accountName"
column=
"account_name"
/>
<result
property=
"accountName"
column=
"account_name"
/>
<result
property=
"orderInfoId"
column=
"order_info_id"
/>
<result
property=
"orderInfoId"
column=
"order_info_id"
/>
<result
property=
"orderNo"
column=
"order_no"
/>
<result
property=
"orderNo"
column=
"order_no"
/>
<result
property=
"skuInfoId"
column=
"sku_info_id"
/>
<result
property=
"skuInfoId"
column=
"sku_info_id"
/>
<result
property=
"skuTitle"
column=
"sku_title"
/>
<result
property=
"skuTitle"
column=
"sku_title"
/>
<result
property=
"wareInfoId"
column=
"ware_info_id"
/>
<result
property=
"wareInfoId"
column=
"ware_info_id"
/>
<result
property=
"wareNo"
column=
"ware_no"
/>
<result
property=
"wareNo"
column=
"ware_no"
/>
<result
property=
"wareTitle"
column=
"ware_title"
/>
<result
property=
"wareTitle"
column=
"ware_title"
/>
<result
property=
"payNo"
column=
"pay_no"
/>
<result
property=
"payNo"
column=
"pay_no"
/>
<result
property=
"payMethod"
column=
"pay_method"
/>
<result
property=
"payMethod"
column=
"pay_method"
/>
<result
property=
"amtPaid"
column=
"amt_paid"
/>
<result
property=
"amtPaid"
column=
"amt_paid"
/>
<result
property=
"cashAmt"
column=
"cash_amt"
/>
<result
property=
"cashAmt"
column=
"cash_amt"
/>
<result
property=
"payTime"
column=
"pay_time"
/>
<result
property=
"payTime"
column=
"pay_time"
/>
<result
property=
"voucher"
column=
"voucher"
/>
<result
property=
"voucher"
column=
"voucher"
/>
<result
property=
"refundNo"
column=
"refund_no"
/>
<result
property=
"refundNo"
column=
"refund_no"
/>
<result
property=
"remark"
column=
"remark"
/>
<result
property=
"remark"
column=
"remark"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
<result
property=
"updateUser"
column=
"update_user"
/>
<result
property=
"updateUser"
column=
"update_user"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"createUser"
column=
"create_user"
/>
<result
property=
"createUser"
column=
"create_user"
/>
</resultMap>
</resultMap>
<select
id=
"getRefundCashInfo"
resultMap=
"repoCashResultMap"
<select
id=
"getRefundCashInfo"
resultMap=
"repoCashResultMap"
parameterType=
"Integer"
>
parameterType=
"Integer"
>
...
@@ -59,17 +59,13 @@
...
@@ -59,17 +59,13 @@
<insert
id=
"insertRepoCash"
useGeneratedKeys=
"true"
<insert
id=
"insertRepoCash"
useGeneratedKeys=
"true"
keyProperty=
"id"
parameterType=
"com.mmc.payment.entity.RepoCashDO"
>
keyProperty=
"id"
parameterType=
"com.mmc.payment.entity.RepoCashDO"
>
insert into repo_cash
insert into repo_cash
(
(repo_account_id, uid, account_name, order_info_id, order_no, sku_info_id, sku_title,
repo_account_id,uid,account_name,order_info_id,order_no,sku_info_id,sku_title,
ware_info_id, ware_no, ware_title, pay_no, pay_method, amt_paid, cash_amt, pay_time, remark,
ware_info_id,ware_no,ware_title,pay_no,pay_method,amt_paid,cash_amt,pay_time,remark,
voucher, refund_no, update_time, update_user, create_time, create_user)
voucher,refund_no,update_time,update_user,create_time,create_user
values (#{repoAccountId}, #{uid}, #{accountName}, #{orderInfoId}, #{orderNo}, #{skuInfoId}, #{skuTitle},
)
#{wareInfoId}, #{wareNo}, #{wareTitle}, #{payNo}, #{payMethod}, #{amtPaid}, #{cashAmt}, #{payTime},
values
#{remark},
(
#{voucher}, #{refundNo}, #{updateTime}, #{updateUser}, #{createTime}, #{createUser})
#{repoAccountId},#{uid},#{accountName},#{orderInfoId},#{orderNo},#{skuInfoId},#{skuTitle},
#{wareInfoId},#{wareNo},#{wareTitle},#{payNo},#{payMethod},#{amtPaid},#{cashAmt},#{payTime},#{remark},
#{voucher},#{refundNo},#{updateTime},#{updateUser},#{createTime},#{createUser}
)
</insert>
</insert>
<update
id=
"updateCashRemark"
>
<update
id=
"updateCashRemark"
>
...
@@ -138,12 +134,18 @@
...
@@ -138,12 +134,18 @@
</select>
</select>
<select
id=
"getRepoWalletInfo"
resultMap=
"repoWalletResultMap"
>
<select
id=
"getRepoWalletInfo"
resultMap=
"repoWalletResultMap"
>
select
select w.id,
w.id,w.repo_account_id,w.cash_amt,w.cash_freeze,
w.repo_account_id,
w.cash_paid,w.rcd_rebate_amt,w.rebate_wdl,w.rebate_freeze,w.create_time,w.update_time
w.cash_amt,
w.cash_freeze,
w.cash_paid,
w.rcd_rebate_amt,
w.rebate_wdl,
w.rebate_freeze,
w.create_time,
w.update_time
from repo_wallet w
from repo_wallet w
where
where w.repo_account_id = #{repoAccountId}
w.repo_account_id = #{repoAccountId}
</select>
</select>
<update
id=
"updateRepoWalletAmt"
>
<update
id=
"updateRepoWalletAmt"
>
...
@@ -153,14 +155,29 @@
...
@@ -153,14 +155,29 @@
</update>
</update>
<select
id=
"RemainingBalance"
resultType=
"java.math.BigDecimal"
>
<select
id=
"RemainingBalance"
resultType=
"java.math.BigDecimal"
>
select cash_amt from repo_wallet where repo_account_id=#{repoAccountId}
select cash_amt
from repo_wallet
where repo_account_id = #{repoAccountId}
</select>
</select>
<update
id=
"updateWalletAmt"
>
<update
id=
"updateWalletAmt"
>
update repo_wallet
update repo_wallet
set cash_amt = cash_amt + #{addAmt},
set cash_amt
= cash_amt + #{addAmt},
cash_paid = cash_paid + #{addPaid}
cash_paid = cash_paid + #{addPaid}
where repo_account_id = #{repoAccountId}
where repo_account_id = #{repoAccountId}
</update>
</update>
<insert
id=
"orderPayment"
useGeneratedKeys=
"true"
keyProperty=
"id"
parameterType=
"com.mmc.payment.entity.RepoCashDO"
>
insert into repo_cash
(repo_account_id, uid, account_name, order_info_id, order_no, sku_info_id, sku_title,
ware_info_id, ware_no, ware_title, pay_no, pay_method, amt_paid, cash_amt, pay_time, remark,
voucher, refund_no, update_time, update_user, create_time, create_user)
values (#{repoAccountId}, #{uid}, #{accountName}, #{orderInfoId}, #{orderNo}, #{skuInfoId}, #{skuTitle},
#{wareInfoId}, #{wareNo}, #{wareTitle}, #{payNo}, #{payMethod}, #{amtPaid}, #{cashAmt}, #{payTime},
#{remark},
#{voucher}, #{refundNo}, #{updateTime}, #{updateUser}, #{createTime}, #{createUser})
</insert>
</mapper>
</mapper>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论