From 3793ba4a9b6be8faa6df0d4a76c06763ac03f873 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期三, 29 十月 2025 15:06:04 +0800
Subject: [PATCH] 外购成品报检相关问题调整

---
 inspect-server/src/main/java/com/ruoyi/inspect/controller/RawMaterialOrderController.java |  104 ++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 77 insertions(+), 27 deletions(-)

diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/controller/RawMaterialOrderController.java b/inspect-server/src/main/java/com/ruoyi/inspect/controller/RawMaterialOrderController.java
index 5ec41ee..c62878c 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/controller/RawMaterialOrderController.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/controller/RawMaterialOrderController.java
@@ -1,13 +1,20 @@
 package com.ruoyi.inspect.controller;
 
+import com.alibaba.excel.EasyExcel;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.basic.dto.*;
 import com.ruoyi.basic.pojo.IfsInventoryQuantity;
+import com.ruoyi.common.annotation.PersonalScope;
+import com.ruoyi.common.enums.OrderType;
+import com.ruoyi.framework.exception.ErrorException;
+import com.ruoyi.inspect.dto.InsPlaceOrderDto;
+import com.ruoyi.inspect.dto.OrderSplitDTO;
 import com.ruoyi.inspect.dto.SampleProductDto;
 import com.ruoyi.inspect.pojo.InsOrder;
 import com.ruoyi.inspect.pojo.RawMaterialOrderTemplate;
+import com.ruoyi.inspect.service.InsOrderService;
 import com.ruoyi.inspect.service.RawMaterialOrderService;
 import com.ruoyi.inspect.service.RawMaterialOrderTemplateService;
 import com.ruoyi.common.core.domain.Result;
