Merge branch 'develop'

# Conflicts:
#	src/main/java/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.java
#	src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java
#	src/main/ui/static/payment/partner/partner-manage.js
master
taylor.dang 5 years ago
commit 75a43ab60f

@ -7,6 +7,7 @@ import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator;
import java.util.Date;
import java.util.List;
@ -14,7 +15,7 @@ import java.util.List;
/**
* Created by davep on 2016-07-28.
*/
@AutoMapper(tablename = "sys_clients", pkName = "client_id", pkAutoIncrement = true)
@AutoMapper(tablename = "sys_clients", pkName = "client_id", keyGenerator = Jdbc3KeyGenerator.class)
public interface ClientAnalysisMapper {
int countNewClients(JSONObject params);
@ -45,7 +46,7 @@ public interface ClientAnalysisMapper {
List<JSONObject> notTradeSubMerchantId();
List<JSONObject> tradeSubMerchantIdBy60Days(@Param("begin")Date begin);
List<JSONObject> tradeSubMerchantIdBy60Days(@Param("begin") Date begin);
List<JSONObject> countClientsSettlementCycle(JSONObject params);
}

@ -1,7 +1,9 @@
package au.com.royalpay.payment.manage.analysis.mappers;
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 cn.yixblog.support.mybatis.paginator.annotations.CountRef;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
@ -12,7 +14,7 @@ import java.util.List;
/**
* Created by yishuqian on 09/11/2016.
*/
@AutoMapper(tablename = "statistics_customer_order",pkName = "id")
@AutoMapper(tablename = "statistics_customer_order", pkName = "id")
public interface CustomerAndOrdersStatisticsMapper {
@AutoSql(type = SqlType.INSERT)
void save(JSONObject jsonObject);
@ -50,8 +52,11 @@ public interface CustomerAndOrdersStatisticsMapper {
JSONObject getCommonCount(JSONObject params);
@CountRef(".countAreaMerchantTradeAnalysis")
PageList<JSONObject> getAreaMerchantTradeAnalysis(JSONObject params, PageBounds pageBounds);
int countAreaMerchantTradeAnalysis(JSONObject params);
List<JSONObject> countTradedClientsByDate(JSONObject parasm);
List<JSONObject> getAreaMerchantTradeByLastCycle(JSONObject parasm);

@ -1,5 +1,6 @@
package au.com.royalpay.payment.manage.analysis.mappers;
import cn.yixblog.support.mybatis.paginator.annotations.CountRef;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
@ -21,7 +22,10 @@ public interface OrderAnalysisMapper {
JSONObject analysisOrderSuccessRateDetailOfGlobal(@Param("date") Date date);
@CountRef(".countCustomersData")
PageList<JSONObject> listCustomersData(JSONObject params, PageBounds pageBounds);
int countCustomersData(JSONObject params);
JSONObject listCustomersDataAnalysis(JSONObject params);
}

@ -1,6 +1,7 @@
package au.com.royalpay.payment.manage.analysis.mappers;
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
import cn.yixblog.support.mybatis.paginator.annotations.CountRef;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
@ -65,22 +66,29 @@ public interface TransactionAnalysisMapper {
JSONObject getAmountRangeAnalysis(JSONObject params);
@CountRef(".countAmountRangeOrders")
PageList<JSONObject> listAmountRangeOrders(JSONObject params, PageBounds pagination);
int countAmountRangeOrders(JSONObject params);
BigDecimal getOneOrder(@Param("order_id") String order_id);
int getCountCustomers(@Param("date") Date date);
JSONObject getClientTransaction(JSONObject params);
PageList<JSONObject> getAreaMerchantAmountAnalysis(JSONObject params,PageBounds pagination);
@CountRef(".countAreaMerchantAmountAnalysis")
PageList<JSONObject> getAreaMerchantAmountAnalysis(JSONObject params, PageBounds pagination);
int countAreaMerchantAmountAnalysis(JSONObject params);
List<JSONObject> getAreaMerchantAmountByCycle(JSONObject params);
JSONObject getOrderClearAmount(@Param("order_id") String order_id);
JSONObject getOrderClearAmount(@Param("order_id") String orderId);
/**
* cny_amount
*
* @param params
* @return
*/

@ -156,7 +156,7 @@ public class BDPrizeServiceImpl implements BDPrizeService {
//todo 10月开始悉尼分公司经理不享受悉尼销售组提成
List<JSONObject> bdLeaders = managerMapper.listByRole(1, ManagerRole.BD_LEADER.getMask());
for (JSONObject leader : bdLeaders) {
BigDecimal groupAmount = transactionMapper.TotalAmountForBDLeaderPrize(now.get(Calendar.YEAR), now.get(Calendar.MONTH) + 1,leader.getString("manager_id"));
BigDecimal groupAmount = transactionMapper.totalAmountForBDLeaderPrize(now.get(Calendar.YEAR), now.get(Calendar.MONTH) + 1,leader.getString("manager_id"));
JSONObject bdConfig = financialBDConfigMapper.getBdConfig(leader.getString("manager_id"));
int bd_type = bdConfig ==null?2:("Sydney").equals(bdConfig.getString("city"))?2:1;//sydney leader 即悉尼大客户经理
JSONObject rateJson = financialBDCommissionConfigMapper.findCurrentCommissionRate(month, groupAmount.toString(), bd_type);
@ -269,7 +269,7 @@ public class BDPrizeServiceImpl implements BDPrizeService {
try {
List<JSONObject> prizeLogList = new ArrayList<>();
JSONObject sydneyPrizeLog = new JSONObject();
BigDecimal sydneyAmount = transactionMapper.TotalAmountForSydneyGMPrize(monthDate.getYear(), monthDate.getMonthOfYear());
BigDecimal sydneyAmount = transactionMapper.totalAmountForSydneyGMPrize(monthDate.getYear(), monthDate.getMonthOfYear());
sydneyPrizeLog.put("total_amount",sydneyAmount);
sydneyPrizeLog.put("bd_type", 3);
JSONObject sydneyGMRate = financialBDCommissionConfigMapper.findCurrentCommissionRate(month, sydneyAmount.toString(), 3);

@ -96,7 +96,7 @@ public class BDPrizeCalculatorDefaultImpl implements BDPrizeCalculator {
log.put("total_amount", 0);
log.put("total_prize", 0);
log.put("total_donation", 0);
BigDecimal totalAmount = transactionMapper.TotalAmountForBDPrize(year,month1,bd.getString("bd_id"));
BigDecimal totalAmount = transactionMapper.totalAmountForBDPrize(year,month1,bd.getString("bd_id"));
List<JSONObject> details = new ArrayList<>();
for (Map.Entry<String, JSONObject> detail : resultItem.getValue().entrySet()) {
JSONObject detailItem = detail.getValue();

@ -4,15 +4,14 @@ import au.com.royalpay.payment.core.risk.bean.RiskTypeEnum;
import au.com.royalpay.payment.manage.logview.beans.LogRiskQueryBean;
import au.com.royalpay.payment.manage.mappers.log.LogRiskMapper;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.manage.tradelog.beans.PreRefundQueryBean;
import au.com.royalpay.payment.manage.tradelog.core.TradeLogService;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@ -30,14 +29,14 @@ public class LogRiskController {
@Resource
private TradeLogService tradeLogService;
@RequestMapping(value = "/risk_log/list", method = RequestMethod.GET)
@GetMapping(value = "/risk_log/list")
public JSONObject listLogRisk(LogRiskQueryBean logRiskQueryBean) {
return PageListUtils.buildPageListResult(
logRiskMapper.listWithClientInfo(logRiskQueryBean.toParams(), new PageBounds(logRiskQueryBean.getPage(), logRiskQueryBean.getLimit())));
}
@RequestMapping(value = "/risk_log/typeCharts", method = RequestMethod.GET)
@GetMapping(value = "/risk_log/typeCharts")
public JSONObject typeCharts(LogRiskQueryBean logRiskQueryBean) {
List<JSONObject> statisticsRiskLogList = logRiskMapper.statisticsRiskLog(logRiskQueryBean.toParams());
if (CollectionUtils.isEmpty(statisticsRiskLogList)) {
@ -84,7 +83,7 @@ public class LogRiskController {
return result;
}
@RequestMapping(value = "/pre_refund/list", method = RequestMethod.GET)
@GetMapping(value = "/pre_refund/list")
public JSONObject listPreRefund(PreRefundQueryBean preRefundQueryBean) {
return PageListUtils.buildPageListResult(tradeLogService.listPreRefundClients(preRefundQueryBean));
}

@ -4,11 +4,7 @@ import au.com.royalpay.payment.core.PaymentApi;
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.ClearingDetailAnalysisMapper;
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.log.LogSettleMailMapper;
import au.com.royalpay.payment.manage.mappers.log.ValidationLogMapper;
import au.com.royalpay.payment.manage.mappers.log.*;
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.*;
@ -34,16 +30,15 @@ import au.com.royalpay.payment.tools.locale.LocaleSupport;
import au.com.royalpay.payment.tools.lock.Locker;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.tasksupport.TaskFinishNotifyEvent;
import au.com.royalpay.payment.tools.utils.DateVaildUtil;
import au.com.royalpay.payment.tools.utils.PageListUtils;
import au.com.royalpay.payment.tools.utils.TimeZoneUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVPrinter;
@ -52,12 +47,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.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.joda.time.DateTime;
import org.joda.time.Days;
@ -75,37 +65,20 @@ import org.springframework.util.CollectionUtils;
import org.thymeleaf.context.Context;
import org.thymeleaf.spring4.SpringTemplateEngine;
import java.io.BufferedWriter;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Writer;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URISyntaxException;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Currency;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.TreeMap;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import static au.com.royalpay.payment.manage.permission.utils.OrgCheckUtils.checkOrgPermission;
/**
@ -163,7 +136,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
@Resource
private ClientDeviceMapper clientDeviceMapper;
private static final int MAX_TRACK_DAYS = 31;
@Value("${app.settlement.email-to}")
private String settlementEmailTo;
@Value("${app.settlement.email-cc}")
@ -627,9 +600,9 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
@Override
public JSONObject getCleanLogsInClients(ClearingLogQuery query, JSONObject manager) {
JSONObject params = query.toParams();
DateVaildUtil.validDateDuration(params.getDate("from"), params.getDate("to"), MAX_TRACK_DAYS);
if (query.getClientMoniker() != null && !query.getClientMoniker().isEmpty()) {
JSONObject client = clientManager.getClientInfoByMoniker(query.getClientMoniker());
Assert.notNull(client);
}
if (manager.getInteger("org_id") != null) {
params.put("org_id", manager.getIntValue("org_id"));
@ -642,9 +615,9 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
@Override
public JSONObject analysisCleanLogs(ClearingLogQuery query, JSONObject manager) {
JSONObject params = query.toParams();
DateVaildUtil.validDateDuration(params.getDate("from"), params.getDate("to"), MAX_TRACK_DAYS);
if (query.getClientMoniker() != null && !query.getClientMoniker().isEmpty()) {
JSONObject client = clientManager.getClientInfoByMoniker(query.getClientMoniker());
Assert.notNull(client);
}
if (manager.getInteger("org_id") != null) {
params.put("org_id", manager.getIntValue("org_id"));

@ -4,9 +4,7 @@ import au.com.royalpay.payment.manage.mappers.log.ValidationLogMapper;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import netscape.javascript.JSObject;
import org.apache.commons.lang3.time.DateUtils;
import org.apache.xerces.impl.validation.ValidationManager;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@ -8,13 +8,14 @@ import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator;
import java.util.List;
/**
* Created by yixian on 2017-03-21.
*/
@AutoMapper(tablename = "act_diet_attend", pkName = "attend_id", pkAutoIncrement = true)
@AutoMapper(tablename = "act_diet_attend", pkName = "attend_id", keyGenerator = Jdbc3KeyGenerator.class)
public interface ActDietAttendMapper {
@AutoSql(type = SqlType.SELECT)

@ -1,17 +1,13 @@
package au.com.royalpay.payment.manage.mappers.custom;
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
/**
* Created by yishuqian on 9/1/16.
*/

@ -4,13 +4,14 @@ 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.executor.keygen.Jdbc3KeyGenerator;
import java.util.List;
/**
* Created by yixian on 2017-02-07.
*/
@AutoMapper(tablename = "financial_bd_prize_rate_config", pkName = "config_id", pkAutoIncrement = true)
@AutoMapper(tablename = "financial_bd_prize_rate_config", pkName = "config_id", keyGenerator = Jdbc3KeyGenerator.class)
public interface FinancialBDRateConfigMapper {
@AutoSql(type = SqlType.SELECT)
List<JSONObject> listAllConfig();

@ -5,6 +5,7 @@ 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 java.math.BigDecimal;
import java.util.Date;
@ -13,7 +14,7 @@ import java.util.List;
/**
* Created by yixian on 2017-03-21.
*/
@AutoMapper(tablename = "log_clearing_detail_analysis", pkName = "detail_id", pkAutoIncrement = true)
@AutoMapper(tablename = "log_clearing_detail_analysis", pkName = "detail_id", keyGenerator = Jdbc3KeyGenerator.class)
public interface ClearingDetailAnalysisMapper {
@AutoSql(type = SqlType.INSERT)
void save(JSONObject channel);

@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator;
import java.util.Date;
import java.util.List;
@ -14,7 +15,7 @@ import java.util.List;
/**
* Created by davep on 2016-09-05.
*/
@AutoMapper(tablename = "log_clearing_detail", pkAutoIncrement = true, pkName = "clear_detail_id")
@AutoMapper(tablename = "log_clearing_detail", keyGenerator = Jdbc3KeyGenerator.class, pkName = "clear_detail_id")
public interface ClearingDetailMapper {
@AutoSql(type = SqlType.INSERT)
void save(JSONObject detail);

@ -5,6 +5,7 @@ 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 java.util.Date;
import java.util.List;
@ -12,7 +13,7 @@ import java.util.List;
/**
* Created by davep on 2016-09-04.
*/
@AutoMapper(tablename = "log_clearing", pkName = "clearing_id", pkAutoIncrement = true)
@AutoMapper(tablename = "log_clearing", pkName = "clearing_id", keyGenerator = Jdbc3KeyGenerator.class)
public interface ClearingLogMapper {
@AutoSql(type = SqlType.INSERT)

@ -22,7 +22,7 @@ public interface NotifyErrorLogMapper {
void saveLog(JSONObject log);
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "success=0 and addtime(`addtime`,'24:00:00')>now()")
@AdvanceSelect(addonWhereClause = "success=0 and `addtime`>addtime(now(),'-24:00:00')")
List<JSONObject> listErrorLogsInOneHour();
@AutoSql(type = SqlType.UPDATE)

@ -5,6 +5,7 @@ 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 java.util.Date;
import java.util.List;
@ -12,7 +13,7 @@ import java.util.List;
/**
* Created by yixian on 2016-09-19.
*/
@AutoMapper(tablename = "log_order_validation", pkName = "valid_id", pkAutoIncrement = true)
@AutoMapper(tablename = "log_order_validation", pkName = "valid_id", keyGenerator = Jdbc3KeyGenerator.class)
public interface ValidationLogMapper {
@AutoSql(type = SqlType.INSERT)

@ -38,14 +38,6 @@ public interface OrderMapper {
JSONObject getOrderDetail(@Param("order_id") String orderId);
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "(status=2 or status=0) and addtime(create_time,'0:05:00')<now()")
List<JSONObject> listUnConfirmedOrders();
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "(status=2 or status=0) and addtime(create_time,'1:00:00')>now()")
List<JSONObject> listRecentUnconfirmedOrders();
@AutoSql(type = SqlType.SELECT)
PageList<JSONObject> list(JSONObject params, PageBounds pagination);
@ -58,17 +50,7 @@ public interface OrderMapper {
void updateOrderCreationError(@Param("order_id") String orderId, @Param("status") int status, @Param("error_code") String errorCode, @Param("error_message") String errorMessage);
@AutoSql(type = SqlType.UPDATE)
void setWechatMsgSendStatus(@Param("order_id") String orderId, @Param("wechat_notify") int status);
@AutoSql(type = SqlType.UPDATE)
void setIOSMsgSendStatus(@Param("order_id") String orderId, @Param("ios_notify") int status);
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "status>4 and wechat_notify=1 and addtime(confirm_time,'12:00:00')>now()")
List<JSONObject> listOrdersWithWechatNotifyFailedToday();
int getOldOrdersPoints(@Param("customer_id") String open_id);
int getOldOrdersPoints(@Param("customer_id") String openId);
PageList<JSONObject> listOrderByCustomer(JSONObject params, PageBounds pagination);

@ -4,10 +4,12 @@ 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 cn.yixblog.support.mybatis.paginator.annotations.CountRef;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator;
import java.math.BigDecimal;
import java.util.Date;
@ -16,50 +18,34 @@ import java.util.List;
/**
* Created by yixian on 2016-07-01.
*/
@AutoMapper(tablename = "pmt_transactions", pkName = "transaction_id", pkAutoIncrement = true)
@AutoMapper(tablename = "pmt_transactions", pkName = "transaction_id", keyGenerator = Jdbc3KeyGenerator.class)
public interface TransactionMapper {
@AutoSql(type = SqlType.INSERT)
void save(JSONObject transaction);
@CountRef(".countTransFlowPage")
PageList<JSONObject> listTransFlowPage(JSONObject params, PageBounds pagination);
int countTransFlowPage(JSONObject params);
List<JSONObject> listTransFlow(JSONObject params);
JSONObject analysisTransFlow(JSONObject params);
Double analysisBalance(JSONObject params);
@AutoSql(type = SqlType.SELECT)
JSONObject findTransById(@Param("transaction_id") String transactionId);
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "refund_id is null and system_generate=0 and transaction_type = 'Credit'")
JSONObject findIncomeByOrderId(@Param("order_id") String orderId);
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "transaction_type = 'Credit'")
JSONObject findByOrderId(@Param("order_id") String orderId);
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "refund_id is null and system_generate=1")
JSONObject findSystemIncomeByOrderId(@Param("order_id") String orderId);
@AutoSql(type = SqlType.UPDATE)
void update(JSONObject transaction);
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "transaction_type='Debit' and system_generate = 0")
JSONObject findRefundLog(@Param("order_id") String orderId, @Param("refund_id") String refundId);
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "transaction_type='Credit'")
JSONObject findRefundPayback(@Param("order_id") String orderId, @Param("refund_id") String refundId);
JSONObject findLastIncome();
double getClientUnClearedAmount(@Param("client_id") int clientId);
List<JSONObject> getClientsUnClearedAmount(@Param("client_ids") List<Integer> client_ids);
List<JSONObject> getClientsUnClearedAmount(@Param("client_ids") List<Integer> clientIds);
JSONObject getClientAmountAnalysis(JSONObject params);
@ -75,8 +61,11 @@ public interface TransactionMapper {
PageList<JSONObject> listSettlementLog(JSONObject params, PageBounds pagination);
@CountRef(".countSettlementLogInClients")
PageList<JSONObject> listSettlementLogInClients(JSONObject params, PageBounds pagination);
int countSettlementLogInClients(JSONObject params);
JSONObject analysisSettlementLog(JSONObject params);
List<JSONObject> listSettlementLogTotal(JSONObject params);
@ -97,11 +86,11 @@ public interface TransactionMapper {
List<JSONObject> listTransactionsForBDPrize(@Param("year") int year, @Param("month") int month, @Param("channel") String channel);
BigDecimal TotalAmountForBDPrize(@Param("year") int year, @Param("month") int month, @Param("bd_id") String bd_id);
BigDecimal totalAmountForBDPrize(@Param("year") int year, @Param("month") int month, @Param("bd_id") String bd_id);
BigDecimal TotalAmountForBDLeaderPrize(@Param("year") int year, @Param("month") int month, @Param("bd_group") String bd_group);
BigDecimal totalAmountForBDLeaderPrize(@Param("year") int year, @Param("month") int month, @Param("bd_group") String bd_group);
BigDecimal TotalAmountForSydneyGMPrize(@Param("year") int year, @Param("month") int month);
BigDecimal totalAmountForSydneyGMPrize(@Param("year") int year, @Param("month") int month);
List<JSONObject> listTransactionForCityPartnerCommissionByDate(@Param("year") int year, @Param("month") int month);
@ -117,7 +106,7 @@ public interface TransactionMapper {
@AutoSql(type = SqlType.COUNT)
@AdvanceSelect(addonWhereClause = "transaction_type='Credit'")
int countOrders(@Param("client_id") int client_id);
int countOrders(@Param("client_id") int clientId);
List<JSONObject> listDailyTransactions(@Param("from") Date from, @Param("to") Date to, @Param("dev_id") String devId, @Param("client_id") int clientId, @Param("client_ids") String[] client_ids);
@ -127,16 +116,8 @@ public interface TransactionMapper {
@AdvanceSelect(addonWhereClause = "system_generate=1")
List<JSONObject> findTransactionsBySysGen(@Param("order_id") String orderId);
@AutoSql(type = SqlType.SELECT)
List<JSONObject> findFixTransaction(@Param("order_id") String orderId, @Param("refund_id") String refundId, @Param("system_transaction_id") String systemTransactionId);
BigDecimal analysisCustomerPaid(@Param("customer_id") String customerId, @Param("startDate") Date startDate, @Param("endDate") Date endDate);
@AutoSql(type = SqlType.UPDATE)
void updateTransactionSurcharge(@Param("transaction_id") String transactionId, @Param("surcharge_rate") BigDecimal surchargeRate,
@Param("settle_amount") BigDecimal settleAmount, @Param("total_surcharge") BigDecimal surcharge,
@Param("channel_surcharge") BigDecimal channelSurcharge, @Param("royal_surcharge") BigDecimal royalSurcharge);
List<JSONObject> getSettleDelayAnalysis(@Param("begin") Date begin, @Param("end") Date end);
List<JSONObject> getSettleDelayTotalTransaction(@Param("begin") Date begin, @Param("end") Date end);

@ -11,8 +11,9 @@ import java.util.List;
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 org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator;
@AutoMapper(tablename = "sys_client_pre_apply", pkName = "client_pre_apply_id",pkAutoIncrement = true)
@AutoMapper(tablename = "sys_client_pre_apply", pkName = "client_pre_apply_id",keyGenerator = Jdbc3KeyGenerator.class)
public interface SysClientPreMapperMapper {
@AutoSql(type = SqlType.UPDATE)
void update(JSONObject data);

@ -11,7 +11,7 @@ import java.util.List;
/**
* Created by yishuqian on 04/01/2017.
*/
@AutoMapper(tablename = "act_black_list")
@AutoMapper(tablename = "act_black_list", pkName = {"act_id", "client_id"})
public interface ActBlackListMapper {
@AutoSql(type = SqlType.INSERT)
void save(JSONObject blackObj);

@ -5,13 +5,14 @@ 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 java.util.List;
/**
* Created by davep on 2016-08-16.
*/
@AutoMapper(tablename = "sys_bank_accounts", pkAutoIncrement = true, pkName = "bank_account_id")
@AutoMapper(tablename = "sys_bank_accounts", keyGenerator = Jdbc3KeyGenerator.class, pkName = "bank_account_id")
public interface ClientBankAccountMapper {
@AutoSql(type = SqlType.SELECT)

@ -10,6 +10,7 @@ import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator;
import java.util.Date;
import java.util.List;
@ -17,7 +18,7 @@ import java.util.List;
/**
* Created by yixian on 2016-06-25.
*/
@AutoMapper(tablename = "sys_clients", pkName = "client_id", pkAutoIncrement = true)
@AutoMapper(tablename = "sys_clients", pkName = "client_id", keyGenerator = Jdbc3KeyGenerator.class)
public interface ClientMapper {
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid=1")

@ -5,6 +5,7 @@ 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 java.util.Date;
import java.util.List;
@ -12,7 +13,7 @@ import java.util.List;
/**
* Created by davep on 2016-08-16.
*/
@AutoMapper(tablename = "sys_client_rates", pkName = "client_rate_id", pkAutoIncrement = true)
@AutoMapper(tablename = "sys_client_rates", pkName = "client_rate_id", keyGenerator = Jdbc3KeyGenerator.class)
public interface ClientRateMapper {
List<JSONObject> listCurrentClientRates(@Param("client_id") int clientId, @Param("date") Date date, @Param("rate_name") String rateName);

@ -6,11 +6,12 @@ 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;
/**
* Created by davep on 2016-08-03.
*/
@AutoMapper(tablename = "sys_customer_relation", pkName = "relation_id", pkAutoIncrement = true)
@AutoMapper(tablename = "sys_customer_relation", pkName = "relation_id", keyGenerator = Jdbc3KeyGenerator.class)
public interface CustomerMapper {
@AutoSql(type = SqlType.INSERT)

@ -8,13 +8,14 @@ import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator;
import java.util.List;
/**
* Created by yixian on 2016-10-18.
*/
@AutoMapper(tablename = "sys_org", pkName = "org_id", pkAutoIncrement = true)
@AutoMapper(tablename = "sys_org", pkName = "org_id", keyGenerator = Jdbc3KeyGenerator.class)
public interface OrgMapper {
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "type != 1")

@ -1,20 +1,18 @@
package au.com.royalpay.payment.manage.mappers.system;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.alibaba.fastjson.JSONObject;
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 java.util.List;
/**
* Created by yixian on 2017-02-28.
*/
@AutoMapper(tablename = "sys_permission_partner_modules", pkName = "id",pkAutoIncrement = true)
@AutoMapper(tablename = "sys_permission_partner_modules", pkName = "id",keyGenerator = Jdbc3KeyGenerator.class)
public interface PermissionPartnerModuleMapper {
@AutoSql(type = SqlType.INSERT)
void save(JSONObject module);

@ -5,13 +5,14 @@ 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 java.util.List;
/**
* Created by yishuqian on 11/11/2016.
*/
@AutoMapper(tablename = "austrac_report_config", pkName = "pkid", pkAutoIncrement = true)
@AutoMapper(tablename = "austrac_report_config", pkName = "pkid", keyGenerator = Jdbc3KeyGenerator.class)
public interface ReportConfigMapper {
@AutoSql(type = SqlType.UPDATE)
void update(JSONObject jsonObject);

@ -16,7 +16,6 @@ import au.com.royalpay.payment.channels.yeepay.runtime.YeePayClient;
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.exceptions.ParamInvalidException;
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;
@ -25,28 +24,13 @@ import au.com.royalpay.payment.manage.application.core.SimpleClientApplyService;
import au.com.royalpay.payment.manage.device.core.DeviceManager;
import au.com.royalpay.payment.manage.management.sysconfig.core.impls.PermissionPartnerManagerImpl;
import au.com.royalpay.payment.manage.mappers.financial.FinancialBDConfigMapper;
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.log.ClientsOperationLogMapper;
import au.com.royalpay.payment.manage.mappers.log.LogClientSubMerchantIdMapper;
import au.com.royalpay.payment.manage.mappers.log.LogSettleMailMapper;
import au.com.royalpay.payment.manage.mappers.log.*;
import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper;
import au.com.royalpay.payment.manage.mappers.redpack.ActClientInvitationCodeMapper;
import au.com.royalpay.payment.manage.mappers.risk.RiskAttentionMerchantsMapper;
import au.com.royalpay.payment.manage.mappers.system.*;
import au.com.royalpay.payment.manage.merchants.beans.ActivityPosterBuilder;
import au.com.royalpay.payment.manage.merchants.beans.BankAccountInfo;
import au.com.royalpay.payment.manage.merchants.beans.ClientAuthFilesInfo;
import au.com.royalpay.payment.manage.merchants.beans.ClientRateConfig;
import au.com.royalpay.payment.manage.merchants.beans.ClientRegisterInfo;
import au.com.royalpay.payment.manage.merchants.beans.NewAccountBean;
import au.com.royalpay.payment.manage.merchants.beans.PartnerQuery;
import au.com.royalpay.payment.manage.merchants.beans.SubMerchantIdApply;
import au.com.royalpay.payment.manage.merchants.core.ClientComplyValidator;
import au.com.royalpay.payment.manage.merchants.core.ClientConfigService;
import au.com.royalpay.payment.manage.merchants.core.ClientInfoCacheSupport;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.merchants.core.ClientModifySupport;
import au.com.royalpay.payment.manage.merchants.beans.*;
import au.com.royalpay.payment.manage.merchants.core.*;
import au.com.royalpay.payment.manage.merchants.entity.impls.*;
import au.com.royalpay.payment.manage.notice.core.MailService;
import au.com.royalpay.payment.manage.signin.beans.TodoNotice;
@ -72,7 +56,6 @@ import au.com.royalpay.payment.tools.inspiry.core.InspiryPOSFinder;
import au.com.royalpay.payment.tools.locale.LocaleSupport;
import au.com.royalpay.payment.tools.lock.Locker;
import au.com.royalpay.payment.tools.mail.SendMail;
import org.apache.commons.codec.binary.Base64;
import au.com.royalpay.payment.tools.merchants.beans.QRCodeConfig;
import au.com.royalpay.payment.tools.merchants.beans.UpdateSurchargeDTO;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
@ -80,31 +63,24 @@ import au.com.royalpay.payment.tools.merchants.qrboard.QRBoard;
import au.com.royalpay.payment.tools.merchants.qrboard.QRBoardProvider;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.permission.enums.PartnerRole;
import au.com.royalpay.payment.tools.utils.ImageUtils;
import au.com.royalpay.payment.tools.utils.PageListUtils;
import au.com.royalpay.payment.tools.utils.PasswordUtils;
import au.com.royalpay.payment.tools.utils.PdfUtils;
import au.com.royalpay.payment.tools.utils.QRCodeUtils;
import au.com.royalpay.payment.tools.utils.TimeZoneUtils;
import au.com.royalpay.payment.tools.utils.*;
import au.com.royalpay.payment.tools.websocket.notify.PartnerPageEvent;
import cn.yixblog.platform.http.HttpRequestGenerator;
import cn.yixblog.platform.http.HttpRequestResult;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import com.yeepay.yop.sdk.service.kj.model.SubmerchantRegisterResult;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.apache.el.parser.AstNot;
import org.apache.http.client.utils.URLEncodedUtils;
import org.dom4j.Element;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -124,6 +100,13 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.thymeleaf.context.Context;
import org.thymeleaf.spring4.SpringTemplateEngine;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import javax.crypto.*;
import javax.crypto.spec.SecretKeySpec;
import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;
@ -131,34 +114,18 @@ import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
import java.security.InvalidParameterException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.List;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import javax.crypto.*;
import javax.crypto.spec.DESKeySpec;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import cn.yixblog.platform.http.HttpRequestGenerator;
import cn.yixblog.platform.http.HttpRequestResult;
import sun.misc.BASE64Encoder;
import static au.com.royalpay.payment.manage.permission.utils.OrgCheckUtils.checkOrgPermission;
/**
@ -5054,21 +5021,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
byte[] enCodeFormat = secretKey.getEncoded();
SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES");
Cipher cipher = Cipher.getInstance("AES");
byte[] byteContent = content.getBytes("utf-8");
byte[] byteContent = content.getBytes(StandardCharsets.UTF_8);
cipher.init(Cipher.ENCRYPT_MODE, key);
byte[] result = cipher.doFinal(byteContent);
return Base64.encodeBase64String(result);
} catch (NoSuchPaddingException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (InvalidKeyException e) {
e.printStackTrace();
} catch (IllegalBlockSizeException e) {
e.printStackTrace();
} catch (BadPaddingException e) {
} catch (NoSuchPaddingException | NoSuchAlgorithmException | InvalidKeyException | IllegalBlockSizeException | BadPaddingException e) {
e.printStackTrace();
}
return null;

@ -54,7 +54,7 @@ public class ManagerPermissionScanner implements BeanPostProcessor, PermissionRe
PermissionNode node = new PermissionNode(controller.getSimpleName(), method.getName());
getRequestInfo(node, clazzRequestMapping, methodMapping);
node.setPermissions(clazzPermission, methodPermission);
logger.debug("register permission:" + node.getFuncName() + ":" + node.getRequestId());
logger.trace("register permission:{}:{}", node.getFuncName(), node.getRequestId());
if (permissionNodes.containsKey(node.getFuncId())) {
throw new RuntimeException("Duplicated permission function ID:" + controller.getName() + "." + method.getName());
}

@ -4,11 +4,7 @@ import au.com.royalpay.payment.core.exceptions.EmailException;
import au.com.royalpay.payment.core.exceptions.InvalidShortIdException;
import au.com.royalpay.payment.manage.device.core.DeviceManager;
import au.com.royalpay.payment.manage.management.sysconfig.core.PermissionManager;
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.mappers.system.ManagerMapper;
import au.com.royalpay.payment.manage.mappers.system.OrgMapper;
import au.com.royalpay.payment.manage.mappers.system.SysCustomerServiceMapper;
import au.com.royalpay.payment.manage.mappers.system.*;
import au.com.royalpay.payment.manage.merchants.core.ClientConfigService;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.notice.core.MailService;
@ -29,9 +25,7 @@ import au.com.royalpay.payment.tools.locale.LocaleSupport;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.threadpool.RoyalThreadPoolExecutor;
import au.com.royalpay.payment.tools.utils.PasswordUtils;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
@ -46,15 +40,14 @@ import org.springframework.util.Assert;
import org.thymeleaf.context.Context;
import org.thymeleaf.spring4.SpringTemplateEngine;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
/**
* account service for sign in Created by yixian on 2016-06-29.
*/

@ -272,6 +272,26 @@
GROUP BY c.sub_merchant_id ORDER BY diff_days desc
</select>
<select id="tradeSubMerchantIdBy60Days" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT COUNT(DISTINCT c.client_id) client_count,
c.sub_merchant_id,
c.merchant_id,
tmp.create_time last_trade_time,
datediff(now(), tmp.create_time) diff_days
FROM sys_clients c INNER JOIN (SELECT sub_merchant_id, max(create_time) create_time
FROM pmt_orders where status>=5 and create_time>=#{begin} and create_time<=now()
and channel='Wechat'
GROUP BY sub_merchant_id
) tmp on c.sub_merchant_id = tmp.sub_merchant_id
WHERE
c.sub_merchant_id IS not null AND c.merchant_id IS NOT NULL
AND (c.approve_result = 1 OR c.approve_result= 2) AND c.is_valid = 1
AND c.enable_wechat = 1
]]>
GROUP BY c.sub_merchant_id ORDER BY diff_days desc
</select>
<select id="countClientsSettlementCycle" resultType="com.alibaba.fastjson.JSONObject">
SELECT COUNT(DISTINCT c.client_id) client_count,
CASE c.clean_days

@ -400,17 +400,50 @@
ifnull(sum(if(s.channel='Alipay'OR s.channel='AlipayOnline',s.orders,0)),0) alipay_order,
ifnull(sum(if(s.channel='Wechat',s.total,0)),0) wechat_toatl,
ifnull(sum(if(s.channel='Wechat',s.orders,0)),0) wechat_order
FROM statistics_customer_order s
RIGHT JOIN sys_clients c ON c.client_id = s.client_id and c.is_valid=1
FROM sys_clients c
]]>
LEFT JOIN (
select ss.client_id,ss.channel,ss.orders,ss.total
from
statistics_customer_order ss
<where>
<if test="begin!=null">and s.date &gt;= #{begin}</if>
<if test="end!=null">and s.date &lt; #{end}</if>
</where>
) s ON c.client_id = s.client_id
<if test="bd_user!=null">
INNER JOIN sys_client_bd d ON c.client_id = d.client_id AND d.bd_id = #{bd_user} and
date(d.start_date)&lt;= #{begin} and (d.end_date is null or date(d.end_date)&gt;= #{end}) and
d.is_valid=1
</if>
where c.is_valid=1
<if test="org_id!=null">and c.org_id = #{org_id}</if>
<if test="state!=null">and c.state = #{state}</if>
<if test="org_id!=null and org_ids==null">and c.org_id=#{org_id}</if>
<if test="org_ids!=null">and c.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<if test="client_monikers!=null">
AND c.client_moniker IN
<foreach collection="client_monikers" open="(" close=")" separator="," item="client_moniker">
#{client_moniker}
</foreach>
</if>
GROUP BY c.client_id ORDER BY total DESC
</select>
<select id="countAreaMerchantTradeAnalysis" resultType="int">
<![CDATA[
SELECT count(distinct c.client_id)
FROM sys_clients c
]]>
<if test="bd_user!=null">
INNER JOIN sys_client_bd d ON c.client_id = d.client_id AND d.bd_id = #{bd_user} and
date(d.start_date)&lt;= #{begin} and (d.end_date is null or date(d.end_date)&gt;= #{end}) and
d.is_valid=1
</if>
<where>
<if test="begin!=null">and s.date &gt;= #{begin}</if>
<if test="end!=null">and s.date &lt; #{end}</if>
where c.is_valid=1
<if test="org_id!=null">and c.org_id = #{org_id}</if>
<if test="state!=null">and c.state = #{state}</if>
<if test="org_id!=null and org_ids==null">and c.org_id=#{org_id}</if>
@ -422,8 +455,6 @@
#{client_moniker}
</foreach>
</if>
</where>
GROUP BY s.client_id ORDER BY total DESC
</select>

@ -234,6 +234,36 @@
GROUP BY o.customer_id
</select>
<select id="countCustomersData" resultType="int">
SELECT count(distinct o.customer_id)
FROM pmt_orders o
<where>
<if test="begin!=null">and o.create_time &gt;= #{begin}</if>
<if test="end!=null">and o.create_time &lt; #{end}</if>
<if test="openid_type==0">
AND o.customer_id LIKE 'o32%' and o.channel='Wechat'
</if>
<if test="openid_type==1">
AND o.customer_id LIKE 'obJ%' and o.channel='Wechat'
</if>
<if test="openid_type==2">
and o.channel='Alipay'
</if>
<if test="openid_type==3">
and o.channel='Bestpay'
</if>
<if test="openid_type==4">
AND o.customer_id LIKE 'olH%' and o.channel='Wechat'
</if>
<if test="customer_id!=null">
and o.customer_id=#{customer_id}
</if>
<if test="org_id!=null and org_ids==null">and o.org_id=#{org_id}</if>
<if test="org_ids!=null">and o.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
</where>
</select>
<select id="listCustomersDataAnalysis" resultType="com.alibaba.fastjson.JSONObject">
SELECT sum(if(o.status='5',o.customer_payment_amount,0)) total_amount
FROM pmt_orders o

@ -13,7 +13,8 @@
<select id="getEarliestOrder" resultType="com.alibaba.fastjson.JSONObject">
SELECT *
FROM pmt_transactions
WHERE client_id = #{client_id} AND clearing_amount > 1
WHERE client_id = #{client_id}
AND clearing_amount > 1
ORDER BY transaction_time
LIMIT 1;
</select>
@ -55,7 +56,8 @@
</if>
<if test="org_id!=null and org_ids==null">and l.org_id=#{org_id}</if>
<if test="org_ids!=null">and l.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
</select>
<select id="analysisTotalAmount" resultType="java.math.BigDecimal">
@ -77,7 +79,8 @@
</if>
<if test="org_id!=null and org_ids==null">and l.org_id=#{org_id}</if>
<if test="org_ids!=null">and l.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
</select>
<select id="analysisTotalCount" resultType="java.lang.Double">
@ -184,7 +187,8 @@
</if>
<if test="org_id!=null and org_ids==null">and o.org_id=#{org_id}</if>
<if test="org_ids!=null">and o.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
<![CDATA[
GROUP BY o.order_id ORDER BY aud_fee DESC limit 1
]]>
@ -244,7 +248,8 @@
<if test="end!=null">and o.create_time &lt;= #{end}</if>
<if test="org_id!=null and org_ids==null">and l.org_id=#{org_id}</if>
<if test="org_ids!=null">and l.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
GROUP BY gateway_label
</select>
@ -274,7 +279,8 @@
</if>
<if test="org_id!=null and org_ids==null">and l.org_id=#{org_id}</if>
<if test="org_ids!=null">and l.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
<if test="bd_group!=null">and l.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
@ -311,7 +317,8 @@
</if>
<if test="org_id!=null and org_ids==null">and l.org_id=#{org_id}</if>
<if test="org_ids!=null">and l.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
<![CDATA[
GROUP BY date(o.create_time)
ORDER BY date(o.create_time)
@ -339,7 +346,8 @@
</if>
<if test="org_id!=null and org_ids==null">and l.org_id=#{org_id}</if>
<if test="org_ids!=null">and l.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
</select>
<select id="countCustomers" resultType="java.lang.Integer">
<![CDATA[
@ -360,7 +368,8 @@
</if>
<if test="org_id!=null and org_ids==null">and o.org_id=#{org_id}</if>
<if test="org_ids!=null">and o.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
<![CDATA[
GROUP BY o.customer_id) p
]]>
@ -385,8 +394,9 @@
</if>
<if test="org_id!=null and org_ids==null">and t.org_id=#{org_id}</if>
<if test="org_ids!=null">and t.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<if test="channel !=null"> and o.channel = #{channel}</if>
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
<if test="channel !=null">and o.channel = #{channel}</if>
<![CDATA[
GROUP BY o.customer_id) p
where p.customer_id NOT IN (SELECT o.customer_id FROM pmt_transactions t INNER JOIN pmt_orders o ON o.order_id = t.order_id
@ -426,8 +436,9 @@
</if>
<if test="org_id!=null and org_ids==null">and t.org_id=#{org_id}</if>
<if test="org_ids!=null">and t.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<if test="channel !=null"> and o.channel = #{channel}</if>
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
<if test="channel !=null">and o.channel = #{channel}</if>
<![CDATA[
GROUP BY o.customer_id) p
where p.customer_id IN (SELECT o.customer_id FROM pmt_transactions t INNER JOIN pmt_orders o ON o.order_id = t.order_id
@ -451,9 +462,11 @@
<select id="getCountCustomers" resultType="java.lang.Integer">
<![CDATA[
SELECT count(DISTINCT o.customer_id) FROM pmt_orders o where
o.create_time < #{date} and o.status>=5
]]>
SELECT count(DISTINCT o.customer_id)
FROM pmt_orders o
where o.create_time < #{date}
and o.status >= 5
]]>
</select>
<select id="getTradePartnersInTypes" resultType="com.alibaba.fastjson.JSONObject">
@ -499,7 +512,8 @@
]]>
<if test="org_id!=null and org_ids==null">and l.org_id=#{org_id}</if>
<if test="org_ids!=null">and l.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
<if test="bd_group!=null">and l.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
@ -558,7 +572,8 @@
</if>
<if test="org_id!=null and org_ids==null">and l.org_id=#{org_id}</if>
<if test="org_ids!=null">and l.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
<if test="bd_group!=null">and l.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
@ -650,18 +665,19 @@
</if>
<if test="org_id!=null and org_ids==null">and ptran.org_id=#{org_id}</if>
<if test="org_ids!=null">and ptran.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
</select>
<select id="listExchangeRates" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT max(t.transaction_time) mx,t.exchange_rate,date(t.transaction_time) `date`
FROM
pmt_transactions t
WHERE date(t.transaction_time) >= #{begin} And date(t.transaction_time) <= #{end} AND
t.transaction_type ='Credit' AND t.channel =#{channel}
GROUP BY
date(t.transaction_time)
order by `date` asc
SELECT max(t.transaction_time) mx, t.exchange_rate, date(t.transaction_time) `date`
FROM pmt_transactions t
WHERE date(t.transaction_time) >= #{begin}
And date(t.transaction_time) <= #{end}
AND t.transaction_type = 'Credit'
AND t.channel = #{channel}
GROUP BY date(t.transaction_time)
order by `date` asc
]]>
</select>
@ -693,8 +709,9 @@
</if>
<if test="org_id!=null and org_ids==null">and o.org_id=#{org_id}</if>
<if test="org_ids!=null">and o.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
GROUP BY date , channel ORDER BY date DESC
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
GROUP BY date , channel ORDER BY date DESC
</select>
<select id="getOrgTransactionAnalysis" resultType="com.alibaba.fastjson.JSONObject">
@ -710,7 +727,8 @@
<if test="end!=null">and t.transaction_time &lt;= #{end}</if>
<if test="org_id!=null and org_ids==null">and o.org_id=#{org_id}</if>
<if test="org_ids!=null">and o.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
GROUP BY o.org_id order by amount desc
</select>
@ -749,7 +767,8 @@
<if test="channel!=null">and o.channel=#{channel}</if>
<if test="org_id!=null and org_ids==null">and l.org_id=#{org_id}</if>
<if test="org_ids!=null">and l.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
</select>
<select id="countAmountRangeAnalysis" resultType="java.lang.Integer">
@ -766,7 +785,8 @@
<select id="listAmountRangeOrders" resultType="com.alibaba.fastjson.JSONObject">
select c.client_moniker,c.short_name,t.order_id,t.clearing_amount,t.transaction_time,t.channel,o.customer_id,o.customer_ip,o.gateway
select
c.client_moniker,c.short_name,t.order_id,t.clearing_amount,t.transaction_time,t.channel,o.customer_id,o.customer_ip,o.gateway
FROM pmt_transactions t
LEFT JOIN pmt_orders o on o.order_id=t.order_id
INNER JOIN sys_clients c on c.client_id = t.client_id
@ -778,6 +798,19 @@
<if test="amount_from!=null">and t.clearing_amount &gt;= #{amount_from}</if>
<if test="amount_to!=null">and t.clearing_amount &lt; #{amount_to}</if>
</select>
<select id="countAmountRangeOrders" resultType="int">
select count(1)
FROM pmt_transactions t
<if test="client_moniker!=null">
inner join sys_clients c on c.client_id=t.client_id and c.client_moniker=#{client_moniker}
</if>
where t.transaction_type = 'Credit' and t.refund_id is null and t.channel != 'Settlement'
<if test="begin!=null">and t.transaction_time &gt;= #{begin}</if>
<if test="end!=null">and t.transaction_time &lt;= #{end}</if>
<if test="channel!=null">and t.channel=#{channel}</if>
<if test="amount_from!=null">and t.clearing_amount &gt;= #{amount_from}</if>
<if test="amount_to!=null">and t.clearing_amount &lt; #{amount_to}</if>
</select>
<!--交易金额分析 饼图 -->
<!--不更改-->
@ -804,13 +837,13 @@
<select id="getClientTransaction" resultType="com.alibaba.fastjson.JSONObject">
SELECT
IFNULL(sum(if(l.transaction_type='Credit',l.clearing_amount,0)),0) trade_amount,
IFNULL(sum(if(l.transaction_type='Debit',l.clearing_amount,0)),0) refund_amount,
IFNULL(sum(if(l.transaction_type='Credit',1,0)),0) trade_count,
IFNULL(sum(if(l.transaction_type='Debit',1,0)),0) refund_orders
FROM pmt_transactions l
where l.channel!='Settlement' and l.system_generate=0
SELECT
IFNULL(sum(if(l.transaction_type='Credit',l.clearing_amount,0)),0) trade_amount,
IFNULL(sum(if(l.transaction_type='Debit',l.clearing_amount,0)),0) refund_amount,
IFNULL(sum(if(l.transaction_type='Credit',1,0)),0) trade_count,
IFNULL(sum(if(l.transaction_type='Debit',1,0)),0) refund_orders
FROM pmt_transactions l
where l.channel!='Settlement' and l.system_generate=0
<if test="client_ids!=null">
AND l.client_id IN
<foreach collection="client_ids" open="(" close=")" separator="," item="client_id">
@ -824,31 +857,39 @@
<if test="end!=null">and l.transaction_time &lt; #{end}</if>
<if test="org_id!=null and org_ids==null">and l.org_id=#{org_id}</if>
<if test="org_ids!=null">and l.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
</select>
<select id="getAreaMerchantAmountAnalysis" resultType="com.alibaba.fastjson.JSONObject">
SELECT c.client_moniker,c.short_name,c.bd_user_name,sum(if(t.transaction_type='Credit',t.clearing_amount,0)) total,
SELECT c.client_moniker,c.short_name,c.bd_user_name,sum(if(t.transaction_type='Credit',t.clearing_amount,0))
total,
COUNT(DISTINCT t.order_id) orders,
c.suburb,c.state,c.royalpayindustry,sum(if(t.channel='Alipay' OR t.channel='AlipayOnline',t.clearing_amount,0)) alipay_total,
sum(if(t.channel='Alipay'OR t.channel='AlipayOnline',1,0)) alipay_order,sum(if(t.channel='Wechat',t.clearing_amount,0)) wechat_toatl,
c.suburb,c.state,c.royalpayindustry,sum(if(t.channel='Alipay' OR t.channel='AlipayOnline',t.clearing_amount,0))
alipay_total,
sum(if(t.channel='Alipay'OR t.channel='AlipayOnline',1,0))
alipay_order,sum(if(t.channel='Wechat',t.clearing_amount,0)) wechat_toatl,
sum(if(t.channel='Wechat',1,0)) wechat_order
FROM pmt_transactions t
INNER JOIN pmt_orders ord on ord.order_id = t.order_id
RIGHT JOIN sys_clients c on t.client_id = c.client_id and c.is_valid = 1
FROM sys_clients c
LEFT JOIN (select
tt.client_id,tt.order_id,tt.transaction_type,tt.clearing_amount, tt.channel
from pmt_transactions tt where tt.transaction_type = 'Credit'
and tt.system_generate=0
<if test="begin!=null">and tt.transaction_time &gt;= #{begin}</if>
<if test="end!=null">and tt.transaction_time &lt;= #{end}</if>
)t on t.client_id = c.client_id
<if test="bd_user!=null">
INNER JOIN sys_client_bd d ON c.client_id = d.client_id AND d.bd_id = #{bd_user} and
date(d.start_date)&lt;= #{begin} and (d.end_date is null or date(d.end_date)&gt;= #{end}) and
d.is_valid=1
</if>
where (t.transaction_type = 'Credit')
<if test="begin!=null">and t.transaction_time &gt;= #{begin}</if>
<if test="end!=null">and t.transaction_time &lt;= #{end}</if>
where (c.is_valid = 1 )
<if test="state!=null">and c.state &lt;= #{state}</if>
<if test="org_id!=null and org_ids==null">and c.org_id=#{org_id}</if>
<if test="org_ids!=null">and c.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
<if test="client_monikers!=null">
AND c.client_moniker IN
<foreach collection="client_monikers" open="(" close=")" separator="," item="client_moniker">
@ -858,6 +899,29 @@
GROUP BY c.client_id order by total desc
</select>
<select id="countAreaMerchantAmountAnalysis" resultType="int">
SELECT count(distinct c.client_id) clients
FROM sys_clients c
<if test="bd_user!=null">
INNER JOIN sys_client_bd d ON c.client_id = d.client_id AND d.bd_id = #{bd_user} and
date(d.start_date)&lt;= #{begin} and (d.end_date is null or date(d.end_date)&gt;= #{end}) and
d.is_valid=1
</if>
where (c.is_valid = 1)
<if test="state!=null">and c.state &lt;= #{state}</if>
<if test="org_id!=null and org_ids==null">and c.org_id=#{org_id}</if>
<if test="org_ids!=null">and c.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
<if test="client_monikers!=null">
AND c.client_moniker IN
<foreach collection="client_monikers" open="(" close=")" separator="," item="client_moniker">
#{client_moniker}
</foreach>
</if>
</select>
<select id="getAreaMerchantAmountByCycle" resultType="com.alibaba.fastjson.JSONObject">
SELECT c.client_moniker,sum(if(t.transaction_type='Credit',t.clearing_amount,0)) old_total,
@ -868,16 +932,20 @@
RIGHT JOIN sys_clients c on t.client_id = c.client_id and c.is_valid = 1
<if test="bd_user!=null">
INNER JOIN sys_client_bd d ON c.client_id = d.client_id AND d.bd_id = #{bd_user} and
date(d.start_date)&lt;= DATE_ADD(#{begin},INTERVAL -datediff( #{end},#{begin}) DAY) and (d.end_date is null or date(d.end_date)&gt;= #{begin}) and
date(d.start_date)&lt;= DATE_ADD(#{begin},INTERVAL -datediff( #{end},#{begin}) DAY) and (d.end_date is null
or date(d.end_date)&gt;= #{begin}) and
d.is_valid=1
</if>
where (t.transaction_type = 'Credit')
<if test="begin!=null">and t.transaction_time &gt;= DATE_ADD(#{begin},INTERVAL -datediff( #{end},#{begin}) DAY)</if>
<if test="begin!=null">and t.transaction_time &gt;= DATE_ADD(#{begin},INTERVAL -datediff( #{end},#{begin})
DAY)
</if>
<if test="end!=null">and t.transaction_time &lt;= #{begin}</if>
<if test="state!=null">and c.state &lt;= #{state}</if>
<if test="org_id!=null and org_ids==null">and c.org_id=#{org_id}</if>
<if test="org_ids!=null">and c.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
<if test="client_monikers!=null">
AND c.client_moniker IN
<foreach collection="client_monikers" open="(" close=")" separator="," item="client_moniker">
@ -888,9 +956,9 @@
</select>
<select id="getOrderClearAmount" resultType="com.alibaba.fastjson.JSONObject">
SELECT clearing_amount,o.client_id
SELECT clearing_amount, o.client_id
FROM pmt_orders o
INNER JOIN pmt_transactions pt ON o.order_id = pt.order_id
INNER JOIN pmt_transactions pt ON o.order_id = pt.order_id
WHERE o.order_id = #{order_id}
LIMIT 1;
</select>

@ -8,12 +8,10 @@
t.cny_amount cny_amount ,r.report_status report_status,r.report_id report_id,o.channel channel
from
pmt_orders o
left join
pmt_transactions t
on o.order_id = t.order_id
left join
pmt_custom_report r
on r.order_id = o.order_id
inner join pmt_transactions t on o.order_id = t.order_id and t.transaction_type = 'Credit'
<if test="from!=null">and t.transaction_time &gt;= #{from}</if>
<if test="to!=null">and t.transaction_time &lt; #{to}</if>
left join pmt_custom_report r on r.order_id = o.order_id
where
o.channel in (
<foreach collection="channels" separator="," item="item">
@ -22,7 +20,7 @@
)
and o.client_id = #{client_id}
and transaction_type = 'Credit'
and
o.status in (
<foreach collection="orderStatus" item="item" separator=",">
@ -33,8 +31,7 @@
<!--<if test="channel!=null">-->
<!--and o.channel = #{channel}-->
<!--</if>-->
<if test="from!=null">and t.transaction_time &gt;= #{from}</if>
<if test="to!=null">and t.transaction_time &lt; #{to}</if>
<if test="report_status!=null">
and r.report_status = #{report_status}
</if>

@ -57,6 +57,42 @@
</if>
</where>
</select>
<select id="countTransFlowPage" resultType="int">
SELECT count(1)
FROM pmt_transactions t
<if test="dev_id!=null or ">
INNER JOIN (select o.order_id from pmt_orders o<where>
<if test="dev_id!=null">and o.dev_id = #{dev_id}</if>
<if test="
channel!=null">and
<foreach collection="channel" item="chan" open="(" close=")" separator=" or ">
o.channel=#{chan}
</foreach>
</if>
</where>)oo ON oo.order_id=t.order_id
</if>
<where>
<if test="client_ids!=null">
AND t.client_id IN
<foreach collection="client_ids" open="(" close=")" separator="," item="client_id">
#{client_id}
</foreach>
</if>
<if test="client_ids==null">
and t.client_id=#{client_id}
</if>
<if test="from!=null">and t.transaction_time &gt;= #{from}</if>
<if test="to!=null">and t.transaction_time &lt; #{to}</if>
<if test="transaction_type!=null">and t.transaction_type=#{transaction_type}</if>
<if test="date!=null">and date(t.transaction_time)=date(#{date})</if>
<if test="clearing_status!=null">and t.clearing_status=#{clearing_status}</if>
<if test="trans_type==1">and t.transaction_type = 'Credit'</if>
<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>
</where>
</select>
<select id="listTransFlow" resultType="com.alibaba.fastjson.JSONObject">
SELECT t.*,
@ -271,16 +307,16 @@
<if test="to!=null">and t.transaction_time &lt; #{to}</if>
</select>
<select id="listPreRefundClients" resultType="com.alibaba.fastjson.JSONObject">
SELECT *
FROM (SELECT ifnull(sum(if(transaction_type = 'Credit', clearing_amount, -clearing_amount)), 0) amount,
c.client_id client_id,
max(t.transaction_time) transation_time,
c.client_moniker client_moniker
FROM pmt_transactions t
INNER JOIN sys_clients c ON t.client_id = c.client_id
INNER JOIN sys_client_config cc on cc.client_id = c.client_id AND cc.enable_refund_auth = 1
GROUP BY c.client_id) a
WHERE a.amount &lt; 0
SELECT sc.client_id,
sc.client_moniker,
IFNULL(SUM(IF(pt.transaction_type = 'Credit', pt.clearing_amount, -pt.clearing_amount)), 0) amount,
IFNULL(MAX(pt.create_time), sc.approve_time) transation_time
FROM pmt_transactions pt,
sys_clients sc
WHERE clearing_status = 0
AND pt.client_id = sc.client_id
GROUP BY client_id
HAVING amount &lt; 0
</select>
<select id="validAnalysis" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
@ -398,19 +434,41 @@
SELECT c.short_name,SUM(t.clearing_amount) total,
sum(if(LOCATE('MERCHANT',t.system_transaction_id),t.clearing_amount,0)) income,
sum(if(LOCATE('SURCHARGE',t.system_transaction_id),t.clearing_amount,0)) fee
FROM pmt_transactions t
RIGHT JOIN sys_clients c ON t.client_id = c.client_id
WHERE t.channel='Settlement'
]]>
<if test="from!=null">and t.transaction_time &gt;= #{from}</if>
<if test="to!=null">and t.transaction_time &lt; #{to}</if>
FROM sys_clients c
]]>
INNER JOIN (select system_transaction_id,clearing_amount,client_id
from pmt_transactions
where channel='Settlement'
<if test="from!=null">and transaction_time &gt;= #{from}</if>
<if test="to!=null">and transaction_time &lt; #{to}</if>
) t ON t.client_id = c.client_id
<where>
<if test="client_moniker!=null">and c.client_moniker=#{client_moniker}</if>
<if test="org_id!=null and org_ids==null">and c.org_id = #{org_id}</if>
<if test="org_ids!=null">and c.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
</where>
GROUP BY c.client_id
order by total desc
</select>
<select id="countSettlementLogInClients" resultType="int">
<![CDATA[
SELECT count(1)
FROM sys_clients c
]]>
<where>
<if test="client_moniker!=null">and c.client_moniker=#{client_moniker}</if>
<if test="org_id!=null and org_ids==null">and c.org_id = #{org_id}</if>
<if test="org_ids!=null">and c.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
and exists (select client_id from pmt_transactions t where channel='Settlement'
<if test="from!=null">and transaction_time &gt;= #{from}</if>
<if test="to!=null">and transaction_time &lt; #{to}</if>
and client_id=c.client_id
)
</where>
exists
</select>
<select id="analysisSettlementLog" resultType="com.alibaba.fastjson.JSONObject">
@ -563,7 +621,7 @@
ORDER BY trade_date ASC, o.client_id ASC
</select>
<select id="TotalAmountForBDPrize" resultType="java.math.BigDecimal">
<select id="totalAmountForBDPrize" resultType="java.math.BigDecimal">
<![CDATA[
select sum(if(temp.transaction_type = 'Credit', temp.clearing_amount * d.proportion,
-temp.clearing_amount * d.proportion))
@ -583,7 +641,7 @@
</select>
<select id="TotalAmountForBDLeaderPrize" resultType="java.math.BigDecimal">
<select id="totalAmountForBDLeaderPrize" resultType="java.math.BigDecimal">
SELECT ifnull(sum(t.total), 0)
total
FROM statistics_customer_order t
@ -600,7 +658,7 @@
or c.manager_id = #{bd_group})
</select>
<select id="TotalAmountForSydneyGMPrize" resultType="java.math.BigDecimal">
<select id="totalAmountForSydneyGMPrize" resultType="java.math.BigDecimal">
SELECT ifnull(sum(t.total), 0)
total
FROM statistics_customer_order t

@ -113,7 +113,7 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func
}
$scope.chooseOrg = function (org) {
if (org == 'all') {
if (org === 'all') {
delete $scope.params.org_id;
$scope.showOrg = 'All'
} else {
@ -135,6 +135,8 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func
$http.get('/sys/clean_logs/clients', {params: params}).then(function (resp) {
$scope.clearing_logs = resp.data.data;
$scope.pagination = resp.data.pagination;
}, function (resp) {
commonDialog.alert({type: 'error', title: 'Error', content: resp.data.message});
});
analysisLog(params);
};
@ -144,8 +146,6 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func
})
};
$scope.loadClearingLogs(1);
$scope.loadClearingLogsHistory = function (days) {
var endDate = new Date();
var startDate = new Date();

@ -99,10 +99,6 @@
<a role="button" class="btn btn-default btn-sm"
ng-click="lastMonth()">Last Month</a>
</div>
<div class="btn-group">
<a role="button" class="btn btn-default btn-sm"
ng-click="thisYear()">This Year</a>
</div>
<div uib-dropdown ng-if="orgs" class="btn-group">
<button id="single-button" type="button" class="btn btn-default"
uib-dropdown-toggle ng-disabled="disabled">

@ -699,10 +699,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
};
$scope.showFile();
$scope.passClient = function () {
if (!$scope.partner.wechat_institution_merchant_id) {
commonDialog.alert({title: 'info', content: 'Wechat Institution Merchant Id not Refresh', type: 'info'});
return;
}
$scope.refreshWechatInstitutionMerchantId();
if ($scope.partner.enable_hf) {
if ($scope.partner.hfindustry == null) {
alert("已开启HF支付通道HF行业不可为空!");
@ -775,14 +772,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
});
};
$scope.pass2GreenChannel = function () {
if (!$scope.partner.wechat_institution_merchant_id) {
commonDialog.alert({
title: 'info',
content: 'Wechat Institution Merchant Id not Refresh',
type: 'info'
});
return;
}
$scope.refreshWechatInstitutionMerchantId();
commonDialog.confirm({
title: 'Green Channel Audit Partner',
content: 'Are you sure to mark partner ' + $scope.partner.company_name + ' green channel audited '
@ -1559,20 +1549,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.ctrl = {};
$scope.saveSubMerchantId = function () {
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/payment_config', {sub_merchant_id: $scope.paymentInfo.sub_merchant_id}).then(function (resp) {
$scope.refreshInstitutionAfterSaveMerchantId();
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
});
};
$scope.refreshInstitutionAfterSaveMerchantId = function () {
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/wechat_institution_merchant_id', {wechat_institution_merchant_id: $scope.paymentInfo.wechat_institution_merchant_id}).then(function (resp) {
commonDialog.alert({
title: 'Success',
content: 'Modify Wechat Sub Merchant ID And Refresh Wechat Institution Merchant Id successfully',
type: 'success'
});
$scope.loadPartnerPaymentInfo();
$scope.refreshWechatInstitutionMerchantId();
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
});
@ -1580,11 +1557,6 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.refreshWechatInstitutionMerchantId = function () {
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/wechat_institution_merchant_id', {wechat_institution_merchant_id: $scope.paymentInfo.wechat_institution_merchant_id}).then(function (resp) {
commonDialog.alert({
title: 'Success',
content: 'Refresh Wechat Institution Merchant Id successfully',
type: 'success'
});
$scope.loadPartnerPaymentInfo();
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
@ -1610,7 +1582,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
content: '是否使用该商户的现有信息进件?',
json:$scope.alipay_gms_json
}).then(function () {
if ($scope.partner.business_structure == "Company") {
if ($scope.partner.business_structure === "Company") {
$http.post('/sys/partners/' + $scope.partner.client_moniker + '/register/alipay_gms', {representative_id: ""}).then(function () {
commonDialog.alert({title: 'Success', content: 'Alipay进件成功', type: 'success'});
}, function (resp) {
@ -1634,7 +1606,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}, function (resp) {
commonDialog.alert({title: 'Error', content: "查询失败:" + resp.data.message, type: 'error'});
})
}
};
$scope.submitAlipayOnlineSubId = function () {
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/alipayOnline_gms_json').then(function (resp) {
$scope.alipayOnline_gms_json = resp.data;

@ -41,7 +41,7 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
var day = new Date();
day.setDate(day.getDate() - 7);
$scope.params.datefrom = day;
$scope.loadTradeLogs(1);
$scope.chooseClient('all');
};
$scope.thisMonth = function () {
$scope.params.dateto = new Date();

Loading…
Cancel
Save