热门产品销售看板
This commit is contained in:
@@ -22,6 +22,9 @@ import com.klp.domain.vo.WmsProductSalesScriptVo;
|
||||
import com.klp.domain.bo.WmsProductSalesScriptBo;
|
||||
import com.klp.service.IWmsProductSalesScriptService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.utils.redis.RedisUtils;
|
||||
import java.time.Duration;
|
||||
import com.klp.domain.vo.HotProductVO;
|
||||
|
||||
/**
|
||||
* 产品销售话术
|
||||
@@ -97,4 +100,29 @@ public class WmsProductSalesScriptController extends BaseController {
|
||||
@PathVariable Long[] scriptIds) {
|
||||
return toAjax(iWmsProductSalesScriptService.deleteWithValidByIds(Arrays.asList(scriptIds), true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 记录话术访问频率
|
||||
*
|
||||
* @param productId 产品ID
|
||||
*/
|
||||
@PostMapping("/recordVisit/{productId}")
|
||||
public R<Void> recordVisit(@NotNull(message = "产品ID不能为空") @PathVariable Long productId) {
|
||||
String key = "product:visit:frequency:" + productId;
|
||||
// 原子递增访问次数,设置7天过期时间
|
||||
long count = RedisUtils.incrAtomicValue(key);
|
||||
if (count == 1) {
|
||||
// 第一次访问时设置过期时间
|
||||
RedisUtils.expire(key, Duration.ofDays(7));
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取热门产品排行(基于访问频率)
|
||||
*/
|
||||
@GetMapping("/hotProducts")
|
||||
public R<List<HotProductVO>> getHotProducts(@RequestParam(defaultValue = "10") Integer limit) {
|
||||
return R.ok(iWmsProductSalesScriptService.getHotProducts(limit));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,9 +155,6 @@ public class WmsStockIoController extends BaseController {
|
||||
* 扫码枪专用:根据明细ID直接入库,无需审核整单
|
||||
*/
|
||||
@PostMapping("/scanInStock")
|
||||
/**
|
||||
* 扫码枪专用:根据传入明细参数直接入库,无需审核整单
|
||||
*/
|
||||
public R<Void> scanInStock(@RequestBody WmsStockIoDetailBo bo) {
|
||||
try {
|
||||
boolean result = iWmsStockIoService.scanInStockByBo(bo);
|
||||
|
||||
Reference in New Issue
Block a user