Просмотр исходного кода

统计报表开发 自定义订单哈默机床特殊处理

BSWYZ 4 дней назад
Родитель
Сommit
efec3e118d

+ 2 - 2
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/mq/TaskWorkNode.java

@@ -1299,14 +1299,14 @@ public class TaskWorkNode {
                 dataMap.put("data", locationMap);
 
                 String uploadInfo = msgUtil.redis_get(DemoLineConstant.DEMOLINE_HEIDENHAIN_FILE_URL+"_"+task.getId())!=null? msgUtil.redis_get(DemoLineConstant.DEMOLINE_HEIDENHAIN_FILE_URL+"_"+task.getId()).toString(): null;
-                Productionresource productionresource =  productionresourceBizMapper.selectOne(Wraps.<Productionresource>lbQ().eq(Productionresource::getId,task.getResourceId()));
+                Productionresource productionresource =  productionresourceBizMapper.selectOne(Wraps.<Productionresource>lbQ().eq(Productionresource::getId,taskNode.getTargetResourceId()));
                 TTask tTask = taskMapper.selectById(taskNode.getTaskId());
                 Order currentOrder = orderMapper.selectById(tTask.getOrderId());
                 if(StringUtils.isNotEmpty(uploadInfo)){
                     JSONObject jsonObject  = JSONObject.parseObject(uploadInfo);
                     //异步发送哈默预处理编号
                     this.asyncPost(jsonObject);
-                }else if(currentOrder.getSingleTaskFlag().equals("1") && productionresource.getModeSpecification().equals("HEIDENHAIN")){
+                }else if("1".equals(currentOrder.getSingleTaskFlag()) && "HEIDENHAIN".equals(productionresource.getModeSpecification()) && ObjectUtil.isNotEmpty(productionresource)){
                     JSONObject jsonObject = new JSONObject();
                     jsonObject.put("url", productionresource.getIp());
                     jsonObject.put("port", productionresource.getPort());

+ 3 - 2
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/RobotNodeServiceImpl.java

@@ -3,6 +3,7 @@ package com.github.zuihou.business.productionResourceCenter.service.impl;
 
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@@ -844,12 +845,12 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                         Storge hcwStorge = (Storge)msgUtil.redis_get(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_HCW + taskNode.getId());
 
                         String uploadInfo = msgUtil.redis_get(DemoLineConstant.DEMOLINE_HEIDENHAIN_FILE_URL+"_"+task.getId())!=null? msgUtil.redis_get(DemoLineConstant.DEMOLINE_HEIDENHAIN_FILE_URL+"_"+task.getId()).toString(): null;
-                        Productionresource productionresource =  productionresourceBizMapper.selectOne(Wraps.<Productionresource>lbQ().eq(Productionresource::getId,task.getResourceId()));
+                        Productionresource productionresource =  productionresourceBizMapper.selectOne(Wraps.<Productionresource>lbQ().eq(Productionresource::getId,taskNode.getTargetResourceId()));
                         if(StringUtils.isNotEmpty(uploadInfo)){
                             JSONObject jsonObject  = JSONObject.parseObject(uploadInfo);
                             //异步发送哈默预处理编号
                             boolean bool = this.asyncPost(jsonObject);
-                        }else if(currentOrder.getSingleTaskFlag().equals("1") && productionresource.getModeSpecification().equals("HEIDENHAIN") ){
+                        }else if("1".equals(currentOrder.getSingleTaskFlag()) && "HEIDENHAIN".equals(productionresource.getModeSpecification()) && ObjectUtil.isNotEmpty(productionresource)){
                                 JSONObject jsonObject = new JSONObject();
                                 jsonObject.put("url", productionresource.getIp());
                                 jsonObject.put("port", productionresource.getPort());

+ 8 - 1
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/statisticalAnalysis/ProductLinePerformanceService.java

@@ -14,6 +14,7 @@ import com.github.zuihou.tenant.dto.ProductDto;
 import com.github.zuihou.tenant.dto.ProductInfoDto;
 import com.github.zuihou.tenant.dto.ProductionStatisticalDto;
 import com.github.zuihou.tenant.vo.DeviceResourceDetailVo;
+import com.github.zuihou.tenant.vo.DeviceResourceStatisticsVo;
 import com.github.zuihou.tenant.vo.DeviceResourceSumVo;
 import com.github.zuihou.tenant.vo.ProductVo;
 import org.apache.ibatis.annotations.Param;
@@ -112,6 +113,10 @@ public interface ProductLinePerformanceService extends SuperCacheService<TaskNod
      */
     IPage<DeviceResourceDetailVo> deviceResourceDetail(IPage page, Map<String, Object> params);
 
+
+    IPage<DeviceResourceStatisticsVo> DeviceResourceStatistics1(IPage page,Map<String, Object> params);
+
+
     Map<String,List<String>> resourceRate(Map<String, Object> params);
 
     /**
@@ -122,7 +127,7 @@ public interface ProductLinePerformanceService extends SuperCacheService<TaskNod
      */
     IPage<DeviceResourceDetailVo> workHourReport(IPage page, Map<String, Object> params);
 
-    IPage<DeviceResourceDetailVo> otherHourReport(IPage page, Map<String, Object> params);
+    IPage<DeviceResourceDetailVo> otherHourReport(IPage page,Map<String, Object> params);
 
     List<Map<String,Object>> taskResourceSum(Map<String, Object> params);
 
@@ -130,6 +135,8 @@ public interface ProductLinePerformanceService extends SuperCacheService<TaskNod
 
     void exportTaskResource(Map<String, Object> params, HttpServletResponse response) throws UnsupportedEncodingException, IOException;
 
+    void exportDeviceResourceStatistics1(Map<String, Object> params, HttpServletResponse response) throws UnsupportedEncodingException, IOException;
+
     IPage<DeviceResourceSumVo> robotTaskSum(Page pageInfo, Map<String, Object> params);
 
     IPage<DeviceResourceSumVo> overTimeTaskSum(Page pageInfo, Map<String, Object> params);

+ 3 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/statisticalAnalysis/dao/ProductLinePerformanceMapper.java

@@ -13,6 +13,7 @@ import com.github.zuihou.database.mybatis.auth.DataScope;
 import com.github.zuihou.tenant.dto.ProcedureSumDto;
 import com.github.zuihou.tenant.dto.ProductionStatisticalDto;
 import com.github.zuihou.tenant.vo.DeviceResourceDetailVo;
+import com.github.zuihou.tenant.vo.DeviceResourceStatisticsVo;
 import com.github.zuihou.tenant.vo.DeviceResourceSumVo;
 import com.github.zuihou.tenant.vo.ProductVo;
 import org.apache.ibatis.annotations.Param;
@@ -73,6 +74,8 @@ public interface ProductLinePerformanceMapper extends SuperMapper<TaskNode> {
 
     IPage<DeviceResourceSumVo> deviceResourceSum(IPage page,@Param("params") Map<String, Object> params);
 
+    IPage<DeviceResourceStatisticsVo> DeviceResourceStatistics1(IPage page,@Param("params") Map<String, Object> params);
+
     IPage<DeviceResourceDetailVo> deviceResourceDetail(IPage page,@Param("params") Map<String, Object> params);
 
     List<DeviceResourceDetailVo> resourceRate(@Param("params") Map<String, Object> params);

+ 122 - 1
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/statisticalAnalysis/impl/ProductLinePerformanceServiceImpl.java

@@ -24,6 +24,7 @@ import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
 import com.github.zuihou.injection.annonation.InjectionResult;
 import com.github.zuihou.tenant.dto.*;
 import com.github.zuihou.tenant.vo.DeviceResourceDetailVo;
+import com.github.zuihou.tenant.vo.DeviceResourceStatisticsVo;
 import com.github.zuihou.tenant.vo.DeviceResourceSumVo;
 import com.github.zuihou.tenant.vo.ProductVo;
 import com.github.zuihou.utils.DateUtils;
@@ -37,7 +38,9 @@ import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
+import java.io.UnsupportedEncodingException;
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicInteger;
@@ -353,6 +356,102 @@ public class ProductLinePerformanceServiceImpl extends SuperCacheServiceImpl<Pro
         return baseMapper.deviceResourceSum(page, params);
     }
 
+    @Override
+    public IPage<DeviceResourceStatisticsVo> DeviceResourceStatistics1(IPage page ,Map<String, Object> params) {
+        if ((Objects.isNull(params.get("startDate")) || Objects.isNull(params.get("endDate")))
+                && Objects.isNull(params.get("month")) && Objects.isNull(params.get("years"))) {
+            //默认当天
+            params.put("today", DateUtil.dateToString0(new Date(), "yyyy-MM-dd"));
+        } else if (params.containsKey("month") && StringUtils.isNotEmpty(params.get("month").toString())) {
+            Date date = DateUtil.stringToDate0(params.get("month").toString(), "yyyy-MM");
+            params.put("daySpan", DateUtil.getDaysOfMonth(date));
+        } else if (params.containsKey("years") && StringUtils.isNotEmpty(params.get("years").toString())) {
+            Date date = DateUtil.stringToDate0(params.get("years").toString(), "yyyy");
+            params.put("daySpan", DateUtil.getDaysOfYear(date));
+        } else if (params.containsKey("startDate") && params.containsKey("endDate")) {
+            List<String> datas = DateUtils.getBetweenDay(params.get("startDate").toString(), params.get("endDate").toString());
+            params.put("daySpan", datas.size() - 1);
+        }
+        //获取主轴利用率
+        IPage<DeviceResourceStatisticsVo> deviceResourceStatisticsVoIPage = baseMapper.DeviceResourceStatistics1(page, params);
+        List<DeviceResourceStatisticsVo> records = deviceResourceStatisticsVoIPage.getRecords();
+        for (DeviceResourceStatisticsVo record : records) {
+            Map<String, Object> map = new HashMap<>();
+            map.put("resourceId",record.getResourceId());
+            map.put("date",record.getDayDate());
+            Map<String, List<String>> stringListMap = resourceRate(map);
+            List<String> rate = stringListMap.get("rate");
+            //调用方法:获取最后一个元素并格式化为百分比
+            String formattedZZLYL = getLastElementAndFormatToPercent(rate);
+            record.setResourceZZLYL(formattedZZLYL);
+        }
+
+        return deviceResourceStatisticsVoIPage;
+    }
+
+    /**
+     * 工具方法:通过索引获取 List 最后一个元素
+     * @param list 目标集合(可能为 null 或空)
+     * @return 最后一个元素(集合无效时返回 null)
+     */
+    private String getLastElement(List<String> list) {
+        // 边界校验:集合为 null 或空 → 返回 null
+        if (list == null || list.isEmpty()) {
+            log.warn("获取最后一个元素失败:集合为 null 或空");
+            return null;
+        }
+        // 最后一个元素的索引 = 集合长度 - 1
+        int lastIndex = list.size() - 1;
+        return list.get(lastIndex);
+    }
+
+    /**
+     * 工具方法:获取List最后一个元素,并格式化为“百分比”(保留两位小数,去.00,加%)
+     * @param list 目标集合(可能为null、空,或元素为非数值格式)
+     * @return 格式化后的百分比字符串(如"66%"、"88.5%";集合无效/格式错误时返回"-")
+     */
+    private String getLastElementAndFormatToPercent(List<String> list) {
+        // 步骤1:先获取List的最后一个元素(空集合/null返回null)
+        String lastRawValue = getLastElement(list);
+        if (lastRawValue == null) {
+            return "-"; // 集合无效时,返回"-"兜底
+        }
+
+        // 步骤2:处理原始值(去除前后空格,避免空格导致的格式错误)
+        String trimmedValue = lastRawValue.trim();
+        if (trimmedValue.isEmpty()) {
+            log.warn("List最后一个元素为空字符串,无法格式化");
+            return "-";
+        }
+
+        // 步骤3:将字符串转为数值,处理格式错误(如非数字、特殊字符)
+        BigDecimal decimalValue;
+        try {
+            // 转为BigDecimal(支持整数、小数,如"66"、"66.0"、"66.583")
+            decimalValue = new BigDecimal(trimmedValue);
+        } catch (NumberFormatException e) {
+            log.error("List最后一个元素格式错误,无法转为数值:{}", trimmedValue, e);
+            return "-"; // 格式错误时,返回"-"兜底
+        }
+
+        // 步骤4:格式化数值(保留两位小数,四舍五入)
+        BigDecimal formattedDecimal = decimalValue.setScale(2, RoundingMode.HALF_UP);
+
+        // 步骤5:处理末尾的.00(转为整数;非.00则保留两位小数)
+        String resultStr;
+        if (formattedDecimal.scale() <= 0 || formattedDecimal.remainder(BigDecimal.ONE).compareTo(BigDecimal.ZERO) == 0) {
+            // 情况1:是整数(如66.00 → 转为66)
+            resultStr = formattedDecimal.setScale(0).toString();
+        } else {
+            // 情况2:是小数(如66.50 → 66.5;66.58 → 66.58)
+            // 去除末尾多余的0(如66.50 → 66.5),再转为字符串
+            resultStr = formattedDecimal.stripTrailingZeros().toString();
+        }
+
+        // 步骤6:拼接%符号,返回最终结果
+        return resultStr + "%";
+    }
+
     @Override
     public IPage<DeviceResourceDetailVo> deviceResourceDetail(IPage page, Map<String, Object> params) {
         if ((Objects.isNull(params.get("startDate")) || Objects.isNull(params.get("endDate")))
@@ -363,6 +462,7 @@ public class ProductLinePerformanceServiceImpl extends SuperCacheServiceImpl<Pro
         return baseMapper.deviceResourceDetail(page, params);
     }
 
+
     @Override
     public Map<String, List<String>> resourceRate(Map<String, Object> params) {
         String date = null;
@@ -457,7 +557,6 @@ public class ProductLinePerformanceServiceImpl extends SuperCacheServiceImpl<Pro
                 BigDecimal jgBig = new BigDecimal(jgTime);
                 BigDecimal sumBig = new BigDecimal((endDate.getTime() - startDate.getTime()));
                 BigDecimal minutes = jgBig.divide(new BigDecimal(60000), 2, BigDecimal.ROUND_HALF_UP);
-                System.out.println("jgBig = " + jgBig + "sumBig = " + sumBig + "minutes = " + minutes);
                 if (delayTime > 0) {
 //                    minutes 表示实际使用的分钟数
                     minutes = minutes.subtract(new BigDecimal(delayTime));
@@ -620,6 +719,28 @@ public class ProductLinePerformanceServiceImpl extends SuperCacheServiceImpl<Pro
         workbook.write(out);
     }
 
+    @Override
+    public void exportDeviceResourceStatistics1(Map<String, Object> params, HttpServletResponse response) throws UnsupportedEncodingException, IOException {
+        int page = params.containsKey("page") ? Integer.parseInt(params.get("page").toString()) : 1;
+        int limit = params.containsKey("limit") ? Integer.parseInt(params.get("limit").toString()) : 50;
+        Page pageInfo = new Page<DeviceResourceSumVo>(page, limit);
+        IPage<DeviceResourceStatisticsVo> dataList = this.DeviceResourceStatistics1(pageInfo, params);
+        List<DeviceResourceStatisticsVo> list = dataList.getRecords();
+
+        // 设置响应输出的头类型
+        // 设置响应输出的头类型
+        response.setHeader("content-Type", "application/vnd.ms-excel");
+        // 设计导出文件的名称,尽量不要中文
+        String fileName = new String("统计报表导出.xls".getBytes(), "ISO-8859-1");
+        response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
+        //输出流。
+        ServletOutputStream out = response.getOutputStream();
+        // 创建参数对象(用来设定excel得sheet的内容等信息)
+        // title的参数为ExportParams类型,目前仅仅在ExportParams中设置了sheetName
+        Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("统计报表导出", "统计报表导出"), DeviceResourceStatisticsVo.class, list);
+        workbook.write(out);
+    }
+
     @Override
     public IPage<DeviceResourceSumVo> robotTaskSum(Page pageInfo, Map<String, Object> params) {
         if ((Objects.isNull(params.get("startDate")) || Objects.isNull(params.get("endDate")))

+ 61 - 0
imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/statisticalAnalysis/ProductLinePerformanceMapper.xml

@@ -254,6 +254,67 @@
             t.resourceId
     </select>
 
+    <select id="DeviceResourceStatistics1" resultType="com.github.zuihou.tenant.vo.DeviceResourceStatisticsVo">
+        SELECT
+            t.resourceId,
+            t.resourceName,
+            t.dayDate,
+            -- 用/分隔零件名称
+            GROUP_CONCAT(t.bomName SEPARATOR '/') AS bomNames,
+            -- 用/分隔对应数量
+            GROUP_CONCAT(t.countSum SEPARATOR '/') AS counts
+        FROM
+            (
+                -- 先按设备、零件、日期统计基础数量
+                SELECT
+                    itp.id AS resourceId,
+                    itp.`name` AS resourceName,
+                    ibb.`name` AS bomName,
+                    DATE_FORMAT(ittn.start_time, '%Y-%m-%d') AS dayDate,
+                    COUNT(1) AS countSum
+                FROM
+                    zuihou_base_yj_0000.imcs_t_task_node ittn,
+                    zuihou_base_yj_0000.imcs_t_task itt,
+                    zuihou_base_yj_0000.imcs_tenant_productionresource itp,
+                    zuihou_base_yj_0000.imcs_b_bom ibb
+                WHERE
+                    ittn.target_resource_id = itp.id
+                  AND ittn.task_id = itt.id
+                  AND itt.bom_id = ibb.id
+                  AND ittn.end_time IS NOT NULL
+                  AND ittn.node_name = '放本序设备'
+                  AND ittn.exe_result = '1'
+                  AND itp.mode_specification IS NOT NULL
+                <if test="params.startDate != null and params.startDate != '' and params.endDate != null and params.endDate != ''">
+                    AND ittn.start_time BETWEEN #{params.startDate} AND #{params.endDate}
+                </if>
+                <if test="params.month != null and params.month != ''">
+                    AND DATE_FORMAT(ittn.start_time, '%Y-%m') = #{params.month}
+                </if>
+                <if test="params.years != null and params.years != ''">
+                    AND DATE_FORMAT(ittn.start_time, '%Y') = #{params.years}
+                </if>
+                <if test="params.resourceName != null and params.resourceName != ''">
+                    AND itp.`name` like concat('%',#{params.resourceName},'%')
+                </if>
+                <if test="params.today != null and params.today != ''">
+                    AND DATE_FORMAT(ittn.start_time, '%Y-%m-%d') = #{params.today}
+                </if>
+                <if test="params.resourceId != null and params.resourceId != ''">
+                    AND ittn.target_resource_id = #{params.resourceId}
+                </if>
+                GROUP BY
+                    itp.id, itp.`name`, ibb.`name`, DATE_FORMAT(ittn.start_time, '%Y-%m-%d')
+            ) t
+        GROUP BY
+            t.resourceId, t.resourceName, t.dayDate
+        ORDER BY
+
+            t.dayDate ASC,
+            t.resourceId
+
+    </select>
+
     <select id="deviceResourceDetail" resultType="com.github.zuihou.tenant.vo.DeviceResourceDetailVo">
         SELECT
             c.order_no,

+ 92 - 61
imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/statisticalAnalysis/ProductLinePerformanceController.java

@@ -20,6 +20,7 @@ import com.github.zuihou.tenant.dto.ProductDto;
 import com.github.zuihou.tenant.dto.ProductInfoDto;
 import com.github.zuihou.tenant.dto.ProductionStatisticalDto;
 import com.github.zuihou.tenant.vo.DeviceResourceDetailVo;
+import com.github.zuihou.tenant.vo.DeviceResourceStatisticsVo;
 import com.github.zuihou.tenant.vo.DeviceResourceSumVo;
 import com.github.zuihou.tenant.vo.ProductVo;
 import io.swagger.annotations.Api;
@@ -59,17 +60,17 @@ public class ProductLinePerformanceController extends SuperController<ProductLin
         LbqWrapper<TaskNode> wrapper = wrap.lambda();
         String statisticalBeginDate;
         String statisticalEndDate;
-        if(null == data.getStatisticalDate()){
+        if (null == data.getStatisticalDate()) {
             Calendar now = Calendar.getInstance();
-            now.add(Calendar.MONTH,-3);
+            now.add(Calendar.MONTH, -3);
             statisticalBeginDate = com.github.zuihou.common.util.DateUtil.beginMonthTime(now.getTime());
             statisticalEndDate = com.github.zuihou.common.util.DateUtil.endMonthTime(new Date());
-        }else{
-            Date SearchDate = com.github.zuihou.common.util.DateUtil.stringToDate0(data.getStatisticalDate(),"yyyy-MM");
+        } else {
+            Date SearchDate = com.github.zuihou.common.util.DateUtil.stringToDate0(data.getStatisticalDate(), "yyyy-MM");
             statisticalBeginDate = com.github.zuihou.common.util.DateUtil.beginMonthTime(SearchDate);
             statisticalEndDate = com.github.zuihou.common.util.DateUtil.endMonthTime(SearchDate);
         }
-        wrapper.between(TaskNode::getStartTime,DateUtil.stringToDate7(statisticalBeginDate),DateUtil.stringToDate7(statisticalEndDate)).between(TaskNode::getEndTime,DateUtil.stringToDate7(statisticalBeginDate),DateUtil.stringToDate7(statisticalEndDate));
+        wrapper.between(TaskNode::getStartTime, DateUtil.stringToDate7(statisticalBeginDate), DateUtil.stringToDate7(statisticalEndDate)).between(TaskNode::getEndTime, DateUtil.stringToDate7(statisticalBeginDate), DateUtil.stringToDate7(statisticalEndDate));
         page.orders().remove(0);
         baseService.pageList(page, wrapper);
     }
@@ -88,11 +89,11 @@ public class ProductLinePerformanceController extends SuperController<ProductLin
 
     @ApiOperation(value = "查询产线月设备OEE", notes = "查询产线月份人员日工时管理")
     @PostMapping("/queryProductionLineOee")
-    public R<Map<String,List>> queryProductionLineOee(@RequestBody(required = true) TaskNode params) {
+    public R<Map<String, List>> queryProductionLineOee(@RequestBody(required = true) TaskNode params) {
         List<TaskNode> datas = baseService.queryProductionLineOee(params);
-        Map<String,List> oee = new HashMap<String,List>();
-        List xData= new ArrayList();
-        List yData= new ArrayList();
+        Map<String, List> oee = new HashMap<String, List>();
+        List xData = new ArrayList();
+        List yData = new ArrayList();
         xData = datas.stream().map((map) -> {
             return map.getResourceName();
         }).collect(Collectors.toList());
@@ -100,8 +101,8 @@ public class ProductLinePerformanceController extends SuperController<ProductLin
         yData = datas.stream().map((map) -> {
             return map.getResourceOee();
         }).collect(Collectors.toList());
-        oee.put("xData",xData);
-        oee.put("yData",yData);
+        oee.put("xData", xData);
+        oee.put("yData", yData);
         return success(oee);
     }
 
@@ -109,9 +110,9 @@ public class ProductLinePerformanceController extends SuperController<ProductLin
     @PostMapping("/getProductStatistics/{page}/{limit}")
     @SysLog("产品流转详汇总")
     public R<IPage<ProductDto>> getProductStatistics(@PathVariable long page,
-                                                    @PathVariable long limit,
-                                                    @RequestBody(required = false)ProductVo vo) {
-        return success(baseService.getProductStatistics(page,limit,vo));
+                                                     @PathVariable long limit,
+                                                     @RequestBody(required = false) ProductVo vo) {
+        return success(baseService.getProductStatistics(page, limit, vo));
     }
 
     @ApiOperation(value = "产品流转详情", notes = "产品流转详情")
@@ -119,8 +120,8 @@ public class ProductLinePerformanceController extends SuperController<ProductLin
     @SysLog("产品流转详情")
     public R<IPage<ProductInfoDto>> getProductInfoStatistics(@PathVariable long page,
                                                              @PathVariable long limit,
-                                                             @RequestBody(required = false)ProductVo vo) {
-        return success(baseService.getProductInfoStatistics(page,limit,vo));
+                                                             @RequestBody(required = false) ProductVo vo) {
+        return success(baseService.getProductInfoStatistics(page, limit, vo));
     }
 
     @ApiOperation(value = "产品流转详情excle导出", notes = "产品流转详情excle导出")
@@ -134,11 +135,12 @@ public class ProductLinePerformanceController extends SuperController<ProductLin
     @GetMapping("/expectProduct")
     @SysLog("产品流转详汇总导出")
     public void expectProduct(HttpServletRequest request, HttpServletResponse response) throws IOException {
-        baseService.expectProduct(request,response);
+        baseService.expectProduct(request, response);
     }
 
     /**
      * 设备工时统计
+     *
      * @param page
      * @param limit
      * @return
@@ -147,35 +149,35 @@ public class ProductLinePerformanceController extends SuperController<ProductLin
     @PostMapping("/queryProcedure/{page}/{limit}")
     public R<IPage<ProductionStatisticalDto>> queryProcedure(@PathVariable Long page,
                                                              @PathVariable Long limit,
-                                                             @RequestBody(required = false)ProductVo vo) {
-        return success(baseService.queryProcedure(page,limit,vo));
+                                                             @RequestBody(required = false) ProductVo vo) {
+        return success(baseService.queryProcedure(page, limit, vo));
     }
 
     @ApiOperation(value = "设备工时导出", notes = "设备工时导出管理")
     @GetMapping("/expectProcedure")
     @SysLog("设备工时导出")
     public void expectProcedure(HttpServletRequest request, HttpServletResponse response) throws IOException {
-        baseService.expectProcedure(request,response);
+        baseService.expectProcedure(request, response);
     }
 
     @ApiOperation(value = "产品加工汇总", notes = "产品加工汇总")
     @PostMapping("/procedureSum/{page}/{limit}")
     public R<IPage<ProcedureSumDto>> procedureSum(@PathVariable Long page,
                                                   @PathVariable Long limit,
-                                                  @RequestBody(required = false)ProductVo vo) {
-        return success(baseService.procedureSum(page,limit,vo));
+                                                  @RequestBody(required = false) ProductVo vo) {
+        return success(baseService.procedureSum(page, limit, vo));
     }
 
     @ApiOperation(value = "产品加工汇总导出", notes = "产品加工汇总导出管理")
     @GetMapping("/expectprocedureSum")
     @SysLog("产品加工汇总导出")
     public void expectprocedureSum(HttpServletRequest request, HttpServletResponse response) throws IOException {
-        baseService.expectprocedureSum(request,response);
+        baseService.expectprocedureSum(request, response);
     }
 
     @ApiOperation(value = "产品加工详情", notes = "产品加工详情")
     @PostMapping("/procedureInfo")
-    public R<Map<String,Object>> procedureInfo(@RequestBody(required = true) TaskNode params) {
+    public R<Map<String, Object>> procedureInfo(@RequestBody(required = true) TaskNode params) {
         return success(baseService.procedureInfo(params));
     }
 
@@ -184,9 +186,20 @@ public class ProductLinePerformanceController extends SuperController<ProductLin
     @SysLog("产品流转详汇总")
     public R<IPage<DeviceResourceSumVo>> deviceResourceSum(@PathVariable Long page,
                                                            @PathVariable Long limit,
-                                                           @RequestBody Map<String,Object> params) {
-        Page pageInfo = new Page<>(page,limit);
-        return success(baseService.deviceResourceSum(pageInfo,params));
+                                                           @RequestBody Map<String, Object> params) {
+        Page pageInfo = new Page<>(page, limit);
+        return success(baseService.deviceResourceSum(pageInfo, params));
+    }
+
+
+    @ApiOperation(value = "设备资源统计", notes = "设备资源统计")
+    @PostMapping("/DeviceResourceStatistics/{page}/{limit}")
+    @SysLog("设备资源统计")
+    public R<IPage<DeviceResourceSumVo>> DeviceResourceStatistics(@PathVariable Long page,
+                                                                  @PathVariable Long limit,
+                                                                  @RequestBody Map<String, Object> params) {
+        Page pageInfo = new Page<>(page, limit);
+        return success(baseService.deviceResourceSum(pageInfo, params));
     }
 
 
@@ -195,22 +208,40 @@ public class ProductLinePerformanceController extends SuperController<ProductLin
     @SysLog("设备资源生产明细")
     public R<IPage<DeviceResourceDetailVo>> deviceResourceDetail(@PathVariable Long page,
                                                                  @PathVariable Long limit,
-                                                                 @RequestBody Map<String,Object> params) {
-        Page pageInfo = new Page<>(page,limit);
-        return success(baseService.deviceResourceDetail(pageInfo,params));
+                                                                 @RequestBody Map<String, Object> params) {
+        Page pageInfo = new Page<>(page, limit);
+        return success(baseService.deviceResourceDetail(pageInfo, params));
+    }
+
+
+    @ApiOperation(value = "统计报表", notes = "统计报表")
+    @PostMapping("/DeviceResourceStatistics1/{page}/{limit}")
+    @SysLog("统计报表")
+    public R<IPage<DeviceResourceStatisticsVo>> DeviceResourceStatistics1(@PathVariable Long page,
+                                                                         @PathVariable Long limit, @RequestBody Map<String, Object> params) {
+        Page<Object> objectPage = new Page<>(page, limit);
+        return success(baseService.DeviceResourceStatistics1(objectPage,params));
+    }
+
+
+    @ApiOperation(value = "统计报表导出", notes = "统计报表导出")
+    @PostMapping("/exportDeviceResourceStatistics1")
+    @SysLog("统计报表导出")
+    public void exportDeviceResourceStatistics1(@RequestBody Map<String, Object> params, HttpServletResponse response) throws IOException {
+        baseService.exportDeviceResourceStatistics1(params, response);
     }
 
     @ApiOperation(value = "任务资源汇总", notes = "任务资源汇总")
     @PostMapping("/taskResourceSum")
     @SysLog("任务资源汇总")
-    public R<List<Map<String, Object>>> taskResourceSum(@RequestBody Map<String,Object> params) {
+    public R<List<Map<String, Object>>> taskResourceSum(@RequestBody Map<String, Object> params) {
         return success(baseService.taskResourceSum(params));
     }
 
     @ApiOperation(value = "任务资源汇总导出", notes = "任务资源汇总导出")
     @PostMapping("/exportTaskResourceSum")
     @SysLog("任务资源汇总")
-    public void exportTaskResourceSum(@RequestBody Map<String,Object> params, HttpServletResponse response) throws IOException{
+    public void exportTaskResourceSum(@RequestBody Map<String, Object> params, HttpServletResponse response) throws IOException {
         //Map params = request.getParameterMap();
         baseService.exportTaskResource(params, response);
     }
@@ -219,16 +250,16 @@ public class ProductLinePerformanceController extends SuperController<ProductLin
     @PostMapping("/taskResourceDetail/{page}/{limit}")
     @SysLog("任务资源详情")
     public R<IPage<TTask>> taskResourceDetail(@PathVariable Long page,
-                                           @PathVariable Long limit,
-                                           @RequestBody Map<String,Object> params) {
-        Page pageInfo = new Page<>(page,limit);
-        return success(baseService.taskResourceDetail(pageInfo,params));
+                                              @PathVariable Long limit,
+                                              @RequestBody Map<String, Object> params) {
+        Page pageInfo = new Page<>(page, limit);
+        return success(baseService.taskResourceDetail(pageInfo, params));
     }
 
     @ApiOperation(value = "设备资源主轴利用率", notes = "设备资源主轴利用率")
     @PostMapping("/resourceRate")
     @SysLog("设备资源生产明细")
-    public R<Map<String,List<String>>> resourceRate(@RequestBody Map<String,Object> params) {
+    public R<Map<String, List<String>>> resourceRate(@RequestBody Map<String, Object> params) {
         Map<String, List<String>> map = baseService.resourceRate(params);
         return success(map);
     }
@@ -237,65 +268,65 @@ public class ProductLinePerformanceController extends SuperController<ProductLin
     @PostMapping("/workHourReport/{page}/{limit}")
     @SysLog("工时定额报表")
     public R<IPage<DeviceResourceDetailVo>> workHourReport(@PathVariable Long page,
-                                                                 @PathVariable Long limit,
-                                                                 @RequestBody Map<String,Object> params) {
-        Page pageInfo = new Page<>(page,limit);
-        return success(baseService.workHourReport(pageInfo,params));
+                                                           @PathVariable Long limit,
+                                                           @RequestBody Map<String, Object> params) {
+        Page pageInfo = new Page<>(page, limit);
+        return success(baseService.workHourReport(pageInfo, params));
     }
 
     @ApiOperation(value = "其他工时报表", notes = "其他工时报表")
     @PostMapping("/otherHourReport/{page}/{limit}")
     @SysLog("其他工时报表")
     public R<IPage<DeviceResourceDetailVo>> otherHourReport(@PathVariable Long page,
-                                                           @PathVariable Long limit,
-                                                           @RequestBody Map<String,Object> params) {
-        Page pageInfo = new Page<>(page,limit);
-        return success(baseService.otherHourReport(pageInfo,params));
+                                                            @PathVariable Long limit,
+                                                            @RequestBody Map<String, Object> params) {
+        Page pageInfo = new Page<>(page, limit);
+        return success(baseService.otherHourReport(pageInfo, params));
     }
 
     @ApiOperation(value = "搬运设备统计", notes = "搬运设备统计")
     @PostMapping("/robotTaskSum/{page}/{limit}")
     @SysLog("搬运设备统计")
     public R<IPage<DeviceResourceSumVo>> robotTaskSum(@PathVariable Long page,
-                                                           @PathVariable Long limit,
-                                                           @RequestBody Map<String,Object> params) {
-        Page pageInfo = new Page<>(page,limit);
-        return success(baseService.robotTaskSum(pageInfo,params));
+                                                      @PathVariable Long limit,
+                                                      @RequestBody Map<String, Object> params) {
+        Page pageInfo = new Page<>(page, limit);
+        return success(baseService.robotTaskSum(pageInfo, params));
     }
 
     @ApiOperation(value = "超时任务统计", notes = "超时任务统计")
     @PostMapping("/overTimeTaskSum/{page}/{limit}")
     @SysLog("超时任务统计")
     public R<IPage<DeviceResourceSumVo>> overTimeTaskSum(@PathVariable Long page,
-                                                      @PathVariable Long limit,
-                                                      @RequestBody Map<String,Object> params) {
-        Page pageInfo = new Page<>(page,limit);
-        return success(baseService.overTimeTaskSum(pageInfo,params));
+                                                         @PathVariable Long limit,
+                                                         @RequestBody Map<String, Object> params) {
+        Page pageInfo = new Page<>(page, limit);
+        return success(baseService.overTimeTaskSum(pageInfo, params));
     }
 
     @ApiOperation(value = "完成任务统计", notes = "完成任务统计")
     @PostMapping("/taskStatusSum")
     @SysLog("完成任务统计")
-    public R<Map<String,List<String>>> taskStatusSum(@RequestBody Map<String,Object> params) {
-          return success(baseService.taskStatusSum(params));
+    public R<Map<String, List<String>>> taskStatusSum(@RequestBody Map<String, Object> params) {
+        return success(baseService.taskStatusSum(params));
     }
 
     @ApiOperation(value = "AGV任务统计", notes = "AGV任务统计")
     @PostMapping("/taskAGVSum")
     @SysLog("AGV任务统计")
-    public R<Map<String,List<String>>> taskAGVSum(@RequestBody Map<String,Object> params) {
+    public R<Map<String, List<String>>> taskAGVSum(@RequestBody Map<String, Object> params) {
         return success(baseService.taskAGVSum(params));
     }
 
     @ApiOperation(value = "未完成业务统计详情", notes = "未完成业务统计详情")
     @PostMapping("/unFinishedBiz")
     @SysLog("未完成业务统计详情")
-    public R unFinishedBiz(@RequestBody Map<String,Object> params) {
+    public R unFinishedBiz(@RequestBody Map<String, Object> params) {
         //String taskType = params.containsKey("taskType")? params.get("taskType").toString() : null;
-        String type = params.containsKey("type")? params.get("type").toString() : null;
-        Page page = new Page<>(1,1000);
-        if(StringUtils.isEmpty(type)) return success(baseService.unFinishedTask(page, params));
-        if(type.equals("agv")) return success(baseService.unFinishedAGV(page, params));
+        String type = params.containsKey("type") ? params.get("type").toString() : null;
+        Page page = new Page<>(1, 1000);
+        if (StringUtils.isEmpty(type)) return success(baseService.unFinishedTask(page, params));
+        if (type.equals("agv")) return success(baseService.unFinishedAGV(page, params));
         return success(baseService.unFinishedTask(page, params));
     }
 

+ 35 - 0
imcs-admin-boot/imcs-tenant-entity/src/main/java/com/github/zuihou/tenant/vo/DeviceResourceStatisticsVo.java

@@ -0,0 +1,35 @@
+package com.github.zuihou.tenant.vo;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class DeviceResourceStatisticsVo {
+
+    @ApiModelProperty(value = "设备ID")
+//    @Excel(name = "设备ID", width = 30)
+    private Long resourceId;
+
+    @ApiModelProperty(value = "设备名称")
+    @Excel(name = "设备名称", width = 30)
+    private String resourceName;
+
+    @ApiModelProperty(value = "日期")
+    @Excel(name = "日期", width = 30)
+    private String dayDate;
+
+    @ApiModelProperty(value = "工艺")
+    @Excel(name = "工艺", width = 30)
+    private String bomNames;
+
+    @ApiModelProperty(value = "加工数量")
+    @Excel(name = "加工数量", width = 30)
+    private String counts;
+
+    @ApiModelProperty(value = "主轴利用率")
+    @Excel(name = "主轴利用率", width = 30)
+    private String resourceZZLYL;
+
+
+}