| | |
| | | import cn.hutool.http.HttpResponse; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | 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 com.dsh.other.model.vo.siteVo.SiteSearchVO; |
| | | import com.dsh.other.service.*; |
| | | import com.dsh.other.util.PayMoneyUtil; |
| | | import com.dsh.other.util.ResultUtil; |
| | | import com.dsh.other.util.TokenUtil; |
| | | import com.dsh.other.util.*; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import redis.clients.jedis.Jedis; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.PrintWriter; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | private UserCouponClient userCouponClient; |
| | | @Autowired |
| | | private CityManagerClient cityManagerClient; |
| | | @Autowired |
| | | private IOperatorUserService operatorUserService; |
| | | |
| | | /** |
| | | * 通过运营商id查询运营商对应的支付宝商户号 |
| | | */ |
| | | @RequestMapping("/base/getSMIDByOperatorId") |
| | | @ResponseBody |
| | | public String getSMIDByOperatorId(Integer id) { |
| | | // 获取运营商的管理员 |
| | | return siteService.getSMIDByOperatorId(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(); |
| | | } |
| | | /** |
| | | * 获取所有场地 |
| | | */ |
| | | @RequestMapping("/base/site/getList") |
| | | @ResponseBody |
| | | public List<Site> getList(){ |
| | | return siteService.list(new QueryWrapper<Site>().ne("state",3)); |
| | | public List<Site> getList() { |
| | | return siteService.list(new QueryWrapper<Site>().ne("state", 3)); |
| | | } |
| | | |
| | | /** |
| | | * 获取场地预约记录 |
| | | */ |
| | | @RequestMapping("/base/site/listAll") |
| | | public List<SiteBooking> listAll(@RequestBody SiteBookingQuery query){ |
| | | public List<SiteBooking> listAll(@RequestBody SiteBookingQuery query) { |
| | | return siteBookingService.listAll(query); |
| | | } |
| | | |
| | | /** |
| | | * 获取所有场地 |
| | | * |
| | | * @return |
| | | */ |
| | | @RequestMapping("/base/site/list") |
| | | public List<TSiteDTO> listAll(@RequestBody SiteSearchVO vo){ |
| | | public List<TSiteDTO> listAll(@RequestBody SiteSearchVO vo) { |
| | | return siteTypeService.listAll(vo); |
| | | } |
| | | |
| | | /** |
| | | * 获取场地有效期在两个月内的场地列表 |
| | | * |
| | | * @return |
| | | */ |
| | | @RequestMapping("/base/site/listExipre") |
| | | public List<TSiteDTO> listExipre(@RequestBody ExpireSiteSearchVO vo){ |
| | | public List<TSiteDTO> listExipre(@RequestBody ExpireSiteSearchVO vo) { |
| | | |
| | | return siteTypeService.listExipre(vo); |
| | | |
| | |
| | | * 上/下架、删除常见问题 type=1为上架 2为下架 3为删除 |
| | | */ |
| | | @RequestMapping("/base/site/changeState") |
| | | public Object changeState(@RequestBody SiteChangeStateVO vo){ |
| | | public Object changeState(@RequestBody SiteChangeStateVO vo) { |
| | | |
| | | return siteService.changeState(vo); |
| | | } |
| | | |
| | | /** |
| | | * 添加场地管理 |
| | | * |
| | | * @return |
| | | */ |
| | | @RequestMapping("/base/site/addSite") |
| | | public Integer addSite(@RequestBody Site site){ |
| | | if(site.getId()!= null ){ |
| | | public Integer addSite(@RequestBody Site site) { |
| | | if (site.getId() != null) { |
| | | siteService.updateById(site); |
| | | return site.getId(); |
| | | }else { |
| | | } else { |
| | | boolean save = siteService.save(site); |
| | | return site.getId(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加场地管理 |
| | | * |
| | | * @return |
| | | */ |
| | | @RequestMapping("/base/site/addSite1") |
| | | public Integer addSite1(@RequestBody Site site) { |
| | | boolean save = siteService.save(site); |
| | | return site.getId(); |
| | | } |
| | | /** |
| | | * 添加场地管理 |
| | | * |
| | | * @return |
| | | */ |
| | | @RequestMapping("/base/site/addSiteBooking") |
| | | public Object addSiteBooking(@RequestBody SiteBooking siteBooking){ |
| | | if(siteBooking.getId()!= null ){ |
| | | public Object addSiteBooking(@RequestBody SiteBooking siteBooking) { |
| | | if (siteBooking.getId() != null) { |
| | | |
| | | return siteBookingService.updateById(siteBooking); |
| | | }else { |
| | | } else { |
| | | return siteBookingService.save(siteBooking); |
| | | } |
| | | } |
| | | |
| | | @RequestMapping("/base/site/listById") |
| | | public Site listById(@RequestParam("id") Integer id){ |
| | | public Site listById(@RequestParam("id") 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(@RequestParam("id") Integer id) { |
| | | List<SiteBooking> siteId = siteBookingService.list(new QueryWrapper<SiteBooking>().eq("siteId", id)); |
| | | return siteId; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/site/querySiteType") |
| | | @ApiOperation(value = "获取场地类型", tags = {"用户—预约场地"}) |
| | | @ApiImplicitParams({ |
| | | }) |
| | | public ResultUtil<List<BaseVo>> querySiteType(){ |
| | | public ResultUtil<List<BaseVo>> querySiteType() { |
| | | try { |
| | | List<BaseVo> list = siteTypeService.querySiteType(); |
| | | return ResultUtil.success(list); |
| | | }catch (Exception e){ |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | |
| | | @ApiOperation(value = "获取场地列表", tags = {"用户—预约场地"}) |
| | | @ApiImplicitParams({ |
| | | }) |
| | | public ResultUtil<List<QuerySiteListVo>> querySiteList(QuerySiteList querySiteList){ |
| | | public ResultUtil<List<QuerySiteListVo>> querySiteList(QuerySiteList querySiteList) { |
| | | try { |
| | | List<QuerySiteListVo> querySiteListVos = siteService.querySiteList(querySiteList); |
| | | return ResultUtil.success(querySiteListVos); |
| | | }catch (Exception e){ |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | |
| | | @ApiImplicitParam(value = "经度", name = "lon", dataType = "string", required = false), |
| | | @ApiImplicitParam(value = "纬度", name = "lat", dataType = "string", required = false), |
| | | }) |
| | | public ResultUtil<QuerySiteInfoVo> querySiteInfo(Integer id, String lon, String lat){ |
| | | public ResultUtil<QuerySiteInfoVo> querySiteInfo(Integer id, String lon, String lat) { |
| | | try { |
| | | QuerySiteInfoVo querySiteInfoVo = siteService.querySiteInfo(id, lon, lat); |
| | | return ResultUtil.success(querySiteInfoVo); |
| | | }catch (Exception e){ |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/site/querySiteTimes") |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "场地id", name = "id", dataType = "int", required = true), |
| | | @ApiImplicitParam(value = "日期(2023-01-01)", name = "day", dataType = "string", required = true), |
| | | @ApiImplicitParam(value = "选择场地的名称", name = "day", dataType = "string", required = true), |
| | | @ApiImplicitParam(value = "半场名称", name = "day", dataType = "string", required = false) |
| | | @ApiImplicitParam(value = "半场名称", name = "halfName", dataType = "string", required = false), |
| | | @ApiImplicitParam(value = "选择场地的名称", name = "siteName", dataType = "string", required = false) |
| | | }) |
| | | public ResultUtil<List<QuerySiteTimes>> querySiteTimes(Integer id, String day,String halfName,String siteName){ |
| | | public ResultUtil<List<QuerySiteTimes>> querySiteTimes(Integer id, String day, String halfName, String siteName) { |
| | | try { |
| | | List<QuerySiteTimes> list = siteService.querySiteTimes(id, day,halfName,siteName); |
| | | List<QuerySiteTimes> list = siteService.querySiteTimes(id, day, halfName, siteName); |
| | | return ResultUtil.success(list); |
| | | }catch (Exception e){ |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | // 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("系统繁忙,请稍后再试!"); |
| | | // } |
| | | // |
| | | // } |
| | | |
| | | |
| | | /** |
| | | * 根据id获取数据 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/site/querySiteById") |
| | | public Site querySiteById(@RequestBody Integer id){ |
| | | public Site querySiteById(@RequestBody Integer id) { |
| | | try { |
| | | return siteService.getById(id); |
| | | }catch (Exception e){ |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | }) |
| | | public ResultUtil reservationSite(ReservationSite reservationSite){ |
| | | public ResultUtil reservationSite(ReservationSite reservationSite) { |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if(null == uid){ |
| | | if (null == uid) { |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return siteService.reservationSite(uid, reservationSite); |
| | | }catch (Exception e){ |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | // 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("系统繁忙,请稍后再试!"); |
| | | // } |
| | | // |
| | | // } |
| | | |
| | | |
| | | /** |
| | | * 购买课程微信支付回调 |
| | | * |
| | | * @param request |
| | | * @param response |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/site/weChatPaymentSiteCallback") |
| | | public void weChatPaymentSiteCallback(HttpServletRequest request, HttpServletResponse response){ |
| | | public void weChatPaymentSiteCallback(HttpServletRequest request, HttpServletResponse response) { |
| | | try { |
| | | Map<String, String> map = payMoneyUtil.weixinpayCallback(request); |
| | | if(null != map){ |
| | | if (null != map) { |
| | | String code = map.get("out_trade_no"); |
| | | String transaction_id = map.get("transaction_id"); |
| | | String result = map.get("result"); |
| | | SiteBooking siteBooking = siteBookingService.getOne(new QueryWrapper<SiteBooking>().eq("orderNo", code).eq("state", 1)); |
| | | if(siteBooking.getStatus() == 0){ |
| | | if (siteBooking.getStatus() == 0) { |
| | | siteBooking.setPayTime(new Date()); |
| | | siteBooking.setStatus(1); |
| | | siteBooking.setPayOrderNo(transaction_id); |
| | |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | }catch (Exception e){ |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 购买课程支付宝回调 |
| | | * 预约场地支付宝回调 |
| | | * |
| | | * @param request |
| | | * @param response |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/site/aliPaymentSiteCallback") |
| | | public void aliPaymentSiteCallback(HttpServletRequest request, HttpServletResponse response){ |
| | | public void aliPaymentSiteCallback(HttpServletRequest request, HttpServletResponse response) { |
| | | try { |
| | | System.out.println("回调回调回调"); |
| | | Map<String, String> map = payMoneyUtil.alipayCallback(request); |
| | | if(null != map){ |
| | | 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)); |
| | | if(siteBooking.getStatus() == 0){ |
| | | 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); |
| | |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | }catch (Exception e){ |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | @Autowired |
| | | private TGameConfigService gameConfigService; |
| | | @Autowired |
| | | private TGameRecordService gameRecordService; |
| | | |
| | | @Resource |
| | | private CourseRecordClient courseRecordClient; |
| | | /** |
| | | * 启动游戏支付宝回调 |
| | | * |
| | | * @param request |
| | | * @param response |
| | | */ |
| | | @ResponseBody |
| | | @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"); |
| | | String[] s = code.split("_"); |
| | | Integer i = startGame(Integer.valueOf(s[0]), Integer.valueOf(s[1]), Integer.valueOf(s[2]), Integer.valueOf(s[3])); |
| | | 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); |
| | | |
| | | System.err.println("===========游戏回调游戏回调=========" + i); |
| | | PrintWriter out = response.getWriter(); |
| | | out.write("success"); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | private static Integer startGame(Integer uid, Integer gameId, Integer spaceId, Integer sutuId) { |
| | | HashMap<String, String> map = new HashMap<>(); |
| | | map.put("sign", "0DB011836143EEE2C2E072967C9F4E4B"); |
| | | map.put("app_user_id", uid + ""); |
| | | map.put("game_id", gameId + ""); |
| | | map.put("space_id", spaceId + ""); |
| | | map.put("sutu_id", sutuId + ""); |
| | | |
| | | String s = HttpRequestUtil.postRequest("https://try.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 |
| | |
| | | @ApiImplicitParam(value = "页条数", name = "pageSize", dataType = "int", required = true), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | }) |
| | | public ResultUtil<List<QueryMySiteVo>> queryMySite(Integer status, Integer pageNo, Integer pageSize){ |
| | | public ResultUtil<List<QueryMySiteVo>> queryMySite(Integer status, Integer pageNo, Integer pageSize) { |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if(null == uid){ |
| | | if (null == uid) { |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<QueryMySiteVo> queryMySiteVos = siteService.queryMySite(uid, status, pageNo, pageSize); |
| | | return ResultUtil.success(queryMySiteVos); |
| | | }catch (Exception e){ |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/site/queryMySiteById") |
| | | @ApiOperation(value = "获取我的预约场地列表详情2.0", tags = {"用户—预约场地"}) |
| | |
| | | @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){ |
| | | public ResultUtil<Map<String, Object>> queryMySiteById(Integer id) { |
| | | try { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | SiteBooking byId = siteBookingService.getById(id); |
| | | Integer storeId = byId.getStoreId(); |
| | | Store byId1 = service.getById(storeId); |
| | | Site site = siteService.getById(byId.getSiteId()); |
| | | map.put("siteName", byId1.getName()); |
| | | SiteType siteType = siteTypeService.getById(site.getSiteTypeId()); |
| | | map.put("siteType", siteType.getName()); |
| | | map.put("shopName", byId1.getName()); |
| | | map.put("shopAddress", byId1.getAddress()); |
| | | |
| | | map.put("name", site.getName()); |
| | | |
| | | |
| | | List<Integer> ids = getIds(byId.getSiteId()); |
| | | byId.setStorePhone(byId1.getPhone()); |
| | | map.put("data",byId); |
| | | map.put("ids",ids); |
| | | |
| | | //拼接开始结束时间 |
| | | Date startTime = byId.getStartTime(); |
| | | Date endTime = byId.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); |
| | | |
| | | |
| | | 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()); |
| | | Integer siteId = byId.getSiteId(); |
| | | ArrayList<Integer> list1 = new ArrayList<>(); |
| | | list1.add(siteId); |
| | | byId.setRid(list1); |
| | | map.put("data", byId); |
| | | map.put("ids", ids); |
| | | return ResultUtil.success(map); |
| | | }catch (Exception e){ |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | public List<Integer> getIds(Integer siteId) { |
| | | public List<Integer> getIds(Integer siteId) { |
| | | HttpRequest httpRequest = HttpRequest.get("https://try.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); |
| | | Object data = jsonObject.get("data"); |
| | | JSONArray array = JSONArray.parseArray(data.toString()); |
| | | List<Integer> ids =new ArrayList<>(); |
| | | List<Integer> ids = new ArrayList<>(); |
| | | for (Object o : array) { |
| | | JSONObject jsonObject1 = JSONObject.parseObject(o.toString()); |
| | | Object id = jsonObject1.get("id"); |
| | |
| | | @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 cancelMySite(Integer id){ |
| | | public ResultUtil cancelMySite(Integer id) { |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if(null == uid){ |
| | | if (null == uid) { |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | |
| | | |
| | | return siteService.cancelMySite(uid, id); |
| | | }catch (Exception e){ |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | |
| | | |
| | | /** |
| | | * 微信退款回调 |
| | | * |
| | | * @param request |
| | | * @param response |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/site/cancelMySiteCallback") |
| | | public void cancelMySiteCallback(HttpServletRequest request, HttpServletResponse response){ |
| | | public void cancelMySiteCallback(HttpServletRequest request, HttpServletResponse response) { |
| | | try { |
| | | Map<String, String> map = payMoneyUtil.wxRefundCallback(request); |
| | | if(null != map){ |
| | | if (null != map) { |
| | | String code = map.get("out_refund_no"); |
| | | String refund_id = map.get("refund_id"); |
| | | String result = map.get("result"); |
| | |
| | | siteBooking.setCancelTime(new Date()); |
| | | siteBooking.setRefundOrderNo(refund_id); |
| | | siteBookingService.updateById(siteBooking); |
| | | if(null != siteBooking.getUserCouponId()){ |
| | | UserCoupon userCoupon = userCouponClient.queryUserCouponById(new QueryUserCouponByIdAndUserId(siteBooking.getUserCouponId(),siteBooking.getAppUserId())); |
| | | if (null != siteBooking.getUserCouponId()) { |
| | | UserCoupon userCoupon = userCouponClient.queryUserCouponById(new QueryUserCouponByIdAndUserId(siteBooking.getUserCouponId(), siteBooking.getAppUserId())); |
| | | userCoupon.setStatus(1); |
| | | userCouponClient.updateUserCoupon(userCoupon); |
| | | } |
| | |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | }catch (Exception e){ |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | |
| | | @ApiImplicitParam(value = "支付方式(1=微信,2=支付宝,3=玩湃币)", name = "payType", dataType = "int", required = true), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | }) |
| | | public ResultUtil continuePaymentMySite(Integer id, Integer payType){ |
| | | public ResultUtil continuePaymentMySite(Integer id, Integer payType) { |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if(null == uid){ |
| | | if (null == uid) { |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return siteService.continuePaymentMySite(uid, id, payType); |
| | | }catch (Exception e){ |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "预约数据id", name = "id", dataType = "int", required = true), |
| | | }) |
| | | public ResultUtil<Map<String, Double>> queryContinuePaymentMySitePrice(Integer id){ |
| | | public ResultUtil<Map<String, Double>> queryContinuePaymentMySitePrice(Integer id) { |
| | | try { |
| | | return siteService.queryContinuePaymentMySitePrice(id); |
| | | }catch (Exception e){ |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | |
| | | |
| | | /** |
| | | * 查询所有现金支付的预约记录 |
| | | * |
| | | * @param requestVo |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/site/queryPaymentSiteDetail") |
| | | public RequestOfTypeVo getAllSiteBookingList(@RequestBody BillingDataRequestVo requestVo){ |
| | | public RequestOfTypeVo getAllSiteBookingList(@RequestBody BillingDataRequestVo requestVo) { |
| | | RequestOfTypeVo typeVo = new RequestOfTypeVo(); |
| | | List<BillingRequestOfType> billingRequestOfTypes = siteBookingService.queryDatas(requestVo.getAppUserId(), requestVo.getMonthStart(), requestVo.getMonthEnd()); |
| | | if (billingRequestOfTypes.size() > 0 ){ |
| | | if (billingRequestOfTypes.size() > 0) { |
| | | typeVo.setRequest(billingRequestOfTypes); |
| | | } |
| | | return typeVo; |
| | |
| | | |
| | | /** |
| | | * 查询所有玩湃币支付的预约记录 |
| | | * |
| | | * @param appUserId |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/site/queryPlaypaiGoldSiteDetail") |
| | | public List<SiteBooking> wanpaiGoldSiteBookingList(@RequestBody Integer appUserId){ |
| | | public List<SiteBooking> wanpaiGoldSiteBookingList(@RequestBody Integer appUserId) { |
| | | ArrayList<Integer> integers = new ArrayList<>(); |
| | | integers.add(1); |
| | | integers.add(2); |
| | |
| | | integers.add(4); |
| | | integers.add(5); |
| | | return siteBookingService.list(new QueryWrapper<SiteBooking>() |
| | | .in("status",integers) |
| | | .eq("payType",3) |
| | | .eq("appUserId",appUserId)); |
| | | .in("status", integers) |
| | | .eq("payType", 3) |
| | | .eq("appUserId", appUserId)); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/site/queryByCode") |
| | | public Integer queryByCode(@RequestBody String code){ |
| | | public Integer queryByCode(@RequestBody String code) { |
| | | |
| | | return siteBookingService.queryByCode(code); |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | private StoreService service; |
| | | private StoreService service; |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/site/game") |
| | | public List<Map<String, Object>> game(@RequestBody Integer appUserId) { |
| | | return service.game(appUserId); |
| | | |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/site/counts") |
| | | public Integer counts(@RequestBody Integer stuId) { |
| | | return siteBookingService.count(new QueryWrapper<SiteBooking>().eq("appUserId", stuId)); |
| | | |
| | | } |
| | | |
| | | @Autowired |
| | | private IOperatorUserService operatorUserService; |
| | | 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){ |
| | | public OperatorUser queryOperator(@RequestBody List<Integer> stores) { |
| | | |
| | | Store one = service.getOne(new QueryWrapper<Store>().in("id", stores)); |
| | | OperatorUser o = operatorUserService.getById(one.getOperatorId()); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/site/getNewAddSiteList") |
| | | public List<SiteVo> getAppUserSiteList(@RequestBody Integer storeId){ |
| | | public List<SiteVo> getAppUserSiteList(@RequestBody Integer storeId) { |
| | | List<SiteVo> siteVos = new ArrayList<>(); |
| | | |
| | | List<Site> list = siteService.list(new QueryWrapper<Site>().eq("state",1).eq("storeId",storeId) |
| | | List<Site> list = siteService.list(new QueryWrapper<Site>().eq("state", 1).eq("storeId", storeId) |
| | | .orderByDesc("insertTime")); |
| | | if (list.size() > 0 ){ |
| | | if (list.size() > 0) { |
| | | for (Site site : list) { |
| | | SiteVo vo = new SiteVo(); |
| | | vo.setSiteId(site.getId()); |