Browse Source

feat(lottery):增加中奖记录页面

wangyc 7 years ago
parent
commit
2baf1dbcc3

+ 14 - 0
src/main/java/com/uas/platform/b2c/common/lottery/controller/LotteryController.java

@@ -84,6 +84,20 @@ public class LotteryController {
         return winningHistoryService.getWinningHistoriesByUser(activityCode, pageParams);
     }
 
+    /**
+     * 分页获取全部中奖记录
+     * @param activityCode 活动编码
+     * @param pageParams 分页参数
+     * @param itemCode 等级编码
+     * @param keyword 关键词
+     * @param prizeCode 奖品编码
+     * @return
+     */
+    @RequestMapping(value = "/user/winninghistories", method = RequestMethod.GET, produces = "application/json")
+    public JSONObject getWinningHistories(String activityCode, com.uas.platform.core.model.PageParams pageParams, String itemCode, String keyword, String prizeCode) {
+        return winningHistoryService.getWinningHistories(activityCode, pageParams, itemCode, keyword, prizeCode);
+    }
+
     /**
      * 用户抽奖
      * @param activityCode 活动编号

+ 11 - 0
src/main/java/com/uas/platform/b2c/common/lottery/service/WinningHistoryService.java

@@ -26,4 +26,15 @@ public interface WinningHistoryService {
      * @return
      */
     JSONObject getWinningHistoriesByUser(String activityCode, PageParams pageParams);
+
+    /**
+     * 分页获取全部中奖记录
+     * @param activityCode 活动编码
+     * @param pageParams 分页参数
+     * @param itemCode 等级编码
+     * @param keyword 关键词
+     * @param prizeCode 奖品编码
+     * @return
+     */
+    JSONObject getWinningHistories(String activityCode, com.uas.platform.core.model.PageParams pageParams, String itemCode, String keyword, String prizeCode);
 }

+ 25 - 0
src/main/java/com/uas/platform/b2c/common/lottery/service/impl/WinningHistoryServiceImpl.java

@@ -34,6 +34,9 @@ public class WinningHistoryServiceImpl implements WinningHistoryService {
     // 获取个人中奖记录路径
     private static final String GET_WINNING_HOSTORIES_PERSONAL_URL = "/winninghistorys/user";
 
+    // 获取全部中奖记录路径
+    private static final String GET_WINNING_HOSTORIES_URL = "/winninghistorys";
+
     @Autowired
     public WinningHistoryServiceImpl(SysConf sysConf) {
         this.sysConf = sysConf;
@@ -77,4 +80,26 @@ public class WinningHistoryServiceImpl implements WinningHistoryService {
             throw new IllegalOperatorException("获取中奖信息错误,请重试");
         }
     }
+
+    @Override
+    public JSONObject getWinningHistories(String activityCode, com.uas.platform.core.model.PageParams pageParams, String itemCode, String keyword, String prizeCode) {
+        if (StringUtils.isEmpty(activityCode)) {
+            throw new IllegalOperatorException("活动信息不完全,请确认活动信息");
+        }
+
+        Map<String, Object> params = new HashMap<>();
+        params.put("activityCode", activityCode);
+        params.put("page", pageParams.getPage());
+        params.put("count", pageParams.getCount());
+        params.put("itemCode", itemCode);
+        params.put("keyword", keyword);
+        params.put("prizeCode", prizeCode);
+
+        try {
+            Response response = HttpUtil.sendGetRequest(sysConf.getLottery() + GET_WINNING_HOSTORIES_URL, params);
+            return JSON.parseObject(response.getResponseText(), JSONObject.class);
+        } catch (Exception e) {
+            throw new IllegalOperatorException("获取中奖信息错误,请重试");
+        }
+    }
 }

+ 1 - 1
src/main/resources/dev/sys.properties

@@ -57,4 +57,4 @@ b2b=http://218.17.158.219:9000/b2b-test
 b2bDomain=218.17.158.219:9000/b2b-test
 
 #lottery
-lottery=http://192.168.253.3:26789/
+lottery=http://127.0.0.1:20000

+ 5 - 0
src/main/webapp/WEB-INF/views/normal/adminWithNav.html

@@ -239,10 +239,15 @@
 					class="fa fa-upload"></i><span> 品牌推广</span></a></li>
 			<li class="nav-node"><a href="#ads/component" ><i
 					class="fa fa-upload"></i><span> 器件推广</span></a></li>
