From de42c7075ba5a474ba74d8833e9830dfa1312464 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期三, 28 八月 2024 15:20:17 +0800
Subject: [PATCH] 业务类型查询模板接口上传

---
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebBtmTypeController.java |  319 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 308 insertions(+), 11 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 395bfa5..10c2d5c 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,6 +1,10 @@
 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.model.IndexObject;
 import com.vci.starter.web.annotation.controller.VciUnCheckRight;
 import com.vci.starter.web.annotation.log.VciBusinessLog;
 import com.vci.starter.web.enumpck.BooleanEnum;
@@ -18,13 +22,16 @@
 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;
@@ -34,6 +41,7 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 import static com.vci.constant.FrameWorkBusLangCodeConstant.DATA_OID_NOT_EXIST;
@@ -58,6 +66,12 @@
      */
     @Autowired
     private OsBtmServiceI btmService;
+
+    /**
+     * 杩炴帴绫诲瀷鐨勬湇鍔�
+     */
+    @Autowired
+    private OsLinkTypeServiceI linkTypeService;
 
     /**
      * 涓氬姟绫诲瀷瀵煎叆瀵煎嚭鏈嶅姟
@@ -102,23 +116,283 @@
         }
     }
 
-
     /**
      * 鑾峰彇鎵�鏈変笟鍔$被鍨嬶紙鏍戝舰缁撴瀯锛�
      * @return 鏌ヨ缁撴灉
      */
     @GetMapping( "/getTreeBizTypes")
     @VciBusinessLog(operateName = "鑾峰彇鎵�鏈変笟鍔$被鍨嬶紙鏍戝舰缁撴瀯锛�")
