|
|
@@ -39,21 +39,30 @@ public class KeycloakController {
|
|
|
if(StringUtils.isEmpty(subscribe.getUserId())){
|
|
|
return Response.buildFailure("404","userId不能为空!");
|
|
|
}
|
|
|
- keycloakService.updateAttribute(subscribe.getUserId(), "wechat" , subscribe.getOppenId());
|
|
|
+ keycloakService.updateAttribute(subscribe.getUserId(), "wechat", subscribe.getOppenId());
|
|
|
return Response.buildSuccess();
|
|
|
}
|
|
|
|
|
|
@GetMapping("query/ticket/{userId}")
|
|
|
- public SingleResponse getTicket(@PathVariable("userId") String userId ,
|
|
|
- @RequestHeader("Authorization") String authorization){
|
|
|
- return SingleResponse.of(iWeChatService.queryTicket(appKey , userId, authorization));
|
|
|
+ public SingleResponse getTicket(@PathVariable("userId") String userId,
|
|
|
+ @RequestHeader("Authorization") String authorization) {
|
|
|
+ return SingleResponse.of(iWeChatService.queryTicket(appKey, userId, authorization));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PutMapping("changePassword")
|
|
|
+ public Response changePassword(@RequestHeader("userId") String userId, String newPassword) {
|
|
|
+ if (StringUtils.isEmpty(userId)) {
|
|
|
+ return Response.buildFailure("400", "密码不能为空");
|
|
|
+ }
|
|
|
+ keycloakService.changePassword(userId, newPassword);
|
|
|
+ return Response.buildSuccess();
|
|
|
}
|
|
|
|
|
|
@Scheduled(cron = "0/10 * * * * ?")
|
|
|
- public void askUserOppenId(){
|
|
|
- for(String userId : keycloakService.getUsersMap().keySet()){
|
|
|
+ public void askUserOppenId() {
|
|
|
+ for (String userId : keycloakService.getUsersMap().keySet()) {
|
|
|
String oppenId = iWeChatService.askUser(userId);
|
|
|
- if(!StringUtils.isEmpty(oppenId)){
|
|
|
+ if (!StringUtils.isEmpty(oppenId)) {
|
|
|
SubscribeDto dto = new SubscribeDto();
|
|
|
dto.setUserId(userId);
|
|
|
dto.setOppenId(oppenId);
|