package com.brilliance.isc.customized.acount;

import cn.hutool.core.util.StrUtil;
import com.brilliance.isc.customized.api.AccountCustomizedApi;
import com.brilliance.mda.runtime.mda.impl.Argument;
import org.springframework.stereotype.Service;

@Service
public class AccountCustomizedService implements AccountCustomizedApi {

    @Override
    public boolean checkAccount(String account, Argument<String> errMsg) {
        if(!StrUtil.isEmpty(account)){
            int length = account.length();
            if(length == 17 || length == 21 || length == 18 || length == 22){
                return true;
            }
        }
        errMsg.value = "账户长度错误！";
        return false;
    }

    @Override
    public boolean checkCur(String cur, Argument<String> errMsg) {

        //TODO 依据实际逻辑校验币种 以下为原有校验逻辑
//        if (!MdaUtils.isEmpty(cur)) {
//            if (MdaUtils.compareTo(vcur, Strings.mid(codetableService.getTblLabel(cur, "CURKEY"), 1, 2)) != 0) {
//                err.value = "记账币种 " + cur + " 与账号币种不符";
//                return false;
//            }
//        }
        if(true){
            return true;
        }
        errMsg.value = "账户长度错误！";
        return false;

    }


}
