功能描述:
作的是物聯網的項目,Excel導入實現的功能是將Excel中的數據批量的導入AEP系統,再導入咱們系統中。目前已經完成該功能,前端還會添加進度條優化。
Excel模板:
前端向後端傳遞的參數:
前端代碼:
<Upload
name="wlwDeviceFile"
ref="upload"
:action="pathUrl"
:on-success="handleSuccess"
:on-error="handleError"
:format="['xls','xlsx']"
:max-size="5120"
:on-format-error="handleFormatError"
:on-exceeded-size="handleMaxSize"
:before-upload="handleBeforeUpload"
:data="extraData"
:disabled="!isLock"
>
<Button type="primary">選擇文件</Button>
</Upload>
data() {
return {
isLock: true,
mesg: false,
extraData: {
aepProductId: localStorage.productId,
productId: localStorage.productItemId,
projectId: localStorage.currentProjectId
},
mes: "",
cod: 0,
// currentShow: false,
pathUrl: Util.baseUrl + "/api/excel/import",
wlwDevice: {
fileName: "", //用於顯示上傳文件名
id: localStorage.productId,
autoSubscribe: 0
},
ruleValidate: {
fileName: [
{
required: true,
message: "請選擇文件",
trigger: "change"
}
]
}
};
},
handleSuccess(res, file) {
// console.log("res++++++++++++++++++++++++++", res);
if (res.code == 0) {
this.cod = res.code;
this.mes = '導入成功';
console.log(this.$refs.upload.fileList);
// this.$refs.upload.fileList.splice(0, 1);
} else {
this.cod = res.code;
this.mes = res.message;
}
this.isLock = true;
// this.$Spin.hide();
this.wlwDevice.fileName = file.name;
if (this.$refs.upload.fileList.length > 1) {
this.$refs.upload.fileList.splice(0, 1);
}
// this.$emit("cancel", this.isOpen);
},
handleSubmit(name) {
console.log("----------------------");
this.$refs[name].validate(valid => {
if (valid) {
this.mesg = true;
this.$refs[name].resetFields();
this.$emit("cancel", this.isOpen);
this.$emit("refreshList");
console.log("-------------@@@--------");
} else {
this.$Message.error(this.$t("errorText"));
}
});
},
後端解析 Excel,將數據讀取出來導入AEP系統
導入咱們系統:前端
後端代碼:
導入POM依賴:
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.9</version>
</dependency>
解析Excel的方法:
@Component
@NoArgsConstructor
public class ParseExcelUtil {
private static final Logger log = LoggerFactory.getLogger(ParseExcelUtil.class);
public static Workbook getWorkbook(InputStream is, String fileName) throws ExcelIOException {
Workbook workbook = null;
String fileType = fileName.substring(fileName.lastIndexOf("."));
// 推薦使用poi-ooxml中的WorkbookFactory.create(is)來建立Workbook,
// 由於HSSFWorkbook和XSSFWorkbook都實現了Workbook接口(能夠解決如下報錯問題)
try {
if (ExcelVersion.V2003.getSuffix().equals(fileType)) {
workbook = new HSSFWorkbook(is);
} else if (ExcelVersion.V2007.getSuffix().equals(fileType)) {
workbook = new XSSFWorkbook(is);
}
}catch (IOException e){
// 無效後綴名稱,這裏之能保證excel的後綴名稱,不能保證文件類型正確,不過不要緊,在建立Workbook的時候會校驗文件格式
throw new ExcelIOException("請上傳文件!");
}
return workbook;
}
}
Excel版本問題的枚舉:
@NoArgsConstructor
public enum ExcelVersion {
/**
* 雖然V2007版本支持最大支持1048575 * 16383 ,
* V2003版支持65535*255
* 可是在實際應用中若是使用如此龐大的對象集合會致使內存溢出,
* 所以這裏限制最大爲10000*100,若是還要加大建議先經過單元測試進行性能測試。
* 1000*100 所有導出預計時間爲27s左右
*/
V2003(".xls", 10000, 100), V2007(".xlsx", 100, 100);
private String suffix;
private int maxRow;
private int maxColumn;
ExcelVersion(String suffix, int maxRow, int maxColumn) {
this.suffix = suffix;
this.maxRow = maxRow;
this.maxColumn = maxColumn;
}
public String getSuffix() {
return this.suffix;
}
public int getMaxRow() {
return maxRow;
}
void setMaxRow(int maxRow) {
this.maxRow = maxRow;
}
public int getMaxColumn() {
return maxColumn;
}
void setMaxColumn(int maxColumn) {
this.maxColumn = maxColumn;
}
void setSuffix(String suffix) {
this.suffix = suffix;
}
}
Long型轉ZonedDateTime型方法:
/**
* 將Long類型轉化成0
* @author yk
* @param time
* @return
*/
public static ZonedDateTime toZonedDateTime(Long time){
SimpleDateFormat sdf = new SimpleDateFormat(LONG_DATE);
Date createDate = new Date(time);
String format = sdf.format(createDate);
DateTimeFormatter beijingFormatter = DateTimeFormatter.ofPattern(LONG_DATE).withZone(ZoneId.of("Asia/Shanghai"));
if(StringUtils.isBlank(format)){
return null;
}
ZonedDateTime beijingDateTime = ZonedDateTime.parse(format, beijingFormatter);
ZonedDateTime utc = beijingDateTime.withZoneSameInstant(ZoneId.of("UTC"));
return utc;
}
控制層
@RestController
@RequestMapping("/api/excel")
public class ImportExcelController {
private final Logger log = LoggerFactory.getLogger(ImportExcelController.class);
private final WlwDeviceService wlwDeviceService;
@Autowired
private ImportExcelService importExcelService;
public ImportExcelController(WlwDeviceService wlwDeviceService) {
this.wlwDeviceService = wlwDeviceService;
}
@PostMapping("/import")
public ImportExcelResult excelToWlwDevice(@RequestParam("wlwDeviceFile") MultipartFile wlwDeviceFile, @RequestParam("productId") String productId, @RequestParam("aepProductId") String aepProductId, @RequestParam("projectId") String projectId) throws Exception {
return importExcelService.excelToWlwDeviceService(wlwDeviceFile, productId, aepProductId, projectId);
}
Service接口:
public interface ImportExcelService {
/**
* 導入
* @param wlwDeviceFile
* @param productId
* @param aepProductId
* @param projectId
* @return
*/
ImportExcelResult excelToWlwDeviceService(MultipartFile wlwDeviceFile, String productId, String aepProductId, String projectId);
}
Service實現類:
@Service
public class ImportExcelServiceImpl implements ImportExcelService {
private static final Logger log = LoggerFactory.getLogger(ImportExcelServiceImpl.class);
@Autowired
private AepApiUtil util;
@Autowired
private WlwDeviceRepository wlwDeviceRepository;
@Override
public ImportExcelResult excelToWlwDeviceService(MultipartFile wlwDeviceFile, String productId, String aepProductId, String projectId) {
ImportExcelResult importExcelResult = new ImportExcelResult(0, "導入成功");
//List<String> sList = new ArrayList<>();
if (wlwDeviceFile.isEmpty()) {
importExcelResult.setCode(100);
importExcelResult.setMessage("填寫模版信息不能爲空");
return importExcelResult;
}
//1.將excel中的數據放入list中
List<AepDeviceDTO> aepDeviceDTOList = new ArrayList<>();
//解析Excel文件
try {
InputStream is = wlwDeviceFile.getInputStream();
int size = 0;
String imei = null;
//廠家名稱
String manufacturer = null;
//型號
String productType = null;
//設備名稱
String deviceName = null;
//自動訂閱
String autoObserver = null;
//設備類型
String deviceType = null;
StringBuilder megBuilder = new StringBuilder();
String filename = wlwDeviceFile.getOriginalFilename();
//1.根據Excel文件建立工做簿
Workbook wb = ParseExcelUtil.getWorkbook(is, filename);
//2.獲取Sheet
Sheet sheet = wb.getSheetAt(0);
if (sheet != null) {
WlwDevice wlwDevice = new WlwDevice();
//3.獲取Sheet中的每一行,和每個單元格,數據從第二行開始
for (int rowNum = 1; rowNum <= sheet.getLastRowNum(); rowNum++) {
log.info("處理到{}條記錄",rowNum);
//根據索引獲取每個行
Row row = sheet.getRow(rowNum);
size = row.getLastCellNum();
//Aep的設備實體類
AepDeviceDTO deviceDTO = new AepDeviceDTO();
AepDeviceOther other = new AepDeviceOther();
Set<String> imeiMap = new HashSet<>();
for (int cellNum = 0; cellNum < row.getLastCellNum(); cellNum++) {
Cell cell = row.getCell(cellNum);
if (null == cell) {
break;
}
//根據索引獲取每個單元格 獲取每個單元格的內容;
switch (cellNum) {
case 0:
manufacturer = cell.getStringCellValue();
break;
case 1:
productType = cell.getStringCellValue();
break;
case 2:
imei = cell.getStringCellValue();
if (StringUtils.isBlank(imei)) {
importExcelResult.setCode(101);
megBuilder.append("行號=[").append (rowNum + 1).append("];IMEI=[").append(imei).append("],設備名稱=[").append(deviceName).append("],失敗緣由:IMEI號不能爲空");
continue;
}
if (imei.trim().length() != 15) {
importExcelResult.setCode(102);
megBuilder.append("行號=[").append (rowNum + 1).append("];IMEI=[").append(imei).append("],設備名稱=[").append(deviceName).append("],失敗緣由:IMEI號必須是15位");
continue;
}
deviceDTO.setImei(imei.trim());
wlwDevice.setImei(imei.trim());
break;
case 3:
deviceName = cell.getStringCellValue();
if (StringUtils.isBlank(deviceName)) {
importExcelResult.setCode(104);
megBuilder.append("行號=[").append (rowNum + 1).append("];IMEI=[").append(imei).append("],設備名稱=[").append(deviceName).append("],失敗緣由:設備名稱不能爲空");
continue;
}
deviceDTO.setDeviceName(deviceName.trim());
wlwDevice.setDeviceName(deviceName.trim());
break;
case 4:
autoObserver = cell.getStringCellValue();
if (StringUtils.isBlank(autoObserver)) {
importExcelResult.setCode(105);
megBuilder.append("行號=[").append (rowNum + 1).append("];IMEI=[").append(imei).append("],設備名稱=[").append(deviceName).append("],失敗緣由:設備必須選擇是否自動訂閱");
continue;
}
//Aep的設備實體類的autoObserver pass平臺暫時不作自動訂閱和PSK,若作在這裏set
if (autoObserver.trim().hashCode() == 26159) {
other.setAutoObserver(0);
} else if (autoObserver.trim().hashCode() == 21542) {
other.setAutoObserver(1);
} else {
importExcelResult.setCode(106);
megBuilder.append("行號=[").append (rowNum + 1).append("];IMEI=[").append(imei).append("],設備名稱=[").append(deviceName).append("],失敗緣由:設備必須選擇是否自動訂閱");
continue;
}
break;
case 5:
deviceName = cell.getStringCellValue();
break;
default:
break;
}
}
deviceDTO.setProductId(Long.valueOf(aepProductId));
deviceDTO.setOther(other);
deviceDTO.setOperator(String.valueOf(SecurityUtils.getCurrentUserId()));
aepDeviceDTOList.add(deviceDTO);
//2.遍歷list校驗是否有重複的imei號
boolean add = imeiMap.add(imei);
if (!add) {
importExcelResult.setCode(108);
megBuilder.append("行號=[").append (rowNum + 1).append("];IMEI=[").append(imei).append("],設備名稱=[")
.append(deviceName).append("],失敗緣由:設備IMEI存在重複數據,請檢查模板");
continue;
}
//導入aep系統的設備
AepCreateDeviceResponse aepDevice = util.createAepDevice(deviceDTO);
Thread.sleep(200);
System.out.println("調用aep接口:" + aepDevice.getResult());
if (aepDevice.getCode() != 0) {
importExcelResult.setCode(aepDevice.getCode());
megBuilder.append("行號=[").append (rowNum + 1).append("];IMEI=[").append(imei).append("],設備名稱=[")
.append(deviceName).append("],失敗緣由:").append(aepDevice.getMsg());
continue;
} else {
importExcelResult.setCode(0);
importExcelResult.setMessage(aepDevice.getMsg());
//aep返回的結果參數
AepDevice result = aepDevice.getResult();
wlwDevice.setDeviceId(result.getDeviceId());
wlwDevice.setProductId(Long.valueOf(productId));
wlwDevice.setProjectId(Integer.valueOf(projectId));
wlwDevice.setAepProductId(Long.valueOf(result.getProductId()));
wlwDevice.setDeviceSn(result.getDeviceSn());
wlwDevice.setTenantId(result.getTenantId());
wlwDevice.setUpdatedDate(result.getUpdateTime() == null ? null : DateUtils.toZonedDateTime(result.getUpdateTime()));
wlwDevice.setNetStatus(result.getNetStatus());
wlwDevice.setUpdaterId(result.getOperator());
int insert = wlwDeviceRepository.insert(wlwDevice);
if (insert == 0) {
importExcelResult.setCode(109);
megBuilder.append("行號=[").append (rowNum + 1).append("];IMEI=[").append(imei).append("],設備名稱=[").append(deviceName).append("],失敗緣由:PasS系統導入錯誤").append(aepDevice.getResult().getDeviceName());
continue;
}
}
}
}
importExcelResult.setMessage(megBuilder.toString());
is.close();
} catch (Exception e) {
log.error("插入設備失敗", e);
importExcelResult.setCode(-1);
importExcelResult.setMessage("插入設備失敗");
}
return importExcelResult;
}
} AepDeviceDTO實體類:
public class AepDeviceDTO {
/**
* 終端名稱
*/
private String deviceName;
/**
* 設備編號
*/
private String deviceSn;
/**
* IMEI號,全局惟一,根據產品的Endpoint必填,建立時可相同,則刪除原產品新建產品
*/
private String imei;
/**
* 操做者
*/
private String operator;
/**
* LWM2M協議必填參數,其餘協議不填
* {
* autoObserver:0.自動訂閱 1.取消自動訂閱,必填;
* imsi:總長度不超過15位,使用0~9的數字,String類型,選填;
* pskValue:由大小寫字母加0-9數字組成的16位字符串,選填
* }
*/
private AepDeviceOther other;
/**
* 產品id
*/
private Long productId;
public String getDeviceName() {
return deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public String getDeviceSn() {
return deviceSn;
}
public void setDeviceSn(String deviceSn) {
this.deviceSn = deviceSn;
}
public String getImei() {
return imei;
}
public void setImei(String imei) {
this.imei = imei;
}
public String getOperator() {
return operator;
}
public void setOperator(String operator) {
this.operator = operator;
}
public AepDeviceOther getOther() {
return other;
}
public void setOther(AepDeviceOther other) {
this.other = other;
}
public Long getProductId() {
return productId;
}
public void setProductId(Long productId) {
this.productId = productId;
}
@Override
public String toString() {
return "AepDeviceDTO{" +
"deviceName='" + deviceName + '\'' +
", deviceSn='" + deviceSn + '\'' +
", imei='" + imei + '\'' +
", operator='" + operator + '\'' +
", other=" + other +
", productId=" + productId +
'}';
}
}
AepDeviceOther實體類:
public class AepDeviceOther {
/**
* 0.自動訂閱 1.取消自動訂閱,必填;
*/
private Integer autoObserver;
/**
* 總長度不超過15位,使用0~9的數字,String類型,選填;
*/
private String imsi;
/**
* 由大小寫字母加0-9數字組成的16位字符串,選填
*/
private String pskValue;
public Integer getAutoObserver() {
return autoObserver;
}
public void setAutoObserver(Integer autoObserver) {
this.autoObserver = autoObserver;
}
public String getImsi() {
return imsi;
}
public void setImsi(String imsi) {
this.imsi = imsi;
}
public String getPskValue() {
return pskValue;
}
public void setPskValue(String pskValue) {
this.pskValue = pskValue;
}
@Override
public String toString() {
return "{" +
"autoObserver=" + autoObserver +
", imsi='" + imsi + '\'' +
", pskValue='" + pskValue + '\'' +
'}';
}
}
WlwDevice實體類:
public class WlwDevice implements Serializable { /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column wlw_device.id * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ private Integer id; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column wlw_device.create_date * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ private ZonedDateTime createDate; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column wlw_device.updated_date * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ private ZonedDateTime updatedDate; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column wlw_device.del_flag * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ private Integer delFlag; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column wlw_device.creator_id * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ private String creatorId; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column wlw_device.updater_id * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ private String updaterId; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column wlw_device.device_name * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ private String deviceName; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column wlw_device.device_id * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ private String deviceId; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column wlw_device.device_sn * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ private String deviceSn; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column wlw_device.imei * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ private String imei; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column wlw_device.imsi * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ private String imsi; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column wlw_device.product_id * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ private Long productId; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column wlw_device.aep_product_id * * @mbg.generated Mon Dec 23 14:04:02 CST 2019 */ private Long aepProductId; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column wlw_device.project_id * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ private Integer projectId; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column wlw_device.remark * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ private String remark; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column wlw_device.last_up_time * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ private ZonedDateTime lastUpTime; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column wlw_device.last_down_time * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ private ZonedDateTime lastDownTime; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column wlw_device.device_status * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ private String deviceStatus; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column wlw_device.net_status * * @mbg.generated Mon Dec 23 14:04:02 CST 2019 */ private Integer netStatus; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column wlw_device.tenant_id * * @mbg.generated Mon Dec 23 14:04:02 CST 2019 */ private String tenantId; /** * This method was generated by MyBatis Generator. * This method returns the value of the database column wlw_device.id * * @return the value of wlw_device.id * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ public Integer getId() { return id; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column wlw_device.id * * @param id the value for wlw_device.id * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ public void setId(Integer id) { this.id = id; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column wlw_device.create_date * * @return the value of wlw_device.create_date * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ public ZonedDateTime getCreateDate() { return createDate; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column wlw_device.create_date * * @param createDate the value for wlw_device.create_date * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ public void setCreateDate(ZonedDateTime createDate) { this.createDate = createDate; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column wlw_device.updated_date * * @return the value of wlw_device.updated_date * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ public ZonedDateTime getUpdatedDate() { return updatedDate; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column wlw_device.updated_date * * @param updatedDate the value for wlw_device.updated_date * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ public void setUpdatedDate(ZonedDateTime updatedDate) { this.updatedDate = updatedDate; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column wlw_device.del_flag * * @return the value of wlw_device.del_flag * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ public Integer getDelFlag() { return delFlag; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column wlw_device.del_flag * * @param delFlag the value for wlw_device.del_flag * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ public void setDelFlag(Integer delFlag) { this.delFlag = delFlag; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column wlw_device.creator_id * * @return the value of wlw_device.creator_id * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ public String getCreatorId() { return creatorId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column wlw_device.creator_id * * @param creatorId the value for wlw_device.creator_id * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ public void setCreatorId(String creatorId) { this.creatorId = creatorId == null ? null : creatorId.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column wlw_device.updater_id * * @return the value of wlw_device.updater_id * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ public String getUpdaterId() { return updaterId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column wlw_device.updater_id * * @param updaterId the value for wlw_device.updater_id * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ public void setUpdaterId(String updaterId) { this.updaterId = updaterId == null ? null : updaterId.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column wlw_device.device_name * * @return the value of wlw_device.device_name * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ public String getDeviceName() { return deviceName; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column wlw_device.device_name * * @param deviceName the value for wlw_device.device_name * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ public void setDeviceName(String deviceName) { this.deviceName = deviceName == null ? null : deviceName.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column wlw_device.device_id * * @return the value of wlw_device.device_id * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ public String getDeviceId() { return deviceId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column wlw_device.device_id * * @param deviceId the value for wlw_device.device_id * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ public void setDeviceId(String deviceId) { this.deviceId = deviceId == null ? null : deviceId.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column wlw_device.device_sn * * @return the value of wlw_device.device_sn * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ public String getDeviceSn() { return deviceSn; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column wlw_device.device_sn * * @param deviceSn the value for wlw_device.device_sn * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ public void setDeviceSn(String deviceSn) { this.deviceSn = deviceSn == null ? null : deviceSn.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column wlw_device.imei * * @return the value of wlw_device.imei * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ public String getImei() { return imei; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column wlw_device.imei * * @param imei the value for wlw_device.imei * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ public void setImei(String imei) { this.imei = imei == null ? null : imei.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column wlw_device.imsi * * @return the value of wlw_device.imsi * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ public String getImsi() { return imsi; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column wlw_device.imsi * * @param imsi the value for wlw_device.imsi * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ public void setImsi(String imsi) { this.imsi = imsi == null ? null : imsi.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column wlw_device.product_id * * @return the value of wlw_device.product_id * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ public Long getProductId() { return productId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column wlw_device.product_id * * @param productId the value for wlw_device.product_id * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ public void setProductId(Long productId) { this.productId = productId; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column wlw_device.aep_product_id * * @return the value of wlw_device.aep_product_id * * @mbg.generated Mon Dec 23 14:04:02 CST 2019 */ public Long getAepProductId() { return aepProductId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column wlw_device.aep_product_id * * @param aepProductId the value for wlw_device.aep_product_id * * @mbg.generated Mon Dec 23 14:04:02 CST 2019 */ public void setAepProductId(Long aepProductId) { this.aepProductId = aepProductId; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column wlw_device.project_id * * @return the value of wlw_device.project_id * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ public Integer getProjectId() { return projectId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column wlw_device.project_id * * @param projectId the value for wlw_device.project_id * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ public void setProjectId(Integer projectId) { this.projectId = projectId; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column wlw_device.remark * * @return the value of wlw_device.remark * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ public String getRemark() { return remark; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column wlw_device.remark * * @param remark the value for wlw_device.remark * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ public void setRemark(String remark) { this.remark = remark == null ? null : remark.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column wlw_device.last_up_time * * @return the value of wlw_device.last_up_time * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ public ZonedDateTime getLastUpTime() { return lastUpTime; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column wlw_device.last_up_time * * @param lastUpTime the value for wlw_device.last_up_time * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ public void setLastUpTime(ZonedDateTime lastUpTime) { this.lastUpTime = lastUpTime; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column wlw_device.last_down_time * * @return the value of wlw_device.last_down_time * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ public ZonedDateTime getLastDownTime() { return lastDownTime; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column wlw_device.last_down_time * * @param lastDownTime the value for wlw_device.last_down_time * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ public void setLastDownTime(ZonedDateTime lastDownTime) { this.lastDownTime = lastDownTime; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column wlw_device.device_status * * @return the value of wlw_device.device_status * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ public String getDeviceStatus() { return deviceStatus; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column wlw_device.device_status * * @param deviceStatus the value for wlw_device.device_status * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ public void setDeviceStatus(String deviceStatus) { this.deviceStatus = deviceStatus == null ? null : deviceStatus.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column wlw_device.net_status * * @return the value of wlw_device.net_status * * @mbg.generated Mon Dec 23 14:04:02 CST 2019 */ public Integer getNetStatus() { return netStatus; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column wlw_device.net_status * * @param netStatus the value for wlw_device.net_status * * @mbg.generated Mon Dec 23 14:04:02 CST 2019 */ public void setNetStatus(Integer netStatus) { this.netStatus = netStatus; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column wlw_device.tenant_id * * @return the value of wlw_device.tenant_id * * @mbg.generated Mon Dec 23 14:04:02 CST 2019 */ public String getTenantId() { return tenantId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column wlw_device.tenant_id * * @param tenantId the value for wlw_device.tenant_id * * @mbg.generated Mon Dec 23 14:04:02 CST 2019 */ public void setTenantId(String tenantId) { this.tenantId = tenantId == null ? null : tenantId.trim(); } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table wlw_device * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ @Override public boolean equals(Object that) { if (this == that) { return true; } if (that == null) { return false; } if (getClass() != that.getClass()) { return false; } WlwDevice other = (WlwDevice) that; return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) && (this.getCreateDate() == null ? other.getCreateDate() == null : this.getCreateDate().equals(other.getCreateDate())) && (this.getUpdatedDate() == null ? other.getUpdatedDate() == null : this.getUpdatedDate().equals(other.getUpdatedDate())) && (this.getDelFlag() == null ? other.getDelFlag() == null : this.getDelFlag().equals(other.getDelFlag())) && (this.getCreatorId() == null ? other.getCreatorId() == null : this.getCreatorId().equals(other.getCreatorId())) && (this.getUpdaterId() == null ? other.getUpdaterId() == null : this.getUpdaterId().equals(other.getUpdaterId())) && (this.getDeviceName() == null ? other.getDeviceName() == null : this.getDeviceName().equals(other.getDeviceName())) && (this.getDeviceId() == null ? other.getDeviceId() == null : this.getDeviceId().equals(other.getDeviceId())) && (this.getDeviceSn() == null ? other.getDeviceSn() == null : this.getDeviceSn().equals(other.getDeviceSn())) && (this.getImei() == null ? other.getImei() == null : this.getImei().equals(other.getImei())) && (this.getImsi() == null ? other.getImsi() == null : this.getImsi().equals(other.getImsi())) && (this.getProductId() == null ? other.getProductId() == null : this.getProductId().equals(other.getProductId())) && (this.getAepProductId() == null ? other.getAepProductId() == null : this.getAepProductId().equals(other.getAepProductId())) && (this.getProjectId() == null ? other.getProjectId() == null : this.getProjectId().equals(other.getProjectId())) && (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark())) && (this.getLastUpTime() == null ? other.getLastUpTime() == null : this.getLastUpTime().equals(other.getLastUpTime())) && (this.getLastDownTime() == null ? other.getLastDownTime() == null : this.getLastDownTime().equals(other.getLastDownTime())) && (this.getDeviceStatus() == null ? other.getDeviceStatus() == null : this.getDeviceStatus().equals(other.getDeviceStatus())) && (this.getNetStatus() == null ? other.getNetStatus() == null : this.getNetStatus().equals(other.getNetStatus())) && (this.getTenantId() == null ? other.getTenantId() == null : this.getTenantId().equals(other.getTenantId())); } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table wlw_device * * @mbg.generated Mon Dec 09 14:33:32 CST 2019 */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); result = prime * result + ((getCreateDate() == null) ? 0 : getCreateDate().hashCode()); result = prime * result + ((getUpdatedDate() == null) ? 0 : getUpdatedDate().hashCode()); result = prime * result + ((getDelFlag() == null) ? 0 : getDelFlag().hashCode()); result = prime * result + ((getCreatorId() == null) ? 0 : getCreatorId().hashCode()); result = prime * result + ((getUpdaterId() == null) ? 0 : getUpdaterId().hashCode()); result = prime * result + ((getDeviceName() == null) ? 0 : getDeviceName().hashCode()); result = prime * result + ((getDeviceId() == null) ? 0 : getDeviceId().hashCode()); result = prime * result + ((getDeviceSn() == null) ? 0 : getDeviceSn().hashCode()); result = prime * result + ((getImei() == null) ? 0 : getImei().hashCode()); result = prime * result + ((getImsi() == null) ? 0 : getImsi().hashCode()); result = prime * result + ((getProductId() == null) ? 0 : getProductId().hashCode()); result = prime * result + ((getAepProductId() == null) ? 0 : getAepProductId().hashCode()); result = prime * result + ((getProjectId() == null) ? 0 : getProjectId().hashCode()); result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode()); result = prime * result + ((getLastUpTime() == null) ? 0 : getLastUpTime().hashCode()); result = prime * result + ((getLastDownTime() == null) ? 0 : getLastDownTime().hashCode()); result = prime * result + ((getDeviceStatus() == null) ? 0 : getDeviceStatus().hashCode()); result = prime * result + ((getNetStatus() == null) ? 0 : getNetStatus().hashCode()); result = prime * result + ((getTenantId() == null) ? 0 : getTenantId().hashCode()); return result; }