| | |
| | |
|
| | | import static com.moral.common.util.WebUtils.getParametersStartingWith;
|
| | |
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | |
| | | import com.moral.util.MessageUtils;
|
| | | import com.taobao.api.ApiException;
|
| | | import org.apache.commons.lang3.StringUtils;
|
| | | import org.springframework.cglib.beans.BeanMap;
|
| | | import org.springframework.web.bind.annotation.*;
|
| | |
|
| | | import com.moral.common.bean.AppData;
|
| | |
| | | return new AppData<OperateUser>(operateUser);
|
| | | }
|
| | |
|
| | | /**
|
| | | * Install device.终端采集
|
| | | *
|
| | | * @param device the device
|
| | | * @return the result bean
|
| | | */
|
| | | /**
|
| | | *
|
| | | * @param request
|
| | | * @param uid
|
| | | * @param deviceName
|
| | | * @param address
|
| | | * @param longitude
|
| | | * @param latitude
|
| | | * @param mac
|
| | | * @param monitorpoint
|
| | | * @return
|
| | | */
|
| | | @PostMapping("reportDevice")
|
| | | public AppData<String> installDevice(Device device) {
|
| | | 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);
|
| | | return new AppData<String>("");
|
| | | }
|
| | |
| | | * @return the device by mac
|
| | | */
|
| | | @GetMapping("getEquInfoByMac")
|
| | | public AppData<Device> getDeviceByMac(@RequestParam(value="mac", required=true)String mac) {
|
| | | Device device = deviceService.getDeviceByMac(mac);
|
| | | return new AppData<Device>(device);
|
| | | 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);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @param request the area name
|
| | | * @return the monitor points by area name
|
| | | */
|
| | | @PostMapping("getMpointsByAreaName")
|
| | | @GetMapping("getMpointsByAreaName")
|
| | | public AppData<List<MonitorPoint>> getMonitorPointsByAreaName(HttpServletRequest request) {
|
| | | Map<String, Object> parameters = getParametersStartingWith(request, null);
|
| | | List<MonitorPoint> monitorPoints = monitorPointService.getMonitorPointsByAreaName(parameters);
|
| | |
| | | * @param request the area name
|
| | | * @return the organizations by area name
|
| | | */
|
| | | @PostMapping("getOrgsByAreaName")
|
| | | @GetMapping("getOrgsByAreaName")
|
| | | public AppData<List<Organization>> getOrganizationsByAreaName(HttpServletRequest request) {
|
| | | Map<String, Object> parameters = getParametersStartingWith(request, null);
|
| | | List<Organization> organizations = organizationService.getOrganizationsByAreaName(parameters);
|
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * Send SMS
|
| | | *
|
| | | * @param mobile
|
| | | * @param username
|
| | | * @param password
|
| | | * @param code
|
| | | * @return
|
| | | */
|
| | | @PostMapping("password")
|