Subversion Repositories SmartDukaan

Rev

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

Rev 24536 Rev 24557
Line 89... Line 89...
89
		ticket.setUpdateTimestamp(LocalDateTime.now());
89
		ticket.setUpdateTimestamp(LocalDateTime.now());
90
		ticket.setL2EscalationTimestamp(ticket.getUpdateTimestamp().plusDays(2));
90
		ticket.setL2EscalationTimestamp(ticket.getUpdateTimestamp().plusDays(2));
91
		ticket.setL3EscalationTimestamp(ticket.getL2EscalationTimestamp().plusDays(2));
91
		ticket.setL3EscalationTimestamp(ticket.getL2EscalationTimestamp().plusDays(2));
92
		ticket.setLastEscalationTimestamp(ticket.getL3EscalationTimestamp().plusDays(2));
92
		ticket.setLastEscalationTimestamp(ticket.getL3EscalationTimestamp().plusDays(2));
93
		ticket.setHappyCode(getRandomString());
93
		ticket.setHappyCode(getRandomString());
94
		int l3Auth = this.getAuthUserId(categoryId, escalationTypeL3, fofoId);
-
 
95
		int l1Auth = this.getAuthUserId(categoryId, escalationTypeL1, fofoId);
94
		int l1Auth = this.getAuthUserId(categoryId, escalationTypeL1, fofoId);
-
 
95
		LOGGER.info("l1Auth"+l1Auth);
96
		int l2Auth = this.getAuthUserId(categoryId, escalationTypeL2, fofoId);
96
		int l2Auth = this.getAuthUserId(categoryId, escalationTypeL2, fofoId);
-
 
97
		LOGGER.info("l2Auth"+l2Auth);
-
 
98
		int l3Auth = this.getAuthUserId(categoryId, escalationTypeL3, fofoId);
97
		LOGGER.info(l1Auth + "-" + l2Auth + "-" + l3Auth);
99
		LOGGER.info("l3Auth"+l3Auth);
