Search in sources :

Example 6 with Permission

use of com.ikoori.vip.common.annotion.Permission in project vip by guangdada.

the class UserMgrController method add.

/**
 * 添加管理员
 */
@RequestMapping("/add")
@BussinessLog(value = "添加管理员", key = "account", dict = Dict.UserDict)
@Permission(Const.ADMIN_NAME)
@ResponseBody
public Tip add(@Valid UserDto user, BindingResult result) {
    if (result.hasErrors()) {
        throw new BussinessException(BizExceptionEnum.REQUEST_NULL);
    }
    // 判断账号是否重复
    User theUser = managerDao.getByAccount(user.getAccount());
    if (theUser != null) {
        throw new BussinessException(BizExceptionEnum.USER_ALREADY_REG);
    }
    // 完善账号信息
    user.setSalt(ShiroKit.getRandomSalt(5));
    user.setPassword(ShiroKit.md5(user.getPassword(), user.getSalt()));
    user.setStatus(ManagerStatus.OK.getCode());
    user.setCreatetime(new Date());
    this.userMapper.insert(UserFactory.createUser(user));
    return SUCCESS_TIP;
}
Also used : ShiroUser(com.ikoori.vip.server.core.shiro.ShiroUser) User(com.ikoori.vip.common.persistence.model.User) BussinessException(com.ikoori.vip.common.exception.BussinessException) Date(java.util.Date) Permission(com.ikoori.vip.common.annotion.Permission) BussinessLog(com.ikoori.vip.common.annotion.log.BussinessLog) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 7 with Permission

use of com.ikoori.vip.common.annotion.Permission in project vip by guangdada.

the class UserMgrController method userEdit.

/**
 * 跳转到编辑管理员页面
 */
@Permission
@RequestMapping("/user_edit/{userId}")
public String userEdit(@PathVariable Integer userId, Model model) {
    if (ToolUtil.isEmpty(userId)) {
        throw new BussinessException(BizExceptionEnum.REQUEST_NULL);
    }
    User user = this.userMapper.selectById(userId);
    model.addAttribute(user);
    model.addAttribute("roleName", ConstantFactory.me().getRoleName(user.getRoleid()));
    model.addAttribute("deptName", ConstantFactory.me().getDeptName(user.getDeptid()));
    LogObjectHolder.me().set(user);
    return PREFIX + "user_edit.html";
}
Also used : ShiroUser(com.ikoori.vip.server.core.shiro.ShiroUser) User(com.ikoori.vip.common.persistence.model.User) BussinessException(com.ikoori.vip.common.exception.BussinessException) Permission(com.ikoori.vip.common.annotion.Permission) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 8 with Permission

use of com.ikoori.vip.common.annotion.Permission in project vip by guangdada.

the class CodeController method add.

/**
 * 代码生成
 */
@ApiOperation("生成代码")
@RequestMapping(value = "/generate", method = RequestMethod.POST)
@ResponseBody
@Permission(Const.ADMIN_NAME)
public Object add(@ApiParam(value = "模块名称", required = true) @RequestParam String moduleName, @RequestParam String bizChName, @RequestParam String bizEnName, @RequestParam String path) {
    if (ToolUtil.isOneEmpty(bizChName, bizEnName)) {
        throw new BussinessException(BizExceptionEnum.REQUEST_NULL);
    }
    ContextConfig contextConfig = new ContextConfig();
    contextConfig.setBizChName(bizChName);
    contextConfig.setBizEnName(bizEnName);
    contextConfig.setModuleName(moduleName);
    if (ToolUtil.isNotEmpty(path)) {
        contextConfig.setProjectPath(path);
    }
    GunsTemplateEngine gunsTemplateEngine = new SimpleTemplateEngine();
    gunsTemplateEngine.setContextConfig(contextConfig);
    gunsTemplateEngine.start();
    return super.SUCCESS_TIP;
}
Also used : ContextConfig(com.ikoori.vip.server.core.template.config.ContextConfig) GunsTemplateEngine(com.ikoori.vip.server.core.template.engine.base.GunsTemplateEngine) BussinessException(com.ikoori.vip.common.exception.BussinessException) SimpleTemplateEngine(com.ikoori.vip.server.core.template.engine.SimpleTemplateEngine) ApiOperation(io.swagger.annotations.ApiOperation) Permission(com.ikoori.vip.common.annotion.Permission) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 9 with Permission

use of com.ikoori.vip.common.annotion.Permission in project vip by guangdada.

the class DeptController method deptUpdate.

/**
 * 跳转到修改部门
 */
@Permission
@RequestMapping("/dept_update/{deptId}")
public String deptUpdate(@PathVariable Integer deptId, Model model) {
    Dept dept = deptMapper.selectById(deptId);
    model.addAttribute(dept);
    model.addAttribute("pName", ConstantFactory.me().getDeptName(dept.getPid()));
    LogObjectHolder.me().set(dept);
    return PREFIX + "dept_edit.html";
}
Also used : Dept(com.ikoori.vip.common.persistence.model.Dept) Permission(com.ikoori.vip.common.annotion.Permission) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 10 with Permission

use of com.ikoori.vip.common.annotion.Permission in project vip by guangdada.

the class RedpackLogController method index.

/**
 * 跳转到红包记录首页
 */
@RequestMapping("")
@Permission
public String index(Model model) {
    Long userId = Long.valueOf(ShiroKit.getUser().getId());
    Merchant merchant = merchantService.getMerchantUserId(userId);
    List<Redpack> redpacks = redpackService.selectByMerchantId(merchant.getId());
    model.addAttribute("sendStatus", RedPackSendStatus.values());
    model.addAttribute("redpacks", redpacks);
    return PREFIX + "redpackLog.html";
}
Also used : Merchant(com.ikoori.vip.common.persistence.model.Merchant) Redpack(com.ikoori.vip.common.persistence.model.Redpack) Permission(com.ikoori.vip.common.annotion.Permission) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

Permission (com.ikoori.vip.common.annotion.Permission)93 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)92 Merchant (com.ikoori.vip.common.persistence.model.Merchant)55 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)47 HashMap (java.util.HashMap)31 Map (java.util.Map)23 BussinessException (com.ikoori.vip.common.exception.BussinessException)18 Store (com.ikoori.vip.common.persistence.model.Store)12 Coupon (com.ikoori.vip.common.persistence.model.Coupon)11 Card (com.ikoori.vip.common.persistence.model.Card)9 MemberCard (com.ikoori.vip.common.persistence.model.MemberCard)6 StoreCoupon (com.ikoori.vip.common.persistence.model.StoreCoupon)6 User (com.ikoori.vip.common.persistence.model.User)6 ShiroUser (com.ikoori.vip.server.core.shiro.ShiroUser)4 LinkedHashMap (java.util.LinkedHashMap)4 BussinessLog (com.ikoori.vip.common.annotion.log.BussinessLog)3 OperationLog (com.ikoori.vip.common.persistence.model.OperationLog)3 WxConfig (com.ikoori.vip.common.persistence.model.WxConfig)3 LogWarpper (com.ikoori.vip.server.modular.system.warpper.LogWarpper)3 EntityWrapper (com.baomidou.mybatisplus.mapper.EntityWrapper)2