xiaoyong931011
2022-11-03 ff9f5b37d6933af1a7b733a261ca5aeae9e8962a
20221021
7 files modified
98 ■■■■ changed files
src/main/java/cc/mrbird/febs/dapp/entity/DappAccountMoneyChangeEntity.java 32 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/service/DappWalletService.java 4 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/service/impl/ApiIgtOnHookPlanServiceImpl.java 14 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java 32 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/job/OnHookPlanJob.java 12 ●●●● patch | view | raw | blame | history
src/main/resources/i18n/message_en_US.properties 3 ●●●● patch | view | raw | blame | history
src/main/resources/i18n/message_zh_CN.properties 1 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/entity/DappAccountMoneyChangeEntity.java
@@ -35,11 +35,41 @@
        this.setVersion(1);
    }
    public DappAccountMoneyChangeEntity(Long memberId, BigDecimal preAmount, BigDecimal amount, BigDecimal afterAmount, String content, Integer type,Long orderId) {
        this.memberId = memberId;
        this.preAmount = preAmount;
        this.amount = amount;
        this.afterAmount = afterAmount;
        this.content = content;
        this.type = type;
        this.orderId = orderId;
        this.setCreateBy("system");
        this.setUpdateBy("system");
        this.setCreateTime(new Date());
        this.setUpdateTime(new Date());
        this.setVersion(1);
    }
    public DappAccountMoneyChangeEntity(Long memberId,BigDecimal amount, String content, Integer type) {
        this.memberId = memberId;
        this.amount = amount;
        this.content = content;
        this.type = type;
        this.setCreateBy("system");
        this.setUpdateBy("system");
        this.setCreateTime(new Date());
        this.setUpdateTime(new Date());
        this.setVersion(1);
    }
    public DappAccountMoneyChangeEntity(Long memberId,BigDecimal amount, String content, Integer type,Long orderId) {
        this.memberId = memberId;
        this.amount = amount;
        this.content = content;
        this.type = type;
        this.orderId = orderId;
        this.setCreateBy("system");
        this.setUpdateBy("system");
@@ -62,6 +92,8 @@
    private Long memberId;
    private Long orderId;
    private BigDecimal preAmount;
    private BigDecimal amount;
src/main/java/cc/mrbird/febs/dapp/service/DappWalletService.java
@@ -65,12 +65,12 @@
     * 生成流水佣金和盈利分成和流水记录,返回剩余盈利
     * @param refererIds
     */
    BigDecimal updateLSYJYLFC(List<String> refererIds, BigDecimal totalProfit);
    BigDecimal updateLSYJYLFC(List<String> refererIds, BigDecimal totalProfit,long id);
    /**
     * 平台分成,返回剩余盈利
     */
    BigDecimal updatePTFC(Long memberId, BigDecimal totalProfit);
    BigDecimal updatePTFC(Long memberId, BigDecimal totalProfit,long id);
    /**
     * 判断是否中奖
src/main/java/cc/mrbird/febs/dapp/service/impl/ApiIgtOnHookPlanServiceImpl.java
@@ -50,6 +50,7 @@
    private final RedisUtils redisUtils;
    private final DappOnHookAwardDao dappOnHookAwardDao;
    private final DappWalletService dappWalletService;
    private final DappOnHookDoneDao dappOnHookDoneDao;
    @Value("${spring.profiles.active}")
    private String active;
@@ -136,6 +137,12 @@
    public FebsResponse endPlan(Long orderId) {
        DappMemberEntity dappMemberEntity = LoginUserUtil.getAppUser();
        Long memberId = dappMemberEntity.getId();
        QueryWrapper<DappOnHookDone> objectQueryWrapper = new QueryWrapper<>();
        objectQueryWrapper.eq("order_id",orderId);
        List<DappOnHookDone> dappOnHookDones = dappOnHookDoneDao.selectList(objectQueryWrapper);
        if(CollUtil.isNotEmpty(dappOnHookDones)){
            new FebsResponse().fail().message(MessageSourceUtils.getString("Operation_003"));
        }
        //更新主表为结束状态
        IgtOnHookPlanOrder igtOnHookPlanOrder = igtOnHookPlanOrderDao.selectById(orderId);
        igtOnHookPlanOrder.setState(2);
@@ -153,14 +160,17 @@
        String refererIds = dappMemberEntity.getRefererIds();
        List<String> refererIdList = StrUtil.split(refererIds, ",", -1, true, true);
        //生成流水佣金和盈利分成和流水记录,返回剩余盈利
        BigDecimal profitSharingTotal = dappWalletService.updateLSYJYLFC(refererIdList, igtOnHookPlanOrder.getProfit());
        BigDecimal profitSharingTotal = dappWalletService.updateLSYJYLFC(refererIdList, igtOnHookPlanOrder.getProfit(),igtOnHookPlanOrder.getId());
        //平台分成,返回剩余盈利
        BigDecimal systemTotal = dappWalletService.updatePTFC(memberId,igtOnHookPlanOrder.getProfit());
        BigDecimal systemTotal = dappWalletService.updatePTFC(memberId,igtOnHookPlanOrder.getProfit(),igtOnHookPlanOrder.getId());
        totalProfit = totalProfit.subtract(profitSharingTotal).subtract(systemTotal);
        BigDecimal totalMoney = avaAmount.add(totalProfit);
        DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(memberId);
        dappWalletCoinDao.addTotalAndaddAvailableById(dappWalletCoinEntity.getId(),totalMoney);
        DappOnHookDone dappOnHookDone = new DappOnHookDone(memberId, igtOnHookPlanOrder.getId());
        dappOnHookDoneDao.insert(dappOnHookDone);
        return new FebsResponse().success().message(MessageSourceUtils.getString("Operation_001"));
    }
src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java
@@ -886,7 +886,7 @@
        return new FebsResponse().success().message(MessageSourceUtils.getString("Operation_001"));
    }
    @Override
    public BigDecimal updateLSYJYLFC(List<String> refererIdList,BigDecimal totalProfit) {
    public BigDecimal updateLSYJYLFC(List<String> refererIdList,BigDecimal totalProfit,long id) {
        //计算盈利分成
        BigDecimal profitSharingTotal = BigDecimal.ZERO;
        if(BigDecimal.ZERO.compareTo(totalProfit)>=0){
@@ -899,7 +899,7 @@
                DappMemberEntity dappMemberEntityLEVEL_IB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_IB);
                dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_IB.getId(),multiply);
                DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                        dappMemberEntityLEVEL_IB.getId(), multiply, "盈利分成", 8);
                        dappMemberEntityLEVEL_IB.getId(), multiply, "盈利分成", 8,id);
                dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
                profitSharingTotal = profitSharingTotal.add(multiply);
            }
@@ -916,7 +916,7 @@
                DappMemberEntity dappMemberEntityLEVEL_FIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_FIB);
                dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_FIB.getId(),multiply);
                DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                        dappMemberEntityLEVEL_FIB.getId(), multiply, "盈利分成", 8);
                        dappMemberEntityLEVEL_FIB.getId(), multiply, "盈利分成", 8,id);
                dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
                profitSharingTotal = profitSharingTotal.add(multiply);
            }
@@ -934,7 +934,7 @@
                DappMemberEntity dappMemberEntityLEVEL_CIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_CIB);
                dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_CIB.getId(),multiply);
                DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                        dappMemberEntityLEVEL_CIB.getId(), multiply, "盈利分成", 8);
                        dappMemberEntityLEVEL_CIB.getId(), multiply, "盈利分成", 8,id);
                dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
                profitSharingTotal = profitSharingTotal.add(multiply);
            }
@@ -954,7 +954,7 @@
                DappMemberEntity dappMemberEntityLEVEL_AIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_AIB);
                dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_AIB.getId(),multiply);
                DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                        dappMemberEntityLEVEL_AIB.getId(), multiply, "盈利分成", 8);
                        dappMemberEntityLEVEL_AIB.getId(), multiply, "盈利分成", 8,id);
                dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
                profitSharingTotal = profitSharingTotal.add(multiply);
            }
@@ -976,7 +976,7 @@
                DappMemberEntity dappMemberEntityLEVEL_GIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_GIB);
                dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_GIB.getId(),multiply);
                DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                        dappMemberEntityLEVEL_GIB.getId(), multiply, "盈利分成", 8);
                        dappMemberEntityLEVEL_GIB.getId(), multiply, "盈利分成", 8,id);
                dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
                profitSharingTotal = profitSharingTotal.add(multiply);
            }
@@ -1000,7 +1000,7 @@
                DappMemberEntity dappMemberEntityLEVEL_BP = dappMemberDao.selectMemberInfoByInviteId(LEVEL_BP);
                dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_BP.getId(),multiply);
                DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                        dappMemberEntityLEVEL_BP.getId(), multiply, "盈利分成", 8);
                        dappMemberEntityLEVEL_BP.getId(), multiply, "盈利分成", 8,id);
                dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
                profitSharingTotal = profitSharingTotal.add(multiply);
            }
@@ -1026,7 +1026,7 @@
                DappMemberEntity dappMemberEntityLEVEL_SP = dappMemberDao.selectMemberInfoByInviteId(LEVEL_SP);
                dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_SP.getId(),multiply);
                DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                        dappMemberEntityLEVEL_SP.getId(), multiply, "盈利分成", 8);
                        dappMemberEntityLEVEL_SP.getId(), multiply, "盈利分成", 8,id);
                dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
                profitSharingTotal = profitSharingTotal.add(multiply);
            }
@@ -1054,7 +1054,7 @@
                DappMemberEntity dappMemberEntityLEVEL_GP = dappMemberDao.selectMemberInfoByInviteId(LEVEL_GP);
                dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_GP.getId(),multiply);
                DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                        dappMemberEntityLEVEL_GP.getId(), multiply, "盈利分成", 8);
                        dappMemberEntityLEVEL_GP.getId(), multiply, "盈利分成", 8,id);
                dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
                profitSharingTotal = profitSharingTotal.add(multiply);
            }
@@ -1070,7 +1070,7 @@
                dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_AIB.getId(),multiply);
                DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                        dappMemberEntityLEVEL_AIB.getId(), multiply, "流水佣金", 7);
                        dappMemberEntityLEVEL_AIB.getId(), multiply, "流水佣金", 7,id);
                dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
                profitSharingTotal = profitSharingTotal.add(multiply);
            }
@@ -1082,7 +1082,7 @@
                dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_GIB.getId(),multiply);
                DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                        dappMemberEntityLEVEL_GIB.getId(), multiply, "流水佣金", 7);
                        dappMemberEntityLEVEL_GIB.getId(), multiply, "流水佣金", 7,id);
                dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
                profitSharingTotal = profitSharingTotal.add(multiply);
            }
@@ -1094,7 +1094,7 @@
                dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_BP.getId(),multiply);
                DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                        dappMemberEntityLEVEL_BP.getId(), multiply, "流水佣金", 7);
                        dappMemberEntityLEVEL_BP.getId(), multiply, "流水佣金", 7,id);
                dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
                profitSharingTotal = profitSharingTotal.add(multiply);
            }
@@ -1106,7 +1106,7 @@
                dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_SP.getId(),multiply);
                DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                        dappMemberEntityLEVEL_SP.getId(), multiply, "流水佣金", 7);
                        dappMemberEntityLEVEL_SP.getId(), multiply, "流水佣金", 7,id);
                dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
                profitSharingTotal = profitSharingTotal.add(multiply);
            }
@@ -1118,7 +1118,7 @@
                dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_GP.getId(),multiply);
                DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                        dappMemberEntityLEVEL_GP.getId(), multiply, "流水佣金", 7);
                        dappMemberEntityLEVEL_GP.getId(), multiply, "流水佣金", 7,id);
                dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
                profitSharingTotal = profitSharingTotal.add(multiply);
            }
@@ -1127,13 +1127,13 @@
    }
    @Override
    public BigDecimal updatePTFC(Long memberId, BigDecimal totalProfit) {
    public BigDecimal updatePTFC(Long memberId, BigDecimal totalProfit,long id) {
        if(BigDecimal.ZERO.compareTo(totalProfit)>=0){
            return BigDecimal.ZERO;
        }
        BigDecimal multiply = totalProfit.multiply(new BigDecimal(0.05));
        DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(65L,
                multiply.negate(), "系统", 9);
                multiply.negate(), "系统", 9,id);
        dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
        return multiply;
    }
src/main/java/cc/mrbird/febs/job/OnHookPlanJob.java
@@ -283,9 +283,9 @@
        Log.info("开始更新挂机主表状态");
        List<IgtOnHookPlanOrder> igtOnHookPlanOrders = igtOnHookPlanOrderDao.selectByState(3);
        if(CollUtil.isNotEmpty(igtOnHookPlanOrders)){
            List<Long> ids = igtOnHookPlanOrderDao.selectIdsByState(3);
            //更新状态避免重复查询
            igtOnHookPlanOrderDao.updateByIds(ids);
//            List<Long> ids = igtOnHookPlanOrderDao.selectIdsByState(3);
//            //更新状态避免重复查询
//            igtOnHookPlanOrderDao.updateByIds(ids);
            for(IgtOnHookPlanOrder igtOnHookPlanOrder : igtOnHookPlanOrders){
                Long memberId = igtOnHookPlanOrder.getMemberId();
                BigDecimal planAmount = igtOnHookPlanOrder.getPlanAmount();
@@ -313,9 +313,9 @@
                String refererIds = dappMemberEntity.getRefererIds();
                List<String> refererIdList = StrUtil.split(refererIds, ",", -1, true, true);
                //生成流水佣金和盈利分成和流水记录,返回剩余盈利
                BigDecimal profitSharingTotal = dappWalletService.updateLSYJYLFC(refererIdList, totalProfit);
                BigDecimal profitSharingTotal = dappWalletService.updateLSYJYLFC(refererIdList, totalProfit,igtOnHookPlanOrder.getId());
                //平台分成,返回剩余盈利
                BigDecimal systemTotal = dappWalletService.updatePTFC(memberId,totalProfit);
                BigDecimal systemTotal = dappWalletService.updatePTFC(memberId,totalProfit,igtOnHookPlanOrder.getId());
                totalProfit = totalProfit.subtract(profitSharingTotal).subtract(systemTotal);
                igtOnHookPlanOrder.setState(2);
@@ -333,7 +333,7 @@
                BigDecimal add = availableAmount.add(totalMoney);
                BigDecimal subtract = add.subtract(totalProfit);
                DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(memberId, subtract, totalProfit, add, igtOnHookPlanOrder.getId().toString(), 5);
                DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(memberId, subtract, totalProfit, add, "投注盈利", 5,igtOnHookPlanOrder.getId());
                dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
            }
        }
src/main/resources/i18n/message_en_US.properties
@@ -57,4 +57,5 @@
member_err_0017=Account exception
Operation_001=Operation succeeded
Operation_002=Operation failed
Operation_002=Operation failed
Operation_003=Do not submit repeatedly
src/main/resources/i18n/message_zh_CN.properties
@@ -56,3 +56,4 @@
Operation_001=\u64CD\u4F5C\u6210\u529F
Operation_002=\u64CD\u4F5C\u5931\u8D25
Operation_003=\u8BF7\u52FF\u91CD\u590D\u63D0\u4EA4