|  |  |  | 
|---|
|  |  |  | package com.dayu.henanlibrary.utils; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.dayu.henanlibrary.HeNanApplication; | 
|---|
|  |  |  | import com.dayu.henanlibrary.dao.BaseDaoSingleton; | 
|---|
|  |  |  | import com.dayu.henanlibrary.dao.HNBaseDaoSingleton; | 
|---|
|  |  |  | import com.dayu.henanlibrary.dbBean.DeviceNumber; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //   获取充值机设备序列号 | 
|---|
|  |  |  | public static String getDeviceNumber() { | 
|---|
|  |  |  | DeviceNumber deviceNumber = BaseDaoSingleton.getInstance(HeNanApplication.myApplication.application).deviceNumberDao().findFirst(); | 
|---|
|  |  |  | DeviceNumber deviceNumber = HNBaseDaoSingleton.getInstance(HeNanApplication.myApplication.application).deviceNumberDao().findFirst(); | 
|---|
|  |  |  | if (deviceNumber != null) { | 
|---|
|  |  |  | return deviceNumber.getDeviceRegistrationNumber(); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //    设置充值机设备序列号 | 
|---|
|  |  |  | public static void setDeviceNumber(String deviceRegistrationNumber) { | 
|---|
|  |  |  | DeviceNumber deviceNumber = BaseDaoSingleton.getInstance(HeNanApplication.myApplication.application).deviceNumberDao().findFirst(); | 
|---|
|  |  |  | DeviceNumber deviceNumber = HNBaseDaoSingleton.getInstance(HeNanApplication.myApplication.application).deviceNumberDao().findFirst(); | 
|---|
|  |  |  | if (deviceNumber != null) { | 
|---|
|  |  |  | deviceNumber.setDeviceRegistrationNumber(deviceRegistrationNumber); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | deviceNumber = new DeviceNumber(); | 
|---|
|  |  |  | deviceNumber.setDeviceRegistrationNumber(deviceRegistrationNumber); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | BaseDaoSingleton.getInstance(HeNanApplication.myApplication.application).deviceNumberDao().insert(deviceNumber); | 
|---|
|  |  |  | HNBaseDaoSingleton.getInstance(HeNanApplication.myApplication.application).deviceNumberDao().insert(deviceNumber); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|