更新autosql插件,sql优化(部分)

master
yixian 6 years ago
parent 4ad021d020
commit 5f633305c1

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

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

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

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

@ -4,9 +4,7 @@ import au.com.royalpay.payment.manage.mappers.log.ValidationLogMapper;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import netscape.javascript.JSObject;
import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.lang3.time.DateUtils;
import org.apache.xerces.impl.validation.ValidationManager;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; 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.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator;
import java.util.List; import java.util.List;
/** /**
* Created by yixian on 2017-03-21. * 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 { public interface ActDietAttendMapper {
@AutoSql(type = SqlType.SELECT) @AutoSql(type = SqlType.SELECT)

@ -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.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType; import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator;
import java.util.List; import java.util.List;
/** /**
* Created by yixian on 2017-02-07. * 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 { public interface FinancialBDRateConfigMapper {
@AutoSql(type = SqlType.SELECT) @AutoSql(type = SqlType.SELECT)
List<JSONObject> listAllConfig(); List<JSONObject> listAllConfig();

@ -5,6 +5,7 @@ import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType; import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
@ -13,7 +14,7 @@ import java.util.List;
/** /**
* Created by yixian on 2017-03-21. * 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 { public interface ClearingDetailAnalysisMapper {
@AutoSql(type = SqlType.INSERT) @AutoSql(type = SqlType.INSERT)
void save(JSONObject channel); 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.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -14,7 +15,7 @@ import java.util.List;
/** /**
* Created by davep on 2016-09-05. * 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 { public interface ClearingDetailMapper {
@AutoSql(type = SqlType.INSERT) @AutoSql(type = SqlType.INSERT)
void save(JSONObject detail); 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 cn.yixblog.support.mybatis.autosql.annotations.SqlType;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -12,7 +13,7 @@ import java.util.List;
/** /**
* Created by davep on 2016-09-04. * 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 { public interface ClearingLogMapper {
@AutoSql(type = SqlType.INSERT) @AutoSql(type = SqlType.INSERT)

@ -5,6 +5,7 @@ import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType; import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -12,7 +13,7 @@ import java.util.List;
/** /**
* Created by yixian on 2016-09-19. * 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 { public interface ValidationLogMapper {
@AutoSql(type = SqlType.INSERT) @AutoSql(type = SqlType.INSERT)

@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
@ -16,7 +17,7 @@ import java.util.List;
/** /**
* Created by yixian on 2016-07-01. * 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 { public interface TransactionMapper {
@AutoSql(type = SqlType.INSERT) @AutoSql(type = SqlType.INSERT)
void save(JSONObject transaction); void save(JSONObject transaction);

@ -11,8 +11,9 @@ import java.util.List;
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper; import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql; import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType; 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 { public interface SysClientPreMapperMapper {
@AutoSql(type = SqlType.UPDATE) @AutoSql(type = SqlType.UPDATE)
void update(JSONObject data); void update(JSONObject data);

@ -11,7 +11,7 @@ import java.util.List;
/** /**
* Created by yishuqian on 04/01/2017. * 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 { public interface ActBlackListMapper {
@AutoSql(type = SqlType.INSERT) @AutoSql(type = SqlType.INSERT)
void save(JSONObject blackObj); 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 cn.yixblog.support.mybatis.autosql.annotations.SqlType;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator;
import java.util.List; import java.util.List;
/** /**
* Created by davep on 2016-08-16. * 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 { public interface ClientBankAccountMapper {
@AutoSql(type = SqlType.SELECT) @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 com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -17,7 +18,7 @@ import java.util.List;
/** /**
* Created by yixian on 2016-06-25. * 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 { public interface ClientMapper {
@AutoSql(type = SqlType.SELECT) @AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid=1") @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 cn.yixblog.support.mybatis.autosql.annotations.SqlType;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -12,7 +13,7 @@ import java.util.List;
/** /**
* Created by davep on 2016-08-16. * 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 { public interface ClientRateMapper {
List<JSONObject> listCurrentClientRates(@Param("client_id") int clientId, @Param("date") Date date, @Param("rate_name") String rateName); 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 cn.yixblog.support.mybatis.autosql.annotations.SqlType;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator;
/** /**
* Created by davep on 2016-08-03. * 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 { public interface CustomerMapper {
@AutoSql(type = SqlType.INSERT) @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.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator;
import java.util.List; import java.util.List;
/** /**
* Created by yixian on 2016-10-18. * 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 { public interface OrgMapper {
@AutoSql(type = SqlType.SELECT) @AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "type != 1") @AdvanceSelect(addonWhereClause = "type != 1")

@ -1,20 +1,18 @@
package au.com.royalpay.payment.manage.mappers.system; 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.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql; import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType; 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. * 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 { public interface PermissionPartnerModuleMapper {
@AutoSql(type = SqlType.INSERT) @AutoSql(type = SqlType.INSERT)
void save(JSONObject module); 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 cn.yixblog.support.mybatis.autosql.annotations.SqlType;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator;
import java.util.List; import java.util.List;
/** /**
* Created by yishuqian on 11/11/2016. * 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 { public interface ReportConfigMapper {
@AutoSql(type = SqlType.UPDATE) @AutoSql(type = SqlType.UPDATE)
void update(JSONObject jsonObject); 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.PaymentChannelApi;
import au.com.royalpay.payment.core.exceptions.EmailException; import au.com.royalpay.payment.core.exceptions.EmailException;
import au.com.royalpay.payment.core.exceptions.InvalidShortIdException; 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.core.utils.OrderExpiryRuleResolver;
import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper; import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper;
import au.com.royalpay.payment.manage.appclient.beans.AppClientBean; 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.device.core.DeviceManager;
import au.com.royalpay.payment.manage.management.sysconfig.core.impls.PermissionPartnerManagerImpl; 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.financial.FinancialBDConfigMapper;
import au.com.royalpay.payment.manage.mappers.log.ClearingDetailMapper; import au.com.royalpay.payment.manage.mappers.log.*;
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.payment.TransactionMapper; 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.redpack.ActClientInvitationCodeMapper;
import au.com.royalpay.payment.manage.mappers.risk.RiskAttentionMerchantsMapper; import au.com.royalpay.payment.manage.mappers.risk.RiskAttentionMerchantsMapper;
import au.com.royalpay.payment.manage.mappers.system.*; 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.*;
import au.com.royalpay.payment.manage.merchants.beans.BankAccountInfo; import au.com.royalpay.payment.manage.merchants.core.*;
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.entity.impls.*; import au.com.royalpay.payment.manage.merchants.entity.impls.*;
import au.com.royalpay.payment.manage.notice.core.MailService; import au.com.royalpay.payment.manage.notice.core.MailService;
import au.com.royalpay.payment.manage.signin.beans.TodoNotice; 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.locale.LocaleSupport;
import au.com.royalpay.payment.tools.lock.Locker; import au.com.royalpay.payment.tools.lock.Locker;
import au.com.royalpay.payment.tools.mail.SendMail; 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.QRCodeConfig;
import au.com.royalpay.payment.tools.merchants.beans.UpdateSurchargeDTO; import au.com.royalpay.payment.tools.merchants.beans.UpdateSurchargeDTO;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; 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.merchants.qrboard.QRBoardProvider;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.permission.enums.PartnerRole; import au.com.royalpay.payment.tools.permission.enums.PartnerRole;
import au.com.royalpay.payment.tools.utils.ImageUtils; import au.com.royalpay.payment.tools.utils.*;
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.websocket.notify.PartnerPageEvent; 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.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.github.miemiedev.mybatis.paginator.domain.PageList;
import com.yeepay.yop.sdk.service.kj.model.SubmerchantRegisterResult; 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.io.IOUtils;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils; 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.dom4j.Element;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -124,6 +100,13 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.thymeleaf.context.Context; import org.thymeleaf.context.Context;
import org.thymeleaf.spring4.SpringTemplateEngine; 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.*;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.*; import java.io.*;
@ -131,34 +114,18 @@ import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.net.URL; import java.net.URL;
import java.net.URLEncoder; import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException; import java.security.InvalidKeyException;
import java.security.InvalidParameterException; import java.security.InvalidParameterException;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom; import java.security.SecureRandom;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.List; import java.util.List;
import java.util.*;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; 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; 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(); byte[] enCodeFormat = secretKey.getEncoded();
SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES"); SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES");
Cipher cipher = Cipher.getInstance("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); cipher.init(Cipher.ENCRYPT_MODE, key);
byte[] result = cipher.doFinal(byteContent); byte[] result = cipher.doFinal(byteContent);
return Base64.encodeBase64String(result); return Base64.encodeBase64String(result);
} catch (NoSuchPaddingException e) { } catch (NoSuchPaddingException | NoSuchAlgorithmException | InvalidKeyException | IllegalBlockSizeException | BadPaddingException 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) {
e.printStackTrace(); e.printStackTrace();
} }
return null; return null;

@ -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.core.exceptions.InvalidShortIdException;
import au.com.royalpay.payment.manage.device.core.DeviceManager; 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.management.sysconfig.core.PermissionManager;
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper; import au.com.royalpay.payment.manage.mappers.system.*;
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.merchants.core.ClientConfigService; import au.com.royalpay.payment.manage.merchants.core.ClientConfigService;
import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.notice.core.MailService; import au.com.royalpay.payment.manage.notice.core.MailService;
@ -29,10 +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.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.threadpool.RoyalThreadPoolExecutor; import au.com.royalpay.payment.tools.threadpool.RoyalThreadPoolExecutor;
import au.com.royalpay.payment.tools.utils.PasswordUtils; import au.com.royalpay.payment.tools.utils.PasswordUtils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.sun.xml.internal.bind.v2.TODO;
import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.lang3.time.DateUtils;
@ -44,19 +37,17 @@ import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.web.servlet.ModelAndView;
import org.thymeleaf.context.Context; import org.thymeleaf.context.Context;
import org.thymeleaf.spring4.SpringTemplateEngine; import org.thymeleaf.spring4.SpringTemplateEngine;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit; 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. * account service for sign in Created by yixian on 2016-06-29.
*/ */

