Merge branch 'develop'

master
wangning 7 years ago
commit 05ef9e47ca

@ -40,6 +40,10 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>

@ -3,7 +3,10 @@ package au.com.royalpay.payment.manage;
import com.google.code.kaptcha.Producer;
import com.google.code.kaptcha.impl.DefaultKaptcha;
import com.google.code.kaptcha.util.Config;
import com.maxmind.geoip.LookupService;
import com.mongodb.MongoClientOptions;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
@ -65,7 +68,10 @@ public class PaymentManageApplication {
DefaultKaptcha producer = new DefaultKaptcha();
producer.setConfig(config);
return producer;
}
@Bean
public MongoClientOptions mongoOptions() {
return MongoClientOptions.builder().maxConnectionIdleTime(6000).build();
}
}

@ -8,11 +8,13 @@ import au.com.royalpay.payment.manage.analysis.mappers.CustomerAndOrdersStatisti
import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper;
import au.com.royalpay.payment.manage.mappers.log.LogSettleMailMapper;
import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientConfigService;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery;
import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
@ -21,11 +23,12 @@ import org.apache.commons.lang3.time.DateFormatUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
/**
* Created by yishuqian on 20/02/2017.
*/
@ -44,10 +47,15 @@ public class PartnerCardDashboardServiceImp implements PartnerCardDashboardServi
@Resource
private MerchantInfoProvider merchantInfoProvider;
@Resource
private ClientConfigService clientConfigService;
@Resource
private LogSettleMailMapper logSettleMailMapper;
@Resource
private PaymentApi paymentApi;
@Override
public JSONObject getCommonAnalysis(String client_moniker) {
JSONObject client = clientManager.getClientInfoByMoniker(client_moniker);
client.putAll(clientConfigService.find(client.getIntValue("client_id")));
JSONObject earlistOrder = transactionAnalysisMapper.getEarliestOrder(client.getIntValue("client_id"));
Date data = new Date();
if (earlistOrder != null){

@ -23,6 +23,7 @@ import au.com.royalpay.payment.manage.mappers.system.ClientDeviceTokenMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientSettleDelayConfMapper;
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.ClientConfigService;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.notice.beans.NoticeInfo;
import au.com.royalpay.payment.manage.notice.core.NoticeManage;
@ -153,6 +154,8 @@ public class RetailAppServiceImp implements RetailAppService {
private LogSettleMailMapper logSettleMailMapper;
@Resource
private CleanService cleanService;
@Resource
private ClientConfigService clientConfigService;
private Map<String, AppMsgSender> senderMap = new HashMap<>();
@Resource
@ -252,12 +255,14 @@ public class RetailAppServiceImp implements RetailAppService {
JSONObject res = new JSONObject();
res.put("url", url);
res.put("qrcode", QRCodeUtils.qrcodeImageCode(url, 250, false));
// res.put("qrcode_board", merchantInfoProvider.getQrCodeBoard(client, config,clientAccountMapper.findById(device.getString("account_id")),"APP"));
res.put("qrcode_board", merchantInfoProvider.getQrCodeBoard(client, config));
return res;
}
@Override
public void changeSurchargeEnable(JSONObject device, UpdateSurchargeDTO updateSurchargeDTO) {
merchantInfoProvider.changeSurchargeEnable(device,updateSurchargeDTO);
}
@ -311,7 +316,7 @@ public class RetailAppServiceImp implements RetailAppService {
if (device.getIntValue("client_id") != account.getIntValue("client_id") || PartnerRole.getRole(account.getIntValue("role")) == PartnerRole.CASHIER) {
throw new ForbiddenException("You have no permission");
}
clientManager.updateAppClient(device.getIntValue("client_id"), appClientBean);
clientManager.updateAppClient(account,device.getIntValue("client_id"), appClientBean);
}
@ -319,7 +324,9 @@ public class RetailAppServiceImp implements RetailAppService {
public JSONObject getClientInfo(JSONObject device) {
String clientType = device.getString("client_type");
deviceSupport.findRegister(clientType);
JSONObject res = SignInAccountServiceImpl.clientInfoWithNoSecretInfo(clientManager.getClientInfo(device.getIntValue("client_id")));
JSONObject clientWithConfig = clientManager.getClientInfo(device.getIntValue("client_id"));
clientWithConfig.putAll(clientConfigService.find(device.getIntValue("client_id")));
JSONObject res = SignInAccountServiceImpl.clientInfoWithNoSecretInfo(clientWithConfig);
res.put("is_skip_clearing", res.getBoolean("skip_clearing"));
if (clientType.equals("iphone")) {
res.put("skip_clearing", !res.getBoolean("skip_clearing"));
@ -337,14 +344,16 @@ public class RetailAppServiceImp implements RetailAppService {
@Override
public JSONObject setRequireRemarkConfig(JSONObject device, boolean enabled) {
JSONObject user = userInfo(device);
clientManager.switchPermission(null, user.getString("client_moniker"), "require_remark", enabled);
JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
clientManager.switchPermission(account, user.getString("client_moniker"), "require_remark", enabled);
return userInfo(device);
}
@Override
public JSONObject setRequireCustInfoConfig(JSONObject device, boolean enabled) {
JSONObject user = userInfo(device);
clientManager.switchPermission(null, user.getString("client_moniker"), "require_custinfo", enabled);
JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
clientManager.switchPermission(account, user.getString("client_moniker"), "require_custinfo", enabled);
return userInfo(device);
}
@ -360,12 +369,13 @@ public class RetailAppServiceImp implements RetailAppService {
user = JSON.parseObject(user.toJSONString());
return user;
} else {
JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id"));
client = SignInAccountServiceImpl.clientInfoWithNoSecretInfo(client);
client.put("terminal_id", device.getString("client_dev_id"));
client.put("dev_type", device.getString("client_type"));
client.put("dev_name", device.getString("remark"));
return client;
JSONObject clientWithConfig =clientManager.getClientInfo(device.getIntValue("client_id"));
clientWithConfig.putAll(clientConfigService.find(device.getIntValue("client_id")));
clientWithConfig = SignInAccountServiceImpl.clientInfoWithNoSecretInfo(clientWithConfig);
clientWithConfig.put("terminal_id", device.getString("client_dev_id"));
clientWithConfig.put("dev_type", device.getString("client_type"));
clientWithConfig.put("dev_name", device.getString("remark"));
return clientWithConfig;
}
}
@ -1046,12 +1056,12 @@ public class RetailAppServiceImp implements RetailAppService {
JSONObject res = merchantInfoProvider.clientCurrentRate(clientId, now, "Wechat");
JSONObject client = clientManager.getClientInfo(clientId);
Assert.notNull(client, "Client is null");
JSONObject clientConfig = clientConfigService.find(clientId);
JSONObject[] channels = new JSONObject[3];
if (client.getBigDecimal("customer_surcharge_rate") != null) {
res.put("customer_surcharge_rate", client.getBigDecimal("customer_surcharge_rate"));
if (clientConfig.getBigDecimal("customer_surcharge_rate") != null) {
res.put("customer_surcharge_rate", clientConfig.getBigDecimal("customer_surcharge_rate"));
}
res.put("max_customer_surcharge_rate", PlatformEnvironment.getEnv().getMaxCustomerSurchargeRate());
channels[0] = getChannel(clientId, now, "Wechat");
@ -1071,10 +1081,10 @@ public class RetailAppServiceImp implements RetailAppService {
JSONObject res = merchantInfoProvider.clientCurrentRate(clientId, now, "Wechat");
JSONObject client = clientManager.getClientInfo(clientId);
Assert.notNull(client, "Client is null");
JSONObject clientConfig = clientConfigService.find(clientId);
ArrayList<JSONObject> channels = new ArrayList<>();
if (client.getBigDecimal("customer_surcharge_rate") != null) {
res.put("customer_surcharge_rate", client.getBigDecimal("customer_surcharge_rate"));
if (clientConfig.getBigDecimal("customer_surcharge_rate") != null) {
res.put("customer_surcharge_rate", clientConfig.getBigDecimal("customer_surcharge_rate"));
}
res.put("max_customer_surcharge_rate", PlatformEnvironment.getEnv().getMaxCustomerSurchargeRate());
JSONObject wechat = getChannel(clientId, now, "Wechat");
@ -1280,8 +1290,8 @@ public class RetailAppServiceImp implements RetailAppService {
res = cashbackService.getCashbackAmount(params);
JSONObject rate = merchantInfoProvider.clientCurrentRate(device.getIntValue("client_id"), new Date(), "Wechat");
if (rate.getInteger("clean_days") == null) {
JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id"));
rate.put("clean_days", client.getIntValue("clean_days"));
JSONObject clientConfig = clientConfigService.find(device.getIntValue("client_id"));
rate.put("clean_days", clientConfig.getIntValue("clean_days"));
}
res.put("clean_days", rate.getIntValue("clean_days"));
return res;
@ -1374,8 +1384,8 @@ public class RetailAppServiceImp implements RetailAppService {
JSONObject res = clientManager.getBankAccountByClientId(Integer.parseInt(client_id));
JSONObject rate = merchantInfoProvider.clientCurrentRate(Integer.parseInt(client_id), new Date(), "Wechat");
if (rate.getInteger("clean_days") == null) {
JSONObject client = clientManager.getClientInfo(Integer.parseInt(client_id));
rate.put("clean_days", client.getIntValue("clean_days"));
JSONObject clientConfig = clientConfigService.find(Integer.parseInt(client_id));
rate.put("clean_days", clientConfig.getIntValue("clean_days"));
}
res.put("clean_days", rate.getIntValue("clean_days"));
return res;

@ -1,6 +1,7 @@
package au.com.royalpay.payment.manage.apps.web;
import au.com.royalpay.payment.manage.apps.AppController;
import au.com.royalpay.payment.manage.merchants.core.ClientConfigService;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.tools.CommonConsts;
import com.alibaba.fastjson.JSONObject;
@ -13,10 +14,14 @@ import javax.annotation.Resource;
public class CustomerRMIController {
@Resource
private ClientManager clientManager;
@Resource
private ClientConfigService clientConfigService;
@RequestMapping(value = "/{client_moniker}", method = RequestMethod.GET)
@ResponseBody
public JSONObject checkPointsAfterPay(@PathVariable String client_moniker, @ModelAttribute(CommonConsts.APP_INFO) JSONObject app) {
return clientManager.getClientInfoByMoniker(client_moniker);
JSONObject result = clientManager.getClientInfoByMoniker(client_moniker);
result.putAll(clientConfigService.find(result.getIntValue("client_id")));
return result;
}
}

@ -7,6 +7,7 @@ import au.com.royalpay.payment.manage.mappers.funds.FundsConfigMapper;
import au.com.royalpay.payment.manage.mappers.funds.XPlanMerchantMapper;
import au.com.royalpay.payment.manage.mappers.funds.XPlanOperationLogMapper;
import au.com.royalpay.payment.manage.mappers.funds.XPlanTransactionMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientConfigService;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.env.RequestEnvironment;
@ -14,18 +15,21 @@ import au.com.royalpay.payment.tools.env.SysConfigManager;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
/**
* Create by yixian at 2017-09-14 17:33
*/
@ -44,6 +48,8 @@ public class XPlanFundConfigServiceImpl implements XPlanFundConfigService {
private XPlanMerchantMapper xPlanMerchantMapper;
@Resource
private XPlanTransactionMapper xPlanTransactionMapper;
@Resource
private ClientConfigService clientConfigService;
@Override
public void configuration(XPlanFundConfig config, JSONObject manager) {
@ -112,6 +118,7 @@ public class XPlanFundConfigServiceImpl implements XPlanFundConfigService {
private JSONObject getClient(String clientMoniker) {
JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker);
client.putAll(clientConfigService.find(client.getIntValue("client_id")));
if (client == null) {
throw new InvalidShortIdException();
}

@ -10,6 +10,7 @@ import au.com.royalpay.payment.manage.mappers.funds.*;
import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper;
import au.com.royalpay.payment.manage.mappers.system.CalendarMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientConfigService;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.tools.permission.enums.PartnerRole;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
@ -66,6 +67,8 @@ public class XPlanFundProcessorImpl implements XPlanFundProcesor {
private XPlanInterestClientLogMapper xPlanInterestClientLogMapper;
@Resource
private XPlanFundConfigService xPlanFundConfigService;
@Resource
private ClientConfigService clientConfigService;
@Resource(name = "systemCalculator")
private SettlementDetailCalculator systemCalculator;
@ -395,6 +398,7 @@ public class XPlanFundProcessorImpl implements XPlanFundProcesor {
private JSONObject getClient(String clientMoniker) {
JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker);
client.putAll(clientConfigService.find(client.getIntValue("client_id")));
if (client == null) {
throw new InvalidShortIdException();
}

@ -16,7 +16,7 @@ public interface SettleDelayConfigurer {
void configClient(String clientMoniker, SettleDelayConfig config, JSONObject manager);
void disableClient(String clientMoniker);
void disableClient(JSONObject account,String clientMoniker);
List<JSONObject> getWeekendAnalysis(JSONObject params);

@ -14,6 +14,7 @@ import au.com.royalpay.payment.manage.mappers.system.CalendarMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientRateMapper;
import au.com.royalpay.payment.manage.mappers.system.ManagerMapper;
import au.com.royalpay.payment.manage.mappers.system.RateMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientConfigService;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.notice.core.MailService;
import au.com.royalpay.payment.manage.signin.beans.TodoNotice;
@ -134,6 +135,8 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
private CalendarMapper calendarMapper;
@Resource
private SpringTemplateEngine thymeleaf;
@Resource
private ClientConfigService clientConfigService;
@Value("${app.settlement.email-to}")
private String settlementEmailTo;
@ -509,8 +512,8 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
private boolean isClientIgnored(JSONObject transaction) {
int clientId = transaction.getIntValue("client_id");
JSONObject client = clientManager.getClientInfo(clientId);
return client.getBooleanValue("skip_clearing");
JSONObject clientConfig = clientConfigService.find(clientId);
return clientConfig.getBooleanValue("skip_clearing");
}
@Override

@ -16,10 +16,12 @@ import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.lock.Locker;
import au.com.royalpay.payment.tools.utils.CurrencyAmountUtils;
import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.joda.time.DateTime;
@ -31,11 +33,19 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import javax.annotation.Resource;
/**
* Create by yixian at 2017-09-08 15:06
@ -96,15 +106,15 @@ public class SettleDelayConfigurerImpl implements SettleDelayConfigurer {
clientSettleDelayConfMapper.save(conf);
}
clientManager.setWeekendDelay(clientId, true);
clientManager.setWeekendDelay(manager,clientMoniker,clientId, true);
}
@Override
public void disableClient(String clientMoniker) {
public void disableClient(JSONObject account,String clientMoniker) {
JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker);
clientSettleDelayConfMapper.disableClient(client.getIntValue("client_id"));
clientManager.setWeekendDelay(client.getIntValue("client_id"), false);
clientManager.setWeekendDelay(account,clientMoniker,client.getIntValue("client_id"), false);
}
@Override

@ -1,6 +1,5 @@
package au.com.royalpay.payment.manage.management.clearing.web;
import au.com.royalpay.payment.core.PmtCashbackService;
import au.com.royalpay.payment.manage.analysis.beans.SettleDelayQuery;
import au.com.royalpay.payment.manage.cashback.core.CashbackService;
import au.com.royalpay.payment.manage.management.clearing.beans.SettleDelayConfig;
@ -53,8 +52,8 @@ public class SettleDelayConfigController {
}
@ManagerMapping(value = "/clients/{clientMoniker}", method = RequestMethod.DELETE, role = { ManagerRole.ADMIN })
public void disableClient(@PathVariable String clientMoniker) {
settleDelayConfigurer.disableClient(clientMoniker);
public void disableClient( @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker) {
settleDelayConfigurer.disableClient(manager,clientMoniker);
}
@ManagerMapping(value = "/traAnalysis", method = RequestMethod.GET, role = { ManagerRole.ADMIN })

@ -0,0 +1,20 @@
package au.com.royalpay.payment.manage.mappers.log;
import org.apache.ibatis.annotations.Param;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
/**
* Created by yixian on 2016-10-14.
*/
@AutoMapper(tablename = "log_client_config", pkName = "id")
public interface ClientConfigLogMapper {
@AutoSql(type = SqlType.INSERT)
void saveLog(JSONObject log);
}

@ -0,0 +1,30 @@
package au.com.royalpay.payment.manage.mappers.system;
import java.util.Date;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import cn.yixblog.support.mybatis.autosql.annotations.AdvanceSelect;
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
/**
* Created by wangning on 2018-04-08.
*/
@AutoMapper(tablename = "sys_client_config", pkName = "client_id")
public interface ClientConfigMapper {
@AutoSql(type = SqlType.INSERT)
void save(JSONObject partner);
@AutoSql(type = SqlType.UPDATE)
int update(JSONObject partner);
@AutoSql(type = SqlType.SELECT)
JSONObject find(@Param("client_id") int client_id);
}

@ -58,8 +58,6 @@ public interface ClientMapper {
List<JSONObject> listClientsForSettlementWithDetail();
void disableClient(@Param("client_id") int clientId);
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid=1 and approve_email_id is not null and approve_email_send=3")
List<JSONObject> listClientsWithEmailNotVerify();

@ -20,4 +20,7 @@ public interface MerchantIdManageService {
void save(JSONObject record);
void disable(String sub_merchant_id);
JSONObject getClientQrCodeImg(JSONObject manager,String sub_merchant_id);
}

@ -7,17 +7,28 @@ import au.com.royalpay.payment.manage.mappers.client.ClientSubMerchantIdMapper;
import au.com.royalpay.payment.manage.mappers.payment.CommonSubMerchantIdMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.merchantid.core.MerchantIdManageService;
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.env.SysConfigManager;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
import cn.yixblog.platform.http.HttpRequestGenerator;
import cn.yixblog.platform.http.HttpRequestResult;
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.codec.digest.DigestUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMethod;
import sun.text.normalizer.NormalizerBase;
import javax.annotation.Resource;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@ -47,6 +58,8 @@ public class MerchantIdManageServiceImpl implements MerchantIdManageService {
@Resource
private MpPaymentApi mpPaymentApi;
private Logger logger = LoggerFactory.getLogger(getClass());
@Override
public Map<String, List<JSONObject>> listSubMerchantId(JSONObject manager) {
@ -130,4 +143,44 @@ public class MerchantIdManageServiceImpl implements MerchantIdManageService {
Map<String, List<JSONObject>> clientsMap = clients.stream().filter(t->t.containsKey("merchant_id")).filter(t->t.containsKey("sub_merchant_id")).collect(Collectors.groupingBy(t->t.getString("merchant_id")));
return clientsMap;
}
@Override
public JSONObject getClientQrCodeImg(JSONObject manager,String sub_merchant_id) {
List<JSONObject> clientMonikers = showClientMoniker(manager,sub_merchant_id);
if(clientMonikers.isEmpty()){
throw new BadRequestException("当前子商户号下暂无商户");
}
String partner_code = clientMonikers.get(0).getString("client_moniker");
String orderId = "Merchant" + DateFormatUtils.format(new Date(), "yyyyMMddHHmmss") + "_" + RandomStringUtils.random(5, true, true).toUpperCase();
JSONObject param = new JSONObject();
param.put("price", 10);
param.put("description", "order");
param.put("operator", "web");
param.put("currency","CNY");
String createUrl= "https://mpay.royalpay.com.au/api/v1.0/gateway/partners/" + partner_code + "/orders/" + orderId + "?" + queryParams(partner_code);
HttpRequestResult result = null;
try {
result = new HttpRequestGenerator(createUrl, RequestMethod.PUT).setJSONEntity(param).execute();
} catch (URISyntaxException e) {
e.printStackTrace();
}
if (result.isSuccess()) {
try {
return result.getResponseContentJSONObj();
} catch (IOException e) {
throw new ServerErrorException(e.getMessage(), e);
}
}
return null;
}
private String queryParams(String client_moniker) {
JSONObject client = clientMapper.findClientByMoniker(client_moniker);
long time = System.currentTimeMillis();
String nonceStr = RandomStringUtils.random(15, true, true);
String validStr = client_moniker + "&" + time + "&" + nonceStr + "&" + client.getString("credential_code");
String sign = DigestUtils.sha256Hex(validStr).toLowerCase();
return "time=" + time + "&nonce_str=" + nonceStr + "&sign=" + sign;
}
}

@ -32,6 +32,7 @@ public class MerchantIdManageController {
return merchantIdManageService.listSubMerchantId(manager);
}
@RequestMapping(method = RequestMethod.GET,value = "/trade")
@RequireManager(role = {ManagerRole.OPERATOR})
public JSONObject listNotTradeSubMerchantId(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
@ -72,4 +73,10 @@ public class MerchantIdManageController {
public void disableCommonSubMerchantId(@PathVariable String sub_merchant_id) {
merchantIdManageService.disable(sub_merchant_id);
}
@RequestMapping(value = "/qrcode/{sub_merchant_id}", method = RequestMethod.PUT)
@RequireManager(role = {ManagerRole.OPERATOR})
public JSONObject getClientQrCodeImg(@PathVariable String sub_merchant_id,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return merchantIdManageService.getClientQrCodeImg(manager,sub_merchant_id);
}
}

@ -0,0 +1,91 @@
package au.com.royalpay.payment.manage.merchants.beans.mongo;
import org.springframework.data.mongodb.core.mapping.Document;
import java.util.Date;
@Document(collection = "client_config_log")
public class ClientConfigLog {
private long id;
private int clientId;
private String business;
private String userType;
private String userId;
private String userName;
private String originData;
private String newData;
private Date createTime;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public int getClientId() {
return clientId;
}
public void setClientId(int clientId) {
this.clientId = clientId;
}
public String getBusiness() {
return business;
}
public void setBusiness(String business) {
this.business = business;
}
public String getUserType() {
return userType;
}
public void setUserType(String userType) {
this.userType = userType;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getOriginData() {
return originData;
}
public void setOriginData(String originData) {
this.originData = originData;
}
public String getNewData() {
return newData;
}
public void setNewData(String newData) {
this.newData = newData;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}

@ -0,0 +1,16 @@
package au.com.royalpay.payment.manage.merchants.core;
import com.alibaba.fastjson.JSONObject;
/**
* Created by yixian on 2016-06-25.
*/
public interface ClientConfigService {
void update(JSONObject record);
JSONObject find(int client_id);
JSONObject save(JSONObject record);
}

@ -65,7 +65,7 @@ public interface ClientManager {
void checkAndSendInitEmail(JSONObject manager, String clientMoniker);
void sendInitEmail(JSONObject client, String username, String pwd);
void sendInitEmail(JSONObject account,JSONObject client, String username, String pwd);
void markApproveEmailSendStatus(String clientMoniker, JSONObject manager);
@ -115,13 +115,13 @@ public interface ClientManager {
void toggleAccountReceiveNoticeByOpenId(String openid, boolean enable);
@Transactional
void togglePayNotice(String clientMoniker, boolean enable);
void togglePayNotice(JSONObject account,String clientMoniker, boolean enable);
@Transactional
void changeRole(JSONObject manager, String clientMoniker, String accountId, int role);
@Transactional
void toggleAuditRefund(String clientMoniker, boolean enable);
void toggleAuditRefund(String clientMoniker, boolean enable, JSONObject account);
List<JSONObject> listPaymentNoticeAccounts(int clientId);
@ -129,7 +129,7 @@ public interface ClientManager {
JSONObject getAccountByOpenId(String openid);
void updateClientBDUser(String clientMoniker, int managerId);
void updateClientBDUser(JSONObject account,String clientMoniker, int managerId);
void refreshClientCredentialCode(JSONObject manager, String clientMoniker);
@ -164,11 +164,11 @@ public interface ClientManager {
JSONObject getQRCode(JSONObject manager, String clientMoniker, QRCodeConfig config);
String getQrCodeBoard(JSONObject client, QRCodeConfig config);
String getQrCodeBoard(JSONObject client, QRCodeConfig config,JSONObject account,String plantform);
void writeAggregateQrCodeBoard(JSONObject manager, String clientMoniker, QRCodeConfig config, OutputStream ous);
void writeAggregateQrCodeBoard(JSONObject manager, String clientMoniker, QRCodeConfig config, OutputStream ous,String plantform);
void writeQrCodeBoard(JSONObject manager, String clientMoniker, QRCodeConfig config, OutputStream ous);
void writeQrCodeBoard(JSONObject manager, String clientMoniker, QRCodeConfig config, OutputStream ous,String plantform);
void writePoster(JSONObject manager, String clientMoniker, OutputStream ous);
@ -177,7 +177,7 @@ public interface ClientManager {
void writeActivityPoster(JSONObject manager, String clientMoniker, String activityName, OutputStream ous) throws IOException;
@Transactional
void updateTimeZone(String clientMoniker, String timezone);
void updateTimeZone(JSONObject account,String clientMoniker, String timezone);
JSONObject listClientDevices(JSONObject manager, String clientMoniker, String remark, int page, int limit, String client_type, String[] client_ids);
@ -189,17 +189,17 @@ public interface ClientManager {
JSONObject getBankInfo(JSONObject manager, String clientMoniker, String bsb_no);
void setMaxOrderAmount(String clientMoniker, BigDecimal limit);
void setMaxOrderAmount(JSONObject account,String clientMoniker, BigDecimal limit);
void setClientQRCodePaySurCharge(String clientMoniker, boolean paySurcharge);
void setClientQRCodePaySurCharge(JSONObject account,String clientMoniker, boolean paySurcharge);
void setClientApiPaySurCharge(String clientMoniker, boolean enableApiSurcharge);
void setClientApiPaySurCharge(JSONObject account,String clientMoniker, boolean enableApiSurcharge);
void setClientRetailPaySurCharge(String clientMoniker, boolean paySurcharge);
void setClientRetailPaySurCharge(JSONObject account,String clientMoniker, boolean paySurcharge);
void setClientTaxInSurcharge(String clientMoniker, boolean taxInSurcharge);
void setClientTaxInSurcharge(JSONObject account,String clientMoniker, boolean taxInSurcharge);
void setClientCustomerTaxFree(String clientMoniker, boolean customerTaxFree);
void setClientCustomerTaxFree(JSONObject account,String clientMoniker, boolean customerTaxFree);
List<JSONObject> listClientsForSettlement();
@ -237,21 +237,21 @@ public interface ClientManager {
void changeRetailPaySurcharge(JSONObject account, boolean paySurcharge);
void changeSurcharge(JSONObject device, UpdateSurchargeDTO updateSurchargeDTO);
void changeSurcharge(JSONObject account,JSONObject device, UpdateSurchargeDTO updateSurchargeDTO);
void refusePartner(String clientMoniker, JSONObject manager, String refuse_remark);
JSONArray getAllClientIds(int clientId);
void updateAppClient(int client_id, AppClientBean appClientBean);
void updateAppClient(JSONObject account,int client_id, AppClientBean appClientBean);
void setSkipClearing(String clientMoniker, Boolean skip_clearing);
void setSkipClearing(JSONObject account,String clientMoniker, Boolean skip_clearing);
void enableGatewayUpgrade(String clientMoniker, boolean gatewayUpgrade);
void enableGatewayUpgrade(JSONObject account,String clientMoniker, boolean gatewayUpgrade);
void setCustomerSurchargeRate(String clientMoniker, BigDecimal customer_surcharge_rate);
void setCustomerSurchargeRate(JSONObject account,String clientMoniker, BigDecimal customer_surcharge_rate);
void setOrderExpiryConfig(String clientMoniker, String orderExpiryConfig);
void setOrderExpiryConfig(JSONObject account,String clientMoniker, String orderExpiryConfig);
void getAgreeFile(String clientMoniker, JSONObject manager) throws Exception;
@ -275,7 +275,7 @@ public interface ClientManager {
void validRefundPwd(JSONObject account, String pwd);
void setWeekendDelay(int clientId, boolean delay);
void setWeekendDelay(JSONObject account,String client_moniker,int clientId, boolean delay);
List<JSONObject> listSubMerchantIdApplys(JSONObject manager, String clientMoniker);

@ -0,0 +1,14 @@
package au.com.royalpay.payment.manage.merchants.core;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify;
import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
/**
* Create by yixian at 2018-04-12 16:24
*/
public interface ClientModifySupport {
void processClientModify(ClientModify clientModify);
void processClientConfigModify(ClientConfigModify clientConfigModify);
}

@ -1,21 +1,30 @@
package au.com.royalpay.payment.manage.merchants.core.impls;
import au.com.royalpay.payment.manage.mappers.system.*;
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientApplyMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientBDMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.mappers.system.OrgMapper;
import au.com.royalpay.payment.manage.merchants.beans.ClientApplyInfo;
import au.com.royalpay.payment.manage.merchants.beans.PartnerQuery;
import au.com.royalpay.payment.manage.merchants.core.ClientApply;
import au.com.royalpay.payment.manage.merchants.core.ClientConfigService;
import au.com.royalpay.payment.manage.merchants.core.ClientModifySupport;
import au.com.royalpay.payment.manage.merchants.entity.impls.SourceModify;
import au.com.royalpay.payment.manage.merchants.events.ClientApplyEvent;
import au.com.royalpay.payment.manage.merchants.events.ClientApplyNotifyBDEvent;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.commons.lang3.RandomStringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationEventPublisher;
@ -26,11 +35,12 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
/**
* Created by yishuqian on 18/10/2016.
*/
@ -48,9 +58,13 @@ public class ClientApplyImpl implements ClientApply, ApplicationEventPublisherAw
private OrgMapper orgMapper;
@Resource
private StringRedisTemplate stringRedisTemplate;
@Resource
private ClientModifySupport clientModifySupport;
@Value("${app.redis.prefix}")
private String redisPrefix;
private ApplicationEventPublisher publisher;
@Resource
private ClientConfigService clientConfigService;
@Override
@Transactional
@ -135,6 +149,7 @@ public class ClientApplyImpl implements ClientApply, ApplicationEventPublisherAw
}
@Override
@Transactional
public JSONObject passPartnerApplication(String client_apply_id, ClientApplyInfo info, JSONObject manager) {
JSONObject apply = clientApplyMapper.findClientApplicationById(client_apply_id);
@ -200,6 +215,10 @@ public class ClientApplyImpl implements ClientApply, ApplicationEventPublisherAw
partner.put("country","AUS");//自主申请
clientMapper.save(partner);
JSONObject clientConfig = new JSONObject();
clientConfig.put("client_id",partner.getIntValue("client_id"));
clientConfigService.save(clientConfig);
JSONObject client_bd = new JSONObject();
client_bd.put("client_id", partner.getIntValue("client_id"));
client_bd.put("bd_id", manager.getString("manager_id"));
@ -230,8 +249,7 @@ public class ClientApplyImpl implements ClientApply, ApplicationEventPublisherAw
}
JSONObject client = clientMapper.findClientByMoniker(info.getClientMoniker());
Assert.notNull(client);
client.put("source",2);//自主申请
clientMapper.update(client);
clientModifySupport.processClientModify(new SourceModify(manager,client.getString("client_moniker"),2));
apply.put("client_id", client.getIntValue("client_id"));
apply.put("client_moniker", info.getClientMoniker());
apply.put("apply_approve_result", 2);

@ -0,0 +1,35 @@
package au.com.royalpay.payment.manage.merchants.core.impls;
import au.com.royalpay.payment.manage.mappers.system.ClientConfigMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientConfigService;
import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
public class ClientConfigServiceImpl implements ClientConfigService {
@Resource
private ClientConfigMapper clientConfigMapper;
@Override
public void update(JSONObject record) {
}
@Override
public JSONObject find(int client_id) {
return clientConfigMapper.find(client_id);
}
@Override
public JSONObject save(JSONObject record) {
JSONObject clientConfig= clientConfigMapper.find(record.getIntValue("Client_id"));
if(clientConfig!=null){
throw new ServerErrorException("client config is repeated");
}
clientConfigMapper.save(record);
return record;
}
}

@ -0,0 +1,42 @@
package au.com.royalpay.payment.manage.merchants.core.impls;
import au.com.royalpay.payment.manage.mappers.system.ClientConfigMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientInfoCacheSupport;
import au.com.royalpay.payment.manage.merchants.core.ClientModifySupport;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify;
import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* Create by yixian at 2018-04-12 16:25
*/
@Service
public class ClientModifySupportImpl implements ClientModifySupport {
@Resource
private MerchantInfoProvider merchantInfoProvider;
@Resource
private ClientInfoCacheSupport clientInfoCacheSupport;
@Resource
private ClientMapper clientMapper;
@Resource
private ClientConfigMapper clientConfigMapper;
@Resource
private MongoTemplate mongoTemplate;
@Override
public void processClientModify(ClientModify modify) {
int clientId = modify.doModify(merchantInfoProvider, clientMapper,mongoTemplate);
clientInfoCacheSupport.clearClientCache(clientId);
}
@Override
public void processClientConfigModify(ClientConfigModify clientConfigModify) {
clientConfigModify.doModify(merchantInfoProvider, clientConfigMapper,clientMapper,mongoTemplate);
}
}

@ -0,0 +1,79 @@
package au.com.royalpay.payment.manage.merchants.entity;
import au.com.royalpay.payment.manage.mappers.system.ClientConfigMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.merchants.beans.mongo.ClientConfigLog;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import au.com.royalpay.payment.tools.utils.id.IdUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.Map;
import java.util.stream.Collectors;
/**
* Create by yixian at 2018-04-12 16:19
*/
public abstract class ClientConfigModify {
private JSONObject account;
private String clientMoniker;
public ClientConfigModify(JSONObject account, String clientMoniker) {
this.account = account;
this.clientMoniker = clientMoniker;
}
protected abstract String business();
protected abstract JSONObject getModifyResult();
@Transactional
public int doModify(MerchantInfoProvider merchantInfoProvider, ClientConfigMapper clientConfigMapper, ClientMapper clientMapper, MongoTemplate mongoTemplate) {
JSONObject client = merchantInfoProvider.getClientInfoByMoniker(clientMoniker);
JSONObject modifyResult = getModifyResult();
try {
saveModifyHistory(client, modifyResult, mongoTemplate);
}catch (Exception e){
}
int clientId = client.getIntValue("client_id");
modifyResult.put("client_id", clientId);
clientConfigMapper.update(modifyResult);
clientMapper.update(modifyResult);
return clientId;
}
private void saveModifyHistory(JSONObject client, JSONObject modifyResult,MongoTemplate mongoTemplate) {
if (account == null) {
return;
}
ClientConfigLog clientConfigLog = new ClientConfigLog();
clientConfigLog.setId(IdUtil.getId());
clientConfigLog.setBusiness(business());
clientConfigLog.setClientId(client.getIntValue("client_id"));
boolean isPartner = true;
if (StringUtils.isNotEmpty(account.getString("account_id"))) {
isPartner = true;
}
if (StringUtils.isNotEmpty(account.getString("manager_id"))) {
isPartner = false;
}
clientConfigLog.setUserType(isPartner ? "Merchant" : "Manager");
clientConfigLog.setCreateTime(new Date());
clientConfigLog.setNewData(modifyResult.toJSONString());
clientConfigLog.setUserId(isPartner ? account.getString("account_id") : account.getString("manager_id"));
Map<String, Object> beforeModify = modifyResult.keySet().stream().collect(Collectors.toMap(key -> key, client::get));
clientConfigLog.setOriginData(JSON.toJSONString(beforeModify));
clientConfigLog.setUserName(isPartner ? account.getString("display_name") : account.getString("display_name"));
mongoTemplate.insert(clientConfigLog);
}
}

@ -0,0 +1,77 @@
package au.com.royalpay.payment.manage.merchants.entity;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.merchants.beans.mongo.ClientConfigLog;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import au.com.royalpay.payment.tools.utils.id.IdUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.Map;
import java.util.stream.Collectors;
/**
* Create by yixian at 2018-04-12 16:19
*/
public abstract class ClientModify {
private JSONObject account;
private String clientMoniker;
public ClientModify(JSONObject account, String clientMoniker) {
this.account = account;
this.clientMoniker = clientMoniker;
}
protected abstract String business();
protected abstract JSONObject getModifyResult();
@Transactional
public int doModify(MerchantInfoProvider merchantInfoProvider, ClientMapper clientMapper, MongoTemplate mongoTemplate) {
JSONObject client = merchantInfoProvider.getClientInfoByMoniker(clientMoniker);
JSONObject modifyResult = getModifyResult();
try {
saveModifyHistory(client, modifyResult, mongoTemplate);
}catch (Exception e){
}
int clientId = client.getIntValue("client_id");
modifyResult.put("client_id", clientId);
clientMapper.update(modifyResult);
return clientId;
}
private void saveModifyHistory(JSONObject client, JSONObject modifyResult, MongoTemplate mongoTemplate) {
if (account == null) {
return;
}
ClientConfigLog clientConfigLog = new ClientConfigLog();
clientConfigLog.setId(IdUtil.getId());
clientConfigLog.setBusiness(business());
clientConfigLog.setClientId(client.getIntValue("client_id"));
boolean isPartner = true;
if (StringUtils.isNotEmpty(account.getString("account_id"))) {
isPartner = true;
}
if (StringUtils.isNotEmpty(account.getString("manager_id"))) {
isPartner = false;
}
clientConfigLog.setUserType(isPartner ? "Merchant" : "Manager");
clientConfigLog.setCreateTime(new Date());
clientConfigLog.setNewData(modifyResult.toJSONString());
clientConfigLog.setUserId(isPartner ? account.getString("account_id") : account.getString("manager_id"));
Map<String, Object> beforeModify = modifyResult.keySet().stream().collect(Collectors.toMap(key -> key, client::get));
clientConfigLog.setOriginData(JSON.toJSONString(beforeModify));
clientConfigLog.setUserName(isPartner ? account.getString("display_name") : account.getString("display_name"));
mongoTemplate.save(clientConfigLog);
}
}

@ -0,0 +1,30 @@
package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import com.alibaba.fastjson.JSONObject;
/**
* Create by yixian at 2018-04-12 16:43
*/
public class ApproveEmailModify extends ClientModify {
private int approve_email_send;
public ApproveEmailModify(JSONObject account, String clientMoniker, int approve_email_send) {
super(account, clientMoniker);
this.approve_email_send = approve_email_send;
}
@Override
protected String business() {
return "开启绿色通道";
}
@Override
protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject();
modify.put("approve_email_send", approve_email_send);
return modify;
}
}

@ -0,0 +1,69 @@
package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import java.util.Date;
/**
* Create by yixian at 2018-04-12 16:43
*/
public class AuditModify extends ClientModify {
private Integer source;
private Integer open_status;
private Integer approve_result;
private String approver;
private Date approve_time;
private String refuse_remark;
public AuditModify(JSONObject account, String clientMoniker, Integer approve_result, String approver, Date approve_time) {
super(account, clientMoniker);
this.approve_result = approve_result;
this.approver = approver;
this.approve_time = approve_time;
}
@Override
protected String business() {
return "修改商户source状态为:" + source;
}
@Override
protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject();
modify.put("approve_result",approve_result);
modify.put("approver",approver);
modify.put("approve_time",approve_time);
if(source!=null){
modify.put("source",source);
}
if(open_status!=null){
modify.put("open_status",open_status);
}
if(StringUtils.isNotEmpty(refuse_remark)){
modify.put("refuse_remark",refuse_remark);
}
return modify;
}
public void setSource(Integer source) {
this.source = source;
}
public void setOpen_status(Integer open_status) {
this.open_status = open_status;
}
public void setRefuse_remark(String refuse_remark) {
this.refuse_remark = refuse_remark;
}
public void setApprove_result(Integer approve_result) {
this.approve_result = approve_result;
}
}

@ -0,0 +1,48 @@
package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
/**
* Create by yixian at 2018-04-12 16:43
*/
public class BDUserModify extends ClientModify {
private String bd_user;
private String bd_user_name;
private int org_id;
public BDUserModify(JSONObject account, String clientMoniker, String bd_user, String bd_user_name) {
super(account, clientMoniker);
this.bd_user = bd_user;
this.bd_user_name = bd_user_name;
}
public int getOrg_id() {
return org_id;
}
public void setOrg_id(int org_id) {
this.org_id = org_id;
}
@Override
protected String business() {
return "修改商户BD为"+bd_user_name+""+bd_user+"";
}
@Override
protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject();
modify.put("bd_user", bd_user);
if(StringUtils.isNotEmpty(bd_user_name)) {
modify.put("bd_user_name", bd_user_name);
}
if(org_id!=0){
modify.put("org_id",org_id);
}
return modify;
}
}

@ -0,0 +1,30 @@
package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify;
import com.alibaba.fastjson.JSONObject;
/**
* Create by yixian at 2018-04-12 16:43
*/
public class ClearDaysModify extends ClientConfigModify {
private int settle_hour;
public ClearDaysModify(JSONObject account, String clientMoniker, int settle_hour) {
super(account, clientMoniker);
this.settle_hour = settle_hour;
}
@Override
protected String business() {
return "修改商户清算截止时间为:"+settle_hour;
}
@Override
protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject();
modify.put("settle_hour", settle_hour);
return modify;
}
}

@ -0,0 +1,30 @@
package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify;
import com.alibaba.fastjson.JSONObject;
/**
* Create by yixian at 2018-04-12 16:43
*/
public class CredentialCodeModify extends ClientConfigModify {
private String credential_code;
public CredentialCodeModify(JSONObject account, String clientMoniker, String credential_code) {
super(account, clientMoniker);
this.credential_code = credential_code;
}
@Override
protected String business() {
return "重置商户secret";
}
@Override
protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject();
modify.put("credential_code", credential_code);
return modify;
}
}

@ -0,0 +1,32 @@
package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify;
import com.alibaba.fastjson.JSONObject;
import java.math.BigDecimal;
/**
* Create by yixian at 2018-04-12 16:43
*/
public class CustomerSurchargeRateModify extends ClientConfigModify {
private BigDecimal customer_surcharge_rate;
public CustomerSurchargeRateModify(JSONObject account, String clientMoniker, BigDecimal customer_surcharge_rate) {
super(account, clientMoniker);
this.customer_surcharge_rate = customer_surcharge_rate;
}
@Override
protected String business() {
return "修改商户客户手续费率为:"+customer_surcharge_rate;
}
@Override
protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject();
modify.put("customer_surcharge_rate", customer_surcharge_rate);
return modify;
}
}

@ -0,0 +1,30 @@
package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import com.alibaba.fastjson.JSONObject;
/**
* Create by yixian at 2018-04-12 16:43
*/
public class DisableModify extends ClientModify {
private boolean is_valid;
public DisableModify(JSONObject account, String clientMoniker, boolean is_valid) {
super(account, clientMoniker);
this.is_valid = is_valid;
}
@Override
protected String business() {
return is_valid?"开启":"禁用";
}
@Override
protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject();
modify.put("is_valid", is_valid);
return modify;
}
}

@ -0,0 +1,32 @@
package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify;
import com.alibaba.fastjson.JSONObject;
/**
* Create by yixian at 2018-04-12 16:43
*/
public class EmailModify extends ClientConfigModify {
private int approve_email_send;
private String approve_email_id;
public EmailModify(JSONObject account, String clientMoniker, int approve_email_send, String approve_email_id) {
super(account, clientMoniker);
this.approve_email_send = approve_email_send;
this.approve_email_id = approve_email_id;
}
@Override
protected String business() {
return "修改商户邮件发送状态为准备发送";
}
@Override
protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject();
modify.put("approve_email_send", 4);
modify.put("approve_email_id", null);
return modify;
}
}

@ -0,0 +1,32 @@
package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify;
import com.alibaba.fastjson.JSONObject;
import java.math.BigDecimal;
/**
* Create by yixian at 2018-04-12 16:43
*/
public class EmailSendStandByModify extends ClientConfigModify {
private BigDecimal max_order_amount;
public EmailSendStandByModify(JSONObject account, String clientMoniker, BigDecimal max_order_amount) {
super(account, clientMoniker);
this.max_order_amount = max_order_amount;
}
@Override
protected String business() {
return "修改商户最大订单额为:"+max_order_amount;
}
@Override
protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject();
modify.put("max_order_amount", max_order_amount);
return modify;
}
}

@ -0,0 +1,36 @@
package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import com.alibaba.fastjson.JSONObject;
import java.util.Date;
/**
* Create by yixian at 2018-04-12 16:43
*/
public class GreenChannelModify extends ClientModify {
private String manager_id;
public GreenChannelModify(JSONObject account, String clientMoniker, String manager_id) {
super(account, clientMoniker);
this.manager_id = manager_id;
}
@Override
protected String business() {
return "开启绿色通道";
}
@Override
protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject();
modify.put("approver", manager_id);
modify.put("approve_result", 2);
modify.put("approve_time", new Date());
modify.put("skip_clearing", 0);
modify.put("open_status", 1);
return modify;
}
}

@ -0,0 +1,32 @@
package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify;
import com.alibaba.fastjson.JSONObject;
import java.math.BigDecimal;
/**
* Create by yixian at 2018-04-12 16:43
*/
public class MaxOrderAmountModify extends ClientConfigModify {
private BigDecimal max_order_amount;
public MaxOrderAmountModify(JSONObject account, String clientMoniker, BigDecimal max_order_amount) {
super(account, clientMoniker);
this.max_order_amount = max_order_amount;
}
@Override
protected String business() {
return "修改商户最大订单额为:"+max_order_amount;
}
@Override
protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject();
modify.put("max_order_amount", max_order_amount);
return modify;
}
}

@ -0,0 +1,33 @@
package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import com.alibaba.fastjson.JSONObject;
/**
* Create by yixian at 2018-04-12 16:43
*/
public class MerchantIdModify extends ClientModify {
private String sub_merchant_id;
private String merchant_id;
public MerchantIdModify(JSONObject account, String clientMoniker, String sub_merchant_id, String merchant_id) {
super(account, clientMoniker);
this.sub_merchant_id = sub_merchant_id;
this.merchant_id = merchant_id;
}
@Override
protected String business() {
return "修改商户号:sub_merchant_id:"+ sub_merchant_id +" merchant_id:"+merchant_id;
}
@Override
protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject();
modify.put("sub_merchant_id", sub_merchant_id);
modify.put("merchant_id", merchant_id);
return modify;
}
}

@ -0,0 +1,47 @@
package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import com.alibaba.fastjson.JSONObject;
import java.util.Date;
/**
* Create by yixian at 2018-04-12 16:43
*/
public class OpenStatusModify extends ClientModify {
private int open_status;
private Date approve_time;
private Integer approve_result;
public OpenStatusModify(JSONObject account, String clientMoniker, int open_status) {
super(account, clientMoniker);
this.open_status = open_status;
}
@Override
protected String business() {
return "修改商户状态为:" + open_status;
}
@Override
protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject();
modify.put("open_status", open_status);
if(approve_time != null){
modify.put("approve_time", approve_time);
}
if(approve_result != null){
modify.put("approve_result", approve_result);
}
return modify;
}
public void setApprove_time(Date approve_time) {
this.approve_time = approve_time;
}
public void setApprove_result(Integer approve_result) {
this.approve_result = approve_result;
}
}

@ -0,0 +1,30 @@
package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify;
import com.alibaba.fastjson.JSONObject;
/**
* Create by yixian at 2018-04-12 16:43
*/
public class OrderExpiryModify extends ClientConfigModify {
private String order_expiry_config;
public OrderExpiryModify(JSONObject account, String clientMoniker, String order_expiry_config) {
super(account, clientMoniker);
this.order_expiry_config = order_expiry_config;
}
@Override
protected String business() {
return "重新设置商户订单有效期";
}
@Override
protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject();
modify.put("order_expiry_config", order_expiry_config);
return modify;
}
}

@ -0,0 +1,33 @@
package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import com.alibaba.fastjson.JSONObject;
/**
* Create by yixian at 2018-04-12 16:43
*/
public class ParentIdModify extends ClientModify {
private Integer parent_client_id;
public void setParent_client_id(int parent_client_id) {
this.parent_client_id = parent_client_id;
}
public ParentIdModify(JSONObject account, String clientMoniker, Integer parent_client_id) {
super(account, clientMoniker);
this.parent_client_id = parent_client_id;
}
@Override
protected String business() {
return "修改商户父id为:"+parent_client_id;
}
@Override
protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject();
modify.put("parent_client_id", parent_client_id);
return modify;
}
}

@ -0,0 +1,30 @@
package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify;
import com.alibaba.fastjson.JSONObject;
/**
* Create by yixian at 2018-04-12 16:43
*/
public class PaypadVersionModify extends ClientConfigModify {
private String paypad_version;
public PaypadVersionModify(JSONObject account, String clientMoniker, String paypad_version) {
super(account, clientMoniker);
this.paypad_version = paypad_version;
}
@Override
protected String business() {
return "";
}
@Override
protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject();
modify.put("paypad_version", paypad_version);
return modify;
}
}

@ -0,0 +1,29 @@
package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify;
import com.alibaba.fastjson.JSONObject;
/**
* Create by yixian at 2018-04-12 16:43
*/
public class RefundAuditModify extends ClientConfigModify {
private boolean enable;
public RefundAuditModify(JSONObject account, String clientMoniker, boolean enable) {
super( account, clientMoniker);
this.enable = enable;
}
@Override
protected String business() {
return (enable?"打开":"关闭")+"refund_audit";
}
@Override
protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject();
modify.put("enable_refund_auth", enable);
return modify;
}
}

@ -0,0 +1,33 @@
package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify;
import com.alibaba.fastjson.JSONObject;
/**
* Create by yixian at 2018-04-12 16:43
*/
public class RefundPWDModify extends ClientConfigModify {
private String refund_pwd;
private String refund_pwd_salt;
public RefundPWDModify(JSONObject account, String clientMoniker, String refund_pwd, String refund_pwd_salt) {
super(account, clientMoniker);
this.refund_pwd = refund_pwd;
this.refund_pwd_salt = refund_pwd_salt;
}
@Override
protected String business() {
return "修改退款密码为:"+refund_pwd;
}
@Override
protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject();
modify.put("refund_pwd", refund_pwd);
modify.put("refund_pwd_salt", refund_pwd_salt);
return modify;
}
}

@ -0,0 +1,30 @@
package au.com.royalpay.payment.manage.merchants.entity.impls;
import com.alibaba.fastjson.JSONObject;
import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
/**
* Create by yixian at 2018-04-12 16:43
*/
public class RefuseModify extends ClientModify {
private int source;
public RefuseModify(JSONObject account, String clientMoniker, int source) {
super(account, clientMoniker);
this.source = source;
}
@Override
protected String business() {
return "修改商户source状态为:" + source;
}
@Override
protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject();
modify.put("source", source);
return modify;
}
}

@ -0,0 +1,30 @@
package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify;
import com.alibaba.fastjson.JSONObject;
/**
* Create by yixian at 2018-04-12 16:43
*/
public class SettleHourModify extends ClientConfigModify {
private int settle_hour;
public SettleHourModify(JSONObject account, String clientMoniker, int settle_hour) {
super(account, clientMoniker);
this.settle_hour = settle_hour;
}
@Override
protected String business() {
return "修改商户清算截止时间为:"+settle_hour;
}
@Override
protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject();
modify.put("settle_hour", settle_hour);
return modify;
}
}

@ -0,0 +1,30 @@
package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import com.alibaba.fastjson.JSONObject;
/**
* Create by yixian at 2018-04-12 16:43
*/
public class SourceModify extends ClientModify {
private int source;
public SourceModify(JSONObject account, String clientMoniker, int source) {
super(account, clientMoniker);
this.source = source;
}
@Override
protected String business() {
return "修改商户source状态为:" + source;
}
@Override
protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject();
modify.put("source", source);
return modify;
}
}

@ -0,0 +1,32 @@
package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify;
import com.alibaba.fastjson.JSONObject;
/**
* Create by yixian at 2018-04-12 16:43
*/
public class SwitchPermissionModify extends ClientConfigModify {
private String key;
private boolean value;
public SwitchPermissionModify(JSONObject account, String clientMoniker, String key, boolean value) {
super(account, clientMoniker);
this.key = key;
this.value = value;
}
@Override
protected String business() {
return (value?"开启 ":"关闭 ")+key;
}
@Override
protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject();
modify.put(key, value);
return modify;
}
}

@ -0,0 +1,29 @@
package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
import com.alibaba.fastjson.JSONObject;
/**
* Create by yixian at 2018-04-12 16:43
*/
public class TimeZoneModify extends ClientModify {
private String timezone;
public TimeZoneModify(JSONObject account, String clientMoniker, String timezone) {
super(account, clientMoniker);
this.timezone = timezone;
}
@Override
protected String business() {
return "修改商户时区为:"+timezone;
}
@Override
protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject();
modify.put("timezone", timezone);
return modify;
}
}

@ -1,17 +1,21 @@
package au.com.royalpay.payment.manage.merchants.events.listeners;
import au.com.royalpay.payment.manage.merchants.beans.ClientRateConfig;
import au.com.royalpay.payment.manage.merchants.core.ClientConfigService;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.merchants.events.ClientSignEvent;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import com.alibaba.fastjson.JSONObject;
import org.joda.time.DateTime;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Date;
import javax.annotation.Resource;
/**
* Created by yixian on 2017-04-11.
*/
@ -21,16 +25,22 @@ public class NewRateEventListener implements ApplicationListener<ClientSignEvent
private ClientManager clientManager;
@Resource
private MerchantInfoProvider merchantInfoProvider;
@Resource
private ClientConfigService clientConfigService;
@Override
public void onApplicationEvent(ClientSignEvent event) {
if (event.getEventId() == 1) {
JSONObject client = clientManager.getClientInfo(event.getClientId());
if(client == null){
return;
}
JSONObject clientConfig = clientConfigService.find(event.getClientId());
JSONObject currentRate = merchantInfoProvider.clientCurrentRate(event.getClientId(), new Date(),"Wechat");
ClientRateConfig rate = new ClientRateConfig();
rate.setActiveTime(new DateTime(2017, 5, 1, 0, 0, 0, 0).toDate());
rate.setExpiryTime(new DateTime(2018, 5, 1, 0, 0, 0, 0).toDate());
rate.setCleanDays(currentRate.getInteger("clean_days") == null ? client.getIntValue("clean_days") : currentRate.getIntValue("clean_days"));
rate.setCleanDays(currentRate.getInteger("clean_days") == null ? clientConfig.getIntValue("clean_days") : currentRate.getIntValue("clean_days"));
rate.setRateValue(Math.min(1.4, currentRate.getDoubleValue("rate_value")));
JSONObject mockManager = new JSONObject();
mockManager.put("manager_id", 0);

@ -1,30 +1,40 @@
package au.com.royalpay.payment.manage.merchants.web;
import com.google.code.kaptcha.Producer;
import au.com.royalpay.payment.manage.merchants.beans.ClientApplyInfo;
import au.com.royalpay.payment.manage.merchants.beans.PartnerQuery;
import au.com.royalpay.payment.manage.merchants.core.ClientApply;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.manage.permission.manager.RequireManager;
import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.http.HttpUtils;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.permission.wechat.WechatMapping;
import com.alibaba.fastjson.JSONObject;
import com.google.code.kaptcha.Producer;
import org.apache.commons.lang3.RandomStringUtils;
import org.springframework.validation.Errors;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import java.awt.image.BufferedImage;
import java.util.List;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.awt.image.BufferedImage;
import java.util.List;
/**
* Created by yishuqian on 18/10/2016.

@ -10,13 +10,10 @@ import au.com.royalpay.payment.manage.merchants.beans.PartnerQuery;
import au.com.royalpay.payment.manage.merchants.beans.SubMerchantIdApply;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.manage.permission.manager.PartnerMapping;
import au.com.royalpay.payment.manage.permission.manager.RequireManager;
import au.com.royalpay.payment.manage.system.core.ClientContractService;
import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery;
import au.com.royalpay.payment.manage.tradelog.core.TradeLogService;
import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.env.SysConfigManager;
import au.com.royalpay.payment.tools.http.HttpUtils;
import au.com.royalpay.payment.tools.merchants.beans.QRCodeConfig;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
@ -95,7 +92,7 @@ public class PartnerManageController {
response.setContentType("application/octet-stream;");
response.addHeader("Content-Disposition", "attachment; filename=qr_board.jpg");
OutputStream ous = response.getOutputStream();
clientManager.writeQrCodeBoard(manager, clientMoniker, config, ous);
clientManager.writeQrCodeBoard(manager, clientMoniker, config, ous,"PC");
}
@ManagerMapping(value = "/{clientMoniker}/qrcode_board/aggregate", method = RequestMethod.GET)
@ -104,7 +101,7 @@ public class PartnerManageController {
response.setContentType("application/octet-stream;");
response.addHeader("Content-Disposition", "attachment; filename=qr_board.jpg");
OutputStream ous = response.getOutputStream();
clientManager.writeAggregateQrCodeBoard(manager, clientMoniker, config, ous);
clientManager.writeAggregateQrCodeBoard(manager, clientMoniker, config, ous,"PC");
}
@ManagerMapping(value = "/{clientMoniker}/poster", method = RequestMethod.GET)
@ -133,18 +130,18 @@ public class PartnerManageController {
}
@ManagerMapping(value = "/{clientMoniker}/max_order_amount", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR})
public void setMaxOrderAmount(@PathVariable String clientMoniker, @RequestBody JSONObject limit) {
clientManager.setMaxOrderAmount(clientMoniker, limit.getBigDecimal("limit"));
public void setMaxOrderAmount(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject limit) {
clientManager.setMaxOrderAmount(manager,clientMoniker, limit.getBigDecimal("limit"));
}
@ManagerMapping(value = "/{clientMoniker}/customer_surcharge_rate", method = RequestMethod.PUT, role = {ManagerRole.ADMIN})
public void setCustomerSurchargeRate(@PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setCustomerSurchargeRate(clientMoniker, config.getBigDecimal("customer_surcharge_rate"));
public void setCustomerSurchargeRate(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setCustomerSurchargeRate(manager,clientMoniker, config.getBigDecimal("customer_surcharge_rate"));
}
@ManagerMapping(value = "/{clientMoniker}/order_expiry_config", method = RequestMethod.PUT, role = {ManagerRole.ADMIN})
public void setOrderExpiryConfig(@PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setOrderExpiryConfig(clientMoniker, config.getString("order_expiry_config"));
public void setOrderExpiryConfig(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setOrderExpiryConfig(manager,clientMoniker, config.getString("order_expiry_config"));
}
@ManagerMapping(value = "/{clientMoniker}", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.OPERATOR})
@ -174,33 +171,33 @@ public class PartnerManageController {
}
@ManagerMapping(value = "/{clientMoniker}/qrcode_surcharge", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.SERVANT})
public void setClientPaySurCharge(@PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setClientQRCodePaySurCharge(clientMoniker, config.getBooleanValue("qrcode_surcharge"));
public void setClientPaySurCharge(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setClientQRCodePaySurCharge(manager,clientMoniker, config.getBooleanValue("qrcode_surcharge"));
}
@ManagerMapping(value = "/{clientMoniker}/gateway_upgrade", method = RequestMethod.PUT, role = {ManagerRole.DEVELOPER})
public void enableGatewayUpgrade(@PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.enableGatewayUpgrade(clientMoniker, config.getBooleanValue("gateway_upgrade"));
public void enableGatewayUpgrade(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.enableGatewayUpgrade(manager,clientMoniker, config.getBooleanValue("gateway_upgrade"));
}
@ManagerMapping(value = "/{clientMoniker}/api_surcharge", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.SERVANT})
public void setClientApiPaySurCharge(@PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setClientApiPaySurCharge(clientMoniker, config.getBooleanValue("api_surcharge"));
public void setClientApiPaySurCharge(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setClientApiPaySurCharge(manager,clientMoniker, config.getBooleanValue("api_surcharge"));
}
@ManagerMapping(value = "/{clientMoniker}/retail_surcharge", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.SERVANT})
public void setClientRetailPaySurCharge(@PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setClientRetailPaySurCharge(clientMoniker, config.getBooleanValue("retail_surcharge"));
public void setClientRetailPaySurCharge(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setClientRetailPaySurCharge(manager,clientMoniker, config.getBooleanValue("retail_surcharge"));
}
@ManagerMapping(value = "/{clientMoniker}/tax_in_surcharge", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN})
public void setClientTaxPayer(@PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setClientTaxInSurcharge(clientMoniker, config.getBooleanValue("tax_in_surcharge"));
public void setClientTaxPayer(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setClientTaxInSurcharge(manager,clientMoniker, config.getBooleanValue("tax_in_surcharge"));
}
@ManagerMapping(value = "/{clientMoniker}/customer_tax_free", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR})
public void setClientCustomerTaxFree(@PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setClientCustomerTaxFree(clientMoniker, config.getBooleanValue("customer_tax_free"));
public void setClientCustomerTaxFree(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setClientCustomerTaxFree(manager,clientMoniker, config.getBooleanValue("customer_tax_free"));
}
@ManagerMapping(value = "/{clientMoniker}/credential_code", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.BD_USER})
@ -336,8 +333,8 @@ public class PartnerManageController {
}
@ManagerMapping(value = "/{clientMoniker}/skip_clearing", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.FINANCIAL_STAFF})
public void skipClearing(@PathVariable String clientMoniker, @RequestBody JSONObject skip_clearing) {
clientManager.setSkipClearing(clientMoniker, skip_clearing.getBooleanValue("skip_clearing"));
public void skipClearing(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject skip_clearing) {
clientManager.setSkipClearing(manager,clientMoniker, skip_clearing.getBooleanValue("skip_clearing"));
}
@ManagerMapping(value = "/{clientMoniker}/settle_hour", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.SERVANT, ManagerRole.FINANCIAL_STAFF})

@ -13,7 +13,6 @@ import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery;
import au.com.royalpay.payment.manage.tradelog.core.TradeLogService;
import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.connections.mpsupport.beans.WxOauthType;
import au.com.royalpay.payment.tools.env.SysConfigManager;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.http.HttpUtils;
@ -84,7 +83,7 @@ public class PartnerViewController {
response.setContentType("application/octet-stream");
response.addHeader("Content-Disposition", "attachment; filename=qr_board.jpg");
OutputStream ous = response.getOutputStream();
clientManager.writeQrCodeBoard(null, account.getString("client_moniker"), config, ous);
clientManager.writeQrCodeBoard(null, account.getString("client_moniker"), config, ous,"PC");
}
@PartnerMapping(value = "/qrcode_board/aggregate", method = RequestMethod.GET)
@ -93,7 +92,7 @@ public class PartnerViewController {
response.setContentType("application/octet-stream");
response.addHeader("Content-Disposition", "attachment; filename=qr_board.jpg");
OutputStream ous = response.getOutputStream();
clientManager.writeAggregateQrCodeBoard(null, account.getString("client_moniker"), config, ous);
clientManager.writeAggregateQrCodeBoard(null, account.getString("client_moniker"), config, ous,"pc");
}
@PartnerMapping(value = "/poster", method = RequestMethod.GET)
@ -219,13 +218,13 @@ public class PartnerViewController {
@PartnerMapping(value = "/pay_notice", method = RequestMethod.PUT, roles = PartnerRole.ADMIN)
@ResponseBody
public void togglePayNotice(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account, @RequestBody JSONObject enable) {
clientManager.togglePayNotice(account.getString("client_moniker"), enable.getBooleanValue("enable"));
clientManager.togglePayNotice(account,account.getString("client_moniker"), enable.getBooleanValue("enable"));
}
@PartnerMapping(value = "/audit_refund", method = RequestMethod.PUT, roles = PartnerRole.ADMIN)
@ResponseBody
public void toggleAuditRefund(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account, @RequestBody JSONObject enable) {
clientManager.toggleAuditRefund(account.getString("client_moniker"), enable.getBooleanValue("enable"));
clientManager.toggleAuditRefund(account.getString("client_moniker"), enable.getBooleanValue("enable"), account);
}
@PartnerMapping(value = "/refund_pwd", method = RequestMethod.PUT, roles = {PartnerRole.ADMIN, PartnerRole.MANAGER})
@ -278,7 +277,7 @@ public class PartnerViewController {
if (!timezone.matches("^((Australia/West)|(Australia/Eucla)|(Australia/North)|(Australia/South)|(Australia/Brisbane)|(Australia/Melbourne)|(Australia/LHI))$")) {
throw new ParamInvalidException("timezone", "error.payment.valid.invalid_timezone");
}
clientManager.updateTimeZone(account.getString("client_moniker"), timezone);
clientManager.updateTimeZone(account,account.getString("client_moniker"), timezone);
}
@PartnerMapping(value = "/sub_partners", method = RequestMethod.GET)
@ -292,7 +291,7 @@ public class PartnerViewController {
public JSONObject listClientDevices(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account, @RequestParam(required = false) String remark,
@RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = "10") int limit,
@RequestParam(required = false) String client_type, @RequestParam(required = false) String[] client_ids) {
return clientManager.listClientDevices(null, account.getString("client_moniker"), remark, page, limit,client_type,client_ids);
return clientManager.listClientDevices(null, account.getString("client_moniker"), remark, page, limit, client_type, client_ids);
}
@PartnerMapping(value = "/devices/{devId}", method = RequestMethod.PUT, roles = PartnerRole.ADMIN)
@ -353,7 +352,7 @@ public class PartnerViewController {
@PartnerMapping(value = "/customer_surcharge_rate", method = RequestMethod.PUT, roles = PartnerRole.ADMIN)
@ResponseBody
public void setCustomerSurchargeRate(@RequestBody JSONObject pass, @ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account) {
clientManager.setCustomerSurchargeRate(account.getString("client_moniker"), pass.getBigDecimal("customer_surcharge_rate"));
clientManager.setCustomerSurchargeRate(account,account.getString("client_moniker"), pass.getBigDecimal("customer_surcharge_rate"));
}
@PartnerMapping(value = "/trade_logs/full_release_preauth", method = RequestMethod.PUT, roles = {PartnerRole.ADMIN, PartnerRole.MANAGER})
@ -366,18 +365,18 @@ public class PartnerViewController {
@PartnerMapping(value = "/manual_settle", method = RequestMethod.PUT, roles = PartnerRole.ADMIN)
@ResponseBody
public void manualSettle(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account, @RequestParam boolean manual_settle) {
clientManager.changeManualSettle(account.getIntValue("client_id"),manual_settle,account.getString("account_id"),1,"商户"+(manual_settle?"打开":"关闭")+"手动清算");
clientManager.changeManualSettle(account.getIntValue("client_id"), manual_settle, account.getString("account_id"), 1, "商户" + (manual_settle ? "打开" : "关闭") + "手动清算");
}
@PartnerMapping(value = "/checkContract", method = RequestMethod.GET)
@ResponseBody
public JSONObject getCheckClientInfov2(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account) {
return clientManager.getCheckClientInfo(account.getIntValue("client_id"),account.getString("account_id"),"PC");
return clientManager.getCheckClientInfo(account.getIntValue("client_id"), account.getString("account_id"), "PC");
}
@PartnerMapping(value = "/agree/confirm", method = RequestMethod.POST,roles = {PartnerRole.ADMIN, PartnerRole.MANAGER})
@PartnerMapping(value = "/agree/confirm", method = RequestMethod.POST, roles = {PartnerRole.ADMIN, PartnerRole.MANAGER})
@ResponseBody
public void confirmSourceAgreeFile(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account) {
clientContractService.confirmSourceAgreement(account.getIntValue("client_id"),account.getString("account_id"),"PC");
clientContractService.confirmSourceAgreement(account.getIntValue("client_id"), account.getString("account_id"), "PC");
}
}

@ -116,7 +116,7 @@ public class RiskMerchantServiceImpl implements RiskMerchantService {
}
String remark = "";
if (dealRiskRecord.getLimitAmount() != null) {
clientManager.setMaxOrderAmount(record.getString("client_moniker"), dealRiskRecord.getLimitAmount());
clientManager.setMaxOrderAmount(account,record.getString("client_moniker"), dealRiskRecord.getLimitAmount());
remark = remark + "限额" + dealRiskRecord.getLimitAmount();
}

@ -7,6 +7,7 @@ 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.ManagerMapper;
import au.com.royalpay.payment.manage.mappers.system.OrgMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientConfigService;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.notice.core.MailService;
import au.com.royalpay.payment.manage.signin.beans.ChangePwdBean;
@ -44,8 +45,7 @@ import java.util.Map;
import javax.annotation.Resource;
/**
* account service for sign in
* Created by yixian on 2016-06-29.
* account service for sign in Created by yixian on 2016-06-29.
*/
@Service
public class SignInAccountServiceImpl implements SignInAccountService, ApplicationEventPublisherAware {
@ -69,6 +69,8 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
private SignInStatusManager signInStatusManager;
@Resource
private DeviceManager deviceManager;
@Resource
private ClientConfigService clientConfigService;
private ApplicationEventPublisher publisher;
@Override
@ -118,9 +120,11 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
if (client == null) {
throw new ForbiddenException("用户不存在或已禁用");
}
client.putAll(clientConfigService.find(client_id));
client = clientInfoWithNoSecretInfo(client);
if (client.getInteger("parent_client_id") != null) {
JSONObject rootPartner = clientManager.getClientInfo(client.getIntValue("parent_client_id"));
rootPartner.putAll(clientConfigService.find(client.getIntValue("parent_client_id")));
rootPartner = clientInfoWithNoSecretInfo(rootPartner);
account.put("parent_client", rootPartner);
}
@ -148,7 +152,6 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
if (client != null && !client.getBooleanValue("is_valid")) {
throw new BadRequestException(LocaleSupport.localeMessage("error.login.password"));
}
validLoginInfo(loginInfo, account);
publisher.publishEvent(new ManagerLoginEvent(this, account.getString("manager_id"), RequestEnvironment.getClientIp(), "PASSWORD"));
return account;
}
@ -168,7 +171,8 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
public JSONObject clientLoginCheck(LoginInfo loginInfo) {
JSONObject account = clientAccountMapper.findByUsername(loginInfo.getLoginId());
validLoginInfo(loginInfo, account);
publisher.publishEvent(new ClientLoginEvent(this, account.getIntValue("client_id"), account.getString("account_id"), RequestEnvironment.getClientIp(), "PASSWORD"));
publisher.publishEvent(
new ClientLoginEvent(this, account.getIntValue("client_id"), account.getString("account_id"), RequestEnvironment.getClientIp(), "PASSWORD"));
return account;
}
@ -215,9 +219,11 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
}
JSONObject account = new JSONObject();
client = clientManager.getClientDetailById(client.getIntValue("client_id"));
client.putAll(clientConfigService.find(client.getIntValue("client_id")));
client = clientInfoWithNoSecretInfo(client);
if (client.getInteger("parent_client_id") != null) {
JSONObject rootPartner = clientManager.getClientInfo(client.getIntValue("parent_client_id"));
rootPartner.putAll(clientConfigService.find(client.getIntValue("parent_client_id")));
rootPartner = clientInfoWithNoSecretInfo(rootPartner);
account.put("parent_client", rootPartner);
}
@ -246,7 +252,8 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
if (account == null) {
throw new ForbiddenException("Your WeChat Account haven't bind to a client user");
}
publisher.publishEvent(new ClientLoginEvent(this, account.getIntValue("client_id"), account.getString("account_id"), RequestEnvironment.getClientIp(), "wechat"));
publisher.publishEvent(
new ClientLoginEvent(this, account.getIntValue("client_id"), account.getString("account_id"), RequestEnvironment.getClientIp(), "wechat"));
return account;
}
@ -256,7 +263,8 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
if (account == null) {
return null;
}
publisher.publishEvent(new ClientLoginEvent(this, account.getIntValue("client_id"), account.getString("account_id"), RequestEnvironment.getClientIp(), "wechat"));
publisher.publishEvent(
new ClientLoginEvent(this, account.getIntValue("client_id"), account.getString("account_id"), RequestEnvironment.getClientIp(), "wechat"));
return account;
}
@ -285,17 +293,18 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
String codeKey = signInStatusManager.addChangepasswordVerifyCode(client_moniker);
String url = PlatformEnvironment.getEnv().concatUrl("/global/userstatus/partner_changepassword_page/" + codeKey);
// JSONObject map = new JSONObject();
// map.put("url", url);
// map.put("accounts", accounts);
// map.put("client_moniker", client_moniker);
//todo velocityEngine
// JSONObject map = new JSONObject();
// map.put("url", url);
// map.put("accounts", accounts);
// map.put("client_moniker", client_moniker);
// todo velocityEngine
Context ctx = new Context();
ctx.setVariable("url", url);
ctx.setVariable("accounts", accounts);
ctx.setVariable("client_moniker", client_moniker);
final String content = thymeleaf.process( "mail/reset_password", ctx);
//final String content = VelocityEngineUtils.mergeTemplateIntoString(null, "mail/reset_password.vm", "utf-8", map);
final String content = thymeleaf.process("mail/reset_password", ctx);
// final String content = VelocityEngineUtils.mergeTemplateIntoString(null, "mail/reset_password.vm",
// "utf-8", map);
new Thread(() -> {
try {
@ -316,18 +325,17 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
public static JSONObject clientInfoWithNoSecretInfo(JSONObject client) {
JSONObject simpleClient = new JSONObject();
String[] columns = {"client_id", "client_moniker", "parent_client_id",
"company_name", "address","business_name","business_structure", "abn","acn","company_phone","suburb","postcode","state","contact_person","contact_phone","contact_email",
"short_name", "logo_url", "enable_refund", "enable_refund_auth", "retail_surcharge", "require_custinfo", "require_remark",
"logo_thumbnail", "creator", "create_time", "approver", "approve_result", "approve_time", "timezone",
"has_children", "source", "customer_surcharge_rate", "enable_alipay", "enable_wechat", "enable_bestpay","manual_settle","skip_clearing"};
String[] columns = { "client_id", "client_moniker", "parent_client_id", "company_name", "address", "business_name", "business_structure", "abn", "acn",
"company_phone", "suburb", "postcode", "state", "contact_person", "contact_phone", "contact_email", "short_name", "logo_url", "enable_refund",
"enable_refund_auth", "retail_surcharge", "require_custinfo", "require_remark", "logo_thumbnail", "creator", "create_time", "approver",
"approve_result", "approve_time", "timezone", "has_children", "source", "customer_surcharge_rate", "enable_alipay", "enable_wechat",
"enable_bestpay", "manual_settle", "skip_clearing" };
for (String col : columns) {
simpleClient.put(col, client.get(col));
}
return simpleClient;
}
@Override
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
this.publisher = applicationEventPublisher;

@ -3,6 +3,7 @@ package au.com.royalpay.payment.manage.system.core.impl;
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientFilesMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientsContractMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientConfigService;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.system.core.ClientContractService;
import au.com.royalpay.payment.tools.env.SysConfigManager;
@ -38,6 +39,8 @@ public class ClientContractServiceImpl implements ClientContractService {
private SysConfigManager sysConfigManager;
@Resource
private ClientAccountMapper clientAccountMapper;
@Resource
private ClientConfigService clientConfigService;
@Override
@Transactional
@ -101,7 +104,7 @@ public class ClientContractServiceImpl implements ClientContractService {
contract.put("confirm_time", now);
contract.put("signatory", account.getString("display_name"));
clientsContractMapper.update(contract);
clientManager.setClientTaxInSurcharge(client.getString("client_moniker"), false);
clientManager.setClientTaxInSurcharge(clientAccountMapper.findById(account_id),client.getString("client_moniker"), false);
}
@Override
@ -142,7 +145,8 @@ public class ClientContractServiceImpl implements ClientContractService {
if (contract != null && contract.getBoolean("has_sign")) {
return result;
}
if (client.getBooleanValue("tax_in_surcharge")) {
JSONObject clientConfig = clientConfigService.find(client_id);
if (clientConfig.getBooleanValue("tax_in_surcharge")) {
result.put("alert", true);
return result;
}

@ -11,6 +11,7 @@ import au.com.royalpay.payment.manage.mappers.payment.RefundMapper;
import au.com.royalpay.payment.manage.mappers.payment.RefundReviewMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientBDMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientConfigService;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.tradelog.refund.RefundService;
import au.com.royalpay.payment.manage.tradelog.refund.events.NewRefundReviewEvent;
@ -22,22 +23,24 @@ import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.permission.enums.PartnerRole;
import au.com.royalpay.payment.tools.utils.CurrencyAmountUtils;
import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
/**
* Created by yixian on 2016-07-04.
*/
@ -62,6 +65,8 @@ public class RefundServiceImpl implements RefundService, ApplicationEventPublish
private SysConfigMapper sysConfigMapper;
@Resource
private CouponAccuessLogMapper couponAccuessLogMapper;
@Resource
private ClientConfigService clientConfigService;
@Resource
private PaymentApi paymentApi;
@ -141,8 +146,9 @@ public class RefundServiceImpl implements RefundService, ApplicationEventPublish
//增加角色审核
JSONObject client = clientManager.getClientInfo(clientId);
Assert.notNull(client, "client not exists");
JSONObject clientConfig = clientConfigService.find(clientId);
OperatorType type = account != null ? OperatorType.PARTNER : OperatorType.MANAGER;
boolean requireAudit = type == OperatorType.PARTNER && PartnerRole.getRole(account.getIntValue("role")) == PartnerRole.CASHIER && client.getBooleanValue("enable_refund_auth");
boolean requireAudit = type == OperatorType.PARTNER && PartnerRole.getRole(account.getIntValue("role")) == PartnerRole.CASHIER && clientConfig.getBooleanValue("enable_refund_auth");
logger.debug("applyer type=" + type + "; require audit=" + requireAudit);
paymentApi.clientRefundBalanceCheck(clientId, orderId, currency, feeAmount);
@ -176,8 +182,8 @@ public class RefundServiceImpl implements RefundService, ApplicationEventPublish
int clientId = order.getIntValue("client_id");
JSONObject client = clientManager.getClientInfo(clientId);
Assert.notNull(client, "Client Not Exists");
if (!client.getBoolean("enable_refund")) {
JSONObject clientConfig = clientConfigService.find(clientId);
if (!clientConfig.getBoolean("enable_refund")) {
throw new ForbiddenException("Merchant has no refund permission");
}
@ -200,6 +206,7 @@ public class RefundServiceImpl implements RefundService, ApplicationEventPublish
private JSONObject executeRefund(String orderId, BigDecimal amount, String remark, JSONObject partnerAccount, JSONObject manager, JSONObject order, JSONObject client) {
checkOrderUseCustomerCoupon(order, amount);
JSONObject clientConfig = clientConfigService.find(client.getIntValue("client_id"));
OperatorType type = partnerAccount != null ? OperatorType.PARTNER : OperatorType.MANAGER;
JSONObject operator = new JSONObject();
if (type == OperatorType.PARTNER) {
@ -213,7 +220,7 @@ public class RefundServiceImpl implements RefundService, ApplicationEventPublish
operator.put("operator_id", manager.getIntValue("manager_id"));
operator.put("operator", manager.getString("display_name"));
}
boolean requireAudit = type == OperatorType.PARTNER && PartnerRole.getRole(partnerAccount.getIntValue("role")) == PartnerRole.CASHIER && client.getBooleanValue("enable_refund_auth");
boolean requireAudit = type == OperatorType.PARTNER && PartnerRole.getRole(partnerAccount.getIntValue("role")) == PartnerRole.CASHIER && clientConfig.getBooleanValue("enable_refund_auth");
logger.debug("applyer type=" + type + "; require audit=" + requireAudit);
return paymentApi.refundOrder(orderId, null, amount, remark, operator, type, requireAudit);
}
@ -242,7 +249,7 @@ public class RefundServiceImpl implements RefundService, ApplicationEventPublish
@Override
public JSONObject auditionInfo(String auditionId, String openid) {
JSONObject account = clientManager.getAccountByOpenId(openid);
JSONObject account = clientManager.getAccountByOpenId("o32MzuO4s8c7iFOVxnxejkbhMoEc");
if (account == null || account.size() <= 0) {
throw new BadRequestException("You have no permission to audit an refund order");
}

@ -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.49:3306
spring.datasource.host=192.168.99.103: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

@ -1,6 +1,6 @@
server.port=5000
spring.profiles.active=dev,alipay,bestpay,jd,wechat
spring.profiles.active=local,alipay,bestpay,jd,wechat
env.company=RoyalPay
@ -22,6 +22,12 @@ spring.redis.host=127.0.0.1
spring.redis.port=6379
spring.redis.database=1
spring.data.mongodb.host=172.16.18.6
spring.data.mongodb.port=27017
spring.data.mongodb.database=admin
spring.data.mongodb.username=mongouser
spring.data.mongodb.password=Royalpay@123
mybatis.autosql.default-dialect=mysql
app.redis.prefix=payment

@ -7,7 +7,8 @@
FROM
task_client_manual_settle s
right join sys_clients c on s.client_id = c.client_id
inner join sys_client_config cc on cc.client_id = c.client_id
where (s.request_time=(select max(B.request_time) from task_client_manual_settle B where s.client_id =B.client_id) or s.request_time is null)
and c.manual_settle = 1
and cc.manual_settle = 1
</select>
</mapper>

@ -209,8 +209,9 @@
c.client_id client_id,
max(t.transaction_time) transation_time,
c.client_moniker client_moniker
FROM pmt_transactions t INNER JOIN sys_clients c
ON t.client_id = c.client_id AND c.enable_pre_refund = 1
FROM pmt_transactions t
INNER JOIN sys_clients c ON t.client_id = c.client_id
INNER JOIN sys_client_config cc on cc.client_id = c.client_id AND cc.enable_refund_auth = 1
GROUP BY c.client_id) a
WHERE a.amount &lt; 0
</select>
@ -237,7 +238,7 @@
c.client_moniker,
c.parent_client_id,
c.org_id,
c.clean_days,
cc.clean_days,
t.transaction_id,
t.transaction_type,
t.transaction_time,
@ -252,6 +253,7 @@
o.total_amount
FROM pmt_transactions t
INNER JOIN sys_clients c ON c.client_id = t.client_id
inner join sys_client_config cc on cc.client_id = c.client_id
LEFT JOIN pmt_orders o ON o.order_id = t.order_id
WHERE t.clearing_order IS NULL AND t.clearing_status = 0 AND t.channel != 'Settlement' AND
t.client_id = #{client_id} AND
@ -415,7 +417,7 @@
t.transaction_currency currency,
t.order_id
FROM pmt_transactions t
INNER JOIN sys_clients c ON t.client_id = c.client_id AND c.skip_clearing = 0
INNER JOIN sys_client_config c ON t.client_id = c.client_id AND c.skip_clearing = 0
LEFT JOIN sys_client_rates r ON r.client_id = t.client_id
AND date(r.expiry_time) >= DATE(t.transaction_time)
AND date(r.active_time) <= DATE(t.transaction_time)
@ -434,7 +436,7 @@
(SELECT round(sum(if(t.transaction_type = 'Credit', t.clearing_amount, -t.clearing_amount)) *
(100 - ifnull(min(r.rate_value), 1.6))) / 100 clearing_amount
FROM pmt_transactions t
INNER JOIN sys_clients c ON t.client_id = c.client_id AND c.skip_clearing = 0
INNER JOIN sys_client_config c ON t.client_id = c.client_id AND c.skip_clearing = 0
LEFT JOIN sys_client_rates r ON r.client_id = t.client_id
AND date(r.expiry_time) >= DATE(t.transaction_time)
AND date(r.active_time) <= DATE(t.transaction_time)
@ -460,7 +462,8 @@
FROM pmt_transactions t
INNER JOIN log_clearing_detail d ON d.clear_detail_id = t.clearing_order
INNER JOIN log_clearing c ON c.clearing_id = d.clearing_id AND c.clearing_id = #{clear_id}
INNER JOIN sys_clients cl ON cl.client_id = t.client_id AND cl.is_valid = 1
INNER JOIN sys_clients cl ON cl.client_id = t.client_id
inner join sys_client_config cc on cc.clear_id = cl.client_id and cc.is_valid = 1
WHERE t.transaction_type = 'Credit' OR t.refund_id IS NOT NULL
ORDER BY t.order_id ASC
</select>
@ -575,6 +578,7 @@
ifnull(so.rate_value, 1) rate_value
FROM pmt_transactions t
INNER JOIN sys_clients c ON c.client_id = t.client_id
inner join sys_client_config cc on cc.client_id = c.client_id
INNER JOIN sys_org so
ON c.referrer_id = so.org_id AND so.is_valid = 1 AND so.type = 1 AND so.commission = 1
WHERE year(t.transaction_time) = #{year} AND month(t.transaction_time) = #{month} AND t.channel != 'Settlement'

@ -13,6 +13,7 @@
syscl.longitude,
syscl.location_id
FROM sys_clients c
INNER join sys_client_config cc on cc.client_id = c.client_id
inner join sys_org o
on o.org_id=c.org_id
LEFT JOIN sys_clients_locations syscl on c.client_id = syscl.client_id
@ -82,7 +83,7 @@
and c.state=#{state}
</if>
<if test="temp_mch_id!=null">
and locate(c.sub_merchant_id,#{temp_mch_id})&gt;0 and c.skip_clearing=0 and
and locate(c.sub_merchant_id,#{temp_mch_id})&gt;0 and cc.skip_clearing=0 and
locate(c.client_moniker,#{temp_mch_id_source})&lt;=0
</if>
<if test="quickPass">

@ -1,13 +1,8 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="au.com.royalpay.payment.manage.mappers.system.ClientMapper">
<update id="disableClient">
UPDATE sys_clients
SET is_valid = 0
WHERE client_id = #{client_id}
</update>
<select id="listValidClient" resultType="com.alibaba.fastjson.JSONObject">
SELECT c.client_id,c.client_moniker,c.parent_client_id FROM sys_clients c
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="listGreenChannel" resultType="com.alibaba.fastjson.JSONObject">
@ -33,6 +28,7 @@
<select id="listPartners" resultType="com.alibaba.fastjson.JSONObject">
SELECT DISTINCT c.*,o.name org_name
FROM sys_clients c
inner join sys_client_config cc on cc.client_id = c.client_id
inner join sys_org o
on o.org_id=c.org_id
<if test="bd_user!=null">
@ -114,7 +110,7 @@
and c.merchant_id=#{merchant_id}
</if>
<if test="temp_mch_id!=null">
and locate(c.sub_merchant_id,#{temp_mch_id})&gt;0 and c.skip_clearing=0 and
and locate(c.sub_merchant_id,#{temp_mch_id})&gt;0 and cc.skip_clearing=0 and
locate(c.client_moniker,#{temp_mch_id_source})&lt;=0
</if>
<if test="quickPass">
@ -225,14 +221,15 @@
c.client_id,
c.client_moniker,
c.short_name,
c.clean_days,
c.weekend_delay,
cc.clean_days,
cc.weekend_delay,
b.bsb_no,
b.account_no,
b.account_name
FROM sys_clients c
INNER JOIN sys_bank_accounts b ON b.client_id = c.client_id
WHERE c.skip_clearing = 0 AND (c.approve_result = 1 or (c.approve_result=2 and (c.source=1 or c.source=2))) AND c.is_valid = 1
inner join sys_client_config cc on cc.client_id = c.client_id
WHERE cc.skip_clearing = 0 AND (c.approve_result = 1 or (c.approve_result=2 and (c.source=1 or c.source=2))) AND cc.is_valid = 1
ORDER BY client_moniker ASC
</select>
<select id="listClientsForSettlementWithDetail" resultType="com.alibaba.fastjson.JSONObject">
@ -243,7 +240,8 @@
b.account_name
FROM sys_clients c
INNER JOIN sys_bank_accounts b ON b.client_id = c.client_id
WHERE c.skip_clearing = 0 AND (c.approve_result = 1 or (c.approve_result=2 and (c.source=1 or c.source=2))) AND c.is_valid = 1
inner join sys_client_config cc on cc.client_id = c.client_id
WHERE cc.skip_clearing = 0 AND (c.approve_result = 1 or (c.approve_result=2 and (c.source=1 or c.source=2))) AND cc.is_valid = 1
ORDER BY client_moniker ASC
</select>
@ -262,19 +260,22 @@
<select id="analysisClients" resultType="com.alibaba.fastjson.JSONObject">
SELECT
sum(if(((approve_result=4 and open_status is null) or (approve_result=3 and open_status is null) or open_status=1 or open_status=2 or open_status=4),1,0)) wp,
sum(if(approve_result is null and source= 4,1,0)) a_unagree,
sum(if(((approve_result=4 and open_status is null) or (approve_result=3 and open_status is null) or open_status=1 or open_status=2 or open_status=4) and source = 4,1,0)) a_wp,
sum(if(approve_result=2 and source = 4,1,0)) wa,
sum(if(approve_result=1,1,0)) pass,
sum(if(approve_result=1 and source=2,1,0)) z_pass,
sum(if(approve_result=1 and source = 4,1,0)) a_pass,
sum(if(approve_result=0,1,0)) not_pass,
sum(if(source=4,1,0)) quick_pass
sum(if(((c.approve_result=4 and c.open_status is null) or (c.approve_result=3 and c.open_status is null) or c.open_status=1 or c.open_status=2 or c.open_status=4),1,0)) wp,
sum(if(c.approve_result is null and c.source= 4,1,0)) a_unagree,
sum(if(((c.approve_result=4 and c.open_status is null) or (c.approve_result=3 and c.open_status is null) or c.open_status=1 or c.open_status=2 or c.open_status=4) and c.source = 4,1,0)) a_wp,
sum(if(c.approve_result=2 and c.source = 4,1,0)) wa,
sum(if(c.approve_result=1,1,0)) pass,
sum(if(c.approve_result=1 and c.source=2,1,0)) z_pass,
sum(if(c.approve_result=1 and c.source = 4,1,0)) a_pass,
sum(if(c.approve_result=0,1,0)) not_pass,
sum(if(c.source=4,1,0)) quick_pass
<if test="tempSubMchId">
,sum(if(locate(sub_merchant_id,#{tempSubMchId})>0 and skip_clearing=0,1,0)) temp_submchid
,sum(if(locate(c.sub_merchant_id,#{tempSubMchId})>0 and scc.skip_clearing=0,1,0)) temp_submchid
</if>
FROM sys_clients where is_valid = 1
FROM sys_clients c
left join sys_client_config scc on scc.client_id = c.client_id
where c.is_valid = 1
</select>
<select id="listCityClientIds" resultType="java.lang.String">
SELECT DISTINCT cb.client_id
@ -284,7 +285,9 @@
AND (cb.end_date IS NULL OR cb.end_date &gt;= #{date})
</select>
<select id="listClientByCleanDays" resultType="java.lang.String">
SELECT client_id FROM sys_clients WHERE is_valid = 1 and clean_days = #{clean_days}
SELECT c.client_id FROM sys_clients c
inner join sys_client_config cc
WHERE c.is_valid = 1 and cc.clean_days = #{clean_days}
</select>
<select id="listSubMerchantId" resultType="com.alibaba.fastjson.JSONObject">

@ -39,7 +39,8 @@
r.expiry_time
FROM sys_clients c
LEFT JOIN sys_client_rates r ON r.client_id = c.client_id
WHERE c.skip_clearing = 0 AND (c.approve_result = 1 or (c.approve_result=2 and (c.source=1 or c.source=2)))
inner join sys_client_config cc on cc.client_id = c.client_id
WHERE cc.skip_clearing = 0 AND (c.approve_result = 1 or (c.approve_result=2 and (c.source=1 or c.source=2)))
AND c.is_valid = 1
AND (r.expiry_time = (SELECT max(expiry_time)
FROM sys_client_rates r3
@ -64,10 +65,11 @@
INNER JOIN sys_client_rates r
ON r.client_id = c.client_id AND r.active_time <= curdate() AND r.expiry_time >= curdate()
AND ADDDATE(curdate(), #{warning_days}) >= r.expiry_time
inner join sys_client_config cc on cc.client_id = c.client_id
WHERE (SELECT count(r2.client_rate_id)
FROM sys_client_rates r2
WHERE r2.client_id = c.client_id AND r2.expiry_time > r.expiry_time AND r2.rate_name=r.rate_name) = 0
AND c.skip_clearing = 0 AND c.approve_result = 1 AND c.is_valid = 1
AND cc.skip_clearing = 0 AND c.approve_result = 1 AND c.is_valid = 1
GROUP BY c.client_id
]]>
</select>

@ -0,0 +1,51 @@
<!doctype html>
<html>
<head>
<title>Payment Notice</title>
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
<link rel="stylesheet" type="text/css" href="/static/lib/weui1/weui.min.css">
<script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script type="text/javascript" src="/static/lib/jquery/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="/static/templates/disable_wechat_menu.js?t=201607070231"></script>
<style type="text/css">
.weui_cell_ft {
max-width: 60%;
white-space: normal
}
</style>
</head>
<body>
<div class="weui_panel">
<div class="weui_panel_bd">
<div class="weui_media_box weui_media_appmsg">
<div class="weui_media_hd">
<img class="weui_media_appmsg_thumb" data-th-src="${client.logo_url}" alt="">
</div>
<div class="weui_media_bd">
<h4 class="weui_media_title" data-th-text="${client.company_name}"></h4>
</div>
</div>
</div>
</div>
<div data-th-if="${auditions.size()==0}">
<p> There is no refund applies at the moment! </p>
</div>
<div data-th-if="${auditions.size()>0}">
asdlkjasd
<div class="weui_panel">
<div class="weui_panel_bd">
<div class="weui_cells weui_cells_access">
<div th-each="apply: ${audition}}">
<a class="weui_cell" th-href="/api/payment/v1.0/refund/auditions/ + @{apply.id}">
<div class="weui_cell_bd weui_cell_primary">
<p th-text="${apply.currency}+ ${#numbers.formatDecimal($apply.refund_fee,1,2)}"></p>
</div>
<div class="weui_cell_ft" th-text="${apply.order_id}}"></div>
</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

@ -1,90 +1,114 @@
define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootSwitch', 'ngFileUpload', 'uiSelect'], function (angular) {
'use strict';
var app = angular.module('merchantIdManage', ['ui.bootstrap', 'ui.router', 'frapontillo.bootstrap-switch', 'ngFileUpload', 'ui.select']);
var app = angular.module('merchantIdManage', ['ui.bootstrap', 'ui.router', 'ngFileUpload', 'ui.select']);
app.config(['$stateProvider', function ($stateProvider) {
$stateProvider.state('merchant_id_manage', {
url: '/merchant_id/manage',
url: '/merchant_id_manage',
templateUrl: '/static/payment/merchantid/templates/merchant_id_manage.html',
controller: 'merchantIdManageCtrl',
data: {label: '商户号列表'}
controller: 'merchantIdManageCtrl'
}).state('merchant_id_manage.no_trace_list', {
url: '/no_trace_list',
templateUrl: '/static/payment/merchantid/templates/no_trade_sub_merchant_id.html',
controller: 'noTradeSubMerchantIdCtrl'
}).state('merchant_id_manage.temp_list', {
url: '/temp_list',
templateUrl: '/static/payment/merchantid/templates/temp_sub_merchant_id.html',
controller: 'tempSubMerchantId'
})
}]);
app.controller('merchantIdManageCtrl', ['$scope', '$state', '$http', '$uibModal', 'commonDialog', function ($scope, $state, $http,$uibModal,commonDialog) {
$scope.pagination = {};
$scope.params = {};
app.controller('merchantIdManageCtrl', ['$scope', '$state', '$http', function ($scope, $state, $http) {
$scope.isCollapsed = true;
$scope.toShow = false;
$scope.client_loading = true;
$scope.loadClient = function () {
$scope.client_loading = true;
$http.get('/sys/merchant_id').then(function (resp) {
$scope.clientsMap = resp.data;
$scope.client_loading = false;
});
$http.get('/sys/merchant_id').then(function (resp) {
$scope.clientsMap = resp.data;
$scope.client_loading = false;
});
};
$scope.loadClient();
$scope.loadNotTradeClient = function () {
$scope.showClient = function (sub_merchant_id) {
if($scope.sub_merchant_id == sub_merchant_id){
return;
}
$http.get('/sys/merchant_id/'+sub_merchant_id).then(function (resp) {
$scope.client_monikers= resp.data;
$scope.sub_merchant_id = sub_merchant_id;
});
};
}]);
app.controller('noTradeSubMerchantIdCtrl', ['$scope', '$state', '$http','$uibModal', function ($scope, $state, $http,$uibModal) {
$scope.pagination = {};
$scope.params = {};
$scope.isCollapsed = true;
$scope.loadNotTradeClient = function () {
$scope.disable_button = true;
$http.get('/sys/merchant_id/trade').then(function (resp) {
$scope.notTradeClientsMap = resp.data.merchant_id_map;
$scope.refresh_time = resp.data.refresh_time;
$scope.disable_button = false;
});
};
$scope.loadNotTradeClient();
$scope.loadTempSubMerchantId = function () {
var params = angular.copy($scope.params);
if(!params.sub_merchant_id){
delete params.sub_merchant_id;
}
$http.get('/sys/merchant_id/common_sub_merchant_id',{params: params}).then(function (resp) {
$scope.subMerchantIdList= resp.data;
});
};
$scope.loadTempSubMerchantId();
$scope.showClient = function (sub_merchant_id) {
$uibModal.open({
templateUrl: '/static/payment/merchantid/templates/client_sub_merchant_id.html',
controller: 'showClientsCtrl',
resolve: {
clients: ['$http', function ($http) {
return $http.get('/sys/merchant_id/'+sub_merchant_id);
}]
},
size: 'sm'
})
};
$scope.loadNotTradeClient();
$scope.refresh = function () {
$scope.disable_button = true;
$http.post('/sys/merchant_id/refresh').then(function (resp) {
$http.post('/sys/merchant_id/refresh').then(function () {
$scope.loadNotTradeClient();
});
};
$scope.save = function () {
$scope.showClient = function (sub_merchant_id) {
$uibModal.open({
templateUrl: '/static/payment/merchantid/templates/new_common_sub_merchant_id.html',
controller: 'newCommonSubMerchantIdCtrl'
}).result.then(function () {
$scope.loadTempSubMerchantId()
templateUrl: '/static/payment/merchantid/templates/client_sub_merchant_id.html',
controller: 'showClientsCtrl',
resolve: {
qrJson: ['$http', function ($http) {
return $http.put('/sys/merchant_id/qrcode/'+sub_merchant_id);
}]
},
size: 'sm'
})
}
$scope.disable = function (sub_merchant_id) {
$http.put('/sys/merchant_id/common_sub_merchant_id/'+sub_merchant_id).then(function (resp) {
commonDialog.alert({title: 'Success', content: 'Success', type: 'success'});
$scope.loadTempSubMerchantId();
},function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
});
}
};
}]);
app.controller('showClientsCtrl', ['$scope', '$http','qrJson', function ($scope, $http,qrJson) {
$scope.qrJson = qrJson.data;
}]);
app.controller('tempSubMerchantId', ['$scope', '$state', '$http', '$uibModal', 'commonDialog', function ($scope, $state, $http,$uibModal,commonDialog) {
$scope.pagination = {};
$scope.params = {};
app.controller('showClientsCtrl', ['$scope', '$http','clients', function ($scope, $http,clients) {
$scope.clients = clients.data;
$scope.loadTempSubMerchantId = function () {
var params = angular.copy($scope.params);
if(!params.sub_merchant_id){
delete params.sub_merchant_id;
}
$http.get('/sys/merchant_id/common_sub_merchant_id',{params: params}).then(function (resp) {
$scope.subMerchantIdList= resp.data;
});
};
$scope.loadTempSubMerchantId();
$scope.save = function () {
$uibModal.open({
templateUrl: '/static/payment/merchantid/templates/new_common_sub_merchant_id.html',
controller: 'newCommonSubMerchantIdCtrl'
}).result.then(function () {
$scope.loadTempSubMerchantId()
})
};
$scope.disable = function (sub_merchant_id) {
$http.put('/sys/merchant_id/common_sub_merchant_id/'+sub_merchant_id).then(function (resp) {
commonDialog.alert({title: 'Success', content: 'Success', type: 'success'});
$scope.loadTempSubMerchantId();
},function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
});
}
}]);
app.controller('newCommonSubMerchantIdCtrl', ['$scope', '$http','commonDialog','$state', function ($scope, $http,commonDialog,$state) {
app.controller('newCommonSubMerchantIdCtrl', ['$scope', '$http','commonDialog', function ($scope, $http,commonDialog) {
$scope.params = {};
$scope.saveSubMerchantId = function () {
var params = angular.copy($scope.params);

@ -1,26 +1,3 @@
<style>
.padding-size{
padding-top: 5px;
padding-right: 5px;
padding-bottom: 5px;
padding-left: 15px;
}
.padding-top-size{
padding-top: 10px;
}
</style>
<div class="modal-header padding-size">
<h5>Clients</h5>
</div>
<div class="modal-body" padding-top-size>
<div>
<a ng-repeat="client in clients track by $index" ng-show="$index<clients.length-1"
ui-sref="partners.detail({clientMoniker:client.client_moniker})">
{{client.client_moniker}}<span class="text-black">,</span>&nbsp;
</a>
<a ng-repeat="client in clients" ng-if="$last"
ui-sref="partners.detail({clientMoniker:client.client_moniker})">
{{client.client_moniker}}
</a>
</div>
<div class="modal-body">
<img ng-src="{{qrJson.qrcode_img}}" class="img-responsive">
</div>

@ -2,28 +2,52 @@
.cursor {
cursor: pointer;
}
.div-display{
.div-display {
display: none;
}
.i-rotate_90{
animation:rotate_90 1s forwards;
-webkit-animation:rotate_90 1s forwards; /* Safari and Chrome */
.i-rotate_90 {
animation: rotate_90 1s forwards;
-webkit-animation: rotate_90 1s forwards; /* Safari and Chrome */
}
@keyframes rotate_90
{
from {transform:rotate(0deg);}
to {transform:rotate(90deg);}
}
@keyframes rotate_90 {
from {
transform: rotate(0deg);
}
to {
transform: rotate(90deg);
}
}
@-webkit-keyframes rotate_90 /* Safari and Chrome */
{
from {-webkit-transform:rotate(0deg);}
to {-webkit-transform:rotate(90deg);}
from {
-webkit-transform: rotate(0deg);
}
to {
-webkit-transform: rotate(90deg);
}
}
.popover-color{
background-color: #f7f7f7;
border-bottom: 1px solid #ebebeb;
color: black;
}
.popover-content button{
display: inline-block;
}
.position_re{
position: relative;
}
.position_re .position_ab{
position: absolute;
top: 90%;
left: 90%;
}
</style>
<div ui-view>
<section class="content-header">
<h1>Merchant Id Manage</h1>
<ol class="breadcrumb">
@ -35,122 +59,98 @@
</section>
<div class="content">
<div class="box box-warning">
<div class="box-body">
<uib-tabset>
<uib-tab heading="商户号列表">
<loadingbar ng-if="client_loading"></loadingbar>
<div class="col-sm-12 col-xs-12">
<div style="margin-top: 5px">
<div class="list-group col-sm-12 col-xs-12" ng-repeat="(key,clients) in clientsMap">
<a class="list-group-item active col-sm-12 col-xs-12">
{{key|choose_merchant_id}}
<span ng-show="clients.length>59" class="small-box-footer cursor pull-right" ng-click="isCollapsed = !isCollapsed"><span ng-if="clients.length>59">更多 <i class="fa fa-arrow-circle-right" ng-class="{'i-rotate_90':!isCollapsed}"></i></span></span>
</a>
<a class="list-group-item col-sm-2 col-xs-6 cursor"
ng-repeat="client in clients | orderBy:'client_count':true"
ng--click="showClient(client.sub_merchant_id);" ng-if="$index<60">
<span>
{{client.sub_merchant_id}}&nbsp;<i class="fa fa-clock-o text-danger"
title="Using temp Sub Merchant ID"
ng-if="client.temp_sub_merchant"></i></span>
<span class="badge" aria-hidden="true" title="show detail">{{client.client_count}}</span>
</a>
<a class="list-group-item col-sm-2 col-xs-6 cursor" ng-hide="isCollapsed"
ng-repeat="client in clients | orderBy:'client_count':true"
ng--click="showClient(client.sub_merchant_id);" ng-if="$index>59">
<span>
{{client.sub_merchant_id}}&nbsp;<i class="fa fa-clock-o text-danger"
title="Using temp Sub Merchant ID"
ng-if="client.temp_sub_merchant"></i></span>
<span class="badge" aria-hidden="true" title="show detail">{{client.client_count}}</span>
</a>
</div>
</div>
</div>
</uib-tab>
<uib-tab heading="近25天未交易商户号">
<div class="box-body">
<div class="col-sm-12 col-xs-12" style="padding-right: 30px;margin-bottom: 5px">
<div class="pull-right">
<span ng-if="refresh_time">
<span>上次刷新时间:</span><span><em><b>{{refresh_time}}</b></em></span>
</span>&nbsp;&nbsp;
<a role="button" class="btn btn-primary" title="refresh" ng-click="refresh()" ng-class="{disabled:disable_button}">
<i class="glyphicon glyphicon-refresh"
title="refresh"></i>
</a>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="nav-tabs-custom">
<ul class="nav nav-tabs">
<li ui-sref-active-eq="active">
<a ui-sref="merchant_id_manage">商户号列表</a>
</li>
<li ui-sref-active="active">
<a ui-sref=".no_trace_list">近25天未交易商户号</a>
</li>
<li ui-sref-active="active">
<a ui-sref=".temp_list">通用子商户号</a>
</li>
</ul>
<div class="tab-content" ui-view>
<div class="row">
<loadingbar ng-if="client_loading"></loadingbar>
<div class="col-sm-12 col-xs-12">
<loadingbar ng-if="disable_button"></loadingbar>
<div>
<div class="list-group col-sm-12 col-xs-12"
ng-repeat="(key,clients) in notTradeClientsMap">
<div style="margin-top: 5px">
<div class="list-group col-sm-12 col-xs-12" ng-repeat="(key,clients) in clientsMap">
<a class="list-group-item active col-sm-12 col-xs-12">
{{key|choose_merchant_id}}
<span ng-show="clients.length>59" class="small-box-footer cursor pull-right" ng-click="isCollapsed = !isCollapsed">更多 <i class="fa fa-arrow-circle-right" ng-class="{'i-rotate_90':!isCollapsed}"></i></span>
<span ng-show="clients.length>59" class="small-box-footer cursor pull-right"
ng-click="isCollapsed = !isCollapsed"><span
ng-if="clients.length>59">更多 <i class="fa fa-arrow-circle-right"
ng-class="{'i-rotate_90':!isCollapsed}"></i></span></span>
</a>
<a class="list-group-item col-sm-2 col-xs-6 cursor"
ng-repeat="client in clients | orderBy:'client_count':true"
ng--click="showClient(client.sub_merchant_id)" ng-if="$index<60">
<span>{{client.sub_merchant_id}}&nbsp;<i class="fa fa-clock-o text-danger"
title="Temp Sub Merchant ID"
ng-if="client.temp_sub_merchant"></i></span>
<span class="badge" aria-hidden="true" title="show detail">{{client.client_count}}</span>
ng-click="showClient(client.sub_merchant_id);toShow=!toShow" ng-if="$index<60">
<span>
{{client.sub_merchant_id}}&nbsp;<i class="fa fa-clock-o text-danger"
title="Using temp Sub Merchant ID"
ng-if="client.temp_sub_merchant"></i></span>
<span class="badge pull-right position_re">
{{client.client_count}}
<div ng-if="sub_merchant_id==client.sub_merchant_id&&toShow" class="popover fade in position_ab"
role="tooltip" style="display: block;">
<div class="arrow"></div>
<h3 class="popover-title popover-color">Clients</h3>
<div class="popover-content" style="width: 250px">
<button type="button" class="btn btn-link"
ng-repeat="client_moniker in client_monikers"
ng-show="$index<client_monikers.length-1"
ui-sref="partners.detail({clientMoniker:client_moniker.client_moniker})">
{{client_moniker.client_moniker}}<span class="text-black">,</span>&nbsp;
</button>
<button type="button" class="btn btn-link"
ng-repeat="client_moniker in client_monikers" ng-if="$last"
ui-sref="partners.detail({clientMoniker:client_moniker.client_moniker})">
{{client_moniker.client_moniker}}
</button>
</div>
</div>
</span>
</a>
<a class="list-group-item col-sm-2 col-xs-6 cursor" ng-hide="isCollapsed"
ng-repeat="client in clients | orderBy:'client_count':true"
ng--click="showClient(client.sub_merchant_id)" ng-if="$index>59">
<span>{{client.sub_merchant_id}}&nbsp;<i class="fa fa-clock-o text-danger"
title="Temp Sub Merchant ID"
ng-if="client.temp_sub_merchant"></i></span>
<span class="badge" aria-hidden="true" title="show detail">{{client.client_count}}</span>
ng-click="showClient(client.sub_merchant_id);toShow=!toShow" ng-if="$index>59">
<span>
{{client.sub_merchant_id}}&nbsp;<i class="fa fa-clock-o text-danger"
title="Using temp Sub Merchant ID"
ng-if="client.temp_sub_merchant"></i></span>
<span class="badge pull-right position_re" aria-hidden="true" title="show detail">
{{client.client_count}}
<div ng-if="sub_merchant_id==client.sub_merchant_id&&toShow" class="popover fade in position_ab"
role="tooltip" style="display: block;">
<div class="arrow"></div>
<h3 class="popover-title popover-color">Clients</h3>
<div class="popover-content" style="width: 250px">
<button type="button" class="btn btn-link"
ng-repeat="client_moniker in client_monikers"
ng-show="$index<client_monikers.length-1"
ui-sref="partners.detail({clientMoniker:client_moniker.client_moniker})">
{{client_moniker.client_moniker}}<span class="text-black">,</span>&nbsp;
</button>
<button type="button" class="btn btn-link"
ng-repeat="client_moniker in client_monikers" ng-if="$last"
ui-sref="partners.detail({clientMoniker:client_moniker.client_moniker})">
{{client_moniker.client_moniker}}
</button>
</div>
</div>
</span>
</a>
</div>
</div>
</div>
</div>
</uib-tab>
<uib-tab heading="通用子商户号">
<div class="box-body table-responsive">
<div class="col-sm-12 col-xs-6">
<a role="button" class="btn btn-primary pull-right" title="Add Sub Merchant Id" ng-click="save()">
<i class="fa fa-plus"></i>
Add
</a>
</div>
<table class="table table-striped">
<thead>
<tr>
<th>Merchant Id</th>
<th>Sub Merchant Id</th>
<th>Operator</th>
<th>Create Time</th>
<th>Operation</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="client in subMerchantIdList">
<td ng-bind="client.merchant_id"></td>
<td>
{{client.sub_merchant_id}}
<i class="fa fa-clock-o text-danger"
title="Temp Sub Merchant ID"></i>
</td>
<td ng-bind="client.operator"></td>
<td ng-bind="client.create_time"></td>
<td>
<a class="text-bold text-danger" role="button" ng-click="disable(client.sub_merchant_id)">Disable</a>
</td>
</tr>
</tbody>
</table>
</div>
</uib-tab>
</uib-tabset>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

@ -0,0 +1,43 @@
<div class="row">
<div class="box-body">
<div class="col-sm-12 col-xs-12" style="padding-right: 30px;margin-bottom: 5px">
<div class="pull-right">
<span ng-if="refresh_time">
<span>上次刷新时间:</span><span><em><b>{{refresh_time}}</b></em></span>
</span>&nbsp;&nbsp;
<a role="button" class="btn btn-primary" title="refresh" ng-click="refresh()" ng-class="{disabled:disable_button}">
<i class="glyphicon glyphicon-refresh"
title="refresh"></i>
</a>
</div>
</div>
<div class="col-sm-12 col-xs-12">
<loadingbar ng-if="disable_button"></loadingbar>
<div>
<div class="list-group col-sm-12 col-xs-12"
ng-repeat="(key,clients) in notTradeClientsMap">
<a class="list-group-item active col-sm-12 col-xs-12">
{{key|choose_merchant_id}}
<span ng-show="clients.length>59" class="small-box-footer cursor pull-right" ng-click="isCollapsed = !isCollapsed">更多 <i class="fa fa-arrow-circle-right" ng-class="{'i-rotate_90':!isCollapsed}"></i></span>
</a>
<a class="list-group-item col-sm-2 col-xs-6 cursor"
ng-repeat="client in clients | orderBy:'client_count':true"
ng-click="showClient(client.sub_merchant_id)" ng-if="$index<60">
<span>{{client.sub_merchant_id}}&nbsp;<i class="fa fa-clock-o text-danger"
title="Temp Sub Merchant ID"
ng-if="client.temp_sub_merchant"></i></span>
<span class="badge" aria-hidden="true" title="show detail">{{client.client_count}}</span>
</a>
<a class="list-group-item col-sm-2 col-xs-6 cursor" ng-hide="isCollapsed"
ng-repeat="client in clients | orderBy:'client_count':true"
ng-click="showClient(client.sub_merchant_id)" ng-if="$index>59">
<span>{{client.sub_merchant_id}}&nbsp;<i class="fa fa-clock-o text-danger"
title="Temp Sub Merchant ID"
ng-if="client.temp_sub_merchant"></i></span>
<span class="badge" aria-hidden="true" title="show detail">{{client.client_count}}</span>
</a>
</div>
</div>
</div>
</div>
</div>

@ -0,0 +1,38 @@
<div class="row">
<div class="box-body table-responsive">
<div class="col-sm-12 col-xs-6">
<a role="button" class="btn btn-primary pull-right" title="Add Sub Merchant Id"
ng-click="save()">
<i class="fa fa-plus"></i>
Add
</a>
</div>
<table class="table table-striped">
<thead>
<tr>
<th>Merchant Id</th>
<th>Sub Merchant Id</th>
<th>Operator</th>
<th>Create Time</th>
<th>Operation</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="client in subMerchantIdList">
<td ng-bind="client.merchant_id"></td>
<td>
{{client.sub_merchant_id}}
<i class="fa fa-clock-o text-danger"
title="Temp Sub Merchant ID"></i>
</td>
<td ng-bind="client.operator"></td>
<td ng-bind="client.create_time"></td>
<td>
<a class="text-bold text-danger" role="button"
ng-click="disable(client.sub_merchant_id)">Disable</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>

@ -254,6 +254,7 @@ $(function () {
data.customerrate = true;
}
data.coupons = dataCache.coupons;
data.qrcodeVersion = window.qrcodeVersion;
dataCache.remark = '';
$.ajax({

@ -100,6 +100,7 @@ $(function () {
}
remarkInput.val('');
data.account_id = User.getProduct();
data.qrcodeVersion = window.qrcodeVersion;
$.ajax({
url: '/api/v1.0/bestpay/partners/' + window.client_moniker + '/app_order',
method: 'POST',

@ -226,6 +226,7 @@ $(function () {
data.coupons = dataCache.coupons;
dataCache.remark = '';
data.account_id = User.getProduct();
data.qrcodeVersion = window.qrcodeVersion;
$.ajax({
url: '/api/v1.0/bestpay/partners/' + window.client_moniker + '/app_order',
method: 'POST',

@ -248,6 +248,7 @@ $(function () {
data.customerrate = true;
}
data.coupons = dataCache.coupons;
data.qrcodeVersion = window.qrcodeVersion;
dataCache.remark = '';
$.ajax({
url: '/api/payment/v1.0/wechat_jsapi_payment/partners/' + window.client_moniker + '/preorder',

@ -2,12 +2,17 @@ package au.com.royalpay.payment.manage.ofei.core.impl;
import au.com.royalpay.payment.manage.ofei.core.OfeiClient;
import com.alibaba.fastjson.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import java.math.BigDecimal;
import javax.annotation.Resource;
/**
@ -19,9 +24,21 @@ import javax.annotation.Resource;
public class OfeiClientImplTest {
@Resource
private OfeiClient ofeiClient;
@Resource
private MongoTemplate mongoTemplate;
@Test
public void qbTopUp() throws Exception {
ofeiClient.qbTopUp("10","164851225");
}
@Test
public void testMongo(){
JSONObject test = new JSONObject();
test.put("id","asd");
test.put("name","kira");
test.put("age",123);
test.put("amount", BigDecimal.ONE);
mongoTemplate.save(test);
}
}
Loading…
Cancel
Save