From 30d8e227e8d823b6c38c3b9c90ac2df03b63befe Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 25 二月 2025 16:41:22 +0800
Subject: [PATCH] 淘宝转链接口更新

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserCouponControllerV2.java |  486 +++++++++++++++++++++++++++---------------------------
 1 files changed, 243 insertions(+), 243 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserCouponControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserCouponControllerV2.java
index 8ef0b9c..309e57d 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserCouponControllerV2.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserCouponControllerV2.java
@@ -1,243 +1,243 @@
-package com.yeshi.fanli.controller.client.v2;
-
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-import javax.annotation.Resource;
-
-import org.springframework.core.task.TaskExecutor;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.yeshi.utils.JsonUtil;
-
-import com.yeshi.fanli.entity.accept.AcceptData;
-import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
-import com.yeshi.fanli.entity.order.CommonOrder;
-import com.yeshi.fanli.entity.system.ConfigKeyEnum;
-import com.yeshi.fanli.exception.user.UserSystemCouponException;
-import com.yeshi.fanli.log.LogHelper;
-import com.yeshi.fanli.service.inter.config.ConfigService;
-import com.yeshi.fanli.service.inter.config.SystemCouponService;
-import com.yeshi.fanli.service.inter.homemodule.SwiperPictureService;
-import com.yeshi.fanli.service.inter.order.CommonOrderService;
-import com.yeshi.fanli.service.inter.user.DeviceLotteryRecordService;
-import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
-import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
-import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
-import com.yeshi.fanli.util.Constant;
-import com.yeshi.fanli.util.StringUtil;
-import com.yeshi.fanli.util.TimeUtil;
-import com.yeshi.fanli.vo.homemodule.BannerVO;
-import com.yeshi.fanli.vo.user.UserSystemCouponVO;
-
-import net.sf.json.JSONObject;
-
-/**
- * 绂忓埄涓績
- * 
- * @author Administrator
- *
- */
-@Controller
-@RequestMapping("api/v2/user/coupon")
-public class UserCouponControllerV2 {
-
-	@Resource(name = "taskExecutor")
-	private TaskExecutor executor;
-
-	@Resource
-	private ConfigService configService;
-
-	@Resource
-	private SystemCouponService systemCouponService;
-	
-	@Resource
-	private UserSystemCouponService UserSystemCouponService;
-
-	@Resource
-	private SwiperPictureService swiperPictureService;
-
-	@Resource
-	private CommonOrderService commonOrderService;
-
-	@Resource
-	private DeviceLotteryRecordService deviceLotteryRecordService;
-
-	@Resource
-	private UserSystemCouponService userSystemCouponService;
-
-	@Resource
-	private UserInfoExtraService userInfoExtraService;
-
-	@Resource
-	private UserVIPInfoService userVIPInfoService;
-
-	/**
-	 * 鐢ㄦ埛鍒稿垪琛ㄦ煡璇�
-	 * 
-	 * @param acceptData
-	 * @param page
-	 * @param uid
-	 * @param out
-	 */
-	@RequestMapping(value = "getCouponList", method = RequestMethod.POST)
-	public void getCouponList(AcceptData acceptData, Integer page, Long uid, PrintWriter out) {
-		if (uid == null || uid <= 0) {
-			out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛鏈櫥褰�"));
-			return;
-		}
-
-		if (page == null || page < 1) {
-			out.print(JsonUtil.loadFalseResult(1, "椤电爜涓嶆纭�"));
-			return;
-		}
-
-		try {
-			JSONObject data = new JSONObject();
-			if (page == 1) {
-				// 绂忓埄涓績鍥剧墖
-				List<BannerVO> listswiper = swiperPictureService.getByBannerCardAndVersion("welfare_top_1.6.5",acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()),acceptData.getSystem());
-				if (listswiper != null && listswiper.size() > 0) {
-					String topPicture = listswiper.get(0).getSrc();
-					data.put("topPicture", topPicture);
-				}
-			}
-	
-			long count = UserSystemCouponService.countUserCouponList(uid);
-			
-			List<UserSystemCouponVO> resultList = UserSystemCouponService.getCouponList(acceptData,(page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid);
-			if (resultList == null) {
-				resultList = new ArrayList<UserSystemCouponVO>();
-			}
-			
-			data.put("count", count);
-			data.put("list", JsonUtil.getApiCommonGson().toJson(resultList));
-			out.print(JsonUtil.loadTrueResult(data));
-		} catch (UserSystemCouponException e) {
-			out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
-		} catch (Exception e) {
-			out.print(JsonUtil.loadFalseResult(1, "鏌ヨ澶辫触"));
-			LogHelper.errorDetailInfo(e);
-		}
-		
-		// 鏇存柊绂忓埄涓績鏈鏁伴噺
-		if (page == 1) {
-			try {
-				executor.execute(new Runnable() {
-					@Override
-					public void run() {
-						UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
-						// 鏈鍒告槸鍚﹀ぇ浜�0
-						if (userInfoExtra != null && userInfoExtra.getCouponNews() > 0) {
-							UserInfoExtra extra = new UserInfoExtra();
-							extra.setId(userInfoExtra.getId());
-							extra.setCouponNews(0);
-							userInfoExtraService.updateByPrimaryKeySelective(extra);
-						}
-					}
-				});
-			} catch (Exception e) {
-			}
-		}
-	}
-
-	
-	/**
-	 * 璧犻�佸埜鍙d护鐢熸垚
-	 * @param acceptData
-	 * @param uid
-	 * @param id
-	 * @param out
-	 */
-	@RequestMapping(value = "giveCoupon", method = RequestMethod.POST)
-	public void giveCoupon(AcceptData acceptData, Long uid, Long id, PrintWriter out) {
-		if (uid == null || uid <= 0) {
-			out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛鏈櫥褰�"));
-			return;
-		}
-		if (id == null || id <= 0) {
-			out.print(JsonUtil.loadFalseResult(1, "浼犻�掑弬鏁颁笉姝g‘"));
-			return;
-		}
-		try {
-			UserSystemCouponVO vo = UserSystemCouponService.giveCoupon(uid, id);
-			JSONObject data = new JSONObject();
-			data.put("result", JsonUtil.getApiCommonGson().toJson(vo));
-			out.print(JsonUtil.loadTrueResult(data));
-		} catch (UserSystemCouponException e) {
-			out.print(JsonUtil.loadFalseResult(1, e.getMsg()));
-		}
-	}
-	
-	
-	/**
-	 * 鐢ㄦ埛濂栧姳鍒�
-	 * 
-	 * @param acceptData
-	 * @param page
-	 * @param uid
-	 * @param out
-	 */
-	@RequestMapping(value = "getOrderCouponList")
-	public void getOrderCouponList(String callback, AcceptData acceptData, Long uid, String orderNo, PrintWriter out) {
-		if (uid == null || StringUtil.isNullOrEmpty(orderNo)) {
-			JsonUtil.printMode(out, callback,JsonUtil.loadFalseResult("浼犻�掑弬鏁颁俊鎭笉瀹屾暣"));
-			return;
-		}
-		
-		if (userVIPInfoService.isVIP(uid)) {
-			JsonUtil.printMode(out, callback,JsonUtil.loadFalseResult("瓒呯骇浼氬憳涓嶅彲浣跨敤濂栧姳鍒�"));
-			return;
-		}
-		
-		List<CommonOrder> listOrder = commonOrderService.getByOrderNo(uid, orderNo);
-		if (listOrder == null || listOrder.size() == 0) {
-			JsonUtil.printMode(out, callback,JsonUtil.loadFalseResult("璁㈠崟鍙蜂笉瀛樺湪"));
-			return;
-		}
-		
-		boolean valid = false;
-		long limitDate = TimeUtil.convertDateToTemp("2019-09-10");
-		for (CommonOrder commonOrder: listOrder) {
-			Integer wholeOrder = commonOrder.getStateWholeOrder();
-			if (wholeOrder != null && CommonOrder.STATE_WHOLE_ORDER_SHIXIAO ==  wholeOrder) {
-				JsonUtil.printMode(out, callback,JsonUtil.loadFalseResult("鏁翠釜璁㈠崟宸插け鏁�"));
-				return;
-			}
-			
-			Date thirdCreateTime = commonOrder.getThirdCreateTime();
-			if (thirdCreateTime != null &&  thirdCreateTime.getTime() > limitDate) {
-				valid = true; // 1.6.5涓婄嚎涔嬪悗涓嬪崟
-			}
-		}
-		
-		try {
-			
-			List<UserSystemCouponVO> resultList = null;
-			if (valid) { 
-				 resultList = UserSystemCouponService.getOrderCouponList(uid);
-			} else {
-				 resultList = UserSystemCouponService.listIncludeNotExchange(uid);
-			}
-			
-			if (resultList == null) {
-				resultList = new ArrayList<UserSystemCouponVO>();
-			}
-
-			JSONObject data = new JSONObject();
-			data.put("helpLink", configService.getValue(ConfigKeyEnum.rewardCouponHelp.getKey(),acceptData.getSystem()));
-			data.put("count", resultList.size());
-			data.put("result_list", JsonUtil.getApiCommonGson().toJson(resultList));
-			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
-		} catch (UserSystemCouponException e) {
-			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
-		} catch (Exception e) {
-			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, "鏌ヨ澶辫触"));
-			LogHelper.errorDetailInfo(e);
-		}
-	}
-
-}
+package com.yeshi.fanli.controller.client.v2;
+
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import javax.annotation.Resource;
+
+import org.springframework.core.task.TaskExecutor;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.yeshi.utils.JsonUtil;
+
+import com.yeshi.fanli.entity.accept.AcceptData;
+import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
+import com.yeshi.fanli.entity.order.CommonOrder;
+import com.yeshi.fanli.entity.system.ConfigKeyEnum;
+import com.yeshi.fanli.exception.user.UserSystemCouponException;
+import com.yeshi.fanli.log.LogHelper;
+import com.yeshi.fanli.service.inter.config.ConfigService;
+import com.yeshi.fanli.service.inter.config.SystemCouponService;
+import com.yeshi.fanli.service.inter.homemodule.SwiperPictureService;
+import com.yeshi.fanli.service.inter.order.CommonOrderService;
+import com.yeshi.fanli.service.inter.user.DeviceLotteryRecordService;
+import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
+import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
+import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
+import com.yeshi.fanli.util.Constant;
+import com.yeshi.fanli.util.StringUtil;
+import org.yeshi.utils.TimeUtil;
+import com.yeshi.fanli.vo.homemodule.BannerVO;
+import com.yeshi.fanli.vo.user.UserSystemCouponVO;
+
+import net.sf.json.JSONObject;
+
+/**
+ * 绂忓埄涓績
+ * 
+ * @author Administrator
+ *
+ */
+@Controller
+@RequestMapping("api/v2/user/coupon")
+public class UserCouponControllerV2 {
+
+	@Resource(name = "taskExecutor")
+	private TaskExecutor executor;
+
+	@Resource
+	private ConfigService configService;
+
+	@Resource
+	private SystemCouponService systemCouponService;
+	
+	@Resource
+	private UserSystemCouponService UserSystemCouponService;
+
+	@Resource
+	private SwiperPictureService swiperPictureService;
+
+	@Resource
+	private CommonOrderService commonOrderService;
+
+	@Resource
+	private DeviceLotteryRecordService deviceLotteryRecordService;
+
+	@Resource
+	private UserSystemCouponService userSystemCouponService;
+
+	@Resource
+	private UserInfoExtraService userInfoExtraService;
+
+	@Resource
+	private UserVIPInfoService userVIPInfoService;
+
+	/**
+	 * 鐢ㄦ埛鍒稿垪琛ㄦ煡璇�
+	 * 
+	 * @param acceptData
+	 * @param page
+	 * @param uid
+	 * @param out
+	 */
+	@RequestMapping(value = "getCouponList", method = RequestMethod.POST)
+	public void getCouponList(AcceptData acceptData, Integer page, Long uid, PrintWriter out) {
+		if (uid == null || uid <= 0) {
+			out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛鏈櫥褰�"));
+			return;
+		}
+
+		if (page == null || page < 1) {
+			out.print(JsonUtil.loadFalseResult(1, "椤电爜涓嶆纭�"));
+			return;
+		}
+
+		try {
+			JSONObject data = new JSONObject();
+			if (page == 1) {
+				// 绂忓埄涓績鍥剧墖
+				List<BannerVO> listswiper = swiperPictureService.getByBannerCardAndVersion("welfare_top_1.6.5",acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()),acceptData.getSystem());
+				if (listswiper != null && listswiper.size() > 0) {
+					String topPicture = listswiper.get(0).getSrc();
+					data.put("topPicture", topPicture);
+				}
+			}
+	
+			long count = UserSystemCouponService.countUserCouponList(uid);
+			
+			List<UserSystemCouponVO> resultList = UserSystemCouponService.getCouponList(acceptData,(page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid);
+			if (resultList == null) {
+				resultList = new ArrayList<UserSystemCouponVO>();
+			}
+			
+			data.put("count", count);
+			data.put("list", JsonUtil.getApiCommonGson().toJson(resultList));
+			out.print(JsonUtil.loadTrueResult(data));
+		} catch (UserSystemCouponException e) {
+			out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
+		} catch (Exception e) {
+			out.print(JsonUtil.loadFalseResult(1, "鏌ヨ澶辫触"));
+			LogHelper.errorDetailInfo(e);
+		}
+		
+		// 鏇存柊绂忓埄涓績鏈鏁伴噺
+		if (page == 1) {
+			try {
+				executor.execute(new Runnable() {
+					@Override
+					public void run() {
+						UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
+						// 鏈鍒告槸鍚﹀ぇ浜�0
+						if (userInfoExtra != null && userInfoExtra.getCouponNews() > 0) {
+							UserInfoExtra extra = new UserInfoExtra();
+							extra.setId(userInfoExtra.getId());
+							extra.setCouponNews(0);
+							userInfoExtraService.updateByPrimaryKeySelective(extra);
+						}
+					}
+				});
+			} catch (Exception e) {
+			}
+		}
+	}
+
+	
+	/**
+	 * 璧犻�佸埜鍙d护鐢熸垚
+	 * @param acceptData
+	 * @param uid
+	 * @param id
+	 * @param out
+	 */
+	@RequestMapping(value = "giveCoupon", method = RequestMethod.POST)
+	public void giveCoupon(AcceptData acceptData, Long uid, Long id, PrintWriter out) {
+		if (uid == null || uid <= 0) {
+			out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛鏈櫥褰�"));
+			return;
+		}
+		if (id == null || id <= 0) {
+			out.print(JsonUtil.loadFalseResult(1, "浼犻�掑弬鏁颁笉姝g‘"));
+			return;
+		}
+		try {
+			UserSystemCouponVO vo = UserSystemCouponService.giveCoupon(uid, id);
+			JSONObject data = new JSONObject();
+			data.put("result", JsonUtil.getApiCommonGson().toJson(vo));
+			out.print(JsonUtil.loadTrueResult(data));
+		} catch (UserSystemCouponException e) {
+			out.print(JsonUtil.loadFalseResult(1, e.getMsg()));
+		}
+	}
+	
+	
+	/**
+	 * 鐢ㄦ埛濂栧姳鍒�
+	 * 
+	 * @param acceptData
+	 * @param page
+	 * @param uid
+	 * @param out
+	 */
+	@RequestMapping(value = "getOrderCouponList")
+	public void getOrderCouponList(String callback, AcceptData acceptData, Long uid, String orderNo, PrintWriter out) {
+		if (uid == null || StringUtil.isNullOrEmpty(orderNo)) {
+			JsonUtil.printMode(out, callback,JsonUtil.loadFalseResult("浼犻�掑弬鏁颁俊鎭笉瀹屾暣"));
+			return;
+		}
+		
+		if (userVIPInfoService.isVIP(uid)) {
+			JsonUtil.printMode(out, callback,JsonUtil.loadFalseResult("瓒呯骇浼氬憳涓嶅彲浣跨敤濂栧姳鍒�"));
+			return;
+		}
+		
+		List<CommonOrder> listOrder = commonOrderService.getByOrderNo(uid, orderNo);
+		if (listOrder == null || listOrder.size() == 0) {
+			JsonUtil.printMode(out, callback,JsonUtil.loadFalseResult("璁㈠崟鍙蜂笉瀛樺湪"));
+			return;
+		}
+		
+		boolean valid = false;
+		long limitDate = TimeUtil.convertDateToTemp("2019-09-10");
+		for (CommonOrder commonOrder: listOrder) {
+			Integer wholeOrder = commonOrder.getStateWholeOrder();
+			if (wholeOrder != null && CommonOrder.STATE_WHOLE_ORDER_SHIXIAO ==  wholeOrder) {
+				JsonUtil.printMode(out, callback,JsonUtil.loadFalseResult("鏁翠釜璁㈠崟宸插け鏁�"));
+				return;
+			}
+			
+			Date thirdCreateTime = commonOrder.getThirdCreateTime();
+			if (thirdCreateTime != null &&  thirdCreateTime.getTime() > limitDate) {
+				valid = true; // 1.6.5涓婄嚎涔嬪悗涓嬪崟
+			}
+		}
+		
+		try {
+			
+			List<UserSystemCouponVO> resultList = null;
+			if (valid) { 
+				 resultList = UserSystemCouponService.getOrderCouponList(uid);
+			} else {
+				 resultList = UserSystemCouponService.listIncludeNotExchange(uid);
+			}
+			
+			if (resultList == null) {
+				resultList = new ArrayList<UserSystemCouponVO>();
+			}
+
+			JSONObject data = new JSONObject();
+			data.put("helpLink", configService.getValue(ConfigKeyEnum.rewardCouponHelp.getKey(),acceptData.getSystem()));
+			data.put("count", resultList.size());
+			data.put("result_list", JsonUtil.getApiCommonGson().toJson(resultList));
+			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
+		} catch (UserSystemCouponException e) {
+			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
+		} catch (Exception e) {
+			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, "鏌ヨ澶辫触"));
+			LogHelper.errorDetailInfo(e);
+		}
+	}
+
+}

--
Gitblit v1.8.0