|
@@ -1,12 +1,13 @@
|
|
|
package cn.rankin.userservice.controller;
|
|
|
|
|
|
+import cn.rankin.data.api.user.dto.UserDeviceDTO;
|
|
|
import cn.rankin.data.api.user.entity.UserDevice;
|
|
|
-import cn.rankin.data.api.user.vo.UserDeviceVo;
|
|
|
import cn.rankin.userservice.helper.RaStringHelper;
|
|
|
import cn.rankin.userservice.service.UserDeviceService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import javax.validation.Valid;
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
@@ -18,33 +19,24 @@ public class UserDeviceController
|
|
|
@Autowired
|
|
|
private UserDeviceService userDeviceService;
|
|
|
|
|
|
- @RequestMapping(value = "/op/{uid}", method = RequestMethod.GET)
|
|
|
+ @RequestMapping(value = "/op/{uid}", method = RequestMethod.POST)
|
|
|
public int bindingDevice(@PathVariable("uid") String uid,
|
|
|
- @RequestParam("deviceCode") String deviceCode,
|
|
|
- @RequestParam("deviceMode") String deviceMode,
|
|
|
- @RequestParam("deviceMfrs") String deviceMfrs,
|
|
|
- @RequestParam("deviceName") String deviceName,
|
|
|
- @RequestParam("deviceType") String deviceType)
|
|
|
+ @Valid @RequestBody UserDeviceDTO userDeviceDTO)
|
|
|
{
|
|
|
|
|
|
if (RaStringHelper.isNull(uid))
|
|
|
{
|
|
|
return 0;
|
|
|
}
|
|
|
- if (RaStringHelper.isNull(deviceCode))
|
|
|
+ if (RaStringHelper.isNull(userDeviceDTO.getDeviceCode()))
|
|
|
{
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
- UserDeviceVo userDeviceVo = new UserDeviceVo();
|
|
|
- userDeviceVo.setUserId(uid);
|
|
|
- userDeviceVo.setDeviceCode(deviceCode);
|
|
|
- userDeviceVo.setDeviceModel(deviceMode);
|
|
|
- userDeviceVo.setDeviceMfrs(deviceMfrs);
|
|
|
- userDeviceVo.setDeviceName(deviceName);
|
|
|
- userDeviceVo.setDeviceType(deviceType);
|
|
|
|
|
|
- return userDeviceService.opUserDevice(userDeviceVo);
|
|
|
+ userDeviceDTO.setUserId(uid);
|
|
|
+
|
|
|
+ return userDeviceService.opUserDevice(userDeviceDTO);
|
|
|
|
|
|
}
|
|
|
|