From f0b8a8d9966d0ccbb23ee8baaedf4ff8ba6060ed Mon Sep 17 00:00:00 2001 From: ludc Date: 星期四, 08 八月 2024 18:15:42 +0800 Subject: [PATCH] 业务类型新增、修改、删除、查看使用范围、创建视图、一致性检查、一致性检查修复、删除数据、删除数据界面查询、删除全部类型接口上传。 --- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java | 797 ++++++++++++++++++++++++++++++++++ Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLifeCycleServiceImpl.java | 20 Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OsBtmTypeVO.java | 27 + Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebBtmTypeController.java | 209 ++++++++ Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsBtmServiceI.java | 108 ++++ Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBtmIOServiceImpl.java | 2 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsLifeCycleController.java | 1 Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsBtmTypeDTO.java | 109 ++++ Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsLinkTypeServiceI.java | 7 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsEnumServiceImpl.java | 3 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLinkTypeServiceImpl.java | 45 + 11 files changed, 1,306 insertions(+), 22 deletions(-) diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsBtmTypeDTO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsBtmTypeDTO.java index 442752d..4f05d27 100644 --- a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsBtmTypeDTO.java +++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsBtmTypeDTO.java @@ -9,10 +9,12 @@ * @date 2019/10/14 16:43 */ public class OsBtmTypeDTO implements java.io.Serializable{ + /** * 绂佹淇敼杩欎釜鍊� */ private static final long serialVersionUID = 2009350578651813260L; + /** * 涓婚敭 */ @@ -37,7 +39,6 @@ * 鎻忚堪 */ private String description; - /** * 鐗堟湰瑙勫垯鐨勭紪鍙� @@ -79,7 +80,6 @@ */ private boolean secretFlag; - /** * 瀹炰緥鍖栫被 */ @@ -89,7 +89,6 @@ * C# */ private String shape; - /** * 鐢熷懡鍛ㄦ湡鐨勮嫳鏂囧悕绉� @@ -105,6 +104,11 @@ * 鐗堟瑙勫垯 */ private String versionRule; + + /** + * 鐗堟湰绾у埆 + */ + private short revLevel; /** * 澶囩敤鐢熷懡鍛ㄦ湡鑻辨枃鍚嶇О @@ -132,15 +136,114 @@ private String classFullName; /** + * 鐖朵笟鍔$被鍨� + */ + private String fName; + + /** + * 鍒嗛殧绗� + */ + private String delimiter; + + /** * 娣诲姞鎴栬�呯Щ闄ょ殑灞炴�т俊鎭� */ private List<OsBtmTypeLinkAttributesDTO> attributesDTOList; /** + * 娣诲姞鎴栫Щ闄ょ殑灞炴�� + */ + private String[] apNameArray; + + /** * 鏃堕棿鎴筹紝鐢ㄤ簬鏍¢獙鏄惁鏈�鏂版暟鎹� */ private Date ts; + /** + * 鍒涘缓浜� + */ + private String creator; + + /** + * 鍒涘缓鏃堕棿 + */ + private Date createTime; + + /** + * 鏈�鍚庝慨鏀逛汉 + */ + private String lastModifier; + + /** + * 鏈�鍚庝慨鏀规椂闂达紝鏍煎紡鏄痽yyy-MM-dd HH:mm:ss + */ + private Date lastModifyTime; + + public void setApNameArray(String[] apNameArray) { + this.apNameArray = apNameArray; + } + + public String[] getApNameArray() { + return apNameArray; + } + + public void setCreator(String creator) { + this.creator = creator; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public void setLastModifier(String lastModifier) { + this.lastModifier = lastModifier; + } + + public void setLastModifyTime(Date lastModifyTime) { + this.lastModifyTime = lastModifyTime; + } + + public String getCreator() { + return creator; + } + + public Date getCreateTime() { + return createTime; + } + + public String getLastModifier() { + return lastModifier; + } + + public Date getLastModifyTime() { + return lastModifyTime; + } + + public void setDelimiter(String delimiter) { + this.delimiter = delimiter; + } + + public String getDelimiter() { + return delimiter; + } + + public void setRevLevel(short revLevel) { + this.revLevel = revLevel; + } + + public short getRevLevel() { + return revLevel; + } + + public String getfName() { + return fName; + } + + public void setfName(String fName) { + this.fName = fName; + } + public String getOid() { return oid; } diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OsBtmTypeVO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OsBtmTypeVO.java index 5283769..6dc7487 100644 --- a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OsBtmTypeVO.java +++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OsBtmTypeVO.java @@ -85,7 +85,6 @@ */ private boolean secretFlag; - /** * 瀹炰緥鍖栫被 */ @@ -95,7 +94,6 @@ * C# */ private String shape; - /** * 鐢熷懡鍛ㄦ湡鐨勮嫳鏂囧悕绉� @@ -112,6 +110,10 @@ */ private String versionRule; + /** + * 鐗堟湰绾у埆 + */ + private short revLevel; /** * 澶囩敤鐢熷懡鍛ㄦ湡鑻辨枃鍚嶇О @@ -132,6 +134,11 @@ * 瑙嗗浘鍒涘缓鐨剆ql璇彞 */ private String viewCreateSql; + + /** + * 鍒嗛殧绗� + */ + private String delimiter; /** * 涓氬姟绫诲瀷鍚嶇О @@ -173,6 +180,22 @@ */ private List<OsBtmTypeAttributeVO> attributes; + public void setDelimiter(String delimiter) { + this.delimiter = delimiter; + } + + public String getDelimiter() { + return delimiter; + } + + public void setRevLevel(short revLevel) { + this.revLevel = revLevel; + } + + public short getRevLevel() { + return revLevel; + } + public String getOid() { return oid; } diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsLifeCycleController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsLifeCycleController.java index c4460b8..0eb1e24 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsLifeCycleController.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsLifeCycleController.java @@ -35,7 +35,6 @@ */ @RequestMapping("/lifeCycleController") @RestController -@VciUnCheckRight public class OsLifeCycleController { /** 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 395bfa5..7e6b5cf 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,6 +1,9 @@ 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.starter.web.annotation.controller.VciUnCheckRight; import com.vci.starter.web.annotation.log.VciBusinessLog; import com.vci.starter.web.enumpck.BooleanEnum; @@ -18,7 +21,9 @@ 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; @@ -46,6 +51,7 @@ @RequestMapping("/btmTypeController") @VciBusinessLog(modelName="涓氬姟绫诲瀷") @RestController +@VciUnCheckRight public class WebBtmTypeController { /** @@ -58,6 +64,12 @@ */ @Autowired private OsBtmServiceI btmService; + + /** + * 杩炴帴绫诲瀷鐨勬湇鍔� + */ + @Autowired + private OsLinkTypeServiceI linkTypeService; /** * 涓氬姟绫诲瀷瀵煎叆瀵煎嚭鏈嶅姟 @@ -102,20 +114,204 @@ } } - /** * 鑾峰彇鎵�鏈変笟鍔$被鍨嬶紙鏍戝舰缁撴瀯锛� * @return 鏌ヨ缁撴灉 */ @GetMapping( "/getTreeBizTypes") @VciBusinessLog(operateName = "鑾峰彇鎵�鏈変笟鍔$被鍨嬶紙鏍戝舰缁撴瀯锛�") - @VciUnCheckRight public BaseResult<List<Tree>> getTreeBizTypes(){ try { - return btmService.getTreeBizTypes(); + return BaseResult.dataList(btmService.getTreeBizTypes()); }catch (Exception e) { e.printStackTrace(); - String exceptionMessage = "鑾峰彇涓氬姟绫诲瀷鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e); + String exceptionMessage = "鏌ヨ涓氬姟绫诲瀷鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e); + logger.error(exceptionMessage); + return BaseResult.fail(exceptionMessage); + } + } + + /** + * 鑾峰彇涓氬姟绫诲瀷浣跨敤鑼冨洿 + * @param btmName + * @return 鏌ヨ缁撴灉 + */ + @GetMapping( "/getUsedBtmLinkList") + @VciBusinessLog(operateName = "鑾峰彇涓氬姟绫诲瀷浣跨敤鑼冨洿") + public BaseResult<List<String>> getUsedBtmLinkList(String btmName){ + try { + return BaseResult.dataList(linkTypeService.getUsedBtmLinkList(btmName)); + }catch (Exception e) { + e.printStackTrace(); + String exceptionMessage = "鑾峰彇涓氬姟绫诲瀷浣跨敤鑼冨洿鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e); + logger.error(exceptionMessage); + return BaseResult.fail(exceptionMessage); + } + } + + /** + * 鍒涘缓涓氬姟绫诲瀷 + * btmTypeDTO 閾炬帴绫诲瀷鐨勪繚瀛樺璞� + * @return 淇濆瓨缁撴灉 + */ + @PostMapping("/addBtmType") + public BaseResult addBtmType(@RequestBody OsBtmTypeDTO btmTypeDTO){ + try { + return btmService.addBtmType(btmTypeDTO) ? BaseResult.success("涓氬姟绫诲瀷鍒涘缓鎴愬姛锛�"):BaseResult.fail("涓氬姟绫诲瀷鍒涘缓澶辫触锛�"); + } catch (Exception e) { + e.printStackTrace(); + String exceptionMessage = "鍒涘缓涓氬姟绫诲瀷鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e); + logger.error(exceptionMessage); + return BaseResult.fail(exceptionMessage); + } + } + + /** + * 鎵归噺鍒涘缓涓氬姟绫诲瀷 + * btmTypeDTO 閾炬帴绫诲瀷鐨勪繚瀛樺璞� + * @return 淇濆瓨缁撴灉 + */ + @PostMapping("/addBtmTypes") + public BaseResult addBtmTypes(@RequestBody List<BizType> bizTypes){ + try { + return btmService.addBtmTypes(bizTypes) ? BaseResult.success("涓氬姟绫诲瀷鎵归噺鍒涘缓鎴愬姛锛�"):BaseResult.fail("涓氬姟绫诲瀷鎵归噺鍒涘缓澶辫触锛�"); + } catch (Exception e) { + e.printStackTrace(); + String exceptionMessage = "鎵归噺鍒涘缓涓氬姟绫诲瀷鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e); + logger.error(exceptionMessage); + return BaseResult.fail(exceptionMessage); + } + } + + /** + * 淇敼涓氬姟绫诲瀷 + * btmTypeDTO 閾炬帴绫诲瀷淇敼鐨勫璞� + * @return 淇濆瓨缁撴灉 + */ + @PostMapping("/updateBtmType") + public BaseResult updateBtmType(@RequestBody OsBtmTypeDTO btmTypeDTO){ + try { + return btmService.updateBtmType(btmTypeDTO) ? BaseResult.success("涓氬姟绫诲瀷淇敼鎴愬姛锛�"):BaseResult.fail("涓氬姟绫诲瀷淇敼澶辫触锛�"); + } catch (Exception e) { + e.printStackTrace(); + String exceptionMessage = "淇敼涓氬姟绫诲瀷鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e); + logger.error(exceptionMessage); + return BaseResult.fail(exceptionMessage); + } + } + + /** + * 涓氬姟绫诲瀷鍒犻櫎 + * btmTypeDTO 涓氬姟绫诲瀷瀵硅薄 + * @return 鍒犻櫎缁撴灉 + */ + @DeleteMapping("/deleteBtmType") + public BaseResult deleteLink(@RequestBody OsBtmTypeDTO btmTypeDTO){ + try { + return btmService.deleteBtmType(btmTypeDTO) ? BaseResult.success("鍒犻櫎涓氬姟绫诲瀷鎴愬姛锛�"):BaseResult.fail("鍒犻櫎涓氬姟绫诲瀷澶辫触锛�"); + } catch (PLException e) { + e.printStackTrace(); + String exceptionMessage = "鍒犻櫎涓氬姟绫诲瀷鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e); + logger.error(exceptionMessage); + return BaseResult.fail(exceptionMessage); + } + } + + /** + * 涓�鑷存�ф鏌� + * @return 妫�鏌ョ粨鏋� + */ + @GetMapping("/checkBtmConsistency") + public BaseResult checkBtmConsistency(){ + try { + return btmService.checkBtmConsistency(); + } catch (PLException e) { + e.printStackTrace(); + String exceptionMessage = "涓氬姟绫诲瀷涓�鑷存�ф鏌ユ椂鍑虹幇閿欒锛屽師鍥狅細" + VciBaseUtil.getExceptionMessage(e); + logger.error(exceptionMessage); + return BaseResult.fail(exceptionMessage); + } + } + + /** + * 涓�鑷存�ф鏌ワ紝涓氬姟绫诲瀷淇 + * @return 鍒犻櫎缁撴灉 + */ + @PostMapping("/executeRepair") + public BaseResult executeRepair(@RequestBody String repairData){ + try { + return btmService.executeRepair(repairData); + } catch (Exception e) { + e.printStackTrace(); + String exceptionMessage = "涓氬姟绫诲瀷淇鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e); + logger.error(exceptionMessage); + return BaseResult.fail(exceptionMessage); + } + } + + /** + * 鍒涘缓瑙嗗浘 + * @return + */ + @PostMapping("/createView") + public BaseResult createView(){ + try { + return btmService.createView() ? BaseResult.success("鍒涘缓瑙嗗浘鎴愬姛!"):BaseResult.fail("鍒涘缓瑙嗗浘澶辫触!"); + } catch (Exception e) { + e.printStackTrace(); + String exceptionMessage = "鍒涘缓瑙嗗浘鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e); + logger.error(exceptionMessage); + return BaseResult.fail(exceptionMessage); + } + } + + /** + * 鍒犻櫎鏁版嵁鐣岄潰鐨勬暟鎹煡璇� + * @return + */ + @GetMapping("/getObjectData") + public BaseResult getObjectData(){ + try { + return btmService.getObjectData(); + } catch (Exception e) { + e.printStackTrace(); + String exceptionMessage = "鏁版嵁瀵硅薄鏌ヨ鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e); + logger.error(exceptionMessage); + return BaseResult.fail(exceptionMessage); + } + } + + /** + * 鍒犻櫎鏁版嵁 + * @param btmNames 涓氬姟绫诲瀷鍚� + * @param linkNames 閾炬帴绫诲瀷鍚� + * @return + * @throws PLException + */ + @DeleteMapping("/truncateTable") + public BaseResult truncateTable(String[] btmNames,String[] linkNames){ + try { + return BaseResult.dataList(btmService.truncateTable(btmNames,linkNames)); + } catch (Exception e) { + e.printStackTrace(); + String exceptionMessage = "鍒犻櫎鏁版嵁鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e); + logger.error(exceptionMessage); + return BaseResult.fail(exceptionMessage); + } + } + + /** + * 鍒犻櫎鍏ㄩ儴绫诲瀷 + * @return + * @throws PLException + */ + @DeleteMapping("/deleteAllType") + public BaseResult deleteAllType(){ + try { + return BaseResult.dataList(btmService.deleteAllType()); + } catch (Exception e) { + e.printStackTrace(); + String exceptionMessage = "鍒犻櫎鍏ㄩ儴绫诲瀷鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e); logger.error(exceptionMessage); return BaseResult.fail(exceptionMessage); } @@ -141,7 +337,6 @@ @GetMapping(value = "/getBizTypeQTDs") @VciBusinessLog(operateName = "鏌ョ湅涓氬姟绫诲瀷鐨勫睘鎬�") public BaseResult<List<OsBtmTypeAttributeVO>> getBizTypeQTDs(String btmName){ - try { List<OsBtmTypeAttributeVO> osBtmTypeAttributeVOS = btmService.getBizTypeQTDs(btmName); return BaseResult.dataList(osBtmTypeAttributeVOS); @@ -218,7 +413,6 @@ return dataGrid; } - /** * 浣跨敤涓婚敭鑾峰彇涓氬姟绫诲瀷鍖呭惈鐨勫睘鎬э紝涓嶅垎椤� * @param baseQueryObject 鏌ヨ瀵硅薄 @@ -250,7 +444,6 @@ return dataGrid; } - /** * 浣跨敤涓婚敭鑾峰彇涓氬姟绫诲瀷鐨勫璞� * @param oid 涓婚敭 @@ -264,6 +457,7 @@ } return BaseResult.success(btmTypeVO); } + /** * 瀵煎嚭涓氬姟绫诲瀷鐨勪俊鎭埌word涓� * @param btmTypeIds 涓氬姟绫诲瀷鐨勭紪鍙凤紝鐢ㄩ�楀彿鍒嗗壊 @@ -333,4 +527,5 @@ public BaseResult createERUsed(String id){ return BaseResult.success(btmService.createERUsed(id)); } + } diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsBtmServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsBtmServiceI.java index aacf813..e8abcb5 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsBtmServiceI.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsBtmServiceI.java @@ -2,6 +2,7 @@ import com.vci.corba.common.PLException; import com.vci.corba.omd.btm.BizType; +import com.vci.dto.OsBtmTypeDTO; import com.vci.pagemodel.OsBtmTypeAttributeVO; import com.vci.pagemodel.OsBtmTypeVO; import com.vci.pagemodel.OsERVO; @@ -11,6 +12,7 @@ import com.vci.starter.web.pagemodel.PageHelper; import com.vci.starter.web.pagemodel.Tree; +import java.io.IOException; import java.text.ParseException; import java.util.Collection; import java.util.List; @@ -158,11 +160,115 @@ * 鑾峰彇鎵�鏈変笟鍔$被鍨嬶紙鏍戝舰缁撴瀯锛� * @return 鏌ヨ缁撴灉 */ - BaseResult<List<Tree>> getTreeBizTypes() throws PLException; + List<Tree> getTreeBizTypes() throws PLException; + + /** + * 鑾峰彇鎵�鏈変笟鍔$被鍨嬪悕绉伴泦鍚� + * @return + */ + List<String> getAllBtmName() throws PLException; + /** * 鑾峰彇涓氬姟鍏ㄩ儴灞炴�х被鍨� * @param btmName 涓氬姟绫诲瀷鍚嶇О * @return 灞炴�х殑淇℃伅 */ List<OsBtmTypeAttributeVO> getBizTypeQTDs(String btmName) throws PLException, ParseException; + + /** + * 鍒涘缓鏂扮殑涓氬姟绫诲瀷 + * @return + * @throws PLException + */ + boolean addBtmType(OsBtmTypeDTO btmTypeDTO) throws PLException; + + /** + * 鎵归噺鏂板涓氬姟绫诲瀷 + * @param bizTypes + * @return + */ + boolean addBtmTypes(List<BizType> bizTypes); + + /** + * 淇敼涓氬姟绫诲瀷 + * @param btmTypeDTO + * @return + * @throws PLException + */ + boolean updateBtmType(OsBtmTypeDTO btmTypeDTO) throws PLException; + + /** + * 鍒犻櫎涓氬姟绫诲瀷 + * @param btmTypeDTO + * @return + * @throws PLException + */ + boolean deleteBtmType(OsBtmTypeDTO btmTypeDTO) throws PLException; + + /** + * 涓�鑷存�ф鏌� + * @return + * @throws PLException + */ + BaseResult checkBtmConsistency() throws PLException; + + /** + * 涓�鑷存�ф鏌ヤ慨澶嶅姛鑳� + * @param repairData + * @return + */ + BaseResult executeRepair(String repairData) throws Exception; + + /** + * 鍒涘缓瑙嗗浘 + * @return + * @throws PLException + */ + boolean createView() throws PLException; + + /** + * 鍒犻櫎鏁版嵁鐣岄潰鐨勬煡璇� + * @return 涓氬姟绫诲瀷锛岄摼鎺ョ被鍨� + */ + BaseResult getObjectData() throws PLException; + + /** + * 鍒犻櫎鏁版嵁 + * @param btmNames 涓氬姟绫诲瀷鍚� + * @param linkNames 閾炬帴绫诲瀷鍚� + * @return + * @throws PLException + */ + List<Map> truncateTable(String[] btmNames,String[] linkNames) throws PLException; + + /** + * 鍒犻櫎鍏ㄩ儴绫诲瀷 + * @return + * @throws PLException + */ + BaseResult deleteAllType() throws PLException; + + /** + * 鏍规嵁涓氬姟绫诲瀷鍚嶇О鍜屽叾涓嬬殑灞炴�у悕绉拌幏鍙栦篃鏈夌殑绱㈠紩 + * @param btmName + * @param attrName + * @return + */ + List<String> getIndexByBtmAndAttrName(String btmName,String attrName); + + /** + * 鏍规嵁涓氬姟绫诲瀷鍚嶇О鍜屽叾涓嬬殑灞炴�у悕绉板垹闄ょ储寮� + * @param btmName + * @param attrName + * @return + */ + boolean delIndexByBtmAndAttrName(String btmName,String attrName); + + /** + * 缁欎笟鍔$被鍨嬩笅鐨勬寚瀹氬睘鎬ф柊澧炵储寮� + * @param addMap 濡傦細(btmName:part attrName:name indexName: PARTNAMEINDEX) + * @return + */ + boolean addIndex(Map<String,String> addMap); + } diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsLinkTypeServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsLinkTypeServiceI.java index 5169a30..63ee265 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsLinkTypeServiceI.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsLinkTypeServiceI.java @@ -47,6 +47,13 @@ List<String> getAllLtName() throws PLException; /** + * 鑾峰彇浣跨敤璇ヤ笟鍔$被鍨嬬殑閾炬帴绫诲瀷鍚� + * @param btmName 涓氬姟绫诲瀷鍚嶇О + * @return + */ + List<String> getUsedBtmLinkList(String btmName); + + /** * 鏌ヨ鎵�鏈夌殑閾炬帴绫诲瀷 * @return 閾炬帴绫诲瀷瀵硅薄 */ diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java index 0d90146..22c0296 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java @@ -1,11 +1,23 @@ package com.vci.web.service.impl; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.vci.client.common.providers.ClientServiceProvider; +import com.vci.client.mw.ClientSessionUtility; import com.vci.corba.common.PLException; import com.vci.corba.omd.atm.AttributeDef; import com.vci.corba.omd.btm.BizType; +import com.vci.corba.omd.etm.EnumType; +import com.vci.corba.omd.lcm.Bound; +import com.vci.corba.omd.lcm.LifeCycle; import com.vci.corba.omd.ltm.LinkType; -import com.vci.corba.omd.qtm.QTD; +import com.vci.corba.omd.stm.StatePool; +import com.vci.corba.omd.vrm.VersionRule; +import com.vci.dto.OsBtmTypeDTO; +import com.vci.dto.OsBtmTypeLinkAttributesDTO; import com.vci.omd.constants.AttributeConstants; +import com.vci.omd.constants.FileObjectType; +import com.vci.omd.objects.OtherInfo; import com.vci.pagemodel.*; import com.vci.starter.web.annotation.log.VciUnLog; import com.vci.starter.web.enumpck.BooleanEnum; @@ -17,6 +29,7 @@ import com.vci.starter.web.util.BeanUtil; import com.vci.starter.web.util.VciBaseUtil; import com.vci.starter.web.util.VciDateUtil; +import com.vci.starter.web.util.WebThreadLocalUtil; import com.vci.web.service.*; import com.vci.web.util.ConcurrentDateFormat; import com.vci.web.util.Func; @@ -30,6 +43,8 @@ import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +import javax.swing.*; +import java.io.IOException; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; @@ -85,6 +100,31 @@ @Autowired(required = false) @Lazy private OsBtmServiceI self; + + /** + * 涓�浜涢粯璁ょ殑琛� + */ + private final List<String> tableList = Arrays.asList("pl_qtemplate", "PL_QTEMPLATEDEF", + "pl_typeright", "plcommandparameter", "plpagedefination", + "pluilayout", "pltabbutton", "pltabpage", "plportalvi", + "plreleasedobj"); + + /** + * workFlowTables 涓殑琛ㄦ湁涓诲閿叧绯�,褰撹〃涓婚敭鎴栧敮涓�閿寮曠敤涓哄閿椂, + * 灏辩畻寮曠敤鏂规病鏈夋暟鎹�, truncate杩樹笉鏄笉鑳藉垹闄よ〃涓暟鎹�, 鑰� delete鍙互. + */ + private final List<String> workFlowTableList = Arrays.asList( + //娴佺▼(鑷畾涔夎〃) + "PLPROCESSTEMPLATE", "PLPROCESSCATEGORY", "PLPROCESSTASK",//"PLRMTEMPLATEPROCESS", + "PLPROCESSTASKPROPERTY", "PLFLOWAPPROVEOPINION", "PLFLOWOBJECT", "PLFLOWINSTANCE", + "WORKFLOW_TASK_CC_TABLE", "PLTASKDESC", "PLTASKSASSIGNED", "JBPM_SUBPROCESSTEM", + "JBPM4_TASKANDUSERCONFIG", "PLREVOKEPOLICY", "JBPM4_TASKANDUSERCONFIGEX", + //娴佺▼(JBPM绯荤粺琛�) + "JBPM4_DEPLOYPROP", "JBPM4_HIST_DETAIL", "JBPM4_ID_MEMBERSHIP", "JBPM4_JOB", + "JBPM4_PARTICIPATION", "JBPM4_VARIABLE", "JBPM4_HIST_ACTINST", "JBPM4_HIST_VAR", + "JBPM4_ID_GROUP", "JBPM4_ID_USER", "JBPM4_LOB", "JBPM4_DEPLOYMENT", + "JBPM4_HIST_PROCINST", "JBPM4_HIST_TASK", "JBPM4_TASK", "JBPM4_SWIMLANE", + "JBPM4_EXECUTION", "JBPM4_PROPERTY"); /** * 鏌ヨ鎵�鏈夌殑涓氬姟绫诲瀷 @@ -157,9 +197,11 @@ vo.setAbstractFlag(btmItem.isAbstract); vo.setImplClass(btmItem.implClass); vo.setShape(btmItem.shape); + vo.setRevLevel(btmItem.revLevel); vo.setRevisionRuleId(btmItem.revRuleName); vo.setTableName(VciBaseUtil.getTableName(vo.getId())); vo.setInputRevisionFlag(btmItem.revInput); + vo.setDelimiter(btmItem.delimiter); if(StringUtils.isNotBlank(vo.getRevisionRuleId()) || vo.isInputRevisionFlag()){ vo.setRevisionFlag(true); } @@ -529,12 +571,13 @@ ervo.setTabRelViewList(relationVOList); return ervo; } + /** * 鑾峰彇鎵�鏈変笟鍔$被鍨嬶紙鏍戝舰缁撴瀯锛� * @return 鏌ヨ缁撴灉 */ @Override - public BaseResult<List<Tree>> getTreeBizTypes() throws PLException { + public List<Tree> getTreeBizTypes() throws PLException { List<Tree> rootTreeList = new ArrayList<>(); BizType[] bizTypes = getBizTypes(""); BizType btItem = null; @@ -553,8 +596,22 @@ } } - return BaseResult.success(rootTreeList); + return rootTreeList; } + + /** + * 鑾峰彇鎵�鏈変笟鍔$被鍨嬪悕绉伴泦鍚� + * @return + */ + @Override + public List<String> getAllBtmName() throws PLException { + BizType[] bizTypes = platformClientUtil.getBtmService().getBizTypes(""); + if(null != bizTypes && bizTypes.length > 0){ + return Arrays.stream(bizTypes).map(bizType -> bizType.name).collect(Collectors.toList()); + } + return null; + } + /** * 鑾峰彇涓氬姟鍏ㄩ儴灞炴�х被鍨� * @param btmName 涓氬姟绫诲瀷鍚嶇О @@ -610,6 +667,523 @@ osBtms.add(vo); } return osBtms; + } + + /** + * dto杞琩o瀵硅薄 + * @return + */ + private BizType dto2BizType(OsBtmTypeDTO dto){ + BizType bizType = new BizType(); + bizType.name =dto.getId(); + bizType.isAbstract = dto.isAbstractFlag(); + bizType.label = dto.getName(); + bizType.fName = dto.getfName(); + bizType.implClass = dto.getImplClass(); + bizType.shape = ""; + bizType.lifeCycle = dto.getLifeCycleId(); + List<String> lcList = Arrays.asList(dto.getSubLifeCycleId().split(",")); + if (lcList != null) { + bizType.lifeCycles = lcList.toArray(new String[0]); + } else { + bizType.lifeCycles = new String[0]; + } + bizType.description = dto.getDescription(); + bizType.revLevel = dto.getRevLevel(); + + bizType.revRuleName = dto.getRevisionRuleName(); + bizType.revInput = dto.isInputRevisionFlag(); + + bizType.delimiter = (dto.getDelimiter() == null ? "" : dto.getDelimiter()); + + bizType.verRuleName = Short.parseShort(dto.getRevisionRuleName()); + + //bizType.imageName = dto.get; + //List<String> attrIdList = dto.getAttributesDTOList().stream().map(OsBtmTypeLinkAttributesDTO::getId).collect(Collectors.toList()); + + bizType.apNameArray = dto.getApNameArray();//attrIdList.toArray(new String[attrIdList.size()]); + String userId = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); + long timeMillis = System.currentTimeMillis(); + bizType.creator = Func.isBlank(dto.getCreator()) ? userId:dto.getCreator(); + bizType.createTime = Func.isEmpty(dto.getCreateTime()) ? timeMillis:dto.getCreateTime().getTime(); + bizType.modifier = userId; + bizType.modifyTime = timeMillis; + return bizType; + } + + /** + * 鍒涘缓鏂扮殑涓氬姟绫诲瀷 + * @return + * @throws PLException + */ + @Override + public boolean addBtmType(OsBtmTypeDTO btmTypeDTO) throws PLException { + VciBaseUtil.alertNotNull(btmTypeDTO,"鍒涘缓鐨勪笟鍔$被鍨嬪璞�"); + //涓氬姟绫诲瀷鍚嶇О妫�鏌� + checkName(btmTypeDTO.getId()); + //鐢熷懡鍛ㄦ湡妫�鏌� + checkLifeCycle(btmTypeDTO); + //鐗堟湰瑙勫垯妫�鏌� + checkVersionInfo(btmTypeDTO); + BizType bizType = this.dto2BizType(btmTypeDTO); + return platformClientUtil.getBtmService().addBizType(bizType); + } + + /** + * 鎵归噺鏂板涓氬姟绫诲瀷 + * @param bizTypes + * @return + */ + @Override + public boolean addBtmTypes(List<BizType> bizTypes) { + VciBaseUtil.alertNotNull(bizTypes,"鍒涘缓鐨勪笟鍔$被鍨嬪璞″垪琛�"); + bizTypes.stream().forEach(bizType->{ + try { + platformClientUtil.getBtmService().addBizType(bizType); + } catch (PLException e) { + e.printStackTrace(); + String exceptionMessage = VciBaseUtil.getExceptionMessage(e); + logger.error(exceptionMessage); + throw new VciBaseException(exceptionMessage); + } + }); + + return true; + } + + /** + * 妫�鏌ヤ笟鍔$被鍨嬪悕绉版槸鍚﹀悎瑙� + * @param btmName + * @throws PLException + */ + private void checkName(String btmName) throws PLException { + if (Func.isBlank(btmName)) { + throw new PLException("500",new String[]{"涓氬姟绫诲瀷鍚嶄笉鑳戒负绌�!"}); + } + + if (!btmName.matches("[a-z A-Z]*")) { + throw new PLException("500",new String[]{"涓氬姟绫诲瀷鍚嶅彧鑳戒负鑻辨枃瀛楁瘝!"}); + } + + int maxLength = platformClientUtil.getBtmService().getBTNameMaxLength(); + + if (btmName.length() > maxLength) { + throw new PLException("500",new String[]{"涓氬姟绫诲瀷鍚嶉暱搴︿笉鑳借秴杩�" + maxLength}); + } + + if (platformClientUtil.getBtmService().checkRowIsExists(btmName)) { + throw new PLException("500",new String[]{"涓氬姟绫诲瀷鍚嶅凡缁忓瓨鍦�"}); + } + } + + /** + * 鏄惁閫夋嫨鐢熷懡鍛ㄦ湡 + * + * @return + */ + private void checkLifeCycle(OsBtmTypeDTO btmTypeDTO) throws PLException { + if (Func.isBlank(btmTypeDTO.getLifeCycleId())) { + throw new PLException("500",new String[]{"鐢熷懡鍛ㄦ湡涓嶈兘涓虹┖"}); + } + } + + /** + * 閫夋嫨涓�绾х増鏈細蹇呴』閫夋嫨鎴栨墜宸ヨ緭鍏ョ増鏈彿瑙勫垯; 閫夋嫨浜岀骇鐗堟湰锛氬繀椤婚�夋嫨鎴栨墜宸ヨ緭鍏ョ増鏈彿瑙勫垯, (鐗堟鍙峰凡缁忛粯璁ら�夋嫨). + * @return + */ + private void checkVersionInfo(OsBtmTypeDTO dto) throws PLException { + //闇�瑕佹墜鍔ㄨ緭鍏ョ増鏈椂revisionRuleName涓嶈兘涓虹┖ + if (dto.isInputRevisionFlag() && Func.isBlank(dto.getRevisionRuleName())) { + throw new PLException("500",new String[]{"鐗堟湰鍙疯鍒欎笉鑳戒负绌�"}); + } + } + + /** + * 鐗堟湰鏈哄埗淇敼: 浠呭厑璁哥被鍨嬩粠"涓嶅彲淇"鍙樻洿鑷�"涓�绾х増鏈鐞嗘満鍒�","浜岀骇鐗堟湰绠$悊鏈哄埗杩涜璋冩暣"; "涓�绾х増鏈鐞嗘満鍒�"鍙樻洿鑷�"浜岀骇鐗堟湰绠$悊鏈哄埗"; + * 涓ょ鏂瑰紡. + * @param dbBizType 褰撳墠淇敼鍓嶇殑涓氬姟绫诲瀷锛堝簱涓瓨鍌ㄧ殑锛� + * @param dto 褰撳墠淇敼涓氬姟绫诲瀷 + * @throws PLException + */ + private void checkRevLevel(BizType dbBizType,OsBtmTypeDTO dto) throws PLException { + if (dbBizType.revLevel == 1 && dto.getRevLevel()==0) { + throw new PLException("500",new String[]{"鐗堟湰鍙樻洿閿欒锛氫笉鑳戒粠涓�绾у彉涓轰笉鍙慨璁�"}); + } + + if (dbBizType.revLevel == 2 && (dto.getRevLevel() == 1 || dto.getRevLevel() == 0)) { + throw new PLException("500",new String[]{"鐗堟湰鍙樻洿閿欒锛氫笉鑳戒粠浜岀骇鍙樹负涓�绾ф垨涓嶅彲淇"}); + } + } + + /** + * 淇敼涓氬姟绫诲瀷 + * @param btmTypeDTO + * @return + * @throws PLException + */ + @Override + public boolean updateBtmType(OsBtmTypeDTO btmTypeDTO) throws PLException { + VciBaseUtil.alertNotNull(btmTypeDTO,"淇敼鐨勪笟鍔$被鍨嬪璞�"); + //妫�鏌ョ敓鍛藉懆鏈熸槸鍚﹀悎瑙� + checkLifeCycle(btmTypeDTO); + //鏌ヨ鏁版嵁搴撲腑鐨勪笟鍔$被鍨� + String id = btmTypeDTO.getId(); + BizType dbBizType = platformClientUtil.getBtmService().getBizTypeByName(id); + if(Func.isEmpty(dbBizType) || Func.isBlank(dbBizType.oid)){ + throw new PLException("500",new String[]{"褰撳墠淇敼鐨勪笟鍔$被鍨嬩笉瀛樺湪锛�"}); + } + //妫�鏌ョ増鏈鍒欎慨鏀规槸鍚﹀悎瑙� + checkRevLevel(dbBizType,btmTypeDTO); + checkVersionInfo(btmTypeDTO); + //澶勭悊涓氬姟绫诲瀷涓嬬殑灞炴�� + List<String> lastAttrList = new ArrayList<>(Arrays.asList(btmTypeDTO.getApNameArray())); + //涓嶈兘绉婚櫎鐨勫睘鎬� + String[] unRemovableFields = null; + List<String> unRemovableFields_ = null; + //闇�瑕佺Щ闄ょ殑灞炴�� + List<String> removableFields = null; + //淇敼鍓嶄笟鍔$被鍨嬪湪鏁版嵁搴撲腑宸插瓨鍦ㄧ殑鎵�鏈夊睘鎬� + String[] apNameArray = btmTypeDTO.getApNameArray(); + Set<String> dbApNameArray = Arrays.stream(dbBizType.apNameArray) + .collect(Collectors.toSet()); + //杩囨护鍑洪渶瑕佺Щ闄ょ殑灞炴�� + removableFields = Arrays.stream(apNameArray) + .filter(ap -> !dbApNameArray.contains(ap)) // 杩囨护涓嶅湪 dbApSet 涓殑鍏冪礌 + .collect(Collectors.toList()); + // 褰撲笟鍔$被鍨嬭〃涓煇灞炴�у凡缁忔湁鍊�, 涓嶅垹闄よ灞炴��, 灏嗗凡缁忕Щ闄ょ殑灞炴�ф坊鍔犲洖鏉� + unRemovableFields = platformClientUtil.getBtmService().getUnRemovableFields(id, removableFields.toArray(new String[0])); + if (removableFields.size() > 0) { + //妫�鏌ヤ笟鍔$被鍨嬫槸鍚﹀叿鏈夊疄渚� + if (this.hasInstanceByBtmName(id)) { + //涓氬姟绫诲瀷宸叉湁瀹炰緥, 鍙兘鍒犻櫎娌℃湁鏁版嵁鐨勫垪 + if (unRemovableFields != null && unRemovableFields.length > 0) { + unRemovableFields_ = Arrays.asList(unRemovableFields); + for (int i = 0; i < removableFields.size(); i++) { + String abName = removableFields.get(i); + if (unRemovableFields_.contains(abName)) { + if (!lastAttrList.contains(abName)) { + lastAttrList.add(abName); + } + } + } + } + } + } + BizType bizType = dto2BizType(btmTypeDTO); + bizType.apNameArray = lastAttrList.toArray(new String[lastAttrList.size()]); + return platformClientUtil.getBtmService().updateBizType(bizType); + } + + /** + * 鍒犻櫎涓氬姟绫诲瀷 + * @param btmTypeDTO + * @return + * @throws PLException + */ + @Override + public boolean deleteBtmType(OsBtmTypeDTO btmTypeDTO) throws PLException { + VciBaseUtil.alertNotNull(btmTypeDTO,"鍒犻櫎鐨勪笟鍔$被鍨�"); + String btmName = btmTypeDTO.getId(); + //鍙兘鍒犻櫎鍙跺瓙鑺傜偣 + if(Func.isNotBlank(btmTypeDTO.getfName())){ + throw new PLException("500",new String[]{"鍙兘鍒犻櫎鍙跺瓙鑺傜偣"}); + } + // 涓氬姟绫诲瀷琚摼鎺ョ被鍨嬩娇鐢�, 涓嶈兘鍒犻櫎 + List<String> usedNameList = linkTypeService.getUsedBtmLinkList(btmName); + if (usedNameList != null && usedNameList.size() > 0) { + throw new PLException("500",new String[]{"璇ョ被鍨嬪凡琚摼鎺ョ被鍨嬩娇鐢紝绂佹鍒犻櫎"}); + } + // 涓氬姟绫诲瀷宸茬粡鐢熸垚浜嗕笟鍔″璞�, 涓嶈兘鍒犻櫎 + if (hasInstanceByBtmName(btmName)) { + throw new PLException("500",new String[]{"璇ョ被鍨嬪凡鏈夊疄渚嬶紝绂佹鍒犻櫎"}); + } + + BizType bizType = new BizType(); + bizType.ts = btmTypeDTO.getTs().getTime(); + bizType.oid = btmTypeDTO.getOid(); + bizType.name = btmTypeDTO.getId(); + return platformClientUtil.getBtmService().deleteBizType(bizType); + } + + /** + * 涓�鑷存�ф鏌� + * @return + * @throws PLException + */ + @Override + public BaseResult checkBtmConsistency() throws PLException { + String[] result = platformClientUtil.getBtmService().btmConsistencyCheck(); + Map<String, String> dbCheckMap = new HashMap<String, String>(); + for(int i = 0; i < result.length; i++){ + String info = result[i]; + if(info.equals("")){ + continue; + } + String[] infos = info.split("/DML"); + String typeName = infos[0]; + String dml = infos[1]; + dbCheckMap.put(typeName, dml); + } + if(dbCheckMap.size() < 1){ + return BaseResult.successMsg("鏁版嵁搴撲腑鐨勮〃缁撴瀯涓庣被鍨嬩竴鑷�,鏃犻渶淇!!"); + }else{ + //闇�瑕佷慨澶嶆椂灏遍渶瑕佺晫闈㈠敜璧峰璇濇杩涜澶勭悊 + List<Map> list = new ArrayList<>(); + list.add(dbCheckMap); + BaseResult<List<Map>> listBaseResult = BaseResult.dataList(200, list, "闇�瑕佽繘琛屽垪鐨勪慨澶嶏紒锛�"); + listBaseResult.setSuccess(false); + return listBaseResult; + } + } + + /** + * 涓�鑷存�ф鏌ヤ慨澶嶅姛鑳� + * @param repairData + * @return + */ + @Override + public BaseResult executeRepair(String repairData) throws Exception { + Map<String, String> dbCheckMap = new ObjectMapper().readValue(repairData, new TypeReference<Map<String,String>>(){}); + List<String> list = this.getRepairDML(dbCheckMap); + if(list.size() < 1){ + return BaseResult.success(); + } + try { + String[] result = platformClientUtil.getBtmService().executeRepair(list.toArray(new String[0])); + return BaseResult.success(result); + }catch (PLException e){ + return BaseResult.fail("涓氬姟绫诲瀷淇澶辫触锛屽師鍥狅細"+VciBaseUtil.getExceptionMessage(e)); + } + } + + /** + * 鍒涘缓瑙嗗浘 + * @return + * @throws PLException + */ + @Override + public boolean createView() throws PLException { + return platformClientUtil.getBtmService().createView(); + } + + /** + * 鍒犻櫎鏁版嵁鐣岄潰鐨勬煡璇� + * @return 涓氬姟绫诲瀷锛岄摼鎺ョ被鍨� + */ + @Override + public BaseResult getObjectData() throws PLException { + //鑾峰彇涓氬姟绫诲瀷鍚嶇О闆嗗悎 + List<String> allBtmName = this.getAllBtmName(); + //鑾峰彇閾炬帴绫诲瀷鍚嶇О闆嗗悎 + List<String> allLinkType = linkTypeService.getAllLtName(); + Map<String,List> map = new HashMap<>(); + map.put("btmType",allBtmName); + map.put("linkType",allLinkType); + map.put("table",tableList); + map.put("workFlow",workFlowTableList); + List<Map> list = new ArrayList<>(); + list.add(map); + return BaseResult.dataList(list); + } + + /** + * 鍒犻櫎鏁版嵁 + * @param btmNames 涓氬姟绫诲瀷鍚� + * @param linkNames 閾炬帴绫诲瀷鍚� + * @return + * @throws PLException + */ + @Override + public List<Map> truncateTable(String[] btmNames,String[] linkNames) throws PLException { + List<Map> returnMapList = new ArrayList<>(); + Map<String, List<String>> map = new HashMap<>(); + map.put("btmSuccess",new ArrayList<>()); + map.put("btmFail",new ArrayList<>()); + map.put("linkSuccess",new ArrayList<>()); + map.put("linkFail",new ArrayList<>()); + if(Func.isNotEmpty(btmNames)){ + for(int i = 0; i < btmNames.length; i++){ + String btName = btmNames[i]; + try { + if(platformClientUtil.getBtmService().truncateTable(btName)){ + //淇敼鎴愬姛璁板綍涓嬫垚鍔熺殑涓氬姟绫诲瀷鍚� + map.get("btmSuccess").add(btName); + } + } catch (PLException e1) { + e1.printStackTrace(); + logger.error(VciBaseUtil.getExceptionMessage(e1)); + //淇敼澶辫触璁板綍涓嬪け璐ョ殑涓氬姟绫诲瀷鍚� + map.get("btmFail").add(btName); + } + } + } + if(Func.isNotEmpty(linkNames)){ + //truncate閾炬帴绫诲瀷鏁版嵁 + for(int i = 0; i < linkNames.length; i++){ + String ltName = linkNames[i]; + try { + if(platformClientUtil.getLinkTypeService().truncateTable(ltName)){ + map.get("linkSuccess").add(ltName); + } + } catch (PLException e1) { + e1.printStackTrace(); + logger.error(VciBaseUtil.getExceptionMessage(e1)); + map.get("linkFail").add(ltName); + } + } + } + returnMapList.add(map); + return returnMapList; + } + + /** + * 鍒犻櫎鍏ㄩ儴绫诲瀷 + * @return + * @throws PLException + */ + @Override + public BaseResult deleteAllType() throws PLException { + DeleteType deleteType = new DeleteType(); + //鑾峰彇寰呭垹闄ょ殑涓氬姟绫诲瀷 + List<BizType> delBtList = deleteType.getDelBtList(); + //鑾峰彇寰呭垹闄ょ殑閾炬帴绫诲瀷 + List<LinkType> ltNames = deleteType.getDelLtList(); + //鑾峰彇寰呭垹闄ょ殑灞炴�� + List<String> delAbList = deleteType.getDelAbList(); + //鑾峰彇寰呭垹闄ょ殑鏋氫妇绫诲瀷 + List<EnumType> delEnumList = deleteType.getDelEnumList(); + //鑾峰彇寰呭垹闄ょ殑鐢熷懡鍛ㄦ湡 + List<LifeCycle> delLCList = deleteType.getDelLCList(); + //鑾峰彇寰呭垹闄ょ殑鐘舵�� + List<StatePool> delStateList = deleteType.getDelSPList(); + //鑾峰彇寰呭垹闄ょ殑鐗堟湰瑙勫垯 + List<VersionRule> delVRList = deleteType.getDelVRList(); + try { + platformClientUtil.getBtmService().deleteBtsAndTables(delBtList.toArray(new BizType[0])); + } catch (PLException e) { + e.printStackTrace(); + String exceptionMessage = "娓呴櫎涓氬姟绫诲瀷鍜屽搴旇〃鏍兼椂鍑虹幇寮傚父锛屽師鍥狅細"+VciBaseUtil.getExceptionMessage(e); + logger.error(exceptionMessage); + return BaseResult.fail(exceptionMessage); + } + try { + ClientServiceProvider.getOMDService().getLinkTypeService().deleteLtsAndTables(ltNames.toArray(new LinkType[0])); + } catch (PLException e) { + e.printStackTrace(); + String exceptionMessage = "娓呴櫎閾炬帴绫诲瀷鏃跺嚭鐜板紓甯革紝鍘熷洜锛�"+VciBaseUtil.getExceptionMessage(e); + logger.error(exceptionMessage); + return BaseResult.fail(exceptionMessage); + } + try { + AttributeDef[] abs = platformClientUtil.getAttributeService().getAttributeDefsByNames(delAbList.toArray(new String[0])); + platformClientUtil.getAttributeService().deleteAttributeDefs(abs); + } catch (PLException e) { + e.printStackTrace(); + String exceptionMessage = "娓呴櫎灞炴�ф睜灞炴�ф椂鍑虹幇寮傚父锛屽師鍥狅細"+VciBaseUtil.getExceptionMessage(e); + logger.error(exceptionMessage); + return BaseResult.fail(exceptionMessage); + } + try { + platformClientUtil.getEnumService().deleteEnumTypes(delEnumList.toArray(new EnumType[0])); + } catch (PLException e) { + e.printStackTrace(); + String exceptionMessage = "娓呴櫎鏋氫妇绫诲瀷鏃跺嚭鐜板紓甯革紝鍘熷洜锛�"+VciBaseUtil.getExceptionMessage(e); + logger.error(exceptionMessage); + return BaseResult.fail(exceptionMessage); + } + try { + platformClientUtil.getLifeCycleService().deleteLifeCycles(delLCList.toArray(new LifeCycle[0])); + } catch (PLException e) { + e.printStackTrace(); + String exceptionMessage = "娓呴櫎鐢熷懡鍛ㄦ湡鏃跺嚭鐜板紓甯革紝鍘熷洜锛�"+VciBaseUtil.getExceptionMessage(e); + logger.error(exceptionMessage); + return BaseResult.fail(exceptionMessage); + } + try { + platformClientUtil.getStatePoolService().deleteStatePools(delStateList.toArray(new StatePool[0])); + } catch (PLException e) { + e.printStackTrace(); + String exceptionMessage = "娓呴櫎鐘舵�佹睜鐘舵�佹椂鍑虹幇寮傚父锛屽師鍥狅細"+VciBaseUtil.getExceptionMessage(e); + logger.error(exceptionMessage); + return BaseResult.fail(exceptionMessage); + } + try { + platformClientUtil.getVersionService().deleteVersionRules(delVRList.toArray(new VersionRule[0])); + } catch (PLException e) { + e.printStackTrace(); + String exceptionMessage = "娓呴櫎鐗堟湰瑙勫垯鏃跺嚭鐜板紓甯革紝鍘熷洜锛�"+VciBaseUtil.getExceptionMessage(e); + logger.error(exceptionMessage); + return BaseResult.fail(exceptionMessage); + } + return BaseResult.success("娓呴櫎鏁版嵁瀹屾垚!"); + } + + /** + * 鏍规嵁涓氬姟绫诲瀷鍚嶇О鍜屽叾涓嬬殑灞炴�у悕绉拌幏鍙栦篃鏈夌殑绱㈠紩 + * @param btmName + * @param attrName + * @return + */ + @Override + public List<String> getIndexByBtmAndAttrName(String btmName, String attrName) { + return null; + } + + /** + * 鏍规嵁涓氬姟绫诲瀷鍚嶇О鍜屽叾涓嬬殑灞炴�у悕绉板垹闄ょ储寮� + * @param btmName + * @param attrName + * @return + */ + @Override + public boolean delIndexByBtmAndAttrName(String btmName, String attrName) { + return false; + } + + /** + * 缁欎笟鍔$被鍨嬩笅鐨勬寚瀹氬睘鎬ф柊澧炵储寮� + * @param addMap 濡傦細(btmName:part attrName:name indexName: PARTNAMEINDEX) + * @return + */ + @Override + public boolean addIndex(Map<String, String> addMap) { + return false; + } + + /** + * 鑾峰彇闇�瑕佷慨澶嶇殑浼猻ql + * @param dbCheckMap + * @return + */ + private List<String> getRepairDML(Map<String, String> dbCheckMap) { + List<String> list = new ArrayList<String>(); + for(Iterator<String> ite = dbCheckMap.keySet().iterator(); ite.hasNext();){ + String type = ite.next(); + String dml = dbCheckMap.get(type); + list.add(type + "/DML" + dml); + } + return list; + } + + /** + * 鏈夊疄渚嬶細true 鏃犲疄渚嬶細false + * + * @return + */ + private boolean hasInstanceByBtmName(String btmName) throws PLException { + //String tableName = OmdTools.getBTMTableName(btmName); + //boolean flag = DDLToolClient.getService().hasInstanceOralce(tableName); + boolean flag = false; + try { + flag = ClientServiceProvider.getOMDService().getBTMService().hasData(btmName); + } catch (PLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + String exceptionMessage = VciBaseUtil.getExceptionMessage(e); + logger.error(exceptionMessage); + throw new PLException("500",new String[]{exceptionMessage}); + } + return flag; } private List<Tree> getChildren(BizType[] bizTypes,BizType parentBIzType){ @@ -864,4 +1438,221 @@ } } + /** + * 灏佽鍒犻櫎鍏ㄩ儴绫诲瀷鐩稿叧鐨勬煡璇㈡柟娉曠殑鍐呴儴绫� + */ + private class DeleteType{ + + private List<String> exceptBts, exceptAbs, exceptEnums, exceptRev, exceptLCs, exceptStates; + + { + exceptBts.add("workitem"); + exceptBts.add(FileObjectType.FILE_DATA_TABLE); + } + + /** + * 鑾峰彇闇�瑕佸垹闄ょ殑涓氬姟绫诲瀷 + * @return + */ + public List<BizType> getDelBtList() throws PLException { + List<BizType> list = new ArrayList<>(); + BizType[] bts = platformClientUtil.getBtmService().getBizTypes(""); + for(BizType bt : bts){ + boolean exceptFlag = false; + for(String except : exceptBts){ + if(except.equalsIgnoreCase(bt.name)){ + exceptFlag = true; + break; + } + } + if(!exceptFlag){ + list.add(bt); + } + } + return list; + } + + /** + * 鑾峰彇闇�瑕佸垹闄ょ殑閾炬帴绫诲瀷 + * @return + */ + public List<LinkType> getDelLtList() throws PLException { + LinkType[] linkTypes = platformClientUtil.getLinkTypeService().getLinkTypes(); + return Arrays.asList(linkTypes); + } + + /** + * 鑾峰彇寰呭垹闄ょ殑灞炴�� + * @return + */ + public List<String> getDelAbList() { + List<String> list = new ArrayList<String>(); + AttributeDef[] attribItems = null; + try { + attribItems = platformClientUtil.getAttributeService().getAttributeDefs("", 0, 0); + } catch (PLException e) { + e.printStackTrace(); + } + //渚濇嵁淇濈暀鐨勭被鍨嬫瀯閫犱繚鐣欑殑灞炴�� + exceptAbs = new ArrayList<String>(); + for(String except : exceptBts){ + String[] btmApNameArray = null; + try { + btmApNameArray = platformClientUtil.getBtmService().getAttributeNames(except); + } catch (PLException e) { + e.printStackTrace(); + } + if(btmApNameArray != null){ + for(String abName : btmApNameArray){ + if(!exceptAbs.contains(abName)){ + exceptAbs.add(abName); + } + } + } + } + //鏋勯�犲彲鍒犻櫎鐨勫睘鎬� + if(attribItems != null){ + for(AttributeDef ab : attribItems){ + String abName = ab.name; + if(!exceptAbs.contains(abName)){ + list.add(abName); + } + } + } + return list; + } + + /** + * 鑾峰彇寰呭垹闄ょ殑鏋氫妇绫诲瀷 + * @return + */ + public List<EnumType> getDelEnumList() { + List<EnumType> list = new ArrayList<EnumType>(); + try { + //渚濇嵁淇濈暀鐨勭被鍨嬫瀯閫犱繚鐣欑殑灞炴�� + exceptEnums = new ArrayList<String>(); + EnumType[] emItems = ClientServiceProvider.getOMDService().getEnumService().getEnumTypes("", 0, 0); + AttributeDef[] abs = platformClientUtil.getAttributeService().getAttributeDefsByNames(exceptAbs.toArray(new String[0])); + for(AttributeDef ab : abs){ + OtherInfo otherInfo = OtherInfo.getOtherInfoByText(ab.other); + String enumName = otherInfo.getEnumName(); + if(enumName != null && !enumName.equals("") && !exceptEnums.contains(enumName)){ + exceptEnums.add(enumName); + } + } + for(EnumType em : emItems){ + if(!exceptEnums.contains(em.name)){ + list.add(em); + } + } + } catch (PLException e) { + e.printStackTrace(); + } + return list; + } + + /** + * 鑾峰彇寰呭垹闄ょ殑鐢熷懡鍛ㄦ湡 + * @return + */ + public List<LifeCycle> getDelLCList(){ + List<LifeCycle> list = new ArrayList<LifeCycle>(); + exceptLCs = new ArrayList<String>(); + exceptStates = new ArrayList<String>(); + for(String btName : exceptBts){ + try { + BizType bt = platformClientUtil.getBtmService().getBizTypeByName(btName); + String lcName = bt.lifeCycle; + if(lcName != null && !lcName.equals("") && !exceptLCs.contains(lcName)){ + exceptLCs.add(lcName); + } + } catch (PLException e) { + e.printStackTrace(); + } + } + + LifeCycle[] lcs = null; + try { + lcs = platformClientUtil.getLifeCycleService().getLifeCycles(); + } catch (PLException e) { + e.printStackTrace(); + } + if(lcs != null){ + for(LifeCycle lc : lcs){ + String name = lc.name; + if(name != null && !name.equals("") && !exceptLCs.contains(name)){ + list.add(lc); + }else{ + //淇濈暀鐨勭姸鎬佹睜 + Bound[] bounds = lc.bounds; + for(Bound bound : bounds){ + String sName = bound.name; + exceptStates.add(sName); + } + } + } + } + return list; + } + + /** + * 鑾峰彇寰呭垹闄ょ殑鐘舵�� + * @return + */ + public List<StatePool> getDelSPList(){ + List<StatePool> list = new ArrayList<StatePool>(); + StatePool[] states = null; + try { + states = platformClientUtil.getStatePoolService().getStatePools(); + } catch (PLException e) { + e.printStackTrace(); + } + if(states != null){ + for(StatePool state : states){ + String name = state.name; + if(name != null && !name.equals("") && !exceptStates.contains(name)){ + list.add(state); + } + } + } + return list; + } + + /** + * 鑾峰彇寰呭垹闄ょ殑鐗堟湰瑙勫垯 + * @return + */ + public List<VersionRule> getDelVRList(){ + List<VersionRule> list = new ArrayList<VersionRule>(); + exceptRev = new ArrayList<String>(); + for(String btName : exceptBts){ + try { + BizType bt = platformClientUtil.getBtmService().getBizTypeByName(btName); + String revName = bt.revRuleName; + if(revName != null && !revName.equals("") && !exceptRev.contains(revName)){ + exceptRev.add(revName); + } + } catch (PLException e) { + e.printStackTrace(); + } + } + VersionRule[] revs = null; + try { + revs = platformClientUtil.getVersionService().getVersionRules(); + } catch (PLException e) { + e.printStackTrace(); + } + if(revs != null){ + for(VersionRule rev : revs){ + String name = rev.name; + if(name != null && !name.equals("") && !exceptRev.contains(name)){ + list.add(rev); + } + } + } + return list; + } + + } + } diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsEnumServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsEnumServiceImpl.java index 7628f7e..00c2d6b 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsEnumServiceImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsEnumServiceImpl.java @@ -1,12 +1,15 @@ package com.vci.web.service.impl; import com.alibaba.fastjson.JSON; +import com.vci.client.common.providers.ClientServiceProvider; import com.vci.corba.common.PLException; +import com.vci.corba.omd.atm.AttributeDef; import com.vci.corba.omd.data.BusinessObject; import com.vci.corba.omd.etm.EnumItem; import com.vci.corba.omd.etm.EnumType; import com.vci.dto.OsEnumDTO; import com.vci.dto.OsEnumItemDTO; +import com.vci.omd.objects.OtherInfo; import com.vci.omd.utils.ObjectTool; import com.vci.pagemodel.*; import com.vci.po.OsEnumPO; diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLifeCycleServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLifeCycleServiceImpl.java index a8e5b77..bbf8729 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLifeCycleServiceImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLifeCycleServiceImpl.java @@ -238,6 +238,7 @@ Arrays.stream(bounds).forEach(bound->{ OsLifeCycleLineBoundVO boundVO = new OsLifeCycleLineBoundVO(); boundVO.setId(bound.id); + boundVO.setName(bound.name); boundVO.setCellx(bound.cellx); boundVO.setCelly(bound.celly); boundVO.setCellh(bound.cellh); @@ -299,7 +300,7 @@ lifeCyle.name = lifeCycleVO.getId(); lifeCyle.tag = lifeCycleVO.getName(); lifeCyle.oid = lifeCycleVO.getOid(); - String userId = "developer";//WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); + String userId = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); lifeCyle.creator = Func.isBlank(lifeCycleVO.getCreator()) ? userId:lifeCycleVO.getCreator(); lifeCyle.description = lifeCycleVO.getDescription(); lifeCyle.modifier = Func.isBlank(lifeCycleVO.getLastModifier()) ? userId:lifeCycleVO.getLastModifier(); @@ -863,13 +864,24 @@ group.setStartStatus(po.getStartStatus()); group.setDescription(po.getDescription()); groupPOMap.put(key, group); - + //绗竴琛岃捣濮嬬姸鎬侀渶瑕佸崟鐙鐞� + if(po.getRowIndex().equals("1")){ + OsLifeCycleLineBoundVO boundVO = new OsLifeCycleLineBoundVO(); + boundVO.setName(po.getStartStatus()); + boundVO.setCellh("30.0"); + boundVO.setCellw("80.0"); + boundVO.setCellx(String.valueOf(200+(Integer.parseInt(po.getRowIndex())*60))); + boundVO.setCelly(String.valueOf(300+(Integer.parseInt(po.getRowIndex())*60))); + boundVO.setCellicon(""); + defaultBoundList.add(boundVO); + } //澶勭悊鐢熷懡鍛ㄦ湡鍥炬爣鐨勯粯璁ょ殑鍧愭爣淇℃伅 OsLifeCycleLineBoundVO boundVO = new OsLifeCycleLineBoundVO(); + boundVO.setName(po.getTargetLifeStatus()); boundVO.setCellh("30.0"); boundVO.setCellw("80.0"); - boundVO.setCellx(String.valueOf(200+(Integer.parseInt(po.getRowIndex())*60))); - boundVO.setCelly(String.valueOf(300+(Integer.parseInt(po.getRowIndex())*60))); + boundVO.setCellx(String.valueOf(250+(Integer.parseInt(po.getRowIndex())*60))); + boundVO.setCelly(String.valueOf(350+(Integer.parseInt(po.getRowIndex())*60))); boundVO.setCellicon(""); defaultBoundList.add(boundVO); } diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLinkTypeServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLinkTypeServiceImpl.java index 2c23e3f..bd33e47 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLinkTypeServiceImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLinkTypeServiceImpl.java @@ -988,4 +988,49 @@ return null; } + /** + * 鑾峰彇浣跨敤璇ヤ笟鍔$被鍨嬬殑閾炬帴绫诲瀷鍚� + * @param btmName 涓氬姟绫诲瀷鍚嶇О + * @return + */ + @Override + public List<String> getUsedBtmLinkList(String btmName) { + try { + List<String> list = new ArrayList<String>(); + LinkType[] linkTypes = platformClientUtil.getLinkTypeService().getLinkTypes(); + for(int i = 0; i < linkTypes.length; i++){ + LinkType linkType = linkTypes[i]; + if(this.containsBtm(linkType, btmName)){ + list.add(linkType.name); + } + } + return list; + } catch (PLException e) { + e.printStackTrace(); + } + return null; + } + + /** + * 鎸囧畾鐨勯摼鎺ョ被鍨嬫槸鍚︿娇鐢ㄤ簡鎸囧畾鐨勪笟鍔$被鍨� + * @param link + * @param btmName + * @return + */ + private boolean containsBtm(LinkType link, String btmName){ + String[] btms = link.btmItemsFrom; + for(int i = 0; i < btms.length; i++){ + if(btmName.equalsIgnoreCase(btms[i])){ + return true; + } + } + btms = link.btmItemsTo; + for(int i = 0; i < btms.length; i++){ + if(btmName.equalsIgnoreCase(btms[i])){ + return true; + } + } + return false; + } + } diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBtmIOServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBtmIOServiceImpl.java index c6247b9..6119c1e 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBtmIOServiceImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBtmIOServiceImpl.java @@ -271,7 +271,7 @@ lifeCyle.ts = VciDateUtil.getNowString(VciDateUtil.DateTimeMillFormat); lifeCyle.name = lifeCycleDTO.getId(); }else { - lifeCyle = lifeCycleService.lifeCycleVO2DO( allLifeCycleLowMap.get(lifeCycleId)); + lifeCyle = lifeCycleService.lifeCycleVO2DO(allLifeCycleLowMap.get(lifeCycleId)); edit = true; } lifeCyle.tag = lifeCycleDTO.getName(); -- Gitblit v1.9.3