Search in sources :

Example 41 with Merchant

use of com.ikoori.vip.common.persistence.model.Merchant in project vip by guangdada.

the class MerchantServiceImpl method getMerchantUserId.

@Cacheable(value = Cache.MERCHANT, key = "'" + CacheKey.SINGLE_MERCHANT + "'+#userId")
public Merchant getMerchantUserId(Long userId) {
    Merchant merchant = new Merchant();
    merchant.setUserId(userId);
    return merchantMapper.selectOne(merchant);
}
Also used : Merchant(com.ikoori.vip.common.persistence.model.Merchant) Cacheable(org.springframework.cache.annotation.Cacheable)

Example 42 with Merchant

use of com.ikoori.vip.common.persistence.model.Merchant in project vip by guangdada.

the class MemberCardApiImpl method getMemberCardByUnionid.

@Override
public JSONObject getMemberCardByUnionid(String unionid) {
    log.info("进入getMemberCardByUnionid>>unionid=" + unionid);
    Member member = memberDao.getMemberByUnionid(unionid);
    if (member == null) {
        log.info("member == null");
        return null;
    }
    MemberCard memberCard = memberCardDao.getMemberCard(member.getId());
    if (memberCard == null) {
        log.info("memberCard == null");
        return null;
    }
    Merchant merchant = memberCard.getMerchant();
    Card card = memberCard.getCard();
    if (merchant == null || card == null) {
        log.info("merchant == null || card == null");
        return null;
    }
    JSONObject obj = new JSONObject();
    obj.put("coverType", card.getCoverType());
    obj.put("coverPic", card.getCoverPic());
    obj.put("colorCode", ColorType.valOf(card.getColorCode()));
    obj.put("merchantName", merchant.getName());
    obj.put("merchantLogo", merchant.getHeadImg());
    obj.put("cardName", card.getName());
    obj.put("cardNum", memberCard.getCardNumber());
    log.info("结束getMemberCardByUnionid");
    return obj;
}
Also used : MemberCard(com.ikoori.vip.common.persistence.model.MemberCard) Merchant(com.ikoori.vip.common.persistence.model.Merchant) JSONObject(com.alibaba.fastjson.JSONObject) Member(com.ikoori.vip.common.persistence.model.Member) Card(com.ikoori.vip.common.persistence.model.Card) MemberCard(com.ikoori.vip.common.persistence.model.MemberCard)

Example 43 with Merchant

use of com.ikoori.vip.common.persistence.model.Merchant in project vip by guangdada.

the class StoreEmployeeController method index.

/**
 * 跳转到员工管理首页
 */
@Permission
@RequestMapping("")
public String index(Model model) {
    Long userId = Long.valueOf(ShiroKit.getUser().getId());
    Merchant merchant = merchantService.getMerchantUserId(userId);
    Map<String, Object> condition = new HashMap<String, Object>();
    condition.put("merchantId", merchant.getId());
    List<Store> stores = storeService.selectByCondition(condition);
    // 查询店铺
    model.addAttribute("stores", stores);
    // 角色
    model.addAttribute("roles", RoleType.values());
    return PREFIX + "storeEmployee.html";
}
Also used : Merchant(com.ikoori.vip.common.persistence.model.Merchant) HashMap(java.util.HashMap) Store(com.ikoori.vip.common.persistence.model.Store) Permission(com.ikoori.vip.common.annotion.Permission) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 44 with Merchant

use of com.ikoori.vip.common.persistence.model.Merchant in project vip by guangdada.

the class TicketController method index.

/**
 * 跳转到小票首页
 */
@Permission
@RequestMapping("")
public String index(Model model) {
    Long userId = Long.valueOf(ShiroKit.getUser().getId());
    Merchant merchant = merchantService.getMerchantUserId(userId);
    Map<String, Object> condition = new HashMap<String, Object>();
    condition.put("merchantId", merchant.getId());
    List<Store> stores = storeService.selectByCondition(condition);
    // 查询店铺
    model.addAttribute("stores", stores);
    /*
		 * Long userId = Long.valueOf(ShiroKit.getUser().getId()); Ticket
		 * ticket=ticketMapper.selectById(1); model.addAttribute("ticket",
		 * ticket);
		 */
    return PREFIX + "ticket.html";
}
Also used : Merchant(com.ikoori.vip.common.persistence.model.Merchant) HashMap(java.util.HashMap) Store(com.ikoori.vip.common.persistence.model.Store) Permission(com.ikoori.vip.common.annotion.Permission) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 45 with Merchant

use of com.ikoori.vip.common.persistence.model.Merchant in project vip by guangdada.

the class TicketController method add.

/**
 * 新增小票
 */
@RequestMapping(value = "/add")
@Permission
@ResponseBody
public Object add(Ticket ticket) {
    Long userId = Long.valueOf(ShiroKit.getUser().getId());
    Merchant merchant = merchantService.getMerchantUserId(userId);
    ticket.setMerchantId(merchant.getId());
    ticketService.insert(ticket);
    return super.SUCCESS_TIP;
}
Also used : Merchant(com.ikoori.vip.common.persistence.model.Merchant) Permission(com.ikoori.vip.common.annotion.Permission) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

Merchant (com.ikoori.vip.common.persistence.model.Merchant)66 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)59 Permission (com.ikoori.vip.common.annotion.Permission)55 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)35 HashMap (java.util.HashMap)29 Map (java.util.Map)20 Store (com.ikoori.vip.common.persistence.model.Store)12 Card (com.ikoori.vip.common.persistence.model.Card)11 BussinessException (com.ikoori.vip.common.exception.BussinessException)8 Coupon (com.ikoori.vip.common.persistence.model.Coupon)7 MemberCard (com.ikoori.vip.common.persistence.model.MemberCard)7 LinkedHashMap (java.util.LinkedHashMap)4 JSONObject (com.alibaba.fastjson.JSONObject)3 Ticket (com.ikoori.vip.common.persistence.model.Ticket)3 User (com.ikoori.vip.common.persistence.model.User)3 Transactional (org.springframework.transaction.annotation.Transactional)3 Member (com.ikoori.vip.common.persistence.model.Member)2 Picture (com.ikoori.vip.common.persistence.model.Picture)2 StoreCoupon (com.ikoori.vip.common.persistence.model.StoreCoupon)2 CouponCodeWarpper (com.ikoori.vip.server.modular.biz.warpper.CouponCodeWarpper)2