Commit c1e735c6 by tyfanchz

查询产品树修改

1 parent daed9eb6
package com.glsx.smart.enums;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-04-27
*/
public enum DeviceChannelEnum {
TU_YA((byte) 0, "access_platform_tuya"),
AQARA((byte) 0, "access_platform_aqara"),
DIDIHU((byte) 0, "access_platform_didihu")
;
private final Byte channel;
private final String platformKey;
DeviceChannelEnum(Byte channel, String platformKey) {
this.channel = channel;
this.platformKey = platformKey;
}
public static Byte getChannelByPlatformKey(String platformKey) {
Byte channel = values()[0].channel;
for (DeviceChannelEnum value : values()) {
if (value.platformKey.equalsIgnoreCase(platformKey)) {
channel = value.channel;
break;
}
}
return channel;
}
}
......@@ -14,6 +14,7 @@ import com.glsx.smart.dao.entity.SmartSysCode;
import com.glsx.smart.dao.mapper.SmartDeviceOrderMapper;
import com.glsx.smart.dao.mapper.SmartProductMapper;
import com.glsx.smart.dao.mapper.SmartSysCodeMapper;
import com.glsx.smart.enums.DeviceChannelEnum;
import com.glsx.smart.exception.BusinessException;
import com.glsx.smart.exception.ResultEnum;
import com.glsx.smart.service.BaseService;
......@@ -263,6 +264,9 @@ public class SmartProductServiceImpl extends BaseService implements SmartProduct
productInfo.put("icon", product.getIconUrl());
productInfo.put("typeId", product.getNetworkKey());
productInfo.put("shopProductId", product.getShopProductId());
productInfo.put("platformKey", product.getPlatformKey());
productInfo.put("channel", DeviceChannelEnum.getChannelByPlatformKey(
product.getPlatformKey()));
productInfoArray.add(productInfo);
}
// 将本级分类名和匹配到的产品类型放到 list 中
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!