inspection-server/src/main/java/com/yuanchu/limslaboratory/mapper/InspectionMapper.java
@@ -50,9 +50,27 @@ Long qualifiedfin(Integer i); //查询该日期的原材料检验数量 Integer getMaterByDay(String dayofWeek); Integer getMaterByDay(String time); //查询该日期的成品检验数量 Integer getFinByDay(String dayofWeek); Integer getFinByDay(String time); //查询该日期的原材料合格数量 Long getOkMaterByDay(String time); //查询该日期的成品合格数量 Long getOkFinByDay(String time); //查询该月的原材料检验数量 Integer getMaterByMonth(String monthofYear); //查询该月的成品检验数量 Integer getFinByMonth(String monthofYear); //查询该月的原材料合格率 Long getOkMaterByMonth(String monthofYear); //查询该月的成品合格率 Long getOkFinByMonth(String monthofYear); } inspection-server/src/main/java/com/yuanchu/limslaboratory/pojo/InspectionMaterial.java
@@ -73,17 +73,13 @@ **/ private Integer state; /** * ${column.comment} **/ @TableField(fill = FieldFill.INSERT) @DateTimeFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date createTime; /** * ${column.comment} **/ @TableField(fill = FieldFill.INSERT_UPDATE) @DateTimeFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") inspection-server/src/main/java/com/yuanchu/limslaboratory/service/PlanService.java
@@ -42,7 +42,7 @@ * @param value * @return */ String check(Integer id, String value); Integer check(Integer id, String value); /** * 上报 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 @@ } } inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/PlanServiceImpl.java
@@ -77,7 +77,7 @@ //检验 @Override @Transactional(rollbackFor = Exception.class) public String check(Integer id, String value) { public Integer check(Integer id, String value) { InspectionProduct inspectionProduct = inspectionProductMapper.selectById(id); //判断检测值是否满足标准值和内控值的要求,如果不满足则检验结论为不合格0 String required = inspectionProduct.getRequired();//标准值 @@ -94,7 +94,7 @@ inspectionProduct.setTestState(1); } inspectionProductMapper.updateById(inspectionProduct); return "提交成功!"; return inspectionProduct.getTestState(); } //上报 inspection-server/src/main/resources/mapper/InspectionMapper.xml
@@ -110,7 +110,7 @@ from lims_laboratory.inspection where state = 1 and type = 0 and create_time = #{dayofWeek} and create_time = #{time} </select> <!--查询该日期的成品检验数量--> @@ -119,6 +119,64 @@ from lims_laboratory.inspection where state = 1 and type in (1, 2) and create_time = #{dayofWeek} and create_time = #{time} </select> <!--查询该日期的原材料合格数量--> <select id="getOkMaterByDay" resultType="java.lang.Long"> select count(id) from lims_laboratory.inspection where state = 1 and type = 0 and inspection_status = 1 and end_time = #{time} </select> <!--查询该日期的成品合格数量--> <select id="getOkFinByDay" resultType="java.lang.Long"> select count(id) from lims_laboratory.inspection where state = 1 and type in (1, 2) and inspection_status = 1 and end_time = #{time} </select> <!--查询该月的原材料检验数量--> <select id="getMaterByMonth" resultType="java.lang.Integer"> select count(id) from lims_laboratory.inspection where state = 1 and type = 0 and DATE_FORMAT(create_time, '%Y-%m') = #{monthofYear} </select> <!--查询该月的成品检验数量--> <select id="getFinByMonth" resultType="java.lang.Integer"> select count(id) from lims_laboratory.inspection where state = 1 and type in (1, 2) and DATE_FORMAT(create_time, '%Y-%m') = #{monthofYear} </select> <!--查询该月的原材料合格率--> <select id="getOkMaterByMonth" resultType="java.lang.Long"> select count(id) from lims_laboratory.inspection where state = 1 and type = 0 and inspection_status = 1 and DATE_FORMAT(end_time, '%Y-%m') = #{monthofYear} </select> <!--查询该月的成品合格率--> <select id="getOkFinByMonth" resultType="java.lang.Long"> select count(id) from lims_laboratory.inspection where state = 1 and type in (1, 2) and inspection_status = 1 and DATE_FORMAT(end_time, '%Y-%m') = #{monthofYear} </select> </mapper>