Commit b4ab90d8402ee42fe68e41aeb3ac6a0a91950a77
1 parent
31863474
refactor(core): 升级Spring Boot至4.0.0并替换Jackson为Tools Jackson
- 将Spring Boot版本从3.5.7升级到4.0.0 - 替换com.fasterxml.jackson依赖为tools.jackson - 更新MyBatis Plus starter为spring-boot4-starter版本 - 修改JsonUtils工具类以适配新的Jackson包路径 - 更新全局异常处理器中的异常类型引用 - 调整相关模块的依赖配置和导入语句 - 升级MyBatis Plus版本至3.5.15 - 更新阿里云Spring Cloud版本至2025.0.0.0
Showing
12 changed files
with
90 additions
and
80 deletions
pom.xml
| @@ -27,11 +27,11 @@ | @@ -27,11 +27,11 @@ | ||
| 27 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | 27 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
| 28 | <!-- Spring相关版本 --> | 28 | <!-- Spring相关版本 --> |
| 29 | <spring-cloud.version>2025.0.0</spring-cloud.version> | 29 | <spring-cloud.version>2025.0.0</spring-cloud.version> |
| 30 | - <spring-boot.version>3.5.7</spring-boot.version> | ||
| 31 | - <alibaba.cloud.version>2023.0.3.4</alibaba.cloud.version> | 30 | + <spring-boot.version>4.0.0</spring-boot.version> |
| 31 | + <alibaba.cloud.version>2025.0.0.0</alibaba.cloud.version> | ||
| 32 | <!-- 数据库相关 --> | 32 | <!-- 数据库相关 --> |
| 33 | <mysql-connector.version>9.4.0</mysql-connector.version> | 33 | <mysql-connector.version>9.4.0</mysql-connector.version> |
| 34 | - <mybatis-plus.version>3.5.14</mybatis-plus.version> | 34 | + <mybatis-plus.version>3.5.15</mybatis-plus.version> |
| 35 | <!-- 工具类库 --> | 35 | <!-- 工具类库 --> |
| 36 | <lombok.version>1.18.42</lombok.version> | 36 | <lombok.version>1.18.42</lombok.version> |
| 37 | <poi.version>5.5.0</poi.version> | 37 | <poi.version>5.5.0</poi.version> |
| @@ -41,7 +41,7 @@ | @@ -41,7 +41,7 @@ | ||
| 41 | <dependencies> | 41 | <dependencies> |
| 42 | <dependency> | 42 | <dependency> |
| 43 | <groupId>com.baomidou</groupId> | 43 | <groupId>com.baomidou</groupId> |
| 44 | - <artifactId>mybatis-plus-spring-boot3-starter</artifactId> | 44 | + <artifactId>mybatis-plus-spring-boot4-starter</artifactId> |
| 45 | <version>${mybatis-plus.version}</version> | 45 | <version>${mybatis-plus.version}</version> |
| 46 | </dependency> | 46 | </dependency> |
| 47 | <dependency> | 47 | <dependency> |
tax-adopt/src/main/java/com/diligrp/tax/adopt/service/impl/AdoptMessageServiceImpl.java
| @@ -14,7 +14,7 @@ import com.diligrp.tax.central.service.ITenantService; | @@ -14,7 +14,7 @@ import com.diligrp.tax.central.service.ITenantService; | ||
| 14 | import com.diligrp.tax.central.type.TaxSystemType; | 14 | import com.diligrp.tax.central.type.TaxSystemType; |
| 15 | import com.diligrp.tax.central.utils.AdoptUtils; | 15 | import com.diligrp.tax.central.utils.AdoptUtils; |
| 16 | import com.diligrp.tax.central.utils.JsonUtils; | 16 | import com.diligrp.tax.central.utils.JsonUtils; |
| 17 | -import com.fasterxml.jackson.core.type.TypeReference; | 17 | + |
| 18 | import lombok.AllArgsConstructor; | 18 | import lombok.AllArgsConstructor; |
| 19 | import lombok.extern.slf4j.Slf4j; | 19 | import lombok.extern.slf4j.Slf4j; |
| 20 | import org.apache.commons.io.FilenameUtils; | 20 | import org.apache.commons.io.FilenameUtils; |
| @@ -24,6 +24,7 @@ import org.springframework.amqp.rabbit.core.RabbitTemplate; | @@ -24,6 +24,7 @@ import org.springframework.amqp.rabbit.core.RabbitTemplate; | ||
| 24 | import org.springframework.stereotype.Service; | 24 | import org.springframework.stereotype.Service; |
| 25 | import org.springframework.util.CollectionUtils; | 25 | import org.springframework.util.CollectionUtils; |
| 26 | import org.springframework.web.multipart.MultipartFile; | 26 | import org.springframework.web.multipart.MultipartFile; |
| 27 | +import tools.jackson.core.type.TypeReference; | ||
| 27 | 28 | ||
| 28 | import java.io.IOException; | 29 | import java.io.IOException; |
| 29 | import java.util.List; | 30 | import java.util.List; |
tax-central/src/main/java/com/diligrp/tax/central/config/GlobalExceptionHandler.java
| @@ -3,7 +3,6 @@ package com.diligrp.tax.central.config; | @@ -3,7 +3,6 @@ package com.diligrp.tax.central.config; | ||
| 3 | import com.diligrp.tax.central.exception.TaxAgentServiceException; | 3 | import com.diligrp.tax.central.exception.TaxAgentServiceException; |
| 4 | import com.diligrp.tax.central.message.Message; | 4 | import com.diligrp.tax.central.message.Message; |
| 5 | import com.diligrp.tax.central.type.TaxSystemType; | 5 | import com.diligrp.tax.central.type.TaxSystemType; |
| 6 | -import com.fasterxml.jackson.databind.exc.InvalidFormatException; | ||
| 7 | import jakarta.validation.ConstraintViolation; | 6 | import jakarta.validation.ConstraintViolation; |
| 8 | import jakarta.validation.ConstraintViolationException; | 7 | import jakarta.validation.ConstraintViolationException; |
| 9 | import lombok.extern.slf4j.Slf4j; | 8 | import lombok.extern.slf4j.Slf4j; |
| @@ -16,6 +15,7 @@ import org.springframework.web.bind.MethodArgumentNotValidException; | @@ -16,6 +15,7 @@ import org.springframework.web.bind.MethodArgumentNotValidException; | ||
| 16 | import org.springframework.web.bind.MissingServletRequestParameterException; | 15 | import org.springframework.web.bind.MissingServletRequestParameterException; |
| 17 | import org.springframework.web.bind.annotation.ExceptionHandler; | 16 | import org.springframework.web.bind.annotation.ExceptionHandler; |
| 18 | import org.springframework.web.bind.annotation.RestControllerAdvice; | 17 | import org.springframework.web.bind.annotation.RestControllerAdvice; |
| 18 | +import tools.jackson.core.JacksonException; | ||
| 19 | 19 | ||
| 20 | import java.util.List; | 20 | import java.util.List; |
| 21 | import java.util.Set; | 21 | import java.util.Set; |
| @@ -42,7 +42,7 @@ public class GlobalExceptionHandler { | @@ -42,7 +42,7 @@ public class GlobalExceptionHandler { | ||
| 42 | * @param ex InvalidFormatException | 42 | * @param ex InvalidFormatException |
| 43 | * @return 响应消息对象 | 43 | * @return 响应消息对象 |
| 44 | */ | 44 | */ |
| 45 | - @ExceptionHandler({HttpMessageNotReadableException.class, InvalidFormatException.class}) | 45 | + @ExceptionHandler({HttpMessageNotReadableException.class, JacksonException.class}) |
| 46 | public Message<?> invalidFormatExceptionHandler(Exception ex) { | 46 | public Message<?> invalidFormatExceptionHandler(Exception ex) { |
| 47 | return Message.failure(TaxSystemType.ABNORMAL_PARAMETERS.code, ex.getMessage()); | 47 | return Message.failure(TaxSystemType.ABNORMAL_PARAMETERS.code, ex.getMessage()); |
| 48 | } | 48 | } |
tax-central/src/main/java/com/diligrp/tax/central/type/DocumentFieldType.java
| @@ -3,7 +3,7 @@ package com.diligrp.tax.central.type; | @@ -3,7 +3,7 @@ package com.diligrp.tax.central.type; | ||
| 3 | import com.diligrp.tax.central.model.PipelineBusinessKeywordDO; | 3 | import com.diligrp.tax.central.model.PipelineBusinessKeywordDO; |
| 4 | import com.diligrp.tax.central.utils.JsonPathUtils; | 4 | import com.diligrp.tax.central.utils.JsonPathUtils; |
| 5 | import com.diligrp.tax.central.utils.JsonUtils; | 5 | import com.diligrp.tax.central.utils.JsonUtils; |
| 6 | -import com.fasterxml.jackson.core.type.TypeReference; | 6 | +import tools.jackson.core.type.TypeReference; |
| 7 | 7 | ||
| 8 | import java.util.*; | 8 | import java.util.*; |
| 9 | 9 |
tax-central/src/main/java/com/diligrp/tax/central/utils/JsonPathUtils.java
| @@ -2,8 +2,8 @@ package com.diligrp.tax.central.utils; | @@ -2,8 +2,8 @@ package com.diligrp.tax.central.utils; | ||
| 2 | 2 | ||
| 3 | import com.diligrp.tax.central.exception.TaxAgentServiceException; | 3 | import com.diligrp.tax.central.exception.TaxAgentServiceException; |
| 4 | import com.diligrp.tax.central.type.TaxSystemType; | 4 | import com.diligrp.tax.central.type.TaxSystemType; |
| 5 | -import com.fasterxml.jackson.core.type.TypeReference; | ||
| 6 | import com.jayway.jsonpath.JsonPath; | 5 | import com.jayway.jsonpath.JsonPath; |
| 6 | +import tools.jackson.core.type.TypeReference; | ||
| 7 | 7 | ||
| 8 | import java.util.HashMap; | 8 | import java.util.HashMap; |
| 9 | import java.util.Map; | 9 | import java.util.Map; |
tax-central/src/main/java/com/diligrp/tax/central/utils/JsonUtils.java
| 1 | package com.diligrp.tax.central.utils; | 1 | package com.diligrp.tax.central.utils; |
| 2 | 2 | ||
| 3 | import com.fasterxml.jackson.annotation.JsonInclude; | 3 | import com.fasterxml.jackson.annotation.JsonInclude; |
| 4 | -import com.fasterxml.jackson.core.JsonProcessingException; | ||
| 5 | -import com.fasterxml.jackson.core.type.TypeReference; | ||
| 6 | -import com.fasterxml.jackson.databind.DeserializationFeature; | ||
| 7 | -import com.fasterxml.jackson.databind.JavaType; | ||
| 8 | -import com.fasterxml.jackson.databind.ObjectMapper; | ||
| 9 | -import com.fasterxml.jackson.databind.SerializationFeature; | ||
| 10 | -import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer; | ||
| 11 | -import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; | ||
| 12 | -import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer; | ||
| 13 | -import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer; | ||
| 14 | -import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; | ||
| 15 | -import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer; | ||
| 16 | -import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; | 4 | +import tools.jackson.core.JacksonException; |
| 5 | +import tools.jackson.databind.DeserializationFeature; | ||
| 6 | +import tools.jackson.databind.SerializationFeature; | ||
| 7 | +import tools.jackson.databind.cfg.DateTimeFeature; | ||
| 8 | +import tools.jackson.databind.cfg.EnumFeature; | ||
| 9 | +import tools.jackson.databind.ext.javatime.deser.LocalDateDeserializer; | ||
| 10 | +import tools.jackson.databind.ext.javatime.deser.LocalDateTimeDeserializer; | ||
| 11 | +import tools.jackson.databind.ext.javatime.deser.LocalTimeDeserializer; | ||
| 12 | +import tools.jackson.databind.ext.javatime.ser.LocalDateSerializer; | ||
| 13 | +import tools.jackson.databind.ext.javatime.ser.LocalDateTimeSerializer; | ||
| 14 | +import tools.jackson.databind.ext.javatime.ser.LocalTimeSerializer; | ||
| 15 | +import tools.jackson.databind.json.JsonMapper; | ||
| 16 | +import tools.jackson.databind.module.SimpleModule; | ||
| 17 | 17 | ||
| 18 | import java.text.SimpleDateFormat; | 18 | import java.text.SimpleDateFormat; |
| 19 | import java.time.LocalDate; | 19 | import java.time.LocalDate; |
| @@ -24,100 +24,109 @@ import java.time.format.DateTimeFormatter; | @@ -24,100 +24,109 @@ import java.time.format.DateTimeFormatter; | ||
| 24 | import java.util.TimeZone; | 24 | import java.util.TimeZone; |
| 25 | 25 | ||
| 26 | public class JsonUtils { | 26 | public class JsonUtils { |
| 27 | - | ||
| 28 | private static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; | 27 | private static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; |
| 29 | 28 | ||
| 30 | private static final String DATE_FORMAT = "yyyy-MM-dd"; | 29 | private static final String DATE_FORMAT = "yyyy-MM-dd"; |
| 31 | 30 | ||
| 32 | private static final String TIME_FORMAT = "HH:mm:ss"; | 31 | private static final String TIME_FORMAT = "HH:mm:ss"; |
| 33 | 32 | ||
| 34 | - private static final ObjectMapper objectMapper = initObjectMapper(); | ||
| 35 | - | ||
| 36 | - private static ObjectMapper initObjectMapper() { | ||
| 37 | - Jackson2ObjectMapperBuilder jackson2ObjectMapperBuilder = new Jackson2ObjectMapperBuilder(); | ||
| 38 | - initObjectMapperBuilder(jackson2ObjectMapperBuilder); | ||
| 39 | - ObjectMapper objectMapper = jackson2ObjectMapperBuilder.createXmlMapper(false).build(); | ||
| 40 | - objectMapper.setSerializerFactory(objectMapper.getSerializerFactory()); | ||
| 41 | - return objectMapper; | ||
| 42 | - } | ||
| 43 | 33 | ||
| 44 | - public static void initObjectMapperBuilder(Jackson2ObjectMapperBuilder builder) { | ||
| 45 | - //序列化java.util.Date类型 | ||
| 46 | - builder.dateFormat(new SimpleDateFormat(DATE_TIME_FORMAT)); | ||
| 47 | - builder.timeZone(TimeZone.getTimeZone(ZoneOffset.of("+8"))); | ||
| 48 | - builder.serializationInclusion(JsonInclude.Include.NON_NULL); | ||
| 49 | - builder.featuresToDisable( | ||
| 50 | - DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, // Json串的属性无JavaBean字段对应时,避免抛出异常 | ||
| 51 | - DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES, // JavaBean中primitive类型的字段无Json属性时,避免抛出异常 | ||
| 52 | - DeserializationFeature.FAIL_ON_NUMBERS_FOR_ENUMS, // Json串数字类型属性,赋值JavaBean中Enum字段时,避免抛出异常 | ||
| 53 | - SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, | ||
| 54 | - SerializationFeature.FAIL_ON_EMPTY_BEANS | ||
| 55 | - ); | ||
| 56 | - builder.featuresToEnable( | ||
| 57 | - DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, | ||
| 58 | - DeserializationFeature.USE_JAVA_ARRAY_FOR_JSON_ARRAY | ||
| 59 | - ); | 34 | + private static final JsonMapper MAPPER = initJacksonMapper(); |
| 60 | 35 | ||
| 36 | + private static JsonMapper initJacksonMapper() { | ||
| 61 | var dateTimeFormatter = DateTimeFormatter.ofPattern(DATE_TIME_FORMAT); | 37 | var dateTimeFormatter = DateTimeFormatter.ofPattern(DATE_TIME_FORMAT); |
| 62 | var dateFormatter = DateTimeFormatter.ofPattern(DATE_FORMAT); | 38 | var dateFormatter = DateTimeFormatter.ofPattern(DATE_FORMAT); |
| 63 | var timeFormatter = DateTimeFormatter.ofPattern(TIME_FORMAT); | 39 | var timeFormatter = DateTimeFormatter.ofPattern(TIME_FORMAT); |
| 64 | - // 添加自定义序列化 | ||
| 65 | - builder.serializerByType(LocalDateTime.class, new LocalDateTimeSerializer(dateTimeFormatter)); | ||
| 66 | - builder.serializerByType(LocalDate.class, new LocalDateSerializer(dateFormatter)); | ||
| 67 | - builder.serializerByType(LocalTime.class, new LocalTimeSerializer(timeFormatter)); | ||
| 68 | - // 添加自定义反序列化 | ||
| 69 | - builder.deserializerByType(LocalDateTime.class, new LocalDateTimeDeserializer(dateTimeFormatter)); | ||
| 70 | - builder.deserializerByType(LocalDate.class, new LocalDateDeserializer(dateFormatter)); | ||
| 71 | - builder.deserializerByType(LocalTime.class, new LocalTimeDeserializer(timeFormatter)); | 40 | + LocalDateTimeSerializer localDateTimeSerializer = new LocalDateTimeSerializer(dateTimeFormatter); |
| 41 | + LocalDateSerializer localDateSerializer = new LocalDateSerializer(dateFormatter); | ||
| 42 | + LocalTimeSerializer localTimeSerializer = new LocalTimeSerializer(timeFormatter); | ||
| 43 | + | ||
| 44 | + LocalDateTimeDeserializer localDateTimeDeserializer = new LocalDateTimeDeserializer(dateTimeFormatter); | ||
| 45 | + LocalDateDeserializer localDateDeserializer = new LocalDateDeserializer(dateFormatter); | ||
| 46 | + LocalTimeDeserializer localTimeDeserializer = new LocalTimeDeserializer(timeFormatter); | ||
| 47 | + | ||
| 48 | + SimpleModule module = new SimpleModule(); | ||
| 49 | + module.addSerializer(LocalDateTime.class, localDateTimeSerializer); | ||
| 50 | + module.addSerializer(LocalDate.class, localDateSerializer); | ||
| 51 | + module.addSerializer(LocalTime.class, localTimeSerializer); | ||
| 52 | + module.addDeserializer(LocalDateTime.class, localDateTimeDeserializer); | ||
| 53 | + module.addDeserializer(LocalDate.class, localDateDeserializer); | ||
| 54 | + module.addDeserializer(LocalTime.class, localTimeDeserializer); | ||
| 55 | + return JsonMapper.builder() | ||
| 56 | + .changeDefaultPropertyInclusion(incl -> incl.withValueInclusion(JsonInclude.Include.NON_NULL)) | ||
| 57 | + .changeDefaultPropertyInclusion(incl -> incl.withContentInclusion(JsonInclude.Include.NON_NULL)) | ||
| 58 | + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) | ||
| 59 | + .disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) | ||
| 60 | + .disable(EnumFeature.FAIL_ON_NUMBERS_FOR_ENUMS) | ||
| 61 | + .disable(DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS) | ||
| 62 | + .disable(SerializationFeature.FAIL_ON_EMPTY_BEANS) | ||
| 63 | + .enable(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT) | ||
| 64 | + .enable(DeserializationFeature.USE_JAVA_ARRAY_FOR_JSON_ARRAY) | ||
| 65 | + .defaultDateFormat(new SimpleDateFormat(DATE_TIME_FORMAT)) | ||
| 66 | + .defaultTimeZone(TimeZone.getTimeZone(ZoneOffset.of("+8"))) | ||
| 67 | + .addModule(module) | ||
| 68 | + .build(); | ||
| 69 | + | ||
| 72 | } | 70 | } |
| 73 | 71 | ||
| 74 | public static <T> T fromJsonString(String json, Class<T> type) { | 72 | public static <T> T fromJsonString(String json, Class<T> type) { |
| 75 | try { | 73 | try { |
| 76 | - return objectMapper.readValue(json, type); | ||
| 77 | - } catch (JsonProcessingException ex) { | 74 | + return MAPPER.readValue(json, type); |
| 75 | + } catch (JacksonException ex) { | ||
| 78 | throw new IllegalArgumentException("Deserialize json exception", ex); | 76 | throw new IllegalArgumentException("Deserialize json exception", ex); |
| 79 | } | 77 | } |
| 80 | } | 78 | } |
| 81 | 79 | ||
| 82 | - public static <T> T fromJsonString(String json, TypeReference<T> jsonTypeReference) { | 80 | + public static <T> T fromJsonString(String json, tools.jackson.core.type.TypeReference<T> jsonTypeReference) { |
| 83 | try { | 81 | try { |
| 84 | - return objectMapper.readValue(json, jsonTypeReference); | ||
| 85 | - } catch (JsonProcessingException ex) { | 82 | + return MAPPER.readValue(json, jsonTypeReference); |
| 83 | + } catch (JacksonException ex) { | ||
| 86 | throw new IllegalArgumentException("Deserialize json array exception", ex); | 84 | throw new IllegalArgumentException("Deserialize json array exception", ex); |
| 87 | } | 85 | } |
| 88 | } | 86 | } |
| 89 | 87 | ||
| 90 | - public static <T> T fromJsonString(String json, JavaType javaType) { | 88 | + public static <T> T fromJsonString(String json, tools.jackson.databind.JavaType javaType) { |
| 91 | try { | 89 | try { |
| 92 | - return objectMapper.readValue(json, javaType); | ||
| 93 | - } catch (JsonProcessingException ex) { | 90 | + return MAPPER.readValue(json, javaType); |
| 91 | + } catch (JacksonException ex) { | ||
| 94 | throw new IllegalArgumentException("Deserialize json array exception", ex); | 92 | throw new IllegalArgumentException("Deserialize json array exception", ex); |
| 95 | } | 93 | } |
| 96 | } | 94 | } |
| 97 | 95 | ||
| 98 | public static <T> String toJsonString(T object) { | 96 | public static <T> String toJsonString(T object) { |
| 99 | try { | 97 | try { |
| 100 | - return objectMapper.writeValueAsString(object); | ||
| 101 | - } catch (JsonProcessingException ex) { | 98 | + return MAPPER.writeValueAsString(object); |
| 99 | + } catch (JacksonException ex) { | ||
| 102 | throw new IllegalArgumentException("Serialize json exception", ex); | 100 | throw new IllegalArgumentException("Serialize json exception", ex); |
| 103 | } | 101 | } |
| 104 | } | 102 | } |
| 105 | 103 | ||
| 106 | public static <T> T convertValue(Object fromValue, Class<T> toValueType) { | 104 | public static <T> T convertValue(Object fromValue, Class<T> toValueType) { |
| 107 | - return objectMapper.convertValue(fromValue, toValueType); | 105 | + try { |
| 106 | + return MAPPER.convertValue(fromValue, toValueType); | ||
| 107 | + } catch (JacksonException ex) { | ||
| 108 | + throw new IllegalArgumentException("Convert value exception", ex); | ||
| 109 | + } | ||
| 108 | } | 110 | } |
| 109 | 111 | ||
| 110 | - public static <T> T convertValue(Object fromValue, TypeReference<T> toValueTypeRef) { | ||
| 111 | - return objectMapper.convertValue(fromValue, toValueTypeRef); | 112 | + public static <T> T convertValue(Object fromValue, tools.jackson.core.type.TypeReference<T> toValueTypeRef) { |
| 113 | + try { | ||
| 114 | + return MAPPER.convertValue(fromValue, toValueTypeRef); | ||
| 115 | + } catch (JacksonException ex) { | ||
| 116 | + throw new IllegalArgumentException("Convert value exception", ex); | ||
| 117 | + } | ||
| 112 | } | 118 | } |
| 113 | 119 | ||
| 114 | - public static <T> T convertValue(Object fromValue, JavaType toValueType) { | ||
| 115 | - return objectMapper.convertValue(fromValue, toValueType); | 120 | + public static <T> T convertValue(Object fromValue, tools.jackson.databind.JavaType toValueType) { |
| 121 | + try { | ||
| 122 | + return MAPPER.convertValue(fromValue, toValueType); | ||
| 123 | + } catch (JacksonException ex) { | ||
| 124 | + throw new IllegalArgumentException("Convert value exception", ex); | ||
| 125 | + } | ||
| 116 | } | 126 | } |
| 117 | 127 | ||
| 118 | public static <T> T deepCopy(T t, Class<T> cls) { | 128 | public static <T> T deepCopy(T t, Class<T> cls) { |
| 119 | return JsonUtils.fromJsonString(JsonUtils.toJsonString(t), cls); | 129 | return JsonUtils.fromJsonString(JsonUtils.toJsonString(t), cls); |
| 120 | } | 130 | } |
| 121 | 131 | ||
| 122 | - | ||
| 123 | } | 132 | } |
tax-central/src/main/java/com/diligrp/tax/central/utils/MappingUtils.java
| @@ -11,8 +11,8 @@ import com.diligrp.tax.central.exception.TaxAgentServiceException; | @@ -11,8 +11,8 @@ import com.diligrp.tax.central.exception.TaxAgentServiceException; | ||
| 11 | import com.diligrp.tax.central.model.PipelineDocFieldTypeDO; | 11 | import com.diligrp.tax.central.model.PipelineDocFieldTypeDO; |
| 12 | import com.diligrp.tax.central.model.PipelineDocFieldTypeRemoteParamDO; | 12 | import com.diligrp.tax.central.model.PipelineDocFieldTypeRemoteParamDO; |
| 13 | import com.diligrp.tax.central.type.TaxSystemType; | 13 | import com.diligrp.tax.central.type.TaxSystemType; |
| 14 | -import com.fasterxml.jackson.core.type.TypeReference; | ||
| 15 | import lombok.extern.slf4j.Slf4j; | 14 | import lombok.extern.slf4j.Slf4j; |
| 15 | +import tools.jackson.core.type.TypeReference; | ||
| 16 | 16 | ||
| 17 | import java.lang.reflect.Field; | 17 | import java.lang.reflect.Field; |
| 18 | import java.util.*; | 18 | import java.util.*; |
tax-map/src/main/java/com/diligrp/tax/mapping/process/kingdee/MappingProcessor.java
| @@ -6,11 +6,10 @@ import com.diligrp.tax.central.process.AbstractProcessor; | @@ -6,11 +6,10 @@ import com.diligrp.tax.central.process.AbstractProcessor; | ||
| 6 | import com.diligrp.tax.central.utils.JsonUtils; | 6 | import com.diligrp.tax.central.utils.JsonUtils; |
| 7 | import com.diligrp.tax.mapping.context.MappingContext; | 7 | import com.diligrp.tax.mapping.context.MappingContext; |
| 8 | import com.diligrp.tax.mapping.demarcate.Transformer; | 8 | import com.diligrp.tax.mapping.demarcate.Transformer; |
| 9 | -import com.fasterxml.jackson.core.type.TypeReference; | ||
| 10 | import lombok.extern.slf4j.Slf4j; | 9 | import lombok.extern.slf4j.Slf4j; |
| 11 | import org.springframework.core.annotation.Order; | 10 | import org.springframework.core.annotation.Order; |
| 12 | import org.springframework.stereotype.Component; | 11 | import org.springframework.stereotype.Component; |
| 13 | - | 12 | +import tools.jackson.core.type.TypeReference; |
| 14 | import java.util.Map; | 13 | import java.util.Map; |
| 15 | 14 | ||
| 16 | /** | 15 | /** |
tax-proxy/src/main/java/com/diligrp/tax/proxy/demarcate/kingdee/CustomerSender.java
| @@ -11,12 +11,13 @@ import com.diligrp.tax.central.type.TaxSystemType; | @@ -11,12 +11,13 @@ import com.diligrp.tax.central.type.TaxSystemType; | ||
| 11 | import com.diligrp.tax.central.utils.JsonUtils; | 11 | import com.diligrp.tax.central.utils.JsonUtils; |
| 12 | import com.diligrp.tax.proxy.demarcate.Sender; | 12 | import com.diligrp.tax.proxy.demarcate.Sender; |
| 13 | import com.diligrp.tax.proxy.helper.KingDeeHelper; | 13 | import com.diligrp.tax.proxy.helper.KingDeeHelper; |
| 14 | -import com.fasterxml.jackson.core.type.TypeReference; | 14 | + |
| 15 | import com.kingdee.bos.webapi.entity.IdentifyInfo; | 15 | import com.kingdee.bos.webapi.entity.IdentifyInfo; |
| 16 | import com.kingdee.bos.webapi.entity.RepoRet; | 16 | import com.kingdee.bos.webapi.entity.RepoRet; |
| 17 | import com.kingdee.bos.webapi.entity.SuccessEntity; | 17 | import com.kingdee.bos.webapi.entity.SuccessEntity; |
| 18 | import com.kingdee.bos.webapi.sdk.K3CloudApi; | 18 | import com.kingdee.bos.webapi.sdk.K3CloudApi; |
| 19 | import org.springframework.stereotype.Component; | 19 | import org.springframework.stereotype.Component; |
| 20 | +import tools.jackson.core.type.TypeReference; | ||
| 20 | 21 | ||
| 21 | import java.util.ArrayList; | 22 | import java.util.ArrayList; |
| 22 | import java.util.List; | 23 | import java.util.List; |
tax-proxy/src/main/java/com/diligrp/tax/proxy/helper/KingDeeHelper.java
| @@ -6,7 +6,6 @@ import com.diligrp.tax.central.type.TaxSystemType; | @@ -6,7 +6,6 @@ import com.diligrp.tax.central.type.TaxSystemType; | ||
| 6 | import com.diligrp.tax.central.utils.JsonUtils; | 6 | import com.diligrp.tax.central.utils.JsonUtils; |
| 7 | import com.diligrp.tax.proxy.message.KingDeeQuery; | 7 | import com.diligrp.tax.proxy.message.KingDeeQuery; |
| 8 | import com.diligrp.tax.proxy.message.KingDeeSubmit; | 8 | import com.diligrp.tax.proxy.message.KingDeeSubmit; |
| 9 | -import com.fasterxml.jackson.core.type.TypeReference; | ||
| 10 | import com.google.gson.Gson; | 9 | import com.google.gson.Gson; |
| 11 | import com.kingdee.bos.webapi.entity.IdentifyInfo; | 10 | import com.kingdee.bos.webapi.entity.IdentifyInfo; |
| 12 | import com.kingdee.bos.webapi.entity.OperateParam; | 11 | import com.kingdee.bos.webapi.entity.OperateParam; |
| @@ -14,6 +13,7 @@ import com.kingdee.bos.webapi.entity.RepoError; | @@ -14,6 +13,7 @@ import com.kingdee.bos.webapi.entity.RepoError; | ||
| 14 | import com.kingdee.bos.webapi.entity.RepoRet; | 13 | import com.kingdee.bos.webapi.entity.RepoRet; |
| 15 | import com.kingdee.bos.webapi.sdk.K3CloudApi; | 14 | import com.kingdee.bos.webapi.sdk.K3CloudApi; |
| 16 | import lombok.extern.slf4j.Slf4j; | 15 | import lombok.extern.slf4j.Slf4j; |
| 16 | +import tools.jackson.core.type.TypeReference; | ||
| 17 | 17 | ||
| 18 | import java.util.Collections; | 18 | import java.util.Collections; |
| 19 | import java.util.List; | 19 | import java.util.List; |
tax-storage/pom.xml
| @@ -23,7 +23,7 @@ | @@ -23,7 +23,7 @@ | ||
| 23 | </dependency> | 23 | </dependency> |
| 24 | <dependency> | 24 | <dependency> |
| 25 | <groupId>com.baomidou</groupId> | 25 | <groupId>com.baomidou</groupId> |
| 26 | - <artifactId>mybatis-plus-spring-boot3-starter</artifactId> | 26 | + <artifactId>mybatis-plus-spring-boot4-starter</artifactId> |
| 27 | </dependency> | 27 | </dependency> |
| 28 | <dependency> | 28 | <dependency> |
| 29 | <groupId>com.baomidou</groupId> | 29 | <groupId>com.baomidou</groupId> |
| @@ -31,7 +31,7 @@ | @@ -31,7 +31,7 @@ | ||
| 31 | </dependency> | 31 | </dependency> |
| 32 | <dependency> | 32 | <dependency> |
| 33 | <groupId>org.springframework.boot</groupId> | 33 | <groupId>org.springframework.boot</groupId> |
| 34 | - <artifactId>spring-boot-starter-aop</artifactId> | 34 | + <artifactId>spring-boot-starter-aspectj</artifactId> |
| 35 | </dependency> | 35 | </dependency> |
| 36 | </dependencies> | 36 | </dependencies> |
| 37 | </project> | 37 | </project> |
tax-storage/src/main/java/com/diligrp/tax/storage/service/MappingErrorService.java
| @@ -13,11 +13,11 @@ import com.diligrp.tax.storage.domain.MappingError; | @@ -13,11 +13,11 @@ import com.diligrp.tax.storage.domain.MappingError; | ||
| 13 | import com.diligrp.tax.storage.model.co.MappingErrorCO; | 13 | import com.diligrp.tax.storage.model.co.MappingErrorCO; |
| 14 | import com.diligrp.tax.storage.model.vo.MappingErrorVO; | 14 | import com.diligrp.tax.storage.model.vo.MappingErrorVO; |
| 15 | import com.diligrp.tax.storage.repo.MappingErrorRepository; | 15 | import com.diligrp.tax.storage.repo.MappingErrorRepository; |
| 16 | -import com.fasterxml.jackson.core.type.TypeReference; | ||
| 17 | import jakarta.annotation.Resource; | 16 | import jakarta.annotation.Resource; |
| 18 | import org.springframework.amqp.rabbit.core.RabbitTemplate; | 17 | import org.springframework.amqp.rabbit.core.RabbitTemplate; |
| 19 | import org.springframework.stereotype.Service; | 18 | import org.springframework.stereotype.Service; |
| 20 | import org.springframework.transaction.annotation.Transactional; | 19 | import org.springframework.transaction.annotation.Transactional; |
| 20 | +import tools.jackson.core.type.TypeReference; | ||
| 21 | 21 | ||
| 22 | import static com.diligrp.tax.central.queue.TaxAutoPush.NORMAL_EXCHANGE; | 22 | import static com.diligrp.tax.central.queue.TaxAutoPush.NORMAL_EXCHANGE; |
| 23 | import static com.diligrp.tax.central.queue.TaxAutoPush.NORMAL_ROUTING; | 23 | import static com.diligrp.tax.central.queue.TaxAutoPush.NORMAL_ROUTING; |