Commit 604e614b by wnb0128

车家智能移动端服务 场景相关接口--think.wang

1 parent 8b4d97ba
package com.glsx.api.controller; package com.glsx.api.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.glsx.api.pojo.request.DeviceOrderReq;
import com.glsx.api.pojo.request.ScenceSupstatusReq;
import com.glsx.api.pojo.response.DeviceOrderResp;
import com.glsx.api.pojo.response.ScenceSupstatusResp;
import com.glsx.api.remote.ProductConditionFeignClient;
import com.glsx.api.remote.ProductContentFeignClient;
import com.glsx.api.remote.ProductTypeFeignClient; import com.glsx.api.remote.ProductTypeFeignClient;
import com.glsx.plat.core.web.R; import com.glsx.plat.core.web.R;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -9,6 +15,11 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -9,6 +15,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/** /**
* <p>Description: * <p>Description:
* <p>Project: chejia-smart * <p>Project: chejia-smart
...@@ -20,9 +31,16 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -20,9 +31,16 @@ import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequestMapping("/productType") @RequestMapping("/productType")
public class ProductTypeController { public class ProductTypeController {
@Autowired @Autowired
private ProductTypeFeignClient productTypeFeignClient; private ProductTypeFeignClient productTypeFeignClient;
@Autowired
private ProductConditionFeignClient conditionFeignClient;
@Autowired
private ProductContentFeignClient contentFeignClient;
/** /**
* 获取结构化的产品类型。 * 获取结构化的产品类型。
* *
...@@ -34,4 +52,34 @@ public class ProductTypeController { ...@@ -34,4 +52,34 @@ public class ProductTypeController {
JSONObject result = productTypeFeignClient.getTypeAndCategory(); JSONObject result = productTypeFeignClient.getTypeAndCategory();
return R.ok().data(result); return R.ok().data(result);
} }
/**
* 获取类型指令条件列表
*
* @return 结果
*/
@RequestMapping(value = "/getConditionList", method = {RequestMethod.GET, RequestMethod.POST})
public R getConditionList() {
List<ScenceSupstatusResp> respList = conditionFeignClient.getList(new ScenceSupstatusReq());
Set<Long> idList = new HashSet<>();
for (ScenceSupstatusResp resp : respList) {
idList.add(Long.valueOf(resp.getProductId()));
}
return R.ok().data(productTypeFeignClient.getListAndCondition(new ArrayList<>(idList)));
}
/**
* 获取类型指令执行内容列表
*
* @return 结果
*/
@RequestMapping(value = "/getContentList", method = {RequestMethod.GET, RequestMethod.POST})
public R getContentList() {
List<DeviceOrderResp> respList = contentFeignClient.getList(new DeviceOrderReq());
Set<Long> idList = new HashSet<>();
for (DeviceOrderResp resp : respList) {
idList.add(Long.valueOf(resp.getProductId()));
}
return R.ok().data(productTypeFeignClient.getListAndContent(new ArrayList<>(idList)));
}
} }
package com.glsx.api.pojo.request;
import lombok.Data;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-17
*/
@Data
public class DeviceOrderReq {
private Integer id;
/**
* 产品id
*/
private String productId;
private String orderCode;
private String orderValue;
/**
* 设备类型 1.非固定值不需要查询 2.固定值需要查询
*/
private String orderType;
/**
* 1.String类型 2.Interger类型 3.boolean类型
*/
private String orderValueType;
}
package com.glsx.api.pojo.request;
import lombok.Data;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-19
*/
/**
* 车家智能场景支持设备条件表
*/
@Data
public class ScenceSupstatusReq {
private Integer id;
/**
* 产品支持状态code
*/
private String sceneSupstatusCode;
/**
* 产品支持状态value
*/
private String sceneSupstatusValue;
/**
* 产品id
*/
private String productId;
/**
* 状态对应的指令code
*/
private String orderCode;
private String orderValue;
/**
* 1.等于 2.大于 3.小于
*/
private String type;
}
package com.glsx.api.pojo.response;
import lombok.Data;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-17
*/
@Data
public class DeviceOrderResp {
private Integer id;
/**
* 产品id
*/
private String productId;
private String orderCode;
private String orderValue;
/**
* 设备类型 1.非固定值不需要查询 2.固定值需要查询
*/
private String orderType;
/**
* 1.String类型 2.Interger类型 3.boolean类型
*/
private String orderValueType;
}
package com.glsx.api.pojo.response;
import lombok.Data;
import java.util.List;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-15
*/
/**
* 车家智能产品类型表
*/
@Data
public class ProductTypeResp{
/**
* 标识ID
*/
private Long id;
/**
* 类型名称
*/
private String typeName;
private List<ScenceSupstatusResp> conditionList;
private List<DeviceOrderResp> contentList;
}
package com.glsx.api.pojo.response;
import lombok.Data;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-19
*/
/**
* 车家智能场景支持设备条件表
*/
@Data
public class ScenceSupstatusResp {
private Integer id;
/**
* 产品支持状态code
*/
private String sceneSupstatusCode;
/**
* 产品支持状态value
*/
private String sceneSupstatusValue;
/**
* 产品id
*/
private String productId;
/**
* 状态对应的指令code
*/
private String orderCode;
private String orderValue;
/**
* 1.等于 2.大于 3.小于
*/
private String type;
}
package com.glsx.api.remote;
import com.glsx.api.pojo.request.ScenceSupstatusReq;
import com.glsx.api.pojo.response.ScenceSupstatusResp;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
@FeignClient(name = "${feign.server.name}",url = "${feign.server.url}")
public interface ProductConditionFeignClient {
@ResponseBody
@RequestMapping(value = "/condition/getList", method = {RequestMethod.GET})
List<ScenceSupstatusResp> getList(@RequestBody ScenceSupstatusReq req);
}
package com.glsx.api.remote;
import com.glsx.api.pojo.request.DeviceOrderReq;
import com.glsx.api.pojo.response.DeviceOrderResp;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
@FeignClient(name = "${feign.server.name}",url = "${feign.server.url}")
public interface ProductContentFeignClient {
@ResponseBody
@RequestMapping(value = "/content/getList", method = {RequestMethod.GET})
List<DeviceOrderResp> getList(@RequestBody DeviceOrderReq req);
}
package com.glsx.api.remote; package com.glsx.api.remote;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.glsx.api.pojo.response.ProductTypeResp;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/** /**
* <p>Description: * <p>Description:
* <p>Project: chejia-smart * <p>Project: chejia-smart
...@@ -15,7 +19,17 @@ import org.springframework.web.bind.annotation.ResponseBody; ...@@ -15,7 +19,17 @@ import org.springframework.web.bind.annotation.ResponseBody;
*/ */
@FeignClient(name = "${feign.server.name}",url = "${feign.server.url}") @FeignClient(name = "${feign.server.name}",url = "${feign.server.url}")
public interface ProductTypeFeignClient { public interface ProductTypeFeignClient {
@RequestMapping(value = "/productType/getTypeAndCategory", method = {RequestMethod.GET})
@ResponseBody @ResponseBody
@RequestMapping(value = "/productType/getTypeAndCategory", method = {RequestMethod.GET})
JSONObject getTypeAndCategory(); JSONObject getTypeAndCategory();
@ResponseBody
@RequestMapping(value = "/productType/getListAndCondition", method = {RequestMethod.POST})
List<ProductTypeResp> getListAndCondition(@RequestBody List<Long> list);
@ResponseBody
@RequestMapping(value = "/productType/getListAndContent", method = {RequestMethod.POST})
List<ProductTypeResp> getListAndContent(@RequestBody List<Long> list);
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!