|
@@ -0,0 +1,65 @@
|
|
|
+package com.fdkankan.scene.service.impl;
|
|
|
+
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
+import com.fdkankan.common.constant.CommonOperStatus;
|
|
|
+import com.fdkankan.common.constant.CommonStatus;
|
|
|
+import com.fdkankan.scene.entity.SceneAsynOperLog;
|
|
|
+import com.fdkankan.scene.mapper.ISceneAsynOperLogMapper;
|
|
|
+import com.fdkankan.scene.service.ISceneAsynOperLogService;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.fdkankan.scene.vo.SceneAsynOperLogParamVO;
|
|
|
+import com.fdkankan.web.response.ResultData;
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 服务实现类
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author
|
|
|
+ * @since 2022-12-07
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class SceneAsynOperLogServiceImpl extends ServiceImpl<ISceneAsynOperLogMapper, SceneAsynOperLog> implements ISceneAsynOperLogService {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ResultData getAsynOperLog(SceneAsynOperLogParamVO param) {
|
|
|
+
|
|
|
+ LambdaQueryWrapper<SceneAsynOperLog> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(SceneAsynOperLog::getNum, param.getNum());
|
|
|
+ if(StrUtil.isNotEmpty(param.getOperType())){
|
|
|
+ queryWrapper.eq(SceneAsynOperLog::getOperType, param.getOperType());
|
|
|
+ }
|
|
|
+ if(StrUtil.isNotEmpty(param.getModule())){
|
|
|
+ queryWrapper.eq(SceneAsynOperLog::getModule, param.getModule());
|
|
|
+ }
|
|
|
+ if(StrUtil.isNotEmpty(param.getFunction())){
|
|
|
+ queryWrapper.eq(SceneAsynOperLog::getFunction, param.getFunction());
|
|
|
+ }
|
|
|
+
|
|
|
+ //需要弹窗的异步操作列表
|
|
|
+ List<SceneAsynOperLog> list = this.list(queryWrapper);
|
|
|
+
|
|
|
+ //如果列表中有需要弹窗并且处理完毕的,需要把这些数据改为不需要弹窗了,因为前端请求到之后就会弹出提示,下次不需要弹窗了
|
|
|
+ if(CollUtil.isNotEmpty(list)){
|
|
|
+ List<Long> idList = list.stream().filter(log -> {
|
|
|
+ if(!log.getState().equals(CommonOperStatus.WAITING.code())){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }).map(log->log.getId()).collect(Collectors.toList());
|
|
|
+ if(CollUtil.isNotEmpty(idList)){
|
|
|
+ this.update(new LambdaUpdateWrapper<SceneAsynOperLog>()
|
|
|
+ .set(SceneAsynOperLog::getPop, CommonStatus.NO.code())
|
|
|
+ .in(SceneAsynOperLog::getId, idList));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return ResultData.ok(list);
|
|
|
+ }
|
|
|
+}
|