Merge remote-tracking branch 'origin/master'

master
yixian 5 years ago
commit 10d34e4d00

@ -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.21</version>
<version>1.0.33</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);
}

@ -125,11 +125,23 @@ public class DailyReportImp implements DailyReport {
kpi.put("compare_value",Math.abs(compare.doubleValue()));
}
}
kpi.put("kpi_percent", p.getBigDecimal("month_amount").divide(kpi_amount,4,BigDecimal.ROUND_HALF_DOWN).multiply(BigDecimal.valueOf(100)).toString().substring(0,5)+"%");
for(JSONObject clientAmount :clientsAmount ){
if(clientAmount.getString("bd_group").equals(kpi.getString("bd_group"))){
kpi.put("clients_month",clientAmount.getBigDecimal("clients_month"));
kpi.put("clients_yesterday",clientAmount.getBigDecimal("clients_yesterday"));
kpi.put("kpi_percent", p.getBigDecimal("month_amount").divide(kpi_amount, 4, BigDecimal.ROUND_HALF_DOWN).multiply(BigDecimal.valueOf(100)).toString().substring(0, 5) + "%");
for (JSONObject clientAmount : clientsAmount) {
if (clientAmount.getString("bd_group").equals(kpi.getString("bd_group"))) {
// sys_clients中查询出此bd创建并属于此bd的商户并且时间是昨天和本月
JSONObject countByBd = clientMapper.findCountByBd(clientAmount.getString("bd_group"), DateUtils.truncate(dt, Calendar.DATE), DateUtils.truncate(DateUtils.addDays(dt, -1), Calendar.DATE), DateUtils.truncate(dt, Calendar.MONTH));
if (countByBd.getInteger("month_count") == null){
kpi.put("clients_month", 0);
}else {
kpi.put("clients_month", countByBd.getInteger("month_count"));
}
if (countByBd.getInteger("yesterday_count") == null){
kpi.put("clients_yesterday", 0);
}else {
kpi.put("clients_yesterday", countByBd.getInteger("yesterday_count"));
}
// kpi.put("clients_month", clientAmount.getBigDecimal("clients_month"));
// kpi.put("clients_yesterday", clientAmount.getBigDecimal("clients_yesterday"));
}
}
total_kpi_amount = total_kpi_amount.add(kpi_amount);

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

@ -13,10 +13,14 @@ public interface AliforexcelService {
JSONObject registerAlipayOnlineMerchant();
JSONObject registerRangeAlipayOnlineMerchant(int start,int end);
JSONObject registerAlipayMerchant();
JSONObject registerInsertAlipayMerchant(String partners);
JSONObject registerInsertAlipayOnlineMerchant(String partners);
JSONObject getLessPartnerInfo();
void initClientPayType(int begin,int end);

@ -21,6 +21,8 @@ import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.dom4j.Element;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -44,6 +46,8 @@ public class AliforexcelServiceImpl implements AliforexcelService {
private AlipayClient alipayClient;
@Resource
private OrderMapper orderMapper;
private Logger logger = LoggerFactory.getLogger(getClass());
@Override
public JSONObject listClients(HttpServletResponse httpResponse,JSONObject manager, AliExcel query) {
@ -105,7 +109,7 @@ public class AliforexcelServiceImpl implements AliforexcelService {
List<String> registerSuccessMerchant = new ArrayList<>();
List<JSONObject> registerFailMerchant = new ArrayList<>();
List<JSONObject> lessInfoMerchant = new ArrayList<>();
List<Integer> useAlipayOnlineMerchant = transactionMapper.useAlipayOnlineClients();
List<Integer> useAlipayOnlineMerchant = clientMapper.listUseAlipayMerchant(0,10000);
for (int clientId : useAlipayOnlineMerchant) {
JSONObject client = clientMapper.findClient(clientId);
if (client == null) {
@ -113,6 +117,9 @@ public class AliforexcelServiceImpl implements AliforexcelService {
}
try {
needRegisterMerchant.add(client.getString("client_moniker"));
if (StringUtils.isBlank(client.getString("company_website"))) {
client.put("company_website", client.getString("ali_sub_merchant_id")+".royalpay.com.au");
}
checkPartnerInfo(client,"online");
} catch (InvalidParameterException e) {
JSONObject exception = new JSONObject();
@ -122,29 +129,104 @@ public class AliforexcelServiceImpl implements AliforexcelService {
lessInfoMerchant.add(exception);
continue;
}
AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayOnlineMerchant();
Element resultElement = alipayClient.registerOnlineGmsPortal(mch.getPid(), client);
if (!StringUtils.equalsIgnoreCase("T", resultElement.elementText("is_success"))) {
try {
AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayOnlineMerchant();
Element resultElement = alipayClient.registerOnlineGmsPortal(mch.getPid(), client);
if (!StringUtils.equalsIgnoreCase("T", resultElement.elementText("is_success"))) {
JSONObject exception = new JSONObject();
exception.put("client_moniker", client.getString("client_moniker"));
exception.put("return_msg", resultElement.elementText("error"));
registerFailMerchant.add(exception);
continue;
}
Element responseElement = resultElement.element("response").element("alipay");
if (!StringUtils.equalsIgnoreCase("SUCCESS", responseElement.elementText("result_code"))) {
JSONObject exception = new JSONObject();
exception.put("client_moniker", client.getString("client_moniker"));
exception.put("return_msg", resultElement.elementText("error"));
registerFailMerchant.add(exception);
continue;
}
registerSuccessMerchant.add(client.getString("client_moniker"));
} catch (Exception e) {
JSONObject exception = new JSONObject();
exception.put("client_moniker", client.getString("client_moniker"));
exception.put("return_msg", resultElement.elementText("error"));
exception.put("return_msg", e.getMessage());
registerFailMerchant.add(exception);
}
}
result.put("need_register_merchant", needRegisterMerchant);
result.put("success_register_merchant", registerSuccessMerchant);
result.put("fail_register_merchant", registerFailMerchant);
result.put("less_info_merchant", lessInfoMerchant);
logger.info("-------AlipayOnline Gms end----fail_register_merchant"+registerFailMerchant.toString());
return result;
}
@Override
public JSONObject registerRangeAlipayOnlineMerchant(int start, int end) {
JSONObject result = new JSONObject();
List<String> needRegisterMerchant = new ArrayList<>();
List<String> registerSuccessMerchant = new ArrayList<>();
List<JSONObject> registerFailMerchant = new ArrayList<>();
List<JSONObject> lessInfoMerchant = new ArrayList<>();
List<Integer> useAlipayOnlineMerchant = clientMapper.listUseAlipayMerchant(start,end);
for (int clientId : useAlipayOnlineMerchant) {
JSONObject client = clientMapper.findClient(clientId);
if (client == null) {
continue;
}
Element responseElement = resultElement.element("response").element("alipay");
if (!StringUtils.equalsIgnoreCase("SUCCESS", responseElement.elementText("result_code"))) {
try {
needRegisterMerchant.add(client.getString("client_moniker"));
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();
exception.put("client_moniker", client.getString("client_moniker"));
exception.put("return_msg", resultElement.elementText("error"));
registerFailMerchant.add(exception);
exception.put("return_msg", e.getMessage());
exception.put("bd_name", client.getString("bd_user_name"));
lessInfoMerchant.add(exception);
continue;
}
registerSuccessMerchant.add(client.getString("client_moniker"));
try {
AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayOnlineMerchant();
Element resultElement = alipayClient.registerOnlineGmsPortal(mch.getPid(), client);
if (!StringUtils.equalsIgnoreCase("T", resultElement.elementText("is_success"))) {
JSONObject exception = new JSONObject();
exception.put("client_moniker", client.getString("client_moniker"));
exception.put("return_msg", resultElement.elementText("error"));
registerFailMerchant.add(exception);
continue;
}
Element responseElement = resultElement.element("response").element("alipay");
if (!StringUtils.equalsIgnoreCase("SUCCESS", responseElement.elementText("result_code"))) {
JSONObject exception = new JSONObject();
exception.put("client_moniker", client.getString("client_moniker"));
exception.put("return_msg", resultElement.elementText("error"));
registerFailMerchant.add(exception);
continue;
}
registerSuccessMerchant.add(client.getString("client_moniker"));
} catch (Exception e) {
JSONObject exception = new JSONObject();
exception.put("client_moniker", client.getString("client_moniker"));
exception.put("return_msg", e.getMessage());
registerFailMerchant.add(exception);
}
}
result.put("need_register_merchant", needRegisterMerchant);
result.put("success_register_merchant", registerSuccessMerchant);
result.put("fail_register_merchant", registerFailMerchant);
result.put("less_info_merchant", lessInfoMerchant);
logger.info("-------AlipayOnline Gms end----fail_register_merchant"+registerFailMerchant.toString());
return result;
}
@ -267,6 +349,65 @@ public class AliforexcelServiceImpl implements AliforexcelService {
return result;
}
@Override
public JSONObject registerInsertAlipayOnlineMerchant(String partners) {
String[] partner = partners.split(",");
JSONObject result = new JSONObject();
List<String> needRegisterMerchant = new ArrayList<>();
List<String> registerSuccessMerchant = new ArrayList<>();
List<JSONObject> registerFailMerchant = new ArrayList<>();
List<JSONObject> lessInfoMerchant = new ArrayList<>();
for (String clientMoniker : partner) {
JSONObject client = clientMapper.findClientByMoniker(clientMoniker);
if (client == null) {
continue;
}
try {
needRegisterMerchant.add(client.getString("client_moniker"));
if (StringUtils.isBlank(client.getString("alipayindustry"))) {
client.put("alipayindustry", "5311");
}
if (StringUtils.isBlank(client.getString("business_structure"))) {
client.put("business_structure", "da");
}
if (StringUtils.isBlank(client.getString("company_website"))) {
client.put("company_website", client.getString("ali_sub_merchant_id")+".royalpay.com.au");
}
checkPartnerInfo(client,"online");
} catch (InvalidParameterException e) {
JSONObject exception = new JSONObject();
exception.put("client_moniker", client.getString("client_moniker"));
exception.put("return_msg", e.getMessage());
exception.put("bd_name", client.getString("bd_user_name"));
lessInfoMerchant.add(exception);
continue;
}
AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayOnlineMerchant();
Element resultElement = alipayClient.registerOnlineGmsPortal(mch.getPid(), client);
if (!StringUtils.equalsIgnoreCase("T", resultElement.elementText("is_success"))) {
JSONObject exception = new JSONObject();
exception.put("client_moniker", client.getString("client_moniker"));
exception.put("return_msg", resultElement.elementText("error"));
registerFailMerchant.add(exception);
continue;
}
Element responseElement = resultElement.element("response").element("alipay");
if (!StringUtils.equalsIgnoreCase("SUCCESS", responseElement.elementText("result_code"))) {
JSONObject exception = new JSONObject();
exception.put("client_moniker", client.getString("client_moniker"));
exception.put("return_msg", resultElement.elementText("error"));
registerFailMerchant.add(exception);
continue;
}
registerSuccessMerchant.add(client.getString("client_moniker"));
}
result.put("need_register_merchant", needRegisterMerchant);
result.put("success_register_merchant", registerSuccessMerchant);
result.put("fail_register_merchant", registerFailMerchant);
result.put("less_info_merchant", lessInfoMerchant);
return result;
}
@Override
public JSONObject getLessPartnerInfo() {
JSONObject result = new JSONObject();

@ -93,7 +93,7 @@ public class CloseOrderWarningSender implements ApplicationListener<OrderCloseEv
}
}
warningList.put(moniker, new Date());
List<JSONObject> developers = managerMapper.listDetailsByRole(null, ManagerRole.DEVELOPER.getMask());
List<JSONObject> developers = managerMapper.listDetailsByRole(null, ManagerRole.DEVELOPER.getMask() | ManagerRole.RISK_MANAGER.getMask());
if (!StringUtils.isEmpty(client.getString("bd_user"))) {
String[] bds = client.getString("bd_user").split(",");
if (bds.length > 0) {
@ -133,6 +133,9 @@ public class CloseOrderWarningSender implements ApplicationListener<OrderCloseEv
if (developer.getString("manager_id").equals("141")) {
continue;
}
if (StringUtils.isBlank(developer.getString("wx_openid"))) {
continue;
}
try {
String title = client.getString("short_name") + "(" + moniker + ")";
String content = "最近" + recentOrders.size() + "笔订单中有" + closed.size() + "笔关闭,占比" + percentage + "%;\r\n" + "最早一笔:"
@ -144,7 +147,8 @@ public class CloseOrderWarningSender implements ApplicationListener<OrderCloseEv
"所属BD:" + client.getString("bd_user_name"));
api.sendTemplateMessage(msg);
}
} catch (Exception ignore) {
} catch (Exception e) {
logger.info("sendTemplateMessage--发送告警模板消息发生错误" + developer.getString("wx_openid") + "--" + e);
}
}
}

@ -108,12 +108,15 @@ public class PaymentAmountCheatMonitor implements CheatMonitor {
}
warningList.put(subMerchantId, new Date());
List<JSONObject> developers = managerMapper.listDetailsByRole(null, ManagerRole.DEVELOPER.getMask());
List<JSONObject> developers = managerMapper.listDetailsByRole(null, ManagerRole.DEVELOPER.getMask() | ManagerRole.RISK_MANAGER.getMask());
MpWechatApi api = mpWechatApiProvider.getNewPaymentApi();
for (JSONObject developer : developers) {
if(developer.getString("manager_id").equals("141")){
continue;
}
if (StringUtils.isBlank(developer.getString("wx_openid"))) {
continue;
}
try {
String wxOpenid = developer.getString("wx_openid");
if (wxOpenid != null) {
@ -124,7 +127,8 @@ public class PaymentAmountCheatMonitor implements CheatMonitor {
TemplateMessage msg = WarningSenderHelper.buildWarningMessage(wxOpenid, templateId, title, content, client.getString("bd_user_name"));
api.sendTemplateMessage(msg);
}
} catch (Exception ignore) {
} catch (Exception e) {
logger.info("sendTemplateMessage--发送告警模板消息发生错误" + developer.getString("wx_openid") + "--" + e);
}
}
}

@ -459,6 +459,11 @@ public class TestController implements ApplicationEventPublisherAware {
return aliforexcelService.registerAlipayOnlineMerchant();
}
@ManagerMapping(value = "/register/alipayOnlineGms", role = ManagerRole.DEVELOPER, method = RequestMethod.GET)
public JSONObject registerRangeAlipayOnlineMerchant(@RequestParam int start,@RequestParam int end) {
return aliforexcelService.registerRangeAlipayOnlineMerchant(start,end);
}
@ManagerMapping(value = "/register/alipayGms", role = ManagerRole.DEVELOPER, method = RequestMethod.POST)
public JSONObject registerAlipayMerchant() {
return aliforexcelService.registerAlipayMerchant();
@ -469,6 +474,11 @@ public class TestController implements ApplicationEventPublisherAware {
return aliforexcelService.registerInsertAlipayMerchant(partners.getString("partners"));
}
@ManagerMapping(value = "/register/alipayOnlineGms/insert_partner", role = ManagerRole.DEVELOPER, method = RequestMethod.POST)
public JSONObject registerInsertAlipayOnlineMerchant(@RequestBody JSONObject partners) {
return aliforexcelService.registerInsertAlipayOnlineMerchant(partners.getString("partners"));
}
@ManagerMapping(value = "/register/getLessPartnerInfo", role = ManagerRole.DEVELOPER, method = RequestMethod.GET)
public JSONObject getLessPartnerInfo() {
return aliforexcelService.getLessPartnerInfo();

@ -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);
}

@ -26,8 +26,16 @@ public interface ClientMapper {
List<JSONObject> listValidClient();
List<JSONObject> listValidClientFor30Days();
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);
@ -126,4 +134,9 @@ public interface ClientMapper {
List<JSONObject> clientPayTypeInfoByClientIdRange(@Param("begin") int begin, @Param("end") int end);
int getPartnercode(@Param("codes") String codes);
JSONObject findCountByBd(@Param("bd_group") String bd_group, @Param("today") Date today, @Param("yesterday") Date yesterday, @Param("month") Date month);
List<Integer> listUseAlipayMerchant(@Param("start") int start, @Param("end") int end);
}

@ -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);
}

@ -213,6 +213,8 @@ public interface ClientManager {
void setClientRetailPaySurCharge(JSONObject account,String clientMoniker, boolean paySurcharge);
void setClientCBBankPaySurCharge(JSONObject account,String clientMoniker, boolean paySurcharge);
void setClientTaxInSurcharge(JSONObject account,String clientMoniker, boolean taxInSurcharge);
void setClientCustomerTaxFree(JSONObject account,String clientMoniker, boolean customerTaxFree);
@ -267,6 +269,8 @@ public interface ClientManager {
void changeRetailPaySurcharge(JSONObject account, boolean paySurcharge);
void changeCBBankPaySurcharge(JSONObject account, boolean paySurcharge);
void changeRequireCustinfo(JSONObject account, boolean requireCustinfo);
void changeRequireRemark(JSONObject account, boolean requireRemark);

@ -13,5 +13,7 @@ public interface ClientModifySupport {
void processClientConfigModify(ClientConfigModify clientConfigModify);
void processClientConfigModify(ClientConfigModify clientConfigModify, boolean onlyModifyConfig);
void processClientGatewaySignModify(ClientGatewaySignModify clientGatewaySignModify);
}

@ -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);
@ -2899,6 +2919,16 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
@Override
public void setClientCBBankPaySurCharge(JSONObject account, String clientMoniker, boolean paySurcharge) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account, clientMoniker, "cbbank_surcharge", paySurcharge), true);
}
@Override
public void setClientTaxInSurcharge(JSONObject account, String clientMoniker, boolean taxInSurcharge) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
@ -2906,7 +2936,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new InvalidShortIdException();
}
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account, clientMoniker, "tax_in_surcharge", taxInSurcharge));
}
@Override
@ -3434,6 +3463,21 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
.processClientConfigModify(new SwitchPermissionModify(account, client.getString("client_moniker"), "retail_surcharge", paySurcharge));
}
@Override
public void changeCBBankPaySurcharge(JSONObject account, boolean paySurcharge) {
int clientId = account.getIntValue("client_id");
JSONObject client = getClientInfo(clientId);
if (client == null) {
throw new InvalidShortIdException();
}
if (account.getIntValue("role") == 3) {
// cashier cannot change this config
throw new ForbiddenException("Cashier has no permission to switch retail surcharge");
}
clientModifySupport
.processClientConfigModify(new SwitchPermissionModify(account, client.getString("client_moniker"), "cbbank_surcharge", paySurcharge),true);
}
@Override
public void changeRequireCustinfo(JSONObject account, boolean requireCustinfo) {
int clientId = account.getIntValue("client_id");

@ -45,6 +45,12 @@ public class ClientModifySupportImpl implements ClientModifySupport {
clientInfoCacheSupport.clearClientCache(clientId);
}
@Override
public void processClientConfigModify(ClientConfigModify clientConfigModify,boolean onlyModifyConfig) {
int clientId =clientConfigModify.doModify(merchantInfoProvider, clientConfigMapper,clientMapper,mongoTemplate,onlyModifyConfig);
clientInfoCacheSupport.clearClientConfigCache(clientId);
}
@Override
public void processClientGatewaySignModify(ClientGatewaySignModify clientGatewaySignModify) {
int clientId =clientGatewaySignModify.doModify(merchantInfoProvider, merchantSignInfoMapper,mongoTemplate);

@ -50,6 +50,20 @@ public abstract class ClientConfigModify {
return clientId;
}
public int doModify(MerchantInfoProvider merchantInfoProvider, ClientConfigMapper clientConfigMapper, ClientMapper clientMapper, MongoTemplate mongoTemplate,boolean onlyModifyConfig) {
JSONObject clientConfig = merchantInfoProvider.getClientConfigInfoByMoniker(clientMoniker);
JSONObject modifyResult = getModifyResult();
try {
saveModifyHistory(clientConfig, modifyResult, mongoTemplate);
}catch (Exception e){
}
int clientId = clientConfig.getIntValue("client_id");
modifyResult.put("client_id", clientId);
clientConfigMapper.update(modifyResult);
return clientId;
}
private void saveModifyHistory(JSONObject client, JSONObject modifyResult,MongoTemplate mongoTemplate) {
if (account == null) {
return;

@ -230,6 +230,11 @@ public class PartnerManageController {
clientManager.setClientRetailPaySurCharge(manager,clientMoniker, config.getBooleanValue("retail_surcharge"));
}
@ManagerMapping(value = "/{clientMoniker}/cbbank_surcharge", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN, ManagerRole.BD_USER})
public void setClientCBBankPaySurCharge(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setClientCBBankPaySurCharge(manager,clientMoniker, config.getBooleanValue("cbbank_surcharge"));
}
@ManagerMapping(value = "/{clientMoniker}/tax_in_surcharge", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN})
public void setClientTaxPayer(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setClientTaxInSurcharge(manager,clientMoniker, config.getBooleanValue("tax_in_surcharge"));

@ -419,6 +419,12 @@ public class PartnerViewController {
clientManager.changeRetailPaySurcharge(account, pass.getBooleanValue("retail_surcharge"));
}
@PartnerMapping(value = "/cbbank_surcharge", method = RequestMethod.PUT)
@ResponseBody
public void changeCBBankPaySurCharge(@RequestBody JSONObject pass, @ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account) {
clientManager.changeCBBankPaySurcharge(account, pass.getBooleanValue("cbbank_surcharge"));
}
@PartnerMapping(value = "/require_custinfo", method = RequestMethod.PUT)
@ResponseBody
public void changeRequireCustinfo(@RequestBody JSONObject pass, @ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account) {

@ -108,7 +108,7 @@ public class NoticeManageImpl implements NoticeManage {
notice.put("create_name", manager.getString("display_name"));
if (!notice.getBoolean("merchants_type")){
StringBuilder sendClients = new StringBuilder();
List<JSONObject> clients = clientMapper.listValidClient();
List<JSONObject> clients = clientMapper.listValidClientFor30Days();
clients.forEach(c -> {
if (c.getInteger("parent_client_id")==null || c.getInteger("parent_client_id")!=9){
String p = c.getString("client_moniker")+",";
@ -146,7 +146,7 @@ public class NoticeManageImpl implements NoticeManage {
if (!notice.getBoolean("merchants_type")){
StringBuilder sendClients = new StringBuilder();
List<JSONObject> clients = clientMapper.listValidClient();
List<JSONObject> clients = clientMapper.listValidClientFor30Days();
clients.forEach(c -> {
if (c.getInteger("parent_client_id")==null || c.getInteger("parent_client_id")!=9){
String p = c.getString("client_moniker")+",";
@ -292,8 +292,7 @@ public class NoticeManageImpl implements NoticeManage {
public int listNoticeClients(String noticeId) {
JSONObject params = new JSONObject();
params.put("notice_id", noticeId);
int clients = noticePartnerMapper.countClientsByNoticeId(params);
return clients;
return noticePartnerMapper.countClientsByNoticeId(params);
}

@ -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>

@ -5,6 +5,17 @@
SELECT client_id,client_moniker,parent_client_id FROM sys_clients
WHERE is_valid=1 and (approve_result = 1 or approve_result = 2)
</select>
<select id="listValidClientFor30Days" resultType="com.alibaba.fastjson.JSONObject">
SELECT
DISTINCT
sc.client_id,
sc.client_moniker,
sc.parent_client_id
FROM statistics_customer_order sco,
sys_clients sc
WHERE sco.date >= DATE_SUB(CURDATE(), INTERVAL 30 DAY)
AND sco.client_id = sc.client_id
</select>
<select id="listGreenChannel" resultType="com.alibaba.fastjson.JSONObject">
select m.manager_id manager_id,m.display_name display_name, m.wx_openid wx_openid , c.client_moniker
client_moniker
@ -662,4 +673,72 @@
AND cb_bankpay_url IS NULL
</select>
<select id="findCountByBd" resultType="com.alibaba.fastjson.JSONObject">
SELECT
*
FROM
(
SELECT
count( * ) yesterday_count
FROM
sys_clients
WHERE
creator = #{bd_group}
AND create_time &gt;= #{yesterday}
AND create_time &lt; #{today}
AND is_valid = 1
) a,
(
SELECT
count( * ) month_count
FROM
sys_clients
WHERE
creator = #{bd_group}
AND create_time &gt;= #{month}
AND create_time &lt; #{today}
AND is_valid = 1
) 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}
</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>

@ -68,6 +68,13 @@
<p class="small text-warning">(跳转H5页面链接)</p>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label" for="kw-input">Copy text</label>
<div class="col-md-10">
<input ng-model="reference.copy" type="text" name="title" id="copy-input" class="form-control">
<p class="small text-warning">(广告页面内添加的文字)</p>
</div>
</div>
</form>
<div class="form-group">
<label class="control-label">Content</label>

@ -456,6 +456,24 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
})
};
$scope.registerInsertOnlineGMS = function (text) {
$scope.totalhide = true;
$scope.selecttotal = false;
var params = {};
params.partners = text;
$http.post('/dev/register/alipayOnlineGms/insert_partner',params).then(function (resp) {
$scope.totalhide = false;
$scope.selecttotal = true;
$scope.need_register_merchant = resp.data.need_register_merchant.toString();
$scope.success_register_merchant = resp.data.success_register_merchant.toString();
$scope.fail_register_merchant = resp.data.fail_register_merchant;
$scope.less_info_merchant = resp.data.less_info_merchant();
}, function (resp) {
alert(resp.data.message);
})
};
$scope.getLessPartnerInfo = function () {
$scope.totalhide = true;
$scope.selecttotal = false;

@ -22,6 +22,10 @@
<textarea class="form-control" ng-model="partners"></textarea>
<button class="btn btn-primary" ng-click="registerInsertGMS(partners)">register textarea partner offline</button> <label ng-hide="selecttotal" style="padding-left: 30px">请稍后</label>
</div>
<div class="box">
<textarea class="form-control" ng-model="online_partners"></textarea>
<button class="btn btn-primary" ng-click="registerInsertOnlineGMS(online_partners)">register textarea partner online</button> <label ng-hide="selecttotal" style="padding-left: 30px">请稍后</label>
</div>
<div class="row" ng-if="need_register_merchant">
<span>需要报备的商户编码</span><p ng-bind="need_register_merchant"></p>
</div>

@ -120,7 +120,7 @@
<label ng-if="!manager.admin && !manager.operator">
<input type="checkbox" ng-model="manager.bd" name="bd">BD User
</label>
<label ng-if="('00001'|withRole)">
<label ng-if="('111'|withRole)">
<input type="checkbox" ng-model="manager.orgmanager" name="orgmanager">Org Manager
</label>
</p>

@ -129,7 +129,7 @@
<label ng-if="!manager.admin && !manager.operator">
<input type="checkbox" ng-model="manager.bd" name="bd">BD User
</label>
<label ng-if="('00001'|withRole)">
<label ng-if="('111'|withRole)">
<input type="checkbox" ng-model="manager.orgmanager" name="guest">Org Manager
</label>
</p>

@ -125,10 +125,13 @@
transition: opacity 0.5s ease-in, margin-top 0.5s ease-in;
}
[ui-view].ng-enter {
/*
safari12.1bug
*/
/*[ui-view].ng-enter {
margin-top: 10px;
opacity: 0.5;
}
}*/
[ui-view], [ui-view].ng-enter.ng-enter-active {
margin-top: 0;
@ -870,4 +873,4 @@
.menu-group .is-hide {
display: none;
}
}

@ -632,6 +632,11 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
alert('请选择商户支付方式')
return;
}
if (typeof ($scope.partner.client_pay_type) == 'string' || typeof ($scope.partner.client_pay_desc) == 'string') {
$scope.partner.client_pay_type = $scope.partner.client_pay_type.split(",");
$scope.partner.client_pay_desc = $scope.partner.client_pay_desc.split(",");
}
if ($scope.partner.client_pay_type.indexOf('1') >= 0) {
if ($scope.partner.client_pay_desc.join(',').indexOf('10') < 0) {
alert("请检查线上支付场景是否已选择支付方式");
@ -1659,6 +1664,21 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
});
};
$scope.updateClientCBBankPaySurCharge = function () {
if (!$scope.paymentInfo) {
return;
}
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/cbbank_surcharge', {cbbank_surcharge: $scope.paymentInfo.cbbank_surcharge}).then(function () {
// $scope.loadPartnerPaymentInfo();
}, function (resp) {
commonDialog.alert({
title: 'failed to change Customer Pay for Surcharge for Retail',
content: resp.data.message,
type: 'error'
})
})
}
$scope.updateClientApiSurCharge = function () {
if (!$scope.paymentInfo) {
return;

@ -999,6 +999,20 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload','uiBoot
})
})
}
$scope.updateClientCBBankPaySurCharge = function () {
if (!$scope.paymentInfo) {
return;
}
$http.put('/client/partner_info/cbbank_surcharge', {cbbank_surcharge: $scope.paymentInfo.cbbank_surcharge}).then(function () {
// $scope.loadPartnerPaymentInfo();
}, function (resp) {
commonDialog.alert({
title: 'failed to change Customer Pay for Surcharge for Retail',
content: resp.data.message,
type: 'error'
})
})
}
$scope.toggleRequireCustInfo = function () {
if (!$scope.paymentInfo) {
return;

@ -444,6 +444,12 @@
</p>
</div>
</div>
<div class="form-group" ng-if="paymentInfo.enable_cb_bankpay">
<label class="col-sm-4 control-label">Customer Pay for Surcharge for CBBank Pay</label>
<div class="col-sm-8">
<input type="checkbox" ng-model="paymentInfo.cbbank_surcharge" bs-switch ng-change="updateClientCBBankPaySurCharge()">
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">Customer Pay for Surcharge for Retail(POS, iOS App)</label>
<div class="col-sm-8">

@ -45,7 +45,7 @@
<h1>
<span ng-bind="partner.company_name"></span>
<i ng-if="partner.parent_client_id" class="fa fa-sitemap" title="Sub Partner"></i>
<a class="text-primary" ng-if="'00001'|withRole" title="Mock Login"
<a class="text-primary" ng-if="'00011'|withRole" title="Mock Login"
ng-href="/global/userstatus/current_manager/clients/{{partner.client_moniker}}/auth" target="_blank"><i
class="fa fa-share"></i></a><span ng-if="partner.is_valid==0"
ng-class="{pass_timeout:partner.is_valid==0}">(已禁用)</span>
@ -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">

@ -286,7 +286,7 @@
</div>
</div>
</div>
<div class="form-group">
<div class="form-group" ng-if="('10000000011'|withRole)">
<label class="control-label col-sm-2" for="remark-input">Remark</label>
<div class="col-sm-8">
<input class="form-control" ng-model="partner.remark" name="remark"

@ -426,6 +426,12 @@
<input ng-if="paymentInfo.enable_cb_bankpay_link" style="opacity: 0" id="cpcbbankpay" value={{paymentInfo.cb_bankpay_url}} readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Customer Pay for Surcharge for CBBank Pay</label>
<div class="col-sm-10">
<input type="checkbox" ng-model="paymentInfo.cbbank_surcharge" bs-switch ng-change="updateClientCBBankPaySurCharge()">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">CB Bank Pay Channel</label>
<div class="col-sm-3">

@ -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>

@ -1,6 +1,8 @@
package au.com.royalpay.payment.manage.support.abafile;
import com.alibaba.fastjson.JSONObject;
import org.joda.time.DateTime;
import org.junit.Assert;
import org.junit.Test;
import java.util.Date;
@ -16,8 +18,17 @@ public class SettleRemarkTemplateDescriberTest {
public void compile() {
JSONObject settle = new JSONObject();
settle.put("client_moniker", "PINE");
SettleRemarkTemplateDescriber describer = new SettleRemarkTemplateDescriber("RoyalPay{date(MMdd)}{moniker}", settle, new Date());
SettleRemarkTemplateDescriber describer = new SettleRemarkTemplateDescriber("RoyalPay{date(MMdd)}{moniker}", settle, DateTime.parse("2019-07-18").toDate());
String result = describer.compile();
System.out.println(result);
Assert.assertEquals("RoyalPay0718PINE", result);
}
@Test
public void compile2() {
JSONObject settle = new JSONObject();
settle.put("client_moniker", "AUPO");
SettleRemarkTemplateDescriber describer = new SettleRemarkTemplateDescriber("Pay By App {date(ddMMyy)}", settle, DateTime.parse("2019-07-18").toDate());
String res = describer.compile();
Assert.assertEquals("Pay By App 180719", res);
}
}
Loading…
Cancel
Save