Ver código fonte

Merge branch 'master' of http://git.izouma.com/licailing/dingdong

panhui 5 anos atrás
pai
commit
2d95d4bbad

+ 3 - 6
src/main/java/com/izouma/dingdong/domain/rider/Rider.java

@@ -36,18 +36,12 @@ public class Rider extends BaseEntity {
     @ApiModelProperty(value = "纬度", name = "latitude")
     private Double latitude;
 
-//    @ApiModelProperty(value = "签到", name = "signIn")
-//    private Boolean signIn;
-
     @ApiModelProperty(value = "交通工具",name = "transportation")
     private String transportation;
 
     @ApiModelProperty(value = "交通工具", name = "transportationImg")
     private String transportationImg;
 
-/*    @ApiModelProperty(value = "车牌照片", name = "licensePlateImg")
-    private String licensePlateImg;*/
-
     @ApiModelProperty(value = "驾照照片",name = "driverLicenseImg")
     private String driverLicenseImg;
 
@@ -79,6 +73,9 @@ public class Rider extends BaseEntity {
     @JoinColumn(name = "userId", insertable = false, updatable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
     private User user;
 
+    @ApiModelProperty(value = "不通过原因", name = "failure")
+    private String failure;
+
 //    @ApiModelProperty(value = "准点率", name = "punctualityRate")
 //    private Double punctualityRate;
 

+ 10 - 2
src/main/java/com/izouma/dingdong/service/UserService.java

@@ -254,13 +254,21 @@ public class UserService {
     /*
     更新密码
      */
-    public String setPassword(Long userId, String key, String code, String password) {
+    public String setPassword(String key, String code, String password,Identity identity) {
         try {
             smsService.verify(key, code);
         } catch (SmsService.SmsVerifyException e) {
             e.printStackTrace();
             throw new BusinessException("验证码错误");
         }
-        return setPassword(userId, password);
+        key = key.substring(3);
+        User user = userRepo.findByPhoneAndIdentity(key, identity);
+        if (user==null){
+            throw new BusinessException("无用户");
+        }
+        user.setPassword(new BCryptPasswordEncoder().encode(password));
+        user = userRepo.save(user);
+        return jwtTokenUtil.generateToken(JwtUserFactory.create(user));
+
     }
 }

+ 1 - 0
src/main/java/com/izouma/dingdong/service/rider/RiderService.java

@@ -98,6 +98,7 @@ public class RiderService {
             }
         } else {
             rider.setStatus(ApplyStatus.DENY);
+            rider.setFailure(reason);
             riderRepo.save(rider);
             return reason;
         }

+ 3 - 2
src/main/java/com/izouma/dingdong/web/UserController.java

@@ -131,8 +131,9 @@ public class UserController extends BaseController {
 
     @PostMapping("/changePassword")
     @ApiOperation("修改密码")
-    public String changePassword(@RequestParam String password, @RequestParam String key, @RequestParam String code) {
-        return userService.setPassword(SecurityUtils.getAuthenticatedUser().getId(), key, code, password);
+    public String changePassword(@RequestParam String password, @RequestParam String key,
+                                 @RequestParam String code, @RequestParam Identity identity) {
+        return userService.setPassword(key, code, password, identity);
     }
 
 }