Merge branch 'feature/mall_product'

pull/16/head
tangqian 2023-05-25 12:02:15 +08:00
commit 64a66f2a3a
20 changed files with 127 additions and 46 deletions

View File

@ -74,4 +74,12 @@ public class MemberController {
return CommonResult.success(rechargeGearService.memberByPhoneGradeInfo(phone));
}
// 充值列表记录
@Operation(summary = "根据手机号获取充值充值记录")
@RequestMapping(value = "/memberOrderInfoByPhone", method = RequestMethod.GET)
@PreAuthenticated
@TenantIgnore
public CommonResult<List<RechargeOrderRespVO>> memberOrderInfoByPhone(@RequestParam String phone) {
return CommonResult.success(rechargeOrderService.memberOrderInfoByPhone(phone));
}
}

View File

@ -1463,7 +1463,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
});
List<PhoneRecordDO> infoDOS = phoneRecordMapper.selectList(Wrappers.<PhoneRecordDO>lambdaQuery()
.eq(PhoneRecordDO::getUserId, user.getId())
.eq(PhoneRecordDO::getUserId, user.getMobile())
.in(PhoneRecordDO::getRechargeGearId, collect));
if (!CollectionUtils.isEmpty(infoDOS)) {
@ -1481,7 +1481,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
MemberUserRespDTO userByMobile = userService.getUserByMobile(request.getUserPhone());
// 初始化一个账号
if (Objects.isNull(userByMobile)) {
userService.saveMemberUser(request.getUserPhone());
userService.saveMemberUser(request.getUserPhone(),user.getPromoterId());
}
}
}

View File

