|
@ -2,7 +2,10 @@ package com.yihu.iot.controller.monitorPlatform;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.yihu.iot.service.dict.IotSystemDictService;
|
|
|
import com.yihu.iot.service.monitorPlatform.MonitorPlatformService;
|
|
|
import com.yihu.iot.service.product.IotProductBaseInfoService;
|
|
|
import com.yihu.jw.entity.iot.dict.IotSystemDictDO;
|
|
|
import com.yihu.jw.restmodel.web.MixEnvelop;
|
|
|
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
|
|
|
import com.yihu.jw.rm.iot.IotRequestMapping;
|
|
@ -10,10 +13,12 @@ import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import iot.device.LocationDataVO;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
@ -26,7 +31,61 @@ public class MonitorPlatformController extends EnvelopRestEndpoint {
|
|
|
|
|
|
@Autowired
|
|
|
private MonitorPlatformService monitorPlatformService;
|
|
|
@Autowired
|
|
|
private IotSystemDictService iotSystemDictService;
|
|
|
@Autowired
|
|
|
private IotProductBaseInfoService iotProductBaseInfoService;
|
|
|
|
|
|
@GetMapping(value = IotRequestMapping.System.findDictByCode)
|
|
|
@ApiOperation(value = "获取字典列表(不分页)")
|
|
|
public MixEnvelop<IotSystemDictDO, IotSystemDictDO> getList(
|
|
|
@ApiParam(name = "dictName", value = "字典名称", defaultValue = "COMPANY_TYPE")
|
|
|
@RequestParam(value = "dictName", required = true) String dictName) throws Exception {
|
|
|
try {
|
|
|
List<IotSystemDictDO> doList = iotSystemDictService.getListByDictName(dictName);
|
|
|
return MixEnvelop.getSuccessList(IotRequestMapping.Company.message_success_find_functions,doList);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
return MixEnvelop.getError("查询失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = IotRequestMapping.Product.findListByCategoryCode)
|
|
|
@ApiOperation(value = "根据分类查找产品信息")
|
|
|
public MixEnvelop<JSONObject, JSONObject> findListByCategoryCode(@ApiParam(name = "categoryCode", value = "分类code", defaultValue = "1")
|
|
|
@RequestParam(value = "categoryCode", required = true)String categoryCode) {
|
|
|
try {
|
|
|
if(org.apache.commons.lang.StringUtils.isBlank(categoryCode)){
|
|
|
return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find, iotProductBaseInfoService.findListByCategoryCode());
|
|
|
}else {
|
|
|
return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find, iotProductBaseInfoService.findListByCategoryCode("'"+categoryCode.replace(",","','")+"'"));
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
return MixEnvelop.getError(e.getMessage());
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = IotRequestMapping.System.getListByParentCode)
|
|
|
@ApiOperation(value = "查询子类字典")
|
|
|
public MixEnvelop<JSONObject, JSONObject> getListByParentCode(
|
|
|
@ApiParam(name = "parentCode", value = "父类字典id", defaultValue = "402803f271b9583b0171b95b34e10001")
|
|
|
@RequestParam(value = "parentCode", required = true) String parentCode) throws Exception {
|
|
|
try {
|
|
|
List<JSONObject> doList = null;
|
|
|
if(StringUtils.isNoneBlank(parentCode)){
|
|
|
doList = iotSystemDictService.getListByParentCode("'"+parentCode.replace(",","','")+"'");
|
|
|
}else{
|
|
|
doList= iotSystemDictService.getListByParentCode();
|
|
|
}
|
|
|
|
|
|
return MixEnvelop.getSuccessList(IotRequestMapping.Company.message_success_find_functions,doList);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
return MixEnvelop.getError("查询失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/areaDict",method = RequestMethod.GET)
|
|
|
@ApiOperation("地区字典")
|