| | |
| | |
|
| | | import com.moral.common.util.Crypto;
|
| | | import com.moral.entity.*;
|
| | | import com.moral.entity.adapter.EquDeviceAdapter;
|
| | | import com.moral.service.*;
|
| | | import com.moral.util.MessageUtils;
|
| | | import com.taobao.api.ApiException;
|
| | |
| | | OperateUser operateUser = operateUserService.updatePassword(uid,password,newpassword);
|
| | | return new AppData<OperateUser>(operateUser);
|
| | | }
|
| | |
|
| | | /**
|
| | | *
|
| | | * @param request
|
| | | * @param uid
|
| | | * @param deviceName
|
| | | * @param address
|
| | | * @param longitude
|
| | | * @param latitude
|
| | | * @param mac
|
| | | * @param monitorpoint
|
| | | * @return
|
| | | */
|
| | | /**
|
| | | * 根据 设备id 来获取设备信息
|
| | | */
|
| | | @RequestMapping("deviceInfo")
|
| | | public AppData<Device> deviceInfo(Integer id){
|
| | | Device device = deviceService.queryById(id);
|
| | | return new AppData<Device>(device);
|
| | | }
|
| | | /**
|
| | | *
|
| | | * @param equDeviceAdapter
|
| | | * @return
|
| | | */
|
| | | @RequestMapping("reportDevice")
|
| | | public AppData<String> installDevice(
|
| | | HttpServletRequest request ,
|
| | | @RequestParam(value ="uid") Integer uid,
|
| | | @RequestParam(value ="device_name") String deviceName,
|
| | | @RequestParam(value ="address") String address,
|
| | | @RequestParam(value ="longitude") double longitude,
|
| | | @RequestParam(value ="latitude") double latitude,
|
| | | @RequestParam(value ="mac") String mac,
|
| | | @RequestParam(value ="monitorpoint") Integer monitorpoint
|
| | | ) {
|
| | | // device 适配
|
| | | Device device = new Device();
|
| | | device.setOperateUserId(uid);
|
| | | device.setName(deviceName);
|
| | | device.setAddress(address);
|
| | | device.setLongitude(longitude);
|
| | | device.setLatitude(latitude);
|
| | | device.setMac(mac);
|
| | | device.setMonitorPointId(monitorpoint);
|
| | | deviceService.saveOrUpdateDevice(device);
|
| | | public AppData<String> installDevice(EquDeviceAdapter equDeviceAdapter) {
|
| | | deviceService.saveOrUpdateDevice(equDeviceAdapter.toDevice());
|
| | | return new AppData<String>("");
|
| | | }
|
| | |
|
| | |
| | | @RequestMapping("getEquInfoByMac")
|
| | | public AppData<Map> getDeviceByMac(@RequestParam(value="mac", required=true)String mac) {
|
| | | Device device = deviceService.getDeviceByMac(mac,false);//不从缓存取
|
| | | Map<String,Object> deviceMap = new HashMap<>(BeanMap.create(device));
|
| | | deviceMap.put("monitorpointDetail",deviceMap.get("monitorPoint"));
|
| | | deviceMap.remove("monitorPoint");
|
| | | return new AppData<Map>(deviceMap);
|
| | | if(device!=null){
|
| | | Map<String,Object> deviceMap = new HashMap<>(BeanMap.create(device));
|
| | | deviceMap.put("monitorpointDetail",deviceMap.get("monitorPoint"));
|
| | | deviceMap.remove("monitorPoint");
|
| | | return new AppData<Map>(deviceMap);
|
| | | }else{
|
| | | return new AppData("mac地址不存在",AppData.FAIL);
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|