parent
938fa2e9ae
commit
0669a85058
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
@ -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;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
@ -0,0 +1,147 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>ruoyi-modules</artifactId>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<version>3.6.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ruoyi-user</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
|
||||
<!-- 短信发送的依赖 5个-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.15</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpcore</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-util</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>4.5.16</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.4.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>2.1.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos Config -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Sentinel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot Actuator -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger UI -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql Connector -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- RuoYi Common DataSource -->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common-datasource</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- RuoYi Common DataScope -->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common-datascope</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- RuoYi Common Log -->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- RuoYi Common Swagger -->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common-swagger</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -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" +
|
||||
" ''-' `'-' `-..-' ");
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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<TbUserVo> 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);
|
||||
}
|
||||
}
|
@ -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<TbPerm> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -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<TbRole> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -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<TbRolePerm> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -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<TbUserBankcard> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -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<TbUser> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -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<TbUserRole> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -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;
|
||||
}
|
@ -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<TbPerm> {
|
||||
|
||||
}
|
@ -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<TbRolePerm> {
|
||||
|
||||
}
|
@ -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<TbRole> {
|
||||
|
||||
}
|
@ -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<TbUserBankcard> {
|
||||
|
||||
}
|
@ -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<TbUserRole> {
|
||||
|
||||
}
|
@ -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<TbUser> {
|
||||
|
||||
List<TbUserVo> 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);
|
||||
}
|
@ -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<TbPermMapper, TbPerm>
|
||||
implements TbPermService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -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<TbRolePermMapper, TbRolePerm>
|
||||
implements TbRolePermService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -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<TbRoleMapper, TbRole>
|
||||
implements TbRoleService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -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<TbUserBankcardMapper, TbUserBankcard>
|
||||
implements TbUserBankcardService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -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<TbUserRoleMapper, TbUserRole>
|
||||
implements TbUserRoleService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -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<TbUserMapper, TbUser>
|
||||
implements TbUserService{
|
||||
@Resource
|
||||
private TbUserMapper tbUserMapper;
|
||||
@Resource
|
||||
private RedisTemplate<String,Object> redisTemplate;
|
||||
@Override
|
||||
public List<TbUserVo> getuser() {
|
||||
List<TbUser> tbUsers = tbUserMapper.selectList(null);
|
||||
List<TbUserVo> 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<TbUser> wrapper=new LambdaQueryWrapper<>();
|
||||
wrapper.eq(TbUser::getPhonenumber,tbUserVo.getPhonenumber());
|
||||
//判断手机号
|
||||
if(tbUserMapper.selectOne(wrapper)!=null){
|
||||
return AjaxResult.error("手机号已经注册请检查手机号");
|
||||
}
|
||||
//判断用户的昵称
|
||||
LambdaQueryWrapper<TbUser> 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<TbUser> 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<TbUser> 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<TbUser> 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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -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<String, String> headers = new HashMap<String, String>();
|
||||
//最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105
|
||||
headers.put("Authorization", "APPCODE " + appcode);
|
||||
Map<String, String> querys = new HashMap<String, String>();
|
||||
querys.put("mobile", mobile);
|
||||
querys.put("param", "code:"+code);
|
||||
querys.put("tpl_id", "TP20010711");
|
||||
Map<String, String> bodys = new HashMap<String, String>();
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
@ -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<String, String> headers,
|
||||
Map<String, String> querys)
|
||||
throws Exception {
|
||||
HttpClient httpClient = wrapClient(host);
|
||||
|
||||
HttpGet request = new HttpGet(buildUrl(host, path, querys));
|
||||
for (Map.Entry<String, String> 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<String, String> headers,
|
||||
Map<String, String> querys,
|
||||
Map<String, String> bodys)
|
||||
throws Exception {
|
||||
HttpClient httpClient = wrapClient(host);
|
||||
|
||||
HttpPost request = new HttpPost(buildUrl(host, path, querys));
|
||||
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||
request.addHeader(e.getKey(), e.getValue());
|
||||
}
|
||||
|
||||
if (bodys != null) {
|
||||
List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>();
|
||||
|
||||
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<String, String> headers,
|
||||
Map<String, String> querys,
|
||||
String body)
|
||||
throws Exception {
|
||||
HttpClient httpClient = wrapClient(host);
|
||||
|
||||
HttpPost request = new HttpPost(buildUrl(host, path, querys));
|
||||
for (Map.Entry<String, String> 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<String, String> headers,
|
||||
Map<String, String> querys,
|
||||
byte[] body)
|
||||
throws Exception {
|
||||
HttpClient httpClient = wrapClient(host);
|
||||
|
||||
HttpPost request = new HttpPost(buildUrl(host, path, querys));
|
||||
for (Map.Entry<String, String> 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<String, String> headers,
|
||||
Map<String, String> querys,
|
||||
String body)
|
||||
throws Exception {
|
||||
HttpClient httpClient = wrapClient(host);
|
||||
|
||||
HttpPut request = new HttpPut(buildUrl(host, path, querys));
|
||||
for (Map.Entry<String, String> 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<String, String> headers,
|
||||
Map<String, String> querys,
|
||||
byte[] body)
|
||||
throws Exception {
|
||||
HttpClient httpClient = wrapClient(host);
|
||||
|
||||
HttpPut request = new HttpPut(buildUrl(host, path, querys));
|
||||
for (Map.Entry<String, String> 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<String, String> headers,
|
||||
Map<String, String> querys)
|
||||
throws Exception {
|
||||
HttpClient httpClient = wrapClient(host);
|
||||
|
||||
HttpDelete request = new HttpDelete(buildUrl(host, path, querys));
|
||||
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||
request.addHeader(e.getKey(), e.getValue());
|
||||
}
|
||||
|
||||
return httpClient.execute(request);
|
||||
}
|
||||
|
||||
private static String buildUrl(String host, String path, Map<String, String> 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<String, String> 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);
|
||||
}
|
||||
}
|
||||
}
|
@ -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}
|
@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/ruoyi-system" />
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.ruoyi" level="info" />
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn" />
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info" />
|
||||
<appender-ref ref="file_error" />
|
||||
</root>
|
||||
</configuration>
|
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bwie.ruoyi.mapper.TbPermMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.bwie.ruoyi.pojo.TbPerm">
|
||||
<id property="permId" column="perm_id" jdbcType="INTEGER"/>
|
||||
<result property="permName" column="perm_name" jdbcType="VARCHAR"/>
|
||||
<result property="permCode" column="perm_code" jdbcType="VARCHAR"/>
|
||||
<result property="deleted" column="deleted" jdbcType="INTEGER"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
perm_id,perm_name,perm_code,
|
||||
deleted,create_time,update_time
|
||||
</sql>
|
||||
</mapper>
|
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bwie.ruoyi.mapper.TbRoleMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.bwie.ruoyi.pojo.TbRole">
|
||||
<id property="roleId" column="role_id" jdbcType="INTEGER"/>
|
||||
<result property="roleName" column="role_name" jdbcType="VARCHAR"/>
|
||||
<result property="deleted" column="deleted" jdbcType="INTEGER"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
role_id,role_name,deleted,
|
||||
create_time,update_time
|
||||
</sql>
|
||||
</mapper>
|
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bwie.ruoyi.mapper.TbRolePermMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.bwie.ruoyi.pojo.TbRolePerm">
|
||||
<id property="rolePermId" column="role_perm_id" jdbcType="INTEGER"/>
|
||||
<result property="roleId" column="role_id" jdbcType="INTEGER"/>
|
||||
<result property="permId" column="perm_id" jdbcType="INTEGER"/>
|
||||
<result property="deleted" column="deleted" jdbcType="INTEGER"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
role_perm_id,role_id,perm_id,
|
||||
deleted,create_time,update_time
|
||||
</sql>
|
||||
</mapper>
|
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bwie.ruoyi.mapper.TbUserBankcardMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.bwie.ruoyi.pojo.TbUserBankcard">
|
||||
<id property="bankcardId" column="bankcard_id" jdbcType="INTEGER"/>
|
||||
<result property="brankcardName" column="brankcard_name" jdbcType="VARCHAR"/>
|
||||
<result property="userId" column="user_id" jdbcType="INTEGER"/>
|
||||
<result property="bankcardMoney" column="bankcard_money" jdbcType="INTEGER"/>
|
||||
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="delFlag" column="del_flag" jdbcType="INTEGER"/>
|
||||
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
bankcard_id,brankcard_name,user_id,
|
||||
bankcard_money,create_by,create_time,
|
||||
del_flag,update_by,update_time
|
||||
</sql>
|
||||
</mapper>
|
@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bwie.ruoyi.mapper.TbUserMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.bwie.ruoyi.pojo.TbUser">
|
||||
<id property="userId" column="user_id" jdbcType="BIGINT"/>
|
||||
<result property="userName" column="user_name" jdbcType="VARCHAR"/>
|
||||
<result property="nickName" column="nick_name" jdbcType="VARCHAR"/>
|
||||
<result property="email" column="email" jdbcType="VARCHAR"/>
|
||||
<result property="phonenumber" column="phonenumber" jdbcType="VARCHAR"/>
|
||||
<result property="age" column="age" jdbcType="INTEGER"/>
|
||||
<result property="sex" column="sex" jdbcType="CHAR"/>
|
||||
<result property="avatar" column="avatar" jdbcType="VARCHAR"/>
|
||||
<result property="userCard" column="user_card" jdbcType="VARCHAR"/>
|
||||
<result property="password" column="password" jdbcType="VARCHAR"/>
|
||||
<result property="status" column="status" jdbcType="CHAR"/>
|
||||
<result property="delFlag" column="del_flag" jdbcType="CHAR"/>
|
||||
<result property="loginIp" column="login_ip" jdbcType="VARCHAR"/>
|
||||
<result property="loginDate" column="login_date" jdbcType="TIMESTAMP"/>
|
||||
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
|
||||
<result property="userPrice" column="user_price" jdbcType="DOUBLE"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
||||
<result property="realnameState" column="realname_state" jdbcType="CHAR"/>
|
||||
<result property="honorIntegral" column="honor_integral" jdbcType="INTEGER"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
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
|
||||
</sql>
|
||||
</mapper>
|
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bwie.ruoyi.mapper.TbUserRoleMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.bwie.ruoyi.pojo.TbUserRole">
|
||||
<id property="userRoleId" column="user_role_id" jdbcType="BIGINT"/>
|
||||
<result property="userRoleName" column="user_role_name" jdbcType="VARCHAR"/>
|
||||
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="roleFunction" column="role_function" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
user_role_id,user_role_name,create_by,
|
||||
create_time,update_by,update_time,
|
||||
role_function
|
||||
</sql>
|
||||
</mapper>
|
Loading…
Reference in new issue