package com.icloud.server.scala.engine.filter

import com.icloud.server.redis.AmountRedis
import com.icloud.server.scala.engine.contect.Context
import com.icloud.server.scala.engine.service.{Alipaye, Goodspaye, Wxpaye}
import com.icloud.server.web.time.TimeUtilss
import org.springframework.stereotype.Component

import javax.annotation.Resource
import scala.beans.BeanProperty

/**
  * 风控过滤---支付系统级别---限额风控--系统设置是5万 50000,00
  */
@Component
class AmountRiskFilter extends AbstractFilter {
  @Resource
  @BeanProperty var amountredis: AmountRedis = _


  override def WxisAccept(context: Context, wxpaye: Wxpaye): Boolean = {

    var amonut=amountredis.WxGetAmount(TimeUtilss.gettoday_tostring(),wxpaye.userid.toString,wxpaye.appid)
    println("wx_appid:"+wxpaye.appid)
    println("wx:"+wxpaye.amount)
  amonut<wxpaye.amount
//    true
  }

  override def AliisAccept(context: Context, alipaye: Alipaye): Boolean = {
    var amonut=amountredis.AliGetAmount(TimeUtilss.gettoday_tostring(),alipaye.userid.toString,alipaye.appid)
    println("ali_appid:"+alipaye.appid)
    println("ali:"+alipaye.amount)
    amonut<alipaye.amount
    //    true
  }
}
