master
wangning 7 years ago
parent 24f49dfcfc
commit 391e254402

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

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

@ -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);
@ -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);
@ -191,13 +191,13 @@ public interface ClientManager {
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);
List<JSONObject> listClientsForSettlement();
@ -235,7 +235,7 @@ 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);
@ -249,7 +249,7 @@ public interface ClientManager {
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;
@ -273,7 +273,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);

@ -46,10 +46,17 @@ import au.com.royalpay.payment.manage.merchants.core.ClientModifySupport;
import au.com.royalpay.payment.manage.merchants.entity.impls.ApproveEmailModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.BDUserModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.ClearDaysModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.CredentialCodeModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.CustomerSurchargeRateModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.EmailModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.GreenChannelModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.LogoModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.MaxOrderAmountModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.MerchantIdModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.OpenStatusModify;
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.SettleHourModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.SwitchPermissionModify;
@ -553,20 +560,19 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
JSONObject client = getClientInfoByMoniker(clientMoniker);
Assert.notNull(client);
checkOrgPermission(manager, client);
JSONObject updateInfo = info.updateObject();
int clientId = client.getIntValue("client_id");
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());
updateInfo.put("logo_url", fileUrl);
clientModify.setLogo_url(fileUrl);
String thumbnail = attachmentClient.getThumbnail(info.getLogoId(), 600).getString("url");
updateInfo.put("logo_thumbnail", thumbnail);
clientModify.setLogo_thumbnail(thumbnail);
for (JSONObject subClient : clients) {
subClient.put("logo_url", fileUrl);
subClient.put("logo_thumbnail", thumbnail);
}
}
updateInfo.put("client_id", clientId);
int originReferrerId = client.getIntValue("referrer_id");
int updateReferrerId = Integer.parseInt(info.getReferrer_id() == null ? "0" : info.getReferrer_id());
@ -578,8 +584,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
clientBDMapper.update(clientBDInfo);
}
}
clientMapper.update(updateInfo);
clientInfoCacheSupport.clearClientCache(clientId);
clientModifySupport.processClientModify(clientModify);
}
@Override
@ -632,7 +637,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
client.put("skip_clearing", 0);
clientMapper.update(client);
if (client.getIntValue("source") == 4) {
sendAuthInitEmail(client);
sendAuthInitEmail(manager,client);
} else if (checkGreenChannel && client.getIntValue("open_status") == 5) {
// 绿色通道通过后不发邮件
logger.info("PASS 绿色通道:" + clientMoniker);
@ -682,7 +687,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
username += "1";
}
}
sendInitEmail(client, username, pwd);
sendInitEmail(manager,client, username, pwd);
}
@Override
@ -695,12 +700,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (sendStatus >= 3) {
throw new BadRequestException("Email validating... Wait for a moment");
}
JSONObject clientUpdate = new JSONObject();
int clientId = client.getIntValue("client_id");
clientUpdate.put("client_id", clientId);
clientUpdate.put("approve_email_send", 4);
clientUpdate.put("approve_email_id", null);
clientMapper.update(clientUpdate);
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) {
@ -709,7 +710,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
List<JSONObject> accounts = clientAccountMapper.listAdminAccounts(clientId);
if (client.getIntValue("source") == 4) {
sendAuthInitEmail(client);
sendAuthInitEmail(manager,client);
} else {
if (accounts.size() == 0) {
initAdminUserAndSendEmail(manager, clientMoniker, client);
@ -717,14 +718,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(client, account.getString("username"), pwd);
sendInitEmail(manager,client, account.getString("username"), pwd);
}
}
clientInfoCacheSupport.clearClientCache(clientId);
}
@Override
public void sendInitEmail(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,24 +762,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);
JSONObject clientUpdate = new JSONObject();
clientUpdate.put("client_id", client.getIntValue("client_id"));
clientUpdate.put("approve_email_send", 3);
clientUpdate.put("approve_email_id", emailId);
clientMapper.update(clientUpdate);
clientModifySupport.processClientConfigModify(new EmailModify(account,client.getString("client_moniker"),3,emailId));
} catch (Exception e) {
JSONObject clientUpdate = new JSONObject();
clientUpdate.put("client_id", client.getIntValue("client_id"));
clientUpdate.put("approve_email_send", 0);
clientUpdate.put("approve_email_id", null);
clientMapper.update(clientUpdate);
clientModifySupport.processClientConfigModify(new EmailModify(account,client.getString("client_moniker"),0,null));
throw new EmailException("Email Sending Failed", e);
}
}
}.start();
}
public void sendAuthInitEmail(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"));
@ -817,11 +809,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);
JSONObject clientUpdate = new JSONObject();
clientUpdate.put("client_id", client.getIntValue("client_id"));
clientUpdate.put("approve_email_send", 3);
clientUpdate.put("approve_email_id", emailId);
clientMapper.update(clientUpdate);
clientModifySupport.processClientConfigModify(new EmailModify(account,client.getString("client_moniker"),3,emailId));
} catch (Exception e) {
throw new EmailException("Email Sending Failed", e);
}
@ -1066,8 +1054,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
public void togglePayNotice(JSONObject account, String clientMoniker, boolean enable) {
JSONObject partner = getClientInfoByMoniker(clientMoniker);
Assert.notNull(partner);
partner.put("enable_pay_notice", enable);
clientMapper.update(partner);
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account, clientMoniker, "enable_pay_notice", enable));
clientInfoCacheSupport.clearClientCache(partner.getIntValue("client_id"));
}
@ -1116,19 +1102,17 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
@Override
public void updateClientBDUser(String clientMoniker, int managerId) {
public void updateClientBDUser(JSONObject account,String clientMoniker, int managerId) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
client.put("bd_user", managerId);
clientMapper.update(client);
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);
clientMapper.update(subClient);
clientModifySupport.processClientModify(new BDUserModify(account,subClient.getString("client_moniker"),String.valueOf(managerId),null));
}
clientInfoCacheSupport.clearClientCache(client.getIntValue("client_id"));
}
@Override
@ -1138,9 +1122,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
client.put("credential_code", RandomStringUtils.random(32, true, true));
clientMapper.update(client);
clientInfoCacheSupport.clearClientCache(client.getIntValue("client_id"));
clientModifySupport.processClientConfigModify(new CredentialCodeModify(manager,clientMoniker, RandomStringUtils.random(32, true, true)));
}
@Override
@ -1793,7 +1775,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
@Override
public void setOrderExpiryConfig(String clientMoniker, String orderExpiryConfig) {
public void setOrderExpiryConfig(JSONObject account ,String clientMoniker, String orderExpiryConfig) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
@ -1802,8 +1784,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
update.put("client_id", client.getIntValue("client_id"));
if (orderExpiryConfig != null) {
OrderExpiryRuleResolver.resolveExpiryTime(orderExpiryConfig, new Date());
update.put("order_expiry_config", orderExpiryConfig);
clientMapper.update(update);
clientModifySupport.processClientConfigModify(new OrderExpiryModify(account,clientMoniker,orderExpiryConfig));
}
}
@ -2140,8 +2121,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
clientFilesMapper.update(file);
}
if (!renewal) {
client.put("open_status", 2);
clientMapper.update(client);
clientModifySupport.processClientModify(new OpenStatusModify(manager,clientMoniker,2));
}
if (manager != null) {
@ -2160,8 +2140,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (CollectionUtils.isEmpty(existFiles)) {
throw new BadRequestException("The Agree File is not Complete!");
}
client.put("open_status", 3);
clientMapper.update(client);
clientModifySupport.processClientModify(new OpenStatusModify(manager,clientMoniker,3));
saveClientAuditProcess(client.getIntValue("client_id"), 2, 3, "合同制作完成等待BD处理", manager);
// sendAgreeFileMsgToBD(client,null);
sendCommissionWechatMessage(client);
@ -2224,11 +2203,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (StringUtils.isNotBlank(master_client.getString("parent_client_id"))) {
throw new BadRequestException("Master Merchant is not valid");
}
client.put("parent_client_id", master_client.getIntValue("client_id"));
clientModifySupport.processClientModify(new ParentIdModify(manager,clientMoniker,master_client.getIntValue("client_id")));
} else {
client.put("parent_client_id", null);
clientModifySupport.processClientModify(new ParentIdModify(manager,clientMoniker,null));
}
clientMapper.update(client);
}
@Override
@ -2257,67 +2235,47 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
@Override
public void setWeekendDelay(int clientId, boolean delay) {
JSONObject record = new JSONObject();
record.put("client_id", clientId);
record.put("weekend_delay", delay);
clientConfigService.update(record);
public void setWeekendDelay(JSONObject account,String clientMoniker,int clientId, boolean delay) {
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account,clientMoniker,"weekend_delay",delay));
}
@Override
public void setClientQRCodePaySurCharge(String clientMoniker, boolean paySurcharge) {
public void setClientQRCodePaySurCharge(JSONObject account,String clientMoniker, boolean paySurcharge) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
JSONObject update = new JSONObject();
int clientId = client.getIntValue("client_id");
update.put("client_id", clientId);
update.put("qrcode_surcharge", paySurcharge);
clientMapper.update(update);
clientInfoCacheSupport.clearClientCache(clientId);
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account,clientMoniker,"qrcode_surcharge",paySurcharge));
}
@Override
public void setClientApiPaySurCharge(String clientMoniker, boolean enableApiSurcharge) {
public void setClientApiPaySurCharge(JSONObject account,String clientMoniker, boolean enableApiSurcharge) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
JSONObject update = new JSONObject();
int clientId = client.getIntValue("client_id");
update.put("client_id", clientId);
update.put("api_surcharge", enableApiSurcharge);
clientMapper.update(update);
clientInfoCacheSupport.clearClientCache(clientId);
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account,clientMoniker,"api_surcharge",enableApiSurcharge));
}
@Override
public void setClientRetailPaySurCharge(String clientMoniker, boolean paySurcharge) {
public void setClientRetailPaySurCharge(JSONObject account,String clientMoniker, boolean paySurcharge) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
JSONObject update = new JSONObject();
int clientId = client.getIntValue("client_id");
update.put("client_id", clientId);
update.put("retail_surcharge", paySurcharge);
clientMapper.update(update);
clientInfoCacheSupport.clearClientCache(clientId);
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account,clientMoniker,"retail_surcharge",paySurcharge));
}
@Override
public void setClientTaxInSurcharge(String clientMoniker, boolean taxInSurcharge) {
public void setClientTaxInSurcharge(JSONObject account , String clientMoniker, boolean taxInSurcharge) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
JSONObject update = new JSONObject();
int clientId = client.getIntValue("client_id");
update.put("client_id", clientId);
update.put("tax_in_surcharge", taxInSurcharge);
clientMapper.update(update);
clientInfoCacheSupport.clearClientCache(clientId);
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account,clientMoniker,"tax_in_surcharge",taxInSurcharge));
}
@Override
@ -2515,16 +2473,15 @@ 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);
if ((client.getIntValue("source") == 1 || client.getIntValue("source") == 2) && client.getIntValue("approve_result") == 2) {
client.put("open_status", 4);
client.put("approve_time", new Date());
openStatusModify.setApprove_time(new Date());
} else {
openStatusModify.setApprove_time(new Date());
openStatusModify.setApprove_result(4);
client.put("approve_result", 4);
client.put("open_status", 4);
client.put("approve_time", new Date());
}
clientMapper.update(client);
clientModifySupport.processClientModify(openStatusModify);
saveClientAuditProcess(client.getIntValue("client_id"), open_status_from, 4, "BD完成签字提交compliance审核", manager);
if (manager != null) {
// sendMessagetoCompliance(client, manager.getString("display_name"));
@ -2581,10 +2538,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (account == null || account.size() <= 0) {
throw new BadRequestException("The Partner's Bank Account is not config!");
}
client.put("approve_result", 4);
client.put("approve_time", new Date());
client.put("open_status", 1);
clientMapper.update(client);
OpenStatusModify openStatusModify = new OpenStatusModify(manager,clientMoniker,1);
openStatusModify.setApprove_result(4);
openStatusModify.setApprove_time(new Date());
clientModifySupport.processClientModify(openStatusModify);
saveClientAuditProcess(client.getIntValue("client_id"), null, 1, "提交Compliance制作合同", manager);
if (manager != null) {
// sendAgreeFileMsgtoCompliance(client, manager.getString("display_name"));
@ -2623,10 +2580,10 @@ 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");
client.put("approve_result", 4);
client.put("open_status", 10);
client.put("approve_time", new Date());
clientMapper.update(client);
OpenStatusModify openStatusModify = new OpenStatusModify(manager,clientMoniker,10);
openStatusModify.setApprove_result(4);
openStatusModify.setApprove_time(new Date());
clientModifySupport.processClientModify(openStatusModify);
saveClientAuditProcess(client.getIntValue("client_id"), open_status_from, 10, "提交绿色通道申请Compliance审核", manager);
if (manager != null) {
// sendGreenChannelMessagetoCompliance(client, manager.getString("display_name"));
@ -2641,9 +2598,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
client.put("paypad_version", paypad_version);
clientMapper.update(client);
clientInfoCacheSupport.clearClientCache(client.getIntValue("client_id"));
clientModifySupport.processClientConfigModify(new PaypadVersionModify(manager,clientMoniker,paypad_version));
}
@Override
@ -2653,10 +2608,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client == null) {
throw new InvalidShortIdException();
}
JSONObject updateObj = new JSONObject();
updateObj.put("client_id", client.getIntValue("client_id"));
updateObj.put("paypad_version", paypad_version);
clientConfigService.update(updateObj);
clientModifySupport.processClientConfigModify(new PaypadVersionModify(account,client.getString("client_moniker"),paypad_version));
}
@Override
@ -2688,10 +2641,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client == null) {
throw new InvalidShortIdException();
}
JSONObject updateObj = new JSONObject();
updateObj.put("client_id", client.getIntValue("client_id"));
updateObj.put("qrcode_surcharge", paySurcharge);
clientConfigService.update(updateObj);
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account,client.getString("client_moniker"),"qrcode_surcharge",paySurcharge));
}
@Override
@ -2701,10 +2652,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client == null) {
throw new InvalidShortIdException();
}
JSONObject updateObj = new JSONObject();
updateObj.put("client_id", client.getIntValue("client_id"));
updateObj.put("api_surcharge", enableApiSurcharge);
clientConfigService.update(updateObj);
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account,client.getString("client_moniker"),"api_surcharge",enableApiSurcharge));
}
@Override
@ -2718,38 +2667,24 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
// cashier cannot change this config
throw new ForbiddenException("Cashier has no permission to switch retail surcharge");
}
JSONObject updateObj = new JSONObject();
updateObj.put("client_id", client.getIntValue("client_id"));
updateObj.put("retail_surcharge", paySurcharge);
clientConfigService.update(updateObj);
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account,client.getString("client_moniker"),"retail_surcharge",paySurcharge));
}
@Override
public void changeSurcharge(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");
}
int clientId = client.getIntValue("client_id");
if (updateSurchargeDTO.getApiSurcharge() != null) {
JSONObject updateObj = new JSONObject();
updateObj.put("client_id", clientId);
updateObj.put("api_surcharge", updateSurchargeDTO.getApiSurcharge());
clientMapper.update(updateObj);
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account,client.getString("client_moniker"),"api_surcharge",updateSurchargeDTO.getApiSurcharge()));
}
if (updateSurchargeDTO.getQrcodeSurcharge() != null) {
JSONObject updateObj = new JSONObject();
updateObj.put("client_id", clientId);
updateObj.put("qrcode_surcharge", updateSurchargeDTO.getQrcodeSurcharge());
clientMapper.update(updateObj);
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account,client.getString("client_moniker"),"qrcode_surcharge",updateSurchargeDTO.getQrcodeSurcharge()));
}
if (updateSurchargeDTO.getRetailSurcharge() != null) {
JSONObject updateObj = new JSONObject();
updateObj.put("client_id", client.getIntValue("client_id"));
updateObj.put("retail_surcharge", updateSurchargeDTO.getRetailSurcharge());
clientMapper.update(updateObj);
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account,client.getString("client_moniker"),"retail_surcharge",updateSurchargeDTO.getRetailSurcharge()));
}
clientInfoCacheSupport.clearClientCache(clientId);
}
@Override

