/**
 * BladeX Commercial License Agreement
 * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
 * <p>
 * Use of this software is governed by the Commercial License Agreement
 * obtained after purchasing a license from BladeX.
 * <p>
 * 1. This software is for development use only under a valid license
 * from BladeX.
 * <p>
 * 2. Redistribution of this software's source code to any third party
 * without a commercial license is strictly prohibited.
 * <p>
 * 3. Licensees may copyright their own code but cannot use segments
 * from this software for such purposes. Copyright of this software
 * remains with BladeX.
 * <p>
 * Using this software signifies agreement to this License, and the software
 * must not be used for illegal purposes.
 * <p>
 * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
 * not liable for any claims arising from secondary or illegal development.
 * <p>
 * Author: Chill Zhuang (bladejava@qq.com)
 */
package org.springblade.modules.order.pojo.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import jakarta.validation.constraints.NotEmpty;
import lombok.Data;
import io.swagger.v3.oas.annotations.media.Schema;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;
import java.math.BigDecimal;

/**
 * 工单基础信息表 实体类
 *
 * @author lzp
 * @since 2024-06-18
 */
@Data
@TableName("sf_operation_order")
@Schema(description = "OperationOrder对象")
public class OperationOrderEntity implements Serializable {



	@Schema(
		description = "主键id"
	)
	@TableId(
		value = "id",
		type = IdType.ASSIGN_UUID
	)
	private String id;

	/**
	 * 工单编号，生成规则:WX（维修）、 AN（安装）年月日时分+随机四位（工单编号不可重复）,例如WX2019041012247567
	 */
	@Schema(description = "工单编号，生成规则:WX（维修）、 AN（安装）年月日时分+随机四位（工单编号不可重复）,例如WX2019041012247567")
	private String number;
	/**
	 * 工单来源类型：1.用户在线报修 2.平台录入 3.其他  默认2 ,4电商
	 */
	@Schema(description = "工单来源类型：1.用户在线报修 2.平台录入 3.其他  默认2 ,4电商")
	private String orderType;

	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@Schema(description = "创建时间")
	private Date createTime;
	/**
	 * 工单报修时间
	 */
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@Schema(description = "工单报修时间")
	private Date repairTime;
	/**
	 * 工单创建人user_id
	 */
	@Schema(description = "工单创建人user_id")
	private String createBy;
	/**
	 * 设备品牌
	 */
	@Schema(description = "设备品牌")
	private String applianceBrand;
	/**
	 * 设备类型
	 */
	@Schema(description = "设备类型")
	private String applianceCategory;
	/**
	 * 设备型号
	 */
	@Schema(description = "设备型号")
	private String applianceModel;
	/**
	 * 设备条码
	 */
	@Schema(description = "设备条码(设备SN)")
	private String applianceBarcode;
	/**
	 * 投运日期
	 */
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@Schema(description = "投运日期")
	private Date applianceBuyTime;
	/**
	 * 设备容量
	 */
	@Schema(description = "设备容量")
	private BigDecimal applianceCapacity;
	/**
	 * 设备序列号
	 */
	@Schema(description = "设备序列号")
	private String applianceMachineCode;
	/**
	 * 用户姓名
	 */
	@Schema(description = "用户姓名")
	@NotEmpty(message = "用户姓名不能为空")
	private String customerName;
	/**
	 * 省
	 */
	@NotEmpty(message = "省不能为空")
	@Schema(description = "省")
	private String province;
	/**
	 * 市
	 */
	@NotEmpty(message = "市不能为空")
	@Schema(description = "市")
	private String city;
	/**
	 * 区
	 */
	@NotEmpty(message = "区县不能为空")
	@Schema(description = "区")
	private String area;
	@Schema(description = "省代码", requiredMode = Schema.RequiredMode.REQUIRED)
	private String provinceCode;
	@Schema(description = "市代码", requiredMode = Schema.RequiredMode.REQUIRED)
	private String cityCode;
	@Schema(description = "区县代码", requiredMode = Schema.RequiredMode.REQUIRED)
	private String areaCode;

