wangning 7 years ago
parent 3a2b7356ca
commit e7817f5449

@ -115,7 +115,7 @@ public interface ClientManager {
void toggleAccountReceiveNoticeByOpenId(String openid, boolean enable);
@Transactional
void togglePayNotice(String clientMoniker, boolean enable);
void togglePayNotice(JSONObject account,String clientMoniker, boolean enable);
@Transactional
void changeRole(JSONObject manager, String clientMoniker, String accountId, int role);

@ -878,12 +878,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client == null) {
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
client.put(permissionKey, allow);
clientMapper.update(client);
clientModifySupport.processClientConfigModify(new SwitchPermissionAuditModify(manager,));
clientInfoCacheSupport.clearClientCache(client.getIntValue("client_id"));
clientModifySupport.processClientConfigModify(new SwitchPermissionAuditModify(manager,clientMoniker,permissionKey,allow));
}
@Override
@ -894,10 +889,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client == null) {
throw new NotFoundException("Client Not Exists");
}
JSONObject update = new JSONObject();
update.put("client_id", client.getIntValue("client_id"));
update.put("enable_" + channel.toLowerCase(), allow);
clientMapper.update(update);
clientModifySupport.processClientConfigModify(new SwitchPermissionAuditModify(manager,clientMoniker,"enable_" + channel.toLowerCase(),allow));
logger.info(manager.getString("display_name") + "(" + manager.getString("manager_id") + ") switched client " + clientMoniker + " channel "
+ channel + " to " + allow);
return;
@ -1065,11 +1057,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
@Override
public void togglePayNotice(String clientMoniker, boolean enable) {
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 SwitchPermissionAuditModify(account,clientMoniker,"enable_pay_notice", enable));
clientInfoCacheSupport.clearClientCache(partner.getIntValue("client_id"));
}

@ -50,20 +50,20 @@ public abstract class ClientConfigModify {
if (account == null) {
return;
}
boolean isManager = true;
boolean isPartner = 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;
isPartner = true;
}
if (StringUtils.isNotEmpty(account.getString("manager_id"))) {
isManager = true;
isPartner = false;
}
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("user_type", isPartner ? "Merchant" : "Manager");
modifyHistory.put("user_id", isPartner ? account.getString("account_id") : account.getString("manager_id"));
modifyHistory.put("username", isPartner ? account.getString("display_name") : account.getString("display_name"));
modifyHistory.put("origin_data", JSON.toJSONString(beforeModify));
modifyHistory.put("new_data", modifyResult.toJSONString());

@ -6,6 +6,7 @@ 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;
@ -21,13 +22,11 @@ import java.util.stream.Collectors;
*/
public abstract class ClientModify {
private JSONObject manager;
private JSONObject account;
private String clientMoniker;
public ClientModify(JSONObject manager, JSONObject account, String clientMoniker) {
this.manager = manager;
public ClientModify(JSONObject account, String clientMoniker) {
this.account = account;
this.clientMoniker = clientMoniker;
}
@ -48,16 +47,25 @@ public abstract class ClientModify {
}
private void saveModifyHistory(JSONObject client, JSONObject modifyResult) {
if (account == null) {
return;
}
boolean isPartner = 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());
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"));
if (StringUtils.isNotEmpty(account.getString("account_id"))) {
isPartner = true;
}
if (StringUtils.isNotEmpty(account.getString("manager_id"))) {
isPartner = false;
}
modifyHistory.put("user_type", isPartner ? "Merchant" : "Manager");
modifyHistory.put("user_id", isPartner ? account.getString("account_id") : account.getString("manager_id"));
modifyHistory.put("username", isPartner ? account.getString("display_name") : account.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 文件地址

@ -11,7 +11,7 @@ public class ApproveEmailAuditModify extends ClientModify {
private int approve_email_send;
public ApproveEmailAuditModify(JSONObject account, String clientMoniker, int approve_email_send) {
super(account, null, clientMoniker);
super(account, clientMoniker);
this.approve_email_send = approve_email_send;
}

@ -13,7 +13,7 @@ public class GreenChannelAuditModify extends ClientModify {
private String manager_id;
public GreenChannelAuditModify(JSONObject account, String clientMoniker, String manager_id) {
super(account, null, clientMoniker);
super(account, clientMoniker);
this.manager_id = manager_id;
}

@ -12,7 +12,7 @@ public class MerchantIdAuditModify extends ClientModify {
private String merchant_id;
public MerchantIdAuditModify(JSONObject account, String clientMoniker, String sub_merchant_id, String merchant_id) {
super(account, null, clientMoniker);
super(account, clientMoniker);
this.sub_merchant_id = sub_merchant_id;
this.merchant_id = merchant_id;

@ -10,7 +10,7 @@ public class RefundAuditModify extends ClientModify {
private boolean enable;
public RefundAuditModify(JSONObject account, String clientMoniker, boolean enable) {
super(null, account, clientMoniker);
super( account, clientMoniker);
this.enable = enable;
}

@ -1,18 +1,18 @@
package au.com.royalpay.payment.manage.merchants.entity.impls;
import au.com.royalpay.payment.manage.merchants.entity.ClientModify;
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 SwitchPermissionAuditModify extends ClientModify {
public class SwitchPermissionAuditModify extends ClientConfigModify {
private String key;
private boolean value;
public SwitchPermissionAuditModify(JSONObject manager, JSONObject account, String clientMoniker, String key, boolean value) {
super(manager, account, clientMoniker);
public SwitchPermissionAuditModify(JSONObject account, String clientMoniker, String key, boolean value) {
super(account, clientMoniker);
this.key = key;
this.value = value;
}

@ -13,7 +13,6 @@ import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery;
import au.com.royalpay.payment.manage.tradelog.core.TradeLogService;
import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.connections.mpsupport.beans.WxOauthType;
import au.com.royalpay.payment.tools.env.SysConfigManager;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.http.HttpUtils;
@ -219,7 +218,7 @@ public class PartnerViewController {
@PartnerMapping(value = "/pay_notice", method = RequestMethod.PUT, roles = PartnerRole.ADMIN)
@ResponseBody
public void togglePayNotice(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account, @RequestBody JSONObject enable) {
clientManager.togglePayNotice(account.getString("client_moniker"), enable.getBooleanValue("enable"));
clientManager.togglePayNotice(account,account.getString("client_moniker"), enable.getBooleanValue("enable"));
}
@PartnerMapping(value = "/audit_refund", method = RequestMethod.PUT, roles = PartnerRole.ADMIN)

Loading…
Cancel
Save