| | |
| | | |
| | | //package com.vci.starter.revision.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | 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 com.vci.ubcs.com.vci.starter.web.util.VciBaseUtil; |
| | | 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.*; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Component |
| | | public class RevisionModelUtil implements VciSecretServiceI { |
| | | |
| | | private Logger logger = LoggerFactory.getLogger(this.getClass()); |
| | | public static volatile Map<String, Map<String, String>> modelColumnAnnotationMap = new ConcurrentHashMap(); |
| | | // public static volatile Map<String, VciBtmType> modelAnnotationMap = new ConcurrentHashMap(); |
| | | public static boolean CHECK_IDEMPOTENCE = false; |
| | | |
| | | public void copyFromDTOIgnore(Object dto, BaseModel baseModel) { |
| | | VciBaseUtil.alertNotNull(new Object[]{dto, "数据传输对象", baseModel, "数据库中的数据对象"}); |
| | | BaseModel tempModel = new BaseModel(); |
| | |
| | | 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(); |
| | |
| | | tree.setText((String)textValues.stream().collect(Collectors.joining(wrapperOptions.getTextValueSep()))); |
| | | } |
| | | |
| | | if (StringUtil.isNotBlank(wrapperOptions.getParentFieldName())) { |
| | | if (StringUtils.isNotBlank(wrapperOptions.getParentFieldName())) { |
| | | tree.setParentId(VciBaseUtil.getStringValueFromObject(VciBaseUtil.getValueFromField(wrapperOptions.getParentFieldName(), doObject))); |
| | | } |
| | | |
| | |
| | | wrapperOptions.setParentOid(""); |
| | | } |
| | | |
| | | if (!StringUtil.isBlank(tree.getParentId()) && (!StringUtil.isNotBlank(wrapperOptions.getParentOid()) || !wrapperOptions.getParentOid().equalsIgnoreCase(tree.getParentId()))) { |
| | | if (!StringUtils.isBlank(tree.getParentId()) && (!StringUtils.isNotBlank(wrapperOptions.getParentOid()) || !wrapperOptions.getParentOid().equalsIgnoreCase(tree.getParentId()))) { |
| | | children.add(tree); |
| | | } else { |
| | | allTree.add(tree); |