From f7fc64d5ed3d19e131bc84398ae7e801ff30341e Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 10 九月 2019 15:28:19 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/div' into div

---
 fanli/src/main/java/com/yeshi/fanli/controller/admin/UserSystemCouponAdminController.java |   71 +++++++++++++++++++++++++++++++++++
 1 files changed, 70 insertions(+), 1 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/admin/UserSystemCouponAdminController.java b/fanli/src/main/java/com/yeshi/fanli/controller/admin/UserSystemCouponAdminController.java
index a2f6c35..a5fb7dc 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/admin/UserSystemCouponAdminController.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/admin/UserSystemCouponAdminController.java
@@ -13,7 +13,9 @@
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 import com.yeshi.fanli.controller.admin.utils.AdminUtils;
+import com.yeshi.fanli.entity.bus.user.UserSystemCouponGiveRecord;
 import com.yeshi.fanli.service.inter.count.UserSystemCouponCountService;
+import com.yeshi.fanli.service.inter.user.UserSystemCouponGiveRecordService;
 import com.yeshi.fanli.tag.PageEntity;
 import com.yeshi.fanli.util.Constant;
 import com.yeshi.fanli.util.StringUtil;
@@ -29,6 +31,9 @@
 
 	@Resource
 	private UserSystemCouponCountService userSystemCouponCountService;
+	
+	@Resource
+	private UserSystemCouponGiveRecordService userSystemCouponGiveRecordService;
 
 	/**
 	 * 鐢ㄦ埛濂栧姳鍒稿垪琛�
@@ -147,7 +152,7 @@
 				return;
 			}
 
-			long count = userSystemCouponCountService.countSystemCouponFree(key);
+			long count = list.size();
 
 			int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
 			PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
@@ -275,6 +280,68 @@
 			e.printStackTrace();
 		}
 	}
+	
+	
+	
+	/**
+	 * 鏌ヨ璧犻�佸厤鍒�
+	 * @param callback
+	 * @param pageIndex
+	 * @param pageSize
+	 * @param key
+	 * @param type 1璧犻�佸厤鍗曞埜 銆�2-濂栧姳鍒�
+	 * @param state
+	 * @param out
+	 */
+	@RequestMapping(value = "listGiveCoupon")
+	public void listGiveCoupon(String callback, Integer pageIndex, Integer pageSize, String key, Integer type,
+			Integer state, PrintWriter out) {
+
+		if (pageIndex == null || pageIndex < 1) {
+			pageIndex = 1;
+		}
+
+		if (pageSize == null || pageSize < 1) {
+			pageSize = Constant.PAGE_SIZE;
+		}
+		
+		String couponType = null;
+		if (type != null) {
+			if (type == 1) {
+				couponType = "freeCouponGive";
+			} else if  (type == 2){
+				couponType = "rebatePercentCoupon";
+			} 
+		}
+
+		try {
+			List<UserSystemCouponGiveRecord> list = userSystemCouponGiveRecordService.listGiveRecord((pageIndex - 1) * pageSize,
+					pageSize, couponType, state);
+
+			if (list == null || list.size() == 0) {
+				JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏆傛棤鏁版嵁"));
+				return;
+			}
+
+			long count = userSystemCouponGiveRecordService.countGiveRecord(couponType, state);
+
+			int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
+			PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
+
+			GsonBuilder gsonBuilder = new GsonBuilder();
+			gsonBuilder.serializeNulls();
+			Gson gson = gsonBuilder.setDateFormat("yyyy/MM/dd HH:mm:ss").create();
+
+			JSONObject data = new JSONObject();
+			data.put("pe", pe);
+			data.put("result_list", gson.toJson(list));
+			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
+		} catch (Exception e) {
+			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父"));
+			e.printStackTrace();
+		}
+	}
+	
 
 	/**
 	 * 濂栧姳鍒告暟閲忔洸绾垮浘
@@ -359,6 +426,8 @@
 				couponType = "freeCoupon";
 			} else if  (coupon == 2){
 				couponType = "welfareFreeCoupon";
+			} else if  (coupon == 3){
+				couponType = "freeCouponBuy";
 			}
 			
 			

--
Gitblit v1.8.0