|
|
@@ -129,32 +129,35 @@ public class IotWarnindicatorServiceImpl implements IIotWarnindicatorService {
|
|
|
|
|
|
List<IotWarnindicator> result = new ArrayList<>();
|
|
|
// 暂时只支持针对设备的告警要素查询
|
|
|
- if(DevTypeUtil.isQxSq(devTypeBid)){
|
|
|
+ if (DevTypeUtil.isQxSq(devTypeBid)) {
|
|
|
result = warnindicatorDevQueryByQxSq(iotDevice);
|
|
|
- }else if(DevTypeUtil.isYfRecogCbd(devTypeBid)){
|
|
|
+ } else if (DevTypeUtil.isYfRecogCbd(devTypeBid)) {
|
|
|
result = warnindicatorDevQueryByCbd(iotDevice);
|
|
|
+ } else if (DevTypeUtil.isYbd(devTypeBid)) {
|
|
|
+ result = warnindicatorDevQueryByYbq(iotDevice);
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询气象墒情告警要素列表
|
|
|
+ *
|
|
|
* @param iotDevice
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<IotWarnindicator> warnindicatorDevQueryByQxSq(IotDevice iotDevice){
|
|
|
+ public List<IotWarnindicator> warnindicatorDevQueryByQxSq(IotDevice iotDevice) {
|
|
|
// 暂不支持根据类型查询要素
|
|
|
// 查询当前设备是否存在预设要素
|
|
|
List<IotWarnindicator> result = new ArrayList<>();
|
|
|
IotDeviceDataListReqVo iotDeviceDataListReqVo = new IotDeviceDataListReqVo();
|
|
|
- BeanUtils.copyProperties(iotDevice,iotDeviceDataListReqVo);
|
|
|
+ BeanUtils.copyProperties(iotDevice, iotDeviceDataListReqVo);
|
|
|
IotDeviceBaseFunReqVo iotDeviceBaseFunReqVo = new IotDeviceBaseFunReqVo();
|
|
|
iotDeviceBaseFunReqVo.setDevBid(iotDevice.getDevBid());
|
|
|
iotDeviceBaseFunReqVo.setMethodName("warnDataLatest");
|
|
|
iotDeviceBaseFunReqVo.setParam(iotDeviceDataListReqVo);
|
|
|
IotDevicelasteddata iotDevicelasteddata = iotDeviceCommonService.func(iotDeviceBaseFunReqVo);
|
|
|
- if(null == iotDevicelasteddata){
|
|
|
+ if (null == iotDevicelasteddata) {
|
|
|
return result;
|
|
|
}
|
|
|
JSONArray jsonArray = JSONArray.parseArray(iotDevicelasteddata.getDevldContent());
|
|
|
@@ -189,7 +192,26 @@ public class IotWarnindicatorServiceImpl implements IIotWarnindicatorService {
|
|
|
factorList.add(new String[]{"pestDetail", "指定害虫", "头", "1"});
|
|
|
|
|
|
List<IotWarnindicator> result = new ArrayList<>();
|
|
|
- for(String[] factor : factorList){
|
|
|
+ for (String[] factor : factorList) {
|
|
|
+ IotWarnindicator iotWarnindicator = new IotWarnindicator();
|
|
|
+ iotWarnindicator.setWiAddress(factor[0]);
|
|
|
+ iotWarnindicator.setWiCode(factor[0]);
|
|
|
+ iotWarnindicator.setWiName(factor[1]);
|
|
|
+ iotWarnindicator.setWiUnit(factor[2]);
|
|
|
+ iotWarnindicator.setWiOptiontype(factor[3]);
|
|
|
+ result.add(iotWarnindicator);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<IotWarnindicator> warnindicatorDevQueryByYbq(IotDevice iotDevice) {
|
|
|
+
|
|
|
+ List<String[]> factorList = new ArrayList<>();
|
|
|
+ factorList.add(new String[]{"computeValue", "发生率", "%", "0"});
|
|
|
+
|
|
|
+ List<IotWarnindicator> result = new ArrayList<>();
|
|
|
+ for (String[] factor : factorList) {
|
|
|
IotWarnindicator iotWarnindicator = new IotWarnindicator();
|
|
|
iotWarnindicator.setWiAddress(factor[0]);
|
|
|
iotWarnindicator.setWiCode(factor[0]);
|
|
|
@@ -201,7 +223,7 @@ public class IotWarnindicatorServiceImpl implements IIotWarnindicatorService {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- private Map<String,IotWarndataitem> queryDefaultFactorMap(IotDevice iotDevice){
|
|
|
+ private Map<String, IotWarndataitem> queryDefaultFactorMap(IotDevice iotDevice) {
|
|
|
// 查询设备是否存在预设要素
|
|
|
IotWarndataitem iotWarndataitemQuery = new IotWarndataitem();
|
|
|
iotWarndataitemQuery.setWdType("0");
|
|
|
@@ -226,12 +248,12 @@ public class IotWarnindicatorServiceImpl implements IIotWarnindicatorService {
|
|
|
@Override
|
|
|
public List<IotPest> pestList(String devBid) {
|
|
|
IotDevice iotDevice = iotDeviceService.selectIotDeviceByDevBid(devBid);
|
|
|
- if(null == iotDevice){
|
|
|
+ if (null == iotDevice) {
|
|
|
throw new BizException(ErrorCode.INVALID_PARAMETER.getCode(), "设备不存在");
|
|
|
}
|
|
|
String devtypeBid = iotDevice.getDevtypeBid();
|
|
|
String devType = null;
|
|
|
- switch (devtypeBid){
|
|
|
+ switch (devtypeBid) {
|
|
|
case IotDeviceDictConst.TYPE_YF_CBD:
|
|
|
case IotDeviceDictConst.TYPE_YF_SDCBD:
|
|
|
devType = "CBD";
|
|
|
@@ -251,14 +273,13 @@ public class IotWarnindicatorServiceImpl implements IIotWarnindicatorService {
|
|
|
* 批量新增告警指标
|
|
|
*
|
|
|
* @param iotWarnindicator
|
|
|
- * @return 结果
|
|
|
* @param iotWarnindicator
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
public int insertIotWarnindicatorBatch(List<IotWarnindicator> iotWarnindicator) {
|
|
|
- for(IotWarnindicator item : iotWarnindicator){
|
|
|
- if(StringUtils.isEmpty(item.getWiOptiontype())){
|
|
|
+ for (IotWarnindicator item : iotWarnindicator) {
|
|
|
+ if (StringUtils.isEmpty(item.getWiOptiontype())) {
|
|
|
item.setWiOptiontype("0");
|
|
|
}
|
|
|
}
|
|
|
@@ -267,7 +288,7 @@ public class IotWarnindicatorServiceImpl implements IIotWarnindicatorService {
|
|
|
|
|
|
@Override
|
|
|
public int deleteIotWarnindicatorByWcBid(String wcBid, String tid) {
|
|
|
- return iotWarnindicatorMapper.deleteIotWarnindicatorByWcBid(wcBid,tid);
|
|
|
+ return iotWarnindicatorMapper.deleteIotWarnindicatorByWcBid(wcBid, tid);
|
|
|
}
|
|
|
|
|
|
@Override
|