fwq
2024-01-25 cb0bdad7cb1fc0a4592479efbb20ca97a50603d0
待领取列表获取不可领取原因
1个文件已修改
56 ■■■■■ 已修改文件
phi_platform_user/src/main/java/com/hx/phip/controller/user/UserMoneyUnclaimedController.java 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/java/com/hx/phip/controller/user/UserMoneyUnclaimedController.java
@@ -1,14 +1,17 @@
package com.hx.phip.controller.user;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hx.common.BaseController;
import com.hx.exception.TipsException;
import com.hx.mybatisTool.SqlSentence;
import com.hx.phiappt.common.PlatformConstants;
import com.hx.phiappt.constants.enums.SysFunctionLimitEnum;
import com.hx.phiappt.constants.tool.employee.EmployeeTool;
import com.hx.phiappt.constants.tool.money.UserMoneyTool;
import com.hx.phiappt.dao.mapper.UserMoneyUnclaimedMapper;
import com.hx.phiappt.dto.money.MoneyRuleValueDto;
import com.hx.phiappt.model.BaseEntity;
import com.hx.phiappt.model.User;
import com.hx.phiappt.model.UserIntegralRecord;
@@ -262,6 +265,16 @@
                            }
                        }
                    }
                    //查询不可使用原因
                    userMoneyUnclaimedInfo.setIsShowNotUse(0);
                    if (userMoneyUnclaimed.getIsSelectNotUse() != null && userMoneyUnclaimed.getIsSelectNotUse().equals(BaseEntity.YES)){
                        String canUseReason = getCanUseReason(userMoneyUnclaimedInfo);
                        if (StringUtils.noNull(canUseReason)){
                            userMoneyUnclaimedInfo.setIsShowNotUse(1);
                            userMoneyUnclaimedInfo.setNotUseReason(canUseReason);
                        }
                    }
                }
            }
        }
@@ -289,6 +302,49 @@
        return PlatformResult.success(data);
    }
    /**获取不可领取原因*/
    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());
                            }
                        }
                    }
                }
            }
        }
        return null;
    }
    /**
     * 领取用户资产
     * @param request 请求