!33 修复文章获取内容转义,限时抢购无参加商品不开启,商品搜索报错
Merge pull request !33 from OceansDeep/feature/pg
This commit is contained in:
		
						commit
						1de4dea1fb
					
				| @ -1,7 +1,9 @@ | ||||
| package cn.lili.modules.page.entity.dos; | ||||
| 
 | ||||
| import cn.lili.mybatis.BaseEntity; | ||||
| import cn.hutool.core.text.CharSequenceUtil; | ||||
| import cn.hutool.http.HtmlUtil; | ||||
| import cn.lili.modules.page.entity.enums.ArticleEnum; | ||||
| import cn.lili.mybatis.BaseEntity; | ||||
| import com.baomidou.mybatisplus.annotation.TableName; | ||||
| import io.swagger.annotations.ApiModel; | ||||
| import io.swagger.annotations.ApiModelProperty; | ||||
| @ -47,4 +49,12 @@ public class Article extends BaseEntity { | ||||
|      */ | ||||
|     @ApiModelProperty(value = "类型") | ||||
|     private String type; | ||||
| 
 | ||||
|     public String getContent() { | ||||
|         if (CharSequenceUtil.isNotEmpty(content)) { | ||||
|             return HtmlUtil.unescape(content); | ||||
|         } | ||||
|         return content; | ||||
|     } | ||||
| 
 | ||||
| } | ||||
| @ -398,42 +398,42 @@ public class PromotionServiceImpl implements PromotionService { | ||||
|         seckill.setPromotionStatus(promotionMessage.getPromotionStatus()); | ||||
|         result = this.seckillService.update(updateWrapper(promotionMessage)); | ||||
|         log.info("更新限时抢购活动状态:{}", seckill); | ||||
|         //判断参与活动的商品是否为空,如果为空则返回 | ||||
|         if (seckill.getSeckillApplyList() == null) { | ||||
|             return result; | ||||
|         } | ||||
| 
 | ||||
|         //循环秒杀商品数据,将数据按照时间段进行存储 | ||||
|         for (SeckillApply seckillApply : seckill.getSeckillApplyList()) { | ||||
|             if (seckillApply.getPromotionApplyStatus().equals(PromotionApplyStatusEnum.PASS.name())) { | ||||
|                 //下一个时间,默认为当天结束时间 | ||||
|                 int nextHour = 23; | ||||
|                 String[] split = seckill.getHours().split(","); | ||||
|                 int[] hoursSored = Arrays.stream(split).mapToInt(Integer::parseInt).toArray(); | ||||
|                 //排序时间段 | ||||
|                 Arrays.sort(hoursSored); | ||||
|                 for (int i : hoursSored) { | ||||
|                     //如果当前时间段大于排序后的时间段的某个,当前时间段的下个时间段即为排序后的时间段的某个 | ||||
|                     if (seckillApply.getTimeLine() < i) { | ||||
|                         nextHour = i; | ||||
|                         break; | ||||
|         //判断参与活动的商品是否为空 | ||||
|         if (seckill.getSeckillApplyList() != null && !seckill.getSeckillApplyList().isEmpty()) { | ||||
|             //循环秒杀商品数据,将数据按照时间段进行存储 | ||||
|             for (SeckillApply seckillApply : seckill.getSeckillApplyList()) { | ||||
|                 if (seckillApply.getPromotionApplyStatus().equals(PromotionApplyStatusEnum.PASS.name())) { | ||||
|                     //下一个时间,默认为当天结束时间 | ||||
|                     int nextHour = 23; | ||||
|                     String[] split = seckill.getHours().split(","); | ||||
|                     int[] hoursSored = Arrays.stream(split).mapToInt(Integer::parseInt).toArray(); | ||||
|                     //排序时间段 | ||||
|                     Arrays.sort(hoursSored); | ||||
|                     for (int i : hoursSored) { | ||||
|                         //如果当前时间段大于排序后的时间段的某个,当前时间段的下个时间段即为排序后的时间段的某个 | ||||
|                         if (seckillApply.getTimeLine() < i) { | ||||
|                             nextHour = i; | ||||
|                             break; | ||||
|                         } | ||||
|                     } | ||||
|                     Seckill seckill1 = JSONUtil.toBean(JSONUtil.toJsonStr(seckill), Seckill.class); | ||||
|                     String format = DateUtil.format(seckill.getStartTime(), cn.lili.common.utils.DateUtil.STANDARD_DATE_FORMAT); | ||||
|                     DateTime parseStartTime = DateUtil.parse((format + " " + seckillApply.getTimeLine()), "yyyy-MM-dd HH"); | ||||
|                     DateTime parseEndTime = DateUtil.parse((format + " " + nextHour), "yyyy-MM-dd HH"); | ||||
|                     //如果是当天最后的时间段则设置到当天结束时间的59分59秒 | ||||
|                     if (nextHour == seckillApply.getTimeLine()) { | ||||
|                         parseEndTime = DateUtil.parse((format + " " + nextHour + ":59:59"), cn.lili.common.utils.DateUtil.STANDARD_FORMAT); | ||||
|                     } | ||||
|                     seckill1.setStartTime(parseStartTime); | ||||
|                     //当时商品的秒杀活动活动结束时间为下个时间段的开始 | ||||
|                     seckill1.setEndTime(parseEndTime); | ||||
|                     log.info("更新限时抢购商品状态:{}", seckill1); | ||||
|                     this.goodsIndexService.updateEsGoodsIndex(seckillApply.getSkuId(), seckill1, promotionTypeEnum.name() + "-" + seckillApply.getTimeLine(), seckillApply.getPrice()); | ||||
|                 } | ||||
|                 Seckill seckill1 = JSONUtil.toBean(JSONUtil.toJsonStr(seckill), Seckill.class); | ||||
|                 String format = DateUtil.format(seckill.getStartTime(), cn.lili.common.utils.DateUtil.STANDARD_DATE_FORMAT); | ||||
|                 DateTime parseStartTime = DateUtil.parse((format + " " + seckillApply.getTimeLine()), "yyyy-MM-dd HH"); | ||||
|                 DateTime parseEndTime = DateUtil.parse((format + " " + nextHour), "yyyy-MM-dd HH"); | ||||
|                 //如果是当天最后的时间段则设置到当天结束时间的59分59秒 | ||||
|                 if (nextHour == seckillApply.getTimeLine()) { | ||||
|                     parseEndTime = DateUtil.parse((format + " " + nextHour + ":59:59"), cn.lili.common.utils.DateUtil.STANDARD_FORMAT); | ||||
|                 } | ||||
|                 seckill1.setStartTime(parseStartTime); | ||||
|                 //当时商品的秒杀活动活动结束时间为下个时间段的开始 | ||||
|                 seckill1.setEndTime(parseEndTime); | ||||
|                 log.info("更新限时抢购商品状态:{}", seckill1); | ||||
|                 this.goodsIndexService.updateEsGoodsIndex(seckillApply.getSkuId(), seckill1, promotionTypeEnum.name() + "-" + seckillApply.getTimeLine(), seckillApply.getPrice()); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         this.mongoTemplate.save(seckill); | ||||
|         return result; | ||||
|     } | ||||
|  | ||||
| @ -164,15 +164,16 @@ public class EsGoodsSearchServiceImpl implements EsGoodsSearchService { | ||||
|                 } | ||||
|                 String[] split = ArrayUtil.distinct(categoryPath.split(",")); | ||||
|                 String[] nameSplit = categoryNamePath.split(","); | ||||
|                 for (int i = 0; i < split.length; i++) { | ||||
|                     SelectorOptions so = new SelectorOptions(); | ||||
|                     so.setName(nameSplit[i]); | ||||
|                     so.setValue(split[i]); | ||||
|                     if (!categoryOptions.contains(so)) { | ||||
|                         categoryOptions.add(so); | ||||
|                 if (split.length == nameSplit.length) { | ||||
|                     for (int i = 0; i < split.length; i++) { | ||||
|                         SelectorOptions so = new SelectorOptions(); | ||||
|                         so.setName(nameSplit[i]); | ||||
|                         so.setValue(split[i]); | ||||
|                         if (!categoryOptions.contains(so)) { | ||||
|                             categoryOptions.add(so); | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
| 
 | ||||
|             } | ||||
|         } | ||||
|         esGoodsRelatedInfo.setCategories(categoryOptions); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 OceansDeep
						OceansDeep