Merge remote-tracking branch 'origin/master'
| | |
| | | /** |
| | | * è·³è·å符 |
| | | */ |
| | | private String skipCode; |
| | | private String jumpCharacter; |
| | | |
| | | /** |
| | | * åå§å¼ |
| | | */ |
| | | private String startCode; |
| | | private String initialValue; |
| | | |
| | | /** |
| | | * æ¥é¿ |
| | | */ |
| | | private Integer serialStep; |
| | | private String stepLength; |
| | | |
| | | /** |
| | | * åç¼ |
| | | */ |
| | | private String prefixCode; |
| | | private String prefixion; |
| | | |
| | | /** |
| | | * åç¼ |
| | | */ |
| | | private String suffixCode; |
| | | private String suffix; |
| | | |
| | | /** |
| | | * æè¿° |
| | |
| | | * æ¶é´æ³ï¼æ ¼å¼æ¯yyyy-MM-dd HH:mm:ss.SSS |
| | | */ |
| | | private Date ts; |
| | | |
| | | /** |
| | | * å建人 |
| | | */ |
| | | private String creator; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * æåä¿®æ¹äºº |
| | | */ |
| | | private String lastModifier; |
| | | |
| | | /** |
| | | * æåä¿®æ¹æ¶é´ï¼æ ¼å¼æ¯yyyy-MM-dd HH:mm:ss |
| | | */ |
| | | private Date lastModifyTime; |
| | | |
| | | public void setCreator(String creator) { |
| | | this.creator = creator; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public void setLastModifier(String lastModifier) { |
| | | this.lastModifier = lastModifier; |
| | | } |
| | | |
| | | public void setLastModifyTime(Date lastModifyTime) { |
| | | this.lastModifyTime = lastModifyTime; |
| | | } |
| | | |
| | | public String getCreator() { |
| | | return creator; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public String getLastModifier() { |
| | | return lastModifier; |
| | | } |
| | | |
| | | public Date getLastModifyTime() { |
| | | return lastModifyTime; |
| | | } |
| | | |
| | | public String getOid() { |
| | | return oid; |
| | |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getSkipCode() { |
| | | return skipCode; |
| | | public void setJumpCharacter(String jumpCharacter) { |
| | | this.jumpCharacter = jumpCharacter; |
| | | } |
| | | |
| | | public void setSkipCode(String skipCode) { |
| | | this.skipCode = skipCode; |
| | | public String getJumpCharacter() { |
| | | return jumpCharacter; |
| | | } |
| | | |
| | | public String getStartCode() { |
| | | return startCode; |
| | | public String getInitialValue() { |
| | | return initialValue; |
| | | } |
| | | |
| | | public void setStartCode(String startCode) { |
| | | this.startCode = startCode; |
| | | public void setInitialValue(String initialValue) { |
| | | this.initialValue = initialValue; |
| | | } |
| | | |
| | | public Integer getSerialStep() { |
| | | return serialStep; |
| | | public void setStepLength(String stepLength) { |
| | | this.stepLength = stepLength; |
| | | } |
| | | |
| | | public void setSerialStep(Integer serialStep) { |
| | | this.serialStep = serialStep; |
| | | public String getStepLength() { |
| | | return stepLength; |
| | | } |
| | | |
| | | public String getPrefixCode() { |
| | | return prefixCode; |
| | | public void setPrefixion(String prefixion) { |
| | | this.prefixion = prefixion; |
| | | } |
| | | |
| | | public void setPrefixCode(String prefixCode) { |
| | | this.prefixCode = prefixCode; |
| | | public String getPrefixion() { |
| | | return prefixion; |
| | | } |
| | | |
| | | public String getSuffixCode() { |
| | | return suffixCode; |
| | | public void setSuffix(String suffix) { |
| | | this.suffix = suffix; |
| | | } |
| | | |
| | | public void setSuffixCode(String suffixCode) { |
| | | this.suffixCode = suffixCode; |
| | | public String getSuffix() { |
| | | return suffix; |
| | | } |
| | | |
| | | public String getDescription() { |
| | |
| | | "oid='" + oid + '\'' + |
| | | ", id='" + id + '\'' + |
| | | ", name='" + name + '\'' + |
| | | ", skipCode='" + skipCode + '\'' + |
| | | ", startCode='" + startCode + '\'' + |
| | | ", serialStep=" + serialStep + |
| | | ", prefixCode='" + prefixCode + '\'' + |
| | | ", suffixCode='" + suffixCode + '\'' + |
| | | ", jumpCharacter='" + jumpCharacter + '\'' + |
| | | ", initialValue='" + initialValue + '\'' + |
| | | ", serialStep=" + stepLength + |
| | | ", prefixion='" + prefixion + '\'' + |
| | | ", suffix='" + suffix + '\'' + |
| | | ", description='" + description + '\'' + |
| | | ", ts=" + ts + |
| | | '}'; |
| | |
| | | /** |
| | | * è·³è·å符 |
| | | */ |
| | | private String skipCode; |
| | | private String jumpCharacter; |
| | | |
| | | /** |
| | | * åå§å¼ |
| | | */ |
| | | private String startCode; |
| | | private String initialValue; |
| | | |
| | | /** |
| | | * æ¥é¿ |
| | | */ |
| | | private Integer serialStep; |
| | | private Integer stepLength; |
| | | |
| | | /** |
| | | * åç¼ |
| | | */ |
| | | private String prefixCode; |
| | | private String prefixion; |
| | | |
| | | /** |
| | | * åç¼ |
| | | */ |
| | | private String suffixCode; |
| | | private String suffix; |
| | | |
| | | /** |
| | | * æè¿° |
| | |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getSkipCode() { |
| | | return skipCode; |
| | | public void setJumpCharacter(String jumpCharacter) { |
| | | this.jumpCharacter = jumpCharacter; |
| | | } |
| | | |
| | | public void setSkipCode(String skipCode) { |
| | | this.skipCode = skipCode; |
| | | public String getJumpCharacter() { |
| | | return jumpCharacter; |
| | | } |
| | | |
| | | public String getStartCode() { |
| | | return startCode; |
| | | public void setInitialValue(String initialValue) { |
| | | this.initialValue = initialValue; |
| | | } |
| | | |
| | | public void setStartCode(String startCode) { |
| | | this.startCode = startCode; |
| | | public String getInitialValue() { |
| | | return initialValue; |
| | | } |
| | | |
| | | public Integer getSerialStep() { |
| | | return serialStep; |
| | | public Integer getStepLength() { |
| | | return stepLength; |
| | | } |
| | | |
| | | public void setSerialStep(Integer serialStep) { |
| | | this.serialStep = serialStep; |
| | | public void setStepLength(Integer stepLength) { |
| | | this.stepLength = stepLength; |
| | | } |
| | | |
| | | public String getPrefixCode() { |
| | | return prefixCode; |
| | | public void setPrefixion(String prefixion) { |
| | | this.prefixion = prefixion; |
| | | } |
| | | |
| | | public void setPrefixCode(String prefixCode) { |
| | | this.prefixCode = prefixCode; |
| | | public void setSuffix(String suffix) { |
| | | this.suffix = suffix; |
| | | } |
| | | |
| | | public String getSuffixCode() { |
| | | return suffixCode; |
| | | public String getSuffix() { |
| | | return suffix; |
| | | } |
| | | |
| | | public void setSuffixCode(String suffixCode) { |
| | | this.suffixCode = suffixCode; |
| | | public String getPrefixion() { |
| | | return prefixion; |
| | | } |
| | | |
| | | public String getDescription() { |
| | |
| | | "oid='" + oid + '\'' + |
| | | ", id='" + id + '\'' + |
| | | ", name='" + name + '\'' + |
| | | ", skipCode='" + skipCode + '\'' + |
| | | ", startCode='" + startCode + '\'' + |
| | | ", serialStep=" + serialStep + |
| | | ", prefixCode='" + prefixCode + '\'' + |
| | | ", suffixCode='" + suffixCode + '\'' + |
| | | ", jumpCharacter='" + jumpCharacter + '\'' + |
| | | ", initialValue='" + initialValue + '\'' + |
| | | ", stepLength=" + stepLength + |
| | | ", prefixion='" + prefixion + '\'' + |
| | | ", suffix='" + suffix + '\'' + |
| | | ", description='" + description + '\'' + |
| | | ", btmname='" + btmname + '\'' + |
| | | ", owner='" + owner + '\'' + |
| | |
| | | /** |
| | | * 屿§ç±»å |
| | | */ |
| | | @ExcelColumn(value="屿§ç±»å(请åç
§æ°å¢çé¢ç屿§ç±»åå¡«å)",nullable = false) |
| | | @ExcelColumn(value="屿§ç±»å(åç
§æ°å¢çé¢ç屿§ç±»åå¦VTString)",nullable = false) |
| | | private String attributeDataType; |
| | | |
| | | /** |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.vci.po; |
| | | |
| | | import com.vci.starter.poi.annotation.ExcelColumn; |
| | | import com.vci.starter.web.pagemodel.BaseModelVO; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | /** |
| | | * 龿¥ç±»å导å
¥å¯¹è±¡ |
| | | * @author yuxc |
| | | * @date 2024/7/30 16:27 |
| | | */ |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class OsLinkTypePO extends BaseModelVO { |
| | | |
| | | /** |
| | | * ç¦æ¢ä¿®æ¹è¿ä¸ªå¼ |
| | | */ |
| | | private static final long serialVersionUID = -2239512786206928201L; |
| | | |
| | | /** |
| | | * æå¨æ°æ®è¡ |
| | | */ |
| | | @ExcelColumn(rowIndexColumn = true,value = "") |
| | | private String rowIndex; |
| | | |
| | | /** |
| | | * æ ç¾ |
| | | */ |
| | | @ExcelColumn(value="æ ç¾",nullable = false) |
| | | private String tag; |
| | | |
| | | /** |
| | | * åç§° |
| | | */ |
| | | @ExcelColumn(value="åç§°",nullable = false) |
| | | private String name; |
| | | |
| | | /** |
| | | * æè¿° |
| | | */ |
| | | @ExcelColumn(value="æè¿°") |
| | | private String description; |
| | | |
| | | /** |
| | | * å½¢ç¶ |
| | | */ |
| | | @ExcelColumn(value="å½¢ç¶") |
| | | private String shape; |
| | | |
| | | /** |
| | | * to端对åºå
³ç³» |
| | | */ |
| | | @ExcelColumn(value="To端对åºå
³ç³»") |
| | | private String relationTo; |
| | | |
| | | /** |
| | | * From端对åºå
³ç³» |
| | | */ |
| | | @ExcelColumn(value="From端对åºå
³ç³»") |
| | | private String relationFrom; |
| | | |
| | | // /** |
| | | // * 对åºå
³ç³»ï¼from端å¨åï¼to端å¨å |
| | | // */ |
| | | // @ExcelColumn(value="对åºå
³ç³»ï¼from端å¨åï¼to端å¨å") |
| | | // private String relation; |
| | | |
| | | /** |
| | | * To端主类å |
| | | */ |
| | | @ExcelColumn(value="To端主类å") |
| | | private String primitivesTo; |
| | | |
| | | /** |
| | | * From端主类å |
| | | */ |
| | | @ExcelColumn(value="From端主类å") |
| | | private String primitivesFrom; |
| | | |
| | | /** |
| | | * å®ç°ç±» |
| | | */ |
| | | @ExcelColumn(value="å®ç°ç±»") |
| | | private String implClass; |
| | | |
| | | /** |
| | | * From端类åå表 |
| | | */ |
| | | @ExcelColumn(value="From端类åå表") |
| | | private String btmItemsFrom; |
| | | |
| | | /** |
| | | * To端类åå表 |
| | | */ |
| | | @ExcelColumn(value="To端类åå表") |
| | | private String btmItemsTo; |
| | | |
| | | /** |
| | | * 屿§å表 |
| | | */ |
| | | @ExcelColumn(value="屿§å表") |
| | | private String attributes; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.vci.po; |
| | | |
| | | import com.vci.starter.poi.annotation.ExcelColumn; |
| | | import com.vci.starter.web.pagemodel.BaseModelVO; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | /** |
| | | * 屿§æ± 导å
¥å¯¹è±¡ |
| | | * @author ludc |
| | | * @date 2024/7/19 11:11 |
| | | */ |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class OsRevisionRulePO extends BaseModelVO { |
| | | |
| | | /** |
| | | * ç¦æ¢ä¿®æ¹è¿ä¸ªå¼ |
| | | */ |
| | | private static final long serialVersionUID = -2239512786206928201L; |
| | | |
| | | /** |
| | | * æå¨æ°æ®è¡ |
| | | */ |
| | | @ExcelColumn(rowIndexColumn = true,value = "") |
| | | private String rowIndex; |
| | | |
| | | /** |
| | | * 屿§è±æåç§° |
| | | */ |
| | | @ExcelColumn(value="åç§°",nullable = false) |
| | | private String id; |
| | | |
| | | /** |
| | | * æ ç¾ |
| | | */ |
| | | @ExcelColumn(value="æ ç¾") |
| | | private String name; |
| | | |
| | | /** |
| | | * è·³è·å符 |
| | | */ |
| | | @ExcelColumn(value="è·³è·å符") |
| | | private String jumpCharacter; |
| | | |
| | | /** |
| | | * åå§å¼ |
| | | */ |
| | | @ExcelColumn(value="åå§å¼",nullable = false) |
| | | private String initialValue; |
| | | |
| | | /** |
| | | * æ¥é¿ |
| | | */ |
| | | @ExcelColumn(value="æ¥é¿",nullable = false) |
| | | private String stepLength; |
| | | |
| | | /** |
| | | * åç¼ |
| | | */ |
| | | @ExcelColumn(value="åç¼") |
| | | private String prefixion; |
| | | |
| | | /** |
| | | * åç¼ |
| | | */ |
| | | @ExcelColumn(value="åç¼") |
| | | private String suffix; |
| | | |
| | | /** |
| | | * æè¿° |
| | | */ |
| | | @ExcelColumn(value="æè¿°") |
| | | private String description; |
| | | |
| | | } |
| | |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | /** |
| | | * 屿§æ± 导å
¥å¯¹è±¡ |
| | | * ç¶ææ± å¯¼å
¥å¯¹è±¡ |
| | | * @author ludc |
| | | * @date 2024/7/19 11:11 |
| | | */ |
| | |
| | | /** |
| | | * 屿§ç±»å |
| | | */ |
| | | @ExcelColumn(value="å¾ç(è·¯å¾)") |
| | | private String imagePath; |
| | | //@ExcelColumn(value="å¾ç(è·¯å¾)") |
| | | //private String imagePath; |
| | | |
| | | /** |
| | | * æè¿° |
| | |
| | | @VciBusinessLog(operateName = "导åºå±æ§") |
| | | public void exportAttributes(String exportFileName,String attrNames, HttpServletResponse response){ |
| | | try { |
| | | String excelPath = attributeService.exportAttributes(exportFileName,attrNames); |
| | | String excelPath = attributeService.exportAttributes(exportFileName,attrNames,false); |
| | | ControllerUtil.writeFileToResponse(response,excelPath); |
| | | } catch (Exception e) { |
| | | String msg = "å¯¼åºæä¸¾æ¶åºç°é误ï¼åå ï¼" + VciBaseUtil.getExceptionMessage(e); |
| | |
| | | package com.vci.web.controller; |
| | | |
| | | import com.vci.constant.FrameWorkLangCodeConstant; |
| | | import com.vci.corba.common.PLException; |
| | | import com.vci.corba.omd.ltm.LinkType; |
| | | import com.vci.pagemodel.OsBtmTypeAttributeVO; |
| | | import com.vci.pagemodel.OsLinkTypeAttributeVO; |
| | | import com.vci.pagemodel.OsLinkTypeVO; |
| | | import com.vci.starter.web.annotation.controller.VciUnCheckRight; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | | import com.vci.starter.web.pagemodel.BaseQueryObject; |
| | | import com.vci.starter.web.pagemodel.BaseResult; |
| | | import com.vci.starter.web.pagemodel.DataGrid; |
| | | import com.vci.starter.web.util.LocalFileUtil; |
| | | import com.vci.starter.web.util.VciBaseUtil; |
| | | import com.vci.web.service.OsLinkTypeServiceI; |
| | | import org.apache.commons.lang3.StringUtils; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.util.Arrays; |
| | | import java.util.HashMap; |
| | |
| | | return objectBaseResult; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 导åºé¾æ¥ç±»å |
| | | * name 龿¥ç±»ååç§° |
| | | * @return |
| | | */ |
| | | @GetMapping("/expData") |
| | | public void expData(String name,HttpServletResponse response) throws PLException, IOException { |
| | | linkTypeService.expData(name, response); |
| | | } |
| | | |
| | | /** |
| | | * 导å
¥é¾æ¥ç±»å |
| | | * @param file ä¸ä¼ çæä»¶ |
| | | * @return |
| | | */ |
| | | @PostMapping("/impData") |
| | | @VciUnCheckRight |
| | | public BaseResult impData(MultipartFile file){try { |
| | | return linkTypeService.impData(file); |
| | | }catch (Throwable e) { |
| | | throw new VciBaseException(VciBaseUtil.getExceptionMessage(e),new String[0],e); |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.vci.web.controller; |
| | | |
| | | import com.vci.constant.FrameWorkLangCodeConstant; |
| | | import com.vci.dto.OsRevisionRuleDTO; |
| | | import com.vci.pagemodel.OsRevisionRuleVO; |
| | | import com.vci.starter.web.annotation.controller.VciUnCheckRight; |
| | | import com.vci.starter.web.annotation.log.VciBusinessLog; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | | import com.vci.starter.web.pagemodel.BaseResult; |
| | | import com.vci.starter.web.util.ControllerUtil; |
| | | import com.vci.starter.web.util.LocalFileUtil; |
| | | import com.vci.starter.web.util.VciBaseUtil; |
| | | import com.vci.web.service.OsRevisionRuleServiceI; |
| | | import com.vci.web.util.Func; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * çæ¬è§åæ§å¶å¨ |
| | | * @author ludc |
| | | * @date 2024/7/30 16:02 |
| | | */ |
| | | @RequestMapping("/revisionRuleController") |
| | | @RestController |
| | | public class OsRevisionRuleController { |
| | | |
| | | @Autowired |
| | | private OsRevisionRuleServiceI revisionRuleServiceI; |
| | | |
| | | /** |
| | | * æ¥å¿ |
| | | */ |
| | | private Logger logger = LoggerFactory.getLogger(getClass()); |
| | | |
| | | /** |
| | | * çæ¬è§åå表(å
¨æ¥è¯¢) |
| | | * @return |
| | | */ |
| | | @GetMapping("/getVersionRuleAllList") |
| | | public BaseResult getVersionRuleAllList(){ |
| | | try { |
| | | return BaseResult.dataList(revisionRuleServiceI.selectAllRevision()); |
| | | }catch (Exception e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "çæ¬è§å管çå表æ¥è¯¢æ¶åºç°é误ï¼åå ï¼" + VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | return BaseResult.fail(exceptionMessage); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢åºç¨èå´ |
| | | * @param vrName çæ¬è§åè±æåç§° |
| | | * @return |
| | | */ |
| | | @GetMapping("/getUsedVersionRuleList") |
| | | public BaseResult getUsedVersionRuleList(String vrName){ |
| | | try { |
| | | return BaseResult.dataList(revisionRuleServiceI.getUsedVersionRuleList(vrName)); |
| | | }catch (Exception e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "çæ¬è§ååºç¨èå´æ¥è¯¢æ¶åºç°é误ï¼åå ï¼" + VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | return BaseResult.fail(exceptionMessage); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * åå»ºçæ¬è§å |
| | | * @param osRevisionRuleDTO çæ¬è§åæ°æ®ä¼ è¾å¯¹è±¡ |
| | | * @return |
| | | */ |
| | | @PostMapping("/addVersionRule") |
| | | public BaseResult addVersionRule(@RequestBody OsRevisionRuleDTO osRevisionRuleDTO){ |
| | | try { |
| | | return revisionRuleServiceI.addVersionRule(osRevisionRuleDTO) ? BaseResult.success("çæ¬è§åæ·»å æåï¼"):BaseResult.fail("çæ¬è§åæ·»å 失败ï¼"); |
| | | }catch (Exception e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "å¢å 屿§æ¶åºç°é误ï¼åå ï¼" + VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | return BaseResult.fail(exceptionMessage); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹çæ¬è§å |
| | | * @param osRevisionRuleDTO çæ¬è§åæ°æ®ä¼ è¾å¯¹è±¡ |
| | | * @return |
| | | */ |
| | | @PutMapping("/updateVersionRule") |
| | | public BaseResult updateVersionRule(@RequestBody OsRevisionRuleDTO osRevisionRuleDTO){ |
| | | try { |
| | | return revisionRuleServiceI.updateVersionRule(osRevisionRuleDTO) ? BaseResult.success("çæ¬è§åä¿®æ¹æåï¼"):BaseResult.fail("çæ¬è§åä¿®æ¹å¤±è´¥ï¼"); |
| | | }catch (Exception e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "ä¿®æ¹çæ¬è§åæ¶åºç°é误ï¼åå ï¼" + VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | return BaseResult.fail(exceptionMessage); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å é¤çæ¬è§å |
| | | * @param osRevisionRuleDTOS çæ¬è§åæ°æ®ä¼ è¾å¯¹è±¡ |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/deleteVersionRule") |
| | | public BaseResult deleteVersionRule(@RequestBody List<OsRevisionRuleDTO> osRevisionRuleDTOS){ |
| | | try { |
| | | return revisionRuleServiceI.deleteVersionRule(osRevisionRuleDTOS) ? BaseResult.success("çæ¬è§åå 餿åï¼"):BaseResult.fail("çæ¬è§åå é¤å¤±è´¥ï¼"); |
| | | }catch (Exception e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "å é¤çæ¬è§åæ¶åºç°é误ï¼åå ï¼" + VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | return BaseResult.fail(exceptionMessage); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 导åºéä¸ççæ¬è§å |
| | | * @param exportFileName 导åºçæä»¶å |
| | | * @param vrNames éè¦å¯¼åºçè§åè±æåç§° |
| | | * @param response |
| | | */ |
| | | @GetMapping( "/exportVersionRule") |
| | | @VciBusinessLog(operateName = "导åºçæ¬è§å") |
| | | public void exportVersionRule(String exportFileName,String vrNames, HttpServletResponse response){ |
| | | try { |
| | | String excelPath = revisionRuleServiceI.exportVersionRule(exportFileName,vrNames,false); |
| | | ControllerUtil.writeFileToResponse(response,excelPath); |
| | | } catch (Exception e) { |
| | | String msg = "导åºçæ¬è§åæ¶åºç°é误ï¼åå ï¼" + VciBaseUtil.getExceptionMessage(e); |
| | | try { |
| | | //åºéæ¶ |
| | | e.printStackTrace(); |
| | | ControllerUtil.writeDataToResponse(response,"error_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss") + ".txt", StringUtils.isNotBlank(msg)?msg.getBytes():new byte[0],null); |
| | | } catch (IOException ioException) { |
| | | ioException.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * ä¸è½½çæ¬è§å导å
¥æ¨¡æ¿ |
| | | * @param exportFileName |
| | | * @param response |
| | | */ |
| | | @GetMapping( "/downloadAttributeTemplate") |
| | | @VciBusinessLog(operateName = "导åºçæ¬è§å") |
| | | public void downloadVersionRuleTemplate(String exportFileName, HttpServletResponse response){ |
| | | try { |
| | | String excelPath = revisionRuleServiceI.downloadVersionRuleTemplate(exportFileName); |
| | | ControllerUtil.writeFileToResponse(response,excelPath); |
| | | } catch (Exception e) { |
| | | String msg = "ä¸è½½çæ¬è§å导å
¥æ¨¡æ¿æ¶åºç°é误ï¼åå ï¼" + VciBaseUtil.getExceptionMessage(e); |
| | | try { |
| | | //åºéæ¶ |
| | | e.printStackTrace(); |
| | | ControllerUtil.writeDataToResponse(response,"error_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss") + ".txt", StringUtils.isNotBlank(msg)?msg.getBytes():new byte[0],null); |
| | | } catch (IOException ioException) { |
| | | ioException.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 导å
¥çæ¬è§å |
| | | * @param file |
| | | * @return |
| | | */ |
| | | @PostMapping("/importVersionRules") |
| | | @VciBusinessLog(operateName = "导å
¥çæ¬è§å") |
| | | public BaseResult importVersionRules(MultipartFile file){ |
| | | String excelFileName = LocalFileUtil.getDefaultTempFolder() + File.separator + LocalFileUtil.getFileNameForIE(file.getOriginalFilename()); |
| | | File file1 = new File(excelFileName); |
| | | try { |
| | | file.transferTo(new File(excelFileName)); |
| | | if (file != null) { |
| | | return revisionRuleServiceI.importVersionRules(file1); |
| | | } else { |
| | | return BaseResult.fail(FrameWorkLangCodeConstant.IMPORT_FAIL, new String[]{"æ 导å
¥çæä»¶"}); |
| | | } |
| | | }catch (Throwable e) { |
| | | throw new VciBaseException(VciBaseUtil.getExceptionMessage(e),new String[0],e); |
| | | }finally { |
| | | file1.delete(); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | @VciBusinessLog(operateName = "导åºç¶æ") |
| | | public void exportStatus(String exportFileName,String statusOids, HttpServletResponse response){ |
| | | try { |
| | | String excelPath = statusService.exportStatus(exportFileName,statusOids); |
| | | String excelPath = statusService.exportStatus(exportFileName,statusOids,true); |
| | | ControllerUtil.writeFileToResponse(response,excelPath); |
| | | } catch (Exception e) { |
| | | String msg = "导åºç¶ææ¶åºç°é误ï¼åå ï¼" + VciBaseUtil.getExceptionMessage(e); |
| | |
| | | @VciBusinessLog(operateName = "å¯¼åºæä¸¾ç±»å") |
| | | public void exportEnumTypes(String exportFileName,String enumNames, HttpServletResponse response){ |
| | | try { |
| | | String excelPath = enumService.exportEnumTypes(exportFileName,enumNames); |
| | | String excelPath = enumService.exportEnumTypes(exportFileName,enumNames,false); |
| | | ControllerUtil.writeFileToResponse(response,excelPath); |
| | | } catch (Exception e) { |
| | | String msg = "å¯¼åºæä¸¾æ¶åºç°é误ï¼åå ï¼" + VciBaseUtil.getExceptionMessage(e); |
| | |
| | | * 导åºéä¸ç屿§ |
| | | * @param exportFileName 导åºçæä»¶å |
| | | * @param attrNames éè¦å¯¼åºç屿§åç§° |
| | | * @param flag æ§å¶å¯¼åºçå忝å¦å导å
¥æ¨¡æ¿ä¸è´ |
| | | * @return |
| | | */ |
| | | String exportAttributes(String exportFileName,String attrNames) throws PLException; |
| | | String exportAttributes(String exportFileName,String attrNames,boolean flag/*æ§å¶å¯¼åºçå忝å¦å导å
¥æ¨¡æ¿ä¸è´*/) throws PLException; |
| | | |
| | | /** |
| | | * ä¸è½½å±æ§å¯¼å
¥æ¨¡æ¿ |
| | |
| | | * å¯¼åºæä¸¾ç±»å |
| | | * @param exportFileName 导åºçæä»¶å |
| | | * @param enumNames éè¦å¯¼åºçæä¸¾åç§° |
| | | * @param flag æ§å¶å¯¼åºçå忝å¦å导å
¥æ¨¡æ¿ä¸è´ |
| | | * @return |
| | | */ |
| | | String exportEnumTypes(String exportFileName,String enumNames) throws PLException; |
| | | String exportEnumTypes(String exportFileName,String enumNames,boolean flag/*æ§å¶å¯¼åºçå忝å¦å导å
¥æ¨¡æ¿ä¸è´*/) throws PLException; |
| | | |
| | | /** |
| | | * 导å
¥æä¸¾ |
| | |
| | | import com.vci.pagemodel.OsBtmTypeAttributeVO; |
| | | import com.vci.pagemodel.OsLinkTypeAttributeVO; |
| | | import com.vci.pagemodel.OsLinkTypeVO; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | |
| | | * @return åå»ºç»æ |
| | | */ |
| | | BaseResult createView() throws PLException; |
| | | /** |
| | | * 导åºé¾æ¥ç±»å |
| | | * name 龿¥ç±»ååç§° |
| | | * @return åå»ºç»æ |
| | | */ |
| | | void expData(String oid, HttpServletResponse response) throws PLException, IOException; |
| | | /** |
| | | * 导å
¥é¾æ¥ç±»å |
| | | * @param file ä¸ä¼ çæä»¶ |
| | | * @return |
| | | */ |
| | | BaseResult impData(MultipartFile file) throws Exception; |
| | | } |
| | |
| | | package com.vci.web.service; |
| | | |
| | | import com.vci.corba.common.PLException; |
| | | import com.vci.corba.omd.vrm.VersionRule; |
| | | import com.vci.dto.OsRevisionRuleDTO; |
| | | import com.vci.pagemodel.OsRevisionRuleVO; |
| | | import com.vci.starter.web.pagemodel.BaseResult; |
| | | |
| | | import java.io.File; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | Map<String,OsRevisionRuleVO> selectAllRevisionMap(); |
| | | |
| | | /** |
| | | * åå»ºçæ¬è§å |
| | | * @param osRevisionRuleDTO |
| | | * @return |
| | | */ |
| | | boolean addVersionRule(OsRevisionRuleDTO osRevisionRuleDTO) throws PLException; |
| | | |
| | | /** |
| | | * ä¿®æ¹çæ¬è§å |
| | | * @param osRevisionRuleDTO |
| | | * @return |
| | | */ |
| | | boolean updateVersionRule(OsRevisionRuleDTO osRevisionRuleDTO) throws PLException; |
| | | |
| | | /** |
| | | * å é¤çæ¬è§å |
| | | * @param osRevisionRuleDTOS |
| | | * @return |
| | | */ |
| | | boolean deleteVersionRule(List<OsRevisionRuleDTO> osRevisionRuleDTOS) throws PLException; |
| | | |
| | | /** |
| | | * æ°æ®å¯¹è±¡è½¬æ¢ä¸ºæ¾ç¤ºå¯¹è±¡ |
| | | * @param versionRules æ°æ®å¯¹è±¡ |
| | | * @return æ¾ç¤ºå¯¹è±¡ |
| | |
| | | * @return æ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | OsRevisionRuleVO getRevisionRuleById(String id); |
| | | |
| | | /** |
| | | * 使ç¨å¤ä¸ªç¼å·è·åè§åçå¼ |
| | | * @param vrIdList ç¼å· |
| | | * @return æ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | List<OsRevisionRuleVO> getRevisionRuleByIds(Collection<String> vrIdList); |
| | | |
| | | /** |
| | | * æ¥è¯¢åºç¨èå´ |
| | | * @param vrName çæ¬è§åè±æåç§° |
| | | * @return |
| | | */ |
| | | List<Map<String, String>> getUsedVersionRuleList(String vrName) throws PLException; |
| | | |
| | | /** |
| | | * 导åºéä¸ççæ¬è§å |
| | | * @param exportFileName 导åºçæä»¶å |
| | | * @param vrNames éè¦å¯¼åºççæ¬è§ååç§° |
| | | * @param flag æ§å¶å¯¼åºçå忝å¦å导å
¥æ¨¡æ¿ä¸è´ |
| | | * @return |
| | | */ |
| | | String exportVersionRule(String exportFileName,String vrNames,boolean flag/*æ§å¶å¯¼åºçå忝å¦å导å
¥æ¨¡æ¿ä¸è´*/) throws PLException; |
| | | |
| | | /** |
| | | * ä¸è½½çæ¬è§å导å
¥æ¨¡æ¿ |
| | | * @param exportFileName |
| | | * @return |
| | | * @throws PLException |
| | | */ |
| | | String downloadVersionRuleTemplate(String exportFileName) throws Exception; |
| | | |
| | | /** |
| | | * 导å
¥çæ¬è§å |
| | | * @param file |
| | | * @return |
| | | */ |
| | | BaseResult importVersionRules(File file) throws Exception; |
| | | |
| | | } |
| | |
| | | * @param statusOids éè¦å¯¼åºç屿§åç§° |
| | | * @return |
| | | */ |
| | | String exportStatus(String exportFileName,String statusOids) throws PLException; |
| | | String exportStatus(String exportFileName,String statusOids,boolean flag/*æ§å¶å¯¼åºçå忝å¦å导å
¥æ¨¡æ¿ä¸è´*/) throws PLException; |
| | | |
| | | /** |
| | | * ä¸è½½ç¶æå¯¼å
¥æ¨¡æ¿ |
| | |
| | | import com.vci.client.mw.ClientSessionUtility; |
| | | import com.vci.corba.common.PLException; |
| | | import com.vci.corba.omd.atm.AttributeDef; |
| | | import com.vci.corba.omd.vrm.VersionRule; |
| | | import com.vci.dto.OsAttributeDTO; |
| | | import com.vci.dto.OsEnumDTO; |
| | | import com.vci.dto.OsEnumItemDTO; |
| | |
| | | public List<OsAttributeVO> getByAttributeNames(String[] attrNames) throws PLException { |
| | | VciBaseUtil.alertNotNull(attrNames,"屿§å"); |
| | | List<OsAttributeVO> osAttributeVOS = new ArrayList<>(); |
| | | for (int i = 0; i < attrNames.length; i++) { |
| | | AttributeDef[] attributeDefs = platformClientUtil.getAttributeService().getAttributeDefs(attrNames[i].toLowerCase(Locale.ROOT),1,1); |
| | | if(Func.isNotEmpty(attributeDefs)){ |
| | | Arrays.stream(attributeDefs).forEach(attributeDef -> { |
| | | osAttributeVOS.add(attributeDO2VO(attributeDef)); |
| | | }); |
| | | } |
| | | } |
| | | AttributeDef[] attributeDefs = platformClientUtil.getAttributeService().getAttributeDefsByNames(attrNames); |
| | | Arrays.stream(attributeDefs).forEach(attr->{ |
| | | osAttributeVOS.add(attributeDO2VO(attr)); |
| | | }); |
| | | return osAttributeVOS; |
| | | } |
| | | |
| | |
| | | checkName(osAttributeDTO.getId()); |
| | | //æ£æ¥é»è®¤å¼ä¸å±æ§ç±»åæ¯å¦å¹é
|
| | | checkDefValue(osAttributeDTO); |
| | | //dto对象转æ¢ä¸ºå卿é对象 |
| | | osAttributeDTO.setOid(VciBaseUtil.getPk().toUpperCase(Locale.ROOT)); |
| | | //osAttributeDTO.setOid(VciBaseUtil.getPk().toUpperCase(Locale.ROOT)); |
| | | AttributeDef attributeDef = this.osAttributeDTO2AttributeDef(osAttributeDTO); |
| | | return platformClientUtil.getAttributeService().addAttributeDef(attributeDef); |
| | | } |
| | |
| | | } |
| | | //æ£æ¥å±æ§åæ¯å¦å·²åå¨ä¸ç³»ç»ä¸ |
| | | if(platformClientUtil.getAttributeService().checkRowIsExists(abName)){ |
| | | throw new PLException("500",new String[]{"屿§åç§°å¨ç³»ç»ä¸å·²åå¨!"}); |
| | | throw new PLException("500",new String[]{"屿§åç§°ã" + abName + "ãå¨ç³»ç»ä¸å·²åå¨!"}); |
| | | } |
| | | } |
| | | |
| | |
| | | * 导åºéä¸ç屿§ |
| | | * @param exportFileName 导åºçæä»¶å |
| | | * @param attrNames éè¦å¯¼åºç屿§åç§° |
| | | * @param flag æ§å¶å¯¼åºçå忝å¦å导å
¥æ¨¡æ¿ä¸è´ |
| | | * @return |
| | | */ |
| | | @Override |
| | | public String exportAttributes(String exportFileName, String attrNames) throws PLException { |
| | | public String exportAttributes(String exportFileName, String attrNames,boolean flag/*æ§å¶å¯¼åºçå忝å¦å导å
¥æ¨¡æ¿ä¸è´*/) throws PLException { |
| | | if(Func.isBlank(attrNames)){ |
| | | throw new PLException("500",new String[]{"请å¾éè¦å¯¼åºç屿§!"}); |
| | | } |
| | | //ç颿²¡ä¼ åç§°ï¼ä½¿ç¨é»è®¤å¯¼åºåç§° |
| | | exportFileName = Func.isBlank(exportFileName) ? "屿§æ± ä¸å±æ§å¯¼åº_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName; |
| | | //设置åå |
| | | List<String> columns = new ArrayList<>( |
| | | Arrays.asList("屿§å", "æ ç¾", "æè¿°", |
| | | "屿§ç±»å", "å
许为空", "é»è®¤å¼", "使ç¨çæä¸¾è±æåç§°(æä¸¾å)", |
| | | "使ç¨çæä¸¾ä¸æåç§°(æ ç¾)", "åç
§çä¸å¡ç±»åç¼å·", "åç
§çä¸å¡ç±»ååç§°", |
| | | "åç
§ç龿¥ç±»ååç§°","çæ¬çæ¬¡","屿§é¿åº¦", "å°æ°ç²¾åº¦ä½æ°","å°æ°å»åº¦ä½æ°","åå¼èå´","å建æ¶é´") |
| | | ); |
| | | List<String> columns = this.getCloumns(flag); |
| | | |
| | | //åexcel |
| | | String excelPath = LocalFileUtil.getDefaultTempFolder() + File.separator + exportFileName + ".xls"; |
| | |
| | | excelDataList.add(new WriteExcelData(0,index, columns.get(index))); |
| | | } |
| | | //æç
§å±æ§åæ¥è¯¢å±æ§ï¼ç¶åå¤ç屿§å¯¼åº |
| | | List<String> enumNameList = Func.toStrList(attrNames); |
| | | List<OsAttributeVO> osAttributeVOS = this.listAttrByIds(enumNameList); |
| | | List<String> attrameList = Func.toStrList(attrNames); |
| | | List<OsAttributeVO> osAttributeVOS = this.listAttrByIds(attrameList); |
| | | if(Func.isEmpty(osAttributeVOS)){ |
| | | excelDataList.add(new WriteExcelData(1,1, "æ ¹æ®å±æ§åç§°æªæ¥è¯¢å°å±æ§ä¿¡æ¯ï¼è¯·å·æ°åå°è¯éæ°å¯¼åºï¼")); |
| | | }else{ |
| | |
| | | excelDataList.add(new WriteExcelData(i+1,0, osAttributeVO.getId())); |
| | | excelDataList.add(new WriteExcelData(i+1,1, osAttributeVO.getName())); |
| | | excelDataList.add(new WriteExcelData(i+1,2, osAttributeVO.getDescription())); |
| | | excelDataList.add(new WriteExcelData(i+1,3, osAttributeVO.getAttributeDataTypeText()+"("+osAttributeVO.getAttributeDataType()+")")); |
| | | if(flag){ |
| | | excelDataList.add(new WriteExcelData(i+1,3, osAttributeVO.getAttributeDataType())); |
| | | }else{ |
| | | excelDataList.add(new WriteExcelData(i+1,3, osAttributeVO.getAttributeDataType()+"("+osAttributeVO.getAttributeDataTypeText()+")")); |
| | | } |
| | | excelDataList.add(new WriteExcelData(i+1,4, osAttributeVO.isNullableFlag())); |
| | | excelDataList.add(new WriteExcelData(i+1,5, osAttributeVO.getDefaultValue())); |
| | | excelDataList.add(new WriteExcelData(i+1,6, osAttributeVO.getEnumId())); |
| | | excelDataList.add(new WriteExcelData(i+1,7, osAttributeVO.getEnumName())); |
| | | excelDataList.add(new WriteExcelData(i+1,8, osAttributeVO.getBtmTypeId())); |
| | | excelDataList.add(new WriteExcelData(i+1,9, osAttributeVO.getBtmTypeName())); |
| | | excelDataList.add(new WriteExcelData(i+1,10, osAttributeVO.getAttrLength())); |
| | | excelDataList.add(new WriteExcelData(i+1,11, osAttributeVO.getLinkTypeName())); |
| | | excelDataList.add(new WriteExcelData(i+1,12, osAttributeVO.getVersion())); |
| | | excelDataList.add(new WriteExcelData(i+1,13, osAttributeVO.getPrecisionLength())); |
| | | excelDataList.add(new WriteExcelData(i+1,14, osAttributeVO.getScaleLength())); |
| | | excelDataList.add(new WriteExcelData(i+1,15, osAttributeVO.getRange())); |
| | | excelDataList.add(new WriteExcelData(i+1,16, osAttributeVO.getCreateTime())); |
| | | //excelDataList.add(new WriteExcelData(i+1,7, osAttributeVO.getEnumName())); |
| | | excelDataList.add(new WriteExcelData(i+1,7, osAttributeVO.getBtmTypeId())); |
| | | //excelDataList.add(new WriteExcelData(i+1,9, osAttributeVO.getBtmTypeName())); |
| | | excelDataList.add(new WriteExcelData(i+1,8, osAttributeVO.getAttrLength())); |
| | | excelDataList.add(new WriteExcelData(i+1,9, osAttributeVO.getLinkTypeName())); |
| | | excelDataList.add(new WriteExcelData(i+1,10, osAttributeVO.getVersion())); |
| | | excelDataList.add(new WriteExcelData(i+1,11, osAttributeVO.getPrecisionLength())); |
| | | excelDataList.add(new WriteExcelData(i+1,12, osAttributeVO.getScaleLength())); |
| | | excelDataList.add(new WriteExcelData(i+1,13, osAttributeVO.getRange())); |
| | | if(!flag){ |
| | | excelDataList.add(new WriteExcelData(i+1,14, Func.format(osAttributeVO.getCreateTime(),"yyyyå¹´MMæddæ¥ hh:mm:ss"))); |
| | | } |
| | | } |
| | | } |
| | | WriteExcelOption excelOption = new WriteExcelOption(excelDataList); |
| | | ExcelUtil.writeDataToFile(excelPath, excelOption); |
| | | return excelPath; |
| | | } |
| | | |
| | | /** |
| | | * è·åå¯¼åºæå¯¼å
¥æ¨¡æ¿çåå |
| | | * @param flag æ¯å¦è·å导å
¥æ¨¡æ¿åå |
| | | * @return |
| | | */ |
| | | private List<String> getCloumns(boolean flag){ |
| | | if(flag){ |
| | | return new ArrayList<>( |
| | | Arrays.asList("屿§å", "æ ç¾", "æè¿°", |
| | | "屿§ç±»å(åç
§æ°å¢çé¢ç屿§ç±»åå¦VTString)", "å
许为空(æ¯/å¦)", "é»è®¤å¼", "使ç¨çæä¸¾è±æåç§°" |
| | | , "åç
§çä¸å¡ç±»åç¼å·","åç
§ç龿¥ç±»åç¼å·","çæ¬çæ¬¡","屿§é¿åº¦", "å°æ°ç²¾åº¦ä½æ°","å°æ°å»åº¦ä½æ°" |
| | | ,"åå¼èå´" |
| | | ) |
| | | ); |
| | | } |
| | | return new ArrayList<>( |
| | | Arrays.asList("屿§å", "æ ç¾", "æè¿°", |
| | | "屿§ç±»å", "å
许为空", "é»è®¤å¼", "使ç¨çæä¸¾è±æåç§°(æä¸¾å)", |
| | | "åç
§çä¸å¡ç±»åç¼å·", "åç
§ç龿¥ç±»åç¼å·","çæ¬çæ¬¡","屿§é¿åº¦", |
| | | "å°æ°ç²¾åº¦ä½æ°","å°æ°å»åº¦ä½æ°","åå¼èå´","å建æ¶é´") |
| | | ); |
| | | } |
| | | |
| | | /** |
| | |
| | | //ç颿²¡ä¼ åç§°ï¼ä½¿ç¨é»è®¤å¯¼åºåç§° |
| | | exportFileName = Func.isBlank(exportFileName) ? "屿§æ± 导å
¥æ¨¡æ¿_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName; |
| | | //设置åå |
| | | List<String> columns = new ArrayList<>( |
| | | Arrays.asList("屿§å", "æ ç¾", "æè¿°", |
| | | "屿§ç±»å(请åç
§æ°å¢çé¢ç屿§ç±»åå¡«å)", "å
许为空(æ¯/å¦)", "é»è®¤å¼", "使ç¨çæä¸¾è±æåç§°", "åç
§çä¸å¡ç±»åç¼å·", |
| | | "åç
§ç龿¥ç±»åç¼å·","çæ¬çæ¬¡","屿§é¿åº¦", "å°æ°ç²¾åº¦ä½æ°","å°æ°å»åº¦ä½æ°","åå¼èå´") |
| | | ); |
| | | List<String> columns = this.getCloumns(true); |
| | | //设置å¿
å¡«å |
| | | ColumnNameisRed.clear(); |
| | | ColumnNameisRed.add(0); |
| | |
| | | List<OsAttributeDTO> dtoList = new ArrayList<>(); |
| | | //å½åexcel䏿¯å¦éå¤ç¨çå¤éMap:ï¼keyï¼å¤é屿§ï¼valueï¼è¡å·ï¼ |
| | | Map<String, String> excelReapeat = new HashMap<>(); |
| | | //夿å¿
填屿§æ¯å¦ä¸ºç©ºï¼ç¨æ·æ¯å¦å·²åå¨ï¼ä»¥åé¨é¨æ¯å¦å¡«éçæ ¡éªé»è¾ |
| | | poList.stream().forEach(osAttributePO -> { |
| | | if(Func.isBlank(osAttributePO.getId())){//屿§åå¤ç©º |
| | | throw new VciBaseException("第ã"+osAttributePO.getRowIndex()+"ãè¡ï¼enumnameerror"); |
| | | throw new VciBaseException("第ã"+osAttributePO.getRowIndex()+"ãè¡ï¼attrnameerror"); |
| | | }else if(Func.isBlank(osAttributePO.getAttributeDataType())){ |
| | | throw new VciBaseException("第ã"+osAttributePO.getRowIndex()+"ãè¡ï¼typeerror"); |
| | | }else if(excelReapeat.containsKey(osAttributePO.getId())){//屿§åè¡¨æ ¼ä¸å¤é |
| | |
| | | //屿§åexcelä¸å¤éå¤ç |
| | | excelReapeat.put(osAttributePO.getId(),osAttributePO.getRowIndex()); |
| | | OsAttributeDTO osAttributeDTO = new OsAttributeDTO(); |
| | | //æ¥è¯¢æä¸¾æ¯å¦åå¨ï¼å¡«åäºæä¸¾ä½æ²¡å¡«ååå¼èå´ï¼è¿æ¶åç´æ¥ä½¿ç¨æä¸¾é¡¹å¼ä½ä¸ºé»è®¤çrange |
| | | //æ¥è¯¢å±æ§æ¯å¦åå¨ï¼å¡«åäºæä¸¾ä½æ²¡å¡«ååå¼èå´ï¼è¿æ¶åç´æ¥ä½¿ç¨æä¸¾é¡¹å¼ä½ä¸ºé»è®¤çrange |
| | | if(Func.isNotBlank(osAttributePO.getEnumId()) && Func.isBlank(osAttributePO.getRange())){ |
| | | try { |
| | | OsEnumVO enumVO = enumService.getEnumTypeById(osAttributePO.getEnumId()); |
| | |
| | | checkDefValue(osAttributeDTO); |
| | | } catch (PLException e) { |
| | | e.printStackTrace(); |
| | | throw new VciBaseException(e.getMessage()); |
| | | throw new VciBaseException(VciBaseUtil.getExceptionMessage(e)); |
| | | } |
| | | dtoList.add(osAttributeDTO); |
| | | }); |
| | |
| | | e.printStackTrace(); |
| | | return BaseResult.fail(VciBaseUtil.getExceptionMessage(e),new String[]{},e); |
| | | } |
| | | return BaseResult.success("æä¸¾å¯¼å
¥æåï¼"); |
| | | return BaseResult.success("屿§å¯¼å
¥æåï¼"); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public String exportEnumTypes(String exportFileName,String enumNames) throws PLException { |
| | | public String exportEnumTypes(String exportFileName,String enumNames,boolean flag/*æ§å¶å¯¼åºçå忝å¦å导å
¥æ¨¡æ¿ä¸è´*/) throws PLException { |
| | | if(Func.isBlank(enumNames)){ |
| | | throw new PLException("500",new String[]{"请å¾éè¦å¯¼åºçæä¸¾!"}); |
| | | } |
| | | //ç颿²¡ä¼ åç§°ï¼ä½¿ç¨é»è®¤å¯¼åºåç§° |
| | | exportFileName = Func.isBlank(exportFileName) ? "æä¸¾ç±»å导åº_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName; |
| | | //设置åå |
| | | List<String> columns = new ArrayList<>(Arrays.asList("æä¸¾åç§°", "æ ç¾", "è¿åç±»å", "é¿åº¦","å建æ¶é´", "æä¸¾é¡¹åç§°", "æä¸¾å¼", "æè¿°")); |
| | | List<String> columns = this.getCloumns(flag); |
| | | |
| | | //åexcel |
| | | String excelPath = LocalFileUtil.getDefaultTempFolder() + File.separator + exportFileName + ".xls"; |
| | |
| | | if(Func.isEmpty(osEnumVO) && Func.isBlank(osEnumVO.getOid())){ |
| | | throw new PLException("500",new String[]{"æªæ¥è¯¢å°æä¸¾å为ã" + enumNameList.get(i) + "ãçæä¸¾ï¼è¯·å·æ°å鿰坼åº!"}); |
| | | } |
| | | //æä¸¾é¡¹ä¸ä¸ºç©ºæ¶éè¦èèåå¹¶è¡é®é¢ |
| | | //æç
§å¯¼åºååæ§å¶åéåæä¸¾é¡¹ä¸ä¸ºç©ºæ¶å³å®æ¯å¦éè¦èèåå¹¶è¡é®é¢ |
| | | List<OsEnumItemVO> enumVOItems = osEnumVO.getItems(); |
| | | //æä¸¾é¡¹ä¸ä¸ºç©ºæ¶éè¦è¿è¡åå¹¶è¡å¤ç |
| | | if(Func.isNotEmpty(enumVOItems) || enumVOItems.size() > 1){ |
| | | //excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,0, osEnumVO.getOid())); |
| | | excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,0, osEnumVO.getId())); |
| | | excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,1, osEnumVO.getName())); |
| | | excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,2, osEnumVO.getEnumValueDataType()+"("+osEnumVO.getEnumValueDataTypeText()+")")); |
| | | excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,3, osEnumVO.getLength())); |
| | | //excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,5, osEnumVO.getCreator())); |
| | | excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,4, Func.format(osEnumVO.getCreateTime(),"yyyyå¹´MMæddæ¥ hh:mm:ss"))); |
| | | |
| | | //å¤çæä¸¾é¡¹åå
¥ |
| | | //å¤ææ¯æç
§ä»ä¹ååå¯¼åº |
| | | if(flag){ |
| | | for (int j = 0; j < enumVOItems.size(); j++) { |
| | | OsEnumItemVO osEnumItemVO = enumVOItems.get(j); |
| | | excelDataList.add(new WriteExcelData(startRow+j,5, true,osEnumItemVO.getName())); |
| | | excelDataList.add(new WriteExcelData(startRow+j,6, true, osEnumItemVO.getValue())); |
| | | excelDataList.add(new WriteExcelData(startRow+j,7, true, osEnumItemVO.getDescription())); |
| | | } |
| | | excelDataList.add(new WriteExcelData(i+j+1,0, osEnumVO.getId())); |
| | | excelDataList.add(new WriteExcelData(i+j+1,1, osEnumVO.getName())); |
| | | excelDataList.add(new WriteExcelData(i+j+1,2, osEnumVO.getEnumValueDataType())); |
| | | excelDataList.add(new WriteExcelData(i+j+1,3, osEnumVO.getLength())); |
| | | |
| | | startRow += enumVOItems.size(); |
| | | excelDataList.add(new WriteExcelData(i+j+1,4,osEnumItemVO.getName())); |
| | | excelDataList.add(new WriteExcelData(i+j+1,5, osEnumItemVO.getValue())); |
| | | excelDataList.add(new WriteExcelData(i+j+1,6, osEnumItemVO.getDescription())); |
| | | } |
| | | }else{ |
| | | //æä¸¾é¡¹ä¸ºç©ºæ¶å°±ä¸éè¦åå¹¶è¡ |
| | | //excelDataList.add(new WriteExcelData(startRow,0, true,osEnumVO.getOid())); |
| | | excelDataList.add(new WriteExcelData(startRow,0, true, osEnumVO.getId())); |
| | | excelDataList.add(new WriteExcelData(startRow,1, true, osEnumVO.getName())); |
| | | excelDataList.add(new WriteExcelData(startRow,1, true, osEnumVO.getEnumValueDataType()+"("+osEnumVO.getEnumValueDataTypeText()+")")); |
| | | excelDataList.add(new WriteExcelData(startRow,3, true, osEnumVO.getLength())); |
| | | //excelDataList.add(new WriteExcelData(startRow,5, true, osEnumVO.getCreator())); |
| | | excelDataList.add(new WriteExcelData(startRow,4, true, Func.format(osEnumVO.getCreateTime(),"yyyyå¹´MMæddæ¥ hh:mm:ss"))); |
| | | //æä¸¾é¡¹ä¸ä¸ºç©ºæ¶éè¦è¿è¡åå¹¶è¡å¤ç |
| | | if(Func.isNotEmpty(enumVOItems) || enumVOItems.size() > 1){ |
| | | //excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,0, osEnumVO.getOid())); |
| | | excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,0, osEnumVO.getId())); |
| | | excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,1, osEnumVO.getName())); |
| | | excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,2, osEnumVO.getEnumValueDataType()+"("+osEnumVO.getEnumValueDataTypeText()+")")); |
| | | excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,3, osEnumVO.getLength())); |
| | | //excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,5, osEnumVO.getCreator())); |
| | | excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,4, Func.format(osEnumVO.getCreateTime(),"yyyyå¹´MMæddæ¥ hh:mm:ss"))); |
| | | |
| | | //å¤çæä¸¾é¡¹åå
¥ |
| | | for (int j = 0; j < enumVOItems.size(); j++) { |
| | | OsEnumItemVO osEnumItemVO = enumVOItems.get(j); |
| | | excelDataList.add(new WriteExcelData(startRow+j,5, true,osEnumItemVO.getName())); |
| | | excelDataList.add(new WriteExcelData(startRow+j,6, true, osEnumItemVO.getValue())); |
| | | excelDataList.add(new WriteExcelData(startRow+j,7, true, osEnumItemVO.getDescription())); |
| | | } |
| | | |
| | | startRow += enumVOItems.size(); |
| | | }else{ |
| | | //æä¸¾é¡¹ä¸ºç©ºæ¶å°±ä¸éè¦åå¹¶è¡ |
| | | //excelDataList.add(new WriteExcelData(startRow,0, true,osEnumVO.getOid())); |
| | | excelDataList.add(new WriteExcelData(startRow,0, true, osEnumVO.getId())); |
| | | excelDataList.add(new WriteExcelData(startRow,1, true, osEnumVO.getName())); |
| | | excelDataList.add(new WriteExcelData(startRow,1, true, osEnumVO.getEnumValueDataType()+"("+osEnumVO.getEnumValueDataTypeText()+")")); |
| | | excelDataList.add(new WriteExcelData(startRow,3, true, osEnumVO.getLength())); |
| | | //excelDataList.add(new WriteExcelData(startRow,5, true, osEnumVO.getCreator())); |
| | | excelDataList.add(new WriteExcelData(startRow,4, true, Func.format(osEnumVO.getCreateTime(),"yyyyå¹´MMæddæ¥ hh:mm:ss"))); |
| | | } |
| | | //è®°å½ä¸ä¸ä¸ç»æ°æ®ç»ææ¶çè¡å·ï¼æ¹ä¾¿ç¨ååå¹¶è¡çèµ·å§è¡ |
| | | startRow += 1; |
| | | } |
| | | //è®°å½ä¸ä¸ä¸ç»æ°æ®ç»ææ¶çè¡å·ï¼æ¹ä¾¿ç¨ååå¹¶è¡çèµ·å§è¡ |
| | | startRow += 1; |
| | | } |
| | | WriteExcelOption excelOption = new WriteExcelOption(excelDataList); |
| | | ExcelUtil.writeDataToFile(excelPath, excelOption); |
| | |
| | | //ç颿²¡ä¼ åç§°ï¼ä½¿ç¨é»è®¤å¯¼åºåç§° |
| | | exportFileName = Func.isBlank(exportFileName) ? "æä¸¾å¯¼å
¥æ¨¡æ¿_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName; |
| | | //设置åå |
| | | List<String> columns = new ArrayList<>(Arrays.asList("æä¸¾åç§°", "æ ç¾", "è¿åç±»å", "é¿åº¦", "æä¸¾é¡¹åç§°(å½åæä¸¾ä¸ææä¸¾é¡¹æ¶å¿
å¡«)", "æä¸¾å¼(å½åæä¸¾ä¸ææä¸¾é¡¹æ¶å¿
å¡«)", "æè¿°","*注æ*:第äºè¡å¼å§çæ°æ®ä¸ºç¤ºä¾æ°æ®ï¼å¯¼å
¥å请å°å
¶å é¤ï¼å½å¯¼å
¥çæä¸¾ä¸å
·å¤å¤ä¸ªæä¸¾é¡¹æ¶ï¼åºæç
§ç¤ºä¾enum2çåæ³")); |
| | | List<String> columns = this.getCloumns(true); |
| | | //åexcel |
| | | String excelPath = LocalFileUtil.getDefaultTempFolder() + File.separator + exportFileName + ".xls"; |
| | | //设置å¿
å¡«å |
| | |
| | | WriteExcelOption excelOption = new WriteExcelOption(excelDataList); |
| | | ExcelUtil.writeDataToFile(excelPath, excelOption); |
| | | return excelPath; |
| | | } |
| | | |
| | | /** |
| | | * è·åå¯¼åºæå¯¼å
¥æ¨¡æ¿çåå |
| | | * @param flag æ¯å¦è·å导å
¥æ¨¡æ¿åå |
| | | * @return |
| | | */ |
| | | private List<String> getCloumns(boolean flag){ |
| | | if(flag){ |
| | | return new ArrayList<>( |
| | | Arrays.asList("æä¸¾åç§°", "æ ç¾", "è¿åç±»å", "é¿åº¦", "æä¸¾é¡¹åç§°(å½åæä¸¾ä¸ææä¸¾é¡¹æ¶å¿
å¡«)", |
| | | "æä¸¾å¼(å½åæä¸¾ä¸ææä¸¾é¡¹æ¶å¿
å¡«)", "æè¿°","*注æ*:第äºè¡å¼å§çæ°æ®ä¸ºç¤ºä¾æ°æ®ï¼å¯¼å
¥å请å°å
¶å é¤ï¼" + |
| | | "å½å¯¼å
¥çæä¸¾ä¸å
·å¤å¤ä¸ªæä¸¾é¡¹æ¶ï¼åºæç
§ç¤ºä¾enumbçåæ³" |
| | | ) |
| | | ); |
| | | } |
| | | return new ArrayList<>( |
| | | Arrays.asList("æä¸¾åç§°", "æ ç¾", "è¿åç±»å", "é¿åº¦", |
| | | "å建æ¶é´", "æä¸¾é¡¹åç§°", "æä¸¾å¼", "æè¿°" |
| | | ) |
| | | ); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | //å½åexcel䏿¯å¦éå¤ç¨çå¤éMap:ï¼keyï¼å¤é屿§ï¼valueï¼è¡å·ï¼ |
| | | Map<String, String> excelReapeat = new HashMap<>(); |
| | | //夿å¿
填屿§æ¯å¦ä¸ºç©ºï¼ç¨æ·æ¯å¦å·²åå¨ï¼ä»¥åé¨é¨æ¯å¦å¡«éçæ ¡éªé»è¾ |
| | | //夿å¿
填屿§æ¯å¦ä¸ºç©ºçç |
| | | List<String> finalRepeatEnumId = repeatEnumId; |
| | | newPOList.stream().forEach(osEnumPO -> { |
| | | if(Func.isBlank(osEnumPO.getId())){//æä¸¾å |
| | |
| | | throw new VciBaseException("第ã"+osEnumPO.getRowIndex()+"ãè¡æ°æ®ï¼æä¸¾åç§°åªè½ä¸ºè±æåæ¯"); |
| | | }else if(excelReapeat.containsKey(osEnumPO.getId())){//æä¸¾åè¡¨æ ¼ä¸å¤é |
| | | throw new VciBaseException("第ã"+excelReapeat.get(osEnumPO.getId())+"ãè¡å第ã"+osEnumPO.getRowIndex()+"ãè¡æ°æ®ï¼æä¸¾åéå¤"); |
| | | }else if (Func.isNotEmpty(osEnumVOList) && finalRepeatEnumId.contains(osEnumPO.getId())){//2ã夿æä¸¾åæ¯å¦ä¸ç³»ç»ä¸éå¤ |
| | | }else if (Func.isNotEmpty(finalRepeatEnumId) && finalRepeatEnumId.contains(osEnumPO.getId())){//2ã夿æä¸¾åæ¯å¦ä¸ç³»ç»ä¸éå¤ |
| | | throw new VciBaseException("第ã"+osEnumPO.getRowIndex()+"ãè¡ï¼æä¸¾åå¨ç³»ç»ä¸å·²ç»åå¨,请修æ¹!"); |
| | | } |
| | | //å
对æä¸¾åexcelä¸éè¦å¤éå¤ç |
| | |
| | | * @return |
| | | */ |
| | | private List<OsEnumVO> getExportEnumTempExample(){ |
| | | String testJosn = "[{\"enumValueDataType\":\"String\",\"id\":\"enum1\",\"items\":[{\"description\":\"enumitem1.1\",\"name\":\"enumitem1.1\",\"value\":\"1\"},{\"description\":\"enumitem1.2\",\"name\":\"enumitem1.2\",\"value\":\"2\"}],\"length\":2,\"name\":\"enum1\"},{\"enumValueDataType\":\"String\",\"id\":\"enum2\",\"items\":[{\"description\":\"enumitem2.1\",\"name\":\"enumitem2.1\",\"value\":\"1\"},{\"description\":\"enumitem2.2\",\"name\":\"enumitem2.2\",\"value\":\"2\"},{\"description\":\"enumitem2.3\",\"name\":\"enumitem2.3\",\"value\":\"3\"}],\"length\":6,\"name\":\"enum2\"}]"; |
| | | String testJosn = "[{\"enumValueDataType\":\"String\",\"id\":\"enuma\",\"items\":[{\"description\":\"enumitem1.1\",\"name\":\"enumitem1.1\",\"value\":\"1\"},{\"description\":\"enumitem1.2\",\"name\":\"enumitem1.2\",\"value\":\"2\"}],\"length\":2,\"name\":\"enuma\"},{\"enumValueDataType\":\"String\",\"id\":\"enumb\",\"items\":[{\"description\":\"enumitem2.1\",\"name\":\"enumitem2.1\",\"value\":\"1\"},{\"description\":\"enumitem2.2\",\"name\":\"enumitem2.2\",\"value\":\"2\"},{\"description\":\"enumitem2.3\",\"name\":\"enumitem2.3\",\"value\":\"3\"}],\"length\":6,\"name\":\"enumb\"}]"; |
| | | List<OsEnumVO> OsEnumVOs = JSON.parseArray(testJosn,OsEnumVO.class); |
| | | return OsEnumVOs; |
| | | } |
| | |
| | | */ |
| | | private EnumType osEnumDTO2EnumType(OsEnumDTO osEnumDTO){ |
| | | EnumType enumType = new EnumType(); |
| | | enumType.oid = osEnumDTO.getOid(); |
| | | //enumType.oid = osEnumDTO.getOid(); |
| | | //æä¸¾åç»ä¸è½¬æå°åï¼é¿å
åæåºç°å
¶ä»é®é¢ |
| | | enumType.name = osEnumDTO.getId().toLowerCase(Locale.ROOT); |
| | | enumType.label = osEnumDTO.getName(); |
| | |
| | | for(int k = 0; k < emChildren.length; k++){ |
| | | EnumItem emChild = emChildren[k]; |
| | | String value = emChild.value; |
| | | valueList.add(value); |
| | | String symbol = ""; |
| | | //å½ä¸ºIntegeræ¶éè¦å°æä¸¾é¡¹å¼æ¼æ¥ä¸= |
| | | if("Integer".equals(enumType)){ |
| | | symbol = "="; |
| | | } |
| | | valueList.add(symbol + value); |
| | | } |
| | | Map<String, List<String>> enumMap = new HashMap<>(); |
| | | enumMap.put(emItem.name, valueList); |
| | |
| | | package com.vci.web.service.impl; |
| | | |
| | | import cn.hutool.core.io.FileUtil; |
| | | import cn.hutool.core.util.ZipUtil; |
| | | import com.fasterxml.jackson.core.type.TypeReference; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.vci.constant.FrameWorkLangCodeConstant; |
| | | import com.vci.corba.common.PLException; |
| | | import com.vci.corba.omd.atm.AttributeDef; |
| | | import com.vci.corba.omd.btm.BizType; |
| | | import com.vci.corba.omd.data.BusinessObject; |
| | | import com.vci.corba.omd.ltm.LinkType; |
| | | import com.vci.corba.omd.ltm.LinkTypeServicePrx; |
| | | import com.vci.dto.OsAttributeDTO; |
| | | import com.vci.omd.constants.LinkTypeConstants; |
| | | import com.vci.omd.utils.ObjectTool; |
| | | import com.vci.pagemodel.*; |
| | | import com.vci.po.OsAttributePO; |
| | | import com.vci.po.OsLinkTypePO; |
| | | import com.vci.starter.poi.bo.ReadExcelOption; |
| | | import com.vci.starter.poi.bo.WriteExcelData; |
| | | import com.vci.starter.poi.bo.WriteExcelOption; |
| | | import com.vci.starter.poi.constant.ExcelLangCodeConstant; |
| | | import com.vci.starter.poi.util.ExcelUtil; |
| | | import com.vci.starter.web.annotation.log.VciUnLog; |
| | | import com.vci.starter.web.enumpck.VciFieldTypeEnum; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | | import com.vci.starter.web.pagemodel.BaseQueryObject; |
| | | import com.vci.starter.web.pagemodel.BaseResult; |
| | | import com.vci.starter.web.pagemodel.DataGrid; |
| | | import com.vci.starter.web.util.BeanUtil; |
| | | import com.vci.starter.web.util.VciBaseUtil; |
| | | import com.vci.starter.web.util.VciDateUtil; |
| | | import com.vci.starter.web.util.*; |
| | | import com.vci.model.OsLinkTypeDO; |
| | | import com.vci.web.service.*; |
| | | import com.vci.web.util.Func; |
| | | import com.vci.web.util.PlatformClientUtil; |
| | | import com.vci.web.util.WebUtil; |
| | | import javafx.scene.shape.HLineTo; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.*; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | */ |
| | | @Service |
| | | public class OsLinkTypeServiceImpl implements OsLinkTypeServiceI { |
| | | |
| | | private static final String OID = "oid"; |
| | | private static final String NAME = "name"; |
| | | private static final String LABEL = "label"; |
| | | private static final String DESCRIPTION = "description"; |
| | | private static final String TS = "ts"; |
| | | private static final String CREATOR = "creator"; |
| | | private static final String CREATETIME = "createTime"; |
| | | private static final String MODIFIER = "modifier"; |
| | | private static final String MODIFYTIME = "modifyTime"; |
| | | |
| | | /** |
| | | * æ¥å¿ |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 导åºé¾æ¥ç±»å |
| | | * name 龿¥ç±»ååç§° |
| | | * @return åå»ºç»æ |
| | | */ |
| | | @Override |
| | | public void expData(String names, HttpServletResponse response) throws PLException, IOException { |
| | | String defaultTempFolder = LocalFileUtil.getDefaultTempFolder(); |
| | | //åexcel |
| | | String excelPath = defaultTempFolder + File.separator + "lt.xls"; |
| | | //设置åå |
| | | List<String> columns = new ArrayList<>( |
| | | Arrays.asList("åç§°", "æ ç¾", "å®ç°ç±»", "å½¢ç¶", "From端类åå表", "From端主类å", "From端对åºå
³ç³»", |
| | | "To端类åå表", "To端主类å", "To端对åºå
³ç³»", "屿§å表", "æè¿°") |
| | | ); |
| | | try { |
| | | new File(excelPath).createNewFile(); |
| | | //设置å |
| | | List<WriteExcelData> excelDataList = new ArrayList<>(); |
| | | //设置å头 |
| | | for (int index = 0; index < columns.size(); index++) { |
| | | excelDataList.add(new WriteExcelData(0,index, columns.get(index))); |
| | | } |
| | | HashSet<String> attributes = new HashSet<>(); |
| | | int i = 0; |
| | | for (String name : names.split(",")) { |
| | | LinkType lt = platformClientUtil.getLinkTypeService().getLinkType(name); |
| | | excelDataList.add(new WriteExcelData(i+1,0, lt.name)); |
| | | excelDataList.add(new WriteExcelData(i+1,1, lt.tag)); |
| | | excelDataList.add(new WriteExcelData(i+1,2, lt.implClass)); |
| | | excelDataList.add(new WriteExcelData(i+1,3, lt.shape)); |
| | | excelDataList.add(new WriteExcelData(i+1,4, String.join(",",lt.btmItemsFrom))); |
| | | excelDataList.add(new WriteExcelData(i+1,5, lt.primitivesFrom)); |
| | | excelDataList.add(new WriteExcelData(i+1,6, lt.relationFrom)); |
| | | excelDataList.add(new WriteExcelData(i+1,7, String.join(",",lt.btmItemsTo))); |
| | | excelDataList.add(new WriteExcelData(i+1,8, lt.primitivesTo)); |
| | | excelDataList.add(new WriteExcelData(i+1,9, lt.relationTo)); |
| | | excelDataList.add(new WriteExcelData(i+1,10, String.join(",",lt.attributes))); |
| | | excelDataList.add(new WriteExcelData(i+1,11, lt.description)); |
| | | attributes.addAll(Arrays.asList(lt.attributes)); |
| | | i++; |
| | | } |
| | | WriteExcelOption excelOption = new WriteExcelOption(excelDataList); |
| | | ExcelUtil.writeDataToFile(excelPath, excelOption); |
| | | //导åºå±æ§ |
| | | String attrPath = attributeService.exportAttributes("attr", |
| | | String.valueOf(attributes.stream().collect(Collectors.joining(","))),true); |
| | | //ç§»å¨å±æ§å°é¾æ¥ç±»åæä»¶å¤¹éé¢å» |
| | | FileUtil.move(new File(attrPath), new File(defaultTempFolder),true); |
| | | FileUtil.del(attrPath.substring(0,attrPath.lastIndexOf("\\"))); |
| | | //todo 导åºä¸å¡ç±»åè¿æ²¡æå®ç° |
| | | // List<BizType> bts = new ArrayList<BizType>(); |
| | | // for (String btName : btNameSet) { |
| | | // BizType bt = BtmProvider.getBtmItemByName(btName); |
| | | // bts.add(bt); |
| | | // } |
| | | // boolean btFlag = BtmProvider.expData(rootPath, bts.toArray(new BizType[0])); |
| | | }catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | File zip = ZipUtil.zip(defaultTempFolder); |
| | | FileUtil.del(defaultTempFolder + File.separator); |
| | | ControllerUtil.writeFileToResponse(response,zip.getAbsoluteFile()); |
| | | } |
| | | |
| | | /** |
| | | * 导å
¥é¾æ¥ç±»å |
| | | * @param file ä¸ä¼ çæä»¶ |
| | | * @return |
| | | */ |
| | | @Override |
| | | public BaseResult impData(MultipartFile file) throws Exception { |
| | | String defaultTempFolder = LocalFileUtil.getDefaultTempFolder(); |
| | | String fileName = defaultTempFolder + File.separator + LocalFileUtil.getFileNameForIE(file.getOriginalFilename()); |
| | | file.transferTo(new File(fileName)); |
| | | if (file == null) { |
| | | return BaseResult.fail(FrameWorkLangCodeConstant.IMPORT_FAIL, new String[]{"æ 导å
¥çæä»¶"}); |
| | | } |
| | | if (!fileName.endsWith(".zip")) { |
| | | throw new VciBaseException("ä»
è½ä¸ä¼ zipå缩æä»¶ï¼è¯·éæ°ä¸ä¼ ï¼"); |
| | | } |
| | | File unzip = ZipUtil.unzip(fileName); |
| | | File ltExcel = new File(unzip.getAbsolutePath() + File.separator + "lt.xls"); |
| | | File attrExcel = new File(unzip.getAbsolutePath() + File.separator + "attr.xls"); |
| | | if (!attrExcel.exists()) { |
| | | //å¢å è§£åçè·¯å¾ï¼çæä»¶è¿å¨æ²¡æ |
| | | attrExcel = new File(unzip.getAbsolutePath() + File.separator + unzip.getName() + File.separator + "attr.xls"); |
| | | if (!attrExcel.exists()) { |
| | | return BaseResult.fail(FrameWorkLangCodeConstant.IMPORT_FAIL, new String[]{"没æå¯¼å
¥ç屿§æä»¶ã导å
¥ç»æ¢ï¼"}); |
| | | } |
| | | } |
| | | BaseResult baseResult = attributeService.importAttributes(attrExcel); |
| | | if(!baseResult.isSuccess()){ |
| | | //å é¤ä¸ä¼ çæä»¶å¤¹ |
| | | FileUtil.del(defaultTempFolder + File.separator); |
| | | return baseResult; |
| | | } |
| | | //todo è¿é导å
¥ä¸å¡ç±»åï¼çå¾
åè½å®ç° |
| | | if (!ltExcel.exists()) { |
| | | //å¢å è§£åçè·¯å¾ï¼çæä»¶è¿å¨æ²¡æ |
| | | ltExcel = new File(unzip.getAbsolutePath() + File.separator + unzip.getName() + File.separator + "lt.xls"); |
| | | if (!ltExcel.exists()) { |
| | | //å é¤ä¸ä¼ çæä»¶å¤¹ |
| | | FileUtil.del(defaultTempFolder + File.separator); |
| | | return BaseResult.fail(FrameWorkLangCodeConstant.IMPORT_FAIL, new String[]{"没æå¯¼å
¥ç龿¥æä»¶ã导å
¥ç»æ¢ï¼"}); |
| | | } |
| | | } |
| | | try{ |
| | | //1ã读åexcelä¸çæ°æ®ï¼ç»æå¯¹è±¡ |
| | | ReadExcelOption excelOption = new ReadExcelOption(); |
| | | List<OsLinkTypePO> poList = ExcelUtil.readDataObjectFromExcel(ltExcel, OsLinkTypePO.class,excelOption,(value, po, fieldName)->{}); |
| | | //å»é¤é½æ¯ç©ºçæ
åµ |
| | | if(CollectionUtils.isEmpty(poList)){ |
| | | return BaseResult.fail(ExcelLangCodeConstant.IMPORT_CONTENT_NULL,new String[]{}); |
| | | } |
| | | //å½åexcel䏿¯å¦éå¤ç¨çå¤éMap:ï¼keyï¼å¤é屿§ï¼valueï¼è¡å·ï¼ |
| | | Map<String, String> excelReapeat = new HashMap<>(); |
| | | int maxLength = platformClientUtil.getLinkTypeService().getLTNameMaxLength(); |
| | | |
| | | //夿å¿
填屿§æ¯å¦ä¸ºç©ºï¼ç¨æ·æ¯å¦å·²åå¨ï¼ä»¥åé¨é¨æ¯å¦å¡«éçæ ¡éªé»è¾ |
| | | poList.stream().forEach(osLinkTypePO -> { |
| | | if(Func.isBlank(osLinkTypePO.getName())){//屿§åå¤ç©º |
| | | throw new VciBaseException("第ã"+osLinkTypePO.getRowIndex()+"ãè¡ï¼name"); |
| | | }else if(osLinkTypePO.getName().length() > maxLength){ |
| | | throw new VciBaseException("第ã"+osLinkTypePO.getRowIndex()+"ãè¡ï¼é¾æ¥ç±»ååé¿åº¦ä¸è½è¶
è¿" + maxLength); |
| | | }else if(!osLinkTypePO.getName().matches("^[A-Za-z]+$")){ |
| | | throw new VciBaseException("第ã"+osLinkTypePO.getRowIndex()+"ãè¡ï¼é¾æ¥ç±»ååç§°åªè½ä¸ºè±æåæ¯"); |
| | | }else if(excelReapeat.containsKey(osLinkTypePO.getName())){//屿§åè¡¨æ ¼ä¸å¤é |
| | | throw new VciBaseException("第ã"+excelReapeat.get(osLinkTypePO.getName())+"ãè¡å第ã"+osLinkTypePO.getRowIndex()+"ãè¡æ°æ®ï¼å±æ§åéå¤"); |
| | | } |
| | | try { |
| | | LinkType historyLink = platformClientUtil.getLinkTypeService().getLinkType(osLinkTypePO.getName()); |
| | | //å·²ææ¤æ°æ®è¿è¡å é¤è¦ç |
| | | if(historyLink != null && !historyLink.name.equals("")){ |
| | | platformClientUtil.getLinkTypeService().deleteLinkType(historyLink); |
| | | } |
| | | } catch (PLException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | //屿§åexcelä¸å¤éå¤ç |
| | | excelReapeat.put(osLinkTypePO.getName(),osLinkTypePO.getRowIndex()); |
| | | LinkType linkType = new LinkType(); |
| | | linkType.name = osLinkTypePO.getName(); |
| | | linkType.attributes = osLinkTypePO.getAttributes().split(","); |
| | | linkType.btmItemsFrom = osLinkTypePO.getBtmItemsFrom().split(","); |
| | | linkType.primitivesFrom = osLinkTypePO.getPrimitivesFrom(); |
| | | linkType.relationFrom = osLinkTypePO.getRelationFrom(); |
| | | linkType.btmItemsTo = osLinkTypePO.getBtmItemsTo().split(","); |
| | | linkType.primitivesTo = osLinkTypePO.getPrimitivesTo(); |
| | | linkType.relationTo = osLinkTypePO.getRelationTo(); |
| | | linkType.relation = osLinkTypePO.getRelationFrom() + ":" + osLinkTypePO.getRelationTo(); |
| | | linkType.description = osLinkTypePO.getDescription(); |
| | | linkType.tag = osLinkTypePO.getTag(); |
| | | linkType.shape = osLinkTypePO.getShape(); |
| | | linkType.implClass = osLinkTypePO.getImplClass(); |
| | | linkType.modifier = WebUtil.getCurrentUserId(); |
| | | linkType.creator = WebUtil.getCurrentUserId(); |
| | | try { |
| | | platformClientUtil.getLinkTypeService().addLinkType(linkType); |
| | | } catch (PLException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | }); |
| | | }catch (Exception e){ |
| | | if(logger.isErrorEnabled()){ |
| | | logger.error("读åexcelå
å®¹æ¶æä¿åç¨æ·ä¿¡æ¯æ¶åºç°äºé误ï¼å
·ä½åå ï¼",VciBaseUtil.getExceptionMessage(e)); |
| | | } |
| | | e.printStackTrace(); |
| | | return BaseResult.fail(VciBaseUtil.getExceptionMessage(e),new String[]{},e); |
| | | } |
| | | //å é¤ä¸ä¼ çæä»¶å¤¹ |
| | | FileUtil.del(defaultTempFolder + File.separator); |
| | | return BaseResult.success("龿¥ç±»å导å
¥æåï¼"); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®å¤é¾æ¥ç±»åçxmlæä»¶ |
| | |
| | | package com.vci.web.service.impl; |
| | | |
| | | import com.vci.client.mw.ClientSessionUtility; |
| | | import com.vci.corba.common.PLException; |
| | | import com.vci.corba.omd.stm.StatePool; |
| | | import com.vci.corba.omd.vrm.VersionRule; |
| | | import com.vci.dto.OsAttributeDTO; |
| | | import com.vci.dto.OsRevisionRuleDTO; |
| | | import com.vci.dto.OsStatusDTO; |
| | | import com.vci.pagemodel.OsAttributeVO; |
| | | import com.vci.pagemodel.OsEnumVO; |
| | | import com.vci.pagemodel.OsStatusVO; |
| | | import com.vci.po.OsAttributePO; |
| | | import com.vci.po.OsEnumPO; |
| | | import com.vci.po.OsRevisionRulePO; |
| | | import com.vci.starter.poi.bo.ReadExcelOption; |
| | | import com.vci.starter.poi.bo.WriteExcelData; |
| | | import com.vci.starter.poi.bo.WriteExcelOption; |
| | | import com.vci.starter.poi.constant.ExcelLangCodeConstant; |
| | | import com.vci.starter.poi.util.ExcelUtil; |
| | | import com.vci.starter.web.annotation.log.VciUnLog; |
| | | import com.vci.starter.web.util.VciDateUtil; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | | import com.vci.starter.web.pagemodel.BaseResult; |
| | | import com.vci.starter.web.util.*; |
| | | import com.vci.pagemodel.OsRevisionRuleVO; |
| | | import com.vci.web.service.OsRevisionRuleServiceI; |
| | | import com.vci.web.util.Func; |
| | | import com.vci.web.util.PlatformClientUtil; |
| | | import com.vci.web.util.WebUtil; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.poi.hssf.util.HSSFColor; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.swing.*; |
| | | import java.awt.*; |
| | | import java.io.File; |
| | | import java.util.*; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | @Autowired(required = false) |
| | | @Lazy |
| | | private OsRevisionRuleServiceI self; |
| | | |
| | | /** |
| | | * æ¥å¿ |
| | | */ |
| | | private Logger logger = LoggerFactory.getLogger(getClass()); |
| | | |
| | | /** |
| | | * å¿
å¡«å |
| | | */ |
| | | private List<Integer> ColumnNameisRed = new ArrayList<Integer>(); |
| | | |
| | | /** |
| | | * æ¥è¯¢ææççæ¬è§å |
| | | * |
| | |
| | | @VciUnLog |
| | | public Map<String, OsRevisionRuleVO> selectAllRevisionMap() { |
| | | return Optional.ofNullable(self.selectAllRevision()).orElseGet(()->new ArrayList<>()).stream().collect(Collectors.toMap(s->s.getId().toLowerCase(),t->t,(o1,o2)->o1)); |
| | | } |
| | | |
| | | /** |
| | | * åå»ºçæ¬è§å |
| | | * @param osRevisionRuleDTO |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean addVersionRule(OsRevisionRuleDTO osRevisionRuleDTO) throws PLException { |
| | | //å¤ç©º |
| | | VciBaseUtil.alertNotNull(osRevisionRuleDTO,"çæ¬è§å对象",osRevisionRuleDTO.getId(),"çæ¬è§ååç§°"); |
| | | //çæ¬è§ååè§æ£éª |
| | | this.checkVersionRule(osRevisionRuleDTO); |
| | | //æ¥é |
| | | VersionRule vr = platformClientUtil.getVersionService().getVersionRule(osRevisionRuleDTO.getId()); |
| | | //nameä¸ä¸ºç©º |
| | | if(Func.isNotEmpty(vr) && !"".equals(vr.name)){ |
| | | throw new PLException("500",new String[]{"åç§°éå¤è¯·æ´æ¢åç§°!"}); |
| | | } |
| | | return platformClientUtil.getVersionService().addVersionRule(this.dto2VersionRule(osRevisionRuleDTO)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹çæ¬è§å |
| | | * @param osRevisionRuleDTO |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean updateVersionRule(OsRevisionRuleDTO osRevisionRuleDTO) throws PLException { |
| | | //å¤ç©º |
| | | VciBaseUtil.alertNotNull(osRevisionRuleDTO,"çæ¬è§å对象",osRevisionRuleDTO.getId(),"çæ¬è§ååç§°"); |
| | | //夿æ¯å¦å¨ç³»ç»ä¸åå¨ |
| | | VersionRule vr = platformClientUtil.getVersionService().getVersionRule(osRevisionRuleDTO.getName()); |
| | | //çæ¬è§ååè§æ£éª |
| | | this.checkVersionRule(osRevisionRuleDTO); |
| | | //nameä¸ä¸ºç©º |
| | | if(Func.isEmpty(vr) && !"".equals(vr.name)){ |
| | | throw new PLException("500",new String[]{"ä¿®æ¹ççæ¬è§åå¨ç³»ç»ä¸ä¸åå¨!"}); |
| | | } |
| | | return platformClientUtil.getVersionService().modifyVersionRule(this.dto2VersionRule(osRevisionRuleDTO)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤çæ¬è§å |
| | | * @param osRevisionRuleDTOS |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean deleteVersionRule(List<OsRevisionRuleDTO> osRevisionRuleDTOS) throws PLException { |
| | | VciBaseUtil.alertNotNull(osRevisionRuleDTOS,"å¾
å é¤ç屿§å表"); |
| | | //夿è¦å é¤ççæ¬è§åæ¯å¦æè¢«å¼ç¨ |
| | | osRevisionRuleDTOS.stream().forEach(item->{ |
| | | String vrName = item.getId(); |
| | | try { |
| | | String[] btNamesByVerName = platformClientUtil.getBtmService().getBTNamesByVerName(vrName); |
| | | if(btNamesByVerName != null && btNamesByVerName.length > 0){ |
| | | throw new VciBaseException("è¯¥çæ¬å·²è¢«ä½¿ç¨ä¸å
许å é¤"); |
| | | } |
| | | } catch (PLException e) { |
| | | logger.error(e.getMessage()); |
| | | e.printStackTrace(); |
| | | throw new VciBaseException(e.getMessage()); |
| | | } |
| | | }); |
| | | |
| | | //å¹³å°çdeleteStatusæ¹æ³å¿
ä¼ ä¸ä¸ªåæ°ï¼oidãnameåts |
| | | List<VersionRule> vrList = new ArrayList<>(); |
| | | for(OsRevisionRuleDTO vrDTO : osRevisionRuleDTOS){ |
| | | //oidåtså¤ç©º |
| | | String oid = vrDTO.getOid(); |
| | | //id主è¦ç¨æ¥å¯¹ç¼åæ°æ®å é¤ |
| | | String id = vrDTO.getId(); |
| | | //åå°ä¼ç¨tsè¿è¡æ°æ®ä¸è´æ§æ ¡éª |
| | | Date ts = vrDTO.getTs(); |
| | | if(Func.isBlank(oid) || Func.isBlank(id) || Func.isEmpty(ts)){ |
| | | throw new PLException("500",new String[]{"å¾
å é¤çç¶æå表ä¸ä¸»é®ãoidããè°æ´æ¶é´ãtsããç¶æåç§°ãnameãä¸è½ä¸ºç©ºï¼"}); |
| | | } |
| | | VersionRule vr = new VersionRule(); |
| | | vr.oid = oid; |
| | | vr.name = id; |
| | | vr.ts = Func.format(ts,VciDateUtil.DateTimeMillFormat); |
| | | vrList.add(vr); |
| | | } |
| | | return platformClientUtil.getVersionService().deleteVersionRules(vrList.toArray(new VersionRule[vrList.size()])); |
| | | } |
| | | |
| | | /** |
| | | * æ£æ¥çæ¬è§åè®¾ç½®çæ¯å¦åç |
| | | * @param dto |
| | | */ |
| | | private void checkVersionRule(OsRevisionRuleDTO dto) throws PLException { |
| | | //çæ¬è§ååç§°åªè½ä¸ºè±æåæ¯ |
| | | String regex = "[a-z A-Z]*"; |
| | | if (!dto.getId().matches(regex)) { |
| | | throw new PLException("500",new String[]{"åç§°åªè½ä¸ºè±æï¼"}); |
| | | } |
| | | //è·³è·å符åªè½ä¸ºæ°åæè
忝 |
| | | if(Func.isNotBlank(dto.getJumpCharacter()) && (!(dto.getJumpCharacter().matches(regex)))){ |
| | | throw new PLException("500",new String[]{"è·³è·å符åªè½ä¸ºæ°åæè
忝ï¼"}); |
| | | } |
| | | //åå§å¼ä¸è½ä¸ºç©ºä¸åªè½ä¸ºæ°åæè
忝æè±æç¶æä¸çç¬¦å· |
| | | String regex1 = "[A-Za-z0-9!@#$%^&*()-_=+{}':|;,.?/]+$"; |
| | | if(Func.isBlank(dto.getInitialValue()) || !dto.getInitialValue().matches(regex1)){ |
| | | throw new PLException("500",new String[]{"åå§å¼ä¸è½ä¸ºç©ºä¸åªè½ä¸ºæ°åæè
忝æè±æç¶æä¸ç符å·ï¼"}); |
| | | } |
| | | if(dto.getInitialValue().length() + dto.getInitialValue().length() > 32) { |
| | | throw new PLException("500",new String[]{"åå§å¼ä¸è½è¶
è¿32个å符ï¼"}); |
| | | } |
| | | //æ¥é¿ä¸è½ä¸ºç©ºä¸å¿
须为1-9çæ£æ´æ° |
| | | String regex2 = "[1-9]"; |
| | | if(Func.isBlank(dto.getStepLength()) || (!dto.getStepLength().matches(regex2))){ |
| | | throw new PLException("500",new String[]{"æ¥é¿ä¸è½ä¸ºç©ºä¸å¿
须为1-9çæ£æ´æ°"}); |
| | | } |
| | | //åç¼ç¸å
³å¤æ |
| | | String regex3 = "^\\s+.*"; |
| | | if(Func.isNotBlank(dto.getPrefixion()) && (dto.getPrefixion().matches(regex3))){ |
| | | throw new PLException("500",new String[]{"åç¼ä¸è½ä»¥ç©ºæ ¼å¼å¤´"}); |
| | | } |
| | | if (Func.isNotBlank(dto.getPrefixion()) && dto.getPrefixion().length() > 32) { |
| | | throw new PLException("500",new String[]{"åç¼ä¸è½è¶
è¿32个å符"}); |
| | | } |
| | | //åç¼ç¸å
³å¤æ |
| | | String regex4 = "^*.\\s+$"; |
| | | if(Func.isNotBlank(dto.getSuffix()) && (dto.getSuffix().matches(regex4))){ |
| | | throw new PLException("500",new String[]{"åç¼ä¸è½ä»¥ç©ºæ ¼ç»å°¾"}); |
| | | } |
| | | if (Func.isNotBlank(dto.getSuffix()) && dto.getSuffix().length() > 32) { |
| | | throw new PLException("500",new String[]{"åç¼ä¸è½è¶
è¿32个å符"}); |
| | | } |
| | | if (dto.getId().length() > 255) { |
| | | throw new PLException("500",new String[]{"åç§°ä¸è½è¶
è¿255个å符"}); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * dto对象转æ¢ä¸ºVersionRule对象 |
| | | * @return |
| | | */ |
| | | private VersionRule dto2VersionRule(OsRevisionRuleDTO osRevisionRuleDTO){ |
| | | VersionRule newVR = new VersionRule(); |
| | | newVR.oid = osRevisionRuleDTO.getOid(); |
| | | newVR.name = osRevisionRuleDTO.getId(); |
| | | newVR.tag = osRevisionRuleDTO.getName(); |
| | | newVR.description = osRevisionRuleDTO.getDescription(); |
| | | newVR.jumpCharacter = osRevisionRuleDTO.getJumpCharacter(); |
| | | newVR.initialValue = osRevisionRuleDTO.getInitialValue(); |
| | | newVR.stepLength = osRevisionRuleDTO.getStepLength(); |
| | | newVR.prefixion = osRevisionRuleDTO.getPrefixion(); |
| | | newVR.suffix = osRevisionRuleDTO.getSuffix(); |
| | | String userName = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); |
| | | long timeMillis = System.currentTimeMillis(); |
| | | newVR.ts = Func.format((Func.isNotEmpty(osRevisionRuleDTO.getTs()) ? osRevisionRuleDTO.getTs():new Date()),VciDateUtil.DateTimeMillFormat); |
| | | newVR.creator = Func.isBlank(osRevisionRuleDTO.getCreator()) ? userName:osRevisionRuleDTO.getCreator(); |
| | | newVR.createTime = Func.isEmpty(osRevisionRuleDTO.getCreateTime()) ? timeMillis:osRevisionRuleDTO.getCreateTime().getTime(); |
| | | newVR.modifier = userName; |
| | | newVR.modifyTime = timeMillis; |
| | | return newVR; |
| | | } |
| | | |
| | | /** |
| | |
| | | try { |
| | | ruleVO.setCreateTime(VciDateUtil.long2Date(versionRule.createTime)); |
| | | ruleVO.setLastModifyTime(VciDateUtil.long2Date(versionRule.modifyTime)); |
| | | ruleVO.setTs(VciDateUtil.str2Date(versionRule.ts,VciDateUtil.DateTimeFormat)); |
| | | ruleVO.setTs(VciDateUtil.str2Date(versionRule.ts,VciDateUtil.DateTimeMillFormat)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | ruleVO.setDescription(versionRule.description); |
| | | ruleVO.setId(versionRule.name); |
| | | ruleVO.setName(versionRule.tag); |
| | | ruleVO.setSerialStep(WebUtil.getInt(versionRule.stepLength)); |
| | | ruleVO.setSkipCode(versionRule.jumpCharacter); |
| | | ruleVO.setPrefixCode(versionRule.prefixion); |
| | | ruleVO.setSuffixCode(versionRule.suffix); |
| | | ruleVO.setStartCode(versionRule.initialValue); |
| | | ruleVO.setStepLength(WebUtil.getInt(versionRule.stepLength)); |
| | | ruleVO.setJumpCharacter(versionRule.jumpCharacter); |
| | | ruleVO.setPrefixion(versionRule.prefixion); |
| | | ruleVO.setSuffix(versionRule.suffix); |
| | | ruleVO.setInitialValue(versionRule.initialValue); |
| | | //associatedææ¶æ²¡æä½¿ç¨ |
| | | } |
| | | return ruleVO; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 使ç¨å¤ä¸ªç¼å·è·åè§åçå¼ |
| | | * @param vrIdList ç¼å· |
| | | * @return æ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @Override |
| | | public List<OsRevisionRuleVO> getRevisionRuleByIds(Collection<String> vrIdList) { |
| | | if(Func.isEmpty(vrIdList)){ |
| | | return null; |
| | | } |
| | | Map<String, OsRevisionRuleVO> revisionRuleVOMap = self.selectAllRevisionMap(); |
| | | List<OsRevisionRuleVO> versionRuleList = new ArrayList<>(); |
| | | vrIdList.stream().forEach(vrId->{ |
| | | OsRevisionRuleVO versionRuleVO = revisionRuleVOMap.getOrDefault(vrId.toLowerCase(Locale.ROOT),null); |
| | | if(versionRuleVO!=null){ |
| | | versionRuleList.add(versionRuleVO); |
| | | } |
| | | }); |
| | | return versionRuleList; |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢åºç¨èå´ |
| | | * @param vrName çæ¬è§åè±æåç§° |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Map<String, String>> getUsedVersionRuleList(String vrName) throws PLException { |
| | | if(Func.isBlank(vrName)){ |
| | | throw new PLException("500",new String[]{"è¯·éæ©è¦æ¥è¯¢åºç¨èå´ç屿§!"}); |
| | | } |
| | | String[] btNames = platformClientUtil.getBtmService().getBTNamesByVerName(vrName); |
| | | if(Func.isEmpty(btNames)){ |
| | | return new ArrayList<>(); |
| | | } |
| | | List<Map<String,String>> btmNameMapList = new ArrayList<>(); |
| | | Arrays.stream(btNames).forEach(btName->{ |
| | | Map<String, String> itemMap = new HashMap<>(); |
| | | itemMap.put("versionRuleName",vrName); |
| | | itemMap.put("source",btName); |
| | | btmNameMapList.add(itemMap); |
| | | }); |
| | | return btmNameMapList; |
| | | } |
| | | |
| | | /** |
| | | * 导åºéä¸ççæ¬è§å |
| | | * @param exportFileName 导åºçæä»¶å |
| | | * @param vrNames éè¦å¯¼åºççæ¬è§ååç§° |
| | | * @param flag æ§å¶å¯¼åºçå忝å¦å导å
¥æ¨¡æ¿ä¸è´ |
| | | * @return |
| | | */ |
| | | @Override |
| | | public String exportVersionRule(String exportFileName, String vrNames, boolean flag) throws PLException { |
| | | if(Func.isBlank(vrNames)){ |
| | | throw new PLException("500",new String[]{"请å¾éè¦å¯¼åºççæ¬è§å!"}); |
| | | } |
| | | //ç颿²¡ä¼ åç§°ï¼ä½¿ç¨é»è®¤å¯¼åºåç§° |
| | | exportFileName = Func.isBlank(exportFileName) ? "çæ¬è§å导åº_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName; |
| | | //设置åå |
| | | List<String> columns = this.getCloumns(flag); |
| | | |
| | | //åexcel |
| | | String excelPath = LocalFileUtil.getDefaultTempFolder() + File.separator + exportFileName + ".xls"; |
| | | try { |
| | | new File(excelPath).createNewFile(); |
| | | } catch (Throwable e) { |
| | | throw new VciBaseException(LangBaseUtil.getErrorMsg(e), new String[]{excelPath}, e); |
| | | } |
| | | //设置å |
| | | List<WriteExcelData> excelDataList = new ArrayList<>(); |
| | | //设置å头 |
| | | for (int index = 0; index < columns.size(); index++) { |
| | | excelDataList.add(new WriteExcelData(0,index, columns.get(index))); |
| | | } |
| | | //æç
§çæ¬è§ååæ¥è¯¢ï¼ç¶åå¤ççæ¬è§åå¯¼åº |
| | | List<String> vrIdList = Func.toStrList(vrNames); |
| | | List<OsRevisionRuleVO> revisionRuleVOList = this.getRevisionRuleByIds(vrIdList); |
| | | if(Func.isEmpty(revisionRuleVOList)){ |
| | | excelDataList.add(new WriteExcelData(1,1, "æ ¹æ®åç§°æªæ¥è¯¢å°çæ¬è§åä¿¡æ¯ï¼è¯·å·æ°åå°è¯éæ°å¯¼åºï¼")); |
| | | }else{ |
| | | for (int i = 0; i < revisionRuleVOList.size(); i++) { |
| | | OsRevisionRuleVO revisionRuleVO = revisionRuleVOList.get(i); |
| | | excelDataList.add(new WriteExcelData(i+1,0, revisionRuleVO.getId())); |
| | | excelDataList.add(new WriteExcelData(i+1,1, revisionRuleVO.getName())); |
| | | excelDataList.add(new WriteExcelData(i+1,2, revisionRuleVO.getJumpCharacter())); |
| | | excelDataList.add(new WriteExcelData(i+1,3, revisionRuleVO.getInitialValue())); |
| | | excelDataList.add(new WriteExcelData(i+1,4, revisionRuleVO.getStepLength())); |
| | | excelDataList.add(new WriteExcelData(i+1,5, revisionRuleVO.getPrefixion())); |
| | | excelDataList.add(new WriteExcelData(i+1,6, revisionRuleVO.getSuffix())); |
| | | excelDataList.add(new WriteExcelData(i+1,7, revisionRuleVO.getDescription())); |
| | | if(!flag){ |
| | | excelDataList.add(new WriteExcelData(i+1,8, Func.format(revisionRuleVO.getCreateTime(),"yyyyå¹´MMæddæ¥ hh:mm:ss"))); |
| | | } |
| | | } |
| | | } |
| | | WriteExcelOption excelOption = new WriteExcelOption(excelDataList); |
| | | ExcelUtil.writeDataToFile(excelPath, excelOption); |
| | | return excelPath; |
| | | } |
| | | |
| | | /** |
| | | * ä¸è½½çæ¬è§å导å
¥æ¨¡æ¿ |
| | | * @param exportFileName |
| | | * @return |
| | | * @throws PLException |
| | | */ |
| | | @Override |
| | | public String downloadVersionRuleTemplate(String exportFileName) throws Exception { |
| | | //ç颿²¡ä¼ åç§°ï¼ä½¿ç¨é»è®¤å¯¼åºåç§° |
| | | exportFileName = Func.isBlank(exportFileName) ? "çæ¬è§å导å
¥æ¨¡æ¿_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName; |
| | | //设置åå |
| | | List<String> columns = this.getCloumns(true); |
| | | //设置å¿
å¡«å |
| | | ColumnNameisRed.clear(); |
| | | ColumnNameisRed.add(0); |
| | | ColumnNameisRed.add(3); |
| | | ColumnNameisRed.add(4); |
| | | |
| | | //åexcel |
| | | String excelPath = LocalFileUtil.getDefaultTempFolder() + File.separator + exportFileName + ".xls"; |
| | | try { |
| | | new File(excelPath).createNewFile(); |
| | | } catch (Throwable e) { |
| | | throw new VciBaseException(LangBaseUtil.getErrorMsg(e), new String[]{excelPath}, e); |
| | | } |
| | | //设置å |
| | | List<WriteExcelData> excelDataList = new ArrayList<>(); |
| | | //设置å头 |
| | | for (int index = 0; index < columns.size(); index++) { |
| | | //夿æ¯å¦ä¸ºå¿
å¡«åï¼ç»å¿
å¡«å设置é¢è² |
| | | if(ColumnNameisRed.contains(index)){ |
| | | WriteExcelData excelData = new WriteExcelData(0, index, columns.get(index)); |
| | | excelData.setFontColor(String.valueOf(HSSFColor.HSSFColorPredefined.RED.getIndex())); |
| | | excelDataList.add(excelData); |
| | | }else{ |
| | | excelDataList.add(new WriteExcelData(0,index, columns.get(index))); |
| | | } |
| | | } |
| | | WriteExcelOption excelOption = new WriteExcelOption(excelDataList); |
| | | ExcelUtil.writeDataToFile(excelPath, excelOption); |
| | | return excelPath; |
| | | } |
| | | |
| | | /** |
| | | * 导å
¥çæ¬è§å |
| | | * @param file |
| | | * @return |
| | | */ |
| | | @Override |
| | | public BaseResult importVersionRules(File file) throws Exception { |
| | | VciBaseUtil.alertNotNull(file,"excelæä»¶"); |
| | | if(!file.exists()){ |
| | | throw new VciBaseException("导å
¥çexcelæä»¶ä¸åå¨,{0}",new String[]{file.getPath()}); |
| | | } |
| | | try{ |
| | | //1ã读åexcelä¸çæ°æ®ï¼ç»æå¯¹è±¡ |
| | | ReadExcelOption excelOption = new ReadExcelOption(); |
| | | List<OsRevisionRulePO> poList = ExcelUtil.readDataObjectFromExcel(file, OsRevisionRulePO.class,excelOption,(value, po, fieldName)->{}); |
| | | //å»é¤é½æ¯ç©ºçæ
åµ |
| | | if(CollectionUtils.isEmpty(poList)){ |
| | | return BaseResult.fail(ExcelLangCodeConstant.IMPORT_CONTENT_NULL,new String[]{}); |
| | | } |
| | | //excelå¤éï¼æ°æ®æ ¡éªï¼dto对象转æ¢ï¼åå¨å¯¹è±¡è½¬æ¢ï¼æ§è¡ä¿å |
| | | List<OsRevisionRuleDTO> dtoList = new ArrayList<>(); |
| | | //å½åexcel䏿¯å¦éå¤ç¨çå¤éMap:ï¼keyï¼å¤éçæ¬è§ååï¼valueï¼è¡å·ï¼ |
| | | Map<String, String> excelReapeat = new HashMap<>(); |
| | | //æ°æ®åºæ¥è¯¢æ¯å¦æå·²åå¨çæä¸¾åï¼æ¹ä¾¿åç»åå¤éå¤ç |
| | | List<OsRevisionRuleVO> versionRuleVOList = this.getRevisionRuleByIds(poList.stream().map(OsRevisionRulePO::getId).collect(Collectors.toSet())); |
| | | List<String> repeatVrId = new ArrayList<>(); |
| | | if(Func.isNotEmpty(versionRuleVOList)){ |
| | | repeatVrId = versionRuleVOList.stream().map(OsRevisionRuleVO::getId).collect(Collectors.toList()); |
| | | } |
| | | //夿å¿
填屿§æ¯å¦ä¸ºç©ºåå
¶ä»æ ¡éª |
| | | List<String> finalRepeatVrId = repeatVrId; |
| | | poList.stream().forEach(vrPO -> { |
| | | if(Func.isBlank(vrPO.getId())){//çæ¬è§ååå¤ç©º |
| | | throw new VciBaseException("第ã"+vrPO.getRowIndex()+"ãè¡ï¼versionrulenameerror"); |
| | | }else if(excelReapeat.containsKey(vrPO.getId())){//çæ¬è§ååè¡¨æ ¼ä¸å¤é |
| | | throw new VciBaseException("第ã"+excelReapeat.get(vrPO.getId())+"ãè¡å第ã"+vrPO.getRowIndex()+"ãè¡æ°æ®ï¼åç§°éå¤"); |
| | | }else if (Func.isNotEmpty(finalRepeatVrId) && finalRepeatVrId.contains(vrPO.getId())){//夿åç§°æ¯å¦ä¸ç³»ç»ä¸éå¤ |
| | | throw new VciBaseException("第ã"+vrPO.getRowIndex()+"ãè¡ï¼åç§°å¨ç³»ç»ä¸å·²ç»åå¨,请修æ¹!"); |
| | | } |
| | | |
| | | //çæ¬è§ååexcelä¸å¤éå¤ç |
| | | excelReapeat.put(vrPO.getId(),vrPO.getRowIndex()); |
| | | OsRevisionRuleDTO revisionRuleDTO = new OsRevisionRuleDTO(); |
| | | //revisionRuleDTO.setOid(VciBaseUtil.getPk().toUpperCase(Locale.ROOT)); |
| | | revisionRuleDTO.setId(vrPO.getId()); |
| | | revisionRuleDTO.setName(vrPO.getName()); |
| | | revisionRuleDTO.setJumpCharacter(vrPO.getJumpCharacter()); |
| | | revisionRuleDTO.setInitialValue(vrPO.getInitialValue()); |
| | | revisionRuleDTO.setStepLength(vrPO.getStepLength()); |
| | | revisionRuleDTO.setPrefixion(vrPO.getPrefixion()); |
| | | revisionRuleDTO.setSuffix(vrPO.getSuffix()); |
| | | revisionRuleDTO.setDescription(vrPO.getDescription()); |
| | | try { |
| | | //æ£æ¥çæ¬è§åæ¯å¦åè§ |
| | | checkVersionRule(revisionRuleDTO); |
| | | } catch (PLException e) { |
| | | e.printStackTrace(); |
| | | throw new VciBaseException(VciBaseUtil.getExceptionMessage(e)); |
| | | } |
| | | dtoList.add(revisionRuleDTO); |
| | | }); |
| | | //æ§è¡ä¿åæä½ |
| | | dtoList.stream().forEach(dto->{ |
| | | try { |
| | | boolean b = platformClientUtil.getVersionService().addVersionRule(dto2VersionRule(dto)); |
| | | if(!b){ |
| | | throw new VciBaseException("save and return false"); |
| | | } |
| | | } catch (PLException e) { |
| | | e.printStackTrace(); |
| | | throw new VciBaseException("æ§è¡ä¿åæ¶åºç°é误ï¼éè¯¯çæ¬è§å对象å为ï¼ã" + dto.getId() + "ãï¼åå ï¼"+VciBaseUtil.getExceptionMessage(e)); |
| | | } |
| | | }); |
| | | }catch (Exception e){ |
| | | if(logger.isErrorEnabled()){ |
| | | logger.error("读åexcelå
å®¹æ¶æä¿åç¨æ·ä¿¡æ¯æ¶åºç°äºé误ï¼å
·ä½åå ï¼",VciBaseUtil.getExceptionMessage(e)); |
| | | } |
| | | e.printStackTrace(); |
| | | return BaseResult.fail(VciBaseUtil.getExceptionMessage(e),new String[]{},e); |
| | | } |
| | | return BaseResult.success("æä¸¾å¯¼å
¥æåï¼"); |
| | | } |
| | | |
| | | /** |
| | | * è·åå¯¼åºæå¯¼å
¥æ¨¡æ¿çåå |
| | | * @param flag æ¯å¦è·å导å
¥æ¨¡æ¿åå |
| | | * @return |
| | | */ |
| | | private List<String> getCloumns(boolean flag){ |
| | | if(flag){ |
| | | return new ArrayList<>( |
| | | Arrays.asList( |
| | | "åç§°", "æ ç¾", "è·³è·å符ï¼ä»¥éå·åéï¼", |
| | | "åå§å¼", "æ¥é¿", "åç¼", "åç¼", "æè¿°" |
| | | ) |
| | | ); |
| | | } |
| | | return new ArrayList<>( |
| | | Arrays.asList( |
| | | "åç§°", "æ ç¾", "è·³è·å符", "åå§å¼", "æ¥é¿", |
| | | "åç¼", "åç¼", "æè¿°", "å建æ¶é´" |
| | | ) |
| | | ); |
| | | } |
| | | |
| | | /** |
| | | * æ¸
é¤ç¼å |
| | | */ |
| | | @Override |
| | | public void clearCache() { |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | package com.vci.web.service.impl; |
| | | |
| | | import com.vci.corba.common.PLException; |
| | | import com.vci.corba.omd.atm.AttributeDef; |
| | | import com.vci.corba.omd.stm.StatePool; |
| | | import com.vci.dto.OsAttributeDTO; |
| | | import com.vci.pagemodel.OsEnumVO; |
| | | import com.vci.po.OsAttributePO; |
| | | import com.vci.po.OsStatusPO; |
| | | import com.vci.starter.poi.bo.ReadExcelOption; |
| | | import com.vci.starter.poi.bo.WriteExcelData; |
| | |
| | | public boolean addSave(OsStatusDTO statusDTO) throws Exception { |
| | | VciBaseUtil.alertNotNull( |
| | | statusDTO,"ç¶æçä¿¡æ¯", |
| | | statusDTO.getId(),"ç¶æçè±æåç§°", |
| | | statusDTO.getName(),"ç¶æç䏿åç§°" |
| | | statusDTO.getId(),"ç¶æçè±æåç§°" |
| | | ); |
| | | StatePool dbStatePool = platformClientUtil.getStatePoolService().getStatePool(statusDTO.getId()); |
| | | if (Func.isNotEmpty(dbStatePool) && Func.isNotBlank(dbStatePool.oid)) { |
| | | throw new PLException("500",new String[]{"åç§°éå¤è¯·æ´æ¢åç§°ï¼"}); |
| | | if (statusDTO.getId().length()>50) { |
| | | throw new PLException("500",new String[]{"ç¶æè±æåç§°ä¸è½è¶
è¿50个å符ï¼"}); |
| | | } |
| | | // ç¶ææ± åç§°åªè½ä¸ºè±æåæ¯ |
| | | String regex = "[a-z A-Z]*"; |
| | | if ((!statusDTO.getId().matches(regex))) { |
| | | if (!statusDTO.getId().matches(regex)) { |
| | | throw new PLException("500",new String[]{"åç§°åªè½ä¸ºè±æï¼"}); |
| | | } |
| | | StatePool dbStatePool = platformClientUtil.getStatePoolService().getStatePool(statusDTO.getId()); |
| | | if (Func.isNotEmpty(dbStatePool) && Func.isNotBlank(dbStatePool.oid)) { |
| | | throw new PLException("500",new String[]{"åç§°éå¤è¯·æ´æ¢åç§°ï¼"}); |
| | | } |
| | | //è½ç¶ä¼èªå¨çæoidï¼ä½æ¯è¿å¿è®¾ç½®ä¸»é®ï¼é¿å
æ¾å
¥ç¼åçæ°æ®æ¯æ²¡æoidç |
| | | statusDTO.setOid(VciBaseUtil.getPk().toUpperCase(Locale.ROOT)); |
| | |
| | | for(OsStatusDTO statusDTO : osStatusDTOS){ |
| | | //oidåtså¤ç©º |
| | | String oid = statusDTO.getOid(); |
| | | //name主è¦ç¨æ¥å¯¹ç¼åæ°æ®å é¤ |
| | | String name = statusDTO.getName(); |
| | | //id主è¦ç¨æ¥å¯¹ç¼åæ°æ®å é¤ |
| | | String id = statusDTO.getId(); |
| | | //åå°ä¼ç¨tsè¿è¡æ°æ®ä¸è´æ§æ ¡éª |
| | | Date ts = statusDTO.getTs(); |
| | | if(Func.isBlank(oid) || Func.isBlank(name) || Func.isEmpty(ts)){ |
| | | if(Func.isBlank(oid) || Func.isBlank(id) || Func.isEmpty(ts)){ |
| | | throw new PLException("500",new String[]{"å¾
å é¤çç¶æå表ä¸ä¸»é®ãoidããè°æ´æ¶é´ãtsããç¶æåç§°ãnameãä¸è½ä¸ºç©ºï¼"}); |
| | | } |
| | | StatePool statePool = new StatePool(); |
| | | statePool.oid = oid; |
| | | statePool.name = name; |
| | | statePool.name = id; |
| | | statePool.ts = Func.format(ts,VciDateUtil.DateTimeMillFormat); |
| | | statePoolList.add(statePool); |
| | | boolean res = platformClientUtil.getStatePoolService().deleteStatePool(statePool); |
| | | if(!res){ |
| | | throw new PLException("500",new String[]{"å é¤ç¶æå称为ã" + name + "ãçæ°æ®æ¶åºç°é误!"}); |
| | | } |
| | | } |
| | | boolean res = platformClientUtil.getStatePoolService().deleteStatePools(statePoolList.toArray(new StatePool[statePoolList.size()])); |
| | | //clearCache(); |
| | | self.selectAllStatusMap(); |
| | | return true; |
| | | return res; |
| | | } |
| | | |
| | | /** |
| | |
| | | statePool.oid = statusDTO.getOid(); |
| | | statePool.id = ""; |
| | | statePool.name = statusDTO.getId(); |
| | | statePool.imagePath = statusDTO.getImagePath(); |
| | | //statePool.imagePath = statusDTO.getImagePath(); |
| | | statePool.description = statusDTO.getDescription()==null?"":statusDTO.getDescription(); |
| | | String userId = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); |
| | | long now = VciDateUtil.getNowTime(); |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public String exportStatus(String exportFileName, String statusOids) throws PLException { |
| | | public String exportStatus(String exportFileName, String statusOids,boolean flag/*æ§å¶å¯¼åºçå忝å¦å导å
¥æ¨¡æ¿ä¸è´*/) throws PLException { |
| | | if(Func.isBlank(statusOids)){ |
| | | throw new PLException("500",new String[]{"请å¾éè¦å¯¼åºç屿§!"}); |
| | | } |
| | | //ç颿²¡ä¼ åç§°ï¼ä½¿ç¨é»è®¤å¯¼åºåç§° |
| | | exportFileName = Func.isBlank(exportFileName) ? "ç¶ææ± ç¶æå¯¼åº_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName; |
| | | //设置åå |
| | | List<String> columns = new ArrayList<>(Arrays.asList("åç§°", "æ ç¾", "å¾ç", "æè¿°")); |
| | | List<String> columns = this.getCloumns(flag); |
| | | |
| | | //åexcel |
| | | String excelPath = LocalFileUtil.getDefaultTempFolder() + File.separator + exportFileName + ".xls"; |
| | |
| | | OsStatusVO osStatusVO = this.getObjectByOid(oid); |
| | | excelDataList.add(new WriteExcelData(i.get(),0, osStatusVO.getId())); |
| | | excelDataList.add(new WriteExcelData(i.get(),1, osStatusVO.getName())); |
| | | excelDataList.add(new WriteExcelData(i.get(),2, osStatusVO.getImagePath())); |
| | | //excelDataList.add(new WriteExcelData(i.get(),2, osStatusVO.getImagePath())); |
| | | excelDataList.add(new WriteExcelData(i.get(),3, osStatusVO.getDescription())); |
| | | i.getAndIncrement(); |
| | | }); |
| | |
| | | //ç颿²¡ä¼ åç§°ï¼ä½¿ç¨é»è®¤å¯¼åºåç§° |
| | | exportFileName = Func.isBlank(exportFileName) ? "ç¶ææ± å¯¼å
¥æ¨¡æ¿_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName; |
| | | //设置åå |
| | | List<String> columns = new ArrayList<>( |
| | | Arrays.asList("åç§°(ä¸è½ä¸ºç©º)", "æ ç¾(对åç§°çè§£é)","å¾ç(è·¯å¾)", "æè¿°(å¯ä»¥ä¸ºç©º)") |
| | | ); |
| | | List<String> columns = this.getCloumns(true); |
| | | //设置å¿
å¡«å |
| | | ColumnNameisRed.clear(); |
| | | ColumnNameisRed.add(0); |
| | |
| | | } |
| | | |
| | | /** |
| | | * è·åå¯¼åºæå¯¼å
¥æ¨¡æ¿çåå |
| | | * @param flag æ¯å¦è·å导å
¥æ¨¡æ¿åå |
| | | * @return |
| | | */ |
| | | private List<String> getCloumns(boolean flag){ |
| | | if(flag){ |
| | | return new ArrayList<>( |
| | | Arrays.asList("åç§°(ä¸è½ä¸ºç©º)", "æ ç¾(对åç§°çè§£é)"/*,"å¾ç(è·¯å¾)"*/, "æè¿°(å¯ä»¥ä¸ºç©º)") |
| | | ); |
| | | } |
| | | return new ArrayList<>(Arrays.asList("åç§°", "æ ç¾"/*, "å¾ç"*/, "æè¿°")); |
| | | } |
| | | |
| | | /** |
| | | * 导å
¥ç¶æ |
| | | * @param file |
| | | * @return |
| | |
| | | List<StatePool> statePoolList = new ArrayList<>(); |
| | | //å½åexcel䏿¯å¦éå¤ç¨çå¤éMap:ï¼keyï¼å¤é屿§ï¼valueï¼è¡å·ï¼ |
| | | Map<String, String> excelReapeat = new HashMap<>(); |
| | | //夿å¿
填屿§æ¯å¦ä¸ºç©ºï¼ç¨æ·æ¯å¦å·²åå¨ï¼ä»¥åé¨é¨æ¯å¦å¡«éçæ ¡éªé»è¾ |
| | | poList.stream().forEach(osStatusPO -> { |
| | | try { |
| | | StatePool dbStatePool = platformClientUtil.getStatePoolService().getStatePool(osStatusPO.getId()); |
| | |
| | | } catch (PLException e) { |
| | | e.printStackTrace(); |
| | | logger.error(e.getMessage()); |
| | | throw new VciBaseException(e.getMessage()); |
| | | throw new VciBaseException(VciBaseUtil.getExceptionMessage(e)); |
| | | } |
| | | if(Func.isBlank(osStatusPO.getId())){//屿§åå¤ç©º |
| | | throw new VciBaseException("第ã"+osStatusPO.getRowIndex()+"ãè¡ï¼enumnameerror"); |
| | | if(Func.isBlank(osStatusPO.getId())){//ç¶æåå¤ç©º |
| | | throw new VciBaseException("第ã"+osStatusPO.getRowIndex()+"ãè¡ï¼statusnameerror"); |
| | | }else if(!osStatusPO.getId().matches("[a-z A-Z]*")){ |
| | | // ç¶ææ± åç§°åªè½ä¸ºè±æåæ¯ |
| | | throw new VciBaseException("åç§°åªè½ä¸ºè±æï¼"); |
| | | }else if(excelReapeat.containsKey(osStatusPO.getId())){//屿§åè¡¨æ ¼ä¸å¤é |
| | | }else if(excelReapeat.containsKey(osStatusPO.getId())){//ç¶æåè¡¨æ ¼ä¸å¤é |
| | | throw new VciBaseException("第ã"+excelReapeat.get(osStatusPO.getId())+"ãè¡å第ã"+osStatusPO.getRowIndex()+"ãè¡æ°æ®ï¼åç§°éå¤"); |
| | | } |
| | | //ç¶æåexcelä¸å¤éå¤ç |
| | |
| | | osStatusDTO.setOid(VciBaseUtil.getPk().toUpperCase(Locale.ROOT)); |
| | | osStatusDTO.setId(osStatusPO.getId()); |
| | | osStatusDTO.setName(osStatusPO.getName()); |
| | | osStatusDTO.setImagePath(osStatusPO.getImagePath()); |
| | | //osStatusDTO.setImagePath(osStatusPO.getImagePath()); |
| | | osStatusDTO.setDescription(osStatusPO.getDescription()); |
| | | statePoolList.add(statusDTO2DO(osStatusDTO)); |
| | | |
| | |
| | | e.printStackTrace(); |
| | | return BaseResult.fail(VciBaseUtil.getExceptionMessage(e),new String[]{},e); |
| | | } |
| | | return BaseResult.success("æä¸¾å¯¼å
¥æåï¼"); |
| | | return BaseResult.success("ç¶æå¯¼å
¥æåï¼"); |
| | | } |
| | | |
| | | /** |
| | |
| | | if (ruleVO == null || StringUtils.isBlank(ruleVO.getOid())) { |
| | | throw new VciBaseException("{0}éççæ¬è§å设置å¾ä¸æ£ç¡®ï¼å¨ç³»ç»ä¸æ²¡ææ¾å°{1}è¿ä¸ªçæ¬è§å", new String[]{btmTypeVO.getName(), btmTypeVO.getRevisionRuleId()}); |
| | | } |
| | | cbo.revisionValue = ruleVO.getStartCode(); |
| | | cbo.revisionValue = ruleVO.getInitialValue(); |
| | | } |
| | | if (StringUtils.isBlank(cbo.nameoid)) { |
| | | cbo.nameoid = VciBaseUtil.getPk(); |
| | |
| | | bo.versionRule = String.valueOf(btmTypeVO.getVersionRule()); |
| | | if(StringUtils.isNotBlank(btmTypeVO.getRevisionRuleId())){ |
| | | OsRevisionRuleVO revisionRuleVO = revisionRuleService.getRevisionRuleById(btmTypeVO.getRevisionRuleId()); |
| | | bo.revisionValue = revisionRuleVO.getStartCode(); |
| | | bo.revisionValue = revisionRuleVO.getInitialValue(); |
| | | } |
| | | |
| | | bo.revisionSeq = (short) 1; |