From 5ce77f5db9439fb12dde261363c3cbaf4fdebb1e Mon Sep 17 00:00:00 2001 From: yuxc <653031404@qq.com> Date: 星期二, 11 四月 2023 19:24:16 +0800 Subject: [PATCH] 主题库相关的代码实现功能 --- Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeClstemplateEntity.java | 70 ++ Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeClassifyController.java | 72 ++ Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/com/vci/starter/revision/service/RevisionModelUtil.java | 82 ++ Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeClstemplateMapper.java | 43 + Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/wrapper/PlCodeClstemplateWrapper.java | 50 + Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/com/vci/starter/web/pagemodel/Tree.java | 205 ++++++ Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeCLassifyMapper.xml | 86 ++ Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/feign/IPlCodeClstemplateClient.java | 49 + Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/bo/TreeWrapperOptions.java | 122 +++ Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/dto/CodeClstemplateDTO.java | 34 + Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/vo/CodeClstemplateVO.java | 34 + Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClstemplateService.java | 44 + Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/ICodeClassifyServiceImpl.java | 397 +++++++++++- Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeClstemplateController.java | 130 ++++ Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/vo/pagemodel/TreeQueryObject.java | 137 ++++ Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyService.java | 69 ++ Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeClstemplateMapper.xml | 44 + Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/com/vci/starter/web/util/VciBaseUtil.java | 38 + Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClstemplateServiceImpl.java | 41 + Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/feign/PlCodeClstemplateClient.java | 54 + Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeClassifyMapper.java | 15 21 files changed, 1,770 insertions(+), 46 deletions(-) diff --git a/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/bo/TreeWrapperOptions.java b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/bo/TreeWrapperOptions.java new file mode 100644 index 0000000..3825007 --- /dev/null +++ b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/bo/TreeWrapperOptions.java @@ -0,0 +1,122 @@ +package com.vci.ubcs.code.bo; + + +import com.vci.ubcs.code.vo.pagemodel.TreeQueryObject; + +import java.io.Serializable; + +public class TreeWrapperOptions implements Serializable { + private static final long serialVersionUID = 3183500138266494574L; + private String textFieldName = "name"; + private String textValueSep = " "; + private String parentFieldName; + private String oidFieldName = "oid"; + private String oidValueSep = ","; + private boolean allAttributes = true; + private String parentOid; + private boolean multipleSelect = false; + private boolean showCheckBox = false; + + public TreeWrapperOptions() { + } + + public TreeWrapperOptions(String parentFieldName) { + this.parentFieldName = parentFieldName; + } + + public TreeWrapperOptions(String textFieldName, String parentFieldName) { + this.textFieldName = textFieldName; + this.parentFieldName = parentFieldName; + } + + public TreeWrapperOptions(String textFieldName, String parentFieldName, String parentOid) { + this.textFieldName = textFieldName; + this.parentFieldName = parentFieldName; + this.parentOid = parentOid; + } + + public void copyFromTreeQuery(TreeQueryObject treeQueryObject) { + if (treeQueryObject != null) { + this.parentOid = treeQueryObject.getParentOid(); + this.multipleSelect = treeQueryObject.isMultipleSelect(); + this.showCheckBox = treeQueryObject.isShowCheckBox(); + } + + } + + public String getTextFieldName() { + return this.textFieldName; + } + + public void setTextFieldName(String textFieldName) { + this.textFieldName = textFieldName; + } + + public String getParentFieldName() { + return this.parentFieldName; + } + + public void setParentFieldName(String parentFieldName) { + this.parentFieldName = parentFieldName; + } + + public String getOidFieldName() { + return this.oidFieldName; + } + + public void setOidFieldName(String oidFieldName) { + this.oidFieldName = oidFieldName; + } + + public boolean isAllAttributes() { + return this.allAttributes; + } + + public void setAllAttributes(boolean allAttributes) { + this.allAttributes = allAttributes; + } + + public String getParentOid() { + return this.parentOid; + } + + public void setParentOid(String parentOid) { + this.parentOid = parentOid; + } + + public boolean isMultipleSelect() { + return this.multipleSelect; + } + + public void setMultipleSelect(boolean multipleSelect) { + this.multipleSelect = multipleSelect; + } + + public boolean isShowCheckBox() { + return this.showCheckBox; + } + + public void setShowCheckBox(boolean showCheckBox) { + this.showCheckBox = showCheckBox; + } + + public String getTextValueSep() { + return this.textValueSep; + } + + public void setTextValueSep(String textValueSep) { + this.textValueSep = textValueSep; + } + + public String getOidValueSep() { + return this.oidValueSep; + } + + public void setOidValueSep(String oidValueSep) { + this.oidValueSep = oidValueSep; + } + + public String toString() { + return "TreeWrapperOptions{textFieldName='" + this.textFieldName + '\'' + ", textValueSep='" + this.textValueSep + '\'' + ", parentFieldName='" + this.parentFieldName + '\'' + ", oidFieldName='" + this.oidFieldName + '\'' + ", oidValueSep='" + this.oidValueSep + '\'' + ", allAttributes=" + this.allAttributes + ", parentOid='" + this.parentOid + '\'' + ", multipleSelect=" + this.multipleSelect + ", showCheckBox=" + this.showCheckBox + '}'; + } +} diff --git a/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/dto/CodeClstemplateDTO.java b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/dto/CodeClstemplateDTO.java new file mode 100644 index 0000000..a8d5eac --- /dev/null +++ b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/dto/CodeClstemplateDTO.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 搴勯獮 (smallchill@163.com) + */ +package com.vci.ubcs.code.dto; + +import com.vci.ubcs.code.entity.CodeClstemplateEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 缂栫爜搴撳畾涔�-妯℃澘绠$悊 鏁版嵁浼犺緭瀵硅薄瀹炰綋绫� + * + * @author yuxc + * @since 2023-04-10 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class CodeClstemplateDTO extends CodeClstemplateEntity { + private static final long serialVersionUID = 1L; + +} diff --git a/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeClstemplateEntity.java b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeClstemplateEntity.java new file mode 100644 index 0000000..6c9baf5 --- /dev/null +++ b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeClstemplateEntity.java @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 搴勯獮 (smallchill@163.com) + */ +package com.vci.ubcs.code.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.vci.ubcs.com.vci.starter.annotation.Transient; +import lombok.Data; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.EqualsAndHashCode; + +/** + * 缂栫爜搴撳畾涔�-妯℃澘绠$悊 瀹炰綋绫� + * + * @author yuxc + * @since 2023-04-10 + */ +@Data +@TableName("PL_CODE_CLSTEMPLATE") +@ApiModel(value = "PlCodeClstemplate瀵硅薄", description = "缂栫爜搴撳畾涔�-妯℃澘绠$悊") +@EqualsAndHashCode(callSuper = true) +public class CodeClstemplateEntity extends BaseModel { + + + /** + * 涓婚搴撳垎绫讳富閿� + */ + @ApiModelProperty(value = "涓婚搴撳垎绫讳富閿�") + private String codeClassifyOid; + /** + * 涓氬姟绫诲瀷鐨勭紪鍙� + */ + @ApiModelProperty(value = "涓氬姟绫诲瀷鐨勭紪鍙�") + private String btmTypeId; + /** + * 涓氬姟绫诲瀷鐨勫悕绉� + */ + @ApiModelProperty(value = "涓氬姟绫诲瀷鐨勫悕绉�") + private String btmTypeName; + + /** + * 涓婚搴撳垎绫讳富閿樉绀烘枃鏈� + */ + @Transient(referColumn = "codeClassifyOid.name") + private String codeClassifyOidName; + + @Override + public String toString() { + return "CodeClassifyTemplateDO{" + + "codeClassifyOid='" + codeClassifyOid + '\'' + + ", codeClassifyOidName='" + codeClassifyOidName + '\'' + + ", btmTypeId='" + btmTypeId + '\'' + + ", btmTypeName='" + btmTypeName + '\'' + + "} " + super.toString(); + } +} diff --git a/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/vo/CodeClstemplateVO.java b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/vo/CodeClstemplateVO.java new file mode 100644 index 0000000..6925f38 --- /dev/null +++ b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/vo/CodeClstemplateVO.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 搴勯獮 (smallchill@163.com) + */ +package com.vci.ubcs.code.vo; + +import com.vci.ubcs.code.entity.CodeClstemplateEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 缂栫爜搴撳畾涔�-妯℃澘绠$悊 瑙嗗浘瀹炰綋绫� + * + * @author yuxc + * @since 2023-04-10 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class CodeClstemplateVO extends CodeClstemplateEntity { + private static final long serialVersionUID = 1L; + +} diff --git a/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/vo/pagemodel/TreeQueryObject.java b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/vo/pagemodel/TreeQueryObject.java new file mode 100644 index 0000000..7213221 --- /dev/null +++ b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/vo/pagemodel/TreeQueryObject.java @@ -0,0 +1,137 @@ +package com.vci.ubcs.code.vo.pagemodel; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +import java.io.Serializable; +import java.util.Map; + +public class TreeQueryObject implements Serializable { + private static final long serialVersionUID = -7570704940199743059L; + private Map<String, String> conditionMap; + private boolean multipleSelect; + private boolean showCheckBox; + private boolean queryAllLevel; + private String parentOid; + private String parentBtmName; + private String valueField = "oid"; + private String textField = "name"; + private String parentFieldName; + private Map<String, String> extandParamsMap; + private boolean queryAllRev; + private String sort; + private String order; + + public TreeQueryObject() { + } + + public String getValueField() { + return this.valueField; + } + + public void setValueField(String valueField) { + this.valueField = valueField; + } + + public String getTextField() { + return this.textField; + } + + public void setTextField(String textField) { + this.textField = textField; + } + + public String getParentFieldName() { + return this.parentFieldName; + } + + public void setParentFieldName(String parentFieldName) { + this.parentFieldName = parentFieldName; + } + + public Map<String, String> getConditionMap() { + return this.conditionMap; + } + + public void setConditionMap(Map<String, String> conditionMap) { + this.conditionMap = conditionMap; + } + + public boolean isMultipleSelect() { + return this.multipleSelect; + } + + public void setMultipleSelect(boolean multipleSelect) { + this.multipleSelect = multipleSelect; + } + + public boolean isShowCheckBox() { + return this.showCheckBox; + } + + public void setShowCheckBox(boolean showCheckBox) { + this.showCheckBox = showCheckBox; + } + + public String getParentOid() { + return this.parentOid; + } + + public void setParentOid(String parentOid) { + this.parentOid = parentOid; + } + + public String getParentBtmName() { + return this.parentBtmName; + } + + public void setParentBtmName(String parentBtmName) { + this.parentBtmName = parentBtmName; + } + + public Map<String, String> getExtandParamsMap() { + return this.extandParamsMap; + } + + public void setExtandParamsMap(Map<String, String> extandParamsMap) { + this.extandParamsMap = extandParamsMap; + } + + public boolean isQueryAllLevel() { + return this.queryAllLevel; + } + + public void setQueryAllLevel(boolean queryAllLevel) { + this.queryAllLevel = queryAllLevel; + } + + public boolean isQueryAllRev() { + return this.queryAllRev; + } + + public void setQueryAllRev(boolean queryAllRev) { + this.queryAllRev = queryAllRev; + } + + public String getSort() { + return this.sort; + } + + public void setSort(String sort) { + this.sort = sort; + } + + public String getOrder() { + return this.order; + } + + public void setOrder(String order) { + this.order = order; + } + + public String toString() { + return "TreeQueryObject{conditionMap=" + this.conditionMap + ", multipleSelect=" + this.multipleSelect + ", showCheckBox=" + this.showCheckBox + ", queryAllLevel=" + this.queryAllLevel + ", parentOid='" + this.parentOid + '\'' + ", parentBtmName='" + this.parentBtmName + '\'' + ", valueField='" + this.valueField + '\'' + ", textField='" + this.textField + '\'' + ", parentFieldName='" + this.parentFieldName + '\'' + ", extandParamsMap=" + this.extandParamsMap + ", queryAllRev=" + this.queryAllRev + ", sort='" + this.sort + '\'' + ", order='" + this.order + '\'' + '}'; + } +} diff --git a/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/com/vci/starter/revision/service/RevisionModelUtil.java b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/com/vci/starter/revision/service/RevisionModelUtil.java index 42d044a..c724777 100644 --- a/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/com/vci/starter/revision/service/RevisionModelUtil.java +++ b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/com/vci/starter/revision/service/RevisionModelUtil.java @@ -7,15 +7,28 @@ //package com.vci.starter.revision.service; +import com.vci.ubcs.code.bo.TreeWrapperOptions; import com.vci.ubcs.code.entity.BaseModel; import com.vci.ubcs.com.vci.starter.util.VciBaseUtil; +import com.vci.ubcs.com.vci.starter.web.pagemodel.Tree; import com.vci.ubcs.com.vci.starter.web.service.VciSecretServiceI; import com.vci.ubcs.com.vci.starter.web.util.BeanUtilForVCI; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springblade.core.tool.utils.StringUtil; import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; @Component public class RevisionModelUtil implements VciSecretServiceI { - + private Logger logger = LoggerFactory.getLogger(this.getClass()); public void copyFromDTOIgnore(Object dto, BaseModel baseModel) { VciBaseUtil.alertNotNull(new Object[]{dto, "鏁版嵁浼犺緭瀵硅薄", baseModel, "鏁版嵁搴撲腑鐨勬暟鎹璞�"}); BaseModel tempModel = new BaseModel(); @@ -27,5 +40,72 @@ baseModel.setDescription(VciBaseUtil.getStringValueFromObject(VciBaseUtil.getValueFromField("description", dto))); tempModel = null; } + public <T, R> List<Tree> doList2Trees(List<T> doList, TreeWrapperOptions wrapperOptions, Function<T, R> f) { + if (CollectionUtils.isEmpty(doList)) { + return new ArrayList(); + } else { + List<Tree> allTree = new ArrayList(); + List<Tree> children = new ArrayList(); + Iterator var6 = doList.iterator(); + + while(true) { + while(var6.hasNext()) { + T doObject = (T) var6.next(); + Tree tree = new Tree(); + List<String> oidFieldNames = VciBaseUtil.str2List(wrapperOptions.getOidFieldName()); + List<String> oidValues = new LinkedList(); + oidFieldNames.stream().forEach((s) -> { + oidValues.add(VciBaseUtil.getStringValueFromObject(VciBaseUtil.getValueFromField(s, doObject))); + }); + tree.setOid((String)oidValues.stream().collect(Collectors.joining(wrapperOptions.getOidValueSep()))); + if (f != null) { + tree.setText((String)f.apply(doObject)); + } else { + List<String> textFieldNames = VciBaseUtil.str2List(wrapperOptions.getTextFieldName()); + List<String> textValues = new LinkedList(); + textFieldNames.stream().forEach((s) -> { + textValues.add(VciBaseUtil.getStringValueFromObject(VciBaseUtil.getValueFromField(s, doObject))); + }); + tree.setText((String)textValues.stream().collect(Collectors.joining(wrapperOptions.getTextValueSep()))); + } + + if (StringUtil.isNotBlank(wrapperOptions.getParentFieldName())) { + tree.setParentId(VciBaseUtil.getStringValueFromObject(VciBaseUtil.getValueFromField(wrapperOptions.getParentFieldName(), doObject))); + } + + if (wrapperOptions.isAllAttributes()) { + try { + tree.setAttributes(VciBaseUtil.objectToMapString(doObject)); + } catch (Exception var13) { + if (this.logger.isErrorEnabled()) { + this.logger.error("鎶婂璞¤浆鎹负map鏃跺嚭鐜颁簡閿欒锛屼絾鏄笉褰卞搷鏍戠殑灞曠ず锛屽涓氬姟鍙兘鏈夊奖鍝�"); + } + } + } + + if (wrapperOptions.isMultipleSelect() || wrapperOptions.isShowCheckBox()) { + tree.setShowCheckbox(true); + } + + if (wrapperOptions.getParentOid() == null) { + wrapperOptions.setParentOid(""); + } + + if (!StringUtil.isBlank(tree.getParentId()) && (!StringUtil.isNotBlank(wrapperOptions.getParentOid()) || !wrapperOptions.getParentOid().equalsIgnoreCase(tree.getParentId()))) { + children.add(tree); + } else { + allTree.add(tree); + } + } + + (new Tree()).findChild(allTree, children); + if (allTree.size() <= 0) { + allTree.addAll(children); + } + + return allTree; + } + } + } } diff --git a/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/com/vci/starter/web/pagemodel/Tree.java b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/com/vci/starter/web/pagemodel/Tree.java new file mode 100644 index 0000000..8214102 --- /dev/null +++ b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/com/vci/starter/web/pagemodel/Tree.java @@ -0,0 +1,205 @@ +package com.vci.ubcs.com.vci.starter.web.pagemodel; + + +import org.springblade.core.tool.utils.StringUtil; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +public class Tree implements Serializable { + private static final long serialVersionUID = 6886695271635257882L; + private String oid; + private String text; + private boolean leaf = false; + private boolean showCheckbox = false; + private boolean checked = false; + private List<Tree> children = new ArrayList(); + private String icon; + private String iconCls; + private String parentId; + private String parentName; + private String parentBtmName; + private boolean expanded = false; + private String href; + private String index; + private Map<String, String> attributes = new HashMap(); + + public Tree() { + } + + public Tree(String oid, String text) { + this.setOid(oid); + this.setText(text); + } + + public String getOid() { + return this.oid; + } + + public void setOid(String oid) { + this.oid = oid; + } + + public String getText() { + return this.text; + } + + public void setText(String text) { + this.text = text; + } + + public boolean isLeaf() { + return this.leaf; + } + + public void setLeaf(boolean leaf) { + this.leaf = leaf; + } + + public boolean isShowCheckbox() { + return this.showCheckbox; + } + + public void setShowCheckbox(boolean showCheckbox) { + this.showCheckbox = showCheckbox; + } + + public boolean isChecked() { + return this.checked; + } + + public void setChecked(boolean checked) { + this.checked = checked; + } + + public List<Tree> getChildren() { + return this.children; + } + + public void setChildren(List<Tree> children) { + this.children = children; + } + + public String getIcon() { + return this.icon; + } + + public void setIcon(String icon) { + this.icon = icon; + } + + public String getIconCls() { + return this.iconCls; + } + + public void setIconCls(String iconCls) { + this.iconCls = iconCls; + } + + public String getParentId() { + return this.parentId; + } + + public void setParentId(String parentId) { + this.parentId = parentId; + } + + public boolean isExpanded() { + return this.expanded; + } + + public void setExpanded(boolean expanded) { + this.expanded = expanded; + } + + public String getHref() { + return this.href; + } + + public void setHref(String href) { + this.href = href; + } + + public String getIndex() { + return this.index; + } + + public void setIndex(String index) { + this.index = index; + } + + public Map<String, String> getAttributes() { + return this.attributes; + } + + public void setAttributes(Map<String, String> attributes) { + this.attributes = attributes; + } + + public String getParentName() { + return this.parentName; + } + + public void setParentName(String parentName) { + this.parentName = parentName; + } + + public String getParentBtmName() { + return this.parentBtmName; + } + + public void setParentBtmName(String parentBtmName) { + this.parentBtmName = parentBtmName; + } + + public static List<Tree> getChildList(List<Tree> rootTree, List<Tree> children) { + if (rootTree == null || rootTree.size() == 0) { + if (children == null || children.size() <= 0) { + return null; + } + + rootTree = children.subList(0, children.size()); + } + + Tree bt = new Tree(); + bt.findChild(rootTree, children); + return rootTree; + } + + public void findChild(List<Tree> treenode, List<Tree> children) { + Tree node; + for(Iterator var3 = treenode.iterator(); var3.hasNext(); this.getChildren().add(node)) { + node = (Tree)var3.next(); + Iterator var5 = children.iterator(); + + while(var5.hasNext()) { + Tree childnode = (Tree)var5.next(); + if (node.getOid().equalsIgnoreCase(childnode.getParentId())) { + childnode.setParentName(node.getText()); + if (StringUtil.isBlank(childnode.getParentBtmName())) { + childnode.setParentBtmName((String)node.getAttributes().getOrDefault("btmname", "")); + } + + node.getChildren().add(childnode); + } + } + + if (node.getChildren().size() > 0) { + this.findChild(node.getChildren(), children); + node.setLeaf(false); + } else { + node.setLeaf(true); + } + } + + } + + public String toString() { + return "Tree{oid='" + this.oid + '\'' + ", text='" + this.text + '\'' + ", leaf=" + this.leaf + ", showCheckbox=" + this.showCheckbox + ", checked=" + this.checked + ", children=" + this.children + ", icon='" + this.icon + '\'' + ", iconCls='" + this.iconCls + '\'' + ", parentId='" + this.parentId + '\'' + ", parentName='" + this.parentName + '\'' + ", parentBtmName='" + this.parentBtmName + '\'' + ", expanded=" + this.expanded + ", href='" + this.href + '\'' + ", index='" + this.index + '\'' + ", attributes=" + this.attributes + '}'; + } +} + diff --git a/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/com/vci/starter/web/util/VciBaseUtil.java b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/com/vci/starter/web/util/VciBaseUtil.java index 379bfc5..792d1cd 100644 --- a/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/com/vci/starter/web/util/VciBaseUtil.java +++ b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/com/vci/starter/web/util/VciBaseUtil.java @@ -1094,5 +1094,43 @@ } } + public static <T> Collection<Collection<T>> switchCollectionForOracleIn(Collection<T> list) { + return switchCollectionForOracleIn(list, 500); + } + + public static <T> Collection<Collection<T>> switchCollectionForOracleIn(Collection<T> collection, int preSize) { + Collection<Collection<T>> listHasList = new ArrayList(); + if (collection == null) { + return listHasList; + } else { + List<T> newList = new ArrayList(); + Iterator var4 = collection.iterator(); + + while(var4.hasNext()) { + Object obj = var4.next(); + newList.add((T) obj); + } + + int muti = 1; + int i; + if (newList.size() > preSize) { + i = newList.size() % preSize; + muti = (newList.size() - i) / preSize + (i == 0 ? 0 : 1); + } + + for(i = 0; i < muti; ++i) { + int start = i * preSize; + int end = start + preSize; + if (i == muti - 1 || end > newList.size()) { + end = newList.size(); + } + + List subList = newList.subList(start, end); + listHasList.add(subList); + } + + return listHasList; + } + } } diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeClassifyController.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeClassifyController.java index 4c33373..add68b8 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeClassifyController.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeClassifyController.java @@ -21,16 +21,22 @@ import com.vci.ubcs.code.entity.CodeClassify; import com.vci.ubcs.code.mapper.CodeClassifyMapper; import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO; +import com.vci.ubcs.code.vo.pagemodel.TreeQueryObject; +import com.vci.ubcs.com.vci.starter.web.pagemodel.Tree; +import com.vci.ubcs.com.vci.starter.web.util.VciBaseUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import lombok.AllArgsConstructor; + +import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.secure.utils.AuthUtil; +import org.springblade.core.tool.api.IResultCode; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; import org.springframework.web.bind.annotation.*; @@ -38,7 +44,14 @@ import com.vci.ubcs.code.service.ICodeClassifyService; import org.springblade.core.boot.ctrl.BladeController; +import java.io.File; +import java.io.IOException; +import java.util.Collection; import java.util.Date; +import java.util.List; + +import static com.vci.ubcs.code.constant.FrameWorkDefaultValueConstant.FRAMEWORK_DATA_DISABLED; +import static com.vci.ubcs.code.constant.FrameWorkDefaultValueConstant.FRAMEWORK_DATA_ENABLED; /** * 涓婚搴撳畾涔夎〃 鎺у埗鍣� @@ -155,4 +168,63 @@ public R delCodeClassify(CodeClassify codeClassify) { return codeClassifyService.deleteCodeClassify(codeClassify); } + + /** + * 鍚敤 + * @param codeClassify + * @return + */ + @PostMapping( "/enableData") + public R enable(CodeClassify codeClassify) { + return codeClassifyService.updateLcStatus(codeClassify.getOid(),FRAMEWORK_DATA_ENABLED); + } + + /** + * 鍋滅敤 + * @param codeClassify + * @return + */ + @PostMapping( "/disableData") + public R disable(CodeClassify codeClassify) { + return codeClassifyService.updateLcStatus(codeClassify.getOid(),FRAMEWORK_DATA_DISABLED); + } + + /** + * 涓婚敭鎵归噺鑾峰彇涓婚搴撳垎绫� + * @param oids 涓婚敭锛屽涓互閫楀彿鍒嗛殧锛屼絾鏄彈鎬ц兘褰卞搷锛屽缓璁竴娆℃煡璇笉瓒呰繃10000涓� + * @return 涓婚搴撳垎绫绘樉绀哄璞� + */ + @GetMapping("/listDataByOids") + public R listCodeClassifyByOids(String oids){ + Collection<CodeClassifyVO> voCollection = codeClassifyService.listCodeClassifyByOids(VciBaseUtil.str2List(oids)); + return R.data(voCollection); + } + + /** + * 鍙傜収鏍� 涓婚搴撳垎绫� + * @param treeQueryObject 鏍戝舰鏌ヨ瀵硅薄 + * @return 涓婚搴撳垎绫绘樉绀烘爲 + */ + @GetMapping("/referTree") + public List<Tree> referTree(TreeQueryObject treeQueryObject) { + return codeClassifyService.referTree(treeQueryObject); + } + + /** + * 瀵煎嚭鍒嗙被 + * @param oid 鍒嗙被涓婚敭 + */ + @GetMapping("/exportClassify") + public void exportClassify(String oid, HttpServletResponse response) throws IOException { + String excelName = codeClassifyService.exportClassify(oid); +// try { +// ControllerUtil.writeFileToResponse(response,excelName); +// } catch (Throwable e) { +// //濡傛灉鍑洪敊,鎶婇敊璇俊鎭啓鍒皌ext +// String msg = LangBaseUtil.getErrorMsg(e); +// String errorFile = LocalFileUtil.getDefaultTempFolder() + File.separator + "閿欒.txt"; +// LocalFileUtil.writeContentToFile(msg,errorFile); +// ControllerUtil.writeFileToResponse(response,errorFile); +// } + } } diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeClstemplateController.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeClstemplateController.java new file mode 100644 index 0000000..bf64641 --- /dev/null +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeClstemplateController.java @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 搴勯獮 (smallchill@163.com) + */ +package com.vci.ubcs.code.controller; + +import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; +import com.vci.ubcs.code.mapper.CodeButtonMapper; +import com.vci.ubcs.code.mapper.CodeClstemplateMapper; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import lombok.AllArgsConstructor; +import javax.validation.Valid; + +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.Func; +import org.springframework.web.bind.annotation.*; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.vci.ubcs.code.entity.CodeClstemplateEntity; +import com.vci.ubcs.code.vo.CodeClstemplateVO; +import com.vci.ubcs.code.wrapper.PlCodeClstemplateWrapper; +import com.vci.ubcs.code.service.ICodeClstemplateService; +import org.springblade.core.boot.ctrl.BladeController; + +/** + * 缂栫爜搴撳畾涔�-妯℃澘绠$悊 鎺у埗鍣� + * + * @author yuxc + * @since 2023-04-10 + */ +@RestController +@AllArgsConstructor +@RequestMapping("/plCodeClstemplate") +@Api(value = "缂栫爜搴撳畾涔�-妯℃澘绠$悊", tags = "缂栫爜搴撳畾涔�-妯℃澘绠$悊鎺ュ彛") +public class CodeClstemplateController extends BladeController { + + private final ICodeClstemplateService plCodeClstemplateService; + + CodeClstemplateMapper codeClstemplateMapper; + + /** + * 缂栫爜搴撳畾涔�-妯℃澘绠$悊 璇︽儏 + */ + @GetMapping("/detail") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "璇︽儏", notes = "浼犲叆plCodeClstemplate") + public R<CodeClstemplateVO> detail(CodeClstemplateEntity plCodeClstemplate) { + CodeClstemplateEntity detail = plCodeClstemplateService.getOne(Condition.getQueryWrapper(plCodeClstemplate)); + return R.data(PlCodeClstemplateWrapper.build().entityVO(detail)); + } + /** + * 缂栫爜搴撳畾涔�-妯℃澘绠$悊 鍒嗛〉 + */ + @GetMapping("/list") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "鍒嗛〉", notes = "浼犲叆plCodeClstemplate") + public R<IPage<CodeClstemplateVO>> list(CodeClstemplateEntity plCodeClstemplate, Query query) { + IPage<CodeClstemplateEntity> pages = plCodeClstemplateService.page(Condition.getPage(query), Condition.getQueryWrapper(plCodeClstemplate)); + return R.data(PlCodeClstemplateWrapper.build().pageVO(pages)); + } + + /** + * 缂栫爜搴撳畾涔�-妯℃澘绠$悊 鑷畾涔夊垎椤� + */ + @GetMapping("/page") + @ApiOperationSupport(order = 3) + @ApiOperation(value = "鍒嗛〉", notes = "浼犲叆plCodeClstemplate") + public R<IPage<CodeClstemplateVO>> page(CodeClstemplateVO plCodeClstemplate, Query query) { + IPage<CodeClstemplateVO> pages = plCodeClstemplateService.selectPlCodeClstemplatePage(Condition.getPage(query), plCodeClstemplate); + return R.data(pages); + } + + /** + * 缂栫爜搴撳畾涔�-妯℃澘绠$悊 鏂板 + */ + @PostMapping("/save") + @ApiOperationSupport(order = 4) + @ApiOperation(value = "鏂板", notes = "浼犲叆plCodeClstemplate") + public R save(@Valid @RequestBody CodeClstemplateEntity plCodeClstemplate) { + return R.status(plCodeClstemplateService.save(plCodeClstemplate)); + } + + /** + * 缂栫爜搴撳畾涔�-妯℃澘绠$悊 淇敼 + */ + @PostMapping("/update") + @ApiOperationSupport(order = 5) + @ApiOperation(value = "淇敼", notes = "浼犲叆plCodeClstemplate") + public R update(@Valid @RequestBody CodeClstemplateEntity plCodeClstemplate) { + return R.status(plCodeClstemplateService.updateById(plCodeClstemplate)); + } + + /** + * 缂栫爜搴撳畾涔�-妯℃澘绠$悊 鏂板鎴栦慨鏀� + */ + @PostMapping("/submit") + @ApiOperationSupport(order = 6) + @ApiOperation(value = "鏂板鎴栦慨鏀�", notes = "浼犲叆plCodeClstemplate") + public R submit(@Valid @RequestBody CodeClstemplateEntity plCodeClstemplate) { + return R.status(plCodeClstemplateService.saveOrUpdate(plCodeClstemplate)); + } + + /** + * 缂栫爜搴撳畾涔�-妯℃澘绠$悊 鍒犻櫎 + */ + @PostMapping("/remove") + @ApiOperationSupport(order = 7) + @ApiOperation(value = "閫昏緫鍒犻櫎", notes = "浼犲叆ids") + public R remove(@ApiParam(value = "涓婚敭闆嗗悎", required = true) @RequestParam String ids) { + return R.status(SqlHelper.retBool(codeClstemplateMapper.deleteBatchIds(Func.toLongList(ids)))); + } + + +} diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/feign/IPlCodeClstemplateClient.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/feign/IPlCodeClstemplateClient.java new file mode 100644 index 0000000..3e86d69 --- /dev/null +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/feign/IPlCodeClstemplateClient.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 搴勯獮 (smallchill@163.com) + */ +package com.vci.ubcs.code.feign; + +import org.springblade.core.mp.support.BladePage; +import com.vci.ubcs.code.entity.CodeClstemplateEntity; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; + +/** + * 缂栫爜搴撳畾涔�-妯℃澘绠$悊 Feign鎺ュ彛绫� + * + * @author yuxc + * @since 2023-04-10 + */ +@FeignClient( + value = "blade-plCodeClstemplate" +) +public interface IPlCodeClstemplateClient { + + String API_PREFIX = "/client"; + String TOP = API_PREFIX + "/top"; + + /** + * 鑾峰彇缂栫爜搴撳畾涔�-妯℃澘绠$悊鍒楄〃 + * + * @param current 椤靛彿 + * @param size 椤垫暟 + * @return BladePage + */ + @GetMapping(TOP) + BladePage<CodeClstemplateEntity> top(@RequestParam("current") Integer current, @RequestParam("size") Integer size); + +} diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/feign/PlCodeClstemplateClient.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/feign/PlCodeClstemplateClient.java new file mode 100644 index 0000000..41b77e6 --- /dev/null +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/feign/PlCodeClstemplateClient.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 搴勯獮 (smallchill@163.com) + */ +package com.vci.ubcs.code.feign; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import lombok.AllArgsConstructor; +import org.springblade.core.mp.support.BladePage; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; +import com.vci.ubcs.code.entity.CodeClstemplateEntity; +import com.vci.ubcs.code.service.ICodeClstemplateService; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; +import springfox.documentation.annotations.ApiIgnore; + +/** + * 缂栫爜搴撳畾涔�-妯℃澘绠$悊 Feign瀹炵幇绫� + * + * @author yuxc + * @since 2023-04-10 + */ +@ApiIgnore() +@RestController +@AllArgsConstructor +public class PlCodeClstemplateClient implements IPlCodeClstemplateClient { + + private final ICodeClstemplateService plCodeClstemplateService; + + @Override + @GetMapping(TOP) + public BladePage<CodeClstemplateEntity> top(Integer current, Integer size) { + Query query = new Query(); + query.setCurrent(current); + query.setSize(size); +// IPage<CodeClstemplateEntity> page = service.page(Condition.getPage(query)); +// return BladePage.of(page); + return null; + } + +} diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeClassifyMapper.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeClassifyMapper.java index bc595c2..e6bf833 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeClassifyMapper.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeClassifyMapper.java @@ -60,5 +60,20 @@ // @MapKey("oid") Boolean checkHasChild(String oid); + /** + * 鏌ユ壘鏍戝舰缁撴瀯 + * + * @param oid 鍒嗙被鐨勪富閿� + * @return 鏁版嵁闆嗗悎 + */ + List<CodeClassify> selectCodeClassifyVOByTree(String oid); + + /** + * 鏌ユ壘鏍戝舰缁撴瀯 + * + * @param oid 鍒嗙被鐨勪富閿� + * @return 鏁版嵁闆嗗悎 + */ + List<CodeClassify> selectAllLevelChildHasPath(String oid); } diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeClstemplateMapper.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeClstemplateMapper.java new file mode 100644 index 0000000..f144c53 --- /dev/null +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeClstemplateMapper.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 搴勯獮 (smallchill@163.com) + */ +package com.vci.ubcs.code.mapper; + +import com.vci.ubcs.code.entity.CodeClstemplateEntity; +import com.vci.ubcs.code.vo.CodeClstemplateVO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import java.util.List; + +/** + * 缂栫爜搴撳畾涔�-妯℃澘绠$悊 Mapper 鎺ュ彛 + * + * @author yuxc + * @since 2023-04-10 + */ +public interface CodeClstemplateMapper extends BaseMapper<CodeClstemplateEntity> { + + /** + * 鑷畾涔夊垎椤� + * + * @param page + * @param plCodeClstemplate + * @return + */ + List<CodeClstemplateVO> selectPlCodeClstemplatePage(IPage page, CodeClstemplateVO plCodeClstemplate); + + +} diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyService.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyService.java index b93788d..3c41c4c 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyService.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyService.java @@ -5,8 +5,11 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.vci.ubcs.code.entity.CodeClassify; import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO; +import com.vci.ubcs.code.vo.pagemodel.TreeQueryObject; +import com.vci.ubcs.com.vci.starter.web.pagemodel.Tree; import org.springblade.core.tool.api.R; +import java.util.Collection; import java.util.List; /** @@ -76,4 +79,70 @@ */ R deleteCodeClassify(CodeClassify codeClassify) ; + /** + * 鍚敤銆佸仠鐢� + * @param oid 涓婚敭 + * @param lcStatus 鐘舵�� + * @return 鎵ц缁撴灉 + */ + R updateLcStatus(String oid, String lcStatus); + + /** + * 鏍规嵁涓婚敭鎵归噺鏌ヨ瀵硅薄 + * @param oids 瀵硅薄涓婚敭,浣跨敤閫楀彿鍒嗛殧锛屼絾鏄笉鑳借秴杩�1000 + * @return 涓氬姟瀵硅薄 + */ +// List<CodeClassify> selectByPrimaryKeyCollection(Collection<String> oids); + + /** + * 涓婚敭鎵归噺鑾峰彇涓婚搴撳垎绫� + * @param oidCollections 涓婚敭闆嗗悎锛屼絾鏄彈鎬ц兘褰卞搷锛屽缓璁竴娆℃煡璇笉瓒呰繃10000涓� + * @return 涓婚搴撳垎绫绘樉绀哄璞� + */ + Collection<CodeClassifyVO> listCodeClassifyByOids(Collection<String> oidCollections) ; + + /** + * 鎵归噺鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞� + * @param codeClassifys 鏁版嵁瀵硅薄鍒楄〃 + * @return 鏄剧ず瀵硅薄 + */ + List<CodeClassifyVO> codeClassifyDO2VOs(Collection<CodeClassify> codeClassifys); + + /** + * 鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞� + * @param codeClassify 鏁版嵁瀵硅薄 + * @return 鏄剧ず瀵硅薄 + */ + CodeClassifyVO codeClassifyDO2VO(CodeClassify codeClassify); + + /** + * 鍙傜収鏍� 涓婚搴撳垎绫� + * @param treeQueryObject 鏍戝舰鏌ヨ瀵硅薄 + * @return 涓婚搴撳垎绫绘樉绀烘爲 + */ + List<Tree> referTree(TreeQueryObject treeQueryObject); + /** + * 鏌ヨ涓婚搴撳垎绫� 鏍� + * @param treeQueryObject 鏍戞煡璇㈠璞� + * @return 涓婚搴撳垎绫� 鏄剧ず鏍� + */ + List<Tree> treeCodeClassify(TreeQueryObject treeQueryObject); + + /** + * 瀵煎嚭鍒嗙被 + * @param oid 鍒嗙被涓婚敭 + * @return excel鏂囦欢璺緞 + */ + String exportClassify(String oid); + + /** + * 鑾峰彇瀛愮骇鐨勪富棰樺簱鍒嗙被 + * + * @param codeClassifyOid 鍒嗙被鐨勪富閿� + * @param allLevel 鏄惁鎵�鏈夌殑灞傜骇 + * @param fieldInPath 鍦ㄨ矾寰勪腑鐨勫瓧娈� + * @param enable 鏄惁鍙樉绀哄惎鐢� + * @return 鍒嗙被鐨勬樉绀哄璞� + */ + List<CodeClassifyVO> listChildrenClassify(String codeClassifyOid, boolean allLevel, String fieldInPath, boolean enable); } diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClstemplateService.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClstemplateService.java new file mode 100644 index 0000000..eec4c1b --- /dev/null +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClstemplateService.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 搴勯獮 (smallchill@163.com) + */ +package com.vci.ubcs.code.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.vci.ubcs.code.entity.CodeClstemplateEntity; +import com.vci.ubcs.code.vo.CodeClstemplateVO; +import org.springblade.core.mp.base.BaseService; +import com.baomidou.mybatisplus.core.metadata.IPage; + +/** + * 缂栫爜搴撳畾涔�-妯℃澘绠$悊 鏈嶅姟绫� + * + * @author yuxc + * @since 2023-04-10 + */ +public interface ICodeClstemplateService extends IService<CodeClstemplateEntity> { + + /** + * 鑷畾涔夊垎椤� + * + * @param page + * @param plCodeClstemplate + * @return + */ + IPage<CodeClstemplateVO> selectPlCodeClstemplatePage(IPage<CodeClstemplateVO> page, CodeClstemplateVO plCodeClstemplate); + + +} diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClstemplateServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClstemplateServiceImpl.java new file mode 100644 index 0000000..85551b0 --- /dev/null +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClstemplateServiceImpl.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 搴勯獮 (smallchill@163.com) + */ +package com.vci.ubcs.code.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.vci.ubcs.code.entity.CodeClstemplateEntity; +import com.vci.ubcs.code.vo.CodeClstemplateVO; +import com.vci.ubcs.code.mapper.CodeClstemplateMapper; +import com.vci.ubcs.code.service.ICodeClstemplateService; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; +import com.baomidou.mybatisplus.core.metadata.IPage; + +/** + * 缂栫爜搴撳畾涔�-妯℃澘绠$悊 鏈嶅姟瀹炵幇绫� + * + * @author yuxc + * @since 2023-04-10 + */ +@Service +public class CodeClstemplateServiceImpl extends ServiceImpl<CodeClstemplateMapper, CodeClstemplateEntity> implements ICodeClstemplateService { + + @Override + public IPage<CodeClstemplateVO> selectPlCodeClstemplatePage(IPage<CodeClstemplateVO> page, CodeClstemplateVO plCodeClstemplate) { + return page.setRecords(baseMapper.selectPlCodeClstemplatePage(page, plCodeClstemplate)); + } +} diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/ICodeClassifyServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/ICodeClassifyServiceImpl.java index 31cea94..770c013 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/ICodeClassifyServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/ICodeClassifyServiceImpl.java @@ -5,24 +5,42 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; +import com.vci.ubcs.code.bo.TreeWrapperOptions; import com.vci.ubcs.code.entity.CodeClassify; +import com.vci.ubcs.code.entity.CodeClstemplateEntity; +import com.vci.ubcs.code.enumpack.FrameworkDataLCStatus; import com.vci.ubcs.code.mapper.CodeClassifyMapper; +import com.vci.ubcs.code.mapper.CodeClstemplateMapper; import com.vci.ubcs.code.service.ICodeClassifyService; +import com.vci.ubcs.code.service.ICodeKeyattrrepeatService; +import com.vci.ubcs.code.service.ICodeRuleService; +import com.vci.ubcs.code.vo.CodeClstemplateVO; import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO; +import com.vci.ubcs.code.vo.pagemodel.CodeKeyAttrRepeatRuleVO; +import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO; +import com.vci.ubcs.code.vo.pagemodel.TreeQueryObject; +import com.vci.ubcs.com.vci.starter.revision.service.RevisionModelUtil; +import com.vci.ubcs.com.vci.starter.web.pagemodel.Tree; +import com.vci.ubcs.com.vci.starter.web.util.BeanUtilForVCI; +import com.vci.ubcs.com.vci.starter.web.util.VciBaseUtil; import com.vci.ubcs.core.log.exception.ServiceException; import jodd.bean.BeanUtil; +import org.springblade.core.cache.utils.CacheUtil; import org.springblade.core.mp.support.Condition; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import javax.annotation.Resource; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.io.File; +import java.util.*; +import java.util.stream.Collectors; + +import static com.vci.ubcs.code.constant.FrameWorkDefaultValueConstant.*; +import static org.springblade.core.cache.constant.CacheConstant.SYS_CACHE; @Service public class ICodeClassifyServiceImpl extends ServiceImpl<CodeClassifyMapper, CodeClassify> implements ICodeClassifyService { @@ -30,6 +48,23 @@ @Resource private CodeClassifyMapper codeClassifyMapper; + @Resource + private CodeClstemplateMapper codeClstemplateMapper; + + @Resource + private ICodeRuleService codeRuleService; + /** + * 瀵硅薄鐨勬搷浣� + */ + @Resource + private RevisionModelUtil revisionModelUtil; + + @Resource + private ICodeKeyattrrepeatService iCodeKeyattrrepeatService; + /** + * 涓婄骇鑺傜偣鐨勫睘鎬у悕绉� + */ + public static final String PARENT_FIELD_NAME = "parentCodeClassifyOid"; /** * 浣跨敤鏌ヨ灏佽鍣ㄦ潵鏌ヨ * @param wrapper 鏌ヨ灏佽鍣� @@ -203,50 +238,322 @@ R result = checkIsCanDeleteForDO(codeClassify); //鍏堢畝绉版槸鍚︽湁鍏宠仈妯℃澘锛屾湁妯℃澘瑕佸厛鍒犻櫎 + Map<String,Object> condition = new HashMap<>(2); + condition.put("codeClassifyOid",codeClassify.getOid()); + List<CodeClstemplateEntity> codeClstemplateEntities = codeClstemplateMapper.selectByMap(condition); // VciQueryWrapperForDO queryWrapper = new VciQueryWrapperForDO(CodeClassifyTemplateDO.class); // queryWrapper.addQueryMap("codeClassifyOid",codeClassifyDTO.getOid()); // List<CodeClassifyTemplateDO> codeClassifyTemplateDOListHaveTemplate = codeClassifyTemplateMapper.selectByWrapper(queryWrapper); -// if(codeClassifyTemplateDOListHaveTemplate.size()>0){ -// return BaseResult.fail("鍒嗙被鍏宠仈妯℃澘锛岃鍏堝垹闄�!"); -// } -// -// //澶勭悊鏁版嵁闆嗘垚閫昏緫,鎴愬姛鍚庢墽琛岄泦鎴愮涓�姝�,鍒嗙被鏁版嵁鐗规畩澶勭悊銆� -// //1銆佹煡璇㈣鍒犻櫎鐨勭埗绫绘暟鎹� -// List<CodeClassifyDO> deletes = new ArrayList<CodeClassifyDO>(); -// deletes.add(codeClassifyDO); -// -// if(result.isSuccess()) { -// //鎵句笅绾х殑锛岃繖涓槸鍙互鍒犻櫎鐨勬椂鍊� -// Map<String,String> childrenOids = codeClassifyMapper.selectAllLevelChildOid(codeClassifyDO.getOid().trim()); -// if (!CollectionUtils.isEmpty(childrenOids)) { -// Collection<Collection<String>> childrenCollections = VciBaseUtil.switchCollectionForOracleIn(childrenOids.keySet()); -// for(Collection<String> s : childrenCollections){ -// -// //澶勭悊鏁版嵁闆嗘垚閫昏緫,鎴愬姛鍚庢墽琛岄泦鎴愮涓�姝�,鍒嗙被鏁版嵁鐗规畩澶勭悊銆� -// //2銆佹煡璇㈣鍒犻櫎鐨勫瓙绫绘暟鎹� -// List<CodeClassifyDO> codeClassifyDOList = codeClassifyMapper.selectByPrimaryKeyCollection(s); -// deletes.addAll(codeClassifyDOList); -// -// codeClassifyMapper.batchDeleteByOids(s); -// } -// -// } -// }else{ -// return baseResult; -// } -// -// //鎵ц鍒犻櫎鎿嶄綔 -// BatchCBO batchCBO = codeClassifyMapper.deleteByPrimaryKey(codeClassifyDO.getOid()); -// -// //澶勭悊鏁版嵁闆嗘垚閫昏緫,鎴愬姛鍚庢墽琛岄泦鎴愮涓�姝� -// for (CodeClassifyDO codeClassifyDO1:deletes){ -// //codeDuckingServiceI.insertCache1(CACHE_TYPE_CLASSIFY_DELETE,FRAMEWORK_DATA_DISABLED,DOCKING_DEFAULT_CLASSIFY, DOCKING_DEFAULT_CLASSIFYOID, codeClassifyDO1.getOid(), DateUtils.addHours(new Date(),1));//杩欓噷鏄綋鍓嶆椂闂� -// -// //瀛樺偍瑕佸垹闄ょ殑鏁版嵁 -// codeDuckingServiceI.cacheDeleteData(codeClassifyDO1.getOid(), codeClassifyDO1); -// } -// return (batchCBO!=null && batchCBO.getDeleteCbos() !=null &&batchCBO.getDeleteCbos().size() > 0)?BaseResult.successMsg(DELETE_SUCCESS):BaseResult.fail(DELETE_FAIL); - return null; + if(codeClstemplateEntities.size()>0){ + return R.fail("鍒嗙被鍏宠仈妯℃澘锛岃鍏堝垹闄�!"); + } + + //澶勭悊鏁版嵁闆嗘垚閫昏緫,鎴愬姛鍚庢墽琛岄泦鎴愮涓�姝�,鍒嗙被鏁版嵁鐗规畩澶勭悊銆� + //1銆佹煡璇㈣鍒犻櫎鐨勭埗绫绘暟鎹� + List<CodeClassify> deletes = new ArrayList<CodeClassify>(); + deletes.add(codeClassify); + + if(result.isSuccess()) { + //鎵句笅绾х殑锛岃繖涓槸鍙互鍒犻櫎鐨勬椂鍊� + Map<String,String> childrenOids = codeClassifyMapper.selectAllLevelChildOid(codeClassify.getOid().trim()); + if (!CollectionUtils.isEmpty(childrenOids)) { + Collection<Collection<String>> childrenCollections = VciBaseUtil.switchCollectionForOracleIn(childrenOids.keySet()); + for(Collection<String> s : childrenCollections){ + + //澶勭悊鏁版嵁闆嗘垚閫昏緫,鎴愬姛鍚庢墽琛岄泦鎴愮涓�姝�,鍒嗙被鏁版嵁鐗规畩澶勭悊銆� + //2銆佹煡璇㈣鍒犻櫎鐨勫瓙绫绘暟鎹� + List<CodeClassify> codeClassifyDOList = codeClassifyMapper.selectBatchIds(s); + deletes.addAll(codeClassifyDOList); + codeClassifyMapper.deleteBatchIds(s); + } + + } + }else{ + return result; + } + + //鎵ц鍒犻櫎鎿嶄綔 + int deleteCount = codeClassifyMapper.deleteById(codeClassify.getOid()); + + //澶勭悊鏁版嵁闆嗘垚閫昏緫,鎴愬姛鍚庢墽琛岄泦鎴愮涓�姝� + for (CodeClassify codeClassifyTemp:deletes){ + //codeDuckingServiceI.insertCache1(CACHE_TYPE_CLASSIFY_DELETE,FRAMEWORK_DATA_DISABLED,DOCKING_DEFAULT_CLASSIFY, DOCKING_DEFAULT_CLASSIFYOID, codeClassifyDO1.getOid(), DateUtils.addHours(new Date(),1));//杩欓噷鏄綋鍓嶆椂闂� + + //瀛樺偍瑕佸垹闄ょ殑鏁版嵁 +// CacheUtil.put(); + CacheUtil.put("ubcs:code", "bean:id:", codeClassifyTemp.getOid(), codeClassifyTemp); +// codeDuckingServiceI.cacheDeleteData(codeClassifyTemp.getOid(), codeClassifyTemp); + } + return R.data(deleteCount>0); +// return null; } + /** + * 鍚敤銆佸仠鐢� + * @param oid 涓婚敭 + * @param lcStatus 鐘舵�� + * @return 鎵ц缁撴灉 + */ + @Override + public R updateLcStatus(String oid, String lcStatus){ + + //鏌ヨ淇敼鍓峵s + CodeClassify codeClassify = codeClassifyMapper.selectById(oid);//涓昏鏄负浜嗘煡璇s + codeClassify.setLcStatus(lcStatus); + //鍚敤銆佸仠鐢� +// int u = codeClassifyMapper.updateLcStatus(oid,lcStatus); + int count = codeClassifyMapper.updateById(codeClassify); +// //澶勭悊鏁版嵁闆嗘垚閫昏緫,鎴愬姛鍚庢墽琛岄泦鎴愮涓�姝�,鍒嗙被鏁版嵁鐗规畩澶勭悊銆� +// if(u!=0) { +// codeDuckingServiceI.insertCache1(lcStatus,lcStatus,DOCKING_DEFAULT_CLASSIFY, DOCKING_DEFAULT_CLASSIFYOID, oid, codeClassifyDO_old.getTs()); +// } + return R.data(SqlHelper.retBool(count)); + } + + /** + * 涓婚敭鎵归噺鑾峰彇涓婚搴撳垎绫� + * @param oidCollections 涓婚敭闆嗗悎锛屼絾鏄彈鎬ц兘褰卞搷锛屽缓璁竴娆℃煡璇笉瓒呰繃10000涓� + * @return 涓婚搴撳垎绫绘樉绀哄璞� + */ + @Override + public Collection<CodeClassifyVO> listCodeClassifyByOids(Collection<String> oidCollections) { + VciBaseUtil.alertNotNull(oidCollections,"鏁版嵁瀵硅薄涓婚敭闆嗗悎"); + List<CodeClassify> codeClassifyDOList = listCodeClassifyDOByOidCollections(oidCollections); + return codeClassifyDO2VOs(codeClassifyDOList); + } + + + /** + * 浣跨敤涓婚敭闆嗗悎鏌ヨ鏁版嵁瀵硅薄 + * @param oidCollections 涓婚敭鐨勯泦鍚� + * @return 鏁版嵁瀵硅薄鍒楄〃 + */ + private List<CodeClassify> listCodeClassifyDOByOidCollections(Collection<String> oidCollections){ + List<CodeClassify> codeClassifyList = new ArrayList<CodeClassify>(); + if(!CollectionUtils.isEmpty(oidCollections)){ + Collection<Collection<String>> oidCollectionsList = VciBaseUtil.switchCollectionForOracleIn(oidCollections); + for(Collection<String> oids: oidCollectionsList){ + List<CodeClassify> tempDOList = codeClassifyMapper.selectBatchIds(oids); + if(!CollectionUtils.isEmpty(tempDOList)){ + codeClassifyList.addAll(tempDOList); + } + } + } + return codeClassifyList; + } + + + /** + * 鎵归噺鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞� + * @param codeClassifys 鏁版嵁瀵硅薄鍒楄〃 + * @return 鏄剧ず瀵硅薄 + */ + @Override + public List<CodeClassifyVO> codeClassifyDO2VOs(Collection<CodeClassify> codeClassifys) { + List<CodeClassifyVO> voList = new ArrayList<CodeClassifyVO>(); + if(!CollectionUtils.isEmpty(codeClassifys)){ + for(CodeClassify s: codeClassifys){ + CodeClassifyVO vo = codeClassifyDO2VO(s); + if(vo != null){ + voList.add(vo); + } + } + } + return voList; + } + + /** + * 鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞� + * @param codeClassify 鏁版嵁瀵硅薄 + * @return 鏄剧ず瀵硅薄 + */ + @Override + public CodeClassifyVO codeClassifyDO2VO(CodeClassify codeClassify) { + CodeClassifyVO vo = new CodeClassifyVO(); + if(codeClassify != null){ + BeanUtilForVCI.copyPropertiesIgnoreCase(codeClassify,vo); + //濡傛灉鏈塴cstatus鐨勭被鐨勮瘽 + vo.setLcStatusText(FrameworkDataLCStatus.getTextByValue(vo.getLcStatus())); + } + return vo; + } + + /** + * 鍙傜収鏍� 涓婚搴撳垎绫� + * @param treeQueryObject 鏍戝舰鏌ヨ瀵硅薄 + * @return 涓婚搴撳垎绫绘樉绀烘爲 + */ + @Override + public List<Tree> referTree(TreeQueryObject treeQueryObject) { + if(treeQueryObject == null){ + treeQueryObject = new TreeQueryObject(); + } + if(treeQueryObject.getConditionMap() == null){ + treeQueryObject.setConditionMap(new HashMap<>()); + } + if(treeQueryObject.getConditionMap().containsKey(LC_STATUS)) { + treeQueryObject.getConditionMap().remove(LC_STATUS); + } + if(treeQueryObject.getExtandParamsMap() ==null || !treeQueryObject.getExtandParamsMap().containsKey(REFER_SHOW_DISABLED_QUERY_KEY)) { + } + treeQueryObject.getConditionMap().put(LC_STATUS, FRAMEWORK_DATA_ENABLED); + return treeCodeClassify(treeQueryObject); + } + + /** + * 鏌ヨ涓婚搴撳垎绫� 鏍� + * @param treeQueryObject 鏍戞煡璇㈠璞� + * @return 涓婚搴撳垎绫� 鏄剧ず鏍� + */ + @Override + public List<Tree> treeCodeClassify(TreeQueryObject treeQueryObject) { + List<CodeClassify> doList =codeClassifyMapper.selectCodeClassifyVOByTree(treeQueryObject.getParentOid()); + List<CodeClassifyVO> voList = codeClassifyDO2VOs(doList); + TreeWrapperOptions treeWrapperOptions = new TreeWrapperOptions(PARENT_FIELD_NAME.toLowerCase(Locale.ROOT)); + treeWrapperOptions.copyFromTreeQuery(treeQueryObject); + List<Tree> tree= revisionModelUtil.doList2Trees(voList,treeWrapperOptions,(CodeClassifyVO s) ->{ + //鍙互鍦ㄨ繖閲屽鐞嗘爲鑺傜偣鐨勬樉绀� + return s.getId() + " " + s.getName() + (FrameworkDataLCStatus.DISABLED.getValue().equalsIgnoreCase(s + .getLcStatus()) ? (" 銆愬仠鐢ㄣ�� ") : ""); + }); + Iterator var6 = tree.listIterator(); + while(var6.hasNext()){ + Tree trees = (Tree) var6.next(); + boolean checkHasChild=codeClassifyMapper.checkHasChild(trees.getOid()); + if(checkHasChild){ + trees.setLeaf(false); + }else{ + trees.setLeaf(true); + } + } + return tree; + } + + +// /** +// * 鏍规嵁鏍戝舰鏌ヨ瀵硅薄鏉ユ煡璇㈡暟鎹璞� +// * +// * @param treeQueryObject 鏍戝舰鏌ヨ瀵硅薄 +// * @return 鏌ヨ缁撴灉,鏁版嵁瀵硅薄 +// */ +// @Override +// public List<CodeClassifyVO> selectCodeClassifyDOByTree(TreeQueryObject treeQueryObject) { +// VciQueryWrapperForDO queryWrapperForDO = new VciQueryWrapperForDO(null,CodeClassifyDO.class); +// VciParentQueryOption parentQueryOption = new VciParentQueryOption(); +// parentQueryOption.setParentFieldName(PARENT_FIELD_NAME); +// queryWrapperForDO.parentQueryChild(treeQueryObject,parentQueryOption); +// if(StringUtils.isBlank(treeQueryObject.getSort())) { +// PageHelper pageHelper = new PageHelper(-1); +// pageHelper.addDefaultAsc("id"); +// queryWrapperForDO.setPageHelper(pageHelper); +// } +// return codeClassifyMapper.selectByWrapper(queryWrapperForDO); +// } + + /** + * 瀵煎嚭鍒嗙被 + * + * @param oid 鍒嗙被涓婚敭 + * @return excel鏂囦欢璺緞 + */ + @Override + public String exportClassify(String oid) { +// VciBaseUtil.alertNotNull(oid,"鍒嗙被鐨勪富閿�"); +// CodeClassify codeClassify = codeClassifyMapper.selectById(oid); +// codeClassify.setDataLevel(0); +// codeClassify.setPath(codeClassify.getId()); +// List<CodeClassifyVO> codeClassifyVOS = listChildrenClassify(oid, true, "id", false); +// if(codeClassifyVOS ==null){ +// codeClassifyVOS = new ArrayList<>(); +// } +// CodeClassifyVO codeClassifyVO = new CodeClassifyVO(); +// BeanUtils.copyProperties(codeClassify,codeClassifyVO); +// codeClassifyVOS.add(codeClassifyVO); +// +// //鏌ヨ涓�涓嬭鍒欑殑缂栧彿锛屽拰鍏抽敭灞炴�ч噸澶嶈鍒� +// List<String> codeRuleOids = codeClassifyVOS.stream().filter(s -> org.apache.commons.lang3.StringUtils.isNotBlank(s.getCoderuleoid())).map(CodeClassifyVO::getCoderuleoid).collect(Collectors.toList()); +// Map<String, CodeRuleVO> ruleVOMap = new HashMap<>(); +// if(!CollectionUtils.isEmpty(codeRuleOids)){ +// VciBaseUtil.switchCollectionForOracleIn(codeRuleOids).stream().forEach(ruleOids->{ +// Collection<CodeRuleVO> ruleVOS = codeRuleService.listCodeRuleByOids(ruleOids); +// ruleVOMap.putAll( Optional.ofNullable(ruleVOS).orElseGet(()->new ArrayList<>()).stream().collect(Collectors.toMap(s->s.getOid(),t->t))); +// }); +// } +// //鎵惧叧閿睘鎬ц鍒� +// List<String> keyRuleOids = codeClassifyVOS.stream().filter(s -> org.apache.commons.lang3.StringUtils.isNotBlank(s.getCodekeyattrrepeatoid())).map(CodeClassifyVO::getCodekeyattrrepeatoid).collect(Collectors.toList()); +// Map<String, CodeKeyAttrRepeatRuleVO> keyRuleVOMap = new HashMap<>(); +// if(!CollectionUtils.isEmpty(keyRuleOids)){ +// VciBaseUtil.switchCollectionForOracleIn(keyRuleOids).stream().forEach(ruleOids->{ +// Collection<CodeKeyAttrRepeatRuleVO> ruleVOS = iCodeKeyattrrepeatService.listCodeKeyAttrRepeatRuleByOids(ruleOids); +// keyRuleVOMap.putAll( Optional.ofNullable(ruleVOS).orElseGet(()->new ArrayList<>()).stream().collect(Collectors.toMap(s->s.getOid(),t->t))); +// }); +// } +// //ok,鍐檈xcel +// String excelName = LocalFileUtil.getDefaultTempFolder() + File.separator + "瀵煎嚭鍒嗙被.xls"; +// try { +// new File(excelName).createNewFile(); +// } catch (Throwable e) { +// throw new VciBaseException(LangBaseUtil.getErrorMsg(e), new String[]{excelName}, e); +// } +// List<WriteExcelData> excelDataList = new ArrayList<>(); +// excelDataList.add(new WriteExcelData(0,0,"鍒嗙被缂栧彿")); +// excelDataList.add(new WriteExcelData(0,1,"鍒嗙被鍚嶇О")); +// excelDataList.add(new WriteExcelData(0,2,"涓氬姟绫诲瀷缂栧彿")); +// excelDataList.add(new WriteExcelData(0,3,"涓氬姟绫诲瀷鍚嶇О")); +// excelDataList.add(new WriteExcelData(0,4,"缂栫爜瑙勫垯缂栧彿")); +// excelDataList.add(new WriteExcelData(0,5,"缂栫爜瑙勫垯鍚嶇О")); +// excelDataList.add(new WriteExcelData(0,6,"鏌ラ噸瑙勫垯缂栧彿")); +// excelDataList.add(new WriteExcelData(0,7,"鏌ラ噸瑙勫垯鍚嶇О")); +// excelDataList.add(new WriteExcelData(0,8,"鍒嗙被璺緞")); +// excelDataList.add(new WriteExcelData(0,9,"鐘舵��")); +// excelDataList.add(new WriteExcelData(0,10,"鍒嗙被灞傜骇")); +// excelDataList.add(new WriteExcelData(0,11,"鎻忚堪")); +// for (int i = 0; i < codeClassifyVOS.size(); i++) { +// CodeClassifyVO vo = codeClassifyVOS.get(i); +// excelDataList.add(new WriteExcelData(i+1,0,vo.getId())); +// excelDataList.add(new WriteExcelData(i+1,1,vo.getName())); +// excelDataList.add(new WriteExcelData(i+1,2,vo.getBtmtypeid())); +// excelDataList.add(new WriteExcelData(i+1,3,vo.getBtmtypename())); +// excelDataList.add(new WriteExcelData(i+1,4, org.apache.commons.lang3.StringUtils.isNotBlank(vo.getCoderuleoid())?ruleVOMap.getOrDefault(vo.getCoderuleoid(),new CodeRuleVO()).getId():"")); +// excelDataList.add(new WriteExcelData(i+1,5, org.apache.commons.lang3.StringUtils.isNotBlank(vo.getCoderuleoid())?ruleVOMap.getOrDefault(vo.getCoderuleoid(),new CodeRuleVO()).getName():"")); +// excelDataList.add(new WriteExcelData(i+1,6, org.apache.commons.lang3.StringUtils.isNotBlank(vo.getCodekeyattrrepeatoid())?keyRuleVOMap.getOrDefault(vo.getCodekeyattrrepeatoid(),new CodeKeyAttrRepeatRuleVO()).getId():"")); +// excelDataList.add(new WriteExcelData(i+1,7, org.apache.commons.lang3.StringUtils.isNotBlank(vo.getCodekeyattrrepeatoid())?keyRuleVOMap.getOrDefault(vo.getCodekeyattrrepeatoid(),new CodeKeyAttrRepeatRuleVO()).getName():"")); +// excelDataList.add(new WriteExcelData(i+1,8,vo.getOid().equalsIgnoreCase(classifyVO.getOid())?vo.getPath():classifyVO.getPath() + vo.getPath())); +// excelDataList.add(new WriteExcelData(i+1,9,FrameworkDataLCStatus.getTextByValue(vo.getLcStatus()))); +// excelDataList.add(new WriteExcelData(i+1,10,vo.getDataLevel())); +// excelDataList.add(new WriteExcelData(i+1,11,vo.getDescription())); +// } +// WriteExcelOption excelOption = new WriteExcelOption(excelDataList); +// ExcelUtil.writeDataToFile(excelName, excelOption); + return null; +// return excelName; + } + + /** + * 鑾峰彇瀛愮骇鐨勪富棰樺簱鍒嗙被 + * + * @param codeClassifyOid 鍒嗙被鐨勪富閿� + * @param allLevel 鏄惁鎵�鏈夌殑灞傜骇 + * @param fieldInPath 鍦ㄨ矾寰勪腑鐨勫瓧娈� + * @param enable 鏄惁鍙樉绀哄惎鐢� + * @return 鍒嗙被鐨勬樉绀哄璞� + */ + @Override + public List<CodeClassifyVO> listChildrenClassify(String codeClassifyOid, boolean allLevel, String fieldInPath, boolean enable) { + if(allLevel){ + List<CodeClassify> classifyDOS = codeClassifyMapper.selectAllLevelChildHasPath(codeClassifyOid); + if(!CollectionUtils.isEmpty(classifyDOS)){ + classifyDOS = classifyDOS.stream().filter(s->FRAMEWORK_DATA_ENABLED.equalsIgnoreCase(s.getLcStatus())).collect(Collectors.toList()); + } + return codeClassifyDO2VOs(classifyDOS); + }else{ + //鍙煡璇竴鏉★紝閭ath灏辨病蹇呰鏌ヨ浜� + Map<String,Object> conditionMap = new HashMap<>(); + conditionMap.put("parentcodeclassifyoid",codeClassifyOid); + if (enable){ + conditionMap.put("lcstatus",FRAMEWORK_DATA_ENABLED); + } + return codeClassifyDO2VOs(codeClassifyMapper.selectByMap(conditionMap)); + } + } } diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/wrapper/PlCodeClstemplateWrapper.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/wrapper/PlCodeClstemplateWrapper.java new file mode 100644 index 0000000..e598d48 --- /dev/null +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/wrapper/PlCodeClstemplateWrapper.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 搴勯獮 (smallchill@163.com) + */ +package com.vci.ubcs.code.wrapper; + +import org.springblade.core.mp.support.BaseEntityWrapper; +import org.springblade.core.tool.utils.BeanUtil; +import com.vci.ubcs.code.entity.CodeClstemplateEntity; +import com.vci.ubcs.code.vo.CodeClstemplateVO; +import java.util.Objects; + +/** + * 缂栫爜搴撳畾涔�-妯℃澘绠$悊 鍖呰绫�,杩斿洖瑙嗗浘灞傛墍闇�鐨勫瓧娈� + * + * @author yuxc + * @since 2023-04-10 + */ +public class PlCodeClstemplateWrapper extends BaseEntityWrapper<CodeClstemplateEntity, CodeClstemplateVO> { + + public static PlCodeClstemplateWrapper build() { + return new PlCodeClstemplateWrapper(); + } + + @Override + public CodeClstemplateVO entityVO(CodeClstemplateEntity plCodeClstemplate) { + CodeClstemplateVO plCodeClstemplateVO = Objects.requireNonNull(BeanUtil.copy(plCodeClstemplate, CodeClstemplateVO.class)); + + //User createUser = UserCache.getUser(plCodeClstemplate.getCreateUser()); + //User updateUser = UserCache.getUser(plCodeClstemplate.getUpdateUser()); + //plCodeClstemplateVO.setCreateUserName(createUser.getName()); + //plCodeClstemplateVO.setUpdateUserName(updateUser.getName()); + + return plCodeClstemplateVO; + } + + +} diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeCLassifyMapper.xml b/Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeCLassifyMapper.xml index 957e70b..761683d 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeCLassifyMapper.xml +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeCLassifyMapper.xml @@ -57,4 +57,90 @@ where parentCodeClassifyOid = #{oid} </select> + <select id="selectCodeClassifyVOByTree" resultMap="plCodeClassifyResultMap"> + select codeclassify0.OWNER as owner, + codeclassify0.BTMTYPEID as btmtypeid, + codeclassify0.CREATOR as creator, + codeclassify0.CREATETIME as createtime, + codeclassify0.LASTMODIFIER as lastmodifier, + codeclassify0.DESCRIPTION as description, + codeclassify0.ORDERNUM as ordernum, + codeclassify0.CODERULEOID as coderuleoid, + codeclassify0.OID as oid, + codeclassify0.BTMNAME as btmname, + codeclassify0.BTMTYPENAME as btmtypename, + codeclassify0.CODEKEYATTRREPEATOID as codekeyattrrepeatoid, + codeclassify0.PARENTCODECLASSIFYOID as parentcodeclassifyoid, + codeclassify0.NAME as name, + codeclassify0.LASTMODIFYTIME as lastmodifytime, + codeclassify0.ID as id, + codeclassify0.CODERESEMBLERULEOID as coderesembleruleoid, + codeclassify0.LCSTATUS as lcstatus, + codeclassify0.TS as ts, + coderuleoid.name as codeRuleOidName, + codekeyattrrepeatoid.name as codeKeyAttrRepeatOidName, + coderesembleruleoid.name as codeResembleRuleOidName + from pl_code_classify codeclassify0 + left join pl_code_rule coderuleoid + on codeclassify0.codeRuleOid = coderuleoid.oid + left join pl_code_keyattrrepeat codekeyattrrepeatoid + on codeclassify0.codeKeyAttrRepeatOid = codekeyattrrepeatoid.oid + left join pl_code_resemblerule coderesembleruleoid + on codeclassify0.codeResembleRuleOid = coderesembleruleoid.oid + where + <where> + <if test="oid != null and oid != ''"> + codeclassify0.parentcodeclassifyoid = #{oid} + </if> + <if test="oid = null or oid = ''"> + codeclassify0.parentcodeclassifyoid is null + </if> + </where> + order by id asc + </select> + + <select id="selectAllLevelChildHasPath" resultMap="plCodeClassifyResultMap"> + select codeclassify0.OWNER as owner, + codeclassify0.BTMTYPEID as btmtypeid, + codeclassify0.CREATOR as creator, + codeclassify0.CREATETIME as createtime, + codeclassify0.LASTMODIFIER as lastmodifier, + codeclassify0.DESCRIPTION as description, + codeclassify0.ORDERNUM as ordernum, + codeclassify0.CODERULEOID as coderuleoid, + codeclassify0.OID as oid, + codeclassify0.BTMNAME as btmname, + codeclassify0.BTMTYPENAME as btmtypename, + codeclassify0.CODEKEYATTRREPEATOID as codekeyattrrepeatoid, + codeclassify0.PARENTCODECLASSIFYOID as parentcodeclassifyoid, + codeclassify0.NAME as name, + codeclassify0.LASTMODIFYTIME as lastmodifytime, + codeclassify0.ID as id, + codeclassify0.CODERESEMBLERULEOID as coderesembleruleoid, + codeclassify0.LCSTATUS as lcstatus, + codeclassify0.TS as ts, + coderuleoid.name as codeRuleOidName, + codekeyattrrepeatoid.name as codeKeyAttrRepeatOidName, + coderesembleruleoid.name as codeResembleRuleOidName, + level as datalevel, + SYS_CONNECT_BY_PATH(codeclassify0.id, '#') as path + from pl_code_classify codeclassify0 + left join pl_code_rule coderuleoid + on codeclassify0.codeRuleOid = coderuleoid.oid + left join pl_code_keyattrrepeat codekeyattrrepeatoid + on codeclassify0.codeKeyAttrRepeatOid = codekeyattrrepeatoid.oid + left join pl_code_resemblerule coderesembleruleoid + on codeclassify0.codeResembleRuleOid = coderesembleruleoid.oid + START WITH + <where> + <if test="oid != null and oid != ''"> + codeclassify0.parentCodeClassifyOid = #{oid} + </if> + <if test="oid = null or oid = ''"> + codeclassify0.parentCodeClassifyOid = is null + </if> + </where> + CONNECT BY PRIOR codeclassify0.OID = codeclassify0.parentCodeClassifyOid + </select> + </mapper> diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeClstemplateMapper.xml b/Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeClstemplateMapper.xml new file mode 100644 index 0000000..07e7d6e --- /dev/null +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeClstemplateMapper.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.vci.ubcs.code.mapper.CodeClstemplateMapper"> + + <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 --> + <resultMap id="plCodeClstemplateResultMap" type="com.vci.ubcs.code.entity.CodeClstemplateEntity"> + <result column="OID" property="oid"/> + <result column="REVISIONOID" property="revisionOid"/> + <result column="NAMEOID" property="nameOid"/> + <result column="BTMNAME" property="btmname"/> + <result column="LASTR" property="lastR"/> + <result column="FIRSTR" property="firstR"/> + <result column="LASTV" property="lastV"/> + <result column="FIRSTV" property="firstV"/> + <result column="CREATOR" property="creator"/> + <result column="CREATETIME" property="createTime"/> + <result column="LASTMODIFIER" property="lastModifier"/> + <result column="LASTMODIFYTIME" property="lastModifyTime"/> + <result column="REVISIONRULE" property="revisionRule"/> + <result column="VERSIONRULE" property="versionRule"/> + <result column="REVISIONSEQ" property="revisionSeq"/> + <result column="REVISIONVALUE" property="revisionValue"/> + <result column="VERSIONSEQ" property="versionSeq"/> + <result column="VERSIONVALUE" property="versionValue"/> + <result column="LCTID" property="lctid"/> + <result column="LCSTATUS" property="lcStatus"/> + <result column="TS" property="ts"/> + <result column="ID" property="id"/> + <result column="NAME" property="name"/> + <result column="DESCRIPTION" property="description"/> + <result column="OWNER" property="owner"/> + <result column="COPYFROMVERSION" property="copyFromVersion"/> + <result column="CODECLASSIFYOID" property="codeClassifyOid"/> + <result column="BTMTYPEID" property="btmTypeId"/> + <result column="BTMTYPENAME" property="btmTypeName"/> + </resultMap> + + + <select id="selectPlCodeClstemplatePage" resultMap="plCodeClstemplateResultMap"> + select * from PL_CODE_CLSTEMPLATE where is_deleted = 0 + </select> + + +</mapper> -- Gitblit v1.9.3