yujian
2019-12-07 fb2faf11c5607cffc34480228e346609d7bb5b42
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
package com.yeshi.fanli.service.inter.user;
 
import java.math.BigDecimal;
import java.util.List;
 
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.bus.user.UserSystemCoupon;
import com.yeshi.fanli.entity.bus.user.UserSystemCouponGiveRecord;
import com.yeshi.fanli.entity.system.SystemCoupon;
import com.yeshi.fanli.exception.user.UserSystemCouponException;
import com.yeshi.fanli.vo.user.UserSystemCouponRecordVO;
import com.yeshi.fanli.vo.user.UserSystemCouponVO;
 
public interface UserSystemCouponService {
    
    public int insertSelective(UserSystemCoupon record);
 
    public UserSystemCoupon selectByPrimaryKey(Long id);
 
    public int updateByPrimaryKeySelective(UserSystemCoupon record);
 
    public int updateByPrimaryKey(UserSystemCoupon record);
 
    /**
     * 查询用户券列表 返回基础对象
     * @param start
     * @param count
     * @param uid
     * @return
     */
    public List<UserSystemCoupon> getUserCouponList(long start, int count, Long uid);
 
    /**
     * 查询用户券列表 返回VO对象
     * @param start
     * @param count
     * @param uid
     * @return
     */
    public List<UserSystemCouponVO> getUserCouponVOList(long start, int count, Long uid, boolean changeJump ) throws UserSystemCouponException, Exception;
 
    /**
     * 统计数量
     * @param uid
     * @return
     */
    public long countUserCouponList(Long uid);
 
    /**
     *  券ID信息查询用户拥有券
     * @param uid
     * @param couponList
     * @return
     * @throws UserSystemCouponException
     * @throws Exception
     */
    public List<UserSystemCouponVO> getEnableListByCouponId(Long uid,  Integer activated, List<SystemCoupon> couponList)
            throws UserSystemCouponException, Exception;
 
    /**
     * 查询订单使用相关券
     * @param uid
     * @return
     * @throws UserSystemCouponException
     * @throws Exception
     */
    public List<UserSystemCouponVO> getOrderCouponList(Long uid) throws UserSystemCouponException, Exception;
 
    /**
     * 查询商品使用相关券
     * @param uid
     * @return
     * @throws UserSystemCouponException
     * @throws Exception
     */
    public List<UserSystemCouponVO> getGoodsCouponList(Long uid, Long auctionId) throws UserSystemCouponException, Exception;
 
    /**
     * 更新券使用记录
     * @param uid
     * @param id 
     * @throws UserSystemCouponException
     * @throws Exception
     */
    public void useGoodsCoupon(Long uid, Long id, Long goodId, Integer sourceType) throws UserSystemCouponException, Exception;
    
    
    /**
     * 更新券使用记录
     * @param uid
     * @param id
     * @throws UserSystemCouponException
     * @throws Exception
     */
    public void useOrderCoupon(Long uid, Long id, String orderNo, Integer sourceType, AcceptData acceptData) throws UserSystemCouponException, Exception;
 
    /**
     * 根据订单号获取奖励券使用进度
     * @param orderNo
     * @return 
     * @throws UserSystemCouponException
     * @throws Exception
     */
    public UserSystemCouponRecordVO getRewardCouponRecord(String orderNo, Integer sourceType) throws UserSystemCouponException, Exception;
 
    /**
     * 是否存在奖励券
     * @param uid
     * @return
     */
    public boolean hasRewardCoupon(Long uid);
 
    /**
     * 根据订单号获取免单券使用进度
     * @param orderNo
     * @return
     * @throws UserSystemCouponException
     * @throws Exception
     */
    public UserSystemCouponRecordVO getFreeCouponRecord(String orderNo, Integer sourceType) throws UserSystemCouponException, Exception;
 
    /**
     * 根据订单来源查询
     * @param uid
     * @param source
     * @return
     */
    public List<UserSystemCoupon> getUserCouponBySource(Long uid, String source);
 
    /**
     * 插入券信息
     * @param uid
     * @param couponType
     * @param source  来源
     * @throws UserSystemCouponException
     * @throws Exception
     */
    public UserSystemCoupon insertUserCoupon(Long uid, String couponType, String source, BigDecimal percent,Boolean needNotify) throws UserSystemCouponException, Exception;
 
 
    /**
     * 退回券
     * @param uid
     */
    public void sendBackTimeOutCoupon(Long uid);
 
