diff --git a/service/src/main/java/com/hfkj/service/user/impl/UserIntegralServiceImpl.java b/service/src/main/java/com/hfkj/service/user/impl/UserIntegralServiceImpl.java index c718cfb..5822b14 100644 --- a/service/src/main/java/com/hfkj/service/user/impl/UserIntegralServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/user/impl/UserIntegralServiceImpl.java @@ -1,5 +1,6 @@ package com.hfkj.service.user.impl; +import com.hfkj.common.exception.BaseException; import com.hfkj.common.exception.ErrorCode; import com.hfkj.common.exception.ErrorHelp; import com.hfkj.common.exception.SysCode; @@ -118,7 +119,7 @@ public class UserIntegralServiceImpl implements UserIntegralService { if (user == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的账户"); } - if (user.getIntegral() > integralNum) { + if (user.getIntegral() < integralNum) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "积分数量不足"); } // 变更前积分数 @@ -147,6 +148,8 @@ public class UserIntegralServiceImpl implements UserIntegralService { record.setOpUserPhone(MapUtils.getString(source, "opUserPhone")); userIntegralRecordService.create(record); + } catch (BaseException e) { + throw e; } catch (Exception e) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "积分交易异常"); } finally {