linzhijie
2021-04-12 3a8e1524dcf0eeb610d38123d5f0a3ef838379cd
src/main/java/com/ots/project/exam/controller/EnterpriseController.java
@@ -1,5 +1,4 @@
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;
@@ -23,30 +22,19 @@
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) {
@@ -61,16 +49,11 @@
        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
@@ -86,9 +69,6 @@
        return getDataTable(list);
    }
    /**
     * 新增用户信息扩展
     */
    @GetMapping("/add")
    public String add(ModelMap mmap) {
        User sysUser = ShiroUtils.getSysUser();
@@ -103,9 +83,6 @@
        return prefix + "/add";
    }
    /**
     * 修改用户信息扩展
     */
    @GetMapping("/edit/{userId}")
    public String edit(@PathVariable("userId") Long userId, ModelMap mmap) {
        SysUserExtend sysUserExtend = sysUserExtendService.selectSysUserExtendById(userId);
@@ -122,9 +99,6 @@
        return prefix + "/edit";
    }
    /**
     * 测试人数设置
     */
    @RequiresPermissions("exam:enterprise:editUserTimes")
    @GetMapping("/operUseTimes/{userId}")
    public String operUseTimes(@PathVariable("userId") Long userId, ModelMap mmap) {
@@ -142,15 +116,11 @@
            });
            systemScore = list.stream().mapToInt(p -> p.intValue()).sum();
        }
        mmap.put("totalNumberOfTesters", systemScore);
//      显示该企业可用测试人数,总测试人数
        return prefix + "/operUseTimes";
    }
    /**
     * 充值测试人数
     */
    @RequiresPermissions("exam:enterprise:editUserTimes")
    @Log(title = "充值测试人数", businessType = BusinessType.UPDATE)
    @PostMapping("/operUseTimes/edit/{userId}/{addNum}")
@@ -158,7 +128,16 @@
    public AjaxResult editSave(@PathVariable("userId") Long userId, @PathVariable("addNum") Long addNum) {
        return toAjax(sysUserExtendService.updateTestNum(userId, addNum));
    }
    @PostMapping("/checkUser")
    @ResponseBody
    public AjaxResult checkUser() {
        User sysUser = ShiroUtils.getSysUser();
        int result = 0;
        if ("02".equals(sysUser.getUserType())) {
            result = 1;
        }
        return toAjax(result);
    }
    @RequiresPermissions("exam:enterprise:remove")
    @PostMapping("/remove")
    @ResponseBody
@@ -166,7 +145,6 @@
        return toAjax(sysUserExtendService.deleteSysUserExtendByIds(ids));
    }
    // 免密登录
    @RequiresPermissions("exam:enterprise:freelogin")
    @PostMapping("/freelogin")
    @ResponseBody
@@ -185,7 +163,6 @@
            return error(msg);
        }
    }
    @PostMapping("/freeloginback")
    @ResponseBody
    public AjaxResult freeLoginBack(Long userId) {
@@ -204,7 +181,6 @@
        }
    }
//    @RequiresPermissions("exam:extend:resetpwd")
    @Log(title = "用户重置密码", businessType = BusinessType.UPDATE)
    @PostMapping("/resetpwd")
    @ResponseBody