Commit fd813483 by wnb0128

车家智能后台管理服务 场景指令相关功能--think.wang

1 parent 98e6d99f
package com.glsx.admin.controller;
import javax.validation.groups.Default;
import java.util.List;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageInfo;
import com.glsx.admin.pojo.GroupA;
import com.glsx.admin.pojo.request.DeviceOrderReq;
import com.glsx.admin.pojo.request.ProductTypeReq;
import com.glsx.admin.pojo.request.ScenceSupstatusReq;
import com.glsx.admin.pojo.response.DeviceOrderResp;
import com.glsx.admin.pojo.response.ProductTypeResp;
import com.glsx.admin.pojo.response.ScenceSupstatusResp;
import com.glsx.admin.remote.ProductConditionFeignClient;
import com.glsx.admin.remote.ProductContentFeignClient;
import com.glsx.admin.remote.ProductTypeFeignClient;
import com.glsx.plat.core.web.R;
import lombok.extern.slf4j.Slf4j;
......@@ -17,6 +21,12 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.groups.Default;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* <p>Description:
* <p>Project: chejia-smart
......@@ -28,9 +38,16 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/productType")
public class ProductTypeController {
@Autowired
private ProductTypeFeignClient productTypeFeignClient;
@Autowired
private ProductConditionFeignClient conditionFeignClient;
@Autowired
private ProductContentFeignClient contentFeignClient;
/**
* 分页获取产品类型列表。
*
......@@ -94,4 +111,35 @@ public class ProductTypeController {
List<String> shopTagList = productTypeFeignClient.getShopTagList();
return R.ok().data(shopTagList);
}
/**
* 获取类型指令条件列表
*
* @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)));
}
}
......@@ -12,6 +12,7 @@ import lombok.Data;
@Data
public class DeviceOrderReq {
private Integer id;
/**
......@@ -27,4 +28,10 @@ public class DeviceOrderReq {
* 设备类型 1.非固定值不需要查询 2.固定值需要查询
*/
private String orderType;
/**
* 1.String类型 2.Interger类型 3.boolean类型
*/
private String orderValueType;
}
package com.glsx.admin.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;
}
......@@ -12,6 +12,7 @@ import lombok.Data;
@Data
public class DeviceOrderResp {
private Integer id;
/**
......@@ -27,4 +28,10 @@ public class DeviceOrderResp {
* 设备类型 1.非固定值不需要查询 2.固定值需要查询
*/
private String orderType;
/**
* 1.String类型 2.Interger类型 3.boolean类型
*/
private String orderValueType;
}
package com.glsx.admin.pojo.response;
import java.util.Date;
import com.glsx.admin.pojo.BaseDTO;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* <p>Description:
* <p>Project: chejia-smart
......@@ -62,4 +64,8 @@ public class ProductTypeResp extends BaseDTO {
* 更新人
*/
private Long updateBy;
private List<ScenceSupstatusResp> conditionList;
private List<DeviceOrderResp> contentList;
}
package com.glsx.admin.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.admin.remote;
import com.glsx.admin.pojo.request.ScenceSupstatusReq;
import com.glsx.admin.pojo.response.ScenceSupstatusResp;
import com.glsx.admin.remote.impl.IndexHystrix;
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.admin.remote;
import com.glsx.admin.pojo.request.DeviceOrderReq;
import com.glsx.admin.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.admin.remote;
import java.util.List;
import com.github.pagehelper.PageInfo;
import com.glsx.admin.pojo.request.ProductTypeReq;
import com.glsx.admin.pojo.response.ProductTypeResp;
......@@ -11,6 +10,8 @@ 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
......@@ -39,4 +40,13 @@ public interface ProductTypeFeignClient {
@RequestMapping(value = "/productType/getShopTagList", method = {RequestMethod.GET})
@ResponseBody
List<String> getShopTagList();
@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!