Merge branch 'develop'

# Conflicts:
#	pom.xml
#	src/main/java/au/com/royalpay/payment/manage/dev/core/impl/AliforexcelServiceImpl.java
#	src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java
#	src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientMapper.xml
master
taylor.dang 5 years ago
commit 58451f5f61

@ -5,12 +5,12 @@
<parent>
<groupId>au.com.royalpay.payment</groupId>
<artifactId>payment-parent</artifactId>
<version>1.0.1</version>
<version>1.0.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId>
<version>1.0.32</version>
<version>1.0.31</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

@ -3,21 +3,28 @@ package au.com.royalpay.payment.manage.analysis.core.impls;
import au.com.royalpay.payment.manage.analysis.beans.ClientRateQueryBean;
import au.com.royalpay.payment.manage.analysis.core.ClientRatesAnalysisService;
import au.com.royalpay.payment.manage.analysis.mappers.ClientRatesAnalysisMapper;
import au.com.royalpay.payment.manage.analysis.mappers.CustomerAndOrdersStatisticsMapper;
import au.com.royalpay.payment.manage.mappers.log.ClientReviewLogMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientBDMapper;
import au.com.royalpay.payment.manage.mappers.system.ManagerMapper;
import au.com.royalpay.payment.manage.mappers.system.OrgMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.organizations.core.OrgManager;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.RequestParam;
import java.text.ParseException;
import java.util.ArrayList;
@ -45,8 +52,15 @@ public class ClientRatesAnalysisServiceImpl implements ClientRatesAnalysisServic
@Resource
private OrgManager orgManager;
@Resource
private OrgMapper orgMapper;
@Resource
private ClientBDMapper clientBDMapper;
@Resource
private CustomerAndOrdersStatisticsMapper customerAndOrdersStatisticsMapper;
@Override
public JSONObject listAnalysisOfBDUsers(JSONObject manager, String orgId, String orgId2,Date beginDate, Date endDate) {
public JSONObject listAnalysisOfBDUsers(JSONObject manager, String orgId, String orgId2, Date beginDate, Date endDate) {
JSONObject params = new JSONObject();
if (orgId != null) {
params.put("org_id", orgId);
@ -58,11 +72,46 @@ public class ClientRatesAnalysisServiceImpl implements ClientRatesAnalysisServic
if (ManagerRole.BD_LEADER.hasRole(manager.getIntValue("role"))) {
params.put("bd_group", manager.getString("manager_id"));
}
params.put("begin", DateFormatUtils.format(beginDate,"yyyy-MM-dd"));
params.put("end", DateFormatUtils.format(endDate,"yyyy-MM-dd"));
orgManager.checkOrgIds(manager,params);
params.put("begin", DateFormatUtils.format(beginDate, "yyyy-MM-dd"));
params.put("end", DateFormatUtils.format(endDate, "yyyy-MM-dd"));
orgManager.checkOrgIds(manager, params);
JSONObject result = new JSONObject();
List<JSONObject> bdAnalysis = clientRatesAnalysisMapper.analysisRatesForBDUsers(params);
// 原 数据直接查询
// List<JSONObject> bdAnalysis = clientRatesAnalysisMapper.analysisRatesForBDUsers(params);
// result.put("bds", bdAnalysis);
// 新 数据查询
// 根据时间查询所有的商户交易量
List<JSONObject> clientOrders = customerAndOrdersStatisticsMapper.findByTime(params);
// 查询所有的组织
PageBounds sort = new PageBounds(Order.formString("sort_no.asc"));
List<JSONObject> orgList = orgMapper.listOrgs(0, sort);
List<JSONObject> bdAnalysis = new ArrayList<>();
// 查询组织下所有的bd
for (JSONObject org : orgList) {
List<JSONObject> bds = managerMapper.findBdById(org.getString("org_id"));
for (JSONObject bd : bds) {
// 查出bd下的所有的商户不为null的 set进 bdAnalysis
List<JSONObject> clients = clientBDMapper.findTotalClientByBdId(bd.getString("manager_id"));
// 遍历商户 查看商户交易量
if (!clients.isEmpty()) {
for (JSONObject client : clients) {
int i = 0;
for (JSONObject clientOrder : clientOrders) {
if (client.getString("client_id").equals(clientOrder.getString("client_id"))) {
// 判断交易量
if (clientOrder.getInteger("order_count") != 0) {
bd.put("trade_clients", i++);
}
}
}
}
bd.put("total_clients", clients.size());
bdAnalysis.add(bd);
}
}
}
result.put("bds", bdAnalysis);
result.put("total", clientRatesAnalysisMapper.analysisTotal(params));
return result;
@ -151,7 +200,7 @@ public class ClientRatesAnalysisServiceImpl implements ClientRatesAnalysisServic
params.put("client_ids", clientIds);
// result.put("total", clientRatesAnalysisMapper.analysisTotal(params));
List<JSONObject> clients = analysisClientRates(params,query);
List<JSONObject> clients = analysisClientRates(params, query);
result.put("clients", clients);
@ -165,7 +214,7 @@ public class ClientRatesAnalysisServiceImpl implements ClientRatesAnalysisServic
client.put("sleep_days_limited", Math.min(client.getIntValue("sleep_days"), 30));
List<JSONObject> events = new ArrayList<>();
for (ClientRateAnalysisEventLoader loader : eventLoaders) {
loader.loadEvents(client, events,query);
loader.loadEvents(client, events, query);
}
client.put("events", events);
}

@ -74,4 +74,6 @@ public interface CustomerAndOrdersStatisticsMapper {
int countEnableChannel(JSONObject params);
int countEnableAlipay(JSONObject params);
List<JSONObject> findByTime(JSONObject params);
}

@ -120,12 +120,6 @@ public class AliforexcelServiceImpl implements AliforexcelService {
if (StringUtils.isBlank(client.getString("company_website"))) {
client.put("company_website", client.getString("ali_sub_merchant_id")+".royalpay.com.au");
}
if (StringUtils.isBlank(client.getString("alipayindustry"))) {
client.put("alipayindustry", "5311");
}
if (StringUtils.isBlank(client.getString("business_structure"))) {
client.put("business_structure", "da");
}
checkPartnerInfo(client,"online");
} catch (InvalidParameterException e) {
JSONObject exception = new JSONObject();
@ -193,6 +187,7 @@ public class AliforexcelServiceImpl implements AliforexcelService {
if (StringUtils.isBlank(client.getString("business_structure"))) {
client.put("business_structure", "da");
}
checkPartnerInfo(client,"online");
} catch (InvalidParameterException e) {
JSONObject exception = new JSONObject();
exception.put("client_moniker", client.getString("client_moniker"));

@ -459,7 +459,7 @@ public class TestController implements ApplicationEventPublisherAware {
return aliforexcelService.registerAlipayOnlineMerchant();
}
@ManagerMapping(value = "/register/alipayOnlineGms/range", role = ManagerRole.DEVELOPER, method = RequestMethod.GET)
@ManagerMapping(value = "/register/alipayOnlineGms", role = ManagerRole.DEVELOPER, method = RequestMethod.GET)
public JSONObject registerRangeAlipayOnlineMerchant(@RequestParam int start,@RequestParam int end) {
return aliforexcelService.registerRangeAlipayOnlineMerchant(start,end);
}

@ -40,4 +40,5 @@ public interface ClientBDMapper {
List<JSONObject> listBDByOrgId(@Param("org_id") int org_id);
List<JSONObject> findTotalClientByBdId(@Param("bd_id")String manager_id);
}

@ -30,6 +30,12 @@ public interface ClientMapper {
List<JSONObject> listGreenChannel(JSONObject params);
JSONObject findSamePhone(@Param("contact_phone") String contactPhone);
JSONObject findSameEmail(@Param("contact_email") String contactEmail);
JSONObject findSameAddress(@Param("address") String address);
@AutoSql(type = SqlType.SELECT)
JSONObject findClientIgnoreInvalid(int clientId);

@ -70,4 +70,6 @@ public interface ManagerMapper {
@Select("select wx_openid from sys_managers where is_valid=1 AND (role & 256 > 0 OR role & 4 > 0) AND (org_id = 1 or org_id is null) AND wx_openid IS NOT NULL")
List<String> listDevAndBdOpenId();
List<JSONObject> findBdById(@Param("org_id")String org_id);
}

@ -344,6 +344,26 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (manager != null) {
checkClientOrg(manager, client);
}
String same_phone = clientMapper.findSamePhone(client.getString("contact_phone")).getString("a");
if(same_phone!=null&& client.getString("contact_phone")!= null&&same_phone.contains(" ") ) {
same_phone = same_phone.replace(client.getString("client_moniker"),"");
client.put("same_phone","(雷同商户:"+same_phone+")" );
}
String same_email = clientMapper.findSameEmail(client.getString("contact_email")).getString("a");
if(same_email!=null&& client.getString("contact_email")!= null&&same_email.contains(" ") ) {
same_email = same_email.replace(client.getString("client_moniker"),"");
client.put("same_email","(雷同商户:"+same_email+")" );
}
String same_address = clientMapper.findSameAddress(client.getString("address")).getString("a");
if(same_address!=null&& client.getString("address")!= null&&same_address.contains(" ") ) {
same_address = same_address.replace(client.getString("client_moniker"),"");
client.put("same_address","(雷同商户:"+same_address+")" );
}
client.putAll(clientConfigService.find(client.getIntValue("client_id")));
client.put("unsubscribe", mailUnsubMapper.findOneByClientMoniker(clientMoniker) == null ? false : true);
client.put("show_all_permission", true);

@ -1,6 +1,6 @@
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.schema-name=royalpay_production
spring.datasource.host=192.168.0.18:3306
spring.datasource.schema-name=royalpay_local
spring.datasource.host=192.168.0.50:3306
spring.datasource.url=jdbc:mysql://${spring.datasource.host}/${spring.datasource.schema-name}?useUnicode=true&characterEncoding=utf8&useSSL=false
spring.datasource.username=root
spring.datasource.password=root

@ -143,3 +143,4 @@ app.hanyin-secure.sftp-host=180.168.61.93
app.hanyin-secure.sftp-port=28480
app.hanyin-secure.sftp-username=royalpay
app.hanyin-secure.sftp-pwd=royalpay

@ -743,4 +743,19 @@
)
</if>
</select>
<select id="findByTime" resultType="com.alibaba.fastjson.JSONObject">
SELECT
client_id, sum( o.orders ) order_count
FROM
statistics_customer_order o
WHERE
o.date &lt;= #{end}
AND o.date &gt;= #{begin}
AND client_id != 0
GROUP BY
o.client_id
</select>
</mapper>

@ -80,4 +80,10 @@
WHERE sysm.org_id = #{org_id}
AND sysm.is_valid = 1)
</select>
<select id="findTotalClientByBdId" resultType="com.alibaba.fastjson.JSONObject">
select client_id from sys_client_bd where bd_id = #{bd_id} and is_valid =1
</select>
</mapper>

@ -702,8 +702,43 @@
) b
</select>
<select id="findSamePhone" resultType="com.alibaba.fastjson.JSONObject">
SELECT
contact_phone,
GROUP_CONCAT(client_moniker separator ' ') a
FROM
sys_clients
WHERE contact_phone= #{contact_phone}
GROUP BY
contact_phone
</select>
<select id="findSameEmail" resultType="com.alibaba.fastjson.JSONObject">
SELECT
contact_email,
GROUP_CONCAT(client_moniker separator ' ') a
FROM
sys_clients
WHERE contact_email= #{contact_email}
GROUP BY
contact_email
</select>
<select id="findSameAddress" resultType="com.alibaba.fastjson.JSONObject">
SELECT
address,
GROUP_CONCAT(client_moniker separator ' ') a
FROM
sys_clients
WHERE address= #{address}
GROUP BY
address
</select>
<select id="listUseAlipayMerchant" resultType="int">
select client_id from sys_clients where gateway_alipay_online=1 and is_valid=1
and client_id >=#{start} and client_id &lt;#{end}
and client_id >=#{start} and client_id &lt;#{end}
</select>
</mapper>

@ -102,5 +102,12 @@
]]>
</select>
<select id="findBdById" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT manager_id,display_name
FROM sys_managers
WHERE org_id = #{org_id} AND is_valid = 1
]]>
</select>
</mapper>

