瀏覽代碼

Merge remote-tracking branch 'origin/master'

kk 3 月之前
父節點
當前提交
8d51d53fa7
共有 20 個文件被更改,包括 615 次插入44 次删除
  1. 3 3
      game-business/src/main/java/com/game/business/controller/AppAgentController.java
  2. 115 0
      game-business/src/main/java/com/game/business/controller/CfgCommonController.java
  3. 45 0
      game-business/src/main/java/com/game/business/domain/CfgCommon.java
  4. 2 2
      game-business/src/main/java/com/game/business/dto/AppAgentTeamDto.java
  5. 5 0
      game-business/src/main/java/com/game/business/dto/AppUserTeamTranserDto.java
  6. 0 1
      game-business/src/main/java/com/game/business/dto/AppUserTeamTranserRecordDto.java
  7. 61 0
      game-business/src/main/java/com/game/business/mapper/CfgCommonMapper.java
  8. 1 1
      game-business/src/main/java/com/game/business/service/IAppGameBettingService.java
  9. 2 0
      game-business/src/main/java/com/game/business/service/IAppUserCountService.java
  10. 66 0
      game-business/src/main/java/com/game/business/service/ICfgCommonService.java
  11. 4 0
      game-business/src/main/java/com/game/business/service/IFinTranRecordService.java
  12. 4 1
      game-business/src/main/java/com/game/business/service/impl/AppGameBettingServiceImpl.java
  13. 3 1
      game-business/src/main/java/com/game/business/service/impl/AppUserAgentServiceImpl.java
  14. 108 6
      game-business/src/main/java/com/game/business/service/impl/AppUserCountServiceImpl.java
  15. 105 0
      game-business/src/main/java/com/game/business/service/impl/CfgCommonServiceImpl.java
  16. 41 18
      game-business/src/main/java/com/game/business/service/impl/FinTranRecordServiceImpl.java
  17. 5 0
      game-business/src/main/java/com/game/business/task/AppGameBettingTask.java
  18. 1 1
      game-business/src/main/java/com/game/business/task/AppUserCountTask.java
  19. 6 0
      game-business/src/main/java/com/game/business/vo/AppAgentTeamVo.java
  20. 38 10
      game-business/src/main/resources/mapper/business/AppUserAgentMapper.xml

+ 3 - 3
game-business/src/main/java/com/game/business/controller/AppAgentController.java

