コード例 #1
0
 /**
  * 添加线路模板
  *
  * @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, "添加失败!");
 }
コード例 #2
0
 /**
  * 进入模板修改页面
  *
  * @param id
  * @param mv
  * @return
  */
 @AuthorityPolicy(authorityTypes = {Right.MODIFY_LINE_TEMPLATE})
 @RequestMapping(value = "/templateupdate.htm")
 public ModelAndView templateupdate(Long id, ModelAndView mv) {
   // 查询线路模板
   TravelLineDO tr = lineService.find(new TravelLineQuery(id));
   // 查询线路所有行程
   TravelRouteQuery routq = new TravelRouteQuery();
   routq.setlId(tr.getlId());
   List<TravelRouteDO> rlistp = lineService.list(routq);
   List<TravelRouteVO> rlist = BeanUtils.convert(TravelRouteVO.class, rlistp);
   mv.getModel().put(CustomVelocityLayoutView.USE_LAYOUT, "false");
   mv.addObject("type", "update");
   mv.addObject("route", rlist);
   mv.addObject("temp", tr);
   mv.setViewName("account/line/templateadd");
   return mv;
 }
コード例 #3
0
 /**
  * 进入模板复制页面
  *
  * @param id
  * @param mv
  * @return
  */
 @AuthorityPolicy(authorityTypes = {Right.COPY_LINE_TEMPLATE})
 @RequestMapping(value = "/templatecopy.htm")
 public ModelAndView templatecopy(Long id, ModelAndView mv) {
   // 查询线路模板
   TravelLineDO tr = lineService.find(new TravelLineQuery(id));
   // 查询线路所有行程
   TravelRouteQuery routq = new TravelRouteQuery();
   routq.setlId(tr.getlId());
   List<TravelRouteDO> rlistp = lineService.list(routq);
   List<TravelRouteVO> rlist = BeanUtils.convert(TravelRouteVO.class, rlistp);
   // 添加进模型
   tr.setcId(null);
   mv.addObject("type", "copy");
   mv.addObject("route", rlist);
   mv.addObject("temp", tr);
   mv.setViewName("account/line/templateadd");
   return mv;
 }