| | |
| | | package com.dsh.guns.modular.system.controller.system; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.nacos.common.utils.Md5Utils; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | |
| | | import com.dsh.course.feignClient.account.AppUserClient; |
| | | import com.dsh.course.feignClient.account.CityManagerClient; |
| | | import com.dsh.course.feignClient.account.CoachClient; |
| | | import com.dsh.course.feignClient.account.model.CityManager; |
| | | import com.dsh.course.feignClient.account.model.Coach; |
| | | import com.dsh.course.feignClient.account.model.TAppUser; |
| | | import com.dsh.course.feignClient.course.CoursePackageClient; |
| | |
| | | import com.dsh.course.feignClient.course.CoursePackagePaymentConfigClient; |
| | | import com.dsh.course.feignClient.course.CoursePackageTypeClient; |
| | | import com.dsh.course.feignClient.course.model.TCoursePackage; |
| | | import com.dsh.course.feignClient.course.model.TCoursePackageType; |
| | | import com.dsh.course.feignClient.other.BallClient; |
| | | import com.dsh.course.feignClient.other.SiteClient; |
| | | import com.dsh.course.feignClient.other.model.Site; |
| | | import com.dsh.course.service.TGameConfigService; |
| | | import com.dsh.course.util.UUIDUtil; |
| | | 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.HttpRequestUtil; |
| | | import com.dsh.guns.modular.system.util.ResultUtil; |
| | | import com.google.common.base.Ascii; |
| | | import com.google.gson.JsonObject; |
| | | import com.netflix.ribbon.proxy.annotation.Http; |
| | | import com.sun.org.apache.xerces.internal.impl.io.ASCIIReader; |
| | | import io.netty.util.AsciiString; |
| | | import io.rong.util.HttpUtil; |
| | | import io.swagger.models.auth.In; |
| | | import org.apache.commons.lang.StringEscapeUtils; |
| | | import org.apache.logging.log4j.util.Base64Util; |
| | | import com.dsh.guns.modular.system.util.*; |
| | | import com.dsh.course.entity.SiteLock; |
| | | import com.google.gson.Gson; |
| | | import com.google.zxing.BarcodeFormat; |
| | | import com.google.zxing.EncodeHintType; |
| | | import com.google.zxing.WriterException; |
| | | import com.google.zxing.client.j2se.MatrixToImageWriter; |
| | | import com.google.zxing.common.BitMatrix; |
| | | import com.google.zxing.qrcode.QRCodeWriter; |
| | | import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; |
| | | import org.apache.commons.fileupload.FileItem; |
| | | import org.apache.tomcat.util.http.fileupload.ByteArrayOutputStream; |
| | | import org.json.JSONArray; |
| | | import org.json.JSONObject; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpRequest; |
| | | import org.springframework.core.io.ByteArrayResource; |
| | | import org.springframework.mock.web.MockMultipartFile; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.util.Base64Utils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import org.springframework.web.multipart.commons.CommonsMultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.BufferedReader; |
| | | import java.io.InputStreamReader; |
| | | import java.io.OutputStream; |
| | | import javax.imageio.ImageIO; |
| | | |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.net.HttpURLConnection; |
| | | import java.net.URL; |
| | | import java.nio.charset.StandardCharsets; |
| | | |
| | | import java.nio.file.FileSystems; |
| | | import java.nio.file.Path; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | |
| | | |
| | | @RequestMapping("/tolist") |
| | | public String tolist(Model model) { |
| | | |
| | | List<TCity> list = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0)); |
| | | model.addAttribute("list",list); |
| | | String roleid = UserExt.getUser().getRoleid(); |
| | |
| | | @ResponseBody |
| | | public ResultUtil confirm(@PathVariable("id") Integer id) { |
| | | |
| | | SiteBooking byId = iSiteBookingService.getById(id); |
| | | String money = byId.getMoney(); |
| | | String[] split = money.split(","); |
| | | Double aDouble = Double.valueOf(split[0]); |
| | | System.out.println("============"+id); |
| | | SiteBooking siteBooking = new SiteBooking(); |
| | | siteBooking.setPayMoney(aDouble); |
| | | siteBooking.setId(id); |
| | | siteBooking.setStatus(1); |
| | | siteBooking.setPayType(4); |
| | |
| | | @RequestMapping("/list") |
| | | @ResponseBody |
| | | public List<Game> changelist(BallQueryDto ballQueryDto) { |
| | | System.out.println("=======ballQueryDto=========="+ballQueryDto); |
| | | System.out.println("=======ballQueryDto=========="+ballQueryDto); |
| | | User user = UserExt.getUser(); |
| | | ballQueryDto.setType(user.getObjectType()); |
| | | ballQueryDto.setId(user.getObjectId()); |
| | |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | public static MultipartFile convert(BufferedImage bufferedImage, String fileName) throws IOException { |
| | | // 将 BufferedImage 转换为字节数组 |
| | | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
| | | ImageIO.write(bufferedImage, "png", baos); |
| | | byte[] bytes = baos.toByteArray(); |
| | | |
| | | // 创建 ByteArrayResource |
| | | ByteArrayResource resource = new ByteArrayResource(bytes); |
| | | |
| | | // 创建 MockMultipartFile |
| | | MockMultipartFile multipartFile = new MockMultipartFile( |
| | | "file", |
| | | fileName, |
| | | "image/png", |
| | | resource.getInputStream() |
| | | ); |
| | | |
| | | return multipartFile; |
| | | } |
| | | |
| | | @RequestMapping("/save") |
| | | @ResponseBody |
| | | public ResultUtil save(Integer id, String operationId, String red, String blue, String province, String city, Integer site, Integer store |
| | |
| | | , String zs, BigDecimal zsCoin, BigDecimal zsCash, String zsImage, BigDecimal zsInt, Integer zsId,Integer zsIId |
| | | , String zs2, BigDecimal zs2Coin, BigDecimal zs2Cash, String zs2Image, BigDecimal zs2Int, Integer zs2Id,Integer zs2IId |
| | | , String ly, BigDecimal lyCoin, BigDecimal lyCash, String lyImage, BigDecimal lyInt, Integer lyId,Integer lyIId |
| | | , String v3, BigDecimal v3Coin, BigDecimal v3Cash, String v3Image, BigDecimal v3Int, Integer v3Id,Integer v3IId |
| | | ,String sutuName |
| | | |
| | | ) { |
| | | ) throws Exception { |
| | | |
| | | Game game = new Game(); |
| | | game.setRed(red); |
| | | game.setRedName(red); |
| | | game.setState(0); |
| | | game.setBlue(blue); |
| | | game.setBlueName(blue); |
| | | |
| | | |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | |
| | | game.setId(id); |
| | | |
| | | |
| | | |
| | | if (!operationId.equals("平台")){ |
| | | game.setOperationId(Integer.valueOf(operationId));} |
| | | else { |
| | | game.setOperationId(0); |
| | | } |
| | | System.out.println("============"+game); |
| | | |
| | | // 判断是新增还是修改 修改不会重新生成sutuId |
| | | if (game.getId()==null) { |
| | | HashMap<String, String> map5 = new HashMap<>(); |
| | | map5.put("space_id", store + ""); |
| | | map5.put("area_id", site + ""); |
| | | String s5 = HttpRequestUtil.getRequest("https://port.daowepark.com/v7/user_api/general/get_space_sutu", map5); |
| | | System.err.println(s5); |
| | | JSONObject jsonObject5 = new JSONObject(s5); |
| | | JSONArray data = jsonObject5.getJSONArray("data"); |
| | | Integer temp = null; // 临时sutuid |
| | | Integer temp1 = null; // 临时sutuid |
| | | TSite si = siteService.getById(site); |
| | | if (data.length() == 0) { |
| | | // 这个场地没有添加过sutu |
| | | HashMap<String, String> map3 = new HashMap<>(); |
| | | HashMap<String, String> map4 = new HashMap<>(); |
| | | // 添加sutu编号 |
| | | // 调用两次 创建sutu |
| | | map3.put("sign", "0DB011836143EEE2C2E072967C9F4E4B"); |
| | | map4.put("sign", "0DB011836143EEE2C2E072967C9F4E4B"); |
| | | map3.put("space_id", store + ""); |
| | | map3.put("area_id", si.getId() + ""); |
| | | map4.put("space_id", store + ""); |
| | | map4.put("area_id", si.getId() + ""); |
| | | map3.put("name", blue); |
| | | map4.put("name", red); |
| | | map3.put("city_code", city); |
| | | map4.put("city_code", city); |
| | | String s3 = HttpRequestUtil.postRequest("https://port.daowepark.com/v7/user_api/general/addSpaceSutu", map3); |
| | | String s4 = HttpRequestUtil.postRequest("https://port.daowepark.com/v7/user_api/general/addSpaceSutu", map4); |
| | | JSONObject jsonObject = new JSONObject(s3); |
| | | JSONObject jsonObject1 = new JSONObject(s4); |
| | | // 获取 data 字段的值 |
| | | JSONObject dataObject = jsonObject.getJSONObject("data"); |
| | | JSONObject dataObject1 = jsonObject1.getJSONObject("data"); |
| | | // 获取 sutu_id 字段的值 |
| | | String sutuIdValue = dataObject.getString("sutu_id"); |
| | | String sutuIdValue1 = dataObject1.getString("sutu_id"); |
| | | Integer sutuId = Integer.valueOf(sutuIdValue); |
| | | Integer sutuId1 = Integer.valueOf(sutuIdValue1); |
| | | game.setBlue("" + sutuId); |
| | | game.setRed("" + sutuId1); |
| | | // 生成红蓝sutu二维码 |
| | | HashMap<String, String> blueCode = new HashMap<>(); |
| | | blueCode.put("scan_type", "1000"); |
| | | blueCode.put("sutu_id", "" + sutuId); |
| | | blueCode.put("space_id", si.getId() + ""); |
| | | HashMap<String, String> redCode = new HashMap<>(); |
| | | redCode.put("scan_type", "1000"); |
| | | redCode.put("sutu_id", sutuId1 + ""); |
| | | redCode.put("space_id", si.getId() + ""); |
| | | String blueS = "{\"scan_type\": 1000, \"space_id\": " + si.getId() + ", \"sutu_id\": " + sutuId + "}"; |
| | | String redS = "{\"scan_type\": 1000, \"space_id\": " + si.getId() + ", \"sutu_id\": " + sutuId1 + "}"; |
| | | MyQrCodeUtil.createCodeToFile(blueS); |
| | | MyQrCodeUtil.createCodeToFile(redS); |
| | | BufferedImage blueImage = QRCodeUtil.createImage(blueS); |
| | | BufferedImage redImage = QRCodeUtil.createImage(redS); |
| | | MultipartFile blueFile = convert(blueImage, new Date().getTime() + UUIDUtil.getRandomCode(3) + ".PNG"); |
| | | MultipartFile redFile = convert(redImage, new Date().getTime() + UUIDUtil.getRandomCode(3) + ".PNG"); |
| | | String s = OssUploadUtil.ossUpload("img/", blueFile); |
| | | String s1 = OssUploadUtil.ossUpload("img/", redFile); |
| | | game.setBlueCode(s); |
| | | game.setRedCode(s1); |
| | | } else { |
| | | Integer sutuid = 0; |
| | | Integer sutuid1 = 0; |
| | | JSONObject element = data.getJSONObject(0); |
| | | if (site == 27) { |
| | | sutuid = 1036; |
| | | sutuid1 = 1037; |
| | | game.setBlue(sutuid.toString()); |
| | | game.setRed(sutuid1.toString()); |
| | | } else { |
| | | sutuid = element.getInt("id"); |
| | | game.setBlue(sutuid.toString()); |
| | | JSONObject element1 = data.getJSONObject(1); |
| | | sutuid1 = element1.getInt("id"); |
| | | game.setRed(sutuid1.toString()); |
| | | } |
| | | // 生成红蓝sutu二维码 |
| | | HashMap<String, String> blueCode = new HashMap<>(); |
| | | blueCode.put("scan_type", "1000"); |
| | | blueCode.put("sutu_id", "" + sutuid); |
| | | blueCode.put("space_id", si.getId() + ""); |
| | | HashMap<String, String> redCode = new HashMap<>(); |
| | | redCode.put("scan_type", "1000"); |
| | | redCode.put("sutu_id", sutuid1 + ""); |
| | | redCode.put("space_id", si.getId() + ""); |
| | | String blueS = "{\"scan_type\": 1000, \"space_id\": " + si.getId() + ", \"sutu_id\": " + sutuid + "}"; |
| | | String redS = "{\"scan_type\": 1000, \"space_id\": " + si.getId() + ", \"sutu_id\": " + sutuid1 + "}"; |
| | | MyQrCodeUtil.createCodeToFile(blueS); |
| | | MyQrCodeUtil.createCodeToFile(redS); |
| | | BufferedImage blueImage = QRCodeUtil.createImage(blueS); |
| | | BufferedImage redImage = QRCodeUtil.createImage(redS); |
| | | MultipartFile blueFile = convert(blueImage, new Date().getTime() + UUIDUtil.getRandomCode(3) + ".PNG"); |
| | | MultipartFile redFile = convert(redImage, new Date().getTime() + UUIDUtil.getRandomCode(3) + ".PNG"); |
| | | String s = OssUploadUtil.ossUpload("img/", blueFile); |
| | | String s1 = OssUploadUtil.ossUpload("img/", redFile); |
| | | game.setBlueCode(s); |
| | | game.setRedCode(s1); |
| | | } |
| | | |
| | | } |
| | | |
| | | 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); |
| | | //社区冠军赛 |
| | | |
| | | TGameConfig gameConfigshequ = new TGameConfig(); |
| | | gameConfigshequ.setId(shequIId); |
| | | gameConfigshequ.setGameId(shequId); |
| | |
| | | gameConfigly.setIntegral(lyInt); |
| | | gameConfigly.setOtherId(gameId); |
| | | gameConfigList.add(gameConfigly); |
| | | |
| | | //激战3V3 |
| | | TGameConfig gameConfigv3 = new TGameConfig(); |
| | | gameConfigv3.setGameId(v3Id); |
| | | gameConfigv3.setId(v3IId); |
| | | gameConfigv3.setCash(v3Cash); |
| | | gameConfigv3.setImg(v3Image); |
| | | gameConfigv3.setName(v3); |
| | | gameConfigv3.setPlayCoin(v3Coin); |
| | | gameConfigv3.setIntegral(v3Int); |
| | | gameConfigv3.setOtherId(gameId); |
| | | gameConfigList.add(gameConfigv3); |
| | | HashMap<String, String> map1 = new HashMap<>(); |
| | | HashMap<String, String> map2 = new HashMap<>(); |
| | | |
| | | |
| | | // map1.put("sign", "0DB011836143EEE2C2E072967C9F4E4B"); |
| | | // map1.put("space_id", si.getId() + ""); |
| | | // map1.put("device_id", red); |
| | | // map1.put("region_id", st.getId() + ""); |
| | | // // 添加门禁 |
| | | // String s1 = HttpRequestUtil.postRequest("https://port.daowepark.com/v7/user_api/general/addDevice", map1); |
| | | // map2.put("sign", "0DB011836143EEE2C2E072967C9F4E4B"); |
| | | // map2.put("space_id", si.getId() + ""); |
| | | // map2.put("device_id", blue); |
| | | // map2.put("region_id", st.getId() + ""); |
| | | // // 添加门禁 |
| | | // String s2 = HttpRequestUtil.postRequest("https://port.daowepark.com/v7/user_api/general/addDevice", map2); |
| | | |
| | | |
| | | |
| | | System.out.println("---------------------------"+gameConfigList); |
| | | ballClient.saveConfig( gameConfigList); |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | @RequestMapping("/pre_add") |
| | | public String add(Model model) { |
| | | |
| | |
| | | private TGameConfigService gameConfigService; |
| | | @RequestMapping("/pre_edit/{id}") |
| | | public String pre_edit(@PathVariable("id") Integer id,Model model) { |
| | | |
| | | Game game = ballClient.queryGame(id); |
| | | System.out.println("---------game------"+game); |
| | | System.out.println("---------game------"+game); |
| | | model.addAttribute("game",game); |
| | | |
| | | if (game.getOperationId() ==0){ |
| | | model.addAttribute("opId","平台"); |
| | | model.addAttribute("is","平台"); |
| | |
| | | |
| | | TGameConfig ly = gameConfigService.getOne(new QueryWrapper<TGameConfig>().eq("otherId", id).eq("gameId", 5)); |
| | | model.addAttribute("ly",ly); |
| | | |
| | | TGameConfig v3 = gameConfigService.getOne(new QueryWrapper<TGameConfig>().eq("otherId", id).eq("gameId", 0)); |
| | | model.addAttribute("v3",v3); |
| | | |
| | | |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | |
| | | |
| | | TGameConfig ly = gameConfigService.getOne(new QueryWrapper<TGameConfig>().eq("otherId", id).eq("gameId", 5)); |
| | | model.addAttribute("ly",ly); |
| | | |
| | | |
| | | TGameConfig v3 = gameConfigService.getOne(new QueryWrapper<TGameConfig>().eq("otherId", id).eq("gameId", 0)); |
| | | model.addAttribute("v3",v3); |
| | | |
| | | |
| | | return PREFIX+"ball_pre_info.html"; |
| | |
| | | |
| | | @Autowired |
| | | private IUserService userService; |
| | | |
| | | @RequestMapping("/yueyue_info/{id}") |
| | | public String yueyue_info(@PathVariable("id") Integer id,Model model) { |
| | | |
| | |
| | | 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); |
| | | |
| | | //时间段 |
| | |
| | | |
| | | List<OrderDto> timeRanges = new ArrayList<>(); |
| | | |
| | | |
| | | Site site = siteClient.listById(book.getSiteId()); |
| | | TSite site = siteService.getById(book.getSiteId()); |
| | | System.out.println("================"+site); |
| | | String appointmentStartTime = site.getAppointmentStartTime(); |
| | | String appointmentEndTime = site.getAppointmentEndTime(); |
| | |
| | | } |
| | | 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]); |
| | |
| | | List<TCoursePackage> coursePackageByStoreId = coursePackageClient.getCoursePackageByStoreId(storeId); |
| | | tCoursePackages.addAll(coursePackageByStoreId); |
| | | } |
| | | |
| | | List<Integer> coursePackageByStoreIds = tCoursePackages.stream().distinct().map(TCoursePackage::getId).collect(Collectors.toList()); |
| | | if (tCoursePackages.isEmpty()){ |
| | | coursePackageByStoreIds.add(-1); |
| | | } |
| | | studentQeryDto.setCoursePackageIds(coursePackageByStoreIds); |
| | | |
| | | } |
| | | // 如果当前登陆人是门店 只查询该门店下的课包的数据 |
| | | if(UserExt.getUser().getObjectType() == 3){ |
| | | // 先查询这个运营商下的所有门店ids |
| | | |
| | | List<Integer> storeIds = new ArrayList<>(); |
| | | storeIds.add(UserExt.getUser().getObjectId()); |
| | | // 根据门店ids 查询所有课包ids |
| | | List<TCoursePackage> tCoursePackages = new ArrayList<>(); |
| | | for (Integer storeId : storeIds) { |
| | | List<TCoursePackage> coursePackageByStoreId = coursePackageClient.getCoursePackageByStoreId(storeId); |
| | | tCoursePackages.addAll(coursePackageByStoreId); |
| | | } |
| | | List<Integer> coursePackageByStoreIds = tCoursePackages.stream().distinct().map(TCoursePackage::getId).collect(Collectors.toList()); |
| | | if (tCoursePackages.isEmpty()){ |
| | | coursePackageByStoreIds.add(-1); |
| | | } |
| | | 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) { |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | Integer objectId = UserExt.getUser().getObjectId(); |
| | | |
| | | String cityCode = null; |
| | | if(objectType == 2){//城市管理员 |
| | | // 获取到这个运营商下面的所有门店 |
| | |
| | | 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(); |
| | |
| | | tAppUser.setInsertTime(new Date()); |
| | | tAppUser.setPassword(MD5.md5("111111")); |
| | | appUserClient.addAppUser1(tAppUser); |
| | | siteBooking.setAppUserId(tAppUser.getId()); |
| | | TAppUser appUserByPhone1 = appUserClient.getAppUserByPhone(phone); |
| | | siteBooking.setAppUserId(appUserByPhone1.getId()); |
| | | }else{ |
| | | siteBooking.setAppUserId(appUserByPhone.getId()); |
| | | } |