| | |
| | | } |
| | | |
| | | //查询不可使用原因 |
| | | userMoneyUnclaimedInfo.setIsShowNotUse(0); |
| | | userMoneyUnclaimedInfo.setIsShowNotUse(BaseEntity.NO); |
| | | /*当前这个判断先不用 |
| | | if (userMoneyUnclaimed.getIsSelectNotUse() != null && userMoneyUnclaimed.getIsSelectNotUse().equals(BaseEntity.YES)){ |
| | | String canUseReason = getCanUseReason(userMoneyUnclaimedInfo); |
| | | if (StringUtils.noNull(canUseReason)){ |
| | | userMoneyUnclaimedInfo.setIsShowNotUse(1); |
| | | userMoneyUnclaimedInfo.setNotUseReason(canUseReason); |
| | | } |
| | | |
| | | }*/ |
| | | String canUseReason = getCanUseReason(userMoneyUnclaimedInfo); |
| | | if (StringUtils.noNull(canUseReason)){ |
| | | userMoneyUnclaimedInfo.setIsShowNotUse(1); |
| | | userMoneyUnclaimedInfo.setNotUseReason(canUseReason); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | /**获取不可领取原因*/ |
| | | private String getCanUseReason(UserMoneyUnclaimed userMoneyUnclaimed) { |
| | | if (userMoneyUnclaimed.getIsReceiveLimit() != null && userMoneyUnclaimed.getIsReceiveLimit().equals(BaseEntity.YES)){ |
| | | // 具体限制类型 |
| | | if (userMoneyUnclaimed.getReceiveLimitType() != null){ |
| | | List<MoneyRuleValueDto> limitList = JSONArray.parseArray(userMoneyUnclaimed.getReceiveLimitData(), MoneyRuleValueDto.class); |
| | | if (limitList != null && limitList.size() > 0){ |
| | | //判断校验逻辑 |
| | | if (userMoneyUnclaimed.getReceiveLimitType().equals(BaseEntity.YES)){ |
| | | boolean isPass = false; |
| | | StringBuilder msg = new StringBuilder(); |
| | | //满足其一 |
| | | for (MoneyRuleValueDto moneyRuleValueDto : limitList) { |
| | | //满足一个则设为通过,退出循环 |
| | | if (SysFunctionLimitEnum.checkPassByCode(moneyRuleValueDto.getFunctionCode() |
| | | ,userMoneyUnclaimed.getUserId(),userMoneyUnclaimed.getOrderId())){ |
| | | if (msg.length() > 0){ |
| | | msg.append(","); |
| | | } |
| | | msg.append(SysFunctionLimitEnum.getNameByCode(moneyRuleValueDto.getFunctionCode())); |
| | | isPass = true; |
| | | break; |
| | | } |
| | | } |
| | | if (!isPass){ |
| | | return "未达成其中一个条件:" + msg; |
| | | } |
| | | } else if (userMoneyUnclaimed.getReceiveLimitType().equals(BaseEntity.NO)){ |
| | | //都要满足 |
| | | for (MoneyRuleValueDto moneyRuleValueDto : limitList) { |
| | | //存在一个不满足则退出循环 |
| | | if (!SysFunctionLimitEnum.checkPassByCode(moneyRuleValueDto.getFunctionCode() |
| | | ,userMoneyUnclaimed.getUserId(),userMoneyUnclaimed.getOrderId())){ |
| | | return "未达成条件:"+SysFunctionLimitEnum.getNameByCode(moneyRuleValueDto.getFunctionCode()); |
| | | } |
| | | } |
| | | if (userMoneyUnclaimed.getIsReceiveLimit() == null || !userMoneyUnclaimed.getIsReceiveLimit().equals(BaseEntity.YES)){ |
| | | return null; |
| | | } |
| | | // 具体限制类型 |
| | | if (userMoneyUnclaimed.getReceiveLimitType() == null){ |
| | | return null; |
| | | } |
| | | List<MoneyRuleValueDto> limitList = JSONArray.parseArray(userMoneyUnclaimed.getReceiveLimitData(), MoneyRuleValueDto.class); |
| | | if (limitList == null || limitList.size() == 0){ |
| | | return null; |
| | | } |
| | | //判断校验逻辑 |
| | | if (userMoneyUnclaimed.getReceiveLimitType().equals(BaseEntity.YES)){ |
| | | boolean isPass = false; |
| | | StringBuilder msg = new StringBuilder(); |
| | | //满足其一 |
| | | for (MoneyRuleValueDto moneyRuleValueDto : limitList) { |
| | | //满足一个则设为通过,退出循环 |
| | | if (SysFunctionLimitEnum.checkPassByCode(moneyRuleValueDto.getFunctionCode() |
| | | ,userMoneyUnclaimed.getUserId(),userMoneyUnclaimed.getOrderId())){ |
| | | if (msg.length() > 0){ |
| | | msg.append(","); |
| | | } |
| | | msg.append(SysFunctionLimitEnum.getNameByCode(moneyRuleValueDto.getFunctionCode())); |
| | | isPass = true; |
| | | break; |
| | | } |
| | | } |
| | | if (!isPass){ |
| | | return "未达成其中一个条件:" + msg; |
| | | } |
| | | } else if (userMoneyUnclaimed.getReceiveLimitType().equals(BaseEntity.NO)){ |
| | | //都要满足 |
| | | for (MoneyRuleValueDto moneyRuleValueDto : limitList) { |
| | | //存在一个不满足则退出循环 |
| | | if (!SysFunctionLimitEnum.checkPassByCode(moneyRuleValueDto.getFunctionCode() |
| | | ,userMoneyUnclaimed.getUserId(),userMoneyUnclaimed.getOrderId())){ |
| | | return "未达成条件:"+SysFunctionLimitEnum.getNameByCode(moneyRuleValueDto.getFunctionCode()); |
| | | } |
| | | } |
| | | } |