Browse Source

预警通知下发弹窗

tags/v1.2.0^2
chengwang 1 year ago
parent
commit
08bfc95f37
4 changed files with 76 additions and 0 deletions
  1. +8
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/AccidentController.java
  2. +54
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/AccidentNoticeService.java
  3. +8
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/AccidentServiceImpl.java
  4. +6
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/IAccidentService.java

+ 8
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/AccidentController.java View File

@@ -59,5 +59,13 @@ public class AccidentController {
return accidentService.accidentDetails(id);
}

/**
* 告警弹窗通知下发
*/
@GetMapping("/notice")
public JsonResult notice(){
return accidentService.notice();
}


}

+ 54
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/AccidentNoticeService.java View File

@@ -0,0 +1,54 @@
package com.tuoheng.admin.service.accident;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.tuoheng.admin.entity.Accident;
import com.tuoheng.admin.enums.AccidentStatusEnum;
import com.tuoheng.admin.enums.FlagEnum;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.mapper.AccidentMapper;
import com.tuoheng.admin.utils.CurrentUserUtil;
import com.tuoheng.common.core.exception.ServiceException;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.sql.rowset.serial.SerialException;
import java.util.List;

/**
* @Author ChengWang
* @Date 2023/3/14
*/
@Slf4j
@Service
public class AccidentNoticeService {

@Autowired
private AccidentMapper accidentMapper;


/**
* 告警弹窗通知下发
* @return
*/
public JsonResult notice() {
//当前登录用户
String tenantId = CurrentUserUtil.getTenantId();
if(StringUtils.isEmpty(tenantId)){
throw new ServiceException("当前用户租户id为空");
}
//查询应急表是否有应急数据
List<Accident> accidentList = accidentMapper.selectList(new LambdaQueryWrapper<Accident>()
.eq(Accident::getTenantId, tenantId)
.eq(Accident::getStatus, AccidentStatusEnum.UNTREATED.getCode())
.eq(Accident::getFlag, FlagEnum.INSPECTION_ACCIDENT.getCode())
.eq(Accident::getMark, MarkEnum.VALID.getCode()));
if(CollectionUtils.isEmpty(accidentList) || accidentList.size() == 0){
return JsonResult.success("巡检任务无应急记录产生");
}
return JsonResult.success(accidentList);
}
}

+ 8
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/AccidentServiceImpl.java View File

@@ -30,6 +30,9 @@ public class AccidentServiceImpl extends BaseServiceImpl<AccidentMapper, Acciden
@Autowired
private QueryAccidentDetailsService queryAccidentDetailsService;

@Autowired
private AccidentNoticeService accidentNoticeService;

@Override
public JsonResult getPageList(QueryAccidentPageListRequest request) {
return queryAccidentPageListService.getPageList(request);
@@ -49,4 +52,9 @@ public class AccidentServiceImpl extends BaseServiceImpl<AccidentMapper, Acciden
public JsonResult accidentDetails(String id) {
return queryAccidentDetailsService.accidentDetailsById(id);
}

@Override
public JsonResult notice() {
return accidentNoticeService.notice();
}
}

+ 6
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/IAccidentService.java View File

@@ -41,4 +41,10 @@ public interface IAccidentService extends IBaseService<Accident> {
* @return
*/
JsonResult accidentDetails(String id);

/**
* 告警弹窗通知下发
* @return
*/
JsonResult notice();
}

Loading…
Cancel
Save