From c8f11c229b87d1652b6da0b15576c166cd51eb8b Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期三, 01 一月 2020 14:25:22 +0800
Subject: [PATCH] 首页悬浮图mapperbug修改,增加商品详情中的比例展示

---
 fanli/src/main/java/com/yeshi/fanli/controller/admin/ExtractAdminController.java |  160 +++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 119 insertions(+), 41 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 9439c01..bcf883a 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
@@ -22,11 +22,11 @@
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.multipart.commons.CommonsMultipartFile;
-import org.yeshi.utils.CsvUtil;
 import org.yeshi.utils.DateUtil;
 import org.yeshi.utils.IPUtil;
 import org.yeshi.utils.JsonUtil;
 import org.yeshi.utils.entity.wx.RedPackRecord;
+import org.yeshi.utils.wx.WXRedPackUtil;
 
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
@@ -50,6 +50,7 @@
 import com.yeshi.fanli.service.inter.money.extract.ExtractAuditRecordService;
 import com.yeshi.fanli.service.inter.money.extract.ExtractCountService;
 import com.yeshi.fanli.service.inter.money.extract.ExtractService;
+import com.yeshi.fanli.service.inter.order.CommonOrderCountService;
 import com.yeshi.fanli.service.inter.order.tb.TaoBaoOrderService;
 import com.yeshi.fanli.service.inter.order.tb.TaoBaoWeiQuanOrderService;
 import com.yeshi.fanli.service.inter.push.PushRecordService;
@@ -102,10 +103,12 @@
 
 	@Resource
 	private TaoBaoWeiQuanOrderService taoBaoWeiQuanOrderService;
-	
+
 	@Resource
 	private UserInfoExtraService userInfoExtraService;
