From 4cb15e222cd7d099d533ccbeb7f9a8cd99bf180c Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 25 十二月 2018 16:35:18 +0800
Subject: [PATCH] 替换原来老的资金详情

---
 fanli/src/main/java/com/yeshi/fanli/controller/admin/ExtractAdminController.java |   84 +++++++++++++++++++-----------------------
 1 files changed, 38 insertions(+), 46 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/admin/ExtractAdminController.java b/fanli/src/main/java/com/yeshi/fanli/controller/admin/ExtractAdminController.java
index b1f7de7..50c0d55 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/admin/ExtractAdminController.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/admin/ExtractAdminController.java
@@ -15,11 +15,12 @@
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 
-import net.sf.json.JSONObject;
-
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
+import org.yeshi.utils.DateUtil;
+import org.yeshi.utils.IPUtil;
+import org.yeshi.utils.JsonUtil;
 
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
@@ -34,6 +35,7 @@
 import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
 import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
 import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
+import com.yeshi.fanli.exception.ExtractException;
 import com.yeshi.fanli.exception.NotExistObjectException;
 import com.yeshi.fanli.exception.ObjectStateException;
 import com.yeshi.fanli.log.LogHelper;
@@ -55,9 +57,7 @@
 import com.yeshi.fanli.util.TimeUtil;
 import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
 
-import org.yeshi.utils.DateUtil;
-import org.yeshi.utils.IPUtil;
-import org.yeshi.utils.JsonUtil;
+import net.sf.json.JSONObject;
 
 @Controller
 @RequestMapping("admin/new/api/v1/extract")
@@ -328,27 +328,12 @@
 	 */
 	@RequestMapping(value = "checkExtract", method = RequestMethod.POST)
 	public void checkExtract(String uid, PrintWriter out) {
-
 		JSONObject data = new JSONObject();
-
-		// 宸插埌璐︾殑绾㈠寘
-		int count = hongBaoService.getCount(HongBao.STATE_YILINGQU);
-		if (count == 0) {
-			data.put("code", "0");
-			out.print(data);
-			return;
-		}
-
-		List<Integer> checked = extractService.checkExtract(uid);
-		if (checked != null && checked.size() > 0) {
-			Integer diversity = checked.get(0);
-			if (diversity == 0) {
-				data.put("code", "0");
-			} else {
-				data.put("code", "1");
-			}
-		} else {
-			data.put("code", "1");
+		try {
+			extractService.checkExtract(uid);
+			data.put("code", "1"); // 姝e父
+		} catch (ExtractException e) {
+			data.put("code", "0");// 寮傚父
 		}
 		out.print(data);
 	}
@@ -523,6 +508,23 @@
 				if (adminUser == null) {
 					record.setAdminUser(new AdminUser());
 				}
+				
+				int warnLevel = 0;
+				Extract extract = record.getExtract();
+				if (extract != null) {
+					Integer extractState = extract.getState();
+					if (extractState != null && extractState == 0) {
+						UserInfo userInfo = extract.getUserInfo();
+						if (userInfo != null) {
+							double countTodayMoney = extractService.countTodayMoney(userInfo.getId());
+							if (countTodayMoney >= 100) {
+								warnLevel = 1;
+							}
+						}
+					}
+					
+				}
+				record.setWarnLevel(warnLevel);
 			}
 
 			int count = extractAuditRecordService.getMyAuditedTimeSlotCount(key, state, null, days);
@@ -1024,7 +1026,11 @@
 				String auctionIds = auctionIdBuf.toString();
 
 				String ids = auctionIds.substring(0, auctionIds.length() - 1);
-				goodsBriefList = TaoKeApiUtil.getBatchGoodsInfos(ids);
+				try {
+					goodsBriefList = TaoKeApiUtil.getBatchGoodsInfos(ids);
+				} catch (Exception e) {
+					e.printStackTrace();
+				}			
 			}
 
 			List<Map<String, Object>> listResult = new ArrayList<Map<String, Object>>();
@@ -1075,7 +1081,7 @@
 
 		} catch (Exception e) {
 			e.printStackTrace();
-			out.print(JsonUtil.loadFalseResult(e.getMessage()));
+			out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(e.getMessage())));
 		}
 	}
 
@@ -1278,7 +1284,7 @@
 
 		} catch (Exception e) {
 			e.printStackTrace();
-			out.print(JsonUtil.loadFalseResult(e.getMessage()));
+			out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(e.getMessage())));
 		}
 	}
 
@@ -1401,26 +1407,12 @@
 			return;
 		}
 
-		// 宸插埌璐︾殑绾㈠寘
-		int count = hongBaoService.getCount(HongBao.STATE_YILINGQU);
-		if (count == 0) {
-			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("璧勯噾寮傚父"));
-			return;
-		}
-		
-		List<Integer> listChecked = extractService.checkExtract(uid);
-		if (listChecked == null || listChecked.size() == 0) {
+		try {
+			extractService.checkExtract(uid);
 			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("璧勯噾姝e父"));
-			return;
+		} catch (ExtractException e) {
+			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
 		}
-
-		Integer diversity = listChecked.get(0);
-		if (diversity == 0) {
-			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("璧勯噾寮傚父"));
-		} else {
-			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("璧勯噾姝e父"));
-		}
-		
 	}
 
 }

--
Gitblit v1.8.0