KKSU
2024-02-21 0dded054a1744e032c30bc5b10fda1f2c94a4099
抽奖
31 files modified
6 files added
1029 ■■■■ changed files
src/main/java/cc/mrbird/febs/common/runner/FebsStartedUpRunner.java 2 ●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/controller/AdminMallGoodsController.java 12 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/controller/AdminMallOrderController.java 13 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/controller/ApiCjController.java 5 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/controller/CommonController.java 3 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/controller/ViewMallGoodsController.java 10 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/controller/ViewMallOrderController.java 10 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/dto/ChoujiangInfoDto.java 14 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/entity/CjInfo.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/entity/CjItem.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/entity/TzInfo.java 3 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/mapper/CjItemMapper.java 10 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/mapper/MallGoodsMapper.java 3 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/mapper/MallOrderInfoMapper.java 4 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/service/AsyncCjService.java 17 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/service/CJService.java 1 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/service/IAdminMallGoodsService.java 3 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/service/IAdminMallOrderService.java 3 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallGoodsService.java 31 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java 7 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallOrderService.java 7 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/service/impl/AsyncCjServiceImpl.java 215 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/service/impl/CJServiceImpl.java 96 ●●●● patch | view | raw | blame | history
src/main/resources/application-prod.yml 16 ●●●● patch | view | raw | blame | history
src/main/resources/mapper/modules/CjItemMapper.xml 34 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/modules/MallGoodsMapper.xml 7 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/modules/MallOrderInfoMapper.xml 24 ●●●●● patch | view | raw | blame | history
src/main/resources/templates/error/403.html 2 ●●● patch | view | raw | blame | history
src/main/resources/templates/error/404.html 2 ●●● patch | view | raw | blame | history
src/main/resources/templates/error/500.html 2 ●●● patch | view | raw | blame | history
src/main/resources/templates/febs/views/layout.html 2 ●●● patch | view | raw | blame | history
src/main/resources/templates/febs/views/login.html 4 ●●●● patch | view | raw | blame | history
src/main/resources/templates/febs/views/modules/goods/tzList.html 140 ●●●●● patch | view | raw | blame | history
src/main/resources/templates/febs/views/modules/mallMember/moneyFlow.html 14 ●●●●● patch | view | raw | blame | history
src/main/resources/templates/febs/views/modules/mallMember/moneyFlowList.html 126 ●●●●● patch | view | raw | blame | history
src/main/resources/templates/febs/views/modules/order/cjList.html 181 ●●●●● patch | view | raw | blame | history
src/main/resources/templates/index.html 2 ●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/common/runner/FebsStartedUpRunner.java
@@ -63,7 +63,7 @@
            log.info("/ /`  / / \\ | |\\/| | |_) | |   | |_   | |  | |_  ");
            log.info("\\_\\_, \\_\\_/ |_|  | |_|   |_|__ |_|__  |_|  |_|__ ");
            log.info("                                                      ");
            log.info("鸿楼梦 权限系统启动完毕,地址:{}", url);
            log.info("抽奖 权限系统启动完毕,地址:{}", url);
            boolean auto = febsProperties.isAutoOpenBrowser();
            if (auto && StringUtils.equalsIgnoreCase(active, FebsConstant.DEVELOP)) {
src/main/java/cc/mrbird/febs/mall/controller/AdminMallGoodsController.java
@@ -11,6 +11,7 @@
import cc.mrbird.febs.mall.dto.UpMallGoodsDto;
import cc.mrbird.febs.mall.entity.MallGoods;
import cc.mrbird.febs.mall.entity.MallGoodsCategory;
import cc.mrbird.febs.mall.entity.TzInfo;
import cc.mrbird.febs.mall.service.IAdminMallGoodsService;
import cc.mrbird.febs.mall.vo.AdminMallGoodsCategoryTreeVo;
import cc.mrbird.febs.mall.vo.AdminMallGoodsTreeVo;
@@ -105,6 +106,17 @@
    /**
     * 商品列表
     * @param request
     * @return
     */
    @GetMapping("tzList")
    public FebsResponse getTzList(TzInfo tzInfo, QueryRequest request) {
        Map<String, Object> data = getDataTable(adminMallGoodsService.getTzListInPage(tzInfo, request));
        return new FebsResponse().success().data(data);
    }
    /**
     * 商品列表
     * @param mallGoods
     * @param request
     * @return
src/main/java/cc/mrbird/febs/mall/controller/AdminMallOrderController.java
@@ -55,6 +55,19 @@
    private final MallMemberMapper mallMemberMapper;
    private final MallOrderInfoMapper mallOrderInfoMapper;
    /**
     * 订单列表
     *
     * @param request
     * @return
     */
    @GetMapping("chouJiangList")
    public FebsResponse chouJiangList(ChoujiangInfoDto choujiangInfoDto, QueryRequest request) {
        Map<String, Object> data = getDataTable(adminMallOrderService.getChouJiangListInPage(choujiangInfoDto, request));
        return new FebsResponse().success().data(data);
    }
    /**
     * 订单列表
     *
src/main/java/cc/mrbird/febs/mall/controller/ApiCjController.java
@@ -1,5 +1,6 @@
package cc.mrbird.febs.mall.controller;
import cc.mrbird.febs.common.annotation.Limit;
import cc.mrbird.febs.common.entity.FebsResponse;
import cc.mrbird.febs.mall.dto.ApiCreateDto;
import cc.mrbird.febs.mall.dto.KjRecordDto;
@@ -28,6 +29,7 @@
            @ApiResponse(code = 200, message = "success", response = ApiKjRecordVo.class)
    })
    @PostMapping(value = "/kjRecord")
    @Limit(key = "kjRecord", period = 60, count = 10, name = "列表接口", prefix = "limit")
    public FebsResponse kjRecord(@RequestBody KjRecordDto kjRecordDto) {
        return cjService.kjRecord(kjRecordDto);
    }
@@ -48,12 +50,14 @@
            @ApiResponse(code = 200, message = "success", response = ApiTzInfoVo.class)
    })
    @GetMapping(value = "/tzInfo")
    @Limit(key = "tzInfo", period = 60, count = 10, name = "首页接口", prefix = "limit")
    public FebsResponse tzInfo() {
        return cjService.tzInfo();
    }
    @ApiOperation(value = "马上投注", notes = "马上投注")
    @PostMapping(value = "/create")
    @Limit(key = "create", period = 1, count = 1, name = "投注接口", prefix = "limit")
    public FebsResponse create(@RequestBody ApiCreateDto apiCreateDto) {
        return cjService.create(apiCreateDto);
    }
@@ -63,6 +67,7 @@
            @ApiResponse(code = 200, message = "success", response = ApiTzListVo.class)
    })
    @PostMapping(value = "/tzInfoList")
    @Limit(key = "tzInfoList", period = 60, count = 10, name = "列表接口", prefix = "limit")
    public FebsResponse tzInfoList(@RequestBody KjRecordDto kjRecordDto) {
        return cjService.tzInfoList(kjRecordDto);
    }
src/main/java/cc/mrbird/febs/mall/controller/CommonController.java
@@ -1,6 +1,7 @@
package cc.mrbird.febs.mall.controller;
import cc.mrbird.febs.common.annotation.ControllerEndpoint;
import cc.mrbird.febs.common.annotation.Limit;
import cc.mrbird.febs.common.entity.FebsResponse;
import cc.mrbird.febs.common.exception.FebsException;
import cc.mrbird.febs.common.utils.*;
@@ -42,6 +43,7 @@
    @ApiOperation(value = "获取验证码接口", notes = "获取验证码通用接口")
    @GetMapping(value = "/verifyCode")
    @Limit(key = "verifyCode", period = 60, count = 2, name = "验证码接口", prefix = "limit")
    public FebsResponse verifyCode(@ApiParam(name = "account", value = "手机号", required = true) @RequestParam(value = "account") String account,
                                   @ApiParam(name = "type", value = "类型1-手机号", required = true) @RequestParam("type") String type) {
        log.info("#账号:{}, 类型:{}#", account, type);
@@ -147,6 +149,7 @@
    @ApiOperation(value = "验证验证码接口")
    @PostMapping(value = "/checkCode")
    @Limit(key = "verifyCode", period = 60, count = 2, name = "验证码接口", prefix = "limit")
    public FebsResponse checkCode(@RequestBody AccountAndCodeDto accountAndCodeDto) {
        boolean flag = commonService.verifyCode(accountAndCodeDto.getAccount(), accountAndCodeDto.getCode());
src/main/java/cc/mrbird/febs/mall/controller/ViewMallGoodsController.java
@@ -28,6 +28,16 @@
     * 商品列表
     * @return
     */
    @GetMapping("tzList")
    @RequiresPermissions("tzList:view")
    public String tzList() {
        return FebsUtil.view("modules/goods/tzList");
    }
    /**
     * 商品列表
     * @return
     */
    @GetMapping("goodsList")
    @RequiresPermissions("goodsList:view")
    public String goodsList() {
src/main/java/cc/mrbird/febs/mall/controller/ViewMallOrderController.java
@@ -32,6 +32,16 @@
     * 订单列表
     * @return
     */
    @GetMapping("cjList")
    @RequiresPermissions("cjList:view")
    public String cjList() {
        return FebsUtil.view("modules/order/cjList");
    }
    /**
     * 订单列表
     * @return
     */
    @GetMapping("orderList")
    @RequiresPermissions("orderList:view")
    public String orderList() {
src/main/java/cc/mrbird/febs/mall/dto/ChoujiangInfoDto.java
New file
@@ -0,0 +1,14 @@
package cc.mrbird.febs.mall.dto;
import io.swagger.annotations.ApiModel;
import lombok.Data;
@Data
@ApiModel(value = "MallOrderInfoDto", description = "参数接收类")
public class ChoujiangInfoDto {
    private String phone;
    private String kjNo;
    private String zjState;
    private String kjState;
}
src/main/java/cc/mrbird/febs/mall/entity/CjInfo.java
@@ -20,4 +20,6 @@
    private BigDecimal perkAmount;//中奖总金额
    @TableField(exist = false)
    private List<CjItem> items;
    @TableField(exist = false)
    private String phone;//开奖编号
}
src/main/java/cc/mrbird/febs/mall/entity/CjItem.java
@@ -13,6 +13,8 @@
    private Long infoId;//主表ID
    private Long memberId;//
    private Long tzId;//投注信息ID
    private String tzCode;//投注号码
    private BigDecimal tzPercent;//获奖倍率
    private Integer type;//投注类型 1-按大小 2-按单双 3-按数字
    private BigDecimal amount;//投入金额
    private String itemNum;//投注数字
src/main/java/cc/mrbird/febs/mall/entity/TzInfo.java
@@ -1,6 +1,7 @@
package cc.mrbird.febs.mall.entity;
import cc.mrbird.febs.common.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@@ -13,4 +14,6 @@
    private Integer type;//类型 1-按大小 2-按单双 3-按数字
    private String tzCode;//值
    private BigDecimal tzPercent;//获奖倍率
    @TableField(exist = false)
    private BigDecimal tzAmount;//投入总金额
}
src/main/java/cc/mrbird/febs/mall/mapper/CjItemMapper.java
@@ -2,6 +2,16 @@
import cc.mrbird.febs.mall.entity.CjItem;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.ArrayList;
import java.util.List;
public interface CjItemMapper extends BaseMapper<CjItem> {
    List<CjItem> selectListByInfoId(@Param("infoId")Long id);
    void updateBatchById(@Param("list")ArrayList<CjItem> cjItemUpdateList);
    List<CjItem> selectSumAmountByInfoId(@Param("list")List<Long> collect);
}
src/main/java/cc/mrbird/febs/mall/mapper/MallGoodsMapper.java
@@ -3,6 +3,7 @@
import cc.mrbird.febs.mall.dto.MallGoodsQueryDto;
import cc.mrbird.febs.mall.entity.MallGoods;
import cc.mrbird.febs.mall.entity.MallGoodsComment;
import cc.mrbird.febs.mall.entity.TzInfo;
import cc.mrbird.febs.mall.vo.*;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -43,4 +44,6 @@
    List<MallGoods> selectOrderGoodsList(@Param("memberId") Long memberId, @Param("date") Date date);
    IPage<MallGoodsCommentVo> selectMallGoodsCommentListQueryInPage(Page<MallGoodsCommentVo> page,  @Param("record")MallGoodsComment mallGoodsComment);
    IPage<TzInfo> getTzListInPage(Page<TzInfo> page, TzInfo tzInfo);
}
src/main/java/cc/mrbird/febs/mall/mapper/MallOrderInfoMapper.java
@@ -1,8 +1,10 @@
package cc.mrbird.febs.mall.mapper;
import cc.mrbird.febs.common.enumerates.OrderPayMethodEnum;
import cc.mrbird.febs.mall.dto.ChoujiangInfoDto;
import cc.mrbird.febs.mall.dto.MallOrderInfoDto;
import cc.mrbird.febs.mall.dto.OrderListDto;
import cc.mrbird.febs.mall.entity.CjInfo;
import cc.mrbird.febs.mall.entity.MallOrderInfo;
import cc.mrbird.febs.mall.entity.MallOrderItem;
import cc.mrbird.febs.mall.vo.AdminMallOrderInfoVo;
@@ -65,4 +67,6 @@
    BigDecimal selectTotalAmountByPayDoneAndDataString(@Param("payResult")int i, @Param("date") Date date);
    BigDecimal selectSumAmountByPayMethodAndSomeStatue(@Param("payMethod")String name, @Param("statues") List<Long> values);
    IPage<CjInfo> getChouJiangListInPage(Page<CjInfo> page, @Param("record")ChoujiangInfoDto choujiangInfoDto);
}
src/main/java/cc/mrbird/febs/mall/service/AsyncCjService.java
New file
@@ -0,0 +1,17 @@
package cc.mrbird.febs.mall.service;
import cc.mrbird.febs.common.entity.FebsConstant;
import cc.mrbird.febs.common.entity.FebsResponse;
import cc.mrbird.febs.mall.dto.ApiCreateDto;
import cc.mrbird.febs.mall.entity.CjInfo;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.scheduling.annotation.Async;
public interface AsyncCjService extends IService<CjInfo> {
    @Async(FebsConstant.ASYNC_POOL)
    void openPriceAsync(CjInfo cjInfo, String kjNum,String danshuang,String daXiao);
    @Async(FebsConstant.ASYNC_POOL)
    void create(ApiCreateDto apiCreateDto);
}
src/main/java/cc/mrbird/febs/mall/service/CJService.java
@@ -30,4 +30,5 @@
    void getNoTimeDelayMsg(String kjNo);
    void getOpenPriceMsg(String kjNo, String kjNum);
}
src/main/java/cc/mrbird/febs/mall/service/IAdminMallGoodsService.java
@@ -7,6 +7,7 @@
import cc.mrbird.febs.mall.dto.UpMallGoodsDto;
import cc.mrbird.febs.mall.entity.MallGoods;
import cc.mrbird.febs.mall.entity.MallGoodsCategory;
import cc.mrbird.febs.mall.entity.TzInfo;
import cc.mrbird.febs.mall.vo.AdminMailGoodsDetailVo;
import cc.mrbird.febs.mall.vo.AdminMailGoodsUpdateVo;
import cc.mrbird.febs.mall.vo.AdminMallGoodsTreeVo;
@@ -41,4 +42,6 @@
    FebsResponse goodsHot(Long id);
    FebsResponse goodsNotHot(Long id);
    IPage<TzInfo> getTzListInPage(TzInfo tzInfo, QueryRequest request);
}
src/main/java/cc/mrbird/febs/mall/service/IAdminMallOrderService.java
@@ -3,6 +3,7 @@
import cc.mrbird.febs.common.entity.FebsResponse;
import cc.mrbird.febs.common.entity.QueryRequest;
import cc.mrbird.febs.mall.dto.*;
import cc.mrbird.febs.mall.entity.CjInfo;
import cc.mrbird.febs.mall.entity.MallMember;
import cc.mrbird.febs.mall.entity.MallOrderInfo;
import cc.mrbird.febs.mall.entity.MallOrderRefund;
@@ -73,4 +74,6 @@
    FebsResponse takeGoods(Long id);
    IPage<AdminMallMoneyFlowVo> orderMoneyFlow(QueryRequest request, MallOrderInfo mallOrderInfo);
    IPage<CjInfo> getChouJiangListInPage(ChoujiangInfoDto choujiangInfoDto, QueryRequest request);
}
src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallGoodsService.java
@@ -2,6 +2,8 @@
import cc.mrbird.febs.common.entity.FebsResponse;
import cc.mrbird.febs.common.entity.QueryRequest;
import cc.mrbird.febs.common.utils.AppContants;
import cc.mrbird.febs.common.utils.RedisUtils;
import cc.mrbird.febs.mall.conversion.MallGoodsConversion;
import cc.mrbird.febs.mall.dto.*;
import cc.mrbird.febs.mall.entity.*;
@@ -12,6 +14,7 @@
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -25,6 +28,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
@Slf4j
@Service
@@ -38,6 +42,9 @@
    private final MallGoodsStyleMapper mallGoodsStyleMapper;
    private final MallGoodsImagesMapper mallGoodsImagesMapper;
    private final MallShoppingCartMapper mallShoppingCartMapper;
    private final RedisUtils redisUtils;
    private final CjItemMapper cjItemMapper;
    private final CjInfoMapper cjInfoMapper;
    @Override
    public IPage<AdminMallGoodsVo> getCategoryListInPage(MallGoods mallGoods, QueryRequest request) {
@@ -495,5 +502,29 @@
        return new FebsResponse().success();
    }
    @Override
    public IPage<TzInfo> getTzListInPage(TzInfo tzInfo, QueryRequest request) {
        Page<TzInfo> page = new Page<>(request.getPageNum(), request.getPageSize());
        IPage<TzInfo> adminMallGoodsVos = this.baseMapper.getTzListInPage(page, tzInfo);
        List<TzInfo> records = adminMallGoodsVos.getRecords();
        String kjNo = redisUtils.getString(AppContants.KJ_RECORD_NO);
        QueryWrapper<CjInfo> objectQueryWrapper = new QueryWrapper<>();
        objectQueryWrapper.eq("kj_no",kjNo);
        List<CjInfo> cjInfos = cjInfoMapper.selectList(objectQueryWrapper);
        List<Long> collect = cjInfos.stream().map(CjInfo::getId).collect(Collectors.toList());
        List<CjItem> cjItems = cjItemMapper.selectSumAmountByInfoId(collect);
        for(TzInfo tzInfo1 : records){
            List<CjItem> collect1 = cjItems.stream().filter(cjItem -> cjItem.getTzCode().equals(tzInfo1.getTzCode())).collect(Collectors.toList());
            if(CollUtil.isNotEmpty(collect1)){
                BigDecimal reduce = collect1.stream().map(CjItem::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
                tzInfo1.setTzAmount(reduce);
            }else{
                tzInfo1.setTzAmount(BigDecimal.ZERO);
            }
        }
        return adminMallGoodsVos;
    }
}
src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java
@@ -2,10 +2,7 @@
import cc.mrbird.febs.common.entity.FebsResponse;
import cc.mrbird.febs.common.entity.QueryRequest;
import cc.mrbird.febs.common.enumerates.AgentLevelEnum;
import cc.mrbird.febs.common.enumerates.FlowTypeEnum;
import cc.mrbird.febs.common.enumerates.GreenScoreEnum;
import cc.mrbird.febs.common.enumerates.MoneyFlowTypeEnum;
import cc.mrbird.febs.common.enumerates.*;
import cc.mrbird.febs.common.exception.FebsException;
import cc.mrbird.febs.common.utils.AppContants;
import cc.mrbird.febs.common.utils.LoginUserUtil;
@@ -476,7 +473,7 @@
        } else {
            iApiMallMemberWalletService.add(mallSystemPayDto.getAddBalance(), mallSystemPayDto.getId(), filedType);
        }
        mallMoneyFlowService.addMoneyFlow(memberId, bigDecimal, MoneyFlowTypeEnum.SYSTEM.getValue(), null, type);
        mallMoneyFlowService.addMoneyFlow(memberId, bigDecimal, MoneyFlowTypeNewEnum.AGENT_BONUS.getValue(), null, type);
        return new FebsResponse().success();
    }
