新增固件管理
Some checks failed
CI Build and Test / build (push) Has been cancelled
Deploy to Server / build-and-deploy (push) Has been cancelled

This commit is contained in:
2025-10-23 09:25:28 +08:00
parent 8a1ef59a8f
commit b3593eaed8
26 changed files with 445 additions and 139 deletions

View File

@@ -334,6 +334,7 @@ GET /params/my/page?current=1&size=10&fcModel=Pixhawk%204
{ {
"id": 1, "id": 1,
"userId": 1, "userId": 1,
"username": "张三",
"paramName": "默认参数配置", "paramName": "默认参数配置",
"deviceName": "我的无人机", "deviceName": "我的无人机",
"description": "这是一个测试参数配置", "description": "这是一个测试参数配置",

View File

@@ -5,8 +5,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.corewing.app.common.Result; import com.corewing.app.common.Result;
import com.corewing.app.dto.FeedbackRequest; import com.corewing.app.dto.FeedbackRequest;
import com.corewing.app.entity.AppFeedback; import com.corewing.app.entity.Feedback;
import com.corewing.app.service.AppFeedbackService; import com.corewing.app.service.FeedbackService;
import com.corewing.app.util.DingTalkUtil; import com.corewing.app.util.DingTalkUtil;
import com.corewing.app.util.I18nUtil; import com.corewing.app.util.I18nUtil;
import com.corewing.app.util.Ip2RegionUtil; import com.corewing.app.util.Ip2RegionUtil;
@@ -23,13 +23,13 @@ import java.util.List;
*/ */
@RestController @RestController
@RequestMapping("/feedback") @RequestMapping("/feedback")
public class AppFeedbackController { public class FeedbackController {
private final AppFeedbackService feedbackService; private final FeedbackService feedbackService;
private final DingTalkUtil dingTalkUtil; private final DingTalkUtil dingTalkUtil;
private final Ip2RegionUtil ip2RegionUtil; private final Ip2RegionUtil ip2RegionUtil;
public AppFeedbackController(AppFeedbackService feedbackService, DingTalkUtil dingTalkUtil, Ip2RegionUtil ip2RegionUtil) { public FeedbackController(FeedbackService feedbackService, DingTalkUtil dingTalkUtil, Ip2RegionUtil ip2RegionUtil) {
this.feedbackService = feedbackService; this.feedbackService = feedbackService;
this.dingTalkUtil = dingTalkUtil; this.dingTalkUtil = dingTalkUtil;
this.ip2RegionUtil = ip2RegionUtil; this.ip2RegionUtil = ip2RegionUtil;
@@ -49,7 +49,7 @@ public class AppFeedbackController {
// 未登录userId 保持为 null // 未登录userId 保持为 null
} }
AppFeedback feedback = new AppFeedback(); Feedback feedback = new Feedback();
feedback.setUserId(userId); feedback.setUserId(userId);
feedback.setFeedbackType(request.getFeedbackType()); feedback.setFeedbackType(request.getFeedbackType());
feedback.setTitle(request.getTitle()); feedback.setTitle(request.getTitle());
@@ -76,11 +76,11 @@ public class AppFeedbackController {
* 查询当前用户的反馈列表 * 查询当前用户的反馈列表
*/ */
@GetMapping("/my") @GetMapping("/my")
public Result<List<AppFeedback>> getMyFeedbackList() { public Result<List<Feedback>> getMyFeedbackList() {
try { try {
// 获取当前登录用户ID // 获取当前登录用户ID
Long userId = StpUtil.getLoginIdAsLong(); Long userId = StpUtil.getLoginIdAsLong();
List<AppFeedback> feedbackList = feedbackService.listByUserId(userId); List<Feedback> feedbackList = feedbackService.listByUserId(userId);
return Result.success(feedbackList); return Result.success(feedbackList);
} catch (Exception e) { } catch (Exception e) {
return Result.error(e.getMessage()); return Result.error(e.getMessage());
@@ -91,9 +91,9 @@ public class AppFeedbackController {
* 根据ID查询反馈详情 * 根据ID查询反馈详情
*/ */
@GetMapping("/{id}") @GetMapping("/{id}")
public Result<AppFeedback> getById(@PathVariable Long id) { public Result<Feedback> getById(@PathVariable Long id) {
try { try {
AppFeedback feedback = feedbackService.getById(id); Feedback feedback = feedbackService.getById(id);
if (feedback != null) { if (feedback != null) {
return Result.success(feedback); return Result.success(feedback);
} }
@@ -113,15 +113,15 @@ public class AppFeedbackController {
* @param status 状态可选 * @param status 状态可选
*/ */
@GetMapping("/page") @GetMapping("/page")
public Result<IPage<AppFeedback>> getPageList( public Result<IPage<Feedback>> getPageList(
@RequestParam(defaultValue = "1") Long current, @RequestParam(defaultValue = "1") Long current,
@RequestParam(defaultValue = "10") Long size, @RequestParam(defaultValue = "10") Long size,
@RequestParam(required = false) Long userId, @RequestParam(required = false) Long userId,
@RequestParam(required = false) String feedbackType, @RequestParam(required = false) String feedbackType,
@RequestParam(required = false) Integer status) { @RequestParam(required = false) Integer status) {
try { try {
Page<AppFeedback> page = new Page<>(current, size); Page<Feedback> page = new Page<>(current, size);
IPage<AppFeedback> pageResult = feedbackService.pageList(page, userId, feedbackType, status); IPage<Feedback> pageResult = feedbackService.pageList(page, userId, feedbackType, status);
return Result.success(pageResult); return Result.success(pageResult);
} catch (Exception e) { } catch (Exception e) {
return Result.error(e.getMessage()); return Result.error(e.getMessage());
@@ -184,7 +184,7 @@ public class AppFeedbackController {
/** /**
* 发送反馈信息到钉钉 * 发送反馈信息到钉钉
*/ */
private void sendFeedbackToDingTalk(AppFeedback feedback, String submitIp, String submitRegion) { private void sendFeedbackToDingTalk(Feedback feedback, String submitIp, String submitRegion) {
try { try {
String title = I18nUtil.getMessage("dingtalk.feedback.title"); String title = I18nUtil.getMessage("dingtalk.feedback.title");
StringBuilder text = new StringBuilder(); StringBuilder text = new StringBuilder();

View File

@@ -0,0 +1,143 @@
package com.corewing.app.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.corewing.app.common.Result;
import com.corewing.app.entity.Firmware;
import com.corewing.app.service.FirmwareService;
import com.corewing.app.util.I18nUtil;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
/**
* 固件 Controller
*/
@RestController
@RequestMapping("/firmware")
public class FirmwareController {
private final FirmwareService firmwareService;
public FirmwareController(FirmwareService firmwareService) {
this.firmwareService = firmwareService;
}
/**
* 新增固件
*/
@PostMapping
public Result<String> add(@RequestBody Firmware firmware) {
try {
// 检查固件名称是否已存在
Firmware existFirmware = firmwareService.getByFirmwareName(firmware.getFirmwareName());
if (existFirmware != null) {
return Result.error(I18nUtil.getMessage("firmware.name.exists"));
}
boolean success = firmwareService.save(firmware);
if (success) {
return Result.success(I18nUtil.getMessage("firmware.add.success"));
}
return Result.error(I18nUtil.getMessage("firmware.add.failed"));
} catch (Exception e) {
return Result.error(e.getMessage());
}
}
/**
* 删除固件
*/
@DeleteMapping("/{id}")
public Result<String> delete(@PathVariable Long id) {
try {
boolean success = firmwareService.removeById(id);
if (success) {
return Result.success(I18nUtil.getMessage("firmware.delete.success"));
}
return Result.error(I18nUtil.getMessage("firmware.delete.failed"));
} catch (Exception e) {
return Result.error(e.getMessage());
}
}
/**
* 更新固件
*/
@PutMapping
public Result<String> update(@RequestBody Firmware firmware) {
try {
// 检查固件名称是否与其他固件重复
if (StringUtils.hasText(firmware.getFirmwareName())) {
Firmware existFirmware = firmwareService.getByFirmwareName(firmware.getFirmwareName());
if (existFirmware != null && !existFirmware.getId().equals(firmware.getId())) {
return Result.error(I18nUtil.getMessage("firmware.name.exists"));
}
}
boolean success = firmwareService.updateById(firmware);
if (success) {
return Result.success(I18nUtil.getMessage("firmware.update.success"));
}
return Result.error(I18nUtil.getMessage("firmware.update.failed"));
} catch (Exception e) {
return Result.error(e.getMessage());
}
}
/**
* 根据ID查询固件
*/
@GetMapping("/{id}")
public Result<Firmware> getById(@PathVariable Long id) {
Firmware firmware = firmwareService.getById(id);
if (firmware != null) {
return Result.success(firmware);
}
return Result.error(I18nUtil.getMessage("firmware.not.found"));
}
/**
* 分页查询固件列表
*
* @param current 当前页
* @param size 每页大小
* @param firmwareName 固件名称(可选)
* @param firmwareType 固件类型(可选)
*/
@GetMapping("/page")
public Result<IPage<Firmware>> page(
@RequestParam(defaultValue = "1") Long current,
@RequestParam(defaultValue = "10") Long size,
@RequestParam(required = false) String firmwareName,
@RequestParam(required = false) String firmwareType) {
Page<Firmware> page = new Page<>(current, size);
QueryWrapper<Firmware> wrapper = new QueryWrapper<>();
// 根据固件名称模糊查询
if (StringUtils.hasText(firmwareName)) {
wrapper.like("firmware_name", firmwareName);
}
// 根据固件类型查询
if (StringUtils.hasText(firmwareType)) {
wrapper.eq("firmware_type", firmwareType);
}
// 按创建时间倒序排列
wrapper.orderByDesc("create_time");
IPage<Firmware> result = firmwareService.page(page, wrapper);
return Result.success(result);
}
/**
* 查询所有固件
*/
@GetMapping("/list")
public Result<java.util.List<Firmware>> list() {
java.util.List<Firmware> list = firmwareService.list();
return Result.success(list);
}
}

View File

@@ -6,10 +6,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.corewing.app.common.Result; import com.corewing.app.common.Result;
import com.corewing.app.dto.CreateParamRequest; import com.corewing.app.dto.CreateParamRequest;
import com.corewing.app.dto.UpdateParamRequest; import com.corewing.app.dto.UpdateParamRequest;
import com.corewing.app.entity.AppParamsCenter; import com.corewing.app.entity.ParamsCenter;
import com.corewing.app.service.AppParamsCenterService; import com.corewing.app.service.ParamsCenterService;
import com.corewing.app.util.I18nUtil; import com.corewing.app.util.I18nUtil;
import com.corewing.app.vo.AppParamsCenterVO; import com.corewing.app.vo.ParamsCenterVO;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.Valid; import javax.validation.Valid;
@@ -20,11 +20,11 @@ import java.util.List;
*/ */
@RestController @RestController
@RequestMapping("/params") @RequestMapping("/params")
public class AppParamsCenterController { public class ParamsCenterController {
private final AppParamsCenterService paramsService; private final ParamsCenterService paramsService;
public AppParamsCenterController(AppParamsCenterService paramsService) { public ParamsCenterController(ParamsCenterService paramsService) {
this.paramsService = paramsService; this.paramsService = paramsService;
} }
@@ -36,7 +36,7 @@ public class AppParamsCenterController {
try { try {
Long userId = StpUtil.getLoginIdAsLong(); Long userId = StpUtil.getLoginIdAsLong();
AppParamsCenter params = new AppParamsCenter(); ParamsCenter params = new ParamsCenter();
params.setUserId(userId); params.setUserId(userId);
params.setParamName(request.getParamName()); params.setParamName(request.getParamName());
params.setDeviceName(request.getDeviceName()); params.setDeviceName(request.getDeviceName());
@@ -66,7 +66,7 @@ public class AppParamsCenterController {
Long userId = StpUtil.getLoginIdAsLong(); Long userId = StpUtil.getLoginIdAsLong();
// 先查询参数是否存在且属于当前用户 // 先查询参数是否存在且属于当前用户
AppParamsCenter existingParam = paramsService.getById(request.getId()); ParamsCenter existingParam = paramsService.getById(request.getId());
if (existingParam == null) { if (existingParam == null) {
return Result.error(I18nUtil.getMessage("params.not.found")); return Result.error(I18nUtil.getMessage("params.not.found"));
} }
@@ -74,7 +74,7 @@ public class AppParamsCenterController {
return Result.error(I18nUtil.getMessage("params.no.permission")); return Result.error(I18nUtil.getMessage("params.no.permission"));
} }
AppParamsCenter params = new AppParamsCenter(); ParamsCenter params = new ParamsCenter();
params.setId(request.getId()); params.setId(request.getId());
params.setParamName(request.getParamName()); params.setParamName(request.getParamName());
params.setDeviceName(request.getDeviceName()); params.setDeviceName(request.getDeviceName());
@@ -103,7 +103,7 @@ public class AppParamsCenterController {
Long userId = StpUtil.getLoginIdAsLong(); Long userId = StpUtil.getLoginIdAsLong();
// 先查询参数是否存在且属于当前用户 // 先查询参数是否存在且属于当前用户
AppParamsCenter existingParam = paramsService.getById(id); ParamsCenter existingParam = paramsService.getById(id);
if (existingParam == null) { if (existingParam == null) {
return Result.error(I18nUtil.getMessage("params.not.found")); return Result.error(I18nUtil.getMessage("params.not.found"));
} }
@@ -125,11 +125,11 @@ public class AppParamsCenterController {
* 根据ID查询参数配置 * 根据ID查询参数配置
*/ */
@GetMapping("/{id}") @GetMapping("/{id}")
public Result<AppParamsCenterVO> getById(@PathVariable Long id) { public Result<ParamsCenterVO> getById(@PathVariable Long id) {
try { try {
Long userId = StpUtil.getLoginIdAsLong(); Long userId = StpUtil.getLoginIdAsLong();
AppParamsCenterVO params = paramsService.getVOById(id); ParamsCenterVO params = paramsService.getVOById(id);
if (params == null) { if (params == null) {
return Result.error(I18nUtil.getMessage("params.not.found")); return Result.error(I18nUtil.getMessage("params.not.found"));
} }
@@ -147,9 +147,9 @@ public class AppParamsCenterController {
* 查询所有参数列表公开接口支持飞控型号过滤 * 查询所有参数列表公开接口支持飞控型号过滤
*/ */
@GetMapping("/all/list") @GetMapping("/all/list")
public Result<List<AppParamsCenterVO>> listAll(@RequestParam(required = false) String fcModel) { public Result<List<ParamsCenterVO>> listAll(@RequestParam(required = false) String fcModel) {
try { try {
List<AppParamsCenterVO> list = paramsService.listAllByFcModel(fcModel); List<ParamsCenterVO> list = paramsService.listAllByFcModel(fcModel);
return Result.success(list); return Result.success(list);
} catch (Exception e) { } catch (Exception e) {
return Result.error(e.getMessage()); return Result.error(e.getMessage());
@@ -160,10 +160,10 @@ public class AppParamsCenterController {
* 查询当前用户的参数列表支持飞控型号过滤 * 查询当前用户的参数列表支持飞控型号过滤
*/ */
@GetMapping("/my/list") @GetMapping("/my/list")
public Result<List<AppParamsCenterVO>> listMy(@RequestParam(required = false) String fcModel) { public Result<List<ParamsCenterVO>> listMy(@RequestParam(required = false) String fcModel) {
try { try {
Long userId = StpUtil.getLoginIdAsLong(); Long userId = StpUtil.getLoginIdAsLong();
List<AppParamsCenterVO> list = paramsService.listByUserIdAndFcModel(userId, fcModel); List<ParamsCenterVO> list = paramsService.listByUserIdAndFcModel(userId, fcModel);
return Result.success(list); return Result.success(list);
} catch (Exception e) { } catch (Exception e) {
return Result.error(e.getMessage()); return Result.error(e.getMessage());
@@ -174,13 +174,13 @@ public class AppParamsCenterController {
* 分页查询所有参数列表公开接口支持飞控型号过滤 * 分页查询所有参数列表公开接口支持飞控型号过滤
*/ */
@GetMapping("/all/page") @GetMapping("/all/page")
public Result<IPage<AppParamsCenterVO>> pageAll( public Result<IPage<ParamsCenterVO>> pageAll(
@RequestParam(defaultValue = "1") Long current, @RequestParam(defaultValue = "1") Long current,
@RequestParam(defaultValue = "10") Long size, @RequestParam(defaultValue = "10") Long size,
@RequestParam(required = false) String fcModel) { @RequestParam(required = false) String fcModel) {
try { try {
Page<AppParamsCenterVO> page = new Page<>(current, size); Page<ParamsCenterVO> page = new Page<>(current, size);
IPage<AppParamsCenterVO> result = paramsService.pageAllByFcModel(fcModel, page); IPage<ParamsCenterVO> result = paramsService.pageAllByFcModel(fcModel, page);
return Result.success(result); return Result.success(result);
} catch (Exception e) { } catch (Exception e) {
return Result.error(e.getMessage()); return Result.error(e.getMessage());
@@ -191,14 +191,14 @@ public class AppParamsCenterController {
* 分页查询当前用户的参数列表支持飞控型号过滤 * 分页查询当前用户的参数列表支持飞控型号过滤
*/ */
@GetMapping("/my/page") @GetMapping("/my/page")
public Result<IPage<AppParamsCenterVO>> pageMy( public Result<IPage<ParamsCenterVO>> pageMy(
@RequestParam(defaultValue = "1") Long current, @RequestParam(defaultValue = "1") Long current,
@RequestParam(defaultValue = "10") Long size, @RequestParam(defaultValue = "10") Long size,
@RequestParam(required = false) String fcModel) { @RequestParam(required = false) String fcModel) {
try { try {
Long userId = StpUtil.getLoginIdAsLong(); Long userId = StpUtil.getLoginIdAsLong();
Page<AppParamsCenterVO> page = new Page<>(current, size); Page<ParamsCenterVO> page = new Page<>(current, size);
IPage<AppParamsCenterVO> result = paramsService.pageByUserIdAndFcModel(userId, fcModel, page); IPage<ParamsCenterVO> result = paramsService.pageByUserIdAndFcModel(userId, fcModel, page);
return Result.success(result); return Result.success(result);
} catch (Exception e) { } catch (Exception e) {
return Result.error(e.getMessage()); return Result.error(e.getMessage());
@@ -211,13 +211,13 @@ public class AppParamsCenterController {
@PostMapping("/{id}/download") @PostMapping("/{id}/download")
public Result<String> incrementDownloadCount(@PathVariable Long id) { public Result<String> incrementDownloadCount(@PathVariable Long id) {
try { try {
AppParamsCenter params = paramsService.getById(id); ParamsCenter params = paramsService.getById(id);
if (params == null) { if (params == null) {
return Result.error(I18nUtil.getMessage("params.not.found")); return Result.error(I18nUtil.getMessage("params.not.found"));
} }
// 增加下载次数 // 增加下载次数
AppParamsCenter updateParams = new AppParamsCenter(); ParamsCenter updateParams = new ParamsCenter();
updateParams.setId(id); updateParams.setId(id);
updateParams.setDownloadCount(params.getDownloadCount() + 1); updateParams.setDownloadCount(params.getDownloadCount() + 1);

View File

@@ -6,8 +6,8 @@ import com.corewing.app.dto.LoginRequest;
import com.corewing.app.dto.RegisterRequest; import com.corewing.app.dto.RegisterRequest;
import com.corewing.app.dto.SendCodeRequest; import com.corewing.app.dto.SendCodeRequest;
import com.corewing.app.dto.UpdatePasswordRequest; import com.corewing.app.dto.UpdatePasswordRequest;
import com.corewing.app.entity.AppUser; import com.corewing.app.entity.User;
import com.corewing.app.service.AppUserService; import com.corewing.app.service.UserService;
import com.corewing.app.service.VerifyCodeService; import com.corewing.app.service.VerifyCodeService;
import com.corewing.app.util.I18nUtil; import com.corewing.app.util.I18nUtil;
import com.corewing.app.util.IpUtil; import com.corewing.app.util.IpUtil;
@@ -22,12 +22,12 @@ import java.util.Map;
*/ */
@RestController @RestController
@RequestMapping("/user") @RequestMapping("/user")
public class AppUserController { public class UserController {
private final AppUserService userService; private final UserService userService;
private final VerifyCodeService verifyCodeService; private final VerifyCodeService verifyCodeService;
public AppUserController(AppUserService userService, VerifyCodeService verifyCodeService) { public UserController(UserService userService, VerifyCodeService verifyCodeService) {
this.userService = userService; this.userService = userService;
this.verifyCodeService = verifyCodeService; this.verifyCodeService = verifyCodeService;
} }
@@ -57,7 +57,7 @@ public class AppUserController {
String token = userService.login(request.getAccount(), request.getPassword()); String token = userService.login(request.getAccount(), request.getPassword());
// 更新登录IP和归属地 // 更新登录IP和归属地
AppUser user = userService.getByAccount(request.getAccount()); User user = userService.getByAccount(request.getAccount());
String loginIp = IpUtil.getClientIp(httpRequest); String loginIp = IpUtil.getClientIp(httpRequest);
userService.updateLoginInfo(user.getId(), loginIp); userService.updateLoginInfo(user.getId(), loginIp);
@@ -78,7 +78,7 @@ public class AppUserController {
@PostMapping("/register") @PostMapping("/register")
public Result<String> register(@RequestBody RegisterRequest request, HttpServletRequest httpRequest) { public Result<String> register(@RequestBody RegisterRequest request, HttpServletRequest httpRequest) {
try { try {
AppUser user = new AppUser(); User user = new User();
user.setUsername(request.getUsername()); user.setUsername(request.getUsername());
user.setPassword(request.getPassword()); user.setPassword(request.getPassword());
user.setEmail(request.getEmail()); user.setEmail(request.getEmail());
@@ -107,9 +107,9 @@ public class AppUserController {
* 获取当前登录用户信息 * 获取当前登录用户信息
*/ */
@GetMapping("/info") @GetMapping("/info")
public Result<AppUser> getUserInfo() { public Result<User> getUserInfo() {
Long userId = StpUtil.getLoginIdAsLong(); Long userId = StpUtil.getLoginIdAsLong();
AppUser user = userService.getById(userId); User user = userService.getById(userId);
// 隐藏密码 // 隐藏密码
user.setPassword(null); user.setPassword(null);
return Result.success(user); return Result.success(user);
@@ -119,8 +119,8 @@ public class AppUserController {
* 根据ID查询用户 * 根据ID查询用户
*/ */
@GetMapping("/{id}") @GetMapping("/{id}")
public Result<AppUser> getById(@PathVariable Long id) { public Result<User> getById(@PathVariable Long id) {
AppUser user = userService.getById(id); User user = userService.getById(id);
if (user != null) { if (user != null) {
// 隐藏密码 // 隐藏密码
user.setPassword(null); user.setPassword(null);
@@ -133,7 +133,7 @@ public class AppUserController {
* 更新用户信息 * 更新用户信息
*/ */
@PutMapping @PutMapping
public Result<String> update(@RequestBody AppUser user) { public Result<String> update(@RequestBody User user) {
// 不允许通过此接口修改密码 // 不允许通过此接口修改密码
user.setPassword(null); user.setPassword(null);
@@ -151,7 +151,7 @@ public class AppUserController {
public Result<String> updatePassword(@RequestBody UpdatePasswordRequest request) { public Result<String> updatePassword(@RequestBody UpdatePasswordRequest request) {
try { try {
Long userId = StpUtil.getLoginIdAsLong(); Long userId = StpUtil.getLoginIdAsLong();
AppUser user = userService.getById(userId); User user = userService.getById(userId);
// 验证旧密码 // 验证旧密码
String oldPasswordMd5 = org.springframework.util.DigestUtils.md5DigestAsHex( String oldPasswordMd5 = org.springframework.util.DigestUtils.md5DigestAsHex(

View File

@@ -15,7 +15,7 @@ import java.time.LocalDateTime;
*/ */
@Data @Data
@TableName("app_feedback") @TableName("app_feedback")
public class AppFeedback implements Serializable { public class Feedback implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@@ -0,0 +1,64 @@
package com.corewing.app.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 固件实体类
*/
@Data
@TableName("app_firmware")
public class Firmware implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 固件ID
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 固件名称
*/
private String firmwareName;
/**
* 固件大小(单位:字节)
*/
private Long firmwareSize;
/**
* 固件描述
*/
private String firmwareDescription;
/**
* 固件类型
*/
private String firmwareType;
/**
* 固件下载地址
*/
private String downloadUrl;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
/**
* 更新时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
}

View File

@@ -15,7 +15,7 @@ import java.time.LocalDateTime;
*/ */
@Data @Data
@TableName("app_params_center") @TableName("app_params_center")
public class AppParamsCenter implements Serializable { public class ParamsCenter implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@@ -15,7 +15,7 @@ import java.time.LocalDateTime;
*/ */
@Data @Data
@TableName("app_user") @TableName("app_user")
public class AppUser implements Serializable { public class User implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@@ -1,13 +1,13 @@
package com.corewing.app.mapper; package com.corewing.app.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.corewing.app.entity.AppFeedback; import com.corewing.app.entity.Feedback;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
/** /**
* 问题反馈 Mapper 接口 * 问题反馈 Mapper 接口
*/ */
@Mapper @Mapper
public interface AppFeedbackMapper extends BaseMapper<AppFeedback> { public interface FeedbackMapper extends BaseMapper<Feedback> {
} }

View File

@@ -0,0 +1,13 @@
package com.corewing.app.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.corewing.app.entity.Firmware;
import org.apache.ibatis.annotations.Mapper;
/**
* 固件 Mapper 接口
*/
@Mapper
public interface FirmwareMapper extends BaseMapper<Firmware> {
}

View File

@@ -3,8 +3,8 @@ package com.corewing.app.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.corewing.app.entity.AppParamsCenter; import com.corewing.app.entity.ParamsCenter;
import com.corewing.app.vo.AppParamsCenterVO; import com.corewing.app.vo.ParamsCenterVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@@ -14,30 +14,30 @@ import java.util.List;
* 参数配置中心 Mapper 接口 * 参数配置中心 Mapper 接口
*/ */
@Mapper @Mapper
public interface AppParamsCenterMapper extends BaseMapper<AppParamsCenter> { public interface ParamsCenterMapper extends BaseMapper<ParamsCenter> {
/** /**
* 根据ID查询带用户名的VO * 根据ID查询带用户名的VO
*/ */
AppParamsCenterVO selectVOById(@Param("id") Long id); ParamsCenterVO selectVOById(@Param("id") Long id);
/** /**
* 查询所有参数列表带用户名 * 查询所有参数列表带用户名
*/ */
List<AppParamsCenterVO> selectAllVOList(@Param("fcModel") String fcModel); List<ParamsCenterVO> selectAllVOList(@Param("fcModel") String fcModel);
/** /**
* 分页查询所有参数列表带用户名 * 分页查询所有参数列表带用户名
*/ */
IPage<AppParamsCenterVO> selectAllVOPage(Page<AppParamsCenterVO> page, @Param("fcModel") String fcModel); IPage<ParamsCenterVO> selectAllVOPage(Page<ParamsCenterVO> page, @Param("fcModel") String fcModel);
/** /**
* 查询当前用户的参数列表带用户名 * 查询当前用户的参数列表带用户名
*/ */
List<AppParamsCenterVO> selectVOListByUserId(@Param("userId") Long userId, @Param("fcModel") String fcModel); List<ParamsCenterVO> selectVOListByUserId(@Param("userId") Long userId, @Param("fcModel") String fcModel);
/** /**
* 分页查询当前用户的参数列表带用户名 * 分页查询当前用户的参数列表带用户名
*/ */
IPage<AppParamsCenterVO> selectVOPageByUserId(Page<AppParamsCenterVO> page, @Param("userId") Long userId, @Param("fcModel") String fcModel); IPage<ParamsCenterVO> selectVOPageByUserId(Page<ParamsCenterVO> page, @Param("userId") Long userId, @Param("fcModel") String fcModel);
} }

View File

@@ -1,13 +1,13 @@
package com.corewing.app.mapper; package com.corewing.app.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.corewing.app.entity.AppUser; import com.corewing.app.entity.User;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
/** /**
* 应用用户 Mapper 接口 * 应用用户 Mapper 接口
*/ */
@Mapper @Mapper
public interface AppUserMapper extends BaseMapper<AppUser> { public interface UserMapper extends BaseMapper<User> {
} }

View File

@@ -3,14 +3,14 @@ package com.corewing.app.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.corewing.app.entity.AppFeedback; import com.corewing.app.entity.Feedback;
import java.util.List; import java.util.List;
/** /**
* 问题反馈 Service 接口 * 问题反馈 Service 接口
*/ */
public interface AppFeedbackService extends IService<AppFeedback> { public interface FeedbackService extends IService<Feedback> {
/** /**
* 创建反馈 * 创建反馈
@@ -18,7 +18,7 @@ public interface AppFeedbackService extends IService<AppFeedback> {
* @param feedback 反馈信息 * @param feedback 反馈信息
* @return 是否成功 * @return 是否成功
*/ */
boolean createFeedback(AppFeedback feedback); boolean createFeedback(Feedback feedback);
/** /**
* 根据用户ID查询反馈列表 * 根据用户ID查询反馈列表
@@ -26,7 +26,7 @@ public interface AppFeedbackService extends IService<AppFeedback> {
* @param userId 用户ID * @param userId 用户ID
* @return 反馈列表 * @return 反馈列表
*/ */
List<AppFeedback> listByUserId(Long userId); List<Feedback> listByUserId(Long userId);
/** /**
* 分页查询反馈列表 * 分页查询反馈列表
@@ -37,7 +37,7 @@ public interface AppFeedbackService extends IService<AppFeedback> {
* @param status 状态可选 * @param status 状态可选
* @return 分页结果 * @return 分页结果
*/ */
IPage<AppFeedback> pageList(Page<AppFeedback> page, Long userId, String feedbackType, Integer status); IPage<Feedback> pageList(Page<Feedback> page, Long userId, String feedbackType, Integer status);
/** /**
* 更新反馈状态 * 更新反馈状态

View File

@@ -0,0 +1,18 @@
package com.corewing.app.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.corewing.app.entity.Firmware;
/**
* 固件 Service 接口
*/
public interface FirmwareService extends IService<Firmware> {
/**
* 根据固件名称查询固件
*
* @param firmwareName 固件名称
* @return 固件信息
*/
Firmware getByFirmwareName(String firmwareName);
}

View File

@@ -3,15 +3,15 @@ package com.corewing.app.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.corewing.app.entity.AppParamsCenter; import com.corewing.app.entity.ParamsCenter;
import com.corewing.app.vo.AppParamsCenterVO; import com.corewing.app.vo.ParamsCenterVO;
import java.util.List; import java.util.List;
/** /**
* 参数配置中心 Service 接口 * 参数配置中心 Service 接口
*/ */
public interface AppParamsCenterService extends IService<AppParamsCenter> { public interface ParamsCenterService extends IService<ParamsCenter> {
/** /**
* 根据ID查询参数VO带用户名 * 根据ID查询参数VO带用户名
@@ -19,7 +19,7 @@ public interface AppParamsCenterService extends IService<AppParamsCenter> {
* @param id 参数ID * @param id 参数ID
* @return 参数VO * @return 参数VO
*/ */
AppParamsCenterVO getVOById(Long id); ParamsCenterVO getVOById(Long id);
/** /**
* 根据用户ID和飞控型号查询参数列表带用户名 * 根据用户ID和飞控型号查询参数列表带用户名
@@ -28,7 +28,7 @@ public interface AppParamsCenterService extends IService<AppParamsCenter> {
* @param fcModel 飞控型号 * @param fcModel 飞控型号
* @return 参数列表 * @return 参数列表
*/ */
List<AppParamsCenterVO> listByUserIdAndFcModel(Long userId, String fcModel); List<ParamsCenterVO> listByUserIdAndFcModel(Long userId, String fcModel);
/** /**
* 分页查询用户的参数列表支持飞控型号过滤带用户名 * 分页查询用户的参数列表支持飞控型号过滤带用户名
@@ -38,7 +38,7 @@ public interface AppParamsCenterService extends IService<AppParamsCenter> {
* @param page 分页对象 * @param page 分页对象
* @return 分页结果 * @return 分页结果
*/ */
IPage<AppParamsCenterVO> pageByUserIdAndFcModel(Long userId, String fcModel, Page<AppParamsCenterVO> page); IPage<ParamsCenterVO> pageByUserIdAndFcModel(Long userId, String fcModel, Page<ParamsCenterVO> page);
/** /**
* 根据飞控型号查询所有参数列表带用户名 * 根据飞控型号查询所有参数列表带用户名
@@ -46,7 +46,7 @@ public interface AppParamsCenterService extends IService<AppParamsCenter> {
* @param fcModel 飞控型号 * @param fcModel 飞控型号
* @return 参数列表 * @return 参数列表
*/ */
List<AppParamsCenterVO> listAllByFcModel(String fcModel); List<ParamsCenterVO> listAllByFcModel(String fcModel);
/** /**
* 分页查询所有参数列表支持飞控型号过滤带用户名 * 分页查询所有参数列表支持飞控型号过滤带用户名
@@ -55,5 +55,5 @@ public interface AppParamsCenterService extends IService<AppParamsCenter> {
* @param page 分页对象 * @param page 分页对象
* @return 分页结果 * @return 分页结果
*/ */
IPage<AppParamsCenterVO> pageAllByFcModel(String fcModel, Page<AppParamsCenterVO> page); IPage<ParamsCenterVO> pageAllByFcModel(String fcModel, Page<ParamsCenterVO> page);
} }

View File

@@ -1,12 +1,12 @@
package com.corewing.app.service; package com.corewing.app.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.corewing.app.entity.AppUser; import com.corewing.app.entity.User;
/** /**
* 应用用户 Service 接口 * 应用用户 Service 接口
*/ */
public interface AppUserService extends IService<AppUser> { public interface UserService extends IService<User> {
/** /**
* 根据用户名查询用户 * 根据用户名查询用户
@@ -14,7 +14,7 @@ public interface AppUserService extends IService<AppUser> {
* @param username 用户名 * @param username 用户名
* @return 用户信息 * @return 用户信息
*/ */
AppUser getByUsername(String username); User getByUsername(String username);
/** /**
* 根据账号查询用户支持用户名/邮箱/手机号 * 根据账号查询用户支持用户名/邮箱/手机号
@@ -22,7 +22,7 @@ public interface AppUserService extends IService<AppUser> {
* @param account 账号 * @param account 账号
* @return 用户信息 * @return 用户信息
*/ */
AppUser getByAccount(String account); User getByAccount(String account);
/** /**
* 根据邮箱查询用户 * 根据邮箱查询用户
@@ -30,7 +30,7 @@ public interface AppUserService extends IService<AppUser> {
* @param email 邮箱 * @param email 邮箱
* @return 用户信息 * @return 用户信息
*/ */
AppUser getByEmail(String email); User getByEmail(String email);
/** /**
* 根据手机号查询用户 * 根据手机号查询用户
@@ -38,7 +38,7 @@ public interface AppUserService extends IService<AppUser> {
* @param telephone 手机号 * @param telephone 手机号
* @return 用户信息 * @return 用户信息
*/ */
AppUser getByTelephone(String telephone); User getByTelephone(String telephone);
/** /**
* 用户登录 * 用户登录
@@ -57,7 +57,7 @@ public interface AppUserService extends IService<AppUser> {
* @param registerIp 注册IP * @param registerIp 注册IP
* @return 是否成功 * @return 是否成功
*/ */
boolean register(AppUser user, String code, String registerIp); boolean register(User user, String code, String registerIp);
/** /**
* 更新登录IP * 更新登录IP

View File

@@ -4,9 +4,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.corewing.app.entity.AppFeedback; import com.corewing.app.entity.Feedback;
import com.corewing.app.mapper.AppFeedbackMapper; import com.corewing.app.mapper.FeedbackMapper;
import com.corewing.app.service.AppFeedbackService; import com.corewing.app.service.FeedbackService;
import com.corewing.app.util.I18nUtil; import com.corewing.app.util.I18nUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
@@ -17,10 +17,10 @@ import java.util.List;
* 问题反馈 Service 实现类 * 问题反馈 Service 实现类
*/ */
@Service @Service
public class AppFeedbackServiceImpl extends ServiceImpl<AppFeedbackMapper, AppFeedback> implements AppFeedbackService { public class FeedbackServiceImpl extends ServiceImpl<FeedbackMapper, Feedback> implements FeedbackService {
@Override @Override
public boolean createFeedback(AppFeedback feedback) { public boolean createFeedback(Feedback feedback) {
// 设置默认状态为待处理 // 设置默认状态为待处理
if (feedback.getStatus() == null) { if (feedback.getStatus() == null) {
feedback.setStatus(0); feedback.setStatus(0);
@@ -29,33 +29,33 @@ public class AppFeedbackServiceImpl extends ServiceImpl<AppFeedbackMapper, AppFe
} }
@Override @Override
public List<AppFeedback> listByUserId(Long userId) { public List<Feedback> listByUserId(Long userId) {
if (userId == null) { if (userId == null) {
throw new RuntimeException(I18nUtil.getMessage("error.feedback.user.id.empty")); throw new RuntimeException(I18nUtil.getMessage("error.feedback.user.id.empty"));
} }
LambdaQueryWrapper<AppFeedback> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<Feedback> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(AppFeedback::getUserId, userId) wrapper.eq(Feedback::getUserId, userId)
.orderByDesc(AppFeedback::getCreateTime); .orderByDesc(Feedback::getCreateTime);
return this.list(wrapper); return this.list(wrapper);
} }
@Override @Override
public IPage<AppFeedback> pageList(Page<AppFeedback> page, Long userId, String feedbackType, Integer status) { public IPage<Feedback> pageList(Page<Feedback> page, Long userId, String feedbackType, Integer status) {
LambdaQueryWrapper<AppFeedback> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<Feedback> wrapper = new LambdaQueryWrapper<>();
// 条件查询 // 条件查询
if (userId != null) { if (userId != null) {
wrapper.eq(AppFeedback::getUserId, userId); wrapper.eq(Feedback::getUserId, userId);
} }
if (StringUtils.hasText(feedbackType)) { if (StringUtils.hasText(feedbackType)) {
wrapper.eq(AppFeedback::getFeedbackType, feedbackType); wrapper.eq(Feedback::getFeedbackType, feedbackType);
} }
if (status != null) { if (status != null) {
wrapper.eq(AppFeedback::getStatus, status); wrapper.eq(Feedback::getStatus, status);
} }
// 按创建时间倒序排序 // 按创建时间倒序排序
wrapper.orderByDesc(AppFeedback::getCreateTime); wrapper.orderByDesc(Feedback::getCreateTime);
return this.page(page, wrapper); return this.page(page, wrapper);
} }
@@ -69,7 +69,7 @@ public class AppFeedbackServiceImpl extends ServiceImpl<AppFeedbackMapper, AppFe
throw new RuntimeException(I18nUtil.getMessage("error.feedback.status.empty")); throw new RuntimeException(I18nUtil.getMessage("error.feedback.status.empty"));
} }
AppFeedback feedback = new AppFeedback(); Feedback feedback = new Feedback();
feedback.setId(id); feedback.setId(id);
feedback.setStatus(status); feedback.setStatus(status);

View File

@@ -0,0 +1,22 @@
package com.corewing.app.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.corewing.app.entity.Firmware;
import com.corewing.app.mapper.FirmwareMapper;
import com.corewing.app.service.FirmwareService;
import org.springframework.stereotype.Service;
/**
* 固件 Service 实现类
*/
@Service
public class FirmwareServiceImpl extends ServiceImpl<FirmwareMapper, Firmware> implements FirmwareService {
@Override
public Firmware getByFirmwareName(String firmwareName) {
LambdaQueryWrapper<Firmware> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Firmware::getFirmwareName, firmwareName);
return this.getOne(wrapper);
}
}

View File

@@ -3,10 +3,10 @@ package com.corewing.app.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.corewing.app.entity.AppParamsCenter; import com.corewing.app.entity.ParamsCenter;
import com.corewing.app.mapper.AppParamsCenterMapper; import com.corewing.app.mapper.ParamsCenterMapper;
import com.corewing.app.service.AppParamsCenterService; import com.corewing.app.service.ParamsCenterService;
import com.corewing.app.vo.AppParamsCenterVO; import com.corewing.app.vo.ParamsCenterVO;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
@@ -15,30 +15,30 @@ import java.util.List;
* 参数配置中心 Service 实现类 * 参数配置中心 Service 实现类
*/ */
@Service @Service
public class AppParamsCenterServiceImpl extends ServiceImpl<AppParamsCenterMapper, AppParamsCenter> implements AppParamsCenterService { public class ParamsCenterServiceImpl extends ServiceImpl<ParamsCenterMapper, ParamsCenter> implements ParamsCenterService {
@Override @Override
public AppParamsCenterVO getVOById(Long id) { public ParamsCenterVO getVOById(Long id) {
return this.baseMapper.selectVOById(id); return this.baseMapper.selectVOById(id);
} }
@Override @Override
public List<AppParamsCenterVO> listByUserIdAndFcModel(Long userId, String fcModel) { public List<ParamsCenterVO> listByUserIdAndFcModel(Long userId, String fcModel) {
return this.baseMapper.selectVOListByUserId(userId, fcModel); return this.baseMapper.selectVOListByUserId(userId, fcModel);
} }
@Override @Override
public IPage<AppParamsCenterVO> pageByUserIdAndFcModel(Long userId, String fcModel, Page<AppParamsCenterVO> page) { public IPage<ParamsCenterVO> pageByUserIdAndFcModel(Long userId, String fcModel, Page<ParamsCenterVO> page) {
return this.baseMapper.selectVOPageByUserId(page, userId, fcModel); return this.baseMapper.selectVOPageByUserId(page, userId, fcModel);
} }
@Override @Override
public List<AppParamsCenterVO> listAllByFcModel(String fcModel) { public List<ParamsCenterVO> listAllByFcModel(String fcModel) {
return this.baseMapper.selectAllVOList(fcModel); return this.baseMapper.selectAllVOList(fcModel);
} }
@Override @Override
public IPage<AppParamsCenterVO> pageAllByFcModel(String fcModel, Page<AppParamsCenterVO> page) { public IPage<ParamsCenterVO> pageAllByFcModel(String fcModel, Page<ParamsCenterVO> page) {
return this.baseMapper.selectAllVOPage(page, fcModel); return this.baseMapper.selectAllVOPage(page, fcModel);
} }
} }

View File

@@ -3,9 +3,9 @@ package com.corewing.app.service.impl;
import cn.dev33.satoken.stp.StpUtil; import cn.dev33.satoken.stp.StpUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.corewing.app.entity.AppUser; import com.corewing.app.entity.User;
import com.corewing.app.mapper.AppUserMapper; import com.corewing.app.mapper.UserMapper;
import com.corewing.app.service.AppUserService; import com.corewing.app.service.UserService;
import com.corewing.app.service.VerifyCodeService; import com.corewing.app.service.VerifyCodeService;
import com.corewing.app.util.I18nUtil; import com.corewing.app.util.I18nUtil;
import com.corewing.app.util.Ip2RegionUtil; import com.corewing.app.util.Ip2RegionUtil;
@@ -19,62 +19,62 @@ import java.nio.charset.StandardCharsets;
* 应用用户 Service 实现类 * 应用用户 Service 实现类
*/ */
@Service @Service
public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> implements AppUserService { public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
private final VerifyCodeService verifyCodeService; private final VerifyCodeService verifyCodeService;
private final Ip2RegionUtil ip2RegionUtil; private final Ip2RegionUtil ip2RegionUtil;
public AppUserServiceImpl(VerifyCodeService verifyCodeService, Ip2RegionUtil ip2RegionUtil) { public UserServiceImpl(VerifyCodeService verifyCodeService, Ip2RegionUtil ip2RegionUtil) {
this.verifyCodeService = verifyCodeService; this.verifyCodeService = verifyCodeService;
this.ip2RegionUtil = ip2RegionUtil; this.ip2RegionUtil = ip2RegionUtil;
} }
@Override @Override
public AppUser getByUsername(String username) { public User getByUsername(String username) {
LambdaQueryWrapper<AppUser> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<User> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(AppUser::getUsername, username); wrapper.eq(User::getUsername, username);
return this.getOne(wrapper); return this.getOne(wrapper);
} }
@Override @Override
public AppUser getByAccount(String account) { public User getByAccount(String account) {
if (!StringUtils.hasText(account)) { if (!StringUtils.hasText(account)) {
return null; return null;
} }
LambdaQueryWrapper<AppUser> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<User> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(AppUser::getUsername, account) wrapper.eq(User::getUsername, account)
.or() .or()
.eq(AppUser::getEmail, account) .eq(User::getEmail, account)
.or() .or()
.eq(AppUser::getTelephone, account); .eq(User::getTelephone, account);
return this.getOne(wrapper); return this.getOne(wrapper);
} }
@Override @Override
public AppUser getByEmail(String email) { public User getByEmail(String email) {
if (!StringUtils.hasText(email)) { if (!StringUtils.hasText(email)) {
return null; return null;
} }
LambdaQueryWrapper<AppUser> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<User> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(AppUser::getEmail, email); wrapper.eq(User::getEmail, email);
return this.getOne(wrapper); return this.getOne(wrapper);
} }
@Override @Override
public AppUser getByTelephone(String telephone) { public User getByTelephone(String telephone) {
if (!StringUtils.hasText(telephone)) { if (!StringUtils.hasText(telephone)) {
return null; return null;
} }
LambdaQueryWrapper<AppUser> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<User> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(AppUser::getTelephone, telephone); wrapper.eq(User::getTelephone, telephone);
return this.getOne(wrapper); return this.getOne(wrapper);
} }
@Override @Override
public String login(String account, String password) { public String login(String account, String password) {
// 查询用户支持用户名/邮箱/手机号 // 查询用户支持用户名/邮箱/手机号
AppUser user = getByAccount(account); User user = getByAccount(account);
if (user == null) { if (user == null) {
throw new RuntimeException(I18nUtil.getMessage("error.user.not.found")); throw new RuntimeException(I18nUtil.getMessage("error.user.not.found"));
} }
@@ -96,9 +96,9 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
} }
@Override @Override
public boolean register(AppUser user, String code, String registerIp) { public boolean register(User user, String code, String registerIp) {
// 检查用户名是否已存在 // 检查用户名是否已存在
AppUser existUser = getByUsername(user.getUsername()); User existUser = getByUsername(user.getUsername());
if (existUser != null) { if (existUser != null) {
throw new RuntimeException(I18nUtil.getMessage("error.username.exists")); throw new RuntimeException(I18nUtil.getMessage("error.username.exists"));
} }
@@ -152,7 +152,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
@Override @Override
public void updateLoginIp(Long userId, String loginIp) { public void updateLoginIp(Long userId, String loginIp) {
AppUser user = new AppUser(); User user = new User();
user.setId(userId); user.setId(userId);
user.setLoginIp(loginIp); user.setLoginIp(loginIp);
this.updateById(user); this.updateById(user);
@@ -160,7 +160,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
@Override @Override
public void updateLoginInfo(Long userId, String loginIp) { public void updateLoginInfo(Long userId, String loginIp) {
AppUser user = new AppUser(); User user = new User();
user.setId(userId); user.setId(userId);
user.setLoginIp(loginIp); user.setLoginIp(loginIp);
user.setLoginRegion(ip2RegionUtil.getRegion(loginIp)); user.setLoginRegion(ip2RegionUtil.getRegion(loginIp));

View File

@@ -8,7 +8,7 @@ import java.time.LocalDateTime;
* 参数配置中心 VO用于返回给前端 * 参数配置中心 VO用于返回给前端
*/ */
@Data @Data
public class AppParamsCenterVO { public class ParamsCenterVO {
/** /**
* 主键ID * 主键ID

View File

@@ -0,0 +1,23 @@
-- 固件表
DROP TABLE IF EXISTS `app_firmware`;
CREATE TABLE `app_firmware` (
`id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '固件ID',
`firmware_name` VARCHAR(100) NOT NULL COMMENT '固件名称',
`firmware_size` BIGINT(20) DEFAULT NULL COMMENT '固件大小(单位:字节)',
`firmware_description` TEXT DEFAULT NULL COMMENT '固件描述',
`firmware_type` VARCHAR(50) DEFAULT NULL COMMENT '固件类型',
`download_url` VARCHAR(500) DEFAULT NULL COMMENT '固件下载地址',
`create_time` DATETIME DEFAULT NULL COMMENT '创建时间',
`update_time` DATETIME DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_firmware_name` (`firmware_name`),
KEY `idx_firmware_type` (`firmware_type`),
KEY `idx_create_time` (`create_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='固件表';
-- 插入测试数据(可选)
INSERT INTO `app_firmware` (`firmware_name`, `firmware_size`, `firmware_description`, `firmware_type`, `download_url`)
VALUES
('固件 v1.0.0', 1048576, '第一个版本的固件', '主控固件', 'https://example.com/firmware/v1.0.0.bin'),
('固件 v1.0.1', 1049600, '修复了若干 bug 的版本', '主控固件', 'https://example.com/firmware/v1.0.1.bin');

View File

@@ -129,3 +129,14 @@ params.not.found=Parameter not found
params.no.permission=No permission to operate this parameter params.no.permission=No permission to operate this parameter
params.download.success=Download successful params.download.success=Download successful
params.download.failed=Download failed params.download.failed=Download failed
# ==================== Firmware Management Module ====================
# Firmware Controller
firmware.name.exists=Firmware name already exists
firmware.add.success=Firmware added successfully
firmware.add.failed=Failed to add firmware
firmware.delete.success=Firmware deleted successfully
firmware.delete.failed=Failed to delete firmware
firmware.update.success=Firmware updated successfully
firmware.update.failed=Failed to update firmware
firmware.not.found=Firmware not found

View File

@@ -129,3 +129,14 @@ params.not.found=参数不存在
params.no.permission=无权限操作该参数 params.no.permission=无权限操作该参数
params.download.success=下载成功 params.download.success=下载成功
params.download.failed=下载失败 params.download.failed=下载失败
# ==================== 固件管理模块 ====================
# 固件Controller
firmware.name.exists=固件名称已存在
firmware.add.success=固件添加成功
firmware.add.failed=固件添加失败
firmware.delete.success=固件删除成功
firmware.delete.failed=固件删除失败
firmware.update.success=固件更新成功
firmware.update.failed=固件更新失败
firmware.not.found=固件不存在

View File

@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.corewing.app.mapper.AppParamsCenterMapper"> <mapper namespace="com.corewing.app.mapper.ParamsCenterMapper">
<!-- 结果映射 --> <!-- 结果映射 -->
<resultMap id="VOResultMap" type="com.corewing.app.vo.AppParamsCenterVO"> <resultMap id="VOResultMap" type="com.corewing.app.vo.ParamsCenterVO">
<id column="id" property="id"/> <id column="id" property="id"/>
<result column="user_id" property="userId"/> <result column="user_id" property="userId"/>
<result column="username" property="username"/> <result column="username" property="username"/>