用 suyu living streaming 这个网站 + obs 获取手机摄像头; 然后在网页上获取obs的虚拟摄像头进行跌倒检测的功能
服务端处理前端传过来数据的类
package com.example.teamapplication.controller; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.example.teamapplication.common.Result; import com.example.teamapplication.entity.News; import com.example.teamapplication.service.NewsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.OffsetDateTime; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.List; import java.util.Map; /** * <p> * 前端控制器 * </p> * * @author xu * @since 2024-06-09 */ @RestController @RequestMapping("/news") public class NewsController { @Autowired NewsService newsService; @PostMapping("savenews") public Result saveNews(@RequestBody Map<String, Object> request){ Map<String, Object> param = (Map<String, Object>) request.get("param"); String title = (String) param.get("title"); String content = (String) param.get("content"); String publishTime = (String) param.get("publishTime"); String articleType = (String) param.get("articleType"); String base64Image = (String) param.get("base64Image"); // 现在你可以在这里处理所有这些字段,包括图片的 Base64 编码 byte[] decodedBytes = javax.xml.bind.DatatypeConverter.parseBase64Binary(base64Image.split(",")[1]); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSX"); LocalDateTime dateTime = LocalDateTime.parse(publishTime, formatter); News news = new News(); news.setTitle(title); news.setContent(content); news.setTime(dateTime); news.setType(articleType); news.setImg(decodedBytes); newsService.save(news); return Result.suc(); } @PostMapping("getnews") public Result getNews(){ List<News> News = newsService.lambdaQuery().list(); ArrayList<News> news = new ArrayList<>(); for(int i =0;i<News.size();i++){ System.out.println(News.get(i).getTitle()); news.add(News.get(i)); } System.out.println("111"); return Result.suc(news); } @PostMapping("search") public Result searchNews(@RequestParam String keyword){ LambdaQueryWrapper<News> lambdaQueryWrapper = new LambdaQueryWrapper<>(); lambdaQueryWrapper.like(News::getTitle, keyword) .or().like(News::getType, keyword) .or().like(News::getContent, keyword); List<News> news = newsService.list(lambdaQueryWrapper); // 假设这里调用了服务层方法进行查询 return Result.suc(news); } }View Code
标签:java,String,News,param,冲刺,news,import,第二阶段 From: https://www.cnblogs.com/azure011328/p/18247435