浏览代码

优化手动开奖

dos 2 月之前
父节点
当前提交
bc1c3bc7e5

+ 34 - 6
game-business/src/main/java/com/game/business/controller/AppGameLotteryController.java

@@ -19,6 +19,7 @@ import com.game.business.vo.AppGameLotteryVO;
 import com.game.business.vo.AppUserAgentVO;
 import com.game.business.vo.AppUserAgentVO;
 import com.game.common.annotation.Anonymous;
 import com.game.common.annotation.Anonymous;
 import com.game.common.annotation.Log;
 import com.game.common.annotation.Log;
+import com.game.common.annotation.RepeatSubmit;
 import com.game.common.core.controller.BaseController;
 import com.game.common.core.controller.BaseController;
 import com.game.common.core.domain.HttpRet;
 import com.game.common.core.domain.HttpRet;
 import com.game.common.core.domain.HttpRetPageArr;
 import com.game.common.core.domain.HttpRetPageArr;
@@ -182,16 +183,16 @@ public class AppGameLotteryController extends BaseController{
     @PostMapping("/addLottery")
     @PostMapping("/addLottery")
     @ApiOperation(value = "手动开奖", notes = "手动开奖")
     @ApiOperation(value = "手动开奖", notes = "手动开奖")
     @Log(title = "手动开奖", businessType = BusinessType.UPDATE)
     @Log(title = "手动开奖", businessType = BusinessType.UPDATE)
-    public HttpRet<Boolean> addLottery(@RequestBody AppGameLottery appGameLottery) throws Exception {
+    public R<Boolean> addLottery(@RequestBody AppGameLottery appGameLottery) throws Exception {
 
 
         Long userId = SecurityUtils.getUserId();
         Long userId = SecurityUtils.getUserId();
 
 
         if(userId == null){
         if(userId == null){
-            return HttpRet.fail("权限不足,请联系管理员");
+            return R.fail("权限不足,请联系管理员");
         }
         }
 
 
         if(userId != 10013 && SecurityUtils.getLoginUser().isBusUser()){ //app用户只有10013能发
         if(userId != 10013 && SecurityUtils.getLoginUser().isBusUser()){ //app用户只有10013能发
-            return HttpRet.fail("权限不足,请联系管理员");
+            return R.fail("权限不足,请联系管理员");
         }
         }
 
 
         if(StringUtils.isNotBlank(appGameLottery.getGameDate())){
         if(StringUtils.isNotBlank(appGameLottery.getGameDate())){
@@ -200,12 +201,17 @@ public class AppGameLotteryController extends BaseController{
 
 
         AppGameLottery dbAppGameLottery = appGameLotteryService.selectLottery(appGameLottery.getClassId(), appGameLottery.getGameId(), appGameLottery.getGameDate());
         AppGameLottery dbAppGameLottery = appGameLotteryService.selectLottery(appGameLottery.getClassId(), appGameLottery.getGameId(), appGameLottery.getGameDate());
         if(dbAppGameLottery != null && dbAppGameLottery.getIsLottery() == 1){
         if(dbAppGameLottery != null && dbAppGameLottery.getIsLottery() == 1){
-            return HttpRet.fail("该游戏,当前期已自动开奖过了,不能手动开奖");
+            return R.fail("该游戏,当前期已自动开奖过了,不能手动开奖");
         }
         }
 
 
         appGameLottery.setIsLottery(1);
         appGameLottery.setIsLottery(1);
         String time = DateUtil.format(new Date(),"yyyy-").concat(appGameLottery.getGameDate());
         String time = DateUtil.format(new Date(),"yyyy-").concat(appGameLottery.getGameDate());
-        appGameLottery.setGameRecordDate(DateUtil.parse(time,"yyyy-MM-dd HH:mm"));
+        if(time.split("\\:").length > 2){
+            appGameLottery.setGameRecordDate(DateUtil.parse(time,"yyyy-MM-dd HH:mm:ss"));
+        }else{
+            appGameLottery.setGameRecordDate(DateUtil.parse(time,"yyyy-MM-dd HH:mm"));
+        }
+
         boolean flg = false;
         boolean flg = false;
         if(dbAppGameLottery == null){
         if(dbAppGameLottery == null){
             flg = appGameLotteryService.save(appGameLottery);
             flg = appGameLotteryService.save(appGameLottery);
@@ -220,7 +226,18 @@ public class AppGameLotteryController extends BaseController{
         if(flg){
         if(flg){
             appGameLotteryTask.updateLottery(appGameLottery);
             appGameLotteryTask.updateLottery(appGameLottery);
         }
         }
-        return HttpRet.success("手动开奖成功",true);
+        return R.ok(true,"手动开奖成功");
+    }
+
+
+    @PostMapping("/leakLottery")
+    @ApiOperation(value = "修补数据", notes = "修补数据")
+    @Log(title = "修补数据", businessType = BusinessType.UPDATE)
+    @RepeatSubmit(message = "频繁操作,请稍后再试")
+    public R leakLottery() throws Exception {
+
+        appGameLotteryService.leakLottery();
+        return R.ok(true,"修补数据成功");
     }
     }
 
 
     /**
     /**
@@ -250,6 +267,17 @@ public class AppGameLotteryController extends BaseController{
         util.exportExcel(response, list, "游戏开奖记录数据");
         util.exportExcel(response, list, "游戏开奖记录数据");
     }
     }
 
 
+    /**
+     * 获取游戏开奖记录详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('business:lottery:query')")
+    @GetMapping(value = "/lotteryInfo/{id}")
+    @ApiOperation(value = "查询漏奖数据", notes = "查询漏奖数据")
+    public R<AppGameLottery> lotteryInfo(@PathVariable("id") Long id)
+    {
+        return R.ok(appGameLotteryService.leakInfo(id));
+    }
+
     /**
     /**
      * 获取游戏开奖记录详细信息
      * 获取游戏开奖记录详细信息
      */
      */

+ 11 - 0
game-business/src/main/java/com/game/business/mapper/AppGameLotteryMapper.java

@@ -2,6 +2,7 @@ package com.game.business.mapper;
 
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.game.business.domain.AppGameLottery;
 import com.game.business.domain.AppGameLottery;
+import org.apache.ibatis.annotations.Param;
 
 
 import java.util.List;
 import java.util.List;
 
 
@@ -55,4 +56,14 @@ public interface AppGameLotteryMapper extends BaseMapper<AppGameLottery> {
      */
      */
     public int deleteAppGameLotteryByIds(Long[] ids);
     public int deleteAppGameLotteryByIds(Long[] ids);
 
 
+    /**
+     * 查询遗漏数据
+     * */
+    public List<AppGameLottery> selectLeakLottery(@Param("time") String time);
+
+    /**
+     * 查询遗漏数据
+     * */
+    public AppGameLottery leakInfo(@Param("gameId") Long gameId, @Param("gameDate") String gameDate);
+
 }
 }

+ 10 - 0
game-business/src/main/java/com/game/business/service/IAppGameLotteryService.java

@@ -65,4 +65,14 @@ public interface IAppGameLotteryService extends IService<AppGameLottery> {
      * @return 结果
      * @return 结果
      */
      */
     public int deleteAppGameLotteryById(Long id);
     public int deleteAppGameLotteryById(Long id);
+
+    /**
+     * 自动修改遗漏数据
+     * */
+    public void leakLottery();
+
+    /**
+     * 查询漏奖数据
+     * */
+    public AppGameLottery leakInfo(Long id);
 }
 }

+ 42 - 0
game-business/src/main/java/com/game/business/service/impl/AppGameLotteryServiceImpl.java

@@ -1,13 +1,17 @@
 package com.game.business.service.impl;
 package com.game.business.service.impl;
 
 
+import cn.hutool.core.date.DateUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.game.business.domain.AppGameLottery;
 import com.game.business.domain.AppGameLottery;
 import com.game.business.mapper.AppGameLotteryMapper;
 import com.game.business.mapper.AppGameLotteryMapper;
 import com.game.business.service.IAppGameLotteryService;
 import com.game.business.service.IAppGameLotteryService;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
+import java.util.Date;
 
 
 import java.util.List;
 import java.util.List;
 
 
@@ -116,4 +120,42 @@ public class AppGameLotteryServiceImpl extends ServiceImpl<AppGameLotteryMapper,
     public int deleteAppGameLotteryById(Long id) {
     public int deleteAppGameLotteryById(Long id) {
         return appGameLotteryMapper.deleteAppGameLotteryById(id);
         return appGameLotteryMapper.deleteAppGameLotteryById(id);
     }
     }
+
+    @Override
+    public void leakLottery() {
+        String time = DateUtil.format(DateUtil.offsetMinute(new Date(), -5),"yyyy-MM-dd HH:mm:ss");
+        List<AppGameLottery> list = appGameLotteryMapper.selectLeakLottery(time);
+        if(null != list && list.size() > 0) {
+            list.forEach(e->{
+                if(null != e.getGameId() && StringUtils.isNotBlank( e.getGameDate())){
+                    LambdaQueryWrapper<AppGameLottery> queryWrapper = new LambdaQueryWrapper<>();
+                    queryWrapper.eq(AppGameLottery::getGameId, e.getGameId());
+                    queryWrapper.eq(AppGameLottery::getGameDate, e.getGameDate());
+                    if(null == appGameLotteryMapper.selectOne(queryWrapper)){
+                        AppGameLottery insert = new AppGameLottery();
+                        BeanUtils.copyProperties(e,insert);
+                        insert.setId(null);
+                        insert.setIsLottery(0);//设置为未开奖
+                        insertAppGameLottery(insert);
+                    }
+                }
+            });
+        }
+    }
+
+    @Override
+    public AppGameLottery leakInfo(Long id) {
+        AppGameLottery reslut = null;
+        AppGameLottery appGameLottery = selectAppGameLotteryById(id);
+        if(null == appGameLottery){
+            return reslut;
+        }
+        reslut = new AppGameLottery();
+        BeanUtils.copyProperties(appGameLottery,reslut);
+        AppGameLottery history = appGameLotteryMapper.leakInfo(reslut.getGameId(),reslut.getGameDate());
+        if(null != history){
+            reslut.setGameLotterySucc(history.getGameLotterySucc());
+        }
+        return reslut;
+    }
 }
 }

+ 12 - 0
game-business/src/main/resources/mapper/business/AppGameLotteryMapper.xml

@@ -79,4 +79,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{id}
             #{id}
         </foreach>
         </foreach>
     </delete>
     </delete>
+
+    <select id="selectLeakLottery" resultMap="AppGameLotteryResult">
+        select * from app_game_lottery_history
+                 where is_lottery != 0
+                 and  CONCAT(game_id,'_',game_date) in (select CONCAT(game_id,'_',game_date) from app_game_lottery where is_lottery = 0)
+                 and game_record_date &lt;= #{time}
+    </select>
+
+    <select id="leakInfo" resultMap="AppGameLotteryResult">
+        select * from app_game_lottery_history
+                 where game_id = #{gameId} and game_date = #{gameDate}
+    </select>
 </mapper>
 </mapper>

+ 16 - 0
game-ui/src/api/business/lottery.js

@@ -26,6 +26,14 @@ export function getLottery(id) {
   })
   })
 }
 }
 
 
