| | |
| | | import com.matrix.core.constance.MatrixConstance; |
| | | import com.matrix.core.exception.GlobleException; |
| | | import com.matrix.core.pojo.PaginationVO; |
| | | import com.matrix.core.tools.*; |
| | | import com.matrix.core.tools.DateUtil; |
| | | import com.matrix.core.tools.EncrypUtil; |
| | | import com.matrix.core.tools.StringUtils; |
| | | import com.matrix.core.tools.WebUtil; |
| | | import com.matrix.core.tools.excl.ExcelSheetPO; |
| | | import com.matrix.core.tools.excl.ExcelUtil; |
| | | import com.matrix.system.app.dto.AddVipDto; |
| | |
| | | import com.matrix.system.app.dto.VipInfoListDto; |
| | | import com.matrix.system.app.vo.VipInfoDetailVo; |
| | | import com.matrix.system.app.vo.VipInfoListVo; |
| | | import com.matrix.system.common.bean.BusParameterSettings; |
| | | import com.matrix.system.common.bean.SysUsers; |
| | | import com.matrix.system.common.dao.BusParameterSettingsDao; |
| | | import com.matrix.system.common.tools.DataAuthUtil; |
| | | import com.matrix.system.common.tools.ServiceUtil; |
| | | import com.matrix.system.constance.Dictionary; |
| | |
| | | import com.matrix.system.hive.plugin.util.CollectionUtils; |
| | | import com.matrix.system.hive.pojo.VipInfoVo; |
| | | import com.matrix.system.hive.service.SysVipInfoService; |
| | | import com.matrix.system.score.constant.ScoreSettingConstant; |
| | | import com.matrix.system.score.entity.ScoreVipDetail; |
| | | import com.matrix.system.score.service.ScoreVipDetailService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | @Value("${default.vip.photo.man}") |
| | | String defaultMan; |
| | | @Autowired |
| | | BusParameterSettingsDao busParameterSettingsDao; |
| | | |
| | | @Autowired |
| | | ScoreVipDetailService scoreVipDetailService; |
| | | |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public int addVipDefaultCard(Long vipId){ |
| | | public MoneyCardUse addVipDefaultCard(Long vipId){ |
| | | MoneyCardUse defaultCardUse=new MoneyCardUse(); |
| | | defaultCardUse.setVipId(vipId); |
| | | defaultCardUse.setCardName("储值卡"); |
| | |
| | | defaultCardUse.setGiftMoney(0D); |
| | | defaultCardUse.setSource("-"); |
| | | defaultCardUse.setStatus(Dictionary.MONEYCARD_STATUS_YX); |
| | | return moneyCardUseDao.insert(defaultCardUse); |
| | | moneyCardUseDao.insert(defaultCardUse); |
| | | return defaultCardUse; |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public List<SysVipInfo> findUserByKey(String keyWord) { |
| | | return sysVipInfoDao.selectUserByKey(keyWord); |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | return sysVipInfoDao.selectUserByKey(keyWord,user.getCompanyId()); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public int apiAddVip(AddVipDto addVipDto) { |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | |
| | |
| | | if (CollectionUtils.isNotEmpty(addVipDto.getLabels())) { |
| | | batchInsertLabel(addVipDto.getLabels(), vipInfo.getId()); |
| | | } |
| | | //添加推荐人积分 |
| | | addReferrerVipScore(vipInfo); |
| | | |
| | | //创建用户默认储值卡 |
| | | addVipDefaultCard(vipInfo.getId()); |
| | | return i; |
| | | } |
| | | |
| | | /** |
| | | * 添加推荐人积分 |
| | | * @param vipInfo |
| | | */ |
| | | public void addReferrerVipScore(SysVipInfo vipInfo) { |
| | | if(vipInfo.getRecommendId()!=null){ |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | BusParameterSettings referrerScoreSetting = busParameterSettingsDao.selectCompanyParamByCode(ScoreSettingConstant.REFERRALS_CONSUMPTION, user.getCompanyId()); |
| | | //推荐注册老带新积分奖励 |
| | | SysVipInfo referrerVip = sysVipInfoDao.selectById(vipInfo.getRecommendId()); |
| | | |
| | | if(StringUtils.isNotBlank(referrerScoreSetting.getParamValue())){ |
| | | |
| | | scoreVipDetailService.addScore(referrerVip.getOpenId(), |
| | | referrerVip.getId(), |
| | | user.getSuId(), |
| | | vipInfo.getShopId(), |
| | | Integer.parseInt(referrerScoreSetting.getParamValue()), |
| | | vipInfo.getId(), |
| | | ScoreVipDetail.SCORE_VIP_TYPE_REFERRER, |
| | | "推荐会员" |
| | | ); |
| | | } |
| | | |
| | | //推荐注册二级带新积分奖励 |
| | | |
| | | if(referrerVip.getRecommendId()!=null){ |
| | | |
| | | SysVipInfo topVipInfo = sysVipInfoDao.selectById(referrerVip.getRecommendId()); |
| | | |
| | | |
| | | if(StringUtils.isNotBlank(referrerScoreSetting.getParamValue1())){ |
| | | scoreVipDetailService.addScore(topVipInfo.getOpenId(), |
| | | topVipInfo.getId(), |
| | | user.getSuId(), |
| | | vipInfo.getShopId(), |
| | | Integer.parseInt(referrerScoreSetting.getParamValue1()), |
| | | vipInfo.getId(), |
| | | ScoreVipDetail.SCORE_VIP_TYPE_REFERRER, |
| | | "间接推荐会员" |
| | | ); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public int apiModifyVip(ModifyVipDto modifyVipDto) { |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |