Search in sources :

Example 11 with Member

use of com.ikoori.vip.common.persistence.model.Member 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 12 with Member

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

the class MemberInfoApiImpl method getMemberByMobile.

/**
 * <p>
 * Title: getMemberByMobile
 * </p>
 * <p>
 * Description:根据会员手机号获取会员
 * </p>
 *
 * @param mobile
 *            会员手机号
 * @return
 * @see com.ikoori.vip.api.service.MemberInfoApi#getMemberByMobile(java.lang.String)
 */
@Override
public Object getMemberByMobile(String mobile) {
    log.info("进入getMemberByMobile");
    log.info("进入getMemberByMobile>>mobile=" + mobile);
    Member member = memberDao.getMemberByMobile(mobile);
    if (member == null) {
        log.info("member == null");
        return null;
    }
    log.info("结束getMemberByMobile");
    return member;
}
Also used : Member(com.ikoori.vip.common.persistence.model.Member)

Example 13 with Member

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

the class MemberInfoApiImpl method getMemberInfoByUnionid.

/**
 * <p>
 * Title: getMemberInfoByUnionid
 * </p>
 * <p>
 * Description:获取会员信息
 * </p>
 *
 * @param unionid
 * @return
 * @see com.ikoori.vip.api.service.MemberInfoApi#getMemberInfoByUnionid(java.lang.String)
 */
@Override
public JSONObject getMemberInfoByUnionid(String unionid) {
    log.info("进入getMemberInfoByUnionid");
    log.info("进入getMemberInfoByUnionid>>unionid=" + unionid);
    Member member = memberDao.getMemberByUnionid(unionid);
    if (member == null) {
        return null;
    }
    JSONObject obj = new JSONObject();
    obj.put("id", member.getId());
    obj.put("name", member.getName());
    obj.put("sex", member.getSex());
    obj.put("address", member.getAddress());
    // obj.put("birthday", DateUtil.getTime(member.getBirthday()));
    obj.put("birthday", member.getBirthday());
    obj.put("mobile", member.getMobile());
    obj.put("isActive", member.isIsActive());
    obj.put("area", member.getArea());
    log.info("结束getMemberInfoByUnionid");
    return obj;
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject) Member(com.ikoori.vip.common.persistence.model.Member)

Example 14 with Member

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

the class MemberInfoApiImpl method activeMemberByUnionid.

/**
 * 激活会员
 *
 * @Title: activeMemberByUnionid
 * @param unionid
 * @param mobile
 * @param ip
 * @param sendPack 发送红包
 * @return
 * @date: 2017年10月9日 上午10:54:16
 * @author: chengxg
 */
@Override
@Transactional(readOnly = false, propagation = Propagation.REQUIRED)
public int activeMemberByUnionid(String unionid, String mobile, String ip, boolean sendPack) {
    synchronized (mobile.intern()) {
        log.info("进入activeMemberByUnionid>>unionid=" + unionid);
        log.info("进入activeMemberByUnionid>>mobile=" + mobile);
        int count = memberDao.registerMember(unionid, mobile);
        if (count > 0) {
            Member receiveMem = memberDao.getMemberByUnionid(unionid);
            shareService.activeShare(receiveMem);
            if (sendPack) {
                Redpack redpack = redpackService.selectByPackType(RedpackType.re.getCode(), receiveMem.getMerchantId());
                if (redpack != null) {
                    Integer amount = redpack.getAmount().multiply(new BigDecimal(100)).intValue();
                    if (redpack.getSendType().intValue() == RedpackSendType.random.getCode()) {
                        int max = redpack.getMaxAmount().multiply(new BigDecimal(100)).intValue();
                        int min = redpack.getMinAmount().multiply(new BigDecimal(100)).intValue();
                        amount = (int) (Math.random() * (max - min + 1) + min);
                    }
                    WxUser wxuser = new WxUser();
                    wxuser.setUnionid(unionid);
                    wxuser = wxUserMapper.selectOne(wxuser);
                    if (wxuser != null) {
                        redpackLogService.saveRedPackLog(amount, unionid, wxuser.getOpenid(), ip, receiveMem.getMerchantId(), redpack.getId(), redpack.getActName(), redpack.getRemark(), redpack.getWishing());
                    }
                }
            }
        }
        log.info("结束activeMemberByUnionid");
        return count;
    }
}
Also used : Redpack(com.ikoori.vip.common.persistence.model.Redpack) WxUser(com.ikoori.vip.common.persistence.model.WxUser) Member(com.ikoori.vip.common.persistence.model.Member) BigDecimal(java.math.BigDecimal) Transactional(org.springframework.transaction.annotation.Transactional)

Example 15 with Member

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

the class SignApiImpl method getSignInfo.

/**
 * 获得签到信息
 *
 * @Title: getSignInfo
 * @param unionid
 * @return
 * @throws Exception
 * @date: 2017年9月29日 下午4:21:09
 * @author: chengxg
 */
public JSONObject getSignInfo(String unionid) throws Exception {
    log.info("进入getSignInfo>>unionid=" + unionid);
    JSONObject obj = new JSONObject();
    // unionid获得会员
    Member member = memberDao.getMemberByUnionid(unionid);
    // 最后签到日期
    Date signDate = member.getSignDate();
    String signDateStr = signDate == null ? "" : DateUtil.getDay(signDate);
    Date yesDate = DateUtil.getAfterDayDate(-1);
    String yesDateStr = DateUtil.getDay(yesDate);
    String nowDateStr = DateUtil.getDay(new Date());
    // 最后签到时间为昨天或者今天,则表示为连续签到状态
    boolean isContinue = yesDateStr.equals(signDateStr) || nowDateStr.equals(signDateStr);
    obj.put("points", member == null ? 0 : member.getPoints());
    obj.put("signDate", member == null ? 0 : member.getSignDate());
    obj.put("signDays", !isContinue ? 0 : member.getSignDays());
    obj.put("signTotalDays", member == null ? 0 : member.getSignTotalDays());
    List<String> dates = signLogDao.getSignDates(member.getMerchantId(), member.getId());
    obj.put("signDates", dates);
    return obj;
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject) Member(com.ikoori.vip.common.persistence.model.Member) Date(java.util.Date)

Aggregations

Member (com.ikoori.vip.common.persistence.model.Member)23 JSONObject (com.alibaba.fastjson.JSONObject)12 Transactional (org.springframework.transaction.annotation.Transactional)10 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)6 Card (com.ikoori.vip.common.persistence.model.Card)5 MemberCard (com.ikoori.vip.common.persistence.model.MemberCard)5 HashMap (java.util.HashMap)5 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)5 BussinessException (com.ikoori.vip.common.exception.BussinessException)4 Coupon (com.ikoori.vip.common.persistence.model.Coupon)4 ApiOperation (io.swagger.annotations.ApiOperation)4 JSONArray (com.alibaba.fastjson.JSONArray)3 Date (java.util.Date)3 EntityWrapper (com.baomidou.mybatisplus.mapper.EntityWrapper)2 Permission (com.ikoori.vip.common.annotion.Permission)2 Merchant (com.ikoori.vip.common.persistence.model.Merchant)2 Point (com.ikoori.vip.common.persistence.model.Point)2 ShareLog (com.ikoori.vip.common.persistence.model.ShareLog)2 WxUser (com.ikoori.vip.common.persistence.model.WxUser)2 BigDecimal (java.math.BigDecimal)2