Rev 24383 | Rev 24417 | Go to most recent revision | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed
package com.spice.profitmandi.dao.repository.cs;import java.time.LocalDateTime;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Component;import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;import com.spice.profitmandi.dao.entity.cs.Activity;import com.spice.profitmandi.dao.entity.cs.Ticket;import com.spice.profitmandi.dao.entity.fofo.ActivityType;@Componentpublic class CsServiceImpl implements CsService {@AutowiredTicketRepository ticketRepository;@AutowiredTicketCategoryRepository ticketCategoryRepository;@AutowiredTicketSubCategoryRepository ticketSubCategoryRepository;@AutowiredActivityRepository activityRepository;@Overridepublic void createTicket(int fofoId, int subcategoryId, String message) {ActivityType type = ActivityType.OPENED;Ticket ticket = new Ticket();ticket.setSubCategoryId(subcategoryId);ticket.setCreateTimestamp(LocalDateTime.now());try {ticket.setAssigneeId(this.getAssigneeId(subcategoryId, type));} catch (Exception e) {e.printStackTrace();}ticketRepository.persist(ticket);Activity activity = this.createActivity(type, message, 0);this.addActivity(ticket.getId(), activity);this.addActivity(ticket.getId(), activity);}private Activity createActivity(ActivityType activityType, String message, int createdBy) {Activity activity = new Activity();activity.setMessage(message);activity.setCreatedBy(createdBy);activity.setType(activityType);return activity;}private int getAssigneeId(int subcategoryId, ActivityType escalationType) throws ProfitMandiBusinessException {return 0;/*if(ActivityType.escalationTypes.contains(escalationType)) {//escalationMatrix} else {throw new ProfitMandiBusinessException("SubCategory", subcategoryId, "Could not find Assignee for ");}*/}@Overridepublic void addActivity(int ticketId, Activity activity) {activity.setTicketId(ticketId);}}