|
|
@ -4,9 +4,7 @@ import com.community.pocket.entity.po.android.Token; |
|
|
|
import com.community.pocket.entity.vo.Result; |
|
|
|
import com.community.pocket.entity.vo.Result; |
|
|
|
import com.community.pocket.entity.vo.android.*; |
|
|
|
import com.community.pocket.entity.vo.android.*; |
|
|
|
import com.community.pocket.repository.EmailDao; |
|
|
|
import com.community.pocket.repository.EmailDao; |
|
|
|
import com.community.pocket.repository.android.TokenDao; |
|
|
|
import com.community.pocket.repository.android.*; |
|
|
|
import com.community.pocket.repository.android.UserDao; |
|
|
|
|
|
|
|
import com.community.pocket.repository.android.VisitorPeopleDao; |
|
|
|
|
|
|
|
import com.community.pocket.util.EmailService; |
|
|
|
import com.community.pocket.util.EmailService; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
@ -30,6 +28,9 @@ public class UserController { |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private EmailService emailService; |
|
|
|
private EmailService emailService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private TokenService tokenService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private TokenDao tokenDao; |
|
|
|
private TokenDao tokenDao; |
|
|
|
|
|
|
|
|
|
|
@ -111,8 +112,28 @@ public class UserController { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/uploadHeadImg") |
|
|
|
|
|
|
|
public InfoResponse upload(UserHeadImg userHeadImg) { |
|
|
|
|
|
|
|
return tokenService.checkToken(userHeadImg, new DoCheck<InfoResponse, UserHeadImg>() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public InfoResponse ok(UserHeadImg userHeadImg) { |
|
|
|
|
|
|
|
if (userDao.uploadImg(userHeadImg)) { |
|
|
|
|
|
|
|
return new InfoResponse(Result.OK, InfoResponse.Msg.ok); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return new InfoResponse(Result.FAIL, InfoResponse.Msg.fail); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public InfoResponse fail() { |
|
|
|
|
|
|
|
return new InfoResponse(Result.FAIL, InfoResponse.Msg.fail, InfoResponse.Msg.token); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 用户登录 |
|
|
|
* 用户登录 |
|
|
|
|
|
|
|
* |
|
|
|
* @param username 用户 |
|
|
|
* @param username 用户 |
|
|
|
* @param password 密码 |
|
|
|
* @param password 密码 |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -134,17 +155,21 @@ public class UserController { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/login/token") |
|
|
|
@PostMapping("/login/token") |
|
|
|
public LoginResponse check(String token){ |
|
|
|
public LoginResponse check(Token token) { |
|
|
|
if(tokenDao.checkToken(token)){ |
|
|
|
return tokenService.checkToken(token, new DoCheck<LoginResponse, Token>() { |
|
|
|
Token t=tokenDao.get(token); |
|
|
|
@Override |
|
|
|
if(t!=null){ |
|
|
|
public LoginResponse ok(Token token) { |
|
|
|
LoginResponse response= new LoginResponse(Result.OK, LoginResponse.Msg.ok,t.getUsername()); |
|
|
|
LoginResponse response = new LoginResponse(Result.OK, LoginResponse.Msg.ok, token.getUsername()); |
|
|
|
response.setToken(t); |
|
|
|
response.setToken(token); |
|
|
|
return response; |
|
|
|
return response; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public LoginResponse fail() { |
|
|
|
return new LoginResponse(Result.FAIL, LoginResponse.Msg.fail); |
|
|
|
return new LoginResponse(Result.FAIL, LoginResponse.Msg.fail); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//检索投诉人
|
|
|
|
//检索投诉人
|
|
|
|
@GetMapping("/query/user") |
|
|
|
@GetMapping("/query/user") |
|
|
@ -163,7 +188,9 @@ public class UserController { |
|
|
|
//修改密码
|
|
|
|
//修改密码
|
|
|
|
@PostMapping("/my/info/modifyPwd") |
|
|
|
@PostMapping("/my/info/modifyPwd") |
|
|
|
public InfoResponse modifyPwd(ModifyPwdForm modifyPwdForm) { |
|
|
|
public InfoResponse modifyPwd(ModifyPwdForm modifyPwdForm) { |
|
|
|
if(tokenDao.checkToken(modifyPwdForm.getToken())){ |
|
|
|
return tokenService.checkToken(modifyPwdForm, new DoCheck<InfoResponse, ModifyPwdForm>() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public InfoResponse ok(ModifyPwdForm modifyPwdForm) { |
|
|
|
if (userDao.login(modifyPwdForm.getUsername(), modifyPwdForm.getOldPassword())) { |
|
|
|
if (userDao.login(modifyPwdForm.getUsername(), modifyPwdForm.getOldPassword())) { |
|
|
|
if (userDao.modifyPwd(modifyPwdForm)) { |
|
|
|
if (userDao.modifyPwd(modifyPwdForm)) { |
|
|
|
return new InfoResponse(Result.OK, InfoResponse.Msg.modify_pwd_ok); |
|
|
|
return new InfoResponse(Result.OK, InfoResponse.Msg.modify_pwd_ok); |
|
|
@ -173,9 +200,13 @@ public class UserController { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return new InfoResponse(Result.FAIL, InfoResponse.Msg.modify_oldpwd_fail); |
|
|
|
return new InfoResponse(Result.FAIL, InfoResponse.Msg.modify_oldpwd_fail); |
|
|
|
} |
|
|
|
} |
|
|
|
}else { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public InfoResponse fail() { |
|
|
|
return new InfoResponse(Result.FAIL, InfoResponse.Msg.token); |
|
|
|
return new InfoResponse(Result.FAIL, InfoResponse.Msg.token); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|