From 7ff5e9edadf446d0d033574a7b0ae802f5ac2233 Mon Sep 17 00:00:00 2001
From: cl <418351270@qq.com>
Date: 星期六, 17 二月 2024 15:36:20 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 jcdm-main/src/main/java/com/jcdm/main/bs/orderScheduling/controller/BsOrderSchedulingController.java |  122 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 122 insertions(+), 0 deletions(-)

diff --git a/jcdm-main/src/main/java/com/jcdm/main/bs/orderScheduling/controller/BsOrderSchedulingController.java b/jcdm-main/src/main/java/com/jcdm/main/bs/orderScheduling/controller/BsOrderSchedulingController.java
index 48cd9bc..8dee271 100644
--- a/jcdm-main/src/main/java/com/jcdm/main/bs/orderScheduling/controller/BsOrderSchedulingController.java
+++ b/jcdm-main/src/main/java/com/jcdm/main/bs/orderScheduling/controller/BsOrderSchedulingController.java
@@ -1,7 +1,27 @@
 package com.jcdm.main.bs.orderScheduling.controller;
 
+import java.io.IOException;
+import java.util.ArrayList;
 import java.util.List;
+import java.util.stream.Collectors;
+import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
+
+import cn.hutool.core.collection.CollUtil;
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.ExcelWriter;
+import com.alibaba.excel.write.metadata.WriteSheet;
+import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
+import com.jcdm.common.annotation.Excel;
+import com.jcdm.common.core.domain.R;
+import com.jcdm.common.core.domain.entity.SysDictData;
+import com.jcdm.common.utils.DictUtils;
+import com.jcdm.common.utils.StringUtils;
+import com.jcdm.main.bs.orderScheduling.vo.FollowReportVO;
+import com.jcdm.main.bs.orderScheduling.vo.LineChartVO;
+import com.jcdm.main.da.paramCollection.domain.DaParamCollection;
+import com.jcdm.main.da.passingStationCollection.domain.DaPassingStationCollection;
+import com.jcdm.system.service.ISysDictDataService;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -34,6 +54,10 @@
     @Autowired
     private IBsOrderSchedulingService bsOrderSchedulingService;
 
+
+    @Resource
+    private ISysDictDataService iSysDictDataService;
+
     /**
      * 鏌ヨ璁㈠崟鎺掍骇鍒楄〃
      */
