Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,14 @@ List<OutboundCalls> getAllocatedRecordsUser(Pageable pageable, @Param("allocated
int getAllocatedRecordsCountMotherUser(@Param("allocatedUserId") Integer allocatedUserId,
@Param("fDate") Timestamp fDate, @Param("tDate") Timestamp tDate, @Param("callStatus") String callStatus,
@Param("phoneNoType") String phoneNoType);


@Query(value = " SELECT COUNT(1) FROM OutboundCalls AS t WHERE t.allocatedUserId=:allocatedUserId AND "
+ " ((:fDate between t.callDateFrom AND t.callDateTo) OR (:tDate between t.callDateFrom AND t.callDateTo)) AND t.callStatus=:callStatus "
+ " AND t.phoneNumberType=:phoneNoType AND t.childId IS NULL AND t.motherId IS NOT NULL AND t.isStickyAgent=:isStickyAgent")
int getAllocatedRecordsCountMotherUserByStickyAgent(@Param("allocatedUserId") Integer allocatedUserId,
@Param("fDate") Timestamp fDate, @Param("tDate") Timestamp tDate, @Param("callStatus") String callStatus,
@Param("phoneNoType") String phoneNoType, @Param("isStickyAgent") Boolean isStickyAgent);

// get users allocated calls count mother , not completed
// @Query(value = " SELECT COUNT(1) FROM OutboundCalls AS t WHERE t.allocatedUserId=:allocatedUserId AND "
Expand All @@ -159,6 +167,13 @@ int getAllocatedRecordsCountMotherUser(@Param("allocatedUserId") Integer allocat
int getAllocatedRecordsCountChildUser(@Param("allocatedUserId") Integer allocatedUserId,
@Param("fDate") Timestamp fDate, @Param("tDate") Timestamp tDate, @Param("callStatus") String callStatus,
@Param("phoneNoType") String phoneNoType);

@Query(value = " SELECT COUNT(1) FROM OutboundCalls AS t WHERE t.allocatedUserId=:allocatedUserId AND "
+ " ((:fDate between t.callDateFrom AND t.callDateTo) OR (:tDate between t.callDateFrom AND t.callDateTo)) AND t.callStatus=:callStatus "
+ " AND t.phoneNumberType=:phoneNoType AND t.childId IS NOT NULL AND t.isStickyAgent=:isStickyAgent")
int getAllocatedRecordsCountChildUserByIsStickyAgent(@Param("allocatedUserId") Integer allocatedUserId,
@Param("fDate") Timestamp fDate, @Param("tDate") Timestamp tDate, @Param("callStatus") String callStatus,
@Param("phoneNoType") String phoneNoType, @Param("isStickyAgent") Boolean isStickyAgent);

// users allocated calls, Mother, by RecordType And PhoneType
// @Query(value = " SELECT t FROM OutboundCalls AS t WHERE t.allocatedUserId=:allocatedUserId AND "
Expand All @@ -174,7 +189,17 @@ int getAllocatedRecordsCountChildUser(@Param("allocatedUserId") Integer allocate
Page<OutboundCalls> getAllocatedRecordsUserByRecordTypeAndPhoneTypeMother(Pageable pageable,
@Param("allocatedUserId") Integer allocatedUserId, @Param("callStatus") String callStatus,
@Param("phoneNoType") String phoneNoType, @Param("fDate") Timestamp fDate, @Param("tDate") Timestamp tDate);



@Query(value = " SELECT t FROM OutboundCalls AS t WHERE t.allocatedUserId=:allocatedUserId AND "
+ " t.callStatus=:callStatus AND t.phoneNumberType=:phoneNoType "
+ " AND ((:fDate between t.callDateFrom AND t.callDateTo) OR (:tDate between t.callDateFrom AND t.callDateTo)) AND "
+ " t.childId IS NULL AND t.motherId IS NOT NULL AND t.isStickyAgent=:isStickyAgent")
Page<OutboundCalls> getAllocatedRecordsUserByRecordTypeAndPhoneTypeMotherByIsStickyAgent(Pageable pageable,
@Param("allocatedUserId") Integer allocatedUserId, @Param("callStatus") String callStatus,
@Param("phoneNoType") String phoneNoType, @Param("fDate") Timestamp fDate, @Param("tDate") Timestamp tDate, @Param("isStickyAgent") Boolean isStickyAgent);


// // users allocated calls, Child, by RecordType And PhoneType
// @Query(value = " SELECT t FROM OutboundCalls AS t WHERE t.allocatedUserId=:allocatedUserId AND "
// + " t.callStatus=:callStatus AND t.phoneNumberType=:phoneNoType "
Expand All @@ -188,7 +213,16 @@ Page<OutboundCalls> getAllocatedRecordsUserByRecordTypeAndPhoneTypeMother(Pageab
Page<OutboundCalls> getAllocatedRecordsUserByRecordTypeAndPhoneTypeChild(Pageable pageable,
@Param("allocatedUserId") Integer allocatedUserId, @Param("callStatus") String callStatus,
@Param("phoneNoType") String phoneNoType, @Param("fDate") Timestamp fDate, @Param("tDate") Timestamp tDate);

@Query(value = " SELECT t FROM OutboundCalls AS t WHERE t.allocatedUserId=:allocatedUserId AND "
+ " t.callStatus=:callStatus AND t.phoneNumberType=:phoneNoType "
+ " AND ((:fDate between t.callDateFrom AND t.callDateTo) OR (:tDate between t.callDateFrom AND t.callDateTo)) AND t.childId IS NOT NULL AND t.isStickyAgent=:isStickyAgent ")
Page<OutboundCalls> getAllocatedRecordsUserByRecordTypeAndPhoneTypeChildByIsStickyAgent(Pageable pageable,
@Param("allocatedUserId") Integer allocatedUserId, @Param("callStatus") String callStatus,
@Param("phoneNoType") String phoneNoType, @Param("fDate") Timestamp fDate, @Param("tDate") Timestamp tDate, @Param("isStickyAgent") Boolean isStickyAgent);



@Modifying
@Transactional
@Query(" UPDATE OutboundCalls obc SET beneficiaryRegId = :beneficiaryRegId, phoneNumberType = :phoneNumberType WHERE motherId = :motherId AND childId IS NULL ")
Expand All @@ -215,17 +249,17 @@ public int updatePhoneNoTypeForChild(@Param("beneficiaryRegId") Long beneficiary

@Transactional
@Modifying
@Query("UPDATE OutboundCalls SET allocationStatus = 'allocated', allocatedUserId = :userId "
@Query("UPDATE OutboundCalls SET allocationStatus = 'allocated', isStickyAgent = :isStickyAgent, allocatedUserId = :userId "
+ " WHERE motherId = :motherId AND callDateTo>current_date() AND obCallId!=:id")
public int stickyMotherAgentAllocation(@Param("id") Long id, @Param("motherId") Long motherId,
@Param("userId") Integer userId);
@Param("userId") Integer userId, @Param("isStickyAgent") Boolean isStickyAgent);

@Transactional
@Modifying
@Query("UPDATE OutboundCalls SET allocationStatus = 'allocated', allocatedUserId = :userId "
@Query("UPDATE OutboundCalls SET allocationStatus = 'allocated', isStickyAgent = :isStickyAgent, allocatedUserId = :userId "
+ " WHERE childId = :childId AND callDateTo>current_date() AND obCallId!=:id")
public int stickyChildAgentAllocation(@Param("id") Long id, @Param("childId") Long childId,
@Param("userId") Integer userId);
@Param("userId") Integer userId, @Param("isStickyAgent") Boolean isStickyAgent);



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ public boolean preHandle(HttpServletRequest request, HttpServletResponse respons
if (authorization == null)
throw new Exception(
"Authorization key is NULL, please pass valid session key to proceed further. ");
/*
* String userRespFromRedis = redisStorage.getSessionObject(authorization); if
* (userRespFromRedis == null) throw new
* Exception("invalid Authorization key, please pass a valid key to proceed further. "
* ); break;
*/

String userRespFromRedis = redisStorage.getSessionObject(authorization);
if (userRespFromRedis == null)
throw new Exception("invalid Authorization key, please pass a valid key to proceed further. ");
break;

}
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
Expand Down