|
@@ -8,16 +8,16 @@ import cn.com.ty.lift.quan.news.service.QuanNewsService;
|
|
|
import cn.com.xwy.boot.web.dto.RestResponse;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
-import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
-import java.io.IOException;
|
|
|
-import java.util.*;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -138,10 +138,6 @@ public class QuanNewsServiceImpl extends ServiceImpl<QuanNewsMapper, QuanNews> i
|
|
|
void newsAddLookAndLike(List<Map<String, Object>> records, Map<Object, Object> lookTimes, Map<Object, Object> likeUsers) {
|
|
|
for (Map<String, Object> record : records) {
|
|
|
Object id = record.get("id");
|
|
|
- if (null != record.get("video_name")) {
|
|
|
- //fixme 新闻视频的路径
|
|
|
- record.put("video_name", "https://temp15827479607.oss-cn-beijing.aliyuncs.com/" + record.get("video_name"));
|
|
|
- }
|
|
|
//如果没有浏览量
|
|
|
if (lookTimes.isEmpty()) {
|
|
|
record.put("lookNum", "0");
|
|
@@ -254,29 +250,6 @@ public class QuanNewsServiceImpl extends ServiceImpl<QuanNewsMapper, QuanNews> i
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //新增、更新新闻时上传文件
|
|
|
- public RestResponse upFile(MultipartFile file) {
|
|
|
- String originalFilename = file.getOriginalFilename();
|
|
|
- if (originalFilename != null && originalFilename.contains(".")) {
|
|
|
- String fileName = "quan/news/video/" + IdWorker.getIdStr()
|
|
|
- + "."
|
|
|
- + originalFilename.substring(file.getOriginalFilename().lastIndexOf(".") + 1);
|
|
|
- //阿里云OSS操作结果
|
|
|
- boolean result = false;
|
|
|
- try {
|
|
|
- result = new AliyunOSSUtil().putObject(file.getBytes(), fileName);
|
|
|
- } catch (IOException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- //如果保存成功
|
|
|
- if (result) {
|
|
|
- return RestResponse.success(fileName);
|
|
|
- }
|
|
|
- return RestResponse.fail();
|
|
|
- }
|
|
|
- return RestResponse.failParam();
|
|
|
- }
|
|
|
-
|
|
|
public RestResponse like(QuanNewsReq req) {
|
|
|
String uid = req.getUserId().toString();
|
|
|
String id = req.getId().toString();
|
|
@@ -318,8 +291,6 @@ public class QuanNewsServiceImpl extends ServiceImpl<QuanNewsMapper, QuanNews> i
|
|
|
}
|
|
|
byId.put("lookNum", lookNum);
|
|
|
byId.put("isLike", isLike);
|
|
|
- //fixme 新闻视频的路径
|
|
|
- byId.put("videoName", "https://temp15827479607.oss-cn-beijing.aliyuncs.com/" + byId.get("videoName"));
|
|
|
return RestResponse.success(byId, "成功");
|
|
|
} else {
|
|
|
return RestResponse.success();
|