master
wangning 7 years ago
parent 796589c8d6
commit d4287e0bc0

@ -54,7 +54,8 @@ 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")||expireInfo.getBoolean("old_contract")) && (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.getNewAggregateAgreeFile(client.getString("client_moniker"), null, true); clientManager.getNewAggregateAgreeFile(client.getString("client_moniker"), null, true);
} catch (Exception e) { } catch (Exception e) {
@ -118,30 +119,16 @@ public class ClientContractServiceImpl implements ClientContractService {
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 || 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 && !old_contract) {
rateInfo.forEach((p) -> {
p.remove("client_rate_id");
p.put("create_time", now);
p.put("manager_id", "0");
p.put("update_time", now);
p.put("manager_name", "merchant_" + account_id + "_" + account.getString("display_name"));
p.put("active_time", DateUtils.addDays(p.getDate("expiry_time"), 1));
p.put("expiry_time", DateUtils.addYears(p.getDate("active_time"), 1));
clientRateMapper.saveRate(p);
});
}
clientManager.setClientTaxInSurcharge(client.getString("client_moniker"), false); clientManager.setClientTaxInSurcharge(client.getString("client_moniker"), false);
} }
@ -213,14 +200,15 @@ public class ClientContractServiceImpl implements ClientContractService {
result.put("rate_waring", true); result.put("rate_waring", true);
} }
} }
if(!result.getBoolean("rate_waring") && !result.getBoolean("rate_expire")){ if (!result.getBoolean("rate_waring") && !result.getBoolean("rate_expire")) {
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)) {
result.put("old_contract", true); result.put("old_contract", true);
result.put("rate_waring", true); result.put("rate_waring", true);
} else { } else {
JSONObject file = files.get(0); 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"))) { 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("old_contract", true);
result.put("rate_waring", true); result.put("rate_waring", true);
} }

Loading…
Cancel
Save