浏览代码

Merge branch 'develop' of gitadmin/tuoheng_freeway into release

tags/V1.3.3
wanjing 10 个月前
父节点
当前提交
b33cccec79
共有 1 个文件被更改,包括 11 次插入3 次删除
  1. +11
    -3
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accidentread/AccidentReadServiceImpl.java

+ 11
- 3
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accidentread/AccidentReadServiceImpl.java 查看文件

@@ -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();
}


正在加载...
取消
保存