Commit ff458eb2 authored by Ramakanth Dhane's avatar Ramakanth Dhane

Merge branch 'master' into 'master'

Master

See merge request !7
parents 9eb39071 91b41690
package com.nisum.omd;
import java.time.LocalDateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.nisum.omd.domain.Order;
import com.nisum.omd.service.RandomDataGeneratorImpl;
......@@ -30,6 +34,8 @@ public class OrderGenerator implements CommandLineRunner{
while(orderGenerateFlag){
order=getObjectData(order);
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.registerModule(new JavaTimeModule());
objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
String jsonOrderStr = objectMapper.writeValueAsString(order);
System.out.println(jsonOrderStr);
}
......@@ -37,8 +43,10 @@ public class OrderGenerator implements CommandLineRunner{
public Order getObjectData(Order order2) {
LocalDateTime currentTime = LocalDateTime.now();
order.setOrderNum(rdg.generateOrderNumber());
order.setCustomerId(rdg.generateCustomerId());
order.setOrderDate(currentTime);
order.setLineItem(rdg.genetateLineItem(order.getLineItem()));
return order;
}
......
package com.nisum.omd.domain;
import java.time.LocalDateTime;
import java.util.Map;
import org.springframework.stereotype.Component;
......@@ -15,13 +16,10 @@ public class LineItem {
private String productName;
private String itemType;
private boolean shipChrgApplInd;
private String estimatedShipDate;
private LocalDateTime estimatedShipDate;
private Map<String,Object> linePriceInfo;
private Map<String,Object> lineTax;
private String originalLineItemId;
private String vendorUpcCode;
private String brandCode;
private String eligibleReturnLocationCode;
public String getLineItemNumber() {
return lineItemNumber;
}
......@@ -71,10 +69,10 @@ public class LineItem {
public void setShipChrgApplInd(boolean shipChrgApplInd) {
this.shipChrgApplInd = shipChrgApplInd;
}
public String getEstimatedShipDate() {
public LocalDateTime getEstimatedShipDate() {
return estimatedShipDate;
}
public void setEstimatedShipDate(String estimatedShipDate) {
public void setEstimatedShipDate(LocalDateTime estimatedShipDate) {
this.estimatedShipDate = estimatedShipDate;
}
public Map<String, Object> getLinePriceInfo() {
......@@ -89,30 +87,5 @@ public class LineItem {
public void setLineTax(Map<String, Object> lineTax) {
this.lineTax = lineTax;
}
public String getOriginalLineItemId() {
return originalLineItemId;
}
public void setOriginalLineItemId(String originalLineItemId) {
this.originalLineItemId = originalLineItemId;
}
public String getVendorUpcCode() {
return vendorUpcCode;
}
public void setVendorUpcCode(String vendorUpcCode) {
this.vendorUpcCode = vendorUpcCode;
}
public String getBrandCode() {
return brandCode;
}
public void setBrandCode(String brandCode) {
this.brandCode = brandCode;
}
public String getEligibleReturnLocationCode() {
return eligibleReturnLocationCode;
}
public void setEligibleReturnLocationCode(String eligibleReturnLocationCode) {
this.eligibleReturnLocationCode = eligibleReturnLocationCode;
}
}
package com.nisum.omd.domain;
import java.time.LocalDateTime;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
......@@ -9,7 +11,7 @@ public class Order {
private String orderNum;
private String orderDate;
private LocalDateTime orderDate;
private String currency;
private String shipMethod;
private String customerId;
......@@ -45,11 +47,11 @@ public class Order {
this.orderNum = orderNum;
}
public String getOrderDate() {
public LocalDateTime getOrderDate() {
return orderDate;
}
public void setOrderDate(String orderDate) {
public void setOrderDate(LocalDateTime orderDate) {
this.orderDate = orderDate;
}
......
......@@ -3,17 +3,17 @@ package com.nisum.omd.domain;
import java.util.Map;
public class PaymentMethod {
private String paymetMethod;
private String paymentMethod;
private String creditCardNo;
private String creditCardType;
private String displayCreditCardNo;
private String paymentStatus;
private Map<String,Object> paymentDetail;
public String getPaymetMethod() {
return paymetMethod;
public String getPaymentMethod() {
return paymentMethod;
}
public void setPaymetMethod(String paymetMethod) {
this.paymetMethod = paymetMethod;
public void setPaymentMethod(String paymentMethod) {
this.paymentMethod = paymentMethod;
}
public String getCreditCardNo() {
return creditCardNo;
......
......@@ -6,7 +6,6 @@ import java.util.Random;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import com.github.javafaker.Faker;
......@@ -35,13 +34,6 @@ public class RandomDataGeneratorImpl implements RandomDataGenerator {
return String.valueOf(fk.number().numberBetween(1, 1000));
}
@GetMapping("/orderDate")
public String getOrderDate()
{
return order.getOrderDate();
}
@Override
public LineItem genetateLineItem(LineItem li) {
List<String> productname = new ArrayList<String>();
......@@ -56,6 +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));
return li;
}
......
app.orderDate=2020-04-26T13:33:15.657-05:00
app.currency=INR
app.shipMethod=1
app.customerType=01
......@@ -18,7 +17,6 @@ app.lineItem.size=6
app.lineItem.orderedQty=2
app.lineItem.itemType=7
app.lineItem.shipChrgApplInd=true
app.lineItem.estimatedShipDate=2020-04-26T00:00:00-05:00
app.lineItem.linePriceInfo.listPrice=29.50
app.lineItem.linePriceInfo.retailPrice=29.50
app.lineItem.linePriceInfo.unitPrice=20.00
......
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