From 986aa62ed00bee39363bab41b4eeb8259d446efd Mon Sep 17 00:00:00 2001
From: ludc <ludc@vci-tech.com>
Date: 星期四, 16 一月 2025 18:20:32 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebBtmTypeController.java |  151 +++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 130 insertions(+), 21 deletions(-)

diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebBtmTypeController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebBtmTypeController.java
index 7e6b5cf..6ae0bdc 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebBtmTypeController.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebBtmTypeController.java
@@ -1,10 +1,11 @@
 package com.vci.web.controller;
 
 import com.vci.corba.common.PLException;
-import com.vci.corba.omd.btm.BizType;
-import com.vci.corba.omd.ltm.LinkType;
 import com.vci.dto.OsBtmTypeDTO;
-import com.vci.starter.web.annotation.controller.VciUnCheckRight;
+import com.vci.model.IndexObject;
+import com.vci.pagemodel.OsBtmTypeAttributeVO;
+import com.vci.pagemodel.OsBtmTypeVO;
+import com.vci.pagemodel.OsERVO;
 import com.vci.starter.web.annotation.log.VciBusinessLog;
 import com.vci.starter.web.enumpck.BooleanEnum;
 import com.vci.starter.web.exception.VciBaseException;
@@ -12,24 +13,21 @@
 import com.vci.starter.web.pagemodel.BaseResult;
 import com.vci.starter.web.pagemodel.DataGrid;
 import com.vci.starter.web.pagemodel.Tree;
-import com.vci.starter.web.util.BeanUtil;
+import com.vci.starter.web.util.BeanUtilForVCI;
 import com.vci.starter.web.util.ControllerUtil;
 import com.vci.starter.web.util.LangBaseUtil;
 import com.vci.starter.web.util.VciBaseUtil;
-import com.vci.pagemodel.OsBtmTypeAttributeVO;
-import com.vci.pagemodel.OsBtmTypeVO;
-import com.vci.pagemodel.OsERVO;
 import com.vci.web.service.OsAttributeServiceI;
 import com.vci.web.service.OsBtmServiceI;
 import com.vci.web.service.OsLinkTypeServiceI;
 import com.vci.web.service.WebBtmIOServiceI;
-import feign.Param;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletResponse;
 import java.io.FileNotFoundException;
@@ -51,7 +49,6 @@
 @RequestMapping("/btmTypeController")
 @VciBusinessLog(modelName="涓氬姟绫诲瀷")
 @RestController
