Browse Source

Merge branch 'dev-mysql' into liusw-account-v1.0.10.19

liusw 8 years ago
parent
commit
b19d96cd80

+ 36 - 0
src/main/java/com/uas/platform/b2c/prod/product/common/CommonTask.java

@@ -0,0 +1,36 @@
+package com.uas.platform.b2c.prod.product.common;
+
+import com.uas.platform.b2c.prod.product.common.dao.CommonCountDao;
+import com.uas.platform.b2c.prod.product.common.model.CommonCount;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * 通用模块任务
+ *
+ * @version 2017/10/21 18:03 wangyc
+ */
+@Component("CommonTask")
+public class CommonTask {
+
+    private final CommonCountDao commonCountDao;
+
+    private final JdbcTemplate jdbcTemplate;
+
+    @Autowired
+    public CommonTask(CommonCountDao commonCountDao, JdbcTemplate jdbcTemplate) {
+        this.commonCountDao = commonCountDao;
+        this.jdbcTemplate = jdbcTemplate;
+    }
+
+    public void updateCount() {
+        List<CommonCount> commonCounts = commonCountDao.findByStatus((short) 1);
+        for (CommonCount commonCount : commonCounts) {
+            commonCount.setCount(jdbcTemplate.queryForLong(commonCount.getSql()));
+        }
+        commonCountDao.save(commonCounts);
+    }
+}

+ 1 - 1
src/main/java/com/uas/platform/b2c/prod/product/common/api/CommonCountController.java

@@ -27,6 +27,6 @@ public class CommonCountController {
      */
     @RequestMapping(method = RequestMethod.GET, params = "_status=actived")
     public List<CommonCount> findActived() {
-        return commonCountService.findByStatus((short) 1);
+        return commonCountService.findByStatus((short) 1, "b2c_index");
     }
 }

+ 9 - 2
src/main/java/com/uas/platform/b2c/prod/product/common/dao/CommonCountDao.java

@@ -14,9 +14,16 @@ import java.util.List;
 public interface CommonCountDao extends JpaSpecificationExecutor<CommonCount>,JpaRepository<CommonCount, Long>{
 
     /**
-     * 通过状态获取计数器
+     * 通过状态和应用获取计数器
      * @param status 状态
      * @return 计数器
      */
-    public List<CommonCount> findByStatusOrderByDetno(Short status);
+    public List<CommonCount> findByStatusAndUsedForOrderByDetno(Short status, String usedFor);
+
+    /**
+     * 通过状态获取计数器
+     * @param status
+     * @return
+     */
+    public List<CommonCount> findByStatus(Short status);
 }

+ 14 - 0
src/main/java/com/uas/platform/b2c/prod/product/common/model/CommonCount.java

