xiaoyong931011
2022-10-21 45189f71f0eb2c119ea15de98c76839e9ee4b570
src/test/java/cc/mrbird/febs/JunitTest.java
@@ -102,11 +102,58 @@
        System.out.println(awardTime);
        DateTime dateTime = DateUtil.offsetMinute(awardTime, 5);
        for(int i =1; i < 100;i++){
            String yyyyMMddHHMM = DateUtil.format(dateTime, "yyyy-MM-dd hh:mm");
            String yyyyMMddHHMM = DateUtil.format(dateTime, "yyyy-MM-dd HH:mm");
//            DappOnHookAward dappOnHookAwardNext = dappOnHookAwardDao.selectByByAwardTime(yyyyMMddHHMM);
            System.out.println(yyyyMMddHHMM);
            dateTime = DateUtil.offsetMinute(dateTime, 5);
        }
    }
    @Autowired
    private DappMemberDao dappMemberDao;
    @Test
    public void getplan(){
        DappMemberEntity dappMember = dappMemberDao.selectById(33);
        List<DataDictionaryCustom> dataDictionaryCustoms = dataDictionaryCustomMapper.selectDicByType(DataDictionaryEnum.PLAN_A.getType());
        LinkedList<Map<String,String>> strings = new LinkedList<>();
        for(DataDictionaryCustom dataDictionaryCustom : dataDictionaryCustoms){
            Map<String, String> stringStringHashMap = new HashMap<>();
            stringStringHashMap.put(dataDictionaryCustom.getDescription(),dataDictionaryCustom.getValue());
            strings.add(stringStringHashMap);
        }
        //收益率
        BigDecimal hangingRevenue = BigDecimal.ZERO;
        //挂机时长
        DataDictionaryCustom maxHours = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.MAX_HOURS.getType(), DataDictionaryEnum.MAX_HOURS.getCode());
        if(ObjectUtil.isEmpty(maxHours)){
            throw new FebsException(MessageSourceUtils.getString("login_err_003"));
        }
        Double maxHoursValue = Double.parseDouble(maxHours.getValue());
        //获取用户信息的是否盈利字段
        Integer isProfit = dappMember.getIsProfit() == null ? 1 : dappMember.getIsProfit();
        String identity = null;
        if(isProfit == 2){
            identity = "IS_PROFIT_NO";
        }else{
            identity = "LEVEL_MB";
            DataDictionaryCustom levelMember = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.LEVEL_MB.getType(), dappMember.getIdentity());
            if(ObjectUtil.isEmpty(levelMember)){
                throw new FebsException(MessageSourceUtils.getString("login_err_003"));
            }
            String levelMemberValue = levelMember.getValue();
            JSONObject levelMemberValueParse = JSONUtil.parseObj(levelMemberValue);
            hangingRevenue = new BigDecimal(levelMemberValueParse.get("hangingRevenue").toString())
                    .multiply(new BigDecimal(0.01)).setScale(4,BigDecimal.ROUND_DOWN);
        }
        //获取挂机字表的顺序
        LinkedList<String> isProfitPlan = new LinkedList<>();
        Map<String, LinkedList<String>> identity_level = MemberOnHookPlanEnum.valueOf(identity)
                .getMemberOnHook(maxHoursValue,hangingRevenue,strings);
        isProfitPlan = identity_level.get(identity);
        System.out.println(isProfitPlan);
    }
}