From e030255c23c7ba3e2cbad1036a810d6d72fa864f Mon Sep 17 00:00:00 2001 From: liujie <liujie> Date: 星期四, 26 十月 2023 18:04:58 +0800 Subject: [PATCH] 修改bug --- cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/system/BallController.java | 143 ++++++++++++++++++++++++++++++++++++----------- 1 files changed, 108 insertions(+), 35 deletions(-) diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/system/BallController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/system/BallController.java index e656163..423bbaf 100644 --- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/system/BallController.java +++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/system/BallController.java @@ -57,6 +57,7 @@ import java.time.LocalTime; import java.time.format.DateTimeFormatter; import java.util.*; +import java.util.stream.Collectors; @Controller @RequestMapping("/ball") @@ -171,6 +172,20 @@ return new ResultUtil<>(0,0,"到店成功",null,null); } + + @RequestMapping("/confirm/{id}") + @ResponseBody + public ResultUtil confirm(@PathVariable("id") Integer id) { + + System.out.println("============"+id); + SiteBooking siteBooking = new SiteBooking(); + siteBooking.setId(id); + siteBooking.setStatus(1); + iSiteBookingService.updateById(siteBooking); + + return new ResultUtil<>(0,0,"手动支付成功",null,null); + } + /** * 获取变更列表 @@ -599,7 +614,12 @@ System.out.println("是否超过当前日期"+isAfterCurrentDate); String currentTime = appointmentStartTime; while (currentTime.compareTo(appointmentEndTime) < 0) { - String nextTime = getNextTime(currentTime); + String nextTime = null; + if("智慧场地".equals(site.getTypeName())){ + nextTime=getNextTimeOne(currentTime); + }else { + nextTime= getNextTime(currentTime); + } String timeRange = currentTime + "-" + nextTime; @@ -655,10 +675,14 @@ 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)); + if(UserExt.getUser().getObjectType()==3){ + list2=storeService.list(new QueryWrapper<TStore>().eq("id", UserExt.getUser().getObjectId()).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); + model.addAttribute("objType", UserExt.getUser().getObjectType()); return PREFIX+"yuyue_edit.html"; @@ -880,6 +904,17 @@ @RequestMapping("/yuyuelist") @ResponseBody public List<Map<String,Object>> yuyuelist(BookingQuery bookingQuery) { + Integer objectType = UserExt.getUser().getObjectType(); + + if(objectType==2){ + List<Integer> operatorId = storeService.list(new QueryWrapper<TStore>() + .eq("operatorId", UserExt.getUser().getObjectId())) + .stream().map(TStore::getId).collect(Collectors.toList()); + bookingQuery.setStoreIds(operatorId); + } + if(objectType==3){ + bookingQuery.setStoreId(UserExt.getUser().getObjectId()); + } List<Map<String,Object>> orders = ballClient.listorder(bookingQuery); System.out.println("=======ballQueryDto=========="+bookingQuery); @@ -959,7 +994,13 @@ String currentTime = appointmentStartTime; while (currentTime.compareTo(appointmentEndTime) < 0) { - String nextTime = getNextTime(currentTime); + String nextTime = null; + if("智慧场地".equals(site.getTypeName())){ + nextTime=getNextTimeOne(currentTime); + }else { + nextTime= getNextTime(currentTime); + } +// String nextTime = getNextTime(currentTime); String timeRange = currentTime + "-" + nextTime; @@ -1001,26 +1042,30 @@ 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); - } + + public static String getNextTimeOne(String currentTime) { + + 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); + + } @RequestMapping("/halfName/{id}") @@ -1040,20 +1085,42 @@ String cityCode = null; if(objectType == 2){//城市管理员 - CityManager cityManager = cityManagerClient.queryCityManagerById(objectId); - cityCode = cityManager.getCityCode(); + // 获取到这个运营商下面的所有门店 + List<TStore> operatorId = storeService.list(new QueryWrapper<TStore>().eq("operatorId",objectId)); + model.addAttribute("store", operatorId); + List<Coach> coach = coachClient.queryCoachByOperatorId(objectId); + model.addAttribute("coach", coach); + // 如果该运营商下面没有门店 + if (operatorId.size()==0){ + List<TStore> o = new ArrayList<>(); + List<TSite> tSites = new ArrayList<>(); + model.addAttribute("store", o); + model.addAttribute("site", tSites); + }else{ + List<TSite> storeId = siteService.list(new QueryWrapper<TSite>() + .eq("storeId", operatorId.get(0).getId())); + model.addAttribute("site", storeId); + } + }else { + 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 =new ArrayList<>(); + if(objectType==3){ + list2 = storeService.list(new QueryWrapper<TStore>().eq("id", objectId).eq("state", 1)); + }else { + 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); } - 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); + model.addAttribute("objectType",objectType); return PREFIX+"yuyue_add.html"; } @@ -1065,10 +1132,16 @@ siteBooking.setInsertTime(new Date()); siteBooking.setState(1); siteBooking.setStatus(0); - - siteClient.addSiteBooking(siteBooking); + // 如果是运营商添加的话 根据门店的省市来存储 + if (UserExt.getUser().getObjectType() == 2){ + TStore byId = storeService.getById(siteBooking.getStoreId()); + siteBooking.setProvince(byId.getProvince()); + siteBooking.setProvinceCode(byId.getProvinceCode()); + siteBooking.setCity(byId.getCity()); + siteBooking.setCityCode(byId.getCityCode()); + } + siteClient.addSiteBooking(siteBooking); System.out.println("================="+siteBooking); - return new ResultUtil<>(null,200,null,null,null); } -- Gitblit v1.7.1