小程序端接口实现
This commit is contained in:
parent
8f3c781183
commit
0ebce622dd
12
pom.xml
12
pom.xml
@ -44,6 +44,12 @@
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- SpringBoot Websocket -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||
<version>2.2.13.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<!-- rabbitmq -->
|
||||
<dependency>
|
||||
@ -282,8 +288,12 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
|
@ -3,12 +3,14 @@ package com.ruoyi;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
/**
|
||||
* 启动程序
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@EnableScheduling
|
||||
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
||||
public class RuoYiApplication
|
||||
{
|
||||
|
@ -113,6 +113,10 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
|
||||
.antMatchers("/webjars/**").anonymous()
|
||||
.antMatchers("/*/api-docs").anonymous()
|
||||
.antMatchers("/druid/**").anonymous()
|
||||
.antMatchers("/echo/*").anonymous()
|
||||
.antMatchers("/echo").anonymous()
|
||||
//便于接口测试,允许请求跳过认证
|
||||
.antMatchers("/hit/**").permitAll()
|
||||
// 除上面外的所有请求全部需要鉴权认证
|
||||
.anyRequest().authenticated()
|
||||
.and()
|
||||
|
@ -1,8 +1,16 @@
|
||||
package com.ruoyi.framework.task;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.ruoyi.project.hit.util.Util1;
|
||||
import com.ruoyi.project.hit.util.webSocket.WsServerEndpoint;
|
||||
import org.springframework.stereotype.Component;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
|
||||
import javax.websocket.EndpointConfig;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 定时任务调度测试
|
||||
*
|
||||
@ -25,4 +33,41 @@ public class RyTask
|
||||
{
|
||||
System.out.println("执行无参方法");
|
||||
}
|
||||
|
||||
public void reportCurrentTime1() {
|
||||
System.out.println("11");
|
||||
|
||||
WsServerEndpoint wsServerEndpoint=new WsServerEndpoint();
|
||||
try {
|
||||
// wsServerEndpoint.onOpen(wsServerEndpointMap.get("id"),wsServerEndpointMap.get("session"));
|
||||
wsServerEndpoint.sendMessage("jsonString");
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
/*long l = System.currentTimeMillis();
|
||||
Map<Integer, Long> upsMap = Util1.upsMap;
|
||||
for (Map.Entry<Integer, Long> entry : upsMap.entrySet()) {
|
||||
if(l-entry.getValue()>=30000){
|
||||
System.out.println(entry.getKey());
|
||||
WsServerEndpoint wsServerEndpoint=new WsServerEndpoint();
|
||||
Map<String,Object> map=new HashMap<>();
|
||||
map.put("id",1);
|
||||
map.put("msg","111");
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
String jsonString = objectMapper.writeValueAsString(map);
|
||||
wsServerEndpoint.sendMessage(jsonString);
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
@ -1,100 +0,0 @@
|
||||
package com.ruoyi.project.hit.controller;
|
||||
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
import com.ruoyi.project.hit.controller.vo.ListCardGameVo;
|
||||
import com.ruoyi.project.hit.controller.vo.ListCardProductVo;
|
||||
import com.ruoyi.project.hit.domain.CardGame;
|
||||
import com.ruoyi.project.hit.domain.CardProduct;
|
||||
import com.ruoyi.project.hit.service.CardGameService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/*
|
||||
活动管理
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/hit/game")
|
||||
public class CardGameController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private CardGameService cardGameService;
|
||||
|
||||
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ListCardGameVo listCardGameVo)
|
||||
{
|
||||
System.out.println("111");
|
||||
startPage();
|
||||
List<HashMap> list = cardGameService.selectCardGameList(listCardGameVo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增活动
|
||||
* @param cardGame
|
||||
* @return
|
||||
*/
|
||||
@PostMapping
|
||||
public AjaxResult addCardGame(@RequestBody CardGame cardGame)
|
||||
{
|
||||
cardGameService.addCardGame(cardGame);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询活动
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public AjaxResult getCardGameById(@PathVariable("id") Integer id)
|
||||
{
|
||||
//多条数据集合
|
||||
Map<String, Object> data = cardGameService.getCardGameDataById(id);
|
||||
return AjaxResult.success("查询成功",data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改活动
|
||||
* @param cardGame
|
||||
* @return
|
||||
*/
|
||||
@PutMapping
|
||||
public AjaxResult updateCardGame(@RequestBody CardGame cardGame)
|
||||
{
|
||||
return toAjax(cardGameService.updateCardGame(cardGame));
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
public AjaxResult deleteCardGameById(@PathVariable("id") Integer id)
|
||||
{
|
||||
return toAjax(cardGameService.deleteCardGameById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 活动详情接口
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/detail/{gameid}")
|
||||
public AjaxResult getCardGameDetailById(@PathVariable("gameid") Integer id)
|
||||
{
|
||||
//多条数据集合
|
||||
Map<String, Object> data = cardGameService.getCardGameDetailById(id);
|
||||
return AjaxResult.success("查询成功",data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
package com.ruoyi.project.hit.controller;
|
||||
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
import com.ruoyi.project.hit.domain.CardGameProduct;
|
||||
import com.ruoyi.project.hit.service.CardGameProductService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/*
|
||||
活动奖品配置
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/hit/game_product")
|
||||
public class CardGameProductController extends BaseController {
|
||||
@Autowired
|
||||
private CardGameProductService cardGameProductService;
|
||||
|
||||
/**
|
||||
* 活动奖品配置
|
||||
* @param cardGameProduct
|
||||
* @return
|
||||
*/
|
||||
@PostMapping
|
||||
public AjaxResult configGameProduct(@RequestBody CardGameProduct cardGameProduct)
|
||||
{
|
||||
return toAjax(cardGameProductService.configGameProduct(cardGameProduct));
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
public AjaxResult deleteGameProduct(@PathVariable("id") Integer id)
|
||||
{
|
||||
cardGameProductService.deleteGameProduct(id);
|
||||
return AjaxResult.success("删除成功",null);
|
||||
}
|
||||
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
package com.ruoyi.project.hit.controller;
|
||||
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
import com.ruoyi.project.hit.domain.CardGameProduct;
|
||||
import com.ruoyi.project.hit.domain.CardGameRule;
|
||||
import com.ruoyi.project.hit.service.CardGameRuleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/*
|
||||
活动奖品配置
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/hit/game_rule")
|
||||
public class CardGameRuleController extends BaseController {
|
||||
@Autowired
|
||||
private CardGameRuleService cardGameRuleService;
|
||||
|
||||
|
||||
/**
|
||||
* 中奖策略配置接口
|
||||
* @param cardGameRule
|
||||
* @return
|
||||
*/
|
||||
@PostMapping
|
||||
public AjaxResult configGameRule(@RequestBody CardGameRule cardGameRule)
|
||||
{
|
||||
return toAjax(cardGameRuleService.configGameRule(cardGameRule));
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
public AjaxResult deleteGameProduct(@PathVariable("id") Integer id)
|
||||
{
|
||||
cardGameRuleService.deleteGameRule(id);
|
||||
return AjaxResult.success("删除成功",null);
|
||||
}
|
||||
|
||||
}
|
@ -1,201 +0,0 @@
|
||||
package com.ruoyi.project.hit.controller;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.support.ExcelTypeEnum;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.ruoyi.common.exception.CustomException;
|
||||
import com.ruoyi.common.utils.ServletUtils;
|
||||
import com.ruoyi.common.utils.http.HttpHelper;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
||||
import com.ruoyi.framework.security.LoginUser;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
import com.ruoyi.project.hit.controller.vo.ExcelCardProductVo;
|
||||
import com.ruoyi.project.hit.controller.vo.ListCardProductVo;
|
||||
import com.ruoyi.project.hit.controller.vo.ListCardUserVo;
|
||||
import com.ruoyi.project.hit.domain.CardProduct;
|
||||
import com.ruoyi.project.hit.service.CardProductService;
|
||||
import com.ruoyi.project.system.domain.SysUser;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/hit/product")
|
||||
@Api(tags = "EasyExcel")
|
||||
public class CardProductController extends BaseController {
|
||||
@Autowired
|
||||
private CardProductService cardProductService;
|
||||
|
||||
|
||||
/**
|
||||
* 获取奖品列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ListCardProductVo listCardProductVo)
|
||||
{
|
||||
startPage();
|
||||
List<CardProduct> list = cardProductService.selectCardProductList(listCardProductVo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询奖品
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public AjaxResult getProductById(@PathVariable Integer id)
|
||||
{
|
||||
return AjaxResult.success(cardProductService.getProductById(id));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 修改奖品列表
|
||||
*/
|
||||
@PutMapping
|
||||
public AjaxResult updateProduct(@RequestBody CardProduct cardProduct)
|
||||
{
|
||||
cardProductService.updateProduct(cardProduct);
|
||||
return AjaxResult.success("修改成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除奖品
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
public AjaxResult deleteProduct(@PathVariable Integer id)
|
||||
{
|
||||
return toAjax(cardProductService.deleteProduct(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增奖品
|
||||
* @param cardProduct
|
||||
* @return
|
||||
*/
|
||||
@PostMapping
|
||||
public AjaxResult addProduct(@RequestBody CardProduct cardProduct)
|
||||
{
|
||||
return toAjax(cardProductService.addProduct(cardProduct));
|
||||
}
|
||||
|
||||
/**
|
||||
* 奖品列表显示
|
||||
* @return 奖品列表
|
||||
*/
|
||||
@GetMapping("/select")
|
||||
public AjaxResult select()
|
||||
{
|
||||
List<Map<String,Object>> list=cardProductService.select();
|
||||
return AjaxResult.success("查询成功",list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 奖品列表导入接口
|
||||
* @param file
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Log(title = "奖品管理", businessType = BusinessType.IMPORT)
|
||||
// @PreAuthorize("@ss.hasPermi('system:user:import')")
|
||||
@PostMapping("/uploadExcel")
|
||||
public AjaxResult importData(@RequestPart(value = "myExcel") MultipartFile file) throws Exception
|
||||
{
|
||||
try {
|
||||
List<CardProduct> cardProducts = EasyExcel.read(file.getInputStream())
|
||||
.head(CardProduct.class)
|
||||
.sheet()
|
||||
.doReadSync();
|
||||
if(cardProducts.size()==0){
|
||||
throw new CustomException("导入失败,excel表空数据");
|
||||
}
|
||||
|
||||
boolean b = cardProductService.saveBatch(cardProducts);
|
||||
if(b){
|
||||
return AjaxResult.success(null);
|
||||
}else {
|
||||
throw new CustomException("导入失败,存在错误数据");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*excel表导出
|
||||
* @param ids
|
||||
*/
|
||||
@PostMapping("/export")
|
||||
public AjaxResult export(@RequestBody List<Integer> ids,HttpServletResponse response){
|
||||
if(ids.isEmpty()){
|
||||
throw new CustomException("未选择要导出的数据");
|
||||
}
|
||||
// List<CardProduct> cardProducts = cardProductService.listByIds(ids);
|
||||
// String s1=exportUserExcel(cardProducts,response);
|
||||
// response.reset();
|
||||
// AjaxResult result =AjaxResult.success(s1);
|
||||
// String json = JSON.toJSONString(result);
|
||||
// ServletUtils.renderString(response, json);
|
||||
String s1="";
|
||||
try {
|
||||
List<CardProduct> cardProducts = cardProductService.listByIds(ids);
|
||||
s1=exportUserExcel(cardProducts,response);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
response.reset();
|
||||
AjaxResult result = AjaxResult.error(e.getMessage());
|
||||
String json = JSON.toJSONString(result);
|
||||
HttpHelper.renderString(response, json);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String exportUserExcel(List<CardProduct> cardProducts,HttpServletResponse response)throws Exception {
|
||||
String s1="";
|
||||
|
||||
s1 ="product_" +this.setExcelResponseProp(response, "奖品列表");
|
||||
EasyExcel.write(response.getOutputStream())
|
||||
.head(CardProduct.class)
|
||||
.excelType(ExcelTypeEnum.XLSX)
|
||||
.sheet("奖品列表")
|
||||
.doWrite(cardProducts);;
|
||||
return s1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置响应结果
|
||||
*
|
||||
* @param response 响应结果对象
|
||||
* @param rawFileName 文件名
|
||||
*@throws UnsupportedEncodingException 不支持编码异常
|
||||
*/
|
||||
private String setExcelResponseProp(HttpServletResponse response, String rawFileName) throws UnsupportedEncodingException {
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
String fileName = new Date().toString();
|
||||
|
||||
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
|
||||
return fileName;
|
||||
}
|
||||
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
package com.ruoyi.project.hit.controller;
|
||||
|
||||
|
||||
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
import com.ruoyi.project.hit.controller.vo.ListCardUserVo;
|
||||
import com.ruoyi.project.hit.domain.CardUser;
|
||||
import com.ruoyi.project.hit.domain.SystemDict;
|
||||
import com.ruoyi.project.hit.service.CardUserService;
|
||||
import com.ruoyi.project.hit.service.SystemDictService;
|
||||
import com.ruoyi.project.system.domain.SysPost;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/hit/card")
|
||||
public class CardUserController extends BaseController {
|
||||
@Autowired
|
||||
private CardUserService cardUserService;
|
||||
/**
|
||||
* 获取會員列表
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:dict:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ListCardUserVo listCardUserVo)
|
||||
{
|
||||
startPage();
|
||||
List<HashMap> list = cardUserService.selectCardUserList(listCardUserVo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,60 +0,0 @@
|
||||
package com.ruoyi.project.hit.controller;
|
||||
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
import com.ruoyi.project.hit.controller.vo.ListCardProductVo;
|
||||
import com.ruoyi.project.hit.controller.vo.ListInfoVo;
|
||||
import com.ruoyi.project.hit.controller.vo.TotalInfoVo;
|
||||
import com.ruoyi.project.hit.domain.CardGame;
|
||||
import com.ruoyi.project.hit.domain.CardProduct;
|
||||
import com.ruoyi.project.hit.service.CardGameService;
|
||||
import com.ruoyi.project.hit.service.CardUserHitService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
/*
|
||||
信息管理
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/hit/info")
|
||||
public class InfoController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private CardUserHitService cardUserHitService;
|
||||
|
||||
/**
|
||||
* 中奖统计列表显示
|
||||
* @param totalInfoVo 中奖统计列表显示的参数
|
||||
* @return 中奖统计列表
|
||||
*/
|
||||
@GetMapping("/total")
|
||||
public TableDataInfo info(TotalInfoVo totalInfoVo)
|
||||
{
|
||||
startPage();
|
||||
List<HashMap> list = cardUserHitService.selectCardUserHitInfo(totalInfoVo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 中奖统计详情显示
|
||||
* @param gameid 活动id
|
||||
* @return 活动中奖详情
|
||||
*/
|
||||
@GetMapping("/{gameid}")
|
||||
public AjaxResult getInfo(@PathVariable Integer gameid)
|
||||
{
|
||||
return AjaxResult.success(cardUserHitService.selectCardUserHitInfoByGameId(gameid));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ListInfoVo listInfoVo)
|
||||
{
|
||||
startPage();
|
||||
List<HashMap> list = cardUserHitService.selectCardUserHitList(listInfoVo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package com.ruoyi.project.hit.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
import com.ruoyi.project.hit.domain.PupuUpsHistory;
|
||||
import com.ruoyi.project.hit.service.PupuUpsHistoryService;
|
||||
import com.ruoyi.project.hit.util.Util1;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/hit/history")
|
||||
public class PupuUpsHistoryController extends BaseController {
|
||||
@Autowired
|
||||
private PupuUpsHistoryService pupuUpsHistoryService;
|
||||
@Autowired
|
||||
private RedisTemplate redisTemplate;
|
||||
|
||||
/**
|
||||
* 历史记录新增
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/add")
|
||||
public AjaxResult add() throws IOException {
|
||||
String data = Util1.getdetail();
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
Map<String, Object> map=new HashMap<>();
|
||||
try {
|
||||
map = mapper.readValue(data, Map.class);
|
||||
// System.out.println(map);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
ArrayList<Map<String,Object>> list = (ArrayList<Map<String,Object>>) map.get("data");
|
||||
|
||||
ArrayList<PupuUpsHistory> newList=new ArrayList<>();
|
||||
|
||||
for (Map<String, Object> stringObjectMap : list) {
|
||||
if(stringObjectMap.size()==6){
|
||||
PupuUpsHistory historyFromMap = Util1.getHistoryFromMap(stringObjectMap);
|
||||
newList.add(historyFromMap);
|
||||
String jsonTime= JSONArray.toJSONString(historyFromMap.getTime());
|
||||
redisTemplate.opsForValue().set("ups:"+historyFromMap.getUpsId(),jsonTime,5, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
}
|
||||
boolean b = pupuUpsHistoryService.saveBatch(newList);
|
||||
return AjaxResult.success(b);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package com.ruoyi.project.hit.controller;
|
||||
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
import com.ruoyi.project.hit.domain.PupuUser;
|
||||
import com.ruoyi.project.hit.domain.vo.UserLoginVO;
|
||||
import com.ruoyi.project.hit.service.PupuUserService;
|
||||
import com.ruoyi.project.hit.util.webSocket.WsServerEndpoint;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/hit/user")
|
||||
public class PupuUserController extends BaseController {
|
||||
@Autowired
|
||||
private PupuUserService pupuUserService;
|
||||
|
||||
@Autowired
|
||||
private WsServerEndpoint wsServerEndpoint;
|
||||
@PostMapping("/login")
|
||||
public AjaxResult login(@RequestBody UserLoginVO userLoginVO){
|
||||
PupuUser loginer = pupuUserService.login(userLoginVO);
|
||||
if(loginer!=null){
|
||||
return AjaxResult.success(loginer);
|
||||
}else {
|
||||
return AjaxResult.error("账号或密码错误");
|
||||
}
|
||||
}
|
||||
@PostMapping("/register")
|
||||
public AjaxResult register(@Validated @RequestBody PupuUser pupuUser){
|
||||
return toAjax(pupuUserService.register(pupuUser));
|
||||
}
|
||||
@GetMapping("/aa")
|
||||
public void aa() throws Exception {
|
||||
wsServerEndpoint.sendAllUser("67");
|
||||
}
|
||||
|
||||
}
|
@ -1,113 +0,0 @@
|
||||
package com.ruoyi.project.hit.controller;
|
||||
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
import com.ruoyi.project.hit.domain.SystemDict;
|
||||
import com.ruoyi.project.hit.service.SystemDictService;
|
||||
import com.ruoyi.project.system.domain.SysPost;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/hit/dict")
|
||||
public class SystemDictController extends BaseController {
|
||||
@Autowired
|
||||
private SystemDictService systemDictService;
|
||||
/**
|
||||
* 获取會員等級列表
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:dict:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SystemDict dict)
|
||||
{
|
||||
startPage();
|
||||
List<SystemDict> list = systemDictService.selectSystemDictList(dict);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增会员等级
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:dict:add')")
|
||||
@Log(title = "会员等级管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SystemDict dict)
|
||||
{
|
||||
if (UserConstants.NOT_UNIQUE.equals(systemDictService.checkDictValueUnique(dict)))
|
||||
{
|
||||
return AjaxResult.error("新增会员等级'" + dict.getDictValue() + "'失败,会员等级名称已存在");
|
||||
}
|
||||
else if (UserConstants.NOT_UNIQUE.equals(systemDictService.checkDictKeyUnique(dict)))
|
||||
{
|
||||
return AjaxResult.error("新增会员等级'" + dict.getDictKey() + "'失败,会员等级代号已存在");
|
||||
}
|
||||
// dict.setCreateBy(SecurityUtils.getUsername());
|
||||
return toAjax(systemDictService.insertDict(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除会员等级
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:post:remove')")
|
||||
@Log(title = "会员等级管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{id}")
|
||||
public AjaxResult remove(@PathVariable Integer id)
|
||||
{
|
||||
System.out.println("111");
|
||||
return toAjax(systemDictService.deleteDictById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据会员等级编号获取详细信息
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:post:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable Long id)
|
||||
{
|
||||
return AjaxResult.success(systemDictService.selectDictById(id));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改会员等级
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:post:edit')")
|
||||
@Log(title = "会员等级管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SystemDict dict)
|
||||
{
|
||||
if (UserConstants.NOT_UNIQUE.equals(systemDictService.checkDictValueUnique(dict)))
|
||||
{
|
||||
return AjaxResult.error("修改会员等级'" + dict.getDictValue() + "'失败,会员等级名称已存在");
|
||||
}
|
||||
else if (UserConstants.NOT_UNIQUE.equals(systemDictService.checkDictKeyUnique(dict)))
|
||||
{
|
||||
return AjaxResult.error("修改会员等级'" + dict.getDictKey() + "'失败,会员等级代号已存在");
|
||||
}
|
||||
|
||||
return toAjax(systemDictService.updateDict(dict));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 会员等级列表显示接口(填充下拉框)
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:post:query')")
|
||||
@GetMapping(value = "/selectOption/{type}")
|
||||
public AjaxResult selectOption(@PathVariable Integer type)
|
||||
{
|
||||
return AjaxResult.success(systemDictService.selectOption(type));
|
||||
}
|
||||
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
package com.ruoyi.project.hit.controller.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.annotation.format.NumberFormat;
|
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ExcelCardProductVo {
|
||||
@ExcelProperty("奖品名称")
|
||||
@ColumnWidth(20)
|
||||
private String pname;
|
||||
|
||||
@ExcelProperty("图片url路径")
|
||||
@ColumnWidth(20)
|
||||
private String pic;
|
||||
|
||||
@ExcelProperty("奖品简介")
|
||||
@ColumnWidth(20)
|
||||
private String content;
|
||||
|
||||
@ExcelProperty("奖品市场价")
|
||||
@NumberFormat("#.##")
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal price;
|
||||
|
||||
@ExcelProperty("逻辑删除字段0:正常 1:已删除")
|
||||
@ColumnWidth(20)
|
||||
private Integer delState;
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
package com.ruoyi.project.hit.controller.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
/**
|
||||
* 封装活动列表显示的参数
|
||||
*/
|
||||
public class ListCardGameVo {
|
||||
|
||||
private String title;
|
||||
|
||||
private Date startTime;
|
||||
|
||||
private Date endTime;
|
||||
|
||||
private Integer type;
|
||||
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package com.ruoyi.project.hit.controller.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ListCardProductVo {
|
||||
private String pname;
|
||||
|
||||
private double priceLow;
|
||||
|
||||
private double priceHigh;
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
package com.ruoyi.project.hit.controller.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/*
|
||||
封装会员信息的查询条件
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ListCardUserVo {
|
||||
|
||||
private String userName;
|
||||
|
||||
private String realname;
|
||||
|
||||
private String idCard;
|
||||
|
||||
private String phone;
|
||||
|
||||
private Integer level;
|
||||
|
||||
private Date startTime;
|
||||
|
||||
private Date endTime;
|
||||
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
package com.ruoyi.project.hit.controller.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ListInfoVo {
|
||||
private String title;
|
||||
|
||||
private String username;
|
||||
|
||||
private String phone;
|
||||
|
||||
private String pname;
|
||||
|
||||
private Date startTime;
|
||||
|
||||
private Date endTime;
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
package com.ruoyi.project.hit.controller.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
/**
|
||||
* 封装中奖统计列表显示的参数
|
||||
*/
|
||||
public class TotalInfoVo {
|
||||
|
||||
private String title;
|
||||
|
||||
private Date startTime;
|
||||
|
||||
private Date endTime;
|
||||
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
package com.ruoyi.project.hit.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @TableName card_game
|
||||
*/
|
||||
@TableName(value ="card_game")
|
||||
@Data
|
||||
public class CardGame implements Serializable {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private String title;
|
||||
|
||||
private String pic;
|
||||
|
||||
private String content;
|
||||
|
||||
private Date startTime;
|
||||
|
||||
private Date endTime;
|
||||
|
||||
private Integer type;
|
||||
|
||||
private Integer status;
|
||||
|
||||
//自动填充时间
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private Date updateTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
package com.ruoyi.project.hit.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 java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @TableName card_game_product
|
||||
*/
|
||||
@TableName(value ="card_game_product")
|
||||
@Data
|
||||
public class CardGameProduct implements Serializable {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private Integer gameid;
|
||||
|
||||
private Integer productid;
|
||||
|
||||
private Integer amount;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
package com.ruoyi.project.hit.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 java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @TableName card_game_rule
|
||||
*/
|
||||
@TableName(value ="card_game_rule")
|
||||
@Data
|
||||
public class CardGameRule implements Serializable {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private Integer gameid;
|
||||
|
||||
private Integer levelid;
|
||||
|
||||
private Integer enterCount;
|
||||
|
||||
private Integer hitCount;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
package com.ruoyi.project.hit.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 java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @TableName card_game_user
|
||||
*/
|
||||
@TableName(value ="card_game_user")
|
||||
@Data
|
||||
|
||||
public class CardGameUser implements Serializable {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private Integer userid;
|
||||
|
||||
private Integer gameid;
|
||||
|
||||
private Date createtime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public CardGameUser(Integer userid, Integer gameid, Date createtime) {
|
||||
this.userid = userid;
|
||||
this.gameid = gameid;
|
||||
this.createtime = createtime;
|
||||
}
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
package com.ruoyi.project.hit.domain;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.annotation.format.NumberFormat;
|
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||
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 java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @TableName card_product
|
||||
*/
|
||||
@TableName(value ="card_product")
|
||||
@Data
|
||||
public class CardProduct implements Serializable {
|
||||
@TableId(type = IdType.AUTO)
|
||||
@ExcelIgnore
|
||||
private Integer id;
|
||||
|
||||
@ExcelProperty("奖品名称")
|
||||
@ColumnWidth(20)
|
||||
private String pname;
|
||||
|
||||
@ExcelProperty("图片url路径")
|
||||
@ColumnWidth(20)
|
||||
private String pic;
|
||||
|
||||
@ExcelProperty("奖品简介")
|
||||
@ColumnWidth(20)
|
||||
private String content;
|
||||
|
||||
@ExcelProperty("奖品市场价")
|
||||
@NumberFormat("#.##")
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal price;
|
||||
|
||||
@ExcelProperty("逻辑删除字段0:正常 1:已删除")
|
||||
@ColumnWidth(20)
|
||||
private Integer delState;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
package com.ruoyi.project.hit.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @TableName card_user
|
||||
*/
|
||||
@TableName(value ="card_user")
|
||||
@Data
|
||||
public class CardUser implements Serializable {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@NotEmpty(message = "账号不能为空")
|
||||
private String userName;
|
||||
|
||||
@NotEmpty(message = "密码不能为空")
|
||||
private String userPass;
|
||||
|
||||
private String pic;
|
||||
|
||||
@NotEmpty(message = "真实姓名不能为空")
|
||||
private String realname;
|
||||
|
||||
private String idCard;
|
||||
|
||||
@NotEmpty(message = "手机号不能为空")
|
||||
private String phone;
|
||||
|
||||
private Integer level;
|
||||
|
||||
//自动填充时间
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private Date updateTime;
|
||||
|
||||
private Integer delState;
|
||||
|
||||
// private String remark;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
package com.ruoyi.project.hit.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 java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @TableName card_user_hit
|
||||
*/
|
||||
@TableName(value ="card_user_hit")
|
||||
@Data
|
||||
public class CardUserHit implements Serializable {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private Integer gameid;
|
||||
|
||||
private Integer userid;
|
||||
|
||||
private Integer productid;
|
||||
|
||||
private Date hittime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public CardUserHit(Integer gameid, Integer userid, Integer productid, Date hittime) {
|
||||
this.gameid = gameid;
|
||||
this.userid = userid;
|
||||
this.productid = productid;
|
||||
this.hittime = hittime;
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package com.ruoyi.project.hit.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 java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @TableName pupu_ups_history
|
||||
*/
|
||||
@TableName(value ="pupu_ups_history")
|
||||
@Data
|
||||
public class PupuUpsHistory implements Serializable {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private Integer upsId;
|
||||
|
||||
private String identifier;
|
||||
|
||||
private Date time;
|
||||
|
||||
private String value;
|
||||
|
||||
private String dataType;
|
||||
|
||||
private String name;
|
||||
|
||||
private String accessMode;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public PupuUpsHistory(Integer upsId, String identifier, Date time, String value, String dataType, String name, String accessMode) {
|
||||
this.upsId = upsId;
|
||||
this.identifier = identifier;
|
||||
this.time = time;
|
||||
this.value = value;
|
||||
this.dataType = dataType;
|
||||
this.name = name;
|
||||
this.accessMode = accessMode;
|
||||
}
|
||||
}
|
41
src/main/java/com/ruoyi/project/hit/domain/PupuUser.java
Normal file
41
src/main/java/com/ruoyi/project/hit/domain/PupuUser.java
Normal file
@ -0,0 +1,41 @@
|
||||
package com.ruoyi.project.hit.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 java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* @TableName pupu_user
|
||||
*/
|
||||
@TableName(value ="pupu_user")
|
||||
@Data
|
||||
public class PupuUser implements Serializable {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer userId;
|
||||
|
||||
@NotBlank(message = "用户名不能为空")
|
||||
@Size(min = 6, max = 16, message = "用户名长度必须在6到16个字符之间")
|
||||
private String userName;
|
||||
|
||||
@NotBlank(message = "密码不能为空")
|
||||
@Size(min = 8, message = "密码长度至少为8个字符")
|
||||
@Pattern(regexp = "^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[\\W]).+$", message = "密码必须包含至少一个大写字母、一个小写字母、一个数字和一个特殊字符")
|
||||
private String password;
|
||||
|
||||
@NotBlank(message = "性别不能为空")
|
||||
@Pattern(regexp = "^(男|女|未知)$", message = "性别必须是男、女或未知")
|
||||
private String gender;
|
||||
|
||||
private String pic;
|
||||
|
||||
private Integer status;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package com.ruoyi.project.hit.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @TableName system_dict
|
||||
*/
|
||||
@TableName(value ="system_dict")
|
||||
@Data
|
||||
public class SystemDict implements Serializable {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private String dictType;
|
||||
|
||||
private Integer dictKey;
|
||||
|
||||
private String dictValue;
|
||||
|
||||
private Integer delState;
|
||||
|
||||
//自动填充时间
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private Date updateTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.ruoyi.project.hit.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserLoginVO {
|
||||
private String userName;
|
||||
|
||||
private String password;
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
package com.ruoyi.project.hit.mapper;
|
||||
|
||||
import com.ruoyi.project.hit.controller.vo.ListCardGameVo;
|
||||
import com.ruoyi.project.hit.controller.vo.ListInfoVo;
|
||||
import com.ruoyi.project.hit.controller.vo.TotalInfoVo;
|
||||
import com.ruoyi.project.hit.domain.CardGame;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author HP
|
||||
* @description 针对表【card_game】的数据库操作Mapper
|
||||
* @createDate 2024-05-25 21:09:47
|
||||
* @Entity com.ruoyi.project.hit.domain.CardGame
|
||||
*/
|
||||
public interface CardGameMapper extends BaseMapper<CardGame> {
|
||||
|
||||
|
||||
List<HashMap> selectCardGameList(ListCardGameVo listCardGameVo);
|
||||
|
||||
HashMap getCardGameByGameId(Integer id);
|
||||
|
||||
List<HashMap> showAllCardGame();
|
||||
|
||||
List<CardGame> getCardByDate(Date now);
|
||||
|
||||
HashMap getCardGameBygameid(Integer gameid);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1,27 +0,0 @@
|
||||
package com.ruoyi.project.hit.mapper;
|
||||
|
||||
import com.ruoyi.project.hit.domain.CardGameProduct;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.project.uniapp.controller.vo.CardProductVo;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HP
|
||||
* @description 针对表【card_game_product】的数据库操作Mapper
|
||||
* @createDate 2024-05-28 16:27:44
|
||||
* @Entity com.ruoyi.project.hit.domain.CardGameProduct
|
||||
*/
|
||||
public interface CardGameProductMapper extends BaseMapper<CardGameProduct> {
|
||||
|
||||
List<HashMap> getGameProductByGameId(Integer id);
|
||||
|
||||
int getSumAmountByGameId(Integer gameid);
|
||||
|
||||
List<CardProductVo> getGameProductList(Integer id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1,24 +0,0 @@
|
||||
package com.ruoyi.project.hit.mapper;
|
||||
|
||||
import com.ruoyi.project.hit.domain.CardGameRule;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HP
|
||||
* @description 针对表【card_game_rule】的数据库操作Mapper
|
||||
* @createDate 2024-05-22 22:59:16
|
||||
* @Entity com.ruoyi.project.hit.domain.CardGameRule
|
||||
*/
|
||||
public interface CardGameRuleMapper extends BaseMapper<CardGameRule> {
|
||||
|
||||
List<HashMap> getGameRuleListByGameId(Integer id);
|
||||
|
||||
int getHitCountSumByGameId(Integer gameid);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1,18 +0,0 @@
|
||||
package com.ruoyi.project.hit.mapper;
|
||||
|
||||
import com.ruoyi.project.hit.domain.CardGameUser;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author HP
|
||||
* @description 针对表【card_game_user】的数据库操作Mapper
|
||||
* @createDate 2024-07-12 16:48:34
|
||||
* @Entity com.ruoyi.project.hit.domain.CardGameUser
|
||||
*/
|
||||
public interface CardGameUserMapper extends BaseMapper<CardGameUser> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1,18 +0,0 @@
|
||||
package com.ruoyi.project.hit.mapper;
|
||||
|
||||
import com.ruoyi.project.hit.domain.CardProduct;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author HP
|
||||
* @description 针对表【card_product】的数据库操作Mapper
|
||||
* @createDate 2024-05-24 20:50:39
|
||||
* @Entity com.ruoyi.project.hit.domain.CardProduct
|
||||
*/
|
||||
public interface CardProductMapper extends BaseMapper<CardProduct> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1,32 +0,0 @@
|
||||
package com.ruoyi.project.hit.mapper;
|
||||
|
||||
import com.ruoyi.project.hit.controller.vo.ListInfoVo;
|
||||
import com.ruoyi.project.hit.controller.vo.TotalInfoVo;
|
||||
import com.ruoyi.project.hit.domain.CardUserHit;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author HP
|
||||
* @description 针对表【card_user_hit】的数据库操作Mapper
|
||||
* @createDate 2024-05-28 23:47:42
|
||||
* @Entity com.ruoyi.project.hit.domain.CardUserHit
|
||||
*/
|
||||
public interface CardUserHitMapper extends BaseMapper<CardUserHit> {
|
||||
List<HashMap> selectCardUserHitInfo(TotalInfoVo totalInfoVo);
|
||||
|
||||
// Map getCardGameBygameid(Integer gameid);
|
||||
|
||||
List<HashMap> getProductsBygameid(Integer gameid);
|
||||
|
||||
List<HashMap> selectCardUserHitList(ListInfoVo listInfoVo);
|
||||
|
||||
List<HashMap> winnerRecord(Integer userId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1,23 +0,0 @@
|
||||
package com.ruoyi.project.hit.mapper;
|
||||
|
||||
import com.ruoyi.project.hit.controller.vo.ListCardUserVo;
|
||||
import com.ruoyi.project.hit.domain.CardUser;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HP
|
||||
* @description 针对表【card_user】的数据库操作Mapper
|
||||
* @createDate 2024-05-22 22:53:27
|
||||
* @Entity com.ruoyi.project.hit.domain.CardUser
|
||||
*/
|
||||
public interface CardUserMapper extends BaseMapper<CardUser> {
|
||||
|
||||
List<HashMap> selectCardUserList(ListCardUserVo listCardUserVo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.ruoyi.project.hit.mapper;
|
||||
|
||||
import com.ruoyi.project.hit.domain.PupuUpsHistory;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author HP
|
||||
* @description 针对表【pupu_ups_history】的数据库操作Mapper
|
||||
* @createDate 2024-09-04 13:45:24
|
||||
* @Entity com.ruoyi.project.hit.domain.PupuUpsHistory
|
||||
*/
|
||||
public interface PupuUpsHistoryMapper extends BaseMapper<PupuUpsHistory> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.ruoyi.project.hit.mapper;
|
||||
|
||||
import com.ruoyi.project.hit.domain.PupuUser;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author HP
|
||||
* @description 针对表【pupu_user】的数据库操作Mapper
|
||||
* @createDate 2024-09-04 11:26:14
|
||||
* @Entity com.ruoyi.project.hit.domain.PupuUser
|
||||
*/
|
||||
public interface PupuUserMapper extends BaseMapper<PupuUser> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1,18 +0,0 @@
|
||||
package com.ruoyi.project.hit.mapper;
|
||||
|
||||
import com.ruoyi.project.hit.domain.SystemDict;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author yifeng868
|
||||
* @description 针对表【system_dict】的数据库操作Mapper
|
||||
* @createDate 2024-05-11 15:59:46
|
||||
* @Entity com.ruoyi.project.hit.domain.SystemDict
|
||||
*/
|
||||
public interface SystemDictMapper extends BaseMapper<SystemDict> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1,55 +0,0 @@
|
||||
package com.ruoyi.project.hit.service;
|
||||
|
||||
import com.ruoyi.project.hit.domain.CardGameProduct;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.project.uniapp.controller.vo.CardProductVo;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HP
|
||||
* @description 针对表【card_game_product】的数据库操作Service
|
||||
* @createDate 2024-05-28 16:27:44
|
||||
*/
|
||||
public interface CardGameProductService extends IService<CardGameProduct> {
|
||||
|
||||
/**
|
||||
*根据productid查询总记录数
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
Long queryByProductId(Integer id);
|
||||
|
||||
/**
|
||||
* 通过活动id(gameid)拿到对应奖品数据
|
||||
* @param id gameid
|
||||
* @return
|
||||
*/
|
||||
List<HashMap> getGameProductByGameId(Integer id);
|
||||
|
||||
/**
|
||||
* 通过活动id(gameid)删除对应奖品数据
|
||||
* @param gameid
|
||||
* @return
|
||||
*/
|
||||
int deleteByGameId(Integer gameid);
|
||||
|
||||
/**
|
||||
* 活动奖品配置
|
||||
* @param cardGameProduct
|
||||
* @return
|
||||
*/
|
||||
int configGameProduct(CardGameProduct cardGameProduct);
|
||||
|
||||
/**
|
||||
* 通过gameid拿到该活动配置的奖品总数量
|
||||
* @param gameid
|
||||
* @return
|
||||
*/
|
||||
int getSumAmountByGameId(Integer gameid);
|
||||
|
||||
int deleteGameProduct(Integer id);
|
||||
|
||||
List<CardProductVo> getGameProductList(Integer id);
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
package com.ruoyi.project.hit.service;
|
||||
|
||||
import com.ruoyi.project.hit.domain.CardGameRule;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HP
|
||||
* @description 针对表【card_game_rule】的数据库操作Service
|
||||
* @createDate 2024-05-22 22:59:16
|
||||
*/
|
||||
public interface CardGameRuleService extends IService<CardGameRule> {
|
||||
|
||||
/**
|
||||
*根据会员等级编号查询总记录数
|
||||
* @param dictKey
|
||||
* @return
|
||||
*/
|
||||
Long queryByDictKey(Integer dictKey);
|
||||
|
||||
List<HashMap> getGameRuleListByGameId(Integer id);
|
||||
|
||||
/**
|
||||
* 通过活动id删除对应的活动奖品策略
|
||||
* @param gameid
|
||||
* @return
|
||||
*/
|
||||
int deleteByGameId(Integer gameid);
|
||||
|
||||
/**
|
||||
* 中奖策略配置接口
|
||||
* @param cardGameRule
|
||||
* @return
|
||||
*/
|
||||
int configGameRule(CardGameRule cardGameRule);
|
||||
|
||||
/**
|
||||
* 通过gameid拿到该活动允许中奖的总次数
|
||||
* @param gameid
|
||||
* @return
|
||||
*/
|
||||
int getHitCountSumByGameId(Integer gameid);
|
||||
|
||||
int deleteGameRule(Integer id);
|
||||
|
||||
List<CardGameRule> getGameRuleList(Integer id);
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
package com.ruoyi.project.hit.service;
|
||||
|
||||
import com.ruoyi.project.hit.controller.vo.ListCardGameVo;
|
||||
import com.ruoyi.project.hit.domain.CardGame;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.project.uniapp.controller.vo.CardUserGameVo;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author HP
|
||||
* @description 针对表【card_game】的数据库操作Service
|
||||
* @createDate 2024-05-25 21:09:47
|
||||
*/
|
||||
public interface CardGameService extends IService<CardGame> {
|
||||
|
||||
|
||||
/**
|
||||
* 活动列表显示
|
||||
* @param listCardGameVo
|
||||
* @return
|
||||
*/
|
||||
List<HashMap> selectCardGameList(ListCardGameVo listCardGameVo);
|
||||
|
||||
int addCardGame(CardGame cardGame);
|
||||
|
||||
/**
|
||||
* 根据id查询活动
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
Map<String,Object> getCardGameDataById(Integer id);
|
||||
|
||||
int updateCardGame(CardGame cardGame);
|
||||
|
||||
int deleteCardGameById(Integer id);
|
||||
|
||||
/**
|
||||
* 活动详情接口
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> getCardGameDetailById(Integer id);
|
||||
|
||||
CardGame getCardGameByGameId(Integer gameid);
|
||||
|
||||
List<CardGame> carousel();
|
||||
|
||||
List<HashMap> showAllCardGame();
|
||||
|
||||
Map<String, Object> getGameDetail(Integer gameId);
|
||||
|
||||
void preHot(Date now);
|
||||
|
||||
HashMap getCardGameBygameid(Integer gameid);
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
package com.ruoyi.project.hit.service;
|
||||
|
||||
import com.ruoyi.project.hit.domain.CardGameUser;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author HP
|
||||
* @description 针对表【card_game_user】的数据库操作Service
|
||||
* @createDate 2024-07-12 16:48:34
|
||||
*/
|
||||
public interface CardGameUserService extends IService<CardGameUser> {
|
||||
|
||||
int addCardGameUser(CardGameUser cardGameUser);
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
package com.ruoyi.project.hit.service;
|
||||
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
import com.ruoyi.project.hit.controller.vo.ExcelCardProductVo;
|
||||
import com.ruoyi.project.hit.controller.vo.ListCardProductVo;
|
||||
import com.ruoyi.project.hit.domain.CardProduct;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author HP
|
||||
* @description 针对表【card_product】的数据库操作Service
|
||||
* @createDate 2024-05-24 20:50:39
|
||||
*/
|
||||
public interface CardProductService extends IService<CardProduct> {
|
||||
|
||||
/**
|
||||
* 获取奖品列表
|
||||
* @param listCardProductVo
|
||||
* @return
|
||||
*/
|
||||
List<CardProduct> selectCardProductList(ListCardProductVo listCardProductVo);
|
||||
|
||||
/**
|
||||
* 修改奖品
|
||||
* @param cardProduct
|
||||
*/
|
||||
int updateProduct(CardProduct cardProduct);
|
||||
|
||||
/**
|
||||
* 根据id查询奖品
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
CardProduct getProductById(Integer id);
|
||||
|
||||
/**
|
||||
* 删除奖品
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
int deleteProduct(Integer id);
|
||||
|
||||
/**
|
||||
* 新增奖品
|
||||
* @param cardProduct
|
||||
* @return
|
||||
*/
|
||||
int addProduct(CardProduct cardProduct);
|
||||
|
||||
/**
|
||||
* 奖品列表显示
|
||||
* @return
|
||||
*/
|
||||
List<Map<String,Object>> select();
|
||||
|
||||
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
package com.ruoyi.project.hit.service;
|
||||
|
||||
import com.ruoyi.project.hit.controller.vo.ListInfoVo;
|
||||
import com.ruoyi.project.hit.controller.vo.TotalInfoVo;
|
||||
import com.ruoyi.project.hit.domain.CardUserHit;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.project.uniapp.controller.vo.CardProductVo;
|
||||
import com.ruoyi.project.uniapp.controller.vo.CardUserGameVo;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author HP
|
||||
* @description 针对表【card_user_hit】的数据库操作Service
|
||||
* @createDate 2024-05-28 23:47:42
|
||||
*/
|
||||
public interface CardUserHitService extends IService<CardUserHit> {
|
||||
|
||||
/**
|
||||
* 中奖统计列表显示
|
||||
* @param totalInfoVo
|
||||
* @return
|
||||
*/
|
||||
List<HashMap> selectCardUserHitInfo(TotalInfoVo totalInfoVo);
|
||||
|
||||
/**
|
||||
* 中奖统计详情显示
|
||||
* @param gameid 活动id
|
||||
* @return 中奖统计详情
|
||||
*/
|
||||
Map<String,Object> selectCardUserHitInfoByGameId(Integer gameid);
|
||||
|
||||
/**
|
||||
* 中奖列表显示
|
||||
* @param listInfoVo 中奖列表显示参数
|
||||
* @return 中奖列表
|
||||
*/
|
||||
List<HashMap> selectCardUserHitList(ListInfoVo listInfoVo);
|
||||
|
||||
CardProductVo getPrizeDraw(CardUserGameVo cardUserGameVo);
|
||||
|
||||
int addCardUserHit(CardUserHit cardUserHit);
|
||||
|
||||
List<HashMap> winnerRecord(Integer userId);
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
package com.ruoyi.project.hit.service;
|
||||
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
import com.ruoyi.project.hit.controller.vo.ListCardUserVo;
|
||||
import com.ruoyi.project.hit.domain.CardUser;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HP
|
||||
* @description 针对表【card_user】的数据库操作Service
|
||||
* @createDate 2024-05-22 22:53:27
|
||||
*/
|
||||
public interface CardUserService extends IService<CardUser> {
|
||||
|
||||
/**
|
||||
*根据会员等级编号查询总记录数
|
||||
* @param dictKey
|
||||
* @return
|
||||
*/
|
||||
Long queryByDictKey(Integer dictKey);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param listCardUserVo
|
||||
* @return
|
||||
*/
|
||||
List<HashMap> selectCardUserList(ListCardUserVo listCardUserVo);
|
||||
|
||||
CardUser login(String userName, String userPass);
|
||||
|
||||
boolean weatherLogin(Integer userId);
|
||||
|
||||
int addCardUser(CardUser cardUser);
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.ruoyi.project.hit.service;
|
||||
|
||||
import com.ruoyi.project.hit.domain.PupuUpsHistory;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author HP
|
||||
* @description 针对表【pupu_ups_history】的数据库操作Service
|
||||
* @createDate 2024-09-04 13:45:24
|
||||
*/
|
||||
public interface PupuUpsHistoryService extends IService<PupuUpsHistory> {
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.ruoyi.project.hit.service;
|
||||
|
||||
import com.ruoyi.project.hit.domain.PupuUser;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.project.hit.domain.vo.UserLoginVO;
|
||||
|
||||
/**
|
||||
* @author HP
|
||||
* @description 针对表【pupu_user】的数据库操作Service
|
||||
* @createDate 2024-09-04 11:26:14
|
||||
*/
|
||||
public interface PupuUserService extends IService<PupuUser> {
|
||||
|
||||
PupuUser login(UserLoginVO userLoginVO);
|
||||
|
||||
int register(PupuUser pupuUser);
|
||||
}
|
@ -1,77 +0,0 @@
|
||||
package com.ruoyi.project.hit.service;
|
||||
|
||||
import com.ruoyi.project.hit.domain.SystemDict;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yifeng868
|
||||
* @description 针对表【system_dict】的数据库操作Service
|
||||
* @createDate 2024-05-11 15:59:46
|
||||
*/
|
||||
public interface SystemDictService extends IService<SystemDict> {
|
||||
/**
|
||||
* 获取用户
|
||||
* @param dict
|
||||
* @return
|
||||
*/
|
||||
List<SystemDict> selectSystemDictList(SystemDict dict);
|
||||
|
||||
/**
|
||||
* 校验会员等级名称
|
||||
*
|
||||
* @param dict 会员等级信息
|
||||
* @return 结果
|
||||
*/
|
||||
String checkDictValueUnique(SystemDict dict);
|
||||
|
||||
/**
|
||||
* 校验会员等级代号
|
||||
*
|
||||
* @param dict 会员等级信息
|
||||
* @return 结果
|
||||
*/
|
||||
String checkDictKeyUnique(SystemDict dict);
|
||||
|
||||
/**
|
||||
* 新增保存会员等级信息
|
||||
*
|
||||
* @param dict 会员等级信息
|
||||
* @return 结果
|
||||
*/
|
||||
int insertDict(SystemDict dict);
|
||||
|
||||
/**
|
||||
* 删除会员等级信息
|
||||
*
|
||||
* @param id 会员id
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteDictById(Integer id);
|
||||
|
||||
/**
|
||||
* 通过id获取会员等级信息
|
||||
*
|
||||
* @param id 会员id
|
||||
* @return 结果
|
||||
*/
|
||||
SystemDict selectDictById(Long id);
|
||||
|
||||
|
||||
/**
|
||||
* 更新会员等级信息
|
||||
*
|
||||
* @param dict 会员等级信息
|
||||
* @return 结果
|
||||
*/
|
||||
int updateDict(SystemDict dict);
|
||||
|
||||
|
||||
/**
|
||||
* 根据字典类型查询字典信息
|
||||
* @param type 1:会员等级 2:活动类型
|
||||
* @return
|
||||
*/
|
||||
List<SystemDict> selectOption(Integer type);
|
||||
}
|
@ -1,95 +0,0 @@
|
||||
package com.ruoyi.project.hit.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.common.exception.CustomException;
|
||||
import com.ruoyi.project.hit.domain.CardGame;
|
||||
import com.ruoyi.project.hit.domain.CardGameProduct;
|
||||
import com.ruoyi.project.hit.service.CardGameProductService;
|
||||
import com.ruoyi.project.hit.mapper.CardGameProductMapper;
|
||||
import com.ruoyi.project.hit.service.CardGameService;
|
||||
import com.ruoyi.project.hit.service.CardUserHitService;
|
||||
import com.ruoyi.project.uniapp.controller.vo.CardProductVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HP
|
||||
* @description 针对表【card_game_product】的数据库操作Service实现
|
||||
* @createDate 2024-05-28 16:27:44
|
||||
*/
|
||||
@Service
|
||||
public class CardGameProductServiceImpl extends ServiceImpl<CardGameProductMapper, CardGameProduct>
|
||||
implements CardGameProductService{
|
||||
|
||||
@Resource
|
||||
private CardGameProductMapper cardGameProductMapper;
|
||||
@Resource
|
||||
private CardUserHitService cardUserHitService;
|
||||
@Resource
|
||||
private CardGameService cardGameService;
|
||||
|
||||
@Override
|
||||
public Long queryByProductId(Integer id) {
|
||||
LambdaQueryWrapper<CardGameProduct> wrapper=new LambdaQueryWrapper<>();
|
||||
wrapper.eq(CardGameProduct::getProductid,id);
|
||||
return cardGameProductMapper.selectCount(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HashMap> getGameProductByGameId(Integer id) {
|
||||
return cardGameProductMapper.getGameProductByGameId(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过活动id(gameid)删除对应奖品数据
|
||||
* @param gameid
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int deleteByGameId(Integer gameid) {
|
||||
LambdaQueryWrapper<CardGameProduct> wrapper=new LambdaQueryWrapper<>();
|
||||
wrapper.eq(CardGameProduct::getGameid,gameid);
|
||||
return cardGameProductMapper.delete(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 活动奖品配置
|
||||
* @param cardGameProduct
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int configGameProduct(CardGameProduct cardGameProduct) {
|
||||
return cardGameProductMapper.insert(cardGameProduct);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSumAmountByGameId(Integer gameid) {
|
||||
return cardGameProductMapper.getSumAmountByGameId(gameid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteGameProduct(Integer id) {
|
||||
CardGameProduct cardGameProduct = cardGameProductMapper.selectById(id);
|
||||
CardGame cardGame = cardGameService.getCardGameByGameId(cardGameProduct.getGameid());
|
||||
//如果活动已开始,则不可删除
|
||||
if(cardGame.getStartTime().before(new Date())){
|
||||
throw new CustomException("活动已开始,不可执行删除操作");
|
||||
}
|
||||
//活动已开始时,不允许删除该活动的奖品
|
||||
return cardGameProductMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CardProductVo> getGameProductList(Integer id) {
|
||||
return cardGameProductMapper.getGameProductList(id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1,97 +0,0 @@
|
||||
package com.ruoyi.project.hit.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.common.exception.CustomException;
|
||||
import com.ruoyi.project.hit.domain.CardGameRule;
|
||||
import com.ruoyi.project.hit.domain.CardUser;
|
||||
import com.ruoyi.project.hit.service.CardGameProductService;
|
||||
import com.ruoyi.project.hit.service.CardGameRuleService;
|
||||
import com.ruoyi.project.hit.mapper.CardGameRuleMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HP
|
||||
* @description 针对表【card_game_rule】的数据库操作Service实现
|
||||
* @createDate 2024-05-22 22:59:16
|
||||
*/
|
||||
@Service
|
||||
public class CardGameRuleServiceImpl extends ServiceImpl<CardGameRuleMapper, CardGameRule>
|
||||
implements CardGameRuleService{
|
||||
|
||||
@Resource
|
||||
private CardGameRuleMapper cardGameRuleMapper;
|
||||
@Resource
|
||||
private CardGameProductService cardGameProductService;
|
||||
|
||||
|
||||
@Override
|
||||
public Long queryByDictKey(Integer dictKey) {
|
||||
LambdaQueryWrapper<CardGameRule> wrapper=new LambdaQueryWrapper<>();
|
||||
wrapper.eq(CardGameRule::getLevelid,dictKey);
|
||||
return cardGameRuleMapper.selectCount(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过gameid拿到gameRuleList
|
||||
* @param id gameid
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<HashMap> getGameRuleListByGameId(Integer id) {
|
||||
return cardGameRuleMapper.getGameRuleListByGameId(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteByGameId(Integer gameid) {
|
||||
LambdaQueryWrapper<CardGameRule> wrapper=new LambdaQueryWrapper<>();
|
||||
wrapper.eq(CardGameRule::getGameid,gameid);
|
||||
return cardGameRuleMapper.delete(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int configGameRule(CardGameRule cardGameRule) {
|
||||
if(cardGameRule.getEnterCount()<cardGameRule.getHitCount()){
|
||||
throw new CustomException("最大抽奖数不能小于最大中奖数,策略配置失败");
|
||||
}
|
||||
LambdaQueryWrapper<CardGameRule> wrapper=new LambdaQueryWrapper<>();
|
||||
wrapper.eq(CardGameRule::getGameid,cardGameRule.getGameid());
|
||||
wrapper.eq(CardGameRule::getLevelid,cardGameRule.getLevelid());
|
||||
CardGameRule cardGameRule1 = cardGameRuleMapper.selectOne(wrapper);
|
||||
if(cardGameRule1!=null){
|
||||
throw new CustomException("已为该活动的此会员等级配置奖品,请勿重复配置");
|
||||
}
|
||||
if(cardGameRuleMapper.getHitCountSumByGameId(cardGameRule.getGameid())+cardGameRule.getHitCount()>cardGameProductService.getSumAmountByGameId(cardGameRule.getGameid())){
|
||||
throw new CustomException("配置奖品数量超出所准备的数量,配置失败");
|
||||
}
|
||||
|
||||
|
||||
return cardGameRuleMapper.insert(cardGameRule);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHitCountSumByGameId(Integer gameid) {
|
||||
return cardGameRuleMapper.getHitCountSumByGameId(gameid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteGameRule(Integer id) {
|
||||
return cardGameRuleMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CardGameRule> getGameRuleList(Integer id) {
|
||||
LambdaQueryWrapper<CardGameRule> wrapper=new LambdaQueryWrapper<>();
|
||||
wrapper.eq(CardGameRule::getGameid,id);
|
||||
return cardGameRuleMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1,219 +0,0 @@
|
||||
package com.ruoyi.project.hit.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.common.exception.CustomException;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.project.hit.controller.vo.ListCardGameVo;
|
||||
import com.ruoyi.project.hit.domain.CardGame;
|
||||
import com.ruoyi.project.hit.domain.CardGameRule;
|
||||
import com.ruoyi.project.hit.service.CardGameProductService;
|
||||
import com.ruoyi.project.hit.service.CardGameRuleService;
|
||||
import com.ruoyi.project.hit.service.CardGameService;
|
||||
import com.ruoyi.project.hit.mapper.CardGameMapper;
|
||||
import com.ruoyi.project.hit.service.CardUserHitService;
|
||||
import com.ruoyi.project.uniapp.controller.vo.CardProductVo;
|
||||
import com.ruoyi.project.uniapp.controller.vo.CardUserGameVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigInteger;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @author HP
|
||||
* @description 针对表【card_game】的数据库操作Service实现
|
||||
* @createDate 2024-05-25 21:09:47
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class CardGameServiceImpl extends ServiceImpl<CardGameMapper, CardGame>
|
||||
implements CardGameService{
|
||||
@Autowired
|
||||
private RedisTemplate redisTemplate;
|
||||
|
||||
@Resource
|
||||
private CardGameMapper cardGameMapper;
|
||||
@Resource
|
||||
private CardGameRuleService cardGameRuleService;
|
||||
@Resource
|
||||
private CardGameProductService cardGameProductService;
|
||||
@Resource
|
||||
private CardUserHitService cardUserHitService;
|
||||
|
||||
@Override
|
||||
public List<HashMap> selectCardGameList(ListCardGameVo listCardGameVo) {
|
||||
return cardGameMapper.selectCardGameList(listCardGameVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addCardGame(CardGame cardGame) {
|
||||
LambdaQueryWrapper<CardGame> wrapper=new LambdaQueryWrapper<>();
|
||||
wrapper.eq(CardGame::getTitle,cardGame.getTitle());
|
||||
CardGame cardGame1 = cardGameMapper.selectOne(wrapper);
|
||||
if(null!=cardGame1){
|
||||
throw new CustomException("该活动标题已存在,添加失败");
|
||||
}
|
||||
//活动状态 0:未开始 1:已结束(已加载)
|
||||
if(cardGame.getStartTime().after(new Date())){
|
||||
cardGame.setStatus(0);
|
||||
}else {
|
||||
cardGame.setStatus(1);
|
||||
}
|
||||
return cardGameMapper.insert(cardGame);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getCardGameDataById(Integer id) {
|
||||
Map<String,Object> map=new HashMap<>();
|
||||
|
||||
List<HashMap> list1 = cardGameRuleService.getGameRuleListByGameId(id);
|
||||
map.put("gameRuleList",list1);
|
||||
List<HashMap> list2=cardGameProductService.getGameProductByGameId(id);
|
||||
map.put("gameProductList",list2);
|
||||
CardGame cardGame = cardGameMapper.selectById(id);
|
||||
map.put("cardGame",cardGame);
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateCardGame(CardGame cardGame) {
|
||||
LambdaQueryWrapper<CardGame> wrapper =new LambdaQueryWrapper<>();
|
||||
wrapper.eq(CardGame::getTitle,cardGame.getTitle());
|
||||
wrapper.ne(CardGame::getId,cardGame.getId());
|
||||
CardGame cardGame1 = cardGameMapper.selectOne(wrapper);
|
||||
if(cardGame1!=null){
|
||||
throw new CustomException("该活动标题已存在,修改失败");
|
||||
}
|
||||
return cardGameMapper.updateById(cardGame);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteCardGameById(Integer id) {
|
||||
CardGame cardGame = cardGameMapper.selectById(id);
|
||||
//如果活动已开始,则不可删除
|
||||
if(cardGame.getStartTime().before(new Date())){
|
||||
throw new CustomException("活动已开始,不可执行删除操作");
|
||||
}
|
||||
//删除对应活动奖品配置信息
|
||||
cardGameProductService.deleteByGameId(id);
|
||||
//删除对应活动配置的活动奖品策略
|
||||
cardGameRuleService.deleteByGameId(id);
|
||||
return cardGameMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getCardGameDetailById(Integer id) {
|
||||
Map<String,Object> map=new HashMap<>();
|
||||
|
||||
List<HashMap> list1 = cardGameRuleService.getGameRuleListByGameId(id);
|
||||
map.put("gameRuleList",list1);
|
||||
List<HashMap> list2=cardGameProductService.getGameProductByGameId(id);
|
||||
map.put("gameProductList",list2);
|
||||
HashMap cardGame = cardGameMapper.getCardGameByGameId(id);
|
||||
map.put("cardGame",cardGame);
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CardGame getCardGameByGameId(Integer gameid) {
|
||||
return cardGameMapper.selectById(gameid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CardGame> carousel() {
|
||||
LambdaQueryWrapper<CardGame> wrapper=new LambdaQueryWrapper<>();
|
||||
wrapper.select(CardGame::getPic);
|
||||
wrapper.select(CardGame::getTitle);
|
||||
return cardGameMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HashMap> showAllCardGame() {
|
||||
return cardGameMapper.showAllCardGame();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getGameDetail(Integer gameId) {
|
||||
Map map=new HashMap();
|
||||
List<HashMap> gameRuleList = cardGameRuleService.getGameRuleListByGameId(gameId);
|
||||
map.put("gameRuleList",gameRuleList);
|
||||
|
||||
List<HashMap> gameProductList = cardGameProductService.getGameProductByGameId(gameId);
|
||||
map.put("gameProductList",gameProductList);
|
||||
Map<String, Object> map1 = cardUserHitService.selectCardUserHitInfoByGameId(gameId);
|
||||
map.putAll(map1);
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preHot(Date now) {
|
||||
List<CardGame> cardGameList = cardGameMapper.getCardByDate(now);
|
||||
if(cardGameList.size()==0){
|
||||
return;
|
||||
}
|
||||
//活动信息缓存redis(json字符串存储)
|
||||
for (CardGame cardGame : cardGameList) {
|
||||
String jsonCardGame = JSONArray.toJSONString(cardGame);
|
||||
//失效时间
|
||||
long l=cardGame.getEndTime().getTime()-now.getTime();
|
||||
redisTemplate.opsForValue().set("cardGame:"+cardGame.getId(),jsonCardGame,l,TimeUnit.MILLISECONDS);
|
||||
|
||||
List<CardGameRule> gameRuleList = cardGameRuleService.getGameRuleList(cardGame.getId());
|
||||
for (CardGameRule cardGameRule : gameRuleList) {
|
||||
//最大中奖数缓存redis(hash存储)
|
||||
redisTemplate.opsForHash().put("cardGame_maxHitCount:"+cardGame.getId(),cardGameRule.getLevelid(),cardGameRule.getHitCount());
|
||||
//最大抽奖数缓存redis(hash存储)
|
||||
redisTemplate.opsForHash().put("cardGame_maxEnterCount:"+cardGame.getId(),cardGameRule.getLevelid(),cardGameRule.getEnterCount());
|
||||
}
|
||||
//设置两个hash失效时间
|
||||
redisTemplate.expire("cardGame_maxHitCount:"+cardGame.getId(),l, TimeUnit.MILLISECONDS);
|
||||
redisTemplate.expire("cardGame_maxEnterCount:"+cardGame.getId(),l, TimeUnit.MILLISECONDS);
|
||||
|
||||
List<CardProductVo> gameProductList = cardGameProductService.getGameProductList(cardGame.getId());
|
||||
//抽奖令牌桶
|
||||
List<Long> tokenList=new ArrayList<>();
|
||||
for (CardProductVo cardProductVo : gameProductList) {
|
||||
for (int i = 0; i < cardProductVo.getAmount(); i++) {
|
||||
//给每个奖品都配置一个时间戳
|
||||
Long start=cardGame.getStartTime().getTime();
|
||||
Long end=cardGame.getEndTime().getTime();
|
||||
//时间差
|
||||
int time= (int) (end-start);
|
||||
Long token=start+new Random().nextInt(time);
|
||||
//避免重复
|
||||
token=token*10000+new Random().nextInt(9999);
|
||||
tokenList.add(token);
|
||||
//奖品-令牌缓存redis(string存储)
|
||||
redisTemplate.opsForValue().set("gameId_token:"+cardGame.getId()+"_"+token,cardProductVo,l,TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
}
|
||||
//由小到大排
|
||||
Collections.sort(tokenList);
|
||||
//令牌集合redis缓存(list存储)
|
||||
redisTemplate.opsForList().rightPushAll("game_token:"+cardGame.getId(),tokenList);
|
||||
redisTemplate.expire("game_token:"+cardGame.getId(),l,TimeUnit.MILLISECONDS);
|
||||
|
||||
//活动状态置1
|
||||
cardGame.setStatus(1);
|
||||
cardGameMapper.updateById(cardGame);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap getCardGameBygameid(Integer gameid) {
|
||||
return cardGameMapper.getCardGameBygameid(gameid);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1,30 +0,0 @@
|
||||
package com.ruoyi.project.hit.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.project.hit.domain.CardGameUser;
|
||||
import com.ruoyi.project.hit.service.CardGameUserService;
|
||||
import com.ruoyi.project.hit.mapper.CardGameUserMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author HP
|
||||
* @description 针对表【card_game_user】的数据库操作Service实现
|
||||
* @createDate 2024-07-12 16:48:34
|
||||
*/
|
||||
@Service
|
||||
public class CardGameUserServiceImpl extends ServiceImpl<CardGameUserMapper, CardGameUser>
|
||||
implements CardGameUserService{
|
||||
@Resource
|
||||
private CardGameUserMapper cardGameUserMapper;
|
||||
|
||||
@Override
|
||||
public int addCardGameUser(CardGameUser cardGameUser) {
|
||||
return cardGameUserMapper.insert(cardGameUser);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1,102 +0,0 @@
|
||||
package com.ruoyi.project.hit.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mchange.lang.DoubleUtils;
|
||||
import com.ruoyi.common.exception.CustomException;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.project.hit.controller.vo.ExcelCardProductVo;
|
||||
import com.ruoyi.project.hit.controller.vo.ListCardProductVo;
|
||||
import com.ruoyi.project.hit.domain.CardProduct;
|
||||
import com.ruoyi.project.hit.domain.CardUser;
|
||||
import com.ruoyi.project.hit.domain.SystemDict;
|
||||
import com.ruoyi.project.hit.mapper.CardUserMapper;
|
||||
import com.ruoyi.project.hit.service.CardGameProductService;
|
||||
import com.ruoyi.project.hit.service.CardProductService;
|
||||
import com.ruoyi.project.hit.mapper.CardProductMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author HP
|
||||
* @description 针对表【card_product】的数据库操作Service实现
|
||||
* @createDate 2024-05-24 20:50:39
|
||||
*/
|
||||
@Service
|
||||
public class CardProductServiceImpl extends ServiceImpl<CardProductMapper, CardProduct>
|
||||
implements CardProductService{
|
||||
@Resource
|
||||
private CardProductMapper cardProductMapper;
|
||||
@Resource
|
||||
private CardGameProductService cardGameProductService;
|
||||
|
||||
@Override
|
||||
public List<CardProduct> selectCardProductList(ListCardProductVo listCardProductVo) {
|
||||
LambdaQueryWrapper<CardProduct> wrapper=new LambdaQueryWrapper<>();
|
||||
if (StringUtils.isNotEmpty(listCardProductVo.getPname())){
|
||||
wrapper.like(CardProduct::getPname,listCardProductVo.getPname());
|
||||
}
|
||||
if (listCardProductVo.getPriceLow()!=0){
|
||||
wrapper.ge(CardProduct::getPrice,listCardProductVo.getPriceLow());
|
||||
}
|
||||
if (listCardProductVo.getPriceHigh()!=0){
|
||||
wrapper.le(CardProduct::getPrice,listCardProductVo.getPriceHigh());
|
||||
}
|
||||
return cardProductMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateProduct(CardProduct cardProduct) {
|
||||
LambdaQueryWrapper<CardProduct> wrapper=new LambdaQueryWrapper<>();
|
||||
wrapper.ne(CardProduct::getId,cardProduct.getId());
|
||||
wrapper.eq(CardProduct::getPname,cardProduct.getPname());
|
||||
CardProduct cardProduct1 = cardProductMapper.selectOne(wrapper);
|
||||
if(cardProduct1!=null){
|
||||
throw new CustomException("该奖品名已存在,修改失败");
|
||||
}
|
||||
return cardProductMapper.updateById(cardProduct);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CardProduct getProductById(Integer id) {
|
||||
return cardProductMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteProduct(Integer id) {
|
||||
Long i = cardGameProductService.queryByProductId(id);
|
||||
if(i>0){
|
||||
throw new CustomException("该奖品已被活动配置,无法删除");
|
||||
}
|
||||
return cardProductMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addProduct(CardProduct cardProduct) {
|
||||
LambdaQueryWrapper<CardProduct> wrapper=new LambdaQueryWrapper<>();
|
||||
wrapper.eq(CardProduct::getPname,cardProduct.getPname());
|
||||
CardProduct cardProduct1 = cardProductMapper.selectOne(wrapper);
|
||||
if(cardProduct1!=null){
|
||||
throw new CustomException("该奖品名已存在,添加失败");
|
||||
}
|
||||
return cardProductMapper.insert(cardProduct);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String,Object>> select() {
|
||||
LambdaQueryWrapper<CardProduct> wrapper=new LambdaQueryWrapper<>();
|
||||
wrapper.select(CardProduct::getId,CardProduct::getPname);
|
||||
return cardProductMapper.selectMaps(wrapper);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1,156 +0,0 @@
|
||||
package com.ruoyi.project.hit.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.common.exception.CustomException;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.bean.BeanUtils;
|
||||
import com.ruoyi.project.hit.controller.vo.ListInfoVo;
|
||||
import com.ruoyi.project.hit.controller.vo.TotalInfoVo;
|
||||
import com.ruoyi.project.hit.domain.*;
|
||||
import com.ruoyi.project.hit.service.CardGameService;
|
||||
import com.ruoyi.project.hit.service.CardUserHitService;
|
||||
import com.ruoyi.project.hit.mapper.CardUserHitMapper;
|
||||
import com.ruoyi.project.hit.service.CardUserService;
|
||||
import com.ruoyi.project.uniapp.controller.vo.CardProductVo;
|
||||
import com.ruoyi.project.uniapp.controller.vo.CardUserGameVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @author HP
|
||||
* @description 针对表【card_user_hit】的数据库操作Service实现
|
||||
* @createDate 2024-05-28 23:47:42
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class CardUserHitServiceImpl extends ServiceImpl<CardUserHitMapper, CardUserHit>
|
||||
implements CardUserHitService{
|
||||
@Resource
|
||||
private CardUserHitMapper cardUserHitMapper;
|
||||
|
||||
@Autowired
|
||||
private CardGameService cardGameService;
|
||||
@Autowired
|
||||
private CardUserService cardUserService;
|
||||
|
||||
@Autowired
|
||||
private RedisTemplate redisTemplate;
|
||||
@Autowired
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
@Override
|
||||
public List<HashMap> selectCardUserHitInfo(TotalInfoVo totalInfoVo) {
|
||||
return cardUserHitMapper.selectCardUserHitInfo(totalInfoVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String,Object> selectCardUserHitInfoByGameId(Integer gameid) {
|
||||
Map<String,Object> map=new HashMap<>();
|
||||
//根据活动id拿到活动详情以及活动类型(2表)
|
||||
Map map1 = cardGameService.getCardGameBygameid(gameid);
|
||||
// log.debug("cardGame",map1);
|
||||
map.put("cardGame",map1);
|
||||
CardGame cardGame = cardGameService.getCardGameByGameId(gameid);
|
||||
if(StringUtils.isNotNull(cardGame)&&cardGame.getEndTime().before(new Date())){
|
||||
//根据活动id拿到活动中奖明细(3表)
|
||||
List<HashMap> hashMapList=cardUserHitMapper.getProductsBygameid(gameid);
|
||||
map.put("products",hashMapList);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HashMap> selectCardUserHitList(ListInfoVo listInfoVo) {
|
||||
return cardUserHitMapper.selectCardUserHitList(listInfoVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CardProductVo getPrizeDraw(CardUserGameVo cardUserGameVo) {
|
||||
Date now=new Date();
|
||||
boolean b1 = cardUserService.weatherLogin(cardUserGameVo.getUserId());
|
||||
if(!b1){
|
||||
throw new CustomException("用户未登录");
|
||||
}
|
||||
CardGame cardGame = JSON.parseObject((String) redisTemplate.opsForValue().get("cardGame:" + cardUserGameVo.getGameId()),CardGame.class);
|
||||
CardUser cardUser= (CardUser) redisTemplate.opsForValue().get("user_login:"+cardUserGameVo.getUserId());
|
||||
if(StringUtils.isNull(cardGame)||now.before(cardGame.getStartTime())){
|
||||
throw new CustomException("活动未开始");
|
||||
}
|
||||
if(now.after(cardGame.getEndTime())){
|
||||
throw new CustomException("活动已结束");
|
||||
}
|
||||
//判断该用户是否参与过抽奖
|
||||
Boolean b = redisTemplate.hasKey("cardGame_user:" + cardUserGameVo.getGameId() + "_" + cardUserGameVo.getUserId());
|
||||
if(!b){
|
||||
//value:抽奖次数
|
||||
redisTemplate.opsForValue().set("cardGame_user:" + cardUserGameVo.getGameId() + "_" + cardUserGameVo.getUserId(),0,(cardGame.getEndTime().getTime()-now.getTime()), TimeUnit.MILLISECONDS);
|
||||
//value:中奖次数
|
||||
redisTemplate.opsForValue().set("cardGame_user_hit:" + cardUserGameVo.getGameId() + "_" + cardUserGameVo.getUserId(),0,(cardGame.getEndTime().getTime()-now.getTime()), TimeUnit.MILLISECONDS);
|
||||
}
|
||||
int maxEnterCount = (int) redisTemplate.opsForHash().get("cardGame_maxEnterCount:" + cardUserGameVo.getGameId(), cardUser.getLevel());
|
||||
int EnterCount=(int) redisTemplate.opsForValue().get("cardGame_user:" + cardUserGameVo.getGameId() + "_" + cardUserGameVo.getUserId());
|
||||
if(EnterCount>=maxEnterCount){
|
||||
throw new CustomException("抽奖次数已达上限");
|
||||
}
|
||||
int maxHitCount = (int) redisTemplate.opsForHash().get("cardGame_maxHitCount:" + cardUserGameVo.getGameId(), cardUser.getLevel());
|
||||
int HitCount=(int) redisTemplate.opsForValue().get("cardGame_user_hit:" + cardUserGameVo.getGameId() + "_" + cardUserGameVo.getUserId());
|
||||
//抽奖记录次数加一
|
||||
redisTemplate.opsForValue().increment("cardGame_user:" + cardUserGameVo.getGameId() + "_" + cardUserGameVo.getUserId(),1);
|
||||
//mq写入抽奖记录到数据库
|
||||
CardGameUser cardGameUser=new CardGameUser(cardUserGameVo.getUserId(),cardUserGameVo.getGameId(),now);
|
||||
String cardGameUserStr= JSONObject.toJSONString(cardGameUser);
|
||||
rabbitTemplate.convertAndSend("drawRecord",cardGameUserStr);
|
||||
//该用户已经达到最大中奖次数
|
||||
if(HitCount>=maxHitCount){
|
||||
return null;
|
||||
}
|
||||
//抽奖流程
|
||||
Long token= (Long) redisTemplate.opsForList().leftPop("game_token:"+cardUserGameVo.getGameId());
|
||||
if(StringUtils.isNull(token)){
|
||||
throw new CustomException("奖品已抽完");
|
||||
}
|
||||
if(now.getTime()<token/10000){
|
||||
//没中奖,token放回令牌桶
|
||||
redisTemplate.opsForList().leftPush("game_token:"+cardUserGameVo.getGameId(),token);
|
||||
return null;
|
||||
}else {
|
||||
//中奖,中奖记录次数加一
|
||||
redisTemplate.opsForValue().increment("cardGame_user_hit:" + cardUserGameVo.getGameId() + "_" + cardUserGameVo.getUserId(),1);
|
||||
CardProductVo cardProductVo= (CardProductVo) redisTemplate.opsForValue().get("gameId_token:"+cardGame.getId()+"_"+token);
|
||||
//mq写入中奖信息到数据库
|
||||
CardUserHit cardUserHit=new CardUserHit(cardUserGameVo.getGameId(),cardUserGameVo.getUserId(),cardProductVo.getId(),now);
|
||||
String cardUserHitStr=JSONObject.toJSONString(cardUserHit);
|
||||
rabbitTemplate.convertAndSend("winnerRecord",cardUserHitStr);
|
||||
|
||||
return cardProductVo;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addCardUserHit(CardUserHit cardUserHit) {
|
||||
return cardUserHitMapper.insert(cardUserHit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HashMap> winnerRecord(Integer userId) {
|
||||
return cardUserHitMapper.winnerRecord(userId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1,75 +0,0 @@
|
||||
package com.ruoyi.project.hit.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.common.exception.CustomException;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.project.hit.controller.vo.ListCardUserVo;
|
||||
import com.ruoyi.project.hit.domain.CardUser;
|
||||
import com.ruoyi.project.hit.domain.SystemDict;
|
||||
import com.ruoyi.project.hit.service.CardUserService;
|
||||
import com.ruoyi.project.hit.mapper.CardUserMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.core.TimeoutUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @author HP
|
||||
* @description 针对表【card_user】的数据库操作Service实现
|
||||
* @createDate 2024-05-22 22:53:27
|
||||
*/
|
||||
@Service
|
||||
public class CardUserServiceImpl extends ServiceImpl<CardUserMapper, CardUser>
|
||||
implements CardUserService{
|
||||
@Autowired
|
||||
private RedisTemplate redisTemplate;
|
||||
|
||||
@Resource
|
||||
private CardUserMapper cardUserMapper;
|
||||
|
||||
@Override
|
||||
public Long queryByDictKey(Integer dictKey) {
|
||||
LambdaQueryWrapper<CardUser> wrapper=new LambdaQueryWrapper<>();
|
||||
wrapper.eq(CardUser::getLevel,dictKey);
|
||||
return cardUserMapper.selectCount(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HashMap> selectCardUserList(ListCardUserVo listCardUserVo) {
|
||||
return cardUserMapper.selectCardUserList(listCardUserVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CardUser login(String userName, String userPass) {
|
||||
LambdaQueryWrapper<CardUser> wrapper=new LambdaQueryWrapper<>();
|
||||
wrapper.eq(CardUser::getUserName,userName);
|
||||
wrapper.eq(CardUser::getUserPass,userPass);
|
||||
CardUser cardUser = cardUserMapper.selectOne(wrapper);
|
||||
if(StringUtils.isNotNull(cardUser)){
|
||||
redisTemplate.opsForValue().set("user_login:"+cardUser.getId(),cardUser, 30, TimeUnit.MINUTES);
|
||||
return cardUser;
|
||||
}
|
||||
throw new CustomException("登录失败");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean weatherLogin(Integer userId) {
|
||||
return redisTemplate.hasKey("user_login:"+userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addCardUser(CardUser cardUser) {
|
||||
return cardUserMapper.insert(cardUser);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,22 @@
|
||||
package com.ruoyi.project.hit.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.project.hit.domain.PupuUpsHistory;
|
||||
import com.ruoyi.project.hit.service.PupuUpsHistoryService;
|
||||
import com.ruoyi.project.hit.mapper.PupuUpsHistoryMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author HP
|
||||
* @description 针对表【pupu_ups_history】的数据库操作Service实现
|
||||
* @createDate 2024-09-04 13:45:24
|
||||
*/
|
||||
@Service
|
||||
public class PupuUpsHistoryServiceImpl extends ServiceImpl<PupuUpsHistoryMapper, PupuUpsHistory>
|
||||
implements PupuUpsHistoryService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,50 @@
|
||||
package com.ruoyi.project.hit.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.common.exception.CustomException;
|
||||
import com.ruoyi.project.hit.domain.PupuUser;
|
||||
import com.ruoyi.project.hit.domain.vo.UserLoginVO;
|
||||
import com.ruoyi.project.hit.service.PupuUserService;
|
||||
import com.ruoyi.project.hit.mapper.PupuUserMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author HP
|
||||
* @description 针对表【pupu_user】的数据库操作Service实现
|
||||
* @createDate 2024-09-04 11:26:14
|
||||
*/
|
||||
@Service
|
||||
public class PupuUserServiceImpl extends ServiceImpl<PupuUserMapper, PupuUser>
|
||||
implements PupuUserService{
|
||||
|
||||
@Resource
|
||||
private PupuUserMapper pupuUserMapper;
|
||||
|
||||
@Override
|
||||
public PupuUser login(UserLoginVO userLoginVO) {
|
||||
LambdaQueryWrapper<PupuUser> wrapper=new LambdaQueryWrapper<>();
|
||||
wrapper.eq(PupuUser::getUserName,userLoginVO.getUserName());
|
||||
wrapper.eq(PupuUser::getPassword,userLoginVO.getPassword());
|
||||
return pupuUserMapper.selectOne(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int register(PupuUser pupuUser) {
|
||||
int i=0;
|
||||
try {
|
||||
i = pupuUserMapper.insert(pupuUser);
|
||||
} catch (Exception e){
|
||||
throw new CustomException("账号已存在");
|
||||
}
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1,161 +0,0 @@
|
||||
package com.ruoyi.project.hit.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.exception.CustomException;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.project.hit.domain.SystemDict;
|
||||
import com.ruoyi.project.hit.mapper.CardUserMapper;
|
||||
import com.ruoyi.project.hit.service.CardGameRuleService;
|
||||
import com.ruoyi.project.hit.service.CardUserService;
|
||||
import com.ruoyi.project.hit.service.SystemDictService;
|
||||
import com.ruoyi.project.hit.mapper.SystemDictMapper;
|
||||
|
||||
import com.ruoyi.project.system.domain.SysPost;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yifeng868
|
||||
* @description 针对表【system_dict】的数据库操作Service实现
|
||||
* @createDate 2024-05-11 15:59:46
|
||||
*/
|
||||
@Service
|
||||
public class SystemDictServiceImpl extends ServiceImpl<SystemDictMapper, SystemDict>
|
||||
implements SystemDictService{
|
||||
@Resource
|
||||
private SystemDictMapper systemDictMapper;
|
||||
@Resource
|
||||
private CardUserService cardUserService;
|
||||
@Resource
|
||||
private CardGameRuleService cardGameRuleService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<SystemDict> selectSystemDictList(SystemDict dict) {
|
||||
LambdaQueryWrapper<SystemDict> wrapper=new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemDict::getDictType,dict.getDictType());
|
||||
if (StringUtils.isNotEmpty(dict.getDictValue())){
|
||||
wrapper.like(SystemDict::getDictValue,dict.getDictValue());
|
||||
}
|
||||
return systemDictMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验会员等级名称是否唯一
|
||||
*
|
||||
* @param dict 会员等级信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkDictValueUnique(SystemDict dict) {
|
||||
//是否传入id的判断
|
||||
Long distId = StringUtils.isNull(dict.getId()) ? -1L : dict.getId();
|
||||
LambdaQueryWrapper<SystemDict> wrapper=new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemDict::getDictType,dict.getDictType());
|
||||
wrapper.eq(SystemDict::getDictValue,dict.getDictValue());
|
||||
SystemDict info = systemDictMapper.selectOne(wrapper);
|
||||
if (StringUtils.isNotNull(info) && info.getId().longValue() != distId.longValue())
|
||||
{
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验会员等级编码是否唯一
|
||||
*
|
||||
* @param dict 会员等级信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkDictKeyUnique(SystemDict dict) {
|
||||
Long distId = StringUtils.isNull(dict.getId()) ? -1L : dict.getId();
|
||||
LambdaQueryWrapper<SystemDict> wrapper=new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemDict::getDictType,dict.getDictType());
|
||||
wrapper.eq(SystemDict::getDictKey,dict.getDictKey());
|
||||
SystemDict info = systemDictMapper.selectOne(wrapper);
|
||||
if (StringUtils.isNotNull(info) && info.getId().longValue() != distId.longValue())
|
||||
{
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增保存会员等级信息
|
||||
*
|
||||
* @param dict 会员等级信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertDict(SystemDict dict) {
|
||||
return systemDictMapper.insert(dict);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除会员等级信息
|
||||
*
|
||||
* @param id 会员等级ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDictById(Integer id) {
|
||||
//根据id查询会员等级编号
|
||||
SystemDict systemDict = systemDictMapper.selectById(id);
|
||||
Long i=cardUserService.queryByDictKey(systemDict.getDictKey());
|
||||
if(i>0){
|
||||
throw new CustomException("会员等级编号在其他处调用");
|
||||
}
|
||||
Long j=cardGameRuleService.queryByDictKey(systemDict.getDictKey());
|
||||
if(j>0){
|
||||
throw new CustomException("会员等级编号在其他处调用");
|
||||
}
|
||||
|
||||
return systemDictMapper.deleteById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过会员等级ID查询信息
|
||||
*
|
||||
* @param id 会员等级id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public SystemDict selectDictById(Long id) {
|
||||
return systemDictMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateDict(SystemDict dict) {
|
||||
LambdaQueryWrapper<SystemDict> wrapper=new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemDict::getId,dict.getId());
|
||||
return systemDictMapper.update(dict,wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SystemDict> selectOption(Integer type) {
|
||||
String dictType="";
|
||||
if(type==1){
|
||||
dictType="userlevel";
|
||||
}else if(type==2){
|
||||
dictType="gametype";
|
||||
}
|
||||
LambdaQueryWrapper<SystemDict> wrapper=new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemDict::getDictType,dictType);
|
||||
wrapper.select(SystemDict::getDictKey,SystemDict::getDictValue);
|
||||
System.out.println(systemDictMapper.selectList(wrapper));
|
||||
return systemDictMapper.selectList(wrapper);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
35
src/main/java/com/ruoyi/project/hit/util/ScheduledTasks.java
Normal file
35
src/main/java/com/ruoyi/project/hit/util/ScheduledTasks.java
Normal file
@ -0,0 +1,35 @@
|
||||
package com.ruoyi.project.hit.util;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.redis.connection.RedisConnection;
|
||||
import org.springframework.data.redis.core.Cursor;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.core.ScanOptions;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class ScheduledTasks {
|
||||
|
||||
// 定时任务,每30秒执行一次
|
||||
// @Scheduled(fixedRate = 3000)
|
||||
public void reportCurrentTime1() {
|
||||
System.out.println(11);
|
||||
long l = System.currentTimeMillis();
|
||||
Map<Integer, Long> upsMap = Util1.upsMap;
|
||||
for (Map.Entry<Integer, Long> entry : upsMap.entrySet()) {
|
||||
if(l-entry.getValue()>=30000){
|
||||
System.out.println(entry.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
70
src/main/java/com/ruoyi/project/hit/util/Token.java
Normal file
70
src/main/java/com/ruoyi/project/hit/util/Token.java
Normal file
@ -0,0 +1,70 @@
|
||||
package com.ruoyi.project.hit.util;
|
||||
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Base64;
|
||||
|
||||
|
||||
public class Token {
|
||||
|
||||
public static String assembleToken(String version, String resourceName, String expirationTime, String signatureMethod, String accessKey)
|
||||
throws UnsupportedEncodingException, NoSuchAlgorithmException, InvalidKeyException {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String res = URLEncoder.encode(resourceName, "UTF-8");
|
||||
String sig = URLEncoder.encode(generatorSignature(version, resourceName, expirationTime, accessKey, signatureMethod), "UTF-8");
|
||||
sb.append("version=")
|
||||
.append(version)
|
||||
.append("&res=")
|
||||
.append(res)
|
||||
.append("&et=")
|
||||
.append(expirationTime)
|
||||
.append("&method=")
|
||||
.append(signatureMethod)
|
||||
.append("&sign=")
|
||||
.append(sig);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String generatorSignature(String version, String resourceName, String expirationTime, String accessKey, String signatureMethod)
|
||||
throws NoSuchAlgorithmException, InvalidKeyException {
|
||||
String encryptText = expirationTime + "\n" + signatureMethod + "\n" + resourceName + "\n" + version;
|
||||
String signature;
|
||||
byte[] bytes = HmacEncrypt(encryptText, accessKey, signatureMethod);
|
||||
signature = Base64.getEncoder().encodeToString(bytes);
|
||||
return signature;
|
||||
}
|
||||
|
||||
public static byte[] HmacEncrypt(String data, String key, String signatureMethod)
|
||||
throws NoSuchAlgorithmException, InvalidKeyException {
|
||||
//根据给定的字节数组构造一个密钥,第二参数指定一个密钥算法的名称
|
||||
SecretKeySpec signinKey = null;
|
||||
signinKey = new SecretKeySpec(Base64.getDecoder().decode(key),
|
||||
"Hmac" + signatureMethod.toUpperCase());
|
||||
//生成一个指定 Mac 算法 的 Mac 对象
|
||||
Mac mac = null;
|
||||
mac = Mac.getInstance("Hmac" + signatureMethod.toUpperCase());
|
||||
//用给定密钥初始化 Mac 对象
|
||||
mac.init(signinKey);
|
||||
//完成 Mac 操作
|
||||
return mac.doFinal(data.getBytes());
|
||||
}
|
||||
|
||||
public enum SignatureMethod {
|
||||
SHA1, MD5, SHA256;
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws UnsupportedEncodingException, NoSuchAlgorithmException, InvalidKeyException {
|
||||
String version = "2022-05-01";
|
||||
String resourceName = "userid/12321";
|
||||
//用户自定义token过期时间
|
||||
String expirationTime = System.currentTimeMillis() / 1000 + 3600 + "";
|
||||
String signatureMethod = SignatureMethod.SHA1.name().toLowerCase();
|
||||
String accessKey = "KuF3NT/jUBJ62LNBB/A8XZA9CqS3Cu79B/ABmfA1UCw=";
|
||||
String token = assembleToken(version, resourceName, expirationTime, signatureMethod, accessKey);
|
||||
System.out.println("Authorization:" + token);
|
||||
}
|
||||
}
|
59
src/main/java/com/ruoyi/project/hit/util/Util1.java
Normal file
59
src/main/java/com/ruoyi/project/hit/util/Util1.java
Normal file
@ -0,0 +1,59 @@
|
||||
package com.ruoyi.project.hit.util;
|
||||
|
||||
import com.ruoyi.project.hit.domain.PupuUpsHistory;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
public class Util1 {
|
||||
public static Map<Integer, Long> upsMap;
|
||||
public static String getdetail() throws IOException {
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
Request request = new Request.Builder()
|
||||
.url("https://iot-api.heclouds.com/thingmodel/query-device-property?product_id=Tz9a5iUEkS&device_name=shante")
|
||||
.addHeader("Authorization", "version=2022-05-01&res=products%2FTz9a5iUEkS%2Fdevices%2Fshante&et=2079998482&method=md5&sign=Gf925YWwSO7SAlOKY98l2Q%3D%3D")
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
return (response.body().string());
|
||||
}
|
||||
|
||||
public static String convertToCamelCase(String input) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
boolean nextUpperCase = false;
|
||||
|
||||
for (char c : input.toCharArray()) {
|
||||
if (c == '_') {
|
||||
nextUpperCase = true;
|
||||
} else if (nextUpperCase) {
|
||||
result.append(Character.toUpperCase(c));
|
||||
nextUpperCase = false;
|
||||
} else {
|
||||
result.append(c);
|
||||
}
|
||||
}
|
||||
|
||||
// 如果字符串以下划线开头,则结果需要首字母大写
|
||||
if (Character.isLowerCase(result.charAt(0)) && input.startsWith("_")) {
|
||||
result.setCharAt(0, Character.toUpperCase(result.charAt(0)));
|
||||
}
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
//将map转为需要的pupuUpsHistory对象
|
||||
public static PupuUpsHistory getHistoryFromMap(Map<String, Object> map) {
|
||||
PupuUpsHistory history=null;
|
||||
|
||||
history = new PupuUpsHistory(null,(String) map.get("identifier"),new Date((Long) map.get("time")) ,
|
||||
(String) map.get("value"),(String) map.get("data_type"),(String) map.get("name"),(String) map.get("access_mode"));
|
||||
upsMap.put(history.getUpsId(),(Long) map.get("time"));
|
||||
return history;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.ruoyi.project.hit.util.webSocket;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.socket.config.annotation.EnableWebSocket;
|
||||
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
|
||||
|
||||
@Configuration
|
||||
@EnableWebSocket
|
||||
public class WebSocketConfig {
|
||||
@Bean
|
||||
public ServerEndpointExporter serverEndpoint() {
|
||||
return new ServerEndpointExporter();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,99 @@
|
||||
package com.ruoyi.project.hit.util.webSocket;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.websocket.*;
|
||||
import javax.websocket.server.PathParam;
|
||||
import javax.websocket.server.ServerEndpoint;
|
||||
import java.io.IOException;
|
||||
import java.time.Instant;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@ServerEndpoint("/echo/{id}")
|
||||
@Component
|
||||
public class WsServerEndpoint {
|
||||
public static Map<String,WsServerEndpoint> wsServerEndpointMap = new ConcurrentHashMap<>();
|
||||
|
||||
private Session session;
|
||||
|
||||
private String id;
|
||||
// 收到消息
|
||||
@OnMessage
|
||||
public void onMessage(String message) throws Exception {
|
||||
JSONObject jsonObject = JSONObject.parseObject(message);
|
||||
String id= (String) jsonObject.get("id");
|
||||
String msg=(String) jsonObject.get("msg");
|
||||
|
||||
if (message.equalsIgnoreCase("bye")) {
|
||||
// 由服务器主动关闭连接。状态码为 NORMAL_CLOSURE(正常关闭)。
|
||||
this.session.close(new CloseReason(CloseReason.CloseCodes.NORMAL_CLOSURE, "Bye"));;
|
||||
return;
|
||||
}
|
||||
if(id!=null)
|
||||
{
|
||||
if("-1".equals(id))
|
||||
{
|
||||
sendAllUser("1");
|
||||
}
|
||||
else {
|
||||
sendToUser(id, msg);
|
||||
}
|
||||
}
|
||||
|
||||
// this.session.getAsyncRemote().sendText("["+ Instant.now().toEpochMilli() +"] Hello " + message);
|
||||
}
|
||||
|
||||
// 连接打开
|
||||
@OnOpen
|
||||
public void onOpen(@PathParam(value = "id") String id, Session session, EndpointConfig endpointConfig){
|
||||
System.out.println("开启连接");
|
||||
// 保存 session 到对象
|
||||
this.session = session;
|
||||
this.id = id;
|
||||
wsServerEndpointMap.put(id,this);
|
||||
System.out.println(wsServerEndpointMap.toString());
|
||||
}
|
||||
|
||||
// 连接关闭
|
||||
@OnClose
|
||||
public void onClose(CloseReason closeReason){
|
||||
wsServerEndpointMap.remove(this);
|
||||
System.out.println("断开连接");
|
||||
}
|
||||
|
||||
// 连接异常
|
||||
@OnError
|
||||
public void onError(Throwable throwable) throws IOException {
|
||||
System.out.println(throwable);
|
||||
// 关闭连接。状态码为 UNEXPECTED_CONDITION(意料之外的异常)
|
||||
this.session.close(new CloseReason(CloseReason.CloseCodes.UNEXPECTED_CONDITION, throwable.getMessage()));
|
||||
}
|
||||
|
||||
public void sendMessage(String message) throws Exception {
|
||||
this.session.getAsyncRemote().sendText(message);
|
||||
}
|
||||
public void sendToUser(String id, String message) throws Exception {
|
||||
if(wsServerEndpointMap.containsKey(id)){
|
||||
wsServerEndpointMap.get(id).session.getAsyncRemote().sendText(message);
|
||||
}
|
||||
}
|
||||
public void sendAllUser(String message) throws Exception{
|
||||
for (String s : wsServerEndpointMap.keySet()) {
|
||||
wsServerEndpointMap.get(s).sendMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(wsServerEndpointMap.toString());
|
||||
try {
|
||||
wsServerEndpointMap.get("1").sendMessage("000");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
package com.ruoyi.project.uniapp.controller;
|
||||
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
import com.ruoyi.project.hit.domain.CardGame;
|
||||
import com.ruoyi.project.hit.domain.CardUser;
|
||||
import com.ruoyi.project.hit.service.CardGameService;
|
||||
import com.ruoyi.project.hit.service.CardUserHitService;
|
||||
import com.ruoyi.project.hit.service.CardUserService;
|
||||
import com.ruoyi.project.uniapp.controller.vo.CardUserGameVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.xml.crypto.Data;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@EnableScheduling
|
||||
@RestController
|
||||
@RequestMapping("/uniapp/bonus")
|
||||
public class BonusController extends BaseController {
|
||||
@Autowired
|
||||
private CardUserService cardUserService;
|
||||
@Autowired
|
||||
private CardGameService cardGameService;
|
||||
@Autowired
|
||||
private CardUserHitService cardUserHitService;
|
||||
|
||||
|
||||
|
||||
@GetMapping("/showAllCardGame")
|
||||
public TableDataInfo showAllCardGame(){
|
||||
startPage();
|
||||
List<HashMap> list = cardGameService.showAllCardGame();
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 活动详情
|
||||
* @param gameId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/getGameDetail/{gameId}")
|
||||
public AjaxResult getGameDetail(@PathVariable(value = "gameId")Integer gameId){
|
||||
return AjaxResult.success(cardGameService.getGameDetail(gameId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 抽奖业务
|
||||
* @param cardUserGameVo
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/getPrizeDraw")
|
||||
public AjaxResult getPrizeDraw(@RequestBody CardUserGameVo cardUserGameVo){
|
||||
return AjaxResult.success(cardUserHitService.getPrizeDraw(cardUserGameVo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 活动预热
|
||||
*/
|
||||
@Scheduled(fixedRate = 60000)
|
||||
public void preHot(){
|
||||
Date now=new Date();
|
||||
cardGameService.preHot(now);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package com.ruoyi.project.uniapp.controller;
|
||||
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
import com.ruoyi.project.hit.domain.CardGame;
|
||||
import com.ruoyi.project.hit.service.CardGameService;
|
||||
import com.ruoyi.project.hit.service.CardSaleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/uniapp/homePage")
|
||||
public class HomePageController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private CardGameService cardGameService;
|
||||
@Autowired
|
||||
private CardSaleService cardSaleService;
|
||||
/**
|
||||
* 主页轮播图
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/carousel")
|
||||
public AjaxResult carousel(){
|
||||
List<CardGame> carousel = cardGameService.carousel();
|
||||
return AjaxResult.success(carousel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 热度榜单
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getHotSale")
|
||||
public AjaxResult getHotSale(){
|
||||
return AjaxResult.success(cardSaleService.getHotSale());
|
||||
}
|
||||
|
||||
@GetMapping("/getAllHotSale")
|
||||
public AjaxResult getAllHotSale(){
|
||||
return AjaxResult.success(cardSaleService.getAllHotSale());
|
||||
}
|
||||
|
||||
/**
|
||||
* 点击(热度增加)
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/addHotSaleNum/{saleId}")
|
||||
public AjaxResult addHotSaleNum(@PathVariable(value = "saleId")Integer id){
|
||||
cardSaleService.addHotSaleNum(id);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
package com.ruoyi.project.uniapp.controller;
|
||||
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
import com.ruoyi.project.hit.domain.CardUser;
|
||||
import com.ruoyi.project.hit.service.CardUserHitService;
|
||||
import com.ruoyi.project.hit.service.CardUserService;
|
||||
import com.ruoyi.project.uniapp.controller.vo.CardUserVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/uniapp/personalCenter")
|
||||
public class PersonalCenterController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private CardUserService cardUserService;
|
||||
@Autowired
|
||||
private CardUserHitService cardUserHitService;
|
||||
|
||||
@PostMapping("/login")
|
||||
public AjaxResult login(@RequestBody @Valid CardUserVo cardUser){
|
||||
CardUser user = cardUserService.login(cardUser.getUserName(), cardUser.getUserPass());
|
||||
return AjaxResult.success("登录成功",user);
|
||||
}
|
||||
|
||||
@PostMapping("/addCardUser")
|
||||
public AjaxResult addCardUser(@Valid @RequestBody CardUser cardUser){
|
||||
return toAjax(cardUserService.addCardUser(cardUser));
|
||||
}
|
||||
|
||||
@GetMapping("/winnerRecord/{userId}")
|
||||
public AjaxResult getMyWinnerRecord(@PathVariable(value = "userId")Integer userId){
|
||||
return AjaxResult.success(cardUserHitService.winnerRecord(userId));
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
package com.ruoyi.project.uniapp.controller.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.annotation.format.NumberFormat;
|
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class CardProductVo {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private String pname;
|
||||
|
||||
private String pic;
|
||||
|
||||
private String content;
|
||||
|
||||
private BigDecimal price;
|
||||
|
||||
private Integer delState;
|
||||
|
||||
private Integer amount;
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
package com.ruoyi.project.uniapp.controller.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
public class CardUserGameVo {
|
||||
@NotNull(message = "用户id不能为空")
|
||||
private Integer userId;
|
||||
@NotNull(message = "活动id不能为空")
|
||||
private Integer gameId;
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
package com.ruoyi.project.uniapp.controller.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
@Data
|
||||
public class CardUserVo {
|
||||
@NotEmpty(message = "账号不能为空")
|
||||
private String userName;
|
||||
|
||||
@NotEmpty(message = "密码不能为空")
|
||||
private String userPass;
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
package com.ruoyi.project.uniapp.mq;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.ruoyi.project.hit.domain.CardGameUser;
|
||||
import com.ruoyi.project.hit.service.CardGameUserService;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@RabbitListener(queues = "drawRecord")
|
||||
@Component
|
||||
public class Consumer01 {
|
||||
@Resource
|
||||
private CardGameUserService cardGameUserService;
|
||||
|
||||
@RabbitHandler
|
||||
public void addCardGameUser(String cardGameUserStr){
|
||||
CardGameUser cardGameUser= JSON.parseObject(cardGameUserStr,CardGameUser.class);
|
||||
cardGameUserService.addCardGameUser(cardGameUser);
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
package com.ruoyi.project.uniapp.mq;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.ruoyi.project.hit.domain.CardUserHit;
|
||||
import com.ruoyi.project.hit.service.CardUserHitService;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@RabbitListener(queues = "winnerRecord")
|
||||
@Component
|
||||
public class Consumer02 {
|
||||
@Autowired
|
||||
private CardUserHitService cardUserHitService;
|
||||
@RabbitHandler
|
||||
public void addCardUserHit(String cardUserHitStr){
|
||||
CardUserHit cardUserHit= JSON.parseObject(cardUserHitStr,CardUserHit.class);
|
||||
cardUserHitService.addCardUserHit(cardUserHit);
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ spring:
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://localhost:3306/his?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: 123456
|
||||
# 从库数据源
|
||||
|
@ -83,6 +83,10 @@ spring:
|
||||
password: guest
|
||||
username: guest
|
||||
port: 5672
|
||||
task:
|
||||
scheduling:
|
||||
pool:
|
||||
size: 10
|
||||
|
||||
# token配置
|
||||
token:
|
||||
|
@ -1,94 +0,0 @@
|
||||
<?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="com.ruoyi.project.hit.mapper.CardGameMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.ruoyi.project.hit.domain.CardGame">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="title" column="title" jdbcType="VARCHAR"/>
|
||||
<result property="pic" column="pic" jdbcType="VARCHAR"/>
|
||||
<result property="content" column="content" jdbcType="VARCHAR"/>
|
||||
<result property="startTime" column="start_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="endTime" column="end_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="type" column="type" jdbcType="SMALLINT"/>
|
||||
<result property="status" column="status" jdbcType="SMALLINT"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,title,pic,
|
||||
content,start_time,end_time,
|
||||
type,status,create_time,
|
||||
update_time
|
||||
</sql>
|
||||
<select id="selectCardGameList" resultType="java.util.HashMap">
|
||||
SELECT
|
||||
system_dict.dict_value dictValue,
|
||||
card_game.end_time endTime,
|
||||
card_game.start_time startTime,
|
||||
card_game.title,
|
||||
card_game.id
|
||||
FROM
|
||||
card_game
|
||||
INNER JOIN
|
||||
system_dict
|
||||
ON
|
||||
card_game.type = system_dict.dict_key and system_dict.dict_type='gametype'
|
||||
<where>
|
||||
<if test="title!=null and title!=''">
|
||||
card_game.title like concat('%',#{title},'%')
|
||||
</if>
|
||||
<if test="startTime!=null and endTime!=null">
|
||||
and card_game.start_time>=#{startTime} and card_game.end_time <=#{endTime}
|
||||
</if>
|
||||
<if test="type!=null">
|
||||
and type=#{type}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
</select>
|
||||
<select id="getCardGameByGameId" resultType="java.util.HashMap">
|
||||
SELECT
|
||||
system_dict.dict_value `dictValue`,
|
||||
card_game.id,
|
||||
card_game.title,
|
||||
card_game.pic,
|
||||
card_game.content,
|
||||
card_game.start_time AS startTime,
|
||||
card_game.end_time AS endTime
|
||||
FROM
|
||||
card_game
|
||||
INNER JOIN system_dict ON card_game.type = system_dict.dict_key and system_dict.dict_type='gametype'
|
||||
where card_game.id=#{id}
|
||||
</select>
|
||||
<select id="showAllCardGame" resultType="java.util.HashMap">
|
||||
SELECT
|
||||
id,
|
||||
title,
|
||||
start_time,
|
||||
end_time,
|
||||
CASE
|
||||
WHEN NOW() <`start_time` THEN '未开始'
|
||||
WHEN NOW() BETWEEN `start_time` AND `end_time` THEN '进行中'
|
||||
ELSE '已结束'
|
||||
END AS status
|
||||
FROM
|
||||
`card_game`;
|
||||
</select>
|
||||
<select id="getCardByDate" resultType="com.ruoyi.project.hit.domain.CardGame">
|
||||
SELECT * FROM card_game
|
||||
WHERE status = 0
|
||||
AND start_time > #{now}
|
||||
AND start_time <DATE_ADD(#{now}, INTERVAL 5 MINUTE)
|
||||
</select>
|
||||
<select id="getCardGameBygameid" resultType="java.util.HashMap">
|
||||
SELECT cg.id,cg.title,cg.pic,cg.content,cg.start_time startTime,cg.end_time endTime,sd.dict_value dictValue
|
||||
from card_game cg
|
||||
INNER JOIN system_dict sd
|
||||
on cg.type=sd.dict_key
|
||||
where cg.id=#{gameid} and sd.dict_type='gametype'
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -1,49 +0,0 @@
|
||||
<?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="com.ruoyi.project.hit.mapper.CardGameProductMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.ruoyi.project.hit.domain.CardGameProduct">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="gameid" column="gameid" jdbcType="INTEGER"/>
|
||||
<result property="productid" column="productid" jdbcType="INTEGER"/>
|
||||
<result property="amount" column="amount" jdbcType="INTEGER"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,gameid,productid,
|
||||
amount
|
||||
</sql>
|
||||
<select id="getGameProductByGameId" resultType="java.util.HashMap">
|
||||
SELECT
|
||||
card_product.id,
|
||||
card_product.pname,
|
||||
card_game_product.amount
|
||||
FROM
|
||||
card_game_product
|
||||
INNER JOIN card_product ON card_game_product.productid = card_product.id
|
||||
where card_game_product.gameid=#{id}
|
||||
</select>
|
||||
<select id="getSumAmountByGameId" resultType="java.lang.Integer">
|
||||
SELECT IFNULL(SUM(amount),0) FROM `card_game_product` WHERE gameid=#{gameid}
|
||||
</select>
|
||||
<select id="getGameProductList" resultType="com.ruoyi.project.uniapp.controller.vo.CardProductVo">
|
||||
SELECT
|
||||
card_game_product.amount,
|
||||
card_product.id,
|
||||
card_product.pname,
|
||||
card_product.pic,
|
||||
card_product.content,
|
||||
card_product.price,
|
||||
card_product.del_state AS delState
|
||||
FROM
|
||||
card_game_product
|
||||
INNER JOIN
|
||||
card_product
|
||||
ON
|
||||
card_game_product.productid = card_product.id
|
||||
WHERE card_game_product.gameid=#{id}
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -1,34 +0,0 @@
|
||||
<?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="com.ruoyi.project.hit.mapper.CardGameRuleMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.ruoyi.project.hit.domain.CardGameRule">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="gameid" column="gameid" jdbcType="INTEGER"/>
|
||||
<result property="levelid" column="levelid" jdbcType="INTEGER"/>
|
||||
<result property="enterCount" column="enter_count" jdbcType="INTEGER"/>
|
||||
<result property="hitCount" column="hit_count" jdbcType="INTEGER"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,gameid,levelid,
|
||||
enter_count,hit_count
|
||||
</sql>
|
||||
<select id="getGameRuleListByGameId" resultType="java.util.HashMap">
|
||||
SELECT
|
||||
card_game_rule.enter_count enterCount,
|
||||
card_game_rule.hit_count hitCount,
|
||||
card_game_rule.id,
|
||||
system_dict.dict_value dictValue
|
||||
FROM
|
||||
card_game_rule
|
||||
INNER JOIN system_dict ON card_game_rule.levelid = system_dict.dict_key AND system_dict.dict_type='userlevel'
|
||||
WHERE card_game_rule.gameid=#{id}
|
||||
</select>
|
||||
|
||||
<select id="getHitCountSumByGameId" resultType="java.lang.Integer">
|
||||
SELECT IFNULL(SUM(hit_count),0) FROM `card_game_rule` WHERE gameid=#{gameid}
|
||||
</select>
|
||||
</mapper>
|
@ -1,18 +0,0 @@
|
||||
<?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="com.ruoyi.project.hit.mapper.CardGameUserMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.ruoyi.project.hit.domain.CardGameUser">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="userid" column="userid" jdbcType="INTEGER"/>
|
||||
<result property="gameid" column="gameid" jdbcType="INTEGER"/>
|
||||
<result property="createtime" column="createtime" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,userid,gameid,
|
||||
createtime
|
||||
</sql>
|
||||
</mapper>
|
@ -1,20 +0,0 @@
|
||||
<?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="com.ruoyi.project.hit.mapper.CardProductMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.ruoyi.project.hit.domain.CardProduct">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="pname" column="pname" jdbcType="VARCHAR"/>
|
||||
<result property="pic" column="pic" jdbcType="VARCHAR"/>
|
||||
<result property="content" column="content" jdbcType="VARCHAR"/>
|
||||
<result property="price" column="price" jdbcType="DECIMAL"/>
|
||||
<result property="delState" column="del_state" jdbcType="SMALLINT"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,pname,pic,
|
||||
content,price,del_state
|
||||
</sql>
|
||||
</mapper>
|
@ -1,112 +0,0 @@
|
||||
<?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="com.ruoyi.project.hit.mapper.CardUserHitMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.ruoyi.project.hit.domain.CardUserHit">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="gameid" column="gameid" jdbcType="INTEGER"/>
|
||||
<result property="userid" column="userid" jdbcType="INTEGER"/>
|
||||
<result property="productid" column="productid" jdbcType="INTEGER"/>
|
||||
<result property="hittime" column="hittime" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,gameid,userid,
|
||||
productid,hittime
|
||||
</sql>
|
||||
|
||||
<select id="selectCardUserHitInfo" resultType="java.util.HashMap">
|
||||
SELECT cg.id,cg.title,cg.start_time startTime,cg.end_time endTime,sd.dict_value dictValue,IFNULL(t1.sumCount,0) sumCount,IFNULL(t2.hitCount,0) hitCount
|
||||
from card_game cg
|
||||
INNER JOIN system_dict sd
|
||||
on cg.type=sd.dict_key and sd.dict_type='gametype'
|
||||
LEFT JOIN (SELECT cgp.gameid,SUM(cgp.amount) sumCount
|
||||
from card_game_product cgp
|
||||
GROUP BY cgp.gameid) t1
|
||||
on cg.id=t1.gameid
|
||||
LEFT JOIN (SELECT cuh.gameid,COUNT(*) hitCount
|
||||
from card_user_hit cuh
|
||||
GROUP BY cuh.gameid) t2
|
||||
on cg.id=t2.gameid
|
||||
<where>
|
||||
<if test="title!=null and title!=''">
|
||||
cg.title LIKE CONCAT('%',#{title},'%')
|
||||
</if>
|
||||
<if test="startTime!=null and endTime!=null">
|
||||
and cg.start_time>=#{startTime} and cg.end_time <=#{endTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getProductsBygameid" resultType="java.util.HashMap">
|
||||
SELECT cp.id,cp.pname,cgp.amount,IFNULL(cn,0) hitCount
|
||||
FROM card_game_product cgp
|
||||
INNER JOIN card_product cp on cgp.productid=cp.id
|
||||
LEFT JOIN (select cuh.productid,count(*) cn
|
||||
from card_user_hit cuh
|
||||
WHERE cuh.gameid=#{gameid}
|
||||
GROUP BY cuh.productid) t1 on cp.id=t1.productid
|
||||
where cgp.gameid=#{gameid}
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectCardUserHitList" resultType="java.util.HashMap">
|
||||
SELECT
|
||||
card_game.title,
|
||||
card_product.pname,
|
||||
card_product.price,
|
||||
d1.dict_value `level`,
|
||||
card_user.user_name userName,
|
||||
card_user.realname,
|
||||
d2.dict_value types,
|
||||
card_user.phone,
|
||||
card_user.id_card idCard,
|
||||
card_user_hit.hittime
|
||||
FROM
|
||||
card_user_hit
|
||||
INNER JOIN card_game ON card_user_hit.gameid = card_game.id
|
||||
INNER JOIN card_product ON card_user_hit.productid = card_product.id
|
||||
INNER JOIN system_dict d2 ON card_game.type = d2.dict_key
|
||||
AND d2.dict_type = 'gametype'
|
||||
INNER JOIN card_user ON card_user_hit.userid = card_user.id
|
||||
INNER JOIN system_dict d1 ON card_user.`level` = d1.dict_key
|
||||
AND d1.dict_type = 'userlevel'
|
||||
<where>
|
||||
<if test="title!=null and title!=''">
|
||||
and card_game.title LIKE CONCAT('%',#{title},'%')
|
||||
</if>
|
||||
<if test="username!=null and username!=''">
|
||||
and card_user.user_name LIKE CONCAT('%',#{username},'%')
|
||||
</if>
|
||||
<if test="phone!=null and phone!=''">
|
||||
and card_user.phone LIKE CONCAT('%',#{phone},'%')
|
||||
</if>
|
||||
<if test="pname!=null and pname!=''">
|
||||
and card_product.pname LIKE CONCAT('%',#{pname},'%')
|
||||
</if>
|
||||
<if test="startTime!=null and endTime!=null">
|
||||
and card_user_hit.hittime between #{startTime} and #{endTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="winnerRecord" resultType="java.util.HashMap">
|
||||
SELECT
|
||||
card_product.pname,
|
||||
card_user_hit.hittime,
|
||||
card_game.title
|
||||
FROM
|
||||
card_user_hit
|
||||
INNER JOIN
|
||||
card_game
|
||||
ON
|
||||
card_user_hit.gameid = card_game.id
|
||||
INNER JOIN
|
||||
card_product
|
||||
ON
|
||||
card_user_hit.productid = card_product.id
|
||||
WHERE
|
||||
card_user_hit.userid = #{userId}
|
||||
</select>
|
||||
</mapper>
|
@ -1,55 +0,0 @@
|
||||
<?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="com.ruoyi.project.hit.mapper.CardUserMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.ruoyi.project.hit.domain.CardUser">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="userName" column="user_name" jdbcType="VARCHAR"/>
|
||||
<result property="userPass" column="user_pass" jdbcType="VARCHAR"/>
|
||||
<result property="pic" column="pic" jdbcType="VARCHAR"/>
|
||||
<result property="realname" column="realname" jdbcType="VARCHAR"/>
|
||||
<result property="idCard" column="id_card" jdbcType="VARCHAR"/>
|
||||
<result property="phone" column="phone" jdbcType="VARCHAR"/>
|
||||
<result property="level" column="level" jdbcType="SMALLINT"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="delState" column="del_state" jdbcType="INTEGER"/>
|
||||
<!-- <result property="remark" column="remark" jdbcType="VARCHAR"/>-->
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id
|
||||
,user_name,user_pass,
|
||||
pic,realname,id_card,
|
||||
phone,level,create_time,
|
||||
update_time,del_state,remark
|
||||
</sql>
|
||||
|
||||
<select id="selectCardUserList" resultType="java.util.HashMap">
|
||||
SELECT u.id,u.user_name userName,u.pic,u.realname,u.id_card idCard,u.phone,u.create_time createTime,u.update_time updateTime,d.dict_value dictValue
|
||||
FROM `card_user` u,`system_dict` d
|
||||
where u.`level`=d.`dict_key` and d.dict_type='userlevel'
|
||||
<if test="userName!=null and userName!=''">
|
||||
and u.user_name like CONCAT('%',#{userName},'%')
|
||||
</if>
|
||||
<if test="realname!=null and realname!=''">
|
||||
and u.realname like CONCAT('%',#{realname},'%')
|
||||
</if>
|
||||
<if test="idCard!=null and idCard!=''">
|
||||
and u.id_card like CONCAT('%',#{idCard},'%')
|
||||
</if>
|
||||
<if test="phone!=null and phone!=''">
|
||||
and u.phone like CONCAT('%',#{phone},'%')
|
||||
</if>
|
||||
<if test="level!=null and level!=''">
|
||||
and u.`level`=#{level}
|
||||
</if>
|
||||
<if test="startTime!=null and endTime!=null">
|
||||
AND u.create_time BETWEEN #{startTime} and #{endTime}
|
||||
</if>
|
||||
|
||||
|
||||
</select>
|
||||
</mapper>
|
23
src/main/resources/mybatis/hit/PupuUpsHistoryMapper.xml
Normal file
23
src/main/resources/mybatis/hit/PupuUpsHistoryMapper.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<?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="com.ruoyi.project.hit.mapper.PupuUpsHistoryMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.ruoyi.project.hit.domain.PupuUpsHistory">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="upsId" column="ups_id" jdbcType="INTEGER"/>
|
||||
<result property="identifier" column="identifier" jdbcType="VARCHAR"/>
|
||||
<result property="time" column="time" jdbcType="TIMESTAMP"/>
|
||||
<result property="value" column="value" jdbcType="VARCHAR"/>
|
||||
<result property="dataType" column="data_type" jdbcType="VARCHAR"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="accessMode" column="access_mode" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,ups_id,identifier,
|
||||
time,value,data_type,
|
||||
name,access_mode
|
||||
</sql>
|
||||
</mapper>
|
20
src/main/resources/mybatis/hit/PupuUserMapper.xml
Normal file
20
src/main/resources/mybatis/hit/PupuUserMapper.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<?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="com.ruoyi.project.hit.mapper.PupuUserMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.ruoyi.project.hit.domain.PupuUser">
|
||||
<id property="userId" column="user_id" jdbcType="INTEGER"/>
|
||||
<result property="userName" column="user_name" jdbcType="VARCHAR"/>
|
||||
<result property="password" column="password" jdbcType="VARCHAR"/>
|
||||
<result property="gender" column="gender" jdbcType="VARCHAR"/>
|
||||
<result property="pic" column="pic" jdbcType="VARCHAR"/>
|
||||
<result property="status" column="status" jdbcType="INTEGER"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
user_id,user_name,password,
|
||||
gender,pic,status
|
||||
</sql>
|
||||
</mapper>
|
@ -1,22 +0,0 @@
|
||||
<?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="com.ruoyi.project.hit.mapper.SystemDictMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.ruoyi.project.hit.domain.SystemDict">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="dictType" column="dict_type" jdbcType="VARCHAR"/>
|
||||
<result property="dictKey" column="dict_key" jdbcType="VARCHAR"/>
|
||||
<result property="dictValue" column="dict_value" jdbcType="VARCHAR"/>
|
||||
<result property="delState" column="del_state" jdbcType="SMALLINT"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,dict_type,dict_key,
|
||||
dict_value,del_state,create_time,
|
||||
update_time
|
||||
</sql>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user