@@ -160,7 +160,7 @@ public class AppAgentController extends BaseController {
      * 团队转账记录
      */
     @PostMapping(value = "/transferRecord")
-    @ApiOperation(value = "团队转账记录(分页)", notes = "团队转账记录(分页)")
+    @ApiOperation(value = "团队转账记录(分页 链接上拼pageSize和pageNum)", notes = "团队转账记录(分页 链接上拼pageSize和pageNum)")
     public HttpRetPageArr<AppUserTeamTranserRecordVo> transferRecord(@RequestBody @Validated AppUserTeamTranserRecordDto transerDto)
     {
         startPage();
@@ -173,12 +173,12 @@ public class AppAgentController extends BaseController {
             if(0 == transerDto.getType()){
                 //转出
                 appUsers = appUserService.selectListByIds(
-                        tableDataInfo.getRows().stream().map(e->e.getFromUid()).collect(Collectors.toList())
+                        tableDataInfo.getRows().stream().map(e->e.getToUid()).collect(Collectors.toList())
                 );
             }else{
                 //转入
                 appUsers = appUserService.selectListByIds(
-                        tableDataInfo.getRows().stream().map(e->e.getToUid()).collect(Collectors.toList())
+                        tableDataInfo.getRows().stream().map(e->e.getFromUid()).collect(Collectors.toList())
                 );
             }
             Map<String,AppUser> userMap = new HashMap<>();

+ 115 - 0
game-business/src/main/java/com/game/business/controller/CfgCommonController.java

@@ -0,0 +1,115 @@
+package com.game.business.controller;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.game.common.core.domain.R;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.game.common.annotation.Log;
+import com.game.common.core.controller.BaseController;
+import com.game.common.core.domain.AjaxResult;
+import com.game.common.enums.BusinessType;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import com.game.business.domain.CfgCommon;
+import com.game.business.service.ICfgCommonService;
+import com.game.common.utils.poi.ExcelUtil;
+import com.game.common.core.page.TableDataInfo;
+
+/**
+ * 公共配置Controller
+ * 
+ * @author game
+ * @date 2024-07-13
+ */
+@RestController
+@RequestMapping("/business/common")
+@Api(value = "CfgCommonController", description = "公共配置接口", tags = {"公共配置"})
+public class CfgCommonController extends BaseController
+{
+    @Autowired
+    private ICfgCommonService cfgCommonService;
+
+    /**
+     * 查询公共配置列表
+     */
+    @PreAuthorize("@ss.hasPermi('business:common:list')")
+    @GetMapping("/list")
+    @ApiOperation(value = "查询公共配置列表", notes = "获取公共配置列表")
+    public TableDataInfo<CfgCommon> list(CfgCommon cfgCommon)
+    {
+        startPage();
+        List<CfgCommon> list = cfgCommonService.selectCfgCommonList(cfgCommon);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出公共配置列表
+     */
+    @PreAuthorize("@ss.hasPermi('business:common:export')")
+    @Log(title = "公共配置", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    @ApiOperation(value = "导出公共配置列表", notes = "导出公共配置列表")
+    public void export(HttpServletResponse response, CfgCommon cfgCommon)
+    {
+        List<CfgCommon> list = cfgCommonService.selectCfgCommonList(cfgCommon);
+        ExcelUtil<CfgCommon> util = new ExcelUtil<CfgCommon>(CfgCommon.class);
+        util.exportExcel(response, list, "公共配置数据");
+    }
+
+    /**
+     * 获取公共配置详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('business:common:query')")
+    @GetMapping(value = "/{id}")
+    @ApiOperation(value = "获取公共配置详细信息", notes = "获取公共配置详细信息")
+    public R<CfgCommon> getInfo(@PathVariable("id") Long id)
+    {
+        return R.ok(cfgCommonService.selectCfgCommonById(id));
+    }
+
+    /**
+     * 新增公共配置
+     */
+    @PreAuthorize("@ss.hasPermi('business:common:add')")
+    @Log(title = "公共配置", businessType = BusinessType.INSERT)
+    @ApiOperation(value = "新增公共配置", notes = "新增公共配置")
+    @PostMapping
+    public R add(@RequestBody CfgCommon cfgCommon)
+    {
+        return R.ok(cfgCommonService.insertCfgCommon(cfgCommon));
+    }
+
+    /**
+     * 修改公共配置
+     */
+    @PreAuthorize("@ss.hasPermi('business:common:edit')")
+    @Log(title = "公共配置", businessType = BusinessType.UPDATE)
+    @ApiOperation(value = "修改公共配置", notes = "修改公共配置")
+    @PutMapping
+    public R edit(@RequestBody CfgCommon cfgCommon)
+    {
+        return R.ok(cfgCommonService.updateCfgCommon(cfgCommon));
+    }
+
+    /**
+     * 删除公共配置
+     */
+    @PreAuthorize("@ss.hasPermi('business:common:remove')")
+    @Log(title = "公共配置", businessType = BusinessType.DELETE)
+    @ApiOperation(value = "删除公共配置", notes = "删除公共配置")
+	@DeleteMapping("/{ids}")
+    public R remove(@PathVariable Long[] ids)
+    {
+        return R.ok(cfgCommonService.deleteCfgCommonByIds(ids));
+    }
+}

+ 45 - 0
game-business/src/main/java/com/game/business/domain/CfgCommon.java

@@ -0,0 +1,45 @@
+package com.game.business.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.game.common.annotation.Excel;
+import com.game.common.core.domain.BaseEntity;
+import io.swagger.annotations.ApiModelProperty;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+/**
+ * 公共配置对象 cfg_common
+ *
+ * @author game
+ * @date 2024-07-13
+ */
+@ApiModel(value = "cfg_common", description = "公共配置")
+@TableName(value= "cfg_common")
+@Data
+public class CfgCommon
+        {
+private static final long serialVersionUID=1L;
+
+    /** $column.columnComment */
+    @ApiModelProperty(value = "$column.columnComment")
+    @TableId(value = "id" , type = IdType.AUTO)
+    private Long id;
+
+    /** 配置值 */
+    @ApiModelProperty(value = "配置值")
+    @Excel(name = "配置值")
+    @TableField(value = "cfg_value")
+    private String cfgValue;
+
+    /** 类型 0:团队转账限额  10:邀请奖励 */
+    @ApiModelProperty(value = "类型 0:团队转账限额  10:邀请奖励  20:直播客服  30:游戏客服 40:支付客服")
+    @Excel(name = "类型 0:团队转账限额  10:邀请奖励  20:直播客服  30:游戏客服 40:支付客服")
+    @TableField(value = "type")
+    private int type;
+
+}

+ 2 - 2
game-business/src/main/java/com/game/business/dto/AppAgentTeamDto.java

@@ -31,8 +31,8 @@ public class AppAgentTeamDto implements Serializable {
     @ApiModelProperty(value = "结束时间 格式yyyy-MM-dd")
     private String endTime;
 
-    @JsonIgnore
-    private long pid;
+    @ApiModelProperty(value = "上级id")
+    private Long pid;
 
     /** 当前记录起始索引 */
     @ApiModelProperty(value = "页数")

+ 5 - 0
game-business/src/main/java/com/game/business/dto/AppUserTeamTranserDto.java

@@ -24,4 +24,9 @@ public class AppUserTeamTranserDto implements Serializable {
     @NotNull(message = "金额不能为空")
     private Double money;
 
+    /** 金额 **/
+    @ApiModelProperty(value = "支付密码")
+    @NotNull(message = "支付密码不能为空")
+    private String fundPassword;
+
 }

+ 0 - 1
game-business/src/main/java/com/game/business/dto/AppUserTeamTranserRecordDto.java

@@ -16,7 +16,6 @@ public class AppUserTeamTranserRecordDto implements Serializable {
 
     /** 用户id */
     @ApiModelProperty(value = "用户id")
-    @NotNull(message = "用户id")
     private Long userId;
 
     @ApiModelProperty(value = "开始时间")

+ 61 - 0
game-business/src/main/java/com/game/business/mapper/CfgCommonMapper.java

@@ -0,0 +1,61 @@
+package com.game.business.mapper;
+
+import java.util.List;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.game.business.domain.CfgCommon;
+
+/**
+ * 公共配置Mapper接口
+ *
+ * @author game
+ * @date 2024-07-13
+ */
+public interface CfgCommonMapper extends BaseMapper<CfgCommon> {
+    /**
+     * 查询公共配置
+     *
+     * @param id 公共配置主键
+     * @return 公共配置
+     */
+    public CfgCommon selectCfgCommonById(Long id);
+
+    /**
+     * 查询公共配置列表
+     *
+     * @param cfgCommon 公共配置
+     * @return 公共配置集合
+     */
+    public List<CfgCommon> selectCfgCommonList(CfgCommon cfgCommon);
+
+    /**
+     * 新增公共配置
+     *
+     * @param cfgCommon 公共配置
+     * @return 结果
+     */
+    public int insertCfgCommon(CfgCommon cfgCommon);
+
+    /**
+     * 修改公共配置
+     *
+     * @param cfgCommon 公共配置
+     * @return 结果
+     */
+    public int updateCfgCommon(CfgCommon cfgCommon);
+
+    /**
+     * 删除公共配置
+     *
+     * @param id 公共配置主键
+     * @return 结果
+     */
+    public int deleteCfgCommonById(Long id);
+
+    /**
+     * 批量删除公共配置
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteCfgCommonByIds(Long[] ids);
+}

+ 1 - 1
game-business/src/main/java/com/game/business/service/IAppGameBettingService.java

@@ -21,5 +21,5 @@ public interface IAppGameBettingService extends IService<AppGameBetting> {
     /**
      * 根据日期查询投注情况
      * */
-    List<AppGameBetting> selectListByDate( Long userId, String beginTime, String endTime);
+    List<AppGameBetting> selectListByDate( Long userId, String beginTime, String endTime,Long gameId);
 }

+ 2 - 0
game-business/src/main/java/com/game/business/service/IAppUserCountService.java

@@ -12,4 +12,6 @@ public interface IAppUserCountService extends IService<AppUserCount> {
 
     public void createAppUserCount(AppUserCount appUserCount);
 
+    public void staticsUserCount(Long gameId,String dateTime);
+
 }

+ 66 - 0
game-business/src/main/java/com/game/business/service/ICfgCommonService.java

@@ -0,0 +1,66 @@
+package com.game.business.service;
+
+import java.util.List;
+import com.game.business.domain.CfgCommon;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 公共配置Service接口
+ *
+ * @author game
+ * @date 2024-07-13
+ */
+public interface ICfgCommonService extends IService<CfgCommon> {
+    /**
+     * 查询公共配置
+     *
+     * @param id 公共配置主键
+     * @return 公共配置
+     */
+    public CfgCommon selectCfgCommonById(Long id);
+
+    /**
+     * 查询公共配置列表
+     *
+     * @param cfgCommon 公共配置
+     * @return 公共配置集合
+     */
+    public List<CfgCommon> selectCfgCommonList(CfgCommon cfgCommon);
+
+    /**
+     * 新增公共配置
+     *
+     * @param cfgCommon 公共配置
+     * @return 结果
+     */
+    public int insertCfgCommon(CfgCommon cfgCommon);
+
+    /**
+     * 修改公共配置
+     *
+     * @param cfgCommon 公共配置
+     * @return 结果
+     */
+    public int updateCfgCommon(CfgCommon cfgCommon);
+
+    /**
+     * 批量删除公共配置
+     *
+     * @param ids 需要删除的公共配置主键集合
+     * @return 结果
+     */
+    public int deleteCfgCommonByIds(Long[] ids);
+
+    /**
+     * 删除公共配置信息
+     *
+     * @param id 公共配置主键
+     * @return 结果
+     */
+    public int deleteCfgCommonById(Long id);
+
+    /**
+     * 获取根据类型配置
+     * */
+    public CfgCommon getCfg(int type);
+}

+ 4 - 0
game-business/src/main/java/com/game/business/service/IFinTranRecordService.java

@@ -1,6 +1,8 @@
 package com.game.business.service;
 
 import java.util.List;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.game.business.domain.FinTranRecord;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.game.business.dto.AppUserTeamTranserDto;
@@ -83,4 +85,6 @@ public interface IFinTranRecordService extends IService<FinTranRecord> {
      * 代存记录
      * */
     public List<FinTranRecord> transferRecord(AppUserTeamTranserRecordDto transerRecordDto);
+
+    public List<FinTranRecord> selecListByWrapper(LambdaQueryWrapper<FinTranRecord> queryWrapper);
 }

+ 4 - 1
game-business/src/main/java/com/game/business/service/impl/AppGameBettingServiceImpl.java

@@ -66,7 +66,7 @@ public class AppGameBettingServiceImpl extends ServiceImpl<AppGameBettingMapper,
     }
 
     @Override
-    public List<AppGameBetting> selectListByDate(Long userId, String beginTime, String endTime) {
+    public List<AppGameBetting> selectListByDate(Long userId, String beginTime, String endTime,Long gameId) {
         LambdaQueryWrapper<AppGameBetting> queryWrapper = Wrappers.lambdaQuery();;
         queryWrapper.ne(AppGameBetting::getIsWinning,0);//查询已开奖
         queryWrapper.eq(AppGameBetting::getBettingType,0);
@@ -76,6 +76,9 @@ public class AppGameBettingServiceImpl extends ServiceImpl<AppGameBettingMapper,
         if(StringUtils.isNotBlank(beginTime)){
             queryWrapper.ge(AppGameBetting::getUpdateTime,beginTime);
         }
+        if(null != gameId){
+            queryWrapper.eq(AppGameBetting::getGameId,gameId);
+        }
         if(StringUtils.isNotBlank(endTime)){
             queryWrapper.le(AppGameBetting::getUpdateTime,endTime);
         }

+ 3 - 1
game-business/src/main/java/com/game/business/service/impl/AppUserAgentServiceImpl.java

@@ -189,7 +189,9 @@ public class AppUserAgentServiceImpl extends ServiceImpl<AppUserAgentMapper, App
 
     @Override
     public List<AppAgentTeamVo> teamList(AppAgentTeamDto teamDto) {
-        teamDto.setPid(SecurityUtils.getUserId());
+        if(null == teamDto.getPid()) {
+            teamDto.setPid(SecurityUtils.getUserId());
+        }
         List<AppAgentTeamVo> list = appUserAgentMapper.teamList(teamDto);
         if(null != list && list.size() > 0){
             List<Long> ids = list.stream().map(e->{return e.getUserId();}).collect(Collectors.toList());

+ 108 - 6
game-business/src/main/java/com/game/business/service/impl/AppUserCountServiceImpl.java

@@ -1,16 +1,23 @@
 package com.game.business.service.impl;
 
+import cn.hutool.core.date.DateUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.game.business.domain.AppUserCount;
+import com.game.business.domain.*;
 import com.game.business.mapper.AppUserCountMapper;
-import com.game.business.service.IAppUserCountService;
+import com.game.business.service.*;
+import com.game.common.constant.finance.FinTranType1;
+import com.game.common.constant.finance.FinTranType3;
+import com.game.common.entity.KeyValue;
+import com.game.common.utils.DateUtils;
+import com.game.common.utils.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 
-import java.util.Collections;
-import java.util.List;
+import java.util.*;
+import java.util.function.Function;
+import java.util.stream.Collectors;
 
 @Service
 public class AppUserCountServiceImpl extends ServiceImpl<AppUserCountMapper, AppUserCount> implements IAppUserCountService {
@@ -18,16 +25,37 @@ public class AppUserCountServiceImpl extends ServiceImpl<AppUserCountMapper, App
     @Autowired
     private AppUserCountMapper appUserCountMapper;
 
+    @Autowired
+    private IAppUserService appUserService;
+
+    @Autowired
+    private IAppUsersChargeService appUsersChargeService;
+
+    @Autowired
+    private IAppUsersCashrecordService appUsersCashrecordService;
+
+    @Autowired
+    private IFinTranRecordService finTranRecordService;
+
+    @Autowired
+    private IAppUserLiveDividedRecordService appUserLiveDividedRecordService;
+
+    @Autowired
+    private IAppUserGameRecordCountService appUserGameRecordCountService;
+
+    @Autowired
+    private IAppGameBettingService appGameBettingService;
+
     @Override
     public List<AppUserCount> getAppUserCount(long userId,String beginTime,String endTIme) {
         LambdaQueryWrapper<AppUserCount> queryWrapper = new LambdaQueryWrapper<AppUserCount>();
         queryWrapper.between(AppUserCount::getStrDate,beginTime,endTIme);
-        queryWrapper.eq(AppUserCount::getUserId,userId);
+        queryWrapper.eq(AppUserCount::getAgentUserId,userId);
         return appUserCountMapper.selectList(queryWrapper);
     }
 
     @Override
-    @Async
+//    @Async
     public void createAppUserCount(AppUserCount appUserCount) {
         //查询当前用户当日是否已经生成记录
         LambdaQueryWrapper<AppUserCount> queryWrapper = new LambdaQueryWrapper<>();
@@ -43,4 +71,78 @@ public class AppUserCountServiceImpl extends ServiceImpl<AppUserCountMapper, App
         }
     }
 
+    @Override
+    public void staticsUserCount(Long gameId,String dateTime) {
+        Date curDate = DateUtils.getNowDate();
+        if (StringUtils.isNotBlank(dateTime)) {
+            curDate = DateUtil.parse(dateTime, "yyyy-MM-dd");
+        } else {
+            dateTime = DateUtils.parseDateToStr("yyyy-MM-dd", curDate);
+        }
+        AppUser queryUser = new AppUser();
+        queryUser.setAgentFlag(1);
+        List<AppUser> list = appUserService.selectAppUserList(queryUser);//查询所有代理用户
+        List<AppUsersCharge> appUsersChargeList = appUsersChargeService.getChargeList(null, dateTime.concat(" 00:00:00"), dateTime.concat(" 23:59:59"));
+        List<AppUsersCashrecord> appUsersCashrecords = appUsersCashrecordService.getUserCashList(null, dateTime.concat(" 00:00:00"), dateTime.concat(" 23:59:59"));
+        List<FinTranRecord> finTranRecordList = finTranRecordService.getUserRecordList(null, dateTime.concat(" 00:00:00"), dateTime.concat(" 23:59:59"));
+        List<AppUserLiveDividedRecord> liveDividedRecordList = appUserLiveDividedRecordService.selectByDate(null, dateTime.concat(" 00:00:00"), dateTime.concat(" 23:59:59"));
+        List<AppUserGameRecordCount> gameRecordCountList = appUserGameRecordCountService.selectByDate(null, dateTime.concat(" 00:00:00"), dateTime.concat(" 23:59:59"));
+        List<AppGameBetting> gameBettingList = appGameBettingService.selectListByDate(null, dateTime.concat(" 00:00:00"), dateTime.concat(" 23:59:59"),null);
+        if (null != list && list.size() > 0) {
+            String finalDateTime = dateTime;
+            list.forEach(appUser -> {
+                AppUserCount appUserCount = new AppUserCount();
+                appUserCount.setUserId(appUser.getUserid());
+                appUserCount.setStrDate(finalDateTime);
+                appUserCount.setAgentUserId(appUser.getPid());
+                //充值总额
+                appUserCount.setRechargeAmount(appUsersChargeList.stream().filter(e -> e.getUid().equals(appUser.getUserid())).mapToDouble(e -> e.getMoney().doubleValue()).sum());
+                //提现金额
+                appUserCount.setWithdrawalAmount(appUsersCashrecords.stream().filter(e -> e.getUid().equals(appUser.getUserid())).mapToDouble(e -> e.getMoney().doubleValue()).sum());
+                //充值服务费/手续费
+                appUserCount.setRechargeCommission(appUsersChargeList.stream().filter(e -> e.getUid().equals(appUser.getUserid())).mapToDouble(e -> e.getPlatformService()).sum());
+                //充值赠送余额
+                appUserCount.setRechargeGive(finTranRecordList.stream().filter(e -> {
+                    return e.getUid().equals(appUser.getUserid()) &&
+                            e.getTranType1().intValue() == FinTranType1.U_Income_Coin_Balance.getType() &&
+                            e.getTranType3().intValue() == FinTranType3.CHARGE_IN_REWARD.getType();
+                }).mapToDouble(e->e.getCoinChange()).sum());
+                //提现服务费/手续费
+                appUserCount.setWithdrawalCommission(appUsersCashrecords.stream().filter(e -> e.getUid().equals(appUser.getUserid())).mapToDouble(e -> e.getService().doubleValue()).sum());
+                //直播消费金额
+                Map<String, KeyValue> type1Keys = Arrays.stream(FinTranType1.getKeyValues(1)).collect(Collectors.toMap(e -> e.a, Function.identity(), (k1, k2) -> k2)); //支出交易类型
+                Map<String, KeyValue> type3Keys = Arrays.stream(FinTranType3.getKeyValues(1)).collect(Collectors.toMap(e -> e.a, Function.identity(), (k1, k2) -> k2)); //支出交易类型
+                appUserCount.setLiveUseAmount(finTranRecordList.stream().filter(e -> {
+                    return e.getUid().equals(appUser.getUserid()) &&
+                            null != type1Keys.get(String.valueOf(e.getTranType1().intValue())) &&
+                            null != type3Keys.get(String.valueOf(e.getTranType3().intValue()));
+                }).mapToDouble(e -> dealMoney(e.getCoinChange())).sum());
+                //直播佣金
+                appUserCount.setLiveCommission(liveDividedRecordList.stream().filter(e -> e.getUserId().equals(appUser.getUserid())).mapToDouble(e -> e.getMoney().doubleValue()).sum());
+                //游戏佣金
+                appUserCount.setGameCommission(gameRecordCountList.stream().filter(e -> e.getUserId().equals(appUser.getUserid())).mapToDouble(e -> e.getCommission()).sum());
+                //游戏输
+                appUserCount.setGameLoseAmount(gameBettingList.stream().filter(
+                        e -> e.getUserId().equals(appUser.getUserid()) && e.getIsWinning().intValue() == 2
+                ).mapToDouble(e ->
+                        e.getBettingAmount()
+                ).sum());
+                //游戏赢
+                appUserCount.setGameWinAmount(gameBettingList.stream().filter(
+                        e -> e.getUserId().equals(appUser.getUserid()) && e.getIsWinning().intValue() == 1
+                ).mapToDouble(e ->
+                        e.getBettingAmount() * e.getBettingMultiple()
+                ).sum());
+                this.createAppUserCount(appUserCount);
+            });
+        }
+    }
+
+    /**
+     * 金额为负数则转为正数
+     * */
+    private double dealMoney(double money){
+        return money<0?money*-1:money;
+    }
+
 }

+ 105 - 0
game-business/src/main/java/com/game/business/service/impl/CfgCommonServiceImpl.java

@@ -0,0 +1,105 @@
+package com.game.business.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import java.util.List;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.game.business.mapper.CfgCommonMapper;
+import com.game.business.domain.CfgCommon;
+import com.game.business.service.ICfgCommonService;
+import com.game.common.annotation.DataSource;
+import com.game.common.enums.DataSourceType;
+
+/**
+ * 公共配置Service业务层处理
+ *
+ * @author game
+ * @date 2024-07-13
+ */
+@Service
+public class CfgCommonServiceImpl extends ServiceImpl<CfgCommonMapper, CfgCommon> implements ICfgCommonService {
+    @Autowired
+    private CfgCommonMapper cfgCommonMapper;
+
+    /**
+     * 查询公共配置
+     *
+     * @param id 公共配置主键
+     * @return 公共配置
+     */
+    @Override
+    @DataSource(DataSourceType.SLAVE)
+    public CfgCommon selectCfgCommonById(Long id) {
+        return cfgCommonMapper.selectCfgCommonById(id);
+    }
+
+    /**
+     * 查询公共配置列表
+     *
+     * @param cfgCommon 公共配置
+     * @return 公共配置
+     */
+    @Override
+    @DataSource(DataSourceType.SLAVE)
+    public List<CfgCommon> selectCfgCommonList(CfgCommon cfgCommon) {
+        return cfgCommonMapper.selectCfgCommonList(cfgCommon);
+    }
+
+    /**
+     * 新增公共配置
+     *
+     * @param cfgCommon 公共配置
+     * @return 结果
+     */
+    @Override
+    @DataSource(DataSourceType.SLAVE)
+    public int insertCfgCommon(CfgCommon cfgCommon) {
+            return cfgCommonMapper.insertCfgCommon(cfgCommon);
+    }
+
+    /**
+     * 修改公共配置
+     *
+     * @param cfgCommon 公共配置
+     * @return 结果
+     */
+    @Override
+    @DataSource(DataSourceType.SLAVE)
+    public int updateCfgCommon(CfgCommon cfgCommon) {
+        return cfgCommonMapper.updateCfgCommon(cfgCommon);
+    }
+
+    /**
+     * 批量删除公共配置
+     *
+     * @param ids 需要删除的公共配置主键
+     * @return 结果
+     */
+    @Override
+    @DataSource(DataSourceType.SLAVE)
+    public int deleteCfgCommonByIds(Long[] ids) {
+        return cfgCommonMapper.deleteCfgCommonByIds(ids);
+    }
+
+    /**
+     * 删除公共配置信息
+     *
+     * @param id 公共配置主键
+     * @return 结果
+     */
+    @Override
+    @DataSource(DataSourceType.SLAVE)
+    public int deleteCfgCommonById(Long id) {
+        return cfgCommonMapper.deleteCfgCommonById(id);
+    }
+
+    @Override
+    @DataSource(DataSourceType.SLAVE)
+    public CfgCommon getCfg(int type) {
+        LambdaQueryWrapper<CfgCommon> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(CfgCommon::getType, type);
+        return cfgCommonMapper.selectOne(queryWrapper);
+    }
+}

+ 41 - 18
game-business/src/main/java/com/game/business/service/impl/FinTranRecordServiceImpl.java

@@ -13,6 +13,7 @@ import com.game.business.dto.AppUserTeamTranserDto;
 import com.game.business.dto.AppUserTeamTranserRecordDto;
 import com.game.business.service.IAppUserService;
 import com.game.business.service.ICfgCommonService;
+import com.game.business.util.Md5Utils;
 import com.game.business.vo.AppUserTeamTranserRecordVo;
 import com.game.common.annotation.DataSource;
 import com.game.common.constant.AppSceneType;
@@ -150,16 +151,27 @@ public class FinTranRecordServiceImpl extends ServiceImpl<FinTranRecordMapper, F
     }
 
     @Override
-    @DataSource(DataSourceType.SLAVE)
     @DSTransactional
+    @DataSource(DataSourceType.SLAVE)
     public HttpRet<Boolean> transfer(AppUserTeamTranserDto transfer) {
         AppUser toAppUser = appUserService.selectAppUserByUserid(transfer.getToUserId());
         AppUser appUser = appUserService.selectAppUserByUserid(SecurityUtils.getUserId());
         if(null == toAppUser){
             return HttpRet.fail("受益用户不存在");
         }
-        if(appUser.getDiamondCoin().longValue() < transfer.getMoney().longValue()){
-            return HttpRet.fail("转账金额不足");
+        if(appUser.getDiamondCoinCash().longValue() < transfer.getMoney().longValue()){
+            return HttpRet.fail("可转账金额不足");
+        }
+        if(StringUtils.isBlank(appUser.getFundPassword())){
+            return HttpRet.fail("未设置支付密码");
+        }
+        if(!Md5Utils.md5(Md5Utils.md5(transfer.getFundPassword()) + appUser.getSalt()).equals(appUser.getFundPassword())){
+            return HttpRet.fail("支付密码错误");
+        }
+        //查询当笔限额
+        CfgCommon cfgSignleCommon = cfgCommonService.getCfg(1);
+        if(null != cfgSignleCommon && transfer.getMoney() > Double.parseDouble(cfgSignleCommon.getCfgValue())){
+            return HttpRet.fail("转账失败超出单笔最大限额");
         }
         //查询当日限额
         CfgCommon cfgCommon = cfgCommonService.getCfg(0);
@@ -170,7 +182,7 @@ public class FinTranRecordServiceImpl extends ServiceImpl<FinTranRecordMapper, F
             queryWrapper.eq(FinTranRecord::getFromUid,SecurityUtils.getUserId());
             queryWrapper.eq(FinTranRecord::getTranType1,FinTranType1.U_Outcome_Coin.getType());
             queryWrapper.eq(FinTranRecord::getTranType3,FinTranType3.TRANSFER_TO_TEAM_DiamondCoin.getType());
-            List<FinTranRecord> finTranRecords = finTranRecordMapper.selectList(queryWrapper);
+            List<FinTranRecord> finTranRecords = finTranRecordService.selecListByWrapper(queryWrapper);
             if(null != finTranRecords && finTranRecords.size()>0){
                 double curMoney = finTranRecords.stream().mapToDouble(FinTranRecord::getDiamondCoinChange).sum();
                 if(curMoney >= limit){
@@ -183,25 +195,26 @@ public class FinTranRecordServiceImpl extends ServiceImpl<FinTranRecordMapper, F
         updateAppUser.setUserid(appUser.getUserid());
         updateAppUser.setDiamondCoin(appUser.getDiamondCoin() - transfer.getMoney());
         updateAppUser.setDiamondCoinCash(appUser.getDiamondCoinCash() - transfer.getMoney());
-        updateAppUser.setDiamondCoinTotal(appUser.getDiamondCoinTotal() + transfer.getMoney());
+        updateAppUser.setDiamondCoinTotal(appUser.getDiamondCoinTotal() - transfer.getMoney());
         //扣减余额
-        appUserService.updateAppUser(appUser);
+        appUserService.updateAppUser(updateAppUser);
 
         FinTranAddedInfo addedInfo = FinTranAddedInfo.createTranInfo(appUser.getUserid(), 0, 0, AppSceneType.Scene_None, "");
         FinTranRecord tran = FinTranRecord.initFinTranRecordSomeParams(addedInfo, FinTranType3.TRANSFER_TO_TEAM_DiamondCoin, FinTranType1.U_Outcome_Balance, appUser);
         tran.setDiamondCoinChange(transfer.getMoney() * -1);
         tran.setAfterDiamondCoin(appUser.getDiamondCoin() + transfer.getMoney());
         tran.setCurrencyType(TranCurrencyType.Balance.getType());
+        tran.setRemarks("团队转账");
         finTranRecordService.insertFinTranRecord(tran);
 
         //受益用户增加余额
         AppUser toUpdateAppUser = new AppUser();
-        toUpdateAppUser.setUserid(appUser.getUserid());
-        toUpdateAppUser.setDiamondCoin(appUser.getDiamondCoin() + transfer.getMoney());
-        toUpdateAppUser.setDiamondCoinCash(appUser.getDiamondCoinCash() + transfer.getMoney());
-        updateAppUser.setDiamondCoinTotal(appUser.getDiamondCoinTotal() + transfer.getMoney());
+        toUpdateAppUser.setUserid(toAppUser.getUserid());
+        toUpdateAppUser.setDiamondCoin(toAppUser.getDiamondCoin() + transfer.getMoney());
+        toUpdateAppUser.setDiamondCoinCash(toAppUser.getDiamondCoinCash() + transfer.getMoney());
+        updateAppUser.setDiamondCoinTotal(toAppUser.getDiamondCoinTotal() + transfer.getMoney());
         //增加余额
-        appUserService.updateAppUser(appUser);
+        appUserService.updateAppUser(toUpdateAppUser);
 
         FinTranAddedInfo toAddedInfo = FinTranAddedInfo.createTranInfo(appUser.getUserid(), 0, 0, AppSceneType.Scene_None, "");
         FinTranRecord toTran = FinTranRecord.initFinTranRecordSomeParams(toAddedInfo, FinTranType3.TRANSFER_TO_TEAM_DiamondCoin, FinTranType1.U_Income_Coin_Balance, toAppUser);
@@ -209,33 +222,43 @@ public class FinTranRecordServiceImpl extends ServiceImpl<FinTranRecordMapper, F
         toTran.setAfterDiamondCoin(appUser.getDiamondCoin() + transfer.getMoney());
         toTran.setCurrencyType(TranCurrencyType.Balance.getType());
         toTran.setFromUid(appUser.getUserid());
+        tran.setRemarks("团队转账");
         finTranRecordService.insertFinTranRecord(toTran);
         //清除用户缓存
         redisCache.deleteObject("U:UserInfo:".concat(String.valueOf(appUser.getUserid())));
         redisCache.deleteObject("U:UserInfo:".concat(String.valueOf(toAppUser.getUserid())));
-        return HttpRet.success("转账成功");
+        return HttpRet.success("转账成功",true);
     }
 
     @Override
+    @DataSource(DataSourceType.SLAVE)
     public List<FinTranRecord> transferRecord(AppUserTeamTranserRecordDto transerRecordDto) {
+        Long userId = SecurityUtils.getUserId();
         LambdaQueryWrapper<FinTranRecord> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.between(FinTranRecord::getCreateTime,transerRecordDto.getBeginTime(),transerRecordDto.getEndTime());
+        queryWrapper.between(FinTranRecord::getCreateTime,transerRecordDto.getBeginTime().concat(" 00:00:00"),transerRecordDto.getEndTime().concat(" 23:59:59"));
         queryWrapper.eq(FinTranRecord::getTranType3,FinTranType3.TRANSFER_TO_TEAM_DiamondCoin.getType());
-        queryWrapper.eq(FinTranRecord::getTranType1,FinTranType1.U_Income_Coin_Balance);
+        queryWrapper.eq(FinTranRecord::getTranType1,FinTranType1.U_Income_Coin_Balance.getType());
         if(transerRecordDto.getType() == 0){
             //转出
-            queryWrapper.eq(FinTranRecord::getFromUid,SecurityUtils.getUserId());
-            if(null != transerRecordDto.getUserId()){
+            queryWrapper.eq(FinTranRecord::getFromUid,userId);
+            if(null != transerRecordDto.getUserId() && transerRecordDto.getUserId().longValue() > 0){
                 queryWrapper.eq(FinTranRecord::getToUid,transerRecordDto.getUserId());
             }
         }else if(transerRecordDto.getType() == 1){
             //转入
-            queryWrapper.eq(FinTranRecord::getToUid,SecurityUtils.getUserId());
-            if(null != transerRecordDto.getUserId()){
+            queryWrapper.eq(FinTranRecord::getToUid,userId);
+            if(null != transerRecordDto.getUserId()  && transerRecordDto.getUserId().longValue() > 0){
                 queryWrapper.eq(FinTranRecord::getFromUid,transerRecordDto.getUserId());
             }
         }
         List<FinTranRecord> list = finTranRecordMapper.selectList(queryWrapper);
         return list;
     }
+
+    @DataSource(DataSourceType.SLAVE)
+    @Override
+    public List<FinTranRecord> selecListByWrapper(LambdaQueryWrapper<FinTranRecord> queryWrapper){
+        List<FinTranRecord> list = finTranRecordMapper.selectList(queryWrapper);
+        return list;
+    }
 }

+ 5 - 0
game-business/src/main/java/com/game/business/task/AppGameBettingTask.java

@@ -44,6 +44,9 @@ public class AppGameBettingTask {
     @Autowired
     private RedisCache redisCache;
 
+    @Autowired
+    private IAppUserCountService appUserCountService;
+
     @Async("asyncExecutor")
     public void gameDataTask(String message, String gameCodeFinal){
 
@@ -219,6 +222,8 @@ public class AppGameBettingTask {
             }
 
             this.gameBettingTask(appGameClassify.getId(), appGame.getId(), gameDate, gameLotterySucc);
+
+            appUserCountService.staticsUserCount(appGame.getId(),null);
         }
 
     }

+ 1 - 1
game-business/src/main/java/com/game/business/task/AppUserCountTask.java

@@ -76,7 +76,7 @@ public class AppUserCountTask {
             List<FinTranRecord> finTranRecordList = finTranRecordService.getUserRecordList(null, dateTime.concat(" 00:00:00"), dateTime.concat(" 23:59:59"));
             List<AppUserLiveDividedRecord> liveDividedRecordList = appUserLiveDividedRecordService.selectByDate(null, dateTime.concat(" 00:00:00"), dateTime.concat(" 23:59:59"));
             List<AppUserGameRecordCount> gameRecordCountList = appUserGameRecordCountService.selectByDate(null, dateTime.concat(" 00:00:00"), dateTime.concat(" 23:59:59"));
-            List<AppGameBetting> gameBettingList = appGameBettingService.selectListByDate(null, dateTime.concat(" 00:00:00"), dateTime.concat(" 23:59:59"));
+            List<AppGameBetting> gameBettingList = appGameBettingService.selectListByDate(null, dateTime.concat(" 00:00:00"), dateTime.concat(" 23:59:59"),null);
             if (null != list && list.size() > 0) {
                 List<AppUserCount> appUserCountList = new ArrayList<>();
                 String finalDateTime = dateTime;

+ 6 - 0
game-business/src/main/java/com/game/business/vo/AppAgentTeamVo.java

@@ -25,6 +25,12 @@ public class AppAgentTeamVo {
     @ApiModelProperty(value = "昵称")
     private String nickName;
 
+    @ApiModelProperty(value = "用户金币")
+    private double coin;
+
+    @ApiModelProperty(value = "用户余额")
+    private double diamondCoin;
+
     @ApiModelProperty(value = "投注金额")
     private double bettingAmount;
 

+ 38 - 10
game-business/src/main/resources/mapper/business/AppUserAgentMapper.xml

@@ -100,11 +100,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         select
             a.user_id as userId,
             c.username as nickName,
+            c.coin as coin,
+            c.diamond_coin as diamondCoin,
             a.pid as pid,
-            (select IFNULL(sum(betting_amount),0) from app_game_betting as b where b.user_id = a.user_id) as bettingAmount,
-            (select IFNULL(sum(d.game_commission),0) from app_user_count as d where d.user_id = a.user_id) as gameCommission,
-            (select IFNULL(sum(d.live_commission),0) from app_user_count as d where d.user_id = a.user_id) as liveCommission,
-            (select IFNULL(sum(e.game_win_amount - e.game_lose_amount),0) from app_user_count as e where e.user_id = a.user_id) as gameAmount,
+            (
+                select IFNULL(sum(betting_amount),0) from app_game_betting as b where b.user_id = a.user_id
+                <if test="teamDto.beginTime != null and teamDto.beginTime != ''">
+                    and <![CDATA[ b.create_time >= concat(#{teamDto.beginTime},' 00:00:00') ]]>
+                </if>
+                <if test="teamDto.endTime != null and teamDto.endTime != ''">
+                    and <![CDATA[ b.create_time <= concat(#{teamDto.endTime},' 23:59:59') ]]>
+                </if>
+             ) as bettingAmount,
+            (
+                select IFNULL(sum(d.game_commission),0) from app_user_count as d where d.user_id = a.user_id
+                <if test="teamDto.beginTime != null and teamDto.beginTime != ''">
+                    and <![CDATA[ d.str_date >= #{teamDto.beginTime} ]]>
+                </if>
+                <if test="teamDto.endTime != null and teamDto.endTime != ''">
+                    and <![CDATA[ d.str_date <= #{teamDto.endTime} ]]>
+                </if>
+            ) as gameCommission,
+            (
+                select IFNULL(sum(f.live_commission),0) from app_user_count as f where f.user_id = a.user_id
+                    <if test="teamDto.beginTime != null and teamDto.beginTime != ''">
+                        and <![CDATA[ f.str_date >= #{teamDto.beginTime} ]]>
+                    </if>
+                    <if test="teamDto.endTime != null and teamDto.endTime != ''">
+                        and <![CDATA[ f.str_date <= #{teamDto.endTime} ]]>
+                    </if>
+            ) as liveCommission,
+            (
+                select IFNULL(sum(e.game_win_amount - e.game_lose_amount),0) from app_user_count as e where e.user_id = a.user_id
+                <if test="teamDto.beginTime != null and teamDto.beginTime != ''">
+                    and <![CDATA[ e.str_date >= #{teamDto.beginTime} ]]>
+                </if>
+                <if test="teamDto.endTime != null and teamDto.endTime != ''">
+                    and <![CDATA[ e.str_date <= #{teamDto.endTime} ]]>
+                </if>
+            ) as gameAmount,
             a.live_rate as liveRate,
             a.dividend_guarantee_rate as dividendGuaranteeRate
         from app_user_agent as a left join mugozbg_live.app_user as c on a.user_id = c.userid where (a.pid = #{teamDto.pid} or a.user_id = #{teamDto.pid})
@@ -114,12 +148,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="teamDto.nickName != null and teamDto.nickName != ''">
              and c.username = #{teamDto.nickName}
         </if>
-        <if test="teamDto.beginTime != null and teamDto.beginTime != ''">
-             and <![CDATA[ a.str_date >= #{teamDto.beginTime} ]]>
-        </if>
-        <if test="teamDto.endTime != null and teamDto.endTime != ''">
-             and <![CDATA[ a.str_date <= #{teamDto.endTime} ]]>
-        </if>
     </select>
 
     <select id="selectAllAgentList" resultMap="AppUserAgentResult">