Search in sources :

Example 21 with Permission

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

the class CardController method list.

/**
 * 获取会员卡列表
 */
@RequestMapping(value = "/list")
@Permission
@ResponseBody
public Object list(String condition) {
    Long userId = Long.valueOf(ShiroKit.getUser().getId());
    Merchant merchant = merchantService.getMerchantUserId(userId);
    Page<Card> page = new PageFactory<Card>().defaultPage();
    List<Map<String, Object>> result = cardService.getCardList(page, condition, page.getOrderByField(), page.isAsc(), merchant.getId());
    page.setRecords((List<Card>) new CardWarpper(result).warp());
    return super.packForBT(page);
}
Also used : Merchant(com.ikoori.vip.common.persistence.model.Merchant) CardWarpper(com.ikoori.vip.server.modular.biz.warpper.CardWarpper) HashMap(java.util.HashMap) Map(java.util.Map) Card(com.ikoori.vip.common.persistence.model.Card) Permission(com.ikoori.vip.common.annotion.Permission) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 22 with Permission

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

the class CardController method update.

/**
 * 修改会员卡
 */
@RequestMapping(value = "/update")
@Permission
@ResponseBody
public Object update(Card card, String rights) {
    if (ToolUtil.isEmpty(card) || card.getId() == null) {
        throw new BussinessException(BizExceptionEnum.REQUEST_NULL);
    }
    Long userId = Long.valueOf(ShiroKit.getUser().getId());
    Merchant merchant = merchantService.getMerchantUserId(userId);
    card.setMerchantId(merchant.getId());
    cardService.saveCard(card, rights);
    return super.SUCCESS_TIP;
}
Also used : Merchant(com.ikoori.vip.common.persistence.model.Merchant) BussinessException(com.ikoori.vip.common.exception.BussinessException) Permission(com.ikoori.vip.common.annotion.Permission) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 23 with Permission

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

the class CardController method cardUpdate.

/**
 * 跳转到修改会员卡
 */
@Permission
@RequestMapping("/card_update/{cardId}")
public String cardUpdate(@PathVariable Long cardId, Model model) {
    Long userId = Long.valueOf(ShiroKit.getUser().getId());
    Merchant merchant = merchantService.getMerchantUserId(userId);
    Map<String, Object> couponCon = new HashMap<String, Object>();
    couponCon.put("merchantId", merchant.getId());
    couponCon.put("invalid", true);
    couponCon.put("type", CouponType.YHQ.getCode());
    model.addAttribute("merchantName", merchant.getName());
    List<Coupon> coupons = couponService.selectByCondition(couponCon);
    // 查询优惠群
    model.addAttribute("coupons", coupons);
    // 查询颜色值
    model.addAttribute("colors", ColorType.values());
    model.addAttribute("grantType", CardGrantType.values());
    Map<String, Object> condition = new HashMap<String, Object>();
    condition.put("merchantId", merchant.getId());
    condition.put("grantType", CardGrantType.NO_RULE.getCode());
    condition.put("excludeCardId", cardId);
    List<Card> cards = cardService.selectByCondition(condition);
    // 查询会员卡
    model.addAttribute("cards", cards);
    // 查询商户Logo
    model.addAttribute("logo", merchant.getHeadImg());
    Card card = cardService.selectById(cardId);
    if (StringUtils.isNotBlank(card.getColorCode())) {
        model.addAttribute("colorType", ColorType.valueOf(card.getColorCode()));
    } else {
        model.addAttribute("colorType", ColorType.Color010);
    }
    model.addAttribute(card);
    Map<String, Object> con = new HashMap<String, Object>();
    con.put("cardId", card.getId());
    List<CardRight> cardRights = cardRightService.selectByCondition(con);
    List<CardRight> couponRights = new ArrayList<CardRight>();
    if (CollectionUtils.isNotEmpty(cardRights)) {
        for (CardRight cardRight : cardRights) {
            if (cardRight.getRightType().equals(RightType.DISCOUNT.getCode())) {
                model.addAttribute(RightType.DISCOUNT.getCode(), cardRight);
            } else if (cardRight.getRightType().equals(RightType.POINTS.getCode())) {
                model.addAttribute(RightType.POINTS.getCode(), cardRight);
            } else if (cardRight.getRightType().equals(RightType.COUPON.getCode())) {
                couponRights.add(cardRight);
            }
        }
    }
    model.addAttribute(RightType.COUPON.getCode(), couponRights);
    return PREFIX + "card_edit.html";
}
Also used : Coupon(com.ikoori.vip.common.persistence.model.Coupon) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Card(com.ikoori.vip.common.persistence.model.Card) Merchant(com.ikoori.vip.common.persistence.model.Merchant) CardRight(com.ikoori.vip.common.persistence.model.CardRight) Permission(com.ikoori.vip.common.annotion.Permission) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 24 with Permission

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