@ -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='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.total,0)),0) wechat_toatl,
ifnull(sum(if(s.channel='Wechat',s.orders,0)),0) wechat_order ifnull(sum(if(s.channel='Wechat',s.orders,0)),0) wechat_order
FROM statistics_customer_order s FROM sys_clients c
RIGHT JOIN sys_clients c ON c.client_id = s.client_id and c.is_valid=1 ]]>
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"> <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 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 date(d.start_date)&lt;= #{begin} and (d.end_date is null or date(d.end_date)&gt;= #{end}) and
d.is_valid=1 d.is_valid=1
</if> </if>
<where> where c.is_valid=1
<if test="begin!=null">and s.date &gt;= #{begin}</if>
<if test="end!=null">and s.date &lt; #{end}</if>
<if test="org_id!=null">and c.org_id = #{org_id}</if> <if test="org_id!=null">and c.org_id = #{org_id}</if>
<if test="state!=null">and c.state = #{state}</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_id!=null and org_ids==null">and c.org_id=#{org_id}</if>
@ -422,8 +455,6 @@
#{client_moniker} #{client_moniker}
</foreach> </foreach>
</if> </if>
</where>
GROUP BY s.client_id ORDER BY total DESC
</select> </select>

@ -234,6 +234,36 @@
GROUP BY o.customer_id GROUP BY o.customer_id
</select> </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 id="listCustomersDataAnalysis" resultType="com.alibaba.fastjson.JSONObject">
SELECT sum(if(o.status='5',o.customer_payment_amount,0)) total_amount SELECT sum(if(o.status='5',o.customer_payment_amount,0)) total_amount
FROM pmt_orders o FROM pmt_orders o