-	
+
+	@Resource
+	private CommonOrderCountService commonOrderCountService;
 
 	/**
 	 * 
@@ -397,6 +400,11 @@
 				if (adminUser == null) {
 					record.setAdminUser(new AdminUser());
 				}
+				// 鏌ヨ鐢ㄦ埛澶囨敞淇℃伅
+				UserInfoExtra extra = userInfoExtraService.getUserInfoExtra(record.getExtract().getUserInfo().getId());
+				if (extra != null) {
+					record.getExtract().getUserInfo().setStateDesc(extra.getMark());
+				}
 
 				int warnLevel = 0;
 				Extract extract = record.getExtract();
@@ -436,7 +444,29 @@
 					}
 					record.setExtraInfoStr(desc.toString());
 				}
+
+				// if (warnLevel == 0) {
+				// // 鏌ヨ鍚屽簵閾哄晢鍝侊紝鍚屽晢鍝佽鍗曡秴杩囦竴瀹氭暟閲忕殑
+				// List<Integer> typeList = new ArrayList<>();
+				// typeList.add(HongBaoV2.TYPE_ZIGOU);
+				// long sameGoodsOrderCount =
+				// commonOrderCountService.countSameGoodsOrderByUidAndHongBaoType(typeList,
+				// record.getExtract().getUserInfo().getId(),
+				// Integer.parseInt(configService.get("admin_min_same_goods_order_count")));
+				// long sameShopOrderCount =
+				// commonOrderCountService.countSameShopOrderByUidAndHongBaoType(typeList,
+				// record.getExtract().getUserInfo().getId(),
+				// Integer.parseInt(configService.get("admin_min_same_shop_order_count")));
+				// if (sameGoodsOrderCount > 0 || sameShopOrderCount > 0) {
+				// warnLevel = 3;
+				// record.setExtraInfoStr(
+				// String.format("鍚屽簵閾�:%s 鍚屽晢鍝�:%s", sameShopOrderCount,
+				// sameGoodsOrderCount));
+				// }
+				// }
+
 				record.setWarnLevel(warnLevel);
+
 			}
 
 			int count = extractAuditRecordService.getMyAuditedTimeSlotCount(key, state, null, days);
@@ -446,7 +476,7 @@
 			GsonBuilder gsonBuilder = new GsonBuilder();
 			gsonBuilder.serializeNulls();
 			gsonBuilder.setDateFormat("yyyy-MM-dd HH:mm:ss");
-			
+
 			Gson gson = gsonBuilder.create();
 
 			JSONObject data = new JSONObject();
@@ -459,6 +489,27 @@
 			e.printStackTrace();
 			out.print(JsonUtil.loadFalseResult(e.getMessage()));
 		}
+	}
+
+	@RequestMapping(value = "getMyAuditedDanger")
+	public void getMyAuditedDanger(String callback, Long uid, PrintWriter out) {
+		if (uid == null) {
+			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("璇风櫥褰�"));
+			return;
+		}
+		// 鏌ヨ鍚屽簵閾哄晢鍝侊紝鍚屽晢鍝佽鍗曡秴杩囦竴瀹氭暟閲忕殑
+		List<Integer> typeList = new ArrayList<>();
+		typeList.add(HongBaoV2.TYPE_ZIGOU);
+		long sameGoodsOrderCount = commonOrderCountService.countSameGoodsOrderByUidAndHongBaoType(typeList, uid,
+				Integer.parseInt(configService.get("admin_min_same_goods_order_count")));
+		long sameShopOrderCount = commonOrderCountService.countSameShopOrderByUidAndHongBaoType(typeList, uid,
+				Integer.parseInt(configService.get("admin_min_same_shop_order_count")));
+		if (sameGoodsOrderCount > 0 || sameShopOrderCount > 0) {
+			String text = (String.format("鍚屽簵閾�:%s 鍚屽晢鍝�:%s", sameShopOrderCount, sameGoodsOrderCount));
+			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(text));
+			return;
+		}
+		JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("搴楅摵/鍟嗗搧鏃犲紓甯�"));
 	}
 
 	/**
@@ -560,14 +611,14 @@
 				} else {
 					surplusTime = DateUtil.dateDiff(formattodayTime, formatTime);
 				}
-				
+
 				String mark = "";
 				UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(extract.getUserInfo().getId());
 				if (userInfoExtra != null && !StringUtil.isNullOrEmpty(userInfoExtra.getMark())) {
 					mark = "璀︽儠锛侊紒 " + userInfoExtra.getMark();
 				}
 
-				data.put("mark",mark);
+				data.put("mark", mark);
 				data.put("extract", extract);
 				data.put("beforeMoney", beforeMoney);
 				data.put("surplusTime", surplusTime);
@@ -637,7 +688,7 @@
 						mark = "璀︽儠锛侊紒 " + userInfoExtra.getMark();
 					}
 
-					data.put("mark",mark);
+					data.put("mark", mark);
 					data.put("extract", extract);
 					data.put("beforeMoney", beforeMoney);
 					data.put("surplusTime", surplusTime);
@@ -850,8 +901,8 @@
 					innerList.put("name", "椹冲洖鏁�");
 				}
 
-				List<ChartTDO> list = extractAuditRecordService.countAuditTotal(state, dateType, year,
-						startTime, endTime);
+				List<ChartTDO> list = extractAuditRecordService.countAuditTotal(state, dateType, year, startTime,
+						endTime);
 				if (dateType != 3) {
 					innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType, dateList, list)));
 				} else {
@@ -935,8 +986,8 @@
 			JSONObject innerList = new JSONObject();
 			innerList.put("name", "鎬昏");
 
-			List<ChartTDO> list = extractAuditRecordService.countExtractApplyMoney(null, dateType, year,
-					startTime, endTime);
+			List<ChartTDO> list = extractAuditRecordService.countExtractApplyMoney(null, dateType, year, startTime,
+					endTime);
 
 			if (dateType != 3) {
 				innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType, dateList, list)));
@@ -1020,12 +1071,11 @@
 			Gson gson = new Gson();
 			List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
 
-
 			JSONObject innerList = new JSONObject();
 			innerList.put("name", "鎬昏");
 
-			List<ChartTDO> list = extractAuditRecordService.countExtractApplyNumber(null, dateType, year,
-					startTime, endTime);
+			List<ChartTDO> list = extractAuditRecordService.countExtractApplyNumber(null, dateType, year, startTime,
+					endTime);
 
 			if (dateType != 3) {
 				innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType, dateList, list)));
@@ -1056,7 +1106,14 @@
 			e.printStackTrace();
 		}
 	}
-	
+
+	/**
+	 * 涓嬭浇鎻愮幇绾㈠寘Openid
+	 * 
+	 * @param callback
+	 * @param response
+	 * @param out
+	 */
 	@RequestMapping(value = "downAutoExtractTxt")
 	public void downAutoExtractTxt(String callback, HttpServletResponse response, PrintWriter out) {
 		try {
@@ -1065,35 +1122,41 @@
 				JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏆傛棤鐢ㄦ埛婊¤冻鑷姩鎻愮幇鏉′欢"));
 				return;
 			}
-			
-			String filepath = "鑷姩鎻愮幇OpenId "+ java.lang.System.currentTimeMillis() + ".txt";
+
+			String filepath = "鑷姩鎻愮幇OpenId " + java.lang.System.currentTimeMillis() + ".txt";
 			response.reset();
-		    response.setContentType("application/octet-stream");
-		    String fileName= URLDecoder.decode(filepath,"utf-8");
-		    response.addHeader("Content-Disposition","attachment;"+ "filename=\"" +URLEncoder.encode(fileName, "utf-8") + "\"");
-			
+			response.setContentType("application/octet-stream");
+			String fileName = URLDecoder.decode(filepath, "utf-8");
+			response.addHeader("Content-Disposition",
+					"attachment;" + "filename=\"" + URLEncoder.encode(fileName, "utf-8") + "\"");
+
 			StringBuilder sb = new StringBuilder();
-			for(String t:list){
-				sb.append(t+"\r\n");
+			for (String t : list) {
+				sb.append(t + "\r\n");
 			}
-			
+
 			String opid_str = sb.toString();
 			if (!StringUtil.isNullOrEmpty(opid_str) && opid_str.endsWith("\r\n")) {
 				opid_str = opid_str.substring(0, opid_str.length() - 2);
 			}
-			
-		    OutputStream os = response.getOutputStream();
-            byte[] byt = opid_str.getBytes();
-            os.write(byt);
-            os.flush();
-	    	os.close();
+
+			OutputStream os = response.getOutputStream();
+			byte[] byt = opid_str.getBytes();
+			os.write(byt);
+			os.flush();
+			os.close();
 		} catch (Exception e) {
 			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父"));
 			e.printStackTrace();
 		}
 	}