@ -4,6 +4,8 @@ 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
*/
@ -35,7 +37,9 @@ public class BDUserModify extends ClientModify {
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);
}

@ -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;
/**
* 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,48 @@
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 LogoModify extends ClientModify {
private String logo_url;
private String logo_thumbnail;
public LogoModify(JSONObject account, String clientMoniker, String logo_url, String logo_thumbnail) {
super(account, clientMoniker);
this.logo_url = logo_url;
this.logo_thumbnail = logo_thumbnail;
}
public String getLogo_url() {
return logo_url;
}
public void setLogo_url(String logo_url) {
this.logo_url = logo_url;
}
public String getLogo_thumbnail() {
return logo_thumbnail;
}
public void setLogo_thumbnail(String logo_thumbnail) {
this.logo_thumbnail = logo_thumbnail;
}
@Override
protected String business() {
return "修改商户Logo信息";
}
@Override
protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject();
modify.put("logo_url", logo_url);
modify.put("logo_thumbnail", logo_thumbnail);
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;
}
}

@ -140,8 +140,8 @@ public class PartnerManageController {
}
@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})
@ -171,8 +171,8 @@ 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})
@ -181,18 +181,18 @@ public class PartnerManageController {
}
@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}/credential_code", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.BD_USER})

@ -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.getIntValue("client_id"), account.getString("account_id"), "PC");
clientContractService.confirmSourceAgreement(account,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(int client_id, String account_id, String channel);
void confirmSourceAgreement(JSONObject account,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(int client_id, String account_id, String channel) {
public void confirmSourceAgreement(JSONObject manager,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(client.getString("client_moniker"), false);
clientManager.setClientTaxInSurcharge(manager,client.getString("client_moniker"), false);
}
@Override

Loading…
Cancel
Save