data import
This commit is contained in:
parent
c2b22d5319
commit
bbca71f125
@ -1,7 +1,5 @@
|
|||||||
package com.realnet.BulkUpload.Controllers;
|
package com.realnet.BulkUpload.Controllers;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -24,7 +22,6 @@ import java.util.Iterator;
|
|||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@ -54,7 +51,6 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
|||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@ -64,11 +60,9 @@ import com.fasterxml.jackson.core.type.TypeReference;
|
|||||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.realnet.BulkUpload.Repository.BulkUpload_Repository;
|
import com.realnet.fnd.response.EntityResponse;
|
||||||
import com.realnet.BulkUpload.Services.BulkUpload_Service;
|
|
||||||
import com.realnet.template.entity.TemplateFileUpload;
|
import com.realnet.template.entity.TemplateFileUpload;
|
||||||
import com.realnet.template.repository.TemplatedataRepo;
|
import com.realnet.template.repository.TemplatedataRepo;
|
||||||
import com.realnet.template.service.DynamicTemplateService;
|
|
||||||
import com.realnet.template.service.FileUploadService;
|
import com.realnet.template.service.FileUploadService;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@ -78,14 +72,6 @@ public class DataImportController {
|
|||||||
private JdbcTemplate jdbcTemplate;
|
private JdbcTemplate jdbcTemplate;
|
||||||
@Autowired
|
@Autowired
|
||||||
private TemplatedataRepo temprepo;
|
private TemplatedataRepo temprepo;
|
||||||
@Autowired
|
|
||||||
private DynamicTemplateService dynamicTemplateService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private BulkUpload_Service bulkUpload_Service;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private BulkUpload_Repository bulkUpload_Repository;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private FileUploadService fileUploadService;
|
private FileUploadService fileUploadService;
|
||||||
@ -280,185 +266,21 @@ public class DataImportController {
|
|||||||
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
|
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/////////// VERY IMPORTANT NOT DELETE THE BELOW///////////
|
|
||||||
|
|
||||||
// @PostMapping("/DownloadExcel/{id}")
|
|
||||||
// public ResponseEntity<?> importdatadownloadexcel(@PathVariable Long id,
|
|
||||||
// @RequestBody Map<String, List<Map<String, Object>>> jsonData) {
|
|
||||||
//
|
|
||||||
// TemplateFileUpload templateFileUpload = fileUploadService.getTemplatebyid(id);
|
|
||||||
//
|
|
||||||
// String entity_name = templateFileUpload.getEntity_name();
|
|
||||||
//
|
|
||||||
// BulkUpload_t bulkUpload_t = bulkUpload_Repository.getentityName(entity_name);
|
|
||||||
// String ruleLine = bulkUpload_t.getRule_line();
|
|
||||||
//
|
|
||||||
// JsonParser parser = new JsonParser();
|
|
||||||
// JsonElement element = parser.parse(ruleLine);
|
|
||||||
// JsonArray array = element.getAsJsonArray();
|
|
||||||
// Iterator<JsonElement> iterator = array.iterator();
|
|
||||||
//
|
|
||||||
// String fromsheet = null;
|
|
||||||
// String fromColumn = null;
|
|
||||||
// String validationTable = null;
|
|
||||||
// String checkColumn = null;
|
|
||||||
// String useColumn = null;
|
|
||||||
// String replacementtable = null;
|
|
||||||
// String replacementcolumn = null;
|
|
||||||
//
|
|
||||||
// while (iterator.hasNext()) {
|
|
||||||
// JsonElement next = iterator.next();
|
|
||||||
// JsonObject jsonObject = next.getAsJsonObject();
|
|
||||||
//
|
|
||||||
// fromsheet = jsonObject.get("fromsheet").getAsString();
|
|
||||||
// fromColumn = jsonObject.get("fromColumn").getAsString();
|
|
||||||
// validationTable = jsonObject.get("validationTable").getAsString();
|
|
||||||
// checkColumn = jsonObject.get("checkColumn").getAsString();
|
|
||||||
// useColumn = jsonObject.get("useColumn").getAsString();
|
|
||||||
// replacementtable = jsonObject.get("useTable").getAsString();
|
|
||||||
// replacementcolumn = jsonObject.get("replacementcolumn").getAsString();
|
|
||||||
//
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// String customerTableName = validationTable;
|
|
||||||
// String siteTableName = replacementtable;
|
|
||||||
//
|
|
||||||
// try {
|
|
||||||
// Set<String> tableNames = jsonData.keySet(); // Get all unique table names
|
|
||||||
//
|
|
||||||
// String siteEntityName = null;
|
|
||||||
// for (String tableName : tableNames) {
|
|
||||||
// List<Map<String, Object>> tableData = jsonData.get(tableName);
|
|
||||||
//
|
|
||||||
// // Process tableData based on the tableName (e.g., "Site" or "Customer")
|
|
||||||
// System.out.println("Table Name: " + tableName);
|
|
||||||
// for (Map<String, Object> row : tableData) {
|
|
||||||
// // Process individual rows within the table data
|
|
||||||
// System.out.println("Row Data: " + row);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// List<Map<String, Object>> processedDataList = new ArrayList<>(); // List to hold processed data rows
|
|
||||||
//
|
|
||||||
// // Iterate through each customer data entry
|
|
||||||
// List<Map<String, Object>> customerData = jsonData.get("Customer");
|
|
||||||
// for (Map<String, Object> insertCustomerData : customerData) {
|
|
||||||
// String customerName = (String) insertCustomerData.get(checkColumn);
|
|
||||||
//
|
|
||||||
// // Check if the customerName is not null and iterate through "Site" data
|
|
||||||
// List<Map<String, Object>> siteData = jsonData.get(fromsheet);
|
|
||||||
//
|
|
||||||
// List<Map<String, Object>> matchedSiteData = new ArrayList<>();
|
|
||||||
// if (customerName != null) {
|
|
||||||
// // Iterate through "Site" data and check for a matching "entity_name"
|
|
||||||
// for (Map<String, Object> siteRow : siteData) {
|
|
||||||
// // Specify the index as "AM" (39th column)
|
|
||||||
//// String columnIndex = "AM";
|
|
||||||
// String columnIndex = fromColumn;
|
|
||||||
//
|
|
||||||
// // Retrieve the value at the specified index
|
|
||||||
//
|
|
||||||
// for (Map.Entry<String, Object> entry : siteRow.entrySet()) {
|
|
||||||
// if (entry.getKey().equals(columnIndex)) {
|
|
||||||
// siteEntityName = (String) entry.getValue();
|
|
||||||
// break; // Exit the loop once the value is found
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (customerName.equals(siteEntityName)) {
|
|
||||||
// // Add the matching "Site" data to the list
|
|
||||||
// matchedSiteData.add(siteRow);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// ObjectMapper objectMapper = new ObjectMapper();
|
|
||||||
// String insertCustomerDataJson = objectMapper.writeValueAsString(insertCustomerData);
|
|
||||||
// String matchedSiteDataJson = objectMapper.writeValueAsString(matchedSiteData);
|
|
||||||
//
|
|
||||||
// String customerSql = getInsertQuery(customerTableName, insertCustomerData);
|
|
||||||
//
|
|
||||||
// // Insert data into the customer table
|
|
||||||
// Object[] customerValues = new Object[insertCustomerData.size() + 5];
|
|
||||||
// int index = 0;
|
|
||||||
// for (Object value : insertCustomerData.values()) {
|
|
||||||
// customerValues[index++] = value;
|
|
||||||
// }
|
|
||||||
// customerValues[index++] = new Timestamp(System.currentTimeMillis()); // created_at
|
|
||||||
// customerValues[index++] = null; // created_by
|
|
||||||
// customerValues[index++] = null; // updated_by
|
|
||||||
// customerValues[index++] = new Timestamp(System.currentTimeMillis()); // updated_at
|
|
||||||
// customerValues[index] = null; // account_id
|
|
||||||
// jdbcTemplate.update(customerSql, customerValues);
|
|
||||||
//
|
|
||||||
// // we can use useColumn here
|
|
||||||
// Long generatedId = jdbcTemplate.queryForObject("SELECT LAST_INSERT_ID()", Long.class);
|
|
||||||
//
|
|
||||||
// List<Map<String, Object>> insertMatchedSiteData = new ArrayList<>(); // List to hold processed data rows
|
|
||||||
//
|
|
||||||
// for (Map<String, Object> siteRow : matchedSiteData) {
|
|
||||||
// // Replace "Customer Name" with "customer_master_id" if it exists
|
|
||||||
// if (siteRow.containsKey(siteEntityName)) {
|
|
||||||
// siteRow.put(replacementcolumn, generatedId);
|
|
||||||
// siteRow.remove(siteEntityName);
|
|
||||||
// }
|
|
||||||
// insertMatchedSiteData.add(siteRow);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// for (Map<String, Object> siteRow : insertMatchedSiteData) {
|
|
||||||
// Object[] siteValues = new Object[siteRow.size() + 5]; // Create a new array for each row
|
|
||||||
//
|
|
||||||
// int siteIndex = 0;
|
|
||||||
// for (Object value : siteRow.values()) {
|
|
||||||
// siteValues[siteIndex++] = value;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// siteValues[siteIndex++] = new Timestamp(System.currentTimeMillis()); // created_at
|
|
||||||
// siteValues[siteIndex++] = null; // created_by
|
|
||||||
// siteValues[siteIndex++] = null; // updated_by
|
|
||||||
// siteValues[siteIndex++] = new Timestamp(System.currentTimeMillis()); // updated_at
|
|
||||||
// siteValues[siteIndex] = null; // account_id
|
|
||||||
//
|
|
||||||
// String siteSql = getInsertQuery(siteTableName, siteRow);
|
|
||||||
// jdbcTemplate.update(siteSql, siteValues);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // Add the processed customer data to the list
|
|
||||||
// processedDataList.add(insertCustomerData);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // Use a LinkedHashMap to preserve insertion order in the response
|
|
||||||
// Map<String, List<Map<String, Object>>> response = new LinkedHashMap<>();
|
|
||||||
// response.put("result", processedDataList);
|
|
||||||
//
|
|
||||||
// return new ResponseEntity<>(response, HttpStatus.OK);
|
|
||||||
//
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// // Handle exceptions and return an appropriate response
|
|
||||||
// return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
@PostMapping("/DownloadExcel/{id}")
|
@PostMapping("/DownloadExcel/{id}")
|
||||||
public ResponseEntity<?> importdatadownloadexcel( @PathVariable Long id,
|
public ResponseEntity<?> importdatadownloadexcel(@PathVariable Long id,
|
||||||
@RequestParam(name = "jsonData") String jsonDataParam,
|
@RequestParam(name = "jsonData") String jsonDataParam,
|
||||||
@RequestParam(name = "ruleData") String ruleDataParam)
|
@RequestParam(name = "ruleData") String ruleDataParam)
|
||||||
throws JsonMappingException, JsonProcessingException, UnsupportedEncodingException {
|
throws JsonMappingException, JsonProcessingException, UnsupportedEncodingException {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Inside your method
|
// Inside your method
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
JsonNode ruleDataNode = objectMapper.readTree(ruleDataParam);
|
JsonNode ruleDataNode = objectMapper.readTree(ruleDataParam);
|
||||||
|
|
||||||
if (ruleDataNode.isArray() && ruleDataNode.isEmpty()) {
|
if (ruleDataNode.isArray() && ruleDataNode.isEmpty()) {
|
||||||
// If ruleDataParam is an empty JSON array, directly upload data to the table
|
// If ruleDataParam is an empty JSON array, directly upload data to the table
|
||||||
return uploadDataToTable(id, jsonDataParam);
|
return uploadDataToTable(id, jsonDataParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Parse jsonDataParam to extract the JSON data
|
// Parse jsonDataParam to extract the JSON data
|
||||||
Map<String, List<Map<String, Object>>> jsonData = objectMapper.readValue(
|
Map<String, List<Map<String, Object>>> jsonData = objectMapper.readValue(
|
||||||
@ -478,8 +300,6 @@ public class DataImportController {
|
|||||||
String replacementtable = null;
|
String replacementtable = null;
|
||||||
String replacementcolumn = null;
|
String replacementcolumn = null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (ruleData != null && !ruleData.isEmpty()) {
|
if (ruleData != null && !ruleData.isEmpty()) {
|
||||||
// Assuming you want to access the first element in the array
|
// Assuming you want to access the first element in the array
|
||||||
Map<String, String> rule = ruleData.get(0);
|
Map<String, String> rule = ruleData.get(0);
|
||||||
@ -508,7 +328,6 @@ public class DataImportController {
|
|||||||
|
|
||||||
// Create a sheet for site data
|
// Create a sheet for site data
|
||||||
XSSFSheet siteSheet = workbook.createSheet("Site");
|
XSSFSheet siteSheet = workbook.createSheet("Site");
|
||||||
|
|
||||||
|
|
||||||
List<Map<String, Object>> customerDataList = new ArrayList<>();
|
List<Map<String, Object>> customerDataList = new ArrayList<>();
|
||||||
List<Map<String, Object>> siteDataList = new ArrayList<>();
|
List<Map<String, Object>> siteDataList = new ArrayList<>();
|
||||||
@ -605,7 +424,7 @@ public class DataImportController {
|
|||||||
if (siteRow.containsKey(responseMessage)) {
|
if (siteRow.containsKey(responseMessage)) {
|
||||||
siteRow.put(replacementcolumn, generatedId);
|
siteRow.put(replacementcolumn, generatedId);
|
||||||
// siteRow.remove(responseMessage);
|
// siteRow.remove(responseMessage);
|
||||||
// siteRow.remove(responseMessage);
|
// siteRow.remove(responseMessage);
|
||||||
}
|
}
|
||||||
newMatchedSiteData.add(siteRow);
|
newMatchedSiteData.add(siteRow);
|
||||||
}
|
}
|
||||||
@ -731,74 +550,74 @@ public class DataImportController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private ResponseEntity<?> uploadDataToTable(Long id, String jsonDataParam) {
|
private ResponseEntity<?> uploadDataToTable(Long id, String jsonDataParam) {
|
||||||
try {
|
try {
|
||||||
// Get table name from TemplateFileUpload entity
|
// Get table name from TemplateFileUpload entity
|
||||||
Optional<TemplateFileUpload> fileUploadOptional = temprepo.findById(id);
|
Optional<TemplateFileUpload> fileUploadOptional = temprepo.findById(id);
|
||||||
if (fileUploadOptional.isPresent()) {
|
if (fileUploadOptional.isPresent()) {
|
||||||
TemplateFileUpload fileUpload = fileUploadOptional.get();
|
TemplateFileUpload fileUpload = fileUploadOptional.get();
|
||||||
// String tableName = fileUpload.getTablename();
|
// String tableName = fileUpload.getTablename();
|
||||||
String tableName = "aa";
|
String tableName = fileUpload.getEntity_name();
|
||||||
// Insert data into the specified table
|
// String tableName = "aa";
|
||||||
insertDataIntoTable(tableName, jsonDataParam);
|
// Insert data into the specified table
|
||||||
return ResponseEntity.ok().body("Data uploaded successfully to table: " + tableName);
|
insertDataIntoTable(tableName, jsonDataParam);
|
||||||
} else {
|
System.out.println("Data uploaded successfully to table...");
|
||||||
return ResponseEntity.status(HttpStatus.NOT_FOUND).body("Template file with id " + id + " not found");
|
return ResponseEntity.ok().body(new EntityResponse("Data uploaded successfully to table: " + tableName));
|
||||||
}
|
} else {
|
||||||
} catch (Exception e) {
|
return ResponseEntity.status(HttpStatus.NOT_FOUND).body("Template file with id " + id + " not found");
|
||||||
e.printStackTrace();
|
}
|
||||||
// Handle exceptions and return an appropriate response
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
|
e.printStackTrace();
|
||||||
}
|
// Handle exceptions and return an appropriate response
|
||||||
|
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void insertDataIntoTable(String tableName, String jsonDataParam) {
|
private void insertDataIntoTable(String tableName, String jsonDataParam) {
|
||||||
try {
|
try {
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
// Parse jsonDataParam to extract the JSON data
|
// Parse jsonDataParam to extract the JSON data
|
||||||
Map<String, List<Map<String, Object>>> jsonData = objectMapper.readValue(
|
Map<String, List<Map<String, Object>>> jsonData = objectMapper.readValue(
|
||||||
URLDecoder.decode(jsonDataParam, "UTF-8"), new TypeReference<Map<String, List<Map<String, Object>>>>() {});
|
URLDecoder.decode(jsonDataParam, "UTF-8"),
|
||||||
|
new TypeReference<Map<String, List<Map<String, Object>>>>() {
|
||||||
|
});
|
||||||
|
|
||||||
// Iterate over the entries of the jsonData map
|
// Iterate over the entries of the jsonData map
|
||||||
for (Map.Entry<String, List<Map<String, Object>>> entry : jsonData.entrySet()) {
|
for (Map.Entry<String, List<Map<String, Object>>> entry : jsonData.entrySet()) {
|
||||||
String sheetName = entry.getKey(); // Get the sheet name dynamically
|
String sheetName = entry.getKey(); // Get the sheet name dynamically
|
||||||
List<Map<String, Object>> data = entry.getValue(); // Get the list of maps dynamically
|
List<Map<String, Object>> data = entry.getValue(); // Get the list of maps dynamically
|
||||||
|
|
||||||
// Now you have the list of maps for the current sheet, you can iterate through it and perform your database insertion logic
|
|
||||||
for (Map<String, Object> rowData : data) {
|
|
||||||
StringBuilder columns = new StringBuilder();
|
|
||||||
StringBuilder values = new StringBuilder();
|
|
||||||
List<Object> params = new ArrayList<>();
|
|
||||||
|
|
||||||
// Build column names and values dynamically
|
// Now you have the list of maps for the current sheet, you can iterate through
|
||||||
for (Map.Entry<String, Object> columnEntry : rowData.entrySet()) {
|
// it and perform your database insertion logic
|
||||||
if (columns.length() > 0) {
|
for (Map<String, Object> rowData : data) {
|
||||||
columns.append(", ");
|
StringBuilder columns = new StringBuilder();
|
||||||
values.append(", ");
|
StringBuilder values = new StringBuilder();
|
||||||
}
|
List<Object> params = new ArrayList<>();
|
||||||
columns.append(columnEntry.getKey());
|
|
||||||
values.append("?");
|
|
||||||
params.add(columnEntry.getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Construct the SQL query
|
// Build column names and values dynamically
|
||||||
String sql = "INSERT INTO " + tableName + " (" + columns + ") VALUES (" + values + ")";
|
for (Map.Entry<String, Object> columnEntry : rowData.entrySet()) {
|
||||||
|
if (columns.length() > 0) {
|
||||||
|
columns.append(", ");
|
||||||
|
values.append(", ");
|
||||||
|
}
|
||||||
|
columns.append(columnEntry.getKey());
|
||||||
|
values.append("?");
|
||||||
|
params.add(columnEntry.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
// Execute the SQL query
|
// Construct the SQL query
|
||||||
jdbcTemplate.update(sql, params.toArray());
|
String sql = "INSERT INTO " + tableName + " (" + columns + ") VALUES (" + values + ")";
|
||||||
}
|
|
||||||
}
|
// Execute the SQL query
|
||||||
} catch (Exception e) {
|
jdbcTemplate.update(sql, params.toArray());
|
||||||
e.printStackTrace();
|
}
|
||||||
// Handle exceptions appropriately
|
}
|
||||||
}
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
// Handle exceptions appropriately
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private String extractExceptionMessage(DataIntegrityViolationException e) {
|
private String extractExceptionMessage(DataIntegrityViolationException e) {
|
||||||
String errorMessage = e.getMessage();
|
String errorMessage = e.getMessage();
|
||||||
int startIndex = errorMessage.indexOf("Incorrect ");
|
int startIndex = errorMessage.indexOf("Incorrect ");
|
||||||
@ -865,8 +684,6 @@ public class DataImportController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/downloadImportStatement/{id}")
|
@GetMapping("/downloadImportStatement/{id}")
|
||||||
public ResponseEntity<?> downloadImportStatement(@PathVariable Long id) {
|
public ResponseEntity<?> downloadImportStatement(@PathVariable Long id) {
|
||||||
// Retrieve the file data from the database based on the ID
|
// Retrieve the file data from the database based on the ID
|
||||||
@ -895,9 +712,8 @@ public class DataImportController {
|
|||||||
return ResponseEntity.status(500).body("Error occurred while reading the file.");
|
return ResponseEntity.status(500).body("Error occurred while reading the file.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// get table column
|
||||||
//get table column
|
|
||||||
|
|
||||||
@GetMapping("/columns/{tableName}")
|
@GetMapping("/columns/{tableName}")
|
||||||
public List<String> getColumnNames(@PathVariable String tableName) {
|
public List<String> getColumnNames(@PathVariable String tableName) {
|
||||||
@ -917,77 +733,62 @@ public class DataImportController {
|
|||||||
return new ArrayList<>(columnNamesSet);
|
return new ArrayList<>(columnNamesSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getCellValue(Map<String, List<Map<String, Object>>> jsonData, String sheetName, String cellAddress)
|
||||||
|
throws IOException {
|
||||||
|
if (jsonData.containsKey(sheetName)) {
|
||||||
|
List<Map<String, Object>> sheetData = jsonData.get(sheetName);
|
||||||
|
int size = sheetData.size();
|
||||||
|
System.out.println(size);
|
||||||
|
Map<String, Object> firstRowData = sheetData.get(0);
|
||||||
|
|
||||||
|
// Separate the numeric part (row part) and non-numeric part (column part)
|
||||||
|
String rowPart = "";
|
||||||
|
String columnPart = "";
|
||||||
private String getCellValue(Map<String, List<Map<String, Object>>> jsonData, String sheetName,
|
|
||||||
String cellAddress) throws IOException {
|
|
||||||
if (jsonData.containsKey(sheetName)) {
|
|
||||||
List<Map<String, Object>> sheetData = jsonData.get(sheetName);
|
|
||||||
int size = sheetData.size();
|
|
||||||
System.out.println(size);
|
|
||||||
Map<String, Object> firstRowData = sheetData.get(0);
|
|
||||||
|
|
||||||
// Separate the numeric part (row part) and non-numeric part (column part)
|
for (char c : cellAddress.toCharArray()) {
|
||||||
String rowPart = "";
|
if (Character.isDigit(c)) {
|
||||||
String columnPart = "";
|
rowPart += c;
|
||||||
|
} else {
|
||||||
|
columnPart += c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (char c : cellAddress.toCharArray()) {
|
System.out.println("Column Part: " + columnPart);
|
||||||
if (Character.isDigit(c)) {
|
System.out.println("Row Part: " + rowPart);
|
||||||
rowPart += c;
|
|
||||||
} else {
|
|
||||||
columnPart += c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println("Column Part: " + columnPart);
|
int columnIndex = getColumnIndex(columnPart); // Get the column index based on the columnPart
|
||||||
System.out.println("Row Part: " + rowPart);
|
|
||||||
|
|
||||||
int columnIndex = getColumnIndex(columnPart); // Get the column index based on the columnPart
|
|
||||||
// int rowIndex = Integer.parseInt(rowPart) - 1; // Excel-style 1-based index
|
// int rowIndex = Integer.parseInt(rowPart) - 1; // Excel-style 1-based index
|
||||||
System.out.println("Column Index: " + columnIndex);
|
System.out.println("Column Index: " + columnIndex);
|
||||||
|
|
||||||
|
if (columnIndex >= 0) {
|
||||||
|
// Get the list of keys from the firstRowData map
|
||||||
|
List<String> keys = new ArrayList<>(firstRowData.keySet());
|
||||||
|
|
||||||
if (columnIndex >= 0 ) {
|
// Check if the columnIndex is within the range of keys
|
||||||
// Get the list of keys from the firstRowData map
|
if (columnIndex < keys.size()) {
|
||||||
List<String> keys = new ArrayList<>(firstRowData.keySet());
|
String columnName = keys.get(columnIndex);
|
||||||
|
return columnName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Check if the columnIndex is within the range of keys
|
return null;
|
||||||
if (columnIndex < keys.size()) {
|
|
||||||
String columnName = keys.get(columnIndex);
|
|
||||||
return columnName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private int getColumnIndex(String columnPart) {
|
private int getColumnIndex(String columnPart) {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
int multiplier = 1;
|
int multiplier = 1;
|
||||||
|
|
||||||
// Iterate through the columnPart in reverse order (right to left)
|
// Iterate through the columnPart in reverse order (right to left)
|
||||||
for (int i = columnPart.length() - 1; i >= 0; i--) {
|
for (int i = columnPart.length() - 1; i >= 0; i--) {
|
||||||
char c = columnPart.charAt(i);
|
char c = columnPart.charAt(i);
|
||||||
index += (c - 'A' + 1) * multiplier;
|
index += (c - 'A' + 1) * multiplier;
|
||||||
multiplier *= 26; // Multiply by 26 for each position to calculate the index
|
multiplier *= 26; // Multiply by 26 for each position to calculate the index
|
||||||
}
|
}
|
||||||
|
|
||||||
return index - 1; // Subtract 1 to get a 0-based index
|
return index - 1; // Subtract 1 to get a 0-based index
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// @PostMapping("/DownloadExcel/{entityName}")
|
// @PostMapping("/DownloadExcel/{entityName}")
|
||||||
// public ResponseEntity<Resource> importdatadownloadexcel(@PathVariable String entityName,
|
// public ResponseEntity<Resource> importdatadownloadexcel(@PathVariable String entityName,
|
||||||
// @RequestBody List<Map<String, Object>> data) throws IOException {
|
// @RequestBody List<Map<String, Object>> data) throws IOException {
|
||||||
@ -1003,80 +804,235 @@ public class DataImportController {
|
|||||||
// return ResponseEntity.ok().body(null);
|
// return ResponseEntity.ok().body(null);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private List<Map<String, Object>> processData(String entityName, List<Map<String, Object>> data) {
|
private List<Map<String, Object>> processData(String entityName, List<Map<String, Object>> data) {
|
||||||
List<Map<String, Object>> processedData = new ArrayList<>();
|
List<Map<String, Object>> processedData = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
String convertedTableName = entityName;
|
String convertedTableName = entityName;
|
||||||
String sql = getInsertQuery(convertedTableName, data.get(0));
|
String sql = getInsertQuery(convertedTableName, data.get(0));
|
||||||
for (int i = 0; i < data.size(); i++) {
|
for (int i = 0; i < data.size(); i++) {
|
||||||
Map<String, Object> row = data.get(i);
|
Map<String, Object> row = data.get(i);
|
||||||
Map<String, Object> processedRow = new HashMap<>();
|
Map<String, Object> processedRow = new HashMap<>();
|
||||||
try {
|
try {
|
||||||
Object[] values = new Object[row.size() + 5]; // +5 for the additional columns
|
Object[] values = new Object[row.size() + 5]; // +5 for the additional columns
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (Object value : row.values()) {
|
for (Object value : row.values()) {
|
||||||
values[index++] = value;
|
values[index++] = value;
|
||||||
}
|
}
|
||||||
values[index++] = new Timestamp(System.currentTimeMillis()); // created_at
|
values[index++] = new Timestamp(System.currentTimeMillis()); // created_at
|
||||||
values[index++] = null; // created_by
|
values[index++] = null; // created_by
|
||||||
values[index++] = null; // updated_by
|
values[index++] = null; // updated_by
|
||||||
values[index++] = new Timestamp(System.currentTimeMillis()); // updated_at
|
values[index++] = new Timestamp(System.currentTimeMillis()); // updated_at
|
||||||
values[index] = null; // account_id
|
values[index] = null; // account_id
|
||||||
jdbcTemplate.update(sql, values);
|
jdbcTemplate.update(sql, values);
|
||||||
processedRow.putAll(row);
|
processedRow.putAll(row);
|
||||||
processedRow.put("Status", "Success");
|
processedRow.put("Status", "Success");
|
||||||
processedRow.put("Exception", "NA");
|
processedRow.put("Exception", "NA");
|
||||||
} catch (DataIntegrityViolationException e) {
|
} catch (DataIntegrityViolationException e) {
|
||||||
processedRow.putAll(row);
|
processedRow.putAll(row);
|
||||||
processedRow.put("Status", "Error");
|
processedRow.put("Status", "Error");
|
||||||
String exceptionMessage = extractExceptionMessage(e);
|
String exceptionMessage = extractExceptionMessage(e);
|
||||||
processedRow.put("Exception", exceptionMessage);
|
processedRow.put("Exception", exceptionMessage);
|
||||||
}
|
}
|
||||||
processedData.add(processedRow);
|
processedData.add(processedRow);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Handle any exceptions here if needed
|
// Handle any exceptions here if needed
|
||||||
}
|
}
|
||||||
return processedData;
|
return processedData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private Workbook createWorkbook(List<Map<String, Object>> processedData) {
|
private Workbook createWorkbook(List<Map<String, Object>> processedData) {
|
||||||
Workbook workbook = new XSSFWorkbook();
|
Workbook workbook = new XSSFWorkbook();
|
||||||
Sheet sheet = workbook.createSheet("Failed Records");
|
Sheet sheet = workbook.createSheet("Failed Records");
|
||||||
|
|
||||||
// Add column headers to the worksheet
|
// Add column headers to the worksheet
|
||||||
Row headerRow = sheet.createRow(0);
|
Row headerRow = sheet.createRow(0);
|
||||||
int columnIndex = 0;
|
int columnIndex = 0;
|
||||||
for (String key : processedData.get(0).keySet()) {
|
for (String key : processedData.get(0).keySet()) {
|
||||||
Cell cell = headerRow.createCell(columnIndex++);
|
Cell cell = headerRow.createCell(columnIndex++);
|
||||||
cell.setCellValue(key);
|
cell.setCellValue(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add data rows to the worksheet
|
// Add data rows to the worksheet
|
||||||
int rowIndex = 1;
|
int rowIndex = 1;
|
||||||
for (Map<String, Object> row : processedData) {
|
for (Map<String, Object> row : processedData) {
|
||||||
Row dataRow = sheet.createRow(rowIndex++);
|
Row dataRow = sheet.createRow(rowIndex++);
|
||||||
columnIndex = 0;
|
columnIndex = 0;
|
||||||
for (Object value : row.values()) {
|
for (Object value : row.values()) {
|
||||||
Cell cell = dataRow.createCell(columnIndex++);
|
Cell cell = dataRow.createCell(columnIndex++);
|
||||||
cell.setCellValue(value.toString());
|
cell.setCellValue(value.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return workbook;
|
return workbook;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Resource createExcelResource(Workbook workbook) throws IOException {
|
private Resource createExcelResource(Workbook workbook) throws IOException {
|
||||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||||
workbook.write(outputStream);
|
workbook.write(outputStream);
|
||||||
ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
|
ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
|
||||||
return new InputStreamResource(inputStream);
|
return new InputStreamResource(inputStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////// VERY IMPORTANT NOT DELETE THE BELOW///////////
|
||||||
|
|
||||||
|
//@PostMapping("/DownloadExcel/{id}")
|
||||||
|
//public ResponseEntity<?> importdatadownloadexcel(@PathVariable Long id,
|
||||||
|
// @RequestBody Map<String, List<Map<String, Object>>> jsonData) {
|
||||||
|
//
|
||||||
|
// TemplateFileUpload templateFileUpload = fileUploadService.getTemplatebyid(id);
|
||||||
|
//
|
||||||
|
// String entity_name = templateFileUpload.getEntity_name();
|
||||||
|
//
|
||||||
|
// BulkUpload_t bulkUpload_t = bulkUpload_Repository.getentityName(entity_name);
|
||||||
|
// String ruleLine = bulkUpload_t.getRule_line();
|
||||||
|
//
|
||||||
|
// JsonParser parser = new JsonParser();
|
||||||
|
// JsonElement element = parser.parse(ruleLine);
|
||||||
|
// JsonArray array = element.getAsJsonArray();
|
||||||
|
// Iterator<JsonElement> iterator = array.iterator();
|
||||||
|
//
|
||||||
|
// String fromsheet = null;
|
||||||
|
// String fromColumn = null;
|
||||||
|
// String validationTable = null;
|
||||||
|
// String checkColumn = null;
|
||||||
|
// String useColumn = null;
|
||||||
|
// String replacementtable = null;
|
||||||
|
// String replacementcolumn = null;
|
||||||
|
//
|
||||||
|
// while (iterator.hasNext()) {
|
||||||
|
// JsonElement next = iterator.next();
|
||||||
|
// JsonObject jsonObject = next.getAsJsonObject();
|
||||||
|
//
|
||||||
|
// fromsheet = jsonObject.get("fromsheet").getAsString();
|
||||||
|
// fromColumn = jsonObject.get("fromColumn").getAsString();
|
||||||
|
// validationTable = jsonObject.get("validationTable").getAsString();
|
||||||
|
// checkColumn = jsonObject.get("checkColumn").getAsString();
|
||||||
|
// useColumn = jsonObject.get("useColumn").getAsString();
|
||||||
|
// replacementtable = jsonObject.get("useTable").getAsString();
|
||||||
|
// replacementcolumn = jsonObject.get("replacementcolumn").getAsString();
|
||||||
|
//
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// String customerTableName = validationTable;
|
||||||
|
// String siteTableName = replacementtable;
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// Set<String> tableNames = jsonData.keySet(); // Get all unique table names
|
||||||
|
//
|
||||||
|
// String siteEntityName = null;
|
||||||
|
// for (String tableName : tableNames) {
|
||||||
|
// List<Map<String, Object>> tableData = jsonData.get(tableName);
|
||||||
|
//
|
||||||
|
// // Process tableData based on the tableName (e.g., "Site" or "Customer")
|
||||||
|
// System.out.println("Table Name: " + tableName);
|
||||||
|
// for (Map<String, Object> row : tableData) {
|
||||||
|
// // Process individual rows within the table data
|
||||||
|
// System.out.println("Row Data: " + row);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// List<Map<String, Object>> processedDataList = new ArrayList<>(); // List to hold processed data rows
|
||||||
|
//
|
||||||
|
// // Iterate through each customer data entry
|
||||||
|
// List<Map<String, Object>> customerData = jsonData.get("Customer");
|
||||||
|
// for (Map<String, Object> insertCustomerData : customerData) {
|
||||||
|
// String customerName = (String) insertCustomerData.get(checkColumn);
|
||||||
|
//
|
||||||
|
// // Check if the customerName is not null and iterate through "Site" data
|
||||||
|
// List<Map<String, Object>> siteData = jsonData.get(fromsheet);
|
||||||
|
//
|
||||||
|
// List<Map<String, Object>> matchedSiteData = new ArrayList<>();
|
||||||
|
// if (customerName != null) {
|
||||||
|
// // Iterate through "Site" data and check for a matching "entity_name"
|
||||||
|
// for (Map<String, Object> siteRow : siteData) {
|
||||||
|
// // Specify the index as "AM" (39th column)
|
||||||
|
//// String columnIndex = "AM";
|
||||||
|
// String columnIndex = fromColumn;
|
||||||
|
//
|
||||||
|
// // Retrieve the value at the specified index
|
||||||
|
//
|
||||||
|
// for (Map.Entry<String, Object> entry : siteRow.entrySet()) {
|
||||||
|
// if (entry.getKey().equals(columnIndex)) {
|
||||||
|
// siteEntityName = (String) entry.getValue();
|
||||||
|
// break; // Exit the loop once the value is found
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (customerName.equals(siteEntityName)) {
|
||||||
|
// // Add the matching "Site" data to the list
|
||||||
|
// matchedSiteData.add(siteRow);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
// String insertCustomerDataJson = objectMapper.writeValueAsString(insertCustomerData);
|
||||||
|
// String matchedSiteDataJson = objectMapper.writeValueAsString(matchedSiteData);
|
||||||
|
//
|
||||||
|
// String customerSql = getInsertQuery(customerTableName, insertCustomerData);
|
||||||
|
//
|
||||||
|
// // Insert data into the customer table
|
||||||
|
// Object[] customerValues = new Object[insertCustomerData.size() + 5];
|
||||||
|
// int index = 0;
|
||||||
|
// for (Object value : insertCustomerData.values()) {
|
||||||
|
// customerValues[index++] = value;
|
||||||
|
// }
|
||||||
|
// customerValues[index++] = new Timestamp(System.currentTimeMillis()); // created_at
|
||||||
|
// customerValues[index++] = null; // created_by
|
||||||
|
// customerValues[index++] = null; // updated_by
|
||||||
|
// customerValues[index++] = new Timestamp(System.currentTimeMillis()); // updated_at
|
||||||
|
// customerValues[index] = null; // account_id
|
||||||
|
// jdbcTemplate.update(customerSql, customerValues);
|
||||||
|
//
|
||||||
|
// // we can use useColumn here
|
||||||
|
// Long generatedId = jdbcTemplate.queryForObject("SELECT LAST_INSERT_ID()", Long.class);
|
||||||
|
//
|
||||||
|
// List<Map<String, Object>> insertMatchedSiteData = new ArrayList<>(); // List to hold processed data rows
|
||||||
|
//
|
||||||
|
// for (Map<String, Object> siteRow : matchedSiteData) {
|
||||||
|
// // Replace "Customer Name" with "customer_master_id" if it exists
|
||||||
|
// if (siteRow.containsKey(siteEntityName)) {
|
||||||
|
// siteRow.put(replacementcolumn, generatedId);
|
||||||
|
// siteRow.remove(siteEntityName);
|
||||||
|
// }
|
||||||
|
// insertMatchedSiteData.add(siteRow);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// for (Map<String, Object> siteRow : insertMatchedSiteData) {
|
||||||
|
// Object[] siteValues = new Object[siteRow.size() + 5]; // Create a new array for each row
|
||||||
|
//
|
||||||
|
// int siteIndex = 0;
|
||||||
|
// for (Object value : siteRow.values()) {
|
||||||
|
// siteValues[siteIndex++] = value;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// siteValues[siteIndex++] = new Timestamp(System.currentTimeMillis()); // created_at
|
||||||
|
// siteValues[siteIndex++] = null; // created_by
|
||||||
|
// siteValues[siteIndex++] = null; // updated_by
|
||||||
|
// siteValues[siteIndex++] = new Timestamp(System.currentTimeMillis()); // updated_at
|
||||||
|
// siteValues[siteIndex] = null; // account_id
|
||||||
|
//
|
||||||
|
// String siteSql = getInsertQuery(siteTableName, siteRow);
|
||||||
|
// jdbcTemplate.update(siteSql, siteValues);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // Add the processed customer data to the list
|
||||||
|
// processedDataList.add(insertCustomerData);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // Use a LinkedHashMap to preserve insertion order in the response
|
||||||
|
// Map<String, List<Map<String, Object>>> response = new LinkedHashMap<>();
|
||||||
|
// response.put("result", processedDataList);
|
||||||
|
//
|
||||||
|
// return new ResponseEntity<>(response, HttpStatus.OK);
|
||||||
|
//
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// // Handle exceptions and return an appropriate response
|
||||||
|
// return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,7 +38,7 @@ public class FileuploadService {
|
|||||||
File projectdir = new File(Path1);
|
File projectdir = new File(Path1);
|
||||||
if (!projectdir.exists()) {
|
if (!projectdir.exists()) {
|
||||||
boolean mkdir = projectdir.mkdirs();
|
boolean mkdir = projectdir.mkdirs();
|
||||||
System.out.println(Path1 + " folder create = " + mkdir);
|
System.out.println(Path1 + " folder created = " + mkdir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -4,8 +4,6 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@ -15,22 +13,20 @@ import com.realnet.Notification.Repository.NotRepo;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/notification")
|
@RequestMapping("/notification")
|
||||||
public class NotController {
|
public class NotController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private NotRepo notRepo;
|
private NotRepo notRepo;
|
||||||
|
|
||||||
// @PostMapping("/save_notification")
|
// @PostMapping("/save_notification")
|
||||||
// public NotEntity Savedata(@RequestBody NotEntity entity) {
|
// public NotEntity Savedata(@RequestBody NotEntity entity) {
|
||||||
// NotEntity dash = notRepo.save(entity) ;
|
// NotEntity dash = notRepo.save(entity) ;
|
||||||
// return dash;
|
// return dash;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/get_notification")
|
@GetMapping("/get_notification")
|
||||||
public List<NotEntity> getdetails() {
|
public List<NotEntity> getdetails() {
|
||||||
List<NotEntity> dash = notRepo.findTopByOrderByd();
|
List<NotEntity> dash = notRepo.findTopByOrderByd();
|
||||||
return dash;
|
return dash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user