From a13255b4129ee8a7a7b7e1ecd8e02dd2c78f7c17 Mon Sep 17 00:00:00 2001 From: 田源 <tianyuan@vci-tech.com> Date: 星期四, 16 一月 2025 16:19:20 +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 | 89 +++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 83 insertions(+), 6 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 6400b16..319c7cf 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 @@ -5,7 +5,7 @@ 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; @@ -17,12 +17,13 @@ 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.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; /** @@ -60,7 +61,6 @@ * @return 閾炬帴绫诲瀷鐨勬樉绀哄璞� */ @GetMapping("/getAllLtName") - @VciUnCheckRight public BaseResult getAllLtName(){ try { return BaseResult.dataList(linkTypeService.getAllLtName()); @@ -86,7 +86,15 @@ String attrId = baseQueryObject.getConditionMap().containsKey("name")?baseQueryObject.getConditionMap().get("name").replace("*",""):""; String attrName = baseQueryObject.getConditionMap().containsKey("label") ? baseQueryObject.getConditionMap().get("label").replace("*","") : ""; OsLinkTypeVO linkTypeVO = linkTypeService.selectByOid(linkTypeOid); - List<OsLinkTypeAttributeVO> boAttrs = linkTypeService.listAttributeByLinkId(linkTypeVO.getId()); + List<OsLinkTypeAttributeVO> boAttrs = null; + try { + boAttrs = linkTypeService.listAttributeByLinkId(linkTypeVO.getId()); + }catch (Exception e){ + e.printStackTrace(); + String errorLog = "鏌ヨ閾炬帴绫诲瀷鍏宠仈鐨勫睘鎬ф椂鍑虹幇閿欒锛屽師鍥狅細"+VciBaseUtil.getExceptionMessage(e); + logger.error(errorLog); + throw new VciBaseException(errorLog); + } List<OsLinkTypeAttributeVO> attrList = boAttrs.stream().filter(s->{ boolean usedFlag = true; if(StringUtils.isNotBlank(attrId) && !s.getId().contains(attrId)){ @@ -101,6 +109,27 @@ dataGrid.setTotal(attrList.size());; dataGrid.setData(attrList); return dataGrid; + } + + /** + * 鑾峰彇閾炬帴绫诲瀷鍖呭惈鐨勫睘鎬� + * @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); + } } /** @@ -147,7 +176,7 @@ * addFlag 鏄惁涓烘柊澧� true鏂板锛宖alse淇敼 * @return 淇濆瓨缁撴灉 */ - @GetMapping("/addAndEditLink") + @PostMapping("/addAndEditLink") public BaseResult addAndEditLink(@RequestBody LinkType linkType, Boolean addFlag){ try { return linkTypeService.addAndEditLink(linkType, addFlag); @@ -228,4 +257,52 @@ 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