12 changed files with 418 additions and 2 deletions
-
124lottery-system/.idea/uiDesigner.xml
-
28lottery-system/lottery-common/src/main/java/com/lottery/context/RequestContext.java
-
2lottery-system/lottery-common/src/main/java/com/lottery/result/Result.java
-
63lottery-system/lottery-common/src/main/java/com/lottery/utils/ConvertBeanUtil.java
-
1lottery-system/lottery-pojo/src/main/java/com/lottery/dto/Prize.java
-
52lottery-system/lottery-pojo/src/main/java/com/lottery/entity/LotteryRound.java
-
55lottery-system/lottery-pojo/src/main/java/com/lottery/entity/Prize.java
-
45lottery-system/lottery-pojo/src/main/java/com/lottery/entity/User.java
-
40lottery-system/lottery-pojo/src/main/java/com/lottery/entity/WinnerRecord.java
-
2lottery-system/lottery-service/src/main/java/com/lottery/service/Impl/PrizeServiceImpl.java
-
2lottery-system/lottery-service/src/main/resources/application.yml
-
6lottery-system/pom.xml
@ -0,0 +1,124 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project version="4"> |
||||
|
<component name="Palette2"> |
||||
|
<group name="Swing"> |
||||
|
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false"> |
||||
|
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" /> |
||||
|
</item> |
||||
|
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false"> |
||||
|
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" /> |
||||
|
</item> |
||||
|
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false"> |
||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" /> |
||||
|
</item> |
||||
|
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true"> |
||||
|
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" /> |
||||
|
</item> |
||||
|
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false"> |
||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" /> |
||||
|
<initial-values> |
||||
|
<property name="text" value="Button" /> |
||||
|
</initial-values> |
||||
|
</item> |
||||
|
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false"> |
||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" /> |
||||
|
<initial-values> |
||||
|
<property name="text" value="RadioButton" /> |
||||
|
</initial-values> |
||||
|
</item> |
||||
|
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false"> |
||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" /> |
||||
|
<initial-values> |
||||
|
<property name="text" value="CheckBox" /> |
||||
|
</initial-values> |
||||
|
</item> |
||||
|
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false"> |
||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" /> |
||||
|
<initial-values> |
||||
|
<property name="text" value="Label" /> |
||||
|
</initial-values> |
||||
|
</item> |
||||
|
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true"> |
||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> |
||||
|
<preferred-size width="150" height="-1" /> |
||||
|
</default-constraints> |
||||
|
</item> |
||||
|
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true"> |
||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> |
||||
|
<preferred-size width="150" height="-1" /> |
||||
|
</default-constraints> |
||||
|
</item> |
||||
|
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true"> |
||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> |
||||
|
<preferred-size width="150" height="-1" /> |
||||
|
</default-constraints> |
||||
|
</item> |
||||
|
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true"> |
||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> |
||||
|
<preferred-size width="150" height="50" /> |
||||
|
</default-constraints> |
||||
|
</item> |
||||
|
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true"> |
||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> |
||||
|
<preferred-size width="150" height="50" /> |
||||
|
</default-constraints> |
||||
|
</item> |
||||
|
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true"> |
||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> |
||||
|
<preferred-size width="150" height="50" /> |
||||
|
</default-constraints> |
||||
|
</item> |
||||
|
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true"> |
||||
|
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" /> |
||||
|
</item> |
||||
|
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false"> |
||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> |
||||
|
<preferred-size width="150" height="50" /> |
||||
|
</default-constraints> |
||||
|
</item> |
||||
|
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false"> |
||||
|
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3"> |
||||
|
<preferred-size width="150" height="50" /> |
||||
|
</default-constraints> |
||||
|
</item> |
||||
|
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false"> |
||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> |
||||
|
<preferred-size width="150" height="50" /> |
||||
|
</default-constraints> |
||||
|
</item> |
||||
|
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false"> |
||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3"> |
||||
|
<preferred-size width="200" height="200" /> |
||||
|
</default-constraints> |
||||
|
</item> |
||||
|
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false"> |
||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3"> |
||||
|
<preferred-size width="200" height="200" /> |
||||
|
</default-constraints> |
||||
|
</item> |
||||
|
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true"> |
||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" /> |
||||
|
</item> |
||||
|
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false"> |
||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" /> |
||||
|
</item> |
||||
|
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false"> |
||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" /> |
||||
|
</item> |
||||
|
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false"> |
||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" /> |
||||
|
</item> |
||||
|
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false"> |
||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1"> |
||||
|
<preferred-size width="-1" height="20" /> |
||||
|
</default-constraints> |
||||
|
</item> |
||||
|
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false"> |
||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" /> |
||||
|
</item> |
||||
|
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false"> |
||||
|
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" /> |
||||
|
</item> |
||||
|
</group> |
||||
|
</component> |
||||
|
</project> |
@ -0,0 +1,28 @@ |
|||||
|
package com.lottery.context; |
||||
|
|
||||
|
/** |
||||
|
* @program: lottery-system |
||||
|
* @ClassName RequestContext |
||||
|
* @description: 获取上下文 |
||||
|
* @author: wwl |
||||
|
* @create: 2025-07-11 10:39 |
||||
|
* @Version 1.0 |
||||
|
**/ |
||||
|
public class RequestContext { |
||||
|
|
||||
|
public static ThreadLocal<Long> threadLocal = new ThreadLocal<>(); |
||||
|
|
||||
|
public static void setCurrentId(Long id) { |
||||
|
threadLocal.set(id); |
||||
|
} |
||||
|
|
||||
|
public static Long getCurrentId() { |
||||
|
return threadLocal.get(); |
||||
|
} |
||||
|
|
||||
|
public static void removeCurrentId() { |
||||
|
threadLocal.remove(); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
@ -1,4 +1,4 @@ |
|||||
package com.lottery.utils; |
|
||||
|
package com.lottery.result; |
||||
|
|
||||
/** |
/** |
||||
* @program: lottery-system |
* @program: lottery-system |
@ -0,0 +1,63 @@ |
|||||
|
package com.lottery.utils; |
||||
|
|
||||
|
import org.springframework.beans.BeanInstantiationException; |
||||
|
import org.springframework.beans.BeanUtils; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @program: lottery-system |
||||
|
* @ClassName ConvertBeanUtil |
||||
|
* @description: Bean转换工具 |
||||
|
* @author: wwl |
||||
|
* @create: 2025-07-11 10:01 |
||||
|
* @Version 1.0 |
||||
|
**/ |
||||
|
public class ConvertBeanUtil { |
||||
|
|
||||
|
/** |
||||
|
* 将一个对象转成目标对象 |
||||
|
* |
||||
|
* @param source |
||||
|
* @param targetClass |
||||
|
* @param <T> |
||||
|
* @return |
||||
|
*/ |
||||
|
public static <T> T convert(Object source, Class<T> targetClass) { |
||||
|
if (source == null) { |
||||
|
return null; |
||||
|
} |
||||
|
T t = newInstance(targetClass); |
||||
|
BeanUtils.copyProperties(source, t); |
||||
|
return t; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 将List对象转换成目标对象,注意实现是ArrayList |
||||
|
* |
||||
|
* @param targetClass |
||||
|
* @param <K> |
||||
|
* @param <T> |
||||
|
* @return |
||||
|
*/ |
||||
|
public static <K, T> List<T> convertList(List<K> sourceList, Class<T> targetClass) { |
||||
|
if (sourceList == null) { |
||||
|
return null; |
||||
|
} |
||||
|
List targetList = new ArrayList((int) (sourceList.size() / 0.75) + 1); |
||||
|
for (K source : sourceList) { |
||||
|
targetList.add(convert(source, targetClass)); |
||||
|
} |
||||
|
return targetList; |
||||
|
} |
||||
|
|
||||
|
private static <T> T newInstance(Class<T> targetClass) { |
||||
|
try { |
||||
|
return targetClass.newInstance(); |
||||
|
} catch (Exception e) { |
||||
|
throw new BeanInstantiationException(targetClass, "instantiation error", e); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,52 @@ |
|||||
|
package com.lottery.entity; |
||||
|
|
||||
|
/** |
||||
|
* @program: lottery-system |
||||
|
* @ClassName |
||||
|
* @description: |
||||
|
* @author: wwl |
||||
|
* @create: 2025-07-11 10:01 |
||||
|
* @Version 1.0 |
||||
|
**/ |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.IdType; |
||||
|
import com.baomidou.mybatisplus.annotation.TableId; |
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
|
||||
|
@Data |
||||
|
@AllArgsConstructor |
||||
|
@NoArgsConstructor |
||||
|
@TableName("lottery_round") |
||||
|
public class LotteryRound { |
||||
|
|
||||
|
@TableId(type = IdType.AUTO) |
||||
|
private Long id; // 主键ID(表中未显示但通常需要) |
||||
|
|
||||
|
|
||||
|
private String name; // 活动名称 |
||||
|
|
||||
|
|
||||
|
private Date startTime; // 开始时间 |
||||
|
|
||||
|
|
||||
|
private Date endTime; // 结束时间 |
||||
|
|
||||
|
|
||||
|
private String description; // 描述 |
||||
|
|
||||
|
|
||||
|
private Integer status; // 状态 |
||||
|
|
||||
|
|
||||
|
private Date createTime; // 创建时间 |
||||
|
|
||||
|
|
||||
|
private Date updateTime; // 更新时间 |
||||
|
|
||||
|
} |
@ -0,0 +1,55 @@ |
|||||
|
package com.lottery.entity; |
||||
|
|
||||
|
/** |
||||
|
* @program: lottery-system |
||||
|
* @ClassName Gift |
||||
|
* @description: |
||||
|
* @author:jihaipeng |
||||
|
* @create: 2025−07-10 15:20 |
||||
|
* @Version 1.0 |
||||
|
**/ |
||||
|
import com.baomidou.mybatisplus.annotation.IdType; |
||||
|
import com.baomidou.mybatisplus.annotation.TableId; |
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
import java.util.Date; |
||||
|
@Data |
||||
|
@AllArgsConstructor |
||||
|
@NoArgsConstructor |
||||
|
@TableName("prize") |
||||
|
public class Prize { |
||||
|
// 主键ID |
||||
|
@TableId(type = IdType.AUTO) |
||||
|
private Long id; |
||||
|
|
||||
|
// 名称 |
||||
|
private String name; |
||||
|
|
||||
|
// 描述 |
||||
|
private String description; |
||||
|
|
||||
|
// 图片URL |
||||
|
private String imageUrl; |
||||
|
|
||||
|
// 库存数量 |
||||
|
private Integer stock; |
||||
|
|
||||
|
// 中奖概率 |
||||
|
private BigDecimal probability; |
||||
|
|
||||
|
// 奖品类型 |
||||
|
private Integer prizeType; |
||||
|
|
||||
|
// 状态 |
||||
|
private Integer status; |
||||
|
|
||||
|
// 创建时间 |
||||
|
private Date createTime; |
||||
|
|
||||
|
// 更新时间 |
||||
|
private Date updateTime; |
||||
|
} |
@ -0,0 +1,45 @@ |
|||||
|
package com.lottery.entity; |
||||
|
|
||||
|
/** |
||||
|
* @program: lottery-system |
||||
|
* @ClassName |
||||
|
* @description: |
||||
|
* @author: wwl |
||||
|
* @create: 2025-07-11 10:01 |
||||
|
* @Version 1.0 |
||||
|
**/ |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.IdType; |
||||
|
import com.baomidou.mybatisplus.annotation.TableId; |
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
|
||||
|
@Data |
||||
|
@AllArgsConstructor |
||||
|
@NoArgsConstructor |
||||
|
@TableName("user") |
||||
|
public class User { |
||||
|
|
||||
|
@TableId(type = IdType.AUTO) |
||||
|
private Long id; // 主键ID(表中未显示但建议添加) |
||||
|
|
||||
|
|
||||
|
private String username; // 用户名 |
||||
|
|
||||
|
|
||||
|
private String phone; // 手机号 |
||||
|
|
||||
|
|
||||
|
private Integer status; // 状态(tinyint对应Integer) |
||||
|
|
||||
|
|
||||
|
private Date createTime; // 创建时间 |
||||
|
|
||||
|
|
||||
|
private Date updateTime; // 更新时间 |
||||
|
} |
@ -0,0 +1,40 @@ |
|||||
|
package com.lottery.entity; |
||||
|
|
||||
|
/** |
||||
|
* @program: lottery-system |
||||
|
* @ClassName |
||||
|
* @description: |
||||
|
* @author: wwl |
||||
|
* @create: 2025-07-11 10:01 |
||||
|
* @Version 1.0 |
||||
|
**/ |
||||
|
import com.baomidou.mybatisplus.annotation.IdType; |
||||
|
import com.baomidou.mybatisplus.annotation.TableId; |
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
@AllArgsConstructor |
||||
|
@NoArgsConstructor |
||||
|
@Data |
||||
|
@TableName("winner_record") |
||||
|
public class WinnerRecord { |
||||
|
|
||||
|
@TableId(type = IdType.AUTO) |
||||
|
private Long id; // 主键ID |
||||
|
|
||||
|
private Long userId; // 用户ID |
||||
|
|
||||
|
private Long prizeId; // 奖品ID |
||||
|
|
||||
|
private Long roundId; // 轮次ID |
||||
|
|
||||
|
private Date winTime; // 中奖时间 |
||||
|
|
||||
|
private Boolean isClaimed; // 是否已领取(tinyint映射为Boolean) |
||||
|
|
||||
|
private Date claimTime; // 领取时间 |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue