package com.engine.htsc.ReimbursementFlow.Service.Impl;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.engine.core.impl.Service;
import com.engine.htsc.ReimbursementFlow.Dao.GettravelapplicationDao;
import com.engine.htsc.ReimbursementFlow.Service.GettravlapplctionService;

import weaver.interfaces.htsc.GlobatTools.JAVATools;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

public class GettravlapplctionServiceImpl extends Service implements GettravlapplctionService {

    @Override
    public JSONArray traveldistctcclc(String travelcodeids,String number,String requestid) {

        if ("".equals(travelcodeids)){
            return  new JSONArray();
        }
        String tablename= JAVATools.Getunnumbertotable(number);

        GettravelapplicationDao gettravelapplicationDao=new GettravelapplicationDao();
        List<Map<String,String>> list= gettravelapplicationDao.traveldistctcclc(travelcodeids,tablename,requestid);
        if(list==null||list.size()<=0){
            return new JSONArray();
        }
        JSONArray jsonArray=new JSONArray();
        for(Map<String,String> listmap :list){
            jsonArray.add(JAVATools.MapToJson(listmap));
        }
        return jsonArray;
    }
}