@ -703,6 +703,7 @@
<div class="col-sm-8">
<p class="form-control-static" ng-bind="partner.contact_phone"></p>
<p class="description-text text-red" ng-bind="partner.same_phone"></p>
</div>
</div>
<div class="form-group col-sm-6">
@ -723,6 +724,7 @@
ng-if="partner.unsubscribe" class="fa fa-star-o text-yellow"></i>
</span>
</p>
<p class="description-text text-red" ng-bind="partner.same_email"></p>
</div>
</div>
</div>
@ -739,6 +741,7 @@
<div class="col-sm-8">
<p class="form-control-static" ng-bind="partner.address"></p>
<p class="description-text text-red" ng-bind="partner.same_address"></p>
</div>
</div>
<div class="form-group col-sm-6">

@ -43,7 +43,7 @@
<th>Phone</th>
<th>Email</th>
<!-- <th>Approve Status</th>-->
<th style="max-width: 20%">Company Name</th>
<th>Channel</th>
<th>Status</th>
<th>Handle Status</th>
<th>Create Time</th>
@ -56,7 +56,20 @@
<td ng-bind="apply.contact_person"></td>
<td ng-bind="apply.contact_phone"></td>
<td ng-bind="apply.contact_email"></td>
<td ng-bind="apply.company_name |cut:true:15:' ....'"></td>
<td>
<!--修改商户来源-->
<span ng-if="apply.channel==10001">谷歌|Google</span>
<span ng-if="apply.channel==10002">领英|LinkedIn</span>
<span ng-if="apply.channel==10003">微信|Wechat</span>
<span ng-if="apply.channel==10004">传单手册|Flyer Manual</span>
<span ng-if="apply.channel==10005">其他媒体|Other Media</span>
<span ng-if="apply.channel==2">线下使用体验|Offline Experience</span>
<span ng-if="apply.channel==3">朋友介绍|Friend Introduction</span>
<span ng-if="apply.channel==4">商户推荐|Merchant Recommendation</span>
<span ng-if="apply.channel==5">销售推荐|Sales Recommendation</span>
</td>
</td>
<td>
<if ng-if="apply.agree">已申请 <span ng-if="apply.client_moniker">({{apply.client_moniker}})</span></if>
<if ng-if="!apply.agree">申请失败
@ -114,4 +127,4 @@
</div>
</div>
</div>
</div>
</div>

Loading…
Cancel
Save