	/**
	 * 用户id 只有用户在app报修时才有
	 */
	@Schema(description = "用户id 只有用户在app报修时才有")
	private String customerId;
	/**
	 * 用户详细地址
	 */
	@NotEmpty(message = "用户详细地址不能为空")
	@Schema(description = "用户详细地址")
	private String customerAddress;
	/**
	 * 用户联系方式一
	 */
	@NotEmpty(message = "联系方式不能为空")
	@Schema(description = "用户联系方式一")
	private String customerMobile;
	/**
	 * 用户联系方式二
	 */
	@Schema(description = "用户联系方式二")
	private String customerTelephone;
	/**
	 * 用户的坐标信息：（格式：纬度，经度）
	 */
	@Schema(description = "用户的坐标信息：（格式：纬度，经度）")
	private String customerLnglat;
	/**
	 * 预约时间
	 */
	@DateTimeFormat(pattern = "yyyy-MM-dd")
	@Schema(description = "预约时间")
	@JsonFormat(pattern = "yyyy-MM-dd")
	private Date promiseTime;
	/**
	 * 时间要求，6:00-8:00，8:00-10:00，10:00-12:00，12:00-14:00，14:00-16:00，16:00-18:00，18:00-20:00，20:00-22:00
	 */
	@Schema(description = "时间要求，6:00-8:00，8:00-10:00，10:00-12:00，12:00-14:00，14:00-16:00，16:00-18:00，18:00-20:00，20:00-22:00")
	private String promiseLimit;
	/**
	 * 保修类型：1.保内 2.保外
	 */
	@Schema(description = "保修类型：1.保内 2.保外")
	private String warrantyType;
	/**
	 * 服务类型:  01 客户纠纷 02.电网问题 03.设备故障 04.收益异常 05.低效设备 06.基他工单
	 */
	@Schema(description = "服务类型:  01 客户纠纷 02.电网问题 03.设备故障 04.收益异常 05.低效设备 06.基他工单")
	@NotEmpty(message = "服务类型不能为空")
	private String serviceType;
	/**
	 * 服务措施
	 */
	@Schema(description = "服务措施")
	private String serviceMeasures;
	/**
	 * 备注(故障描述)
	 */
	@Schema(description = "备注(故障描述)")
	private String remarks;
	/**
	 * 预约标记：0未预约 1已预约
	 */
	@Schema(description = "预约标记：0未预约 1已预约")
	private String promiseFlag;
	/**
	 * 投诉标记：0无投诉 1有投诉（默认为0）
	 */
	@Schema(description = "投诉标记：0无投诉 1有投诉（默认为0）")
	private String complaintFlag;
	/**
	 * 配件标记，0无备件 1待发备件 2已发备件
	 */
	@Schema(description = "配件标记，0无备件 1待发备件 2已发备件")
	private String fittingFlag;
	/**
	 * 报修图片 多张用逗号" , " 隔开
	 */
	@Schema(description = "报修图片 多张用逗号 隔开")
	private String bdImgs;
	/**
	 * 标记类型id
	 */
	@Schema(description = "标记类型id")
	private String flag;
	/**
	 * 服务商id
	 */
	@Schema(description = "服务商id")
	private String siteId;
	/**
	 * 服务商名称
	 */
	@Schema(description = "服务商名称")
	private String siteName;
	/**
	 * 代理商id
	 */
	@Schema(description = "代理商id")
	private String agentId;
	/**
	 * 代理商名称
	 */
	@Schema(description = "代理商名称")
	private String agentName;