-    @VciUnCheckRight
     public BaseResult<List<Tree>> getTreeBizTypes(){
         try {
-            return btmService.getTreeBizTypes();
+            return BaseResult.dataList(btmService.getTreeBizTypes());
         }catch (Exception e) {
             e.printStackTrace();
-            String exceptionMessage = "鑾峰彇涓氬姟绫诲瀷鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+            String exceptionMessage = "鏌ヨ涓氬姟绫诲瀷鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
             logger.error(exceptionMessage);
             return BaseResult.fail(exceptionMessage);
         }
+    }
+
+    /**
+     * 鑾峰彇涓氬姟绫诲瀷浣跨敤鑼冨洿
+     * @param btmName
+     * @return 鏌ヨ缁撴灉
+     */
+    @GetMapping( "/getUsedBtmLinkList")
+    @VciBusinessLog(operateName = "鑾峰彇涓氬姟绫诲瀷浣跨敤鑼冨洿")
+    public BaseResult<List<String>> getUsedBtmLinkList(String btmName){
+        try {
+            return BaseResult.dataList(linkTypeService.getUsedBtmLinkList(btmName));
+        }catch (Exception e) {
+            e.printStackTrace();
+            String exceptionMessage = "鑾峰彇涓氬姟绫诲瀷浣跨敤鑼冨洿鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+            logger.error(exceptionMessage);
+            return BaseResult.fail(exceptionMessage);
+        }
+    }
+
+    /**
+     * 鍒涘缓涓氬姟绫诲瀷
+     * btmTypeDTO 閾炬帴绫诲瀷鐨勪繚瀛樺璞�
+     * @return 淇濆瓨缁撴灉
+     */
+    @PostMapping("/addBtmType")
+    public BaseResult addBtmType(@RequestBody OsBtmTypeDTO btmTypeDTO){
+        try {
+            return btmService.addBtmType(btmTypeDTO) ? BaseResult.success("涓氬姟绫诲瀷鍒涘缓鎴愬姛锛�"):BaseResult.fail("涓氬姟绫诲瀷鍒涘缓澶辫触锛�");
+        } catch (Exception e) {
+            e.printStackTrace();
+            String exceptionMessage = "鍒涘缓涓氬姟绫诲瀷鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+            logger.error(exceptionMessage);
+            return BaseResult.fail(exceptionMessage);
+        }
+    }
+
+    /**
+     * 鎵归噺鍒涘缓涓氬姟绫诲瀷
+     * btmTypeDTO 閾炬帴绫诲瀷鐨勪繚瀛樺璞�
+     * @return 淇濆瓨缁撴灉
+     */
+    /*@PostMapping("/addBtmTypes")
+    public BaseResult addBtmTypes(@RequestBody List<BizType> bizTypes){
+        try {
+            return btmService.addBtmTypes(bizTypes) ? BaseResult.success("涓氬姟绫诲瀷鎵归噺鍒涘缓鎴愬姛锛�"):BaseResult.fail("涓氬姟绫诲瀷鎵归噺鍒涘缓澶辫触锛�");
+        } catch (Exception e) {
+            e.printStackTrace();
+            String exceptionMessage = "鎵归噺鍒涘缓涓氬姟绫诲瀷鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+            logger.error(exceptionMessage);
+            return BaseResult.fail(exceptionMessage);
+        }
+    }*/
+
+    /**
+     * 淇敼涓氬姟绫诲瀷
+     * btmTypeDTO 閾炬帴绫诲瀷淇敼鐨勫璞�
+     * @return 淇濆瓨缁撴灉
+     */
+    @PutMapping("/updateBtmType")
+    public BaseResult updateBtmType(@RequestBody OsBtmTypeDTO btmTypeDTO){
+        try {
+            return btmService.updateBtmType(btmTypeDTO) ? BaseResult.success("涓氬姟绫诲瀷淇敼鎴愬姛锛�"):BaseResult.fail("涓氬姟绫诲瀷淇敼澶辫触锛�");
+        } catch (Exception e) {
+            e.printStackTrace();
+            String exceptionMessage = "淇敼涓氬姟绫诲瀷鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+            logger.error(exceptionMessage);
+            return BaseResult.fail(exceptionMessage);
+        }
+    }
+
+    /**
+     * 涓氬姟绫诲瀷鍒犻櫎
+     * btmTypeDTO 涓氬姟绫诲瀷瀵硅薄
+     * @return 鍒犻櫎缁撴灉
+     */
+    @DeleteMapping("/deleteBtmType")
+    public BaseResult deleteLink(@RequestBody OsBtmTypeDTO btmTypeDTO){
+        try {
+            return btmService.deleteBtmType(btmTypeDTO) ? BaseResult.success("鍒犻櫎涓氬姟绫诲瀷鎴愬姛锛�"):BaseResult.fail("鍒犻櫎涓氬姟绫诲瀷澶辫触锛�");
+        } catch (PLException e) {
+            e.printStackTrace();
+            String exceptionMessage = "鍒犻櫎涓氬姟绫诲瀷鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+            logger.error(exceptionMessage);
+            return BaseResult.fail(exceptionMessage);
+        }
+    }
+
+    /**
+     * 涓�鑷存�ф鏌�
+     * @return 妫�鏌ョ粨鏋�
+     */
+    @GetMapping("/checkBtmConsistency")
+    public BaseResult checkBtmConsistency(){
+        try {
+            return btmService.checkBtmConsistency();
+        } catch (PLException e) {
+            e.printStackTrace();
+            String exceptionMessage = "涓氬姟绫诲瀷涓�鑷存�ф鏌ユ椂鍑虹幇閿欒锛屽師鍥狅細" + VciBaseUtil.getExceptionMessage(e);
+            logger.error(exceptionMessage);
+            return BaseResult.fail(exceptionMessage);
+        }
+    }
+
+    /**
+     * 涓�鑷存�ф鏌ワ紝涓氬姟绫诲瀷淇
+     * @return 鍒犻櫎缁撴灉
+     */
+    @PostMapping("/executeRepair")
+    public BaseResult executeRepair(@RequestBody String repairData){
+        try {
+            return btmService.executeRepair(repairData);
+        } catch (Exception e) {
+            e.printStackTrace();
+            String exceptionMessage = "涓氬姟绫诲瀷淇鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+            logger.error(exceptionMessage);
+            return BaseResult.fail(exceptionMessage);
+        }
+    }
+
+    /**
+     * 鍒涘缓瑙嗗浘
+     * @return
+     */
+    @PostMapping("/createView")
+    public BaseResult createView(){
+        try {
+            return btmService.createView() ? BaseResult.success("鍒涘缓瑙嗗浘鎴愬姛!"):BaseResult.fail("鍒涘缓瑙嗗浘澶辫触!");
+        } catch (Exception e) {
+            e.printStackTrace();
+            String exceptionMessage = "鍒涘缓瑙嗗浘鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+            logger.error(exceptionMessage);
+            return BaseResult.fail(exceptionMessage);
+        }
+    }
+
+    /**
+     * 鍒犻櫎鏁版嵁鐣岄潰鐨勬暟鎹煡璇�
+     * @return
+     */
+    @GetMapping("/getObjectData")
+    public BaseResult getObjectData(){
+        try {
+            return btmService.getObjectData();
+        } catch (Exception e) {
+            e.printStackTrace();
+            String exceptionMessage = "鏁版嵁瀵硅薄鏌ヨ鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+            logger.error(exceptionMessage);
+            return BaseResult.fail(exceptionMessage);
+        }
+    }
+
+    /**
+     * 鍒犻櫎鏁版嵁
+     * @param btmNames 涓氬姟绫诲瀷鍚�
+     * @param linkNames 閾炬帴绫诲瀷鍚�
+     * @return
+     * @throws PLException
+     */
+    @DeleteMapping("/truncateTable")
+    public BaseResult truncateTable(String[] btmNames,String[] linkNames){
+        try {
+            return BaseResult.dataList(btmService.truncateTable(btmNames,linkNames));
+        } catch (Exception e) {
+            e.printStackTrace();
+            String exceptionMessage = "鍒犻櫎鏁版嵁鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+            logger.error(exceptionMessage);
+            return BaseResult.fail(exceptionMessage);
+        }
+    }
+
+    /**
+     * 鍒犻櫎鍏ㄩ儴绫诲瀷
+     * @return
+     * @throws PLException
+     */
+    @DeleteMapping("/deleteAllType")
+    public BaseResult deleteAllType(){
+        try {
+            return BaseResult.dataList(btmService.deleteAllType());
+        } catch (Exception e) {
+            e.printStackTrace();
+            String exceptionMessage = "鍒犻櫎鍏ㄩ儴绫诲瀷鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+            logger.error(exceptionMessage);
+            return BaseResult.fail(exceptionMessage);
+        }
+    }
+
+    /**
+     * 鑾峰彇褰撳墠涓氬姟绫诲瀷涓嬬殑绱㈠紩
+     * @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")
+    @VciUnCheckRight
+    public BaseResult impData(MultipartFile file){try {
+        return btmService.impData(file);
+    }catch (Throwable e) {
+        throw new VciBaseException(VciBaseUtil.getExceptionMessage(e),new String[0],e);
+    }
     }
 
     /**
@@ -129,7 +403,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);
     }
 
@@ -141,7 +423,6 @@
     @GetMapping(value = "/getBizTypeQTDs")
     @VciBusinessLog(operateName = "鏌ョ湅涓氬姟绫诲瀷鐨勫睘鎬�")
     public BaseResult<List<OsBtmTypeAttributeVO>> getBizTypeQTDs(String btmName){
-
         try {
             List<OsBtmTypeAttributeVO> osBtmTypeAttributeVOS = btmService.getBizTypeQTDs(btmName);
             return BaseResult.dataList(osBtmTypeAttributeVOS);
@@ -184,7 +465,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<>();
         }
@@ -195,7 +484,7 @@
                 OsBtmTypeAttributeVO attributeVO = new OsBtmTypeAttributeVO();
                 BeanUtil.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);
@@ -218,7 +507,6 @@
         return dataGrid;
     }
 
-
     /**
      * 浣跨敤涓婚敭鑾峰彇涓氬姟绫诲瀷鍖呭惈鐨勫睘鎬э紝涓嶅垎椤�
      * @param baseQueryObject 鏌ヨ瀵硅薄
@@ -233,7 +521,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)){
@@ -250,7 +546,6 @@
         return dataGrid;
     }
 
-
     /**
      * 浣跨敤涓婚敭鑾峰彇涓氬姟绫诲瀷鐨勫璞�
      * @param oid 涓婚敭
@@ -264,6 +559,7 @@
         }
         return BaseResult.success(btmTypeVO);
     }
+
     /**
      * 瀵煎嚭涓氬姟绫诲瀷鐨勪俊鎭埌word涓�
      * @param btmTypeIds 涓氬姟绫诲瀷鐨勭紪鍙凤紝鐢ㄩ�楀彿鍒嗗壊
@@ -333,4 +629,5 @@
     public BaseResult createERUsed(String id){
         return BaseResult.success(btmService.createERUsed(id));
     }
+
 }

--
Gitblit v1.9.3