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();
|
}
|
}
|