package calendarscheduling;

import TestAttendanceAllowance.beforlog;
import com.alibaba.fastjson.JSONObject;
import com.engine.attendance.component.calendarscheduling.service.WorkRulesService;
import com.engine.attendance.component.calendarscheduling.service.impl.WorkRulesServiceImpl;
import com.engine.common.util.ServiceUtil;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.google.common.collect.Maps;
import com.google.gson.Gson;

import java.util.HashMap;
import java.util.Map;


public class Test1 extends beforlog {


    @org.junit.Test
    public void test2() throws Exception{
        WorkRulesService basicsetService = ServiceUtil.getService(WorkRulesServiceImpl.class);
        Map<String, Object> param = Maps.newHashMap();
        param.put("dateTime","2024-05");
        param.put("pageSize","10");
        param.put("pageindex","1");
        param.put("deparment","");
        param.put("type","0");
        param.put("subcompany","");
        param.put("tableName","uf_pbjg");

        Map<String, Object> result = basicsetService.getDepartSchedule(param);

        Map<String, Object> apidatas = new HashMap<>();
        apidatas.put("api_status", true);
        apidatas.put("data", result);
        String success = getJsonString(apidatas);

        System.out.println(success);
    }
    public   String getJsonString(Object apidatas) throws JsonProcessingException {
        Gson gson = new Gson();
//        ObjectMapper mapper = new ObjectMapper();
        return JSONObject.toJSONString(apidatas);
    }
}
