Subversion Repositories SmartDukaan

Rev

Rev 28712 | Rev 28773 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 28712 Rev 28769
Line 73... Line 73...
73
import com.spice.profitmandi.dao.entity.catalog.Item;
73
import com.spice.profitmandi.dao.entity.catalog.Item;
74
import com.spice.profitmandi.dao.entity.catalog.Scheme;
74
import com.spice.profitmandi.dao.entity.catalog.Scheme;
75
import com.spice.profitmandi.dao.entity.cs.Position;
75
import com.spice.profitmandi.dao.entity.cs.Position;
76
import com.spice.profitmandi.dao.entity.cs.Ticket;
76
import com.spice.profitmandi.dao.entity.cs.Ticket;
77
import com.spice.profitmandi.dao.entity.dtr.DailyRecharge;
77
import com.spice.profitmandi.dao.entity.dtr.DailyRecharge;
-
 
78
import com.spice.profitmandi.dao.entity.dtr.EmployeeAttendance;
78
import com.spice.profitmandi.dao.entity.dtr.InsurancePolicy;
79
import com.spice.profitmandi.dao.entity.dtr.InsurancePolicy;
79
import com.spice.profitmandi.dao.entity.dtr.NotificationCampaign;
80
import com.spice.profitmandi.dao.entity.dtr.NotificationCampaign;
80
import com.spice.profitmandi.dao.entity.dtr.PushNotifications;
81
import com.spice.profitmandi.dao.entity.dtr.PushNotifications;
81
import com.spice.profitmandi.dao.entity.dtr.RechargeProvider;
82
import com.spice.profitmandi.dao.entity.dtr.RechargeProvider;
82
import com.spice.profitmandi.dao.entity.dtr.RechargeProviderCreditWalletHistory;
83
import com.spice.profitmandi.dao.entity.dtr.RechargeProviderCreditWalletHistory;
83
import com.spice.profitmandi.dao.entity.dtr.RechargeTransaction;
84
import com.spice.profitmandi.dao.entity.dtr.RechargeTransaction;
-
 
85
import com.spice.profitmandi.dao.entity.dtr.User;
84
import com.spice.profitmandi.dao.entity.fofo.ActivityType;
86
import com.spice.profitmandi.dao.entity.fofo.ActivityType;
85
import com.spice.profitmandi.dao.entity.fofo.Customer;
87
import com.spice.profitmandi.dao.entity.fofo.Customer;
86
import com.spice.profitmandi.dao.entity.fofo.CustomerAddress;
88
import com.spice.profitmandi.dao.entity.fofo.CustomerAddress;
87
import com.spice.profitmandi.dao.entity.fofo.FofoLineItem;
89
import com.spice.profitmandi.dao.entity.fofo.FofoLineItem;
88
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
90
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
Line 108... Line 110...
108
import com.spice.profitmandi.dao.entity.user.FranchiseeVisit;
110
import com.spice.profitmandi.dao.entity.user.FranchiseeVisit;
109
import com.spice.profitmandi.dao.entity.user.Lead;
111
import com.spice.profitmandi.dao.entity.user.Lead;
110
import com.spice.profitmandi.dao.entity.user.Refferal;
112
import com.spice.profitmandi.dao.entity.user.Refferal;
111
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
113
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
112
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
114
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
-
 
115
import com.spice.profitmandi.dao.enumuration.dtr.PunchType;
113
import com.spice.profitmandi.dao.enumuration.dtr.RefferalStatus;
116
import com.spice.profitmandi.dao.enumuration.dtr.RefferalStatus;
114
import com.spice.profitmandi.dao.enumuration.fofo.ScanType;
117
import com.spice.profitmandi.dao.enumuration.fofo.ScanType;
115
import com.spice.profitmandi.dao.enumuration.transaction.PriceDropImeiStatus;
118
import com.spice.profitmandi.dao.enumuration.transaction.PriceDropImeiStatus;
116
import com.spice.profitmandi.dao.model.SimpleCampaign;
119
import com.spice.profitmandi.dao.model.SimpleCampaign;
117
import com.spice.profitmandi.dao.model.SimpleCampaignParams;
120
import com.spice.profitmandi.dao.model.SimpleCampaignParams;
Line 125... Line 128...
125
import com.spice.profitmandi.dao.repository.cs.PartnerRegionRepository;
128
import com.spice.profitmandi.dao.repository.cs.PartnerRegionRepository;
126
import com.spice.profitmandi.dao.repository.cs.PositionRepository;
129
import com.spice.profitmandi.dao.repository.cs.PositionRepository;
127
import com.spice.profitmandi.dao.repository.cs.RegionRepository;
130
import com.spice.profitmandi.dao.repository.cs.RegionRepository;
128
import com.spice.profitmandi.dao.repository.cs.TicketRepository;
131
import com.spice.profitmandi.dao.repository.cs.TicketRepository;
129
import com.spice.profitmandi.dao.repository.dtr.DailyRechargeRepository;
132
import com.spice.profitmandi.dao.repository.dtr.DailyRechargeRepository;
-
 
