|
@@ -15,13 +15,15 @@ public class UserDeviceService
|
|
private UserDeviceRepository userDeviceRepository;
|
|
private UserDeviceRepository userDeviceRepository;
|
|
|
|
|
|
/**
|
|
/**
|
|
- * Find user deceive
|
|
|
|
- * @param uid the user id
|
|
|
|
- * @param deviceCode the device code
|
|
|
|
- * @param deviceType the device type
|
|
|
|
- * @return the entity of user device
|
|
|
|
|
|
+ * Find device
|
|
|
|
+ * @param uid
|
|
|
|
+ * @param deviceCode
|
|
|
|
+ * @param deviceModel
|
|
|
|
+ * @param deviceMfrs
|
|
|
|
+ * @param deviceBrand
|
|
|
|
+ * @return
|
|
*/
|
|
*/
|
|
- public UserDevice findDevice(String uid,String deviceCode,String deviceType)
|
|
|
|
|
|
+ public UserDevice findDevice(String uid,String deviceCode,String deviceModel,String deviceMfrs,String deviceBrand)
|
|
{
|
|
{
|
|
if(RaStringHelper.isNull(uid))
|
|
if(RaStringHelper.isNull(uid))
|
|
{
|
|
{
|
|
@@ -31,12 +33,12 @@ public class UserDeviceService
|
|
{
|
|
{
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
- if(RaStringHelper.isNull(deviceType))
|
|
|
|
|
|
+ if(RaStringHelper.isNull(deviceModel))
|
|
{
|
|
{
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
- UserDevice userDevice = userDeviceRepository.findUserDevice(uid,deviceCode,deviceType);
|
|
|
|
|
|
+ UserDevice userDevice = userDeviceRepository.findUserDevice(uid,deviceCode,deviceModel,deviceMfrs,deviceBrand);
|
|
if(userDevice != null)
|
|
if(userDevice != null)
|
|
{
|
|
{
|
|
return userDevice;
|
|
return userDevice;
|
|
@@ -47,8 +49,10 @@ public class UserDeviceService
|
|
userDevice.setUserId(uid);
|
|
userDevice.setUserId(uid);
|
|
userDevice.setGmtCreated(new Date());
|
|
userDevice.setGmtCreated(new Date());
|
|
userDevice.setDeviceCode(deviceCode);
|
|
userDevice.setDeviceCode(deviceCode);
|
|
- userDevice.setDeviceType(deviceType);
|
|
|
|
- userDevice.setBindingNum(1);
|
|
|
|
|
|
+ userDevice.setDeviceModel(deviceModel);
|
|
|
|
+ userDevice.setDeviceMfrs(deviceMfrs);
|
|
|
|
+ userDevice.setDeviceBrand(deviceBrand);
|
|
|
|
+ userDevice.setNum(1);
|
|
userDeviceRepository.save(userDevice);
|
|
userDeviceRepository.save(userDevice);
|
|
|
|
|
|
return null;
|
|
return null;
|
|
@@ -56,13 +60,16 @@ public class UserDeviceService
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * Find user deceive
|
|
|
|
- * @param uid the user id
|
|
|
|
- * @param deviceCode the device code
|
|
|
|
- * @param deviceType the device type
|
|
|
|
- * @return the entity of user device
|
|
|
|
|
|
+ * Updates device
|
|
|
|
+ * @param uid
|
|
|
|
+ * @param deviceCode
|
|
|
|
+ * @param deviceModel
|
|
|
|
+ * @param deviceMfrs
|
|
|
|
+ * @param deviceBrand
|
|
|
|
+ * @param bingdingNum
|
|
|
|
+ * @return
|
|
*/
|
|
*/
|
|
- public int updateDevice(String uid,String deviceCode,String deviceType,int bingdingNum)
|
|
|
|
|
|
+ public int updateDevice(String uid,String deviceCode,String deviceModel,String deviceMfrs,String deviceBrand,int bingdingNum)
|
|
{
|
|
{
|
|
if(RaStringHelper.isNull(uid))
|
|
if(RaStringHelper.isNull(uid))
|
|
{
|
|
{
|
|
@@ -72,12 +79,12 @@ public class UserDeviceService
|
|
{
|
|
{
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
- if(RaStringHelper.isNull(deviceType))
|
|
|
|
|
|
+ if(RaStringHelper.isNull(deviceModel))
|
|
{
|
|
{
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
- int updateRet = userDeviceRepository.updateDevice(uid,deviceCode,deviceType,bingdingNum);
|
|
|
|
|
|
+ int updateRet = userDeviceRepository.updateDevice(uid,deviceCode,deviceModel,deviceMfrs,deviceBrand,bingdingNum);
|
|
|
|
|
|
return updateRet;
|
|
return updateRet;
|
|
}
|
|
}
|