Merge remote-tracking branch 'origin/develop' into develop

master
eason.qian 7 years ago
commit 796589c8d6

@ -255,6 +255,8 @@ public interface ClientManager {
void getAggregateAgreeFile(String clientMoniker, JSONObject manager,boolean renewal) throws Exception; void getAggregateAgreeFile(String clientMoniker, JSONObject manager,boolean renewal) throws Exception;
void getNewAggregateAgreeFile(String clientMoniker, JSONObject manager,boolean renewal) throws Exception;
void temporaryExportPdf(String clientMoniker, JSONObject manager, HttpServletResponse httpResponse) throws Exception; void temporaryExportPdf(String clientMoniker, JSONObject manager, HttpServletResponse httpResponse) throws Exception;
void importAgreeFile(String clientMoniker, JSONObject manager, String sourceFile,boolean renewal); void importAgreeFile(String clientMoniker, JSONObject manager, String sourceFile,boolean renewal);

@ -1865,7 +1865,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
ByteArrayOutputStream bos = pdu.templetPdfBos(file); ByteArrayOutputStream bos = pdu.templetPdfBos(file);
stream = new ByteArrayInputStream(bos.toByteArray()); stream = new ByteArrayInputStream(bos.toByteArray());
JSONObject fileRes = attachmentClient.uploadFile(stream, clientMoniker + "_agreement.pdf", false); JSONObject fileRes = attachmentClient.uploadFile(stream, clientMoniker + "_agreement.pdf", false);
importAgreeFile(clientMoniker, manager, fileRes.getString("url"),false); importAgreeFile(clientMoniker, manager, fileRes.getString("url"), false);
} catch (Exception e) { } catch (Exception e) {
logger.error("合同制作出现问题:", e); logger.error("合同制作出现问题:", e);
} finally { } finally {
@ -1875,7 +1875,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Override @Override
@Transactional @Transactional
public void getAggregateAgreeFile(String clientMoniker, JSONObject manager,boolean renewal) throws Exception { public void getAggregateAgreeFile(String clientMoniker, JSONObject manager, boolean renewal) throws Exception {
JSONObject client = getClientInfoByMoniker(clientMoniker); JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) { if (client == null) {
throw new InvalidShortIdException(); throw new InvalidShortIdException();
@ -1893,27 +1893,26 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
client.put("company_name_acn", client.getString("company_name") + " (ABN " + client.getString("abn") + ")"); client.put("company_name_acn", client.getString("company_name") + " (ABN " + client.getString("abn") + ")");
} }
// List<JSONObject> clientRate = clientRateMapper.latestConfig(client.getIntValue("client_id"), null); // List<JSONObject> clientRate = clientRateMapper.latestConfig(client.getIntValue("client_id"), null);
// if (CollectionUtils.isEmpty(clientRate)) { // if (CollectionUtils.isEmpty(clientRate)) {
// throw new BadRequestException("The Partner's Rate is not config!"); // throw new BadRequestException("The Partner's Rate is not config!");
// } // }
// clientRate.forEach((p) -> { // clientRate.forEach((p) -> {
// String rate_name = p.getString("rate_name"); // String rate_name = p.getString("rate_name");
// if ("Wechat".equals(rate_name)) { // if ("Wechat".equals(rate_name)) {
// client.put("wechat_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); // client.put("wechat_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
// client.put("clean", "T+" + p.getString("clean_days")); // client.put("clean", "T+" + p.getString("clean_days"));
// client.put("clean_days", p.getString("clean_days")); // client.put("clean_days", p.getString("clean_days"));
// } else if ("Alipay".equals(rate_name)) { // } else if ("Alipay".equals(rate_name)) {
// client.put("alipay_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); // client.put("alipay_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
// } else if ("Bestpay".equals(rate_name)) { // } else if ("Bestpay".equals(rate_name)) {
// client.put("bestpay_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); // client.put("bestpay_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
// } else if ("jd".equals(rate_name)) { // } else if ("jd".equals(rate_name)) {
// client.put("jd_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); // client.put("jd_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
// } else if ("AlipayOnline".equals(rate_name)) { // } else if ("AlipayOnline".equals(rate_name)) {
// client.put("alipay_online_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); // client.put("alipay_online_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
// } // }
// }); // });
JSONObject weChatRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Wechat"); JSONObject weChatRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Wechat");
if (weChatRate == null) { if (weChatRate == null) {
@ -1966,7 +1965,75 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
InputStream stream = new ByteArrayInputStream(bos.toByteArray()); InputStream stream = new ByteArrayInputStream(bos.toByteArray());
JSONObject fileRes = attachmentClient.uploadFile(stream, clientMoniker + "_" + System.currentTimeMillis() + "_agreement.pdf", false); JSONObject fileRes = attachmentClient.uploadFile(stream, clientMoniker + "_" + System.currentTimeMillis() + "_agreement.pdf", false);
if (fileRes != null) { if (fileRes != null) {
importAgreeFile(clientMoniker, manager, fileRes.getString("url"),renewal); importAgreeFile(clientMoniker, manager, fileRes.getString("url"), renewal);
}
stream.close();
} catch (Exception e) {
logger.error("合同制作出现问题:", e);
}
}
@Override
@Transactional
public void getNewAggregateAgreeFile(String clientMoniker, JSONObject manager, boolean renewal) throws Exception {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
String address = client.getString("address").trim();
if (address.contains(",")) {
client.put("address", address.substring(0, address.lastIndexOf(",")).trim());
client.put("address_sub", address.substring(address.lastIndexOf(",") + 1).trim());
}
if (client.getString("acn") != null && !client.getString("acn").equals("")) {
client.put("acn_type", "ACN: (" + client.getString("acn") + ")");
client.put("company_name_acn", client.getString("company_name") + " (ACN " + client.getString("acn") + ")");
} else {
client.put("acn_type", "ABN: (" + client.getString("abn") + ")");
client.put("company_name_acn", client.getString("company_name") + " (ABN " + client.getString("abn") + ")");
}
List<JSONObject> clientRate = clientRateMapper.latestConfig(client.getIntValue("client_id"), null);
if (CollectionUtils.isEmpty(clientRate)) {
throw new BadRequestException("The Partner's Rate is not config!");
}
clientRate.forEach((p) -> {
String rate_name = p.getString("rate_name");
if ("Wechat".equals(rate_name)) {
client.put("wechat_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
client.put("clean", "T+" + p.getString("clean_days"));
client.put("clean_days", p.getString("clean_days"));
} else if ("Alipay".equals(rate_name)) {
client.put("alipay_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
} else if ("Bestpay".equals(rate_name)) {
client.put("bestpay_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
} else if ("jd".equals(rate_name)) {
client.put("jd_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
} else if ("AlipayOnline".equals(rate_name)) {
client.put("alipay_online_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN));
}
});
JSONObject account = getBankAccountByClientId(client.getIntValue("client_id"));
if (account == null || account.size() <= 0) {
throw new BadRequestException("The Partner's Account is not config!");
}
client.put("bank", account.getString("bank"));
client.put("bsb_no", account.getString("bsb_no"));
client.put("account_no", account.getString("account_no"));
client.put("account_name", account.getString("account_name"));
String start_date = DateFormatUtils.format(new Date(), "dd/MM/yyyy");
client.put("start_date", start_date);
PdfUtils pdu = new PdfUtils();
pdu.setTemplatePdfPath(aggregateAgreetemplatePdfPath);
pdu.setPdfTemplate(client);
try {
File file = new File(clientMoniker + "_agreement.pdf");
ByteArrayOutputStream bos = pdu.templetPdfBos(file);
InputStream stream = new ByteArrayInputStream(bos.toByteArray());
JSONObject fileRes = attachmentClient.uploadFile(stream, clientMoniker + "_" + System.currentTimeMillis() + "_agreement.pdf", false);
if (fileRes != null) {
importAgreeFile(clientMoniker, manager, fileRes.getString("url"), renewal);
} }
stream.close(); stream.close();
} catch (Exception e) { } catch (Exception e) {
@ -2052,7 +2119,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Override @Override
@Transactional @Transactional
public void importAgreeFile(String clientMoniker, JSONObject manager, String sourceFile,boolean renewal) { public void importAgreeFile(String clientMoniker, JSONObject manager, String sourceFile, boolean renewal) {
JSONObject client = getClientInfoByMoniker(clientMoniker); JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) { if (client == null) {
throw new InvalidShortIdException(); throw new InvalidShortIdException();
@ -2081,7 +2148,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
file.put("file_id", existFile.getString("file_id")); file.put("file_id", existFile.getString("file_id"));
clientFilesMapper.update(file); clientFilesMapper.update(file);
} }
if(!renewal) { if (!renewal) {
client.put("open_status", 2); client.put("open_status", 2);
clientMapper.update(client); clientMapper.update(client);
} }
@ -2598,22 +2665,22 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Override @Override
@Transactional @Transactional
public void changeManualSettle(int client_id, boolean manual_settle,String operator_id,int type,String operation) { public void changeManualSettle(int client_id, boolean manual_settle, String operator_id, int type, String operation) {
JSONObject client = getClientInfo(client_id); JSONObject client = getClientInfo(client_id);
if(client==null){ if (client == null) {
throw new BadRequestException("merchant not found"); throw new BadRequestException("merchant not found");
} }
JSONObject record = new JSONObject(); JSONObject record = new JSONObject();
record.put("client_id",client_id); record.put("client_id", client_id);
record.put("manual_settle",manual_settle); record.put("manual_settle", manual_settle);
clientMapper.update(record); clientMapper.update(record);
JSONObject actClientLog = new JSONObject(); JSONObject actClientLog = new JSONObject();
actClientLog.put("client_id",client_id); actClientLog.put("client_id", client_id);
actClientLog.put("operator_id",operator_id); actClientLog.put("operator_id", operator_id);
actClientLog.put("operation",operation); actClientLog.put("operation", operation);
actClientLog.put("create_time",new Date()); actClientLog.put("create_time", new Date());
actClientLog.put("operator_type",type); actClientLog.put("operator_type", type);
clientsOperationLogMapper.save(actClientLog); clientsOperationLogMapper.save(actClientLog);
clientInfoCacheSupport.clearClientCache(client_id); clientInfoCacheSupport.clearClientCache(client_id);
@ -3173,38 +3240,47 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
} }
@Override @Override
public JSONObject getCheckClientInfo(int client_id,String account_id) { public JSONObject getCheckClientInfo(int client_id, String account_id) {
JSONObject result = clientContractService.getClientContractExpire(client_id); JSONObject result = clientContractService.getClientContractExpire(client_id);
JSONObject account = clientAccountMapper.findById(account_id); JSONObject account = clientAccountMapper.findById(account_id);
boolean expire = result.getBoolean("rate_expire"); boolean expire = result.getBoolean("rate_expire");
boolean waring = result.getBoolean("rate_waring"); boolean waring = result.getBoolean("rate_waring");
boolean old_contract = result.getBoolean("old_contract");
if (PartnerRole.getRole(account.getIntValue("role")) == PartnerRole.CASHIER) { if (PartnerRole.getRole(account.getIntValue("role")) == PartnerRole.CASHIER) {
result.put("is_ordinary", true); result.put("is_ordinary", true);
if (!expire && waring) { if (!expire && waring) {
String[] key = { result.getString("expire_days") }; String[] key = { result.getString("expire_days") };
result.put("contract_info", editContractOrdinaryWaring(key, messageSource.getMessage("sys.contract.ordinary.waring", null, RequestEnvironment.getLocale()))); result.put("contract_info",
editContractOrdinaryWaring(key, messageSource.getMessage("sys.contract.ordinary.waring", null, RequestEnvironment.getLocale())));
} }
if (expire) { if (expire) {
result.put("contract_info", messageSource.getMessage("sys.contract.ordinary.info", null, RequestEnvironment.getLocale())); result.put("contract_info", messageSource.getMessage("sys.contract.ordinary.info", null, RequestEnvironment.getLocale()));
} }
return result; if (old_contract) {
result.put("contract_info", messageSource.getMessage("contract.old.waring", null, RequestEnvironment.getLocale()));
}
} else { } else {
result.put("is_ordinary", false); result.put("is_ordinary", false);
if (!expire && waring) { if (!expire && waring) {
String[] key = { result.getString("expire_days") }; String[] key = { result.getString("expire_days") };
result.put("contract_info", editContractOrdinaryWaring(key,messageSource.getMessage("sys.contract.waring", null, RequestEnvironment.getLocale()))); result.put("contract_info",
editContractOrdinaryWaring(key, messageSource.getMessage("sys.contract.waring", null, RequestEnvironment.getLocale())));
} }
if (expire) { if (expire) {
result.put("contract_info", messageSource.getMessage("sys.contract.info", null, RequestEnvironment.getLocale())); result.put("contract_info", messageSource.getMessage("sys.contract.info", null, RequestEnvironment.getLocale()));
} }
JSONObject file = clientContractService.getOrGenerateSourceAgreement(account.getIntValue("client_id"),"pc"); if (old_contract) {
if(file!=null){ result.put("contract_info", messageSource.getMessage("contract.old.waring", null, RequestEnvironment.getLocale()));
}
}
JSONObject file = clientContractService.getOrGenerateSourceAgreement(account.getIntValue("client_id"), "pc");
if (file != null) {
result.put("file_url", file.getString("file_value")); result.put("file_url", file.getString("file_value"));
}else { } else {
result.put("file_url",""); result.put("file_url", "");
} }
return result; return result;
}
} }
@ -3213,6 +3289,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
return ""; return "";
} }
for (int i = 0; i < key.length; i++) { for (int i = 0; i < key.length; i++) {
if (key[i] == null) {
return "";
}
sourceStr = sourceStr.replace("{" + i + "}", key[i]); sourceStr = sourceStr.replace("{" + i + "}", key[i]);
} }
return sourceStr; return sourceStr;

@ -46,7 +46,7 @@ public class ClientContractServiceImpl implements ClientContractService {
@Override @Override
@Transactional @Transactional
public JSONObject getOrGenerateSourceAgreement(int client_id,String channel) { public JSONObject getOrGenerateSourceAgreement(int client_id, String channel) {
JSONObject client = clientManager.getClientInfo(client_id); JSONObject client = clientManager.getClientInfo(client_id);
if (client == null) { if (client == null) {
throw new NotFoundException("merchant not found"); throw new NotFoundException("merchant not found");
@ -54,19 +54,19 @@ public class ClientContractServiceImpl implements ClientContractService {
JSONObject expireInfo = getClientContractExpire(client_id); JSONObject expireInfo = getClientContractExpire(client_id);
JSONObject contract = clientsContractMapper.findByClientId(client_id); JSONObject contract = clientsContractMapper.findByClientId(client_id);
Date now = new Date(); Date now = new Date();
if (expireInfo.getBoolean("rate_waring") && (contract == null || now.compareTo(contract.getDate("expiry_date")) > 0)) { if ((expireInfo.getBoolean("rate_waring")||expireInfo.getBoolean("old_contract")) && (contract == null || now.compareTo(contract.getDate("expiry_date")) > 0)) {
try { try {
clientManager.getAggregateAgreeFile(client.getString("client_moniker"), null,true); clientManager.getNewAggregateAgreeFile(client.getString("client_moniker"), null, true);
} catch (Exception e) { } catch (Exception e) {
logger.info("App generate PDF failed"); logger.info("App generate PDF failed");
throw new ServerErrorException("System error"); throw new ServerErrorException("System error");
} }
List<JSONObject> files = clientFilesMapper.findFileByClientAndType(client_id, "source_agree_file"); List<JSONObject> files = clientFilesMapper.findFileByClientAndType(client_id, "source_agree_file");
saveContract(client_id, now,channel); saveContract(client_id, now, channel);
return files.get(0); return files.get(0);
} else { } else {
List<JSONObject> files = clientFilesMapper.findFileByClientAndType(client_id, "source_agree_file"); List<JSONObject> files = clientFilesMapper.findFileByClientAndType(client_id, "source_agree_file");
if(!CollectionUtils.isEmpty(files)) { if (!CollectionUtils.isEmpty(files)) {
JSONObject file = files.get(0); JSONObject file = files.get(0);
if (expireInfo.getBoolean("rate_expire")) { if (expireInfo.getBoolean("rate_expire")) {
contract.put("create_time", now); contract.put("create_time", now);
@ -80,7 +80,7 @@ public class ClientContractServiceImpl implements ClientContractService {
} }
private void saveContract(int client_id, Date now,String channel) { private void saveContract(int client_id, Date now, String channel) {
JSONObject newContract = new JSONObject(); JSONObject newContract = new JSONObject();
newContract.put("create_time", now); newContract.put("create_time", now);
newContract.put("expiry_date", DateUtils.addYears(now, 1)); newContract.put("expiry_date", DateUtils.addYears(now, 1));
@ -92,7 +92,7 @@ public class ClientContractServiceImpl implements ClientContractService {
@Override @Override
@Transactional @Transactional
public void confirmSourceAgreement(int client_id,String account_id,String channel) { public void confirmSourceAgreement(int client_id, String account_id, String channel) {
JSONObject client = clientManager.getClientInfo(client_id); JSONObject client = clientManager.getClientInfo(client_id);
if (client == null) { if (client == null) {
throw new NotFoundException("merchant not found"); throw new NotFoundException("merchant not found");
@ -100,48 +100,49 @@ public class ClientContractServiceImpl implements ClientContractService {
JSONObject rateExpire = getClientContractExpire(client_id); JSONObject rateExpire = getClientContractExpire(client_id);
boolean expire = rateExpire.getBoolean("rate_expire"); boolean expire = rateExpire.getBoolean("rate_expire");
boolean waring = rateExpire.getBoolean("rate_waring"); boolean waring = rateExpire.getBoolean("rate_waring");
boolean old_contract = rateExpire.getBoolean("old_contract");
JSONObject contract = clientsContractMapper.findByClientId(client_id); JSONObject contract = clientsContractMapper.findByClientId(client_id);
if (contract == null) { if (contract == null) {
throw new BadRequestException("generate contract first"); throw new BadRequestException("generate contract first");
} }
if(contract.getBoolean("has_sign")){ if (contract.getBoolean("has_sign")) {
return; return;
} }
Date now = new Date(); Date now = new Date();
JSONObject account = clientAccountMapper.findById(account_id); JSONObject account = clientAccountMapper.findById(account_id);
contract.put("has_sign", 1); contract.put("has_sign", 1);
contract.put("sign_account_id",account_id); contract.put("sign_account_id", account_id);
contract.put("sign_channel",channel); contract.put("sign_channel", channel);
contract.put("confirm_time",now); contract.put("confirm_time", now);
contract.put("signatory",account.getString("display_name")); contract.put("signatory", account.getString("display_name"));
clientsContractMapper.update(contract); clientsContractMapper.update(contract);
List<JSONObject> rateInfo = clientRateMapper.minExpiryTime(client_id, null); List<JSONObject> rateInfo = clientRateMapper.minExpiryTime(client_id, null);
if(expire){ if (expire || old_contract) {
rateInfo.forEach((p)->{ rateInfo.forEach((p) -> {
p.remove("client_rate_id"); p.remove("client_rate_id");
p.put("create_time",now); p.put("create_time", now);
p.put("active_time",now); p.put("active_time", now);
p.put("update_time",now); p.put("update_time", now);
p.put("manager_id","0"); p.put("manager_id", "0");
p.put("expiry_time",DateUtils.addYears(now,1)); p.put("expiry_time", DateUtils.addYears(now, 1));
p.put("manager_name","merchant_"+account_id+"_"+account.getString("display_name")); p.put("manager_name", "merchant_" + account_id + "_" + account.getString("display_name"));
clientRateMapper.saveRate(p); clientRateMapper.saveRate(p);
}); });
} }
if(!expire && waring){ if (!expire && waring && !old_contract) {
rateInfo.forEach((p)->{ rateInfo.forEach((p) -> {
p.remove("client_rate_id"); p.remove("client_rate_id");
p.put("create_time",now); p.put("create_time", now);
p.put("manager_id","0"); p.put("manager_id", "0");
p.put("update_time",now); p.put("update_time", now);
p.put("manager_name","merchant_"+account_id+"_"+account.getString("display_name")); p.put("manager_name", "merchant_" + account_id + "_" + account.getString("display_name"));
p.put("active_time",DateUtils.addDays(p.getDate("expiry_time"),1)); p.put("active_time", DateUtils.addDays(p.getDate("expiry_time"), 1));
p.put("expiry_time",DateUtils.addYears(p.getDate("active_time"),1)); p.put("expiry_time", DateUtils.addYears(p.getDate("active_time"), 1));
clientRateMapper.saveRate(p); clientRateMapper.saveRate(p);
}); });
} }
clientManager.setClientTaxInSurcharge(client.getString("client_moniker"),false); clientManager.setClientTaxInSurcharge(client.getString("client_moniker"), false);
} }
@Override @Override
@ -163,10 +164,11 @@ public class ClientContractServiceImpl implements ClientContractService {
JSONObject defaultResult = new JSONObject(); JSONObject defaultResult = new JSONObject();
defaultResult.put("rate_expire", false); defaultResult.put("rate_expire", false);
defaultResult.put("rate_waring", false); defaultResult.put("rate_waring", false);
defaultResult.put("old_contract",false); defaultResult.put("old_contract", false);
if (sysconfig!=null && !sysconfig.getBoolean("sys_new_contract_on")) { if (sysconfig != null && !sysconfig.getBoolean("sys_new_contract_on")) {
return defaultResult; return defaultResult;
} }
List<JSONObject> rateInfo = clientRateMapper.minExpiryTime(client_id, null); List<JSONObject> rateInfo = clientRateMapper.minExpiryTime(client_id, null);
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
if (CollectionUtils.isEmpty(rateInfo)) { if (CollectionUtils.isEmpty(rateInfo)) {
@ -176,43 +178,54 @@ public class ClientContractServiceImpl implements ClientContractService {
} }
result.put("rate_expire", false); result.put("rate_expire", false);
result.put("rate_waring", false); result.put("rate_waring", false);
result.put("old_contract", false);
Date now = new Date(); Date now = new Date();
JSONObject contract = clientsContractMapper.findByClientId(client_id); JSONObject contract = clientsContractMapper.findByClientId(client_id);
if (contract != null && contract.getDate("expiry_date").compareTo(now) > 0 && contract.getBoolean("has_sign")) { if (contract != null && contract.getDate("expiry_date").compareTo(now) > 0 && contract.getBoolean("has_sign")) {
return result; return result;
} }
int waringDays = sysConfigManager.getSysConfig().getIntValue("rate_warning_days"); int waringDays = sysconfig.getIntValue("rate_warning_days");
Map<String,JSONObject> filterMap = new HashMap<>(); Map<String, JSONObject> filterMap = new HashMap<>();
rateInfo.forEach((p)->{ rateInfo.forEach((p) -> {
String key = p.getString("rate_name"); String key = p.getString("rate_name");
JSONObject tmp = filterMap.get(key); JSONObject tmp = filterMap.get(key);
if(tmp==null){ if (tmp == null) {
filterMap.put(key,p); filterMap.put(key, p);
}else { } else {
if(tmp.getDate("expiry_time").compareTo(p.getDate("expiry_time"))<0){ if (tmp.getDate("expiry_time").compareTo(p.getDate("expiry_time")) < 0) {
filterMap.put(key,p); filterMap.put(key, p);
} }
} }
}); });
for (JSONObject p : filterMap.values()) { for (JSONObject p : filterMap.values()) {
if (now.compareTo(DateUtils.addDays(p.getDate("expiry_time"),1)) > -1) { if (now.compareTo(DateUtils.addDays(p.getDate("expiry_time"), 1)) > -1) {
result.put("rate_expire", true); result.put("rate_expire", true);
} }
if (DateUtils.addDays(now, waringDays).compareTo(DateUtils.addDays(p.getDate("expiry_time"),1)) > -1) { if (DateUtils.addDays(now, waringDays).compareTo(DateUtils.addDays(p.getDate("expiry_time"), 1)) > -1) {
int expireDay = 0; int expireDay = 0;
long expireSS = (DateUtils.addDays(p.getDate("expiry_time"),1).getTime()-now.getTime()); long expireSS = (DateUtils.addDays(p.getDate("expiry_time"), 1).getTime() - now.getTime());
expireDay = (int)expireSS/(1000*60*60*24); expireDay = (int) expireSS / (1000 * 60 * 60 * 24);
if(expireSS%(1000*60*60*24)>1){ if (expireSS % (1000 * 60 * 60 * 24) > 1) {
++expireDay; ++expireDay;
} }
result.put("expire_days",expireDay); result.put("expire_days", expireDay);
result.put("rate_waring", true); result.put("rate_waring", true);
} }
} }
if(!result.getBoolean("rate_waring") && !result.getBoolean("rate_expire")){
List<JSONObject> files = clientFilesMapper.findFileByClientAndType(client_id, "source_agree_file");
if (CollectionUtils.isEmpty(files)) {
result.put("old_contract", true);
result.put("rate_waring", true);
} else {
JSONObject file = files.get(0);
if (sysconfig.getDate("sys_new_contract_time").compareTo(file.getDate("last_update_date")) > 0 || (contract!=null && !contract.getBoolean("has_sign"))) {
result.put("old_contract", true);
result.put("rate_waring", true);
}
}
}
return result; return result;
} }

@ -1,6 +1,6 @@
spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.schema-name=royalpay_production spring.datasource.schema-name=royalpay_production
spring.datasource.host=192.168.0.49:3306 spring.datasource.host=192.168.99.100:3306
spring.datasource.url=jdbc:mysql://${spring.datasource.host}/${spring.datasource.schema-name}?useUnicode=true&characterEncoding=utf8&useSSL=false spring.datasource.url=jdbc:mysql://${spring.datasource.host}/${spring.datasource.schema-name}?useUnicode=true&characterEncoding=utf8&useSSL=false
spring.datasource.username=root spring.datasource.username=root
spring.datasource.password=root spring.datasource.password=root

@ -1,6 +1,6 @@
server.port=5000 server.port=5000
spring.profiles.active=dev,alipay,bestpay,jd,wechat spring.profiles.active=local,alipay,bestpay,jd,wechat
env.company=RoyalPay env.company=RoyalPay
@ -18,8 +18,8 @@ spring.datasource.max-idle=150
spring.datasource.max-wait=3000 spring.datasource.max-wait=3000
spring.datasource.filters=stat,wall,log4j spring.datasource.filters=stat,wall,log4j
spring.redis.host=127.0.0.1 spring.redis.host=192.168.99.100
spring.redis.port=6379 spring.redis.port=32768
spring.redis.database=1 spring.redis.database=1
mybatis.autosql.default-dialect=mysql mybatis.autosql.default-dialect=mysql

@ -105,6 +105,6 @@ sys.contract.ordinary.info=Dear merchant, your service contract with ROYALPAY ha
sys.contract.ordinary.waring=Dear merchant, your service contract with ROYALPAY expires in {0} days. In order not to affect your normal use, please contact your supervisor or use your administrator account as soon as possible in order to renew your service contract. sys.contract.ordinary.waring=Dear merchant, your service contract with ROYALPAY expires in {0} days. In order not to affect your normal use, please contact your supervisor or use your administrator account as soon as possible in order to renew your service contract.
sys.contract.waring=Dear merchant, your service contract with ROYALPAY is due to expire in {0} days. In order not to affect your normal use, please see the latest service agreement for renewal. sys.contract.waring=Dear merchant, your service contract with ROYALPAY is due to expire in {0} days. In order not to affect your normal use, please see the latest service agreement for renewal.
sys.contract.info=Dear merchant, your service contract with ROYALPAY has expired. Please check the latest service agreement to renew your contract so as not to affect your normal use. sys.contract.info=Dear merchant, your service contract with ROYALPAY has expired. Please check the latest service agreement to renew your contract so as not to affect your normal use.
contract.old.waring=Dear Valued Merchants to ensure we comply with the ATO, we will need to adjust our current service agreements to be exclusionary of GST. This will result in contractual changes to your agreement,please read it carefully.
sys.mondelay.cancel.waring=Are you sure to quit this activity? sys.mondelay.cancel.waring=Are you sure to quit this activity?

@ -99,5 +99,5 @@ sys.contract.ordinary.info=尊敬的商户您与ROYALPAY的服务合同已到
sys.contract.ordinary.waring=尊敬的商户您与ROYALPAY的服务合同还有{0}天到期,为了不影响您的正常使用,请尽快联系您的主管或使用管理员账户登录以便进行服务续约 sys.contract.ordinary.waring=尊敬的商户您与ROYALPAY的服务合同还有{0}天到期,为了不影响您的正常使用,请尽快联系您的主管或使用管理员账户登录以便进行服务续约
sys.contract.waring=尊敬的商户您与ROYALPAY的服务合同还有{0}天到期,为了不影响您的正常使用,请查看最新服务协议进行续约。 sys.contract.waring=尊敬的商户您与ROYALPAY的服务合同还有{0}天到期,为了不影响您的正常使用,请查看最新服务协议进行续约。
sys.contract.info=尊敬的商户您与ROYALPAY的服务合同已到期为了不影响您的正常使用请查看最新服务协议进行续约。 sys.contract.info=尊敬的商户您与ROYALPAY的服务合同已到期为了不影响您的正常使用请查看最新服务协议进行续约。
contract.old.waring=尊敬的商户RoyalPay于近期正式收到澳洲监管机构的通知应澳大利亚税务局ATO的要求进行了合同上GST部分的相应调整。请仔细阅读合同条款并确认。
sys.mondelay.cancel.waring=是否确认退出活动 sys.mondelay.cancel.waring=是否确认退出活动
Loading…
Cancel
Save