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
382539ab
Commit
382539ab
authored
May 04, 2020
by
Ramakanth Dhane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
omd-dashboard added logic to display static weekly orders
parent
d643ba93
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
135 deletions
+48
-135
OrdersController.java
...main/java/com/nisum/omd/controllers/OrdersController.java
+0
-96
OrdersSummaryController.java
...va/com/nisum/omd/controllers/OrdersSummaryController.java
+11
-1
WeeklyOrders.java
...oard/src/main/java/com/nisum/omd/models/WeeklyOrders.java
+0
-35
OrdersSummaryService.java
...main/java/com/nisum/omd/service/OrdersSummaryService.java
+4
-1
OrdersSummaryServiceImpl.java
.../java/com/nisum/omd/service/OrdersSummaryServiceImpl.java
+33
-2
No files found.
omd-dashboard/src/main/java/com/nisum/omd/controllers/OrdersController.java
deleted
100755 → 0
View file @
d643ba93
package
com
.
nisum
.
omd
.
controllers
;
import
java.math.BigDecimal
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
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
;
import
com.nisum.omd.models.OrdersSummary
;
import
com.nisum.omd.models.WeeklyOrders
;
import
com.nisum.omd.security.services.OrderService
;
import
com.nisum.omd.security.services.UserDetailsImpl
;
import
com.nisum.omd.service.OrdersSummaryService
;
import
com.nisum.omd.pojo.*
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
@CrossOrigin
(
origins
=
"*"
,
maxAge
=
3600
)
@RestController
@RequestMapping
(
"/api/test"
)
public
class
OrdersController
{
static
Long
dailyOrders
=
new
Long
(
0
);
static
Long
hoursOrders
=
new
Long
(
0
);
static
Long
minutesOrders
=
new
Long
(
0
);
static
Long
customers
=
new
Long
(
100
);
@Autowired
OrderService
service
;
@Autowired
OrdersSummaryService
ordersSummaryService
;
@GetMapping
(
value
=
"/getOrdersSummary"
,
produces
=
"application/vnd.jcg.api.v1+json"
)
public
OrdersSummary
getOrdersCount
()
{
DateTimeFormatter
dtf
=
DateTimeFormatter
.
ofPattern
(
"yyyy/MM/dd HH:mm:ss"
);
LocalDateTime
now
=
LocalDateTime
.
now
();
System
.
out
.
println
(
"getOrdersCount:::called at:::"
+
dtf
.
format
(
now
));
OrdersSummary
ordersSummary
=
new
OrdersSummary
();
ordersSummary
.
setToday_orders
(++
dailyOrders
);
ordersSummary
.
setToday_date
(
"04/28/2020"
);
ordersSummary
.
setCurrent_hour_orders
(++
hoursOrders
);
ordersSummary
.
setCurrent_hour
(
"12"
);
ordersSummary
.
setCurrent_minute_orders
(++
minutesOrders
);
ordersSummary
.
setCurrent_minute
(
"36"
);
ordersSummary
.
setCustomers_count
(++
customers
);
return
ordersSummary
;
}
@GetMapping
(
value
=
"/getTopOrders"
,
produces
=
"application/json"
)
public
List
<
OrdersSummary
>
getTopOrders
()
{
System
.
out
.
println
(
"getTopOrders Called."
);
return
service
.
getTopOrders
();
}
@GetMapping
(
value
=
"/getWeekOrders"
,
produces
=
"application/json"
)
public
List
<
WeeklyOrders
>
getWeekOrders
()
{
System
.
out
.
println
(
"getWeekOrders Called."
);
List
<
WeeklyOrders
>
list
=
new
ArrayList
<
WeeklyOrders
>();
WeeklyOrders
weeklyOrders1
=
new
WeeklyOrders
(
new
Date
(),
new
Long
(
12548
));
WeeklyOrders
weeklyOrders2
=
new
WeeklyOrders
(
new
Date
(),
new
Long
(
25415
));
list
.
add
(
weeklyOrders1
);
list
.
add
(
weeklyOrders2
);
return
list
;
}
@GetMapping
(
"/orderCount"
)
public
com
.
nisum
.
omd
.
pojo
.
OrdersSummary
getOrderSummary
(){
com
.
nisum
.
omd
.
pojo
.
OrdersSummary
ordersSummary
=
ordersSummaryService
.
getOrderSummaryCount
();
return
ordersSummary
;
}
@GetMapping
(
"/weeklyCount"
)
public
Map
<
LocalDate
,
Long
>
getWeeklyOrderSummary
(){
Map
<
LocalDate
,
Long
>
ordersSummary
=
ordersSummaryService
.
getOrderSummaryInWeek
();
return
ordersSummary
;
}
}
omd-dashboard/src/main/java/com/nisum/omd/controllers/OrdersSummaryController.java
View file @
382539ab
package
com
.
nisum
.
omd
.
controllers
;
import
java.time.LocalDate
;
import
java.util.List
;
import
java.util.Map
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -8,6 +9,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.nisum.omd.dto.WeeklyOrders
;
import
com.nisum.omd.pojo.OrdersSummary
;
import
com.nisum.omd.service.OrdersSummaryService
;
...
...
@@ -24,13 +26,21 @@ 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
();
return
ordersSummary
;
}
}
omd-dashboard/src/main/java/com/nisum/omd/models/WeeklyOrders.java
deleted
100755 → 0
View file @
d643ba93
package
com
.
nisum
.
omd
.
models
;
import
java.util.Date
;
public
class
WeeklyOrders
{
private
Date
oderDate
;
private
Long
orderCount
;
public
WeeklyOrders
(
Date
oderDate
,
Long
orderCount
)
{
super
();
this
.
oderDate
=
oderDate
;
this
.
orderCount
=
orderCount
;
}
@Override
public
String
toString
()
{
return
"WeeklyOrders [oderDate="
+
oderDate
+
", orderCount="
+
orderCount
+
"]"
;
}
public
Date
getOderDate
()
{
return
oderDate
;
}
public
void
setOderDate
(
Date
oderDate
)
{
this
.
oderDate
=
oderDate
;
}
public
Long
getOrderCount
()
{
return
orderCount
;
}
public
void
setOrderCount
(
Long
orderCount
)
{
this
.
orderCount
=
orderCount
;
}
}
omd-dashboard/src/main/java/com/nisum/omd/service/OrdersSummaryService.java
View file @
382539ab
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
;
public
interface
OrdersSummaryService
{
OrdersSummary
getOrderSummaryCount
();
Map
<
LocalDate
,
Long
>
getOrderSummaryInWeek
();
// Map<LocalDate,Long> getOrderSummaryInWeek();
List
<
WeeklyOrders
>
getOrderSummaryInWeek
();
}
...
...
omd-dashboard/src/main/java/com/nisum/omd/service/OrdersSummaryServiceImpl.java
View file @
382539ab
...
...
@@ -6,7 +6,9 @@ import java.time.LocalDate;
import
java.time.LocalDateTime
;
import
java.time.LocalTime
;
import
java.time.ZoneId
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.TreeMap
;
...
...
@@ -14,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.stereotype.Service
;
import
com.nisum.omd.dto.WeeklyOrders
;
import
com.nisum.omd.pojo.OrdersSummary
;
import
com.nisum.omd.repository.DynamicQuery
;
import
com.nisum.omd.repository.OrdersSummaryRepository
;
...
...
@@ -119,7 +122,7 @@ public class OrdersSummaryServiceImpl implements OrdersSummaryService {
}
private
Map
<
LocalDate
,
Long
>
orderCountInCustomDate
(){
/*
private Map<LocalDate, Long> orderCountInCustomDate(){
Integer weekCount = 6;
TreeMap<LocalDate, Long> hm = new TreeMap<>();
...
...
@@ -151,6 +154,27 @@ public class OrdersSummaryServiceImpl implements OrdersSummaryService {
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
);
return
orders
;
}
public
OrdersSummary
getOrderSummaryCount
(){
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"MM-dd-YYYY"
);
LocalDateTime
localTime
=
LocalDateTime
.
now
();
...
...
@@ -170,9 +194,16 @@ public class OrdersSummaryServiceImpl implements OrdersSummaryService {
@Override
/*
@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