package com.zy.asrs.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 com.core.common.Cools; import com.core.common.SpringUtils; import com.zy.asrs.service.BasStationService; import com.zy.asrs.service.BasWrkIotypeService; import com.zy.asrs.service.BasWrkStatusService; import com.zy.system.entity.User; import com.zy.system.service.UserService; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; import java.text.SimpleDateFormat; import java.util.Date; @Data @TableName("asr_bas_station_err_log") public class BasStationErrLog implements Serializable { private static final long serialVersionUID = 1L; @ApiModelProperty(value = "编号") @TableId(value = "id", type = IdType.AUTO) private Long id; @ApiModelProperty(value = "工作号") @TableField("wrk_no") private Integer wrkNo; @ApiModelProperty(value = "发生时间") @TableField("start_time") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date startTime; @ApiModelProperty(value = "结束时间") @TableField("end_time") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date endTime; @ApiModelProperty(value = "工作状态") @TableField("wrk_sts") private Long wrkSts; @ApiModelProperty(value = "入出库类型") @TableField("io_type") private Integer ioType; @ApiModelProperty(value = "站点号") @TableField("station_id") private Integer stationId; @ApiModelProperty(value = "目标库位") @TableField("loc_no") private String locNo; @ApiModelProperty(value = "目标站") @TableField("sta_no") private Integer staNo; @ApiModelProperty(value = "源站") @TableField("source_sta_no") private Integer sourceStaNo; @ApiModelProperty(value = "源库位") @TableField("source_loc_no") private String sourceLocNo; @ApiModelProperty(value = "条码") private String barcode; @ApiModelProperty(value = "异常码") @TableField("err_code") private Integer errCode; @ApiModelProperty(value = "异常") private String error; @ApiModelProperty(value = "异常情况 1: 未处理 2: 已修复") private Integer status; @ApiModelProperty(value = "添加时间") @TableField("create_time") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date createTime; @ApiModelProperty(value = "添加人员") @TableField("create_by") private Long createBy; @ApiModelProperty(value = "修改时间") @TableField("update_time") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date updateTime; @ApiModelProperty(value = "修改人员") @TableField("update_by") private Long updateBy; @ApiModelProperty(value = "备注") private String memo; @ApiModelProperty(value = "系统状态数据") @TableField("system_status") private String systemStatus; public String getStartTime$() { return formatDate(startTime); } public String getEndTime$() { return formatDate(endTime); } public String getWrkSts$() { if (wrkSts == null) { return null; } BasWrkStatusService service = SpringUtils.getBean(BasWrkStatusService.class); if (service == null) { return String.valueOf(wrkSts); } BasWrkStatus basWrkStatus = service.getById(wrkSts); return basWrkStatus == null ? String.valueOf(wrkSts) : basWrkStatus.getWrkDesc(); } public String getIoType$() { if (ioType == null) { return null; } BasWrkIotypeService service = SpringUtils.getBean(BasWrkIotypeService.class); if (service == null) { return String.valueOf(ioType); } BasWrkIotype basWrkIotype = service.getById(ioType); return basWrkIotype == null ? String.valueOf(ioType) : basWrkIotype.getIoDesc(); } public String getStationLabel$() { if (stationId == null) { return null; } BasStationService service = SpringUtils.getBean(BasStationService.class); if (service == null) { return String.valueOf(stationId); } BasStation basStation = service.getById(stationId); if (basStation == null || Cools.isEmpty(basStation.getStationAlias())) { return String.valueOf(stationId); } return stationId + " - " + basStation.getStationAlias(); } public String getStatus$() { if (status == null) { return null; } switch (status) { case 1: return "未处理"; case 2: return "已修复"; default: return String.valueOf(status); } } public String getCreateTime$() { return formatDate(createTime); } public String getCreateBy$() { if (createBy == null) { return null; } UserService service = SpringUtils.getBean(UserService.class); if (service == null) { return String.valueOf(createBy); } User user = service.getById(createBy); return user == null ? String.valueOf(createBy) : String.valueOf(user.getId()); } public String getUpdateTime$() { return formatDate(updateTime); } public String getUpdateBy$() { if (updateBy == null) { return null; } UserService service = SpringUtils.getBean(UserService.class); if (service == null) { return String.valueOf(updateBy); } User user = service.getById(updateBy); return user == null ? String.valueOf(updateBy) : String.valueOf(user.getId()); } private String formatDate(Date value) { if (Cools.isEmpty(value)) { return ""; } return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(value); } }