|
|
@@ -3,6 +3,7 @@ package com.yunfeiyun.agmp.iotm.web.service.impl;
|
|
|
import com.yunfeiyun.agmp.common.constant.ErrorCode;
|
|
|
import com.yunfeiyun.agmp.common.core.domain.entity.SysUser;
|
|
|
import com.yunfeiyun.agmp.common.exception.BizException;
|
|
|
+import com.yunfeiyun.agmp.common.utils.DateUtils;
|
|
|
import com.yunfeiyun.agmp.common.utils.SecurityUtils;
|
|
|
import com.yunfeiyun.agmp.common.web.system.mapper.SysUserMapper;
|
|
|
import com.yunfeiyun.agmp.iot.common.domain.IotDevice;
|
|
|
@@ -10,6 +11,7 @@ import com.yunfeiyun.agmp.iot.common.domain.IotWarnlog;
|
|
|
import com.yunfeiyun.agmp.iot.common.domain.TosDevicetype;
|
|
|
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.IotWarnlogBatchDealReqVo;
|
|
|
import com.yunfeiyun.agmp.iotm.web.domain.reqvo.IotWarnlogReqVo;
|
|
|
import com.yunfeiyun.agmp.iotm.web.domain.resvo.IotWarnlogResVo;
|
|
|
import com.yunfeiyun.agmp.iotm.web.mapper.IotDeviceMapper;
|
|
|
@@ -204,6 +206,54 @@ public class IotWarnlogServiceImpl implements IIotWarnlogService {
|
|
|
return iotWarnlogMapper.deleteIotWarnlogByWlBid(wlBid, tid);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 批量修改告警记录
|
|
|
+ *
|
|
|
+ * @param iotWarnlogList 告警记录
|
|
|
+ * @return 结果
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public int batchUpdateIotWarnlog(List<IotWarnlog> iotWarnlogList) {
|
|
|
+ return iotWarnlogMapper.batchUpdateIotWarnlog(iotWarnlogList);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量处理告警记录
|
|
|
+ *
|
|
|
+ * @param iotWarnlogDealReqVo 告警记录
|
|
|
+ * @return 结果
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public int batchDeal(IotWarnlogBatchDealReqVo reqVo) {
|
|
|
+ List<String> wlBidList = reqVo.getWlBidList();
|
|
|
+ if(null == wlBidList || wlBidList.isEmpty()){
|
|
|
+ throw new BizException(ErrorCode.INVALID_PARAMETER.getCode(),"参数不能为空");
|
|
|
+ }
|
|
|
+ if(wlBidList.size() > 100){
|
|
|
+ throw new BizException(ErrorCode.INVALID_PARAMETER.getCode(),"一次最多处理100条数据");
|
|
|
+ }
|
|
|
+ String wlDealresult = reqVo.getWlDealresult();
|
|
|
+ String userId = SecurityUtils.getUserId();
|
|
|
+ String tid = SecurityUtils.getTid();
|
|
|
+ String wlDealtime = DateUtils.dateTimeNow();
|
|
|
+ List<IotWarnlog> dealLogList = new ArrayList<>();
|
|
|
+ for(String wlBid : wlBidList) {
|
|
|
+ IotWarnlog dealLog = new IotWarnlog();
|
|
|
+ dealLog.setTid(tid);
|
|
|
+ dealLog.setWlBid(wlBid);
|
|
|
+ dealLog.setWlDealresult(wlDealresult);
|
|
|
+ dealLog.setWlDealtime(wlDealtime);
|
|
|
+ dealLog.setWlDealuserid(userId);
|
|
|
+ dealLog.setStatus("1");
|
|
|
+
|
|
|
+ dealLogList.add(dealLog);
|
|
|
+ }
|
|
|
+ if(!dealLogList.isEmpty()){
|
|
|
+ return batchUpdateIotWarnlog(dealLogList);
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
public static void main(String[] args)throws Exception{
|
|
|
try {
|
|
|
|