Jelajahi Sumber

新增抽奖内容

goods20 5 bulan lalu
induk
melakukan
cdb610331d
21 mengubah file dengan 1349 tambahan dan 12 penghapusan
  1. 26 0
      ruoyi-common/src/main/java/com/ruoyi/common/enums/LotteryTypeEnum.java
  2. 104 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/controller/WxLotteryController.java
  3. 104 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/controller/WxUserLotteryController.java
  4. 23 9
      ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/domain/WxCoupons.java
  5. 126 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/domain/WxLottery.java
  6. 138 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/domain/WxUserLottery.java
  7. 61 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/mapper/WxLotteryMapper.java
  8. 61 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/mapper/WxUserLotteryMapper.java
  9. 61 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/service/IWxLotteryService.java
  10. 61 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/service/IWxUserLotteryService.java
  11. 93 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/service/impl/WxLotteryServiceImpl.java
  12. 95 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/service/impl/WxUserLotteryServiceImpl.java
  13. 2 2
      ruoyi-generator/src/main/resources/vm/java/domain.java.vm
  14. 6 1
      ruoyi-system/src/main/resources/mapper/system/WxCouponsMapper.xml
  15. 81 0
      ruoyi-system/src/main/resources/mapper/system/WxLotteryMapper.xml
  16. 86 0
      ruoyi-system/src/main/resources/mapper/system/WxUserLotteryMapper.xml
  17. 52 0
      ruoyi-wx/src/main/java/com/ruoyi/wx/web/controller/WxLotteryUserController.java
  18. 51 0
      ruoyi-wx/src/main/java/com/ruoyi/wx/web/domain/dto/LotteryDto.java
  19. 39 0
      ruoyi-wx/src/main/java/com/ruoyi/wx/web/domain/vo/LotteryVo.java
  20. 21 0
      ruoyi-wx/src/main/java/com/ruoyi/wx/web/service/IWxLotteryUserService.java
  21. 58 0
      ruoyi-wx/src/main/java/com/ruoyi/wx/web/service/impl/WxLotteryUserServiceImpl.java

+ 26 - 0
ruoyi-common/src/main/java/com/ruoyi/common/enums/LotteryTypeEnum.java

