/** * 添加线路模板 * * @param travelLineDO * @param mv * @param result * @return */ @AuthorityPolicy(authorityTypes = {Right.CREATE_LINE_TEMPLATE}) @RequestMapping(value = "/addtemplate.htm") @ResponseBody public JsonResult addtemplat(TravelLineVO travelLineVO, BindingResult result) { Result rs = showErrors(result); if (rs.isFailed()) { return JsonResultUtils.error(rs.getMessage()); } // 添加线路模板 travelLineVO.setlTemplateState(LineTemplateEnum.Template.getValue()); TravelLineDO travelLineDO = new TravelLineDO(); BeanUtils.copyProperties(travelLineDO, travelLineVO); // 设置添加线路的用户id travelLineDO.setmId(WebUserTools.getMid()); travelLineDO.setcId(WebUserTools.getCid()); int linebo = lineService.addTravelLine(travelLineDO); int routebo = 0; // 添加行程 if (travelLineVO.getRoutelist() != null || travelLineVO.getRoutelist().size() != 0) { for (TravelRouteDO route : travelLineVO.getRoutelist()) { route.setlId(travelLineDO.getlId()); routebo = lineService.addTravelRoute(route); } } boolean bool = linebo != 0 && routebo != 0; return bool ? JsonResultUtils.success("添加成功!") : JsonResultUtils.error(null, "添加失败!"); }
/** * 进入修改交通模板页面 * * @param id * @param mav * @return */ @AuthorityPolicy(authorityTypes = {Right.MODIFY_TRAFFIC_TEMPLATE}) @RequestMapping(value = "/trafficupdate.htm", method = RequestMethod.GET) public ModelAndView trafficUpdate(Long id, ModelAndView mav) { TravelTrafficDO trafficdo = lineService.getTravelTrafficById(id); TravelTrafficVO vo = new TravelTrafficVO(trafficdo); BeanUtils.copyProperties(vo, trafficdo); mav.addObject("traffic", vo); mav.addObject("type", "update"); mav.setViewName("account/line/trafficadd"); return mav; }