113
社区成员
发帖
与我相关
我的任务
分享| 这个作业属于哪个课程 | https://bbs.csdn.net/forums/2401_CS_SE_FZU |
|---|---|
| 这个作业要求在哪里 | https://bbs.csdn.net/topics/619397949 |
| 这个作业的目标 | CodeArt团队实战总结 |
| 其他参考文献 | CSDN,博客园 |
222200315张俊腾
进展一:完成了RescueInfoRepository接口的实现,支持查询用户参与的救援信息。

222200309孙阳
进展一:完成entity_message
package com.bafang.entity.entity_message;
import jakarta.persistence.*;
import java.time.LocalDateTime;
@Entity
@Table(name = "message")
public class Message {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "to_uid", nullable = false)
private Long toUid;
@Column(name = "title", nullable = false)
private String title;
@Column(name = "content", nullable = false)
private String content;
@Column(name = "created_at", nullable = false)
private LocalDateTime createdAt;
@Column(name = "updated_at")
private LocalDateTime updatedAt;
@Column(name = "deleted_at")
private LocalDateTime deletedAt;
@PrePersist
protected void onCreate() {
this.createdAt = LocalDateTime.now();
this.updatedAt = LocalDateTime.now();
}
@PreUpdate
protected void onUpdate() {
this.updatedAt = LocalDateTime.now();
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getToUid() {
return toUid;
}
public void setToUid(Long toUid) {
this.toUid = toUid;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public LocalDateTime getCreatedAt() {
return createdAt;
}
public void setCreatedAt(LocalDateTime createdAt) {
this.createdAt = createdAt;
}
public LocalDateTime getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(LocalDateTime updatedAt) {
this.updatedAt = updatedAt;
}
public LocalDateTime getDeletedAt() {
return deletedAt;
}
public void setDeletedAt(LocalDateTime deletedAt) {
this.deletedAt = deletedAt;
}
}
进展二:完成entity_medal
package com.bafang.entity.entity_medal;
import jakarta.persistence.*;
import java.time.LocalDateTime;
@Entity
@Table(name = "user_medal")
public class UserMedal {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(nullable = false)
private Long uid;
@Column(name = "medal_type", nullable = false)
private Byte medalType;
@Column(name = "created_at", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
private LocalDateTime createdAt;
@Column(name = "updated_at", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
private LocalDateTime updatedAt;
@Column(name = "deleted_at")
private LocalDateTime deletedAt;
@PrePersist
protected void onCreate() {
this.createdAt = LocalDateTime.now();
this.updatedAt = LocalDateTime.now();
}
@PreUpdate
protected void onUpdate() {
this.updatedAt = LocalDateTime.now();
}
// Getters and Setters
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getUid() {
return uid;
}
public void setUid(Long uid) {
this.uid = uid;
}
public Byte getMedalType() {
return medalType;
}
public void setMedalType(Byte medalType) {
this.medalType = medalType;
}
public LocalDateTime getCreatedAt() {
return createdAt;
}
public void setCreatedAt(LocalDateTime createdAt) {
this.createdAt = createdAt;
}
public LocalDateTime getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(LocalDateTime updatedAt) {
this.updatedAt = updatedAt;
}
public LocalDateTime getDeletedAt() {
return deletedAt;
}
public void setDeletedAt(LocalDateTime deletedAt) {
this.deletedAt = deletedAt;
}
}
222200304卢君豪
进展一:“获取我的求助信息”dto的创建
package com.bafang.dto.dto_help;
import java.time.LocalDateTime;
public class HelpRequestInfo {
private Long id;
private Long uid;
private String location;
private Integer type;
private String phoneNumber;
private String detailedAddress;
private String roadCondition;
private String weatherCondition;
private String utilitiesInfo;
private Integer assistanceType;
private String suppliesNeeded;
private String introduction;
private LocalDateTime createdAt;
public HelpRequestInfo(Long id, Long uid, String location, Integer type, String phoneNumber, String detailedAddress, String roadCondition, String weatherCondition, String utilitiesInfo, Integer assistanceType, String suppliesNeeded, String introduction, LocalDateTime createdAt) {
this.id = id;
this.uid = uid;
this.location = location;
this.type = type;
this.phoneNumber = phoneNumber;
this.detailedAddress = detailedAddress;
this.roadCondition = roadCondition;
this.weatherCondition = weatherCondition;
this.utilitiesInfo = utilitiesInfo;
this.assistanceType = assistanceType;
this.suppliesNeeded = suppliesNeeded;
this.introduction = introduction;
this.createdAt = createdAt;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getUid() {
return uid;
}
public void setUid(Long uid) {
this.uid = uid;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public String getDetailedAddress() {
return detailedAddress;
}
public void setDetailedAddress(String detailedAddress) {
this.detailedAddress = detailedAddress;
}
public String getRoadCondition() {
return roadCondition;
}
public void setRoadCondition(String roadCondition) {
this.roadCondition = roadCondition;
}
public String getWeatherCondition() {
return weatherCondition;
}
public void setWeatherCondition(String weatherCondition) {
this.weatherCondition = weatherCondition;
}
public String getUtilitiesInfo() {
return utilitiesInfo;
}
public void setUtilitiesInfo(String utilitiesInfo) {
this.utilitiesInfo = utilitiesInfo;
}
public Integer getAssistanceType() {
return assistanceType;
}
public void setAssistanceType(Integer assistanceType) {
this.assistanceType = assistanceType;
}
public String getSuppliesNeeded() {
return suppliesNeeded;
}
public void setSuppliesNeeded(String suppliesNeeded) {
this.suppliesNeeded = suppliesNeeded;
}
public String getIntroduction() {
return introduction;
}
public void setIntroduction(String introduction) {
this.introduction = introduction;
}
public LocalDateTime getCreatedAt() {
return createdAt;
}
public void setCreatedAt(LocalDateTime createdAt) {
this.createdAt = createdAt;
}
}
进展二:“获取我的求助信息”controller的创建
package com.bafang.controller;
import com.bafang.dto.Response.ResultResponse;
import com.bafang.dto.dto_help.HelpRequestInfo;
import com.bafang.service.HelpRequestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/bafang/help_request")
public class HelpRequestController {
@Autowired
private HelpRequestService helpRequestService;
@GetMapping("/user")
public ResultResponse<List<HelpRequestInfo>> getUserHelpRequestInfo(@RequestParam Long uid, @RequestHeader("Authorization") String token) {
return helpRequestService.getUserHelpRequestInfo(uid, token);
}
}
进展三:token相关知识的学习
222200310李怡涵
进展一:各个功能的框架
package com.bafang.controller;
import com.bafang.dto.Response.ResultResponse;
import com.bafang.dto.dto_live.*;
import com.bafang.service.LiveInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/bafang/live_info")
public class LiveInfoController {
@Autowired
private LiveInfoService liveInfoService;
@GetMapping("/user")
public ResultResponse<List<UserLiveList>> getUserLive(
@RequestParam("uid") Long uid,
@RequestHeader("Authorization") String token
) {
return liveInfoService.getUserLive(uid, token);
}
@GetMapping
public ResultResponse<List<UserLiveList>> getNearbyLive(
@RequestParam("location") String location,
@RequestHeader("Authorization") String token
) {
return liveInfoService.getNearbyLive(location, token);
}
@PostMapping
public ResultResponse<UserUpload> uploadLive(
@ModelAttribute UserUploadRequest userUploadRequest,
@RequestHeader("Authorization") String token
){
return liveInfoService.uploadLive(userUploadRequest, token);
}
@PostMapping("/action")
public ResultResponse<UserAction> likeOrDislikeLive(
@ModelAttribute UserActionRequest userActionRequest,
@RequestHeader("Authorization") String token
){
return liveInfoService.likeOrDislikeLive(userActionRequest, token);
}
}
进展二:dto文件夹中的请求和返回类的定义。实例:UserUploadReque
package com.bafang.dto.dto_live;
public class UserUploadRequest {
private String Location;
private String weatherCondition;
private String roadCondition;
private String utilitiesInfo;
private Integer level;
private String introduction;
private String expiryAt;
public String getExpiryAt() {
return expiryAt;
}
public void setExpiryAt(String expiryAt) {
this.expiryAt = expiryAt;
}
public String getLocation() {
return Location;
}
public void setLocation(String location) {
Location = location;
}
public String getWeatherCondition() {
return weatherCondition;
}
public void setWeatherCondition(String weatherCondition) {
this.weatherCondition = weatherCondition;
}
public String getRoadCondition() {
return roadCondition;
}
public void setRoadCondition(String roadCondition) {
this.roadCondition = roadCondition;
}
public String getUtilitiesInfo() {
return utilitiesInfo;
}
public void setUtilitiesInfo(String utilitiesInfo) {
this.utilitiesInfo = utilitiesInfo;
}
public Integer getLevel() {
return level;
}
public void setLevel(Integer level) {
this.level = level;
}
public String getIntroduction() {
return introduction;
}
public void setIntroduction(String introduction) {
this.introduction = introduction;
}
}
222200311李梓玄
进展一:研究高德地图api使用https://lbs.amap.com/api/webservice/guide/api-advanced/newpoisearch
进展二:完成「发布实况」「发起求助」的按钮及页面跳转

222200328夏振
进展一:debug并拓展授予/取消管理员权限功能
进展二:新增token工具,用于解析token对应uid
进展三:新增查询id是否存在
222200401丁昌彪
进展一: 完成了客户端注册、登录和登出功能
222200312杨年申
进展一:完成UserController.login及其Request的搭建
@PostMapping("/login") // 表示这个方法将处理 POST /bafang/user/login 请求
public ResultResponse<UserLogin> login(@ModelAttribute LoginRequest loginRequest) {
return userService.login(loginRequest);
}
public class LoginRequest {
private String username;
private String password;
// Getter 和 Setter
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
进展二:完善login的Service
public class UserService {
public ResultResponse<UserLogin> login(LoginRequest loginRequest) {
// 检查用户是否存在
User user = userRepository.findByUsername(loginRequest.getUsername());
if (user == null) {
return new ResultResponse<>(401, "用户名不存在", null);
}
// 验证密码
if (!passwordEncoder.matches(loginRequest.getPassword(), user.getPassword())) {
return new ResultResponse<>(401, "密码错误", null);
}
// 生成JWT令牌
String token = JwtUtil.generateToken(user.getId());
// 返回响应
return new ResultResponse<>(200, "success", new UserLogin(user.getId(), user.getUsername(), token));
}
}
222200230梁蕴潆
进展一:编写冲刺博客
进展二:尝试编写Vue 路由配置
import Vue from 'vue'
import VueRouter from 'vue-router'
import MutualAidList from '../components/互助信息列表/MutualAidList.vue'
import MutualAidForm from '../components/互助信息表单/MutualAidForm.vue'
Vue.use(VueRouter)
const routes = [
{
path: '/',
name: 'MutualAidList',
component: MutualAidList
},
{
path: '/form',
name: 'MutualAidForm',
component: MutualAidForm
}
]
const router = new VueRouter({
mode: 'history',
base: process.env.BASE_URL,
routes
})
export default router
| 成员 | 存在的问题/遇到的困难 | 接下来的安排 |
|---|---|---|
| 222200315张俊腾 | 问题:在实现自定义查询方法时,遇到命名冲突。- 解答:调整了方法名以避免冲突,增加注解@Query来实现自定义逻辑。
| 开发AcceptHelpRequestRequest DTO 类和测试用例。 |
| 222200309孙阳 | 无 | 打算开始编写“获取用户奖牌”的接口代码 |
| 222200304卢君豪 | 无 | “获取我的求助信息”service的创建和相关功能函数的实现 |
| 222200310李怡涵 | 无 | 继续完善后端代码,实现新的接口功能 |
| 222200311李梓玄 | 问题、困难1:还是高德地图api,原本老旧的文档加上封装复杂导致代码难以理解,地图拖拽选点获取位置未能按时完成- 解答:已经理解大半,只能是花费更多时间了 | 实现地图拖拽选点获取位置 |
| 222200328夏振 | id查询用户role竟然返回null导致卡壳3小时- 不知道哪里的bug自己就修复了,奇了怪了 | 接下来例如软封禁等功能的设计和实现,并总结今天完成的内容 |
| 222200401丁昌彪 | 问题:没有注入viewMoel导致客户端闪退 解决办法:开启调试模式,寻找闪退原因,找到后注入相应的viewModel | 1. 完成用户实名认证功能 2. 完成用户基本资料功能 3. 完成求助历史功能 |
| 222200312杨年申 | 问题、困难1- - 登录业务逻辑复杂,可能需要处理多个场景,例如用户不存在、密码错误等,导致代码冗长且难以维护。- 解答 - - 将登录逻辑拆分成多个小的方法,每个方法负责一个具体的检查(如验证用户是否存在、验证密码等),提高代码的可读性和可维护性。- 问题、困难2 - - 登录接口容易受到攻击(如 SQL 注入、暴力破解等)。- 解答- - 使用 JWT 或其他令牌机制进行身份验证,确保接口的安全性。 | 安排实现一个接口register |
| 222200230梁蕴潆 | 理解Vuex的深层原理、掌握高级组件通信对我来说还是有些困难。 | 继续学习有关灾难互助平台vue框架 |

| 成员 | 相关图片 |
|---|---|
| 222200315张俊腾 |
|
| 222200309孙阳 |
|
| 222200304卢君豪 |
|
| 222200310李怡涵 |
|
| 222200311李梓玄 |
|
| 222200328夏振 |
|
| 222200401丁昌彪 |
|
| 222200312杨年申 |
|
| 222200230梁蕴潆 |
|
| 成员 | 心得体会 |
|---|---|
| 222200315张俊腾 | 理解了如何在JPA中使用命名约定和注解进行复杂查询 |
| 222200309孙阳 | 认真做好每一件小事,小到包括对某个变量的命名 |
| 222200304卢君豪 | 非常好的学习,使我学习token |
| 222200310李怡涵 | 更加了解后端代码的运行逻辑,了解了前后端对接的相关知识。 |
| 222200311李梓玄 | 文档很重要,文档很重要,文档很重要。 |
| 222200328夏振 | 感谢项目使我获得提升,谢谢 |
| 222200401丁昌彪 | 编程是一个需要耐心的过程。遇到复杂的问题时,要冷静分析,分步解决,而不是急于求成。 |
| 222200312杨年申 | 清晰的结构:将 Controller 和 Service 层的职责明确分开,可以让代码结构更加清晰。Controller 只负责处理请求和返回响应,而 Service 处理具体的业务逻辑,这种分层设计提高了代码的可维护性。- 重视安全性:在设计登录接口时,安全性是一个不容忽视的因素。通过合理的权限管理和安全措施,可以有效保护用户信息,防止恶意攻击。 |
| 222200230梁蕴潆 | 更加了解前端代码的运行逻辑,学到很多新知识。 |