|
|
|
@ -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 文件地址
|
|
|
|
|