|
@@ -1,12 +1,12 @@
|
|
|
package com.fdkankan.ucenter.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.fdkankan.common.constant.ErrorCode;
|
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
|
import com.fdkankan.common.response.PageInfo;
|
|
|
+import com.fdkankan.fyun.oss.UploadToOssUtil;
|
|
|
+import com.fdkankan.ucenter.common.OssPath;
|
|
|
import com.fdkankan.ucenter.entity.ScenePlus;
|
|
|
-import com.fdkankan.ucenter.entity.ScenePlusExt;
|
|
|
import com.fdkankan.ucenter.entity.ScenePlusVoid;
|
|
|
import com.fdkankan.ucenter.entity.User;
|
|
|
import com.fdkankan.ucenter.mapper.IScenePlusVoidMapper;
|
|
@@ -16,10 +16,10 @@ import com.fdkankan.ucenter.service.IScenePlusVoidService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fdkankan.ucenter.service.IUserService;
|
|
|
import com.fdkankan.ucenter.vo.request.SceneParam;
|
|
|
+import com.fdkankan.ucenter.vo.response.ScenePlusVo;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.sql.BatchUpdateException;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
@@ -42,6 +42,8 @@ public class ScenePlusVoidServiceImpl extends ServiceImpl<IScenePlusVoidMapper,
|
|
|
IUserService userService;
|
|
|
@Autowired
|
|
|
IScenePlusService scenePlusService;
|
|
|
+ @Autowired
|
|
|
+ UploadToOssUtil uploadToOssUtil;
|
|
|
|
|
|
@Override
|
|
|
public void setStatus(Long plusId, Integer type,String token) {
|
|
@@ -52,26 +54,30 @@ public class ScenePlusVoidServiceImpl extends ServiceImpl<IScenePlusVoidMapper,
|
|
|
if(scenePlus == null){
|
|
|
throw new BusinessException(-1,"场景不存在");
|
|
|
}
|
|
|
- if(type == 0){
|
|
|
- User user = userService.getByToken(token);
|
|
|
- ScenePlusVoid plusVoid = new ScenePlusVoid();
|
|
|
+ ScenePlusVoid plusVoid ;
|
|
|
+ User user = userService.getByToken(token);
|
|
|
+ plusVoid = this.getByPlusId(plusId);
|
|
|
+ if(plusVoid == null){
|
|
|
+ plusVoid = new ScenePlusVoid();
|
|
|
plusVoid.setUserId(user.getId());
|
|
|
plusVoid.setPlusId(plusId);
|
|
|
this.save(plusVoid);
|
|
|
- }else{
|
|
|
- LambdaUpdateWrapper<ScenePlusVoid> wrapper = new LambdaUpdateWrapper<>();
|
|
|
- if(type == 1){
|
|
|
- wrapper.eq(ScenePlusVoid::getPlusId,plusId).set(ScenePlusVoid::getStatus,1);
|
|
|
- }else {
|
|
|
- wrapper.eq(ScenePlusVoid::getPlusId,plusId).set(ScenePlusVoid::getStatus,2);
|
|
|
- }
|
|
|
- this.update(wrapper);
|
|
|
+ }else {
|
|
|
+ plusVoid.setStatus(type);
|
|
|
+ plusVoid.setUpdateTime(null);
|
|
|
+ this.updateById(plusVoid);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
+ private ScenePlusVoid getByPlusId(Long plusId) {
|
|
|
+ LambdaQueryWrapper<ScenePlusVoid> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(ScenePlusVoid::getPlusId,plusId);
|
|
|
+ return this.getOne(wrapper);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
- public PageInfo scenePageList(SceneParam param, String token) {
|
|
|
+ public List<ScenePlusVo> scenePageList(SceneParam param, String token) {
|
|
|
if(param.getHaveVoid()!=null){
|
|
|
User user = userService.getByToken(token);
|
|
|
LambdaQueryWrapper<ScenePlusVoid> wrapper = new LambdaQueryWrapper<>();
|
|
@@ -79,7 +85,7 @@ public class ScenePlusVoidServiceImpl extends ServiceImpl<IScenePlusVoidMapper,
|
|
|
.eq(ScenePlusVoid::getUserId,user.getId());
|
|
|
List<ScenePlusVoid> list = this.list(wrapper);
|
|
|
if(list.size() <=0 && param.getHaveVoid() == 0){
|
|
|
- return new PageInfo(param.getPageNum(),param.getPageSize(),0,new ArrayList<>());
|
|
|
+ return new ArrayList<>();
|
|
|
}
|
|
|
if(list.size() >0){
|
|
|
List<Long> plusIds = list.parallelStream().map(ScenePlusVoid::getPlusId).collect(Collectors.toList());
|
|
@@ -91,7 +97,17 @@ public class ScenePlusVoidServiceImpl extends ServiceImpl<IScenePlusVoidMapper,
|
|
|
}
|
|
|
}
|
|
|
param.setStatus(2); //计算成功的数据
|
|
|
- return fusionService.scenePageList(param,token);
|
|
|
+ param.setPageSize(Integer.MAX_VALUE);
|
|
|
+ PageInfo pageInfo = fusionService.scenePageList(param, token);
|
|
|
+ List<ScenePlusVo> list = (List<ScenePlusVo>) pageInfo.getList();
|
|
|
+ List<ScenePlusVo> newList = new ArrayList<>();
|
|
|
+ for (ScenePlusVo scenePlusVo : list) { //检测oss 是否存在houseType
|
|
|
+ String key = String.format(OssPath.houseTypePath,scenePlusVo.getNum());
|
|
|
+ if(uploadToOssUtil.existKey(key)){
|
|
|
+ newList.add(scenePlusVo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return newList;
|
|
|
}
|
|
|
|
|
|
@Override
|