From 664db98c9e8595ce4dd636a27f480e3a08b81ff5 Mon Sep 17 00:00:00 2001
From: xyc <jc_xiong@hotmail.com>
Date: 星期五, 21 二月 2025 11:13:51 +0800
Subject: [PATCH] 新增可忽略的维修时间

---
 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/sysPictureBase/controller/SysPictureBaseController.java |   66 +++++++++-----------------------
 1 files changed, 19 insertions(+), 47 deletions(-)

diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/sysPictureBase/controller/SysPictureBaseController.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/sysPictureBase/controller/SysPictureBaseController.java
index 36df92b..29e7de6 100644
--- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/sysPictureBase/controller/SysPictureBaseController.java
+++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/sysPictureBase/controller/SysPictureBaseController.java
@@ -50,7 +50,8 @@
     @ApiImplicitParams({
             @ApiImplicitParam(name = Constant.Q.ORDER_FIELD, value = Constant.QV.ORDER_FIELD, dataType = Constant.QT.STRING),
             @ApiImplicitParam(name = Constant.Q.ORDER, value = Constant.QV.ORDER, dataType = Constant.QT.STRING),
-            @ApiImplicitParam(name = "productType", value = "妫�绱㈠叧閿瓧", dataType = Constant.QT.STRING, format = "CONTENT_TYPE^LK"), @ApiImplicitParam(name = "systemMark", value = "绯荤粺鏍囪瘑", dataType = Constant.QT.STRING, format = "SYSTEM_MARK^LK")})
+            @ApiImplicitParam(name = "productType", value = "妫�绱㈠叧閿瓧", dataType = Constant.QT.STRING, format = "PRODUCT_TYPE^EQ"),
+            @ApiImplicitParam(name = "systemMark", value = "绯荤粺鏍囪瘑", dataType = Constant.QT.STRING, format = "SYSTEM_MARK^LK")})
     public Result<List<SysPictureBase>> page(@ApiIgnore @QueryParam QueryFilter queryFilter) {
 
         return Result.ok(sysPictureBaseService.page(queryFilter));
@@ -66,55 +67,15 @@
     @PostMapping("save")
     @ApiOperation("淇濆瓨")
     @LogOperation("淇濆瓨")
-    public Result save(@RequestBody MultipartFile file, Long id, Integer isDefault,
-                       String name, String contentType, Integer productType,  String remark) {
-        SysPictureBase sysPictureBase;
-        if (id != 0) {
-            sysPictureBase = sysPictureBaseService.get(id);
-            sysPictureBase.setIsDefault(isDefault);
-            sysPictureBase.setName(name);
-            sysPictureBase.setContentType(contentType);
-            sysPictureBase.setProductType(productType);
-            sysPictureBase.setRemark(remark);
+    public Result save(@RequestBody SysPictureBase sysPictureBase) {
+        if (sysPictureBase.getId() != null) {
             sysPictureBaseService.update(sysPictureBase);
         } else {
-            sysPictureBase = new SysPictureBase();
-            sysPictureBase.setIsDefault(isDefault);
-            sysPictureBase.setName(name);
-            sysPictureBase.setContentType(contentType);
-            sysPictureBase.setProductType(productType);
-            sysPictureBase.setRemark(remark);
             sysPictureBaseService.insert(sysPictureBase);
         }
-        if (sysPictureBase.getIsDefault()==1){
-            sysPictureBaseService.updateByDefault(sysPictureBase.getId(),sysPictureBase.getProductType());
-            sysPictureBaseService.updateProdeuctImg(sysPictureBase.getId(),sysPictureBase.getProductType());
-        }
-        if (file != null) {
-            BufferedImage bufferedImage = null;
-            try {
-                String fileName = file.getOriginalFilename();
-                String[] arr = fileName.split("\\.");
-                String suffixName = arr[arr.length - 1].toLowerCase();
-
-                bufferedImage = ImageIO.read(file.getInputStream());
-                // 瀹藉害
-                int width = bufferedImage.getWidth();
-                sysPictureBase.setWidth(width);
-                // 楂樺害
-                int height = bufferedImage.getHeight();
-                sysPictureBase.setHeight(height);
-                sysPictureBaseService.update(sysPictureBase);
-                String tempUploadDir = localPath + "/product_img/";
-                File dir = new File(tempUploadDir);
-                if (!dir.exists()) {
-                    dir.mkdirs();
-                }
-                ImageIO.write(bufferedImage, suffixName, new File(tempUploadDir + sysPictureBase.getId().toString()));
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-
+        if (sysPictureBase.getIsDefault() == 1 && sysPictureBase.getProductType()!=20) {
+            sysPictureBaseService.updateByDefault(sysPictureBase.getId(), sysPictureBase.getProductType());
+            sysPictureBaseService.updateProdeuctImg(sysPictureBase.getId(), sysPictureBase.getProductType(), null);
         }
         return Result.ok();
     }
@@ -143,11 +104,22 @@
             //鍏虫祦
             outputStream.close();
             in.close();
-        }  catch (IOException e) {
+        } catch (IOException e) {
             e.printStackTrace();
         }
     }
 
+    @RequestMapping("/getSvgImage")
+    public void getSvgImage(HttpServletResponse response, Long id) {
+        sysPictureBaseService.getSvgImage(response,id);
+    }
+
+    @GetMapping("/getDefaultImg")
+    public Result<SysPictureBase> getDefaultImg(Integer productType) {
+        SysPictureBase data = sysPictureBaseService.getDefaultImg(productType);
+        return Result.ok(data);
+    }
+
     @DeleteMapping
     @ApiOperation("鍒犻櫎")
     @LogOperation("鍒犻櫎")

--
Gitblit v1.9.1