| | |
| | | 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.dto.JsDto; |
| | | import com.dsh.course.dto.StudentQeryDto; |
| | | 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.CoursePackageDiscountClient; |
| | | import com.dsh.course.feignClient.course.CoursePackagePaymentConfigClient; |
| | | import com.dsh.course.feignClient.course.CoursePackageTypeClient; |
| | | import com.dsh.course.feignClient.course.model.TCoursePackageType; |
| | | import com.dsh.course.feignClient.course.model.TCoursePackage; |
| | | 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.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.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.DateComparisonExample; |
| | | 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 org.apache.commons.lang.StringEscapeUtils; |
| | | import org.apache.logging.log4j.util.Base64Util; |
| | | import com.dsh.course.entity.SiteLock; |
| | | import org.json.JSONObject; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpRequest; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.util.Base64Utils; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.BufferedReader; |
| | | import java.io.InputStreamReader; |
| | | import java.io.OutputStream; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.net.HttpURLConnection; |
| | | import java.net.URL; |
| | | 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.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Controller |
| | | @RequestMapping("/ball") |
| | |
| | | |
| | | @Resource |
| | | private CoursePackageClient coursePackageClient; |
| | | @Autowired |
| | | private AppUserClient appUserClient; |
| | | |
| | | |
| | | @RequestMapping("/tolist") |
| | | public String tolist(Model model) { |
| | |
| | | model.addAttribute("role",roleid); |
| | | |
| | | 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("/confirm/{id}") |
| | | @ResponseBody |
| | | public ResultUtil confirm(@PathVariable("id") Integer id) { |
| | | |
| | | SiteBooking byId = iSiteBookingService.getById(id); |
| | | String money = byId.getMoney(); |
| | | // todo 这里手动支付 默认按照现金当作支付金额 后续可能要问下产品 |
| | | 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); |
| | | siteBooking.setPayUserId(UserExt.getUser().getId()); |
| | | iSiteBookingService.updateById(siteBooking); |
| | | |
| | | return new ResultUtil<>(0,0,"手动支付成功",null,null); |
| | | } |
| | | |
| | | |
| | |
| | | @ResponseBody |
| | | public List<Game> changelist(BallQueryDto ballQueryDto) { |
| | | System.out.println("=======ballQueryDto=========="+ballQueryDto); |
| | | |
| | | User user = UserExt.getUser(); |
| | | ballQueryDto.setType(user.getObjectType()); |
| | | ballQueryDto.setId(user.getObjectId()); |
| | | return ballClient.list(ballQueryDto); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/editCoursePackageState") |
| | | public ResultUtil editCoursePackageState(Integer id, Integer state){ |
| | | Game game = new Game(); |
| | | game.setId(id); |
| | | game.setState(state); |
| | | ballClient.save(game); |
| | | |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | @RequestMapping("/save") |
| | | @ResponseBody |
| | | public ResultUtil save(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 |
| | | , String sudu, BigDecimal suduCoin, BigDecimal suduCash,String suduImage,BigDecimal suduInt,Integer suduId |
| | | , String fangkuai, BigDecimal fangkuaiCoin, BigDecimal fangkuaiCash,String fangkuaiImage,BigDecimal fangkuaiInt,Integer fangkuaiId |
| | | , String jx, BigDecimal jxCoin, BigDecimal jxCash,String jxImage,BigDecimal jxInt,Integer jxId |
| | | , String sq, BigDecimal sqCoin, BigDecimal sqCash,String sqImage,BigDecimal sqInt,Integer sqId |
| | | , String zs, BigDecimal zsCoin, BigDecimal zsCash,String zsImage,BigDecimal zsInt,Integer zsId |
| | | , String zs2, BigDecimal zs2Coin, BigDecimal zs2Cash,String zs2Image,BigDecimal zs2Int,Integer zs2Id |
| | | , String ly, BigDecimal lyCoin, BigDecimal lyCash,String lyImage,BigDecimal lyInt,Integer lyId |
| | | |
| | | |
| | | |
| | | |
| | | public ResultUtil save(Integer id, 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,Integer kcId |
| | | , String shequ, BigDecimal shequCoin, BigDecimal shequCash, String shequImage, BigDecimal shequInt, Integer shequId,Integer shequIId |
| | | , String shemen, BigDecimal shemenCoin, BigDecimal shemenCash, String shemenImage, BigDecimal shemenInt, Integer shemenId,Integer smId |
| | | , String sudu, BigDecimal suduCoin, BigDecimal suduCash, String suduImage, BigDecimal suduInt, Integer suduId,Integer sdId |
| | | , String fangkuai, BigDecimal fangkuaiCoin, BigDecimal fangkuaiCash, String fangkuaiImage, BigDecimal fangkuaiInt, Integer fangkuaiId,Integer fkId |
| | | , String jx, BigDecimal jxCoin, BigDecimal jxCash, String jxImage, BigDecimal jxInt, Integer jxId,Integer jxIId |
| | | , String sq, BigDecimal sqCoin, BigDecimal sqCash, String sqImage, BigDecimal sqInt, Integer sqId,Integer qwId |
| | | , 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 sutuName |
| | | |
| | | ) { |
| | | |
| | | Game game = new Game(); |
| | | game.setRed(red); |
| | | game.setState(0); |
| | | game.setBlue(blue); |
| | | |
| | | |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | |
| | | if (objectType ==3){ |
| | | |
| | | |
| | | TStore byId = storeService.getById(UserExt.getUser().getObjectId()); |
| | | System.out.println("=====byId======="+byId); |
| | | game.setProvinceCode(byId.getProvinceCode()); |
| | | game.setCityCode(byId.getCityCode()); |
| | | |
| | | |
| | | }else { |
| | | game.setProvinceCode(province); |
| | | game.setCityCode(city); |
| | | |
| | | } |
| | | game.setSiteId(site); |
| | | game.setStoreId(store); |
| | | game.setId(id); |
| | | |
| | | |
| | | if (!operationId.equals("平台")){ |
| | | game.setOperationId(Integer.valueOf(operationId));} |
| | | else { |
| | | game.setOperationId(0); |
| | | } |
| | | System.out.println("============"+game); |
| | | |
| | | // 添加sutu编号 |
| | | HashMap<String, String> map3 = new HashMap<>(); |
| | | // 添加sutu编号 |
| | | // 添加门禁 红蓝方 |
| | | TSite si = siteService.getById(site); |
| | | TStore st = storeService.getById(store); |
| | | // 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.setCash(kuachengCash); |
| | | gameConfigkuacheng.setImg(kuachengImage); |
| | |
| | | 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); |
| | | gameConfigshequ.setCash(shequCash); |
| | | gameConfigshequ.setImg(shequImage); |
| | | gameConfigshequ.setName(shequ); |
| | | gameConfigshequ.setPlayCoin(shequCoin); |
| | | gameConfigshequ.setIntegral(shequInt); |
| | | gameConfigshequ.setOtherId(shequId); |
| | | gameConfigshequ.setOtherId(gameId); |
| | | gameConfigList.add(gameConfigshequ); |
| | | |
| | | //射门速度-玩湃熊之力 |
| | | TGameConfig gameConfigshemen = new TGameConfig(); |
| | | gameConfigshemen.setGameId(shemenId); |
| | | gameConfigshemen.setId(smId); |
| | | gameConfigshemen.setCash(shemenCash); |
| | | gameConfigshemen.setImg(shemenImage); |
| | | gameConfigshemen.setName(shemen); |
| | | gameConfigshemen.setPlayCoin(shemenCoin); |
| | | gameConfigshemen.setIntegral(shemenInt); |
| | | gameConfigshemen.setOtherId(shemenId); |
| | | gameConfigshemen.setOtherId(gameId); |
| | | gameConfigList.add(gameConfigshemen); |
| | | |
| | | |
| | | //玩湃熊之力-速度 |
| | | TGameConfig gameConfigsudu = new TGameConfig(); |
| | | gameConfigsudu.setGameId(suduId); |
| | | gameConfigsudu.setGameId(suduId);gameConfigsudu.setId(sdId); |
| | | gameConfigsudu.setCash(suduCash); |
| | | gameConfigsudu.setImg(suduImage); |
| | | gameConfigsudu.setName(sudu); |
| | | gameConfigsudu.setPlayCoin(suduCoin); |
| | | gameConfigsudu.setIntegral(suduInt); |
| | | gameConfigsudu.setOtherId(suduId); |
| | | gameConfigsudu.setOtherId(gameId); |
| | | gameConfigList.add(gameConfigsudu); |
| | | |
| | | |
| | | //方块球王 |
| | | TGameConfig gameConfigfangkuai = new TGameConfig(); |
| | | gameConfigfangkuai.setGameId(fangkuaiId); |
| | | gameConfigfangkuai.setId(fkId); |
| | | gameConfigfangkuai.setCash(fangkuaiCash); |
| | | gameConfigfangkuai.setImg(fangkuaiImage); |
| | | gameConfigfangkuai.setName(fangkuai); |
| | | gameConfigfangkuai.setPlayCoin(fangkuaiCoin); |
| | | gameConfigfangkuai.setIntegral(fangkuaiInt); |
| | | gameConfigfangkuai.setOtherId(fangkuaiId); |
| | | gameConfigfangkuai.setOtherId(gameId); |
| | | gameConfigList.add(gameConfigfangkuai); |
| | | |
| | | |
| | | //镜像阵容 |
| | | TGameConfig gameConfigjx = new TGameConfig(); |
| | | gameConfigjx.setGameId(jxId); |
| | | gameConfigjx.setId(jxIId); |
| | | gameConfigjx.setCash(jxCash); |
| | | gameConfigjx.setImg(jxImage); |
| | | gameConfigjx.setName(jx); |
| | | gameConfigjx.setPlayCoin(jxCoin); |
| | | gameConfigjx.setIntegral(jxInt); |
| | | gameConfigjx.setOtherId(jxId); |
| | | gameConfigjx.setOtherId(gameId); |
| | | gameConfigList.add(gameConfigjx); |
| | | |
| | | |
| | | //社区小球王 |
| | | TGameConfig gameConfigsq = new TGameConfig(); |
| | | gameConfigsq.setGameId(sqId); |
| | | gameConfigsq.setId(qwId); |
| | | gameConfigsq.setCash(sqCash); |
| | | gameConfigsq.setImg(sqImage); |
| | | gameConfigsq.setName(sq); |
| | | gameConfigsq.setPlayCoin(sqCoin); |
| | | gameConfigsq.setIntegral(sqInt); |
| | | gameConfigsq.setOtherId(sqId); |
| | | gameConfigsq.setOtherId(gameId); |
| | | gameConfigList.add(gameConfigsq); |
| | | |
| | | |
| | |
| | | //涨姿势 |
| | | TGameConfig gameConfigzs = new TGameConfig(); |
| | | gameConfigzs.setGameId(zsId); |
| | | gameConfigzs.setId(zsIId); |
| | | gameConfigzs.setCash(zsCash); |
| | | gameConfigzs.setImg(zsImage); |
| | | gameConfigzs.setName(zs); |
| | | gameConfigzs.setPlayCoin(zsCoin); |
| | | gameConfigzs.setIntegral(zsInt); |
| | | gameConfigzs.setOtherId(zsId); |
| | | gameConfigzs.setOtherId(gameId); |
| | | gameConfigList.add(gameConfigzs); |
| | | |
| | | //涨姿势2 |
| | | TGameConfig gameConfigzs2 = new TGameConfig(); |
| | | gameConfigzs2.setGameId(zs2Id); |
| | | gameConfigzs2.setGameId(zs2Id);gameConfigzs2.setId(zs2IId); |
| | | gameConfigzs2.setCash(zs2Cash); |
| | | gameConfigzs2.setImg(zs2Image); |
| | | gameConfigzs2.setName(zs2); |
| | | gameConfigzs2.setPlayCoin(zs2Coin); |
| | | gameConfigzs2.setIntegral(zs2Int); |
| | | gameConfigzs2.setOtherId(zs2Id); |
| | | gameConfigzs2.setOtherId(gameId); |
| | | gameConfigList.add(gameConfigzs2); |
| | | |
| | | //绿茵密码 |
| | | TGameConfig gameConfigly = new TGameConfig(); |
| | | gameConfigly.setGameId(lyId); |
| | | gameConfigly.setId(lyIId); |
| | | gameConfigly.setCash(lyCash); |
| | | gameConfigly.setImg(lyImage); |
| | | gameConfigly.setName(ly); |
| | | gameConfigly.setPlayCoin(lyCoin); |
| | | gameConfigly.setIntegral(lyInt); |
| | | gameConfigly.setOtherId(lyId); |
| | | gameConfigly.setOtherId(gameId); |
| | | gameConfigList.add(gameConfigly); |
| | | 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://try.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://try.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) { |
| | | |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | |
| | | if (objectType ==3){ |
| | | |
| | | model.addAttribute("is3","true"); |
| | | model.addAttribute("storeId",UserExt.getUser().getObjectId()); |
| | | TStore byId = storeService.getById(UserExt.getUser().getObjectId()); |
| | | System.out.println("=====byId======="+byId); |
| | | model.addAttribute("cityCode",byId.getCityCode()); |
| | | model.addAttribute("provinceCode",byId.getProvinceCode()); |
| | | model.addAttribute("oId",byId.getOperatorId()); |
| | | return PREFIX+"ball_pre_add1.html"; |
| | | |
| | | } |
| | | |
| | | if (objectType == 2){ |
| | | model.addAttribute("is3","true"); |
| | | model.addAttribute("oId",UserExt.getUser().getObjectId()); |
| | | return PREFIX+"ball_pre_add2.html"; |
| | | } |
| | | |
| | | |
| | | |
| | | model.addAttribute("is","${is}"); |
| | | |
| | | |
| | | |
| | |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | 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","平台"); |
| | | }else { |
| | | model.addAttribute("opId",game.getOperationId()); |
| | | } |
| | | |
| | | TGameConfig kc = gameConfigService.getOne(new QueryWrapper<TGameConfig>().eq("otherId", id).eq("gameId", 14)); |
| | | model.addAttribute("kc",kc); |
| | | |
| | | |
| | | TGameConfig sq = gameConfigService.getOne(new QueryWrapper<TGameConfig>().eq("otherId", id).eq("gameId", 16)); |
| | | model.addAttribute("sq",sq); |
| | | |
| | | |
| | | TGameConfig sm = gameConfigService.getOne(new QueryWrapper<TGameConfig>().eq("otherId", id).eq("gameId", 13)); |
| | | model.addAttribute("sm",sm); |
| | | |
| | | TGameConfig sd = gameConfigService.getOne(new QueryWrapper<TGameConfig>().eq("otherId", id).eq("gameId", 15)); |
| | | model.addAttribute("sd",sd); |
| | | |
| | | TGameConfig fk = gameConfigService.getOne(new QueryWrapper<TGameConfig>().eq("otherId", id).eq("gameId", 1)); |
| | | model.addAttribute("fk",fk); |
| | | |
| | | TGameConfig jx = gameConfigService.getOne(new QueryWrapper<TGameConfig>().eq("otherId", id).eq("gameId", 7)); |
| | | model.addAttribute("jx",jx); |
| | | |
| | | TGameConfig qw = gameConfigService.getOne(new QueryWrapper<TGameConfig>().eq("otherId", id).eq("gameId", 8)); |
| | | model.addAttribute("qw",qw); |
| | | |
| | | TGameConfig zs = gameConfigService.getOne(new QueryWrapper<TGameConfig>().eq("otherId", id).eq("gameId", 10)); |
| | | model.addAttribute("zs",zs); |
| | | |
| | | TGameConfig zs2 = gameConfigService.getOne(new QueryWrapper<TGameConfig>().eq("otherId", id).eq("gameId", 11)); |
| | | model.addAttribute("zs2",zs2); |
| | | |
| | | TGameConfig ly = gameConfigService.getOne(new QueryWrapper<TGameConfig>().eq("otherId", id).eq("gameId", 5)); |
| | | model.addAttribute("ly",ly); |
| | | |
| | | |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | |
| | | if (objectType ==3){ |
| | | model.addAttribute("is3","true"); |
| | | model.addAttribute("storeId",UserExt.getUser().getObjectId()); |
| | | TStore byId = storeService.getById(UserExt.getUser().getObjectId()); |
| | | model.addAttribute("cityCode",byId.getCityCode()); |
| | | model.addAttribute("provinceCode",byId.getProvinceCode()); |
| | | model.addAttribute("oId",byId.getOperatorId()); |
| | | return PREFIX+"ball_pre_edit1.html"; |
| | | |
| | | } |
| | | if (objectType == 2){ |
| | | return PREFIX+"ball_pre_edit2.html"; |
| | | |
| | | } |
| | | |
| | | return PREFIX+"ball_pre_edit.html"; |
| | | } |
| | | |
| | | |
| | | @RequestMapping("/pre_info/{id}") |
| | | public String pre_info(@PathVariable("id") Integer id,Model model) { |
| | | |
| | | Game game = ballClient.queryGame(id); |
| | | System.out.println("---------game------"+game); |
| | | model.addAttribute("game",game); |
| | | |
| | | |
| | | if (game.getOperationId() ==0){ |
| | | model.addAttribute("opId","平台"); |
| | | model.addAttribute("is","平台"); |
| | | }else { |
| | | model.addAttribute("opId",game.getOperationId()); |
| | | } |
| | | |
| | | TGameConfig kc = gameConfigService.getOne(new QueryWrapper<TGameConfig>().eq("otherId", id).eq("gameId", 14)); |
| | | model.addAttribute("kc",kc); |
| | | |
| | | |
| | | TGameConfig sq = gameConfigService.getOne(new QueryWrapper<TGameConfig>().eq("otherId", id).eq("gameId", 16)); |
| | | model.addAttribute("sq",sq); |
| | | |
| | | |
| | | TGameConfig sm = gameConfigService.getOne(new QueryWrapper<TGameConfig>().eq("otherId", id).eq("gameId", 13)); |
| | | model.addAttribute("sm",sm); |
| | | |
| | | TGameConfig sd = gameConfigService.getOne(new QueryWrapper<TGameConfig>().eq("otherId", id).eq("gameId", 15)); |
| | | model.addAttribute("sd",sd); |
| | | |
| | | TGameConfig fk = gameConfigService.getOne(new QueryWrapper<TGameConfig>().eq("otherId", id).eq("gameId", 1)); |
| | | model.addAttribute("fk",fk); |
| | | |
| | | TGameConfig jx = gameConfigService.getOne(new QueryWrapper<TGameConfig>().eq("otherId", id).eq("gameId", 7)); |
| | | model.addAttribute("jx",jx); |
| | | |
| | | TGameConfig qw = gameConfigService.getOne(new QueryWrapper<TGameConfig>().eq("otherId", id).eq("gameId", 8)); |
| | | model.addAttribute("qw",qw); |
| | | |
| | | TGameConfig zs = gameConfigService.getOne(new QueryWrapper<TGameConfig>().eq("otherId", id).eq("gameId", 10)); |
| | | model.addAttribute("zs",zs); |
| | | |
| | | TGameConfig zs2 = gameConfigService.getOne(new QueryWrapper<TGameConfig>().eq("otherId", id).eq("gameId", 11)); |
| | | model.addAttribute("zs2",zs2); |
| | | |
| | | TGameConfig ly = gameConfigService.getOne(new QueryWrapper<TGameConfig>().eq("otherId", id).eq("gameId", 5)); |
| | | model.addAttribute("ly",ly); |
| | | |
| | | |
| | | |
| | | return PREFIX+"ball_pre_info.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 = 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); |
| | | } |
| | | //日期是否超过 |
| | | 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; |
| | | |
| | | 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)); |
| | | 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()); |
| | | // 查询运营商下所有门店 所有场地 |
| | | 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("objectType", objectType); |
| | | |
| | | 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); |
| | | } |
| | | 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<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(); |
| | | 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("/paike") |
| | |
| | | @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.setEnd(split[1]); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | // 如果当前登陆人是运营商 只查询该运营商下的课包的数据 |
| | | if(UserExt.getUser().getObjectType() == 2){ |
| | | // 先查询这个运营商下的所有门店ids |
| | | List<Integer> storeIds = storeService.list(new QueryWrapper<TStore>().eq("operatorId", UserExt.getUser().getObjectId())) |
| | | .stream().map(TStore::getId).collect(Collectors.toList()); |
| | | // 根据门店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()); |
| | | 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){ |
| | | 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; |
| | | } |
| | | |
| | |
| | | @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); |
| | | for (Map<String, Object> vo : orders) { |
| | | |
| | | |
| | | if (vo.get("payType")!=null && Integer.parseInt(vo.get("payType").toString()) == 1){ |
| | | vo.put("payType","微信"); |
| | | }else if (vo.get("payType")!=null && Integer.parseInt(vo.get("payType").toString()) == 2){ |
| | | vo.put("payType","支付宝"); |
| | | }else if (vo.get("payType")!=null && Integer.parseInt(vo.get("payType").toString()) == 3){ |
| | | vo.put("payType","玩湃币"); |
| | | }else if (vo.get("payType")!=null && Integer.parseInt(vo.get("payType").toString()) == 4){ |
| | | if (vo.get("payUserId")!=null){ |
| | | User payUserId = userService.getById(Integer.parseInt(vo.get("payUserId").toString())); |
| | | if(payUserId!=null){ |
| | | vo.put("payType","手动支付"+"-"+payUserId.getName()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | |
| | | |
| | | @RequestMapping("/addjs") |
| | | @ResponseBody |
| | | public void addjs( @RequestBody JsDto jsDto) { |
| | | public ResultUtil addjs( @RequestBody JsDto jsDto) { |
| | | System.out.println("=======jsDto========"+jsDto); |
| | | storeService.insert(jsDto); |
| | | return new ResultUtil(0,0,"保存成功",null,null); |
| | | |
| | | } |
| | | |
| | |
| | | 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) { |
| | | 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); |
| | | 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); |
| | | } |
| | | List<SiteBooking> siteBookings = iSiteBookingService.list(new QueryWrapper<SiteBooking>().eq("siteId", id).ne("status", 5).eq("nextName", siteName).like("times", date)); |
| | | |
| | | 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 = getNextTime(currentTime); |
| | | String nextTime = null; |
| | | if ("智慧场地".equals(site.getTypeName())) { |
| | | nextTime = getNextTimeOne(currentTime); |
| | | } else { |
| | | 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 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}") |
| | |
| | | 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){//城市管理员 |
| | | 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"; |
| | | } |
| | | |
| | |
| | | siteBooking.setInsertTime(new Date()); |
| | | siteBooking.setState(1); |
| | | siteBooking.setStatus(0); |
| | | siteBooking.setAddType(1); |
| | | |
| | | //存开始和结束时间 |
| | | String times = siteBooking.getTimes(); |
| | | String[] dates = times.split(";"); |
| | | |
| | | siteClient.addSiteBooking(siteBooking); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | |
| | | Date minDate = null; |
| | | Date maxDate = null; |
| | | |
| | | for (String dateStr : dates) { |
| | | String[] dateRange = dateStr.split("-"); |
| | | String startDateStr = dateRange[0].trim(); |
| | | String endDateStr = dateRange[1].trim(); |
| | | |
| | | try { |
| | | Date startDate = format.parse(startDateStr); |
| | | Date endDate = format.parse(endDateStr); |
| | | |
| | | if (minDate == null || startDate.before(minDate)) { |
| | | minDate = startDate; |
| | | } |
| | | if (maxDate == null || endDate.after(maxDate)) { |
| | | maxDate = endDate; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | System.out.println("最小日期:" + minDate); |
| | | System.out.println("最大日期:" + maxDate); |
| | | siteBooking.setStartTime(minDate); |
| | | siteBooking.setEndTime(maxDate); |
| | | 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 appUserByPhone = appUserClient.getAppUserByPhone(phone); |
| | | TStore byId1 = storeService.getById(siteBooking.getStoreId()); |
| | | if (appUserByPhone== null){ |
| | | // 则当前预约人不是会员 添加到会员表里 |
| | | TAppUser tAppUser = new TAppUser(); |
| | | tAppUser.setName(booker); |
| | | tAppUser.setPhone(phone); |
| | | tAppUser.setProvince(byId1.getProvince()); |
| | | tAppUser.setProvinceCode(byId1.getProvinceCode()); |
| | | tAppUser.setCity(byId1.getCity()); |
| | | tAppUser.setCityCode(byId1.getCityCode()); |
| | | tAppUser.setIsVip(0); |
| | | tAppUser.setInsertType(UserExt.getUser().getObjectType()); |
| | | tAppUser.setAddUserId(UserExt.getUser().getObjectId()); |
| | | tAppUser.setInsertTime(new Date()); |
| | | tAppUser.setPassword(MD5.md5("111111")); |
| | | appUserClient.addAppUser1(tAppUser); |
| | | TAppUser appUserByPhone1 = appUserClient.getAppUserByPhone(phone); |
| | | siteBooking.setAppUserId(appUserByPhone1.getId()); |
| | | }else{ |
| | | siteBooking.setAppUserId(appUserByPhone.getId()); |
| | | } |
| | | // 如果是运营商添加的话 根据门店的省市来存储 |
| | | 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()); |
| | | } |
| | | if (UserExt.getUser().getObjectType() == 3){ |
| | | TStore byId = storeService.getById(UserExt.getUser().getObjectId()); |
| | | 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); |
| | | } |
| | | |
| | | @RequestMapping("/orderedit") |
| | | @ResponseBody |
| | | public ResultUtil orderedit(SiteBooking siteBooking){ |
| | | iSiteBookingService.updateById(siteBooking); |
| | | |
| | | System.out.println("================="+siteBooking); |
| | | |
| | | return new ResultUtil<>(null,200,null,null,null); |