+// 查询游戏开奖记录详细
+export function lotteryInfo(id) {
+  return request({
+    url: '/business/lottery/lotteryInfo/' + id,
+    method: 'get'
+  })
+}
+
 // 新增游戏开奖记录
 // 新增游戏开奖记录
 export function addLottery(data) {
 export function addLottery(data) {
   return request({
   return request({
@@ -44,6 +52,14 @@ export function kjLottery(data) {
   })
   })
 }
 }
 
 
+// 修补数据
+export function leakLottery() {
+  return request({
+    url: '/business/lottery/leakLottery',
+    method: 'post'
+  })
+}
+
 // 修改游戏开奖记录
 // 修改游戏开奖记录
 export function updateLottery(data) {
 export function updateLottery(data) {
   return request({
   return request({

+ 69 - 4
game-ui/src/views/business/lottery/index.vue

@@ -63,6 +63,15 @@
           @click="handleKj"
           @click="handleKj"
         >手动开奖</el-button>
         >手动开奖</el-button>
       </el-col>
       </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handLeakLottery"
+        >修补开奖数据(10分钟之前的数据)</el-button>
+      </el-col>
       <el-col :span="1.5">
       <el-col :span="1.5">
         <el-button
         <el-button
           type="primary"
           type="primary"
@@ -140,6 +149,12 @@
       </el-table-column>
       </el-table-column>
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
         <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleLeakInfo(scope.row)"
+          >开奖</el-button>
           <el-button
           <el-button
             size="mini"
             size="mini"
             type="text"
             type="text"
@@ -278,7 +293,7 @@
 </template>
 </template>
 
 
 <script>
 <script>
-import { listLottery, getLottery, delLottery, addLottery, updateLottery,allList,kjLottery } from "@/api/business/lottery";
+import { listLottery, getLottery, delLottery, addLottery, updateLottery,allList,kjLottery,leakLottery,lotteryInfo } from "@/api/business/lottery";
 
 
 import {allGameList } from "@/api/business/game_item";
 import {allGameList } from "@/api/business/game_item";
 
 
@@ -430,12 +445,14 @@ export default {
       that.kjForm.gameLotterySucc = null;
       that.kjForm.gameLotterySucc = null;
       for(var i in that.gameItemList){
       for(var i in that.gameItemList){
         var item = that.gameItemList[i];
         var item = that.gameItemList[i];
-        console.log(item["value"],val)
         if(item["gameId"] == val){
         if(item["gameId"] == val){
+
           that.kjGameItemList.push({
           that.kjGameItemList.push({
             value:item["value"].split("_")[0],
             value:item["value"].split("_")[0],
             label:item["label"],
             label:item["label"],
-            gameId:item["gameId"]
+            gameId:item["gameId"],
+            isLottery: item["isLottery"],
+
           });
           });
         }
         }
       }
       }
@@ -532,6 +549,27 @@ export default {
       this.kjOpen = true;
       this.kjOpen = true;
       this.title = "手动开奖";
       this.title = "手动开奖";
     },
     },
+    /** 新增按钮操作 */
+    handLeakLottery() {
+      this.$confirm('是否开始修补10分钟之前的开奖数据', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        /*this.$message({
+          type: 'success',
+          message: '删除成功!'
+        });*/
+        leakLottery().then(()=>{
+          this.$message({
+            type: 'success',
+            message: '修补成功!'
+          });
+        })
+      }).catch(() => {
+
+      });
+    },
     /** 修改按钮操作 */
     /** 修改按钮操作 */
     handleUpdate(row) {
     handleUpdate(row) {
       this.reset();
       this.reset();
@@ -542,6 +580,33 @@ export default {
         this.title = "修改游戏开奖记录";
         this.title = "修改游戏开奖记录";
       });
       });
     },
     },
+    /** 修改按钮操作 */
+    handleLeakInfo(row) {
+      this.reset();
+      const id = row.id || this.ids
+      lotteryInfo(id).then(response => {
+        let item = response.data;
+        this.resetKj();
+        this.changeClass(item.classId);
+        this.changeGame(item.gameId)
+        let arr = [];
+        if(undefined != item["gameLotterySucc"] && null != item["gameLotterySucc"] && "" != item["gameLotterySucc"]){
+          let gameLotterySucc = item["gameLotterySucc"].split(",");
+          for(var i in gameLotterySucc){
+            arr.push(gameLotterySucc[i]);
+          }
+        }
+        this.kjForm = {
+          classId: item.classId,
+          gameId: item.gameId,
+          gameDate: item.gameDate,
+          isLottery:"1",
+          gameLotterySuccItem:arr
+        }
+        this.kjOpen = true;
+        this.title = "手动开奖";
+      });
+    },
     /** 提交按钮 */
     /** 提交按钮 */
     submitForm() {
     submitForm() {
       this.$refs["form"].validate(valid => {
       this.$refs["form"].validate(valid => {
@@ -575,7 +640,7 @@ export default {
           }
           }
           kjLottery(this.kjForm).then(response => {
           kjLottery(this.kjForm).then(response => {
                 this.$modal.msgSuccess(response.msg);
                 this.$modal.msgSuccess(response.msg);
-                this.open = false;
+                this.kjOpen = false;
                 this.getList();
                 this.getList();
 
 
             });
             });