Search in sources :

Example 6 with BussinessException

use of com.ikoori.vip.common.exception.BussinessException 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 BussinessException

use of com.ikoori.vip.common.exception.BussinessException 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 BussinessException

use of com.ikoori.vip.common.exception.BussinessException in project vip by guangdada.

the class WebOrderController method pay.

@ApiOperation("会员优惠券、积分结算接口")
@RequestMapping(value = "pay", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> pay(@ApiParam(value = "店铺编号", required = true) @RequestParam(required = true) String storeNo, @ApiParam(value = "手机号", required = true) @RequestParam(required = true) String mobile, @ApiParam(value = "订单号", required = true) @RequestParam(required = true) String orderNo, @ApiParam(value = "订单总额", required = true) @RequestParam(required = true) String balanceDue, @ApiParam(value = "支付金额", required = true) @RequestParam(required = true) String payment, @ApiParam(value = "使用积分", required = true) @RequestParam(required = true) String point, @ApiParam(value = "优惠金额", required = true) @RequestParam(required = true) String discount, @ApiParam(value = "优惠券明细", required = true) @RequestParam(required = true) String coupons, @ApiParam(value = "订单明细", required = true) @RequestParam(required = true) String orderItems, @ApiParam(value = "签名", required = true) @RequestParam(required = true) String sign) {
    Map<String, Object> result = new HashMap<String, Object>();
    result.put("code", "200");
    result.put("msg", "请求成功");
    try {
        log.info(">>>>>>>>>>>>>>>>>>>>>>>会员优惠券、积分结算接口>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
        boolean isSign = true;
        if (gunsProperties.isCheckSign()) {
            Map<String, String> data = new HashMap<String, String>();
            data.put("storeNo", storeNo);
            data.put("mobile", mobile);
            data.put("mobile", orderNo);
            data.put("balanceDue", balanceDue);
            data.put("payment", payment);
            data.put("point", point);
            data.put("discount", discount);
            data.put("coupons", coupons);
            data.put("orderItems", orderItems);
            data.put("sign", sign);
            log.info("请求参数:" + data.toString());
            isSign = WXPayUtil.isSignatureValid(data, gunsProperties.getSignKey());
            if (!isSign) {
                log.info("签名失败");
                result.put("code", "500");
                result.put("msg", "签名失败");
            }
        }
        if (isSign) {
            OrderPayDo orderPayDo = new OrderPayDo();
            orderPayDo.setStoreNo(storeNo);
            orderPayDo.setMobile(mobile);
            orderPayDo.setOrderNo(orderNo);
            orderPayDo.setBalanceDue(Integer.valueOf(balanceDue));
            orderPayDo.setPayment(Integer.valueOf(payment));
            orderPayDo.setDiscount(Integer.valueOf(discount));
            orderPayDo.setPoint(Integer.valueOf(point));
            orderPayDo.setCoupons(JSONArray.parseArray(coupons, CouponPayDo.class));
            orderPayDo.setOrderItems(JSONArray.parseArray(orderItems, OrderItemPayDo.class));
            orderPayDo.setOrderSource(OrderSource.offline.getCode());
            orderService.saveOrder(orderPayDo);
        }
    } catch (BussinessException e) {
        log.error("", e);
        result.put("code", e.getCode());
        result.put("msg", e.getMessage());
    } catch (Exception e) {
        log.error("", e);
        result.put("code", "500");
        result.put("msg", "请求失败");
    }
    log.info("<<<<<<<<<<<<<<<<<<<<<<<<<<<<会员优惠券、积分结算接口<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
    return result;
}
Also used : HashMap(java.util.HashMap) CouponPayDo(com.ikoori.vip.common.dto.CouponPayDo) OrderItemPayDo(com.ikoori.vip.common.dto.OrderItemPayDo) OrderPayDo(com.ikoori.vip.common.dto.OrderPayDo) BussinessException(com.ikoori.vip.common.exception.BussinessException) BussinessException(com.ikoori.vip.common.exception.BussinessException) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 9 with BussinessException

use of com.ikoori.vip.common.exception.BussinessException in project vip by guangdada.

the class NoticeController method update.

/**
 * 修改通知
 */
@RequestMapping(value = "/update")
@ResponseBody
@BussinessLog(value = "修改通知", key = "title", dict = Dict.NoticeMap)
public Object update(Notice notice) {
    if (ToolUtil.isOneEmpty(notice, notice.getId(), notice.getTitle(), notice.getContent())) {
        throw new BussinessException(BizExceptionEnum.REQUEST_NULL);
    }
    Notice old = this.noticeMapper.selectById(notice.getId());
    old.setTitle(notice.getTitle());
    old.setContent(notice.getContent());
    old.updateById();
    return super.SUCCESS_TIP;
}
Also used : Notice(com.ikoori.vip.common.persistence.model.Notice) BussinessException(com.ikoori.vip.common.exception.BussinessException) BussinessLog(com.ikoori.vip.common.annotion.log.BussinessLog) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 10 with BussinessException

use of com.ikoori.vip.common.exception.BussinessException in project vip by guangdada.

the class NoticeController method add.

/**
 * 新增通知
 */
@RequestMapping(value = "/add")
@ResponseBody
@BussinessLog(value = "新增通知", key = "title", dict = Dict.NoticeMap)
public Object add(Notice notice) {
    if (ToolUtil.isOneEmpty(notice, notice.getTitle(), notice.getContent())) {
        throw new BussinessException(BizExceptionEnum.REQUEST_NULL);
    }
    notice.setCreater(ShiroKit.getUser().getId());
    notice.setCreatetime(new Date());
    notice.insert();
    return super.SUCCESS_TIP;
}
Also used : BussinessException(com.ikoori.vip.common.exception.BussinessException) Date(java.util.Date) BussinessLog(com.ikoori.vip.common.annotion.log.BussinessLog) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

BussinessException (com.ikoori.vip.common.exception.BussinessException)41 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)25 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)19 Permission (com.ikoori.vip.common.annotion.Permission)17 Transactional (org.springframework.transaction.annotation.Transactional)9 User (com.ikoori.vip.common.persistence.model.User)8 Merchant (com.ikoori.vip.common.persistence.model.Merchant)7 Date (java.util.Date)7 Coupon (com.ikoori.vip.common.persistence.model.Coupon)6 ShiroUser (com.ikoori.vip.server.core.shiro.ShiroUser)6 BussinessLog (com.ikoori.vip.common.annotion.log.BussinessLog)5 File (java.io.File)4 HashMap (java.util.HashMap)4 EntityWrapper (com.baomidou.mybatisplus.mapper.EntityWrapper)3 OrderItemPayDo (com.ikoori.vip.common.dto.OrderItemPayDo)3 Card (com.ikoori.vip.common.persistence.model.Card)3 Member (com.ikoori.vip.common.persistence.model.Member)3 Menu (com.ikoori.vip.common.persistence.model.Menu)3 StoreCoupon (com.ikoori.vip.common.persistence.model.StoreCoupon)3 ApiOperation (io.swagger.annotations.ApiOperation)3