Commit a80a3f65 authored by shiyu's avatar shiyu

Merge remote-tracking branch 'origin/quanku_0914' into quanku_0914

parents 90987c31 c7f577f4
......@@ -7,6 +7,7 @@ import com.wwdz.ch.db.domain.Category;
import com.wwdz.ch.db.dto.request.CategorySearchRequestDto;
import com.wwdz.ch.wx.entity.TransverseCategory;
import com.wwdz.ch.wx.entity.request.CategoryRequestDto;
import com.wwdz.ch.wx.entity.vo.AgentTranceResponseVo;
import com.wwdz.ch.wx.entity.vo.CategoryResponseVo;
import com.wwdz.ch.wx.entity.vo.TransverseCategoryVo;
import com.wwdz.ch.wx.service.CategoryService;
......@@ -129,6 +130,38 @@ public class CategoryServiceImpl implements CategoryService {
}
}
@Override
public Result queryPriceFindNames(CategoryRequestDto dto) {
if (StringUtils.isBlank(dto.getName())) {
return Result.success(new ArrayList<>());
}
try {
Map<String, Object> map = new HashMap<>();
List<AgentTranceResponseVo> resultList = new ArrayList<>();
CategorySearchRequestDto categorySearchRequestDto = new CategorySearchRequestDto();
categorySearchRequestDto.setName(dto.getName());
List<Category> list = categoryDao.listSelective(categorySearchRequestDto);
// 筛选叶子节点
if (CollectionUtils.isNotEmpty(list)) {
for (Category category : list) {
if (!categoryDao.isExistedChild(category.getId())) {
AgentTranceResponseVo vo = new AgentTranceResponseVo();
vo.setAgentTraceInfo_("");
vo.setViewType(1);
vo.setDetail(category);
resultList.add(vo);
}
}
}
map.put("list", resultList);
map.put("hasNextPage", false);
return Result.success(map);
} catch (Exception e) {
logger.error("搜索分类失败", e);
return Result.failed("搜索分类失败");
}
}
/**
* 分类列表树形转换
*
......
......@@ -186,6 +186,8 @@ public class ItemServiceImpl implements ItemService {
List<Long> itemIds = userItemsRelations.stream()
.map(UserItemsRelation::getItemId).collect(Collectors.toList());
CoinRequestDto coinRequestDto = new CoinRequestDto();
coinRequestDto.setPage(dto.getPage());
coinRequestDto.setLimit(dto.getSize());
coinRequestDto.setIds(itemIds);
// 分页查询
PageInfo<Item> pageInfo = itemDao.findPageNotDeleted(coinRequestDto);
......
......@@ -43,6 +43,14 @@ public interface CategoryService {
*/
Result findNames(CategoryRequestDto dto);
/**
* 按名称搜索模糊匹配返回分类列表(查价)
*
* @param dto
* @return
*/
Result queryPriceFindNames(CategoryRequestDto dto);
/**
* 查价页面横向展示类目
......
......@@ -67,4 +67,10 @@ public class WxCategoryController {
public Result findNames(@RequestBody CategoryRequestDto dto) {
return categoryService.findNames(dto);
}
@ApiOperation(value = "名称模糊联想(查价)")
@PostMapping(value = "/queryPrice/findNames")
public Result queryPriceFindNames(@RequestBody CategoryRequestDto dto) {
return categoryService.queryPriceFindNames(dto);
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment