//保存学校信息
@RequestMapping("/saveSchoolInfo")
@ResponseBody
public String saveSchoolInfo(School school,HttpSession session,HttpServletRequest request){
HashMap<String, Object> result = schoolService.saveSchoolInfo(school);
String data = null;
if ((Boolean) result.get("success")) {
data="0";
session.setAttribute("schoolInfo", school);
Date currentTime = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
String format = sdf.format(currentTime);
String filepath=PathRoot+"/" + format + "学校信息导出.xls";
zjzpsrc=request.getServletContext().getRealPath(school.getZjzp());
frsfzzmzpsrc=request.getServletContext().getRealPath(school.getFrsfzzmzp());
frsfzfmzpsrc=request.getServletContext().getRealPath(school.getFrsfzfmzp());
sydwfrzssrc=request.getServletContext().getRealPath(school.getSydwfrzs());
excelpath=request.getServletContext().getRealPath(filepath);
list=new ArrayList<School>(Arrays.asList(school));
try {
log.info("===========进入邮箱发送===============");
// 启动线程
log.info("启动线程---------");
MyThreadPoolManager.getInstance().execute(new Runnable() {
@Override
public void run() {
try {
List<File> fList = new Vector<File>();
fList.add(new File(zjzpsrc));
fList.add(new File(frsfzzmzpsrc));
fList.add(new File(frsfzfmzpsrc));
fList.add(new File(sydwfrzssrc));
schoolService.schoolToExcel(excelpath,list);
fList.add(new File(excelpath));
EmailSenderUtil.sendEmail("学校信息", "详情见附件",fList);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}else{
data="1";
}
return data;
}