|
@@ -11,9 +11,10 @@ import com.example.civilizedcity.common.StringUtils;
|
11
|
11
|
import com.example.civilizedcity.config.WxMaUitl;
|
12
|
12
|
import com.example.civilizedcity.entity.SysUser;
|
13
|
13
|
import com.example.civilizedcity.entity.TaPerson;
|
14
|
|
-import com.example.civilizedcity.entity.TaPersonReflect;
|
|
14
|
+import com.example.civilizedcity.service.SysLoginService;
|
15
|
15
|
import com.example.civilizedcity.service.SysUserDutyService;
|
16
|
16
|
import com.example.civilizedcity.service.TaPersonReflectService;
|
|
17
|
+import com.example.civilizedcity.vo.WxChangePwd;
|
17
|
18
|
import com.example.civilizedcity.vo.LoginParam;
|
18
|
19
|
import io.swagger.annotations.Api;
|
19
|
20
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -40,6 +41,9 @@ public class WxMaController extends BaseController {
|
40
|
41
|
@Autowired
|
41
|
42
|
SysUserDutyService sysUserDutyService;
|
42
|
43
|
|
|
44
|
+ @Autowired
|
|
45
|
+ SysLoginService sysLoginService;
|
|
46
|
+
|
43
|
47
|
|
44
|
48
|
// private boolean checkLoginParam(LoginParam loginParam) {
|
45
|
49
|
// return !StringUtils.isEmpty(loginParam.getCode())
|
|
@@ -184,4 +188,27 @@ public class WxMaController extends BaseController {
|
184
|
188
|
return ResponseBean.success(taPerson);
|
185
|
189
|
}
|
186
|
190
|
|
|
191
|
+ @PostMapping("/change-password")
|
|
192
|
+ @ApiOperation(value="修改密码", notes = "修改密码", httpMethod = "POST", response = ResponseBean.class)
|
|
193
|
+ public ResponseBean changePassword(@ApiParam("修改密码") @RequestBody WxChangePwd wxChangePwd) throws Exception {
|
|
194
|
+
|
|
195
|
+ if (StringUtils.isEmpty(wxChangePwd.getPhone())
|
|
196
|
+ || StringUtils.isEmpty(wxChangePwd.getCaptcha())
|
|
197
|
+ || StringUtils.isEmpty(wxChangePwd.getPassword())
|
|
198
|
+ ) {
|
|
199
|
+ return ResponseBean.error("修改密码参数部分为空");
|
|
200
|
+ }
|
|
201
|
+
|
|
202
|
+ // TODO 校验验证码
|
|
203
|
+
|
|
204
|
+ SysUser user = sysUserService.getExistBy("phone", wxChangePwd.getPhone(), false, true);
|
|
205
|
+ if (null == user) {
|
|
206
|
+ return ResponseBean.error("当前手机号不存在");
|
|
207
|
+ }
|
|
208
|
+
|
|
209
|
+ sysLoginService.changePassword(user, wxChangePwd);
|
|
210
|
+
|
|
211
|
+ return ResponseBean.success("success");
|
|
212
|
+ }
|
|
213
|
+
|
187
|
214
|
}
|