|
|
@@ -1,5 +1,7 @@ |
|
|
|
package com.tuoheng.admin.service.accidentread; |
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.tuoheng.admin.entity.AccidentRead; |
|
|
|
import com.tuoheng.admin.enums.AccidentEnum; |
|
|
|
import com.tuoheng.admin.mapper.AccidentReadMapper; |
|
|
@@ -14,6 +16,8 @@ import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Author ChengWang |
|
|
|
* @Date 2023/3/2 |
|
|
@@ -38,8 +42,13 @@ public class AccidentReadServiceImpl implements IAccidentReadService { |
|
|
|
} |
|
|
|
//当前用户信息 |
|
|
|
String userId = CurrentUserUtil.getUserId(); |
|
|
|
if(StringUtils.isEmpty(userId)){ |
|
|
|
throw new ServiceException("用户id为空"); |
|
|
|
AccidentRead accidentReadOld = accidentReadMapper.selectOne(new LambdaQueryWrapper<AccidentRead>() |
|
|
|
.eq(AccidentRead::getUserId, userId) |
|
|
|
.eq(AccidentRead::getAccidentId, accidentId) |
|
|
|
.last("limit 1")); |
|
|
|
if (ObjectUtil.isNotEmpty(accidentReadOld)) { |
|
|
|
log.info("应急记录已读已存在,userId={}, accidentId={}", userId, accidentId); |
|
|
|
return JsonResult.success(); |
|
|
|
} |
|
|
|
AccidentRead accidentRead = new AccidentRead(); |
|
|
|
accidentRead.setAccidentId(accidentId); |
|
|
@@ -51,7 +60,6 @@ public class AccidentReadServiceImpl implements IAccidentReadService { |
|
|
|
if(result<=0){ |
|
|
|
return JsonResult.error(); |
|
|
|
} |
|
|
|
|
|
|
|
return JsonResult.success(); |
|
|
|
} |
|
|
|
|