培训计划管理
一、年度计划 二、月度计划 三、计划管理
培训班管理
一、创建培训班
二、管理培训班
1、设置课程
2、设置学员
3、训后录入
4、确认结束
5、培训班报销
讲师管理
1、讲师录入
2、额外嘉奖
3、讲师异动
4、讲师评级
5、讲师津贴系数调整
课程管理
1、培训班名称管理
2、培训班模板管理
教材管理
1、教材征订录入
2、教材征订审核
3、教材借阅录入
4、教材归还录入
系统管理
1、培训班解锁
2、培训班开放补建
3、解冻培训班
4、角色管理
查询中心
1、讲师类查询
2、计划类查询
3、培训班查询
4、教材查询
个人中心
1、个人工作交接
2、个人授课授权
3、个人积分
4、个人培训绩效
特定实现:
1、增加培训班后通过线程实现邮件通知对应branch的计划管理员们和教师们,以减低时延(这里是插入一个邮件表)
public Map addClassInfo(ClassInfoDTO classInfo) throws BusinessServiceException {
try{
if(StringUtils.isEmpty(classInfo.getIsGranted())){
classInfo.setIsGranted(CodeTypes.VALID_NO);
}
CommonDAO commonDAO = (CommonDAO)context.getBean(BeanNames.TMS_COMMON_DAO);
String classId = commonDAO.getNextSeqValue(SeqNames.TMS_SEQ_CLASS_ID);
classInfo.setClassId(classId);
if(Calendar.getInstance().getTime().after(classInfo.getDateStart())){
classInfo.setClassStatus(CodeTypes.CLASS_STATUS_PROGRESS_RS);
}else{
classInfo.setClassStatus(CodeTypes.CLASS_STATUS_CREATE_RS);
}
classInfoDAO.addClassInfo(classInfo);
classInfoDAO.addClassTeacherInfo(classInfo);
MonthlyPlanDTO monthlyPlanDTO = new MonthlyPlanDTO();
monthlyPlanDTO.setMonthlyPlanId(classInfo.getMonthlyPlanId());
monthlyPlanDTO.setSeriesId(classInfo.getSeriesId());
monthlyPlanDTO.setAchieveTimes(classInfo.getAchieveTimes());
commonDAO.modifySomeInfoBySqlId(ClassInfoIbatisSqlId.MODIFY_MONTHLY_PLAN_ACHIEVE_TIMES, monthlyPlanDTO);
if(Calendar.getInstance().getTime().after(classInfo.getDateStart())){
addBulletinInfo(classInfo);
}
//发送培训班创建后邮件 ClassCreatedSenderMail实现 Runable接口,实现run方法
ClassCreatedSenderMail senderMail = new ClassCreatedSenderMail(classInfo,context,CommonUtil.getTxID(),CommonUtil.getUserID());
TmsThreadPool.execute(senderMail);
ClassTeacherRoleCreate teacherRoleCreate = new ClassTeacherRoleCreate(classInfo,context,CommonUtil.getTxID(),CommonUtil.getUserID());
TmsThreadPool.execute(teacherRoleCreate);
Map<String,String> model = new HashMap<String,String>();
model.put(KeyNames.SERVICE_RESPONSE_RESULT, "培训班成功创建!");
return model;
}catch(PafaDAOException ex){
throw new BusinessServiceException("ClassInfoPojoServiceImpl.addClassInfo is error",ex);
}
}
//定义类里面的static方法(通过实例化一个ThreadPoolExecutor)
//import java.util.concurrent.ThreadPoolExecutor;
public class TmsThreadPool {
//线程池维护最小线程数
private static final int CORE_POOL_SIZE = Integer.parseInt(PropertiesUtils.getPropertiesValue("CORE_POOL_SIZE"));
//线程池维护最大线程数
private static final int MAXIMUM_POOL_SIZE = Integer.parseInt(PropertiesUtils.getPropertiesValue("MAXIMUM_POOL_SIZE"));
//线程池维护线程所允许的空闲时间
private static final long KEEP_ALIVE_TIME = Long.parseLong(PropertiesUtils.getPropertiesValue("KEEP_ALIVE_TIME"));
//线程池最大队列数
private static final int BLOCKING_QUEUE_MAX_NUM = Integer.parseInt(PropertiesUtils.getPropertiesValue("BLOCKING_QUEUE_MAX_NUM"));
private static ThreadPoolExecutor threadPolls = new ThreadPoolExecutor(CORE_POOL_SIZE,MAXIMUM_POOL_SIZE,KEEP_ALIVE_TIME,
TimeUnit.SECONDS,new ArrayBlockingQueue<Runnable>(BLOCKING_QUEUE_MAX_NUM),new ThreadPoolExecutor.CallerRunsPolicy());
/**
* 执行新任务
* @param runnable
*/
public static final void execute(Runnable runnable){
threadPolls.execute(runnable);
}
}
private void sendMail( Session session, MailDTO mail ) throws Exception
{
if(mail != null && StringUtils.isNotEmpty(mail.getReceiver())&&StringUtils.isNotEmpty(mail.getContent())){
try{
if( session == null )
{
session = getSession();
}
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(mail.getSender()));
msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(mail.getReceiver(),
false));
msg.setSentDate(new Date());
msg.setSubject(mail.getSubject());
if(mail.getContent().indexOf("<html>")!=-1){
msg.setContent(mail.getContent(), "text/html;charset=GB2312");
}else{
msg.setText(mail.getContent());
}
Transport.send(msg);
}catch(Exception ex){
DevLog.debug(mail.getSender()+" send mail to "+mail.getReceiver()+" is fail, the txID is:"+CommonUtil.getTxID()+"the error message is "+ex.getMessage());
throw new BusinessServiceException("邮件发送错误",ex);
}
}
}
使用Quartz开源框架实现定时重复任务,执行邮件发送。这里定制了其ejb调用实现biz-context-autotask.xml的schedulerFactory作为监听
<session id="TmsInitQuartz">
<ejb-name>TmsInitQuartz</ejb-name>
<home>com.paic.tms.common.ejb.TmsQuartzInitHome</home>
<remote>com.paic.tms.common.ejb.TmsQuartzInit</remote>
<ejb-class>com.paic.tms.common.ejb.TmsQuartzInitBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<env-entry>
<env-entry-name>ejb/BeanFactoryPath</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>biz-context.xml,biz-context-autotask.xml</env-entry-value>
</env-entry>
</session>
使用jquery和ajax
//检验教材单证代码
function checkDno(){
var dno = trim($("#dno").val());
if(dno == ""){
alert("请录入教材单证代码");
return;
}
$.ajax({
type: "POST",
url: "/book.orderInStorage.checkDno.do",
dataType: "json",
contentType:"application/x-www-form-urlencoded;charset=utf-8",
data: "dno="+dno,
success : function(result){
if(result == null){
alert("不存在与此单证代码符合的教材!")
$("#bookId").val("");
$("#bookName").val("");
//$("#version").val("");
$("#dno").focus();
}else{
var bookInfo = eval(result);
$("#bookId").val(bookInfo.bookId);
$("#dno").val(bookInfo.dno);
$("#bookName").val(bookInfo.bookName);
//$("#version").val(bookInfo.version);
}
}
});
}
//printJSONObjectForResponse 回调函数,写回
public ModelAndView checkDno(HttpServletRequest request,
HttpServletResponse response) throws PafaWebException{
ServiceRequest serviceRequest = getServiceRequest(request);
createBinder(BookInfoDTO.class);
BookInfoDTO bookInfoDTO = (BookInfoDTO)bind(request);
serviceRequest.setParameter(BookKeyName.BOOK_INFO_DTO_KEY_NAME,bookInfoDTO);
serviceRequest.setRequestedServiceID(OtherInStorageServiceRequestID.CHECK_BOOK_DNO_SERVICE_REQUEST_ID);
ServiceResponse serviceResponse = dispatchService(serviceRequest, WebContextNames.PAFA_AC);
Map model = serviceResponse.getModel();
try {
printJSONObjectForResponse(response, model.get(BookKeyName.RESULT_KEY_NAME));
} catch (Exception e) {
throw new PafaWebException("新增其它入库录入时校验教材单证代码",e);
}
return null;
}
//以json的形式写数据到页面
protected void printJSONObjectForResponse(HttpServletResponse response,Object obj) throws PafaWebException{
JSONObject json = null;
try{
json = JSONObject.fromObject(obj);
response.setContentType("text/json;charset=utf-8");
PrintWriter pw = response.getWriter();
pw.print(json.toString());
pw.flush();
pw.close();
}catch(Throwable ex){
throw new PafaWebException("printJSONObjectForResponse is error",ex);
}
}