From a471b20fe8075a663f32b3a2ee0cd70c1c63baf7 Mon Sep 17 00:00:00 2001 From: ludc Date: 星期四, 21 十一月 2024 21:59:42 +0800 Subject: [PATCH] 业务类型查询:树查询修改,数据列表查询接口修改(处理模板套模板情况下freemarker表达式的替换处理)。 --- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebBtmTypeController.java | 138 ++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 126 insertions(+), 12 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 7e6b5cf..ea31dba 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 @@ -4,6 +4,7 @@ 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; @@ -30,6 +31,7 @@ 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; @@ -39,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; @@ -51,7 +54,6 @@ @RequestMapping("/btmTypeController") @VciBusinessLog(modelName="涓氬姟绫诲瀷") @RestController -@VciUnCheckRight public class WebBtmTypeController { /** @@ -102,7 +104,6 @@ */ @GetMapping( "/getBizTypes") @VciBusinessLog(operateName = "涓氬姟绫诲瀷鍒楄〃(涓昏鐢ㄤ簬瀵硅瘽妗嗕娇鐢�)") - @VciUnCheckRight public BaseResult getBizTypes(String btmName){ try { return BaseResult.dataList(Arrays.asList(btmService.getBizTypes(btmName))); @@ -171,7 +172,7 @@ * btmTypeDTO 閾炬帴绫诲瀷鐨勪繚瀛樺璞� * @return 淇濆瓨缁撴灉 */ - @PostMapping("/addBtmTypes") + /*@PostMapping("/addBtmTypes") public BaseResult addBtmTypes(@RequestBody List<BizType> bizTypes){ try { return btmService.addBtmTypes(bizTypes) ? BaseResult.success("涓氬姟绫诲瀷鎵归噺鍒涘缓鎴愬姛锛�"):BaseResult.fail("涓氬姟绫诲瀷鎵归噺鍒涘缓澶辫触锛�"); @@ -181,14 +182,14 @@ logger.error(exceptionMessage); return BaseResult.fail(exceptionMessage); } - } + }*/ /** * 淇敼涓氬姟绫诲瀷 * btmTypeDTO 閾炬帴绫诲瀷淇敼鐨勫璞� * @return 淇濆瓨缁撴灉 */ - @PostMapping("/updateBtmType") + @PutMapping("/updateBtmType") public BaseResult updateBtmType(@RequestBody OsBtmTypeDTO btmTypeDTO){ try { return btmService.updateBtmType(btmTypeDTO) ? BaseResult.success("涓氬姟绫诲瀷淇敼鎴愬姛锛�"):BaseResult.fail("涓氬姟绫诲瀷淇敼澶辫触锛�"); @@ -318,6 +319,81 @@ } /** + * 鑾峰彇褰撳墠涓氬姟绫诲瀷涓嬬殑绱㈠紩 + * @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") + public BaseResult impData(MultipartFile file){try { + return btmService.impData(file); + }catch (Throwable e) { + throw new VciBaseException(VciBaseUtil.getExceptionMessage(e),new String[0],e); + } + } + + /** * 鑾峰彇涓氬姟绫诲瀷鍖呭惈鐨勫睘鎬у叏閮ㄤ负灏忓啓 * @param btmId 涓氬姟绫诲瀷鍚嶇О * @return 灞炴�х殑淇℃伅 @@ -325,7 +401,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); } @@ -379,7 +463,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<>(); } @@ -390,7 +482,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); @@ -427,7 +519,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)){ @@ -514,8 +614,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); + } } /** @@ -525,7 +632,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