大屏bug

This commit is contained in:
sxu 2025-01-07 16:04:59 +08:00
parent 350150ac89
commit 11534b3436
2 changed files with 11 additions and 7 deletions

View File

@ -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<OrderData> list = orderMapper.getBuyerAndSellerCouples();
Map<String, List<OrderData>> groupedMap = list.stream()
Map<String, List<OrderData>> groupedBuyerMap = list.stream()
.collect(Collectors.groupingBy(OrderData::getBuyerCompany));
List<List<OrderData>> groupedList = new ArrayList<>(groupedMap.values());
int randomValue = (int) (Math.random() * groupedList.size());
return AjaxResult.success(groupedList.get(randomValue));
List<List<OrderData>> groupedList = new ArrayList<>(groupedBuyerMap.values());
int randomIndex = (int) (Math.random() * groupedList.size());
List<OrderData> orderDataList = groupedList.get(randomIndex);
Map<String, Map<String, Long>> resultMap = new HashMap();
Map<String, Long> sellerCount = orderDataList.stream()
.collect(Collectors.groupingBy(OrderData::getSellerCompany, Collectors.counting()));
resultMap.put(orderDataList.get(0).getBuyerCompany(), sellerCount);
return AjaxResult.success(resultMap);
}
@ApiOperation("装备上架统计")

View File

@ -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
</select>
</mapper>