| | |
| | | logger.info("操作资金-moneyRule规则数据:"+JSON.toJSONString(moneyRule)); |
| | | |
| | | //获得操作类型 |
| | | logger.info("请求的操作类型(0系统1领取):"+userMoneyUnclaimed.getOpType()); |
| | | logger.info("操作待领取资金-请求的类型(0系统1领取):"+userMoneyUnclaimed.getOpType()); |
| | | checkGetOpType(userMoneyUnclaimed,moneyRule); |
| | | logger.info("最终操作类型(0系统1领取):"+userMoneyUnclaimed.getOpType()); |
| | | logger.info("操作待领取资金-最终的类型(0系统1领取):"+userMoneyUnclaimed.getOpType()); |
| | | |
| | | // 判断操作数量或金额 |
| | | if (userMoneyUnclaimed.getOpNumber() == null) { |
| | |
| | | logger.info("待领取资产处理跳过,数据id:{},原因:数据已失效无法领取", userMoneyUnclaimed.getId()); |
| | | return; |
| | | } |
| | | //要领取的资金判断是否满足条件 |
| | | if (UserMoneyUnclaimed.OP_TYPE_RECEIVE == userMoneyUnclaimed.getOpType()){ |
| | | if (checkCanNotReceive(userMoneyUnclaimed)){ |
| | | throw new PlatTipsException(PlatformCode.ERROR_TIPS,"领取失败,未满足领取条件"); |
| | | } |
| | | } |
| | | // 添加用户日志 |
| | | if (BaseEntity.NO.equals(isReceive)) { |
| | | addUserLog(userMoneyUnclaimed, BaseEntity.YES); |
| | | } |
| | | //计算有效结束时间,操作资金处理用到结束时间 |
| | | Date limitEndTime = null; |
| | | //有限制时间规则 |
| | | if (StringUtils.noNull(userMoneyUnclaimed.getMoneyRuleId())){ |
| | | if (userMoneyUnclaimed.getReceiveMoneyLimit() != null && userMoneyUnclaimed.getReceiveMoneyLimit().equals(BaseEntity.YES)){ |
| | | //要领取的资金判断是否满足条件 |
| | | if (UserMoneyUnclaimed.OP_TYPE_RECEIVE == userMoneyUnclaimed.getOpType() && checkCanNotReceive(userMoneyUnclaimed)){ |
| | | throw new PlatTipsException(PlatformCode.ERROR_TIPS,"领取失败,未满足领取条件"); |
| | | } |
| | | //有限制,限制结束时间计算 |
| | | logger.info("待领取资产处理,数据id:{},关联规则限制天数{}",userMoneyUnclaimed.getId(),userMoneyUnclaimed.getWaitReceiveLimitDay()); |
| | | limitEndTime = DateUtil.addDay(userMoneyUnclaimed.getLimitStartTime(),userMoneyUnclaimed.getWaitReceiveLimitDay()); |
| | |
| | | userIntegralRecordService.handleData(userMoneyUnclaimed); |
| | | break; |
| | | } |
| | | // 添加用户日志 |
| | | if (BaseEntity.NO.equals(isReceive)) { |
| | | addUserLog(userMoneyUnclaimed, BaseEntity.YES); |
| | | } |
| | | // 更新状态成已处理 |
| | | SqlSentence sqlSentence = new SqlSentence(); |
| | | String sql = " status=#{m.status},receiveTime=#{m.nowTime},limitEndTime=#{m.limitEndTime},editTime=#{m.nowTime} WHERE id=#{m.id}"; |
| | |
| | | } |
| | | } |
| | | |
| | | /**判断是否可以领取*/ |
| | | /** |
| | | * 判断是不是 不可领取的状态 |
| | | * @param userMoneyUnclaimed 参数 |
| | | * @return true是不可领取 |
| | | * */ |
| | | private boolean checkCanNotReceive(UserMoneyUnclaimed userMoneyUnclaimed) { |
| | | //有领取限制 |
| | | if (userMoneyUnclaimed.getIsReceiveLimit() != null && userMoneyUnclaimed.getIsReceiveLimit().equals(BaseEntity.YES)){ |
| | | List<MoneyRuleValueDto> limitList = JSONArray.parseArray(userMoneyUnclaimed.getReceiveLimitData(), MoneyRuleValueDto.class); |
| | | logger.info("待领取资产处理,数据id:{},限制数据{},解析的数据{}" |
| | | ,userMoneyUnclaimed.getId(),userMoneyUnclaimed.getReceiveLimitData(),JSON.toJSONString(limitList)); |
| | | if (limitList != null && limitList.size() > 0){ |
| | | //满足其一 |
| | | if (userMoneyUnclaimed.getReceiveLimitType().equals(BaseEntity.YES)){ |
| | | for (MoneyRuleValueDto moneyRuleValueDto : limitList) { |
| | | //满足一个则设为通过,退出循环 |
| | | if (SysFunctionLimitEnum.checkPassByCode(moneyRuleValueDto.getFunctionCode() |
| | | ,userMoneyUnclaimed.getUserId(),userMoneyUnclaimed.getOrderId())){ |
| | | return false; |
| | | } |
| | | } |
| | | //无限制可以领取 |
| | | if (userMoneyUnclaimed.getIsReceiveLimit() == null || !userMoneyUnclaimed.getIsReceiveLimit().equals(BaseEntity.YES)){ |
| | | return false; |
| | | } |
| | | List<MoneyRuleValueDto> limitList = JSONArray.parseArray(userMoneyUnclaimed.getReceiveLimitData(), MoneyRuleValueDto.class); |
| | | logger.info("待领取资产处理,数据id:{},限制数据{},解析的数据{}" |
| | | ,userMoneyUnclaimed.getId(),userMoneyUnclaimed.getReceiveLimitData(),JSON.toJSONString(limitList)); |
| | | if (limitList == null || limitList.size() < 1){ |
| | | return false; |
| | | } |
| | | // 无具体限制类型 |
| | | if (userMoneyUnclaimed.getReceiveLimitType() == null){ |
| | | return false; |
| | | } |
| | | //判断校验逻辑 |
| | | if (userMoneyUnclaimed.getReceiveLimitType().equals(BaseEntity.YES)){ |
| | | //满足其一 |
| | | for (MoneyRuleValueDto moneyRuleValueDto : limitList) { |
| | | //满足一个则设为通过,退出循环 |
| | | if (SysFunctionLimitEnum.checkPassByCode(moneyRuleValueDto.getFunctionCode() |
| | | ,userMoneyUnclaimed.getUserId(),userMoneyUnclaimed.getOrderId())){ |
| | | return false; |
| | | } |
| | | //都要满足 |
| | | else if (userMoneyUnclaimed.getReceiveLimitType().equals(BaseEntity.NO)){ |
| | | for (MoneyRuleValueDto moneyRuleValueDto : limitList) { |
| | | //存在一个不满足则退出循环 |
| | | if (!SysFunctionLimitEnum.checkPassByCode(moneyRuleValueDto.getFunctionCode() |
| | | ,userMoneyUnclaimed.getUserId(),userMoneyUnclaimed.getOrderId())){ |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | } else if (userMoneyUnclaimed.getReceiveLimitType().equals(BaseEntity.NO)){ |
| | | //都要满足 |
| | | for (MoneyRuleValueDto moneyRuleValueDto : limitList) { |
| | | //存在一个不满足则退出循环 |
| | | if (!SysFunctionLimitEnum.checkPassByCode(moneyRuleValueDto.getFunctionCode() |
| | | ,userMoneyUnclaimed.getUserId(),userMoneyUnclaimed.getOrderId())){ |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return true; |
| | | return false; |
| | | } |
| | | |
| | | /**转赠*/ |