| | |
| | | import com.dsh.guns.core.base.controller.BaseController; |
| | | import com.dsh.guns.modular.system.model.*; |
| | | import com.dsh.guns.modular.system.model.dto.*; |
| | | import com.dsh.guns.modular.system.service.ICityService; |
| | | import com.dsh.guns.modular.system.service.ICoursePackageService; |
| | | import com.dsh.guns.modular.system.service.IStoreService; |
| | | import com.dsh.guns.modular.system.service.ITSiteService; |
| | | import com.dsh.guns.modular.system.service.*; |
| | | import com.dsh.guns.modular.system.util.HttpRequestUtil; |
| | | import com.dsh.guns.modular.system.util.ResultUtil; |
| | | import com.google.common.base.Ascii; |
| | |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | |
| | | @Controller |
| | |
| | | return PREFIX+"ball.html"; |
| | | } |
| | | |
| | | //入园方式 |
| | | @RequestMapping("/joinmethod/{id}") |
| | | public String joinmethod(Model model,@PathVariable("id") Integer id) { |
| | | |
| | | |
| | | model.addAttribute("id",id); |
| | | |
| | | return PREFIX+"join.html"; |
| | | } |
| | | |
| | | |
| | | @RequestMapping("/selectJoin") |
| | | @ResponseBody |
| | | public ResultUtil join(@RequestBody MethodDto method) { |
| | | |
| | | System.out.println("============"+method); |
| | | SiteBooking siteBooking = new SiteBooking(); |
| | | siteBooking.setStatus(2); |
| | | siteBooking.setId(method.getId()); |
| | | siteBooking.setGoType(method.getMethod()); |
| | | iSiteBookingService.updateById(siteBooking); |
| | | |
| | | return new ResultUtil<>(0,0,"到店成功",null,null); |
| | | } |
| | | |
| | | |
| | | |
| | | @RequestMapping(value = "/yunying") |
| | | @ResponseBody |
| | | public ResultUtil getUserSlect() { |
| | | |
| | | |
| | | |
| | | List<SelectDto> selectDtos = storeService.getSelect(); |
| | | Map<String,List<SelectDto>> map = new HashMap<>(); |
| | | map.put("options",selectDtos); |
| | | |
| | | System.out.println("=======selectDtos====="+selectDtos); |
| | | return new ResultUtil(0,0,"编辑成功",map,""); |
| | | } |
| | | |
| | | //取消凭证页面 |
| | | @RequestMapping("/tocancel/{id}") |
| | | public String tocancel(Model model,@PathVariable("id") Integer id) { |
| | | |
| | | model.addAttribute("id",id); |
| | | |
| | | return PREFIX+"cancel.html"; |
| | | } |
| | | |
| | | |
| | | @RequestMapping("/cancel") |
| | | @ResponseBody |
| | | public ResultUtil cancel(Integer id,String voucher,String textarea) { |
| | | |
| | | System.out.println("============"+id); |
| | | SiteBooking siteBooking = new SiteBooking(); |
| | | siteBooking.setId(id); |
| | | siteBooking.setStatus(5); |
| | | siteBooking.setVoucher(voucher); |
| | | siteBooking.setRemark(textarea); |
| | | siteBooking.setCancelUserId(UserExt.getUser().getId()); |
| | | iSiteBookingService.updateById(siteBooking); |
| | | |
| | | return new ResultUtil<>(0,0,"到店成功",null,null); |
| | | } |
| | | |
| | | /** |
| | | * 获取变更列表 |
| | |
| | | |
| | | @RequestMapping("/save") |
| | | @ResponseBody |
| | | public ResultUtil save(String red, String blue, String province, String city, Integer site, Integer store |
| | | public ResultUtil save(String operationId,String red, String blue, String province, String city, Integer site, Integer store |
| | | , String kuacheng, BigDecimal kuachengCoin, BigDecimal kuachengCash,String kuachengImage,BigDecimal kuachengInt,Integer kuachengId |
| | | , String shequ, BigDecimal shequCoin, BigDecimal shequCash,String shequImage,BigDecimal shequInt,Integer shequId |
| | | , String shemen, BigDecimal shemenCoin, BigDecimal shemenCash,String shemenImage,BigDecimal shemenInt,Integer shemenId |
| | |
| | | game.setCityCode(city); |
| | | game.setSiteId(site); |
| | | game.setStoreId(store); |
| | | |
| | | |
| | | if (!operationId.equals("平台")){ |
| | | game.setOperationId(Integer.valueOf(operationId));} |
| | | else { |
| | | game.setOperationId(0); |
| | | } |
| | | System.out.println("============"+game); |
| | | Integer gameId = ballClient.save(game); |
| | | |
| | |
| | | @RequestMapping("/pre_add") |
| | | public String add(Model model) { |
| | | |
| | | |
| | | model.addAttribute("is","${is}"); |
| | | |
| | | return PREFIX+"ball_pre_add.html"; |
| | | } |
| | |
| | | |
| | | return PREFIX+"ball_pre_edit.html"; |
| | | } |
| | | |
| | | @Autowired |
| | | private ISiteBookingService iSiteBookingService; |
| | | |
| | | @RequestMapping("/yueyue_edit/{id}") |
| | | public String yueyue_edit(@PathVariable("id") Integer id,Model model) { |
| | | |
| | | List<String> strings1 = new ArrayList<>(); |
| | | |
| | | SiteBooking book = iSiteBookingService.getById(id); |
| | | model.addAttribute("item", book); |
| | | if (book.getMoney()!=null){ |
| | | model.addAttribute("money",book.getMoney().split(","));} |
| | | String[] split1 = book.getTimes().split(";"); |
| | | model.addAttribute("date",split1[0].substring(0,10)); |
| | | |
| | | for (String s : split1) { |
| | | |
| | | String convertedValue = s.substring(11); |
| | | strings1.add(convertedValue); |
| | | } |
| | | |
| | | System.out.println("========strings1====="+strings1); |
| | | |
| | | //时间段 |
| | | List<String> strings = new ArrayList<>(); |
| | | // List<SiteBooking> siteBookings = siteClient.listBooks(book.getSiteId()); |
| | | List<SiteBooking> siteBookings = iSiteBookingService.list(new QueryWrapper<SiteBooking>().eq("siteId", book.getSiteId()).like("times",split1[0].substring(0,10))); |
| | | System.out.println("=======siteBookings======"+siteBookings); |
| | | for (SiteBooking siteBooking : siteBookings) { |
| | | String[] split = siteBooking.getTimes().split(";"); |
| | | for (String s : split) { |
| | | |
| | | String convertedValue = s.substring(11); |
| | | strings.add(convertedValue); |
| | | } |
| | | |
| | | } |
| | | System.out.println("======strings======="+strings); |
| | | |
| | | |
| | | List<OrderDto> timeRanges = new ArrayList<>(); |
| | | |
| | | |
| | | Site site = siteClient.listById(book.getSiteId()); |
| | | System.out.println("================"+site); |
| | | String appointmentStartTime = site.getAppointmentStartTime(); |
| | | String appointmentEndTime = site.getAppointmentEndTime(); |
| | | //生成用于比较日期是否超过的当前日期 |
| | | LocalDate currentDate = LocalDate.now(); |
| | | LocalDate parsedDate = LocalDate.parse(split1[0].substring(0,10), DateTimeFormatter.ISO_DATE); |
| | | boolean isAfterCurrentDate = parsedDate.isBefore(currentDate); |
| | | System.out.println("是否超过当前日期"+isAfterCurrentDate); |
| | | String currentTime = appointmentStartTime; |
| | | while (currentTime.compareTo(appointmentEndTime) < 0) { |
| | | String nextTime = getNextTime(currentTime); |
| | | |
| | | |
| | | String timeRange = currentTime + "-" + nextTime; |
| | | OrderDto orderDto = new OrderDto(); |
| | | orderDto.setTime(timeRange); |
| | | |
| | | LocalTime currentTime1 = LocalTime.now(); |
| | | LocalTime targetTime = LocalTime.parse(currentTime); |
| | | |
| | | boolean hasExceeded = currentTime1.isAfter(targetTime); |
| | | //是否超过当前时间 |
| | | if (hasExceeded){ |
| | | orderDto.setState(0); |
| | | } |
| | | //是否已经预定 |
| | | if (strings.contains(timeRange)){ |
| | | orderDto.setState(0); |
| | | } |
| | | //日期是否超过 |
| | | if (isAfterCurrentDate){ |
| | | orderDto.setState(0); |
| | | } |
| | | //是否是当前场地当前日期预定的 |
| | | if (strings1.contains(timeRange)){ |
| | | orderDto.setState(1); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | timeRanges.add(orderDto); |
| | | currentTime = nextTime; |
| | | } |
| | | System.out.println("-------------"+timeRanges); |
| | | model.addAttribute("timeRanges",timeRanges); |
| | | |
| | | System.out.println("======timeRanges========"+timeRanges); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | Integer objectId = UserExt.getUser().getObjectId(); |
| | | |
| | | String cityCode = null; |
| | | if(objectType == 2){//城市管理员 |
| | | CityManager cityManager = cityManagerClient.queryCityManagerById(objectId); |
| | | cityCode = cityManager.getCityCode(); |
| | | } |
| | | List<Map<String, Object>> list = storeService.queryProvince(cityCode); |
| | | model.addAttribute("province", list); |
| | | Object code = list.get(0).get("code"); |
| | | List<Map<String, Object>> list1 = storeService.queryCity(code.toString(), cityCode); |
| | | model.addAttribute("city", list1); |
| | | String code1 = list1.get(0).get("code").toString(); |
| | | List<TStore> list2 = storeService.list(new QueryWrapper<TStore>().eq("cityCode", code1).eq("state", 1)); |
| | | model.addAttribute("store", list2); |
| | | TStore store = list2.get(0); |
| | | List<TSite> list3 = siteService.list(new QueryWrapper<TSite>().eq("storeId", store.getId()).eq("state", 1)); |
| | | model.addAttribute("site", list3); |
| | | |
| | | |
| | | return PREFIX+"yuyue_edit.html"; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private IUserService userService; |
| | | @RequestMapping("/yueyue_info/{id}") |
| | | public String yueyue_info(@PathVariable("id") Integer id,Model model) { |
| | | |
| | | List<String> strings1 = new ArrayList<>(); |
| | | |
| | | SiteBooking book = iSiteBookingService.getById(id); |
| | | model.addAttribute("item", book); |
| | | if (book.getMoney()!=null){ |
| | | model.addAttribute("money",book.getMoney().split(","));} |
| | | String[] split1 = book.getTimes().split(";"); |
| | | model.addAttribute("date",split1[0].substring(0,10)); |
| | | |
| | | |
| | | User user = userService.getById(book.getCancelUserId()); |
| | | if (user!=null) { |
| | | model.addAttribute("cancelUser", user.getName()); |
| | | } |
| | | |
| | | |
| | | for (String s : split1) { |
| | | |
| | | String convertedValue = s.substring(11); |
| | | strings1.add(convertedValue); |
| | | } |
| | | |
| | | System.out.println("========strings1====="+strings1); |
| | | |
| | | //时间段 |
| | | List<String> strings = new ArrayList<>(); |
| | | // List<SiteBooking> siteBookings = siteClient.listBooks(book.getSiteId()); |
| | | List<SiteBooking> siteBookings = iSiteBookingService.list(new QueryWrapper<SiteBooking>().eq("siteId", book.getSiteId()).like("times",split1[0].substring(0,10))); |
| | | System.out.println("=======siteBookings======"+siteBookings); |
| | | for (SiteBooking siteBooking : siteBookings) { |
| | | String[] split = siteBooking.getTimes().split(";"); |
| | | for (String s : split) { |
| | | |
| | | String convertedValue = s.substring(11); |
| | | strings.add(convertedValue); |
| | | } |
| | | |
| | | } |
| | | System.out.println("======strings======="+strings); |
| | | |
| | | |
| | | List<OrderDto> timeRanges = new ArrayList<>(); |
| | | |
| | | |
| | | Site site = siteClient.listById(book.getSiteId()); |
| | | System.out.println("================"+site); |
| | | String appointmentStartTime = site.getAppointmentStartTime(); |
| | | String appointmentEndTime = site.getAppointmentEndTime(); |
| | | //生成用于比较日期是否超过的当前日期 |
| | | LocalDate currentDate = LocalDate.now(); |
| | | LocalDate parsedDate = LocalDate.parse(split1[0].substring(0,10), DateTimeFormatter.ISO_DATE); |
| | | boolean isAfterCurrentDate = parsedDate.isBefore(currentDate); |
| | | System.out.println("是否超过当前日期"+isAfterCurrentDate); |
| | | String currentTime = appointmentStartTime; |
| | | while (currentTime.compareTo(appointmentEndTime) < 0) { |
| | | String nextTime = getNextTime(currentTime); |
| | | |
| | | |
| | | String timeRange = currentTime + "-" + nextTime; |
| | | OrderDto orderDto = new OrderDto(); |
| | | orderDto.setTime(timeRange); |
| | | |
| | | LocalTime currentTime1 = LocalTime.now(); |
| | | LocalTime targetTime = LocalTime.parse(currentTime); |
| | | |
| | | boolean hasExceeded = currentTime1.isAfter(targetTime); |
| | | //是否超过当前时间 |
| | | if (hasExceeded){ |
| | | orderDto.setState(0); |
| | | } |
| | | //是否已经预定 |
| | | if (strings.contains(timeRange)){ |
| | | orderDto.setState(0); |
| | | } |
| | | //日期是否超过 |
| | | if (isAfterCurrentDate){ |
| | | orderDto.setState(0); |
| | | } |
| | | //是否是当前场地当前日期预定的 |
| | | if (strings1.contains(timeRange)){ |
| | | orderDto.setState(1); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | timeRanges.add(orderDto); |
| | | currentTime = nextTime; |
| | | } |
| | | System.out.println("-------------"+timeRanges); |
| | | model.addAttribute("timeRanges",timeRanges); |
| | | |
| | | System.out.println("======timeRanges========"+timeRanges); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | Integer objectId = UserExt.getUser().getObjectId(); |
| | | |
| | | String cityCode = null; |
| | | if(objectType == 2){//城市管理员 |
| | | CityManager cityManager = cityManagerClient.queryCityManagerById(objectId); |
| | | cityCode = cityManager.getCityCode(); |
| | | } |
| | | List<Map<String, Object>> list = storeService.queryProvince(cityCode); |
| | | model.addAttribute("province", list); |
| | | Object code = list.get(0).get("code"); |
| | | List<Map<String, Object>> list1 = storeService.queryCity(code.toString(), cityCode); |
| | | model.addAttribute("city", list1); |
| | | String code1 = list1.get(0).get("code").toString(); |
| | | List<TStore> list2 = storeService.list(new QueryWrapper<TStore>().eq("cityCode", code1).eq("state", 1)); |
| | | model.addAttribute("store", list2); |
| | | TStore store = list2.get(0); |
| | | List<TSite> list3 = siteService.list(new QueryWrapper<TSite>().eq("storeId", store.getId()).eq("state", 1)); |
| | | model.addAttribute("site", list3); |
| | | |
| | | |
| | | return PREFIX+"yuyue_info.html"; |
| | | } |
| | | |
| | | |
| | | |
| | | @RequestMapping("/paike") |
| | |
| | | |
| | | @RequestMapping("/yuyuetimes/{id}") |
| | | @ResponseBody |
| | | public List<OrderDto> yuyuetimes(@PathVariable("id") Integer id) { |
| | | |
| | | public List<OrderDto> yuyuetimes(@PathVariable("id") Integer id,String date) { |
| | | System.out.println("=======date======"+date); |
| | | |
| | | List<String> strings = new ArrayList<>(); |
| | | List<SiteBooking> siteBookings = siteClient.listBooks(id); |
| | | |
| | | // List<SiteBooking> siteBookings = siteClient.listBooks(id); |
| | | List<SiteBooking> siteBookings = iSiteBookingService.list(new QueryWrapper<SiteBooking>().eq("siteId", id).like("times",date)); |
| | | System.out.println("=======siteBookings======"+siteBookings); |
| | | for (SiteBooking siteBooking : siteBookings) { |
| | | String[] split = siteBooking.getTimes().split(";"); |
| | |
| | | } |
| | | |
| | | return String.format("%02d:%02d", hour, minute); |
| | | |
| | | // String[] parts = currentTime.split(":"); |
| | | // int hour = Integer.parseInt(parts[0]); |
| | | // int minute = Integer.parseInt(parts[1]); |
| | | // |
| | | // if (minute == 45) { |
| | | // hour++; |
| | | // minute = 0; |
| | | // } else if (minute == 0){ |
| | | // minute = 15; |
| | | // }else if (minute == 15){ |
| | | // minute = 30; |
| | | // }else if (minute == 30){ |
| | | // minute = 45; |
| | | // } |
| | | // |
| | | // return String.format("%02d:%02d", hour, minute); |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | return new ResultUtil<>(null,200,null,null,null); |
| | | } |
| | | |
| | | @RequestMapping("/orderedit") |
| | | @ResponseBody |
| | | public ResultUtil orderedit(SiteBooking siteBooking){ |
| | | iSiteBookingService.updateById(siteBooking); |
| | | |
| | | System.out.println("================="+siteBooking); |
| | | |
| | | return new ResultUtil<>(null,200,null,null,null); |
| | | } |
| | | |
| | | } |