|  |  |  | 
|---|
|  |  |  | package com.moral.api.controller; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import io.swagger.annotations.Api; | 
|---|
|  |  |  | import io.swagger.annotations.ApiImplicitParam; | 
|---|
|  |  |  | import io.swagger.annotations.ApiImplicitParams; | 
|---|
|  |  |  | import io.swagger.annotations.ApiOperation; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | 
|---|
|  |  |  | return ResultMessage.ok(response); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "获取该组织该行业所有设备的因子", notes = "获取该组织该行业所有设备的因子") | 
|---|
|  |  |  | @ApiOperation(value = "获取该组织某些行业所有设备的因子", notes = "获取该组织某些行业所有设备的因子") | 
|---|
|  |  |  | @GetMapping("getSensorByProfessions") | 
|---|
|  |  |  | public ResultMessage getProfessions(HttpServletRequest request) { | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(name = "organizationId", value = "组织id", required = true, paramType = "query", dataType = "Integer"), | 
|---|
|  |  |  | @ApiImplicitParam(name = "professions", value = "行业key,多个逗号隔开", required = true, paramType = "query", dataType = "String") | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | public ResultMessage getSensorByProfessions(HttpServletRequest request) { | 
|---|
|  |  |  | Map<String, Object> params = WebUtils.getParametersStartingWith(request, null); | 
|---|
|  |  |  | if (ObjectUtils.isEmpty(params.get("organizationId")) || ObjectUtils.isEmpty(params.get("professions"))) { | 
|---|
|  |  |  | return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), | 
|---|
|  |  |  | 
|---|
|  |  |  | Set<Map<String, Object>> response = professionService.getSensorByProfessionsAndOrganizationId(params); | 
|---|
|  |  |  | return ResultMessage.ok(response); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "行业贡献率", notes = "行业贡献率") | 
|---|
|  |  |  | @GetMapping("professionContribution") | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(name = "organizationId", value = "组织id", required = true, paramType = "query", dataType = "Integer"), | 
|---|
|  |  |  | @ApiImplicitParam(name = "profession", value = "行业key,多个逗号隔开", required = true, paramType = "query", dataType = "String"), | 
|---|
|  |  |  | @ApiImplicitParam(name = "type", value = "类型,月(2021-12),日(2021-12-24)", required = true, paramType = "query", dataType = "String"), | 
|---|
|  |  |  | @ApiImplicitParam(name = "time", value = "时间", required = true, paramType = "query", dataType = "String"), | 
|---|
|  |  |  | @ApiImplicitParam(name = "sensorCode", value = "传感器code", required = true, paramType = "query", dataType = "String") | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | public ResultMessage professionContribution(HttpServletRequest request) { | 
|---|
|  |  |  | Map<String, Object> params = WebUtils.getParametersStartingWith(request, null); | 
|---|
|  |  |  | if (ObjectUtils.isEmpty(params.get("organizationId")) | 
|---|
|  |  |  | || ObjectUtils.isEmpty(params.get("professions")) | 
|---|
|  |  |  | || ObjectUtils.isEmpty(params.get("type")) | 
|---|
|  |  |  | || ObjectUtils.isEmpty(params.get("time")) | 
|---|
|  |  |  | || ObjectUtils.isEmpty(params.get("sensorCode"))) { | 
|---|
|  |  |  | return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), | 
|---|
|  |  |  | ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Map<String, Object> response = professionService.professionContribution(params); | 
|---|
|  |  |  | return ResultMessage.ok(response); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|