| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.other.entity.*; |
| | | import com.dsh.other.feignclient.CourseRecordClient; |
| | | import com.dsh.other.feignclient.account.CityManagerClient; |
| | | import com.dsh.other.feignclient.activity.UserCouponClient; |
| | | import com.dsh.other.feignclient.activity.model.QueryUserCouponByIdAndUserId; |
| | |
| | | import com.dsh.other.feignclient.model.BillingDataRequestVo; |
| | | import com.dsh.other.feignclient.model.SiteChangeStateVO; |
| | | import com.dsh.other.feignclient.model.SiteVo; |
| | | import com.dsh.other.mapper.TOperatorUserMapper; |
| | | import com.dsh.other.model.*; |
| | | import com.dsh.other.model.dto.siteDto.TSiteDTO; |
| | | import com.dsh.other.model.vo.siteVo.ExpireSiteSearchVO; |
| | |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | |
| | | @Resource |
| | | private UserCouponClient userCouponClient; |
| | | @Autowired |
| | | private CityManagerClient cityManagerClient; |
| | | |
| | | @Resource |
| | | private CityManagerClient cityManagerClient; |
| | | @Autowired |
| | | private IOperatorUserService operatorUserService; |
| | | |
| | | @Autowired |
| | | private TGameConfigService gameConfigService; |
| | | |
| | | @Autowired |
| | | private TGameRecordService gameRecordService; |
| | | |
| | | @Resource |
| | | private CourseRecordClient courseRecordClient; |
| | | |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 通过运营商id查询运营商对应的支付宝商户号 |
| | | */ |
| | | @RequestMapping("/base/getSMIDByOperatorId") |
| | | @ResponseBody |
| | | public String getSMIDByOperatorId(Integer id) { |
| | | return siteService.getSMIDByOperatorId(id); |
| | | } |
| | | /** |
| | | * 通过运营商id查询运营商对应的微信商户号 |
| | | */ |
| | | @RequestMapping("/base/getmerchantNumberByOperatorId") |
| | | @ResponseBody |
| | | public String getmerchantNumberByOperatorId(Integer id) { |
| | | return siteService.getmerchantNumberByOperatorId(id); |
| | | } |
| | | /** |
| | | * 根据运营商id获取对应运营商分账比例 返回格式: 微信分账比例,支付宝分账比例 |
| | | */ |
| | | @RequestMapping("/base/getProportionByOperatorId") |
| | | @ResponseBody |
| | | public String getProportionByOperatorId(Integer id) { |
| | | OperatorUser operatorId = operatorUserService.getOne( |
| | | new QueryWrapper<OperatorUser>().eq("operatorId",id) |
| | | ); |
| | | if (operatorId.getWechatProportion() == null){ |
| | | operatorId.setWechatProportion("0"); |
| | | } |
| | | if (operatorId.getAlipayProportion() == null){ |
| | | operatorId.setAlipayProportion("0"); |
| | | } |
| | | return operatorId.getWechatProportion()+","+operatorId.getAlipayProportion(); |
| | | } |
| | | /** |
| | | * 获取所有场地 |
| | | */ |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加场地管理 |
| | | * |
| | | * @return |
| | | */ |
| | | @RequestMapping("/base/site/addSite1") |
| | | public Integer addSite1(@RequestBody Site site) { |
| | | boolean save = siteService.save(site); |
| | | return site.getId(); |
| | | } |
| | | /** |
| | | * 添加场地管理 |
| | | * |
| | |
| | | } |
| | | |
| | | @RequestMapping("/base/site/listById") |
| | | public Site listById(@RequestParam("id") Integer id) { |
| | | public Site listById(@RequestBody Integer id) { |
| | | Site byId = siteService.getById(id); |
| | | return byId; |
| | | } |
| | | |
| | | |
| | | @RequestMapping("/base/site/listBooks") |
| | | public List<SiteBooking> listBooks(@RequestParam("id") Integer id) { |
| | | public List<SiteBooking> listBooks(@RequestBody Integer id) { |
| | | List<SiteBooking> siteId = siteBookingService.list(new QueryWrapper<SiteBooking>().eq("siteId", id)); |
| | | return siteId; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/site/querySiteTimes") |
| | | @ApiOperation(value = "获取场地详情时间段数据", tags = {"用户—预约场地"}) |
| | |
| | | } |
| | | } |
| | | |
| | | // public ResultUtil<List<QuerySiteTimes>> querySiteTimes(Integer id, String day, String halfName, String siteName) throws Exception { |
| | | // |
| | | // if (redisUtil.acquireLock(day,day)) { |
| | | // try { |
| | | // List<QuerySiteTimes> list = siteService.querySiteTimes(id, day,halfName,siteName); |
| | | // return ResultUtil.success(list); |
| | | // } finally { |
| | | // redisUtil.releaseLock(day); |
| | | // } |
| | | // } else { |
| | | // return ResultUtil.error("系统繁忙,请稍后再试!"); |
| | | // } |
| | | // |
| | | // } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | |
| | | // public ResultUtil<List<QuerySiteTimes>> querySiteTimes(Integer id, String day, String halfName, String siteName) throws Exception { |
| | | // |
| | | // if (redisUtil.acquireLock(day,day)) { |
| | | // try { |
| | | // List<QuerySiteTimes> list = siteService.querySiteTimes(id, day,halfName,siteName); |
| | | // return ResultUtil.success(list); |
| | | // } finally { |
| | | // redisUtil.releaseLock(day); |
| | | // } |
| | | // } else { |
| | | // return ResultUtil.error("系统繁忙,请稍后再试!"); |
| | | // } |
| | | // |
| | | // } |
| | | |
| | | |
| | | /** |
| | |
| | | siteBooking.setStatus(1); |
| | | siteBooking.setPayOrderNo(transaction_id); |
| | | siteBookingService.updateById(siteBooking); |
| | | |
| | | PrintWriter out = response.getWriter(); |
| | | out.write(result); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | PrintWriter out = response.getWriter(); |
| | | out.write(result); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 预约场地支付宝回调 |
| | |
| | | @PostMapping("/base/site/aliPaymentSiteCallback") |
| | | public void aliPaymentSiteCallback(HttpServletRequest request, HttpServletResponse response) { |
| | | try { |
| | | System.out.println("回调回调回调"); |
| | | Map<String, String> map = payMoneyUtil.alipayCallback(request); |
| | | if (null != map) { |
| | | String code = map.get("out_trade_no"); |
| | | String trade_no = map.get("trade_no"); |
| | | SiteBooking siteBooking = siteBookingService.getOne(new QueryWrapper<SiteBooking>().eq("orderNo", code).eq("state", 1)); |
| | | SiteBooking siteBooking = siteBookingService.getOne(new QueryWrapper<SiteBooking>() |
| | | .eq("orderNo", code).eq("state", 1)); |
| | | if (siteBooking.getStatus() == 0) { |
| | | siteBooking.setPayTime(new Date()); |
| | | siteBooking.setStatus(1); |
| | | siteBooking.setPayOrderNo(trade_no); |
| | | siteBookingService.updateById(siteBooking); |
| | | PrintWriter out = response.getWriter(); |
| | | out.write("success"); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | PrintWriter out = response.getWriter(); |
| | | out.write("success"); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | @PostMapping("/base/site/gameCallback") |
| | | public void gameCallback(HttpServletRequest request, HttpServletResponse response) { |
| | | try { |
| | | System.out.println("回调回调回调"); |
| | | Map<String, String> map = payMoneyUtil.alipayCallback(request); |
| | | if (null != map) { |
| | | |
| | | String code = map.get("passback_params"); |
| | | // String trade_no = map.get("trade_no"); |
| | | // SiteBooking siteBooking = siteBookingService.getOne(new QueryWrapper<SiteBooking>().eq("orderNo", code).eq("state", 1)); |
| | | // if(siteBooking.getStatus() == 0){ |
| | | // siteBooking.setPayTime(new Date()); |
| | | // siteBooking.setStatus(1); |
| | | // siteBooking.setPayOrderNo(trade_no); |
| | | // siteBookingService.updateById(siteBooking); |
| | | // } |
| | | |
| | | String trade_no = map.get("trade_no"); |
| | | String[] s = code.split("_"); |
| | | Integer i = startGame(Integer.valueOf(s[0]), Integer.valueOf(s[1]), Integer.valueOf(s[2]), Integer.valueOf(s[3])); |
| | | System.err.println("===========游戏回调游戏回调=========" + i); |
| | | List<TGameRecord> list = gameRecordService.list(new QueryWrapper<TGameRecord>().eq("number", s[4]).eq("payType", 2)); |
| | | TGameRecord one = list.get(0); |
| | | TGameConfig config = gameConfigService.getById(s[5]); |
| | | for (TGameRecord coursePackagePayment : list) { |
| | | coursePackagePayment.setStatus(1); |
| | | coursePackagePayment.setMoney(config.getCash()); |
| | | coursePackagePayment.setOrderNo(trade_no); |
| | | |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | courseCounsum.setChangeType(3); |
| | | courseCounsum.setInsertTime(new Date()); |
| | | courseCounsum.setReason("智慧球场;" + config.getCash()); |
| | | courseCounsum.setAppUserId(Integer.valueOf(s[0])); |
| | | courseRecordClient.save(courseCounsum); |
| | | } |
| | | gameRecordService.updateBatchById(list); |
| | | |
| | | PrintWriter out = response.getWriter(); |
| | | out.write("success"); |
| | | out.flush(); |
| | |
| | | map.put("space_id", spaceId + ""); |
| | | map.put("sutu_id", sutuId + ""); |
| | | |
| | | String s = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/gameStart", map); |
| | | String s = HttpRequestUtil.postRequest("https://port.daowepark.com/v7/user_api/general/gameStart", map); |
| | | JSONObject jsonObject = JSONObject.parseObject(s); |
| | | Object code = jsonObject.get("code"); |
| | | if (String.valueOf(code) != null && "200".equals(String.valueOf(code))) { |
| | | System.err.println("启动了一次游戏"); |
| | | return 200; |
| | | } else { |
| | | return 500; |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/site/queryMySiteById") |
| | | @ApiOperation(value = "获取我的预约场地列表详情2.0", tags = {"用户—预约场地"}) |
| | | @ApiOperation(value = "获取我的预约场地列表详情", tags = {"用户—预约场地"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "id", name = "id", dataType = "int", required = true), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | |
| | | public ResultUtil<Map<String, Object>> queryMySiteById(Integer id) { |
| | | try { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | SiteBooking byId = siteBookingService.getById(id); |
| | | Integer storeId = byId.getStoreId(); |
| | | SiteBooking siteBooking = siteBookingService.getById(id); |
| | | Integer storeId = siteBooking.getStoreId(); |
| | | Store byId1 = service.getById(storeId); |
| | | Site site = siteService.getById(byId.getSiteId()); |
| | | Site site = siteService.getById(siteBooking.getSiteId()); |
| | | map.put("siteName", byId1.getName()); |
| | | SiteType siteType = siteTypeService.getById(site.getSiteTypeId()); |
| | | map.put("siteType", siteType.getName()); |
| | |
| | | map.put("name", site.getName()); |
| | | |
| | | |
| | | List<Integer> ids = getIds(byId.getSiteId()); |
| | | byId.setStorePhone(byId1.getPhone()); |
| | | List<Integer> ids = getIds(siteBooking.getSiteId()); |
| | | siteBooking.setStorePhone(byId1.getPhone()); |
| | | |
| | | //拼接开始结束时间 |
| | | Date startTime = byId.getStartTime(); |
| | | Date endTime = byId.getEndTime(); |
| | | Date startTime = siteBooking.getStartTime(); |
| | | Date endTime = siteBooking.getEndTime(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | |
| | | String startTimeString = sdf.format(startTime); |
| | | String endTimeString = sdf.format(endTime); |
| | | |
| | | String result = startTimeString + "-" + endTimeString.substring(11); |
| | | byId.setTimes(result); |
| | | siteBooking.setTimes(result); |
| | | |
| | | |
| | | byId.setSid(Arrays.asList(storeId)); |
| | | List<Site> list = siteService.list(new LambdaQueryWrapper<Site>().eq(Site::getStoreId, storeId).eq(Site::getSign, 1)); |
| | | List<Integer> collect = list.stream().map(Site::getId).collect(Collectors.toList()); |
| | | byId.setRid(collect); |
| | | map.put("data", byId); |
| | | |
| | | |
| | | siteBooking.setSid(Arrays.asList(storeId)); |
| | | Integer siteId = siteBooking.getSiteId(); |
| | | ArrayList<Integer> list1 = new ArrayList<>(); |
| | | list1.add(siteId); |
| | | siteBooking.setRid(list1); |
| | | SiteBookingVo siteBookingVo = new SiteBookingVo(); |
| | | BeanUtils.copyProperties(siteBooking, siteBookingVo); |
| | | siteBookingVo.setStartTime(siteBooking.getStartTime().getTime()); |
| | | siteBookingVo.setEndTime(siteBooking.getEndTime().getTime()); |
| | | siteBookingVo.setPayTime(siteBooking.getPayTime().getTime()); |
| | | map.put("data", siteBookingVo); |
| | | map.put("ids", ids); |
| | | return ResultUtil.success(map); |
| | | } catch (Exception e) { |
| | |
| | | } |
| | | |
| | | public List<Integer> getIds(Integer siteId) { |
| | | HttpRequest httpRequest = HttpRequest.get("https://try.daowepark.com/v7/user_api/general/get_space_area?space_id=" + siteId); |
| | | HttpRequest httpRequest = HttpRequest.get("https://port.daowepark.com/v7/user_api/general/get_space_area?space_id=" + siteId); |
| | | HttpResponse execute = httpRequest.execute(); |
| | | String body = execute.body(); |
| | | JSONObject jsonObject = JSONObject.parseObject(body); |
| | |
| | | if (null == uid) { |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | |
| | | |
| | | return siteService.cancelMySite(uid, id); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | @Autowired |
| | | private StoreService service; |
| | | |
| | | @Autowired |
| | | private IOperatorUserService operatorUserService; |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/site/game") |
| | | public List<Map<String, Object>> game(@RequestBody Integer appUserId) { |
| | |
| | | |
| | | } |
| | | |
| | | @Autowired |
| | | private IUserService userService; |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/site/queryUserName") |
| | | public User queryUserName(@RequestBody Integer coachId){ |
| | | User byId = userService.getById(coachId); |
| | | |
| | | return byId; |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/site/queryOperator") |
| | | public OperatorUser queryOperator(@RequestBody List<Integer> stores) { |