Commit 0289d079 by 吕明尚

Merge branch 'dev' into test

parents 85c83213 02f3366a
......@@ -10,6 +10,7 @@ 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.domain.vo.PrizeVo;
import share.system.service.PrizeService;
import javax.servlet.http.HttpServletResponse;
......@@ -32,9 +33,9 @@ public class PrizeController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:prize:list')")
@GetMapping("/list")
public TableDataInfo list(Prize prize) {
public TableDataInfo list(PrizeVo prize) {
startPage();
List<Prize> list = prizeService.selectPrizeList(prize);
List<PrizeVo> list = prizeService.selectPrizeList(prize);
return getDataTable(list);
}
......@@ -44,9 +45,9 @@ public class PrizeController extends BaseController {
@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);
public void export(HttpServletResponse response, PrizeVo prize) {
List<PrizeVo> list = prizeService.selectPrizeList(prize);
ExcelUtil<PrizeVo> util = new ExcelUtil<PrizeVo>(PrizeVo.class);
util.exportExcel(response, list, "奖品数据");
}
......
......@@ -6,6 +6,7 @@ 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.domain.R;
import share.common.core.page.TableDataInfo;
import share.common.enums.BusinessType;
import share.common.utils.poi.ExcelUtil;
......@@ -38,6 +39,11 @@ public class WheelGameController extends BaseController {
return getDataTable(list);
}
@GetMapping("/query")
public R<List<WheelGame>> query(WheelGame wheelGame) {
return R.ok(wheelGameService.selectWheelGameList(wheelGame));
}
/**
* 导出转盘游戏列表
*/
......
package share.common.enums;
public enum PrizeTypeEnum {
//1=优惠券,2商品,3积分,4谢谢参与
COUPON(1, "优惠券"),
GOODS(2, "商品"),
INTEGRAL(3, "积分"),
THANK(4, "谢谢参与");
private Integer index;
private String name;
PrizeTypeEnum() {
}
PrizeTypeEnum(Integer index, String name) {
this.index = index;
this.name = name;
}
public Integer getIndex() {
return index;
}
public void setIndex(Integer index) {
this.index = index;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import share.common.core.controller.BaseController;
import share.common.core.page.TableDataInfo;
import share.system.domain.LotteryRecordsLog;
import share.system.service.LotteryRecordsLogService;
import java.util.List;
/**
* 抽奖记录日志Controller
*
* @author wuwenlong
* @date 2024-11-12
*/
@RestController
@RequestMapping("/lotteryRecordsLog")
public class LotteryRecordsLogController extends BaseController {
@Autowired
private LotteryRecordsLogService lotteryRecordsLogService;
/**
* 查询抽奖记录日志列表
*/
@GetMapping("/list")
public TableDataInfo list(LotteryRecordsLog lotteryRecordsLog) {
startPage();
List<LotteryRecordsLog> list = lotteryRecordsLogService.selectLotteryRecordsLogList(lotteryRecordsLog);
return getDataTable(list);
}
}
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("/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));
}
}
......@@ -7,6 +7,8 @@ import org.apache.commons.lang3.builder.ToStringStyle;
import share.common.annotation.Excel;
import share.common.core.domain.BaseEntity;
import java.math.BigDecimal;
/**
* 奖品对象 s_prize
*
......@@ -30,10 +32,16 @@ public class Prize extends BaseEntity {
private Long gameId;
/**
* 优惠券ID
*/
@Excel(name = "优惠券ID")
private Long couponId;
/**
* 奖品类型(1优惠券,2商品,3积分,4谢谢参与)
*/
@Excel(name = "奖品类型", readConverterExp = "1=优惠券,2商品,3积分,4谢谢参与")
private String prizeType;
private Integer prizeType;
/**
* 奖品名字
......@@ -45,25 +53,25 @@ public class Prize extends BaseEntity {
* 奖品值(数量)
*/
@Excel(name = "奖品值", readConverterExp = "数=量")
private Long prizeValue;
private Integer prizeValue;
/**
* 当前命中
*/
@Excel(name = "当前命中")
private Long currentNum;
private Integer currentNum;
/**
* 最大中奖数 0:代表不限制
*/
@Excel(name = "最大中奖数 0:代表不限制")
private Long maxNum;
private Integer maxNum;
/**
* 中奖几率
*/
@Excel(name = "中奖几率")
private Long ratio;
private BigDecimal ratio;
@Override
......
package share.system.domain.vo;
import lombok.Data;
import share.system.domain.Prize;
@Data
public class PrizeVo extends Prize {
private String gameName;
private String couponName;
}
......@@ -2,6 +2,7 @@ package share.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import share.system.domain.Prize;
import share.system.domain.vo.PrizeVo;
import java.util.List;
......@@ -26,7 +27,7 @@ public interface PrizeMapper extends BaseMapper<Prize> {
* @param prize 奖品
* @return 奖品集合
*/
public List<Prize> selectPrizeList(Prize prize);
public List<PrizeVo> selectPrizeList(PrizeVo prize);
/**
* 新增奖品
......
......@@ -2,6 +2,7 @@ package share.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.Prize;
import share.system.domain.vo.PrizeVo;
import java.util.List;
......@@ -26,7 +27,7 @@ public interface PrizeService extends IService<Prize> {
* @param prize 奖品
* @return 奖品集合
*/
public List<Prize> selectPrizeList(Prize prize);
public List<PrizeVo> selectPrizeList(PrizeVo prize);
/**
* 新增奖品
......
......@@ -5,6 +5,7 @@ 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.domain.vo.PrizeVo;
import share.system.mapper.PrizeMapper;
import share.system.service.PrizeService;
......@@ -39,7 +40,7 @@ public class PrizeServiceImpl extends ServiceImpl<PrizeMapper, Prize> implements
* @return 奖品
*/
@Override
public List<Prize> selectPrizeList(Prize prize) {
public List<PrizeVo> selectPrizeList(PrizeVo prize) {
return prizeMapper.selectPrizeList(prize);
}
......
......@@ -2940,7 +2940,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse.setMemberDiscount(BigDecimal.ZERO);
priceResponse.setTotalFee(payPrice);
priceResponse.setTotalFeeNow(payPrice);
// priceResponse.setDiscount(BigDecimal.ZERO);
SConsumerCoupon consumerCoupon = consumerCouponService.getById(request.getCouponId());
computedCouponPrice(request, priceResponse, user, consumerCoupon);
priceResponse.setDuration(new BigDecimal(0));
......@@ -2952,6 +2952,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
if (priceResponse.getPayFee().compareTo(new BigDecimal(0)) > 0) {
if (ObjectUtil.isNotEmpty(consumerWallet) && ObjectUtil.isNotEmpty(consumerMember)) {
MemberConfig memberConfig = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>().eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel()));
priceResponse.setDiscount(memberConfig.getDiscountRatio());
if (consumerWallet.getBalance().compareTo(priceResponse.getPayFee()) >= 0) {
BigDecimal payFee = priceResponse.getPayFee();
BigDecimal divide = priceResponse.getPayFee().multiply(memberConfig.getDiscountRatio()).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP);
......
......@@ -4,9 +4,12 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="share.system.mapper.PrizeMapper">
<resultMap type="Prize" id="PrizeResult">
<resultMap type="PrizeVo" id="PrizeResult">
<result property="id" column="id"/>
<result property="gameId" column="game_id"/>
<result property="gameName" column="game_name"/>
<result property="couponName" column="coupon_name"/>
<result property="couponId" column="coupon_id"/>
<result property="prizeType" column="prize_type"/>
<result property="prizeName" column="prize_name"/>
<result property="prizeValue" column="prize_value"/>
......@@ -23,6 +26,7 @@
<sql id="selectPrizeVo">
select id,
game_id,
coupon_id,
prize_type,
prize_name,
prize_value,
......@@ -38,15 +42,33 @@
</sql>
<select id="selectPrizeList" parameterType="Prize" resultMap="PrizeResult">
<include refid="selectPrizeVo"/>
select p.id,
p.game_id,
w.name as 'game_name',
p.coupon_id,
c.name as 'coupon_name',
p. prize_type,
p.prize_name,
p.prize_value,
p.current_num,
p.max_num,
p.ratio,
p. create_by,
p. create_time,
p. update_by,
p. update_time,
p. remark
from s_prize p left join s_wheel_game w on p.game_id = w.id
left join s_coupon c on p.coupon_id = c.id
<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>
<if test="gameId != null ">and p.game_id = #{gameId}</if>
<if test="couponId != null ">and p.coupon_id = #{couponId}</if>
<if test="prizeType != null and prizeType != ''">and p.prize_type = #{prizeType}</if>
<if test="prizeName != null and prizeName != ''">and p.prize_name like concat('%', #{prizeName}, '%')</if>
<if test="prizeValue != null ">and p.prize_value = #{prizeValue}</if>
<if test="currentNum != null ">and p.current_num = #{currentNum}</if>
<if test="maxNum != null ">and p.max_num = #{maxNum}</if>
<if test="ratio != null ">and p.ratio = #{ratio}</if>
</where>
</select>
......@@ -59,6 +81,7 @@
insert into s_prize
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="gameId != null">game_id,</if>
<if test="couponId != null">coupon_id,</if>
<if test="prizeType != null">prize_type,</if>
<if test="prizeName != null">prize_name,</if>
<if test="prizeValue != null">prize_value,</if>
......@@ -73,6 +96,7 @@
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="gameId != null">#{gameId},</if>
<if test="couponId != null">#{couponId}</if>
<if test="prizeType != null">#{prizeType},</if>
<if test="prizeName != null">#{prizeName},</if>
<if test="prizeValue != null">#{prizeValue},</if>
......@@ -91,6 +115,7 @@
update s_prize
<trim prefix="SET" suffixOverrides=",">
<if test="gameId != null">game_id = #{gameId},</if>
<if test="couponId != null">coupon_id = #{couponId}</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>
......
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