Remove PDF annotation and envelope data methods
Removed BurnAnnotationsToPdf, GetEnvelopeData, and GetAnnotationData from FinalizeDocumentJob. These methods handled document reading, annotation retrieval, and PDF annotation burning. This change reflects a refactor or shift in document processing responsibilities.
This commit is contained in:
@@ -212,84 +212,4 @@ public class FinalizeDocumentJob(IOptions<WorkerOptions> options, IConfiguration
|
|||||||
{
|
{
|
||||||
return type == FinalEmailType.YesWithAttachment;
|
return type == FinalEmailType.YesWithAttachment;
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] BurnAnnotationsToPdf(EnvelopeData envelopeData)
|
|
||||||
{
|
|
||||||
var envelopeId = envelopeData.EnvelopeId;
|
|
||||||
|
|
||||||
logger?.LogInformation("Burning [{0}] signatures", envelopeData.AnnotationData.Count);
|
|
||||||
var annotations = envelopeData.AnnotationData;
|
|
||||||
var inputPath = string.Empty;
|
|
||||||
if (envelopeData.DocAsByte is null)
|
|
||||||
{
|
|
||||||
inputPath = envelopeData.DocumentPath;
|
|
||||||
logger?.LogInformation("Input path: [{0}]", inputPath);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
inputPath = _config!.DocumentPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (envelopeData.DocAsByte is null)
|
|
||||||
{
|
|
||||||
var directorySource = Path.GetDirectoryName(inputPath) ?? string.Empty;
|
|
||||||
var split = directorySource.Split('\\');
|
|
||||||
_parentFolderUid = split[^1];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_parentFolderUid = envelopeData.EnvelopeUuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
logger?.LogInformation("ParentFolderUID: [{0}]", _parentFolderUid);
|
|
||||||
byte[] inputDocumentBuffer;
|
|
||||||
if (envelopeData.DocAsByte is not null)
|
|
||||||
{
|
|
||||||
inputDocumentBuffer = envelopeData.DocAsByte;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
inputDocumentBuffer = File.ReadAllBytes(inputPath);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
throw new BurnAnnotationException("Source document could not be read from disk!", ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return pdfBurner!.BurnAnnotsToPDF(inputDocumentBuffer, annotations, envelopeId);
|
|
||||||
}
|
|
||||||
|
|
||||||
private EnvelopeData? GetEnvelopeData(int envelopeId)
|
|
||||||
{
|
|
||||||
var sql = $"SELECT T.GUID, T.ENVELOPE_UUID, T.ENVELOPE_TYPE, T2.FILEPATH, T2.BYTE_DATA FROM [dbo].[TBSIG_ENVELOPE] T\n JOIN TBSIG_ENVELOPE_DOCUMENT T2 ON T.GUID = T2.ENVELOPE_ID\n WHERE T.GUID = {envelopeId}";
|
|
||||||
var table = _database!.GetDatatable(sql);
|
|
||||||
var row = table.Rows.Cast<DataRow>().SingleOrDefault();
|
|
||||||
if (row is null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
var annotationData = GetAnnotationData(envelopeId);
|
|
||||||
var data = new EnvelopeData
|
|
||||||
{
|
|
||||||
EnvelopeId = envelopeId,
|
|
||||||
DocumentPath = row.ItemEx("FILEPATH", string.Empty),
|
|
||||||
AnnotationData = annotationData,
|
|
||||||
DocAsByte = row.Field<byte[]?>("BYTE_DATA"),
|
|
||||||
EnvelopeUuid = row.ItemEx("ENVELOPE_UUID", string.Empty)
|
|
||||||
};
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<string> GetAnnotationData(int envelopeId)
|
|
||||||
{
|
|
||||||
var sql = $"SELECT VALUE FROM TBSIG_DOCUMENT_STATUS WHERE ENVELOPE_ID = {envelopeId}";
|
|
||||||
var table = _database!.GetDatatable(sql);
|
|
||||||
|
|
||||||
return [.. table.Rows.Cast<DataRow>().Select(r => r.ItemEx("VALUE", string.Empty))];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user