| | |
| | | package com.qianwen.smartman.modules.cps.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import java.lang.invoke.SerializedLambda; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import com.qianwen.smartman.common.constant.CommonConstant; |
| | | import com.qianwen.smartman.common.enums.StatusType; |
| | | import com.qianwen.smartman.common.utils.CommonUtil; |
| | | import com.qianwen.smartman.common.utils.ExtraLambdaQueryWrapper; |
| | | import com.qianwen.smartman.common.utils.Lambda; |
| | | import com.qianwen.smartman.common.utils.MessageUtils; |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.qianwen.core.log.exception.ServiceException; |
| | | import com.qianwen.core.tool.node.ForestNodeMerger; |
| | | import com.qianwen.core.tool.utils.Func; |
| | | import com.qianwen.smartman.common.constant.CommonConstant; |
| | | import com.qianwen.smartman.common.enums.StatusType; |
| | | import com.qianwen.smartman.common.utils.CommonUtil; |
| | | import com.qianwen.smartman.common.utils.Lambda; |
| | | import com.qianwen.smartman.common.utils.MessageUtils; |
| | | import com.qianwen.smartman.modules.cps.convert.OrganizationConvert; |
| | | import com.qianwen.smartman.modules.cps.dto.OrganizationDTO; |
| | | import com.qianwen.smartman.modules.cps.entity.CommonGroup; |
| | |
| | | import com.qianwen.smartman.modules.cps.service.IOrganizationService; |
| | | import com.qianwen.smartman.modules.cps.vo.OrganizationSelectVO; |
| | | import com.qianwen.smartman.modules.cps.vo.OrganizationVO; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | @Service |
| | | /* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/cps/service/impl/OrganizationServiceImpl.class */ |
| | | public class OrganizationServiceImpl implements IOrganizationService { |
| | | private final OrganizationMapper organizationMapper; |
| | | private final ICommonGroupService commonGroupService; |
| | | |
| | | private static /* synthetic */ Object $deserializeLambda$(SerializedLambda lambda) { |
| | | String implMethodName = lambda.getImplMethodName(); |
| | | boolean z = true; |
| | | switch (implMethodName.hashCode()) { |
| | | case -1041904421: |
| | | if (implMethodName.equals("getParentId")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case 803533544: |
| | | if (implMethodName.equals("getStatus")) { |
| | | z = false; |
| | | 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/cps/entity/CommonGroup") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) { |
| | | return (v0) -> { |
| | | return v0.getStatus(); |
| | | }; |
| | | } |
| | | 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/cps/entity/CommonGroup") && 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/cps/entity/CommonGroup") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getParentId(); |
| | | }; |
| | | } |
| | | break; |
| | | } |
| | | throw new IllegalArgumentException("Invalid lambda deserialization"); |
| | | } |
| | | |
| | | |
| | | public OrganizationServiceImpl(final OrganizationMapper organizationMapper, final ICommonGroupService commonGroupService) { |
| | | this.organizationMapper = organizationMapper; |
| | |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public Boolean deleteOrganization(String ids, Integer type) { |
| | | if (StatusType.REMOVE.getType().equals(type)) { |
| | | CommonGroup commonGroup = this.commonGroupService.getOne(Lambda.<CommonGroup>create() |
| | | .eq(CommonGroup::getStatus, 1) |
| | | .in(CommonGroup::getParentId, Func.toLongList(ids)) |
| | | .limit()); |
| | | /* |
| | | CommonGroup commonGroup = (CommonGroup) this.commonGroupService.getOne(((ExtraLambdaQueryWrapper) ((ExtraLambdaQueryWrapper) Lambda.create().eq((v0) -> { |
| | | return v0.getStatus(); |
| | | }, 1)).in((v0) -> { |
| | | return v0.getParentId(); |
| | | }, Func.toLongList(ids))).limit()); |
| | | }, Func.toLongList(ids))).limit());*/ |
| | | if (Func.isNotEmpty(commonGroup)) { |
| | | throw new ServiceException(MessageUtils.message("cps.organization.delete.sub.dept", new Object[0])); |
| | | } |
| | |
| | | } |
| | | return Boolean.valueOf(this.commonGroupService.removeByIds(Func.toLongList(ids))); |
| | | } |
| | | |
| | | List<CommonGroup> groups = this.commonGroupService.list(Wrappers.<CommonGroup>query() |
| | | .lambda() |
| | | .in(CommonGroup::getParentId, Func.toLongList(ids))); |
| | | /* |
| | | List<CommonGroup> groups = this.commonGroupService.list((Wrapper) Wrappers.query().lambda().in((v0) -> { |
| | | return v0.getParentId(); |
| | | }, Func.toLongList(ids))); |
| | | }, Func.toLongList(ids)));*/ |
| | | if (Func.isEmpty(groups)) { |
| | | return this.commonGroupService.changeStatus(Func.toLongList(ids), CommonConstant.DEACTIVATE); |
| | | } |