use of com.ikoori.vip.common.persistence.model.Merchant 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);
}
use of com.ikoori.vip.common.persistence.model.Merchant 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;
}
use of com.ikoori.vip.common.persistence.model.Merchant 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";
}
use of com.ikoori.vip.common.persistence.model.Merchant 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";
}
use of com.ikoori.vip.common.persistence.model.Merchant 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);
}
Aggregations