@@ -400,6 +400,7 @@ public Subscription updateRchMotherSubscriber(Long msisdn, MctsMother motherUpda
400
400
motherUpdate .setLastMenstrualPeriod (lmp );
401
401
motherUpdate .setUpdatedDateNic (lastUpdatedDateNic );
402
402
motherUpdate .setRegistrationDate (motherRegistrationDate );
403
+ updateSubscriptionModificationDate (subscriberByRchId , SubscriptionPackType .CHILD );
403
404
return latestDeactivatedSubscription ;
404
405
}
405
406
}else {
@@ -464,6 +465,7 @@ public Subscription updateRchMotherSubscriber(Long msisdn, MctsMother motherUpda
464
465
motherUpdate .setDateOfBirth (motherDOB );
465
466
motherUpdate .setLastMenstrualPeriod (lmp );
466
467
motherUpdate .setUpdatedDateNic (lastUpdatedDateNic );
468
+ updateSubscriptionModificationDate (subscriberByRchId , SubscriptionPackType .CHILD );
467
469
return latestDeactivatedSubscription ;
468
470
469
471
} else if (status .equals (SubscriptionStatus .DEACTIVATED ) && ((!DeactivationReason .LOW_LISTENERSHIP .equals (reason ) && !DeactivationReason .WEEKLY_CALLS_NOT_ANSWERED .equals (reason )))) {
@@ -507,6 +509,7 @@ public Subscription updateRchMotherSubscriber(Long msisdn, MctsMother motherUpda
507
509
508
510
} else if (status .equals (SubscriptionStatus .COMPLETED ) || (DeactivationReason .INVALID_NUMBER .equals (reason ) && subscriberByRchId .getCallingNumber ().equals (msisdn )) ) {
509
511
subscriberByRchId .setModificationDate (DateTime .now ());
512
+ updateSubscriptionModificationDate (subscriberByRchId , SubscriptionPackType .CHILD );
510
513
return latestDeactivatedSubscription ;
511
514
} else {
512
515
subscription = latestDeactivatedSubscription ;
@@ -743,8 +746,7 @@ public ChildImportRejection updateRchChildSubscriber(Long msisdn, MctsChild chil
743
746
subscriberByRchId .setDateOfBirth (dob );
744
747
subscriberByRchId .setModificationDate (DateTime .now ());
745
748
//Check for active mother subscription as well, we are modifying mobile number so it should impact mother
746
- updateMotherSubscriptionModificationDate (subscriberByRchId );
747
- LOGGER .debug ("Returning from latest deactivated subscription" );
749
+ updateSubscriptionModificationDate (subscriberByRchId , SubscriptionPackType .PREGNANCY );
748
750
return null ;
749
751
}else if (latestDeactivatedSubscription .getStatus ().equals (SubscriptionStatus .DEACTIVATED ) && (latestDeactivatedSubscription .getDeactivationReason ().equals (DeactivationReason .INVALID_NUMBER ))) {
750
752
LOGGER .debug ("Assigning the latest deactivated subscription to subscriptions" );
@@ -815,7 +817,7 @@ public ChildImportRejection updateRchChildSubscriber(Long msisdn, MctsChild chil
815
817
subscriberByRchId .setModificationDate (DateTime .now ());
816
818
//Check for active mother subscription as well, we are modifying mobile number so it should impact mother
817
819
if (!Objects .equals (subscriberByRchId .getCallingNumber (), msisdn )) {
818
- updateMotherSubscriptionModificationDate (subscriberByRchId );
820
+ updateSubscriptionModificationDate (subscriberByRchId , SubscriptionPackType . PREGNANCY );
819
821
}
820
822
821
823
return null ;
@@ -847,7 +849,7 @@ else if(childUpdate.getMother()!=null){
847
849
subscriberByRchId .setModificationDate (DateTime .now ());
848
850
849
851
if (!Objects .equals (subscriber .getCallingNumber (), msisdn )) {
850
- updateMotherSubscriptionModificationDate (subscriberByRchId );
852
+ updateSubscriptionModificationDate (subscriberByRchId , SubscriptionPackType . PREGNANCY );
851
853
}
852
854
return null ;
853
855
} else if (status .equals (SubscriptionStatus .DEACTIVATED ) && reason .equals (DeactivationReason .INVALID_NUMBER ) && !Objects .equals (subscriber .getCallingNumber (), msisdn )) {
@@ -882,7 +884,7 @@ else if(childUpdate.getMother()!=null){
882
884
subscriberByRchId .setModificationDate (DateTime .now ());
883
885
//Check for active mother subscription as well, we are modifying mobile number so it should impact mother
884
886
if (!Objects .equals (subscriber .getCallingNumber (), msisdn )) {
885
- updateMotherSubscriptionModificationDate (subscriberByRchId );
887
+ updateSubscriptionModificationDate (subscriberByRchId , SubscriptionPackType . PREGNANCY );
886
888
}
887
889
return null ;
888
890
}
@@ -917,7 +919,7 @@ else if(childUpdate.getMother()!=null){
917
919
subscriberByRchId .setDateOfBirth (dob );
918
920
subscriberByRchId .setModificationDate (DateTime .now ());
919
921
//Check for active mother subscription as well, we are modifying mobile number so it should impact mother
920
- updateMotherSubscriptionModificationDate (subscriberByRchId );
922
+ updateSubscriptionModificationDate (subscriberByRchId , SubscriptionPackType . PREGNANCY );
921
923
return null ;
922
924
}
923
925
else if (latestDeactivatedSubscription .getStatus ().equals (SubscriptionStatus .DEACTIVATED ) && (latestDeactivatedSubscription .getDeactivationReason ().equals (DeactivationReason .INVALID_NUMBER ))) {
@@ -1241,11 +1243,10 @@ public List<Subscriber> execute(Query query) {
1241
1243
else return subscriber ;
1242
1244
}
1243
1245
}
1244
-
1245
- private void updateMotherSubscriptionModificationDate (Subscriber subscriber ) {
1246
- Subscription motherActive = subscriptionService .getActiveSubscription (subscriber , SubscriptionPackType .PREGNANCY );
1247
- if (motherActive != null ) {
1248
- motherActive .setModificationDate (DateTime .now ());
1246
+ private void updateSubscriptionModificationDate (Subscriber subscriber , SubscriptionPackType packType ) {
1247
+ Subscription activeSubscription = subscriptionService .getActiveSubscription (subscriber , packType );
1248
+ if (activeSubscription != null ) {
1249
+ activeSubscription .setModificationDate (DateTime .now ());
1249
1250
}
1250
1251
}
1251
1252
0 commit comments