Explorar o código

积分不足,不允许进行该操作!

姜永辉 hai 1 ano
pai
achega
eed0798bd4

+ 15 - 0
src/main/java/com/dk/oauth/service/impl/CompanyServiceImpl.java

@@ -619,6 +619,13 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
 
             // 使用员工   // 积分的使用
             if (companyVO.getIntegral() != null && companyVO.getIntegral() > 0) {
+                // 公司积分--查询
+                IntegralResponse integralResponse = integralMapper.selectById(companyVO.getCpId());
+                if (integralResponse!=null && integralResponse.getIntegral() < companyVO.getIntegral()){
+                    // 积分不足,不允许进行该操作!
+                    throw new BaseBusinessException(ErrorCodeEnum.INTEGRAL_MAX.getCode(),
+                            ErrorCodeEnum.INTEGRAL_MAX.getMessage());
+                }
                 // 积分明细
                 IntegralItem integralItem = new IntegralItem();
                 integralItem.setIntegralType(Constant.IntegralType.INTEGRAL_TYPE_USE.getName());
@@ -701,6 +708,14 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
 
             // 使用员工   // 积分的使用
             if (companyVO.getIntegral() != null && companyVO.getIntegral() > 0) {
+                // 公司积分--查询
+                IntegralResponse integralResponse = integralMapper.selectById(companyVO.getCpId());
+                if (integralResponse!=null && integralResponse.getIntegral() < companyVO.getIntegral()){
+                    // 积分不足,不允许进行该操作!
+                    throw new BaseBusinessException(ErrorCodeEnum.INTEGRAL_MAX.getCode(),
+                            ErrorCodeEnum.INTEGRAL_MAX.getMessage());
+                }
+
                 // 积分明细
                 IntegralItem integralItem = new IntegralItem();
                 integralItem.setIntegralType(Constant.IntegralType.INTEGRAL_TYPE_USE.getName());