我有以下代码作为粘合工作的一部分:
def forTxnType(dynamicRecord: DynamicRecord): DynamicRecord = {
val s = dynamicRecord.getField("transactiondirection")
val s_out = dynamicRecord.getField("transfermechanism")
val s_in = dynamicRecord.getField("terminalid").mkString("")
val m_Wire = List("FWWRD", "WTPCT", "WTROL")
val m_ACH = List("9CACH","9DACH","WTB19","WTB20","WTCN0","WTCN9","WTFP0","WTLEG","WTM20","WTP20","WTPMD","WTSNR","WTSPN","WTT20","WTTEF")
val m_ACAT = List("NSTFR","TSTFR","NSADJ")
val m_Check = List("MGRCF","WTFEE","WTFP0","WTLEG","WTM20","WTP20","WTROL","WTSPN","WTTEF","Z9CHK")
val m_CashJournal = List("AUDEP","AUFEE","CSCSG","WTB20","WTBYP","WTCN0","WTCN9")
val etype = if(s.equals("Outgoing")){
s_out
} else {
if(m_Check.contains(s_in)){
"Check"
}
else if(m_CashJournal.contains(s_in)){
"Cash_journal"
}
else if(m_Wire.contains(s_in)){
"Wire"
}
else if(m_ACH.contains(s_in)){
"ACH"
}
else if(m_ACAT.contains(s_in)){
"ACAT"
}
else{
"NoType"
}
}
dynamicRecord.addField("transactionType", StringNode(etype))
dynamicRecord
}
它在-dynamicrecord.addfield(“transactiontype”,stringnode(etype))行上给出了以下错误:
重载方法值应用于替换项
1条答案
按热度按时间7nbnzgx91#
返回类型
def getField( path : String ) : Option[Any]
是Option
StringNode
将只接受类型为的数据String
但是你的etype
数据类型为类型Any
,因此您将得到错误overloaded method value apply with alternatives
要解决此问题,请更改s_out
至s_out.get
在你的if街区。检查以下代码。