zss
2023-08-23 cd60954222dc5540ccdaf6b015a4be4c70b2b605
inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/HomeServiceImpl.java
@@ -126,7 +126,8 @@
        List<Object> list3 = new ArrayList<>();
        List<Object> list4 = new ArrayList<>();
        switch (type) {
            case 1:         /*本周*/
            /*本周*/
            case 1:
                List<String> dayofWeeks = getDayofWeeks();
                lineChartVO.setXAxis(dayofWeeks);
                for (String dayofWeek : dayofWeeks) {
@@ -137,21 +138,56 @@
                    Integer allFinByDay = inspectionMapper.getFinByDay(dayofWeek);
                    list2.add(allFinByDay);
                    //查询该日期的原材料合格率
                    Long okMaterByDay = inspectionMapper.getOkMaterByDay(dayofWeek);
                    list3.add(getRadio(allMaterByDay, okMaterByDay));
                    //查询该日期的成品合格率
                    Long okFinByDay = inspectionMapper.getOkFinByDay(dayofWeek);
                    list4.add(getRadio(allFinByDay, okFinByDay));
                }
                lineSeriesVO1.setData(list1);
                break;
            case 2:         /*本月*/
            /*本月*/
            case 2:
                List<String> dayofMonths = getDayofMonth();
                lineChartVO.setXAxis(dayofMonths);
                for (String dayofMonth : dayofMonths) {
                    //查询该日期的原材料检验数量
                    Integer allMaterByDay = inspectionMapper.getMaterByDay(dayofMonth);
                    list1.add(allMaterByDay);
                    //查询该日期的成品检验数量
                    Integer allFinByDay = inspectionMapper.getFinByDay(dayofMonth);
                    list2.add(allFinByDay);
                    //查询该日期的原材料合格率
                    Long okMaterByDay = inspectionMapper.getOkMaterByDay(dayofMonth);
                    list3.add(getRadio(allMaterByDay, okMaterByDay));
                    //查询该日期的成品合格率
                    Long okFinByDay = inspectionMapper.getOkFinByDay(dayofMonth);
                    list4.add(getRadio(allFinByDay, okFinByDay));
                }
                break;
            case 3:         /*本年*/
            /*本年*/
            case 3:
                List<String> monthofYears = getMonthofYear();
                lineChartVO.setXAxis(monthofYears);
                for (String monthofYear : monthofYears) {
                    //查询该日期范围内的原材料检验数量
                    Integer allMaterByDay = inspectionMapper.getMaterByMonth(monthofYear);
                    list1.add(allMaterByDay);
                    //查询该日期的成品检验数量
                    Integer allFinByDay = inspectionMapper.getFinByMonth(monthofYear);
                    list2.add(allFinByDay);
                    //查询该日期的原材料合格率
                    Long okMaterByDay = inspectionMapper.getOkMaterByMonth(monthofYear);
                    list3.add(getRadio(allMaterByDay, okMaterByDay));
                    //查询该日期的成品合格率
                    Long okFinByDay = inspectionMapper.getOkFinByMonth(monthofYear);
                    list4.add(getRadio(allFinByDay, okFinByDay));
                }
                break;
        }
        lineSeriesVO1.setData(list1);
        lineSeriesVO2.setData(list2);
        lineSeriesVO3.setData(list3);
        lineSeriesVO4.setData(list4);
        series.add(lineSeriesVO1);
        series.add(lineSeriesVO2);
        series.add(lineSeriesVO3);
@@ -227,4 +263,5 @@
    }
}