Merge branch 'develop'

# Conflicts:
#	src/main/java/au/com/royalpay/payment/manage/citypartner/core/impls/CityPartnerPrizeServiceImpl.java
#	src/main/java/au/com/royalpay/payment/manage/mappers/financial/FinancialPartnerCommissionMapper.java
master
luoyang 6 years ago
commit 9b2b7a6619

@ -35,6 +35,8 @@ public interface DashboardService {
List<JSONObject> getTradeAnalysisInDays(JSONObject params);
List<JSONObject> getClientsTradeAnalysisInDays(JSONObject params);
JSONObject getCommonAnalysis(JSONObject partner, AnalysisBean partnerAnalysisBean);
List<JSONObject> getTradeAnalysisInHours(JSONObject partner, AnalysisBean partnerAnalysisBean);

@ -288,6 +288,14 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
return customerAndOrdersStatisticsMapper.getSumCustomersAnalysis(params);
}
@Override
public List<JSONObject> getClientsTradeAnalysisInDays(JSONObject params) {
if (!params.containsKey("client_ids") && !params.containsKey("org_id")) {
params.put("client_id", 0);
}
return clientAnalysisMapper.listNewClients(params);
}
@Override
public JSONObject getCommonAnalysis(JSONObject partner, AnalysisBean partnerAnalysisBean) {
String timezone = partner.getJSONObject("client").getString("timezone");

@ -25,6 +25,9 @@ public interface ClientAnalysisMapper {
// 统计所有的商户,包括禁用的
int countClientsAll(JSONObject params);
// 统计一段时期新增的商户数
List<JSONObject> listNewClients(JSONObject params);
@AutoSql(type = SqlType.COUNT)
@AdvanceSelect(addonWhereClause = "sub_merchant_id is not null")
int countTotalPartners();

@ -107,6 +107,13 @@ public class DashboardController {
return dashboardService.getTradeAnalysisInDays(params);
}
@ManagerMapping("/new_clients")
public List<JSONObject> clientsTradeInDays(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
JSONObject params = analysis.toParams(null);
orgManager.checkOrg(manager,params);
return dashboardService.getClientsTradeAnalysisInDays(params);
}
@ManagerMapping("/partners_in_types")
public List<JSONObject> partnersInTypes(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
JSONObject params = analysis.toParams(analysis.getTimezone());

@ -1,5 +1,41 @@
package au.com.royalpay.payment.manage.citypartner.core.impls;
import java.io.IOException;
import java.io.OutputStream;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.swing.plaf.basic.BasicScrollPaneUI;
import au.com.royalpay.payment.manage.mappers.system.ClientBankAccountMapper;
import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.alibaba.fastjson.JSONObject;
import au.com.royalpay.payment.manage.citypartner.beans.AgentCommissionAnalysis;
import au.com.royalpay.payment.manage.citypartner.beans.CityPartnerCommissionAnalysis;
import au.com.royalpay.payment.manage.citypartner.beans.ReferrerCommissionAnalysis;
@ -69,6 +105,9 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
private FinancialSeniorPartnerCommissionMapper financialSeniorPartnerCommissionMapper;
@Resource
private FinancialSeniorPartnerCommissionDetailMapper financialSeniorPartnerCommissionDetailMapper;
@Resource
private MerchantInfoProvider merchantInfoProvider;
@Override
public List<JSONObject> listAvailableMonths(String year) {
@ -114,6 +153,10 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
for (JSONObject prize : partnerPrizes) {
plusKey(sum, prize, "gross_amount");
plusKey(sum, prize, "total_charge");
//暂只处理合伙人提成总额
if (prize.get("parent_org_id") == null) {
prize.put("org_charge", prize.getBigDecimal("org_charge").add(prize.getBigDecimal("share_charge")));
}
plusKey(sum, prize, "royalpay_charge");
plusKey(sum, prize, "org_charge");
prize.put("monthstr", monthStr);
@ -231,7 +274,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
sumResult.put("net_charge", netCharge);
sumResult.put("client_moniker", clientMoniker);
sumResult.put("channel_detail", entry.getValue());
sumResult.put("type", type);
sumResult.put("type",type);
partnerClientInfos.add(sumResult);
}
result.put("partner_client_infos", partnerClientInfos);
@ -255,9 +298,9 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
return result;
}
@Override
@Transactional
public void generate(String monthStr) {
public void generateold(String monthStr) {
Date mon = checkMonth(monthStr);
Calendar monthCal = Calendar.getInstance();
monthCal.setTime(mon);
@ -268,7 +311,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
BigDecimal alipayChargeRate = new BigDecimal("0.6");
BigDecimal wechatChargeRate = new BigDecimal("0.6");
BigDecimal jdChargeRate = new BigDecimal("0.9");
BigDecimal alipayonlineChargeRate = new BigDecimal("2.0");
BigDecimal alipayonlineChargeRate = new BigDecimal("0.6");
if (sysConfig.getBigDecimal("Alipay_charge_rate") != null) {
alipayChargeRate = sysConfig.getBigDecimal("Alipay_charge_rate");
}
@ -329,7 +372,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
}
Runnable task = () -> {
orgIds.forEach((p) -> {
generateAgent(monthStr, p);
generateAgentold(monthStr, p);
});
generateReferrer(monthStr);
generateSenior(monthStr);
@ -337,6 +380,290 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
new Thread(task).start();
}
@Override
@Transactional
public void generate(String monthStr) {
Date mon = checkMonth(monthStr);
Calendar monthCal = Calendar.getInstance();
monthCal.setTime(mon);
int year = monthCal.get(Calendar.YEAR);
int month = monthCal.get(Calendar.MONTH) + 1;
List<JSONObject> list = financialPartnerCommissionMapper.list(year, month);
if (list!=null &&list.size() > 0) {
throw new ServerErrorException("请不要重复生成合伙人记录");
}
financialPartnerCommissionDetailMapper.clearData(year, month, 1);
financialPartnerCommissionMapper.clearData(year, month, 1);
JSONObject sysConfig = sysConfigManager.getSysConfig();
BigDecimal alipayChargeRate = new BigDecimal("0.6");
BigDecimal wechatChargeRate = new BigDecimal("0.6");
BigDecimal jdChargeRate = new BigDecimal("0.9");
BigDecimal alipayonlineChargeRate = new BigDecimal("0.6");
if (sysConfig.getBigDecimal("Alipay_charge_rate") != null) {
alipayChargeRate = sysConfig.getBigDecimal("Alipay_charge_rate");
}
if (sysConfig.getBigDecimal("Wechat_charge_rate") != null) {
wechatChargeRate = sysConfig.getBigDecimal("Wechat_charge_rate");
}
if (sysConfig.getBigDecimal("jd_charge_rate") != null) {
jdChargeRate = sysConfig.getBigDecimal("jd_charge_rate");
}
if (sysConfig.getBigDecimal("alipayonline_charge_rate") != null) {
alipayonlineChargeRate = sysConfig.getBigDecimal("alipayonline_charge_rate");
}
JSONObject channelCharge = new JSONObject();
channelCharge.put("alipayChargeRate", alipayChargeRate);
channelCharge.put("wechatChargeRate", wechatChargeRate);
channelCharge.put("jdChargeRate", jdChargeRate);
channelCharge.put("alipayonlineChargeRate", alipayonlineChargeRate);
List<JSONObject> transactionDetail = transactionMapper.listTransactionForCityPartnerCommissionByDate(year, month);
Map<Integer, List<JSONObject>> groupByOrgMap = transactionDetail.stream().collect(Collectors.groupingBy(e -> e.getInteger("org_id")));
for (Map.Entry<Integer, List<JSONObject>> oneOrg : groupByOrgMap.entrySet()) {
int orgId = oneOrg.getKey();
JSONObject org = orgMapper.findOne(orgId);
if (org == null) {
// shall never happen
throw new ServerErrorException("Organization Id not exists:" + orgId);
}
if (org.getInteger("commission_type")!=1) {
generateold(monthStr);
return;
}
List<JSONObject> items = oneOrg.getValue();
Map<String, List<JSONObject>> groupByChannelMap = items.stream().collect(Collectors.groupingBy(e -> e.getString("channel")));
List<JSONObject> channelAmount = orgChannelAmount(org,groupByChannelMap, channelCharge);
for (JSONObject channel : channelAmount) {
channel.put("share_charge", 0);
channel.put("month", month);
channel.put("year", year);
channel.put("org_id", orgId);
financialPartnerCommissionMapper.save(channel);
}
}
Map<Integer, List<JSONObject>> groupByClientMap = transactionDetail.stream().collect(Collectors.groupingBy(e -> e.getInteger("client_id")));
for (Map.Entry<Integer, List<JSONObject>> oneClient : groupByClientMap.entrySet()) {
JSONObject org = orgMapper.findOne(oneClient.getValue().get(0).getInteger("org_id"));
Map<String, List<JSONObject>> groupByChannel = oneClient.getValue().stream().collect(Collectors.groupingBy(e -> e.getString("channel")));
List<JSONObject> clientChannelAmount = clientChannelAmount(oneClient.getKey(),org, groupByChannel, channelCharge,year,month,1);
for (JSONObject channel : clientChannelAmount) {
financialPartnerCommissionDetailMapper.save(channel);
}
}
Runnable task = () -> {
generateAgent(monthStr, channelCharge);
generateReferrer(monthStr);
generateSenior(monthStr);
};
new Thread(task).start();
}
public List<JSONObject> orgChannelAmount(JSONObject orgInfo,Map<String, List<JSONObject>> channelMap,JSONObject channelCharge) {
List<JSONObject> amountByChannel = new ArrayList<>();
for (Map.Entry<String, List<JSONObject>> oneChannel : channelMap.entrySet()) {
BigDecimal total = BigDecimal.ZERO;
BigDecimal total_surage = BigDecimal.ZERO;
BigDecimal net_surage = BigDecimal.ZERO;
BigDecimal royalpay_surage = BigDecimal.ZERO;
JSONObject json = new JSONObject();
String channel = oneChannel.getKey();
if (orgInfo.get(channel.toLowerCase() + "_rate_value")==null) {
throw new ServerErrorException(orgInfo.get("org_id") + "组织未设置"+ channel + "渠道成本手续费");
}
for (JSONObject params : oneChannel.getValue()) {
//增加货币判断
int i = currencyScale(params.getString("clearing_currency"));
total = total.add(params.getBigDecimal("clearing_amount"));
total_surage = total_surage.add(params.getBigDecimal("total_surcharge")).setScale(i, RoundingMode.HALF_UP);
royalpay_surage = royalpay_surage.add(params.getBigDecimal("clearing_amount").multiply(orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)).setScale(i, RoundingMode.HALF_UP));
// net_surage = net_surage.add(getThirdPartyCharge(params.getString("channel"), params.getBigDecimal("clearing_amount"), channelCharge));
net_surage = net_surage.add(params.getBigDecimal("channel_surcharge"));
}
BigDecimal org_charge = total_surage.subtract(royalpay_surage);
json.put("channel",channel);
json.put("gross_amount",total);
json.put("total_charge",total_surage);
json.put("net_charge",net_surage);
json.put("org_rate", orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value"));
json.put("royalpay_charge", royalpay_surage);
json.put("org_charge", org_charge);
json.put("commission_type", "1");
json.put("create_time", new Date());
amountByChannel.add(json);
}
return amountByChannel;
}
public List<JSONObject> parentOrgChannelAmount(JSONObject orgInfo,JSONObject parentOrgInfo,Map<String, List<JSONObject>> channelMap,JSONObject channelCharge) {
List<JSONObject> amountByChannel = new ArrayList<>();
for (Map.Entry<String, List<JSONObject>> oneChannel : channelMap.entrySet()) {
BigDecimal total = BigDecimal.ZERO;
BigDecimal total_surage = BigDecimal.ZERO;
BigDecimal net_surage = BigDecimal.ZERO;
BigDecimal royalpay_surage = BigDecimal.ZERO;
BigDecimal share_surage = BigDecimal.ZERO;
JSONObject json = new JSONObject();
String channel = oneChannel.getKey();
for (JSONObject params : oneChannel.getValue()) {
//增加货币判断
int i = currencyScale(params.getString("clearing_currency"));
BigDecimal parent_surage = params.getBigDecimal("clearing_amount").multiply(parentOrgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)).setScale(i, RoundingMode.HALF_UP);
BigDecimal roy_surage = (params.getBigDecimal("clearing_amount").multiply(orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)).setScale(i, RoundingMode.HALF_UP));
total = total.add(params.getBigDecimal("clearing_amount"));
total_surage = total_surage.add(params.getBigDecimal("total_surcharge")).setScale(i, RoundingMode.HALF_UP);
royalpay_surage = royalpay_surage.add(roy_surage);
//net_surage = net_surage.add(getThirdPartyCharge(params.getString("channel"), params.getBigDecimal("clearing_amount"), channelCharge));
net_surage = net_surage.add(params.getBigDecimal("channel_surcharge"));
share_surage = share_surage.add(roy_surage.subtract(parent_surage)).setScale(i,RoundingMode.HALF_UP);
}
BigDecimal org_charge = total_surage.subtract(royalpay_surage);
json.put("channel",channel);
json.put("gross_amount",total);
json.put("total_charge",total_surage);
json.put("net_charge",net_surage);
json.put("org_rate", orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value"));
json.put("partner_charge", royalpay_surage);
json.put("share_charge", share_surage);
json.put("org_charge", org_charge);
json.put("commission_type", "1");
json.put("create_time", new Date());
amountByChannel.add(json);
}
return amountByChannel;
}
//type 1:一级代理 2:二级代理
public List<JSONObject> clientChannelAmount(int clientId,JSONObject orgInfo,Map<String, List<JSONObject>> channelMap,JSONObject channelCharge,int year,int month,int type) {
List<JSONObject> amountByChannel = new ArrayList<>();
for (Map.Entry<String, List<JSONObject>> oneChannel : channelMap.entrySet()) {
JSONObject rate = merchantInfoProvider.clientCurrentRate(clientId, oneChannel.getValue().get(0).getDate("transaction_time"),oneChannel.getKey());
String recordId = "";
if (type == 1) {
recordId = financialPartnerCommissionMapper.getRecordId(orgInfo.getInteger("org_id"), year, month, oneChannel.getKey());
}
if (type == 2) {
recordId = financialAgentCommissionMapper.getRecordId(orgInfo.getInteger("org_id"), year, month, oneChannel.getKey());
}
BigDecimal total = BigDecimal.ZERO;
BigDecimal total_surage = BigDecimal.ZERO;
BigDecimal net_surage = BigDecimal.ZERO;
BigDecimal royalpay_surage = BigDecimal.ZERO;
Date datefrom = new Date();
Date dateto = new Date();
JSONObject json = new JSONObject();
String channel = oneChannel.getKey();
for (JSONObject params : oneChannel.getValue()) {
//增加货币判断
int i = currencyScale(params.getString("clearing_currency"));
if (total.compareTo(BigDecimal.ZERO)==0 ) {
datefrom = params.getDate("transaction_time");
dateto = params.getDate("transaction_time");
}else {
if (params.getDate("transaction_time").before(datefrom)) {
datefrom = params.getDate("transaction_time");
}
if (params.getDate("transaction_time").after(dateto)) {
dateto = params.getDate("transaction_time");
}
}
total = total.add(params.getBigDecimal("clearing_amount"));
total_surage = total_surage.add(params.getBigDecimal("total_surcharge")).setScale(i, RoundingMode.HALF_UP);
royalpay_surage = royalpay_surage.add(params.getBigDecimal("clearing_amount").multiply(orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)).setScale(i, RoundingMode.HALF_UP));
//net_surage = net_surage.add(getThirdPartyCharge(params.getString("channel"), params.getBigDecimal("clearing_amount"), channelCharge));
net_surage = net_surage.add(params.getBigDecimal("channel_surcharge"));
}
BigDecimal org_charge = total_surage.subtract(royalpay_surage);
if(channel.toLowerCase().equals("alipay_direct")){
channel = channel.replace("_", "");
}
json.put("channel",channel);
json.put("record_id",recordId);
json.put("client_id",clientId);
json.put("client_rate",rate.getBigDecimal("rate_value").setScale(2,RoundingMode.DOWN));
json.put("gross_amount",total);
json.put("total_charge",total_surage);
json.put("org_rate", orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value"));
json.put("royalpay_charge", royalpay_surage);
if (type == 1) {
json.put("net_charge",net_surage);
}
if (type == 2) {
json.put("org_net_charge",net_surage);
}
json.put("org_charge", org_charge);
json.put("commission_type", "1");
json.put("create_time", new Date());
json.put("date_from", DateFormatUtils.format(datefrom,"yyyy-MM-dd"));
json.put("date_to", DateFormatUtils.format(dateto,"yyyy-MM-dd"));
json.put("year", year);
json.put("month", month);
amountByChannel.add(json);
}
return amountByChannel;
}
private int currencyScale(String currency) {
int i = 0;
switch (currency) {
case "JPY":
i = 0;
break;
default:
i = 2;
break;
}
return i;
}
private BigDecimal getThirdPartyCharge(String channel, BigDecimal total,JSONObject chargeRate) {
BigDecimal thirdPartyPaymentCharge = BigDecimal.ZERO;
switch (channel) {
case "Alipay":
thirdPartyPaymentCharge = total.multiply(chargeRate.getBigDecimal("alipayChargeRate").divide(CommonConsts.HUNDRED, 4, BigDecimal.ROUND_DOWN)).setScale(2,RoundingMode.HALF_UP);
break;
case "Wechat":
thirdPartyPaymentCharge = total.multiply(chargeRate.getBigDecimal("wechatChargeRate").divide(CommonConsts.HUNDRED, 4, BigDecimal.ROUND_DOWN)).setScale(2,RoundingMode.HALF_UP);
break;
case "jd":
thirdPartyPaymentCharge = total.multiply(chargeRate.getBigDecimal("jdChargeRate").divide(CommonConsts.HUNDRED, 4, BigDecimal.ROUND_DOWN)).setScale(2,RoundingMode.HALF_UP);
break;
case "AlipayOnline":
thirdPartyPaymentCharge = total.multiply(chargeRate.getBigDecimal("alipayonlineChargeRate").divide(CommonConsts.HUNDRED, 4, BigDecimal.ROUND_DOWN)).setScale(2,RoundingMode.HALF_UP);
break;
default:
break;
}
return thirdPartyPaymentCharge;
}
@Override
@Transactional
public void generateReferrer(String monthStr) {
@ -371,9 +698,8 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
}
}
@Override
@Transactional
public void generateAgent(String monthStr, int orgId) {
public void generateAgentold(String monthStr, int orgId) {
JSONObject org = orgMapper.findOne(orgId);
if (org == null) {
// shall never happen
@ -425,6 +751,93 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
financialAgentCommissionDetailMapper.save(detail);
}
}
}
@Transactional
public void generateAgent(String monthStr,JSONObject channelCharge) {
Date mon = checkMonth(monthStr);
Calendar monthCal = Calendar.getInstance();
monthCal.setTime(mon);
int year = monthCal.get(Calendar.YEAR);
int month = monthCal.get(Calendar.MONTH) + 1;
financialAgentCommissionMapper.clearData(year, month);
financialAgentCommissionDetailMapper.clearData(year, month);
List<JSONObject> transactionDetail = transactionMapper.listTransactionForCityPartnerAgentCommissionByDate(year, month);
Map<Integer, List<JSONObject>> groupByOrgMap = transactionDetail.stream().collect(Collectors.groupingBy(e -> e.getInteger("org_id")));
for (Map.Entry<Integer, List<JSONObject>> oneOrg : groupByOrgMap.entrySet()) {
int orgId = oneOrg.getKey();
JSONObject org = orgMapper.findOne(orgId);
if (org == null) {
// shall never happen
throw new ServerErrorException("Organization Id not exists:" + orgId);
}
JSONObject parentOrg = orgMapper.findOne(org.getInteger("parent_org_id"));
if (parentOrg == null) {
// shall never happen
throw new ServerErrorException("Parent Organization Id not exists:" + orgId);
}
if (org.getInteger("commission_type")!=1) {
generateold(monthStr);
return;
}
List<JSONObject> items = oneOrg.getValue();
Map<String, List<JSONObject>> groupByChannelMap = items.stream().collect(Collectors.groupingBy(e -> e.getString("channel")));
List<JSONObject> channelAmount = parentOrgChannelAmount(org,parentOrg,groupByChannelMap, channelCharge);
for (JSONObject channel : channelAmount) {
if (channel.getBigDecimal("share_charge").compareTo(BigDecimal.ZERO) != 0) {
JSONObject parentCommission = financialPartnerCommissionMapper.findByChanel(year, month, parentOrg.getInteger("org_id"), channel.getString("channel"));
if (parentCommission == null) {
JSONObject temp = new JSONObject();
temp.put("org_id", parentOrg.getInteger("org_id"));
temp.put("year", year);
temp.put("month", month);
temp.put("create_time", new Date());
temp.put("org_rate", 0);
temp.put("gross_amount", 0);
temp.put("total_charge", 0);
temp.put("royalpay_charge", 0);
temp.put("org_charge", 0);
temp.put("share_charge", 0);
temp.put("channel", channel.getString("channel"));
temp.put("net_charge", 0);
temp.put("commission_type", 1);
temp.put("settle_surcharge", 0);
financialPartnerCommissionMapper.save(temp);
parentCommission = temp;
}
parentCommission.put("share_charge", parentCommission.getBigDecimal("share_charge").add(channel.getBigDecimal("share_charge")));
financialPartnerCommissionMapper.update(parentCommission);
JSONObject mineCommission = financialPartnerCommissionMapper.findByChanel(year, month, orgId, channel.getString("channel"));
mineCommission.put("share_charge", mineCommission.getBigDecimal("share_charge").subtract(channel.getBigDecimal("share_charge")));
financialPartnerCommissionMapper.update(mineCommission);
}
channel.put("month", month);
channel.put("year", year);
channel.put("org_id", orgId);
//撤销agent表
// financialAgentCommissionMapper.save(channel);
}
}
//撤销agent表
// Map<Integer, List<JSONObject>> groupByClientMap = transactionDetail.stream().collect(Collectors.groupingBy(e -> e.getInteger("client_id")));
// for (Map.Entry<Integer, List<JSONObject>> oneClient : groupByClientMap.entrySet()) {
//
// JSONObject org = orgMapper.findOne(oneClient.getValue().get(0).getInteger("org_id"));
// Map<String, List<JSONObject>> groupByChannel = oneClient.getValue().stream().collect(Collectors.groupingBy(e -> e.getString("channel")));
//
// List<JSONObject> clientChannelAmount = clientChannelAmount(oneClient.getKey(),org, groupByChannel, channelCharge,year,month,2);
// for (JSONObject channel : clientChannelAmount) {
// financialAgentCommissionDetailMapper.save(channel);
// }
//
// }
}
@Override

@ -4,6 +4,8 @@ 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.List;
@ -19,6 +21,9 @@ public interface FinancialPartnerCommissionMapper {
@AutoSql(type = SqlType.INSERT)
void save(JSONObject commissionAnalysis);
@AutoSql(type = SqlType.UPDATE)
void update(JSONObject commission);
List<Integer> listAvailableMonths(@Param("year") int year);
List<JSONObject> listWithOrgInfo(@Param("year") int year, @Param("month") int month);
@ -32,4 +37,11 @@ public interface FinancialPartnerCommissionMapper {
List<JSONObject> analysisSenior(@Param("year") int year, @Param("month")int month,@Param("orgIds") List<String> orgIds);
JSONObject analysisSeniorForGenerate(@Param("year") int year, @Param("month")int month,@Param("orgIds") List<String> orgIds);
String getRecordId(@Param("org_id") int orgId, @Param("year") int year, @Param("month") int month, @Param("channel") String channel);
JSONObject findByChanel(@Param("year") int year, @Param("month") int month, @Param("org_id") int orgId,@Param("channel") String channel);
PageList<JSONObject> getClientExtractRecord(@Param("org_id") int orgId, PageBounds pageBounds);
}

@ -27,6 +27,8 @@ public interface OrgManager {
List<JSONObject> getReferrers();
JSONObject getCityPartnerPrizeInfoList(int page, int limit,int orgId, JSONObject manager);
void switchPermission(int orgId, String permissionName, boolean enabled);
List<JSONObject> listAllOrg();

@ -1,5 +1,6 @@
package au.com.royalpay.payment.manage.organizations.core.impls;
import au.com.royalpay.payment.manage.mappers.financial.FinancialPartnerCommissionMapper;
import au.com.royalpay.payment.manage.mappers.system.OrgMapper;
import au.com.royalpay.payment.manage.organizations.beans.OrgInfo;
import au.com.royalpay.payment.manage.organizations.core.OrgManager;
@ -29,6 +30,8 @@ import javax.annotation.Resource;
public class OrgManagerImpl implements OrgManager {
@Resource
private OrgMapper orgMapper;
@Resource
private FinancialPartnerCommissionMapper financialPartnerCommissionMapper;
@Override
public List<JSONObject> listOrgs(boolean detail) {
@ -126,6 +129,16 @@ public class OrgManagerImpl implements OrgManager {
return orgMapper.listOrgs(1,new PageBounds());
}
@Override
public JSONObject getCityPartnerPrizeInfoList(int page, int limit,int orgId, JSONObject manager) {
if (orgId > 0) {
PageList<JSONObject> clientExtractList = financialPartnerCommissionMapper.getClientExtractRecord(orgId,
new PageBounds(page, limit));
return PageListUtils.buildPageListResult(clientExtractList);
}
return null;
}
@Override
public void switchPermission(int orgId, String permissionName, boolean enabled) {
JSONObject org = new JSONObject();

@ -97,7 +97,10 @@ public class OrgManageController {
return orgManager.getReferrers();
}
@ManagerMapping(value = "/{orgId}/extract/search", method = RequestMethod.GET)
public JSONObject getCityPartnerPrizeInfoAllList(@PathVariable int orgId,
@RequestParam(defaultValue = "1") int page,
@RequestParam(defaultValue = "20") int limit, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return orgManager.getCityPartnerPrizeInfoList(page, limit,orgId,manager);
}
}

@ -53,6 +53,19 @@
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
</select>
<select id="listNewClients" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT count(client_id) new_clients,DATE_FORMAT(date(create_time),'%d/%m/%Y') create_times
FROM sys_clients
WHERE
create_time >= #{begin} AND create_time <= #{end} and (approve_result is null or approve_result !=0)
]]>
<if test="org_id!=null and org_ids==null">and org_id=#{org_id}</if>
<if test="org_ids!=null">and org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
GROUP BY YEAR(create_time),MONTH(create_time),DAY(create_time) ORDER BY create_time desc
</select>
<select id="countClients" resultType="java.lang.Integer">
<![CDATA[
SELECT count(client_id)

@ -60,4 +60,13 @@
<select id="getClientExtractRecord" resultType="com.alibaba.fastjson.JSONObject">
SELECT
o.name,c.`year`,c.`month`,c.gross_amount,c.total_charge,c.royalpay_charge,c.org_charge,c.channel,c.share_charge
FROM financial_partner_commission c
INNER JOIN sys_org o ON o.org_id = c.org_id and o.type = 0
WHERE c.org_id = #{org_id}
ORDER BY c.year DESC,c.month DESC
</select>
</mapper>

@ -3,6 +3,7 @@
*/
define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
'use strict';
var colors = ['#00c0ef', '#00a65a', '#ff851b', '#f39c12', '#d81b60', '#605ca8', '#dd4b39', '#008080', '#8B008B', '#D2691E', '#708090'];
var types = [{
"label": "城市合伙人",
@ -85,7 +86,121 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
};
$scope.listOrgs(1);
}]);
app.controller('orgDetailCtrl', ['$scope', '$http', '$state', 'Upload', '$uibModal','commonDialog', 'org','stateMap', function ($scope, $http, $state, Upload,$uibModal,commonDialog, org,stateMap) {
app.controller('orgDetailCtrl', ['$scope', '$http', '$state', 'Upload', '$filter','$uibModal','commonDialog','chartParser', 'org','stateMap', function ($scope, $http, $state, Upload,$filter,$uibModal,commonDialog, chartParser,org,stateMap) {
$scope.analysis = {};
$scope.today = new Date();
$scope.chooseToday = function () {
$scope.params.begin = $scope.params.end = new Date();
$scope.loadTransactionAmountInOrg();
};
$scope.chooseYesterday = function () {
var yesterday = new Date();
yesterday.setDate(yesterday.getDate() - 1);
$scope.params.begin = $scope.params.end = yesterday;
$scope.loadTransactionAmountInOrg();
};
$scope.chooseLast7Days = function () {
$scope.params.end = new Date();
var day = new Date();
day.setDate(day.getDate() - 7);
$scope.params.begin = day;
$scope.loadTransactionAmountInOrg();
};
$scope.thisMonth = function () {
$scope.params.end = new Date();
var monthBegin = new Date();
monthBegin.setDate(1);
$scope.params.begin = monthBegin;
$scope.loadTransactionAmountInOrg();
};
$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.loadTransactionAmountInOrg();
};
$scope.thisYear = function () {
var yearFinish = new Date();
$scope.params.end = yearFinish;
var currentYearFirstDate = new Date(new Date().getFullYear(), 0, 1);
$scope.params.begin = currentYearFirstDate;
$scope.loadTransactionAmountInOrg();
};
$scope.scales = [
{
key: 'today',
label: '今日',
params: function () {
return {
begin: $filter('date')(new Date(), 'yyyyMMdd'),
end: $filter('date')(new Date(), 'yyyyMMdd'),
timezone: jstz.determine().name()
}
}
},
{
key: 'yesterday',
label: '昨日',
params: function () {
var date = new Date();
date = date.setDate(date.getDate() - 1);
return {
begin: $filter('date')(date, 'yyyyMMdd'),
end: $filter('date')(date, 'yyyyMMdd')
}
}
},
{
key: 'seven',
label: '近7日',
params: function () {
var date = new Date();
var end = $filter('date')(date, 'yyyyMMdd');
date = date.setDate(date.getDate() - 6);
return {
begin: $filter('date')(date, 'yyyyMMdd'),
end: end
}
}
},
{
key: 'month',
label: '本月',
params: function () {
var date = new Date();
var end = $filter('date')(date, 'yyyyMMdd');
date = date.setDate(1);
return {
begin: $filter('date')(date, 'yyyyMMdd'),
end: end
}
}
},
{
key: 'lastmonth',
label: '上月',
params: function () {
var date = new Date();
date = date.setDate(1);
var oneDay=1000*60*60*24;
var end = $filter('date')(date-oneDay, 'yyyyMMdd');
var date2 = new Date();
date2.setDate(1);
date2.setMonth(date2.getMonth() - 1);
var begin = $filter('date')(date2, 'yyyyMMdd');
return {
begin: begin,
end: end
}
}
}
];
$scope.types = angular.copy(types);
$scope.states = stateMap.configs();
$scope.commission_types = angular.copy(commission_types);
@ -104,6 +219,225 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
};
$scope.loadSeniorOrg(1);
$scope.loadPartners = function (page) {
var params = angular.copy($scope.params);
params.page = page || $scope.pagination.page || 1;
params.org_id = $scope.org.org_id;
$http.get('/sys/partners', {params: params}).then(function (resp) {
$scope.partners = resp.data.data;
$scope.pagination = resp.data.pagination;
});
};
$scope.loadTransactionAmountInOrg = function () {
$scope.future_loading = true;
var params = angular.copy($scope.params);
if (params.begin) {
params.begin = $filter('date')(params.begin, 'yyyyMMdd');
} else {
params.begin = $filter('date')('2016-01-01', 'yyyyMMdd');
}
if (params.end) {
params.end = $filter('date')(params.end, 'yyyyMMdd');
} else {
params.end = $filter('date')(new Date(), 'yyyyMMdd');
}
params.org_id = $scope.org.org_id;
$http.get('/analysis/org/sales', {params: params}).then(function (resp) {
$scope.orgAmounts = resp.data;
$scope.legends = [];
for (var i = 0; i < resp.data.length; i++) {
$scope.legends[i] = resp.data[i].org_name;
}
if($scope.orgAmounts.length >= 1){
$scope.chooseOrg = resp.data[0].org_name;
loadPartnersByOrgId(resp.data[0].org_id);
}
$scope.future_loading = false;
});
};
function loadPartnersByOrgId(org_id) {
var params = angular.copy($scope.params);
if (params.begin) {
params.begin = $filter('date')(params.begin, 'yyyyMMdd');
} else {
params.begin = $filter('date')('2016-01-01', 'yyyyMMdd');
}
if (params.end) {
params.end = $filter('date')(params.end, 'yyyyMMdd');
} else {
params.end = $filter('date')(new Date(), 'yyyyMMdd');
}
$http.get('/analysis/org/'+org_id+'/partners', {params: params}).then(function (resp) {
$scope.salespartners = resp.data;
$scope.partnerSales1 = [];
$scope.partnerSales2 = [];
$scope.partnerSalesList = [];
var partnerSales = angular.copy($scope.salespartners);
var partnerSalesSize = 0;
if (partnerSales.length % 2 == 0) {
partnerSalesSize = partnerSales.length / 2;
} else {
partnerSalesSize = (partnerSales.length + 1) / 2
}
for (var i = 0; i < partnerSalesSize; i++) {
var item = [];
item[0] = partnerSales[i * 2];
if (i * 2 - 1 < partnerSales.length) {
item[1] = partnerSales[i * 2 + 1];
}
$scope.partnerSalesList[i] = item;
}
$scope.future_loading = false;
});
}
$scope.reloadTrade = function () {
loadFeeAnalysis($scope.scales[2].params());
loadNewClientAnalysis($scope.scales[2].params());
};
$scope.chooseLast7Days();
//$scope.loadTransactionAmountInOrg();
function loadFeeAnalysis(params) {
var analysisConfig = {
chart: {
tooltip: {
trigger: 'axis',
formatter: '{b}:AUD {c}'
},
toolbox: {
show: true,
feature: {
mySeven: {
title: '最近7天',
show: true,
icon: 'path://M3.59-4.07L32.38-4.07L32.38 0.04Q22.25 25.11 17.19 46.34L10.65 46.34Q16.14 26.94 26.19 1.41L3.59 1.41L3.59-4.07Z',
onclick: function () {
loadFeeAnalysis($scope.scales[2].params())
}
},
myThirty: {
title: '最近30天',
show: true,
icon: 'path://M12.52 17.02L16.10 17.02Q20.71 17.02 22.43 15.72Q25.66 13.23 25.66 8.23Q25.66-0.63 17.61-0.63Q10.93-0.63 9.42 6.93L3.73 6.93Q4.50 2.19 7.03-0.91Q10.90-5.51 17.61-5.51Q23.24-5.51 26.89-2.28Q31.22 1.52 31.22 8.02Q31.22 16.78 23.38 19.48Q32.84 23.14 32.84 32.81Q32.84 39.00 29.32 42.97Q25.10 47.79 17.72 47.79Q10.79 47.79 6.68 43.04Q3.66 39.56 3.02 33.44L8.93 33.44Q9.67 42.83 17.72 42.83Q21.45 42.83 23.98 40.72Q27.14 38.01 27.14 32.81Q27.14 21.63 16.10 21.63L12.52 21.63L12.52 17.02ZM54-5.51Q67.99-5.51 67.99 21.14Q67.99 47.79 54 47.79Q40.04 47.79 40.04 21.14Q40.04-5.51 54-5.51M46.97 33.65L59.84 4.30Q57.80-0.55 53.93-0.55Q45.95-0.55 45.95 21.14Q45.95 28.52 46.97 33.65M48.16 37.91Q50.13 42.83 54 42.83Q62.09 42.83 62.09 21.07Q62.09 13.86 61.07 8.66L48.16 37.91Z',
onclick: function () {
var params = {};
var dt = new Date();
params.end = $filter('date')(dt, 'yyyyMMdd');
dt.setDate(dt.getDate() - 29);
params.begin = $filter('date')(dt, 'yyyyMMdd');
loadFeeAnalysis(params)
}
}
}
},
yAxis: {
type: 'value',
name: '交易金额(AUD)'
},
color: colors
},
xAxis: {
basic: {
type: 'category',
boundaryGap: false
},
key: 'trade_date'
},
series: [
{
basic: {type: 'line', label: {normal: {show: true}}, showAllSymbols: true},
column: {key: 'total'}
}
]
};
params.org_id = $scope.org.org_id;
$http.get('/dashboard/system/fee_analysis', {params: params}).then(function (resp) {
$scope.analysis.trade_line = chartParser.parse(analysisConfig, resp.data.reverse());
})
}
function loadNewClientAnalysis(params) {
var analysisConfig = {
chart: {
tooltip: {
trigger: 'axis',
formatter: '新增商户数:{c}'
},
toolbox: {
show: true,
feature: {
mySeven: {
title: '最近7天',
show: true,
icon: 'path://M3.59-4.07L32.38-4.07L32.38 0.04Q22.25 25.11 17.19 46.34L10.65 46.34Q16.14 26.94 26.19 1.41L3.59 1.41L3.59-4.07Z',
onclick: function () {
loadNewClientAnalysis($scope.scales[2].params())
}
},
myThirty: {
title: '最近30天',
show: true,
icon: 'path://M12.52 17.02L16.10 17.02Q20.71 17.02 22.43 15.72Q25.66 13.23 25.66 8.23Q25.66-0.63 17.61-0.63Q10.93-0.63 9.42 6.93L3.73 6.93Q4.50 2.19 7.03-0.91Q10.90-5.51 17.61-5.51Q23.24-5.51 26.89-2.28Q31.22 1.52 31.22 8.02Q31.22 16.78 23.38 19.48Q32.84 23.14 32.84 32.81Q32.84 39.00 29.32 42.97Q25.10 47.79 17.72 47.79Q10.79 47.79 6.68 43.04Q3.66 39.56 3.02 33.44L8.93 33.44Q9.67 42.83 17.72 42.83Q21.45 42.83 23.98 40.72Q27.14 38.01 27.14 32.81Q27.14 21.63 16.10 21.63L12.52 21.63L12.52 17.02ZM54-5.51Q67.99-5.51 67.99 21.14Q67.99 47.79 54 47.79Q40.04 47.79 40.04 21.14Q40.04-5.51 54-5.51M46.97 33.65L59.84 4.30Q57.80-0.55 53.93-0.55Q45.95-0.55 45.95 21.14Q45.95 28.52 46.97 33.65M48.16 37.91Q50.13 42.83 54 42.83Q62.09 42.83 62.09 21.07Q62.09 13.86 61.07 8.66L48.16 37.91Z',
onclick: function () {
var params = {};
var dt = new Date();
params.end = $filter('date')(dt, 'yyyyMMdd');
dt.setDate(dt.getDate() - 29);
params.begin = $filter('date')(dt, 'yyyyMMdd');
loadNewClientAnalysis(params)
}
}
}
},
yAxis: {
type: 'value',
name: '新增商户数'
},
color: colors
},
xAxis: {
basic: {
type: 'category',
boundaryGap: false
},
key: 'create_times'
},
series: [
{
basic: {type: 'line', label: {normal: {show: true}}, showAllSymbols: true},
column: {key: 'new_clients'}
}
]
};
params.org_id = $scope.org.org_id;
$http.get('/dashboard/system/new_clients', {params: params}).then(function (resp) {
$scope.analysis.clients_line = chartParser.parse(analysisConfig, resp.data.reverse());
})
}
$scope.loadPartners(1);
$scope.paginationc = {};
$scope.loadCommission = function () {
var params = {};
params.page = $scope.paginationc.page || 1;
params.org_id = $scope.org.org_id;
$http.get('/sys/orgs/'+$scope.org.org_id + '/extract/search', {params: params}).then(function (resp) {
$scope.client_extarct = resp.data.data;
$scope.paginationc = resp.data.pagination;
});
};
$scope.loadCommission();
$scope.uploadLogo = function (file) {
if (file == null) {
return;
@ -158,14 +492,14 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
};
$scope.params = {role:'1111111',org_id:$scope.org.org_id};
$scope.pagination = {};
$scope.paginationa = {};
$scope.listManagers = function (page) {
var params = angular.copy($scope.params);
params.page = page || $scope.pagination.page || 1;
params.page = page || $scope.paginationa.page || 1;
$http.get('/sys/manager_accounts',{params:params}).then(function (resp) {
$scope.managers = resp.data.data;
$scope.pagination = resp.data.pagination;
$scope.paginationa = resp.data.pagination;
})
};

@ -318,6 +318,111 @@
</div>
<!--<button class="btn btn-success col-sm-offset-2" ng-click="update()"><i class="fa fa-save"></i> Update</button>-->
</form>
<div class="box-solid" ng-if="org.type == 0">
<div class="box box-warning">
<div class="box-header">
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-2">
<form class="navbar-form navbar-left" role="search">
<div class="form-group">
<label class="control-label" for="username-filter-input">Username</label>
<input type="text" class="form-control" ng-model="params.username" placeholder="Username" id="username-filter-input">
</div>
<div class="form-group" ng-if="'1'|withRole">
<label class="control-label" for="role-filter-select">Role</label>
<select ng-change="listManagers(1)" class="form-control" id="role-filter-select" ng-model="params.role">
<option value="1111111">All</option>
<option value="1">Administrator</option>
<option value="10">Compliance</option>
<option value="100">BD User</option>
<option value="1000">Accountant</option>
<option value="10000">Service</option>
<option value="100000">Account Manager</option>
<option value="1000000">Director</option>
<option value="10000000">Site Manager</option>
<option value="100000000">Developer</option>
<option value="1000000000000">Org Manager</option>
</select>
</div>
<div class="form-group">
<button class="btn btn-primary" type="button" ng-click="listManagers(1)">
<i class="fa fa-search"></i> Search
</button>
</div>
</form>
<div class="navbar-form navbar-right">
<button class="btn btn-success" type="button" ng-click="newManager()">
<i class="fa fa-plus"></i> New Manager Account
</button>
</div>
</div>
</div>
</div>
<div class="box">
<div class="box-body">
<div class="row">
<div class="col-sm-12 table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Username</th>
<th>Display Name</th>
<th>Wechat</th>
<th>Create Time</th>
<th>Email</th>
<th>Roles</th>
<th>Operation</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="manager in managers">
<td ng-bind="manager.username"></td>
<td ng-bind="manager.display_name"></td>
<td style="white-space: nowrap;overflow: hidden;text-overflow:ellipsis;"><img ng-src="{{manager.headimg}}" style="height: 30px;width:30px;" class="img-circle" ng-if="manager.headimg"> {{manager.nickname}}</td>
<td ng-bind="manager.create_time|date:'yyyy-MM-dd'"></td>
<td ng-bind="manager.email"></td>
<td>
<i class="fa fa-user-secret" title="Administrator" ng-class="{'text-green':manager.admin,'text-gray':!manager.admin}"></i>
<i class="fa fa-eye" title="Compliance" ng-class="{'text-green':manager.operator,'text-gray':!manager.operator}"></i>
<i class="fa fa-crosshairs" title="BD User" ng-class="{'text-green':manager.bd,'text-gray':!manager.bd}"></i>
<i class="fa fa-balance-scale" title="Accountant" ng-class="{'text-green':manager.finacial,'text-gray':!manager.finacial}"></i>
<i class="fa fa-tty" title="Service" ng-class="{'text-green':manager.sevant,'text-gray':!manager.servant}"></i>
<i class="fa fa-university" title="Account Manager" ng-class="{'text-green':manager.accountmanager,'text-gray':!manager.accountmanager}"></i>
<i class="fa fa-line-chart" title="Director" ng-class="{'text-green':manager.director,'text-gray':!manager.director}"></i>
<i class="fa fa-map-o" title="Site Manager" ng-class="{'text-green':manager.sitemanager,'text-gray':!manager.sitemanager}"></i>
<i class="fa fa-code" title="Developer" ng-class="{'text-green':manager.developer,'text-gray':!manager.developer}"></i>
<i class="fa fa-user-plus" title="Org Manager" ng-class="{'text-green':manager.orgmanager,'text-gray':!manager.orgmanager}"></i>
</td>
<td>
<a role="button" class="text-bold text-primary" ng-click="modifyManager(manager)">Modify</a>
|
<a class="text-bold text-danger" role="button" ng-click="disableManager(manager)">Disable</a>
</td>
</tr>
</tbody>
</table>
</div>
<div class="box-footer" ng-if="managers.length">
<uib-pagination class="pagination"
total-items="paginationa.totalCount"
boundary-links="true"
ng-model="paginationa.page"
items-per-page="paginationa.limit"
max-size="10"
ng-change="listManagers()"
previous-text="&lsaquo;"
next-text="&rsaquo;"
first-text="&laquo;"
last-text="&raquo;"></uib-pagination>
<div class="row">
<div class="col-xs-12">Total Records:{{paginationa.totalCount}};Total Pages:{{paginationa.totalPages}}</div>
</div>
</div>
</div>
</div>
</div>
</div>
</uib-tab>
<uib-tab heading="Permission" ng-if="org.type == 0">
<form class="form-horizontal margin-top" name="org_permission_form">
@ -329,112 +434,324 @@
</div>
</form>
</uib-tab>
</uib-tabset>
</div>
</div>
<div class="box-solid" ng-if="org.type == 0">
<div class="box box-warning">
<div class="box-header">
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-2">
<form class="navbar-form navbar-left" role="search">
<div class="form-group">
<label class="control-label" for="username-filter-input">Username</label>
<input type="text" class="form-control" ng-model="params.username" placeholder="Username" id="username-filter-input">
<uib-tab heading="商户">
<div class="box box-warning" style="border-top-color:#f06101">
<div class="box-body no-padding table-responsive">
<div>
<span style="float: right;font-size: 14px;" class="del_client">禁用</span>
<span style="float: right;font-size: 14px;" class="pass_timeout">&nbsp;&nbsp;超期提醒&nbsp;&nbsp;</span>
<span style="float: right;font-size: 14px;"
class="bg-red">&nbsp;&nbsp;等待合规&nbsp;&nbsp;</span>
<span style="float: right;font-size: 14px;"
class="bg-green">&nbsp;&nbsp;绿色通道&nbsp;&nbsp;</span>
<span style="float: right;font-size: 14px;">&nbsp;&nbsp;通过&nbsp;&nbsp;</span>
</div>
<table class="table table-striped">
<thead>
<tr>
<th style="padding: 12px;">Partner Code</th>
<th style="padding: 12px;">Partner Name</th>
<th style="padding: 12px;">Sub Mch ID</th>
<th style="padding: 12px;">Register Time</th>
<th style="padding: 12px;">Compliance Status</th>
<th style="padding: 12px;">Organization</th>
<th style="padding: 12px;">BD</th>
<th style="padding: 12px;" ng-if="'client_detail_by_moniker'|withFunc">Operation</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="partner in partners"
ng-class="{pass_timeout:partner.pass_timeout,success:partner.source==5,warning:partner.approve_result==5 && ('100'|withRole)}">
<td>
<a class="text-primary" role="button" title="Detail"
ng-click="openClientBoard(partner)"
ng-if="(partner.approve_result==1) || (partner.approve_result == 2 && (partner.source==1 || partner.source==2))">
<span ng-bind="partner.client_moniker"></span></a>
<span ng-bind="partner.client_moniker" ng-if="partner.approve_result!=1 && !(partner.approve_result==2 && (partner.source==1 || partner.source==2))"></span>
<span ng-if="partner.is_valid==0" ng-class="{pass_timeout:partner.is_valid==0}">(已禁用)</span>
<i class="fa fa-sitemap" ng-if="partner.parent_client_id"
title="Sub Partner"></i>
<i class="text-danger fa fa-envelope-o"
ng-if="(partner.approve_result==1 || (partner.approve_result == 2 && (partner.source==1 || partner.source==2))) && (partner.approve_email_send==2 || partner.approve_email_send==0)"
title="Init email send failed"></i>
<i class="text-danger fa fa-clock-o" ng-if="partner.temp_sub_merchant"
title="Using temp Sub Merchant ID"></i>
</td>
<td ng-bind="partner.short_name"></td>
<td ng-bind="partner.sub_merchant_id"></td>
<td ng-bind="partner.create_time"></td>
<td ng-class="{'bg-green':(partner.approve_result==2 && (partner.source==1 || partner.source==2)),'bg-red':((partner.open_status==1||partner.open_status==2||partner.open_status==4) && partner.approve_result!=3)||(partner.approve_result==3 && (!partner.open_status || partner.open_status==1 || partner.open_status == 4))||(partner.approve_result==4 && !partner.open_status)||(partner.open_status==10)}">
<span ng-if="partner.approve_result==1 && partner.approve_time">通过({{partner.approve_time}})</span>
<span ng-if="!partner.open_status && !partner.approve_result && partner.approve_result!=5 && partner.source!=4">资料完善中</span>
<span ng-if="!partner.open_status && !partner.approve_result && partner.approve_result!=5 && partner.source==4">(自助开通)资料完善中</span>
<span ng-if="!partner.open_status && partner.approve_result==2 && partner.approve_time">自助开通试用中({{partner.approve_time}}~{{partner.expiry_time}})</span>
<span ng-if="partner.approve_result==0 && partner.approve_time">不通过({{partner.approve_time}})</span>
<span ng-if="partner.approve_result==5 && partner.approve_time && partner.refuse_remark">申请打回({{partner.refuse_remark|limitTo:15}})</span>
<span ng-if="(partner.open_status==1||partner.open_status==4) && partner.approve_result!=3"><i ng-if="partner.refuse_remark.length>0" class="fa fa-reply" aria-hidden="true" title="被打回重新提交"></i>等待合规</span>
<span ng-if="partner.approve_result==3 && (!partner.open_status || partner.open_status==4)">自助开通(等待合规)</span>
<span ng-if="partner.open_status==2">合同制作完成</span>
<span ng-if="partner.open_status==3 && partner.approve_result!=5">等待BD上传材料审核</span>
<span ng-if="partner.open_status==10">绿色通道申请中</span>
<span ng-if="partner.approve_result==4 && !partner.open_status"><i ng-if="partner.refuse_remark.length>0" class="fa fa-reply" aria-hidden="true" title="被打回重新提交"></i>等待合规</span>
</td>
<td ng-bind="partner.org_name"></td>
<td ng-bind="partner.bd_user_name"></td>
<td ng-if="'client_detail_by_moniker'|withFunc">
<a class="text-primary" role="button" title="Detail"
ui-sref="partners.detail({clientMoniker:partner.client_moniker})">
<i class="fa fa-search"></i> Detail
</a>
</td>
</tr>
</tbody>
</table>
</div>
<div class="form-group" ng-if="'1'|withRole">
<label class="control-label" for="role-filter-select">Role</label>
<select ng-change="listManagers(1)" class="form-control" id="role-filter-select" ng-model="params.role">
<option value="1111111">All</option>
<option value="1">Administrator</option>
<option value="10">Compliance</option>
<option value="100">BD User</option>
<option value="1000">Accountant</option>
<option value="10000">Service</option>
<option value="100000">Account Manager</option>
<option value="1000000">Director</option>
<option value="10000000">Site Manager</option>
<option value="100000000">Developer</option>
<option value="1000000000000">Org Manager</option>
</select>
<div class="box-footer" ng-if="partners.length">
<uib-pagination class="pagination"
total-items="pagination.totalCount"
boundary-links="true"
ng-model="pagination.page"
items-per-page="pagination.limit"
max-size="10"
ng-change="loadPartners()"
previous-text="&lsaquo;"
next-text="&rsaquo;"
first-text="&laquo;"
last-text="&raquo;"></uib-pagination>
<div class="row">
<div class="col-xs-12">Total Records:{{pagination.totalCount}};Total
Pages:{{pagination.totalPages}}
</div>
</div>
</div>
<div class="form-group">
<button class="btn btn-primary" type="button" ng-click="listManagers(1)">
<i class="fa fa-search"></i> Search
</button>
</div>
</uib-tab>
<uib-tab heading="交易情况" ng-click="reloadTrade()">
<div class="row">
<div class="col-sm-12">
<div class="box box-warning">
<div class="box-header with-border">商户新增趋势</div>
<div class="box-body">
<div class="chart" echarts="analysis.clients_line" style="height: 300px"
ng-class="{nodata:analysis.clients_line.nodata}"></div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="box box-warning">
<div class="box-header with-border">交易额趋势</div>
<div class="box-body">
<div class="chart" echarts="analysis.trade_line" style="height: 300px"
ng-class="{nodata:analysis.trade_line.nodata}"></div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="box">
<div class="box-header">
<div class="form-horizontal">
<div class="form-group col-xs-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>
</form>
<div class="navbar-form navbar-right">
<button class="btn btn-success" type="button" ng-click="newManager()">
<i class="fa fa-plus"></i> New Manager Account
</button>
<div class="btn-group">
<a role="button" class="btn btn-default btn-sm"
ng-click="chooseToday()">Today</a>
</div>
<div class="btn-group">
<a role="button" class="btn btn-default btn-sm"
ng-click="chooseYesterday()">Yesterday</a>
</div>
<div class="btn-group">
<a role="button" class="btn btn-default btn-sm"
ng-click="chooseLast7Days()">Last 7 Days</a>
</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>
<div class="btn-group">
<a role="button" class="btn btn-default btn-sm" ng-click="thisYear()">This
Year</a>
</div>
<button class="btn btn-success" type="button" ng-click="loadTransactionAmountInOrg()">
<i class="fa fa-search"></i>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row cen">
<div class="col-sm-12">
<div class="box">
<loadingbar ng-if="future_loading"></loadingbar>
<div class="box-header with-border">交易分布</div>
<div class="box-body" ng-if="orgAmounts.length">
<div class="row">
<div class="col-sm-4 col-xs-12">
<p class="text-center">组织总交易额</p>
<div class="col-sm-12 col -xs-4">
<table class="table table-bordered table-hover table-striped">
<thead>
<tr>
<th>Organization</th>
<th>Amount ($)</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="org in orgAmounts">
<td ng-bind="org.org_name"></td>
<td ng-bind="org.amount"></td>
</tr>
</tbody>
</table>
<loadingbar ng-if="partners_loading"></loadingbar>
</div>
</div>
<div class="col-sm-8 col-xs-12">
<p class="text-center">{{chooseOrg}} 合伙人商户交易量排名</p>
<div class="col-sm-12 col-xs-12">
<table class="table table-bordered table-hover table-striped">
<thead>
<tr>
<th style="width: 10%">Ranking</th>
<th style="width: 30%">Partner</th>
<th>AUD Amount</th>
<th style="width: 10%">Ranking</th>
<th style="width: 30%">Partner</th>
<th>Amount</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="sale in partnerSalesList">
<td style="text-align: center;font-style: italic;font-size: larger"
ng-bind="$index*2+1+'.'"></td>
<td>
<a class="text-primary" role="button" title="Detail"
ui-sref="partners.detail({clientMoniker:sale[0].client_moniker})">
{{sale[0].client_moniker}}
</a>
</td>
<td ng-bind="sale[0].amount"></td>
<td style="text-align: center;font-style: italic;font-size: larger"
ng-bind="$index * 2 + 2 +'.'"></td>
<td>
<a class="text-primary" role="button" title="Detail"
ui-sref="partners.detail({clientMoniker:sale[1].client_moniker})">
{{sale[1].client_moniker}}
</a>
</td>
<td ng-bind="sale[1].amount"></td>
</tr>
</tbody>
</table>
<loadingbar ng-if="rank_loading"></loadingbar>
</div>
</div>
</div>
<div class="box">
<div class="box-body">
<div class="row">
<div class="col-sm-12 table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Username</th>
<th>Display Name</th>
<th>Wechat</th>
<th>Create Time</th>
<th>Email</th>
<th>Roles</th>
<th>Operation</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="manager in managers">
<td ng-bind="manager.username"></td>
<td ng-bind="manager.display_name"></td>
<td style="white-space: nowrap;overflow: hidden;text-overflow:ellipsis;"><img ng-src="{{manager.headimg}}" style="height: 30px;width:30px;" class="img-circle" ng-if="manager.headimg"> {{manager.nickname}}</td>
<td ng-bind="manager.create_time|date:'yyyy-MM-dd'"></td>
<td ng-bind="manager.email"></td>
<td>
<i class="fa fa-user-secret" title="Administrator" ng-class="{'text-green':manager.admin,'text-gray':!manager.admin}"></i>
<i class="fa fa-eye" title="Compliance" ng-class="{'text-green':manager.operator,'text-gray':!manager.operator}"></i>
<i class="fa fa-crosshairs" title="BD User" ng-class="{'text-green':manager.bd,'text-gray':!manager.bd}"></i>
<i class="fa fa-balance-scale" title="Accountant" ng-class="{'text-green':manager.finacial,'text-gray':!manager.finacial}"></i>
<i class="fa fa-tty" title="Service" ng-class="{'text-green':manager.sevant,'text-gray':!manager.servant}"></i>
<i class="fa fa-university" title="Account Manager" ng-class="{'text-green':manager.accountmanager,'text-gray':!manager.accountmanager}"></i>
<i class="fa fa-line-chart" title="Director" ng-class="{'text-green':manager.director,'text-gray':!manager.director}"></i>
<i class="fa fa-map-o" title="Site Manager" ng-class="{'text-green':manager.sitemanager,'text-gray':!manager.sitemanager}"></i>
<i class="fa fa-code" title="Developer" ng-class="{'text-green':manager.developer,'text-gray':!manager.developer}"></i>
<i class="fa fa-user-plus" title="Org Manager" ng-class="{'text-green':manager.orgmanager,'text-gray':!manager.orgmanager}"></i>
</td>
<td>
<a role="button" class="text-bold text-primary" ng-click="modifyManager(manager)">Modify</a>
|
<a class="text-bold text-danger" role="button" ng-click="disableManager(manager)">Disable</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="box-footer">
</div>
</div>
</div>
</div>
<div class="box-footer" ng-if="managers.length">
<uib-pagination class="pagination"
total-items="pagination.totalCount"
boundary-links="true"
ng-model="pagination.page"
items-per-page="pagination.limit"
max-size="10"
ng-change="listManagers()"
previous-text="&lsaquo;"
next-text="&rsaquo;"
first-text="&laquo;"
last-text="&raquo;"></uib-pagination>
<div class="row">
<div class="col-xs-12">Total Records:{{pagination.totalCount}};Total Pages:{{pagination.totalPages}}</div>
</uib-tab>
<uib-tab heading="提成">
<div class="box box-default">
<div class="box-header">合伙人提成</div>
<div class="box-body table-responsive">
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th>名称</th>
<th>时间</th>
<th>交易金额</th>
<th>商户总手续费</th>
<th>Royalpay手续费</th>
<th>合伙人提成</th>
<th>提成分润</th>
<th>支付渠道</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="clientExtracts in client_extarct">
<td ng-bind="clientExtracts.name"></td>
<td>
{{clientExtracts.year|limitTo:10}}
-
{{clientExtracts.month|limitTo:10}}
</td>
<td ng-bind="clientExtracts.gross_amount|currency:'AUD'"></td>
<td ng-bind="clientExtracts.total_charge|currency:'AUD'"></td>
<td ng-bind="clientExtracts.royalpay_charge|currency:'AUD'"></td>
<td ng-bind="clientExtracts.org_charge|currency:'AUD'"></td>
<td ng-bind="clientExtracts.share_charge|currency:'AUD'"></td>
<td>
<img ng-if='clientExtracts.channel=="Alipay"' src="/static/images/alipay_sign_lg.png"/>
<img ng-if='clientExtracts.channel=="AlipayOnline"' style="width: 48px;height: 48px" src="/static/images/alipay_online.png"/>
<img ng-if='clientExtracts.channel=="Wechat"' src="/static/images/wechatpay_sign_lg.png"/>
<img ng-if='clientExtracts.channel=="Bestpay"' src="/static/images/bestpay_sign_lg.png"/>
<img ng-if='clientExtracts.channel=="hf"' src="/static/images/hf_sign_lg.png"/>
<img ng-if='clientExtracts.channel=="jd"' src="/static/images/jd_sign_lg.png"/>
<img ng-if='clientExtracts.channel=="Yeepay"' src="/static/images/yeepay_sign_lg.png"/>
<img ng-if='clientExtracts.channel=="Rpay"' src="/static/images/rpayplus_sign_lg.png"/>
{{clientExtracts.channel}}
</td>
</tr>
</tbody>
</table>
</div>
<div class="box-footer" ng-if="client_extarct.length">
<uib-pagination class="pagination"
total-items="paginationc.totalCount"
boundary-links="true"
ng-model="paginationc.page"
items-per-page="paginationc.limit"
max-size="10"
ng-change="loadCommission()"
previous-text="&lsaquo;"
next-text="&rsaquo;"
first-text="&laquo;"
last-text="&raquo;"></uib-pagination>
<div class="row">
<div class="col-xs-12">Total Records:{{paginationc.totalCount}};Total Pages:{{paginationc.totalPages}}</div>
</div>
</div>
</div>
</div>
</div>
</uib-tab>
</uib-tabset>
</div>
</div>
</section>

@ -2067,6 +2067,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.rate.hf_rate_value = parseFloat($scope.sysRateConfig.t1.HFpay);
$scope.rate.Rpay_rate_value = parseFloat($scope.sysRateConfig.t1.Rpay);
$scope.rate.yeepay_rate_value = parseFloat($scope.sysRateConfig.t1.Yeepay);
$scope.rate.transaction_fee = 0;
break;
}
case '2': {
@ -2078,6 +2079,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.rate.hf_rate_value = parseFloat($scope.sysRateConfig.t2.HFpay);
$scope.rate.Rpay_rate_value = parseFloat($scope.sysRateConfig.t2.Rpay);
$scope.rate.yeepay_rate_value = parseFloat($scope.sysRateConfig.t2.Yeepay);
$scope.rate.transaction_fee = 0;
break;
}
case '3': {
@ -2089,6 +2091,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.rate.hf_rate_value = parseFloat($scope.sysRateConfig.t3.HFpay);
$scope.rate.Rpay_rate_value = parseFloat($scope.sysRateConfig.t3.Rpay);
$scope.rate.yeepay_rate_value = parseFloat($scope.sysRateConfig.t3.Yeepay);
$scope.rate.transaction_fee = 0;
break;
}
}

Loading…
Cancel
Save