add 合同client信息返还

master
luoyang 5 years ago
parent ace8e86a09
commit 8cb8c5e027

@ -463,5 +463,7 @@ public interface ClientManager {
JSONObject getComplianceFiles(JSONObject account);
JSONObject getClientInfoByAggree(JSONObject account);
JSONObject getComplianceFilesForBD(JSONObject account);
}

@ -1999,6 +1999,79 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
return file;
}
@Override
public JSONObject getClientInfoByAggree(JSONObject account) {
JSONObject client = getClientInfo(account.getIntValue("client_id"));
if (client == null) {
throw new InvalidShortIdException();
}
JSONObject result = new JSONObject();
String address = client.getString("address").trim();
if (address.contains(",")) {
result.put("address", address.substring(0, address.lastIndexOf(",")).trim());
result.put("address_sub", address.substring(address.lastIndexOf(",") + 1).trim());
}
if (client.getString("acn") != null && !client.getString("acn").equals("")) {
result.put("acn_type", "ACN: (" + client.getString("acn") + ")");
result.put("company_name_acn", client.getString("company_name") + " (ACN " + client.getString("acn") + ")");
} else {
result.put("acn_type", "ABN: (" + client.getString("abn") + ")");
result.put("company_name_acn", client.getString("company_name") + " (ABN " + client.getString("abn") + ")");
}
JSONObject weChatRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Wechat");
if (weChatRate == null) {
throw new BadRequestException("The Partner's Rate is not config!");
}
result.put("wechat_rate", weChatRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
result.put("clean", "T+" + weChatRate.getString("clean_days"));
result.put("clean_days", weChatRate.getString("clean_days"));
try {
JSONObject alipayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Alipay");
if (alipayRate != null) {
result.put("alipay_rate", alipayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
}
JSONObject bestPayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Bestpay");
if (bestPayRate != null) {
result.put("bestpay_rate", bestPayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
}
JSONObject jdRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "jd");
if (jdRate != null) {
result.put("jd_rate", jdRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
}
JSONObject alipayOnlineRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "AlipayOnline");
if (alipayOnlineRate != null) {
result.put("alipay_online_rate", alipayOnlineRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
}
JSONObject cbBankPayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "CB_BankPay");
if (cbBankPayRate != null) {
result.put("cbbank_rate", cbBankPayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
}
} catch (Exception ignored) {
throw new BadRequestException("Merchant Rate Not Configure");
}
JSONObject bankAccount = getBankAccountByClientId(client.getIntValue("client_id"));
if (bankAccount == null || bankAccount.size() <= 0) {
throw new BadRequestException("The Partner's Account is not config!");
}
result.put("bank", bankAccount.getString("bank"));
result.put("bsb_no", bankAccount.getString("bsb_no"));
result.put("account_no", bankAccount.getString("account_no"));
result.put("account_name", bankAccount.getString("account_name"));
String start_date = DateFormatUtils.format(new Date(), "dd/MM/yyyy");
result.put("start_date", start_date);
Date endDate = TimeZoneUtils.nextYearByCurrDay();
String end_date = DateFormatUtils.format(endDate, "dd/MM/yyyy");
result.put("end_date", end_date);
return result;
}
@Override
public JSONObject getComplianceFilesForBD(JSONObject account) {
JSONObject client = getClientInfo(account.getIntValue("client_id"));

@ -519,6 +519,13 @@ public class PartnerViewController {
return clientManager.getComplianceFiles(account);
}
@PartnerMapping(value = "/aggregateFile/client_info", method = RequestMethod.GET)
@ResponseBody
public JSONObject getClientInfoByAggree(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account) {
return clientManager.getClientInfoByAggree(account);
}
/* @PartnerMapping(value = "/{clientMoniker}/clientViewFiles", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.BD_USER, ManagerRole.SERVANT})
public JSONObject getAuthFiles(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return clientManager.getAllAuthFiles(manager, clientMoniker);

Loading…
Cancel
Save