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;
}
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;
}
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;
}
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;
}
}
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;
}
Aggregations