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