| | |
| | | package com.qianwen.smartman.modules.tool.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import java.lang.invoke.SerializedLambda; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | import com.qianwen.smartman.common.cache.RegionCache; |
| | | import com.qianwen.smartman.common.constant.DncConstant; |
| | | import com.qianwen.smartman.common.utils.Lambda; |
| | | import com.qianwen.smartman.common.utils.MessageUtils; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.qianwen.core.coderule.constant.enums.ElementTypeEnum; |
| | | import com.qianwen.core.log.exception.ServiceException; |
| | | import com.qianwen.core.mp.base.BaseServiceImpl; |
| | | import com.qianwen.core.mp.support.Query; |
| | | import com.qianwen.core.tool.node.ForestNodeMerger; |
| | | import com.qianwen.core.tool.utils.Func; |
| | | import com.qianwen.smartman.common.constant.DncConstant; |
| | | import com.qianwen.smartman.common.utils.Lambda; |
| | | import com.qianwen.smartman.common.utils.MessageUtils; |
| | | import com.qianwen.smartman.modules.system.dto.BasCoderuleDTO; |
| | | import com.qianwen.smartman.modules.system.entity.BasCodeRule; |
| | | import com.qianwen.smartman.modules.system.entity.BasCodeRuleEntry; |
| | | import com.qianwen.smartman.modules.system.entity.Dict; |
| | | import com.qianwen.smartman.modules.system.entity.MetaObjectType; |
| | |
| | | import com.qianwen.smartman.modules.system.vo.DictVO; |
| | | import com.qianwen.smartman.modules.tool.constant.ToolConstant; |
| | | import com.qianwen.smartman.modules.tool.convert.ToolCategoryConvert; |
| | | import com.qianwen.smartman.modules.tool.entity.Tool; |
| | | import com.qianwen.smartman.modules.tool.entity.ToolCategory; |
| | | import com.qianwen.smartman.modules.tool.entity.ToolModel; |
| | | import com.qianwen.smartman.modules.tool.mapper.ToolCategoryMapper; |
| | | import com.qianwen.smartman.modules.tool.service.IToolCategoryService; |
| | | import com.qianwen.smartman.modules.tool.service.IToolManageService; |
| | | import com.qianwen.smartman.modules.tool.service.IToolModelService; |
| | | import com.qianwen.smartman.modules.tool.vo.ToolCategoryTreeVO; |
| | | import com.qianwen.smartman.modules.tool.vo.ToolCategoryVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | @Service |
| | | /* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/tool/service/impl/ToolCategoryServiceImpl.class */ |
| | |
| | | private IToolModelService toolModelService; |
| | | private final Integer MIN_SORT = 1; |
| | | |
| | | private static /* synthetic */ Object $deserializeLambda$(SerializedLambda lambda) { |
| | | String implMethodName = lambda.getImplMethodName(); |
| | | boolean z = true; |
| | | switch (implMethodName.hashCode()) { |
| | | case -1669172377: |
| | | if (implMethodName.equals("getToolCategoryId")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case -1249363733: |
| | | if (implMethodName.equals("getFId")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case -1041904421: |
| | | if (implMethodName.equals("getParentId")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case -75308287: |
| | | if (implMethodName.equals("getName")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case -75145708: |
| | | if (implMethodName.equals("getSort")) { |
| | | z = false; |
| | | break; |
| | | } |
| | | break; |
| | | case 58947841: |
| | | if (implMethodName.equals("getRuleFieldDictKey")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case 98245393: |
| | | if (implMethodName.equals("getId")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | } |
| | | switch (z) { |
| | | case false: |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/tool/entity/ToolCategory") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) { |
| | | return (v0) -> { |
| | | return v0.getSort(); |
| | | }; |
| | | } |
| | | break; |
| | | case true: |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/system/entity/BasCodeRule") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { |
| | | return (v0) -> { |
| | | return v0.getRuleFieldDictKey(); |
| | | }; |
| | | } |
| | | break; |
| | | case true: |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/system/entity/MetaObjectType") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { |
| | | return (v0) -> { |
| | | return v0.getFId(); |
| | | }; |
| | | } |
| | | break; |
| | | case true: |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/tool/entity/ToolCategory") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { |
| | | return (v0) -> { |
| | | return v0.getName(); |
| | | }; |
| | | } |
| | | break; |
| | | case true: |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/tool/entity/Tool") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getToolCategoryId(); |
| | | }; |
| | | } |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/tool/entity/ToolModel") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getToolCategoryId(); |
| | | }; |
| | | } |
| | | break; |
| | | case RegionCache.VILLAGE_LEVEL /* 5 */: |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/core/mp/base/BaseEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getId(); |
| | | }; |
| | | } |
| | | break; |
| | | case true: |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/tool/entity/ToolCategory") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getParentId(); |
| | | }; |
| | | } |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/tool/entity/ToolCategory") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getParentId(); |
| | | }; |
| | | } |
| | | break; |
| | | } |
| | | throw new IllegalArgumentException("Invalid lambda deserialization"); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.tool.service.IToolCategoryService |
| | | public List<ToolCategoryTreeVO> tree() { |
| | |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public Boolean remove(List<Long> ids) { |
| | | List<Long> categoryIds = getChildrenIds(ids, ids); |
| | | long count = this.toolManageService.count(Wrappers.<Tool>lambdaQuery().in(Tool::getToolCategoryId, categoryIds)); |
| | | /* |
| | | long count = this.toolManageService.count((Wrapper) Wrappers.lambdaQuery().in((v0) -> { |
| | | return v0.getToolCategoryId(); |
| | | }, categoryIds)); |
| | | }, categoryIds));*/ |
| | | if (count > 0) { |
| | | throw new ServiceException(MessageUtils.message("tool.have.tool.can.not.delete", new Object[0])); |
| | | } |
| | | this.toolModelService.remove((Wrapper) Wrappers.lambdaQuery().in((v0) -> { |
| | | return v0.getToolCategoryId(); |
| | | }, categoryIds)); |
| | | List<String> idStrList = (List) categoryIds.stream().map((v0) -> { |
| | | this.toolModelService.remove(Wrappers.<ToolModel>lambdaQuery().in(ToolModel::getToolCategoryId, categoryIds)); |
| | | List<String> idStrList = categoryIds.stream().map((v0) -> { |
| | | return String.valueOf(v0); |
| | | }).collect(Collectors.toList()); |
| | | |
| | | this.basCoderuleService.remove(Wrappers.<BasCodeRule>lambdaQuery().in(BasCodeRule::getRuleFieldDictKey, idStrList)); |
| | | /* |
| | | this.basCoderuleService.remove((Wrapper) Wrappers.lambdaQuery().in((v0) -> { |
| | | return v0.getRuleFieldDictKey(); |
| | | }, idStrList)); |
| | | String idList = (String) categoryIds.stream().map((v0) -> { |
| | | }, idStrList));*/ |
| | | String idList = categoryIds.stream().map((v0) -> { |
| | | return String.valueOf(v0); |
| | | }).reduce(a, b -> { |
| | | }).reduce((a, b) -> { |
| | | return a + "," + b; |
| | | }).get(); |
| | | this.dictService.removeDict(idList); |
| | |
| | | } |
| | | |
| | | private int getNextDictSort(Long parentId) { |
| | | List<DictVO> dictVOS = this.dictService.childList(new HashMap(), parentId); |
| | | List<DictVO> dictVOS = this.dictService.childList(new HashMap<>(), parentId); |
| | | return ((Integer) dictVOS.stream().map((v0) -> { |
| | | return v0.getSort(); |
| | | }).max((v0, v1) -> { |
| | |
| | | } |
| | | |
| | | private int getNextSort(Long parentId) { |
| | | List<ToolCategory> toolCategoryList = list(Wrappers.<ToolCategory>lambdaQuery().eq(ToolCategory::getParentId, parentId).orderByDesc(ToolCategory::getSort)); |
| | | /* |
| | | List<ToolCategory> toolCategoryList = list((Wrapper) ((LambdaQueryWrapper) Wrappers.lambdaQuery().eq((v0) -> { |
| | | return v0.getParentId(); |
| | | }, parentId)).orderByDesc((v0) -> { |
| | | return v0.getSort(); |
| | | })); |
| | | }));*/ |
| | | if (Func.isEmpty(toolCategoryList)) { |
| | | return this.MIN_SORT.intValue(); |
| | | } |
| | |
| | | } |
| | | |
| | | private void checkName(Long id, String name) { |
| | | long count = count(Wrappers.<ToolCategory>lambdaQuery().ne(Func.isNotEmpty(id), ToolCategory::getId, id).eq(ToolCategory::getName, name)); |
| | | /* |
| | | long count = count((Wrapper) Wrappers.lambdaQuery().ne(Func.isNotEmpty(id), (v0) -> { |
| | | return v0.getId(); |
| | | }, id).eq((v0) -> { |
| | | return v0.getName(); |
| | | }, name)); |
| | | }, name));*/ |
| | | if (count > 0) { |
| | | throw new ServiceException(MessageUtils.message("tool.category.already.exists", new Object[0])); |
| | | } |
| | |
| | | |
| | | @Override // org.springblade.modules.tool.service.IToolCategoryService |
| | | public List<Long> getChildrenIds(List<Long> queryIdList, List<Long> ids) { |
| | | List<Long> categoryIdList = (List) list(Lambda.in((v0) -> { |
| | | List<Long> categoryIdList = list(Lambda.in((v0) -> { |
| | | return v0.getParentId(); |
| | | }, queryIdList)).stream().map((v0) -> { |
| | | return v0.getId(); |