wangning 7 years ago
parent 6380c5d5b5
commit 3a2b7356ca

@ -268,14 +268,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);
}

@ -1,5 +1,6 @@
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;
/**
@ -8,4 +9,6 @@ import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
public interface ClientModifySupport {
void processClientModify(ClientModify clientModify);
void processClientConfigModify(ClientConfigModify clientConfigModify);
}

@ -43,7 +43,11 @@ import au.com.royalpay.payment.manage.merchants.core.ClientConfigService;
import au.com.royalpay.payment.manage.merchants.core.ClientInfoCacheSupport;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.merchants.core.ClientModifySupport;
import au.com.royalpay.payment.manage.merchants.entity.impls.ApproveEmailAuditModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.GreenChannelAuditModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.MerchantIdAuditModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.RefundAuditModify;
import au.com.royalpay.payment.manage.merchants.entity.impls.SwitchPermissionAuditModify;
import au.com.royalpay.payment.manage.notice.core.MailService;
import au.com.royalpay.payment.manage.signin.beans.TodoNotice;
import au.com.royalpay.payment.manage.signin.core.ManagerTodoNoticeProvider;
@ -582,20 +586,18 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
JSONObject update = new JSONObject();
int clientId = client.getIntValue("client_id");
String originSubMerchantId = client.getString("sub_merchant_id");
update.put("client_id", clientId);
String subMerchantId = subMerchantInfo.getString("sub_merchant_id");
WeChatPayConfig.Merchant availableMerchant = mpPaymentApi.determineMerchant(subMerchantId);
update.put("merchant_id", availableMerchant == null ? null : availableMerchant.getMerchantId());
update.put("sub_merchant_id", subMerchantId);
clientMapper.update(update);
clientModifySupport.processClientModify(
new MerchantIdAuditModify(manager, clientMoniker, subMerchantId, availableMerchant == null ? null : availableMerchant.getMerchantId()));
List<JSONObject> children = clientMapper.listChildClients(clientId);
for (JSONObject child : children) {
if (Objects.equals(child.getString("sub_merchant_id"), originSubMerchantId)) {
update.put("client_id", child.getIntValue("client_id"));
clientMapper.update(update);
clientModifySupport.processClientModify(
new MerchantIdAuditModify(manager, clientMoniker, subMerchantId, availableMerchant == null ? null : availableMerchant.getMerchantId()));
}
}
clientInfoCacheSupport.clearClientCache(clientId);
}
@Override
@ -617,6 +619,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client.getIntValue("source") == 5) {
client.put("source", 1);
}
clientMapper.update(client);
sendCommissionWechatMessage(client);// wxMessage
if (pass == 1) {
@ -650,11 +653,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client.getString("sub_merchant_id") == null || client.getString("sub_merchant_id").equals("")) {
throw new BadRequestException("该商户未设置微信 Sub Merchant ID!");
}
clientMapper.update(client);
clientModifySupport.processClientModify(new GreenChannelAuditModify(manager, clientMoniker, manager.getString("manager_id")));
saveClientAuditProcess(client.getIntValue("client_id"), 10, 1, "绿色通道申请通过", manager);
sendCommissionWechatMessage(client);
initAdminUserAndSendEmail(manager, clientMoniker, client);
clientInfoCacheSupport.clearClientCache(client.getIntValue("client_id"));
}
private void initAdminUserAndSendEmail(JSONObject manager, String clientMoniker, JSONObject client) {
@ -831,15 +833,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new BadRequestException("Client Not Complied yet!");
}
int clientId = client.getIntValue("client_id");
updateClientApproveEmailStatus(clientId, 1);
clientInfoCacheSupport.clearClientCache(clientId);
updateClientApproveEmailStatus(1, manager, clientMoniker);
}
private void updateClientApproveEmailStatus(int clientId, int status) {
JSONObject clientUpdate = new JSONObject();
clientUpdate.put("client_id", clientId);
clientUpdate.put("approve_email_send", status);
clientMapper.update(clientUpdate);
private void updateClientApproveEmailStatus(int status, JSONObject account, String client_moniker) {
clientModifySupport.processClientModify(new ApproveEmailAuditModify(account, client_moniker, status));
}
@Override
@ -862,7 +860,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
mailStatus = 2;
break;
}
updateClientApproveEmailStatus(client.getIntValue("client_id"), mailStatus);
updateClientApproveEmailStatus(mailStatus, null, null);
} else {
logger.debug("get mail status:" + emailId + "-- none");
// updateClientApproveEmailStatus(client.getIntValue("client_id"), 0);
@ -883,6 +881,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
checkOrgPermission(manager, client);
client.put(permissionKey, allow);
clientMapper.update(client);
clientModifySupport.processClientConfigModify(new SwitchPermissionAuditModify(manager,));
clientInfoCacheSupport.clearClientCache(client.getIntValue("client_id"));
}
@ -2151,7 +2151,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
file.put("last_update_by", manager.getString("display_name"));
}
JSONObject contract = clientsContractMapper.findByClientId(client.getIntValue("client_id"));
if (contract == null || now.compareTo(contract.getDate("expiry_date")) > 0 || !contract.getBoolean("has_sign") || existFile == null || existFile.isEmpty()) {
if (contract == null || now.compareTo(contract.getDate("expiry_date")) > 0 || !contract.getBoolean("has_sign") || existFile == null
|| existFile.isEmpty()) {
clientFilesMapper.save(file);
} else {
file.put("file_id", existFile.getString("file_id"));
@ -3262,24 +3263,34 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
// "\n" +
// "\n" +
// "\n" +
// "We would like to extend our warm gratitude to your business for your continued support of RoyalPay. Without our merchants we wouldn't be where we are today. \n" +
// "We would like to extend our warm gratitude to your business for your continued support of RoyalPay.
// Without our merchants we wouldn't be where we are today. \n" +
// "\n" +
// "\n" +
// "\n" +
// "RoyalPay has and always will be committed to complying with all Australian laws, rules and regulations. With our deep roots in China, we also work with all Chinese regulations simultaneously with Australia. Since our humble beginnings in 2016 we have worked with the ATO (Australian Tax Office) to make sure that we are in alignment with all tax requirements. \n" +
// "RoyalPay has and always will be committed to complying with all Australian laws, rules and
// regulations. With our deep roots in China, we also work with all Chinese regulations simultaneously
// with Australia. Since our humble beginnings in 2016 we have worked with the ATO (Australian Tax
// Office) to make sure that we are in alignment with all tax requirements. \n" +
// "\n" +
// "\n" +
// "\n" +
// "\n" +
// "During FY18 we entered negotiations with the ATO to file for GST exemptions for the part of surcharge fees. The ATO has recently advised that we have been unsuccessful in this bid. To ensure we comply with the ATO, we will need to adjust our current service agreements to be exclusionary of GST. \n" +
// "During FY18 we entered negotiations with the ATO to file for GST exemptions for the part of
// surcharge fees. The ATO has recently advised that we have been unsuccessful in this bid. To ensure we
// comply with the ATO, we will need to adjust our current service agreements to be exclusionary of GST.
// \n" +
// "\n" +
// "\n" +
// "\n" +
// "This will result in contractual changes to your agreement. However, your business may be eligible to claim this amount back depending on the tax relationship of your business. Please consult with your accounting team in relation to these changes. \n" +
// "This will result in contractual changes to your agreement. However, your business may be eligible to
// claim this amount back depending on the tax relationship of your business. Please consult with your
// accounting team in relation to these changes. \n" +
// "\n" +
// "\n" +
// "\n" +
// "If you have any questions related to this change please direct them to our Sales Management Team or your relevant BD officer.\n" +
// "If you have any questions related to this change please direct them to our Sales Management Team or
// your relevant BD officer.\n" +
// "\n" +
// "\n" +
// "\n" +
@ -3292,11 +3303,14 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
// "\n" +
// "\n" +
// "\n" +
// "感谢您选择RoyalPay。作为澳洲移动支付的先行者和领导者RoyalPay自2016年起就开始针对交易手续费这一澳洲目前空白的税务问题对接澳大利亚相关监管机构。作为市场上全新的支付模式这两年来我们不断地与相关机构探讨最为合适的监管法令应用同时澳洲的相应法律法规也在不断地完善来提供更全面的监管来营造更加稳定、健康、健全的金融市场。\n" +
// "感谢您选择RoyalPay。作为澳洲移动支付的先行者和领导者RoyalPay自2016年起就开始针对交易手续费这一澳洲目前空白的税务问题对接澳大利亚相关监管机构。作为市场上全新的支付模式这两年来我们不断地与相关机构探讨最为合适的监管法令应用同时澳洲的相应法律法规也在不断地完善来提供更全面的监管来营造更加稳定、健康、健全的金融市场。\n"
// +
// "\n" +
// "\n" +
// "\n" +
// "RoyalPay于近期正式收到澳洲监管机构的通知针对手续费Tax Free的申请和特殊税务条款考量做出了相应的回复目前澳洲市场上的移动支付扫码解决方案所产生的手续费部分的GST并不能享受Tax Free及部分减免的政策条款。我们已经替2018年前交易的商户补足了手续费部分的税金并应澳大利亚税务局ATO的要求进行了合同上手续费GST部分的相应调整。您也可咨询专业的会计师来申请您额外的手续费GST Return。感谢您的支持和理解愿我们一起共同努力塑造一个良好而有序的澳洲移动支付市场。\n" +
// "RoyalPay于近期正式收到澳洲监管机构的通知针对手续费Tax Free的申请和特殊税务条款考量做出了相应的回复目前澳洲市场上的移动支付扫码解决方案所产生的手续费部分的GST并不能享受Tax
// Free及部分减免的政策条款。我们已经替2018年前交易的商户补足了手续费部分的税金并应澳大利亚税务局ATO的要求进行了合同上手续费GST部分的相应调整。您也可咨询专业的会计师来申请您额外的手续费GST
// Return。感谢您的支持和理解愿我们一起共同努力塑造一个良好而有序的澳洲移动支付市场。\n" +
// "\n" +
// "\n" +
// "\n" +
@ -3304,7 +3318,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
// "\n" +
// "GST只针对手续费部分与商品价格无关\n" +
// "\n");
result.put("content", "<p class=\"p1\"><span style=\"font-size: 20px;\"></span></p><p class=\"p1\"><span style=\"font-size: 20px;\">Dear Valued Merchants,</span></p><p class=\"p2\"><span style=\"font-size: 20px;\"><br/></span></p><p class=\"p1\"><span style=\"font-size: 20px;\">We would like to extend our warm gratitude to your business for your continued support of RoyalPay. Without our merchants we wouldn&#39;t be where we are today.&nbsp;</span></p><p class=\"p2\"><span style=\"font-size: 20px;\"><br/></span></p><p class=\"p1\"><span style=\"font-size: 20px;\">RoyalPay has and always will be committed to complying with all Australian laws, rules and regulations. With our deep roots in China, we also work with all Chinese regulations simultaneously with Australia. Since our humble beginnings in 2016 we have worked with the ATO (Australian Tax Office) to make sure that we are in alignment with all tax requirements.&nbsp;</span></p><p class=\"p2\"><span style=\"font-size: 20px;\"><br/></span></p><p class=\"p1\"><span style=\"font-size: 20px;\"></span></p><p><span style=\"font-size: 20px;\">During FY18 we entered negotiations with the ATO to file for GST exemptions for the part of surcharge fees. The ATO has recently advised that we have been unsuccessful in this bid. To ensure we comply with the ATO, we will need to adjust our current service agreements to be exclusionary of GST.&nbsp;</span></p><p><br/></p><p><span style=\"font-size: 20px;\">This will result in contractual changes to your agreement. However, your business may be eligible to claim this amount back depending on the tax relationship of your business. Please consult with your accounting team in relation to these changes.&nbsp;</span></p><p><span style=\"font-size: 20px;\"><br/></span></p><p><span style=\"font-size: 20px;\">If you have any questions related to this change please direct them to our Sales Management Team or your relevant BD officer.</span><br/></p><p><br/></p><p><strong><span style=\"font-size: 20px;\">(note: GST is for the surcharge fee only, not related to the price of the goods.)</span></strong></p><p class=\"p1\"><br/></p><p class=\"p1\"><span style=\"font-size: 20px;\">尊敬的商户,<br/></span></p><p class=\"p2\"><span style=\"font-size: 20px;\"></span></p><p class=\"p2\"><span style=\"font-size: 20px;\"><br/></span></p><p class=\"p3\"><span style=\"font-size: 20px;\">感谢您选择RoyalPay。作为澳洲移动支付的先行者和领导者RoyalPay自2016年起就开始针对交易手续费这一澳洲目前空白的税务问题对接澳大利亚相关监管机构。作为市场上全新的支付模式这两年来我们不断地与相关机构探讨最为合适的监管法令应用同时澳洲的相应法律法规也在不断地完善来提供更全面的监管来营造更加稳定、健康、健全的金融市场。</span></p><p class=\"p2\"><span style=\"font-size: 20px;\"><br/></span></p><p class=\"p3\"><span style=\"font-size: 20px;\">RoyalPay于近期正式收到澳洲监管机构的通知针对手续费Tax Free的申请和特殊税务条款考量做出了相应的回复目前澳洲市场上的移动支付扫码解决方案所产生的手续费部分的GST并不能享受Tax Free及部分减免的政策条款。我们已经替2018年前交易的商户补足了手续费部分的税金并应澳大利亚税务局ATO的要求进行了合同上手续费GST部分的相应调整。您也可咨询专业的会计师来申请您额外的手续费GST Return。感谢您的支持和理解愿我们一起共同努力塑造一个良好而有序的澳洲移动支付市场。</span></p><p class=\"p2\"><span style=\"font-size: 20px;\"><br/></span></p><p class=\"p3\"><span style=\"font-size: 20px;\">有任何疑问,请随时联络我们的客服与公众号。</span></p><p class=\"p3\"><strong><span style=\"font-size: 20px;\">GST只针对手续费部分与商品价格无关</span></strong></p><p><br/></p>");
result.put("content",
"<p class=\"p1\"><span style=\"font-size: 20px;\"></span></p><p class=\"p1\"><span style=\"font-size: 20px;\">Dear Valued Merchants,</span></p><p class=\"p2\"><span style=\"font-size: 20px;\"><br/></span></p><p class=\"p1\"><span style=\"font-size: 20px;\">We would like to extend our warm gratitude to your business for your continued support of RoyalPay. Without our merchants we wouldn&#39;t be where we are today.&nbsp;</span></p><p class=\"p2\"><span style=\"font-size: 20px;\"><br/></span></p><p class=\"p1\"><span style=\"font-size: 20px;\">RoyalPay has and always will be committed to complying with all Australian laws, rules and regulations. With our deep roots in China, we also work with all Chinese regulations simultaneously with Australia. Since our humble beginnings in 2016 we have worked with the ATO (Australian Tax Office) to make sure that we are in alignment with all tax requirements.&nbsp;</span></p><p class=\"p2\"><span style=\"font-size: 20px;\"><br/></span></p><p class=\"p1\"><span style=\"font-size: 20px;\"></span></p><p><span style=\"font-size: 20px;\">During FY18 we entered negotiations with the ATO to file for GST exemptions for the part of surcharge fees. The ATO has recently advised that we have been unsuccessful in this bid. To ensure we comply with the ATO, we will need to adjust our current service agreements to be exclusionary of GST.&nbsp;</span></p><p><br/></p><p><span style=\"font-size: 20px;\">This will result in contractual changes to your agreement. However, your business may be eligible to claim this amount back depending on the tax relationship of your business. Please consult with your accounting team in relation to these changes.&nbsp;</span></p><p><span style=\"font-size: 20px;\"><br/></span></p><p><span style=\"font-size: 20px;\">If you have any questions related to this change please direct them to our Sales Management Team or your relevant BD officer.</span><br/></p><p><br/></p><p><strong><span style=\"font-size: 20px;\">(note: GST is for the surcharge fee only, not related to the price of the goods.)</span></strong></p><p class=\"p1\"><br/></p><p class=\"p1\"><span style=\"font-size: 20px;\">尊敬的商户,<br/></span></p><p class=\"p2\"><span style=\"font-size: 20px;\"></span></p><p class=\"p2\"><span style=\"font-size: 20px;\"><br/></span></p><p class=\"p3\"><span style=\"font-size: 20px;\">感谢您选择RoyalPay。作为澳洲移动支付的先行者和领导者RoyalPay自2016年起就开始针对交易手续费这一澳洲目前空白的税务问题对接澳大利亚相关监管机构。作为市场上全新的支付模式这两年来我们不断地与相关机构探讨最为合适的监管法令应用同时澳洲的相应法律法规也在不断地完善来提供更全面的监管来营造更加稳定、健康、健全的金融市场。</span></p><p class=\"p2\"><span style=\"font-size: 20px;\"><br/></span></p><p class=\"p3\"><span style=\"font-size: 20px;\">RoyalPay于近期正式收到澳洲监管机构的通知针对手续费Tax Free的申请和特殊税务条款考量做出了相应的回复目前澳洲市场上的移动支付扫码解决方案所产生的手续费部分的GST并不能享受Tax Free及部分减免的政策条款。我们已经替2018年前交易的商户补足了手续费部分的税金并应澳大利亚税务局ATO的要求进行了合同上手续费GST部分的相应调整。您也可咨询专业的会计师来申请您额外的手续费GST Return。感谢您的支持和理解愿我们一起共同努力塑造一个良好而有序的澳洲移动支付市场。</span></p><p class=\"p2\"><span style=\"font-size: 20px;\"><br/></span></p><p class=\"p3\"><span style=\"font-size: 20px;\">有任何疑问,请随时联络我们的客服与公众号。</span></p><p class=\"p3\"><strong><span style=\"font-size: 20px;\">GST只针对手续费部分与商品价格无关</span></strong></p><p><br/></p>");
result.put("title", "【Important重要】GST Modification Notice | 澳洲监管机构关于手续费GST调整问题通知\n");
}
}

@ -4,6 +4,7 @@ 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.stereotype.Service;
@ -24,10 +25,14 @@ public class ClientModifySupportImpl implements ClientModifySupport {
@Resource
private ClientConfigMapper clientConfigMapper;
@Override
public void processClientModify(ClientModify modify) {
int clientId = modify.doModify(merchantInfoProvider, clientConfigMapper, clientMapper);
int clientId = modify.doModify(merchantInfoProvider, clientMapper);
clientInfoCacheSupport.clearClientCache(clientId);
}
@Override
public void processClientConfigModify(ClientConfigModify clientConfigModify) {
clientConfigModify.doModify(merchantInfoProvider, clientConfigMapper);
}
}

@ -0,0 +1,89 @@
package au.com.royalpay.payment.manage.merchants.entity;
import au.com.royalpay.payment.manage.mappers.system.ClientConfigMapper;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
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) {
JSONObject client = merchantInfoProvider.getClientInfoByMoniker(clientMoniker);
JSONObject modifyResult = getModifyResult();
saveModifyHistory(client, modifyResult);
int clientId = client.getIntValue("client_id");
modifyResult.put("client_id", clientId);
clientConfigMapper.update(modifyResult);
return clientId;
}
private void saveModifyHistory(JSONObject client, JSONObject modifyResult) {
if (account == null) {
return;
}
boolean isManager = true;
Map<String, Object> beforeModify = modifyResult.keySet().stream().collect(Collectors.toMap(key -> key, client::get));
JSONObject modifyHistory = new JSONObject();
modifyHistory.put("client_id", client.getIntValue("client_id"));
modifyHistory.put("business", business());
if (StringUtils.isNotEmpty(account.getString("account_id"))) {
isManager = false;
}
if (StringUtils.isNotEmpty(account.getString("manager_id"))) {
isManager = true;
}
modifyHistory.put("user_type", manager == null ? "Merchant" : "Manager");
modifyHistory.put("user_id", manager == null ? account.getString("account_id") : manager.getString("manager_id"));
modifyHistory.put("username", manager == null ? account.getString("display_name") : manager.getString("display_name"));
modifyHistory.put("origin_data", JSON.toJSONString(beforeModify));
modifyHistory.put("new_data", modifyResult.toJSONString());
BufferedWriter out = null;
try {
// TODO: 2018/4/12 kira 文件地址
File file = new File("/Users/wangning/Desktop/asd.txt");
if (file == null) {
file.createNewFile();
}
out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file, true)));
out.write("asdasdasdasd" + "\r\n");
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}

@ -1,6 +1,5 @@
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.tools.merchants.core.MerchantInfoProvider;
@ -9,6 +8,11 @@ import com.alibaba.fastjson.JSONObject;
import org.springframework.transaction.annotation.Transactional;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Map;
import java.util.stream.Collectors;
@ -33,17 +37,17 @@ public abstract class ClientModify {
protected abstract JSONObject getModifyResult();
@Transactional
public int doModify(MerchantInfoProvider merchantInfoProvider, ClientConfigMapper clientConfigMapper, ClientMapper clientMapper) {
public int doModify(MerchantInfoProvider merchantInfoProvider, ClientMapper clientMapper) {
JSONObject client = merchantInfoProvider.getClientInfoByMoniker(clientMoniker);
JSONObject modifyResult = getModifyResult();
saveModifyHistory(clientConfigMapper, client, modifyResult);
saveModifyHistory(client, modifyResult);
int clientId = client.getIntValue("client_id");
modifyResult.put("client_id", clientId);
clientMapper.update(modifyResult);
return clientId;
}
private void saveModifyHistory(ClientConfigMapper clientConfigMapper, JSONObject client, JSONObject modifyResult) {
private void saveModifyHistory(JSONObject client, JSONObject modifyResult) {
Map<String, Object> beforeModify = modifyResult.keySet().stream().collect(Collectors.toMap(key -> key, client::get));
JSONObject modifyHistory = new JSONObject();
modifyHistory.put("client_id", client.getIntValue("client_id"));
@ -53,6 +57,24 @@ public abstract class ClientModify {
modifyHistory.put("username", manager == null ? account.getString("display_name") : manager.getString("display_name"));
modifyHistory.put("origin_data", JSON.toJSONString(beforeModify));
modifyHistory.put("new_data", modifyResult.toJSONString());
clientConfigMapper.save(modifyHistory);
BufferedWriter out = null;
try {
// TODO: 2018/4/12 kira 文件地址
File file = new File("/Users/wangning/Desktop/asd.txt");
if (file == null) {
file.createNewFile();
}
out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file, true)));
out.write("asdasdasdasd" + "\r\n");
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}

@ -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 ApproveEmailAuditModify extends ClientModify {
private int approve_email_send;
public ApproveEmailAuditModify(JSONObject account, String clientMoniker, int approve_email_send) {
super(account, null, 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,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 GreenChannelAuditModify extends ClientModify {
private String manager_id;
public GreenChannelAuditModify(JSONObject account, String clientMoniker, String manager_id) {
super(account, null, 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,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 MerchantIdAuditModify extends ClientModify {
private String sub_merchant_id;
private String merchant_id;
public MerchantIdAuditModify(JSONObject account, String clientMoniker, String sub_merchant_id, String merchant_id) {
super(account, null, 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;
}
}

@ -16,7 +16,7 @@ public class RefundAuditModify extends ClientModify {
@Override
protected String business() {
return "refund_audit";
return (enable?"打开":"关闭")+"refund_audit";
}
@Override

@ -0,0 +1,32 @@
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 SwitchPermissionAuditModify extends ClientModify {
private String key;
private boolean value;
public SwitchPermissionAuditModify(JSONObject manager, JSONObject account, String clientMoniker, String key, boolean value) {
super(manager, 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;
}
}
Loading…
Cancel
Save