|  |  |  | 
|---|
|  |  |  | import org.springframework.cglib.beans.BeanMap; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.CrossOrigin; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.GetMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.PostMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestParam; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RestController; | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.moral.common.bean.AppData; | 
|---|
|  |  |  | import com.moral.common.bean.ResultBean; | 
|---|
|  |  |  | import com.moral.common.util.Crypto; | 
|---|
|  |  |  | import com.moral.common.util.WebUtils; | 
|---|
|  |  |  | import com.moral.entity.Account; | 
|---|
|  |  |  | import com.moral.entity.Device; | 
|---|
|  |  |  | import com.moral.entity.MonitorPoint; | 
|---|
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @RequestMapping("reportDevice") | 
|---|
|  |  |  | public AppData<String> installDevice(EquDeviceAdapter equDeviceAdapter) { | 
|---|
|  |  |  | deviceService.addOrModify(equDeviceAdapter.toDevice()); | 
|---|
|  |  |  | //deviceService.addOrModify(equDeviceAdapter.toDevice()); | 
|---|
|  |  |  | deviceService.saveOrUpdate4Mobile(equDeviceAdapter.toDevice(), equDeviceAdapter.getDeviceProperty()); | 
|---|
|  |  |  | return new AppData<String>(""); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | List<Map<String, Object>> sensors = historyService.getSensorDataBySensorKey(parameters); | 
|---|
|  |  |  | return new ResultBean<List<Map<String, Object>>>(sensors); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @GetMapping("profession-provincecode") | 
|---|
|  |  |  | @ApiOperation(value = "根据省code返回行业数据", notes = "根据省code返回行业数据") | 
|---|
|  |  |  | @ApiImplicitParams(value = { | 
|---|
|  |  |  | @ApiImplicitParam(name = "provinceCode", value = "省code", required = true, paramType = "query", dataType = "String") | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | public ResultBean<List<Profession>> getProfessionByProvinceCode(HttpServletRequest request){ | 
|---|
|  |  |  | Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null); | 
|---|
|  |  |  | List<Profession> professions = professionService.getProfessiontList(parameters); | 
|---|
|  |  |  | return new ResultBean<List<Profession>>(professions); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PostMapping("update-maintenance") | 
|---|
|  |  |  | @ApiOperation(value = "设备状态从离线更新为维保", notes = "设备状态从离线更新为维保") | 
|---|
|  |  |  | @ApiImplicitParams(value = { | 
|---|
|  |  |  | @ApiImplicitParam(name = "id", value = "设备ID", required = true, paramType = "query", dataType = "int") , | 
|---|
|  |  |  | @ApiImplicitParam(name = "old_state", value = "旧的设备状态", required = true, paramType = "query", dataType = "String"), | 
|---|
|  |  |  | @ApiImplicitParam(name = "new_state", value = "新的设备状态", required = true, paramType = "query", dataType = "String") | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | public ResultBean offLinToMaintenance(HttpServletRequest request) { | 
|---|
|  |  |  | Map<String, Object> parameters = getParametersStartingWith(request, null); | 
|---|
|  |  |  | deviceService.offLinToMaintenance(parameters); | 
|---|
|  |  |  | ResultBean resultBean = new ResultBean(parameters); | 
|---|
|  |  |  | return resultBean; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @GetMapping("mointorPointRank") | 
|---|
|  |  |  | @ApiOperation(value = "获取站点排名", notes = "获取站点排名") | 
|---|
|  |  |  | @ApiImplicitParams(value = { | 
|---|
|  |  |  | @ApiImplicitParam(name = "accountId", value = "账号id", required = true, paramType = "query", dataType = "String"), | 
|---|
|  |  |  | @ApiImplicitParam(name = "sensor", value = "因子", required = true, paramType = "query", dataType = "String") | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | public ResultBean<List<Map<String, Object>>> getMointorPointRank(HttpServletRequest request){ | 
|---|
|  |  |  | Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null); | 
|---|
|  |  |  | String id = parameters.get("accountId").toString(); | 
|---|
|  |  |  | String sensor = parameters.get("sensor").toString(); | 
|---|
|  |  |  | Map<String, Object> account = accountService.getOrganizationIdByAccountId(id); | 
|---|
|  |  |  | //通过组织id来获取站点和设备信息 | 
|---|
|  |  |  | account.put("sensor", sensor); | 
|---|
|  |  |  | List<Map<String, Object>> returnList = historyService.getMointorPointRankByOrganizationId(account); | 
|---|
|  |  |  | return new ResultBean<List<Map<String, Object>>>(returnList); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|