Class CommunicationLogService
java.lang.Object
com.minicrm.mini_crm_api.services.CommunicationLogService
Service for managing the lifecycle of CommunicationLog entries.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates a new communication log entry with a 'PENDING' status.getCampaignStats(String campaignId) Calculates the delivery statistics for a given campaign.voidupdateLogStatus(String logId, String status) Updates the status of an existing communication log.voidupdateLogStatusInBatch(List<DeliveryReceiptDTO> receipts) Update status of multiple communication logs in a single efficient batch operation.
-
Constructor Details
-
CommunicationLogService
public CommunicationLogService()
-
-
Method Details
-
createLog
Creates a new communication log entry with a 'PENDING' status.- Parameters:
campaignId- The ID of the campaign this log belongs to.customerId- The ID of the customer this message is for.- Returns:
- The newly created and saved CommunicationLog object.
-
updateLogStatus
Updates the status of an existing communication log.- Parameters:
logId- The ID of the log entry to update.status- The new status (e.g., "SENT" or "FAILED").- Throws:
IllegalArgumentException- if no log is found for the given ID.
-
getCampaignStats
Calculates the delivery statistics for a given campaign.- Parameters:
campaignId- The ID of the campaign.- Returns:
- A DTO containing the counts of sent, failed, and pending messages.
-
updateLogStatusInBatch
Update status of multiple communication logs in a single efficient batch operation.- Parameters:
receipts- A list of DeliveryReceiptDTOs to process.
-