Merge branch 'hotwords'
热词功能,管理端权限存在的问题处理 # 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
This commit is contained in:
@@ -1,54 +0,0 @@
|
||||
package cn.lili.controller.hotwords;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.search.entity.dto.HotWordsDTO;
|
||||
import cn.lili.modules.search.service.EsGoodsSearchService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 管理端,app版本控制器
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2018-07-04 21:50:52
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,系统设置扩展接口")
|
||||
@RequestMapping("/manager/hotwords/hotwords")
|
||||
public class HotWordsManagerController {
|
||||
|
||||
@Autowired
|
||||
private EsGoodsSearchService esGoodsSearchService;
|
||||
|
||||
@ApiOperation(value = "获取热词")
|
||||
@GetMapping
|
||||
public ResultMessage<Object> getHotWords() {
|
||||
return ResultUtil.data(esGoodsSearchService.getHotWords(100));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "设置热词")
|
||||
@PostMapping
|
||||
public ResultMessage<Object> paymentForm(@Validated HotWordsDTO hotWords) {
|
||||
esGoodsSearchService.setHotWords(hotWords);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除热词")
|
||||
@DeleteMapping("/{words}")
|
||||
public ResultMessage<Object> deleteWords(@PathVariable String words) {
|
||||
esGoodsSearchService.deleteHotWords(words);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除全部热词")
|
||||
@DeleteMapping("")
|
||||
public ResultMessage<Object> deleteWordsAll() {
|
||||
esGoodsSearchService.deleteHotWords(null);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package cn.lili.controller.other;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.search.entity.dos.HotWordsHistory;
|
||||
import cn.lili.modules.search.entity.dto.HotWordsDTO;
|
||||
import cn.lili.modules.search.entity.dto.HotWordsSearchParams;
|
||||
import cn.lili.modules.search.service.HotWordsHistoryService;
|
||||
import cn.lili.modules.search.service.HotWordsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.Data;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理端,热词管理
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2018-07-04 21:50:52
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "管理端,热词管理")
|
||||
@RequestMapping("/manager/hotwords/hotwords")
|
||||
public class HotWordsManagerController {
|
||||
|
||||
@Autowired
|
||||
private HotWordsService hotWordsService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private HotWordsHistoryService hotWordsHistoryService;
|
||||
|
||||
@ApiOperation(value = "获取热词")
|
||||
@GetMapping
|
||||
public ResultMessage<Object> getHotWords() {
|
||||
return ResultUtil.data(hotWordsService.getHotWords(100));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "设置热词")
|
||||
@PostMapping
|
||||
public ResultMessage<Object> setHotWords(@Validated HotWordsDTO hotWords) {
|
||||
hotWordsService.setHotWords(hotWords);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除热词")
|
||||
@DeleteMapping
|
||||
public ResultMessage<Object> deleteWords(String words) {
|
||||
hotWordsService.deleteHotWords(words);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "历史热词")
|
||||
@GetMapping("/history")
|
||||
public ResultMessage<Object> deleteWords(HistorySearchParams historySearchParams) {
|
||||
List<HotWordsHistory> hotWordsHistoryList = hotWordsHistoryService.queryByDay(historySearchParams.getDate());
|
||||
Collections.sort(hotWordsHistoryList);
|
||||
return ResultUtil.data(hotWordsHistoryList);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "热词统计")
|
||||
@GetMapping("/statistics")
|
||||
public ResultMessage<Object> deleteWords(HotWordsSearchParams hotWordsSearchParams) {
|
||||
return ResultUtil.data(hotWordsHistoryService.statistics(hotWordsSearchParams));
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
class HistorySearchParams {
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@NotNull(message = "查询日期不能为空")
|
||||
private Date date;
|
||||
|
||||
}
|
||||
@@ -88,13 +88,10 @@ public class AdminUserManagerController {
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@ApiOperation(value = "获取当前登录用户接口")
|
||||
public ResultMessage<AdminUserVO> getUserInfo() {
|
||||
public ResultMessage<AdminUser> getUserInfo() {
|
||||
AuthUser tokenUser = UserContext.getCurrentUser();
|
||||
if (tokenUser != null) {
|
||||
AdminUserVO adminUser = new AdminUserVO(adminUserService.findByUsername(tokenUser.getUsername()));
|
||||
if (StringUtils.isNotEmpty(adminUser.getDepartmentId())) {
|
||||
adminUser.setDepartmentTitle(departmentService.getById(adminUser.getDepartmentId()).getTitle());
|
||||
}
|
||||
AdminUser adminUser = adminUserService.findByUsername(tokenUser.getUsername());
|
||||
adminUser.setPassword(null);
|
||||
return ResultUtil.data(adminUser);
|
||||
}
|
||||
|
||||
@@ -185,6 +185,10 @@ public class SettingManagerController {
|
||||
return setting == null ?
|
||||
ResultUtil.data(new ImSetting()) :
|
||||
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), ImSetting.class));
|
||||
case HOT_WORDS:
|
||||
return setting == null ?
|
||||
ResultUtil.data(new HotWordsSetting()) :
|
||||
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), HotWordsSetting.class));
|
||||
default:
|
||||
throw new ServiceException(ResultCode.SETTING_NOT_TO_SET);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user