Unverified Commit eafda528 authored by sarojsingh2021's avatar sarojsingh2021 Committed by GitHub
Browse files

Merge pull request #9 from UPHRH-platform/cvs_download

Cvs download
No related merge requests found
Showing with 1206 additions and 921 deletions
+1206 -921
......@@ -44,7 +44,12 @@
<artifactId>javax.mail</artifactId>
<version>1.6.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.opencsv/opencsv -->
<dependency>
<groupId>com.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>5.7.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
<dependency>
<groupId>org.apache.poi</groupId>
......
......@@ -6,6 +6,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.tarento.formservice.model.*;
import org.apache.commons.lang3.StringUtils;
import org.apache.tomcat.util.codec.binary.Base64;
import org.slf4j.Logger;
......@@ -28,16 +29,6 @@ import org.springframework.web.multipart.MultipartFile;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.google.gson.Gson;
import com.tarento.formservice.model.AssignApplication;
import com.tarento.formservice.model.Consent;
import com.tarento.formservice.model.FormData;
import com.tarento.formservice.model.IncomingData;
import com.tarento.formservice.model.KeyValue;
import com.tarento.formservice.model.KeyValueList;
import com.tarento.formservice.model.SearchObject;
import com.tarento.formservice.model.SearchRequestDto;
import com.tarento.formservice.model.Status;
import com.tarento.formservice.model.UserInfo;
import com.tarento.formservice.models.Form;
import com.tarento.formservice.models.FormDetail;
import com.tarento.formservice.service.FormsService;
......@@ -173,6 +164,21 @@ public class FormsController {
return ResponseGenerator.failureResponse(Constants.ResponseMessages.ERROR_MESSAGE);
}
@PostMapping(value = PathRoutes.FormServiceApi.GET_INSTITUTE_DATA, produces = MediaType.APPLICATION_JSON_VALUE)
public String getInstituteData(
@RequestHeader(value = Constants.Parameters.X_USER_INFO, required = false) String xUserInfo,
@RequestBody InstituteDownloadRequestDto instituteDownloadRequestDto) throws JsonProcessingException {
UserInfo userInfo = null;
if (StringUtils.isNotBlank(xUserInfo)) {
userInfo = new Gson().fromJson(xUserInfo, UserInfo.class);
}
String responseData = formsService.getInstitutesData(userInfo, instituteDownloadRequestDto);
if (responseData != null) {
return ResponseGenerator.successResponse(responseData);
}
return ResponseGenerator.failureResponse(Constants.ResponseMessages.ERROR_MESSAGE);
}
@GetMapping(value = PathRoutes.FormServiceApi.GET_APPLICATIONS_STATUS_COUNT, produces = MediaType.APPLICATION_JSON_VALUE)
public String getApplicationsStatusCount(
@RequestHeader(value = Constants.Parameters.X_USER_INFO, required = false) String xUserInfo)
......
package com.tarento.formservice.model;
import lombok.*;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@ToString
public class CSVDataDto {
private String applicationId;
private Long formId;
private String title;
private String section;
private String question;
private String instituteAnswer;
private String inspectionAnswer;
private String updatedBy;
private String updatedDate;
private String createdDate;
private Integer version;
private String status;
private String inspectionCompletionDate;
}
package com.tarento.formservice.model;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class InstituteCSVResponseDto {
private String data;
}
package com.tarento.formservice.model;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
@Getter
@Setter
public class InstituteDownloadRequestDto {
private Integer page;
private Integer size;
}
......@@ -25,6 +25,8 @@ import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder.HttpClientConfigCallback;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.client.core.CountRequest;
import org.elasticsearch.client.core.CountResponse;
import org.elasticsearch.common.xcontent.XContentType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -268,4 +270,15 @@ public class ElasticSearchRepository {
}
return response;
}
public CountResponse executeCountRequest(CountRequest countRequest) {
CountResponse response = null;
try {
response = client.count(countRequest, RequestOptions.DEFAULT);
} catch (IOException e) {
LOGGER.error(marker, "Encountered an error while connecting : ", e);
LOGGER.error(marker, "Error Message to report : {}", e.getMessage());
}
return response;
}
}
......@@ -6,17 +6,9 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentMap;
import com.tarento.formservice.model.*;
import org.springframework.web.multipart.MultipartFile;
import com.tarento.formservice.model.AssignApplication;
import com.tarento.formservice.model.Consent;
import com.tarento.formservice.model.IncomingData;
import com.tarento.formservice.model.KeyValueList;
import com.tarento.formservice.model.ResponseData;
import com.tarento.formservice.model.SearchRequestDto;
import com.tarento.formservice.model.State;
import com.tarento.formservice.model.StateMatrix;
import com.tarento.formservice.model.UserInfo;
import com.tarento.formservice.models.Form;
import com.tarento.formservice.models.FormDetail;
......@@ -44,6 +36,8 @@ public interface FormsService {
List<Map<String, Object>> getAllPlainForms();
String getInstitutesData(UserInfo userInfo, InstituteDownloadRequestDto instituteDownloadRequestDto);
KeyValueList getApplicationsStatusCount(UserInfo userInfo);
public Boolean saveFormSubmitv1(IncomingData incomingData, UserInfo userInfo, String action);
......
......@@ -11,6 +11,7 @@ public interface PathRoutes {
final String SAVE_FORM_SUBMIT_V1 = "/v1/saveFormSubmit";
final String SAVE_FORM_SUBMIT_BULK = "/saveFormSubmitBulk";
final String GET_ALL_APPLICATIONS = "/getAllApplications";
final String GET_INSTITUTE_DATA = "/getInstituteData";
final String GET_APPLICATIONS_BY_ID = "/getApplicationsById";
final String GET_APPLICATIONS_STATUS_COUNT = "/getApplicationsStatusCount";
final String FILE_UPLOAD = "/fileUpload";
......
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