Commit 2895ed15 authored by rani0808's avatar rani0808

changed orderDate and estimated Date format to String

parent 7cf48a6e
package com.nisum.omd;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import com.nisum.omd.service.OmdProducerService;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -52,7 +53,10 @@ public class OrderGenerator implements CommandLineRunner{
LocalDateTime currentTime = LocalDateTime.now();
order.setOrderNum(rdg.generateOrderNumber());
order.setCustomerId(rdg.generateCustomerId());
order.setOrderDate(currentTime);
LocalDateTime currentDateTime = LocalDateTime.now();
DateTimeFormatter formatter = DateTimeFormatter.ISO_DATE_TIME;
String formattedDateTime = currentTime.format(formatter);
order.setOrderDate(formattedDateTime);
order.setLineItem(rdg.genetateLineItem(order.getLineItem()));
return order;
}
......
......@@ -16,7 +16,7 @@ public class LineItem {
private String productName;
private String itemType;
private boolean shipChrgApplInd;
private LocalDateTime estimatedShipDate;
private String estimatedShipDate;
private Map<String,Object> linePriceInfo;
private Map<String,Object> lineTax;
......@@ -69,10 +69,10 @@ public class LineItem {
public void setShipChrgApplInd(boolean shipChrgApplInd) {
this.shipChrgApplInd = shipChrgApplInd;
}
public LocalDateTime getEstimatedShipDate() {
public String getEstimatedShipDate() {
return estimatedShipDate;
}
public void setEstimatedShipDate(LocalDateTime estimatedShipDate) {
public void setEstimatedShipDate(String estimatedShipDate) {
this.estimatedShipDate = estimatedShipDate;
}
public Map<String, Object> getLinePriceInfo() {
......
......@@ -11,7 +11,7 @@ public class Order {
private String orderNum;
private LocalDateTime orderDate;
private String orderDate;
private String currency;
private String shipMethod;
private String customerId;
......@@ -47,11 +47,11 @@ public class Order {
this.orderNum = orderNum;
}
public LocalDateTime getOrderDate() {
public String getOrderDate() {
return orderDate;
}
public void setOrderDate(LocalDateTime orderDate) {
public void setOrderDate(String orderDate) {
this.orderDate = orderDate;
}
......
......@@ -48,8 +48,7 @@ public class RandomDataGeneratorImpl implements RandomDataGenerator {
int randomIndex = rand.nextInt(productname.size());
String randomElement = productname.get(randomIndex);
li.setProductName(randomElement);
li.setEstimatedShipDate(order.getOrderDate().plusDays(5));
li.setEstimatedShipDate(order.getOrderDate()+5);
return li;
}
......
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