From f9ce347bc1325ec05704b1213cdafdd9db8dd578 Mon Sep 17 00:00:00 2001 From: 44323 <443237572@qq.com> Date: 星期一, 29 一月 2024 11:25:01 +0800 Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/PlayPai --- cloud-server-other/src/main/java/com/dsh/other/model/TStoreOtherVo.java | 27 ++ cloud-server-account/src/main/java/com/dsh/account/util/GDMapGeocodingUtil.java | 3 cloud-server-course/pom.xml | 10 cloud-server-course/src/main/java/com/dsh/course/controller/CoursePackageController.java | 8 cloud-server-course/src/main/java/com/dsh/course/controller/CoursePackagePaymentController.java | 24 ++ cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java | 14 - cloud-server-course/src/main/java/com/dsh/course/service/impl/CoursePackageSchedulingServiceImpl.java | 136 +++++++++++ cloud-server-course/src/main/java/com/dsh/course/service/ICoursePackageSchedulingService.java | 6 cloud-server-course/src/main/java/com/dsh/course/controller/CourseStudentController.java | 11 + cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java | 13 - cloud-server-other/src/main/java/com/dsh/other/controller/StoreController.java | 39 +- cloud-server-other/src/main/java/com/dsh/other/controller/GameController.java | 105 +++++--- cloud-server-course/src/main/java/com/dsh/course/util/ALiSendSms.java | 128 +++++++++++ cloud-server-account/src/main/java/com/dsh/account/service/impl/TStudentServiceImpl.java | 14 - cloud-server-activity/src/main/java/com/dsh/activity/controller/UserCouponController.java | 40 +++ cloud-server-other/src/main/java/com/dsh/other/util/GDMapGeocodingUtil.java | 4 cloud-server-account/src/main/java/com/dsh/account/controller/ExploreWPController.java | 4 cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackagePaymentServiceImpl.java | 9 cloud-server-other/src/main/java/com/dsh/other/controller/UserController.java | 29 ++ cloud-server-activity/src/main/java/com/dsh/activity/util/GDMapGeocodingUtil.java | 3 20 files changed, 513 insertions(+), 114 deletions(-) diff --git a/cloud-server-account/src/main/java/com/dsh/account/controller/ExploreWPController.java b/cloud-server-account/src/main/java/com/dsh/account/controller/ExploreWPController.java index b421fad..3c38b0e 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/controller/ExploreWPController.java +++ b/cloud-server-account/src/main/java/com/dsh/account/controller/ExploreWPController.java @@ -117,11 +117,7 @@ @ApiImplicitParam(value = "搜索", name = "search", required = true, dataType = "string"), }) public ResultUtil<List<StoreDetailList>> getStoreListCon(Integer space, String cityCode, String latitude, String longitude, String search) { -// try { return ResultUtil.success(tsService.queryStoreList(space, cityCode, longitude, latitude, search)); -// }catch (Exception e){ -// return ResultUtil.runErr(); -// } } diff --git a/cloud-server-account/src/main/java/com/dsh/account/service/impl/TStudentServiceImpl.java b/cloud-server-account/src/main/java/com/dsh/account/service/impl/TStudentServiceImpl.java index 3f33b30..6fabab4 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/service/impl/TStudentServiceImpl.java +++ b/cloud-server-account/src/main/java/com/dsh/account/service/impl/TStudentServiceImpl.java @@ -742,30 +742,16 @@ citycodeResp.setLatitude(longitude); List<StoreDetailList> queryStoreList = storeClient.getQueryStoreList(citycodeResp); if (queryStoreList.size() > 0) { - if (ToolUtil.isEmpty(space) || space ==1) { queryStoreList = queryStoreList.stream().sorted(Comparator.comparing(o -> o.getStoreDistance())).collect(Collectors.toList()); - - } else { queryStoreList = queryStoreList.stream() .sorted(Comparator.comparing(StoreDetailList::getStoreDistance).reversed()) .collect(Collectors.toList()); } - - -// if (ToolUtil.isEmpty(space) || space == 2) { -// queryStoreList = queryStoreList.stream() -// .sorted(Comparator.comparing(StoreDetailList::getStoreDistance).reversed()) -// .collect(Collectors.toList()); -// -// } else { -// queryStoreList = queryStoreList.stream().sorted(Comparator.comparing(o -> o.getStoreDistance())).collect(Collectors.toList()); -// } if (ToolUtil.isNotEmpty(search)) { queryStoreList = queryStoreList.stream().filter(o -> o.getStoreName().contains(search)).collect(Collectors.toList()); } - } return queryStoreList; } diff --git a/cloud-server-account/src/main/java/com/dsh/account/util/GDMapGeocodingUtil.java b/cloud-server-account/src/main/java/com/dsh/account/util/GDMapGeocodingUtil.java index 6a83b16..bb40cb1 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/util/GDMapGeocodingUtil.java +++ b/cloud-server-account/src/main/java/com/dsh/account/util/GDMapGeocodingUtil.java @@ -121,7 +121,8 @@ String city = addressComponent.getString("city"); String district = addressComponent.getString("district"); if("[]".equals(code)){ - throw new Exception("经纬度转行政区划代码失败[" + lon + "," + lan + "]"); + System.err.println("经纬度转行政区划代码失败[" + lon + "," + lan + "]"); + return null; } map.put("province", province); map.put("provinceCode", code.substring(0, 2) + "0000"); diff --git a/cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java b/cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java index d46c314..a276027 100644 --- a/cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java +++ b/cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java @@ -297,12 +297,11 @@ List<IntegralCommodity> commodity = new ArrayList<>(); Map<String, String> geocode = gdMapGeocodingUtil.geocode(location.getLon(), location.getLat()); + if(null == geocode){ + return new ArrayList<>(); + } String provinceCode = geocode.get("provinceCode"); String cityCode = geocode.get("cityCode"); - - -// if(null != geocode) { - List<Store> stores = storeClient.queryStoreList(new QueryStoreList(provinceCode, cityCode)); Store s = null; Double d = 0D; @@ -314,14 +313,7 @@ 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()); -// } - List<PointsMerchandiseStore> storesids = pointsMerchandiseStoreService.list(new QueryWrapper<PointsMerchandiseStore>().eq("storeId", s.getId())); for (PointsMerchandiseStore storesid : storesids) { cIds.add(storesid.getPointsMerchandiseId()); diff --git a/cloud-server-activity/src/main/java/com/dsh/activity/controller/UserCouponController.java b/cloud-server-activity/src/main/java/com/dsh/activity/controller/UserCouponController.java index ed0fd9d..38aea5c 100644 --- a/cloud-server-activity/src/main/java/com/dsh/activity/controller/UserCouponController.java +++ b/cloud-server-activity/src/main/java/com/dsh/activity/controller/UserCouponController.java @@ -4,7 +4,11 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.dsh.activity.entity.Coupon; import com.dsh.activity.entity.CouponStore; +import com.dsh.activity.entity.TStudent; import com.dsh.activity.entity.UserCoupon; +import com.dsh.activity.feignclient.account.AppUserClient; +import com.dsh.activity.feignclient.account.StudentClient; +import com.dsh.activity.feignclient.account.model.AppUser; import com.dsh.activity.feignclient.model.CouponStuAvailableVo; import com.dsh.activity.feignclient.model.QueryUserCouponByIdAndUserId; import com.dsh.activity.model.CouponListVo; @@ -21,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; @@ -43,9 +48,16 @@ @Autowired private UserCouponService userCouponService; - @Autowired private CouponStoreService csServie; + + @Resource + private AppUserClient appUserClient; + + @Resource + private StudentClient studentClient; + + private final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM"); @@ -202,6 +214,28 @@ String couponIds = sendCouponReq.getCouponIds(); for (String s : couponIds.split(",")) { Coupon coupon = couponService.getById(s); + Integer userId = sendCouponReq.getUserId(); + if(coupon.getAuditStatus() != 2){ + continue; + } + if(coupon.getStatus() != 2){ + continue; + } + if(coupon.getState() != 1){ + continue; + } + if(coupon.getUserPopulation() == 2){ + AppUser appUser = appUserClient.queryAppUser(userId); + if(appUser.getIsVip() == 0){ + continue; + } + } + if(coupon.getUserPopulation() == 3){ + List<TStudent> tStudents = studentClient.queryStudentList(userId); + if(tStudents.size() == 0){ + continue; + } + } if (new Date().before(coupon.getStartTime()) && new Date().after(coupon.getEndTime())) { continue; } @@ -212,6 +246,10 @@ if (coupon.getQuantityIssued() <= counts) { continue; } + counts = userCouponService.count(new QueryWrapper<UserCoupon>().eq("couponId", s).eq("userId", userId)); + if (coupon.getPickUpQuantity() <= counts) { + continue; + } UserCoupon userCoupon = new UserCoupon(); userCoupon.setCouponId(Integer.valueOf(s)); diff --git a/cloud-server-activity/src/main/java/com/dsh/activity/util/GDMapGeocodingUtil.java b/cloud-server-activity/src/main/java/com/dsh/activity/util/GDMapGeocodingUtil.java index f424503..a53fcb2 100644 --- a/cloud-server-activity/src/main/java/com/dsh/activity/util/GDMapGeocodingUtil.java +++ b/cloud-server-activity/src/main/java/com/dsh/activity/util/GDMapGeocodingUtil.java @@ -113,7 +113,8 @@ String city = addressComponent.getString("city"); String district = addressComponent.getString("district"); if("[]".equals(code)){ - throw new Exception("经纬度转行政区划代码失败[" + lon + "," + lan + "]"); + System.err.println("经纬度转行政区划代码失败[" + lon + "," + lan + "]"); + return null; } map.put("province", province); map.put("provinceCode", code.substring(0, 2) + "0000"); diff --git a/cloud-server-course/pom.xml b/cloud-server-course/pom.xml index 00964b8..f84b131 100644 --- a/cloud-server-course/pom.xml +++ b/cloud-server-course/pom.xml @@ -137,6 +137,16 @@ <version>2.4</version> <classifier>jdk15</classifier> </dependency> + <dependency> + <groupId>com.aliyun</groupId> + <artifactId>aliyun-java-sdk-core</artifactId> + <version>4.4.3</version> + </dependency> + <dependency> + <groupId>com.aliyun.oss</groupId> + <artifactId>aliyun-sdk-oss</artifactId> + <version>3.8.0</version> + </dependency> </dependencies> <build> diff --git a/cloud-server-course/src/main/java/com/dsh/course/controller/CoursePackageController.java b/cloud-server-course/src/main/java/com/dsh/course/controller/CoursePackageController.java index f09ef4e..597b4f1 100644 --- a/cloud-server-course/src/main/java/com/dsh/course/controller/CoursePackageController.java +++ b/cloud-server-course/src/main/java/com/dsh/course/controller/CoursePackageController.java @@ -55,6 +55,9 @@ @Autowired private TokenUtil tokenUtil; + @Autowired + private ICoursePackageSchedulingService coursePackageSchedulingService; + /** * 根据门店ids获取课包ids 根据课包ids 获取购课记录的用户ids @@ -329,7 +332,12 @@ @ResponseBody @PostMapping("/coursePackage/updateCoursePackageById") public void updateCoursePackageById(@RequestBody TCoursePackage coursePackage) { + TCoursePackage coursePackage1 = coursePackageService.getById(coursePackage.getId()); coursePackageService.updateCoursePackageById(coursePackage); + //暂停课程后的开课操作(需要检查是否继续排课) + if(coursePackage1.getStatus() == 4 && coursePackage.getStatus() == 1){ + coursePackageSchedulingService.startAndScheduleClasses(coursePackage.getId()); + } } diff --git a/cloud-server-course/src/main/java/com/dsh/course/controller/CoursePackagePaymentController.java b/cloud-server-course/src/main/java/com/dsh/course/controller/CoursePackagePaymentController.java index 080d4d4..3908b88 100644 --- a/cloud-server-course/src/main/java/com/dsh/course/controller/CoursePackagePaymentController.java +++ b/cloud-server-course/src/main/java/com/dsh/course/controller/CoursePackagePaymentController.java @@ -138,6 +138,12 @@ @Autowired private ICoursePackageOrderStudentService coursePackageOrderStudentService; + @Autowired + private ALiSendSms aLiSendSms; + + @Resource + private AppUserClient appuClient; + /** * 查询学员入学时间 根据第一次购买课包的时间 @@ -1312,6 +1318,12 @@ TCoursePackage coursePackage = coursePackageService.getById(coursePackageOrderStudent.getCoursePackageId()); coursePackageOrderStudent.setLaveClassHours(coursePackageOrderStudent.getLaveClassHours() - paymentDeductionClassHour.getClassHour()); coursePackageOrderStudentService.updateById(coursePackageOrderStudent); + Integer laveClassHours = coursePackageOrderStudent.getLaveClassHours(); + if(3 >= laveClassHours){ + AppUser appUser = appuClient.queryAppUser(coursePackageOrderStudent.getAppUserId()); + //发送短信提醒 + aLiSendSms.sendSms(appUser.getPhone(), "SMS_463646317", ""); + } //判断剩余课时是否已经全部进行排课,如果排课需要删除已经排好的记录 List<CoursePackageScheduling> list1 = coursePackageSchedulingService.list(new QueryWrapper<CoursePackageScheduling>() .eq("studentId", coursePackageOrderStudent.getStudentId()).eq("status", 1) @@ -2379,6 +2391,13 @@ } coursePackageOrderStudent.setLaveClassHours(coursePackageOrderStudent.getLaveClassHours()-coursePackage.getNeedNum()); orderStudentService.updateById(coursePackageOrderStudent); + Integer laveClassHours = coursePackageOrderStudent.getLaveClassHours(); + if(3 >= laveClassHours){ + AppUser appUser = appuClient.queryAppUser(coursePackageOrderStudent.getAppUserId()); + //发送短信提醒 + aLiSendSms.sendSms(appUser.getPhone(), "SMS_463646317", ""); + } + CourseCounsum courseCounsum = new CourseCounsum(); courseCounsum.setPaymentId(coursePackageOrderStudent.getId()); courseCounsum.setChangeType(0); @@ -2595,6 +2614,7 @@ .eq(CoursePackageScheduling::getCoursePackageId, tCoursePackage.getId()) .like(CoursePackageScheduling::getClassDate, courseDetailReq.getTime()) ); + if (list3.isEmpty()) { detailsListVo.setType(2); objects.add(detailsListVo); @@ -2674,6 +2694,10 @@ objects.add(detailsListVo); } + //课程暂停 + if(tCoursePackage.getState() == 4){ + detailsListVo.setType(4); + } } map.put("data", objects); diff --git a/cloud-server-course/src/main/java/com/dsh/course/controller/CourseStudentController.java b/cloud-server-course/src/main/java/com/dsh/course/controller/CourseStudentController.java index 9c1760d..33021bf 100644 --- a/cloud-server-course/src/main/java/com/dsh/course/controller/CourseStudentController.java +++ b/cloud-server-course/src/main/java/com/dsh/course/controller/CourseStudentController.java @@ -10,11 +10,13 @@ import com.dsh.course.entity.dto.*; import com.dsh.course.feignclient.account.AppUserClient; import com.dsh.course.feignclient.account.StudentClient; +import com.dsh.course.feignclient.account.model.AppUser; import com.dsh.course.feignclient.account.model.Student; import com.dsh.course.mapper.CoursePackageSchedulingMapper; import com.dsh.course.mapper.CoursePackageStudentMapper; import com.dsh.course.model.dto.ToClassDto; import com.dsh.course.service.*; +import com.dsh.course.util.ALiSendSms; import com.dsh.course.util.ResultUtil; import com.dsh.course.util.UUIDUtil; import io.swagger.annotations.Api; @@ -171,6 +173,9 @@ @Resource private AppUserClient appUserClient; + + @Autowired + private ALiSendSms aLiSendSms; @Autowired @@ -821,6 +826,12 @@ coursePackageOrderStudent.setAppUserId(null); coursePackageOrderStudent.setLaveClassHours(coursePackageOrderStudent.getLaveClassHours()-toHoliDto.getClassNum()); orderStudentService.updateById(coursePackageOrderStudent); + Integer laveClassHours = coursePackageOrderStudent.getLaveClassHours(); + if(3 >= laveClassHours){ + AppUser appUser = appUserClient.queryAppUser(coursePackageOrderStudent.getAppUserId()); + //发送短信提醒 + aLiSendSms.sendSms(appUser.getPhone(), "SMS_463646317", ""); + } //上课星期 String classWeeks = coursePackage1.getClassWeeks(); diff --git a/cloud-server-course/src/main/java/com/dsh/course/service/ICoursePackageSchedulingService.java b/cloud-server-course/src/main/java/com/dsh/course/service/ICoursePackageSchedulingService.java index ff40d01..4d363cc 100644 --- a/cloud-server-course/src/main/java/com/dsh/course/service/ICoursePackageSchedulingService.java +++ b/cloud-server-course/src/main/java/com/dsh/course/service/ICoursePackageSchedulingService.java @@ -53,4 +53,10 @@ * 定时任务过期清零课时及排课数据 */ void taskOverdueClearing(); + + + /** + * 课程开课后检查排课 + */ + void startAndScheduleClasses(Integer coursePackageId); } diff --git a/cloud-server-course/src/main/java/com/dsh/course/service/impl/CoursePackageSchedulingServiceImpl.java b/cloud-server-course/src/main/java/com/dsh/course/service/impl/CoursePackageSchedulingServiceImpl.java index f3f89c2..2bd5d02 100644 --- a/cloud-server-course/src/main/java/com/dsh/course/service/impl/CoursePackageSchedulingServiceImpl.java +++ b/cloud-server-course/src/main/java/com/dsh/course/service/impl/CoursePackageSchedulingServiceImpl.java @@ -162,21 +162,19 @@ @Override public void taskCoursePackageScheduling() { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + List<TCoursePackage> list2 = coursePackageService.list(new QueryWrapper<TCoursePackage>().eq("status", 2).eq("auditStatus", 2) + .eq("state", 1).eq("type", 1)); + List<Integer> collect = list2.stream().map(TCoursePackage::getId).collect(Collectors.toList()); + if(collect.size() == 0){ + return; + } List<CoursePackageOrderStudent> list = coursePackageOrderStudentService.list(new QueryWrapper<CoursePackageOrderStudent>() .eq("status", 1) .eq("state", 1) .gt("useTime", "now()") .gt("laveClassHours", 0) + .in("coursePackageId", collect) ); - - List<CoursePackageOrder> list1 = coursePackageOrderService.list(new QueryWrapper<CoursePackageOrder>() - .eq("payStatus", 2) - .eq("status", 1) - .eq("state", 1) - .gt("laveClassHours", 0) - .orderByAsc("insertTime") - ); - for (CoursePackageOrderStudent coursePackageOrderStudent : list) { CoursePackageScheduling coursePackageScheduling = this.getOne(new QueryWrapper<CoursePackageScheduling>() .eq("appUserId", coursePackageOrderStudent.getAppUserId()) @@ -615,8 +613,128 @@ coursePackageOrderStudentService.updateBatchById(list); } } + } + /** + * 课程开课后检查排课 + */ + @Override + public void startAndScheduleClasses(Integer coursePackageId) { + List<CoursePackageOrderStudent> list = coursePackageOrderStudentService.list(new QueryWrapper<CoursePackageOrderStudent>() + .eq("status", 1) + .eq("state", 1) + .gt("useTime", "now()") + .gt("laveClassHours", 0) + .eq("coursePackageId", coursePackageId) + ); + for (CoursePackageOrderStudent coursePackageOrderStudent : list) { + CoursePackageScheduling coursePackageScheduling = this.getOne(new QueryWrapper<CoursePackageScheduling>() + .eq("appUserId", coursePackageOrderStudent.getAppUserId()) + .eq("studentId", coursePackageOrderStudent.getStudentId()) + .eq("coursePackageId", coursePackageOrderStudent.getCoursePackageId()) + .eq("status", 1) + .orderByDesc("classDate") + .last(" limit 0, 1") + ); + //当前时间小于最后一次排课时间则交由定时任务排课 + if(null != coursePackageScheduling && System.currentTimeMillis() <= coursePackageScheduling.getClassDate().getTime()){ + continue; + } + + //当前时间大于最后一次排课时间,表明已经断开了定时任务的排课逻辑,需要从第二天手动排课。后续的排课还是让定时任务排课 + Student student = studentClient.queryStudentById(coursePackageScheduling.getStudentId()); + Date validity = student.getValidity(); + TCoursePackage coursePackage = coursePackageService.getById(coursePackageScheduling.getCoursePackageId()); + //上课星期 + String classWeeks = coursePackage.getClassWeeks(); + List<Integer> week = week(classWeeks); + //新排课的开始日期 + Calendar start = Calendar.getInstance(); + start.setTime(new Date()); + start.set(Calendar.DAY_OF_YEAR, start.get(Calendar.DAY_OF_YEAR) + 1); + //需要排课的天数 + int day_week = start.get(Calendar.DAY_OF_WEEK); + day_week = day_week - 1 == 0 ? 7 : day_week - 1; + Integer num = 8 - day_week + 7; + + String classStartTime = coursePackage.getClassStartTime(); + String classEndTime = coursePackage.getClassEndTime(); + String[] split = classStartTime.split(","); + String[] split1 = classEndTime.split(","); + //有效期 + Date useTime = coursePackageOrderStudent.getUseTime(); + //剩余课时(需要扣除已排课但是还未上课的数据) + Integer laveClassHours = coursePackageOrderStudent.getLaveClassHours(); + int count = this.count(new QueryWrapper<CoursePackageScheduling>() + .eq("appUserId", coursePackageOrderStudent.getAppUserId()) + .eq("studentId", coursePackageOrderStudent.getStudentId()) + .eq("coursePackageId", coursePackageOrderStudent.getCoursePackageId()) + .eq("status", 1) + .eq("type", 1) + ); + Integer codeTime = coursePackage.getCodeTime(); + laveClassHours -= count; + //剩余数量不足以排课 + if (laveClassHours.compareTo(codeTime) < 0) { + break; + } + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + //生成一周的排课数据 + for (int i = 0; i < num; i++) { + String s = sdf.format(start.getTime()); + + //判断当天是否在排课星期内 + int day = start.get(Calendar.DAY_OF_WEEK); + day = day - 1 == 0 ? 7 : day - 1; + if (!week.contains(day)) { + start.set(Calendar.DAY_OF_YEAR, start.get(Calendar.DAY_OF_YEAR) + 1); + continue; + } + //大于有效期不进行排课 + if (start.getTimeInMillis() >= validity.getTime()) { + break; + } + for (int j = 0; j < split.length; j++) { + //剩余数量不足以排课 + if (laveClassHours.compareTo(codeTime) < 0) { + break; + } + //减少剩余课时数量 + laveClassHours -= codeTime; + //开始组装排课数据 + CoursePackageScheduling packageScheduling = new CoursePackageScheduling(); + packageScheduling.setType(1); + packageScheduling.setAppUserId(coursePackageOrderStudent.getAppUserId()); + packageScheduling.setStudentId(coursePackageOrderStudent.getStudentId()); + packageScheduling.setCoursePackageId(coursePackage.getId()); + try { + Date parse = format.parse(s + " " + split[j]); + Date parse1 = format.parse(s + " " + split1[j]); + packageScheduling.setClassDate(parse); + packageScheduling.setEndDate(parse1); + packageScheduling.setStatus(1); + this.save(packageScheduling); + + CoursePackageStudent student1 = new CoursePackageStudent(); + student1.setAppUserId(coursePackageOrderStudent.getAppUserId()); + student1.setStudentId(coursePackageOrderStudent.getStudentId()); + student1.setCoursePackageId(coursePackage.getId()); + student1.setCoursePackagePaymentId(coursePackageOrderStudent.getId()); + student1.setCoursePackageSchedulingId(packageScheduling.getId()); + student1.setSignInOrNot(1); + student1.setReservationStatus(1); + student1.setInsertTime(new Date()); + student1.setType(1); + coursePackageStudentMapper.insert(student1); + } catch (Exception e) { + e.printStackTrace(); + } + } + start.set(Calendar.DAY_OF_YEAR, start.get(Calendar.DAY_OF_YEAR) + 1); + } + } } } diff --git a/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackagePaymentServiceImpl.java b/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackagePaymentServiceImpl.java index ccbeb2c..21f0578 100644 --- a/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackagePaymentServiceImpl.java +++ b/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackagePaymentServiceImpl.java @@ -510,6 +510,9 @@ @Autowired private TCoursePackageService coursePackageService; + @Autowired + private ALiSendSms aLiSendSms; + @@ -1550,6 +1553,12 @@ coursePackageOrderStudent.setLaveClassHours(coursePackageOrderStudent.getLaveClassHours() - req.getNum()); coursePackageOrderStudentService.updateById(coursePackageOrderStudent); + Integer laveClassHours = coursePackageOrderStudent.getLaveClassHours(); + if(3 >= laveClassHours){ + AppUser appUser = appuClient.queryAppUser(coursePackageOrderStudent.getAppUserId()); + //发送短信提醒 + aLiSendSms.sendSms(appUser.getPhone(), "SMS_463646317", ""); + } CourseCounsum courseCounsum = new CourseCounsum(); diff --git a/cloud-server-course/src/main/java/com/dsh/course/util/ALiSendSms.java b/cloud-server-course/src/main/java/com/dsh/course/util/ALiSendSms.java new file mode 100644 index 0000000..a9023a9 --- /dev/null +++ b/cloud-server-course/src/main/java/com/dsh/course/util/ALiSendSms.java @@ -0,0 +1,128 @@ +package com.dsh.course.util; + + +import com.aliyuncs.CommonRequest; +import com.aliyuncs.CommonResponse; +import com.aliyuncs.DefaultAcsClient; +import com.aliyuncs.IAcsClient; +import com.aliyuncs.exceptions.ClientException; +import com.aliyuncs.profile.DefaultProfile; +import com.google.gson.Gson; +import org.springframework.stereotype.Component; + +import java.util.Map; + +/** + * 阿里云短信工具类 + */ +@Component +public class ALiSendSms { + + // 设置鉴权参数,初始化客户端 + private DefaultProfile profile = DefaultProfile.getProfile( + "cn-hangzhou",// 地域ID + "LTAI5tSWQMMn9HNU9Zatoe1T",// 您的AccessKey ID + "kSOsRakIMPbvTlgXU19pYfbwmBXBA4");// 您的AccessKey Secret + private IAcsClient client = new DefaultAcsClient(profile); + + private static void log_print(String functionName, Object result) { + Gson gson = new Gson(); + System.out.println("-------------------------------" + functionName + "-------------------------------"); + System.out.println(gson.toJson(result)); + } + + /** + * 添加短信模板 + */ + public String addSmsTemplate() throws ClientException { + CommonRequest addSmsTemplateRequest = new CommonRequest(); + addSmsTemplateRequest.setSysDomain("dysmsapi.aliyuncs.com"); + addSmsTemplateRequest.setSysAction("AddSmsTemplate"); + addSmsTemplateRequest.setSysVersion("2017-05-25"); + // 短信类型。0:验证码;1:短信通知;2:推广短信;3:国际/港澳台消息 + addSmsTemplateRequest.putQueryParameter("TemplateType", "0"); + // 模板名称,长度为1~30个字符 + addSmsTemplateRequest.putQueryParameter("TemplateName", "测试短信模板"); + // 模板内容,长度为1~500个字符 + addSmsTemplateRequest.putQueryParameter("TemplateContent", "您正在申请手机注册,验证码为:${code},5分钟内有效!"); + // 短信模板申请说明 + addSmsTemplateRequest.putQueryParameter("Remark", "测试"); + CommonResponse addSmsTemplateResponse = client.getCommonResponse(addSmsTemplateRequest); + String data = addSmsTemplateResponse.getData(); + // 消除返回文本中的反转义字符 + String sData = data.replaceAll("'\'", ""); + log_print("addSmsTemplate", sData); + Gson gson = new Gson(); + // 将字符串转换为Map类型,取TemplateCode字段值 + Map map = gson.fromJson(sData, Map.class); + Object templateCode = map.get("TemplateCode"); + return templateCode.toString(); + } + + /** + * 发送短信 + */ + public String sendSms(String phone, String templateCode, String json) { + try { + CommonRequest request = new CommonRequest(); + request.setSysDomain("dysmsapi.aliyuncs.com"); + request.setSysVersion("2017-05-25"); + request.setSysAction("SendSms"); + // 接收短信的手机号码 + request.putQueryParameter("PhoneNumbers", phone); + // 短信签名名称。请在控制台签名管理页面签名名称一列查看(必须是已添加、并通过审核的短信签名)。 + request.putQueryParameter("SignName", "玩湃"); + // 短信模板ID + request.putQueryParameter("TemplateCode", templateCode); + // 短信模板变量对应的实际值,JSON格式。 + request.putQueryParameter("TemplateParam", json); + CommonResponse commonResponse = client.getCommonResponse(request); + String data = commonResponse.getData(); + String sData = data.replaceAll("'\'", ""); + log_print("sendSms", sData); + return sData; + }catch (Exception e){ + e.printStackTrace(); + } + return null; + } + + /** + * 查询发送详情 + */ + private void querySendDetails(String bizId) throws ClientException { + CommonRequest request = new CommonRequest(); + request.setSysDomain("dysmsapi.aliyuncs.com"); + request.setSysVersion("2017-05-25"); + request.setSysAction("QuerySendDetails"); + // 接收短信的手机号码 + request.putQueryParameter("PhoneNumber", "156xxxxxxxx"); + // 短信发送日期,支持查询最近30天的记录。格式为yyyyMMdd,例如20191010。 + request.putQueryParameter("SendDate", "20191010"); + // 分页记录数量 + request.putQueryParameter("PageSize", "10"); + // 分页当前页码 + request.putQueryParameter("CurrentPage", "1"); + // 发送回执ID,即发送流水号。 + request.putQueryParameter("BizId", bizId); + CommonResponse response = client.getCommonResponse(request); + log_print("querySendDetails", response.getData()); + } + +// public static void main(String[] args) { +// ALiSendSms sendSmsDemo = new ALiSendSms(); +// try { +// // 创建短信模板 +// String templateCode = sendSmsDemo.addSmsTemplate(); +// // 使用刚创建的短信模板发送短信 +// String sData = sendSmsDemo.sendSms("156xxxxxxxx", templateCode, "{\"code\":\"8888\"}"); +// Gson gson = new Gson(); +// Map map = gson.fromJson(sData, Map.class); +// String bizId = map.get("BizId").toString(); +// // 根据短信发送流水号查询短信发送情况 +// sendSmsDemo.querySendDetails(bizId); +// } catch (ClientException e) { +// e.printStackTrace(); +// } +// } +} diff --git a/cloud-server-other/src/main/java/com/dsh/other/controller/GameController.java b/cloud-server-other/src/main/java/com/dsh/other/controller/GameController.java index c14da34..3d31715 100644 --- a/cloud-server-other/src/main/java/com/dsh/other/controller/GameController.java +++ b/cloud-server-other/src/main/java/com/dsh/other/controller/GameController.java @@ -10,13 +10,13 @@ import com.dsh.other.feignclient.account.AppUserClient; import com.dsh.other.feignclient.account.model.AppUser; import com.dsh.other.model.QueryMySiteVo; +import com.dsh.other.model.User; import com.dsh.other.service.*; import com.dsh.other.util.*; import com.dsh.other.util.httpClinet.HttpResult; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; -import net.bytebuddy.asm.Advice; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -46,7 +46,7 @@ @Autowired private TokenUtil tokenUtil; - @Autowired + @Resource private AppUserClient appUserClient; @Autowired @@ -54,6 +54,12 @@ @Resource private CourseRecordClient courseRecordClient; + + @Autowired + private IUserService userService; + + @Autowired + private ISiteBookingService siteBookingService; @ResponseBody @@ -108,9 +114,7 @@ List<TGame> list = gameService.list(new LambdaQueryWrapper<TGame>().eq(TGame::getSiteId, siteId).eq(TGame::getStoreId, storeId).eq(TGame::getState, 0)); if (list.size() > 0) { Integer id = list.get(0).getId(); -// tGameConfigs = gameConfigService.list(new LambdaQueryWrapper<TGameConfig>().eq(TGameConfig::getOtherId, id)); tGameConfigs = gameConfigService.listJs(id); - } List<TGameConfig> filteredList = tGameConfigs.stream() .filter(gameConfig -> !gameConfig.getImg().isEmpty()) @@ -121,9 +125,50 @@ return ResultUtil.runErr(); } } - private String smid = "2088330203191220";//平台支付宝商户号 - @Autowired - private ISiteService siteService; + + + @ResponseBody + @PostMapping("/gameStartupCheck") + @ApiOperation(value = "扫码启动游戏前的校验(0=不通过,1=通过)", tags = {"用户—游戏"}) + @ApiImplicitParams({ + @ApiImplicitParam(value = "三方游戏id", name = "gameId", dataType = "int", required = true), + @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), + }) + public ResultUtil<Integer> gameStartupCheck(Integer gameId){ + try { + Integer uid = tokenUtil.getUserIdFormRedis(); + if (null == uid) { + return ResultUtil.tokenErr(); + } + //判断当前用户是否是员工 + AppUser appUser1 = appUserClient.queryAppUser(uid); + User one = userService.getOne(new QueryWrapper<User>().eq("phone", appUser1.getPhone()).eq("status", 1)); + if (null != one) { + return ResultUtil.success(1); + } + //普通用户校验当前时间是否在预约时间段内 + TGame game = gameService.getById(gameId); + Integer siteId = game.getSiteId(); + SiteBooking siteBooking = siteBookingService.getOne(new QueryWrapper<SiteBooking>() + .eq("state", 1) + .in("status", Arrays.asList(1, 2)) + .eq("appUserId", uid) + .eq("siteId", siteId) + .last(" and now() between startTime and endTime") + ); + return ResultUtil.success(null == siteBooking ? 0 : 1); + }catch (Exception e){ + e.printStackTrace(); + return ResultUtil.runErr(); + } + } + + + + + + + @ResponseBody @PostMapping("/payGame") @ApiOperation(value = "支付游戏", tags = {"用户—游戏"}) @@ -141,6 +186,13 @@ if (null == uid) { return ResultUtil.tokenErr(); } + //判断当前用户是否是员工 + AppUser appUser1 = appUserClient.queryAppUser(uid); + User one = userService.getOne(new QueryWrapper<User>().eq("phone", appUser1.getPhone()).eq("status", 1)); + if (null != one) { + Integer integer = startGame(uid, gameId, spaceId, sutuId); + return ResultUtil.success(); + } SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); String code = sdf.format(new Date()) + UUIDUtil.getNumberRandom(5); TGameConfig config = gameConfigService.getById(configId); @@ -151,6 +203,7 @@ tGameRecord.setNumber(code); tGameRecord.setTime(new Date()); gameRecordService.save(tGameRecord); + if (type == 1) { ResultUtil weixinpay = payMoneyUtil.weixinpay("游戏支付", "", code, config.getCash().toString(), "/base/course/weChatPaymentCourseCallback", "APP", ""); if (weixinpay.getCode() == 200) { @@ -210,22 +263,8 @@ } return weixinpay; } else if (type == 2) { -// Integer gameId, Integer configId,Integer type,Integer sutuId,Integer spaceId; - String smid1=""; - String params = uid + "_" + gameId + "_" + spaceId + "_" + sutuId+"_"+code+"_"+configId; - // 判断这个课包属于哪个门店 属于哪个运营商 根据运营商 id 获取对应的商户号 - TGame game = gameService.getById(gameId); - - Integer operationId = game.getOperationId(); - if (operationId==0){ - // 是平台的 - smid1 = smid; - }else{ - String smidByOperatorId = siteService.getSMIDByOperatorId(operationId); - smid1 = smidByOperatorId; - } - - ResultUtil alipay = payMoneyUtil.alipay(smid1,"游戏支付", "游戏支付", params, code, config.getCash().toString(), "/base/site/gameCallback"); + String params = uid + "_" + gameId + "_" + spaceId + "_" + sutuId + "_" + code + "_" + configId; + ResultUtil alipay = payMoneyUtil.alipay("游戏支付", "游戏支付", params, code, config.getCash().toString(), "/base/site/gameCallback"); if (alipay.getCode() == 200) { new Thread(new Runnable() { @Override @@ -250,9 +289,6 @@ * TRADE_SUCCESS(交易支付成功)、 * TRADE_FINISHED(交易结束,不可退款) */ -// Map<String, String> data1 = resultUtil.getData(); -// String s = data1.get("tradeStatus"); -// String tradeNo = data1.get("tradeNo"); String tradeNo = resultUtil.getTradeNo(); String s = resultUtil.getTradeStatus(); if ("TRADE_CLOSED".equals(s) || "TRADE_FINISHED".equals(s) || num == 10) { @@ -263,28 +299,17 @@ coursePackagePayment.setStatus(1); coursePackagePayment.setMoney(config.getCash()); coursePackagePayment.setOrderNo(tradeNo); + CourseCounsum courseCounsum = new CourseCounsum(); -// courseCounsum.setPaymentId(paymentId); courseCounsum.setChangeType(3); courseCounsum.setInsertTime(new Date()); courseCounsum.setReason("智慧球场;" + config.getCash()); courseCounsum.setAppUserId(uid); courseRecordClient.save(courseCounsum); + } gameRecordService.updateBatchById(list); Integer integer = startGame(uid, gameId, spaceId, sutuId); - // 判断这个课包属于哪个门店 属于哪个运营商 根据运营商 id 获取对应的商户号 - TGame game = gameService.getById(gameId); - String smid2=""; - Integer operationId = game.getOperationId(); - if (operationId==0){ - // 是平台的 - smid2 = smid; - }else{ - String smidByOperatorId = siteService.getSMIDByOperatorId(operationId); - smid2 = smidByOperatorId; - } - payMoneyUtil.confirm(smid2,code,tradeNo,config.getCash().toString()); break; } if ("WAIT_BUYER_PAY".equals(s)) { @@ -336,8 +361,6 @@ e.printStackTrace(); return ResultUtil.runErr(); } - - } diff --git a/cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java b/cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java index 9180575..b17ef77 100644 --- a/cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java +++ b/cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java @@ -405,14 +405,6 @@ 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)); @@ -424,18 +416,13 @@ 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(); diff --git a/cloud-server-other/src/main/java/com/dsh/other/controller/StoreController.java b/cloud-server-other/src/main/java/com/dsh/other/controller/StoreController.java index a5649bd..38e3a64 100644 --- a/cloud-server-other/src/main/java/com/dsh/other/controller/StoreController.java +++ b/cloud-server-other/src/main/java/com/dsh/other/controller/StoreController.java @@ -12,14 +12,17 @@ import com.dsh.other.util.GeodesyUtil; import com.dsh.other.util.ResultUtil; import com.dsh.other.util.ToolUtil; +import com.sun.javafx.binding.StringFormatter; 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.web.bind.annotation.*; import java.math.BigDecimal; import java.math.RoundingMode; +import java.text.DecimalFormat; import java.util.*; import java.util.stream.Collectors; @@ -202,37 +205,29 @@ if (citycodeResp.getCityCode() == null) { Map<String, String> geocode = gdMapGeocodingUtil.geocode(citycodeResp.getLongitude(), citycodeResp.getLatitude()); - String provinceCode = geocode.get("provinceCode"); - String cityCode = geocode.get("cityCode"); - citycodeResp.setCityCode(cityCode); + if(null != geocode){ + String cityCode = geocode.get("cityCode"); + citycodeResp.setCityCode(cityCode); + } } List<Store> list = storeService.list(new QueryWrapper<Store>() .eq("state", 1) .eq("cityCode", citycodeResp.getCityCode())); if (list.size() > 0) { -// if (ToolUtil.isEmpty(citycodeResp.getLongitude()) && ToolUtil.isEmpty(citycodeResp.getLatitude())){ -// return detailLists; -// } for (Store store : list) { String current = citycodeResp.getLongitude() + "," + citycodeResp.getLatitude(); String result = store.getLon() + "," + store.getLat(); - String distanceTOKilometer = gdMapGeocodingUtil.getDistanceTOKilometer(current, result); -// long l = Long.parseLong(distanceTOKilometer); -//// 取5公里范围内的门店 -// if ( l > 5){ -// continue; -// } + Map<String, Double> distance = GeodesyUtil.getDistance(current, result); StoreDetailList detailList = new StoreDetailList(); detailList.setStoreId(store.getId()); detailList.setStoreImg(store.getCoverDrawing()); detailList.setStoreName(store.getName()); detailList.setStoreAddress(store.getAddress()); detailList.setStorePhone(store.getPhone()); -// detailList.setStoreDistance(l); detailList.setStoreTime(store.getStartTime() + "-" + store.getEndTime()); detailList.setStoreInfo(store.getIntroduce()); - detailList.setStoreDistance(Double.valueOf(distanceTOKilometer)); + detailList.setStoreDistance(null != distance ? Double.valueOf(String.format("%.2f", distance.get("WGS84") / 1000)) : 0D); detailLists.add(detailList); } } @@ -422,7 +417,7 @@ @ApiImplicitParams({ @ApiImplicitParam(value = "门店id", name = "id", dataType = "int", required = true), }) - public ResultUtil<List<TStoreOtherConfigTrue>> queryIndexSet(Integer id) { + public ResultUtil<List<TStoreOtherVo>> queryIndexSet(Integer id) { try { List<TStoreOtherConfigTrue> tStoreOtherConfigTrues = new ArrayList<>(); @@ -430,14 +425,20 @@ if (list.size() > 0) { tStoreOtherConfigTrues = tStoreOtherConfigTrueService.list(new LambdaQueryWrapper<TStoreOtherConfigTrue>().in(TStoreOtherConfigTrue::getPid, list.stream().map(TStoreOther::getId).collect(Collectors.toList())).eq(TStoreOtherConfigTrue::getState, 1)); } - for (TStoreOtherConfigTrue tStoreOtherConfigTrue : tStoreOtherConfigTrues) { - for (TStoreOther tStoreOther : list) { + List<TStoreOtherVo> list1 = new ArrayList<>(); + for (TStoreOther tStoreOther : list) { + TStoreOtherVo storeOtherVo = new TStoreOtherVo(); + BeanUtils.copyProperties(tStoreOther, storeOtherVo); + List<TStoreOtherConfigTrue> lists = new ArrayList<>(); + for (TStoreOtherConfigTrue tStoreOtherConfigTrue : tStoreOtherConfigTrues) { if (tStoreOtherConfigTrue.getPid() == tStoreOther.getId()) { - tStoreOtherConfigTrue.setSort(tStoreOther.getSort()); + lists.add(tStoreOtherConfigTrue); } } + storeOtherVo.setList(lists); + list1.add(storeOtherVo); } - return ResultUtil.success(tStoreOtherConfigTrues); + return ResultUtil.success(list1); } catch (Exception e) { e.printStackTrace(); return ResultUtil.runErr(); diff --git a/cloud-server-other/src/main/java/com/dsh/other/controller/UserController.java b/cloud-server-other/src/main/java/com/dsh/other/controller/UserController.java new file mode 100644 index 0000000..fa013de --- /dev/null +++ b/cloud-server-other/src/main/java/com/dsh/other/controller/UserController.java @@ -0,0 +1,29 @@ +package com.dsh.other.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.dsh.other.model.User; +import com.dsh.other.service.IUserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author zhibing.pu + * @Date 2023/12/14 16:25 + */ +@RestController +@RequestMapping("") +public class UserController { + + @Autowired + private IUserService userService; + + + + @PostMapping("/user/getUserByPhone") + public User getUserByPhone(@RequestBody String phone){ + return userService.getOne(new QueryWrapper<User>().eq("phone", phone).eq("status", 1)); + } +} diff --git a/cloud-server-other/src/main/java/com/dsh/other/model/TStoreOtherVo.java b/cloud-server-other/src/main/java/com/dsh/other/model/TStoreOtherVo.java new file mode 100644 index 0000000..a6515c9 --- /dev/null +++ b/cloud-server-other/src/main/java/com/dsh/other/model/TStoreOtherVo.java @@ -0,0 +1,27 @@ +package com.dsh.other.model; + +import com.dsh.other.entity.TStoreOtherConfigTrue; +import lombok.Data; + +import java.util.List; + +/** + * @author zhibing.pu + * @Date 2023/12/15 18:32 + */ +@Data +public class TStoreOtherVo { + private Integer id; + + private String name; + + private Integer storeId; + + private Integer sort; + /** + * 1开启 2关闭 + */ + private Integer state; + + private List<TStoreOtherConfigTrue> list; +} diff --git a/cloud-server-other/src/main/java/com/dsh/other/util/GDMapGeocodingUtil.java b/cloud-server-other/src/main/java/com/dsh/other/util/GDMapGeocodingUtil.java index 400f97e..3611668 100644 --- a/cloud-server-other/src/main/java/com/dsh/other/util/GDMapGeocodingUtil.java +++ b/cloud-server-other/src/main/java/com/dsh/other/util/GDMapGeocodingUtil.java @@ -121,6 +121,10 @@ String province = addressComponent.getString("province"); String city = addressComponent.getString("city"); String district = addressComponent.getString("district"); + if("[]".equals(code)){ + System.err.println("经纬度转行政区划代码失败[" + lon + "," + lan + "]"); + return null; + } map.put("province", province); map.put("provinceCode", code.substring(0, 2) + "0000"); map.put("city", city); -- Gitblit v1.7.1