wenhongquan 1 год назад
Родитель
Сommit
a9109e362f

+ 6 - 1
ruoyi-modules/ruoyi-dzbc/src/main/java/org/dromara/system/controller/TblDzbcOrderController.java

@@ -102,7 +102,12 @@ public class TblDzbcOrderController extends BaseController {
     @RepeatSubmit()
     @PostMapping()
     public R add(@Validated(AddGroup.class) @RequestBody TblDzbcOrderBo bo) {
-        return R.ok(tblDzbcOrderService.insertByBo(bo));
+        try {
+            return R.ok(tblDzbcOrderService.insertByBo(bo));
+        } catch (Exception e) {
+            return R.fail(e.getMessage());
+        }
+
     }
 
     /**

+ 4 - 0
ruoyi-modules/ruoyi-dzbc/src/main/java/org/dromara/system/service/impl/TblDzbcOrderServiceImpl.java

@@ -2,6 +2,7 @@ package org.dromara.system.service.impl;
 
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.thread.ThreadUtil;
+import cn.hutool.core.util.StrUtil;
 import cn.hutool.cron.timingwheel.SystemTimer;
 import cn.hutool.cron.timingwheel.TimerTask;
 import cn.hutool.json.JSONObject;
@@ -116,6 +117,7 @@ public class TblDzbcOrderServiceImpl implements ITblDzbcOrderService {
         validEntityBeforeSave(add);
         Assert.isTrue(bo.getSchedulingId()!=null,"缺少路线班次");
         TblDzbcPathSchedulingVo scheduling = pathSchedulingMapper.selectVoById(bo.getSchedulingId());
+        Assert.isTrue(scheduling!=null,"路线未查询到排班");
         TblDzbcPathVo pathVo = pathMapper.selectVoById(scheduling.getPathId());
         //Ext1  { zw:2,usersInfos:[user1,{lx:'成人','name':'张三','cardNo':'1234567890','cardType':'身份证'}]  }
         Assert.isTrue(scheduling!=null,"路线排班不存在");
@@ -136,6 +138,8 @@ public class TblDzbcOrderServiceImpl implements ITblDzbcOrderService {
         //查询起点区域到目前区域的距离
         List<TblDzbcAreaVo> areas = areaMapper.selectVoBatchIds(List.of(startSite.getAreaId(),endSite.getAreaId()), TblDzbcAreaVo.class);
         Assert.isTrue(areas.size()==2,"站点信息错误");
+        Assert.isTrue(StrUtil.isNotEmpty(areas.get(0).getLocation()) ,areas.get(0).getName()+"区域未设置经纬度");
+        Assert.isTrue(StrUtil.isNotEmpty(areas.get(1).getLocation()),areas.get(1).getName()+"区域未设置经纬度");
         double distanceArea = DistanceCalculator.calculateDistance(areas.get(0).getLocation(),areas.get(1).getLocation());
         double distanceSite = DistanceCalculator.calculateDistance(startSite.getLocation(),endSite.getLocation());
         Assert.isTrue(pathVo.getPrice()!=null,"路线价格未设置");

+ 1 - 0
ruoyi-modules/ruoyi-dzbc/src/main/java/org/dromara/system/util/ScheduleCarUtil.java

@@ -26,6 +26,7 @@ public class ScheduleCarUtil {
         List<TblDzbcPathSchedulingVo> list = SpringUtils.getBean(ITblDzbcPathSchedulingService.class).queryList(bo);
         Map<Long, TblDzbcPathSchedulingVo> map = new HashMap<>();
         for (TblDzbcPathSchedulingVo vo : list) {
+            if(vo.getMdate()==null) continue;
             if(map.containsKey(vo.getPathId())){
                 TblDzbcPathSchedulingVo vo1 = map.get(vo.getPathId());
                 if(vo1.getMdate().getTime()<vo.getMdate().getTime()){