@@ -48,6 +48,12 @@ public class CommonCount implements Serializable{
     @Column(name = "cc_count")
     private Long count;
 
+    /**
+     * 应用
+     */
+    @Column(name = "cc_usedfor")
+    private String usedFor;
+
     /**
      * 状态,是否激活(1:是;0:否)
      */
@@ -94,6 +100,14 @@ public class CommonCount implements Serializable{
         this.count = count;
     }
 
+    public String getUsedFor() {
+        return usedFor;
+    }
+
+    public void setUsedFor(String usedFor) {
+        this.usedFor = usedFor;
+    }
+
     public Short getStatus() {
         return status;
     }

+ 2 - 2
src/main/java/com/uas/platform/b2c/prod/product/common/service/CommonCountService.java

@@ -10,9 +10,9 @@ import java.util.List;
 public interface CommonCountService {
 
     /**
-     * 根据状态获取计数器
+     * 根据状态和用途获取计数器
      * @param status 状态
      * @return
      */
-    List<CommonCount> findByStatus(Short status);
+    List<CommonCount> findByStatus(Short status, String usedFor);
 }

+ 2 - 6
src/main/java/com/uas/platform/b2c/prod/product/common/service/impl/CommonCountServiceImpl.java

@@ -4,7 +4,6 @@ import com.uas.platform.b2c.prod.product.common.dao.CommonCountDao;
 import com.uas.platform.b2c.prod.product.common.model.CommonCount;
 import com.uas.platform.b2c.prod.product.common.service.CommonCountService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
@@ -18,12 +17,9 @@ public class CommonCountServiceImpl implements CommonCountService{
     @Autowired
     private CommonCountDao commonCountDao;
 
-    @Autowired
-    private JdbcTemplate jdbcTemplate;
-
     @Override
-    public List<CommonCount> findByStatus(Short status) {
-        List<CommonCount> commonCounts = commonCountDao.findByStatusOrderByDetno(status);
+    public List<CommonCount> findByStatus(Short status, String usedFor) {
+        List<CommonCount> commonCounts = commonCountDao.findByStatusAndUsedForOrderByDetno(status, usedFor);
         for (CommonCount commonCount : commonCounts) {
             commonCount.setSql(null);
         }

+ 3 - 0
src/main/resources/spring/task.xml

@@ -19,5 +19,8 @@
         <task:scheduled ref="RateTask" method="autoAfterRate" cron="0 0 1 * * ?"/>
        <!-- <task:scheduled ref="RateTask" method="autoAfterRate" cron="* */10 * * * ?"/>-->
     </task:scheduled-tasks>
+    <task:scheduled-tasks>
+        <task:scheduled ref="CommonTask" method="updateCount" cron="0 0 1 * * ?"/>
+    </task:scheduled-tasks>
     <context:annotation-config />
 </beans>

+ 7 - 3
src/main/webapp/WEB-INF/views/normal/proxyLogout.html

@@ -11,13 +11,17 @@
 </head>
 <body>
 <script type="text/javascript">
-	function proxyLogout(askUrl, retUrl) {
+	function proxyLogout(askUrl, retUrl, logoutUrl) {
 	    $.getJSON(askUrl + "?callback=?", function(d){
-	    	window.location.href = retUrl;
+            if (d.error) {
+                window.location.href = logoutUrl
+            } else {
+                window.location.href = retUrl && retUrl !== 'null' ? retUrl : '/'
+            }
 	    });
 	}
 	$.getJSON('logout/crossBefore', function(data){
-		proxyLogout(data.askUrl, data.returnUrl);
+		proxyLogout(data.askUrl, data.returnUrl ,data.logoutUrl);
 	});
 </script>
 <div align="center" style="margin-top: 180px;">

+ 1 - 1
src/main/webapp/resources/js/admin/controllers/customService/ReviewerEmailInfo.js

@@ -20,7 +20,7 @@ define(['app/app'], function(app) {
 				templateUrl : 'static/view/admin/customService/modal/addMailInfo.html',
 				controller : 'addMailInfoCtrl',
 				resolve : {
-					
+
 				}
 			});
 			

+ 9 - 6
src/main/webapp/resources/js/usercenter/controllers/forstore/buyer_order_ctrl.js

@@ -158,10 +158,13 @@ define(['app/app'], function (app) {
 
 		var loadData = function() {
 			Order.getIndividualOrder($scope.param, function(data) {
-				$scope.AllOrderInfo = data;
-                if($scope.childStatus ==''){
-                    $scope.AllOrderInfo[$scope.status] = data.totalElements;
-                }
+                if (!$scope.startDate && !$scope.endDate && !$scope.keyword){
+                    $scope.AllOrderInfo = data;
+                    if($scope.childStatus ==''){
+                        $scope.AllOrderInfo[$scope.status] = data.totalElements;
+                    }
+				}
+                $scope.isSearch = false;
 				$scope.currenctOrders = data.content;
 				angular.forEach($scope.currenctOrders, function(data){
                     data.ensurePrice = Number(NumberService.toCeil(data.ensurePrice, 2));
@@ -414,9 +417,9 @@ define(['app/app'], function (app) {
 			$scope.param.page = 1;
 			$scope.param.status = getState();
 			$scope.param.keyword = $scope.keyword;
-
+            $scope.setChildStatus('','订单状态')
 			loadData();
-			getCounts();
+			//getCounts();
 		};
 
 		$scope.noticeShipConfirm = function () {

+ 24 - 17
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_order_ctrl.js

@@ -401,10 +401,12 @@ define(['app/app'], function (app) {
 
         // 获取各种状态订单的数量信息
         var getCounts = function () {
-            Purchase.getAllStatusCounts({storeType: $scope.storeType}, function (data) {
-                $scope.counts = angular.copy(data);
-                $scope.counts[$scope.status] = $scope.pageParams.totalElements;
-            });
+            if (!$scope.startDate && !$scope.endDate && !$scope.keyword){
+                Purchase.getAllStatusCounts({storeType: $scope.storeType}, function (data) {
+                    $scope.counts = angular.copy(data);
+                    $scope.counts[$scope.status] = $scope.pageParams.totalElements;
+                });
+            }
         };
         getCounts();
 
@@ -494,6 +496,7 @@ define(['app/app'], function (app) {
             $scope.orderTableParams.reload();
         };
 
+
         $scope.orderTableParams = new ngTableParams($scope.tableParams, {
             total: 0,
             getData: function ($defer, params) {
@@ -523,22 +526,25 @@ define(['app/app'], function (app) {
 
                 Purchase.getByStatusAndInternal(param, function (page) {
                     if (page) {
-                        if ($scope.childStatus ==''){
-                            if (page.content) {
-                                angular.forEach(page, function (value, key) {
-                                    if (key == 'all' || key == 'tobeconfirmed' || key == 'comfirmed' || key == 'inbound'
-                                        || key == 'tobepaid' || key == 'completed' || key == 'unavailable' || key == 'toBeReviewed') {
-                                        if(!$scope.counts) {
-                                            $scope.counts = {};
+                        if (!$scope.startDate && !$scope.endDate && !$scope.keyword) {
+                            if ($scope.childStatus == '') {
+                                if (page.content) {
+                                    angular.forEach(page, function (value, key) {
+                                        if (key == 'all' || key == 'tobeconfirmed' || key == 'comfirmed' || key == 'inbound'
+                                            || key == 'tobepaid' || key == 'completed' || key == 'unavailable' || key == 'toBeReviewed') {
+                                            if (!$scope.counts) {
+                                                $scope.counts = {};
+                                            }
+                                            $scope.counts[key] = value;
                                         }
-                                        $scope.counts[key] = value;
-                                    }
-                                    $scope.counts[$scope.status] = page.totalElements;
-                                });
-                            } else {
-                                $scope.counts = {};
+                                        $scope.counts[$scope.status] = page.totalElements;
+                                    });
+                                } else {
+                                    $scope.counts = {};
+                                }
                             }
                         }
+
                         $scope.purchases = page.content;
                         $scope.requestOver = 0;
                         angular.forEach($scope.purchases, function (order) {
@@ -801,6 +807,7 @@ define(['app/app'], function (app) {
                 $scope.endDate = null;
                 return;
             }
+            $scope.setChildStatus('','订单状态');
             $scope.orderTableParams.page(1);
             $scope.orderTableParams.reload();
         };