From 7a61f5f2f29a069cd8947ea46b6b2329ac0f5d44 Mon Sep 17 00:00:00 2001 From: 田源 <lastanimals@163.com> Date: 星期五, 02 八月 2024 12:02:33 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsRevisionRuleServiceImpl.java | 459 ++++++++++++++++ Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsLinkTypePO.java | 108 +++ Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsAttributeServiceI.java | 3 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIDataServiceImpl.java | 2 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsRevisionRuleServiceI.java | 64 ++ Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsStatusServiceI.java | 2 Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsRevisionRuleDTO.java | 112 ++- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsLinkTypeController.java | 30 + Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/VciOsStatusController.java | 2 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBoServiceImpl.java | 2 Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OsRevisionRuleVO.java | 60 +- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsEnumServiceI.java | 3 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsRevisionRuleController.java | 200 +++++++ Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsStatusPO.java | 6 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebEnumController.java | 2 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsLinkTypeServiceI.java | 14 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsEnumServiceImpl.java | 111 ++- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsStatusServiceImpl.java | 72 +- Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsRevisionRulePO.java | 78 ++ Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsAttributeController.java | 2 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java | 98 ++- Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsAttributePO.java | 2 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLinkTypeServiceImpl.java | 210 +++++++ 23 files changed, 1,450 insertions(+), 192 deletions(-) diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsRevisionRuleDTO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsRevisionRuleDTO.java index 7fe59b4..461a6c1 100644 --- a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsRevisionRuleDTO.java +++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsRevisionRuleDTO.java @@ -32,27 +32,27 @@ /** * 璺宠穬瀛楃 */ - private String skipCode; + private String jumpCharacter; /** * 鍒濆鍊� */ - private String startCode; + private String initialValue; /** * 姝ラ暱 */ - private Integer serialStep; + private String stepLength; /** * 鍓嶇紑 */ - private String prefixCode; + private String prefixion; /** * 鍚庣紑 */ - private String suffixCode; + private String suffix; /** * 鎻忚堪 @@ -63,6 +63,58 @@ * 鏃堕棿鎴筹紝鏍煎紡鏄痽yyy-MM-dd HH:mm:ss.SSS */ private Date ts; + + /** + * 鍒涘缓浜� + */ + private String creator; + + /** + * 鍒涘缓鏃堕棿 + */ + private Date createTime; + + /** + * 鏈�鍚庝慨鏀逛汉 + */ + private String lastModifier; + + /** + * 鏈�鍚庝慨鏀规椂闂达紝鏍煎紡鏄痽yyy-MM-dd HH:mm:ss + */ + private Date lastModifyTime; + + 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 String getOid() { return oid; @@ -88,44 +140,44 @@ this.name = name; } - public String getSkipCode() { - return skipCode; + public void setJumpCharacter(String jumpCharacter) { + this.jumpCharacter = jumpCharacter; } - public void setSkipCode(String skipCode) { - this.skipCode = skipCode; + public String getJumpCharacter() { + return jumpCharacter; } - public String getStartCode() { - return startCode; + public String getInitialValue() { + return initialValue; } - public void setStartCode(String startCode) { - this.startCode = startCode; + public void setInitialValue(String initialValue) { + this.initialValue = initialValue; } - public Integer getSerialStep() { - return serialStep; + public void setStepLength(String stepLength) { + this.stepLength = stepLength; } - public void setSerialStep(Integer serialStep) { - this.serialStep = serialStep; + public String getStepLength() { + return stepLength; } - public String getPrefixCode() { - return prefixCode; + public void setPrefixion(String prefixion) { + this.prefixion = prefixion; } - public void setPrefixCode(String prefixCode) { - this.prefixCode = prefixCode; + public String getPrefixion() { + return prefixion; } - public String getSuffixCode() { - return suffixCode; + public void setSuffix(String suffix) { + this.suffix = suffix; } - public void setSuffixCode(String suffixCode) { - this.suffixCode = suffixCode; + public String getSuffix() { + return suffix; } public String getDescription() { @@ -150,11 +202,11 @@ "oid='" + oid + '\'' + ", id='" + id + '\'' + ", name='" + name + '\'' + - ", skipCode='" + skipCode + '\'' + - ", startCode='" + startCode + '\'' + - ", serialStep=" + serialStep + - ", prefixCode='" + prefixCode + '\'' + - ", suffixCode='" + suffixCode + '\'' + + ", jumpCharacter='" + jumpCharacter + '\'' + + ", initialValue='" + initialValue + '\'' + + ", serialStep=" + stepLength + + ", prefixion='" + prefixion + '\'' + + ", suffix='" + suffix + '\'' + ", description='" + description + '\'' + ", ts=" + ts + '}'; diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OsRevisionRuleVO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OsRevisionRuleVO.java index 1144d97..a8d5d67 100644 --- a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OsRevisionRuleVO.java +++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OsRevisionRuleVO.java @@ -32,27 +32,27 @@ /** * 璺宠穬瀛楃 */ - private String skipCode; + private String jumpCharacter; /** * 鍒濆鍊� */ - private String startCode; + private String initialValue; /** * 姝ラ暱 */ - private Integer serialStep; + private Integer stepLength; /** * 鍓嶇紑 */ - private String prefixCode; + private String prefixion; /** * 鍚庣紑 */ - private String suffixCode; + private String suffix; /** * 鎻忚堪 @@ -118,44 +118,44 @@ this.name = name; } - public String getSkipCode() { - return skipCode; + public void setJumpCharacter(String jumpCharacter) { + this.jumpCharacter = jumpCharacter; } - public void setSkipCode(String skipCode) { - this.skipCode = skipCode; + public String getJumpCharacter() { + return jumpCharacter; } - public String getStartCode() { - return startCode; + public void setInitialValue(String initialValue) { + this.initialValue = initialValue; } - public void setStartCode(String startCode) { - this.startCode = startCode; + public String getInitialValue() { + return initialValue; } - public Integer getSerialStep() { - return serialStep; + public Integer getStepLength() { + return stepLength; } - public void setSerialStep(Integer serialStep) { - this.serialStep = serialStep; + public void setStepLength(Integer stepLength) { + this.stepLength = stepLength; } - public String getPrefixCode() { - return prefixCode; + public void setPrefixion(String prefixion) { + this.prefixion = prefixion; } - public void setPrefixCode(String prefixCode) { - this.prefixCode = prefixCode; + public void setSuffix(String suffix) { + this.suffix = suffix; } - public String getSuffixCode() { - return suffixCode; + public String getSuffix() { + return suffix; } - public void setSuffixCode(String suffixCode) { - this.suffixCode = suffixCode; + public String getPrefixion() { + return prefixion; } public String getDescription() { @@ -228,11 +228,11 @@ "oid='" + oid + '\'' + ", id='" + id + '\'' + ", name='" + name + '\'' + - ", skipCode='" + skipCode + '\'' + - ", startCode='" + startCode + '\'' + - ", serialStep=" + serialStep + - ", prefixCode='" + prefixCode + '\'' + - ", suffixCode='" + suffixCode + '\'' + + ", jumpCharacter='" + jumpCharacter + '\'' + + ", initialValue='" + initialValue + '\'' + + ", stepLength=" + stepLength + + ", prefixion='" + prefixion + '\'' + + ", suffix='" + suffix + '\'' + ", description='" + description + '\'' + ", btmname='" + btmname + '\'' + ", owner='" + owner + '\'' + diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsAttributePO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsAttributePO.java index d64806f..7ee9fb7 100644 --- a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsAttributePO.java +++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsAttributePO.java @@ -52,7 +52,7 @@ /** * 灞炴�х被鍨� */ - @ExcelColumn(value="灞炴�х被鍨�(璇峰弬鐓ф柊澧炵晫闈㈢殑灞炴�х被鍨嬪~鍐�)",nullable = false) + @ExcelColumn(value="灞炴�х被鍨�(鍙傜収鏂板鐣岄潰鐨勫睘鎬х被鍨嬪VTString)",nullable = false) private String attributeDataType; /** diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsLinkTypePO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsLinkTypePO.java new file mode 100644 index 0000000..b161c8d --- /dev/null +++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsLinkTypePO.java @@ -0,0 +1,108 @@ +package com.vci.po; + +import com.vci.starter.poi.annotation.ExcelColumn; +import com.vci.starter.web.pagemodel.BaseModelVO; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 閾炬帴绫诲瀷瀵煎叆瀵硅薄 + * @author yuxc + * @date 2024/7/30 16:27 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class OsLinkTypePO extends BaseModelVO { + + /** + * 绂佹淇敼杩欎釜鍊� + */ + private static final long serialVersionUID = -2239512786206928201L; + + /** + * 鎵�鍦ㄦ暟鎹 + */ + @ExcelColumn(rowIndexColumn = true,value = "") + private String rowIndex; + + /** + * 鏍囩 + */ + @ExcelColumn(value="鏍囩",nullable = false) + private String tag; + + /** + * 鍚嶇О + */ + @ExcelColumn(value="鍚嶇О",nullable = false) + private String name; + + /** + * 鎻忚堪 + */ + @ExcelColumn(value="鎻忚堪") + private String description; + + /** + * 褰㈢姸 + */ + @ExcelColumn(value="褰㈢姸") + private String shape; + + /** + * to绔搴斿叧绯� + */ + @ExcelColumn(value="To绔搴斿叧绯�") + private String relationTo; + + /** + * From绔搴斿叧绯� + */ + @ExcelColumn(value="From绔搴斿叧绯�") + private String relationFrom; + +// /** +// * 瀵瑰簲鍏崇郴锛宖rom绔湪鍓嶏紝to绔湪鍚� +// */ +// @ExcelColumn(value="瀵瑰簲鍏崇郴锛宖rom绔湪鍓嶏紝to绔湪鍚�") +// private String relation; + + /** + * To绔富绫诲瀷 + */ + @ExcelColumn(value="To绔富绫诲瀷") + private String primitivesTo; + + /** + * From绔富绫诲瀷 + */ + @ExcelColumn(value="From绔富绫诲瀷") + private String primitivesFrom; + + /** + * 瀹炵幇绫� + */ + @ExcelColumn(value="瀹炵幇绫�") + private String implClass; + + /** + * From绔被鍨嬪垪琛� + */ + @ExcelColumn(value="From绔被鍨嬪垪琛�") + private String btmItemsFrom; + + /** + * To绔被鍨嬪垪琛� + */ + @ExcelColumn(value="To绔被鍨嬪垪琛�") + private String btmItemsTo; + + /** + * 灞炴�у垪琛� + */ + @ExcelColumn(value="灞炴�у垪琛�") + private String attributes; + +} diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsRevisionRulePO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsRevisionRulePO.java new file mode 100644 index 0000000..3b628cf --- /dev/null +++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsRevisionRulePO.java @@ -0,0 +1,78 @@ +package com.vci.po; + +import com.vci.starter.poi.annotation.ExcelColumn; +import com.vci.starter.web.pagemodel.BaseModelVO; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 灞炴�ф睜瀵煎叆瀵硅薄 + * @author ludc + * @date 2024/7/19 11:11 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class OsRevisionRulePO extends BaseModelVO { + + /** + * 绂佹淇敼杩欎釜鍊� + */ + private static final long serialVersionUID = -2239512786206928201L; + + /** + * 鎵�鍦ㄦ暟鎹 + */ + @ExcelColumn(rowIndexColumn = true,value = "") + private String rowIndex; + + /** + * 灞炴�ц嫳鏂囧悕绉� + */ + @ExcelColumn(value="鍚嶇О",nullable = false) + private String id; + + /** + * 鏍囩 + */ + @ExcelColumn(value="鏍囩") + private String name; + + /** + * 璺宠穬瀛楃 + */ + @ExcelColumn(value="璺宠穬瀛楃") + private String jumpCharacter; + + /** + * 鍒濆鍊� + */ + @ExcelColumn(value="鍒濆鍊�",nullable = false) + private String initialValue; + + /** + * 姝ラ暱 + */ + @ExcelColumn(value="姝ラ暱",nullable = false) + private String stepLength; + + /** + * 鍓嶇紑 + */ + @ExcelColumn(value="鍓嶇紑") + private String prefixion; + + /** + * 鍚庣紑 + */ + @ExcelColumn(value="鍚庣紑") + private String suffix; + + /** + * 鎻忚堪 + */ + @ExcelColumn(value="鎻忚堪") + private String description; + +} diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsStatusPO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsStatusPO.java index c443178..8896d9b 100644 --- a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsStatusPO.java +++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsStatusPO.java @@ -7,7 +7,7 @@ import lombok.NoArgsConstructor; /** - * 灞炴�ф睜瀵煎叆瀵硅薄 + * 鐘舵�佹睜瀵煎叆瀵硅薄 * @author ludc * @date 2024/7/19 11:11 */ @@ -42,8 +42,8 @@ /** * 灞炴�х被鍨� */ - @ExcelColumn(value="鍥剧墖(璺緞)") - private String imagePath; + //@ExcelColumn(value="鍥剧墖(璺緞)") + //private String imagePath; /** * 鎻忚堪 diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsAttributeController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsAttributeController.java index adf0e3e..ae35b5d 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsAttributeController.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsAttributeController.java @@ -164,7 +164,7 @@ @VciBusinessLog(operateName = "瀵煎嚭灞炴��") public void exportAttributes(String exportFileName,String attrNames, HttpServletResponse response){ try { - String excelPath = attributeService.exportAttributes(exportFileName,attrNames); + String excelPath = attributeService.exportAttributes(exportFileName,attrNames,false); ControllerUtil.writeFileToResponse(response,excelPath); } catch (Exception e) { String msg = "瀵煎嚭鏋氫妇鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e); 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 5d9a344..eededfb 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,14 +1,17 @@ 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.starter.web.util.LocalFileUtil; import com.vci.starter.web.util.VciBaseUtil; import com.vci.web.service.OsLinkTypeServiceI; import org.apache.commons.lang3.StringUtils; @@ -17,7 +20,10 @@ 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.HashMap; @@ -227,4 +233,28 @@ 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") + @VciUnCheckRight + public BaseResult impData(MultipartFile file){try { + return linkTypeService.impData(file); + }catch (Throwable e) { + throw new VciBaseException(VciBaseUtil.getExceptionMessage(e),new String[0],e); + } + } } diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsRevisionRuleController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsRevisionRuleController.java new file mode 100644 index 0000000..7b4c389 --- /dev/null +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsRevisionRuleController.java @@ -0,0 +1,200 @@ +package com.vci.web.controller; + +import com.vci.constant.FrameWorkLangCodeConstant; +import com.vci.dto.OsRevisionRuleDTO; +import com.vci.pagemodel.OsRevisionRuleVO; +import com.vci.starter.web.annotation.controller.VciUnCheckRight; +import com.vci.starter.web.annotation.log.VciBusinessLog; +import com.vci.starter.web.exception.VciBaseException; +import com.vci.starter.web.pagemodel.BaseResult; +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.OsRevisionRuleServiceI; +import com.vci.web.util.Func; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +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.Date; +import java.util.List; + +/** + * 鐗堟湰瑙勫垯鎺у埗鍣� + * @author ludc + * @date 2024/7/30 16:02 + */ +@RequestMapping("/revisionRuleController") +@RestController +public class OsRevisionRuleController { + + @Autowired + private OsRevisionRuleServiceI revisionRuleServiceI; + + /** + * 鏃ュ織 + */ + private Logger logger = LoggerFactory.getLogger(getClass()); + + /** + * 鐗堟湰瑙勫垯鍒楄〃(鍏ㄦ煡璇�) + * @return + */ + @GetMapping("/getVersionRuleAllList") + public BaseResult getVersionRuleAllList(){ + try { + return BaseResult.dataList(revisionRuleServiceI.selectAllRevision()); + }catch (Exception e) { + e.printStackTrace(); + String exceptionMessage = "鐗堟湰瑙勫垯绠$悊鍒楄〃鏌ヨ鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e); + logger.error(exceptionMessage); + return BaseResult.fail(exceptionMessage); + } + } + + /** + * 鏌ヨ搴旂敤鑼冨洿 + * @param vrName 鐗堟湰瑙勫垯鑻辨枃鍚嶇О + * @return + */ + @GetMapping("/getUsedVersionRuleList") + public BaseResult getUsedVersionRuleList(String vrName){ + try { + return BaseResult.dataList(revisionRuleServiceI.getUsedVersionRuleList(vrName)); + }catch (Exception e) { + e.printStackTrace(); + String exceptionMessage = "鐗堟湰瑙勫垯搴旂敤鑼冨洿鏌ヨ鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e); + logger.error(exceptionMessage); + return BaseResult.fail(exceptionMessage); + } + } + + /** + * 鍒涘缓鐗堟湰瑙勫垯 + * @param osRevisionRuleDTO 鐗堟湰瑙勫垯鏁版嵁浼犺緭瀵硅薄 + * @return + */ + @PostMapping("/addVersionRule") + public BaseResult addVersionRule(@RequestBody OsRevisionRuleDTO osRevisionRuleDTO){ + try { + return revisionRuleServiceI.addVersionRule(osRevisionRuleDTO) ? BaseResult.success("鐗堟湰瑙勫垯娣诲姞鎴愬姛锛�"):BaseResult.fail("鐗堟湰瑙勫垯娣诲姞澶辫触锛�"); + }catch (Exception e) { + e.printStackTrace(); + String exceptionMessage = "澧炲姞灞炴�ф椂鍑虹幇閿欒锛屽師鍥狅細" + VciBaseUtil.getExceptionMessage(e); + logger.error(exceptionMessage); + return BaseResult.fail(exceptionMessage); + } + } + + /** + * 淇敼鐗堟湰瑙勫垯 + * @param osRevisionRuleDTO 鐗堟湰瑙勫垯鏁版嵁浼犺緭瀵硅薄 + * @return + */ + @PutMapping("/updateVersionRule") + public BaseResult updateVersionRule(@RequestBody OsRevisionRuleDTO osRevisionRuleDTO){ + try { + return revisionRuleServiceI.updateVersionRule(osRevisionRuleDTO) ? BaseResult.success("鐗堟湰瑙勫垯淇敼鎴愬姛锛�"):BaseResult.fail("鐗堟湰瑙勫垯淇敼澶辫触锛�"); + }catch (Exception e) { + e.printStackTrace(); + String exceptionMessage = "淇敼鐗堟湰瑙勫垯鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e); + logger.error(exceptionMessage); + return BaseResult.fail(exceptionMessage); + } + } + + /** + * 鍒犻櫎鐗堟湰瑙勫垯 + * @param osRevisionRuleDTOS 鐗堟湰瑙勫垯鏁版嵁浼犺緭瀵硅薄 + * @return + */ + @DeleteMapping("/deleteVersionRule") + public BaseResult deleteVersionRule(@RequestBody List<OsRevisionRuleDTO> osRevisionRuleDTOS){ + try { + return revisionRuleServiceI.deleteVersionRule(osRevisionRuleDTOS) ? BaseResult.success("鐗堟湰瑙勫垯鍒犻櫎鎴愬姛锛�"):BaseResult.fail("鐗堟湰瑙勫垯鍒犻櫎澶辫触锛�"); + }catch (Exception e) { + e.printStackTrace(); + String exceptionMessage = "鍒犻櫎鐗堟湰瑙勫垯鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e); + logger.error(exceptionMessage); + return BaseResult.fail(exceptionMessage); + } + } + + /** + * 瀵煎嚭閫変腑鐨勭増鏈鍒� + * @param exportFileName 瀵煎嚭鐨勬枃浠跺悕 + * @param vrNames 闇�瑕佸鍑虹殑瑙勫垯鑻辨枃鍚嶇О + * @param response + */ + @GetMapping( "/exportVersionRule") + @VciBusinessLog(operateName = "瀵煎嚭鐗堟湰瑙勫垯") + public void exportVersionRule(String exportFileName,String vrNames, HttpServletResponse response){ + try { + String excelPath = revisionRuleServiceI.exportVersionRule(exportFileName,vrNames,false); + ControllerUtil.writeFileToResponse(response,excelPath); + } 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 exportFileName + * @param response + */ + @GetMapping( "/downloadAttributeTemplate") + @VciBusinessLog(operateName = "瀵煎嚭鐗堟湰瑙勫垯") + public void downloadVersionRuleTemplate(String exportFileName, HttpServletResponse response){ + try { + String excelPath = revisionRuleServiceI.downloadVersionRuleTemplate(exportFileName); + ControllerUtil.writeFileToResponse(response,excelPath); + } 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("/importVersionRules") + @VciBusinessLog(operateName = "瀵煎叆鐗堟湰瑙勫垯") + public BaseResult importVersionRules(MultipartFile file){ + String excelFileName = LocalFileUtil.getDefaultTempFolder() + File.separator + LocalFileUtil.getFileNameForIE(file.getOriginalFilename()); + File file1 = new File(excelFileName); + try { + file.transferTo(new File(excelFileName)); + if (file != null) { + return revisionRuleServiceI.importVersionRules(file1); + } else { + return BaseResult.fail(FrameWorkLangCodeConstant.IMPORT_FAIL, new String[]{"鏃犲鍏ョ殑鏂囦欢"}); + } + }catch (Throwable e) { + throw new VciBaseException(VciBaseUtil.getExceptionMessage(e),new String[0],e); + }finally { + file1.delete(); + } + } + +} diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/VciOsStatusController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/VciOsStatusController.java index 2371ba8..31076f5 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/VciOsStatusController.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/VciOsStatusController.java @@ -165,7 +165,7 @@ @VciBusinessLog(operateName = "瀵煎嚭鐘舵��") public void exportStatus(String exportFileName,String statusOids, HttpServletResponse response){ try { - String excelPath = statusService.exportStatus(exportFileName,statusOids); + String excelPath = statusService.exportStatus(exportFileName,statusOids,true); ControllerUtil.writeFileToResponse(response,excelPath); } catch (Exception e) { String msg = "瀵煎嚭鐘舵�佹椂鍑虹幇閿欒锛屽師鍥狅細" + VciBaseUtil.getExceptionMessage(e); diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebEnumController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebEnumController.java index a8048f4..971c715 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebEnumController.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebEnumController.java @@ -216,7 +216,7 @@ @VciBusinessLog(operateName = "瀵煎嚭鏋氫妇绫诲瀷") public void exportEnumTypes(String exportFileName,String enumNames, HttpServletResponse response){ try { - String excelPath = enumService.exportEnumTypes(exportFileName,enumNames); + String excelPath = enumService.exportEnumTypes(exportFileName,enumNames,false); ControllerUtil.writeFileToResponse(response,excelPath); } catch (Exception e) { String msg = "瀵煎嚭鏋氫妇鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e); diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsAttributeServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsAttributeServiceI.java index b1e782f..2f45519 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsAttributeServiceI.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsAttributeServiceI.java @@ -150,9 +150,10 @@ * 瀵煎嚭閫変腑鐨勫睘鎬� * @param exportFileName 瀵煎嚭鐨勬枃浠跺悕 * @param attrNames 闇�瑕佸鍑虹殑灞炴�у悕绉� + * @param flag 鎺у埗瀵煎嚭鐨勫垪鍚嶆槸鍚﹀拰瀵煎叆妯℃澘涓�鑷� * @return */ - String exportAttributes(String exportFileName,String attrNames) throws PLException; + String exportAttributes(String exportFileName,String attrNames,boolean flag/*鎺у埗瀵煎嚭鐨勫垪鍚嶆槸鍚﹀拰瀵煎叆妯℃澘涓�鑷�*/) throws PLException; /** * 涓嬭浇灞炴�у鍏ユā鏉� diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsEnumServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsEnumServiceI.java index 7d53a23..3c19f39 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsEnumServiceI.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsEnumServiceI.java @@ -110,9 +110,10 @@ * 瀵煎嚭鏋氫妇绫诲瀷 * @param exportFileName 瀵煎嚭鐨勬枃浠跺悕 * @param enumNames 闇�瑕佸鍑虹殑鏋氫妇鍚嶇О + * @param flag 鎺у埗瀵煎嚭鐨勫垪鍚嶆槸鍚﹀拰瀵煎叆妯℃澘涓�鑷� * @return */ - String exportEnumTypes(String exportFileName,String enumNames) throws PLException; + String exportEnumTypes(String exportFileName,String enumNames,boolean flag/*鎺у埗瀵煎嚭鐨勫垪鍚嶆槸鍚﹀拰瀵煎叆妯℃澘涓�鑷�*/) throws PLException; /** * 瀵煎叆鏋氫妇 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 0fae7cb..d81d452 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 @@ -8,7 +8,9 @@ import com.vci.pagemodel.OsBtmTypeAttributeVO; import com.vci.pagemodel.OsLinkTypeAttributeVO; import com.vci.pagemodel.OsLinkTypeVO; +import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.Collection; import java.util.List; @@ -145,4 +147,16 @@ * @return 鍒涘缓缁撴灉 */ BaseResult createView() throws PLException; + /** + * 瀵煎嚭閾炬帴绫诲瀷 + * name 閾炬帴绫诲瀷鍚嶇О + * @return 鍒涘缓缁撴灉 + */ + void expData(String oid, HttpServletResponse response) throws PLException, IOException; + /** + * 瀵煎叆閾炬帴绫诲瀷 + * @param file 涓婁紶鐨勬枃浠� + * @return + */ + BaseResult impData(MultipartFile file) throws Exception; } diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsRevisionRuleServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsRevisionRuleServiceI.java index b32a874..c301a49 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsRevisionRuleServiceI.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsRevisionRuleServiceI.java @@ -1,8 +1,12 @@ package com.vci.web.service; +import com.vci.corba.common.PLException; import com.vci.corba.omd.vrm.VersionRule; +import com.vci.dto.OsRevisionRuleDTO; import com.vci.pagemodel.OsRevisionRuleVO; +import com.vci.starter.web.pagemodel.BaseResult; +import java.io.File; import java.util.Collection; import java.util.List; import java.util.Map; @@ -27,6 +31,27 @@ Map<String,OsRevisionRuleVO> selectAllRevisionMap(); /** + * 鍒涘缓鐗堟湰瑙勫垯 + * @param osRevisionRuleDTO + * @return + */ + boolean addVersionRule(OsRevisionRuleDTO osRevisionRuleDTO) throws PLException; + + /** + * 淇敼鐗堟湰瑙勫垯 + * @param osRevisionRuleDTO + * @return + */ + boolean updateVersionRule(OsRevisionRuleDTO osRevisionRuleDTO) throws PLException; + + /** + * 鍒犻櫎鐗堟湰瑙勫垯 + * @param osRevisionRuleDTOS + * @return + */ + boolean deleteVersionRule(List<OsRevisionRuleDTO> osRevisionRuleDTOS) throws PLException; + + /** * 鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞� * @param versionRules 鏁版嵁瀵硅薄 * @return 鏄剧ず瀵硅薄 @@ -46,4 +71,43 @@ * @return 鏄剧ず瀵硅薄 */ OsRevisionRuleVO getRevisionRuleById(String id); + + /** + * 浣跨敤澶氫釜缂栧彿鑾峰彇瑙勫垯鐨勫�� + * @param vrIdList 缂栧彿 + * @return 鏄剧ず瀵硅薄 + */ + List<OsRevisionRuleVO> getRevisionRuleByIds(Collection<String> vrIdList); + + /** + * 鏌ヨ搴旂敤鑼冨洿 + * @param vrName 鐗堟湰瑙勫垯鑻辨枃鍚嶇О + * @return + */ + List<Map<String, String>> getUsedVersionRuleList(String vrName) throws PLException; + + /** + * 瀵煎嚭閫変腑鐨勭増鏈鍒� + * @param exportFileName 瀵煎嚭鐨勬枃浠跺悕 + * @param vrNames 闇�瑕佸鍑虹殑鐗堟湰瑙勫垯鍚嶇О + * @param flag 鎺у埗瀵煎嚭鐨勫垪鍚嶆槸鍚﹀拰瀵煎叆妯℃澘涓�鑷� + * @return + */ + String exportVersionRule(String exportFileName,String vrNames,boolean flag/*鎺у埗瀵煎嚭鐨勫垪鍚嶆槸鍚﹀拰瀵煎叆妯℃澘涓�鑷�*/) throws PLException; + + /** + * 涓嬭浇鐗堟湰瑙勫垯瀵煎叆妯℃澘 + * @param exportFileName + * @return + * @throws PLException + */ + String downloadVersionRuleTemplate(String exportFileName) throws Exception; + + /** + * 瀵煎叆鐗堟湰瑙勫垯 + * @param file + * @return + */ + BaseResult importVersionRules(File file) throws Exception; + } diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsStatusServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsStatusServiceI.java index 4b1b4a7..f003a48 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsStatusServiceI.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsStatusServiceI.java @@ -118,7 +118,7 @@ * @param statusOids 闇�瑕佸鍑虹殑灞炴�у悕绉� * @return */ - String exportStatus(String exportFileName,String statusOids) throws PLException; + String exportStatus(String exportFileName,String statusOids,boolean flag/*鎺у埗瀵煎嚭鐨勫垪鍚嶆槸鍚﹀拰瀵煎叆妯℃澘涓�鑷�*/) throws PLException; /** * 涓嬭浇鐘舵�佸鍏ユā鏉� diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java index 8b6c442..3af2c48 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java @@ -7,6 +7,7 @@ import com.vci.client.mw.ClientSessionUtility; import com.vci.corba.common.PLException; import com.vci.corba.omd.atm.AttributeDef; +import com.vci.corba.omd.vrm.VersionRule; import com.vci.dto.OsAttributeDTO; import com.vci.dto.OsEnumDTO; import com.vci.dto.OsEnumItemDTO; @@ -206,14 +207,10 @@ public List<OsAttributeVO> getByAttributeNames(String[] attrNames) throws PLException { VciBaseUtil.alertNotNull(attrNames,"灞炴�у悕"); List<OsAttributeVO> osAttributeVOS = new ArrayList<>(); - for (int i = 0; i < attrNames.length; i++) { - AttributeDef[] attributeDefs = platformClientUtil.getAttributeService().getAttributeDefs(attrNames[i].toLowerCase(Locale.ROOT),1,1); - if(Func.isNotEmpty(attributeDefs)){ - Arrays.stream(attributeDefs).forEach(attributeDef -> { - osAttributeVOS.add(attributeDO2VO(attributeDef)); - }); - } - } + AttributeDef[] attributeDefs = platformClientUtil.getAttributeService().getAttributeDefsByNames(attrNames); + Arrays.stream(attributeDefs).forEach(attr->{ + osAttributeVOS.add(attributeDO2VO(attr)); + }); return osAttributeVOS; } @@ -484,8 +481,7 @@ checkName(osAttributeDTO.getId()); //妫�鏌ラ粯璁ゅ�间笌灞炴�х被鍨嬫槸鍚﹀尮閰� checkDefValue(osAttributeDTO); - //dto瀵硅薄杞崲涓哄瓨鍌ㄦ墍闇�瀵硅薄 - osAttributeDTO.setOid(VciBaseUtil.getPk().toUpperCase(Locale.ROOT)); + //osAttributeDTO.setOid(VciBaseUtil.getPk().toUpperCase(Locale.ROOT)); AttributeDef attributeDef = this.osAttributeDTO2AttributeDef(osAttributeDTO); return platformClientUtil.getAttributeService().addAttributeDef(attributeDef); } @@ -698,7 +694,7 @@ } //妫�鏌ュ睘鎬у悕鏄惁宸插瓨鍦ㄤ笌绯荤粺涓� if(platformClientUtil.getAttributeService().checkRowIsExists(abName)){ - throw new PLException("500",new String[]{"灞炴�у悕绉板湪绯荤粺涓凡瀛樺湪!"}); + throw new PLException("500",new String[]{"灞炴�у悕绉般��" + abName + "銆戝湪绯荤粺涓凡瀛樺湪!"}); } } @@ -866,22 +862,18 @@ * 瀵煎嚭閫変腑鐨勫睘鎬� * @param exportFileName 瀵煎嚭鐨勬枃浠跺悕 * @param attrNames 闇�瑕佸鍑虹殑灞炴�у悕绉� + * @param flag 鎺у埗瀵煎嚭鐨勫垪鍚嶆槸鍚﹀拰瀵煎叆妯℃澘涓�鑷� * @return */ @Override - public String exportAttributes(String exportFileName, String attrNames) throws PLException { + public String exportAttributes(String exportFileName, String attrNames,boolean flag/*鎺у埗瀵煎嚭鐨勫垪鍚嶆槸鍚﹀拰瀵煎叆妯℃澘涓�鑷�*/) throws PLException { if(Func.isBlank(attrNames)){ throw new PLException("500",new String[]{"璇峰嬀閫夎瀵煎嚭鐨勫睘鎬�!"}); } //鐣岄潰娌′紶鍚嶇О锛屼娇鐢ㄩ粯璁ゅ鍑哄悕绉� exportFileName = Func.isBlank(exportFileName) ? "灞炴�ф睜涓睘鎬у鍑篲" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName; //璁剧疆鍒楀悕 - List<String> columns = new ArrayList<>( - Arrays.asList("灞炴�у悕", "鏍囩", "鎻忚堪", - "灞炴�х被鍨�", "鍏佽涓虹┖", "榛樿鍊�", "浣跨敤鐨勬灇涓捐嫳鏂囧悕绉�(鏋氫妇鍚�)", - "浣跨敤鐨勬灇涓句腑鏂囧悕绉�(鏍囩)", "鍙傜収鐨勪笟鍔$被鍨嬬紪鍙�", "鍙傜収鐨勪笟鍔$被鍨嬪悕绉�", - "鍙傜収鐨勯摼鎺ョ被鍨嬪悕绉�","鐗堟湰鐗堟","灞炴�ч暱搴�", "灏忔暟绮惧害浣嶆暟","灏忔暟鍒诲害浣嶆暟","鍙栧�艰寖鍥�","鍒涘缓鏃堕棿") - ); + List<String> columns = this.getCloumns(flag); //鍐檈xcel String excelPath = LocalFileUtil.getDefaultTempFolder() + File.separator + exportFileName + ".xls"; @@ -897,8 +889,8 @@ excelDataList.add(new WriteExcelData(0,index, columns.get(index))); } //鎸夌収灞炴�у悕鏌ヨ灞炴�э紝鐒跺悗澶勭悊灞炴�у鍑� - List<String> enumNameList = Func.toStrList(attrNames); - List<OsAttributeVO> osAttributeVOS = this.listAttrByIds(enumNameList); + List<String> attrameList = Func.toStrList(attrNames); + List<OsAttributeVO> osAttributeVOS = this.listAttrByIds(attrameList); if(Func.isEmpty(osAttributeVOS)){ excelDataList.add(new WriteExcelData(1,1, "鏍规嵁灞炴�у悕绉版湭鏌ヨ鍒板睘鎬т俊鎭紝璇峰埛鏂板悗灏濊瘯閲嶆柊瀵煎嚭锛�")); }else{ @@ -909,25 +901,54 @@ excelDataList.add(new WriteExcelData(i+1,0, osAttributeVO.getId())); excelDataList.add(new WriteExcelData(i+1,1, osAttributeVO.getName())); excelDataList.add(new WriteExcelData(i+1,2, osAttributeVO.getDescription())); - excelDataList.add(new WriteExcelData(i+1,3, osAttributeVO.getAttributeDataTypeText()+"("+osAttributeVO.getAttributeDataType()+")")); + if(flag){ + excelDataList.add(new WriteExcelData(i+1,3, osAttributeVO.getAttributeDataType())); + }else{ + excelDataList.add(new WriteExcelData(i+1,3, osAttributeVO.getAttributeDataType()+"("+osAttributeVO.getAttributeDataTypeText()+")")); + } excelDataList.add(new WriteExcelData(i+1,4, osAttributeVO.isNullableFlag())); excelDataList.add(new WriteExcelData(i+1,5, osAttributeVO.getDefaultValue())); excelDataList.add(new WriteExcelData(i+1,6, osAttributeVO.getEnumId())); - excelDataList.add(new WriteExcelData(i+1,7, osAttributeVO.getEnumName())); - excelDataList.add(new WriteExcelData(i+1,8, osAttributeVO.getBtmTypeId())); - excelDataList.add(new WriteExcelData(i+1,9, osAttributeVO.getBtmTypeName())); - excelDataList.add(new WriteExcelData(i+1,10, osAttributeVO.getAttrLength())); - excelDataList.add(new WriteExcelData(i+1,11, osAttributeVO.getLinkTypeName())); - excelDataList.add(new WriteExcelData(i+1,12, osAttributeVO.getVersion())); - excelDataList.add(new WriteExcelData(i+1,13, osAttributeVO.getPrecisionLength())); - excelDataList.add(new WriteExcelData(i+1,14, osAttributeVO.getScaleLength())); - excelDataList.add(new WriteExcelData(i+1,15, osAttributeVO.getRange())); - excelDataList.add(new WriteExcelData(i+1,16, osAttributeVO.getCreateTime())); + //excelDataList.add(new WriteExcelData(i+1,7, osAttributeVO.getEnumName())); + excelDataList.add(new WriteExcelData(i+1,7, osAttributeVO.getBtmTypeId())); + //excelDataList.add(new WriteExcelData(i+1,9, osAttributeVO.getBtmTypeName())); + excelDataList.add(new WriteExcelData(i+1,8, osAttributeVO.getAttrLength())); + excelDataList.add(new WriteExcelData(i+1,9, osAttributeVO.getLinkTypeName())); + excelDataList.add(new WriteExcelData(i+1,10, osAttributeVO.getVersion())); + excelDataList.add(new WriteExcelData(i+1,11, osAttributeVO.getPrecisionLength())); + excelDataList.add(new WriteExcelData(i+1,12, osAttributeVO.getScaleLength())); + excelDataList.add(new WriteExcelData(i+1,13, osAttributeVO.getRange())); + if(!flag){ + excelDataList.add(new WriteExcelData(i+1,14, Func.format(osAttributeVO.getCreateTime(),"yyyy骞碝M鏈坉d鏃� hh:mm:ss"))); + } } } WriteExcelOption excelOption = new WriteExcelOption(excelDataList); ExcelUtil.writeDataToFile(excelPath, excelOption); return excelPath; + } + + /** + * 鑾峰彇瀵煎嚭鎴栧鍏ユā鏉跨殑鍒楀悕 + * @param flag 鏄惁鑾峰彇瀵煎叆妯℃澘鍒楀悕 + * @return + */ + private List<String> getCloumns(boolean flag){ + if(flag){ + return new ArrayList<>( + Arrays.asList("灞炴�у悕", "鏍囩", "鎻忚堪", + "灞炴�х被鍨�(鍙傜収鏂板鐣岄潰鐨勫睘鎬х被鍨嬪VTString)", "鍏佽涓虹┖(鏄�/鍚�)", "榛樿鍊�", "浣跨敤鐨勬灇涓捐嫳鏂囧悕绉�" + , "鍙傜収鐨勪笟鍔$被鍨嬬紪鍙�","鍙傜収鐨勯摼鎺ョ被鍨嬬紪鍙�","鐗堟湰鐗堟","灞炴�ч暱搴�", "灏忔暟绮惧害浣嶆暟","灏忔暟鍒诲害浣嶆暟" + ,"鍙栧�艰寖鍥�" + ) + ); + } + return new ArrayList<>( + Arrays.asList("灞炴�у悕", "鏍囩", "鎻忚堪", + "灞炴�х被鍨�", "鍏佽涓虹┖", "榛樿鍊�", "浣跨敤鐨勬灇涓捐嫳鏂囧悕绉�(鏋氫妇鍚�)", + "鍙傜収鐨勪笟鍔$被鍨嬬紪鍙�", "鍙傜収鐨勯摼鎺ョ被鍨嬬紪鍙�","鐗堟湰鐗堟","灞炴�ч暱搴�", + "灏忔暟绮惧害浣嶆暟","灏忔暟鍒诲害浣嶆暟","鍙栧�艰寖鍥�","鍒涘缓鏃堕棿") + ); } /** @@ -941,11 +962,7 @@ //鐣岄潰娌′紶鍚嶇О锛屼娇鐢ㄩ粯璁ゅ鍑哄悕绉� exportFileName = Func.isBlank(exportFileName) ? "灞炴�ф睜瀵煎叆妯℃澘_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName; //璁剧疆鍒楀悕 - List<String> columns = new ArrayList<>( - Arrays.asList("灞炴�у悕", "鏍囩", "鎻忚堪", - "灞炴�х被鍨�(璇峰弬鐓ф柊澧炵晫闈㈢殑灞炴�х被鍨嬪~鍐�)", "鍏佽涓虹┖(鏄�/鍚�)", "榛樿鍊�", "浣跨敤鐨勬灇涓捐嫳鏂囧悕绉�", "鍙傜収鐨勪笟鍔$被鍨嬬紪鍙�", - "鍙傜収鐨勯摼鎺ョ被鍨嬬紪鍙�","鐗堟湰鐗堟","灞炴�ч暱搴�", "灏忔暟绮惧害浣嶆暟","灏忔暟鍒诲害浣嶆暟","鍙栧�艰寖鍥�") - ); + List<String> columns = this.getCloumns(true); //璁剧疆蹇呭~鍒� ColumnNameisRed.clear(); ColumnNameisRed.add(0); @@ -1000,10 +1017,9 @@ List<OsAttributeDTO> dtoList = new ArrayList<>(); //褰撳墠excel涓槸鍚﹂噸澶嶇敤鐨勫垽閲峂ap:锛坘ey锛氬垽閲嶅睘鎬э紝value锛氳鍙凤級 Map<String, String> excelReapeat = new HashMap<>(); - //鍒ゆ柇蹇呭~灞炴�ф槸鍚︿负绌猴紝鐢ㄦ埛鏄惁宸插瓨鍦紝浠ュ強閮ㄩ棬鏄惁濉敊绛夋牎楠岄�昏緫 poList.stream().forEach(osAttributePO -> { if(Func.isBlank(osAttributePO.getId())){//灞炴�у悕鍒ょ┖ - throw new VciBaseException("绗��"+osAttributePO.getRowIndex()+"銆戣锛宔numnameerror"); + throw new VciBaseException("绗��"+osAttributePO.getRowIndex()+"銆戣锛宎ttrnameerror"); }else if(Func.isBlank(osAttributePO.getAttributeDataType())){ throw new VciBaseException("绗��"+osAttributePO.getRowIndex()+"銆戣锛宼ypeerror"); }else if(excelReapeat.containsKey(osAttributePO.getId())){//灞炴�у悕琛ㄦ牸涓垽閲� @@ -1019,7 +1035,7 @@ //灞炴�у悕excel涓垽閲嶅鐞� excelReapeat.put(osAttributePO.getId(),osAttributePO.getRowIndex()); OsAttributeDTO osAttributeDTO = new OsAttributeDTO(); - //鏌ヨ鏋氫妇鏄惁瀛樺湪锛屽~鍐欎簡鏋氫妇浣嗘病濉啓鍙栧�艰寖鍥达紝杩欐椂鍊欑洿鎺ヤ娇鐢ㄦ灇涓鹃」鍊间綔涓洪粯璁ょ殑range + //鏌ヨ灞炴�ф槸鍚﹀瓨鍦紝濉啓浜嗘灇涓句絾娌″~鍐欏彇鍊艰寖鍥达紝杩欐椂鍊欑洿鎺ヤ娇鐢ㄦ灇涓鹃」鍊间綔涓洪粯璁ょ殑range if(Func.isNotBlank(osAttributePO.getEnumId()) && Func.isBlank(osAttributePO.getRange())){ try { OsEnumVO enumVO = enumService.getEnumTypeById(osAttributePO.getEnumId()); @@ -1057,7 +1073,7 @@ checkDefValue(osAttributeDTO); } catch (PLException e) { e.printStackTrace(); - throw new VciBaseException(e.getMessage()); + throw new VciBaseException(VciBaseUtil.getExceptionMessage(e)); } dtoList.add(osAttributeDTO); }); @@ -1080,7 +1096,7 @@ e.printStackTrace(); return BaseResult.fail(VciBaseUtil.getExceptionMessage(e),new String[]{},e); } - return BaseResult.success("鏋氫妇瀵煎叆鎴愬姛锛�"); + return BaseResult.success("灞炴�у鍏ユ垚鍔燂紒"); } /** 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 1a59db5..c76ea0b 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 @@ -385,14 +385,14 @@ * @return */ @Override - public String exportEnumTypes(String exportFileName,String enumNames) throws PLException { + public String exportEnumTypes(String exportFileName,String enumNames,boolean flag/*鎺у埗瀵煎嚭鐨勫垪鍚嶆槸鍚﹀拰瀵煎叆妯℃澘涓�鑷�*/) throws PLException { if(Func.isBlank(enumNames)){ throw new PLException("500",new String[]{"璇峰嬀閫夎瀵煎嚭鐨勬灇涓�!"}); } //鐣岄潰娌′紶鍚嶇О锛屼娇鐢ㄩ粯璁ゅ鍑哄悕绉� exportFileName = Func.isBlank(exportFileName) ? "鏋氫妇绫诲瀷瀵煎嚭_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName; //璁剧疆鍒楀悕 - List<String> columns = new ArrayList<>(Arrays.asList("鏋氫妇鍚嶇О", "鏍囩", "杩斿洖绫诲瀷", "闀垮害","鍒涘缓鏃堕棿", "鏋氫妇椤瑰悕绉�", "鏋氫妇鍊�", "鎻忚堪")); + List<String> columns = this.getCloumns(flag); //鍐檈xcel String excelPath = LocalFileUtil.getDefaultTempFolder() + File.separator + exportFileName + ".xls"; @@ -418,39 +418,54 @@ if(Func.isEmpty(osEnumVO) && Func.isBlank(osEnumVO.getOid())){ throw new PLException("500",new String[]{"鏈煡璇㈠埌鏋氫妇鍚嶄负銆�" + enumNameList.get(i) + "銆戠殑鏋氫妇锛岃鍒锋柊鍚庨噸鏂板鍑�!"}); } - //鏋氫妇椤逛笉涓虹┖鏃堕渶瑕佽�冭檻鍚堝苟琛岄棶棰� + //鎸夌収瀵煎嚭鍒楀悕鎺у埗鍙橀噺鍜屾灇涓鹃」涓嶄负绌烘椂鍐冲畾鏄惁闇�瑕佽�冭檻鍚堝苟琛岄棶棰� List<OsEnumItemVO> enumVOItems = osEnumVO.getItems(); - //鏋氫妇椤逛笉涓虹┖鏃堕渶瑕佽繘琛屽悎骞惰澶勭悊 - if(Func.isNotEmpty(enumVOItems) || enumVOItems.size() > 1){ - //excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,0, osEnumVO.getOid())); - excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,0, osEnumVO.getId())); - excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,1, osEnumVO.getName())); - excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,2, osEnumVO.getEnumValueDataType()+"("+osEnumVO.getEnumValueDataTypeText()+")")); - excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,3, osEnumVO.getLength())); - //excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,5, osEnumVO.getCreator())); - excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,4, Func.format(osEnumVO.getCreateTime(),"yyyy骞碝M鏈坉d鏃� hh:mm:ss"))); - - //澶勭悊鏋氫妇椤瑰啓鍏� + //鍒ゆ柇鏄寜鐓т粈涔堝垪鍚嶅鍑� + if(flag){ for (int j = 0; j < enumVOItems.size(); j++) { OsEnumItemVO osEnumItemVO = enumVOItems.get(j); - excelDataList.add(new WriteExcelData(startRow+j,5, true,osEnumItemVO.getName())); - excelDataList.add(new WriteExcelData(startRow+j,6, true, osEnumItemVO.getValue())); - excelDataList.add(new WriteExcelData(startRow+j,7, true, osEnumItemVO.getDescription())); - } + excelDataList.add(new WriteExcelData(i+j+1,0, osEnumVO.getId())); + excelDataList.add(new WriteExcelData(i+j+1,1, osEnumVO.getName())); + excelDataList.add(new WriteExcelData(i+j+1,2, osEnumVO.getEnumValueDataType())); + excelDataList.add(new WriteExcelData(i+j+1,3, osEnumVO.getLength())); - startRow += enumVOItems.size(); + excelDataList.add(new WriteExcelData(i+j+1,4,osEnumItemVO.getName())); + excelDataList.add(new WriteExcelData(i+j+1,5, osEnumItemVO.getValue())); + excelDataList.add(new WriteExcelData(i+j+1,6, osEnumItemVO.getDescription())); + } }else{ - //鏋氫妇椤逛负绌烘椂灏变笉闇�瑕佸悎骞惰 - //excelDataList.add(new WriteExcelData(startRow,0, true,osEnumVO.getOid())); - excelDataList.add(new WriteExcelData(startRow,0, true, osEnumVO.getId())); - excelDataList.add(new WriteExcelData(startRow,1, true, osEnumVO.getName())); - excelDataList.add(new WriteExcelData(startRow,1, true, osEnumVO.getEnumValueDataType()+"("+osEnumVO.getEnumValueDataTypeText()+")")); - excelDataList.add(new WriteExcelData(startRow,3, true, osEnumVO.getLength())); - //excelDataList.add(new WriteExcelData(startRow,5, true, osEnumVO.getCreator())); - excelDataList.add(new WriteExcelData(startRow,4, true, Func.format(osEnumVO.getCreateTime(),"yyyy骞碝M鏈坉d鏃� hh:mm:ss"))); + //鏋氫妇椤逛笉涓虹┖鏃堕渶瑕佽繘琛屽悎骞惰澶勭悊 + if(Func.isNotEmpty(enumVOItems) || enumVOItems.size() > 1){ + //excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,0, osEnumVO.getOid())); + excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,0, osEnumVO.getId())); + excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,1, osEnumVO.getName())); + excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,2, osEnumVO.getEnumValueDataType()+"("+osEnumVO.getEnumValueDataTypeText()+")")); + excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,3, osEnumVO.getLength())); + //excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,5, osEnumVO.getCreator())); + excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,4, Func.format(osEnumVO.getCreateTime(),"yyyy骞碝M鏈坉d鏃� hh:mm:ss"))); + + //澶勭悊鏋氫妇椤瑰啓鍏� + for (int j = 0; j < enumVOItems.size(); j++) { + OsEnumItemVO osEnumItemVO = enumVOItems.get(j); + excelDataList.add(new WriteExcelData(startRow+j,5, true,osEnumItemVO.getName())); + excelDataList.add(new WriteExcelData(startRow+j,6, true, osEnumItemVO.getValue())); + excelDataList.add(new WriteExcelData(startRow+j,7, true, osEnumItemVO.getDescription())); + } + + startRow += enumVOItems.size(); + }else{ + //鏋氫妇椤逛负绌烘椂灏变笉闇�瑕佸悎骞惰 + //excelDataList.add(new WriteExcelData(startRow,0, true,osEnumVO.getOid())); + excelDataList.add(new WriteExcelData(startRow,0, true, osEnumVO.getId())); + excelDataList.add(new WriteExcelData(startRow,1, true, osEnumVO.getName())); + excelDataList.add(new WriteExcelData(startRow,1, true, osEnumVO.getEnumValueDataType()+"("+osEnumVO.getEnumValueDataTypeText()+")")); + excelDataList.add(new WriteExcelData(startRow,3, true, osEnumVO.getLength())); + //excelDataList.add(new WriteExcelData(startRow,5, true, osEnumVO.getCreator())); + excelDataList.add(new WriteExcelData(startRow,4, true, Func.format(osEnumVO.getCreateTime(),"yyyy骞碝M鏈坉d鏃� hh:mm:ss"))); + } + //璁板綍涓嬩笂涓�缁勬暟鎹粨鏉熸椂鐨勮鍙凤紝鏂逛究鐢ㄥ仛鍚堝苟琛岀殑璧峰琛� + startRow += 1; } - //璁板綍涓嬩笂涓�缁勬暟鎹粨鏉熸椂鐨勮鍙凤紝鏂逛究鐢ㄥ仛鍚堝苟琛岀殑璧峰琛� - startRow += 1; } WriteExcelOption excelOption = new WriteExcelOption(excelDataList); ExcelUtil.writeDataToFile(excelPath, excelOption); @@ -467,7 +482,7 @@ //鐣岄潰娌′紶鍚嶇О锛屼娇鐢ㄩ粯璁ゅ鍑哄悕绉� exportFileName = Func.isBlank(exportFileName) ? "鏋氫妇瀵煎叆妯℃澘_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName; //璁剧疆鍒楀悕 - List<String> columns = new ArrayList<>(Arrays.asList("鏋氫妇鍚嶇О", "鏍囩", "杩斿洖绫诲瀷", "闀垮害", "鏋氫妇椤瑰悕绉�(褰撳墠鏋氫妇涓嬫湁鏋氫妇椤规椂蹇呭~)", "鏋氫妇鍊�(褰撳墠鏋氫妇涓嬫湁鏋氫妇椤规椂蹇呭~)", "鎻忚堪","*娉ㄦ剰*:绗簩琛屽紑濮嬬殑鏁版嵁涓虹ず渚嬫暟鎹紝瀵煎叆鍓嶈灏嗗叾鍒犻櫎锛屽綋瀵煎叆鐨勬灇涓句笅鍏峰澶氫釜鏋氫妇椤规椂锛屽簲鎸夌収绀轰緥enum2鐨勫啓娉�")); + List<String> columns = this.getCloumns(true); //鍐檈xcel String excelPath = LocalFileUtil.getDefaultTempFolder() + File.separator + exportFileName + ".xls"; //璁剧疆蹇呭~鍒� @@ -514,6 +529,27 @@ WriteExcelOption excelOption = new WriteExcelOption(excelDataList); ExcelUtil.writeDataToFile(excelPath, excelOption); return excelPath; + } + + /** + * 鑾峰彇瀵煎嚭鎴栧鍏ユā鏉跨殑鍒楀悕 + * @param flag 鏄惁鑾峰彇瀵煎叆妯℃澘鍒楀悕 + * @return + */ + private List<String> getCloumns(boolean flag){ + if(flag){ + return new ArrayList<>( + Arrays.asList("鏋氫妇鍚嶇О", "鏍囩", "杩斿洖绫诲瀷", "闀垮害", "鏋氫妇椤瑰悕绉�(褰撳墠鏋氫妇涓嬫湁鏋氫妇椤规椂蹇呭~)", + "鏋氫妇鍊�(褰撳墠鏋氫妇涓嬫湁鏋氫妇椤规椂蹇呭~)", "鎻忚堪","*娉ㄦ剰*:绗簩琛屽紑濮嬬殑鏁版嵁涓虹ず渚嬫暟鎹紝瀵煎叆鍓嶈灏嗗叾鍒犻櫎锛�" + + "褰撳鍏ョ殑鏋氫妇涓嬪叿澶囧涓灇涓鹃」鏃讹紝搴旀寜鐓хず渚媏numb鐨勫啓娉�" + ) + ); + } + return new ArrayList<>( + Arrays.asList("鏋氫妇鍚嶇О", "鏍囩", "杩斿洖绫诲瀷", "闀垮害", + "鍒涘缓鏃堕棿", "鏋氫妇椤瑰悕绉�", "鏋氫妇鍊�", "鎻忚堪" + ) + ); } /** @@ -569,7 +605,7 @@ } //褰撳墠excel涓槸鍚﹂噸澶嶇敤鐨勫垽閲峂ap:锛坘ey锛氬垽閲嶅睘鎬э紝value锛氳鍙凤級 Map<String, String> excelReapeat = new HashMap<>(); - //鍒ゆ柇蹇呭~灞炴�ф槸鍚︿负绌猴紝鐢ㄦ埛鏄惁宸插瓨鍦紝浠ュ強閮ㄩ棬鏄惁濉敊绛夋牎楠岄�昏緫 + //鍒ゆ柇蹇呭~灞炴�ф槸鍚︿负绌虹瓑绛� List<String> finalRepeatEnumId = repeatEnumId; newPOList.stream().forEach(osEnumPO -> { if(Func.isBlank(osEnumPO.getId())){//鏋氫妇鍚� @@ -582,7 +618,7 @@ throw new VciBaseException("绗��"+osEnumPO.getRowIndex()+"銆戣鏁版嵁锛屾灇涓惧悕绉板彧鑳戒负鑻辨枃瀛楁瘝"); }else if(excelReapeat.containsKey(osEnumPO.getId())){//鏋氫妇鍚嶈〃鏍间腑鍒ら噸 throw new VciBaseException("绗��"+excelReapeat.get(osEnumPO.getId())+"銆戣鍜岀銆�"+osEnumPO.getRowIndex()+"銆戣鏁版嵁锛屾灇涓惧悕閲嶅"); - }else if (Func.isNotEmpty(osEnumVOList) && finalRepeatEnumId.contains(osEnumPO.getId())){//2銆佸垽鏂灇涓惧悕鏄惁涓庣郴缁熶腑閲嶅 + }else if (Func.isNotEmpty(finalRepeatEnumId) && finalRepeatEnumId.contains(osEnumPO.getId())){//2銆佸垽鏂灇涓惧悕鏄惁涓庣郴缁熶腑閲嶅 throw new VciBaseException("绗��"+osEnumPO.getRowIndex()+"銆戣锛屾灇涓惧悕鍦ㄧ郴缁熶腑宸茬粡瀛樺湪,璇蜂慨鏀�!"); } //鍏堝鏋氫妇鍚峞xcel涓渶瑕佸垽閲嶅鐞� @@ -619,7 +655,7 @@ * @return */ private List<OsEnumVO> getExportEnumTempExample(){ - String testJosn = "[{\"enumValueDataType\":\"String\",\"id\":\"enum1\",\"items\":[{\"description\":\"enumitem1.1\",\"name\":\"enumitem1.1\",\"value\":\"1\"},{\"description\":\"enumitem1.2\",\"name\":\"enumitem1.2\",\"value\":\"2\"}],\"length\":2,\"name\":\"enum1\"},{\"enumValueDataType\":\"String\",\"id\":\"enum2\",\"items\":[{\"description\":\"enumitem2.1\",\"name\":\"enumitem2.1\",\"value\":\"1\"},{\"description\":\"enumitem2.2\",\"name\":\"enumitem2.2\",\"value\":\"2\"},{\"description\":\"enumitem2.3\",\"name\":\"enumitem2.3\",\"value\":\"3\"}],\"length\":6,\"name\":\"enum2\"}]"; + String testJosn = "[{\"enumValueDataType\":\"String\",\"id\":\"enuma\",\"items\":[{\"description\":\"enumitem1.1\",\"name\":\"enumitem1.1\",\"value\":\"1\"},{\"description\":\"enumitem1.2\",\"name\":\"enumitem1.2\",\"value\":\"2\"}],\"length\":2,\"name\":\"enuma\"},{\"enumValueDataType\":\"String\",\"id\":\"enumb\",\"items\":[{\"description\":\"enumitem2.1\",\"name\":\"enumitem2.1\",\"value\":\"1\"},{\"description\":\"enumitem2.2\",\"name\":\"enumitem2.2\",\"value\":\"2\"},{\"description\":\"enumitem2.3\",\"name\":\"enumitem2.3\",\"value\":\"3\"}],\"length\":6,\"name\":\"enumb\"}]"; List<OsEnumVO> OsEnumVOs = JSON.parseArray(testJosn,OsEnumVO.class); return OsEnumVOs; } @@ -661,7 +697,7 @@ */ private EnumType osEnumDTO2EnumType(OsEnumDTO osEnumDTO){ EnumType enumType = new EnumType(); - enumType.oid = osEnumDTO.getOid(); + //enumType.oid = osEnumDTO.getOid(); //鏋氫妇鍚嶇粺涓�杞垚灏忓啓锛岄伩鍏嶅悗鏈熷嚭鐜板叾浠栭棶棰� enumType.name = osEnumDTO.getId().toLowerCase(Locale.ROOT); enumType.label = osEnumDTO.getName(); @@ -952,7 +988,12 @@ for(int k = 0; k < emChildren.length; k++){ EnumItem emChild = emChildren[k]; String value = emChild.value; - valueList.add(value); + String symbol = ""; + //褰撲负Integer鏃堕渶瑕佸皢鏋氫妇椤瑰�兼嫾鎺ヤ笂= + if("Integer".equals(enumType)){ + symbol = "="; + } + valueList.add(symbol + value); } Map<String, List<String>> enumMap = new HashMap<>(); enumMap.put(emItem.name, valueList); 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 8b2cf40..e66ecc9 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 @@ -1,26 +1,40 @@ package com.vci.web.service.impl; +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.util.ZipUtil; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; +import com.vci.constant.FrameWorkLangCodeConstant; 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.data.BusinessObject; import com.vci.corba.omd.ltm.LinkType; +import com.vci.corba.omd.ltm.LinkTypeServicePrx; +import com.vci.dto.OsAttributeDTO; +import com.vci.omd.constants.LinkTypeConstants; import com.vci.omd.utils.ObjectTool; import com.vci.pagemodel.*; +import com.vci.po.OsAttributePO; +import com.vci.po.OsLinkTypePO; +import com.vci.starter.poi.bo.ReadExcelOption; +import com.vci.starter.poi.bo.WriteExcelData; +import com.vci.starter.poi.bo.WriteExcelOption; +import com.vci.starter.poi.constant.ExcelLangCodeConstant; +import com.vci.starter.poi.util.ExcelUtil; import com.vci.starter.web.annotation.log.VciUnLog; import com.vci.starter.web.enumpck.VciFieldTypeEnum; +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.BeanUtil; -import com.vci.starter.web.util.VciBaseUtil; -import com.vci.starter.web.util.VciDateUtil; +import com.vci.starter.web.util.*; import com.vci.model.OsLinkTypeDO; import com.vci.web.service.*; +import com.vci.web.util.Func; import com.vci.web.util.PlatformClientUtil; import com.vci.web.util.WebUtil; +import javafx.scene.shape.HLineTo; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -28,8 +42,10 @@ import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import java.io.*; import java.util.*; import java.util.stream.Collectors; @@ -40,6 +56,16 @@ */ @Service public class OsLinkTypeServiceImpl implements OsLinkTypeServiceI { + + private static final String OID = "oid"; + private static final String NAME = "name"; + private static final String LABEL = "label"; + private static final String DESCRIPTION = "description"; + private static final String TS = "ts"; + private static final String CREATOR = "creator"; + private static final String CREATETIME = "createTime"; + private static final String MODIFIER = "modifier"; + private static final String MODIFYTIME = "modifyTime"; /** * 鏃ュ織 @@ -487,6 +513,182 @@ } } + /** + * 瀵煎嚭閾炬帴绫诲瀷 + * name 閾炬帴绫诲瀷鍚嶇О + * @return 鍒涘缓缁撴灉 + */ + @Override + public void expData(String names, HttpServletResponse response) throws PLException, IOException { + String defaultTempFolder = LocalFileUtil.getDefaultTempFolder(); + //鍐檈xcel + String excelPath = defaultTempFolder + File.separator + "lt.xls"; + //璁剧疆鍒楀悕 + List<String> columns = new ArrayList<>( + Arrays.asList("鍚嶇О", "鏍囩", "瀹炵幇绫�", "褰㈢姸", "From绔被鍨嬪垪琛�", "From绔富绫诲瀷", "From绔搴斿叧绯�", + "To绔被鍨嬪垪琛�", "To绔富绫诲瀷", "To绔搴斿叧绯�", "灞炴�у垪琛�", "鎻忚堪") + ); + try { + new File(excelPath).createNewFile(); + //璁剧疆鍒� + List<WriteExcelData> excelDataList = new ArrayList<>(); + //璁剧疆鍒楀ご + for (int index = 0; index < columns.size(); index++) { + excelDataList.add(new WriteExcelData(0,index, columns.get(index))); + } + HashSet<String> attributes = new HashSet<>(); + int i = 0; + for (String name : names.split(",")) { + LinkType lt = platformClientUtil.getLinkTypeService().getLinkType(name); + excelDataList.add(new WriteExcelData(i+1,0, lt.name)); + excelDataList.add(new WriteExcelData(i+1,1, lt.tag)); + excelDataList.add(new WriteExcelData(i+1,2, lt.implClass)); + excelDataList.add(new WriteExcelData(i+1,3, lt.shape)); + excelDataList.add(new WriteExcelData(i+1,4, String.join(",",lt.btmItemsFrom))); + excelDataList.add(new WriteExcelData(i+1,5, lt.primitivesFrom)); + excelDataList.add(new WriteExcelData(i+1,6, lt.relationFrom)); + excelDataList.add(new WriteExcelData(i+1,7, String.join(",",lt.btmItemsTo))); + excelDataList.add(new WriteExcelData(i+1,8, lt.primitivesTo)); + excelDataList.add(new WriteExcelData(i+1,9, lt.relationTo)); + excelDataList.add(new WriteExcelData(i+1,10, String.join(",",lt.attributes))); + excelDataList.add(new WriteExcelData(i+1,11, lt.description)); + attributes.addAll(Arrays.asList(lt.attributes)); + i++; + } + WriteExcelOption excelOption = new WriteExcelOption(excelDataList); + ExcelUtil.writeDataToFile(excelPath, excelOption); + //瀵煎嚭灞炴�� + String attrPath = attributeService.exportAttributes("attr", + String.valueOf(attributes.stream().collect(Collectors.joining(","))),true); + //绉诲姩灞炴�у埌閾炬帴绫诲瀷鏂囦欢澶归噷闈㈠幓 + FileUtil.move(new File(attrPath), new File(defaultTempFolder),true); + FileUtil.del(attrPath.substring(0,attrPath.lastIndexOf("\\"))); + //todo 瀵煎嚭涓氬姟绫诲瀷杩樻病鏈夊疄鐜� +// List<BizType> bts = new ArrayList<BizType>(); +// for (String btName : btNameSet) { +// BizType bt = BtmProvider.getBtmItemByName(btName); +// bts.add(bt); +// } +// boolean btFlag = BtmProvider.expData(rootPath, bts.toArray(new BizType[0])); + }catch (IOException e) { + throw new RuntimeException(e); + } + File zip = ZipUtil.zip(defaultTempFolder); + FileUtil.del(defaultTempFolder + File.separator); + ControllerUtil.writeFileToResponse(response,zip.getAbsoluteFile()); + } + + /** + * 瀵煎叆閾炬帴绫诲瀷 + * @param file 涓婁紶鐨勬枃浠� + * @return + */ + @Override + public BaseResult impData(MultipartFile file) throws Exception { + String defaultTempFolder = LocalFileUtil.getDefaultTempFolder(); + String fileName = defaultTempFolder + File.separator + LocalFileUtil.getFileNameForIE(file.getOriginalFilename()); + file.transferTo(new File(fileName)); + if (file == null) { + return BaseResult.fail(FrameWorkLangCodeConstant.IMPORT_FAIL, new String[]{"鏃犲鍏ョ殑鏂囦欢"}); + } + if (!fileName.endsWith(".zip")) { + throw new VciBaseException("浠呰兘涓婁紶zip鍘嬬缉鏂囦欢锛岃閲嶆柊涓婁紶锛�"); + } + File unzip = ZipUtil.unzip(fileName); + File ltExcel = new File(unzip.getAbsolutePath() + File.separator + "lt.xls"); + File attrExcel = new File(unzip.getAbsolutePath() + File.separator + "attr.xls"); + if (!attrExcel.exists()) { + //澧炲姞瑙e帇鐨勮矾寰勶紝鐪嬫枃浠惰繕鍦ㄦ病鏈� + attrExcel = new File(unzip.getAbsolutePath() + File.separator + unzip.getName() + File.separator + "attr.xls"); + if (!attrExcel.exists()) { + return BaseResult.fail(FrameWorkLangCodeConstant.IMPORT_FAIL, new String[]{"娌℃湁瀵煎叆鐨勫睘鎬ф枃浠躲�傚鍏ョ粓姝紒"}); + } + } + BaseResult baseResult = attributeService.importAttributes(attrExcel); + if(!baseResult.isSuccess()){ + //鍒犻櫎涓婁紶鐨勬枃浠跺す + FileUtil.del(defaultTempFolder + File.separator); + return baseResult; + } + //todo 杩橀渶瀵煎叆涓氬姟绫诲瀷锛岀瓑寰呭姛鑳藉疄鐜� + if (!ltExcel.exists()) { + //澧炲姞瑙e帇鐨勮矾寰勶紝鐪嬫枃浠惰繕鍦ㄦ病鏈� + ltExcel = new File(unzip.getAbsolutePath() + File.separator + unzip.getName() + File.separator + "lt.xls"); + if (!ltExcel.exists()) { + //鍒犻櫎涓婁紶鐨勬枃浠跺す + FileUtil.del(defaultTempFolder + File.separator); + return BaseResult.fail(FrameWorkLangCodeConstant.IMPORT_FAIL, new String[]{"娌℃湁瀵煎叆鐨勯摼鎺ユ枃浠躲�傚鍏ョ粓姝紒"}); + } + } + try{ + //1銆佽鍙杄xcel涓殑鏁版嵁锛岀粍鎴愬璞� + ReadExcelOption excelOption = new ReadExcelOption(); + List<OsLinkTypePO> poList = ExcelUtil.readDataObjectFromExcel(ltExcel, OsLinkTypePO.class,excelOption,(value, po, fieldName)->{}); + //鍘婚櫎閮芥槸绌虹殑鎯呭喌 + if(CollectionUtils.isEmpty(poList)){ + return BaseResult.fail(ExcelLangCodeConstant.IMPORT_CONTENT_NULL,new String[]{}); + } + //褰撳墠excel涓槸鍚﹂噸澶嶇敤鐨勫垽閲峂ap:锛坘ey锛氬垽閲嶅睘鎬э紝value锛氳鍙凤級 + Map<String, String> excelReapeat = new HashMap<>(); + int maxLength = platformClientUtil.getLinkTypeService().getLTNameMaxLength(); + + //鍒ゆ柇蹇呭~灞炴�ф槸鍚︿负绌猴紝鐢ㄦ埛鏄惁宸插瓨鍦紝浠ュ強閮ㄩ棬鏄惁濉敊绛夋牎楠岄�昏緫 + poList.stream().forEach(osLinkTypePO -> { + if(Func.isBlank(osLinkTypePO.getName())){//灞炴�у悕鍒ょ┖ + throw new VciBaseException("绗��"+osLinkTypePO.getRowIndex()+"銆戣锛宯ame"); + }else if(osLinkTypePO.getName().length() > maxLength){ + throw new VciBaseException("绗��"+osLinkTypePO.getRowIndex()+"銆戣锛岄摼鎺ョ被鍨嬪悕闀垮害涓嶈兘瓒呰繃" + maxLength); + }else if(!osLinkTypePO.getName().matches("^[A-Za-z]+$")){ + throw new VciBaseException("绗��"+osLinkTypePO.getRowIndex()+"銆戣锛岄摼鎺ョ被鍨嬪悕绉板彧鑳戒负鑻辨枃瀛楁瘝"); + }else if(excelReapeat.containsKey(osLinkTypePO.getName())){//灞炴�у悕琛ㄦ牸涓垽閲� + throw new VciBaseException("绗��"+excelReapeat.get(osLinkTypePO.getName())+"銆戣鍜岀銆�"+osLinkTypePO.getRowIndex()+"銆戣鏁版嵁锛屽睘鎬у悕閲嶅"); + } + try { + LinkType historyLink = platformClientUtil.getLinkTypeService().getLinkType(osLinkTypePO.getName()); + //宸叉湁姝ゆ暟鎹繘琛屽垹闄よ鐩� + if(historyLink != null && !historyLink.name.equals("")){ + platformClientUtil.getLinkTypeService().deleteLinkType(historyLink); + } + } catch (PLException e) { + throw new RuntimeException(e); + } + + //灞炴�у悕excel涓垽閲嶅鐞� + excelReapeat.put(osLinkTypePO.getName(),osLinkTypePO.getRowIndex()); + LinkType linkType = new LinkType(); + linkType.name = osLinkTypePO.getName(); + linkType.attributes = osLinkTypePO.getAttributes().split(","); + linkType.btmItemsFrom = osLinkTypePO.getBtmItemsFrom().split(","); + linkType.primitivesFrom = osLinkTypePO.getPrimitivesFrom(); + linkType.relationFrom = osLinkTypePO.getRelationFrom(); + linkType.btmItemsTo = osLinkTypePO.getBtmItemsTo().split(","); + linkType.primitivesTo = osLinkTypePO.getPrimitivesTo(); + linkType.relationTo = osLinkTypePO.getRelationTo(); + linkType.relation = osLinkTypePO.getRelationFrom() + ":" + osLinkTypePO.getRelationTo(); + linkType.description = osLinkTypePO.getDescription(); + linkType.tag = osLinkTypePO.getTag(); + linkType.shape = osLinkTypePO.getShape(); + linkType.implClass = osLinkTypePO.getImplClass(); + linkType.modifier = WebUtil.getCurrentUserId(); + linkType.creator = WebUtil.getCurrentUserId(); + try { + platformClientUtil.getLinkTypeService().addLinkType(linkType); + } catch (PLException e) { + throw new RuntimeException(e); + } + + }); + }catch (Exception e){ + if(logger.isErrorEnabled()){ + logger.error("璇诲彇excel鍐呭鏃舵垨淇濆瓨鐢ㄦ埛淇℃伅鏃跺嚭鐜颁簡閿欒锛屽叿浣撳師鍥狅細",VciBaseUtil.getExceptionMessage(e)); + } + e.printStackTrace(); + return BaseResult.fail(VciBaseUtil.getExceptionMessage(e),new String[]{},e); + } + //鍒犻櫎涓婁紶鐨勬枃浠跺す + FileUtil.del(defaultTempFolder + File.separator); + return BaseResult.success("閾炬帴绫诲瀷瀵煎叆鎴愬姛锛�"); + } /** * 淇閾炬帴绫诲瀷鐨剎ml鏂囦欢 diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsRevisionRuleServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsRevisionRuleServiceImpl.java index 4adf929..904da86 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsRevisionRuleServiceImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsRevisionRuleServiceImpl.java @@ -1,19 +1,46 @@ package com.vci.web.service.impl; +import com.vci.client.mw.ClientSessionUtility; import com.vci.corba.common.PLException; +import com.vci.corba.omd.stm.StatePool; import com.vci.corba.omd.vrm.VersionRule; +import com.vci.dto.OsAttributeDTO; +import com.vci.dto.OsRevisionRuleDTO; +import com.vci.dto.OsStatusDTO; +import com.vci.pagemodel.OsAttributeVO; +import com.vci.pagemodel.OsEnumVO; +import com.vci.pagemodel.OsStatusVO; +import com.vci.po.OsAttributePO; +import com.vci.po.OsEnumPO; +import com.vci.po.OsRevisionRulePO; +import com.vci.starter.poi.bo.ReadExcelOption; +import com.vci.starter.poi.bo.WriteExcelData; +import com.vci.starter.poi.bo.WriteExcelOption; +import com.vci.starter.poi.constant.ExcelLangCodeConstant; +import com.vci.starter.poi.util.ExcelUtil; import com.vci.starter.web.annotation.log.VciUnLog; -import com.vci.starter.web.util.VciDateUtil; +import com.vci.starter.web.exception.VciBaseException; +import com.vci.starter.web.pagemodel.BaseResult; +import com.vci.starter.web.util.*; import com.vci.pagemodel.OsRevisionRuleVO; import com.vci.web.service.OsRevisionRuleServiceI; +import com.vci.web.util.Func; import com.vci.web.util.PlatformClientUtil; import com.vci.web.util.WebUtil; import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.util.HSSFColor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; +import javax.swing.*; +import java.awt.*; +import java.io.File; import java.util.*; +import java.util.List; import java.util.stream.Collectors; /** @@ -36,6 +63,17 @@ @Autowired(required = false) @Lazy private OsRevisionRuleServiceI self; + + /** + * 鏃ュ織 + */ + private Logger logger = LoggerFactory.getLogger(getClass()); + + /** + * 蹇呭~鍒� + */ + private List<Integer> ColumnNameisRed = new ArrayList<Integer>(); + /** * 鏌ヨ鎵�鏈夌殑鐗堟湰瑙勫垯 * @@ -59,6 +97,163 @@ @VciUnLog public Map<String, OsRevisionRuleVO> selectAllRevisionMap() { return Optional.ofNullable(self.selectAllRevision()).orElseGet(()->new ArrayList<>()).stream().collect(Collectors.toMap(s->s.getId().toLowerCase(),t->t,(o1,o2)->o1)); + } + + /** + * 鍒涘缓鐗堟湰瑙勫垯 + * @param osRevisionRuleDTO + * @return + */ + @Override + public boolean addVersionRule(OsRevisionRuleDTO osRevisionRuleDTO) throws PLException { + //鍒ょ┖ + VciBaseUtil.alertNotNull(osRevisionRuleDTO,"鐗堟湰瑙勫垯瀵硅薄",osRevisionRuleDTO.getId(),"鐗堟湰瑙勫垯鍚嶇О"); + //鐗堟湰瑙勫垯鍚堣妫�楠� + this.checkVersionRule(osRevisionRuleDTO); + //鏌ラ噸 + VersionRule vr = platformClientUtil.getVersionService().getVersionRule(osRevisionRuleDTO.getId()); + //name涓嶄负绌� + if(Func.isNotEmpty(vr) && !"".equals(vr.name)){ + throw new PLException("500",new String[]{"鍚嶇О閲嶅璇锋洿鎹㈠悕绉�!"}); + } + return platformClientUtil.getVersionService().addVersionRule(this.dto2VersionRule(osRevisionRuleDTO)); + } + + /** + * 淇敼鐗堟湰瑙勫垯 + * @param osRevisionRuleDTO + * @return + */ + @Override + public boolean updateVersionRule(OsRevisionRuleDTO osRevisionRuleDTO) throws PLException { + //鍒ょ┖ + VciBaseUtil.alertNotNull(osRevisionRuleDTO,"鐗堟湰瑙勫垯瀵硅薄",osRevisionRuleDTO.getId(),"鐗堟湰瑙勫垯鍚嶇О"); + //鍒ゆ柇鏄惁鍦ㄧ郴缁熶腑瀛樺湪 + VersionRule vr = platformClientUtil.getVersionService().getVersionRule(osRevisionRuleDTO.getName()); + //鐗堟湰瑙勫垯鍚堣妫�楠� + this.checkVersionRule(osRevisionRuleDTO); + //name涓嶄负绌� + if(Func.isEmpty(vr) && !"".equals(vr.name)){ + throw new PLException("500",new String[]{"淇敼鐨勭増鏈鍒欏湪绯荤粺涓笉瀛樺湪!"}); + } + return platformClientUtil.getVersionService().modifyVersionRule(this.dto2VersionRule(osRevisionRuleDTO)); + } + + /** + * 鍒犻櫎鐗堟湰瑙勫垯 + * @param osRevisionRuleDTOS + * @return + */ + @Override + public boolean deleteVersionRule(List<OsRevisionRuleDTO> osRevisionRuleDTOS) throws PLException { + VciBaseUtil.alertNotNull(osRevisionRuleDTOS,"寰呭垹闄ょ殑灞炴�у垪琛�"); + //鍒ゆ柇瑕佸垹闄ょ殑鐗堟湰瑙勫垯鏄惁鏈夎寮曠敤 + osRevisionRuleDTOS.stream().forEach(item->{ + String vrName = item.getId(); + try { + String[] btNamesByVerName = platformClientUtil.getBtmService().getBTNamesByVerName(vrName); + if(btNamesByVerName != null && btNamesByVerName.length > 0){ + throw new VciBaseException("璇ョ増鏈凡琚娇鐢ㄤ笉鍏佽鍒犻櫎"); + } + } catch (PLException e) { + logger.error(e.getMessage()); + e.printStackTrace(); + throw new VciBaseException(e.getMessage()); + } + }); + + //骞冲彴鐨刣eleteStatus鏂规硶蹇呬紶涓変釜鍙傛暟锛宱id銆乶ame鍜宼s + List<VersionRule> vrList = new ArrayList<>(); + for(OsRevisionRuleDTO vrDTO : osRevisionRuleDTOS){ + //oid鍜宼s鍒ょ┖ + String oid = vrDTO.getOid(); + //id涓昏鐢ㄦ潵瀵圭紦瀛樻暟鎹垹闄� + String id = vrDTO.getId(); + //鍚庡彴浼氱敤ts杩涜鏁版嵁涓�鑷存�ф牎楠� + Date ts = vrDTO.getTs(); + if(Func.isBlank(oid) || Func.isBlank(id) || Func.isEmpty(ts)){ + throw new PLException("500",new String[]{"寰呭垹闄ょ殑鐘舵�佸垪琛ㄤ腑涓婚敭銆恛id銆戙�佽皟鏁存椂闂淬�恡s銆戙�佺姸鎬佸悕绉般�恘ame銆戜笉鑳戒负绌猴紒"}); + } + VersionRule vr = new VersionRule(); + vr.oid = oid; + vr.name = id; + vr.ts = Func.format(ts,VciDateUtil.DateTimeMillFormat); + vrList.add(vr); + } + return platformClientUtil.getVersionService().deleteVersionRules(vrList.toArray(new VersionRule[vrList.size()])); + } + + /** + * 妫�鏌ョ増鏈鍒欒缃殑鏄惁鍚堢悊 + * @param dto + */ + private void checkVersionRule(OsRevisionRuleDTO dto) throws PLException { + //鐗堟湰瑙勫垯鍚嶇О鍙兘涓鸿嫳鏂囧瓧姣� + String regex = "[a-z A-Z]*"; + if (!dto.getId().matches(regex)) { + throw new PLException("500",new String[]{"鍚嶇О鍙兘涓鸿嫳鏂囷紒"}); + } + //璺宠穬瀛楃鍙兘涓烘暟瀛楁垨鑰呭瓧姣� + if(Func.isNotBlank(dto.getJumpCharacter()) && (!(dto.getJumpCharacter().matches(regex)))){ + throw new PLException("500",new String[]{"璺宠穬瀛楃鍙兘涓烘暟瀛楁垨鑰呭瓧姣嶏紒"}); + } + //鍒濆鍊间笉鑳戒负绌轰笖鍙兘涓烘暟瀛楁垨鑰呭瓧姣嶆垨鑻辨枃鐘舵�佷笅鐨勭鍙� + String regex1 = "[A-Za-z0-9!@#$%^&*()-_=+{}':|;,.?/]+$"; + if(Func.isBlank(dto.getInitialValue()) || !dto.getInitialValue().matches(regex1)){ + throw new PLException("500",new String[]{"鍒濆鍊间笉鑳戒负绌轰笖鍙兘涓烘暟瀛楁垨鑰呭瓧姣嶆垨鑻辨枃鐘舵�佷笅鐨勭鍙凤紒"}); + } + if(dto.getInitialValue().length() + dto.getInitialValue().length() > 32) { + throw new PLException("500",new String[]{"鍒濆鍊间笉鑳借秴杩�32涓瓧绗︼紒"}); + } + //姝ラ暱涓嶈兘涓虹┖涓斿繀椤讳负1-9鐨勬鏁存暟 + String regex2 = "[1-9]"; + if(Func.isBlank(dto.getStepLength()) || (!dto.getStepLength().matches(regex2))){ + throw new PLException("500",new String[]{"姝ラ暱涓嶈兘涓虹┖涓斿繀椤讳负1-9鐨勬鏁存暟"}); + } + //鍓嶇紑鐩稿叧鍒ゆ柇 + String regex3 = "^\\s+.*"; + if(Func.isNotBlank(dto.getPrefixion()) && (dto.getPrefixion().matches(regex3))){ + throw new PLException("500",new String[]{"鍓嶇紑涓嶈兘浠ョ┖鏍煎紑澶�"}); + } + if (Func.isNotBlank(dto.getPrefixion()) && dto.getPrefixion().length() > 32) { + throw new PLException("500",new String[]{"鍓嶇紑涓嶈兘瓒呰繃32涓瓧绗�"}); + } + //鍚庣紑鐩稿叧鍒ゆ柇 + String regex4 = "^*.\\s+$"; + if(Func.isNotBlank(dto.getSuffix()) && (dto.getSuffix().matches(regex4))){ + throw new PLException("500",new String[]{"鍚庣紑涓嶈兘浠ョ┖鏍肩粨灏�"}); + } + if (Func.isNotBlank(dto.getSuffix()) && dto.getSuffix().length() > 32) { + throw new PLException("500",new String[]{"鍚庣紑涓嶈兘瓒呰繃32涓瓧绗�"}); + } + if (dto.getId().length() > 255) { + throw new PLException("500",new String[]{"鍚嶇О涓嶈兘瓒呰繃255涓瓧绗�"}); + } + } + + /** + * dto瀵硅薄杞崲涓篤ersionRule瀵硅薄 + * @return + */ + private VersionRule dto2VersionRule(OsRevisionRuleDTO osRevisionRuleDTO){ + VersionRule newVR = new VersionRule(); + newVR.oid = osRevisionRuleDTO.getOid(); + newVR.name = osRevisionRuleDTO.getId(); + newVR.tag = osRevisionRuleDTO.getName(); + newVR.description = osRevisionRuleDTO.getDescription(); + newVR.jumpCharacter = osRevisionRuleDTO.getJumpCharacter(); + newVR.initialValue = osRevisionRuleDTO.getInitialValue(); + newVR.stepLength = osRevisionRuleDTO.getStepLength(); + newVR.prefixion = osRevisionRuleDTO.getPrefixion(); + newVR.suffix = osRevisionRuleDTO.getSuffix(); + String userName = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); + long timeMillis = System.currentTimeMillis(); + newVR.ts = Func.format((Func.isNotEmpty(osRevisionRuleDTO.getTs()) ? osRevisionRuleDTO.getTs():new Date()),VciDateUtil.DateTimeMillFormat); + newVR.creator = Func.isBlank(osRevisionRuleDTO.getCreator()) ? userName:osRevisionRuleDTO.getCreator(); + newVR.createTime = Func.isEmpty(osRevisionRuleDTO.getCreateTime()) ? timeMillis:osRevisionRuleDTO.getCreateTime().getTime(); + newVR.modifier = userName; + newVR.modifyTime = timeMillis; + return newVR; } /** @@ -93,18 +288,18 @@ try { ruleVO.setCreateTime(VciDateUtil.long2Date(versionRule.createTime)); ruleVO.setLastModifyTime(VciDateUtil.long2Date(versionRule.modifyTime)); - ruleVO.setTs(VciDateUtil.str2Date(versionRule.ts,VciDateUtil.DateTimeFormat)); + ruleVO.setTs(VciDateUtil.str2Date(versionRule.ts,VciDateUtil.DateTimeMillFormat)); } catch (Exception e) { e.printStackTrace(); } ruleVO.setDescription(versionRule.description); ruleVO.setId(versionRule.name); ruleVO.setName(versionRule.tag); - ruleVO.setSerialStep(WebUtil.getInt(versionRule.stepLength)); - ruleVO.setSkipCode(versionRule.jumpCharacter); - ruleVO.setPrefixCode(versionRule.prefixion); - ruleVO.setSuffixCode(versionRule.suffix); - ruleVO.setStartCode(versionRule.initialValue); + ruleVO.setStepLength(WebUtil.getInt(versionRule.stepLength)); + ruleVO.setJumpCharacter(versionRule.jumpCharacter); + ruleVO.setPrefixion(versionRule.prefixion); + ruleVO.setSuffix(versionRule.suffix); + ruleVO.setInitialValue(versionRule.initialValue); //associated鏆傛椂娌℃湁浣跨敤 } return ruleVO; @@ -125,10 +320,260 @@ } /** + * 浣跨敤澶氫釜缂栧彿鑾峰彇瑙勫垯鐨勫�� + * @param vrIdList 缂栧彿 + * @return 鏄剧ず瀵硅薄 + */ + @Override + public List<OsRevisionRuleVO> getRevisionRuleByIds(Collection<String> vrIdList) { + if(Func.isEmpty(vrIdList)){ + return null; + } + Map<String, OsRevisionRuleVO> revisionRuleVOMap = self.selectAllRevisionMap(); + List<OsRevisionRuleVO> versionRuleList = new ArrayList<>(); + vrIdList.stream().forEach(vrId->{ + OsRevisionRuleVO versionRuleVO = revisionRuleVOMap.getOrDefault(vrId.toLowerCase(Locale.ROOT),null); + if(versionRuleVO!=null){ + versionRuleList.add(versionRuleVO); + } + }); + return versionRuleList; + } + + /** + * 鏌ヨ搴旂敤鑼冨洿 + * @param vrName 鐗堟湰瑙勫垯鑻辨枃鍚嶇О + * @return + */ + @Override + public List<Map<String, String>> getUsedVersionRuleList(String vrName) throws PLException { + if(Func.isBlank(vrName)){ + throw new PLException("500",new String[]{"璇烽�夋嫨瑕佹煡璇㈠簲鐢ㄨ寖鍥寸殑灞炴��!"}); + } + String[] btNames = platformClientUtil.getBtmService().getBTNamesByVerName(vrName); + if(Func.isEmpty(btNames)){ + return new ArrayList<>(); + } + List<Map<String,String>> btmNameMapList = new ArrayList<>(); + Arrays.stream(btNames).forEach(btName->{ + Map<String, String> itemMap = new HashMap<>(); + itemMap.put("versionRuleName",vrName); + itemMap.put("source",btName); + btmNameMapList.add(itemMap); + }); + return btmNameMapList; + } + + /** + * 瀵煎嚭閫変腑鐨勭増鏈鍒� + * @param exportFileName 瀵煎嚭鐨勬枃浠跺悕 + * @param vrNames 闇�瑕佸鍑虹殑鐗堟湰瑙勫垯鍚嶇О + * @param flag 鎺у埗瀵煎嚭鐨勫垪鍚嶆槸鍚﹀拰瀵煎叆妯℃澘涓�鑷� + * @return + */ + @Override + public String exportVersionRule(String exportFileName, String vrNames, boolean flag) throws PLException { + if(Func.isBlank(vrNames)){ + throw new PLException("500",new String[]{"璇峰嬀閫夎瀵煎嚭鐨勭増鏈鍒�!"}); + } + //鐣岄潰娌′紶鍚嶇О锛屼娇鐢ㄩ粯璁ゅ鍑哄悕绉� + exportFileName = Func.isBlank(exportFileName) ? "鐗堟湰瑙勫垯瀵煎嚭_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName; + //璁剧疆鍒楀悕 + List<String> columns = this.getCloumns(flag); + + //鍐檈xcel + String excelPath = LocalFileUtil.getDefaultTempFolder() + File.separator + exportFileName + ".xls"; + try { + new File(excelPath).createNewFile(); + } catch (Throwable e) { + throw new VciBaseException(LangBaseUtil.getErrorMsg(e), new String[]{excelPath}, e); + } + //璁剧疆鍒� + List<WriteExcelData> excelDataList = new ArrayList<>(); + //璁剧疆鍒楀ご + for (int index = 0; index < columns.size(); index++) { + excelDataList.add(new WriteExcelData(0,index, columns.get(index))); + } + //鎸夌収鐗堟湰瑙勫垯鍚嶆煡璇紝鐒跺悗澶勭悊鐗堟湰瑙勫垯瀵煎嚭 + List<String> vrIdList = Func.toStrList(vrNames); + List<OsRevisionRuleVO> revisionRuleVOList = this.getRevisionRuleByIds(vrIdList); + if(Func.isEmpty(revisionRuleVOList)){ + excelDataList.add(new WriteExcelData(1,1, "鏍规嵁鍚嶇О鏈煡璇㈠埌鐗堟湰瑙勫垯淇℃伅锛岃鍒锋柊鍚庡皾璇曢噸鏂板鍑猴紒")); + }else{ + for (int i = 0; i < revisionRuleVOList.size(); i++) { + OsRevisionRuleVO revisionRuleVO = revisionRuleVOList.get(i); + excelDataList.add(new WriteExcelData(i+1,0, revisionRuleVO.getId())); + excelDataList.add(new WriteExcelData(i+1,1, revisionRuleVO.getName())); + excelDataList.add(new WriteExcelData(i+1,2, revisionRuleVO.getJumpCharacter())); + excelDataList.add(new WriteExcelData(i+1,3, revisionRuleVO.getInitialValue())); + excelDataList.add(new WriteExcelData(i+1,4, revisionRuleVO.getStepLength())); + excelDataList.add(new WriteExcelData(i+1,5, revisionRuleVO.getPrefixion())); + excelDataList.add(new WriteExcelData(i+1,6, revisionRuleVO.getSuffix())); + excelDataList.add(new WriteExcelData(i+1,7, revisionRuleVO.getDescription())); + if(!flag){ + excelDataList.add(new WriteExcelData(i+1,8, Func.format(revisionRuleVO.getCreateTime(),"yyyy骞碝M鏈坉d鏃� hh:mm:ss"))); + } + } + } + WriteExcelOption excelOption = new WriteExcelOption(excelDataList); + ExcelUtil.writeDataToFile(excelPath, excelOption); + return excelPath; + } + + /** + * 涓嬭浇鐗堟湰瑙勫垯瀵煎叆妯℃澘 + * @param exportFileName + * @return + * @throws PLException + */ + @Override + public String downloadVersionRuleTemplate(String exportFileName) throws Exception { + //鐣岄潰娌′紶鍚嶇О锛屼娇鐢ㄩ粯璁ゅ鍑哄悕绉� + exportFileName = Func.isBlank(exportFileName) ? "鐗堟湰瑙勫垯瀵煎叆妯℃澘_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName; + //璁剧疆鍒楀悕 + List<String> columns = this.getCloumns(true); + //璁剧疆蹇呭~鍒� + ColumnNameisRed.clear(); + ColumnNameisRed.add(0); + ColumnNameisRed.add(3); + ColumnNameisRed.add(4); + + //鍐檈xcel + String excelPath = LocalFileUtil.getDefaultTempFolder() + File.separator + exportFileName + ".xls"; + try { + new File(excelPath).createNewFile(); + } catch (Throwable e) { + throw new VciBaseException(LangBaseUtil.getErrorMsg(e), new String[]{excelPath}, e); + } + //璁剧疆鍒� + List<WriteExcelData> excelDataList = new ArrayList<>(); + //璁剧疆鍒楀ご + for (int index = 0; index < columns.size(); index++) { + //鍒ゆ柇鏄惁涓哄繀濉垪锛岀粰蹇呭~鍒楄缃鑹� + if(ColumnNameisRed.contains(index)){ + WriteExcelData excelData = new WriteExcelData(0, index, columns.get(index)); + excelData.setFontColor(String.valueOf(HSSFColor.HSSFColorPredefined.RED.getIndex())); + excelDataList.add(excelData); + }else{ + excelDataList.add(new WriteExcelData(0,index, columns.get(index))); + } + } + WriteExcelOption excelOption = new WriteExcelOption(excelDataList); + ExcelUtil.writeDataToFile(excelPath, excelOption); + return excelPath; + } + + /** + * 瀵煎叆鐗堟湰瑙勫垯 + * @param file + * @return + */ + @Override + public BaseResult importVersionRules(File file) throws Exception { + VciBaseUtil.alertNotNull(file,"excel鏂囦欢"); + if(!file.exists()){ + throw new VciBaseException("瀵煎叆鐨別xcel鏂囦欢涓嶅瓨鍦�,{0}",new String[]{file.getPath()}); + } + try{ + //1銆佽鍙杄xcel涓殑鏁版嵁锛岀粍鎴愬璞� + ReadExcelOption excelOption = new ReadExcelOption(); + List<OsRevisionRulePO> poList = ExcelUtil.readDataObjectFromExcel(file, OsRevisionRulePO.class,excelOption,(value, po, fieldName)->{}); + //鍘婚櫎閮芥槸绌虹殑鎯呭喌 + if(CollectionUtils.isEmpty(poList)){ + return BaseResult.fail(ExcelLangCodeConstant.IMPORT_CONTENT_NULL,new String[]{}); + } + //excel鍒ら噸锛屾暟鎹牎楠岋紝dto瀵硅薄杞崲锛屽瓨鍌ㄥ璞¤浆鎹紝鎵ц淇濆瓨 + List<OsRevisionRuleDTO> dtoList = new ArrayList<>(); + //褰撳墠excel涓槸鍚﹂噸澶嶇敤鐨勫垽閲峂ap:锛坘ey锛氬垽閲嶇増鏈鍒欏悕锛寁alue锛氳鍙凤級 + Map<String, String> excelReapeat = new HashMap<>(); + //鏁版嵁搴撴煡璇㈡槸鍚︽湁宸插瓨鍦ㄧ殑鏋氫妇鍚嶏紝鏂逛究鍚庣画鍋氬垽閲嶅鐞� + List<OsRevisionRuleVO> versionRuleVOList = this.getRevisionRuleByIds(poList.stream().map(OsRevisionRulePO::getId).collect(Collectors.toSet())); + List<String> repeatVrId = new ArrayList<>(); + if(Func.isNotEmpty(versionRuleVOList)){ + repeatVrId = versionRuleVOList.stream().map(OsRevisionRuleVO::getId).collect(Collectors.toList()); + } + //鍒ゆ柇蹇呭~灞炴�ф槸鍚︿负绌哄拰鍏朵粬鏍¢獙 + List<String> finalRepeatVrId = repeatVrId; + poList.stream().forEach(vrPO -> { + if(Func.isBlank(vrPO.getId())){//鐗堟湰瑙勫垯鍚嶅垽绌� + throw new VciBaseException("绗��"+vrPO.getRowIndex()+"銆戣锛寁ersionrulenameerror"); + }else if(excelReapeat.containsKey(vrPO.getId())){//鐗堟湰瑙勫垯鍚嶈〃鏍间腑鍒ら噸 + throw new VciBaseException("绗��"+excelReapeat.get(vrPO.getId())+"銆戣鍜岀銆�"+vrPO.getRowIndex()+"銆戣鏁版嵁锛屽悕绉伴噸澶�"); + }else if (Func.isNotEmpty(finalRepeatVrId) && finalRepeatVrId.contains(vrPO.getId())){//鍒ゆ柇鍚嶇О鏄惁涓庣郴缁熶腑閲嶅 + throw new VciBaseException("绗��"+vrPO.getRowIndex()+"銆戣锛屽悕绉板湪绯荤粺涓凡缁忓瓨鍦�,璇蜂慨鏀�!"); + } + + //鐗堟湰瑙勫垯鍚峞xcel涓垽閲嶅鐞� + excelReapeat.put(vrPO.getId(),vrPO.getRowIndex()); + OsRevisionRuleDTO revisionRuleDTO = new OsRevisionRuleDTO(); + //revisionRuleDTO.setOid(VciBaseUtil.getPk().toUpperCase(Locale.ROOT)); + revisionRuleDTO.setId(vrPO.getId()); + revisionRuleDTO.setName(vrPO.getName()); + revisionRuleDTO.setJumpCharacter(vrPO.getJumpCharacter()); + revisionRuleDTO.setInitialValue(vrPO.getInitialValue()); + revisionRuleDTO.setStepLength(vrPO.getStepLength()); + revisionRuleDTO.setPrefixion(vrPO.getPrefixion()); + revisionRuleDTO.setSuffix(vrPO.getSuffix()); + revisionRuleDTO.setDescription(vrPO.getDescription()); + try { + //妫�鏌ョ増鏈鍒欐槸鍚﹀悎瑙� + checkVersionRule(revisionRuleDTO); + } catch (PLException e) { + e.printStackTrace(); + throw new VciBaseException(VciBaseUtil.getExceptionMessage(e)); + } + dtoList.add(revisionRuleDTO); + }); + //鎵ц淇濆瓨鎿嶄綔 + dtoList.stream().forEach(dto->{ + try { + boolean b = platformClientUtil.getVersionService().addVersionRule(dto2VersionRule(dto)); + if(!b){ + throw new VciBaseException("save and return false"); + } + } catch (PLException e) { + e.printStackTrace(); + throw new VciBaseException("鎵ц淇濆瓨鏃跺嚭鐜伴敊璇紝閿欒鐗堟湰瑙勫垯瀵硅薄鍚嶄负锛氥��" + dto.getId() + "銆戯紝鍘熷洜锛�"+VciBaseUtil.getExceptionMessage(e)); + } + }); + }catch (Exception e){ + if(logger.isErrorEnabled()){ + logger.error("璇诲彇excel鍐呭鏃舵垨淇濆瓨鐢ㄦ埛淇℃伅鏃跺嚭鐜颁簡閿欒锛屽叿浣撳師鍥狅細",VciBaseUtil.getExceptionMessage(e)); + } + e.printStackTrace(); + return BaseResult.fail(VciBaseUtil.getExceptionMessage(e),new String[]{},e); + } + return BaseResult.success("鏋氫妇瀵煎叆鎴愬姛锛�"); + } + + /** + * 鑾峰彇瀵煎嚭鎴栧鍏ユā鏉跨殑鍒楀悕 + * @param flag 鏄惁鑾峰彇瀵煎叆妯℃澘鍒楀悕 + * @return + */ + private List<String> getCloumns(boolean flag){ + if(flag){ + return new ArrayList<>( + Arrays.asList( + "鍚嶇О", "鏍囩", "璺宠穬瀛楃锛堜互閫楀彿鍒嗛殧锛�", + "鍒濆鍊�", "姝ラ暱", "鍓嶇紑", "鍚庣紑", "鎻忚堪" + ) + ); + } + return new ArrayList<>( + Arrays.asList( + "鍚嶇О", "鏍囩", "璺宠穬瀛楃", "鍒濆鍊�", "姝ラ暱", + "鍓嶇紑", "鍚庣紑", "鎻忚堪", "鍒涘缓鏃堕棿" + ) + ); + } + + /** * 娓呴櫎缂撳瓨 */ @Override public void clearCache() { } + } diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsStatusServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsStatusServiceImpl.java index 033c3f4..52e0be9 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsStatusServiceImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsStatusServiceImpl.java @@ -1,11 +1,7 @@ package com.vci.web.service.impl; import com.vci.corba.common.PLException; -import com.vci.corba.omd.atm.AttributeDef; import com.vci.corba.omd.stm.StatePool; -import com.vci.dto.OsAttributeDTO; -import com.vci.pagemodel.OsEnumVO; -import com.vci.po.OsAttributePO; import com.vci.po.OsStatusPO; import com.vci.starter.poi.bo.ReadExcelOption; import com.vci.starter.poi.bo.WriteExcelData; @@ -280,17 +276,19 @@ public boolean addSave(OsStatusDTO statusDTO) throws Exception { VciBaseUtil.alertNotNull( statusDTO,"鐘舵�佺殑淇℃伅", - statusDTO.getId(),"鐘舵�佺殑鑻辨枃鍚嶇О", - statusDTO.getName(),"鐘舵�佺殑涓枃鍚嶇О" + statusDTO.getId(),"鐘舵�佺殑鑻辨枃鍚嶇О" ); - StatePool dbStatePool = platformClientUtil.getStatePoolService().getStatePool(statusDTO.getId()); - if (Func.isNotEmpty(dbStatePool) && Func.isNotBlank(dbStatePool.oid)) { - throw new PLException("500",new String[]{"鍚嶇О閲嶅璇锋洿鎹㈠悕绉帮紒"}); + if (statusDTO.getId().length()>50) { + throw new PLException("500",new String[]{"鐘舵�佽嫳鏂囧悕绉颁笉鑳借秴杩�50涓瓧绗︼紒"}); } // 鐘舵�佹睜鍚嶇О鍙兘涓鸿嫳鏂囧瓧姣� String regex = "[a-z A-Z]*"; - if ((!statusDTO.getId().matches(regex))) { + if (!statusDTO.getId().matches(regex)) { throw new PLException("500",new String[]{"鍚嶇О鍙兘涓鸿嫳鏂囷紒"}); + } + StatePool dbStatePool = platformClientUtil.getStatePoolService().getStatePool(statusDTO.getId()); + if (Func.isNotEmpty(dbStatePool) && Func.isNotBlank(dbStatePool.oid)) { + throw new PLException("500",new String[]{"鍚嶇О閲嶅璇锋洿鎹㈠悕绉帮紒"}); } //铏界劧浼氳嚜鍔ㄧ敓鎴恛id锛屼絾鏄繖鍎胯缃富閿紝閬垮厤鏀惧叆缂撳瓨鐨勬暟鎹槸娌℃湁oid鐨� statusDTO.setOid(VciBaseUtil.getPk().toUpperCase(Locale.ROOT)); @@ -351,26 +349,23 @@ for(OsStatusDTO statusDTO : osStatusDTOS){ //oid鍜宼s鍒ょ┖ String oid = statusDTO.getOid(); - //name涓昏鐢ㄦ潵瀵圭紦瀛樻暟鎹垹闄� - String name = statusDTO.getName(); + //id涓昏鐢ㄦ潵瀵圭紦瀛樻暟鎹垹闄� + String id = statusDTO.getId(); //鍚庡彴浼氱敤ts杩涜鏁版嵁涓�鑷存�ф牎楠� Date ts = statusDTO.getTs(); - if(Func.isBlank(oid) || Func.isBlank(name) || Func.isEmpty(ts)){ + if(Func.isBlank(oid) || Func.isBlank(id) || Func.isEmpty(ts)){ throw new PLException("500",new String[]{"寰呭垹闄ょ殑鐘舵�佸垪琛ㄤ腑涓婚敭銆恛id銆戙�佽皟鏁存椂闂淬�恡s銆戙�佺姸鎬佸悕绉般�恘ame銆戜笉鑳戒负绌猴紒"}); } StatePool statePool = new StatePool(); statePool.oid = oid; - statePool.name = name; + statePool.name = id; statePool.ts = Func.format(ts,VciDateUtil.DateTimeMillFormat); statePoolList.add(statePool); - boolean res = platformClientUtil.getStatePoolService().deleteStatePool(statePool); - if(!res){ - throw new PLException("500",new String[]{"鍒犻櫎鐘舵�佸悕绉颁负銆�" + name + "銆戠殑鏁版嵁鏃跺嚭鐜伴敊璇�!"}); - } } + boolean res = platformClientUtil.getStatePoolService().deleteStatePools(statePoolList.toArray(new StatePool[statePoolList.size()])); //clearCache(); self.selectAllStatusMap(); - return true; + return res; } /** @@ -384,7 +379,7 @@ statePool.oid = statusDTO.getOid(); statePool.id = ""; statePool.name = statusDTO.getId(); - statePool.imagePath = statusDTO.getImagePath(); + //statePool.imagePath = statusDTO.getImagePath(); statePool.description = statusDTO.getDescription()==null?"":statusDTO.getDescription(); String userId = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); long now = VciDateUtil.getNowTime(); @@ -404,14 +399,14 @@ * @return */ @Override - public String exportStatus(String exportFileName, String statusOids) throws PLException { + public String exportStatus(String exportFileName, String statusOids,boolean flag/*鎺у埗瀵煎嚭鐨勫垪鍚嶆槸鍚﹀拰瀵煎叆妯℃澘涓�鑷�*/) throws PLException { if(Func.isBlank(statusOids)){ throw new PLException("500",new String[]{"璇峰嬀閫夎瀵煎嚭鐨勫睘鎬�!"}); } //鐣岄潰娌′紶鍚嶇О锛屼娇鐢ㄩ粯璁ゅ鍑哄悕绉� exportFileName = Func.isBlank(exportFileName) ? "鐘舵�佹睜鐘舵�佸鍑篲" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName; //璁剧疆鍒楀悕 - List<String> columns = new ArrayList<>(Arrays.asList("鍚嶇О", "鏍囩", "鍥剧墖", "鎻忚堪")); + List<String> columns = this.getCloumns(flag); //鍐檈xcel String excelPath = LocalFileUtil.getDefaultTempFolder() + File.separator + exportFileName + ".xls"; @@ -433,7 +428,7 @@ OsStatusVO osStatusVO = this.getObjectByOid(oid); excelDataList.add(new WriteExcelData(i.get(),0, osStatusVO.getId())); excelDataList.add(new WriteExcelData(i.get(),1, osStatusVO.getName())); - excelDataList.add(new WriteExcelData(i.get(),2, osStatusVO.getImagePath())); + //excelDataList.add(new WriteExcelData(i.get(),2, osStatusVO.getImagePath())); excelDataList.add(new WriteExcelData(i.get(),3, osStatusVO.getDescription())); i.getAndIncrement(); }); @@ -453,9 +448,7 @@ //鐣岄潰娌′紶鍚嶇О锛屼娇鐢ㄩ粯璁ゅ鍑哄悕绉� exportFileName = Func.isBlank(exportFileName) ? "鐘舵�佹睜瀵煎叆妯℃澘_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName; //璁剧疆鍒楀悕 - List<String> columns = new ArrayList<>( - Arrays.asList("鍚嶇О(涓嶈兘涓虹┖)", "鏍囩(瀵瑰悕绉扮殑瑙i噴)","鍥剧墖(璺緞)", "鎻忚堪(鍙互涓虹┖)") - ); + List<String> columns = this.getCloumns(true); //璁剧疆蹇呭~鍒� ColumnNameisRed.clear(); ColumnNameisRed.add(0); @@ -486,6 +479,20 @@ } /** + * 鑾峰彇瀵煎嚭鎴栧鍏ユā鏉跨殑鍒楀悕 + * @param flag 鏄惁鑾峰彇瀵煎叆妯℃澘鍒楀悕 + * @return + */ + private List<String> getCloumns(boolean flag){ + if(flag){ + return new ArrayList<>( + Arrays.asList("鍚嶇О(涓嶈兘涓虹┖)", "鏍囩(瀵瑰悕绉扮殑瑙i噴)"/*,"鍥剧墖(璺緞)"*/, "鎻忚堪(鍙互涓虹┖)") + ); + } + return new ArrayList<>(Arrays.asList("鍚嶇О", "鏍囩"/*, "鍥剧墖"*/, "鎻忚堪")); + } + + /** * 瀵煎叆鐘舵�� * @param file * @return @@ -508,7 +515,6 @@ List<StatePool> statePoolList = new ArrayList<>(); //褰撳墠excel涓槸鍚﹂噸澶嶇敤鐨勫垽閲峂ap:锛坘ey锛氬垽閲嶅睘鎬э紝value锛氳鍙凤級 Map<String, String> excelReapeat = new HashMap<>(); - //鍒ゆ柇蹇呭~灞炴�ф槸鍚︿负绌猴紝鐢ㄦ埛鏄惁宸插瓨鍦紝浠ュ強閮ㄩ棬鏄惁濉敊绛夋牎楠岄�昏緫 poList.stream().forEach(osStatusPO -> { try { StatePool dbStatePool = platformClientUtil.getStatePoolService().getStatePool(osStatusPO.getId()); @@ -518,14 +524,14 @@ } catch (PLException e) { e.printStackTrace(); logger.error(e.getMessage()); - throw new VciBaseException(e.getMessage()); + throw new VciBaseException(VciBaseUtil.getExceptionMessage(e)); } - if(Func.isBlank(osStatusPO.getId())){//灞炴�у悕鍒ょ┖ - throw new VciBaseException("绗��"+osStatusPO.getRowIndex()+"銆戣锛宔numnameerror"); + if(Func.isBlank(osStatusPO.getId())){//鐘舵�佸悕鍒ょ┖ + throw new VciBaseException("绗��"+osStatusPO.getRowIndex()+"銆戣锛宻tatusnameerror"); }else if(!osStatusPO.getId().matches("[a-z A-Z]*")){ // 鐘舵�佹睜鍚嶇О鍙兘涓鸿嫳鏂囧瓧姣� throw new VciBaseException("鍚嶇О鍙兘涓鸿嫳鏂囷紒"); - }else if(excelReapeat.containsKey(osStatusPO.getId())){//灞炴�у悕琛ㄦ牸涓垽閲� + }else if(excelReapeat.containsKey(osStatusPO.getId())){//鐘舵�佸悕琛ㄦ牸涓垽閲� throw new VciBaseException("绗��"+excelReapeat.get(osStatusPO.getId())+"銆戣鍜岀銆�"+osStatusPO.getRowIndex()+"銆戣鏁版嵁锛屽悕绉伴噸澶�"); } //鐘舵�佸悕excel涓垽閲嶅鐞� @@ -534,7 +540,7 @@ osStatusDTO.setOid(VciBaseUtil.getPk().toUpperCase(Locale.ROOT)); osStatusDTO.setId(osStatusPO.getId()); osStatusDTO.setName(osStatusPO.getName()); - osStatusDTO.setImagePath(osStatusPO.getImagePath()); + //osStatusDTO.setImagePath(osStatusPO.getImagePath()); osStatusDTO.setDescription(osStatusPO.getDescription()); statePoolList.add(statusDTO2DO(osStatusDTO)); @@ -548,7 +554,7 @@ e.printStackTrace(); return BaseResult.fail(VciBaseUtil.getExceptionMessage(e),new String[]{},e); } - return BaseResult.success("鏋氫妇瀵煎叆鎴愬姛锛�"); + return BaseResult.success("鐘舵�佸鍏ユ垚鍔燂紒"); } /** diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIDataServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIDataServiceImpl.java index f2ea563..5d53a0d 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIDataServiceImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIDataServiceImpl.java @@ -2042,7 +2042,7 @@ if (ruleVO == null || StringUtils.isBlank(ruleVO.getOid())) { throw new VciBaseException("{0}閲岀殑鐗堟湰瑙勫垯璁剧疆寰椾笉姝g‘锛屽湪绯荤粺涓病鏈夋壘鍒皗1}杩欎釜鐗堟湰瑙勫垯", new String[]{btmTypeVO.getName(), btmTypeVO.getRevisionRuleId()}); } - cbo.revisionValue = ruleVO.getStartCode(); + cbo.revisionValue = ruleVO.getInitialValue(); } if (StringUtils.isBlank(cbo.nameoid)) { cbo.nameoid = VciBaseUtil.getPk(); diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBoServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBoServiceImpl.java index 31f0204..12701d1 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBoServiceImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBoServiceImpl.java @@ -196,7 +196,7 @@ bo.versionRule = String.valueOf(btmTypeVO.getVersionRule()); if(StringUtils.isNotBlank(btmTypeVO.getRevisionRuleId())){ OsRevisionRuleVO revisionRuleVO = revisionRuleService.getRevisionRuleById(btmTypeVO.getRevisionRuleId()); - bo.revisionValue = revisionRuleVO.getStartCode(); + bo.revisionValue = revisionRuleVO.getInitialValue(); } bo.revisionSeq = (short) 1; -- Gitblit v1.9.3