Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
orders-monitoring-dashboard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ramakanth Dhane
orders-monitoring-dashboard
Commits
aa7f2c24
Commit
aa7f2c24
authored
May 04, 2020
by
Ramakanth Dhane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed test data from dashboard
parent
96c532dd
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
36 additions
and
93 deletions
+36
-93
OrderGenerator.java
...t-service/src/main/java/com/nisum/omd/OrderGenerator.java
+0
-2
OmdProducerConfig.java
...src/main/java/com/nisum/omd/config/OmdProducerConfig.java
+5
-0
RandomDataGeneratorImpl.java
...n/java/com/nisum/omd/service/RandomDataGeneratorImpl.java
+2
-1
OrdersSummaryController.java
...va/com/nisum/omd/controllers/OrdersSummaryController.java
+2
-11
OrdersSummaryService.java
...main/java/com/nisum/omd/service/OrdersSummaryService.java
+0
-3
OrdersSummaryServiceImpl.java
.../java/com/nisum/omd/service/OrdersSummaryServiceImpl.java
+27
-76
No files found.
omd-checkout-service/src/main/java/com/nisum/omd/OrderGenerator.java
View file @
aa7f2c24
package
com
.
nisum
.
omd
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.ZoneId
;
import
java.time.format.DateTimeFormatter
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.concurrent.CompletableFuture
;
...
...
omd-checkout-service/src/main/java/com/nisum/omd/config/OmdProducerConfig.java
View file @
aa7f2c24
package
com
.
nisum
.
omd
.
config
;
import
com.github.javafaker.Faker
;
import
com.nisum.omd.domain.Order
;
import
org.apache.kafka.clients.producer.ProducerConfig
;
import
org.apache.kafka.common.serialization.StringSerializer
;
...
...
@@ -36,4 +37,8 @@ public class OmdProducerConfig {
public
KafkaTemplate
<
String
,
Order
>
kafkaTemplate
(){
return
new
KafkaTemplate
<>(
producerFactory
());
}
@Bean
public
Faker
getFaker
()
{
return
new
Faker
();
}
}
omd-checkout-service/src/main/java/com/nisum/omd/service/RandomDataGeneratorImpl.java
View file @
aa7f2c24
...
...
@@ -19,7 +19,8 @@ public class RandomDataGeneratorImpl implements RandomDataGenerator {
@Autowired
private
Order
order
;
private
Faker
faker
=
new
Faker
();
@Autowired
private
Faker
faker
;
public
String
generateOrderNumber
()
{
return
String
.
valueOf
(
faker
.
number
().
numberBetween
(
1000000
,
9999999
));
...
...
omd-dashboard/src/main/java/com/nisum/omd/controllers/OrdersSummaryController.java
View file @
aa7f2c24
package
com
.
nisum
.
omd
.
controllers
;
import
java.time.LocalDate
;
import
java.util.List
;
import
java.util.Map
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.CrossOrigin
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
...
...
@@ -13,7 +12,7 @@ import com.nisum.omd.dto.WeeklyOrders;
import
com.nisum.omd.pojo.OrdersSummary
;
import
com.nisum.omd.service.OrdersSummaryService
;
@CrossOrigin
(
origins
=
"*"
,
maxAge
=
3600
)
@RestController
@RequestMapping
(
"orders"
)
public
class
OrdersSummaryController
{
...
...
@@ -26,14 +25,6 @@ public class OrdersSummaryController {
OrdersSummary
ordersSummary
=
ordersSummaryService
.
getOrderSummaryCount
();
return
ordersSummary
;
}
/*
@GetMapping("/weeklyCount")
public Map<LocalDate, Long> getWeeklyOrderSummary(){
Map<LocalDate, Long> ordersSummary=ordersSummaryService.getOrderSummaryInWeek();
return ordersSummary;
} */
@GetMapping
(
"/weeklyCount"
)
public
List
<
WeeklyOrders
>
getWeeklyOrderSummary
(){
List
<
WeeklyOrders
>
ordersSummary
=
ordersSummaryService
.
getOrderSummaryInWeek
();
...
...
omd-dashboard/src/main/java/com/nisum/omd/service/OrdersSummaryService.java
View file @
aa7f2c24
package
com
.
nisum
.
omd
.
service
;
import
java.time.LocalDate
;
import
java.util.List
;
import
java.util.Map
;
import
com.nisum.omd.dto.WeeklyOrders
;
import
com.nisum.omd.pojo.OrdersSummary
;
...
...
@@ -10,7 +8,6 @@ import com.nisum.omd.pojo.OrdersSummary;
public
interface
OrdersSummaryService
{
OrdersSummary
getOrderSummaryCount
();
// Map<LocalDate,Long> getOrderSummaryInWeek();
List
<
WeeklyOrders
>
getOrderSummaryInWeek
();
}
...
...
omd-dashboard/src/main/java/com/nisum/omd/service/OrdersSummaryServiceImpl.java
View file @
aa7f2c24
...
...
@@ -125,60 +125,36 @@ public class OrdersSummaryServiceImpl implements OrdersSummaryService {
}
/* private Map<LocalDate, Long> orderCountInCustomDate(){
Integer weekCount = 6;
TreeMap<LocalDate, Long> hm = new TreeMap<>();
for(int i=weekCount; i >=0; i--) {
LocalTime fromdt = LocalTime.of(00, 00,00);
LocalTime todt = LocalTime.of(23, 59,59);
Instant instant = fromdt.atDate(LocalDate.now().minusDays(i)).
atZone(ZoneId.systemDefault()).toInstant();
Date time1 = Date.from(instant);
Long fromDate=time1.getTime();
Instant instant2 = todt.atDate(LocalDate.now().minusDays(i)).
atZone(ZoneId.systemDefault()).toInstant();
Date time2 = Date.from(instant2);
Long toDate=time2.getTime();
DynamicQuery dynamicQuery = new DynamicQuery();
dynamicQuery.setOrderDateFrom(fromDate);
dynamicQuery.setOrderDateTo(toDate);
Long orderCount = ordersSummaryRepository.query(dynamicQuery);
LocalDate formattedFromDate =
Instant.ofEpochMilli(fromDate).atZone(ZoneId.systemDefault()).toLocalDate();
hm.put(formattedFromDate, orderCount);
}
return hm;
}
*/
private
List
<
WeeklyOrders
>
orderCountInCustomDate
()
{
List
<
WeeklyOrders
>
orders
=
new
ArrayList
<>();
WeeklyOrders
order1
=
new
WeeklyOrders
(
LocalDate
.
now
()
+
""
,
900L
);
WeeklyOrders
order2
=
new
WeeklyOrders
(
LocalDate
.
now
().
minusDays
(
1
)
+
""
,
100L
);
WeeklyOrders
order3
=
new
WeeklyOrders
(
LocalDate
.
now
().
minusDays
(
2
)
+
""
,
200L
);
WeeklyOrders
order4
=
new
WeeklyOrders
(
LocalDate
.
now
().
minusDays
(
3
)
+
""
,
300L
);
WeeklyOrders
order5
=
new
WeeklyOrders
(
LocalDate
.
now
().
minusDays
(
4
)
+
""
,
400L
);
WeeklyOrders
order6
=
new
WeeklyOrders
(
LocalDate
.
now
().
minusDays
(
5
)
+
""
,
500L
);
WeeklyOrders
order7
=
new
WeeklyOrders
(
LocalDate
.
now
().
minusDays
(
6
)
+
""
,
600L
);
orders
.
add
(
order1
);
orders
.
add
(
order2
);
orders
.
add
(
order3
);
orders
.
add
(
order4
);
orders
.
add
(
order5
);
orders
.
add
(
order6
);
orders
.
add
(
order7
);
Integer
weekCount
=
6
;
for
(
int
i
=
weekCount
;
i
>=
0
;
i
--)
{
LocalTime
fromdt
=
LocalTime
.
of
(
00
,
00
,
00
);
LocalTime
todt
=
LocalTime
.
of
(
23
,
59
,
59
);
Instant
instant
=
fromdt
.
atDate
(
LocalDate
.
now
().
minusDays
(
i
)).
atZone
(
ZoneId
.
systemDefault
()).
toInstant
();
Date
time1
=
Date
.
from
(
instant
);
Long
fromDate
=
time1
.
getTime
();
Instant
instant2
=
todt
.
atDate
(
LocalDate
.
now
().
minusDays
(
i
)).
atZone
(
ZoneId
.
systemDefault
()).
toInstant
();
Date
time2
=
Date
.
from
(
instant2
);
Long
toDate
=
time2
.
getTime
();
DynamicQuery
dynamicQuery
=
new
DynamicQuery
();
dynamicQuery
.
setOrderDateFrom
(
fromDate
);
dynamicQuery
.
setOrderDateTo
(
toDate
);
Long
orderCount
=
ordersSummaryRepository
.
query
(
dynamicQuery
);
LocalDate
formattedFromDate
=
Instant
.
ofEpochMilli
(
fromDate
).
atZone
(
ZoneId
.
systemDefault
()).
toLocalDate
();
WeeklyOrders
order
=
new
WeeklyOrders
(
formattedFromDate
+
""
,
orderCount
);
orders
.
add
(
order
);
}
return
orders
;
}
/*
public OrdersSummary getOrderSummaryCount(){
public
OrdersSummary
getOrderSummaryCount
(){
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"MM-dd-YYYY"
);
LocalDateTime
localTime
=
LocalDateTime
.
now
();
OrdersSummary
ordersSummary
=
new
OrdersSummary
();
...
...
@@ -191,37 +167,12 @@ public class OrdersSummaryServiceImpl implements OrdersSummaryService {
ordersSummary
.
setCurrentDate
(
simpleDateFormat
.
format
(
new
Date
()));
return
ordersSummary
;
}
*/
public
OrdersSummary
getOrderSummaryCount
(){
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"MM-dd-YYYY"
);
LocalDateTime
localTime
=
LocalDateTime
.
now
();
OrdersSummary
ordersSummary
=
new
OrdersSummary
();
ordersSummary
.
setOrderCountInMinute
(++
minuteCount
);
ordersSummary
.
setOrderCountInHour
(++
HrCount
);
ordersSummary
.
setOrderCountInDay
(++
dayCount
);
ordersSummary
.
setTotalCustomers
(++
cutomers
);
ordersSummary
.
setCurrentMinute
(
LocalTime
.
of
(
localTime
.
getHour
(),
localTime
.
getMinute
(),
00
).
toString
());
ordersSummary
.
setCurrentHour
(
LocalTime
.
of
(
localTime
.
getHour
(),
00
,
00
).
toString
());
ordersSummary
.
setCurrentDate
(
simpleDateFormat
.
format
(
new
Date
()));
return
ordersSummary
;
}
/* @Override
public Map<LocalDate, Long> getOrderSummaryInWeek() {
return orderCountInCustomDate();
}
*/
@Override
public
List
<
WeeklyOrders
>
getOrderSummaryInWeek
()
{
return
orderCountInCustomDate
();
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment