commit
9b7e268788
@ -0,0 +1,33 @@
|
||||
package au.com.royalpay.payment.manage.actchairty.beans;
|
||||
|
||||
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import org.apache.commons.lang3.time.DateUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created by yangluo on 2018/7/9.
|
||||
*/
|
||||
public class ActChairtyBean {
|
||||
@JSONField(name = "date")
|
||||
private String date;
|
||||
|
||||
public String getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(String date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public java.util.Date toDate() {
|
||||
try {
|
||||
return DateUtils.parseDate(date, new String[]{"yyyy-MM-dd"});
|
||||
} catch (ParseException e) {
|
||||
throw new BadRequestException("Invalid To Date");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package au.com.royalpay.payment.manage.actchairty.beans;
|
||||
|
||||
import au.com.royalpay.payment.core.exceptions.ParamInvalidException;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.lang3.time.DateUtils;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* redpack query
|
||||
* Created by davep on 2016-08-03.
|
||||
*/
|
||||
public class ActChairtyQuery {
|
||||
private static final String[] DATE_PATTERNS = {"yyyyMMdd", "yyyy-MM-dd"};
|
||||
private String begin;
|
||||
private String end;
|
||||
private int page = 1;
|
||||
private int limit = 20;
|
||||
|
||||
public JSONObject params() {
|
||||
JSONObject param = new JSONObject();
|
||||
if (begin != null) {
|
||||
try {
|
||||
Date fromDate = DateUtils.parseDate(begin, DATE_PATTERNS);
|
||||
param.put("begin", fromDate);
|
||||
} catch (ParseException e) {
|
||||
throw new ParamInvalidException("begin", "error.payment.valid.invalid_date_format");
|
||||
}
|
||||
}
|
||||
if (end != null) {
|
||||
try {
|
||||
Date fromDate = DateUtils.addDays(DateUtils.parseDate(end, DATE_PATTERNS), 1);
|
||||
param.put("end", fromDate);
|
||||
} catch (ParseException e) {
|
||||
throw new ParamInvalidException("end", "error.payment.valid.invalid_date_format");
|
||||
}
|
||||
}
|
||||
param.put("page",page);
|
||||
param.put("limit",limit);
|
||||
return param;
|
||||
}
|
||||
|
||||
public String getBegin() {
|
||||
return begin;
|
||||
}
|
||||
|
||||
public void setBegin(String begin) {
|
||||
this.begin = begin;
|
||||
}
|
||||
|
||||
public String getEnd() {
|
||||
return end;
|
||||
}
|
||||
|
||||
public void setEnd(String end) {
|
||||
this.end = end;
|
||||
}
|
||||
|
||||
public int getPage() {
|
||||
return page;
|
||||
}
|
||||
|
||||
public void setPage(int page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
public int getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
public void setLimit(int limit) {
|
||||
this.limit = limit;
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package au.com.royalpay.payment.manage.actchairty.core;
|
||||
|
||||
|
||||
import au.com.royalpay.payment.manage.actchairty.beans.ActChairtyBean;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.miemiedev.mybatis.paginator.domain.PageList;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by yangluo on 2018/7/9.
|
||||
*/
|
||||
|
||||
public interface ActChairtyService {
|
||||
|
||||
void configClient(String clientMoniker, ActChairtyBean config, JSONObject manager);
|
||||
|
||||
JSONObject listChairClients(int page, int limit);
|
||||
|
||||
void disableClient(String clientMoniker);
|
||||
|
||||
List<JSONObject> getWeekendAnalysis(JSONObject params);
|
||||
|
||||
PageList<JSONObject> getClientRank(JSONObject params);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
package au.com.royalpay.payment.manage.actchairty.core.impls;
|
||||
|
||||
import au.com.royalpay.payment.core.exceptions.InvalidShortIdException;
|
||||
import au.com.royalpay.payment.manage.actchairty.beans.ActChairtyBean;
|
||||
import au.com.royalpay.payment.manage.actchairty.core.ActChairtyService;
|
||||
import au.com.royalpay.payment.manage.mappers.act.ActChairtyMapper;
|
||||
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
|
||||
import au.com.royalpay.payment.tools.utils.PageListUtils;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
|
||||
import com.github.miemiedev.mybatis.paginator.domain.PageList;
|
||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by yangluo on 2018/7/9.
|
||||
*/
|
||||
@Service
|
||||
public class ActChairtyServiceImp implements ActChairtyService {
|
||||
|
||||
@Resource
|
||||
private ClientManager clientManager;
|
||||
@Resource
|
||||
private ActChairtyMapper actChairtyMapper;
|
||||
@Override
|
||||
public void configClient(String clientMoniker, ActChairtyBean config, JSONObject manager) {
|
||||
JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker);
|
||||
if (client == null) {
|
||||
throw new InvalidShortIdException();
|
||||
}
|
||||
JSONObject findChairty = actChairtyMapper.findChairtyClient(clientMoniker);
|
||||
if (findChairty == null) {
|
||||
JSONObject chairtyClient = new JSONObject();
|
||||
chairtyClient.put("client_id", client.get("client_id"));
|
||||
chairtyClient.put("client_moniker", clientMoniker);
|
||||
chairtyClient.put("active_time", config.toDate());
|
||||
actChairtyMapper.save(chairtyClient);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject listChairClients(int page, int limit) {
|
||||
PageList<JSONObject> clients = actChairtyMapper.chairtyClientNum(new PageBounds(page, limit));
|
||||
for (JSONObject client : clients){
|
||||
client.put("client_moniker", client.getString("client_moniker"));
|
||||
client.put("active_time", DateFormatUtils.format(client.getDate("active_time"), "yyyy/MM/dd"));
|
||||
BigDecimal bg = new BigDecimal(client.getIntValue("count_ordernum") * 0.01);
|
||||
double f1 = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
client.put("chairty_num", f1);
|
||||
}
|
||||
return PageListUtils.buildPageListResult(clients);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableClient(String clientMoniker) {
|
||||
actChairtyMapper.disableClient(clientMoniker);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<JSONObject> getWeekendAnalysis(JSONObject params) {
|
||||
List<JSONObject> result = new ArrayList<>();
|
||||
List<JSONObject> getWeekstartanalysis = actChairtyMapper.getChairtyWeekstartAnalysis(params.getDate("begin"), params.getDate("end"));
|
||||
for (JSONObject getWeekendAnalysis : getWeekstartanalysis) {
|
||||
Calendar rightNow = Calendar.getInstance();
|
||||
rightNow.setTime(getWeekendAnalysis.getDate("weekstart"));
|
||||
rightNow.add(Calendar.DAY_OF_YEAR,7);
|
||||
Date dt1=rightNow.getTime();
|
||||
JSONObject getAnalysis = actChairtyMapper.getChairtyWeekAnalysis(getWeekendAnalysis.getDate("weekstart"), dt1);
|
||||
getWeekendAnalysis.put("count_ordernum", getAnalysis.getIntValue("count_ordernum"));
|
||||
getWeekendAnalysis.put("sum_ordernum", getAnalysis.getBigDecimal("sum_ordernum"));
|
||||
BigDecimal bg = new BigDecimal(getAnalysis.getIntValue("count_ordernum") * 0.01);
|
||||
double f1 = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
getWeekendAnalysis.put("chairty_amount", f1);
|
||||
result.add(getWeekendAnalysis);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageList<JSONObject> getClientRank(JSONObject params) {
|
||||
PageList<JSONObject> getChairtyWeekRaking = actChairtyMapper.getChairtyWeekRaking(params.getDate("begin"), params.getDate("end"),new PageBounds(params.getIntValue("page"), params.getIntValue("limit")));
|
||||
return getChairtyWeekRaking;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,62 @@
|
||||
package au.com.royalpay.payment.manage.actchairty.web;
|
||||
|
||||
import au.com.royalpay.payment.manage.actchairty.beans.ActChairtyBean;
|
||||
import au.com.royalpay.payment.manage.actchairty.beans.ActChairtyQuery;
|
||||
import au.com.royalpay.payment.manage.actchairty.core.ActChairtyService;
|
||||
import au.com.royalpay.payment.manage.cashback.core.CashbackService;
|
||||
import au.com.royalpay.payment.manage.management.clearing.core.SettleDelayConfigurer;
|
||||
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
|
||||
import au.com.royalpay.payment.tools.CommonConsts;
|
||||
import au.com.royalpay.payment.tools.http.HttpUtils;
|
||||
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
|
||||
import au.com.royalpay.payment.tools.utils.PageListUtils;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.miemiedev.mybatis.paginator.domain.PageList;
|
||||
import org.springframework.validation.Errors;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by yangluo on 2018/7/9.
|
||||
*/
|
||||
|
||||
@RequestMapping(value = "/actchairty")
|
||||
@RestController
|
||||
public class ActChairtyController {
|
||||
@Resource
|
||||
private ActChairtyService actChairtyService;
|
||||
|
||||
@ManagerMapping(value = "/clients", method = RequestMethod.GET, role = { ManagerRole.ADMIN })
|
||||
public JSONObject listAttendingClients(@RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = "10") int limit) {
|
||||
// todo params
|
||||
return actChairtyService.listChairClients(page, limit);
|
||||
}
|
||||
|
||||
@ManagerMapping(value = "/clients/{clientMoniker}", method = RequestMethod.PUT, role = { ManagerRole.ADMIN })
|
||||
public void configClient(@PathVariable String clientMoniker, @RequestBody @Valid ActChairtyBean config, Errors errors,
|
||||
@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
|
||||
HttpUtils.handleValidErrors(errors);
|
||||
actChairtyService.configClient(clientMoniker, config, manager);
|
||||
}
|
||||
|
||||
@ManagerMapping(value = "/clients/{clientMoniker}", method = RequestMethod.DELETE, role = { ManagerRole.ADMIN })
|
||||
public void disableClient(@PathVariable String clientMoniker) {
|
||||
actChairtyService.disableClient(clientMoniker);
|
||||
}
|
||||
|
||||
@ManagerMapping(value = "/traAnalysis", method = RequestMethod.GET, role = { ManagerRole.ADMIN })
|
||||
public List<JSONObject> traAnalysis(ActChairtyQuery params) {
|
||||
return actChairtyService.getWeekendAnalysis(params.params());
|
||||
}
|
||||
@ManagerMapping(value = "/ranking", method = RequestMethod.GET, role = { ManagerRole.ADMIN })
|
||||
public JSONObject getRanking(ActChairtyQuery params) {
|
||||
PageList<JSONObject> clientRank = actChairtyService.getClientRank(params.params());
|
||||
if(clientRank==null){
|
||||
return null;
|
||||
}
|
||||
return PageListUtils.buildPageListResult(clientRank);
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package au.com.royalpay.payment.manage.mappers.act;
|
||||
|
||||
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 com.github.miemiedev.mybatis.paginator.domain.PageBounds;
|
||||
import com.github.miemiedev.mybatis.paginator.domain.PageList;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by yangluo on 2018/7/9.
|
||||
*/
|
||||
@AutoMapper(tablename = "act_charity", pkName = "client_moniker")
|
||||
public interface ActChairtyMapper {
|
||||
|
||||
@AutoSql(type = SqlType.SELECT)
|
||||
JSONObject findChairtyClient(@Param("client_moniker") String clientMoniker);
|
||||
|
||||
@AutoSql(type = SqlType.INSERT)
|
||||
void save(JSONObject chairtyClient);
|
||||
|
||||
@AutoSql(type = SqlType.DELETE)
|
||||
void disableClient(@Param("client_moniker") String clientMoniker);
|
||||
|
||||
PageList<JSONObject> chairtyClientNum(PageBounds pageBounds);
|
||||
|
||||
List<JSONObject> getChairtyWeekstartAnalysis(@Param("begin") Date begin, @Param("end") Date end);
|
||||
|
||||
JSONObject getChairtyWeekAnalysis(@Param("begin") Date begin, @Param("end") Date end);
|
||||
|
||||
PageList<JSONObject> getChairtyWeekRaking(@Param("begin") Date begin, @Param("end") Date end,PageBounds pageBounds);
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="au.com.royalpay.payment.manage.mappers.act.ActChairtyMapper">
|
||||
<select id="chairtyClientNum" resultType="com.alibaba.fastjson.JSONObject">
|
||||
select client_moniker,active_time,IFNULL(count(org_id),0) as count_ordernum,ifnull(sum(pmt_transactions.transaction_amount),0) as sum_ordernum
|
||||
from act_charity
|
||||
left JOIN pmt_transactions on act_charity.client_id = pmt_transactions.client_id
|
||||
and pmt_transactions.transaction_type='Credit' and pmt_transactions.transaction_time>=act_charity.active_time
|
||||
|
||||
GROUP BY act_charity.client_id order by sum_ordernum desc
|
||||
</select>
|
||||
<!--
|
||||
<select id="getChairtyWeekAnalysis" resultType="com.alibaba.fastjson.JSONObject">
|
||||
select weekofyear(DATE_FORMAT(transaction_time,'%Y-%m-%d'))-weekofyear(DATE_FORMAT(transaction_time,'%Y-%m-%d')-interval day(DATE_FORMAT(transaction_time,'%Y-%m-%d'))-1 day)+1 as weekon,IFNULL(count(org_id),0) as count_ordernum,ifnull(sum(pmt_transactions.transaction_amount),0) as sum_ordernum
|
||||
from act_charity
|
||||
inner JOIN pmt_transactions on act_charity.client_id = pmt_transactions.client_id
|
||||
and pmt_transactions.transaction_type='Credit'
|
||||
and pmt_transactions.transaction_time>=#{begin}
|
||||
and pmt_transactions.transaction_time<=#{end}
|
||||
group by weekon order by weekon asc;
|
||||
</select>-->
|
||||
|
||||
<select id="getChairtyWeekstartAnalysis" resultType="com.alibaba.fastjson.JSONObject">
|
||||
select DATE_FORMAT(pmt_transactions.transaction_time,'%Y-%m-%d') as weekstart from act_charity
|
||||
inner JOIN pmt_transactions on act_charity.client_id = pmt_transactions.client_id
|
||||
where dayofweek(pmt_transactions.transaction_time)=2 and pmt_transactions.transaction_time>=#{begin} and pmt_transactions.transaction_time<=#{end}
|
||||
group by weekstart order by weekstart asc;
|
||||
</select>
|
||||
<select id="getChairtyWeekAnalysis" resultType="com.alibaba.fastjson.JSONObject">
|
||||
select count(pmt_transactions.org_id) as count_ordernum,ifnull(sum(pmt_transactions.transaction_amount),0) as sum_ordernum from act_charity left JOIN pmt_transactions ON act_charity.client_id = pmt_transactions.client_id
|
||||
and pmt_transactions.transaction_type='Credit' and pmt_transactions.transaction_time>=#{begin} and pmt_transactions.transaction_time<=#{end}
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getChairtyWeekRaking" resultType="com.alibaba.fastjson.JSONObject">
|
||||
select act_charity.client_moniker,((count(pmt_transactions.org_id)) * 0.01) as chair_ordernum,ifnull(sum(pmt_transactions.transaction_amount),0) as sum_ordernum from act_charity left JOIN pmt_transactions ON act_charity.client_id = pmt_transactions.client_id
|
||||
and pmt_transactions.transaction_type='Credit' and pmt_transactions.transaction_time>=#{begin} and pmt_transactions.transaction_time<=#{end}
|
||||
GROUP BY act_charity.client_moniker order by sum_ordernum desc
|
||||
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,216 @@
|
||||
define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts'], function (angular) {
|
||||
'use strict';
|
||||
var colors = ['#00c0ef', '#00a65a', '#ff851b'];
|
||||
var app = angular.module('actChairty', ['ui.bootstrap', 'ui.router', 'ngEcharts']);
|
||||
var total;
|
||||
|
||||
app.config(['$stateProvider', function ($stateProvider) {
|
||||
$stateProvider.state('act_chairty', {
|
||||
url: '/act_chairty',
|
||||
templateUrl: '/static/actchairty/templates/act_chairty_merchants.html',
|
||||
controller: 'actChairtyConfDialogCtrl'
|
||||
}).state('act_chairty.analysis',{
|
||||
url:'/act_chairty/analysis',
|
||||
templateUrl: '/static/actchairty/templates/act_chairty_analysis.html',
|
||||
controller: 'actChairtyAnalysisConfDialogCtrl'
|
||||
})
|
||||
}]);
|
||||
app.controller('actChairtyConfDialogCtrl', ['$scope', '$http', '$filter', function ($scope, $http, $filter) {
|
||||
$scope.pagination = {};
|
||||
$scope.today = new Date();
|
||||
$scope.loadClients = function (page) {
|
||||
var params = {page: page || $scope.pagination.page || 1};
|
||||
$http.get('/actchairty/clients', {params: params}).then(function (resp) {
|
||||
$scope.clients = resp.data.data;
|
||||
$scope.pagination = resp.data.pagination;
|
||||
})
|
||||
};
|
||||
$scope.loadClients();
|
||||
$scope.new_conf = {};
|
||||
$scope.ctrl = {dateInput: false};
|
||||
$scope.disableClient = function (client) {
|
||||
$http.delete('/actchairty/clients/' + client.client_moniker).then(function () {
|
||||
$scope.loadClients();
|
||||
});
|
||||
};
|
||||
$scope.submitClient = function () {
|
||||
$scope.errmsg = null;
|
||||
var conf = {
|
||||
date: $filter('date')($scope.new_conf.date, 'yyyy-MM-dd'),
|
||||
};
|
||||
$http.put('/actchairty/clients/' + $scope.new_conf.client_moniker, conf).then(function () {
|
||||
$scope.new_conf = {};
|
||||
$scope.loadClients();
|
||||
}, function (resp) {
|
||||
$scope.errmsg = resp.data.message;
|
||||
});
|
||||
};
|
||||
}]);
|
||||
|
||||
app.controller('actChairtyAnalysisConfDialogCtrl', ['$scope', '$http', '$filter', function ($scope, $http, $filter) {
|
||||
$scope.params = {};
|
||||
$scope.today = new Date();
|
||||
$scope.params.end = new Date();
|
||||
var date = new Date();
|
||||
date.setDate(date.getDate()-30);
|
||||
$scope.params.begin = date;
|
||||
$scope.thisMonth = function () {
|
||||
$scope.params.end = new Date();
|
||||
var monthBegin = new Date();
|
||||
monthBegin.setDate(1);
|
||||
$scope.params.begin = monthBegin;
|
||||
$scope.doAnalysis(1);
|
||||
};
|
||||
$scope.lastMonth = function () {
|
||||
var monthFinish = new Date();
|
||||
monthFinish.setDate(0);
|
||||
$scope.params.end = monthFinish;
|
||||
var monthBegin = new Date();
|
||||
monthBegin.setDate(0);
|
||||
monthBegin.setDate(1);
|
||||
$scope.params.begin = monthBegin;
|
||||
$scope.doAnalysis(1);
|
||||
};
|
||||
|
||||
$scope.doPartnerTotalRanking = function (page) {
|
||||
var params = {};
|
||||
params.page = page||$scope.total_ranking_pagination.page || 1;
|
||||
params.limit = 10;
|
||||
|
||||
$http.get('/actchairty/clients', {params: params}).then(function (resp) {
|
||||
$scope.chairtyPartnersRanking = resp.data.data;
|
||||
$scope.total_ranking_pagination = resp.data.pagination;
|
||||
var amount = 0;
|
||||
var chairty = 0;
|
||||
angular.forEach(resp.data.data, function (data) {
|
||||
amount += parseFloat(data.sum_ordernum);
|
||||
chairty += parseFloat(data.chairty_num)
|
||||
return amount,chairty;
|
||||
});
|
||||
$scope.totalAmount = amount;
|
||||
$scope.totalChairty = Math.round(chairty*100)/100; ;
|
||||
})
|
||||
};
|
||||
|
||||
|
||||
|
||||
$scope.getTotalCashBack = function () {
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
$scope.getClientsCashbackRankingByDate = function (date,page) {
|
||||
$scope.event_date = date;
|
||||
var params = {};
|
||||
params.begin = date;
|
||||
var event_date_format=date.replace(/^(\d{4})(\d{2})(\d{2})$/, "$1-$2-$3")
|
||||
var endDate = new Date(event_date_format);
|
||||
endDate.setDate(endDate.getDate()+6);
|
||||
params.end =$filter('date')(endDate,'yyyyMMdd');
|
||||
params.page = page||$scope.day_ranking_pagination.page || 1;
|
||||
params.limit = 10;
|
||||
if ($scope.params.cashback_type){
|
||||
params.cashback_type = angular.copy($scope.params.cashback_type);
|
||||
}
|
||||
$http.get('/actchairty/ranking', {params: params}).then(function (resp) {
|
||||
$scope.cashbackPartnersRankingByDate = resp.data.data;
|
||||
if(resp.data.data != null){
|
||||
|
||||
}
|
||||
$scope.day_ranking_pagination = resp.data.pagination;
|
||||
});
|
||||
};
|
||||
$scope.doAnalysis = function () {
|
||||
var params = angular.copy($scope.params);
|
||||
if (params.begin) {
|
||||
params.begin = $filter('date')(params.begin, 'yyyyMMdd');
|
||||
} else {
|
||||
params.begin = $filter('date')(new Date(), 'yyyyMMdd');
|
||||
}
|
||||
if (params.end) {
|
||||
params.end = $filter('date')(params.end, 'yyyyMMdd');
|
||||
} else {
|
||||
params.end = $filter('date')(new Date(), 'yyyyMMdd');
|
||||
}
|
||||
$http.get('/actchairty/traAnalysis', {params: params}).then(function (resp) {
|
||||
$scope.cashbackDaily = angular.copy(resp.data);
|
||||
var dates = [];
|
||||
var count_ordernum = [];
|
||||
var sum_ordernum = [];
|
||||
var chairty_amount = [];
|
||||
resp.data.forEach(function (e) {
|
||||
dates.push(e.weekstart);
|
||||
chairty_amount.push(e.chairty_amount);
|
||||
count_ordernum.push(e.count_ordernum);
|
||||
sum_ordernum.push(e.sum_ordernum);
|
||||
});
|
||||
var cashbackHistoryConfig = function (dates,sum_ordernum, count_ordernum, chairty_amount) {
|
||||
return {
|
||||
color: colors,
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: { // 坐标轴指示器,坐标轴触发有效
|
||||
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
data: ['周一交易额', '交易量','公益额']
|
||||
},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '4%',
|
||||
bottom: '3%',
|
||||
containLabel: true
|
||||
},
|
||||
xAxis: [
|
||||
{
|
||||
type: 'category',
|
||||
data: dates
|
||||
}
|
||||
],
|
||||
yAxis: [
|
||||
{
|
||||
type: 'value',
|
||||
name: 'Amount(AUD)'
|
||||
}
|
||||
],
|
||||
series: [{
|
||||
name: '周一交易额',
|
||||
type: 'bar',
|
||||
data: sum_ordernum
|
||||
}, {
|
||||
name: '交易量',
|
||||
type: 'bar',
|
||||
data: count_ordernum
|
||||
}, {
|
||||
name: '公益额',
|
||||
type: 'bar',
|
||||
data: chairty_amount
|
||||
}
|
||||
]
|
||||
};
|
||||
};
|
||||
$scope.settleDelayHistory = cashbackHistoryConfig(dates,sum_ordernum, count_ordernum, chairty_amount);
|
||||
});
|
||||
$scope.doPartnerTotalRanking(1);
|
||||
};
|
||||
$scope.doAnalysis(1);
|
||||
$scope.getTotalCashBack(1);
|
||||
$scope.settleDelayEchart = function (chart) {
|
||||
chart.on('click', function (params) {
|
||||
$scope.cashBack_total_daily = $scope.cashbackDaily[params.dataIndex].chairty_amount;
|
||||
var event_date = $scope.cashbackDaily[params.dataIndex].weekstart;
|
||||
|
||||
if (event_date) {
|
||||
event_date+="";
|
||||
var event_date_format=event_date.replace(/^(\d{4})(\d{2})(\d{2})$/, "$1-$2-$3")
|
||||
var date = new Date(event_date_format);
|
||||
$scope.getClientsCashbackRankingByDate($filter('date')(date,'yyyyMMdd'),1);
|
||||
}
|
||||
})
|
||||
};
|
||||
}]);
|
||||
return app;
|
||||
});
|
@ -0,0 +1,138 @@
|
||||
<div class="box box-warning">
|
||||
<div class="box-header">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group col-xs-12 col-sm-12">
|
||||
<label class="control-label col-xs-4 col-sm-2">Date Range</label>
|
||||
<div class="col-sm-10">
|
||||
<div class="form-control-static form-inline">
|
||||
<div style="display: inline-block">
|
||||
<input class="form-control" id="date-from-input"
|
||||
ng-model="params.begin"
|
||||
uib-datepicker-popup size="10" placeholder="From"
|
||||
is-open="dateBegin.open" ng-click="dateBegin.open=true"
|
||||
datepicker-options="{maxDate:params.end||today}">
|
||||
</div>
|
||||
~
|
||||
<div style="display: inline-block">
|
||||
<input class="form-control" id="date-to-input" ng-model="params.end"
|
||||
uib-datepicker-popup size="10" placeholder="To"
|
||||
is-open="dateTo.open" ng-click="dateTo.open=true"
|
||||
datepicker-options="{minDate:params.begin,maxDate:today}">
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<a role="button" class="btn btn-default btn-sm"
|
||||
ng-click="thisMonth()">This Month</a>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<a role="button" class="btn btn-default btn-sm" ng-click="lastMonth()">Last Month</a>
|
||||
</div>
|
||||
<button class="btn btn-success" type="button"
|
||||
ng-click="doAnalysis()">
|
||||
<i class="fa fa-search"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box">
|
||||
<!--<div class="box-header with-border">Trading customer quantity trends</div>-->
|
||||
<div class="box-body">
|
||||
<div class="chart col-md-12" echarts="settleDelayHistory" style="height: 300px"
|
||||
chart-setter="settleDelayEchart($chart)"
|
||||
ng-class="{nodata:redPackSendLogsHistory.nodata}"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title">Settle Delay Ranking</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div class="row cen col-sm-12">
|
||||
<div class="col-md-6">
|
||||
<p class="text-center">到目前为止交易总金额排名<span ng-if="totalAmount!=null">(总额:{{totalAmount}})</span>
|
||||
<span ng-if="totalChairty!=null">(总公益额:{{totalChairty}})</span>
|
||||
</p>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered table-hover table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Partner Name</th>
|
||||
<th>Amount</th>
|
||||
<th>订单量</th>
|
||||
<th>捐款额</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="client in chairtyPartnersRanking">
|
||||
<!--<td style="text-align: center;font-style: italic;font-size: larger"-->
|
||||
<!--ng-bind="$index+1+'.'"></td>-->
|
||||
<td ng-bind="client.client_moniker"></td>
|
||||
<td ng-bind="client.sum_ordernum"></td>
|
||||
<td ng-bind="client.count_ordernum"></td>
|
||||
<td ng-bind="client.chairty_num"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<uib-pagination ng-if="chairtyPartnersRanking.length"
|
||||
class="pagination"
|
||||
total-items="total_ranking_pagination.totalCount"
|
||||
boundary-links="true"
|
||||
ng-model="total_ranking_pagination.page"
|
||||
items-per-page="total_ranking_pagination.limit"
|
||||
max-size="10"
|
||||
ng-change="doPartnerTotalRanking()"
|
||||
previous-text="‹"
|
||||
next-text="›"
|
||||
first-text="«"
|
||||
last-text="»"></uib-pagination>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">Total Records:{{total_ranking_pagination.totalCount}};Total Pages:{{total_ranking_pagination.totalPages}}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<p class="text-center"><span style="color: red">{{event_date}}</span> 商户半边天公益活动总排名 <span
|
||||
style="font-size: smaller;color: grey">(选择上图相应的日期获取当日排名)</span><span ng-if="cashBack_total_daily!=null">当日总额:{{cashBack_total_daily}}</span></p>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered table-hover table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Partner Name</th>
|
||||
<th>Amount</th>
|
||||
<th>捐款额</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="client in cashbackPartnersRankingByDate">
|
||||
<td ng-bind="client.client_moniker"></td>
|
||||
<td ng-bind="client.sum_ordernum"></td>
|
||||
<td ng-bind="client.chair_ordernum"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<uib-pagination ng-if="chairtyPartnersRanking.length"
|
||||
class="pagination"
|
||||
total-items="day_ranking_pagination.totalCount"
|
||||
boundary-links="true"
|
||||
ng-model="day_ranking_pagination.page"
|
||||
items-per-page="day_ranking_pagination.limit"
|
||||
max-size="10"
|
||||
ng-change="getClientsCashbackRankingByDate(event_date)"
|
||||
previous-text="‹"
|
||||
next-text="›"
|
||||
first-text="«"
|
||||
last-text="»"></uib-pagination>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">Total Records:{{day_ranking_pagination.totalCount}};Total Pages:{{day_ranking_pagination.totalPages}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,93 @@
|
||||
<section class="content-header">
|
||||
<h4>半边天公益活动</h4>
|
||||
<ol class="breadcrumb">
|
||||
<li>
|
||||
<i class="fa fa-users"></i> Activity
|
||||
</li>
|
||||
<li class="active">
|
||||
Act Chairty
|
||||
</li>
|
||||
</ol>
|
||||
</section>
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="nav-tabs-custom">
|
||||
<ul class="nav nav-tabs">
|
||||
<li ui-sref-active-eq="active">
|
||||
<a ui-sref="act_chairty">Config</a>
|
||||
</li>
|
||||
<li ui-sref-active="active">
|
||||
<a ui-sref="act_chairty.analysis">Analysis</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content" ui-view>
|
||||
<div class="modal-body">
|
||||
<div class="alert alert-danger" ng-if="errmsg" ng-bind="errmsg"></div>
|
||||
<div class="form-inline">
|
||||
<div class="form-group">
|
||||
<input class="form-control" placeholder="Client Moniker" ng-model="new_conf.client_moniker">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input class="form-control" placeholder="Date" ng-model="new_conf.date"
|
||||
uib-datepicker-popup size="10" is-open="ctrl.dateInput" ng-click="ctrl.dateInput=true"
|
||||
>
|
||||
</div>
|
||||
|
||||
<button class="btn btn-success" ng-click="submitClient()">Submit</button>
|
||||
</div>
|
||||
<div class="row" ng-if="clients.length">
|
||||
<div class="col-xs-12 table-responsive">
|
||||
<table class="table table-hover table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Client Moniker</th>
|
||||
<th>Active Time</th>
|
||||
<th>订单量</th>
|
||||
<th>订单金额</th>
|
||||
<th>捐款额</th>
|
||||
<th>Operation</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="client in clients">
|
||||
<td ng-bind="client.client_moniker"></td>
|
||||
<td ng-bind="client.active_time"></td>
|
||||
<td ng-bind="client.count_orderNum"></td>
|
||||
<td ng-bind="client.sum_orderNum"></td>
|
||||
<td ng-bind="client.chairty_num"></td>
|
||||
<td>
|
||||
<a role="button" class="text-danger" ng-click="disableClient(client)"><i class="fa fa-ban"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<uib-pagination ng-if="clients.length"
|
||||
class="pagination"
|
||||
total-items="pagination.totalCount"
|
||||
boundary-links="true"
|
||||
ng-model="pagination.page"
|
||||
items-per-page="pagination.limit"
|
||||
max-size="10"
|
||||
ng-change="loadClients()"
|
||||
previous-text="‹"
|
||||
next-text="›"
|
||||
first-text="«"
|
||||
last-text="»"></uib-pagination>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in new issue