| | |
| | | package com.dsh.other.service.impl; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | |
| | | @Autowired |
| | | private SiteMapper siteMapper; |
| | | |
| | | @Autowired |
| | | private TBackRecordService backRecordService; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | querySiteInfoVo.setStoreLon(store.getLon()); |
| | | querySiteInfoVo.setStoreLat(store.getLat()); |
| | | querySiteInfoVo.setStorePhone(store.getPhone()); |
| | | querySiteInfoVo.setImgs(site.getImgs()); |
| | | querySiteInfoVo.setDistance(0D); |
| | | querySiteInfoVo.setCashPriceOne(site.getCashPriceOne()); |
| | | if(site.getPlayPaiCoinOne()!=null){ |
| | | querySiteInfoVo.setPlayPaiCoinOne(site.getPlayPaiCoinOne().intValue()); |
| | | } |
| | | |
| | | querySiteInfoVo.setIntroduce(site.getIntroduce()); |
| | | ArrayList<String> nextName = new ArrayList<>(); |
| | | ArrayList<String> halfName = new ArrayList<>(); |
| | | String nextName1 = site.getNextName(); |
| | | String halfName1 = site.getHalfName(); |
| | | querySiteInfoVo.setIshalf(site.getIshalf()); |
| | | String[] split = nextName1.split(","); |
| | | for (String s : split) { |
| | | nextName.add(s); |
| | | } |
| | | String[] split1 = halfName1.split(","); |
| | | for (String s : split1) { |
| | | halfName.add(s); |
| | | } |
| | | querySiteInfoVo.setHalfName(halfName); |
| | | querySiteInfoVo.setNextName(nextName); |
| | | if(ToolUtil.isNotEmpty(lon) && ToolUtil.isNotEmpty(lat)){ |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(lon + "," + lat, store.getLon() + "," + store.getLat()); |
| | | double wgs84 = new BigDecimal(distance.get("WGS84")).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | |
| | | e.setTime(sdf.parse(day + " " + site.getAppointmentEndTime())); |
| | | |
| | | int hour = e.get(Calendar.HOUR_OF_DAY); |
| | | |
| | | int minute = e.get(Calendar.MINUTE); |
| | | |
| | | List<QuerySiteTimes> list = new ArrayList<>(); |
| | | |
| | | SimpleDateFormat sdfs = new SimpleDateFormat("HH:mm"); |
| | | |
| | | while (true){ |
| | | |
| | | String start = sdfs.format(s.getTime()); |
| | | |
| | | s.set(Calendar.MINUTE, s.get(Calendar.MINUTE) + 30); |
| | | |
| | | int e_hour = s.get(Calendar.HOUR_OF_DAY); |
| | | |
| | | int e_minute = s.get(Calendar.MINUTE); |
| | | |
| | | String end = sdfs.format(s.getTime()); |
| | | |
| | | QuerySiteTimes querySiteTimes = new QuerySiteTimes(); |
| | | |
| | | querySiteTimes.setTime(start + "-" + end); |
| | | |
| | | querySiteTimes.setSelectable(1); |
| | | |
| | | SiteBooking siteBooking = siteBookingService.getOne(new QueryWrapper<SiteBooking>().eq("siteId", id).eq("state", 1) |
| | |
| | | siteBooking.setStatus(0); |
| | | siteBooking.setState(1); |
| | | siteBooking.setInsertTime(new Date()); |
| | | |
| | | // 2.0 |
| | | siteBooking.setNextName(reservationSite.getNextName()); |
| | | siteBooking.setIsHalf(reservationSite.getIsHalf()); |
| | | siteBooking.setHalfName(reservationSite.getHalfName()); |
| | | siteBookingService.save(siteBooking); |
| | | |
| | | if(reservationSite.getPayType() == 1){//微信支付 |
| | |
| | | SiteBooking siteBooking = siteBookingService.getById(queryMySiteVo.getId()); |
| | | Site site = this.getById(siteBooking.getSiteId()); |
| | | String[] split = siteBooking.getTimes().split(";"); |
| | | queryMySiteVo.setPlayPaiCoin(site.getPlayPaiCoin() * split.length); |
| | | if(site!=null){ |
| | | |
| | | queryMySiteVo.setPlayPaiCoin(site.getPlayPaiCoin() * split.length); |
| | | } |
| | | } |
| | | return queryMySiteVos; |
| | | } |
| | |
| | | @Override |
| | | public ResultUtil cancelMySite(Integer uid, Integer id) throws Exception { |
| | | SiteBooking siteBooking = siteBookingService.getById(id); |
| | | |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd"); |
| | | Date startTime = siteBooking.getStartTime(); |
| | | if(format.format(new Date()).equals(format.format(startTime))){ |
| | | return ResultUtil.error("预约当天,不能取消"); |
| | | } |
| | | if(siteBooking.getStatus() == 0){ |
| | | return ResultUtil.error("请先进行支付"); |
| | | } |
| | |
| | | } |
| | | siteBooking.setCancelUserId(uid); |
| | | siteBookingService.updateById(siteBooking); |
| | | |
| | | TBackRecord tBackRecord = new TBackRecord(); |
| | | tBackRecord.setMoney(siteBooking.getPayMoney()); |
| | | tBackRecord.setUserId(siteBooking.getAppUserId()); |
| | | tBackRecord.setTime(new Date()); |
| | | backRecordService.save(tBackRecord); |
| | | |
| | | } |
| | | if(siteBooking.getPayType() == 2){//支付宝 |
| | | Map<String, String> map = payMoneyUtil.aliRefund(siteBooking.getPayOrderNo(), siteBooking.getPayMoney().toString()); |
| | |
| | | userCoupon.setStatus(1); |
| | | userCouponClient.updateUserCoupon(userCoupon); |
| | | } |
| | | |
| | | |
| | | TBackRecord tBackRecord = new TBackRecord(); |
| | | tBackRecord.setMoney(siteBooking.getPayMoney()); |
| | | tBackRecord.setUserId(siteBooking.getAppUserId()); |
| | | tBackRecord.setTime(new Date()); |
| | | backRecordService.save(tBackRecord); |
| | | } |
| | | |
| | | if(siteBooking.getPayType() == 3){//玩湃币 |