|
|
@ -38,7 +38,6 @@ public class AppFileServiceImpl implements AppFileService {
|
|
|
|
public JSONObject getOrGenerateSourceAgreement(int client_id) {
|
|
|
|
public JSONObject getOrGenerateSourceAgreement(int client_id) {
|
|
|
|
JSONObject client = clientManager.getClientInfo(client_id);
|
|
|
|
JSONObject client = clientManager.getClientInfo(client_id);
|
|
|
|
JSONObject contract = clientsContractMapper.findByClientId(client_id);
|
|
|
|
JSONObject contract = clientsContractMapper.findByClientId(client_id);
|
|
|
|
List<JSONObject> files = clientFilesMapper.findFileByClientAndType(client_id, "source_agree_file");
|
|
|
|
|
|
|
|
Date now = new Date();
|
|
|
|
Date now = new Date();
|
|
|
|
if (contract == null || now.compareTo(contract.getDate("expiry_date")) > 0) {
|
|
|
|
if (contract == null || now.compareTo(contract.getDate("expiry_date")) > 0) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -46,11 +45,12 @@ public class AppFileServiceImpl implements AppFileService {
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
logger.info("App generate PDF failed");
|
|
|
|
logger.info("App generate PDF failed");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
files = clientFilesMapper.findFileByClientAndType(client_id, "source_agree_file");
|
|
|
|
List<JSONObject> files =clientFilesMapper.findFileByClientAndType(client_id, "source_agree_file");
|
|
|
|
saveContract(client_id, now);
|
|
|
|
saveContract(client_id, now);
|
|
|
|
return files.get(0);
|
|
|
|
return files.get(0);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
JSONObject expireInfo = retailAppService.getClientRateExpire(client_id);
|
|
|
|
JSONObject expireInfo = retailAppService.getClientRateExpire(client_id);
|
|
|
|
|
|
|
|
List<JSONObject> files = clientFilesMapper.findFileByClientAndType(client_id, "source_agree_file");
|
|
|
|
JSONObject file = files.get(0);
|
|
|
|
JSONObject file = files.get(0);
|
|
|
|
if(expireInfo.getBoolean("rate_expire")){
|
|
|
|
if(expireInfo.getBoolean("rate_expire")){
|
|
|
|
file.put("last_update_date",now);
|
|
|
|
file.put("last_update_date",now);
|
|
|
|