-	
-	
+
+	/**
+	 * 涓婁紶鎻愮幇绾㈠寘Excel
+	 * 
+	 * @param file
+	 * @param out
+	 */
 	@RequestMapping(value = "uploadExcel", method = RequestMethod.POST)
 	public void uploadExcel(@RequestParam("file") CommonsMultipartFile file, PrintWriter out) {
 		if (file == null) {
@@ -1102,7 +1165,7 @@
 		}
 
 		try {
-			List<RedPackRecord> list = CsvUtil.getCsvData(file, RedPackRecord.class);
+			List<RedPackRecord> list = WXRedPackUtil.readCsv(file.getInputStream());
 			extractService.updateManualExtractRecord(list);
 			out.print(JsonUtil.loadTrueResult("涓婁紶鎴愬姛"));
 		} catch (ExtractException e) {
@@ -1112,41 +1175,56 @@
 			out.print(JsonUtil.loadFalseResult("涓婁紶澶辫触"));
 		}
 	}
+
 	
+	public static String getValue(String[] item,int index){
+        if(item.length > index){
+            String value = item[index];
+            return value;
+        }
+        return "";
+    }
 	
-	
+	/**
+	 * 棰勮绾㈠寘鍙戠敓浜�
+	 * 
+	 * @param callback
+	 * @param pageIndex
+	 * @param out
+	 */
 	@RequestMapping(value = "preAutoUser")
-	public void preAutoUser(String callback, Integer pageIndex, Integer pageSize, PrintWriter out) {
+	public void preAutoUser(String callback, Integer pageIndex, PrintWriter out) {
 		try {
 			List<UserInfo> list = extractService.preAutoUser();
 			if (list == null || list.isEmpty()) {
 				JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏆傛棤鐢ㄦ埛婊¤冻鑷姩鎻愮幇鏉′欢"));
 				return;
 			}
-			
+
 			if (pageIndex == null || pageIndex < 1) {
 				pageIndex = 1;
 			}
 
+			Integer pageSize = 100;
 			if (pageSize == null || pageSize < 1) {
 				pageSize = Constant.PAGE_SIZE;
 			}
-			
+
 			int count = list.size();
 			int totalPage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1;
 			PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
-			
+
 			List<UserInfo> listResult = null;
 			if (pageIndex < totalPage) {
 				int start = (pageIndex - 1) * pageSize;
 				listResult = list.subList(start, start + pageSize);
 			} else if (pageIndex == totalPage) {
-				 listResult = list.subList((pageIndex - 1) * pageSize, list.size());
+				listResult = list.subList((pageIndex - 1) * pageSize, list.size());
 			} else {
 				JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("娌℃湁鏇村浜�"));
 				return;
 			}
-			
+
 			JSONObject data = new JSONObject();
 			data.put("pe", pe);
 			data.put("result_list", listResult);
@@ -1156,5 +1234,5 @@
 			e.printStackTrace();
 		}
 	}
-
 }
+	

--
Gitblit v1.8.0