From 894a0ce49bab4add5dd9208539dbc03c1c85414b Mon Sep 17 00:00:00 2001 From: 田源 <lastanimals@163.com> Date: 星期四, 29 八月 2024 17:50:39 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsLinkTypeController.java | 222 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 217 insertions(+), 5 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 3b6691a..9bbe900 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,19 +1,35 @@ 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.web.pageModel.*; +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.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +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.text.ParseException; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; /** @@ -32,6 +48,11 @@ private OsLinkTypeServiceI linkTypeService; /** + * 鏃ュ織 + */ + private Logger logger = LoggerFactory.getLogger(getClass()); + + /** * 閾炬帴绫诲瀷鐨勫垪琛� * @param baseQueryObject 鏌ヨ瀵硅薄 * @return 閾炬帴绫诲瀷鐨勬樉绀哄璞� @@ -39,6 +60,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); + } } /** @@ -73,6 +110,27 @@ } /** + * 鑾峰彇閾炬帴绫诲瀷鍖呭惈鐨勫睘鎬� + * @param name 閾炬帴绫诲瀷鐨勭紪鍙� + * @return 灞炴�х殑淇℃伅 + */ + @GetMapping("/getAllAttributeByLink") + public BaseResult<List<OsLinkTypeAttributeVO>> getAllAttributeByLink(String name){ + + try { + List<OsLinkTypeAttributeVO> osLinkTypeAttributeVOS = linkTypeService.getAllAttributeByLink(name); + return BaseResult.dataList(osLinkTypeAttributeVOS); + } catch (PLException e) { + BaseResult objectBaseResult = new BaseResult<>(); + objectBaseResult.setCode(Integer.parseInt(e.code)); + objectBaseResult.setMsg(Arrays.toString(e.messages)); + return objectBaseResult; + } catch (ParseException e) { + throw new RuntimeException(e); + } + } + + /** * 妫�鏌ラ摼鎺ョ被鍨嬩腑鍏宠仈鐨勪笟鍔$被鍨嬬殑灞炴�ф湁涓嶅悓鐨勫唴瀹� * @param linkTypeOid 閾炬帴绫诲瀷鐨勪富閿� * @return 宸紓鐨勫睘鎬� @@ -91,4 +149,158 @@ return BaseResult.success(); } } + + + /** + * 閾炬帴绫诲瀷鐨勫垪琛� + * + * @return 閾炬帴绫诲瀷鐨勬樉绀哄璞� + */ + @GetMapping("/gridLink") + public BaseResult<List<LinkType>> gridLink(){ + try { + return linkTypeService.gridLink(); + } catch (PLException e) { + BaseResult objectBaseResult = new BaseResult<>(); + objectBaseResult.setCode(Integer.parseInt(e.code)); + objectBaseResult.setMsg(Arrays.toString(e.messages)); + return objectBaseResult; + } + } + + /** + * 閾炬帴绫诲瀷淇濆瓨 + * linkType 閾炬帴绫诲瀷鐨勪繚瀛樺璞� + * addFlag 鏄惁涓烘柊澧� true鏂板锛宖alse淇敼 + * @return 淇濆瓨缁撴灉 + */ + @PostMapping("/addAndEditLink") + public BaseResult addAndEditLink(@RequestBody LinkType linkType, Boolean addFlag){ + try { + return linkTypeService.addAndEditLink(linkType, addFlag); + } catch (PLException e) { + BaseResult objectBaseResult = new BaseResult<>(); + objectBaseResult.setCode(Integer.parseInt(e.code)); + objectBaseResult.setMsg(Arrays.toString(e.messages)); + 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") + public BaseResult impData(MultipartFile file){ + try { + return linkTypeService.impData(file); + }catch (Throwable e) { + throw new VciBaseException(VciBaseUtil.getExceptionMessage(e),new String[0],e); + } + } + + + /** + * 鑾峰彇璁剧疆鎺掑簭瀛楁鐨勬帓搴忓瓧娈� + * @param linkType 閾炬帴绫诲瀷鐨勭紪鍙� + * @param btmType 涓氬姟绫诲瀷鐨勭紪鍙� + * @param direction 姝�/鍙嶅悜 + * @return 灞炴�х殑淇℃伅 + */ + @GetMapping("/getAllOrderbyAttributeByLink") + public BaseResult<List<String>> getAllOrderbyAttributeByLink(String linkType, String btmType, String direction){ + + try { + List<String> osLinkTypeAttributes = linkTypeService.getAllOrderbyAttributeByLink(linkType, btmType, direction); + return BaseResult.dataList(osLinkTypeAttributes); + } catch (PLException e) { + BaseResult objectBaseResult = new BaseResult<>(); + objectBaseResult.setCode(Integer.parseInt(e.code)); + objectBaseResult.setMsg(Arrays.toString(e.messages)); + return objectBaseResult; + } catch (ParseException e) { + throw new RuntimeException(e); + } + } } -- Gitblit v1.9.3