Commit 41fd4a7a authored by hezhen's avatar hezhen

Merge branch 'base-modify' of http://113.105.137.151:22280/youjj/cloud-platform into base-modify

parents 85f0800a 19982643
......@@ -22,11 +22,21 @@ public class ObjectRestResponse<T> extends BaseResponse {
return this;
}
public ObjectRestResponse data(T data) {
this.setData(data);
return this;
}
public ObjectRestResponse status(Integer status) {
this.setStatus(status);
return this;
}
public ObjectRestResponse msg(String msg) {
this.setMessage(msg);
return this;
}
public T getData() {
return data;
}
......@@ -35,5 +45,4 @@ public class ObjectRestResponse<T> extends BaseResponse {
this.data = data;
}
}
......@@ -5,6 +5,7 @@ import com.github.wxiaoqi.security.common.context.BaseContextHandler;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.msg.TableResultResponse;
import com.github.wxiaoqi.security.common.util.Query;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
......@@ -24,6 +25,7 @@ public class BaseController<Biz extends BaseBiz,Entity> extends CommonBaseContro
@Autowired
protected Biz baseBiz;
@ApiOperation("添加")
@RequestMapping(value = "",method = RequestMethod.POST)
@ResponseBody
public ObjectRestResponse<Entity> add(@RequestBody Entity entity){
......@@ -31,6 +33,7 @@ public class BaseController<Biz extends BaseBiz,Entity> extends CommonBaseContro
return new ObjectRestResponse<Entity>();
}
@ApiOperation("查询")
@RequestMapping(value = "/{id}",method = RequestMethod.GET)
@ResponseBody
public ObjectRestResponse<Entity> get(@PathVariable int id){
......@@ -40,12 +43,15 @@ public class BaseController<Biz extends BaseBiz,Entity> extends CommonBaseContro
return entityObjectRestResponse;
}
@ApiOperation("修改")
@RequestMapping(value = "/{id}",method = RequestMethod.PUT)
@ResponseBody
public ObjectRestResponse<Entity> update(@RequestBody Entity entity){
baseBiz.updateSelectiveById(entity);
return new ObjectRestResponse<Entity>();
}
@ApiOperation("删除")
@RequestMapping(value = "/{id}",method = RequestMethod.DELETE)
@ResponseBody
public ObjectRestResponse<Entity> remove(@PathVariable int id){
......@@ -53,12 +59,14 @@ public class BaseController<Biz extends BaseBiz,Entity> extends CommonBaseContro
return new ObjectRestResponse<Entity>();
}
@ApiOperation("查询所有")
@RequestMapping(value = "/all",method = RequestMethod.GET)
@ResponseBody
public List<Entity> all(){
return baseBiz.selectListAll();
}
@ApiOperation("查询分页")
@RequestMapping(value = "/page",method = RequestMethod.GET)
@ResponseBody
public TableResultResponse<Entity> list(@RequestParam Map<String, Object> params){
......
......@@ -5,6 +5,7 @@ import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
......@@ -31,111 +32,6 @@ public class VehicleModel implements Serializable {
@ApiModelProperty(value = "名称")
private String name;
//牌照
@Column(name = "license_plate")
@ApiModelProperty(value = "牌照")
private String licensePlate;
//厂家
@Column(name = "factory")
@ApiModelProperty(value = "厂家")
private Integer factory;
//车型
@Column(name = "category")
@ApiModelProperty(value = "车型")
private Integer category;
//长度mm
@Column(name = "length")
@ApiModelProperty(value = "长度mm")
private Integer length;
//宽度mm
@Column(name = "width")
@ApiModelProperty(value = "宽度mm")
private Integer width;
//高度mm
@Column(name = "high")
@ApiModelProperty(value = "高度mm")
private Integer high;
//乘坐人数
@Column(name = "seating")
@ApiModelProperty(value = "乘坐人数")
private Integer seating;
//离地空隙mm
@Column(name = "above_ground")
@ApiModelProperty(value = "离地空隙mm")
private Integer aboveGround;
//排量
@Column(name = "displacement")
@ApiModelProperty(value = "排量")
private Integer displacement;
//燃油类型
@Column(name = "fuel_type")
@ApiModelProperty(value = "燃油类型")
private Integer fuelType;
//功率
@Column(name = "power")
@ApiModelProperty(value = "功率")
private Integer power;
//最大扭矩
@Column(name = "max_torque")
@ApiModelProperty(value = "最大扭矩")
private Integer maxTorque;
//驱动形式
@Column(name = "drive_type")
@ApiModelProperty(value = "驱动形式")
private Integer driveType;
//变速箱
@Column(name = "gearbox")
@ApiModelProperty(value = "变速箱")
private Integer gearbox;
//油箱大小
@Column(name = "fuel_tank_size")
@ApiModelProperty(value = "油箱大小")
private Integer fuelTankSize;
//排放标准
@Column(name = "emission_standard")
@ApiModelProperty(value = "排放标准")
private Integer emissionStandard;
//最高车速
@Column(name = "max_speed")
@ApiModelProperty(value = "最高车速")
private Integer maxSpeed;
//清水箱大小
@Column(name = "water_tank_size")
@ApiModelProperty(value = "清水箱大小")
private Integer waterTankSize;
//灰水箱大小
@Column(name = "grey_water_tank_size")
@ApiModelProperty(value = "灰水箱大小")
private Integer greyWaterTankSize;
//黑水箱大小
@Column(name = "black_water_tank_size")
@ApiModelProperty(value = "黑水箱大小")
private Integer blackWaterTankSize;
//马 桶
@Column(name = "closestool")
@ApiModelProperty(value = "马 桶")
private Integer closestool;
//配置,code逗号分割
@Column(name = "config")
@ApiModelProperty(value = "配置,code逗号分割")
......@@ -146,10 +42,15 @@ public class VehicleModel implements Serializable {
@ApiModelProperty(value = "关键字,code逗号分割")
private String keyword;
//评分
@Column(name = "point")
@ApiModelProperty(value = "评分")
private Integer point;
//房车展示
@Column(name = "model_show")
@ApiModelProperty(value = "房车展示")
private String modelShow;
//参数
@Column(name = "model_param")
@ApiModelProperty(value = "参数")
private String modelParam;
//图片地址 多张为逗号分割
@Column(name = "picture")
......
package com.xxfc.platform.vehicle.vo;
import com.xxfc.platform.vehicle.entity.VehicleModel;
import com.xxfc.platform.vehicle.entity.VehiclePlatCata;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class VModelDetailVO extends VehicleModel {
@ApiModelProperty("类型列表")
List<VehiclePlatCata> vehiclePlatCatas;
}
\ No newline at end of file
......@@ -24,4 +24,5 @@ public class VehicleModelBiz extends BaseBiz<VehicleModelMapper,VehicleModel> {
model.setScore(score);
updateSelectiveById(model);
}
}
\ No newline at end of file
......@@ -7,23 +7,29 @@ import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.constant.RedisKey;
import com.xxfc.platform.vehicle.entity.VehicleCata;
import com.xxfc.platform.vehicle.entity.VehiclePlatCata;
import com.xxfc.platform.vehicle.mapper.VehiclePlatCataMapper;
import com.xxfc.platform.vehicle.vo.CataVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.weekend.WeekendSqls;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@Service
@Slf4j
public class VehiclePlatCataBiz extends BaseBiz<VehiclePlatCataMapper, VehiclePlatCata> {
@Autowired
VehicleCataBiz vehicleCataBiz;
//更新
......@@ -89,13 +95,26 @@ public class VehiclePlatCataBiz extends BaseBiz<VehiclePlatCataMapper, VehiclePl
return mapper.selectByExample(example);
}
/**
* 根据车型获取
* @param modelId
* @return
*/
public List<VehiclePlatCata> getByModelId(Integer modelId){
List<VehicleCata> vehicleCatas = vehicleCataBiz.selectByExample(new Example.Builder(VehicleCata.class)
.where(WeekendSqls.<VehicleCata>custom().andEqualTo(VehicleCata::getVehicleModelId, modelId)).build());
if(vehicleCatas.isEmpty()) {
return new ArrayList<VehiclePlatCata>();
}else {
List<VehiclePlatCata> VehiclePlatCatas = this.selectByExample(new Example.Builder(VehiclePlatCata.class)
.where(WeekendSqls.<VehiclePlatCata>custom().andIn(VehiclePlatCata::getId
, vehicleCatas.parallelStream().map(VehicleCata::getCataId).distinct()
.collect(Collectors.toList()))).build());
return VehiclePlatCatas;
}
}
// public List
}
......@@ -14,6 +14,7 @@ import com.xxfc.platform.vehicle.feign.dto.UserDTO;
import com.xxfc.platform.vehicle.vo.BranchCompanyVo;
import com.xxfc.platform.vehicle.vo.CompanySearchDTO;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
......@@ -28,6 +29,7 @@ import java.util.List;
@Slf4j
@IgnoreClientToken
@IgnoreUserToken
@Api(value="公司controller",tags={"公司操作接口"})
public class BranchCompanyController extends BaseController<BranchCompanyBiz> {
private static Integer MAX_DRIVING_LICENSE_SIZE = 10*1024*1024;//10M
......
......@@ -7,6 +7,7 @@ import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig;
import com.github.wxiaoqi.security.common.context.BaseContextHandler;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.BaseResponse;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
......@@ -295,6 +296,8 @@ public class VehicleController extends BaseController<VehicleBiz> {
PageDataVO<Vehicle> pageDataVO = vehicleBiz.searchUsableVehicle(dto);
bookVehicleVo.setVehicle(pageDataVO.getData().get(0).getId());
// new ObjectRestResponse<>().data();
return baseBiz.applyVehicle4Employee(operatorId, bookVehicleVo, userName);
}
}
package com.xxfc.platform.vehicle.rest;
import cn.hutool.core.bean.BeanUtil;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.vehicle.biz.VehicleModelBiz;
import com.xxfc.platform.vehicle.biz.VehiclePlatCataBiz;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.constant.ResCode.ResCode;
import com.xxfc.platform.vehicle.entity.VehicleCata;
import com.xxfc.platform.vehicle.entity.VehicleModel;
import com.xxfc.platform.vehicle.entity.VehiclePlatCata;
import com.xxfc.platform.vehicle.entity.VehicleUserLicense;
import com.xxfc.platform.vehicle.feign.dto.AppUserDTO;
import com.xxfc.platform.vehicle.vo.VModelDetailVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.models.auth.In;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Controller
@RequestMapping("vehicleModel")
@Api(value="车型controller",tags={"车型操作接口"})
public class VehicleModelController extends BaseController<VehicleModelBiz,VehicleModel> {
@Autowired
VehiclePlatCataBiz vehiclePlatCataBiz;
//修改评分
@RequestMapping(value = "/app/addScore", method = RequestMethod.GET)
public RestResponse addScore(
......@@ -26,4 +45,19 @@ public class VehicleModelController extends BaseController<VehicleModelBiz,Vehic
return RestResponse.suc();
}
//订单
@ApiOperation("车型详情")
@RequestMapping(value = "/app/unauth/detail/{id}", method = RequestMethod.GET)
@ResponseBody
public ObjectRestResponse<VModelDetailVO> detail(@PathVariable("id") @ApiParam("车型id") Integer id){
//查询车型信息,车型类型关系
//,公司信息,系统信息(购车须知,预定须知)
VehicleModel vm = baseBiz.selectById(id);
if(null == vm)
throw new BaseException(ResultCode.NOTEXIST_CODE);
VModelDetailVO vModelDetailVO = BeanUtil.toBean(vm, VModelDetailVO.class);
vModelDetailVO.setVehiclePlatCatas(vehiclePlatCataBiz.getByModelId(vm.getId()));
return new ObjectRestResponse().data(vModelDetailVO);
}
}
\ No newline at end of file
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