From edea984a07d4d3654074bc13035ff397a4938dbb Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Wed, 16 Feb 2022 16:40:42 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=90=E5=88=B6=E7=A7=AF=E5=88=86=E8=AE=B0?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/cweb/controller/pay/CzOrderController.java | 9 ++++++++- .../main/java/com/hai/service/HighUserService.java | 11 +++++++++++ .../com/hai/service/impl/HighUserServiceImpl.java | 12 ++++++++++++ .../service/impl/OutRechargeOrderServiceImpl.java | 6 +++++- 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java b/hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java index 99bae71c..360ee523 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java @@ -228,7 +228,14 @@ public class CzOrderController { // 积分退款 if (order.getPayType() == 3) { - highUserService.goldHandle(order.getUserId(), order.getPayRealPrice().multiply(BigDecimal.valueOf(100)).intValue(), 1, 3, order.getId()); + + if (!highUserService.findGoldRepeat(3 , order.getId())) { + highUserService.goldHandle(order.getUserId(), order.getPayRealPrice().multiply(BigDecimal.valueOf(100)).intValue(), 1, 3, order.getId()); + }else { + log.error("orderToPay error!", "已有退款记录"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已有退款记录"); + } + } // 银联退款 diff --git a/hai-service/src/main/java/com/hai/service/HighUserService.java b/hai-service/src/main/java/com/hai/service/HighUserService.java index eed2dcf3..15344c25 100644 --- a/hai-service/src/main/java/com/hai/service/HighUserService.java +++ b/hai-service/src/main/java/com/hai/service/HighUserService.java @@ -108,6 +108,17 @@ public interface HighUserService { **/ void goldHandle(Long userId, Integer goldNum, Integer goldType, Integer resType, Long resId); + /** + * @Author Sum1Dream + * @name findGoldRepeat.java + * @Description // 查询用户是否有重复记录 + * @Date 3:55 下午 2022/2/16 + * @Param [java.lang.Integer, java.lang.Long] + * @return java.lang.Boolean + */ + Boolean findGoldRepeat(Integer resType , Long resId); + + Long countUser(); } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java index 4aea00bf..f34d8d5a 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java @@ -6,8 +6,10 @@ import com.hai.common.exception.SysCode; import com.hai.common.security.SessionObject; import com.hai.common.security.UserCenter; import com.hai.common.utils.DateUtil; +import com.hai.dao.HighGoldRecMapper; import com.hai.dao.HighUserMapper; import com.hai.entity.HighGoldRec; +import com.hai.entity.HighGoldRecExample; import com.hai.entity.HighUser; import com.hai.entity.HighUserExample; import com.hai.model.HighUserModel; @@ -50,6 +52,9 @@ public class HighUserServiceImpl implements HighUserService { @Resource private UserCenter userCenter; + @Resource + private HighGoldRecMapper highGoldRecMapper; + @Override public List getListUser(Map map) { @@ -224,4 +229,11 @@ public class HighUserServiceImpl implements HighUserService { HighUserExample example = new HighUserExample(); return highUserMapper.countByExample(example); } + + @Override + public Boolean findGoldRepeat(Integer resType, Long resId) { + HighGoldRecExample example = new HighGoldRecExample(); + example.createCriteria().andResIdEqualTo(resId).andResTypeEqualTo(resType); + return highGoldRecMapper.selectByExample(example) != null; + } } diff --git a/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java index 5162ed64..e7f7b3ff 100644 --- a/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java @@ -476,7 +476,11 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { // 金币退款 if (order.getPayType() == 3) { - highUserService.goldHandle(order.getUserId(), order.getPayRealPrice().intValue() * 100, 1, 3, order.getId()); + if (!highUserService.findGoldRepeat(3 , order.getId())) { + highUserService.goldHandle(order.getUserId(), order.getPayRealPrice().multiply(BigDecimal.valueOf(100)).intValue(), 1, 3, order.getId()); + }else { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已有退款记录"); + } order.setStatus(5); order.setRefundTime(new Date()); order.setOutRefundNo("HFR"+new Date().getTime() );