|
|
|
@ -44,7 +44,7 @@ public class ClientContractServiceImpl implements ClientContractService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional
|
|
|
|
|
public JSONObject getOrGenerateSourceAgreement(int client_id) {
|
|
|
|
|
public JSONObject getOrGenerateSourceAgreement(int client_id,String channel) {
|
|
|
|
|
JSONObject client = clientManager.getClientInfo(client_id);
|
|
|
|
|
if (client == null) {
|
|
|
|
|
throw new NotFoundException("merchant not found");
|
|
|
|
@ -60,7 +60,7 @@ public class ClientContractServiceImpl implements ClientContractService {
|
|
|
|
|
throw new ServerErrorException("System error");
|
|
|
|
|
}
|
|
|
|
|
List<JSONObject> files = clientFilesMapper.findFileByClientAndType(client_id, "source_agree_file");
|
|
|
|
|
saveContract(client_id, now);
|
|
|
|
|
saveContract(client_id, now,channel);
|
|
|
|
|
return files.get(0);
|
|
|
|
|
} else {
|
|
|
|
|
List<JSONObject> files = clientFilesMapper.findFileByClientAndType(client_id, "source_agree_file");
|
|
|
|
@ -75,11 +75,11 @@ public class ClientContractServiceImpl implements ClientContractService {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void saveContract(int client_id, Date now) {
|
|
|
|
|
private void saveContract(int client_id, Date now,String channel) {
|
|
|
|
|
JSONObject newContract = new JSONObject();
|
|
|
|
|
newContract.put("create_time", now);
|
|
|
|
|
newContract.put("expiry_date", DateUtils.addYears(now, 1));
|
|
|
|
|
newContract.put("sign_channel", "App");
|
|
|
|
|
newContract.put("sign_channel", channel);
|
|
|
|
|
newContract.put("client_id", client_id);
|
|
|
|
|
newContract.put("has_sign", false);
|
|
|
|
|
clientsContractMapper.save(newContract);
|
|
|
|
|