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
bbfdf82c
Commit
bbfdf82c
authored
Apr 30, 2020
by
Hari Krishna Marri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
omd-dashboard backend files
parent
5e5d25aa
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
177 additions
and
4 deletions
+177
-4
OrdersController.java
...main/java/com/nisum/omd/controllers/OrdersController.java
+39
-1
OrdersSummary.java
...ard/src/main/java/com/nisum/omd/models/OrdersSummary.java
+74
-1
WeeklyOrders.java
...oard/src/main/java/com/nisum/omd/models/WeeklyOrders.java
+35
-0
OrderRepository.java
...c/main/java/com/nisum/omd/repository/OrderRepository.java
+3
-2
OrderService.java
...in/java/com/nisum/omd/security/services/OrderService.java
+20
-0
UserDetailsServiceImpl.java
...m/nisum/omd/security/services/UserDetailsServiceImpl.java
+6
-0
No files found.
omd-dashboard/src/main/java/com/nisum/omd/controllers/OrdersController.java
View file @
bbfdf82c
package
com
.
nisum
.
omd
.
controllers
;
import
java.math.BigDecimal
;
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
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
@CrossOrigin
(
origins
=
"*"
,
maxAge
=
3600
)
...
...
@@ -19,7 +28,11 @@ public class OrdersController {
static
Long
hoursOrders
=
new
Long
(
0
);
static
Long
minutesOrders
=
new
Long
(
0
);
static
Long
customers
=
new
Long
(
100
);
@GetMapping
(
value
=
"/getOrdersSummary"
,
produces
=
"application/vnd.jcg.api.v1+json"
)
@Autowired
OrderService
service
;
@GetMapping
(
value
=
"/getOrdersSummary"
,
produces
=
"application/vnd.jcg.api.v1+json"
)
public
OrdersSummary
getOrdersCount
()
{
DateTimeFormatter
dtf
=
DateTimeFormatter
.
ofPattern
(
"yyyy/MM/dd HH:mm:ss"
);
...
...
@@ -37,5 +50,30 @@ public class OrdersController {
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
;
}
}
omd-dashboard/src/main/java/com/nisum/omd/models/OrdersSummary.java
View file @
bbfdf82c
package
com
.
nisum
.
omd
.
models
;
import
java.math.BigDecimal
;
import
org.springframework.data.annotation.Id
;
import
org.springframework.data.mongodb.core.mapping.Document
;
@Document
(
collection
=
"orders"
)
public
class
OrdersSummary
{
private
Long
id
;
private
Long
_id
;
private
Long
today_orders
;
private
String
today_date
;
private
String
current_hour
;
...
...
@@ -11,6 +18,26 @@ public class OrdersSummary {
private
Long
current_minute_orders
;
private
Long
customers_count
;
private
String
orderNum
;
private
String
customerId
;
private
BigDecimal
orderPrice
;
private
String
orderDate
;
private
String
productName
;
private
int
orderedQty
;
public
OrdersSummary
(
String
orderNum
,
String
customerId
,
BigDecimal
orderPrice
,
String
orderDate
,
String
productName
,
int
orderedQty
)
{
super
();
this
.
orderNum
=
orderNum
;
this
.
customerId
=
customerId
;
this
.
orderPrice
=
orderPrice
;
this
.
orderDate
=
orderDate
;
this
.
productName
=
productName
;
this
.
orderedQty
=
orderedQty
;
}
public
Long
getToday_orders
()
{
return
today_orders
;
}
...
...
@@ -20,6 +47,9 @@ public class OrdersSummary {
public
String
getToday_date
()
{
return
today_date
;
}
public
OrdersSummary
()
{
super
();
}
public
void
setToday_date
(
String
today_date
)
{
this
.
today_date
=
today_date
;
}
...
...
@@ -53,6 +83,49 @@ public class OrdersSummary {
public
void
setCustomers_count
(
Long
customers_count
)
{
this
.
customers_count
=
customers_count
;
}
public
Long
getId
()
{
return
_id
;
}
public
void
setId
(
Long
_id
)
{
this
.
_id
=
_id
;
}
public
String
getOrderNum
()
{
return
orderNum
;
}
public
void
setOrderNum
(
String
orderNum
)
{
this
.
orderNum
=
orderNum
;
}
public
String
getCustomerId
()
{
return
customerId
;
}
public
void
setCustomerId
(
String
customerId
)
{
this
.
customerId
=
customerId
;
}
public
BigDecimal
getOrderPrice
()
{
return
orderPrice
;
}
public
void
setOrderPrice
(
BigDecimal
orderPrice
)
{
this
.
orderPrice
=
orderPrice
;
}
public
String
getOrderDate
()
{
return
orderDate
;
}
public
void
setOrderDate
(
String
orderDate
)
{
this
.
orderDate
=
orderDate
;
}
public
String
getProductName
()
{
return
productName
;
}
public
void
setProductName
(
String
productName
)
{
this
.
productName
=
productName
;
}
public
int
getOrderedQty
()
{
return
orderedQty
;
}
public
void
setOrderedQty
(
int
orderedQty
)
{
this
.
orderedQty
=
orderedQty
;
}
}
omd-dashboard/src/main/java/com/nisum/omd/models/WeeklyOrders.java
0 → 100644
View file @
bbfdf82c
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/repository/OrderRepository.java
View file @
bbfdf82c
...
...
@@ -2,11 +2,12 @@ package com.nisum.omd.repository;
import
org.springframework.data.mongodb.repository.MongoRepository
;
import
org.springframework.stereotype.Repository
;
import
com.nisum.omd.models.OrdersSummary
;
public
interface
OrderRepository
extends
MongoRepository
<
OrdersSummary
,
Lo
ng
>
{
@Repository
public
interface
OrderRepository
extends
MongoRepository
<
OrdersSummary
,
Stri
ng
>
{
}
omd-dashboard/src/main/java/com/nisum/omd/security/services/OrderService.java
0 → 100644
View file @
bbfdf82c
package
com
.
nisum
.
omd
.
security
.
services
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.nisum.omd.models.OrdersSummary
;
import
com.nisum.omd.repository.OrderRepository
;
@Service
public
class
OrderService
{
@Autowired
OrderRepository
orderRepository
;
public
List
<
OrdersSummary
>
getTopOrders
()
{
return
orderRepository
.
findAll
();
}
}
omd-dashboard/src/main/java/com/nisum/omd/security/services/UserDetailsServiceImpl.java
View file @
bbfdf82c
package
com
.
nisum
.
omd
.
security
.
services
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.core.userdetails.UserDetails
;
import
org.springframework.security.core.userdetails.UserDetailsService
;
...
...
@@ -7,7 +9,9 @@ import org.springframework.security.core.userdetails.UsernameNotFoundException;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.nisum.omd.models.OrdersSummary
;
import
com.nisum.omd.models.User
;
import
com.nisum.omd.repository.OrderRepository
;
import
com.nisum.omd.repository.UserRepository
;
...
...
@@ -15,6 +19,7 @@ import com.nisum.omd.repository.UserRepository;
public
class
UserDetailsServiceImpl
implements
UserDetailsService
{
@Autowired
UserRepository
userRepository
;
@Override
@Transactional
...
...
@@ -25,4 +30,5 @@ public class UserDetailsServiceImpl implements UserDetailsService {
return
UserDetailsImpl
.
build
(
user
);
}
}
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