private void setTp(BehaviorCon b, HttpServletRequest request) { String upperTP = request.getParameter("upper_tp"); String equalTP = request.getParameter("equal_tp"); String lowerTP = request.getParameter("lower_tp"); String selfTP = request.getParameter("self_tp"); String otherTP = request.getParameter("other_tp"); if (b.getType() == 3) // 设置统一模板 { equalTP = upperTP; lowerTP = upperTP; selfTP = upperTP; otherTP = upperTP; } StringBuffer tpids = new StringBuffer(); StringBuffer logos = new StringBuffer(); if (!StringUtils.isEmpty(upperTP)) { tpids.append(upperTP + ","); logos.append("0,"); } if (!StringUtils.isEmpty(equalTP)) { tpids.append(equalTP + ","); logos.append("1,"); } if (!StringUtils.isEmpty(lowerTP)) { tpids.append(lowerTP + ","); logos.append("2,"); } if (!StringUtils.isEmpty(selfTP)) { tpids.append(selfTP + ","); logos.append("4,"); } if (!StringUtils.isEmpty(otherTP)) { tpids.append(otherTP + ","); logos.append("3,"); } b.setTemplateIds(tpids.toString()); b.setLogos(logos.toString()); }
@RequestMapping(value = "save.html", method = RequestMethod.POST) public String save(BehaviorCon b, HttpServletRequest request, ModelMap model) { String tcid = request.getParameter("tcid"); String tcName = request.getParameter("tcName"); String symbol = request.getParameter("symbol"); String sid = request.getParameter("sId"); this.setTp(b, request); UserInfoBo user = (UserInfoBo) request.getSession().getAttribute("user"); b.setCreater_id(user.getUid()); // LMSWD-2471 by LTC 20130510 b.setTrainClassId(tcid); b.setCreate_date(DateTool.getNowShort()); String status = request.getParameter("status"); // 不改变发布状态 if (null != status && status != "") { int _status = Integer.parseInt(status); b.setStatus(_status); } else { b.setStatus(1); // 新建默认为未发布 } /** **此培训班ID作为upId是区分是否是在培训内新建的评估|LMSWD-3469|by LuChao*** */ b.setUpId(b.getUpId()); SurveyCon survey = new SurveyCon(); String nameJudge = b.getTopic(); survey.setTopic(nameJudge); survey.setsId(sid); survey.setType(b.getType()); Return repeat = sService.getVildateName(survey); if (repeat.getCode().equals("0")) { Return re = beService.newBehavior(b); if (re.getCode() != null && tcid != null) { SurveyAimCon cla = new SurveyAimCon(); cla.setObjectId(tcid); if (null != tcName) { cla.setObjectName(tcName); } cla.setSurvey_id(re.getCode()); aimService.saveLpi(cla); } return "redirect:setting.html?type=" + b.getType() + "&sid=" + re.getCode() + "&symbol=" + symbol + "&upId=" + b.getUpId(); } else { return "redirect:errorforsurvey.html?type=" + b.getType() + "&sid=" + sid + "&symbol=" + symbol; } }