diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/model/IdVo.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/model/IdVo.java new file mode 100644 index 00000000..670a7935 --- /dev/null +++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/model/IdVo.java @@ -0,0 +1,17 @@ +package com.ruoyi.system.api.model; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author 苏海龙 + * @version 1.0 + * @description: TODO + * @date 2023/1/10 20:07 + */ + +@Data +public class IdVo implements Serializable { + private Integer id; +} diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/model/LoginVo.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/model/LoginVo.java new file mode 100644 index 00000000..ee6e8860 --- /dev/null +++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/model/LoginVo.java @@ -0,0 +1,20 @@ +package com.ruoyi.system.api.model; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author 苏海龙 + * @version 1.0 + * @description: TODO + * @date 2023/1/10 20:57 + */ +//登录的vo实体类 +@Data +public class LoginVo implements Serializable { + private String nickName; + private String userPass; + private String code; + private String phone; +} diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/model/PageInfoVo.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/model/PageInfoVo.java new file mode 100644 index 00000000..d151469e --- /dev/null +++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/model/PageInfoVo.java @@ -0,0 +1,41 @@ +package com.ruoyi.system.api.model; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description //TODO + * @Author 王辉 + * @Date 2022/11/14 18:34 + */ +@Data +public class PageInfoVo implements Serializable { + + //分页 + private Integer pageNum; + private Integer pageSize; + //区间查询 + private Integer maxprice; + private Integer minprice; + //模糊条件查询 + private String keyWord; + //根据类型 + private Integer id; + private Integer pid; + + + + + + + + + + + + + + + +} diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/model/PassWordCode.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/model/PassWordCode.java new file mode 100644 index 00000000..dbc8163e --- /dev/null +++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/model/PassWordCode.java @@ -0,0 +1,19 @@ +package com.ruoyi.system.api.model; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author 苏海龙 + * @version 1.0 + * @description: TODO + * @date 2023/1/14 8:05 + */ + +@Data +public class PassWordCode implements Serializable { + private Integer userId; + private String oldPassword; + private String newPassword; +} diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/model/PhoneVo.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/model/PhoneVo.java new file mode 100644 index 00000000..11ce82c3 --- /dev/null +++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/model/PhoneVo.java @@ -0,0 +1,18 @@ +package com.ruoyi.system.api.model; + +import com.ruoyi.common.core.web.domain.BaseEntity; +import lombok.Data; + +import java.io.Serializable; + +/** + * @author 苏海龙 + * @version 1.0 + * @description: TODO + * @date 2023/1/11 8:18 + */ + +@Data +public class PhoneVo extends BaseEntity { + private String phone; +} diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/model/TbUserVo.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/model/TbUserVo.java new file mode 100644 index 00000000..884338a5 --- /dev/null +++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/model/TbUserVo.java @@ -0,0 +1,135 @@ +package com.ruoyi.system.api.model; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.core.web.domain.BaseEntity; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +/** + * @author 苏海龙 + * @version 1.0 + * @description: TODO + * @date 2023/1/10 15:03 + */ + +@Data +public class TbUserVo extends BaseEntity { + private static final long serialVersionUID = 1L; + private Long userId; + + /** + * 用户账号 + */ + private String userName; + private String token; + + /** + * 用户昵称 + */ + private String nickName; + + /** + * 用户邮箱 + */ + private String email; + + /** + * 手机号码 + */ + private String phonenumber; + + /** + * 年龄 + */ + private Integer age; + + /** + * 用户性别(0男 1女 2未知) + */ + private String sex; + + /** + * 头像地址 + */ + private String avatar; + + /** + * 身份证(只有管理员能看到) + */ + private String userCard; + + /** + * 密码 + */ + private String password; + + /** + * 帐号状态(0正常 1停用) + */ + private String status; + + /** + * 删除标志(0代表存在 2代表删除) + */ + private String delFlag; + + /** + * 最后登录IP + */ + private String loginIp; + + /** + * 最后登录时间 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date loginDate; + + /** + * 创建者 + */ + private String createBy; + + /** + * 创建时间 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date createTime; + + /** + * 更新者 + */ + private String updateBy; + + /** + * 账号金额(元) + */ + private Double userPrice; + + /** + * 更新时间 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date updateTime; + + /** + * 备注 + */ + private String remark; + + /** + * 实名状态(0,未实名1已实名) + */ + private String realnameState; + + /** + * 信誉积分 + */ + private Integer honorIntegral; + + +} diff --git a/ruoyi-modules/pom.xml b/ruoyi-modules/pom.xml index 91177839..3d5da182 100644 --- a/ruoyi-modules/pom.xml +++ b/ruoyi-modules/pom.xml @@ -14,6 +14,7 @@ ruoyi-job ruoyi-file ruoyi-potenza + ruoyi-user ruoyi-modules diff --git a/ruoyi-modules/ruoyi-user/pom.xml b/ruoyi-modules/ruoyi-user/pom.xml new file mode 100644 index 00000000..c738af55 --- /dev/null +++ b/ruoyi-modules/ruoyi-user/pom.xml @@ -0,0 +1,147 @@ + + + + ruoyi-modules + com.ruoyi + 3.6.1 + + 4.0.0 + + ruoyi-user + + + 8 + 8 + + + + + + + + com.alibaba + fastjson + 1.2.15 + + + org.apache.httpcomponents + httpclient + + + org.apache.httpcomponents + httpcore + + + commons-lang + commons-lang + 2.6 + + + org.eclipse.jetty + jetty-util + + + + cn.hutool + hutool-all + 4.5.16 + + + + + + com.baomidou + mybatis-plus-boot-starter + 3.4.2 + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + 2.1.4 + + + org.projectlombok + lombok + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-sentinel + + + + + org.springframework.boot + spring-boot-starter-actuator + + + + + io.springfox + springfox-swagger-ui + ${swagger.fox.version} + + + + + mysql + mysql-connector-java + + + + + com.ruoyi + ruoyi-common-datasource + + + + + com.ruoyi + ruoyi-common-datascope + + + + + com.ruoyi + ruoyi-common-log + + + + + com.ruoyi + ruoyi-common-swagger + + + + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + + \ No newline at end of file diff --git a/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/RuoYiUserApplication.java b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/RuoYiUserApplication.java new file mode 100644 index 00000000..5e96c64e --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/RuoYiUserApplication.java @@ -0,0 +1,34 @@ +package com.bwie.ruoyi; + +import com.ruoyi.common.security.annotation.EnableCustomConfig; +import com.ruoyi.common.security.annotation.EnableRyFeignClients; +import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * 系统模块 + * + * @author ruoyi + */ +@EnableCustomConfig +@EnableCustomSwagger2 +@EnableRyFeignClients +@SpringBootApplication +public class RuoYiUserApplication +{ + public static void main(String[] args) + { + SpringApplication.run(RuoYiUserApplication.class, args); + System.out.println("(♥◠‿◠)ノ゙ 系统模块启动成功 ლ(´ڡ`ლ)゙ \n" + + " .-------. ____ __ \n" + + " | _ _ \\ \\ \\ / / \n" + + " | ( ' ) | \\ _. / ' \n" + + " |(_ o _) / _( )_ .' \n" + + " | (_,_).' __ ___(_ o _)' \n" + + " | |\\ \\ | || |(_,_)' \n" + + " | | \\ `' /| `-' / \n" + + " | | \\ / \\ / \n" + + " ''-' `'-' `-..-' "); + } +} diff --git a/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/config/Knife4jConfiguration.java b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/config/Knife4jConfiguration.java new file mode 100644 index 00000000..3edeb256 --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/config/Knife4jConfiguration.java @@ -0,0 +1,48 @@ +package com.bwie.ruoyi.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.Contact; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc; + +/** + * @author 冰烆 + * @version 1.0 + * @description: TODO + * @date 2022/10/21 20:15 + */ + +@Configuration +@EnableSwagger2WebMvc +public class Knife4jConfiguration { + @Bean(value = "dockerBean") + public Docket dockerBean() { + //指定使用Swagger2规范 + Docket docket = new Docket(DocumentationType.SWAGGER_2) + .apiInfo(webApiInfo()) + //分组名称 + .groupName("WebApi") + .select() + //这里指定Controller扫描包路径 + .apis(RequestHandlerSelectors.basePackage("com.bwie")) + .paths(PathSelectors.any()) + .build(); + return docket; + } + + private ApiInfo webApiInfo() { + return new ApiInfoBuilder() + //描述字段支持Markdown语法 + .title("Weekly-API") + .contact(new Contact("苏海龙", "https://www.bwie.net/", "bwie@bwie.com")) + .description("考试服务端API-version1.0") + .version("1.0") + .build(); + } +} diff --git a/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/controller/DuanXinSend.java b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/controller/DuanXinSend.java new file mode 100644 index 00000000..688ffdb4 --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/controller/DuanXinSend.java @@ -0,0 +1,30 @@ +package com.bwie.ruoyi.controller; + +import com.bwie.ruoyi.service.TbUserService; +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.system.api.model.PhoneVo; +import io.swagger.annotations.Api; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +/** + * @author 苏海龙 + * @version 1.0 + * @description: TODO + * @date 2023/1/14 7:49 + */ + +@RestController +@CrossOrigin +@Api(tags = "aaa-api") +@RequestMapping("duanxin") +public class DuanXinSend { + @Resource + private TbUserService tbUserService; + //1.发送验证码 + @PostMapping("phoneSend") + public AjaxResult phoneSend(@RequestBody(required=false) PhoneVo phoneVo){ + return tbUserService.phoneSend(phoneVo); + } +} diff --git a/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/controller/UserController.java b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/controller/UserController.java new file mode 100644 index 00000000..6d7f0282 --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/controller/UserController.java @@ -0,0 +1,61 @@ +package com.bwie.ruoyi.controller; + +import com.bwie.ruoyi.pojo.TbUser; +import com.bwie.ruoyi.service.TbUserService; +import com.github.pagehelper.PageHelper; +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.core.web.page.TableDataInfo; +import com.ruoyi.system.api.model.*; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.util.List; + +/** + * @author 苏海龙 + * @version 1.0 + * @description: TODO + * @date 2023/1/13 14:40 + */ + +@RestController +@RequestMapping("user") +@Slf4j +public class UserController extends BaseController { + @Resource + private TbUserService tbUserServicet; + @PostMapping("getuser") + private TableDataInfo getuser(@RequestBody PageInfoVo pageInfoVo){ + PageHelper.startPage(pageInfoVo.getPageNum(),pageInfoVo.getPageSize()); + List list=tbUserServicet.getuser(); + return getDataTable(list); + } + @PostMapping("deluser") + private AjaxResult deluser(@RequestBody IdVo idVo) { + return tbUserServicet.deluser(idVo); + } + @PostMapping("adduser") + private AjaxResult adduser(@RequestBody TbUserVo tbUserVo){ + return tbUserServicet.adduser(tbUserVo); + } + + @PostMapping("updateuser") + private AjaxResult updateuser(@RequestBody TbUserVo tbUserVo){ + return tbUserServicet.updateuser(tbUserVo); + } + //修改密码 + @PostMapping("uppassword") + private AjaxResult uppassword(@RequestBody PassWordCode passWordCode){ + return tbUserServicet.uppassword(passWordCode); + } + //登录 + @PostMapping("loginUser") + private AjaxResult loginuser(@RequestBody LoginVo loginVo){ + return tbUserServicet.loginuser(loginVo); + } +} diff --git a/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/mapper/TbPermMapper.java b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/mapper/TbPermMapper.java new file mode 100644 index 00000000..3176d6aa --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/mapper/TbPermMapper.java @@ -0,0 +1,18 @@ +package com.bwie.ruoyi.mapper; + +import com.bwie.ruoyi.pojo.TbPerm; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** +* @author 海龙 +* @description 针对表【tb_perm(权限表)】的数据库操作Mapper +* @createDate 2023-01-13 14:34:44 +* @Entity com.bwie.ruoyi.pojo.TbPerm +*/ +public interface TbPermMapper extends BaseMapper { + +} + + + + diff --git a/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/mapper/TbRoleMapper.java b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/mapper/TbRoleMapper.java new file mode 100644 index 00000000..9cbc5598 --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/mapper/TbRoleMapper.java @@ -0,0 +1,18 @@ +package com.bwie.ruoyi.mapper; + +import com.bwie.ruoyi.pojo.TbRole; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** +* @author 海龙 +* @description 针对表【tb_role(角色表)】的数据库操作Mapper +* @createDate 2023-01-13 14:34:44 +* @Entity com.bwie.ruoyi.pojo.TbRole +*/ +public interface TbRoleMapper extends BaseMapper { + +} + + + + diff --git a/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/mapper/TbRolePermMapper.java b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/mapper/TbRolePermMapper.java new file mode 100644 index 00000000..3b4d3262 --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/mapper/TbRolePermMapper.java @@ -0,0 +1,18 @@ +package com.bwie.ruoyi.mapper; + +import com.bwie.ruoyi.pojo.TbRolePerm; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** +* @author 海龙 +* @description 针对表【tb_role_perm(角色权限表)】的数据库操作Mapper +* @createDate 2023-01-13 14:34:44 +* @Entity com.bwie.ruoyi.pojo.TbRolePerm +*/ +public interface TbRolePermMapper extends BaseMapper { + +} + + + + diff --git a/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/mapper/TbUserBankcardMapper.java b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/mapper/TbUserBankcardMapper.java new file mode 100644 index 00000000..b7f99c99 --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/mapper/TbUserBankcardMapper.java @@ -0,0 +1,18 @@ +package com.bwie.ruoyi.mapper; + +import com.bwie.ruoyi.pojo.TbUserBankcard; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** +* @author 海龙 +* @description 针对表【tb_user_bankcard(账户表)】的数据库操作Mapper +* @createDate 2023-01-13 14:34:44 +* @Entity com.bwie.ruoyi.pojo.TbUserBankcard +*/ +public interface TbUserBankcardMapper extends BaseMapper { + +} + + + + diff --git a/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/mapper/TbUserMapper.java b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/mapper/TbUserMapper.java new file mode 100644 index 00000000..b2b89529 --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/mapper/TbUserMapper.java @@ -0,0 +1,18 @@ +package com.bwie.ruoyi.mapper; + +import com.bwie.ruoyi.pojo.TbUser; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** +* @author 海龙 +* @description 针对表【tb_user(用户信息表)】的数据库操作Mapper +* @createDate 2023-01-13 14:34:44 +* @Entity com.bwie.ruoyi.pojo.TbUser +*/ +public interface TbUserMapper extends BaseMapper { + +} + + + + diff --git a/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/mapper/TbUserRoleMapper.java b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/mapper/TbUserRoleMapper.java new file mode 100644 index 00000000..a1ee4340 --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/mapper/TbUserRoleMapper.java @@ -0,0 +1,18 @@ +package com.bwie.ruoyi.mapper; + +import com.bwie.ruoyi.pojo.TbUserRole; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** +* @author 海龙 +* @description 针对表【tb_user_role(用户类型表)】的数据库操作Mapper +* @createDate 2023-01-13 14:34:44 +* @Entity com.bwie.ruoyi.pojo.TbUserRole +*/ +public interface TbUserRoleMapper extends BaseMapper { + +} + + + + diff --git a/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/pojo/TbPerm.java b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/pojo/TbPerm.java new file mode 100644 index 00000000..98b151ed --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/pojo/TbPerm.java @@ -0,0 +1,58 @@ +package com.bwie.ruoyi.pojo; + +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 com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +/** + * 权限表 + * @TableName tb_perm + */ +@TableName(value ="tb_perm") +@Data +public class TbPerm implements Serializable { + /** + * + */ + @TableId(type = IdType.AUTO) + private Integer permId; + + /** + * 权限名称 + */ + private String permName; + + /** + * 权限编码 + */ + private String permCode; + + /** + * 删除状态0:未删除1:已删除 + */ + private Integer deleted; + + /** + * 创建时间 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date createTime; + + /** + * 更新时间 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date updateTime; + + @TableField(exist = false) + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/pojo/TbRole.java b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/pojo/TbRole.java new file mode 100644 index 00000000..aa188dce --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/pojo/TbRole.java @@ -0,0 +1,53 @@ +package com.bwie.ruoyi.pojo; + +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 com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +/** + * 角色表 + * @TableName tb_role + */ +@TableName(value ="tb_role") +@Data +public class TbRole implements Serializable { + /** + * + */ + @TableId(type = IdType.AUTO) + private Integer roleId; + + /** + * 角色名称 + */ + private String roleName; + + /** + * 删除状态0:未删除1:已删除 + */ + private Integer deleted; + + /** + * 创建时间 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date createTime; + + /** + * 更新时间 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date updateTime; + + @TableField(exist = false) + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/pojo/TbRolePerm.java b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/pojo/TbRolePerm.java new file mode 100644 index 00000000..47ac169b --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/pojo/TbRolePerm.java @@ -0,0 +1,58 @@ +package com.bwie.ruoyi.pojo; + +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 com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +/** + * 角色权限表 + * @TableName tb_role_perm + */ +@TableName(value ="tb_role_perm") +@Data +public class TbRolePerm implements Serializable { + /** + * + */ + @TableId(type = IdType.AUTO) + private Integer rolePermId; + + /** + * 角色ID + */ + private Integer roleId; + + /** + * 权限ID + */ + private Integer permId; + + /** + * 删除状态0:未删除1:已删除 + */ + private Integer deleted; + + /** + * 创建时间 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date createTime; + + /** + * 更新时间 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date updateTime; + + @TableField(exist = false) + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/pojo/TbUser.java b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/pojo/TbUser.java new file mode 100644 index 00000000..79d52f02 --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/pojo/TbUser.java @@ -0,0 +1,140 @@ +package com.bwie.ruoyi.pojo; + +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 com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +/** + * 用户信息表 + * @TableName tb_user + */ +@TableName(value ="tb_user") +@Data +public class TbUser implements Serializable { + /** + * 用户ID + */ + @TableId(type = IdType.AUTO) + private Long userId; + + /** + * 用户账号 + */ + private String userName; + + /** + * 用户昵称 + */ + private String nickName; + + /** + * 用户邮箱 + */ + private String email; + + /** + * 手机号码 + */ + private String phonenumber; + + /** + * 年龄 + */ + private Integer age; + + /** + * 用户性别(0男 1女 2未知) + */ + private String sex; + + /** + * 头像地址 + */ + private String avatar; + + /** + * 身份证(只有管理员能看到) + */ + private String userCard; + + /** + * 密码 + */ + private String password; + + /** + * 帐号状态(0正常 1停用) + */ + private String status; + + /** + * 删除标志(0代表存在 2代表删除) + */ + private String delFlag; + + /** + * 最后登录IP + */ + private String loginIp; + + /** + * 最后登录时间 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date loginDate; + + /** + * 创建者 + */ + private String createBy; + + /** + * 创建时间 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date createTime; + + /** + * 更新者 + */ + private String updateBy; + + /** + * 账号金额(元) + */ + private Double userPrice; + + /** + * 更新时间 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date updateTime; + + /** + * 备注 + */ + private String remark; + + /** + * 实名状态(0,未实名1已实名) + */ + private String realnameState; + + /** + * 信誉积分 + */ + private Integer honorIntegral; + + @TableField(exist = false) + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/pojo/TbUserBankcard.java b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/pojo/TbUserBankcard.java new file mode 100644 index 00000000..6d6af6c2 --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/pojo/TbUserBankcard.java @@ -0,0 +1,73 @@ +package com.bwie.ruoyi.pojo; + +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 com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +/** + * 账户表 + * @TableName tb_user_bankcard + */ +@TableName(value ="tb_user_bankcard") +@Data +public class TbUserBankcard implements Serializable { + /** + * 账户ID + */ + @TableId(type = IdType.AUTO) + private Integer bankcardId; + + /** + * 账户昵称 + */ + private String brankcardName; + + /** + * 用户ID + */ + private Integer userId; + + /** + * 账户金额 + */ + private Integer bankcardMoney; + + /** + * 创建者 + */ + private String createBy; + + /** + * 创建时间 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date createTime; + + /** + * 删除状态0:存在,2:删除 + */ + private Integer delFlag; + + /** + * 更新者 + */ + private String updateBy; + + /** + * 更新时间 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date updateTime; + + @TableField(exist = false) + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/pojo/TbUserRole.java b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/pojo/TbUserRole.java new file mode 100644 index 00000000..44293573 --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/pojo/TbUserRole.java @@ -0,0 +1,63 @@ +package com.bwie.ruoyi.pojo; + +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 com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +/** + * 用户类型表 + * @TableName tb_user_role + */ +@TableName(value ="tb_user_role") +@Data +public class TbUserRole implements Serializable { + /** + * 类型ID + */ + @TableId(type = IdType.AUTO) + private Long userRoleId; + + /** + * 用户角色类型 + */ + private String userRoleName; + + /** + * 创建者 + */ + private String createBy; + + /** + * 创建时间 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date createTime; + + /** + * 更新者 + */ + private String updateBy; + + /** + * 更新时间 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date updateTime; + + /** + * 用户角色有哪些功能 + */ + private String roleFunction; + + @TableField(exist = false) + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/service/TbPermService.java b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/service/TbPermService.java new file mode 100644 index 00000000..558705b4 --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/service/TbPermService.java @@ -0,0 +1,13 @@ +package com.bwie.ruoyi.service; + +import com.bwie.ruoyi.pojo.TbPerm; +import com.baomidou.mybatisplus.extension.service.IService; + +/** +* @author 海龙 +* @description 针对表【tb_perm(权限表)】的数据库操作Service +* @createDate 2023-01-13 14:34:44 +*/ +public interface TbPermService extends IService { + +} diff --git a/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/service/TbRolePermService.java b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/service/TbRolePermService.java new file mode 100644 index 00000000..5cb53d14 --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/service/TbRolePermService.java @@ -0,0 +1,13 @@ +package com.bwie.ruoyi.service; + +import com.bwie.ruoyi.pojo.TbRolePerm; +import com.baomidou.mybatisplus.extension.service.IService; + +/** +* @author 海龙 +* @description 针对表【tb_role_perm(角色权限表)】的数据库操作Service +* @createDate 2023-01-13 14:34:44 +*/ +public interface TbRolePermService extends IService { + +} diff --git a/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/service/TbRoleService.java b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/service/TbRoleService.java new file mode 100644 index 00000000..89446534 --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/service/TbRoleService.java @@ -0,0 +1,13 @@ +package com.bwie.ruoyi.service; + +import com.bwie.ruoyi.pojo.TbRole; +import com.baomidou.mybatisplus.extension.service.IService; + +/** +* @author 海龙 +* @description 针对表【tb_role(角色表)】的数据库操作Service +* @createDate 2023-01-13 14:34:44 +*/ +public interface TbRoleService extends IService { + +} diff --git a/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/service/TbUserBankcardService.java b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/service/TbUserBankcardService.java new file mode 100644 index 00000000..15509d8b --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/service/TbUserBankcardService.java @@ -0,0 +1,13 @@ +package com.bwie.ruoyi.service; + +import com.bwie.ruoyi.pojo.TbUserBankcard; +import com.baomidou.mybatisplus.extension.service.IService; + +/** +* @author 海龙 +* @description 针对表【tb_user_bankcard(账户表)】的数据库操作Service +* @createDate 2023-01-13 14:34:44 +*/ +public interface TbUserBankcardService extends IService { + +} diff --git a/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/service/TbUserRoleService.java b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/service/TbUserRoleService.java new file mode 100644 index 00000000..db30cbc1 --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/service/TbUserRoleService.java @@ -0,0 +1,13 @@ +package com.bwie.ruoyi.service; + +import com.bwie.ruoyi.pojo.TbUserRole; +import com.baomidou.mybatisplus.extension.service.IService; + +/** +* @author 海龙 +* @description 针对表【tb_user_role(用户类型表)】的数据库操作Service +* @createDate 2023-01-13 14:34:44 +*/ +public interface TbUserRoleService extends IService { + +} diff --git a/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/service/TbUserService.java b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/service/TbUserService.java new file mode 100644 index 00000000..555faabe --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/service/TbUserService.java @@ -0,0 +1,30 @@ +package com.bwie.ruoyi.service; + +import com.bwie.ruoyi.pojo.TbUser; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.system.api.model.*; + +import java.util.List; + +/** +* @author 海龙 +* @description 针对表【tb_user(用户信息表)】的数据库操作Service +* @createDate 2023-01-13 14:34:44 +*/ +public interface TbUserService extends IService { + + List getuser(); + + AjaxResult deluser(IdVo idVo); + + AjaxResult adduser(TbUserVo tbUserVo); + + AjaxResult phoneSend(PhoneVo phoneVo); + + AjaxResult updateuser(TbUserVo tbUserVo); + + AjaxResult uppassword(PassWordCode passWordCode); + + AjaxResult loginuser(LoginVo loginVo); +} diff --git a/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/service/impl/TbPermServiceImpl.java b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/service/impl/TbPermServiceImpl.java new file mode 100644 index 00000000..6afaa891 --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/service/impl/TbPermServiceImpl.java @@ -0,0 +1,22 @@ +package com.bwie.ruoyi.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.bwie.ruoyi.pojo.TbPerm; +import com.bwie.ruoyi.service.TbPermService; +import com.bwie.ruoyi.mapper.TbPermMapper; +import org.springframework.stereotype.Service; + +/** +* @author 海龙 +* @description 针对表【tb_perm(权限表)】的数据库操作Service实现 +* @createDate 2023-01-13 14:34:44 +*/ +@Service +public class TbPermServiceImpl extends ServiceImpl + implements TbPermService{ + +} + + + + diff --git a/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/service/impl/TbRolePermServiceImpl.java b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/service/impl/TbRolePermServiceImpl.java new file mode 100644 index 00000000..3024fe4b --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/service/impl/TbRolePermServiceImpl.java @@ -0,0 +1,22 @@ +package com.bwie.ruoyi.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.bwie.ruoyi.pojo.TbRolePerm; +import com.bwie.ruoyi.service.TbRolePermService; +import com.bwie.ruoyi.mapper.TbRolePermMapper; +import org.springframework.stereotype.Service; + +/** +* @author 海龙 +* @description 针对表【tb_role_perm(角色权限表)】的数据库操作Service实现 +* @createDate 2023-01-13 14:34:44 +*/ +@Service +public class TbRolePermServiceImpl extends ServiceImpl + implements TbRolePermService{ + +} + + + + diff --git a/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/service/impl/TbRoleServiceImpl.java b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/service/impl/TbRoleServiceImpl.java new file mode 100644 index 00000000..e4f043d5 --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/service/impl/TbRoleServiceImpl.java @@ -0,0 +1,22 @@ +package com.bwie.ruoyi.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.bwie.ruoyi.pojo.TbRole; +import com.bwie.ruoyi.service.TbRoleService; +import com.bwie.ruoyi.mapper.TbRoleMapper; +import org.springframework.stereotype.Service; + +/** +* @author 海龙 +* @description 针对表【tb_role(角色表)】的数据库操作Service实现 +* @createDate 2023-01-13 14:34:44 +*/ +@Service +public class TbRoleServiceImpl extends ServiceImpl + implements TbRoleService{ + +} + + + + diff --git a/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/service/impl/TbUserBankcardServiceImpl.java b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/service/impl/TbUserBankcardServiceImpl.java new file mode 100644 index 00000000..fa8bcc56 --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/service/impl/TbUserBankcardServiceImpl.java @@ -0,0 +1,22 @@ +package com.bwie.ruoyi.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.bwie.ruoyi.pojo.TbUserBankcard; +import com.bwie.ruoyi.service.TbUserBankcardService; +import com.bwie.ruoyi.mapper.TbUserBankcardMapper; +import org.springframework.stereotype.Service; + +/** +* @author 海龙 +* @description 针对表【tb_user_bankcard(账户表)】的数据库操作Service实现 +* @createDate 2023-01-13 14:34:44 +*/ +@Service +public class TbUserBankcardServiceImpl extends ServiceImpl + implements TbUserBankcardService{ + +} + + + + diff --git a/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/service/impl/TbUserRoleServiceImpl.java b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/service/impl/TbUserRoleServiceImpl.java new file mode 100644 index 00000000..3bafb84f --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/service/impl/TbUserRoleServiceImpl.java @@ -0,0 +1,22 @@ +package com.bwie.ruoyi.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.bwie.ruoyi.pojo.TbUserRole; +import com.bwie.ruoyi.service.TbUserRoleService; +import com.bwie.ruoyi.mapper.TbUserRoleMapper; +import org.springframework.stereotype.Service; + +/** +* @author 海龙 +* @description 针对表【tb_user_role(用户类型表)】的数据库操作Service实现 +* @createDate 2023-01-13 14:34:44 +*/ +@Service +public class TbUserRoleServiceImpl extends ServiceImpl + implements TbUserRoleService{ + +} + + + + diff --git a/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/service/impl/TbUserServiceImpl.java b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/service/impl/TbUserServiceImpl.java new file mode 100644 index 00000000..7ed4eb6e --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/service/impl/TbUserServiceImpl.java @@ -0,0 +1,155 @@ +package com.bwie.ruoyi.service.impl; + +import cn.hutool.core.util.RandomUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.bwie.ruoyi.pojo.TbUser; +import com.bwie.ruoyi.service.TbUserService; +import com.bwie.ruoyi.mapper.TbUserMapper; +import com.bwie.ruoyi.utils.DuanxinUtils; +import com.bwie.ruoyi.utils.TokenUtils; +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.system.api.model.*; +import org.apache.poi.ss.formula.functions.T; +import org.springframework.beans.BeanUtils; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.security.crypto.bcrypt.BCrypt; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +/** +* @author 海龙 +* @description 针对表【tb_user(用户信息表)】的数据库操作Service实现 +* @createDate 2023-01-13 14:34:44 +*/ +@Service +public class TbUserServiceImpl extends ServiceImpl + implements TbUserService{ + @Resource + private TbUserMapper tbUserMapper; + @Resource + private RedisTemplate redisTemplate; + @Override + public List getuser() { + List tbUsers = tbUserMapper.selectList(null); + List collect = tbUsers.stream().map(item -> { + TbUserVo tbUserVo = new TbUserVo(); + BeanUtils.copyProperties(item, tbUserVo); + return tbUserVo; + }).collect(Collectors.toList()); + return collect; + } + + @Override + public AjaxResult deluser(IdVo idVo) { + tbUserMapper.deleteById(idVo.getId()); + return AjaxResult.success(); + } + + @Override + public AjaxResult adduser(TbUserVo tbUserVo) { + LambdaQueryWrapper wrapper=new LambdaQueryWrapper<>(); + wrapper.eq(TbUser::getPhonenumber,tbUserVo.getPhonenumber()); + //判断手机号 + if(tbUserMapper.selectOne(wrapper)!=null){ + return AjaxResult.error("手机号已经注册请检查手机号"); + } + //判断用户的昵称 + LambdaQueryWrapper wrapper1=new LambdaQueryWrapper<>(); + wrapper1.eq(TbUser::getNickName,tbUserVo.getNickName() ); + if(tbUserMapper.selectOne(wrapper1)!=null){ + return AjaxResult.error("用户昵称已经被注册请换一个"); + } + //加密密码 + String hashpw = BCrypt.hashpw(tbUserVo.getPassword(), BCrypt.gensalt()); + TbUser tbUser = new TbUser(); + BeanUtils.copyProperties(tbUserVo, tbUser); + //更换加密密码 + tbUser.setPassword(hashpw); + tbUserMapper.insert(tbUser); + return AjaxResult.success(tbUser); + } + + @Override + public AjaxResult phoneSend(PhoneVo phoneVo) { + //随机生成的四位数 + String nums = RandomUtil.randomNumbers(6); + //存入redis用来做登录 + redisTemplate.opsForValue().set(phoneVo.getPhone(), nums); + //向手机发送信息 + DuanxinUtils.sendDuanxin(phoneVo.getPhone(), nums); + return AjaxResult.success("验证码已经发送是:"+nums+"请注意查收"); + } + + @Override + public AjaxResult updateuser(TbUserVo tbUserVo) { + LambdaQueryWrapper wrapper=new LambdaQueryWrapper<>(); + wrapper.eq(TbUser::getUserId,tbUserVo.getUserId()); + if(tbUserMapper.selectOne(wrapper)==null){ + return AjaxResult.error(); + } + TbUser tbUser = new TbUser(); + BeanUtils.copyProperties(tbUserVo, tbUser); + tbUserMapper.updateById(tbUser); + return AjaxResult.success("修改完成"); + } + + @Override + public AjaxResult uppassword(PassWordCode passWordCode) { + LambdaQueryWrapper wrapper=new LambdaQueryWrapper<>(); + wrapper.eq(TbUser::getUserId,passWordCode.getUserId()); + if(tbUserMapper.selectOne(wrapper)==null){ + return AjaxResult.error("用户不存在"); + } + boolean b = BCrypt.checkpw(passWordCode.getOldPassword(), tbUserMapper.selectOne(wrapper).getPassword()); + if(!b){ + return AjaxResult.error("输入的老密码不正确请重新输入"); + } + String hashpw = BCrypt.hashpw(passWordCode.getNewPassword(), BCrypt.gensalt()); + TbUser tbUser = new TbUser(); + BeanUtils.copyProperties(tbUserMapper.selectOne(wrapper), tbUser); + tbUser.setPassword(hashpw); + return AjaxResult.success(); + } + + @Override + public AjaxResult loginuser(LoginVo loginVo) { + //第一步判断账号 + LambdaQueryWrapper wrapper=new LambdaQueryWrapper<>(); + wrapper.eq(TbUser::getNickName,loginVo.getNickName()); + TbUser tbUser = tbUserMapper.selectOne(wrapper); + if(tbUser==null){ + return AjaxResult.error("账号不存在"); + } + boolean checkpw = BCrypt.checkpw(loginVo.getUserPass(), tbUser.getPassword()); + if(!checkpw){ + return AjaxResult.error("密码不正确"); + } + //判断code + String o =(String) redisTemplate.opsForValue().get(loginVo.getPhone()); + if(!loginVo.getCode().equals(o)){ + return AjaxResult.error("验证码不正确"); + } + //生成token + String token = TokenUtils.token().setKey("123456").setClaim("userId", tbUser.getUserId() + "").setClaim("nickName", tbUser.getNickName()).makeToken(); + //存入redis + redisTemplate.opsForValue().set(token, token,1, TimeUnit.MINUTES); + //返回类 + TbUserVo tbUserVo = new TbUserVo(); + BeanUtils.copyProperties(tbUser, tbUserVo); + tbUserVo.setToken(token); + tbUserVo.setPassword(null); + tbUserVo.setUserCard(null); + return AjaxResult.success(tbUserVo); + } + + +} + + + + diff --git a/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/utils/DuanxinUtils.java b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/utils/DuanxinUtils.java new file mode 100644 index 00000000..3233885b --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/utils/DuanxinUtils.java @@ -0,0 +1,46 @@ +package com.bwie.ruoyi.utils; + +import org.apache.http.HttpResponse; + +import java.util.HashMap; +import java.util.Map; + +public class DuanxinUtils { + + public static Boolean sendDuanxin(String mobile,String code){ + String host = "http://dingxin.market.alicloudapi.com"; + String path = "/dx/sendSms"; + String method = "POST"; + String appcode = "42feffa4bb0b463ab03421a67ec79e0c"; + Map headers = new HashMap(); + //最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105 + headers.put("Authorization", "APPCODE " + appcode); + Map querys = new HashMap(); + querys.put("mobile", mobile); + querys.put("param", "code:"+code); + querys.put("tpl_id", "TP20010711"); + Map bodys = new HashMap(); + + + try { + /** + * 重要提示如下: + * HttpUtils请从 + * https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/src/main/java/com/aliyun/api/gateway/demo/util/HttpUtils.java + * 下载 + * + * 相应的依赖请参照 + * https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/pom.xml + */ + HttpResponse response = HttpUtils.doPost(host, path, method, headers, querys, bodys); + System.out.println(response.toString()); + //获取response的body + //System.out.println(EntityUtils.toString(response.getEntity())); + return true; + } catch (Exception e) { + //打印异常 + e.printStackTrace(); + return false; + } + } +} diff --git a/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/utils/HttpUtils.java b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/utils/HttpUtils.java new file mode 100644 index 00000000..1b9bd7db --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/utils/HttpUtils.java @@ -0,0 +1,311 @@ +package com.bwie.ruoyi.utils; + +import org.apache.commons.lang.StringUtils; +import org.apache.http.HttpResponse; +import org.apache.http.NameValuePair; +import org.apache.http.client.HttpClient; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.HttpDelete; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpPut; +import org.apache.http.conn.ClientConnectionManager; +import org.apache.http.conn.scheme.Scheme; +import org.apache.http.conn.scheme.SchemeRegistry; +import org.apache.http.conn.ssl.SSLSocketFactory; +import org.apache.http.entity.ByteArrayEntity; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.message.BasicNameValuePair; + +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.security.KeyManagementException; +import java.security.NoSuchAlgorithmException; +import java.security.cert.X509Certificate; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class HttpUtils { + + /** + * get + * + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @return + * @throws Exception + */ + public static HttpResponse doGet(String host, String path, String method, + Map headers, + Map querys) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpGet request = new HttpGet(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + return httpClient.execute(request); + } + + /** + * post form + * + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @param bodys + * @return + * @throws Exception + */ + public static HttpResponse doPost(String host, String path, String method, + Map headers, + Map querys, + Map bodys) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpPost request = new HttpPost(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + if (bodys != null) { + List nameValuePairList = new ArrayList(); + + for (String key : bodys.keySet()) { + nameValuePairList.add(new BasicNameValuePair(key, bodys.get(key))); + } + UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(nameValuePairList, "utf-8"); + formEntity.setContentType("application/x-www-form-urlencoded; charset=UTF-8"); + request.setEntity(formEntity); + } + + return httpClient.execute(request); + } + + /** + * Post String + * + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @param body + * @return + * @throws Exception + */ + public static HttpResponse doPost(String host, String path, String method, + Map headers, + Map querys, + String body) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpPost request = new HttpPost(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + if (StringUtils.isNotBlank(body)) { + request.setEntity(new StringEntity(body, "utf-8")); + } + + return httpClient.execute(request); + } + + /** + * Post stream + * + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @param body + * @return + * @throws Exception + */ + public static HttpResponse doPost(String host, String path, String method, + Map headers, + Map querys, + byte[] body) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpPost request = new HttpPost(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + if (body != null) { + request.setEntity(new ByteArrayEntity(body)); + } + + return httpClient.execute(request); + } + + /** + * Put String + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @param body + * @return + * @throws Exception + */ + public static HttpResponse doPut(String host, String path, String method, + Map headers, + Map querys, + String body) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpPut request = new HttpPut(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + if (StringUtils.isNotBlank(body)) { + request.setEntity(new StringEntity(body, "utf-8")); + } + + return httpClient.execute(request); + } + + /** + * Put stream + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @param body + * @return + * @throws Exception + */ + public static HttpResponse doPut(String host, String path, String method, + Map headers, + Map querys, + byte[] body) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpPut request = new HttpPut(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + if (body != null) { + request.setEntity(new ByteArrayEntity(body)); + } + + return httpClient.execute(request); + } + + /** + * Delete + * + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @return + * @throws Exception + */ + public static HttpResponse doDelete(String host, String path, String method, + Map headers, + Map querys) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpDelete request = new HttpDelete(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + return httpClient.execute(request); + } + + private static String buildUrl(String host, String path, Map querys) throws UnsupportedEncodingException { + StringBuilder sbUrl = new StringBuilder(); + sbUrl.append(host); + if (!StringUtils.isBlank(path)) { + sbUrl.append(path); + } + if (null != querys) { + StringBuilder sbQuery = new StringBuilder(); + for (Map.Entry query : querys.entrySet()) { + if (0 < sbQuery.length()) { + sbQuery.append("&"); + } + if (StringUtils.isBlank(query.getKey()) && !StringUtils.isBlank(query.getValue())) { + sbQuery.append(query.getValue()); + } + if (!StringUtils.isBlank(query.getKey())) { + sbQuery.append(query.getKey()); + if (!StringUtils.isBlank(query.getValue())) { + sbQuery.append("="); + sbQuery.append(URLEncoder.encode(query.getValue(), "utf-8")); + } + } + } + if (0 < sbQuery.length()) { + sbUrl.append("?").append(sbQuery); + } + } + + return sbUrl.toString(); + } + + private static HttpClient wrapClient(String host) { + HttpClient httpClient = new DefaultHttpClient(); + if (host.startsWith("https://")) { + sslClient(httpClient); + } + + return httpClient; + } + + private static void sslClient(HttpClient httpClient) { + try { + SSLContext ctx = SSLContext.getInstance("TLS"); + X509TrustManager tm = new X509TrustManager() { + public X509Certificate[] getAcceptedIssuers() { + return null; + } + public void checkClientTrusted(X509Certificate[] xcs, String str) { + + } + public void checkServerTrusted(X509Certificate[] xcs, String str) { + + } + }; + ctx.init(null, new TrustManager[] { tm }, null); + SSLSocketFactory ssf = new SSLSocketFactory(ctx); + ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); + ClientConnectionManager ccm = httpClient.getConnectionManager(); + SchemeRegistry registry = ccm.getSchemeRegistry(); + registry.register(new Scheme("https", 443, ssf)); + } catch (KeyManagementException ex) { + throw new RuntimeException(ex); + } catch (NoSuchAlgorithmException ex) { + throw new RuntimeException(ex); + } + } +} \ No newline at end of file diff --git a/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/utils/TokenUtils.java b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/utils/TokenUtils.java new file mode 100644 index 00000000..5b43a79f --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/java/com/bwie/ruoyi/utils/TokenUtils.java @@ -0,0 +1,178 @@ +package com.bwie.ruoyi.utils; + +import io.jsonwebtoken.*; + +import java.util.ArrayList; +import java.util.Date; + +public class TokenUtils { + + public static int SUCCESS = 0; + public static int ERROR_SIGN = 1; + public static int ERROR_EXPIRE = 2; + public static int ERROR = 3; + + private String key = "123456"; + private Integer expireTime = 60; + private Claims claims = null; + JwtBuilder builder = null; + + public TokenUtils() { + builder = Jwts.builder(); + } + + public static TokenUtils token() { + return new TokenUtils(); + } + + public TokenUtils setKey(String key) { + this.key = key; + return this; + } + + public TokenUtils setExpire(Integer seconds) { + this.expireTime = seconds; + + // 设置签发日期 + builder.setIssuedAt(new Date()); + // 设置过期时间 + long now = System.currentTimeMillis(); + long exp = now+1000*expireTime; + builder.setExpiration( new Date( exp ) ); + + return this; + } + + public TokenUtils setClaim(String key, String value) { + builder.claim( key, value ); + return this; + } + + /** + * @description 生成最终token + * @author 军哥 + * @date 2022/6/22 15:44 + * @version 1.0 + */ + public String makeToken() { + // 设置签名 使用HS256算法,并设置SecretKey(字符串) + builder.signWith(SignatureAlgorithm.HS256,key); + + // 生成token + String token = builder.compact(); + + return token; + } + + + /** + * @description 存放多个Key-Value数据 + * @author 军哥 + * @date 2022/6/22 15:47 + * @version 1.0 + */ + public TokenUtils putKeyValues(String... keyValues) { + if(keyValues.length > 0) { + // 添加数据 + ArrayList stringPair = new ArrayList<>(); + for(String kv:keyValues) { + // 添加键值对 + stringPair.add(kv); + // + if(stringPair.size()>=2) { + builder.claim( stringPair.get(0),stringPair.get(1) ); + stringPair.clear(); + continue; + } + } + } + + return this; + } + + /** + * @description 添加键值对数据,然后生成token + * @author 军哥 + * @date 2022/6/22 15:45 + * @version 1.0 + */ + public String createToken(String... keyValues) { + + // 存放数据 + if(keyValues.length > 0) { + // 添加数据 + ArrayList stringPair = new ArrayList<>(); + for(String kv:keyValues) { + // 添加键值对 + stringPair.add(kv); + // + if(stringPair.size()>=2) { + builder.claim( stringPair.get(0),stringPair.get(1) ); + stringPair.clear(); + continue; + } + } + } + + // + // 设置签名 使用HS256算法,并设置SecretKey(字符串) + builder.signWith(SignatureAlgorithm.HS256,key); + + // 生成token + String token = builder.compact(); + + return token; + } + + public int parseToken(String token) { + try { + claims = Jwts.parser() + .setSigningKey(key) + .parseClaimsJws(token) + .getBody(); + return TokenUtils.SUCCESS; + } + catch (ExpiredJwtException e) { + System.out.println("token expired"); + claims = e.getClaims(); + return TokenUtils.ERROR_EXPIRE; + } catch (SignatureException e) { + System.out.println("token signature error"); + return TokenUtils.ERROR_SIGN; + } catch (Exception e) { + System.out.println("token error"); + return TokenUtils.ERROR; + } + } + + public String getClaim(String key) { + if(claims == null) { + return null; + } + + String value = (String)claims.get(key); + + return value; + } + + /** + * @description 测试工具类 + * @author 军哥 + * @date 2022/6/22 15:49 + * @version 1.0 + */ + public static void main(String[] args) { + String token = TokenUtils.token() + // 设置加密密码 + .setKey("123456") + // 设置过期时间 + .setExpire(60 * 30) + // 添加数据 + .setClaim("id", "" + 666) + .setClaim("userName", "zhaoyun") + .putKeyValues("role", "admin", "permissions", "select,delete,insert") + // 生成token + .makeToken(); + System.out.println("token="+token); + } +} \ No newline at end of file diff --git a/ruoyi-modules/ruoyi-user/src/main/resources/bootstrap.yml b/ruoyi-modules/ruoyi-user/src/main/resources/bootstrap.yml new file mode 100644 index 00000000..d0eb132c --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/resources/bootstrap.yml @@ -0,0 +1,25 @@ +# Tomcat +server: + port: 9302 + +# Spring +spring: + application: + # 应用名称 + name: ruoyi-user + profiles: + # 环境配置 + active: dev + cloud: + nacos: + discovery: + # 服务注册地址 + server-addr: 127.0.0.1:8848 + config: + # 配置中心地址 + server-addr: 127.0.0.1:8848 + # 配置文件格式 + file-extension: yml + # 共享配置 + shared-configs: + - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} diff --git a/ruoyi-modules/ruoyi-user/src/main/resources/logback.xml b/ruoyi-modules/ruoyi-user/src/main/resources/logback.xml new file mode 100644 index 00000000..0154e288 --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/resources/logback.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + ${log.pattern} + + + + + + ${log.path}/info.log + + + + ${log.path}/info.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + INFO + + ACCEPT + + DENY + + + + + ${log.path}/error.log + + + + ${log.path}/error.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + ERROR + + ACCEPT + + DENY + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ruoyi-modules/ruoyi-user/src/main/resources/mapper/TbPermMapper.xml b/ruoyi-modules/ruoyi-user/src/main/resources/mapper/TbPermMapper.xml new file mode 100644 index 00000000..5a3a0096 --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/resources/mapper/TbPermMapper.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + perm_id,perm_name,perm_code, + deleted,create_time,update_time + + diff --git a/ruoyi-modules/ruoyi-user/src/main/resources/mapper/TbRoleMapper.xml b/ruoyi-modules/ruoyi-user/src/main/resources/mapper/TbRoleMapper.xml new file mode 100644 index 00000000..b59b2c7f --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/resources/mapper/TbRoleMapper.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + role_id,role_name,deleted, + create_time,update_time + + diff --git a/ruoyi-modules/ruoyi-user/src/main/resources/mapper/TbRolePermMapper.xml b/ruoyi-modules/ruoyi-user/src/main/resources/mapper/TbRolePermMapper.xml new file mode 100644 index 00000000..2a5d1614 --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/resources/mapper/TbRolePermMapper.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + role_perm_id,role_id,perm_id, + deleted,create_time,update_time + + diff --git a/ruoyi-modules/ruoyi-user/src/main/resources/mapper/TbUserBankcardMapper.xml b/ruoyi-modules/ruoyi-user/src/main/resources/mapper/TbUserBankcardMapper.xml new file mode 100644 index 00000000..d63cb616 --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/resources/mapper/TbUserBankcardMapper.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + bankcard_id,brankcard_name,user_id, + bankcard_money,create_by,create_time, + del_flag,update_by,update_time + + diff --git a/ruoyi-modules/ruoyi-user/src/main/resources/mapper/TbUserMapper.xml b/ruoyi-modules/ruoyi-user/src/main/resources/mapper/TbUserMapper.xml new file mode 100644 index 00000000..c7ac2290 --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/resources/mapper/TbUserMapper.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + user_id,user_name,nick_name, + email,phonenumber,age, + sex,avatar,user_card, + password,status,del_flag, + login_ip,login_date,create_by, + create_time,update_by,user_price, + update_time,remark,realname_state, + honor_integral + + diff --git a/ruoyi-modules/ruoyi-user/src/main/resources/mapper/TbUserRoleMapper.xml b/ruoyi-modules/ruoyi-user/src/main/resources/mapper/TbUserRoleMapper.xml new file mode 100644 index 00000000..fd2a8128 --- /dev/null +++ b/ruoyi-modules/ruoyi-user/src/main/resources/mapper/TbUserRoleMapper.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + user_role_id,user_role_name,create_by, + create_time,update_by,update_time, + role_function + +