Commit b6172a51 authored by 周健威's avatar 周健威

修改代码

parent 97889578
......@@ -47,9 +47,11 @@ public class VehicleModelController extends CommonBaseController {
@RequestMapping(value = "/detail/{name}", method = RequestMethod.GET)
@IgnoreUserToken
public ObjectRestResponse<VModelDetailVO> detail(@PathVariable("name") @ApiParam("车型名称") String name) {
return vehicleFeign.detailByParam(BeanUtil.beanToMap(new VehicleModel(){{
ObjectRestResponse<VModelDetailVO> objectRestResponse = vehicleFeign.detailByParam(BeanUtil.beanToMap(new VehicleModel(){{
setName(name);
}}, false, true));
objectRestResponse.getData().setUccnCataList(initUccnCataCollect(objectRestResponse.getData().getConfig()));
return objectRestResponse;
}
/**
......@@ -65,21 +67,26 @@ public class VehicleModelController extends CommonBaseController {
ObjectRestResponse<PageDataVO<VehicleModelVo>> objectRestResponse = vehicleFeign.findVehicleModelPageUnauthfind(vmqc);
PageDataVO<VehicleModelVo> pageDataVOs = objectRestResponse.getData();
pageDataVOs.getData().forEach( v -> {
List<VehiclePlatCata> vehiclePlatCataList = vehicleFeign.getCatasByIds(v.getConfig()).getData();
StrUtil.splitToInt("14,7,11", ",");
v.setUccnCataList(vehiclePlatCataList.parallelStream().filter(v1 -> {return ArrayUtil.contains(StrUtil.splitToInt("14,7,11", ","), v1.getParentId());}).sorted(Comparator.comparing(VehiclePlatCata::getParentId, (x, y) -> {
int xx = 0,yy = 0;
int[] array = StrUtil.splitToInt("14,7,11", ",");
for(int i = 0; i < array.length; i++) {
if(x == array[i]) {
xx = i;
}else if(y == array[i]) {
yy = i;
}
}
return (xx - yy);
})).collect(Collectors.toList()));
v.setUccnCataList(initUccnCataCollect(v.getConfig()));
});
return objectRestResponse;
}
private List<VehiclePlatCata> initUccnCataCollect(String modelConfig) {
List<VehiclePlatCata> vehiclePlatCataList = vehicleFeign.getCatasByIds(modelConfig).getData();
int[] array = StrUtil.splitToInt("14,7,11", ",");
return vehiclePlatCataList.parallelStream()
.filter(v1 -> {return ArrayUtil.contains(array, v1.getParentId());})
.sorted(Comparator.comparing(VehiclePlatCata::getParentId, (x, y) -> {
int xx = 0,yy = 0;
for(int i = 0; i < array.length; i++) {
if(x == array[i]) {
xx = i;
}else if(y == array[i]) {
yy = i;
}
}
return (xx - yy);
})).collect(Collectors.toList());
}
}
......@@ -19,4 +19,9 @@ public class VModelDetailVO extends VehicleModel {
@ApiModelProperty("会员列表")
List<BaseUserMemberLevel> userMemberLevel;
/**
* 官网需要显示的配置列表
*/
List<VehiclePlatCata> UccnCataList;
}
\ No newline at end of file
......@@ -48,6 +48,9 @@ public class VehicleModelVo extends VehicleModel implements Serializable {
@ApiModelProperty(value = "品牌")
private String brandName;
/**
* 官网需要显示的配置列表
*/
List<VehiclePlatCata> UccnCataList;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment