package com.icloud.server.scala.engine.service

import com.icloud.server.scala.engine.cache.GoodsCache
import org.slf4j.LoggerFactory
import org.springframework.scheduling.annotation.Scheduled
import org.springframework.stereotype.Service

import javax.annotation.Resource
import scala.beans.BeanProperty
import scala.jdk.CollectionConverters._


@Service
class GoodsPayService {

  @Resource
  @BeanProperty var goodscache: GoodsCache = _
  val log = LoggerFactory.getLogger(classOf[GoodsPayService])


  @Scheduled(cron = "1 */5 * * * *")
  def init = {
    log.info("加载商品支付链接数据");
    goodscache.init
  }
  /**
   * @Description: 手动触发缓存
   * @Author: yang
   * @Date: 2022-07-14 01:56
   *
   *
   **/

  def lading(): Unit ={
    log.info("手动触发加载商品支付链接数据");
    goodscache.init
  }
  def getGoodsPay(): List[Goodspaye] ={
    goodscache.getgoodsPayeList.asScala.toList
  }
  def getGoodsPayById(id:String):Goodspaye={
    goodscache.get(id)
  }


}
