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/job/RedPackJob.java |  185 ++++++++++++++++++++++++----------------------
 1 files changed, 96 insertions(+), 89 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/job/RedPackJob.java b/fanli/src/main/java/com/yeshi/fanli/job/RedPackJob.java
index 96495a4..bfbde45 100644
--- a/fanli/src/main/java/com/yeshi/fanli/job/RedPackJob.java
+++ b/fanli/src/main/java/com/yeshi/fanli/job/RedPackJob.java
@@ -1,89 +1,96 @@
-package com.yeshi.fanli.job;
-
-import java.lang.reflect.Type;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-import javax.annotation.Resource;
-
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
-
-import com.google.gson.Gson;
-import com.google.gson.reflect.TypeToken;
-import com.yeshi.fanli.dto.user.PullNewRuleTerm;
-import com.yeshi.fanli.log.LogHelper;
-import com.yeshi.fanli.service.inter.redpack.RedPackConfigService;
-import com.yeshi.fanli.service.inter.redpack.RedPackWinInviteService;
-import com.yeshi.fanli.util.StringUtil;
-
-@Component
-public class RedPackJob {
-
-	@Resource
-	private RedPackWinInviteService redPackWinInviteService;
-	
-	@Resource
-	private RedPackConfigService redPackConfigService;
-	
-	
-	/**
-	 * 绾㈠寘姣忔湀26鍒拌处
-	 */
-	@Scheduled(cron = "0 20 0 26 * ? ")
-	public void arriveMoney() {
-		try {
-			String value = redPackConfigService.getValueByKey("win_redpack_term");
-			if (StringUtil.isNullOrEmpty(value)) {
-				return;
-			}
-			
-			Type type = new TypeToken<ArrayList<PullNewRuleTerm>>() {
-			}.getType();
-			List<PullNewRuleTerm> listRule = new Gson().fromJson(value, type);
-			if (listRule == null || listRule.size() == 0) {
-				return;
-			}
-			
-			int start = 0;
-			Date date = new Date();
-			while(true) {
-				// 涓婃湀瀛樺湪閭�璇风殑鐢ㄧ敤鎴穒d
-				List<Long> list = redPackWinInviteService.listWinUid(start, 1000);
-				if (list == null || list.size() == 0) {
-					break;
-				}
-				
-				for (Long uid: list) {
-					// 缁熻涓婃湀閭�璇锋垚鍔熸暟閲�
-					long count = redPackWinInviteService.countLastMonthByUid(uid);
-					if (count == 0)
-						continue;
-					
-					BigDecimal money = null;
-					for (PullNewRuleTerm term: listRule) {
-						if (count >= term.getMin() && (term.getMax() != null && count <= term.getMax())) {
-							money = term.getMoney();
-						}
-					}
-					
-					if (money == null) {
-						LogHelper.test("绾㈠寘濂栧姳鏈尮閰嶅埌瑙勫垯count =" + count + " uid =" + uid);
-						continue;
-					}
-					
-					try {
-						redPackWinInviteService.arriveMoney(uid, money, date);
-					} catch (Exception e) {
-						LogHelper.errorDetailInfo(e);
-					}
-				}
-			}
-		} catch (Exception e) {
-			LogHelper.errorDetailInfo(e);
-		}
-	}
-	 
-}
+package com.yeshi.fanli.job;
+
+import java.lang.reflect.Type;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import javax.annotation.Resource;
+
+import org.springframework.stereotype.Component;
+
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import com.yeshi.fanli.dto.user.PullNewRuleTerm;
+import com.yeshi.fanli.log.LogHelper;
+import com.yeshi.fanli.service.inter.redpack.RedPackConfigService;
+import com.yeshi.fanli.service.inter.redpack.RedPackWinInviteService;
+import com.yeshi.fanli.util.StringUtil;
+
+@Component
+public class RedPackJob {
+
+	@Resource
+	private RedPackWinInviteService redPackWinInviteService;
+	
+	@Resource
+	private RedPackConfigService redPackConfigService;
+	
+	
+	
+	@XxlJob("RedPackJob-arriveMoney")
+	public ReturnT<String> arriveMoney(String param) throws Exception {
+		arriveMoney();
+		return ReturnT.SUCCESS;
+	}
+	
+	/**
+	 * 绾㈠寘姣忔湀26鍒拌处
+	 */
+	public void arriveMoney() {
+		try {
+			String value = redPackConfigService.getValueByKey("win_redpack_term");
+			if (StringUtil.isNullOrEmpty(value)) {
+				return;
+			}
+			
+			Type type = new TypeToken<ArrayList<PullNewRuleTerm>>() {
+			}.getType();
+			List<PullNewRuleTerm> listRule = new Gson().fromJson(value, type);
+			if (listRule == null || listRule.size() == 0) {
+				return;
+			}
+			
+			int start = 0;
+			Date date = new Date();
+			while(true) {
+				// 涓婃湀瀛樺湪閭�璇风殑鐢ㄧ敤鎴穒d
+				List<Long> list = redPackWinInviteService.listWinUid(start, 1000);
+				if (list == null || list.size() == 0) {
+					break;
+				}
+				
+				for (Long uid: list) {
+					// 缁熻涓婃湀閭�璇锋垚鍔熸暟閲�
+					long count = redPackWinInviteService.countLastMonthByUid(uid);
+					if (count == 0)
+						continue;
+					
+					BigDecimal money = null;
+					for (PullNewRuleTerm term: listRule) {
+						if (count >= term.getMin() && (term.getMax() != null && count <= term.getMax())) {
+							money = term.getMoney();
+						}
+					}
+					
+					if (money == null) {
+						LogHelper.test("绾㈠寘濂栧姳鏈尮閰嶅埌瑙勫垯count =" + count + " uid =" + uid);
+						continue;
+					}
+					
+					try {
+						redPackWinInviteService.arriveMoney(uid, money, date);
+					} catch (Exception e) {
+						LogHelper.errorDetailInfo(e);
+					}
+				}
+			}
+		} catch (Exception e) {
+			LogHelper.errorDetailInfo(e);
+		}
+	}
+	 
+}

--
Gitblit v1.8.0