You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
2.0 KiB
Java

package calendarscheduling;
import TestAttendanceAllowance.beforlog;
import com.alibaba.fastjson.JSONObject;
import com.engine.jucailinkq.attendance.component.calendarscheduling.service.WorkRulesService;
import com.engine.jucailinkq.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 weaver.hrm.User;
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);
}
@org.junit.Test
public void test3() throws Exception{
User user = new User(1);
WorkRulesService basicsetService = ServiceUtil.getService(WorkRulesServiceImpl.class,user);
Map<String, Object> param = Maps.newHashMap();
param.put("resourceIds","36,56");
param.put("bcxx","8");
param.put("date","2024-06-15,2024-06-14,2024-06-13,2024-06-12");
basicsetService.saveCalendarWork(param);
}
public String getJsonString(Object apidatas) throws JsonProcessingException {
Gson gson = new Gson();
// ObjectMapper mapper = new ObjectMapper();
return JSONObject.toJSONString(apidatas);
}
}