点单智能推荐 间隔时间

This commit is contained in:
wangw 2025-10-23 10:39:30 +08:00
parent fbd98b52a5
commit 5d7687830b
6 changed files with 25 additions and 8 deletions

View File

@ -1,6 +1,5 @@
package com.czg.controller.user;
import com.czg.market.entity.MkProductSmartSuggest;
import com.czg.market.service.MkProductSmartSuggestService;
import com.czg.resp.CzgResult;
import jakarta.annotation.Resource;
@ -9,7 +8,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
* 点单智能推荐
@ -27,9 +26,9 @@ public class UProductSmartSuggestController {
* 获取点单智能推荐
*/
@GetMapping
public CzgResult<List<MkProductSmartSuggest>> getActivity(@RequestParam Long shopId) {
List<MkProductSmartSuggest> list = suggestService.getProductSmartSuggestByShopId(shopId);
return CzgResult.success(list);
public CzgResult<Map<String, Object>> getActivity(@RequestParam Long shopId) {
Map<String, Object> map = suggestService.getProductSmartSuggestByShopId(shopId);
return CzgResult.success(map);
}

View File

@ -1,5 +1,6 @@
package com.czg.account.dto.shopinfo;
import com.mybatisflex.annotation.Column;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
@ -62,6 +63,10 @@ public class ShopInfoEditDTO {
* 点餐智能推荐 1- 0-
*/
private Integer isProductSuggest;
/**
* 首次弹窗时间
*/
private Integer suggestTime;
/**
* 台桌预订短信
*/

View File

@ -1,5 +1,6 @@
package com.czg.account.entity;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
@ -50,6 +51,10 @@ public class ShopConfig implements Serializable {
* 点餐智能推荐 1- 0-
*/
private Integer isProductSuggest;
/**
* 首次弹窗时间
*/
private Integer suggestTime;
/**
* 是否允许账号登录 1- 0-
*/

View File

@ -268,6 +268,11 @@ public class ShopInfo implements Serializable {
*/
@Column(ignore = true)
private Integer isProductSuggest;
/**
* 首次弹窗时间
*/
@Column(ignore = true)
private Integer suggestTime;
/**
* 是否允许账号登录 1- 0-
*/

View File

@ -7,6 +7,7 @@ import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.service.IService;
import java.util.List;
import java.util.Map;
/**
* 点单智能推荐 服务层
@ -17,7 +18,7 @@ import java.util.List;
public interface MkProductSmartSuggestService extends IService<MkProductSmartSuggest> {
Page<MkProductSmartSuggestDTO> getProductSmartSuggestPage(BaseQueryParam param, Long shopId);
List<MkProductSmartSuggest> getProductSmartSuggestByShopId(Long shopId);
Map<String,Object> getProductSmartSuggestByShopId(Long shopId);
void addProductSmartSuggest(MkProductSmartSuggestDTO param);

View File

@ -23,6 +23,7 @@ import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* 点单智能推荐 服务层实现
@ -46,13 +47,14 @@ public class MkProductSmartSuggestServiceImpl extends ServiceImpl<MkProductSmart
}
@Override
public List<MkProductSmartSuggest> getProductSmartSuggestByShopId(Long shopId) {
public Map<String, Object> getProductSmartSuggestByShopId(Long shopId) {
ShopInfo shopInfo = shopInfoService.getById(shopId);
AssertUtil.isNull(shopInfo, "店铺不存在");
if (shopInfo.getIsProductSuggest() == null || shopInfo.getIsProductSuggest() == 0) {
return null;
}
return mapper.selectListByShopId(shopId, CzgStrUtils.getStrWeek());
List<MkProductSmartSuggest> suggests = mapper.selectListByShopId(shopId, CzgStrUtils.getStrWeek());
return Map.of("suggestTime", shopInfo.getSuggestTime(), "list", suggests);
}
@Override