@ -1,35 +1,33 @@
package cn.iocoder.yudao.module.shop.service.recharge;
import cn.iocoder.yudao.framework.common.exception.ServiceException;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.*;
import cn.iocoder.yudao.module.shop.convert.recharge.RechargeGearConvert;
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.PhoneRecordDO;
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderDO;
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderInfoDO;
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeGearDO;
import cn.iocoder.yudao.module.shop.dal.mysql.recharge.PhoneRecordMapper;
import cn.iocoder.yudao.module.shop.dal.mysql.recharge.RechargeGearMapper;
import cn.iocoder.yudao.module.shop.dal.mysql.recharge.RechargeOrderInfoMapper;
import cn.iocoder.yudao.module.shop.dal.mysql.recharge.RechargeOrderMapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import java.util.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.*;
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeGearDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.shop.convert.recharge.RechargeGearConvert;
import cn.iocoder.yudao.module.shop.dal.mysql.recharge.RechargeGearMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.shop.enums.ErrorCodeConstants.*;
import static cn.iocoder.yudao.module.shop.enums.ErrorCodeConstants.RECHARGE_GEAR_NOT_EXISTS;
/**
* Service
@ -48,6 +46,8 @@ public class RechargeGearServiceImpl implements RechargeGearService {
private RechargeOrderMapper orderMapper;
@Resource
private PhoneRecordMapper phoneRecordMapper;
@Autowired
private MemberUserApi userService;
@Override
public Long createRechargeGear(RechargeGearCreateReqVO createReqVO) {
@ -104,6 +104,7 @@ public class RechargeGearServiceImpl implements RechargeGearService {
@Override
public List<RechargeGearRespVO> getGradeInfo() {
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
MemberUserRespDTO user = userService.getUser(loginUser.getId());
Assert.notNull(loginUser, "登录失效,请重新登录!");
List<RechargeGearDO> rechargeGearDOS = rechargeGearMapper.selectList(Wrappers.<RechargeGearDO>lambdaQuery()
.eq(RechargeGearDO::getDeleted, 0));
@ -111,7 +112,7 @@ public class RechargeGearServiceImpl implements RechargeGearService {
throw new ServiceException("未初始化档次信息!");
}
List<RechargeGearRespVO> rechargeGearRespVOS = RechargeGearConvert.INSTANCE.convertList(rechargeGearDOS);
List<PhoneRecordDO> infoDOS = phoneRecordMapper.selectList(Wrappers.<PhoneRecordDO>lambdaQuery().eq(PhoneRecordDO::getUserId, loginUser.getId()));
List<PhoneRecordDO> infoDOS = phoneRecordMapper.selectList(Wrappers.<PhoneRecordDO>lambdaQuery().eq(PhoneRecordDO::getPhone, user.getMobile()));
Map<Long, List<PhoneRecordDO>> collect = infoDOS.stream().collect(Collectors.groupingBy(PhoneRecordDO::getRechargeGearId));
rechargeGearRespVOS.forEach(vo -> {
List<PhoneRecordDO> infoDOS1 = collect.get(vo.getId());

View File

@ -76,4 +76,6 @@ public interface RechargeOrderService {
List<RechargeOrderRespVO> memberOrderInfo();
MemberHeadResponse memberHeadInfo();
List<RechargeOrderRespVO> memberOrderInfoByPhone(String phone);
}

View File

@ -171,4 +171,35 @@ public class RechargeOrderServiceImpl implements RechargeOrderService {
return response;
}
@Override
public List<RechargeOrderRespVO> memberOrderInfoByPhone(String phone) {
List<RechargeOrderDO> orderDOS = rechargeOrderMapper.selectList(Wrappers.<RechargeOrderDO>lambdaQuery()
.eq(RechargeOrderDO::getUserPhone, phone).eq(RechargeOrderDO::getPaid, 1));
if (!CollectionUtils.isEmpty(orderDOS)) {
List<RechargeOrderRespVO> rechargeOrderRespVOS = RechargeOrderConvert.INSTANCE.convertList(orderDOS);
List<String> collect1 = rechargeOrderRespVOS.stream().map(RechargeOrderBaseVO::getOrderId).collect(Collectors.toList());
List<RechargeOrderInfoDO> infoDOS = infoMapper.selectList(Wrappers.<RechargeOrderInfoDO>lambdaQuery().in(RechargeOrderInfoDO::getOrderNo, collect1));
Map<String, List<RechargeOrderInfoDO>> collect = infoDOS.stream().collect(Collectors.groupingBy(RechargeOrderInfoDO::getOrderNo));
for (RechargeOrderRespVO orderDO : rechargeOrderRespVOS) {
StringBuilder grade = new StringBuilder();
List<RechargeOrderInfoDO> infoDOS1 = collect.get(orderDO.getOrderId());
for (RechargeOrderInfoDO infoDO : infoDOS1) {
if (infoDO.getPrice().compareTo(new BigDecimal("240")) == 0) {
grade.append("套餐1,");
} else if (infoDO.getPrice().compareTo(new BigDecimal("400")) == 0) {
grade.append("套餐2,");
} else if (infoDO.getPrice().compareTo(new BigDecimal("640")) == 0) {
grade.append("套餐3");
}
}
orderDO.setGrade(grade.toString());
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
orderDO.setStringCreateTime(orderDO.getCreateTime().format(formatter));
}
return rechargeOrderRespVOS;
}
return null;
}
}

View File

@ -80,7 +80,7 @@ public interface MemberUserApi {
MemberUserRespDTO getInfo();
void saveMemberUser(String phone);
void saveMemberUser(String phone,Long promoterId);
PromoterDTO getPromoterDOByUserId(Long userId);
}

View File

@ -5,9 +5,11 @@ import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
import cn.iocoder.yudao.module.member.api.user.dto.PromoterDTO;
import cn.iocoder.yudao.module.member.controller.app.auth.vo.AppAuthSmsLoginReqVO;
import cn.iocoder.yudao.module.member.convert.user.UserConvert;
import cn.iocoder.yudao.module.member.dal.dataobject.promoter.PromoterDO;
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
import cn.iocoder.yudao.module.member.service.auth.MemberAuthService;
import cn.iocoder.yudao.module.member.service.promoter.PromoterService;
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
import com.thoughtworks.xstream.core.SecurityUtils;
@ -31,6 +33,8 @@ public class MemberUserApiImpl implements MemberUserApi {
private MemberUserService userService;
@Resource
private PromoterService promoterService;
@Resource
private MemberAuthService authService;
@Override
@TenantIgnore
@ -103,8 +107,12 @@ public class MemberUserApiImpl implements MemberUserApi {
}
@Override
public void saveMemberUser(String phone) {
userService.saveMemberUser(phone);
public void saveMemberUser(String phone,Long promoterId) {
AppAuthSmsLoginReqVO reqVO = new AppAuthSmsLoginReqVO();
reqVO.setMobile(phone);
reqVO.setPromoterId(promoterId);
reqVO.setRealName("初始化账号");
authService.initialize(reqVO);
}
@Override

View File

@ -44,6 +44,14 @@ public interface MemberAuthService {
*/
Long register(@Valid AppAuthSmsLoginReqVO reqVO);
/**
*
*
* @param reqVO
* @return
*/
Long initialize(@Valid AppAuthSmsLoginReqVO reqVO);
/**
* 使 code

View File

@ -139,6 +139,19 @@ public class MemberAuthServiceImpl implements MemberAuthService {
return memberUserDO.getId();
}
@Override
public Long initialize(AppAuthSmsLoginReqVO reqVO) {
// 校验验证码
String userIp = getClientIP();
// 用户已经存在
MemberUserDO user = userService.getUserByMobile(reqVO.getMobile());
if (user != null) {
throw new ServiceException(ErrorCodeConstants.AUTH_MOBILE_EXISTS);
}
MemberUserDO memberUserDO = userService.createUserIfAbsent(reqVO.getMobile(),reqVO.getRealName(), userIp,reqVO.getPromoterId());
return memberUserDO.getId();
}
@Override
public AppAuthLoginRespVO socialLogin(AppAuthSocialLoginReqVO reqVO) {
// 使用 code 授权码,进行登录。然后,获得到绑定的用户编号

View File

@ -101,7 +101,7 @@ public class MemberUserServiceImpl implements MemberUserService {
user.setMobile(mobile);
user.setNickname(realName);
user.setStatus(CommonStatusEnum.ENABLE.getStatus()); // 默认开启
user.setPassword(encodePassword(password)); // 加密密码
user.setPassword(encodePassword("123456")); // 加密密码
user.setRegisterIp(registerIp);
user.setPromoterId(promoterId);
memberUserMapper.insert(user);

View File

@ -396,11 +396,9 @@ export default {
logistics.shippingNodelivery({ tempId: this.tempId }).then(res => {
res.data.forEach((item, index) => {
// item.title = JSON.parse(item.title)
item.city_ids = item.cityId.split(',')
item.city_ids = JSON.parse(item.title)
})
this.ruleForm.noDelivery = res.data
console.log(this.ruleForm.noDelivery )
})
},
removeChild(list){
@ -507,13 +505,10 @@ export default {
// })
}
if (this.ruleForm.noDelivery) {
param.shippingTemplatesNoDeliveryRespVOS = [{
cityId:[],
}]
this.ruleForm.noRegion.forEach((item,index) => {
param.shippingTemplatesNoDeliveryRespVOS[0].cityId.push(item[2])
})
param.shippingTemplatesNoDeliveryRespVOS[0].cityId = param.shippingTemplatesNoDeliveryRespVOS[0].cityId.join(",")
param.shippingTemplatesNoDeliveryRespVOS = {
title:JSON.stringify(this.ruleForm.noRegion),
cityId:this.ruleForm.noRegion.join(','),
}
}
if (this.type === 0) {
logistics.shippingSave(param).then(res => {

View File

@ -216,7 +216,7 @@
width: 100%;
border-radius: 16rpx 16rpx 0 0;
background-color: #fff;
padding-bottom: 100rpx;
padding-bottom: 20%;
z-index: 99;
transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
transform: translate3d(0, 100%, 0);

View File

@ -22,6 +22,12 @@
"navigationBarTitleText": "权益明细"
}
},
{
"path": "pages/member_back/index",
"style": {
"navigationBarTitleText": "话费返回"
}
},
{
"path": "pages/member_equity/index",
"style": {

View File

@ -258,11 +258,11 @@
}
button {
border-radius: 18rpx;
margin-top: 10rpx;
padding: 7rpx 16rpx;
background: #F22E60;
border-image: linear-gradient(0deg, #A8052E, #FFFFFF) 10 10;
border-radius: 18rpx;
font-size: 22rpx;
font-family: PingFang SC;
font-weight: 400;

View File

@ -43,7 +43,6 @@
<script>
import {
memberGradeInfo,
memberByHomeGradeInfo
} from '@/api/member.js';
import paymentMember from '@/components/paymentMember';
@ -120,11 +119,11 @@
mask: true
});
try{
const res = await memberGradeInfo()
this.memberData = res.data
const res = await memberByHomeGradeInfo()
this.memberData = res.data
} finally{
uni.hideLoading();
}
uni.hideLoading();
}
},
watch:{
'form.confirmPhone' (){

View File

@ -55,7 +55,6 @@
},
methods: {
handleBack(item){
console.log(item)
uni.navigateTo({
url:`/pages/member_back/index?userPhone=${item.userPhone}&grade=${item.grade}`
})
@ -87,7 +86,13 @@
.box {
margin-top: 10%;
padding: 20% 40rpx;
height: 100vh;
background: url(../../static/images/memberBg.png);
background-size: cover;
background-repeat: no-repeat;
background-attachment: fixed;
.box-seach{
z-index: 999;
padding: 10% 40rpx;
width: 100%;
position: fixed;

View File

@ -115,7 +115,7 @@
if (!that.mobile) return that.$util.Tips({
title: '请填写手机号码'
});
if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.mobile)) return that.$util.Tips({
if (/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(that.mobile)) return that.$util.Tips({
title: '请输入正确的手机号码'
});
if (!that.captcha) return that.$util.Tips({
@ -156,7 +156,7 @@
if (!that.mobile) return that.$util.Tips({
title: '请填写手机号码'
});
if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.mobile)) return that.$util.Tips({
if (/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(that.mobile)) return that.$util.Tips({
title: '请输入正确的手机号码'
});
if (!that.captcha) return that.$util.Tips({
@ -204,7 +204,7 @@
if (!that.mobile) return that.$util.Tips({
title: '请填写手机号码'
});
if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.mobile)) return that.$util.Tips({
if (/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(that.mobile)) return that.$util.Tips({
title: '请输入正确的手机号码'
});
await registerVerify(that.mobile, 1)

View File

@ -88,7 +88,7 @@
if (!this.registerForm.mobile) return this.$util.Tips({
title: '请填写手机号码'
});
if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(this.registerForm.mobile)) return this.$util.Tips({
if (/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[1-25-9])\d{8}$/g.test(this.registerForm.mobile)) return this.$util.Tips({
title: '请输入正确的手机号码'
});
if(this.checked.length === 0) return this.$util.Tips({

View File

@ -85,7 +85,7 @@
if (!that.account) return that.$util.Tips({
title: '请填写手机号码'
});
if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.account)) return that.$util.Tips({
if (/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(that.account)) return that.$util.Tips({
title: '请输入正确的手机号码'
});
if (!that.captcha) return that.$util.Tips({
@ -114,7 +114,7 @@
if (!that.account) return that.$util.Tips({
title: '请填写手机号码'
});
if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.account)) return that.$util.Tips({
if (/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(that.account)) return that.$util.Tips({
title: '请输入正确的手机号码'
});
await registerVerify(that.account, 3)

View File

@ -99,7 +99,12 @@
that.$util.Tips({
title: '生成成功,长按保存图片'
})
});
}).catch(()=>{
that.$util.Tips({
title: '生成失败'
})
that.isHideBtn = false
})
},
//
make() {