Source/UBCS/ubcs-service-api/ubcs-code-api/pom.xml
@@ -58,6 +58,18 @@ <artifactId>staxon</artifactId> <version>1.3</version> </dependency>--> <!-- poi --> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>4.1.0</version> </dependency> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml</artifactId> <version>4.1.0</version> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/dto/CodeOsattributeDTO.javacopy from Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/dto/CodeCodeAllcodeDTO.java copy to Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/dto/CodeOsattributeDTO.java
Îļþ´Ó Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/dto/CodeCodeAllcodeDTO.java ¸´ÖÆ @@ -16,19 +16,19 @@ */ package com.vci.ubcs.code.dto; import com.vci.ubcs.code.entity.CodeAllCode; import com.vci.ubcs.code.entity.CodeOsattributeEntity; import lombok.Data; import lombok.EqualsAndHashCode; /** * å ¨é¨ç å¼ æ°æ®ä¼ è¾å¯¹è±¡å®ä½ç±» * 屿§æ¾ç¤ºå¯¹è±¡ æ°æ®ä¼ è¾å¯¹è±¡å®ä½ç±» * * @author ludc * @since 2023-04-03 * @author yuxc * @since 2023-04-14 */ @Data @EqualsAndHashCode(callSuper = true) public class CodeCodeAllcodeDTO extends CodeAllCode { public class CodeOsattributeDTO extends CodeOsattributeEntity { private static final long serialVersionUID = 1L; } Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/dto/CodeOsbtmtypeDTO.javacopy from Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/dto/CodeCodeAllcodeDTO.java copy to Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/dto/CodeOsbtmtypeDTO.java
Îļþ´Ó Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/dto/CodeCodeAllcodeDTO.java ¸´ÖÆ @@ -16,19 +16,19 @@ */ package com.vci.ubcs.code.dto; import com.vci.ubcs.code.entity.CodeAllCode; import com.vci.ubcs.code.entity.CodeOsbtmtypeEntity; import lombok.Data; import lombok.EqualsAndHashCode; /** * å ¨é¨ç å¼ æ°æ®ä¼ è¾å¯¹è±¡å®ä½ç±» * ä¸å¡ç±»å æ°æ®ä¼ è¾å¯¹è±¡å®ä½ç±» * * @author ludc * @since 2023-04-03 * @author yuxc * @since 2023-04-13 */ @Data @EqualsAndHashCode(callSuper = true) public class CodeCodeAllcodeDTO extends CodeAllCode { public class CodeOsbtmtypeDTO extends CodeOsbtmtypeEntity { private static final long serialVersionUID = 1L; } Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeOsattributeEntity.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,102 @@ /* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill åºéª (smallchill@163.com) */ package com.vci.ubcs.code.entity; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.Date; import lombok.EqualsAndHashCode; import org.springblade.core.tenant.mp.TenantEntity; /** * 屿§æ¾ç¤ºå¯¹è±¡ å®ä½ç±» * * @author yuxc * @since 2023-04-14 */ @Data @TableName("PL_CODE_OSATTRIBUTE") @ApiModel(value = "CodeOsattribute对象", description = "屿§æ¾ç¤ºå¯¹è±¡") @EqualsAndHashCode(callSuper = true) public class CodeOsattributeEntity extends BaseModel { /** * 屿§ç±»åï¼ä½¿ç¨æä¸¾VCIFIELDTYPEENUM */ @ApiModelProperty(value = "屿§ç±»åï¼ä½¿ç¨æä¸¾VCIFIELDTYPEENUM") private String attributedatatype; /** * 屿§ç±»åæ¾ç¤ºææ¬ */ @ApiModelProperty(value = "屿§ç±»åæ¾ç¤ºææ¬") private String attributedatatypetext; /** * æ¯å¦å¯ä»¥ä¸ºç©º */ @ApiModelProperty(value = "æ¯å¦å¯ä»¥ä¸ºç©º") private String nullableflag; /** * é»è®¤å¼ */ @ApiModelProperty(value = "é»è®¤å¼") private String defaultvalue; /** * ä½¿ç¨æä¸¾è±æåç§° */ @ApiModelProperty(value = "ä½¿ç¨æä¸¾è±æåç§°") private String enumid; /** * ä½¿ç¨æä¸¾ç䏿åç§° */ @ApiModelProperty(value = "ä½¿ç¨æä¸¾ç䏿åç§°") private String enumname; /** * åç §çä¸å¡ç±»åç¼å· */ @ApiModelProperty(value = "åç §çä¸å¡ç±»åç¼å·") private String btmtypeid; /** * åç §çä¸å¡ç±»ååç§° */ @ApiModelProperty(value = "åç §çä¸å¡ç±»ååç§°") private String btmtypename; /** * 屿§çé¿åº¦ */ @ApiModelProperty(value = "屿§çé¿åº¦") private Short attrlength; /** * å°æ°ç²¾åº¦ä½æ° */ @ApiModelProperty(value = "å°æ°ç²¾åº¦ä½æ°") private Short precisionlength; /** * å°æ°å»åº¦ä½æ° */ @ApiModelProperty(value = "å°æ°å»åº¦ä½æ°") private Short scalelength; /** * åå¼èå´ */ @ApiModelProperty(value = "åå¼èå´") private String range; } Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeOsbtmtypeEntity.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,118 @@ /* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill åºéª (smallchill@163.com) */ package com.vci.ubcs.code.entity; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.EqualsAndHashCode; /** * ä¸å¡ç±»å å®ä½ç±» * * @author yuxc * @since 2023-04-13 */ @Data @TableName("PL_CODE_OSBTMTYPE") @ApiModel(value = "PLCodeOsbtmtype对象", description = "ä¸å¡ç±»å") @EqualsAndHashCode(callSuper = true) public class CodeOsbtmtypeEntity extends BaseModel { /** * åºåå */ private static final long serialVersionUID = -7142347409100551299L; /** * æ°æ®åºè¡¨çåç§° */ @ApiModelProperty(value = "æ°æ®åºè¡¨çåç§°") private String tableName; /** * çæ¬è§åçç¼å· */ @ApiModelProperty(value = "çæ¬è§åçç¼å·") private String revisionruleid; /** * çæ¬è§åçåç§° */ @ApiModelProperty(value = "çæ¬è§åçåç§°") private String revisionrulename; /** * åé符 */ @ApiModelProperty(value = "åé符") private Short revisionsep; /** * æ¯å¦æå¨è¾å ¥çæ¬ */ @ApiModelProperty(value = "æ¯å¦æå¨è¾å ¥çæ¬") private String inputrevisionflag; /** * æ¯å¦æ§å¶å¯çº§ */ @ApiModelProperty(value = "æ¯å¦æ§å¶å¯çº§") private String secretflag; /** * æ¯å¦æ½è±¡å */ @ApiModelProperty(value = "æ¯å¦æ½è±¡å") private String abstractflag; /** * å®ä¾åç±» */ @ApiModelProperty(value = "å®ä¾åç±»") private String implclass; /** * C# */ @ApiModelProperty(value = "C#") private String shape; /** * çå½å¨æçè±æåç§° */ @ApiModelProperty(value = "çå½å¨æçè±æåç§°") private String lifecycleid; /** * çå½å¨æç䏿åç§° */ @ApiModelProperty(value = "çå½å¨æç䏿åç§°") private String lifecyclename; /** * å¤ç¨çå½å¨æè±æåç§° */ @ApiModelProperty(value = "å¤ç¨çå½å¨æè±æåç§°") private String sublifecycleid; /** * å¤ç¨çå½å¨æä¸æåç§° */ @ApiModelProperty(value = "å¤ç¨çå½å¨æä¸æåç§°") private String sublifecyclename; /** * æ¯å¦ä¸ºè§å¾ */ @ApiModelProperty(value = "æ¯å¦ä¸ºè§å¾") private String viewflag; /** * è§å¾å建çSQLè¯å¥ */ @ApiModelProperty(value = "è§å¾å建çSQLè¯å¥") private String viewcreatesql; } Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/vo/CodeOsattributeVO.javacopy from Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/dto/CodeCodeAllcodeDTO.java copy to Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/vo/CodeOsattributeVO.java
Îļþ´Ó Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/dto/CodeCodeAllcodeDTO.java ¸´ÖÆ @@ -14,21 +14,22 @@ * this software without specific prior written permission. * Author: Chill åºéª (smallchill@163.com) */ package com.vci.ubcs.code.dto; package com.vci.ubcs.code.vo; import com.vci.ubcs.code.entity.CodeAllCode; import com.vci.ubcs.code.entity.CodeOsattributeEntity; import org.springblade.core.tool.node.INode; import lombok.Data; import lombok.EqualsAndHashCode; /** * å ¨é¨ç å¼ æ°æ®ä¼ è¾å¯¹è±¡å®ä½ç±» * 屿§æ¾ç¤ºå¯¹è±¡ è§å¾å®ä½ç±» * * @author ludc * @since 2023-04-03 * @author yuxc * @since 2023-04-14 */ @Data @EqualsAndHashCode(callSuper = true) public class CodeCodeAllcodeDTO extends CodeAllCode { public class CodeOsattributeVO extends CodeOsattributeEntity { private static final long serialVersionUID = 1L; } Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/vo/CodeOsbtmtypeVO.javacopy from Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/dto/CodeCodeAllcodeDTO.java copy to Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/vo/CodeOsbtmtypeVO.java
Îļþ´Ó Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/dto/CodeCodeAllcodeDTO.java ¸´ÖÆ @@ -14,21 +14,21 @@ * this software without specific prior written permission. * Author: Chill åºéª (smallchill@163.com) */ package com.vci.ubcs.code.dto; package com.vci.ubcs.code.vo; import com.vci.ubcs.code.entity.CodeAllCode; import com.vci.ubcs.code.entity.CodeOsbtmtypeEntity; import lombok.Data; import lombok.EqualsAndHashCode; /** * å ¨é¨ç å¼ æ°æ®ä¼ è¾å¯¹è±¡å®ä½ç±» * ä¸å¡ç±»å è§å¾å®ä½ç±» * * @author ludc * @since 2023-04-03 * @author yuxc * @since 2023-04-13 */ @Data @EqualsAndHashCode(callSuper = true) public class CodeCodeAllcodeDTO extends CodeAllCode { public class CodeOsbtmtypeVO extends CodeOsbtmtypeEntity { private static final long serialVersionUID = 1L; } Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/vo/CodeOsbtmtypeattributeVO.javacopy from Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/dto/CodeCodeAllcodeDTO.java copy to Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/vo/CodeOsbtmtypeattributeVO.java
Îļþ´Ó Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/dto/CodeCodeAllcodeDTO.java ¸´ÖÆ @@ -14,21 +14,22 @@ * this software without specific prior written permission. * Author: Chill åºéª (smallchill@163.com) */ package com.vci.ubcs.code.dto; package com.vci.ubcs.code.vo; import com.vci.ubcs.code.entity.CodeAllCode; import com.vci.ubcs.code.entity.CodeOsbtmtypeattributeEntity; import org.springblade.core.tool.node.INode; import lombok.Data; import lombok.EqualsAndHashCode; /** * å ¨é¨ç å¼ æ°æ®ä¼ è¾å¯¹è±¡å®ä½ç±» * ä¸å¡ç±»åå å«ç屿§ è§å¾å®ä½ç±» * * @author ludc * @since 2023-04-03 * @author yuxc * @since 2023-04-14 */ @Data @EqualsAndHashCode(callSuper = true) public class CodeCodeAllcodeDTO extends CodeAllCode { public class CodeOsbtmtypeattributeVO extends CodeOsbtmtypeattributeEntity { private static final long serialVersionUID = 1L; } Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/com/vci/starter/bo/WriteExcelData.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,244 @@ package com.vci.ubcs.com.vci.starter.bo; import java.util.List; public class WriteExcelData { private int row; private int col; private Object obj; private boolean merged = false; private int rowTo; private int colTo; private boolean copyStyle = false; private int copyStyleRow; private int copyStyleCol; private boolean center; private boolean formula = false; private boolean nameRefer = false; private boolean validation = false; private List<String> validationDataList; private String validationErrorMsg; private String fontColor; private String align; private String dateFormat; private boolean readOnly; private Integer width; public String getFontColor() { return this.fontColor; } public void setFontColor(String fontColor) { this.fontColor = fontColor; } public String getAlign() { return this.align; } public void setAlign(String align) { this.align = align; } public List<String> getValidationDataList() { return this.validationDataList; } public void setValidationDataList(List<String> validationDataList) { this.validationDataList = validationDataList; } public WriteExcelData() { } public WriteExcelData(int row, int col, Object obj) { this.row = row; this.col = col; this.obj = obj; } public void writeFormula(int row, int col, String foumula) { this.row = row; this.col = col; this.obj = foumula; this.formula = true; } public void writeNameRefer(int row, int col, int rowTo, int colTo, String name) { this.row = row; this.col = col; this.obj = name; this.nameRefer = true; this.rowTo = rowTo; this.colTo = colTo; } public void writeComboBox(List<String> comboBoxData, int row, int col, int rowTo, int colTo) { this.writeComboBox(comboBoxData, (String)null, row, col, rowTo, colTo); } public void writeComboBox(List<String> comboBoxData, String errorMsg, int row, int col, int rowTo, int colTo) { this.validationDataList = comboBoxData; this.validation = true; this.validationErrorMsg = errorMsg; this.row = row; this.col = col; this.rowTo = rowTo; this.colTo = colTo; } public void writeUseRefer(String referFormula, int row, int col, int rowTo, int colTo) { this.writeUseRefer(referFormula, (String)null, row, col, rowTo, colTo); } public void writeUseRefer(String referFormula, String errorMsg, int row, int col, int rowTo, int colTo) { this.validation = true; this.obj = referFormula; this.validationErrorMsg = errorMsg; this.row = row; this.col = col; this.rowTo = rowTo; this.colTo = colTo; } public boolean isReadOnly() { return this.readOnly; } public void setReadOnly(boolean readOnly) { this.readOnly = readOnly; } public int getRow() { return this.row; } public void setRow(int row) { this.row = row; } public int getCol() { return this.col; } public void setCol(int col) { this.col = col; } public Object getObj() { return this.obj; } public void setObj(Object obj) { this.obj = obj; } public boolean isMerged() { return this.merged; } public void setMerged(boolean merged) { this.merged = merged; } public int getRowTo() { return this.rowTo; } public void setRowTo(int rowTo) { this.rowTo = rowTo; } public int getColTo() { return this.colTo; } public void setColTo(int colTo) { this.colTo = colTo; } public boolean isCopyStyle() { return this.copyStyle; } public void setCopyStyle(boolean copyStyle) { this.copyStyle = copyStyle; } public int getCopyStyleRow() { return this.copyStyleRow; } public void setCopyStyleRow(int copyStyleRow) { this.copyStyleRow = copyStyleRow; } public int getCopyStyleCol() { return this.copyStyleCol; } public void setCopyStyleCol(int copyStyleCol) { this.copyStyleCol = copyStyleCol; } public boolean isCenter() { return this.center; } public void setCenter(boolean center) { this.center = center; } public boolean isFormula() { return this.formula; } public void setFormula(boolean formula) { this.formula = formula; } public boolean isNameRefer() { return this.nameRefer; } public void setNameRefer(boolean nameRefer) { this.nameRefer = nameRefer; } public boolean isValidation() { return this.validation; } public void setValidation(boolean validation) { this.validation = validation; } public String getValidationErrorMsg() { return this.validationErrorMsg; } public void setValidationErrorMsg(String validationErrorMsg) { this.validationErrorMsg = validationErrorMsg; } public String getDateFormat() { return this.dateFormat; } public void setDateFormat(String dateFormat) { this.dateFormat = dateFormat; } public Integer getWidth() { return this.width; } public void setWidth(Integer width) { this.width = width; } public String toString() { return "WriteExcelData{row=" + this.row + ", col=" + this.col + ", obj=" + this.obj + ", merged=" + this.merged + ", rowTo=" + this.rowTo + ", colTo=" + this.colTo + ", copyStyle=" + this.copyStyle + ", copyStyleRow=" + this.copyStyleRow + ", copyStyleCol=" + this.copyStyleCol + ", center=" + this.center + ", formula=" + this.formula + ", nameRefer=" + this.nameRefer + ", validation=" + this.validation + ", validationDataList=" + this.validationDataList + ", validationErrorMsg='" + this.validationErrorMsg + '\'' + ", fontColor='" + this.fontColor + '\'' + ", align='" + this.align + '\'' + ", dateFormat='" + this.dateFormat + '\'' + ", readOnly=" + this.readOnly + '}'; } } Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/com/vci/starter/poi/annotation/ExcelColumn.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,28 @@ package com.vci.ubcs.com.vci.starter.poi.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target({ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) public @interface ExcelColumn { String value(); boolean nullable() default true; String enumId() default ""; String regExg() default ""; String regExgTitle() default ""; String group() default ""; boolean rowIndexColumn() default false; boolean readOnly() default false; int width() default 0; } Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/com/vci/starter/poi/annotation/ExcelTitle.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,12 @@ package com.vci.ubcs.com.vci.starter.poi.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface ExcelTitle { int rowIndexForTitle() default 1; } Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/com/vci/starter/poi/bo/AppendDataExcelOption.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,60 @@ package com.vci.ubcs.com.vci.starter.poi.bo; import java.io.Serializable; import java.util.List; public class AppendDataExcelOption implements Serializable { private int titleRowIndex = 0; private String sheetName; private List<String> writeFields; private List<String> readOnlyFields; private boolean readOnlyFromField = false; public AppendDataExcelOption() { } public int getTitleRowIndex() { return this.titleRowIndex; } public void setTitleRowIndex(int titleRowIndex) { this.titleRowIndex = titleRowIndex; } public String getSheetName() { return this.sheetName; } public void setSheetName(String sheetName) { this.sheetName = sheetName; } public List<String> getWriteFields() { return this.writeFields; } public void setWriteFields(List<String> writeFields) { this.writeFields = writeFields; } public List<String> getReadOnlyFields() { return this.readOnlyFields; } public void setReadOnlyFields(List<String> readOnlyFields) { this.readOnlyFields = readOnlyFields; } public boolean isReadOnlyFromField() { return this.readOnlyFromField; } public void setReadOnlyFromField(boolean readOnlyFromField) { this.readOnlyFromField = readOnlyFromField; } public String toString() { return "AppendDataExcelOption{titleRowIndex=" + this.titleRowIndex + ", sheetName='" + this.sheetName + '\'' + ", writeFields=" + this.writeFields + ", readOnlyFields=" + this.readOnlyFields + ", readOnlyFromField=" + this.readOnlyFromField + '}'; } } Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/com/vci/starter/poi/bo/DownloadTempOption.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,42 @@ package com.vci.ubcs.com.vci.starter.poi.bo; import java.io.Serializable; public class DownloadTempOption implements Serializable { private Integer defaultRowSize = 1000; private String excelName; private String sheetName; public DownloadTempOption(String excelName) { this.excelName = excelName; } public String getExcelName() { return this.excelName; } public void setExcelName(String excelName) { this.excelName = excelName; } public Integer getDefaultRowSize() { return this.defaultRowSize; } public void setDefaultRowSize(Integer defaultRowSize) { this.defaultRowSize = defaultRowSize; } public String getSheetName() { return this.sheetName; } public void setSheetName(String sheetName) { this.sheetName = sheetName; } public String toString() { return "DownloadTempOption{defaultRowSize=" + this.defaultRowSize + '}'; } } Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/com/vci/starter/poi/bo/ExcelColumnMap.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,71 @@ package com.vci.ubcs.com.vci.starter.poi.bo; public class ExcelColumnMap { private String title; private String columnName; private boolean nullable = true; private String regExg; private String regExgTitle; private String group; public ExcelColumnMap() { } public ExcelColumnMap(String title, String columnName) { this.title = title; this.columnName = columnName; } public String getTitle() { return this.title; } public void setTitle(String title) { this.title = title; } public String getColumnName() { return this.columnName; } public void setColumnName(String columnName) { this.columnName = columnName; } public boolean isNullable() { return this.nullable; } public void setNullable(boolean nullable) { this.nullable = nullable; } public String getRegExg() { return this.regExg; } public void setRegExg(String regExg) { this.regExg = regExg; } public String getRegExgTitle() { return this.regExgTitle; } public void setRegExgTitle(String regExgTitle) { this.regExgTitle = regExgTitle; } public String getGroup() { return this.group; } public void setGroup(String group) { this.group = group; } public String toString() { return "ExcelColumnMap{title='" + this.title + '\'' + ", columnName='" + this.columnName + '\'' + ", nullable=" + this.nullable + ", regExg='" + this.regExg + '\'' + ", regExgTitle='" + this.regExgTitle + '\'' + ", group='" + this.group + '\'' + '}'; } } Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/com/vci/starter/poi/bo/ReadExcelOption.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,69 @@ package com.vci.ubcs.com.vci.starter.poi.bo; import java.util.List; import java.util.Map; public class ReadExcelOption { private int fristRow = 1; private int sheetIndex = 0; private String sheetName; private boolean readAllSheet = false; private Map<String, List<ExcelColumnMap>> extendAttrMap; public String getSheetName() { return this.sheetName; } public void setSheetName(String sheetName) { this.sheetName = sheetName; } public ReadExcelOption() { } public ReadExcelOption(int fristRow) { this.fristRow = fristRow; } public ReadExcelOption(int fristRow, boolean readAllSheet) { this.fristRow = fristRow; this.readAllSheet = readAllSheet; } public int getFristRow() { return this.fristRow; } public void setFristRow(int fristRow) { this.fristRow = fristRow; } public int getSheetIndex() { return this.sheetIndex; } public void setSheetIndex(int sheetIndex) { this.sheetIndex = sheetIndex; } public boolean isReadAllSheet() { return this.readAllSheet; } public void setReadAllSheet(boolean readAllSheet) { this.readAllSheet = readAllSheet; } public Map<String, List<ExcelColumnMap>> getExtendAttrMap() { return this.extendAttrMap; } public void setExtendAttrMap(Map<String, List<ExcelColumnMap>> extendAttrMap) { this.extendAttrMap = extendAttrMap; } public String toString() { return "ReadExcelOption{fristRow=" + this.fristRow + ", sheetIndex=" + this.sheetIndex + ", sheetName='" + this.sheetName + '\'' + ", readAllSheet=" + this.readAllSheet + ", extendAttrMap=" + this.extendAttrMap + '}'; } } Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/com/vci/starter/poi/bo/SheetDataSet.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,43 @@ package com.vci.ubcs.com.vci.starter.poi.bo; import java.util.ArrayList; import java.util.List; public class SheetDataSet { private String sheetName; private List<String> colName = new ArrayList(); private List<SheetRowData> rowData = new ArrayList(); public SheetDataSet() { } public String getSheetName() { return this.sheetName; } public void setSheetName(String sheetName) { this.sheetName = sheetName; } public List<SheetRowData> getRowData() { return this.rowData; } public void setRowData(List<SheetRowData> rowData) { this.rowData = rowData; } public List<String> getColName() { return this.colName; } public void setColName(List<String> colName) { this.colName = colName; } public String toString() { return "SheetDataSet{sheetName='" + this.sheetName + '\'' + ", colName=" + this.colName + ", rowData=" + this.rowData + '}'; } } Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/com/vci/starter/poi/bo/SheetRowData.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,33 @@ package com.vci.ubcs.com.vci.starter.poi.bo; import java.util.HashMap; import java.util.Map; public class SheetRowData { private String rowIndex; private Map<Integer, String> data = new HashMap(); public SheetRowData() { } public String getRowIndex() { return this.rowIndex; } public void setRowIndex(String rowIndex) { this.rowIndex = rowIndex; } public Map<Integer, String> getData() { return this.data; } public void setData(Map<Integer, String> data) { this.data = data; } public String toString() { return "SheetRowData{rowIndex='" + this.rowIndex + '\'' + ", data=" + this.data + '}'; } } Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/com/vci/starter/poi/bo/WriteExcelOption.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,85 @@ package com.vci.ubcs.com.vci.starter.poi.bo; import com.vci.ubcs.com.vci.starter.bo.WriteExcelData; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class WriteExcelOption { private Map<String, List<WriteExcelData>> writeDataMap; private List<String> hideSheetList; private boolean append = false; private boolean revision07 = false; private Map<String, List<ExcelColumnMap>> extendAttrMap; public WriteExcelOption() { } public WriteExcelOption(List<WriteExcelData> excelDataList) { this.writeDataMap = new HashMap(); this.writeDataMap.put("Sheet1", excelDataList); } public void addSheetDataList(String sheetName, List<WriteExcelData> excelDataList) { if (this.writeDataMap == null) { this.writeDataMap = new HashMap(); } this.writeDataMap.put(sheetName, excelDataList); } public void addHideSheet(String sheetName) { if (this.hideSheetList == null) { this.hideSheetList = new ArrayList(); } this.hideSheetList.add(sheetName); } public Map<String, List<WriteExcelData>> getWriteDataMap() { return this.writeDataMap; } public void setWriteDataMap(Map<String, List<WriteExcelData>> writeDataMap) { this.writeDataMap = writeDataMap; } public List<String> getHideSheetList() { return this.hideSheetList; } public void setHideSheetList(List<String> hideSheetList) { this.hideSheetList = hideSheetList; } public boolean isAppend() { return this.append; } public void setAppend(boolean append) { this.append = append; } public boolean isRevision07() { return this.revision07; } public void setRevision07(boolean revision07) { this.revision07 = revision07; } public Map<String, List<ExcelColumnMap>> getExtendAttrMap() { return this.extendAttrMap; } public void setExtendAttrMap(Map<String, List<ExcelColumnMap>> extendAttrMap) { this.extendAttrMap = extendAttrMap; } public String toString() { return "WriteExcelOption{writeDataMap=" + this.writeDataMap + ", hideSheetList=" + this.hideSheetList + ", append=" + this.append + ", revision07=" + this.revision07 + ", extendAttrMap=" + this.extendAttrMap + '}'; } } Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/com/vci/starter/poi/constant/ExcelLangCodeConstant.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,23 @@ package com.vci.ubcs.com.vci.starter.poi.constant; public class ExcelLangCodeConstant { public static final String READ_IMPORT_FILE_FAIL = "readImportFileFail"; public static final String IMPORT_CONTENT_NULL = "importContentNull"; public static final String FILE_NOT_FOUND = "fileNotFound"; public static final String FILE_IO_EXCEPTION = "fileIoException"; public static final String FILE_CREATE_EXCEPTION = "fileCreateException"; public static final String INPUT_STREAM_IS_NULL = "inputStreamIsNull"; public static final String OUTPUT_STREAM_IS_NULL = "outputStreamIsNull"; public static final String WORKBOOK_INIT_FAIL = "workBookInitFail"; public static final String CELL_VALUE_CAN_NOT_NULL = "cellValueCanNotNull"; public static final String CELL_VALUE_CAN_NOT_NULL_FOR_REG = "cellValueCanNotNullForReg"; public static final String CELL_VALUE_NOT_EQUAL_REG = "cellValueNotEqualReg"; public static final String CELL_NOT_DATE_FORMATE = "cellNotDateFormate"; public ExcelLangCodeConstant() { } } Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/com/vci/starter/poi/util/ExcelUtil.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,1485 @@ package com.vci.ubcs.com.vci.starter.poi.util; import com.vci.ubcs.com.vci.starter.bo.WriteExcelData; import com.vci.ubcs.com.vci.starter.exception.VciBaseException; import com.vci.ubcs.com.vci.starter.poi.annotation.ExcelColumn; import com.vci.ubcs.com.vci.starter.poi.annotation.ExcelTitle; import com.vci.ubcs.com.vci.starter.poi.bo.*; import com.vci.ubcs.com.vci.starter.util.LocalFileUtil; import com.vci.ubcs.com.vci.starter.web.annotation.VciFieldType; import com.vci.ubcs.com.vci.starter.web.enumpck.VciFieldTypeEnum; import com.vci.ubcs.com.vci.starter.web.util.LangBaseUtil; import com.vci.ubcs.com.vci.starter.web.util.VciBaseUtil; import org.apache.commons.io.IOUtils; import org.apache.poi.hssf.usermodel.*; import org.apache.poi.hssf.util.HSSFColor; import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.ss.util.CellRangeAddressList; import org.apache.poi.xssf.usermodel.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springblade.core.tool.utils.StringUtil; import org.springframework.util.CollectionUtils; import java.io.*; import java.lang.reflect.Field; import java.math.BigDecimal; import java.nio.channels.FileChannel; import java.util.*; import java.util.stream.Collectors; public class ExcelUtil { private static Logger logger = LoggerFactory.getLogger(ExcelUtil.class); public static final String KEY_ATTR_CHAR = "â"; public static final String REQUIRED_CHAR = "*"; public ExcelUtil() { } public static void copyFile(File source, File target) throws VciBaseException { VciBaseUtil.alertNotNull(new Object[]{source, "æ¥æºæä»¶", target, "ç®æ æä»¶"}); if (!source.exists()) { throw new VciBaseException("fileNotFound", new String[]{source.getName()}); } else { File is; if (!target.exists()) { is = target.getParentFile(); is.mkdirs(); try { target.createNewFile(); } catch (IOException var17) { throw new VciBaseException("fileIoException", new String[]{target.getName()}); } } is = null; FileOutputStream os = null; FileInputStream isF; try { isF = new FileInputStream(source); } catch (FileNotFoundException var16) { throw new VciBaseException("fileNotFound", new String[]{source.getName()}); } try { os = new FileOutputStream(target); } catch (FileNotFoundException var15) { IOUtils.closeQuietly(isF); throw new VciBaseException("fileNotFound", new String[]{target.getName()}); } try { copyFile(isF, os); } catch (VciBaseException var12) { throw var12; } catch (Throwable var13) { throw new VciBaseException(LangBaseUtil.getErrorMsg(var13), new String[]{source.getName(), target.getName()}, var13); } finally { IOUtils.closeQuietly(isF); IOUtils.closeQuietly(os); } } } public static void copyFile(FileInputStream in, FileOutputStream os) throws VciBaseException { try { FileChannel sourceChannel = in.getChannel(); FileChannel targetChannel = os.getChannel(); int i = 0; int length = 2097152; while(true) { if (sourceChannel.position() == sourceChannel.size()) { sourceChannel.close(); targetChannel.close(); } if (sourceChannel.size() - sourceChannel.position() < 20971520L) { length = (int)(sourceChannel.size() - sourceChannel.position()); } else { length = 20971520; } sourceChannel.transferTo(sourceChannel.position(), (long)length, targetChannel); sourceChannel.position(sourceChannel.position() + (long)length); ++i; } } catch (IOException var10) { if (logger.isErrorEnabled()) { logger.error("æ·è´æºæä»¶å°ç®æ æä»¶åºç°äºé误", var10); } throw new VciBaseException(LangBaseUtil.getErrorMsg(var10), new String[0], var10); } catch (Throwable var11) { if (logger.isErrorEnabled()) { logger.error("æ·è´æºæä»¶å°ç®æ æä»¶åºç°äºé误", var11); } throw new VciBaseException(LangBaseUtil.getErrorMsg(var11), new String[0], var11); } finally { IOUtils.closeQuietly(in); IOUtils.closeQuietly(os); } } public static void copyFileFromJar(String filePathInJar, File targetFile) throws VciBaseException { VciBaseUtil.alertNotNull(new Object[]{filePathInJar, "æ¥æºæä»¶", targetFile, "ç®æ æä»¶"}); File os; if (!targetFile.exists()) { os = targetFile.getParentFile(); os.mkdirs(); try { targetFile.createNewFile(); } catch (IOException var12) { throw new VciBaseException("fileIoException", new String[]{targetFile.getName()}); } } os = null; InputStream ins = null; FileOutputStream osF; try { osF = new FileOutputStream(targetFile); } catch (FileNotFoundException var11) { throw new VciBaseException("fileNotFound", new String[]{targetFile.getName()}); } try { ins = ExcelUtil.class.getResourceAsStream(filePathInJar); IOUtils.copy(ins, osF); } catch (IOException var13) { if (logger.isErrorEnabled()) { logger.error("æ·è´æºæä»¶å°ç®æ æä»¶åºç°äºé误", var13); } throw new VciBaseException(LangBaseUtil.getErrorMsg(var13), new String[0], var13); } catch (Throwable var14) { if (logger.isErrorEnabled()) { logger.error("æ·è´æºæä»¶å°ç®æ æä»¶åºç°äºé误", var14); } throw new VciBaseException(LangBaseUtil.getErrorMsg(var14), new String[0], var14); } finally { IOUtils.closeQuietly(ins); IOUtils.closeQuietly(osF); } } public static void writeDataToFile(String fileName, WriteExcelOption writeExcelOption) throws VciBaseException { writeDataToFile(new File(fileName), writeExcelOption); } public static void writeDataToFile(File file, WriteExcelOption writeExcelOption) throws VciBaseException { if (file == null) { throw new VciBaseException("æä»¶ä¸ºç©ºï¼æ æ³æ¾å°æä»¶"); } else { if (!file.exists()) { File folder = file.getParentFile(); if (!folder.exists()) { folder.mkdirs(); } try { file.createNewFile(); } catch (IOException var14) { throw new VciBaseException("fileNotFound", new String[]{file.getName()}); } } Workbook workbook = null; if (writeExcelOption != null && writeExcelOption.isAppend()) { try { if (file.length() == 0L) { workbook = createWorkbook(false); } else { workbook = getWorkbookByInputStream(new FileInputStream(file)); } } catch (FileNotFoundException var13) { throw new VciBaseException("fileNotExist", new String[]{file.getName()}, var13); } } OutputStream os = null; try { os = new FileOutputStream(file); } catch (FileNotFoundException var12) { throw new VciBaseException("fileNotFound", new String[]{var12.getMessage()}, var12); } try { writeDataToFile(os, writeExcelOption, workbook); } catch (VciBaseException var15) { if (logger.isErrorEnabled()) { logger.error("åå ¥æ°æ®å°excelåºé", var15); } throw var15; } catch (Throwable var16) { if (logger.isErrorEnabled()) { logger.error("åå ¥æ°æ®å°excelåºé", var16); } throw new VciBaseException(LangBaseUtil.getErrorMsg(var16), new String[0], var16); } finally { IOUtils.closeQuietly(os); } } } public static void writeDataToFile(OutputStream os, WriteExcelOption writeExcelOption) throws VciBaseException { writeDataToFile(os, writeExcelOption, (Workbook)null); } public static void writeDataToFile(OutputStream os, WriteExcelOption writeExcelOption, Workbook workbook) throws VciBaseException { if (os == null) { throw new VciBaseException("outputStreamIsNull"); } else { if (writeExcelOption == null) { IOUtils.closeQuietly(os); } else { Workbook wb = null; if (writeExcelOption.isAppend() && workbook != null) { wb = workbook; } else { wb = createWorkbook(writeExcelOption.isRevision07()); } Workbook finalWb = wb; writeExcelOption.getWriteDataMap().forEach((sheetName, excelDataList) -> { Sheet sheet = getSheetByWorkbook(finalWb, sheetName); try { writeDataToCell(sheet, excelDataList); } catch (VciBaseException var6) { IOUtils.closeQuietly(os); throw var6; } catch (Throwable var7) { if (logger.isErrorEnabled()) { logger.error("åå ¥æ°æ®å°å·¥ä½ç°¿åºé", var7); } IOUtils.closeQuietly(os); throw new VciBaseException(LangBaseUtil.getErrorMsg(var7), new String[0], var7); } }); if (!CollectionUtils.isEmpty(writeExcelOption.getHideSheetList())) { Workbook finalWb1 = wb; writeExcelOption.getHideSheetList().stream().forEach((sheetName) -> { Sheet sheet = getSheetByWorkbook(finalWb1, sheetName); finalWb1.setSheetHidden(finalWb1.getSheetIndex(sheet), true); }); } try { wb.write(os); } catch (IOException var13) { if (logger.isErrorEnabled()) { logger.error("æå·¥ä½ç°¿ä¸çæ°æ®åå ¥å°æä»¶åºé", var13); } throw new VciBaseException(LangBaseUtil.getErrorMsg(var13), new String[0], var13); } finally { IOUtils.closeQuietly(os); try { wb.close(); } catch (Throwable var12) { if (logger.isErrorEnabled()) { logger.error("å ³éå·¥ä½ç°¿", var12); } } } } } } public static int getCellIndexForPoField(String excelFileName, String sheetName, Class<?> poClass, String poFieldName) throws VciBaseException { return getCellIndexForPoField(new File(excelFileName), sheetName, poClass, poFieldName); } public static int getCellIndexForPoField(File excelFile, String sheetName, Class<?> poClass, String poFieldName) throws VciBaseException { VciBaseUtil.alertNotNull(new Object[]{excelFile, "excelçæä»¶", poClass, "poiå¯¼å ¥å¯¼åºå¯¹è±¡æå±çç±»", poFieldName, "屿§çåç§°"}); if (!excelFile.exists()) { throw new VciBaseException("fileNotExist", new String[]{excelFile.getAbsolutePath()}); } else { if (StringUtil.isBlank(sheetName)) { sheetName = "Sheet1"; } Field field = VciBaseUtil.getFieldForObject(poFieldName, poClass); if (field == null) { throw new VciBaseException("对象ä¸ä¸å卿¤å±æ§ï¼{0}ï¼{1}", new String[]{poFieldName, poClass.getName()}); } else { if (field.isAnnotationPresent(ExcelColumn.class)) { ExcelColumn ec = getExcelColumnAnnotation(field); String columnName = ec.value(); Workbook workbook = null; try { workbook = getWorkbookByInputStream(new FileInputStream(excelFile)); } catch (FileNotFoundException var15) { throw new VciBaseException("fileNotExist", new String[]{excelFile.getAbsolutePath()}); } if (workbook != null) { Sheet sheet = workbook.getSheet(sheetName); if (sheet != null) { Row row = sheet.getRow(getRowIndexForTitle(poClass)); if (row != null) { short lastCellNum = row.getLastCellNum(); for(short i = 0; i < lastCellNum; ++i) { Cell cell = row.getCell(i); if (columnName.equals(cell.getStringCellValue())) { try { workbook.close(); } catch (IOException var14) { logger.error("å ³éå·¥ä½è¡¨åºç°é误", var14); } return i; } } } } } } return -1; } } } public static Map<String, Integer> listCellIndexForPO(File excelFile, String sheetName, Class<?> poClass) throws VciBaseException { VciBaseUtil.alertNotNull(new Object[]{excelFile, "excelçæä»¶", poClass, "poiå¯¼å ¥å¯¼åºå¯¹è±¡æå±çç±»"}); if (!excelFile.exists()) { throw new VciBaseException("fileNotExist", new String[]{excelFile.getAbsolutePath()}); } else { if (StringUtil.isBlank(sheetName)) { sheetName = "Sheet1"; } List<Field> fields = VciBaseUtil.getAllFieldForObj(poClass); Map<String, Integer> cellIndexMap = new HashMap(); if (!CollectionUtils.isEmpty(fields)) { Workbook workbook = null; try { workbook = getWorkbookByInputStream(new FileInputStream(excelFile)); } catch (FileNotFoundException var14) { throw new VciBaseException("fileNotExist", new String[]{excelFile.getAbsolutePath()}); } if (workbook != null) { Sheet sheet = workbook.getSheet(sheetName); if (sheet != null) { Row row = sheet.getRow(getRowIndexForTitle(poClass)); if (row != null) { Map<String, String> columnNamesMap = new HashMap(); fields.stream().forEach((field) -> { if (field.isAnnotationPresent(ExcelColumn.class)) { ExcelColumn ec = getExcelColumnAnnotation(field); String columnName = ec.value(); columnNamesMap.put(columnName, field.getName()); } }); short lastCellNum = row.getLastCellNum(); for(short i = 0; i < lastCellNum; ++i) { Cell cell = row.getCell(i); String cellName = cell.getStringCellValue(); if (columnNamesMap.containsKey(cellName)) { cellIndexMap.put(columnNamesMap.get(cellName), Integer.valueOf(i)); } } } } try { workbook.close(); } catch (IOException var13) { logger.error("å ³éå·¥ä½è¡¨åºç°é误", var13); } } } return cellIndexMap; } } public static int getRowIndexForTitle(Class<?> poClass) { if (poClass.isAnnotationPresent(ExcelTitle.class)) { ExcelTitle ec = (ExcelTitle)poClass.getAnnotation(ExcelTitle.class); if (ec == null) { ec = (ExcelTitle)poClass.getDeclaredAnnotation(ExcelTitle.class); } if (ec != null) { return ec.rowIndexForTitle(); } } return 0; } public static String getCellNameByIndex(int colIndex) { if (colIndex < 26) { return String.valueOf((char)(65 + colIndex)); } else { int balance = colIndex % 26; int multiple = (colIndex - balance) / 26; String prefix = String.valueOf((char)(65 + (multiple - 1))); String suffix = String.valueOf((char)(65 + balance)); return prefix + suffix; } } public static Workbook createWorkbook(boolean is07) { Workbook wb = null; if (is07) { wb = new XSSFWorkbook(); } else { wb = new HSSFWorkbook(); } return (Workbook)wb; } public static Workbook getWorkbookByInputStream(InputStream ins) throws VciBaseException { Workbook wb = null; try { wb = WorkbookFactory.create(ins); return wb; } catch (IOException var3) { IOUtils.closeQuietly(ins); throw new VciBaseException("workBookInitFail", new String[]{LangBaseUtil.getErrorMsg(var3)}); } } private static Sheet getSheetByWorkbook(Workbook wb, String sheetName) { if (StringUtil.isBlank(sheetName)) { sheetName = "Sheet1"; } Sheet sheet = wb.getSheet(sheetName); if (sheet == null) { sheet = wb.createSheet(sheetName); } return sheet; } private static Row getRowBySheet(Sheet sheet, int rowIndex) { Row row = sheet.getRow(rowIndex); if (row == null) { row = sheet.createRow(rowIndex); } return row; } private static Cell getCellByRow(Row row, int cellIndex) { Cell cell = row.getCell(cellIndex); if (cell == null) { cell = row.createCell(cellIndex); } return cell; } private static void writeDataToCell(Sheet sheet, List<WriteExcelData> excelDataList) throws VciBaseException { if (sheet != null && !CollectionUtils.isEmpty(excelDataList)) { List<WriteExcelData> mergedDataList = new ArrayList(); excelDataList.stream().forEach((ed) -> { Row row = getRowBySheet(sheet, ed.getRow()); Cell cell = getCellByRow(row, ed.getCol()); if (ed.isMerged() && (ed.getRowTo() > ed.getRow() || ed.getColTo() > ed.getCol())) { mergedDataList.add(ed); } copyStyle(sheet, cell, ed); if (ed.isReadOnly() && ed.getObj() != null && !(ed.getObj() instanceof RichTextString) && CollectionUtils.isEmpty(ed.getValidationDataList())) { List<String> list = new ArrayList(); list.add(ed.getObj().toString()); ed.setValidationDataList(list); setValidation(sheet, ed); } centerCell(cell, ed); Object value = ed.getObj(); if (StringUtil.isNotBlank(ed.getFontColor())) { String rtsValue = value == null ? "" : value.toString(); RichTextString ts = cell instanceof HSSFCell ? new HSSFRichTextString(rtsValue) : new XSSFRichTextString(rtsValue); Font font = sheet.getWorkbook().createFont(); font.setColor(VciBaseUtil.getShort(ed.getFontColor())); ((RichTextString)ts).applyFont(font); value = ts; } if (ed.isFormula()) { setFormula(cell, ed); } else if (ed.isNameRefer()) { setNameRefer(sheet, ed); } else if (ed.isValidation()) { setValidation(sheet, ed); } else { setCellValue(cell, value); } if (ed.getWidth() != null && ed.getWidth() > 0) { sheet.setColumnWidth(cell.getColumnIndex(), (int)((double)ed.getWidth() + 0.72) * 256); } }); mergedRegion(sheet, mergedDataList); } } private static void setFormula(Cell cell, WriteExcelData ed) { if (ed.getObj() != null) { cell.setCellFormula(ed.getObj().toString()); } } private static void setNameRefer(Sheet sheet, WriteExcelData ed) { if (ed.getObj() != null) { Name name = sheet.getWorkbook().createName(); name.setNameName(ed.getObj().toString()); name.setRefersToFormula(sheet.getSheetName() + "!" + getRange(ed)); } } private static void setValidation(Sheet sheet, WriteExcelData ed) { if (ed.getRowTo() < ed.getRow()) { ed.setRowTo(ed.getRow()); } if (ed.getColTo() < ed.getCol()) { ed.setColTo(ed.getCol()); } CellRangeAddressList regions = new CellRangeAddressList(ed.getRow(), ed.getRowTo(), ed.getCol(), ed.getColTo()); DataValidation validation = null; XSSFDataValidationConstraint dvConstraint; if (sheet instanceof XSSFSheet) { XSSFDataValidationHelper dvHelper = new XSSFDataValidationHelper((XSSFSheet)sheet); dvConstraint = null; if (!CollectionUtils.isEmpty(ed.getValidationDataList())) { dvConstraint = (XSSFDataValidationConstraint)dvHelper.createExplicitListConstraint((String[])ed.getValidationDataList().toArray(new String[0])); } else { VciBaseUtil.alertNotNull(new Object[]{ed.getObj(), "åå ¥æææ§çæ¶åï¼æ²¡æè®¾ç½®æææ§çå ¬å¼è¡¨è¾¾å¼"}); dvConstraint = (XSSFDataValidationConstraint)dvHelper.createFormulaListConstraint(ed.getObj().toString()); } validation = (XSSFDataValidation)dvHelper.createValidation(dvConstraint, regions); } else { HSSFDataValidationHelper dvHelper = new HSSFDataValidationHelper((HSSFSheet)sheet); dvConstraint = null; DataValidationConstraint dvConstraintF; if (!CollectionUtils.isEmpty(ed.getValidationDataList())) { dvConstraintF = dvHelper.createExplicitListConstraint((String[])ed.getValidationDataList().toArray(new String[0])); } else { VciBaseUtil.alertNotNull(new Object[]{ed.getObj(), "åå ¥æææ§çæ¶åï¼æ²¡æè®¾ç½®æææ§çå ¬å¼è¡¨è¾¾å¼"}); dvConstraintF = dvHelper.createFormulaListConstraint(ed.getObj().toString()); } validation = new HSSFDataValidation(regions, dvConstraintF); } if (validation instanceof XSSFDataValidation) { ((DataValidation)validation).setSuppressDropDownArrow(true); ((DataValidation)validation).setShowErrorBox(true); } else { ((DataValidation)validation).setSuppressDropDownArrow(false); } if (StringUtil.isNotBlank(ed.getValidationErrorMsg())) { ((DataValidation)validation).createErrorBox("error", ed.getValidationErrorMsg()); } sheet.addValidationData((DataValidation)validation); } private static String getRange(WriteExcelData excelData) { char start = (char)(65 + excelData.getCol()); int rowId = excelData.getRow() + 1; int endRowId = excelData.getRowTo() + 1; char endPrefix; if (excelData.getColTo() <= 25) { endPrefix = (char)(65 + excelData.getColTo()); return "$" + start + "$" + rowId + ":$" + endPrefix + "$" + endRowId; } else { endPrefix = 'A'; // boolean endSuffix = true; char endSuffix; if ((excelData.getColTo() - 25) / 26 != 0 && excelData.getColTo() != 51) { if ((excelData.getColTo() - 25) % 26 == 0) { endSuffix = 'Z'; endPrefix = (char)(endPrefix + (excelData.getColTo() - 25) / 26 - 1); } else { endSuffix = (char)(65 + (excelData.getColTo() - 25) % 26 - 1); endPrefix = (char)(endPrefix + (excelData.getColTo() - 25) / 26); } } else if ((excelData.getColTo() - 25) % 26 == 0) { endSuffix = 'Z'; } else { endSuffix = (char)(65 + (excelData.getColTo() - 25) % 26 - 1); } return "$" + start + "$" + rowId + ":$" + endPrefix + endSuffix + "$" + endRowId; } } private static void setCellValue(Cell cell, Object value) { if (value != null) { if (value instanceof Date) { cell.setCellValue((Date)value); } else if (value instanceof String) { cell.setCellValue(value.toString()); } else if (value instanceof Boolean) { cell.setCellValue((Boolean)value); } else if (value instanceof Integer) { cell.setCellValue((double)(Integer)value); } else if (value instanceof Long) { cell.setCellValue((double)(Long)value); } else if (value instanceof BigDecimal) { cell.setCellValue(((BigDecimal)value).doubleValue()); } else if (value instanceof Double) { cell.setCellValue((Double)value); } else if (value instanceof RichTextString) { cell.setCellValue((RichTextString)value); } else { cell.setCellValue(value.toString()); } } } private static void copyStyle(Sheet sheet, Cell cell, WriteExcelData excelData) { if (excelData.isCopyStyle()) { Row copyStyleRow = sheet.getRow(excelData.getCopyStyleRow()); if (copyStyleRow != null) { Cell copyStyleCell = copyStyleRow.getCell(excelData.getCopyStyleCol()); copyStyleForCell(copyStyleCell, cell); if (StringUtil.isNotBlank(excelData.getDateFormat())) { HSSFDataFormat format = (HSSFDataFormat)sheet.getWorkbook().createDataFormat(); cell.getCellStyle().setDataFormat(format.getFormat(excelData.getDateFormat())); } } } } private static void copyStyleForCell(Cell fromCell, Cell toCell) { CellStyle cellStyle = toCell.getCellStyle(); CellStyle fromStyle = fromCell.getCellStyle(); cellStyle.cloneStyleFrom(fromStyle); cellStyle.setAlignment(fromStyle.getAlignment()); cellStyle.setBorderBottom(fromStyle.getBorderBottom()); cellStyle.setBorderLeft(fromStyle.getBorderLeft()); cellStyle.setBorderRight(fromStyle.getBorderRight()); cellStyle.setBorderTop(fromStyle.getBorderTop()); cellStyle.setDataFormat(fromStyle.getDataFormat()); cellStyle.setFillBackgroundColor(fromStyle.getFillBackgroundColor()); cellStyle.setFillForegroundColor(fromStyle.getFillForegroundColor()); cellStyle.setFillPattern(fromStyle.getFillPattern()); cellStyle.setVerticalAlignment(fromStyle.getVerticalAlignment()); cellStyle.setWrapText(fromStyle.getWrapText()); cellStyle.setLocked(fromStyle.getLocked()); cellStyle.setBottomBorderColor(fromStyle.getBottomBorderColor()); cellStyle.setLeftBorderColor(fromStyle.getLeftBorderColor()); cellStyle.setTopBorderColor(fromStyle.getTopBorderColor()); cellStyle.setRightBorderColor(fromStyle.getRightBorderColor()); } private static void centerCell(Cell cell, WriteExcelData excelData) { if (excelData.isCenter()) { CellStyle cellStyle = cell.getCellStyle(); cellStyle.setAlignment(HorizontalAlignment.CENTER); cellStyle.setVerticalAlignment(VerticalAlignment.CENTER); } } private static void mergedRegion(Sheet sheet, Collection<WriteExcelData> mergedDataList) { if (!CollectionUtils.isEmpty(mergedDataList)) { mergedDataList.stream().forEach((ed) -> { if (ed.getRowTo() < ed.getRow()) { ed.setRowTo(ed.getRow()); } if (ed.getColTo() < ed.getCol()) { ed.setColTo(ed.getCol()); } sheet.addMergedRegion(new CellRangeAddress(ed.getRow(), ed.getRowTo(), ed.getCol(), ed.getColTo())); }); } } public static List<SheetDataSet> readDataObjectFromExcel(File file) throws VciBaseException { return readDataObjectFromExcel(file, SheetDataSet.class); } public static <T> List<T> readDataObjectFromExcel(File file, Class<T> doClass) throws VciBaseException { return readDataObjectFromExcel(file, doClass, (ReadExcelOption)null); } public static <T> List<T> readDataObjectFromExcel(File file, Class<T> doClass, ReadExcelOption excelOption) throws VciBaseException { return readDataObjectFromExcel((File)file, doClass, excelOption, (PoiImportProcesser)null); } public static <T> List<T> readDataObjectFromExcel(File file, Class<T> doClass, ReadExcelOption excelOption, PoiImportProcesser<T> processer) throws VciBaseException { InputStream ins = null; try { ins = new FileInputStream(file); } catch (Throwable var15) { String msg = "readImportFileFail"; if (logger.isErrorEnabled()) { logger.error(msg, var15); } throw new VciBaseException(msg + LangBaseUtil.getErrorMsg(var15), new String[0], var15); } List var5; try { var5 = readDataObjectFromExcel((InputStream)ins, doClass, excelOption, processer); } catch (VciBaseException var12) { throw var12; } catch (Throwable var13) { throw new VciBaseException(LangBaseUtil.getErrorMsg(var13), new String[0], var13); } finally { IOUtils.closeQuietly(ins); } return var5; } public static <T> List<T> readDataObjectFromExcel(InputStream ins, Class<T> doClass, ReadExcelOption excelOption, PoiImportProcesser<T> processer) throws VciBaseException { if (ins == null) { throw new VciBaseException("inputStreamIsNull"); } else { if (doClass == null) { doClass = (Class<T>) SheetDataSet.class; } boolean isDataSet = false; if (doClass.equals(SheetDataSet.class)) { isDataSet = true; } Map<Field, ExcelColumn> excelColumnSet = getExcelColumnAnnotations(doClass); Map<String, ExcelColumn> excelTitleMap = (Map)((Map)Optional.of(excelColumnSet).get()).values().stream().collect(Collectors.toMap((s) -> { // return s.value(); return s; }, (t) -> { return t; })); Map<String, Field> excelTitleFieldMap = new HashMap(); Map<String, ExcelColumnMap> extendAttrTitleMap = new HashMap(); Field[] rowIndexFields = new Field[]{null}; ReadExcelOption finalExcelOption = excelOption; excelColumnSet.forEach((field, excelColumnx) -> { excelTitleFieldMap.put(excelColumnx.value(), field); if (excelColumnx.rowIndexColumn()) { rowIndexFields[0] = field; } field.setAccessible(true); if ((field.getType().equals(Map.class) || field.getType().getSuperclass().equals(Map.class)) && !CollectionUtils.isEmpty(finalExcelOption.getExtendAttrMap()) && finalExcelOption.getExtendAttrMap().containsKey(excelColumnx.value())) { List<ExcelColumnMap> excelColumnMaps = (List) finalExcelOption.getExtendAttrMap().get(excelColumnx.value()); if (!CollectionUtils.isEmpty(excelColumnMaps)) { excelColumnMaps.stream().forEach((ss) -> { excelTitleFieldMap.put(ss.getTitle(), field); extendAttrTitleMap.put(ss.getTitle(), ss); }); } } }); Field rowIndexField = null; if (rowIndexFields[0] != null) { rowIndexField = rowIndexFields[0]; } Workbook workbook = getWorkbookByInputStream(ins); if (excelOption == null) { excelOption = new ReadExcelOption(); } FormulaEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator(); List<T> dataSet = new ArrayList(); try { for(int sheetIndex = 0; sheetIndex < workbook.getNumberOfSheets(); ++sheetIndex) { Sheet sheet = workbook.getSheetAt(sheetIndex); if (StringUtil.isNotBlank(excelOption.getSheetName())) { if (!sheet.getSheetName().equalsIgnoreCase(excelOption.getSheetName())) { continue; } } else if (!excelOption.isReadAllSheet() && sheetIndex != excelOption.getSheetIndex()) { continue; } SheetDataSet sheetDataSet = new SheetDataSet(); sheetDataSet.setSheetName(sheet.getSheetName()); if (isDataSet) { dataSet.add((T) sheetDataSet); } Map<Integer, String> colsNameIndexMap = new HashMap(); int rowIndex; if (excelOption.getFristRow() > 0) { try { Row titleRow = sheet.getRow(excelOption.getFristRow() - 1); rowIndex = titleRow.getLastCellNum(); List<String> titleList = new LinkedList(); for(int i = 0; i < rowIndex; ++i) { String title = VciBaseUtil.getStringValueFromObject(getCellValue(titleRow.getCell(i), evaluator)); if (StringUtil.isNotBlank(title)) { title = title.replace("*", "").replace("â", ""); colsNameIndexMap.put(i, title); titleList.add(title); } } if (isDataSet) { sheetDataSet.setColName(titleList); } } catch (Exception var52) { if (logger.isErrorEnabled()) { logger.error("读åexcelæä»¶ä¸çæ é¢ä¿¡æ¯åºç°äºé误", var52); } throw var52; } } List<SheetRowData> rowDataList = new LinkedList(); if (sheet.getLastRowNum() > 0) { for(rowIndex = excelOption.getFristRow(); rowIndex <= sheet.getLastRowNum(); ++rowIndex) { Row rowDataSet = sheet.getRow(rowIndex); if (rowDataSet != null) { boolean notValue = false; for(int i = 0; i < rowDataSet.getLastCellNum(); ++i) { Cell cellTemp = rowDataSet.getCell(i); Object valueTemp = getCellValue(cellTemp, evaluator); if (valueTemp != null && !(valueTemp instanceof String) || valueTemp instanceof String && valueTemp != null && StringUtil.isNotBlank(valueTemp.toString())) { notValue = true; break; } } if (notValue) { SheetRowData rd = isDataSet ? new SheetRowData() : null; T obj = null; if (!isDataSet) { try { obj = doClass.newInstance(); } catch (Throwable var49) { if (logger.isErrorEnabled()) { logger.error("å®ä¾åæ°æ®å¯¹è±¡", var49); } throw new VciBaseException("å®ä¾åæ°æ®å¯¹è±¡," + LangBaseUtil.getErrorMsg(var49)); } } if (isDataSet) { rd.setRowIndex(String.valueOf(rowIndex)); } if (!isDataSet && rowIndexField != null) { VciBaseUtil.setValueForField(rowIndexField, obj, String.valueOf(rowIndex)); } Map<Integer, String> rowDataMap = new HashMap(); for(int columnIndex = 0; columnIndex < rowDataSet.getLastCellNum(); ++columnIndex) { Cell cell = rowDataSet.getCell(columnIndex); Object value = getCellValue(cell, evaluator); String title = colsNameIndexMap.containsKey(columnIndex) ? (String)colsNameIndexMap.get(columnIndex) : ""; boolean isMapField = false; Field thisField = null; if (StringUtil.isNotBlank(title) && excelTitleFieldMap.containsKey(title)) { thisField = (Field)excelTitleFieldMap.get(title); } if (thisField != null) { thisField.setAccessible(true); if (thisField.getType().equals(Map.class) || thisField.getType().getSuperclass().equals(Map.class)) { isMapField = true; } } ExcelColumn excelColumn = null; if (StringUtil.isNotBlank(title) && excelTitleMap.containsKey(title)) { excelColumn = (ExcelColumn)excelTitleMap.get(title); } ExcelColumnMap columnMap = null; if (isMapField) { columnMap = (ExcelColumnMap)extendAttrTitleMap.get(title); } boolean isNull = false; if (value == null || value instanceof String && StringUtil.isBlank(value.toString())) { isNull = true; } if (!isNull) { if (!isDataSet) { if (thisField != null && (excelColumn != null || columnMap != null)) { if (isMapField) { Object fieldValue = thisField.get(obj); Object data; if (fieldValue == null) { data = new HashMap(); } else { data = (Map)fieldValue; } ((Map)data).put(columnMap.getColumnName(), value == null ? "" : value.toString()); try { thisField.set(obj, data); } catch (IllegalAccessException var50) { if (logger.isErrorEnabled()) { logger.error("设置mapç±»åçæ°æ®æ¶ååºç°äºé误", var50); } } } else { if (value.getClass().equals(thisField.getType())) { try { thisField.set(obj, value); } catch (IllegalAccessException var51) { if (logger.isErrorEnabled()) { logger.error("读åexcelçåå æ ¼çå¼åï¼ä¸ºå¯¹è±¡èµå¼åºç°äºé误", var51); } } } else { VciBaseUtil.setValueForField(thisField, obj, VciBaseUtil.getStringValueFromObject(value)); } if (thisField.getType().equals(Date.class) && thisField.get(obj) == null) { throw new VciBaseException("cellNotDateFormate", new String[]{title, rowIndex + 1 + ""}); } if (StringUtil.isNotBlank(excelColumn.regExg()) && !VciBaseUtil.getStringValueFromObject(value).matches(excelColumn.regExg())) { throw new VciBaseException("cellValueNotEqualReg", new String[]{title, rowIndex + 1 + "", excelColumn.regExgTitle()}); } } } if (processer != null && thisField != null) { processer.process(value, obj, thisField); } } else { rowDataMap.put(columnIndex, VciBaseUtil.getStringValueFromObject(value)); } } else if (!isDataSet && thisField != null && excelColumn != null) { if (!excelColumn.nullable()) { throw new VciBaseException("cellValueCanNotNull", new String[]{title, rowIndex + 1 + ""}); } if (StringUtil.isNotBlank(excelColumn.regExg())) { throw new VciBaseException("cellValueCanNotNullForReg", new String[]{title, rowIndex + 1 + ""}); } } } if (isDataSet) { rd.setData(rowDataMap); rowDataList.add(rd); } else { dataSet.add(obj); } } } } } if (isDataSet) { sheetDataSet.setRowData(rowDataList); } } } catch (Throwable var53) { throw new VciBaseException(LangBaseUtil.getErrorMsg(var53), new String[0], var53); } finally { IOUtils.closeQuietly(ins); try { workbook.close(); } catch (IOException var48) { if (logger.isErrorEnabled()) { logger.error("å ³éå·¥ä½ç°¿åºç°äºé误", var48); } } } return dataSet; } } private static Object getCellValue(Cell cell, FormulaEvaluator evaluator) { if (cell != null) { Object cellValue = null; CellType cellTypeEnum = cell.getCellType(); switch (cellTypeEnum) { case STRING: String thisCellValue = cell.getStringCellValue(); cellValue = StringUtil.isEmpty(thisCellValue) ? "" : thisCellValue.trim(); break; case BOOLEAN: boolean boolValue = cell.getBooleanCellValue(); cellValue = boolValue; break; case FORMULA: cellValue = getCellValue(evaluator.evaluate(cell)); break; case NUMERIC: if (DateUtil.isCellDateFormatted(cell)) { cellValue = cell.getDateCellValue(); } else { cellValue = cell.getNumericCellValue(); } break; default: cellValue = ""; } return cellValue; } else { return null; } } private static Object getCellValue(CellValue cell) { Object cellValue = null; switch (cell.getCellTypeEnum()) { case STRING: String thisCellValue = cell.getStringValue(); cellValue = StringUtil.isEmpty(thisCellValue) ? "" : thisCellValue.trim(); break; case NUMERIC: cellValue = cell.getNumberValue(); } return cellValue; } public static <T> Map<Field, ExcelColumn> getExcelColumnAnnotations(Class<T> doClass) { Map<Field, ExcelColumn> excelColumnMap = new HashMap(); if (!doClass.equals(SheetDataSet.class)) { List<Field> allFields = VciBaseUtil.getAllFieldForObj(doClass); List<Field> hasExcelColumnFields = (List)allFields.stream().filter((field) -> { return field.isAnnotationPresent(ExcelColumn.class); }).collect(Collectors.toList()); if (!CollectionUtils.isEmpty(hasExcelColumnFields)) { hasExcelColumnFields.stream().forEach((field) -> { ExcelColumn ec = getExcelColumnAnnotation(field); excelColumnMap.put(field, ec); }); } } return excelColumnMap; } public static ExcelColumn getExcelColumnAnnotation(Field field) { ExcelColumn ec = (ExcelColumn)field.getAnnotation(ExcelColumn.class); if (ec == null) { ec = (ExcelColumn)field.getDeclaredAnnotation(ExcelColumn.class); } return ec; } public static <T> String downloadImportTempByClass(Class<T> doClass, DownloadTempOption downloadTempOption, PoiTemplateProcesser<T> processer) { if (downloadTempOption == null) { downloadTempOption = new DownloadTempOption(""); } String excelName = LocalFileUtil.getDefaultTempFolder() + File.separator + (StringUtil.isNotBlank(downloadTempOption.getExcelName()) ? downloadTempOption.getExcelName() : "å¯¼å ¥æ¨¡æ¿.xls"); try { (new File(excelName)).createNewFile(); } catch (Throwable var22) { throw new VciBaseException(LangBaseUtil.getErrorMsg(var22), new String[]{excelName}, var22); } List<WriteExcelData> excelDataList = new ArrayList(); Map<Field, ExcelColumn> fieldExcelColumnMap = getExcelColumnAnnotations(doClass); Map<String, ExcelColumn> fieldNameExcelColumnMap = new HashMap(); fieldExcelColumnMap.forEach((fieldx, ec) -> { fieldx.setAccessible(true); fieldNameExcelColumnMap.put(fieldx.getName(), ec); }); Field[] fields = doClass.getDeclaredFields(); Set<String> finedFields = new HashSet(); new HSSFWorkbook(); int index = 0; for(int i = 0; i < fields.length; ++i) { Field field = fields[i]; field.setAccessible(true); String fieldName = field.getName(); if (fieldNameExcelColumnMap.containsKey(fieldName)) { finedFields.add(fieldName); ExcelColumn column = (ExcelColumn)fieldNameExcelColumnMap.get(fieldName); if (!column.rowIndexColumn()) { WriteExcelData excelData = new WriteExcelData(0, index, StringUtil.isNotBlank(column.value()) ? column.value() : fieldName); if (!column.nullable()) { excelData.setFontColor(String.valueOf(HSSFColor.HSSFColorPredefined.RED.getIndex())); excelData.setObj(excelData.getObj() + "*"); } excelData.setReadOnly(true); excelData.setCenter(true); if (column.width() > 0) { excelData.setWidth(column.width()); } List<WriteExcelData> thisRowNextDatas = new ArrayList(); if (downloadTempOption.getDefaultRowSize() == null || downloadTempOption.getDefaultRowSize() < 0) { downloadTempOption.setDefaultRowSize(1); } Integer defaultRowSize = downloadTempOption.getDefaultRowSize(); for(int j = 0; j < defaultRowSize; ++j) { thisRowNextDatas.add(new WriteExcelData(1 + j, index, "")); } if (StringUtil.isNotBlank(column.enumId()) && processer != null) { Map<String, String> enumMap = processer.wrapperEnumMap(column.enumId(), doClass, field); if (!CollectionUtils.isEmpty(enumMap)) { WriteExcelData thisRowNext = (WriteExcelData)thisRowNextDatas.get(0); thisRowNext.setValidation(true); thisRowNext.setRowTo(defaultRowSize); thisRowNext.setColTo(thisRowNext.getCol()); thisRowNext.setValidationDataList((List)enumMap.values().stream().collect(Collectors.toList())); } } if (field.isAnnotationPresent(VciFieldType.class)) { VciFieldType fieldType = (VciFieldType)field.getDeclaredAnnotation(VciFieldType.class); if (fieldType == null) { fieldType = (VciFieldType)field.getAnnotation(VciFieldType.class); } if (fieldType != null) { String dateFormat; if (VciFieldTypeEnum.VTDateTime.equals(fieldType.value())) { dateFormat = "yyyy-MM-dd HH:mm:ss"; } else if (VciFieldTypeEnum.VTDate.equals(fieldType.value())) { dateFormat = "yyyy-MM-dd"; } else if (VciFieldTypeEnum.VTTime.equals(fieldType.value())) { dateFormat = "HH:mm:ss"; } else { dateFormat = ""; } if (StringUtil.isNotBlank(dateFormat)) { thisRowNextDatas.stream().forEach((thisRowNextx) -> { thisRowNextx.setDateFormat(dateFormat); }); } if (VciFieldTypeEnum.VTBoolean.equals(fieldType.value())) { List<String> trueFlase = new ArrayList(); trueFlase.add("æ¯"); trueFlase.add("å¦"); WriteExcelData thisRowNext = (WriteExcelData)thisRowNextDatas.get(0); thisRowNext.setValidation(true); thisRowNext.setRowTo(defaultRowSize); thisRowNext.setColTo(thisRowNext.getCol()); thisRowNext.setValidationDataList(trueFlase); } } } excelDataList.addAll(thisRowNextDatas); excelDataList.add(excelData); ++index; } } } WriteExcelOption excelOption = new WriteExcelOption(); excelOption.addSheetDataList(StringUtil.isNotBlank(downloadTempOption.getSheetName()) ? downloadTempOption.getSheetName() : "Sheet1", excelDataList); writeDataToFile(excelName, excelOption); return excelName; } public static void mergeExcel(List<String> files, String excelName) { Workbook newExcelCreat = excelName.toLowerCase(Locale.ROOT).endsWith(".xlsx") ? new XSSFWorkbook() : new HSSFWorkbook(); for(int i = 0; i < files.size(); ++i) { String fromExcelName = (String)files.get(i); try { InputStream in = new FileInputStream(fromExcelName); Throwable var6 = null; try { Workbook fromExcel = null; if (fromExcelName.toLowerCase(Locale.ROOT).endsWith(".xlsx")) { fromExcel = new XSSFWorkbook(in); } else { fromExcel = new HSSFWorkbook(in); } int length = ((Workbook)fromExcel).getNumberOfSheets(); Sheet oldSheet; if (length <= 1) { oldSheet = ((Workbook)fromExcel).getSheetAt(0); oldSheet = ((Workbook)newExcelCreat).getSheet(oldSheet.getSheetName()); String newSheetName = oldSheet.getSheetName(); if (oldSheet != null) { newSheetName = newSheetName + "_" + i; } Sheet newSheet = ((Workbook)newExcelCreat).createSheet(newSheetName); copySheet((Workbook)newExcelCreat, oldSheet, newSheet); } else { for(int j = 0; j < length; ++j) { oldSheet = ((Workbook)fromExcel).getSheetAt(j); Sheet existSheet = ((Workbook)newExcelCreat).getSheet(oldSheet.getSheetName()); String newSheetName = oldSheet.getSheetName(); if (existSheet != null) { newSheetName = newSheetName + "_" + i + "_" + j; } Sheet newSheet = ((Workbook)newExcelCreat).createSheet(newSheetName); copySheet((Workbook)newExcelCreat, oldSheet, newSheet); } } List<? extends Name> allNames = ((Workbook)fromExcel).getAllNames(); if (!CollectionUtils.isEmpty(allNames)) { allNames.stream().forEach((name) -> { Name name1 = newExcelCreat.createName(); name1.setNameName(name.getNameName()); name1.setRefersToFormula(name.getRefersToFormula()); }); } } catch (Throwable var64) { var6 = var64; throw var64; } finally { if (in != null) { if (var6 != null) { try { in.close(); } catch (Throwable var58) { var6.addSuppressed(var58); } } else { in.close(); } } } } catch (IOException var66) { throw new VciBaseException("åå¹¶excelåºéçäº", new String[0], var66); } } String allFileName = excelName; try { FileOutputStream fileOut = new FileOutputStream(allFileName); Throwable var69 = null; try { ((Workbook)newExcelCreat).write(fileOut); fileOut.flush(); } catch (Throwable var60) { var69 = var60; throw var60; } finally { if (fileOut != null) { if (var69 != null) { try { fileOut.close(); } catch (Throwable var59) { var69.addSuppressed(var59); } } else { fileOut.close(); } } } } catch (IOException var62) { var62.printStackTrace(); } finally { try { ((Workbook)newExcelCreat).close(); } catch (IOException var57) { var57.printStackTrace(); } } } private static void mergeSheetAllRegion(Sheet fromSheet, Sheet toSheet) { int num = fromSheet.getNumMergedRegions(); CellRangeAddress cellR = null; for(int i = 0; i < num; ++i) { cellR = fromSheet.getMergedRegion(i); toSheet.addMergedRegion(cellR); } } private static void copyCell(Cell fromCell, Cell toCell) { copyStyleForCell(fromCell, toCell); if (fromCell.getCellComment() != null) { toCell.setCellComment(fromCell.getCellComment()); } CellType fromCellType = fromCell.getCellType(); toCell.setCellType(fromCellType); if (fromCellType == CellType.NUMERIC) { if (DateUtil.isCellDateFormatted(fromCell)) { toCell.setCellValue(fromCell.getDateCellValue()); } else { toCell.setCellValue(fromCell.getNumericCellValue()); } } else if (fromCellType == CellType.STRING) { RichTextString value = fromCell.getRichStringCellValue(); if (value != null && StringUtil.isNotBlank(value.toString())) { Font fontAt = fromCell.getSheet().getWorkbook().getFontAt(fromCell.getCellStyle().getFontIndexAsInt()); value.applyFont(fontAt); } toCell.setCellValue(value); } else if (fromCellType != CellType.BLANK) { if (fromCellType == CellType.BOOLEAN) { toCell.setCellValue(fromCell.getBooleanCellValue()); } else if (fromCellType == CellType.ERROR) { toCell.setCellErrorValue(fromCell.getErrorCellValue()); } else if (fromCellType == CellType.FORMULA) { toCell.setCellFormula(fromCell.getCellFormula()); } } } private static void copyRow(Workbook wb, Row oldRow, Row toRow) { toRow.setHeight(oldRow.getHeight()); Iterator cellIt = oldRow.cellIterator(); while(cellIt.hasNext()) { Cell tmpCell = (Cell)cellIt.next(); Cell newCell = toRow.createCell(tmpCell.getColumnIndex()); copyCell(tmpCell, newCell); } } private static void copySheet(Workbook wb, Sheet fromSheet, Sheet toSheet) { mergeSheetAllRegion(fromSheet, toSheet); int length = fromSheet.getRow(fromSheet.getFirstRowNum()).getLastCellNum(); for(int i = 0; i <= length; ++i) { toSheet.setColumnWidth(i, fromSheet.getColumnWidth(i)); } Iterator rowIt = fromSheet.rowIterator(); while(rowIt.hasNext()) { Row oldRow = (Row)rowIt.next(); Row newRow = toSheet.createRow(oldRow.getRowNum()); copyRow(wb, oldRow, newRow); } List<? extends DataValidation> dataValidations = fromSheet.getDataValidations(); if (!CollectionUtils.isEmpty(dataValidations)) { dataValidations.stream().forEach((dv) -> { toSheet.addValidationData(dv); }); } } public static <T> void appendDataToExcel(Collection<T> data, String excelName, AppendDataExcelOption excelOption) { if (!CollectionUtils.isEmpty(data)) { T t1 = data.stream().findFirst().get(); Map<Field, ExcelColumn> excelColumnSet = getExcelColumnAnnotations(t1.getClass()); Map<String, String> excelTitleFieldNameMap = new HashMap(); Set<String> readOnlyFields = new HashSet(); excelColumnSet.forEach((field, excelColumn) -> { excelTitleFieldNameMap.put(excelColumn.value(), field.getName()); if (excelColumn.readOnly()) { readOnlyFields.add(field.getName()); } }); ReadExcelOption readExcelOption = new ReadExcelOption(); readExcelOption.setSheetName(excelOption.getSheetName()); readExcelOption.setFristRow(excelOption.getTitleRowIndex() + 1); List<SheetDataSet> sheetDataSets = readDataObjectFromExcel(new File(excelName), SheetDataSet.class, readExcelOption); if (!CollectionUtils.isEmpty(sheetDataSets)) { SheetDataSet sheetDataSet = (SheetDataSet)sheetDataSets.get(0); Map<String, Integer> fieldColumnMap = new HashMap(); List<String> colName = sheetDataSet.getColName(); if (!CollectionUtils.isEmpty(colName)) { for(int i = 0; i < colName.size(); ++i) { String col = ((String)colName.get(i)).replace("*", "").replace("â", ""); if (excelTitleFieldNameMap.containsKey(col)) { fieldColumnMap.put(excelTitleFieldNameMap.get(col), i); } } List<WriteExcelData> writeExcelDataList = new ArrayList(); Integer[] index = new Integer[]{excelOption.getTitleRowIndex() + 1}; data.stream().forEach((d) -> { Map<String, String> dataMap = VciBaseUtil.objectToMapString(d); fieldColumnMap.forEach((field, col) -> { if (CollectionUtils.isEmpty(excelOption.getWriteFields()) || excelOption.getWriteFields().contains(field)) { WriteExcelData excelData = new WriteExcelData(index[0], col, dataMap.getOrDefault(field, "")); excelData.setReadOnly(excelOption.isReadOnlyFromField() && readOnlyFields.contains(field) || !CollectionUtils.isEmpty(excelOption.getReadOnlyFields()) && excelOption.getReadOnlyFields().contains(field)); writeExcelDataList.add(excelData); } }); Integer var7 = index[0]; Integer var8 = index[0] = index[0] + 1; }); WriteExcelOption writeExcelOption = new WriteExcelOption(); writeExcelOption.addSheetDataList(excelOption.getSheetName(), writeExcelDataList); writeExcelOption.setAppend(true); writeDataToFile(excelName, writeExcelOption); } } } } } Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/com/vci/starter/poi/util/PoiImportProcesser.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,8 @@ package com.vci.ubcs.com.vci.starter.poi.util; import java.lang.reflect.Field; @FunctionalInterface public interface PoiImportProcesser<T> { void process(Object var1, T var2, Field var3); } Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/com/vci/starter/poi/util/PoiTemplateProcesser.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,10 @@ package com.vci.ubcs.com.vci.starter.poi.util; import java.lang.reflect.Field; import java.util.Map; @FunctionalInterface public interface PoiTemplateProcesser<T> { Map<String, String> wrapperEnumMap(String var1, Class<T> var2, Field var3); } Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/com/vci/starter/util/LocalFileUtil.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,318 @@ package com.vci.ubcs.com.vci.starter.util; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.nio.channels.FileChannel; import java.nio.charset.StandardCharsets; import java.rmi.ServerException; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.UUID; import com.vci.ubcs.com.vci.starter.exception.VciBaseException; import org.apache.commons.io.IOUtils; import org.springblade.core.tool.utils.StringUtil; import org.springframework.boot.system.ApplicationHome; public class LocalFileUtil { public static Class mainClass = null; public LocalFileUtil() { } public static void deleteFile(File file) { if (file != null && file.exists()) { if (file.isDirectory()) { File[] files = file.listFiles(); for(int i = 0; i < files.length; ++i) { deleteFile(files[i]); } } file.delete(); } } public static void copyFile(File source, File target) { FileInputStream is = null; FileOutputStream os = null; try { is = new FileInputStream(source); os = new FileOutputStream(target); FileChannel sourceChannel = is.getChannel(); FileChannel targetChannel = os.getChannel(); int i = 0; for(int length = 2097152; sourceChannel.position() != sourceChannel.size(); ++i) { if (sourceChannel.size() - sourceChannel.position() < 20971520L) { length = (int)(sourceChannel.size() - sourceChannel.position()); } else { length = 20971520; } sourceChannel.transferTo(sourceChannel.position(), (long)length, targetChannel); sourceChannel.position(sourceChannel.position() + (long)length); } sourceChannel.close(); targetChannel.close(); } catch (Throwable var11) { throw new VciBaseException("æ·è´æä»¶åºé", new String[0], var11); } finally { IOUtils.closeQuietly(is); IOUtils.closeQuietly(os); } } public static String getDefaultTempFolder() { String path = getProjectFolder(); path = path + File.separator + "tempFolder" + File.separator + UUID.randomUUID().toString(); File folder = new File(path); if (!folder.exists()) { folder.mkdirs(); } return path; } public static String getProjectFolder() { return getProjectFolder(LocalFileUtil.class); } public static String getProjectFolder(Class classObj) { String path = ""; try { ApplicationHome h = new ApplicationHome(classObj == null ? (mainClass == null ? LocalFileUtil.class : mainClass) : classObj); File jarF = h.getSource(); if (jarF == null) { jarF = h.getDir(); } path = jarF.getParentFile().toString(); if (path.contains("!")) { path = (new File(path)).getParentFile().getParent(); } } catch (Throwable var4) { var4.printStackTrace(); throw new VciBaseException("è·åå½åæå¡æå¨çæä»¶å¤¹åºç°äºé误", new String[0], var4); } if (path.startsWith("file:\\")) { path = path.substring(6); } if (System.getProperty("os.name").toLowerCase().startsWith("win") && path.startsWith("/")) { path = path.substring(path.indexOf("/") + 1); } System.out.println("项ç®çè·¯å¾æ¯:" + path); return path; } public static void deleteTempFile(File tempFile, boolean deleteRandomFolder) { if (tempFile != null) { tempFile.delete(); if (deleteRandomFolder) { tempFile.getParentFile().delete(); } } } public static void alertNotNull(Object... s) { if (s != null && s.length > 0) { for(int i = 0; i < s.length; ++i) { Object obj = s[i]; if (obj == null || StringUtil.isBlank(obj.toString())) { String param = ""; try { ++i; param = s[i].toString(); } catch (Exception var5) { } throw new VciBaseException("åæ°[" + param + "]ä¸è½ä¸ºç©º"); } } } } public static String getFileExtension(File file) { return file != null ? getFileExtensionByName(file.getName()) : ""; } public static String getFileExtensionByName(String name) { return StringUtil.isNotBlank(name) && name.contains(".") ? name.substring(name.lastIndexOf(".") + 1) : ""; } public static String getFileNameForIE(String name) { if (StringUtil.isBlank(name)) { return name; } else if (name.contains(File.separator)) { return name.substring(name.lastIndexOf(File.separator) + 1); } else { return name.contains("\\") ? name.substring(name.lastIndexOf("\\") + 1) : name; } } public static String readContentForFileInJar(String fileName) { if (StringUtil.isBlank(fileName)) { throw new VciBaseException("æä»¶å为空"); } else { if (!fileName.startsWith("/")) { fileName = "/" + fileName; } InputStream in = null; ByteArrayOutputStream os = null; String var3; try { in = LocalFileUtil.class.getResourceAsStream(fileName); if (in == null) { in = Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName); } os = new ByteArrayOutputStream(); IOUtils.copy(in, os); var3 = new String(os.toByteArray(), "UTF-8"); } catch (Throwable var7) { throw new VciBaseException("读åæä»¶çå 容åºç°äºé误", new String[0], var7); } finally { IOUtils.closeQuietly(in); IOUtils.closeQuietly(os); } return var3; } } public static String readContentForFile(String fileName) { File file = new File(fileName); if (!file.exists()) { throw new VciBaseException("æä»¶æªæ¾å°ï¼{0}", new String[]{fileName}); } else { InputStream in = null; ByteArrayOutputStream os = null; String var4; try { in = new FileInputStream(file); os = new ByteArrayOutputStream(); IOUtils.copy(in, os); var4 = new String(os.toByteArray(), "UTF-8"); } catch (Throwable var8) { throw new VciBaseException("读åæä»¶çå 容åºç°äºé误", new String[0], var8); } finally { IOUtils.closeQuietly(in); IOUtils.closeQuietly(os); } return var4; } } public static void writeContentToFile(String content, String fileName) { File file = new File(fileName); if (!file.exists()) { File parentFile = file.getParentFile(); if (!parentFile.exists()) { parentFile.mkdirs(); } try { file.createNewFile(); } catch (IOException var11) { throw new VciBaseException("åå ¥æä»¶çå 容æ¶ååºç°äºå建æä»¶å¤±è´¥çé®é¢,{}", new String[]{fileName}, var11); } } if (content == null) { content = ""; } OutputStream os = null; try { os = new FileOutputStream(file); os.write(content.getBytes(StandardCharsets.UTF_8)); os.flush(); } catch (Throwable var9) { throw new VciBaseException("åå ¥æä»¶çå 容æ¶ååºç°äºåé误,{}", new String[]{fileName}, var9); } finally { IOUtils.closeQuietly(os); } } public static void copyFileInJar(String fileInJar, String target) { VciBaseUtil.alertNotNull(new Object[]{fileInJar, "æºæä»¶", target, "ç®æ æä»¶"}); File targetFile = new File(target); File folder = targetFile.getParentFile(); if (!folder.exists()) { folder.mkdirs(); } if (!targetFile.exists()) { try { targetFile.createNewFile(); } catch (IOException var11) { throw new VciBaseException("åå»ºç®æ æä»¶çåºç°äºé误", new String[0], var11); } } if (!fileInJar.startsWith("/")) { fileInJar = "/" + fileInJar; } InputStream in = null; FileOutputStream os = null; try { in = LocalFileUtil.class.getResourceAsStream(fileInJar); if (in == null) { in = Thread.currentThread().getContextClassLoader().getResourceAsStream(fileInJar); } os = new FileOutputStream(target); IOUtils.copy(in, os); } catch (Throwable var12) { throw new VciBaseException("æ·è´æä»¶çå 容åºç°äºé误.{0},{1}", new String[]{fileInJar, target}, var12); } finally { IOUtils.closeQuietly(in); IOUtils.closeQuietly(os); } } public static List<String> fileToPatch(Collection<File> fileList) { VciBaseUtil.alertNotNull(new Object[]{"æä»¶å表", fileList}); List<String> filePath = new ArrayList(); Iterator var2 = fileList.iterator(); while(var2.hasNext()) { File file = (File)var2.next(); if (!file.exists()) { throw new VciBaseException(file.getAbsolutePath() + "æä»¶æ²¡ææ¾å°" + new String[0]); } filePath.add(file.getAbsolutePath()); } return filePath; } } Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/com/vci/starter/web/annotation/VciFieldType.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,15 @@ package com.vci.ubcs.com.vci.starter.web.annotation; import com.vci.ubcs.com.vci.starter.web.enumpck.VciFieldTypeEnum; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target({ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) public @interface VciFieldType { VciFieldTypeEnum value() default VciFieldTypeEnum.VTString; } Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/com/vci/starter/web/enumpck/VciEnum.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,20 @@ package com.vci.ubcs.com.vci.starter.web.enumpck; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface VciEnum { String name() default ""; Class valueType() default String.class; String text() default ""; String description() default ""; } Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/com/vci/starter/web/enumpck/VciFieldTypeEnum.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,93 @@ package com.vci.ubcs.com.vci.starter.web.enumpck; @VciEnum( name = "VciFieldType", text = "屿§ç±»å" ) public enum VciFieldTypeEnum { VTString, VTInteger, VTLong, VTDouble, VTBoolean, VTDate, VTDateTime, VTTime, VTFilePath, VTClob; private VciFieldTypeEnum() { } public static String getValueByText(String text) { if (text != null && text.trim().length() != 0) { if ("å¸å°å".equalsIgnoreCase(text)) { return VTBoolean.name(); } else if ("é¿ææ¬".equalsIgnoreCase(text)) { return VTClob.name(); } else if ("æ¥æ".equalsIgnoreCase(text)) { return VTDate.name(); } else if ("æ¥ææ¶é´".equalsIgnoreCase(text)) { return VTDateTime.name(); } else if ("æ¶é´".equalsIgnoreCase(text)) { return VTTime.name(); } else if ("é¿æ´å".equalsIgnoreCase(text)) { return VTLong.name(); } else if ("éé¢/å精度".equalsIgnoreCase(text)) { return VTDouble.name(); } else if ("æ´å½¢".equalsIgnoreCase(text)) { return VTInteger.name(); } else { return "æä»¶".equalsIgnoreCase(text) ? VTFilePath.name() : VTString.name(); } } else { return ""; } } public static String getTextByValue(String value) { VciFieldTypeEnum wenum = forValue(value); if (wenum == null) { return ""; } else { switch (wenum) { case VTBoolean: return "å¸å°å"; case VTClob: return "é¿ææ¬"; case VTDate: return "æ¥æ"; case VTDateTime: return "æ¥ææ¶é´"; case VTTime: return "æ¶é´"; case VTLong: return "é¿æ´å"; case VTDouble: return "éé¢/å精度"; case VTInteger: return "æ´å½¢"; case VTFilePath: return "æä»¶"; default: return "å符串"; } } } public static VciFieldTypeEnum forValue(String value) { VciFieldTypeEnum[] var1 = values(); int var2 = var1.length; for(int var3 = 0; var3 < var2; ++var3) { VciFieldTypeEnum wenum = var1[var3]; if (wenum.name().equalsIgnoreCase(value)) { return wenum; } } return null; } } Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/com/vci/starter/web/toolmodel/DateConverter.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,188 @@ package com.vci.ubcs.com.vci.starter.web.toolmodel; import com.vci.ubcs.com.vci.starter.exception.VciBaseException; import com.vci.ubcs.com.vci.starter.web.util.VciDateUtil; import org.springblade.core.tool.utils.StringUtil; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; public class DateConverter { private DateFormat dateFormat; private int exactDateLength; private Date value; public DateConverter() { } public DateFormat getDateFormat() { return this.dateFormat; } public void setDateFormat(DateFormat dateFormat) { this.dateFormat = dateFormat; } public int getExactDateLength() { return this.exactDateLength; } public void setExactDateLength(int exactDateLength) { this.exactDateLength = exactDateLength; } public Date getValue() { return this.value; } public void setValue(Date value) { this.value = value; } public void setAsText(String text) throws VciBaseException { if (StringUtil.isBlank(text)) { this.setValue((Date)null); } else { text = text.trim(); text = text.replace("å¹´", "-").replace("æ", "-").replace("æ¥", "").replace("æ¶", ":").replace("å", ":"); String pattern = "\\d{2,4}([^\\d]?)\\d{1,2}\\1\\d{1,2}( \\d{1,2}([^\\d])\\d{1,2})?"; Pattern r = Pattern.compile(pattern); Matcher m = r.matcher(text); if (!m.find()) { throw new VciBaseException("䏿¯åæ ¼çæ¶é´æ ¼å¼å符串,{0}", new String[]{text}); } String dateSplit = m.group(1); String timeSplit = m.group(3); String formateStr = String.format("yyyy%sMM%sdd", dateSplit, dateSplit); String yearMD; if (StringUtil.isNotBlank(timeSplit)) { yearMD = text.substring(text.indexOf(" ")); String[] split = yearMD.split(timeSplit); if (split.length == 2) { formateStr = formateStr + String.format(" HH%smm", timeSplit); } if (split.length > 2) { formateStr = formateStr + String.format(" HH%smm%sss", timeSplit, timeSplit); } if (yearMD.contains(".")) { formateStr = formateStr + ".SSS"; } } yearMD = text.contains(" ") ? text.substring(0, text.indexOf(" ")) : text; if (StringUtil.isNotBlank(dateSplit)) { String year = text.substring(0, text.indexOf(dateSplit)); if (StringUtil.isNotBlank(year) && year.length() == 2) { formateStr = formateStr.replace("yyyy", "yy"); } String[] split = yearMD.split(dateSplit); if (split.length == 2) { formateStr = formateStr.replace("dd", ""); } } else if (!text.matches("^[0-9]*$")) { if (text.length() == 5) { formateStr = formateStr.replace("yyyyMMdd", "yy" + text.substring(2, 3) + "MM"); } if (text.length() == 7) { formateStr = formateStr.replace("yyyyMMdd", "yyyy" + text.substring(4, 5) + "MM"); } } else if (text.length() == 2 && text.matches("^[0-9]*$")) { formateStr = "yy"; } else if (text.length() == 4 && text.matches("^[0-9]*$")) { formateStr = "yyyy"; } else if (text.length() == 6 && text.matches("^[0-9]*$")) { formateStr = "yyyyMM"; } else if (StringUtil.isNotBlank(yearMD) && yearMD.length() < 6) { formateStr = formateStr.replace("yyyy", "yy"); } SimpleDateFormat simpleDateFormat = new SimpleDateFormat(formateStr); try { this.setValue(simpleDateFormat.parse(text)); } catch (ParseException var13) { formateStr = formateStr.replace("yyyy", "yy"); simpleDateFormat = new SimpleDateFormat(formateStr); try { this.setValue(simpleDateFormat.parse(text)); } catch (ParseException var12) { if (text.length() == 2 && text.matches("^[0-9]*$")) { formateStr = "yy"; } throw new VciBaseException("ä¸è½æ ¼å¼åæ¥æ: {0}", new String[]{text}, var13); } } } } private String fillNano(String text) { String nano = text.substring(text.lastIndexOf(".") + 1); if (nano.length() < 3) { for(int i = 0; i < 3 - nano.length(); ++i) { nano = nano + "0"; } } return text.substring(0, text.lastIndexOf(".")) + "." + nano; } public static void main(String[] args) { List<String> list = new ArrayList<String>() { { this.add("2020-11-12 12:12:03"); this.add("2020-1-2 2:2:3"); this.add("2020-11-12 12:12:03.232"); this.add("2020/11/12 12:12:03"); this.add("2020/1/2 2:2:3"); this.add("2020/11/12 12:12:03.232"); this.add("20/11/12 12:12:03"); this.add("20/1/2 2:2:3"); this.add("20/11/12 12:12:03.232"); this.add("2020"); this.add("2020-11"); this.add("202011"); this.add("12:02:12"); this.add("2:2:3"); this.add("20201112"); this.add("202012"); this.add("202012"); this.add("2020å¹´11æ12æ¥ 12æ¶12å03ç§"); this.add("2020å¹´1æ2æ¥ 2:2:3"); this.add("2020å¹´11æ12æ¥ 12æ¶12å03ç§232毫ç§"); } }; list.stream().forEach((t) -> { try { DateConverter dateConverter = new DateConverter(); dateConverter.setAsText(t); System.out.println("转æ¢å:" + t + "; 转æ¢å:" + VciDateUtil.date2Str(dateConverter.getValue(), "yyyy-MM-dd HH:mm:ss.SSS")); } catch (Throwable var2) { var2.printStackTrace(); } }); } public String getAsText(String dateFormat) { Date value = this.getValue(); if (StringUtil.isEmpty(dateFormat)) { dateFormat = "yyyy-MM-dd HH:mm:ss.SSS"; } return value != null ? (new SimpleDateFormat(dateFormat)).format(value) : ""; } } Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/com/vci/starter/web/util/ControllerUtil.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,248 @@ package com.vci.ubcs.com.vci.starter.web.util; import org.apache.commons.io.IOUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springblade.core.tool.utils.StringUtil; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.*; import java.net.URLEncoder; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class ControllerUtil { private static Logger logger = LoggerFactory.getLogger(ControllerUtil.class); public static final Map<String, String> tempFileForDownloadMap = new ConcurrentHashMap(); public ControllerUtil() { } public static void writeFileToResponse(HttpServletResponse response, String fileName) throws FileNotFoundException, IOException { writeFileToResponse(response, fileName, true); } public static void writeFileToResponse(HttpServletResponse response, String fileName, boolean deleteFile) throws FileNotFoundException, IOException { writeFileToResponse(response, (String)fileName, (String)null, deleteFile); } public static void writeFileToResponse(HttpServletResponse response, String fileName, String showName, boolean deleteFile) throws FileNotFoundException, IOException { File file = new File(fileName); if (!file.exists()) { throw new FileNotFoundException(fileName); } else { writeFileToResponse(response, file, showName, deleteFile); } } public static void writeFileToResponse(HttpServletResponse response, File file) throws FileNotFoundException, IOException { writeFileToResponse(response, file, true); } public static void writeFileToResponse(HttpServletResponse response, File file, boolean deleteFile) throws FileNotFoundException, IOException { writeFileToResponse(response, (File)file, (String)null, deleteFile); } public static void writeFileToResponse(HttpServletResponse response, File file, String showName, boolean deleteFile) throws FileNotFoundException, IOException { writeFileToResponse(response, file, showName, deleteFile, (String)null); } public static void writeFileToResponse(HttpServletResponse response, File file, String showName, boolean deleteFile, String contentType) throws FileNotFoundException, IOException { VciBaseUtil.alertNotNull(new Object[]{file, "æä»¶å¯¹è±¡"}); if (!file.exists()) { throw new FileNotFoundException(file.getName()); } else { if (StringUtil.isBlank(showName)) { showName = file.getName(); } FileInputStream in = null; boolean var11 = false; File parentFile; label96: { try { var11 = true; in = new FileInputStream(file); writeFileToResponse(response, in, showName, contentType); var11 = false; break label96; } catch (IOException var12) { if (logger.isErrorEnabled()) { logger.error("åå ¥æä»¶å°ååºæµåºé", var12); var11 = false; } else { var11 = false; } } finally { if (var11) { IOUtils.closeQuietly(in); if (deleteFile) { File parentFile1 = file.getParentFile(); file.delete(); parentFile1.delete(); } } } IOUtils.closeQuietly(in); if (deleteFile) { parentFile = file.getParentFile(); file.delete(); parentFile.delete(); } return; } IOUtils.closeQuietly(in); if (deleteFile) { parentFile = file.getParentFile(); file.delete(); parentFile.delete(); } } } public static void writeFileToResponse(HttpServletResponse response, InputStream ins, String showName) throws IOException { writeFileToResponse(response, ins, showName, (String)null); } public static void writeFileToResponse(HttpServletResponse response, InputStream ins, String showName, String contentType) throws IOException { if (StringUtil.isBlank(contentType)) { contentType = "application/force-download"; } if (StringUtil.isBlank(showName)) { showName = "ä¸è½½æä»¶"; } response.setContentType(contentType); try { String fileName = URLEncoder.encode(showName, "UTF8"); response.addHeader("Content-Disposition", "attachment; filename=" + fileName + ";filename*=utf-8''" + fileName); } catch (Exception var12) { if (logger.isErrorEnabled()) { logger.error("设置æä»¶çåç§°å°ååºæµçæ¶ååºé", var12); } } response.setCharacterEncoding("UTF-8"); Cookie cookie = new Cookie("fileDownload", "true"); cookie.setPath("/"); response.addCookie(cookie); try { IOUtils.copy(ins, response.getOutputStream()); } catch (IOException var10) { if (logger.isErrorEnabled()) { logger.error("åå ¥æä»¶å°ååºæµåºé", var10); } throw var10; } finally { IOUtils.closeQuietly(ins); } } public static void writeDataToResponse(HttpServletResponse response, byte[] data, String contentType) throws IOException { if (StringUtil.isBlank(contentType)) { contentType = "application/force-download"; } response.setContentType(contentType); response.setCharacterEncoding("UTF-8"); Cookie cookie = new Cookie("fileDownload", "true"); cookie.setPath("/"); response.addCookie(cookie); try { response.getOutputStream().write(data); } catch (IOException var5) { if (logger.isErrorEnabled()) { logger.error("åå ¥æä»¶å°ååºæµåºé", var5); } throw var5; } } public static void writeClasspathFileToResponse(HttpServletResponse response, String classPathFileName) throws FileNotFoundException, IOException { writeClasspathFileToResponse(response, classPathFileName, (String)null); } public static void writeClasspathFileToResponse(HttpServletResponse response, String classPathFileName, String showName) throws FileNotFoundException, IOException { InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(classPathFileName); if (StringUtil.isBlank(showName)) { showName = classPathFileName.contains("/") ? classPathFileName.substring(classPathFileName.lastIndexOf("/") + 1) : classPathFileName; } try { writeFileToResponse(response, in, showName); } catch (IOException var8) { throw var8; } finally { IOUtils.closeQuietly(in); } } public static String getClientInfo(HttpServletRequest request) { String ip = request.getHeader("X-Forwarded-For"); if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getHeader("Proxy-Client-IP"); } if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getHeader("WL-Proxy-Client-IP"); } if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getHeader("HTTP_CLIENT_IP"); } if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getHeader("HTTP_X_FORWARDED_FOR"); } if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getRemoteAddr(); } if (ip == null || ip.length() == 0 || ip.indexOf("0:0:0:0:0:0:0:1") > -1) { ip = "127.0.0.1"; } return ip; } public static void setQueryTotal(HttpServletRequest request, boolean isQueryTotal) { WebThreadLocalUtil.getNeedQueryTotalInThread().set(isQueryTotal ? "true" : "false"); } public static String putErrorFile(String errorFile) { String uuid = VciBaseUtil.getPk(); tempFileForDownloadMap.put(uuid, errorFile); return uuid; } public static void downloadErrorFile(HttpServletResponse response, String uuid) throws IOException { String errorFile = (String)tempFileForDownloadMap.getOrDefault(uuid, ""); try { if (StringUtil.isNotBlank(errorFile)) { writeFileToResponse(response, new File(errorFile), (String)null, true, "application/msexcel"); } } finally { tempFileForDownloadMap.remove(uuid); } } } Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/com/vci/starter/web/util/LangBaseUtil.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,32 @@ package com.vci.ubcs.com.vci.starter.web.util; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; public class LangBaseUtil { public LangBaseUtil() { } public static String getErrorMsg(Throwable e) { if (e == null) { return "æªç¥é误"; } else { if (e.getClass() != null && e.getClass().getSuperclass() != null && (e.getClass().getSuperclass().equals(RuntimeException.class) || e.getClass().getSuperclass().getName().endsWith(".VciBaseException") || e.getClass().getName().endsWith(".VciBaseException"))) { try { Method errorMethod = e.getClass().getMethod("getErrorMsg"); if (errorMethod != null) { return (String)errorMethod.invoke(e); } } catch (NoSuchMethodException var2) { return e.getMessage(); } catch (IllegalAccessException var3) { return e.getMessage(); } catch (InvocationTargetException var4) { return e.getMessage(); } } return e.getMessage(); } } } Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/com/vci/starter/web/util/VciBaseUtil.java
@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.vci.ubcs.com.vci.starter.exception.VciBaseException; import com.vci.ubcs.com.vci.starter.web.pagemodel.SessionInfo; import com.vci.ubcs.com.vci.starter.web.toolmodel.DateConverter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.util.CollectionUtils; @@ -1142,6 +1143,69 @@ return listHasList; } } public static short getShort(String s) { // short i = false; if (s == null) { return 0; } else { try { short i = Short.parseShort(s); return i; } catch (Exception var3) { return 0; } } } public static void setValueForField(Field field, Object obj, String value) { try { if (field != null && StringUtils.isNotBlank(value)) { field.setAccessible(true); Method setMethod = getSetmethod(field.getDeclaringClass(), field.getName()); Class type = field.getType(); Object valueObj = null; if (!type.equals(Integer.TYPE) && !type.equals(Integer.class)) { if (!type.equals(Float.TYPE) && !type.equals(Float.class)) { if (!type.equals(Long.TYPE) && !type.equals(Long.class)) { if (!type.equals(Double.class) && !type.equals(Double.TYPE)) { if (type.equals(Date.class)) { DateConverter dateConverter = new DateConverter(); dateConverter.setAsText(value); valueObj = dateConverter.getValue(); } else if (type.equals(String.class)) { valueObj = value; } else { valueObj = value; if (log.isErrorEnabled()) { log.error("䏿¯æçç±»å" + type.toString()); } } } else { valueObj = getDouble(value); } } else { valueObj = getLong(value); } } else { valueObj = getFloat(value); } } else { valueObj = getInt(value); } if (setMethod != null) { setMethod.invoke(obj, valueObj); } else { field.set(obj, valueObj); } } } catch (Throwable var7) { if (log.isErrorEnabled()) { log.error("è®¾ç½®å±æ§çå¼åºéäºé误", var7); } } } } Source/UBCS/ubcs-service-api/ubcs-dict-api/src/main/java/com/vci/ubcs/system/cache/DictBizCache.java
@@ -110,7 +110,7 @@ */ public static String getValue(String code, String dictKey) { String keyPrefix = DICT_VALUE.concat(StringPool.DASH).concat(AuthUtil.getTenantId()).concat(StringPool.COLON); return CacheUtil.get(DICT_CACHE, keyPrefix + code + StringPool.COLON, dictKey, () -> { return CacheUtil.get(DICT_CACHE+"Biz", keyPrefix + code + StringPool.COLON, dictKey, () -> { R<String> result = getDictClient().getValue(code, dictKey); return result.getData(); }); Source/UBCS/ubcs-service-api/ubcs-dict-api/src/main/java/com/vci/ubcs/system/feign/IDictBizClient.java
@@ -32,7 +32,7 @@ * @author Chill */ @FeignClient( value = AppConstant.APPLICATION_SYSTEM_NAME, value = AppConstant.APPLICATION_NAME_OMD, fallback = IDictBizClientFallback.class ) public interface IDictBizClient { Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/feign/IDictBizClient.java
@@ -18,6 +18,7 @@ import com.vci.ubcs.omd.entity.DictBizM; import org.springblade.core.launch.constant.AppConstant; import org.springblade.core.tool.api.R; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; @@ -33,7 +34,7 @@ * @author Chill */ @FeignClient( value = "blade-omd", value = AppConstant.APPLICATION_NAME_OMD, fallback = IDictBizClientFallback.class ) public interface IDictBizClient { Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeClassifyController.java
@@ -20,9 +20,15 @@ import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; import com.vci.ubcs.code.entity.CodeClassify; import com.vci.ubcs.code.mapper.CodeClassifyMapper; import com.vci.ubcs.code.vo.CodeOsattributeVO; import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO; import com.vci.ubcs.code.vo.pagemodel.TreeQueryObject; import com.vci.ubcs.com.vci.starter.util.LocalFileUtil; import com.vci.ubcs.com.vci.starter.web.pagemodel.BaseQueryObject; import com.vci.ubcs.com.vci.starter.web.pagemodel.DataGrid; import com.vci.ubcs.com.vci.starter.web.pagemodel.Tree; import com.vci.ubcs.com.vci.starter.web.util.ControllerUtil; import com.vci.ubcs.com.vci.starter.web.util.LangBaseUtil; import com.vci.ubcs.com.vci.starter.web.util.VciBaseUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -39,13 +45,16 @@ import org.springblade.core.tool.api.IResultCode; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.StringUtil; import org.springframework.web.bind.annotation.*; import com.vci.ubcs.code.wrapper.CodeClassifyWrapper; import com.vci.ubcs.code.service.ICodeClassifyService; import org.springblade.core.boot.ctrl.BladeController; import org.springframework.web.multipart.MultipartFile; import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.Collection; import java.util.Date; import java.util.List; @@ -78,6 +87,17 @@ CodeClassify detail = codeClassifyMapper.selectOne(Condition.getQueryWrapper(codeClassify)); return R.data(CodeClassifyWrapper.build().entityVO(detail)); } /** * 主é¢åºåç±»æ * @param treeQueryObject æ å½¢æ¥è¯¢å¯¹è±¡ * @return 主é¢åºåç±»æ¾ç¤ºæ */ @GetMapping("/treeCodeClassify") public List<Tree> treeCodeClassify(TreeQueryObject treeQueryObject) { return codeClassifyService. treeCodeClassify(treeQueryObject); } /** * 主é¢åºå®ä¹è¡¨ å页 */ @@ -217,14 +237,100 @@ @GetMapping("/exportClassify") public void exportClassify(String oid, HttpServletResponse response) throws IOException { String excelName = codeClassifyService.exportClassify(oid); // try { // ControllerUtil.writeFileToResponse(response,excelName); // } catch (Throwable e) { // //妿åºé,æé误信æ¯åå°text // String msg = LangBaseUtil.getErrorMsg(e); // String errorFile = LocalFileUtil.getDefaultTempFolder() + File.separator + "é误.txt"; // LocalFileUtil.writeContentToFile(msg,errorFile); // ControllerUtil.writeFileToResponse(response,errorFile); // } try { ControllerUtil.writeFileToResponse(response,excelName); } catch (Throwable e) { //妿åºé,æé误信æ¯åå°text String msg = LangBaseUtil.getErrorMsg(e); String errorFile = LocalFileUtil.getDefaultTempFolder() + File.separator + "é误.txt"; LocalFileUtil.writeContentToFile(msg,errorFile); ControllerUtil.writeFileToResponse(response,errorFile); } } /** * ä¸è½½å¯¼å ¥çæ¨¡æ¿ * @param response ååºå¯¹è±¡ * @throws IOException æåºå¼å¸¸ */ @GetMapping("/downloadImportExcel") public void downloadImportExcel(HttpServletResponse response) throws IOException{ String excelName = codeClassifyService.createImportExcel(); try { ControllerUtil.writeFileToResponse(response,excelName); } catch (Throwable e) { //妿åºé,æé误信æ¯åå°text String msg = LangBaseUtil.getErrorMsg(e); if(StringUtil.isBlank(msg)){ msg = "æªç¥é误"; } ControllerUtil.writeDataToResponse(response,msg.getBytes(StandardCharsets.UTF_8),null); } } /** * å¯¼å ¥åç±» * @param file excelçå 容 * @return æ§è¡ç»æï¼objæå¼è¡¨ç¤ºæé误信æ¯ï¼éè¦è®¿é®downloadErrorFileæ¥ä¸è½½ */ @PostMapping("/importClassify") public R importClassify(MultipartFile file) { String excelFileName = LocalFileUtil.getDefaultTempFolder() + File.separator + LocalFileUtil.getFileNameForIE(file.getOriginalFilename()); File file1 = new File(excelFileName); try { file.transferTo(new File(excelFileName)); codeClassifyService.importClassify(file1); return R.success("å¯¼å ¥æåï¼"); }catch (Throwable e) { String errorFile = LocalFileUtil.getDefaultTempFolder() + File.separator + "é误信æ¯.txt"; LocalFileUtil.writeContentToFile(LangBaseUtil.getErrorMsg(e),errorFile); //æ¾å°mapé // R result = R.fail("å¯¼å ¥å¤±è´¥"); // result.(ControllerUtil.putErrorFile(errorFile)); return R.data(400,errorFile,"å¯¼å ¥å¤±è´¥"); }finally { file1.delete(); } } /** * ä¸è½½é误çæä»¶ä¿¡æ¯ * @param uuid å¯ä¸æ è¯ * @param response ååºå¯¹è±¡ * @throws IOException æåºå¼å¸¸ */ @GetMapping("/downloadErrorFile") public void downloadErrorFile(String uuid, HttpServletResponse response) throws IOException { ControllerUtil.downloadErrorFile(response,uuid); } /** * è·ååç±»å ³èç屿§ * @param baseQueryObject æ¥è¯¢å¯¹è±¡ï¼å¿ é¡»æcodeClassifyOidï¼æ¯æidånameä¸¤ç§æ¥è¯¢æ¡ä»¶(䏿¯æå页) * @return 屿§çä¿¡æ¯ï¼å å«é»è®¤ç屿§ */ @GetMapping("/listClassifyLinkAttr") public DataGrid<CodeOsattributeVO> listClassifyLinkAttr(BaseQueryObject baseQueryObject){ return codeClassifyService.listClassifyLinkAttr(baseQueryObject); } /** * 使ç¨ç¼å·çè·¯å¾è·å对象 * @param idPath ç¼å·çè·¯å¾ï¼ä¸å®è¦ä»æé¡¶å±èç¹å¼å§ï¼æ ¼å¼ä¸ºxxx/yyy/zz è¿æ · * @return åç±»çæ¾ç¤ºå¯¹è±¡ */ @GetMapping("/getObjectByIdPath") public CodeClassifyVO getObjectByIdPath(String idPath){ return codeClassifyService.getObjectByIdPath(idPath); } /** * 主é¢åºçæ * @param treeQueryObject æ å½¢æ¥è¯¢å¯¹è±¡ * @return 主é¢åºæ¾ç¤ºæ */ @GetMapping("/treeTopCodeClassify") public List<Tree> treeTopCodeClassify(TreeQueryObject treeQueryObject){ return codeClassifyService.treeTopCodeClassify(treeQueryObject); } } Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeOsbtmtypeController.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,126 @@ /* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill åºéª (smallchill@163.com) */ package com.vci.ubcs.code.controller; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import lombok.AllArgsConstructor; import javax.validation.Valid; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; import org.springframework.web.bind.annotation.*; import com.baomidou.mybatisplus.core.metadata.IPage; import com.vci.ubcs.code.entity.CodeOsbtmtypeEntity; import com.vci.ubcs.code.vo.CodeOsbtmtypeVO; import com.vci.ubcs.code.wrapper.CodeOsbtmtypeWrapper; import com.vci.ubcs.code.service.ICodeOsbtmtypeService; import org.springblade.core.boot.ctrl.BladeController; /** * ä¸å¡ç±»å æ§å¶å¨ * * @author yuxc * @since 2023-04-13 */ @RestController @AllArgsConstructor @RequestMapping("ubcs-code/PLCodeOsbtmtype") @Api(value = "ä¸å¡ç±»å", tags = "ä¸å¡ç±»åæ¥å£") public class CodeOsbtmtypeController extends BladeController { private final ICodeOsbtmtypeService PLCodeOsbtmtypeService; /** * ä¸å¡ç±»å 详æ */ @GetMapping("/detail") @ApiOperationSupport(order = 1) @ApiOperation(value = "详æ ", notes = "ä¼ å ¥PLCodeOsbtmtype") public R<CodeOsbtmtypeVO> detail(CodeOsbtmtypeEntity PLCodeOsbtmtype) { CodeOsbtmtypeEntity detail = PLCodeOsbtmtypeService.getOne(Condition.getQueryWrapper(PLCodeOsbtmtype)); return R.data(CodeOsbtmtypeWrapper.build().entityVO(detail)); } /** * ä¸å¡ç±»å å页 */ @GetMapping("/list") @ApiOperationSupport(order = 2) @ApiOperation(value = "å页", notes = "ä¼ å ¥PLCodeOsbtmtype") public R<IPage<CodeOsbtmtypeVO>> list(CodeOsbtmtypeEntity PLCodeOsbtmtype, Query query) { IPage<CodeOsbtmtypeEntity> pages = PLCodeOsbtmtypeService.page(Condition.getPage(query), Condition.getQueryWrapper(PLCodeOsbtmtype)); return R.data(CodeOsbtmtypeWrapper.build().pageVO(pages)); } /** * ä¸å¡ç±»å èªå®ä¹å页 */ @GetMapping("/page") @ApiOperationSupport(order = 3) @ApiOperation(value = "å页", notes = "ä¼ å ¥PLCodeOsbtmtype") public R<IPage<CodeOsbtmtypeVO>> page(CodeOsbtmtypeVO PLCodeOsbtmtype, Query query) { IPage<CodeOsbtmtypeVO> pages = PLCodeOsbtmtypeService.selectPLCodeOsbtmtypePage(Condition.getPage(query), PLCodeOsbtmtype); return R.data(pages); } /** * ä¸å¡ç±»å æ°å¢ */ @PostMapping("/save") @ApiOperationSupport(order = 4) @ApiOperation(value = "æ°å¢", notes = "ä¼ å ¥PLCodeOsbtmtype") public R save(@Valid @RequestBody CodeOsbtmtypeEntity PLCodeOsbtmtype) { return R.status(PLCodeOsbtmtypeService.save(PLCodeOsbtmtype)); } /** * ä¸å¡ç±»å ä¿®æ¹ */ @PostMapping("/update") @ApiOperationSupport(order = 5) @ApiOperation(value = "ä¿®æ¹", notes = "ä¼ å ¥PLCodeOsbtmtype") public R update(@Valid @RequestBody CodeOsbtmtypeEntity PLCodeOsbtmtype) { return R.status(PLCodeOsbtmtypeService.updateById(PLCodeOsbtmtype)); } /** * ä¸å¡ç±»å æ°å¢æä¿®æ¹ */ @PostMapping("/submit") @ApiOperationSupport(order = 6) @ApiOperation(value = "æ°å¢æä¿®æ¹", notes = "ä¼ å ¥PLCodeOsbtmtype") public R submit(@Valid @RequestBody CodeOsbtmtypeEntity PLCodeOsbtmtype) { return R.status(PLCodeOsbtmtypeService.saveOrUpdate(PLCodeOsbtmtype)); } /** * ä¸å¡ç±»å å é¤ */ @PostMapping("/remove") @ApiOperationSupport(order = 7) @ApiOperation(value = "é»è¾å é¤", notes = "ä¼ å ¥ids") public R remove(@ApiParam(value = "主é®éå", required = true) @RequestParam String ids) { return null; // return R.status(PLCodeOsbtmtypeService.deleteLogic(Func.toLongList(ids))); } } Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/dto/CodeCodeAllcodeDTOAllcode.java
ÎļþÃû´Ó Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/dto/CodeCodeAllcodeDTO.java ÐÞ¸Ä @@ -16,7 +16,7 @@ */ package com.vci.ubcs.code.dto; import com.vci.ubcs.code.entity.CodeAllCode; import com.vci.ubcs.code.entity.CodeAllcode; import lombok.Data; import lombok.EqualsAndHashCode; @@ -28,7 +28,7 @@ */ @Data @EqualsAndHashCode(callSuper = true) public class CodeCodeAllcodeDTO extends CodeAllCode { public class CodeCodeAllcodeDTOAllcode extends CodeAllcode { private static final long serialVersionUID = 1L; } Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/dto/CodeOsbtmtypeDTO.javacopy from Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/dto/CodeCodeAllcodeDTO.java copy to Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/dto/CodeOsbtmtypeDTO.java
Îļþ´Ó Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/dto/CodeCodeAllcodeDTO.java ¸´ÖÆ @@ -16,19 +16,19 @@ */ package com.vci.ubcs.code.dto; import com.vci.ubcs.code.entity.CodeAllCode; import com.vci.ubcs.code.entity.CodeOsbtmtypeEntity; import lombok.Data; import lombok.EqualsAndHashCode; /** * å ¨é¨ç å¼ æ°æ®ä¼ è¾å¯¹è±¡å®ä½ç±» * ä¸å¡ç±»å æ°æ®ä¼ è¾å¯¹è±¡å®ä½ç±» * * @author ludc * @since 2023-04-03 * @author yuxc * @since 2023-04-13 */ @Data @EqualsAndHashCode(callSuper = true) public class CodeCodeAllcodeDTO extends CodeAllCode { public class CodeOsbtmtypeDTO extends CodeOsbtmtypeEntity { private static final long serialVersionUID = 1L; } Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/feign/CodeClstemplateClient.java
ÎļþÃû´Ó Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/feign/PlCodeClstemplateClient.java ÐÞ¸Ä @@ -16,10 +16,8 @@ */ package com.vci.ubcs.code.feign; import com.baomidou.mybatisplus.core.metadata.IPage; import lombok.AllArgsConstructor; import org.springblade.core.mp.support.BladePage; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import com.vci.ubcs.code.entity.CodeClstemplateEntity; import com.vci.ubcs.code.service.ICodeClstemplateService; @@ -36,7 +34,7 @@ @ApiIgnore() @RestController @AllArgsConstructor public class PlCodeClstemplateClient implements IPlCodeClstemplateClient { public class CodeClstemplateClient implements lCodeClstemplateClient { private final ICodeClstemplateService plCodeClstemplateService; Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/feign/CodeOsbtmtypeClient.javacopy from Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/feign/PlCodeClstemplateClient.java copy to Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/feign/CodeOsbtmtypeClient.java
Îļþ´Ó Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/feign/PlCodeClstemplateClient.java ¸´ÖÆ @@ -16,39 +16,37 @@ */ package com.vci.ubcs.code.feign; import com.baomidou.mybatisplus.core.metadata.IPage; import lombok.AllArgsConstructor; import org.springblade.core.mp.support.BladePage; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import com.vci.ubcs.code.entity.CodeClstemplateEntity; import com.vci.ubcs.code.service.ICodeClstemplateService; import com.vci.ubcs.code.entity.CodeOsbtmtypeEntity; import com.vci.ubcs.code.service.ICodeOsbtmtypeService; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import springfox.documentation.annotations.ApiIgnore; /** * ç¼ç åºå®ä¹-模æ¿ç®¡ç Feignå®ç°ç±» * ä¸å¡ç±»å Feignå®ç°ç±» * * @author yuxc * @since 2023-04-10 * @since 2023-04-13 */ @ApiIgnore() @RestController @AllArgsConstructor public class PlCodeClstemplateClient implements IPlCodeClstemplateClient { public class CodeOsbtmtypeClient implements ICodeOsbtmtypeClient { private final ICodeClstemplateService plCodeClstemplateService; private final ICodeOsbtmtypeService PLCodeOsbtmtypeService; @Override @GetMapping(TOP) public BladePage<CodeClstemplateEntity> top(Integer current, Integer size) { public BladePage<CodeOsbtmtypeEntity> top(Integer current, Integer size) { Query query = new Query(); query.setCurrent(current); query.setSize(size); // IPage<CodeClstemplateEntity> page = service.page(Condition.getPage(query)); // return BladePage.of(page); // IPage<CodeOsbtmtypeEntity> page = service.page(Condition.getPage(query)); return null; // return BladePage.of(page); } } Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/feign/ICodeOsbtmtypeClient.javacopy from Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/feign/IPlCodeClstemplateClient.java copy to Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/feign/ICodeOsbtmtypeClient.java
Îļþ´Ó Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/feign/IPlCodeClstemplateClient.java ¸´ÖÆ @@ -17,33 +17,33 @@ package com.vci.ubcs.code.feign; import org.springblade.core.mp.support.BladePage; import com.vci.ubcs.code.entity.CodeClstemplateEntity; import com.vci.ubcs.code.entity.CodeOsbtmtypeEntity; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; /** * ç¼ç åºå®ä¹-模æ¿ç®¡ç Feignæ¥å£ç±» * ä¸å¡ç±»å Feignæ¥å£ç±» * * @author yuxc * @since 2023-04-10 * @since 2023-04-13 */ @FeignClient( value = "blade-plCodeClstemplate" value = "ubcs-code" ) public interface IPlCodeClstemplateClient { public interface ICodeOsbtmtypeClient { String API_PREFIX = "/client"; String TOP = API_PREFIX + "/top"; String TOP = API_PREFIX + "/getOsbtmPage"; /** * è·åç¼ç åºå®ä¹-模æ¿ç®¡çå表 * è·åä¸å¡ç±»åå表 * * @param current é¡µå· * @param size é¡µæ° * @return BladePage */ @GetMapping(TOP) BladePage<CodeClstemplateEntity> top(@RequestParam("current") Integer current, @RequestParam("size") Integer size); BladePage<CodeOsbtmtypeEntity> top(@RequestParam("current") Integer current, @RequestParam("size") Integer size); } Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/feign/lCodeClstemplateClient.java
ÎļþÃû´Ó Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/feign/IPlCodeClstemplateClient.java ÐÞ¸Ä @@ -29,12 +29,12 @@ * @since 2023-04-10 */ @FeignClient( value = "blade-plCodeClstemplate" value = "ubcs-code" ) public interface IPlCodeClstemplateClient { public interface lCodeClstemplateClient { String API_PREFIX = "/client"; String TOP = API_PREFIX + "/top"; String TOP = API_PREFIX + "/getClstempPage"; /** * è·åç¼ç åºå®ä¹-模æ¿ç®¡çå表 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeClassifyMapper.java
@@ -1,3 +1,19 @@ /* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill åºéª (smallchill@163.com) */ package com.vci.ubcs.code.mapper; import com.vci.ubcs.code.entity.CodeClassify; @@ -60,4 +76,12 @@ */ List<CodeClassify> selectAllLevelChildHasPath(String oid); @MapKey("oid") List<Map<String,Object>> selectAllLevelParentByOid(String oid); @MapKey("oid") List<Map<String,Object>> selectByFieldPath(String fieldPath); } Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeOsbtmtypeMapper.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,43 @@ /* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill åºéª (smallchill@163.com) */ package com.vci.ubcs.code.mapper; import com.vci.ubcs.code.entity.CodeOsbtmtypeEntity; import com.vci.ubcs.code.vo.CodeOsbtmtypeVO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import java.util.List; /** * ä¸å¡ç±»å Mapper æ¥å£ * * @author yuxc * @since 2023-04-13 */ public interface CodeOsbtmtypeMapper extends BaseMapper<CodeOsbtmtypeEntity> { /** * èªå®ä¹å页 * * @param page * @param PLCodeOsbtmtype * @return */ List<CodeOsbtmtypeVO> selectPLCodeOsbtmtypePage(IPage page, CodeOsbtmtypeVO PLCodeOsbtmtype); } Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyService.java
@@ -4,11 +4,15 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import com.vci.ubcs.code.entity.CodeClassify; import com.vci.ubcs.code.vo.CodeOsattributeVO; import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO; import com.vci.ubcs.code.vo.pagemodel.TreeQueryObject; import com.vci.ubcs.com.vci.starter.web.pagemodel.BaseQueryObject; import com.vci.ubcs.com.vci.starter.web.pagemodel.DataGrid; import com.vci.ubcs.com.vci.starter.web.pagemodel.Tree; import org.springblade.core.tool.api.R; import java.io.File; import java.util.Collection; import java.util.List; @@ -145,4 +149,53 @@ * @return åç±»çæ¾ç¤ºå¯¹è±¡ */ List<CodeClassifyVO> listChildrenClassify(String codeClassifyOid, boolean allLevel, String fieldInPath, boolean enable); /** * åå»ºå¯¼å ¥æ¨¡æ¿ * @return excelæä»¶è·¯å¾ */ String createImportExcel(); /** * å¯¼å ¥åç±» * @param file1 æä»¶çä¿¡æ¯ */ void importClassify(File file1); /** * è·ååç±»å ³èç屿§ * @param baseQueryObject æ¥è¯¢å¯¹è±¡ï¼å¿ é¡»æcodeClassifyOidï¼æ¯æidånameä¸¤ç§æ¥è¯¢æ¡ä»¶ * @return 屿§çä¿¡æ¯ï¼å å«é»è®¤ç屿§ */ DataGrid<CodeOsattributeVO> listClassifyLinkAttr(BaseQueryObject baseQueryObject); /** * è·åå½ååç±»çé¡¶å±åç±» * * @param codeClassifyOid åç±»çä¸»é® * @return é¡¶å±åç±»çä¿¡æ¯ */ CodeClassifyVO getTopClassifyVO(String codeClassifyOid); /** * è·åå½ååç±»çææä¸çº§åç±»ï¼å«æ¬æ¬¡æ¥è¯¢å±çº§å·ï¼ * @param oid ä¸»é® * @return ææçä¸çº§ */ List<CodeClassify> selectAllLevelParentByOid(String oid); /** * 使ç¨ç¼å·çè·¯å¾è·å对象 * @param idPath ç¼å·çè·¯å¾ï¼ä¸å®è¦ä»æé¡¶å±èç¹å¼å§ï¼æ ¼å¼ä¸ºxxx/yyy/zz è¿æ · * @return åç±»çæ¾ç¤ºå¯¹è±¡ */ CodeClassifyVO getObjectByIdPath(String idPath); /** * 主é¢åºçæ * @param treeQueryObject æ å½¢æ¥è¯¢å¯¹è±¡ * @return 主é¢åºæ¾ç¤ºæ */ List<Tree> treeTopCodeClassify(TreeQueryObject treeQueryObject); } Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeKeyattrrepeatService.java
@@ -16,8 +16,13 @@ */ package com.vci.ubcs.code.service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.vci.ubcs.code.entity.CodeKeyattrrepeatEntity; import com.vci.ubcs.code.vo.CodeKeyattrrepeatVO; import com.vci.ubcs.code.vo.pagemodel.CodeKeyAttrRepeatRuleVO; import com.baomidou.mybatisplus.core.metadata.IPage; import java.util.Collection; import java.util.List; /** * å ³é®å±æ§æ¥éè§å æå¡ç±» @@ -36,5 +41,25 @@ */ IPage<CodeKeyattrrepeatVO> selectPlCodeKeyattrrepeatPage(IPage<CodeKeyattrrepeatVO> page, CodeKeyattrrepeatVO plCodeKeyattrrepeat); /** * 䏻鮿¹éè·åå ³é®æ°æ®æ¥éè§å * * @param oidCollections 主é®éåï¼ä½æ¯åæ§è½å½±åï¼å»ºè®®ä¸æ¬¡æ¥è¯¢ä¸è¶ è¿10000个 * @return å ³é®æ°æ®æ¥éè§åæ¾ç¤ºå¯¹è±¡ */ List<CodeKeyAttrRepeatRuleVO> listCodeKeyAttrRepeatRuleByOids(Collection<String> oidCollections) ; /** * æ¹éæ°æ®å¯¹è±¡è½¬æ¢ä¸ºæ¾ç¤ºå¯¹è±¡ * @param codeKeyattrrepeatEntityS æ°æ®å¯¹è±¡å表 * @return æ¾ç¤ºå¯¹è±¡ */ List<CodeKeyAttrRepeatRuleVO> codeKeyAttrRepeatRuleDO2VOs(Collection<CodeKeyattrrepeatEntity> codeKeyattrrepeatEntityS); /** * æ°æ®å¯¹è±¡è½¬æ¢ä¸ºæ¾ç¤ºå¯¹è±¡ * @param codeKeyattrrepeatEntity æ°æ®å¯¹è±¡ * @return æ¾ç¤ºå¯¹è±¡ */ CodeKeyAttrRepeatRuleVO codeKeyAttrRepeatRuleDO2VO(CodeKeyattrrepeatEntity codeKeyattrrepeatEntity); } Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeOsattributeService.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,43 @@ /* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill åºéª (smallchill@163.com) */ package com.vci.ubcs.code.service; import com.baomidou.mybatisplus.extension.service.IService; import com.vci.ubcs.code.entity.CodeOsattributeEntity; import com.vci.ubcs.code.vo.CodeOsattributeVO; import org.springblade.core.mp.base.BaseService; import com.baomidou.mybatisplus.core.metadata.IPage; /** * 屿§æ¾ç¤ºå¯¹è±¡ æå¡ç±» * * @author yuxc * @since 2023-04-14 */ public interface ICodeOsattributeService extends IService<CodeOsattributeEntity> { /** * èªå®ä¹å页 * * @param page * @param CodeOsattribute * @return */ IPage<CodeOsattributeVO> selectCodeOsattributePage(IPage<CodeOsattributeVO> page, CodeOsattributeVO CodeOsattribute); } Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeOsbtmtypeService.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,44 @@ /* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill åºéª (smallchill@163.com) */ package com.vci.ubcs.code.service; import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.vci.ubcs.code.entity.CodeOsbtmtypeEntity; import com.vci.ubcs.code.vo.CodeOsbtmtypeVO; import org.springblade.core.mp.base.BaseService; import com.baomidou.mybatisplus.core.metadata.IPage; /** * ä¸å¡ç±»å æå¡ç±» * * @author yuxc * @since 2023-04-13 */ public interface ICodeOsbtmtypeService extends IService<CodeOsbtmtypeEntity> { /** * èªå®ä¹å页 * * @param page * @param PLCodeOsbtmtype * @return */ IPage<CodeOsbtmtypeVO> selectPLCodeOsbtmtypePage(IPage<CodeOsbtmtypeVO> page, CodeOsbtmtypeVO PLCodeOsbtmtype); } Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeKeyattrrepeatServiceImpl.java
@@ -16,12 +16,22 @@ */ package com.vci.ubcs.code.service.impl; import com.baomidou.mybatisplus.core.metadata.IPage; import com.vci.ubcs.code.entity.CodeKeyattrrepeatEntity; import com.vci.ubcs.code.enumpack.FrameworkDataLCStatus; import com.vci.ubcs.code.vo.CodeKeyattrrepeatVO; import com.vci.ubcs.code.mapper.CodeKeyattrrepeatMapper; import com.vci.ubcs.code.service.ICodeKeyattrrepeatService; import com.vci.ubcs.code.vo.CodeKeyattrrepeatVO; import com.vci.ubcs.code.vo.pagemodel.CodeKeyAttrRepeatRuleVO; import com.vci.ubcs.com.vci.starter.web.util.BeanUtilForVCI; import com.vci.ubcs.com.vci.starter.web.util.VciBaseUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.core.metadata.IPage; import org.springframework.util.CollectionUtils; import java.util.ArrayList; import java.util.Collection; import java.util.List; /** * å ³é®å±æ§æ¥éè§å æå¡å®ç°ç±» @@ -40,5 +50,71 @@ return page.setRecords(codeKeyattrrepeatMapper.selectPlCodeKeyattrrepeatPage(page, plCodeKeyattrrepeat)); } /** * 䏻鮿¹éè·åå ³é®æ°æ®æ¥éè§å * * @param oidCollections 主é®éåï¼ä½æ¯åæ§è½å½±åï¼å»ºè®®ä¸æ¬¡æ¥è¯¢ä¸è¶ è¿10000个 * @return å ³é®æ°æ®æ¥éè§åæ¾ç¤ºå¯¹è±¡ */ @Override public List<CodeKeyAttrRepeatRuleVO> listCodeKeyAttrRepeatRuleByOids(Collection<String> oidCollections) { VciBaseUtil.alertNotNull(oidCollections,"æ°æ®å¯¹è±¡ä¸»é®éå"); List<CodeKeyattrrepeatEntity> codeKeyAttrRepeatRuleDOList = listCodeKeyAttrRepeatRuleDOByOidCollections(oidCollections); return codeKeyAttrRepeatRuleDO2VOs(codeKeyAttrRepeatRuleDOList); } /** * æ¹éæ°æ®å¯¹è±¡è½¬æ¢ä¸ºæ¾ç¤ºå¯¹è±¡ * @param codeKeyattrrepeatEntityS æ°æ®å¯¹è±¡å表 * @return æ¾ç¤ºå¯¹è±¡ */ @Override public List<CodeKeyAttrRepeatRuleVO> codeKeyAttrRepeatRuleDO2VOs(Collection<CodeKeyattrrepeatEntity> codeKeyattrrepeatEntityS){ List<CodeKeyAttrRepeatRuleVO> voList = new ArrayList<CodeKeyAttrRepeatRuleVO>(); if(!CollectionUtils.isEmpty(codeKeyattrrepeatEntityS)){ for(CodeKeyattrrepeatEntity s: codeKeyattrrepeatEntityS){ CodeKeyAttrRepeatRuleVO vo = codeKeyAttrRepeatRuleDO2VO(s); if(vo != null){ voList.add(vo); } } } return voList; } /** * 使ç¨ä¸»é®éåæ¥è¯¢æ°æ®å¯¹è±¡ * @param oidCollections 主é®çéå * @return æ°æ®å¯¹è±¡å表 */ private List<CodeKeyattrrepeatEntity> listCodeKeyAttrRepeatRuleDOByOidCollections(Collection<String> oidCollections){ List<CodeKeyattrrepeatEntity> codeKeyAttrRepeatRuleDOList = new ArrayList<CodeKeyattrrepeatEntity>(); if(!CollectionUtils.isEmpty(oidCollections)){ Collection<Collection<String>> oidCollectionsList = VciBaseUtil.switchCollectionForOracleIn(oidCollections); for(Collection<String> oids: oidCollectionsList){ List<CodeKeyattrrepeatEntity> tempDOList = codeKeyattrrepeatMapper.selectBatchIds(oids); if(!CollectionUtils.isEmpty(tempDOList)){ codeKeyAttrRepeatRuleDOList.addAll(tempDOList); } } } return codeKeyAttrRepeatRuleDOList; } /** * æ°æ®å¯¹è±¡è½¬æ¢ä¸ºæ¾ç¤ºå¯¹è±¡ * @param codeKeyattrrepeatEntity æ°æ®å¯¹è±¡ * @return æ¾ç¤ºå¯¹è±¡ */ @Override public CodeKeyAttrRepeatRuleVO codeKeyAttrRepeatRuleDO2VO(CodeKeyattrrepeatEntity codeKeyattrrepeatEntity) { CodeKeyAttrRepeatRuleVO vo = new CodeKeyAttrRepeatRuleVO(); if(codeKeyattrrepeatEntity != null) { BeanUtilForVCI.copyPropertiesIgnoreCase(codeKeyattrrepeatEntity, vo); //妿ælcstatusçç±»çè¯ vo.setLcStatusText(FrameworkDataLCStatus.getTextByValue(vo.getLcStatus())); } return vo; } } Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeOsbtmtypeServiceImpl.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,42 @@ /* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill åºéª (smallchill@163.com) */ package com.vci.ubcs.code.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.vci.ubcs.code.entity.CodeOsbtmtypeEntity; import com.vci.ubcs.code.vo.CodeOsbtmtypeVO; import com.vci.ubcs.code.mapper.CodeOsbtmtypeMapper; import com.vci.ubcs.code.service.ICodeOsbtmtypeService; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.core.metadata.IPage; /** * ä¸å¡ç±»å æå¡å®ç°ç±» * * @author yuxc * @since 2023-04-13 */ @Service public class CodeOsbtmtypeServiceImpl extends ServiceImpl<CodeOsbtmtypeMapper, CodeOsbtmtypeEntity> implements ICodeOsbtmtypeService { @Override public IPage<CodeOsbtmtypeVO> selectPLCodeOsbtmtypePage(IPage<CodeOsbtmtypeVO> page, CodeOsbtmtypeVO PLCodeOsbtmtype) { return page.setRecords(baseMapper.selectPLCodeOsbtmtypePage(page, PLCodeOsbtmtype)); } } Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/wrapper/CodeButtonWrapper.java
@@ -18,9 +18,11 @@ import com.vci.ubcs.code.entity.CodeButtonEntity; import com.vci.ubcs.code.vo.CodeButtonVO; import com.vci.ubcs.system.cache.DictBizCache; import com.vci.ubcs.system.cache.DictCache; import com.vci.ubcs.system.enums.DictEnum; import org.springblade.core.mp.support.BaseEntityWrapper; import org.springblade.core.redis.cache.BladeRedis; import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.Func; import org.springframework.boot.autoconfigure.security.SecurityProperties; @@ -43,8 +45,8 @@ @Override public CodeButtonVO entityVO(CodeButtonEntity codebutton) { CodeButtonVO codebuttonVO = Objects.requireNonNull(BeanUtil.copy(codebutton, CodeButtonVO.class)); codebuttonVO.setUsedpositiontypeName(DictCache.getValue("codeButtonPosition", codebutton.getUsedpositiontype())); codebuttonVO.setLcstatusName(DictCache.getValue("codeLcstatus", codebutton.getLcstatus())); codebuttonVO.setUsedpositiontypeName(DictBizCache.getValue("codeButtonPosition", codebutton.getUsedpositiontype())); codebuttonVO.setLcstatusName(DictBizCache.getValue("codeLcstatus", codebutton.getLcstatus())); return codebuttonVO; } Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/wrapper/CodeOsbtmtypeWrapper.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,50 @@ /* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill åºéª (smallchill@163.com) */ package com.vci.ubcs.code.wrapper; import org.springblade.core.mp.support.BaseEntityWrapper; import org.springblade.core.tool.utils.BeanUtil; import com.vci.ubcs.code.entity.CodeOsbtmtypeEntity; import com.vci.ubcs.code.vo.CodeOsbtmtypeVO; import java.util.Objects; /** * ä¸å¡ç±»å å è£ ç±»,è¿åè§å¾å±æéçåæ®µ * * @author yuxc * @since 2023-04-13 */ public class CodeOsbtmtypeWrapper extends BaseEntityWrapper<CodeOsbtmtypeEntity, CodeOsbtmtypeVO> { public static CodeOsbtmtypeWrapper build() { return new CodeOsbtmtypeWrapper(); } @Override public CodeOsbtmtypeVO entityVO(CodeOsbtmtypeEntity PLCodeOsbtmtype) { CodeOsbtmtypeVO PLCodeOsbtmtypeVO = Objects.requireNonNull(BeanUtil.copy(PLCodeOsbtmtype, CodeOsbtmtypeVO.class)); //User createUser = UserCache.getUser(PLCodeOsbtmtype.getCreateUser()); //User updateUser = UserCache.getUser(PLCodeOsbtmtype.getUpdateUser()); //PLCodeOsbtmtypeVO.setCreateUserName(createUser.getName()); //PLCodeOsbtmtypeVO.setUpdateUserName(updateUser.getName()); return PLCodeOsbtmtypeVO; } } Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeCLassifyMapper.xml
@@ -137,10 +137,23 @@ codeclassify0.parentCodeClassifyOid = #{oid} </if> <if test="oid = null or oid = ''"> codeclassify0.parentCodeClassifyOid = is null codeclassify0.parentCodeClassifyOid is null </if> </where> CONNECT BY PRIOR codeclassify0.OID = codeclassify0.parentCodeClassifyOid </select> <select id="selectAllLevelParentByOid" resultType="java.util.HashMap"> select oid,level from pl_code_classify start with oid= #{oid} connect by prior PARENTCODECLASSIFYOID = oid </select> <select id="selectByFieldPath" resultType="java.util.HashMap"> select * from (select oid, SYS_CONNECT_BY_PATH(id, '/') as paths from pl_code_classify START WITH parentCodeClassifyOid is null CONNECT BY PRIOR OID = parentCodeClassifyOid) a where a.paths = #{fieldPath} </select> </mapper> Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeOsbtmtypeMapper.xml
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,42 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.vci.ubcs.code.mapper.CodeOsbtmtypeMapper"> <!-- éç¨æ¥è¯¢æ å°ç»æ --> <resultMap id="PLCodeOsbtmtypeResultMap" type="com.vci.ubcs.code.entity.CodeOsbtmtypeEntity"> <result column="OID" property="oid"/> <result column="ID" property="id"/> <result column="NAME" property="name"/> <result column="TABLENAME" property="tablename"/> <result column="DESCRIPTION" property="description"/> <result column="REVISIONRULEID" property="revisionruleid"/> <result column="REVISIONRULENAME" property="revisionrulename"/> <result column="REVISIONSEP" property="revisionsep"/> <result column="INPUTREVISIONFLAG" property="inputrevisionflag"/> <result column="SECRETFLAG" property="secretflag"/> <result column="ABSTRACTFLAG" property="abstractflag"/> <result column="IMPLCLASS" property="implclass"/> <result column="SHAPE" property="shape"/> <result column="LIFECYCLEID" property="lifecycleid"/> <result column="LIFECYCLENAME" property="lifecyclename"/> <result column="VERSIONRULE" property="versionrule"/> <result column="SUBLIFECYCLEID" property="sublifecycleid"/> <result column="SUBLIFECYCLENAME" property="sublifecyclename"/> <result column="VIEWFLAG" property="viewflag"/> <result column="VIEWCREATESQL" property="viewcreatesql"/> <result column="BTMNAME" property="btmname"/> <result column="OWNER" property="owner"/> <result column="CREATOR" property="creator"/> <result column="CREATETIME" property="createtime"/> <result column="LASTMODIFIER" property="lastmodifier"/> <result column="LASTMODIFYTIME" property="lastmodifytime"/> <result column="TS" property="ts"/> </resultMap> <select id="selectPLCodeOsbtmtypePage" resultMap="PLCodeOsbtmtypeResultMap"> select * from PL_CODE_OSBTMTYPE where is_deleted = 0 </select> </mapper> Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/DictBizServiceImpl.java
@@ -4,15 +4,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.vci.ubcs.common.constant.CommonConstant; import com.vci.ubcs.omd.cache.DictBizCache; import com.vci.ubcs.omd.entity.DictBizM; import com.vci.ubcs.core.log.exception.ServiceException; import com.vci.ubcs.omd.mapper.DictBizMapper; import com.vci.ubcs.omd.service.IDictBizService; import com.vci.ubcs.omd.vo.DictBizMVO; import com.vci.ubcs.omd.wrapper.DictBizWrapper; import com.vci.ubcs.common.constant.CommonConstant; import org.springblade.core.cache.utils.CacheUtil; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; @@ -20,6 +17,9 @@ import org.springblade.core.tool.node.ForestNodeMerger; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.StringPool; import com.vci.ubcs.omd.cache.DictBizCache; import com.vci.ubcs.omd.entity.DictBizM; import com.vci.ubcs.omd.vo.DictBizMVO; import org.springframework.stereotype.Service; import java.util.ArrayList;