Merge branch 'master' of gitee.com:beijing_hongye_huicheng/lilishop into feature/pg
This commit is contained in:
@@ -119,7 +119,6 @@ public enum ResultCode {
|
||||
USER_OLD_PASSWORD_ERROR(20016, "旧密码不正确"),
|
||||
USER_COLLECTION_EXIST(20017, "无法重复收藏"),
|
||||
USER_GRADE_IS_DEFAULT(20018, "会员等级为默认会员等级"),
|
||||
DELETE_EXIST(20019, "无法重复收藏"),
|
||||
USER_NOT_BINDING(20020, "未绑定用户"),
|
||||
USER_AUTO_REGISTER_ERROR(20021, "自动注册失败,请稍后重试"),
|
||||
USER_OVERDUE_CONNECT_ERROR(20022, "授权信息已过期,请重新授权/登录"),
|
||||
|
||||
@@ -37,7 +37,7 @@ public class PointsGoods extends BasePromotion {
|
||||
private String pointsGoodsCategoryName;
|
||||
|
||||
@ApiModelProperty(value = "活动库存数量")
|
||||
private Long activeStock;
|
||||
private Integer activeStock;
|
||||
|
||||
@ApiModelProperty(value = "兑换积分")
|
||||
private Long points;
|
||||
|
||||
@@ -2,6 +2,8 @@ package cn.lili.modules.promotion.entity.vos.kanjia;
|
||||
|
||||
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.security.enums.UserEnums;
|
||||
import cn.lili.modules.promotion.entity.enums.PromotionStatusEnum;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@@ -53,10 +55,14 @@ public class KanjiaActivityGoodsParams implements Serializable {
|
||||
queryWrapper.eq("promotion_status", promotionStatus);
|
||||
}
|
||||
if (startTime != null) {
|
||||
queryWrapper.ge("start_time", new Date(startTime));
|
||||
queryWrapper.le("start_time", new Date(startTime));
|
||||
}
|
||||
if (endTime != null) {
|
||||
queryWrapper.le("end_time", new Date(endTime));
|
||||
queryWrapper.ge("end_time", new Date(endTime));
|
||||
}
|
||||
if (UserContext.getCurrentUser() != null && UserContext.getCurrentUser().getRole().equals(UserEnums.MEMBER)) {
|
||||
|
||||
queryWrapper.gt("stock", 0);
|
||||
}
|
||||
queryWrapper.eq("delete_flag", false);
|
||||
return queryWrapper;
|
||||
|
||||
@@ -281,7 +281,7 @@ public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> impleme
|
||||
*/
|
||||
@Override
|
||||
public void usedCoupon(String couponId, Integer usedNum) {
|
||||
CouponVO couponVO = checkStatus(couponId);
|
||||
CouponVO couponVO = this.mongoTemplate.findById(couponId, CouponVO.class);
|
||||
couponVO.setUsedNum(couponVO.getUsedNum() + usedNum);
|
||||
LambdaUpdateWrapper<Coupon> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(Coupon::getId, couponId);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package cn.lili.modules.promotion.serviceimpl;
|
||||
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.modules.member.entity.dos.MemberAddress;
|
||||
import cn.lili.modules.member.mapper.MemberAddressMapper;
|
||||
import cn.lili.modules.promotion.service.MemberAddressService;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@@ -14,8 +14,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 收货地址业务层实现
|
||||
*
|
||||
@@ -27,7 +25,7 @@ import java.util.List;
|
||||
public class MemberAddressServiceImpl extends ServiceImpl<MemberAddressMapper, MemberAddress> implements MemberAddressService {
|
||||
|
||||
@Override
|
||||
public IPage<MemberAddress> getAddressByMember(PageVO page,String memberId) {
|
||||
public IPage<MemberAddress> getAddressByMember(PageVO page, String memberId) {
|
||||
return this.page(PageUtil.initPage(page),
|
||||
new QueryWrapper<MemberAddress>()
|
||||
.eq("member_id", memberId));
|
||||
@@ -69,10 +67,6 @@ public class MemberAddressServiceImpl extends ServiceImpl<MemberAddressMapper, M
|
||||
public MemberAddress updateMemberAddress(MemberAddress memberAddress) {
|
||||
//判断当前地址是否为默认地址,如果为默认需要将其他的地址修改为非默认
|
||||
updateDefaultShippingAddress(memberAddress);
|
||||
//修改会员地址
|
||||
this.update(memberAddress,
|
||||
new QueryWrapper<MemberAddress>()
|
||||
.eq("id", memberAddress.getId()));
|
||||
return memberAddress;
|
||||
}
|
||||
|
||||
@@ -85,21 +79,21 @@ public class MemberAddressServiceImpl extends ServiceImpl<MemberAddressMapper, M
|
||||
/**
|
||||
* 修改会员默认收件地址
|
||||
*
|
||||
* @param shippingAddress 收件地址
|
||||
* @param memberAddress 收件地址
|
||||
*/
|
||||
private void updateDefaultShippingAddress(MemberAddress shippingAddress) {
|
||||
//校验此地址是否为第一个会员地址 如果是默认是会员默认地址
|
||||
List<MemberAddress> list = this.baseMapper.selectList(new QueryWrapper<MemberAddress>().eq("member_id", shippingAddress.getMemberId()));
|
||||
if (list.size() == 1) {
|
||||
shippingAddress.setIsDefault(true);
|
||||
}
|
||||
private void updateDefaultShippingAddress(MemberAddress memberAddress) {
|
||||
//如果不是默认地址不需要处理
|
||||
if (shippingAddress.getIsDefault()) {
|
||||
if (memberAddress.getIsDefault()) {
|
||||
//将会员的地址修改为非默认地址
|
||||
LambdaUpdateWrapper<MemberAddress> lambdaUpdateWrapper = Wrappers.lambdaUpdate();
|
||||
lambdaUpdateWrapper.set(MemberAddress::getIsDefault, false);
|
||||
lambdaUpdateWrapper.eq(MemberAddress::getMemberId, shippingAddress.getMemberId());
|
||||
lambdaUpdateWrapper.eq(MemberAddress::getMemberId, memberAddress.getMemberId());
|
||||
this.update(lambdaUpdateWrapper);
|
||||
|
||||
//修改会员地址
|
||||
this.update(memberAddress,
|
||||
new QueryWrapper<MemberAddress>()
|
||||
.eq("id", memberAddress.getId()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user