From d0ae279ff3b83358d1c07f4481a041c4ad335026 Mon Sep 17 00:00:00 2001
From: dangsn <dangsn@chicecm.com>
Date: 星期二, 03 十二月 2024 11:57:38 +0800
Subject: [PATCH] 提取业务系统使用的功能,独立出一个单独的模块

---
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebBtmTypeController.java |   72 +++++++++++++++++++++++++----------
 1 files changed, 51 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 5e6f1f0..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,11 +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.model.IndexObject;
-import com.vci.starter.web.annotation.controller.VciUnCheckRight;
+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;
@@ -13,18 +13,14 @@
 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;
@@ -41,7 +37,6 @@
 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;
@@ -54,7 +49,6 @@
 @RequestMapping("/btmTypeController")
 @VciBusinessLog(modelName="涓氬姟绫诲瀷")
 @RestController
-@VciUnCheckRight
 public class WebBtmTypeController {
 
     /**
@@ -105,7 +99,6 @@
      */
     @GetMapping( "/getBizTypes")
     @VciBusinessLog(operateName = "涓氬姟绫诲瀷鍒楄〃(涓昏鐢ㄤ簬瀵硅瘽妗嗕娇鐢�)")
-    @VciUnCheckRight
     public BaseResult getBizTypes(String btmName){
         try {
             return BaseResult.dataList(Arrays.asList(btmService.getBizTypes(btmName)));
@@ -191,7 +184,7 @@
      * btmTypeDTO 閾炬帴绫诲瀷淇敼鐨勫璞�
      * @return 淇濆瓨缁撴灉
      */
-    @PostMapping("/updateBtmType")
+    @PutMapping("/updateBtmType")
     public BaseResult updateBtmType(@RequestBody OsBtmTypeDTO btmTypeDTO){
         try {
             return btmService.updateBtmType(btmTypeDTO) ? BaseResult.success("涓氬姟绫诲瀷淇敼鎴愬姛锛�"):BaseResult.fail("涓氬姟绫诲瀷淇敼澶辫触锛�");
@@ -388,7 +381,6 @@
      * @return
      */
     @PostMapping("/impData")
-    @VciUnCheckRight
     public BaseResult impData(MultipartFile file){try {
         return btmService.impData(file);
     }catch (Throwable e) {
@@ -404,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);
     }
 
@@ -458,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<>();
         }
@@ -467,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);
@@ -506,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)){
@@ -593,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);
+        }
     }
 
     /**
@@ -604,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