master
wangning 7 years ago
parent 391e254402
commit 498b30c519

@ -1,21 +1,29 @@
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.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 +34,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,6 +57,8 @@ 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;
@ -230,8 +241,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);

@ -58,6 +58,7 @@ import au.com.royalpay.payment.manage.merchants.entity.impls.OrderExpiryModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.ParentIdModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.PaypadVersionModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.RefundAuditModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.AuditModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.SettleHourModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.SwitchPermissionModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.TimeZoneModify;
@ -561,7 +562,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
Assert.notNull(client);
checkOrgPermission(manager, client);
int clientId = client.getIntValue("client_id");
LogoModify clientModify = new LogoModify(manager,clientMoniker,null,null);
LogoModify clientModify = new LogoModify(manager, clientMoniker, null, null);
List<JSONObject> clients = clientMapper.listChildClients(clientId);
if (StringUtils.isNotEmpty(info.getLogoId())) {
String fileUrl = attachmentClient.getFileUrl(info.getLogoId());
@ -623,21 +624,17 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
client.putAll(clientConfigService.find(client.getIntValue("client_id")));
Integer open_status = client.getInteger("open_status");
boolean checkGreenChannel = client.getIntValue("approve_result") == 2 && (client.getIntValue("source") == 1 || client.getIntValue("source") == 2);
client.put("approve_result", pass);
client.put("approver", manager.getString("manager_id"));
client.put("approve_time", new Date());
client.put("open_status", 5);
AuditModify auditModify = new AuditModify(manager, clientMoniker, pass, manager.getString("manager_id"), new Date());
auditModify.setOpen_status(5);
if (client.getIntValue("source") == 5) {
client.put("source", 1);
auditModify.setSource(1);
}
clientMapper.update(client);
clientModifySupport.processClientModify(auditModify);
sendCommissionWechatMessage(client);// wxMessage
if (pass == 1) {
client.put("skip_clearing", 0);
clientMapper.update(client);
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "skip_clearing", false));
if (client.getIntValue("source") == 4) {
sendAuthInitEmail(manager,client);
sendAuthInitEmail(manager, client);
} else if (checkGreenChannel && client.getIntValue("open_status") == 5) {
// 绿色通道通过后不发邮件
logger.info("PASS 绿色通道:" + clientMoniker);
@ -687,7 +684,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
username += "1";
}
}
sendInitEmail(manager,client, username, pwd);
sendInitEmail(manager, client, username, pwd);
}
@Override
@ -701,7 +698,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new BadRequestException("Email validating... Wait for a moment");
}
int clientId = client.getIntValue("client_id");
clientModifySupport.processClientConfigModify(new EmailModify(manager,clientMoniker,4,null));
clientModifySupport.processClientConfigModify(new EmailModify(manager, clientMoniker, 4, null));
if (ManagerRole.BD_USER.hasRole(manager.getIntValue("role"))) {
int checkBDPermission = clientBDMapper.checkBDPermission(clientId, manager.getString("manager_id"));
if (checkBDPermission <= 0) {
@ -710,7 +707,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
List<JSONObject> accounts = clientAccountMapper.listAdminAccounts(clientId);
if (client.getIntValue("source") == 4) {
sendAuthInitEmail(manager,client);
sendAuthInitEmail(manager, client);
} else {
if (accounts.size() == 0) {
initAdminUserAndSendEmail(manager, clientMoniker, client);
@ -718,13 +715,13 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
JSONObject account = accounts.get(0);
String pwd = RandomStringUtils.random(8, true, true);
resetAccountPwd(manager, clientMoniker, account.getString("account_id"), pwd);
sendInitEmail(manager,client, account.getString("username"), pwd);
sendInitEmail(manager, client, account.getString("username"), pwd);
}
}
}
@Override
public void sendInitEmail(JSONObject account,final JSONObject client, String username, String pwd) {
public void sendInitEmail(JSONObject account, final JSONObject client, String username, String pwd) {
logger.debug("sending email after comply");
JSONObject model = new JSONObject();
model.put("username", username);
@ -762,16 +759,16 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
try {
String emailId = mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", mailTo,
emails.isEmpty() ? "" : StringUtils.join(emails, ","), content);
clientModifySupport.processClientConfigModify(new EmailModify(account,client.getString("client_moniker"),3,emailId));
clientModifySupport.processClientConfigModify(new EmailModify(account, client.getString("client_moniker"), 3, emailId));
} catch (Exception e) {
clientModifySupport.processClientConfigModify(new EmailModify(account,client.getString("client_moniker"),0,null));
clientModifySupport.processClientConfigModify(new EmailModify(account, client.getString("client_moniker"), 0, null));
throw new EmailException("Email Sending Failed", e);
}
}
}.start();
}
public void sendAuthInitEmail(JSONObject account ,final JSONObject client) {
public void sendAuthInitEmail(JSONObject account, final JSONObject client) {
logger.debug("sending email after comply about a new partner opening by quick access");
JSONObject model = new JSONObject();
model.put("client_moniker", client.getString("client_moniker"));
@ -809,7 +806,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
try {
String emailId = mailService.sendEmail("Your Partner Account Has Been Authenticated Successfully", mailTo,
emails.isEmpty() ? "" : StringUtils.join(emails, ","), content);
clientModifySupport.processClientConfigModify(new EmailModify(account,client.getString("client_moniker"),3,emailId));
clientModifySupport.processClientConfigModify(new EmailModify(account, client.getString("client_moniker"), 3, emailId));
} catch (Exception e) {
throw new EmailException("Email Sending Failed", e);
}
@ -1102,16 +1099,16 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
@Override
public void updateClientBDUser(JSONObject account,String clientMoniker, int managerId) {
public void updateClientBDUser(JSONObject account, String clientMoniker, int managerId) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
clientModifySupport.processClientModify(new BDUserModify(account,clientMoniker,String.valueOf(managerId),null));
clientModifySupport.processClientModify(new BDUserModify(account, clientMoniker, String.valueOf(managerId), null));
List<JSONObject> subClients = clientMapper.listChildClients(client.getIntValue("client_id"));
for (JSONObject subClient : subClients) {
subClient.put("bd_user", managerId);
clientModifySupport.processClientModify(new BDUserModify(account,subClient.getString("client_moniker"),String.valueOf(managerId),null));
clientModifySupport.processClientModify(new BDUserModify(account, subClient.getString("client_moniker"), String.valueOf(managerId), null));
}
}
@ -1122,7 +1119,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
clientModifySupport.processClientConfigModify(new CredentialCodeModify(manager,clientMoniker, RandomStringUtils.random(32, true, true)));
clientModifySupport.processClientConfigModify(new CredentialCodeModify(manager, clientMoniker, RandomStringUtils.random(32, true, true)));
}
@Override
@ -1648,12 +1645,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
@Override
public void updateTimeZone(JSONObject account,String clientMoniker, String timezone) {
public void updateTimeZone(JSONObject account, String clientMoniker, String timezone) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
clientModifySupport.processClientModify(new TimeZoneModify(account,clientMoniker,timezone));
clientModifySupport.processClientModify(new TimeZoneModify(account, clientMoniker, timezone));
}
@Override
@ -1746,36 +1743,35 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
@Override
public void setMaxOrderAmount(JSONObject account,String clientMoniker, BigDecimal limit) {
public void setMaxOrderAmount(JSONObject account, String clientMoniker, BigDecimal limit) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
clientModifySupport.processClientConfigModify(new MaxOrderAmountModify(account,clientMoniker,limit));
clientModifySupport.processClientConfigModify(new MaxOrderAmountModify(account, clientMoniker, limit));
}
@Override
public void setCustomerSurchargeRate(JSONObject account,String clientMoniker, BigDecimal customer_surcharge_rate) {
public void setCustomerSurchargeRate(JSONObject account, String clientMoniker, BigDecimal customer_surcharge_rate) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
if (customer_surcharge_rate == null) {
clientModifySupport.processClientConfigModify(new CustomerSurchargeRateModify(account,clientMoniker,null));
clientModifySupport.processClientConfigModify(new CustomerSurchargeRateModify(account, clientMoniker, null));
} else {
BigDecimal rate_value = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Wechat").getBigDecimal("rate_value");
if (customer_surcharge_rate.compareTo(PlatformEnvironment.getEnv().getMaxCustomerSurchargeRate()) > 0
|| customer_surcharge_rate.compareTo(rate_value) < 0) {
throw new ForbiddenException("Invalid Range");
}
clientModifySupport.processClientConfigModify(new CustomerSurchargeRateModify(account,clientMoniker,customer_surcharge_rate));
clientModifySupport.processClientConfigModify(new CustomerSurchargeRateModify(account, clientMoniker, customer_surcharge_rate));
}
}
@Override
public void setOrderExpiryConfig(JSONObject account ,String clientMoniker, String orderExpiryConfig) {
public void setOrderExpiryConfig(JSONObject account, String clientMoniker, String orderExpiryConfig) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
@ -1784,7 +1780,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
update.put("client_id", client.getIntValue("client_id"));
if (orderExpiryConfig != null) {
OrderExpiryRuleResolver.resolveExpiryTime(orderExpiryConfig, new Date());
clientModifySupport.processClientConfigModify(new OrderExpiryModify(account,clientMoniker,orderExpiryConfig));
clientModifySupport.processClientConfigModify(new OrderExpiryModify(account, clientMoniker, orderExpiryConfig));
}
}
@ -2121,7 +2117,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
clientFilesMapper.update(file);
}
if (!renewal) {
clientModifySupport.processClientModify(new OpenStatusModify(manager,clientMoniker,2));
clientModifySupport.processClientModify(new OpenStatusModify(manager, clientMoniker, 2));
}
if (manager != null) {
@ -2140,7 +2136,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (CollectionUtils.isEmpty(existFiles)) {
throw new BadRequestException("The Agree File is not Complete!");
}
clientModifySupport.processClientModify(new OpenStatusModify(manager,clientMoniker,3));
clientModifySupport.processClientModify(new OpenStatusModify(manager, clientMoniker, 3));
saveClientAuditProcess(client.getIntValue("client_id"), 2, 3, "合同制作完成等待BD处理", manager);
// sendAgreeFileMsgToBD(client,null);
sendCommissionWechatMessage(client);
@ -2203,9 +2199,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (StringUtils.isNotBlank(master_client.getString("parent_client_id"))) {
throw new BadRequestException("Master Merchant is not valid");
}
clientModifySupport.processClientModify(new ParentIdModify(manager,clientMoniker,master_client.getIntValue("client_id")));
clientModifySupport.processClientModify(new ParentIdModify(manager, clientMoniker, master_client.getIntValue("client_id")));
} else {
clientModifySupport.processClientModify(new ParentIdModify(manager,clientMoniker,null));
clientModifySupport.processClientModify(new ParentIdModify(manager, clientMoniker, null));
}
}
@ -2235,46 +2231,46 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
@Override
public void setWeekendDelay(JSONObject account,String clientMoniker,int clientId, boolean delay) {
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account,clientMoniker,"weekend_delay",delay));
public void setWeekendDelay(JSONObject account, String clientMoniker, int clientId, boolean delay) {
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account, clientMoniker, "weekend_delay", delay));
}
@Override
public void setClientQRCodePaySurCharge(JSONObject account,String clientMoniker, boolean paySurcharge) {
public void setClientQRCodePaySurCharge(JSONObject account, String clientMoniker, boolean paySurcharge) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account,clientMoniker,"qrcode_surcharge",paySurcharge));
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account, clientMoniker, "qrcode_surcharge", paySurcharge));
}
@Override
public void setClientApiPaySurCharge(JSONObject account,String clientMoniker, boolean enableApiSurcharge) {
public void setClientApiPaySurCharge(JSONObject account, String clientMoniker, boolean enableApiSurcharge) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account,clientMoniker,"api_surcharge",enableApiSurcharge));
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account, clientMoniker, "api_surcharge", enableApiSurcharge));
}
@Override
public void setClientRetailPaySurCharge(JSONObject account,String clientMoniker, boolean paySurcharge) {
public void setClientRetailPaySurCharge(JSONObject account, String clientMoniker, boolean paySurcharge) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account,clientMoniker,"retail_surcharge",paySurcharge));
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account, clientMoniker, "retail_surcharge", paySurcharge));
}
@Override
public void setClientTaxInSurcharge(JSONObject account , String clientMoniker, boolean taxInSurcharge) {
public void setClientTaxInSurcharge(JSONObject account, String clientMoniker, boolean taxInSurcharge) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account,clientMoniker,"tax_in_surcharge",taxInSurcharge));
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account, clientMoniker, "tax_in_surcharge", taxInSurcharge));
}
@ -2473,7 +2469,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new BadRequestException("The Partner's Bank Account is not config!");
}
int open_status_from = client.getIntValue("open_status");
OpenStatusModify openStatusModify = new OpenStatusModify(manager,clientMoniker,4);
OpenStatusModify openStatusModify = new OpenStatusModify(manager, clientMoniker, 4);
if ((client.getIntValue("source") == 1 || client.getIntValue("source") == 2) && client.getIntValue("approve_result") == 2) {
openStatusModify.setApprove_time(new Date());
} else {
@ -2538,7 +2534,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (account == null || account.size() <= 0) {
throw new BadRequestException("The Partner's Bank Account is not config!");
}
OpenStatusModify openStatusModify = new OpenStatusModify(manager,clientMoniker,1);
OpenStatusModify openStatusModify = new OpenStatusModify(manager, clientMoniker, 1);
openStatusModify.setApprove_result(4);
openStatusModify.setApprove_time(new Date());
clientModifySupport.processClientModify(openStatusModify);
@ -2580,7 +2576,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new BadRequestException("The Partner's Bank Account is not config!");
}
Integer open_status_from = client.getInteger("open_status");
OpenStatusModify openStatusModify = new OpenStatusModify(manager,clientMoniker,10);
OpenStatusModify openStatusModify = new OpenStatusModify(manager, clientMoniker, 10);
openStatusModify.setApprove_result(4);
openStatusModify.setApprove_time(new Date());
clientModifySupport.processClientModify(openStatusModify);
@ -2598,7 +2594,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
clientModifySupport.processClientConfigModify(new PaypadVersionModify(manager,clientMoniker,paypad_version));
clientModifySupport.processClientConfigModify(new PaypadVersionModify(manager, clientMoniker, paypad_version));
}
@Override
@ -2608,7 +2604,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client == null) {
throw new InvalidShortIdException();
}
clientModifySupport.processClientConfigModify(new PaypadVersionModify(account,client.getString("client_moniker"),paypad_version));
clientModifySupport.processClientConfigModify(new PaypadVersionModify(account, client.getString("client_moniker"), paypad_version));
}
@ -2641,7 +2637,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client == null) {
throw new InvalidShortIdException();
}
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account,client.getString("client_moniker"),"qrcode_surcharge",paySurcharge));
clientModifySupport
.processClientConfigModify(new SwitchPermissionModify(account, client.getString("client_moniker"), "qrcode_surcharge", paySurcharge));
}
@ -2652,7 +2649,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client == null) {
throw new InvalidShortIdException();
}
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account,client.getString("client_moniker"),"api_surcharge",enableApiSurcharge));
clientModifySupport
.processClientConfigModify(new SwitchPermissionModify(account, client.getString("client_moniker"), "api_surcharge", enableApiSurcharge));
}
@ -2667,23 +2665,27 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
// cashier cannot change this config
throw new ForbiddenException("Cashier has no permission to switch retail surcharge");
}
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account,client.getString("client_moniker"),"retail_surcharge",paySurcharge));
clientModifySupport
.processClientConfigModify(new SwitchPermissionModify(account, client.getString("client_moniker"), "retail_surcharge", paySurcharge));
}
@Override
public void changeSurcharge(JSONObject account,JSONObject device, UpdateSurchargeDTO updateSurchargeDTO) {
public void changeSurcharge(JSONObject account, JSONObject device, UpdateSurchargeDTO updateSurchargeDTO) {
JSONObject client = clientMapper.findClient(device.getIntValue("client_id"));
if (client == null) {
throw new NotFoundException("Client not found, please check");
}
if (updateSurchargeDTO.getApiSurcharge() != null) {
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account,client.getString("client_moniker"),"api_surcharge",updateSurchargeDTO.getApiSurcharge()));
clientModifySupport.processClientConfigModify(
new SwitchPermissionModify(account, client.getString("client_moniker"), "api_surcharge", updateSurchargeDTO.getApiSurcharge()));
}
if (updateSurchargeDTO.getQrcodeSurcharge() != null) {
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account,client.getString("client_moniker"),"qrcode_surcharge",updateSurchargeDTO.getQrcodeSurcharge()));
clientModifySupport.processClientConfigModify(
new SwitchPermissionModify(account, client.getString("client_moniker"), "qrcode_surcharge", updateSurchargeDTO.getQrcodeSurcharge()));
}
if (updateSurchargeDTO.getRetailSurcharge() != null) {
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account,client.getString("client_moniker"),"retail_surcharge",updateSurchargeDTO.getRetailSurcharge()));
clientModifySupport.processClientConfigModify(
new SwitchPermissionModify(account, client.getString("client_moniker"), "retail_surcharge", updateSurchargeDTO.getRetailSurcharge()));
}
}
@ -2697,26 +2699,23 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new ForbiddenException();
}
int open_status = client.getIntValue("open_status");
AuditModify auditModify = new AuditModify(manager, clientMoniker, 5, manager.getString("manager_id"), new Date());
if (open_status == 1) {
client.put("open_status", null);
auditModify.setOpen_status(null);
} else {
client.put("open_status", open_status - 1);
auditModify.setOpen_status(-1);
}
client.put("approve_result", 5);
client.put("approver", manager.getString("manager_id"));
client.put("approve_time", new Date());
if (refuse_remark != null && !refuse_remark.isEmpty()) {
client.put("refuse_remark", refuse_remark);
auditModify.setRefuse_remark(refuse_remark);
}
saveClientAuditProcess(client.getIntValue("client_id"), open_status, client.getInteger("open_status"), "打回," + refuse_remark, manager);
clientMapper.update(client);
clientModifySupport.processClientModify(auditModify);
try {
sendMessageToBD(client, refuse_remark);
} catch (Exception e) {
logger.error("RefusePartnerError=======:" + clientMoniker + "," + e.getMessage());
}
clientInfoCacheSupport.clearClientCache(client.getIntValue("client_id"));
}
@Override
@ -2734,7 +2733,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
@Override
public void updateAppClient(JSONObject account,int client_id, AppClientBean appClientBean) {
public void updateAppClient(JSONObject account, int client_id, AppClientBean appClientBean) {
JSONObject client = getClientInfo(client_id);
Assert.notNull(client);
JSONObject updateObj = appClientBean.updateObject();
@ -2747,26 +2746,26 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new ForbiddenException("customerSurchargeRate is 0");
}
BigDecimal customerSurchargeRate = new BigDecimal(appClientBean.getCustomerSurchargeRate()).setScale(2, BigDecimal.ROUND_HALF_DOWN);
setCustomerSurchargeRate(account,client.getString("client_moniker"), customerSurchargeRate);
setCustomerSurchargeRate(account, client.getString("client_moniker"), customerSurchargeRate);
}
}
@Override
public void setSkipClearing(JSONObject account,String clientMoniker, Boolean skip_clearing) {
public void setSkipClearing(JSONObject account, String clientMoniker, Boolean skip_clearing) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account,clientMoniker,"skip_clearing",skip_clearing));
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account, clientMoniker, "skip_clearing", skip_clearing));
}
@Override
public void enableGatewayUpgrade(JSONObject account,String clientMoniker, boolean gatewayUpgrade) {
public void enableGatewayUpgrade(JSONObject account, String clientMoniker, boolean gatewayUpgrade) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account,clientMoniker,"gateway_upgrade",gatewayUpgrade));
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account, clientMoniker, "gateway_upgrade", gatewayUpgrade));
}
private void sendMessagetoCompliance(JSONObject client, String bd_user_name) {

@ -0,0 +1,65 @@
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;
}
}

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

