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() );