diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/payment/PaySuccessCountMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/payment/PaySuccessCountMapper.java new file mode 100644 index 000000000..ac0b29330 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/payment/PaySuccessCountMapper.java @@ -0,0 +1,21 @@ +package au.com.royalpay.payment.manage.mappers.payment; + + +import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper; +import cn.yixblog.support.mybatis.autosql.annotations.AutoSql; +import cn.yixblog.support.mybatis.autosql.annotations.SqlType; +import com.alibaba.fastjson.JSONObject; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * Created by todking on 2019-06-15. + */ + +@AutoMapper(tablename = "paysuccess_count", pkName = "id") +public interface PaySuccessCountMapper { + + @AutoSql(type = SqlType.SELECT) + List findCount(@Param("in_time") String time); +} diff --git a/src/main/java/au/com/royalpay/payment/manage/posters/beans/paySuccessCountBean.java b/src/main/java/au/com/royalpay/payment/manage/posters/beans/paySuccessCountBean.java new file mode 100644 index 000000000..2a01c8a18 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/posters/beans/paySuccessCountBean.java @@ -0,0 +1,42 @@ +package au.com.royalpay.payment.manage.posters.beans; + +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.annotation.JSONField; + +/** + * created by todking at 2019-6-15 + */ +public class paySuccessCountBean { + + @JSONField(name = "in_time") + private String inTime; + + @JSONField(name = "count") + private int count; + + public String getInTime() { + return inTime; + } + + public void setInTime(String inTime) { + this.inTime = inTime; + } + + public int getCount() { + return count; + } + + public void setCount(int count) { + this.count = count; + } + + public JSONObject toJson() { + JSONObject jsons = new JSONObject(); + + jsons.put("inTime", inTime); + + jsons.put("count", count); + + return jsons; + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/posters/core/PaySuccessCountService.java b/src/main/java/au/com/royalpay/payment/manage/posters/core/PaySuccessCountService.java new file mode 100644 index 000000000..9f7d42b17 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/posters/core/PaySuccessCountService.java @@ -0,0 +1,14 @@ +package au.com.royalpay.payment.manage.posters.core; + +import com.alibaba.fastjson.JSONObject; +import org.springframework.stereotype.Service; + +/** + * create by todking at 2019-6-3 + */ + +public interface PaySuccessCountService { + + //查询支付成功页面次数 + JSONObject selectCount(String time); +} diff --git a/src/main/java/au/com/royalpay/payment/manage/posters/core/PosterService.java b/src/main/java/au/com/royalpay/payment/manage/posters/core/PosterService.java index 918e19999..7bc13aee4 100644 --- a/src/main/java/au/com/royalpay/payment/manage/posters/core/PosterService.java +++ b/src/main/java/au/com/royalpay/payment/manage/posters/core/PosterService.java @@ -1,9 +1,14 @@ package au.com.royalpay.payment.manage.posters.core; +import com.alibaba.fastjson.JSONObject; + + /** * create by todking at 2019-6-3 */ public interface PosterService { void updatePoster(String imgUrl); + + JSONObject getPoster(); } diff --git a/src/main/java/au/com/royalpay/payment/manage/posters/core/impls/PaySuccessCountServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/posters/core/impls/PaySuccessCountServiceImpl.java new file mode 100644 index 000000000..28016fd43 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/posters/core/impls/PaySuccessCountServiceImpl.java @@ -0,0 +1,44 @@ +package au.com.royalpay.payment.manage.posters.core.impls; + +import au.com.royalpay.payment.manage.mappers.payment.PaySuccessCountMapper; +import au.com.royalpay.payment.manage.posters.core.PaySuccessCountService; +import com.alibaba.fastjson.JSONObject; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.Locale; + + +/** + * created by todking at 2019-6-15 + */ + +@Service +public class PaySuccessCountServiceImpl implements PaySuccessCountService { + + @Resource + private PaySuccessCountMapper paySuccessCountMapper; + + @Override + public JSONObject selectCount(String time) { + String gmt = time.replace("GMT", "").replaceAll("\\(.*\\)", ""); + SimpleDateFormat format = new SimpleDateFormat("EEE MMM dd yyyy hh:mm:ss z", Locale.ENGLISH); + Date dateTrans = null; + try { + dateTrans = format.parse(gmt); + } catch (ParseException e) { + e.printStackTrace(); + } + String s = new SimpleDateFormat("yyyy-MM-dd").format(dateTrans); + List object = paySuccessCountMapper.findCount(s); + if(object.size() != 0){ + return object.get(0); + }else { + return null; + } + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/posters/core/impls/PosterServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/posters/core/impls/PosterServiceImpl.java index f2df7f4d7..a4a25e5a0 100644 --- a/src/main/java/au/com/royalpay/payment/manage/posters/core/impls/PosterServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/posters/core/impls/PosterServiceImpl.java @@ -3,12 +3,14 @@ package au.com.royalpay.payment.manage.posters.core.impls; import au.com.royalpay.payment.manage.posters.core.PosterService; import cn.yixblog.platform.http.HttpRequestGenerator; import cn.yixblog.platform.http.HttpRequestResult; +import com.alibaba.fastjson.JSONObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.web.bind.annotation.RequestMethod; +import java.io.IOException; import java.net.URISyntaxException; @@ -40,5 +42,28 @@ public class PosterServiceImpl implements PosterService { } } + @Override + public JSONObject getPoster() { + String url = cmsHost + "/api/statistics/posters"; + HttpRequestGenerator htg = new HttpRequestGenerator(url, RequestMethod.GET); + try { + HttpRequestResult result = htg.execute(); + if(result.isSuccess()){ + int statusCode = result.getStatusCode(); + if (statusCode == 200) { + logger.info("Get posters succeeded"); + } + JSONObject obj = result.getResponseContentJSONObj(); +// final String s = result.getResponseContentString(); + return obj; + } + } catch (URISyntaxException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } + } diff --git a/src/main/java/au/com/royalpay/payment/manage/posters/web/paySuccessCountController.java b/src/main/java/au/com/royalpay/payment/manage/posters/web/paySuccessCountController.java new file mode 100644 index 000000000..700e67a50 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/posters/web/paySuccessCountController.java @@ -0,0 +1,33 @@ +package au.com.royalpay.payment.manage.posters.web; + + +import au.com.royalpay.payment.manage.posters.core.PaySuccessCountService; +import com.alibaba.fastjson.JSONObject; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.text.ParseException; + + + +/** + * created by todking at 2019-6-15 + */ +@RestController +@RequestMapping(value = "/statistics/click") +public class paySuccessCountController { + + @Resource + private PaySuccessCountService paySuccessCountService; + + @RequestMapping(value = "/paySuccess_count/{time}",method = RequestMethod.GET) + public Long selectCount(@PathVariable String time) throws ParseException { + JSONObject jsonObject = paySuccessCountService.selectCount(time); + if(jsonObject == null){ + return 0L; + }else { + Long count = (Long) jsonObject.get("count"); + return count; + } + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/posters/web/posterController.java b/src/main/java/au/com/royalpay/payment/manage/posters/web/posterController.java index bf56f78c3..e39c1f8e1 100644 --- a/src/main/java/au/com/royalpay/payment/manage/posters/web/posterController.java +++ b/src/main/java/au/com/royalpay/payment/manage/posters/web/posterController.java @@ -22,4 +22,10 @@ public class posterController { public void updatePoster(@RequestBody JSONObject img ){ posterService.updatePoster(img.getString("imgUrl")); } + + @RequestMapping(value = "/getPosters",method = RequestMethod.GET) + public JSONObject getPosters(){ + JSONObject posters = posterService.getPoster(); + return posters; + } } diff --git a/src/main/ui/static/cms/cms.js b/src/main/ui/static/cms/cms.js index acbd8bf61..6d6f80671 100644 --- a/src/main/ui/static/cms/cms.js +++ b/src/main/ui/static/cms/cms.js @@ -3,95 +3,95 @@ */ define(['angular', 'uiRouter', 'static/commons/angular-ueditor'], function (angular) { 'use strict'; - var app = angular.module('cms', ['ui.router','ng.uditor']); + var app = angular.module('cms', ['ui.router', 'ng.uditor']); var style = [ { - "style_key":"settlement", - "style_value":"" + "style_key": "settlement", + "style_value": "" }, { - "style_key":"home_select", - "style_value":"" + "style_key": "home_select", + "style_value": "" }, { - "style_key":"activity_gray", - "style_value":"" + "style_key": "activity_gray", + "style_value": "" }, { - "style_key":"activity_select", - "style_value":"" + "style_key": "activity_select", + "style_value": "" }, { - "style_key":"mess_gray", - "style_value":"" + "style_key": "mess_gray", + "style_value": "" }, { - "style_key":"mess_select", - "style_value":"" + "style_key": "mess_select", + "style_value": "" }, { - "style_key":"my_select", - "style_value":"" + "style_key": "my_select", + "style_value": "" }, { - "style_key":"my_gray", - "style_value":"" + "style_key": "my_gray", + "style_value": "" }, { - "style_key":"transaction", - "style_value":"" + "style_key": "transaction", + "style_value": "" }, { //customers report - "style_key":"statistics", - "style_value":"" + "style_key": "statistics", + "style_value": "" }, { //Account - "style_key":"marketing_account", - "style_value":"" + "style_key": "marketing_account", + "style_value": "" }, { //Customer outline - "style_key":"usergroup", - "style_value":"" + "style_key": "usergroup", + "style_value": "" }, { //Compliance check - "style_key":"coupon", - "style_value":"" + "style_key": "coupon", + "style_value": "" }, { - "style_key":"rpbill", - "style_value":"" + "style_key": "rpbill", + "style_value": "" }, { - "style_key":"invoice_assistant", - "style_value":"" + "style_key": "invoice_assistant", + "style_value": "" }, { - "style_key":"home_gray", - "style_value":"" + "style_key": "home_gray", + "style_value": "" }, { - "style_key":"balance", - "style_value":"" + "style_key": "balance", + "style_value": "" }, { - "style_key":"pro_collection", - "style_value":"" + "style_key": "pro_collection", + "style_value": "" }, { - "style_key":"pro_tralogs", - "style_value":"" + "style_key": "pro_tralogs", + "style_value": "" }, { - "style_key":"pro_qrcode", - "style_value":"" + "style_key": "pro_qrcode", + "style_value": "" }, { - "style_key":"pro_coupon", - "style_value":"" + "style_key": "pro_coupon", + "style_value": "" }]; app.config(['$stateProvider', function ($stateProvider) { $stateProvider.state('cms', { @@ -128,11 +128,11 @@ define(['angular', 'uiRouter', 'static/commons/angular-ueditor'], function (angu url: '/phone_top_up', controller: 'CmsPhonetopupCtrl', templateUrl: '/static/cms/templates/phone_top_up.html', - }).state('cms.app_style',{ + }).state('cms.app_style', { url: '/app_style', controller: 'cmsAppStyleListCtrl', templateUrl: '/static/cms/templates/app_style.html', - }).state('cms.app_style.app_style_preview',{ + }).state('cms.app_style.app_style_preview', { url: '/{style_id}/preview', controller: 'cmsAppStylePreviewCtrl', templateUrl: '/static/cms/templates/app_style_preview.html', @@ -141,7 +141,7 @@ define(['angular', 'uiRouter', 'static/commons/angular-ueditor'], function (angu return $http.get('/app/cms/app_style/style_group/' + $stateParams.style_id); }] } - }).state('cms.app_style.app_style_save',{ + }).state('cms.app_style.app_style_save', { url: '/save', controller: 'cmsAppStyleSaveCtrl', templateUrl: '/static/cms/templates/app_style_config.html', @@ -150,7 +150,7 @@ define(['angular', 'uiRouter', 'static/commons/angular-ueditor'], function (angu return angular.copy(style); } } - }).state('cms.app_style.app_style_edit',{ + }).state('cms.app_style.app_style_edit', { url: '/{style_id}/edit', controller: 'cmsAppStyleEditCtrl', templateUrl: '/static/cms/templates/app_style_config.html', @@ -162,8 +162,33 @@ define(['angular', 'uiRouter', 'static/commons/angular-ueditor'], function (angu return angular.copy(style); } } + }).state('cms.statistics_of_clicks', { + url: '/statistics/clicks', + controller:'cmsStatisticsClickCtrl', + templateUrl:'/static/cms/templates/statistics_of_clicks.html', }) }]); + app.controller('cmsStatisticsClickCtrl', ['$scope', '$http','$filter', function ($scope,$http,$filter) { + $scope.params = {status: 'PAID', channel :'ALL' ,textType: 'all', datefrom: new Date(), dateto: new Date()}; + $scope.count = 0; + $scope.loadTradeLogs = function () { + var params = angular.copy($scope.params); + if (params.datefrom) { + params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd'); + } + $http.get('/statistics/click/paySuccess_count/' + $scope.params.datefrom).then(function (resp) { + $scope.count = resp.data; + }) + }; + + $scope.viewAdvertisements = function () { + $scope.posters = {}; + $http.get('/app/poster/getPosters').then(function (resp) { + $scope.posters = resp.data.posters + }) + } + return app; + }]); app.controller('cmsRootCtrl', ['$scope', function ($scope) { }]); @@ -172,10 +197,10 @@ define(['angular', 'uiRouter', 'static/commons/angular-ueditor'], function (angu $scope.pagination = {}; $scope.topUp = function () { var params = angular.copy($scope.params); - if(params.type==null || params.type==''||params.amount==null||params.amount==''||params.customerNumber==''||params.customerNumber==null ){ + if (params.type == null || params.type == '' || params.amount == null || params.amount == '' || params.customerNumber == '' || params.customerNumber == null) { return; } - $http.get('/top_up/recharge',{params: params}).then(function (resp) { + $http.get('/top_up/recharge', {params: params}).then(function (resp) { alert('ok'); }, function (resp) { alert(resp.data.message); @@ -183,21 +208,21 @@ define(['angular', 'uiRouter', 'static/commons/angular-ueditor'], function (angu } $scope.listTopUpOrders = function (page) { - var params = angular.copy($scope.queryParams); + var params = angular.copy($scope.queryParams); params.page = page || $scope.pagination.page || 1; - if(params.amount==''|| params.amount==null){ + if (params.amount == '' || params.amount == null) { delete params.amount; } - if(params.phone==''|| params.phone==null){ + if (params.phone == '' || params.phone == null) { delete params.phone; } - if(params.status==''|| params.status==null){ + if (params.status == '' || params.status == null) { delete params.status; } - if(params.type==''|| params.type==null){ + if (params.type == '' || params.type == null) { delete params.type; } - $http.get('/top_up/list',{params: params}).then(function (resp) { + $http.get('/top_up/list', {params: params}).then(function (resp) { $scope.orders = resp.data.data; $scope.pagination = resp.data.pagination; }) @@ -232,7 +257,7 @@ define(['angular', 'uiRouter', 'static/commons/angular-ueditor'], function (angu app.controller('cmsAddArticleCtrl', ['$scope', '$http', '$state', '$stateParams', 'commonDialog', function ($scope, $http, $state, $stateParams, commonDialog) { $scope.saveArticle = function () { - $scope.article.reference =$scope.reference; + $scope.article.reference = $scope.reference; $http.post('/app/cms/categories/' + $stateParams.catId + '/articles', $scope.article).then(function (resp) { $state.go('^.article_view', {articleId: resp.data.article_id}); }, function (resp) { @@ -245,12 +270,12 @@ define(['angular', 'uiRouter', 'static/commons/angular-ueditor'], function (angu $scope.article = article.data; if ($scope.article.reference) { $scope.reference = JSON.parse($scope.article.reference); - }else { + } else { $scope.reference = {}; } $scope.saveArticle = function () { - $scope.article.reference =$scope.reference; + $scope.article.reference = $scope.reference; $http.put('/app/cms/categories/' + $stateParams.catId + '/articles/' + $stateParams.articleId, $scope.article).then(function (resp) { $state.go('^.article_view', {articleId: $stateParams.articleId}); }, function (resp) { @@ -280,68 +305,68 @@ define(['angular', 'uiRouter', 'static/commons/angular-ueditor'], function (angu $scope.appStyles = appStyles.data.data; }]); - app.controller('cmsAppStyleEditCtrl', ['$scope', '$http', '$state','commonDialog', 'appStyles', 'style', function ($scope, $http, $state, commonDialog, appStyles, style) { + app.controller('cmsAppStyleEditCtrl', ['$scope', '$http', '$state', 'commonDialog', 'appStyles', 'style', function ($scope, $http, $state, commonDialog, appStyles, style) { $scope.ctrl = {sending: false, flag: false, originStyleId: angular.copy(appStyles.data.data[0].style_id)}; - $scope.entity={}; + $scope.entity = {}; $scope.style = angular.copy(style); $scope.entity.appStyle = angular.copy(appStyles.data.data); $scope.params = {style_id: angular.copy(appStyles.data.data[0].style_id)}; - $scope.appStyleList = function() { + $scope.appStyleList = function () { var styleKeyStr = ""; - $scope.entity.appStyle.forEach(function(item){ + $scope.entity.appStyle.forEach(function (item) { styleKeyStr += item.style_key + ","; }); - $scope.style.forEach(function(item){ + $scope.style.forEach(function (item) { if (styleKeyStr.indexOf(item.style_key) < 0) { - $scope.entity.appStyle.push({"style_key": item.style_key,"style_value":""}); + $scope.entity.appStyle.push({"style_key": item.style_key, "style_value": ""}); } }) }; $scope.appStyleList(); - $scope.addSpecOption = function() { + $scope.addSpecOption = function () { $scope.entity.appStyle.push({}); }; // 删除规格选项 - $scope.delSpecOption = function(index) { + $scope.delSpecOption = function (index) { $scope.entity.appStyle.splice(index, 1); }; - $scope.saveOneGroupAppStyle = function() { + $scope.saveOneGroupAppStyle = function () { if ($scope.params.style_id == "" || $scope.params.style_id == null) { $scope.errmsg = "title不能为空"; return; } var item = ""; - for (var i=0;i<$scope.entity.appStyle.length;i++) { + for (var i = 0; i < $scope.entity.appStyle.length; i++) { item = $scope.entity.appStyle[i]; if (item.style_value == "" || item.style_value == null) { $scope.errmsg = "value不能为空"; return; } - if (item.style_value.substr(0,4).toLowerCase() != "http" && - item.style_value.substr(0,5).toLowerCase() != "https") { + if (item.style_value.substr(0, 4).toLowerCase() != "http" && + item.style_value.substr(0, 5).toLowerCase() != "https") { $scope.errmsg = "value必须以http或者https开头"; return; } } $scope.ctrl.sending = true; - $http.put('/app/cms/app_style/style_group/' + $scope.params.style_id + '/style?originStyleId=' + $scope.ctrl.originStyleId, $scope.entity).then(function(){ + $http.put('/app/cms/app_style/style_group/' + $scope.params.style_id + '/style?originStyleId=' + $scope.ctrl.originStyleId, $scope.entity).then(function () { $scope.ctrl.sending = false; - $state.go('cms.app_style.app_style_preview',{style_id: $scope.params.style_id}); + $state.go('cms.app_style.app_style_preview', {style_id: $scope.params.style_id}); }, function (resp) { $scope.ctrl.sending = false; $scope.errmsg = resp.data.message; }) } - $scope.toggleAppStyleIsValid = function(styleId) { + $scope.toggleAppStyleIsValid = function (styleId) { if (styleId) { commonDialog.confirm({ title: '确认操作', - content: '当前操作将发布title为:' +styleId +"的app图标,是否确认?" + content: '当前操作将发布title为:' + styleId + "的app图标,是否确认?" }).then(function () { $http.put('/app/cms/app_style/style_group/' + styleId).then(function () { $state.reload(); @@ -352,42 +377,42 @@ define(['angular', 'uiRouter', 'static/commons/angular-ueditor'], function (angu }]); app.controller('cmsAppStyleSaveCtrl', ['$scope', '$http', '$state', 'style', function ($scope, $http, $state, style) { $scope.ctrl = {sending: false, flag: true}; - $scope.entity={}; + $scope.entity = {}; $scope.entity.appStyle = angular.copy(style); $scope.params = {style_id: ""}; - $scope.addSpecOption = function() { + $scope.addSpecOption = function () { $scope.entity.appStyle.push({}); }; // 删除规格选项 - $scope.delSpecOption = function(index) { + $scope.delSpecOption = function (index) { console.log(index) $scope.entity.appStyle.splice(index, 1); }; - $scope.saveOneGroupAppStyle = function() { + $scope.saveOneGroupAppStyle = function () { if ($scope.params.style_id == "" || $scope.params.style_id == null) { $scope.errmsg = "title不能为空"; return; } var item = ""; - for (var i=0;i<$scope.entity.appStyle.length;i++) { + for (var i = 0; i < $scope.entity.appStyle.length; i++) { item = $scope.entity.appStyle[i]; if (item.style_value == "" || item.style_value == null) { $scope.errmsg = "value不能为空"; return; } - if (item.style_value.substr(0,4).toLowerCase() != "http" && - item.style_value.substr(0,5).toLowerCase() != "https") { + if (item.style_value.substr(0, 4).toLowerCase() != "http" && + item.style_value.substr(0, 5).toLowerCase() != "https") { $scope.errmsg = "value必须以http或者https开头"; return; } } $scope.ctrl.sending = true; - $http.post('/app/cms/app_style/style_group?style_id=' + $scope.params.style_id, $scope.entity).then(function(){ + $http.post('/app/cms/app_style/style_group?style_id=' + $scope.params.style_id, $scope.entity).then(function () { $scope.ctrl.sending = false; $state.go('cms.app_style.app_style_preview', {style_id: $scope.params.style_id}); }, function (resp) { diff --git a/src/main/ui/static/cms/templates/cms_root.html b/src/main/ui/static/cms/templates/cms_root.html index 006648e7a..d595c79fc 100644 --- a/src/main/ui/static/cms/templates/cms_root.html +++ b/src/main/ui/static/cms/templates/cms_root.html @@ -35,6 +35,9 @@ + diff --git a/src/main/ui/static/cms/templates/statistics_of_clicks.html b/src/main/ui/static/cms/templates/statistics_of_clicks.html new file mode 100644 index 000000000..f3a048b3b --- /dev/null +++ b/src/main/ui/static/cms/templates/statistics_of_clicks.html @@ -0,0 +1,90 @@ +
+
+

广告点击统计

+ +
+
+
+

支付成功页面开启次数统计

+
+
+ +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+

支付成功页面开启次数:{{count}}

+
+ + + + + + + + +
+
+ + + + + + + + + + + + + + + + + +
CountPicture AddressPicture NameLink
+
+
+
+
+
\ No newline at end of file