From 6e0576df5b5621b6e3c3c2a039c61b89c930c2b4 Mon Sep 17 00:00:00 2001 From: chen-xin-zhi <3588068430@qq.com> Date: Wed, 7 May 2025 04:14:21 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../promotion/aop/PermissionCheck.java | 8 +- .../controller/project/ProjectController.java | 5 + .../ProjectDetailController.java | 133 ++++++++++++++++ .../ProjectNotificationController.java | 133 ++++++++++++++++ .../controller/user/UserInfoController.java | 90 ++++++++++- .../userMainInfo/UserMainInfoController.java | 148 ++++++++++++++++++ .../wechat/WechatGetQrcodeController.java | 81 ++-------- .../promotion/generator/Generator.java | 21 ++- .../promotion/mapper/ProjectDetailMapper.java | 18 +++ .../mapper/ProjectNotificationMapper.java | 18 +++ .../promotion/mapper/UserMainInfoMapper.java | 18 +++ .../ProjectDetailAddRequest.java | 54 +++++++ .../ProjectDetailQueryRequest.java | 58 +++++++ .../ProjectDetailUpdateRequest.java | 61 ++++++++ .../ProjectNotificationAddRequest.java | 47 ++++++ .../ProjectNotificationQueryRequest.java | 51 ++++++ .../ProjectNotificationUpdateRequest.java | 54 +++++++ .../model/dto/user/UserInfoAddRequest.java | 2 +- .../model/dto/user/UserInfoLoginRequest.java | 2 +- .../model/dto/user/UserInfoUpdateRequest.java | 2 +- .../userMainInfo/UserMainInfoAddRequest.java | 82 ++++++++++ .../UserMainInfoQueryRequest.java | 82 ++++++++++ .../UserMainInfoUpdateRequest.java | 89 +++++++++++ .../promotion/model/entity/ProjectDetail.java | 62 ++++++++ .../model/entity/ProjectNotification.java | 56 +++++++ .../promotion/model/entity/UserMainInfo.java | 82 ++++++++++ .../vo/projectDetail/ProjectDetailVO.java | 50 ++++++ .../ProjectNotificationVO.java | 44 ++++++ .../model/vo/userMainInfo/UserMainInfoVO.java | 74 +++++++++ .../file/impl/FileInfoServiceImpl.java | 1 - .../service/project/ProjectDetailService.java | 13 ++ .../project/ProjectNotificationService.java | 13 ++ .../impl/ProjectDetailServiceImpl.java | 22 +++ .../impl/ProjectNotificationServiceImpl.java | 22 +++ .../service/user/UserMainInfoService.java | 13 ++ .../user/impl/UserInfoServiceImpl.java | 29 +++- .../user/impl/UserMainInfoServiceImpl.java | 22 +++ .../wechat/WechatGetQrcodeService.java | 13 ++ .../impl/WechatGetQrcodeServiceImpl.java | 133 ++++++++++++++++ .../resources/mapper/ProjectDetailMapper.xml | 23 +++ .../mapper/ProjectNotificationMapper.xml | 22 +++ .../resources/mapper/UserMainInfoMapper.xml | 27 ++++ 42 files changed, 1882 insertions(+), 96 deletions(-) create mode 100644 src/main/java/com/greenorange/promotion/controller/projectDetail/ProjectDetailController.java create mode 100644 src/main/java/com/greenorange/promotion/controller/projectNotification/ProjectNotificationController.java create mode 100644 src/main/java/com/greenorange/promotion/controller/userMainInfo/UserMainInfoController.java create mode 100644 src/main/java/com/greenorange/promotion/mapper/ProjectDetailMapper.java create mode 100644 src/main/java/com/greenorange/promotion/mapper/ProjectNotificationMapper.java create mode 100644 src/main/java/com/greenorange/promotion/mapper/UserMainInfoMapper.java create mode 100644 src/main/java/com/greenorange/promotion/model/dto/projectDetail/ProjectDetailAddRequest.java create mode 100644 src/main/java/com/greenorange/promotion/model/dto/projectDetail/ProjectDetailQueryRequest.java create mode 100644 src/main/java/com/greenorange/promotion/model/dto/projectDetail/ProjectDetailUpdateRequest.java create mode 100644 src/main/java/com/greenorange/promotion/model/dto/projectNotification/ProjectNotificationAddRequest.java create mode 100644 src/main/java/com/greenorange/promotion/model/dto/projectNotification/ProjectNotificationQueryRequest.java create mode 100644 src/main/java/com/greenorange/promotion/model/dto/projectNotification/ProjectNotificationUpdateRequest.java create mode 100644 src/main/java/com/greenorange/promotion/model/dto/userMainInfo/UserMainInfoAddRequest.java create mode 100644 src/main/java/com/greenorange/promotion/model/dto/userMainInfo/UserMainInfoQueryRequest.java create mode 100644 src/main/java/com/greenorange/promotion/model/dto/userMainInfo/UserMainInfoUpdateRequest.java create mode 100644 src/main/java/com/greenorange/promotion/model/entity/ProjectDetail.java create mode 100644 src/main/java/com/greenorange/promotion/model/entity/ProjectNotification.java create mode 100644 src/main/java/com/greenorange/promotion/model/entity/UserMainInfo.java create mode 100644 src/main/java/com/greenorange/promotion/model/vo/projectDetail/ProjectDetailVO.java create mode 100644 src/main/java/com/greenorange/promotion/model/vo/projectNotification/ProjectNotificationVO.java create mode 100644 src/main/java/com/greenorange/promotion/model/vo/userMainInfo/UserMainInfoVO.java create mode 100644 src/main/java/com/greenorange/promotion/service/project/ProjectDetailService.java create mode 100644 src/main/java/com/greenorange/promotion/service/project/ProjectNotificationService.java create mode 100644 src/main/java/com/greenorange/promotion/service/project/impl/ProjectDetailServiceImpl.java create mode 100644 src/main/java/com/greenorange/promotion/service/project/impl/ProjectNotificationServiceImpl.java create mode 100644 src/main/java/com/greenorange/promotion/service/user/UserMainInfoService.java create mode 100644 src/main/java/com/greenorange/promotion/service/user/impl/UserMainInfoServiceImpl.java create mode 100644 src/main/resources/mapper/ProjectDetailMapper.xml create mode 100644 src/main/resources/mapper/ProjectNotificationMapper.xml create mode 100644 src/main/resources/mapper/UserMainInfoMapper.xml diff --git a/src/main/java/com/greenorange/promotion/aop/PermissionCheck.java b/src/main/java/com/greenorange/promotion/aop/PermissionCheck.java index 57b5949..8e83e6e 100644 --- a/src/main/java/com/greenorange/promotion/aop/PermissionCheck.java +++ b/src/main/java/com/greenorange/promotion/aop/PermissionCheck.java @@ -68,10 +68,10 @@ public class PermissionCheck { String userPassword = decodedJWT.getClaim("userPassword").asString(); // 将账号存入request,用于记录日志 request.setAttribute("userAccount", userAccount); - // 打印token的过期时间 - Date expiresAt = decodedJWT.getExpiresAt(); - String formatExpiresAt = DateUtil.format(expiresAt, "yyyy-MM-dd HH:mm:ss"); - log.info("Token过期时间为:" + formatExpiresAt); +// // 打印token的过期时间 +// Date expiresAt = decodedJWT.getExpiresAt(); +// String formatExpiresAt = DateUtil.format(expiresAt, "yyyy-MM-dd HH:mm:ss"); +// log.info("Token过期时间为:" + formatExpiresAt); LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); lambdaQueryWrapper.eq(UserInfo::getUserAccount, userAccount).eq(UserInfo::getUserPassword, userPassword); UserInfo userInfo = userInfoService.getOne(lambdaQueryWrapper); diff --git a/src/main/java/com/greenorange/promotion/controller/project/ProjectController.java b/src/main/java/com/greenorange/promotion/controller/project/ProjectController.java index 64aae15..8685a28 100644 --- a/src/main/java/com/greenorange/promotion/controller/project/ProjectController.java +++ b/src/main/java/com/greenorange/promotion/controller/project/ProjectController.java @@ -1,5 +1,6 @@ package com.greenorange.promotion.controller.project; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.greenorange.promotion.annotation.RequiresPermission; import com.greenorange.promotion.annotation.SysLog; @@ -13,7 +14,9 @@ import com.greenorange.promotion.model.dto.project.ProjectAddRequest; import com.greenorange.promotion.model.dto.project.ProjectQueryRequest; import com.greenorange.promotion.model.dto.project.ProjectUpdateRequest; import com.greenorange.promotion.model.entity.Project; +import com.greenorange.promotion.model.entity.ProjectNotification; import com.greenorange.promotion.model.vo.project.ProjectVO; +import com.greenorange.promotion.model.vo.projectNotification.ProjectNotificationVO; import com.greenorange.promotion.service.common.CommonService; import com.greenorange.promotion.service.project.ProjectService; import io.swagger.v3.oas.annotations.Operation; @@ -145,4 +148,6 @@ public class ProjectController { voPage.setTotal(page.getTotal()); return ResultUtils.success(voPage); } + + } \ No newline at end of file diff --git a/src/main/java/com/greenorange/promotion/controller/projectDetail/ProjectDetailController.java b/src/main/java/com/greenorange/promotion/controller/projectDetail/ProjectDetailController.java new file mode 100644 index 0000000..b89dfb1 --- /dev/null +++ b/src/main/java/com/greenorange/promotion/controller/projectDetail/ProjectDetailController.java @@ -0,0 +1,133 @@ +package com.greenorange.promotion.controller.projectDetail; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.greenorange.promotion.annotation.RequiresPermission; +import com.greenorange.promotion.annotation.SysLog; +import com.greenorange.promotion.common.BaseResponse; +import com.greenorange.promotion.common.ErrorCode; +import com.greenorange.promotion.common.ResultUtils; +import com.greenorange.promotion.constant.UserConstant; +import com.greenorange.promotion.exception.ThrowUtils; +import com.greenorange.promotion.model.dto.CommonBatchRequest; +import com.greenorange.promotion.model.dto.projectDetail.ProjectDetailAddRequest; +import com.greenorange.promotion.model.dto.projectDetail.ProjectDetailQueryRequest; +import com.greenorange.promotion.model.dto.projectDetail.ProjectDetailUpdateRequest; +import com.greenorange.promotion.model.entity.ProjectDetail; +import com.greenorange.promotion.model.vo.projectDetail.ProjectDetailVO; +import com.greenorange.promotion.service.common.CommonService; +import com.greenorange.promotion.service.project.ProjectDetailService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.greenorange.promotion.model.dto.CommonRequest; +import jakarta.validation.Valid; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + + +/** + * 项目明细 控制器 + */ +@RestController +@RequestMapping("projectDetail") +@Slf4j +@Tag(name = "项目明细管理") +public class ProjectDetailController { + + @Resource + private ProjectDetailService projectDetailService; + + @Resource + private CommonService commonService; + + /** + * web端管理员添加项目明细 + * @param projectDetailAddRequest 项目明细添加请求体 + * @return 是否添加成功 + */ + @PostMapping("add") + @Operation(summary = "web端管理员添加项目明细", description = "参数:项目明细添加请求体,权限:管理员,方法名:addProjectDetail") + @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE) + @SysLog(title = "项目明细管理", content = "web端管理员添加项目明细") + public BaseResponse addProjectDetail(@Valid @RequestBody ProjectDetailAddRequest projectDetailAddRequest) { + ProjectDetail projectDetail = commonService.copyProperties(projectDetailAddRequest, ProjectDetail.class); + projectDetailService.save(projectDetail); + return ResultUtils.success(true); + } + + /** + * web端管理员根据id修改项目明细信息 + * @param projectDetailUpdateRequest 项目明细更新请求体 + * @return 是否更新成功 + */ + @PostMapping("update") + @Operation(summary = "web端管理员更新项目明细", description = "参数:项目明细更新请求体,权限:管理员,方法名:updateProjectDetail") + @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE) + @SysLog(title = "项目明细管理", content = "web端管理员根据id修改项目明细信息") + public BaseResponse updateProjectDetail(@Valid @RequestBody ProjectDetailUpdateRequest projectDetailUpdateRequest) { + ProjectDetail projectDetail = commonService.copyProperties(projectDetailUpdateRequest, ProjectDetail.class); + projectDetailService.updateById(projectDetail); + return ResultUtils.success(true); + } + + /** + * web端管理员根据id删除项目明细 + * @param commonRequest 项目明细删除请求体 + * @return 是否删除成功 + */ + @PostMapping("delete") + @Operation(summary = "web端管理员根据id删除项目明细", description = "参数:项目明细删除请求体,权限:管理员,方法名:delProjectDetail") + @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE) + @SysLog(title = "项目明细管理", content = "web端管理员根据id删除项目明细") + public BaseResponse delProjectDetail(@Valid @RequestBody CommonRequest commonRequest) { + Long id = commonRequest.getId(); + projectDetailService.removeById(id); + return ResultUtils.success(true); + } + + + /** + * web端管理员根据id查询项目明细 + * @param commonRequest 项目明细查询请求体 + * @return 项目明细信息 + */ + @PostMapping("queryById") + @Operation(summary = "web端管理员根据id查询项目明细", description = "参数:项目明细查询请求体,权限:管理员,方法名:queryProjectDetailById") + @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE) + @SysLog(title = "项目明细管理", content = "web端管理员根据id查询项目明细") + public BaseResponse queryProjectDetailById(@Valid @RequestBody CommonRequest commonRequest) { + Long id = commonRequest.getId(); + ProjectDetail projectDetail = projectDetailService.getById(id); + ThrowUtils.throwIf(projectDetail == null, ErrorCode.OPERATION_ERROR, "当前项目明细不存在"); + ProjectDetailVO projectDetailVO = commonService.copyProperties(projectDetail, ProjectDetailVO.class); + return ResultUtils.success(projectDetailVO); + } + + + /** + * web端管理员根据项目id查询项目明细 + * @param commonRequest 项目id + * @return 项目明细列表 + */ + @PostMapping("query/pid") + @Operation(summary = "web端管理员根据项目id查询项目明细", description = "参数:项目id,权限:管理员,方法名:queryProjectDetailByPid") + @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE) + @SysLog(title = "项目明细管理", content = "web端管理员根据项目id查询项目明细") + public BaseResponse> queryProjectDetailByPid(@Valid @RequestBody CommonRequest commonRequest) { + Long id = commonRequest.getId(); + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(ProjectDetail::getProjectId, id); + List projectDetailList = projectDetailService.list(lambdaQueryWrapper); + List projectDetailVOS = commonService.convertList(projectDetailList, ProjectDetailVO.class); + return ResultUtils.success(projectDetailVOS); + } + + +} \ No newline at end of file diff --git a/src/main/java/com/greenorange/promotion/controller/projectNotification/ProjectNotificationController.java b/src/main/java/com/greenorange/promotion/controller/projectNotification/ProjectNotificationController.java new file mode 100644 index 0000000..3fba871 --- /dev/null +++ b/src/main/java/com/greenorange/promotion/controller/projectNotification/ProjectNotificationController.java @@ -0,0 +1,133 @@ +package com.greenorange.promotion.controller.projectNotification; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.greenorange.promotion.annotation.RequiresPermission; +import com.greenorange.promotion.annotation.SysLog; +import com.greenorange.promotion.common.BaseResponse; +import com.greenorange.promotion.common.ErrorCode; +import com.greenorange.promotion.common.ResultUtils; +import com.greenorange.promotion.constant.UserConstant; +import com.greenorange.promotion.exception.ThrowUtils; +import com.greenorange.promotion.model.dto.CommonBatchRequest; +import com.greenorange.promotion.model.dto.projectNotification.ProjectNotificationAddRequest; +import com.greenorange.promotion.model.dto.projectNotification.ProjectNotificationQueryRequest; +import com.greenorange.promotion.model.dto.projectNotification.ProjectNotificationUpdateRequest; +import com.greenorange.promotion.model.entity.ProjectNotification; +import com.greenorange.promotion.model.vo.projectNotification.ProjectNotificationVO; +import com.greenorange.promotion.service.common.CommonService; +import com.greenorange.promotion.service.project.ProjectNotificationService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.greenorange.promotion.model.dto.CommonRequest; +import jakarta.validation.Valid; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + + +/** + * 项目通知 控制器 + */ +@RestController +@RequestMapping("projectNotification") +@Slf4j +@Tag(name = "项目通知管理") +public class ProjectNotificationController { + + @Resource + private ProjectNotificationService projectNotificationService; + + @Resource + private CommonService commonService; + + /** + * web端管理员添加项目通知 + * @param projectNotificationAddRequest 项目通知添加请求体 + * @return 是否添加成功 + */ + @PostMapping("add") + @Operation(summary = "web端管理员添加项目通知", description = "参数:项目通知添加请求体,权限:管理员,方法名:addProjectNotification") + @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE) + @SysLog(title = "项目通知管理", content = "web端管理员添加项目通知") + public BaseResponse addProjectNotification(@Valid @RequestBody ProjectNotificationAddRequest projectNotificationAddRequest) { + ProjectNotification projectNotification = commonService.copyProperties(projectNotificationAddRequest, ProjectNotification.class); + projectNotificationService.save(projectNotification); + return ResultUtils.success(true); + } + + /** + * web端管理员根据id修改项目通知信息 + * @param projectNotificationUpdateRequest 项目通知更新请求体 + * @return 是否更新成功 + */ + @PostMapping("update") + @Operation(summary = "web端管理员更新项目通知", description = "参数:项目通知更新请求体,权限:管理员,方法名:updateProjectNotification") + @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE) + @SysLog(title = "项目通知管理", content = "web端管理员根据id修改项目通知信息") + public BaseResponse updateProjectNotification(@Valid @RequestBody ProjectNotificationUpdateRequest projectNotificationUpdateRequest) { + ProjectNotification projectNotification = commonService.copyProperties(projectNotificationUpdateRequest, ProjectNotification.class); + projectNotificationService.updateById(projectNotification); + return ResultUtils.success(true); + } + + /** + * web端管理员根据id删除项目通知 + * @param commonRequest 项目通知删除请求体 + * @return 是否删除成功 + */ + @PostMapping("delete") + @Operation(summary = "web端管理员根据id删除项目通知", description = "参数:项目通知删除请求体,权限:管理员,方法名:delProjectNotification") + @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE) + @SysLog(title = "项目通知管理", content = "web端管理员根据id删除项目通知") + public BaseResponse delProjectNotification(@Valid @RequestBody CommonRequest commonRequest) { + Long id = commonRequest.getId(); + projectNotificationService.removeById(id); + return ResultUtils.success(true); + } + + + /** + * web端管理员根据id查询项目通知 + * @param commonRequest 项目通知查询请求体 + * @return 项目通知信息 + */ + @PostMapping("queryById") + @Operation(summary = "web端管理员根据id查询项目通知", description = "参数:项目通知查询请求体,权限:管理员,方法名:queryProjectNotificationById") + @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE) + @SysLog(title = "项目通知管理", content = "web端管理员根据id查询项目通知") + public BaseResponse queryProjectNotificationById(@Valid @RequestBody CommonRequest commonRequest) { + Long id = commonRequest.getId(); + ProjectNotification projectNotification = projectNotificationService.getById(id); + ThrowUtils.throwIf(projectNotification == null, ErrorCode.OPERATION_ERROR, "当前项目通知不存在"); + ProjectNotificationVO projectNotificationVO = commonService.copyProperties(projectNotification, ProjectNotificationVO.class); + return ResultUtils.success(projectNotificationVO); + } + + + /** + * web端管理员根据项目id查询项目通知 + * @param commonRequest 项目id + * @return 项目通知列表 + */ + @PostMapping("query/pid") + @Operation(summary = "web端管理员根据项目id查询项目通知", description = "参数:项目id,权限:管理员,方法名:queryProjectNotificationByPid") + @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE) + @SysLog(title = "项目通知管理", content = "web端管理员根据项目id查询项目通知") + public BaseResponse> queryProjectNotificationByPid(@Valid @RequestBody CommonRequest commonRequest) { + Long id = commonRequest.getId(); + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(ProjectNotification::getProjectId, id); + List projectNotificationList = projectNotificationService.list(lambdaQueryWrapper); + List projectNotificationVOS = commonService.convertList(projectNotificationList, ProjectNotificationVO.class); + return ResultUtils.success(projectNotificationVOS); + } + + +} \ No newline at end of file diff --git a/src/main/java/com/greenorange/promotion/controller/user/UserInfoController.java b/src/main/java/com/greenorange/promotion/controller/user/UserInfoController.java index 778910d..0093c77 100644 --- a/src/main/java/com/greenorange/promotion/controller/user/UserInfoController.java +++ b/src/main/java/com/greenorange/promotion/controller/user/UserInfoController.java @@ -1,6 +1,7 @@ package com.greenorange.promotion.controller.user; import com.auth0.jwt.interfaces.DecodedJWT; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.greenorange.promotion.annotation.RequiresPermission; @@ -16,15 +17,19 @@ import com.greenorange.promotion.model.dto.CommonRequest; import com.greenorange.promotion.model.dto.CommonStringRequest; import com.greenorange.promotion.model.dto.user.*; import com.greenorange.promotion.model.entity.UserInfo; +import com.greenorange.promotion.model.entity.UserMainInfo; import com.greenorange.promotion.model.vo.user.UserInfoVO; +import com.greenorange.promotion.model.vo.userMainInfo.UserMainInfoVO; import com.greenorange.promotion.service.common.CommonService; import com.greenorange.promotion.service.user.UserInfoService; +import com.greenorange.promotion.service.user.UserMainInfoService; import com.greenorange.promotion.utils.JWTUtils; import com.greenorange.promotion.utils.RegexUtils; import com.greenorange.promotion.utils.SendSmsUtil; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletRequest; import jakarta.validation.Valid; import jakarta.validation.constraints.NotBlank; import lombok.extern.slf4j.Slf4j; @@ -48,6 +53,10 @@ public class UserInfoController { private UserInfoService userInfoService; + @Resource + private UserMainInfoService userMainInfoService; + + @Resource private CommonService commonService; @@ -75,6 +84,21 @@ public class UserInfoController { } + /** + * 小程序端用户根据id获取上级邀请码 + * @param commonRequest 用户id + * @return 上级邀请码 + */ + @PostMapping("inviteCode") + @Operation(summary = "小程序端用户根据id获取上级邀请码", description = "参数:用户id,权限:管理员(boss, admin),方法名:getParentUserInviteCode") + @SysLog(title = "用户管理", content = "小程序端用户根据id获取上级邀请码") + public BaseResponse getParentUserInviteCode(@Valid @RequestBody CommonRequest commonRequest) { + Long id = commonRequest.getId(); + UserInfo userInfo = userInfoService.getById(id); + return ResultUtils.success(userInfo.getInvitationCode()); + } + + /** * 小程序端用户注册 @@ -120,19 +144,75 @@ public class UserInfoController { /** - * 小程序用户重置密码 + * 小程序用户重置密码(外部) * @param userInfoResetRequest 小程序用户密码重置请求体 * @return 是否重置成功 */ - @PostMapping("mini/reset/pwd") - @Operation(summary = "小程序用户重置密码", description = "参数:小程序用户密码重置请求体,权限:管理员(boss, admin),方法名:userInfoMiniResetPwd") - @SysLog(title = "用户管理", content = "小程序端用户重置密码") - public BaseResponse userInfoMiniResetPwd(@Valid @RequestBody UserInfoResetRequest userInfoResetRequest) { + @PostMapping("mini/out/reset/pwd") + @Operation(summary = "小程序用户重置密码(外部)", description = "参数:小程序用户密码重置请求体,权限:管理员(boss, admin),方法名:userInfoMiniOuterResetPwd") + @SysLog(title = "用户管理", content = "小程序用户重置密码(外部)") + public BaseResponse userInfoMiniOuterResetPwd(@Valid @RequestBody UserInfoResetRequest userInfoResetRequest) { userInfoService.userInfoMiniResetPwd(userInfoResetRequest); return ResultUtils.success(true); } + /** + * 小程序用户重置密码(内部) + * @param userInfoResetRequest 小程序用户密码重置请求体 + * @return 是否重置成功 + */ + @PostMapping("mini/in/reset/pwd") + @Operation(summary = "小程序用户重置密码(内部)", description = "参数:小程序用户密码重置请求体,权限:管理员(boss, admin),方法名:userInfoMiniInnerResetPwd") + @RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE) + @SysLog(title = "用户管理", content = "小程序用户重置密码(内部)") + public BaseResponse userInfoMiniInnerResetPwd(@Valid @RequestBody UserInfoResetRequest userInfoResetRequest) { + userInfoService.userInfoMiniResetPwd(userInfoResetRequest); + return ResultUtils.success(true); + } + + + /** + * 小程序端用户根据jwt获取用户信息 + * @return 用户信息 + */ + @GetMapping("get/jwt") + @Operation(summary = "小程序端用户根据jwt获取用户信息", description = "参数:无,权限:管理员(boss, admin),方法名:getMiniUserInfoByJWT") + @RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE) + @SysLog(title = "用户管理", content = "小程序端用户根据jwt获取用户信息") + public BaseResponse getMiniUserInfoByJWT(HttpServletRequest request) { + String userAccount = (String) request.getAttribute("userAccount"); + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(UserInfo::getUserAccount, userAccount); + UserInfo userInfo = userInfoService.getOne(lambdaQueryWrapper); + UserInfoVO userInfoVO = commonService.copyProperties(userInfo, UserInfoVO.class); + return ResultUtils.success(userInfoVO); + } + + + /** + * 小程序端用户根据jwt获取用户主要信息 + * @return 用户信息 + */ + @GetMapping("get/main/jwt") + @Operation(summary = "小程序端用户根据jwt获取用户主要信息", description = "参数:无,权限:管理员(boss, admin),方法名:getMiniUserInfoByJWT") + @RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE) + @SysLog(title = "用户管理", content = "小程序端用户根据jwt获取用户主要信息") + public BaseResponse getMiniUserMainInfoByJWT(HttpServletRequest request) { + String userAccount = (String) request.getAttribute("userAccount"); + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(UserInfo::getUserAccount, userAccount); + UserInfo userInfo = userInfoService.getOne(lambdaQueryWrapper); + + Long id = userInfo.getId(); + LambdaQueryWrapper userMainInfoLambdaQueryWrapper = new LambdaQueryWrapper<>(); + userMainInfoLambdaQueryWrapper.eq(UserMainInfo::getUserId, id); + UserMainInfo userMainInfo = userMainInfoService.getOne(userMainInfoLambdaQueryWrapper); + UserMainInfoVO userMainInfoVO = commonService.copyProperties(userMainInfo, UserMainInfoVO.class); + return ResultUtils.success(userMainInfoVO); + } + + /** diff --git a/src/main/java/com/greenorange/promotion/controller/userMainInfo/UserMainInfoController.java b/src/main/java/com/greenorange/promotion/controller/userMainInfo/UserMainInfoController.java new file mode 100644 index 0000000..7e0542e --- /dev/null +++ b/src/main/java/com/greenorange/promotion/controller/userMainInfo/UserMainInfoController.java @@ -0,0 +1,148 @@ +package com.greenorange.promotion.controller.userMainInfo; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.greenorange.promotion.annotation.RequiresPermission; +import com.greenorange.promotion.annotation.SysLog; +import com.greenorange.promotion.common.BaseResponse; +import com.greenorange.promotion.common.ErrorCode; +import com.greenorange.promotion.common.ResultUtils; +import com.greenorange.promotion.constant.UserConstant; +import com.greenorange.promotion.exception.ThrowUtils; +import com.greenorange.promotion.model.dto.CommonBatchRequest; +import com.greenorange.promotion.model.dto.userMainInfo.UserMainInfoAddRequest; +import com.greenorange.promotion.model.dto.userMainInfo.UserMainInfoQueryRequest; +import com.greenorange.promotion.model.dto.userMainInfo.UserMainInfoUpdateRequest; +import com.greenorange.promotion.model.entity.UserMainInfo; +import com.greenorange.promotion.model.vo.userMainInfo.UserMainInfoVO; +import com.greenorange.promotion.service.common.CommonService; +import com.greenorange.promotion.service.user.UserMainInfoService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.greenorange.promotion.model.dto.CommonRequest; +import jakarta.validation.Valid; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + + +/** + * 用户主要信息 控制器 + */ +@RestController +@RequestMapping("userMainInfo") +@Slf4j +@Tag(name = "用户主要信息管理") +public class UserMainInfoController { + + @Resource + private UserMainInfoService userMainInfoService; + + @Resource + private CommonService commonService; + + /** + * web端管理员添加用户主要信息 + * @param userMainInfoAddRequest 用户主要信息添加请求体 + * @return 是否添加成功 + */ + @PostMapping("add") + @Operation(summary = "web端管理员添加用户主要信息", description = "参数:用户主要信息添加请求体,权限:管理员,方法名:addUserMainInfo") + @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE) + @SysLog(title = "用户主要信息管理", content = "web端管理员添加用户主要信息") + public BaseResponse addUserMainInfo(@Valid @RequestBody UserMainInfoAddRequest userMainInfoAddRequest) { + UserMainInfo userMainInfo = commonService.copyProperties(userMainInfoAddRequest, UserMainInfo.class); + userMainInfoService.save(userMainInfo); + return ResultUtils.success(true); + } + + /** + * web端管理员根据id修改用户主要信息信息 + * @param userMainInfoUpdateRequest 用户主要信息更新请求体 + * @return 是否更新成功 + */ + @PostMapping("update") + @Operation(summary = "web端管理员更新用户主要信息", description = "参数:用户主要信息更新请求体,权限:管理员,方法名:updateUserMainInfo") + @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE) + @SysLog(title = "用户主要信息管理", content = "web端管理员根据id修改用户主要信息信息") + public BaseResponse updateUserMainInfo(@Valid @RequestBody UserMainInfoUpdateRequest userMainInfoUpdateRequest) { + UserMainInfo userMainInfo = commonService.copyProperties(userMainInfoUpdateRequest, UserMainInfo.class); + userMainInfoService.updateById(userMainInfo); + return ResultUtils.success(true); + } + + /** + * web端管理员根据id删除用户主要信息 + * @param commonRequest 用户主要信息删除请求体 + * @return 是否删除成功 + */ + @PostMapping("delete") + @Operation(summary = "web端管理员根据id删除用户主要信息", description = "参数:用户主要信息删除请求体,权限:管理员,方法名:delUserMainInfo") + @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE) + @SysLog(title = "用户主要信息管理", content = "web端管理员根据id删除用户主要信息") + public BaseResponse delUserMainInfo(@Valid @RequestBody CommonRequest commonRequest) { + Long id = commonRequest.getId(); + userMainInfoService.removeById(id); + return ResultUtils.success(true); + } + + /** + * web端管理员批量删除用户主要信息 + * @param commonBatchRequest 用户主要信息批量删除请求体 + * @return 是否删除成功 + */ + @PostMapping("delBatch") + @Operation(summary = "web端管理员批量删除用户主要信息", description = "参数:用户主要信息批量删除请求体,权限:管理员,方法名:delBatchUserMainInfo") + @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE) + @SysLog(title = "用户主要信息管理", content = "web端管理员批量删除用户主要信息") + public BaseResponse delBatchUserMainInfo(@Valid @RequestBody CommonBatchRequest commonBatchRequest) { + List ids = commonBatchRequest.getIds(); + userMainInfoService.removeByIds(ids); + return ResultUtils.success(true); + } + + /** + * web端管理员根据id查询用户主要信息 + * @param commonRequest 用户主要信息查询请求体 + * @return 用户主要信息信息 + */ + @PostMapping("queryById") + @Operation(summary = "web端管理员根据id查询用户主要信息", description = "参数:用户主要信息查询请求体,权限:管理员,方法名:queryUserMainInfoById") + @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE) + @SysLog(title = "用户主要信息管理", content = "web端管理员根据id查询用户主要信息") + public BaseResponse queryUserMainInfoById(@Valid @RequestBody CommonRequest commonRequest) { + Long id = commonRequest.getId(); + UserMainInfo userMainInfo = userMainInfoService.getById(id); + ThrowUtils.throwIf(userMainInfo == null, ErrorCode.OPERATION_ERROR, "当前用户主要信息不存在"); + UserMainInfoVO userMainInfoVO = commonService.copyProperties(userMainInfo, UserMainInfoVO.class); + return ResultUtils.success(userMainInfoVO); + } + +// /** +// * Web端管理员分页查询用户主要信息 +// * @param userMainInfoQueryRequest 用户主要信息查询请求体 +// * @return 用户主要信息列表 +// */ +// @PostMapping("page") +// @Operation(summary = "Web端管理员分页查询用户主要信息", description = "参数:用户主要信息查询请求体,权限:管理员,方法名:listUserMainInfoByPage") +// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE) +// @SysLog(title = "用户主要信息管理", content = "Web端管理员分页查询用户主要信息") +// public BaseResponse> listUserMainInfoByPage(@Valid @RequestBody UserMainInfoQueryRequest userMainInfoQueryRequest) { +// long current = userMainInfoQueryRequest.getCurrent(); +// long pageSize = userMainInfoQueryRequest.getPageSize(); +// QueryWrapper queryWrapper = userMainInfoService.getQueryWrapper(userMainInfoQueryRequest); +// Page page = userMainInfoService.page(new Page<>(current, pageSize), queryWrapper); +// List userMainInfoList = page.getRecords(); +// List userMainInfoVOList = commonService.convertList(userMainInfoList, UserMainInfoVO.class); +// Page voPage = new Page<>(current, pageSize); +// voPage.setRecords(userMainInfoVOList); +// voPage.setPages(page.getPages()); +// voPage.setTotal(page.getTotal()); +// return ResultUtils.success(voPage); +// } +} \ No newline at end of file diff --git a/src/main/java/com/greenorange/promotion/controller/wechat/WechatGetQrcodeController.java b/src/main/java/com/greenorange/promotion/controller/wechat/WechatGetQrcodeController.java index bb0ba26..5d3933f 100644 --- a/src/main/java/com/greenorange/promotion/controller/wechat/WechatGetQrcodeController.java +++ b/src/main/java/com/greenorange/promotion/controller/wechat/WechatGetQrcodeController.java @@ -3,22 +3,23 @@ package com.greenorange.promotion.controller.wechat; import cn.hutool.http.HttpUtil; import cn.hutool.json.JSONUtil; +import com.greenorange.promotion.annotation.RequiresPermission; import com.greenorange.promotion.common.BaseResponse; import com.greenorange.promotion.common.ErrorCode; import com.greenorange.promotion.common.ResultUtils; import com.greenorange.promotion.config.WxAccessToken; +import com.greenorange.promotion.constant.UserConstant; +import com.greenorange.promotion.model.dto.CommonStringRequest; import com.greenorange.promotion.service.wechat.WechatGetQrcodeService; import com.greenorange.promotion.utils.QRCodeUtil; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.annotation.Resource; import jakarta.servlet.http.HttpServletRequest; +import jakarta.validation.Valid; import lombok.extern.slf4j.Slf4j; import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.imageio.ImageIO; import java.awt.image.BufferedImage; @@ -38,9 +39,6 @@ import java.util.Map; public class WechatGetQrcodeController { - private final static String ACCESS_TOKEN_KEY = "accessToken"; - - @Resource private RedisTemplate redisTemplate; @@ -57,76 +55,23 @@ public class WechatGetQrcodeController { @GetMapping("/get/token") @Operation(summary = "(小程序端)获取接口调用凭据", description = "参数:无, 权限:所有人, 方法名:getAccessToken") public BaseResponse getAccessToken() { - String accessToken = (String) redisTemplate.opsForValue().get(ACCESS_TOKEN_KEY); - if (accessToken == null) { - accessToken = wechatGetQrcodeService.getAccessToken().getAccess_token(); - } - WxAccessToken wxAccessToken = WxAccessToken.builder() - .access_token(accessToken) - .expires_in("7200").build(); + WxAccessToken wxAccessToken = wechatGetQrcodeService.getApiAccessToken(); return ResultUtils.success(wxAccessToken); } - - /** * 微信小程序获取二维码 + * @return + * @throws IOException */ @PostMapping("/get/qrcode") @Operation(summary = "微信小程序获取二维码", description = "参数:无, 权限:所有人, 方法名:getQrcode") - public BaseResponse getQrcode() throws IOException { - String accessToken = (String) redisTemplate.opsForValue().get(ACCESS_TOKEN_KEY); - if (accessToken == null) { - accessToken = wechatGetQrcodeService.getAccessToken().getAccess_token(); - } - Map param = new HashMap<>(); - param.put("page", "pages/test/test"); - param.put("scene", "a=1"); - param.put("width", 430); // 宽度 - param.put("check_path", false); - param.put("env_version", "develop"); - String url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + accessToken; - String jsonParams = JSONUtil.toJsonStr(param); - byte[] responseBytes = HttpUtil.createPost(url) - .header("Content-Type", "application/json") - .body(jsonParams) - .execute() - .bodyBytes(); - - - // 将二维码数据转换为 BufferedImage - BufferedImage qrImage = ImageIO.read(new ByteArrayInputStream(responseBytes)); - // 获取用户头像 - String avatarUrl = "https://img.picui.cn/free/2025/04/09/67f5d7bd6b368.jpg"; // 假设这是用户头像的URL - BufferedImage avatarImage = QRCodeUtil.getScaledAvatar(avatarUrl, 188, 188); - // 获取空白图像 - String blankUrl = "https://www.helloimg.com/i/2025/04/07/67f34b0490d07.png"; - // 加载一张空白图片来覆盖logo(假设是透明背景的图片) - BufferedImage blankImage = QRCodeUtil.getScaledAvatar(blankUrl, 196, 196); // 空白图片路径 - // 将头像转换为圆形 - BufferedImage circularAvatar = QRCodeUtil.getCircularImage(avatarImage); - // 将空白头像转换为圆形 - BufferedImage circularBlank = QRCodeUtil.getCircularImage(blankImage); - // 合并二维码和空白图片 - BufferedImage mergedWithBlank = QRCodeUtil.addImages(qrImage, circularBlank, 116, 116); // 偏移量根据需要调整 - // 合并二维码和头像 - BufferedImage resultImage = QRCodeUtil.addImages(mergedWithBlank, circularAvatar, 120, 120); - // 将合成后的图片转换为 Base64 编码 - InputStream resultStream = QRCodeUtil.bufferedImageToInputStream(resultImage); - byte[] resultBytes = resultStream.readAllBytes(); - - - // 生成图片并保存 - try (FileOutputStream fos = new FileOutputStream("qrcode.png")) { - fos.write(resultBytes); // 将二进制数据写入文件 - } catch (IOException e) { - e.printStackTrace(); - return ResultUtils.error(ErrorCode.OPERATION_ERROR, "保存二维码图片失败"); - } - // 将二维码转换为Base64编码 - String base64Image = "data:image/jpeg;base64," + Base64.getEncoder().encodeToString(responseBytes); - return ResultUtils.success(base64Image); +// @RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE) + public BaseResponse getQrcode(@Valid @RequestBody CommonStringRequest commonStringRequest) throws IOException { + String inviteCode = commonStringRequest.getTemplateString(); + String view = wechatGetQrcodeService.getWxQrCode(inviteCode); + return ResultUtils.success(view); } diff --git a/src/main/java/com/greenorange/promotion/generator/Generator.java b/src/main/java/com/greenorange/promotion/generator/Generator.java index ec755c6..ce1c6f6 100644 --- a/src/main/java/com/greenorange/promotion/generator/Generator.java +++ b/src/main/java/com/greenorange/promotion/generator/Generator.java @@ -24,8 +24,16 @@ public class Generator { // 根路径 private static final String ROOT_PATH = "/src/main/java"; + // 作者 + private static final String AUTHOR = "chenxinzhi"; + // 表注释 + private static final String TABLE_COMMENT = "推广码"; + // 实体类名 + private static final String ENTITY_NAME = "PromoCode"; + // 表名 + private static final String TABLE_NAME = "promo_code"; // 实体类属性名 - private static final String ENTITY_NAME_LOWER = "fileInfo"; + private static final String ENTITY_NAME_LOWER = "promoCode"; // 父包名 private static final String PARENT_PATH = "com.greenorange.promotion"; @@ -48,17 +56,6 @@ public class Generator { private static final String VO_TEMPLATE = "/templates/vo/VO.java.vm"; - // 作者 - private static final String AUTHOR = "chenxinzhi"; - // 表注释 - private static final String TABLE_COMMENT = "文件"; - // 实体类名 - private static final String ENTITY_NAME = "FileInfo"; - // 表名 - private static final String TABLE_NAME = "file_info"; - - - public static void main(String[] args) { diff --git a/src/main/java/com/greenorange/promotion/mapper/ProjectDetailMapper.java b/src/main/java/com/greenorange/promotion/mapper/ProjectDetailMapper.java new file mode 100644 index 0000000..ebcaed5 --- /dev/null +++ b/src/main/java/com/greenorange/promotion/mapper/ProjectDetailMapper.java @@ -0,0 +1,18 @@ +package com.greenorange.promotion.mapper; + +import com.greenorange.promotion.model.entity.ProjectDetail; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** +* @author 35880 +* @description 针对表【project_detail(项目明细表)】的数据库操作Mapper +* @createDate 2025-05-07 03:47:58 +* @Entity com.greenorange.promotion.model.entity.ProjectDetail +*/ +public interface ProjectDetailMapper extends BaseMapper { + +} + + + + diff --git a/src/main/java/com/greenorange/promotion/mapper/ProjectNotificationMapper.java b/src/main/java/com/greenorange/promotion/mapper/ProjectNotificationMapper.java new file mode 100644 index 0000000..11f13c9 --- /dev/null +++ b/src/main/java/com/greenorange/promotion/mapper/ProjectNotificationMapper.java @@ -0,0 +1,18 @@ +package com.greenorange.promotion.mapper; + +import com.greenorange.promotion.model.entity.ProjectNotification; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** +* @author 35880 +* @description 针对表【project_notification(项目通知表)】的数据库操作Mapper +* @createDate 2025-05-07 03:31:03 +* @Entity com.greenorange.promotion.model.entity.ProjectNotification +*/ +public interface ProjectNotificationMapper extends BaseMapper { + +} + + + + diff --git a/src/main/java/com/greenorange/promotion/mapper/UserMainInfoMapper.java b/src/main/java/com/greenorange/promotion/mapper/UserMainInfoMapper.java new file mode 100644 index 0000000..805a8fa --- /dev/null +++ b/src/main/java/com/greenorange/promotion/mapper/UserMainInfoMapper.java @@ -0,0 +1,18 @@ +package com.greenorange.promotion.mapper; + +import com.greenorange.promotion.model.entity.UserMainInfo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** +* @author 35880 +* @description 针对表【user_main_info(用户主要信息表)】的数据库操作Mapper +* @createDate 2025-05-07 00:53:58 +* @Entity com.greenorange.promotion.model.entity.UserMainInfo +*/ +public interface UserMainInfoMapper extends BaseMapper { + +} + + + + diff --git a/src/main/java/com/greenorange/promotion/model/dto/projectDetail/ProjectDetailAddRequest.java b/src/main/java/com/greenorange/promotion/model/dto/projectDetail/ProjectDetailAddRequest.java new file mode 100644 index 0000000..703ea90 --- /dev/null +++ b/src/main/java/com/greenorange/promotion/model/dto/projectDetail/ProjectDetailAddRequest.java @@ -0,0 +1,54 @@ +package com.greenorange.promotion.model.dto.projectDetail; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Min; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * 项目明细添加请求体 + */ +@Data +@Schema(description = "项目明细添加请求体", requiredProperties = { + "projectDetailName", + "projectSettlementPrice", + "maxCommissionRate", + "projectId", +}) +public class ProjectDetailAddRequest implements Serializable { + + /** + * 项目明细名称 + */ + @NotBlank(message = "项目明细名称不能为空") + @Schema(description = "项目明细名称", example = "") + private String projectDetailName; + + /** + * 项目结算价 + */ + @Schema(description = "项目结算价", example = "") + private BigDecimal projectSettlementPrice; + + /** + * 最大抽佣比例 + */ + @Schema(description = "最大抽佣比例", example = "") + private Integer maxCommissionRate; + + /** + * 项目ID + */ + @Min(value = 1L, message = "项目ID ID不能小于1") + @Schema(description = "项目ID", example = "") + private Long projectId; + + + @Serial + private static final long serialVersionUID = 1L; +} + diff --git a/src/main/java/com/greenorange/promotion/model/dto/projectDetail/ProjectDetailQueryRequest.java b/src/main/java/com/greenorange/promotion/model/dto/projectDetail/ProjectDetailQueryRequest.java new file mode 100644 index 0000000..ba217ed --- /dev/null +++ b/src/main/java/com/greenorange/promotion/model/dto/projectDetail/ProjectDetailQueryRequest.java @@ -0,0 +1,58 @@ +package com.greenorange.promotion.model.dto.projectDetail; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Min; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.math.BigDecimal; + +import com.greenorange.promotion.common.PageRequest; + +/** + * 项目明细查询请求体,继承自分页请求 PageRequest + */ +@Data +@Schema(description = "项目明细查询请求体", requiredProperties = {"current", "pageSize"}) +public class ProjectDetailQueryRequest extends PageRequest implements Serializable { + + /** + * 项目明细ID + */ + @Min(value = 1L, message = "项目明细ID ID不能小于1") + @Schema(description = "项目明细ID", example = "") + private Long id; + + /** + * 项目明细名称 + */ + @NotBlank(message = "项目明细名称不能为空") + @Schema(description = "项目明细名称", example = "") + private String projectDetailName; + + /** + * 项目结算价 + */ + @Schema(description = "项目结算价", example = "") + private BigDecimal projectSettlementPrice; + + /** + * 最大抽佣比例 + */ + @Schema(description = "最大抽佣比例", example = "") + private Integer maxCommissionRate; + + /** + * 项目ID + */ + @Min(value = 1L, message = "项目ID ID不能小于1") + @Schema(description = "项目ID", example = "") + private Long projectId; + + + @Serial + private static final long serialVersionUID = 1L; +} + diff --git a/src/main/java/com/greenorange/promotion/model/dto/projectDetail/ProjectDetailUpdateRequest.java b/src/main/java/com/greenorange/promotion/model/dto/projectDetail/ProjectDetailUpdateRequest.java new file mode 100644 index 0000000..96d554f --- /dev/null +++ b/src/main/java/com/greenorange/promotion/model/dto/projectDetail/ProjectDetailUpdateRequest.java @@ -0,0 +1,61 @@ +package com.greenorange.promotion.model.dto.projectDetail; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Min; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * 项目明细更新请求体 + */ +@Data +@Schema(description = "项目明细更新请求体", requiredProperties = { + "id", + "projectDetailName", + "projectSettlementPrice", + "maxCommissionRate", + "projectId", +}) +public class ProjectDetailUpdateRequest implements Serializable { + + /** + * 项目明细ID + */ + @Min(value = 1L, message = "项目明细ID ID不能小于1") + @Schema(description = "项目明细ID", example = "") + private Long id; + + /** + * 项目明细名称 + */ + @NotBlank(message = "项目明细名称不能为空") + @Schema(description = "项目明细名称", example = "") + private String projectDetailName; + + /** + * 项目结算价 + */ + @Schema(description = "项目结算价", example = "") + private BigDecimal projectSettlementPrice; + + /** + * 最大抽佣比例 + */ + @Schema(description = "最大抽佣比例", example = "") + private Integer maxCommissionRate; + + /** + * 项目ID + */ + @Min(value = 1L, message = "项目ID ID不能小于1") + @Schema(description = "项目ID", example = "") + private Long projectId; + + + @Serial + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/src/main/java/com/greenorange/promotion/model/dto/projectNotification/ProjectNotificationAddRequest.java b/src/main/java/com/greenorange/promotion/model/dto/projectNotification/ProjectNotificationAddRequest.java new file mode 100644 index 0000000..09de679 --- /dev/null +++ b/src/main/java/com/greenorange/promotion/model/dto/projectNotification/ProjectNotificationAddRequest.java @@ -0,0 +1,47 @@ +package com.greenorange.promotion.model.dto.projectNotification; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Min; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; + +/** + * 项目通知添加请求体 + */ +@Data +@Schema(description = "项目通知添加请求体", requiredProperties = { + "notificationTitle", + "notificationContent", + "projectId", +}) +public class ProjectNotificationAddRequest implements Serializable { + + /** + * 通知标题 + */ + @NotBlank(message = "通知标题不能为空") + @Schema(description = "通知标题", example = "") + private String notificationTitle; + + /** + * 通知内容 + */ + @NotBlank(message = "通知内容不能为空") + @Schema(description = "通知内容", example = "") + private String notificationContent; + + /** + * 项目ID + */ + @Min(value = 1L, message = "项目ID ID不能小于1") + @Schema(description = "项目ID", example = "") + private Long projectId; + + + @Serial + private static final long serialVersionUID = 1L; +} + diff --git a/src/main/java/com/greenorange/promotion/model/dto/projectNotification/ProjectNotificationQueryRequest.java b/src/main/java/com/greenorange/promotion/model/dto/projectNotification/ProjectNotificationQueryRequest.java new file mode 100644 index 0000000..57edb54 --- /dev/null +++ b/src/main/java/com/greenorange/promotion/model/dto/projectNotification/ProjectNotificationQueryRequest.java @@ -0,0 +1,51 @@ +package com.greenorange.promotion.model.dto.projectNotification; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Min; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import com.greenorange.promotion.common.PageRequest; + +/** + * 项目通知查询请求体,继承自分页请求 PageRequest + */ +@Data +@Schema(description = "项目通知查询请求体", requiredProperties = {"current", "pageSize"}) +public class ProjectNotificationQueryRequest extends PageRequest implements Serializable { + + /** + * 通知ID + */ + @Min(value = 1L, message = "通知ID ID不能小于1") + @Schema(description = "通知ID", example = "") + private Long id; + + /** + * 通知标题 + */ + @NotBlank(message = "通知标题不能为空") + @Schema(description = "通知标题", example = "") + private String notificationTitle; + + /** + * 通知内容 + */ + @NotBlank(message = "通知内容不能为空") + @Schema(description = "通知内容", example = "") + private String notificationContent; + + /** + * 项目ID + */ + @Min(value = 1L, message = "项目ID ID不能小于1") + @Schema(description = "项目ID", example = "") + private Long projectId; + + + @Serial + private static final long serialVersionUID = 1L; +} + diff --git a/src/main/java/com/greenorange/promotion/model/dto/projectNotification/ProjectNotificationUpdateRequest.java b/src/main/java/com/greenorange/promotion/model/dto/projectNotification/ProjectNotificationUpdateRequest.java new file mode 100644 index 0000000..cafcb6e --- /dev/null +++ b/src/main/java/com/greenorange/promotion/model/dto/projectNotification/ProjectNotificationUpdateRequest.java @@ -0,0 +1,54 @@ +package com.greenorange.promotion.model.dto.projectNotification; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Min; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; + +/** + * 项目通知更新请求体 + */ +@Data +@Schema(description = "项目通知更新请求体", requiredProperties = { + "id", + "notificationTitle", + "notificationContent", + "projectId", +}) +public class ProjectNotificationUpdateRequest implements Serializable { + + /** + * 通知ID + */ + @Min(value = 1L, message = "通知ID ID不能小于1") + @Schema(description = "通知ID", example = "") + private Long id; + + /** + * 通知标题 + */ + @NotBlank(message = "通知标题不能为空") + @Schema(description = "通知标题", example = "") + private String notificationTitle; + + /** + * 通知内容 + */ + @NotBlank(message = "通知内容不能为空") + @Schema(description = "通知内容", example = "") + private String notificationContent; + + /** + * 项目ID + */ + @Min(value = 1L, message = "项目ID ID不能小于1") + @Schema(description = "项目ID", example = "") + private Long projectId; + + + @Serial + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/src/main/java/com/greenorange/promotion/model/dto/user/UserInfoAddRequest.java b/src/main/java/com/greenorange/promotion/model/dto/user/UserInfoAddRequest.java index 9a5a718..2095b78 100644 --- a/src/main/java/com/greenorange/promotion/model/dto/user/UserInfoAddRequest.java +++ b/src/main/java/com/greenorange/promotion/model/dto/user/UserInfoAddRequest.java @@ -46,7 +46,7 @@ public class UserInfoAddRequest implements Serializable { * 账号 */ @NotBlank(message = "账号不能为空") - @Size(min = 6, max = 10, message = "账号长度在 6 到 10 个字符") + @Size(min = 6, max = 11, message = "账号长度在 6 到 11 个字符") @Schema(description = "账号", example = "qingcheng") private String userAccount; diff --git a/src/main/java/com/greenorange/promotion/model/dto/user/UserInfoLoginRequest.java b/src/main/java/com/greenorange/promotion/model/dto/user/UserInfoLoginRequest.java index 8d717d5..00fc299 100644 --- a/src/main/java/com/greenorange/promotion/model/dto/user/UserInfoLoginRequest.java +++ b/src/main/java/com/greenorange/promotion/model/dto/user/UserInfoLoginRequest.java @@ -18,7 +18,7 @@ public class UserInfoLoginRequest implements Serializable { * 账号 */ @NotBlank(message = "账号不能为空") - @Size(min = 6, max = 10, message = "账号长度在 6 到 10 个字符") + @Size(min = 6, max = 11, message = "账号长度在 6 到 11 个字符") @Schema(description = "账号", example = "qingcheng") private String userAccount; diff --git a/src/main/java/com/greenorange/promotion/model/dto/user/UserInfoUpdateRequest.java b/src/main/java/com/greenorange/promotion/model/dto/user/UserInfoUpdateRequest.java index 1fc518e..acbd805 100644 --- a/src/main/java/com/greenorange/promotion/model/dto/user/UserInfoUpdateRequest.java +++ b/src/main/java/com/greenorange/promotion/model/dto/user/UserInfoUpdateRequest.java @@ -53,7 +53,7 @@ public class UserInfoUpdateRequest implements Serializable { * 账号 */ @NotBlank(message = "账号不能为空") - @Size(min = 6, max = 10, message = "账号长度在 6 到 10 个字符") + @Size(min = 6, max = 11, message = "账号长度在 6 到 11 个字符") @Schema(description = "账号", example = "qingcheng") private String userAccount; diff --git a/src/main/java/com/greenorange/promotion/model/dto/userMainInfo/UserMainInfoAddRequest.java b/src/main/java/com/greenorange/promotion/model/dto/userMainInfo/UserMainInfoAddRequest.java new file mode 100644 index 0000000..1d267c8 --- /dev/null +++ b/src/main/java/com/greenorange/promotion/model/dto/userMainInfo/UserMainInfoAddRequest.java @@ -0,0 +1,82 @@ +package com.greenorange.promotion.model.dto.userMainInfo; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Min; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * 用户主要信息添加请求体 + */ +@Data +@Schema(description = "用户主要信息添加请求体", requiredProperties = { + "teamSize", + "parentEarnings", + "currentBalance", + "withdrawalAmount", + "withdrawnAmount", + "totalIncome", + "userId", + "inviteQrCode", +}) +public class UserMainInfoAddRequest implements Serializable { + + /** + * 团队人数(不包括自己) + */ + @Schema(description = "团队人数(不包括自己)", example = "") + private Integer teamSize; + + /** + * 给上级带来的收益 + */ + @Schema(description = "给上级带来的收益", example = "") + private BigDecimal parentEarnings; + + /** + * 当前余额 + */ + @Schema(description = "当前余额", example = "") + private BigDecimal currentBalance; + + /** + * 提现中的金额 + */ + @Schema(description = "提现中的金额", example = "") + private BigDecimal withdrawalAmount; + + /** + * 已提现的金额 + */ + @Schema(description = "已提现的金额", example = "") + private BigDecimal withdrawnAmount; + + /** + * 累计收入 + */ + @Schema(description = "累计收入", example = "") + private BigDecimal totalIncome; + + /** + * 用户id + */ + @Min(value = 1L, message = "用户id ID不能小于1") + @Schema(description = "用户id", example = "") + private Long userId; + + /** + * 邀请二维码 + */ + @NotBlank(message = "邀请二维码不能为空") + @Schema(description = "邀请二维码", example = "") + private String inviteQrCode; + + + @Serial + private static final long serialVersionUID = 1L; +} + diff --git a/src/main/java/com/greenorange/promotion/model/dto/userMainInfo/UserMainInfoQueryRequest.java b/src/main/java/com/greenorange/promotion/model/dto/userMainInfo/UserMainInfoQueryRequest.java new file mode 100644 index 0000000..7b68304 --- /dev/null +++ b/src/main/java/com/greenorange/promotion/model/dto/userMainInfo/UserMainInfoQueryRequest.java @@ -0,0 +1,82 @@ +package com.greenorange.promotion.model.dto.userMainInfo; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Min; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.math.BigDecimal; + +import com.greenorange.promotion.common.PageRequest; + +/** + * 用户主要信息查询请求体,继承自分页请求 PageRequest + */ +@Data +@Schema(description = "用户主要信息查询请求体", requiredProperties = {"current", "pageSize"}) +public class UserMainInfoQueryRequest extends PageRequest implements Serializable { + + /** + * 主键ID + */ + @Min(value = 1L, message = "主键ID ID不能小于1") + @Schema(description = "主键ID", example = "") + private Long id; + + /** + * 团队人数(不包括自己) + */ + @Schema(description = "团队人数(不包括自己)", example = "") + private Integer teamSize; + + /** + * 给上级带来的收益 + */ + @Schema(description = "给上级带来的收益", example = "") + private BigDecimal parentEarnings; + + /** + * 当前余额 + */ + @Schema(description = "当前余额", example = "") + private BigDecimal currentBalance; + + /** + * 提现中的金额 + */ + @Schema(description = "提现中的金额", example = "") + private BigDecimal withdrawalAmount; + + /** + * 已提现的金额 + */ + @Schema(description = "已提现的金额", example = "") + private BigDecimal withdrawnAmount; + + /** + * 累计收入 + */ + @Schema(description = "累计收入", example = "") + private BigDecimal totalIncome; + + /** + * 用户id + */ + @Min(value = 1L, message = "用户id ID不能小于1") + @Schema(description = "用户id", example = "") + private Long userId; + + /** + * 邀请二维码 + */ + @NotBlank(message = "邀请二维码不能为空") + @Schema(description = "邀请二维码", example = "") + private String inviteQrCode; + + + @Serial + private static final long serialVersionUID = 1L; +} + diff --git a/src/main/java/com/greenorange/promotion/model/dto/userMainInfo/UserMainInfoUpdateRequest.java b/src/main/java/com/greenorange/promotion/model/dto/userMainInfo/UserMainInfoUpdateRequest.java new file mode 100644 index 0000000..986d847 --- /dev/null +++ b/src/main/java/com/greenorange/promotion/model/dto/userMainInfo/UserMainInfoUpdateRequest.java @@ -0,0 +1,89 @@ +package com.greenorange.promotion.model.dto.userMainInfo; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Min; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * 用户主要信息更新请求体 + */ +@Data +@Schema(description = "用户主要信息更新请求体", requiredProperties = { + "id", + "teamSize", + "parentEarnings", + "currentBalance", + "withdrawalAmount", + "withdrawnAmount", + "totalIncome", + "userId", + "inviteQrCode", +}) +public class UserMainInfoUpdateRequest implements Serializable { + + /** + * 主键ID + */ + @Min(value = 1L, message = "主键ID ID不能小于1") + @Schema(description = "主键ID", example = "") + private Long id; + + /** + * 团队人数(不包括自己) + */ + @Schema(description = "团队人数(不包括自己)", example = "") + private Integer teamSize; + + /** + * 给上级带来的收益 + */ + @Schema(description = "给上级带来的收益", example = "") + private BigDecimal parentEarnings; + + /** + * 当前余额 + */ + @Schema(description = "当前余额", example = "") + private BigDecimal currentBalance; + + /** + * 提现中的金额 + */ + @Schema(description = "提现中的金额", example = "") + private BigDecimal withdrawalAmount; + + /** + * 已提现的金额 + */ + @Schema(description = "已提现的金额", example = "") + private BigDecimal withdrawnAmount; + + /** + * 累计收入 + */ + @Schema(description = "累计收入", example = "") + private BigDecimal totalIncome; + + /** + * 用户id + */ + @Min(value = 1L, message = "用户id ID不能小于1") + @Schema(description = "用户id", example = "") + private Long userId; + + /** + * 邀请二维码 + */ + @NotBlank(message = "邀请二维码不能为空") + @Schema(description = "邀请二维码", example = "") + private String inviteQrCode; + + + @Serial + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/src/main/java/com/greenorange/promotion/model/entity/ProjectDetail.java b/src/main/java/com/greenorange/promotion/model/entity/ProjectDetail.java new file mode 100644 index 0000000..e28f3d2 --- /dev/null +++ b/src/main/java/com/greenorange/promotion/model/entity/ProjectDetail.java @@ -0,0 +1,62 @@ +package com.greenorange.promotion.model.entity; + +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 java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import lombok.Data; + +/** + * 项目明细表 + * @TableName project_detail + */ +@TableName(value ="project_detail") +@Data +public class ProjectDetail implements Serializable { + /** + * 项目明细ID + */ + @TableId(type = IdType.AUTO) + private Long id; + + /** + * 项目明细名称 + */ + private String projectDetailName; + + /** + * 项目结算价 + */ + private BigDecimal projectSettlementPrice; + + /** + * 最大抽佣比例 + */ + private Integer maxCommissionRate; + + /** + * 项目ID + */ + private Long projectId; + + /** + * 是否删除 + */ + private Integer isDelete; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 更新时间 + */ + private Date updateTime; + + @TableField(exist = false) + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/src/main/java/com/greenorange/promotion/model/entity/ProjectNotification.java b/src/main/java/com/greenorange/promotion/model/entity/ProjectNotification.java new file mode 100644 index 0000000..4da7c0c --- /dev/null +++ b/src/main/java/com/greenorange/promotion/model/entity/ProjectNotification.java @@ -0,0 +1,56 @@ +package com.greenorange.promotion.model.entity; + +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 java.io.Serializable; +import java.util.Date; +import lombok.Data; + +/** + * 项目通知表 + * @TableName project_notification + */ +@TableName(value ="project_notification") +@Data +public class ProjectNotification implements Serializable { + /** + * 通知ID + */ + @TableId(type = IdType.AUTO) + private Long id; + + /** + * 通知标题 + */ + private String notificationTitle; + + /** + * 通知内容 + */ + private String notificationContent; + + /** + * 项目ID + */ + private Long projectId; + + /** + * 是否删除 + */ + private Integer isDelete; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 更新时间 + */ + private Date updateTime; + + @TableField(exist = false) + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/src/main/java/com/greenorange/promotion/model/entity/UserMainInfo.java b/src/main/java/com/greenorange/promotion/model/entity/UserMainInfo.java new file mode 100644 index 0000000..23ec2ab --- /dev/null +++ b/src/main/java/com/greenorange/promotion/model/entity/UserMainInfo.java @@ -0,0 +1,82 @@ +package com.greenorange.promotion.model.entity; + +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 java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import lombok.Data; + +/** + * 用户主要信息表 + * @TableName user_main_info + */ +@TableName(value ="user_main_info") +@Data +public class UserMainInfo implements Serializable { + /** + * 主键ID + */ + @TableId(type = IdType.AUTO) + private Long id; + + /** + * 团队人数(不包括自己) + */ + private Integer teamSize; + + /** + * 给上级带来的收益 + */ + private BigDecimal parentEarnings; + + /** + * 当前余额 + */ + private BigDecimal currentBalance; + + /** + * 提现中的金额 + */ + private BigDecimal withdrawalAmount; + + /** + * 已提现的金额 + */ + private BigDecimal withdrawnAmount; + + /** + * 累计收入 + */ + private BigDecimal totalIncome; + + /** + * 用户id + */ + private Long userId; + + /** + * 邀请二维码 + */ + private String inviteQrCode; + + /** + * 是否删除 + */ + private Integer isDelete; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 更新时间 + */ + private Date updateTime; + + @TableField(exist = false) + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/src/main/java/com/greenorange/promotion/model/vo/projectDetail/ProjectDetailVO.java b/src/main/java/com/greenorange/promotion/model/vo/projectDetail/ProjectDetailVO.java new file mode 100644 index 0000000..ee3b557 --- /dev/null +++ b/src/main/java/com/greenorange/promotion/model/vo/projectDetail/ProjectDetailVO.java @@ -0,0 +1,50 @@ +package com.greenorange.promotion.model.vo.projectDetail; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * 项目明细 视图对象 + */ +@Data +@Schema(description = "项目明细 视图对象") +public class ProjectDetailVO implements Serializable { + + /** + * 项目明细ID + */ + @Schema(description = "项目明细ID", example = "1") + private Long id; + + /** + * 项目明细名称 + */ + @Schema(description = "项目明细名称", example = "${field.example}") + private String projectDetailName; + + /** + * 项目结算价 + */ + @Schema(description = "项目结算价", example = "${field.example}") + private BigDecimal projectSettlementPrice; + + /** + * 最大抽佣比例 + */ + @Schema(description = "最大抽佣比例", example = "${field.example}") + private Integer maxCommissionRate; + + /** + * 项目ID + */ + @Schema(description = "项目ID", example = "${field.example}") + private Long projectId; + + + @Serial + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/greenorange/promotion/model/vo/projectNotification/ProjectNotificationVO.java b/src/main/java/com/greenorange/promotion/model/vo/projectNotification/ProjectNotificationVO.java new file mode 100644 index 0000000..70e84f0 --- /dev/null +++ b/src/main/java/com/greenorange/promotion/model/vo/projectNotification/ProjectNotificationVO.java @@ -0,0 +1,44 @@ +package com.greenorange.promotion.model.vo.projectNotification; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * 项目通知 视图对象 + */ +@Data +@Schema(description = "项目通知 视图对象") +public class ProjectNotificationVO implements Serializable { + + /** + * 项目通知ID + */ + @Schema(description = "项目通知ID", example = "1") + private Long id; + + /** + * 通知标题 + */ + @Schema(description = "通知标题", example = "${field.example}") + private String notificationTitle; + + /** + * 通知内容 + */ + @Schema(description = "通知内容", example = "${field.example}") + private String notificationContent; + + /** + * 项目ID + */ + @Schema(description = "项目ID", example = "${field.example}") + private Long projectId; + + + @Serial + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/greenorange/promotion/model/vo/userMainInfo/UserMainInfoVO.java b/src/main/java/com/greenorange/promotion/model/vo/userMainInfo/UserMainInfoVO.java new file mode 100644 index 0000000..3f790a8 --- /dev/null +++ b/src/main/java/com/greenorange/promotion/model/vo/userMainInfo/UserMainInfoVO.java @@ -0,0 +1,74 @@ +package com.greenorange.promotion.model.vo.userMainInfo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * 用户主要信息 视图对象 + */ +@Data +@Schema(description = "用户主要信息 视图对象") +public class UserMainInfoVO implements Serializable { + + /** + * 用户主要信息ID + */ + @Schema(description = "用户主要信息ID", example = "1") + private Long id; + + /** + * 团队人数(不包括自己) + */ + @Schema(description = "团队人数(不包括自己)", example = "${field.example}") + private Integer teamSize; + + /** + * 给上级带来的收益 + */ + @Schema(description = "给上级带来的收益", example = "${field.example}") + private BigDecimal parentEarnings; + + /** + * 当前余额 + */ + @Schema(description = "当前余额", example = "${field.example}") + private BigDecimal currentBalance; + + /** + * 提现中的金额 + */ + @Schema(description = "提现中的金额", example = "${field.example}") + private BigDecimal withdrawalAmount; + + /** + * 已提现的金额 + */ + @Schema(description = "已提现的金额", example = "${field.example}") + private BigDecimal withdrawnAmount; + + /** + * 累计收入 + */ + @Schema(description = "累计收入", example = "${field.example}") + private BigDecimal totalIncome; + + /** + * 用户id + */ + @Schema(description = "用户id", example = "${field.example}") + private Long userId; + + /** + * 邀请二维码 + */ + @Schema(description = "邀请二维码", example = "${field.example}") + private String inviteQrCode; + + + @Serial + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/greenorange/promotion/service/file/impl/FileInfoServiceImpl.java b/src/main/java/com/greenorange/promotion/service/file/impl/FileInfoServiceImpl.java index 859a532..a34e6aa 100644 --- a/src/main/java/com/greenorange/promotion/service/file/impl/FileInfoServiceImpl.java +++ b/src/main/java/com/greenorange/promotion/service/file/impl/FileInfoServiceImpl.java @@ -79,7 +79,6 @@ public class FileInfoServiceImpl extends ServiceImpl String fileName = multipartFile.getOriginalFilename(); // 获取文件类型 String fileType = FileUtil.getSuffix(fileName); - // 获取文件路径 // 获取view值 String view = RandomStringUtils.random(8, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"); // 获取文件路径 diff --git a/src/main/java/com/greenorange/promotion/service/project/ProjectDetailService.java b/src/main/java/com/greenorange/promotion/service/project/ProjectDetailService.java new file mode 100644 index 0000000..bbf8249 --- /dev/null +++ b/src/main/java/com/greenorange/promotion/service/project/ProjectDetailService.java @@ -0,0 +1,13 @@ +package com.greenorange.promotion.service.project; + +import com.greenorange.promotion.model.entity.ProjectDetail; +import com.baomidou.mybatisplus.extension.service.IService; + +/** +* @author 35880 +* @description 针对表【project_detail(项目明细表)】的数据库操作Service +* @createDate 2025-05-07 03:47:58 +*/ +public interface ProjectDetailService extends IService { + +} diff --git a/src/main/java/com/greenorange/promotion/service/project/ProjectNotificationService.java b/src/main/java/com/greenorange/promotion/service/project/ProjectNotificationService.java new file mode 100644 index 0000000..5bcbc8f --- /dev/null +++ b/src/main/java/com/greenorange/promotion/service/project/ProjectNotificationService.java @@ -0,0 +1,13 @@ +package com.greenorange.promotion.service.project; + +import com.greenorange.promotion.model.entity.ProjectNotification; +import com.baomidou.mybatisplus.extension.service.IService; + +/** +* @author 35880 +* @description 针对表【project_notification(项目通知表)】的数据库操作Service +* @createDate 2025-05-07 03:31:03 +*/ +public interface ProjectNotificationService extends IService { + +} diff --git a/src/main/java/com/greenorange/promotion/service/project/impl/ProjectDetailServiceImpl.java b/src/main/java/com/greenorange/promotion/service/project/impl/ProjectDetailServiceImpl.java new file mode 100644 index 0000000..837288f --- /dev/null +++ b/src/main/java/com/greenorange/promotion/service/project/impl/ProjectDetailServiceImpl.java @@ -0,0 +1,22 @@ +package com.greenorange.promotion.service.project.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.greenorange.promotion.model.entity.ProjectDetail; +import com.greenorange.promotion.service.project.ProjectDetailService; +import com.greenorange.promotion.mapper.ProjectDetailMapper; +import org.springframework.stereotype.Service; + +/** +* @author 35880 +* @description 针对表【project_detail(项目明细表)】的数据库操作Service实现 +* @createDate 2025-05-07 03:47:58 +*/ +@Service +public class ProjectDetailServiceImpl extends ServiceImpl + implements ProjectDetailService{ + +} + + + + diff --git a/src/main/java/com/greenorange/promotion/service/project/impl/ProjectNotificationServiceImpl.java b/src/main/java/com/greenorange/promotion/service/project/impl/ProjectNotificationServiceImpl.java new file mode 100644 index 0000000..c04b5a0 --- /dev/null +++ b/src/main/java/com/greenorange/promotion/service/project/impl/ProjectNotificationServiceImpl.java @@ -0,0 +1,22 @@ +package com.greenorange.promotion.service.project.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.greenorange.promotion.model.entity.ProjectNotification; +import com.greenorange.promotion.service.project.ProjectNotificationService; +import com.greenorange.promotion.mapper.ProjectNotificationMapper; +import org.springframework.stereotype.Service; + +/** +* @author 35880 +* @description 针对表【project_notification(项目通知表)】的数据库操作Service实现 +* @createDate 2025-05-07 03:31:03 +*/ +@Service +public class ProjectNotificationServiceImpl extends ServiceImpl + implements ProjectNotificationService{ + +} + + + + diff --git a/src/main/java/com/greenorange/promotion/service/user/UserMainInfoService.java b/src/main/java/com/greenorange/promotion/service/user/UserMainInfoService.java new file mode 100644 index 0000000..c44e0e2 --- /dev/null +++ b/src/main/java/com/greenorange/promotion/service/user/UserMainInfoService.java @@ -0,0 +1,13 @@ +package com.greenorange.promotion.service.user; + +import com.greenorange.promotion.model.entity.UserMainInfo; +import com.baomidou.mybatisplus.extension.service.IService; + +/** +* @author 35880 +* @description 针对表【user_main_info(用户主要信息表)】的数据库操作Service +* @createDate 2025-05-07 00:53:58 +*/ +public interface UserMainInfoService extends IService { + +} diff --git a/src/main/java/com/greenorange/promotion/service/user/impl/UserInfoServiceImpl.java b/src/main/java/com/greenorange/promotion/service/user/impl/UserInfoServiceImpl.java index 8f8fd01..294ab48 100644 --- a/src/main/java/com/greenorange/promotion/service/user/impl/UserInfoServiceImpl.java +++ b/src/main/java/com/greenorange/promotion/service/user/impl/UserInfoServiceImpl.java @@ -14,9 +14,12 @@ import com.greenorange.promotion.exception.ThrowUtils; import com.greenorange.promotion.mapper.UserInfoMapper; import com.greenorange.promotion.model.dto.user.*; import com.greenorange.promotion.model.entity.UserInfo; +import com.greenorange.promotion.model.entity.UserMainInfo; import com.greenorange.promotion.model.enums.UserRoleEnum; import com.greenorange.promotion.service.common.CommonService; import com.greenorange.promotion.service.user.UserInfoService; +import com.greenorange.promotion.service.user.UserMainInfoService; +import com.greenorange.promotion.service.wechat.WechatGetQrcodeService; import com.greenorange.promotion.utils.JWTUtils; import com.greenorange.promotion.utils.RegexUtils; import com.greenorange.promotion.utils.SendSmsUtil; @@ -27,6 +30,7 @@ import org.springframework.beans.BeanUtils; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; +import java.io.IOException; import java.util.HashMap; import java.util.Map; import java.util.concurrent.TimeUnit; @@ -48,10 +52,18 @@ public class UserInfoServiceImpl extends ServiceImpl private CommonService commonService; + @Resource + private UserMainInfoService userMainInfoService; + + @Resource private RedisTemplate redisTemplate; + @Resource + private WechatGetQrcodeService wechatGetQrcodeService; + + /** * 获取查询条件 */ @@ -120,11 +132,22 @@ public class UserInfoServiceImpl extends ServiceImpl UserInfo myUserInfo = commonService.copyProperties(userInfoRegisterRequest, UserInfo.class); userInfo.setParentUserId(parentUserInfo.getId()); userInfo.setInvitationCode(RandomUtil.randomNumbers(6)); - userInfo.setUserAccount(RandomUtil.randomNumbers(8)); + userInfo.setUserAccount(phoneNumber); userInfo.setUserRole(UserConstant.DEFAULT_ROLE); userInfo.setUserAvatar(UserConstant.USER_DEFAULT_AVATAR); userInfo.setSuperUserList(parentUserInfo.getSuperUserList() + "," + parentUserInfo.getId()); this.save(myUserInfo); + UserMainInfo userMainInfo = new UserMainInfo(); + userMainInfo.setUserId(myUserInfo.getId()); + + // 生成邀请二维码 + try { + String view = wechatGetQrcodeService.getWxQrCode(myUserInfo.getInvitationCode()); + userMainInfo.setInviteQrCode(view); + } catch (IOException e) { + e.printStackTrace(); + } + userMainInfoService.save(userMainInfo); } @@ -143,7 +166,7 @@ public class UserInfoServiceImpl extends ServiceImpl ThrowUtils.throwIf(userInfo == null, ErrorCode.OPERATION_ERROR, "手机号未注册"); Map payload = new HashMap<>(); - payload.put("phoneNumber", phoneNumber); + payload.put("userAccount", phoneNumber); payload.put("userPassword", userPassword); return jwtUtils.generateToken(payload); } @@ -172,7 +195,7 @@ public class UserInfoServiceImpl extends ServiceImpl String userPassword = userInfo.getUserPassword(); Map payload = new HashMap<>(); - payload.put("phoneNumber", phoneNumber); + payload.put("userAccount", phoneNumber); payload.put("userPassword", userPassword); return jwtUtils.generateToken(payload); } diff --git a/src/main/java/com/greenorange/promotion/service/user/impl/UserMainInfoServiceImpl.java b/src/main/java/com/greenorange/promotion/service/user/impl/UserMainInfoServiceImpl.java new file mode 100644 index 0000000..f7915ce --- /dev/null +++ b/src/main/java/com/greenorange/promotion/service/user/impl/UserMainInfoServiceImpl.java @@ -0,0 +1,22 @@ +package com.greenorange.promotion.service.user.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.greenorange.promotion.model.entity.UserMainInfo; +import com.greenorange.promotion.service.user.UserMainInfoService; +import com.greenorange.promotion.mapper.UserMainInfoMapper; +import org.springframework.stereotype.Service; + +/** +* @author 35880 +* @description 针对表【user_main_info(用户主要信息表)】的数据库操作Service实现 +* @createDate 2025-05-07 00:53:58 +*/ +@Service +public class UserMainInfoServiceImpl extends ServiceImpl + implements UserMainInfoService{ + +} + + + + diff --git a/src/main/java/com/greenorange/promotion/service/wechat/WechatGetQrcodeService.java b/src/main/java/com/greenorange/promotion/service/wechat/WechatGetQrcodeService.java index 2c6cceb..3e0a7b2 100644 --- a/src/main/java/com/greenorange/promotion/service/wechat/WechatGetQrcodeService.java +++ b/src/main/java/com/greenorange/promotion/service/wechat/WechatGetQrcodeService.java @@ -2,6 +2,8 @@ package com.greenorange.promotion.service.wechat; import com.greenorange.promotion.config.WxAccessToken; +import java.io.IOException; + public interface WechatGetQrcodeService { /** @@ -9,4 +11,15 @@ public interface WechatGetQrcodeService { */ WxAccessToken getAccessToken(); + + /** + * 获取接口调用凭据 + */ + WxAccessToken getApiAccessToken(); + + + /** + * 微信小程序获取二维码 + */ + String getWxQrCode(String inviteCode) throws IOException; } diff --git a/src/main/java/com/greenorange/promotion/service/wechat/impl/WechatGetQrcodeServiceImpl.java b/src/main/java/com/greenorange/promotion/service/wechat/impl/WechatGetQrcodeServiceImpl.java index 33be69c..15bbd82 100644 --- a/src/main/java/com/greenorange/promotion/service/wechat/impl/WechatGetQrcodeServiceImpl.java +++ b/src/main/java/com/greenorange/promotion/service/wechat/impl/WechatGetQrcodeServiceImpl.java @@ -2,24 +2,49 @@ package com.greenorange.promotion.service.wechat.impl; +import ch.qos.logback.core.util.MD5Util; +import cn.hutool.core.io.FileUtil; import cn.hutool.http.HttpUtil; +import cn.hutool.json.JSONUtil; import com.google.gson.Gson; +import com.greenorange.promotion.common.ErrorCode; +import com.greenorange.promotion.common.ResultUtils; import com.greenorange.promotion.config.WxAccessToken; +import com.greenorange.promotion.exception.BusinessException; +import com.greenorange.promotion.model.entity.FileInfo; +import com.greenorange.promotion.service.file.FileInfoService; import com.greenorange.promotion.service.wechat.WechatGetQrcodeService; +import com.greenorange.promotion.utils.QRCodeUtil; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.annotation.Resource; +import org.apache.commons.codec.digest.DigestUtils; +import org.apache.commons.lang.RandomStringUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; +import javax.imageio.ImageIO; +import java.awt.image.BufferedImage; +import java.io.*; +import java.util.Base64; +import java.util.HashMap; +import java.util.Map; import java.util.concurrent.TimeUnit; @Service public class WechatGetQrcodeServiceImpl implements WechatGetQrcodeService { + + // 上传文件的服务器存储目录 + private static final String UPLOAD_DIR = "D:/qingcheng/image/"; + + private final static String ACCESS_TOKEN_KEY = "accessToken"; + // 优化:设置一个合理的缓冲区大小 + private static final int BUFFER_SIZE = 8192; // 8 KB + @Resource private RedisTemplate redisTemplate; @@ -33,6 +58,10 @@ public class WechatGetQrcodeServiceImpl implements WechatGetQrcodeService { private String appSecret; + @Resource + private FileInfoService fileInfoService; + + /** * 获取接口调用凭据 */ @@ -51,4 +80,108 @@ public class WechatGetQrcodeServiceImpl implements WechatGetQrcodeService { redisTemplate.opsForValue().set(ACCESS_TOKEN_KEY, access_token, 7200, TimeUnit.SECONDS); return wxAccessToken; } + + + @Override + public WxAccessToken getApiAccessToken() { + String accessToken = (String) redisTemplate.opsForValue().get(ACCESS_TOKEN_KEY); + if (accessToken == null) { + accessToken = this.getAccessToken().getAccess_token(); + } + WxAccessToken wxAccessToken = WxAccessToken.builder() + .access_token(accessToken) + .expires_in("7200").build(); + return wxAccessToken; + } + + + /** + * 获取微信小程序二维码 + */ + @Override + public String getWxQrCode(String inviteCode) throws IOException { + String accessToken = (String) redisTemplate.opsForValue().get(ACCESS_TOKEN_KEY); + if (accessToken == null) { + accessToken = this.getAccessToken().getAccess_token(); + } + Map param = new HashMap<>(); + param.put("page", "pages/login/login"); + param.put("scene", "invitationCode=" + inviteCode); + param.put("width", 430); // 宽度 + param.put("check_path", false); + param.put("env_version", "develop"); + String url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + accessToken; + String jsonParams = JSONUtil.toJsonStr(param); + byte[] responseBytes = HttpUtil.createPost(url) + .header("Content-Type", "application/json") + .body(jsonParams) + .execute() + .bodyBytes(); + + // 将二维码数据转换为 BufferedImage + BufferedImage qrImage = ImageIO.read(new ByteArrayInputStream(responseBytes)); +// // 获取用户头像 +// String avatarUrl = "https://img.picui.cn/free/2025/04/09/67f5d7bd6b368.jpg"; // 假设这是用户头像的URL +// BufferedImage avatarImage = QRCodeUtil.getScaledAvatar(avatarUrl, 188, 188); +// // 获取空白图像 +// String blankUrl = "https://www.helloimg.com/i/2025/04/07/67f34b0490d07.png"; +// // 加载一张空白图片来覆盖logo(假设是透明背景的图片) +// BufferedImage blankImage = QRCodeUtil.getScaledAvatar(blankUrl, 196, 196); // 空白图片路径 +// // 将头像转换为圆形 +// BufferedImage circularAvatar = QRCodeUtil.getCircularImage(avatarImage); +// // 将空白头像转换为圆形 +// BufferedImage circularBlank = QRCodeUtil.getCircularImage(blankImage); +// // 合并二维码和空白图片 +// BufferedImage mergedWithBlank = QRCodeUtil.addImages(qrImage, circularBlank, 116, 116); // 偏移量根据需要调整 +// // 合并二维码和头像 +// BufferedImage resultImage = QRCodeUtil.addImages(mergedWithBlank, circularAvatar, 120, 120); + // 将合成后的图片转换为 Base64 编码 + InputStream resultStream = QRCodeUtil.bufferedImageToInputStream(qrImage); + byte[] resultBytes = resultStream.readAllBytes(); + // 创建上传目录,如果不存在 + String biz = "default"; + String fileName = "qrcode.png"; + // 获取文件类型 + String fileType = FileUtil.getSuffix(fileName); + // 获取文件路径 + String filePath = String.format("%s-%s", biz, fileName); + // 获取view值 + String view = RandomStringUtils.random(8, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"); + File file = new File(UPLOAD_DIR + filePath); + if (!file.getParentFile().exists()) { + file.getParentFile().mkdirs();// 如果路径不存在则创建 + } + // 将文件上传到目标位置 + try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file), BUFFER_SIZE)) { + bos.write(resultBytes); + } catch (IOException e) { + throw new BusinessException(ErrorCode.OPERATION_ERROR, "文件上传失败,失败原因:" + e.getMessage()); + } + // 生成图片并保存 +// try (FileOutputStream fos = new FileOutputStream(UPLOAD_DIR)) { +// fos.write(resultBytes); // 将二进制数据写入文件 +// } catch (IOException e) { +// e.printStackTrace(); +// } + // 将二维码转换为Base64编码 +// String base64Image = "data:image/jpeg;base64," + Base64.getEncoder().encodeToString(responseBytes); + // 获取文件大小 + Double fileSize = file.length() / 1024.0; + fileSize = Double.valueOf(String.format("%.2f", fileSize)); + // 获取文件哈希值 + InputStream inputStream = new FileInputStream(file); + String hashValue = DigestUtils.sha256Hex(inputStream); + // 保存文件 + FileInfo fileInfo = FileInfo.builder() + .name(fileName) + .type(fileType) + .path(filePath) + .size(fileSize) + .fileView(view) + .biz(biz) + .hashValue(hashValue) + .build(); + fileInfoService.save(fileInfo); + return view; + } } diff --git a/src/main/resources/mapper/ProjectDetailMapper.xml b/src/main/resources/mapper/ProjectDetailMapper.xml new file mode 100644 index 0000000..d08cf0f --- /dev/null +++ b/src/main/resources/mapper/ProjectDetailMapper.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + id,projectDetailName,projectSettlementPrice, + maxCommissionRate,projectId,isDelete, + createTime,updateTime + + diff --git a/src/main/resources/mapper/ProjectNotificationMapper.xml b/src/main/resources/mapper/ProjectNotificationMapper.xml new file mode 100644 index 0000000..2723b0f --- /dev/null +++ b/src/main/resources/mapper/ProjectNotificationMapper.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + id,notificationTitle,notificationContent, + projectId,isDelete,createTime, + updateTime + + diff --git a/src/main/resources/mapper/UserMainInfoMapper.xml b/src/main/resources/mapper/UserMainInfoMapper.xml new file mode 100644 index 0000000..bfeddda --- /dev/null +++ b/src/main/resources/mapper/UserMainInfoMapper.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + id,teamSize,parentEarnings, + currentBalance,withdrawalAmount,withdrawnAmount, + totalIncome,userId,isDelete, + createTime,updateTime + +