@@ -0,0 +1,26 @@
+package com.ruoyi.common.enums;
+
+public enum LotteryTypeEnum {
+    PARTICIPATE_IN(1, "参加"),
+    SHARE(2, "分享"),
+    ASSIST(3, "好友助力"),
+    POINTS_REDEMPTION(4, "积分兑换"),
+    MONTHLY(5, "月卡会员"),
+    QUARTER(6, "季度会员"),
+    ANNUAL(7, "年度会员");
+
+    private Integer code;
+    private String desc;
+    LotteryTypeEnum(Integer code, String desc) {
+        this.code = code;
+        this.desc = desc;
+    }
+
+    public Integer getCode() {
+        return code;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+}

+ 104 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/controller/WxLotteryController.java

@@ -0,0 +1,104 @@
+package com.ruoyi.framework.recovery.controller;
+
+import java.util.List;
+import jakarta.servlet.http.HttpServletResponse;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.framework.recovery.domain.WxLottery;
+import com.ruoyi.framework.recovery.service.IWxLotteryService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 微信抽奖Controller
+ * 
+ * @author jin
+ * @date 2024-12-17
+ */
+@RestController
+@RequestMapping("/recovery/lottery")
+public class WxLotteryController extends BaseController
+{
+    @Autowired
+    private IWxLotteryService wxLotteryService;
+
+    /**
+     * 查询微信抽奖列表
+     */
+    @PreAuthorize("@ss.hasPermi('recovery:lottery:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(WxLottery wxLottery)
+    {
+        startPage();
+        List<WxLottery> list = wxLotteryService.selectWxLotteryList(wxLottery);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出微信抽奖列表
+     */
+    @PreAuthorize("@ss.hasPermi('recovery:lottery:export')")
+    @Log(title = "微信抽奖", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, WxLottery wxLottery)
+    {
+        List<WxLottery> list = wxLotteryService.selectWxLotteryList(wxLottery);
+        ExcelUtil<WxLottery> util = new ExcelUtil<WxLottery>(WxLottery.class);
+        util.exportExcel(response, list, "微信抽奖数据");
+    }
+
+    /**
+     * 获取微信抽奖详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('recovery:lottery:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return success(wxLotteryService.selectWxLotteryById(id));
+    }
+
+    /**
+     * 新增微信抽奖
+     */
+    @PreAuthorize("@ss.hasPermi('recovery:lottery:add')")
+    @Log(title = "微信抽奖", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody WxLottery wxLottery)
+    {
+        return toAjax(wxLotteryService.insertWxLottery(wxLottery));
+    }
+
+    /**
+     * 修改微信抽奖
+     */
+    @PreAuthorize("@ss.hasPermi('recovery:lottery:edit')")
+    @Log(title = "微信抽奖", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody WxLottery wxLottery)
+    {
+        return toAjax(wxLotteryService.updateWxLottery(wxLottery));
+    }
+
+    /**
+     * 删除微信抽奖
+     */
+    @PreAuthorize("@ss.hasPermi('recovery:lottery:remove')")
+    @Log(title = "微信抽奖", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(wxLotteryService.deleteWxLotteryByIds(ids));
+    }
+}

+ 104 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/controller/WxUserLotteryController.java

@@ -0,0 +1,104 @@
+package com.ruoyi.framework.recovery.controller;
+
+import java.util.List;
+import jakarta.servlet.http.HttpServletResponse;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.framework.recovery.domain.WxUserLottery;
+import com.ruoyi.framework.recovery.service.IWxUserLotteryService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 微信中奖记录Controller
+ * 
+ * @author jin
+ * @date 2024-12-17
+ */
+@RestController
+@RequestMapping("/recovery/lottery")
+public class WxUserLotteryController extends BaseController
+{
+    @Autowired
+    private IWxUserLotteryService wxUserLotteryService;
+
+    /**
+     * 查询微信中奖记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('recovery:lottery:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(WxUserLottery wxUserLottery)
+    {
+        startPage();
+        List<WxUserLottery> list = wxUserLotteryService.selectWxUserLotteryList(wxUserLottery);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出微信中奖记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('recovery:lottery:export')")
+    @Log(title = "微信中奖记录", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, WxUserLottery wxUserLottery)
+    {
+        List<WxUserLottery> list = wxUserLotteryService.selectWxUserLotteryList(wxUserLottery);
+        ExcelUtil<WxUserLottery> util = new ExcelUtil<WxUserLottery>(WxUserLottery.class);
+        util.exportExcel(response, list, "微信中奖记录数据");
+    }
+
+    /**
+     * 获取微信中奖记录详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('recovery:lottery:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return success(wxUserLotteryService.selectWxUserLotteryById(id));
+    }
+
+    /**
+     * 新增微信中奖记录
+     */
+    @PreAuthorize("@ss.hasPermi('recovery:lottery:add')")
+    @Log(title = "微信中奖记录", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody WxUserLottery wxUserLottery)
+    {
+        return toAjax(wxUserLotteryService.insertWxUserLottery(wxUserLottery));
+    }
+
+    /**
+     * 修改微信中奖记录
+     */
+    @PreAuthorize("@ss.hasPermi('recovery:lottery:edit')")
+    @Log(title = "微信中奖记录", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody WxUserLottery wxUserLottery)
+    {
+        return toAjax(wxUserLotteryService.updateWxUserLottery(wxUserLottery));
+    }
+
+    /**
+     * 删除微信中奖记录
+     */
+    @PreAuthorize("@ss.hasPermi('recovery:lottery:remove')")
+    @Log(title = "微信中奖记录", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(wxUserLotteryService.deleteWxUserLotteryByIds(ids));
+    }
+}

+ 23 - 9
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/domain/WxCoupons.java

@@ -1,5 +1,6 @@
 package com.ruoyi.framework.recovery.domain;
 
+import java.math.BigDecimal;
 import java.util.Date;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import org.apache.commons.lang3.builder.ToStringBuilder;
@@ -28,6 +29,12 @@ public class WxCoupons extends BaseEntity
     @Excel(name = "优惠卷折扣")
     private String couponsAmount;
 
+    /**
+     * 优惠卷金额
+     */
+    @Excel(name = "优惠卷金额")
+    private BigDecimal couponsPrice;
+
     /** 创建时间 */
     @JsonFormat(pattern = "yyyy-MM-dd")
     @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
@@ -84,16 +91,23 @@ public class WxCoupons extends BaseEntity
         return updateDate;
     }
 
+    public BigDecimal getCouponsPrice() {
+        return couponsPrice;
+    }
+
+    public void setCouponsPrice(BigDecimal couponsPrice) {
+        this.couponsPrice = couponsPrice;
+    }
+
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("couponsType", getCouponsType())
-            .append("couponsAmount", getCouponsAmount())
-            .append("createBy", getCreateBy())
-            .append("createDate", getCreateDate())
-            .append("updateBy", getUpdateBy())
-            .append("updateDate", getUpdateDate())
-            .toString();
+        return "WxCoupons{" +
+                "id=" + id +
+                ", couponsType='" + couponsType + '\'' +
+                ", couponsAmount='" + couponsAmount + '\'' +
+                ", couponsPrice=" + couponsPrice +
+                ", createDate=" + createDate +
+                ", updateDate=" + updateDate +
+                '}';
     }
 }

+ 126 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/domain/WxLottery.java

