Browse Source

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@760 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d

administrator 11 years ago
parent
commit
22cb4f38f2

+ 43 - 1
src/main/java/com/uas/platform/b2b/controller/SaleStatController.java

@@ -36,7 +36,7 @@ public class SaleStatController {
 	private SaleStatService saleStatService;
 
 	/**
-	 * 销售额
+	 * 销售额(包括日线、月线、年线数据)
 	 * 
 	 * @param json
 	 * @return
@@ -105,6 +105,27 @@ public class SaleStatController {
 		return saleStatService.findYearByPageInfo(info).getContent();
 	}
 
+	/**
+	 * 客户采购额(包括客户采购额月线、年线数据)
+	 * 
+	 * @param json
+	 * @return
+	 */
+	@RequestMapping(value = "/cust", method = RequestMethod.GET)
+	@ResponseBody
+	public ModelMap getCustStat() {
+		ModelMap map = new ModelMap();
+		PageInfo info = new PageInfo(1, 12, 0);
+		info.filter("enUU", SystemSession.getUser().getEnterprise().getUu());
+		info.sorting(Direction.DESC, "year", "month");
+		map.put("month", ArrayUtils.reverse(saleStatService.findCustMonthByPageInfo(info).getContent()));
+		info = new PageInfo(1, 10, 0);
+		info.filter("enUU", SystemSession.getUser().getEnterprise().getUu());
+		info.sorting(Direction.DESC, "year");
+		map.put("year", ArrayUtils.reverse(saleStatService.findCustYearByPageInfo(info).getContent()));
+		return map;
+	}
+
 	/**
 	 * 客户采购额(月线)
 	 * 
@@ -135,6 +156,27 @@ public class SaleStatController {
 		return saleStatService.findCustYearByPageInfo(info).getContent();
 	}
 
+	/**
+	 * 业务员销售额(包括业务员销售额月线、年线数据)
+	 * 
+	 * @param json
+	 * @return
+	 */
+	@RequestMapping(value = "/seller", method = RequestMethod.GET)
+	@ResponseBody
+	public ModelMap getSellerStat() {
+		ModelMap map = new ModelMap();
+		PageInfo info = new PageInfo(1, 12, 0);
+		info.filter("enUU", SystemSession.getUser().getEnterprise().getUu());
+		info.sorting(Direction.DESC, "year", "month");
+		map.put("month", ArrayUtils.reverse(saleStatService.findSellerMonthByPageInfo(info).getContent()));
+		info = new PageInfo(1, 10, 0);
+		info.filter("enUU", SystemSession.getUser().getEnterprise().getUu());
+		info.sorting(Direction.DESC, "year");
+		map.put("year", ArrayUtils.reverse(saleStatService.findSellerYearByPageInfo(info).getContent()));
+		return map;
+	}
+
 	/**
 	 * 业务员销售额(月线)
 	 * 

+ 119 - 87
src/main/webapp/resources/js/index/app.js

@@ -260,101 +260,133 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 			$scope.todo = data;
 		});
 	});
-	app.controller('DataCtrl', function($scope) {
-		$scope.charts = {
-			sale : {
-				chartType : 'pie',
-				datas : {
-					data : [ {
-						x : "通达电子",
-						y : [ 1800000 ],
-						tooltip : "通达电子: ¥1800000"
-					}, {
-						x : "天派科技",
-						y : [ 1600000 ],
-						tooltip : "天派科技: ¥1600000"
-					}, {
-						x : "凯瑞德",
-						y : [ 900000 ],
-						tooltip : "凯瑞德: ¥900000"
-					}, {
-						x : "松下电器",
-						y : [ 360000 ],
-						tooltip : "松下电器: ¥360000"
-					}, {
-						x : "易商电子",
-						y : [ 180000 ],
-						tooltip : "易商电子: ¥180000"
-					} ]
-				},
-				config : {
-					labels : false,
-					title : "客户月采购量排行榜",
-					legend : {
-						display : true,
-						position : 'right'
-					},
-					colors : [ '#4D9934', '#33D6EA', '#98E1CC', '#8060E4', '#9999CC' ],
-					click : function(d) {
+	app.controller('PersonalSaleStatCtrl', function($scope, SaleStat) {
+		SaleStat.cust({}, function(data){
+			var p = [], q = [];
+			angular.forEach(data.month, function(d){
+				p.push({x: (d.enterprise.enShortname || d.enterprise.enName), y: [(d.total || 0)], tooltip: (d.total || 0)});
+			});
+			angular.forEach(data.year, function(d){
+				q.push({x: (d.enterprise.enShortname || d.enterprise.enName), y: [(d.total || 0)], tooltip: (d.total || 0)});
+			});
+			$scope.custCharts = {
+					month : {
+						chartType : 'pie',
+						datas : {
+							data : p
+						},
+						config : {
+							labels : false,
+							title : "客户月采购量排行榜",
+							legend : {
+								display : true,
+								position : 'right'
+							},
+							colors : [ '#4D9934', '#33D6EA', '#98E1CC', '#8060E4', '#9999CC' ],
+							click : function(d) {
 
-					},
-					mouseover : function(d) {
+							},
+							mouseover : function(d) {
 
-					},
-					mouseout : function(d) {
+							},
+							mouseout : function(d) {
 
+							},
+							innerRadius : 0,
+							lineLegend : 'lineEnd'
+						}
 					},
-					innerRadius : 0,
-					lineLegend : 'lineEnd'
-				}
-			},
-			seller : {
-				chartType : 'pie',
-				datas : {
-					data : [ {
-						x : "刘青松",
-						y : [ 5000000 ],
-						tooltip : "刘青松: ¥5000000"
-					}, {
-						x : "凌海洋",
-						y : [ 2000000 ],
-						tooltip : "凌海洋: ¥2000000"
-					}, {
-						x : "聂洋",
-						y : [ 980000 ],
-						tooltip : "聂洋: ¥980000"
-					}, {
-						x : "李小敏",
-						y : [ 900000 ],
-						tooltip : "李小敏: ¥900000"
-					}, {
-						x : "张韶刚",
-						y : [ 800000 ],
-						tooltip : "张韶刚: ¥800000"
-					} ]
-				},
-				config : {
-					labels : false,
-					title : "业务员月销量排行榜",
-					legend : {
-						display : true,
-						position : 'right'
-					},
-					colors : [ '#4D9934', '#33D6EA', '#98E1CC', '#8060E4', '#9999CC' ],
-					click : function(d) {
+					year : {
+						chartType : 'pie',
+						datas : {
+							data : q
+						},
+						config : {
+							labels : false,
+							title : "客户年采购量排行榜",
+							legend : {
+								display : true,
+								position : 'right'
+							},
+							colors : [ '#4D9934', '#33D6EA', '#98E1CC', '#8060E4', '#9999CC' ],
+							click : function(d) {
 
-					},
-					mouseover : function(d) {
+							},
+							mouseover : function(d) {
 
-					},
-					mouseout : function(d) {
+							},
+							mouseout : function(d) {
 
-					},
-					innerRadius : 0,
-					lineLegend : 'lineEnd'
-				}
+							},
+							innerRadius : 0,
+							lineLegend : 'lineEnd'
+						}
+					}
 			}
-		};
+		});
+		SaleStat.seller({}, function(data){
+			var p = [], q = [];
+			angular.forEach(data.month, function(d){
+				p.push({x: (d.enterprise.enShortname || d.enterprise.enName), y: [(d.total || 0)], tooltip: (d.total || 0)});
+			});
+			angular.forEach(data.year, function(d){
+				q.push({x: (d.enterprise.enShortname || d.enterprise.enName), y: [(d.total || 0)], tooltip: (d.total || 0)});
+			});
+			$scope.sellerCharts = {
+					month : {
+						chartType : 'pie',
+						datas : {
+							data : []
+						},
+						config : {
+							labels : false,
+							title : "业务员月销量排行榜",
+							legend : {
+								display : true,
+								position : 'right'
+							},
+							colors : [ '#4D9934', '#33D6EA', '#98E1CC', '#8060E4', '#9999CC' ],
+							click : function(d) {
+
+							},
+							mouseover : function(d) {
+
+							},
+							mouseout : function(d) {
+
+							},
+							innerRadius : 0,
+							lineLegend : 'lineEnd'
+						}
+					},
+					year : {
+						chartType : 'pie',
+						datas : {
+							data : []
+						},
+						config : {
+							labels : false,
+							title : "业务员年销量排行榜",
+							legend : {
+								display : true,
+								position : 'right'
+							},
+							colors : [ '#4D9934', '#33D6EA', '#98E1CC', '#8060E4', '#9999CC' ],
+							click : function(d) {
+
+							},
+							mouseover : function(d) {
+
+							},
+							mouseout : function(d) {
+
+							},
+							innerRadius : 0,
+							lineLegend : 'lineEnd'
+						}
+					}
+			};
+		});
 	});
 	app.controller('SaleStatCtrl', function($scope, SaleStat){
 		SaleStat.get({}, function(data){

+ 22 - 0
src/main/webapp/resources/js/index/services/Purc.js

@@ -250,6 +250,28 @@ define([ 'ngResource'], function() {
 			year: {
 				url: 'sale/stat/year',
 				isArray: true
+			},
+			cust: {
+				url: 'sale/stat/cust',
+			},
+			custMonth: {
+				url: 'sale/stat/cust/month',
+				isArray: true
+			},
+			custYear: {
+				url: 'sale/stat/cust/year',
+				isArray: true
+			},
+			seller: {
+				url: 'sale/stat/seller',
+			},
+			sellerMonth: {
+				url: 'sale/stat/seller/month',
+				isArray: true
+			},
+			sellerYear: {
+				url: 'sale/stat/seller/year',
+				isArray: true
 			}
 		});
 	});

+ 38 - 14
src/main/webapp/resources/tpl/index/home/right.html

@@ -1,5 +1,5 @@
 <!-- 交易信息 Start -->
-<div class="data-wrap" ng-controller="DataCtrl">
+<div class="data-wrap">
 	<!-- 待处理统计 Start -->
 	<div class="todo block">
 		<ul class="todo-label list-unstyled">
@@ -12,14 +12,26 @@
 				<li class="icon">销售</li>
 				<li class="start">
 					<ul class="list-unstyled">
-						<li><a ui-sref="sale.todo.inquiry">待报价(<span ng-class="{'text-default': todo.inquiry>0}">{{todo.inquiry || 0}}</span>)</a></li>
-						<li><a ui-sref="sale.todo.order">待回复(<span ng-class="{'text-default': todo.order>0}">{{todo.order || 0}}</span>)</a></li>
+						<li><a ui-sref="sale.todo.inquiry">待报价(<span
+								ng-class="{'text-default': todo.inquiry>0}">{{todo.inquiry
+									|| 0}}</span>)
+						</a></li>
+						<li><a ui-sref="sale.todo.order">待回复(<span
+								ng-class="{'text-default': todo.order>0}">{{todo.order ||
+									0}}</span>)
+						</a></li>
 					</ul>
 				</li>
 				<li class="doing">
 					<ul class="list-unstyled">
-						<li><a ui-sref="sale.todo.notice">待发货(<span ng-class="{'text-default': todo.notice>0}">{{todo.notice || 0}}</span>)</a></li>
-						<li><a ui-sref="sale.todo.change">变更中(<span ng-class="{'text-default': todo.orderChange>0}">{{todo.orderChange || 0}}</span>)</a></li>
+						<li><a ui-sref="sale.todo.notice">待发货(<span
+								ng-class="{'text-default': todo.notice>0}">{{todo.notice
+									|| 0}}</span>)
+						</a></li>
+						<li><a ui-sref="sale.todo.change">变更中(<span
+								ng-class="{'text-default': todo.orderChange>0}">{{todo.orderChange
+									|| 0}}</span>)
+						</a></li>
 					</ul>
 				</li>
 				<li class="end">
@@ -52,14 +64,22 @@
 	</div>
 	<!-- 待处理统计 End -->
 	<!-- 交易额统计 Start -->
-	<div class="pie-charts block">
+	<div class="pie-charts block" ng-controller="PersonalSaleStatCtrl">
 		<ul class="list-unstyled list-inline">
-			<li id="chart-sale-amount" class="chart"
-				ac-chart="charts.sale.chartType" ac-data="charts.sale.datas"
-				ac-config="charts.sale.config"></li>
-			<li id="chart-seller-amount" class="chart"
-				ac-chart="charts.seller.chartType" ac-data="charts.seller.datas"
-				ac-config="charts.seller.config"></li>
+			<li id="custchart-month-amount" class="chart"
+				ac-chart="custCharts.month.chartType"
+				ac-data="custCharts.month.datas" ac-config="custCharts.month.config"></li>
+			<li id="custchart-year-amount" class="chart"
+				ac-chart="custCharts.year.chartType" ac-data="custCharts.year.datas"
+				ac-config="custCharts.year.config"></li>
+			<li id="sellerchart-month-amount" class="chart"
+				ac-chart="sellerCharts.month.chartType"
+				ac-data="sellerCharts.month.datas"
+				ac-config="sellerCharts.month.config"></li>
+			<li id="sellerchart-year-amount" class="chart"
+				ac-chart="sellerCharts.year.chartType"
+				ac-data="sellerCharts.year.datas"
+				ac-config="sellerCharts.year.config"></li>
 		</ul>
 	</div>
 	<!-- 交易额统计 End -->
@@ -69,11 +89,15 @@
 <div class="feed-wrap">
 	<div class="pane notice" ng-controller="NoticeCtrl">
 		<div class="pane-header">
-			公告<span class="pull-right f12 text-muted">{{dateTime | date: 'yyyy-MM-dd'}} {{["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"][dateTime.getDay()]}}</span>
+			公告<span class="pull-right f12 text-muted">{{dateTime | date:
+				'yyyy-MM-dd'}} {{["星期日", "星期一", "星期二", "星期三", "星期四", "星期五",
+				"星期六"][dateTime.getDay()]}}</span>
 		</div>
 		<div class="pane-body">
 			<ul class="list-unstyled detail">
-				<li ng-repeat="notice in notices"><a href="public#/notice/{{notice.id}}" class="text-light" ng-bind="::notice.title" target="_blank"></a></li>
+				<li ng-repeat="notice in notices"><a
+					href="public#/notice/{{notice.id}}" class="text-light"
+					ng-bind="::notice.title" target="_blank"></a></li>
 			</ul>
 		</div>
 	</div>