/**
  * 添加线路模板
  *
  * @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;
 }
 /**
  * * 交通列表
  *
  * @param mav
  * @param query
  * @param page
  * @param pagesize
  * @return
  */
 @RequestMapping(value = "/trafficpage.htm")
 public ModelAndView traffic(
     ModelAndView mav, TravelTrafficQuery query, Integer page, Integer pagesize) {
   query.setcId(WebUserTools.getCid());
   query.setPageSize(Argument.isNotPositive(pagesize) ? 15 : pagesize);
   query.setNowPageIndex(Argument.isNotPositive(page) ? 0 : page - 1);
   // 分页查询
   PaginationList<TravelTrafficDO> trafficlist =
       lineService.listPagination(query, new DefaultIpageUrl());
   // 转成VOList
   List<TravelTrafficVO> trafficlistvo = BeanUtils.convert(TravelTrafficVO.class, trafficlist);
   mav.getModel().put(CustomVelocityLayoutView.USE_LAYOUT, "false");
   mav.addObject("traffic", trafficlistvo);
   mav.addObject("pagination", trafficlist.getQuery());
   mav.setViewName("account/line/trafficpage");
   return mav;
 }
 /**
  * 进入模板修改页面
  *
  * @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;
 }
 /**
  * 模板显示list
  *
  * @param mv
  * @param query
  * @param page
  * @param pagesize
  * @return
  */
 @RequestMapping(value = "/templatepage.htm")
 public ModelAndView template(
     ModelAndView mv, TravelLineQuery query, Integer page, Integer pagesize) {
   if (query.getzId() != null) {
     query.setzIds(query.getzId());
   }
   query.setlTemplateState(1);
   query.setcId(WebUserTools.getCid());
   query.setPageSize(Argument.isNotPositive(pagesize) ? 15 : pagesize);
   query.setNowPageIndex(Argument.isNotPositive(page) ? 0 : page - 1);
   // 查询线路模板
   PaginationList<TravelLineDO> list = lineService.listPagination(query, new DefaultIpageUrl());
   List<TravelLineVO> lists = BeanUtils.convert(TravelLineVO.class, list);
   mv.addObject("pagination", list.getQuery());
   mv.addObject("template", lists);
   mv.setViewName("account/line/templatepage");
   return mv;
 }
 /**
  * 进入模板复制页面
  *
  * @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;
 }
Esempio n. 7
0
  @RequestMapping(value = "/company_line/{id}.htm")
  public ModelAndView line(
      @PathVariable("id") Long id,
      ModelAndView mav,
      Integer page,
      Integer pagesize,
      TravelLineQuery query) {
    TravelLineQuery.parse(query, null, null, page, pagesize, LineTemplateEnum.Line.getValue());
    query.setcId(id);

    PaginationList<TravelLineDO> list = lineService.listPagination(query, new DefaultIpageUrl());
    List<TravelLineVO> lists = BeanUtils.convert(TravelLineVO.class, list);

    mav.addObject("list", lists);
    mav.addObject("pagination", list.getQuery());
    mav.setViewName("cms/1409/line");
    return mav;
  }