Browse Source

Merge remote-tracking branch 'origin/dev' into dev

dongbw 8 years ago
parent
commit
bb378149f3

+ 12 - 0
src/main/java/com/uas/platform/b2b/controller/PubInquiryListController.java

@@ -2,8 +2,10 @@ package com.uas.platform.b2b.controller;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.uas.platform.b2b.core.util.ContextUtils;
 import com.uas.platform.b2b.model.*;
 import com.uas.platform.b2b.service.EnquiryService;
+import com.uas.platform.b2b.support.SysConf;
 import com.uas.platform.b2b.support.UsageBufferedLogger;
 import com.uas.platform.core.logging.BufferedLoggerManager;
 import com.uas.platform.core.model.PageInfo;
@@ -97,4 +99,14 @@ public class PubInquiryListController {
         logger.log("公共询价", "将公共询价转成客户询价单", "关联id:" + inquiryItem.getId());
         return enquiryService.turnToQuotation(inquiryItem, method, uploadItem);
     }
+
+    /**
+     * 获取公共询价服务的访问路径
+     *
+     * @return modelMap
+     */
+    @RequestMapping(value = "/accessUrl", method = RequestMethod.GET)
+    private ModelMap getAccessUrl() {
+        return new ModelMap("url", ContextUtils.getBean(SysConf.class).getInquiryServiceUrl());
+    }
 }

+ 122 - 51
src/main/webapp/resources/js/index/app.js

@@ -5349,7 +5349,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
     }]);
 
     // 公共询价列表
