Merge branch 'master' of gitee.com:beijing_hongye_huicheng/lilishop into feature/pg

This commit is contained in:
OceansDeep
2021-06-21 16:10:06 +00:00
committed by Gitee
157 changed files with 1383 additions and 1137 deletions

View File

@@ -69,7 +69,7 @@ public class CategoryManagerController {
if (StringUtils.isNotEmpty(list)) {
throw new ServiceException(ResultCode.CATEGORY_NOT_EXIST);
}
// 非顶级分类
//非顶级分类
if (category.getParentId() != null && !category.getParentId().equals("0")) {
Category parent = categoryService.getById(category.getParentId());
if (parent == null) {
@@ -116,7 +116,7 @@ public class CategoryManagerController {
throw new ServiceException(ResultCode.CATEGORY_HAS_CHILDREN);
}
// 查询某商品分类的商品数量
//查询某商品分类的商品数量
Integer count = goodsService.getGoodsCountByCategory(id);
if (count > 0) {
throw new ServiceException(ResultCode.CATEGORY_HAS_GOODS);

View File

@@ -0,0 +1,45 @@
package cn.lili.controller.member;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.message.entity.dos.MemberMessage;
import cn.lili.modules.message.entity.dos.StoreMessage;
import cn.lili.modules.message.entity.vos.MemberMessageQueryVO;
import cn.lili.modules.message.entity.vos.StoreMessageQueryVO;
import cn.lili.modules.message.service.MemberMessageService;
import cn.lili.modules.message.service.StoreMessageService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 管理端,会员消息消息管理接口
*
* @author pikachu
* @date: 2020/12/6 16:09
*/
@Transactional
@RestController
@Api(tags = "管理端,会员消息消息管理接口")
@RequestMapping("/manager/message/member")
public class MemberMessageManagerController {
@Autowired
private MemberMessageService memberMessageService;
@GetMapping
@ApiOperation(value = "多条件分页获取")
public ResultMessage<IPage<MemberMessage>> getByCondition(MemberMessageQueryVO memberMessageQueryVO,
PageVO pageVo) {
IPage<MemberMessage> page = memberMessageService.getPage(memberMessageQueryVO, pageVo);
return ResultUtil.data(page);
}
}

View File

@@ -49,7 +49,7 @@ public class ManagerAuthenticationFilter extends BasicAuthenticationFilter {
//从header中获取jwt
String jwt = request.getHeader(SecurityEnum.HEADER_TOKEN.getValue());
// 如果没有token 则return
//如果没有token 则return
if (StrUtil.isBlank(jwt)) {
chain.doFilter(request, response);
return;
@@ -77,20 +77,20 @@ public class ManagerAuthenticationFilter extends BasicAuthenticationFilter {
} else {
//用户是否拥有权限判定œ
//获取数据权限
// if (request.getMethod().equals(RequestMethod.GET.name())) {
// if (!PatternMatchUtils.simpleMatch(permission.get(PermissionEnum.SUPER).toArray(new String[0]), request.getRequestURI()) ||
// PatternMatchUtils.simpleMatch(permission.get(PermissionEnum.QUERY).toArray(new String[0]), request.getRequestURI())) {
// if (request.getMethod().equals(RequestMethod.GET.name())) {
// if (!PatternMatchUtils.simpleMatch(permission.get(PermissionEnum.SUPER).toArray(new String[0]), request.getRequestURI()) ||
// PatternMatchUtils.simpleMatch(permission.get(PermissionEnum.QUERY).toArray(new String[0]), request.getRequestURI())) {
//
// ResponseUtil.output(response, ResponseUtil.resultMap(false, 401, "抱歉,您没有访问权限"));
// throw new NoPermissionException("权限不足");
// }
// } else {
// if (!PatternMatchUtils.simpleMatch(permission.get(PermissionEnum.SUPER).toArray(new String[0]), request.getRequestURI())) {
// ResponseUtil.output(response, ResponseUtil.resultMap(false, 401, "抱歉,您没有访问权限"));
// throw new NoPermissionException("权限不足");
// }
// } else {
// if (!PatternMatchUtils.simpleMatch(permission.get(PermissionEnum.SUPER).toArray(new String[0]), request.getRequestURI())) {
//
// ResponseUtil.output(response, ResponseUtil.resultMap(false, 401, "抱歉,您没有访问权限"));
// throw new NoPermissionException("权限不足");
// }
// }
// ResponseUtil.output(response, ResponseUtil.resultMap(false, 401, "抱歉,您没有访问权限"));
// throw new NoPermissionException("权限不足");
// }
// }
return;
}
}
@@ -113,7 +113,7 @@ public class ManagerAuthenticationFilter extends BasicAuthenticationFilter {
String json = claims.get(SecurityEnum.USER_CONTEXT.getValue()).toString();
AuthUser authUser = new Gson().fromJson(json, AuthUser.class);
// 校验redis中是否有权限
//校验redis中是否有权限
if (cache.hasKey(CachePrefix.ACCESS_TOKEN.getPrefix(UserEnums.MANAGER) + jwt)) {
//用户角色
List<GrantedAuthority> auths = new ArrayList<>();

View File

@@ -47,32 +47,32 @@ public class ManagerSecurityConfig extends WebSecurityConfigurerAdapter {
ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry = http
.authorizeRequests();
// 配置的url 不需要授权
//配置的url 不需要授权
for (String url : ignoredUrlsProperties.getUrls()) {
registry.antMatchers(url).permitAll();
}
registry
.and()
// 禁止网页iframe
//禁止网页iframe
.headers().frameOptions().disable()
.and()
.authorizeRequests()
// 任何请求
//任何请求
.anyRequest()
// 需要身份认证
//需要身份认证
.authenticated()
.and()
// 允许跨域
//允许跨域
.cors().configurationSource(corsConfigurationSource).and()
// 关闭跨站请求防护
//关闭跨站请求防护
.csrf().disable()
// 前后端分离采用JWT 不需要session
//前后端分离采用JWT 不需要session
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
// 自定义权限拒绝处理类
//自定义权限拒绝处理类
.exceptionHandling().accessDeniedHandler(accessDeniedHandler)
.and()
// 添加JWT认证过滤器
//添加JWT认证过滤器
.addFilter(new ManagerAuthenticationFilter(authenticationManager(), cache));
}

View File

@@ -58,13 +58,13 @@ class EsTest {
@Test
void searchGoods() {
EsGoodsSearchDTO goodsSearchDTO = new EsGoodsSearchDTO();
// goodsSearchDTO.setKeyword("黄");
// goodsSearchDTO.setKeyword("黄");
goodsSearchDTO.setProp("IETF_HTTP/3");
// goodsSearchDTO.setPrice("100_20000");
// goodsSearchDTO.setStoreCatId(1L);
// goodsSearchDTO.setBrandId(123L);
// goodsSearchDTO.setCategoryId(2L);
// goodsSearchDTO.setNameIds(Arrays.asList("1344113311566553088", "1344113367694729216"));
// goodsSearchDTO.setPrice("100_20000");
// goodsSearchDTO.setStoreCatId(1L);
// goodsSearchDTO.setBrandId(123L);
// goodsSearchDTO.setCategoryId(2L);
// goodsSearchDTO.setNameIds(Arrays.asList("1344113311566553088", "1344113367694729216"));
PageVO pageVo = new PageVO();
pageVo.setPageNumber(0);
pageVo.setPageSize(100);
@@ -73,25 +73,25 @@ class EsTest {
Page<EsGoodsIndex> esGoodsIndices = goodsSearchService.searchGoods(goodsSearchDTO, pageVo);
Assertions.assertNotNull(esGoodsIndices);
esGoodsIndices.getContent().forEach(System.out::println);
// esGoodsIndices.getContent().forEach(i -> {
// if (i.getPromotionMap() != null){
// String s = i.getPromotionMap().keySet().parallelStream().filter(j -> j.contains(PromotionTypeEnum.FULL_DISCOUNT.name())).findFirst().orElse(null);
// if (s != null) {
// FullDiscount basePromotion = (FullDiscount) i.getPromotionMap().get(s);
// System.out.println(basePromotion);
// }
// }
// });
// esGoodsIndices.getContent().forEach(i -> {
// if (i.getPromotionMap() != null){
// String s = i.getPromotionMap().keySet().parallelStream().filter(j -> j.contains(PromotionTypeEnum.FULL_DISCOUNT.name())).findFirst().orElse(null);
// if (s != null) {
// FullDiscount basePromotion = (FullDiscount) i.getPromotionMap().get(s);
// System.out.println(basePromotion);
// }
// }
// });
}
@Test
void aggregationSearch() {
EsGoodsSearchDTO goodsSearchDTO = new EsGoodsSearchDTO();
// goodsSearchDTO.setKeyword("电脑");
// goodsSearchDTO.setProp("颜色_故宫文创@版本_小新Pro13s");
// goodsSearchDTO.setCategoryId("2");
// goodsSearchDTO.setPrice("100_20000");
//goodsSearchDTO.setKeyword("电脑");
//goodsSearchDTO.setProp("颜色_故宫文创@版本_小新Pro13s");
// goodsSearchDTO.setCategoryId("2");
// goodsSearchDTO.setPrice("100_20000");
PageVO pageVo = new PageVO();
pageVo.setPageNumber(0);
pageVo.setPageSize(10);
@@ -154,60 +154,60 @@ class EsTest {
@Test
void updateIndex() {
// EsGoodsIndex goodsIndex = new EsGoodsIndex();
// goodsIndex.setId("121");
// goodsIndex.setBrandId("113");
// goodsIndex.setGoodsId("113");
// goodsIndex.setCategoryPath("0|1");
// goodsIndex.setBuyCount(100);
// goodsIndex.setCommentNum(100);
// goodsIndex.setGoodsName("惠普HP战66 三代AMD版14英寸轻薄笔记本电脑锐龙7nm 六核R5-4500U 16G 512G 400尼特高色域一年上门 ");
// goodsIndex.setGrade(100D);
// goodsIndex.setHighPraiseNum(100);
// goodsIndex.setIntro("I'd like a cup of tea, please");
// goodsIndex.setIsAuth("1");
// goodsIndex.setMarketEnable("1");
// goodsIndex.setMobileIntro("I want something cold to drink");
// goodsIndex.setPoint(100);
// goodsIndex.setPrice(100D);
// goodsIndex.setSelfOperated(true);
// goodsIndex.setStoreId("113");
// goodsIndex.setStoreName("惠普自营官方旗舰店");
// goodsIndex.setStoreCategoryPath("1");
// goodsIndex.setThumbnail("picture");
// goodsIndex.setSn("A113");
// Map<String, BasePromotion> promotionMap = new HashMap<>();
// Coupon coupon = new Coupon();
// coupon.setStoreId("113");
// coupon.setStoreName("惠普自营官方旗舰店");
// coupon.setPromotionStatus(PromotionStatusEnum.START.name());
// coupon.setReceivedNum(0);
// coupon.setConsumeLimit(11D);
// coupon.setCouponLimitNum(10);
// coupon.setCouponName("满11减10");
// coupon.setCouponType(CouponTypeEnum.PRICE.name());
// coupon.setGetType(CouponGetEnum.FREE.name());
// coupon.setPrice(10D);
// promotionMap.put(PromotionTypeEnum.COUPON.name(), coupon);
// goodsIndex.setPromotionMap(promotionMap);
// List<EsGoodsAttribute> esGoodsAttributeList = new ArrayList<>();
// EsGoodsAttribute attribute = new EsGoodsAttribute();
// attribute.setType(0);
// attribute.setName("颜色");
// attribute.setValue("14英寸");
// esGoodsAttributeList.add(attribute);
// esGoodsAttributeList.add(attribute);
// attribute = new EsGoodsAttribute();
// attribute.setName("版本");
// attribute.setValue("【战66新品】R5-4500 8G 256G");
// esGoodsAttributeList.add(attribute);
// attribute = new EsGoodsAttribute();
// attribute.setName("配置");
// attribute.setValue("i5 8G 512G 2G独显");
// esGoodsAttributeList.add(attribute);
// goodsIndex.setAttrList(esGoodsAttributeList);
// GoodsSku goodsSkuByIdFromCache = goodsSkuService.getGoodsSkuByIdFromCache("121");
// EsGoodsIndex goodsIndex = new EsGoodsIndex(goodsSkuByIdFromCache);
// EsGoodsIndex goodsIndex = new EsGoodsIndex();
// goodsIndex.setId("121");
// goodsIndex.setBrandId("113");
// goodsIndex.setGoodsId("113");
// goodsIndex.setCategoryPath("0|1");
// goodsIndex.setBuyCount(100);
// goodsIndex.setCommentNum(100);
// goodsIndex.setGoodsName("惠普HP战66 三代AMD版14英寸轻薄笔记本电脑锐龙7nm 六核R5-4500U 16G 512G 400尼特高色域一年上门 ");
// goodsIndex.setGrade(100D);
// goodsIndex.setHighPraiseNum(100);
// goodsIndex.setIntro("I'd like a cup of tea, please");
// goodsIndex.setIsAuth("1");
// goodsIndex.setMarketEnable("1");
// goodsIndex.setMobileIntro("I want something cold to drink");
// goodsIndex.setPoint(100);
// goodsIndex.setPrice(100D);
// goodsIndex.setSelfOperated(true);
// goodsIndex.setStoreId("113");
// goodsIndex.setStoreName("惠普自营官方旗舰店");
// goodsIndex.setStoreCategoryPath("1");
// goodsIndex.setThumbnail("picture");
// goodsIndex.setSn("A113");
// Map<String, BasePromotion> promotionMap = new HashMap<>();
// Coupon coupon = new Coupon();
// coupon.setStoreId("113");
// coupon.setStoreName("惠普自营官方旗舰店");
// coupon.setPromotionStatus(PromotionStatusEnum.START.name());
// coupon.setReceivedNum(0);
// coupon.setConsumeLimit(11D);
// coupon.setCouponLimitNum(10);
// coupon.setCouponName("满11减10");
// coupon.setCouponType(CouponTypeEnum.PRICE.name());
// coupon.setGetType(CouponGetEnum.FREE.name());
// coupon.setPrice(10D);
// promotionMap.put(PromotionTypeEnum.COUPON.name(), coupon);
// goodsIndex.setPromotionMap(promotionMap);
// List<EsGoodsAttribute> esGoodsAttributeList = new ArrayList<>();
// EsGoodsAttribute attribute = new EsGoodsAttribute();
// attribute.setType(0);
// attribute.setName("颜色");
// attribute.setValue("14英寸");
// esGoodsAttributeList.add(attribute);
// esGoodsAttributeList.add(attribute);
// attribute = new EsGoodsAttribute();
// attribute.setName("版本");
// attribute.setValue("【战66新品】R5-4500 8G 256G");
// esGoodsAttributeList.add(attribute);
// attribute = new EsGoodsAttribute();
// attribute.setName("配置");
// attribute.setValue("i5 8G 512G 2G独显");
// esGoodsAttributeList.add(attribute);
// goodsIndex.setAttrList(esGoodsAttributeList);
// GoodsSku goodsSkuByIdFromCache = goodsSkuService.getGoodsSkuByIdFromCache("121");
// EsGoodsIndex goodsIndex = new EsGoodsIndex(goodsSkuByIdFromCache);
EsGoodsIndex byId = esGoodsIndexService.findById("121");
byId.setPromotionMap(null);
esGoodsIndexService.updateIndex(byId);

View File

@@ -21,12 +21,12 @@ class OrderServiceTest {
@Test
void QueryParam() {
// OrderSearchParams orderSearchParams = new OrderSearchParams();
// orderSearchParams.setPageSize(0);
// orderSearchParams.setPageNumber(10);
// IPage<OrderSimpleVO> orderVOIPage = orderService.queryByParams(orderSearchParams);
// Assertions.assertNotNull(orderVOIPage);
// orderVOIPage.getRecords().forEach(System.out::println);
// OrderSearchParams orderSearchParams = new OrderSearchParams();
// orderSearchParams.setPageSize(0);
// orderSearchParams.setPageNumber(10);
// IPage<OrderSimpleVO> orderVOIPage = orderService.queryByParams(orderSearchParams);
// Assertions.assertNotNull(orderVOIPage);
// orderVOIPage.getRecords().forEach(System.out::println);
}

View File

@@ -50,14 +50,14 @@ class CouponTest {
couponVO.setDescription(couponVO.getCouponName() + " are expensive");
couponVO.setGetType(CouponGetEnum.FREE.name());
couponVO.setPromotionStatus(PromotionStatusEnum.NEW.name());
// couponVO.setStoreId("0");
// couponVO.setStoreName("platform");
// couponVO.setStoreId("0");
// couponVO.setStoreName("platform");
couponVO.setStoreId("131");
couponVO.setStoreName("小米自营旗舰店");
couponVO.setPublishNum(1000);
couponVO.setCouponLimitNum(0);
couponVO.setConsumeThreshold(500D);
// couponVO.setPrice(200D);
// couponVO.setPrice(200D);
couponVO.setCouponDiscount(0.1D);
couponVO.setScopeType(CouponScopeTypeEnum.PORTION_GOODS.name());
@@ -71,7 +71,7 @@ class CouponTest {
couponVO.setPromotionName(couponVO.getPrice() + "元券");
}
List<PromotionGoods> promotionGoodsList = new ArrayList<>();
// GoodsSku sku121 = goodsSkuService.getGoodsSkuByIdFromCache("121");
// GoodsSku sku121 = goodsSkuService.getGoodsSkuByIdFromCache("121");
PromotionGoods promotionGoods = new PromotionGoods();
promotionGoods.setPrice(0.0);
promotionGoods.setLimitNum(0);
@@ -85,17 +85,17 @@ class CouponTest {
promotionGoods.setPromotionType(PromotionTypeEnum.COUPON.name());
promotionGoodsList.add(promotionGoods);
//
// GoodsSku sku50112 = goodsSkuService.getGoodsSkuByIdFromCache("50112");
// promotionGoods = new PromotionGoods(sku50112);
// promotionGoods.setPrice(80000d);
// promotionGoods.setLimitNum(0);
// promotionGoods.setPromotionQuantity(1000);
// promotionGoods.setNum(1000);
// promotionGoods.setStartTime(couponVO.getStartTime());
// promotionGoods.setEndTime(couponVO.getEndTime());
// promotionGoods.setTitle(couponVO.getPromotionName());
// promotionGoods.setPromotionStatus(couponVO.getPromotionStatus());
// promotionGoodsList.add(promotionGoods);
// GoodsSku sku50112 = goodsSkuService.getGoodsSkuByIdFromCache("50112");
// promotionGoods = new PromotionGoods(sku50112);
// promotionGoods.setPrice(80000d);
// promotionGoods.setLimitNum(0);
// promotionGoods.setPromotionQuantity(1000);
// promotionGoods.setNum(1000);
// promotionGoods.setStartTime(couponVO.getStartTime());
// promotionGoods.setEndTime(couponVO.getEndTime());
// promotionGoods.setTitle(couponVO.getPromotionName());
// promotionGoods.setPromotionStatus(couponVO.getPromotionStatus());
// promotionGoodsList.add(promotionGoods);
//
couponVO.setPromotionGoodsList(promotionGoodsList);
Assertions.assertNotNull(couponService.add(couponVO));
@@ -192,7 +192,7 @@ class CouponTest {
@Test
void delete() {
// Assertions.assertTrue(couponService.deleteCoupon("1326001296591577088"));
// Assertions.assertTrue(couponService.deleteCoupon("1326001296591577088"));
GoodsStatusEnum goodsStatusEnum = GoodsStatusEnum.DOWN;
System.out.println("name:: " + goodsStatusEnum.name());
System.out.println("description:: " + goodsStatusEnum.description());

View File

@@ -88,7 +88,7 @@ class FullDiscountTest {
Assertions.assertNotNull(fullDiscountByPageFromMongo);
FullDiscount fullDiscount = JSONUtil.toBean(JSONUtil.parseObj(fullDiscountByPageFromMongo.getPages()), FullDiscount.class);
System.out.println(fullDiscount);
// fullDiscountByPageFromMongo.forEach(System.out::println);
// fullDiscountByPageFromMongo.forEach(System.out::println);
}
@Test