xiaoyong931011
2021-06-30 65f0f3bf2fbadc5940d5cb339dd3c72a9d51afe6
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
package com.xzx.gc.user.controller;
 
import com.xzx.gc.common.Result;
import com.xzx.gc.common.constant.Constants;
import com.xzx.gc.common.dto.CommonDto;
import com.xzx.gc.common.dto.log.OperationAppLog;
import com.xzx.gc.common.request.BaseController;
import com.xzx.gc.common.utils.MqUtil;
import com.xzx.gc.entity.UserHomePage;
import com.xzx.gc.user.service.UserHomePageService;
import com.xzx.gc.user.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
 
import javax.servlet.http.HttpServletRequest;
 
@RestController
@Validated
@Slf4j
@Api(tags = "首页配置管理")
public class UserHomePageController extends BaseController {
 
    @Autowired
    private UserHomePageService userHomePageService;
 
 
    @Autowired
    private UserService userService;
 
    @Autowired
    private MqUtil mqUtil;
 
 
 
 
    @ApiOperation(value = "查询用户首页绑定信息")
    @PostMapping("/userHomePage/find")
    public Result<UserHomePage> find(HttpServletRequest request) {
        UserHomePage byUserId = userHomePageService.findByUserId(getUserId(request));
        return Result.success(byUserId);
    }
 
    @ApiOperation(value = "用户首页绑定",notes = "extra传权限项的authCode码")
    @PostMapping("/userHomePage/bind")
    public Result bind(HttpServletRequest request, @RequestBody CommonDto commonDto) {
        userHomePageService.bind(getUserId(request),commonDto.getExtra());
 
        String mobilePhone = userService.findOtherByUserId(getUserId(request),0);
        OperationAppLog build = OperationAppLog.builder().appPrograme(getFrontClient(request)).opreateName(mobilePhone)
                .methodName(Constants.USER_MODUL_NAME).operateAction("用户首页绑定-"+getUserId(request)).build();
        mqUtil.sendApp(build);
 
 
        return Result.success();
    }
}