From 08635bced778daba88cd02a6382f7727de4f7bab Mon Sep 17 00:00:00 2001 From: ludc Date: 星期一, 09 九月 2024 10:29:32 +0800 Subject: [PATCH] ui定义下页面定义添加、查询接口调整 --- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsQueryTemplateController.java | 335 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 322 insertions(+), 13 deletions(-) diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsQueryTemplateController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsQueryTemplateController.java index 447ebd1..e00dd3b 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsQueryTemplateController.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsQueryTemplateController.java @@ -1,32 +1,29 @@ package com.vci.web.controller; +import cn.hutool.core.io.FileUtil; import com.vci.corba.common.PLException; -import com.vci.corba.omd.ltm.LinkType; import com.vci.corba.omd.qtm.QTD; -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.dto.QTInfoDTO; +import com.vci.pagemodel.QtQueryVO; 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.starter.web.util.ControllerUtil; +import com.vci.starter.web.util.LocalFileUtil; import com.vci.starter.web.util.VciBaseUtil; -import com.vci.web.service.OsLinkTypeServiceI; import com.vci.web.service.OsQuereyTemplateServiceI; +import com.vci.web.util.Func; import org.apache.commons.lang3.StringUtils; +import org.dom4j.DocumentException; 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.*; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; +import java.io.File; import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; +import java.util.*; /** * 鏌ヨ妯℃澘鐨勬帶鍒跺櫒 @@ -66,8 +63,28 @@ } } + /** - * 鏌ヨ妯℃澘 + * 鏌ヨ妯℃澘鐨勫垪琛ㄦ坊鍔犱簡瀛楁鐨勭浉鍏冲睘鎬� + * @param btmName 绫诲瀷 + * @param linkFlag 鏄惁閾炬帴绫诲瀷 锛歵rue 閾炬帴绫诲瀷 锛宖alse 涓氬姟绫诲瀷 + * @param direction 姝e弽鏂瑰悜 + * @return 鏌ヨ妯℃澘鐨勫垪琛� + */ + @GetMapping("/queryTemplateListByAttr") + public BaseResult queryTemplateListByAttr(String btmName,Boolean linkFlag, String direction){ + try { + return quereyTemplateServiceI.queryTemplateListByAttr(btmName,linkFlag,direction); + } catch (PLException e) { + BaseResult objectBaseResult = new BaseResult<>(); + objectBaseResult.setCode(Integer.parseInt(e.code)); + objectBaseResult.setMsg(Arrays.toString(e.messages)); + return objectBaseResult; + } + } + + /** + * 淇濆瓨鏌ヨ妯℃澘 * @param qtd 鏌ヨ妯℃澘瀹炰綋绫� * @return 淇濆瓨缁撴灉 */ @@ -82,4 +99,296 @@ return objectBaseResult; } } + + /** + * 淇敼鏌ヨ妯℃澘 + * @param qtd 鏌ヨ妯℃澘瀹炰綋绫� + * @return 淇濆瓨缁撴灉 + */ + @PostMapping("/updateTemplate") + public BaseResult updateTemplate(@RequestBody QTD qtd){ + try { + return quereyTemplateServiceI.updateTemplate(qtd); + } catch (PLException e) { + BaseResult objectBaseResult = new BaseResult<>(); + objectBaseResult.setCode(Integer.parseInt(e.code)); + objectBaseResult.setMsg(Arrays.toString(e.messages)); + return objectBaseResult; + } + } + + /** + * 鍒犻櫎鏌ヨ妯℃澘 + * @param name 鏌ヨ妯℃澘鍚� + * @return 淇濆瓨缁撴灉 + */ + @DeleteMapping("/deleteTemplate") + public BaseResult deleteTemplate(String name){ + try { + return quereyTemplateServiceI.deleteTemplate(name); + } catch (PLException e) { + BaseResult objectBaseResult = new BaseResult<>(); + objectBaseResult.setCode(Integer.parseInt(e.code)); + objectBaseResult.setMsg(Arrays.toString(e.messages)); + return objectBaseResult; + } + } + + /** + * 鏌ヨ鏉′欢鐨勬煡璇㈡寜閽煡璇is鍒楄〃 + * @param qtInfoDTO 浼犺緭鐨勬暟鎹璞★細 + * linkTypeName 閾炬帴绫诲瀷鍚嶇О銆� + * rdPositive 鏂瑰悜锛宼rue姝e悜锛宖alse鍙嶅悜 + * btmName 涓氬姟绫诲瀷鍚嶇О + * combRelaType 涓氬姟绫诲瀷閫夋嫨鍊� + * versionValue 鐗堟湰鐝鍊� + * isQueryIsLeaf 鏄惁閫夋嫨涓嬬骇 + * level 瀛愯妭鐐瑰眰鏁� + * @return 鏌ヨ缁撴灉 + */ + @PostMapping("/getCriteria") + public BaseResult getCriteria(@RequestBody QTInfoDTO qtInfoDTO){ + try { + return quereyTemplateServiceI.getCriteria(qtInfoDTO); + } catch (PLException e) { + BaseResult objectBaseResult = new BaseResult<>(); + objectBaseResult.setCode(Integer.parseInt(e.code)); + objectBaseResult.setMsg(Arrays.toString(e.messages)); + return objectBaseResult; + } + } + + /** + * 涓氬姟绫诲瀷鏌ヨ妯℃澘涓嬬殑鏌ヨ鏉′欢鐨勬煡璇㈡寜閽煡璇ist鍒楄〃 + * @param qtInfoDTO + * @return 鏌ヨ缁撴灉 + */ + @PostMapping("/getCriteriaBtm") + public BaseResult getCriteriaBtm(@RequestBody QTInfoDTO qtInfoDTO){ + try { + return quereyTemplateServiceI.getCriteriaBtm(qtInfoDTO); + } catch (PLException e) { + BaseResult objectBaseResult = new BaseResult<>(); + objectBaseResult.setCode(Integer.parseInt(e.code)); + objectBaseResult.setMsg(Arrays.toString(e.messages)); + return objectBaseResult; + } + } + + /** + * 鏌ヨ鏉′欢涓嬬殑閫夋嫨鏌ヨ妯℃澘瀵硅瘽妗嗭紙鏌ヨ鍏ㄩ儴妯℃澘鍜屾墍瀵瑰簲鐨勪笟鍔$被鍨嬫垨閾炬帴绫诲瀷鍚嶏級 + * @return + */ + @GetMapping("/getAllQTs") + public BaseResult getAllQTs(){ + try { + return quereyTemplateServiceI.getAllQTs(); + } catch (PLException e) { + BaseResult objectBaseResult = new BaseResult<>(); + objectBaseResult.setCode(Integer.parseInt(e.code)); + objectBaseResult.setMsg(Arrays.toString(e.messages)); + return objectBaseResult; + } + } + + /** + * 鏌ヨ妯℃澘鍒楄〃 + * @param btName 绫诲瀷鍚嶇О + * @return 鏌ヨ缁撴灉 + */ + @GetMapping("/getObjTypeQTs") + public BaseResult getObjTypeQTs(String btName){ + try { + return quereyTemplateServiceI.getObjTypeQTs(btName); + } catch (PLException e) { + BaseResult objectBaseResult = new BaseResult<>(); + objectBaseResult.setCode(Integer.parseInt(e.code)); + objectBaseResult.setMsg(Arrays.toString(e.messages)); + return objectBaseResult; + } catch (DocumentException e) { + e.printStackTrace(); + BaseResult objectBaseResult = new BaseResult<>(); + objectBaseResult.setCode(500); + objectBaseResult.setMsg(Arrays.toString(e.getMessage().toCharArray())); + return objectBaseResult; + } + } + + /** + * 妫�鏌ユ煡璇㈡ā鏉垮悕瀛楁槸鍚﹀瓨鍦� + * @param name 鏌ヨ妯℃澘鍚嶅瓧 + * @return 鏌ヨ缁撴灉 + */ + @GetMapping("/isExistsQT") + public BaseResult isExistsQT(String name){ + try { + return quereyTemplateServiceI.isExistsQT(name); + } catch (PLException e) { + BaseResult objectBaseResult = new BaseResult<>(); + objectBaseResult.setCode(Integer.parseInt(e.code)); + objectBaseResult.setMsg(Arrays.toString(e.messages)); + return objectBaseResult; + } + } + + /** + * 閾炬帴绫诲瀷鏌ヨ妯℃澘淇濆瓨 + * @param qtInfoDTO 淇濆瓨浼犺緭瀵硅薄 + * @return 淇濆瓨缁撴灉 + */ + @PostMapping("/linkSave") + public BaseResult linkSave(@RequestBody QTInfoDTO qtInfoDTO){ + try { + return quereyTemplateServiceI.linkSave(qtInfoDTO); + } catch (PLException e) { + BaseResult objectBaseResult = new BaseResult<>(); + objectBaseResult.setCode(Integer.parseInt(e.code)); + objectBaseResult.setMsg(Arrays.toString(e.messages)); + return objectBaseResult; + } + } + + /** + * 閾炬帴绫诲瀷鏌ヨ妯℃澘鏍戞煡璇紝鐢ㄤ簬鐣岄潰鐨勫鍑哄姛鑳� + * @return 鏌ヨ缁撴灉 + */ + @GetMapping("/getLinkTree") + public BaseResult getLinkTree(){ + try { + return quereyTemplateServiceI.getLinkTree(); + } catch (PLException e) { + BaseResult objectBaseResult = new BaseResult<>(); + objectBaseResult.setCode(Integer.parseInt(e.code)); + objectBaseResult.setMsg(Arrays.toString(e.messages)); + return objectBaseResult; + } + } + /** + * 瀵煎嚭閾炬帴绫诲瀷鏌ヨ妯℃澘 + * names 鏌ヨ妯℃澘鍚� + * @return + */ + @PostMapping("/expLinkTemplate") + public void expLinkTemplate(@RequestBody List<String> names,HttpServletResponse response) throws PLException, IOException { + quereyTemplateServiceI.expLinkTemplate(names, response); + } + + /** + * 瀵煎叆閾炬帴绫诲瀷鏌ヨ妯℃澘 + * @param file 涓婁紶鐨勬枃浠� + * @return 瀵煎叆缁撴灉 + */ + @PostMapping("/impLinkTemplate") + public BaseResult impLinkTemplate(MultipartFile file){ + try { + return quereyTemplateServiceI.impLinkTemplate(file); + }catch (Throwable e) { + throw new VciBaseException(VciBaseUtil.getExceptionMessage(e),new String[0],e); + } + } + + /** + * 鏌ヨ鏂规鍒犻櫎 + * @param names 鏌ヨ鏂规鍚� + * @return 鎿嶄綔缁撴灉 + */ + @DeleteMapping("/deleteLinkTemplate") + public BaseResult deleteLinkTemplate(String names){ + try { + return quereyTemplateServiceI.deleteLinkTemplate(names); + } catch (PLException e) { + BaseResult objectBaseResult = new BaseResult<>(); + objectBaseResult.setCode(Integer.parseInt(e.code)); + objectBaseResult.setMsg(Arrays.toString(e.messages)); + return objectBaseResult; + } + } + + /** + * 涓氬姟绫诲瀷鏌ヨ妯℃澘淇濆瓨 + * @param qtInfoDTO 淇濆瓨浼犺緭瀵硅薄 + * @return 淇濆瓨缁撴灉 + */ + @PostMapping("/btmSave") + public BaseResult btmSave(@RequestBody QTInfoDTO qtInfoDTO){ + try { + return quereyTemplateServiceI.btmSave(qtInfoDTO); + } catch (PLException e) { + BaseResult objectBaseResult = new BaseResult<>(); + objectBaseResult.setCode(Integer.parseInt(e.code)); + objectBaseResult.setMsg(Arrays.toString(e.messages)); + return objectBaseResult; + } + } + + /** + * 鏇存柊鏁版嵁搴撶粨鏋� + * @return 鏇存柊缁撴灉 + */ + @PostMapping("/updateDBStructure") + public BaseResult btmSave(){ + try { + return quereyTemplateServiceI.updateDBStructure(); + } catch (PLException e) { + BaseResult objectBaseResult = new BaseResult<>(); + objectBaseResult.setCode(Integer.parseInt(e.code)); + objectBaseResult.setMsg(Arrays.toString(e.messages)); + return objectBaseResult; + } + } + + /** + * 涓氬姟绫诲瀷鏌ヨ妯℃澘鏍戞煡璇紝鐢ㄤ簬鐣岄潰鐨勫鍑哄姛鑳� + * @return 鏌ヨ缁撴灉 + */ + @GetMapping("/getBtmQtTree") + public BaseResult getBtmQtTree(){ + try { + return quereyTemplateServiceI.getBtmQtTree(); + } catch (PLException e) { + BaseResult objectBaseResult = new BaseResult<>(); + objectBaseResult.setCode(Integer.parseInt(e.code)); + objectBaseResult.setMsg(Arrays.toString(e.messages)); + return objectBaseResult; + } + } + + /** + * 瀵煎嚭涓氬姟绫诲瀷鏌ヨ妯℃澘 + * names 鏌ヨ妯℃澘鍚� + * @return + */ + @PostMapping("/expBtmQTTemplate") + public void expBtmQTTemplate(Map qtQueryMap, HttpServletResponse response) throws PLException, IOException { + try { + String qtNames = (String)qtQueryMap.get("qtNames"); + String excelPath = quereyTemplateServiceI.expBtmQTTemplate(Arrays.asList(qtNames.split(","))); + ControllerUtil.writeFileToResponse(response,excelPath); + FileUtil.del(LocalFileUtil.getDefaultTempFolder() + File.separator); + } catch (Exception e) { + String msg = "瀵煎嚭涓氬姟绫诲瀷鏌ヨ妯℃澘鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e); + try { + //鍑洪敊鏃� + e.printStackTrace(); + ControllerUtil.writeDataToResponse(response,"error_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss") + ".txt", StringUtils.isNotBlank(msg)?msg.getBytes():new byte[0],null); + } catch (IOException ioException) { + ioException.printStackTrace(); + } + } + } + + /** + * 瀵煎叆涓氬姟绫诲瀷鏌ヨ妯℃澘 + * @param file 涓婁紶鐨勬枃浠� + * @return 瀵煎叆缁撴灉 + */ + @PostMapping("/impBtmTemplate") + public BaseResult impBtmTemplate(MultipartFile file){ + try { + return quereyTemplateServiceI.impBtmTemplate(file); + }catch (Throwable e) { + throw new VciBaseException(VciBaseUtil.getExceptionMessage(e),new String[0],e); + } + } + } -- Gitblit v1.9.3