[EDIT] CAMBIOS PARA EXCEL Y APACHE KAFKA

parent 0bc53c57
package web.multitask.trismegistoservices.config; //package web.multitask.trismegistoservices.config;
//
import org.apache.kafka.clients.consumer.ConsumerConfig; //import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.common.serialization.StringDeserializer; //import org.apache.kafka.common.serialization.StringDeserializer;
import org.springframework.context.annotation.Bean; //import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; //import org.springframework.context.annotation.Configuration;
import org.springframework.kafka.annotation.EnableKafka; //import org.springframework.kafka.annotation.EnableKafka;
import org.springframework.kafka.core.ConsumerFactory; //import org.springframework.kafka.core.ConsumerFactory;
import org.springframework.kafka.core.DefaultKafkaConsumerFactory; //import org.springframework.kafka.core.DefaultKafkaConsumerFactory;
import java.util.HashMap; //import java.util.HashMap;
import java.util.Map; //import java.util.Map;
//
@EnableKafka //@EnableKafka
@Configuration //@Configuration
public class KafkaConsumerConfig { //public class KafkaConsumerConfig {
@Bean // @Bean
public ConsumerFactory<String, String> consumerFactory() { // public ConsumerFactory<String, String> consumerFactory() {
Map<String, Object> config = new HashMap<>(); // Map<String, Object> config = new HashMap<>();
config.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092"); //// config.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
config.put(ConsumerConfig.GROUP_ID_CONFIG, "1"); //// config.put(ConsumerConfig.GROUP_ID_CONFIG, "1");
config.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class); //// config.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
config.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class); //// config.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
return new DefaultKafkaConsumerFactory<>(config); // return new DefaultKafkaConsumerFactory<>(config);
} // }
//
} //}
\ No newline at end of file \ No newline at end of file
...@@ -120,6 +120,9 @@ public class ExcelService { ...@@ -120,6 +120,9 @@ public class ExcelService {
}else{ }else{
cell.setCellStyle(styleObjectsSaved.get(stylesSaved.indexOf(style.toString()))); cell.setCellStyle(styleObjectsSaved.get(stylesSaved.indexOf(style.toString())));
} }
if(style.has("format")){
setCellFormat(cell,style.optString("format","text"));
}
} }
cell.setCellValue(row_data.optString(identifiers.optString(j, ""))); cell.setCellValue(row_data.optString(identifiers.optString(j, "")));
} }
...@@ -127,6 +130,23 @@ public class ExcelService { ...@@ -127,6 +130,23 @@ public class ExcelService {
} }
public void setCellFormat (XSSFCell cell, String format){
switch (format){
case "number":
cell.setCellType(CellType.NUMERIC);
break;
case "date":
cell.setCellType(CellType.NUMERIC);
cell.setCellValue(cell.getDateCellValue());
break;
case "formula":
cell.setCellType(CellType.FORMULA);
break;
default:
cell.setCellType(CellType.STRING);
break;
}
}
// @Async // @Async
// public CompletableFuture<Boolean> buildSheetAsync(XSSFWorkbook workbook, XSSFSheet sheet, JSONObject json) { // public CompletableFuture<Boolean> buildSheetAsync(XSSFWorkbook workbook, XSSFSheet sheet, JSONObject json) {
// //
......
Markdown is supported
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