| | |
| | | package com.ots.project.exam.controller; |
| | | |
| | | import com.ots.common.utils.StringUtils; |
| | | import com.ots.common.utils.security.ShiroUtils; |
| | | import com.ots.framework.aspectj.lang.annotation.Log; |
| | |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.ModelMap; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * @Created with IntelliJ IDEA. |
| | | * @User: liguosheng |
| | | * @Date: 2019/11/22 |
| | | * @Time: 10:40 |
| | | * @description: 企业用户 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/exam/enterprise") |
| | | public class EnterpriseController extends BaseController { |
| | | |
| | | private String prefix = "exam/enterprise"; |
| | | @Autowired |
| | | private ISysUserExtendService sysUserExtendService; |
| | | |
| | | @Autowired |
| | | private CountCalculateService calculate; |
| | | |
| | | @RequiresPermissions("exam:enterprise:view") |
| | | @GetMapping() |
| | | public String enterprise(String parentUserId, String userName, ModelMap mmap) { |
| | |
| | | if (Objects.nonNull(userName)) { |
| | | mmap.put("userNameSend", userName); |
| | | } |
| | | |
| | | List<SysUserExtend> list = sysUserExtendService.selectSysUserExtendList(sysUserExtend); |
| | | |
| | | mmap.put("us", list); |
| | | return prefix + "/enterprise"; |
| | | } |
| | | |
| | | /** |
| | | * 查询用户信息扩展列表 |
| | | */ |
| | | @RequiresPermissions("exam:enterprise:list") |
| | | @PostMapping("/list") |
| | | @ResponseBody |
| | |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * 新增用户信息扩展 |
| | | */ |
| | | @GetMapping("/add") |
| | | public String add(ModelMap mmap) { |
| | | User sysUser = ShiroUtils.getSysUser(); |
| | |
| | | return prefix + "/add"; |
| | | } |
| | | |
| | | /** |
| | | * 修改用户信息扩展 |
| | | */ |
| | | @GetMapping("/edit/{userId}") |
| | | public String edit(@PathVariable("userId") Long userId, ModelMap mmap) { |
| | | SysUserExtend sysUserExtend = sysUserExtendService.selectSysUserExtendById(userId); |
| | |
| | | return prefix + "/edit"; |
| | | } |
| | | |
| | | /** |
| | | * 测试人数设置 |
| | | */ |
| | | @RequiresPermissions("exam:enterprise:editUserTimes") |
| | | @GetMapping("/operUseTimes/{userId}") |
| | | public String operUseTimes(@PathVariable("userId") Long userId, ModelMap mmap) { |
| | |
| | | }); |
| | | systemScore = list.stream().mapToInt(p -> p.intValue()).sum(); |
| | | } |
| | | mmap.put("totalNumberOfTesters", systemScore); |
| | | |
| | | mmap.put("totalNumberOfTesters", systemScore); |
| | | // 显示该企业可用测试人数,总测试人数 |
| | | return prefix + "/operUseTimes"; |
| | | } |
| | | |
| | | /** |
| | | * 充值测试人数 |
| | | */ |
| | | @RequiresPermissions("exam:enterprise:editUserTimes") |
| | | @Log(title = "充值测试人数", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/operUseTimes/edit/{userId}/{addNum}") |
| | |
| | | public AjaxResult editSave(@PathVariable("userId") Long userId, @PathVariable("addNum") Long addNum) { |
| | | return toAjax(sysUserExtendService.updateTestNum(userId, addNum)); |
| | | } |
| | | |
| | | @RequiresPermissions("exam:enterprise:remove") |
| | | @PostMapping("/remove") |
| | | @ResponseBody |
| | |
| | | return toAjax(sysUserExtendService.deleteSysUserExtendByIds(ids)); |
| | | } |
| | | |
| | | // 免密登录 |
| | | @RequiresPermissions("exam:enterprise:freelogin") |
| | | @PostMapping("/freelogin") |
| | | @ResponseBody |
| | |
| | | return error(msg); |
| | | } |
| | | } |
| | | |
| | | @PostMapping("/freeloginback") |
| | | @ResponseBody |
| | | public AjaxResult freeLoginBack(Long userId) { |
| | |
| | | } |
| | | } |
| | | |
| | | // @RequiresPermissions("exam:extend:resetpwd") |
| | | @Log(title = "用户重置密码", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/resetpwd") |
| | | @ResponseBody |