Commit 46b706e2 by wnb0128

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

1 parent 604e614b
package com.glsx.api.controller;
import com.alibaba.fastjson.JSON;
import com.glsx.api.pojo.request.DeviceOrderValueReq;
import com.glsx.api.remote.OrderValueFeignClient;
import com.glsx.plat.core.web.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
/**
* @Title: OrderValueController.java
* @Description: 场景设备指令集值列表
* @author think.wang
* @version V1.0
* @Company: Didihu.com.cn
* @Copyright Copyright (c) 2017
*/
@Slf4j
@RestController
@RequestMapping("/orderValue")
public class OrderValueController extends BaseController{
@Autowired
private OrderValueFeignClient valueFeignClient;
@ResponseBody
@RequestMapping("/getList")
public R getList(DeviceOrderValueReq req){
log.info("根据条件参数获取指令值列表:{}", JSON.toJSONString(req));
return R.ok().data(valueFeignClient.getList(req));
}
}
package com.glsx.api.controller;
import com.alibaba.fastjson.JSON;
import com.glsx.api.constant.Constant;
import com.glsx.api.pojo.request.ProductReq;
import com.glsx.api.remote.ProductFeignClient;
import com.glsx.plat.core.web.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
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.RestController;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-17
*/
@Slf4j
@RestController
@RequestMapping("/product")
public class ProductController {
@Autowired
private ProductFeignClient productFeignClient;
/**
* 获取结构化的产品类型
*
* @return 结果
*/
@RequestMapping(value = "/getList", method = {RequestMethod.POST})
public R getTypeAndCategory(@RequestBody ProductReq req) {
req.setStatus(Constant.ONLINE);
log.info("根据条件参数获取产品列表:{}", JSON.toJSONString(req));
return R.ok().data(productFeignClient.getListByCondition(req));
}
}
package com.glsx.api.pojo.request;
import lombok.Data;
import javax.validation.constraints.NotNull;
import javax.validation.groups.Default;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-19
*/
/**
* 车家智能场景设备指令集表
*/
@Data
public class DeviceOrderValueReq {
private Integer id;
/**
* 关联smart_device_order表中id
*/
private Integer orderId;
private String deviceStatusCode;
private String deviceStatusValue;
}
package com.glsx.api.pojo.request;
import lombok.Data;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-15
*/
/**
* 车家智能产品数据表
*/
@Data
public class ProductReq {
/**
* 标识ID
*/
private Long id;
/**
* 产品名称
*/
private String productName;
/**
* 图片ID 关联smart_sys_file中id
*/
private Long icon;
/**
* 产品类型ID 关联smart_product_type中id
*/
private Long typeId;
/**
* 商城产品id
*/
private String shopProductId;
/**
* 接入平台key 关联smart_sys_code中dict_key
*/
private String platformKey;
/**
* 接入平台产品id
*/
private String platformProductId;
/**
* 配网方式key 关联smart_sys_code中dict_key
*/
private String networkKey;
/**
* 状态:0下线 1上线
*/
private Byte status;
}
package com.glsx.api.pojo.response;
import lombok.Data;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-19
*/
/**
* 车家智能场景设备指令集表
*/
@Data
public class DeviceOrderValueResp {
private Integer id;
/**
* 关联smart_device_order表中id
*/
private Integer orderId;
private String deviceStatusCode;
private String deviceStatusValue;
}
package com.glsx.api.pojo.response;
import lombok.Data;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-15
*/
/**
* 车家智能产品数据表
*/
@Data
public class ProductResp {
/**
* 标识ID
*/
private Long id;
/**
* 产品名称
*/
private String productName;
/**
* 图片ID 关联smart_sys_file中id
*/
private Long icon;
/**
* 产品类型ID 关联smart_product_type中id
*/
private Long typeId;
/**
* 商城产品id
*/
private String shopProductId;
/**
* 接入平台key 关联smart_sys_code中dict_key
*/
private String platformKey;
/**
* 接入平台产品id
*/
private String platformProductId;
/**
* 配网方式key 关联smart_sys_code中dict_key
*/
private String networkKey;
}
package com.glsx.api.remote;
import com.glsx.api.pojo.request.DeviceOrderValueReq;
import com.glsx.api.pojo.response.DeviceOrderValueResp;
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 OrderValueFeignClient {
@ResponseBody
@RequestMapping(value = "/orderValue/getList", method = {RequestMethod.POST})
List<DeviceOrderValueResp> getList(@RequestBody DeviceOrderValueReq req);
}
package com.glsx.api.remote;
import com.glsx.api.pojo.request.ProductReq;
import com.glsx.api.pojo.response.ProductResp;
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;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-16
*/
@FeignClient(name = "${feign.server.name}",url = "${feign.server.url}")
public interface ProductFeignClient {
@ResponseBody
@RequestMapping(value = "/product/getListByCondition", method = {RequestMethod.POST})
List<ProductResp> getListByCondition(@RequestBody ProductReq req);
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!