@@ -17,12 +24,16 @@
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
+import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.File;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 
 /**
  * @Author zhuo
@@ -34,13 +45,14 @@
 @Api(tags = "鍘熸潗鏂欎笅鍗�")
 public class RawMaterialOrderController {
 
+    private InsOrderService insOrderService;
     private RawMaterialOrderService rawMaterialOrderService;
     private RawMaterialOrderTemplateService rawMaterialOrderTemplateService;
 
     @ApiOperation(value = "鏇村叿闆朵欢鍙疯幏鍙栨爣鍑嗘爲")
     @GetMapping("/selectStandardTreeListByPartNo")
     public Result selectStandardTreeListByPartNo(String partNo) {
-        return Result.success(rawMaterialOrderService.selectStandardTreeListByPartNo(partNo));
+        return rawMaterialOrderService.selectStandardTreeListByPartNo(partNo);
     }
 
     @ApiOperation(value = "鍘熸潗鏂欐楠屾煡璇唬涓嬪崟")
@@ -51,12 +63,16 @@
 
     @ApiOperation(value = "鍘熸潗鏂欐楠屾煡璇㈡楠屼腑")
     @GetMapping("/getIfsByStateOne")
+    @PreAuthorize("@ss.hasPermi('business:order')")
+    @PersonalScope(permsName = "business:order", objectName = IfsInventoryQuantityDto.class, paramName = "createUser")
     public Result getIfsByStateOne(Page page, IfsInventoryQuantityDto ifsInventoryQuantityDto){
         return Result.success(rawMaterialOrderService.getIfsByStateOne(page, ifsInventoryQuantityDto));
     }
 
     @ApiOperation(value = "鍘熸潗鏂欐楠屾煡璇㈠凡妫�楠�")
     @GetMapping("/getIfsByOver")
+    @PreAuthorize("@ss.hasPermi('business:order')")
+    @PersonalScope(permsName = "business:order", objectName = IfsInventoryQuantitySupplierDto.class, paramName = "createUser")
     public Result getIfsByOver(Page page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto){
         return Result.success(rawMaterialOrderService.getIfsByOver(page, ifsInventoryQuantityDto));
     }
@@ -75,7 +91,7 @@
     @ApiOperation(value = "閫氳繃鍘熸潗鏂欐楠屽崟妯℃澘id鑾峰彇妫�楠屽崟妯℃澘鍐呭")
     @GetMapping("/selectRawMaterOrderTemplateById")
     public Result<?> selectRawMaterOrderTemplateById(Integer id) {
-        return Result.success("鎴愬姛", rawMaterialOrderTemplateService.selectRawMaterOrderTemplateById(id));
+        return Result.success(rawMaterialOrderTemplateService.selectRawMaterOrderTemplateById(id));
     }
 
     @ApiOperation(value = "鍒犻櫎鍘熸潗鏂欐楠屽崟妯℃澘")
@@ -83,7 +99,6 @@
     public Result<?> delRawMaterOrderTemplate(Integer id) {
         return Result.success(rawMaterialOrderTemplateService.delRawMaterOrderTemplate(id));
     }
-
 
     /**
      * 鎶ユ鎵归噺
@@ -93,19 +108,23 @@
     @ApiOperation(value = "鎶ユ鎵归噺")
     @PostMapping("/inspectionReport")
     public Result<?> inspectionReport(@RequestBody Map<String, Object> param) {
-        List<Integer> ids = (List<Integer>) param.get("ids");
-        return Result.success(rawMaterialOrderService.inspectionReport(ids));
+        List<Long> ids = (List<Long>) param.get("ids");
+        String orderType = Objects.nonNull(param.get("orderType"))?param.get("orderType").toString():"";
+        if(!OrderType.validateValue(orderType)){
+            throw new ErrorException("鎵归噺鎶ユ澶辫触,闈炴硶鐨勯攢鍞鍗曞垎绫绘灇涓�");
+        }
+        return Result.success(rawMaterialOrderService.inspectionReport(ids,orderType));
     }
 
     /**
      * 鍙栨秷鎶ユ
-     * @param param 鍘熸潗鏂欎笅鍗�
+     * @param param
      * @return
      */
     @ApiOperation(value = "鎾ら攢鎶ユ")
     @PostMapping("/revokeInspectionReport")
     public Result<?> revokeInspectionReport(@RequestBody Map<String, Object> param) {
-        Integer id = (Integer) param.get("id");
+        Long id = Long.parseLong(param.get("id").toString());
         return Result.success(rawMaterialOrderService.revokeInspectionReport(id));
     }
 
@@ -129,7 +148,6 @@
     @ApiOperation(value = "鎶ユ")
     @PostMapping("/inspectionReportOne")
     public Result<?> inspectionReportOne(@RequestBody IfsInventoryQuantity ifsInventoryQuantity) {
-
         return Result.success(rawMaterialOrderService.inspectionReportOne(ifsInventoryQuantity));
     }
 
@@ -141,7 +159,7 @@
     @ApiOperation(value = "鑾峰彇閾滀骇涓氶摼妫�娴嬫暟鎹�")
     @GetMapping("/getIndustryChain")
     public Result<?> getIndustryChain(Integer id) {
-        return Result.success("鎴愬姛", rawMaterialOrderService.getIndustryChain(id));
+        return Result.success(rawMaterialOrderService.getIndustryChain(id));
     }
 
     /**
@@ -152,19 +170,15 @@
     @ApiOperation(value = "鍘熸潗鏂欐挙閿�涓嬪崟")
     @GetMapping("/repealRawOrder")
     public Result<?> repealRawOrder(@RequestBody Map<String, Object> param){
-        Integer ifsInventoryId = (Integer) param.get("ifsInventoryId");
+        Long ifsInventoryId = Long.parseLong(param.get("ifsInventoryId").toString());
         return Result.success(rawMaterialOrderService.repealRawOrder(ifsInventoryId));
     }
 
 
     @ApiOperation(value = "鍘熸潗鏂欎笅鍗曞厤妫�")
     @PostMapping("/addExemptionOrder")
-    public Result<?> addExemptionOrder(String str) {
-        Map<String, Object> map = JSON.parseObject(str, Map.class);
-        JSONArray jsonArray = JSON.parseArray(map.get("list")+"");
-        List<SampleProductDto> list = jsonArray.toJavaList(SampleProductDto.class);
-        InsOrder insOrder = JSON.parseObject(JSON.toJSONString(map.get("insOrder")), InsOrder.class);
-        return Result.success(rawMaterialOrderService.addExemptionOrder(list, insOrder));
+    public Result<?> addExemptionOrder(@RequestBody InsPlaceOrderDto insPlaceOrderDto) {
+        return Result.success(rawMaterialOrderService.addExemptionOrder(insPlaceOrderDto.getSampleList(), insPlaceOrderDto.getInsOrder()));
     }
 
 
@@ -176,7 +190,7 @@
 
     /**
      * 鍙栨秷鎶ユ
-     * @param id 鍘熸潗鏂欎笅鍗�
+     * @param id
      * @return
      */
     @ApiOperation(value = "鍒犻櫎鍘熸潗鏂欐姤妫�淇℃伅")
