登录
This commit is contained in:
@ -0,0 +1,96 @@
|
||||
package com.ruoyi.web.controller.bgt;
|
||||
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.model.BgtLoginBody;
|
||||
import com.ruoyi.framework.web.service.BgtLoginService;
|
||||
import com.ruoyi.framework.web.service.SysPermissionService;
|
||||
import com.ruoyi.framework.web.service.TokenService;
|
||||
import com.ruoyi.system.service.ISysMenuService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 登录验证
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
public class BgtLoginController
|
||||
{
|
||||
@Autowired
|
||||
private BgtLoginService loginService;
|
||||
|
||||
@Autowired
|
||||
private ISysMenuService menuService;
|
||||
|
||||
@Autowired
|
||||
private SysPermissionService permissionService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
/**
|
||||
* 登录方法
|
||||
*
|
||||
* @param loginBody 登录信息
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/bgt/login")
|
||||
public AjaxResult login(@RequestBody BgtLoginBody loginBody)
|
||||
{
|
||||
Map<String,Object> ajax = new HashMap<>();
|
||||
// 生成令牌
|
||||
String token = loginService.login(loginBody.getPhone(), loginBody.getPassword(), loginBody.getCode(),
|
||||
loginBody.getUuid());
|
||||
ajax.put(Constants.TOKEN, token);
|
||||
return AjaxResult.success(ajax);
|
||||
}
|
||||
|
||||
@GetMapping("/test")
|
||||
public AjaxResult test(){
|
||||
return AjaxResult.success("test");
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 获取用户信息
|
||||
// *
|
||||
// * @return 用户信息
|
||||
// */
|
||||
// @GetMapping("getInfo")
|
||||
// public AjaxResult getInfo()
|
||||
// {
|
||||
// LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
// SysUser user = loginUser.getUser();
|
||||
// // 角色集合
|
||||
// Set<String> roles = permissionService.getRolePermission(user);
|
||||
// // 权限集合
|
||||
// Set<String> permissions = permissionService.getMenuPermission(user);
|
||||
// Map<String,Object> ajax = new HashMap<>();
|
||||
// ajax.put("user", user);
|
||||
// ajax.put("roles", roles);
|
||||
// ajax.put("permissions", permissions);
|
||||
// return AjaxResult.success(ajax);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 获取路由信息
|
||||
// *
|
||||
// * @return 路由信息
|
||||
// */
|
||||
// @GetMapping("getRouters")
|
||||
// public AjaxResult getRouters()
|
||||
// {
|
||||
// LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
// // 用户信息
|
||||
// SysUser user = loginUser.getUser();
|
||||
// List<SysMenu> menus = menuService.selectMenuTreeByUserId(user.getUserId());
|
||||
// return AjaxResult.success(menuService.buildMenus(menus));
|
||||
// }
|
||||
}
|
@ -0,0 +1,121 @@
|
||||
package com.ruoyi.web.controller.bgt;
|
||||
|
||||
import com.ruoyi.bgt.bo.BgtUserQueryBo;
|
||||
import com.ruoyi.bgt.domain.dto.UserRealNameAuthenticationDTO;
|
||||
import com.ruoyi.bgt.service.IBgtUserService;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.BgtUser;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* APP包工头Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-02-14
|
||||
*/
|
||||
@Api(value = "APP包工头控制器", tags = {"APP包工头管理"})
|
||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||
@RestController
|
||||
@RequestMapping("/bgt/user")
|
||||
public class BgtUserController extends BaseController {
|
||||
|
||||
private final IBgtUserService iBgtUserService;
|
||||
|
||||
/**
|
||||
* 查询APP包工头列表
|
||||
*/
|
||||
@ApiOperation("查询APP包工头列表")
|
||||
@PreAuthorize("@ss.hasPermi('bgt:user:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<BgtUser> list(@Validated BgtUserQueryBo bo) {
|
||||
return iBgtUserService.queryPageList(bo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出APP包工头列表
|
||||
*/
|
||||
@ApiOperation("导出APP包工头列表")
|
||||
@PreAuthorize("@ss.hasPermi('bgt:user:export')")
|
||||
@Log(title = "APP包工头", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult<BgtUser> export(@Validated BgtUserQueryBo bo) {
|
||||
List<BgtUser> list = iBgtUserService.queryList(bo);
|
||||
ExcelUtil<BgtUser> util = new ExcelUtil<BgtUser>(BgtUser.class);
|
||||
return util.exportExcel(list, "APP包工头");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取APP包工头详细信息
|
||||
*/
|
||||
@ApiOperation("获取APP包工头详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('bgt:user:query')")
|
||||
@GetMapping("/{id}")
|
||||
public AjaxResult<BgtUser> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("id") String id) {
|
||||
return AjaxResult.success(iBgtUserService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增APP包工头
|
||||
*/
|
||||
@ApiOperation("新增APP包工头")
|
||||
@PreAuthorize("@ss.hasPermi('bgt:user:add')")
|
||||
@Log(title = "APP包工头", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit
|
||||
@PostMapping()
|
||||
public AjaxResult<Void> add(@Validated @RequestBody BgtUser bo) {
|
||||
return toAjax(iBgtUserService.insert(bo) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改APP包工头
|
||||
*/
|
||||
@ApiOperation("修改APP包工头")
|
||||
@PreAuthorize("@ss.hasPermi('bgt:user:edit')")
|
||||
@Log(title = "APP包工头", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit
|
||||
@PutMapping()
|
||||
public AjaxResult<Void> edit(@Validated @RequestBody BgtUser bo) {
|
||||
return toAjax(iBgtUserService.update(bo) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除APP包工头
|
||||
*/
|
||||
@ApiOperation("删除APP包工头")
|
||||
@PreAuthorize("@ss.hasPermi('bgt:user:remove')")
|
||||
@Log(title = "APP包工头" , businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable String[] ids) {
|
||||
return toAjax(iBgtUserService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 实名认证
|
||||
*/
|
||||
@ApiOperation("实名认证")
|
||||
@Log(title = "APP包工头", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit
|
||||
@PutMapping("/realNameAuthentication")
|
||||
public AjaxResult<Void> realNameAuthentication(@Validated @RequestBody UserRealNameAuthenticationDTO dto) {
|
||||
return toAjax(iBgtUserService.realNameAuthentication(dto));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user