大屏接口改造
This commit is contained in:
parent
c3026428fa
commit
6606826273
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.datacenter.controller.app.saledata;
|
||||
|
||||
import cn.iocoder.yudao.module.datacenter.service.saledata.SaleDataService;
|
||||
import cn.iocoder.yudao.module.infra.api.websocket.WebSocketSenderApi;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@ -26,6 +27,8 @@ import java.util.regex.Pattern;
|
||||
public class SaleDataApi {
|
||||
@Resource
|
||||
private SaleDataService saleDataService;
|
||||
// @Resource
|
||||
// private WebSocketSenderApi webSocketSenderApi;
|
||||
|
||||
@GetMapping()
|
||||
@Operation(summary = "获得输入日期的当天总售票数")
|
||||
@ -138,4 +141,10 @@ public class SaleDataApi {
|
||||
return saleDataService.findyearJun(saleDataService.findEventsLastYear());
|
||||
}
|
||||
|
||||
// @GetMapping("/test")
|
||||
// public void testMethod(){
|
||||
//
|
||||
// webSocketSenderApi.sendObject("1","1","666");
|
||||
// }
|
||||
|
||||
}
|
||||
|
@ -5,5 +5,5 @@ import lombok.Data;
|
||||
@Data
|
||||
public class SaleDataItemTypeVo {
|
||||
// private String itemtype;
|
||||
private String itemtypename;
|
||||
private String itemname;
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public interface SaleDataRepository extends MongoRepository<SaleData,String> {
|
||||
@Query(value = "{}", fields = "{ 'itemtypename': 1 }")
|
||||
List<SaleDataItemTypeVo> findAllByItemtypename();
|
||||
|
||||
@Query(value = "{'sddate': { $gte: ?0, $lt: ?1 }}", fields = "{ 'itemtypename': 1 }")
|
||||
@Query(value = "{'sddate': { $gte: ?0, $lt: ?1 }}", fields = "{ 'itemname': 1 }")
|
||||
List<SaleDataItemTypeVo> findAllByItemtypenameTime(String starTime, String endTime);
|
||||
|
||||
@Query(value = "{'sddate': { $gte: ?0, $lt: ?1 }}", fields = "{ 'transactiontypeno': 1 }")
|
||||
|
@ -256,7 +256,7 @@ public class SaleDataServiceImpl implements SaleDataService {
|
||||
public List<Map<String, String>> findByDoItemType(String starTime, String endTime) {
|
||||
List<SaleDataItemTypeVo> list = saleDataRepository.findAllByItemtypenameTime(starTime, this.publicMethod(endTime));
|
||||
Map<String, Long> countMap = list.stream()
|
||||
.collect(Collectors.groupingBy(SaleDataItemTypeVo::getItemtypename, Collectors.counting()));
|
||||
.collect(Collectors.groupingBy(SaleDataItemTypeVo::getItemname, Collectors.counting()));
|
||||
List<Map<String, String>> mapArrayList = new ArrayList<>();
|
||||
for (String s : countMap.keySet()) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
|
Loading…
Reference in New Issue
Block a user