| | |
| | | import com.matrix.system.app.vo.VipInfoListVo; |
| | | import com.matrix.system.common.bean.SysUsers; |
| | | import com.matrix.system.common.tools.DataAuthUtil; |
| | | import com.matrix.system.common.tools.PasswordUtil; |
| | | import com.matrix.system.common.tools.ServiceUtil; |
| | | import com.matrix.system.constance.Dictionary; |
| | | import com.matrix.system.constance.TableMapping; |
| | |
| | | import com.matrix.system.hive.pojo.VipInfoVo; |
| | | import com.matrix.system.hive.service.SysVipInfoService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | @Autowired |
| | | private SysVipLabelDao sysVipLabelDao; |
| | | |
| | | @Value("${default.vip.photo.woman}") |
| | | String defaultWoman; |
| | | |
| | | @Value("${default.vip.photo.man}") |
| | | String defaultMan; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 新增会员储值卡 |
| | | * @param vipId |
| | | * @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; |
| | | |
| | | } |
| | | |
| | |
| | | sysVipInfo.setPointAll(0); |
| | | sysVipInfo.setIsDeal(SysVipInfo.UNDEAL_VIP); |
| | | sysVipInfo.setZjm(StringUtils.toHanyuPinyin(sysVipInfo.getVipName())+","+StringUtils.toHeadWordHanyuPinyin(sysVipInfo.getVipName())); |
| | | if(sysVipInfo.getSex().equals(Dictionary.SEX_MAN)){ |
| | | sysVipInfo.setPhoto(defaultMan); |
| | | }else{ |
| | | sysVipInfo.setPhoto(defaultWoman); |
| | | } |
| | | int i=sysVipInfoDao.insert(sysVipInfo); |
| | | modifyVipWithOtherInfo(sysVipInfo); |
| | | //创建用户默认储值卡 |
| | |
| | | |
| | | @Override |
| | | public List<SysVipInfo> findByVipNoOrTel(String key) { |
| | | SysUsers users = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | return sysVipInfoDao.selectByVipNoOrTel(key, users.getShopId()); |
| | | return sysVipInfoDao.selectByVipNoOrTel(key); |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public List<SysVipInfo> findUserByKey(String keyWord) { |
| | | SysUsers users = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | return sysVipInfoDao.selectUserByKey(keyWord, users.getShopId()); |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | return sysVipInfoDao.selectUserByKey(keyWord,user.getCompanyId()); |
| | | } |
| | | |
| | | |
| | |
| | | SysUsers users = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY); |
| | | sysVipInfo.setCompanyId(users.getCompanyId()); |
| | | sysVipInfo.setShopId(users.getShopId()); |
| | | if(sysVipInfo.getSex().equals(Dictionary.SEX_MAN)){ |
| | | sysVipInfo.setPhoto(defaultMan); |
| | | }else{ |
| | | sysVipInfo.setPhoto(defaultWoman); |
| | | } |
| | | int i=sysVipInfoDao.insert(sysVipInfo); |
| | | modifyVipWithOtherInfo(sysVipInfo); |
| | | return i; |
| | |
| | | public int apiAddVip(AddVipDto addVipDto) { |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | |
| | | if (serviceUtil.addCheckRepeatTowColumn(TableMapping.SYS_VIP_INFO, "VIP_NO", addVipDto.getVipNo(), |
| | | "company_id",user.getCompanyId())) { |
| | | throw new GlobleException("编号已存在!"); |
| | | if (StringUtils.isNotBlank(addVipDto.getVipNo())) { |
| | | if (serviceUtil.addCheckRepeatTowColumn(TableMapping.SYS_VIP_INFO, "VIP_NO", addVipDto.getVipNo(), |
| | | "company_id", user.getCompanyId())) { |
| | | throw new GlobleException("编号已存在!"); |
| | | } |
| | | } |
| | | |
| | | if (serviceUtil.addCheckRepeatTowColumn(TableMapping.SYS_VIP_INFO, "PHONE", addVipDto.getPhone(), |
| | |
| | | vipInfo.setPointAll(0); |
| | | vipInfo.setIsDeal(SysVipInfo.UNDEAL_VIP); |
| | | vipInfo.setZjm(StringUtils.toHanyuPinyin(vipInfo.getVipName())+","+StringUtils.toHeadWordHanyuPinyin(vipInfo.getVipName())); |
| | | if(vipInfo.getSex().equals(Dictionary.SEX_MAN)){ |
| | | vipInfo.setPhoto(defaultMan); |
| | | }else{ |
| | | vipInfo.setPhoto(defaultWoman); |
| | | } |
| | | int i=sysVipInfoDao.insert(vipInfo); |
| | | |
| | | if (CollectionUtils.isNotEmpty(addVipDto.getLabels())) { |
| | |
| | | throw new GlobleException("用户不存在"); |
| | | } |
| | | |
| | | if (!modifyVipDto.getVipNo().equals(vipInfo.getVipNo())) { |
| | | if (serviceUtil.addCheckRepeatTowColumn(TableMapping.SYS_VIP_INFO, "VIP_NO", modifyVipDto.getVipNo(), |
| | | "company_id",user.getCompanyId())) { |
| | | throw new GlobleException("编号已存在!"); |
| | | if (StringUtils.isNotBlank(modifyVipDto.getVipNo())) { |
| | | if (!modifyVipDto.getVipNo().equals(vipInfo.getVipNo())) { |
| | | if (serviceUtil.addCheckRepeatTowColumn(TableMapping.SYS_VIP_INFO, "VIP_NO", modifyVipDto.getVipNo(), |
| | | "company_id", user.getCompanyId())) { |
| | | throw new GlobleException("编号已存在!"); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | private void batchInsertLabel(List<String> labelList, Long id) { |
| | | Set<String> labels = new HashSet<>(labelList); |
| | | Iterator<String> iterator = labels.iterator(); |
| | | if (iterator.hasNext()) { |
| | | while (iterator.hasNext()) { |
| | | SysVipLabelRelate relate = new SysVipLabelRelate(); |
| | | relate.setLabelId(Long.parseLong(iterator.next())); |
| | | relate.setVipId(id); |