Merge pull request '大屏接口改造' (#51) from zzw-one into master
Some checks failed
continuous-integration/drone/tag Build is failing
continuous-integration/drone Build is failing

Reviewed-on: #51
This commit is contained in:
root 2024-08-28 11:31:21 +08:00
commit 7dd0b85d36
4 changed files with 12 additions and 3 deletions

View File

@ -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");
// }
}

View File

@ -5,5 +5,5 @@ import lombok.Data;
@Data
public class SaleDataItemTypeVo {
// private String itemtype;
private String itemtypename;
private String itemname;
}

View File

@ -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 }")

View File

@ -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<>();