Commit 85c83213 by 吕明尚

Merge branch 'dev' into test

parents 5ab69429 7a8b7439
package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import share.common.annotation.Log;
import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult;
import share.common.core.page.TableDataInfo;
import share.common.enums.BusinessType;
import share.common.utils.poi.ExcelUtil;
import share.system.domain.LotteryRecordsLog;
import share.system.service.LotteryRecordsLogService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 抽奖记录日志Controller
*
* @author wuwenlong
* @date 2024-11-12
*/
@RestController
@RequestMapping("/system/lotteryRecordsLog")
public class LotteryRecordsLogController extends BaseController {
@Autowired
private LotteryRecordsLogService lotteryRecordsLogService;
/**
* 查询抽奖记录日志列表
*/
@PreAuthorize("@ss.hasPermi('system:lotteryRecordsLog:list')")
@GetMapping("/list")
public TableDataInfo list(LotteryRecordsLog lotteryRecordsLog) {
startPage();
List<LotteryRecordsLog> list = lotteryRecordsLogService.selectLotteryRecordsLogList(lotteryRecordsLog);
return getDataTable(list);
}
/**
* 导出抽奖记录日志列表
*/
@PreAuthorize("@ss.hasPermi('system:lotteryRecordsLog:export')")
@Log(title = "抽奖记录日志", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, LotteryRecordsLog lotteryRecordsLog) {
List<LotteryRecordsLog> list = lotteryRecordsLogService.selectLotteryRecordsLogList(lotteryRecordsLog);
ExcelUtil<LotteryRecordsLog> util = new ExcelUtil<LotteryRecordsLog>(LotteryRecordsLog.class);
util.exportExcel(response, list, "抽奖记录日志数据");
}
/**
* 获取抽奖记录日志详细信息
*/
@PreAuthorize("@ss.hasPermi('system:lotteryRecordsLog:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(lotteryRecordsLogService.selectLotteryRecordsLogById(id));
}
/**
* 新增抽奖记录日志
*/
@PreAuthorize("@ss.hasPermi('system:lotteryRecordsLog:add')")
@Log(title = "抽奖记录日志", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody LotteryRecordsLog lotteryRecordsLog) {
return toAjax(lotteryRecordsLogService.insertLotteryRecordsLog(lotteryRecordsLog));
}
/**
* 修改抽奖记录日志
*/
@PreAuthorize("@ss.hasPermi('system:lotteryRecordsLog:edit')")
@Log(title = "抽奖记录日志", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody LotteryRecordsLog lotteryRecordsLog) {
return toAjax(lotteryRecordsLogService.updateLotteryRecordsLog(lotteryRecordsLog));
}
/**
* 删除抽奖记录日志
*/
@PreAuthorize("@ss.hasPermi('system:lotteryRecordsLog:remove')")
@Log(title = "抽奖记录日志", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(lotteryRecordsLogService.deleteLotteryRecordsLogByIds(ids));
}
}
package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import share.common.annotation.Log;
import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult;
import share.common.core.page.TableDataInfo;
import share.common.enums.BusinessType;
import share.common.utils.poi.ExcelUtil;
import share.system.domain.Prize;
import share.system.service.PrizeService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 奖品Controller
*
* @author wuwenlong
* @date 2024-11-12
*/
@RestController
@RequestMapping("/system/prize")
public class PrizeController extends BaseController {
@Autowired
private PrizeService prizeService;
/**
* 查询奖品列表
*/
@PreAuthorize("@ss.hasPermi('system:prize:list')")
@GetMapping("/list")
public TableDataInfo list(Prize prize) {
startPage();
List<Prize> list = prizeService.selectPrizeList(prize);
return getDataTable(list);
}
/**
* 导出奖品列表
*/
@PreAuthorize("@ss.hasPermi('system:prize:export')")
@Log(title = "奖品", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Prize prize) {
List<Prize> list = prizeService.selectPrizeList(prize);
ExcelUtil<Prize> util = new ExcelUtil<Prize>(Prize.class);
util.exportExcel(response, list, "奖品数据");
}
/**
* 获取奖品详细信息
*/
@PreAuthorize("@ss.hasPermi('system:prize:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(prizeService.selectPrizeById(id));
}
/**
* 新增奖品
*/
@PreAuthorize("@ss.hasPermi('system:prize:add')")
@Log(title = "奖品", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Prize prize) {
return toAjax(prizeService.insertPrize(prize));
}
/**
* 修改奖品
*/
@PreAuthorize("@ss.hasPermi('system:prize:edit')")
@Log(title = "奖品", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Prize prize) {
return toAjax(prizeService.updatePrize(prize));
}
/**
* 删除奖品
*/
@PreAuthorize("@ss.hasPermi('system:prize:remove')")
@Log(title = "奖品", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(prizeService.deletePrizeByIds(ids));
}
}
package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import share.common.annotation.Log;
import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult;
import share.common.core.page.TableDataInfo;
import share.common.enums.BusinessType;
import share.common.utils.poi.ExcelUtil;
import share.system.domain.WheelGame;
import share.system.service.WheelGameService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 转盘游戏Controller
*
* @author wuwenlong
* @date 2024-11-12
*/
@RestController
@RequestMapping("/system/wheelGame")
public class WheelGameController extends BaseController {
@Autowired
private WheelGameService wheelGameService;
/**
* 查询转盘游戏列表
*/
@PreAuthorize("@ss.hasPermi('system:wheelGame:list')")
@GetMapping("/list")
public TableDataInfo list(WheelGame wheelGame) {
startPage();
List<WheelGame> list = wheelGameService.selectWheelGameList(wheelGame);
return getDataTable(list);
}
/**
* 导出转盘游戏列表
*/
@PreAuthorize("@ss.hasPermi('system:wheelGame:export')")
@Log(title = "转盘游戏", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WheelGame wheelGame) {
List<WheelGame> list = wheelGameService.selectWheelGameList(wheelGame);
ExcelUtil<WheelGame> util = new ExcelUtil<WheelGame>(WheelGame.class);
util.exportExcel(response, list, "转盘游戏数据");
}
/**
* 获取转盘游戏详细信息
*/
@PreAuthorize("@ss.hasPermi('system:wheelGame:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(wheelGameService.selectWheelGameById(id));
}
/**
* 新增转盘游戏
*/
@PreAuthorize("@ss.hasPermi('system:wheelGame:add')")
@Log(title = "转盘游戏", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WheelGame wheelGame) {
return toAjax(wheelGameService.insertWheelGame(wheelGame));
}
/**
* 修改转盘游戏
*/
@PreAuthorize("@ss.hasPermi('system:wheelGame:edit')")
@Log(title = "转盘游戏", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WheelGame wheelGame) {
return toAjax(wheelGameService.updateWheelGame(wheelGame));
}
/**
* 删除转盘游戏
*/
@PreAuthorize("@ss.hasPermi('system:wheelGame:remove')")
@Log(title = "转盘游戏", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(wheelGameService.deleteWheelGameByIds(ids));
}
}
package share.system.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import share.common.annotation.Excel;
import share.common.core.domain.BaseEntity;
import java.util.Date;
/**
* 抽奖记录日志对象 s_lottery_records_log
*
* @author wuwenlong
* @date 2024-11-12
*/
@Data
@TableName("s_lottery_records_log")
public class LotteryRecordsLog extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private Long id;
/**
* 游戏id
*/
@Excel(name = "游戏id")
private Long gameId;
/**
* 用户id
*/
@Excel(name = "用户id")
private Long userId;
/**
* 用户名
*/
@Excel(name = "用户名")
private String userName;
/**
* 手机号
*/
@Excel(name = "手机号")
private String phone;
/**
* 抽奖时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "抽奖时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date drawTime;
/**
* 是否中奖 0:未中奖 1:中奖
*/
@Excel(name = "是否中奖 0:未中奖 1:中奖")
private Long isHit;
/**
* 中奖奖品
*/
@Excel(name = "中奖奖品")
private String hitPrize;
/**
* 是否发放 1未发放,2 已发放 3 发放失败
*/
@Excel(name = " 是否发放 1未发放,2 已发放 3 发放失败")
private Long isSend;
/**
* 发放结果
*/
@Excel(name = "发放结果")
private String sendMsg;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("gameId", getGameId())
.append("userId", getUserId())
.append("userName", getUserName())
.append("phone", getPhone())
.append("drawTime", getDrawTime())
.append("isHit", getIsHit())
.append("hitPrize", getHitPrize())
.append("isSend", getIsSend())
.append("sendMsg", getSendMsg())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}
package share.system.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import share.common.annotation.Excel;
import share.common.core.domain.BaseEntity;
/**
* 奖品对象 s_prize
*
* @author wuwenlong
* @date 2024-11-12
*/
@Data
@TableName("s_prize")
public class Prize extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private Long id;
/**
* 游戏id
*/
@Excel(name = "游戏id")
private Long gameId;
/**
* 奖品类型(1优惠券,2商品,3积分,4谢谢参与)
*/
@Excel(name = "奖品类型", readConverterExp = "1=优惠券,2商品,3积分,4谢谢参与")
private String prizeType;
/**
* 奖品名字
*/
@Excel(name = "奖品名字")
private String prizeName;
/**
* 奖品值(数量)
*/
@Excel(name = "奖品值", readConverterExp = "数=量")
private Long prizeValue;
/**
* 当前命中
*/
@Excel(name = "当前命中")
private Long currentNum;
/**
* 最大中奖数 0:代表不限制
*/
@Excel(name = "最大中奖数 0:代表不限制")
private Long maxNum;
/**
* 中奖几率
*/
@Excel(name = "中奖几率")
private Long ratio;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("gameId", getGameId())
.append("prizeType", getPrizeType())
.append("prizeName", getPrizeName())
.append("prizeValue", getPrizeValue())
.append("currentNum", getCurrentNum())
.append("maxNum", getMaxNum())
.append("ratio", getRatio())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}
package share.system.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import share.common.annotation.Excel;
import share.common.core.domain.BaseEntity;
import java.util.Date;
/**
* 转盘游戏对象 s_wheel_game
*
* @author wuwenlong
* @date 2024-11-12
*/
@Data
@TableName("s_wheel_game")
public class WheelGame extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private Long id;
/**
* 活动名称
*/
@Excel(name = "活动名称")
private String name;
/**
* 开始时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date startTime;
/**
* 结束时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date endTime;
/**
* 描述
*/
@Excel(name = "描述")
private String description;
/**
* 单人当天限制次数 0:代表不限制
*/
@Excel(name = "单人当天限制次数 0:代表不限制")
private Long dayLimit;
/**
* 单人总次数限制 0:代表不限制
*/
@Excel(name = "单人总次数限制 0:代表不限制")
private Long singleLimit;
/**
* 是否开启1 开启 0 关闭
*/
@Excel(name = "是否开启1 开启 0 关闭")
private Long isOpen;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("startTime", getStartTime())
.append("endTime", getEndTime())
.append("description", getDescription())
.append("dayLimit", getDayLimit())
.append("singleLimit", getSingleLimit())
.append("isOpen", getIsOpen())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}
...@@ -2,6 +2,7 @@ package share.system.domain; ...@@ -2,6 +2,7 @@ package share.system.domain;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic; import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
...@@ -18,6 +19,7 @@ import java.util.Date; ...@@ -18,6 +19,7 @@ import java.util.Date;
* @date 2024-08-28 * @date 2024-08-28
*/ */
@Data @Data
@TableName("s_withdraw_log")
public class WithdrawLog extends BaseEntity public class WithdrawLog extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
package share.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import share.system.domain.LotteryRecordsLog;
import java.util.List;
/**
* 抽奖记录日志Mapper接口
*
* @author wuwenlong
* @date 2024-11-12
*/
public interface LotteryRecordsLogMapper extends BaseMapper<LotteryRecordsLog> {
/**
* 查询抽奖记录日志
*
* @param id 抽奖记录日志主键
* @return 抽奖记录日志
*/
public LotteryRecordsLog selectLotteryRecordsLogById(Long id);
/**
* 查询抽奖记录日志列表
*
* @param lotteryRecordsLog 抽奖记录日志
* @return 抽奖记录日志集合
*/
public List<LotteryRecordsLog> selectLotteryRecordsLogList(LotteryRecordsLog lotteryRecordsLog);
/**
* 新增抽奖记录日志
*
* @param lotteryRecordsLog 抽奖记录日志
* @return 结果
*/
public int insertLotteryRecordsLog(LotteryRecordsLog lotteryRecordsLog);
/**
* 修改抽奖记录日志
*
* @param lotteryRecordsLog 抽奖记录日志
* @return 结果
*/
public int updateLotteryRecordsLog(LotteryRecordsLog lotteryRecordsLog);
/**
* 删除抽奖记录日志
*
* @param id 抽奖记录日志主键
* @return 结果
*/
public int deleteLotteryRecordsLogById(Long id);
/**
* 批量删除抽奖记录日志
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteLotteryRecordsLogByIds(Long[] ids);
}
package share.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import share.system.domain.Prize;
import java.util.List;
/**
* 奖品Mapper接口
*
* @author wuwenlong
* @date 2024-11-12
*/
public interface PrizeMapper extends BaseMapper<Prize> {
/**
* 查询奖品
*
* @param id 奖品主键
* @return 奖品
*/
public Prize selectPrizeById(Long id);
/**
* 查询奖品列表
*
* @param prize 奖品
* @return 奖品集合
*/
public List<Prize> selectPrizeList(Prize prize);
/**
* 新增奖品
*
* @param prize 奖品
* @return 结果
*/
public int insertPrize(Prize prize);
/**
* 修改奖品
*
* @param prize 奖品
* @return 结果
*/
public int updatePrize(Prize prize);
/**
* 删除奖品
*
* @param id 奖品主键
* @return 结果
*/
public int deletePrizeById(Long id);
/**
* 批量删除奖品
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deletePrizeByIds(Long[] ids);
}
package share.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import share.system.domain.WheelGame;
import java.util.List;
/**
* 转盘游戏Mapper接口
*
* @author wuwenlong
* @date 2024-11-12
*/
public interface WheelGameMapper extends BaseMapper<WheelGame> {
/**
* 查询转盘游戏
*
* @param id 转盘游戏主键
* @return 转盘游戏
*/
public WheelGame selectWheelGameById(Long id);
/**
* 查询转盘游戏列表
*
* @param wheelGame 转盘游戏
* @return 转盘游戏集合
*/
public List<WheelGame> selectWheelGameList(WheelGame wheelGame);
/**
* 新增转盘游戏
*
* @param wheelGame 转盘游戏
* @return 结果
*/
public int insertWheelGame(WheelGame wheelGame);
/**
* 修改转盘游戏
*
* @param wheelGame 转盘游戏
* @return 结果
*/
public int updateWheelGame(WheelGame wheelGame);
/**
* 删除转盘游戏
*
* @param id 转盘游戏主键
* @return 结果
*/
public int deleteWheelGameById(Long id);
/**
* 批量删除转盘游戏
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteWheelGameByIds(Long[] ids);
}
package share.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.LotteryRecordsLog;
import java.util.List;
/**
* 抽奖记录日志Service接口
*
* @author wuwenlong
* @date 2024-11-12
*/
public interface LotteryRecordsLogService extends IService<LotteryRecordsLog> {
/**
* 查询抽奖记录日志
*
* @param id 抽奖记录日志主键
* @return 抽奖记录日志
*/
public LotteryRecordsLog selectLotteryRecordsLogById(Long id);
/**
* 查询抽奖记录日志列表
*
* @param lotteryRecordsLog 抽奖记录日志
* @return 抽奖记录日志集合
*/
public List<LotteryRecordsLog> selectLotteryRecordsLogList(LotteryRecordsLog lotteryRecordsLog);
/**
* 新增抽奖记录日志
*
* @param lotteryRecordsLog 抽奖记录日志
* @return 结果
*/
public int insertLotteryRecordsLog(LotteryRecordsLog lotteryRecordsLog);
/**
* 修改抽奖记录日志
*
* @param lotteryRecordsLog 抽奖记录日志
* @return 结果
*/
public int updateLotteryRecordsLog(LotteryRecordsLog lotteryRecordsLog);
/**
* 批量删除抽奖记录日志
*
* @param ids 需要删除的抽奖记录日志主键集合
* @return 结果
*/
public int deleteLotteryRecordsLogByIds(Long[] ids);
/**
* 删除抽奖记录日志信息
*
* @param id 抽奖记录日志主键
* @return 结果
*/
public int deleteLotteryRecordsLogById(Long id);
}
package share.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.Prize;
import java.util.List;
/**
* 奖品Service接口
*
* @author wuwenlong
* @date 2024-11-12
*/
public interface PrizeService extends IService<Prize> {
/**
* 查询奖品
*
* @param id 奖品主键
* @return 奖品
*/
public Prize selectPrizeById(Long id);
/**
* 查询奖品列表
*
* @param prize 奖品
* @return 奖品集合
*/
public List<Prize> selectPrizeList(Prize prize);
/**
* 新增奖品
*
* @param prize 奖品
* @return 结果
*/
public int insertPrize(Prize prize);
/**
* 修改奖品
*
* @param prize 奖品
* @return 结果
*/
public int updatePrize(Prize prize);
/**
* 批量删除奖品
*
* @param ids 需要删除的奖品主键集合
* @return 结果
*/
public int deletePrizeByIds(Long[] ids);
/**
* 删除奖品信息
*
* @param id 奖品主键
* @return 结果
*/
public int deletePrizeById(Long id);
}
package share.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.WheelGame;
import java.util.List;
/**
* 转盘游戏Service接口
*
* @author wuwenlong
* @date 2024-11-12
*/
public interface WheelGameService extends IService<WheelGame> {
/**
* 查询转盘游戏
*
* @param id 转盘游戏主键
* @return 转盘游戏
*/
public WheelGame selectWheelGameById(Long id);
/**
* 查询转盘游戏列表
*
* @param wheelGame 转盘游戏
* @return 转盘游戏集合
*/
public List<WheelGame> selectWheelGameList(WheelGame wheelGame);
/**
* 新增转盘游戏
*
* @param wheelGame 转盘游戏
* @return 结果
*/
public int insertWheelGame(WheelGame wheelGame);
/**
* 修改转盘游戏
*
* @param wheelGame 转盘游戏
* @return 结果
*/
public int updateWheelGame(WheelGame wheelGame);
/**
* 批量删除转盘游戏
*
* @param ids 需要删除的转盘游戏主键集合
* @return 结果
*/
public int deleteWheelGameByIds(Long[] ids);
/**
* 删除转盘游戏信息
*
* @param id 转盘游戏主键
* @return 结果
*/
public int deleteWheelGameById(Long id);
}
...@@ -46,6 +46,8 @@ public class ConsumerMonthlyCardServiceImpl extends ServiceImpl<ConsumerMonthlyC ...@@ -46,6 +46,8 @@ public class ConsumerMonthlyCardServiceImpl extends ServiceImpl<ConsumerMonthlyC
private IPackService packService; private IPackService packService;
@Autowired @Autowired
private ISRoomService roomService; private ISRoomService roomService;
@Autowired
private ConsumerWalletService consumerWalletService;
/** /**
* 查询用户月卡 * 查询用户月卡
...@@ -128,12 +130,14 @@ public class ConsumerMonthlyCardServiceImpl extends ServiceImpl<ConsumerMonthlyC ...@@ -128,12 +130,14 @@ public class ConsumerMonthlyCardServiceImpl extends ServiceImpl<ConsumerMonthlyC
SConsumer user = sConsumerService.getInfo(); SConsumer user = sConsumerService.getInfo();
ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, user.getId()).eq(ConsumerMember::getIsRights ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, user.getId()).eq(ConsumerMember::getIsRights
, YesNoEnum.yes.getIndex())); , YesNoEnum.yes.getIndex()));
ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>().eq(ConsumerWallet::getConsumerId, user.getId()));
ConsumerMonthlyCard consumerMonthlyCard = null; ConsumerMonthlyCard consumerMonthlyCard = null;
List<ConsumerSecondaryCard> consumerSecondaryCard = null; List<ConsumerSecondaryCard> consumerSecondaryCard = null;
MonthlyCardResponse map = new MonthlyCardResponse(); MonthlyCardResponse map = new MonthlyCardResponse();
List<ConsumerMonthlyCard> consumerMonthlyCardList = new ArrayList<>(); List<ConsumerMonthlyCard> consumerMonthlyCardList = new ArrayList<>();
List<ConsumerSecondaryCard> consumerSecondaryCardList = new ArrayList<>(); List<ConsumerSecondaryCard> consumerSecondaryCardList = new ArrayList<>();
//可用时长
BigDecimal freeDuration = consumerWallet.getRemainingDuration();
if (ObjectUtil.isNotEmpty(consumerMember)) { if (ObjectUtil.isNotEmpty(consumerMember)) {
SRoom room = roomService.getById(monthlyCardRequest.getRoomId()); SRoom room = roomService.getById(monthlyCardRequest.getRoomId());
consumerMonthlyCard = baseMapper.selectOne(new LambdaQueryWrapper<ConsumerMonthlyCard>().eq(ConsumerMonthlyCard::getConsumerId, user.getId()).gt(ConsumerMonthlyCard::getFreeDuration, 0)); consumerMonthlyCard = baseMapper.selectOne(new LambdaQueryWrapper<ConsumerMonthlyCard>().eq(ConsumerMonthlyCard::getConsumerId, user.getId()).gt(ConsumerMonthlyCard::getFreeDuration, 0));
...@@ -142,6 +146,7 @@ public class ConsumerMonthlyCardServiceImpl extends ServiceImpl<ConsumerMonthlyC ...@@ -142,6 +146,7 @@ public class ConsumerMonthlyCardServiceImpl extends ServiceImpl<ConsumerMonthlyC
.gt(ConsumerSecondaryCard::getNumber, 0) .gt(ConsumerSecondaryCard::getNumber, 0)
.orderByAsc(ConsumerSecondaryCard::getNumber) .orderByAsc(ConsumerSecondaryCard::getNumber)
); );
freeDuration = freeDuration.add(consumerMonthlyCard.getFreeDuration());
if (!ObjectUtils.isEmpty(monthlyCardRequest.getRoomLabelId())) { if (!ObjectUtils.isEmpty(monthlyCardRequest.getRoomLabelId())) {
RoomLabel roomLabel = roomLabelService.selectRoomLabelById(monthlyCardRequest.getRoomLabelId()); RoomLabel roomLabel = roomLabelService.selectRoomLabelById(monthlyCardRequest.getRoomLabelId());
Label label = labelService.getById(roomLabel.getLabelId()); Label label = labelService.getById(roomLabel.getLabelId());
...@@ -179,7 +184,7 @@ public class ConsumerMonthlyCardServiceImpl extends ServiceImpl<ConsumerMonthlyC ...@@ -179,7 +184,7 @@ public class ConsumerMonthlyCardServiceImpl extends ServiceImpl<ConsumerMonthlyC
} }
}); });
} }
if (ObjectUtil.isNotEmpty(consumerMonthlyCard) && consumerMonthlyCard.getFreeDuration().compareTo(new BigDecimal(byId.getDuration())) >= 0) { if (ObjectUtil.isNotEmpty(consumerMonthlyCard) && freeDuration.compareTo(new BigDecimal(byId.getDuration())) >= 0) {
consumerMonthlyCardList.add(consumerMonthlyCard); consumerMonthlyCardList.add(consumerMonthlyCard);
map.setConsumerMonthlyCard(consumerMonthlyCardList); map.setConsumerMonthlyCard(consumerMonthlyCardList);
} }
...@@ -218,7 +223,7 @@ public class ConsumerMonthlyCardServiceImpl extends ServiceImpl<ConsumerMonthlyC ...@@ -218,7 +223,7 @@ public class ConsumerMonthlyCardServiceImpl extends ServiceImpl<ConsumerMonthlyC
} }
}); });
} }
if (ObjectUtil.isNotEmpty(consumerMonthlyCard) && consumerMonthlyCard.getFreeDuration().compareTo(new BigDecimal(pack.getDuration())) >= 0) { if (ObjectUtil.isNotEmpty(consumerMonthlyCard) && freeDuration.compareTo(new BigDecimal(pack.getDuration())) >= 0) {
consumerMonthlyCardList.add(consumerMonthlyCard); consumerMonthlyCardList.add(consumerMonthlyCard);
map.setConsumerMonthlyCard(consumerMonthlyCardList); map.setConsumerMonthlyCard(consumerMonthlyCardList);
} }
......
package share.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.utils.DateUtils;
import share.system.domain.LotteryRecordsLog;
import share.system.mapper.LotteryRecordsLogMapper;
import share.system.service.LotteryRecordsLogService;
import java.util.List;
/**
* 抽奖记录日志Service业务层处理
*
* @author wuwenlong
* @date 2024-11-12
*/
@Service
public class LotteryRecordsLogServiceImpl extends ServiceImpl<LotteryRecordsLogMapper, LotteryRecordsLog> implements LotteryRecordsLogService {
@Autowired
private LotteryRecordsLogMapper lotteryRecordsLogMapper;
/**
* 查询抽奖记录日志
*
* @param id 抽奖记录日志主键
* @return 抽奖记录日志
*/
@Override
public LotteryRecordsLog selectLotteryRecordsLogById(Long id) {
return lotteryRecordsLogMapper.selectLotteryRecordsLogById(id);
}
/**
* 查询抽奖记录日志列表
*
* @param lotteryRecordsLog 抽奖记录日志
* @return 抽奖记录日志
*/
@Override
public List<LotteryRecordsLog> selectLotteryRecordsLogList(LotteryRecordsLog lotteryRecordsLog) {
return lotteryRecordsLogMapper.selectLotteryRecordsLogList(lotteryRecordsLog);
}
/**
* 新增抽奖记录日志
*
* @param lotteryRecordsLog 抽奖记录日志
* @return 结果
*/
@Override
public int insertLotteryRecordsLog(LotteryRecordsLog lotteryRecordsLog) {
lotteryRecordsLog.setCreateTime(DateUtils.getNowDate());
return lotteryRecordsLogMapper.insertLotteryRecordsLog(lotteryRecordsLog);
}
/**
* 修改抽奖记录日志
*
* @param lotteryRecordsLog 抽奖记录日志
* @return 结果
*/
@Override
public int updateLotteryRecordsLog(LotteryRecordsLog lotteryRecordsLog) {
lotteryRecordsLog.setUpdateTime(DateUtils.getNowDate());
return lotteryRecordsLogMapper.updateLotteryRecordsLog(lotteryRecordsLog);
}
/**
* 批量删除抽奖记录日志
*
* @param ids 需要删除的抽奖记录日志主键
* @return 结果
*/
@Override
public int deleteLotteryRecordsLogByIds(Long[] ids) {
return lotteryRecordsLogMapper.deleteLotteryRecordsLogByIds(ids);
}
/**
* 删除抽奖记录日志信息
*
* @param id 抽奖记录日志主键
* @return 结果
*/
@Override
public int deleteLotteryRecordsLogById(Long id) {
return lotteryRecordsLogMapper.deleteLotteryRecordsLogById(id);
}
}
package share.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.utils.DateUtils;
import share.system.domain.Prize;
import share.system.mapper.PrizeMapper;
import share.system.service.PrizeService;
import java.util.List;
/**
* 奖品Service业务层处理
*
* @author wuwenlong
* @date 2024-11-12
*/
@Service
public class PrizeServiceImpl extends ServiceImpl<PrizeMapper, Prize> implements PrizeService {
@Autowired
private PrizeMapper prizeMapper;
/**
* 查询奖品
*
* @param id 奖品主键
* @return 奖品
*/
@Override
public Prize selectPrizeById(Long id) {
return prizeMapper.selectPrizeById(id);
}
/**
* 查询奖品列表
*
* @param prize 奖品
* @return 奖品
*/
@Override
public List<Prize> selectPrizeList(Prize prize) {
return prizeMapper.selectPrizeList(prize);
}
/**
* 新增奖品
*
* @param prize 奖品
* @return 结果
*/
@Override
public int insertPrize(Prize prize) {
prize.setCreateTime(DateUtils.getNowDate());
return prizeMapper.insertPrize(prize);
}
/**
* 修改奖品
*
* @param prize 奖品
* @return 结果
*/
@Override
public int updatePrize(Prize prize) {
prize.setUpdateTime(DateUtils.getNowDate());
return prizeMapper.updatePrize(prize);
}
/**
* 批量删除奖品
*
* @param ids 需要删除的奖品主键
* @return 结果
*/
@Override
public int deletePrizeByIds(Long[] ids) {
return prizeMapper.deletePrizeByIds(ids);
}
/**
* 删除奖品信息
*
* @param id 奖品主键
* @return 结果
*/
@Override
public int deletePrizeById(Long id) {
return prizeMapper.deletePrizeById(id);
}
}
...@@ -528,11 +528,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -528,11 +528,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
//退款 //退款
if (sOrder.getPayType().equals(PayTypeEnum.WECHAT.getCode())) { if (sOrder.getPayType().equals(PayTypeEnum.WECHAT.getCode())) {
try { try {
if (!ObjectUtils.isEmpty(sOrder.getMonthlyCardId()) || !ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) { if (!ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) {
refundExtracted(consumerMonthlyCard, sOrder, consumerSecondaryCard); refundExtracted(sOrder, consumerSecondaryCard);
} else {
refundExtracted(consumerWallet, sOrder, consumerMember);
} }
refundExtracted(consumerWallet, sOrder, consumerMember, consumerMonthlyCard);
orderRefundService.refundOp(request, sOrder); orderRefundService.refundOp(request, sOrder);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
...@@ -540,11 +539,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -540,11 +539,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
} }
} }
} else { } else {
if (!ObjectUtils.isEmpty(sOrder.getMonthlyCardId()) || !ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) { if (!ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) {
refundExtracted(consumerMonthlyCard, sOrder, consumerSecondaryCard); refundExtracted(sOrder, consumerSecondaryCard);
} else {
refundExtracted(consumerWallet, sOrder, consumerMember);
} }
refundExtracted(consumerWallet, sOrder, consumerMember, consumerMonthlyCard);
sOrder.setStatus(OrderStatusEnum.CANCEL.getCode()); sOrder.setStatus(OrderStatusEnum.CANCEL.getCode());
sOrder.setRefundStatus(RefundStatusEnum.REFUNDED.getCode()); sOrder.setRefundStatus(RefundStatusEnum.REFUNDED.getCode());
sOrder.setRefundReasonTime(cn.hutool.core.date.DateUtil.date()); sOrder.setRefundReasonTime(cn.hutool.core.date.DateUtil.date());
...@@ -992,10 +990,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -992,10 +990,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
response.setOrderNo(sOrder.getOrderNo()); response.setOrderNo(sOrder.getOrderNo());
sOrder.setPayStatus(YesNoEnum.yes.getIndex()); sOrder.setPayStatus(YesNoEnum.yes.getIndex());
sOrder.setPayTime(DateUtils.getNowDate()); sOrder.setPayTime(DateUtils.getNowDate());
if (!ObjectUtils.isEmpty(request.getMonthlyCardId()) || !ObjectUtils.isEmpty(request.getSecondaryCardId())) { if (!ObjectUtils.isEmpty(request.getSecondaryCardId())) {
creatExtracted(consumerMonthlyCard, sOrder, consumerSecondaryCard); creatExtracted(sOrder, consumerSecondaryCard);
} }
creatExtracted(consumerWallet, sOrder, consumerMember); creatExtracted(consumerWallet, sOrder, consumerMember, consumerMonthlyCard);
} else { } else {
// response = orderPayService.payment(sOrder); // response = orderPayService.payment(sOrder);
// 扫呗聚合支付 // 扫呗聚合支付
...@@ -1129,9 +1127,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1129,9 +1127,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
} }
} }
private void creatExtracted(ConsumerWallet consumerWallet, SOrder sOrder, ConsumerMember consumerMember) { private void creatExtracted(ConsumerWallet consumerWallet, SOrder sOrder, ConsumerMember consumerMember, ConsumerMonthlyCard consumerMonthlyCard) {
if (ObjectUtil.isNotEmpty(consumerWallet)) { if (ObjectUtil.isNotEmpty(consumerWallet)) {
if (ObjectUtil.isNotEmpty(sOrder.getDuration()) && sOrder.getDuration().compareTo(BigDecimal.ZERO) > 0 && ObjectUtil.isEmpty(sOrder.getMonthlyCardId())) {
if (ObjectUtil.isNotEmpty(sOrder.getDuration()) && sOrder.getDuration().compareTo(BigDecimal.ZERO) > 0) {
if (ObjectUtil.isEmpty(sOrder.getMonthlyCardId())) {
DurationLog durationLog = new DurationLog(); DurationLog durationLog = new DurationLog();
durationLog.setConsumerId(sOrder.getConsumerId()); durationLog.setConsumerId(sOrder.getConsumerId());
durationLog.setVariableDuration(sOrder.getDuration()); durationLog.setVariableDuration(sOrder.getDuration());
...@@ -1143,6 +1143,51 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1143,6 +1143,51 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
durationLogService.save(durationLog); durationLogService.save(durationLog);
consumerWallet.setRemainingDuration(consumerWallet.getRemainingDuration().subtract(sOrder.getDuration())); consumerWallet.setRemainingDuration(consumerWallet.getRemainingDuration().subtract(sOrder.getDuration()));
consumerWalletService.updateById(consumerWallet); consumerWalletService.updateById(consumerWallet);
} else {
if (!ObjectUtils.isEmpty(sOrder.getMonthlyCardId()) && !ObjectUtils.isEmpty(sOrder.getDuration())) {
if (consumerMonthlyCard.getFreeDuration().compareTo(sOrder.getDuration()) >= 0) {
consumerMonthlyCard.setFreeDuration(consumerMonthlyCard.getFreeDuration().subtract(sOrder.getDuration()));
MonthlyCardLog monthlyCardLog = new MonthlyCardLog();
monthlyCardLog.setConsumerMonthlyCardId(sOrder.getMonthlyCardId());
monthlyCardLog.setConsumerId(consumerMonthlyCard.getConsumerId());
monthlyCardLog.setPhone(sOrder.getConsumerPhone());
monthlyCardLog.setUseDuration(sOrder.getDuration());
monthlyCardLog.setResidueDuration(consumerMonthlyCard.getFreeDuration());
monthlyCardLog.setOperationType(YesNoEnum.no.getIndex());
monthlyCardLog.setOperationTime(new Date());
monthlyCardLog.setCreateTime(new Date());
consumerMonthlyCardService.updateById(consumerMonthlyCard);
monthlyCardLogService.save(monthlyCardLog);
} else if (consumerMonthlyCard.getFreeDuration().compareTo(sOrder.getDuration()) < 0) {
BigDecimal duration = sOrder.getDuration();
MonthlyCardLog monthlyCardLog = new MonthlyCardLog();
monthlyCardLog.setConsumerMonthlyCardId(sOrder.getMonthlyCardId());
monthlyCardLog.setConsumerId(consumerMonthlyCard.getConsumerId());
monthlyCardLog.setPhone(sOrder.getConsumerPhone());
monthlyCardLog.setUseDuration(consumerMonthlyCard.getFreeDuration());
duration = duration.subtract(consumerMonthlyCard.getFreeDuration());
consumerMonthlyCard.setFreeDuration(BigDecimal.ZERO);
monthlyCardLog.setResidueDuration(consumerMonthlyCard.getFreeDuration());
monthlyCardLog.setOperationType(YesNoEnum.no.getIndex());
monthlyCardLog.setOperationTime(new Date());
monthlyCardLog.setCreateTime(new Date());
consumerMonthlyCardService.updateById(consumerMonthlyCard);
monthlyCardLogService.save(monthlyCardLog);
DurationLog durationLog = new DurationLog();
durationLog.setConsumerId(sOrder.getConsumerId());
durationLog.setVariableDuration(duration);
durationLog.setCurrentDuration(consumerWallet.getRemainingDuration());
durationLog.setOperationType(YesNoEnum.no.getIndex());
durationLog.setDurationType(DurationTypeEnum.ORDER.getCode());
durationLog.setOperationTime(new Date());
durationLog.setCreateTime(new Date());
durationLogService.save(durationLog);
consumerWallet.setRemainingDuration(consumerWallet.getRemainingDuration().subtract(duration));
consumerWalletService.updateById(consumerWallet);
}
}
}
} }
if (ObjectUtil.isNotEmpty(sOrder.getBalance()) && sOrder.getBalance().compareTo(BigDecimal.ZERO) > 0) { if (ObjectUtil.isNotEmpty(sOrder.getBalance()) && sOrder.getBalance().compareTo(BigDecimal.ZERO) > 0) {
BalanceLog balanceLog = new BalanceLog(); BalanceLog balanceLog = new BalanceLog();
...@@ -1321,23 +1366,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1321,23 +1366,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
} }
} }
private void creatExtracted(ConsumerMonthlyCard consumerMonthlyCard, SOrder sOrder, ConsumerSecondaryCard consumerSecondaryCard) { private void creatExtracted(SOrder sOrder, ConsumerSecondaryCard consumerSecondaryCard) {
if (!ObjectUtils.isEmpty(sOrder.getMonthlyCardId()) && !ObjectUtils.isEmpty(sOrder.getDuration())) {
if (consumerMonthlyCard.getFreeDuration().compareTo(sOrder.getDuration()) >= 0) {
consumerMonthlyCard.setFreeDuration(consumerMonthlyCard.getFreeDuration().subtract(sOrder.getDuration()));
MonthlyCardLog monthlyCardLog = new MonthlyCardLog();
monthlyCardLog.setConsumerMonthlyCardId(sOrder.getMonthlyCardId());
monthlyCardLog.setConsumerId(consumerMonthlyCard.getConsumerId());
monthlyCardLog.setPhone(sOrder.getConsumerPhone());
monthlyCardLog.setUseDuration(sOrder.getDuration());
monthlyCardLog.setResidueDuration(consumerMonthlyCard.getFreeDuration());
monthlyCardLog.setOperationType(YesNoEnum.no.getIndex());
monthlyCardLog.setOperationTime(new Date());
monthlyCardLog.setCreateTime(new Date());
consumerMonthlyCardService.updateById(consumerMonthlyCard);
monthlyCardLogService.save(monthlyCardLog);
}
}
if (!ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) { if (!ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) {
consumerSecondaryCard.setNumber(consumerSecondaryCard.getNumber() - 1); consumerSecondaryCard.setNumber(consumerSecondaryCard.getNumber() - 1);
SecondaryCardLog secondaryCardLog = new SecondaryCardLog(); SecondaryCardLog secondaryCardLog = new SecondaryCardLog();
...@@ -1354,9 +1384,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1354,9 +1384,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
} }
} }
private void refundExtracted(ConsumerWallet consumerWallet, SOrder sOrder, ConsumerMember consumerMember) { private void refundExtracted(ConsumerWallet consumerWallet, SOrder sOrder, ConsumerMember consumerMember, ConsumerMonthlyCard consumerMonthlyCard) {
if (ObjectUtil.isNotEmpty(consumerWallet)) { if (ObjectUtil.isNotEmpty(consumerWallet)) {
if (ObjectUtil.isNotEmpty(sOrder.getDuration()) && sOrder.getDuration().compareTo(BigDecimal.ZERO) > 0 && ObjectUtil.isEmpty(sOrder.getMonthlyCardId())) { if (ObjectUtil.isNotEmpty(sOrder.getDuration()) && sOrder.getDuration().compareTo(BigDecimal.ZERO) > 0) {
if (ObjectUtil.isEmpty(sOrder.getMonthlyCardId())) {
DurationLog durationLog = new DurationLog(); DurationLog durationLog = new DurationLog();
durationLog.setConsumerId(sOrder.getConsumerId()); durationLog.setConsumerId(sOrder.getConsumerId());
durationLog.setVariableDuration(sOrder.getDuration()); durationLog.setVariableDuration(sOrder.getDuration());
...@@ -1368,6 +1399,62 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1368,6 +1399,62 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
durationLogService.save(durationLog); durationLogService.save(durationLog);
consumerWallet.setRemainingDuration(consumerWallet.getRemainingDuration().add(sOrder.getDuration())); consumerWallet.setRemainingDuration(consumerWallet.getRemainingDuration().add(sOrder.getDuration()));
consumerWalletService.updateById(consumerWallet); consumerWalletService.updateById(consumerWallet);
} else {
if (!ObjectUtils.isEmpty(sOrder.getMonthlyCardId()) && !ObjectUtils.isEmpty(sOrder.getDuration())) {
BigDecimal duration = sOrder.getDuration();
BigDecimal monthlyCardTime = new BigDecimal(sysConfigService.selectConfigByKey("monthlyCardTime"));
if (monthlyCardTime.compareTo(duration) >= 0) {
//判断订单的下单时间是否是当前天
LocalDate localDate1 = sOrder.getCreateTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
LocalDate localDate2 = new Date().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
if (localDate1.equals(localDate2)) {
consumerMonthlyCard.setFreeDuration(consumerMonthlyCard.getFreeDuration().add(sOrder.getDuration()));
MonthlyCardLog monthlyCardLog = new MonthlyCardLog();
monthlyCardLog.setConsumerMonthlyCardId(sOrder.getMonthlyCardId());
monthlyCardLog.setConsumerId(consumerMonthlyCard.getConsumerId());
monthlyCardLog.setPhone(sOrder.getConsumerPhone());
monthlyCardLog.setUseDuration(sOrder.getDuration());
monthlyCardLog.setResidueDuration(consumerMonthlyCard.getFreeDuration());
monthlyCardLog.setOperationType(YesNoEnum.yes.getIndex());
monthlyCardLog.setOperationTime(new Date());
monthlyCardLog.setCreateTime(new Date());
consumerMonthlyCardService.updateById(consumerMonthlyCard);
monthlyCardLogService.save(monthlyCardLog);
}
} else if (monthlyCardTime.compareTo(duration) < 0) {
//判断订单的下单时间是否是当前天
LocalDate localDate1 = sOrder.getCreateTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
LocalDate localDate2 = new Date().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
duration = duration.subtract(monthlyCardTime);
if (localDate1.equals(localDate2)) {
consumerMonthlyCard.setFreeDuration(consumerMonthlyCard.getFreeDuration().add(monthlyCardTime));
MonthlyCardLog monthlyCardLog = new MonthlyCardLog();
monthlyCardLog.setConsumerMonthlyCardId(sOrder.getMonthlyCardId());
monthlyCardLog.setConsumerId(consumerMonthlyCard.getConsumerId());
monthlyCardLog.setPhone(sOrder.getConsumerPhone());
monthlyCardLog.setUseDuration(monthlyCardTime);
monthlyCardLog.setResidueDuration(consumerMonthlyCard.getFreeDuration());
monthlyCardLog.setOperationType(YesNoEnum.yes.getIndex());
monthlyCardLog.setOperationTime(new Date());
monthlyCardLog.setCreateTime(new Date());
consumerMonthlyCardService.updateById(consumerMonthlyCard);
monthlyCardLogService.save(monthlyCardLog);
}
DurationLog durationLog = new DurationLog();
durationLog.setConsumerId(sOrder.getConsumerId());
durationLog.setVariableDuration(duration);
durationLog.setCurrentDuration(consumerWallet.getRemainingDuration());
durationLog.setOperationType(YesNoEnum.yes.getIndex());
durationLog.setDurationType(DurationTypeEnum.ORDER_REFUND.getCode());
durationLog.setOperationTime(new Date());
durationLog.setCreateTime(new Date());
durationLogService.save(durationLog);
consumerWallet.setRemainingDuration(consumerWallet.getRemainingDuration().add(duration));
consumerWalletService.updateById(consumerWallet);
}
}
}
} }
if (ObjectUtil.isNotEmpty(sOrder.getBalance()) && sOrder.getBalance().compareTo(BigDecimal.ZERO) > 0) { if (ObjectUtil.isNotEmpty(sOrder.getBalance()) && sOrder.getBalance().compareTo(BigDecimal.ZERO) > 0) {
BalanceLog balanceLog = new BalanceLog(); BalanceLog balanceLog = new BalanceLog();
...@@ -1571,26 +1658,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1571,26 +1658,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
// } // }
} }
private void refundExtracted(ConsumerMonthlyCard consumerMonthlyCard, SOrder sOrder, ConsumerSecondaryCard consumerSecondaryCard) { private void refundExtracted(SOrder sOrder, ConsumerSecondaryCard consumerSecondaryCard) {
if (!ObjectUtils.isEmpty(sOrder.getMonthlyCardId()) && !ObjectUtils.isEmpty(sOrder.getDuration())) {
//判断订单的下单时间是否是当前天
LocalDate localDate1 = sOrder.getCreateTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
LocalDate localDate2 = new Date().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
if (localDate1.equals(localDate2)) {
consumerMonthlyCard.setFreeDuration(consumerMonthlyCard.getFreeDuration().add(sOrder.getDuration()));
MonthlyCardLog monthlyCardLog = new MonthlyCardLog();
monthlyCardLog.setConsumerMonthlyCardId(sOrder.getMonthlyCardId());
monthlyCardLog.setConsumerId(consumerMonthlyCard.getConsumerId());
monthlyCardLog.setPhone(sOrder.getConsumerPhone());
monthlyCardLog.setUseDuration(sOrder.getDuration());
monthlyCardLog.setResidueDuration(consumerMonthlyCard.getFreeDuration());
monthlyCardLog.setOperationType(YesNoEnum.yes.getIndex());
monthlyCardLog.setOperationTime(new Date());
monthlyCardLog.setCreateTime(new Date());
consumerMonthlyCardService.updateById(consumerMonthlyCard);
monthlyCardLogService.save(monthlyCardLog);
}
}
if (!ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) { if (!ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) {
consumerSecondaryCard.setNumber(consumerSecondaryCard.getNumber() + 1); consumerSecondaryCard.setNumber(consumerSecondaryCard.getNumber() + 1);
SecondaryCardLog secondaryCardLog = new SecondaryCardLog(); SecondaryCardLog secondaryCardLog = new SecondaryCardLog();
...@@ -1812,6 +1880,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1812,6 +1880,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
order.setBalance(priceResponse.getBalance()); order.setBalance(priceResponse.getBalance());
order.setDuration(priceResponse.getDuration()); order.setDuration(priceResponse.getDuration());
order.setDiscountRatio(priceResponse.getDiscountRatio()); order.setDiscountRatio(priceResponse.getDiscountRatio());
order.setMonthlyCardId(priceResponse.getMonthlyCardId());
order.setSecondaryCardId(priceResponse.getSecondaryCardId());
if (priceResponse.getPayFee().compareTo(order.getPayPrice()) != 0 if (priceResponse.getPayFee().compareTo(order.getPayPrice()) != 0
&& priceResponse.getDuration().compareTo(request.getDuration()) != 0 && priceResponse.getDuration().compareTo(request.getDuration()) != 0
&& priceResponse.getBalance().compareTo(request.getBalance()) != 0 && priceResponse.getBalance().compareTo(request.getBalance()) != 0
...@@ -2156,10 +2226,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2156,10 +2226,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
deviceOpService.openOrCloseDevice(sOrder.getRoomId(), sOrder.getConsumerPhone(), OpTypeEnum.CUT_ELECTRIC.getCode(), true, 5, deviceOpService.openOrCloseDevice(sOrder.getRoomId(), sOrder.getConsumerPhone(), OpTypeEnum.CUT_ELECTRIC.getCode(), true, 5,
DeviceOpSourceEnum.DEVICE_SOURCE_20.getCode()); DeviceOpSourceEnum.DEVICE_SOURCE_20.getCode());
} }
if (!ObjectUtils.isEmpty(sOrder.getMonthlyCardId()) || !ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) { if (!ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) {
refundExtracted(consumerMonthlyCard, sOrder, consumerSecondaryCard); refundExtracted(sOrder, consumerSecondaryCard);
} else { } else {
refundExtracted(consumerWallet, sOrder, consumerMember); refundExtracted(consumerWallet, sOrder, consumerMember, consumerMonthlyCard);
} }
} }
} else { } else {
...@@ -2191,10 +2261,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2191,10 +2261,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
if (sOrder.getIsDelete().equals(YesNoEnum.yes.getIndex()) && sOrder.getPayStatus().equals(YesNoEnum.yes.getIndex())) { if (sOrder.getIsDelete().equals(YesNoEnum.yes.getIndex()) && sOrder.getPayStatus().equals(YesNoEnum.yes.getIndex())) {
sOrder.setIsDelete(YesNoEnum.no.getIndex()); sOrder.setIsDelete(YesNoEnum.no.getIndex());
} }
if (!ObjectUtils.isEmpty(sOrder.getMonthlyCardId()) || !ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) { if (!ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) {
creatExtracted(consumerMonthlyCard, sOrder, consumerSecondaryCard); creatExtracted(sOrder, consumerSecondaryCard);
} }
creatExtracted(consumerWallet, sOrder, consumerMember); creatExtracted(consumerWallet, sOrder, consumerMember, consumerMonthlyCard);
baseMapper.updateSOrder(sOrder); baseMapper.updateSOrder(sOrder);
unLockOrder(sOrder.getRoomId()); unLockOrder(sOrder.getRoomId());
if (sOrder.getOrderType().equals(OrderTypeEnum.RENEW.getCode())) { if (sOrder.getOrderType().equals(OrderTypeEnum.RENEW.getCode())) {
...@@ -2348,10 +2418,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2348,10 +2418,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
deviceOpService.openOrCloseDevice(sOrder.getRoomId(), sOrder.getConsumerPhone(), OpTypeEnum.CUT_ELECTRIC.getCode(), true, 5, deviceOpService.openOrCloseDevice(sOrder.getRoomId(), sOrder.getConsumerPhone(), OpTypeEnum.CUT_ELECTRIC.getCode(), true, 5,
DeviceOpSourceEnum.DEVICE_SOURCE_20.getCode()); DeviceOpSourceEnum.DEVICE_SOURCE_20.getCode());
} }
if (!ObjectUtils.isEmpty(sOrder.getMonthlyCardId()) || !ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) { if (!ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) {
refundExtracted(consumerMonthlyCard, sOrder, consumerSecondaryCard); refundExtracted(sOrder, consumerSecondaryCard);
} }
refundExtracted(consumerWallet, sOrder, consumerMember); refundExtracted(consumerWallet, sOrder, consumerMember, consumerMonthlyCard);
} }
} catch (Exception e) { } catch (Exception e) {
...@@ -2379,10 +2449,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2379,10 +2449,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
try { try {
sOrder.setRefundReason(request.getRefundReason()); sOrder.setRefundReason(request.getRefundReason());
updateById(sOrder); updateById(sOrder);
if (!ObjectUtils.isEmpty(sOrder.getMonthlyCardId()) || !ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) { if (!ObjectUtils.isEmpty(sOrder.getSecondaryCardId())) {
refundExtracted(consumerMonthlyCard, sOrder, consumerSecondaryCard); refundExtracted(sOrder, consumerSecondaryCard);
} }
refundExtracted(consumerWallet, sOrder, consumerMember); refundExtracted(consumerWallet, sOrder, consumerMember, consumerMonthlyCard);
//微信退款 //微信退款
// if (sOrder.getPayType().equals(PayTypeEnum.WECHAT.getCode()) && request.getAmount().compareTo(BigDecimal.ZERO) == 0) { // if (sOrder.getPayType().equals(PayTypeEnum.WECHAT.getCode()) && request.getAmount().compareTo(BigDecimal.ZERO) == 0) {
// 退款task, 定时任务退优惠券 // 退款task, 定时任务退优惠券
...@@ -2877,6 +2947,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2877,6 +2947,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse.setBalance(new BigDecimal(0)); priceResponse.setBalance(new BigDecimal(0));
priceResponse.setRemainingBalance(new BigDecimal(0)); priceResponse.setRemainingBalance(new BigDecimal(0));
priceResponse.setRemainingDuration(new BigDecimal(0)); priceResponse.setRemainingDuration(new BigDecimal(0));
priceResponse.setMonthlyCardId(null);
priceResponse.setSecondaryCardId(null);
if (priceResponse.getPayFee().compareTo(new BigDecimal(0)) > 0) { if (priceResponse.getPayFee().compareTo(new BigDecimal(0)) > 0) {
if (ObjectUtil.isNotEmpty(consumerWallet) && ObjectUtil.isNotEmpty(consumerMember)) { if (ObjectUtil.isNotEmpty(consumerWallet) && ObjectUtil.isNotEmpty(consumerMember)) {
MemberConfig memberConfig = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>().eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel())); MemberConfig memberConfig = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>().eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel()));
...@@ -3180,21 +3252,21 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -3180,21 +3252,21 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse.setDiscountRatio(memberConfig.getDiscountRatio()); priceResponse.setDiscountRatio(memberConfig.getDiscountRatio());
priceResponse.setDiscount(memberConfig.getDiscountRatio()); priceResponse.setDiscount(memberConfig.getDiscountRatio());
priceResponse.setTotalFee(totalFee); priceResponse.setTotalFee(totalFee);
priceResponse.setAvailableDuration(consumerMonthlyCard.getFreeDuration()); priceResponse.setAvailableDuration(consumerMonthlyCard.getFreeDuration().add(consumerWallet.getRemainingDuration()));
if (consumerMonthlyCard.getFreeDuration().compareTo(timeLong) >= 0) { if (priceResponse.getAvailableDuration().compareTo(timeLong) >= 0) {
priceResponse.setDuration(timeLong); priceResponse.setDuration(timeLong);
priceResponse.setRemainingDuration(consumerMonthlyCard.getFreeDuration().subtract(timeLong)); priceResponse.setRemainingDuration(priceResponse.getAvailableDuration().subtract(timeLong));
totalFee = new BigDecimal(0); totalFee = new BigDecimal(0);
priceResponse.setDiscount(BigDecimal.ZERO); priceResponse.setDiscount(BigDecimal.ZERO);
priceResponse.setMemberDiscount(new BigDecimal(0.00)); priceResponse.setMemberDiscount(new BigDecimal(0.00));
priceResponse.setTotalFeeNow(priceResponse.getTotalFee()); priceResponse.setTotalFeeNow(priceResponse.getTotalFee());
priceResponse.setMonthlyCardId(consumerMonthlyCard.getId()); priceResponse.setMonthlyCardId(consumerMonthlyCard.getId());
priceResponse.setPayFee(BigDecimal.ZERO); priceResponse.setPayFee(BigDecimal.ZERO);
} else if (consumerMonthlyCard.getFreeDuration().compareTo(timeLong) < 0) { } else if (priceResponse.getAvailableDuration().compareTo(timeLong) < 0) {
priceResponse.setDuration(consumerMonthlyCard.getFreeDuration()); priceResponse.setDuration(priceResponse.getAvailableDuration());
priceResponse.setRemainingDuration(new BigDecimal(0)); priceResponse.setRemainingDuration(new BigDecimal(0));
//时长的金额 //时长的金额
BigDecimal remainingBalance = consumerMonthlyCard.getFreeDuration().multiply(room.getPrice()); BigDecimal remainingBalance = priceResponse.getAvailableDuration().multiply(room.getPrice());
//恢复原价 //恢复原价
// totalFee = totalFee.divide(memberConfig.getDiscountRatio(), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)); // totalFee = totalFee.divide(memberConfig.getDiscountRatio(), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
//原价减时长 //原价减时长
......
package share.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.utils.DateUtils;
import share.system.domain.WheelGame;
import share.system.mapper.WheelGameMapper;
import share.system.service.WheelGameService;
import java.util.List;
/**
* 转盘游戏Service业务层处理
*
* @author wuwenlong
* @date 2024-11-12
*/
@Service
public class WheelGameServiceImpl extends ServiceImpl<WheelGameMapper, WheelGame> implements WheelGameService {
@Autowired
private WheelGameMapper wheelGameMapper;
/**
* 查询转盘游戏
*
* @param id 转盘游戏主键
* @return 转盘游戏
*/
@Override
public WheelGame selectWheelGameById(Long id) {
return wheelGameMapper.selectWheelGameById(id);
}
/**
* 查询转盘游戏列表
*
* @param wheelGame 转盘游戏
* @return 转盘游戏
*/
@Override
public List<WheelGame> selectWheelGameList(WheelGame wheelGame) {
return wheelGameMapper.selectWheelGameList(wheelGame);
}
/**
* 新增转盘游戏
*
* @param wheelGame 转盘游戏
* @return 结果
*/
@Override
public int insertWheelGame(WheelGame wheelGame) {
wheelGame.setCreateTime(DateUtils.getNowDate());
return wheelGameMapper.insertWheelGame(wheelGame);
}
/**
* 修改转盘游戏
*
* @param wheelGame 转盘游戏
* @return 结果
*/
@Override
public int updateWheelGame(WheelGame wheelGame) {
wheelGame.setUpdateTime(DateUtils.getNowDate());
return wheelGameMapper.updateWheelGame(wheelGame);
}
/**
* 批量删除转盘游戏
*
* @param ids 需要删除的转盘游戏主键
* @return 结果
*/
@Override
public int deleteWheelGameByIds(Long[] ids) {
return wheelGameMapper.deleteWheelGameByIds(ids);
}
/**
* 删除转盘游戏信息
*
* @param id 转盘游戏主键
* @return 结果
*/
@Override
public int deleteWheelGameById(Long id) {
return wheelGameMapper.deleteWheelGameById(id);
}
}
<?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="share.system.mapper.LotteryRecordsLogMapper">
<resultMap type="LotteryRecordsLog" id="LotteryRecordsLogResult">
<result property="id" column="id"/>
<result property="gameId" column="game_id"/>
<result property="userId" column="user_id"/>
<result property="userName" column="user_name"/>
<result property="phone" column="phone"/>
<result property="drawTime" column="draw_time"/>
<result property="isHit" column="is_hit"/>
<result property="hitPrize" column="hit_prize"/>
<result property="isSend" column="is_send"/>
<result property="sendMsg" column="send_msg"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectLotteryRecordsLogVo">
select id,
game_id,
user_id,
user_name,
phone,
draw_time,
is_hit,
hit_prize,
is_send,
send_msg,
create_by,
create_time,
update_by,
update_time,
remark
from s_lottery_records_log
</sql>
<select id="selectLotteryRecordsLogList" parameterType="LotteryRecordsLog" resultMap="LotteryRecordsLogResult">
<include refid="selectLotteryRecordsLogVo"/>
<where>
<if test="gameId != null ">and game_id = #{gameId}</if>
<if test="userId != null ">and user_id = #{userId}</if>
<if test="userName != null and userName != ''">and user_name like concat('%', #{userName}, '%')</if>
<if test="phone != null and phone != ''">and phone = #{phone}</if>
<if test="drawTime != null ">and draw_time = #{drawTime}</if>
<if test="isHit != null ">and is_hit = #{isHit}</if>
<if test="hitPrize != null and hitPrize != ''">and hit_prize = #{hitPrize}</if>
<if test="isSend != null ">and is_send = #{isSend}</if>
<if test="sendMsg != null and sendMsg != ''">and send_msg = #{sendMsg}</if>
</where>
</select>
<select id="selectLotteryRecordsLogById" parameterType="Long" resultMap="LotteryRecordsLogResult">
<include refid="selectLotteryRecordsLogVo"/>
where id = #{id}
</select>
<insert id="insertLotteryRecordsLog" parameterType="LotteryRecordsLog" useGeneratedKeys="true" keyProperty="id">
insert into s_lottery_records_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="gameId != null">game_id,</if>
<if test="userId != null">user_id,</if>
<if test="userName != null">user_name,</if>
<if test="phone != null">phone,</if>
<if test="drawTime != null">draw_time,</if>
<if test="isHit != null">is_hit,</if>
<if test="hitPrize != null">hit_prize,</if>
<if test="isSend != null">is_send,</if>
<if test="sendMsg != null">send_msg,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="gameId != null">#{gameId},</if>
<if test="userId != null">#{userId},</if>
<if test="userName != null">#{userName},</if>
<if test="phone != null">#{phone},</if>
<if test="drawTime != null">#{drawTime},</if>
<if test="isHit != null">#{isHit},</if>
<if test="hitPrize != null">#{hitPrize},</if>
<if test="isSend != null">#{isSend},</if>
<if test="sendMsg != null">#{sendMsg},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateLotteryRecordsLog" parameterType="LotteryRecordsLog">
update s_lottery_records_log
<trim prefix="SET" suffixOverrides=",">
<if test="gameId != null">game_id = #{gameId},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="userName != null">user_name = #{userName},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="drawTime != null">draw_time = #{drawTime},</if>
<if test="isHit != null">is_hit = #{isHit},</if>
<if test="hitPrize != null">hit_prize = #{hitPrize},</if>
<if test="isSend != null">is_send = #{isSend},</if>
<if test="sendMsg != null">send_msg = #{sendMsg},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteLotteryRecordsLogById" parameterType="Long">
delete
from s_lottery_records_log
where id = #{id}
</delete>
<delete id="deleteLotteryRecordsLogByIds" parameterType="String">
delete from s_lottery_records_log where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
<?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="share.system.mapper.PrizeMapper">
<resultMap type="Prize" id="PrizeResult">
<result property="id" column="id"/>
<result property="gameId" column="game_id"/>
<result property="prizeType" column="prize_type"/>
<result property="prizeName" column="prize_name"/>
<result property="prizeValue" column="prize_value"/>
<result property="currentNum" column="current_num"/>
<result property="maxNum" column="max_num"/>
<result property="ratio" column="ratio"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectPrizeVo">
select id,
game_id,
prize_type,
prize_name,
prize_value,
current_num,
max_num,
ratio,
create_by,
create_time,
update_by,
update_time,
remark
from s_prize
</sql>
<select id="selectPrizeList" parameterType="Prize" resultMap="PrizeResult">
<include refid="selectPrizeVo"/>
<where>
<if test="gameId != null ">and game_id = #{gameId}</if>
<if test="prizeType != null and prizeType != ''">and prize_type = #{prizeType}</if>
<if test="prizeName != null and prizeName != ''">and prize_name like concat('%', #{prizeName}, '%')</if>
<if test="prizeValue != null ">and prize_value = #{prizeValue}</if>
<if test="currentNum != null ">and current_num = #{currentNum}</if>
<if test="maxNum != null ">and max_num = #{maxNum}</if>
<if test="ratio != null ">and ratio = #{ratio}</if>
</where>
</select>
<select id="selectPrizeById" parameterType="Long" resultMap="PrizeResult">
<include refid="selectPrizeVo"/>
where id = #{id}
</select>
<insert id="insertPrize" parameterType="Prize" useGeneratedKeys="true" keyProperty="id">
insert into s_prize
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="gameId != null">game_id,</if>
<if test="prizeType != null">prize_type,</if>
<if test="prizeName != null">prize_name,</if>
<if test="prizeValue != null">prize_value,</if>
<if test="currentNum != null">current_num,</if>
<if test="maxNum != null">max_num,</if>
<if test="ratio != null">ratio,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="gameId != null">#{gameId},</if>
<if test="prizeType != null">#{prizeType},</if>
<if test="prizeName != null">#{prizeName},</if>
<if test="prizeValue != null">#{prizeValue},</if>
<if test="currentNum != null">#{currentNum},</if>
<if test="maxNum != null">#{maxNum},</if>
<if test="ratio != null">#{ratio},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updatePrize" parameterType="Prize">
update s_prize
<trim prefix="SET" suffixOverrides=",">
<if test="gameId != null">game_id = #{gameId},</if>
<if test="prizeType != null">prize_type = #{prizeType},</if>
<if test="prizeName != null">prize_name = #{prizeName},</if>
<if test="prizeValue != null">prize_value = #{prizeValue},</if>
<if test="currentNum != null">current_num = #{currentNum},</if>
<if test="maxNum != null">max_num = #{maxNum},</if>
<if test="ratio != null">ratio = #{ratio},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deletePrizeById" parameterType="Long">
delete
from s_prize
where id = #{id}
</delete>
<delete id="deletePrizeByIds" parameterType="String">
delete from s_prize where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
<if test="usageCount != null ">and l.usage_count = #{usageCount}</if> <if test="usageCount != null ">and l.usage_count = #{usageCount}</if>
<if test="residueCount != null ">and l.residue_count = #{residueCount}</if> <if test="residueCount != null ">and l.residue_count = #{residueCount}</if>
order by l.create_time order by l.create_time desc
</select> </select>
<select id="selectSecondaryCardLogById" parameterType="Long" resultMap="SecondaryCardLogResult"> <select id="selectSecondaryCardLogById" parameterType="Long" resultMap="SecondaryCardLogResult">
......
<?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="share.system.mapper.WheelGameMapper">
<resultMap type="WheelGame" id="WheelGameResult">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="startTime" column="start_time"/>
<result property="endTime" column="end_time"/>
<result property="description" column="description"/>
<result property="dayLimit" column="day_limit"/>
<result property="singleLimit" column="single_limit"/>
<result property="isOpen" column="is_open"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectWheelGameVo">
select id,
name,
start_time,
end_time,
description,
day_limit,
single_limit,
is_open,
create_by,
create_time,
update_by,
update_time,
remark
from s_wheel_game
</sql>
<select id="selectWheelGameList" parameterType="WheelGame" resultMap="WheelGameResult">
<include refid="selectWheelGameVo"/>
<where>
<if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
<if test="startTime != null ">and start_time = #{startTime}</if>
<if test="endTime != null ">and end_time = #{endTime}</if>
<if test="description != null and description != ''">and description = #{description}</if>
<if test="dayLimit != null ">and day_limit = #{dayLimit}</if>
<if test="singleLimit != null ">and single_limit = #{singleLimit}</if>
<if test="isOpen != null ">and is_open = #{isOpen}</if>
</where>
</select>
<select id="selectWheelGameById" parameterType="Long" resultMap="WheelGameResult">
<include refid="selectWheelGameVo"/>
where id = #{id}
</select>
<insert id="insertWheelGame" parameterType="WheelGame" useGeneratedKeys="true" keyProperty="id">
insert into s_wheel_game
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="startTime != null">start_time,</if>
<if test="endTime != null">end_time,</if>
<if test="description != null">description,</if>
<if test="dayLimit != null">day_limit,</if>
<if test="singleLimit != null">single_limit,</if>
<if test="isOpen != null">is_open,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="startTime != null">#{startTime},</if>
<if test="endTime != null">#{endTime},</if>
<if test="description != null">#{description},</if>
<if test="dayLimit != null">#{dayLimit},</if>
<if test="singleLimit != null">#{singleLimit},</if>
<if test="isOpen != null">#{isOpen},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateWheelGame" parameterType="WheelGame">
update s_wheel_game
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="startTime != null">start_time = #{startTime},</if>
<if test="endTime != null">end_time = #{endTime},</if>
<if test="description != null">description = #{description},</if>
<if test="dayLimit != null">day_limit = #{dayLimit},</if>
<if test="singleLimit != null">single_limit = #{singleLimit},</if>
<if test="isOpen != null">is_open = #{isOpen},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteWheelGameById" parameterType="Long">
delete
from s_wheel_game
where id = #{id}
</delete>
<delete id="deleteWheelGameByIds" parameterType="String">
delete from s_wheel_game where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment