From a74c2b9d3faf522e572f5f0c466c07780138bb50 Mon Sep 17 00:00:00 2001
From: yuxc <yuxc@vci-tech.com>
Date: 星期五, 02 八月 2024 15:44:33 +0800
Subject: [PATCH] 返回错误状态修改

---
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsLinkTypeController.java |  128 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 128 insertions(+), 0 deletions(-)

diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsLinkTypeController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsLinkTypeController.java
index 1780a4c..eededfb 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsLinkTypeController.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsLinkTypeController.java
@@ -1,21 +1,34 @@
 package com.vci.web.controller;
 
+import com.vci.constant.FrameWorkLangCodeConstant;
 import com.vci.corba.common.PLException;
 import com.vci.corba.omd.ltm.LinkType;
 import com.vci.pagemodel.OsBtmTypeAttributeVO;
 import com.vci.pagemodel.OsLinkTypeAttributeVO;
 import com.vci.pagemodel.OsLinkTypeVO;
+import com.vci.starter.web.annotation.controller.VciUnCheckRight;
+import com.vci.starter.web.exception.VciBaseException;
 import com.vci.starter.web.pagemodel.BaseQueryObject;
 import com.vci.starter.web.pagemodel.BaseResult;
 import com.vci.starter.web.pagemodel.DataGrid;
+import com.vci.starter.web.util.LocalFileUtil;
+import com.vci.starter.web.util.VciBaseUtil;
 import com.vci.web.service.OsLinkTypeServiceI;
 import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.IOException;
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 /**
@@ -34,6 +47,11 @@
     private OsLinkTypeServiceI linkTypeService;
 
     /**
+     * 鏃ュ織
+     */
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    /**
      * 閾炬帴绫诲瀷鐨勫垪琛�
      * @param baseQueryObject 鏌ヨ瀵硅薄
      * @return 閾炬帴绫诲瀷鐨勬樉绀哄璞�
@@ -41,6 +59,22 @@
     @GetMapping("/gridLinkType")
     public DataGrid<OsLinkTypeVO> gridLinkType(BaseQueryObject baseQueryObject){
         return linkTypeService.gridLinkType(baseQueryObject);
+    }
+
+    /**
+     * 鏌ヨ鎵�鏈夌殑閾炬帴绫诲瀷鍚嶇О锛屽彲鐢ㄤ簬灞炴�ф睜鐨勮繛鎺ョ被鍨嬮�夋嫨鏃剁殑瀵硅瘽妗�
+     * @return 閾炬帴绫诲瀷鐨勬樉绀哄璞�
+     */
+    @GetMapping("/getAllLtName")
+    public BaseResult getAllLtName(){
+        try {
+            return BaseResult.dataList(linkTypeService.getAllLtName());
+        }catch (Exception e) {
+            e.printStackTrace();
+            String exceptionMessage = "閾炬帴绫诲瀷鍒楄〃鏌ヨ鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+            logger.error(exceptionMessage);
+            return BaseResult.fail(exceptionMessage);
+        }
     }
 
     /**
@@ -129,4 +163,98 @@
             return objectBaseResult;
         }
     }
+    /**
+     * 閾炬帴绫诲瀷鍒犻櫎
+     * linkType 閾炬帴绫诲瀷瀵硅薄
+     * @return 鍒犻櫎缁撴灉
+     */
+    @DeleteMapping("/deleteLink")
+    public BaseResult deleteLink(@RequestBody LinkType linkType){
+        try {
+            return linkTypeService.deleteLink(linkType);
+        } catch (PLException e) {
+            BaseResult objectBaseResult = new BaseResult<>();
+            objectBaseResult.setCode(Integer.parseInt(e.code));
+            objectBaseResult.setMsg(Arrays.toString(e.messages));
+            return objectBaseResult;
+        }
+    }
+
+    /**
+     * 涓�鑷存�ф鏌�
+     * @return 鍒犻櫎缁撴灉
+     */
+    @GetMapping("/checkLinkType")
+    public BaseResult checkLinkType(){
+        try {
+            return linkTypeService.checkLinkType();
+        } catch (PLException e) {
+            BaseResult objectBaseResult = new BaseResult<>();
+            objectBaseResult.setCode(Integer.parseInt(e.code));
+            objectBaseResult.setMsg(Arrays.toString(e.messages));
+            return objectBaseResult;
+        }
+    }
+
+    /**
+     * 涓�鑷存�ф鏌ヤ慨澶嶆暟鎹簱琛�
+     * repairData 闇�瑕佷慨澶嶇殑鏁版嵁
+     * @return 淇缁撴灉
+     */
+    @PostMapping("/repairTable")
+    public BaseResult repairTable(@RequestBody String repairData){
+        try {
+            return linkTypeService.repairTable(repairData);
+        } catch (PLException e) {
+            BaseResult objectBaseResult = new BaseResult<>();
+            objectBaseResult.setCode(Integer.parseInt(e.code));
+            objectBaseResult.setMsg(Arrays.toString(e.messages));
+            return objectBaseResult;
+        } catch (IOException e) {
+            BaseResult objectBaseResult = new BaseResult<>();
+            objectBaseResult.setCode(500);
+            objectBaseResult.setMsg(e.getMessage());
+            return objectBaseResult;
+        }
+    }
+
+    /**
+     * 鍒涘缓瑙嗗浘
+     * @return 鍒涘缓缁撴灉
+     */
+    @PostMapping("/createView")
+    public BaseResult createView(){
+        try {
+            return linkTypeService.createView();
+        } catch (PLException e) {
+            BaseResult objectBaseResult = new BaseResult<>();
+            objectBaseResult.setCode(Integer.parseInt(e.code));
+            objectBaseResult.setMsg(Arrays.toString(e.messages));
+            return objectBaseResult;
+        }
+    }
+
+    /**
+     * 瀵煎嚭閾炬帴绫诲瀷
+     * name 閾炬帴绫诲瀷鍚嶇О
+     * @return
+     */
+    @GetMapping("/expData")
+    public void expData(String name,HttpServletResponse response) throws PLException, IOException {
+        linkTypeService.expData(name, response);
+    }
+
+    /**
+     * 瀵煎叆閾炬帴绫诲瀷
+     * @param file 涓婁紶鐨勬枃浠�
+     * @return
+     */
+    @PostMapping("/impData")
+    @VciUnCheckRight
+    public BaseResult impData(MultipartFile file){try {
+             return linkTypeService.impData(file);
+        }catch (Throwable e) {
+            throw new VciBaseException(VciBaseUtil.getExceptionMessage(e),new String[0],e);
+        }
+    }
 }

--
Gitblit v1.9.3