提交 6dbd5c9e 作者: xiaowang

bug修复

上级 6448a0fb
...@@ -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.GetMapping; import org.springframework.web.bind.annotation.PostMapping;
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 {
@GetMapping("pay/feignTopUpCash") @PostMapping("pay/feignTopUpCash")
public ResultBody feignTopUpCash(@RequestBody TopUpOrderVO topUpOrderVO); public ResultBody feignTopUpCash(@RequestBody TopUpOrderVO topUpOrderVO);
} }
...@@ -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 userAppApi() {
return new UserAppApiHystrix(); return new UserAppApiHystrix();
} }
......
...@@ -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,6 +91,8 @@ public class DemandReleaseOrderServiceImpl implements DemandReleaseOrderService ...@@ -89,6 +91,8 @@ 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位
ResultBody resultBody = null;
try {
String TOrderNo = "T" + TDateUtil.getDateStr(new Date(), TDateUtil.TYPE) + userAccountId + CodeUtil.getRandomNum(4); String TOrderNo = "T" + TDateUtil.getDateStr(new Date(), TDateUtil.TYPE) + userAccountId + CodeUtil.getRandomNum(4);
OrderRequestParamsVO orderRequestParamsVO = new OrderRequestParamsVO(); OrderRequestParamsVO orderRequestParamsVO = new OrderRequestParamsVO();
orderRequestParamsVO.setAmount(commonPaymentVO.getAmount()); orderRequestParamsVO.setAmount(commonPaymentVO.getAmount());
...@@ -101,12 +105,16 @@ public class DemandReleaseOrderServiceImpl implements DemandReleaseOrderService ...@@ -101,12 +105,16 @@ public class DemandReleaseOrderServiceImpl implements DemandReleaseOrderService
topUpOrderDO.setDescription("充值云享金"); topUpOrderDO.setDescription("充值云享金");
// 充值订单记录至充值订单表 // 充值订单记录至充值订单表
topUpOrderDao.insertTopUpOrder(topUpOrderDO); topUpOrderDao.insertTopUpOrder(topUpOrderDO);
ResultBody resultBody = releaseOrder(orderRequestParamsVO, token); resultBody = releaseOrder(orderRequestParamsVO, token);
if (!"200".equals(resultBody.getCode())) { if (!"200".equals(resultBody.getCode())) {
throw new RuntimeException("调用微信支付方法失败!"); throw new RuntimeException("调用微信支付方法失败!");
} }
} catch (RuntimeException e) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
} finally {
return resultBody; return resultBody;
} }
}
/** /**
* 服务需求发布 * 服务需求发布
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论