98
		if (l1Auth == 0) {
100
		if (l1Auth == 0) {
99
			if (l2Auth == 0) {
101
			if (l2Auth == 0) {
100
				this.setAssignment(ticket, ticketAssigned);
102
				this.setAssignment(ticket, ticketAssigned);
101
			} else {
103
			} else {
102
				ticketAssigned.setAssineeId(l2Auth);
104
				ticketAssigned.setAssineeId(l2Auth);
Line 146... Line 148...
146
			if (regions.size() == 0) {
148
			if (regions.size() == 0) {
147
				regions = partnerRegionRepository.selectByfofoId(0);
149
				regions = partnerRegionRepository.selectByfofoId(0);
148
				LOGGER.info("regions=" + regions);
150
				LOGGER.info("regions=" + regions);
149
			}
151
			}
150
			for (PartnerRegion region : regions) {
152
			for (PartnerRegion region : regions) {
-
 
153
				LOGGER.info(categoryId+":"+escalationType+":"+region.getRegionId());
151
				positions = positionRepository.selectPositionbyCategoryIdAndEscalationType(categoryId, escalationType,
154
				positions = positionRepository.selectPositionbyCategoryIdAndEscalationType(categoryId, escalationType,
152
						region.getRegionId());
155
						region.getRegionId());
153
				LOGGER.info("positions:-" + positions);
156
				LOGGER.info("positions:-" + positions);
154
				if (positions.size() > 0) {
157
				if (positions.size() > 0) {
155
					break;
158
					break;
156
				}
159
				}
157
 
160
 
158
			}
161
			}
159
			if (positions.size() == 0) {
162
			if (positions.size() == 0) {
-
 
163
				if (escalationType == EscalationType.L1) {
-
 
164
					regions = partnerRegionRepository.selectByfofoId(0);
-
 
165
					LOGGER.info("regions=" + regions);
-
 
166
					for (PartnerRegion region : regions) {
-
 
167
						positions = positionRepository.selectPositionbyCategoryIdAndEscalationType(categoryId,
-
 
168
								escalationType, region.getRegionId());
-
 
169
						LOGGER.info("positions:-" + positions);
-
 
170
						if (positions.size() > 0) {
160
				return 0;
171
							break;
-
 
172
						}
-
 
173
					}
-
 
174
				} else {
-
 
175
					regions = partnerRegionRepository.selectByfofoId(0);
-
 
176
					LOGGER.info("regions=" + regions);
-
 
177
					for (PartnerRegion region : regions) {
-
 
178
						positions = positionRepository.selectPositionbyCategoryIdAndEscalationType(categoryId,
-
 
179
								escalationType, region.getRegionId());
-
 
180
						LOGGER.info("positions:-" + positions);
-
 
181
						if (positions.size() > 0) {
-
 
182
							break;
-
 
183
						}
-
 
184
					}
-
 
185
				}
161
			}
186
			}
-
 
187
			
-
 
188
		}
-
 
189
		if(positions.size()==0)
-
 
190
		{
-
 
191
			return 0;
162
		}
192
		}
-
 
193
		LOGGER.info(positions.get(0).getAuthUserId());
163
		return positions.get(0).getAuthUserId();
194
		return positions.get(0).getAuthUserId();
164
		/*
195
		/*
165
		 * if(ActivityType.escalationTypes.contains(escalationType)) {
196
		 * if(ActivityType.escalationTypes.contains(escalationType)) {
166
		 * //escalationMatrix } else { throw new
197
		 * //escalationMatrix } else { throw new
167
		 * ProfitMandiBusinessException("SubCategory", subcategoryId,
198
		 * ProfitMandiBusinessException("SubCategory", subcategoryId,
Line 185... Line 216...
185
	}
216
	}
186
 
217
 
187
	@Override
218
	@Override
188
	public void addPartnerToRegion(int regionId, List<Integer> fofoIds) {
219
	public void addPartnerToRegion(int regionId, List<Integer> fofoIds) {
189
 
220
 
190
		for (Integer fofoId : fofoIds) {
221
		for (int fofoId : fofoIds) {
191
			PartnerRegion partnerRegion = partnerRegionRepository.selectByRegionIdAndFofoId(regionId, fofoId);
-
 
192
			if (partnerRegion == null) {
-
 
193
				partnerRegion = new PartnerRegion();
222
			PartnerRegion partnerRegion = new PartnerRegion();
194
				partnerRegion.setFofoId(fofoId);
223
			partnerRegion.setFofoId(fofoId);
195
				partnerRegion.setRegionId(regionId);
224
			partnerRegion.setRegionId(regionId);
196
				partnerRegionRepository.persist(partnerRegion);
225
			partnerRegionRepository.persist(partnerRegion);
197
			} else {
-
 
198
				continue;
-
 
199
			}
-
 
200
		}
226
		}
201
	}
227
	}
202
 
228
 
203
	@Override
229
	@Override
204
	public Map<Integer, AuthUser> getAuthUserIdAndAuthUserMap(List<TicketAssigned> ticketAssigneds) {
230
	public Map<Integer, AuthUser> getAuthUserIdAndAuthUserMap(List<TicketAssigned> ticketAssigneds) {
Line 259... Line 285...
259
		List<Position> positions = positionRepository.selectPositionByCategoryId(ticketCategory.getId());
285
		List<Position> positions = positionRepository.selectPositionByCategoryId(ticketCategory.getId());
260
		for (Position position : positions) {
286
		for (Position position : positions) {
261
			if (position.getEscalationType().equals(EscalationType.L1)) {
287
			if (position.getEscalationType().equals(EscalationType.L1)) {
262
				ticketAssigned.setAssineeId(position.getAuthUserId());
288
				ticketAssigned.setAssineeId(position.getAuthUserId());
263
				ticket.setL1AuthUser(position.getAuthUserId());
289
				ticket.setL1AuthUser(position.getAuthUserId());
264
			} else if(position.getEscalationType().equals(EscalationType.L2)) {
290
			} else if (position.getEscalationType().equals(EscalationType.L2)) {
265
				ticket.setL2AuthUser(position.getAuthUserId());
291
				ticket.setL2AuthUser(position.getAuthUserId());
266
			}
292
			}
267
		}
293
		}
268
		return ticket;
294
		return ticket;
269
	}
295
	}
Line 346... Line 372...
346
				}
372
				}
347
			}
373
			}
348
		}
374
		}
349
		return authUserListMap;
375
		return authUserListMap;
350
	}
376
	}
-
 
377
 
351
	@Override
378
	@Override
352
	public void updateTicket(int categoryId,int subCategoryId,Ticket ticket) throws ProfitMandiBusinessException
379
	public void updateTicket(int categoryId, int subCategoryId, Ticket ticket) throws ProfitMandiBusinessException {
353
	{
-
 
354
		TicketAssigned ticketAssigned=new TicketAssigned();
380
		TicketAssigned ticketAssigned = new TicketAssigned();
355
		ticket.setSubCategoryId(subCategoryId);
381
		ticket.setSubCategoryId(subCategoryId);
356
		ticket.setUpdateTimestamp(LocalDateTime.now());
382
		ticket.setUpdateTimestamp(LocalDateTime.now());
357
		ticket.setL2EscalationTimestamp(ticket.getUpdateTimestamp().plusDays(2));
383
		ticket.setL2EscalationTimestamp(ticket.getUpdateTimestamp().plusDays(2));
358
		ticket.setL3EscalationTimestamp(ticket.getL2EscalationTimestamp().plusDays(2));
384
		ticket.setL3EscalationTimestamp(ticket.getL2EscalationTimestamp().plusDays(2));
359
		ticket.setLastEscalationTimestamp(ticket.getL3EscalationTimestamp().plusDays(2));
385
		ticket.setLastEscalationTimestamp(ticket.getL3EscalationTimestamp().plusDays(2));
Line 387... Line 413...
387
		} catch (Exception e) {
413
		} catch (Exception e) {
388
			throw new ProfitMandiBusinessException("Ticket Assingment", authUser.getEmailId(),
414
			throw new ProfitMandiBusinessException("Ticket Assingment", authUser.getEmailId(),
389
					"Could not send ticket assignment mail");
415
					"Could not send ticket assignment mail");
390
		}
416
		}
391
	}
417
	}
392
	
418
 
393
}
419
}