@ -13,7 +13,8 @@
<select id="getEarliestOrder" resultType="com.alibaba.fastjson.JSONObject"> <select id="getEarliestOrder" resultType="com.alibaba.fastjson.JSONObject">
SELECT * SELECT *
FROM pmt_transactions 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 ORDER BY transaction_time
LIMIT 1; LIMIT 1;
</select> </select>
@ -55,7 +56,8 @@
</if> </if>
<if test="org_id!=null and org_ids==null">and l.org_id=#{org_id}</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 <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>
<select id="analysisTotalAmount" resultType="java.math.BigDecimal"> <select id="analysisTotalAmount" resultType="java.math.BigDecimal">
@ -77,7 +79,8 @@
</if> </if>
<if test="org_id!=null and org_ids==null">and l.org_id=#{org_id}</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 <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>
<select id="analysisTotalCount" resultType="java.lang.Double"> <select id="analysisTotalCount" resultType="java.lang.Double">
@ -184,7 +187,8 @@
</if> </if>
<if test="org_id!=null and org_ids==null">and o.org_id=#{org_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 <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[ <![CDATA[
GROUP BY o.order_id ORDER BY aud_fee DESC limit 1 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="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_id!=null and org_ids==null">and l.org_id=#{org_id}</if>
<if test="org_ids!=null">and l.org_id in <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 GROUP BY gateway_label
</select> </select>
@ -274,7 +279,8 @@
</if> </if>
<if test="org_id!=null and org_ids==null">and l.org_id=#{org_id}</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 <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 <if test="bd_group!=null">and l.client_id in
(SELECT b.client_id FROM sys_client_bd b (SELECT b.client_id FROM sys_client_bd b
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id
@ -311,7 +317,8 @@
</if> </if>
<if test="org_id!=null and org_ids==null">and l.org_id=#{org_id}</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 <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[ <![CDATA[
GROUP BY date(o.create_time) GROUP BY date(o.create_time)
ORDER BY date(o.create_time) ORDER BY date(o.create_time)
@ -339,7 +346,8 @@
</if> </if>
<if test="org_id!=null and org_ids==null">and l.org_id=#{org_id}</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 <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>
<select id="countCustomers" resultType="java.lang.Integer"> <select id="countCustomers" resultType="java.lang.Integer">
<![CDATA[ <![CDATA[
@ -360,7 +368,8 @@
</if> </if>
<if test="org_id!=null and org_ids==null">and o.org_id=#{org_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 <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[ <![CDATA[
GROUP BY o.customer_id) p GROUP BY o.customer_id) p
]]> ]]>
@ -385,8 +394,9 @@
</if> </if>
<if test="org_id!=null and org_ids==null">and t.org_id=#{org_id}</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 <if test="org_ids!=null">and t.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 test="channel !=null"> and o.channel = #{channel}</if> </if>
<if test="channel !=null">and o.channel = #{channel}</if>
<![CDATA[ <![CDATA[
GROUP BY o.customer_id) p 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 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>
<if test="org_id!=null and org_ids==null">and t.org_id=#{org_id}</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 <if test="org_ids!=null">and t.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 test="channel !=null"> and o.channel = #{channel}</if> </if>
<if test="channel !=null">and o.channel = #{channel}</if>
<![CDATA[ <![CDATA[
GROUP BY o.customer_id) p 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 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"> <select id="getCountCustomers" resultType="java.lang.Integer">
<![CDATA[ <![CDATA[
SELECT count(DISTINCT o.customer_id) FROM pmt_orders o where SELECT count(DISTINCT o.customer_id)
o.create_time < #{date} and o.status>=5 FROM pmt_orders o
]]> where o.create_time < #{date}
and o.status >= 5
]]>
</select> </select>
<select id="getTradePartnersInTypes" resultType="com.alibaba.fastjson.JSONObject"> <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_id!=null and org_ids==null">and l.org_id=#{org_id}</if>
<if test="org_ids!=null">and l.org_id in <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 <if test="bd_group!=null">and l.client_id in
(SELECT b.client_id FROM sys_client_bd b (SELECT b.client_id FROM sys_client_bd b
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id
@ -558,7 +572,8 @@
</if> </if>
<if test="org_id!=null and org_ids==null">and l.org_id=#{org_id}</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 <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 <if test="bd_group!=null">and l.client_id in
(SELECT b.client_id FROM sys_client_bd b (SELECT b.client_id FROM sys_client_bd b
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id
@ -650,18 +665,19 @@
</if> </if>
<if test="org_id!=null and org_ids==null">and ptran.org_id=#{org_id}</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 <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>
<select id="listExchangeRates" resultType="com.alibaba.fastjson.JSONObject"> <select id="listExchangeRates" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[ <![CDATA[
SELECT max(t.transaction_time) mx,t.exchange_rate,date(t.transaction_time) `date` SELECT max(t.transaction_time) mx, t.exchange_rate, date(t.transaction_time) `date`
FROM FROM pmt_transactions t
pmt_transactions t WHERE date(t.transaction_time) >= #{begin}
WHERE date(t.transaction_time) >= #{begin} And date(t.transaction_time) <= #{end} AND And date(t.transaction_time) <= #{end}
t.transaction_type ='Credit' AND t.channel =#{channel} AND t.transaction_type = 'Credit'
GROUP BY AND t.channel = #{channel}
date(t.transaction_time) GROUP BY date(t.transaction_time)
order by `date` asc order by `date` asc
]]> ]]>
</select> </select>
@ -693,8 +709,9 @@
</if> </if>
<if test="org_id!=null and org_ids==null">and o.org_id=#{org_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 <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>
GROUP BY date , channel ORDER BY date DESC </if>
GROUP BY date , channel ORDER BY date DESC
</select> </select>
<select id="getOrgTransactionAnalysis" resultType="com.alibaba.fastjson.JSONObject"> <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="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_id!=null and org_ids==null">and o.org_id=#{org_id}</if>
<if test="org_ids!=null">and o.org_id in <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 GROUP BY o.org_id order by amount desc
</select> </select>
@ -749,7 +767,8 @@
<if test="channel!=null">and o.channel=#{channel}</if> <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_id!=null and org_ids==null">and l.org_id=#{org_id}</if>
<if test="org_ids!=null">and l.org_id in <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>
<select id="countAmountRangeAnalysis" resultType="java.lang.Integer"> <select id="countAmountRangeAnalysis" resultType="java.lang.Integer">
@ -766,7 +785,8 @@
<select id="listAmountRangeOrders" resultType="com.alibaba.fastjson.JSONObject"> <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 FROM pmt_transactions t
LEFT JOIN pmt_orders o on o.order_id=t.order_id LEFT JOIN pmt_orders o on o.order_id=t.order_id
INNER JOIN sys_clients c on c.client_id = t.client_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_from!=null">and t.clearing_amount &gt;= #{amount_from}</if>
<if test="amount_to!=null">and t.clearing_amount &lt; #{amount_to}</if> <if test="amount_to!=null">and t.clearing_amount &lt; #{amount_to}</if>
</select> </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 id="getClientTransaction" resultType="com.alibaba.fastjson.JSONObject">
SELECT SELECT
IFNULL(sum(if(l.transaction_type='Credit',l.clearing_amount,0)),0) trade_amount, 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='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='Credit',1,0)),0) trade_count,
IFNULL(sum(if(l.transaction_type='Debit',1,0)),0) refund_orders IFNULL(sum(if(l.transaction_type='Debit',1,0)),0) refund_orders
FROM pmt_transactions l FROM pmt_transactions l
where l.channel!='Settlement' and l.system_generate=0 where l.channel!='Settlement' and l.system_generate=0
<if test="client_ids!=null"> <if test="client_ids!=null">
AND l.client_id IN AND l.client_id IN
<foreach collection="client_ids" open="(" close=")" separator="," item="client_id"> <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="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_id!=null and org_ids==null">and l.org_id=#{org_id}</if>
<if test="org_ids!=null">and l.org_id in <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>
<select id="getAreaMerchantAmountAnalysis" resultType="com.alibaba.fastjson.JSONObject"> <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, 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, c.suburb,c.state,c.royalpayindustry,sum(if(t.channel='Alipay' OR t.channel='AlipayOnline',t.clearing_amount,0))
sum(if(t.channel='Alipay'OR t.channel='AlipayOnline',1,0)) alipay_order,sum(if(t.channel='Wechat',t.clearing_amount,0)) wechat_toatl, 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 sum(if(t.channel='Wechat',1,0)) wechat_order
FROM pmt_transactions t FROM sys_clients c
INNER JOIN pmt_orders ord on ord.order_id = t.order_id LEFT JOIN (select
RIGHT JOIN sys_clients c on t.client_id = c.client_id and c.is_valid = 1 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"> <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 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 date(d.start_date)&lt;= #{begin} and (d.end_date is null or date(d.end_date)&gt;= #{end}) and
d.is_valid=1 d.is_valid=1
</if> </if>
where (t.transaction_type = 'Credit') where (c.is_valid = 1 )
<if test="begin!=null">and t.transaction_time &gt;= #{begin}</if>
<if test="end!=null">and t.transaction_time &lt;= #{end}</if>
<if test="state!=null">and c.state &lt;= #{state}</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_id!=null and org_ids==null">and c.org_id=#{org_id}</if>
<if test="org_ids!=null">and c.org_id in <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"> <if test="client_monikers!=null">
AND c.client_moniker IN AND c.client_moniker IN
<foreach collection="client_monikers" open="(" close=")" separator="," item="client_moniker"> <foreach collection="client_monikers" open="(" close=")" separator="," item="client_moniker">
@ -858,6 +899,29 @@
GROUP BY c.client_id order by total desc GROUP BY c.client_id order by total desc
</select> </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 id="getAreaMerchantAmountByCycle" resultType="com.alibaba.fastjson.JSONObject">
SELECT c.client_moniker,sum(if(t.transaction_type='Credit',t.clearing_amount,0)) old_total, 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 RIGHT JOIN sys_clients c on t.client_id = c.client_id and c.is_valid = 1
<if test="bd_user!=null"> <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 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 d.is_valid=1
</if> </if>
where (t.transaction_type = 'Credit') 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="end!=null">and t.transaction_time &lt;= #{begin}</if>
<if test="state!=null">and c.state &lt;= #{state}</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_id!=null and org_ids==null">and c.org_id=#{org_id}</if>
<if test="org_ids!=null">and c.org_id in <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"> <if test="client_monikers!=null">
AND c.client_moniker IN AND c.client_moniker IN
<foreach collection="client_monikers" open="(" close=")" separator="," item="client_moniker"> <foreach collection="client_monikers" open="(" close=")" separator="," item="client_moniker">
@ -888,9 +956,9 @@
</select> </select>
<select id="getOrderClearAmount" resultType="com.alibaba.fastjson.JSONObject"> <select id="getOrderClearAmount" resultType="com.alibaba.fastjson.JSONObject">
SELECT clearing_amount,o.client_id SELECT clearing_amount, o.client_id
FROM pmt_orders o 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} WHERE o.order_id = #{order_id}
LIMIT 1; LIMIT 1;
</select> </select>

@ -273,13 +273,12 @@
<select id="listPreRefundClients" resultType="com.alibaba.fastjson.JSONObject"> <select id="listPreRefundClients" resultType="com.alibaba.fastjson.JSONObject">
SELECT * SELECT *
FROM (SELECT ifnull(sum(if(transaction_type = 'Credit', clearing_amount, -clearing_amount)), 0) amount, FROM (SELECT ifnull(sum(if(transaction_type = 'Credit', clearing_amount, -clearing_amount)), 0) amount,
c.client_id client_id, cc.client_id client_id,
max(t.transaction_time) transation_time, max(t.transaction_time) transation_time,
c.client_moniker client_moniker cc.client_moniker client_moniker
FROM pmt_transactions t 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 = t.client_id AND cc.enable_refund_auth = 1
INNER JOIN sys_client_config cc on cc.client_id = c.client_id AND cc.enable_refund_auth = 1 GROUP BY cc.client_id) a
GROUP BY c.client_id) a
WHERE a.amount &lt; 0 WHERE a.amount &lt; 0
</select> </select>
<select id="validAnalysis" resultType="com.alibaba.fastjson.JSONObject"> <select id="validAnalysis" resultType="com.alibaba.fastjson.JSONObject">

Loading…
Cancel
Save