You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.9 KiB
48 lines
1.9 KiB
package com.dsideal.newUniversityExamination.selectcourse.controller;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.dsideal.newUniversityExamination.exception.NewUniversityExaminationException;
|
|
import com.dsideal.newUniversityExamination.exportService.ExportService;
|
|
import com.dsideal.newUniversityExamination.exportService.ExportServiceBean;
|
|
import com.dsideal.newUniversityExamination.util.ParamUtil;
|
|
import com.jfinal.core.Controller;
|
|
|
|
public class ExportExcelController extends Controller {
|
|
public void getData(){
|
|
JSONObject returnJson;
|
|
ExportServiceBean bean= null;
|
|
try{
|
|
String code = ParamUtil.isEmpty("code","code");
|
|
bean = getServicConfig(getPara(code));
|
|
Object rs = excuteService(bean);
|
|
} catch (NewUniversityExaminationException e) {
|
|
e.printStackTrace();
|
|
returnJson = ParamUtil.getMessage(e.getMessage(), false);
|
|
renderJson(returnJson);
|
|
return;
|
|
}catch (Exception e) {
|
|
e.printStackTrace();
|
|
returnJson = ParamUtil.getMessage(e.getMessage(), false);
|
|
renderJson(returnJson);
|
|
return;
|
|
}
|
|
|
|
renderJson("111");
|
|
}
|
|
|
|
public ExportServiceBean getServicConfig(String serviceCode) throws IllegalAccessException, InstantiationException, ClassNotFoundException {
|
|
ExportServiceBean bean = new ExportServiceBean();
|
|
if("test".equals(serviceCode)){
|
|
String className="com.dsideal.newUniversityExamination.exportService.jxTest";
|
|
Class<? extends ExportService> clazz = (Class<? extends ExportService>) Class.forName(className);
|
|
bean.setServiceClass(clazz.newInstance());
|
|
}
|
|
return bean;
|
|
}
|
|
|
|
public static Object excuteService(ExportServiceBean bean) throws Exception {
|
|
return bean.getServiceClass().excute(bean);
|
|
}
|
|
}
|