diff --git a/src/main/java/com/chint/application/dtos/response/LocationRes.java b/src/main/java/com/chint/application/dtos/response/LocationRes.java new file mode 100644 index 00000000..497fe871 --- /dev/null +++ b/src/main/java/com/chint/application/dtos/response/LocationRes.java @@ -0,0 +1,12 @@ +package com.chint.application.dtos.response; + +import lombok.Data; +import org.springframework.data.annotation.Id; +import org.springframework.data.relational.core.mapping.Column; + +@Data +public class LocationRes { + @Id + private Long locationId; + private String locationName; +} diff --git a/src/main/java/com/chint/application/out/LocationController.java b/src/main/java/com/chint/application/out/LocationController.java index 75e99e89..a032f420 100644 --- a/src/main/java/com/chint/application/out/LocationController.java +++ b/src/main/java/com/chint/application/out/LocationController.java @@ -1,6 +1,8 @@ package com.chint.application.out; +import cn.hutool.core.bean.BeanUtil; import com.chint.application.dtos.LocationParam; +import com.chint.application.dtos.response.LocationRes; import com.chint.domain.aggregates.order.Location; import com.chint.domain.repository.LocationRepository; import com.chint.domain.service.LocationDomainService; @@ -36,15 +38,21 @@ public class LocationController { @ApiOperation("根据查询词查询地理信息") @PostMapping("/query/word") - public Result> queryByFirstLetter(@RequestBody LocationParam locationParam) { + public Result> queryByFirstLetter(@RequestBody LocationParam locationParam) { String queryWord = locationParam.getQueryWord(); List locations = null; + List locationRes = null; if (StringCheck.isFirstCharacterAlphabetic(queryWord)) { locations = locationDomainService.queryByFirstLetter(locationParam); } - if(StringCheck.isFirstCharacterChinese(queryWord)){ + if (StringCheck.isFirstCharacterChinese(queryWord)) { locations = locationDomainService.queryByCityName(locationParam); } - return Result.Success(SUCCESS, locations); + if (locations != null && !locations.isEmpty()) { + locationRes = locations + .stream() + .map(location -> BeanUtil.copyProperties(location, LocationRes.class)).toList(); + } + return Result.Success(SUCCESS, locationRes); } } \ No newline at end of file diff --git a/src/main/java/com/chint/domain/aggregates/order/ApprovalEvent.java b/src/main/java/com/chint/domain/aggregates/order/ApprovalEvent.java index b46b77b4..dfb1c175 100644 --- a/src/main/java/com/chint/domain/aggregates/order/ApprovalEvent.java +++ b/src/main/java/com/chint/domain/aggregates/order/ApprovalEvent.java @@ -12,7 +12,7 @@ import static com.chint.infrastructure.constant.Constant.*; @Data public class ApprovalEvent { @Id - private Long approveEventId; + private Long approvalEventId; @Column("route_id") private Long routeId; diff --git a/src/main/java/com/chint/domain/aggregates/order/RouteOrder.java b/src/main/java/com/chint/domain/aggregates/order/RouteOrder.java index c833250f..f4194799 100644 --- a/src/main/java/com/chint/domain/aggregates/order/RouteOrder.java +++ b/src/main/java/com/chint/domain/aggregates/order/RouteOrder.java @@ -137,7 +137,7 @@ public class RouteOrder extends BaseEntity { private RouteOrder reloadApprovalStatus(){ if (this.approveEvents != null && !this.approveEvents.isEmpty()) { this.approveEvents.stream() - .max(Comparator.comparingLong(ApprovalEvent::getApproveEventId)) + .max(Comparator.comparingLong(ApprovalEvent::getApprovalEventId)) .ifPresent(event -> this.setApprovalStatus(event.reloadStatus().getEventName())); } else { this.setApprovalStatus(APPROVAL_EVENT_PREPARE_NAME);