diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/largeScreen/controller/LargeScreenController.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/largeScreen/controller/LargeScreenController.java index 05a7cb5..73bdb8e 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/largeScreen/controller/LargeScreenController.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/largeScreen/controller/LargeScreenController.java @@ -20,9 +20,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; /** @@ -73,11 +71,16 @@ public class LargeScreenController { @GetMapping("/getLeaseCouples") public AjaxResult getLeaseCouples() { List list = orderMapper.getBuyerAndSellerCouples(); - Map> groupedMap = list.stream() + Map> groupedBuyerMap = list.stream() .collect(Collectors.groupingBy(OrderData::getBuyerCompany)); - List> groupedList = new ArrayList<>(groupedMap.values()); - int randomValue = (int) (Math.random() * groupedList.size()); - return AjaxResult.success(groupedList.get(randomValue)); + List> groupedList = new ArrayList<>(groupedBuyerMap.values()); + int randomIndex = (int) (Math.random() * groupedList.size()); + List orderDataList = groupedList.get(randomIndex); + Map> resultMap = new HashMap(); + Map sellerCount = orderDataList.stream() + .collect(Collectors.groupingBy(OrderData::getSellerCompany, Collectors.counting())); + resultMap.put(orderDataList.get(0).getBuyerCompany(), sellerCount); + return AjaxResult.success(resultMap); } @ApiOperation("装备上架统计") diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/order/OrderInfoMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/order/OrderInfoMapper.xml index 5e9a334..aa5d7a4 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/order/OrderInfoMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/order/OrderInfoMapper.xml @@ -472,6 +472,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN ma_dev_info mdi on mdi.ma_id=modd.ma_id LEFT JOIN sys_dept sd1 on sd1.dept_id=moi.buyer_company LEFT JOIN sys_dept sd2 on sd2.dept_id=mdi.own_co + where sd2.dept_name is not null order by moi.buyer_company \ No newline at end of file