|  |  | 
 |  |  | package com.vincent.rsf.server.manager.entity; | 
 |  |  |  | 
 |  |  | import java.text.SimpleDateFormat; | 
 |  |  | import java.util.Arrays; | 
 |  |  | import java.util.Date; | 
 |  |  | import java.util.*; | 
 |  |  |  | 
 |  |  | import com.alibaba.fastjson.JSONArray; | 
 |  |  | import com.alibaba.fastjson.JSONObject; | 
 |  |  | import com.baomidou.mybatisplus.annotation.*; | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
 |  |  | import com.vincent.rsf.server.manager.enums.StationTypeEnum; | 
 |  |  | import com.vincent.rsf.server.manager.service.WarehouseAreasService; | 
 |  |  | import com.vincent.rsf.server.system.entity.DictData; | 
 |  |  | import com.vincent.rsf.server.system.service.DictDataService; | 
 |  |  | 
 |  |  | import com.vincent.rsf.server.system.entity.User; | 
 |  |  | import java.io.Serializable; | 
 |  |  | import java.util.Date; | 
 |  |  | import java.util.stream.Collectors; | 
 |  |  |  | 
 |  |  | @Data | 
 |  |  | @TableName("man_bas_station") | 
 |  |  | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value= "站点名称") | 
 |  |  |     private String stationName; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty("站点类型: {0:光电, 1:无光电}") | 
 |  |  |     private Integer type; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 可入 | 
 |  |  | 
 |  |  |      * 容器类型 | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value= "容器类型") | 
 |  |  |     private Integer containerType; | 
 |  |  |     private String containerType; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 条码 | 
 |  |  | 
 |  |  |      */ | 
 |  |  |     @ApiModelProperty(value= "备注") | 
 |  |  |     private String memo; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value= "是否删除 1: 是  0: 否  ") | 
 |  |  |     @TableLogic | 
 |  |  |     private Integer deleted; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 创建人 | 
 |  |  | 
 |  |  |     @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | 
 |  |  |     private Date updateTime; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value= "状态") | 
 |  |  |     private Integer status; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 所属机构 | 
 |  |  |      */ | 
 |  |  | 
 |  |  |     private Long tenantId; | 
 |  |  |  | 
 |  |  |     @TableField(exist = false) | 
 |  |  |     private Long[] areaIds; | 
 |  |  |     private List<Long> areaIds; | 
 |  |  |  | 
 |  |  |     @TableField(exist = false) | 
 |  |  |     private List<Long> containerTypes; | 
 |  |  |  | 
 |  |  |     public BasStation() {} | 
 |  |  |  | 
 |  |  |     public String getType$() { | 
 |  |  |         if (this.type == null) return null; | 
 |  |  |         return StationTypeEnum.getStationDesc(this.type); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public List<Long> getContainerTypes$(){ | 
 |  |  |         if (Cools.isEmpty(this.containerType)){ | 
 |  |  |             return new ArrayList<>(); | 
 |  |  |         } | 
 |  |  |         DictDataService service = SpringUtils.getBean(DictDataService.class); | 
 |  |  |  | 
 |  |  | //    BasStation basStation = new BasStation( | 
 |  |  | //            null,    // 站点名称 | 
 |  |  | //            null,    // 可入 | 
 |  |  | //            null,    // 可出 | 
 |  |  | //            null,    // 状态 | 
 |  |  | //            null,    // 所属库区id | 
 |  |  | //            null,    // 是否可跨区 | 
 |  |  | //            null,    // 可跨区区域id | 
 |  |  | //            null,    // 是否wcs站点 | 
 |  |  | //            null,    // wcs站点信息 | 
 |  |  | //            null,    // 容器类型 | 
 |  |  | //            null,    // 条码 | 
 |  |  | //            null,    // 是否自动调拨 | 
 |  |  | //            null,    // 备注 | 
 |  |  | //            null,    // 创建人 | 
 |  |  | //            null,    // 创建时间 | 
 |  |  | //            null,    // 更新人 | 
 |  |  | //            null    // 更新时间 | 
 |  |  | //    ); | 
 |  |  |         Object parse = JSONArray.parse(this.getContainerType()); | 
 |  |  |         List<Long> longs1 = JSONObject.parseArray(parse.toString(), Long.class); | 
 |  |  |         List<DictData> dictData = service.list(new LambdaQueryWrapper<DictData>() | 
 |  |  |                 .eq(DictData::getDictTypeCode, "sys_container_type") | 
 |  |  |                 .in(DictData::getValue, longs1) | 
 |  |  |         ); | 
 |  |  |         List<Long> longs = dictData.stream().map(DictData::getId).collect(Collectors.toList()); | 
 |  |  |         return longs; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getCreateTime$(){ | 
 |  |  |         if (Cools.isEmpty(this.createTime)){ | 
 |  |  | 
 |  |  |         return ""; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getContainerType$(){ | 
 |  |  |         if (Cools.isEmpty(this.useStatus)){ | 
 |  |  |             return ""; | 
 |  |  |         } | 
 |  |  |         DictDataService service = SpringUtils.getBean(DictDataService.class); | 
 |  |  |         DictData dictData = service.getOne(new LambdaQueryWrapper<DictData>() | 
 |  |  |                 .eq(DictData::getDictTypeCode, "sys_container_type") | 
 |  |  |                 .eq(DictData::getValue, this.containerType) | 
 |  |  |         ); | 
 |  |  |         if (!Cools.isEmpty(dictData)){ | 
 |  |  |             return String.valueOf(dictData.getLabel()); | 
 |  |  |         } | 
 |  |  |         return ""; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     public String getArea$(){ | 
 |  |  |         if (null == this.area){ return null; } | 
 |  |  | 
 |  |  |         } | 
 |  |  |         return null; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     public Boolean getStatusBool(){ | 
 |  |  |         if (null == this.status){ return null; } | 
 |  |  |         switch (this.status){ | 
 |  |  |             case 1: | 
 |  |  |                 return true; | 
 |  |  |             case 0: | 
 |  |  |                 return false; | 
 |  |  |             default: | 
 |  |  |                 return null; | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  | } |