/** * 保理线下风控审核后指定文件覆盖归档 * @param payId * 付款确认书的uuid * @throws ActiveRecordException */ public void getFactoringOfflineFileArchive(QhyfController ctl,String payId ) throws ActiveRecordException { //获取配置的可以覆盖的归档的文件的ID String archiveSql= "SELECT " + " a.cover_archive_file_id " + "FROM " + " biz_pre_import_configuration a, " + " biz_pay_comfirm_info b " + "WHERE " + " b.uuid = ? " + " AND a.coreid = b.core_enterprise_id " + " AND a.financial_institutions_id = b.financial_institutions_id " + " AND a.sys_status = 1 " + " AND b.sys_status = 1" ; Record archiveRecord=Db.findFirst(archiveSql,payId); // 如果覆盖归档的文件id不为空 if(archiveRecord !=null && StringUtils.isNotBlank(archiveRecord.getStr("coverArchiveFileId"))){ //拆分归档文件的id String[] coverArchiveFileIdArray = archiveRecord.getStr("coverArchiveFileId").split(","); for (String coverArchiveFileId: coverArchiveFileIdArray) { // 查询该文件的单个文件的最新表的信息 String newSql = String.format(""+ " SELECT " + " a.upload_file_id " + " FROM " + " biz_newest_single_file a " + " WHERE " + " a.biz_id = ? " + " AND a.document_id = %s " + " AND a.sys_status = 1 ", coverArchiveFileId); Record newFile = Db.findFirst(newSql, payId); //如果该文件的单个文件最新表信息不为空 if (newFile != null && StringUtils.isNotBlank(newFile.getStr("uploadFileId"))) { String uploadFileId = newFile.getStr("uploadFileId"); //查询该文件的归档信息 String archiveInformationSql = String.format(""+ " SELECT " + " b.uuid ," + " b.upload_file_id"+ " FROM " + " biz_archive a " + " LEFT JOIN biz_archive_detail b " + " ON a.uuid = b.archive_id " + " WHERE " + " a.biz_id = ? " + " AND b.file_id = %s " + " AND a.sys_status = 1 " + " AND b.sys_status = 1 ", coverArchiveFileId); Record archiveInformationRecord = Db.findFirst(archiveInformationSql, payId); // 归档明细履历表备注 String archiveDetailHistoryMemo = "风控审核后指定文件覆盖归档"; coverArchiveFileId = coverArchiveFileId.replaceAll("'", ""); // 如果该文件的归档信息不为空 if (archiveInformationRecord != null) { //单个文件最新表的文件信息与归纳表中不一致的话 if (!uploadFileId.equals(archiveInformationRecord.getStr("uploadFileId"))) { // 直接将单个文件的最新表的信息写入归档表中,追加归档履历 this.dirctArchive(ctl, payId, coverArchiveFileId, uploadFileId, archiveDetailHistoryMemo); } // 如果该文件的归档信息为空 }else{ //为空直接将单个文件的最新表的信息写入归档表中,追加归档履历 this.dirctArchive(ctl, payId, coverArchiveFileId, uploadFileId, archiveDetailHistoryMemo); } } } } }
保存的数据自身带引号, 用format一下,就去除了