因为数据库连接问题导致的插入数据库异常
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package com.rj.entity;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeParseException;
|
||||
|
||||
/**
|
||||
* Parses {@link LocalDateTime} from ISO-8601 or common SQL-style {@code yyyy-MM-dd HH:mm:ss}.
|
||||
*/
|
||||
public class FlexibleLocalDateTimeDeserializer extends JsonDeserializer<LocalDateTime> {
|
||||
|
||||
private static final DateTimeFormatter SQL_SPACE = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
@Override
|
||||
public LocalDateTime deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
|
||||
String text = p.getValueAsString();
|
||||
if (text == null) {
|
||||
return null;
|
||||
}
|
||||
text = text.trim();
|
||||
if (text.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return LocalDateTime.parse(text, SQL_SPACE);
|
||||
} catch (DateTimeParseException ignored) {
|
||||
// continue
|
||||
}
|
||||
try {
|
||||
return LocalDateTime.parse(text, DateTimeFormatter.ISO_LOCAL_DATE_TIME);
|
||||
} catch (DateTimeParseException e) {
|
||||
throw ctxt.weirdStringException(text, LocalDateTime.class,
|
||||
"Expected ISO-8601 local date-time or yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
}
|
||||
}
|
||||
19
src/main/java/com/rj/entity/JsonFlexibleLocalDateTime.java
Normal file
19
src/main/java/com/rj/entity/JsonFlexibleLocalDateTime.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package com.rj.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Accepts ISO-8601 local date-time and common SQL-style {@code yyyy-MM-dd HH:mm:ss} for JSON binding.
|
||||
*/
|
||||
@JacksonAnnotationsInside
|
||||
@Target({ ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@JsonDeserialize(using = FlexibleLocalDateTimeDeserializer.class)
|
||||
public @interface JsonFlexibleLocalDateTime {
|
||||
}
|
||||
@@ -76,13 +76,16 @@ public class LbAssessmentApply implements Serializable {
|
||||
|
||||
@TableField("application_datetime")
|
||||
@Schema(description = "申请日期时间")
|
||||
@JsonFlexibleLocalDateTime
|
||||
private LocalDateTime applicationDatetime;
|
||||
|
||||
@TableField("created_at")
|
||||
@Schema(description = "创建时间")
|
||||
@JsonFlexibleLocalDateTime
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@TableField("updated_at")
|
||||
@Schema(description = "修改时间")
|
||||
@JsonFlexibleLocalDateTime
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
|
||||
113
src/main/java/com/rj/entity/LbOrderRow.java
Normal file
113
src/main/java/com/rj/entity/LbOrderRow.java
Normal file
@@ -0,0 +1,113 @@
|
||||
package com.rj.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("lb_order_row")
|
||||
@Schema(description = "LB 订单行表")
|
||||
public class LbOrderRow implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 业务主键为订单 id,由调用方传入,非数据库自增 */
|
||||
@TableId(value = "id", type = IdType.INPUT)
|
||||
@Schema(description = "订单 id")
|
||||
private Long id;
|
||||
|
||||
@TableField("old_id")
|
||||
@Schema(description = "旧订单 id")
|
||||
private Long oldId;
|
||||
|
||||
@TableField("tenant_id")
|
||||
@Schema(description = "租户ID")
|
||||
private String tenantId;
|
||||
|
||||
@TableField("seller_id")
|
||||
@Schema(description = "卖家 id")
|
||||
private Long sellerId;
|
||||
|
||||
@TableField("buyer_id")
|
||||
@Schema(description = "买家 id")
|
||||
private Long buyerId;
|
||||
|
||||
@TableField("order_sn")
|
||||
@Schema(description = "订单号")
|
||||
private String orderSn;
|
||||
|
||||
@TableField("total_money")
|
||||
@Schema(description = "总金额(接口为字符串)")
|
||||
private String totalMoney;
|
||||
|
||||
@TableField("pay_time")
|
||||
@Schema(description = "支付时间(原样字符串)")
|
||||
private String payTime;
|
||||
|
||||
@TableField("pay_img")
|
||||
@Schema(description = "支付凭证图")
|
||||
private String payImg;
|
||||
|
||||
@TableField("status")
|
||||
@Schema(description = "状态")
|
||||
private Integer status;
|
||||
|
||||
@TableField("is_resell")
|
||||
@Schema(description = "是否转卖")
|
||||
private Integer isResell;
|
||||
|
||||
@TableField("is_show")
|
||||
@Schema(description = "是否展示")
|
||||
private Integer isShow;
|
||||
|
||||
@TableField("consignee")
|
||||
@Schema(description = "收货人")
|
||||
private String consignee;
|
||||
|
||||
@TableField("phone")
|
||||
@Schema(description = "电话")
|
||||
private String phone;
|
||||
|
||||
@TableField("province")
|
||||
@Schema(description = "省")
|
||||
private String province;
|
||||
|
||||
@TableField("city")
|
||||
@Schema(description = "市")
|
||||
private String city;
|
||||
|
||||
@TableField("area")
|
||||
@Schema(description = "区")
|
||||
private String area;
|
||||
|
||||
@TableField("address")
|
||||
@Schema(description = "详细地址")
|
||||
private String address;
|
||||
|
||||
@TableField("merchandise_id")
|
||||
@Schema(description = "商品 id")
|
||||
private Long merchandiseId;
|
||||
|
||||
@TableField("confirm_time")
|
||||
@Schema(description = "确认时间")
|
||||
private String confirmTime;
|
||||
|
||||
@TableField("buy_time")
|
||||
@Schema(description = "下单时间")
|
||||
private String buyTime;
|
||||
|
||||
@TableField("created_at")
|
||||
@Schema(description = "创建时间")
|
||||
private String createdAt;
|
||||
|
||||
@TableField("updated_at")
|
||||
@Schema(description = "更新时间")
|
||||
private String updatedAt;
|
||||
}
|
||||
Reference in New Issue
Block a user