diff --git a/pom.xml b/pom.xml
index 7384381f5..16fc224d8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,7 +10,7 @@
4.0.0
manage
- 1.2.20
+ 1.2.21
UTF-8
diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/CustomersAnalysisService.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/CustomersAnalysisService.java
index 38ab29857..0ecbd17c8 100644
--- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/CustomersAnalysisService.java
+++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/CustomersAnalysisService.java
@@ -1,5 +1,6 @@
package au.com.royalpay.payment.manage.analysis.core;
+import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery;
import com.alibaba.fastjson.JSONObject;
import java.util.Date;
@@ -24,5 +25,7 @@ public interface CustomersAnalysisService {
void sendPartnerTransactionDaily(Date date);
List getCustomersAnalysisMonthly(JSONObject params);
+
+ JSONObject getUserEcharts(JSONObject params, JSONObject manager);
}
diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/CustomersAnalysisServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/CustomersAnalysisServiceImp.java
index 805e0fa52..28c16d48f 100644
--- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/CustomersAnalysisServiceImp.java
+++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/CustomersAnalysisServiceImp.java
@@ -8,29 +8,38 @@ import au.com.royalpay.payment.manage.mappers.log.WechatTemplateMsgSendLogMapper
import au.com.royalpay.payment.manage.mappers.payment.OrderMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
+import au.com.royalpay.payment.manage.mappers.system.CustomerMapper;
+import au.com.royalpay.payment.manage.mappers.system.ManagerCustomerRelationAlipayMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
+import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery;
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi;
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApiProvider;
import au.com.royalpay.payment.tools.connections.mpsupport.beans.TemplateMessage;
+import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
+import com.maxmind.geoip.LookupService;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
+import org.apache.commons.lang3.time.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
+import java.util.stream.Collectors;
/**
* Created by yishuqian on 10/11/2016.
@@ -51,6 +60,10 @@ public class CustomersAnalysisServiceImp implements CustomersAnalysisService {
private ClientMapper clientMapper;
@Resource
private ClientAccountMapper clientAccountMapper;
+ @Resource
+ private CustomerMapper customerMapper;
+ @Resource
+ private ManagerCustomerRelationAlipayMapper managerCustomerRelationAlipayMapper;
@Resource
private WechatTemplateMsgSendLogMapper wechatTemplateMsgSendLogMapper;
@@ -60,6 +73,8 @@ public class CustomersAnalysisServiceImp implements CustomersAnalysisService {
@Resource
private RetailAppService retailAppService;
+ @Resource
+ private LookupService lookupService;
@Override
public List getCustomersAnalysis(JSONObject params) {
@@ -95,6 +110,11 @@ public class CustomersAnalysisServiceImp implements CustomersAnalysisService {
@Override
public JSONObject getCustomersRanking(JSONObject params, int page, int limit) {
PageList logs = orderAnalysisMapper.listCustomersData(params, new PageBounds(page, limit, Order.formString("amount.desc")));
+ if (logs.size() > 0) {
+ for (JSONObject log : logs) {
+ generatorUserProfile(log, params);
+ }
+ }
JSONObject result = PageListUtils.buildPageListResult(logs);
result.put("analysis", orderAnalysisMapper.listCustomersDataAnalysis(params));
result.put("openid_type", params.getIntValue("openid_type"));
@@ -180,7 +200,7 @@ public class CustomersAnalysisServiceImp implements CustomersAnalysisService {
}
}
try {
- retailAppService.sendTransactionDailyMessage(tradeInfo,client.getIntValue("client_id"));
+ retailAppService.sendTransactionDailyMessage(tradeInfo, client.getIntValue("client_id"));
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
@@ -224,6 +244,63 @@ public class CustomersAnalysisServiceImp implements CustomersAnalysisService {
//
// }
+ @Override
+ public JSONObject getUserEcharts(JSONObject params, JSONObject manager) {
+ JSONObject graph = new JSONObject();
+ List nodes = new ArrayList<>();
+ List links = new ArrayList<>();
+ initUserInfo(nodes, params);
+ List clients = orderAnalysisMapper.listClientsByCustomerId(params);
+ JSONObject total = orderAnalysisMapper.listClientsTotalByCustomerId(params);
+ int id = 1;
+ for (JSONObject client : clients) {
+ BigDecimal clientInTotal = client.getBigDecimal("orders").divide(total.getBigDecimal("orders"), 5, RoundingMode.HALF_UP).multiply(new BigDecimal(300));
+ BigDecimal orderInTotal = client.getBigDecimal("orders").divide(total.getBigDecimal("orders"), 5, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
+ BigDecimal amountInTotal = client.getBigDecimal("total_amount").divide(total.getBigDecimal("total_amount"), 5, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
+ JSONObject node = new JSONObject();
+ node.put("id", id);
+ node.put("category", id);
+ node.put("name", client.getString("client_moniker"));
+ node.put("label", client.getString("short_name"));
+ node.put("value", client.getString("short_name"));
+ node.put("symbolSize", clientInTotal.compareTo(new BigDecimal(10))<0?10:clientInTotal.toPlainString());
+ if (clientInTotal.compareTo(new BigDecimal(300)) == 0) {
+ node.put("symbolSize", 100);
+ }
+ node.put("ignore", true);
+ node.put("flag", true);
+ node.put("draggable", true);
+ nodes.add(node);
+ JSONObject totalAmountInfo = getClientAmountInfo(id,"x0", "交易金额", client);
+ totalAmountInfo.put("label", client.getString("total_amount"));
+ totalAmountInfo.put("value", client.getBigDecimal("total_amount").setScale(2,RoundingMode.HALF_UP));
+ totalAmountInfo.put("symbolSize",amountInTotal.compareTo(new BigDecimal(10))<0?10:amountInTotal.toPlainString());
+ nodes.add(totalAmountInfo);
+ JSONObject OrdersInfo = getClientAmountInfo(id,"x1", "订单数", client);
+ OrdersInfo.put("label", client.getString("orders"));
+ OrdersInfo.put("value", client.getString("orders"));
+ OrdersInfo.put("symbolSize", orderInTotal.compareTo(new BigDecimal(10))<0?10:orderInTotal.toPlainString());
+ nodes.add(OrdersInfo);
+ JSONObject priceInfo = getClientAmountInfo(id,"x2", "客单价", client);
+ BigDecimal price = client.getBigDecimal("total_amount").divide(client.getBigDecimal("orders"), 2, RoundingMode.HALF_UP);
+ priceInfo.put("label", price.toPlainString());
+ priceInfo.put("value", price.toPlainString());
+ priceInfo.put("symbolSize", price.divide(new BigDecimal(50), 0, RoundingMode.DOWN).compareTo(new BigDecimal(10))<0?5:price.divide(new BigDecimal(50), 0, RoundingMode.DOWN).toPlainString());
+ nodes.add(priceInfo);
+ id++;
+ }
+ for (JSONObject node : nodes) {
+ JSONObject link = new JSONObject();
+ String linkId = node.getString("id");
+ link.put("source", linkId);
+ link.put("target", linkId.indexOf("x")>0?linkId.substring(0,linkId.indexOf("x")):0);
+ links.add(link);
+ }
+ graph.put("nodes", nodes);
+ graph.put("links", links);
+ return graph;
+ }
+
private int setAllClientIds(JSONObject params, int clientId) {
JSONArray client_ids = clientManager.getAllClientIds(clientId);
if (client_ids.size() > 1) {
@@ -268,6 +345,89 @@ public class CustomersAnalysisServiceImp implements CustomersAnalysisService {
return msg;
}
+ private void initUserInfo(List nodes, JSONObject params) {
+ JSONObject userInfo = new JSONObject();
+ if (params.getString("customer_id").startsWith("o")) {
+ userInfo = customerMapper.findCustomerByOpenId(params.getString("customer_id"));
+ } else {
+ userInfo = managerCustomerRelationAlipayMapper.findCustomerByUserId(params.getString("customer_id"));
+ }
+ JSONObject user = new JSONObject();
+ user.put("id", 0);
+ user.put("category", 0);
+ if (userInfo.size() > 0) {
+ user.put("name", userInfo.getString("nickname"));
+ } else {
+ user.put("name", params.getString("customer_id"));
+ }
+ user.put("symbolSize", 80);
+ user.put("ignore", true);
+ user.put("flag", true);
+ user.put("draggable", true);
+ String imgUrl = StringUtils.isNotBlank(userInfo.getString("headimg")) ? userInfo.getString("headimg") : PlatformEnvironment.getEnv().concatUrl("/static/images/r_logo.svg");
+ user.put("symbol", "image://" + imgUrl);
+ nodes.add(user);
+ }
+
+ private JSONObject getClientAmountInfo(int oldId, String newId, String name, JSONObject client) {
+ JSONObject amountInfo = new JSONObject();
+ amountInfo.put("ignore", true);
+ amountInfo.put("flag", true);
+ amountInfo.put("draggable", true);
+ amountInfo.put("id", String.valueOf(oldId) + newId);
+ amountInfo.put("name", name);
+ return amountInfo;
+ }
+
+ private void generatorUserProfile(JSONObject customer, JSONObject params) {
+ List topAddress = new ArrayList<>();
+ String topAmountRange = "None";
+ String topTimeRange = "None";
+ params.put("customer_id", customer.getString("customer_id"));
+ List mostUseClientsByCustomer = orderAnalysisMapper.mostUseClientsByCustomer(params);
+ List mostUseIndustryByCustomer = orderAnalysisMapper.mostUseIndustryByCustomer(params);
+ List mostUseAddressByCustomer = orderAnalysisMapper.mostUseAddressByCustomer(params);
+ for (JSONObject address : mostUseAddressByCustomer) {
+ String city = lookupService.getLocation(address.getString("customer_ip")).city;
+ if (topAddress.size() < 3 && !topAddress.contains(city)) {
+ topAddress.add(city);
+ }
+ }
+ JSONObject mostUseAmountByCustomer = orderAnalysisMapper.mostUseAmountByCustomer(params);
+ if (mostUseAmountByCustomer != null) {
+ int amount = mostUseAmountByCustomer.getIntValue("amount_int");
+ if (amount == 0) {
+ topAmountRange = "0~100";
+ }else {
+ topAmountRange = String.valueOf(amount * 100) + "~" + String.valueOf((amount + 1) * 100);
+ }
+ }
+ JSONObject mostUseTimesByCustomer = orderAnalysisMapper.mostUseTimesByCustomer(params);
+ if (mostUseTimesByCustomer != null) {
+ Date orderDate = mostUseTimesByCustomer.getDate("create_time");
+ Date nextHourDate = DateUtils.addHours(orderDate, 1);
+ orderDate = DateUtils.setMinutes(orderDate, 0);
+ nextHourDate = DateUtils.setMinutes(nextHourDate, 0);
+ topTimeRange = DateFormatUtils.format(orderDate, "HH:mm") + "-" + DateFormatUtils.format(nextHourDate, "HH:mm");
+ }
+ customer.put("top_clients", getTopInfo(mostUseClientsByCustomer, "client_moniker"));
+ customer.put("top_industry", getTopInfo(mostUseIndustryByCustomer, "royalpayindustry"));
+ customer.put("top_citys", String.join(",", topAddress));
+ customer.put("amount_range", topAmountRange);
+ customer.put("hour_range", topTimeRange);
+ customer.put("price", customer.getBigDecimal("amount").divide(customer.getBigDecimal("orders"), 2, RoundingMode.HALF_UP).toPlainString());
+
+
+ }
+
+ private String getTopInfo(List list, String key) {
+ if (list != null && list.size() > 0) {
+ List clients = list.stream().map(e -> e.getString(key)).collect(Collectors.toList());
+ return String.join(",", clients);
+ }
+ return "None";
+ }
+
// private TemplateMessage initWxMsg(JSONObject tradeInfo,String short_name,String clientCounts, String openId, String templateId,String path,String color) {
//
diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/OrderAnalysisMapper.java b/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/OrderAnalysisMapper.java
index 6119fb777..0b3a84463 100644
--- a/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/OrderAnalysisMapper.java
+++ b/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/OrderAnalysisMapper.java
@@ -22,10 +22,23 @@ public interface OrderAnalysisMapper {
JSONObject analysisOrderSuccessRateDetailOfGlobal(@Param("date") Date date);
- @CountRef(".countCustomersData")
PageList listCustomersData(JSONObject params, PageBounds pageBounds);
int countCustomersData(JSONObject params);
JSONObject listCustomersDataAnalysis(JSONObject params);
+
+ List listClientsByCustomerId(JSONObject params);
+
+ JSONObject listClientsTotalByCustomerId(JSONObject params);
+
+ List mostUseClientsByCustomer(JSONObject params);
+
+ List mostUseIndustryByCustomer(JSONObject params);
+
+ List mostUseAddressByCustomer(JSONObject params);
+
+ JSONObject mostUseAmountByCustomer(JSONObject params);
+
+ JSONObject mostUseTimesByCustomer(JSONObject params);
}
diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/web/CustomersAnalysisController.java b/src/main/java/au/com/royalpay/payment/manage/analysis/web/CustomersAnalysisController.java
index 4d3528399..501db3123 100644
--- a/src/main/java/au/com/royalpay/payment/manage/analysis/web/CustomersAnalysisController.java
+++ b/src/main/java/au/com/royalpay/payment/manage/analysis/web/CustomersAnalysisController.java
@@ -123,5 +123,17 @@ public class CustomersAnalysisController {
return customersAnalysisService.getOrdersByOpenid(params, tradeLogQuery.getPage(), tradeLogQuery.getLimit());
}
+ @ManagerMapping(value = "/{customer_id}/user_echarts")
+ @ReadOnlyConnection
+ public JSONObject getUserEcharts(@PathVariable String customer_id, AnalysisBean analysisBean, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
+ JSONObject params = analysisBean.toParams(null);
+ params.put("customer_id", customer_id);
+ params.put("status", 5);
+ if (manager.getInteger("org_id") != null) {
+ params.put("org_id", manager.getIntValue("org_id"));
+ }
+ return customersAnalysisService.getUserEcharts(params, manager);
+ }
+
}
diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java
index efab02aaa..206378602 100644
--- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java
+++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java
@@ -8,18 +8,15 @@ import au.com.royalpay.payment.manage.merchants.beans.ClientUpdateInfo;
import au.com.royalpay.payment.manage.notice.beans.NoticeInfo;
import au.com.royalpay.payment.manage.signin.beans.ChangePwdBean;
import au.com.royalpay.payment.tools.merchants.beans.QRCodeConfig;
-import au.com.royalpay.payment.tools.merchants.beans.UpdateSurchargeDTO;
-
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.multipart.MultipartFile;
+import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
-import javax.servlet.http.HttpServletResponse;
-
/**
* Created by yishuqian on 28/03/2017.
diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java
index 6c5dc554f..c0db20b89 100644
--- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java
+++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java
@@ -57,21 +57,16 @@ import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
import au.com.royalpay.payment.tools.locale.LocaleSupport;
import au.com.royalpay.payment.tools.merchants.beans.QRCodeConfig;
-import au.com.royalpay.payment.tools.merchants.beans.UpdateSurchargeDTO;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import au.com.royalpay.payment.tools.permission.enums.PartnerRole;
import au.com.royalpay.payment.tools.threadpool.RoyalThreadPoolExecutor;
import au.com.royalpay.payment.tools.utils.*;
-
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
-
-import com.github.qcloudsms.httpclient.HTTPException;
-import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.RandomUtils;
@@ -82,7 +77,6 @@ import org.joda.time.DateTime;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
@@ -92,31 +86,19 @@ import org.springframework.web.multipart.MultipartFile;
import org.thymeleaf.context.Context;
import org.thymeleaf.spring5.SpringTemplateEngine;
-import java.awt.image.BufferedImage;
+import javax.annotation.Resource;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
import java.io.*;
-import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.TimeZone;
+import java.util.*;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
-import java.util.stream.Collectors;
-
-import javax.annotation.Resource;
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServletResponse;
/**
* Created by yishuqian on 28/03/2017.
@@ -294,7 +276,7 @@ public class RetailAppServiceImp implements RetailAppService {
params.put("client_id", client_id);
List res = transactionAnalysisMapper.getWeekClientTransaction(params);
res.forEach(r -> {
- r.put("date",r.getDate("date").toString());
+ r.put("date", r.getDate("date").toString());
});
res.remove(res.size() - 1);
return res;
@@ -1545,9 +1527,11 @@ public class RetailAppServiceImp implements RetailAppService {
@Override
public JSONObject bankAccountInfo(JSONObject device) {
String clientType = device.getString("client_type");
- deviceSupport.findRegister(clientType);
+ DeviceRegister register = deviceSupport.findRegister(clientType);
JSONObject bankInfo = clientManager.getBankAccountByClientId(device.getIntValue("client_id"));
- bankInfo.put("account_no", "***" + StringUtils.substring(bankInfo.getString("account_no"), -4));
+ if (register.hideBankDetails()) {
+ bankInfo.put("account_no", "***" + StringUtils.substring(bankInfo.getString("account_no"), -4));
+ }
return bankInfo;
}
@@ -2406,7 +2390,7 @@ public class RetailAppServiceImp implements RetailAppService {
}
@Override
- public JSONObject getClientAggregateFile(JSONObject device,MultipartFile file, String userAgent) throws IOException{
+ public JSONObject getClientAggregateFile(JSONObject device, MultipartFile file, String userAgent) throws IOException {
String clientType = device.getString("client_type");
deviceSupport.findRegister(clientType);
@@ -2445,7 +2429,7 @@ public class RetailAppServiceImp implements RetailAppService {
JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id"));
JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
account.put("photo_info", photoInfo);
- clientManager.commitAuthFilesToCompliance(client.getString("client_moniker"), account,"App");
+ clientManager.commitAuthFilesToCompliance(client.getString("client_moniker"), account, "App");
}
@Override
diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/extend/GatewayOAuthRegister.java b/src/main/java/au/com/royalpay/payment/manage/appclient/extend/GatewayOAuthRegister.java
index 11002c74b..dfe200f7a 100644
--- a/src/main/java/au/com/royalpay/payment/manage/appclient/extend/GatewayOAuthRegister.java
+++ b/src/main/java/au/com/royalpay/payment/manage/appclient/extend/GatewayOAuthRegister.java
@@ -37,6 +37,11 @@ public class GatewayOAuthRegister implements DeviceRegister {
return CLIENT_TYPE;
}
+ @Override
+ public boolean hideBankDetails() {
+ return false;
+ }
+
@Override
public JSONObject register(String encrypted, int type) {
return null;
diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java b/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java
index af347377a..e21ca8464 100644
--- a/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java
+++ b/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java
@@ -210,17 +210,17 @@ public class RetailAppController {
}
@GetMapping("/bank_account")
- public JSONObject getBankAccountInfo(@ModelAttribute("RETAIL_DEVICE") JSONObject device) {
+ public JSONObject getBankAccountInfo(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
return retailAppService.bankAccountInfo(device);
}
@GetMapping("/current_rate")
- public JSONObject getClientRate(@ModelAttribute("RETAIL_DEVICE") JSONObject device) {
+ public JSONObject getClientRate(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
return retailAppService.getClientCurrentRate(device);
}
@GetMapping("/current_rate_new")
- public JSONObject getClientCurrentRateNew(@ModelAttribute("RETAIL_DEVICE") JSONObject device) {
+ public JSONObject getClientCurrentRateNew(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
return retailAppService.getClientCurrentRateNew(device);
}
diff --git a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/OrderAnalysisMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/OrderAnalysisMapper.xml
index ada34a2a8..0ab520bda 100644
--- a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/OrderAnalysisMapper.xml
+++ b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/OrderAnalysisMapper.xml
@@ -15,198 +15,210 @@
+
+
+
+
+
+
+
+
+
+
@@ -290,7 +391,50 @@
and o.org_id=#{org_id}
and o.org_id in
- #{org_id}
+ #{org_id}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.xml
index 87b4b3557..84e0fbc5c 100644
--- a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.xml
+++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.xml
@@ -571,7 +571,7 @@
and o.status>#{include_success_status}
- and ocreate_time >= #{from}
+ and o.create_time >= #{from}
and o.create_time < #{to}
and c.org_id=#{org_id}
and c.org_id in
diff --git a/src/main/ui/static/analysis/customer_analysis.js b/src/main/ui/static/analysis/customer_analysis.js
index a46191474..13878c95b 100644
--- a/src/main/ui/static/analysis/customer_analysis.js
+++ b/src/main/ui/static/analysis/customer_analysis.js
@@ -13,6 +13,57 @@ define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', '
})
}]);
app.controller('customersListCtrl', ['$scope', '$http','$filter', '$uibModal', 'commonDialog', 'orderService', 'refunder', function ($scope, $http,$filter, $uibModal, commonDialog, orderService, refunder) {
+ $scope.one_customer = {};
+ var echartsConfig = function (graph) {
+ var categories = [];
+ var c = 0;
+ for (var i = 0; i < $scope.graph.nodes.length; i++) {
+ var id = ($scope.graph.nodes[i].id).toString();
+ if (id.indexOf("x") < 0) {
+ categories[c] = {
+ name: $scope.graph.nodes[i].name
+ };
+ c++;
+ }
+ }
+ $scope.graph.nodes.forEach(function (node) {
+ node.itemStyle = null;
+ // Use random x, y
+ node.x = node.y = null;
+ node.draggable = true;
+ });
+ return {
+ tooltip: {},
+ legend: [{
+ // selectedMode: 'single',
+ data: categories.map(function (a) {
+ return a.name;
+ })
+ }],
+ animation: false,
+ series : [
+ {
+ name: "用户关系图",
+ type: 'graph',
+ layout: 'force',
+ data: graph.nodes,
+ links: graph.links,
+ categories: categories,
+ roam: false,
+ label: {
+ show: true
+ },
+ focusNodeAdjacency: true,
+ draggable: false,
+ symbolRotate:undefined,
+ force: {
+ repulsion: 50,
+ edgeLength: [300, 200]
+ }
+ }
+ ]
+ };
+ };
$scope.pagination = {};
$scope.params = {};
$scope.params.openid_type = '0';
@@ -77,6 +128,8 @@ define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', '
$http.get('/analysis/customers/ranking/'+$scope.params.openid_type, {params: params}).then(function (resp) {
$scope.customer_loading = false;
$scope.customers = resp.data.data;
+ $scope.checkoutCustomer($scope.customers[0]);
+ $scope.generatorEcharts($scope.customers[0].customer_id);
$scope.customers_type = resp.data.openid_type;
$scope.pagination = resp.data.pagination;
if($scope.customers.length>0){
@@ -88,6 +141,18 @@ define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', '
}
});
+ $scope.checkoutCustomer = function (data) {
+ $scope.one_customer = data;
+ $scope.one_customer.industry = data.top_industry.split(",");
+ $scope.one_customer.clients = data.top_clients.split(",");
+ };
+ $scope.generatorEcharts = function (customer_id) {
+ $http.get('/analysis/customers/'+ customer_id + '/user_echarts', {params: params}).then(function (resp) {
+ $scope.graph = resp.data;
+ $scope.testobj = echartsConfig($scope.graph);
+ });
+ };
+
$http.get('/analysis/customers/ranking/'+$scope.params.openid_type+'/total', {params: params}).then(function (resp) {
$scope.customers_analysis = resp.data.analysis;
});
@@ -135,12 +200,12 @@ define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', '
// $scope.order_loading = true;
$scope.listCustomerOrders = function (page) {
$scope.order_loading = true;
- var params = angular.copy($scope.order_params) || {};
- if (params.datefrom) {
- params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd');
+ var params = angular.copy($scope.params) || {};
+ if (params.begin) {
+ params.datefrom = $filter('date')(params.begin, 'yyyyMMdd');
}
- if (params.dateto) {
- params.dateto = $filter('date')(params.dateto, 'yyyyMMdd');
+ if (params.end) {
+ params.dateto = $filter('date')(params.end, 'yyyyMMdd');
}
params.gateway = [0, 1];
params.page = page || $scope.orderPagination.page || 1;
diff --git a/src/main/ui/static/analysis/templates/customer_analysis.html b/src/main/ui/static/analysis/templates/customer_analysis.html
index 9009da9f9..23f0f3fcb 100644
--- a/src/main/ui/static/analysis/templates/customer_analysis.html
+++ b/src/main/ui/static/analysis/templates/customer_analysis.html
@@ -1,3 +1,22 @@
+