Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
payment
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
iuav
payment
Commits
86550cee
提交
86550cee
authored
5月 25, 2023
作者:
张小凤
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
payment(add)
上级
18b7ef67
显示空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
175 行增加
和
38 行删除
+175
-38
pom.xml
pom.xml
+5
-0
RestTemplateConfig.java
src/main/java/com/mmc/payment/config/RestTemplateConfig.java
+30
-0
RepoCashController.java
...n/java/com/mmc/payment/controller/RepoCashController.java
+7
-5
RepoCashDao.java
src/main/java/com/mmc/payment/dao/RepoCashDao.java
+6
-0
UserAccountSimpleDTO.java
.../java/com/mmc/payment/model/dto/UserAccountSimpleDTO.java
+48
-0
RepoCashServiceImpl.java
...ava/com/mmc/payment/service/Impl/RepoCashServiceImpl.java
+42
-24
application-dev.yml
src/main/resources/application-dev.yml
+3
-3
application-local.yml
src/main/resources/application-local.yml
+3
-3
application-prod.yml
src/main/resources/application-prod.yml
+2
-2
RepoCashDao.xml
src/main/resources/mapper/RepoCashDao.xml
+29
-1
没有找到文件。
pom.xml
浏览文件 @
86550cee
...
...
@@ -82,11 +82,16 @@
<artifactId>
fastjson
</artifactId>
<version>
2.0.32
</version>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-redis
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
</dependencies>
<build>
...
...
src/main/java/com/mmc/payment/config/RestTemplateConfig.java
0 → 100644
浏览文件 @
86550cee
package
com
.
mmc
.
payment
.
config
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.http.client.ClientHttpRequestFactory
;
import
org.springframework.http.client.SimpleClientHttpRequestFactory
;
import
org.springframework.web.client.RestTemplate
;
/**
* @Author small
* @Date 2023/5/25 17:45
* @Version 1.0
*/
@Configuration
public
class
RestTemplateConfig
{
@Bean
public
RestTemplate
restTemplate
(
ClientHttpRequestFactory
factory
)
{
return
new
RestTemplate
(
factory
);
}
@Bean
public
ClientHttpRequestFactory
simpleClientHttpRequestFactory
()
{
SimpleClientHttpRequestFactory
factory
=
new
SimpleClientHttpRequestFactory
();
// 设置连接超时
factory
.
setConnectTimeout
(
15000
);
factory
.
setReadTimeout
(
5000
);
return
factory
;
}
}
src/main/java/com/mmc/payment/controller/RepoCashController.java
浏览文件 @
86550cee
...
...
@@ -24,7 +24,7 @@ import javax.servlet.http.HttpServletRequest;
@Api
(
tags
=
{
"消耗-现金-接口"
})
@RestController
@RequestMapping
(
"/repocash/"
)
public
class
RepoCashController
extends
BaseController
{
public
class
RepoCashController
{
@Autowired
private
RepoCashService
repoCashService
;
...
...
@@ -44,20 +44,22 @@ public class RepoCashController extends BaseController {
return
ResultBody
.
success
();
}
@ApiOperation
(
value
=
"现金-充值"
)
@ApiOperation
(
value
=
"
v1.0.1-NO
现金-充值"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)
})
@RepeatSubmit
@PostMapping
(
"reqCash"
)
public
ResultBody
reqCash
(
HttpServletRequest
request
,
@RequestBody
RepoCashVO
param
)
{
return
repoCashService
.
reqCash
(
this
.
getCurrentAccount
(
request
),
param
);
return
repoCashService
.
reqCash
(
null
,
param
);
//repoCashService.reqCash(this.getCurrentAccount(request), param);
}
@ApiOperation
(
value
=
"现金-手动扣除"
)
@ApiOperation
(
value
=
"
v1.0.1-NO
现金-手动扣除"
)
@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
);
//repoCashService.dedCash(this.getCurrentAccount(request), param)
return
repoCashService
.
dedCash
(
null
,
param
);
}
@ApiOperation
(
value
=
"feign-查询退款金额"
)
...
...
src/main/java/com/mmc/payment/dao/RepoCashDao.java
浏览文件 @
86550cee
package
com
.
mmc
.
payment
.
dao
;
import
com.mmc.payment.entity.RepoCashDO
;
import
com.mmc.payment.entity.RepoWalletDO
;
import
com.mmc.payment.model.qo.RepoCashQO
;
import
org.apache.ibatis.annotations.Mapper
;
import
java.math.BigDecimal
;
import
java.util.List
;
/**
...
...
@@ -22,4 +24,8 @@ public interface RepoCashDao {
List
<
RepoCashDO
>
listPagePFRepoCash
(
RepoCashQO
param
);
int
countPagePFRepoCash
(
RepoCashQO
param
);
RepoWalletDO
getRepoWalletInfo
(
Integer
repoAccountId
);
void
updateRepoWalletAmt
(
Integer
repoAccountId
,
BigDecimal
chageAmt
);
}
src/main/java/com/mmc/payment/model/dto/UserAccountSimpleDTO.java
0 → 100644
浏览文件 @
86550cee
package
com
.
mmc
.
payment
.
model
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
/**
* @Author small
* @Date 2023/5/25 17:50
* @Version 1.0
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public
class
UserAccountSimpleDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
3451336520607073343L
;
@ApiModelProperty
(
value
=
"用户id"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"用户类型"
)
private
Integer
accountType
;
@ApiModelProperty
(
value
=
"用户uid"
)
private
String
uid
;
@ApiModelProperty
(
value
=
"手机号"
)
private
String
phoneNum
;
@ApiModelProperty
(
value
=
"用户名称"
)
private
String
userName
;
@ApiModelProperty
(
value
=
"用户昵称"
)
private
String
nickName
;
@ApiModelProperty
(
value
=
"用户头像"
)
private
String
userImg
;
@ApiModelProperty
(
value
=
"用户性别:0未知、1男、2女"
)
private
Integer
userSex
;
@ApiModelProperty
(
value
=
"用户邮箱"
)
private
String
email
;
@ApiModelProperty
(
value
=
"用户来源,0自然流、1海报、2抖音、3公众号、4社群、5招投标、6官网"
)
private
Integer
source
;
@ApiModelProperty
(
value
=
"用户可用状态:0禁用、1可用"
)
private
Integer
accountStatus
;
@ApiModelProperty
(
value
=
"账号类型:0后台管理账号 ; 100云享飞-客户端;"
)
private
Integer
portType
;
@ApiModelProperty
(
value
=
"企业认证状态, 0未通过,1通过"
)
private
Integer
companyAuthStatus
;
}
src/main/java/com/mmc/payment/service/Impl/RepoCashServiceImpl.java
浏览文件 @
86550cee
package
com
.
mmc
.
payment
.
service
.
Impl
;
import
com.alibaba.fastjson.JSON
;
import
com.mmc.payment.common.*
;
import
com.mmc.payment.config.RepoCashMethod
;
import
com.mmc.payment.dao.RepoCashDao
;
import
com.mmc.payment.entity.RepoCashDO
;
import
com.mmc.payment.entity.RepoWalletDO
;
import
com.mmc.payment.model.dto.BaseAccountDTO
;
import
com.mmc.payment.model.dto.RepoAccountDTO
;
import
com.mmc.payment.model.dto.RepoCashDTO
;
import
com.mmc.payment.model.dto.UserAccountDTO
;
import
com.mmc.payment.model.dto.*
;
import
com.mmc.payment.model.qo.RepoCashQO
;
import
com.mmc.payment.model.qo.UserAccountQO
;
import
com.mmc.payment.model.vo.RepoCashVO
;
import
com.mmc.payment.service.RepoCashService
;
import
io.jsonwebtoken.lang.Collections
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.client.RestTemplate
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
...
...
@@ -35,6 +35,9 @@ public class RepoCashServiceImpl implements RepoCashService {
@Autowired
private
RepoCashDao
repoCashDao
;
@Autowired
private
RestTemplate
restTemplate
;
/* @Autowired
private RepoWalletDao repoWalletDao;*/
...
...
@@ -64,7 +67,12 @@ public class RepoCashServiceImpl implements RepoCashService {
}).
collect
(
Collectors
.
toList
());
UserAccountQO
uq
=
UserAccountQO
.
builder
().
userIds
(
userIds
).
build
();
List
<
UserAccountDTO
>
users
=
null
;
//userServletClient.feignListUserAccountById(uq);
// userServletClient.feignListUserAccountById(uq);
// 远程调用
ResponseEntity
<
String
>
response
=
restTemplate
.
getForEntity
(
"http://localhost:35150/userapp/user-account/feignGetUserSimpleInfo?userAccountId=1"
+
userIds
,
String
.
class
);
String
body
=
response
.
getBody
();
Map
<
Integer
,
UserAccountDTO
>
mapUser
=
users
.
stream
()
.
collect
(
Collectors
.
toMap
(
UserAccountDTO:
:
getId
,
ud
->
ud
,
(
k1
,
k2
)
->
k2
));
data
.
forEach
(
d
->
{
...
...
@@ -91,30 +99,33 @@ public class RepoCashServiceImpl implements RepoCashService {
// 密码认证
ResultBody
body
=
null
;
//userServletClient.feignAuthUserPwd(cuser.getId(), cash.getAuthPwd());
if
(!
ResultEnum
.
SUCCESS
.
getResultCode
().
equals
(
body
.
getCode
()))
{
/*
if (!ResultEnum.SUCCESS.getResultCode().equals(body.getCode())) {
return body;
}
}
*/
// 用户信息
RepoAccountDTO
account
=
null
;
//
RepoAccountDTO account = null;
//repoServletClient.feignAccountSimpleInfo(cash.getRepoAccountId());
ResponseEntity
<
String
>
response
=
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
(
account
==
null
)
{
return
ResultBody
.
error
(
ResultEnum
.
FEIGN_REPOUSER_SERVLET_ERROR
);
}
RepoWalletDO
wallet
=
null
;
//repoWalletDao.getRepoWalletInfo(cash.getRepoAccountId());
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);
//
}
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
.
get
Account
Name
());
rc
.
setAccountName
(
account
.
get
User
Name
());
rc
.
setPayNo
(
CodeUtil
.
createRepoCashNo
());
rc
.
setPayMethod
(
RepoCashMethod
.
REG
.
getCode
());
rc
.
setAmtPaid
(
cash
.
getAmtPaid
());
...
...
@@ -125,9 +136,11 @@ public class RepoCashServiceImpl implements RepoCashService {
rc
.
setVoucher
(
voucher
);
rc
.
setRemark
(
cash
.
getRemark
());
rc
.
setCreateTime
(
cdate
);
rc
.
setCreateUser
(
cuser
.
getId
());
//rc.setCreateUser(cuser.getId());
rc
.
setCreateUser
(
1
);
repoCashDao
.
insertRepoCash
(
rc
);
// repoWallet
Dao.updateRepoWalletAmt(account.getId(), rc.getAmtPaid());
repoCash
Dao
.
updateRepoWalletAmt
(
account
.
getId
(),
rc
.
getAmtPaid
());
return
ResultBody
.
success
();
}
...
...
@@ -140,18 +153,22 @@ public class RepoCashServiceImpl implements RepoCashService {
// 密码认证
ResultBody
body
=
null
;
//userServletClient.feignAuthUserPwd(cuser.getId(), cash.getAuthPwd());
if
(!
ResultEnum
.
SUCCESS
.
getResultCode
().
equals
(
body
.
getCode
()))
{
/*
if (!ResultEnum.SUCCESS.getResultCode().equals(body.getCode())) {
return body;
}
}*/
// 用户信息
RepoAccountDTO
account
=
null
;
//
RepoAccountDTO account =null;
//repoServletClient.feignAccountSimpleInfo(cash.getRepoAccountId());
ResponseEntity
<
String
>
response
=
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
(
account
==
null
)
{
return
ResultBody
.
error
(
ResultEnum
.
FEIGN_REPOUSER_SERVLET_ERROR
);
}
RepoWalletDO
wallet
=
null
;
//repoWalletDao.getRepoWalletInfo(cash.getRepoAccountId());
RepoWalletDO
wallet
=
repoCashDao
.
getRepoWalletInfo
(
cash
.
getRepoAccountId
());
if
(
wallet
==
null
)
{
return
ResultBody
.
error
(
ResultEnum
.
WALLET_NOT_FIND_ERROR
);
}
...
...
@@ -163,7 +180,7 @@ public class RepoCashServiceImpl implements RepoCashService {
RepoCashDO
rc
=
new
RepoCashDO
();
rc
.
setRepoAccountId
(
account
.
getId
());
rc
.
setUid
(
account
.
getUid
());
rc
.
setAccountName
(
account
.
get
Account
Name
());
rc
.
setAccountName
(
account
.
get
User
Name
());
rc
.
setPayNo
(
CodeUtil
.
createRepoCashNo
());
rc
.
setPayMethod
(
RepoCashMethod
.
HANDLER
.
getCode
());
rc
.
setAmtPaid
(
cash
.
getAmtPaid
().
multiply
(
BigDecimal
.
valueOf
(-
1
)));
...
...
@@ -175,9 +192,10 @@ public class RepoCashServiceImpl implements RepoCashService {
rc
.
setVoucher
(
voucher
);
rc
.
setRemark
(
cash
.
getRemark
());
rc
.
setCreateTime
(
cdate
);
rc
.
setCreateUser
(
cuser
.
getId
());
// rc.setCreateUser(cuser.getId());
rc
.
setCreateUser
(
1
);
repoCashDao
.
insertRepoCash
(
rc
);
//repoWallet
Dao.updateRepoWalletAmt(account.getId(), rc.getAmtPaid());
repoCash
Dao
.
updateRepoWalletAmt
(
account
.
getId
(),
rc
.
getAmtPaid
());
return
ResultBody
.
success
();
}
...
...
src/main/resources/application-dev.yml
浏览文件 @
86550cee
...
...
@@ -2,14 +2,14 @@ spring:
datasource
:
type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://mysql.default:3306/iuav_p
ms
?characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
url
:
jdbc:mysql://mysql.default:3306/iuav_p
ayment
?characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
username
:
tmj
password
:
MMC@2022&MYSQL
redis
:
database
:
3
database
:
1
host
:
r-wz9ke310fs684hacn1pd.redis.rds.aliyuncs.com
port
:
6379
password
:
MMC@2022&REDIS
port
:
6379
jedis
:
pool
:
max-active
:
2
...
...
src/main/resources/application-local.yml
浏览文件 @
86550cee
...
...
@@ -2,12 +2,12 @@ spring:
datasource
:
type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://rm-wz9dd796t4j1giz6t2o.mysql.rds.aliyuncs.com:3306/iuav_p
ms
?characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
url
:
jdbc:mysql://rm-wz9dd796t4j1giz6t2o.mysql.rds.aliyuncs.com:3306/iuav_p
ayment
?characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
username
:
tmj
password
:
MMC@2022&MYSQL
redis
:
database
:
3
host
:
r-wz9ke310fs684hacn1.redis.rds.aliyuncs.com
database
:
1
host
:
r-wz9ke310fs684hacn1
pd
.redis.rds.aliyuncs.com
port
:
6379
password
:
MMC@2022&REDIS
jedis
:
...
...
src/main/resources/application-prod.yml
浏览文件 @
86550cee
...
...
@@ -2,11 +2,11 @@ spring:
datasource
:
type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://mysql.default:3306/iuav_p
ms
?characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
url
:
jdbc:mysql://mysql.default:3306/iuav_p
ayment
?characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
username
:
tmj
password
:
MMC@2022&MYSQL
redis
:
database
:
3
database
:
1
host
:
r-wz9ke310fs684hacn1pd.redis.rds.aliyuncs.com
port
:
6379
password
:
MMC@2022&REDIS
...
...
src/main/resources/mapper/RepoCashDao.xml
浏览文件 @
86550cee
...
...
@@ -4,7 +4,20 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.mmc.payment.dao.RepoCashDao"
>
<resultMap
id=
"repoWalletResultMap"
type=
"com.mmc.payment.entity.RepoWalletDO"
>
<id
property=
"id"
column=
"id"
/>
<result
property=
"repoAccountId"
column=
"repo_account_id"
/>
<result
property=
"cashAmt"
column=
"cash_amt"
/>
<result
property=
"cashPaid"
column=
"cash_paid"
/>
<result
property=
"cashFreeze"
column=
"cash_freeze"
/>
<result
property=
"rcdRebateAmt"
column=
"rcd_rebate_amt"
/>
<result
property=
"rebateWdl"
column=
"rebate_wdl"
/>
<result
property=
"rebateFreeze"
column=
"rebate_freeze"
/>
<result
property=
"remark"
column=
"remark"
/>
<result
property=
"updateTime"
column=
"create_time"
/>
<result
property=
"createTime"
column=
"update_time"
/>
</resultMap>
<resultMap
id=
"repoCashResultMap"
type=
"com.mmc.payment.entity.RepoCashDO"
>
<id
property=
"id"
column=
"id"
/>
...
...
@@ -123,4 +136,19 @@
</if>
</where>
</select>
<select
id=
"getRepoWalletInfo"
resultMap=
"repoWalletResultMap"
>
select
w.id,w.repo_account_id,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
where
w.repo_account_id = #{repoAccountId}
</select>
<update
id=
"updateRepoWalletAmt"
>
update repo_wallet
set cash_amt = cash_amt + #{chageAmt}
where repo_account_id = #{repoAccountId}
</update>
</mapper>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论