Merge remote-tracking branch 'origin/develop' into develop

master
yixian 6 years ago
commit e2ba914c1c

@ -5,11 +5,11 @@
<parent>
<groupId>au.com.royalpay.payment</groupId>
<artifactId>payment-parent</artifactId>
<version>1.1.5</version>
<version>1.1.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId>
<version>1.2.81</version>
<version>1.3.2</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jib-maven-plugin.version>1.4.0</jib-maven-plugin.version>
@ -212,6 +212,10 @@
<artifactId>HikariCP</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>
<build>
<plugins>

@ -0,0 +1,3 @@
ALTER TABLE sys_incremental_channels ADD COLUMN channel_pub_key TEXT DEFAULT NULL AFTER source_code;
ALTER TABLE sys_incremental_channels ADD COLUMN platform_pub_key TEXT DEFAULT NULL AFTER channel_pub_key;
ALTER TABLE sys_incremental_channels ADD COLUMN platform_pri_key TEXT DEFAULT NULL AFTER platform_pub_key;

@ -3,6 +3,7 @@ package au.com.royalpay.payment.manage.analysis.core.impls;
import au.com.royalpay.payment.manage.analysis.core.DailyReport;
import au.com.royalpay.payment.manage.mappers.cashback.CashbackRecordsMapper;
import au.com.royalpay.payment.manage.mappers.financial.FinancialBDCommissionConfigMapper;
import au.com.royalpay.payment.manage.mappers.financial.FinancialBDConfigMapper;
import au.com.royalpay.payment.manage.mappers.financial.FinancialBDPrizeLogMapper;
import au.com.royalpay.payment.manage.mappers.log.ClearingLogMapper;
import au.com.royalpay.payment.manage.mappers.log.DailyReportMapper;
@ -10,7 +11,6 @@ import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper;
import au.com.royalpay.payment.manage.mappers.redpack.ActPartnerLMLogMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.mappers.system.ManagerMapper;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi;
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApiProvider;
import au.com.royalpay.payment.tools.connections.mpsupport.beans.TemplateMessage;
@ -18,6 +18,7 @@ import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.time.DateFormatUtils;
@ -31,7 +32,10 @@ import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.text.ParseException;
import java.util.*;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
/**
* Created by yishuqian on 16/11/2017.
@ -59,16 +63,17 @@ public class DailyReportImp implements DailyReport {
private Logger logger = LoggerFactory.getLogger(getClass());
@Resource
private TransactionMapper transactionMapper;
@Resource
private FinancialBDConfigMapper financialBDConfigMapper;
@Override
public void generateReport(String date, boolean sendMsg) {
try {
Date beginTime = DateUtils.parseDate(date, new String[]{"yyyy-MM-dd"});
String reportId =DateFormatUtils.format(beginTime,"yyyy-MM-dd");
String reportId = DateFormatUtils.format(beginTime, "yyyy-MM-dd");
Date yesterdayEndTime = DateUtils.addDays(beginTime, 1);
String endDate = DateFormatUtils.format(yesterdayEndTime, "yyyy-MM-dd");
Date endTime = DateUtils.parseDate(endDate, new String[]{"yyyy-MM-dd"});
Date endTime = DateUtils.parseDate(endDate, new String[]{"yyyy-MM-dd"});
JSONObject report = dailyReportMapper.findOne(reportId);
@ -80,7 +85,7 @@ public class DailyReportImp implements DailyReport {
report.put("analysis_date", beginTime);
report.put("report_date", new Date());
JSONObject creditReport = getCreditReport(beginTime,endTime);
JSONObject creditReport = getCreditReport(beginTime, endTime);
report.put("credit", creditReport.toJSONString());
JSONObject debitReport = getDebitReport(beginTime);
@ -103,67 +108,69 @@ public class DailyReportImp implements DailyReport {
}
private JSONObject getKPI(Date dt){
private JSONObject getKPI(Date dt) {
JSONObject report = new JSONObject();
List<JSONObject> kpiList =new ArrayList<>();
List<JSONObject> prizeAmountAndBdTypeList = financialBDPrizeLogMapper.findBdPrizeAmountMonth(DateUtils.truncate(dt, Calendar.DATE),DateUtils.truncate(DateUtils.addDays(dt,1), Calendar.DATE),DateUtils.truncate(dt, Calendar.MONTH));
List<JSONObject> prizeAmountAndBdTypeListYesterDay = financialBDPrizeLogMapper.findBdPrizeAmountMonth(DateUtils.truncate(DateUtils.addDays(dt,-1), Calendar.DATE),DateUtils.truncate(dt, Calendar.DATE),DateUtils.truncate(DateUtils.addDays(dt,-1), Calendar.MONTH));
List<JSONObject> clientsAmount = clientMapper.createClientsByGroup(DateUtils.truncate(dt, Calendar.DATE),DateUtils.truncate(DateUtils.addDays(dt,1), Calendar.DATE),DateUtils.truncate(dt, Calendar.MONTH));
List<JSONObject> kpiList = new ArrayList<>();
List<JSONObject> prizeAmountAndBdTypeList = financialBDPrizeLogMapper.findBdPrizeAmountMonth(DateUtils.truncate(dt, Calendar.DATE), DateUtils.truncate(DateUtils.addDays(dt, 1), Calendar.DATE), DateUtils.truncate(dt, Calendar.MONTH));
List<JSONObject> prizeAmountAndBdTypeListYesterDay = financialBDPrizeLogMapper.findBdPrizeAmountMonth(DateUtils.truncate(DateUtils.addDays(dt, -1), Calendar.DATE), DateUtils.truncate(dt, Calendar.DATE), DateUtils.truncate(DateUtils.addDays(dt, -1), Calendar.MONTH));
List<JSONObject> clientsAmount = clientMapper.createClientsByGroup(DateUtils.truncate(dt, Calendar.DATE), DateUtils.truncate(DateUtils.addDays(dt, 1), Calendar.DATE), DateUtils.truncate(dt, Calendar.MONTH));
//BD团队总KPI
BigDecimal total_kpi_amount = BigDecimal.ZERO;
//BD团队当月总销售额
BigDecimal total_month_amount = BigDecimal.ZERO;
for(JSONObject p :prizeAmountAndBdTypeList){
JSONObject kpi = new JSONObject();
kpi.put("bd_group",p.getString("bd_group"));
kpi.put("bd_name",p.getString("bd_name"));
kpi.put("group_name",groupName(p.getIntValue("bd_type")));
for (JSONObject p : prizeAmountAndBdTypeList) {
JSONObject kpi = new JSONObject();
kpi.put("bd_group", p.getString("bd_group"));
kpi.put("bd_name", p.getString("bd_name"));
kpi.put("group_name", groupName(p.getIntValue("bd_type")));
//昨日数据
kpi.put("total_amount",p.getBigDecimal("total_amount"));
kpi.put("total_amount", p.getBigDecimal("total_amount"));
//当月数据
kpi.put("month_amount",p.getBigDecimal("month_amount"));
BigDecimal kpi_amount = financialBDCommissionConfigMapper.findCurrentCommissionMaxAmount(DateFormatUtils.format(DateUtils.truncate(dt,Calendar.MONTH),"yyyy-MM"), p.getIntValue("bd_type"));
kpi.put("kpi_amount",kpi_amount);
for(JSONObject prize : prizeAmountAndBdTypeListYesterDay){
if(prize.getString("bd_group").equals(kpi.getString("bd_group"))){
kpi.put("month_amount", p.getBigDecimal("month_amount"));
BigDecimal kpi_amount = financialBDCommissionConfigMapper.findCurrentCommissionMaxAmount(DateFormatUtils.format(DateUtils.truncate(dt, Calendar.MONTH), "yyyy-MM"), p.getIntValue("bd_type"));
kpi.put("kpi_amount", kpi_amount);
for (JSONObject prize : prizeAmountAndBdTypeListYesterDay) {
if (prize.getString("bd_group").equals(kpi.getString("bd_group"))) {
BigDecimal compare = kpi.getBigDecimal("total_amount").subtract(prize.getBigDecimal("total_amount"));
kpi.put("compare",compare);
kpi.put("compare_value",Math.abs(compare.doubleValue()));
kpi.put("compare", compare);
kpi.put("compare_value", Math.abs(compare.doubleValue()));
}
}
kpi.put("kpi_percent", p.getBigDecimal("month_amount").divide(kpi_amount, 4, BigDecimal.ROUND_HALF_DOWN).multiply(BigDecimal.valueOf(100)).toString().substring(0, 5) + "%");
for (JSONObject clientAmount : clientsAmount) {
if (clientAmount.getString("bd_group").equals(kpi.getString("bd_group"))) {
// sys_clients中查询出此bd创建并属于此bd的商户并且时间是昨天和本月
JSONObject countByBd = clientMapper.findCountByBd(clientAmount.getString("bd_group"), DateUtils.truncate(DateUtils.addDays(dt, 1), Calendar.DATE), DateUtils.truncate(dt, Calendar.DATE), DateUtils.truncate(dt, Calendar.MONTH));
if (countByBd.getInteger("month_count") == null){
kpi.put("clients_month", 0);
}else {
kpi.put("clients_month", countByBd.getInteger("month_count"));
}
if (countByBd.getInteger("yesterday_count") == null){
kpi.put("clients_yesterday", 0);
}else {
kpi.put("clients_yesterday", countByBd.getInteger("yesterday_count"));
//查询该领队下所有BD
List<JSONObject> teamBDs = financialBDConfigMapper.listGroupBds(kpi.getString("bd_group"));
int bdMonthClientCount = 0;
int bdYesterdayClientCount = 0;
for (int i = 0; i < teamBDs.size(); i++) {
// sys_clients中查询出此bd创建并属于此bd的商户并且时间是昨天和本月
JSONObject countByBd = clientMapper.findCountByBd(teamBDs.get(i).getString("manager_id"), DateUtils.truncate(DateUtils.addDays(dt, 1), Calendar.DATE), DateUtils.truncate(dt, Calendar.DATE), DateUtils.truncate(dt, Calendar.MONTH));
if (countByBd.getInteger("month_count") != null) {
bdMonthClientCount += countByBd.getInteger("month_count");
}
if (countByBd.getInteger("yesterday_count") != null) {
bdYesterdayClientCount += countByBd.getInteger("yesterday_count");
}
}
// kpi.put("clients_month", clientAmount.getBigDecimal("clients_month"));
// kpi.put("clients_yesterday", clientAmount.getBigDecimal("clients_yesterday"));
kpi.put("clients_month", bdMonthClientCount);
kpi.put("clients_yesterday", bdYesterdayClientCount);
}
}
total_kpi_amount = total_kpi_amount.add(kpi_amount);
total_month_amount = total_month_amount.add(p.getBigDecimal("month_amount"));
kpiList.add(kpi);
}
report.put("kpiList",kpiList);
report.put("kpi_percent_total",total_month_amount.divide(total_kpi_amount,4,BigDecimal.ROUND_HALF_DOWN).multiply(BigDecimal.valueOf(100)).toString().substring(0,5)+"%");
report.put("total_month_amount",total_month_amount);
report.put("kpiList", kpiList);
report.put("kpi_percent_total", total_month_amount.divide(total_kpi_amount, 4, BigDecimal.ROUND_HALF_DOWN).multiply(BigDecimal.valueOf(100)).toString().substring(0, 5) + "%");
report.put("total_month_amount", total_month_amount);
Calendar calendar = Calendar.getInstance();
calendar.setTime(dt);
report.put("time_percent",BigDecimal.valueOf(calendar.get(Calendar.DAY_OF_MONTH)).divide(BigDecimal.valueOf(calendar.getActualMaximum(Calendar.DAY_OF_MONTH)),4,BigDecimal.ROUND_HALF_DOWN).multiply(BigDecimal.valueOf(100)).toString().substring(0,5)+"%");
report.put("time_percent", BigDecimal.valueOf(calendar.get(Calendar.DAY_OF_MONTH)).divide(BigDecimal.valueOf(calendar.getActualMaximum(Calendar.DAY_OF_MONTH)), 4, BigDecimal.ROUND_HALF_DOWN).multiply(BigDecimal.valueOf(100)).toString().substring(0, 5) + "%");
return report;
}
private String groupName(int bd_type){
private String groupName(int bd_type) {
switch (bd_type) {
case 1:
return "Sydney Team";
@ -181,21 +188,21 @@ public class DailyReportImp implements DailyReport {
private JSONObject getDebitReport(Date dt) {
JSONObject report = new JSONObject();
BigDecimal redpack = actPartnerLMLogMapper.getRedpackAmount(dt);
BigDecimal last_redpack = actPartnerLMLogMapper.getRedpackAmount(DateUtils.addDays(dt,-1));
BigDecimal last_redpack = actPartnerLMLogMapper.getRedpackAmount(DateUtils.addDays(dt, -1));
JSONObject redpackObj = new JSONObject();
redpackObj.put("value",redpack);
redpackObj.put("value", redpack);
BigDecimal redpack_compare = redpack.subtract(last_redpack);
redpackObj.put("compare",redpack_compare);
redpackObj.put("compare_value",Math.abs(redpack_compare.doubleValue()));
report.put("redpack",redpackObj);
redpackObj.put("compare", redpack_compare);
redpackObj.put("compare_value", Math.abs(redpack_compare.doubleValue()));
report.put("redpack", redpackObj);
BigDecimal cashback = cashbackRecordsMapper.getSettleDelayDebit(dt);
BigDecimal last_cashback = cashbackRecordsMapper.getSettleDelayDebit(DateUtils.addDays(dt,-1));
BigDecimal last_cashback = cashbackRecordsMapper.getSettleDelayDebit(DateUtils.addDays(dt, -1));
JSONObject cashObj = new JSONObject();
cashObj.put("value",cashback);
cashObj.put("value", cashback);
BigDecimal cashback_compare = cashback.subtract(last_cashback);
cashObj.put("compare",cashback_compare);
cashObj.put("compare_value",Math.abs(cashback_compare.doubleValue()));
report.put("cashback",cashObj);
cashObj.put("compare", cashback_compare);
cashObj.put("compare_value", Math.abs(cashback_compare.doubleValue()));
report.put("cashback", cashObj);
// BigDecimal total_debit=redpack.add(cashback);
// BigDecimal last_debit=last_redpack.add(last_cashback);
// report.put("total_debit",total_debit);
@ -205,9 +212,9 @@ public class DailyReportImp implements DailyReport {
return report;
}
private JSONObject getCreditReport(Date beginTime,Date endTime) {
JSONObject report = new JSONObject();
List<JSONObject> settles = transactionMapper.getSettleDataDailyReport(beginTime,endTime);
private JSONObject getCreditReport(Date beginTime, Date endTime) {
JSONObject report = new JSONObject();
List<JSONObject> settles = transactionMapper.getSettleDataDailyReport(beginTime, endTime);
JSONObject yesterdayTotal = this.computerTotalAmount(settles);
BigDecimal yesterday_settle_amount = yesterdayTotal.getBigDecimal("total_settle_amount");
BigDecimal yesterday_credit_amount = yesterdayTotal.getBigDecimal("total_credit_amount");
@ -218,7 +225,7 @@ public class DailyReportImp implements DailyReport {
BigDecimal yesterday_channel_surcharge = yesterdayTotal.getBigDecimal("total_channel_surcharge");
BigDecimal yesterday_tax_amount = yesterdayTotal.getBigDecimal("total_tax_amount");
List<JSONObject> last_settle = transactionMapper.getSettleDataDailyReport(DateUtils.addDays(beginTime,-1),DateUtils.addDays(endTime,-1));
List<JSONObject> last_settle = transactionMapper.getSettleDataDailyReport(DateUtils.addDays(beginTime, -1), DateUtils.addDays(endTime, -1));
JSONObject lastTotal = this.computerTotalAmount(last_settle);
BigDecimal last_settle_amount = lastTotal.getBigDecimal("total_settle_amount");
BigDecimal last_total_credit = lastTotal.getBigDecimal("total_credit_amount");
@ -238,44 +245,44 @@ public class DailyReportImp implements DailyReport {
JSONObject percentage_yesterday_channel_surcharge = this.percentage(yesterday_channel_surcharge, last_channel_surcharge);
JSONObject percentage_yesterday_tax_amount = this.percentage(yesterday_tax_amount, last_tax_amount);
report.put("channels",settles);
report.put("total_settle_amount",new JSONObject(){{
put("amount",yesterday_settle_amount);
put("compare",percentage_yesterday_settle_amount);
report.put("channels", settles);
report.put("total_settle_amount", new JSONObject() {{
put("amount", yesterday_settle_amount);
put("compare", percentage_yesterday_settle_amount);
}});
report.put("total_credit_amount",new JSONObject(){{
put("amount",yesterday_credit_amount);
put("compare",percentage_yesterday_total_credit);
report.put("total_credit_amount", new JSONObject() {{
put("amount", yesterday_credit_amount);
put("compare", percentage_yesterday_total_credit);
}});
report.put("total_debit_amount",new JSONObject(){{
put("amount",yesterday_debit_amount);
put("compare",percentage_yesterday_debit_amount);
report.put("total_debit_amount", new JSONObject() {{
put("amount", yesterday_debit_amount);
put("compare", percentage_yesterday_debit_amount);
}});
report.put("total_net_trading",new JSONObject(){{
put("amount",yesterday_net_trading);
put("compare",percentage_yesterday_net_trading);
report.put("total_net_trading", new JSONObject() {{
put("amount", yesterday_net_trading);
put("compare", percentage_yesterday_net_trading);
}});
report.put("total_total_surcharge",new JSONObject(){{
put("amount",yesterday_total_surcharge);
put("compare",percentage_yesterday_total_surcharge);
report.put("total_total_surcharge", new JSONObject() {{
put("amount", yesterday_total_surcharge);
put("compare", percentage_yesterday_total_surcharge);
}});
report.put("total_royal_surcharge",new JSONObject(){{
put("amount",yesterday_royal_surcharge);
put("compare",percentage_yesterday_royal_surcharge);
report.put("total_royal_surcharge", new JSONObject() {{
put("amount", yesterday_royal_surcharge);
put("compare", percentage_yesterday_royal_surcharge);
}});
report.put("total_channel_surcharge",new JSONObject(){{
put("amount",yesterday_channel_surcharge);
put("compare",percentage_yesterday_channel_surcharge);
report.put("total_channel_surcharge", new JSONObject() {{
put("amount", yesterday_channel_surcharge);
put("compare", percentage_yesterday_channel_surcharge);
}});
report.put("total_tax_amount",new JSONObject(){{
put("amount",yesterday_tax_amount);
put("compare",percentage_yesterday_tax_amount);
report.put("total_tax_amount", new JSONObject() {{
put("amount", yesterday_tax_amount);
put("compare", percentage_yesterday_tax_amount);
}});
return report;
return report;
}
private JSONObject computerTotalAmount(List<JSONObject> settles){
private JSONObject computerTotalAmount(List<JSONObject> settles) {
BigDecimal total_settle_amount = new BigDecimal("0.00");
BigDecimal total_credit_amount = new BigDecimal("0.00");
BigDecimal total_debit_amount = new BigDecimal("0.00");
@ -286,41 +293,41 @@ public class DailyReportImp implements DailyReport {
BigDecimal total_tax_amount = new BigDecimal("0.00");
DecimalFormat df1 = new DecimalFormat("0.00");
for (int i=0;i<settles.size();i++){
for (int i = 0; i < settles.size(); i++) {
JSONObject jsonObject = settles.get(i);
BigDecimal settle_amount = jsonObject.getBigDecimal("settle_amount");
total_settle_amount = total_settle_amount.add(settle_amount);
jsonObject.put("settle_amount",df1.format(settle_amount));
jsonObject.put("settle_amount", df1.format(settle_amount));
BigDecimal credit_amount = jsonObject.getBigDecimal("credit_amount");
total_credit_amount = total_credit_amount.add(credit_amount);
jsonObject.put("credit_amount",df1.format(credit_amount));
jsonObject.put("credit_amount", df1.format(credit_amount));
BigDecimal debit_amount = jsonObject.getBigDecimal("debit_amount");
total_debit_amount = total_debit_amount.add(debit_amount);
jsonObject.put("debit_amount",df1.format(debit_amount));
jsonObject.put("debit_amount", df1.format(debit_amount));
BigDecimal net_trading = jsonObject.getBigDecimal("net_trading");
total_net_trading = total_net_trading.add(net_trading);
jsonObject.put("net_trading",df1.format(net_trading));
jsonObject.put("net_trading", df1.format(net_trading));
BigDecimal total_surcharge = jsonObject.getBigDecimal("total_surcharge");
total_total_surcharge = total_total_surcharge.add(total_surcharge);
jsonObject.put("total_surcharge",df1.format(total_surcharge));
jsonObject.put("total_surcharge", df1.format(total_surcharge));
BigDecimal royal_surcharge = jsonObject.getBigDecimal("royal_surcharge");
total_royal_surcharge = total_royal_surcharge.add(royal_surcharge);
jsonObject.put("royal_surcharge",df1.format(royal_surcharge));
jsonObject.put("royal_surcharge", df1.format(royal_surcharge));
BigDecimal channel_surcharge = jsonObject.getBigDecimal("channel_surcharge");
total_channel_surcharge = total_channel_surcharge.add(channel_surcharge);
jsonObject.put("channel_surcharge",df1.format(channel_surcharge));
jsonObject.put("channel_surcharge", df1.format(channel_surcharge));
BigDecimal tax_amount = jsonObject.getBigDecimal("tax_amount");
total_tax_amount = total_tax_amount.add(tax_amount);
jsonObject.put("tax_amount",df1.format(tax_amount));
jsonObject.put("tax_amount", df1.format(tax_amount));
}
String finalTotal_settle_amount = df1.format(total_settle_amount);
String finalTotal_credit_amount = df1.format(total_credit_amount);
@ -330,8 +337,8 @@ public class DailyReportImp implements DailyReport {
String finalTotal_royal_surcharge = df1.format(total_royal_surcharge);
String finalTotal_channel_surcharge = df1.format(total_channel_surcharge);
String finalTotal_tax_amount = df1.format(total_tax_amount);
return new JSONObject(){{
put("total_settle_amount",finalTotal_settle_amount);
return new JSONObject() {{
put("total_settle_amount", finalTotal_settle_amount);
put("total_credit_amount", finalTotal_credit_amount);
put("total_debit_amount", finalTotal_debit_amount);
put("total_net_trading", finalTotal_net_trading);
@ -343,28 +350,27 @@ public class DailyReportImp implements DailyReport {
}
private JSONObject percentage(BigDecimal num1, BigDecimal num2) {
boolean positive =true;
boolean positive = true;
double n1 = num1.doubleValue();
double n2 = num2.doubleValue();
if(Double.compare(n2, 0) == 0)
if (Double.compare(n2, 0) == 0)
throw new RuntimeException("输入有误");
double ratio = n1 / n2;
if(ratio<1){
if (ratio < 1) {
positive = false;
}
NumberFormat format = NumberFormat.getPercentInstance();
format.setMaximumFractionDigits(2);
String result=format.format(ratio<1?1-ratio:ratio-1);
String result = format.format(ratio < 1 ? 1 - ratio : ratio - 1);
boolean finalPositive = positive;
return new JSONObject(){{
put("compare",result);
return new JSONObject() {{
put("compare", result);
put("positive", finalPositive);
}};
}
@Override
public JSONObject getReport(String reportId, String openid) {
JSONObject manager = managerMapper.findByWxOpenId(openid);
@ -382,13 +388,14 @@ public class DailyReportImp implements DailyReport {
report.put("report_date", report.getDate("report_date"));
return report;
}
private void publishMessages(List<JSONObject> users, String reportId, String range) {
ArrayList<String> clean_users = new ArrayList<>();
String url = PlatformEnvironment.getEnv().concatUrl("/analysis/daily_reports/" + reportId);
String time = DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm");
for (JSONObject user : users) {
String openId = user.getString("wx_openid");
if(openId!=null && clean_users.contains(openId)){
if (openId != null && clean_users.contains(openId)) {
continue;
}
if (openId != null) {
@ -403,7 +410,7 @@ public class DailyReportImp implements DailyReport {
}
}
}
logger.info("DailyReportUsers"+clean_users.toString());
logger.info("DailyReportUsers" + clean_users.toString());
}
private TemplateMessage initMsg(String range, String url, String time, String openId, String templateId) {

@ -0,0 +1,52 @@
package au.com.royalpay.payment.manage.appclient.beans;
import au.com.royalpay.payment.manage.permission.utils.GeekLoginDESUtil;
import au.com.royalpay.payment.manage.signin.beans.LoginInfo;
import au.com.royalpay.payment.tools.utils.PasswordUtils;
import javax.validation.constraints.NotEmpty;
/**
* Created by yixian on 2016-12-14.
*/
public class ApiClientAccountLoginInfo {
@NotEmpty(message = "error.payment.valid.param_missing")
private String loginId;
@NotEmpty(message = "error.payment.valid.param_missing")
private String password;
public LoginInfo ClientAccountLoginInfo(){
LoginInfo info = new LoginInfo();
info.setLoginId(loginId);
info.setPassword(GeekLoginDESUtil.getDecryptString(password));
return info;
}
public String getPasswordHashed(String salt) {
return PasswordUtils.hashPwd(password, salt);
}
public String getLoginId() {
return loginId.toLowerCase();
}
public void setLoginId(String loginId) {
this.loginId = loginId;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public String toString() {
return "ApiClientAccountLoginInfo{" +
"loginId='" + loginId + '\'' +
", password='" + password + '\'' +
'}';
}
}

@ -48,10 +48,10 @@ public class AppQueryBean {
params.put("from", fromDate.toDate());
}
if (end != null) {
DateTime toDate = DateTime.parse(end, DateTimeFormat.forPattern("yyyyMMdd"))
.withZoneRetainFields(DateTimeZone.forTimeZone(TimeZone.getTimeZone(StringUtils.isNotBlank(timezone)?timezone:"Australia/Melbourne"))).withZone(DateTimeZone.getDefault());
params.put("end", DateUtils.addDays(toDate.toDate(), 1));
params.put("to", DateUtils.addDays(toDate.toDate(), 1));
DateTime toDate = DateTime.parse(end, DateTimeFormat.forPattern("yyyyMMdd")).withZoneRetainFields(DateTimeZone.forTimeZone(TimeZone.getTimeZone(timezone))).plusDays(1).withZone(DateTimeZone.getDefault());
params.put("end", toDate.toDate());
params.put("to", toDate.toDate());
}
if (gateway != null && gateway.length > 0) {
List<Integer> tradeTypes = new ArrayList<>();

@ -0,0 +1,50 @@
package au.com.royalpay.payment.manage.appclient.beans;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class RSvcMchBean {
/**
*
*/
private String merchantNumber;
/**
* partnerCode
*/
private String partnerCode;
/**
* CredentialCode
*/
private String credentialCode;
/**
* HostpayHost
*/
private String payHost;
/**
* logo
*/
private String logo;
/**
*
*/
private String industryCode;
/**
*
*/
private String industryName;
/**
*
*/
private String merchantName;
}

@ -0,0 +1,14 @@
package au.com.royalpay.payment.manage.appclient.core;
import com.alibaba.fastjson.JSONObject;
public interface RetailRSvcService {
/**
* Appservice code
*
* @param device
* @param sourceCode
* @return
*/
JSONObject findMchInfoBySourceCode(JSONObject device, String sourceCode);
}

@ -13,6 +13,7 @@ import au.com.royalpay.payment.manage.appclient.core.RetailAppService;
import au.com.royalpay.payment.manage.appclient.extend.GatewayOAuthRegister;
import au.com.royalpay.payment.manage.cashback.core.CashbackService;
import au.com.royalpay.payment.manage.customers.core.CouponValidateService;
import au.com.royalpay.payment.manage.device.core.DeviceManager;
import au.com.royalpay.payment.manage.fund.core.impls.XPlanFundConfigServiceImpl;
import au.com.royalpay.payment.manage.management.clearing.core.CleanService;
import au.com.royalpay.payment.manage.mappers.client.AuthAppMessageMapper;
@ -209,6 +210,8 @@ public class RetailAppServiceImp implements RetailAppService {
private StringRedisTemplate stringRedisTemplate;
@Resource
private MpClientAppWechatApiProvider mpClientAppWechatApiProvider;
@Resource
private DeviceManager deviceManager;
private final String CBBANK_AGGREGATE_FILE = "https://file.royalpay.com.au/open/2019/08/05/1564972204689_uwZvpTBjtLUMcN8c540xcZvux1Rd3O.pdf";
private final String IMG_AGGREGATE_FILE = "https://file.royalpay.com.au/open/2019/10/22/1571723034726_5xK6A0FGv5aQPbMIDJzXJrUPKHFutv.pdf";
@ -1100,7 +1103,7 @@ public class RetailAppServiceImp implements RetailAppService {
String clientType = device.getString("client_type");
DeviceRegister register = deviceSupport.findRegister(clientType);
register.signout(device);
deviceManager.deviceOffline(device.getString("account_id"));
}
@Override

@ -0,0 +1,65 @@
package au.com.royalpay.payment.manage.appclient.core.impls;
import au.com.royalpay.payment.manage.appclient.beans.RSvcMchBean;
import au.com.royalpay.payment.manage.appclient.core.RetailRSvcService;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.tools.codec.AESCrypt;
import au.com.royalpay.payment.tools.device.DeviceSupport;
import au.com.royalpay.payment.tools.encryptalgorithm.SignUtils;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.mappers.CommonIncrementalChannelMapper;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.parser.Feature;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.net.util.Base64;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.nio.charset.StandardCharsets;
import java.security.Key;
@Service
public class RetailRSvcServiceImpl implements RetailRSvcService {
@Resource
private ClientManager clientManager;
@Resource
private DeviceSupport deviceSupport;
@Resource
private CommonIncrementalChannelMapper commonIncrementalChannelMapper;
@Override
public JSONObject findMchInfoBySourceCode(JSONObject device, String sourceCode) {
String clientType = device.getString("client_type");
deviceSupport.findRegister(clientType);
JSONObject svcInfo = commonIncrementalChannelMapper.findIncreamentalChannelBySourceCode(sourceCode);
if (svcInfo == null || StringUtils.isEmpty(svcInfo.getString("channel_pub_key"))
|| StringUtils.isEmpty(svcInfo.getString("platform_pub_key")) || StringUtils.isEmpty("platform_pri_key")) {
throw new BadRequestException("this channel config is wrong");
}
RSvcMchBean svcMchBean = clientManager.findSvcMchByAccountId(device.getString("account_id"));
String aesKeyStr = Base64.encodeBase64String(AESCrypt.randomKey().getEncoded());
Key key = AESCrypt.fromKeyString(Base64.decodeBase64(aesKeyStr));
JSONObject result = (JSONObject) JSONObject.toJSON(svcMchBean);
result.put("sign_type", "RSA2");
result.put("enc_data", new JSONObject() {
{
put("credentialCode", encData(svcMchBean.getCredentialCode(), key, svcInfo.getString("channel_pub_key")));
put("payHost", encData(svcMchBean.getPayHost(), key, svcInfo.getString("channel_pub_key")));
put("partnerCode", encData(svcMchBean.getPartnerCode(), key, svcInfo.getString("channel_pub_key")));
put("merchantNumber", encData(svcMchBean.getMerchantNumber(), key, svcInfo.getString("channel_pub_key")));
}
});
result.put("nonce_str", aesKeyStr);
result.put("timestamp", System.currentTimeMillis());
result = JSONObject.parseObject(JSON.toJSONString(result), Feature.OrderedField);
result.put("sign", SignUtils.buildSign(result.toJSONString(), svcInfo.getString("platform_pri_key")));
return result;
}
private String encData(String data, Key key, String publicKey) {
String pubKeyEncData = SignUtils.encData(data, publicKey);
return org.apache.commons.codec.binary.Base64.encodeBase64String(AESCrypt.encrypt(pubKeyEncData.getBytes(StandardCharsets.UTF_8), key));
}
}

@ -0,0 +1,79 @@
package au.com.royalpay.payment.manage.appclient.web;
import au.com.royalpay.payment.manage.appclient.beans.ApiClientAccountLoginInfo;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.signin.core.SignInStatusManager;
import au.com.royalpay.payment.manage.signin.events.ClientLoginEvent;
import au.com.royalpay.payment.tools.env.RequestEnvironment;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import au.com.royalpay.payment.manage.permission.utils.GeekLoginDESUtil;
import javax.annotation.Resource;
import javax.validation.Valid;
/**
* @Author DuLingLing
* @create 2019/11/27 0027 14:30
*/
@RestController
@RequestMapping("/api/v1.0/royalpay/client")
public class RetailClientController implements ApplicationEventPublisherAware {
@Resource
private SignInStatusManager signInStatusManager;
@Resource
private ClientManager clientManager;
private ApplicationEventPublisher publisher;
@Override
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
this.publisher = applicationEventPublisher;
}
@PostMapping("/sigIn")
public JSONObject signIn(@RequestBody @Valid ApiClientAccountLoginInfo loginInfo) {
try {
String signKey = signInStatusManager.partnerSignIn(loginInfo.ClientAccountLoginInfo());
JSONObject account = signInStatusManager.getCurrentClient(signKey);
JSONObject clientAllInfo = clientManager.getClientInfo(account.getInteger("client_id"));
publisher.publishEvent(
new ClientLoginEvent(this, account.getIntValue("client_id"), account.getString("account_id"), RequestEnvironment.getClientIp(), "GEEK_PASSWORD"));
return convertResponseClientInfo(clientAllInfo);
} catch (BadRequestException be) {
return responseError(be.getMessage());
} catch (Exception e) {
return responseError(e.getMessage());
}
}
private JSONObject convertResponseClientInfo(JSONObject clientAllInfo) {
JSONObject response = new JSONObject();
response.put("status", "SUCCESS");
JSONObject industryInfo = clientManager.findByLookupCode(clientAllInfo.getString("industry"));
response.put("clientInfo", new JSONObject() {{
put("partner_code", clientAllInfo.getString("client_moniker"));
put("company_name", clientAllInfo.getString("company_name"));
put("logo", clientAllInfo.getString("client_moniker"));
put("gateway_credential", clientAllInfo.getString("credential_code"));
put("industry_code", clientAllInfo.getString("industry"));
put("industry_value", industryInfo.getString("lookup_value"));
}});
return response;
}
private JSONObject responseError(String message) {
JSONObject response = new JSONObject();
response.put("status", "FAIL");
response.put("message", message);
return response;
}
}

@ -0,0 +1,26 @@
package au.com.royalpay.payment.manage.appclient.web;
import au.com.royalpay.payment.manage.appclient.core.RetailRSvcService;
import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.device.advise.AppClientController;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.annotation.Resource;
@AppClientController
@RequestMapping("/api/v1.0/retail/rsvc")
public class RetailRSvcController {
@Resource
private RetailRSvcService retailRSvcService;
@GetMapping(value = "/{source_code}/userinfo")
public JSONObject findUserInfoBySourceCode(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @PathVariable String source_code) {
return retailRSvcService.findMchInfoBySourceCode(device, source_code);
}
}

@ -219,7 +219,6 @@ public class RetailValidationController implements ApplicationEventPublisherAwar
result.put("account",account);
result.put("status","success");
result.put("bind_status", true);
this.publisher.publishEvent(new ClientLoginEvent(this, account.getIntValue("client_id"), account.getString("account_id"), RequestEnvironment.getClientIp(), "MOBILE"));
}else{
result.put("status","success");
@ -254,9 +253,6 @@ public class RetailValidationController implements ApplicationEventPublisherAwar
account = JSON.parseObject(account.toJSONString());
JSONObject result = new JSONObject();
result.put("account",account);
if (params.getString("devId") != null) {
deviceSupport.validDeviceWithClient(account, params.getString("devId"));
}
result.put("bind_status", true);
this.publisher.publishEvent(new ClientLoginEvent(this, account.getIntValue("client_id"), account.getString("account_id"), RequestEnvironment.getClientIp(), "MOBILE"));
return result;
@ -297,9 +293,6 @@ public class RetailValidationController implements ApplicationEventPublisherAwar
params.put("union_id",wechatInfo.getString("union_id"));
retailAppService.updateLoginClientAccountOpenId(account,params);
account = JSON.parseObject(account.toJSONString());
if (params.getString("devId") != null) {
deviceSupport.validDeviceWithClient(account, params.getString("devId"));
}
JSONObject result = new JSONObject();
account.put("sign_key", signKey);
result.put("account",account);

@ -5,6 +5,7 @@ import au.com.royalpay.payment.core.exceptions.InvalidShortIdException;
import au.com.royalpay.payment.core.tasksupport.SettlementSupport;
import au.com.royalpay.payment.manage.management.clearing.core.CleanService;
import au.com.royalpay.payment.manage.mappers.log.*;
import au.com.royalpay.payment.manage.mappers.payment.SysClientIncrementalMapper;
import au.com.royalpay.payment.manage.mappers.payment.TaskManualSettleMapper;
import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper;
import au.com.royalpay.payment.manage.mappers.system.*;
@ -48,6 +49,7 @@ 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.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.joda.time.DateTime;
@ -133,6 +135,8 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
@Resource
private ClearingDistributedSurchargeMapper clearingDistributedSurchargeMapper;
@Resource
private SysClientIncrementalMapper sysClientIncrementalMapper;
@Resource
private Locker locker;
@Resource
@ -727,6 +731,10 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
}
List<JSONObject> transactions = transactionMapper.listTransactionsOfClearingOrder(clearClient.getIntValue("clear_detail_id"),
new PageBounds(Order.formString("order_id.asc")));
for (JSONObject transaction : transactions) {
transaction.put("rate_value",StringUtils.defaultString(sysClientIncrementalMapper.findByChannelAndClientId(transaction.getString("client_id"),transaction.getString("source")) ,"0"));
}
String timezone_client = client.getString("timezone");
if (timezone_client != null) {
transactions.parallelStream().forEach(p -> {
@ -816,6 +824,15 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
font.setFontHeightInPoints((short) 10);
CellStyle analysisStyle = wb.createCellStyle();
analysisStyle.setFont(font);
//红色字体提示
Font font2 = wb.createFont();
font.setBoldweight(Font.BOLDWEIGHT_BOLD);
font2.setFontHeightInPoints((short) 10);
font2.setColor(HSSFColor.RED.index);
CellStyle analysisStyle2 = wb.createCellStyle();
analysisStyle2.setFont(font2);
Sheet sheet = wb.createSheet("Merchant_Settlement_Info_" + DateFormatUtils.format(reportDate, "yyyyMMdd"));
int rowNum = 0;
Row row = sheet.createRow(rowNum);
@ -846,18 +863,36 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
row.createCell(4, Cell.CELL_TYPE_STRING).setCellValue("-");
}
row.createCell(5, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("exchange_rate").setScale(5, BigDecimal.ROUND_DOWN).toPlainString());
row.createCell(6, Cell.CELL_TYPE_STRING).setCellValue(settle.getString("transaction_type"));
cell = row.createCell(6, Cell.CELL_TYPE_STRING);
cell.setCellValue(settle.getString("transaction_type"));
cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type"))?analysisStyle2:null);
row.createCell(7, Cell.CELL_TYPE_STRING).setCellValue(settle.getString("transaction_currency"));
row.createCell(8, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("display_amount") == null ? ""
: settle.getBigDecimal("display_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString());
row.createCell(9, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("transaction_amount") == null ? ""
: settle.getBigDecimal("transaction_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString());
row.createCell(10, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("clearing_amount") == null ? ""
: settle.getBigDecimal("clearing_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString());
cell = row.createCell(8, Cell.CELL_TYPE_STRING);
cell.setCellValue(settle.getBigDecimal("display_amount") == null ? ""
: "Credit".equals(settle.getString("transaction_type"))?
settle.getBigDecimal("display_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString():
"-"+settle.getBigDecimal("display_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString());
cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type"))?analysisStyle2:null);
cell = row.createCell(9, Cell.CELL_TYPE_STRING);
cell.setCellValue(settle.getBigDecimal("transaction_amount") == null ? ""
: "Credit".equals(settle.getString("transaction_type"))?
settle.getBigDecimal("transaction_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString():
"-"+settle.getBigDecimal("transaction_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString());
cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type"))?analysisStyle2:null);
cell = row.createCell(10, Cell.CELL_TYPE_STRING);
cell.setCellValue(settle.getBigDecimal("clearing_amount") == null ? ""
: "Credit".equals(settle.getString("transaction_type"))?
settle.getBigDecimal("clearing_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString():
"-"+settle.getBigDecimal("clearing_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString());
cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type"))?analysisStyle2:null);
row.createCell(11, Cell.CELL_TYPE_STRING).setCellValue(channels.getString(settle.getString("channel")) == null ? ""
: channels.getJSONObject(settle.getString("channel")).getBigDecimal("rate").toPlainString() + "%");
row.createCell(12, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("settle_amount") == null ? ""
: settle.getBigDecimal("settle_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString());
cell = row.createCell(12, Cell.CELL_TYPE_STRING);
cell.setCellValue(settle.getBigDecimal("settle_amount") == null ? ""
: "Credit".equals(settle.getString("transaction_type"))?
settle.getBigDecimal("settle_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString():
"-"+settle.getBigDecimal("settle_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString());
cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type"))?analysisStyle2:null);
row.createCell(13, Cell.CELL_TYPE_STRING).setCellValue(settle.getString("order_detail"));
device = clientDeviceMapper.find(settle.getString("dev_id"));
if (device != null)

@ -30,10 +30,14 @@ public interface OrderMapper {
PageList<JSONObject> listOrders(JSONObject params, PageBounds pagination);
PageList<JSONObject> listIncrementalOrders(JSONObject params, PageBounds pagination);
List<JSONObject> listOrdersNoPage(JSONObject params);
PageList<JSONObject> listOrdersByClients(JSONObject params, PageBounds pagination);
PageList<JSONObject> listIncrementalOrdersByClients(JSONObject params, PageBounds pagination);
JSONObject analysisOrders(JSONObject params);
JSONObject getOrderDetail(@Param("order_id") String orderId);

@ -0,0 +1,25 @@
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 org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* Created by liuxinxin on 2019-11-12.
*/
@AutoMapper(tablename = "sys_client_incremental", pkName = "incremental_id")
public interface SysClientIncrementalMapper {
@Select("SELECT incremental_rate_value FROM sys_client_incremental WHERE channel = #{channel} AND client_id = #{client_id} ")
String findByChannelAndClientId(@Param("client_id") String clientId,@Param("channel") String channel);
@AutoSql(type = SqlType.SELECT)
List<JSONObject> find(@Param("client_id") String clientId);
}

@ -99,4 +99,8 @@ public interface ClientAccountMapper {
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid=1", excludeColumns = {"salt", "password_hash"})
List<JSONObject> findByWechatUnionId(@Param("wx_unionid")String unionId);
@AutoSql(type = SqlType.SELECT)
JSONObject findRSvcClientInfo(@Param("account_id")String accountId);
}

@ -9,6 +9,8 @@ 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;
/**
* Created by yixian on 2016-09-12.
*/
@ -45,4 +47,6 @@ public interface ClientDeviceMapper {
PageList<JSONObject> listDevices(JSONObject params, PageBounds pagination);
void deviceOffline(@Param("account_id") String accountId);
List<JSONObject> listClientDeviceIds(JSONObject params);
}

@ -40,6 +40,8 @@ public interface ClientFilesMapper {
List<JSONObject> findFileByClientAndType(@Param("client_id") int client_id, @Param("file_name") String file_name);
JSONObject getSourceAgreeFilesByClientId(@Param("client_id") int clientId);
void deleteByClientAndFileId(@Param("file_id") String file_id);
void deleteAggreeByClientId(@Param("client_id") int file_id);

@ -0,0 +1,37 @@
package au.com.royalpay.payment.manage.mappers.system;
import cn.yixblog.support.mybatis.autosql.annotations.AdvanceSelect;
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 org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
/**
* @Author DuLingLing
* @create 2019/11/13 0013 14:49
*/
@AutoMapper(tablename = "sys_client_incremental", pkName = "incremental_id", keyGenerator = Jdbc3KeyGenerator.class)
public interface ClientIncrementalMapper {
/**
*
* @param clientId
* @return
*/
@AutoSql(type = SqlType.SELECT)
List<JSONObject> findAllByclientMoniker(@Param("client_id") int clientId);
@AutoSql(type = SqlType.SELECT)
JSONObject findByClinetIdAndChannel(@Param("client_id")int clinet_id, @Param("channel")String channel);
@AutoSql(type = SqlType.INSERT)
void save(JSONObject saveIncrementalService);
@AutoSql(type = SqlType.UPDATE)
void update(JSONObject saveIncrementalService);
}

@ -0,0 +1,18 @@
package au.com.royalpay.payment.manage.mappers.system;
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 org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator;
/**
* @Author DuLingLing
* @create 2019/11/27 0027 16:20
*/
@AutoMapper(tablename = "industry_lookup", pkName = "client_id", keyGenerator = Jdbc3KeyGenerator.class)
public interface IndustryLookupMapper {
@AutoSql(type = SqlType.SELECT)
JSONObject findByLookupCode(@Param("lookup_code") String code);
}

@ -3,6 +3,7 @@ package au.com.royalpay.payment.manage.merchants.core;
import au.com.royalpay.payment.core.exceptions.EmailException;
import au.com.royalpay.payment.manage.appclient.beans.AppClientBean;
import au.com.royalpay.payment.manage.appclient.beans.AppMerchantBean;
import au.com.royalpay.payment.manage.appclient.beans.RSvcMchBean;
import au.com.royalpay.payment.manage.merchants.beans.*;
import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery;
import au.com.royalpay.payment.tools.merchants.beans.QRCodeConfig;
@ -40,7 +41,7 @@ public interface ClientManager {
JSONObject listClients(JSONObject manager, PartnerQuery query);
void exportClients(JSONObject manager,PartnerQuery query,HttpServletResponse resp);
void exportClients(JSONObject manager, PartnerQuery query, HttpServletResponse resp);
JSONObject listClientsByApp(JSONObject manager, AppMerchantBean query);
@ -136,7 +137,7 @@ public interface ClientManager {
void toggleAccountReceiveNoticeByOpenId(String openid, boolean enable);
@Transactional
void togglePayNotice(JSONObject account,String clientMoniker, boolean enable);
void togglePayNotice(JSONObject account, String clientMoniker, boolean enable);
@Transactional
void changeRole(JSONObject manager, String clientMoniker, String accountId, int role);
@ -150,7 +151,7 @@ public interface ClientManager {
JSONObject getAccountByOpenId(String openid);
void updateClientBDUser(JSONObject account,String clientMoniker, int managerId);
void updateClientBDUser(JSONObject account, String clientMoniker, int managerId);
void refreshClientCredentialCode(JSONObject manager, String clientMoniker);
@ -183,13 +184,13 @@ public interface ClientManager {
JSONObject getQRCode(JSONObject manager, String clientMoniker, QRCodeConfig config);
String getQrCodeBoard(JSONObject client, QRCodeConfig config,JSONObject account,String plantform);
String getQrCodeBoard(JSONObject client, QRCodeConfig config, JSONObject account, String plantform);
void writeAggregateQrCodeBoard(JSONObject manager, String clientMoniker, QRCodeConfig config, OutputStream ous,String plantform);
void writeAggregateQrCodeBoard(JSONObject manager, String clientMoniker, QRCodeConfig config, OutputStream ous, String plantform);
void writeCBBankAggregateQrCodeBoard(JSONObject manager, String clientMoniker, OutputStream ous,String plantform);
void writeCBBankAggregateQrCodeBoard(JSONObject manager, String clientMoniker, OutputStream ous, String plantform);
void writeQrCodeBoard(JSONObject manager, String clientMoniker, QRCodeConfig config, OutputStream ous,String plantform);
void writeQrCodeBoard(JSONObject manager, String clientMoniker, QRCodeConfig config, OutputStream ous, String plantform);
void writePoster(JSONObject manager, String clientMoniker, OutputStream ous);
@ -198,10 +199,19 @@ public interface ClientManager {
void writeActivityPoster(JSONObject manager, String clientMoniker, String activityName, OutputStream ous) throws IOException;
@Transactional
void updateTimeZone(JSONObject account,String clientMoniker, String timezone);
void updateTimeZone(JSONObject account, String clientMoniker, String timezone);
JSONObject listClientDevices(JSONObject manager, String clientMoniker, String remark, int page, int limit, String client_type, String[] client_ids);
/**
* Id
* @param clientMoniker
* @param client_type
* @param client_ids
* @return
*/
JSONObject listClientDeviceIds(String clientMoniker, String client_type, String[] client_ids);
void updateDevie(JSONObject manager, String clientMoniker, String devId, String remark);
void toggleDeviceAvailable(JSONObject manager, String clientMoniker, String devId, boolean enable);
@ -210,19 +220,19 @@ public interface ClientManager {
JSONObject getBankInfo(JSONObject manager, String clientMoniker, String bsb_no);
void setMaxOrderAmount(JSONObject account,String clientMoniker, BigDecimal limit);
void setMaxOrderAmount(JSONObject account, String clientMoniker, BigDecimal limit);
void setClientQRCodePaySurCharge(JSONObject account,String clientMoniker, boolean paySurcharge);
void setClientQRCodePaySurCharge(JSONObject account, String clientMoniker, boolean paySurcharge);
void setClientApiPaySurCharge(JSONObject account,String clientMoniker, boolean enableApiSurcharge);
void setClientApiPaySurCharge(JSONObject account, String clientMoniker, boolean enableApiSurcharge);
void setClientRetailPaySurCharge(JSONObject account,String clientMoniker, boolean paySurcharge);
void setClientRetailPaySurCharge(JSONObject account, String clientMoniker, boolean paySurcharge);
void setClientCBBankPaySurCharge(JSONObject account,String clientMoniker, boolean paySurcharge);
void setClientCBBankPaySurCharge(JSONObject account, String clientMoniker, boolean paySurcharge);
void setClientTaxInSurcharge(JSONObject account,String clientMoniker, boolean taxInSurcharge);
void setClientTaxInSurcharge(JSONObject account, String clientMoniker, boolean taxInSurcharge);
void setClientCustomerTaxFree(JSONObject account,String clientMoniker, boolean customerTaxFree);
void setClientCustomerTaxFree(JSONObject account, String clientMoniker, boolean customerTaxFree);
List<JSONObject> listClientsForSettlement();
@ -242,6 +252,8 @@ public interface ClientManager {
JSONObject getAllAuthFiles(JSONObject manager, String clientMoniker);
JSONObject getSourceAgreeFiles(JSONObject manage, String clientMoniker);
void deleteAuthFiles(String fileId);
void deleteAuthFilesByAdmin(String fileId);
@ -280,7 +292,7 @@ public interface ClientManager {
void changeCBBankPaymentPage(JSONObject account, String paypad_version);
void changeManualSettle(JSONObject account , int client_id, boolean manual_settle,String operator_id,int type,String operation);
void changeManualSettle(JSONObject account, int client_id, boolean manual_settle, String operator_id, int type, String operation);
void changeQRCodePaySurcharge(JSONObject account, boolean paySurcharge);
@ -294,37 +306,37 @@ public interface ClientManager {
void changeRequireRemark(JSONObject account, boolean requireRemark);
void changeSurcharge(JSONObject account,JSONObject device, UpdateSurchargeDTO updateSurchargeDTO);
void changeSurcharge(JSONObject account, JSONObject device, UpdateSurchargeDTO updateSurchargeDTO);
void refusePartner(String clientMoniker, JSONObject manager, String refuse_remark);
JSONArray getAllClientIds(int clientId);
void updateAppClient(JSONObject account,int client_id, AppClientBean appClientBean);
void updateAppClient(JSONObject account, int client_id, AppClientBean appClientBean);
void setSkipClearing(JSONObject account,String clientMoniker, Boolean skip_clearing,String remark);
void setSkipClearing(JSONObject account, String clientMoniker, Boolean skip_clearing, String remark);
void setSurchargeMode(JSONObject account, String clientMoniker, String surcharge_mode);
JSONObject surchargeAccount(JSONObject account, String clientMoniker);
void setAllowSurchargeCredit(JSONObject account,String clientMoniker, Boolean allow_surcharge_credit);
void setAllowSurchargeCredit(JSONObject account, String clientMoniker, Boolean allow_surcharge_credit);
List<JSONObject> getAccountTransactions(JSONObject account,String clientMoniker);
List<JSONObject> getAccountTransactions(JSONObject account, String clientMoniker);
List<JSONObject> getAccountDetailByMonths(JSONObject account,String clientMoniker);
List<JSONObject> getAccountDetailByMonths(JSONObject account, String clientMoniker);
List<JSONObject> getAccountTransactionsByDetailId(JSONObject account,String clientMoniker, String detailId);
List<JSONObject> getAccountTransactionsByDetailId(JSONObject account, String clientMoniker, String detailId);
List<JSONObject> getAccountMonthDetails(JSONObject account,String clientMoniker);
List<JSONObject> getAccountMonthDetails(JSONObject account, String clientMoniker);
void saveAccountTransaction(JSONObject account,String clientMoniker, JSONObject transaction);
void saveAccountTransaction(JSONObject account, String clientMoniker, JSONObject transaction);
void enableGatewayUpgrade(JSONObject account,String clientMoniker, boolean gatewayUpgrade);
void enableGatewayUpgrade(JSONObject account, String clientMoniker, boolean gatewayUpgrade);
void enableGatewayAlipayOnline(JSONObject account,String clientMoniker, boolean gatewayAlipayOnline);
void enableGatewayAlipayOnline(JSONObject account, String clientMoniker, boolean gatewayAlipayOnline);
void setCustomerSurchargeRate(JSONObject account,String clientMoniker, BigDecimal customer_surcharge_rate);
void setCustomerSurchargeRate(JSONObject account, String clientMoniker, BigDecimal customer_surcharge_rate);
void setPartnerPublicKeyConfig(JSONObject account, String ipWhitelistConfig);
@ -332,17 +344,17 @@ public interface ClientManager {
void setIpWhitelistConfig(JSONObject account, String ipWhitelistConfig);
void setOrderExpiryConfig(JSONObject account,String clientMoniker, String orderExpiryConfig);
void setOrderExpiryConfig(JSONObject account, String clientMoniker, String orderExpiryConfig);
void getAgreeFile(String clientMoniker, JSONObject manager) throws Exception;
void getAggregateAgreeFile(String clientMoniker, JSONObject manager,boolean renewal) throws Exception;
void getAggregateAgreeFile(String clientMoniker, JSONObject manager, boolean renewal) throws Exception;
void getNewAggregateAgreeFile(String clientMoniker, JSONObject manager,boolean renewal) throws Exception;
void getNewAggregateAgreeFile(String clientMoniker, JSONObject manager, boolean renewal) throws Exception;
void temporaryExportPdf(String clientMoniker, JSONObject manager, HttpServletResponse httpResponse) throws Exception;
void importAgreeFile(String clientMoniker, JSONObject manager, String sourceFile,boolean renewal);
void importAgreeFile(String clientMoniker, JSONObject manager, String sourceFile, boolean renewal);
void completeAgree(String clientMoniker, JSONObject manager);
@ -352,11 +364,20 @@ public interface ClientManager {
JSONObject getSettlementLog(JSONObject manager, String clientMoniker, TradeLogQuery query);
/**
*
*
* @param manager
* @param clientMoniker
* @param query
*/
void excelSettlementLog(JSONObject manager, String clientMoniker, TradeLogQuery query, HttpServletResponse response);
void updateRefundPwd(JSONObject account, String pwd);
void validRefundPwd(JSONObject account, String pwd);
void setWeekendDelay(JSONObject account,String client_moniker,int clientId, boolean delay);
void setWeekendDelay(JSONObject account, String client_moniker, int clientId, boolean delay);
List<JSONObject> listSubMerchantIdApplys(JSONObject manager, String clientMoniker);
@ -364,7 +385,7 @@ public interface ClientManager {
List<JSONObject> listYeepaySubMerchantIdApplys(JSONObject manager, String clientMoniker);
String subMerchantApplication(String clientMoniker, SubMerchantIdApply subMerchantApply,JSONObject manager);
String subMerchantApplication(String clientMoniker, SubMerchantIdApply subMerchantApply, JSONObject manager);
void registerAlipayGms(String clientMoniker, JSONObject manager);
@ -380,25 +401,25 @@ public interface ClientManager {
String queryAlipayOnlineGmsStatus(String clientMoniker, JSONObject manager);
List<JSONObject> listMerchantIds(String clientMoniker,JSONObject manager);
List<JSONObject> listMerchantIds(String clientMoniker, JSONObject manager);
void clearCacheSubMerchantIdApplices(String clientMoniker);
JSONObject getCheckClientInfo(int client_id,String account_id, String channel);
JSONObject getCheckClientInfo(int client_id, String account_id, String channel);
List<JSONObject> getClientSubMerchantIdLogs(String clientMoniker,JSONObject manager);
List<JSONObject> getClientSubMerchantIdLogs(String clientMoniker, JSONObject manager);
void applyToCompliance(String client_moniker, JSONObject account);
void sendVerifyEmail(JSONObject client,String accountId);
void sendVerifyEmail(JSONObject client, String accountId);
JSONObject getWithConfig(int client_id);
List<JSONObject> getClientsByBD(String bd_user);
JSONObject simpleQuery(JSONObject param, int page,int limit);
JSONObject simpleQuery(JSONObject param, int page, int limit);
JSONObject getByEmail(String email, int page, int limit,List<String> ExceptClientIds);
JSONObject getByEmail(String email, int page, int limit, List<String> ExceptClientIds);
void addSub(String client_moniker, JSONObject manager);
@ -406,25 +427,25 @@ public interface ClientManager {
String getShortLink(String client_moniker);
String getGatewayShortLink(String client_moniker,String channel);
String getGatewayShortLink(String client_moniker, String channel);
@Transactional
void switchHfLink(JSONObject manager, String clientMoniker,boolean allow);
void switchHfLink(JSONObject manager, String clientMoniker, boolean allow);
@Transactional
void switchGatewayLink(JSONObject manager, String clientMoniker,String channel,boolean allow);
void switchGatewayLink(JSONObject manager, String clientMoniker, String channel, boolean allow);
void sendHfEmailNotice(JSONObject order);
void sendGatewayEmailNotice(JSONObject order);
void subRpayMerchantApplication(String clientMoniker,JSONObject merchantInfo, JSONObject manager);
void subRpayMerchantApplication(String clientMoniker, JSONObject merchantInfo, JSONObject manager);
void subYeepayMerchantApplication(String clientMoniker,JSONObject merchantInfo, JSONObject manager);
void subYeepayMerchantApplication(String clientMoniker, JSONObject merchantInfo, JSONObject manager);
void subYeepayMerchantAdd(String clientMoniker,JSONObject merchantInfo, JSONObject manager);
void subYeepayMerchantAdd(String clientMoniker, JSONObject merchantInfo, JSONObject manager);
void reSubYeepayMerchantApplication(String clientMoniker,JSONObject merchantInfo, JSONObject manager);
void reSubYeepayMerchantApplication(String clientMoniker, JSONObject merchantInfo, JSONObject manager);
void updateAllPartnerPassword(String clientMoniker);
@ -435,7 +456,7 @@ public interface ClientManager {
*
* @param clientId
*/
boolean postponeClientRate(int clientId, String clientMoniker,String nextYearExipryDate);
boolean postponeClientRate(int clientId, String clientMoniker, String nextYearExipryDate);
JSONObject comListPartnerSelection(JSONObject manager, PartnerQuery query);
@ -464,7 +485,7 @@ public interface ClientManager {
*/
void resetRefundPassword(JSONObject account, JSONObject json);
void resetRefundPasswordByManage(String clientMoniker,JSONObject manage, JSONObject json);
void resetRefundPasswordByManage(String clientMoniker, JSONObject manage, JSONObject json);
List<Integer> listLevel3Client(int client_id);
@ -475,4 +496,41 @@ public interface ClientManager {
JSONObject getClientInfoByAggree(JSONObject account);
JSONObject getComplianceFilesForBD(JSONObject account);
/**
*
*
* @param clientMoniker
* @return
*/
JSONObject partnerIncrementalService(String clientMoniker);
/**
* /
*
* @param clientMoniker
* @param incrementalService
*/
void changePartnerIncrementalService(String clientMoniker, JSONObject incrementalService, JSONObject manager);
/**
* /
*
* @param clientMoniker
* @param incrementalService
*/
void changeSwitchIncrementalService(String clientMoniker, JSONObject incrementalService, JSONObject manager);
/**
*
*
* @param clientMoniker
* @return
*/
JSONObject partnerIncrementalServiceInfo(String clientMoniker, String incrementalId);
JSONObject findByLookupCode(String code);
RSvcMchBean findSvcMchByAccountId(String accountId);
}

@ -17,6 +17,8 @@ import au.com.royalpay.payment.core.PaymentChannelApi;
import au.com.royalpay.payment.core.exceptions.EmailException;
import au.com.royalpay.payment.core.exceptions.InvalidShortIdException;
import au.com.royalpay.payment.core.mappers.SysClientMapper;
import au.com.royalpay.payment.manage.appclient.beans.RSvcMchBean;
import au.com.royalpay.payment.tools.defines.IncrementalChannel;
import au.com.royalpay.payment.core.utils.OrderExpiryRuleResolver;
import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper;
import au.com.royalpay.payment.manage.appclient.beans.AppClientBean;
@ -88,6 +90,11 @@ 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.apache.poi.hssf.usermodel.*;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.dom4j.Element;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -122,11 +129,13 @@ import java.math.RoundingMode;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLDecoder;
import java.security.*;
import java.security.InvalidParameterException;
import java.security.KeyPair;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.util.List;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
@ -162,6 +171,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
private StringRedisTemplate stringRedisTemplate;
@Resource
private ClientComplianceApply clientComplianceApply;
@Resource
private ClientIncrementalMapper clientIncrementalMapper;
@Value("${app.redis.prefix}")
private String redisPrefix;
@ -267,8 +278,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Resource
private ClientConfigMapper clientConfigMapper;
@Resource
private PermissionPartnerModuleMapper permissionPartnerModuleMapper;
@Resource
private PermissionPartnerManagerImpl permissionPartnerManagerImpl;
@Resource
private RiskAttentionMerchantsMapper riskAttentionMerchantsMapper;
@ -294,6 +303,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
private MongoTemplate mongoTemplate;
@Resource
private ClientComplianceCompanyMapper clientComplianceCompanyMapper;
@Resource
private IndustryLookupMapper industryLookupMapper;
@Resource
@ -356,7 +367,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (manager != null) {
checkClientOrg(manager, client);
}
String same_phone = clientMapper.findSamePhone(client.getString("contact_phone")).getString("a");
if (same_phone != null && client.getString("contact_phone") != null && same_phone.contains(" ")) {
same_phone = same_phone.replace(client.getString("client_moniker"), "");
@ -1580,7 +1590,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
private void checkPhoneAndWechatExist(NewAccountBean account) {
List<JSONObject> accounts = clientAccountMapper.findByPhone(account.getContactPhone(), account.getNation_code().startsWith("+") ? account.getNation_code() : "+" + account.getNation_code());
if ( accounts != null && accounts.size()>0) {
if (accounts != null && accounts.size() > 0) {
throw new BadRequestException("Mobile phone number has been bound to other accounts");
}
}
@ -1653,13 +1663,13 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (account == null) {
throw new BadRequestException("account not exists");
}
if(user.getString("openid")!=null && !"".equals(user.getString("openid"))) {
if (user.getString("openid") != null && !"".equals(user.getString("openid"))) {
if (clientAccountMapper.findByWechatOpenId(user.getString("openid")).size() > 0) {
throw new BadRequestException("The WeChat has been linked to other accounts");
}
}
if(user.getString("unioinid")!=null && !"".equals(user.getString("unioinid"))){
if(clientAccountMapper.findByWechatUnionId(user.getString("unioinid")).size()>0 ){
if (user.getString("unioinid") != null && !"".equals(user.getString("unioinid"))) {
if (clientAccountMapper.findByWechatUnionId(user.getString("unioinid")).size() > 0) {
throw new BadRequestException("The WeChat has been linked to other accounts");
}
}
@ -2563,6 +2573,27 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
return PageListUtils.buildPageListResult(devices);
}
@Override
public JSONObject listClientDeviceIds(String clientMoniker, String client_type, String[] client_ids) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
checkOrgPermission(null, client);
JSONObject params = new JSONObject();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
sdf.setTimeZone(TimeZone.getTimeZone(client.getString("timezone") != null ? client.getString("timezone") : "Australia/Melbourne"));
params.put("client_id", client.getIntValue("client_id"));
if (client_ids != null) {
params.put("client_ids", Arrays.asList(client_ids));
params.remove("client_id");
}
List<JSONObject> deviceIds = clientDeviceMapper.listClientDeviceIds(params);
return new JSONObject(){{
put("data",deviceIds);
}};
}
@Override
@Transactional
public void addDevice(JSONObject manager, String clientMoniker, JSONObject newDevice) {
@ -3353,6 +3384,17 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
return fileJson;
}
@Override
public JSONObject getSourceAgreeFiles(JSONObject manage, String clientMoniker) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
JSONObject sourceFile = clientFilesMapper.getSourceAgreeFilesByClientId(client.getIntValue("client_id"));
sourceFile.put(sourceFile.getString("file_name"), sourceFile.getString("file_value"));
return sourceFile;
}
@Override
public JSONObject getAllAuthFiles(JSONObject manager, String clientMoniker) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
@ -3382,7 +3424,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
return fileJson;
}
@Override
public JSONObject getClientViewAuthFiles(JSONObject manager, String clientMoniker) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
@ -3414,8 +3455,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
;
@Override
public void deleteAuthFiles(String fileId) {
JSONObject file = clientFilesMapper.findFileById(fileId);
@ -3676,6 +3715,147 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
return result;
}
@Override
public void excelSettlementLog(JSONObject manager, String clientMoniker, TradeLogQuery query,HttpServletResponse response) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
int client_id = client.getIntValue("client_id");
String timezone = client.getString("timezone");
if (query.getDatefrom() == null) {
JSONObject earlistOrder = transactionAnalysisMapper.getEarliestOrder(client_id);
if (earlistOrder != null) {
query.setDatefrom(DateFormatUtils.format(earlistOrder.getDate("transaction_time"), "yyyyMMdd"));
query.setDateto(DateFormatUtils.format(new Date(), "yyyyMMdd"));
}
}
if(query.getClient_ids()!=null){
if(query.getClient_ids().length>1){
query.setClient_ids(null);
}
}
JSONObject params = query.toParams(timezone);
params.put("client_id", client_id);
PageList<JSONObject> logs = transactionMapper.listSettlementLog(params, new PageBounds(query.getPage(), 10000, Order.formString("clearing_time.desc")));
//Excel 多sheet导出
try (HSSFWorkbook workbook = new HSSFWorkbook()) {
if(query.getClient_ids() ==null){
addSheet(0,workbook,client,logs);
List<JSONObject> childs = clientMapper.listChildClients(client.getIntValue("client_id"));
for (int i=0;i<childs.size();i++){
params.put("client_id", childs.get(i).getInteger("client_id"));
PageList<JSONObject> childLogs = transactionMapper.listSettlementLog(params, new PageBounds(query.getPage(), 10000, Order.formString("clearing_time.desc")));
if(childLogs.size()>0){
addSheet(i+1,workbook, childs.get(i),childLogs);
}
}
}else{
JSONObject chlidClient = clientMapper.findClient(Integer.parseInt(query.getClient_ids()[0]));
addSheet(0,workbook,chlidClient,logs);
}
String fileName = "Settlement Log - "+ (query.getDatefrom() + "~" + query.getDateto() );
response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xls");
OutputStream outputStream = response.getOutputStream();
try {
workbook.write(outputStream);
outputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
} catch (IOException e) {
e.printStackTrace();
}
}
private void addSheet(int sheetNum,HSSFWorkbook workbook,JSONObject client,List<JSONObject> logs){
HSSFSheet sheet = workbook.createSheet();
workbook.setSheetName(sheetNum,client.getString("client_moniker")+"_excel");
sheet.setDefaultColumnWidth((short) 40);
HSSFCellStyle style = workbook.createCellStyle();
style.setFillForegroundColor(HSSFColor.LIGHT_ORANGE.index);
style.setFillPattern(CellStyle.SOLID_FOREGROUND);
style.setBorderBottom(CellStyle.BORDER_THIN);
style.setBorderLeft(CellStyle.BORDER_THIN);
style.setBorderRight(CellStyle.BORDER_THIN);
style.setBorderTop(CellStyle.BORDER_THIN);
style.setAlignment(CellStyle.ALIGN_CENTER);
HSSFFont font = workbook.createFont();
font.setFontHeightInPoints((short) 16);
font.setBoldweight(Font.BOLDWEIGHT_BOLD);
style.setFont(font);
HSSFCellStyle style2 = workbook.createCellStyle();
style2.setFillForegroundColor(HSSFColor.WHITE.index);
style2.setFillPattern(CellStyle.SOLID_FOREGROUND);
style2.setBorderBottom(CellStyle.BORDER_THIN);
style2.setBorderLeft(CellStyle.BORDER_THIN);
style2.setBorderRight(CellStyle.BORDER_THIN);
style2.setBorderTop(CellStyle.BORDER_THIN);
style2.setAlignment(CellStyle.ALIGN_CENTER);
HSSFFont font2 = workbook.createFont();
// font.setColor(HSSFColor.VIOLET.index);
font2.setFontHeightInPoints((short) 12);
font2.setBoldweight(Font.BOLDWEIGHT_NORMAL);
// 把字体应用到当前的样式
style2.setFont(font2);
HSSFRow row0 = sheet.createRow(0);
HSSFCell cell00 = row0.createCell(0);
HSSFCell cell01 = row0.createCell(1);
HSSFCell cell02 = row0.createCell(2);
HSSFCell cell03 = row0.createCell(3);
HSSFCell cell04 = row0.createCell(4);
HSSFCell cell05 = row0.createCell(5);
cell00.setCellStyle(style);
cell01.setCellStyle(style);
cell02.setCellStyle(style);
cell03.setCellStyle(style);
cell04.setCellStyle(style);
cell05.setCellStyle(style);
HSSFRichTextString text00 = new HSSFRichTextString("Short Name");
HSSFRichTextString text01 = new HSSFRichTextString("Client Moniker");
HSSFRichTextString text02 = new HSSFRichTextString("Settle Time");
HSSFRichTextString text03 = new HSSFRichTextString("Transaction Amount");
HSSFRichTextString text04 = new HSSFRichTextString("to Merchant");
HSSFRichTextString text05 = new HSSFRichTextString("Service Fee");
cell00.setCellValue(text00);
cell01.setCellValue(text01);
cell02.setCellValue(text02);
cell03.setCellValue(text03);
cell04.setCellValue(text04);
cell05.setCellValue(text05);
for (int i = 0; i < logs.size(); i++) {
HSSFRow row = sheet.createRow(i + 1);
HSSFCell cell0 = row.createCell(0);
HSSFCell cell1 = row.createCell(1);
HSSFCell cell2 = row.createCell(2);
HSSFCell cell3 = row.createCell(3);
HSSFCell cell4 = row.createCell(4);
HSSFCell cell5 = row.createCell(5);
cell0.setCellStyle(style2);
cell1.setCellStyle(style2);
cell2.setCellStyle(style2);
cell3.setCellStyle(style2);
cell4.setCellStyle(style2);
cell5.setCellStyle(style2);
JSONObject dataItem = logs.get(i);
HSSFRichTextString text0 = new HSSFRichTextString(client.getString("short_name"));
HSSFRichTextString text1 = new HSSFRichTextString(client.getString("client_moniker"));
HSSFRichTextString text2 = new HSSFRichTextString(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format( dataItem.getDate("report_date")));
HSSFRichTextString text3 = new HSSFRichTextString(dataItem.getBigDecimal("total").setScale(2, BigDecimal.ROUND_HALF_DOWN).toString());
HSSFRichTextString text4 = new HSSFRichTextString(dataItem.getBigDecimal("income").setScale(2, BigDecimal.ROUND_HALF_DOWN).toString());
HSSFRichTextString text5 = new HSSFRichTextString(dataItem.getBigDecimal("fee").setScale(2, BigDecimal.ROUND_HALF_DOWN).toString());
cell0.setCellValue(text0);
cell1.setCellValue(text1);
cell2.setCellValue(text2);
cell3.setCellValue(text3);
cell4.setCellValue(text4);
cell5.setCellValue(text5);
}
}
public void updateSysClientFiles(JSONObject manager, int clientId, String fileType, String fileValue) {
if (fileValue != null) {
JSONObject fileJson = new JSONObject();
@ -5891,4 +6071,123 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
return key;
}
@Override
public JSONObject partnerIncrementalService(String clientMoniker) {
JSONObject client = clientMapper.findClientByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
List<JSONObject> service = clientIncrementalMapper.findAllByclientMoniker(client.getInteger("client_id"));
List<String> incrementalChannels = new ArrayList<>();
for (IncrementalChannel e : IncrementalChannel.values()) {
boolean exist = false;
for (JSONObject s : service) {
exist = e.getChannel().equals(s.getString("channel"));
if (exist) {
break;
}
}
if (!exist) {
incrementalChannels.add(e.getChannel());
}
}
incrementalChannels.remove("system");
return new JSONObject() {{
put("all_service", service);
put("incremental_channel", incrementalChannels);
}};
}
@Override
public JSONObject partnerIncrementalServiceInfo(String clientMoniker,String channel){
JSONObject client = clientMapper.findClientByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
JSONObject incrementalInfo = clientIncrementalMapper.findByClinetIdAndChannel(client.getInteger("client_id"), channel);
if(incrementalInfo==null){
throw new BadRequestException("Merchant service not opened");
}
return incrementalInfo;
}
@Override
public void changePartnerIncrementalService(String clientMoniker, JSONObject incrementalService, JSONObject manager) {
JSONObject client = clientMapper.findClientByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
JSONObject existIncrementalService = clientIncrementalMapper.findByClinetIdAndChannel(client.getInteger("client_id"), incrementalService.getString("channel"));
JSONObject saveIncrementalService = new JSONObject();
if (existIncrementalService == null) {
saveIncrementalService.put("incremental_id", UUID.randomUUID().toString());
saveIncrementalService.put("channel", incrementalService.getString("channel"));
saveIncrementalService.put("create_time", new Date());
saveIncrementalService.put("update_time", new Date());
saveIncrementalService.put("is_valid", 1);
} else {
saveIncrementalService.put("incremental_id", incrementalService.getString("incremental_id"));
saveIncrementalService.put("update_time", new Date());
}
saveIncrementalService.put("client_id", client.getInteger("client_id"));
saveIncrementalService.put("operator", manager.getString("display_name"));
saveIncrementalService.put("incremental_mode", incrementalService.getInteger("incremental_mode"));
saveIncrementalService.put("incremental_rate_value", incrementalService.getInteger("incremental_mode") == 1 ? incrementalService.getString("incremental_rate_value") : 0);
saveIncrementalService.put("total_incremental_amount", incrementalService.getInteger("incremental_mode") != 1 ? incrementalService.getString("total_incremental_amount") : 0);
if (existIncrementalService == null) {
clientIncrementalMapper.save(saveIncrementalService);
} else {
clientIncrementalMapper.update(saveIncrementalService);
}
}
@Override
public void changeSwitchIncrementalService(String clientMoniker, JSONObject incrementalService, JSONObject manager) {
JSONObject client = clientMapper.findClientByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
JSONObject existIncrementalService = clientIncrementalMapper.findByClinetIdAndChannel(client.getInteger("client_id"), incrementalService.getString("channel"));
if (existIncrementalService == null) {
throw new BadRequestException("Incremental service is not exist");
}
existIncrementalService.put("update_time", new Date());
existIncrementalService.put("incremental_id", incrementalService.getString("incremental_id"));
existIncrementalService.put("is_valid", incrementalService.getInteger("is_valid"));
existIncrementalService.put("operator", manager.getString("display_name"));
clientIncrementalMapper.update(existIncrementalService);
}
@Override
public JSONObject findByLookupCode(String code) {
JSONObject industryInfo = industryLookupMapper.findByLookupCode(code);
if (industryInfo == null) {
return new JSONObject() {{
put("lookup_code", "code");
put("lookup_value", "未知行业");
}};
}
return industryInfo;
}
@Override
public RSvcMchBean findSvcMchByAccountId(String accountId) {
JSONObject mchInfo = clientAccountMapper.findRSvcClientInfo(accountId);
if (mchInfo == null || mchInfo.isEmpty()) {
throw new BadRequestException("Client Not Exists!");
}
RSvcMchBean svcMchBean = new RSvcMchBean();
svcMchBean.setMerchantNumber(mchInfo.getString("username"));
svcMchBean.setMerchantName(mchInfo.getString("short_name"));
svcMchBean.setPartnerCode(mchInfo.getString("client_moniker"));
svcMchBean.setCredentialCode(mchInfo.getString("credential_code"));
svcMchBean.setPayHost(PlatformEnvironment.getEnv().mainHost());
svcMchBean.setLogo(mchInfo.getString("logo_url"));
svcMchBean.setIndustryCode(mchInfo.getString("industry"));
svcMchBean.setIndustryName(findByLookupCode(mchInfo.getString("industry")).getString("lookup_value"));
return svcMchBean;
}
}

@ -4,6 +4,7 @@ import au.com.royalpay.payment.manage.dev.core.MerchantLocationService;
import au.com.royalpay.payment.manage.merchants.beans.*;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.manage.permission.manager.PartnerMapping;
import au.com.royalpay.payment.manage.permission.manager.RequireManager;
import au.com.royalpay.payment.manage.pos.datasource.ReadOnlyConnection;
import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery;
@ -538,7 +539,7 @@ public class PartnerManageController {
@ManagerMapping(value = "/{clientMoniker}/file/source_agree_file", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.BD_USER, ManagerRole.SERVANT})
public JSONObject getSourceAgreeAuthFiles(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return clientManager.getAuthFiles(manager, clientMoniker);
return clientManager.getSourceAgreeFiles(manager, clientMoniker);
}
@ManagerMapping(value = "/auth_file/{fileId}/delete", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.BD_USER})
@ -619,6 +620,12 @@ public class PartnerManageController {
return clientManager.getSettlementLog(manager, clientMoniker, query);
}
@GetMapping(value = "/{clientMoniker}/lists_settlements/excel")
@ReadOnlyConnection
public void excelSettlements(@PathVariable String clientMoniker, TradeLogQuery query, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,HttpServletResponse response){
clientManager.excelSettlementLog(manager, clientMoniker, query,response);
}
@ManagerMapping(value = "/{clientMoniker}/requireCustinfo", method = RequestMethod.POST, role = {ManagerRole.OPERATOR, ManagerRole.BD_USER})
public void switchRequireCustinfoPermission(@PathVariable String clientMoniker, @RequestBody JSONObject pass, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.switchPermission(manager, clientMoniker, "require_custinfo", pass.getBooleanValue("allow"));
@ -809,4 +816,34 @@ public class PartnerManageController {
public void switchPartnerCBChannelConfig(@PathVariable String clientMoniker, @PathVariable String channelKey, @RequestBody JSONObject channel) {
clientManager.partnerCBChannelConfig(clientMoniker, channelKey, channel.getString("channel_id"));
}
/**
*
* @param clientMoniker
* @return
*/
@ManagerMapping(value = "/{clientMoniker}/incremental_service", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR})
public JSONObject getClientIncrementalService(@PathVariable String clientMoniker){
return clientManager.partnerIncrementalService(clientMoniker);
}
/**
* /
* @param clientMoniker
* @param incrementalService
*/
@ManagerMapping(value = "/{clientMoniker}/incremental_service", method = RequestMethod.POST, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR})
public void updateClientIncrementalService(@PathVariable("clientMoniker") String clientMoniker,@RequestBody JSONObject incrementalService, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager){
clientManager.changePartnerIncrementalService(clientMoniker,incrementalService,manager);
}
/**
* /
* @param clientMoniker
* @param incrementalService
*/
@ManagerMapping(value = "/{clientMoniker}/incremental_service/status", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR})
public void switchClientIncrementalService(@PathVariable("clientMoniker") String clientMoniker,@RequestBody JSONObject incrementalService, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager){
clientManager.changeSwitchIncrementalService(clientMoniker,incrementalService,manager);
}
}

@ -301,6 +301,12 @@ public class PartnerViewController {
return tradeLogService.listPartnerTradeLogs(null, account, account.getString("client_moniker"), query, account.getJSONObject("client").getString("timezone"));
}
@PartnerMapping(value = "/incremental_trade_logs", method = RequestMethod.GET)
@ResponseBody
public JSONObject listIncrementalTradeLogs(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account, TradeLogQuery query) throws Exception {
return tradeLogService.listPartnerIncrementalTradeLogs(null, account, account.getString("client_moniker"), query, account.getJSONObject("client").getString("timezone"));
}
@PartnerMapping(value = "/trade_logs/{orderId}", method = RequestMethod.GET)
@ResponseBody
public JSONObject getOrderDetail(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account, @PathVariable String orderId) {
@ -358,6 +364,13 @@ public class PartnerViewController {
return clientManager.listClientDevices(null, account.getString("client_moniker"), remark, page, limit, client_type, client_ids);
}
@PartnerMapping(value = "/device_ids", method = RequestMethod.GET, roles = PartnerRole.ADMIN)
@ResponseBody
public JSONObject listClientDeviceIds(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account,
@RequestParam(required = false) String client_type, @RequestParam(required = false) String[] client_ids) {
return clientManager.listClientDeviceIds(account.getString("client_moniker"), client_type, client_ids);
}
@PartnerMapping(value = "/devices/{devId}", method = RequestMethod.PUT, roles = PartnerRole.ADMIN)
@ResponseBody
public void modifyDevice(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account, @PathVariable String devId, @RequestBody JSONObject remark) {
@ -602,4 +615,28 @@ public class PartnerViewController {
public void deleteAuthFiles(@PathVariable String fileId, @ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account) {
clientManager.deleteAuthFiles(fileId);
}
/**
*
* @param clientMoniker
* @return
*/
@PartnerMapping(value = "/{clientMoniker}/incremental_service", method = RequestMethod.GET, roles = {PartnerRole.ADMIN, PartnerRole.MANAGER})
@ResponseBody
public JSONObject getClientIncrementalService(@PathVariable String clientMoniker){
return clientManager.partnerIncrementalService(clientMoniker);
}
/**
*
* @param clientMoniker
* @param channel
* @return
*/
@PartnerMapping(value = "/{clientMoniker}/incremental_service/{channel}/info", method = RequestMethod.GET, roles = {PartnerRole.ADMIN, PartnerRole.MANAGER})
@ResponseBody
public JSONObject getClientIncrementalServiceInfo(@PathVariable("clientMoniker") String clientMoniker, @PathVariable("channel") String channel){
return clientManager.partnerIncrementalServiceInfo(clientMoniker,channel);
}
}

@ -0,0 +1,70 @@
package au.com.royalpay.payment.manage.permission.utils;
import java.security.Key;
import java.security.SecureRandom;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import org.apache.commons.codec.binary.Base64;
/**
* @Author DuLingLing
* @create 2019/11/27 0027 18:32
*/
public class GeekLoginDESUtil {
private static Key key;
//设置秘钥key
private static String KEY_STR="GEEKPAYMENT";
private static String CHARSETNAME="UTF-8";
private static String ALGORITHM="DES";
static{
try{
KeyGenerator generator=KeyGenerator.getInstance(ALGORITHM);
SecureRandom secureRandom=SecureRandom.getInstance("SHA1PRNG");
secureRandom.setSeed(KEY_STR.getBytes());
generator.init(secureRandom);
key=generator.generateKey();
generator=null;
}catch(Exception e){
throw new RuntimeException(e);
}
}
/**
*
* @param str
* @return
*/
public static String getEncryptString(String str){
try {
byte[] bytes = str.getBytes(CHARSETNAME);
Cipher cipher = Cipher.getInstance(ALGORITHM);
cipher.init(Cipher.ENCRYPT_MODE, key);
byte[] doFinal = cipher.doFinal(bytes);
return Base64.encodeBase64String(doFinal);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
/**
*
*
* @param str
* @return
*/
public static String getDecryptString(String str) {
try {
byte[] bytes = Base64.decodeBase64(str);
Cipher cipher = Cipher.getInstance(ALGORITHM);
cipher.init(Cipher.DECRYPT_MODE, key);
byte[] doFinal = cipher.doFinal(bytes);
return new String(doFinal, CHARSETNAME);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}

@ -60,7 +60,6 @@ public class SignInController {
private ManagerTodoNoticeProvider[] managerTodoNoticeProviders;
@Resource
private ClientManager clientManager;
@Resource
private ManagerAccountsService managerAccountsService;
@ -191,6 +190,7 @@ public class SignInController {
@PartnerMapping(value = "/current_partner", method = RequestMethod.GET)
public JSONObject partnerLoginStatus(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner) {
partner.put("has_incremental_setvice",clientManager.partnerIncrementalService(partner.getString("client_moniker")).getJSONArray("all_service").size()>0);
return partner;
}

@ -2,16 +2,15 @@ package au.com.royalpay.payment.manage.tradelog.beans;
import au.com.royalpay.payment.core.beans.OrderStatus;
import au.com.royalpay.payment.core.beans.PayChannel;
import au.com.royalpay.payment.core.exceptions.ParamInvalidException;
import au.com.royalpay.payment.tools.defines.TradeType;
import au.com.royalpay.payment.tools.utils.TimeZoneUtils;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.joda.time.format.DateTimeFormat;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
@ -29,6 +28,7 @@ public class TradeLogQuery {
private String datefrom;
private String dateto;
private int[] gateway;
private String source = "ALL" ;
private OrderStatus status = OrderStatus.PAID;
private PayChannel channel = PayChannel.ALL;
private String[] client_ids;
@ -40,22 +40,28 @@ public class TradeLogQuery {
private String org_id;
private String org_id2;
public Integer getGatewayChild() {
return gatewayChild;
}
public void setGatewayChild(Integer gatewayChild) {
this.gatewayChild = gatewayChild;
}
private Integer gatewayChild;
public JSONObject toParams(String timezone) {
JSONObject params = new JSONObject();
if (datefrom != null) {
try {
params.put("from", TimeZoneUtils.formatTime(format.parse(datefrom),"yyyy-MM-dd HH:mm:ss",timezone!=null?timezone:"Australia/Melbourne"));
} catch (ParseException e) {
throw new ParamInvalidException("datefrom", "error.payment.valid.invalid_date_format");
}
DateTime fromDate = DateTime.parse(datefrom, DateTimeFormat.forPattern("yyyyMMdd"))
.withZoneRetainFields(DateTimeZone.forTimeZone(TimeZone.getTimeZone(StringUtils.isNotBlank(timezone) ? timezone : "Australia/Melbourne"))).withZone(DateTimeZone.getDefault());
params.put("from", fromDate.toDate());
}
if (dateto != null) {
try {
params.put("to", TimeZoneUtils.formatTime(DateUtils.addDays(format.parse(dateto), 1),"yyyy-MM-dd HH:mm:ss",timezone!=null?timezone:"Australia/Melbourne"));
} catch (ParseException e) {
throw new ParamInvalidException("dateto", "error.payment.valid.invalid_date_format");
}
DateTime toDate = DateTime.parse(dateto, DateTimeFormat.forPattern("yyyyMMdd")).withZoneRetainFields(DateTimeZone.forTimeZone(TimeZone.getTimeZone(StringUtils.isNotBlank(timezone) ? timezone : "Australia/Melbourne"))).plusDays(1).withZone(DateTimeZone.getDefault());
params.put("to", toDate.toDate());
}
if (StringUtils.isNotBlank(searchText)) {
params.put("search_text", searchText);
if (StringUtils.isNotBlank(textType)) {
@ -79,6 +85,8 @@ public class TradeLogQuery {
if (client_ids != null) {
params.put("client_ids", client_ids);
}
params.put("source", source);
params.put("status", status.getStatus());
params.put("channel", channel.getChannels());
@ -237,4 +245,12 @@ public class TradeLogQuery {
public void setorg_id2(String org_id2) {
this.org_id2 = org_id2;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
}

@ -14,8 +14,12 @@ import java.util.List;
public interface TradeLogService {
JSONObject listPartnerTradeLogs(JSONObject manager, JSONObject account, String clientMoniker, TradeLogQuery query, String timezone) throws Exception;
JSONObject listPartnerIncrementalTradeLogs(JSONObject manager, JSONObject account, String clientMoniker, TradeLogQuery query, String timezone) throws Exception;
JSONObject listAllTradeLogs(TradeLogQuery query, JSONObject manager);
JSONObject listAllIncrementalTradeLogs(TradeLogQuery query, JSONObject manager);
List<JSONObject> listOrderRefunds(String orderId, String timezone);
void getOrderDetail(Model model, String clientMoniker, String orderId, String openid);
@ -38,6 +42,8 @@ public interface TradeLogService {
JSONObject listSettlementLog(TradeLogQuery query, JSONObject partner);
void listSettlementLogExcel(TradeLogQuery query, JSONObject partner,HttpServletResponse response);
Double getClientUnClearedAmount(JSONObject partner);
void exportTransLog(TradeLogQuery query, JSONObject manager, HttpServletResponse httpResponse);

@ -13,10 +13,7 @@ import au.com.royalpay.payment.manage.mappers.client.ClientCustomersMapper;
import au.com.royalpay.payment.manage.mappers.log.ClearingDetailMapper;
import au.com.royalpay.payment.manage.mappers.log.ClearingLogMapper;
import au.com.royalpay.payment.manage.mappers.payment.*;
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientDeviceMapper;
import au.com.royalpay.payment.manage.mappers.system.CustomerMapper;
import au.com.royalpay.payment.manage.mappers.system.ManagerCustomerRelationAlipayMapper;
import au.com.royalpay.payment.manage.mappers.system.*;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.organizations.core.OrgManager;
import au.com.royalpay.payment.manage.tradelog.beans.PreRefundQueryBean;
@ -112,6 +109,8 @@ public class TradeLogServiceImpl implements TradeLogService {
@Resource
private ManagerCustomerRelationAlipayMapper managerCustomerRelationAlipayMapper;
@Resource
private SysClientIncrementalMapper sysClientIncrementalMapper;
@Resource
private ClientCustomersMapper clientCustomersMapper;
@Resource
private ClearingLogMapper clearingLogMapper;
@ -119,6 +118,8 @@ public class TradeLogServiceImpl implements TradeLogService {
private StringRedisTemplate stringRedisTemplate;
@Resource
private OrgManager orgManager;
@Resource
private ClientMapper clientMapper;
@Resource
private ClientDeviceMapper clientDeviceMapper;
@ -149,6 +150,9 @@ public class TradeLogServiceImpl implements TradeLogService {
if (manager != null && manager.getInteger("org_id") != null) {
params.put("org_id", manager.getIntValue("org_id"));
}
if(query.getGatewayChild()!=null){
params.put("trade_type",new ArrayList<Integer>(){{add(query.getGatewayChild());}});
}
PageList<JSONObject> logs = orderMapper.listOrdersByClients(params,
new PageBounds(query.getPage(), query.getLimit(), Order.formString("create_time.desc")));
if (timezone != null) {
@ -168,6 +172,42 @@ public class TradeLogServiceImpl implements TradeLogService {
return result;
}
@Override
public JSONObject listPartnerIncrementalTradeLogs(JSONObject manager, JSONObject account, String shortId, TradeLogQuery query, String timezone) throws Exception {
JSONObject client = clientManager.getClientInfoByMoniker(shortId);
if (client == null) {
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
JSONObject params = query.toParams(timezone);
clientManager.validateClients(client.getIntValue("client_id"), params);
params.put("client_id", client.getIntValue("client_id"));
if (manager != null && manager.getInteger("org_id") != null) {
params.put("org_id", manager.getIntValue("org_id"));
}
if(query.getGatewayChild()!=null){
params.put("trade_type",new ArrayList<Integer>(){{add(query.getGatewayChild());}});
}
PageList<JSONObject> logs = orderMapper.listIncrementalOrdersByClients(params,
new PageBounds(query.getPage(), query.getLimit(), Order.formString("create_time.desc")));
if (timezone != null) {
TimeZoneUtils.switchTimeZone(logs, timezone, "create_time", "confirm_time", "transaction_time");
}
if (account != null) {
PartnerRole role = PartnerRole.getRole(account.getIntValue("role"));
if (role == PartnerRole.MANAGER || role == PartnerRole.ADMIN) {
for (JSONObject log : logs) {
log.put("audition", !refundAuditionMapper.listAuditingRefundsOfOrder(log.getString("order_id")).isEmpty());
}
}
}
JSONObject result = PageListUtils.buildPageListResult(logs);
JSONObject analysis = orderMapper.analysisOrders(params);
result.put("analysis", analysis);
return result;
}
@Override
public JSONObject listAllTradeLogs(TradeLogQuery query, JSONObject manager) {
JSONObject params = query.toParams(null);
@ -182,6 +222,9 @@ public class TradeLogServiceImpl implements TradeLogService {
}
}
orgManager.checkOrgIds(manager, params);
if(query.getGatewayChild()!=null){
params.put("trade_type",new ArrayList<Integer>(){{add(query.getGatewayChild());}});
}
PageList<JSONObject> logs = orderMapper.listOrders(params, new PageBounds(query.getPage(), query.getLimit(), Order.formString("create_time.desc")));
JSONObject result = PageListUtils.buildPageListResult(logs);
JSONObject analysis = orderMapper.analysisOrders(params);
@ -189,6 +232,33 @@ public class TradeLogServiceImpl implements TradeLogService {
return result;
}
@Override
public JSONObject listAllIncrementalTradeLogs(TradeLogQuery query, JSONObject manager) {
JSONObject params = query.toParams(null);
if (ManagerRole.BD_USER.hasRole(manager.getIntValue("role")) && !ManagerRole.ORG_MANAGER.hasRole(manager.getIntValue("role"))) {
params.put("bd_user", manager.getString("manager_id"));
}
if (query.isOnlyGroup() && ManagerRole.BD_LEADER.hasRole(manager.getIntValue("role"))) {
params.remove("bd_user");
params.put("bd_group", manager.getString("manager_id"));
if (query.getGroup_bd() > 0) {
params.put("bd_group_bd", query.getGroup_bd());
}
}
orgManager.checkOrgIds(manager, params);
if(query.getGatewayChild()!=null){
params.put("trade_type",new ArrayList<Integer>(){{add(query.getGatewayChild());}});
}
PageList<JSONObject> logs = orderMapper.listIncrementalOrders(params, new PageBounds(query.getPage(), query.getLimit(), Order.formString("create_time.desc")));
for (JSONObject log : logs) {
log.put("rate_value",sysClientIncrementalMapper.findByChannelAndClientId(log.getString("client_id"),log.getString("source")));
}
JSONObject result = PageListUtils.buildPageListResult(logs);
JSONObject analysis = orderMapper.analysisOrders(params);
result.put("analysis", analysis);
return result;
}
@Override
public List<JSONObject> listOrderRefunds(String orderId, String timezone) {
@ -721,14 +791,16 @@ public class TradeLogServiceImpl implements TradeLogService {
row.createCell(10, Cell.CELL_TYPE_STRING).setCellValue(data.getString("clearing_amount"));
row.createCell(11, Cell.CELL_TYPE_STRING).setCellValue(data.getString("settle_amount"));
row.createCell(12, Cell.CELL_TYPE_STRING).setCellValue(data.getString("total_surcharge"));
row.createCell(13, Cell.CELL_TYPE_STRING).setCellValue(data.getString("tax_amount"));
row.createCell(14, Cell.CELL_TYPE_STRING).setCellValue(data.getString("clearing_time"));
row.createCell(15, Cell.CELL_TYPE_STRING).setCellValue(data.getString("trans_type").equals("clearing") ? "-" : data.getBigDecimal("exchange_rate").toString());
row.createCell(16, Cell.CELL_TYPE_STRING).setCellValue(data.getString("trans_type"));
row.createCell(17, Cell.CELL_TYPE_STRING).setCellValue(data.getString("clear_status"));
row.createCell(18, Cell.CELL_TYPE_STRING).setCellValue(data.getString("gateway"));
row.createCell(19, Cell.CELL_TYPE_STRING).setCellValue(data.getString("order_detail"));
row.createCell(20, Cell.CELL_TYPE_STRING).setCellValue(data.getString("dev_id"));
row.createCell(13, Cell.CELL_TYPE_STRING).setCellValue(StringUtils.defaultString(data.getString("incremental_surcharge"),"0.0000"));
row.createCell(14, Cell.CELL_TYPE_STRING).setCellValue(data.getString("tax_amount"));
row.createCell(15, Cell.CELL_TYPE_STRING).setCellValue(data.getString("clearing_time"));
row.createCell(16, Cell.CELL_TYPE_STRING).setCellValue(data.getString("trans_type").equals("clearing") ? "-" : data.getBigDecimal("exchange_rate").toString());
row.createCell(17, Cell.CELL_TYPE_STRING).setCellValue(data.getString("trans_type"));
row.createCell(18, Cell.CELL_TYPE_STRING).setCellValue(data.getString("clear_status"));
row.createCell(19, Cell.CELL_TYPE_STRING).setCellValue(data.getString("gateway"));
row.createCell(20, Cell.CELL_TYPE_STRING).setCellValue(data.getString("order_detail"));
row.createCell(21, Cell.CELL_TYPE_STRING).setCellValue(data.getString("dev_id"));
}
@Override
@ -776,6 +848,20 @@ public class TradeLogServiceImpl implements TradeLogService {
font2.setBoldweight(Font.BOLDWEIGHT_NORMAL);
// 把字体应用到当前的样式
style2.setFont(font2);
HSSFCellStyle style3 = workbook.createCellStyle();
style3.setFillForegroundColor(HSSFColor.WHITE.index);
style3.setFillPattern(CellStyle.SOLID_FOREGROUND);
style3.setBorderBottom(CellStyle.BORDER_THIN);
style3.setBorderLeft(CellStyle.BORDER_THIN);
style3.setBorderRight(CellStyle.BORDER_THIN);
style3.setBorderTop(CellStyle.BORDER_THIN);
style3.setAlignment(CellStyle.ALIGN_CENTER);
HSSFFont font3 = workbook.createFont();
font3.setFontHeightInPoints((short) 12);
font3.setBoldweight(Font.BOLDWEIGHT_NORMAL);
font3.setColor(HSSFColor.RED.index);
style3.setFont(font3);
HSSFRow row0 = sheet.createRow(0);
HSSFCell cell00 = row0.createCell(0);
HSSFCell cell01 = row0.createCell(1);
@ -807,7 +893,6 @@ public class TradeLogServiceImpl implements TradeLogService {
cell0.setCellStyle(style2);
cell1.setCellStyle(style2);
cell2.setCellStyle(style2);
cell3.setCellStyle(style2);
cell4.setCellStyle(style2);
JSONObject dataItem = dataList.get(i);
HSSFRichTextString text0 = new HSSFRichTextString(dataItem.getString("transaction_time"));
@ -822,6 +907,11 @@ public class TradeLogServiceImpl implements TradeLogService {
cell0.setCellValue(text0);
cell1.setCellValue(text1);
cell2.setCellValue(text2);
if(dataItem.getString("transaction_type").equals("Debit") ){
cell2.setCellStyle(style3);
}else{
cell2.setCellStyle(style2);
}
cell3.setCellValue(text3);
cell4.setCellValue(text4);
}
@ -880,6 +970,135 @@ public class TradeLogServiceImpl implements TradeLogService {
return result;
}
@Override
public void listSettlementLogExcel(TradeLogQuery query, JSONObject partner,HttpServletResponse response) {
JSONObject client = clientManager.getClientInfoByMoniker(partner.getString("client_moniker"));
int clientId = partner.getIntValue("client_id");
String timezone = partner.getJSONObject("client").getString("timezone");
if(query.getClient_ids()!=null){
if(query.getClient_ids().length>1){
query.setClient_ids(null);
}
}
JSONObject params = query.toParams(timezone);
params.put("client_id", clientId);
PageList<JSONObject> logs = transactionMapper.listSettlementLog(params,
new PageBounds(query.getPage(), query.getLimit(), Order.formString("clearing_time.desc")));
try (HSSFWorkbook workbook = new HSSFWorkbook()) {
if(query.getClient_ids() ==null){
addSheet(0,workbook,client,logs);
List<JSONObject> childs = clientMapper.listChildClients(client.getIntValue("client_id"));
for (int i=0;i<childs.size();i++){
params.put("client_id", childs.get(i).getInteger("client_id"));
PageList<JSONObject> childLogs = transactionMapper.listSettlementLog(params, new PageBounds(query.getPage(), 10000, Order.formString("clearing_time.desc")));
if(childLogs.size()>0){
addSheet(i+1,workbook, childs.get(i),childLogs);
}
}
}else{
JSONObject chlidClient = clientMapper.findClient(Integer.parseInt(query.getClient_ids()[0]));
addSheet(0,workbook,chlidClient,logs);
}
String fileName = "Settlement Log - "+ (query.getDatefrom() + "~" + query.getDateto() );
response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xls");
OutputStream outputStream = response.getOutputStream();
try {
workbook.write(outputStream);
outputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
} catch (IOException e) {
e.printStackTrace();
}
}
private void addSheet(int sheetNum,HSSFWorkbook workbook,JSONObject client,List<JSONObject> logs){
HSSFSheet sheet = workbook.createSheet();
workbook.setSheetName(sheetNum,client.getString("client_moniker")+"_excel");
sheet.setDefaultColumnWidth((short) 40);
HSSFCellStyle style = workbook.createCellStyle();
style.setFillForegroundColor(HSSFColor.LIGHT_ORANGE.index);
style.setFillPattern(CellStyle.SOLID_FOREGROUND);
style.setBorderBottom(CellStyle.BORDER_THIN);
style.setBorderLeft(CellStyle.BORDER_THIN);
style.setBorderRight(CellStyle.BORDER_THIN);
style.setBorderTop(CellStyle.BORDER_THIN);
style.setAlignment(CellStyle.ALIGN_CENTER);
HSSFFont font = workbook.createFont();
font.setFontHeightInPoints((short) 16);
font.setBoldweight(Font.BOLDWEIGHT_BOLD);
style.setFont(font);
HSSFCellStyle style2 = workbook.createCellStyle();
style2.setFillForegroundColor(HSSFColor.WHITE.index);
style2.setFillPattern(CellStyle.SOLID_FOREGROUND);
style2.setBorderBottom(CellStyle.BORDER_THIN);
style2.setBorderLeft(CellStyle.BORDER_THIN);
style2.setBorderRight(CellStyle.BORDER_THIN);
style2.setBorderTop(CellStyle.BORDER_THIN);
style2.setAlignment(CellStyle.ALIGN_CENTER);
HSSFFont font2 = workbook.createFont();
// font.setColor(HSSFColor.VIOLET.index);
font2.setFontHeightInPoints((short) 12);
font2.setBoldweight(Font.BOLDWEIGHT_NORMAL);
// 把字体应用到当前的样式
style2.setFont(font2);
HSSFRow row0 = sheet.createRow(0);
HSSFCell cell00 = row0.createCell(0);
HSSFCell cell01 = row0.createCell(1);
HSSFCell cell02 = row0.createCell(2);
HSSFCell cell03 = row0.createCell(3);
HSSFCell cell04 = row0.createCell(4);
HSSFCell cell05 = row0.createCell(5);
cell00.setCellStyle(style);
cell01.setCellStyle(style);
cell02.setCellStyle(style);
cell03.setCellStyle(style);
cell04.setCellStyle(style);
cell05.setCellStyle(style);
HSSFRichTextString text00 = new HSSFRichTextString("Short Name");
HSSFRichTextString text01 = new HSSFRichTextString("Client Moniker");
HSSFRichTextString text02 = new HSSFRichTextString("Settle Time");
HSSFRichTextString text03 = new HSSFRichTextString("Transaction Amount");
HSSFRichTextString text04 = new HSSFRichTextString("to Merchant");
HSSFRichTextString text05 = new HSSFRichTextString("Service Fee");
cell00.setCellValue(text00);
cell01.setCellValue(text01);
cell02.setCellValue(text02);
cell03.setCellValue(text03);
cell04.setCellValue(text04);
cell05.setCellValue(text05);
for (int i = 0; i < logs.size(); i++) {
HSSFRow row = sheet.createRow(i + 1);
HSSFCell cell0 = row.createCell(0);
HSSFCell cell1 = row.createCell(1);
HSSFCell cell2 = row.createCell(2);
HSSFCell cell3 = row.createCell(3);
HSSFCell cell4 = row.createCell(4);
HSSFCell cell5 = row.createCell(5);
cell0.setCellStyle(style2);
cell1.setCellStyle(style2);
cell2.setCellStyle(style2);
cell3.setCellStyle(style2);
cell4.setCellStyle(style2);
cell5.setCellStyle(style2);
JSONObject dataItem = logs.get(i);
HSSFRichTextString text0 = new HSSFRichTextString(client.getString("short_name"));
HSSFRichTextString text1 = new HSSFRichTextString(client.getString("client_moniker"));
HSSFRichTextString text2 = new HSSFRichTextString(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format( dataItem.getDate("report_date")));
HSSFRichTextString text3 = new HSSFRichTextString(dataItem.getBigDecimal("total").setScale(2, BigDecimal.ROUND_HALF_DOWN).toString());
HSSFRichTextString text4 = new HSSFRichTextString(dataItem.getBigDecimal("income").setScale(2, BigDecimal.ROUND_HALF_DOWN).toString());
HSSFRichTextString text5 = new HSSFRichTextString(dataItem.getBigDecimal("fee").setScale(2, BigDecimal.ROUND_HALF_DOWN).toString());
cell0.setCellValue(text0);
cell1.setCellValue(text1);
cell2.setCellValue(text2);
cell3.setCellValue(text3);
cell4.setCellValue(text4);
cell5.setCellValue(text5);
}
}
@Override
public Double getClientUnClearedAmount(JSONObject partner) {
return transactionMapper.getClientUnClearedAmount(partner.getIntValue("client_id"));
@ -1213,6 +1432,13 @@ public class TradeLogServiceImpl implements TradeLogService {
font.setFontHeightInPoints((short) 10);
CellStyle analysisStyle = wb.createCellStyle();
analysisStyle.setFont(font);
//红色字体提示
Font font2 = wb.createFont();
font.setBoldweight(Font.BOLDWEIGHT_BOLD);
font2.setFontHeightInPoints((short) 10);
font2.setColor(HSSFColor.RED.index);
CellStyle analysisStyle2 = wb.createCellStyle();
analysisStyle2.setFont(font2);
Sheet sheet = wb.createSheet("Merchant_Settlement_Info_" + begin + "_" + end);
int rowNum = 0;
Row row = sheet.createRow(rowNum);
@ -1240,17 +1466,35 @@ public class TradeLogServiceImpl implements TradeLogService {
row.createCell(4, Cell.CELL_TYPE_STRING).setCellValue("-");
}
row.createCell(5, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("exchange_rate").setScale(5, RoundingMode.DOWN).toPlainString());
row.createCell(6, Cell.CELL_TYPE_STRING).setCellValue(settle.getString("transaction_type"));
cell = row.createCell(6, Cell.CELL_TYPE_STRING);
cell.setCellValue(settle.getString("transaction_type"));
cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type"))?analysisStyle2:null);
row.createCell(7, Cell.CELL_TYPE_STRING).setCellValue(settle.getString("transaction_currency"));
row.createCell(8, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("display_amount") == null ? ""
: settle.getBigDecimal("display_amount").setScale(2, RoundingMode.DOWN).toPlainString());
row.createCell(9, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("transaction_amount") == null ? ""
: settle.getBigDecimal("transaction_amount").setScale(2, RoundingMode.DOWN).toPlainString());
row.createCell(10, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("clearing_amount") == null ? ""
: settle.getBigDecimal("clearing_amount").setScale(2, RoundingMode.DOWN).toPlainString());
cell = row.createCell(8, Cell.CELL_TYPE_STRING);
cell.setCellValue(settle.getBigDecimal("display_amount") == null ? ""
: "Credit".equals(settle.getString("transaction_type"))?
settle.getBigDecimal("display_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString():
"-"+settle.getBigDecimal("display_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString());
cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type"))?analysisStyle2:null);
cell = row.createCell(9, Cell.CELL_TYPE_STRING);
cell.setCellValue(settle.getBigDecimal("transaction_amount") == null ? ""
: "Credit".equals(settle.getString("transaction_type"))?
settle.getBigDecimal("transaction_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString():
"-"+settle.getBigDecimal("transaction_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString());
cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type"))?analysisStyle2:null);
cell = row.createCell(10, Cell.CELL_TYPE_STRING);
cell.setCellValue(settle.getBigDecimal("clearing_amount") == null ? ""
: "Credit".equals(settle.getString("transaction_type"))?
settle.getBigDecimal("clearing_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString():
"-"+settle.getBigDecimal("clearing_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString());
cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type"))?analysisStyle2:null);
row.createCell(11, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("rate") == null ? "" : settle.getBigDecimal("rate").toPlainString() + "%");
row.createCell(12, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("settle_amount") == null ? ""
: settle.getBigDecimal("settle_amount").setScale(2, RoundingMode.DOWN).toPlainString());
cell = row.createCell(12, Cell.CELL_TYPE_STRING);
cell.setCellValue(settle.getBigDecimal("settle_amount") == null ? ""
: "Credit".equals(settle.getString("transaction_type"))?
settle.getBigDecimal("settle_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString():
"-"+settle.getBigDecimal("settle_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString());
cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type"))?analysisStyle2:null);
row.createCell(13, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("total_surcharge") == null ? ""
: settle.getBigDecimal("total_surcharge").setScale(2, RoundingMode.DOWN).toPlainString());
row.createCell(14, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("tax_amount") == null ? ""
@ -1377,7 +1621,7 @@ public class TradeLogServiceImpl implements TradeLogService {
Row row = sheet.createRow(rowNum);
String[] title = {"Transaction Time", "Client Order ID", "System Order ID", "Client Moniker", "Short Name",
"Order ID", "Channel", "Input Amount", "Transaction Amount", "Transaction Currency", "Clearing Amount",
"Settle Amount", "Surcharge", "GST", "Settle Date", "Exchange Rate",
"Settle Amount", "Surcharge", "Incremental Surcharge", "GST", "Settle Date", "Exchange Rate",
"Transaction Type", "Clearing Status", "Gateway", "Remark", "Dev No"};
for (int j = 0; j < title.length; j++) {
row.createCell(j, Cell.CELL_TYPE_STRING).setCellValue(title[j]);

@ -34,6 +34,13 @@ public class ManageTradelogController {
return tradeLogService.listAllTradeLogs(query, manager);
}
@RequestMapping(value = "/incremental",method = RequestMethod.GET)
@ReadOnlyConnection
@RequireManager(role = {ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.OPERATOR, ManagerRole.FINANCIAL_STAFF, ManagerRole.SERVANT, ManagerRole.DIRECTOR})
public JSONObject listAllIncrementalTradeLogs(TradeLogQuery query, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return tradeLogService.listAllIncrementalTradeLogs(query, manager);
}
@ManagerMapping(value = "/{tradeId}/refunds", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.FINANCIAL_STAFF, ManagerRole.SERVANT, ManagerRole.DIRECTOR})
@ReadOnlyConnection
@RequirePartner

@ -57,6 +57,13 @@ public class TradeFlowController {
return tradeLogService.listSettlementLog(query,partner);
}
@PartnerMapping(value = "/settlement/log/excelAll",method = RequestMethod.GET)
@ReadOnlyConnection
@ResponseBody
public void listSettlementLogExcel(TradeLogQuery query,@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner,HttpServletResponse response){
tradeLogService.listSettlementLogExcel(query,partner,response);
}
@PartnerMapping(value = "/settlement/unclear",method = RequestMethod.GET)
@ReadOnlyConnection
@ResponseBody

@ -1,6 +1,16 @@
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.schema-name=royalpay_local
spring.datasource.host=192.168.0.50:3306
spring.datasource.url=jdbc:mysql://${spring.datasource.host}/${spring.datasource.schema-name}?useUnicode=true&characterEncoding=utf8&useSSL=false
spring.datasource.username=root
spring.datasource.password=root
#多数据源配置
spring.datasource.type = com.zaxxer.hikari.HikariDataSource
#数据源master
spring.datasource.master.schema-name=royalpay_production
spring.datasource.master.host=192.168.1.52:3306
spring.datasource.master.jdbc-url=jdbc:mysql://${spring.datasource.master.host}/${spring.datasource.master.schema-name}?useUnicode=true&characterEncoding=utf8&useSSL=false
spring.datasource.master.username=taylor
spring.datasource.master.password=taylor
#数据源salve
spring.datasource.slave.schema-name=royalpay_production
spring.datasource.slave.host=192.168.1.52:3306
spring.datasource.slave.jdbc-url=jdbc:mysql://${spring.datasource.slave.host}/${spring.datasource.slave.schema-name}?useUnicode=true&characterEncoding=utf8&useSSL=false
spring.datasource.slave.username=taylor
spring.datasource.slave.password=taylor

@ -19,8 +19,8 @@
<select id="getCashbackRecores" resultType="com.alibaba.fastjson.JSONObject">
SELECT c.*,p.client_moniker,p.short_name FROM cashback_records c
INNER JOIN sys_clients p on c.client_id=p.client_id
SELECT c.*,p.client_moniker,p.short_name,o.source FROM cashback_records c
INNER JOIN sys_clients p on c.client_id=p.client_id INNER JOIN pmt_orders o on c.order_id = o.order_id
<where>
<if test="client_ids!=null">
AND c.client_id IN

@ -23,6 +23,7 @@
p.short_name,
o.refund_amount refund_fee,
o.customer_id,
o.source,
sum(t.clearing_amount) clearing_amount,
t.refund_id,
t.transaction_time,
@ -30,7 +31,11 @@
t.transaction_id,
t.exchange_rate,
t.clearing_status,
t.settle_amount
t.settle_amount,
t.incremental_surcharge,
t.total_surcharge,
t.tax_amount,
t.surcharge_rate
</sql>
<sql id="gateway_keys">
SELECT
@ -42,6 +47,7 @@
o.create_time,
o.confirm_time pay_time,
o.pre_authorization,
o.source,
CASE o.status
WHEN 0
THEN 'SUBMITTING'
@ -149,7 +155,148 @@
select oo.order_id,oo.client_id,oo.total_amount,oo.display_amount,
oo.customer_payment_amount,oo.coupon_payment_amount,oo.currency,
oo.create_time,oo.confirm_time,oo.status,oo.order_description,oo.order_detail,
oo.client_order_id,oo.gateway,oo.channel,oo.pre_authorization,oo.refund_amount,oo.customer_id
oo.client_order_id,oo.gateway,oo.channel,oo.pre_authorization,oo.refund_amount,oo.customer_id,oo.source
from pmt_orders oo
<where>
<if test="search_text != null">
<bind name="name_pattern" value="'%' + search_text + '%'"/>
<if test="text_type == 'remark'">
AND oo.order_detail LIKE #{name_pattern}
</if>
<if test="text_type == 'channel'">
AND oo.channel = #{search_text}
</if>
<if test="text_type == 'order_id'">
AND oo.order_id = #{search_text}
</if>
</if>
<if test="order_id != null">
AND oo.order_id = #{order_id}
</if>
<if test="trade_type != null">
AND oo.gateway IN
<foreach collection="trade_type" item="gateway" open="(" close=")" separator=",">
#{gateway}
</foreach>
</if>
<if test="from != null">
AND oo.create_time &gt;= #{from}
</if>
<if test="to != null">
AND oo.create_time &lt; #{to}
</if>
<if test="date != null">
AND oo.transaction_date = DATE(#{date})
</if>
<if test="dev_id != null">
AND oo.dev_id = #{dev_id}
</if>
<if test="status != null">
AND
<foreach collection="status" item="std" open="(" close=")" separator=" or ">
oo.status = #{std}
</foreach>
</if>
<if test="channel != null">
AND
<foreach collection="channel" item="chan" open="(" close=")" separator=" or ">
oo.channel = #{chan}
</foreach>
</if>
<if test="source != 'ALL'">
AND
oo.source = #{source}
</if>
</where>
) o
INNER JOIN sys_clients p
ON p.client_id = o.client_id
AND p.is_valid = 1
<if test="client_ids != null">
AND p.client_id IN
<foreach collection="client_ids" open="(" close=")" separator="," item="client_id">
#{client_id}
</foreach>
</if>
<if test="client_ids == null and client_id != null">
AND p.client_id = #{client_id}
</if>
LEFT JOIN pmt_transactions t
ON t.order_id = o.order_id
AND t.refund_id IS NULL
AND t.transaction_type = 'Credit'
<where>
<if test="search_text != null">
<bind name="name_pattern" value="'%' + search_text + '%'"/>
<if test="text_type == 'all'">
AND (
p.client_moniker = #{search_text}
OR p.short_name LIKE #{name_pattern}
OR o.order_detail LIKE #{name_pattern}
OR t.system_transaction_id = #{search_text}
OR o.channel = #{search_text}
OR o.order_id = #{search_text}
)
</if>
<if test="text_type == 'client_moniker'">
AND p.client_moniker = #{search_text}
</if>
<if test="text_type == 'client_name'">
AND p.short_name LIKE #{name_pattern}
</if>
<if test="text_type == 'sys_trans_id'">
AND t.system_transaction_id = #{search_text}
</if>
</if>
<if test="org_id != null and org_ids == null">
AND p.org_id = #{org_id}
</if>
<if test="org_ids != null">
AND p.org_id IN
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">
#{org_id}
</foreach>
</if>
<if test="bd_group != null">
AND p.client_id IN(
SELECT distinct b.client_id
FROM sys_client_bd b
INNER JOIN financial_bd_config c
ON c.manager_id = b.bd_id
WHERE b.is_valid = 1
AND b.start_date &lt;= now()
AND (b.end_date is null or b.end_date &gt;= now())
AND (c.bd_group = #{bd_group} or c.manager_id = #{bd_group})
<if test="bd_group_bd">
AND c.manager_id = #{bd_group_bd}
</if>
)
</if>
<if test="bd_user != null">
AND p.client_id in(select distinct d.client_id
from sys_client_bd d
where d.bd_id = #{bd_user}
AND d.is_valid = 1
AND DATE(d.start_date) &lt;= curdate()
AND (d.end_date IS NULL OR DATE(d.end_date) &gt;= curdate()))
</if>
</where>
GROUP BY o.order_id
</select>
<select id="listIncrementalOrders" resultType="com.alibaba.fastjson.JSONObject">
<if test="gateway">
<include refid="gateway_keys"/>
</if>
<if test="!gateway">
<include refid="tradelog_list_keys"/>
</if>
FROM (
select oo.order_id,oo.client_id,oo.total_amount,oo.display_amount,
oo.customer_payment_amount,oo.coupon_payment_amount,oo.currency,
oo.create_time,oo.confirm_time,oo.status,oo.order_description,oo.order_detail,
oo.client_order_id,oo.gateway,oo.channel,oo.pre_authorization,oo.refund_amount,oo.customer_id,oo.source
from pmt_orders oo
<where>
<if test="search_text != null">
@ -197,6 +344,10 @@
oo.channel = #{chan}
</foreach>
</if>
<if test="source != 'ALL'">
AND
oo.source = #{source}
</if>
</where>
) o
INNER JOIN sys_clients p
@ -359,7 +510,7 @@
and o.client_order_id = #{search_text}
</if>
</if>
<if test="dev_id!=null">and dev_id=#{dev_id}</if>
<if test="dev_id!=null">and binary dev_id=#{dev_id}</if>
<if test="trade_type!=null">and o.gateway in
<foreach collection="trade_type" item="gateway" open="(" close=")" separator=",">#{gateway}</foreach>
</if>
@ -379,6 +530,48 @@
<foreach collection="channel" item="chan" open="(" close=")" separator=" or ">o.channel=#{chan}
</foreach>
</if>
<if test="source != 'ALL'">
AND
o.source = #{source}
</if>
</where>
GROUP BY o.order_id
</select>
<select id="listIncrementalOrdersByClients" resultType="com.alibaba.fastjson.JSONObject">
<include refid="tradelog_list_keys"/>
,i.incremental_rate as rate_value
FROM pmt_orders o
INNER JOIN sys_clients p ON p.client_id=o.client_id and p.is_valid=1
<if test="client_ids!=null">
AND p.client_id IN
<foreach collection="client_ids" open="(" close=")" separator="," item="client_id">
#{client_id}
</foreach>
</if>
<if test="client_ids==null and client_id !=null">
and p.client_id=#{client_id}
</if>
LEFT JOIN pmt_transactions t on t.order_id=o.order_id and t.refund_id is null and t.transaction_type='Credit'
LEFT JOIN pmt_incremental_detail i on i.transaction_id = t.transaction_id
<where>
<if test="from!=null">and o.create_time &gt;= #{from}</if>
<if test="to!=null">and o.create_time &lt; #{to}</if>
<if test="status!=null">
and
<foreach collection="status" item="std" open="(" close=")" separator=" or ">o.status=#{std}</foreach>
</if>
<if test="channel!=null">
and
<foreach collection="channel" item="chan" open="(" close=")" separator=" or ">o.channel=#{chan}
</foreach>
</if>
<if test="source != 'ALL'">
AND
o.source = #{source}
</if>
</where>
GROUP BY o.order_id
</select>
@ -396,6 +589,12 @@
count(DISTINCT l.client_id) clients,
ifnull(sum(if(l.transaction_type='Credit' and l.refund_id is null and l.currency!='CNY',l.display_amount,0)),0)
display_amount,
ifnull(sum(if(l.transaction_type='Credit' and l.refund_id is null and l.currency!='CNY',l.incremental_surcharge,0)),0)
incremental_surcharge,
ifnull(sum(if(l.transaction_type='Debit' and l.refund_id is not null and l.currency!='CNY',l.incremental_surcharge,0)),0)
refund_incremental_surcharge,
ifnull(sum(if(l.currency!='CNY',l.incremental_surcharge,0)),0)
all_incremental_surcharge,
ifnull(sum(if(l.transaction_type='Credit' and l.refund_id is null and l.currency!='CNY' and
l.pre_authorization=1,l.display_amount,0)),0) pre_display_amount,
ifnull(sum(if(l.transaction_type='Credit' and l.refund_id is null and l.currency='CNY',l.display_amount,0)),0)
@ -465,7 +664,7 @@
<if test="from!=null">and o.create_time &gt;= #{from}</if>
<if test="to!=null">and o.create_time &lt; #{to}</if>
<if test="date!=null">and date(o.create_time)=date(#{date})</if>
<if test="dev_id!=null">and o.dev_id=#{dev_id}</if>
<if test="dev_id!=null">and binary o.dev_id=#{dev_id}</if>
<if test="status!=null">
and
<foreach collection="status" item="std" open="(" close=")" separator=" or ">o.status=#{std}</foreach>
@ -475,6 +674,10 @@
<foreach collection="channel" item="chan" open="(" close=")" separator=" or ">o.channel=#{chan}
</foreach>
</if>
<if test="source !='ALL'">
and
o.source=#{source}
</if>
<if test="bd_group!=null">and p.client_id in
(SELECT b.client_id FROM sys_client_bd b
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id

@ -96,7 +96,7 @@
<select id="listTransFlow" resultType="com.alibaba.fastjson.JSONObject">
SELECT t.*,
o.status,
o.status,o.source,
c.client_moniker,
c.short_name,
o.dev_id order_dev_id,
@ -170,7 +170,7 @@
<if test="trans_type==2">and t.refund_id is NOT NULL</if>
<if test="trans_type==3">and t.transaction_type='Debit' and t.refund_id is NULL</if>
<if test="dev_id!=null">
and o.dev_id = #{dev_id}
and binary o.dev_id = #{dev_id}
</if>
<if test="channel!=null">
and
@ -241,7 +241,7 @@
<if test="trans_type==2">and t.refund_id is NOT NULL</if>
<if test="trans_type==3">and t.transaction_type='Debit' and t.refund_id is NULL</if>
<if test="dev_id!=null">
and o.dev_id = #{dev_id}
and binary o.dev_id = #{dev_id}
</if>
<if test="channel!=null">
and
@ -949,13 +949,15 @@
<select id="listTransactionsOfClearingOrder" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT t.*,
IFNULL(t.incremental_surcharge, 0.00) incremental_surcharge_settle,
o.display_amount,
o.client_order_id,
o.gateway,
r.out_refund_id,
r.client_refund_id,
o.order_detail,
o.dev_id
o.dev_id,
o.source
FROM pmt_transactions t
LEFT JOIN pmt_orders o ON o.order_id = t.order_id
LEFT JOIN pmt_refunds r ON r.refund_id = t.refund_id

@ -41,4 +41,24 @@
ORDER BY a.create_time DESC
limit 1
</select>
<select id="findRSvcClientInfo" resultType="com.alibaba.fastjson.JSONObject">
SELECT
sa.username,
sc.client_id,
sc.client_moniker,
sc.credential_code,
sc.short_name,
sc.company_name,
ifnull(sc.logo_url,"NONE") logo_url,
sc.industry,
industry
FROM
sys_accounts sa,
sys_clients sc
WHERE
sa.account_id = #{account_id}
AND sc.client_id = sa.client_id
AND sc.is_valid = 1
AND sa.is_valid = 1
</select>
</mapper>

@ -22,6 +22,23 @@
</if>
</where>
</select>
<select id="listClientDeviceIds" resultType="com.alibaba.fastjson.JSONObject">
SELECT o.dev_id
FROM pmt_orders AS o
WHERE o.dev_id IS NOT NULL
<if test="client_ids!=null">
AND o.client_id IN
<foreach collection="client_ids" open="(" close=")" separator="," item="client_id">
#{client_id}
</foreach>
</if>
<if test="client_id!=null and client_ids==null">
AND o.client_id=#{client_id}
</if>
AND o.gateway in(5,6)
GROUP BY o.dev_id
ORDER BY o.dev_id ASC
</select>
<select id="listDevices" resultType="com.alibaba.fastjson.JSONObject">
SELECT d.*,c.client_moniker,c.short_name client_name FROM sys_clients_devices d
LEFT JOIN sys_clients c on c.client_id=d.client_id

@ -13,6 +13,12 @@
update sys_files set is_valid = 0
where file_id = #{file_id}
</select>
<select id="getSourceAgreeFilesByClientId" resultType="com.alibaba.fastjson.JSONObject">
select * from sys_files
where client_id = #{client_id}
and file_name = 'source_agree_file'
order by last_update_date desc limit 1
</select>
<select id="deleteAggreeByClientId" resultType="com.alibaba.fastjson.JSONObject">
update sys_files set is_valid = 0
where client_id = #{client_id}

@ -874,6 +874,11 @@ margin-bottom: 10%;"/>
<!--<i class="fa fa-list-alt"></i> -->Orders
</a>
</li>
<!--<li>
<a ui-sref="incremental_trade">
&lt;!&ndash;<i class="fa fa-list-alt"></i> &ndash;&gt;Incremental Orders
</a>
</li>-->
<li>
<a ui-sref="settlementlogs">
<!--<i class="fa fa-calendar"></i> -->Settlement
@ -1035,6 +1040,10 @@ margin-bottom: 10%;"/>
</ul>
</li>
<li class="has-submenu" ui-sref-active="active">
<a ui-sref="partnerIncrementalService"><i class="fa fa-plus-square-o"></i>R Services</a>
</li>
</ul>
<!-- End navigation menu -->
</div> <!-- end #navigation -->

@ -343,6 +343,11 @@ margin-bottom: 10%;"/>
<i class="fa fa-list-alt"></i> <span>交易流水|Trades Logs</span>
</a>
</li>
<li ui-sref-active="active" ng-if="'tradelog'|withModule">
<a ui-sref="incremental_trade" ui-sref-opts="{reload:true}">
<i class="fa fa-list-alt"></i> <span>增值服务交易流水|Incremental Trades Logs</span>
</a>
</li>
<li ui-sref-active="active" ng-if="('transAnalysis'|withModule) && (currentUser.org_id==null || currentUser.org_id==1)">
<a ui-sref="analysis_transanalysis" ui-sref-opts="{reload:true}">
<i class="fa fa-area-chart"></i> <span>交易数据|Transaction Data</span>

@ -128,15 +128,20 @@ define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', '
$http.get('/analysis/customers/ranking/'+$scope.params.openid_type, {params: params}).then(function (resp) {
$scope.customer_loading = false;
$scope.customers = resp.data.data;
$scope.checkoutCustomer($scope.customers[0]);
$scope.generatorEcharts($scope.customers[0].customer_id);
$scope.customers_type = resp.data.openid_type;
$scope.pagination = resp.data.pagination;
if($scope.customers.length>0){
$scope.order_params.customer_id = $scope.customers[0].customer_id;
$scope.customer_loading = false;
$scope.listCustomerOrders(1);
}else{
$scope.checkoutCustomer($scope.customers[0]);
$scope.generatorEcharts($scope.customers[0].customer_id);
$scope.customers_type = resp.data.openid_type;
$scope.pagination = resp.data.pagination;
if($scope.customers.length>0){
$scope.order_params.customer_id = $scope.customers[0].customer_id;
$scope.customer_loading = false;
$scope.listCustomerOrders(1);
}else{
$scope.orders=[];
}
}
else{
$scope.orders=[];
}

@ -181,7 +181,7 @@
</div>
</div>
</div>
<div class="box" ng-if="one_customer">
<div class="box" ng-if="one_customer&&orders.length>0">
<div class="box-header">
<h3 class="box-title">用户画像</h3>
</div>
@ -248,7 +248,7 @@
</div>
</div>
<div class="row">
<div class="row" ng-if="orders">
<div class="col-sm-12">
<div class="box box-default">
<div class="box-body table-responsive">

@ -78,7 +78,8 @@ var modules = [
{path: 'static/payment/surchargeaccount/partner-surcharge-account', module: 'surchargeAccountApp', roles: [1,2,3]},
{path: 'static/integralmall/coupon_cancellation', module: 'couponCancellation', roles: [1,2]},
{path: 'static/invoice/invoice_assistant', module: 'partnerInvoice', roles: [1]},
{path: 'static/payment/billqrcode/bill-qrcode-manage', module: 'billQrCodeManagement', roles: [1,2,3]}
{path: 'static/payment/billqrcode/bill-qrcode-manage', module: 'billQrCodeManagement', roles: [1,2,3]},
{path: 'static/incrementalService/partner-incremental-service', module: 'partnerIncrementalService', roles: [1,2,3]}
];
require(['angular', 'jquery'], function (angular, $) {

@ -80,7 +80,13 @@
<tbody>
<tr ng-repeat="record in records">
<td ng-bind="record.short_name"></td>
<td ng-bind="record.order_id"></td>
<td>
<img src="/static/images/royalpay_sign_s.png"
uib-tooltip="RoyalPay" ng-if="record.source=='system'"/>
<img src="/static/images/yangmaimai_sign.png"
uib-tooltip="R跨境商城" ng-if="record.source=='R跨境商城'"/>
{{record.order_id}}
</td>
<td ng-bind="record.cashback_amount|currency:'AUD '"></td>
<td ng-bind="record.create_time"></td>
<td>

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 415 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 547 B

@ -0,0 +1,305 @@
define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
'use strict';
var app = angular.module('partnerIncrementalService', ['ui.bootstrap', 'ui.router']);
app.config(['$stateProvider', function ($stateProvider) {
$stateProvider.state('partnerIncrementalService', {
url: '/partner_incremental_service',
templateUrl: '/static/incrementalService/templates/partner_incremental_service.html',
controller: 'partnerIncrementalServiceCtrl',
resolve:{
partner:['$http',function($http){
return $http.get('/client/partner_info');
}]
}
}).state('partnerIncrementalServiceInfo', {
url: '/partner_incremental_service_info?:channel',
templateUrl: '/static/incrementalService/templates/partner_incremental_service_info.html',
controller: 'partnerIncrementalServiceInfoCtrl',
resolve:{
partner:['$http',function($http){
return $http.get('/client/partner_info');
}]
}
});
}]);
app.controller('partnerIncrementalServiceCtrl', ['$scope', '$http', '$state', 'partner', function ($scope, $http, $state, partner) {
$scope.serviceAll = [];
$scope.channelOptions = [];
$scope.windowHeight = document.body.clientWidth;
$scope.clientInfo = partner.data
$scope.initDate = function(){
$http.get("/client/partner_info/"+$scope.clientInfo.client_moniker+"/incremental_service").then(function (res) {
$scope.serviceAll = res.data.all_service;
$scope.serviceAll.forEach(function(service){
service.logo_url = '/static/images/'+service.channel+'.jpg'
service.logo_url = $scope.CheckImgExists(service.logo_url)?service.logo_url:'/static/images/royalpay_sign.png'
})
res.data.incremental_channel.forEach(function(channel){
$scope.channelOptions.push({name:channel,logo_url:'/static/images/'+channel+'.jpg'})
})
})
}
$scope.CheckImgExists =function (url) {
var xmlHttp ;
if (window.ActiveXObject)
{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest)
{
xmlHttp = new XMLHttpRequest();
}
xmlHttp.open("Get",url,false);
xmlHttp.send();
if(xmlHttp.status==404)
return false;
else
return true;
}
$scope.initDate();
}]);
app.controller('partnerIncrementalServiceInfoCtrl',['$scope', '$http', '$state','$stateParams','$filter', '$timeout', 'partnerRefunder', 'orderService', 'commonDialog','partner',
function($scope,$http,$state,$stateParams,$filter, $timeout, partnerRefunder, orderService, commonDialog,partner){
$scope.serviceInfo = {}
$scope.initDate = function () {
$http.get("/client/partner_info/"+partner.data.client_moniker+"/incremental_service/"+$stateParams.channel+"/info").then(function(res){
$scope.serviceInfo =res.data
$scope.serviceInfo.logo_url = '/static/images/'+$scope.serviceInfo.channel+'.jpg'
$scope.serviceInfo.logo_url = $scope.CheckImgExists($scope.serviceInfo.logo_url)?$scope.serviceInfo.logo_url:'/static/images/royalpay_sign.png'
})
}
$scope.CheckImgExists =function (url) {
var xmlHttp ;
if (window.ActiveXObject)
{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest)
{
xmlHttp = new XMLHttpRequest();
}
xmlHttp.open("Get",url,false);
xmlHttp.send();
if(xmlHttp.status==404)
return false;
else
return true;
}
$scope.initDate();
$scope.params = {source: $stateParams.channel,status: 'PAID', channel :'ALL' ,textType: 'all', datefrom: new Date(), dateto: new Date()};
$scope.pagination = {};
$scope.today = new Date();
$scope.isAll = true;
$scope.isLevel3All = true;
$scope.device_isAll = true;
$scope.dev_params = {client_type:'sunmi',limit:100};
$scope.clients = [$scope.currentUser.client];
$scope.showLevel3Clients = false;
$scope.chooseToday = function () {
$scope.params.datefrom = $scope.params.dateto = new Date();
$scope.loadTradeLogs(1);
};
$scope.chooseYesterday = function () {
var yesterday = new Date();
yesterday.setDate(yesterday.getDate() - 1);
$scope.params.datefrom = $scope.params.dateto = yesterday;
$scope.loadTradeLogs(1);
};
$scope.chooseLast7Days = function () {
$scope.params.dateto = new Date();
var day = new Date();
day.setDate(day.getDate() - 7);
$scope.params.datefrom = day;
$scope.loadTradeLogs(1);
};
$scope.thisMonth = function () {
$scope.params.dateto = new Date();
var monthBegin = new Date();
monthBegin.setDate(1);
$scope.params.datefrom = monthBegin;
$scope.loadTradeLogs(1);
};
$scope.lastMonth = function () {
var monthFinish = new Date();
monthFinish.setDate(0);
$scope.params.dateto = monthFinish;
var monthBegin = new Date();
monthBegin.setDate(0);
monthBegin.setDate(1);
$scope.params.datefrom = monthBegin;
$scope.loadTradeLogs(1);
};
$scope.loadTradeLogs = function (page) {
var params = angular.copy($scope.params);
if (params.datefrom) {
params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd');
}
if (params.dateto) {
params.dateto = $filter('date')(params.dateto, 'yyyyMMdd');
}
params.page = page || $scope.pagination.page || 1;
$http.get('/client/partner_info/incremental_trade_logs', {params: params}).then(function (resp) {
$scope.tradeLogs = resp.data.data;
$scope.pagination = resp.data.pagination;
$scope.analysis = resp.data.analysis;
$scope.analysis.refund_fee = angular.copy(Math.abs($scope.analysis.refund_fee));
});
};
$scope.gatewaySelected = function (arr) {
return $scope.params.gateway != null && $scope.params.gateway.filter(function (gateway) {
return arr.indexOf(gateway) >= 0
}).length > 0
};
$scope.showTradeDetail = function (order) {
orderService.clientOrderDetail(order)
};
$scope.showPRefundLog = function (orderId) {
partnerRefunder.prefunded(orderId);
};
$scope.newPRefund = function (orderId) {
partnerRefunder.prefund(orderId).then(function () {
$scope.loadTradeLogs();
});
};
$scope.releasePreAuth = function (orderId) {
commonDialog.confirm({
title: 'Pre Authorization Completion',
content: 'This bill will be taken into settlement, or you will be able to make a refund order. Are you sure?'
}).then(function () {
$http.put('/client/partner_info/trade_logs/' + orderId + '/release_preauth').then(function (resp) {
$scope.loadTradeLogs();
}, function (resp) {
commonDialog.alert({title: 'Error!', content: resp.data.message, type: 'error'})
})
})
};
$scope.alerts = [];
$scope.$on('pe_order_paid', function (evt, order) {
$scope.alerts.push(order);
$timeout(function () {
$scope.alerts.splice(0, 1);
}, 10000);
$scope.loadTradeLogs();
});
$scope.chooseClient = function (client) {
if (client == 'all') {
$scope.params.client_ids = angular.copy($scope.clientIds);
$scope.isAll = true;
$scope.chooseClientId = '';
$scope.dev_params.client_ids = angular.copy($scope.clientIds);
$scope.showLevel3Clients = false;
$scope.listDevices();
} else if (client.level3Clients) {
$scope.chooseClientId = client.client_id;
$scope.showLevel3Clients = true;
$scope.level3Clients = client.level3Clients;
$scope.isAll = false;
$scope.level3ClientIds = [];
$scope.level3ClientIds.push(client.client_id);
client.level3Clients.forEach(function (client) {
$scope.level3ClientIds.push(client.client_id);
});
$scope.chooseLevel3Client("all");
return;
} else {
$scope.chooseClientId = client.client_id;
$scope.params.client_ids = [client.client_id];
$scope.isAll = false;
$scope.dev_params.client_ids = [client.client_id];
$scope.showLevel3Clients = false;
$scope.listDevices();
}
$scope.loadTradeLogs();
};
$scope.chooseLevel3Client = function (client) {
if (client == 'all') {
$scope.params.client_ids = angular.copy($scope.level3ClientIds);
$scope.isLevel3All = true;
$scope.chooseLevel3ClientId = '';
$scope.dev_params.client_ids = angular.copy($scope.level3ClientIds);
$scope.listDevices();
} else {
$scope.chooseLevel3ClientId = client.client_id;
$scope.params.client_ids = [client.client_id];
$scope.isLevel3All = false;
$scope.dev_params.client_ids = [client.client_id];
$scope.listDevices();
}
$scope.loadTradeLogs();
};
$scope.listDevices = function () {
var params = angular.copy($scope.dev_params)
$http.get('/client/partner_info/devices', {params: params}).then(function (resp) {
$scope.devices = resp.data.data;
})
};
$scope.chooseDevices = function (dev_id) {
if(dev_id == 'all'){
$scope.chooseDevice_id = '';
$scope.params.dev_id = null;
$scope.device_isAll = true;
$scope.loadTradeLogs(1);
}else {
$scope.chooseDevice_id = dev_id;
$scope.params.dev_id = dev_id;
$scope.device_isAll = false;
$scope.loadTradeLogs(1);
}
};
$scope.listDevices();
if ($scope.currentUser.client.has_children) {
$http.get('/client/partner_info/sub_partners').then(function (resp) {
var clientList = resp.data;
clientList.forEach(function (client) {
$scope.clients.push(client);
});
$scope.clientIds = [];
$scope.clients.forEach(function (client) {
$scope.clientIds.push(client.client_id);
if (client.level3Clients) {
client.level3Clients.forEach(function (level3Client) {
$scope.clientIds.push(level3Client.client_id);
});
}
});
$scope.params.client_ids = angular.copy($scope.clientIds);
$scope.loadTradeLogs(1);
//console.log($rootScope.currentUser.client.clientList);
})
}else{
$scope.loadTradeLogs(1);
}
$scope.fullReleasePreAuth = function (){
var params = angular.copy($scope.params);
if (params.datefrom) {
params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd');
}
if (params.dateto) {
params.dateto = $filter('date')(params.dateto, 'yyyyMMdd');
}
commonDialog.confirm({
title: 'All Pre Authorization Completion',
content: 'These pre authorization orders will be taken into settlement, or you will be able to make a refund order. Are you sure?'
}).then(function(){
$http.put('/client/partner_info/trade_logs/full_release_preauth',params).then(function (resp){
$scope.loadTradeLogs(1);
alert("Success");
},function (resp) {
commonDialog.alert({title: 'Error!', content: resp.data.message, type: 'error'})
})
});
}
}]);
return app;
});

@ -0,0 +1,161 @@
<style>
*{margin: 0;padding: 0;}
@keyframes rotate_90 {
from {
transform: rotate(0deg);
}
to {
transform: rotate(90deg);
}
}
@-webkit-keyframes rotate_90 /* Safari and Chrome */
{
from {
-webkit-transform: rotate(0deg);
}
to {
-webkit-transform: rotate(90deg);
}
}
.popover-content button {
display: inline-block;
}
.position_re .position_ab {
position: absolute;
top: 90%;
left: 90%;
}
.img_auto_height_width {
height: 60px;
margin: 30px 0px;
}
.label-left{
float: left;
}
.border-show{
margin: 4px 0px;
font-size: 16px;
border-bottom: 1px solid ;
border-bottom-color: #ffb38c;
width: 90%;
text-align: left;
margin-left: 5%;
}
.service-background{
padding-top: 10px;
border: 2px solid #F06101;
margin: 21px 2%;
border-radius:10px;
text-align: center;
}
.service-info-button{
cursor:pointer;
height: 35px;
line-height: 35px;
width: 100% ;
text-align: center;
color: white;
}
</style>
<section class="content-header">
<h1>R Services</h1>
<ol class="breadcrumb">
<li class="active">R Services</li>
</ol>
</section>
<div class="content">
<div class="row">
<div class="col-sm-12">
<div class="box-solid">
<div class="box box-warning" ng-style="{'height':windowHeight}">
<div class="box-header" style="margin-top: 10px">
<!-- 已开通服务展示 -->
<div class="col-md-3 col-sm-3 col-xs-12" ng-repeat=" service in serviceAll">
<div class="service-background">
<img class="row img_auto_height_width" ng-src="{{service.logo_url}}">
<div class="row border-show">
<div class="col-md-4 col-sm-4 col-xs-6">
<label class="label-left">Name</label>
</div>
<div class="col-md-8 col-sm-8 col-xs-6 label-left">
{{service.channel}}
</div>
</div>
<div class="row border-show">
<div class="col-md-4 col-sm-4 col-xs-6">
<label class="label-left ">Mode</label>
</div>
<div class="col-md-8 col-sm-8 col-xs-6 label-left">
{{service.incremental_mode==1?'固定手续费':'固定金额扣款'}}
</div>
</div>
<div class="row border-show">
<div class="col-md-4 col-sm-4 col-xs-6">
<label class="label-left ">{{service.incremental_mode==1?'Rate':'Amount'}}</label>
</div>
<div class="col-md-8 col-sm-8 col-xs-6 label-left">
{{service.incremental_mode==1?service.incremental_rate_value+'%':service.total_incremental_amount}}
</div>
</div>
<div class="row border-show" style="margin-bottom: 35px">
<div class="col-md-4 col-sm-4 col-xs-6 label-left">
<label class="label-left ">Status</label>
</div>
<div class="col-md-8 col-sm-8 col-xs-6">
<span ng-style="{'color':service.is_valid?'#00A65A':'#DD4B39'}">{{service.is_valid?'已启用':'未启用' }}</span>
</div>
</div>
<div class="row border-show" style="background-color: #F06101;margin: -5px 0px -1px 0px; border-radius: 2px 1px 8px 8px; width: 100%;margin-left: 0px" >
<a class="col-md-12 col-sm-12 col-xs-12 service-info-button"
title="点击查看交易详情" ui-sref="partnerIncrementalServiceInfo({channel:service.channel})">
查看详情
</a>
</div>
</div>
</div>
<!-- 未开通服务展示 -->
<div class="col-md-3 col-sm-3 col-xs-12" ng-if="channel.name=='R跨境商城'" ng-repeat=" channel in channelOptions">
<div class="service-background">
<img class="row img_auto_height_width" ng-src="{{channel.logo_url}}">
<div class="row border-show">
<div class="col-md-4 col-sm-4 col-xs-6">
<label class="label-left">Name</label>
</div>
<div class="col-md-8 col-sm-8 col-xs-6 label-left">
{{channel.name}}
</div>
</div>
<div class="row border-show" style="margin-bottom: 20px">
<div class="col-md-4 col-sm-4 col-xs-6">
<label class="label-left ">Status</label>
</div>
<div class="col-md-8 col-sm-8 col-xs-6 label-left">
<span style="color:#DD4B39">未启用</span>
</div>
</div>
<div class="row border-show" style="height: 68px;margin: -10px 0px 20px 5%;padding-top: -10px" >
<div class="col-md-4 col-sm-4 col-xs-6 label-left">
<label class="label-left">Description</label>
</div>
<div class="col-md-8 col-sm-8 col-xs-6" style="font-size: 10px;line-height: 17px">
<span >一站式跨境进口电商SaaS平台帮您快速构建自己的品牌自营商城系统直达10亿+中国消费者,快速实现获客和交易变现。</span>
</div>
</div>
<div class="row border-show" style="background-color: #F06101;margin: -5px 0px -1px 0px; border-radius: 2px 1px 8px 8px; width: 100%;margin-left: 0px" >
<a target="_blank" class="col-md-12 col-sm-12 col-xs-12 service-info-button"
title="申请开通" ng-href="https://mch.royalpay.com.au/">
申请开通
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

@ -0,0 +1,426 @@
<style>
.cursor {
cursor: pointer;
}
.div-display {
display: none;
}
.i-rotate_90 {
animation: rotate_90 1s forwards;
-webkit-animation: rotate_90 1s forwards; /* Safari and Chrome */
}
@keyframes rotate_90 {
from {
transform: rotate(0deg);
}
to {
transform: rotate(90deg);
}
}
@-webkit-keyframes rotate_90 /* Safari and Chrome */
{
from {
-webkit-transform: rotate(0deg);
}
to {
-webkit-transform: rotate(90deg);
}
}
.popover-color {
background-color: #f7f7f7;
border-bottom: 1px solid #ebebeb;
color: black;
}
.popover-content button {
display: inline-block;
}
.position_re {
position: relative;
}
.position_re .position_ab {
position: absolute;
top: 90%;
left: 90%;
}
.box-icon_small {
width: 70px;
height: 70px;
font-size: 30px;
line-height: 70px
}
.info_box_bottom {
min-height: 70px;
margin-bottom: 0px
}
.box-content_left {
margin-left: 70px
}
.box-number_font {
font-size: 14px;
}
.line_height {
line-height: 14px
}
.line_height_ {
line-height: 22px;
}
</style>
<section class="content-header">
<h1>
<img height="40px" ng-src="{{serviceInfo.logo_url}}">
<span style="color:#F06101">{{serviceInfo.channel}}</span>
Service Info</h1>
<ol class="breadcrumb">
<li>
<i class="fa fa-comments-o"></i> Service List
</li>
<li class="active">{{serviceInfo.channel}} Service Info</li>
</ol>
</section>
<div class="content">
<div class="row" style="font-size: 18px">
<div class="col-sm-12">
<div class="box-solid">
<div class="box box-warning">
<div class="box-header">
<div class="row">
<div class="col-sm-12">
<div class="row">
<div class="col-sm-3">
<label>Mode:</label>
<span>{{serviceInfo.incremental_mode==1?'固定手续费':'固定金额扣款' }}</span>
</div>
<div class="col-sm-3">
<label>{{serviceInfo.incremental_mode==1?'Rate':'Amount'}}:</label>
<span>{{serviceInfo.incremental_mode==1?serviceInfo.incremental_rate_value+'%':serviceInfo.total_incremental_amount}}</span>
</div>
<div class="col-sm-3">
<label>Create Time:</label>
<span>{{serviceInfo.create_time }}</span>
</div>
<div class="col-sm-3">
<label>Status:</label>
<span ng-style="{'color':serviceInfo.is_valid?'#00A65A':'#DD4B39'}">{{serviceInfo.is_valid?'已启用':'未启用' }}</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<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">
<label class="control-label col-xs-4 col-sm-2">Source</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':params.source=='ALL'}"
ng-click="params.source='ALL';loadTradeLogs(1)">All</a> |
<a role="button" ng-class="{'bg-primary':params.source=='system'}"
ng-click="params.source='system';loadTradeLogs(1)">System</a> |
<a role="button" ng-class="{'bg-primary':params.source=='R跨境商城'}"
ng-click="params.source='R跨境商城';loadTradeLogs(1)">R跨境商城</a>
</p>
</div>
</div>-->
<div class="form-group col-xs-12">
<label class="control-label col-xs-4 col-sm-2">Status</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':params.status=='ALL'}"
ng-click="params.status='ALL';loadTradeLogs(1)">All</a> |
<a role="button" ng-class="{'bg-primary':params.status=='PAID'}"
ng-click="params.status='PAID';loadTradeLogs(1)">Payment Success</a> |
<a role="button" ng-class="{'bg-primary':params.status=='ALL_REFUNDED'}"
ng-click="params.status='ALL_REFUNDED';loadTradeLogs(1)">All Refund</a> |
<a role="button" ng-class="{'bg-primary':params.status=='PARTIAL_REFUNDED'}"
ng-click="params.status='PARTIAL_REFUNDED';loadTradeLogs(1)">Partial Refund</a> |
<a role="button" ng-class="{'bg-primary':params.status=='FULL_REFUNDED'}"
ng-click="params.status='FULL_REFUNDED';loadTradeLogs(1)">Full Refund</a>
</p>
</div>
</div>
<div class="form-group col-xs-12">
<label class="control-label col-xs-4 col-sm-2">Channel</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':params.channel=='ALL'}"
ng-click="params.channel='ALL';loadTradeLogs(1)">All</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='WECHAT'}"
ng-click="params.channel='WECHAT';loadTradeLogs(1)">Wechat Pay</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='ALIPAY'}"
ng-click="params.channel='ALIPAY';loadTradeLogs(1)">Alipay</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='ALIPAYONLINE'}"
ng-click="params.channel='ALIPAYONLINE';loadTradeLogs(1)">AlipayOnline</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='BESTPAY'}"
ng-click="params.channel='BESTPAY';loadTradeLogs(1)">BestPay</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='JD'}"
ng-click="params.channel='JD';loadTradeLogs(1)">JD Pay</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='HF'}"
ng-click="params.channel='HF';loadTradeLogs(1)">HF Pay</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='RPAY'}"
ng-click="params.channel='RPAY';loadTradeLogs(1)">RPay+</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='YEEPAY'}"
ng-click="params.channel='YEEPAY';loadTradeLogs(1)">Yeepay</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='LAKALAPAY'}"
ng-click="params.channel='LAKALAPAY';loadTradeLogs(1)">LakalaPay</a>
</p>
</div>
</div>
<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 col-xs-8">
<div class="form-control-static form-inline">
<div style="display: inline-block">
<input class="form-control" id="date-from-input"
ng-model="params.datefrom"
uib-datepicker-popup size="10" placeholder="From"
is-open="dateBegin.open" ng-click="dateBegin.open=true"
datepicker-options="{maxDate:params.dateto||today}">
</div>
~
<div style="display: inline-block">
<input class="form-control" id="date-to-input"
ng-model="params.dateto"
uib-datepicker-popup size="10" placeholder="To"
is-open="dateTo.open" ng-click="dateTo.open=true"
datepicker-options="{minDate:params.datefrom,maxDate:today}">
</div>
<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>
</div>
</div>
<div class="form-group col-xs-12" ng-if="currentUser.client.has_children">
<label class="control-label col-xs-4 col-sm-2">Sub Partner</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':isAll}" ng-click="chooseClient('all')">All</a>
<label ng-repeat="sub in clients">
|&nbsp;
<a role="button" ng-class="{'bg-primary':sub.client_id==chooseClientId}" ng-click="chooseClient(sub)">{{sub.short_name}}</a>
&nbsp;
</label>
</p>
</div>
</div>
<div class="form-group col-xs-12" ng-if="level3Clients && showLevel3Clients">
<label class="control-label col-xs-4 col-sm-2">Sub-Partner of sub-partners</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':isLevel3All}" ng-click="chooseLevel3Client('all')">All</a>
<label ng-repeat="sub in level3Clients">
|&nbsp;
<a role="button" ng-class="{'bg-primary':sub.client_id==chooseLevel3ClientId}" ng-click="chooseLevel3Client(sub)">{{sub.short_name}}</a>
&nbsp;
</label>
</p>
</div>
</div>
<button class="btn btn-success" type="button" ng-click="loadTradeLogs(1)">
<i class="fa fa-search"></i> Search
</button>
</div>
</div>
</div>
</div>
</div>
<div class="box">
<div class="box-header">
<div class="row">
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="info-box info_box_bottom">
<span class="info-box-icon bg-aqua box-icon_small"><i class="ion ion-social-usd"></i></span>
<div class="info-box-content box-content_left">
<span class="info-box-text">Transaction Amount</span>
<span class="info-box-number box-number_font"
ng-bind="analysis.paid_fee|currency:'AUD '"></span>
<span class="small">( {{analysis.order_count}} Orders )</span>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 col-xs-12" ng-if="!analysis.cny_display_amount">
<div class="info-box info_box_bottom">
<span class="info-box-icon bg-aqua box-icon_small"><i class="ion ion-social-usd"></i></span>
<div class="info-box-content box-content_left">
<span class="info-box-text">Input Amount</span>
<span class="info-box-number box-number_font"
ng-bind="analysis.display_amount|currency:'AUD '"></span>
<span class="small"> ( {{analysis.pre_display_amount | currency:'pre authorization '}} )</span>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 col-xs-12" ng-if="analysis.cny_display_amount">
<div class="info-box info_box_bottom" ng-class="{'line_height':analysis.pre_display_amount||analysis.pre_cny_display_amount}">
<span class="info-box-icon bg-aqua box-icon_small"><i class="ion ion-social-usd"></i></span>
<div class="info-box-content box-content_left">
<span class="info-box-text" >Input Amount</span>
<span class="info-box-number box-number_font" style="margin-bottom: -3px;" ng-class="{line_height_:!analysis.pre_display_amount}"
ng-bind="analysis.display_amount|currency:'AUD '"></span>
<span style="font-size: 10px;line-height: 10px" ng-if="analysis.pre_display_amount">
( {{analysis.pre_display_amount | currency:'pre authorization '}} )
</span>
<span class="info-box-number box-number_font" style="margin-bottom: -3px;"
ng-if="analysis.cny_display_amount"
ng-bind="analysis.cny_display_amount|currency:'CNY '"></span>
<span style="font-size: 10px;line-height: 10px" ng-if="analysis.pre_cny_display_amount">
( {{analysis.pre_cny_display_amount | currency:'pre authorization '}} )
</span>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="info-box info_box_bottom">
<span class="info-box-icon bg-red box-icon_small"><i class="ion ion-android-warning"></i></span>
<div class="info-box-content box-content_left">
<span class="info-box-text">Refund Amount</span>
<span class="info-box-number box-number_font"
ng-bind="analysis.refund_fee|currency:'AUD '"></span>
<span class=small" ng-if="analysis.pre_refund_fee">
({{analysis.pre_refund_fee|currency:'pre authorization '}})
</span>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="info-box info_box_bottom">
<span class="info-box-icon bg-yellow box-icon_small"><i class="ion ion-ios-people"></i></span>
<div class="info-box-content box-content_left">
<span class="info-box-text">Incremental Surcharge</span>
<span class="info-box-number box-number_font"
ng-bind="analysis.incremental_surcharge|currency:'AUD '">
</span>
<span style="color: red" ng-if="analysis.refund_incremental_surcharge">({{analysis.all_incremental_surcharge}} - {{analysis.refund_incremental_surcharge}} = {{analysis.incremental_surcharge}}) </span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="box">
<div class="box-header">
<h3 class="box-title" style="display: inherit">Orders</h3>
</div>
<div class="box-body table-responsive">
<table class="table table-bordered table-hover table-striped">
<thead>
<tr>
<th>Client Order ID</th>
<th>Order ID</th>
<th>Amount</th>
<th>Input Amount</th>
<th>System Rate</th>
<th>System Profit</th>
<th>Incremental Rate</th>
<th>Incremental Profit</th>
<th>Status</th>
<th>Create Time</th>
<th>Operation</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="trade in tradeLogs" ng-class="{warning:trade.clearing_status==2}">
<td ng-bind="trade.client_order_id||'NOT PROVIDED'"></td>
<td>
<img src="/static/images/clearing-icon.png" uib-tooltip="clearing" ng-if="trade.clearing_status=='1'"/>
<i class="fa fa-check-circle-o text-danger" uib-tooltip="Refund Audition Required" ng-if="trade.audition"></i>
<img src="/static/images/royalpay_sign_s.png" uib-tooltip="RoyalPay" ng-if="trade.source=='system'"/>
<img src="/static/images/yangmaimai_sign.png" uib-tooltip="R跨境商城" ng-if="trade.source=='R跨境商城'"/>
<img src="/static/images/wechatpay_sign.png" uib-tooltip="Znyoo" ng-if="trade.channel=='Znyoo'"/>
<img src="/static/images/wechatpay_sign.png" uib-tooltip="Wechat Pay" ng-if="trade.channel=='Wechat'"/>
<img src="/static/images/bestpay_sign.png" uib-tooltip="BestPay" alt="BestPay" ng-if="trade.channel=='Bestpay'"/>
<img src="/static/images/alipay_sign.png" uib-tooltip="Alipay" alt="Alipay" ng-if="trade.channel=='Alipay'"/>
<img src="/static/images/alipay_sign.png" uib-tooltip="AlipayOnline" alt="AlipayOnline" ng-if="trade.channel=='AlipayOnline'"/>
<img src="/static/images/jd_sign.png" uib-tooltip="JD Pay" ng-if="trade.channel=='jd'"/>
<img src="/static/images/hf_sign.png" uib-tooltip="HF Pay" ng-if="trade.channel=='hf'"/>
<img src="/static/images/rpayplus_sign.png" uib-tooltip="RPay+" ng-if="trade.channel=='Rpay'"/>
<img src="/static/images/yeepay_sign.png" uib-tooltip="Yeepay" ng-if="trade.channel=='Yeepay'"/>
<img src="/static/images/lakalapay_sign.png" uib-tooltip="LakalaPay" ng-if="trade.channel=='LakalaPay'"/>
{{trade.order_id}}
</td>
<td>
{{trade.total_amount|currency:trade.currency+' '}}
<a ng-if="trade.refund_fee" class="text-danger" role="button">(-{{trade.refund_fee}})</a>
</td>
<td ng-bind="trade.display_amount|currency:trade.currency"></td>
<td>{{(trade.surcharge_rate * 100 - trade.rate_value)| number : 2}}<span ng-if="trade.surcharge_rate">%</span></td>
<td>{{(trade.total_surcharge-trade.incremental_surcharge) | number : 2 | currency:trade.currency}}</td>
<td><span ng-if="trade.rate_value">{{trade.source}}:{{(trade.rate_value) | number : 2}}%</span></td>
<td>{{trade.source}}:<span ng-if="trade.incremental_surcharge">{{trade.incremental_surcharge | currency:trade.currency}}</span><span ng-if="!trade.incremental_surcharge">{{0.00 | currency:trade.currency}}</span></td>
<td ng-bind="trade.status|tradeStatus"></td>
<td ng-bind="trade.create_time"></td>
<td>
<a role="button" class="text-bold" ng-click="showTradeDetail(trade)" title="Detail">
<i class="fa fa-list-alt"></i>
</a>
</a>
</td>
</tr>
</tbody>
</table>
</div>
<div class="box-footer" ng-if="tradeLogs.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="loadTradeLogs()"
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>
</div>
</div>
</div>
</div>

@ -11,7 +11,7 @@ define(['angular','decimal'], function (angular,decimal) {
controller: 'partnerInvoiceApp'
})
}]);
app.controller('partnerInvoiceApp', ['$scope', '$http','$filter', 'commonDialog', function ($scope, $http,$filter, commonDialog) {
app.controller('partnerInvoiceApp', ['$scope', '$http','$filter', 'commonDialog','$sce',function ($scope, $http,$filter, commonDialog, $sce) {
$scope.params = {channel:'ALL',clearing_status:-1,client_ids:[$scope.currentUser.client.client_id]};
$scope.today = new Date();
$scope.pagination = {};
@ -90,6 +90,7 @@ define(['angular','decimal'], function (angular,decimal) {
params.page = page || $scope.pagination.page || 1;
$http.get('/partner/invoice/trans_flow', {params: params}).then(function (resp) {
$scope.tradeLogs = resp.data.data;
$scope.htmlToolst();
$scope.tradeLogs.forEach(function (log) {
if(log.total_surcharge){
log.total_surcharge = decimal.add(log.total_surcharge,log.tax_amount).toFixed(2);
@ -136,6 +137,28 @@ define(['angular','decimal'], function (angular,decimal) {
return url;
}
$scope.htmlToolst = function(){
for(var i=0;i< $scope.tradeLogs.length;i++){
var tax_amount = $scope.tradeLogs[i].tax_amount;
var total_surcharge= $scope.tradeLogs[i].total_surcharge;
var incremental_surcharge = $scope.tradeLogs[i].incremental_surcharge;
var channel_surcharge = $scope.tradeLogs[i].channel_surcharge;
var royal_surcharge = $scope.tradeLogs[i].royal_surcharge;
var system_surcharge = (total_surcharge-incremental_surcharge).toFixed(2);
var channel = $scope.tradeLogs[i].source;
var tip = '<div style="width: 180px">' +
'<h5>手续费组成</h5>'+'<div style="background-color: #EFEFF5;height: 1px;margin-bottom: 10px;"></div>'+
'<p>system:'+ system_surcharge +'</p>' +
'<p>'+channel+':'+ incremental_surcharge +'</p>';
var a = royal_surcharge+incremental_surcharge+channel_surcharge+tax_amount;
if(total_surcharge <= (royal_surcharge+incremental_surcharge+channel_surcharge+tax_amount)){
tip = tip +'<p>tax amount:'+ tax_amount +'</p>';
}
tip = tip + '</div>';
$scope.tradeLogs[i].htmlTooltip = $sce.trustAsHtml(tip);
}
};
}]);
return app;
});
});

@ -194,6 +194,10 @@
<tr ng-repeat="trade in tradeLogs" ng-class="{'tr_refund':trade.trans_type=='refund','tr_clearing':trade.trans_type=='clearing'}">
<td ng-bind="trade.transaction_time||'NOT PROVIDED'"></td>
<td>
<img src="/static/images/royalpay_sign_s.png"
uib-tooltip="RoyalPay" ng-if="trade.source=='system'"/>
<img src="/static/images/yangmaimai_sign.png"
uib-tooltip="R跨境商城" ng-if="trade.source=='R跨境商城'"/>
<img src="/static/images/wechatpay_sign.png"
uib-tooltip="Znyoo" ng-if="trade.channel=='Znyoo'"/>
<img src="/static/images/wechatpay_sign.png"
@ -208,7 +212,7 @@
uib-tooltip="HF Pay" ng-if="trade.channel=='hf'"/>
<img src="/static/images/rpayplus_sign.png"
uib-tooltip="RPay+" ng-if="trade.channel=='Rpay'"/>
{{trade.order_id2}}
{{trade.order_id2}}<span ng-if="trade.source!='system' && trade.source!=null && trade.incremental_surcharge != null"><i class="fa fa-question-circle-o" uib-tooltip-html="trade.htmlTooltip"></i></span>
</td>
<td ng-bind="trade.currency"></td>
<td ng-bind="trade.display_amount"></td>
@ -265,4 +269,4 @@
</div>
</div>
</div>
</div>
</div>

@ -197,6 +197,10 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
url: '/permission_client',
templateUrl: 'static/payment/partner/templates/partner_permission.html',
controller: 'permissionClientCtrl'
}).state('partners.detail.incremental_service', {
url: '/incremental_service',
templateUrl: 'static/payment/partner/templates/incremental_service.html',
controller: 'incrementalServiceCtrl'
});
}]);
app.controller('partnerListCtrl', ['$scope', '$sce', '$http', '$filter', '$uibModal', 'businessStructuresMap', 'industryMap', 'stateMap', 'sectorMap', 'countryMap',
@ -3351,6 +3355,28 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
params.dateto = $filter('date')(params.dateto, 'yyyyMMdd');
}
params.page = page || $scope.pagination.page || 1;
if(params.gateway){
if((params.gateway.sort().toString()!=[0,1].toString()) && (params.gateway.sort().toString()!=[5,6].toString())){
delete params.gatewayChilds;
delete params.gatewayChild;
}
if(params.gatewayChilds){
var exist = false
params.gatewayChilds.forEach(function (child) {
if(child==params.gatewayChild){
exist = true
}
})
if(!exist){
params.gatewayChild = null
}
}else{
delete params.gatewayChild;
}
}else{
delete params.gatewayChilds;
delete params.gatewayChild;
}
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/trade_logs', {params: params}).then(function (resp) {
$scope.tradeLogs = resp.data.data;
$scope.pagination = resp.data.pagination;
@ -3358,6 +3384,11 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
});
};
$scope.initGatewayChild = function(){
$scope.params.gatewayChilds = $scope.params.gateway;
$scope.params.gatewayChild=null;
$scope.loadTradeLogs(1);
}
$scope.gatewaySelected = function (arr) {
return $scope.params.gateway != null && $scope.params.gateway.filter(function (gateway) {
return arr.indexOf(gateway) >= 0
@ -4016,8 +4047,89 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
app.controller('partnerSettlementCtrl', ['$scope', '$uibModal', '$http', 'clientMoniker', '$filter', function ($scope, $uibModal, $http, clientMoniker, $filter) {
$scope.params = {};
$scope.pagination = {};
$scope.today = new Date();
$scope.clients = [];
$scope.showLevel3Clients = false;
$scope.isLevel3All = true;
$scope.clinet = {};
$scope.isAll = true;
$scope.initClientInfo = function(){
$http.get('/sys/partners/'+clientMoniker).then(function (resp) {
$scope.client = resp.data
$scope.clients = [$scope.client];
if ($scope.client.has_children) {
$scope.params.client_ids = [$scope.client.client_id];
$http.get('/sys/partners/'+clientMoniker+'/sub_clients').then(function (resp) {
var clientList = resp.data;
clientList.forEach(function (client) {
$scope.clients.push(client);
});
$scope.clientIds = [];
$scope.clients.forEach(function (client) {
$scope.clientIds.push(client.client_id);
if (client.level3Clients) {
client.level3Clients.forEach(function (level3Client) {
$scope.clientIds.push(level3Client.client_id);
});
}
});
$scope.params.client_ids = angular.copy($scope.clientIds);
$scope.loadSettlementLogs(1);
})
}
});
}
$scope.initClientInfo();
$scope.exportSettlementLogs = function() {
var params = angular.copy($scope.params);
var url = '/sys/partners/'+clientMoniker+'/lists_settlements/excel';
var connectSymbol = '?';
if (params.datefrom) {
params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd');
url += connectSymbol + 'datefrom=' + params.datefrom;
connectSymbol = '&';
}
if (params.dateto) {
params.dateto = $filter('date')(params.dateto, 'yyyyMMdd');
url += connectSymbol + 'dateto=' + params.dateto;
}
if (params.client_ids){
params.client_ids.forEach(function (i) {
url += connectSymbol + 'client_ids=' + i;
connectSymbol = '&';
});
}
return url;
};
$scope.chooseClient = function (client) {
if (client == 'all') {
$scope.params.client_ids = angular.copy($scope.clientIds);
$scope.isAll = true;
$scope.chooseClientId = '';
$scope.showLevel3Clients = false;
} else if (client.level3Clients) {
$scope.chooseClientId = client.client_id;
$scope.showLevel3Clients = true;
$scope.level3Clients = client.level3Clients;
$scope.isAll = false;
$scope.level3ClientIds = [];
$scope.level3ClientIds.push(client.client_id);
client.level3Clients.forEach(function (client) {
$scope.level3ClientIds.push(client.client_id);
});
$scope.chooseLevel3Client("all");
return;
} else {
$scope.chooseClientId = client.client_id;
$scope.params.client_ids = [client.client_id];
$scope.isAll = false;
$scope.showLevel3Clients = false;
}
$scope.loadSettlementLogs();
};
$scope.today = new Date();
$scope.chooseToday = function () {
$scope.params.datefrom = $scope.params.dateto = new Date();
$scope.loadSettlementLogs(1);
@ -5159,6 +5271,141 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
};
}]);
app.controller('incrementalServiceCtrl',['$scope', '$http', '$uibModal', '$state', '$filter', 'commonDialog',function($scope, $http, $uibModal, $state, $filter, commonDialog){
$scope.serviceAll = {};
$scope.channelOptions=[];
$scope.initData = function(){
$http.get('/sys/partners/' + $scope.partner.client_moniker+'/incremental_service').then(function(res){
$scope.serviceAll = res.data.all_service;
$scope.serviceAll.forEach(function(service){
service.logo_url = '/static/images/'+service.channel+'.jpg'
service.logo_url = $scope.CheckImgExists(service.logo_url)?service.logo_url:'/static/images/royalpay_sign.png'
})
$scope.channelOptions=res.data.incremental_channel;
})
}
$scope.CheckImgExists =function (url) {
var xmlHttp ;
if (window.ActiveXObject)
{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest)
{
xmlHttp = new XMLHttpRequest();
}
xmlHttp.open("Get",url,false);
xmlHttp.send();
if(xmlHttp.status==404)
return false;
else
return true;
}
$scope.initData();
$scope.newServiceChannelDialog = function (){
$uibModal.open({
templateUrl: '/static/payment/partner/templates/incremental_service_dialog.html',
controller: 'incrementalServiceDialogCtrl',
resolve: {
params: function(){
return {
isCreate:true,
clientMoniker:$scope.partner.client_moniker,
channelOptions:$scope.channelOptions,
serviceChannel:null
}
}
}
}).result.then(function () {
$scope.initData();
});
}
$scope.editServiceChannelDialog = function (serviceChannel){
$uibModal.open({
templateUrl: '/static/payment/partner/templates/incremental_service_dialog.html',
controller: 'incrementalServiceDialogCtrl',
resolve: {
params: function(){
return {
isCreate:false,
clientMoniker:$scope.partner.client_moniker,
channelOptions:$scope.channelOptions,
serviceChannel:serviceChannel
}
}
}
}).result.then(function () {
$scope.initData();
});
}
$scope.updateStatus = function(service){
commonDialog.confirm({
title: 'Update '+service.channel+ ' Incremental Service Status',
content: 'Are you sure update ' + service.channel + ' status',
choises: [
{label: 'Submit', className: 'btn-success', key: 1},
{label: 'Cancel', className: 'btn-warning', key: 0, dismiss: true}
]
}).then(function (choice) {
if (choice == 1) {
service.is_valid = !service.is_valid;
$http.put('/sys/partners/'+$scope.partner.client_moniker+'/incremental_service/status',service).then(function(res){
commonDialog.alert({
title: 'Success',
content: 'Update Service Successful!',
type: 'success'
});
$scope.initData();
},function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
$scope.initData();
})
}
})
}
}]);
app.controller('incrementalServiceDialogCtrl',['$scope','$http','params','commonDialog',function($scope ,$http,params,commonDialog){
$scope.model ={};
$scope.ctrl = {sending: false};
$scope.isCreate = true;
$scope.initData =function(){
$scope.isCreate = angular.copy(params.isCreate);
if($scope.isCreate ){
$scope.model.incremental_mode = "1"
$scope.model.channel= angular.copy(params.channelOptions[0])
$scope.model.channelOptions= angular.copy(params.channelOptions)
}else{
$scope.model = angular.copy(params.serviceChannel);
$scope.model.incremental_mode = $scope.model.incremental_mode.toString()
}
}
$scope.initData();
$scope.save = function(form){
if (form.$invalid) {
angular.forEach(form, function (item, key) {
if (key.indexOf('$') < 0) {
item.$dirty = true;
}
});
return;
}
$scope.ctrl.sending = true;
$http.post('/sys/partners/'+params.clientMoniker+'/incremental_service',$scope.model).then(function(res){
commonDialog.alert({
title: 'Success',
content: $scope.isCreate?'Create Service Successful!':'Update Service Successful!',
type: 'success'
});
$scope.ctrl.sending = false;
$scope.$close();
},function (resp) {
$scope.ctrl.sending = false;
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
})
}
}])
app.filter('bdOrg', function () {

@ -0,0 +1,38 @@
<div class="row">
<div class="col-sm-12">
<div class="table-responsive col-sm-12">
<button class="btn btn-success" role="button" ng-if="channelOptions.length>0" ng-click="newServiceChannelDialog()" style="margin: 5px">新增增值服务</button>
<table class="table table-bordered table-hover table-striped">
<thead>
<tr>
<th>Logo</th>
<th>Channel</th>
<th>Mode</th>
<th>Rate Value</th>
<th>Amount</th>
<th>Operator</th>
<th>Create Time</th>
<th>Update Time</th>
<th>Operation</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="service in serviceAll">
<td style="max-width: 160px;line-height: 90px"><img style=" height:80px; max-width: 180px;"ng-src="{{service.logo_url}}"/></td>
<td style="line-height: 90px">{{service.channel}}</td>
<td style="line-height: 90px">{{service.incremental_mode==1?'固定手续费':'固定金额扣款' }}</td>
<td style="line-height: 90px">{{service.incremental_rate_value!=null?service.incremental_rate_value+'%':'-'}}</td>
<td style="line-height: 90px">{{service.total_incremental_amount}}</td>
<td style="line-height: 90px">{{service.operator}}</td>
<td style="line-height: 90px">{{service.create_time}}</td>
<td style="line-height: 90px">{{service.update_time}}</td>
<td style="line-height: 90px">
<a role="button" ng-click="editServiceChannelDialog(service)" ng-if="'011'|withRole"><i class="fa fa-edit"></i></a> |
<a role="button" ng-click="updateStatus(service)">{{service.is_valid?'禁用':'启用'}}</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>

@ -0,0 +1,72 @@
<div class="modal-header">
<h4>{{isCreate?"New":"Edit"}} Service</h4>
</div>
<div class="modal-body">
<div class="alert alert-danger" ng-if="errmsg" ng-bind="errmsg"></div>
<div class="row">
<div class="col-sm-12">
<form novalidate name="service_form" class="form-horizontal">
<div class="form-group has-feedback" ng-if="isCreate"
ng-class="{'has-error':service_form.channel.$invalid && service_form.channel.$dirty}">
<label class="control-label col-sm-4">Service Channel:</label>
<div class="col-sm-6">
<select class="form-control" name="channel" id="channel-input" required
ng-model="model.channel"
ng-options="channel for channel in model.channelOptions">
</select>
<span ng-messages="service_form.channel.$error" ng-if="service_form.channel.$dirty" ng-message="required">Required Field</span>
</div>
</div>
<div class="form-group has-feedback"
ng-class="{'has-error':service_form.incremental_mode.$invalid && service_form.incremental_mode.$dirty}">
<label class="control-label col-sm-4">Mode:</label>
<div class="col-sm-6">
<select class="form-control" name="incrementalMode" id="incrementalMode-input" required
ng-model="model.incremental_mode">
<option value="1">固定手续费</option>
<option value="2">固定金额扣款</option>
</select>
<span ng-messages="service_form.incremental_mode.$error" ng-if="service_form.incremental_mode.$dirty" ng-message="required">Required Field</span>
</div>
</div>
<div class="form-group has-feedback" ng-if="model.incremental_mode==1" ng-class="{'has-error':service_form.incremental_rate_value.$invalid && service_form.incremental_rate_value.$dirty}">
<label class="control-label col-sm-4" style="text-align: right">Rate Value:</label>
<div class="col-sm-6">
<div class="input-group">
<input type="number" name="incremental_rate_value" stringToNumber2 class="form-control" ng-model="model.incremental_rate_value" max="100" min="0" step="0" id="incremental_rate_value" required>
<div class="input-group-addon">%</div>
</div>
<div ng-messages="service_form.incremental_rate_value.$error" ng-if="service_form.incremental_rate_value.$dirty">
<div class="small text-danger" ng-message="min">
<i class="glyphicon glyphicon-alert"></i> No less than 0%
</div>
<div class="small text-danger" ng-message="max">
<i class="glyphicon glyphicon-alert"></i> No less than 100%
</div>
<div class="small text-danger" ng-message="required">
<i class="glyphicon glyphicon-alert"></i> Required Field
</div>
</div>
</div>
</div>
<div class="form-group has-feedback" ng-if="model.incremental_mode==2" ng-class="{'has-error':service_form.total_incremental_amount.$invalid && service_form.total_incremental_amount.$dirty}">
<label class="control-label col-sm-4" style="text-align: right">Amount:</label>
<div class="col-sm-6">
<input type="number" name="total_incremental_amount" stringToNumber2 class="form-control" ng-model="model.total_incremental_amount"
min="0" maxlength="20" id="total_incremental_amount" required>
<div ng-messages="service_form.total_incremental_amount.$error" ng-if="service_form.total_incremental_amount.$dirty">
<div class="small text-danger" ng-message="required">
<i class="glyphicon glyphicon-alert"></i> Required Field
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-success" type="button" ng-click="save(service_form)" ng-disabled="ctrl.sending">Submit</button>
<button class="btn btn-danger" type="button" ng-click="$dismiss()">Cancel</button>
</div>

@ -295,6 +295,9 @@
<li ui-sref-active="active" ng-if="partner.is_valid==1">
<a ui-sref=".permission_client">Permissions</a>
</li>
<li ui-sref-active="active" ng-if="partner.is_valid==1">
<a ui-sref=".incremental_service">R Services</a>
</li>
</ul>
<div class="tab-content" ui-view>
<div class="panel panel-default">

@ -42,9 +42,9 @@
<a role="button" ng-class="{'bg-primary':params.gateway==null}"
ng-click="params.gateway=null;loadTradeLogs(1)">All</a> |
<a role="button" ng-class="{'bg-primary':gatewaySelected([0,1])}"
ng-click="params.gateway=[0,1];loadTradeLogs(1)">Retail In-Store</a> |
ng-click="params.gateway=[0,1];initGatewayChild()">Retail In-Store</a> |
<a role="button" ng-class="{'bg-primary':gatewaySelected([5,6])}"
ng-click="params.gateway=[5,6];loadTradeLogs(1)">Retail API</a> |
ng-click="params.gateway=[5,6];initGatewayChild()">Retail API</a> |
<a role="button" ng-class="{'bg-primary':gatewaySelected([2,7])}"
ng-click="params.gateway=[2,7];loadTradeLogs(1)">QR Code</a> |
<a role="button" ng-class="{'bg-primary':gatewaySelected([3])}"
@ -68,6 +68,28 @@
</p>
</div>
</div>
<div class="form-group col-xs-12"
ng-if="params.gateway.sort().toString()==[0,1] || params.gateway.sort().toString()==[5,6]">
<label class="control-label col-xs-4 col-sm-2">Type of payment</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':params.gatewayChild==null}"
ng-click="params.gatewayChild=null;loadTradeLogs(1)">All</a> |
<a role="button" ng-if="params.gateway.sort().toString()==[0,1]"
ng-class="{'bg-primary':params.gatewayChild==1}"
ng-click="params.gatewayChild=1;loadTradeLogs(1)">线下B端二维码 |</a>
<a role="button" ng-if="params.gateway.sort().toString()==[0,1]"
ng-class="{'bg-primary':params.gatewayChild==0}"
ng-click="params.gatewayChild=0;loadTradeLogs(1)">线下C端支付码</a>
<a role="button" ng-if="params.gateway.sort().toString()==[5,6]"
ng-class="{'bg-primary':params.gatewayChild==6}"
ng-click="params.gatewayChild=6;loadTradeLogs(1)">线下网关(B端二维码) |</a>
<a role="button" ng-if="params.gateway.sort().toString()==[5,6]"
ng-class="{'bg-primary':params.gatewayChild==5}"
ng-click="params.gatewayChild=5;loadTradeLogs(1)">线下网关(C端支付码)</a>
</p>
</div>
</div>
<div class="form-group col-xs-12">
<label class="control-label col-xs-4 col-sm-2">Channel</label>
<div class="col-sm-10 col-xs-8">

@ -50,6 +50,20 @@
</div>
</div>
</div>
<div class="form-group col-xs-12" ng-if="client.has_children">
<label class="control-label col-xs-4 col-sm-2">Sub Partner</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':isAll}"
ng-click="chooseClient('all')">All</a>
<label ng-repeat="sub in clients">
|&nbsp;<a role="button"
ng-class="{'bg-primary':sub.client_id==chooseClientId}"
ng-click="chooseClient(sub)">{{sub.short_name}}</a>&nbsp;
</label>
</p>
</div>
</div>
<button class="btn btn-success" type="button" ng-click="loadSettlementLogs(1)">
<i class="fa fa-search"></i> Search
</button>
@ -61,7 +75,7 @@
<div class="box box-warning">
<div class="box-header">
<h3 class="box-title">Clearing Logs</h3>
<a ng-if="settlementLogs.length>0" target="_blank" style="float: right" ng-href="{{exportSettlementLogs()}}"> <i class="fa fa-download"></i>Export Settlement Summary</a>
</div>
<div class="box-body table-responsive">
<table class="table table-bordered table-hover table-striped">

@ -98,8 +98,31 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
$scope.analysis = resp.data.analysis;
});
};
$scope.excelSettlementAllLogs = function(){
var params = angular.copy($scope.params);
var url = '/client/trans_flow/settlement/log/excelAll';
var connectSymbol = '?';
if (params.datefrom) {
params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd');
url += connectSymbol + 'datefrom=' + params.datefrom;
connectSymbol = '&';
}
if (params.dateto) {
params.dateto = $filter('date')(params.dateto, 'yyyyMMdd');
url += connectSymbol + 'dateto=' + params.dateto;
}
if (params.client_ids){
params.client_ids.forEach(function (i) {
url += connectSymbol + 'client_ids=' + i;
connectSymbol = '&';
});
}
return url;
}
$scope.loadSettlementLogs(1);
$scope.chooseLast7Days();
$scope.exportSettlementLogs = function(pattern) {
var params = angular.copy($scope.params);
var url = '/client/trans_flow/settlement/log/excel';

@ -116,6 +116,17 @@
</p>
</div>
</div>
<div class="form-group col-xs-12" ng-if="deviceIds.length">
<label class="control-label col-xs-4 col-sm-2">Third Device</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':order_device_isAll}" ng-click="chooseDeviceIds('all')">All</a>
<label ng-repeat="dev in deviceIds">
|&nbsp;<a role="button" ng-class="{'bg-primary':dev.dev_id==choose_order_device_id}" ng-click="chooseDeviceIds(dev.dev_id)">{{dev.dev_id}}</a>&nbsp;
</label>
</p>
</div>
</div>
<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 col-xs-8">
@ -311,6 +322,10 @@
<tr ng-repeat="trade in tradeLogs" ng-class="{'tr_refund':trade.trans_type=='refund','tr_clearing':trade.trans_type=='clearing',warning:trade.clearing_status==2}">
<td ng-bind="trade.transaction_time||'NOT PROVIDED'"></td>
<td>
<img src="/static/images/royalpay_sign_s.png"
uib-tooltip="RoyalPay" ng-if="trade.source=='system'"/>
<img src="/static/images/yangmaimai_sign.png"
uib-tooltip="R跨境商城" ng-if="trade.source=='R跨境商城'"/>
<img src="/static/images/wechatpay_sign.png"
uib-tooltip="Znyoo" ng-if="trade.channel=='Znyoo'"/>
<img src="/static/images/wechatpay_sign.png"
@ -331,7 +346,7 @@
uib-tooltip="Yeepay" ng-if="trade.channel=='Yeepay'"/>
<img src="/static/images/lakalapay_sign.png"
uib-tooltip="LakalaPay" ng-if="trade.channel=='LakalaPay'"/>
{{trade.order_id2}}
{{trade.order_id2}}<span ng-if="trade.source!='system' && trade.source!=null && trade.incremental_surcharge != null"><i class="fa fa-question-circle-o" uib-tooltip-html="trade.htmlTooltip"></i></span>
</td>
<td ng-bind="trade.currency"></td>
<td ng-bind="trade.display_amount"></td>

@ -0,0 +1,436 @@
<style>
.box-icon_small {
width: 70px;
height: 70px;
font-size: 30px;
line-height: 70px
}
.info_box_bottom {
min-height: 70px;
margin-bottom: 0px
}
.box-content_left {
margin-left: 70px
}
.box-number_font {
font-size: 14px
}
.line_height {
line-height: 14px
}
.line_height_ {
line-height: 22px;
}
.col-xs-1-5,
.col-sm-1-5,
.col-md-1-5,
.col-lg-1-5 {
position: relative;
min-height: 1px;
padding-right: 10px;
padding-left: 10px;
}
.col-xs-1-5 {
width: 20%;
float: left;
}
@media (min-width: 768px) {
.col-sm-1-5 {
width: 20%;
float: left;
}
}
@media (min-width: 992px) {
.col-md-1-5 {
width: 20%;
float: left;
}
}
@media (min-width: 1200px) {
.col-lg-1-5 {
width: 20%;
float: left;
}
}
</style>
<section class="content-header">
<h1>Trade Logs</h1>
<ol class="breadcrumb">
<li>
<i class="fa fa-list-alt"></i> Transaction
</li>
<li class="active">Trade Logs</li>
</ol>
</section>
<div class="content">
<div class="row">
<div class="col-sm-12">
<div class="box-solid">
<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">
<label class="col-xs-4 col-sm-2">
<select class="form-control" ng-model="params.textType">
<option value="all">ALL</option>
<option value="client_moniker">Partner Code</option>
<option value="client_name">Partner Name</option>
<option value="sys_trans_id">Platform Transaction ID</option>
<option value="channel">Channel</option>
<option value="order_id">Order ID</option>
<option value="remark">Remark</option>
</select>
</label>
<div class="col-sm-4 col-xs-8">
<input class="form-control" placeholder="Keyword"
ng-enter="loadTradeLogs(1)"
ng-model="params.searchText">
</div>
<div class="col-sm-6 col-xs-8">
<div ng-if="orgs" class="col-sm-6">
<select id="org-clild" class="form-control" ng-model="params.org_id"
ng-options="org.org_id as org.name group by org.type for org in orgs"
ng-change="params.org_id2 = '';loadOrgs();loadTradeLogs(1)">
<option value="">ALL Organizations</option>
</select>
</div>
<div ng-if="((orgs_child.length > 1) && ('1000011'|withRole))&&params.org_id || ((orgs_child.length > 0) && ('1000000000000'|withRole))"
class="col-sm-6">
<select id="org-select" class="form-control" ng-model="params.org_id2"
ng-options="org.org_id as org.name group by org.org_type for org in orgs_child"
ng-change="loadTradeLogs(1)">
<option value="">{{org2}}</option>
</select>
</div>
</div>
</div>
<div class="form-group col-xs-12">
<label class="control-label col-xs-4 col-sm-2">Status</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':params.status=='ALL'}"
ng-click="params.status='ALL';loadTradeLogs(1)">All</a> |
<a role="button" ng-class="{'bg-primary':params.status=='PAID'}"
ng-click="params.status='PAID';loadTradeLogs(1)">Payment Success</a>
|
<a role="button" ng-class="{'bg-primary':params.status=='ALL_REFUNDED'}"
ng-click="params.status='ALL_REFUNDED';loadTradeLogs(1)">All
Refund</a> |
<a role="button"
ng-class="{'bg-primary':params.status=='PARTIAL_REFUNDED'}"
ng-click="params.status='PARTIAL_REFUNDED';loadTradeLogs(1)">Partial
Refund</a> |
<a role="button"
ng-class="{'bg-primary':params.status=='FULL_REFUNDED'}"
ng-click="params.status='FULL_REFUNDED';loadTradeLogs(1)">Full
Refund</a>
</p>
</div>
</div>
<div class="form-group col-xs-12">
<label class="control-label col-xs-4 col-sm-2">Channel</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':params.channel=='ALL'}"
ng-click="params.channel='ALL';loadTradeLogs(1)">All</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='WECHAT'}"
ng-click="params.channel='WECHAT';loadTradeLogs(1)">Wechat Pay</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='ALIPAY'}"
ng-click="params.channel='ALIPAY';loadTradeLogs(1)">Alipay</a> |
<a role="button"
ng-class="{'bg-primary':params.channel=='ALIPAYONLINE'}"
ng-click="params.channel='ALIPAYONLINE';loadTradeLogs(1)">AlipayOnline</a>
|
<a role="button" ng-class="{'bg-primary':params.channel=='BESTPAY'}"
ng-click="params.channel='BESTPAY';loadTradeLogs(1)">BestPay</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='JD'}"
ng-click="params.channel='JD';loadTradeLogs(1)">JD Pay</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='HF'}"
ng-click="params.channel='HF';loadTradeLogs(1)">HF Pay</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='RPAY'}"
ng-click="params.channel='RPAY';loadTradeLogs(1)">RPay +</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='YEEPAY'}"
ng-click="params.channel='YEEPAY';loadTradeLogs(1)">Yeepay</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='LAKALAPAY'}"
ng-click="params.channel='LAKALAPAY';loadTradeLogs(1)">LakalaPay</a>
</p>
</div>
</div>
<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 col-xs-8">
<div class="form-control-static form-inline">
<div style="display: inline-block">
<input class="form-control" id="date-from-input"
ng-model="params.datefrom"
uib-datepicker-popup size="10" placeholder="From"
is-open="dateBegin.open" ng-click="dateBegin.open=true"
datepicker-options="{maxDate:params.dateto||today}">
</div>
~
<div style="display: inline-block">
<input class="form-control" id="date-to-input"
ng-model="params.dateto"
uib-datepicker-popup size="10" placeholder="To"
is-open="dateTo.open" ng-click="dateTo.open=true"
datepicker-options="{minDate:params.datefrom,maxDate:today}">
</div>
<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>
</div>
<div class="form-group col-xs-12" ng-if="'1000000000'|withRole">
<label class="control-label col-xs-4 col-sm-2">My Group</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':isAll}"
ng-click="chooseBD('all')">All</a>
<label ng-repeat="sub in bd_group_bds">
|&nbsp;<a role="button"
ng-class="{'bg-primary':sub.manager_id==chooseBDId}"
ng-click="chooseBD(sub.manager_id)">{{sub.bd_name}}</a>&nbsp;
</label>
</p>
</div>
</div>
</div>
<button class="btn btn-success" type="button" ng-click="loadTradeLogs(1)">
<i class="fa fa-search"></i> Search
</button>
</div>
</div>
</div>
</div>
</div>
<div class="box">
<div class="box-header">
<div class="row">
<div class="col-md-1-5 col-sm-6 col-xs-12">
<div class="info-box info_box_bottom">
<span class="info-box-icon bg-aqua box-icon_small"><i
class="ion ion-social-usd"></i></span>
<div class="info-box-content box-content_left">
<span class="info-box-text">Transaction Amount</span>
<span class="info-box-number box-number_font"
ng-bind="analysis.paid_fee|currency:'AUD'"></span>
<span class="small">( {{analysis.order_count}} Orders )</span>
</div>
</div>
</div>
<div class="col-md-1-5 col-sm-6 col-xs-12" ng-if="!analysis.cny_display_amount">
<div class="info-box info_box_bottom">
<span class="info-box-icon bg-aqua box-icon_small"><i
class="ion ion-social-usd"></i></span>
<div class="info-box-content box-content_left">
<span class="info-box-text">Input Amount</span>
<span class="info-box-number box-number_font"
ng-bind="analysis.display_amount|currency:'AUD '"></span>
<span class="small"> ( {{analysis.pre_display_amount | currency:'pre authorization '}} )</span>
</div>
</div>
</div>
<div class="col-md-1-5 col-sm-6 col-xs-12" ng-if="analysis.cny_display_amount">
<div class="info-box info_box_bottom"
ng-class="{'line_height':analysis.pre_display_amount||analysis.pre_cny_display_amount}">
<span class="info-box-icon bg-aqua box-icon_small"><i
class="ion ion-social-usd"></i></span>
<div class="info-box-content box-content_left">
<span class="info-box-text">Input Amount</span>
<span class="info-box-number box-number_font" style="margin-bottom: -3px;"
ng-class="{line_height_:!analysis.pre_display_amount}"
ng-bind="analysis.display_amount|currency:'AUD '"></span>
<span style="font-size: 8px;line-height: 8px"
ng-if="analysis.pre_display_amount">
( {{analysis.pre_display_amount | currency:'pre authorization '}} )
</span>
<span class="info-box-number box-number_font" style="margin-bottom: -3px;"
ng-if="analysis.cny_display_amount"
ng-bind="analysis.cny_display_amount|currency:'CNY '"></span>
<span style="font-size: 8px;line-height: 8px"
ng-if="analysis.pre_cny_display_amount">
( {{analysis.pre_cny_display_amount | currency:'pre authorization '}} )
</span>
</div>
</div>
</div>
<div class="col-md-1-5 col-sm-6 col-xs-12">
<div class="info-box info_box_bottom">
<span class="info-box-icon bg-red box-icon_small"><i
class="ion ion-android-warning"></i></span>
<div class="info-box-content box-content_left">
<span class="info-box-text">Refund Amount</span>
<span class="info-box-number box-number_font"
ng-bind="analysis.refund_fee|currency:'AUD '"></span>
<span class=small" ng-if="analysis.pre_refund_fee">
({{analysis.pre_refund_fee|currency:'pre authorization '}})
</span>
</div>
</div>
</div>
<div class="col-md-1-5 col-sm-6 col-xs-12">
<div class="info-box info_box_bottom">
<span class="info-box-icon bg-yellow box-icon_small"><i
class="ion ion-ios-people"></i></span>
<div class="info-box-content box-content_left">
<span class="info-box-text">Merchants</span>
<span class="info-box-number box-number_font"
ng-bind="analysis.clients"></span>
</span>
</div>
</div>
</div>
<div class="col-md-1-5 col-sm-6 col-xs-12">
<div class="info-box info_box_bottom">
<span class="info-box-icon bg-yellow box-icon_small"><i
class="ion ion-ios-people"></i></span>
<div class="info-box-content box-content_left">
<span class="info-box-text">Incremental Surcharge</span>
<span class="info-box-number box-number_font"
ng-bind="analysis.incremental_surcharge|currency:'AUD '"></span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="box">
<div class="box-header">
<h3 class="box-title" style="display: inherit">Trade Orders
<span style="float: right;font-size: 14px;">Pre Authorization:<i class="fa fa-stop"
aria-hidden="true"
style="color: #fff2a5"></i></span>
</h3>
<a hidden class="pull-right text-bold" ng-if="'manual_refund_check'|withFunc" role="button"
ng-click="confirmOrders()">Manual Confirm Orders</a>
</div>
<div class="box-body table-responsive">
<table class="table table-bordered table-hover table-striped">
<thead>
<tr>
<th>Partner</th>
<th>Order ID</th>
<th>Amount</th>
<th>Input Amount</th>
<th>System Rate</th>
<th>System Profit</th>
<th>R跨境商城 Rate</th>
<th>R跨境商城 Profit</th>
<th>Status</th>
<th>Create Time</th>
<th>Operation</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="trade in tradeLogs" ng-class="{warning:trade.clearing_status==2}">
<td>
<a role="button" ui-sref="partners.detail({clientMoniker:trade.client_moniker})">
{{trade.short_name}}({{trade.client_moniker}})
</a>
</td>
<td>
<img src="/static/images/royalpay_sign_s.png"
uib-tooltip="RoyalPay" ng-if="trade.source=='system'"/>
<img src="/static/images/yangmaimai_sign.png"
uib-tooltip="R跨境商城" ng-if="trade.source=='R跨境商城'"/>
<img src="/static/images/wechatpay_sign.png"
uib-tooltip="WechatPay" ng-if="trade.channel=='Wechat'"/>
<img src="/static/images/wechatpay_sign.png"
uib-tooltip="Znyoo" ng-if="trade.channel=='Znyoo'"/>
<img src="/static/images/bestpay_sign.png"
uib-tooltip="BestPay" ng-if="trade.channel=='Bestpay'"/>
<img src="/static/images/alipay_sign.png"
uib-tooltip="Alipay" ng-if="trade.channel=='Alipay'"/>
<img src="/static/images/alipay_sign.png"
uib-tooltip="AlipayOnline" ng-if="trade.channel=='AlipayOnline'"/>
<img src="/static/images/jd_sign.png"
uib-tooltip="JD Pay" ng-if="trade.channel=='jd'"/>
<img src="/static/images/hf_sign.png"
uib-tooltip="HF Pay" ng-if="trade.channel=='hf'"/>
<img src="/static/images/rpayplus_sign.png"
uib-tooltip="Royal Pay" ng-if="trade.channel=='Rpay'"/>
<img src="/static/images/yeepay_sign.png"
uib-tooltip="Yeepay" ng-if="trade.channel=='Yeepay'"/>
<img src="/static/images/lakalapay_sign.png"
uib-tooltip="LakalaPay" ng-if="trade.channel=='LakalaPay'"/>
{{trade.order_id}}
</td>
<td>
{{trade.total_amount|currency:trade.currency}}
<a ng-if="trade.refund_fee" class="text-danger" role="button"
ng-click="showRefundLog(trade.order_id)">(-{{trade.refund_fee}})</a>
</td>
<td ng-bind="trade.display_amount|currency:trade.currency"></td>
<td><span ng-if="trade.surcharge_rate">{{(trade.surcharge_rate * 100 - trade.rate_value)| number : 2}}%</span></td>
<td>{{(trade.total_surcharge-trade.incremental_surcharge) | number : 2 | currency:trade.currency}}</td>
<td><span ng-if="trade.rate_value">{{trade.source}}:{{(trade.rate_value) | number : 2}}%</span></td>
<td><span ng-if="trade.incremental_surcharge">{{trade.source}}:{{trade.incremental_surcharge | currency:trade.currency}}</span></td>
<td ng-bind="trade.status|tradeStatus"></td>
<td ng-bind="trade.create_time"></td>
<td>
<a role="button" class="text-bold" ng-click="showTradeDetail(trade)" title="Detail">
<i class="fa fa-list-alt"></i>
</a>
</td>
</tr>
</tbody>
</table>
</div>
<div class="box-body" ng-if="tradeLogs.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="loadTradeLogs()"
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>
</div>
</div>
</div>
</div>

@ -0,0 +1,388 @@
<style>
.cursor {
cursor: pointer;
}
.div-display {
display: none;
}
.i-rotate_90 {
animation: rotate_90 1s forwards;
-webkit-animation: rotate_90 1s forwards; /* Safari and Chrome */
}
@keyframes rotate_90 {
from {
transform: rotate(0deg);
}
to {
transform: rotate(90deg);
}
}
@-webkit-keyframes rotate_90 /* Safari and Chrome */
{
from {
-webkit-transform: rotate(0deg);
}
to {
-webkit-transform: rotate(90deg);
}
}
.popover-color{
background-color: #f7f7f7;
border-bottom: 1px solid #ebebeb;
color: black;
}
.popover-content button{
display: inline-block;
}
.position_re{
position: relative;
}
.position_re .position_ab{
position: absolute;
top: 90%;
left: 90%;
}
.box-icon_small{
width: 70px;
height: 70px;
font-size: 30px;
line-height: 70px
}
.info_box_bottom{
min-height:70px;
margin-bottom:0px
}
.box-content_left{
margin-left:70px
}
.box-number_font{
font-size:14px;
}
.line_height{
line-height: 14px
}
.line_height_{
line-height: 22px;
}
</style>
<section class="content-header">
<h1>Incremental Orders</h1>
<ol class="breadcrumb">
<li>
<i class="fa fa-comments-o"></i> Payment
</li>
<li class="active">Incremental Orders</li>
</ol>
</section>
<div class="content">
<div class="callout callout-info" ng-repeat="order in alerts">
<h4><span style="font-size: 22px">{{order.display_amount|currency:order.currency+' '}}</span> Paid
Success!</h4>
<p>Pay Time:{{order.pay_time_local}}</p>
</div>
<div class="row">
<div class="col-sm-12">
<div class="box-solid">
<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">
<label class="control-label col-xs-4 col-sm-2">Source</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':params.source=='ALL'}"
ng-click="params.source='ALL';loadTradeLogs(1)">All</a> |
<a role="button" ng-class="{'bg-primary':params.source=='system'}"
ng-click="params.source='system';loadTradeLogs(1)">System</a> |
<a role="button" ng-class="{'bg-primary':params.source=='R跨境商城'}"
ng-click="params.source='R跨境商城';loadTradeLogs(1)">R跨境商城</a>
</p>
</div>
</div>-->
<div class="form-group col-xs-12">
<label class="control-label col-xs-4 col-sm-2">Status</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':params.status=='ALL'}"
ng-click="params.status='ALL';loadTradeLogs(1)">All</a> |
<a role="button" ng-class="{'bg-primary':params.status=='PAID'}"
ng-click="params.status='PAID';loadTradeLogs(1)">Payment Success</a> |
<a role="button" ng-class="{'bg-primary':params.status=='ALL_REFUNDED'}"
ng-click="params.status='ALL_REFUNDED';loadTradeLogs(1)">All Refund</a> |
<a role="button" ng-class="{'bg-primary':params.status=='PARTIAL_REFUNDED'}"
ng-click="params.status='PARTIAL_REFUNDED';loadTradeLogs(1)">Partial Refund</a> |
<a role="button" ng-class="{'bg-primary':params.status=='FULL_REFUNDED'}"
ng-click="params.status='FULL_REFUNDED';loadTradeLogs(1)">Full Refund</a>
</p>
</div>
</div>
<div class="form-group col-xs-12">
<label class="control-label col-xs-4 col-sm-2">Channel</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':params.channel=='ALL'}"
ng-click="params.channel='ALL';loadTradeLogs(1)">All</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='WECHAT'}"
ng-click="params.channel='WECHAT';loadTradeLogs(1)">Wechat Pay</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='ALIPAY'}"
ng-click="params.channel='ALIPAY';loadTradeLogs(1)">Alipay</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='ALIPAYONLINE'}"
ng-click="params.channel='ALIPAYONLINE';loadTradeLogs(1)">AlipayOnline</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='BESTPAY'}"
ng-click="params.channel='BESTPAY';loadTradeLogs(1)">BestPay</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='JD'}"
ng-click="params.channel='JD';loadTradeLogs(1)">JD Pay</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='HF'}"
ng-click="params.channel='HF';loadTradeLogs(1)">HF Pay</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='RPAY'}"
ng-click="params.channel='RPAY';loadTradeLogs(1)">RPay+</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='YEEPAY'}"
ng-click="params.channel='YEEPAY';loadTradeLogs(1)">Yeepay</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='LAKALAPAY'}"
ng-click="params.channel='LAKALAPAY';loadTradeLogs(1)">LakalaPay</a>
</p>
</div>
</div>
<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 col-xs-8">
<div class="form-control-static form-inline">
<div style="display: inline-block">
<input class="form-control" id="date-from-input"
ng-model="params.datefrom"
uib-datepicker-popup size="10" placeholder="From"
is-open="dateBegin.open" ng-click="dateBegin.open=true"
datepicker-options="{maxDate:params.dateto||today}">
</div>
~
<div style="display: inline-block">
<input class="form-control" id="date-to-input"
ng-model="params.dateto"
uib-datepicker-popup size="10" placeholder="To"
is-open="dateTo.open" ng-click="dateTo.open=true"
datepicker-options="{minDate:params.datefrom,maxDate:today}">
</div>
<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>
</div>
</div>
<div class="form-group col-xs-12" ng-if="currentUser.client.has_children">
<label class="control-label col-xs-4 col-sm-2">Sub Partner</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':isAll}" ng-click="chooseClient('all')">All</a>
<label ng-repeat="sub in clients">
|&nbsp;
<a role="button" ng-class="{'bg-primary':sub.client_id==chooseClientId}" ng-click="chooseClient(sub)">{{sub.short_name}}</a>
&nbsp;
</label>
</p>
</div>
</div>
<div class="form-group col-xs-12" ng-if="level3Clients && showLevel3Clients">
<label class="control-label col-xs-4 col-sm-2">Sub-Partner of sub-partners</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':isLevel3All}" ng-click="chooseLevel3Client('all')">All</a>
<label ng-repeat="sub in level3Clients">
|&nbsp;
<a role="button" ng-class="{'bg-primary':sub.client_id==chooseLevel3ClientId}" ng-click="chooseLevel3Client(sub)">{{sub.short_name}}</a>
&nbsp;
</label>
</p>
</div>
</div>
<button class="btn btn-success" type="button" ng-click="loadTradeLogs(1)">
<i class="fa fa-search"></i> Search
</button>
</div>
</div>
</div>
</div>
</div>
<div class="box">
<div class="box-header">
<div class="row">
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="info-box info_box_bottom">
<span class="info-box-icon bg-aqua box-icon_small"><i class="ion ion-social-usd"></i></span>
<div class="info-box-content box-content_left">
<span class="info-box-text">Transaction Amount</span>
<span class="info-box-number box-number_font"
ng-bind="analysis.paid_fee|currency:'AUD '"></span>
<span class="small">( {{analysis.order_count}} Orders )</span>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 col-xs-12" ng-if="!analysis.cny_display_amount">
<div class="info-box info_box_bottom">
<span class="info-box-icon bg-aqua box-icon_small"><i class="ion ion-social-usd"></i></span>
<div class="info-box-content box-content_left">
<span class="info-box-text">Input Amount</span>
<span class="info-box-number box-number_font"
ng-bind="analysis.display_amount|currency:'AUD '"></span>
<span class="small"> ( {{analysis.pre_display_amount | currency:'pre authorization '}} )</span>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 col-xs-12" ng-if="analysis.cny_display_amount">
<div class="info-box info_box_bottom" ng-class="{'line_height':analysis.pre_display_amount||analysis.pre_cny_display_amount}">
<span class="info-box-icon bg-aqua box-icon_small"><i class="ion ion-social-usd"></i></span>
<div class="info-box-content box-content_left">
<span class="info-box-text" >Input Amount</span>
<span class="info-box-number box-number_font" style="margin-bottom: -3px;" ng-class="{line_height_:!analysis.pre_display_amount}"
ng-bind="analysis.display_amount|currency:'AUD '"></span>
<span style="font-size: 10px;line-height: 10px" ng-if="analysis.pre_display_amount">
( {{analysis.pre_display_amount | currency:'pre authorization '}} )
</span>
<span class="info-box-number box-number_font" style="margin-bottom: -3px;"
ng-if="analysis.cny_display_amount"
ng-bind="analysis.cny_display_amount|currency:'CNY '"></span>
<span style="font-size: 10px;line-height: 10px" ng-if="analysis.pre_cny_display_amount">
( {{analysis.pre_cny_display_amount | currency:'pre authorization '}} )
</span>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="info-box info_box_bottom">
<span class="info-box-icon bg-red box-icon_small"><i class="ion ion-android-warning"></i></span>
<div class="info-box-content box-content_left">
<span class="info-box-text">Refund Amount</span>
<span class="info-box-number box-number_font"
ng-bind="analysis.refund_fee|currency:'AUD '"></span>
<span class=small" ng-if="analysis.pre_refund_fee">
({{analysis.pre_refund_fee|currency:'pre authorization '}})
</span>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="info-box info_box_bottom">
<span class="info-box-icon bg-yellow box-icon_small"><i class="ion ion-ios-people"></i></span>
<div class="info-box-content box-content_left">
<span class="info-box-text">Incremental Surcharge</span>
<span class="info-box-number box-number_font"
ng-bind="analysis.incremental_surcharge|currency:'AUD '">
</span>
<span style="color: red" ng-if="analysis.refund_incremental_surcharge">({{analysis.all_incremental_surcharge}} - {{analysis.refund_incremental_surcharge}} = {{analysis.incremental_surcharge}}) </span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="box">
<div class="box-header">
<h3 class="box-title" style="display: inherit">Orders</h3>
</div>
<div class="box-body table-responsive">
<table class="table table-bordered table-hover table-striped">
<thead>
<tr>
<th>Client Order ID</th>
<th>Order ID</th>
<th>Amount</th>
<th>Input Amount</th>
<th>System Rate</th>
<th>System Profit</th>
<th>Incremental Rate</th>
<th>Incremental Profit</th>
<th>Status</th>
<th>Create Time</th>
<th>Operation</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="trade in tradeLogs" ng-class="{warning:trade.clearing_status==2}">
<td ng-bind="trade.client_order_id||'NOT PROVIDED'"></td>
<td>
<img src="/static/images/clearing-icon.png" uib-tooltip="clearing" ng-if="trade.clearing_status=='1'"/>
<i class="fa fa-check-circle-o text-danger" uib-tooltip="Refund Audition Required" ng-if="trade.audition"></i>
<img src="/static/images/royalpay_sign_s.png" uib-tooltip="RoyalPay" ng-if="trade.source=='system'"/>
<img src="/static/images/yangmaimai_sign.png" uib-tooltip="R跨境商城" ng-if="trade.source=='R跨境商城'"/>
<img src="/static/images/wechatpay_sign.png" uib-tooltip="Znyoo" ng-if="trade.channel=='Znyoo'"/>
<img src="/static/images/wechatpay_sign.png" uib-tooltip="Wechat Pay" ng-if="trade.channel=='Wechat'"/>
<img src="/static/images/bestpay_sign.png" uib-tooltip="BestPay" alt="BestPay" ng-if="trade.channel=='Bestpay'"/>
<img src="/static/images/alipay_sign.png" uib-tooltip="Alipay" alt="Alipay" ng-if="trade.channel=='Alipay'"/>
<img src="/static/images/alipay_sign.png" uib-tooltip="AlipayOnline" alt="AlipayOnline" ng-if="trade.channel=='AlipayOnline'"/>
<img src="/static/images/jd_sign.png" uib-tooltip="JD Pay" ng-if="trade.channel=='jd'"/>
<img src="/static/images/hf_sign.png" uib-tooltip="HF Pay" ng-if="trade.channel=='hf'"/>
<img src="/static/images/rpayplus_sign.png" uib-tooltip="RPay+" ng-if="trade.channel=='Rpay'"/>
<img src="/static/images/yeepay_sign.png" uib-tooltip="Yeepay" ng-if="trade.channel=='Yeepay'"/>
<img src="/static/images/lakalapay_sign.png" uib-tooltip="LakalaPay" ng-if="trade.channel=='LakalaPay'"/>
{{trade.order_id}}
</td>
<td>
{{trade.total_amount|currency:trade.currency+' '}}
<a ng-if="trade.refund_fee" class="text-danger" role="button">(-{{trade.refund_fee}})</a>
</td>
<td ng-bind="trade.display_amount|currency:trade.currency"></td>
<td>{{(trade.surcharge_rate * 100 - trade.rate_value)| number : 2}}<span ng-if="trade.surcharge_rate">%</span></td>
<td>{{(trade.total_surcharge-trade.incremental_surcharge) | number : 2 | currency:trade.currency}}</td>
<td><span ng-if="trade.rate_value">{{trade.source}}:{{(trade.rate_value) | number : 2}}%</span></td>
<td>{{trade.source}}:<span ng-if="trade.incremental_surcharge">{{trade.incremental_surcharge | currency:trade.currency}}</span><span ng-if="!trade.incremental_surcharge">{{0.00 | currency:trade.currency}}</span></td>
<td ng-bind="trade.status|tradeStatus"></td>
<td ng-bind="trade.create_time"></td>
<td>
<a role="button" class="text-bold" ng-click="showTradeDetail(trade)" title="Detail">
<i class="fa fa-list-alt"></i>
</a>
</a>
</td>
</tr>
</tbody>
</table>
</div>
<div class="box-footer" ng-if="tradeLogs.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="loadTradeLogs()"
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>
</div>
</div>
</div>
</div>

@ -205,8 +205,12 @@
<th>Currency</th>
<th>Input Amount</th>
<th>Total Amount</th>
<th>Surcharge Rate</th>
<!--<th>Surcharge Rate</th>-->
<th>Surcharge Amount</th>
<th>System Rate</th>
<th>System Profit</th>
<th>Incremental Rate</th>
<th>Incremental Profit</th>
<th>Tax Amount</th>
<th ng-if="report.report[0].settle_amount!=null">Settle Amount</th>
<th>Remark</th>
@ -215,14 +219,20 @@
<tbody>
<tr ng-repeat="tr in report.report|propsFilter:{transaction_type:'Credit',channel:ctrl.channel,transaction_time:ctrl.day}:true">
<td>
<img src="/static/images/royalpay_sign_s.png" uib-tooltip="RoyalPay" ng-if="tr.source=='system'"/>
<img src="/static/images/yangmaimai_sign.png" uib-tooltip="R跨境商城" ng-if="tr.source=='R跨境商城'"/>
<img class="channel-icon" ng-src="{{tr.channel|channel_image}}">{{tr.order_id}}
</td>
<td ng-bind="tr.transaction_time"></td>
<td ng-bind="tr.transaction_currency"></td>
<td ng-bind="tr.display_amount"></td>
<td ng-bind="tr.transaction_amount"></td>
<td ng-bind="tr.surcharge_rate?(tr.surcharge_rate|percentage:1):report.channels[tr.channel].rate+'%'"></td>
<!--<td ng-bind="tr.surcharge_rate?(tr.surcharge_rate|percentage:1):report.channels[tr.channel].rate+'%'"></td>-->
<td ng-bind="tr.total_surcharge?tr.total_surcharge:0"></td>
<td>{{(tr.surcharge_rate * 100 - tr.rate_value)| number : 2}}<span ng-if="tr.surcharge_rate">%</span></td>
<td>{{(tr.total_surcharge-tr.incremental_surcharge) | number : 2 | currency:tr.currency}}</td>
<td><span ng-if="tr.rate_value">{{tr.source}}:{{(tr.rate_value) | number : 2}}%</span></td>
<td>{{tr.source}}:<span ng-if="tr.incremental_surcharge">{{tr.incremental_surcharge | currency:tr.currency}}</span><span ng-if="!tr.incremental_surcharge">{{0.00 | currency:tr.currency}}</span></td>
<td ng-bind="tr.tax_amount"></td>
<td ng-if="tr.settle_amount!=null" ng-bind="tr.settle_amount|currency:''"></td>
<td ng-bind="tr.remark"></td>

@ -127,6 +127,7 @@
</span><i style="cursor:pointer;" class="glyphicon glyphicon-warning-sign text-yellow small"
uib-tooltip-html="htmlTooltip"></i>
</h3>
<a ng-if="settlementLogs.length>0" target="_blank" style="float: right" ng-href="{{excelSettlementAllLogs()}}"> <i class="fa fa-download"></i>Export Settlement Summary</a>
</div>
<div class="box-body table-responsive">
<table class="table table-bordered table-hover table-striped alignCen">

@ -109,6 +109,19 @@
ng-model="params.searchText">
</div>
</div>
<div class="form-group col-xs-12">
<label class="control-label col-xs-4 col-sm-2">Source</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':params.source=='ALL'}"
ng-click="params.source='ALL';loadTradeLogs(1)">All</a> |
<a role="button" ng-class="{'bg-primary':params.source=='system'}"
ng-click="params.source='system';loadTradeLogs(1)">System</a> |
<a role="button" ng-class="{'bg-primary':params.source=='R跨境商城'}"
ng-click="params.source='R跨境商城';loadTradeLogs(1)">R跨境商城</a>
</p>
</div>
</div>
<div class="form-group col-xs-12">
<label class="control-label col-xs-4 col-sm-2">Status</label>
<div class="col-sm-10 col-xs-8">
@ -160,9 +173,9 @@
<a role="button" ng-class="{'bg-primary':params.gateway==null}"
ng-click="params.gateway=null;loadTradeLogs(1)">All</a> |
<a role="button" ng-class="{'bg-primary':gatewaySelected([0,1])}"
ng-click="params.gateway=[0,1];loadTradeLogs(1)">Retail In-Store</a> |
ng-click="params.gateway=[0,1];initGatewayChild()">Retail In-Store</a> |
<a role="button" ng-class="{'bg-primary':gatewaySelected([5,6])}"
ng-click="params.gateway=[5,6];loadTradeLogs(1)">Retail API</a> |
ng-click="params.gateway=[5,6];initGatewayChild()">Retail API</a> |
<a role="button" ng-class="{'bg-primary':gatewaySelected([2,7])}"
ng-click="params.gateway=[2,7];loadTradeLogs(1)">QR Code</a> |
<a role="button" ng-class="{'bg-primary':gatewaySelected([3])}"
@ -186,6 +199,28 @@
</p>
</div>
</div>
<div class="form-group col-xs-12"
ng-if="params.gateway.sort().toString()==[0,1] || params.gateway.sort().toString()==[5,6]">
<label class="control-label col-xs-4 col-sm-2">Type of payment</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':params.gatewayChild==null}"
ng-click="params.gatewayChild=null;loadTradeLogs(1)">All</a> |
<a role="button" ng-if="params.gateway.sort().toString()==[0,1]"
ng-class="{'bg-primary':params.gatewayChild==1}"
ng-click="params.gatewayChild=1;loadTradeLogs(1)">线下B端二维码 |</a>
<a role="button" ng-if="params.gateway.sort().toString()==[0,1]"
ng-class="{'bg-primary':params.gatewayChild==0}"
ng-click="params.gatewayChild=0;loadTradeLogs(1)">线下C端支付码</a>
<a role="button" ng-if="params.gateway.sort().toString()==[5,6]"
ng-class="{'bg-primary':params.gatewayChild==6}"
ng-click="params.gatewayChild=6;loadTradeLogs(1)">线下网关(B端二维码) |</a>
<a role="button" ng-if="params.gateway.sort().toString()==[5,6]"
ng-class="{'bg-primary':params.gatewayChild==5}"
ng-click="params.gatewayChild=5;loadTradeLogs(1)">线下网关(C端支付码)</a>
</p>
</div>
</div>
<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 col-xs-8">
@ -257,6 +292,17 @@
</p>
</div>
</div>
<div class="form-group col-xs-12" ng-if="deviceIds.length">
<label class="control-label col-xs-4 col-sm-2">Third Device</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':order_device_isAll}" ng-click="chooseDeviceIds('all')">All</a>
<label ng-repeat="dev in deviceIds">
|&nbsp;<a role="button" ng-class="{'bg-primary':dev.dev_id==choose_order_device_id}" ng-click="chooseDeviceIds(dev.dev_id)">{{dev.dev_id}}</a>&nbsp;
</label>
</p>
</div>
</div>
<div class="form-group col-xs-12" ng-if="devices.length">
<label class="control-label col-xs-4 col-sm-2">Devices</label>
<div class="col-sm-10 col-xs-8">
@ -384,6 +430,8 @@
<td>
<img src="/static/images/clearing-icon.png" uib-tooltip="clearing" ng-if="trade.clearing_status=='1'"/>
<i class="fa fa-check-circle-o text-danger" uib-tooltip="Refund Audition Required" ng-if="trade.audition"></i>
<img src="/static/images/royalpay_sign_s.png" uib-tooltip="RoyalPay" ng-if="trade.source=='system'"/>
<img src="/static/images/yangmaimai_sign.png" uib-tooltip="R跨境商城" ng-if="trade.source=='R跨境商城'"/>
<img src="/static/images/wechatpay_sign.png" uib-tooltip="Znyoo" ng-if="trade.channel=='Znyoo'"/>
<img src="/static/images/wechatpay_sign.png" uib-tooltip="Wechat Pay" ng-if="trade.channel=='Wechat'"/>
<img src="/static/images/bestpay_sign.png" uib-tooltip="BestPay" alt="BestPay" ng-if="trade.channel=='Bestpay'"/>
@ -394,7 +442,7 @@
<img src="/static/images/rpayplus_sign.png" uib-tooltip="RPay+" ng-if="trade.channel=='Rpay'"/>
<img src="/static/images/yeepay_sign.png" uib-tooltip="Yeepay" ng-if="trade.channel=='Yeepay'"/>
<img src="/static/images/lakalapay_sign.png" uib-tooltip="LakalaPay" ng-if="trade.channel=='LakalaPay'"/>
{{trade.order_id}}
{{trade.order_id}}<span ng-if="trade.source!='system' && trade.source!=null && trade.incremental_surcharge != null"><i class="fa fa-question-circle-o" uib-tooltip-html="trade.htmlTooltip"></i></span>
</td>
<td>
{{trade.total_amount|currency:trade.currency+' '}}

@ -1,26 +1,32 @@
<style>
.box-icon_small{
.box-icon_small {
width: 70px;
height: 70px;
font-size: 30px;
line-height: 70px
}
.info_box_bottom{
min-height:70px;
margin-bottom:0px
.info_box_bottom {
min-height: 70px;
margin-bottom: 0px
}
.box-content_left{
margin-left:70px
.box-content_left {
margin-left: 70px
}
.box-number_font{
font-size:14px
.box-number_font {
font-size: 14px
}
.line_height{
.line_height {
line-height: 14px
}
.line_height_{
.line_height_ {
line-height: 22px;
}
.col-xs-1-5,
.col-sm-1-5,
.col-md-1-5,
@ -30,22 +36,26 @@
padding-right: 10px;
padding-left: 10px;
}
.col-xs-1-5 {
width: 20%;
float: left;
}
@media (min-width: 768px) {
.col-sm-1-5 {
width: 20%;
float: left;
}
}
@media (min-width: 992px) {
.col-md-1-5 {
width: 20%;
float: left;
}
}
@media (min-width: 1200px) {
.col-lg-1-5 {
width: 20%;
@ -84,7 +94,8 @@
</select>
</label>
<div class="col-sm-4 col-xs-8">
<input class="form-control" placeholder="Keyword" ng-enter="loadTradeLogs(1)"
<input class="form-control" placeholder="Keyword"
ng-enter="loadTradeLogs(1)"
ng-model="params.searchText">
</div>
@ -97,7 +108,8 @@
</select>
</div>
<div ng-if="((orgs_child.length > 1) && ('1000011'|withRole))&&params.org_id || ((orgs_child.length > 0) && ('1000000000000'|withRole))" class="col-sm-6">
<div ng-if="((orgs_child.length > 1) && ('1000011'|withRole))&&params.org_id || ((orgs_child.length > 0) && ('1000000000000'|withRole))"
class="col-sm-6">
<select id="org-select" class="form-control" ng-model="params.org_id2"
ng-options="org.org_id as org.name group by org.org_type for org in orgs_child"
ng-change="loadTradeLogs(1)">
@ -130,6 +142,19 @@
</div>
</div>-->
</div>
<div class="form-group col-xs-12">
<label class="control-label col-xs-4 col-sm-2">Source</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':params.source=='ALL'}"
ng-click="params.source='ALL';loadTradeLogs(1)">All</a> |
<a role="button" ng-class="{'bg-primary':params.source=='system'}"
ng-click="params.source='system';loadTradeLogs(1)">System</a> |
<a role="button" ng-class="{'bg-primary':params.source=='R跨境商城'}"
ng-click="params.source='R跨境商城';loadTradeLogs(1)">R跨境商城</a>
</p>
</div>
</div>
<div class="form-group col-xs-12">
<label class="control-label col-xs-4 col-sm-2">Status</label>
<div class="col-sm-10 col-xs-8">
@ -137,13 +162,19 @@
<a role="button" ng-class="{'bg-primary':params.status=='ALL'}"
ng-click="params.status='ALL';loadTradeLogs(1)">All</a> |
<a role="button" ng-class="{'bg-primary':params.status=='PAID'}"
ng-click="params.status='PAID';loadTradeLogs(1)">Payment Success</a> |
ng-click="params.status='PAID';loadTradeLogs(1)">Payment Success</a>
|
<a role="button" ng-class="{'bg-primary':params.status=='ALL_REFUNDED'}"
ng-click="params.status='ALL_REFUNDED';loadTradeLogs(1)">All Refund</a> |
<a role="button" ng-class="{'bg-primary':params.status=='PARTIAL_REFUNDED'}"
ng-click="params.status='PARTIAL_REFUNDED';loadTradeLogs(1)">Partial Refund</a> |
<a role="button" ng-class="{'bg-primary':params.status=='FULL_REFUNDED'}"
ng-click="params.status='FULL_REFUNDED';loadTradeLogs(1)">Full Refund</a>
ng-click="params.status='ALL_REFUNDED';loadTradeLogs(1)">All
Refund</a> |
<a role="button"
ng-class="{'bg-primary':params.status=='PARTIAL_REFUNDED'}"
ng-click="params.status='PARTIAL_REFUNDED';loadTradeLogs(1)">Partial
Refund</a> |
<a role="button"
ng-class="{'bg-primary':params.status=='FULL_REFUNDED'}"
ng-click="params.status='FULL_REFUNDED';loadTradeLogs(1)">Full
Refund</a>
</p>
</div>
</div>
@ -157,8 +188,10 @@
ng-click="params.channel='WECHAT';loadTradeLogs(1)">Wechat Pay</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='ALIPAY'}"
ng-click="params.channel='ALIPAY';loadTradeLogs(1)">Alipay</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='ALIPAYONLINE'}"
ng-click="params.channel='ALIPAYONLINE';loadTradeLogs(1)">AlipayOnline</a> |
<a role="button"
ng-class="{'bg-primary':params.channel=='ALIPAYONLINE'}"
ng-click="params.channel='ALIPAYONLINE';loadTradeLogs(1)">AlipayOnline</a>
|
<a role="button" ng-class="{'bg-primary':params.channel=='BESTPAY'}"
ng-click="params.channel='BESTPAY';loadTradeLogs(1)">BestPay</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='JD'}"
@ -181,9 +214,10 @@
<a role="button" ng-class="{'bg-primary':params.gateway==null}"
ng-click="params.gateway=null;loadTradeLogs(1)">All</a> |
<a role="button" ng-class="{'bg-primary':gatewaySelected([0,1])}"
ng-click="params.gateway=[0,1];loadTradeLogs(1)">Retail In-Store</a> |
ng-click="params.gateway=[0,1];initGatewayChild()">Retail In-Store</a>
|
<a role="button" ng-class="{'bg-primary':gatewaySelected([5,6])}"
ng-click="params.gateway=[5,6];loadTradeLogs(1)">Retail API</a> |
ng-click="params.gateway=[5,6];loadTradeLogs(1);initGatewayChild()">Retail API</a> |
<a role="button" ng-class="{'bg-primary':gatewaySelected([2,7])}"
ng-click="params.gateway=[2,7];loadTradeLogs(1)">QR Code</a> |
<a role="button" ng-class="{'bg-primary':gatewaySelected([3])}"
@ -193,7 +227,8 @@
<a role="button" ng-class="{'bg-primary':gatewaySelected([8])}"
ng-click="params.gateway=[8];loadTradeLogs(1)">Mobile H5</a> |
<a role="button" ng-class="{'bg-primary':gatewaySelected([9])}"
ng-click="params.gateway=[9];loadTradeLogs(1)">Third Party Gateway</a> |
ng-click="params.gateway=[9];loadTradeLogs(1)">Third Party
Gateway</a> |
<a role="button" ng-class="{'bg-primary':gatewaySelected([10])}"
ng-click="params.gateway=[10];loadTradeLogs(1)">APP</a> |
<a role="button" ng-class="{'bg-primary':gatewaySelected([11])}"
@ -207,19 +242,43 @@
</p>
</div>
</div>
<div class="form-group col-xs-12"
ng-if="params.gateway.sort().toString()==[0,1] || params.gateway.sort().toString()==[5,6]">
<label class="control-label col-xs-4 col-sm-2">Type of payment</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':params.gatewayChild==null}"
ng-click="params.gatewayChild=null;loadTradeLogs(1)">All</a> |
<a role="button" ng-if="params.gateway.sort().toString()==[0,1]"
ng-class="{'bg-primary':params.gatewayChild==1}"
ng-click="params.gatewayChild=1;loadTradeLogs(1)">线下B端二维码 |</a>
<a role="button" ng-if="params.gateway.sort().toString()==[0,1]"
ng-class="{'bg-primary':params.gatewayChild==0}"
ng-click="params.gatewayChild=0;loadTradeLogs(1)">线下C端支付码</a>
<a role="button" ng-if="params.gateway.sort().toString()==[5,6]"
ng-class="{'bg-primary':params.gatewayChild==6}"
ng-click="params.gatewayChild=6;loadTradeLogs(1)">线下网关(B端二维码) |</a>
<a role="button" ng-if="params.gateway.sort().toString()==[5,6]"
ng-class="{'bg-primary':params.gatewayChild==5}"
ng-click="params.gatewayChild=5;loadTradeLogs(1)">线下网关(C端支付码)</a>
</p>
</div>
</div>
<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 col-xs-8">
<div class="form-control-static form-inline">
<div style="display: inline-block">
<input class="form-control" id="date-from-input" ng-model="params.datefrom"
<input class="form-control" id="date-from-input"
ng-model="params.datefrom"
uib-datepicker-popup size="10" placeholder="From"
is-open="dateBegin.open" ng-click="dateBegin.open=true"
datepicker-options="{maxDate:params.dateto||today}">
</div>
~
<div style="display: inline-block">
<input class="form-control" id="date-to-input" ng-model="params.dateto"
<input class="form-control" id="date-to-input"
ng-model="params.dateto"
uib-datepicker-popup size="10" placeholder="To"
is-open="dateTo.open" ng-click="dateTo.open=true"
datepicker-options="{minDate:params.datefrom,maxDate:today}">
@ -238,10 +297,12 @@
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>
<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>
<a role="button" class="btn btn-default btn-sm"
ng-click="lastMonth()">Last Month</a>
</div>
</div>
@ -250,9 +311,12 @@
<label class="control-label col-xs-4 col-sm-2">My Group</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':isAll}" ng-click="chooseBD('all')">All</a>
<a role="button" ng-class="{'bg-primary':isAll}"
ng-click="chooseBD('all')">All</a>
<label ng-repeat="sub in bd_group_bds">
|&nbsp;<a role="button" ng-class="{'bg-primary':sub.manager_id==chooseBDId}" ng-click="chooseBD(sub.manager_id)">{{sub.bd_name}}</a>&nbsp;
|&nbsp;<a role="button"
ng-class="{'bg-primary':sub.manager_id==chooseBDId}"
ng-click="chooseBD(sub.manager_id)">{{sub.bd_name}}</a>&nbsp;
</label>
</p>
</div>
@ -267,6 +331,7 @@
<!--<i class="fa fa-wrench"></i> Audit Refund-->
<!--</button>-->
<!--</div>-->
</div>
</div>
</div>
@ -277,7 +342,8 @@
<div class="row">
<div class="col-md-1-5 col-sm-6 col-xs-12">
<div class="info-box info_box_bottom">
<span class="info-box-icon bg-aqua box-icon_small"><i class="ion ion-social-usd"></i></span>
<span class="info-box-icon bg-aqua box-icon_small"><i
class="ion ion-social-usd"></i></span>
<div class="info-box-content box-content_left">
<span class="info-box-text">Transaction Amount</span>
<span class="info-box-number box-number_font"
@ -288,7 +354,8 @@
</div>
<div class="col-md-1-5 col-sm-6 col-xs-12" ng-if="!analysis.cny_display_amount">
<div class="info-box info_box_bottom">
<span class="info-box-icon bg-aqua box-icon_small"><i class="ion ion-social-usd"></i></span>
<span class="info-box-icon bg-aqua box-icon_small"><i
class="ion ion-social-usd"></i></span>
<div class="info-box-content box-content_left">
<span class="info-box-text">Input Amount</span>
<span class="info-box-number box-number_font"
@ -298,19 +365,24 @@
</div>
</div>
<div class="col-md-1-5 col-sm-6 col-xs-12" ng-if="analysis.cny_display_amount">
<div class="info-box info_box_bottom" ng-class="{'line_height':analysis.pre_display_amount||analysis.pre_cny_display_amount}">
<span class="info-box-icon bg-aqua box-icon_small"><i class="ion ion-social-usd"></i></span>
<div class="info-box info_box_bottom"
ng-class="{'line_height':analysis.pre_display_amount||analysis.pre_cny_display_amount}">
<span class="info-box-icon bg-aqua box-icon_small"><i
class="ion ion-social-usd"></i></span>
<div class="info-box-content box-content_left">
<span class="info-box-text" >Input Amount</span>
<span class="info-box-number box-number_font" style="margin-bottom: -3px;" ng-class="{line_height_:!analysis.pre_display_amount}"
<span class="info-box-text">Input Amount</span>
<span class="info-box-number box-number_font" style="margin-bottom: -3px;"
ng-class="{line_height_:!analysis.pre_display_amount}"
ng-bind="analysis.display_amount|currency:'AUD '"></span>
<span style="font-size: 8px;line-height: 8px" ng-if="analysis.pre_display_amount">
<span style="font-size: 8px;line-height: 8px"
ng-if="analysis.pre_display_amount">
( {{analysis.pre_display_amount | currency:'pre authorization '}} )
</span>
<span class="info-box-number box-number_font" style="margin-bottom: -3px;"
ng-if="analysis.cny_display_amount"
ng-bind="analysis.cny_display_amount|currency:'CNY '"></span>
<span style="font-size: 8px;line-height: 8px" ng-if="analysis.pre_cny_display_amount">
<span style="font-size: 8px;line-height: 8px"
ng-if="analysis.pre_cny_display_amount">
( {{analysis.pre_cny_display_amount | currency:'pre authorization '}} )
</span>
</div>
@ -318,7 +390,8 @@
</div>
<div class="col-md-1-5 col-sm-6 col-xs-12">
<div class="info-box info_box_bottom">
<span class="info-box-icon bg-red box-icon_small"><i class="ion ion-android-warning"></i></span>
<span class="info-box-icon bg-red box-icon_small"><i
class="ion ion-android-warning"></i></span>
<div class="info-box-content box-content_left">
<span class="info-box-text">Refund Amount</span>
<span class="info-box-number box-number_font"
@ -331,7 +404,8 @@
</div>
<div class="col-md-1-5 col-sm-6 col-xs-12">
<div class="info-box info_box_bottom">
<span class="info-box-icon bg-yellow box-icon_small"><i class="ion ion-ios-people"></i></span>
<span class="info-box-icon bg-yellow box-icon_small"><i
class="ion ion-ios-people"></i></span>
<div class="info-box-content box-content_left">
<span class="info-box-text">Merchants</span>
<span class="info-box-number box-number_font"
@ -342,7 +416,8 @@
</div>
<div class="col-md-1-5 col-sm-6 col-xs-12">
<div class="info-box info_box_bottom">
<span class="info-box-icon bg-yellow box-icon_small"><i class="ion ion-ios-people"></i></span>
<span class="info-box-icon bg-yellow box-icon_small"><i
class="ion ion-ios-people"></i></span>
<div class="info-box-content box-content_left">
<span class="info-box-text">CUSTOMERS</span>
<span class="info-box-number box-number_font"
@ -356,7 +431,9 @@
<div class="box">
<div class="box-header">
<h3 class="box-title" style="display: inherit">Trade Orders
<span style="float: right;font-size: 14px;">Pre Authorization:<i class="fa fa-stop" aria-hidden="true" style="color: #fff2a5"></i></span>
<span style="float: right;font-size: 14px;">Pre Authorization:<i class="fa fa-stop"
aria-hidden="true"
style="color: #fff2a5"></i></span>
</h3>
<a hidden class="pull-right text-bold" ng-if="'manual_refund_check'|withFunc" role="button"
ng-click="confirmOrders()">Manual Confirm Orders</a>
@ -385,6 +462,10 @@
</a>
</td>
<td>
<img src="/static/images/royalpay_sign_s.png"
uib-tooltip="RoyalPay" ng-if="trade.source=='system'"/>
<img src="/static/images/yangmaimai_sign.png"
uib-tooltip="R跨境商城" ng-if="trade.source=='R跨境商城'"/>
<img src="/static/images/wechatpay_sign.png"
uib-tooltip="WechatPay" ng-if="trade.channel=='Wechat'"/>
<img src="/static/images/wechatpay_sign.png"
@ -405,7 +486,7 @@
uib-tooltip="Yeepay" ng-if="trade.channel=='Yeepay'"/>
<img src="/static/images/lakalapay_sign.png"
uib-tooltip="LakalaPay" ng-if="trade.channel=='LakalaPay'"/>
{{trade.order_id}}
{{trade.order_id}}<span ng-if="trade.source!='system'&& trade.source!=null && trade.incremental_surcharge != null"><i class="fa fa-question-circle-o" uib-tooltip-html="trade.htmlTooltip"></i></span>
</td>
<td>
{{trade.total_amount|currency:trade.currency}}
@ -415,8 +496,9 @@
<td ng-bind="trade.display_amount|currency:trade.currency"></td>
<td ng-bind="trade.clearing_amount|currency:'AUD'"></td>
<td>
<span ng-if="(trade.channel!='hf') && (trade.channel!='Rpay')" ng-bind="trade.exchange_rate"></span>
<span ng-if="(trade.channel=='hf') || (trade.channel=='Rpay')" > - </span>
<span ng-if="(trade.channel!='hf') && (trade.channel!='Rpay')"
ng-bind="trade.exchange_rate"></span>
<span ng-if="(trade.channel=='hf') || (trade.channel=='Rpay')"> - </span>
</td>
<td ng-bind="trade.status|tradeStatus"></td>
<td ng-bind="trade.create_time"></td>
@ -425,7 +507,9 @@
<a role="button" class="text-bold" ng-click="showTradeDetail(trade)" title="Detail">
<i class="fa fa-list-alt"></i>
</a>
<a role="button" ng-if="trade.status>=5 && trade.confirm_time!=null && trade.clearing_status<2 && ('do_refund'|withFunc)" title="Refund"
<a role="button"
ng-if="trade.status>=5 && trade.confirm_time!=null && trade.clearing_status<2 && ('do_refund'|withFunc)"
title="Refund"
class="text-bold text-danger" ng-click="newRefund(trade.order_id)">
<i class="fa fa-undo"></i>
</a>
@ -448,7 +532,9 @@
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 class="col-xs-12">Total Records:{{pagination.totalCount}};Total
Pages:{{pagination.totalPages}}
</div>
</div>
</div>
</div>

@ -13,11 +13,15 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
url: '/refundReview',
templateUrl: '/static/payment/tradelog/templates/refund_review.html',
controller: 'refundReviewCtrl'
}).state('incremental_trade', {
url: '/incrementalTrade',
templateUrl: '/static/payment/tradelog/templates/incremental_trade_logs.html',
controller: 'globalIncrementalTradeLogCtrl'
})
}]);
app.controller('globalTradeLogCtrl', ['$scope', '$http', '$filter', 'commonDialog', 'refunder', 'orderService',
function ($scope, $http, $filter, commonDialog, refunder, orderService) {
$scope.params = {status: 'PAID',channel:'ALL', textType: 'all', datefrom: new Date(), dateto: new Date(),org_name:'ALL'};
app.controller('globalTradeLogCtrl', ['$scope', '$http', '$filter', 'commonDialog', 'refunder', 'orderService','$sce',
function ($scope, $http, $filter, commonDialog, refunder, orderService,$sce) {
$scope.params = {source: 'ALL',status: 'PAID',channel:'ALL', textType: 'all', datefrom: new Date(), dateto: new Date(),org_name:'ALL'};
$scope.pagination = {};
$scope.today = new Date();
@ -103,8 +107,31 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
params.dateto = $filter('date')(params.dateto, 'yyyyMMdd');
}
params.page = page || $scope.pagination.page || 1;
if(params.gateway){
if((params.gateway.sort().toString()!=[0,1].toString()) && (params.gateway.sort().toString()!=[5,6].toString())){
delete params.gatewayChilds;
delete params.gatewayChild;
}
if(params.gatewayChilds){
var exist = false
params.gatewayChilds.forEach(function (child) {
if(child==params.gatewayChild){
exist = true
}
})
if(!exist){
params.gatewayChild = null
}
}else{
delete params.gatewayChild;
}
}else{
delete params.gatewayChilds;
delete params.gatewayChild;
}
$http.get('/sys/trade_logs', {params: params}).then(function (resp) {
$scope.tradeLogs = resp.data.data;
$scope.htmlToolst();
$scope.pagination = resp.data.pagination;
$scope.analysis = resp.data.analysis;
$scope.analysis.refund_fee = angular.copy(Math.abs($scope.analysis.refund_fee));
@ -118,6 +145,12 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
return arr.indexOf(gateway) >= 0
}).length > 0
};
$scope.initGatewayChild = function(){
$scope.params.gatewayChilds = $scope.params.gateway;
$scope.params.gatewayChild=null;
$scope.loadTradeLogs(1);
}
$scope.showTradeDetail = function (order) {
orderService.managerOrderDetail(order)
};
@ -139,6 +172,30 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
$scope.$on('order_refunded', function () {
$scope.loadTradeLogs();
});
$scope.htmlToolst = function(){
for(var i=0;i< $scope.tradeLogs.length;i++){
var tax_amount = $scope.tradeLogs[i].tax_amount;
var total_surcharge= $scope.tradeLogs[i].total_surcharge;
var incremental_surcharge = $scope.tradeLogs[i].incremental_surcharge;
var total_amount = $scope.tradeLogs[i].total_amount;
var display_amount = $scope.tradeLogs[i].display_amount;
var source = $scope.tradeLogs[i].source;
var system_surcharge = (total_surcharge-incremental_surcharge).toFixed(2);
var tip = '<div style="width: 180px">' +
'<h5>手续费组成</h5>'+'<div style="background-color: #EFEFF5;height: 1px;margin-bottom: 10px;"></div>'+
'<p>system:'+ system_surcharge +'</p>' +
'<p>'+ source +':'+incremental_surcharge +'</p>';
if(total_surcharge < (total_amount-display_amount).toFixed(2)){
tip = tip +'<p>tax amount:'+ tax_amount +'</p>';
}
tip = tip + '</div>';
$scope.tradeLogs[i].htmlTooltip = $sce.trustAsHtml(tip);
}
}
}
]);
app.controller('refundReviewCtrl', ['$rootScope', '$scope', '$http', '$state', '$filter', '$uibModal', 'commonDialog', 'orderService',
@ -267,6 +324,134 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
});
};
}]);
app.controller('globalIncrementalTradeLogCtrl', ['$scope', '$http', '$filter', 'commonDialog', 'refunder', 'orderService','$sce',
function ($scope, $http, $filter, commonDialog, refunder, orderService,$sce) {
$scope.params = {source: 'R跨境商城',status: 'PAID',channel:'ALL', textType: 'all', datefrom: new Date(), dateto: new Date(),org_name:'ALL'};
$scope.pagination = {};
$scope.today = new Date();
if (($scope.currentUser.role & parseInt('1000000000', 2)) > 0 && $scope.currentUser.org_id) {
$http.get('/sys/manager_accounts/group/group_bds').then(function (resp) {
$scope.bd_group_bds = resp.data;
$scope.chooseBD('all');
});
}
$scope.chooseBD = function (groupBD) {
$scope.params.onlyGroup=true;
if (groupBD == 'all') {
$scope.isAll = true;
$scope.chooseBDId='';
delete $scope.params.group_bd;
} else {
$scope.chooseBDId=groupBD;
$scope.params.group_bd = groupBD;
$scope.isAll = false;
}
$scope.loadTradeLogs();
};
$scope.chooseToday = function () {
$scope.params.datefrom = $scope.params.dateto = new Date();
$scope.loadTradeLogs(1);
};
$scope.chooseYesterday = function () {
var yesterday = new Date();
yesterday.setDate(yesterday.getDate() - 1);
$scope.params.datefrom = $scope.params.dateto = yesterday;
$scope.loadTradeLogs(1);
};
$scope.chooseLast7Days = function () {
$scope.params.dateto = new Date();
var day = new Date();
day.setDate(day.getDate() - 7);
$scope.params.datefrom = day;
$scope.loadTradeLogs(1);
};
$scope.thisMonth = function () {
$scope.params.dateto = new Date();
var monthBegin = new Date();
monthBegin.setDate(1);
$scope.params.datefrom = monthBegin;
$scope.loadTradeLogs(1);
};
$scope.lastMonth = function () {
var monthFinish = new Date();
monthFinish.setDate(0);
$scope.params.dateto = monthFinish;
var monthBegin = new Date();
monthBegin.setDate(0);
monthBegin.setDate(1);
$scope.params.datefrom = monthBegin;
$scope.loadTradeLogs(1);
};
if (($scope.currentUser.role & parseInt('1000011', 2)) > 0 && !$scope.currentUser.org_id) {
$scope.org2 = "ALL"
$http.get('/sys/orgs', {params: {}}).then(function (resp) {
$scope.orgs = resp.data;
});
}
$scope.loadOrgs = function () {
var params = angular.copy($scope.params);
$http.get('/sys/orgs/orgChild',{params: params}).then(function (resp) {
$scope.orgs_child = resp.data;
})
};
if(($scope.currentUser.role & parseInt('1000000000000', 2)) > 0 && ($scope.currentUser.org_id != null)){
$scope.org2 = "ALL Organizations"
$scope.loadOrgs();
}
$scope.loadTradeLogs = function (page) {
var params = angular.copy($scope.params);
if (params.datefrom) {
params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd');
}
if (params.dateto) {
params.dateto = $filter('date')(params.dateto, 'yyyyMMdd');
}
params.page = page || $scope.pagination.page || 1;
if(params.gateway){
if((params.gateway.sort().toString()!=[0,1].toString()) && (params.gateway.sort().toString()!=[5,6].toString())){
delete params.gatewayChilds;
delete params.gatewayChild;
}
if(params.gatewayChilds){
var exist = false
params.gatewayChilds.forEach(function (child) {
if(child==params.gatewayChild){
exist = true
}
})
if(!exist){
params.gatewayChild = null
}
}else{
delete params.gatewayChild;
}
}else{
delete params.gatewayChilds;
delete params.gatewayChild;
}
$http.get('/sys/trade_logs/incremental', {params: params}).then(function (resp) {
$scope.tradeLogs = resp.data.data;
$scope.pagination = resp.data.pagination;
$scope.analysis = resp.data.analysis;
$scope.analysis.refund_fee = angular.copy(Math.abs($scope.analysis.refund_fee));
});
};
$scope.showTradeDetail = function (order) {
orderService.managerOrderDetail(order)
};
$scope.loadTradeLogs(1);
$scope.$on('order_refunded', function () {
$scope.loadTradeLogs();
});
}
]);
return app;
});

@ -10,16 +10,21 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
url: '/trade',
templateUrl: '/static/payment/tradelog/templates/partner_trade_logs.html',
controller: 'tradeLogCtrl'
}).state('incremental_trade', {
url: '/IncrementalTrade',
templateUrl: '/static/payment/tradelog/templates/partner_incremental_trade_logs.html',
controller: 'IncrementalTradeLogCtrl'
})
}]);
app.controller('tradeLogCtrl', ['$scope', '$http', '$filter', '$timeout', 'partnerRefunder', 'orderService', 'commonDialog',
function ($scope, $http, $filter, $timeout, partnerRefunder, orderService, commonDialog) {
$scope.params = {status: 'PAID', channel :'ALL' ,textType: 'all', datefrom: new Date(), dateto: new Date()};
app.controller('tradeLogCtrl', ['$scope', '$http', '$filter', '$timeout', 'partnerRefunder', 'orderService', 'commonDialog','$sce',
function ($scope, $http, $filter, $timeout, partnerRefunder, orderService, commonDialog,$sce) {
$scope.params = {source: 'ALL',status: 'PAID', channel :'ALL' ,textType: 'all', datefrom: new Date(), dateto: new Date()};
$scope.pagination = {};
$scope.today = new Date();
$scope.isAll = true;
$scope.isLevel3All = true;
$scope.device_isAll = true;
$scope.order_device_isAll = true;
$scope.dev_params = {client_type:'sunmi',limit:100};
$scope.clients = [$scope.currentUser.client];
$scope.showLevel3Clients = false;
@ -68,19 +73,326 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
params.dateto = $filter('date')(params.dateto, 'yyyyMMdd');
}
params.page = page || $scope.pagination.page || 1;
if(params.gateway){
if((params.gateway.sort().toString()!=[0,1].toString()) && (params.gateway.sort().toString()!=[5,6].toString())){
delete params.gatewayChilds;
delete params.gatewayChild;
}
if(params.gatewayChilds){
var exist = false
params.gatewayChilds.forEach(function (child) {
if(child==params.gatewayChild){
exist = true
}
})
if(!exist){
params.gatewayChild = null
}
}else{
delete params.gatewayChild;
}
}else{
delete params.gatewayChilds;
delete params.gatewayChild;
}
$http.get('/client/partner_info/trade_logs', {params: params}).then(function (resp) {
$scope.tradeLogs = resp.data.data;
$scope.htmlToolst();
$scope.pagination = resp.data.pagination;
$scope.analysis = resp.data.analysis;
$scope.analysis.refund_fee = angular.copy(Math.abs($scope.analysis.refund_fee));
});
};
/*$scope.htmlToolst = function(){
for(var i=0;i< $scope.tradeLogs.length;i++){
var tax_amount = $scope.tradeLogs[i].tax_amount;
var total_surcharge= $scope.tradeLogs[i].total_surcharge;
var incremental_surcharge = $scope.tradeLogs[i].incremental_surcharge;
var system_surcharge = (total_surcharge-incremental_surcharge).toFixed(2);
$scope.tradeLogs[i].htmlTooltip = $sce.trustAsHtml('<div style="width: 180px">' +
'<h5>手续费组成</h5>'+'<div style="background-color: #EFEFF5;height: 1px;margin-bottom: 10px;"></div>'+
'<p>system:'+ system_surcharge +'</p>' +
'<p>R跨境商城:'+ incremental_surcharge +'</p>' +
'<p>tax amount:'+ tax_amount +'</p>' +
'</div>');
}
};*/
$scope.htmlToolst = function(){
for(var i=0;i< $scope.tradeLogs.length;i++){
var tax_amount = $scope.tradeLogs[i].tax_amount;
var total_surcharge= $scope.tradeLogs[i].total_surcharge;
var incremental_surcharge = $scope.tradeLogs[i].incremental_surcharge;
var total_amount = $scope.tradeLogs[i].total_amount;
var display_amount = $scope.tradeLogs[i].display_amount;
var source = $scope.tradeLogs[i].source;
var system_surcharge = (total_surcharge-incremental_surcharge).toFixed(2);
var tip = '<div style="width: 180px">' +
'<h5>手续费组成</h5>'+'<div style="background-color: #EFEFF5;height: 1px;margin-bottom: 10px;"></div>'+
'<p>system:'+ system_surcharge +'</p>' +
'<p>'+ source +':'+incremental_surcharge +'</p>';
if(total_surcharge < (total_amount-display_amount).toFixed(2)){
tip = tip +'<p>tax amount:'+ tax_amount +'</p>';
}
tip = tip + '</div>';
$scope.tradeLogs[i].htmlTooltip = $sce.trustAsHtml(tip);
}
}
$scope.gatewaySelected = function (arr) {
return $scope.params.gateway != null && $scope.params.gateway.filter(function (gateway) {
return arr.indexOf(gateway) >= 0
}).length > 0
};
$scope.initGatewayChild = function(){
$scope.params.gatewayChilds = $scope.params.gateway;
$scope.params.gatewayChild=null;
$scope.loadTradeLogs(1);
}
$scope.showTradeDetail = function (order) {
orderService.clientOrderDetail(order)
};
$scope.showPRefundLog = function (orderId) {
partnerRefunder.prefunded(orderId);
};
$scope.newPRefund = function (orderId) {
partnerRefunder.prefund(orderId).then(function () {
$scope.loadTradeLogs();
});
};
$scope.releasePreAuth = function (orderId) {
commonDialog.confirm({
title: 'Pre Authorization Completion',
content: 'This bill will be taken into settlement, or you will be able to make a refund order. Are you sure?'
}).then(function () {
$http.put('/client/partner_info/trade_logs/' + orderId + '/release_preauth').then(function (resp) {
$scope.loadTradeLogs();
}, function (resp) {
commonDialog.alert({title: 'Error!', content: resp.data.message, type: 'error'})
})
})
};
$scope.alerts = [];
$scope.$on('pe_order_paid', function (evt, order) {
$scope.alerts.push(order);
$timeout(function () {
$scope.alerts.splice(0, 1);
}, 10000);
$scope.loadTradeLogs();
});
$scope.chooseClient = function (client) {
if (client == 'all') {
$scope.params.client_ids = angular.copy($scope.clientIds);
$scope.isAll = true;
$scope.chooseClientId = '';
$scope.dev_params.client_ids = angular.copy($scope.clientIds);
$scope.showLevel3Clients = false;
$scope.listDevices();
$scope.listDevicesIds();
} else if (client.level3Clients) {
$scope.chooseClientId = client.client_id;
$scope.showLevel3Clients = true;
$scope.level3Clients = client.level3Clients;
$scope.isAll = false;
$scope.level3ClientIds = [];
$scope.level3ClientIds.push(client.client_id);
client.level3Clients.forEach(function (client) {
$scope.level3ClientIds.push(client.client_id);
});
$scope.chooseLevel3Client("all");
return;
} else {
$scope.chooseClientId = client.client_id;
$scope.params.client_ids = [client.client_id];
$scope.isAll = false;
$scope.dev_params.client_ids = [client.client_id];
$scope.showLevel3Clients = false;
$scope.listDevices();
$scope.listDevicesIds();
}
$scope.loadTradeLogs();
};
$scope.chooseLevel3Client = function (client) {
if (client == 'all') {
$scope.params.client_ids = angular.copy($scope.level3ClientIds);
$scope.isLevel3All = true;
$scope.chooseLevel3ClientId = '';
$scope.dev_params.client_ids = angular.copy($scope.level3ClientIds);
$scope.listDevices();
$scope.listDevicesIds();
} else {
$scope.chooseLevel3ClientId = client.client_id;
$scope.params.client_ids = [client.client_id];
$scope.isLevel3All = false;
$scope.dev_params.client_ids = [client.client_id];
$scope.listDevices();
$scope.listDevicesIds();
}
$scope.loadTradeLogs();
};
$scope.listDevices = function () {
var params = angular.copy($scope.dev_params)
$http.get('/client/partner_info/devices', {params: params}).then(function (resp) {
$scope.devices = resp.data.data;
})
};
$scope.listDevicesIds = function () {
var params = angular.copy($scope.params)
$http.get('/client/partner_info/device_ids',{params: params}).then(function (resp) {
$scope.deviceIds = resp.data.data;
})
};
$scope.chooseDevices = function (dev_id) {
if(dev_id == 'all'){
$scope.chooseDevice_id = '';
$scope.params.dev_id = null;
$scope.device_isAll = true;
$scope.loadTradeLogs(1);
}else {
$scope.chooseDevice_id = dev_id;
$scope.params.dev_id = dev_id;
$scope.device_isAll = false;
$scope.order_device_isAll = true;
$scope.choose_order_device_id = '';
$scope.loadTradeLogs(1);
}
};
$scope.chooseDeviceIds = function (dev_id) {
if(dev_id == 'all'){
$scope.choose_order_device_id = '';
$scope.params.dev_id = null;
$scope.order_device_isAll = true;
$scope.loadTradeLogs(1);
}else {
$scope.choose_order_device_id = dev_id;
$scope.params.dev_id = dev_id;
$scope.device_isAll = true;
$scope.order_device_isAll = false;
$scope.chooseDevice_id = '';
$scope.loadTradeLogs(1);
}
};
$scope.listDevices();
$scope.listDevicesIds();
if ($scope.currentUser.client.has_children) {
$http.get('/client/partner_info/sub_partners').then(function (resp) {
var clientList = resp.data;
clientList.forEach(function (client) {
$scope.clients.push(client);
});
$scope.clientIds = [];
$scope.clients.forEach(function (client) {
$scope.clientIds.push(client.client_id);
if (client.level3Clients) {
client.level3Clients.forEach(function (level3Client) {
$scope.clientIds.push(level3Client.client_id);
});
}
});
$scope.params.client_ids = angular.copy($scope.clientIds);
$scope.loadTradeLogs(1);
$scope.listDevicesIds();
//console.log($rootScope.currentUser.client.clientList);
})
}else{
$scope.loadTradeLogs(1);
}
$scope.fullReleasePreAuth = function (){
var params = angular.copy($scope.params);
if (params.datefrom) {
params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd');
}
if (params.dateto) {
params.dateto = $filter('date')(params.dateto, 'yyyyMMdd');
}
commonDialog.confirm({
title: 'All Pre Authorization Completion',
content: 'These pre authorization orders will be taken into settlement, or you will be able to make a refund order. Are you sure?'
}).then(function(){
$http.put('/client/partner_info/trade_logs/full_release_preauth',params).then(function (resp){
$scope.loadTradeLogs(1);
alert("Success");
},function (resp) {
commonDialog.alert({title: 'Error!', content: resp.data.message, type: 'error'})
})
});
}
}]);
app.controller('IncrementalTradeLogCtrl', ['$scope', '$http', '$filter', '$timeout', 'partnerRefunder', 'orderService', 'commonDialog',
function ($scope, $http, $filter, $timeout, partnerRefunder, orderService, commonDialog) {
$scope.params = {source: 'R跨境商城',status: 'PAID', channel :'ALL' ,textType: 'all', datefrom: new Date(), dateto: new Date()};
$scope.pagination = {};
$scope.today = new Date();
$scope.isAll = true;
$scope.isLevel3All = true;
$scope.device_isAll = true;
$scope.dev_params = {client_type:'sunmi',limit:100};
$scope.clients = [$scope.currentUser.client];
$scope.showLevel3Clients = false;
$scope.chooseToday = function () {
$scope.params.datefrom = $scope.params.dateto = new Date();
$scope.loadTradeLogs(1);
};
$scope.chooseYesterday = function () {
var yesterday = new Date();
yesterday.setDate(yesterday.getDate() - 1);
$scope.params.datefrom = $scope.params.dateto = yesterday;
$scope.loadTradeLogs(1);
};
$scope.chooseLast7Days = function () {
$scope.params.dateto = new Date();
var day = new Date();
day.setDate(day.getDate() - 7);
$scope.params.datefrom = day;
$scope.loadTradeLogs(1);
};
$scope.thisMonth = function () {
$scope.params.dateto = new Date();
var monthBegin = new Date();
monthBegin.setDate(1);
$scope.params.datefrom = monthBegin;
$scope.loadTradeLogs(1);
};
$scope.lastMonth = function () {
var monthFinish = new Date();
monthFinish.setDate(0);
$scope.params.dateto = monthFinish;
var monthBegin = new Date();
monthBegin.setDate(0);
monthBegin.setDate(1);
$scope.params.datefrom = monthBegin;
$scope.loadTradeLogs(1);
};
$scope.loadTradeLogs = function (page) {
var params = angular.copy($scope.params);
if (params.datefrom) {
params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd');
}
if (params.dateto) {
params.dateto = $filter('date')(params.dateto, 'yyyyMMdd');
}
params.page = page || $scope.pagination.page || 1;
$http.get('/client/partner_info/incremental_trade_logs', {params: params}).then(function (resp) {
$scope.tradeLogs = resp.data.data;
$scope.pagination = resp.data.pagination;
$scope.analysis = resp.data.analysis;
$scope.analysis.refund_fee = angular.copy(Math.abs($scope.analysis.refund_fee));
});
};
$scope.gatewaySelected = function (arr) {
return $scope.params.gateway != null && $scope.params.gateway.filter(function (gateway) {
return arr.indexOf(gateway) >= 0
}).length > 0
};
$scope.showTradeDetail = function (order) {
orderService.clientOrderDetail(order)
};
@ -225,7 +537,8 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
})
});
}
}]);
return app;
});
});

@ -12,13 +12,14 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
controller: 'balanceListCtrl'
})
}]);
app.controller('balanceListCtrl', ['$scope', '$http', '$filter', '$timeout', 'refunder', 'orderService', function ($scope, $http, $filter, $timeout, refunder) {
app.controller('balanceListCtrl', ['$scope', '$http', '$filter', '$timeout', 'refunder', 'orderService','$sce', function ($scope, $http, $filter, $timeout, refunder,orderService,$sce) {
$scope.params = {};
$scope.pagination = {};
$scope.params.clearing_status = -1;
$scope.params.channel = 'ALL'
$scope.dev_params = {client_type:'sunmi',limit:100};
$scope.device_isAll = true;
$scope.order_device_isAll = true;
$scope.params.trans_type = 0;
$scope.isAll = true;
$scope.clients = [$scope.currentUser.client];
@ -66,6 +67,13 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
$scope.devices = resp.data.data;
})
};
$scope.listDevicesIds = function () {
var params = angular.copy($scope.params)
$http.get('/client/partner_info/device_ids',{params: params}).then(function (resp) {
$scope.deviceIds = resp.data.data;
})
};
$scope.chooseDevices = function (dev_id) {
if(dev_id == 'all'){
$scope.chooseDevice_id = '';
@ -76,10 +84,26 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
$scope.chooseDevice_id = dev_id;
$scope.params.dev_id = dev_id;
$scope.device_isAll = false;
$scope.order_device_isAll = true;
$scope.loadTradeLogs(1);
}
};
$scope.chooseDeviceIds = function (dev_id) {
if(dev_id == 'all'){
$scope.choose_order_device_id = '';
$scope.params.dev_id = null;
$scope.order_device_isAll = true;
$scope.loadTradeLogs(1);
}else {
$scope.choose_order_device_id = dev_id;
$scope.params.dev_id = dev_id;
$scope.device_isAll = true;
$scope.order_device_isAll = false;
$scope.loadTradeLogs(1);
}
};
$scope.listDevices();
$scope.listDevicesIds();
$scope.loadTradeLogs = function (page) {
var params = angular.copy($scope.params);
if (params.datefrom) {
@ -91,10 +115,12 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
params.page = page || $scope.pagination.page || 1;
$http.get('/client/trans_flow', {params: params}).then(function (resp) {
$scope.tradeLogs = resp.data.data;
$scope.htmlToolst();
$scope.pagination = resp.data.pagination;
$scope.analysis = resp.data.analysis;
$scope.analysis.refund_fee = angular.copy(Math.abs($scope.analysis.refund_fee));
});
};
$scope.chooseClient = function (client) {
if (client == 'all') {
@ -104,6 +130,7 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
$scope.dev_params.client_ids = angular.copy($scope.clientIds);
$scope.showLevel3Clients = false;
$scope.listDevices();
$scope.listDevicesIds();
} else if (client.level3Clients) {
$scope.chooseClientId = client.client_id;
$scope.showLevel3Clients = true;
@ -123,6 +150,7 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
$scope.dev_params.client_ids = [client.client_id];
$scope.showLevel3Clients = false;
$scope.listDevices();
$scope.listDevicesIds();
}
$scope.loadTradeLogs();
};
@ -133,12 +161,14 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
$scope.chooseLevel3ClientId = '';
$scope.dev_params.client_ids = angular.copy($scope.level3ClientIds);
$scope.listDevices();
$scope.listDevicesIds();
} else {
$scope.chooseLevel3ClientId = client.client_id;
$scope.params.client_ids = [client.client_id];
$scope.isLevel3All = false;
$scope.dev_params.client_ids = [client.client_id];
$scope.listDevices();
$scope.listDevicesIds();
}
$scope.loadTradeLogs();
};
@ -214,7 +244,29 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
}else {
$scope.chooseLast7Days();
}
$scope.htmlToolst = function(){
for(var i=0;i< $scope.tradeLogs.length;i++){
var tax_amount = $scope.tradeLogs[i].tax_amount;
var total_surcharge= $scope.tradeLogs[i].total_surcharge;
var incremental_surcharge = $scope.tradeLogs[i].incremental_surcharge;
var channel_surcharge = $scope.tradeLogs[i].channel_surcharge;
var royal_surcharge = $scope.tradeLogs[i].royal_surcharge;
var system_surcharge = (total_surcharge-incremental_surcharge).toFixed(2);
var channel = $scope.tradeLogs[i].source;
var tip = '<div style="width: 180px">' +
'<h5>手续费组成</h5>'+'<div style="background-color: #EFEFF5;height: 1px;margin-bottom: 10px;"></div>'+
'<p>system:'+ system_surcharge +'</p>' +
'<p>'+channel+':'+ incremental_surcharge +'</p>';
if(total_surcharge <= (royal_surcharge+incremental_surcharge+channel_surcharge+tax_amount)){
tip = tip +'<p>tax amount:'+ tax_amount +'</p>';
}
tip = tip + '</div>';
$scope.tradeLogs[i].htmlTooltip = $sce.trustAsHtml(tip);
}
};
}]);
return app;
});
});

@ -1,11 +1,23 @@
package au.com.royalpay.payment.manage.valid;
import au.com.royalpay.payment.manage.analysis.beans.ato.CharacterUtils;
import au.com.royalpay.payment.manage.appclient.beans.RSvcMchBean;
import au.com.royalpay.payment.tools.codec.AESCrypt;
import au.com.royalpay.payment.tools.encryptalgorithm.SignUtils;
import com.alibaba.fastjson.JSONObject;
import com.github.stuxuhai.jpinyin.PinyinException;
import com.github.stuxuhai.jpinyin.PinyinFormat;
import com.github.stuxuhai.jpinyin.PinyinHelper;
import org.apache.commons.net.util.Base64;
import org.junit.Test;
import javax.crypto.BadPaddingException;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
/**
* Create by yixian at 2018-09-06 8:57
*/
@ -16,4 +28,38 @@ public class JPinYinTest {
System.out.println(CharacterUtils.convertFullWidthToHalfWidth(CharacterUtils.convertToPinYin(test)));
}
@Test
public void testRSA() throws NoSuchPaddingException, NoSuchAlgorithmException, IllegalBlockSizeException, BadPaddingException, InvalidKeyException, InvalidKeySpecException {
String rsa1_pub = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlxNzoulC++qq9a37bvNe5hyoWhlybZxrOGXRunMK84zpTlCL1tDfiwVYuXipAH8z9U0GcU6noEeY1WqIDftK89zLiUtOEkIMZsIDkiuCbJip61ArhI/oRhb6DeyRk9oLo+5kO428ZOr/9NdVJUapMEqKSEvdMzDvnU5ruU7jBcUZpLkn108478OcNTptxAvy4+xaErij8BOuIooG6F2IfIRz9TfcYV7ycaD449lks64oeMZJok+Gr+NyD8YXJDQrVw5tP1LUwDjQHJanmShCrPboSXKF6+h2Puv8F8Iy+vXZdP3Y6X9VHJdjBn3nMaohIrbuK9YCjTOAue+lFPzK+wIDAQAB";
String rsa1_pri = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCXE3Oi6UL76qr1rftu817mHKhaGXJtnGs4ZdG6cwrzjOlOUIvW0N+LBVi5eKkAfzP1TQZxTqegR5jVaogN+0rz3MuJS04SQgxmwgOSK4JsmKnrUCuEj+hGFvoN7JGT2guj7mQ7jbxk6v/011UlRqkwSopIS90zMO+dTmu5TuMFxRmkuSfXTzjvw5w1Om3EC/Lj7FoSuKPwE64iigboXYh8hHP1N9xhXvJxoPjj2WSzrih4xkmiT4av43IPxhckNCtXDm0/UtTAONAclqeZKEKs9uhJcoXr6HY+6/wXwjL69dl0/djpf1Ucl2MGfecxqiEitu4r1gKNM4C576UU/Mr7AgMBAAECggEAFPmbZXPzW9yB7ehA72+UrmguK4w66eL8s/DXBIbyb0wSHFBsid+oGbodTmrlM+91PEp8aYDdHxCxtHe8+gv4pRDzpVUyOrC23hFzw3iM/BzaApS35gjA2/JWt1YwBBIS6aiwe+A61twVu12mMa200cKXnmACDxhtPC7mH+1G8cbsG23qW2LnbZoMAa8CtaE8/oVi57AsoxYdK2mEh0wgwdIVpDANWnS7WRr9Qb3VzcJNFkcd1ngt5NdjmtJaAfkV0JZuANWG/7exrUFkzTiaejeKCn3hCEmT4yD7D+27WLzrjOJDFOaPmQjcLYpWxQsckxAG1PCZcyZbW99QVl4XmQKBgQDLi9f4TwZFb55fHM9kja7KP8Ts34z6vlE2RPzd5gf6Zdt3yFxh/nl8e1m+SPzgUZnrlaSyP4HMKsEoLOGCCqyuHjxE3u8S4Y6pzZOxfD+j5t30cSfGbflyRnE1vhsHsNeQ4sx9Slcj2erZeI1IeKXbA3Z4bI5x7g4xiF8ufhMeDQKBgQC+Ahb1JNIO3JVlR5mWmcQkrlQCLCJznjoXQ2ikhtwJ4j/Gg6JZUD2OjnqX2gzIB+6DYI0Xfv6Ph31DuAQ1/pLG+Q9rRicox9PkDV7nol6ZPH0peCECVf40FvQWXlt6crWkNk8ukrQJi5Y/msFCmR1v9DA6ovaxr/KfvNA9QmlTJwKBgDaDbYQDJhrSmge/H4w+peFk0sjd1lQRRI7USyTixqA5R139O0DDdqXwI0jjI1awhBikK0fR2mFj0feAjaTWVwkK7/lB+6WC40J23Gdcb27mFeuxooVyTqxcUVWjZHna0uDq3PlxP4VKh6tWrgAKz+CoPMJj0IKSzxpU+6jn+xbBAoGAc0zfU4kxctVGTvxA5lOO49dpoRvZGCHnDGDaaiRv+At0Oel9Jgd8Izqwh99IrEWr5cs8MwrcPIqyZ9qNq5o8xUMzqRwb/TItkZDPi25LS1+acAS2uy0locRgAAboKgjb0rcmG5PobnZnCVfGeLxjUaFzdtGXM8IaT/aKwvG+6jcCgYEAnyMYkTyyyPlzJRdvQz/ovuXzI+dRvDGbkOpwZcCp5JukoQGSZvy8LCDbiMjKXq1q2/PfUdYxvala7pCBstX7MHg4dy8UvZAnAVy1jM6sJs2zXsR3d4F6/GlVO0aLd0spEgmxqEnLl84F/bRwypr6CzqpkROxUa/SbtdxSjXFqOA=";
String rsa2_pub = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoDwO29Hs7XCm7bEhNVs57Jfgr+kj0vivPcX3XvIs+jXQzvMDfNrnwcsI3cNqQ/4+tVmt9ie8Qy1yn4mjJW4Leuv+2CqIRkOmzohwzjN2F1ue4EaNUF0YJaM1OTYhTMxud/6h05h4fVapuAycJ5NZ9fZW+7pV73Jn4ZMm5pIdE4m+NDcqVUyrBqBsxmJ0QVf6qpvfU5zE9a3PhLK4YhnLT278B+J+yGKFiNO/0W5KMpVcLSZ9e29x/aPFu+SyqmkJfGECNmvRKD3JkD3+YnCBR/TQLHPallL/mUDBc7kLQqkhzdEXepfPVg99K7PggNcsyIlUMmSP9SsSUcmXLUUcHwIDAQAB";
String rsa2_pri = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCgPA7b0eztcKbtsSE1Wznsl+Cv6SPS+K89xfde8iz6NdDO8wN82ufBywjdw2pD/j61Wa32J7xDLXKfiaMlbgt66/7YKohGQ6bOiHDOM3YXW57gRo1QXRglozU5NiFMzG53/qHTmHh9Vqm4DJwnk1n19lb7ulXvcmfhkybmkh0Tib40NypVTKsGoGzGYnRBV/qqm99TnMT1rc+EsrhiGctPbvwH4n7IYoWI07/RbkoylVwtJn17b3H9o8W75LKqaQl8YQI2a9EoPcmQPf5icIFH9NAsc9qWUv+ZQMFzuQtCqSHN0Rd6l89WD30rs+CA1yzIiVQyZI/1KxJRyZctRRwfAgMBAAECggEAYpexuNY5h3vqapSzz0XbpVVqXjMA5P45rbPS2uv+etKEMeJbggab1aVdRj7Icx/Ma//LR4v5jgg34CxrY0uL6s2tGEtLYJid2bUgW/BUOFkar/sZVpqBkh8TT6mb4cpkKpdV8YF+mfiqI2I27y7+ipZRvUBRQi1N+AF4TSUYmP0N+l+13y+ndDAi45qzhhsyF7aD50jZ6cRK35PqkgWx9vEhnDHBUYVWIJ3V5D/fFiJHjTX8+a/pC8SriQvvi3p1sUdcMil3qn/6J/rytZ331h1f7IcHaR3RRfJrVd0g9JT4jUOx1wzZTLw3ZxEK3xKMRDHCIpYkDBti4fk00nZ9IQKBgQDLHUCIlNEA3WQcee/t1031N5VzxDRTy4SHW6jgDsllHOcvC2URIBga4mbczS5MYlZ2Jll3iyqDBD8FDhCdf5CE5Ey2N4DxSKPzHSqn+rdvQRAs2QaVPUcND63V7J5mpp97MzsqWzBiESG0jIoNys0IrpdrqHCkcMAtOukEZ9o+MQKBgQDJ9KB086XiS3gIYqgfutF2QuTTpm9sjuPr3Ij1Xq6xPo3Dxc1nCMNx8dnka0erwPZ1bypbQcvgjxjxuow1XsnbvY9dQpmg51eH1/oFoXHeuY4qel5LnODJ05RSPK25bYX29ezV4Fp+LX/5ZRQwJXojPvZhxB8i0RdMiNmPQzjbTwKBgQCRB0sL+w6dSndwKdUag5CjllO9fIxMhNYVfGpBye0dqJyeJ8m7h6oOkDgYUt1LJzBLXqilRhZNxJtm9ZsBipNbgFQSC+Gi51ZBgkLx/IA8DT4Kd9BOgZmZBuf+Bt03uKPJaVRGsyQB8e+aJntwy6zJFTkDYxtDH0rpQNYfEjRwEQKBgA+p3IQVnakWh2HHHRkQ6UwN1iegQgYecwkJGspFJLF0k5Q6lDrIkDgXNPolY/KrTbJAA/399W0eTCX7fQJqrqdPZX4rOzUinERZ+PdU1TscEy2yPfwJV9nvghJ6yFKYbwp/enYAJ6SfrMxQDafKUFXJfVyJ1IxjwTXba1xUL2W7AoGAc6PzW66wEVYqvzfWzWr22tR0JS87b0h9eqyqHib5XATKmpKpJztMZvgj50fCGWxWcwW+QoEoxFZqRXWiFiS1Tax+UY7QDRF55JOOfZyl1+eerAQAq99sVg0QAom/9V4jZNfX3JZvIYI15opGSdI2hsRrtW7CBvYxsGz7mT3cLoE=";
RSvcMchBean aaa = new RSvcMchBean();
aaa.setMerchantNumber("taylor");
aaa.setIndustryName("其他服务行业");
aaa.setIndustryCode("331");
aaa.setCredentialCode("7dlXrdvhyuN73NDpZsGYftdIMuZms1Qc");
aaa.setLogo("https://file.royalpay.com.au/open/2017/07/24/1500898932409_7uFGyWIpk4IRTQyT3INk2Nk3KHedOG.png");
aaa.setPayHost("http://192.168.1.6:9008/");
aaa.setPartnerCode("PINE");
aaa.setMerchantName("TEST");
String pubKeyEncCredentialCode = SignUtils.encData(aaa.getCredentialCode(), rsa1_pub);
String aesKeyStr = Base64.encodeBase64String(AESCrypt.randomKey().getEncoded());
Key key = AESCrypt.fromKeyString(Base64.decodeBase64(aesKeyStr));
String decCredentialCode = Base64.encodeBase64String(AESCrypt.encrypt(pubKeyEncCredentialCode.getBytes(StandardCharsets.UTF_8), key));
JSONObject result = (JSONObject) JSONObject.toJSON(aaa);
result.put("sign_type", "RSA2");
result.put("enc_data", decCredentialCode);
result.put("nonce_str", aesKeyStr);
result.put("timestamp", System.currentTimeMillis());
result.put("sign", SignUtils.buildSign(result.toJSONString(), rsa2_pri));
System.err.println(result);
String signa = result.getString("sign");
result.remove("sign");
SignUtils.checkStringSign(result.toJSONString(), signa, rsa2_pub);
String aesData = new String(AESCrypt.decrypt(Base64.decodeBase64(result.getString("enc_data")), key), StandardCharsets.UTF_8);
System.err.println(SignUtils.decData(aesData, rsa1_pri));
}
}

Loading…
Cancel
Save