-@VciUnCheckRight
 public class WebBtmTypeController {
 
     /**
@@ -102,7 +99,6 @@
      */
     @GetMapping( "/getBizTypes")
     @VciBusinessLog(operateName = "涓氬姟绫诲瀷鍒楄〃(涓昏鐢ㄤ簬瀵硅瘽妗嗕娇鐢�)")
-    @VciUnCheckRight
     public BaseResult getBizTypes(String btmName){
         try {
             return BaseResult.dataList(Arrays.asList(btmService.getBizTypes(btmName)));
@@ -171,7 +167,7 @@
      * btmTypeDTO 閾炬帴绫诲瀷鐨勪繚瀛樺璞�
      * @return 淇濆瓨缁撴灉
      */
-    @PostMapping("/addBtmTypes")
+    /*@PostMapping("/addBtmTypes")
     public BaseResult addBtmTypes(@RequestBody List<BizType> bizTypes){
         try {
             return btmService.addBtmTypes(bizTypes) ? BaseResult.success("涓氬姟绫诲瀷鎵归噺鍒涘缓鎴愬姛锛�"):BaseResult.fail("涓氬姟绫诲瀷鎵归噺鍒涘缓澶辫触锛�");
@@ -181,14 +177,14 @@
             logger.error(exceptionMessage);
             return BaseResult.fail(exceptionMessage);
         }
-    }
+    }*/
 
     /**
      * 淇敼涓氬姟绫诲瀷
      * btmTypeDTO 閾炬帴绫诲瀷淇敼鐨勫璞�
      * @return 淇濆瓨缁撴灉
      */
-    @PostMapping("/updateBtmType")
+    @PutMapping("/updateBtmType")
     public BaseResult updateBtmType(@RequestBody OsBtmTypeDTO btmTypeDTO){
         try {
             return btmService.updateBtmType(btmTypeDTO) ? BaseResult.success("涓氬姟绫诲瀷淇敼鎴愬姛锛�"):BaseResult.fail("涓氬姟绫诲瀷淇敼澶辫触锛�");
@@ -318,6 +314,81 @@
     }
 
     /**
+     * 鑾峰彇褰撳墠涓氬姟绫诲瀷涓嬬殑绱㈠紩
+     * @return
+     * @throws PLException
+     */
+    @GetMapping("/getIndexByCondition")
+    public BaseResult getIndexByCondition(BaseQueryObject baseQueryObject){
+        try {
+            return BaseResult.dataList(btmService.getIndexByCondition(baseQueryObject.getConditionMap()));
+        } catch (Exception e) {
+            e.printStackTrace();
+            String exceptionMessage = "鏌ヨ褰撳墠涓氬姟绫诲瀷涓嬬殑绱㈠紩鏃舵椂鍑虹幇閿欒锛屽師鍥狅細" + VciBaseUtil.getExceptionMessage(e);
+            logger.error(exceptionMessage);
+            return BaseResult.fail(exceptionMessage);
+        }
+    }
+
+    /**
+     * 鍒涘缓绱㈠紩
+     * @param indexObjectList
+     * @return
+     */
+    @PostMapping("/addIndex")
+    public BaseResult addIndex(@RequestBody List<IndexObject> indexObjectList){
+        try {
+            return btmService.addIndex(indexObjectList) ? BaseResult.success("鍒涘缓绱㈠紩鎴愬姛!"):BaseResult.fail("鍒涘缓绱㈠紩澶辫触!");
+        } catch (Exception e) {
+            e.printStackTrace();
+            String exceptionMessage = "鍒涘缓绱㈠紩鏃舵椂鍑虹幇閿欒锛屽師鍥狅細" + VciBaseUtil.getExceptionMessage(e);
+            logger.error(exceptionMessage);
+            return BaseResult.fail(exceptionMessage);
+        }
+    }
+
+    /**
+     * 鍒犻櫎绱㈠紩
+     * @param btmName
+     * @param indexName
+     * @return
+     */
+    @DeleteMapping("/delIndex")
+    public BaseResult delIndex(String btmName,String indexName){
+        try {
+            return btmService.delIndex(btmName,indexName) ? BaseResult.success("鍒犻櫎绱㈠紩鎴愬姛!"):BaseResult.fail("鍒犻櫎绱㈠紩澶辫触!");
+        } catch (Exception e) {
+            e.printStackTrace();
+            String exceptionMessage = "鍒犻櫎绱㈠紩鏃舵椂鍑虹幇閿欒锛屽師鍥狅細" + VciBaseUtil.getExceptionMessage(e);
+            logger.error(exceptionMessage);
+            return BaseResult.fail(exceptionMessage);
+        }
+    }
+
+    /**
+     * 瀵煎嚭涓氬姟绫诲瀷
+     * name 閾炬帴绫诲瀷鍚嶇О
+     * @return
+     */
+    @GetMapping("/expData")
+    public void expData(String name,HttpServletResponse response) throws PLException, IOException {
+        btmService.expData(name, response);
+    }
+
+    /**
+     * 瀵煎叆涓氬姟绫诲瀷
+     * @param file 涓婁紶鐨勬枃浠�
+     * @return
+     */
+    @PostMapping("/impData")
+    public BaseResult impData(MultipartFile file){try {
+        return btmService.impData(file);
+    }catch (Throwable e) {
+        throw new VciBaseException(VciBaseUtil.getExceptionMessage(e),new String[0],e);
+    }
+    }
+
+    /**
      * 鑾峰彇涓氬姟绫诲瀷鍖呭惈鐨勫睘鎬у叏閮ㄤ负灏忓啓
      * @param btmId 涓氬姟绫诲瀷鍚嶇О
      * @return 灞炴�х殑淇℃伅
@@ -325,7 +396,15 @@
     @GetMapping(value = "/getAllAttributesByBtmId")
     @VciBusinessLog(operateName = "鏌ョ湅涓氬姟绫诲瀷鐨勫睘鎬�")
     public BaseResult<List<OsBtmTypeAttributeVO>> getAllAttributesByBtmId(String btmId){
-        List<OsBtmTypeAttributeVO> osBtmTypeAttributeVOS = btmService.listAttributeByBtmIdHasDefault(btmId);
+        List<OsBtmTypeAttributeVO> osBtmTypeAttributeVOS = null;
+        try {
+            osBtmTypeAttributeVOS = btmService.listAttributeByBtmIdHasDefault(btmId);
+        } catch (PLException e) {
+            e.printStackTrace();
+            String exceptionMessage = VciBaseUtil.getExceptionMessage(e);
+            logger.error(exceptionMessage);
+            throw new VciBaseException(exceptionMessage);
+        }
         return BaseResult.dataList(osBtmTypeAttributeVOS);
     }
 
@@ -379,7 +458,15 @@
         String hasDefaultAttr = baseQueryObject.getConditionMap().getOrDefault("hasDefaultAttr","false");
         String attrId = baseQueryObject.getConditionMap().containsKey("name")?baseQueryObject.getConditionMap().get("name").replace("*",""):"";
         String attrName = baseQueryObject.getConditionMap().containsKey("label") ? baseQueryObject.getConditionMap().get("label").replace("*","") : "";
-        List<OsBtmTypeAttributeVO> boAttrs = btmService.listAttributeByBtmId(btmTypeId);
+        List<OsBtmTypeAttributeVO> boAttrs = null;
+        try {
+            boAttrs = btmService.listAttributeByBtmId(btmTypeId);
+        } catch (PLException e) {
+            e.printStackTrace();
+            String exceptionMessage = VciBaseUtil.getExceptionMessage(e);
+            logger.error(exceptionMessage);
+            throw new VciBaseException(exceptionMessage);
+        }
         if(boAttrs == null){
             boAttrs = new ArrayList<>();
         }
@@ -388,9 +475,9 @@
             List<OsBtmTypeAttributeVO> finalBoAttrs = boAttrs;
             attributeService.getDefaultAttributeVOs().stream().forEach(attr->{
                 OsBtmTypeAttributeVO attributeVO = new OsBtmTypeAttributeVO();
-                BeanUtil.convert(attr,attributeVO);
+                BeanUtilForVCI.convert(attr,attributeVO);
                 attributeVO.setAttributeLength(attr.getAttrLength());
-                attributeVO.setAttrDataType(attr.getAttributeDataType());
+                attributeVO.setAttributeDataType(attr.getAttributeDataType());
                 attributeVO.setReferBtmTypeId(attr.getBtmTypeId());
                 attributeVO.setReferBtmTypeName(attr.getBtmTypeName());
                 finalBoAttrs.add(attributeVO);
@@ -427,7 +514,15 @@
         String attrId = baseQueryObject.getConditionMap().containsKey("name")?baseQueryObject.getConditionMap().get("name").replace("*",""):"";
         String attrName = baseQueryObject.getConditionMap().containsKey("label") ? baseQueryObject.getConditionMap().get("label").replace("*","") : "";
         OsBtmTypeVO btmTypeVO = btmService.selectByOid(btmTypeOid);
-        List<OsBtmTypeAttributeVO> boAttrs = btmService.listAttributeByBtmId(btmTypeVO.getId());
+        List<OsBtmTypeAttributeVO> boAttrs = null;
+        try {
+            boAttrs = btmService.listAttributeByBtmId(btmTypeVO.getId());
+        } catch (PLException e) {
+            e.printStackTrace();
+            String exceptionMessage = VciBaseUtil.getExceptionMessage(e);
+            logger.error(exceptionMessage);
+            throw new VciBaseException(exceptionMessage);
+        }
         List<OsBtmTypeAttributeVO> attrList = boAttrs.stream().filter(s->{
             boolean usedFlag = true;
             if(StringUtils.isNotBlank(attrId) && !s.getId().contains(attrId)){
@@ -514,8 +609,15 @@
      */
     @GetMapping("/createERDiagram")
     public BaseResult createERDiagram(String id){
-        OsERVO osERVO = btmService.createERDiagram(id);
-        return BaseResult.success(osERVO);
+        try {
+            OsERVO osERVO = btmService.createERDiagram(id);
+            return BaseResult.success(osERVO);
+        }catch (Exception e){
+            e.printStackTrace();
+            String msg = "鐢熸垚涓氬姟绫诲瀷浣跨敤鐨凟R鍥炬椂鍑虹幇閿欒锛屽師鍥狅細"+VciBaseUtil.getExceptionMessage(e);
+            logger.error(msg);
+            return BaseResult.fail(msg);
+        }
     }
 
     /**
@@ -525,7 +627,14 @@
      */
     @GetMapping("/createERUsed")
     public BaseResult createERUsed(String id){
-        return BaseResult.success(btmService.createERUsed(id));
+        try {
+            return BaseResult.success(btmService.createERUsed(id));
+        } catch (PLException e) {
+            e.printStackTrace();
+            String msg = "鍙栦娇鐢ㄨ繖涓笟鍔$被鍨嬬殑E-R鍥炬椂鍑虹幇閿欒锛屽師鍥狅細"+VciBaseUtil.getExceptionMessage(e);
+            logger.error(msg);
+            return BaseResult.fail(msg);
+        }
     }
 
 }

--
Gitblit v1.9.3