@@ -47,6 +71,104 @@
     }
 
     /**
+     * 鏌ヨ杩芥函鍒楄〃
+     */
+    @PreAuthorize("@ss.hasPermi('bs:orderScheduling:list')")
+    @GetMapping("/getFollowReportList")
+    public R getFollowReportList(BsOrderScheduling bsOrderScheduling)
+    {
+        FollowReportVO followReportList = bsOrderSchedulingService.getFollowReportList(bsOrderScheduling);
+        return R.ok(followReportList);
+    }
+
+    @PreAuthorize("@ss.hasPermi('bs:orderScheduling:export')")
+    @Log(title = "杩芥函鎶ヨ〃瀵煎嚭", businessType = BusinessType.EXPORT)
+    @PostMapping("/exportFollow")
+    public void exportFollow(HttpServletResponse response, BsOrderScheduling bsOrderScheduling)
+    {
+        FollowReportVO followReportList = bsOrderSchedulingService.getFollowReportList(bsOrderScheduling);
+        List<SysDictData> allDict = iSysDictDataService.selectDictDataList(null);
+        if (CollUtil.isNotEmpty(followReportList.getMainList())){
+            List<SysDictData> dict1 = allDict.stream().filter(x -> "material_type".equals(x.getDictType())).collect(Collectors.toList());
+            List<SysDictData> dict2 = allDict.stream().filter(x -> "order_scheduling_produce_status".equals(x.getDictType())).collect(Collectors.toList());
+            for (BsOrderScheduling orderScheduling : followReportList.getMainList()) {
+                if (CollUtil.isNotEmpty(dict1)){
+                    List<SysDictData> collect = dict1.stream().filter(x -> x.getDictValue().equals(orderScheduling.getProductType())).collect(Collectors.toList());
+                    if (CollUtil.isNotEmpty(collect)){
+                        SysDictData sysDictData1 = collect.get(0);
+                        orderScheduling.setProductTypeString(sysDictData1.getDictLabel());
+                    }
+                }
+                if (CollUtil.isNotEmpty(dict2)){
+                    List<SysDictData> collect = dict2.stream().filter(x -> x.getDictValue().equals(orderScheduling.getProductionStatus())).collect(Collectors.toList());
+                    if (CollUtil.isNotEmpty(collect)){
+                        SysDictData sysDictData1 = collect.get(0);
+                        orderScheduling.setProductionStatusString(sysDictData1.getDictLabel());
+                    }
+                }
+            }
+        }
+        String fileName = "杩芥函鎶ヨ〃";
+        try {
+            ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).build();
+            WriteSheet mainSheet = EasyExcel.writerSheet(0, "璁㈠崟鎺掍骇")
+                    .head(BsOrderScheduling.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
+                    .build();
+            WriteSheet sheet1 = EasyExcel.writerSheet(1, "鎷х揣鏁版嵁")
+                    .head(DaParamCollection.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
+                    .build();
+            WriteSheet sheet2 = EasyExcel.writerSheet(2, "鐩告満妫�娴�")
+                    .head(DaParamCollection.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
+                    .build();
+            WriteSheet sheet3 = EasyExcel.writerSheet(3, "澶栨紡妫�娴�")
+                    .head(DaParamCollection.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
+                    .build();
+            WriteSheet sheet4 = EasyExcel.writerSheet(4, "鏈烘补鍔犳敞")
+                    .head(DaParamCollection.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
+                    .build();
+            WriteSheet sheet5 = EasyExcel.writerSheet(5, "宸ヤ綅缁撴灉")
+                    .head(DaPassingStationCollection.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
+                    .build();
+            excelWriter.write(followReportList.getMainList(),mainSheet);
+            excelWriter.write(followReportList.getList1(),sheet1);
+            excelWriter.write(followReportList.getList2(),sheet2);
+            excelWriter.write(followReportList.getList3(),sheet3);
+            excelWriter.write(followReportList.getList4(),sheet4);
+            excelWriter.write(followReportList.getList5(),sheet5);
+            response.setContentType("application/vnd.ms-excel;charset=utf-8");
+            response.setCharacterEncoding("UTF-8");
+            response.setHeader("Content-Disposition","attachment;filename="+fileName+".xlsx");
+            excelWriter.finish();
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    /**
+     * 鏌ヨ涓嬬嚎鏁伴噺
+     */
+    @PreAuthorize("@ss.hasPermi('bs:orderScheduling:list')")
+    @GetMapping("/getOffLineNum")
+    public TableDataInfo getOffLineNum(BsOrderScheduling bsOrderScheduling)
+    {
+
+        List<LineChartVO> vo = bsOrderSchedulingService.getOffLineNum();
+        return getDataTable(vo);
+    }
+
+    @PreAuthorize("@ss.hasPermi('bs:orderScheduling:list')")
+    @GetMapping("/list2")
+    public TableDataInfo list2(BsOrderScheduling bsOrderScheduling)
+    {
+//        startPage();
+        List<BsOrderScheduling> list = new ArrayList<>();
+        if (StringUtils.isNotEmpty(bsOrderScheduling.getOrderNo())){
+            list = bsOrderSchedulingService.selectBsOrderSchedulingList(bsOrderScheduling);
+        }
+        return getDataTable(list);
+    }
+
+    /**
      * 瀵煎嚭璁㈠崟鎺掍骇鍒楄〃
      */
     @PreAuthorize("@ss.hasPermi('bs:orderScheduling:export')")

--
Gitblit v1.9.3