xiaoqiang пре 4 година
родитељ
комит
32aeb73fb3

+ 3 - 1
src/main/java/org/springblade/gateway/active_gateway/service/impl/ProductSortServiceImpl.java

@@ -1,5 +1,6 @@
 package org.springblade.gateway.active_gateway.service.impl;
 
+import cn.hutool.core.util.DesensitizedUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -73,7 +74,8 @@ public class ProductSortServiceImpl implements ProductSortService {
 					LoginUser loginUser = loginUserService.getOne(new LambdaQueryWrapper<LoginUser>().eq(LoginUser::getPhone,productRecord.getPhone()));
 
 					if (loginUser != null){
-						activeProductRecordVO.setUsername(loginUser.getNickName());
+
+						activeProductRecordVO.setUsername(DesensitizedUtil.mobilePhone(loginUser.getNickName()));
 
 						activeProductRecordVO.setUserImg(loginUser.getAvatar());
 					}

+ 2 - 1
src/main/java/org/springblade/gateway/point_gateway/controller/PointExchangeController.java

@@ -40,10 +40,11 @@ public class PointExchangeController {
 	@ApiOperation("积分兑换")
 	public R<Boolean> exchange(@ApiParam(value = "兑换类型",required = true) @RequestParam Integer type,
 							   @ApiParam(value = "手机号",required = true) @RequestParam String phone,
+							   @ApiParam(value = "活动id",required = true) @RequestParam Long activeId,
 							   @ApiParam(value = "兑换数量",required = true) @RequestParam Long num,
 							   @ApiParam(value = "商品ID",required = true) @RequestParam Long goodsId,
 						   @ApiParam(value = "收获地址ID",required = false) @RequestParam Long addressId){
-		return R.status(pointExchangeService.exchange(type,phone,goodsId,addressId,num));
+		return R.status(pointExchangeService.exchange(type,phone,goodsId,addressId,num,activeId));
 	}
 
 

+ 35 - 0
src/main/java/org/springblade/gateway/point_gateway/controller/PointGoodsByAIdController.java

@@ -0,0 +1,35 @@
+package org.springblade.gateway.point_gateway.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiParam;
+import lombok.AllArgsConstructor;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.sing.goods.entity.PointGoods;
+import org.springblade.sing.goods.service.IPointGoodsService;
+import org.springblade.sing.goods.vo.PointGoodsVO;
+import org.springblade.sing.goods.wrapper.PointGoodsWrapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+@RestController
+@AllArgsConstructor
+@RequestMapping("sing_goods/pointgoods")
+@Api(value = "积分商城", tags = "积分商城接口")
+public class PointGoodsByAIdController {
+
+	@Autowired
+	private IPointGoodsService pointGoodsService;
+
+	@GetMapping("/queryList")
+	public R<IPage<PointGoodsVO>> orderList(@ApiParam(value = "活动id",required = true) @RequestParam Long activeId, Query query){
+		IPage<PointGoods> pages = pointGoodsService.queryList(activeId, query);
+		return R.data(PointGoodsWrapper.build().pageVO(pages));
+	}
+}

+ 1 - 1
src/main/java/org/springblade/gateway/point_gateway/service/PointExchangeService.java

@@ -10,6 +10,6 @@ public interface PointExchangeService {
 	 * @param num 兑换数量
 	 * @return
 	 */
-	boolean exchange(Integer type,String phone, Long goodsId, Long addressId,Long num);
+	boolean exchange(Integer type,String phone, Long goodsId, Long addressId,Long num,Long activeId);
 }
 

+ 3 - 2
src/main/java/org/springblade/gateway/point_gateway/service/impl/PointExchangeServiceImpl.java

@@ -3,6 +3,7 @@ package org.springblade.gateway.point_gateway.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import io.jsonwebtoken.lang.Assert;
 import org.springblade.common.enums.AppConstant;
+import org.springblade.core.tool.utils.StringUtil;
 import org.springblade.gateway.point_gateway.enums.PointTypeEnum;
 import org.springblade.gateway.point_gateway.excetion.PointException;
 import org.springblade.gateway.point_gateway.service.PointExchangeService;
@@ -40,14 +41,14 @@ public class PointExchangeServiceImpl implements PointExchangeService {
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public boolean exchange(Integer type,String phone, Long goodsId, Long addressId ,Long num) {
-		System.out.println(phone);
+	public boolean exchange(Integer type,String phone, Long goodsId, Long addressId ,Long num,Long activeId) {
 		UserPufaPoint user = userPufaPointService.getOne(new LambdaQueryWrapper<UserPufaPoint>().eq(UserPufaPoint::getPhone,phone));
 		Assert.notNull(user,"用户不存在");
 		PointGoods goods = pointGoodsService.getById(goodsId);
 		Assert.notNull(goods,"商品不存在");
 		UserAddress address = userAddressService.getById(addressId);
 		Assert.notNull(address,"请添加收货地址");
+		Assert.notNull(activeId,"兑换失败");
 
 		Boolean isLimit = Optional.ofNullable(goods.getIsLimit()).orElse(false);
 		if (isLimit){

+ 1 - 1
src/main/java/org/springblade/sing/goods/controller/PointGoodsController.java

@@ -71,7 +71,7 @@ public class PointGoodsController extends BladeController {
 	@ApiOperationSupport(order = 2)
 	@ApiOperation(value = "分页", notes = "传入pointGoods")
 	public R<IPage<PointGoodsVO>> list(PointGoods pointGoods, Query query) {
-		IPage<PointGoods> pages = pointGoodsService.page(Condition.getPage(query), Condition.getQueryWrapper(pointGoods));
+		IPage<PointGoods> pages = pointGoodsService.page(Condition.getPage(query),Condition.getQueryWrapper(pointGoods));
 		return R.data(PointGoodsWrapper.build().pageVO(pages));
 	}
 

+ 10 - 0
src/main/java/org/springblade/sing/goods/service/IPointGoodsService.java

@@ -16,11 +16,14 @@
  */
 package org.springblade.sing.goods.service;
 
+import org.springblade.core.mp.support.Query;
 import org.springblade.sing.goods.entity.PointGoods;
 import org.springblade.sing.goods.vo.PointGoodsVO;
 import org.springblade.core.mp.base.BaseService;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 
+import java.util.List;
+
 /**
  * 积分商城 服务类
  *
@@ -38,4 +41,11 @@ public interface IPointGoodsService extends BaseService<PointGoods> {
 	 */
 	IPage<PointGoodsVO> selectPointGoodsPage(IPage<PointGoodsVO> page, PointGoodsVO pointGoods);
 
+	/**
+	 * 积分商城列表
+	 *
+	 * @param activeId 活动id
+	 * @return
+	 */
+    IPage<PointGoods> queryList(Long activeId, Query query);
 }

+ 23 - 0
src/main/java/org/springblade/sing/goods/service/impl/PointGoodsServiceImpl.java

@@ -16,6 +16,10 @@
  */
 package org.springblade.sing.goods.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.tool.utils.StringUtil;
 import org.springblade.sing.goods.entity.PointGoods;
 import org.springblade.sing.goods.vo.PointGoodsVO;
 import org.springblade.sing.goods.mapper.PointGoodsMapper;
@@ -23,6 +27,11 @@ import org.springblade.sing.goods.service.IPointGoodsService;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.core.mp.support.Query;
+import org.springframework.util.Assert;
+
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * 积分商城 服务实现类
@@ -38,4 +47,18 @@ public class PointGoodsServiceImpl extends BaseServiceImpl<PointGoodsMapper, Poi
 		return page.setRecords(baseMapper.selectPointGoodsPage(page, pointGoods));
 	}
 
+    @Override
+    public IPage<PointGoods> queryList(Long activeId,Query query) {
+		LambdaQueryWrapper<PointGoods> wrapper = new LambdaQueryWrapper<PointGoods>().eq(PointGoods::getActiveId, activeId);
+
+		List<PointGoods> goods = baseMapper.selectList(wrapper);
+		Assert.isNull(goods,"此活动没有可兑换商品");
+
+		IPage<PointGoods> pointGoodsIpage = new Page<>(query.getCurrent(),query.getSize());
+
+
+		return super.page(pointGoodsIpage,wrapper);
+
+    }
+
 }