| | |
| | | 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.*; |
| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.PrintWriter; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | |
| | | @Resource |
| | | private UserCouponClient userCouponClient; |
| | | @Autowired |
| | | |
| | | @Resource |
| | | private CityManagerClient cityManagerClient; |
| | | @Autowired |
| | | private IOperatorUserService operatorUserService; |
| | | |
| | | @Autowired |
| | | private TGameConfigService gameConfigService; |
| | | |
| | | @Autowired |
| | | private TGameRecordService gameRecordService; |
| | | |
| | | @Resource |
| | | private CourseRecordClient courseRecordClient; |
| | | @Resource |
| | | private StoreService storeService; |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 通过运营商id查询运营商对应的支付宝商户号 |
| | |
| | | @RequestMapping("/base/getSMIDByOperatorId") |
| | | @ResponseBody |
| | | public String getSMIDByOperatorId(Integer id) { |
| | | // 获取运营商的管理员 |
| | | return siteService.getSMIDByOperatorId(id); |
| | | } |
| | | /** |
| | | * 通过运营商id查询运营商对应的微信商户号 |
| | | */ |
| | | @RequestMapping("/base/getmerchantNumberByOperatorId/{id}") |
| | | @ResponseBody |
| | | public String getmerchantNumberByOperatorId(@PathVariable("id")Integer id) { |
| | | return siteService.getmerchantNumberByOperatorId(id); |
| | | } |
| | | /** |
| | | * 根据运营商id获取对应运营商分账比例 返回格式: 微信分账比例,支付宝分账比例 |
| | | */ |
| | | @RequestMapping("/base/getProportionByOperatorId/{id}") |
| | | @ResponseBody |
| | | public String getProportionByOperatorId(@PathVariable("id")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"); |
| | | } |
| | | System.err.println("查询分账比例"+operatorId); |
| | | return operatorId.getWechatProportion()+","+operatorId.getAlipayProportion(); |
| | | } |
| | | /** |
| | | * 获取所有场地 |
| | |
| | | } |
| | | |
| | | @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 Site querySiteById(@RequestBody Integer id) { |
| | | try { |
| | | return siteService.getById(id); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | /** |
| | | * 根据id获取数据 |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/site/querySiteByStoreIds") |
| | | public List<Site> querySiteByStoreIds(@RequestBody String ids) { |
| | | try { |
| | | return siteService.lambdaQuery().in(Site::getStoreId,Arrays.asList(ids.split(","))).list(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return null; |
| | |
| | | } |
| | | } |
| | | |
| | | // 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("系统繁忙,请稍后再试!"); |
| | | // } |
| | | // |
| | | // } |
| | | |
| | | |
| | | /** |
| | |
| | | @PostMapping("/base/site/weChatPaymentSiteCallback") |
| | | public void weChatPaymentSiteCallback(HttpServletRequest request, HttpServletResponse response) { |
| | | try { |
| | | System.err.println("预约场地回调"); |
| | | Map<String, String> map = payMoneyUtil.weixinpayCallback(request); |
| | | if (null != map) { |
| | | String code = map.get("out_trade_no"); |
| | |
| | | siteBooking.setStatus(1); |
| | | siteBooking.setPayOrderNo(transaction_id); |
| | | siteBookingService.updateById(siteBooking); |
| | | Store byId = service.getById(siteBooking.getStoreId()); |
| | | if (byId.getOperatorId()!=null && byId.getOperatorId()!=0){ |
| | | System.err.println("预约场地分账"); |
| | | // 休眠两分钟后再调用分账接口 避免提示订单正在处理中 |
| | | Thread.sleep(120000); |
| | | // 根据运营商id获取对应运营商分账比例 返回格式: 微信分账比例,支付宝分账比例 |
| | | OperatorUser operatorId = operatorUserService.getOne( |
| | | new QueryWrapper<OperatorUser>().eq("operatorId",byId.getOperatorId()) |
| | | ); |
| | | if (operatorId.getWechatProportion() == null){ |
| | | operatorId.setWechatProportion("0"); |
| | | } |
| | | if (operatorId.getAlipayProportion() == null){ |
| | | operatorId.setAlipayProportion("0"); |
| | | } |
| | | String proportion= operatorId.getWechatProportion()+","+operatorId.getAlipayProportion(); |
| | | String[] split = proportion.split(","); |
| | | String s1 = split[0]; |
| | | if (!s1.equals("未设置")){ |
| | | BigDecimal bigDecimal = new BigDecimal(s1); |
| | | // 分账比例 |
| | | BigDecimal bigDecimal1 = bigDecimal.divide(new BigDecimal(100)).setScale(2); |
| | | // 微信商户号 |
| | | String s2 =siteService.getmerchantNumberByOperatorId(byId.getOperatorId()); |
| | | String nonce_str = UUIDUtil.getRandomCode(16); |
| | | BigDecimal bigDecimal2 = new BigDecimal(siteBooking.getPayMoney()); |
| | | ResultUtil fenzhang = payMoneyUtil.fenzhang(transaction_id, bigDecimal2.multiply(bigDecimal1), s2,nonce_str,"预约场地分账"); |
| | | if (!fenzhang.getCode().equals(200)){ |
| | | System.err.println("分账失败 原因是:"+fenzhang.getMsg()); |
| | | }else{ |
| | | siteBooking.setFenzhangNo(fenzhang.getData().toString()); |
| | | siteBooking.setFenzhangOrderNo(nonce_str); |
| | | siteBooking.setFenzhangAmount(bigDecimal2.multiply(bigDecimal1)); |
| | | 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"); |
| | |
| | | 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(); |
| | | } |
| | | } |
| | | |
| | | @Autowired |
| | | private TGameConfigService gameConfigService; |
| | | @Autowired |
| | | private TGameRecordService gameRecordService; |
| | | |
| | | @Resource |
| | | private CourseRecordClient courseRecordClient; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 启动游戏支付宝回调 |
| | | * |
| | |
| | | @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[] 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)); |
| | |
| | | coursePackagePayment.setOrderNo(trade_no); |
| | | |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | // courseCounsum.setPaymentId(paymentId); |
| | | 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(); |
| | |
| | | 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))) { |
| | |
| | | |
| | | @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(); |
| | | System.err.println("预约id"+id); |
| | | SiteBooking siteBooking = siteBookingService.getById(id); |
| | | System.err.println("预约"+siteBooking); |
| | | 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()); |
| | | System.err.println("预约类型"+siteType); |
| | | 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()); |
| | | 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()); |
| | | Integer siteId = byId.getSiteId(); |
| | | siteBooking.setSid(Arrays.asList(storeId)); |
| | | Integer siteId = siteBooking.getSiteId(); |
| | | ArrayList<Integer> list1 = new ArrayList<>(); |
| | | list1.add(siteId); |
| | | byId.setRid(list1); |
| | | map.put("data", byId); |
| | | siteBooking.setRid(list1); |
| | | SiteBookingVo siteBookingVo = new SiteBookingVo(); |
| | | BeanUtils.copyProperties(siteBooking, siteBookingVo); |
| | | siteBookingVo.setStartTime(siteBooking.getStartTime().getTime()); |
| | | siteBookingVo.setEndTime(siteBooking.getEndTime().getTime()); |
| | | if (siteBooking.getPayTime()!=null){ |
| | | 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") |