Showing
20 changed files
with
1590 additions
and
0 deletions
1 | +package com.yoho.activity.common.bo; | ||
2 | + | ||
3 | +import com.yoho.queue.dal.model.BaseModel; | ||
4 | + | ||
5 | +import java.util.Date; | ||
6 | + | ||
7 | +public class ActPrizeProductBo extends BaseModel { | ||
8 | + /** | ||
9 | + * | ||
10 | + */ | ||
11 | + private static final long serialVersionUID = 1704484697194941946L; | ||
12 | + private Integer id; | ||
13 | + | ||
14 | + private Integer actId; | ||
15 | + | ||
16 | + private String name; | ||
17 | + | ||
18 | + private String price; | ||
19 | + | ||
20 | + private Integer status; | ||
21 | + | ||
22 | + private Integer startTime; | ||
23 | + | ||
24 | + private Integer endTime; | ||
25 | + | ||
26 | + private Integer limit; | ||
27 | + | ||
28 | + private Integer sort; | ||
29 | + | ||
30 | + private String coverImg; | ||
31 | + | ||
32 | + private Date createTime; | ||
33 | + | ||
34 | + private Integer isFull; | ||
35 | + | ||
36 | + private Integer channel; | ||
37 | + | ||
38 | + private String notice; | ||
39 | + | ||
40 | + private String lotteryInfo; | ||
41 | + | ||
42 | + private Integer lotteryTime; | ||
43 | + | ||
44 | + public Integer getId() { | ||
45 | + return id; | ||
46 | + } | ||
47 | + | ||
48 | + public void setId(Integer id) { | ||
49 | + this.id = id; | ||
50 | + } | ||
51 | + | ||
52 | + public Integer getActId() { | ||
53 | + return actId; | ||
54 | + } | ||
55 | + | ||
56 | + public void setActId(Integer actId) { | ||
57 | + this.actId = actId; | ||
58 | + } | ||
59 | + | ||
60 | + public String getName() { | ||
61 | + return name; | ||
62 | + } | ||
63 | + | ||
64 | + public void setName(String name) { | ||
65 | + this.name = name == null ? null : name.trim(); | ||
66 | + } | ||
67 | + | ||
68 | + public String getPrice() { | ||
69 | + return price; | ||
70 | + } | ||
71 | + | ||
72 | + public void setPrice(String price) { | ||
73 | + this.price = price; | ||
74 | + } | ||
75 | + | ||
76 | + public Integer getStatus() { | ||
77 | + return status; | ||
78 | + } | ||
79 | + | ||
80 | + public void setStatus(Integer status) { | ||
81 | + this.status = status; | ||
82 | + } | ||
83 | + | ||
84 | + public Integer getStartTime() { | ||
85 | + return startTime; | ||
86 | + } | ||
87 | + | ||
88 | + public void setStartTime(Integer startTime) { | ||
89 | + this.startTime = startTime; | ||
90 | + } | ||
91 | + | ||
92 | + public Integer getEndTime() { | ||
93 | + return endTime; | ||
94 | + } | ||
95 | + | ||
96 | + public void setEndTime(Integer endTime) { | ||
97 | + this.endTime = endTime; | ||
98 | + } | ||
99 | + | ||
100 | + public Integer getLimit() { | ||
101 | + return limit; | ||
102 | + } | ||
103 | + | ||
104 | + public void setLimit(Integer limit) { | ||
105 | + this.limit = limit; | ||
106 | + } | ||
107 | + | ||
108 | + public Integer getSort() { | ||
109 | + return sort; | ||
110 | + } | ||
111 | + | ||
112 | + public void setSort(Integer sort) { | ||
113 | + this.sort = sort; | ||
114 | + } | ||
115 | + | ||
116 | + public String getCoverImg() { | ||
117 | + return coverImg; | ||
118 | + } | ||
119 | + | ||
120 | + public void setCoverImg(String coverImg) { | ||
121 | + this.coverImg = coverImg == null ? null : coverImg.trim(); | ||
122 | + } | ||
123 | + | ||
124 | + public Date getCreateTime() { | ||
125 | + return createTime; | ||
126 | + } | ||
127 | + | ||
128 | + public void setCreateTime(Date createTime) { | ||
129 | + this.createTime = createTime; | ||
130 | + } | ||
131 | + | ||
132 | + public Integer getIsFull() { | ||
133 | + return isFull; | ||
134 | + } | ||
135 | + | ||
136 | + public void setIsFull(Integer isFull) { | ||
137 | + this.isFull = isFull; | ||
138 | + } | ||
139 | + | ||
140 | + public Integer getChannel() { | ||
141 | + return channel; | ||
142 | + } | ||
143 | + | ||
144 | + public void setChannel(Integer channel) { | ||
145 | + this.channel = channel; | ||
146 | + } | ||
147 | + | ||
148 | + public String getNotice() { | ||
149 | + return notice; | ||
150 | + } | ||
151 | + | ||
152 | + public void setNotice(String notice) { | ||
153 | + this.notice = notice == null ? null : notice.trim(); | ||
154 | + } | ||
155 | + | ||
156 | + public String getLotteryInfo() { | ||
157 | + return lotteryInfo; | ||
158 | + } | ||
159 | + | ||
160 | + public void setLotteryInfo(String lotteryInfo) { | ||
161 | + this.lotteryInfo = lotteryInfo == null ? null : lotteryInfo.trim(); | ||
162 | + } | ||
163 | + | ||
164 | + public Integer getLotteryTime() { | ||
165 | + return lotteryTime; | ||
166 | + } | ||
167 | + | ||
168 | + public void setLotteryTime(Integer lotteryTime) { | ||
169 | + this.lotteryTime = lotteryTime; | ||
170 | + } | ||
171 | +} |
@@ -45,4 +45,7 @@ public class Constant { | @@ -45,4 +45,7 @@ public class Constant { | ||
45 | 45 | ||
46 | //当天已经领取过 | 46 | //当天已经领取过 |
47 | public final static int ORDER_SHARE_ALREADYDRAW_ERROR = 8; | 47 | public final static int ORDER_SHARE_ALREADYDRAW_ERROR = 8; |
48 | + | ||
49 | + // Yo!Luck 活动缓存前缀 | ||
50 | + public final static String YOLUCK_ACTIVITY_CACHE_PREFIX = "yh:yoluck:activity_cache_prefix_"; | ||
48 | } | 51 | } |
1 | +package com.yoho.activity.common.convert; | ||
2 | + | ||
3 | +import com.yoho.activity.common.bo.ActPrizeProductBo; | ||
4 | +import com.yoho.activity.common.vo.YoLuckReq; | ||
5 | +import com.yoho.activity.dal.model.ActPrizeProduct; | ||
6 | +import org.apache.commons.lang3.StringUtils; | ||
7 | +import org.springframework.beans.BeanUtils; | ||
8 | + | ||
9 | +public class ActPrizeProductConvert { | ||
10 | + | ||
11 | + /** | ||
12 | + * 数据库对象转为bo对象返回 | ||
13 | + * @param db | ||
14 | + * @return | ||
15 | + */ | ||
16 | + public static ActPrizeProductBo db2bo(ActPrizeProduct db){ | ||
17 | + if (db == null) { | ||
18 | + return null; | ||
19 | + } | ||
20 | + ActPrizeProductBo bo=new ActPrizeProductBo(); | ||
21 | + BeanUtils.copyProperties(db, bo); | ||
22 | + // 图片地址换成https | ||
23 | + bo.setCoverImg(StringUtils.replace(db.getCoverImg(),"http:" , "https:")); | ||
24 | + // 价格保留2位小数,添加人民币符号 | ||
25 | + StringBuilder priceBuffer = new StringBuilder(); | ||
26 | + bo.setPrice(priceBuffer.append("¥").append(String.valueOf(db.getPrice() / 100d)).toString()); | ||
27 | + return bo; | ||
28 | + } | ||
29 | + | ||
30 | + | ||
31 | + /** | ||
32 | + * 请求对象转为数据库对象 | ||
33 | + * @param bo | ||
34 | + * @return | ||
35 | + */ | ||
36 | + public static ActPrizeProduct bo2DalRequest(YoLuckReq bo) { | ||
37 | + if (bo == null) { | ||
38 | + return null; | ||
39 | + } | ||
40 | + | ||
41 | + ActPrizeProduct product = new ActPrizeProduct(); | ||
42 | + BeanUtils.copyProperties(bo, product); | ||
43 | + | ||
44 | + return product; | ||
45 | + } | ||
46 | + | ||
47 | +} |
1 | +package com.yoho.activity.common.enums; | ||
2 | + | ||
3 | +public enum YoLockActivityListTypeEnum { | ||
4 | + _0(0, "进行中"), | ||
5 | + _1(1, "即将开始"), | ||
6 | + _2(2, "已结束"), | ||
7 | + _3(3, "已参加"); | ||
8 | + | ||
9 | + private YoLockActivityListTypeEnum(Integer status, String statusStr) { | ||
10 | + this.type = status; | ||
11 | + this.description = statusStr; | ||
12 | + } | ||
13 | + private Integer type; | ||
14 | + private String description; | ||
15 | + | ||
16 | + public Integer getType() { | ||
17 | + return type; | ||
18 | + } | ||
19 | + | ||
20 | + public void setStatus(Integer type) { | ||
21 | + this.type = type; | ||
22 | + } | ||
23 | + | ||
24 | + public String getDescription() { | ||
25 | + return description; | ||
26 | + } | ||
27 | + | ||
28 | + public void setDescription(String description) { | ||
29 | + this.description = description; | ||
30 | + } | ||
31 | +} |
1 | +package com.yoho.activity.common.enums; | ||
2 | + | ||
3 | +public enum YoLockActivityStatusEnum { | ||
4 | + _1(1, "活动未开始"), | ||
5 | + _2(2, "活动已开始"), | ||
6 | + _3(3, "活动已结束"), | ||
7 | + _4(4, "活动已开奖"), | ||
8 | + _5(5, "人数未达到,活动失败"); | ||
9 | + | ||
10 | + private YoLockActivityStatusEnum(Integer status, String statusStr) { | ||
11 | + this.status = status; | ||
12 | + this.statusStr = statusStr; | ||
13 | + } | ||
14 | + private Integer status; | ||
15 | + private String statusStr; | ||
16 | + | ||
17 | + public Integer getStatus() { | ||
18 | + return status; | ||
19 | + } | ||
20 | + | ||
21 | + public void setStatus(Integer status) { | ||
22 | + this.status = status; | ||
23 | + } | ||
24 | + | ||
25 | + public String getStatusStr() { | ||
26 | + return statusStr; | ||
27 | + } | ||
28 | + | ||
29 | + public void setStatusStr(String statusStr) { | ||
30 | + this.statusStr = statusStr; | ||
31 | + } | ||
32 | +} |
1 | +package com.yoho.activity.common.vo; | ||
2 | + | ||
3 | +/** | ||
4 | + * Created by sefon 2019-1-15 10:44:20 | ||
5 | + */ | ||
6 | +public class YoLuckReq { | ||
7 | + | ||
8 | + /** | ||
9 | + * | ||
10 | + */ | ||
11 | + private Integer actId; | ||
12 | + | ||
13 | + private Integer type = 0; | ||
14 | + | ||
15 | + private Integer channel; | ||
16 | + | ||
17 | + private Integer uid; | ||
18 | + | ||
19 | + private Integer actPrizeId; | ||
20 | + | ||
21 | + | ||
22 | + public Integer getActId() { | ||
23 | + return actId; | ||
24 | + } | ||
25 | + | ||
26 | + public void setActId(Integer actId) { | ||
27 | + this.actId = actId; | ||
28 | + } | ||
29 | + | ||
30 | + public Integer getType() { | ||
31 | + return type; | ||
32 | + } | ||
33 | + | ||
34 | + public void setType(Integer type) { | ||
35 | + this.type = type; | ||
36 | + } | ||
37 | + | ||
38 | + public Integer getChannel() { | ||
39 | + return channel; | ||
40 | + } | ||
41 | + | ||
42 | + public void setChannel(Integer channel) { | ||
43 | + this.channel = channel; | ||
44 | + } | ||
45 | + | ||
46 | + public Integer getUid() { | ||
47 | + return uid; | ||
48 | + } | ||
49 | + | ||
50 | + public void setUid(Integer uid) { | ||
51 | + this.uid = uid; | ||
52 | + } | ||
53 | + | ||
54 | + public Integer getActPrizeId() { | ||
55 | + return actPrizeId; | ||
56 | + } | ||
57 | + | ||
58 | + public void setActPrizeId(Integer actPrizeId) { | ||
59 | + this.actPrizeId = actPrizeId; | ||
60 | + } | ||
61 | +} |
1 | +package com.yoho.activity.controller; | ||
2 | + | ||
3 | + | ||
4 | +import com.yoho.activity.common.ApiResponse; | ||
5 | +import com.yoho.activity.common.bo.ActPrizeProductBo; | ||
6 | +import com.yoho.activity.service.IYoLuckService; | ||
7 | +import com.yoho.error.exception.ServiceException; | ||
8 | +import org.slf4j.Logger; | ||
9 | +import org.slf4j.LoggerFactory; | ||
10 | +import org.springframework.stereotype.Controller; | ||
11 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
12 | +import org.springframework.web.bind.annotation.RequestParam; | ||
13 | +import org.springframework.web.bind.annotation.ResponseBody; | ||
14 | +import com.yoho.tools.common.beans.page.PageRequest; | ||
15 | +import com.yoho.activity.common.vo.YoLuckReq; | ||
16 | + | ||
17 | +import javax.annotation.Resource; | ||
18 | +import java.util.List; | ||
19 | + | ||
20 | +/** | ||
21 | + * 描述:Yo!luck 相关接口 | ||
22 | + * | ||
23 | + * @author sefon 2019-1-11 10:36:20 | ||
24 | + * | ||
25 | + */ | ||
26 | +@Controller | ||
27 | +// 保持和原项目相同路径 | ||
28 | +@RequestMapping("/YoLuckController") | ||
29 | +public class YoLuckController { | ||
30 | + static Logger log = LoggerFactory.getLogger(YearMemberBillController.class); | ||
31 | + | ||
32 | + @Resource | ||
33 | + IYoLuckService yoLuckService; | ||
34 | + | ||
35 | + /** | ||
36 | + * 0元购列表 | ||
37 | + * @return | ||
38 | + * @throws ServiceException | ||
39 | + */ | ||
40 | + @RequestMapping("/list") | ||
41 | + @ResponseBody | ||
42 | + public List<ActPrizeProductBo> getActivityList(YoLuckReq request, PageRequest page) throws ServiceException { | ||
43 | + log.info("Enter YoLuckController getActivityList YoLuckReq request = {}, PageRequest = {}", request, page); | ||
44 | + return yoLuckService.actList(request, page); | ||
45 | + } | ||
46 | + | ||
47 | + | ||
48 | + /** | ||
49 | + * 详情页 | ||
50 | + * @return | ||
51 | + * @throws ServiceException | ||
52 | + */ | ||
53 | + | ||
54 | + /** | ||
55 | + * 推荐列表 | ||
56 | + * @return | ||
57 | + * @throws ServiceException | ||
58 | + */ | ||
59 | + | ||
60 | + | ||
61 | + /** | ||
62 | + * 已参加用户 | ||
63 | + * @return | ||
64 | + * @throws ServiceException | ||
65 | + */ | ||
66 | + @RequestMapping("/code/recent") | ||
67 | + @ResponseBody | ||
68 | + public ApiResponse activityUserList(@RequestParam(value="uid")int uid, @RequestParam(value="year")String year) throws ServiceException { | ||
69 | + log.info(""); | ||
70 | + ApiResponse apiResponse = new ApiResponse(); | ||
71 | + log.info(""); | ||
72 | + return apiResponse; | ||
73 | + } | ||
74 | + /** | ||
75 | + * 我的列表 | ||
76 | + * @return | ||
77 | + * @throws ServiceException | ||
78 | + */ | ||
79 | + @RequestMapping("/list/mine") | ||
80 | + @ResponseBody | ||
81 | + public ApiResponse getUserActivityList(@RequestParam(value="uid")int uid, @RequestParam(value="year")String year) throws ServiceException { | ||
82 | + log.info(""); | ||
83 | + ApiResponse apiResponse = new ApiResponse(); | ||
84 | + log.info(""); | ||
85 | + return apiResponse; | ||
86 | + } | ||
87 | + | ||
88 | + /** | ||
89 | + * 获得分享码 | ||
90 | + * @return | ||
91 | + * @throws ServiceException | ||
92 | + */ | ||
93 | + @RequestMapping("/code/gain") | ||
94 | + @ResponseBody | ||
95 | + public ApiResponse getShareCode(@RequestParam(value="uid")int uid, @RequestParam(value="year")String year) throws ServiceException { | ||
96 | + log.info(""); | ||
97 | + ApiResponse apiResponse = new ApiResponse(); | ||
98 | + log.info(""); | ||
99 | + return apiResponse; | ||
100 | + } | ||
101 | +} |
1 | +package com.yoho.activity.dal; | ||
2 | + | ||
3 | +import com.yoho.activity.dal.model.ActPrizeProductContent; | ||
4 | + | ||
5 | +public interface ActPrizeProductContentMapper { | ||
6 | + int deleteByPrimaryKey(Integer id); | ||
7 | + | ||
8 | + int insert(ActPrizeProductContent record); | ||
9 | + | ||
10 | + int insertSelective(ActPrizeProductContent record); | ||
11 | + | ||
12 | + ActPrizeProductContent selectByPrimaryKey(Integer id); | ||
13 | + | ||
14 | + int updateByPrimaryKeySelective(ActPrizeProductContent record); | ||
15 | + | ||
16 | + int updateByPrimaryKeyWithBLOBs(ActPrizeProductContent record); | ||
17 | + | ||
18 | + int updateByPrimaryKey(ActPrizeProductContent record); | ||
19 | +} |
1 | +package com.yoho.activity.dal; | ||
2 | + | ||
3 | +import com.yoho.activity.dal.model.ActPrizeProduct; | ||
4 | +import com.yoho.tools.common.beans.page.PageModel; | ||
5 | +import org.apache.ibatis.annotations.Param; | ||
6 | + | ||
7 | +import java.util.*; | ||
8 | + | ||
9 | +public interface ActPrizeProductMapper { | ||
10 | + int deleteByPrimaryKey(Integer id); | ||
11 | + | ||
12 | + int insert(ActPrizeProduct record); | ||
13 | + | ||
14 | + int insertSelective(ActPrizeProduct record); | ||
15 | + | ||
16 | + ActPrizeProduct selectByPrimaryKey(Integer id); | ||
17 | + | ||
18 | + int updateByPrimaryKeySelective(ActPrizeProduct record); | ||
19 | + | ||
20 | + int updateByPrimaryKey(ActPrizeProduct record); | ||
21 | + List<ActPrizeProduct> selectActList(@Param("record") ActPrizeProduct record, @Param("page") PageModel page); | ||
22 | +} |
1 | +package com.yoho.activity.dal; | ||
2 | + | ||
3 | +import com.yoho.activity.dal.model.ActPrizeProductUser; | ||
4 | + | ||
5 | +public interface ActPrizeProductUserMapper { | ||
6 | + int deleteByPrimaryKey(Integer id); | ||
7 | + | ||
8 | + int insert(ActPrizeProductUser record); | ||
9 | + | ||
10 | + int insertSelective(ActPrizeProductUser record); | ||
11 | + | ||
12 | + ActPrizeProductUser selectByPrimaryKey(Integer id); | ||
13 | + | ||
14 | + int updateByPrimaryKeySelective(ActPrizeProductUser record); | ||
15 | + | ||
16 | + int updateByPrimaryKey(ActPrizeProductUser record); | ||
17 | +} |
1 | +package com.yoho.activity.dal.model; | ||
2 | + | ||
3 | +import com.yoho.queue.dal.model.BaseModel; | ||
4 | + | ||
5 | +import java.util.Date; | ||
6 | + | ||
7 | +public class ActPrizeProduct extends BaseModel { | ||
8 | + private Integer id; | ||
9 | + | ||
10 | + private Integer actId; | ||
11 | + | ||
12 | + private String name; | ||
13 | + | ||
14 | + private Long price; | ||
15 | + | ||
16 | + private Integer status; | ||
17 | + | ||
18 | + private Integer startTime; | ||
19 | + | ||
20 | + private Integer endTime; | ||
21 | + | ||
22 | + private Integer limit; | ||
23 | + | ||
24 | + private Integer sort; | ||
25 | + | ||
26 | + private String coverImg; | ||
27 | + | ||
28 | + private Date createTime; | ||
29 | + | ||
30 | + private Integer isFull; | ||
31 | + | ||
32 | + private Integer channel; | ||
33 | + | ||
34 | + private String notice; | ||
35 | + | ||
36 | + private String lotteryInfo; | ||
37 | + | ||
38 | + private Integer lotteryTime; | ||
39 | + | ||
40 | + private Integer type; | ||
41 | + | ||
42 | + private Integer uid; | ||
43 | + | ||
44 | + private Integer nowTime; | ||
45 | + | ||
46 | + public Integer getId() { | ||
47 | + return id; | ||
48 | + } | ||
49 | + | ||
50 | + public void setId(Integer id) { | ||
51 | + this.id = id; | ||
52 | + } | ||
53 | + | ||
54 | + public Integer getActId() { | ||
55 | + return actId; | ||
56 | + } | ||
57 | + | ||
58 | + public void setActId(Integer actId) { | ||
59 | + this.actId = actId; | ||
60 | + } | ||
61 | + | ||
62 | + public String getName() { | ||
63 | + return name; | ||
64 | + } | ||
65 | + | ||
66 | + public void setName(String name) { | ||
67 | + this.name = name == null ? null : name.trim(); | ||
68 | + } | ||
69 | + | ||
70 | + public Long getPrice() { | ||
71 | + return price; | ||
72 | + } | ||
73 | + | ||
74 | + public void setPrice(Long price) { | ||
75 | + this.price = price; | ||
76 | + } | ||
77 | + | ||
78 | + public Integer getStatus() { | ||
79 | + return status; | ||
80 | + } | ||
81 | + | ||
82 | + public void setStatus(Integer status) { | ||
83 | + this.status = status; | ||
84 | + } | ||
85 | + | ||
86 | + public Integer getStartTime() { | ||
87 | + return startTime; | ||
88 | + } | ||
89 | + | ||
90 | + public void setStartTime(Integer startTime) { | ||
91 | + this.startTime = startTime; | ||
92 | + } | ||
93 | + | ||
94 | + public Integer getEndTime() { | ||
95 | + return endTime; | ||
96 | + } | ||
97 | + | ||
98 | + public void setEndTime(Integer endTime) { | ||
99 | + this.endTime = endTime; | ||
100 | + } | ||
101 | + | ||
102 | + public Integer getLimit() { | ||
103 | + return limit; | ||
104 | + } | ||
105 | + | ||
106 | + public void setLimit(Integer limit) { | ||
107 | + this.limit = limit; | ||
108 | + } | ||
109 | + | ||
110 | + public Integer getSort() { | ||
111 | + return sort; | ||
112 | + } | ||
113 | + | ||
114 | + public void setSort(Integer sort) { | ||
115 | + this.sort = sort; | ||
116 | + } | ||
117 | + | ||
118 | + public String getCoverImg() { | ||
119 | + return coverImg; | ||
120 | + } | ||
121 | + | ||
122 | + public void setCoverImg(String coverImg) { | ||
123 | + this.coverImg = coverImg == null ? null : coverImg.trim(); | ||
124 | + } | ||
125 | + | ||
126 | + public Date getCreateTime() { | ||
127 | + return createTime; | ||
128 | + } | ||
129 | + | ||
130 | + public void setCreateTime(Date createTime) { | ||
131 | + this.createTime = createTime; | ||
132 | + } | ||
133 | + | ||
134 | + public Integer getIsFull() { | ||
135 | + return isFull; | ||
136 | + } | ||
137 | + | ||
138 | + public void setIsFull(Integer isFull) { | ||
139 | + this.isFull = isFull; | ||
140 | + } | ||
141 | + | ||
142 | + public Integer getChannel() { | ||
143 | + return channel; | ||
144 | + } | ||
145 | + | ||
146 | + public void setChannel(Integer channel) { | ||
147 | + this.channel = channel; | ||
148 | + } | ||
149 | + | ||
150 | + public String getNotice() { | ||
151 | + return notice; | ||
152 | + } | ||
153 | + | ||
154 | + public void setNotice(String notice) { | ||
155 | + this.notice = notice == null ? null : notice.trim(); | ||
156 | + } | ||
157 | + | ||
158 | + public String getLotteryInfo() { | ||
159 | + return lotteryInfo; | ||
160 | + } | ||
161 | + | ||
162 | + public void setLotteryInfo(String lotteryInfo) { | ||
163 | + this.lotteryInfo = lotteryInfo == null ? null : lotteryInfo.trim(); | ||
164 | + } | ||
165 | + | ||
166 | + public Integer getLotteryTime() { | ||
167 | + return lotteryTime; | ||
168 | + } | ||
169 | + | ||
170 | + public void setLotteryTime(Integer lotteryTime) { | ||
171 | + this.lotteryTime = lotteryTime; | ||
172 | + } | ||
173 | + | ||
174 | + public Integer getType() { | ||
175 | + return type; | ||
176 | + } | ||
177 | + | ||
178 | + public void setType(Integer type) { | ||
179 | + this.type = type; | ||
180 | + } | ||
181 | + | ||
182 | + public Integer getUid() { | ||
183 | + return uid; | ||
184 | + } | ||
185 | + | ||
186 | + public void setUid(Integer uid) { | ||
187 | + this.uid = uid; | ||
188 | + } | ||
189 | + | ||
190 | + public Integer getNowTime() { | ||
191 | + return nowTime; | ||
192 | + } | ||
193 | + | ||
194 | + public void setNowTime(Integer nowTime) { | ||
195 | + this.nowTime = nowTime; | ||
196 | + } | ||
197 | +} |
1 | +package com.yoho.activity.dal.model; | ||
2 | + | ||
3 | +import com.yoho.queue.dal.model.BaseModel; | ||
4 | + | ||
5 | +public class ActPrizeProductContent extends BaseModel { | ||
6 | + private Integer id; | ||
7 | + | ||
8 | + private Integer actId; | ||
9 | + | ||
10 | + private Integer actPrizeId; | ||
11 | + | ||
12 | + private Byte floorType; | ||
13 | + | ||
14 | + private Integer sort; | ||
15 | + | ||
16 | + private String content; | ||
17 | + | ||
18 | + public Integer getId() { | ||
19 | + return id; | ||
20 | + } | ||
21 | + | ||
22 | + public void setId(Integer id) { | ||
23 | + this.id = id; | ||
24 | + } | ||
25 | + | ||
26 | + public Integer getActId() { | ||
27 | + return actId; | ||
28 | + } | ||
29 | + | ||
30 | + public void setActId(Integer actId) { | ||
31 | + this.actId = actId; | ||
32 | + } | ||
33 | + | ||
34 | + public Integer getActPrizeId() { | ||
35 | + return actPrizeId; | ||
36 | + } | ||
37 | + | ||
38 | + public void setActPrizeId(Integer actPrizeId) { | ||
39 | + this.actPrizeId = actPrizeId; | ||
40 | + } | ||
41 | + | ||
42 | + public Byte getFloorType() { | ||
43 | + return floorType; | ||
44 | + } | ||
45 | + | ||
46 | + public void setFloorType(Byte floorType) { | ||
47 | + this.floorType = floorType; | ||
48 | + } | ||
49 | + | ||
50 | + public Integer getSort() { | ||
51 | + return sort; | ||
52 | + } | ||
53 | + | ||
54 | + public void setSort(Integer sort) { | ||
55 | + this.sort = sort; | ||
56 | + } | ||
57 | + | ||
58 | + public String getContent() { | ||
59 | + return content; | ||
60 | + } | ||
61 | + | ||
62 | + public void setContent(String content) { | ||
63 | + this.content = content == null ? null : content.trim(); | ||
64 | + } | ||
65 | +} |
1 | +package com.yoho.activity.dal.model; | ||
2 | + | ||
3 | +import com.yoho.queue.dal.model.BaseModel; | ||
4 | + | ||
5 | +import java.util.Date; | ||
6 | + | ||
7 | +public class ActPrizeProductUser extends BaseModel { | ||
8 | + private Integer id; | ||
9 | + | ||
10 | + private Integer actId; | ||
11 | + | ||
12 | + private Integer actPrizeId; | ||
13 | + | ||
14 | + private Integer uid; | ||
15 | + | ||
16 | + private String userName; | ||
17 | + | ||
18 | + private String userThumb; | ||
19 | + | ||
20 | + private String unionId; | ||
21 | + | ||
22 | + private String prizeCode; | ||
23 | + | ||
24 | + private Byte isShareTake; | ||
25 | + | ||
26 | + private Integer shareUid; | ||
27 | + | ||
28 | + private Date createTime; | ||
29 | + | ||
30 | + public Integer getId() { | ||
31 | + return id; | ||
32 | + } | ||
33 | + | ||
34 | + public void setId(Integer id) { | ||
35 | + this.id = id; | ||
36 | + } | ||
37 | + | ||
38 | + public Integer getActId() { | ||
39 | + return actId; | ||
40 | + } | ||
41 | + | ||
42 | + public void setActId(Integer actId) { | ||
43 | + this.actId = actId; | ||
44 | + } | ||
45 | + | ||
46 | + public Integer getActPrizeId() { | ||
47 | + return actPrizeId; | ||
48 | + } | ||
49 | + | ||
50 | + public void setActPrizeId(Integer actPrizeId) { | ||
51 | + this.actPrizeId = actPrizeId; | ||
52 | + } | ||
53 | + | ||
54 | + public Integer getUid() { | ||
55 | + return uid; | ||
56 | + } | ||
57 | + | ||
58 | + public void setUid(Integer uid) { | ||
59 | + this.uid = uid; | ||
60 | + } | ||
61 | + | ||
62 | + public String getUserName() { | ||
63 | + return userName; | ||
64 | + } | ||
65 | + | ||
66 | + public void setUserName(String userName) { | ||
67 | + this.userName = userName == null ? null : userName.trim(); | ||
68 | + } | ||
69 | + | ||
70 | + public String getUserThumb() { | ||
71 | + return userThumb; | ||
72 | + } | ||
73 | + | ||
74 | + public void setUserThumb(String userThumb) { | ||
75 | + this.userThumb = userThumb == null ? null : userThumb.trim(); | ||
76 | + } | ||
77 | + | ||
78 | + public String getUnionId() { | ||
79 | + return unionId; | ||
80 | + } | ||
81 | + | ||
82 | + public void setUnionId(String unionId) { | ||
83 | + this.unionId = unionId == null ? null : unionId.trim(); | ||
84 | + } | ||
85 | + | ||
86 | + public String getPrizeCode() { | ||
87 | + return prizeCode; | ||
88 | + } | ||
89 | + | ||
90 | + public void setPrizeCode(String prizeCode) { | ||
91 | + this.prizeCode = prizeCode == null ? null : prizeCode.trim(); | ||
92 | + } | ||
93 | + | ||
94 | + public Byte getIsShareTake() { | ||
95 | + return isShareTake; | ||
96 | + } | ||
97 | + | ||
98 | + public void setIsShareTake(Byte isShareTake) { | ||
99 | + this.isShareTake = isShareTake; | ||
100 | + } | ||
101 | + | ||
102 | + public Integer getShareUid() { | ||
103 | + return shareUid; | ||
104 | + } | ||
105 | + | ||
106 | + public void setShareUid(Integer shareUid) { | ||
107 | + this.shareUid = shareUid; | ||
108 | + } | ||
109 | + | ||
110 | + public Date getCreateTime() { | ||
111 | + return createTime; | ||
112 | + } | ||
113 | + | ||
114 | + public void setCreateTime(Date createTime) { | ||
115 | + this.createTime = createTime; | ||
116 | + } | ||
117 | +} |
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
3 | +<mapper namespace="com.yoho.activity.dal.ActPrizeProductContentMapper"> | ||
4 | + <resultMap id="BaseResultMap" type="com.yoho.activity.dal.model.ActPrizeProductContent"> | ||
5 | + <id column="id" jdbcType="INTEGER" property="id" /> | ||
6 | + <result column="act_id" jdbcType="INTEGER" property="actId" /> | ||
7 | + <result column="act_prize_id" jdbcType="INTEGER" property="actPrizeId" /> | ||
8 | + <result column="floor_type" jdbcType="TINYINT" property="floorType" /> | ||
9 | + <result column="sort" jdbcType="INTEGER" property="sort" /> | ||
10 | + </resultMap> | ||
11 | + <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.yoho.activity.dal.model.ActPrizeProductContent"> | ||
12 | + <result column="content" jdbcType="LONGVARCHAR" property="content" /> | ||
13 | + </resultMap> | ||
14 | + <sql id="Base_Column_List"> | ||
15 | + id, act_id, act_prize_id, floor_type, sort | ||
16 | + </sql> | ||
17 | + <sql id="Blob_Column_List"> | ||
18 | + content | ||
19 | + </sql> | ||
20 | + <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="ResultMapWithBLOBs"> | ||
21 | + select | ||
22 | + <include refid="Base_Column_List" /> | ||
23 | + , | ||
24 | + <include refid="Blob_Column_List" /> | ||
25 | + from act_prize_product_content | ||
26 | + where id = #{id,jdbcType=INTEGER} | ||
27 | + </select> | ||
28 | + <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> | ||
29 | + delete from act_prize_product_content | ||
30 | + where id = #{id,jdbcType=INTEGER} | ||
31 | + </delete> | ||
32 | + <insert id="insert" parameterType="com.yoho.activity.dal.model.ActPrizeProductContent"> | ||
33 | + insert into act_prize_product_content (id, act_id, act_prize_id, | ||
34 | + floor_type, sort, content | ||
35 | + ) | ||
36 | + values (#{id,jdbcType=INTEGER}, #{actId,jdbcType=INTEGER}, #{actPrizeId,jdbcType=INTEGER}, | ||
37 | + #{floorType,jdbcType=TINYINT}, #{sort,jdbcType=INTEGER}, #{content,jdbcType=LONGVARCHAR} | ||
38 | + ) | ||
39 | + </insert> | ||
40 | + <insert id="insertSelective" parameterType="com.yoho.activity.dal.model.ActPrizeProductContent"> | ||
41 | + insert into act_prize_product_content | ||
42 | + <trim prefix="(" suffix=")" suffixOverrides=","> | ||
43 | + <if test="id != null"> | ||
44 | + id, | ||
45 | + </if> | ||
46 | + <if test="actId != null"> | ||
47 | + act_id, | ||
48 | + </if> | ||
49 | + <if test="actPrizeId != null"> | ||
50 | + act_prize_id, | ||
51 | + </if> | ||
52 | + <if test="floorType != null"> | ||
53 | + floor_type, | ||
54 | + </if> | ||
55 | + <if test="sort != null"> | ||
56 | + sort, | ||
57 | + </if> | ||
58 | + <if test="content != null"> | ||
59 | + content, | ||
60 | + </if> | ||
61 | + </trim> | ||
62 | + <trim prefix="values (" suffix=")" suffixOverrides=","> | ||
63 | + <if test="id != null"> | ||
64 | + #{id,jdbcType=INTEGER}, | ||
65 | + </if> | ||
66 | + <if test="actId != null"> | ||
67 | + #{actId,jdbcType=INTEGER}, | ||
68 | + </if> | ||
69 | + <if test="actPrizeId != null"> | ||
70 | + #{actPrizeId,jdbcType=INTEGER}, | ||
71 | + </if> | ||
72 | + <if test="floorType != null"> | ||
73 | + #{floorType,jdbcType=TINYINT}, | ||
74 | + </if> | ||
75 | + <if test="sort != null"> | ||
76 | + #{sort,jdbcType=INTEGER}, | ||
77 | + </if> | ||
78 | + <if test="content != null"> | ||
79 | + #{content,jdbcType=LONGVARCHAR}, | ||
80 | + </if> | ||
81 | + </trim> | ||
82 | + </insert> | ||
83 | + <update id="updateByPrimaryKeySelective" parameterType="com.yoho.activity.dal.model.ActPrizeProductContent"> | ||
84 | + update act_prize_product_content | ||
85 | + <set> | ||
86 | + <if test="actId != null"> | ||
87 | + act_id = #{actId,jdbcType=INTEGER}, | ||
88 | + </if> | ||
89 | + <if test="actPrizeId != null"> | ||
90 | + act_prize_id = #{actPrizeId,jdbcType=INTEGER}, | ||
91 | + </if> | ||
92 | + <if test="floorType != null"> | ||
93 | + floor_type = #{floorType,jdbcType=TINYINT}, | ||
94 | + </if> | ||
95 | + <if test="sort != null"> | ||
96 | + sort = #{sort,jdbcType=INTEGER}, | ||
97 | + </if> | ||
98 | + <if test="content != null"> | ||
99 | + content = #{content,jdbcType=LONGVARCHAR}, | ||
100 | + </if> | ||
101 | + </set> | ||
102 | + where id = #{id,jdbcType=INTEGER} | ||
103 | + </update> | ||
104 | + <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.yoho.activity.dal.model.ActPrizeProductContent"> | ||
105 | + update act_prize_product_content | ||
106 | + set act_id = #{actId,jdbcType=INTEGER}, | ||
107 | + act_prize_id = #{actPrizeId,jdbcType=INTEGER}, | ||
108 | + floor_type = #{floorType,jdbcType=TINYINT}, | ||
109 | + sort = #{sort,jdbcType=INTEGER}, | ||
110 | + content = #{content,jdbcType=LONGVARCHAR} | ||
111 | + where id = #{id,jdbcType=INTEGER} | ||
112 | + </update> | ||
113 | + <update id="updateByPrimaryKey" parameterType="com.yoho.activity.dal.model.ActPrizeProductContent"> | ||
114 | + update act_prize_product_content | ||
115 | + set act_id = #{actId,jdbcType=INTEGER}, | ||
116 | + act_prize_id = #{actPrizeId,jdbcType=INTEGER}, | ||
117 | + floor_type = #{floorType,jdbcType=TINYINT}, | ||
118 | + sort = #{sort,jdbcType=INTEGER} | ||
119 | + where id = #{id,jdbcType=INTEGER} | ||
120 | + </update> | ||
121 | +</mapper> |
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
3 | +<mapper namespace="com.yoho.activity.dal.ActPrizeProductMapper"> | ||
4 | + <resultMap id="BaseResultMap" type="com.yoho.activity.dal.model.ActPrizeProduct"> | ||
5 | + <id column="id" jdbcType="INTEGER" property="id" /> | ||
6 | + <result column="act_id" jdbcType="INTEGER" property="actId" /> | ||
7 | + <result column="name" jdbcType="VARCHAR" property="name" /> | ||
8 | + <result column="price" jdbcType="DECIMAL" property="price" /> | ||
9 | + <result column="status" jdbcType="TINYINT" property="status" /> | ||
10 | + <result column="start_time" jdbcType="INTEGER" property="startTime" /> | ||
11 | + <result column="end_time" jdbcType="INTEGER" property="endTime" /> | ||
12 | + <result column="limit" jdbcType="INTEGER" property="limit" /> | ||
13 | + <result column="sort" jdbcType="INTEGER" property="sort" /> | ||
14 | + <result column="cover_img" jdbcType="VARCHAR" property="coverImg" /> | ||
15 | + <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | ||
16 | + <result column="is_full" jdbcType="TINYINT" property="isFull" /> | ||
17 | + <result column="channel" jdbcType="INTEGER" property="channel" /> | ||
18 | + <result column="notice" jdbcType="VARCHAR" property="notice" /> | ||
19 | + <result column="lottery_info" jdbcType="VARCHAR" property="lotteryInfo" /> | ||
20 | + <result column="lottery_time" jdbcType="INTEGER" property="lotteryTime" /> | ||
21 | + </resultMap> | ||
22 | + <sql id="Base_Column_List"> | ||
23 | + id, act_id, name, price, status, start_time, end_time, limit, sort, cover_img, create_time, | ||
24 | + is_full, channel, notice, lottery_info, lottery_time | ||
25 | + </sql> | ||
26 | + <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> | ||
27 | + select | ||
28 | + <include refid="Base_Column_List" /> | ||
29 | + from act_prize_product | ||
30 | + where id = #{id,jdbcType=INTEGER} | ||
31 | + </select> | ||
32 | + <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> | ||
33 | + delete from act_prize_product | ||
34 | + where id = #{id,jdbcType=INTEGER} | ||
35 | + </delete> | ||
36 | + <insert id="insert" parameterType="com.yoho.activity.dal.model.ActPrizeProduct"> | ||
37 | + insert into act_prize_product (id, act_id, name, | ||
38 | + price, status, start_time, | ||
39 | + end_time, limit, sort, | ||
40 | + cover_img, create_time, is_full, | ||
41 | + channel, notice, lottery_info, | ||
42 | + lottery_time) | ||
43 | + values (#{id,jdbcType=INTEGER}, #{actId,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, | ||
44 | + #{price,jdbcType=DECIMAL}, #{status,jdbcType=TINYINT}, #{startTime,jdbcType=INTEGER}, | ||
45 | + #{endTime,jdbcType=INTEGER}, #{limit,jdbcType=INTEGER}, #{sort,jdbcType=INTEGER}, | ||
46 | + #{coverImg,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{isFull,jdbcType=TINYINT}, | ||
47 | + #{channel,jdbcType=INTEGER}, #{notice,jdbcType=VARCHAR}, #{lotteryInfo,jdbcType=VARCHAR}, | ||
48 | + #{lotteryTime,jdbcType=INTEGER}) | ||
49 | + </insert> | ||
50 | + <insert id="insertSelective" parameterType="com.yoho.activity.dal.model.ActPrizeProduct"> | ||
51 | + insert into act_prize_product | ||
52 | + <trim prefix="(" suffix=")" suffixOverrides=","> | ||
53 | + <if test="id != null"> | ||
54 | + id, | ||
55 | + </if> | ||
56 | + <if test="actId != null"> | ||
57 | + act_id, | ||
58 | + </if> | ||
59 | + <if test="name != null"> | ||
60 | + name, | ||
61 | + </if> | ||
62 | + <if test="price != null"> | ||
63 | + price, | ||
64 | + </if> | ||
65 | + <if test="status != null"> | ||
66 | + status, | ||
67 | + </if> | ||
68 | + <if test="startTime != null"> | ||
69 | + start_time, | ||
70 | + </if> | ||
71 | + <if test="endTime != null"> | ||
72 | + end_time, | ||
73 | + </if> | ||
74 | + <if test="limit != null"> | ||
75 | + limit, | ||
76 | + </if> | ||
77 | + <if test="sort != null"> | ||
78 | + sort, | ||
79 | + </if> | ||
80 | + <if test="coverImg != null"> | ||
81 | + cover_img, | ||
82 | + </if> | ||
83 | + <if test="createTime != null"> | ||
84 | + create_time, | ||
85 | + </if> | ||
86 | + <if test="isFull != null"> | ||
87 | + is_full, | ||
88 | + </if> | ||
89 | + <if test="channel != null"> | ||
90 | + channel, | ||
91 | + </if> | ||
92 | + <if test="notice != null"> | ||
93 | + notice, | ||
94 | + </if> | ||
95 | + <if test="lotteryInfo != null"> | ||
96 | + lottery_info, | ||
97 | + </if> | ||
98 | + <if test="lotteryTime != null"> | ||
99 | + lottery_time, | ||
100 | + </if> | ||
101 | + </trim> | ||
102 | + <trim prefix="values (" suffix=")" suffixOverrides=","> | ||
103 | + <if test="id != null"> | ||
104 | + #{id,jdbcType=INTEGER}, | ||
105 | + </if> | ||
106 | + <if test="actId != null"> | ||
107 | + #{actId,jdbcType=INTEGER}, | ||
108 | + </if> | ||
109 | + <if test="name != null"> | ||
110 | + #{name,jdbcType=VARCHAR}, | ||
111 | + </if> | ||
112 | + <if test="price != null"> | ||
113 | + #{price,jdbcType=DECIMAL}, | ||
114 | + </if> | ||
115 | + <if test="status != null"> | ||
116 | + #{status,jdbcType=TINYINT}, | ||
117 | + </if> | ||
118 | + <if test="startTime != null"> | ||
119 | + #{startTime,jdbcType=INTEGER}, | ||
120 | + </if> | ||
121 | + <if test="endTime != null"> | ||
122 | + #{endTime,jdbcType=INTEGER}, | ||
123 | + </if> | ||
124 | + <if test="limit != null"> | ||
125 | + #{limit,jdbcType=INTEGER}, | ||
126 | + </if> | ||
127 | + <if test="sort != null"> | ||
128 | + #{sort,jdbcType=INTEGER}, | ||
129 | + </if> | ||
130 | + <if test="coverImg != null"> | ||
131 | + #{coverImg,jdbcType=VARCHAR}, | ||
132 | + </if> | ||
133 | + <if test="createTime != null"> | ||
134 | + #{createTime,jdbcType=TIMESTAMP}, | ||
135 | + </if> | ||
136 | + <if test="isFull != null"> | ||
137 | + #{isFull,jdbcType=TINYINT}, | ||
138 | + </if> | ||
139 | + <if test="channel != null"> | ||
140 | + #{channel,jdbcType=INTEGER}, | ||
141 | + </if> | ||
142 | + <if test="notice != null"> | ||
143 | + #{notice,jdbcType=VARCHAR}, | ||
144 | + </if> | ||
145 | + <if test="lotteryInfo != null"> | ||
146 | + #{lotteryInfo,jdbcType=VARCHAR}, | ||
147 | + </if> | ||
148 | + <if test="lotteryTime != null"> | ||
149 | + #{lotteryTime,jdbcType=INTEGER}, | ||
150 | + </if> | ||
151 | + </trim> | ||
152 | + </insert> | ||
153 | + <update id="updateByPrimaryKeySelective" parameterType="com.yoho.activity.dal.model.ActPrizeProduct"> | ||
154 | + update act_prize_product | ||
155 | + <set> | ||
156 | + <if test="actId != null"> | ||
157 | + act_id = #{actId,jdbcType=INTEGER}, | ||
158 | + </if> | ||
159 | + <if test="name != null"> | ||
160 | + name = #{name,jdbcType=VARCHAR}, | ||
161 | + </if> | ||
162 | + <if test="price != null"> | ||
163 | + price = #{price,jdbcType=DECIMAL}, | ||
164 | + </if> | ||
165 | + <if test="status != null"> | ||
166 | + status = #{status,jdbcType=TINYINT}, | ||
167 | + </if> | ||
168 | + <if test="startTime != null"> | ||
169 | + start_time = #{startTime,jdbcType=INTEGER}, | ||
170 | + </if> | ||
171 | + <if test="endTime != null"> | ||
172 | + end_time = #{endTime,jdbcType=INTEGER}, | ||
173 | + </if> | ||
174 | + <if test="limit != null"> | ||
175 | + limit = #{limit,jdbcType=INTEGER}, | ||
176 | + </if> | ||
177 | + <if test="sort != null"> | ||
178 | + sort = #{sort,jdbcType=INTEGER}, | ||
179 | + </if> | ||
180 | + <if test="coverImg != null"> | ||
181 | + cover_img = #{coverImg,jdbcType=VARCHAR}, | ||
182 | + </if> | ||
183 | + <if test="createTime != null"> | ||
184 | + create_time = #{createTime,jdbcType=TIMESTAMP}, | ||
185 | + </if> | ||
186 | + <if test="isFull != null"> | ||
187 | + is_full = #{isFull,jdbcType=TINYINT}, | ||
188 | + </if> | ||
189 | + <if test="channel != null"> | ||
190 | + channel = #{channel,jdbcType=INTEGER}, | ||
191 | + </if> | ||
192 | + <if test="notice != null"> | ||
193 | + notice = #{notice,jdbcType=VARCHAR}, | ||
194 | + </if> | ||
195 | + <if test="lotteryInfo != null"> | ||
196 | + lottery_info = #{lotteryInfo,jdbcType=VARCHAR}, | ||
197 | + </if> | ||
198 | + <if test="lotteryTime != null"> | ||
199 | + lottery_time = #{lotteryTime,jdbcType=INTEGER}, | ||
200 | + </if> | ||
201 | + </set> | ||
202 | + where id = #{id,jdbcType=INTEGER} | ||
203 | + </update> | ||
204 | + <update id="updateByPrimaryKey" parameterType="com.yoho.activity.dal.model.ActPrizeProduct"> | ||
205 | + update act_prize_product | ||
206 | + set act_id = #{actId,jdbcType=INTEGER}, | ||
207 | + name = #{name,jdbcType=VARCHAR}, | ||
208 | + price = #{price,jdbcType=DECIMAL}, | ||
209 | + status = #{status,jdbcType=TINYINT}, | ||
210 | + start_time = #{startTime,jdbcType=INTEGER}, | ||
211 | + end_time = #{endTime,jdbcType=INTEGER}, | ||
212 | + limit = #{limit,jdbcType=INTEGER}, | ||
213 | + sort = #{sort,jdbcType=INTEGER}, | ||
214 | + cover_img = #{coverImg,jdbcType=VARCHAR}, | ||
215 | + create_time = #{createTime,jdbcType=TIMESTAMP}, | ||
216 | + is_full = #{isFull,jdbcType=TINYINT}, | ||
217 | + channel = #{channel,jdbcType=INTEGER}, | ||
218 | + notice = #{notice,jdbcType=VARCHAR}, | ||
219 | + lottery_info = #{lotteryInfo,jdbcType=VARCHAR}, | ||
220 | + lottery_time = #{lotteryTime,jdbcType=INTEGER} | ||
221 | + where id = #{id,jdbcType=INTEGER} | ||
222 | + </update> | ||
223 | + | ||
224 | + <sql id="selectActListSQL"> | ||
225 | + <if test="record.type == 1 and record.nowTime != null"> | ||
226 | + and status > 0 and start_time > #{record.nowTime} | ||
227 | + </if> | ||
228 | + <if test="record.type == 2 and record.nowTime != null"> | ||
229 | + and status > 1 or end_time < #{record.nowTime} or is_full > 0 | ||
230 | + </if> | ||
231 | + <if test="record.type == 0 and record.nowTime != null"> | ||
232 | + and status = 1 and start_time <= #{record.nowTime} and end_time >= #{record.nowTime} and is_full = 0 | ||
233 | + </if> | ||
234 | + <if test="record.channel != null"> | ||
235 | + and channel = #{record.channel} | ||
236 | + </if> | ||
237 | + </sql> | ||
238 | + <select id="selectActList" resultMap="BaseResultMap"> | ||
239 | + select * from act_prize_product where 1=1 | ||
240 | + <include refid="selectActListSQL" /> | ||
241 | + order by sort desc | ||
242 | + limit #{page.startIndex}, #{page.pageSize} | ||
243 | + </select> | ||
244 | +</mapper> |
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
3 | +<mapper namespace="com.yoho.activity.dal.ActPrizeProductUserMapper"> | ||
4 | + <resultMap id="BaseResultMap" type="com.yoho.activity.dal.model.ActPrizeProductUser"> | ||
5 | + <id column="id" jdbcType="INTEGER" property="id" /> | ||
6 | + <result column="act_id" jdbcType="INTEGER" property="actId" /> | ||
7 | + <result column="act_prize_id" jdbcType="INTEGER" property="actPrizeId" /> | ||
8 | + <result column="uid" jdbcType="INTEGER" property="uid" /> | ||
9 | + <result column="user_name" jdbcType="VARCHAR" property="userName" /> | ||
10 | + <result column="user_thumb" jdbcType="VARCHAR" property="userThumb" /> | ||
11 | + <result column="union_id" jdbcType="VARCHAR" property="unionId" /> | ||
12 | + <result column="prize_code" jdbcType="VARCHAR" property="prizeCode" /> | ||
13 | + <result column="is_share_take" jdbcType="TINYINT" property="isShareTake" /> | ||
14 | + <result column="share_uid" jdbcType="INTEGER" property="shareUid" /> | ||
15 | + <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | ||
16 | + </resultMap> | ||
17 | + <sql id="Base_Column_List"> | ||
18 | + id, act_id, act_prize_id, uid, user_name, user_thumb, union_id, prize_code, is_share_take, | ||
19 | + share_uid, create_time | ||
20 | + </sql> | ||
21 | + <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> | ||
22 | + select | ||
23 | + <include refid="Base_Column_List" /> | ||
24 | + from act_prize_product_user | ||
25 | + where id = #{id,jdbcType=INTEGER} | ||
26 | + </select> | ||
27 | + <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> | ||
28 | + delete from act_prize_product_user | ||
29 | + where id = #{id,jdbcType=INTEGER} | ||
30 | + </delete> | ||
31 | + <insert id="insert" parameterType="com.yoho.activity.dal.model.ActPrizeProductUser"> | ||
32 | + insert into act_prize_product_user (id, act_id, act_prize_id, | ||
33 | + uid, user_name, user_thumb, | ||
34 | + union_id, prize_code, is_share_take, | ||
35 | + share_uid, create_time) | ||
36 | + values (#{id,jdbcType=INTEGER}, #{actId,jdbcType=INTEGER}, #{actPrizeId,jdbcType=INTEGER}, | ||
37 | + #{uid,jdbcType=INTEGER}, #{userName,jdbcType=VARCHAR}, #{userThumb,jdbcType=VARCHAR}, | ||
38 | + #{unionId,jdbcType=VARCHAR}, #{prizeCode,jdbcType=VARCHAR}, #{isShareTake,jdbcType=TINYINT}, | ||
39 | + #{shareUid,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}) | ||
40 | + </insert> | ||
41 | + <insert id="insertSelective" parameterType="com.yoho.activity.dal.model.ActPrizeProductUser"> | ||
42 | + insert into act_prize_product_user | ||
43 | + <trim prefix="(" suffix=")" suffixOverrides=","> | ||
44 | + <if test="id != null"> | ||
45 | + id, | ||
46 | + </if> | ||
47 | + <if test="actId != null"> | ||
48 | + act_id, | ||
49 | + </if> | ||
50 | + <if test="actPrizeId != null"> | ||
51 | + act_prize_id, | ||
52 | + </if> | ||
53 | + <if test="uid != null"> | ||
54 | + uid, | ||
55 | + </if> | ||
56 | + <if test="userName != null"> | ||
57 | + user_name, | ||
58 | + </if> | ||
59 | + <if test="userThumb != null"> | ||
60 | + user_thumb, | ||
61 | + </if> | ||
62 | + <if test="unionId != null"> | ||
63 | + union_id, | ||
64 | + </if> | ||
65 | + <if test="prizeCode != null"> | ||
66 | + prize_code, | ||
67 | + </if> | ||
68 | + <if test="isShareTake != null"> | ||
69 | + is_share_take, | ||
70 | + </if> | ||
71 | + <if test="shareUid != null"> | ||
72 | + share_uid, | ||
73 | + </if> | ||
74 | + <if test="createTime != null"> | ||
75 | + create_time, | ||
76 | + </if> | ||
77 | + </trim> | ||
78 | + <trim prefix="values (" suffix=")" suffixOverrides=","> | ||
79 | + <if test="id != null"> | ||
80 | + #{id,jdbcType=INTEGER}, | ||
81 | + </if> | ||
82 | + <if test="actId != null"> | ||
83 | + #{actId,jdbcType=INTEGER}, | ||
84 | + </if> | ||
85 | + <if test="actPrizeId != null"> | ||
86 | + #{actPrizeId,jdbcType=INTEGER}, | ||
87 | + </if> | ||
88 | + <if test="uid != null"> | ||
89 | + #{uid,jdbcType=INTEGER}, | ||
90 | + </if> | ||
91 | + <if test="userName != null"> | ||
92 | + #{userName,jdbcType=VARCHAR}, | ||
93 | + </if> | ||
94 | + <if test="userThumb != null"> | ||
95 | + #{userThumb,jdbcType=VARCHAR}, | ||
96 | + </if> | ||
97 | + <if test="unionId != null"> | ||
98 | + #{unionId,jdbcType=VARCHAR}, | ||
99 | + </if> | ||
100 | + <if test="prizeCode != null"> | ||
101 | + #{prizeCode,jdbcType=VARCHAR}, | ||
102 | + </if> | ||
103 | + <if test="isShareTake != null"> | ||
104 | + #{isShareTake,jdbcType=TINYINT}, | ||
105 | + </if> | ||
106 | + <if test="shareUid != null"> | ||
107 | + #{shareUid,jdbcType=INTEGER}, | ||
108 | + </if> | ||
109 | + <if test="createTime != null"> | ||
110 | + #{createTime,jdbcType=TIMESTAMP}, | ||
111 | + </if> | ||
112 | + </trim> | ||
113 | + </insert> | ||
114 | + <update id="updateByPrimaryKeySelective" parameterType="com.yoho.activity.dal.model.ActPrizeProductUser"> | ||
115 | + update act_prize_product_user | ||
116 | + <set> | ||
117 | + <if test="actId != null"> | ||
118 | + act_id = #{actId,jdbcType=INTEGER}, | ||
119 | + </if> | ||
120 | + <if test="actPrizeId != null"> | ||
121 | + act_prize_id = #{actPrizeId,jdbcType=INTEGER}, | ||
122 | + </if> | ||
123 | + <if test="uid != null"> | ||
124 | + uid = #{uid,jdbcType=INTEGER}, | ||
125 | + </if> | ||
126 | + <if test="userName != null"> | ||
127 | + user_name = #{userName,jdbcType=VARCHAR}, | ||
128 | + </if> | ||
129 | + <if test="userThumb != null"> | ||
130 | + user_thumb = #{userThumb,jdbcType=VARCHAR}, | ||
131 | + </if> | ||
132 | + <if test="unionId != null"> | ||
133 | + union_id = #{unionId,jdbcType=VARCHAR}, | ||
134 | + </if> | ||
135 | + <if test="prizeCode != null"> | ||
136 | + prize_code = #{prizeCode,jdbcType=VARCHAR}, | ||
137 | + </if> | ||
138 | + <if test="isShareTake != null"> | ||
139 | + is_share_take = #{isShareTake,jdbcType=TINYINT}, | ||
140 | + </if> | ||
141 | + <if test="shareUid != null"> | ||
142 | + share_uid = #{shareUid,jdbcType=INTEGER}, | ||
143 | + </if> | ||
144 | + <if test="createTime != null"> | ||
145 | + create_time = #{createTime,jdbcType=TIMESTAMP}, | ||
146 | + </if> | ||
147 | + </set> | ||
148 | + where id = #{id,jdbcType=INTEGER} | ||
149 | + </update> | ||
150 | + <update id="updateByPrimaryKey" parameterType="com.yoho.activity.dal.model.ActPrizeProductUser"> | ||
151 | + update act_prize_product_user | ||
152 | + set act_id = #{actId,jdbcType=INTEGER}, | ||
153 | + act_prize_id = #{actPrizeId,jdbcType=INTEGER}, | ||
154 | + uid = #{uid,jdbcType=INTEGER}, | ||
155 | + user_name = #{userName,jdbcType=VARCHAR}, | ||
156 | + user_thumb = #{userThumb,jdbcType=VARCHAR}, | ||
157 | + union_id = #{unionId,jdbcType=VARCHAR}, | ||
158 | + prize_code = #{prizeCode,jdbcType=VARCHAR}, | ||
159 | + is_share_take = #{isShareTake,jdbcType=TINYINT}, | ||
160 | + share_uid = #{shareUid,jdbcType=INTEGER}, | ||
161 | + create_time = #{createTime,jdbcType=TIMESTAMP} | ||
162 | + where id = #{id,jdbcType=INTEGER} | ||
163 | + </update> | ||
164 | +</mapper> |
@@ -16,6 +16,7 @@ | @@ -16,6 +16,7 @@ | ||
16 | <project-name>yohobuy-activity</project-name> | 16 | <project-name>yohobuy-activity</project-name> |
17 | <project-version>1.0.0-SNAPSHOT</project-version> | 17 | <project-version>1.0.0-SNAPSHOT</project-version> |
18 | <yoho.service.model.version>1.0.0-SNAPSHOT</yoho.service.model.version> | 18 | <yoho.service.model.version>1.0.0-SNAPSHOT</yoho.service.model.version> |
19 | + <yohobuy-tools-version>0.0.1-SNAPSHOT</yohobuy-tools-version> | ||
19 | </properties> | 20 | </properties> |
20 | 21 | ||
21 | <dependencyManagement> | 22 | <dependencyManagement> |
@@ -60,6 +61,11 @@ | @@ -60,6 +61,11 @@ | ||
60 | 61 | ||
61 | <dependencies> | 62 | <dependencies> |
62 | <dependency> | 63 | <dependency> |
64 | + <groupId>com.yoho.tools</groupId> | ||
65 | + <artifactId>yohobuy-tools-common</artifactId> | ||
66 | + <version>${yohobuy-tools-version}</version> | ||
67 | + </dependency> | ||
68 | + <dependency> | ||
63 | <groupId>com.yoho.common</groupId> | 69 | <groupId>com.yoho.common</groupId> |
64 | <artifactId>error-code</artifactId> | 70 | <artifactId>error-code</artifactId> |
65 | </dependency> | 71 | </dependency> |
1 | +/** | ||
2 | + * | ||
3 | + */ | ||
4 | +package com.yoho.activity.service; | ||
5 | + | ||
6 | +import com.yoho.activity.common.ApiResponse; | ||
7 | +import com.yoho.activity.common.bo.ActPrizeProductBo; | ||
8 | +import com.yoho.activity.common.vo.YoLuckReq; | ||
9 | +import com.yoho.error.exception.ServiceException; | ||
10 | +import com.yoho.tools.common.beans.page.PageRequest; | ||
11 | + | ||
12 | +import java.util.List; | ||
13 | + | ||
14 | +/** | ||
15 | + * 描述:Yo!Luck 相关接口 | ||
16 | + * @author sefon 2019-1-15 12:15:11 | ||
17 | + */ | ||
18 | +public interface IYoLuckService { | ||
19 | + | ||
20 | + /** | ||
21 | + * 元购列表 | ||
22 | + * @param request | ||
23 | + * @param page | ||
24 | + * @return | ||
25 | + * @throws Exception | ||
26 | + */ | ||
27 | + public List<ActPrizeProductBo> actList(YoLuckReq request, PageRequest page) throws ServiceException; | ||
28 | +} |
1 | +package com.yoho.activity.service.impl; | ||
2 | + | ||
3 | +import com.yoho.activity.common.bo.ActPrizeProductBo; | ||
4 | +import com.yoho.activity.common.convert.ActPrizeProductConvert; | ||
5 | +import com.yoho.activity.common.redis.CacheKeyHelper; | ||
6 | +import com.yoho.activity.common.vo.YoLuckReq; | ||
7 | +import com.yoho.activity.dal.model.ActPrizeProduct; | ||
8 | +import com.yoho.activity.service.IYoLuckService; | ||
9 | +import com.yoho.core.common.utils.DateUtil; | ||
10 | +import com.yoho.core.redis.cluster.annotation.Redis; | ||
11 | +import com.yoho.core.redis.cluster.operations.nosync.YHValueOperations; | ||
12 | +import com.yoho.core.redis.cluster.operations.serializer.RedisKeyBuilder; | ||
13 | +import com.yoho.error.exception.ServiceException; | ||
14 | +import com.yoho.tools.common.beans.page.PageRequest; | ||
15 | +import com.yoho.tools.common.redis.RedisValueHelper; | ||
16 | +import org.apache.commons.collections.CollectionUtils; | ||
17 | +import org.slf4j.Logger; | ||
18 | +import org.slf4j.LoggerFactory; | ||
19 | +import org.springframework.beans.factory.annotation.Autowired; | ||
20 | +import org.springframework.stereotype.Service; | ||
21 | +import com.yoho.activity.dal.ActPrizeProductMapper; | ||
22 | +import com.yoho.activity.common.enums.YoLockActivityStatusEnum; | ||
23 | +import com.yoho.activity.common.enums.YoLockActivityListTypeEnum; | ||
24 | +import com.yoho.activity.common.constatns.Constant; | ||
25 | +import javax.annotation.Resource; | ||
26 | +import java.util.ArrayList; | ||
27 | +import java.util.List; | ||
28 | +import java.util.concurrent.TimeUnit; | ||
29 | + | ||
30 | + | ||
31 | +@Service | ||
32 | +public class YoLuckServiceImpl implements IYoLuckService { | ||
33 | + | ||
34 | + private static Logger log = LoggerFactory.getLogger(YoLuckServiceImpl.class); | ||
35 | + | ||
36 | + @Resource | ||
37 | + private ActPrizeProductMapper actPrizeProductMapper; | ||
38 | + | ||
39 | + @Autowired | ||
40 | + RedisValueHelper redisValueHelper; | ||
41 | + | ||
42 | + @Redis("yohoNoSyncRedis") | ||
43 | + YHValueOperations yhValueOperations; | ||
44 | + | ||
45 | + | ||
46 | + /** | ||
47 | + * 活动列表 | ||
48 | + * @param request | ||
49 | + * @param page | ||
50 | + * @return | ||
51 | + * @throws ServiceException | ||
52 | + */ | ||
53 | + @Override | ||
54 | + public List<ActPrizeProductBo> actList(YoLuckReq request, PageRequest page) throws ServiceException { | ||
55 | + log.info("Enter YoLuckController getActivityList YoLuckReq request = {}, PageRequest = {}", request, page); | ||
56 | + List<ActPrizeProductBo> resultList = new ArrayList<>(); | ||
57 | + do { | ||
58 | + // 缓存 | ||
59 | + RedisKeyBuilder listCacheKey = getCacheKey(request, page); | ||
60 | + String value = yhValueOperations.get(listCacheKey); | ||
61 | + List<ActPrizeProductBo> redisResultList = CacheKeyHelper.string2Value(value, List.class); | ||
62 | + if (CollectionUtils.isNotEmpty(redisResultList)) { | ||
63 | + resultList = redisResultList; | ||
64 | + log.warn("getActivityList with result from redis."); | ||
65 | + break; | ||
66 | + } | ||
67 | + | ||
68 | + // 数据库 | ||
69 | + ActPrizeProduct record = ActPrizeProductConvert.bo2DalRequest(request); | ||
70 | + record.setNowTime(DateUtil.getCurrentTimeSecond()); | ||
71 | + List<ActPrizeProduct> list = actPrizeProductMapper.selectActList(record, page.toPageModel()); | ||
72 | + | ||
73 | + if (CollectionUtils.isEmpty(list)) { | ||
74 | + log.warn("getActivityList with result is empty."); | ||
75 | + break; | ||
76 | + } | ||
77 | + | ||
78 | + ActPrizeProductBo itemBo = null; | ||
79 | + for (ActPrizeProduct item : list) { | ||
80 | + itemBo = ActPrizeProductConvert.db2bo(item); | ||
81 | + itemBo.setStatus(getActivityStatus(itemBo)); | ||
82 | + resultList.add(itemBo); | ||
83 | + } | ||
84 | + | ||
85 | + // 存缓存 | ||
86 | + try { | ||
87 | + yhValueOperations.set(listCacheKey, CacheKeyHelper.value2String(resultList), 10, TimeUnit.SECONDS); | ||
88 | + } catch (Exception e) { | ||
89 | + log.warn("setActivityList redis cache fail err={}.", e); | ||
90 | + } | ||
91 | + | ||
92 | + } while (false); | ||
93 | + | ||
94 | + return resultList; | ||
95 | + } | ||
96 | + | ||
97 | + | ||
98 | + /** | ||
99 | + * 获取活动的状态 | ||
100 | + * @param bo | ||
101 | + * @return | ||
102 | + */ | ||
103 | + private Integer getActivityStatus(ActPrizeProductBo bo) { | ||
104 | + // 默认活动已经开始,正在进行中 | ||
105 | + Integer status = YoLockActivityStatusEnum._2.getStatus(); | ||
106 | + Integer nowTime = DateUtil.getCurrentTimeSecond(); | ||
107 | + | ||
108 | + if (bo.getStatus() == 2) { // 已经开奖 | ||
109 | + status = YoLockActivityStatusEnum._4.getStatus(); | ||
110 | + } else { // 未开奖 | ||
111 | + if (nowTime > bo.getEndTime()) { | ||
112 | + // 时间已过结束时间 | ||
113 | + status = YoLockActivityStatusEnum._3.getStatus(); | ||
114 | + } else if (nowTime > bo.getEndTime()) { | ||
115 | + // 时间未到结束时间 | ||
116 | + status = YoLockActivityStatusEnum._1.getStatus(); | ||
117 | + } | ||
118 | + } | ||
119 | + | ||
120 | + return status; | ||
121 | + } | ||
122 | + | ||
123 | + | ||
124 | + /** | ||
125 | + * 获取活动列表缓存key | ||
126 | + * @param request | ||
127 | + * @param page | ||
128 | + * @return | ||
129 | + */ | ||
130 | + private RedisKeyBuilder getCacheKey(YoLuckReq request, PageRequest page){ | ||
131 | + return RedisKeyBuilder.newInstance().appendFixed(Constant.YOLUCK_ACTIVITY_CACHE_PREFIX).appendVar(request.getType()).appendFixed(":").appendVar(page.toString()); | ||
132 | + } | ||
133 | +} |
@@ -24,4 +24,15 @@ datasources: | @@ -24,4 +24,15 @@ datasources: | ||
24 | - com.yoho.lottery.dal.WeixinBindPrizeMapper | 24 | - com.yoho.lottery.dal.WeixinBindPrizeMapper |
25 | - com.yoho.lottery.dal.LotteryPrizeMapper | 25 | - com.yoho.lottery.dal.LotteryPrizeMapper |
26 | 26 | ||
27 | + yoho_activity_platform: | ||
28 | + servers: | ||
29 | + - 192.168.102.219:3306 | ||
30 | + - 192.168.102.219:3306 | ||
31 | + username: yh_test | ||
32 | + password: 9nm0icOwt6bMHjMusIfMLw== | ||
33 | + daos: | ||
34 | + - com.yoho.activity.dal.ActPrizeProductMapper | ||
35 | + - com.yoho.activity.dal.ActPrizeProductContentMapper | ||
36 | + - com.yoho.activity.dal.ActPrizeProductUserMapper | ||
37 | + | ||
27 | readOnlyInSlave: true | 38 | readOnlyInSlave: true |
-
Please register or login to post a comment