@@ -193,7 +207,7 @@
     @ApiOperation(value = "鍘熸潗鏂欎笅鍗曟斁琛屽厤妫�")
     @PostMapping("/rawOrderRelease")
     public Result<?> rawOrderRelease(@RequestBody Map<String, Object> param){
-        Integer ifsInventoryId = (Integer) param.get("ifsInventoryId");
+        Long ifsInventoryId = Long.parseLong(param.get("ifsInventoryId").toString());
         String partDetail = (String) param.get("partDetail");
         return Result.success(rawMaterialOrderService.rawOrderRelease(ifsInventoryId, partDetail));
     }
@@ -205,14 +219,16 @@
      */
     @ApiOperation(value = "鍘熸潗鏂欎笅鍗曢�氱煡鍏嶆鎴栬�呭娆℃楠�")
     @GetMapping("/notificationRawOrder")
-    public Result<?> notificationRawOrder(Integer ifsInventoryId){
+    public Result<?> notificationRawOrder(Long ifsInventoryId){
         return Result.success(rawMaterialOrderService.notificationRawOrder(ifsInventoryId));
     }
 
 
     @ApiOperation(value = "鍘熸潗鏂欐姤妫�鏌ヨ鍏ㄩ儴")
+    @PreAuthorize("@ss.hasPermi('get:Ifs:ByAll')")
     @GetMapping("/getIfsByAll")
     public Result getIfsByAll(Page page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto){
+        ifsInventoryQuantityDto.setOrderType(OrderType.RAW.getValue());
         return Result.success(rawMaterialOrderService.getIfsByOver(page, ifsInventoryQuantityDto));
     }
 
@@ -228,6 +244,7 @@
     @GetMapping("/getIfsByFinish")
     public Result getIfsByFinish(Page page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto) throws Exception {
         ifsInventoryQuantityDto.setIsFinish(1);
+        ifsInventoryQuantityDto.setOrderType(OrderType.RAW.getValue());
         return Result.success(rawMaterialOrderService.getIfsByOver(page, ifsInventoryQuantityDto));
     }
 
@@ -238,14 +255,18 @@
         return Result.success();
     }
 
+
+
+    @ApiOperation(value = "閾滃崟涓濅笅鍗�")
+    @PostMapping("/addRawCopperOrder")
+    public Result<?> addRawCopperOrder(@RequestBody InsPlaceOrderDto insPlaceOrderDto) {
+        return Result.success(insOrderService.addRawCopperOrder(insPlaceOrderDto.getSampleList(), insPlaceOrderDto.getCopperInsOrder()));
+    }
+
     @ApiOperation(value = "閾滃崟涓濅笅鍗曞厤妫�")
     @PostMapping("/addRawCopperOrderExemptionOrder")
