chenjiahe
2024-02-29 46a9c5e82eeb3b4d657663bdb3ee07d3ce7849e5
phi_platform_user/src/main/java/com/hx/phip/service/userMoney/impl/UserMoneyUnclaimedServiceImpl.java
@@ -575,7 +575,8 @@
        // 有规则,且规则不需要校验用户勾选,则校验基础规则中是否需要领取
        if (moneyRule != null && moneyRule.getIsUserReceive().equals(BaseEntity.NO)){
            logger.info("操作用户资金(待领取记录)-不校验用户设置是否需要领取状态-是否需要用户领取:"+moneyRule.getIsNeedReceive());
            logger.info("操作用户资金(待领取记录)-不校验用户设置是否需要领取状态");
            logger.info("操作用户资金(待领取记录)-是否需要用户领取:"+moneyRule.getIsNeedReceive());
            if (moneyRule.getIsNeedReceive().equals(BaseEntity.NO)){
                //不需要领取,设置为系统处理
                userMoneyUnclaimed.setOpType(UserMoneyUnclaimed.OP_TYPE_SYSTEM);
@@ -591,7 +592,7 @@
                if (userInfo != null){
                    logger.info("操作用户资金(待领取记录)-用户设置增值金是否需要领取状态:{}", userInfo.getIsReceiveValueAddedFund());
                    if (userInfo.getIsReceiveValueAddedFund() != null  && BaseEntity.YES.equals(userInfo.getIsReceiveValueAddedFund())){
                        // 用户设置了不用再领取,设置为系统处理
                        // 设置要领取设置为领取
                        userMoneyUnclaimed.setOpType(UserMoneyUnclaimed.OP_TYPE_RECEIVE);
                    }
                }
@@ -780,22 +781,32 @@
                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,"领取失败,未满足领取条件");
                    //需要领取,有领取限制 则校验是否满足条件
                    if (UserMoneyUnclaimed.OP_TYPE_RECEIVE == userMoneyUnclaimed.getOpType()){
                        if (userMoneyUnclaimed.getReceiveMoneyLimit() != null
                                && userMoneyUnclaimed.getReceiveMoneyLimit().equals(BaseEntity.YES)
                                && checkCanNotReceive(userMoneyUnclaimed)) {
                            logger.info("操作待领取资金-但是有领取限制-进行限制校验");
                            throw new PlatTipsException(PlatformCode.ERROR_TIPS, "领取失败,未满足领取条件");
                        }
                        //有限制,限制结束时间计算
                        logger.info("待领取资产处理,数据id:{},关联规则限制天数{}",userMoneyUnclaimed.getId(),userMoneyUnclaimed.getWaitReceiveLimitDay());
                        limitEndTime = DateUtil.addDay(userMoneyUnclaimed.getLimitStartTime(),userMoneyUnclaimed.getWaitReceiveLimitDay());
                    }
                    //有领取后的时间限制,限制结束时间计算
                    logger.info("操作待领取资金-是否有效时间限制:" + userMoneyUnclaimed.getReceiveMoneyLimit());
                    if (userMoneyUnclaimed.getReceiveMoneyLimit() != null && userMoneyUnclaimed.getReceiveMoneyLimit().equals(BaseEntity.YES)){
                        logger.info("操作待领取资金-限制有效天数:" + userMoneyUnclaimed.getReceiveMoneyLimitDay());
                        //为空默认处理
                        if (userMoneyUnclaimed.getReceiveMoneyLimitDay() == null) {
                            userMoneyUnclaimed.setReceiveMoneyLimitDay(UserMoneyTool.getReceivedValidityTime(commonService));
                        }
                        limitEndTime = DateUtil.addDay(userMoneyUnclaimed.getLimitStartTime(), userMoneyUnclaimed.getReceiveMoneyLimitDay());
                    }else {
                        logger.info("操作待领取资金-未设置有效时间限制-默认给100年");
                        //无限制,默认100年
                        limitEndTime = DateUtil.addYear(userMoneyUnclaimed.getLimitStartTime(), 100);
                    }
                }else {
                    // 已领取调整领取时间
                    // 默认处理
                    int validityPeriod = UserMoneyTool.getReceivedValidityTime(commonService);
                    // 获取时间
                    limitEndTime = DateUtil.addDay(userMoneyUnclaimed.getLimitStartTime(), validityPeriod);
                }
                // 传进去下面的资金处理