Commit c6cd8a62 authored by Ramakanth Dhane's avatar Ramakanth Dhane

Security changes

parent 105f3a03
...@@ -15,7 +15,7 @@ import com.nisum.omd.service.OrdersSummaryService; ...@@ -15,7 +15,7 @@ import com.nisum.omd.service.OrdersSummaryService;
@RestController @RestController
@RequestMapping("api") @RequestMapping("orders")
public class OrdersSummaryController { public class OrdersSummaryController {
@Autowired @Autowired
......
...@@ -59,7 +59,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -59,7 +59,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
.exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and() .exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and()
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and() .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
.authorizeRequests().antMatchers("/api/auth/**").permitAll() .authorizeRequests().antMatchers("/api/auth/**").permitAll()
.antMatchers("/api/test/**").permitAll() .antMatchers("/orders/**").permitAll()
.anyRequest().authenticated(); .anyRequest().authenticated();
http.addFilterBefore(authenticationJwtTokenFilter(), UsernamePasswordAuthenticationFilter.class); http.addFilterBefore(authenticationJwtTokenFilter(), UsernamePasswordAuthenticationFilter.class);
......
...@@ -30,7 +30,10 @@ public class OrdersSummaryServiceImpl implements OrdersSummaryService { ...@@ -30,7 +30,10 @@ public class OrdersSummaryServiceImpl implements OrdersSummaryService {
@Autowired @Autowired
private OrdersSummaryRepository ordersSummaryRepository; private OrdersSummaryRepository ordersSummaryRepository;
static long minuteCount = 0;
static long HrCount = 0;
static long dayCount = 0;
static int cutomers = 0;
private Long orderCountInMinute(){ private Long orderCountInMinute(){
...@@ -175,7 +178,7 @@ public class OrdersSummaryServiceImpl implements OrdersSummaryService { ...@@ -175,7 +178,7 @@ public class OrdersSummaryServiceImpl implements OrdersSummaryService {
return orders; return orders;
} }
public OrdersSummary getOrderSummaryCount(){ /* public OrdersSummary getOrderSummaryCount(){
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM-dd-YYYY"); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM-dd-YYYY");
LocalDateTime localTime = LocalDateTime.now(); LocalDateTime localTime = LocalDateTime.now();
OrdersSummary ordersSummary=new OrdersSummary(); OrdersSummary ordersSummary=new OrdersSummary();
...@@ -188,7 +191,22 @@ public class OrdersSummaryServiceImpl implements OrdersSummaryService { ...@@ -188,7 +191,22 @@ public class OrdersSummaryServiceImpl implements OrdersSummaryService {
ordersSummary.setCurrentDate(simpleDateFormat.format(new Date())); ordersSummary.setCurrentDate(simpleDateFormat.format(new Date()));
return ordersSummary; 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;
}
......
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