| | |
| | | import com.dsh.course.service.TGameConfigService; |
| | | import com.dsh.guns.config.UserExt; |
| | | import com.dsh.guns.core.base.controller.BaseController; |
| | | import com.dsh.guns.core.util.ToolUtil; |
| | | import com.dsh.guns.modular.system.controller.util.MD5; |
| | | import com.dsh.guns.modular.system.model.*; |
| | | import com.dsh.guns.modular.system.model.dto.*; |
| | | import com.dsh.guns.modular.system.service.*; |
| | | import com.dsh.guns.modular.system.util.DateComparisonExample; |
| | | import com.dsh.guns.modular.system.util.HttpRequestUtil; |
| | | import com.dsh.guns.modular.system.util.ResultUtil; |
| | | |
| | | import com.dsh.course.entity.SiteLock; |
| | | import org.json.JSONObject; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalTime; |
| | | import java.time.format.DateTimeFormatter; |
| | |
| | | // 添加门禁 红蓝方 |
| | | TSite si = siteService.getById(site); |
| | | TStore st = storeService.getById(store); |
| | | map3.put("sign", "0DB011836143EEE2C2E072967C9F4E4B"); |
| | | map3.put("space_id", si.getId() + ""); |
| | | map3.put("name", sutuName); |
| | | map3.put("city_code", ""); |
| | | String s3 = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addDevice", map3); |
| | | System.out.println("---------------------------"+s3); |
| | | JSONObject jsonObject = new JSONObject(s3); |
| | | // 获取 data 字段的值 |
| | | JSONObject dataObject = jsonObject.getJSONObject("data"); |
| | | // 获取 sutu_id 字段的值 |
| | | String sutuIdValue = dataObject.getString("sutu_id"); |
| | | Integer sutuId = Integer.valueOf(sutuIdValue); |
| | | game.setSutuId(sutuId); |
| | | // map3.put("sign", "0DB011836143EEE2C2E072967C9F4E4B"); |
| | | // map3.put("space_id", si.getId() + ""); |
| | | // map3.put("name", ToolUtil.isEmpty(sutuName) ? "" : sutuName); |
| | | // map3.put("city_code", ""); |
| | | // String s3 = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addDevice", map3); |
| | | // System.out.println("---------------------------"+s3); |
| | | // JSONObject jsonObject = new JSONObject(s3); |
| | | // // 获取 data 字段的值 |
| | | // JSONObject dataObject = jsonObject.getJSONObject("data"); |
| | | // // 获取 sutu_id 字段的值 |
| | | // String sutuIdValue = dataObject.getString("sutu_id"); |
| | | // Integer sutuId = Integer.valueOf(sutuIdValue); |
| | | // game.setSutuId(sutuId); |
| | | Integer gameId = ballClient.save(game); |
| | | List<TGameConfig> gameConfigList = new ArrayList<>(); |
| | | List<TGameConfig> gameConfigList = new ArrayList<>(); |
| | | |
| | | |
| | | |
| | | //玩湃跨城赛 |
| | | |
| | | //玩湃跨城赛 |
| | | TGameConfig gameConfigkuacheng = new TGameConfig(); |
| | | gameConfigkuacheng.setId(kcId); |
| | | gameConfigkuacheng.setGameId(kuachengId); |
| | |
| | | gameConfigkuacheng.setOtherId(gameId); |
| | | System.out.println("========gameConfig======"+gameConfigkuacheng); |
| | | gameConfigList.add(gameConfigkuacheng); |
| | | System.out.println("======gameConfigList======="+gameConfigList); |
| | | System.out.println("======gameConfigList======="+gameConfigList); |
| | | |
| | | //社区冠军赛 |
| | | |
| | |
| | | String convertedValue = s.substring(11); |
| | | strings1.add(convertedValue); |
| | | } |
| | | |
| | | switch (book.getStatus()){ |
| | | case 0: |
| | | model.addAttribute("state","待支付"); |
| | | break; |
| | | case 1: |
| | | model.addAttribute("state","待核销"); |
| | | break; |
| | | case 2: |
| | | model.addAttribute("state","已到店"); |
| | | break; |
| | | case 3: |
| | | model.addAttribute("state","已完成"); |
| | | break; |
| | | case 4: |
| | | model.addAttribute("state","已过期"); |
| | | break; |
| | | case 5: |
| | | model.addAttribute("state","已取消"); |
| | | break; |
| | | } |
| | | System.out.println("========strings1====="+strings1); |
| | | |
| | | //时间段 |
| | |
| | | } |
| | | 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; |
| | | |
| | | |
| | | 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); |
| | | // 查询运营商下所有门店 所有场地 |
| | | if (objectType == 2){ |
| | | List<TStore> stores = storeService.list(new QueryWrapper<TStore>().eq("operatorId", objectId)); |
| | | model.addAttribute("store", stores); |
| | | // 门店ids |
| | | List<Integer> storeIds = stores.stream().map(TStore::getId).collect(Collectors.toList()); |
| | | List<TSite> sites = siteService.list(new QueryWrapper<TSite>().in("storeId", storeIds)); |
| | | model.addAttribute("site", sites); |
| | | } |
| | | model.addAttribute("province", book.getProvince()); |
| | | model.addAttribute("city", book.getCity()); |
| | | model.addAttribute("store",storeService.getById(book.getStoreId()).getName()); |
| | | model.addAttribute("siteName",siteService.getById(book.getSiteId()).getName()); |
| | | model.addAttribute("objectType", objectType); |
| | | return PREFIX+"yuyue_info.html"; |
| | | } |
| | |
| | | @RequestMapping("/getStudentTotal") |
| | | @ResponseBody |
| | | public List<Map<String, Object>>getStudentTotal(@RequestBody StudentQeryDto studentQeryDto) { |
| | | System.out.println("========ballQueryDto======"+studentQeryDto); |
| | | if (studentQeryDto.getTimes()!=null&& studentQeryDto.getTimes()!=""){ |
| | | String[] split = studentQeryDto.getTimes().split(","); |
| | | studentQeryDto.setStart(split[0]); |
| | |
| | | studentQeryDto.setCoursePackageIds(coursePackageByStoreIds); |
| | | } |
| | | List<Map<String, Object>> pays = coursePackageClient.getStudentTotal(studentQeryDto); |
| | | |
| | | System.out.println("=========getStudentTotal======="+pays); |
| | | |
| | | return pays; |
| | | } |
| | | |
| | |
| | | @RequestMapping("/bypac") |
| | | @ResponseBody |
| | | public List<Map<String, Object>>bypac(@RequestBody PacQueryDto pacQueryDto) { |
| | | System.out.println("========ballQueryDto======"+pacQueryDto); |
| | | if (pacQueryDto.getTimes()!=null&& pacQueryDto.getTimes()!=""){ |
| | | String[] split = pacQueryDto.getTimes().split(","); |
| | | pacQueryDto.setStart(split[0]); |
| | | pacQueryDto.setEnd(split[1]); |
| | | } |
| | | if (UserExt.getUser().getObjectType() == 2){ |
| | | List<Integer> storeIds = storeService.list(new QueryWrapper<TStore>().eq("operatorId", UserExt.getUser().getObjectId())) |
| | | QueryWrapper<TStore> queryWrapper = new QueryWrapper<TStore>().eq("operatorId", UserExt.getUser().getObjectId()).eq("state", 1); |
| | | if(ToolUtil.isNotEmpty(pacQueryDto.getCityCode())){ |
| | | queryWrapper.eq("cityCode", pacQueryDto.getCityCode()); |
| | | } |
| | | if(ToolUtil.isNotEmpty(pacQueryDto.getName())){ |
| | | queryWrapper.like("name", pacQueryDto.getName()); |
| | | } |
| | | List<Integer> storeIds = storeService.list(queryWrapper) |
| | | .stream().map(TStore::getId).collect(Collectors.toList()); |
| | | storeIds.add(-1); |
| | | pacQueryDto.setStoreIds(storeIds); |
| | | }else{ |
| | | QueryWrapper<TStore> queryWrapper = new QueryWrapper<TStore>().eq("state", 1); |
| | | if(ToolUtil.isNotEmpty(pacQueryDto.getCityCode())){ |
| | | queryWrapper.eq("cityCode", pacQueryDto.getCityCode()); |
| | | } |
| | | if(ToolUtil.isNotEmpty(pacQueryDto.getName())){ |
| | | queryWrapper.like("name", pacQueryDto.getName()); |
| | | } |
| | | List<Integer> storeIds = storeService.list(queryWrapper) |
| | | .stream().map(TStore::getId).collect(Collectors.toList()); |
| | | storeIds.add(-1); |
| | | pacQueryDto.setStoreIds(storeIds); |
| | | } |
| | | List<Map<String, Object>> pays = coursePackageClient.bypac(pacQueryDto); |
| | | System.out.println("=========getStudentTotal======="+pays); |
| | | return pays; |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (Integer.parseInt(vo.get("status").toString())==1 ){ |
| | | String dateTimeStr = vo.get("times").toString(); |
| | | String formattedDateTimeStr = dateTimeStr.substring(0, 11) + dateTimeStr.substring(17); |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | try { |
| | | Date date = sdf.parse(formattedDateTimeStr); |
| | | if (new Date().after(date)){ |
| | | vo.put("status",4); |
| | | } |
| | | |
| | | System.out.println(date); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | return orders; |
| | | } |
| | |
| | | System.out.println("=====stie====="+site); |
| | | System.out.println("=====type====="+type); |
| | | |
| | | if (type == 0 ){ |
| | | if (type == 1 ){ |
| | | doubles.add(site.getCashPrice()); |
| | | doubles.add(Double.valueOf(site.getPlayPaiCoin())); |
| | | return doubles; |
| | |
| | | private SiteClient siteClient; |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private ISiteLockService siteLockService; |
| | | |
| | | |
| | | @RequestMapping("/yuyuetimes/{id}") |
| | | @ResponseBody |
| | | public List<OrderDto> yuyuetimes(@PathVariable("id") Integer id,String date) { |
| | | System.out.println("=======date======"+date); |
| | | public List<OrderDto> yuyuetimes(@PathVariable("id") Integer id,String date,String siteName,String halfName) throws ParseException { |
| | | // System.out.println("=======date======"+date); |
| | | // |
| | | // List<String> strings = new ArrayList<>(); |
| | | // |
| | | //// 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(";"); |
| | | // 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(id); |
| | | //System.out.println("================"+site); |
| | | // String appointmentStartTime = site.getAppointmentStartTime(); |
| | | // String appointmentEndTime = site.getAppointmentEndTime(); |
| | | // |
| | | // String currentTime = appointmentStartTime; |
| | | // while (currentTime.compareTo(appointmentEndTime) < 0){ |
| | | // String nextTime = null; |
| | | // if("智慧场地".equals(site.getTypeName())){ |
| | | // nextTime=getNextTimeOne(currentTime); |
| | | // }else { |
| | | // 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); |
| | | // } |
| | | // |
| | | // |
| | | // timeRanges.add(orderDto); |
| | | // currentTime = nextTime; |
| | | // } |
| | | // System.out.println("-------------"+timeRanges); |
| | | // |
| | | // return timeRanges; |
| | | |
| | | |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | Date now = new Date(); |
| | | |
| | | System.out.println("=======date======" + date); |
| | | List<String> strings = new ArrayList<>(); |
| | | |
| | | // 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(";"); |
| | | for (String s : split) { |
| | | List<SiteBooking> siteBookings = iSiteBookingService.list(new QueryWrapper<SiteBooking>().eq("siteId", id).ne("status", 5).eq("nextName", siteName).like("times", date)); |
| | | |
| | | String convertedValue = s.substring(11); |
| | | strings.add(convertedValue); |
| | | } |
| | | |
| | | if (siteName == null || siteName.equals("")) { |
| | | siteBookings = iSiteBookingService.list(new QueryWrapper<SiteBooking>().eq("siteId", id).ne("status", 5).like("times", date)); |
| | | } |
| | | System.out.println("======strings======="+strings); |
| | | |
| | | |
| | | System.out.println("=======siteBookings======" + siteBookings); |
| | | for (SiteBooking siteBooking : siteBookings) { |
| | | |
| | | |
| | | String[] split = siteBooking.getTimes().split(";"); |
| | | |
| | | if (siteBooking.getIsHalf() == 2) { |
| | | for (String s : split) { |
| | | String convertedValue = s.substring(11); |
| | | strings.add(convertedValue); |
| | | } |
| | | } else { |
| | | if (halfName == null) { |
| | | for (String s : split) { |
| | | String convertedValue = s.substring(11); |
| | | strings.add(convertedValue); |
| | | } |
| | | } |
| | | |
| | | if (siteBooking.getHalfName().equals(halfName)) { |
| | | 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(id); |
| | | System.out.println("================"+site); |
| | | TSite site = siteService.getById(id); |
| | | System.out.println("================" + site); |
| | | String appointmentStartTime = site.getAppointmentStartTime(); |
| | | String appointmentEndTime = site.getAppointmentEndTime(); |
| | | |
| | | String currentTime = appointmentStartTime; |
| | | while (currentTime.compareTo(appointmentEndTime) < 0) { |
| | | String nextTime = null; |
| | | if("智慧场地".equals(site.getTypeName())){ |
| | | nextTime=getNextTimeOne(currentTime); |
| | | }else { |
| | | nextTime= getNextTime(currentTime); |
| | | if ("智慧场地".equals(site.getTypeName())) { |
| | | nextTime = getNextTimeOne(currentTime); |
| | | } else { |
| | | nextTime = getNextTime(currentTime); |
| | | } |
| | | // String nextTime = getNextTime(currentTime); |
| | | |
| | | |
| | | String timeRange = currentTime + "-" + nextTime; |
| | |
| | | LocalTime targetTime = LocalTime.parse(currentTime); |
| | | |
| | | boolean hasExceeded = currentTime1.isAfter(targetTime); |
| | | if (hasExceeded){ |
| | | orderDto.setState(0); |
| | | } |
| | | if (strings.contains(timeRange)){ |
| | | orderDto.setState(0); |
| | | } |
| | | // if (hasExceeded){ |
| | | // orderDto.setSelectable(0); |
| | | // } |
| | | if (strings.contains(timeRange)) { |
| | | |
| | | orderDto.setState(0); |
| | | } else { |
| | | |
| | | String stime = date + " " + currentTime; |
| | | String etime = date + " " + nextTime; |
| | | Date isPass = format.parse(etime); |
| | | |
| | | |
| | | |
| | | orderDto.setState(1); |
| | | // 查出lock |
| | | List<SiteLock> list = siteLockService.list(new LambdaQueryWrapper<SiteLock>().eq(SiteLock::getSiteId, id)); |
| | | for (SiteLock siteLock : list) { |
| | | boolean stringDateBetween = DateComparisonExample.isStringDateBetween(stime + " - " + etime, siteLock.getStartTime(), siteLock.getEndTime()); |
| | | if (stringDateBetween) { |
| | | orderDto.setState(0); |
| | | } |
| | | if (DateComparisonExample.isStringWithinTimeRange(stime, siteLock.getStartTime(), siteLock.getEndTime())) { |
| | | orderDto.setState(0); |
| | | } |
| | | if (DateComparisonExample.isStringWithinTimeRange(etime, siteLock.getStartTime(), siteLock.getEndTime())) { |
| | | orderDto.setState(0); |
| | | } |
| | | |
| | | } |
| | | if (isPass.before(now)){ |
| | | orderDto.setState(0); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | timeRanges.add(orderDto); |
| | | currentTime = nextTime; |
| | | } |
| | | System.out.println("-------------"+timeRanges); |
| | | System.out.println("-------------" + timeRanges); |
| | | |
| | | return timeRanges; |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | return split; |
| | | } |
| | | |
| | | @RequestMapping("/nextName/{id}") |
| | | @ResponseBody |
| | | public String[] nextName(@PathVariable("id") Integer id) { |
| | | TSite byId = siteService.getById(id); |
| | | String[] split = byId.getNextName().split(","); |
| | | System.out.println("=-============"+split); |
| | | |
| | | return split; |
| | | } |
| | | |
| | | |
| | | @RequestMapping("/yuyue_add") |
| | | public String yuyueadd(Model model) { |
| | |
| | | siteBooking.setInsertTime(new Date()); |
| | | siteBooking.setState(1); |
| | | siteBooking.setStatus(0); |
| | | siteBooking.setAddType(1); |
| | | |
| | | //存开始和结束时间 |
| | | String times = siteBooking.getTimes(); |
| | | String[] dates = times.split(";"); |
| | | |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | try { |
| | | String start = dates[0]; |
| | | String startDateStr = start.substring(0, start.lastIndexOf("-")); |
| | | Date startDate = format.parse(startDateStr); |
| | | |
| | | String end = dates[dates.length - 1]; |
| | | String[] str = end.split(" "); |
| | | String endDateStr = str[0] + " " + str[1].substring(str[1].indexOf("-") + 1); |
| | | Date endDate = format.parse(endDateStr); |
| | | siteBooking.setStartTime(startDate); |
| | | siteBooking.setEndTime(endDate); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | siteBooking.setPayType(2); |
| | | //存多少钱 |
| | | String money = siteBooking.getMoney(); |
| | | String[] moneys = money.split(","); |
| | | siteBooking.setPayMoney(Double.valueOf(moneys[0])); |
| | | // 查询当前预约人是否是会员 |
| | | String phone = siteBooking.getPhone(); |
| | | String booker = siteBooking.getBooker(); |