Merge branch 'develop'

# Conflicts:
#	pom.xml
master
luoyang 5 years ago
commit f1b5d7abee

@ -10,7 +10,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId> <artifactId>manage</artifactId>
<version>1.2.20</version> <version>1.2.21</version>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

@ -1,5 +1,6 @@
package au.com.royalpay.payment.manage.analysis.core; package au.com.royalpay.payment.manage.analysis.core;
import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import java.util.Date; import java.util.Date;
@ -24,5 +25,7 @@ public interface CustomersAnalysisService {
void sendPartnerTransactionDaily(Date date); void sendPartnerTransactionDaily(Date date);
List<JSONObject> getCustomersAnalysisMonthly(JSONObject params); List<JSONObject> getCustomersAnalysisMonthly(JSONObject params);
JSONObject getUserEcharts(JSONObject params, JSONObject manager);
} }

@ -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.payment.OrderMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper; 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.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.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.MpWechatApi;
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApiProvider; 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.connections.mpsupport.beans.TemplateMessage;
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.utils.PageListUtils; import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.github.miemiedev.mybatis.paginator.domain.PageList;
import com.maxmind.geoip.LookupService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* Created by yishuqian on 10/11/2016. * Created by yishuqian on 10/11/2016.
@ -51,6 +60,10 @@ public class CustomersAnalysisServiceImp implements CustomersAnalysisService {
private ClientMapper clientMapper; private ClientMapper clientMapper;
@Resource @Resource
private ClientAccountMapper clientAccountMapper; private ClientAccountMapper clientAccountMapper;
@Resource
private CustomerMapper customerMapper;
@Resource
private ManagerCustomerRelationAlipayMapper managerCustomerRelationAlipayMapper;
@Resource @Resource
private WechatTemplateMsgSendLogMapper wechatTemplateMsgSendLogMapper; private WechatTemplateMsgSendLogMapper wechatTemplateMsgSendLogMapper;
@ -60,6 +73,8 @@ public class CustomersAnalysisServiceImp implements CustomersAnalysisService {
@Resource @Resource
private RetailAppService retailAppService; private RetailAppService retailAppService;
@Resource
private LookupService lookupService;
@Override @Override
public List<JSONObject> getCustomersAnalysis(JSONObject params) { public List<JSONObject> getCustomersAnalysis(JSONObject params) {
@ -95,6 +110,11 @@ public class CustomersAnalysisServiceImp implements CustomersAnalysisService {
@Override @Override
public JSONObject getCustomersRanking(JSONObject params, int page, int limit) { public JSONObject getCustomersRanking(JSONObject params, int page, int limit) {
PageList<JSONObject> logs = orderAnalysisMapper.listCustomersData(params, new PageBounds(page, limit, Order.formString("amount.desc"))); PageList<JSONObject> 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); JSONObject result = PageListUtils.buildPageListResult(logs);
result.put("analysis", orderAnalysisMapper.listCustomersDataAnalysis(params)); result.put("analysis", orderAnalysisMapper.listCustomersDataAnalysis(params));
result.put("openid_type", params.getIntValue("openid_type")); result.put("openid_type", params.getIntValue("openid_type"));
@ -180,7 +200,7 @@ public class CustomersAnalysisServiceImp implements CustomersAnalysisService {
} }
} }
try { try {
retailAppService.sendTransactionDailyMessage(tradeInfo,client.getIntValue("client_id")); retailAppService.sendTransactionDailyMessage(tradeInfo, client.getIntValue("client_id"));
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage(), 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<JSONObject> nodes = new ArrayList<>();
List<JSONObject> links = new ArrayList<>();
initUserInfo(nodes, params);
List<JSONObject> 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) { private int setAllClientIds(JSONObject params, int clientId) {
JSONArray client_ids = clientManager.getAllClientIds(clientId); JSONArray client_ids = clientManager.getAllClientIds(clientId);
if (client_ids.size() > 1) { if (client_ids.size() > 1) {
@ -268,6 +345,89 @@ public class CustomersAnalysisServiceImp implements CustomersAnalysisService {
return msg; return msg;
} }
private void initUserInfo(List<JSONObject> 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<String> topAddress = new ArrayList<>();
String topAmountRange = "None";
String topTimeRange = "None";
params.put("customer_id", customer.getString("customer_id"));
List<JSONObject> mostUseClientsByCustomer = orderAnalysisMapper.mostUseClientsByCustomer(params);
List<JSONObject> mostUseIndustryByCustomer = orderAnalysisMapper.mostUseIndustryByCustomer(params);
List<JSONObject> 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<JSONObject> list, String key) {
if (list != null && list.size() > 0) {
List<String> 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) { // private TemplateMessage initWxMsg(JSONObject tradeInfo,String short_name,String clientCounts, String openId, String templateId,String path,String color) {
// //

@ -22,10 +22,23 @@ public interface OrderAnalysisMapper {
JSONObject analysisOrderSuccessRateDetailOfGlobal(@Param("date") Date date); JSONObject analysisOrderSuccessRateDetailOfGlobal(@Param("date") Date date);
@CountRef(".countCustomersData")
PageList<JSONObject> listCustomersData(JSONObject params, PageBounds pageBounds); PageList<JSONObject> listCustomersData(JSONObject params, PageBounds pageBounds);
int countCustomersData(JSONObject params); int countCustomersData(JSONObject params);
JSONObject listCustomersDataAnalysis(JSONObject params); JSONObject listCustomersDataAnalysis(JSONObject params);
List<JSONObject> listClientsByCustomerId(JSONObject params);
JSONObject listClientsTotalByCustomerId(JSONObject params);
List<JSONObject> mostUseClientsByCustomer(JSONObject params);
List<JSONObject> mostUseIndustryByCustomer(JSONObject params);
List<JSONObject> mostUseAddressByCustomer(JSONObject params);
JSONObject mostUseAmountByCustomer(JSONObject params);
JSONObject mostUseTimesByCustomer(JSONObject params);
} }

@ -123,5 +123,17 @@ public class CustomersAnalysisController {
return customersAnalysisService.getOrdersByOpenid(params, tradeLogQuery.getPage(), tradeLogQuery.getLimit()); 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);
}
} }

@ -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.notice.beans.NoticeInfo;
import au.com.royalpay.payment.manage.signin.beans.ChangePwdBean; 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.QRCodeConfig;
import au.com.royalpay.payment.tools.merchants.beans.UpdateSurchargeDTO;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.servlet.http.HttpServletResponse;
/** /**
* Created by yishuqian on 28/03/2017. * Created by yishuqian on 28/03/2017.

@ -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.exceptions.ServerErrorException;
import au.com.royalpay.payment.tools.locale.LocaleSupport; 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.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.merchants.core.MerchantInfoProvider;
import au.com.royalpay.payment.tools.permission.enums.PartnerRole; import au.com.royalpay.payment.tools.permission.enums.PartnerRole;
import au.com.royalpay.payment.tools.threadpool.RoyalThreadPoolExecutor; import au.com.royalpay.payment.tools.threadpool.RoyalThreadPoolExecutor;
import au.com.royalpay.payment.tools.utils.*; import au.com.royalpay.payment.tools.utils.*;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.github.miemiedev.mybatis.paginator.domain.PageList;
import com.github.qcloudsms.httpclient.HTTPException;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.RandomUtils; import org.apache.commons.lang3.RandomUtils;
@ -82,7 +77,6 @@ import org.joda.time.DateTime;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
import org.jsoup.nodes.Document; import org.jsoup.nodes.Document;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -92,31 +86,19 @@ import org.springframework.web.multipart.MultipartFile;
import org.thymeleaf.context.Context; import org.thymeleaf.context.Context;
import org.thymeleaf.spring5.SpringTemplateEngine; 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.io.*;
import java.lang.reflect.Array;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.*;
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.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit; 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. * Created by yishuqian on 28/03/2017.
@ -294,7 +276,7 @@ public class RetailAppServiceImp implements RetailAppService {
params.put("client_id", client_id); params.put("client_id", client_id);
List<JSONObject> res = transactionAnalysisMapper.getWeekClientTransaction(params); List<JSONObject> res = transactionAnalysisMapper.getWeekClientTransaction(params);
res.forEach(r -> { res.forEach(r -> {
r.put("date",r.getDate("date").toString()); r.put("date", r.getDate("date").toString());
}); });
res.remove(res.size() - 1); res.remove(res.size() - 1);
return res; return res;
@ -1545,9 +1527,11 @@ public class RetailAppServiceImp implements RetailAppService {
@Override @Override
public JSONObject bankAccountInfo(JSONObject device) { public JSONObject bankAccountInfo(JSONObject device) {
String clientType = device.getString("client_type"); String clientType = device.getString("client_type");
deviceSupport.findRegister(clientType); DeviceRegister register = deviceSupport.findRegister(clientType);
JSONObject bankInfo = clientManager.getBankAccountByClientId(device.getIntValue("client_id")); JSONObject bankInfo = clientManager.getBankAccountByClientId(device.getIntValue("client_id"));
if (register.hideBankDetails()) {
bankInfo.put("account_no", "***" + StringUtils.substring(bankInfo.getString("account_no"), -4)); bankInfo.put("account_no", "***" + StringUtils.substring(bankInfo.getString("account_no"), -4));
}
return bankInfo; return bankInfo;
} }
@ -2406,7 +2390,7 @@ public class RetailAppServiceImp implements RetailAppService {
} }
@Override @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"); String clientType = device.getString("client_type");
deviceSupport.findRegister(clientType); deviceSupport.findRegister(clientType);
@ -2445,7 +2429,7 @@ public class RetailAppServiceImp implements RetailAppService {
JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id")); JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id"));
JSONObject account = clientAccountMapper.findById(device.getString("account_id")); JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
account.put("photo_info", photoInfo); account.put("photo_info", photoInfo);
clientManager.commitAuthFilesToCompliance(client.getString("client_moniker"), account,"App"); clientManager.commitAuthFilesToCompliance(client.getString("client_moniker"), account, "App");
} }
@Override @Override

@ -37,6 +37,11 @@ public class GatewayOAuthRegister implements DeviceRegister {
return CLIENT_TYPE; return CLIENT_TYPE;
} }
@Override
public boolean hideBankDetails() {
return false;
}
@Override @Override
public JSONObject register(String encrypted, int type) { public JSONObject register(String encrypted, int type) {
return null; return null;

@ -210,17 +210,17 @@ public class RetailAppController {
} }
@GetMapping("/bank_account") @GetMapping("/bank_account")
public JSONObject getBankAccountInfo(@ModelAttribute("RETAIL_DEVICE") JSONObject device) { public JSONObject getBankAccountInfo(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
return retailAppService.bankAccountInfo(device); return retailAppService.bankAccountInfo(device);
} }
@GetMapping("/current_rate") @GetMapping("/current_rate")
public JSONObject getClientRate(@ModelAttribute("RETAIL_DEVICE") JSONObject device) { public JSONObject getClientRate(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
return retailAppService.getClientCurrentRate(device); return retailAppService.getClientCurrentRate(device);
} }
@GetMapping("/current_rate_new") @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); return retailAppService.getClientCurrentRateNew(device);
} }

@ -15,6 +15,7 @@
<select id="analysisOrderSuccessRateInTypes" resultMap="successRateInTypes"> <select id="analysisOrderSuccessRateInTypes" resultMap="successRateInTypes">
<![CDATA[ <![CDATA[
SELECT SELECT
t.*, t.*,
format(t.success / t.total * 100, 2) percentage format(t.success / t.total * 100, 2) percentage
@ -49,11 +50,13 @@
GROUP BY date(o.create_time), o.gateway GROUP BY date(o.create_time), o.gateway
) t ) t
]]> ]]>
</select> </select>
<select id="analysisOrderSuccessRateOfAll" resultMap="successRateInTypes"> <select id="analysisOrderSuccessRateOfAll" resultMap="successRateInTypes">
<![CDATA[ <![CDATA[
SELECT SELECT
t.*, t.*,
format(t.success / t.total * 100, 2) percentage format(t.success / t.total * 100, 2) percentage
@ -71,11 +74,13 @@
GROUP BY date(o.create_time) GROUP BY date(o.create_time)
) t ) t
]]> ]]>
</select> </select>
<select id="analysisOrderSuccessRateDetailOfClients" resultType="com.alibaba.fastjson.JSONObject"> <select id="analysisOrderSuccessRateDetailOfClients" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[ <![CDATA[
SELECT SELECT
t.*, t.*,
format(t.success / t.total * 100, 2) percentage, format(t.success / t.total * 100, 2) percentage,
@ -137,11 +142,13 @@
) t ) t
ORDER BY t.failed DESC ORDER BY t.failed DESC
]]> ]]>
</select> </select>
<select id="analysisOrderSuccessRateDetailOfGlobal" resultType="com.alibaba.fastjson.JSONObject"> <select id="analysisOrderSuccessRateDetailOfGlobal" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[ <![CDATA[
SELECT SELECT
t.*, t.*,
format(t.success / t.total * 100, 2) percentage, format(t.success / t.total * 100, 2) percentage,
@ -193,20 +200,25 @@
WHERE o.status > 1 AND DATE(o.create_time) = DATE(#{date}) WHERE o.status > 1 AND DATE(o.create_time) = DATE(#{date})
) t ) t
]]> ]]>
</select> </select>
<select id="listCustomersData" resultType="com.alibaba.fastjson.JSONObject"> <select id="listCustomersData" resultType="com.alibaba.fastjson.JSONObject">
SELECT r.nickname,r.headimg,o.customer_id,sum(if(o.status='5',o.customer_payment_amount,0)) amount, SELECT r.nickname,r.headimg,r.sex,o.customer_id,sum(o.customer_payment_amount) amount,
COUNT(DISTINCT o.order_id) orders,max(o.customer_payment_amount) max_order COUNT(DISTINCT o.order_id) orders,max(o.customer_payment_amount) max_order
FROM pmt_orders o FROM pmt_orders o
<if test="openid_type==4"> <if test="openid_type==4">
LEFT JOIN sys_customer_relation r on r.globalpay_openid = o.customer_id LEFT JOIN sys_customer_relation r on r.globalpay_openid = o.customer_id
</if> </if>
<if test="openid_type!=4"> <if test="openid_type==2">
LEFT JOIN sys_customer_relation_alipay r on r.alipay_uid = o.customer_id
</if>
<if test="openid_type!=4 and openid_type!=2">
LEFT JOIN sys_customer_relation r on r.wechat_openid = o.customer_id LEFT JOIN sys_customer_relation r on r.wechat_openid = o.customer_id
</if> </if>
<where> <where>
o.status>4
<if test="begin!=null">and o.create_time &gt;= #{begin}</if> <if test="begin!=null">and o.create_time &gt;= #{begin}</if>
<if test="end!=null">and o.create_time &lt; #{end}</if> <if test="end!=null">and o.create_time &lt; #{end}</if>
<if test="openid_type==0"> <if test="openid_type==0">
@ -229,11 +241,99 @@
</if> </if>
<if test="org_id!=null and org_ids==null">and o.org_id=#{org_id}</if> <if test="org_id!=null and org_ids==null">and o.org_id=#{org_id}</if>
<if test="org_ids!=null">and o.org_id in <if test="org_ids!=null">and o.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if> <foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
</where> </where>
GROUP BY o.customer_id GROUP BY o.customer_id
</select> </select>
<select id="mostUseClientsByCustomer" resultType="com.alibaba.fastjson.JSONObject">
select o.client_id,c.client_moniker,count(1) as orders from pmt_orders o INNER JOIN sys_clients c on
c.client_id=o.client_id
<where>
o.status>4
<if test="begin!=null">and o.create_time &gt;= #{begin}</if>
<if test="end!=null">and o.create_time &lt; #{end}</if>
<if test="customer_id!=null">
and o.customer_id=#{customer_id}
</if>
<if test="org_id!=null and org_ids==null">and o.org_id=#{org_id}</if>
<if test="org_ids!=null">and o.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
</where>
GROUP BY client_id order by orders desc limit 3;
</select>
<select id="mostUseIndustryByCustomer" resultType="com.alibaba.fastjson.JSONObject">
select o.client_id,c.royalpayindustry,count(1) as orders from pmt_orders o INNER JOIN sys_clients c on
c.client_id=o.client_id
<where>
o.status>4
<if test="begin!=null">and o.create_time &gt;= #{begin}</if>
<if test="end!=null">and o.create_time &lt; #{end}</if>
<if test="customer_id!=null">
and o.customer_id=#{customer_id}
</if>
<if test="org_id!=null and org_ids==null">and o.org_id=#{org_id}</if>
<if test="org_ids!=null">and o.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
</where>
GROUP BY c.royalpayindustry order by orders desc limit 3;
</select>
<select id="mostUseAddressByCustomer" resultType="com.alibaba.fastjson.JSONObject">
select o.customer_ip,count(1) as orders from pmt_orders o
<where>
o.status>4
<if test="begin!=null">and o.create_time &gt;= #{begin}</if>
<if test="end!=null">and o.create_time &lt; #{end}</if>
<if test="customer_id!=null">
and o.customer_id=#{customer_id}
</if>
<if test="org_id!=null and org_ids==null">and o.org_id=#{org_id}</if>
<if test="org_ids!=null">and o.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
</where>
GROUP BY substring_index(o.customer_ip,'.',2) order by orders desc limit 10;
</select>
<select id="mostUseAmountByCustomer" resultType="com.alibaba.fastjson.JSONObject">
SELECT count(1) as orders ,substring_index((o.customer_payment_amount/100),'.',1) as amount_int from pmt_orders o
<where>
o.status>4
<if test="begin!=null">and o.create_time &gt;= #{begin}</if>
<if test="end!=null">and o.create_time &lt; #{end}</if>
<if test="customer_id!=null">
and o.customer_id=#{customer_id}
</if>
<if test="org_id!=null and org_ids==null">and o.org_id=#{org_id}</if>
<if test="org_ids!=null">and o.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
</where>
GROUP BY substring_index((o.customer_payment_amount/100),'.',1) order by orders desc limit 1;
</select>
<select id="mostUseTimesByCustomer" resultType="com.alibaba.fastjson.JSONObject">
SELECT count(1) as orders ,hour(o.create_time),o.create_time from pmt_orders o
<where>
o.status>4
<if test="begin!=null">and o.create_time &gt;= #{begin}</if>
<if test="end!=null">and o.create_time &lt; #{end}</if>
<if test="customer_id!=null">
and o.customer_id=#{customer_id}
</if>
<if test="org_id!=null and org_ids==null">and o.org_id=#{org_id}</if>
<if test="org_ids!=null">and o.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
</where>
GROUP BY hour(o.create_time) order by orders desc limit 1
</select>
<select id="countCustomersData" resultType="int"> <select id="countCustomersData" resultType="int">
SELECT count(distinct o.customer_id) SELECT count(distinct o.customer_id)
FROM pmt_orders o FROM pmt_orders o
@ -260,7 +360,8 @@
</if> </if>
<if test="org_id!=null and org_ids==null">and o.org_id=#{org_id}</if> <if test="org_id!=null and org_ids==null">and o.org_id=#{org_id}</if>
<if test="org_ids!=null">and o.org_id in <if test="org_ids!=null">and o.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if> <foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
</where> </where>
</select> </select>
@ -290,7 +391,50 @@
</if> </if>
<if test="org_id!=null and org_ids==null">and o.org_id=#{org_id}</if> <if test="org_id!=null and org_ids==null">and o.org_id=#{org_id}</if>
<if test="org_ids!=null">and o.org_id in <if test="org_ids!=null">and o.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if> <foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
</where>
</select>
<select id="listClientsByCustomerId" resultType="com.alibaba.fastjson.JSONObject">
SELECT COUNT(1) as orders,SUM(IF(t.transaction_type='Credit',t.clearing_amount,0))
total_amount,c.client_moniker,c.short_name,o.customer_id,c.royalpayindustry,o.customer_ip
FROM pmt_orders o
INNER JOIN sys_clients c ON o.client_id=c.client_id
INNER JOIN pmt_transactions t ON t.order_id = o.order_id
<where>
o.status>4
<if test="begin!=null">and o.create_time &gt;= #{begin}</if>
<if test="end!=null">and o.create_time &lt; #{end}</if>
<if test="customer_id!=null">
and o.customer_id=#{customer_id}
</if>
<if test="org_id!=null and org_ids==null">and o.org_id=#{org_id}</if>
<if test="org_ids!=null">and o.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
</where> </where>
GROUP BY o.client_id ORDER BY orders DESC
</select> </select>
<select id="listClientsTotalByCustomerId" resultType="com.alibaba.fastjson.JSONObject">
SELECT COUNT(1) as orders,SUM(IF(t.transaction_type='Credit',t.clearing_amount,0))
total_amount
FROM pmt_orders o
INNER JOIN sys_clients c ON o.client_id=c.client_id
INNER JOIN pmt_transactions t ON t.order_id = o.order_id
<where>
o.status>4
<if test="begin!=null">and o.create_time &gt;= #{begin}</if>
<if test="end!=null">and o.create_time &lt; #{end}</if>
<if test="customer_id!=null">
and o.customer_id=#{customer_id}
</if>
<if test="org_id!=null and org_ids==null">and o.org_id=#{org_id}</if>
<if test="org_ids!=null">and o.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
</where>
</select>
</mapper> </mapper>

@ -571,7 +571,7 @@
<if test="include_success_status != null"> <if test="include_success_status != null">
and o.status>#{include_success_status} and o.status>#{include_success_status}
</if> </if>
<if test="from!=null">and ocreate_time &gt;= #{from}</if> <if test="from!=null">and o.create_time &gt;= #{from}</if>
<if test="to!=null">and o.create_time &lt; #{to}</if> <if test="to!=null">and o.create_time &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

@ -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) { 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.pagination = {};
$scope.params = {}; $scope.params = {};
$scope.params.openid_type = '0'; $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) { $http.get('/analysis/customers/ranking/'+$scope.params.openid_type, {params: params}).then(function (resp) {
$scope.customer_loading = false; $scope.customer_loading = false;
$scope.customers = resp.data.data; $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.customers_type = resp.data.openid_type;
$scope.pagination = resp.data.pagination; $scope.pagination = resp.data.pagination;
if($scope.customers.length>0){ 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) { $http.get('/analysis/customers/ranking/'+$scope.params.openid_type+'/total', {params: params}).then(function (resp) {
$scope.customers_analysis = resp.data.analysis; $scope.customers_analysis = resp.data.analysis;
}); });
@ -135,12 +200,12 @@ define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', '
// $scope.order_loading = true; // $scope.order_loading = true;
$scope.listCustomerOrders = function (page) { $scope.listCustomerOrders = function (page) {
$scope.order_loading = true; $scope.order_loading = true;
var params = angular.copy($scope.order_params) || {}; var params = angular.copy($scope.params) || {};
if (params.datefrom) { if (params.begin) {
params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd'); params.datefrom = $filter('date')(params.begin, 'yyyyMMdd');
} }
if (params.dateto) { if (params.end) {
params.dateto = $filter('date')(params.dateto, 'yyyyMMdd'); params.dateto = $filter('date')(params.end, 'yyyyMMdd');
} }
params.gateway = [0, 1]; params.gateway = [0, 1];
params.page = page || $scope.orderPagination.page || 1; params.page = page || $scope.orderPagination.page || 1;

@ -1,3 +1,22 @@
<style>
.userfile {
width: 300px;
margin-left: 40px;
height: 600px;
display: inline-block;
vertical-align:top
}
.userechart {
width: 70%;
height: 600px;
display: inline-block;
margin-left: 20px;
}
.profile-user-img {
height: 100px;
}
</style>
<section class="content-header"> <section class="content-header">
<h1>Customer Transaction Analysis</h1> <h1>Customer Transaction Analysis</h1>
<ol class="breadcrumb"> <ol class="breadcrumb">
@ -111,7 +130,7 @@
<tbody> <tbody>
<tr ng-repeat="customer in customers" <tr ng-repeat="customer in customers"
ng-class="{'selectRow':order_params.customer_id==customer.customer_id}" ng-class="{'selectRow':order_params.customer_id==customer.customer_id}"
ng-click="order_params.customer_id=customer.customer_id;listCustomerOrders()"> ng-click="order_params.customer_id=customer.customer_id;listCustomerOrders();checkoutCustomer(customer);generatorEcharts(customer.customer_id)">
<td style="width: 60px" ng-if="customers_type ==0 || customers_type==1"> <td style="width: 60px" ng-if="customers_type ==0 || customers_type==1">
<span> <span>
<img style="height: 30px;width: 30px" class="img-circle" ng-src="{{customer.headimg||'static/images/royalpay_sign_ln.png'}}" /> <img style="height: 30px;width: 30px" class="img-circle" ng-src="{{customer.headimg||'static/images/royalpay_sign_ln.png'}}" />
@ -162,7 +181,67 @@
</div> </div>
</div> </div>
</div> </div>
<div class="box" ng-if="one_customer">
<div class="box-header">
<h3 class="box-title">用户画像</h3>
</div>
<div class="userfile">
<div class="box box-primary" style="box-shadow:0 1px 20px rgba(0,0,0,0.4)">
<div class="box-body box-profile">
<img ng-if="one_customer.headimg" class="profile-user-img img-responsive img-circle" ng-src="{{one_customer.headimg}}" >
<img ng-if="!one_customer.headimg" class="profile-user-img img-responsive img-circle" src="static/images/r_logo.svg" >
<h3 class="profile-username text-center">{{one_customer.nickname}}</h3>
<p class="text-muted text-center" ng-if="one_customer.sex=='f' || one_customer.sex=='1'">性别:女</p>
<p class="text-muted text-center" ng-if="one_customer.sex=='m' || one_customer.sex=='2'">性别:男</p>
<p class="text-muted text-center" ng-if="one_customer.sex!='m' && one_customer.sex!='f' && one_customer.sex=='0'">性别:未知</p>
<ul class="list-group list-group-unbordered">
<li class="list-group-item">
<b>常消费的店铺</b> <div class="pull-right">
<a ui-sref="partners.detail({clientMoniker:one_customer.clients[0]})">{{one_customer.clients[0]}} </a>
<span ng-if="one_customer.clients[1]">,</span>
<a ui-sref="partners.detail({clientMoniker:one_customer.clients[1]})">{{one_customer.clients[1]}}</a>
<span ng-if="one_customer.clients[2]">,</span>
<a ui-sref="partners.detail({clientMoniker:one_customer.clients[2]})">{{one_customer.clients[2]}}</a>
</div>
</li>
<li class="list-group-item">
<b>常消费的金额区间</b> <a class="pull-right">{{one_customer.amount_range}}</a>
</li>
<li class="list-group-item">
<b>常消费的时间段</b> <a class="pull-right">{{one_customer.hour_range}}</a>
</li>
<li class="list-group-item">
<b>常消费的城市</b> <a class="pull-right" style="width: 70%;text-align:right;white-space: nowrap;">{{one_customer.top_citys}}</a>
</li>
<li class="list-group-item">
<b>总金额数</b> <a class="pull-right">{{one_customer.amount}}</a>
</li>
<li class="list-group-item">
<b>总订单数</b> <a class="pull-right">{{one_customer.orders}}</a>
</li>
<li class="list-group-item">
<b>客单价</b> <a class="pull-right">{{one_customer.price}}</a>
</li>
<li class="list-group-item" style="height: 100px">
<b>常消费的行业</b> <a class="pull-right" style="width:50%;text-align:right;">
{{one_customer.industry[0]|partner_royalpay_industry}} <span ng-if="one_customer.industry[1]">,</span>
{{one_customer.industry[1]|partner_royalpay_industry}}
<span ng-if="one_customer.industry[2]">,</span>
{{one_customer.industry[2]|partner_royalpay_industry}}</a>
</li>
</ul>
</div>
<!-- /.box-body -->
</div>
</div>
<div class="box-body userechart">
<div class="chart" id="drageId" echarts="testobj" moved=true style="height: 600px"></div>
</div>
<loadingbar ng-if="customer_loading"></loadingbar>
</div>
</div> </div>

@ -8,6 +8,7 @@ define(['angular', 'echarts'], function (angular, echarts) {
restrict: 'AEC', restrict: 'AEC',
scope: { scope: {
echarts: '=', echarts: '=',
moved: '=',
chartSetter: '&' chartSetter: '&'
}, },
link: function (scope, element, attr) { link: function (scope, element, attr) {
@ -18,6 +19,15 @@ define(['angular', 'echarts'], function (angular, echarts) {
if (element.height() > 0 && element.width() > 0) { if (element.height() > 0 && element.width() > 0) {
scope.chartObj = echarts.init(element[0]); scope.chartObj = echarts.init(element[0]);
initDefer.resolve(); initDefer.resolve();
if (scope.moved) {
scope.chartObj.on('mouseup', function (params) {
var option =scope.chartObj.getOption();
option.series[0].data[params.dataIndex].x = params.event.offsetX;
option.series[0].data[params.dataIndex].y = params.event.offsetY;
option.series[0].data[params.dataIndex].fixed = true;
scope.chartObj.setOption(option);
});
}
} else { } else {
$timeout(initChart, 100) $timeout(initChart, 100)
} }
@ -54,17 +64,17 @@ define(['angular', 'echarts'], function (angular, echarts) {
} catch (e) { } catch (e) {
} }
}); });
angular.element(window).bind('resize',function () { angular.element(window).bind('resize', function () {
try { try {
setTimeout(function () { setTimeout(function () {
if (scope.chartObj != null && !!scope.chartObj.getOption()) { if (scope.chartObj != null && !!scope.chartObj.getOption()) {
scope.chartObj.resize() scope.chartObj.resize()
} }
},1000) }, 1000)
} catch (e) { } catch (e) {
} }
}) });
} }
} }
}]); }]);

@ -29449,7 +29449,7 @@ define('zrender/mixin/Draggable', ['require'], function (require) {
if (draggingTarget) { if (draggingTarget) {
draggingTarget.dragging = false; draggingTarget.dragging = false;
} }
this.dispatchToElement(draggingTarget, 'dragend', e.event); // this.dispatchToElement(draggingTarget, 'dragend', e.event);
if (this._dropTarget) { if (this._dropTarget) {
this.dispatchToElement(this._dropTarget, 'drop', e.event); this.dispatchToElement(this._dropTarget, 'drop', e.event);
} }

Loading…
Cancel
Save