|
|
@@ -1,6 +1,8 @@
|
|
|
package org.dromara.system.service.impl;
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
+import cn.hutool.core.thread.ThreadUtil;
|
|
|
+import cn.hutool.json.JSONObject;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.github.binarywang.wxpay.bean.request.BaseWxPayRequest;
|
|
|
import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
|
|
|
@@ -15,8 +17,10 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.dromara.common.satoken.utils.LoginHelper;
|
|
|
import org.dromara.system.domain.TblDzbcOrderLog;
|
|
|
+import org.dromara.system.domain.TblDzbcPathScheduling;
|
|
|
import org.dromara.system.domain.TblDzbcSite;
|
|
|
import org.dromara.system.domain.bo.TblDzbcOrderLogBo;
|
|
|
+import org.dromara.system.domain.bo.TblDzbcPathSchedulingBo;
|
|
|
import org.dromara.system.domain.vo.*;
|
|
|
import org.dromara.system.mapper.*;
|
|
|
import org.dromara.util.DistanceCalculator;
|
|
|
@@ -26,6 +30,7 @@ import org.dromara.system.domain.TblDzbcOrder;
|
|
|
import org.dromara.system.service.ITblDzbcOrderService;
|
|
|
import org.springframework.util.Assert;
|
|
|
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Collection;
|
|
|
@@ -172,9 +177,73 @@ public class TblDzbcOrderServiceImpl implements ITblDzbcOrderService {
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
}
|
|
|
+ int c = baseMapper.updateById(update);
|
|
|
+ if(bo.getId()!=null && bo.getStatus()!=null){
|
|
|
+ //跟新路线站点信息
|
|
|
+ ThreadUtil.execAsync(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ //获取所有订单为2的订单
|
|
|
+ //先获取当前点的的路线ID
|
|
|
+ TblDzbcOrderVo entity = queryById(bo.getId());
|
|
|
+ if(entity!=null){
|
|
|
+ TblDzbcOrderBo bo1 = new TblDzbcOrderBo();
|
|
|
+ bo1.setSchedulingId(entity.getSchedulingId());
|
|
|
+ List<TblDzbcOrderVo> list = queryList(bo1);
|
|
|
+ //查出所有订单的startInfo和endInfo
|
|
|
+ //{"areaInfo": {"id": 1889580334985953281, "addr": "ss", "ext1": "{}", "ext2": "{}", "name": "松罗", "kyzId": 1889579208173600769, "remark": "nulla deserunt minim tempor", "location": "119.61157136502725,27.179696949640462"}, "siteInfo": {"id": 1889579608918376450, "addr": "是多少", "ext1": "{}", "ext2": "{}", "name": "万达公交站", "areaId": 1889580334985953281, "remark": "ut nulla sint", "location": "119.70444636953097,27.142621940313745"}}
|
|
|
|
|
|
+ Map<Long, Object> startSites = new HashMap<>();
|
|
|
+ Map<Long, Object> endSites = new HashMap<>();
|
|
|
|
|
|
- return baseMapper.updateById(update) > 0;
|
|
|
+
|
|
|
+
|
|
|
+ for (TblDzbcOrderVo tblDzbcOrderVo : list) {
|
|
|
+ Map<String,Object> startsite = new HashMap<>();
|
|
|
+ JSONObject siteJson = JSONUtil.parseObj(tblDzbcOrderVo.getStartInfo()).getJSONObject("siteInfo");
|
|
|
+ try {
|
|
|
+ if(startSites.get(siteJson.getLong("id"))!=null){
|
|
|
+ startsite = (Map<String, Object>) startSites.get(siteJson.getLong("id"));
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ }
|
|
|
+ startsite.put("siteInfo",siteJson);
|
|
|
+ startsite.put(StringUtils.format("order-{}", tblDzbcOrderVo.getId().toString()),tblDzbcOrderVo.getExt1());
|
|
|
+ startSites.put(siteJson.getLong("id"),startsite);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Map<String,Object> endsite = new HashMap<>();
|
|
|
+ JSONObject siteJson1 = JSONUtil.parseObj(tblDzbcOrderVo.getEndInfo()).getJSONObject("siteInfo");
|
|
|
+ try {
|
|
|
+ if(endSites.get(siteJson1.getLong("id"))!=null){
|
|
|
+ endsite = (Map<String, Object>) endSites.get(siteJson1.getLong("id"));
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ }
|
|
|
+ endsite.put("siteInfo",siteJson1);
|
|
|
+ endsite.put(StringUtils.format("order-{}", tblDzbcOrderVo.getId().toString()),tblDzbcOrderVo.getExt1());
|
|
|
+ endSites.put(siteJson1.getLong("id"),endsite);
|
|
|
+ }
|
|
|
+ //跟新路线
|
|
|
+ TblDzbcPathScheduling sbo1 = new TblDzbcPathScheduling();
|
|
|
+ sbo1.setId(entity.getSchedulingId());
|
|
|
+ sbo1.setStartSites(JSONUtil.toJsonStr(startSites));
|
|
|
+ sbo1.setEndSites(JSONUtil.toJsonStr(endSites));
|
|
|
+ pathSchedulingMapper.updateById(sbo1);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return c> 0;
|
|
|
}
|
|
|
|
|
|
|