    /**
     * 激活福利免单券
     * @param uid
     */
    public void activatedWelfareFreeCoupon(Long uid, String from);
 
    /**
     * 更新券记录 ——匹配免单券
     * @param uid        用户id
     * @param orderNo    订单号
     * @param payment    付款金额
     * @param auctionId  商品id(淘宝)
     * @return           免单成功 true 
     * @throws Exception
     */
    public boolean updateCouponRecordUsed(Long uid, String orderNo, BigDecimal payment, Long auctionId) throws  Exception;
 
    /**
     * 订单退款更新 券记录状态并退回券
     * @param orderNo
     */
    public void updateStateByDrawback(String orderNo) throws Exception;
 
    /**
     * 红包到账 -- 更新券使用状态 -改为使用成功
     * @param orderNo
     * @throws Exception
     */
    public void updateStateByArrivalAccount(String orderNo) throws Exception;
 
    /**
     * 领取未登录时已抽奖的礼品
     * @param uid
     * @param platform
     * @param device
     * @throws Exception
     */
    public void copyLotteryPrize(Long uid, int platform, String device) throws Exception;
 
    
 
    /**
     * 统计今日抽奖中的券数量
     * @param uid
     * @param source
     * @return
     */
    public int countTodatyUserCouponBySource(Long uid, String source);
 
    /**
     * 随机生成奖励券
     * @param num
     * @param uid
     * @param source
     * @throws Exception
     */
    public void randomRewardCoupon(int num, Long uid, String source) throws Exception;
    
    
    
    
    /**
     * 系统赠送奖励券
     * @param num
     * @param uid
     * @param source
     * @throws Exception
     */
    public void systemGiveRewardCoupon(Long uid,int num,String orderId,Integer orderType,String reason) throws Exception;
    
    
    
    
 
    /**
     * 添加券
     * @param uid
     * @param couponType
     * @param source
     * @throws UserSystemCouponException
     */
    public void exchangeCoupon(Long uid, String couponType, String source,
            BigDecimal percent) throws UserSystemCouponException, Exception;
 
    
    /**
     * 券列表 1.6.5
     * @param start
     * @param count
     * @param uid
     * @return
     * @throws UserSystemCouponException
     * @throws Exception
     */
    public List<UserSystemCouponVO> getCouponList(AcceptData acceptData, long start, int count, Long uid) throws UserSystemCouponException, Exception;
 
    
    /**
     * 赠送券生成口令
     * @param uid
     * @param id
     * @return
     * @throws UserSystemCouponException
     */
    public UserSystemCouponVO giveCoupon(Long uid, Long id) throws UserSystemCouponException;
 
 
    /**
     * 赠送退回
     * @param id
     */
    public void sendBackGiveCoupon(List<UserSystemCouponGiveRecord> overdueList);
 
    /**
     * 查询需要过期的
     * @param count
     * @return
     */
    public List<UserSystemCoupon> getCounponNowInvalid(int count);
 
    /**
     * 过期券
     * @param list
     */
    public void updateCounponInvalid(List<UserSystemCoupon> list);
 
    /**
     * 有效奖励券
     * @param uid
     * @return
     */
    public boolean getValidRebateCoupon(Long uid);
 
 
    /**
     * 查询1.6.5之前的  不等于35%
     * @param uid
     * @return
     */
    public List<UserSystemCouponVO> listIncludeNotExchange(Long uid) throws Exception;
 
    public long countCouponOld(Long uid);
 
    /**
     * 更新用户过期券
     * @param uid
     */
    public void updateInvalidSate(Long uid);
 
    /*
     * 赠送券
     */
    public void sendBackGiveUser(Long uid);
 
    /**
     * 统计可使用的免单券
     * @param uid
     * @return
     */
    public long countUsableFreeCouponForBuy(Long uid);
    
    /**
     * 统计可使用的奖励券
     * @param uid
     * @return
     */
    public long countUsableRewardCoupon(Long uid);
 
    /**
     * 查询免券数量
     * @param uid
     * @param type
     * @return
     */
    public List<UserSystemCoupon> getFreeCouponByType(Long uid, String type);
 
    /**
     * 激活免单券---订单已到账   触发激活免单券
     * @param uid
     */
    public void triggerFreeCouponActivate(Long uid, String orderNo, Integer source);
 
    /**
     * 退回券
     * @param giveid
     */
    public void sendBackByGiveId(Long giveid);
 
}