Commit 380b2a8e authored by shishir suman's avatar shishir suman
Browse files

Merge branch 'main' into user_management

# Conflicts:
#	src/main/resources/application.properties
Showing with 515 additions and 144 deletions
+515 -144
......@@ -3,4 +3,30 @@ package org.upsmf.grievance.constants;
public class Constants {
public static final String TIME_ZONE = "Asia/Kolkata";
public static final Long PENDING_21_DAYS = 21l;
public static final Long PENDING_15_DAYS = 15l;
public static final Long AFFILIATION = 1l;
public static final Long EXAM = 2l;
public static final Long ADMISSION = 3l;
public static final Long REGISTRATION = 4l;
public static final Long ASSESSMENT = 5l;
public static final String TOTAL_TICKETS = "total";
public static final String IS_OPEN = "isOpen";
public static final String IS_CLOSED = "isClosed";
public static final String IS_JUNK = "isJunk";
public static final String IS_ESCALATED = "isEscalated";
public static final String UNASSIGNED = "unassigned";
public static final String ASSESSMENT_MATRIX = "assignmentMatrix";
public static final String RESOLUTION_MATRIX = "resolutionMatrix";
public static final String AFFILIATION_NAME = "AFFILIATION";
public static final String ASSESSMENT_DEPARTMENT = "ASSESSMENT";
public static final String REGISTRATION_NAME = "REGISTRATION";
public static final String ADMISSION_NAME = "ADMISSION";
public static final String EXAM_NAME = "EXAM";
public static final String OPEN_TICKET_GTE15 = "openTicketGte15";
public static final String OPEN_TICKET_GTE21 = "openTicketGte21";
public static final String PERFORMANCE_INDICATORS = "performanceIndicators";
public static final String TURN_AROUND_TIME = "turnAroundTime";
public static final String ESCLATION_PERCENTAGE = "escalationPercentage";
public static final String NUDGE_TICKET_PERCENTAGE = "nudgeTicketPercentage";
}
......@@ -22,6 +22,8 @@ public class SearchRequest {
private Long cc;
private List<Integer> ccList;
private SearchDateRange date;
private Boolean isJunk;
......
package org.upsmf.grievance.scheduler;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.upsmf.grievance.controller.SearchTicketController;
import org.upsmf.grievance.constants.Constants;
import org.upsmf.grievance.dto.SearchDateRange;
import org.upsmf.grievance.dto.SearchRequest;
import org.upsmf.grievance.model.reponse.Response;
import org.upsmf.grievance.model.reponse.TicketResponse;
import org.upsmf.grievance.model.EmailDetails;
import org.upsmf.grievance.service.EmailService;
import org.upsmf.grievance.service.SearchService;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Calendar;
import java.util.List;
import java.util.Map;
@Component
@Slf4j
public class BiWeeklyJobScheduler {
@Autowired
private SearchTicketController searchTicketController;
@Scheduled(cron = "0 0 0 */14 * ?")
private SearchService searchService;
@Autowired
private EmailService emailService;
@Value("${email.ids}")
private List<String> emailIds;
@Value("${subject.bi.weekly.report}")
private String subject;
@Scheduled(cron = "0 1 0 */14 * ?")
public void runBiWeeklyJob(){
log.info("Starting the Bi Weekly job");
SearchRequest searchRequest = new SearchRequest();
ResponseEntity<Response> ticketResponse = searchTicketController.search(searchRequest);
searchRequest.setDate(SearchDateRange.builder().to(Calendar.getInstance().getTimeInMillis())
.from(LocalDateTime.now().minusDays(14).atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()).build());
Map<String, Object> response = searchService.dashboardReport(searchRequest);
log.info("Response "+response);
ObjectMapper objectMapper = new ObjectMapper();
JsonNode jsonNode = objectMapper.valueToTree(response);
JsonNode assessmentMatrix = jsonNode.get(Constants.ASSESSMENT_MATRIX);
log.info("Json node "+assessmentMatrix.toString());
EmailDetails emailDetails = new EmailDetails();
for (int i=0;i<emailIds.size();i++){
emailDetails.builder().recipient(emailIds.get(i)).msgBody(assessmentMatrix.toString())
.subject(subject);
log.info("Details "+emailIds.get(i) + " "+response.get(Constants.ASSESSMENT_MATRIX)+ " "+ subject);
emailService.sendSimpleMail(emailDetails);
}
}
}
package org.upsmf.grievance.scheduler;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.upsmf.grievance.constants.Constants;
import org.upsmf.grievance.dto.SearchDateRange;
import org.upsmf.grievance.dto.SearchRequest;
import org.upsmf.grievance.model.EmailDetails;
import org.upsmf.grievance.service.EmailService;
import org.upsmf.grievance.service.SearchService;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Calendar;
import java.util.List;
import java.util.Map;
@Component
@Slf4j
public class NightlyJobScheduler {
@Scheduled(cron = "0 0 0 * * ?")
@Autowired
private SearchService searchService;
@Autowired
private EmailService emailService;
@Value("${email.ids}")
private List<String> emailIds;
@Value("${subject.daily.report}")
private String subject;
@Scheduled(cron = "0 1 0 * * ?")
public void runNightlyJob(){
log.info("Starting the Nightly job");
SearchRequest searchRequest = new SearchRequest();
searchRequest.setDate(SearchDateRange.builder().to(Calendar.getInstance().getTimeInMillis())
.from(LocalDateTime.now().minusDays(1).atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()).build());
Map<String, Object> response = searchService.dashboardReport(searchRequest);
log.info("Response "+response);
ObjectMapper objectMapper = new ObjectMapper();
JsonNode jsonNode = objectMapper.valueToTree(response);
JsonNode assessmentMatrix = jsonNode.get(Constants.ASSESSMENT_MATRIX);
log.info("Json node "+assessmentMatrix.toString());
EmailDetails emailDetails = new EmailDetails();
for (int i=0;i<emailIds.size();i++){
emailDetails.builder().recipient(emailIds.get(i)).msgBody(assessmentMatrix.toString())
.subject(subject);
log.info("Details "+emailIds.get(i) + " "+response.get(Constants.ASSESSMENT_MATRIX)+ " "+ subject);
emailService.sendSimpleMail(emailDetails);
}
}
}
# Details for our datasource
#spring.datasource.url=jdbc:postgresql://192.168.64.5:5432/grievance
spring.datasource.url=jdbc:postgresql://localhost:5432/grievance_desk
spring.datasource.url=jdbc:postgresql://192.168.64.5:5432/grievance
spring.datasource.username=postgres
#spring.datasource.password=postgres
spring.datasource.password=mysecretpassword
spring.datasource.password=postgres
# Hibernate properties
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQL94Dialect
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=create
spring.jpa.hibernate.ddl-auto=none
spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl
spring.jpa.properties.hibernate.format_sql=true
spring.main.allow-bean-definition-overriding=true
......@@ -46,9 +44,15 @@ gcp.max.file.size=2mb
gcp.config.file.path=/Users/shishirsuman/Desktop/upsmf.json
gcp.client.id=
gcp.client.email=
gcp.pkcs.key=
gcp.private.key.id=
gcp.pkcs.key=
#Dashboard
pending.21.days=21
pending.15.days=15
email.ids=nodalofficer@yopmail.com,grievance@yopmail.com
subject.daily.report=Daily Report
subject.bi.weekly.report=Bi Weekly Report
api.user.createUrl=http://localhost:5298/api/v1/user/create
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment