From d88c167fc5973a2c15ff1539e4cdab36e4a7842c Mon Sep 17 00:00:00 2001
From: yujian <yujian@123.com>
Date: 星期三, 28 八月 2019 14:47:15 +0800
Subject: [PATCH] 奖励券使用区分订单下单三方日期

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserCouponController.java |   43 ++++++++++++++++++++-----------------------
 1 files changed, 20 insertions(+), 23 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserCouponController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserCouponController.java
index f6bbfca..30209f2 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserCouponController.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserCouponController.java
@@ -119,13 +119,11 @@
 				changeJump = true;
 			}
 			
-			long count = 0;
+			long count = UserSystemCouponService.countCouponOld(uid);
 			List<UserSystemCouponVO> resultList = UserSystemCouponService
 					.getUserCouponVOList((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid, changeJump);
 
-			if (resultList != null && resultList.size() > 0) {
-				count = UserSystemCouponService.countUserCouponList(uid);
-			} else if (resultList == null) {
+			 if (resultList == null) {
 				resultList = new ArrayList<UserSystemCouponVO>();
 			}
 
@@ -216,14 +214,18 @@
 	 * @param out
 	 */
 	@RequestMapping(value = "useFreeCoupon", method = RequestMethod.POST)
-	public void useFreeCoupon(AcceptData acceptData, Long uid, Long cid, Long goodId, PrintWriter out) {
+	public void useFreeCoupon(AcceptData acceptData, Long uid, Long cid, Long goodId, Integer goodsType, PrintWriter out) {
 		if (uid == null) {
 			out.print(JsonUtil.loadFalseResult("鐢ㄦ埛鏈櫥褰�"));
 			return;
 		}
+		
+		if (goodsType == null || goodsType > 3 || goodsType < 1) {
+			goodsType = Constant.SOURCE_TYPE_TAOBAO;
+		}
 
 		try {
-			UserSystemCouponService.useGoodsCoupon(uid, cid, goodId);
+			UserSystemCouponService.useGoodsCoupon(uid, cid, goodId, goodsType);
 			out.print(JsonUtil.loadTrueResult("浣跨敤鎴愬姛"));
 		} catch (UserSystemCouponException e) {
 			out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
@@ -293,11 +295,8 @@
 		
 		try {
 			UserSystemCouponService.useOrderCoupon(uid, cid, orderNo, goodsType);
-
 			JSONObject data = commonOrderService.getRewardJumpInfo(orderNo);
-
 			out.print(JsonUtil.loadTrueResult(data));
-
 		} catch (UserSystemCouponException e) {
 			out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
 		} catch (Exception e) {
@@ -314,17 +313,16 @@
 	 * @param out
 	 */
 	@RequestMapping(value = "getRewardRecord", method = RequestMethod.POST)
-	public void getRewardCounponRecord(AcceptData acceptData, String orderNo, PrintWriter out) {
-
+	public void getRewardCounponRecord(AcceptData acceptData, String orderNo, Integer goodsType, PrintWriter out) {
 		try {
-
-			UserSystemCouponRecordVO rewardRecord = UserSystemCouponService.getRewardCouponRecord(orderNo);
-
+			if (goodsType == null || goodsType > 3 || goodsType < 1) {
+				goodsType = Constant.SOURCE_TYPE_TAOBAO;
+			}
+			
+			UserSystemCouponRecordVO rewardRecord = UserSystemCouponService.getRewardCouponRecord(orderNo, goodsType);
 			JSONObject data = new JSONObject();
 			data.put("rewardRecord", rewardRecord);
-
 			out.print(JsonUtil.loadTrueResult(data));
-
 		} catch (UserSystemCouponException e) {
 			out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
 		} catch (Exception e) {
@@ -341,17 +339,16 @@
 	 * @param out
 	 */
 	@RequestMapping(value = "getFreeCounponRecord", method = RequestMethod.POST)
-	public void getFreeCounponRecord(AcceptData acceptData, String orderNo, PrintWriter out) {
-
+	public void getFreeCounponRecord(AcceptData acceptData, String orderNo, Integer goodsType, PrintWriter out) {
 		try {
-
-			UserSystemCouponRecordVO rewardRecord = UserSystemCouponService.getFreeCouponRecord(orderNo);
-
+			if (goodsType == null || goodsType > 3 || goodsType < 1) {
+				goodsType = Constant.SOURCE_TYPE_TAOBAO;
+			}
+			
+			UserSystemCouponRecordVO rewardRecord = UserSystemCouponService.getFreeCouponRecord(orderNo, goodsType);
 			JSONObject data = new JSONObject();
 			data.put("frreCouponRecord", rewardRecord);
-
 			out.print(JsonUtil.loadTrueResult(data));
-
 		} catch (UserSystemCouponException e) {
 			out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
 		} catch (Exception e) {

--
Gitblit v1.8.0