	/**
	 * 工程师id
	 */
	@Schema(description = "工程师id")
	private String employeId;
	/**
	 * 工程师姓名
	 */
	@Schema(description = "工程师姓名")
	private String employeName;
	/**
	 * 工程师手机号码
	 */
	@Schema(description = "工程师手机号码")
	private String employeMobile;
	/**
	 * 更新人姓名
	 */
	@Schema(description = "更新人姓名")
	private String updateName;
	/**
	 * 最新过程：如 修改预约时间、上门维修、缺件等
	 */
	@Schema(description = "最新过程：如 修改预约时间、上门维修、缺件等")
	private String latestProcess;
	/**
	 * 最新过程时间
	 */
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@Schema(description = "最新过程时间")
	private Date latestProcessTime;
	/**
	 * 投诉次数
	 */
	@Schema(description = "投诉次数")
	private Integer complaintCount;
	/**
	 * 服务商结算费
	 */
	@Schema(description = "服务商结算费")
	private BigDecimal siteCost;
	/**
	 * 应收金额
	 */
	@Schema(description = "应收金额")
	private BigDecimal accountsReceivable;
	/**
	 * 收款总额
	 */
	@Schema(description = "收款总额")
	private BigDecimal totalCollections;
	@Schema(description = "工单平台操作状态：1.待派工 2.服务中 3.待回访 4.待结算 5.已完成 6.无效工单 7.取消工单，默认1")
	private String status;
	/**
	 * 工单服务商操作状态:0尚未指派给服务商 1待服务商接单 2服务商已拒单 3待服务商派工 4待工程师接单 5待上门 6服务中 7已完工 8派工取消 9无效工单
	 */
	@Schema(description = "工单服务商操作状态:0尚未指派给服务商 1待服务商接单 2服务商已拒单 3待服务商派工 4待工程师接单 5待上门 6服务中 7已完工 8派工取消 9无效工单")
	private String siteStatus;
	/**
	 * 平台派工时间
	 */
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@Schema(description = "平台派工时间")
	private Date dispatchTime;
	/**
	 * 服务商接单时间
	 */
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@Schema(description = "服务商接单时间")
	private Date processTime;
	/**
	 * 服务商派工时间
	 */
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@Schema(description = "服务商派工时间")
	private Date siteDispatchTime;
	/**
	 * 工程师接单时间
	 */
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@Schema(description = "工程师接单时间")
	private Date siteProcessTime;
	/**
	 * 服务商的服务完工时间
	 */
	@TableField(updateStrategy = FieldStrategy.IGNORED)
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@Schema(description = "服务商的服务完工时间")
	private Date endTime;
	/**
	 * 服务商的工程师上门时间
	 */
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@Schema(description = "服务商的工程师上门时间")
	private Date dropInTime;
	/**
	 * 无效原因
	 */
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@Schema(description = "无效原因")
	private String disableResource;
	/**
	 * 回访结果  1已完成、2仍需上门
	 */
	@Schema(description = "回访结果  1已完成、2仍需上门")
	private String callbackResult;
	/**
	 * 工单的里程
	 */
	@Schema(description = "工单的里程")
	private BigDecimal mileage;
	/**
	 * 里程费
	 */
	@Schema(description = "里程费")
	private BigDecimal mileCost;
	/**
	 * 服务费
	 */
	@Schema(description = "服务费")
	private BigDecimal serviceCost;
	/**
	 * 备件费用
	 */
	@Schema(description = "备件费用")
	private BigDecimal fittingCost;
	/**
	 * 电站名称
	 */
	@Schema(description = "电站名称")
	private String powerStationName;
	/**
	 * 电站编码
	 */
	@NotEmpty(message = "电站编码不能为空")
	@Schema(description = "电站编码")
	private String powerStationCode;
	/**
	 * 电站id
	 */
	@Schema(description = "电站id")
	private String entryId;
	/**
	 * 重要程度:1.紧急 2.一般
	 */
	@Schema(description = "重要程度:1.紧急 2.一般")
	private String level;
	/**
	 * 销售商
	 */
	@Schema(description = "销售商")
	private String pleaseReferMall;
	/**
	 * 发票号码
	 */
	@Schema(description = "发票号码")
	private String invoice;
	/**
	 * 特殊安装单（渠道安装单）  1否 、2是 默认为 1
	 */
	@Schema(description = "特殊安装单（渠道安装单）  1否 、2是 默认为 1")
	private String specialInstallation;
	/**
	 * 保修卡生成标记:0未生成 1已生成
	 */
	@Schema(description = "保修卡生成标记:0未生成 1已生成")
	private String warrantyFlag;
	/**
	 * 直接封单备注
	 */
	@Schema(description = "直接封单备注")
	private String memoNote;

	@Schema(description = "投运时间")
	@DateTimeFormat(pattern = "yyyy-MM-dd")
	@JsonFormat(pattern ="yyyy-MM-dd")
	@JSONField(format = "yyyy-MM-dd")
	private Date putIntoTime;

	private String createName;

	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@Schema(description = "结算时间")
	private Date settleTime;
	@JsonSerialize(
		using = ToStringSerializer.class
	)
	@Schema(description = "故障id")
	private Long alarmId;

	/**
	 * 资方编号
	 */
	@Schema(description = "资方编号")
	private String capitalCode;
	/**
	 * 资方名称
	 */
	@Schema(description = "资方名称")
	private String capitalName;

	@Schema(description = "延期次数")
	@JsonSerialize(nullsUsing = NullSerializer.class)
	private Integer extensionCount;

	@Schema(description = "预警时间")
	@JsonFormat(pattern ="yyyy-MM-dd")
	@JSONField(format = "yyyy-MM-dd")
	private Date warningStartDay;

	@Schema(description = "回款时间(投放通过时间)")
	@JsonFormat(pattern ="yyyy-MM-dd")
	@JSONField(format = "yyyy-MM-dd")
	private Date paymentTime;

	@Schema(description = "质保到期时间")
	@JsonFormat(pattern ="yyyy-MM-dd")
	@JSONField(format = "yyyy-MM-dd")
	private Date warrantyExpiresTime;


	@Schema(description = "是否需要结算：1是 0否")
	private String ifSettle;

	@Schema(description = "扣款金额")
	private BigDecimal deductionTotalAmount;

}
