Authored by caoyan

订单列表

@@ -10,6 +10,7 @@ import org.slf4j.LoggerFactory; @@ -10,6 +10,7 @@ import org.slf4j.LoggerFactory;
10 import org.springframework.stereotype.Controller; 10 import org.springframework.stereotype.Controller;
11 import org.springframework.web.bind.annotation.RequestBody; 11 import org.springframework.web.bind.annotation.RequestBody;
12 import org.springframework.web.bind.annotation.RequestMapping; 12 import org.springframework.web.bind.annotation.RequestMapping;
  13 +import org.springframework.web.bind.annotation.RequestParam;
13 import org.springframework.web.bind.annotation.ResponseBody; 14 import org.springframework.web.bind.annotation.ResponseBody;
14 15
15 import com.yoho.activity.common.ApiResponse; 16 import com.yoho.activity.common.ApiResponse;
@@ -49,25 +50,21 @@ public class LotteryController { @@ -49,25 +50,21 @@ public class LotteryController {
49 } 50 }
50 51
51 /** 52 /**
52 - * 查询用户订单信息(时间:15天 至 一个月,是否已经抽奖) 53 + * 查询用户订单列表(时间:15天 至 一个月,是否已经抽奖)
53 * 54 *
54 - * @param lotteryId 活动id  
55 - * @param userId 用户id  
56 - * @param orderCode 订单编号  
57 - * @return 抽奖状态信息 55 + * @param uid 用户id
  56 + * @return 用户有效的订单列表
58 */ 57 */
59 - @RequestMapping("/getValidOrderInfo") 58 + @RequestMapping("/getValidOrderList")
60 @ResponseBody 59 @ResponseBody
61 - public ApiResponse getValidOrderInfo(@RequestBody LotteryVO vo) {  
62 - logger.info("Start getValidTimeOrderInfo with req {}", vo); 60 + public ApiResponse getValidOrderList(@RequestParam(value="uid")Integer uid) {
  61 + logger.info("Start getValidOrderList with uid is {}", uid);
63 62
64 - Integer userId = vo.getUserId();  
65 -  
66 - checkUserId(userId); 63 + checkUserId(uid);
67 64
68 - LotteryRespData respData = lotteryService.getValidTimeOrderInfo(userId); 65 + LotteryRespData respData = lotteryService.getValidOrderList(uid);
69 66
70 - logger.info("End getValidTimeOrderInfo with req {}", vo); 67 + logger.info("End getValidOrderList");
71 return new ApiResponse(respData); 68 return new ApiResponse(respData);
72 } 69 }
73 70
@@ -8,7 +8,7 @@ public interface WeixinOrderListMapper { @@ -8,7 +8,7 @@ public interface WeixinOrderListMapper {
8 8
9 int insert(WeixinOrderList record); 9 int insert(WeixinOrderList record);
10 10
11 - WeixinOrderList selectByPrimaryKey(Long orderCode); 11 + List<Integer> selectOrderCodeByUid(Integer uid);
12 12
13 List<WeixinOrderList> selectAll(); 13 List<WeixinOrderList> selectAll();
14 14
@@ -26,10 +26,10 @@ @@ -26,10 +26,10 @@
26 prize_id = #{prizeId,jdbcType=INTEGER} 26 prize_id = #{prizeId,jdbcType=INTEGER}
27 where order_code = #{orderCode,jdbcType=BIGINT} 27 where order_code = #{orderCode,jdbcType=BIGINT}
28 </update> 28 </update>
29 - <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">  
30 - select order_code, create_time, uid, wx, prize_id 29 + <select id="selectOrderCodeByUid" parameterType="java.lang.Integer">
  30 + select order_code
31 from weixin_order_list 31 from weixin_order_list
32 - where order_code = #{orderCode,jdbcType=BIGINT} 32 + where uid = #{uid,jdbcType=INTEGER}
33 </select> 33 </select>
34 <select id="selectAll" resultMap="BaseResultMap"> 34 <select id="selectAll" resultMap="BaseResultMap">
35 select order_code, create_time, uid, wx, prize_id 35 select order_code, create_time, uid, wx, prize_id
@@ -37,13 +37,13 @@ public interface ILotteryService { @@ -37,13 +37,13 @@ public interface ILotteryService {
37 LotteryRespData lucky(Integer lotteryId, Integer userId, Integer orderCode); 37 LotteryRespData lucky(Integer lotteryId, Integer userId, Integer orderCode);
38 38
39 /** 39 /**
40 - * 查询用户订单信息(时间:15天 至 一个月) 40 + * 查询用户订单列表(时间:距离当前时间15天 至 一个月)
41 * 41 *
42 * @param lotteryId 活动id 42 * @param lotteryId 活动id
43 * @param userId 用户id 43 * @param userId 用户id
44 * @param orderCode 订单编号 44 * @param orderCode 订单编号
45 * @return 抽奖状态信息 45 * @return 抽奖状态信息
46 */ 46 */
47 - LotteryRespData getValidTimeOrderInfo(Integer userId); 47 + LotteryRespData getValidOrderList(Integer userId);
48 48
49 } 49 }
@@ -3,14 +3,21 @@ @@ -3,14 +3,21 @@
3 */ 3 */
4 package com.yoho.activity.service.impl; 4 package com.yoho.activity.service.impl;
5 5
  6 +import java.util.List;
  7 +
  8 +import org.springframework.beans.factory.annotation.Autowired;
6 import org.springframework.stereotype.Service; 9 import org.springframework.stereotype.Service;
7 10
8 import com.yoho.activity.common.vo.LotteryRespData; 11 import com.yoho.activity.common.vo.LotteryRespData;
9 import com.yoho.activity.service.ILotteryService; 12 import com.yoho.activity.service.ILotteryService;
  13 +import com.yoho.lottery.dal.WeixinOrderListMapper;
10 14
11 15
12 @Service 16 @Service
13 public class LotteryServiceImpl implements ILotteryService { 17 public class LotteryServiceImpl implements ILotteryService {
  18 +
  19 + @Autowired
  20 + private WeixinOrderListMapper weixinOrderListMapper;
14 21
15 @Override 22 @Override
16 public LotteryRespData getLotteryInfo(Integer lotteryId) { 23 public LotteryRespData getLotteryInfo(Integer lotteryId) {
@@ -31,8 +38,9 @@ public class LotteryServiceImpl implements ILotteryService { @@ -31,8 +38,9 @@ public class LotteryServiceImpl implements ILotteryService {
31 } 38 }
32 39
33 @Override 40 @Override
34 - public LotteryRespData getValidTimeOrderInfo(Integer userId) {  
35 - // TODO Auto-generated method stub 41 + public LotteryRespData getValidOrderList(Integer uid) {
  42 + List<Integer> weixinOrderCodeList = weixinOrderListMapper.selectOrderCodeByUid(uid);
  43 +
36 return null; 44 return null;
37 } 45 }
38 46
@@ -5,5 +5,14 @@ datasources: @@ -5,5 +5,14 @@ datasources:
5 - 192.168.102.219:3306 5 - 192.168.102.219:3306
6 username: yh_test 6 username: yh_test
7 password: 9nm0icOwt6bMHjMusIfMLw== 7 password: 9nm0icOwt6bMHjMusIfMLw==
  8 +
  9 + yh_lottery:
  10 + servers:
  11 + - 192.168.102.219:3306
  12 + - 192.168.102.219:3306
  13 + username: yh_test
  14 + password: 9nm0icOwt6bMHjMusIfMLw==
  15 + daos:
  16 + - com.yoho.lottery.dal.WeixinORderListMapper
8 17
9 readOnlyInSlave: true 18 readOnlyInSlave: true