Merge remote-tracking branch 'origin/master'
| | |
| | | indexOfUserBenefirVo.setCommodities(commodities); |
| | | return ResultUtil.success(indexOfUserBenefirVo); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | |
| | | @ApiModelProperty(value = "课时有效期") |
| | | private String periodOfValidity; |
| | | |
| | | @ApiModelProperty(value = "总学时数") |
| | | private Integer totalNums; |
| | | |
| | | @ApiModelProperty(value = "已扣学时数") |
| | | private Integer deductedNums; |
| | | |
| | | @ApiModelProperty(value = "剩余学时数") |
| | | private Integer remainingNums; |
| | | |
| | | } |
| | |
| | | List<SiteBooking> siteBookings = stClient.wanpaiGoldSiteBookingList(appUserId); |
| | | if (siteBookings.size() > 0 ){ |
| | | for (SiteBooking booking : siteBookings) { |
| | | RechargesDetail consumeDetail = new RechargesDetail(); |
| | | consumeDetail.setConsumeName(RechargeRecordEnum.VENUE_RESERVATION.getMsg()); |
| | | consumeDetail.setConsumeTime(simpleDateFormat.format(booking.getInsertTime())); |
| | | consumeDetail.setConsumeAmount("-" + booking.getPayMoney()); |
| | | consumeDetail.setRecordId(2); |
| | | details.add(consumeDetail); |
| | | if (booking.getStatus()!=5) { |
| | | RechargesDetail consumeDetail = new RechargesDetail(); |
| | | consumeDetail.setConsumeName(RechargeRecordEnum.VENUE_RESERVATION.getMsg()); |
| | | consumeDetail.setConsumeTime(simpleDateFormat.format(booking.getInsertTime())); |
| | | consumeDetail.setConsumeAmount("-" + booking.getPayMoney()); |
| | | consumeDetail.setRecordId(2); |
| | | details.add(consumeDetail); |
| | | }else { |
| | | RechargesDetail consumeDetail1 = new RechargesDetail(); |
| | | consumeDetail1.setConsumeName(RechargeRecordEnum.CANCEL_VENUE_RESERVATION.getMsg()); |
| | | consumeDetail1.setConsumeTime(simpleDateFormat.format(booking.getCancelTime())); |
| | | consumeDetail1.setConsumeAmount("+" + booking.getPayMoney()); |
| | | consumeDetail1.setRecordId(1); |
| | | details.add(consumeDetail1); |
| | | |
| | | RechargesDetail consumeDetail = new RechargesDetail(); |
| | | consumeDetail.setConsumeName(RechargeRecordEnum.VENUE_RESERVATION.getMsg()); |
| | | consumeDetail.setConsumeTime(simpleDateFormat.format(booking.getInsertTime())); |
| | | consumeDetail.setConsumeAmount("-" + booking.getPayMoney()); |
| | | consumeDetail.setRecordId(2); |
| | | details.add(consumeDetail); |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | | } |
| | | // 4.智慧球场 |
| | |
| | | RechargeCentVo vo = new RechargeCentVo(); |
| | | Double money = (Double) stringObjectMap.get("money"); |
| | | vo.setAmount(BigDecimal.valueOf(money) ); |
| | | if (tAppUser.getIsVip() == 1){ |
| | | if (tAppUser.getIsVip() == 1&&tAppUser.getVipEndTime().after(new Date())){ |
| | | vo.setWpGold((Integer) stringObjectMap.get("MemberCoins")); |
| | | }else { |
| | | vo.setWpGold((Integer) stringObjectMap.get("usersCoins")); |
| | |
| | | UserIntegralChanges userIntegralChanges = new UserIntegralChanges(); |
| | | userIntegralChanges.setAppUserId(appUserId); |
| | | userIntegralChanges.setOldIntegral(appUser.getIntegral()); |
| | | userIntegralChanges.setType(5); |
| | | userIntegralChanges.setType(2); |
| | | appUser.setIntegral(null == appUser.getIntegral() ? points : appUser.getIntegral() - points); |
| | | userIntegralChanges.setNewIntegral(appUser.getIntegral()); |
| | | userIntegralChanges.setInsertTime(new Date()); |
| | |
| | | <artifactId>httpmime</artifactId> |
| | | <version>4.5.2</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.gavaghan</groupId> |
| | | <artifactId>geodesy</artifactId> |
| | | <version>1.1.3</version> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | | <build> |
| | |
| | | import com.dsh.activity.model.response.GoodsInfoOneVo; |
| | | import com.dsh.activity.model.response.StoreVos; |
| | | import com.dsh.activity.service.*; |
| | | import com.dsh.activity.util.GDMapGeocodingUtil; |
| | | import com.dsh.activity.util.StrUtils; |
| | | import com.dsh.activity.util.TokenUtil; |
| | | import com.dsh.activity.util.ToolUtil; |
| | | import com.dsh.activity.util.*; |
| | | import io.swagger.models.auth.In; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | } |
| | | |
| | | |
| | | @Resource |
| | | private StoreClient storeClient; |
| | | |
| | | @Autowired |
| | | private PointsMerchandiseStoreService pointsMerchandiseStoreService; |
| | | @ResponseBody |
| | | @PostMapping("/base/pointMerchars/convertGoods") |
| | | public List<IntegralCommodity> getConvertibleGoods(@RequestBody Location location) throws Exception { |
| | |
| | | String cityCode = geocode.get("cityCode"); |
| | | |
| | | |
| | | List<PointsMerchandiseCity> cityCode1 = pmdsCityService.list(new QueryWrapper<PointsMerchandiseCity>().eq("cityCode", cityCode)); |
| | | // if(null != geocode) { |
| | | |
| | | List<Store> stores = storeClient.queryStoreList(new QueryStoreList(provinceCode, cityCode)); |
| | | Store s = null; |
| | | Double d = 0D; |
| | | for (Store store : stores) { |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(location.getLon() + "," + location.getLat(), store.getLon() + "," + store.getLat()); |
| | | Double wgs84 = distance.get("WGS84"); |
| | | if (s == null || d > wgs84) { |
| | | s = store; |
| | | d = wgs84; |
| | | } |
| | | } |
| | | // } |
| | | |
| | | // List<PointsMerchandiseCity> cityCode1 = pmdsCityService.list(new QueryWrapper<PointsMerchandiseCity>().eq("cityCode", cityCode)); |
| | | List<Integer> cIds = new ArrayList<>(); |
| | | for (PointsMerchandiseCity pointsMerchandiseCity : cityCode1) { |
| | | cIds.add(pointsMerchandiseCity.getPointsMerchandiseId()); |
| | | // for (PointsMerchandiseCity pointsMerchandiseCity : cityCode1) { |
| | | // cIds.add(pointsMerchandiseCity.getPointsMerchandiseId()); |
| | | // } |
| | | |
| | | List<PointsMerchandiseStore> storesids =pointsMerchandiseStoreService.list(new QueryWrapper<PointsMerchandiseStore>().eq("storeId",s.getId())); |
| | | for (PointsMerchandiseStore storesid : storesids) { |
| | | cIds.add(storesid.getPointsMerchandiseId()); |
| | | } |
| | | |
| | | |
| | | // if (cIds.size()>0) { |
| | | |
| | | List<PointsMerchandise> merchandises = pmdsService.list(new QueryWrapper<PointsMerchandise>() |
| | | List<PointsMerchandise> merchandises = pmdsService.list(new QueryWrapper<PointsMerchandise>().in("id",cIds) |
| | | .eq("state", 1) |
| | | .eq("shelves", 1) |
| | | .gt("endTime", new Date()).last("ORDER BY sort desc,insertTime desc")); |
New file |
| | |
| | | package com.dsh.activity.entity; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/6/28 9:08 |
| | | */ |
| | | @Data |
| | | public class QueryStoreList { |
| | | private String provinceCode; |
| | | |
| | | private String cityCode; |
| | | |
| | | public QueryStoreList() { |
| | | } |
| | | |
| | | public QueryStoreList(String provinceCode, String cityCode) { |
| | | this.provinceCode = provinceCode; |
| | | this.cityCode = cityCode; |
| | | } |
| | | } |
| | |
| | | package com.dsh.activity.feignclient.other; |
| | | |
| | | import com.dsh.activity.entity.QueryStoreList; |
| | | import com.dsh.activity.feignclient.other.model.Store; |
| | | import com.dsh.activity.feignclient.other.model.StoreDetailOfCourse; |
| | | import com.dsh.activity.feignclient.other.model.StoreInfoDto; |
| | |
| | | /** |
| | | * 获取根据门店id 获取店长信息 |
| | | */ |
| | | @PostMapping("/store/queryStoreList") |
| | | List<Store> queryStoreList(QueryStoreList queryStoreList); |
| | | |
| | | @RequestMapping(value = "/getStoreInfo") |
| | | public StoreInfoDto getStoreInfo(@RequestBody Integer id); |
| | | |
New file |
| | |
| | | package com.dsh.activity.util; |
| | | |
| | | import org.gavaghan.geodesy.Ellipsoid; |
| | | import org.gavaghan.geodesy.GeodeticCalculator; |
| | | import org.gavaghan.geodesy.GeodeticCurve; |
| | | import org.gavaghan.geodesy.GlobalCoordinates; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 计算两个金纬度坐标之间的直线距离 |
| | | */ |
| | | public class GeodesyUtil { |
| | | |
| | | |
| | | /** |
| | | * 获取直线距离 |
| | | * @param fromLonLat |
| | | * @param toLonLat |
| | | * @return |
| | | */ |
| | | public static Map<String, Double> getDistance(String fromLonLat, String toLonLat){ |
| | | String[] from = fromLonLat.split(","); |
| | | String[] to = toLonLat.split(","); |
| | | GlobalCoordinates source = new GlobalCoordinates(Double.valueOf(from[1]), Double.valueOf(from[0])); |
| | | GlobalCoordinates target = new GlobalCoordinates(Double.valueOf(to[1]), Double.valueOf(to[0])); |
| | | double Sphere = getDistanceMeter(source, target, Ellipsoid.Sphere); |
| | | double WGS84 = getDistanceMeter(source, target, Ellipsoid.WGS84); |
| | | double GRS80 = getDistanceMeter(source, target, Ellipsoid.GRS80); |
| | | double GRS67 = getDistanceMeter(source, target, Ellipsoid.GRS67); |
| | | double ANS = getDistanceMeter(source, target, Ellipsoid.ANS); |
| | | double WGS72 = getDistanceMeter(source, target, Ellipsoid.WGS72); |
| | | double Clarke1858 = getDistanceMeter(source, target, Ellipsoid.Clarke1858); |
| | | double Clarke1880 = getDistanceMeter(source, target, Ellipsoid.Clarke1880); |
| | | // System.out.println("Sphere坐标系计算结果:"+Sphere + "米"); |
| | | // System.out.println("WGS84坐标系计算结果:"+WGS84 + "米"); |
| | | // System.out.println("GRS80坐标系计算结果:"+GRS80 + "米"); |
| | | // System.out.println("GRS67坐标系计算结果:"+GRS67 + "米"); |
| | | // System.out.println("ANS坐标系计算结果:"+ANS + "米"); |
| | | // System.out.println("WGS72坐标系计算结果:"+WGS72 + "米"); |
| | | // System.out.println("Clarke1858坐标系计算结果:"+Clarke1858 + "米"); |
| | | // System.out.println("Clarke1880坐标系计算结果:"+Clarke1880 + "米"); |
| | | Map<String, Double> map = new HashMap<>(); |
| | | map.put("Sphere", Sphere); |
| | | map.put("WGS84", WGS84); |
| | | map.put("GRS80", GRS80); |
| | | map.put("GRS67", GRS67); |
| | | map.put("ANS", ANS); |
| | | map.put("WGS72", WGS72); |
| | | map.put("Clarke1858", Clarke1858); |
| | | map.put("Clarke1880", Clarke1880); |
| | | return map; |
| | | } |
| | | |
| | | |
| | | private static double getDistanceMeter(GlobalCoordinates gpsFrom, GlobalCoordinates gpsTo, Ellipsoid ellipsoid){ |
| | | //创建GeodeticCalculator,调用计算方法,传入坐标系、经纬度用于计算距离 |
| | | GeodeticCurve geoCurve = new GeodeticCalculator().calculateGeodeticCurve(ellipsoid, gpsFrom, gpsTo); |
| | | return geoCurve.getEllipsoidalDistance(); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.dsh.competition.feignclient.account.AppUserClient; |
| | | import com.dsh.competition.feignclient.account.model.AppUser; |
| | | import com.dsh.competition.feignclient.course.CoursePackagePaymentClient; |
| | | import com.dsh.competition.feignclient.course.model.PaymentDeductionClassHour; |
| | | import com.dsh.competition.feignclient.model.*; |
| | | import com.dsh.competition.feignclient.other.StoreClient; |
| | | import com.dsh.competition.model.*; |
| | | import com.dsh.competition.service.CompetitionService; |
| | | import com.dsh.competition.service.IParticipantService; |
| | |
| | | } |
| | | } |
| | | |
| | | @Resource |
| | | private StoreClient storeClient; |
| | | |
| | | @Autowired |
| | | private UserCompetitionService userCompetitionService; |
| | | |
| | | |
| | | @PostMapping("/base/competition/cancel") |
| | | public void cancel(@RequestBody Integer id){ |
| | | try { |
| | | Competition byId = cttService.getById(id); |
| | | byId.setStatus(4); |
| | | cttService.updateById(byId); |
| | | List<PaymentCompetition> list = paymentCompetitionService.list(new QueryWrapper<PaymentCompetition>().eq("competitionId", byId.getId()).eq("payStatus", 2)); |
| | | for (PaymentCompetition pay : list) { |
| | | PaymentCompetition paymentCompetition = pay; |
| | | |
| | | String code = paymentCompetition.getCode(); |
| | | Double amount = paymentCompetition.getAmount(); |
| | | Competition competition = competitionService.getById(paymentCompetition.getCompetitionId()); |
| | | |
| | | |
| | | String payOrderNo = paymentCompetition.getPayOrderNo(); |
| | | if(paymentCompetition.getPayType() == 1){//微信支付 |
| | | Map<String, String> map = payMoneyUtil.wxRefund(payOrderNo, code, amount.toString(), amount.toString(), "/base/competition/weChatCancelPaymentCompetitionCallback"); |
| | | String return_code = map.get("return_code"); |
| | | if(!"SUCCESS".equals(return_code)){ |
| | | // return ResultUtil.error(map.get("return_msg")); |
| | | continue; |
| | | } |
| | | String refund_id = map.get("refund_id"); |
| | | paymentCompetition.setRefundOrderNo(refund_id); |
| | | paymentCompetitionService.updateById(paymentCompetition); |
| | | |
| | | storeClient.addBackRecord(paymentCompetition.getAmount()+"_"+paymentCompetition.getAppUserId()); |
| | | |
| | | |
| | | } |
| | | if(paymentCompetition.getPayType() == 2){//支付宝支付 |
| | | Map<String, String> map = payMoneyUtil.aliRefund(payOrderNo, amount.toString()); |
| | | String return_code = map.get("code"); |
| | | if(!"10000".equals(return_code)){ |
| | | // return ResultUtil.error(map.get("msg")); |
| | | continue; |
| | | } |
| | | String refund_id = map.get("trade_no"); |
| | | paymentCompetition.setRefundOrderNo(refund_id); |
| | | paymentCompetition.setRefundTime(new Date()); |
| | | paymentCompetition.setPayStatus(3); |
| | | paymentCompetition.setAppUserId(null); |
| | | paymentCompetitionService.updateById(paymentCompetition); |
| | | |
| | | // competition.setApplicantsNumber(competition.getApplicantsNumber() - 1); |
| | | competitionService.updateById(competition); |
| | | } |
| | | if(paymentCompetition.getPayType() == 3){//玩湃币支付 |
| | | AppUser appUser = appUserClient.queryAppUser(paymentCompetition.getAppUserId()); |
| | | appUser.setPlayPaiCoins(appUser.getPlayPaiCoins() + amount.intValue()); |
| | | appUserClient.updateAppUser(appUser); |
| | | |
| | | paymentCompetition.setRefundOrderNo(""); |
| | | paymentCompetition.setRefundTime(new Date()); |
| | | paymentCompetition.setPayStatus(3); |
| | | paymentCompetition.setAppUserId(null); |
| | | paymentCompetitionService.updateById(paymentCompetition); |
| | | |
| | | // competition.setApplicantsNumber(competition.getApplicantsNumber() - 1); |
| | | competitionService.updateById(competition); |
| | | } |
| | | if(paymentCompetition.getPayType() == 4){//课程支付 |
| | | List<UserCompetition> list1 = userCompetitionService.list(new QueryWrapper<UserCompetition>().eq("paymentCompetitionId", paymentCompetition.getId())); |
| | | for (UserCompetition userCompetition : list1) { |
| | | // Participant participant = participantService.getById(userCompetition.getId()); |
| | | // Student student = studentClient.queryStudentByPhone(participant.getPhone()); |
| | | PaymentDeductionClassHour paymentDeductionClassHour = new PaymentDeductionClassHour(); |
| | | paymentDeductionClassHour.setId(userCompetition.getParticipantId()); |
| | | paymentDeductionClassHour.setClassHour(competition.getClassPrice()); |
| | | paymentDeductionClassHour.setCode(code); |
| | | coursePackagePaymentClient.rollbackPaymentDeductionClassHour(paymentDeductionClassHour); |
| | | } |
| | | |
| | | paymentCompetition.setRefundOrderNo(""); |
| | | paymentCompetition.setRefundTime(new Date()); |
| | | paymentCompetition.setPayStatus(3); |
| | | paymentCompetition.setAppUserId(null); |
| | | paymentCompetitionService.updateById(paymentCompetition); |
| | | |
| | | // competition.setApplicantsNumber(competition.getApplicantsNumber() - 1); |
| | | competitionService.updateById(competition); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | String[] split = paymentCompetitionVo.getIds().split(";"); |
| | | Competition competition = this.getById(paymentCompetitionVo.getId()); |
| | | |
| | | int competitionId = userCompetitionService.count(new QueryWrapper<UserCompetition>().eq("competitionId", paymentCompetitionVo.getId())); |
| | | List<PaymentCompetition> list = paymentCompetitionService.list(new QueryWrapper<PaymentCompetition>().eq("competitionId", paymentCompetitionVo.getId()).ne("payStatus", 3)); |
| | | List<Long> pays = new ArrayList<>(); |
| | | for (PaymentCompetition paymentCompetition : list) { |
| | | pays.add(paymentCompetition.getId()); |
| | | } |
| | | |
| | | int competitionId = 0; |
| | | if (!pays.isEmpty()) { |
| | | competitionId = userCompetitionService.count(new QueryWrapper<UserCompetition>().in("paymentCompetitionId", pays)); |
| | | } |
| | | |
| | | |
| | | // int competitionId = userCompetitionService.count(new QueryWrapper<UserCompetition>().eq("competitionId", paymentCompetitionVo.getId())); |
| | | if ((competitionId+split.length)>competition.getApplicantsNumber()){ |
| | | return ResultUtil.error("报名人数超过最大限制"); |
| | | } |
| | |
| | | paymentCompetition.setAppUserId(null); |
| | | this.updateById(paymentCompetition); |
| | | |
| | | competition.setApplicantsNumber(competition.getApplicantsNumber() - 1); |
| | | // competition.setApplicantsNumber(competition.getApplicantsNumber() - 1); |
| | | competitionService.updateById(competition); |
| | | } |
| | | if(paymentCompetition.getPayType() == 3){//玩湃币支付 |
| | |
| | | paymentCompetition.setAppUserId(null); |
| | | this.updateById(paymentCompetition); |
| | | |
| | | competition.setApplicantsNumber(competition.getApplicantsNumber() - 1); |
| | | // competition.setApplicantsNumber(competition.getApplicantsNumber() - 1); |
| | | competitionService.updateById(competition); |
| | | } |
| | | if(paymentCompetition.getPayType() == 4){//课程支付 |
| | |
| | | paymentCompetition.setAppUserId(null); |
| | | this.updateById(paymentCompetition); |
| | | |
| | | competition.setApplicantsNumber(competition.getApplicantsNumber() - 1); |
| | | // competition.setApplicantsNumber(competition.getApplicantsNumber() - 1); |
| | | competitionService.updateById(competition); |
| | | } |
| | | return ResultUtil.success(); |
| | |
| | | <name>课程</name> |
| | | <description>课程</description> |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>com.github.pagehelper</groupId> |
| | | <artifactId>pagehelper</artifactId> |
| | | <version>5.2.1</version> |
| | | </dependency> |
| | | <!--日志处理--> |
| | | <dependency> |
| | | <groupId>cn.mb.cloud</groupId> |
| | |
| | | List<Integer> collect = byUserId.stream().map(TCoursePackagePayment::getCoursePackageId).collect(Collectors.toList()); |
| | | List<TCoursePackage> list = tcpService.list(new QueryWrapper<TCoursePackage>() |
| | | .in("id", collect)); |
| | | list.forEach(vo -> { |
| | | |
| | | byUserId.forEach(vo -> { |
| | | |
| | | StuSessionDetailsVo detVo = new StuSessionDetailsVo(); |
| | | if (vo.getType()!=2) { |
| | | detVo.setSessionid(vo.getId()); |
| | | detVo.setSessionName(vo.getName()); |
| | | String afterDayDate = DateUtil.getAfterDayDate2(vo.getInsertTime(), vo.getValidDays() + ""); |
| | | detVo.setPeriodOfValidity(afterDayDate); |
| | | detVo.setSessionid(vo.getCoursePackageId()); |
| | | TCoursePackage byId = coursePackageService.getById(vo.getCoursePackageId()); |
| | | detVo.setSessionName(byId.getName()); |
| | | // String afterDayDate = DateUtil.getAfterDayDate2(vo.getInsertTime(), vo.getValidDays() + ""); |
| | | |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | String format1 = simpleDateFormat.format(vo.getUseTime()); |
| | | detVo.setPeriodOfValidity(format1); |
| | | |
| | | detVo.setTotalNums(vo.getTotalClassHours()); |
| | | detVo.setDeductedNums(vo.getTotalClassHours()-vo.getLaveClassHours()); |
| | | detVo.setRemainingNums(vo.getLaveClassHours()); |
| | | |
| | | detailsVos.add(detVo); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | }); |
| | | |
| | | // list.forEach(vo -> { |
| | | // StuSessionDetailsVo detVo = new StuSessionDetailsVo(); |
| | | // if (vo.getType()!=2) { |
| | | // detVo.setSessionid(vo.getId()); |
| | | // detVo.setSessionName(vo.getName()); |
| | | // String afterDayDate = DateUtil.getAfterDayDate2(vo.getInsertTime(), vo.getValidDays() + ""); |
| | | // detVo.setPeriodOfValidity(afterDayDate); |
| | | // |
| | | // detVo.setTotalNums(ToolUtil.isEmpty(tCoursePackagePayment.getTotalCourseNums()) ? 0 : tCoursePackagePayment.getTotalCourseNums()); |
| | | // detVo.setDeductedNums(ToolUtil.isEmpty(tCoursePackagePayment.getDeductionNums()) ? 0 : tCoursePackagePayment.getDeductionNums()); |
| | | // detVo.setRemainingNums(ToolUtil.isEmpty(tCoursePackagePayment.getResidueNums())? 0 : tCoursePackagePayment.getResidueNums()); |
| | | // |
| | | // detailsVos.add(detVo); |
| | | // } |
| | | // }); |
| | | } |
| | | return detailsVos; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | @Autowired |
| | | private TOrderService orderService; |
| | | |
| | | |
| | | /** |
| | | * 已报名课程详情 |
| | |
| | | if(null == appUserId){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return ResultUtil.success(packagePaymentService.queryRegisteredCourseDetails(coursePayId,appUserId)); |
| | | CourseDetailsResponse courseDetailsResponse = packagePaymentService.queryRegisteredCourseDetails(coursePayId, appUserId,lon,lat); |
| | | |
| | | |
| | | if (orderId!=null){ |
| | | TOrder byId = orderService.getById(orderId); |
| | | courseDetailsResponse.setAmount(byId.getPrice()); |
| | | } |
| | | return ResultUtil.success(courseDetailsResponse); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | throw new RuntimeException(e.getMessage()); |
| | |
| | | .eq(CoursePackageScheduling::getCoursePackageId, tCoursePackage.getId()) |
| | | .like(CoursePackageScheduling::getClassDate, courseDetailReq.getTime()) |
| | | ); |
| | | if(list3.size()==0){ |
| | | if(list3.isEmpty()){ |
| | | detailsListVo.setType(2); |
| | | objects.add(detailsListVo); |
| | | continue; |
| | | } |
| | | //排课的ids |
| | | List<Long> collect2 = list3.stream().map(CoursePackageScheduling::getId).collect(Collectors.toList()); |
| | | if(collect2.size()==0){ |
| | | if(collect2.isEmpty()){ |
| | | collect2.add(-1l); |
| | | } |
| | | |
| | |
| | | |
| | | @ApiModelProperty(value = "课时有效期") |
| | | private String periodOfValidity; |
| | | @ApiModelProperty(value = "总学时数") |
| | | private Integer totalNums; |
| | | |
| | | @ApiModelProperty(value = "已扣学时数") |
| | | private Integer deductedNums; |
| | | |
| | | @ApiModelProperty(value = "剩余学时数") |
| | | private Integer remainingNums; |
| | | |
| | | } |
| | |
| | | private Integer chooseHours; |
| | | @ApiModelProperty("课时套餐") |
| | | private List<CoursePackagePaymentConfigVo> list; |
| | | |
| | | @ApiModelProperty("门店地址") |
| | | private String storeAddress; |
| | | @ApiModelProperty("门店名称") |
| | |
| | | * @param appUserId |
| | | * @return |
| | | */ |
| | | CourseDetailsResponse queryRegisteredCourseDetails(Long coursePayId, Integer appUserId); |
| | | CourseDetailsResponse queryRegisteredCourseDetails(Long coursePayId, Integer appUserId,String lon,String lat); |
| | | |
| | | |
| | | |
| | |
| | | // map.put("registered", count); |
| | | int count1 = coursePackageStudentService.count(new QueryWrapper<CoursePackageStudent>().eq("coursePackageSchedulingId", id).eq("reservationStatus", 1)); |
| | | int count2 = coursePackageStudentService.count(new QueryWrapper<CoursePackageStudent>().eq("coursePackageSchedulingId", id).eq("reservationStatus", 0)); |
| | | |
| | | |
| | | map.put("registered", count2); |
| | | map.put("actualArrival", count1); |
| | | map.put("nonArrival", count - count1); |
| | |
| | | if (tCoursePackageDiscounts.size() > 0) { |
| | | for (TCoursePackageDiscount tCoursePackageDiscount : tCoursePackageDiscounts) { |
| | | TCoursePackage coursePackage = tcpMapper.selectById(tCoursePackageDiscount.getCoursePackageId()); |
| | | if (coursePackage.getState()==2){ |
| | | continue; |
| | | } |
| | | // 判断预约人数是否已满 |
| | | // Integer maxSubscribeNumber = coursePackage.getMaxSubscribeNumber(); |
| | | // Integer integer = tcppMapper.selectCount(new QueryWrapper<TCoursePackagePayment>() |
| | |
| | | if (tCoursePackageDiscounts.size() > 0) { |
| | | for (TCoursePackageDiscount tCoursePackageDiscount : tCoursePackageDiscounts) { |
| | | TCoursePackage coursePackage = tcpMapper.selectById(tCoursePackageDiscount.getCoursePackageId()); |
| | | if (coursePackage.getState()==2){ |
| | | continue; |
| | | } |
| | | |
| | | // 判断预约人数是否已满 |
| | | Integer maxSubscribeNumber = coursePackage.getMaxSubscribeNumber(); |
| | | Integer integer = tcppMapper.selectCount(new QueryWrapper<TCoursePackagePayment>() |
| | |
| | | @Autowired |
| | | private TCoursePackageDiscountService coursePackageDiscountService; |
| | | |
| | | |
| | | @Resource StoreClient storeClient; |
| | | @Override |
| | | public CourseDetailsResponse queryRegisteredCourseDetails(Long coursePayId, Integer appUserId) { |
| | | public CourseDetailsResponse queryRegisteredCourseDetails(Long coursePayId, Integer appUserId,String lon,String lat) { |
| | | AppUser appUser = appuClient.queryAppUser(appUserId); |
| | | CourseDetailsResponse response = new CourseDetailsResponse(); |
| | | TCoursePackagePayment tCoursePackagePayment = this.baseMapper.selectById(coursePayId); |
| | |
| | | response.setTime(new SimpleDateFormat("yyyy.MM.dd").format(coursePackage.getStartTime()) + "-" + new SimpleDateFormat("yyyy.MM.dd").format(coursePackage.getEndTime())); |
| | | } |
| | | |
| | | // Store store = storeClient.queryStoreById(coursePackage.getStoreId()); |
| | | // response.setStoreName(store.getName()); |
| | | // response.setStoreCoverDrawing(store.getCoverDrawing()); |
| | | // response.setStoreAddress(store.getAddress()); |
| | | // response.setLon(store.getLon()); |
| | | // response.setLat(store.getLat()); |
| | | // 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(); |
| | | // response.setDistance(wgs84); |
| | | // } |
| | | Store store = storeClient.queryStoreById(coursePackage.getStoreId()); |
| | | response.setStoreName(store.getName()); |
| | | |
| | | 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(); |
| | | response.setDistance(wgs84); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | response.setCoursePackageId(tCoursePackagePayment.getCoursePackageId()); |
| | |
| | | |
| | | |
| | | }else { |
| | | if (coursePackagePaymentServiceOne.getPayStatus()==1){ |
| | | isContinue = 1; |
| | | |
| | | } |
| | | // coursePackagePaymentServiceOne.setClassHours(coursePackagePaymentServiceOne.getClassHours()+coursePackagePaymentConfig.getClassHours()); |
| | | // coursePackagePaymentServiceOne.setOriginalPrice(coursePackagePaymentServiceOne.getOriginalPrice()+paymentCourseVo.getPrice()); |
| | | // coursePackagePaymentServiceOne.setPlayPaiCoin(coursePackagePaymentServiceOne.getPlayPaiCoin()+paymentPrice.intValue()); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | //新的订单添加 |
| | | if (paymentCourseVo.getOrderId()==null) { |
| | | TOrder order = new TOrder(); |
| | | order.setIsPay(1); |
| | | order.setPayType(2); |
| | | order.setPayType(1); |
| | | order.setAppUserId(uid); |
| | | order.setPrice(paymentPrice); |
| | | order.setCode(code); |
| | |
| | | Thread.sleep(wait); |
| | | List<TCoursePackagePayment> list = coursePackagePaymentService.list(new QueryWrapper<TCoursePackagePayment>().eq("state", 1).eq("code", code).eq("payType", 2)); |
| | | TCoursePackagePayment one = list.get(0); |
| | | |
| | | List<TOrder> list1 = orderService.list(new QueryWrapper<TOrder>().eq("code", code).eq("payType", 1)); |
| | | TOrder order = list1.get(0); |
| | | |
| | | |
| | | AlipayTradeQueryResponse alipayTradeQueryResponse = payMoneyUtil.queryALIOrder(code); |
| | | if(one.getPayStatus() == 2){ |
| | | if(order.getIsPay() == 2){ |
| | | break; |
| | | } |
| | | |
| | | if( one.getPayStatus() == 1){ |
| | | if(order.getIsPay() == 1){ |
| | | /** |
| | | * WAIT_BUYER_PAY(交易创建,等待买家付款)、 |
| | | * TRADE_CLOSED(未付款交易超时关闭,或支付完成后全额退款)、 |
| | |
| | | } |
| | | |
| | | coursePackagePaymentService.updateBatchById(list); |
| | | |
| | | |
| | | for (TOrder tOrder : list1) { |
| | | tOrder.setIsPay(2); |
| | | tOrder.setOrderNum(tradeNo); |
| | | } |
| | | orderService.updateBatchById(list1); |
| | | |
| | | |
| | | |
| | | for (String s1 : split) { |
| | |
| | | userCouponClient.sendUserCoupon(new SendCouponReq(uid,coursePackagePaymentConfig.getCouponIds())); |
| | | |
| | | for (TCoursePackagePayment coursePackagePayment : list) { |
| | | addPackageStudent(paymentCourseVo.getId(),uid, finalSid,coursePackagePayment.getId(),paymentCourseVo.getPrice()); |
| | | addPackageStudent(paymentCourseVo.getId(),uid, finalSid,coursePackagePayment.getId(),paymentPrice); |
| | | } |
| | | |
| | | moneyOut(tradeNo,tradeNo); |
| | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String code = sdf.format(new Date()) + UUIDUtil.getNumberRandom(5); |
| | | |
| | | List<Long> pays = new ArrayList<>(); |
| | | |
| | | |
| | | TCoursePackage course = coursePackageService.getById(paymentCourseVo.getId()); |
| | | |
| | | |
| | |
| | | courseCounsumService.save(courseCounsum1); |
| | | } |
| | | |
| | | |
| | | pays.add(coursePackagePayment.getId()); |
| | | }else{ |
| | | coursePackagePaymentServiceOne.setClassHours(coursePackagePaymentServiceOne.getClassHours()+coursePackagePaymentConfig.getClassHours()+hour); |
| | | if (coursePackagePaymentServiceOne.getOriginalPrice()!=null) { |
| | |
| | | } |
| | | |
| | | |
| | | pays.add(coursePackagePaymentServiceOne.getId()); |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | if (paymentCourseVo.getOrderId()==null) { |
| | | TOrder order = new TOrder(); |
| | | order.setIsPay(1); |
| | | order.setPayType(2); |
| | | order.setAppUserId(appUser.getId()); |
| | | order.setPrice(paymentPrice); |
| | | order.setCode(code); |
| | | |
| | | String paysStr = pays.stream() |
| | | .map(String::valueOf) |
| | | .collect(Collectors.joining(",")); |
| | | order.setPaysId(paysStr); |
| | | |
| | | orderService.save(order); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | Integer playPaiCoins = appUser.getPlayPaiCoins(); |
| | | appUser.setPlayPaiCoins(playPaiCoins - paymentPrice.intValue()); |
| | | appUserClient.updateAppUser(appUser); |
| | |
| | | /** |
| | | * 零时任务 |
| | | */ |
| | | @Scheduled(cron = "0 0 0 * * *") |
| | | @Scheduled(cron = "0 0 23 * * *") |
| | | public void zeroTask(){ |
| | | //定时添加排课数据 |
| | | // coursePackageSchedulingService.taskAddData(); |
| | |
| | | ListQuery listQuery = new ListQuery(page.getSize(),page.getCurrent(),provinceCode,cityCode,eventName,time,state,registerCondition,ids); |
| | | Page<Competition> competitions = competitionClient.list(listQuery); |
| | | List<Competition> records = new ArrayList<>(); |
| | | for (Competition competition : competitions.getRecords()) { |
| | | // 当前时间小于开始时间 |
| | | if (competition.getStartTime().after(new Date())){ |
| | | competition.setStatus(1); |
| | | } |
| | | if (competition.getStartTime().before(new Date())){ |
| | | if (competition.getEndTime().after(new Date())){ |
| | | competition.setStatus(2); |
| | | }else{ |
| | | competition.setStatus(3); |
| | | } |
| | | } |
| | | if (competition.getStatus()!=state && state != null){ |
| | | }else{ |
| | | records.add(competition); |
| | | } |
| | | for (TStore tStore : list) { |
| | | String[] split = competition.getStoreId().split(","); |
| | | for (String s : split) { |
| | | if(s.equals(String.valueOf(tStore.getId()))){ |
| | | if (competition.getStoreName()==null){ |
| | | competition.setStoreName(tStore.getName()); |
| | | }else { |
| | | competition.setStoreName(competition.getStoreName()+","+tStore.getName()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // for (Competition competition : competitions.getRecords()) { |
| | | //// if (competition.getStatus()==4){ |
| | | //// continue; |
| | | //// } |
| | | // |
| | | // // 当前时间小于开始时间 |
| | | // if (competition.getStartTime().after(new Date())){ |
| | | // competition.setStatus(1); |
| | | // } |
| | | // if (competition.getStartTime().before(new Date())){ |
| | | // |
| | | // |
| | | // if (competition.getEndTime().after(new Date())){ |
| | | // competition.setStatus(2); |
| | | // }else{ |
| | | // competition.setStatus(3); |
| | | // } |
| | | // } |
| | | // if (competition.getStatus()!=state && state != null){ |
| | | // }else{ |
| | | // records.add(competition); |
| | | // } |
| | | // for (TStore tStore : list) { |
| | | // String[] split = competition.getStoreId().split(","); |
| | | // for (String s : split) { |
| | | // if(s.equals(String.valueOf(tStore.getId()))){ |
| | | // if (competition.getStoreName()==null){ |
| | | // competition.setStoreName(tStore.getName()); |
| | | // }else { |
| | | // competition.setStoreName(competition.getStoreName()+","+tStore.getName()); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | competitions.setRecords(records); |
| | | System.err.println(competitions.getRecords()); |
| | | return super.packForBT(competitions); |
| | |
| | | |
| | | |
| | | @RequestMapping(value = "/cancel") |
| | | public Object cancel(Integer id) { |
| | | public Object cancel(Integer TCompetitionId) { |
| | | try { |
| | | competitionClient.cancel(id); |
| | | competitionClient.cancel(TCompetitionId); |
| | | return SUCCESS_TIP; |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | confirmButtonText: language==1?"删除":(language==2?'Delete':'Hapus'), |
| | | closeOnConfirm: true |
| | | }, function () { |
| | | var ajax = new $ax(Feng.ctxPath + "/TCompetition/delete", function (data) { |
| | | var ajax = new $ax(Feng.ctxPath + "/tCompetition/cancel", function (data) { |
| | | if(language==1){ |
| | | swal("删除成功", "您已经成功删除了" + nickname + "。", "success"); |
| | | }else if(language==2){ |
| | |
| | | String[] split = siteBooking.getTimes().split(";"); |
| | | if(site!=null){ |
| | | if (queryMySiteVo.getIsHalf()==1) { |
| | | queryMySiteVo.setPlayPaiCoin(site.getPlayPaiCoin() * split.length); |
| | | }else { |
| | | queryMySiteVo.setPlayPaiCoin((int) (site.getPlayPaiCoinOne() * split.length)); |
| | | |
| | | }else { |
| | | queryMySiteVo.setPlayPaiCoin(site.getPlayPaiCoin() * split.length); |
| | | |
| | | } |
| | | } |
| | | } |