-    app.controller('PublicInquiryListCtrl', ['$scope', '$stateParams', 'PurchaseInquiry', '$filter', 'toaster', 'BaseService', 'ngTableParams', 'PurcInquiry', 'publicInquiry', 'publicInquiryList', '$modal', '$http', function ($scope, $stateParams, PurchaseInquiry, $filter, toaster, BaseService, ngTableParams, PurcInquiry, publicInquiry, publicInquiryList, $modal, $http) {
+    app.controller('PublicInquiryListCtrl', ['$scope', '$stateParams', 'PurchaseInquiry', '$filter', 'toaster', 'BaseService', 'ngTableParams', 'PurcInquiry', 'publicInquiry', 'publicInquiryList', '$modal', '$http', 'AccountEnterprise', function ($scope, $stateParams, PurchaseInquiry, $filter, toaster, BaseService, ngTableParams, PurcInquiry, publicInquiry, publicInquiryList, $modal, $http, AccountEnterprise) {
         BaseService.scrollBackToTop();
         /**
          * 改变单据日期范围
@@ -5430,15 +5430,6 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
             $scope.tableParams.page(1);
             $scope.tableParams.reload();
         };
-        // $scope.setActive = function(state) {
-        //     if($scope.active != state) {
-        //         $scope.active = state;
-        //         if($scope.tableParams.page() == 1)
-        //             $scope.tableParams.reload();
-        //         else
-        //             $scope.tableParams.page(1);
-        //     }
-        // };
 
         $scope.nowdate = new Date().getTime() - 24 * 3600 * 1000;
         var getOpenState = function (active) {
@@ -5469,11 +5460,6 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
         };
 
         var getService = function () {
-            // if ($scope.active == 'teams') {
-            //     return PurchaseInquiry.hisquotation;
-            // } else {
-            //     return PurchaseInquiry.publicInquiryItem;
-            // }
             return publicInquiryList.getInquirylist;
         }
 
@@ -5497,19 +5483,51 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                     fromDate: getDateTime($scope.condition.dateFrom),
                     endDate: getDateTime($scope.condition.dateTo)
                 };
-//                AccountEnterprise.get({}, function(data){
-//                    $scope.currentEn = data;
-//                });
-                getService().call(null, BaseService.parseParams(pageParams), function (page) {
-                    $scope.loading = false;
-                    if (page) {
-                        params.total(page.totalElement);
-                        $defer.resolve(page.content);
-                        // $scope.keywordXls = angular.copy($scope.keyword); // 保存当前取值的关键词  做导出时需要的字段
-                    }
-                }, function (response) {
-                    $scope.loading = false;
-                    toaster.pop('error', '数据加载失败', response.data);
+                /*getService().call(null, BaseService.parseParams(pageParams), function (page) {
+                 $scope.loading = false;
+                 if (page) {
+                 params.total(page.totalElement);
+                 $defer.resolve(page.content);
+                 // $scope.keywordXls = angular.copy($scope.keyword); // 保存当前取值的关键词  做导出时需要的字段
+                 }
+                 }, function (response) {
+                 $scope.loading = false;
+                 toaster.pop('error', '数据加载失败', response.data);
+                 });*/
+                AccountEnterprise.get({}, function(data) {
+                   $scope.currentEn = data;
+                    publicInquiry.getUrl({}, function(data) {
+                        var url = data.url;
+                        $http({
+                            method: 'get',
+                            dataType: 'json',
+                            url: url + '/inquiry/public',
+                            params: {pageNumber: pageParams.page, pageSize: pageParams.count, enUU: $scope.currentEn.uu, keyword: $scope.keyword,
+                                fromDate: getDateTime($scope.condition.dateFrom), endDate: getDateTime($scope.condition.dateTo)}
+                        }).success(function (response) {
+                            $scope.loading = false;
+                            if (response) {
+                                params.total(response.totalElements);
+                                $defer.resolve(response.content);
+                                // $scope.keywordXls = angular.copy($scope.keyword); // 保存当前取值的关键词  做导出时需要的字段
+                            }
+                        }).error(function (err) {
+                            $scope.loading = false;
+                            toaster.pop('error', '数据加载失败', err);
+                        });
+
+                        // 顶部滚动消息
+                        $http({
+                            method: 'get',
+                            url: url + '/inquiry/public/messageList',
+                            params: {enuu: $scope.currentEn.uu, size: 10},
+                            dataType: 'json'
+                        }).success(function(data) {
+                            $scope.message = data;
+                        }).error(function(error) {
+
+                        });
+                    });
                 });
             }
         });
@@ -5527,24 +5545,6 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
             $scope.tableParams.page(1);
             $scope.tableParams.reload();
         };
-        //得到消息
-        PurcInquiry.getMessage({}, function (data) {
-            $scope.message = data;
-        }, function (response) {
-
-        });
-
-        /*$http({
-            method: 'GET',
-            dataType: 'JSON',
-            url: 'http://192.168.253.12:24000/inquiry/public/messageList',
-            async : false,
-            params: {enuu:10041559, size: 10},
-        }).success(function(data) {
-            console.log(data)
-        }).error(function() {
-            console.log('error')
-        });*/
 
         // 转客户询价
         $scope.transtoInquiry = function (inquiryItem) {
@@ -23158,7 +23158,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
     /**
      * 针对卖家,已转询价的公共询价单列表
      */
-    app.controller('SalePubInquiryCtrl', ['$scope', '$filter', 'PubInquirySearchInfo', 'ngTableParams', 'toaster', 'BaseService', 'PubInquiryNoSearchInfo', '$upload', '$rootScope', 'token', '$timeout', 'CurrentRole', 'publicInquiry', '$modal', function ($scope, $filter, PubInquirySearchInfo, ngTableParams, toaster, BaseService, PubInquiryNoSearchInfo, $upload, $rootScope, token, $timeout, CurrentRole, publicInquiry, $modal) {
+    app.controller('SalePubInquiryCtrl', ['$scope', '$filter', 'PubInquirySearchInfo', 'ngTableParams', 'toaster', 'BaseService', 'PubInquiryNoSearchInfo', '$upload', '$rootScope', 'token', '$timeout', 'CurrentRole', 'publicInquiry', '$modal', 'AccountEnterprise', '$http', function ($scope, $filter, PubInquirySearchInfo, ngTableParams, toaster, BaseService, PubInquiryNoSearchInfo, $upload, $rootScope, token, $timeout, CurrentRole, publicInquiry, $modal, AccountEnterprise, $http) {
         BaseService.scrollBackToTop();
 
         // 获取当前用户是否为普通用户
@@ -23244,7 +23244,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                 if ($scope.active == 'overdue') {
                     $scope.active = 'end';
                 }
-                getService()[getState($scope.active)].call(null, BaseService.parseParams(pageParams), function (page) {
+                /*getService()[getState($scope.active)].call(null, BaseService.parseParams(pageParams), function (page) {
                     $scope.loading = false;
                     if (page) {
                         params.total(page.totalElement);
@@ -23254,6 +23254,30 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                 }, function (response) {
                     $scope.loading = false;
                     toaster.pop('error', '数据加载失败', response.data);
+                });*/
+                AccountEnterprise.get({}, function(data) {
+                    $scope.currentEn = data;
+                    publicInquiry.getUrl({}, function(data) {
+                        var url = data.url;
+                        var filter = {vendUU: $scope.currentEn.uu, keyword: $scope.keyword,
+                            fromDate: getDateTime($scope.condition.dateFrom), endDate: getDateTime($scope.condition.dateTo)};
+                        $http({
+                            method: 'get',
+                            dataType: 'json',
+                            url: url + '/inquiry/public/quotation/list',
+                            params: {pageNumber: pageParams.page, pageSize: pageParams.count, filter: filter, _state: $scope.active}
+                        }).success(function (response) {
+                            $scope.loading = false;
+                            if (response) {
+                                params.total(response.totalElements);
+                                $defer.resolve(response.content);
+                                // $scope.keywordXls = angular.copy($scope.keyword); // 保存当前取值的关键词  做导出时需要的字段
+                            }
+                        }).error(function (err) {
+                            $scope.loading = false;
+                            toaster.pop('error', '数据加载失败', err);
+                        });
+                    });
                 });
             }
         });
@@ -23751,7 +23775,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
     /**
      * 针对买家,已转询价的公共询价单列表
      */
-    app.controller('PurcPubInquiryCtrl', ['$scope', '$filter', 'PurcPubInquirySearchInfo', 'ngTableParams', 'toaster', 'BaseService', 'PurcPubInquiryNoSearchInfo', '$upload', '$rootScope', 'token', '$timeout', 'CurrentRole', 'publicInquiry', function ($scope, $filter, PurcPubInquirySearchInfo, ngTableParams, toaster, BaseService, PurcPubInquiryNoSearchInfo, $upload, $rootScope, token, $timeout, CurrentRole, publicInquiry) {
+    app.controller('PurcPubInquiryCtrl', ['$scope', '$filter', 'PurcPubInquirySearchInfo', 'ngTableParams', 'toaster', 'BaseService', 'PurcPubInquiryNoSearchInfo', '$upload', '$rootScope', 'token', '$timeout', 'CurrentRole', 'publicInquiry', 'AccountEnterprise', '$http', function ($scope, $filter, PurcPubInquirySearchInfo, ngTableParams, toaster, BaseService, PurcPubInquiryNoSearchInfo, $upload, $rootScope, token, $timeout, CurrentRole, publicInquiry, AccountEnterprise, $http) {
         BaseService.scrollBackToTop();
 
         // 获取当前用户是否为普通用户
@@ -23828,7 +23852,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                 if ($scope.active == 'overdue') {
                     $scope.active = 'end';
                 }
-                getService()[getState($scope.active)].call(null, BaseService.parseParams(pageParams), function (page) {
+               /* getService()[getState($scope.active)].call(null, BaseService.parseParams(pageParams), function (page) {
                     $scope.loading = false;
                     if (page) {
                         params.total(page.totalElement);
@@ -23838,6 +23862,30 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                 }, function (response) {
                     $scope.loading = false;
                     toaster.pop('error', '数据加载失败', response.data);
+                });*/
+                AccountEnterprise.get({}, function(data) {
+                    $scope.currentEn = data;
+                    publicInquiry.getUrl({}, function(data) {
+                        var url = data.url;
+                        var filter = {enUU: $scope.currentEn.uu, keyword: $scope.keyword,
+                            fromDate: getDateTime($scope.condition.dateFrom), endDate: getDateTime($scope.condition.dateTo)};
+                        $http({
+                            method: 'get',
+                            dataType: 'json',
+                            url: url + '/inquiry/public/quotation/list',
+                            params: {pageNumber: pageParams.page, pageSize: pageParams.count, filter: filter, _state: $scope.active}
+                        }).success(function (response) {
+                            $scope.loading = false;
+                            if (response) {
+                                params.total(response.totalElements);
+                                $defer.resolve(response.content);
+                                // $scope.keywordXls = angular.copy($scope.keyword); // 保存当前取值的关键词  做导出时需要的字段
+                            }
+                        }).error(function (err) {
+                            $scope.loading = false;
+                            toaster.pop('error', '数据加载失败', err);
+                        });
+                    });
                 });
             }
         });
@@ -24089,6 +24137,29 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                 toaster.pop('error', '附件上传失败');
             });
         }
-    }])
+    }]);
+
+    /**
+     * 首页侧边栏询价列表
+     */
+    app.controller('InquiryMessageListCtrl', ['$scope', 'publicInquiry', 'AccountEnterprise', '$http', function($scope, publicInquiry, AccountEnterprise, $http) {
+        AccountEnterprise.get({}, function(data) {
+            $scope.currentEn = data;
+            publicInquiry.getUrl({}, function (data) {
+                var url = data.url;
+                $http({
+                    method: 'get',
+                    url: url + '/inquiry/public/messageList',
+                    params: {enuu: $scope.currentEn.uu, size: 7},
+                    dataType: 'json'
+                }).success(function(data) {
+                    $scope.message = data;
+                }).error(function(error) {
+
+                });
+            });
+        });
+    }]);
+
     return app;
 });

+ 7 - 0
src/main/webapp/resources/js/index/services/PublicInquiry.js

@@ -84,6 +84,13 @@ define([ 'ngResource'], function() {
             quotationInfo: {
                 url: 'pubInquiry/quotation/:id',
                 method: 'GET'
+            },
+            /**
+             * 查询公共询价服务的访问路径
+             */
+            getUrl: {
+                url: 'pubInquiry/accessUrl',
+                method: 'GET'
             }
         })
     }]).factory('PubInquiryNoSearchInfo', ['$resource', function($resource) {

+ 3 - 0
src/main/webapp/resources/tpl/index/baseInfo/inquiry_list.html

@@ -316,6 +316,9 @@
 </style>
 
 <div class="ng-scope">
+    <div class="loading in" ng-class="{'in': loading}">
+        <i></i>
+    </div>
     <!--<form name="tenderForm">-->
         <div class="purc-tender" id="tender-list">
             <div class="tender-label list-unstyled">

+ 1 - 1
src/main/webapp/resources/tpl/index/home/left.html

@@ -176,7 +176,7 @@
 			</ul>
 		</div>
 	</div>
-	<div class="pane service" ng-controller="SaleInquiryCtrl">
+	<div class="pane service" ng-controller="InquiryMessageListCtrl">
 		<div class="pane-header">
 			<img src="static/img/home/xunjia.png"> 公共询价<a class="pull-right text-muted"></a>
 			<span class="pull-right"><a ui-sref="baseInfo.inquiryList" class="text-light">更多>></a></span>