-    public Result<?> addRawCopperOrderExemptionOrder(String str) {
-        Map<String, Object> map = JSON.parseObject(str, Map.class);
-        JSONArray jsonArray = JSON.parseArray(map.get("list")+"");
-        List<SampleProductDto> list = jsonArray.toJavaList(SampleProductDto.class);
-        CopperInsOrderDto CopperInsOrder = JSON.parseObject(JSON.toJSONString(map.get("insOrder")), CopperInsOrderDto.class);
-        return Result.success(rawMaterialOrderService.addRawCopperOrderExemptionOrder(list, CopperInsOrder));
+    public Result<?> addRawCopperOrderExemptionOrder(@RequestBody InsPlaceOrderDto insPlaceOrderDto) {
+        return Result.success(rawMaterialOrderService.addRawCopperOrderExemptionOrder(insPlaceOrderDto.getSampleList(), insPlaceOrderDto.getCopperInsOrder()));
     }
 
     /**
@@ -256,7 +277,7 @@
     @ApiOperation(value = "璁╂鏀捐")
     @PostMapping("/concessionRelease")
     public Result<?> concessionRelease(@RequestBody Map<String, Object> param){
-        Integer ifsInventoryId = (Integer) param.get("ifsInventoryId");
+        Long ifsInventoryId = Long.parseLong(param.get("ifsInventoryId").toString());
         return Result.success(rawMaterialOrderService.concessionRelease(ifsInventoryId));
     }
 
@@ -292,6 +313,8 @@
 
     @ApiOperation(value = "鍘熸潗鏂欐楠屾煡璇㈠搴︽楠�")
     @GetMapping("/getIfsByQuarter")
+    @PreAuthorize("@ss.hasPermi('business:order')")
+    @PersonalScope(permsName = "business:order", objectName = IfsInventoryQuantitySupplierDto.class, paramName = "createUser")
     public Result getIfsByQuarter(Page page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto){
         return Result.success(rawMaterialOrderService.getIfsByQuarter(page, ifsInventoryQuantityDto));
     }
@@ -304,8 +327,35 @@
     @ApiOperation(value = "鎻愬墠鍏ュ簱")
     @PostMapping("/advancedGodown")
     public Result<?> advancedGodown(@RequestBody Map<String, Object> param){
-        Integer ifsInventoryId = (Integer) param.get("ifsInventoryId");
+        Long ifsInventoryId = Long.parseLong(param.get("ifsInventoryId").toString());
         return Result.success(rawMaterialOrderService.advancedGodown(ifsInventoryId));
     }
 
+    /**
+     * 涓嬭浇璁㈠崟鎷嗗垎瀵煎叆妯℃澘
+     */
+    @ApiOperation(value = "涓嬭浇璁㈠崟鎷嗗垎瀵煎叆妯℃澘")
+    @GetMapping("/downloadTemplate")
+    public void downloadTemplate(HttpServletResponse response){
+        rawMaterialOrderService.downloadTemplate(response);
+    }
+
+    /**
+     * 涓嬭浇璁㈠崟鎷嗗垎瀵煎叆妯℃澘
+     */
+    @ApiOperation(value = "瀵煎叆璁㈠崟鎷嗗垎鏁版嵁")
+    @PostMapping("/importSplitOrderData")
+    public Result importSplitOrderData(@RequestParam(value = "file") MultipartFile file,@RequestParam("ifsId") Long ifsId, HttpServletRequest request){
+        return rawMaterialOrderService.importSplitOrderData(file,ifsId,request);
+    }
+
+    /**
+     * 纭鎷嗗垎璁㈠崟
+     */
+    @ApiOperation(value = "纭鎷嗗垎璁㈠崟")
+    @PostMapping("/confirmSplitOrder")
+    public Result confirmSplitOrder(@RequestBody OrderSplitDTO orderSplitDTO){
+        return Result.success(rawMaterialOrderService.confirmSplitOrder(orderSplitDTO));
+    }
+
 }

--
Gitblit v1.9.3