Browse Source

Merge remote-tracking branch 'origin/release-201826-wangcz' into release-201826-wangcz

dongbw 7 years ago
parent
commit
3f219ab39b

+ 3 - 1
src/main/java/com/uas/platform/b2c/fa/payment/service/impl/BankTransferServiceImpl.java

@@ -288,7 +288,9 @@ public class BankTransferServiceImpl implements BankTransferService {
         bankTransfer.setTransferTime(new Date());
         bankTransfer.setTranferCreateTime(new Date());
         bankTransfer.setBuyername(user.getUserName());
-        bankTransfer.setBuyerentername(user.getEnterprise().getEnName());
+		if (user.getEnterprise() != null) {
+			bankTransfer.setBuyerentername(user.getEnterprise().getEnName());
+		}
         bankTransfer.setOrderid(order);
 		if (com.uas.platform.b2c.core.constant.Type.PAIDTOVENDOR.name().equals(bankTransfer.getType())) {// 付款类型为分期付款
 			if (orderIds.length > 1)

+ 11 - 1
src/main/java/com/uas/platform/b2c/fa/settlement/service/impl/ExchangeRateServiceImpl.java

@@ -2,10 +2,14 @@ package com.uas.platform.b2c.fa.settlement.service.impl;
 
 import com.uas.platform.b2c.common.account.model.User;
 import com.uas.platform.b2c.core.support.SystemSession;
+import com.uas.platform.b2c.core.utils.NumberUtil;
 import com.uas.platform.b2c.fa.settlement.dao.ExchangeRateDao;
 import com.uas.platform.b2c.fa.settlement.model.ExchangeRate;
 import com.uas.platform.b2c.fa.settlement.service.ExchangeRateService;
+import com.uas.platform.b2c.prod.commodity.constant.DoubleConstant;
+import com.uas.platform.b2c.trade.support.CodeType;
 import com.uas.platform.b2c.trade.support.ResultMap;
+import org.apache.commons.collections.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -38,6 +42,9 @@ public class ExchangeRateServiceImpl implements ExchangeRateService {
         if (exchangeRate == null) {
             return ResultMap.success(null);
         } else {
+            if (NumberUtil.compare(exchangeRate.getRate(), DoubleConstant.zero) < 1) {
+                return new ResultMap(CodeType.NO_INFO, "汇率必须是大于0的整数");
+            }
             User user = SystemSession.getUser();
             exchangeRate.setEnuu(user.getEnterprise().getUu());
             exchangeRate.setEnterpriseName(user.getEnterprise().getEnName());
@@ -58,7 +65,10 @@ public class ExchangeRateServiceImpl implements ExchangeRateService {
     @Override
     public ResultMap getExchangeRate(String type) {
         List<ExchangeRate> exchangeRates = exchangeRateDao.findByFromCurrency(type);
-        return ResultMap.success(exchangeRates);
+        if (CollectionUtils.isNotEmpty(exchangeRates)) {
+            return ResultMap.success(exchangeRates.get(0));
+        }
+        return ResultMap.success(null);
     }
 
     /**

+ 7 - 5
src/main/webapp/resources/js/admin/controllers/checkMoney/exchangeRate.js

@@ -3,17 +3,19 @@ define(['app/app'], function(app) {
 	app.register.controller('exchangeRateCtrl', ['$scope', 'exchangeRateService', 'toaster', function($scope, exchangeRateService, toaster) {
 		$scope.edit = false;
 		exchangeRateService.getUSD(null, function(date) {
-			$scope.usdExchangeRate = date;
+			$scope.usdExchangeRate = date.data;
 		}, function(response) {
 			toaster.pop('error', '获取信息失败:' + response.data);
 		});
 		
 		$scope.save = function() {
-			$scope.usdExchangeRate.fromCurrency = 'USD';
-			$scope.usdExchangeRate.toCurrency = 'CNY';
-			$scope.usdExchangeRate.type = 'USD';
+			if ($scope.usdExchangeRate.fromCurrency == null || $scope.usdExchangeRate.fromCurrency == '') {
+                $scope.usdExchangeRate.fromCurrency = 'USD';
+                $scope.usdExchangeRate.toCurrency = 'CNY';
+                $scope.usdExchangeRate.type = 'USD';
+			}
 			exchangeRateService.save(null, $scope.usdExchangeRate, function(data) {
-				$scope.usdExchangeRate = data;
+				$scope.usdExchangeRate = data.data;
 				$scope.edit = false;
 				toaster.pop('success', '保存成功');
 			}, function(response) {

+ 17 - 15
src/main/webapp/resources/js/admin/controllers/statsDataCtrl.js

@@ -37,29 +37,26 @@ define([ 'app/app' ], function(app) {
         $scope.endDate = new Date(currentTime + 23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000);
         $scope.startFormatDate = _formatDate($scope.startDate, 'yyyy-MM-dd');
         $scope.endFormatDate = _formatDate($scope.endDate, 'yyyy-MM-dd');
+        var addStartDate = new Date($scope.startDate.getTime() + 24 * 60 * 60 * 1000)
+        var addEndDate = new Date($scope.endDate.getTime() + 24 * 60 * 60 * 1000)
+        $scope.addStartFormatDate = _formatDate(addStartDate, 'yyyy-MM-dd');
+        $scope.addEndFormatDate = _formatDate(addEndDate, 'yyyy-MM-dd');
 
         $scope.setFilters = function (type, val) {
             $scope[type] = val;
             if (type == 'dateArea') {
                 // 时间筛选
                 var currentTime = _getClearDay(new Date());
-                console.log(currentTime, 'currentTime')
                 var endDate = new Date(currentTime + 23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000);
                 if (val == 'oneMonth') {
                     $scope.startDate = new Date(currentTime - 30 * 24 * 60 * 60 * 1000 - 24 * 60 * 60 * 1000);
                     $scope.endDate = endDate;
-                    $scope.startFormatDate = _formatDate($scope.startDate, 'yyyy-MM-dd');
-                    $scope.endFormatDate = _formatDate($scope.endDate, 'yyyy-MM-dd');
                 } else if (val == 'threeMonth') {
                     $scope.startDate = new Date(currentTime - 3 * 30 * 24 * 60 * 60 * 1000 - 24 * 60 * 60 * 1000);
                     $scope.endDate = endDate;
-                    $scope.startFormatDate = _formatDate($scope.startDate, 'yyyy-MM-dd');
-                    $scope.endFormatDate =  _formatDate($scope.endDate, 'yyyy-MM-dd');
                 } else if (val == 'sixMonth') {
                     $scope.startDate = new Date(currentTime - 6 * 30 * 24 * 60 * 60 * 1000 - 24 * 60 * 60 * 1000);
                     $scope.endDate = endDate;
-                    $scope.startFormatDate = _formatDate($scope.startDate, 'yyyy-MM-dd');
-                    $scope.endFormatDate =  _formatDate($scope.endDate, 'yyyy-MM-dd');
                 }
             }
             if (val != 'autoMonth') {
@@ -112,7 +109,7 @@ define([ 'app/app' ], function(app) {
                 $scope.ssoUrl = data.data == 'success' ? 'https://sso.ubtob.com' : 'http://192.168.253.6:32323';
                 $scope.uasUrl = data.data == 'success' ? 'http://uas.ubtob.com' : 'http://192.168.253.12:9000/b2b-test';
                 $scope.commonUrl = data.data == 'success' ? 'https://api-inquiry.usoftmall.com' : 'http://218.17.158.219:24000';
-                // 询价信息
+                // 询价信息(刘)
                 $http({
                     method: 'get',
                     dataType: 'json',
@@ -123,34 +120,34 @@ define([ 'app/app' ], function(app) {
                 }).error(function () {
                     toaster.pop('error', '获取未处理审批数据失败');
                 });
-                // 新增企业用户数
+                // 新增企业用户数(1)
                 $http({
                     method: 'get',
                     dataType: 'json',
                     url: $scope.ssoUrl + '/api/userspace/inputTime/count/apps',
-                    params: {start: $scope.startFormatDate, end: $scope.endFormatDate, fromApps:'mall,b2b'}
+                    params: {start: $scope.addStartFormatDate, end: $scope.addEndFormatDate, fromApps:'mall,b2b'}
                 }).success(function (data) {
                     $scope.newAddUserSpaceData = data.content
                 }).error(function () {
                     toaster.pop('error', '获取未处理审批数据失败');
                 });
-                // 新增个人用户
+                // 新增个人用户(1)
                 $http({
                     method: 'get',
                     dataType: 'json',
                     url: $scope.ssoUrl + '/api/user/inputTime/count/apps',
-                    params: {start: $scope.startFormatDate, end: $scope.endFormatDate, fromApps:'mall,b2b'}
+                    params: {start: $scope.addStartFormatDate, end: $scope.addEndFormatDate, fromApps:'mall,b2b'}
                 }).success(function (data) {
                     $scope.newAddUserData = data.content
                 }).error(function () {
                     toaster.pop('error', '获取未处理审批数据失败');
                 });
-                // 半年未登录用户数
+                // 半年未登录用户数(1)
                 $http({
                     method: 'get',
                     dataType: 'json',
                     url: $scope.ssoUrl + '/api/user/count/notlgoin/month',
-                    params: {start: $scope.startFormatDate, end: $scope.endFormatDate, months: '6,12,24'}
+                    params: {start: $scope.addStartFormatDate, end: $scope.addEndFormatDate, months: '6,12,24'}
                 }).success(function (data) {
                     $scope.monthLogoData = data
                 }).error(function () {
@@ -160,9 +157,14 @@ define([ 'app/app' ], function(app) {
                 toaster.pop('error', '获取运行环境失败');
             });
         };
-
         // 获取不同时间阶段的相关数据
         var initData = function () {
+            var addStartDate = new Date($scope.startDate.getTime() + 24 * 60 * 60 * 1000)
+            var addEndDate = new Date($scope.endDate.getTime() + 24 * 60 * 60 * 1000)
+            $scope.addStartFormatDate = _formatDate(addStartDate, 'yyyy-MM-dd');
+            $scope.addEndFormatDate = _formatDate(addEndDate, 'yyyy-MM-dd');
+            $scope.startFormatDate = _formatDate($scope.startDate, 'yyyy-MM-dd');
+            $scope.endFormatDate =  _formatDate($scope.endDate, 'yyyy-MM-dd');
             getDevOrProdData();
             // 上传产品个数
             Goods.getProductsCmp({fromDate: $scope.startDate.getTime(), toDate: $scope.endDate.getTime()}, function (data) {