| | |
| | | package com.qianwen.smartman.modules.system.handler.field; |
| | | |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.core.toolkit.support.SFunction; |
| | | import java.lang.invoke.SerializedLambda; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.HashMap; |
| | |
| | | import java.util.Map; |
| | | import java.util.StringJoiner; |
| | | import java.util.stream.Collectors; |
| | | import com.qianwen.smartman.common.cache.RegionCache; |
| | | |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.qianwen.core.tool.utils.Func; |
| | | import com.qianwen.smartman.common.constant.CommonConstant; |
| | | import com.qianwen.smartman.common.constant.DncConstant; |
| | | import com.qianwen.core.tool.utils.Func; |
| | | import com.qianwen.smartman.modules.cps.entity.Employee; |
| | | import com.qianwen.smartman.modules.cps.service.IEmployeeService; |
| | | import com.qianwen.smartman.modules.system.constant.FieldConstant; |
| | |
| | | import com.qianwen.smartman.modules.system.enums.CustomFieldTypeEnums; |
| | | import com.qianwen.smartman.modules.system.service.ICustomTemplateFieldService; |
| | | import com.qianwen.smartman.modules.system.service.impl.CustomTemplateFieldServiceImpl; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.hutool.json.JSONUtil; |
| | | |
| | | @Component |
| | | /* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/system/handler/field/ExtendFieldResultParse.class */ |
| | |
| | | private final IEmployeeService employeeService; |
| | | private static final List<Integer> CHECK_LIST = Arrays.asList(CustomFieldTypeEnums.CASCADE_SELECT.getType(), CustomFieldTypeEnums.MULTI_SELECT.getType(), CustomFieldTypeEnums.BUSINESS.getType()); |
| | | private static final List<Integer> IS_CHECK_TYPE = Arrays.asList(CustomFieldTypeEnums.INPUT.getType(), CustomFieldTypeEnums.DIGITAL_INPUT.getType(), CustomFieldTypeEnums.DATE.getType(), CustomFieldTypeEnums.MULTI_TEXT.getType()); |
| | | |
| | | private static /* synthetic */ Object $deserializeLambda$(SerializedLambda lambda) { |
| | | String implMethodName = lambda.getImplMethodName(); |
| | | boolean z = true; |
| | | switch (implMethodName.hashCode()) { |
| | | case -75308287: |
| | | if (implMethodName.equals("getName")) { |
| | | z = false; |
| | | 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/cps/entity/Employee") && 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/core/mp/base/BaseEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getId(); |
| | | }; |
| | | } |
| | | break; |
| | | } |
| | | throw new IllegalArgumentException("Invalid lambda deserialization"); |
| | | } |
| | | |
| | | public ExtendFieldResultParse(final ICustomTemplateFieldService customTemplateFieldService, final IEmployeeService employeeService) { |
| | | this.customTemplateFieldService = customTemplateFieldService; |
| | |
| | | return resultJson; |
| | | } |
| | | JSONObject resJsonObj = JSONUtil.parseObj(resultJson); |
| | | resJsonObj.forEach(fieldCode, value -> { |
| | | resJsonObj.forEach((fieldCode, value) -> { |
| | | if (!showFields.containsKey(fieldCode) || Func.isEmpty(value)) { |
| | | return; |
| | | } |
| | |
| | | return ""; |
| | | } |
| | | JSONObject resObj = JSONUtil.parseObj(resultJson); |
| | | resObj.forEach(fieldCode, value -> { |
| | | resObj.forEach((fieldCode, value) -> { |
| | | if (!editFields.containsKey(fieldCode)) { |
| | | return; |
| | | } |
| | |
| | | if (Func.isEmpty(fieldOptions)) { |
| | | return optionMap; |
| | | } |
| | | optionMap = (Map) fieldOptions.stream().collect(Collectors.toMap(c -> { |
| | | optionMap = fieldOptions.stream().collect(Collectors.toMap(c -> { |
| | | return String.valueOf(c.getId()); |
| | | }, o -> { |
| | | return o; |
| | | }, old, newVal -> { |
| | | }, (old, newVal) -> { |
| | | return old; |
| | | })); |
| | | } |
| | |
| | | private String filedResHandler(CustomTemplateField field, JSONObject resJsonObj) { |
| | | Integer fieldType = field.getFieldType(); |
| | | CustomFieldTypeEnums fieldTypeEnums = CustomFieldTypeEnums.getEnum(fieldType); |
| | | |
| | | switch (fieldTypeEnums) { |
| | | case MULTI_SELECT: |
| | | return multiValueToStr(resJsonObj, field); |
| | | case BUSINESS: |
| | | return businessEmpToStr(resJsonObj, field.getFieldCode()); |
| | | case CASCADE_SELECT: |
| | | return cascadeValueToStr(resJsonObj, field); |
| | | case DIGITAL_INPUT: |
| | | return digitalValueToStr(resJsonObj, field); |
| | | case DROP_DOWN: |
| | | case SELECT: |
| | | return selectValueToStr(resJsonObj, field); |
| | | default: |
| | | return defaultValueToStr(resJsonObj, field); |
| | | } |
| | | |
| | | /* |
| | | switch (AnonymousClass1.$SwitchMap$org$springblade$modules$system$enums$CustomFieldTypeEnums[fieldTypeEnums.ordinal()]) { |
| | | case 1: |
| | | return multiValueToStr(resJsonObj, field); |
| | |
| | | return cascadeValueToStr(resJsonObj, field); |
| | | case 4: |
| | | return digitalValueToStr(resJsonObj, field); |
| | | case RegionCache.VILLAGE_LEVEL /* 5 */: |
| | | case RegionCache.VILLAGE_LEVEL // 5 |
| | | case 6: |
| | | return selectValueToStr(resJsonObj, field); |
| | | default: |
| | | return defaultValueToStr(resJsonObj, field); |
| | | } |
| | | } |
| | | |
| | | /* JADX INFO: Access modifiers changed from: package-private */ |
| | | /* renamed from: org.springblade.modules.system.handler.field.ExtendFieldResultParse$1 reason: invalid class name */ |
| | | /* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/system/handler/field/ExtendFieldResultParse$1.class */ |
| | | public static /* synthetic */ class AnonymousClass1 { |
| | | static final /* synthetic */ int[] $SwitchMap$org$springblade$modules$system$enums$CustomFieldTypeEnums = new int[CustomFieldTypeEnums.values().length]; |
| | | |
| | | static { |
| | | try { |
| | | $SwitchMap$org$springblade$modules$system$enums$CustomFieldTypeEnums[CustomFieldTypeEnums.MULTI_SELECT.ordinal()] = 1; |
| | | } catch (NoSuchFieldError e) { |
| | | } |
| | | try { |
| | | $SwitchMap$org$springblade$modules$system$enums$CustomFieldTypeEnums[CustomFieldTypeEnums.BUSINESS.ordinal()] = 2; |
| | | } catch (NoSuchFieldError e2) { |
| | | } |
| | | try { |
| | | $SwitchMap$org$springblade$modules$system$enums$CustomFieldTypeEnums[CustomFieldTypeEnums.CASCADE_SELECT.ordinal()] = 3; |
| | | } catch (NoSuchFieldError e3) { |
| | | } |
| | | try { |
| | | $SwitchMap$org$springblade$modules$system$enums$CustomFieldTypeEnums[CustomFieldTypeEnums.DIGITAL_INPUT.ordinal()] = 4; |
| | | } catch (NoSuchFieldError e4) { |
| | | } |
| | | try { |
| | | $SwitchMap$org$springblade$modules$system$enums$CustomFieldTypeEnums[CustomFieldTypeEnums.DROP_DOWN.ordinal()] = 5; |
| | | } catch (NoSuchFieldError e5) { |
| | | } |
| | | try { |
| | | $SwitchMap$org$springblade$modules$system$enums$CustomFieldTypeEnums[CustomFieldTypeEnums.SELECT.ordinal()] = 6; |
| | | } catch (NoSuchFieldError e6) { |
| | | } |
| | | } |
| | | }*/ |
| | | } |
| | | |
| | | private String defaultValueToStr(JSONObject resJsonObj, CustomTemplateField field) { |
| | |
| | | if (empList.size() < 2) { |
| | | return ""; |
| | | } |
| | | Employee employee = this.employeeService.getOne(Wrappers.<Employee>lambdaQuery().eq(Employee::getId, empList.get(empList.size() - 1)) |
| | | .select(Employee::getName)); |
| | | /* |
| | | Employee employee = (Employee) this.employeeService.getOne(((LambdaQueryWrapper) Wrappers.lambdaQuery().eq((v0) -> { |
| | | return v0.getId(); |
| | | }, empList.get(empList.size() - 1))).select(new SFunction[]{(v0) -> { |
| | | return v0.getName(); |
| | | }})); |
| | | }}));*/ |
| | | if (Func.isEmpty(employee) || Func.isEmpty(employee.getName())) { |
| | | return ""; |
| | | } |