Compare commits
4 Commits
1e26d750ff
...
a6a4d1e382
Author | SHA1 | Date | |
---|---|---|---|
a6a4d1e382 | |||
a4685cbf50 | |||
d6687f97f1 | |||
0d8fa5efb1 |
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.infra.clients;
|
|||||||
|
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -9,5 +10,11 @@ import java.util.Map;
|
|||||||
@FeignClient("datacenter-server")
|
@FeignClient("datacenter-server")
|
||||||
public interface LargeScreenClient {
|
public interface LargeScreenClient {
|
||||||
@GetMapping("/api/asset/type")
|
@GetMapping("/api/asset/type")
|
||||||
List<Object> assetMethod1();
|
Object assetMethod1();
|
||||||
|
|
||||||
|
@GetMapping("/api/saledata")
|
||||||
|
Object saleDataTotal(@RequestParam("starTime") String starTime, @RequestParam("endTime") String endTime);
|
||||||
|
|
||||||
|
@GetMapping("/api/checkticket")
|
||||||
|
Object checkTicketTotal(@RequestParam("starTime") String starTime, @RequestParam("endTime") String endTime);
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.infra.controller.admin.ticketing;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.date.TickingDateUtils;
|
import cn.iocoder.yudao.framework.common.util.date.TickingDateUtils;
|
||||||
|
import cn.iocoder.yudao.module.infra.api.websocket.WebSocketSenderApi;
|
||||||
|
import cn.iocoder.yudao.module.infra.clients.LargeScreenClient;
|
||||||
import cn.iocoder.yudao.module.infra.job.ticketing.TicketDataMigration;
|
import cn.iocoder.yudao.module.infra.job.ticketing.TicketDataMigration;
|
||||||
import cn.iocoder.yudao.module.infra.service.checkticket.CheckTicketService;
|
import cn.iocoder.yudao.module.infra.service.checkticket.CheckTicketService;
|
||||||
import cn.iocoder.yudao.module.infra.service.saledata.SaleDataService;
|
import cn.iocoder.yudao.module.infra.service.saledata.SaleDataService;
|
||||||
@ -10,9 +12,10 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Calendar;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description 测试抽数接口
|
* @Description 测试抽数接口
|
||||||
@ -31,6 +34,12 @@ public class TicketingController {
|
|||||||
@Resource
|
@Resource
|
||||||
SaleDataService saleDataService;
|
SaleDataService saleDataService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WebSocketSenderApi webSocketSenderApi;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private LargeScreenClient largeScreenClient;
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public CommonResult<String> testTicketing(@RequestParam("startDate") String startDate, @RequestParam("endDate")String endDate, @RequestParam("method") String method) throws Exception {
|
public CommonResult<String> testTicketing(@RequestParam("startDate") String startDate, @RequestParam("endDate")String endDate, @RequestParam("method") String method) throws Exception {
|
||||||
Calendar startCalendar = Calendar.getInstance();
|
Calendar startCalendar = Calendar.getInstance();
|
||||||
@ -39,10 +48,29 @@ public class TicketingController {
|
|||||||
endCalendar.setTime(TickingDateUtils.parse(endDate));
|
endCalendar.setTime(TickingDateUtils.parse(endDate));
|
||||||
return CommonResult.success(ticketDataMigration.getTicketDataByTimeZonesToMongo(startCalendar, endCalendar, method));
|
return CommonResult.success(ticketDataMigration.getTicketDataByTimeZonesToMongo(startCalendar, endCalendar, method));
|
||||||
}
|
}
|
||||||
@GetMapping("/test")
|
@GetMapping("/test1")
|
||||||
public CommonResult<List<String>> testAll(){
|
public CommonResult<List<String>> testAll(){
|
||||||
return CommonResult.success(checkTicketService.deleteTwoYearLastMonthAgo());
|
return CommonResult.success(checkTicketService.deleteTwoYearLastMonthAgo());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void methodUtils(Map<String, Object> map, String name, Object list){
|
||||||
|
map.put(name,list);
|
||||||
|
}
|
||||||
|
private String methodDataUtils(){
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
return now.format(formatter);
|
||||||
|
}
|
||||||
|
@GetMapping("/test")
|
||||||
|
public void test(){
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
String dataUtils = this.methodDataUtils();
|
||||||
|
this.methodUtils(map, "assetCount", largeScreenClient.assetMethod1());
|
||||||
|
this.methodUtils(map,"saleDataTotal",largeScreenClient.saleDataTotal(dataUtils,dataUtils));
|
||||||
|
this.methodUtils(map,"checkTicketTotal",largeScreenClient.checkTicketTotal(dataUtils,dataUtils));
|
||||||
|
webSocketSenderApi.sendObject(2,1L,"1",map);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/testa")
|
@GetMapping("/testa")
|
||||||
public CommonResult<List<String>> testAlla(){
|
public CommonResult<List<String>> testAlla(){
|
||||||
return CommonResult.success(saleDataService.deleteTwoYearLastMonthAgo());
|
return CommonResult.success(saleDataService.deleteTwoYearLastMonthAgo());
|
||||||
|
@ -7,6 +7,9 @@ import com.xxl.job.core.handler.annotation.XxlJob;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -19,10 +22,25 @@ public class LargeScreenHeartbeat {
|
|||||||
@Resource
|
@Resource
|
||||||
private LargeScreenClient largeScreenClient;
|
private LargeScreenClient largeScreenClient;
|
||||||
|
|
||||||
|
|
||||||
|
private void methodUtils(Map<String, Object> map, String name, Object list){
|
||||||
|
map.put(name,list);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String methodDataUtils(){
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
return now.format(formatter);
|
||||||
|
}
|
||||||
|
|
||||||
@XxlJob("largeScreen")
|
@XxlJob("largeScreen")
|
||||||
public void largeScreenToWebSocket(){
|
public void largeScreenToWebSocket(){
|
||||||
List<Object> maps = largeScreenClient.assetMethod1();
|
Map<String, Object> map = new HashMap<>();
|
||||||
webSocketSenderApi.sendObject(1,"1",maps);
|
String dataUtils = this.methodDataUtils();
|
||||||
|
this.methodUtils(map, "assetCount", largeScreenClient.assetMethod1());
|
||||||
|
this.methodUtils(map,"saleDataTotal",largeScreenClient.saleDataTotal(dataUtils,dataUtils));
|
||||||
|
this.methodUtils(map,"checkTicketTotal",largeScreenClient.checkTicketTotal(dataUtils,dataUtils));
|
||||||
|
webSocketSenderApi.sendObject(2,1L,"1",map);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user