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