the class CardController method cardAdd.

/**
 * 跳转到添加会员卡
 */
@Permission
@RequestMapping("/card_add")
public String cardAdd(Model model) {
    Long userId = Long.valueOf(ShiroKit.getUser().getId());
    Merchant merchant = merchantService.getMerchantUserId(userId);
    Map<String, Object> couponCon = new HashMap<String, Object>();
    couponCon.put("merchantId", merchant.getId());
    couponCon.put("invalid", true);
    couponCon.put("type", CouponType.YHQ.getCode());
    model.addAttribute("merchantName", merchant.getName());
    List<Coupon> coupons = couponService.selectByCondition(couponCon);
    // 查询优惠群
    model.addAttribute("coupons", coupons);
    // 查询颜色值
    model.addAttribute("colors", ColorType.values());
    model.addAttribute("grantType", CardGrantType.values());
    Map<String, Object> condition = new HashMap<String, Object>();
    condition.put("merchantId", merchant.getId());
    condition.put("grantType", CardGrantType.NO_RULE.getCode());
    List<Card> cards = cardService.selectByCondition(condition);
    // 查询会员卡
    model.addAttribute("cards", cards);
    // model.addAttribute("grantType", GrantType.NO_RULE.getCode());
    // 查询商户Logo
    model.addAttribute("logo", merchant.getHeadImg());
    return PREFIX + "card_add.html";
}
Also used : Coupon(com.ikoori.vip.common.persistence.model.Coupon) Merchant(com.ikoori.vip.common.persistence.model.Merchant) HashMap(java.util.HashMap) Card(com.ikoori.vip.common.persistence.model.Card) Permission(com.ikoori.vip.common.annotion.Permission) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 25 with Permission

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

the class CouponController method list.

/**
 * 获取优惠券列表
 */
@RequestMapping(value = "/list")
@Permission
@ResponseBody
public Object list(String couponName, Long storeId, Boolean isExpired, Boolean isInvalid, Integer type) {
    Long userId = Long.valueOf(ShiroKit.getUser().getId());
    Merchant merchant = merchantService.getMerchantUserId(userId);
    Page<Coupon> page = new PageFactory<Coupon>().defaultPage();
    List<Map<String, Object>> result = couponService.getCouponList(merchant.getId(), isExpired, isInvalid, type, storeId, page, couponName, page.getOrderByField(), page.isAsc());
    page.setRecords((List<Coupon>) new CouponWarpper(result).warp());
    return super.packForBT(page);
}
Also used : StoreCoupon(com.ikoori.vip.common.persistence.model.StoreCoupon) Coupon(com.ikoori.vip.common.persistence.model.Coupon) Merchant(com.ikoori.vip.common.persistence.model.Merchant) CouponWarpper(com.ikoori.vip.server.modular.biz.warpper.CouponWarpper) HashMap(java.util.HashMap) Map(java.util.Map) Permission(com.ikoori.vip.common.annotion.Permission) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

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