Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
O
oms
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
iuav
oms
Commits
6dbd5c9e
提交
6dbd5c9e
authored
8月 23, 2023
作者:
xiaowang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
bug修复
上级
6448a0fb
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
27 行增加
和
19 行删除
+27
-19
UserAppApi.java
src/main/java/com/mmc/oms/feign/UserAppApi.java
+2
-2
FeignConfiguration.java
...ain/java/com/mmc/oms/feign/config/FeignConfiguration.java
+1
-1
DemandReleaseOrderServiceImpl.java
...ms/service/demand/Impl/DemandReleaseOrderServiceImpl.java
+24
-16
没有找到文件。
src/main/java/com/mmc/oms/feign/UserAppApi.java
浏览文件 @
6dbd5c9e
...
@@ -4,7 +4,7 @@ import com.mmc.oms.common.result.ResultBody;
...
@@ -4,7 +4,7 @@ import com.mmc.oms.common.result.ResultBody;
import
com.mmc.oms.feign.hystrix.UserAppApiHystrix
;
import
com.mmc.oms.feign.hystrix.UserAppApiHystrix
;
import
com.mmc.oms.model.vo.wallet.TopUpOrderVO
;
import
com.mmc.oms.model.vo.wallet.TopUpOrderVO
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.
Ge
tMapping
;
import
org.springframework.web.bind.annotation.
Pos
tMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
/**
/**
...
@@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RequestBody;
...
@@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RequestBody;
*/
*/
@FeignClient
(
url
=
"${userapp.url}"
,
name
=
"cms-svc"
,
fallback
=
UserAppApiHystrix
.
class
)
@FeignClient
(
url
=
"${userapp.url}"
,
name
=
"cms-svc"
,
fallback
=
UserAppApiHystrix
.
class
)
public
interface
UserAppApi
{
public
interface
UserAppApi
{
@
Ge
tMapping
(
"pay/feignTopUpCash"
)
@
Pos
tMapping
(
"pay/feignTopUpCash"
)
public
ResultBody
feignTopUpCash
(
@RequestBody
TopUpOrderVO
topUpOrderVO
);
public
ResultBody
feignTopUpCash
(
@RequestBody
TopUpOrderVO
topUpOrderVO
);
}
}
src/main/java/com/mmc/oms/feign/config/FeignConfiguration.java
浏览文件 @
6dbd5c9e
...
@@ -20,7 +20,7 @@ public class FeignConfiguration {
...
@@ -20,7 +20,7 @@ public class FeignConfiguration {
}
}
@Bean
(
name
=
"userAppApiHystrix"
)
@Bean
(
name
=
"userAppApiHystrix"
)
public
UserAppApiHystrix
userApp
()
{
public
UserAppApiHystrix
userApp
Api
()
{
return
new
UserAppApiHystrix
();
return
new
UserAppApiHystrix
();
}
}
...
...
src/main/java/com/mmc/oms/service/demand/Impl/DemandReleaseOrderServiceImpl.java
浏览文件 @
6dbd5c9e
...
@@ -25,6 +25,7 @@ import org.springframework.data.redis.core.StringRedisTemplate;
...
@@ -25,6 +25,7 @@ import org.springframework.data.redis.core.StringRedisTemplate;
import
org.springframework.http.*
;
import
org.springframework.http.*
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
org.springframework.web.client.RestClientException
;
import
org.springframework.web.client.RestClientException
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
...
@@ -71,6 +72,7 @@ public class DemandReleaseOrderServiceImpl implements DemandReleaseOrderService
...
@@ -71,6 +72,7 @@ public class DemandReleaseOrderServiceImpl implements DemandReleaseOrderService
}
}
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResultBody
orderPayment
(
CommonPaymentVO
commonPaymentVO
,
HttpServletRequest
request
,
Integer
userAccountId
)
{
public
ResultBody
orderPayment
(
CommonPaymentVO
commonPaymentVO
,
HttpServletRequest
request
,
Integer
userAccountId
)
{
String
token
=
request
.
getHeader
(
"token"
);
String
token
=
request
.
getHeader
(
"token"
);
switch
(
commonPaymentVO
.
getOrderPort
().
toString
())
{
switch
(
commonPaymentVO
.
getOrderPort
().
toString
())
{
...
@@ -89,23 +91,29 @@ public class DemandReleaseOrderServiceImpl implements DemandReleaseOrderService
...
@@ -89,23 +91,29 @@ public class DemandReleaseOrderServiceImpl implements DemandReleaseOrderService
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResultBody
topUpOrder
(
CommonPaymentVO
commonPaymentVO
,
String
token
,
Integer
userAccountId
)
{
public
ResultBody
topUpOrder
(
CommonPaymentVO
commonPaymentVO
,
String
token
,
Integer
userAccountId
)
{
// 生成充值订单编号 规则T加时间戳加用户id加随机数4位
// 生成充值订单编号 规则T加时间戳加用户id加随机数4位
String
TOrderNo
=
"T"
+
TDateUtil
.
getDateStr
(
new
Date
(),
TDateUtil
.
TYPE
)
+
userAccountId
+
CodeUtil
.
getRandomNum
(
4
);
ResultBody
resultBody
=
null
;
OrderRequestParamsVO
orderRequestParamsVO
=
new
OrderRequestParamsVO
();
try
{
orderRequestParamsVO
.
setAmount
(
commonPaymentVO
.
getAmount
());
String
TOrderNo
=
"T"
+
TDateUtil
.
getDateStr
(
new
Date
(),
TDateUtil
.
TYPE
)
+
userAccountId
+
CodeUtil
.
getRandomNum
(
4
);
orderRequestParamsVO
.
setOrderNo
(
TOrderNo
);
OrderRequestParamsVO
orderRequestParamsVO
=
new
OrderRequestParamsVO
();
orderRequestParamsVO
.
setDescription
(
"云享金充值"
);
orderRequestParamsVO
.
setAmount
(
commonPaymentVO
.
getAmount
());
orderRequestParamsVO
.
setOrderPort
(
5
);
orderRequestParamsVO
.
setOrderNo
(
TOrderNo
);
orderRequestParamsVO
.
setAttach
(
"TOP_UP"
);
orderRequestParamsVO
.
setDescription
(
"云享金充值"
);
TopUpOrderDO
topUpOrderDO
=
new
TopUpOrderDO
(
orderRequestParamsVO
,
userAccountId
);
orderRequestParamsVO
.
setOrderPort
(
5
);
topUpOrderDO
.
setTradeState
(
"WAIT"
);
orderRequestParamsVO
.
setAttach
(
"TOP_UP"
);
topUpOrderDO
.
setDescription
(
"充值云享金"
);
TopUpOrderDO
topUpOrderDO
=
new
TopUpOrderDO
(
orderRequestParamsVO
,
userAccountId
);
// 充值订单记录至充值订单表
topUpOrderDO
.
setTradeState
(
"WAIT"
);
topUpOrderDao
.
insertTopUpOrder
(
topUpOrderDO
);
topUpOrderDO
.
setDescription
(
"充值云享金"
);
ResultBody
resultBody
=
releaseOrder
(
orderRequestParamsVO
,
token
);
// 充值订单记录至充值订单表
if
(!
"200"
.
equals
(
resultBody
.
getCode
()))
{
topUpOrderDao
.
insertTopUpOrder
(
topUpOrderDO
);
throw
new
RuntimeException
(
"调用微信支付方法失败!"
);
resultBody
=
releaseOrder
(
orderRequestParamsVO
,
token
);
if
(!
"200"
.
equals
(
resultBody
.
getCode
()))
{
throw
new
RuntimeException
(
"调用微信支付方法失败!"
);
}
}
catch
(
RuntimeException
e
)
{
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
}
finally
{
return
resultBody
;
}
}
return
resultBody
;
}
}
/**
/**
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论