/** * @param rebateModel * @return */ public int doAwardItemOwnerWithBuy(DcRebateModel rebateModel) { if (rebateModel.getItemOwnerUserId() == null || rebateModel.isPgcOwner() || rebateModel.isUserSelf()) { return 0; } int integral = (int) (rebateModel.getIntegralCount() * 0.1); integral = integral > 20 ? 20 : integral; DcUserIntegralDetailDTO integralDetail = new DcUserIntegralDetailDTO(); integralDetail.setUserId(rebateModel.getItemOwnerUserId()); integralDetail.setIntegralCount(integral); integralDetail.setSource(DcIntegralSourceEnums.BUY_UGC); DcIntegralDesc desc = new DcIntegralDesc(); desc.setFromObjId(rebateModel.getItemId()); desc.setFromObjName(rebateModel.getItemTitle()); desc.setToObjId(rebateModel.getItemOwnerUserId()); try { DcUserDTO user = dcUserService.getUser(rebateModel.getItemOwnerUserId()); if (user != null) { desc.setToObjName(user.getNick()); } } catch (Exception e) { } integralDetail.setIntegralDesc(desc); try { _doWithIntegral(integralDetail); return integral; } catch (Exception e) { logger.error(e); return 0; } }
/** * 购物返积分 * * @param userId * @param integralCount */ public boolean doBuyRebate(DcRebateModel buyModel) { DcUserIntegralDetailDTO detail = new DcUserIntegralDetailDTO(); detail.setUserId(buyModel.getUserId()); detail.setIntegralCount(buyModel.getIntegralCount()); detail.setSource(DcIntegralSourceEnums.BUY_REBATE); DcIntegralDesc integralDesc = new DcIntegralDesc(); integralDesc.setFromObjName(buyModel.getItemTitle()); integralDesc.setFromObjId(buyModel.getItemId()); integralDesc.setToObjId(buyModel.getUserId()); integralDesc.setToObjName(buyModel.getUserNick()); detail.setIntegralDesc(integralDesc); try { _doWithIntegral(detail); } catch (Exception e) { logger.error(e); return false; } doAwardItemOwnerWithBuy(buyModel); return true; }