| | |
| | | package com.qianwen.smartman.modules.system.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.convert.Convert; |
| | | import cn.hutool.core.lang.Snowflake; |
| | | import cn.hutool.core.util.IdUtil; |
| | | import cn.hutool.json.JSONArray; |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import java.lang.invoke.SerializedLambda; |
| | | import java.math.BigDecimal; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | |
| | | import java.util.Map; |
| | | import java.util.regex.Pattern; |
| | | import java.util.stream.Collectors; |
| | | import com.qianwen.smartman.common.cache.RegionCache; |
| | | import com.qianwen.smartman.common.constant.CommonConstant; |
| | | import com.qianwen.smartman.common.constant.DncConstant; |
| | | 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.toolkit.Wrappers; |
| | | import com.qianwen.core.log.exception.ServiceException; |
| | | import com.qianwen.core.mp.base.BaseServiceImpl; |
| | | import com.qianwen.core.redis.cache.BladeRedis; |
| | |
| | | import com.qianwen.core.tool.api.R; |
| | | import com.qianwen.core.tool.utils.Func; |
| | | import com.qianwen.core.tool.utils.StringUtil; |
| | | import com.qianwen.smartman.common.constant.CommonConstant; |
| | | import com.qianwen.smartman.common.constant.DncConstant; |
| | | import com.qianwen.smartman.common.utils.MessageUtils; |
| | | import com.qianwen.smartman.modules.cps.entity.Employee; |
| | | import com.qianwen.smartman.modules.cps.service.IEmployeeService; |
| | | import com.qianwen.smartman.modules.cps.vo.HierarchyVO; |
| | |
| | | import com.qianwen.smartman.modules.system.entity.CustomTemplate; |
| | | import com.qianwen.smartman.modules.system.entity.CustomTemplateField; |
| | | import com.qianwen.smartman.modules.system.entity.CustomTemplateFieldOption; |
| | | import com.qianwen.smartman.modules.system.entity.CustomTemplateFieldRelation; |
| | | import com.qianwen.smartman.modules.system.enums.ConfigTypeEnum; |
| | | import com.qianwen.smartman.modules.system.enums.CustomFieldTypeEnums; |
| | | import com.qianwen.smartman.modules.system.mapper.CustomTemplateFieldMapper; |
| | |
| | | import com.qianwen.smartman.modules.system.vo.CustomTemplateFieldListVO; |
| | | import com.qianwen.smartman.modules.system.vo.CustomTemplateFieldSubmitVO; |
| | | import com.qianwen.smartman.modules.system.vo.CustomTemplateFieldUpdateVO; |
| | | 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 cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.convert.Convert; |
| | | import cn.hutool.core.lang.Snowflake; |
| | | import cn.hutool.core.util.IdUtil; |
| | | import cn.hutool.json.JSONArray; |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.hutool.json.JSONUtil; |
| | | |
| | | @Service |
| | | /* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/system/service/impl/CustomTemplateFieldServiceImpl.class */ |
| | | public class CustomTemplateFieldServiceImpl extends BaseServiceImpl<CustomTemplateFieldMapper, CustomTemplateField> implements ICustomTemplateFieldService { |
| | | @Autowired |
| | | private ICustomTemplateFieldOptionService customTemplateFieldOptionService; |
| | |
| | | @Autowired |
| | | private BladeRedis bladeRedis; |
| | | |
| | | private static /* synthetic */ Object $deserializeLambda$(SerializedLambda lambda) { |
| | | String implMethodName = lambda.getImplMethodName(); |
| | | boolean z = true; |
| | | switch (implMethodName.hashCode()) { |
| | | case 98245393: |
| | | if (implMethodName.equals("getId")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case 175607679: |
| | | if (implMethodName.equals("getFieldId")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case 771206363: |
| | | if (implMethodName.equals("getTenantId")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case 953775504: |
| | | if (implMethodName.equals("getBusinessType")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case 977687216: |
| | | if (implMethodName.equals("getJobNumber")) { |
| | | z = false; |
| | | break; |
| | | } |
| | | break; |
| | | case 1255090001: |
| | | if (implMethodName.equals("getFieldCode")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case 1255404527: |
| | | if (implMethodName.equals("getFieldName")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case 1255606430: |
| | | if (implMethodName.equals("getFieldType")) { |
| | | 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.getJobNumber(); |
| | | }; |
| | | } |
| | | 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/CustomTemplateFieldOption") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getFieldId(); |
| | | }; |
| | | } |
| | | 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/CustomTemplateFieldOption") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getFieldId(); |
| | | }; |
| | | } |
| | | 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/CustomTemplateFieldOption") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getFieldId(); |
| | | }; |
| | | } |
| | | 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/CustomTemplateFieldOption") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getFieldId(); |
| | | }; |
| | | } |
| | | 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/CustomTemplateFieldRelation") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getFieldId(); |
| | | }; |
| | | } |
| | | 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/CustomTemplateField") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) { |
| | | return (v0) -> { |
| | | return v0.getFieldType(); |
| | | }; |
| | | } |
| | | 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/CustomTemplateField") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) { |
| | | return (v0) -> { |
| | | return v0.getBusinessType(); |
| | | }; |
| | | } |
| | | 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/CustomTemplateField") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) { |
| | | return (v0) -> { |
| | | return v0.getBusinessType(); |
| | | }; |
| | | } |
| | | 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(); |
| | | }; |
| | | } |
| | | 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(); |
| | | }; |
| | | } |
| | | 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 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/modules/system/entity/CustomTemplateField") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { |
| | | return (v0) -> { |
| | | return v0.getTenantId(); |
| | | }; |
| | | } |
| | | 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/CustomTemplateField") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { |
| | | return (v0) -> { |
| | | return v0.getFieldName(); |
| | | }; |
| | | } |
| | | 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/CustomTemplateField") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { |
| | | return (v0) -> { |
| | | return v0.getFieldCode(); |
| | | }; |
| | | } |
| | | break; |
| | | } |
| | | throw new IllegalArgumentException("Invalid lambda deserialization"); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.system.service.ICustomTemplateFieldService |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public CustomTemplateField saveField(CustomTemplateFieldSubmitVO customTemplateFieldSubmitVO) { |
| | |
| | | this.customTemplateFieldOptionService.saveBatch(customTemplateFieldOptions); |
| | | propertyJson.remove(FieldConstant.OPTION_NAME); |
| | | if (fieldType.equals(CustomFieldTypeEnums.SELECT.getType()) || fieldType.equals(CustomFieldTypeEnums.MULTI_SELECT.getType())) { |
| | | Map<String, String> optionMap = (Map) customTemplateFieldOptions.stream().collect(Collectors.toMap(c -> { |
| | | return c.getKey() + SystemPropertyUtils.VALUE_SEPARATOR + c.getValue(); |
| | | Map<String, String> optionMap = customTemplateFieldOptions.stream().collect(Collectors.toMap(c -> { |
| | | return c.getKey() + ":" + c.getValue(); |
| | | }, c2 -> { |
| | | return String.valueOf(c2.getId()); |
| | | })); |
| | |
| | | private String getOptionIdByDefaultValue(String defaultValue, List<OptionBean> optionBeans, Map<String, String> optionMap) { |
| | | for (OptionBean option : optionBeans) { |
| | | if (option.getValue().equals(defaultValue)) { |
| | | return optionMap.get(option.getValue() + SystemPropertyUtils.VALUE_SEPARATOR + option.getLabel()); |
| | | return optionMap.get(option.getValue() + ":" + option.getLabel()); |
| | | } |
| | | } |
| | | return ""; |
| | |
| | | Snowflake snowflake = IdUtil.getSnowflake(1L, 1L); |
| | | JSONArray optionArray = propertyJson.getJSONArray(FieldConstant.OPTION_NAME); |
| | | if (optionArray.isEmpty()) { |
| | | return new ArrayList(); |
| | | return new ArrayList<>(); |
| | | } |
| | | return parseOptionJsonToBean(optionArray, fieldId, snowflake, FieldConstant.PARENT_ID); |
| | | } |
| | |
| | | if (!checkRemove(ids)) { |
| | | throw new ServiceException(MessageUtils.message("template.field.use.not.remove", new Object[0])); |
| | | } |
| | | List<CustomTemplateField> fields = list(Wrappers.<CustomTemplateField>lambdaQuery().in(CustomTemplateField::getId, ids).in((ids.size() != 1), CustomTemplateField::getFieldType, CUSTOM_FIELD_TYPE_LIST)); |
| | | /* |
| | | List<CustomTemplateField> fields = list(((LambdaQueryWrapper) Wrappers.lambdaQuery().in((v0) -> { |
| | | return v0.getId(); |
| | | }, ids)).in(ids.size() != 1, (v0) -> { |
| | | return v0.getFieldType(); |
| | | }, CUSTOM_FIELD_TYPE_LIST)); |
| | | }, CUSTOM_FIELD_TYPE_LIST));*/ |
| | | if (CollectionUtil.isNotEmpty(fields)) { |
| | | this.customTemplateFieldOptionService.remove(Wrappers.<CustomTemplateFieldOption>lambdaQuery().in(CustomTemplateFieldOption::getFieldId, ids)); |
| | | /* |
| | | this.customTemplateFieldOptionService.remove((Wrapper) Wrappers.lambdaQuery().in((v0) -> { |
| | | return v0.getFieldId(); |
| | | }, ids)); |
| | | }, ids));*/ |
| | | } |
| | | fields.forEach(field -> { |
| | | this.bladeRedis.del(FieldConstant.getFieldCacheKey(field.getFieldCode(), field.getBusinessType())); |
| | |
| | | |
| | | @Override // org.springblade.modules.system.service.ICustomTemplateFieldService |
| | | public CustomFieldRelationSelectVO getSelectBox(Long templateId, Integer configType) { |
| | | CustomTemplate customTemplate = this.customTemplateService.getOne(Wrappers.<CustomTemplate>lambdaQuery().eq(CustomTemplate::getId, templateId)); |
| | | /* |
| | | CustomTemplate customTemplate = (CustomTemplate) this.customTemplateService.getOne((Wrapper) Wrappers.lambdaQuery().eq((v0) -> { |
| | | return v0.getId(); |
| | | }, templateId)); |
| | | }, templateId));*/ |
| | | List<CustomTemplateColumnDTO> columnDTOList = fieldsOptionBeanToJson(CustomTemplateFieldConvert.INSTANCE.convertColumn(this.customTemplateFieldMapper.getSelectBox(customTemplate.getBusinessType(), templateId, configType))); |
| | | List<CustomFieldRelationInfoVO> result = CustomTemplateFieldConvert.INSTANCE.convertRelationInfos(columnDTOList); |
| | | CustomFieldRelationSelectVO customFieldRelationSelectVO = new CustomFieldRelationSelectVO(); |
| | | if (Func.isNotEmpty(result)) { |
| | | Map<Integer, List<CustomFieldRelationInfoVO>> groupResult = (Map) result.stream().collect(Collectors.groupingBy((v0) -> { |
| | | Map<Integer, List<CustomFieldRelationInfoVO>> groupResult = result.stream().collect(Collectors.groupingBy((v0) -> { |
| | | return v0.getSystemField(); |
| | | })); |
| | | customFieldRelationSelectVO.setCustomFieldList(groupResult.get(0)); |
| | |
| | | List<CustomTemplateFieldListVO> customTemplateFieldListVOS = this.customTemplateFieldMapper.listField(templateId, configType); |
| | | CustomFieldRelationListVO customFieldRelationListVO = new CustomFieldRelationListVO(); |
| | | if (Func.isNotEmpty(customTemplateFieldListVOS)) { |
| | | Map<Integer, List<CustomTemplateFieldListVO>> groupResult = (Map) customTemplateFieldListVOS.stream().collect(Collectors.groupingBy((v0) -> { |
| | | Map<Integer, List<CustomTemplateFieldListVO>> groupResult = customTemplateFieldListVOS.stream().collect(Collectors.groupingBy((v0) -> { |
| | | return v0.getSystemField(); |
| | | })); |
| | | customFieldRelationListVO.setCustomFieldList(groupResult.get(0)); |
| | |
| | | if (!CUSTOM_FIELD_TYPE_LIST.contains(customTemplateField.getFieldType())) { |
| | | return; |
| | | } |
| | | List<CustomTemplateFieldOption> templateFieldOptions = this.customTemplateFieldOptionService.list(Wrappers.<CustomTemplateFieldOption>lambdaQuery().eq(CustomTemplateFieldOption::getFieldId, customTemplateField.getId())); |
| | | /* |
| | | List<CustomTemplateFieldOption> templateFieldOptions = this.customTemplateFieldOptionService.list((Wrapper) Wrappers.lambdaQuery().eq((v0) -> { |
| | | return v0.getFieldId(); |
| | | }, customTemplateField.getId())); |
| | | }, customTemplateField.getId()));*/ |
| | | if (CollectionUtil.isEmpty(templateFieldOptions)) { |
| | | return; |
| | | } |
| | |
| | | String propJson = customTemplateField.getPropertyJson(); |
| | | if (Func.isEmpty(value)) { |
| | | if (fieldType.equals(CustomFieldTypeEnums.MULTI_SELECT.getType()) || fieldType.equals(CustomFieldTypeEnums.CASCADE_SELECT.getType())) { |
| | | return new ArrayList(); |
| | | return new ArrayList<>(); |
| | | } |
| | | return ""; |
| | | } |
| | |
| | | if (Func.isEmpty(customTemplateField)) { |
| | | throw new RuntimeException(customTemplateField.getFieldName() + "导入字段不存在"); |
| | | } |
| | | Map<String, CustomTemplateFieldOption> transMap = (Map) customTemplateField.getOptionList().stream().collect(Collectors.toMap((v0) -> { |
| | | Map<String, CustomTemplateFieldOption> transMap = customTemplateField.getOptionList().stream().collect(Collectors.toMap((v0) -> { |
| | | return v0.getValue(); |
| | | }, o -> { |
| | | return o; |
| | |
| | | if (Func.isEmpty(customTemplateField)) { |
| | | throw new RuntimeException(customTemplateField.getFieldName() + "导入字段不存在"); |
| | | } |
| | | Map<String, CustomTemplateFieldOption> transMap2 = (Map) customTemplateField.getOptionList().stream().collect(Collectors.toMap((v0) -> { |
| | | Map<String, CustomTemplateFieldOption> transMap2 = customTemplateField.getOptionList().stream().collect(Collectors.toMap((v0) -> { |
| | | return v0.getValue(); |
| | | }, o2 -> { |
| | | return o2; |
| | |
| | | if (Func.isEmpty(customTemplateField)) { |
| | | throw new RuntimeException(customTemplateField.getFieldName() + "导入字段不存在"); |
| | | } |
| | | Map<String, CustomTemplateFieldOption> transMap3 = (Map) customTemplateField.getOptionList().stream().collect(Collectors.toMap((v0) -> { |
| | | Map<String, CustomTemplateFieldOption> transMap3 = customTemplateField.getOptionList().stream().collect(Collectors.toMap((v0) -> { |
| | | return v0.getValue(); |
| | | }, o3 -> { |
| | | return o3; |
| | |
| | | throw new RuntimeException(customTemplateField.getFieldName() + "导入字段不存在"); |
| | | } |
| | | List<CustomTemplateFieldOption> customTemplateFieldOptions = customTemplateField.getOptionList(); |
| | | Map<String, CustomTemplateFieldOption> parentMap = (Map) customTemplateFieldOptions.stream().filter(o4 -> { |
| | | Map<String, CustomTemplateFieldOption> parentMap = customTemplateFieldOptions.stream().filter(o4 -> { |
| | | return o4.getParentId().equals(0L); |
| | | }).collect(Collectors.toMap((v0) -> { |
| | | return v0.getValue(); |
| | |
| | | if (parentMap.containsKey(values[0])) { |
| | | CustomTemplateFieldOption pCustomTemplateFieldOption = parentMap.get(values[0]); |
| | | optionIds2.add(String.valueOf(pCustomTemplateFieldOption.getId())); |
| | | Map<String, CustomTemplateFieldOption> childMap = (Map) customTemplateFieldOptions.stream().filter(o6 -> { |
| | | Map<String, CustomTemplateFieldOption> childMap = customTemplateFieldOptions.stream().filter(o6 -> { |
| | | return o6.getParentId().equals(pCustomTemplateFieldOption.getId()); |
| | | }).collect(Collectors.toMap((v0) -> { |
| | | return v0.getValue(); |
| | |
| | | throw new RuntimeException(customTemplateField.getFieldName() + "输入内容在选项值中不存在"); |
| | | } |
| | | } else if (fieldType.equals(CustomFieldTypeEnums.BUSINESS.getType())) { |
| | | Employee employee = this.employeeService.getOne(Wrappers.<Employee>lambdaQuery().eq(Employee::getJobNumber, value)); |
| | | /* |
| | | Employee employee = (Employee) this.employeeService.getOne((Wrapper) Wrappers.lambdaQuery().eq((v0) -> { |
| | | return v0.getJobNumber(); |
| | | }, value)); |
| | | }, value));*/ |
| | | if (Func.isEmpty(employee)) { |
| | | throw new RuntimeException(customTemplateField.getFieldName() + "员工不存在"); |
| | | } |
| | |
| | | if (Func.isEmpty(fieldCode)) { |
| | | return null; |
| | | } |
| | | CustomTemplateField customTemplateField = getOne(Wrappers.<CustomTemplateField>lambdaQuery().eq(CustomTemplateField::getFieldCode, fieldCode).eq(CustomTemplateField::getBusinessType, busType)); |
| | | /* |
| | | CustomTemplateField customTemplateField = (CustomTemplateField) getOne((Wrapper) ((LambdaQueryWrapper) Wrappers.lambdaQuery().eq((v0) -> { |
| | | return v0.getFieldCode(); |
| | | }, fieldCode)).eq((v0) -> { |
| | | return v0.getBusinessType(); |
| | | }, busType)); |
| | | }, busType));*/ |
| | | if (Func.isEmpty(customTemplateField)) { |
| | | customTemplateField = new CustomTemplateField(1); |
| | | } |
| | | if (CUSTOM_FIELD_TYPE_LIST.contains(customTemplateField.getFieldType())) { |
| | | optionFieldHandler(customTemplateField); |
| | | List<CustomTemplateFieldOption> templateFieldOptions = this.customTemplateFieldOptionService.list(Wrappers.<CustomTemplateFieldOption>lambdaQuery().eq(CustomTemplateFieldOption::getFieldId, customTemplateField.getId())); |
| | | /* |
| | | List<CustomTemplateFieldOption> templateFieldOptions = this.customTemplateFieldOptionService.list((Wrapper) Wrappers.lambdaQuery().eq((v0) -> { |
| | | return v0.getFieldId(); |
| | | }, customTemplateField.getId())); |
| | | }, customTemplateField.getId()));*/ |
| | | customTemplateField.setOptionList(templateFieldOptions); |
| | | } |
| | | this.bladeRedis.setEx(FieldConstant.getFieldCacheKey(fieldCode, busType), customTemplateField, FieldConstant.CACHE_TIMEOUT); |
| | |
| | | return v0.getFieldCode(); |
| | | }, o -> { |
| | | return o; |
| | | }, o2, n -> { |
| | | }, (o2, n) -> { |
| | | return o2; |
| | | })); |
| | | result.forEach(r -> { |
| | |
| | | if (Func.isEmpty(result)) { |
| | | return result; |
| | | } |
| | | List<CustomTemplateColumnDTO> optionFields = (List) result.stream().filter(field -> { |
| | | List<CustomTemplateColumnDTO> optionFields = result.stream().filter(field -> { |
| | | return CUSTOM_FIELD_TYPE_LIST.contains(field.getFieldType()); |
| | | }).collect(Collectors.toList()); |
| | | if (Func.isEmpty(optionFields)) { |
| | | return result; |
| | | } |
| | | List<Long> ids = (List) optionFields.stream().map((v0) -> { |
| | | List<Long> ids = optionFields.stream().map((v0) -> { |
| | | return v0.getFieldId(); |
| | | }).collect(Collectors.toList()); |
| | | List<CustomTemplateFieldOption> templateFieldOptions = this.customTemplateFieldOptionService.list(Wrappers.<CustomTemplateFieldOption>lambdaQuery().in(CustomTemplateFieldOption::getFieldId, ids)); |
| | | /* |
| | | List<CustomTemplateFieldOption> templateFieldOptions = this.customTemplateFieldOptionService.list((Wrapper) Wrappers.lambdaQuery().in((v0) -> { |
| | | return v0.getFieldId(); |
| | | }, ids)); |
| | | Map<Long, List<CustomTemplateFieldOption>> optionMap = (Map) templateFieldOptions.stream().collect(Collectors.groupingBy((v0) -> { |
| | | }, ids));*/ |
| | | Map<Long, List<CustomTemplateFieldOption>> optionMap = templateFieldOptions.stream().collect(Collectors.groupingBy((v0) -> { |
| | | return v0.getFieldId(); |
| | | })); |
| | | result.forEach(field2 -> { |
| | | List<CustomTemplateFieldOption> customTemplateFieldOptions = (List) optionMap.get(field2.getFieldId()); |
| | | List<CustomTemplateFieldOption> customTemplateFieldOptions = optionMap.get(field2.getFieldId()); |
| | | if (CollectionUtil.isEmpty(customTemplateFieldOptions)) { |
| | | return; |
| | | } |
| | |
| | | |
| | | private static List<OptionBean> parseOptionBeanToJson(List<CustomTemplateFieldOption> options, Long parentId) { |
| | | List<OptionBean> result = new ArrayList<>(); |
| | | List<CustomTemplateFieldOption> parentOptions = (List) options.stream().filter(o -> { |
| | | List<CustomTemplateFieldOption> parentOptions = options.stream().filter(o -> { |
| | | return o.getParentId().equals(parentId); |
| | | }).collect(Collectors.toList()); |
| | | if (CollectionUtil.isEmpty(parentOptions)) { |
| | |
| | | } |
| | | |
| | | private boolean checkNameIsExist(Long id, String name, Integer businessType) { |
| | | List<CustomTemplateField> result = this.baseMapper.selectList(Wrappers.<CustomTemplateField>query().lambda() |
| | | .eq(Func.isNotEmpty(AuthUtil.getTenantId()), CustomTemplateField::getTenantId, AuthUtil.getTenantId()) |
| | | .eq(Func.isNotBlank(name), CustomTemplateField::getFieldName, name) |
| | | .eq(Func.isNotEmpty(businessType), CustomTemplateField::getBusinessType, businessType) |
| | | .ne(Func.isNotEmpty(id), CustomTemplateField::getId, id)); |
| | | /* |
| | | List<CustomTemplateField> result = ((CustomTemplateFieldMapper) this.baseMapper).selectList(Wrappers.query().lambda().eq(Func.isNotEmpty(AuthUtil.getTenantId()), (v0) -> { |
| | | return v0.getTenantId(); |
| | | }, AuthUtil.getTenantId()).eq(Func.isNotBlank(name), (v0) -> { |
| | |
| | | return v0.getBusinessType(); |
| | | }, businessType).ne(Func.isNotEmpty(id), (v0) -> { |
| | | return v0.getId(); |
| | | }, id)); |
| | | }, id));*/ |
| | | return result != null && result.size() > 0; |
| | | } |
| | | |
| | | private boolean checkRemove(List<Long> ids) { |
| | | long count = this.customTemplateFieldRelationService.count(Wrappers.<CustomTemplateFieldRelation>lambdaQuery().in(CustomTemplateFieldRelation::getFieldId, ids)); |
| | | /* |
| | | long count = this.customTemplateFieldRelationService.count((Wrapper) Wrappers.lambdaQuery().in((v0) -> { |
| | | return v0.getFieldId(); |
| | | }, ids)); |
| | | }, ids));*/ |
| | | return count <= 0; |
| | | } |
| | | } |