|
|
@@ -13,12 +13,14 @@ import com.yunfeiyun.agmp.iot.common.enums.warn.IotWarnTouchTypeEnum;
|
|
|
import com.yunfeiyun.agmp.iot.common.enums.warn.IotWarnlevelEnum;
|
|
|
import com.yunfeiyun.agmp.iotm.web.domain.reqvo.IotWarnconfigAddReqVo;
|
|
|
import com.yunfeiyun.agmp.iotm.web.domain.reqvo.IotWarnconfigEditReqVo;
|
|
|
+import com.yunfeiyun.agmp.iotm.web.domain.resvo.IotWarnconfigInfoResVo;
|
|
|
import com.yunfeiyun.agmp.iotm.web.domain.resvo.IotWarnconfigResVo;
|
|
|
import com.yunfeiyun.agmp.iotm.web.mapper.IotWarnconfigMapper;
|
|
|
import com.yunfeiyun.agmp.iotm.web.mapper.IotWarnindicatorMapper;
|
|
|
import com.yunfeiyun.agmp.iotm.web.mapper.IotWarnobjectMapper;
|
|
|
import com.yunfeiyun.agmp.iotm.web.service.IIotWarnconfigService;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
@@ -26,7 +28,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.Collection;
|
|
|
import java.util.List;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 告警配置Service业务层处理
|
|
|
@@ -50,6 +51,7 @@ public class IotWarnconfigServiceImpl implements IIotWarnconfigService {
|
|
|
*/
|
|
|
@Override
|
|
|
public IotWarnconfig selectIotWarnconfigByWcBid(String wcBid, String tid){
|
|
|
+
|
|
|
return iotWarnconfigMapper.selectIotWarnconfigByWcBid(wcBid, tid);
|
|
|
}
|
|
|
/**
|
|
|
@@ -168,8 +170,8 @@ public class IotWarnconfigServiceImpl implements IIotWarnconfigService {
|
|
|
Collection<IotWarnobject> differ = CollectionUtils.disjunction(oldWarnObjectList,iotWarnconfigEditReqVo.getIotWarnobjectList());
|
|
|
// 老数据中存在,新数据中不存在,代表被删除的数据
|
|
|
Collection<IotWarnobject> deleteData = CollectionUtils.subtract(oldWarnObjectList,differ);
|
|
|
- List<String> deleteWarnObjectBids = deleteData.stream().map(IotWarnobject::getWoBid).collect(Collectors.toList());
|
|
|
- iotWarnobjectMapper.deleteIotWarnobjectByWoBids(deleteWarnObjectBids.toArray(new String[0]), SecurityUtils.getTid());
|
|
|
+ String[] woBids = deleteData.stream().map(IotWarnobject::getWoBid).toArray(String[]::new);
|
|
|
+ iotWarnobjectMapper.deleteIotWarnobjectByWoBids(woBids, SecurityUtils.getTid());
|
|
|
// 老数据中不存在,新数据中存在,代表新增的数据
|
|
|
Collection<IotWarnobject> addData = CollectionUtils.subtract(iotWarnconfigEditReqVo.getIotWarnobjectList(),differ);
|
|
|
for(IotWarnobject addWarnObject : addData){
|
|
|
@@ -183,4 +185,25 @@ public class IotWarnconfigServiceImpl implements IIotWarnconfigService {
|
|
|
}
|
|
|
return iotWarnconfigMapper.updateIotWarnconfig(iotWarnconfigEditReqVo);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public IotWarnconfigInfoResVo info(String wcBid, String tid) {
|
|
|
+ IotWarnconfig iotWarnconfig = iotWarnconfigMapper.selectIotWarnconfigByWcBid(wcBid,SecurityUtils.getTid());
|
|
|
+ if(null == iotWarnconfig){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ IotWarnobject iotWarnobjectQuery = new IotWarnobject();
|
|
|
+ iotWarnobjectQuery.setWcBid(wcBid);
|
|
|
+ iotWarnobjectQuery.setTid(SecurityUtils.getTid());
|
|
|
+ List<IotWarnobject> iotWarnobjectList = iotWarnobjectMapper.selectIotWarnobjectList(iotWarnobjectQuery);
|
|
|
+ IotWarnindicator iotWarnindicatorQuery = new IotWarnindicator();
|
|
|
+ iotWarnindicatorQuery.setWcBid(wcBid);
|
|
|
+ iotWarnindicatorQuery.setTid(SecurityUtils.getTid());
|
|
|
+ List<IotWarnindicator> iotWarnindicatorList = iotWarnindicatorMapper.selectIotWarnindicatorList(iotWarnindicatorQuery);
|
|
|
+ IotWarnconfigInfoResVo iotWarnconfigInfoResVo = new IotWarnconfigInfoResVo();
|
|
|
+ BeanUtils.copyProperties(iotWarnconfig,iotWarnconfigInfoResVo);
|
|
|
+ iotWarnconfigInfoResVo.setIotWarnindicatorList(iotWarnindicatorList);
|
|
|
+ iotWarnconfigInfoResVo.setIotWarnobjectList(iotWarnobjectList);
|
|
|
+ return iotWarnconfigInfoResVo;
|
|
|
+ }
|
|
|
}
|