|
@@ -2,6 +2,7 @@ package org.springblade.business.feignClient;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import org.springblade.business.entity.MileagePart;
|
|
|
import org.springblade.business.entity.Mileagexy;
|
|
|
import org.springblade.business.feign.MileageClient;
|
|
|
import org.springblade.business.service.impl.MileagePartService;
|
|
@@ -25,6 +26,7 @@ import java.util.stream.Collectors;
|
|
|
@AllArgsConstructor
|
|
|
public class MileageClientImpl implements MileageClient {
|
|
|
private final MileagexyService service;
|
|
|
+ private final MileagePartService partService;
|
|
|
|
|
|
|
|
|
@Override
|
|
@@ -33,20 +35,23 @@ public class MileageClientImpl implements MileageClient {
|
|
|
Map<String, List<String>> group = mileages.stream().collect(Collectors.groupingBy(e -> e.replaceAll("K.+", StringPool.EMPTY)));
|
|
|
for (Map.Entry<String, List<String>> entry : group.entrySet()) {
|
|
|
String part = entry.getKey();
|
|
|
- List<Mileagexy> target = this.service.list(Wrappers.<Mileagexy>lambdaQuery().eq(Mileagexy::getContractId, contractId.toString()).eq(Mileagexy::getPartNo, part).orderByAsc(Mileagexy::getValue));
|
|
|
- if (CollectionUtil.isNotEmpty(target)) {
|
|
|
- entry.getValue().forEach(e -> {
|
|
|
- String[] r = new String[]{StringPool.EMPTY, StringPool.EMPTY};
|
|
|
- if (Func.isNotBlank(e)) {
|
|
|
- String[] arr = e.split(StringPool.AT);
|
|
|
- double[] db = MileageUtill.azimuthZbXy(BaseUtils.k2d(arr[0]), Double.parseDouble(arr[1]), 90, target);
|
|
|
- if (db != null && db.length == 3) {
|
|
|
- r[0] = String.valueOf(db[0]);
|
|
|
- r[1] = String.valueOf(db[1]);
|
|
|
- result.put(e, r);
|
|
|
+ MileagePart mileagePart=this.partService.getOne(Wrappers.<MileagePart>lambdaQuery().eq(MileagePart::getContractId,contractId.toString()).eq(MileagePart::getPrefix,part).last(" limit 1 "));
|
|
|
+ if(mileagePart!=null) {
|
|
|
+ List<Mileagexy> target = this.service.list(Wrappers.<Mileagexy>lambdaQuery().eq(Mileagexy::getPartId, mileagePart.getId()).orderByAsc(Mileagexy::getValue));
|
|
|
+ if (CollectionUtil.isNotEmpty(target)) {
|
|
|
+ entry.getValue().forEach(e -> {
|
|
|
+ String[] r = new String[]{StringPool.EMPTY, StringPool.EMPTY};
|
|
|
+ if (Func.isNotBlank(e)) {
|
|
|
+ String[] arr = e.split(StringPool.AT);
|
|
|
+ double[] db = MileageUtill.azimuthZbXy(BaseUtils.k2d(arr[0]), Double.parseDouble(arr[1]), 90, target);
|
|
|
+ if (db != null && db.length == 3) {
|
|
|
+ r[0] = String.valueOf(db[0]);
|
|
|
+ r[1] = String.valueOf(db[1]);
|
|
|
+ result.put(e, r);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- });
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
/*坐标集合*/
|