Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
I
ims-ci-test
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
test-ci
ims-ci-test
Commits
8818bbb0
提交
8818bbb0
authored
8月 31, 2023
作者:
张小凤
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Re(update)
上级
d666307a
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
97 行增加
和
14 行删除
+97
-14
NotRepeatSubmitConfig.java
...ava/com/mmc/csf/release/commit/NotRepeatSubmitConfig.java
+78
-0
RequirementsServiceImpl.java
...mmc/csf/release/service/impl/RequirementsServiceImpl.java
+19
-14
没有找到文件。
release-service/src/main/java/com/mmc/csf/release/commit/NotRepeatSubmitConfig.java
浏览文件 @
8818bbb0
package
com
.
mmc
.
csf
.
release
.
commit
;
package
com
.
mmc
.
csf
.
release
.
commit
;
import
com.alibaba.fastjson.JSONObject
;
import
com.mmc.csf.common.util.web.ResultBody
;
import
com.mmc.csf.infomation.vo.GrabTheOrderVO
;
import
com.mmc.csf.release.controller.BaseController
;
import
com.mmc.csf.release.controller.BaseController
;
import
com.mmc.csf.release.industry.UserPayInfoVO
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.aspectj.lang.annotation.Around
;
import
org.aspectj.lang.annotation.Around
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Pointcut
;
import
org.aspectj.lang.annotation.Pointcut
;
import
org.aspectj.lang.reflect.CodeSignature
;
import
org.aspectj.lang.reflect.MethodSignature
;
import
org.redisson.api.RLock
;
import
org.redisson.api.RLock
;
import
org.redisson.api.RedissonClient
;
import
org.redisson.api.RedissonClient
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.*
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
java.lang.reflect.Method
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeUnit
;
/**
/**
...
@@ -28,6 +40,15 @@ public class NotRepeatSubmitConfig extends BaseController {
...
@@ -28,6 +40,15 @@ public class NotRepeatSubmitConfig extends BaseController {
@Autowired
@Autowired
private
RedissonClient
redissonClient
;
private
RedissonClient
redissonClient
;
@Value
(
"${iuav.omsapp.url}"
)
private
String
omsApp
;
@Value
(
"${iuav.payment.url}"
)
private
String
paymentApp
;
@Autowired
private
RestTemplate
restTemplate
;
@Pointcut
(
"@within(notRepeatSubmit)||@annotation(notRepeatSubmit)"
)
@Pointcut
(
"@within(notRepeatSubmit)||@annotation(notRepeatSubmit)"
)
public
void
pointcut
(
NotRepeatSubmit
notRepeatSubmit
)
{
public
void
pointcut
(
NotRepeatSubmit
notRepeatSubmit
)
{
...
@@ -50,6 +71,21 @@ public class NotRepeatSubmitConfig extends BaseController {
...
@@ -50,6 +71,21 @@ public class NotRepeatSubmitConfig extends BaseController {
RLock
accountUriLock
=
redissonClient
.
getLock
(
accountUriLockKey
);
RLock
accountUriLock
=
redissonClient
.
getLock
(
accountUriLockKey
);
boolean
tryLock
;
boolean
tryLock
;
MethodSignature
signature
=
(
MethodSignature
)
proceedingJoinPoint
.
getSignature
();
Method
method
=
signature
.
getMethod
();
String
name
=
method
.
getDeclaringClass
().
getName
();
String
[]
parameterNames
=
signature
.
getParameterNames
();
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
Object
[]
values
=
proceedingJoinPoint
.
getArgs
();
String
[]
names
=
((
CodeSignature
)
proceedingJoinPoint
.
getSignature
()).
getParameterNames
();
for
(
int
i
=
0
;
i
<
names
.
length
;
i
++)
{
map
.
put
(
names
[
i
],
values
[
i
]);
}
log
.
info
(
map
+
""
);
GrabTheOrderVO
grabTheOrderVO
=
(
GrabTheOrderVO
)
map
.
get
(
"grabTheOrderVO"
);
//尝试获取分布式锁
//尝试获取分布式锁
//-1为永久 leaseTime 最多等待几秒 上锁以后leaseTime秒自动解锁
//-1为永久 leaseTime 最多等待几秒 上锁以后leaseTime秒自动解锁
...
@@ -57,6 +93,11 @@ public class NotRepeatSubmitConfig extends BaseController {
...
@@ -57,6 +93,11 @@ public class NotRepeatSubmitConfig extends BaseController {
log
.
info
(
"tryLock:"
+
tryLock
);
log
.
info
(
"tryLock:"
+
tryLock
);
if
(
tryLock
)
{
if
(
tryLock
)
{
try
{
try
{
String
wechatPayOrderNumber
=
grabTheOrderVO
.
getWechatPayOrderNumber
();
Integer
requirementsInfoId
=
grabTheOrderVO
.
getRequirementsInfoId
();
/* if (wechatPayOrderNumber != null) {
queryUserPayInfo()
}*/
// 查询订单库存判断是否大于0
// 查询订单库存判断是否大于0
// 大于0表示还有库存可以更新订单库存将库存数字减一更新到数据库中
// 大于0表示还有库存可以更新订单库存将库存数字减一更新到数据库中
...
@@ -76,4 +117,41 @@ public class NotRepeatSubmitConfig extends BaseController {
...
@@ -76,4 +117,41 @@ public class NotRepeatSubmitConfig extends BaseController {
}
}
/**
* 通过订单编号查看是否支付成功
*
* @param orderNo
* @return
*/
public
UserPayInfoVO
queryUserPayInfo
(
String
orderNo
,
HttpServletRequest
request
)
{
String
token
=
request
.
getHeader
(
"token"
);
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
headers
.
add
(
"token"
,
token
);
HttpEntity
<
String
>
entity
=
new
HttpEntity
<>(
JSONObject
.
toJSONString
(
orderNo
),
headers
);
ResponseEntity
<
UserPayInfoVO
>
exchange
=
restTemplate
.
exchange
(
paymentApp
+
"/payment/wechat/queryUserPayInfo?orderNo="
+
orderNo
,
HttpMethod
.
GET
,
entity
,
UserPayInfoVO
.
class
);
UserPayInfoVO
body
=
exchange
.
getBody
();
return
body
;
}
/**
* 删除抢单未支付的金额
*
* @param requirementsInfoId
* @param request
* @return
*/
public
ResultBody
getDelete
(
Integer
requirementsInfoId
,
HttpServletRequest
request
)
{
String
token
=
request
.
getHeader
(
"token"
);
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
headers
.
add
(
"token"
,
token
);
HttpEntity
<
String
>
entity
=
new
HttpEntity
<>(
JSONObject
.
toJSONString
(
requirementsInfoId
),
headers
);
ResponseEntity
<
ResultBody
>
exchange
=
restTemplate
.
exchange
(
omsApp
+
"releaseOrder/getDelete?requirementsInfoId="
+
requirementsInfoId
,
HttpMethod
.
GET
,
entity
,
ResultBody
.
class
);
//UserPayInfoVO body = exchange.getBody();
ResultBody
body
=
exchange
.
getBody
();
return
body
;
}
}
}
release-service/src/main/java/com/mmc/csf/release/service/impl/RequirementsServiceImpl.java
浏览文件 @
8818bbb0
...
@@ -1319,7 +1319,8 @@ public class RequirementsServiceImpl implements RequirementsService {
...
@@ -1319,7 +1319,8 @@ public class RequirementsServiceImpl implements RequirementsService {
RequirementsAmountDO
amountDO
=
new
RequirementsAmountDO
(
requirementsEditVO
);
RequirementsAmountDO
amountDO
=
new
RequirementsAmountDO
(
requirementsEditVO
);
if
(
requirementsEditVO
.
getWechatPayOrderNumber
()
!=
null
)
{
if
(
requirementsEditVO
.
getWechatPayOrderNumber
()
!=
null
)
{
UserPayInfoVO
userPayInfoVO
=
queryUserPayInfo
(
requirementsEditVO
.
getWechatPayOrderNumber
(),
request
);
UserPayInfoVO
userPayInfoVO
=
queryUserPayInfo
(
requirementsEditVO
.
getWechatPayOrderNumber
(),
request
);
if
(
userPayInfoVO
.
getTradeState
()
!=
"SUCCESS"
)
{
String
tradeState
=
userPayInfoVO
.
getTradeState
();
if
(!
"SUCCESS"
.
equals
(
tradeState
))
{
return
ResultBody
.
error
(
"支付失败,请重新支付"
);
return
ResultBody
.
error
(
"支付失败,请重新支付"
);
}
}
}
}
...
@@ -1327,6 +1328,16 @@ public class RequirementsServiceImpl implements RequirementsService {
...
@@ -1327,6 +1328,16 @@ public class RequirementsServiceImpl implements RequirementsService {
PublisherWalletFlowVO
publisherWalletFlowVO
=
new
PublisherWalletFlowVO
();
PublisherWalletFlowVO
publisherWalletFlowVO
=
new
PublisherWalletFlowVO
();
IsNullConvertZeroUtil
.
checkIsNull
(
publisherWalletFlowVO
);
IsNullConvertZeroUtil
.
checkIsNull
(
publisherWalletFlowVO
);
ApplyRefundVO
applyRefundVO
=
new
ApplyRefundVO
();
ApplyRefundVO
applyRefundVO
=
new
ApplyRefundVO
();
RequirementsInfoDO
infoDO
=
new
RequirementsInfoDO
(
requirementsEditVO
);
if
(
requirementsInfoDO
==
null
)
{
return
ResultBody
.
error
(
"只能修改自己发布的服务需求"
);
}
Integer
serviceFlowId
=
requirementsInfoDO
.
getServiceFlowId
();
if
(
serviceFlowId
!=
1
)
{
return
ResultBody
.
error
(
"只有未抢单的信息才能被修改"
);
}
//先退款
//先退款
if
(
requirementsInfoDO
.
getCashAmount
().
compareTo
(
BigDecimal
.
ZERO
)
!=
0
||
if
(
requirementsInfoDO
.
getCashAmount
().
compareTo
(
BigDecimal
.
ZERO
)
!=
0
||
requirementsInfoDO
.
getSalaryAmount
().
compareTo
(
BigDecimal
.
ZERO
)
!=
0
)
{
requirementsInfoDO
.
getSalaryAmount
().
compareTo
(
BigDecimal
.
ZERO
)
!=
0
)
{
...
@@ -1350,16 +1361,6 @@ public class RequirementsServiceImpl implements RequirementsService {
...
@@ -1350,16 +1361,6 @@ public class RequirementsServiceImpl implements RequirementsService {
applyRefund
(
applyRefundVO
,
request
.
getHeader
(
"token"
));
applyRefund
(
applyRefundVO
,
request
.
getHeader
(
"token"
));
}
}
RequirementsInfoDO
infoDO
=
new
RequirementsInfoDO
(
requirementsEditVO
);
if
(
requirementsInfoDO
==
null
)
{
return
ResultBody
.
error
(
"只能修改自己发布的服务需求"
);
}
Integer
serviceFlowId
=
requirementsInfoDO
.
getServiceFlowId
();
if
(
serviceFlowId
!=
1
)
{
return
ResultBody
.
error
(
"只有未抢单的信息才能被修改"
);
}
//用户钱包信息接口
//用户钱包信息接口
ResultBody
resultBody
=
getCurrentUserPayWalletInfo
(
request
);
ResultBody
resultBody
=
getCurrentUserPayWalletInfo
(
request
);
GetOrderNumberDTO
orderNumberDTO
=
new
GetOrderNumberDTO
();
GetOrderNumberDTO
orderNumberDTO
=
new
GetOrderNumberDTO
();
...
@@ -2377,9 +2378,13 @@ public class RequirementsServiceImpl implements RequirementsService {
...
@@ -2377,9 +2378,13 @@ public class RequirementsServiceImpl implements RequirementsService {
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
headers
.
add
(
"token"
,
token
);
headers
.
add
(
"token"
,
token
);
HttpEntity
<
String
>
entity
=
new
HttpEntity
<>(
JSONObject
.
toJSONString
(
orderNo
),
headers
);
HttpEntity
<
String
>
entity
=
new
HttpEntity
<>(
JSONObject
.
toJSONString
(
orderNo
),
headers
);
ResponseEntity
<
UserPayInfoVO
>
exchange
=
restTemplate
.
exchange
(
paymentApp
+
"/payment/wechat/queryUserPayInfo?orderNo="
+
orderNo
,
HttpMethod
.
GET
,
entity
,
UserPayInfoVO
.
class
);
ResponseEntity
<
Object
>
exchange
=
restTemplate
.
exchange
(
paymentApp
+
"/payment/wechat/queryUserPayInfo?orderNo="
+
orderNo
,
HttpMethod
.
GET
,
entity
,
Object
.
class
);
UserPayInfoVO
body
=
exchange
.
getBody
();
Object
body
=
exchange
.
getBody
();
return
body
;
String
s
=
JSONObject
.
toJSONString
(
body
);
UserPayInfoVO
userPayInfoVO
=
JSONObject
.
parseObject
(
s
,
UserPayInfoVO
.
class
);
System
.
out
.
println
(
userPayInfoVO
);
// UserPayInfoVO body = exchange.getBody();
return
userPayInfoVO
;
}
}
/**
/**
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论