133
import com.spice.profitmandi.dao.repository.dtr.EmployeeAttendanceRepository;
130
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
134
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
131
import com.spice.profitmandi.dao.repository.dtr.FranchiseeActivityRepository;
135
import com.spice.profitmandi.dao.repository.dtr.FranchiseeActivityRepository;
132
import com.spice.profitmandi.dao.repository.dtr.FranchiseeVisitRepository;
136
import com.spice.profitmandi.dao.repository.dtr.FranchiseeVisitRepository;
133
import com.spice.profitmandi.dao.repository.dtr.InsurancePolicyRepository;
137
import com.spice.profitmandi.dao.repository.dtr.InsurancePolicyRepository;
134
import com.spice.profitmandi.dao.repository.dtr.LeadRepository;
138
import com.spice.profitmandi.dao.repository.dtr.LeadRepository;
Line 203... Line 207...
203
 
207
 
204
	private static final DateTimeFormatter leadTimeFormatter = DateTimeFormatter.ofPattern("d LLL, hh:mm a");
208
	private static final DateTimeFormatter leadTimeFormatter = DateTimeFormatter.ofPattern("d LLL, hh:mm a");
205
 
209
 
206
	@Autowired
210
	@Autowired
207
	private PartnerRegionRepository partnerRegionRepository;
211
	private PartnerRegionRepository partnerRegionRepository;
-
 
212
	
-
 
213
	@Autowired
-
 
214
	private EmployeeAttendanceRepository employeeAttendanceRepository;
208
 
215
 
209
	@Autowired
216
	@Autowired
210
	private PartnerTypeChangeService partnerTypeChangeService;
217
	private PartnerTypeChangeService partnerTypeChangeService;
211
 
218
 
212
	@Autowired
219
	@Autowired
Line 1093... Line 1100...
1093
				isr);
1100
				isr);
1094
		Utils.sendMailWithAttachments(googleMailSender, INDENT_TERTIARY_MAIL_LIST, null, "Indent Tertiary Report",
1101
		Utils.sendMailWithAttachments(googleMailSender, INDENT_TERTIARY_MAIL_LIST, null, "Indent Tertiary Report",
1095
				"PFA", attachment);
1102
				"PFA", attachment);
1096
 
1103
 
1097
	}
1104
	}
-
 
1105
	
-
 
1106
	public void sendAttendanceMorningAlert() throws Exception {
-
 
1107
		LocalDateTime moriningTime = LocalDate.now().atTime(10, 45);
-
 
1108
		List<AuthUser> authUsers = authRepository.selectHOUsers();
-
 
1109
		Map<String, AuthUser> authUserEmailMap = authUsers.stream().filter(x->x.isActive()).collect(Collectors.toMap(x->x.getEmailId(), x->x));
-
 
1110
		
-
 
1111
		List<User> users = dtrUserRepository.selectAllByEmailIds(new ArrayList<>(authUserEmailMap.keySet()));
-
 
1112
		Map<String, User> userMap = users.stream().collect(Collectors.toMap(x->x.getEmailId(), x->x));
-
 
1113
		
-
 
1114
		List<EmployeeAttendance> employeeAttendances = employeeAttendanceRepository.selectAllByDatesBetween(LocalDate.now().atStartOfDay(), LocalDateTime.now())
-
 
1115
				.stream().filter(x->x.getPunchType().equals(PunchType.ONSITE)).collect(Collectors.toList());
-
 
1116
		Map<Integer, Optional<EmployeeAttendance>> employeeMorningAttendance = employeeAttendances.stream().collect(Collectors.groupingBy(EmployeeAttendance::getUserId, 
-
 
1117
				Collectors.minBy(Comparator.comparing(EmployeeAttendance::getCreateTimestamp)
-
 
1118
			)));
-
 
1119
		
-
 
1120
		for(AuthUser authUser: authUsers) {
-
 
1121
			User user = userMap.get(authUser.getEmailId());
-
 
1122
			Optional<EmployeeAttendance> employeeAttendanceOptional = employeeMorningAttendance.get(user.getId());
-
 
1123
			if(employeeAttendanceOptional==null 
-
 
1124
					|| employeeAttendanceOptional.orElseGet(null)==null 
-
 
1125
					|| employeeAttendanceOptional.get().getCreateTimestamp().isAfter(moriningTime)) {
1098
 
1126
				String body = String.format("Dear %s , Pls note that you haven't punched your attendance ONSITE by 10:45am. You have been marked absent for half the day. You may contact your manager and get it regularise.\n\tRegards\n\tHR Team", authUser.getFullName());
-
 
1127
				Utils.sendMailWithAttachments(googleMailSender, new String[] { "amit.gupta@shop2020.in" }, new String[] { "jyoti.rawat@smartdukaan.com" }, "Attendance Alert", 
-
 
1128
						body);
-
 
1129
				break;
-
 
1130
			}
-
 
1131
		}
-
 
1132
		
-
 
1133
	}
-
 
1134
	
1099
	public void checkPartnerActiveStore() throws Exception {
1135
	public void checkPartnerActiveStore() throws Exception {
1100
 
1136
 
1101
		List<FofoStore> fofoStores = fofoStoreRepository.selectByStatus(true);
1137
		List<FofoStore> fofoStores = fofoStoreRepository.selectByStatus(true);
1102
 
1138
 
1103
		LocalDateTime currentDate = LocalDate.now().atStartOfDay();
1139
		LocalDateTime currentDate = LocalDate.now().atStartOfDay();