src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallOrderService.java
@@ -471,6 +471,13 @@
    }
    @Override
    public IPage<CjInfo> getChouJiangListInPage(ChoujiangInfoDto choujiangInfoDto, QueryRequest request) {
        Page<CjInfo> page = new Page<>(request.getPageNum(), request.getPageSize());
        IPage<CjInfo> cjInfoIPage = mallOrderInfoMapper.getChouJiangListInPage(page, choujiangInfoDto);
        return cjInfoIPage;
    }
    @Override
    public void deliverGoodsByOrderNo(DeliverGoodsDto deliverGoodsDto) {
        MallOrderInfo mallOrderInfo = mallOrderInfoMapper.selectByOrderNo(deliverGoodsDto.getOrderNo());
        if (mallOrderInfo == null) {
src/main/java/cc/mrbird/febs/mall/service/impl/AsyncCjServiceImpl.java
New file
@@ -0,0 +1,215 @@
package cc.mrbird.febs.mall.service.impl;
import cc.mrbird.febs.common.enumerates.DataDictionaryEnum;
import cc.mrbird.febs.common.enumerates.FlowTypeEnum;
import cc.mrbird.febs.common.enumerates.MoneyFlowTypeNewEnum;
import cc.mrbird.febs.common.exception.FebsException;
import cc.mrbird.febs.common.utils.AppContants;
import cc.mrbird.febs.common.utils.MallUtils;
import cc.mrbird.febs.common.utils.RedisUtils;
import cc.mrbird.febs.mall.dto.ApiCreateDto;
import cc.mrbird.febs.mall.dto.ApiCreateItemDto;
import cc.mrbird.febs.mall.entity.*;
import cc.mrbird.febs.mall.mapper.*;
import cc.mrbird.febs.mall.service.AsyncCjService;
import cc.mrbird.febs.mall.service.IApiMallMemberService;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@Slf4j
@Service
@RequiredArgsConstructor
public class AsyncCjServiceImpl extends ServiceImpl<CjInfoMapper, CjInfo> implements AsyncCjService {
    private final RedisUtils redisUtils;
    private final DataDictionaryCustomMapper dataDictionaryCustomMapper;
    private final TzInfoMapper tzInfoMapper;
    private final MallMemberWalletMapper mallMemberWalletMapper;
    private final CjInfoMapper cjInfoMapper;
    private final CjItemMapper cjItemMapper;
    private final IApiMallMemberService mallMemberService;
    @Override
    public void openPriceAsync(CjInfo cjInfo, String kjNum,String danshuang,String daXiao) {
        long l = System.currentTimeMillis();
        List<CjItem> cjItems = cjItemMapper.selectListByInfoId(cjInfo.getId());
        if(CollUtil.isEmpty(cjItems)){
            return;
        }
        /**
         * 1-按大小 2-按单双 3-按数字
         */
        BigDecimal perkAmountTotal = BigDecimal.ZERO;//中奖总金额
        ArrayList<CjItem> CjItemUpdateList = new ArrayList<>();
        //按大小
        List<CjItem> collectDaXiao = cjItems.stream().filter(cjItem -> cjItem.getType() == 1).collect(Collectors.toList());
        if(CollUtil.isNotEmpty(collectDaXiao)){
            for(CjItem cjItem : collectDaXiao){
                String tzCode = cjItem.getTzCode();
                cjItem.setKjNum(daXiao);
                BigDecimal perkAmount = BigDecimal.ZERO;
                if(daXiao.equals(tzCode)){
                    perkAmount = cjItem.getAmount().multiply(cjItem.getTzPercent()).setScale(2, BigDecimal.ROUND_DOWN);
                    cjItem.setPerkAmount(perkAmount);
                }else{
                    cjItem.setPerkAmount(perkAmount);
                }
                CjItemUpdateList.add(cjItem);
                perkAmountTotal = perkAmountTotal.add(perkAmount);
            }
        }
        //按单双
        List<CjItem> collectDanShuang = cjItems.stream().filter(cjItem -> cjItem.getType() == 2).collect(Collectors.toList());
        if(CollUtil.isNotEmpty(collectDanShuang)){
            for(CjItem cjItem : collectDanShuang){
                String tzCode = cjItem.getTzCode();
                cjItem.setKjNum(danshuang);
                BigDecimal perkAmount = BigDecimal.ZERO;
                if(danshuang.equals(tzCode)){
                    perkAmount = cjItem.getAmount().multiply(cjItem.getTzPercent()).setScale(2, BigDecimal.ROUND_DOWN);
                    cjItem.setPerkAmount(perkAmount);
                }else{
                    cjItem.setPerkAmount(perkAmount);
                }
                CjItemUpdateList.add(cjItem);
                perkAmountTotal = perkAmountTotal.add(perkAmount);
            }
        }
        //按数字
        List<CjItem> collectNumber = cjItems.stream().filter(cjItem -> cjItem.getType() == 3).collect(Collectors.toList());
        if(CollUtil.isNotEmpty(collectNumber)){
            for(CjItem cjItem : collectNumber){
                String tzCode = cjItem.getTzCode();
                cjItem.setKjNum(kjNum);
                BigDecimal perkAmount = BigDecimal.ZERO;
                if(kjNum.equals(tzCode)){
                    perkAmount = cjItem.getAmount().multiply(cjItem.getTzPercent()).setScale(2, BigDecimal.ROUND_DOWN);
                    cjItem.setPerkAmount(perkAmount);
                }else{
                    cjItem.setPerkAmount(perkAmount);
                }
                CjItemUpdateList.add(cjItem);
                perkAmountTotal = perkAmountTotal.add(perkAmount);
            }
        }
        cjItemMapper.updateBatchById(CjItemUpdateList);//批量更新
        if(perkAmountTotal.compareTo(BigDecimal.ZERO) > 0){
            cjInfo.setZjState(1);
        }else{
            cjInfo.setZjState(0);
        }
        cjInfo.setPerkAmount(perkAmountTotal);
        cjInfo.setKjNum(kjNum);
        cjInfo.setKjState(1);
        cjInfoMapper.updateById(cjInfo);
        //更新用户余额
        MallMemberWallet mallMemberWallet = mallMemberWalletMapper.selectWalletByMemberId(cjInfo.getMemberId());
        mallMemberWallet.setBalance(mallMemberWallet.getBalance().add(perkAmountTotal));
        mallMemberWalletMapper.updateBalanceWithVersion(mallMemberWallet);
        String orderNo = MallUtils.getOrderNum("T");
        mallMemberService.addMoneyFlow(
                cjInfo.getMemberId(),
                perkAmountTotal,
                MoneyFlowTypeNewEnum.DYNAMIC_ACHIEVE.getValue(),
                orderNo,
                MoneyFlowTypeNewEnum.DYNAMIC_ACHIEVE.getDescription(),
                null,
                cjInfo.getId(),
                2,
                FlowTypeEnum.BALANCE.getValue());
        log.info("结束:{}", (System.currentTimeMillis() - l));
    }
    @Override
    public void create(ApiCreateDto apiCreateDto) {
        long l = System.currentTimeMillis();
        Long memberId = 1L;
        //开启下注
        DataDictionaryCustom noTimeDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                DataDictionaryEnum.NO_TIME.getType(),
                DataDictionaryEnum.NO_TIME.getCode()
        );
        if(noTimeDic.getValue().equals(2)){
            throw new FebsException("请等待下一期");
        }
        List<ApiCreateItemDto> items = apiCreateDto.getItems();
        if(CollUtil.isEmpty(items)){
            throw new FebsException("参数有误,请刷新页面");
        }
        MallMemberWallet mallMemberWallet = mallMemberWalletMapper.selectWalletByMemberId(memberId);
        BigDecimal totalAmount = BigDecimal.ZERO;
        for(ApiCreateItemDto apiCreateItemDto : items){
            BigDecimal tzAmount = apiCreateItemDto.getTzAmount().setScale(2,BigDecimal.ROUND_DOWN);//投注金额
            if(BigDecimal.ZERO.compareTo(tzAmount) >= 0){
                throw new FebsException("金额必须大于0");
            }
            totalAmount = totalAmount.add(tzAmount);
        }
        if(mallMemberWallet.getBalance().compareTo(totalAmount) < 0){
            throw new FebsException("余额不足");
        }
        //更新用户余额
        mallMemberWallet.setBalance(mallMemberWallet.getBalance().subtract(totalAmount));
        mallMemberWalletMapper.updateBalanceWithVersion(mallMemberWallet);
        //新增一条投注主表记录
        CjInfo cjInfo = new CjInfo();
        cjInfo.setMemberId(memberId);
        String kjNo = redisUtils.getString(AppContants.KJ_RECORD_NO);
        cjInfo.setKjNo(kjNo);
        cjInfo.setKjState(0);
        cjInfo.setPerkAmount(BigDecimal.ZERO);
        cjInfo.setTotalAmount(totalAmount);
        cjInfoMapper.insert(cjInfo);
        for(ApiCreateItemDto apiCreateItemDto : items){
            Long id = apiCreateItemDto.getId();//投注ID
            TzInfo tzInfo = tzInfoMapper.selectById(id);
            if(ObjectUtil.isEmpty(tzInfo)){
                throw new FebsException("参数有误,请刷新页面");
            }
            BigDecimal tzAmount = apiCreateItemDto.getTzAmount().setScale(2,BigDecimal.ROUND_DOWN);//投注金额
            CjItem cjItem = new CjItem();
            cjItem.setInfoId(cjInfo.getId());
            cjItem.setMemberId(memberId);
            cjItem.setTzId(id);
            cjItem.setTzCode(tzInfo.getTzCode());
            cjItem.setTzPercent(tzInfo.getTzPercent());
            cjItem.setType(tzInfo.getType());
            cjItem.setAmount(tzAmount);
            cjItem.setItemNum(tzInfo.getTzCode());
            cjItem.setPerkAmount(BigDecimal.ZERO);
            cjItemMapper.insert(cjItem);
        }
        String orderNo = MallUtils.getOrderNum("T");
        mallMemberService.addMoneyFlow(
                memberId,
                totalAmount.negate(),
                MoneyFlowTypeNewEnum.STATIC_BONUS.getValue(),
                orderNo,
                MoneyFlowTypeNewEnum.STATIC_BONUS.getDescription(),
                null,
                cjInfo.getId(),
                2,
                FlowTypeEnum.BALANCE.getValue());
        log.info("结束:{}", (System.currentTimeMillis() - l));
    }
}
src/main/java/cc/mrbird/febs/mall/service/impl/CJServiceImpl.java
@@ -14,6 +14,7 @@
import cc.mrbird.febs.mall.dto.OpenPrice;
import cc.mrbird.febs.mall.entity.*;
import cc.mrbird.febs.mall.mapper.*;
import cc.mrbird.febs.mall.service.AsyncCjService;
import cc.mrbird.febs.mall.service.CJService;
import cc.mrbird.febs.mall.service.IApiMallMemberService;
import cc.mrbird.febs.mall.vo.ApiKjInfoVo;
@@ -25,6 +26,7 @@
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -52,6 +54,7 @@
    private final CjInfoMapper cjInfoMapper;
    private final CjItemMapper cjItemMapper;
    private final IApiMallMemberService mallMemberService;
    private final AsyncCjService asyncCjService;
    @Override
    public FebsResponse kjRecord(KjRecordDto kjRecordDto) {
@@ -82,7 +85,43 @@
        redisUtils.set(AppContants.KJ_RECORD_TIME, kjRecord.getCreatedTime(), 600);
        agentProducer.sendChouJiangDelayMsg(kjNo, 10 * 60 * 1000L);
        agentProducer.sendNoTimeDelayMsg(kjNo, 95 * 6 * 1000L);//提前三十秒停止下注
        agentProducer.sendNoTimeDelayMsg(kjNo, 9 * 60 * 1000L);//提一分钟停止下注
        //todo 测试下注
        ApiCreateDto apiCreateDto = new ApiCreateDto();
        List<ApiCreateItemDto> items = new ArrayList<>();
        ApiCreateItemDto apiCreateItemDto = new ApiCreateItemDto();
        apiCreateItemDto.setId(1L);
        apiCreateItemDto.setTzAmount(new BigDecimal("10"));
        items.add(apiCreateItemDto);
        ApiCreateItemDto apiCreateItemDto2 = new ApiCreateItemDto();
        apiCreateItemDto2.setId(2L);
        apiCreateItemDto2.setTzAmount(new BigDecimal("10"));
        items.add(apiCreateItemDto2);
        ApiCreateItemDto apiCreateItemDto3 = new ApiCreateItemDto();
        apiCreateItemDto3.setId(3L);
        apiCreateItemDto3.setTzAmount(new BigDecimal("10"));
        items.add(apiCreateItemDto3);
        ApiCreateItemDto apiCreateItemDto4 = new ApiCreateItemDto();
        apiCreateItemDto4.setId(4L);
        apiCreateItemDto4.setTzAmount(new BigDecimal("10"));
        items.add(apiCreateItemDto4);
        for(int i = 1;i<5;i++){
            ApiCreateItemDto apiCreateItemDto5 = new ApiCreateItemDto();
            int randomInt = RandomUtil.randomInt(1, 25);
            apiCreateItemDto5.setId(Long.parseLong(String.valueOf(randomInt)));
            apiCreateItemDto5.setTzAmount(new BigDecimal("10"));
            items.add(apiCreateItemDto5);
            apiCreateDto.setItems(items);
        }
        for(int i = 0;i<=100;i++){
            asyncCjService.create(apiCreateDto);
        }
    }
@@ -181,8 +220,7 @@
    @Override
    @Transactional
    public FebsResponse create(ApiCreateDto apiCreateDto) {
//        Long memberId = LoginUserUtil.getLoginUser().getId();
        Long memberId = 1L;
        Long memberId = LoginUserUtil.getLoginUser().getId();
        //开启下注
        DataDictionaryCustom noTimeDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                DataDictionaryEnum.NO_TIME.getType(),
@@ -208,13 +246,16 @@
        if(mallMemberWallet.getBalance().compareTo(totalAmount) < 0){
            throw new FebsException("余额不足");
        }
        //更新用户余额
        mallMemberWallet.setBalance(mallMemberWallet.getBalance().subtract(totalAmount));
        mallMemberWalletMapper.updateBalanceWithVersion(mallMemberWallet);
        //新增一条投注主表记录
        CjInfo cjInfo = new CjInfo();
        cjInfo.setMemberId(memberId);
        String kjNo = redisUtils.getString(AppContants.KJ_RECORD_NO);
        cjInfo.setKjNo(kjNo);
        cjInfo.setKjState(1);
        cjInfo.setZjState(1);
        cjInfo.setKjState(0);
        cjInfo.setPerkAmount(BigDecimal.ZERO);
        cjInfo.setTotalAmount(totalAmount);
        cjInfoMapper.insert(cjInfo);
@@ -226,12 +267,12 @@
                throw new FebsException("参数有误,请刷新页面");
            }
            BigDecimal tzAmount = apiCreateItemDto.getTzAmount().setScale(2,BigDecimal.ROUND_DOWN);//投注金额
            totalAmount = totalAmount.add(tzAmount);
            CjItem cjItem = new CjItem();
            cjItem.setInfoId(cjInfo.getId());
            cjItem.setMemberId(memberId);
            cjItem.setTzId(id);
            cjItem.setTzCode(tzInfo.getTzCode());
            cjItem.setTzPercent(tzInfo.getTzPercent());
            cjItem.setType(tzInfo.getType());
            cjItem.setAmount(tzAmount);
            cjItem.setItemNum(tzInfo.getTzCode());
@@ -242,7 +283,7 @@
        String orderNo = MallUtils.getOrderNum("T");
        mallMemberService.addMoneyFlow(
                memberId,
                totalAmount,
                totalAmount.negate(),
                MoneyFlowTypeNewEnum.STATIC_BONUS.getValue(),
                orderNo,
                MoneyFlowTypeNewEnum.STATIC_BONUS.getDescription(),
@@ -256,8 +297,7 @@
    @Override
    public FebsResponse tzInfoList(KjRecordDto kjRecordDto) {
//        Long memberId = LoginUserUtil.getLoginUser().getId();
        Long memberId = 1L;
        Long memberId = LoginUserUtil.getLoginUser().getId();
        kjRecordDto.setMemberId(memberId);
        IPage<CjInfo> page = new Page<>(kjRecordDto.getPageNum(), kjRecordDto.getPageSize());
        IPage<CjInfo> pages = cjInfoMapper.selectTzListByMemberId(page, kjRecordDto);
@@ -278,7 +318,43 @@
    @Override
    public void getOpenPriceMsg(String kjNo, String kjNum) {
        QueryWrapper<CjInfo> objectQueryWrapper = new QueryWrapper<>();
        objectQueryWrapper.eq("kj_no",kjNo);
        List<CjInfo> cjInfos = cjInfoMapper.selectList(objectQueryWrapper);
        if(ObjectUtil.isEmpty(cjInfos)){
            return;
        }
        String danshuang = judgeNumberOne(Integer.parseInt(kjNum));
        String daXiao = judgeNumberTwo(Integer.parseInt(kjNum));
        for(CjInfo cjInfo : cjInfos){
            asyncCjService.openPriceAsync(cjInfo,kjNum,danshuang,daXiao);
        }
    }
    /**
     * 取模运算符%来判断该数字是否为偶数。如果余数为0,则该数字为偶数,返回"双数";否则,该数字为奇数,返回"单数"
     * @param num
     * @return 1-单数 2-双数
     */
    public static String judgeNumberOne(int num) {
        if (num % 2 == 0) {
            return "双";
        } else {
            return "单";
        }
    }
    /**
     * 小于等于12为小 大于12为大
     * @param num
     * @return 1-小数 2-大数
     */
    public static String judgeNumberTwo(int num) {
        if (num <= 12) {
            return "小";
        } else {
            return "大";
        }
    }
}
src/main/resources/application-prod.yml
@@ -13,22 +13,22 @@
      # 配置默认数据源
      primary: base
      datasource:
        # 数据源-1,名称为 base
        # 数据源-1,名称为 base 154.91.195.148
        base:
          username: db_mall_hongloumeng
          password: hongloumeng123!@#123
          username: db_choujiang
          password: db_choujiang123
          driver-class-name: com.mysql.cj.jdbc.Driver
          url: jdbc:mysql://127.0.0.1:3306/db_mall_hongloumeng?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&rewriteBatchedStatements=true&allowMultiQueries=true&serverTimezone=GMT%2b8
          url: jdbc:mysql://127.0.0.1:3306/db_choujiang?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&rewriteBatchedStatements=true&allowMultiQueries=true&serverTimezone=GMT%2b8
  redis:
    # Redis数据库索引(默认为 0)
    database: 1
    database: 3
    # Redis服务器地址
    host: 127.0.0.1
    # Redis服务器连接端口
    port: 6379
    # Redis 密码
    password: zhongji-mall=-0
    password: dapp!@#123
    lettuce:
      pool:
        # 连接池中的最小空闲连接
@@ -44,8 +44,8 @@
  rabbitmq:
    host: 127.0.0.1
    port: 5672
    username: zj_mall
    password: zj_mall123
    username: xc_rabbit
    password: xuncong123
    publisher-confirm-type: correlated
pay:
src/main/resources/mapper/modules/CjItemMapper.xml
New file
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cc.mrbird.febs.mall.mapper.CjItemMapper">
    <select id="selectListByInfoId" resultType="cc.mrbird.febs.mall.entity.CjItem">
        select *
        from cj_item a
        where a.info_id = #{infoId}
    </select>
    <update id="updateBatchById">
        <foreach collection="list" item="item" separator=";">
            update
            `cj_item`
            set
            `kj_num` = #{item.kjNum},
            `perk_amount` = #{item.perkAmount}
            where
            id = #{item.id}
        </foreach>
    </update>
    <select id="selectSumAmountByInfoId" resultType="cc.mrbird.febs.mall.entity.CjItem">
        select *
        from cj_item a
        where a.info_id in
        <foreach collection = "list" item = "item"  separator=","  open = "(" close = ")" >
            #{item}
        </foreach >
    </select>
</mapper>
src/main/resources/mapper/modules/MallGoodsMapper.xml
@@ -240,4 +240,11 @@
        order by a.created_time desc
    </select>
    <select id="getTzListInPage" resultType="cc.mrbird.febs.mall.entity.TzInfo">
        select
        a.*
        from tz_info a
        order by a.id asc
    </select>
</mapper>
src/main/resources/mapper/modules/MallOrderInfoMapper.xml
@@ -315,4 +315,28 @@
            #{item}
        </foreach>
    </select>
    <select id="getChouJiangListInPage" resultType="cc.mrbird.febs.mall.entity.CjInfo">
        select
        a.*,
        c.phone
        from cj_info a
        left join mall_member c on a.member_id = c.id
        <where>
            <if test="record.phone != null and record.phone != ''">
                and c.phone=#{record.phone}
            </if>
            <if test="record.kjNo != null and record.kjNo != ''">
                and a.kj_no=#{record.kjNo}
            </if>
            <if test="record.kjState != null and record.kjState != ''">
                and a.kj_state=#{record.kjState}
            </if>
            <if test="record.zjState != null and record.zjState != ''">
                and a.zj_state=#{record.zjState}
            </if>
        </where>
        order by a.created_time desc
    </select>
</mapper>
src/main/resources/templates/error/403.html
@@ -2,7 +2,7 @@
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>鸿楼梦 权限系统</title>
    <title>抽奖 权限系统</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
src/main/resources/templates/error/404.html
@@ -2,7 +2,7 @@
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>鸿楼梦 权限系统</title>
    <title>抽奖 权限系统</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
src/main/resources/templates/error/500.html
@@ -2,7 +2,7 @@
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>鸿楼梦 权限系统</title>
    <title>抽奖 权限系统</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
src/main/resources/templates/febs/views/layout.html
@@ -64,7 +64,7 @@
        <div class="layui-side-scroll">
            <div class="layui-logo" style="cursor: pointer">
                <img data-th-src="@{febs/images/logo.png}">
                <span>鸿楼梦 权限系统</span>
                <span>抽奖 权限系统</span>
            </div>
            <script
                    type="text/html"
src/main/resources/templates/febs/views/login.html
@@ -2,7 +2,7 @@
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>鸿楼梦 权限系统</title>
    <title>抽奖 权限系统</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
@@ -19,7 +19,7 @@
        <div class="layui-container">
            <div class="layui-row">
                <div class="layui-col-xs12 layui-col-lg4 layui-col-lg-offset4 febs-tc">
                    <div class="layui-logo"><span><b>鸿楼梦</b> 权限系统</span></div>
                    <div class="layui-logo"><span><b>抽奖</b> 权限系统</span></div>
                </div>
                <div class="layui-col-xs12 layui-col-lg4 layui-col-lg-offset4" id="login-div">
                    <div class="layui-form" lay-filter="login-form">
src/main/resources/templates/febs/views/modules/goods/tzList.html
New file
@@ -0,0 +1,140 @@
<div class="layui-fluid layui-anim febs-anim" id="febs-tz" lay-title="投注列表">
    <div class="layui-row febs-container">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body febs-table-full">
                    <form class="layui-form layui-table-form" lay-filter="user-table-form">
                        <div class="layui-row">
                            <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area">
                                <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain table-action" id="query">
                                    <i class="layui-icon">&#xe848;</i>
                                </div>
                                <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="reset">
                                    <i class="layui-icon">&#xe79b;</i>
                                </div>
                            </div>
                        </div>
                    </form>
                    <table lay-filter="tzTable" lay-data="{id: 'tzTable'}"></table>
                    <style type="text/css">
                        .layui-table-cell{
                            text-align:center;
                            height: auto;
                            white-space: nowrap; /*文本不会换行,在同一行显示*/
                            overflow: hidden; /*超出隐藏*/
                            text-overflow: ellipsis; /*省略号显示*/
                        }
                        .layui-table img{
                            max-width:100px
                        }
                    </style>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- 表格操作栏 start -->
<script type="text/html" id="user-option">
    <span shiro:lacksPermission="user:view,user:update,user:delete">
        <span class="layui-badge-dot febs-bg-orange"></span> 无权限
    </span>
    <a lay-event="edit" shiro:hasPermission="user:update"><i
            class="layui-icon febs-edit-area febs-blue">&#xe7a5;</i></a>
</script>
<script type="text/html" id="tzTypeFormat">
    <div>
        {{# if (d.type == 1) { }}
        <span class="layui-badge febs-tag-green">大小</span>
        {{# } else if (d.type == 2) { }}
        <span class="layui-badge febs-tag-cyan">单双</span>
        {{# } else { }}
        <span class="layui-badge febs-tag-orange">数字</span>
        {{# } }}
    </div>
</script>
<style>
    .layui-form-onswitch {
        background-color: #5FB878 !important;
    }
</style>
<!-- 表格操作栏 end -->
<script data-th-inline="none" type="text/javascript">
    // 引入组件并初始化
    layui.use([ 'jquery', 'form', 'table', 'febs'], function () {
        var $ = layui.jquery,
            febs = layui.febs,
            form = layui.form,
            table = layui.table,
            $view = $('#febs-tz'),
            $query = $view.find('#query'),
            $reset = $view.find('#reset'),
            $searchForm = $view.find('form'),
            $add = $view.find('#add'),
            sortObject = {field: 'phone', type: null},
            tableIns;
        form.render();
        let currPageTz = 1;//首先默认值为1,防止出错
        //获取当前页
        currPageTz = $view.find(".layui-laypage-em").next().html();
        // 表格初始化
        initTable();
        // 初始化表格操作栏各个按钮功能
        table.on('tool(tzTable)', function (obj) {
            var data = obj.data,
                layEvent = obj.event;
            if (layEvent === 'goodsUpdate') {
                febs.modal.open('编辑', 'modules/goods/goodsUpdateNew/' + data.id, {
                    btn: ['提交', '取消'],
                    area:['100%','100%'],
                    yes: function (index, layero) {
                        $('#febs-update').find('#submit').trigger('click');
                    },
                    btn2: function () {
                        layer.closeAll();
                    }
                });
            }
        });
        // 查询按钮
        $query.on('click', function () {
            var params = $.extend(getQueryParams(), {field: sortObject.field, order: sortObject.type});
            tableIns.reload({where: params, page: {curr: currPageTz}});
        });
        // 刷新按钮
        $reset.on('click', function () {
            $searchForm[0].reset();
            sortObject.type = 'null';
            tableIns.reload({where: getQueryParams(), page: {curr: currPageTz}, initSort: sortObject});
        });
        function initTable() {
            tableIns = febs.table.init({
                elem: $view.find('table'),
                id: 'tzTable',
                url: ctx + 'admin/goods/tzList',
                cols: [[
                    {templet:"#tzTypeFormat",  title: '类型', minWidth: 100,align:'left'},
                    {field: 'tzCode', title: '值', minWidth: 100,align:'left'},
                    {field: 'tzPercent', title: '倍率', minWidth: 100,align:'left'},
                    {field: 'tzAmount', title: '投注总额', minWidth: 100,align:'left'},
                    {title: '操作',
                        templet: function (d) {
                            return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="goodsUpdate" shiro:hasPermission="user:update">编辑</button>'
                        },minWidth: 160,align:'center'}
                ]]
            });
        }
        // 获取查询参数
        function getQueryParams() {
            return {
            };
        }
    })
</script>
src/main/resources/templates/febs/views/modules/mallMember/moneyFlow.html
@@ -44,20 +44,6 @@
                url: ctx + 'admin/mallMember/moneyFlow?parentId=1',
                cols: [[
                    {field: 'amount', title: '金额', minWidth: 80,align:'center'},
                    {field: 'type', title: '流水类型',
                        templet: function (d) {
                            if (d.type === 1) {
                                return '<span>投注</span>'
                            } else if (d.type === 2) {
                                return '<span>中奖</span>'
                            } else if (d.type === 3) {
                                return '<span>充值</span>'
                            } else if (d.type === 4) {
                                return '<span>提现</span>'
                            }else{
                                return ''
                            }
                        }, minWidth: 80,align:'center'},
                    {field: 'orderNo', title: '订单编号', minWidth: 150,align:'center'},
                    {field: 'description', title: '备注', minWidth: 150,align:'left'},
                    {field: 'createdTime', title: '时间', minWidth: 150,align:'left'}
src/main/resources/templates/febs/views/modules/mallMember/moneyFlowList.html
@@ -8,18 +8,6 @@
                            <div class="layui-col-md10">
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">登录账户:</label>
                                        <div class="layui-input-inline">
                                            <input type="text" placeholder="登录账户" name="accountLogin" autocomplete="off" class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">名称:</label>
                                        <div class="layui-input-inline">
                                            <input type="text" placeholder="名称" name="name" autocomplete="off" class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">手机号码:</label>
                                        <div class="layui-input-inline">
                                            <input type="text" placeholder="手机号码" name="phone" autocomplete="off" class="layui-input">
@@ -30,40 +18,10 @@
                                        <div class="layui-input-inline">
                                            <select name="type">
                                                <option value="">请选择</option>
                                                <option value="1">静态收益</option>
                                                <option value="2">直推奖</option>
                                                <option value="8">提现</option>
                                                <option value="9">转账</option>
                                                <option value="10">支付</option>
                                                <option value="11">退款</option>
                                                <option value="14">签到</option>
                                                <option value="16">系统拨付</option>
                                                <option value="19">1星合伙人补贴</option>
                                                <option value="20">2星合伙人补贴</option>
                                                <option value="21">3星合伙人补贴</option>
                                                <option value="22">4星合伙人补贴</option>
                                                <option value="23">5星合伙人补贴</option>
                                                <option value="24">6星合伙人补贴</option>
                                                <option value="25">贡献点</option>
                                                <option value="26">补贴额度</option>
                                                <option value="27">团队补贴</option>
                                                <option value="28">平级奖励补贴</option>
                                                <option value="29">线下服务中心补贴</option>
                                                <option value="30">代理商补贴</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">资金类型:</label>
                                        <div class="layui-input-inline">
                                            <select name="flowType">
                                                <option value="">请选择</option>
                                                <option value="1">余额</option>
<!--                                                <option value="2">赠送积分</option>-->
                                                <option value="3">现金积分</option>
                                                <option value="5">贡献点</option>
<!--                                                <option value="6">补贴额度</option>-->
<!--                                                <option value="4">佣金</option>-->
                                                <option value="1">投注</option>
                                                <option value="2">中奖</option>
                                                <option value="3">充值</option>
                                                <option value="4">提现</option>
                                            </select>
                                        </div>
                                    </div>
@@ -130,87 +88,20 @@
                id: 'moneyFlowTable',
                url: ctx + 'admin/mallMember/getMoneyFlowList',
                cols: [[
                    {field: 'accountLogin', title: '登录账户', minWidth: 100,align:'left'},
                    {field: 'name', title: '名称', minWidth: 100,align:'left'},
                    {field: 'phone', title: '手机号码', minWidth: 150,align:'left'},
                    {field: 'amount', title: '金额', minWidth: 150,align:'left'},
                    {field: 'fromMemberName', title: '来自', minWidth: 150,align:'left'},
                    {field: 'type', title: '流水类型',
                        templet: function (d) {
                            if (d.type === 1) {
                                return '<span>静态收益</span>'
                                return '<span>投注</span>'
                            } else if (d.type === 2) {
                                return '<span>直推奖</span>'
                                return '<span>中奖</span>'
                            } else if (d.type === 3) {
                                return '<span>代理收益</span>'
                                return '<span>充值</span>'
                            } else if (d.type === 4) {
                                return '<span>排名收益</span>'
                            }else if (d.type === 5) {
                                return '<span>总监收益</span>'
                            }else if (d.type === 6) {
                                return '<span>社区店补</span>'
                            }else if (d.type === 7) {
                                return '<span>一代收益</span>'
                            }else if (d.type === 8) {
                                return '<span>提现</span>'
                            }else if (d.type === 9) {
                                return '<span>转账</span>'
                            }else if (d.type === 10) {
                                return '<span>支付</span>'
                            }else if (d.type === 11) {
                                return '<span>退款</span>'
                            }else if (d.type === 12) {
                                return '<span>佣金转竞猜积分</span>'
                            }else if (d.type === 13) {
                                return '<span>佣金转余额</span>'
                            }else if (d.type === 14) {
                                return '<span>签到</span>'
                            }else if (d.type === 15) {
                                return '<span>感恩奖</span>'
                            }else if (d.type === 16) {
                                return '<span>系统拨付</span>'
                            }else if (d.type === 17) {
                                return '<span>抽奖</span>'
                            }else if (d.type === 18) {
                                return '<span>积分池收益</span>'
                            }else if (d.type === 19) {
                                return '<span>1星合伙人补贴</span>'
                            }else if (d.type === 20) {
                                return '<span>2星合伙人补贴</span>'
                            }else if (d.type === 21) {
                                return '<span>3星合伙人补贴</span>'
                            }else if (d.type === 22) {
                                return '<span>4星合伙人补贴</span>'
                            }else if (d.type === 23) {
                                return '<span>5星合伙人补贴</span>'
                            }else if (d.type === 24) {
                                return '<span>6星合伙人补贴</span>'
                            }else if (d.type === 25) {
                                return '<span>贡献点</span>'
                            }else if (d.type === 26) {
                                return '<span>补贴额度</span>'
                            }else if (d.type === 27) {
                                return '<span>团队补贴</span>'
                            }else if (d.type === 28) {
                                return '<span>平级奖励补贴</span>'
                            }else if (d.type === 29) {
                                return '<span>线下服务中心补贴</span>'
                            }else if (d.type === 30) {
                                return '<span>代理商补贴</span>'
                            }else{
                                return ''
                            }
                        }, minWidth: 80,align:'center'},
                    {field: 'flowType', title: '资金类型',
                        templet: function (d) {
                            if (d.flowType === 1) {
                                return '余额';
                            } else if(d.flowType === 3) {
                                return '现金积分'
                            } else if(d.flowType === 5) {
                                return '贡献点'
                            } else {
                                return '-';
                            }
                        }, minWidth: 80,align:'center'},
                    {field: 'orderNo', title: '订单编号', minWidth: 150,align:'left'},
@@ -223,11 +114,8 @@
        // 获取查询参数
        function getQueryParams() {
            return {
                name: $searchForm.find('input[name="name"]').val().trim(),
                accountLogin: $searchForm.find('input[name="accountLogin"]').val().trim(),
                phone: $searchForm.find('input[name="phone"]').val().trim(),
                type: $searchForm.find("select[name='type']").val(),
                flowType: $searchForm.find("select[name='flowType']").val(),
            };
        }
src/main/resources/templates/febs/views/modules/order/cjList.html
New file
@@ -0,0 +1,181 @@
<div class="layui-fluid layui-anim febs-anim" id="febs-choujiang" lay-title="投注列表">
    <div class="layui-row febs-container">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body febs-table-full">
                    <form class="layui-form layui-table-form" lay-filter="user-table-form">
                        <div class="layui-form-item">
                            <div class="layui-col-md10">
                                <div class="layui-inline">
                                    <label class="layui-form-label">账号:</label>
                                    <div class="layui-input-inline">
                                        <input type="text" placeholder="账号" name="phone" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">期号:</label>
                                    <div class="layui-input-inline">
                                        <input type="text" placeholder="期号" name="kjNo" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">是否开奖:</label>
                                    <div class="layui-input-inline">
                                        <select name="kjState">
                                            <option value="">请选择</option>
                                            <option value="0">未开奖</option>
                                            <option value="1">已开奖</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">是否中奖:</label>
                                    <div class="layui-input-inline">
                                        <select name="zjState">
                                            <option value="">请选择</option>
                                            <option value="0">未中奖</option>
                                            <option value="1">中奖</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area">
                                <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain table-action" id="query">
                                    <i class="layui-icon">&#xe848;</i>
                                </div>
                                <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="reset">
                                    <i class="layui-icon">&#xe79b;</i>
                                </div>
                            </div>
                        </div>
                    </form>
                    <table lay-filter="chouJiangTable" lay-data="{id: 'chouJiangTable'}"></table>
                    <style type="text/css">
                        .layui-table-cell{
                            text-align:center;
                            height: auto;
                            white-space: nowrap; /*文本不会换行,在同一行显示*/
                            overflow: hidden; /*超出隐藏*/
                            text-overflow: ellipsis; /*省略号显示*/
                        }
                        .layui-table img{
                            max-width:100px
                        }
                    </style>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/html" id="user-option">
    <span shiro:lacksPermission="user:view,user:update,user:delete">
        <span class="layui-badge-dot febs-bg-orange"></span> 无权限
    </span>
    <a lay-event="edit" shiro:hasPermission="user:update"><i
            class="layui-icon febs-edit-area febs-blue">&#xe7a5;</i></a>
</script>
<script type="text/html" id="tableToolBar">
    <div class="layui-btn-container">
    </div>
</script>
<!-- 表格操作栏 end -->
<script data-th-inline="none" type="text/javascript">
    // 引入组件并初始化
    layui.use([ 'jquery', 'form', 'table', 'febs', 'upload','laydate'], function () {
        var $ = layui.jquery,
            febs = layui.febs,
            form = layui.form,
            table = layui.table,
            upload = layui.upload,
            $view = $('#febs-choujiang'),
            $query = $view.find('#query'),
            $reset = $view.find('#reset'),
            $searchForm = $view.find('form'),
            $add = $view.find('#add'),
            sortObject = {field: 'phone', type: null},
            laydate = layui.laydate,
            tableIns;
        form.render();
        let currPageCj = 1;//首先默认值为1,防止出错
        //获取当前页
        currPageCj = $view.find(".layui-laypage-em").next().html();
        // 表格初始化
        initTable();
        // 初始化表格操作栏各个按钮功能
        table.on('tool(chouJiangTable)', function (obj) {
            var data = obj.data,
                layEvent = obj.event;
        });
        // 查询按钮
        $query.on('click', function () {
            var params = $.extend(getQueryParams(), {field: sortObject.field, order: sortObject.type});
            tableIns.reload({where: params, page: {curr: currPageCj}});
        });
        // 刷新按钮
        $reset.on('click', function () {
            $searchForm[0].reset();
            sortObject.type = 'null';
            tableIns.reload({where: getQueryParams(), page: {curr: currPageCj}, initSort: sortObject});
        });
        function initTable() {
            tableIns = febs.table.init({
                elem: $view.find('table'),
                id: 'chouJiangTable',
                url: ctx + 'admin/order/chouJiangList',
                defaultToolbar: [],
                // toolbar: '#tableToolBar',
                totalRow: true ,// 开启合计行
                cols: [[
                        {field: 'kjNo', title: '期号', minWidth: 120,align:'left', totalRowText: '合计:'},
                        {field: 'phone', title: '账号', minWidth: 120,align:'left'},
                        {field: 'totalAmount', title: '投注金额', minWidth: 120,align:'left'},
                        {field: 'perkAmount', title: '奖金', minWidth: 120,align:'left'},
                        {field: 'kjState', title: '是否开奖',
                            templet: function (d) {
                                if (d.kjState === 0) {
                                    return '<span style="color:blue;">未开奖</span>'
                                } else if (d.kjState === 1) {
                                    return '<span style="color:green;">已开奖</span>'
                                }else{
                                    return ''
                                }
                            }, minWidth: 120,align:'center'},
                        {field: 'zjState', title: '是否开奖',
                            templet: function (d) {
                                if (d.zjState === 0) {
                                    return '<span style="color:green;">未中奖</span>'
                                } else if (d.zjState === 1) {
                                    return '<span style="color:red;">中奖</span>'
                                }else{
                                    return ''
                                }
                            }, minWidth: 120,align:'center'},
                        {field: 'kjNum', title: '中奖号码', minWidth: 120,align:'left'},
                        {field: 'createdTime', title: '时间', minWidth: 200,align:'left'},
                ]]
            });
        }
        // 获取查询参数
        function getQueryParams() {
            return {
                phone: $searchForm.find('input[name="phone"]').val().trim(),
                kjNo: $searchForm.find('input[name="kjNo"]').val().trim(),
                kjState: $searchForm.find("select[name='kjState']").val(),
                zjState: $searchForm.find("select[name='zjState']").val(),
            };
        }
    })
</script>
src/main/resources/templates/index.html
@@ -3,7 +3,7 @@
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <meta charset="utf-8">
    <title>鸿楼梦 权限系统</title>
    <title>抽奖 权限系统</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">