1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  package org.kuali.ole.pdp.batch.service.impl;
17  
18  import java.util.List;
19  
20  import org.kuali.ole.pdp.batch.service.AchAdviceNotificationService;
21  import org.kuali.ole.pdp.businessobject.CustomerProfile;
22  import org.kuali.ole.pdp.businessobject.PaymentDetail;
23  import org.kuali.ole.pdp.businessobject.PaymentGroup;
24  import org.kuali.ole.pdp.service.PaymentGroupService;
25  import org.kuali.ole.pdp.service.PdpEmailService;
26  import org.kuali.ole.sys.service.NonTransactional;
27  import org.kuali.rice.core.api.datetime.DateTimeService;
28  import org.kuali.rice.krad.service.BusinessObjectService;
29  
30  
31  
32  
33  public class AchAdviceNotificationServiceImpl implements AchAdviceNotificationService {
34      private PdpEmailService pdpEmailService;
35      private PaymentGroupService paymentGroupService;
36  
37      private DateTimeService dateTimeService;
38      private BusinessObjectService businessObjectService;
39  
40      
41  
42  
43  
44  
45      @NonTransactional
46      public void sendAdviceNotifications() {
47          
48          List<PaymentGroup> paymentGroups = paymentGroupService.getAchPaymentsNeedingAdviceNotification();
49          for (PaymentGroup paymentGroup : paymentGroups) {
50              CustomerProfile customer = paymentGroup.getBatch().getCustomerProfile();
51  
52              
53              if (customer.getAdviceCreate()) {
54                  for (PaymentDetail paymentDetail : paymentGroup.getPaymentDetails()) {
55                      pdpEmailService.sendAchAdviceEmail(paymentGroup, paymentDetail, customer);
56                  }
57              }
58  
59              
60              paymentGroup.setAdviceEmailSentDate(dateTimeService.getCurrentTimestamp());
61              businessObjectService.save(paymentGroup);
62          }
63      }
64  
65      
66  
67  
68  
69  
70      @NonTransactional
71      public void setPdpEmailService(PdpEmailService pdpEmailService) {
72          this.pdpEmailService = pdpEmailService;
73      }
74  
75      
76  
77  
78  
79  
80      @NonTransactional
81      public void setDateTimeService(DateTimeService dateTimeService) {
82          this.dateTimeService = dateTimeService;
83      }
84  
85      
86  
87  
88  
89  
90      @NonTransactional
91      public void setBusinessObjectService(BusinessObjectService businessObjectService) {
92          this.businessObjectService = businessObjectService;
93      }
94  
95      
96  
97  
98  
99  
100     @NonTransactional
101     public void setPaymentGroupService(PaymentGroupService paymentGroupService) {
102         this.paymentGroupService = paymentGroupService;
103     }
104 }