+			<li class="nav-node"><a href="#ads/brand" ><i
+					class="fa fa-upload"></i><span> 活动信息</span></a></li>
+			<li class="nav-node"><a href="#ads/winningHistories" ><i
+					class="fa fa-upload"></i><span> 中奖记录</span></a></li>
 
 			<li class="nav-header">搜索预览</li>
 			<li class="nav-node"><a href="#search/see" ><i
 					class="fa fa-upload"></i><span> 搜索预览</span></a></li>
+
 			<!--<li class="nav-node"><a href="#help/publish" ><i
 					class="fa fa-upload"></i><span> 产品推广</span></a></li>
 			<li class="nav-node"><a href="#help/publish" ><i

+ 64 - 57
src/main/webapp/resources/js/admin/app.js

@@ -1,4 +1,4 @@
- define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ui-form', 'ngLocal', 'ngTable', 'ngSanitize', 'ngDraggable', 'common/services', 'common/directives', 'common/query/brand', 'common/query/address', 'common/query/return' , 'common/query/change' ,'common/query/component', 'common/query/order', 'common/query/purchase', 'common/query/invoice', 'common/query/property', 'common/query/kind', 'common/query/property', 'common/query/commodity', 'common/query/receipt', 'common/query/logistics' ,'angular-toaster', 'ui-jquery', 'jquery-uploadify','common/query/dateParse' , 'common/query/bankTransfer' ,'common/query/bankInfo', 'common/query/urlencryption', 'common/query/bill', 'common/query/makerDemand', 'common/query/goods', 'common/query/validtime', 'file-upload','file-upload-shim', 'common/query/slideImage', 'common/query/kindAdvice', 'common/query/responseLogistics', 'common/query/search','common/directives/dynamicInput', 'common/query/auditorMail', 'common/query/tradeBasicProperties', 'common/query/exchangeRate', 'common/query/tradeDeliveryDelayTime', 'common/query/payment', 'common/query/kindContrast', 'common/query/crawlTask', 'common/query/afterSale', 'common/query/refund', 'common/query/messageBoard', 'common/query/logisticsPort', 'common/query/storeInfo', 'common/query/cms', 'common/query/help', 'common/query/commonCount', 'common/module/store_admin_violations_module', 'common/query/internalMessage','common/query/user','common/query/secQuestion','common/query/keyWord','common/query/logUsage','common/query/seekQualityBuyer','common/query/loanApply', 'common/query/supplier', 'common/query/seekSalesman', 'common/query/b2bManage', 'common/query/adminNews', 'common/query/seekPurchase'], function(angularAMD) {
+ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ui-form', 'ngLocal', 'ngTable', 'ngSanitize', 'ngDraggable', 'common/services', 'common/directives', 'common/query/brand', 'common/query/address', 'common/query/return' , 'common/query/change' ,'common/query/component', 'common/query/order', 'common/query/purchase', 'common/query/invoice', 'common/query/property', 'common/query/kind', 'common/query/property', 'common/query/commodity', 'common/query/receipt', 'common/query/logistics' ,'angular-toaster', 'ui-jquery', 'jquery-uploadify','common/query/dateParse' , 'common/query/bankTransfer' ,'common/query/bankInfo', 'common/query/urlencryption', 'common/query/bill', 'common/query/makerDemand', 'common/query/goods', 'common/query/validtime', 'file-upload','file-upload-shim', 'common/query/slideImage', 'common/query/kindAdvice', 'common/query/responseLogistics', 'common/query/search','common/directives/dynamicInput', 'common/query/auditorMail', 'common/query/tradeBasicProperties', 'common/query/exchangeRate', 'common/query/tradeDeliveryDelayTime', 'common/query/payment', 'common/query/kindContrast', 'common/query/crawlTask', 'common/query/afterSale', 'common/query/refund', 'common/query/messageBoard', 'common/query/logisticsPort', 'common/query/storeInfo', 'common/query/cms', 'common/query/help', 'common/query/commonCount', 'common/module/store_admin_violations_module', 'common/query/internalMessage','common/query/user','common/query/secQuestion','common/query/keyWord','common/query/logUsage','common/query/seekQualityBuyer','common/query/loanApply', 'common/query/supplier', 'common/query/seekSalesman', 'common/query/b2bManage', 'common/query/adminNews', 'common/query/seekPurchase', 'common/query/lottery'], function(angularAMD) {
 	'use strict';
 
 	 /**
@@ -8,7 +8,7 @@
 		 return this.length > 0 ? this[this.length - 1] : null;
 	 };
 
-	var app = angular.module('myApp', [ 'ui.router', 'ui.bootstrap', 'ui.form', 'ng.local', 'ngTable', 'ngSanitize', 'ngDraggable', 'common.services', 'common.directives', 'brandServices', 'addressServices', 'returnServices', 'changeServices', 'componentServices', 'orderServices', 'purchaseServices', 'invoiceServices', 'propertyServices', 'receiptServices', 'logisticsServices', 'common.query.kind', 'toaster','ui.jquery', 'commodityServices', 'dateparseServices', 'bankInfo' , 'bankTransfer', 'urlencryptionServices', 'billServices', 'makerDemand', 'goodsServices', 'validtimeServices', 'angularFileUpload', 'slideImageService', 'common.query.kindAdvice', 'responseLogisticsService', 'searchService', 'ngDynamicInput', 'ReviewerEmailInfoService', 'tradeBasicPropertiesServices', 'exchangeRateModule', 'tradeDeliveryDelayTimeModule', 'PaymentService', 'kindContrastServices', 'crawlTaskServices', 'afterSaleService', 'refundModule', 'messageBoardServices', 'logisticsPortService', 'storeInfoServices', 'cmsService', 'helpServices', 'commonCountServices', 'tool.directives', 'StoreAdminViolationsModule', 'internalMessageServices','common.query.user','secQuestionServices','keyWordServices','logUsageServices','seekQualityBuyerServices', 'loanApplyService', 'supplierServices', 'seekSalesmanServices', 'b2bManageService','adminNewsService', 'seekPurchaseServices']);
+	var app = angular.module('myApp', [ 'ui.router', 'ui.bootstrap', 'ui.form', 'ng.local', 'ngTable', 'ngSanitize', 'ngDraggable', 'common.services', 'common.directives', 'brandServices', 'addressServices', 'returnServices', 'changeServices', 'componentServices', 'orderServices', 'purchaseServices', 'invoiceServices', 'propertyServices', 'receiptServices', 'logisticsServices', 'common.query.kind', 'toaster','ui.jquery', 'commodityServices', 'dateparseServices', 'bankInfo' , 'bankTransfer', 'urlencryptionServices', 'billServices', 'makerDemand', 'goodsServices', 'validtimeServices', 'angularFileUpload', 'slideImageService', 'common.query.kindAdvice', 'responseLogisticsService', 'searchService', 'ngDynamicInput', 'ReviewerEmailInfoService', 'tradeBasicPropertiesServices', 'exchangeRateModule', 'tradeDeliveryDelayTimeModule', 'PaymentService', 'kindContrastServices', 'crawlTaskServices', 'afterSaleService', 'refundModule', 'messageBoardServices', 'logisticsPortService', 'storeInfoServices', 'cmsService', 'helpServices', 'commonCountServices', 'tool.directives', 'StoreAdminViolationsModule', 'internalMessageServices','common.query.user','secQuestionServices','keyWordServices','logUsageServices','seekQualityBuyerServices', 'loanApplyService', 'supplierServices', 'seekSalesmanServices', 'b2bManageService','adminNewsService', 'seekPurchaseServices', 'lotteryServices']);
 	app.init = function() {
 		angularAMD.bootstrap(app);
 	};
@@ -778,41 +778,48 @@
 			controllerUrl: 'app/controllers/HotifyShipTime',
 			title: '买家提醒发货时间条件'
 		})).state('automaticReceiving', angularAMD.route({
-            // 买家提醒发货时间条件
-            url : '/buyer/automaticReceiving',
-            templateUrl: 'static/view/admin/automaticReceiving.html',
-            controller: 'AutomaticReceivingCtrl',
-            controllerUrl: 'app/controllers/AutomaticReceiving',
-            title: '买家提醒发货时间条件'
-        })).state('downAllGoodsByEnterprise', angularAMD.route({
-            //下架该公司所有的商品
-            url : '/product/downAllGoodsByEnterprise',
-            templateUrl: 'static/view/admin/product/downGoodsByEnterprise.html',
-            controller: 'downGoodsByEnterpriseCtrl',
-            controllerUrl: 'app/controllers/product/downGoodsByEnterprise',
-            title: '下架公司产品'
-        })).state('adsBrand', angularAMD.route({
-            //品牌推广
-            url : '/ads/brand',
-            templateUrl: 'static/view/admin/ads/ads_brand.html',
-            controller: 'adsBrandCtrl',
-            controllerUrl: 'app/controllers/ads/ads_brand',
-            title: '品牌推广'
-        })).state('adsComponent', angularAMD.route({
-            //品牌推广
-            url : '/ads/component',
-            templateUrl: 'static/view/admin/ads/ads_component.html',
-            controller: 'adsComponentCtrl',
-            controllerUrl: 'app/controllers/ads/ads_component',
-            title: '器件推广'
-        })).state('searchSee', angularAMD.route({
-            //搜索预览
-            url : '/search/see',
-            templateUrl: 'static/view/admin/search/search_See.html',
-            controller: 'SearchSeeBrandCtrl',
-            controllerUrl: 'app/controllers/search/search_See',
-            title: '搜索预览'
-        })).state('internalMessage', angularAMD.route({
+				// 买家提醒发货时间条件
+				url : '/buyer/automaticReceiving',
+				templateUrl: 'static/view/admin/automaticReceiving.html',
+				controller: 'AutomaticReceivingCtrl',
+				controllerUrl: 'app/controllers/AutomaticReceiving',
+				title: '买家提醒发货时间条件'
+		})).state('downAllGoodsByEnterprise', angularAMD.route({
+				//下架该公司所有的商品
+				url : '/product/downAllGoodsByEnterprise',
+				templateUrl: 'static/view/admin/product/downGoodsByEnterprise.html',
+				controller: 'downGoodsByEnterpriseCtrl',
+				controllerUrl: 'app/controllers/product/downGoodsByEnterprise',
+				title: '下架公司产品'
+		})).state('adsBrand', angularAMD.route({
+				//品牌推广
+				url : '/ads/brand',
+				templateUrl: 'static/view/admin/ads/ads_brand.html',
+				controller: 'adsBrandCtrl',
+				controllerUrl: 'app/controllers/ads/ads_brand',
+				title: '品牌推广'
+		})).state('adsWinningHistories', angularAMD.route({
+      // 中奖记录
+      url: '/ads/winningHistories',
+      templateUrl: 'static/view/admin/ads/ads_winninghistories.html',
+      controller: 'WinningHistoriesCtrl',
+      controllerUrl: 'app/controllers/ads/winningHistoriesCtrl',
+      title: '中奖纪录'
+    })).state('adsComponent', angularAMD.route({
+				//品牌推广
+				url : '/ads/component',
+				templateUrl: 'static/view/admin/ads/ads_component.html',
+				controller: 'adsComponentCtrl',
+				controllerUrl: 'app/controllers/ads/ads_component',
+				title: '器件推广'
+		})).state('searchSee', angularAMD.route({
+				//搜索预览
+				url : '/search/see',
+				templateUrl: 'static/view/admin/search/search_See.html',
+				controller: 'SearchSeeBrandCtrl',
+				controllerUrl: 'app/controllers/search/search_See',
+				title: '搜索预览'
+		})).state('internalMessage', angularAMD.route({
 			// 消息列表
 			url: '/internalMessages',
 			templateUrl: 'static/view/admin/common/message/internalMessageList.html',
@@ -820,26 +827,26 @@
 			controllerUrl: 'app/controllers/common/message/internalMessageListCtrl',
 			title: '消息列表'
 		})).state('loanApplyList', angularAMD.route({
-            // 消息列表
-            url: '/fa/loanApply',
-            templateUrl: 'static/view/admin/fa/loanApplyList.html',
-            controller: 'LoanApplyListCtrl',
-            controllerUrl: 'app/controllers/fa/LoanApplyListCtrl',
-            title: '消息列表'
-        })).state('b2bManage', angularAMD.route({
-			// b2b后台管理贷款申请列表
-			url: '/b2b/manage',
-            templateUrl: 'static/view/admin/b2b/manage.html',
-            controller: 'b2bManageCtrl',
-            controllerUrl: 'app/controllers/b2b/b2bManageCtrl',
-            title: '贷款申请列表'
-        })).state('statsData', angularAMD.route({
-            // 后台管理数据统计数据
-            url: '/statsData',
-            templateUrl: 'static/view/admin/stats_data.html',
-            controller: 'statsDataCtrl',
-            controllerUrl: 'app/controllers/statsDataCtrl',
-            title: '数据统计数据'
+				// 消息列表
+				url: '/fa/loanApply',
+				templateUrl: 'static/view/admin/fa/loanApplyList.html',
+				controller: 'LoanApplyListCtrl',
+				controllerUrl: 'app/controllers/fa/LoanApplyListCtrl',
+				title: '消息列表'
+		})).state('b2bManage', angularAMD.route({
+				// b2b后台管理贷款申请列表
+				url: '/b2b/manage',
+				templateUrl: 'static/view/admin/b2b/manage.html',
+				controller: 'b2bManageCtrl',
+				controllerUrl: 'app/controllers/b2b/b2bManageCtrl',
+				title: '贷款申请列表'
+		})).state('statsData', angularAMD.route({
+				// 后台管理数据统计数据
+				url: '/statsData',
+				templateUrl: 'static/view/admin/stats_data.html',
+				controller: 'statsDataCtrl',
+				controllerUrl: 'app/controllers/statsDataCtrl',
+				title: '数据统计数据'
 		}));
 		
 	}]);

+ 74 - 0
src/main/webapp/resources/js/admin/controllers/ads/winningHistoriesCtrl.js

@@ -0,0 +1,74 @@
+define([ 'app/app' ], function(app) {
+	//品牌审批
+	app.register.controller('WinningHistoriesCtrl', ['$scope', 'ngTableParams', 'Lottery', 'BaseService', function($scope, ngTableParams, Lottery, BaseService) {
+    BaseService.scrollBackToTop();
+
+		$scope.active = 'all';
+    $scope.keyword = '';
+    $scope.prizeCode = '';
+
+    $scope.setActive = function(state) {
+      if($scope.active != state) {
+        $scope.active = state;
+        if($scope.winningTableParams.page() == 1)
+          $scope.winningTableParams.reload();
+        else
+          $scope.winningTableParams.page(1);
+      }
+    };
+
+		var getState = function() {
+			var state = 'get';
+			switch($scope.active) {
+				case 'all' : //全部
+					state = ''; break;
+				case 'bronze' ://青铜
+					state = '12wwwwwwww'; break;
+				case 'gold' : //黄金
+					state = '12wwwwwwwQ'; break;
+				case 'diamond' : //钻石
+					state = '12wwwwwwwZ'; break;
+				case 'king' : //王者
+					state = '12wwwwwwwX'; break;
+			}
+			return state;
+		};
+
+		$scope.setActive = function(state) {
+			if($scope.active != state) {
+				$scope.active = state;
+				$scope.winningTableParams.page(1);
+				$scope.winningTableParams.reload();
+			}
+		};
+
+		var loadData = function() {
+      $scope.winningTableParams = new ngTableParams({
+        page : 1,
+        count : 10,
+      }, {
+        total : 0,
+        getData : function($defer, params) {
+          var param = BaseService.parseParams(params.url());
+          param.activityCode = '11wwwwwwww';
+          param.keyword = $scope.keyword;
+          param.prizeCode = $scope.prizeCode;
+          param.itemCode = getState();
+          Lottery.getWinningHistories(param, function(page) {
+            if (page) {
+              params.total(page.totalElements);
+              $defer.resolve(page.content);
+            }
+          });
+        }
+      });
+		};
+
+		loadData();
+
+		//根据订单号搜索
+		$scope.onSearch = function() {
+			$scope.winningTableParams.reload();
+		}
+	}]);
+});

+ 14 - 0
src/main/webapp/resources/js/common/query/lottery.js

@@ -0,0 +1,14 @@
+define([ 'ngResource'], function() {
+  angular.module('lotteryServices', [ 'ngResource']).factory('Lottery', ['$resource' , function($resource) {
+    return $resource('lottery', {}, {
+      getWinningHistories: {
+        url: 'lottery/user/winninghistories',
+        method : 'GET'
+      },
+      saveMakeDemandAuthentic: {
+        url: 'trade/help/makeDemand/save/entity',
+        method : 'POST'
+      }
+    });
+  }]);
+});