package com.chushang.inspection.work.vo;

import cn.hutool.core.date.DatePattern;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalTime;

@Data
@NoArgsConstructor
public class Result implements Serializable {

    /**
     * 交易码
     */
    private String transCode = "1010";

    /**
     * 响应日期
     */
    @JsonFormat(pattern = DatePattern.PURE_DATE_PATTERN)
    private LocalDate respDate = LocalDate.now();

    /**
     * 响应时间
     */
    @JsonFormat(pattern = DatePattern.PURE_TIME_PATTERN)
    private LocalTime respTime = LocalTime.now();

    /**
     * 响应码
     */
    private String respCode;

    /**
     * 响应信息
     */
    private String respMssg;

    public Result(String respCode, String respMssg) {
        this.respCode = respCode;
        this.respMssg = respMssg;
    }

    public static Result success() {
        return new Result("00", "处理成功");
    }

    public static Result error() {
        return new Result("FF", "业务处理出现异常");
    }
}
