Merge branch 'stable-beforeaps' into develop

# Conflicts:
#	pom.xml
#	src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java
#	src/main/java/au/com/royalpay/payment/manage/citypartner/core/impls/CityPartnerPrizeServiceImpl.java
#	src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java
#	src/main/ui/static/payment/partner/partner-manage.js
master
Yixian 4 years ago
commit 4e20c19b79

@ -39,8 +39,8 @@ import java.util.concurrent.TimeUnit;
* Created by davep on 2016-07-28. * Created by davep on 2016-07-28.
*/ */
@Service @Service
public class DashboardServiceImpl implements DashboardService,DashboardAnalysisTask { public class DashboardServiceImpl implements DashboardService, DashboardAnalysisTask {
private Logger logger = LoggerFactory.getLogger(getClass()); private final Logger logger = LoggerFactory.getLogger(getClass());
@Resource @Resource
private ClientAnalysisMapper clientAnalysisMapper; private ClientAnalysisMapper clientAnalysisMapper;
@Resource @Resource
@ -64,25 +64,24 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
private MerchantInfoProvider merchantInfoProvider; private MerchantInfoProvider merchantInfoProvider;
@Override @Override
public JSONObject getCommonAnalysis1(JSONObject params) { public JSONObject getCommonAnalysis1(JSONObject params) {
String jsonStr = stringRedisTemplate.boundValueOps("org_commonAnalysis1" + params.getString("org_id") + params.getString("begin")).get(); String jsonStr = stringRedisTemplate.boundValueOps("org_commonAnalysis1" + params.getString("org_id") + params.getString("begin")).get();
JSONObject commonAnalysis1 = JSON.parseObject(jsonStr); JSONObject commonAnalysis1 = JSON.parseObject(jsonStr);
if(commonAnalysis1 != null){ if (commonAnalysis1 != null) {
return commonAnalysis1; return commonAnalysis1;
} }
JSONObject res = new JSONObject(); JSONObject res = new JSONObject();
if(params.getDate("end").after(new Date())){ if (params.getDate("end").after(new Date())) {
if(params.getDate("begin").compareTo(DateUtils.addDays(params.getDate("end"), -1))==0){ if (params.getDate("begin").compareTo(DateUtils.addDays(params.getDate("end"), -1)) == 0) {
res = transactionAnalysisMapper.getClientTransaction(params); res = transactionAnalysisMapper.getClientTransaction(params);
}else { } else {
res = customerAndOrdersStatisticsMapper.getCommonCount(params); res = customerAndOrdersStatisticsMapper.getCommonCount(params);
} }
}else { } else {
res = customerAndOrdersStatisticsMapper.getCommonCount(params); res = customerAndOrdersStatisticsMapper.getCommonCount(params);
} }
stringRedisTemplate.boundValueOps("org_commonAnalysis1"+params.getString("org_id")+params.getString("begin")).set(res.toJSONString(), 5, TimeUnit.MINUTES); stringRedisTemplate.boundValueOps("org_commonAnalysis1" + params.getString("org_id") + params.getString("begin")).set(res.toJSONString(), 5, TimeUnit.MINUTES);
return res; return res;
} }
@ -91,7 +90,7 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
public JSONObject getCommonAnalysis3(JSONObject params) { public JSONObject getCommonAnalysis3(JSONObject params) {
String jsonStr = stringRedisTemplate.boundValueOps("org_commonAnalysis3" + params.getString("org_id") + params.getString("begin")).get(); String jsonStr = stringRedisTemplate.boundValueOps("org_commonAnalysis3" + params.getString("org_id") + params.getString("begin")).get();
JSONObject commonAnalysis3 = JSON.parseObject(jsonStr); JSONObject commonAnalysis3 = JSON.parseObject(jsonStr);
if(commonAnalysis3 != null){ if (commonAnalysis3 != null) {
return commonAnalysis3; return commonAnalysis3;
} }
JSONObject res = new JSONObject(); JSONObject res = new JSONObject();
@ -100,7 +99,7 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
//res.put("total_partners", clientAnalysisMapper.countClients(params)); //res.put("total_partners", clientAnalysisMapper.countClients(params));
// 统计所有的商户,包括禁用的 // 统计所有的商户,包括禁用的
res.put("total_partners", clientAnalysisMapper.countClientsAll(params)); res.put("total_partners", clientAnalysisMapper.countClientsAll(params));
stringRedisTemplate.boundValueOps("org_commonAnalysis3"+params.getString("org_id")+params.getString("begin")).set(res.toJSONString(), 5, TimeUnit.MINUTES); stringRedisTemplate.boundValueOps("org_commonAnalysis3" + params.getString("org_id") + params.getString("begin")).set(res.toJSONString(), 5, TimeUnit.MINUTES);
return res; return res;
} }
@ -108,25 +107,25 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
public JSONObject getCommonAnalysis2(JSONObject params) { public JSONObject getCommonAnalysis2(JSONObject params) {
String jsonStr = stringRedisTemplate.boundValueOps("org_commonAnalysis2" + params.getString("org_id") + params.getString("begin")).get(); String jsonStr = stringRedisTemplate.boundValueOps("org_commonAnalysis2" + params.getString("org_id") + params.getString("begin")).get();
JSONObject commonAnalysis2 = JSON.parseObject(jsonStr); JSONObject commonAnalysis2 = JSON.parseObject(jsonStr);
if(commonAnalysis2 != null){ if (commonAnalysis2 != null) {
return commonAnalysis2; return commonAnalysis2;
} }
JSONObject res = new JSONObject(); JSONObject res = new JSONObject();
if(params.getDate("end").after(new Date())){ if (params.getDate("end").after(new Date())) {
if(params.getDate("begin").compareTo(DateUtils.addDays(params.getDate("end"), -1))==0){ if (params.getDate("begin").compareTo(DateUtils.addDays(params.getDate("end"), -1)) == 0) {
res.put("total_customers", transactionAnalysisMapper.countCustomers(params)); res.put("total_customers", transactionAnalysisMapper.countCustomers(params));
res.put("old_customers", transactionAnalysisMapper.countOldCustomers(params));
res.put("traded_partners", clientAnalysisMapper.countTradedPartners(params)); res.put("traded_partners", clientAnalysisMapper.countTradedPartners(params));
}else { } else {
res = getYesOrLasMonth(params); res = getYesOrLasMonth(params);
} }
}else { } else {
res = getYesOrLasMonth(params); res = getYesOrLasMonth(params);
} }
stringRedisTemplate.boundValueOps("org_commonAnalysis2"+params.getString("org_id")+params.getString("begin")).set(res.toJSONString(), 5, TimeUnit.MINUTES); stringRedisTemplate.boundValueOps("org_commonAnalysis2" + params.getString("org_id") + params.getString("begin")).set(res.toJSONString(), 5, TimeUnit.MINUTES);
return res; return res;
} }
private JSONObject getYesOrLasMonth(JSONObject params){
private JSONObject getYesOrLasMonth(JSONObject params) {
JSONObject res = new JSONObject(); JSONObject res = new JSONObject();
res.put("traded_partners", customerAndOrdersStatisticsMapper.countTradedClients(params)); res.put("traded_partners", customerAndOrdersStatisticsMapper.countTradedClients(params));
res.put("total_customers", customerAndOrdersStatisticsMapper.countTotalCustomers(params)); res.put("total_customers", customerAndOrdersStatisticsMapper.countTotalCustomers(params));
@ -138,7 +137,7 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
public JSONObject getCommonAnalysis4(JSONObject params) { public JSONObject getCommonAnalysis4(JSONObject params) {
String jsonStr = stringRedisTemplate.boundValueOps("org_commonAnalysis4" + params.getString("org_id") + params.getString("begin")).get(); String jsonStr = stringRedisTemplate.boundValueOps("org_commonAnalysis4" + params.getString("org_id") + params.getString("begin")).get();
JSONObject commonAnalysis4 = JSON.parseObject(jsonStr); JSONObject commonAnalysis4 = JSON.parseObject(jsonStr);
if(commonAnalysis4 != null){ if (commonAnalysis4 != null) {
return commonAnalysis4; return commonAnalysis4;
} }
JSONObject res = new JSONObject(); JSONObject res = new JSONObject();
@ -146,22 +145,22 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
if (!topOrders.isEmpty()) { if (!topOrders.isEmpty()) {
res.put("top_amount_order", topOrders.get(0)); res.put("top_amount_order", topOrders.get(0));
} }
stringRedisTemplate.boundValueOps("org_commonAnalysis4"+params.getString("org_id")+params.getString("begin")).set(res.toJSONString(), 5, TimeUnit.MINUTES); stringRedisTemplate.boundValueOps("org_commonAnalysis4" + params.getString("org_id") + params.getString("begin")).set(res.toJSONString(), 5, TimeUnit.MINUTES);
return res; return res;
} }
@Override @Override
public List<JSONObject> getTradeInTypes(JSONObject params) { public List<JSONObject> getTradeInTypes(JSONObject params) {
String jsonStr = stringRedisTemplate.boundValueOps("tradeInTypes"+params.getString("org_id")+ params.getString("begin")).get(); String jsonStr = stringRedisTemplate.boundValueOps("tradeInTypes" + params.getString("org_id") + params.getString("begin")).get();
List<JSONObject> tradeInTypes = JSONObject.parseArray(jsonStr,JSONObject.class); List<JSONObject> tradeInTypes = JSONObject.parseArray(jsonStr, JSONObject.class);
if(tradeInTypes != null){ if (tradeInTypes != null) {
return tradeInTypes; return tradeInTypes;
} }
if (params.containsKey("client_id")) { if (params.containsKey("client_id")) {
clientManager.queryModifyClientIds(params.getInteger("client_id"), params); clientManager.queryModifyClientIds(params.getInteger("client_id"), params);
} }
List<JSONObject> res = transactionAnalysisMapper.getTradeAmountInTypes(params); List<JSONObject> res = transactionAnalysisMapper.getTradeAmountInTypes(params);
stringRedisTemplate.boundValueOps("tradeInTypes"+params.getString("org_id")+ params.getString("begin")).set(res.toString(), 5, TimeUnit.MINUTES); stringRedisTemplate.boundValueOps("tradeInTypes" + params.getString("org_id") + params.getString("begin")).set(res.toString(), 5, TimeUnit.MINUTES);
return res; return res;
} }
@ -175,14 +174,14 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
@Override @Override
public List<JSONObject> getTopTradePartnersNew(JSONObject params) { public List<JSONObject> getTopTradePartnersNew(JSONObject params) {
String jsonStr = stringRedisTemplate.boundValueOps("topTradePartnersNew"+params.getString("org_id")+ params.getString("begin")).get(); String jsonStr = stringRedisTemplate.boundValueOps("topTradePartnersNew" + params.getString("org_id") + params.getString("begin")).get();
List<JSONObject> topTradePartnersNew = JSONObject.parseArray(jsonStr,JSONObject.class); List<JSONObject> topTradePartnersNew = JSONObject.parseArray(jsonStr, JSONObject.class);
if(topTradePartnersNew != null){ if (topTradePartnersNew != null) {
return topTradePartnersNew; return topTradePartnersNew;
} }
params.putIfAbsent("rankType", "aud_fee"); params.putIfAbsent("rankType", "aud_fee");
List<JSONObject> res = clientAnalysisMapper.listPartnersTradeAmountNew(params); List<JSONObject> res = clientAnalysisMapper.listPartnersTradeAmountNew(params);
stringRedisTemplate.boundValueOps("topTradePartnersNew"+params.getString("org_id")+ params.getString("begin")).set(res.toString(), 5, TimeUnit.MINUTES); stringRedisTemplate.boundValueOps("topTradePartnersNew" + params.getString("org_id") + params.getString("begin")).set(res.toString(), 5, TimeUnit.MINUTES);
return res; return res;
} }
@ -277,6 +276,7 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
analysis.add(wechatHtml5); analysis.add(wechatHtml5);
return analysis; return analysis;
} }
@Override @Override
public List<JSONObject> getPartnerTradeAnalysisInDays(JSONObject params) { public List<JSONObject> getPartnerTradeAnalysisInDays(JSONObject params) {
int date_range = Integer.parseInt(DurationFormatUtils.formatPeriod(params.getDate("begin").getTime(), params.getDate("end").getTime(), "dd")); int date_range = Integer.parseInt(DurationFormatUtils.formatPeriod(params.getDate("begin").getTime(), params.getDate("end").getTime(), "dd"));
@ -293,16 +293,16 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
@Override @Override
public List<JSONObject> getTradeAnalysisInDays(JSONObject params) { public List<JSONObject> getTradeAnalysisInDays(JSONObject params) {
String jsonStr = stringRedisTemplate.boundValueOps("tradeAnalysisInDays"+params.getString("org_id")+ params.getString("begin")).get(); String jsonStr = stringRedisTemplate.boundValueOps("tradeAnalysisInDays" + params.getString("org_id") + params.getString("begin")).get();
List<JSONObject> tradeAnalysisInDays = JSONObject.parseArray(jsonStr,JSONObject.class); List<JSONObject> tradeAnalysisInDays = JSONObject.parseArray(jsonStr, JSONObject.class);
if(tradeAnalysisInDays != null){ if (tradeAnalysisInDays != null) {
return tradeAnalysisInDays; return tradeAnalysisInDays;
} }
if (!params.containsKey("client_ids") && !params.containsKey("org_id")) { if (!params.containsKey("client_ids") && !params.containsKey("org_id")) {
params.put("client_id", 0); params.put("client_id", 0);
} }
List<JSONObject> res = customerAndOrdersStatisticsMapper.getSumCustomersAnalysis(params); List<JSONObject> res = customerAndOrdersStatisticsMapper.getSumCustomersAnalysis(params);
stringRedisTemplate.boundValueOps("tradeAnalysisInDays"+params.getString("org_id")+ params.getString("begin")).set(res.toString(), 5, TimeUnit.MINUTES); stringRedisTemplate.boundValueOps("tradeAnalysisInDays" + params.getString("org_id") + params.getString("begin")).set(res.toString(), 5, TimeUnit.MINUTES);
return res; return res;
} }
@ -330,11 +330,11 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
params.put("client_id", partner.getIntValue("client_id")); params.put("client_id", partner.getIntValue("client_id"));
clientManager.queryModifyClientIds(partner.getIntValue("client_id"), params); clientManager.queryModifyClientIds(partner.getIntValue("client_id"), params);
JSONObject today = getTransJSONO(params); JSONObject today = getTransJSONO(params);
params.put("begin",DateUtils.addDays(params.getDate("begin"),-1)); params.put("begin", DateUtils.addDays(params.getDate("begin"), -1));
params.put("end",DateUtils.addDays(params.getDate("end"),-1)); params.put("end", DateUtils.addDays(params.getDate("end"), -1));
JSONObject yes = getTransJSONO(params); JSONObject yes = getTransJSONO(params);
res.put("today",today); res.put("today", today);
res.put("yes",yes); res.put("yes", yes);
// res.put("not_settled", new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params))); // res.put("not_settled", new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params)));
// params.put("channel", "system"); // params.put("channel", "system");
// res.put("sys_not_settled", new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params))); // res.put("sys_not_settled", new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params)));
@ -342,18 +342,19 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
// res.put("rpaypmt_card_not_settled", new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params))); // res.put("rpaypmt_card_not_settled", new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params)));
// params.put("channel", "rpaypmt_dd"); // params.put("channel", "rpaypmt_dd");
// res.put("rpaypmt_dd_not_settled", new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params))); // res.put("rpaypmt_dd_not_settled", new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params)));
res.put("trade_amount_rise",yes.getBigDecimal("trade_amount").compareTo(BigDecimal.ZERO)>0 ? (today.getBigDecimal("trade_amount").subtract(yes.getBigDecimal("trade_amount"))).divide(yes.getBigDecimal("trade_amount"), 4, RoundingMode.HALF_UP):BigDecimal.ZERO); res.put("trade_amount_rise", yes.getBigDecimal("trade_amount").compareTo(BigDecimal.ZERO) > 0 ? (today.getBigDecimal("trade_amount").subtract(yes.getBigDecimal("trade_amount"))).divide(yes.getBigDecimal("trade_amount"), 4, RoundingMode.HALF_UP) : BigDecimal.ZERO);
res.put("trade_count_rise", yes.getIntValue("trade_count") > 0 ? (today.getBigDecimal("trade_count").subtract(yes.getBigDecimal("trade_count"))).divide(yes.getBigDecimal("trade_count"), 4, RoundingMode.HALF_UP) : 0); res.put("trade_count_rise", yes.getIntValue("trade_count") > 0 ? (today.getBigDecimal("trade_count").subtract(yes.getBigDecimal("trade_count"))).divide(yes.getBigDecimal("trade_count"), 4, RoundingMode.HALF_UP) : 0);
res.put("customers_rise", yes.getIntValue("customers") > 0 ? (today.getBigDecimal("customers").subtract(yes.getBigDecimal("customers"))).divide(yes.getBigDecimal("customers"), 4, RoundingMode.HALF_UP) : 0); res.put("customers_rise", yes.getIntValue("customers") > 0 ? (today.getBigDecimal("customers").subtract(yes.getBigDecimal("customers"))).divide(yes.getBigDecimal("customers"), 4, RoundingMode.HALF_UP) : 0);
params.remove("begin"); params.remove("begin");
params.remove("end"); params.remove("end");
List<JSONObject> logs = transactionMapper.listSettlementLogTotal(params); List<JSONObject> logs = transactionMapper.listSettlementLogTotal(params);
res.put("latest_settle",logs.isEmpty()?BigDecimal.ZERO:logs.get(0).getBigDecimal("income")); res.put("latest_settle", logs.isEmpty() ? BigDecimal.ZERO : logs.get(0).getBigDecimal("income"));
return res; return res;
} }
/** /**
* *
*
* @param partner * @param partner
* @param partnerAnalysisBean * @param partnerAnalysisBean
* @return * @return
@ -374,16 +375,17 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
params.put("hide_sub_mch", mchConfig.getBooleanValue("hide_sub_mch")); params.put("hide_sub_mch", mchConfig.getBooleanValue("hide_sub_mch"));
params.put("client_id", partner.getIntValue("client_id")); params.put("client_id", partner.getIntValue("client_id"));
clientManager.queryModifyClientIds(partner.getIntValue("client_id"), params); clientManager.queryModifyClientIds(partner.getIntValue("client_id"), params);
params.put("begin",DateUtils.addDays(params.getDate("begin"),-1)); params.put("begin", DateUtils.addDays(params.getDate("begin"), -1));
params.put("end",DateUtils.addDays(params.getDate("end"),-1)); params.put("end", DateUtils.addDays(params.getDate("end"), -1));
String key="not_settled"; String key = "not_settled";
if(StringUtils.isNotEmpty(params.getString("channel"))){ if (StringUtils.isNotEmpty(params.getString("channel"))) {
key=params.getString("channel")+"_not_settled"; key = params.getString("channel") + "_not_settled";
} }
res.put(key, new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params))); res.put(key, new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params)));
return res; return res;
} }
private JSONObject getTransJSONO(JSONObject params){
private JSONObject getTransJSONO(JSONObject params) {
JSONObject res = new JSONObject(); JSONObject res = new JSONObject();
JSONObject object = transactionAnalysisMapper.getClientTransaction(params); JSONObject object = transactionAnalysisMapper.getClientTransaction(params);
res.put("trade_amount", object.getBigDecimal("trade_amount")); res.put("trade_amount", object.getBigDecimal("trade_amount"));
@ -391,6 +393,7 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
res.put("customers", transactionAnalysisMapper.countCustomers(params)); res.put("customers", transactionAnalysisMapper.countCustomers(params));
return res; return res;
} }
@Override @Override
public List<JSONObject> getTradeAnalysisInHours(JSONObject partner, AnalysisBean partnerAnalysisBean) { public List<JSONObject> getTradeAnalysisInHours(JSONObject partner, AnalysisBean partnerAnalysisBean) {
String timezone = partner.getJSONObject("client").getString("timezone"); String timezone = partner.getJSONObject("client").getString("timezone");
@ -446,22 +449,22 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
throw new ParamInvalidException("end", "error.payment.valid.invalid_time"); throw new ParamInvalidException("end", "error.payment.valid.invalid_time");
} }
List<JSONObject> listChannelRate = new ArrayList<>(); List<JSONObject> listChannelRate = new ArrayList<>();
Map<Date,JSONObject> exchangeRateMap = new TreeMap<>(); Map<Date, JSONObject> exchangeRateMap = new TreeMap<>();
String[] channels = {"Wechat","Alipay"}; String[] channels = {"Wechat", "Alipay"};
for (String channel:channels){ for (String channel : channels) {
channelsExchangeRate(beginDate, endDate, exchangeRateMap, channel); channelsExchangeRate(beginDate, endDate, exchangeRateMap, channel);
} }
for (Date date:exchangeRateMap.keySet()){ for (Date date : exchangeRateMap.keySet()) {
JSONObject total = exchangeRateMap.get(date); JSONObject total = exchangeRateMap.get(date);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd "); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd ");
String time = sdf.format(date); String time = sdf.format(date);
total.put("date",time); total.put("date", time);
for (String channel:channels){ for (String channel : channels) {
if(total.getJSONObject(channel)==null){ if (total.getJSONObject(channel) == null) {
JSONObject mockAnalysis = new JSONObject(); JSONObject mockAnalysis = new JSONObject();
mockAnalysis.put("exchange_rate",0); mockAnalysis.put("exchange_rate", 0);
mockAnalysis.put("date",time); mockAnalysis.put("date", time);
total.put(channel,mockAnalysis); total.put(channel, mockAnalysis);
} }
} }
listChannelRate.add(total); listChannelRate.add(total);
@ -469,17 +472,17 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
return listChannelRate; return listChannelRate;
} }
public void channelsExchangeRate(Date beginDate,Date endDate,Map<Date, JSONObject> exchangeRateMap, String channel){ public void channelsExchangeRate(Date beginDate, Date endDate, Map<Date, JSONObject> exchangeRateMap, String channel) {
List<JSONObject> channelRates = exchangeRateMapper.listExchangeRates(beginDate, endDate,channel); List<JSONObject> channelRates = exchangeRateMapper.listExchangeRates(beginDate, endDate, channel);
for (JSONObject analysisItem:channelRates){ for (JSONObject analysisItem : channelRates) {
Date date = analysisItem.getDate("date"); Date date = analysisItem.getDate("date");
JSONObject dataItem = exchangeRateMap.get(date); JSONObject dataItem = exchangeRateMap.get(date);
if(dataItem==null){ if (dataItem == null) {
dataItem = new JSONObject(); dataItem = new JSONObject();
exchangeRateMap.put(date,dataItem); exchangeRateMap.put(date, dataItem);
} }
dataItem.put(channel,analysisItem); dataItem.put(channel, analysisItem);
} }
} }
@ -502,16 +505,16 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
public JSONObject getNewRecord() { public JSONObject getNewRecord() {
String jsonStr = stringRedisTemplate.boundValueOps("newRecord").get(); String jsonStr = stringRedisTemplate.boundValueOps("newRecord").get();
JSONObject newRecord = JSON.parseObject(jsonStr); JSONObject newRecord = JSON.parseObject(jsonStr);
if(newRecord != null){ if (newRecord != null) {
return newRecord; return newRecord;
} }
JSONObject max_amount = customerAndOrdersStatisticsMapper.getMaxAmount(0); JSONObject max_amount = customerAndOrdersStatisticsMapper.getMaxAmount(0);
JSONObject max_orders = customerAndOrdersStatisticsMapper.getMaxOrders(0); JSONObject max_orders = customerAndOrdersStatisticsMapper.getMaxOrders(0);
JSONObject maxTransactionPartners = customerAndOrdersStatisticsMapper.getMaxTransactionPartners(); JSONObject maxTransactionPartners = customerAndOrdersStatisticsMapper.getMaxTransactionPartners();
JSONObject res = new JSONObject(); JSONObject res = new JSONObject();
res.put("max_amount",max_amount); res.put("max_amount", max_amount);
res.put("max_orders",max_orders); res.put("max_orders", max_orders);
res.put("max_transaction_partners",maxTransactionPartners); res.put("max_transaction_partners", maxTransactionPartners);
stringRedisTemplate.boundValueOps("newRecord").set(res.toJSONString(), 5, TimeUnit.MINUTES); stringRedisTemplate.boundValueOps("newRecord").set(res.toJSONString(), 5, TimeUnit.MINUTES);
return res; return res;
} }
@ -523,38 +526,43 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
} }
@Override @Override
public void generateCustomersAndOrdersStatistics(Date analysisDate){ public void generateCustomersAndOrdersStatistics(Date analysisDate) {
DateFormat format = new SimpleDateFormat("yyyyMMdd"); DateFormat format = new SimpleDateFormat("yyyyMMdd");
String date = format.format(analysisDate); String date = format.format(analysisDate);
List<JSONObject> clients =clientMapper.listClients(); List<JSONObject> clients = clientMapper.listClients();
for (JSONObject client:clients){ for (JSONObject client : clients) {
generateData(format, date, client); generateData(format, date, client);
} }
JSONObject totalObject = new JSONObject(); JSONObject totalObject = new JSONObject();
totalObject.put("client_id",0); totalObject.put("client_id", 0);
generateData(format,date,totalObject); generateData(format, date, totalObject);
logger.info("generate customer and orders statistics on {} done", date);
} }
/** /**
* *
*
* @param analysisDate * @param analysisDate
* @param clientId * @param clientId
*/ */
public void generateCustomersAndOrdersStatisticsByClientMoniker(Date analysisDate,String clientId){ public void generateCustomersAndOrdersStatisticsByClientMoniker(Date analysisDate, String clientId) {
DateFormat format = new SimpleDateFormat("yyyyMMdd"); DateFormat format = new SimpleDateFormat("yyyyMMdd");
String date = format.format(analysisDate); String date = format.format(analysisDate);
List<JSONObject> clients =clientMapper.listClients(); List<JSONObject> clients = clientMapper.listClients();
for (JSONObject client:clients){ for (JSONObject client : clients) {
if(client.getString("client_id").equals(clientId)){ if (client.getString("client_id").equals(clientId)) {
generateData(format, date, client); generateData(format, date, client);
} }
} }
} }
private void generateData(DateFormat format, String date, JSONObject client) { private void generateData(DateFormat format, String date, JSONObject client) {
if (client.getIntValue("client_id") == 0) {
logger.info("analysising platform customers data", new RuntimeException("debug exception"));
}
JSONObject params = new JSONObject(); JSONObject params = new JSONObject();
String timezone =client.getString("timezone"); String timezone = client.getString("timezone");
if (timezone!=null){ if (timezone != null) {
format.setTimeZone(TimeZone.getTimeZone(timezone)); format.setTimeZone(TimeZone.getTimeZone(timezone));
} }
try { try {
@ -563,17 +571,17 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
} catch (ParseException e) { } catch (ParseException e) {
throw new ParamInvalidException("date", "error.payment.valid.invalid_date_format"); throw new ParamInvalidException("date", "error.payment.valid.invalid_date_format");
} }
if (client.getIntValue("client_id")!=0){ if (client.getIntValue("client_id") != 0) {
params.put("client_id",client.getIntValue("client_id")); params.put("client_id", client.getIntValue("client_id"));
} }
List<JSONObject> records = transactionAnalysisMapper.getCustomersAndOrdersInDaysUseInScheduled(params); List<JSONObject> records = transactionAnalysisMapper.getCustomersAndOrdersInDaysUseInScheduled(params);
if (!records.isEmpty()){ if (!records.isEmpty()) {
JSONObject deleteParams = new JSONObject(); JSONObject deleteParams = new JSONObject();
deleteParams.put("begin",params.getDate("begin")); deleteParams.put("begin", params.getDate("begin"));
deleteParams.put("end",params.getDate("end")); deleteParams.put("end", params.getDate("end"));
deleteParams.put("client_id",params.getIntValue("client_id")); deleteParams.put("client_id", params.getIntValue("client_id"));
customerAndOrdersStatisticsMapper.delete(deleteParams); customerAndOrdersStatisticsMapper.delete(deleteParams);
for (JSONObject record:records){ for (JSONObject record : records) {
String sdate = format.format(record.getDate("date")); String sdate = format.format(record.getDate("date"));
try { try {
params.put("begin", format.parse(sdate)); params.put("begin", format.parse(sdate));
@ -581,17 +589,16 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
} catch (ParseException e) { } catch (ParseException e) {
throw new ParamInvalidException("date", "error.payment.valid.invalid_date_format"); throw new ParamInvalidException("date", "error.payment.valid.invalid_date_format");
} }
params.put("channel",record.getString("channel")); params.put("channel", record.getString("channel"));
int newCustomers = 0; int newCustomers = 0;
int oldCustomers = transactionAnalysisMapper.countOldCustomers(params); int oldCustomers=0;
if (client.getIntValue("client_id")==0){ if (client.getIntValue("client_id") != 0) {
newCustomers = record.getIntValue("customers")-oldCustomers; oldCustomers = transactionAnalysisMapper.countOldCustomers(params);
}else {
newCustomers = transactionAnalysisMapper.countNewCustomers(params); newCustomers = transactionAnalysisMapper.countNewCustomers(params);
} }
record.put("new_customers",newCustomers); record.put("new_customers", newCustomers);
record.put("old_customers",oldCustomers); record.put("old_customers", oldCustomers);
record.put("client_id",client.getIntValue("client_id")); record.put("client_id", client.getIntValue("client_id"));
if (StringUtils.equalsIgnoreCase("rpaypmt_card", record.getString("channel")) || StringUtils.equalsIgnoreCase("rpaypmt_dd", record.getString("channel"))) { if (StringUtils.equalsIgnoreCase("rpaypmt_card", record.getString("channel")) || StringUtils.equalsIgnoreCase("rpaypmt_dd", record.getString("channel"))) {
record.put("single_amount", record.getBigDecimal("total").divide(record.getBigDecimal("orders"), 2, RoundingMode.HALF_UP)); record.put("single_amount", record.getBigDecimal("total").divide(record.getBigDecimal("orders"), 2, RoundingMode.HALF_UP));
} }
@ -599,37 +606,40 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
} }
} }
} }
@Override @Override
public JSONObject getPlatformAmount(JSONObject params) { public JSONObject getPlatformAmount(JSONObject params) {
String jsonStr = stringRedisTemplate.boundValueOps("org_ChannelAnalysis" + params.getString("org_id") + params.getString("begin")).get(); String jsonStr = stringRedisTemplate.boundValueOps("org_ChannelAnalysis" + params.getString("org_id") + params.getString("begin")).get();
JSONObject channelAnalysis = JSON.parseObject(jsonStr); JSONObject channelAnalysis = JSON.parseObject(jsonStr);
if(channelAnalysis != null){ if (channelAnalysis != null) {
return channelAnalysis; return channelAnalysis;
}else { } else {
JSONObject resp; JSONObject resp;
if(params.getDate("end").compareTo(new Date()) > 0){ if (params.getDate("end").compareTo(new Date()) > 0) {
if(params.getDate("begin").compareTo(DateUtils.addDays(params.getDate("end"), -1))==0){ if (params.getDate("begin").compareTo(DateUtils.addDays(params.getDate("end"), -1)) == 0) {
resp = getTodayChannelCount(params); resp = getTodayChannelCount(params);
}else { } else {
resp = customerAndOrdersStatisticsMapper.getChannelCommonCount(params); resp = customerAndOrdersStatisticsMapper.getChannelCommonCount(params);
} }
}else { } else {
resp = customerAndOrdersStatisticsMapper.getChannelCommonCount(params); resp = customerAndOrdersStatisticsMapper.getChannelCommonCount(params);
} }
stringRedisTemplate.boundValueOps("org_ChannelAnalysis"+ params.getString("org_id")+params.getString("begin")).set(resp.toJSONString(), 5, TimeUnit.MINUTES); stringRedisTemplate.boundValueOps("org_ChannelAnalysis" + params.getString("org_id") + params.getString("begin")).set(resp.toJSONString(), 5, TimeUnit.MINUTES);
return resp; return resp;
} }
} }
private JSONObject getTodayChannelCount(JSONObject params){
private JSONObject getTodayChannelCount(JSONObject params) {
String[] channels = new String[]{"Wechat", "Alipay", "AlipayOnline", "Rpay", "rpaypmt_card", "rpaypmt_dd","ApsInStore","ApsCashier"}; String[] channels = new String[]{"Wechat", "Alipay", "AlipayOnline", "Rpay", "rpaypmt_card", "rpaypmt_dd","ApsInStore","ApsCashier"};
JSONObject resp = new JSONObject(); JSONObject resp = new JSONObject();
for(String channel:channels) { for (String channel : channels) {
params.put("channel", channel); params.put("channel", channel);
resp.put(channel.toLowerCase()+"amount", transactionAnalysisMapper.getPlatformAmount(params).getBigDecimal("amount")); resp.put(channel.toLowerCase() + "amount", transactionAnalysisMapper.getPlatformAmount(params).getBigDecimal("amount"));
resp.put(channel.toLowerCase()+"_order_count", transactionAnalysisMapper.getPlatformAmount(params).getIntValue("order_count")); resp.put(channel.toLowerCase() + "_order_count", transactionAnalysisMapper.getPlatformAmount(params).getIntValue("order_count"));
} }
return resp; return resp;
} }
@Override @Override
public JSONObject getOrderAndCustomerPerDay(JSONObject partner, AnalysisBean partnerAnalysisBean) { public JSONObject getOrderAndCustomerPerDay(JSONObject partner, AnalysisBean partnerAnalysisBean) {
String timezone = partner.getJSONObject("client").getString("timezone"); String timezone = partner.getJSONObject("client").getString("timezone");

@ -26,6 +26,7 @@ import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.util.HSSFColor; import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.usermodel.*;
import org.joda.time.DateTime;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -263,10 +264,10 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
@Transactional @Transactional
public void generateold(String monthStr) { public void generateold(String monthStr) {
Date mon = checkMonth(monthStr); Date mon = checkMonth(monthStr);
Calendar monthCal = Calendar.getInstance(); DateTime begin = new DateTime(mon);
monthCal.setTime(mon); DateTime end = begin.plusMonths(1);
int year = monthCal.get(Calendar.YEAR); int year = begin.getYear();
int month = monthCal.get(Calendar.MONTH) + 1; int month = begin.getMonthOfYear();
JSONObject sysConfig = sysConfigManager.getSysConfig(); JSONObject sysConfig = sysConfigManager.getSysConfig();
BigDecimal alipayChargeRate = new BigDecimal("0.6"); BigDecimal alipayChargeRate = new BigDecimal("0.6");
@ -290,7 +291,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
channelMap.put("Wechat", "Wechat"); channelMap.put("Wechat", "Wechat");
channelMap.put("AlipayOnline", "AlipayOnline"); channelMap.put("AlipayOnline", "AlipayOnline");
Set<Integer> orgIds = new HashSet<>(); Set<Integer> orgIds = new HashSet<>();
List<JSONObject> transactionAnalysis = transactionMapper.listTransactionsForCityPartnerCommission(year, month); List<JSONObject> transactionAnalysis = transactionMapper.listTransactionsForCityPartnerCommission(begin.toDate(), end.toDate());
Map<String, CityPartnerCommissionAnalysis> results = new HashMap<>(); Map<String, CityPartnerCommissionAnalysis> results = new HashMap<>();
for (JSONObject analysisDay : transactionAnalysis) { for (JSONObject analysisDay : transactionAnalysis) {
int orgId = analysisDay.getIntValue("org_id"); int orgId = analysisDay.getIntValue("org_id");
@ -343,10 +344,12 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
@Transactional @Transactional
public void generate(String monthStr) { public void generate(String monthStr) {
Date mon = checkMonth(monthStr); Date mon = checkMonth(monthStr);
Calendar monthCal = Calendar.getInstance(); DateTime begin = new DateTime(mon);
monthCal.setTime(mon); DateTime timeinterval1=begin.plusDays(10);
int year = monthCal.get(Calendar.YEAR); DateTime timeinterval2=begin.plusDays(20);
int month = monthCal.get(Calendar.MONTH) + 1; DateTime end = begin.plusMonths(1);
int year = begin.getYear();
int month = begin.getMonthOfYear();
// List<JSONObject> list = financialPartnerCommissionMapper.list(year, month); // List<JSONObject> list = financialPartnerCommissionMapper.list(year, month);
// if (list != null && !list.isEmpty()) { // if (list != null && !list.isEmpty()) {
@ -401,7 +404,16 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
channelCharge.put("onlineInterchangeChargeRate", onlineInterchangeChargeRate); channelCharge.put("onlineInterchangeChargeRate", onlineInterchangeChargeRate);
channelCharge.put("onlineServiceChargeRate", onlineServiceChargeRate); channelCharge.put("onlineServiceChargeRate", onlineServiceChargeRate);
List<JSONObject> transactionDetail = transactionMapper.listTransactionForCityPartnerCommissionByDate(year, month); List<JSONObject> transactionDetail=new ArrayList<>();
long time1=System.currentTimeMillis();
List<JSONObject> transactionDetail1 = transactionMapper.listTransactionForCityPartnerCommissionByDate(begin.toDate(), timeinterval1.toDate());
List<JSONObject> transactionDetail2 = transactionMapper.listTransactionForCityPartnerCommissionByDate(timeinterval1.toDate(), timeinterval2.toDate());
List<JSONObject> transactionDetail3 = transactionMapper.listTransactionForCityPartnerCommissionByDate(timeinterval2.toDate(), end.toDate());
long time2=System.currentTimeMillis();
System.out.println("=====>time:"+(time2-time1));
transactionDetail.addAll(transactionDetail1);
transactionDetail.addAll(transactionDetail2);
transactionDetail.addAll(transactionDetail3);
transactionDetail.forEach(item -> { transactionDetail.forEach(item -> {
if (StringUtils.equalsIgnoreCase("AlipayPlus", item.getString("channel"))) { if (StringUtils.equalsIgnoreCase("AlipayPlus", item.getString("channel"))) {
item.put("channel", item.getString("pay_type")); item.put("channel", item.getString("pay_type"));
@ -1175,15 +1187,22 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
@Transactional @Transactional
public void generateReferrer(String monthStr) { public void generateReferrer(String monthStr) {
Date mon = checkMonth(monthStr); Date mon = checkMonth(monthStr);
Calendar monthCal = Calendar.getInstance(); DateTime begin = new DateTime(mon);
monthCal.setTime(mon); DateTime timeinterval1=begin.plusDays(10);
int year = monthCal.get(Calendar.YEAR); DateTime timeinterval2=begin.plusDays(20);
int month = monthCal.get(Calendar.MONTH) + 1; DateTime end = begin.plusMonths(1);
int year = begin.getYear();
int month = begin.getMonthOfYear();
financialReferrerCommissionDetailMapper.clearData(year, month); financialReferrerCommissionDetailMapper.clearData(year, month);
financialReferrerCommissionMapper.clearData(year, month); financialReferrerCommissionMapper.clearData(year, month);
List<JSONObject> transactionAnalysis=new ArrayList<>();
List<JSONObject> transactionAnalysis = transactionMapper.listTransactionsForReferrerCommission(year, month); List<JSONObject> transactionAnalysis1 = transactionMapper.listTransactionsForReferrerCommission(begin.toDate(), timeinterval1.toDate());
List<JSONObject> transactionAnalysis2 = transactionMapper.listTransactionsForReferrerCommission(timeinterval1.toDate(), timeinterval2.toDate());
List<JSONObject> transactionAnalysis3 = transactionMapper.listTransactionsForReferrerCommission(timeinterval2.toDate(), end.toDate());
transactionAnalysis.addAll(transactionAnalysis1);
transactionAnalysis.addAll(transactionAnalysis2);
transactionAnalysis.addAll(transactionAnalysis3);
Map<Integer, ReferrerCommissionAnalysis> results = new HashMap<>(); Map<Integer, ReferrerCommissionAnalysis> results = new HashMap<>();
for (JSONObject analysisDay : transactionAnalysis) { for (JSONObject analysisDay : transactionAnalysis) {
Integer orgId = analysisDay.getInteger("org_id"); Integer orgId = analysisDay.getInteger("org_id");
@ -1262,14 +1281,22 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
public void generateAgent(String monthStr, JSONObject channelCharge) { public void generateAgent(String monthStr, JSONObject channelCharge) {
Date mon = checkMonth(monthStr); Date mon = checkMonth(monthStr);
Calendar monthCal = Calendar.getInstance(); DateTime begin = new DateTime(mon);
monthCal.setTime(mon); DateTime timeinterval1=begin.plusDays(10);
int year = monthCal.get(Calendar.YEAR); DateTime timeinterval2=begin.plusDays(20);
int month = monthCal.get(Calendar.MONTH) + 1; DateTime end = begin.plusMonths(1);
int year = begin.getYear();
int month = begin.getMonthOfYear();
financialAgentCommissionMapper.clearData(year, month); financialAgentCommissionMapper.clearData(year, month);
financialAgentCommissionDetailMapper.clearData(year, month); financialAgentCommissionDetailMapper.clearData(year, month);
List<JSONObject> transactionDetail = transactionMapper.listTransactionForCityPartnerAgentCommissionByDate(year, month); List<JSONObject> transactionDetail=new ArrayList<>();
List<JSONObject> transactionDetail1 = transactionMapper.listTransactionForCityPartnerAgentCommissionByDate(begin.toDate(), timeinterval1.toDate());
List<JSONObject> transactionDetail2 = transactionMapper.listTransactionForCityPartnerAgentCommissionByDate(timeinterval1.toDate(), timeinterval2.toDate());
List<JSONObject> transactionDetail3 = transactionMapper.listTransactionForCityPartnerAgentCommissionByDate(timeinterval2.toDate(), end.toDate());
transactionDetail.addAll(transactionDetail1);
transactionDetail.addAll(transactionDetail2);
transactionDetail.addAll(transactionDetail3);
transactionDetail.forEach(item -> { transactionDetail.forEach(item -> {
if (StringUtils.equalsIgnoreCase("AlipayPlus", item.getString("channel"))) { if (StringUtils.equalsIgnoreCase("AlipayPlus", item.getString("channel"))) {
item.put("channel", item.getString("pay_type")); item.put("channel", item.getString("pay_type"));

@ -58,9 +58,9 @@ public class DataAnalysisServiceImpl implements DataAnalysisService {
response.put("max_order", 0); response.put("max_order", 0);
} }
//总消费人数 //总消费人数
response.put("total_customers", transactionAnalysisMapper.countCustomers(params)); response.put("total_customers", 0);
//老客户人数 //老客户人数
response.put("old_customers", transactionAnalysisMapper.countOldCustomers(params)); response.put("old_customers", 0);
return response; return response;
} }

@ -1,10 +1,15 @@
package au.com.royalpay.payment.manage.dev.web; package au.com.royalpay.payment.manage.dev.web;
import au.com.royalpay.payment.channels.alipay.config.AlipayConfig;
import au.com.royalpay.payment.channels.alipay.config.AlipayEnvironment;
import au.com.royalpay.payment.channels.alipay.runtime.AlipayOnlineApi;
import au.com.royalpay.payment.channels.alipay.runtime.AlipayRetailApi;
import au.com.royalpay.payment.channels.wechat.runtime.beans.SubMerchantInfoInheritance; import au.com.royalpay.payment.channels.wechat.runtime.beans.SubMerchantInfoInheritance;
import au.com.royalpay.payment.channels.wechat.runtime.impls.WxPayMerchantRegister; import au.com.royalpay.payment.channels.wechat.runtime.impls.WxPayMerchantRegister;
import au.com.royalpay.payment.channels.wechat.runtime.mappers.PaymentChannelMccGoodMapper; import au.com.royalpay.payment.channels.wechat.runtime.mappers.PaymentChannelMccGoodMapper;
import au.com.royalpay.payment.core.PaymentApi; import au.com.royalpay.payment.core.PaymentApi;
import au.com.royalpay.payment.core.PaymentDevHelper; import au.com.royalpay.payment.core.PaymentDevHelper;
import au.com.royalpay.payment.core.beans.EmptyMerchantApplication;
import au.com.royalpay.payment.core.exceptions.InvalidShortIdException; import au.com.royalpay.payment.core.exceptions.InvalidShortIdException;
import au.com.royalpay.payment.core.impls.MerchantChannelApplicationManager; import au.com.royalpay.payment.core.impls.MerchantChannelApplicationManager;
import au.com.royalpay.payment.core.mappers.PmtCustomReportMapper; import au.com.royalpay.payment.core.mappers.PmtCustomReportMapper;
@ -37,6 +42,7 @@ import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
import au.com.royalpay.payment.tools.http.HttpUtils; import au.com.royalpay.payment.tools.http.HttpUtils;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.scheduler.SynchronizedScheduler;
import au.com.royalpay.payment.tools.utils.PdfUtils; import au.com.royalpay.payment.tools.utils.PdfUtils;
import au.com.royalpay.payment.tools.utils.TimeZoneUtils; import au.com.royalpay.payment.tools.utils.TimeZoneUtils;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
@ -62,12 +68,10 @@ import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.security.InvalidParameterException;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Optional;
/** /**
* Created by yixian on 2016-07-06. * Created by yixian on 2016-07-06.
@ -77,6 +81,8 @@ import java.util.Optional;
public class TestController { public class TestController {
private final Logger logger = LoggerFactory.getLogger(getClass()); private final Logger logger = LoggerFactory.getLogger(getClass());
@Resource @Resource
private SynchronizedScheduler synchronizedScheduler;
@Resource
private OrderMapper orderMapper; private OrderMapper orderMapper;
@Resource @Resource
private RefundMapper refundMapper; private RefundMapper refundMapper;
@ -179,6 +185,7 @@ public class TestController {
/** /**
* *
*
* @param clientMoniker * @param clientMoniker
* @param manager * @param manager
* @param httpResponse * @param httpResponse
@ -186,7 +193,7 @@ public class TestController {
*/ */
@ManagerMapping(value = "/{clientMoniker}/export/aggregate/agreepdf", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.DIRECTOR, ManagerRole.OPERATOR}) @ManagerMapping(value = "/{clientMoniker}/export/aggregate/agreepdf", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.DIRECTOR, ManagerRole.OPERATOR})
public void exportAggregateAgreeFile(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, HttpServletResponse httpResponse) { public void exportAggregateAgreeFile(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, HttpServletResponse httpResponse) {
logger.info("===>exportAggregateAgreeFile:path:"+aggragatePdfPath); logger.info("===>exportAggregateAgreeFile:path:" + aggragatePdfPath);
httpResponse.setContentType("application/pdf"); httpResponse.setContentType("application/pdf");
httpResponse.setHeader("content-disposition", "attachment;filename=" + clientMoniker + "_AGREEMENT_" + new Date() + ".pdf"); httpResponse.setHeader("content-disposition", "attachment;filename=" + clientMoniker + "_AGREEMENT_" + new Date() + ".pdf");
@ -215,21 +222,21 @@ public class TestController {
throw new BadRequestException("The Partner's Rate is not config!"); throw new BadRequestException("The Partner's Rate is not config!");
} }
client.put("wechat_rate", weChatRate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN)); client.put("wechat_rate", weChatRate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN));
client.put("clean", "T+"+weChatRate.getString("clean_days")); client.put("clean", "T+" + weChatRate.getString("clean_days"));
client.put("clean_days", weChatRate.getString("clean_days")); client.put("clean_days", weChatRate.getString("clean_days"));
client.put("located_country", "Australia"); client.put("located_country", "Australia");
if("1".equalsIgnoreCase(weChatRate.getString("clean_days"))){ if ("1".equalsIgnoreCase(weChatRate.getString("clean_days"))) {
// clean_1 clean_1_friday clean_1_saturday // clean_1 clean_1_friday clean_1_saturday
// first, second, third or fourth // first, second, third or fourth
client.put("clean_1", weChatRate.getString("clean_days")); client.put("clean_1", weChatRate.getString("clean_days"));
client.put("clean_1_friday", "first"); client.put("clean_1_friday", "first");
client.put("clean_1_saturday", "second"); client.put("clean_1_saturday", "second");
}else if("2".equalsIgnoreCase(weChatRate.getString("clean_days"))){ } else if ("2".equalsIgnoreCase(weChatRate.getString("clean_days"))) {
client.put("clean_1", weChatRate.getString("clean_days")); client.put("clean_1", weChatRate.getString("clean_days"));
client.put("clean_1_friday", "second"); client.put("clean_1_friday", "second");
client.put("clean_1_saturday", "third"); client.put("clean_1_saturday", "third");
}else if("3".equalsIgnoreCase(weChatRate.getString("clean_days"))){ } else if ("3".equalsIgnoreCase(weChatRate.getString("clean_days"))) {
client.put("clean_1", weChatRate.getString("clean_days")); client.put("clean_1", weChatRate.getString("clean_days"));
client.put("clean_1_friday", "third"); client.put("clean_1_friday", "third");
client.put("clean_1_saturday", "fourth"); client.put("clean_1_saturday", "fourth");
@ -285,6 +292,7 @@ public class TestController {
e.printStackTrace(); e.printStackTrace();
} }
} }
/** /**
* *
* *
@ -464,8 +472,15 @@ public class TestController {
} }
@GetMapping(value = "/task/analysisDashboard") @GetMapping(value = "/task/analysisDashboard")
public void analysisDashboard(@RequestParam("date") String date) throws ParseException { public void analysisDashboard(@RequestParam("date") String date) {
synchronizedScheduler.executeProcess("manage_task:dashboardTask", 120_000,
() -> {
try {
dashboardService.generateCustomersAndOrdersStatistics(DateUtils.parseDate(date, "yyyyMMdd")); dashboardService.generateCustomersAndOrdersStatistics(DateUtils.parseDate(date, "yyyyMMdd"));
} catch (ParseException e) {
logger.error("invalid input date:{}", date);
}
});
} }
@ -569,68 +584,67 @@ public class TestController {
*/ */
@ManagerMapping(value = "/batch_update_wxsubmerchantId", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.DIRECTOR, ManagerRole.OPERATOR, ManagerRole.DEVELOPER}) @ManagerMapping(value = "/batch_update_wxsubmerchantId", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.DIRECTOR, ManagerRole.OPERATOR, ManagerRole.DEVELOPER})
public void batchUpdateWxSubmerchantId() { public void batchUpdateWxSubmerchantId() {
List<JSONObject> findSubMerchantIdHistorys=sysWxMerchantApplyMapper.findSubMerchantIdHistorys(); List<JSONObject> findSubMerchantIdHistorys = sysWxMerchantApplyMapper.findSubMerchantIdHistorys();
if(findSubMerchantIdHistorys==null)return; if (findSubMerchantIdHistorys == null) return;
logger.info("=========>batchUpdateWxSubmerchantId:"+findSubMerchantIdHistorys.size()); logger.info("=========>batchUpdateWxSubmerchantId:" + findSubMerchantIdHistorys.size());
findSubMerchantIdHistorys.parallelStream().forEach(jsonObject -> { findSubMerchantIdHistorys.parallelStream().forEach(jsonObject -> {
JSONObject clientJson = clientMapper.findClient(jsonObject.getInteger("client_id")); JSONObject clientJson = clientMapper.findClient(jsonObject.getInteger("client_id"));
JSONObject wechatMcc = paymentChannelMccGoodMapper.findWechatPayMccByClientId(jsonObject.getIntValue("client_id")); JSONObject wechatMcc = paymentChannelMccGoodMapper.findWechatPayMccByClientId(jsonObject.getIntValue("client_id"));
JSONObject clientConfig = clientConfigMapper.find(jsonObject.getIntValue("client_id")); JSONObject clientConfig = clientConfigMapper.find(jsonObject.getIntValue("client_id"));
if(clientJson==null){ if (clientJson == null) {
logger.info("=========>没有查询到client:"+jsonObject.getInteger("client_id")); logger.info("=========>没有查询到client:" + jsonObject.getInteger("client_id"));
return; return;
} }
if(wechatMcc==null){ if (wechatMcc == null) {
logger.info("=========>没有查询到mcc:"+jsonObject.getInteger("client_id")); logger.info("=========>没有查询到mcc:" + jsonObject.getInteger("client_id"));
return; return;
} }
// company_name short_name industry company_phone contact_person contact_phone contact_email 这些字段不能为空 // company_name short_name industry company_phone contact_person contact_phone contact_email 这些字段不能为空
if(TextUtils.isEmpty(clientJson.getString("short_name"))|| if (TextUtils.isEmpty(clientJson.getString("short_name")) ||
TextUtils.isEmpty(clientJson.getString("industry"))|| TextUtils.isEmpty(clientJson.getString("industry")) ||
TextUtils.isEmpty(clientJson.getString("company_phone"))|| TextUtils.isEmpty(clientJson.getString("company_phone")) ||
TextUtils.isEmpty(clientJson.getString("contact_phone"))|| TextUtils.isEmpty(clientJson.getString("contact_phone")) ||
TextUtils.isEmpty(clientJson.getString("contact_person"))|| TextUtils.isEmpty(clientJson.getString("contact_person")) ||
TextUtils.isEmpty(clientJson.getString("contact_email"))|| TextUtils.isEmpty(clientJson.getString("contact_email")) ||
TextUtils.isEmpty(wechatMcc.getString("mc_code"))){ TextUtils.isEmpty(wechatMcc.getString("mc_code"))) {
logger.error("=======>数据不完整clientid"+jsonObject.getInteger("client_id")+""); logger.error("=======>数据不完整clientid" + jsonObject.getInteger("client_id") + "");
return; return;
} }
NewSubMerchantIdApply newSubMerchantIdApply=new NewSubMerchantIdApply(); NewSubMerchantIdApply newSubMerchantIdApply = new NewSubMerchantIdApply();
newSubMerchantIdApply.setMerchant_id(jsonObject.getString("merchant_id")); newSubMerchantIdApply.setMerchant_id(jsonObject.getString("merchant_id"));
newSubMerchantIdApply.setSub_mch_id(jsonObject.getString("sub_merchant_id")); newSubMerchantIdApply.setSub_mch_id(jsonObject.getString("sub_merchant_id"));
newSubMerchantIdApply.setMerchantRemark(jsonObject.getString("merchant_remark")); newSubMerchantIdApply.setMerchantRemark(jsonObject.getString("merchant_remark"));
newSubMerchantIdApply.setMerchant_name(cutLength(jsonObject.getString("merchant_name"),50)); newSubMerchantIdApply.setMerchant_name(cutLength(jsonObject.getString("merchant_name"), 50));
newSubMerchantIdApply.setAddress(cutLength(clientJson.getString("address"),128)); newSubMerchantIdApply.setAddress(cutLength(clientJson.getString("address"), 128));
newSubMerchantIdApply.setMerchant_shortname(cutLength(clientJson.getString("short_name"),64)); newSubMerchantIdApply.setMerchant_shortname(cutLength(clientJson.getString("short_name"), 64));
newSubMerchantIdApply.setBusiness_category(clientJson.getString("industry")); newSubMerchantIdApply.setBusiness_category(clientJson.getString("industry"));
newSubMerchantIdApply.setWebsite(cutLength(clientJson.getString("company_website"),100)); newSubMerchantIdApply.setWebsite(cutLength(clientJson.getString("company_website"), 100));
newSubMerchantIdApply.setOffice_phone(cutLength(clientJson.getString("company_phone"),20)); newSubMerchantIdApply.setOffice_phone(cutLength(clientJson.getString("company_phone"), 20));
newSubMerchantIdApply.setContact_phone(cutLength(clientJson.getString("contact_phone"),16)); newSubMerchantIdApply.setContact_phone(cutLength(clientJson.getString("contact_phone"), 16));
newSubMerchantIdApply.setContact_name(cutLength(clientJson.getString("contact_person"),32)); newSubMerchantIdApply.setContact_name(cutLength(clientJson.getString("contact_person"), 32));
newSubMerchantIdApply.setContact_email(cutLength(clientJson.getString("contact_email"),50)); newSubMerchantIdApply.setContact_email(cutLength(clientJson.getString("contact_email"), 50));
newSubMerchantIdApply.setMcc_code(cutLength(wechatMcc.getString("mc_code"),10)); newSubMerchantIdApply.setMcc_code(cutLength(wechatMcc.getString("mc_code"), 10));
if(!TextUtils.isEmpty(clientConfig.getString("client_pay_type"))){ if (!TextUtils.isEmpty(clientConfig.getString("client_pay_type"))) {
if(clientConfig.getString("client_pay_type").indexOf("1")>=0 if (clientConfig.getString("client_pay_type").indexOf("1") >= 0
&&clientConfig.getString("client_pay_type").indexOf("2")>=0){ && clientConfig.getString("client_pay_type").indexOf("2") >= 0) {
newSubMerchantIdApply.setBusiness_type("BOTH"); newSubMerchantIdApply.setBusiness_type("BOTH");
}else if(clientConfig.getString("client_pay_type").indexOf("1")>=0){ } else if (clientConfig.getString("client_pay_type").indexOf("1") >= 0) {
newSubMerchantIdApply.setBusiness_type("ONLINE"); newSubMerchantIdApply.setBusiness_type("ONLINE");
} } else if (clientConfig.getString("client_pay_type").indexOf("2") >= 0) {
else if(clientConfig.getString("client_pay_type").indexOf("2")>=0){
newSubMerchantIdApply.setBusiness_type("OFFLINE"); newSubMerchantIdApply.setBusiness_type("OFFLINE");
} }
}else{ } else {
newSubMerchantIdApply.setBusiness_type("BOTH"); newSubMerchantIdApply.setBusiness_type("BOTH");
} }
if (!TextUtils.isEmpty(clientJson.getString("business_structure"))) { if (!TextUtils.isEmpty(clientJson.getString("business_structure"))) {
newSubMerchantIdApply.setMerchant_type(clientJson.getString("business_structure").equals("Registered body(Sole Trader)")?"INDIVIDUAL":"ENTERPRISE") ; newSubMerchantIdApply.setMerchant_type(clientJson.getString("business_structure").equals("Registered body(Sole Trader)") ? "INDIVIDUAL" : "ENTERPRISE");
}else{ } else {
newSubMerchantIdApply.setMerchant_type("INDIVIDUAL") ; newSubMerchantIdApply.setMerchant_type("INDIVIDUAL");
} }
newSubMerchantIdApply.setCompany_register_no(cutLength(TextUtils.isEmpty(clientJson.getString("acn"))?clientJson.getString("abn"):clientJson.getString("acn"),50)); newSubMerchantIdApply.setCompany_register_no(cutLength(TextUtils.isEmpty(clientJson.getString("acn")) ? clientJson.getString("abn") : clientJson.getString("acn"), 50));
if (!TextUtils.isEmpty(clientJson.getString("certificat_expire_date"))) { if (!TextUtils.isEmpty(clientJson.getString("certificat_expire_date"))) {
newSubMerchantIdApply.setCertificat_expire_date(clientJson.getString("certificat_expire_date")); newSubMerchantIdApply.setCertificat_expire_date(clientJson.getString("certificat_expire_date"));
} else { } else {
@ -638,34 +652,32 @@ public class TestController {
} }
if("ENTERPRISE".equalsIgnoreCase(newSubMerchantIdApply.getMerchant_type())&&TextUtils.isEmpty(newSubMerchantIdApply.getCompany_register_no())){ if ("ENTERPRISE".equalsIgnoreCase(newSubMerchantIdApply.getMerchant_type()) && TextUtils.isEmpty(newSubMerchantIdApply.getCompany_register_no())) {
logger.error("=======>公司注册号为空clientid"+clientJson.getInteger("client_id")+":"+clientJson.getString("client_moniker")); logger.error("=======>公司注册号为空clientid" + clientJson.getInteger("client_id") + ":" + clientJson.getString("client_moniker"));
return; return;
} }
if("BOTH".equalsIgnoreCase(newSubMerchantIdApply.getBusiness_type())&&(TextUtils.isEmpty(newSubMerchantIdApply.getAddress())|| if ("BOTH".equalsIgnoreCase(newSubMerchantIdApply.getBusiness_type()) && (TextUtils.isEmpty(newSubMerchantIdApply.getAddress()) ||
TextUtils.isEmpty(newSubMerchantIdApply.getWebsite()))){ TextUtils.isEmpty(newSubMerchantIdApply.getWebsite()))) {
logger.error("=======>公司类型为BOTH网址或地址为空clientid:"+clientJson.getInteger("client_id")+":"+clientJson.getString("client_moniker")); logger.error("=======>公司类型为BOTH网址或地址为空clientid:" + clientJson.getInteger("client_id") + ":" + clientJson.getString("client_moniker"));
return; return;
} } else if ("OFFLINE".equalsIgnoreCase(newSubMerchantIdApply.getBusiness_type()) && (TextUtils.isEmpty(newSubMerchantIdApply.getAddress()))) {
else if("OFFLINE".equalsIgnoreCase(newSubMerchantIdApply.getBusiness_type())&&(TextUtils.isEmpty(newSubMerchantIdApply.getAddress()))){ logger.error("=======>公司类型为OFFLINE地址为空clientid:" + clientJson.getInteger("client_id") + ":" + clientJson.getString("client_moniker"));
logger.error("=======>公司类型为OFFLINE地址为空clientid:"+clientJson.getInteger("client_id")+":"+clientJson.getString("client_moniker"));
return; return;
} } else if ("ONLINE".equalsIgnoreCase(newSubMerchantIdApply.getBusiness_type()) &&
else if("ONLINE".equalsIgnoreCase(newSubMerchantIdApply.getBusiness_type())&& TextUtils.isEmpty(newSubMerchantIdApply.getWebsite())) {
TextUtils.isEmpty(newSubMerchantIdApply.getWebsite())){ logger.error("=======>公司类型为ONLINE网址为空clientid:" + clientJson.getInteger("client_id") + ":" + clientJson.getString("client_moniker"));
logger.error("=======>公司类型为ONLINE网址为空clientid:"+clientJson.getInteger("client_id")+":"+clientJson.getString("client_moniker"));
return; return;
} }
JSONObject params = newSubMerchantIdApply.insertObject(clientJson); JSONObject params = newSubMerchantIdApply.insertObject(clientJson);
params.put("merchant_app_id", jsonObject.getString("merchant_app_id")); params.put("merchant_app_id", jsonObject.getString("merchant_app_id"));
SubMerchantInfoInheritance subMerchantInfo = JSON.toJavaObject(params, SubMerchantInfoInheritance.class); SubMerchantInfoInheritance subMerchantInfo = JSON.toJavaObject(params, SubMerchantInfoInheritance.class);
params.put("operator","System"); params.put("operator", "System");
WxPayMerchantRegister register = Optional.ofNullable(merchantChannelApplicationManager.getRegister(WxPayMerchantRegister.class)) WxPayMerchantRegister register = Optional.ofNullable(merchantChannelApplicationManager.getRegister(WxPayMerchantRegister.class))
.orElseThrow(() -> new ServerErrorException("No Register found for wechat")); .orElseThrow(() -> new ServerErrorException("No Register found for wechat"));
JSONObject manager=new JSONObject(); JSONObject manager = new JSONObject();
manager.put("display_name","System"); manager.put("display_name", "System");
register.modifyForBatch(jsonObject.getString("merchant_app_id"), clientJson, subMerchantInfo, manager); register.modifyForBatch(jsonObject.getString("merchant_app_id"), clientJson, subMerchantInfo, manager);
try { try {
Thread.sleep(500); Thread.sleep(500);
@ -677,6 +689,7 @@ public class TestController {
} }
/** /**
* *
*/ */
@ -784,13 +797,104 @@ public class TestController {
// //
// //
// } // }
public String cutLength(String str,int maxlen){ public String cutLength(String str, int maxlen) {
if(TextUtils.isEmpty(str))return ""; if (TextUtils.isEmpty(str)) return "";
if(str.length()>maxlen){ if (str.length() > maxlen) {
return str.substring(0,maxlen); return str.substring(0, maxlen);
}else{ } else {
return str; return str;
} }
} }
/**
*
*/
@GetMapping(value = "/batch_update_alipayapply")
public void batchUpdateAlipayApply() {
logger.info("=======>batchUpdateAlipayApply=开始批量更新支付宝");
String[] alipayonlines = new String[]{};
StringBuilder sb=new StringBuilder();
Arrays.stream(alipayonlines).forEach(
clientMoniker -> {
JSONObject client = clientMapper.findClientByMoniker(clientMoniker);
if (client == null) {
logger.info("======>alipayonline:" + clientMoniker + ":client为空");
return;
}
if(TextUtils.isEmpty(client.getString("acn"))){
client.put("acn",null);
}
logger.info("======>alipayonline:" + clientMoniker);
if (!client.containsKey("company_website")) {
client.put("company_website", "https://www.royalpay.com.au/");
}
if (StringUtils.isBlank(client.getString("business_structure"))) {
client.put("business_structure", "Registered body(Sole Trader)");
}
if (StringUtils.isBlank(client.getString("alipayindustry"))) {
logger.info("======>alipayonline:" + clientMoniker + ":alipayindustry为空给默认值5311");
client.put("alipayindustry", "5311");
}
logger.info("======>alipayindustry:register:" + clientMoniker);
sb.append(clientMoniker+",");
// try {
// merchantChannelApplicationManager.getRegister(AlipayOnlineApi.class).apply(client, new EmptyMerchantApplication(), null);
// } catch (Exception e) {
// e.printStackTrace();
// }
// try {
// Thread.sleep(100);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
}
);
String[] alipayRetails = new String[]{ };
Arrays.stream(alipayRetails).forEach(
clientMoniker -> {
JSONObject client = clientMapper.findClientByMoniker(clientMoniker);
if (client == null) {
logger.info("======>alipayRetail:" + clientMoniker + ":client为空");
}
if(TextUtils.isEmpty(client.getString("acn"))){
client.put("acn",null);
}
logger.info("======>alipayRetail:" + clientMoniker);
if (!client.containsKey("store_photo") || !client.containsKey("company_photo")) {
return;
}
if (StringUtils.isBlank(client.getString("business_structure"))) {
client.put("business_structure", "Registered body(Sole Trader)");
}
if (StringUtils.isBlank(client.getString("alipayindustry"))) {
logger.info("======>alipayRetail:" + clientMoniker + ":alipayindustry为空给默认值5311");
client.put("alipayindustry", "5311");
}
if(TextUtils.isEmpty(client.getString("acn")) && !TextUtils.isEmpty(client.getString("abn")))
logger.info("======>alipayRetail:register:" + clientMoniker);
sb.append(clientMoniker+",");
// try {
// merchantChannelApplicationManager.getRegister(AlipayRetailApi.class).apply(client, new EmptyMerchantApplication(), null);
// } catch (Exception e) {
// e.printStackTrace();
// }
// try {
// Thread.sleep(100);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
}
);
logger.info("======>as:" + sb.toString());
}
} }

@ -1707,6 +1707,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
} }
} }
transactionMapper.deleteSettlementTransaction(clearingId); transactionMapper.deleteSettlementTransaction(clearingId);
// transactionMapper.removePreSettleRemark(clearingId);
transactionMapper.removeSettleRemark(clearingId); transactionMapper.removeSettleRemark(clearingId);
preSettleTaskMapper.resetClearStatus(clearingId); preSettleTaskMapper.resetClearStatus(clearingId);
clearingDetailAnalysisMapper.clearAnalysis(clearingId); clearingDetailAnalysisMapper.clearAnalysis(clearingId);

@ -15,6 +15,8 @@ import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.joda.time.DateTimeZone; import org.joda.time.DateTimeZone;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.client.RestTemplateBuilder; import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
@ -38,6 +40,7 @@ import java.util.stream.Collectors;
@Service @Service
public class SettleTaskServiceImpl implements SettleTasksService { public class SettleTaskServiceImpl implements SettleTasksService {
private final Logger logger = LoggerFactory.getLogger(getClass());
private final SysSettlePlanMapper planMapper; private final SysSettlePlanMapper planMapper;
private final StringRedisTemplate redisTemplate; private final StringRedisTemplate redisTemplate;
private final MerchantInfoProvider mchInfoProvider; private final MerchantInfoProvider mchInfoProvider;
@ -105,8 +108,10 @@ public class SettleTaskServiceImpl implements SettleTasksService {
URI uri = UriComponentsBuilder.fromHttpUrl(transactionHost).replacePath(SETTLE_TASK_URI) URI uri = UriComponentsBuilder.fromHttpUrl(transactionHost).replacePath(SETTLE_TASK_URI)
.build().toUri(); .build().toUri();
try { try {
String taskStr = JSON.toJSONString(tasks);
logger.info("submitting settlement task:{}--------->{}", uri, taskStr);
restTemplate.exchange(RequestEntity.post(uri).contentType(MediaType.APPLICATION_JSON) restTemplate.exchange(RequestEntity.post(uri).contentType(MediaType.APPLICATION_JSON)
.body(JSON.toJSONString(tasks).getBytes(StandardCharsets.UTF_8)), String.class); .body(taskStr.getBytes(StandardCharsets.UTF_8)), String.class);
} catch (RestClientResponseException e) { } catch (RestClientResponseException e) {
String resp = e.getResponseBodyAsString(); String resp = e.getResponseBodyAsString();
try { try {

@ -60,6 +60,8 @@ public interface TransactionMapper {
PageList<JSONObject> listSettlementLog(JSONObject params, PageBounds pagination); PageList<JSONObject> listSettlementLog(JSONObject params, PageBounds pagination);
PageList<JSONObject> listSettlementLogOrigin(JSONObject params, PageBounds pagination);
PageList<JSONObject> listSettlementLogForDashbord(JSONObject params, PageBounds pagination); PageList<JSONObject> listSettlementLogForDashbord(JSONObject params, PageBounds pagination);
@CountRef(".countSettlementLogInClients") @CountRef(".countSettlementLogInClients")
@ -93,13 +95,13 @@ public interface TransactionMapper {
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); List<JSONObject> listTransactionForCityPartnerCommissionByDate(@Param("begin") Date begin, @Param("end") Date end);
List<JSONObject> listTransactionForCityPartnerAgentCommissionByDate(@Param("year") int year, @Param("month") int month); List<JSONObject> listTransactionForCityPartnerAgentCommissionByDate(@Param("begin") Date begin, @Param("end") Date end);
List<JSONObject> listTransactionsForCityPartnerCommission(@Param("year") int year, @Param("month") int month); List<JSONObject> listTransactionsForCityPartnerCommission(@Param("begin") Date begin, @Param("end") Date end);
List<JSONObject> listTransactionsForReferrerCommission(@Param("year") int year, @Param("month") int month); List<JSONObject> listTransactionsForReferrerCommission(@Param("begin") Date begin, @Param("end") Date end);
List<JSONObject> listTransactionsForAgentCommission(@Param("year") int year, @Param("month") int month, @Param("parent_org_id") int parent_org_id); List<JSONObject> listTransactionsForAgentCommission(@Param("year") int year, @Param("month") int month, @Param("parent_org_id") int parent_org_id);
@ -131,6 +133,8 @@ public interface TransactionMapper {
void removeSettleRemark(@Param("clearing_id") int clearingId); void removeSettleRemark(@Param("clearing_id") int clearingId);
// void removePreSettleRemark(@Param("clearing_id") int clearingId);
List<JSONObject> getHfClearAmount(JSONObject params); List<JSONObject> getHfClearAmount(JSONObject params);
List<JSONObject> analysisForATOReport(@Param("clientId") int clientId, @Param("channels") List<String> channels, @Param("from") Date startOfMon, @Param("to") Date endOfMon); List<JSONObject> analysisForATOReport(@Param("clientId") int clientId, @Param("channels") List<String> channels, @Param("from") Date startOfMon, @Param("to") Date endOfMon);
@ -163,11 +167,12 @@ public interface TransactionMapper {
/** /**
* *
*
* @param beginTime * @param beginTime
* @param endTime * @param endTime
* @return * @return
*/ */
List<JSONObject> getSettleDataDailyReport(@Param("beginTime") Date beginTime,@Param("endTime")Date endTime); List<JSONObject> getSettleDataDailyReport(@Param("beginTime") Date beginTime, @Param("endTime") Date endTime);
List<JSONObject> analysisByChannels(@Param("from") Date from, @Param("to") Date to, @Param("channels") List<String> channels); List<JSONObject> analysisByChannels(@Param("from") Date from, @Param("to") Date to, @Param("channels") List<String> channels);

@ -125,6 +125,8 @@ public class ClientRegisterInfo {
private String averageCardTransaction; private String averageCardTransaction;
@JSONField(name = "mw_industry") @JSONField(name = "mw_industry")
private String mwIndustry; private String mwIndustry;
@JSONField(name = "mc_industry")
private String mcIndustry;
@JSONField(name = "enable_international_card") @JSONField(name = "enable_international_card")
private boolean enableInternaltionCard; private boolean enableInternaltionCard;
@JSONField(name = "enable_cross_payment") @JSONField(name = "enable_cross_payment")
@ -613,6 +615,10 @@ public class ClientRegisterInfo {
return mwIndustry; return mwIndustry;
} }
public String getMcIndustry() {
return mcIndustry;
}
public void setAverageCardTransaction(String averageCardTransaction) { public void setAverageCardTransaction(String averageCardTransaction) {
this.averageCardTransaction = averageCardTransaction; this.averageCardTransaction = averageCardTransaction;
} }
@ -629,6 +635,10 @@ public class ClientRegisterInfo {
this.mwIndustry = mwIndustry; this.mwIndustry = mwIndustry;
} }
public void setMcIndustry(String mcIndustry) {
this.mcIndustry = mcIndustry;
}
public boolean isEnableCardPayment() { public boolean isEnableCardPayment() {
return enableCardPayment; return enableCardPayment;
} }

@ -23,7 +23,7 @@ public class DashboardTaskManager {
@Resource @Resource
private SynchronizedScheduler synchronizedScheduler; private SynchronizedScheduler synchronizedScheduler;
@Scheduled(cron = "0 0 2 * * ?") @Scheduled(cron = "0 30 1 * * ?")
public void analysisDashboard() { public void analysisDashboard() {
synchronizedScheduler.executeProcess("manage_task:dashboardTask", 120_000, synchronizedScheduler.executeProcess("manage_task:dashboardTask", 120_000,
() -> dashboardService.generateCustomersAndOrdersStatistics(DateUtils.addDays(new Date(), -1))); () -> dashboardService.generateCustomersAndOrdersStatistics(DateUtils.addDays(new Date(), -1)));

@ -414,11 +414,9 @@
<select id="countNewCustomers" resultType="java.lang.Integer"> <select id="countNewCustomers" resultType="java.lang.Integer">
<![CDATA[ <![CDATA[
SELECT COUNT(DISTINCT customer_id) FROM (SELECT o.customer_id FROM pmt_transactions t SELECT COUNT(customer_id) FROM (
INNER JOIN pmt_orders o ON o.order_id = t.order_id SELECT o.customer_id,min(o.create_time) first_pay FROM pmt_orders o
]]> WHERE o.create_time < #{end} and o.status>4
<![CDATA[
WHERE o.create_time >= #{begin} AND o.create_time < #{end}
]]> ]]>
<if test="client_ids!=null"> <if test="client_ids!=null">
AND o.client_id IN AND o.client_id IN
@ -429,38 +427,23 @@
<if test="client_ids==null and client_id != null"> <if test="client_ids==null and client_id != null">
and o.client_id=#{client_id} and o.client_id=#{client_id}
</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 o.org_id=#{org_id}</if>
<if test="org_ids!=null">and t.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> <foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if> </if>
<if test="channel !=null">and o.channel = #{channel}</if> <if test="channel !=null">and o.channel = #{channel}</if>
<![CDATA[ <![CDATA[
GROUP BY o.customer_id) p GROUP BY o.customer_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 having first_pay>=#{begin}
]]> ) p
<![CDATA[
WHERE o.create_time < #{begin}
]]>
<if test="client_ids!=null">
AND o.client_id IN
<foreach collection="client_ids" open="(" close=")" separator="," item="client_id">
#{client_id}
</foreach>
</if>
<if test="client_ids==null and client_id != null">
and o.client_id=#{client_id}
</if>
<![CDATA[
)
]]> ]]>
</select> </select>
<select id="countOldCustomers" resultType="java.lang.Integer"> <select id="countOldCustomers" resultType="java.lang.Integer">
<![CDATA[ <![CDATA[
SELECT COUNT(DISTINCT customer_id) FROM (SELECT o.customer_id FROM pmt_transactions t SELECT COUNT(customer_id) FROM (
INNER JOIN pmt_orders o ON o.order_id = t.order_id SELECT o.customer_id,min(o.create_time) first_pay,max(o.create_time) last_pay FROM pmt_orders o
]]> WHERE o.create_time < #{end} and o.status>4
<![CDATA[
WHERE o.create_time >= #{begin} AND o.create_time < #{end}
]]> ]]>
<if test="client_ids!=null"> <if test="client_ids!=null">
AND o.client_id IN AND o.client_id IN
@ -471,29 +454,15 @@
<if test="client_ids==null and client_id != null"> <if test="client_ids==null and client_id != null">
and o.client_id=#{client_id} and o.client_id=#{client_id}
</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 o.org_id=#{org_id}</if>
<if test="org_ids!=null">and t.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> <foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if> </if>
<if test="channel !=null">and o.channel = #{channel}</if> <if test="channel !=null">and o.channel = #{channel}</if>
<![CDATA[ <![CDATA[
GROUP BY o.customer_id) p GROUP BY o.customer_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 having first_pay<#{begin} and last_pay>=#{begin}
]]> ) p
<![CDATA[
WHERE o.create_time < #{begin}
]]>
<if test="client_ids!=null">
AND o.client_id IN
<foreach collection="client_ids" open="(" close=")" separator="," item="client_id">
#{client_id}
</foreach>
</if>
<if test="client_ids==null and client_id != null">
and o.client_id=#{client_id}
</if>
<![CDATA[
)
]]> ]]>
</select> </select>

@ -3,13 +3,15 @@
<mapper namespace="au.com.royalpay.payment.manage.mappers.payment.TransactionMapper"> <mapper namespace="au.com.royalpay.payment.manage.mappers.payment.TransactionMapper">
<update id="removeSettleRemark"> <update id="removeSettleRemark">
UPDATE pmt_transactions AS t UPDATE pmt_transactions AS t
INNER JOIN log_clearing_detail d ON d.clear_detail_id = t.clearing_order INNER JOIN (
SET clearing_status = if( select d.clear_detail_id,count(p.task_id) pre_settle_flag from log_clearing_detail d
(select count(task_id) from log_presettle_task p where p.clear_detail_id = d.clear_detail_id) > left join log_presettle_task p on p.clear_detail_id = d.clear_detail_id
0, 4, 0), where d.clearing_id=#{clearing_id}
group by d.clear_detail_id) dd
ON dd.clear_detail_id = t.clearing_order
SET clearing_status = if(pre_settle_flag > 0, 4, 0),
clearing_order = NULL, clearing_order = NULL,
clearing_time = NULL clearing_time = NULL
WHERE d.clearing_id = #{clearing_id}
</update> </update>
<delete id="deleteSettlementTransaction"> <delete id="deleteSettlementTransaction">
DELETE t DELETE t
@ -559,6 +561,46 @@
</select> </select>
<select id="listSettlementLog" resultType="com.alibaba.fastjson.JSONObject"> <select id="listSettlementLog" resultType="com.alibaba.fastjson.JSONObject">
select cd.client_id, cd.report_date clearing_time, cd.report_date,
lc.editable, lc.balance_group,
<if test="merge_settle!=null">
SUM(cd.tax_amount) as tax_amount,
SUM(cd.total_charge) as total_charge,
1 as merge_settle,
</if>
<if test="merge_settle==null">
cd.tax_amount,
cd.total_charge,
cd.clear_detail_id,
</if>
sum(cd.gross_amount) total,
sum(cd.clearing_amount) income,
sum(cd.total_charge+cd.tax_amount) fee,
(SELECT min(r.rate_value) FROM sys_client_rates r WHERE r.client_id = cd.client_id
AND r.expiry_time > cd.report_date
AND r.active_time &lt;= cd.report_date) rate
from log_clearing_detail cd
inner join sys_clients sc on sc.client_id=cd.client_id
inner join log_clearing lc on lc.clearing_id=cd.clearing_id
<where>
<if test="client_ids!=null">
AND cd.client_id IN
<foreach collection="client_ids" open="(" close=")" separator="," item="client_id">
#{client_id}
</foreach>
</if>
<if test="client_ids==null and client_id !=null">
and (sc.client_id=#{client_id} or sc.parent_client_id =#{client_id})
</if>
<if test="from!=null">and cd.report_date &gt;= #{from}</if>
<if test="to!=null">and cd.report_date &lt; #{to}</if>
<if test="merge_settle!=null">GROUP BY cd.report_date</if>
<if test="merge_settle==null">GROUP BY cd.clear_detail_id</if>
order by lc.clearing_id desc
</where>
</select>
<select id="listSettlementLogOrigin" resultType="com.alibaba.fastjson.JSONObject">
SELECT t.client_id,DATE(t.transaction_time) clearing_time, SELECT t.client_id,DATE(t.transaction_time) clearing_time,
ifnull(cd.report_date,date(t.transaction_time)) report_date, ifnull(cd.report_date,date(t.transaction_time)) report_date,
<if test="merge_settle!=null"> <if test="merge_settle!=null">
@ -646,15 +688,17 @@
<select id="listSettlementLogTotal" resultType="com.alibaba.fastjson.JSONObject"> <select id="listSettlementLogTotal" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[ <![CDATA[
SELECT DATE(t.transaction_time) clearing_time,date_format(t.transaction_time, '%Y-%m-%d') clear_time,SUM(t.clearing_amount) total, SELECT cd.report_date clearing_time,
sum(if(LOCATE('MERCHANT',t.system_transaction_id),t.clearing_amount,0)) income, date_format(cd.report_date, '%Y-%m-%d') clear_time,
sum(if(LOCATE('SURCHARGE',t.system_transaction_id),t.clearing_amount,0)) fee SUM(cd.gross_amount) total,
FROM pmt_transactions t sum(cd.clearing_amount) income,
LEFT JOIN sys_clients c on c.client_id = t.client_id sum(cd.total_charge+cd.tax_amount) fee
WHERE t.channel='Settlement' from log_clearing_detail cd
inner JOIN sys_clients c on c.client_id = cd.client_id
]]> ]]>
<where>
<if test="client_ids!=null"> <if test="client_ids!=null">
AND t.client_id IN AND cd.client_id IN
<foreach collection="client_ids" open="(" close=")" separator="," item="client_id"> <foreach collection="client_ids" open="(" close=")" separator="," item="client_id">
#{client_id} #{client_id}
</foreach> </foreach>
@ -662,29 +706,27 @@
<if test="client_ids==null and client_id !=null"> <if test="client_ids==null and client_id !=null">
and (c.client_id=#{client_id} or c.parent_client_id=#{client_id}) and (c.client_id=#{client_id} or c.parent_client_id=#{client_id})
</if> </if>
<if test="from!=null">and t.transaction_time &gt;= #{from}</if> <if test="from!=null">and cd.report_date &gt;= #{from}</if>
<if test="to!=null">and t.transaction_time &lt; #{to}</if> <if test="to!=null">and cd.report_date &lt; #{to}</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> <foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if> </if>
GROUP BY DATE(t.transaction_time) GROUP BY cd.report_date
order by t.clearing_time desc order by cd.clearing_id desc
</where>
</select> </select>
<select id="listSettlementLogInClients" resultType="com.alibaba.fastjson.JSONObject"> <select id="listSettlementLogInClients" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[ <![CDATA[
SELECT c.short_name,SUM(t.clearing_amount) total, SELECT c.short_name,SUM(cd.gross_amount) total,
sum(if(LOCATE('MERCHANT',t.system_transaction_id),t.clearing_amount,0)) income, sum(cd.clearing_amount) income,
sum(if(LOCATE('SURCHARGE',t.system_transaction_id),t.clearing_amount,0)) fee sum(cd.total_charge+cd.tax_amount) fee
FROM sys_clients c FROM sys_clients c
]]> ]]>
INNER JOIN (select system_transaction_id,clearing_amount,client_id INNER JOIN log_clearing_detail cd on c.client_id=cd.client_id
from pmt_transactions <if test="from!=null">and cd.report_date &gt;= #{from}</if>
where channel='Settlement' <if test="to!=null">and cd.report_date &lt; #{to}</if>
<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> <where>
<if test="client_moniker!=null">and c.client_moniker=#{client_moniker}</if> <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_id!=null and org_ids==null">and c.org_id = #{org_id}</if>
@ -696,8 +738,9 @@
</select> </select>
<select id="countSettlementLogInClients" resultType="int"> <select id="countSettlementLogInClients" resultType="int">
<![CDATA[ <![CDATA[
SELECT count(1) SELECT count(cd.clear_detail_id)
FROM sys_clients c from log_clearing_detail
inner join sys_clients c on c.client_id=cd.client_id
]]> ]]>
<where> <where>
<if test="client_moniker!=null">and c.client_moniker=#{client_moniker}</if> <if test="client_moniker!=null">and c.client_moniker=#{client_moniker}</if>
@ -705,13 +748,9 @@
<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> <foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if> </if>
and exists (select client_id from pmt_transactions t where channel='Settlement' <if test="from!=null">and cd.report_date &gt;= #{from}</if>
<if test="from!=null">and transaction_time &gt;= #{from}</if> <if test="to!=null">and cd.report_date &lt; #{to}</if>
<if test="to!=null">and transaction_time &lt; #{to}</if>
and client_id=c.client_id
)
</where> </where>
exists
</select> </select>
<select id="analysisSettlementLog" resultType="com.alibaba.fastjson.JSONObject"> <select id="analysisSettlementLog" resultType="com.alibaba.fastjson.JSONObject">
@ -967,8 +1006,8 @@
INNER JOIN sys_org so INNER JOIN sys_org so
ON m.org_id = so.org_id AND so.is_valid = 1 AND so.type = 0 AND so.citypartner = 1 AND ON m.org_id = so.org_id AND so.is_valid = 1 AND so.type = 0 AND so.citypartner = 1 AND
so.commission = 1 so.commission = 1
WHERE year(t.transaction_time) = #{year} WHERE t.transaction_time >= #{begin}
AND month(t.transaction_time) = #{month} AND t.transaction_time < #{end}
AND t.channel != 'Settlement' AND t.channel != 'Settlement'
GROUP BY t.client_id, trade_date, channel GROUP BY t.client_id, trade_date, channel
ORDER BY c.org_id ASC, t.client_id ASC, trade_date ASC ORDER BY c.org_id ASC, t.client_id ASC, trade_date ASC
@ -997,7 +1036,7 @@
INNER JOIN sys_org so ON t.org_id = so.org_id AND so.is_valid = 1 INNER JOIN sys_org so ON t.org_id = so.org_id AND so.is_valid = 1
AND so.type = 0 AND so.type = 0
AND so.citypartner = 1 AND so.commission = 1 AND so.citypartner = 1 AND so.commission = 1
AND year(t.create_time) = #{year} AND month(t.create_time) = #{month} AND t.create_time >= #{begin} AND t.create_time < #{end}
AND t.channel != 'Settlement' AND t.channel != 'System' AND t.system_generate = 0 AND t.channel != 'Settlement' AND t.channel != 'System' AND t.system_generate = 0
ORDER BY t.client_id asc ORDER BY t.client_id asc
]]> ]]>
@ -1027,7 +1066,7 @@
AND so.type = 0 AND so.type = 0
AND so.parent_org_id != '' AND so.parent_org_id != ''
AND so.citypartner = 1 AND so.commission = 1 AND so.citypartner = 1 AND so.commission = 1
AND year(t.transaction_time) = #{year} AND month(t.transaction_time) = #{month} AND t.transaction_time >= #{begin} AND t.transaction_time < #{end}
AND t.channel != 'Settlement' AND t.channel != 'System' AND t.channel != 'Settlement' AND t.channel != 'System'
ORDER BY t.client_id asc ORDER BY t.client_id asc
]]> ]]>
@ -1045,8 +1084,8 @@
inner join sys_client_config cc on cc.client_id = c.client_id inner join sys_client_config cc on cc.client_id = c.client_id
INNER JOIN sys_org so INNER JOIN sys_org so
ON c.referrer_id = so.org_id AND so.is_valid = 1 AND so.type = 1 AND so.commission = 1 ON c.referrer_id = so.org_id AND so.is_valid = 1 AND so.type = 1 AND so.commission = 1
WHERE year(t.transaction_time) = #{year} WHERE t.transaction_time >= #{begin}
AND month(t.transaction_time) = #{month} AND t.transaction_time &lt; #{end}
AND t.channel != 'Settlement' AND t.channel != 'Settlement'
GROUP BY so.org_id, trade_date, t.client_id GROUP BY so.org_id, trade_date, t.client_id
ORDER BY c.org_id ASC, t.client_id ASC, trade_date ASC ORDER BY c.org_id ASC, t.client_id ASC, trade_date ASC

@ -95,6 +95,14 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
size: 'lg' size: 'lg'
}).result.then(function (merchants) { }).result.then(function (merchants) {
let arr = $scope.editingTask.whitelist_clients || []; let arr = $scope.editingTask.whitelist_clients || [];
if(!merchants){
commonDialog.alert({
type: 'error',
title: '未选择有效商户',
content: '未选择有效商户'
});
return;
}
for (let mch of merchants) { for (let mch of merchants) {
if (arr.filter(wMch => wMch.client_moniker === mch.client_moniker).length < 1) { if (arr.filter(wMch => wMch.client_moniker === mch.client_moniker).length < 1) {
arr.push(mch); arr.push(mch);
@ -161,6 +169,14 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
submitTask.last_settle_date = task.last_settle_date; submitTask.last_settle_date = task.last_settle_date;
submitTask.disabled_clean_days = task.disabled_clean_days; submitTask.disabled_clean_days = task.disabled_clean_days;
submitTask.follow_sub_partner = task.follow_sub_partner; submitTask.follow_sub_partner = task.follow_sub_partner;
if (task.whitelist_clients == null) {
commonDialog.alert({
type: 'error',
title: '批次配置出错',
content: '批次[' + task.remark + ']未选择商户'
})
return false
}
submitTask.whitelist_clients = task.whitelist_clients.map(cli => cli.client_moniker) submitTask.whitelist_clients = task.whitelist_clients.map(cli => cli.client_moniker)
} }
tasks.push(submitTask) tasks.push(submitTask)

@ -15,6 +15,7 @@ define(['./app',
'./services/stateMap', './services/stateMap',
'./services/industryMap', './services/industryMap',
'./services/upayIndustryMap', './services/upayIndustryMap',
'./services/upayMcc',
'./services/wechatGoodMcc', './services/wechatGoodMcc',
'./services/sectorMap', './services/sectorMap',
'./services/countryMap', './services/countryMap',

File diff suppressed because it is too large Load Diff

@ -139,8 +139,6 @@ define(['angular', 'uiRouter', 'jstz', 'uiBootstrap', 'angularEcharts'], functio
$scope.analysis.traded_partners = resp.data.traded_partners; $scope.analysis.traded_partners = resp.data.traded_partners;
$scope.analysis.total_customers = resp.data.total_customers; $scope.analysis.total_customers = resp.data.total_customers;
$scope.analysis.new_customers = resp.data.total_customers - resp.data.old_customers;
$scope.analysis.old_customers = resp.data.old_customers;
}); });
$http.get('/dashboard/system/common_analysis_4', {params: $scope.currentScale.params()}).then(function (resp) { $http.get('/dashboard/system/common_analysis_4', {params: $scope.currentScale.params()}).then(function (resp) {

@ -261,11 +261,9 @@
<!--ng-bind="analysis.top_amount_order.aud_fee|currency:'AUD '" ng-if="analysis.top_amount_order"></p>--> <!--ng-bind="analysis.top_amount_order.aud_fee|currency:'AUD '" ng-if="analysis.top_amount_order"></p>-->
<!--<p class="description-text" ng-bind="analysis.top_amount_order.short_name" ng-if="analysis.top_amount_order"></p>--> <!--<p class="description-text" ng-bind="analysis.top_amount_order.short_name" ng-if="analysis.top_amount_order"></p>-->
<p class="description-header text-green"> <p class="description-header text-green">
<label>{{analysis.total_customers}}</label> / <label>{{analysis.total_customers}}</label>
<label>{{analysis.new_customers}}</label> /
<label>{{analysis.old_customers}}</label>
</p> </p>
<p class="description-text">总消费人数/新客户/老客户</p> <p class="description-text">总消费人数</p>
</div> </div>
</div> </div>
<div class="col-sm-3 col-xs-6"> <div class="col-sm-3 col-xs-6">

@ -32,7 +32,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
} }
}) })
}]); }]);
app.controller('addPartnerCtrl', ['$rootScope', '$scope', '$http', '$state', 'Upload', 'commonDialog', 'timezone', 'businessStructuresMap', 'upayIndustryMap', 'industryMap', 'stateMap', 'sectorMap', 'countryMap','wechatGoodMcc','$filter', function ($rootScope, $scope, $http, $state, Upload, commonDialog, timezone, businessStructuresMap, upayIndustryMap, industryMap, stateMap, sectorMap, countryMap,wechatGoodMcc,$filter) { app.controller('addPartnerCtrl', ['$rootScope', '$scope', '$http', '$state', 'Upload', 'commonDialog', 'timezone', 'businessStructuresMap', 'upayIndustryMap','upayMcc', 'industryMap', 'stateMap', 'sectorMap', 'countryMap','wechatGoodMcc','$filter', function ($rootScope, $scope, $http, $state, Upload, commonDialog, timezone, businessStructuresMap, upayIndustryMap, upayMcc, industryMap, stateMap, sectorMap, countryMap,wechatGoodMcc,$filter) {
if ($scope.partner_application) { if ($scope.partner_application) {
$scope.partner = angular.copy($scope.partner_application); $scope.partner = angular.copy($scope.partner_application);
delete $rootScope.partner_application; delete $rootScope.partner_application;
@ -172,6 +172,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.industries = industryMap.configs(); $scope.industries = industryMap.configs();
$scope.wechatMccIndustries = wechatGoodMcc.configs(); $scope.wechatMccIndustries = wechatGoodMcc.configs();
$scope.upayIndustrys = upayIndustryMap.configs(); $scope.upayIndustrys = upayIndustryMap.configs();
$scope.upayMccs = upayMcc.configs();
$scope.states = stateMap.configs(); $scope.states = stateMap.configs();
$scope.countries = countryMap.configs(); $scope.countries = countryMap.configs();
$scope.sectors = sectorMap.configs(); $scope.sectors = sectorMap.configs();
@ -472,10 +473,11 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
} }
} }
}]); }]);
app.controller('partnerEditCtrl2', ['$scope', '$http', '$state', 'Upload', 'commonDialog', 'timezone', 'partner','upayIndustryMap','wechatGoodMcc','$filter', app.controller('partnerEditCtrl2', ['$scope', '$http', '$state', 'Upload', 'commonDialog', 'timezone', 'partner','upayIndustryMap','upayMcc','wechatGoodMcc','$filter',
function ($scope, $http, $state, Upload, commonDialog, timezone, partner,upayIndustryMap,wechatGoodMcc,$filter) { function ($scope, $http, $state, Upload, commonDialog, timezone, partner,upayIndustryMap,upayMcc,wechatGoodMcc,$filter) {
$scope.upayIndustrys = upayIndustryMap.configs(); $scope.upayIndustrys = upayIndustryMap.configs();
$scope.upayMccs = upayMcc.configs();
$scope.timezones = timezone.configs(); $scope.timezones = timezone.configs();
$scope.wechatMccIndustries = wechatGoodMcc.configs(); $scope.wechatMccIndustries = wechatGoodMcc.configs();
$scope.partner = partner.data; $scope.partner = partner.data;

@ -1178,7 +1178,9 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
'commonDialog', 'commonDialog',
'partner', 'partner',
'$sce', '$sce',
function ($scope, $http, $state, $uibModal, $rootScope, Upload, commonDialog, partner, $sce) { 'upayMcc',
function ($scope, $http, $state, $uibModal, $rootScope, Upload, commonDialog, partner, $sce,upayMcc) {
$scope.upayMccs = upayMcc.configs();
$scope.init = {wechat_compliance: false, local_merchant: false} $scope.init = {wechat_compliance: false, local_merchant: false}
$scope.partner = partner.data $scope.partner = partner.data
$scope.isComplianceOfCompanyName = false $scope.isComplianceOfCompanyName = false

@ -1379,6 +1379,24 @@
</div> </div>
</div> </div>
</div> </div>
<div class="form-group" ng-if="partner.enable_card_payment"
ng-class="{'has-error':partnerForm.mcindustry.$invalid && partnerForm.mcindustry.$dirty}">
<label class="control-label col-sm-2" for="mw-industry-input">
*Merchant Warrior Merchant Category Code</label>
<div class="col-sm-8">
<select class="form-control" name="mcindustry"
ng-model="partner.mc_industry"
id="mc-industry-input" required
ng-options="mcc.value as '['+mcc.value+']'+mcc.label for mcc in upayMccs">
<option value="">Please Choose</option>
</select>
<div ng-messages="partnerForm.mcindustry.$error"
ng-if="partnerForm.mcindustry.$dirty">
<p class="small text-danger" ng-message="required">Required
Field</p>
</div>
</div>
</div>
<div class="form-group" ng-if="partner.enable_card_payment"> <div class="form-group" ng-if="partner.enable_card_payment">
<label class="control-label col-sm-2" for="mw-industry-input"> <label class="control-label col-sm-2" for="mw-industry-input">
*Card Service Selection</label> *Card Service Selection</label>

@ -1370,6 +1370,20 @@
ng-if="$root.complianceCheck.clientInfo"></i> ng-if="$root.complianceCheck.clientInfo"></i>
</div> </div>
</div> </div>
<div class="form-group" ng-if="partner.mc_industry">
<label class="control-label col-sm-2">Merchant Warrior Merchant Category Code</label>
<div class="col-sm-10">
<select class="form-control" name="mcindustry"
ng-model="partner.mc_industry"
readonly
disabled
id="mc-industry-input"
ng-options="mcc.value as '['+mcc.value+']'+mcc.label for mcc in upayMccs">
</select>
<i class="fa fa-check-square-o check-i" aria-hidden="true"
ng-if="$root.complianceCheck.clientInfo"></i>
</div>
</div>
<div class="form-group"> <div class="form-group">
<label class="control-label col-sm-2"> <label class="control-label col-sm-2">
Card Service Selection</label> Card Service Selection</label>

@ -1340,6 +1340,24 @@
</div> </div>
</div> </div>
</div> </div>
<div class="form-group" ng-if="partner.enable_card_payment"
ng-class="{'has-error':partnerForm.mc-industry.$invalid && partnerForm.mc-industry.$dirty}">
<label class="control-label col-sm-2" for="mc-industry-input">
*Merchant Warrior Merchant Category Code</label>
<div class="col-sm-8">
<select class="form-control" name="mc-industry"
ng-model="partner.mc_industry" required
id="mc-industry-input"
ng-options="mcc.value as '['+mcc.value+']'+mcc.label for mcc in upayMccs">
<option value="">Please Choose</option>
</select>
<div ng-messages="partnerForm.mc-industry.$error"
ng-if="partnerForm.mc-industry.$dirty">
<p class="small text-danger" ng-message="required">Required
Field</p>
</div>
</div>
</div>
<div class="form-group" ng-if="partner.enable_card_payment"> <div class="form-group" ng-if="partner.enable_card_payment">
<label class="control-label col-sm-2" for="mw-industry-input"> <label class="control-label col-sm-2" for="mw-industry-input">
*Card Service Selection</label> *Card Service Selection</label>

@ -20,6 +20,9 @@ server {
server { server {
listen 3000; listen 3000;
server_name _ default; server_name _ default;
underscores_in_headers on;
proxy_ignore_client_abort on;
client_max_body_size 0;
location ~ ^/api/v1.0/retail/((?!(app|rsvc)).)+ { location ~ ^/api/v1.0/retail/((?!(app|rsvc)).)+ {
proxy_pass http://rppaycenter; proxy_pass http://rppaycenter;
@ -31,7 +34,7 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header Real-IP $remote_addr;
proxy_read_timeout 300s; proxy_read_timeout 300s;
@ -47,7 +50,7 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header Real-IP $remote_addr;
proxy_read_timeout 300s; proxy_read_timeout 300s;
} }
@ -61,6 +64,21 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_read_timeout 300s;
}
location ~ ^/api/v1.0/org_gateway {
proxy_pass http://rpmanage;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header Real-IP $remote_addr; proxy_set_header Real-IP $remote_addr;
@ -83,7 +101,7 @@ server {
} }
location ~ ^/api/v1.0/((alipay\w*)|(customs)|(rpay)|(yeepay)|(card_payment_view)|(lakala_pay)|(cb_bankpay)|(bestpay)|(hf)|(\w*gateway)|(micropay)|(retail_qrcode)|(share_code)|(payment)|(h5_payment))/ { location ~ ^/api/v1.0/((alipay\w*)|(customs)|(rpay)|(card_payment_view)|(\w*gateway)|(micropay)|(retail_qrcode)|(share_code)|(payment)|(h5_payment))/ {
proxy_pass http://rppaycenter; proxy_pass http://rppaycenter;
proxy_http_version 1.1; proxy_http_version 1.1;
@ -93,7 +111,7 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header Real-IP $remote_addr;
proxy_read_timeout 300s; proxy_read_timeout 300s;
@ -109,7 +127,7 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header Real-IP $remote_addr;
proxy_read_timeout 300s; proxy_read_timeout 300s;
} }
@ -124,7 +142,7 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header Real-IP $remote_addr;
proxy_read_timeout 300s; proxy_read_timeout 300s;
@ -140,7 +158,7 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header Real-IP $remote_addr;
proxy_read_timeout 300s; proxy_read_timeout 300s;
@ -156,7 +174,7 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header Real-IP $remote_addr;
proxy_read_timeout 300s; proxy_read_timeout 300s;
@ -172,7 +190,6 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header Real-IP $remote_addr;
proxy_read_timeout 300s; proxy_read_timeout 300s;
@ -188,7 +205,7 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header Real-IP $remote_addr;
proxy_read_timeout 300s; proxy_read_timeout 300s;
} }
@ -203,7 +220,7 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header Real-IP $remote_addr;
proxy_read_timeout 300s; proxy_read_timeout 300s;
} }
@ -218,7 +235,7 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header Real-IP $remote_addr;
proxy_read_timeout 300s; proxy_read_timeout 300s;
} }

Loading…
Cancel
Save