| | |
| | | package cc.mrbird.febs.mall.service.impl; |
| | | |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.enumerates.AgentLevelEnum; |
| | | import cc.mrbird.febs.common.enumerates.DataDictionaryEnum; |
| | | import cc.mrbird.febs.common.enumerates.FlowTypeEnum; |
| | | import cc.mrbird.febs.common.enumerates.MoneyFlowTypeEnum; |
| | | import cc.mrbird.febs.common.enumerates.*; |
| | | import cc.mrbird.febs.common.exception.FebsException; |
| | | import cc.mrbird.febs.common.utils.*; |
| | | import cc.mrbird.febs.mall.conversion.MallGoodsConversion; |
| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author wzy |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public FebsResponse register(RegisterDto registerDto) { |
| | | MallMember mallMember = this.baseMapper.selectInfoByAccount(registerDto.getAccount()); |
| | | // MallMember mallMember = this.baseMapper.selectInfoByAccount(registerDto.getAccount()); |
| | | // if (mallMember != null) { |
| | | // throw new FebsException("该账号已被占用"); |
| | | // } |
| | | String accountLogin = registerDto.getAccountLogin(); |
| | | MallMember mallMember = this.baseMapper.selectByAccountLogin(accountLogin); |
| | | if (mallMember != null) { |
| | | throw new FebsException("该账号已被占用"); |
| | | } |
| | | |
| | | List<MallMember> mallMembers = this.baseMapper.selectMemberByName(registerDto.getName()); |
| | | if (CollUtil.isNotEmpty(mallMembers)) { |
| | | MallRegisterAppeal registerAppeal = mallRegisterAppealMapper.selectByPhoneAndName(registerDto.getName(), registerDto.getAccount()); |
| | | if (registerAppeal == null || registerAppeal.getStatus() != 1) { |
| | | return new FebsResponse().code(HttpStatus.ACCEPTED).message("用户名已存在"); |
| | | } |
| | | } |
| | | // List<MallMember> mallMembers = this.baseMapper.selectMemberByName(registerDto.getName()); |
| | | // if (CollUtil.isNotEmpty(mallMembers)) { |
| | | // MallRegisterAppeal registerAppeal = mallRegisterAppealMapper.selectByPhoneAndName(registerDto.getName(), registerDto.getAccount()); |
| | | // if (registerAppeal == null || registerAppeal.getStatus() != 1) { |
| | | // return new FebsResponse().code(HttpStatus.ACCEPTED).message("用户名已存在"); |
| | | // } |
| | | // } |
| | | |
| | | String account = registerDto.getAccount(); |
| | | if (!"admin".equals(registerDto.getRegistType())) { |
| | |
| | | } |
| | | |
| | | mallMember = new MallMember(); |
| | | mallMember.setAccountLogin(accountLogin); |
| | | mallMember.setPassword(SecureUtil.md5(registerDto.getPassword())); |
| | | |
| | | // 判断账号类型 |
| | |
| | | public FebsResponse toLogin(LoginDto loginDto) { |
| | | String md5Pwd = SecureUtil.md5(loginDto.getPassword()); |
| | | |
| | | MallMember mallMember = this.baseMapper.selectInfoByAccountAndPwd(loginDto.getAccount(), md5Pwd); |
| | | // MallMember mallMember = this.baseMapper.selectInfoByAccountAndPwd(loginDto.getAccount(), md5Pwd); |
| | | MallMember mallMember = this.baseMapper.selectInfoByAccountLoginAndPwd(loginDto.getAccount(), md5Pwd); |
| | | if (mallMember == null) { |
| | | throw new FebsException("用户不存在或账号密码错误"); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public FebsResponse forgetPwd(ForgetPwdDto forgetPwdDto) { |
| | | MallMember mallMember = this.baseMapper.selectInfoByAccount(forgetPwdDto.getPhone()); |
| | | Long id = LoginUserUtil.getLoginUser().getId(); |
| | | MallMember mallMember = this.baseMapper.selectById(id); |
| | | |
| | | // MallMember mallMember = this.baseMapper.selectInfoByAccount(forgetPwdDto.getPhone()); |
| | | // MallMember mallMember = this.baseMapper.selectInfoByAccount(forgetPwdDto.getAccount()); |
| | | if (mallMember == null) { |
| | | throw new FebsException("账号不存在"); |
| | |
| | | mallMemberVo.setPrizeScore(wallet.getPrizeScore()); |
| | | mallMemberVo.setTotalScore(wallet.getTotalScore()); |
| | | mallMemberVo.setStar(wallet.getStar()); |
| | | mallMemberVo.setVoucherCnt(wallet.getVoucherCnt()); |
| | | mallMemberVo.setTotalCost(mallOrderInfoMapper.selectTotalAmount(id)); |
| | | return new FebsResponse().success().data(mallMemberVo); |
| | | } |
| | |
| | | MallMember mallMember = this.baseMapper.selectInfoByAccount(transferDto.getAccount()); |
| | | if (mallMember == null) { |
| | | throw new FebsException("用户不存在"); |
| | | } |
| | | Integer insideWith = mallMember.getInsideWith() == null ? 2 :mallMember.getInsideWith(); |
| | | if (1 != insideWith) { |
| | | throw new FebsException("功能升级中"); |
| | | } |
| | | |
| | | Long memberId = LoginUserUtil.getLoginUser().getId(); |
| | |
| | | } |
| | | |
| | | MallMemberWallet wallet = mallMemberWalletMapper.selectWalletByMemberId(id); |
| | | commissionVo.setCommission(wallet.getCommission()); |
| | | commissionVo.setCommission(wallet.getBalance()); |
| | | commissionVo.setToday(mallMoneyFlowMapper.selectCommissionIncome(1, new Date(), id)); |
| | | commissionVo.setMonth(mallMoneyFlowMapper.selectCommissionIncome(2, new Date(), id)); |
| | | commissionVo.setTotal(mallMoneyFlowMapper.selectCommissionIncome(null, null, id)); |
| | |
| | | if (dic != null) { |
| | | cashOutSettingVo = JSONObject.parseObject(dic.getValue(), CashOutSettingVo.class); |
| | | } |
| | | DataDictionaryCustom voucherOnOffDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | GreenScoreEnum.VOUCHER_ON_OFF.getType(), GreenScoreEnum.VOUCHER_ON_OFF.getCode()); |
| | | if(ObjectUtil.isNotEmpty(voucherOnOffDic)){ |
| | | cashOutSettingVo.setVoucherOnOff(voucherOnOffDic.getValue()); |
| | | DataDictionaryCustom voucherPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | GreenScoreEnum.VOUCHER_PERCENT.getType(), GreenScoreEnum.VOUCHER_PERCENT.getCode()); |
| | | if(ObjectUtil.isNotEmpty(voucherPercentDic)){ |
| | | cashOutSettingVo.setVoucherPercent(new BigDecimal(voucherPercentDic.getValue())); |
| | | } |
| | | } |
| | | |
| | | return cashOutSettingVo; |
| | | } |
| | | |
| | |
| | | mallMemberBank.setIdCardNum(updateMemberBankDto.getIdCardNum()); |
| | | mallMemberBank.setBankNo(updateMemberBankDto.getBankNo()); |
| | | mallMemberBank.setPhone(updateMemberBankDto.getPhone()); |
| | | mallMemberBank.setDigitalNo(updateMemberBankDto.getDigitalNo()); |
| | | mallMemberBank.setBankName(updateMemberBankDto.getBankName()); |
| | | mallMemberBank.setSubbranchName(updateMemberBankDto.getSubbranchName()); |
| | | mallMemberBank.setProvince(updateMemberBankDto.getProvince()); |
| | | mallMemberBank.setCity(updateMemberBankDto.getCity()); |
| | | mallMemberBank.setSkhh(updateMemberBankDto.getSkhh()); |
| | | mallMemberBankMapper.updateById(mallMemberBank); |
| | | return new FebsResponse().success(); |
| | | } |
| | |
| | | mallMemberBankMapper.deleteById(id); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse findBankName() { |
| | | List<String> bankNameList = new ArrayList<>(); |
| | | List<DataDictionaryCustom> typeBank = dataDictionaryCustomMapper.selectDicByType("TYPE_BANK"); |
| | | if(CollUtil.isNotEmpty(typeBank)){ |
| | | bankNameList = typeBank.stream().map(DataDictionaryCustom::getValue).collect(Collectors.toList()); |
| | | } |
| | | return new FebsResponse().success().data(bankNameList); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse pwdForget(ForgetPwdDto forgetPwdDto) { |
| | | MallMember mallMember = this.baseMapper.selectInfoByAccountNew(forgetPwdDto.getAccountLogin(),forgetPwdDto.getPhone()); |
| | | if(ObjectUtil.isEmpty(mallMember)){ |
| | | throw new FebsException("账号不存在"); |
| | | } |
| | | |
| | | boolean b = commonService.verifyCode(forgetPwdDto.getAccount(), forgetPwdDto.getCode()); |
| | | if (!b) { |
| | | throw new FebsException("验证码错误"); |
| | | } |
| | | |
| | | String pwd = SecureUtil.md5(forgetPwdDto.getPassword()); |
| | | mallMember.setPassword(pwd); |
| | | |
| | | this.baseMapper.updateById(mallMember); |
| | | return new FebsResponse().success().message("重置成功"); |
| | | } |
| | | } |