Browse Source
			
			
			Merge branch 'master' of http://120.76.47.59:3000/liu_li/yxk_canvasScreen into master
			
			
				master
			
			
		
		Merge branch 'master' of http://120.76.47.59:3000/liu_li/yxk_canvasScreen into master
	
		
	
			
			
				master
			
			
		
				 13 changed files with 310 additions and 21 deletions
			
			
		- 
					59common/src/main/java/com/canvas/web/annotation/rest/AnonymousPutMapping.java
- 
					4common/src/main/java/com/canvas/web/utils/RedisUtils.java
- 
					59system/src/main/java/com/canvas/web/modules/security/config/bean/MessageCode.java
- 
					9system/src/main/java/com/canvas/web/modules/security/config/bean/MessageCodeProperties.java
- 
					63system/src/main/java/com/canvas/web/modules/security/controller/AuthorizationController.java
- 
					18system/src/main/java/com/canvas/web/modules/security/service/dto/MsgDto.java
- 
					35system/src/main/java/com/canvas/web/modules/system/controller/UserController.java
- 
					24system/src/main/java/com/canvas/web/modules/system/domain/vo/UserPassVo.java
- 
					3system/src/main/java/com/canvas/web/modules/system/repository/UserRepository.java
- 
					17system/src/main/java/com/canvas/web/modules/system/service/RoleService.java
- 
					1system/src/main/java/com/canvas/web/modules/system/service/UserService.java
- 
					13system/src/main/java/com/canvas/web/modules/system/service/impl/RoleServiceImpl.java
- 
					26system/src/main/java/com/canvas/web/modules/system/service/impl/UserServiceImpl.java
| @ -0,0 +1,59 @@ | |||||
|  | package com.canvas.web.annotation.rest; | ||||
|  | 
 | ||||
|  | 
 | ||||
|  | import com.canvas.web.annotation.AnonymousAccess; | ||||
|  | import org.springframework.core.annotation.AliasFor; | ||||
|  | import org.springframework.web.bind.annotation.RequestMapping; | ||||
|  | import org.springframework.web.bind.annotation.RequestMethod; | ||||
|  | 
 | ||||
|  | import java.lang.annotation.*; | ||||
|  | 
 | ||||
|  | @AnonymousAccess | ||||
|  | @Target(ElementType.METHOD) | ||||
|  | @Retention(RetentionPolicy.RUNTIME) | ||||
|  | @Documented | ||||
|  | @RequestMapping(method = RequestMethod.PUT) | ||||
|  | public @interface AnonymousPutMapping { | ||||
|  | 
 | ||||
|  |     /** | ||||
|  |      * Alias for {@link RequestMapping#name}. | ||||
|  |      */ | ||||
|  |     @AliasFor(annotation = RequestMapping.class) | ||||
|  |     String name() default ""; | ||||
|  | 
 | ||||
|  |     /** | ||||
|  |      * Alias for {@link RequestMapping#value}. | ||||
|  |      */ | ||||
|  |     @AliasFor(annotation = RequestMapping.class) | ||||
|  |     String[] value() default {}; | ||||
|  | 
 | ||||
|  |     /** | ||||
|  |      * Alias for {@link RequestMapping#path}. | ||||
|  |      */ | ||||
|  |     @AliasFor(annotation = RequestMapping.class) | ||||
|  |     String[] path() default {}; | ||||
|  | 
 | ||||
|  |     /** | ||||
|  |      * Alias for {@link RequestMapping#params}. | ||||
|  |      */ | ||||
|  |     @AliasFor(annotation = RequestMapping.class) | ||||
|  |     String[] params() default {}; | ||||
|  | 
 | ||||
|  |     /** | ||||
|  |      * Alias for {@link RequestMapping#headers}. | ||||
|  |      */ | ||||
|  |     @AliasFor(annotation = RequestMapping.class) | ||||
|  |     String[] headers() default {}; | ||||
|  | 
 | ||||
|  |     /** | ||||
|  |      * Alias for {@link RequestMapping#consumes}. | ||||
|  |      */ | ||||
|  |     @AliasFor(annotation = RequestMapping.class) | ||||
|  |     String[] consumes() default {}; | ||||
|  | 
 | ||||
|  |     /** | ||||
|  |      * Alias for {@link RequestMapping#produces}. | ||||
|  |      */ | ||||
|  |     @AliasFor(annotation = RequestMapping.class) | ||||
|  |     String[] produces() default {}; | ||||
|  | } | ||||
| @ -0,0 +1,59 @@ | |||||
|  | package com.canvas.web.modules.security.config.bean; | ||||
|  | 
 | ||||
|  | 
 | ||||
|  | import lombok.AllArgsConstructor; | ||||
|  | import lombok.Data; | ||||
|  | 
 | ||||
|  | //短信配置类 | ||||
|  | 
 | ||||
|  | 
 | ||||
