package com.sqx.modules.app.controller.app;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sqx.common.utils.DateUtils;
import com.sqx.common.utils.Result;
import com.sqx.modules.app.annotation.Login;
import com.sqx.modules.app.entity.UserEntity;
import com.sqx.modules.app.entity.UserMoney;
import com.sqx.modules.app.entity.UserMoneyDetails;
import com.sqx.modules.app.response.HomeMessageResponse;
import com.sqx.modules.app.service.UserMoneyDetailsService;
import com.sqx.modules.app.service.UserMoneyService;
import com.sqx.modules.app.service.UserService;
import com.sqx.modules.common.service.CommonInfoService;
import com.sqx.modules.pay.service.PayDetailsService;
import com.sqx.modules.resumes.entity.Company;
import com.sqx.modules.resumes.entity.Resumes;
import com.sqx.modules.resumes.service.CompanyService;
import com.sqx.modules.resumes.service.ResumesService;
import com.sqx.modules.utils.SenInfoCheckUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.catalina.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * @author fang
 * @date 2020/7/30
 */
@RestController
@Api(value = "用户管理", tags = {"用户管理"})
@RequestMapping(value = "/app/user/")
public class AppUserController {
    @Autowired
    UserService userService;

    @Login
    @PostMapping("updateUserEntity")
    public Result updateUserEntity(@RequestAttribute("userId") Long userId, Integer userType) {
        UserEntity userEntity = new UserEntity();
        userEntity.setUserId(userId);
        userEntity.setUserType(userType);
        return userService.updateById(userEntity) ? Result.success() : Result.error();
    }
    @Login
    @GetMapping("userData")
    @ApiOperation("获取用户投递记录 浏览记录 收藏记录")
    public Result userData(@RequestAttribute("userId") Long userId){
        return Result.success().put("data", userService.userData(userId));
    }
}