@ -377,6 +377,6 @@ public class PartnerViewController {
@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,account.getIntValue("client_id"), account.getString("account_id"), "PC");
clientContractService.confirmSourceAgreement(account.getIntValue("client_id"), account.getString("account_id"), "PC");
}
}

@ -9,7 +9,7 @@ public interface ClientContractService {
JSONObject getOrGenerateSourceAgreement(int client_id, String channel);
void confirmSourceAgreement(JSONObject account,int client_id, String account_id, String channel);
void confirmSourceAgreement(int client_id, String account_id, String channel);
JSONObject getSourceAgreement(int client_id);

@ -74,7 +74,7 @@ public class ClientContractServiceImpl implements ClientContractService {
@Override
@Transactional
public void confirmSourceAgreement(JSONObject manager,int client_id, String account_id, String channel) {
public void confirmSourceAgreement(int client_id, String account_id, String channel) {
JSONObject client = clientManager.getClientInfo(client_id);
if (client == null) {
throw new NotFoundException("merchant not found");
@ -107,7 +107,7 @@ public class ClientContractServiceImpl implements ClientContractService {
contract.put("confirm_time", now);
contract.put("signatory", account.getString("display_name"));
clientsContractMapper.update(contract);
clientManager.setClientTaxInSurcharge(manager,client.getString("client_moniker"), false);
clientManager.setClientTaxInSurcharge(clientAccountMapper.findById(account_id),client.getString("client_moniker"), false);
}
@Override

Loading…
Cancel
Save