forked from lilishop/lilishop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
热词功能,管理端权限存在的问题处理 # Conflicts: # framework/src/main/java/cn/lili/modules/order/order/serviceimpl/StoreFlowServiceImpl.java # framework/src/main/java/cn/lili/modules/search/serviceimpl/EsGoodsSearchServiceImpl.java # manager-api/src/main/java/cn/lili/controller/hotwords/HotWordsManagerController.java
- Loading branch information
Showing
26 changed files
with
714 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,18 @@ | ||
/** 增加签到日期 **/ | ||
ALTER TABLE li_member_sign ADD day int DEFAULT NULL COMMENT '签到日 '; | ||
ALTER TABLE li_member_sign DROP INDEX uk_member_day; | ||
ALTER TABLE li_member_sign add unique uk_member_day (member_id, day) COMMENT 'uk_member_day'; | ||
ALTER TABLE li_member_sign add unique uk_member_day (member_id, day) COMMENT 'uk_member_day'; | ||
|
||
|
||
|
||
-- ---------------------------- | ||
-- Table structure for li_hot_words_history | ||
-- ---------------------------- | ||
DROP TABLE IF EXISTS `li_hot_words_history`; | ||
CREATE TABLE `li_hot_words_history` ( | ||
`id` bigint NOT NULL COMMENT 'ID', | ||
`create_time` datetime(6) DEFAULT NULL COMMENT '创建时间', | ||
`keywords` varchar(255) COLLATE utf8_bin DEFAULT NULL COMMENT '热词', | ||
`score` int DEFAULT NULL COMMENT '热词分数', | ||
PRIMARY KEY (`id`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_bin; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
framework/src/main/java/cn/lili/modules/search/entity/dos/HotWordsHistory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package cn.lili.modules.search.entity.dos; | ||
|
||
import cn.lili.mybatis.BaseIdEntity; | ||
import com.baomidou.mybatisplus.annotation.TableName; | ||
import com.fasterxml.jackson.annotation.JsonFormat; | ||
import io.swagger.annotations.ApiModelProperty; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import org.springframework.format.annotation.DateTimeFormat; | ||
|
||
import java.io.Serializable; | ||
import java.util.Date; | ||
|
||
/** | ||
* HotWordsHistory | ||
* | ||
* @author Chopper | ||
* @version v1.0 | ||
* 2022-04-14 09:39 | ||
*/ | ||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@TableName("li_hot_words_history") | ||
public class HotWordsHistory extends BaseIdEntity implements Comparable<HotWordsHistory>, Serializable { | ||
|
||
/** | ||
* 词 | ||
*/ | ||
private String keywords; | ||
|
||
/** | ||
* 分数 | ||
*/ | ||
private Integer score; | ||
|
||
@ApiModelProperty(value = "创建时间") | ||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | ||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") | ||
private Date createTime; | ||
|
||
public HotWordsHistory(String keywords, Integer score) { | ||
this.keywords = keywords; | ||
this.score = score; | ||
} | ||
|
||
@Override | ||
public int compareTo(HotWordsHistory hotWordsHistory) { | ||
return hotWordsHistory.getScore() - this.score; | ||
} | ||
} |
83 changes: 83 additions & 0 deletions
83
framework/src/main/java/cn/lili/modules/search/entity/dto/HotWordsSearchParams.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
package cn.lili.modules.search.entity.dto; | ||
|
||
import cn.hutool.core.text.CharSequenceUtil; | ||
import cn.lili.common.utils.StringUtils; | ||
import cn.lili.common.vo.PageVO; | ||
import cn.lili.modules.goods.entity.enums.GoodsAuthEnum; | ||
import cn.lili.modules.goods.entity.enums.GoodsStatusEnum; | ||
import cn.lili.modules.statistics.entity.dto.StatisticsQueryParam; | ||
import cn.lili.modules.statistics.util.StatisticsDateUtil; | ||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||
import io.swagger.annotations.ApiModelProperty; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import org.springframework.beans.BeanUtils; | ||
|
||
import javax.validation.constraints.NotNull; | ||
import java.util.Arrays; | ||
import java.util.Calendar; | ||
import java.util.Date; | ||
|
||
/** | ||
* 商品查询条件 | ||
* | ||
* @author pikachu | ||
* @since 2020-02-24 19:27:20 | ||
*/ | ||
@EqualsAndHashCode(callSuper = true) | ||
@Data | ||
public class HotWordsSearchParams extends PageVO { | ||
|
||
private static final long serialVersionUID = 2544015852728566887L; | ||
|
||
@NotNull(message = "搜索热词不能为空") | ||
@ApiModelProperty(value = "热词") | ||
private String keywords; | ||
|
||
@ApiModelProperty(value = "快捷搜索", allowableValues = "TODAY, YESTERDAY, LAST_SEVEN, LAST_THIRTY") | ||
private String searchType; | ||
|
||
@ApiModelProperty(value = "类型:年(YEAR)、月(MONTH)") | ||
private String timeType; | ||
|
||
@ApiModelProperty(value = "年份") | ||
private Integer year; | ||
|
||
@ApiModelProperty(value = "月份") | ||
private Integer month; | ||
|
||
|
||
//临时参数 不作为前端传递 | ||
private Date startTIme; | ||
|
||
private Date endTime; | ||
|
||
//搜索热词数量 | ||
private Integer top = 50; | ||
|
||
public <T> QueryWrapper<T> queryWrapper() { | ||
//组织查询时间 | ||
QueryWrapper<T> queryWrapper = new QueryWrapper<>(); | ||
StatisticsQueryParam statisticsQueryParam = new StatisticsQueryParam(); | ||
BeanUtils.copyProperties(this, statisticsQueryParam); | ||
Date[] dates = StatisticsDateUtil.getDateArray(statisticsQueryParam); | ||
|
||
//获取当前时间 | ||
Calendar calendar = Calendar.getInstance(); | ||
|
||
|
||
calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH), 0, 0, 0); | ||
calendar.set(Calendar.MILLISECOND, 0); | ||
|
||
if (StringUtils.isNotEmpty(keywords)) { | ||
queryWrapper.like("keywords", keywords); | ||
} | ||
queryWrapper.between("create_time", dates[0], dates[1]); | ||
|
||
startTIme = dates[0]; | ||
endTime = dates[1]; | ||
|
||
return queryWrapper; | ||
} | ||
|
||
} |
33 changes: 33 additions & 0 deletions
33
framework/src/main/java/cn/lili/modules/search/entity/vo/HotWordsHistoryVO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package cn.lili.modules.search.entity.vo; | ||
|
||
import com.fasterxml.jackson.annotation.JsonFormat; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
|
||
import java.util.Date; | ||
|
||
/** | ||
* 在线会员 | ||
* | ||
* @author Chopper | ||
* @since 2021-02-21 09:59 | ||
*/ | ||
@Data | ||
public class HotWordsHistoryVO { | ||
|
||
/** | ||
* 时间 | ||
*/ | ||
private Date createTime; | ||
|
||
/** | ||
* 词 | ||
*/ | ||
private String keywords; | ||
|
||
/** | ||
* 分数 | ||
*/ | ||
private Integer score; | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
framework/src/main/java/cn/lili/modules/search/mapper/HotWordsHistoryMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package cn.lili.modules.search.mapper; | ||
|
||
import cn.lili.modules.search.entity.dos.CustomWords; | ||
import cn.lili.modules.search.entity.dos.HotWordsHistory; | ||
import cn.lili.modules.search.entity.vo.HotWordsHistoryVO; | ||
import cn.lili.modules.statistics.entity.vo.OrderStatisticsDataVO; | ||
import com.baomidou.mybatisplus.core.conditions.Wrapper; | ||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
import com.baomidou.mybatisplus.core.toolkit.Constants; | ||
import org.apache.ibatis.annotations.Param; | ||
import org.apache.ibatis.annotations.Select; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* 搜索热词历史记录数据处理层 | ||
* | ||
* @author paulG | ||
* @since 2020/10/15 | ||
**/ | ||
public interface HotWordsHistoryMapper extends BaseMapper<HotWordsHistory> { | ||
|
||
/** | ||
* 获取订单统计数据 | ||
* | ||
* @param queryWrapper 查询条件 | ||
* @return 订单统计列表 | ||
*/ | ||
@Select("SELECT sum(score) as score,keywords FROM li_hot_words_history " +" ${ew.customSqlSegment}") | ||
List<HotWordsHistory> statistics(@Param(Constants.WRAPPER) Wrapper queryWrapper); | ||
|
||
} |
Oops, something went wrong.