/** * 依据实际情况返回WorkInfoHistoryBaseBO的子类对象 * * @param boParam 用于接收从Action类中传入的参数,是各参数列表的组合,包括smRangeID,givenDate等信息 * @return WorkInfoHistoryBaseBO的子类对象 */ public WorkInfoHistoryBaseBO createBOByUserAndRange(HistoryWorkInfoCreateBOParam boParam) { WorkInfoHistoryBaseBO bo = null; String id = boParam.getSmRangeID(); // 短信的RangeID UserInfo userInfo = boParam.getUserInfo(); HistoryWorkInfoConditionBean bean = boParam.getBean(); // 传入的界面查询bean String userType = userInfo.getType(); if (id == null) { // 如果短信的RangeID为空,意味着与短信无关,则与历史曲线有关 id = getRangeID(userType, bean); // 得到适用于历史曲线的rangeID } if (UserType.PROVINCE.equals(userType)) { // 如果是省移动用户 if ("11".equals(id)) { // 如果所选范围是“全省范围“ bo = createBOProvinceMobile(null); // 操作省移动BO子类中实现的方法 } else { bo = createBOCityMobile(id); // 操作市移动BO子类中实现的方法 } } else if (UserType.SECTION.equals(userType)) { // 如果是市移动用户 // 如果所选范围为用户所在地市 if ("12".equals(id)) { bo = createBOCityMobile(userInfo.getRegionid()); // 操作市移动BO子类中实现的方法 } else { bo = createBOCityContractor(id); // 操作市代维BO子类中实现的方法 } } else if (UserType.CONTRACTOR.equals(userType)) { // 如果是市代维用户 // 如果所选范围为用户所在代维公司 if ("22".equals(id)) { bo = createBOCityContractor(userInfo.getDeptID()); // 操作市代维BO子类中实现的方法 } else { bo = createBOPatrolman(id); // 操作巡检组BO子类中实现的方法 } } return bo; }
/** 发送短信(短信发送给填写故障反馈单的人) */ public void sendMsg(TestPlan plan, String planId) { try { String eid = planId; UserInfoDAOImpl userdao = new UserInfoDAOImpl(); String userid = plan.getCreatorId(); UserInfo user = userdao.findById(userid); if (user != null) { String phone = user.getPhone(); if (phone != null && !"".equals(phone)) { // 发送短信 String content = "【技术维护】您有一个名称为\"" + plan.getTestPlanName() + " \" 的测试计划"; content += "已经考核结束。"; logger.info("短信内容: " + phone + ":" + content); super.sendMessage(content, phone); // smSendProxy.simpleSend(phone,content, null, null, true); // 保存短信记录 SMHistory history = new SMHistory(); history.setSimIds(phone); history.setSendContent(content); history.setSendTime(new Date()); history.setSmType(MainTenanceConstant.LP_EVALUATE); history.setObjectId(eid); history.setBusinessModule(MainTenanceConstant.MAINTENANCE_MODULE); historyDAO.save(history); } } } catch (Exception e) { e.getStackTrace(); } }
/** * 年终检查打分生成 * * @param mapping * @param form * @param request * @param response * @return */ public ActionForward appraiseDailyYearEnd( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { AppraiseDailyBean appraiseDailyBean = (AppraiseDailyBean) form; WebApplicationContext ctx = getWebApplicationContext(); AppraiseDailyBO appraiseDailyBO = (AppraiseDailyBO) ctx.getBean("appraiseDailyYearEndBO"); UserInfo userInfo = (UserInfo) request.getSession().getAttribute("LOGIN_USER"); appraiseDailyBean.setAppraiser(userInfo.getUserID()); List<AppraiseDaily> appraiseDailies = appraiseDailyBO.getAppraiseDailyByBean(appraiseDailyBean, AppraiseConstant.TYPE_YEAREND); if (appraiseDailies.size() > 0) { return forwardInfoPage(mapping, request, "appraiseDailyYearEndRepeatError"); } request.setAttribute("contractNo", appraiseDailyBean.getContractNo()); request.setAttribute("year", appraiseDailyBean.getYear()); request.setAttribute("contractorId", appraiseDailyBean.getContractorId()); return mapping.findForward("appraiseDailyYearEnd"); }
/** * 考核结束,流程结束 * * @param user */ private void evaluate(UserInfo user, String planid) { Task task = workflowBo.getHandleTaskForId(user.getUserID(), planid); if (task != null && MaintenanceWorkflowBO.EVALUATE_TASK.equals(task.getName())) { workflowBo.completeTask(task.getId(), "end"); ProcessHistoryBean processHistoryBean = new ProcessHistoryBean(); processHistoryBean.initial(task, user, "", ModuleCatalog.MAINTENANCE); processHistoryBean.setNextOperateUserId(""); processHistoryBean.setObjectId(planid); processHistoryBean.setProcessAction("测试计划考核"); processHistoryBean.setTaskOutCome("end"); processHistoryBO.saveProcessHistory(processHistoryBean); } System.out.println("测试计划已经考核!"); }
/** * 查询批量计划 * * @param user * @param batchname * @return */ public List queryBatch(UserInfo user, String batchname) { String sql = "select id,batchname,to_char(startdate,'yyyy/mm/dd') startdate,to_char(enddate,'yyyy/mm/dd')enddate,to_char(createdate,'yyyy/mm/dd')createdate from batchplan where contractorid='" + user.getDeptID() + "' "; logger.info(batchname); if (batchname != null) { sql += " and batchname like ('%" + batchname + "%')"; } logger.info(sql); QueryUtil query; try { query = new QueryUtil(); List list = query.queryBeans(sql); return list; } catch (Exception e) { logger.error(e); e.printStackTrace(); return null; } }