Skip to content

Commit

Permalink
Merge pull request #358 from softeerbootcamp-2nd/dev
Browse files Browse the repository at this point in the history
요청사항 반영
  • Loading branch information
tank3a authored Aug 20, 2023
2 parents 5db8dfa + 6027cdf commit 2597d91
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public class ModelShortDataDto {
private Long modelPrice;
@Schema(description = "선택 비율 퍼센트 값(정수), 데이터가 없다면 0", example = "38")
private int percentage;
@Schema(description = "모델 이미지")
private String modelImage;
@ArraySchema(schema = @Schema(implementation = PowerTrainDataDto.class, description = "파워트레인의 HMG 데이터"))
private PowerTrainDataDto hmgData;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,20 @@ public class ModelShortMappedDto {
private Long modelPrice;
private Long modelBoughtCount;
private boolean isDefaultModel;
private String modelImage;
private int modelTypeId;
private String maxPs;
private String maxKgfm;

@Builder
public ModelShortMappedDto(int modelId, String modelName, String modelTypeName, Long modelPrice, Long modelBoughtCount, boolean isDefaultModel, int modelTypeId, String maxPs, String maxKgfm) {
public ModelShortMappedDto(int modelId, String modelName, String modelTypeName, Long modelPrice, Long modelBoughtCount, boolean isDefaultModel, String modelImage, int modelTypeId, String maxPs, String maxKgfm) {
this.modelId = modelId;
this.modelName = modelName;
this.modelTypeName = modelTypeName;
this.modelPrice = modelPrice;
this.modelBoughtCount = modelBoughtCount;
this.isDefaultModel = isDefaultModel;
this.modelImage = modelImage;
this.modelTypeId = modelTypeId;
this.maxPs = maxPs;
this.maxKgfm = maxKgfm;
Expand All @@ -37,7 +39,7 @@ public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ModelShortMappedDto that = (ModelShortMappedDto) o;
return modelId == that.modelId && isDefaultModel == that.isDefaultModel && modelTypeId == that.modelTypeId && Objects.equals(modelName, that.modelName) && Objects.equals(modelTypeName, that.modelTypeName) && Objects.equals(modelPrice, that.modelPrice) && Objects.equals(modelBoughtCount, that.modelBoughtCount) && Objects.equals(maxPs, that.maxPs) && Objects.equals(maxKgfm, that.maxKgfm);
return modelId == that.modelId && isDefaultModel == that.isDefaultModel && modelTypeId == that.modelTypeId && Objects.equals(modelName, that.modelName) && Objects.equals(modelTypeName, that.modelTypeName) && Objects.equals(modelPrice, that.modelPrice) && Objects.equals(modelBoughtCount, that.modelBoughtCount) && Objects.equals(modelImage, that.modelImage) && Objects.equals(maxPs, that.maxPs) && Objects.equals(maxKgfm, that.maxKgfm);
}

public void setIsDefaultModel(int isDefaultModel) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public ModelRepository(DataSource dataSource) {
}

public List<ModelShortMappedDto> findAllModelTypeData(int carId) {
String sql = "select m.model_id, m.model_name, t.model_type_id, t.model_type_name, m.model_price, mm.model_bought_count, mm.is_default_model, pd.max_ps, pd.max_kgfm " +
String sql = "select m.model_id, m.model_name, t.model_type_id, t.model_type_name, m.model_price, m.model_image, mm.model_bought_count, mm.is_default_model, pd.max_ps, pd.max_kgfm " +
"from ModelCarMapper mm " +
"inner join Model m " +
"on mm.model_id = m.model_id " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ public List<ModelShortDataDto> getModelTypeData(int carId) {
.modelName(modelTypeMappedDto.getModelName())
.modelTypeName(modelTypeMappedDto.getModelTypeName())
.modelPrice(modelTypeMappedDto.getModelPrice())
.modelImage(modelTypeMappedDto.getModelImage())
.percentage(percentage)
.build();
}
)

.collect(Collectors.toList()));

return result;
Expand Down Expand Up @@ -76,6 +76,7 @@ private List<ModelShortDataDto> getPowerTrainDataWithRatio(List<ModelShortMapped
.modelPrice(data.getModelPrice())
.modelTypeName(data.getModelTypeName())
.percentage(percentage)
.modelImage(data.getModelImage())
.build();

if(finalPs <= 0 || finalKgfm <= 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Service;

import java.net.URI;
Expand All @@ -11,6 +12,7 @@
import java.net.http.HttpResponse;

@Service
@PropertySource("classpath:application-test.yml")
public class RecommendService {

@Value("${python.url}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ void findAllModelTypeData() {
.modelPrice(1480000L)
.maxPs("202/3800")
.maxKgfm("45.0/1750~2750")
.modelImage("/model/diesel2-2.jpg")
.build();

ModelShortMappedDto sixthModel = ModelShortMappedDto.builder()
Expand All @@ -60,6 +61,7 @@ void findAllModelTypeData() {
.isDefaultModel(false)
.modelBoughtCount(1800L)
.modelPrice(0L)
.modelImage("/model/8seats.jpg")
.build();

//when
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ spring:
init:
mode: always
schema-locations: classpath:schema-h2.sql

python:
url: http://localhost:5001/test

0 comments on commit 2597d91

Please sign in to comment.