Browse Source

2023年9月27日14:17:05

纪新园 1 year ago
parent
commit
77da47f877

+ 40 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/iot/OrderController.java

@@ -10,6 +10,7 @@ import com.ruoyi.web.controller.iot.service.IOrderService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 /**
@@ -48,6 +49,22 @@ public class OrderController extends BaseController {
     }
 
     /**
+     * 客户端工单生产进度
+     */
+    @GetMapping("/productionScheduleList")
+    public AjaxResult productionScheduleList(Order order) {
+        return AjaxResult.success(orderService.productionScheduleList(order));
+    }
+
+    /**
+     * 客户端订单状态
+     */
+    @GetMapping("/orderStatus")
+    public AjaxResult orderStatus(Order order) {
+        return AjaxResult.success(orderService.orderStatus(order));
+    }
+
+    /**
      * 银行端设备管理列表
      */
     @GetMapping("/deviceList")
@@ -95,4 +112,27 @@ public class OrderController extends BaseController {
         return orderService.enterpriseDetail(enterprise);
     }
 
+
+    /**
+     * 银行端企业效能中心-产能报表
+     */
+    @GetMapping("/reportList")
+    public TableDataInfo reportList(@RequestParam(value = "status",required = false) String status,
+                                    @RequestParam(value = "enterpriseName",required = false) String enterpriseName,
+                                    @RequestParam(value = "startTime",required = false) String startTime,
+                                    @RequestParam(value = "endTime",required = false) String endTime) {
+        return orderService.reportList(status,enterpriseName,startTime,endTime);
+    }
+
+    /**
+     * 银行端企业效能中心-柱状图
+     */
+    @GetMapping("/reportHistogram")
+    public AjaxResult reportHistogram(@RequestParam(value = "status",required = false) String status,
+                                    @RequestParam(value = "enterpriseName",required = false) String enterpriseName,
+                                    @RequestParam(value = "startTime",required = false) String startTime,
+                                    @RequestParam(value = "endTime",required = false) String endTime) {
+        return orderService.reportHistogram(status,enterpriseName,startTime,endTime);
+    }
+
 }

+ 26 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/iot/domain/Device.java

