Commit ceb1e84eb95a5d527cf7bbe43febb8e85f71ad3e
1 parent
b548022e
调整04-02
Showing
3 changed files
with
85 additions
and
8 deletions
trash-garbage/src/main/java/com/trash/garbage/service/impl/GarOrderAssociationServiceAsync.java
| @@ -102,7 +102,8 @@ public class GarOrderAssociationServiceAsync { | @@ -102,7 +102,8 @@ public class GarOrderAssociationServiceAsync { | ||
| 102 | List<double[]> coordinates = parseCoordinates(coord); | 102 | List<double[]> coordinates = parseCoordinates(coord); |
| 103 | 103 | ||
| 104 | 104 | ||
| 105 | - coordinates = com.trash.garbage.utils.DistanceUtil.expansion(coordinates, 200); | 105 | + // 处置场所电子围栏外扩距离(单位:米) |
| 106 | + coordinates = com.trash.garbage.utils.DistanceUtil.expansion(coordinates, 800); | ||
| 106 | // 判断是否在多边形内 | 107 | // 判断是否在多边形内 |
| 107 | boolean isInside = isPointInPolygon(vehicleLat, vehicleLon, coordinates); | 108 | boolean isInside = isPointInPolygon(vehicleLat, vehicleLon, coordinates); |
| 108 | if (isInside) { | 109 | if (isInside) { |
trash-garbage/src/main/java/com/trash/garbage/service/impl/GarOrderMatchAskServiceImpl.java
| @@ -2,17 +2,25 @@ package com.trash.garbage.service.impl; | @@ -2,17 +2,25 @@ package com.trash.garbage.service.impl; | ||
| 2 | 2 | ||
| 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| 4 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 4 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| 5 | +import com.trash.dropPointInfo.domain.DropPointInfo; | ||
| 6 | +import com.trash.dropPointInfo.service.IDropPointInfoService; | ||
| 5 | import com.trash.garbage.mapper.GarOrderMapper; | 7 | import com.trash.garbage.mapper.GarOrderMapper; |
| 6 | import com.trash.garbage.mapper.GarOrderMatchAskMapper; | 8 | import com.trash.garbage.mapper.GarOrderMatchAskMapper; |
| 7 | import com.trash.garbage.pojo.domain.DriverSend; | 9 | import com.trash.garbage.pojo.domain.DriverSend; |
| 10 | +import com.trash.garbage.pojo.domain.GarOrder; | ||
| 8 | import com.trash.garbage.pojo.domain.GarOrderMatchAsk; | 11 | import com.trash.garbage.pojo.domain.GarOrderMatchAsk; |
| 9 | import com.trash.garbage.pojo.vo.OrderDetailTransportVo; | 12 | import com.trash.garbage.pojo.vo.OrderDetailTransportVo; |
| 10 | import com.trash.garbage.service.GarOrderMatchAskService; | 13 | import com.trash.garbage.service.GarOrderMatchAskService; |
| 11 | import org.apache.ibatis.annotations.Param; | 14 | import org.apache.ibatis.annotations.Param; |
| 15 | +import org.apache.commons.collections4.CollectionUtils; | ||
| 16 | +import org.apache.commons.lang3.StringUtils; | ||
| 12 | import org.springframework.beans.factory.annotation.Autowired; | 17 | import org.springframework.beans.factory.annotation.Autowired; |
| 13 | import org.springframework.stereotype.Service; | 18 | import org.springframework.stereotype.Service; |
| 14 | 19 | ||
| 20 | +import java.util.HashMap; | ||
| 15 | import java.util.List; | 21 | import java.util.List; |
| 22 | +import java.util.Map; | ||
| 23 | +import java.util.Objects; | ||
| 16 | 24 | ||
| 17 | /** | 25 | /** |
| 18 | * @author 20412 | 26 | * @author 20412 |
| @@ -27,6 +35,8 @@ public class GarOrderMatchAskServiceImpl extends ServiceImpl<GarOrderMatchAskMap | @@ -27,6 +35,8 @@ public class GarOrderMatchAskServiceImpl extends ServiceImpl<GarOrderMatchAskMap | ||
| 27 | GarOrderMatchAskMapper garOrderMatchAskMapper; | 35 | GarOrderMatchAskMapper garOrderMatchAskMapper; |
| 28 | @Autowired | 36 | @Autowired |
| 29 | private GarOrderMapper garOrderMapper; | 37 | private GarOrderMapper garOrderMapper; |
| 38 | + @Autowired | ||
| 39 | + private IDropPointInfoService dropPointInfoService; | ||
| 30 | 40 | ||
| 31 | 41 | ||
| 32 | @Override | 42 | @Override |
| @@ -42,12 +52,9 @@ public class GarOrderMatchAskServiceImpl extends ServiceImpl<GarOrderMatchAskMap | @@ -42,12 +52,9 @@ public class GarOrderMatchAskServiceImpl extends ServiceImpl<GarOrderMatchAskMap | ||
| 42 | */ | 52 | */ |
| 43 | @Override | 53 | @Override |
| 44 | public GarOrderMatchAsk selectGarOrderMatchAskById(String garId) | 54 | public GarOrderMatchAsk selectGarOrderMatchAskById(String garId) |
| 45 | - { | ||
| 46 | - | ||
| 47 | - | 55 | + { |
| 48 | GarOrderMatchAsk ask = garOrderMatchAskMapper.selectGarOrderMatchAskById(garId); | 56 | GarOrderMatchAsk ask = garOrderMatchAskMapper.selectGarOrderMatchAskById(garId); |
| 49 | - | ||
| 50 | - | 57 | + fillDropPointInfoIfMissing(ask, null); |
| 51 | return ask; | 58 | return ask; |
| 52 | } | 59 | } |
| 53 | 60 | ||
| @@ -60,7 +67,76 @@ public class GarOrderMatchAskServiceImpl extends ServiceImpl<GarOrderMatchAskMap | @@ -60,7 +67,76 @@ public class GarOrderMatchAskServiceImpl extends ServiceImpl<GarOrderMatchAskMap | ||
| 60 | @Override | 67 | @Override |
| 61 | public List<GarOrderMatchAsk> selectGarOrderMatchAskList(GarOrderMatchAsk garOrderMatchAsk) | 68 | public List<GarOrderMatchAsk> selectGarOrderMatchAskList(GarOrderMatchAsk garOrderMatchAsk) |
| 62 | { | 69 | { |
| 63 | - return garOrderMatchAskMapper.selectGarOrderMatchAskList(garOrderMatchAsk); | 70 | + List<GarOrderMatchAsk> list = garOrderMatchAskMapper.selectGarOrderMatchAskList(garOrderMatchAsk); |
| 71 | + if (CollectionUtils.isEmpty(list)) { | ||
| 72 | + return list; | ||
| 73 | + } | ||
| 74 | + Map<String, DropPointInfo> dropPointCacheByPhone = new HashMap<>(); | ||
| 75 | + for (GarOrderMatchAsk ask : list) { | ||
| 76 | + fillDropPointInfoIfMissing(ask, dropPointCacheByPhone); | ||
| 77 | + } | ||
| 78 | + return list; | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + private void fillDropPointInfoIfMissing(GarOrderMatchAsk ask, Map<String, DropPointInfo> dropPointCacheByPhone) { | ||
| 82 | + if (Objects.isNull(ask)) { | ||
| 83 | + return; | ||
| 84 | + } | ||
| 85 | + boolean missingDropPointInfo = ask.getDropPointId() <= 0 | ||
| 86 | + || StringUtils.isBlank(ask.getDropPointName()) | ||
| 87 | + || StringUtils.isBlank(ask.getDropPointNo()); | ||
| 88 | + if (!missingDropPointInfo || StringUtils.isBlank(ask.getGarOrderId())) { | ||
| 89 | + return; | ||
| 90 | + } | ||
| 91 | + GarOrder order = garOrderMapper.selectById(ask.getGarOrderId()); | ||
| 92 | + if (Objects.isNull(order) || StringUtils.isBlank(order.getGarOrderContactTel())) { | ||
| 93 | + return; | ||
| 94 | + } | ||
| 95 | + String orderAddress = StringUtils.defaultString(order.getGarOrderAddress()) + StringUtils.defaultString(order.getGarOrderAddressDetails()); | ||
| 96 | + if (StringUtils.isBlank(ask.getGarOrderPhone())) { | ||
| 97 | + ask.setGarOrderPhone(order.getGarOrderContactTel()); | ||
| 98 | + } | ||
| 99 | + if (StringUtils.isBlank(ask.getGarOrderName())) { | ||
| 100 | + ask.setGarOrderName(order.getGarOrderContactName()); | ||
| 101 | + } | ||
| 102 | + if (StringUtils.isBlank(ask.getDropAddress())) { | ||
| 103 | + ask.setDropAddress(orderAddress); | ||
| 104 | + } | ||
| 105 | + DropPointInfo dropPointInfo; | ||
| 106 | + if (Objects.nonNull(dropPointCacheByPhone) && dropPointCacheByPhone.containsKey(order.getGarOrderContactTel())) { | ||
| 107 | + dropPointInfo = dropPointCacheByPhone.get(order.getGarOrderContactTel()); | ||
| 108 | + } else { | ||
| 109 | + List<DropPointInfo> dropPointInfoList = dropPointInfoService.selectDropPointInfoListByPhone(order.getGarOrderContactTel()); | ||
| 110 | + dropPointInfo = CollectionUtils.isNotEmpty(dropPointInfoList) ? dropPointInfoList.get(0) : null; | ||
| 111 | + if (Objects.nonNull(dropPointCacheByPhone)) { | ||
| 112 | + dropPointCacheByPhone.put(order.getGarOrderContactTel(), dropPointInfo); | ||
| 113 | + } | ||
| 114 | + } | ||
| 115 | + if (Objects.isNull(dropPointInfo)) { | ||
| 116 | + // 查不到投放点时,兜底展示下单信息 | ||
| 117 | + if (StringUtils.isBlank(ask.getDropPointName())) { | ||
| 118 | + ask.setDropPointName(orderAddress); | ||
| 119 | + } | ||
| 120 | + if (StringUtils.isBlank(ask.getDropPointNo())) { | ||
| 121 | + ask.setDropPointNo(order.getGarOrderId()); | ||
| 122 | + } | ||
| 123 | + if (StringUtils.isBlank(ask.getDropCustodianPhone())) { | ||
| 124 | + ask.setDropCustodianPhone(order.getGarOrderContactTel()); | ||
| 125 | + } | ||
| 126 | + return; | ||
| 127 | + } | ||
| 128 | + if (ask.getDropPointId() <= 0 && Objects.nonNull(dropPointInfo.getId())) { | ||
| 129 | + ask.setDropPointId(dropPointInfo.getId().intValue()); | ||
| 130 | + } | ||
| 131 | + if (StringUtils.isBlank(ask.getDropPointName())) { | ||
| 132 | + ask.setDropPointName(dropPointInfo.getDropPointName()); | ||
| 133 | + } | ||
| 134 | + if (StringUtils.isBlank(ask.getDropPointNo())) { | ||
| 135 | + ask.setDropPointNo(dropPointInfo.getDropPointNo()); | ||
| 136 | + } | ||
| 137 | + if (StringUtils.isBlank(ask.getDropCustodianPhone())) { | ||
| 138 | + ask.setDropCustodianPhone(dropPointInfo.getCustodianPhone()); | ||
| 139 | + } | ||
| 64 | } | 140 | } |
| 65 | 141 | ||
| 66 | /** | 142 | /** |
trash-ui/src/views/gar/order/index.vue
| @@ -52,7 +52,7 @@ | @@ -52,7 +52,7 @@ | ||
| 52 | <el-table-column label="备注" align="center" prop="garRemark" /> | 52 | <el-table-column label="备注" align="center" prop="garRemark" /> |
| 53 | <el-table-column label="是否取消" align="center" prop="garCancelFlag"> | 53 | <el-table-column label="是否取消" align="center" prop="garCancelFlag"> |
| 54 | <template slot-scope="scope"> | 54 | <template slot-scope="scope"> |
| 55 | - {{ computedCancelFlagString(scope.row.garCancelFlag).toString() }}2 | 55 | + {{ computedCancelFlagString(scope.row.garCancelFlag).toString() }} |
| 56 | </template> | 56 | </template> |
| 57 | </el-table-column> | 57 | </el-table-column> |
| 58 | <el-table-column label="车辆数量" align="center" prop="garRealCarCount" /> | 58 | <el-table-column label="车辆数量" align="center" prop="garRealCarCount" /> |