goupan
2024-04-03 5506e9a45e717ffcb67ec313b5a4e8206d9b3a39
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package cn.stylefeng.roses.kernel.customer.modular.controller;
 
import cn.stylefeng.roses.kernel.customer.api.pojo.CustomerInfoChangeAvatarPasswordRequest;
import cn.stylefeng.roses.kernel.customer.modular.service.CustomerService;
import cn.stylefeng.roses.kernel.rule.annotation.BusinessLog;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
 
import javax.annotation.Resource;
 
/**
 * C端用户个人信息修改
 *
 * @author fengshuonan
 * @date 2021/6/18 16:28
 */
@Api(tags = "C端用户")
@RestController
@ApiResource(name = "C端用户个人信息修改")
public class CustomerInfoController {
 
    @Resource
    private CustomerService customerService;
 
    /**
     * 修改个人密码
     *
     * @author fengshuonan
     * @date 2021/6/18 16:29
     */
    @ApiOperation("修改个人密码")
    @PostResource(name = "修改个人密码", path = "/customerInfo/updatePassword", requiredPermission = false)
    @BusinessLog
    public ResponseData<?> updatePassword(@RequestBody @Validated(CustomerInfoChangeAvatarPasswordRequest.changePassword.class) CustomerInfoChangeAvatarPasswordRequest req) {
        this.customerService.updatePassword(req);
        return new SuccessResponseData<>();
    }
 
    /**
     * 修改个人头像
     *
     * @author fengshuonan
     * @date 2021/6/18 16:29
     */
    @PostResource(name = "修改个人头像", path = "/customerInfo/updateAvatar", requiredPermission = false)
    @BusinessLog
    public ResponseData<?> updateAvatar(@RequestBody @Validated(CustomerInfoChangeAvatarPasswordRequest.changeAvatar.class) CustomerInfoChangeAvatarPasswordRequest customerInfoRequest) {
        this.customerService.updateAvatar(customerInfoRequest);
        return new SuccessResponseData<>();
    }
 
    /**
     * 重置个人秘钥
     *
     * @author fengshuonan
     * @date 2021/7/20 10:44
     */
    @PostResource(name = "重置个人秘钥", path = "/customerInfo/resetPersonalSecret", requiredPermission = false)
    @BusinessLog
    public ResponseData<String> resetPersonalSecret() {
        String secret = customerService.updateSecret();
        return new SuccessResponseData<>(secret);
    }
 
}