Browse Source

Merge branch 'develop' of gitadmin/tuoheng_freeway into release

tags/V1.3.3
wanjing 11 months ago
parent
commit
b33cccec79
1 changed files with 11 additions and 3 deletions
  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 View File

package com.tuoheng.admin.service.accidentread; 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.entity.AccidentRead;
import com.tuoheng.admin.enums.AccidentEnum; import com.tuoheng.admin.enums.AccidentEnum;
import com.tuoheng.admin.mapper.AccidentReadMapper; import com.tuoheng.admin.mapper.AccidentReadMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;


import java.util.List;

/** /**
* @Author ChengWang * @Author ChengWang
* @Date 2023/3/2 * @Date 2023/3/2
} }
//当前用户信息 //当前用户信息
String userId = CurrentUserUtil.getUserId(); 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 accidentRead = new AccidentRead();
accidentRead.setAccidentId(accidentId); accidentRead.setAccidentId(accidentId);
if(result<=0){ if(result<=0){
return JsonResult.error(); return JsonResult.error();
} }

return JsonResult.success(); return JsonResult.success();
} }



Loading…
Cancel
Save