|  | public class MessageCode { | ||||
|  | 
 | ||||
|  |     //短信验证码到期时间 | ||||
|  |     private static Long expiration = 5L; | ||||
|  | 
 | ||||
|  |     //短信模板编号 | ||||
|  |     private static String project = "hhzXr"; | ||||
|  | 
 | ||||
|  |     //短信验证码模板代码 | ||||
|  |     private static String key = "code"; | ||||
|  | 
 | ||||
|  |     //短信验证码模板值 | ||||
|  |     private static String val; | ||||
|  | 
 | ||||
|  |     //生成多少位验证码 | ||||
|  |     private static final Integer count = 4; | ||||
|  | 
 | ||||
|  | 
 | ||||
|  |     public static String getVal() { | ||||
|  |         return val; | ||||
|  |     } | ||||
|  | 
 | ||||
|  |     public static void setVal(String val) { | ||||
|  |         MessageCode.val = val; | ||||
|  |     } | ||||
|  | 
 | ||||
|  |     public static Long getExpiration() { | ||||
|  |         return expiration; | ||||
|  |     } | ||||
|  | 
 | ||||
|  |     public static void setExpiration(Long expiration) { | ||||
|  |         MessageCode.expiration = expiration; | ||||
|  |     } | ||||
|  | 
 | ||||
|  |     public static String getProject() { | ||||
|  |         return project; | ||||
|  |     } | ||||
|  | 
 | ||||
|  |     public static void setProject(String project) { | ||||
|  |         MessageCode.project = project; | ||||
|  |     } | ||||
|  | 
 | ||||
|  |     public static String getKey() { | ||||
|  |         return key; | ||||
|  |     } | ||||
|  | 
 | ||||
|  |     public static void setKey(String key) { | ||||
|  |         MessageCode.key = key; | ||||
|  |     } | ||||
|  | } | ||||
| @ -0,0 +1,9 @@ | |||||
|  | package com.canvas.web.modules.security.config.bean; | ||||
|  | 
 | ||||
|  | public class MessageCodeProperties { | ||||
|  | 
 | ||||
|  |     //随机生成验证码 | ||||
|  |     public static String generatedCode(int count){ | ||||
|  |         return String.valueOf((int)((Math.random()*9+1)*Math.pow(10,count-1))); | ||||
|  |     } | ||||
|  | } | ||||
| @ -0,0 +1,18 @@ | |||||
|  | package com.canvas.web.modules.security.service.dto; | ||||
|  | 
 | ||||
|  | 
 | ||||
|  | import lombok.AllArgsConstructor; | ||||
|  | import lombok.Data; | ||||
|  | import lombok.NoArgsConstructor; | ||||
|  | 
 | ||||
|  | import javax.validation.constraints.NotBlank; | ||||
|  | 
 | ||||
|  | @Data | ||||
|  | @AllArgsConstructor | ||||
|  | @NoArgsConstructor | ||||
|  | public class MsgDto { | ||||
|  | 
 | ||||
|  |     @NotBlank(message = "手机号不能为空") | ||||
|  |     private String phone; | ||||
|  | 
 | ||||
|  | } | ||||
| @ -0,0 +1,35 @@ | |||||
|  | package com.canvas.web.modules.system.controller; | ||||
|  | 
 | ||||
|  | 
 | ||||
|  | import com.canvas.web.modules.system.service.RoleService; | ||||
|  | import com.canvas.web.modules.system.service.UserService; | ||||
|  | import com.canvas.web.modules.system.service.dto.UserDto; | ||||
|  | import io.swagger.annotations.Api; | ||||
|  | import io.swagger.annotations.ApiOperation; | ||||
|  | import lombok.RequiredArgsConstructor; | ||||
|  | import org.springframework.http.ResponseEntity; | ||||
|  | import org.springframework.validation.annotation.Validated; | ||||
|  | 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; | ||||
|  | 
 | ||||
|  | @Api(tags = "用户管理") | ||||
|  | @RestController | ||||
|  | @RequestMapping("api/users/") | ||||
|  | @RequiredArgsConstructor | ||||
|  | public class UserController { | ||||
|  | 
 | ||||
|  |     private final UserService userService; | ||||
|  |     private final RoleService roleService; | ||||
|  | 
 | ||||
|  | //    @ApiOperation("新增用户") | ||||
|  | //    @PostMapping | ||||
|  | //    public ResponseEntity<Object> create(@Validated @RequestBody UserDto userDto){ | ||||
|  | // | ||||
|  | //    } | ||||
|  | // | ||||
|  | //    private void checkLevel(UserDto userDto){ | ||||
|  | //        Integer currentLevel= | ||||
|  | //    } | ||||
|  | } | ||||
| @ -0,0 +1,24 @@ | |||||
|  | package com.canvas.web.modules.system.domain.vo; | ||||
|  | 
 | ||||
|  | import com.alibaba.fastjson.annotation.JSONField; | ||||
|  | import com.fasterxml.jackson.annotation.JsonProperty; | ||||
|  | import lombok.Data; | ||||
|  | 
 | ||||
|  | import javax.validation.constraints.NotBlank; | ||||
|  | 
 | ||||
|  | @Data | ||||
|  | public class UserPassVo { | ||||
|  | 
 | ||||
|  |     @NotBlank(message = "手机号不能为空") | ||||
|  |     private String phone; | ||||
|  | 
 | ||||
|  |     @JsonProperty("new_pass") | ||||
|  |     @JSONField(name = "new_pass") | ||||
|  |     @NotBlank(message = "密码不能为空") | ||||
|  |     private String newPass; | ||||
|  | 
 | ||||
|  |     @NotBlank(message = "验证码不能为空") | ||||
|  |     private String code; | ||||
|  | 
 | ||||
|  |     private String uuid; | ||||
|  | } | ||||
						Write
						Preview
					
					
					Loading…
					
					Cancel
						Save
					
		Reference in new issue