@@ -0,0 +1,126 @@
+package com.ruoyi.framework.recovery.domain;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 微信抽奖对象 wx_lottery
+ * 
+ * @author jin
+ * @date 2024-12-17
+ */
+public class WxLottery extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 抽奖id */
+    private Long id;
+
+    /** 抽奖内容 */
+    @Excel(name = "抽奖内容")
+    private String lotteryDesc;
+
+    /** 奖品数量 */
+    @Excel(name = "奖品数量")
+    private Long lotteryNum;
+
+    /** 抽奖图片 */
+    @Excel(name = "抽奖图片")
+    private String lotteryImage;
+
+    /** 开奖时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "开奖时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date lotteryTime;
+
+    /** 创建时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date createDate;
+
+    /** 更新时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date updateDate;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+    public void setLotteryDesc(String lotteryDesc) 
+    {
+        this.lotteryDesc = lotteryDesc;
+    }
+
+    public String getLotteryDesc() 
+    {
+        return lotteryDesc;
+    }
+    public void setLotteryNum(Long lotteryNum) 
+    {
+        this.lotteryNum = lotteryNum;
+    }
+
+    public Long getLotteryNum() 
+    {
+        return lotteryNum;
+    }
+    public void setLotteryImage(String lotteryImage) 
+    {
+        this.lotteryImage = lotteryImage;
+    }
+
+    public String getLotteryImage() 
+    {
+        return lotteryImage;
+    }
+    public void setLotteryTime(Date lotteryTime) 
+    {
+        this.lotteryTime = lotteryTime;
+    }
+
+    public Date getLotteryTime() 
+    {
+        return lotteryTime;
+    }
+    public void setCreateDate(Date createDate) 
+    {
+        this.createDate = createDate;
+    }
+
+    public Date getCreateDate() 
+    {
+        return createDate;
+    }
+    public void setUpdateDate(Date updateDate) 
+    {
+        this.updateDate = updateDate;
+    }
+
+    public Date getUpdateDate() 
+    {
+        return updateDate;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("lotteryDesc", getLotteryDesc())
+            .append("lotteryNum", getLotteryNum())
+            .append("lotteryImage", getLotteryImage())
+            .append("lotteryTime", getLotteryTime())
+            .append("createDate", getCreateDate())
+            .append("updateDate", getUpdateDate())
+            .toString();
+    }
+}

+ 138 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/domain/WxUserLottery.java

@@ -0,0 +1,138 @@
+package com.ruoyi.framework.recovery.domain;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 微信中奖记录对象 wx_user_lottery
+ * 
+ * @author jin
+ * @date 2024-12-17
+ */
+public class WxUserLottery extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 抽奖记录id */
+    private Long id;
+
+    /** 奖品id */
+    @Excel(name = "奖品id")
+    private Long lotteryId;
+
+    /** 抽奖编号 */
+    @Excel(name = "抽奖编号")
+    private String lotteryNum;
+
+    /** 用户编号 */
+    @Excel(name = "用户编号")
+    private String openId;
+
+    /** 中奖标记 */
+    @Excel(name = "中奖标记")
+    private String mark;
+
+    /** 抽奖方式 */
+    @Excel(name = "抽奖方式")
+    private String lotteryType;
+
+    /** 创建时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date createDate;
+
+    /** 更新时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date updateDate;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+    public void setLotteryId(Long lotteryId) 
+    {
+        this.lotteryId = lotteryId;
+    }
+
+    public Long getLotteryId() 
+    {
+        return lotteryId;
+    }
+    public void setLotteryNum(String lotteryNum) 
+    {
+        this.lotteryNum = lotteryNum;
+    }
+
+    public String getLotteryNum() 
+    {
+        return lotteryNum;
+    }
+    public void setOpenId(String openId)
+    {
+        this.openId = openId;
+    }
+
+    public String getOpenId()
+    {
+        return openId;
+    }
+    public void setMark(String mark) 
+    {
+        this.mark = mark;
+    }
+
+    public String getMark() 
+    {
+        return mark;
+    }
+    public void setCreateDate(Date createDate) 
+    {
+        this.createDate = createDate;
+    }
+
+    public Date getCreateDate() 
+    {
+        return createDate;
+    }
+    public void setUpdateDate(Date updateDate) 
+    {
+        this.updateDate = updateDate;
+    }
+
+    public Date getUpdateDate() 
+    {
+        return updateDate;
+    }
+
+    public String getLotteryType() {
+        return lotteryType;
+    }
+
+    public void setLotteryType(String lotteryType) {
+        this.lotteryType = lotteryType;
+    }
+
+    @Override
+    public String toString() {
+        return "WxUserLottery{" +
+                "id=" + id +
+                ", lotteryId=" + lotteryId +
+                ", lotteryNum='" + lotteryNum + '\'' +
+                ", userId=" + openId +
+                ", mark='" + mark + '\'' +
+                ", lotteryType='" + lotteryType + '\'' +
+                ", createDate=" + createDate +
+                ", updateDate=" + updateDate +
+                '}';
+    }
+}

+ 61 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/mapper/WxLotteryMapper.java

@@ -0,0 +1,61 @@
+package com.ruoyi.framework.recovery.mapper;
+
+import java.util.List;
+import com.ruoyi.framework.recovery.domain.WxLottery;
+
+/**
+ * 微信抽奖Mapper接口
+ * 
+ * @author jin
+ * @date 2024-12-17
+ */
+public interface WxLotteryMapper 
+{
+    /**
+     * 查询微信抽奖
+     * 
+     * @param id 微信抽奖主键
+     * @return 微信抽奖
+     */
+    public WxLottery selectWxLotteryById(Long id);
+
+    /**
+     * 查询微信抽奖列表
+     * 
+     * @param wxLottery 微信抽奖
+     * @return 微信抽奖集合
+     */
+    public List<WxLottery> selectWxLotteryList(WxLottery wxLottery);
+
+    /**
+     * 新增微信抽奖
+     * 
+     * @param wxLottery 微信抽奖
+     * @return 结果
+     */
+    public int insertWxLottery(WxLottery wxLottery);
+
+    /**
+     * 修改微信抽奖
+     * 
+     * @param wxLottery 微信抽奖
+     * @return 结果
+     */
+    public int updateWxLottery(WxLottery wxLottery);
+
+    /**
+     * 删除微信抽奖
+     * 
+     * @param id 微信抽奖主键
+     * @return 结果
+     */
+    public int deleteWxLotteryById(Long id);
+
+    /**
+     * 批量删除微信抽奖
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteWxLotteryByIds(Long[] ids);
+}

+ 61 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/mapper/WxUserLotteryMapper.java

@@ -0,0 +1,61 @@
+package com.ruoyi.framework.recovery.mapper;
+
+import java.util.List;
+import com.ruoyi.framework.recovery.domain.WxUserLottery;
+
+/**
+ * 微信中奖记录Mapper接口
+ * 
+ * @author jin
+ * @date 2024-12-17
+ */
+public interface WxUserLotteryMapper 
+{
+    /**
+     * 查询微信中奖记录
+     * 
+     * @param id 微信中奖记录主键
+     * @return 微信中奖记录
+     */
+    public WxUserLottery selectWxUserLotteryById(Long id);
+
+    /**
+     * 查询微信中奖记录列表
+     * 
+     * @param wxUserLottery 微信中奖记录
+     * @return 微信中奖记录集合
+     */
+    public List<WxUserLottery> selectWxUserLotteryList(WxUserLottery wxUserLottery);
+
+    /**
+     * 新增微信中奖记录
+     * 
+     * @param wxUserLottery 微信中奖记录
+     * @return 结果
+     */
+    public int insertWxUserLottery(WxUserLottery wxUserLottery);
+
+    /**
+     * 修改微信中奖记录
+     * 
+     * @param wxUserLottery 微信中奖记录
+     * @return 结果
+     */
+    public int updateWxUserLottery(WxUserLottery wxUserLottery);
+
+    /**
+     * 删除微信中奖记录
+     * 
+     * @param id 微信中奖记录主键
+     * @return 结果
+     */
+    public int deleteWxUserLotteryById(Long id);
+
+    /**
+     * 批量删除微信中奖记录
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteWxUserLotteryByIds(Long[] ids);
+}

+ 61 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/service/IWxLotteryService.java

@@ -0,0 +1,61 @@
+package com.ruoyi.framework.recovery.service;
+
+import java.util.List;
+import com.ruoyi.framework.recovery.domain.WxLottery;
+
+/**
+ * 微信抽奖Service接口
+ * 
+ * @author jin
+ * @date 2024-12-17
+ */
+public interface IWxLotteryService 
+{
+    /**
+     * 查询微信抽奖
+     * 
+     * @param id 微信抽奖主键
+     * @return 微信抽奖
+     */
+    public WxLottery selectWxLotteryById(Long id);
+
+    /**
+     * 查询微信抽奖列表
+     * 
+     * @param wxLottery 微信抽奖
+     * @return 微信抽奖集合
+     */
+    public List<WxLottery> selectWxLotteryList(WxLottery wxLottery);
+
+    /**
+     * 新增微信抽奖
+     * 
+     * @param wxLottery 微信抽奖
+     * @return 结果
+     */
+    public int insertWxLottery(WxLottery wxLottery);
+
+    /**
+     * 修改微信抽奖
+     * 
+     * @param wxLottery 微信抽奖
+     * @return 结果
+     */
+    public int updateWxLottery(WxLottery wxLottery);
+
+    /**
+     * 批量删除微信抽奖
+     * 
+     * @param ids 需要删除的微信抽奖主键集合
+     * @return 结果
+     */
+    public int deleteWxLotteryByIds(Long[] ids);
+
+    /**
+     * 删除微信抽奖信息
+     * 
+     * @param id 微信抽奖主键
+     * @return 结果
+     */
+    public int deleteWxLotteryById(Long id);
+}

+ 61 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/service/IWxUserLotteryService.java

@@ -0,0 +1,61 @@
+package com.ruoyi.framework.recovery.service;
+
+import java.util.List;
+import com.ruoyi.framework.recovery.domain.WxUserLottery;
+
+/**
+ * 微信中奖记录Service接口
+ * 
+ * @author jin
+ * @date 2024-12-17
+ */
+public interface IWxUserLotteryService 
+{
+    /**
+     * 查询微信中奖记录
+     * 
+     * @param id 微信中奖记录主键
+     * @return 微信中奖记录
+     */
+    public WxUserLottery selectWxUserLotteryById(Long id);
+
+    /**
+     * 查询微信中奖记录列表
+     * 
+     * @param wxUserLottery 微信中奖记录
+     * @return 微信中奖记录集合
+     */
+    public List<WxUserLottery> selectWxUserLotteryList(WxUserLottery wxUserLottery);
+
+    /**
+     * 新增微信中奖记录
+     * 
+     * @param wxUserLottery 微信中奖记录
+     * @return 结果
+     */
+    public int insertWxUserLottery(WxUserLottery wxUserLottery);
+
+    /**
+     * 修改微信中奖记录
+     * 
+     * @param wxUserLottery 微信中奖记录
+     * @return 结果
+     */
+    public int updateWxUserLottery(WxUserLottery wxUserLottery);
+
+    /**
+     * 批量删除微信中奖记录
+     * 
+     * @param ids 需要删除的微信中奖记录主键集合
+     * @return 结果
+     */
+    public int deleteWxUserLotteryByIds(Long[] ids);
+
+    /**
+     * 删除微信中奖记录信息
+     * 
+     * @param id 微信中奖记录主键
+     * @return 结果
+     */
+    public int deleteWxUserLotteryById(Long id);
+}

+ 93 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/service/impl/WxLotteryServiceImpl.java

@@ -0,0 +1,93 @@
+package com.ruoyi.framework.recovery.service.impl;
+
+import java.util.List;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.framework.recovery.mapper.WxLotteryMapper;
+import com.ruoyi.framework.recovery.domain.WxLottery;
+import com.ruoyi.framework.recovery.service.IWxLotteryService;
+
+/**
+ * 微信抽奖Service业务层处理
+ * 
+ * @author jin
+ * @date 2024-12-17
+ */
+@Service
+public class WxLotteryServiceImpl implements IWxLotteryService 
+{
+    @Autowired
+    private WxLotteryMapper wxLotteryMapper;
+
+    /**
+     * 查询微信抽奖
+     * 
+     * @param id 微信抽奖主键
+     * @return 微信抽奖
+     */
+    @Override
+    public WxLottery selectWxLotteryById(Long id)
+    {
+        return wxLotteryMapper.selectWxLotteryById(id);
+    }
+
+    /**
+     * 查询微信抽奖列表
+     * 
+     * @param wxLottery 微信抽奖
+     * @return 微信抽奖
+     */
+    @Override
+    public List<WxLottery> selectWxLotteryList(WxLottery wxLottery)
+    {
+        return wxLotteryMapper.selectWxLotteryList(wxLottery);
+    }
+
+    /**
+     * 新增微信抽奖
+     * 
+     * @param wxLottery 微信抽奖
+     * @return 结果
+     */
+    @Override
+    public int insertWxLottery(WxLottery wxLottery)
+    {
+        return wxLotteryMapper.insertWxLottery(wxLottery);
+    }
+
+    /**
+     * 修改微信抽奖
+     * 
+     * @param wxLottery 微信抽奖
+     * @return 结果
+     */
+    @Override
+    public int updateWxLottery(WxLottery wxLottery)
+    {
+        return wxLotteryMapper.updateWxLottery(wxLottery);
+    }
+
+    /**
+     * 批量删除微信抽奖
+     * 
+     * @param ids 需要删除的微信抽奖主键
+     * @return 结果
+     */
+    @Override
+    public int deleteWxLotteryByIds(Long[] ids)
+    {
+        return wxLotteryMapper.deleteWxLotteryByIds(ids);
+    }
+
+    /**
+     * 删除微信抽奖信息
+     * 
+     * @param id 微信抽奖主键
+     * @return 结果
+     */
+    @Override
+    public int deleteWxLotteryById(Long id)
+    {
+        return wxLotteryMapper.deleteWxLotteryById(id);
+    }
+}

+ 95 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/service/impl/WxUserLotteryServiceImpl.java

@@ -0,0 +1,95 @@
+package com.ruoyi.framework.recovery.service.impl;
+
+import java.util.Date;
+import java.util.List;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.framework.recovery.mapper.WxUserLotteryMapper;
+import com.ruoyi.framework.recovery.domain.WxUserLottery;
+import com.ruoyi.framework.recovery.service.IWxUserLotteryService;
+
+/**
+ * 微信中奖记录Service业务层处理
+ * 
+ * @author jin
+ * @date 2024-12-17
+ */
+@Service
+public class WxUserLotteryServiceImpl implements IWxUserLotteryService 
+{
+    @Autowired
+    private WxUserLotteryMapper wxUserLotteryMapper;
+
+    /**
+     * 查询微信中奖记录
+     * 
+     * @param id 微信中奖记录主键
+     * @return 微信中奖记录
+     */
+    @Override
+    public WxUserLottery selectWxUserLotteryById(Long id)
+    {
+        return wxUserLotteryMapper.selectWxUserLotteryById(id);
+    }
+
+    /**
+     * 查询微信中奖记录列表
+     * 
+     * @param wxUserLottery 微信中奖记录
+     * @return 微信中奖记录
+     */
+    @Override
+    public List<WxUserLottery> selectWxUserLotteryList(WxUserLottery wxUserLottery)
+    {
+        return wxUserLotteryMapper.selectWxUserLotteryList(wxUserLottery);
+    }
+
+    /**
+     * 新增微信中奖记录
+     * 
+     * @param wxUserLottery 微信中奖记录
+     * @return 结果
+     */
+    @Override
+    public int insertWxUserLottery(WxUserLottery wxUserLottery)
+    {
+        wxUserLottery.setCreateDate(new Date());
+        return wxUserLotteryMapper.insertWxUserLottery(wxUserLottery);
+    }
+
+    /**
+     * 修改微信中奖记录
+     * 
+     * @param wxUserLottery 微信中奖记录
+     * @return 结果
+     */
+    @Override
+    public int updateWxUserLottery(WxUserLottery wxUserLottery)
+    {
+        return wxUserLotteryMapper.updateWxUserLottery(wxUserLottery);
+    }
+
+    /**
+     * 批量删除微信中奖记录
+     * 
+     * @param ids 需要删除的微信中奖记录主键
+     * @return 结果
+     */
+    @Override
+    public int deleteWxUserLotteryByIds(Long[] ids)
+    {
+        return wxUserLotteryMapper.deleteWxUserLotteryByIds(ids);
+    }
+
+    /**
+     * 删除微信中奖记录信息
+     * 
+     * @param id 微信中奖记录主键
+     * @return 结果
+     */
+    @Override
+    public int deleteWxUserLotteryById(Long id)
+    {
+        return wxUserLotteryMapper.deleteWxUserLotteryById(id);
+    }
+}

+ 2 - 2
ruoyi-generator/src/main/resources/vm/java/domain.java.vm

@@ -40,8 +40,8 @@ public class ${ClassName} extends ${Entity}
 #if($parentheseIndex != -1)
     @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
 #elseif($column.javaType == 'Date')
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
 #else
     @Excel(name = "${comment}")
 #end

+ 6 - 1
ruoyi-system/src/main/resources/mapper/system/WxCouponsMapper.xml

@@ -12,10 +12,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="createDate"    column="create_date"    />
         <result property="updateBy"    column="update_by"    />
         <result property="updateDate"    column="update_date"    />
+        <result property="couponsPrice"    column="coupons_price"    />
     </resultMap>
 
     <sql id="selectWxCouponsVo">
-        select id, coupons_type, coupons_amount, create_by, create_date, update_by, update_date from wx_coupons
+        select id, coupons_type, coupons_amount, create_by, create_date, update_by, update_date, coupons_price from wx_coupons
     </sql>
 
     <select id="selectWxCouponsList" parameterType="WxCoupons" resultMap="WxCouponsResult">
@@ -25,6 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="couponsAmount != null  and couponsAmount != ''"> and coupons_amount = #{couponsAmount}</if>
             <if test="createDate != null "> and create_date = #{createDate}</if>
             <if test="updateDate != null "> and update_date = #{updateDate}</if>
+            <if test="couponsPrice != null "> and coupons_price = #{couponsPrice}</if>
         </where>
     </select>
     
@@ -42,6 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createDate != null">create_date,</if>
             <if test="updateBy != null">update_by,</if>
             <if test="updateDate != null">update_date,</if>
+            <if test="couponsPrice != null">coupons_price,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="couponsType != null">#{couponsType},</if>
@@ -50,6 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createDate != null">#{createDate},</if>
             <if test="updateBy != null">#{updateBy},</if>
             <if test="updateDate != null">#{updateDate},</if>
+            <if test="couponsPrice != null">#{couponsPrice},</if>
          </trim>
     </insert>
 
@@ -62,6 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createDate != null">create_date = #{createDate},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>
             <if test="updateDate != null">update_date = #{updateDate},</if>
+            <if test="couponsPrice != null">coupons_price = #{couponsPrice},</if>
         </trim>
         where id = #{id}
     </update>

+ 81 - 0
ruoyi-system/src/main/resources/mapper/system/WxLotteryMapper.xml

@@ -0,0 +1,81 @@
+<?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.framework.recovery.mapper.WxLotteryMapper">
+    
+    <resultMap type="WxLottery" id="WxLotteryResult">
+        <result property="id"    column="id"    />
+        <result property="lotteryDesc"    column="lottery_desc"    />
+        <result property="lotteryNum"    column="lottery_num"    />
+        <result property="lotteryImage"    column="lottery_image"    />
+        <result property="lotteryTime"    column="lottery_time"    />
+        <result property="createDate"    column="create_date"    />
+        <result property="updateDate"    column="update_date"    />
+    </resultMap>
+
+    <sql id="selectWxLotteryVo">
+        select id, lottery_desc, lottery_num, lottery_image, lottery_time, create_date, update_date from wx_lottery
+    </sql>
+
+    <select id="selectWxLotteryList" parameterType="WxLottery" resultMap="WxLotteryResult">
+        <include refid="selectWxLotteryVo"/>
+        <where>  
+            <if test="lotteryDesc != null  and lotteryDesc != ''"> and lottery_desc = #{lotteryDesc}</if>
+            <if test="lotteryNum != null "> and lottery_num = #{lotteryNum}</if>
+            <if test="lotteryImage != null  and lotteryImage != ''"> and lottery_image = #{lotteryImage}</if>
+            <if test="lotteryTime != null "> and lottery_time = #{lotteryTime}</if>
+            <if test="createDate != null "> and create_date = #{createDate}</if>
+            <if test="updateDate != null "> and update_date = #{updateDate}</if>
+        </where>
+    </select>
+    
+    <select id="selectWxLotteryById" parameterType="Long" resultMap="WxLotteryResult">
+        <include refid="selectWxLotteryVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertWxLottery" parameterType="WxLottery" useGeneratedKeys="true" keyProperty="id">
+        insert into wx_lottery
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="lotteryDesc != null">lottery_desc,</if>
+            <if test="lotteryNum != null">lottery_num,</if>
+            <if test="lotteryImage != null">lottery_image,</if>
+            <if test="lotteryTime != null">lottery_time,</if>
+            <if test="createDate != null">create_date,</if>
+            <if test="updateDate != null">update_date,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="lotteryDesc != null">#{lotteryDesc},</if>
+            <if test="lotteryNum != null">#{lotteryNum},</if>
+            <if test="lotteryImage != null">#{lotteryImage},</if>
+            <if test="lotteryTime != null">#{lotteryTime},</if>
+            <if test="createDate != null">#{createDate},</if>
+            <if test="updateDate != null">#{updateDate},</if>
+         </trim>
+    </insert>
+
+    <update id="updateWxLottery" parameterType="WxLottery">
+        update wx_lottery
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="lotteryDesc != null">lottery_desc = #{lotteryDesc},</if>
+            <if test="lotteryNum != null">lottery_num = #{lotteryNum},</if>
+            <if test="lotteryImage != null">lottery_image = #{lotteryImage},</if>
+            <if test="lotteryTime != null">lottery_time = #{lotteryTime},</if>
+            <if test="createDate != null">create_date = #{createDate},</if>
+            <if test="updateDate != null">update_date = #{updateDate},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteWxLotteryById" parameterType="Long">
+        delete from wx_lottery where id = #{id}
+    </delete>
+
+    <delete id="deleteWxLotteryByIds" parameterType="String">
+        delete from wx_lottery where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 86 - 0
ruoyi-system/src/main/resources/mapper/system/WxUserLotteryMapper.xml

@@ -0,0 +1,86 @@
+<?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.framework.recovery.mapper.WxUserLotteryMapper">
+    
+    <resultMap type="WxUserLottery" id="WxUserLotteryResult">
+        <result property="id"    column="id"    />
+        <result property="lotteryId"    column="lottery_id"    />
+        <result property="lotteryNum"    column="lottery_num"    />
+        <result property="openId"    column="open_id"    />
+        <result property="mark"    column="mark"    />
+        <result property="createDate"    column="create_date"    />
+        <result property="updateDate"    column="update_date"    />
+        <result property="lotteryType"    column="lottery_type"    />
+    </resultMap>
+
+    <sql id="selectWxUserLotteryVo">
+        select id, lottery_id, lottery_num, open_id, mark, lottery_type, create_date, update_date from wx_user_lottery
+    </sql>
+
+    <select id="selectWxUserLotteryList" parameterType="WxUserLottery" resultMap="WxUserLotteryResult">
+        <include refid="selectWxUserLotteryVo"/>
+        <where>  
+            <if test="lotteryId != null "> and lottery_id = #{lotteryId}</if>
+            <if test="lotteryNum != null  and lotteryNum != ''"> and lottery_num = #{lotteryNum}</if>
+            <if test="openId != null "> and open_id = #{openId}</if>
+            <if test="mark != null  and mark != ''"> and mark = #{mark}</if>
+            <if test="createDate != null "> and create_date = #{createDate}</if>
+            <if test="updateDate != null "> and update_date = #{updateDate}</if>
+            <if test="lotteryType != null "> and lottery_type = #{lotteryType}</if>
+        </where>
+    </select>
+    
+    <select id="selectWxUserLotteryById" parameterType="Long" resultMap="WxUserLotteryResult">
+        <include refid="selectWxUserLotteryVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertWxUserLottery" parameterType="WxUserLottery" useGeneratedKeys="true" keyProperty="id">
+        insert into wx_user_lottery
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="lotteryId != null">lottery_id,</if>
+            <if test="lotteryNum != null">lottery_num,</if>
+            <if test="openId != null">open_id,</if>
+            <if test="mark != null">mark,</if>
+            <if test="createDate != null">create_date,</if>
+            <if test="updateDate != null">update_date,</if>
+            <if test="lotteryType != null">lottery_type,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="lotteryId != null">#{lotteryId},</if>
+            <if test="lotteryNum != null">#{lotteryNum},</if>
+            <if test="openId != null">#{openId},</if>
+            <if test="mark != null">#{mark},</if>
+            <if test="createDate != null">#{createDate},</if>
+            <if test="updateDate != null">#{updateDate},</if>
+            <if test="lotteryType != null">#{lotteryType},</if>
+         </trim>
+    </insert>
+
+    <update id="updateWxUserLottery" parameterType="WxUserLottery">
+        update wx_user_lottery
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="lotteryId != null">lottery_id = #{lotteryId},</if>
+            <if test="lotteryNum != null">lottery_num = #{lotteryNum},</if>
+            <if test="openId != null">open_id = #{openId},</if>
+            <if test="mark != null">mark = #{mark},</if>
+            <if test="createDate != null">create_date = #{createDate},</if>
+            <if test="updateDate != null">update_date = #{updateDate},</if>
+            <if test="lotteryType != null">lottery_type = #{lotteryType},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteWxUserLotteryById" parameterType="Long">
+        delete from wx_user_lottery where id = #{id}
+    </delete>
+
+    <delete id="deleteWxUserLotteryByIds" parameterType="String">
+        delete from wx_user_lottery where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 52 - 0
ruoyi-wx/src/main/java/com/ruoyi/wx/web/controller/WxLotteryUserController.java

@@ -0,0 +1,52 @@
+package com.ruoyi.wx.web.controller;
+
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.wx.web.domain.dto.LotteryDto;
+import com.ruoyi.wx.web.domain.vo.LotteryVo;
+import com.ruoyi.wx.web.service.IWxLotteryUserService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ *
+ * 微信抽奖中心
+ */
+@Slf4j
+@RestController
+@RequestMapping("/wx/lottery")
+public class WxLotteryUserController {
+
+    @Autowired
+    private IWxLotteryUserService wxLotteryUserService;
+
+    /**
+     *
+     * 获取当前人的抽奖内容
+     * @return
+     */
+    @GetMapping("/info/list")
+    public AjaxResult getIndex() {
+        try {
+            LotteryVo lotteryVo = wxLotteryUserService.getList();
+            return AjaxResult.success(lotteryVo);
+        } catch (SecurityException e) {
+            return AjaxResult.error(e.getMessage());
+        }
+    }
+
+    /**
+     * 当前人员进行抽奖
+     *
+     * @return
+     */
+    @PostMapping("/info/add")
+    public AjaxResult addLottery(@RequestBody LotteryDto lotteryDto) {
+        try {
+            LotteryVo lotteryVo = wxLotteryUserService.addLottery(lotteryDto);
+            return AjaxResult.success(lotteryVo);
+        } catch (SecurityException e) {
+            return AjaxResult.error(e.getMessage());
+        }
+    }
+}

+ 51 - 0
ruoyi-wx/src/main/java/com/ruoyi/wx/web/domain/dto/LotteryDto.java

@@ -0,0 +1,51 @@
+package com.ruoyi.wx.web.domain.dto;
+
+public class LotteryDto {
+    /**
+     * 获取方式
+     */
+    private String type;
+
+    /**
+     * 获取数量
+     */
+    private Integer num;
+
+    /**
+     * 奖品id
+     */
+    private Long lotteryId;
+
+    public Long getLotteryId() {
+        return lotteryId;
+    }
+
+    public void setLotteryId(Long lotteryId) {
+        this.lotteryId = lotteryId;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public Integer getNum() {
+        return num;
+    }
+
+    public void setNum(Integer num) {
+        this.num = num;
+    }
+
+    @Override
+    public String toString() {
+        return "LotteryDto{" +
+                "type='" + type + '\'' +
+                ", num=" + num +
+                ", lotteryId=" + lotteryId +
+                '}';
+    }
+}

+ 39 - 0
ruoyi-wx/src/main/java/com/ruoyi/wx/web/domain/vo/LotteryVo.java

@@ -0,0 +1,39 @@
+package com.ruoyi.wx.web.domain.vo;
+
+import java.util.List;
+
+public class LotteryVo {
+    /**
+     * 抽奖码
+     */
+    private List<String> lotteryCodes;
+
+    /**
+     * 抽奖数
+     */
+    private Integer LotteryNum;
+
+    public List<String> getLotteryCodes() {
+        return lotteryCodes;
+    }
+
+    public void setLotteryCodes(List<String> lotteryCodes) {
+        this.lotteryCodes = lotteryCodes;
+    }
+
+    public Integer getLotteryNum() {
+        return LotteryNum;
+    }
+
+    public void setLotteryNum(Integer lotteryNum) {
+        LotteryNum = lotteryNum;
+    }
+
+    @Override
+    public String toString() {
+        return "LotteryVo{" +
+                "LotteryCode='" + lotteryCodes + '\'' +
+                ", LotteryNum='" + LotteryNum + '\'' +
+                '}';
+    }
+}

+ 21 - 0
ruoyi-wx/src/main/java/com/ruoyi/wx/web/service/IWxLotteryUserService.java

@@ -0,0 +1,21 @@
+package com.ruoyi.wx.web.service;
+
+import com.ruoyi.wx.web.domain.dto.LotteryDto;
+import com.ruoyi.wx.web.domain.vo.LotteryVo;
+
+public interface IWxLotteryUserService {
+    /**
+     * 获取当前人抽奖码
+     *
+     * @return 返回结果集
+     */
+    LotteryVo getList();
+
+    /**
+     * 当前人员进行抽奖
+     *
+     * @param lotteryDto 入参
+     * @return 结果集
+     */
+    LotteryVo addLottery(LotteryDto lotteryDto);
+}

+ 58 - 0
ruoyi-wx/src/main/java/com/ruoyi/wx/web/service/impl/WxLotteryUserServiceImpl.java

@@ -0,0 +1,58 @@
+package com.ruoyi.wx.web.service.impl;
+
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.framework.recovery.domain.WxUserLottery;
+import com.ruoyi.framework.recovery.mapper.WxUserLotteryMapper;
+import com.ruoyi.wx.web.domain.dto.LotteryDto;
+import com.ruoyi.wx.web.domain.vo.LotteryVo;
+import com.ruoyi.wx.web.service.IWxLotteryUserService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+public class WxLotteryUserServiceImpl implements IWxLotteryUserService {
+    @Autowired
+    private WxUserLotteryMapper wxUserLotteryMapper;
+
+    @Override
+    public LotteryVo getList() {
+        WxUserLottery lottery = new WxUserLottery();
+        String wxOpenid = SecurityUtils.getLoginWxUser().getWxUser().getWxOpenid();
+        lottery.setOpenId(wxOpenid);
+        List<WxUserLottery> userLotteries = wxUserLotteryMapper.selectWxUserLotteryList(lottery);
+        List<String> lotteryIds = new ArrayList<>();
+        for (WxUserLottery userLottery : userLotteries) {
+            lotteryIds.add(userLottery.getLotteryNum());
+        }
+        LotteryVo result = new LotteryVo();
+        result.setLotteryCodes(lotteryIds);
+        result.setLotteryNum(lotteryIds.size());
+        return result;
+    }
+
+    @Override
+    public LotteryVo addLottery(LotteryDto lotteryDto) {
+        String wxOpenid = SecurityUtils.getLoginWxUser().getWxUser().getWxOpenid();
+        WxUserLottery lottery = new WxUserLottery();
+        lottery.setOpenId(wxOpenid);
+        List<WxUserLottery> userLotteries = wxUserLotteryMapper.selectWxUserLotteryList(lottery);
+        int total = lotteryDto.getNum() + userLotteries.size();
+        if (total > 10) {
+            throw new ServiceException("超出抽奖数量阈值");
+        }
+        List<WxUserLottery> dto = new ArrayList<>();
+        for (int i = 0 ; i < lotteryDto.getNum() ; i++) {
+            WxUserLottery info = new WxUserLottery();
+            info.setOpenId(wxOpenid);
+            String lotteryCode = String.valueOf(System.currentTimeMillis()).substring(7);
+            lotteryCode = lotteryCode + i;
+            info.setLotteryNum(lotteryCode);
+            info.setLotteryType(lotteryDto.getType());
+        }
+        return null;
+    }
+}