| | |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | |
| | | model.addAttribute("start",start); |
| | | TLineSite end = itLineSiteService.selectOne(new EntityWrapper<TLineSite>().eq("lineId", tLineId).eq("type", 2)); |
| | | model.addAttribute("end",end); |
| | | List<TLineSite> stopoverList = itLineSiteService.selectList(new EntityWrapper<TLineSite>().eq("lineId", tLineId).eq("type", 3)); |
| | | model.addAttribute("stopoverList",stopoverList); |
| | | //站点 |
| | | List<TSite> siteList = itSiteService.selectList(new EntityWrapper<TSite>().eq("state", 1)); |
| | | model.addAttribute("siteList",siteList); |
| | |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public ResultUtil add(TLine tLine,Integer startSiteId,Integer endSiteId,@RequestParam String subArr,@RequestParam String shuArr) { |
| | | public ResultUtil add(TLine tLine,Integer startSiteId,Integer endSiteId, |
| | | @RequestParam String subArr, |
| | | @RequestParam String shuArr, |
| | | @RequestParam String stopoverValues) { |
| | | String name = tLine.getName(); |
| | | name = name.replaceAll("& lt;", "<"); |
| | | name = name.replaceAll("& gt;", ">"); |
| | |
| | | end.setSiteId(endSiteId); |
| | | end.setType(2); |
| | | itLineSiteService.insert(end); |
| | | // 添加经停站 |
| | | List<TLineSite> stopoverList = new ArrayList<>(); |
| | | JSONArray jsonArray = JSON.parseArray(stopoverValues); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | TLineSite stopover = new TLineSite(); |
| | | stopover.setLineId(tLine.getId()); |
| | | stopover.setSiteId(jsonObject.getInteger("id")); |
| | | stopover.setType(3); |
| | | stopoverList.add(stopover); |
| | | } |
| | | if(!CollectionUtils.isEmpty(stopoverList)){ |
| | | itLineSiteService.insertBatch(stopoverList); |
| | | } |
| | | |
| | | //添加价格设置 |
| | | addPrice(tLine.getId(), subArr); |
| | |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public ResultUtil update(TLine tLine,Integer startSiteId,Integer endSiteId,@RequestParam String subArr,@RequestParam String shuArr) { |
| | | public ResultUtil update(TLine tLine,Integer startSiteId,Integer endSiteId, |
| | | @RequestParam String subArr, |
| | | @RequestParam String shuArr, |
| | | @RequestParam String stopoverValues) { |
| | | String name = tLine.getName(); |
| | | name = name.replaceAll("& lt;", "<"); |
| | | name = name.replaceAll("& gt;", ">"); |
| | |
| | | itLineSiteService.insert(end); |
| | | } |
| | | |
| | | // 删除经停站 |
| | | itLineSiteService.delete(new EntityWrapper<TLineSite>().eq("lineId",tLine.getId()).eq("type",3)); |
| | | // 添加经停站 |
| | | List<TLineSite> stopoverList = new ArrayList<>(); |
| | | JSONArray jsonArray = JSON.parseArray(stopoverValues); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | TLineSite stopover = new TLineSite(); |
| | | stopover.setLineId(tLine.getId()); |
| | | stopover.setSiteId(jsonObject.getInteger("id")); |
| | | stopover.setType(3); |
| | | stopoverList.add(stopover); |
| | | } |
| | | if(!CollectionUtils.isEmpty(stopoverList)){ |
| | | itLineSiteService.insertBatch(stopoverList); |
| | | } |
| | | |
| | | //删除线路价格 |
| | | itLinePriceService.delete(new EntityWrapper<TLinePrice>().eq("lineId",tLine.getId())); |
| | | //添加价格设置 |