@@ -75,6 +75,32 @@ public class Device {
      */
     private String deptId;
 
+    /**
+     * 运行状态
+     */
+    private String deviceStatus;
+
+    /**
+     * 运行时间
+     */
+    private String deviceTime;
+
+    public String getDeviceStatus() {
+        return deviceStatus;
+    }
+
+    public void setDeviceStatus(String deviceStatus) {
+        this.deviceStatus = deviceStatus;
+    }
+
+    public String getDeviceTime() {
+        return deviceTime;
+    }
+
+    public void setDeviceTime(String deviceTime) {
+        this.deviceTime = deviceTime;
+    }
+
     public String getUrl() {
         return url;
     }

+ 157 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/iot/domain/ProductionScheduleDto.java

@@ -0,0 +1,157 @@
+package com.ruoyi.web.controller.iot.domain;
+
+/**
+ * @author :jixinyuan
+ * @date : 2023/9/25
+ */
+
+public class ProductionScheduleDto {
+
+    /**
+     * 订单编号
+     */
+    private String orderNum;
+    /**
+     * 日期
+     */
+    private String deliveryTime;
+    /**
+     * 订单名称
+     */
+    private String orderName;
+    /**
+     * 供应商名称
+     */
+    private String customerName;
+    /**
+     * 品名
+     */
+    private String groupName;
+    /**
+     * 计划数量
+     */
+    private String productionNum;
+    /**
+     * 完工数量
+     */
+    private String orderFinishNum;
+    /**
+     * 天数
+     */
+    private String deliveryCycle;
+    /**
+     * 进度
+     */
+    private String productionSchedule;
+
+    /**
+     * 订单状态
+     */
+    private String shippingStatus;
+
+    /**
+     * 订单数量
+     */
+    private String number;
+
+    /**
+     * 发货数量
+     */
+    private String deliveryNum;
+
+    public String getShippingStatus() {
+        return shippingStatus;
+    }
+
+    public void setShippingStatus(String shippingStatus) {
+        this.shippingStatus = shippingStatus;
+    }
+
+    public String getNumber() {
+        return number;
+    }
+
+    public void setNumber(String number) {
+        this.number = number;
+    }
+
+    public String getDeliveryNum() {
+        return deliveryNum;
+    }
+
+    public void setDeliveryNum(String deliveryNum) {
+        this.deliveryNum = deliveryNum;
+    }
+
+    public String getOrderNum() {
+        return orderNum;
+    }
+
+    public void setOrderNum(String orderNum) {
+        this.orderNum = orderNum;
+    }
+
+    public String getDeliveryTime() {
+        return deliveryTime;
+    }
+
+    public void setDeliveryTime(String deliveryTime) {
+        this.deliveryTime = deliveryTime;
+    }
+
+    public String getOrderName() {
+        return orderName;
+    }
+
+    public void setOrderName(String orderName) {
+        this.orderName = orderName;
+    }
+
+    public String getCustomerName() {
+        return customerName;
+    }
+
+    public void setCustomerName(String customerName) {
+        this.customerName = customerName;
+    }
+
+    public String getGroupName() {
+        return groupName;
+    }
+
+    public void setGroupName(String groupName) {
+        this.groupName = groupName;
+    }
+
+    public String getProductionNum() {
+        return productionNum;
+    }
+
+    public void setProductionNum(String productionNum) {
+        this.productionNum = productionNum;
+    }
+
+    public String getOrderFinishNum() {
+        return orderFinishNum;
+    }
+
+    public void setOrderFinishNum(String orderFinishNum) {
+        this.orderFinishNum = orderFinishNum;
+    }
+
+    public String getDeliveryCycle() {
+        return deliveryCycle;
+    }
+
+    public void setDeliveryCycle(String deliveryCycle) {
+        this.deliveryCycle = deliveryCycle;
+    }
+
+    public String getProductionSchedule() {
+        return productionSchedule;
+    }
+
+    public void setProductionSchedule(String productionSchedule) {
+        this.productionSchedule = productionSchedule;
+    }
+}

+ 131 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/iot/domain/capacityReportDto.java

@@ -0,0 +1,131 @@
+package com.ruoyi.web.controller.iot.domain;
+
+/**
+ * @author :jixinyuan
+ * @date : 2023/9/25
+ */
+
+public class capacityReportDto {
+
+    /**
+     * 订单编号
+     */
+    private String orderNumD;
+    /**
+     * 企业名称
+     */
+    private String customerName;
+    /**
+     * 订单名称
+     */
+    private String orderName;
+    /**
+     * 生成工单编号
+     */
+    private String orderNumG;
+    /**
+     * 报工数量
+     */
+    private String reportingNum;
+    /**
+     * 合格数量
+     */
+    private String qualifiedNum;
+    /**
+     * 不合格数量
+     */
+    private String unqualifiedNum;
+    /**
+     * 日产量
+     */
+    private String dailyProduction;
+    /**
+     * 报工时间
+     */
+    private String reportTime;
+
+    /**
+     * 合格率
+     */
+    private String passRate;
+
+    public String getPassRate() {
+        return passRate;
+    }
+
+    public void setPassRate(String passRate) {
+        this.passRate = passRate;
+    }
+
+    public String getOrderNumD() {
+        return orderNumD;
+    }
+
+    public void setOrderNumD(String orderNumD) {
+        this.orderNumD = orderNumD;
+    }
+
+    public String getCustomerName() {
+        return customerName;
+    }
+
+    public void setCustomerName(String customerName) {
+        this.customerName = customerName;
+    }
+
+    public String getOrderName() {
+        return orderName;
+    }
+
+    public void setOrderName(String orderName) {
+        this.orderName = orderName;
+    }
+
+    public String getOrderNumG() {
+        return orderNumG;
+    }
+
+    public void setOrderNumG(String orderNumG) {
+        this.orderNumG = orderNumG;
+    }
+
+    public String getReportingNum() {
+        return reportingNum;
+    }
+
+    public void setReportingNum(String reportingNum) {
+        this.reportingNum = reportingNum;
+    }
+
+    public String getQualifiedNum() {
+        return qualifiedNum;
+    }
+
+    public void setQualifiedNum(String qualifiedNum) {
+        this.qualifiedNum = qualifiedNum;
+    }
+
+    public String getUnqualifiedNum() {
+        return unqualifiedNum;
+    }
+
+    public void setUnqualifiedNum(String unqualifiedNum) {
+        this.unqualifiedNum = unqualifiedNum;
+    }
+
+    public String getDailyProduction() {
+        return dailyProduction;
+    }
+
+    public void setDailyProduction(String dailyProduction) {
+        this.dailyProduction = dailyProduction;
+    }
+
+    public String getReportTime() {
+        return reportTime;
+    }
+
+    public void setReportTime(String reportTime) {
+        this.reportTime = reportTime;
+    }
+}

+ 9 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/iot/service/IOrderService.java

@@ -5,6 +5,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.web.controller.iot.domain.Device;
 import com.ruoyi.web.controller.iot.domain.Enterprise;
 import com.ruoyi.web.controller.iot.domain.Order;
+import com.ruoyi.web.controller.iot.domain.ProductionScheduleDto;
 
 import java.util.List;
 
@@ -32,4 +33,12 @@ public interface IOrderService {
     TableDataInfo enterpriseList(Enterprise enterprise);
 
     AjaxResult enterpriseDetail(Enterprise enterprise);
+
+    List<ProductionScheduleDto> productionScheduleList(Order order);
+
+    List<ProductionScheduleDto> orderStatus(Order order);
+
+    TableDataInfo reportList(String status, String enterpriseName, String startTime, String endTime);
+
+    AjaxResult reportHistogram(String status, String enterpriseName, String startTime, String endTime);
 }

+ 228 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/iot/service/impl/OrderServiceImpl.java

@@ -25,6 +25,10 @@ import org.springframework.jdbc.datasource.DriverManagerDataSource;
 import org.springframework.stereotype.Service;
 import org.springframework.util.ObjectUtils;
 
+import java.math.BigDecimal;
+import java.math.MathContext;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -394,8 +398,11 @@ public class OrderServiceImpl implements IOrderService {
         dataSource.setPassword(detail.getEnterpriseDatabasePassword());
         JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
         try {
-            List<Device> deviceList = jdbcTemplate.query("SELECT ie.* ,it.tsl_name as tslName, '" + detail.getEnterpriseDatabaseUrl() + "' as url" + " FROM iot_equipment ie " +
-                            "LEFT JOIN iot_tsl it ON ie.tsl_id = it.id ;",
+            List<Device> deviceList = jdbcTemplate.query("SELECT ie.* ,it.tsl_name as tslName," +
+                            "ird.update_time as deviceTime, ird.val as deviceStatus, '" + detail.getEnterpriseDatabaseUrl() + "' as url"
+                            + " FROM iot_equipment ie " +
+                            "LEFT JOIN iot_tsl it ON ie.tsl_id = it.id " +
+                            "LEFT JOIN iot_real_data ird ON ie.equipment_code = ird.device_code ;",
                     new BeanPropertyRowMapper<Device>(Device.class));
             detail.setDeviceList(deviceList);
         } catch (Exception e) {
@@ -420,6 +427,225 @@ public class OrderServiceImpl implements IOrderService {
     }
 
     @Override
+    public List<ProductionScheduleDto> productionScheduleList(Order order) {
+        List<ProductionScheduleDto> orderList = new ArrayList<>();
+        String condition = "";
+
+        if (!ObjectUtils.isEmpty(order.getStartTime())) {
+            condition += "and fo.start_time >= '" + order.getStartTime() + "'";
+        }
+        if (!ObjectUtils.isEmpty(order.getEndTime())) {
+            condition += "and fo.end_time <= '" + order.getEndTime() + "'";
+        }
+        try {
+            Map<String, JdbcTemplate> jdbcTemplateMap = databaseConnectionMap.getJdbcTemplate();
+            Set<String> key = jdbcTemplateMap.keySet();
+
+            for (String keyUrl : key) {
+                JdbcTemplate template = jdbcTemplateMap.get(keyUrl);
+                List<ProductionScheduleDto> orders = template.query("SELECT fo.order_num as orderNum,fo.delivery_time as deliveryTime,"
+                                + "fo.order_name as orderName,fo.customer_name as customerName,pg.group_name as groupName," +
+                                "IF(tpo.production_num,tpo.production_num,0) as productionNum," +
+                                "IF(tpo.order_finish_num,tpo.order_finish_num,0) as orderFinishNum," +
+                                "tpo.delivery_cycle as deliveryCycle," +
+                                "IF(IF(tpo.production_num,tpo.production_num,0)/IF(tpo.order_finish_num,tpo.order_finish_num,0)," +
+                                "IF(tpo.production_num,tpo.production_num,0)/IF(tpo.order_finish_num,tpo.order_finish_num,0)," +
+                                "0) as productionSchedule" +
+                                " FROM t_factory_order fo LEFT JOIN t_product_order tpo ON fo.id = tpo.task_id " +
+                                "LEFT JOIN t_process_group pg ON tpo.process_group_id = pg.id " +
+                                "where 1=1 " + (ObjectUtils.isEmpty(condition) ? "" : condition) + ";",
+                        new BeanPropertyRowMapper<ProductionScheduleDto>(ProductionScheduleDto.class));
+                orderList.addAll(orders);
+            }
+        } catch (Exception e) {
+            throw new RuntimeException(e.getMessage());
+        }
+        return orderList;
+    }
+
+    @Override
+    public List<ProductionScheduleDto> orderStatus(Order order) {
+        List<ProductionScheduleDto> orderList = new ArrayList<>();
+        String condition = "";
+
+        if (!ObjectUtils.isEmpty(order.getStartTime())) {
+            condition += "and fo.start_time >= '" + order.getStartTime() + "'";
+        }
+        if (!ObjectUtils.isEmpty(order.getEndTime())) {
+            condition += "and fo.end_time <= '" + order.getEndTime() + "'";
+        }
+        try {
+            Map<String, JdbcTemplate> jdbcTemplateMap = databaseConnectionMap.getJdbcTemplate();
+            Set<String> key = jdbcTemplateMap.keySet();
+
+            for (String keyUrl : key) {
+                JdbcTemplate template = jdbcTemplateMap.get(keyUrl);
+                List<ProductionScheduleDto> orders = template.query("SELECT fo.order_num as orderNum,fo.delivery_time as deliveryTime,"
+                                + "fo.order_name as orderName,fo.customer_name as customerName,pg.group_name as groupName," +
+                                "tto.shipping_status as shippingStatus," +
+                                "IF(tto.number,tto.number,0) as number," +
+                                "IF(tto.delivery_num,tto.delivery_num,0) as deliveryNum" +
+                                " FROM t_factory_order fo LEFT JOIN t_product_order tpo ON fo.id = tpo.task_id " +
+                                " LEFT JOIN t_transport_order tto ON fo.order_num = tto.order_num " +
+                                "LEFT JOIN t_process_group pg ON tpo.process_group_id = pg.id " +
+                                "where 1=1 " + (ObjectUtils.isEmpty(condition) ? "" : condition) + ";",
+                        new BeanPropertyRowMapper<ProductionScheduleDto>(ProductionScheduleDto.class));
+                orderList.addAll(orders);
+            }
+        } catch (Exception e) {
+            throw new RuntimeException(e.getMessage());
+        }
+        return orderList;
+    }
+
+    @Override
+    public TableDataInfo reportList(String status, String enterpriseName, String startTime, String endTime) {
+        PageDomain pageDomain = TableSupport.buildPageRequest();
+        Integer pageNum = pageDomain.getPageNum();
+        Integer pageSize = pageDomain.getPageSize();
+        String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
+        Boolean reasonable = pageDomain.getReasonable();
+        PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable);
+        List<capacityReportDto> orderList = new ArrayList<>();
+        String condition = "";
+        if (!ObjectUtils.isEmpty(enterpriseName)) {
+            condition += "and tfo.customer_name = '" + enterpriseName + "'";
+        }
+        if (!ObjectUtils.isEmpty(status)) {
+            condition += "and fo.start_time = '" + status + "'";
+        }
+        if (!ObjectUtils.isEmpty(startTime)) {
+            condition += "and tpo.complete_time >= '" + startTime + "'";
+        }
+        if (!ObjectUtils.isEmpty(endTime)) {
+            condition += "and tpo.complete_time <= '" + endTime + "'";
+        }
+        try {
+            Map<String, JdbcTemplate> jdbcTemplateMap = databaseConnectionMap.getJdbcTemplate();
+            Set<String> key = jdbcTemplateMap.keySet();
+
+            for (String keyUrl : key) {
+                JdbcTemplate template = jdbcTemplateMap.get(keyUrl);
+                List<capacityReportDto> orders = template.query("SELECT tfo.order_num AS orderNumD,tfo.customer_name AS customerName,"
+                                + "tfo.order_name AS orderName,tpo.order_num AS orderNumG,tpo.production_num AS reportingNum, " +
+                                "(SELECT count(report_num) FROM t_work_report where order_id = tpo.id and process_id =" +
+                                "(SELECT process_id FROM t_process_group_detail where group_id = tpo.process_group_id  ORDER BY sort_num desc  LIMIT 1)" +
+                                "and defect_cause is null)as qualifiedNum," +
+                                "(SELECT count(waste_num) FROM t_work_report where order_id = tpo.id and process_id =" +
+                                "(SELECT process_id FROM t_process_group_detail where group_id = tpo.process_group_id  ORDER BY sort_num desc  LIMIT 1)" +
+                                "and defect_cause is not null) as unqualifiedNum," +
+                                "(SELECT count(product_num) FROM t_work_report where order_id = tpo.id and process_id =" +
+                                "(SELECT process_id FROM t_process_group_detail where group_id = tpo.process_group_id  ORDER BY sort_num desc  LIMIT 1))" +
+                                "as dailyProduction," +
+                                "(SELECT report_time FROM t_work_report where order_id = tpo.id and process_id =" +
+                                "(SELECT process_id FROM t_process_group_detail where group_id = tpo.process_group_id  ORDER BY sort_num desc  LIMIT 1)" +
+                                "ORDER BY  report_time  LIMIT 1) as reportTime" +
+                                " FROM t_product_order tpo " +
+                                " LEFT JOIN t_factory_order tfo ON tpo.task_id = tfo.id " +
+                                "where 1=1 " + (ObjectUtils.isEmpty(condition) ? "" : condition) + ";",
+                        new BeanPropertyRowMapper<capacityReportDto>(capacityReportDto.class));
+                for (capacityReportDto item : orders) {
+                    if ("0".equals(item.getQualifiedNum()) || "0".equals(item.getUnqualifiedNum())) {
+                        item.setPassRate("0");
+                    } else {
+                        BigDecimal sum = new BigDecimal(item.getQualifiedNum()).add(new BigDecimal(item.getUnqualifiedNum()));
+                        item.setPassRate(new BigDecimal(item.getQualifiedNum()).divide(sum, MathContext.DECIMAL32).setScale(2, BigDecimal.ROUND_HALF_UP).toString());
+                    }
+                }
+                orderList.addAll(orders);
+            }
+        } catch (Exception e) {
+            throw new RuntimeException(e.getMessage());
+        }
+        TableDataInfo tableDataInfo = new TableDataInfo();
+        tableDataInfo.setCode(HttpStatus.SUCCESS);
+        tableDataInfo.setMsg("查询成功");
+        tableDataInfo.setRows(orderList.stream().skip(pageNum).limit(pageSize).collect(Collectors.toList()));
+        tableDataInfo.setTotal(orderList.size());
+        return tableDataInfo;
+    }
+
+    @Override
+    public AjaxResult reportHistogram(String status, String enterpriseName, String startTime, String endTime) {
+        Map<String, Object> map = new HashMap<>();
+        List<String> yearList = new ArrayList<>();
+        List<String> reportingNumList = new ArrayList<>();
+        List<String> qualifiedNumList = new ArrayList<>();
+        List<String> unqualifiedNumList = new ArrayList<>();
+        List<String> passRateList = new ArrayList<>();
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+        try {
+            Map<String, JdbcTemplate> jdbcTemplateMap = databaseConnectionMap.getJdbcTemplate();
+            Set<String> key = jdbcTemplateMap.keySet();
+
+            for (String keyUrl : key) {
+                if (ObjectUtils.isEmpty(startTime) || ObjectUtils.isEmpty(endTime)) {
+                    endTime = LocalDate.now().toString();
+                    startTime =  LocalDate.parse(endTime).minusDays(7).toString();
+                }
+                LocalDate start = LocalDate.parse(startTime);
+                LocalDate end = LocalDate.parse(endTime);
+                // 判断是否到达结束日期
+                while (!start.isAfter(end)) {
+                    String condition = "";
+                    if (!ObjectUtils.isEmpty(enterpriseName)) {
+                        condition += "and tfo.customer_name = '" + enterpriseName + "'";
+                    }
+                    if (!ObjectUtils.isEmpty(status)) {
+                        condition += "and fo.start_time = '" + status + "'";
+                    }
+                    condition += "and DATE_FORMAT(tpo.complete_time, '%Y-%m-%d') >= '" + start.format(formatter) + "'";
+                    condition += "and DATE_FORMAT(tpo.complete_time, '%Y-%m-%d') <= '" + start.format(formatter) + "'";
+                    JdbcTemplate template = jdbcTemplateMap.get(keyUrl);
+                    List<capacityReportDto> orders = template.query("SELECT tfo.order_num AS orderNumD,tfo.customer_name AS customerName,"
+                                    + "tfo.order_name AS orderName,tpo.order_num AS orderNumG,tpo.production_num AS reportingNum, " +
+                                    "(SELECT count(report_num) FROM t_work_report where order_id = tpo.id and process_id =" +
+                                    "(SELECT process_id FROM t_process_group_detail where group_id = tpo.process_group_id  ORDER BY sort_num desc  LIMIT 1)" +
+                                    "and defect_cause is null)as qualifiedNum," +
+                                    "(SELECT count(waste_num) FROM t_work_report where order_id = tpo.id and process_id =" +
+                                    "(SELECT process_id FROM t_process_group_detail where group_id = tpo.process_group_id  ORDER BY sort_num desc  LIMIT 1)" +
+                                    "and defect_cause is not null) as unqualifiedNum," +
+                                    "(SELECT count(product_num) FROM t_work_report where order_id = tpo.id and process_id =" +
+                                    "(SELECT process_id FROM t_process_group_detail where group_id = tpo.process_group_id  ORDER BY sort_num desc  LIMIT 1))" +
+                                    "as dailyProduction," +
+                                    "(SELECT report_time FROM t_work_report where order_id = tpo.id and process_id =" +
+                                    "(SELECT process_id FROM t_process_group_detail where group_id = tpo.process_group_id  ORDER BY sort_num desc  LIMIT 1)" +
+                                    "ORDER BY  report_time  LIMIT 1) as reportTime" +
+                                    " FROM t_product_order tpo " +
+                                    " LEFT JOIN t_factory_order tfo ON tpo.task_id = tfo.id " +
+                                    "where 1=1 " + (ObjectUtils.isEmpty(condition) ? "" : condition) + ";",
+                            new BeanPropertyRowMapper<capacityReportDto>(capacityReportDto.class));
+                    for (capacityReportDto item : orders) {
+                        if (!ObjectUtils.isEmpty(item.getQualifiedNum()) && !ObjectUtils.isEmpty(item.getUnqualifiedNum())
+                                && !ObjectUtils.isEmpty(item.getReportingNum())) {
+                            if ("0".equals(item.getQualifiedNum()) || "0".equals(item.getUnqualifiedNum())) {
+                                passRateList.add("0");
+                            } else {
+                                BigDecimal sum = new BigDecimal(item.getQualifiedNum()).add(new BigDecimal(item.getUnqualifiedNum()));
+                                passRateList.add(new BigDecimal(item.getQualifiedNum()).divide(sum, MathContext.DECIMAL32).setScale(2, BigDecimal.ROUND_HALF_UP).toString());
+                            }
+                            yearList.add(start.format(formatter));
+                            reportingNumList.add(item.getReportingNum());
+                            qualifiedNumList.add(item.getQualifiedNum());
+                            unqualifiedNumList.add(item.getUnqualifiedNum());
+                        }
+                    }
+                    // 日期加一天
+                    start = start.plusDays(1);
+                }
+            }
+        } catch (Exception e) {
+            throw new RuntimeException(e.getMessage());
+        }
+        map.put("passRateList", passRateList);
+        map.put("yearList", yearList);
+        map.put("reportingNumList", reportingNumList);
+        map.put("qualifiedNumList", qualifiedNumList);
+        map.put("unqualifiedNumList", unqualifiedNumList);
+        return AjaxResult.success(map);
+    }
+
+    @Override
     public AjaxResult deviceDetails(Device device) {
         List<IotRealData> iotRealDataList = new ArrayList<>();
         try {