macminiuser 7 years ago
parent f4cb0221fe
commit e160be4afd

@ -53,12 +53,10 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
@Override
public JSONObject getCommonAnalysis1(JSONObject params) {
JSONObject res = new JSONObject();
JSONObject res = transactionAnalysisMapper.getClientTransaction(params);
res.put("new_partners", clientAnalysisMapper.countNewClients(params));
res.put("total_partners", clientAnalysisMapper.countClients(params));
res.put("traded_partners", clientAnalysisMapper.countTradedPartners(params));
res.put("trade_amount", transactionAnalysisMapper.getClientTransaction(params).getBigDecimal("trade_amount"));
// res.put("trade_count", transactionAnalysisMapper.analysisTotalCount(params));
// List<JSONObject> topOrders = transactionAnalysisMapper.getTopOrders(params, new PageBounds(1, 1, Order.formString("aud_fee.desc")));
// if (!topOrders.isEmpty()) {
// res.put("top_amount_order", topOrders.get(0));
@ -75,7 +73,7 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
// res.put("total_partners", clientAnalysisMapper.countClients(params));
// res.put("traded_partners", clientAnalysisMapper.countTradedPartners(params));
// res.put("trade_amount", transactionAnalysisMapper.analysisTotalAmount(params));
res.put("trade_count", transactionAnalysisMapper.getClientTransaction(params).getIntValue("trade_count"));
// res.put("trade_count", transactionAnalysisMapper.getClientTransaction(params).getIntValue("trade_count"));
List<JSONObject> topOrders = transactionAnalysisMapper.getTopOrders(params, new PageBounds(1, 1, Order.formString("aud_fee.desc")));
if (!topOrders.isEmpty()) {
res.put("top_amount_order", topOrders.get(0));

@ -24,6 +24,8 @@ public interface RetailAppService {
JSONObject listOrders(JSONObject device, AppQueryBean query);
JSONObject listOrdersNew(JSONObject device, AppQueryBean query);
JSONObject listOrdersShareCode(JSONObject device, AppQueryBean query);
void updateDevToken(JSONObject device, String devToken);

@ -358,9 +358,7 @@ public class RetailAppServiceImp implements RetailAppService {
}
params.put("client_id", client_id);
// PageList<JSONObject> orders = orderMapper.listOrdersByClients(params,
// new PageBounds(query.getPage(), query.getLimit(), Order.formString("create_time.desc")));
PageList<JSONObject> orders = orderMapper.listTransactionsForApp(params,
PageList<JSONObject> orders = orderMapper.listOrdersByClients(params,
new PageBounds(query.getPage(), query.getLimit(), Order.formString("create_time.desc")));
TimeZoneUtils.switchTimeZone(orders, query.getTimezone(), "create_time", "transaction_time", "confirm_time");
ArrayList<String> date_contains = new ArrayList<>();
@ -391,6 +389,70 @@ public class RetailAppServiceImp implements RetailAppService {
return PageListUtils.buildPageListResult(orders);
}
@Override
public JSONObject listOrdersNew(JSONObject device, AppQueryBean query) {
String clientType = device.getString("client_type");
DeviceRegister register = deviceSupport.findRegister(clientType);
int client_id = device.getIntValue("client_id");
JSONObject client = clientManager.getClientInfo(client_id);
String timezone = client.getString("timezone");
if (timezone != null && !timezone.isEmpty()) {
query.setTimezone(timezone);
}
JSONObject params = query.toParams();
setAllClientIds(params, client_id);
if (register.includeDevId()) {
params.put("dev_id", device.getString("dev_id"));
}
params.put("client_id", client_id);
PageList<JSONObject> orders = orderMapper.listTransactionsForApp(params,
new PageBounds(query.getPage(), query.getLimit(), Order.formString("create_time.desc")));
TimeZoneUtils.switchTimeZone(orders, query.getTimezone(), "create_time", "transaction_time", "confirm_time");
ArrayList<String> date_contains = new ArrayList<>();
for (JSONObject order : orders) {
String customer_id = order.getString("customer_id");
if (StringUtils.isEmpty(customer_id)) {
continue;
}
switch (order.getString("channel")) {
case "Alipay":
JSONObject alipayUser = customerRelationAlipayMapper.findCustomerByUserId(customer_id);
order.put("nickname", alipayUser.getString("nickname"));
order.put("headimg", alipayUser.getString("headimg"));
break;
case "Wechat":
JSONObject weUser = customerMapper.findCustomerByOpenId(customer_id);
order.put("nickname", weUser.getString("nickname"));
order.put("headimg", weUser.getString("headimg"));
break;
default:
break;
}
Calendar calendar = (Calendar) order.get("create_time");
String trade_date = DateFormatUtils.format(calendar, "yyyy-MM-dd");
String trade_time = DateFormatUtils.format(calendar, "HH:mm:ss");
order.put("trade_date", trade_date);
order.put("trade_time", trade_time);
if (!date_contains.contains(trade_date)) {
String re_date = trade_date.replaceAll("-", "");
TradeLogQuery date_query = new TradeLogQuery();
date_query.setDatefrom(re_date);
date_query.setDateto(re_date);
// date_query.setStatus(OrderStatus.ALL);
if (params.containsKey("client_ids")) {
date_query.setClient_ids((String[]) params.get("client_ids"));
}
JSONObject date_params = date_query.toParams(query.getTimezone());
date_params.put("client_id", device.getIntValue("client_id"));
JSONObject analysis = orderMapper.analysisOrders(date_params);
order.put("date_total", analysis);
date_contains.add(trade_date);
}
}
return PageListUtils.buildPageListResult(orders);
}
@Override
public JSONObject listOrdersShareCode(JSONObject device, AppQueryBean query) {
query.setGateway_app("11");

@ -78,6 +78,11 @@ public class RetailAppController {
return retailAppService.listOrders(device, query);
}
@RequestMapping(value = "/orders_new", method = RequestMethod.GET)
public JSONObject listOrdersNew(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, AppQueryBean query) {
return retailAppService.listOrdersNew(device, query);
}
@RequestMapping(value = "/orders/share_code", method = RequestMethod.GET)
public JSONObject listOrdersShareCode(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, AppQueryBean query) {
return retailAppService.listOrdersShareCode(device, query);

@ -3,7 +3,7 @@
<mapper namespace="au.com.royalpay.payment.manage.analysis.mappers.BDAnalysisMapper">
<select id="getBDSaleList" resultType="com.alibaba.fastjson.JSONObject">
SELECT
d.bd_name,d.bd_id,sum(if(temp.transaction_type='Credit',temp.clearing_amount*d.proportion,0))
d.bd_name,d.bd_id,sum(if(temp.transaction_type='Credit',temp.clearing_amount*d.proportion,-temp.clearing_amount*d.proportion))
total,
ifnull(sum(if(temp.refund_id is not null,if(temp.transaction_type='Debit',temp.clearing_amount,-temp.clearing_amount)*d.proportion,0)),0) refund_fee
FROM
@ -38,7 +38,7 @@
</select>
<select id="getBDSalePartnerList" resultType="com.alibaba.fastjson.JSONObject">
SELECT
c.client_id,c.client_moniker,c.short_name,c.approve_time,IFNULL(sum(if(temp.transaction_type='Credit',temp.clearing_amount*d.proportion,0)),0)
c.client_id,c.client_moniker,c.short_name,c.approve_time,IFNULL(sum(if(temp.transaction_type='Credit',temp.clearing_amount*d.proportion,-temp.clearing_amount*d.proportion)),0)
total FROM (SELECT l.client_id,l.clearing_amount,l.transaction_type,l.refund_id,o.create_time FROM
pmt_transactions l
INNER JOIN pmt_orders o
@ -156,7 +156,7 @@
<select id="getBDSalePartnerReport" resultType="com.alibaba.fastjson.JSONObject">
SELECT c.industry,c.royalpayindustry,
count(DISTINCT c.client_id) partner_counts,
IFNULL(sum(if(temp.transaction_type='Credit',temp.clearing_amount*d.proportion,0)),0)
IFNULL(sum(if(temp.transaction_type='Credit',temp.clearing_amount*d.proportion,-temp.clearing_amount*d.proportion)),0)
total
FROM (SELECT l.client_id,l.clearing_amount,l.transaction_type,l.refund_id,o.create_time FROM pmt_transactions l
INNER JOIN pmt_orders o

@ -128,6 +128,8 @@ define(['angular', 'uiRouter', 'uiBootstrap', 'angularEcharts'], function (angul
$scope.analysis.total_partners = resp.data.total_partners;
$scope.analysis.traded_partners = resp.data.traded_partners;
$scope.analysis.trade_amount = resp.data.trade_amount;
$scope.analysis.trade_count = resp.data.trade_count;
// $scope.analysis.top_amount_order = resp.data.top_amount_order;
// $scope.analysis.trade_count = resp.data.trade_count;
// $scope.analysis.total_customers = resp.data.total_customers;
@ -140,7 +142,7 @@ define(['angular', 'uiRouter', 'uiBootstrap', 'angularEcharts'], function (angul
// $scope.analysis.traded_partners = resp.data.traded_partners;
// $scope.analysis.trade_amount = resp.data.trade_amount;
$scope.analysis.top_amount_order = resp.data.top_amount_order;
$scope.analysis.trade_count = resp.data.trade_count;
// $scope.analysis.trade_count = resp.data.trade_count;
$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;

Loading…
Cancel
Save