Commit 362799e0 authored by hezhen's avatar hezhen

123

parent 23624918
...@@ -334,10 +334,11 @@ public class Vehicle { ...@@ -334,10 +334,11 @@ public class Vehicle {
private Integer vehicleApplyId; private Integer vehicleApplyId;
@Transient
@ApiModelProperty("品牌名称") @ApiModelProperty("品牌名称")
private String brandName; private String brandName;
@Transient
@ApiModelProperty("型号名称") @ApiModelProperty("型号名称")
private String categoryName; private String categoryName;
......
...@@ -5,6 +5,7 @@ import cn.hutool.core.bean.copier.CopyOptions; ...@@ -5,6 +5,7 @@ import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.admin.feign.UserFeign; import com.github.wxiaoqi.security.admin.feign.UserFeign;
...@@ -126,6 +127,9 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR ...@@ -126,6 +127,9 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
@Autowired @Autowired
OrderFeign orderFeign; OrderFeign orderFeign;
@Autowired
VehicleCategoryBiz vehicleCategoryBiz;
@Override @Override
public UserFeign getUserFeign() { public UserFeign getUserFeign() {
return userFeign; return userFeign;
...@@ -1618,6 +1622,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR ...@@ -1618,6 +1622,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
throw new BaseException("车牌号不能重复", ResultCode.FAILED_CODE); throw new BaseException("车牌号不能重复", ResultCode.FAILED_CODE);
} }
Vehicle vehicle= JSONUtil.toBean(vehicleApply.getChangeJson(),Vehicle.class); Vehicle vehicle= JSONUtil.toBean(vehicleApply.getChangeJson(),Vehicle.class);
setVehicle(vehicle,vehicleApply.getChangeJson());
if (StringUtils.isNotBlank(vehicleId)){ if (StringUtils.isNotBlank(vehicleId)){
vehicle.setExtensionList(null); vehicle.setExtensionList(null);
if (!CheckObjectIsNullUtils.objCheckIsNull(vehicle) ){ if (!CheckObjectIsNullUtils.objCheckIsNull(vehicle) ){
...@@ -1638,6 +1643,22 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR ...@@ -1638,6 +1643,22 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
return vehicleId; return vehicleId;
} }
public void setVehicle(Vehicle vehicle,String changeJson){
JSONObject jsonObject = JSONObject.parseObject(changeJson);
if (jsonObject == null )
return;
String brandName = jsonObject.getString("brandName");
VehicleCategory vehicleCategory = new VehicleCategory();
vehicleCategory.setBrandName(brandName);
String categoryName = jsonObject.getString("categoryName");
vehicleCategory.setName(categoryName);
vehicleCategory.setGoodsType(vehicle.getGoodsType());
vehicleCategory = vehicleCategoryBiz.addCategory(vehicleCategory);
vehicle.setBrandId(vehicleCategory.getBrandId());
vehicle.setCategoryId(vehicleCategory.getId());
}
public void setGoodsTypes(Vehicle vehicle){ public void setGoodsTypes(Vehicle vehicle){
......
package com.xxfc.platform.vehicle.biz; package com.xxfc.platform.vehicle.biz;
import com.xxfc.platform.vehicle.entity.VehicleCategory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.xxfc.platform.vehicle.entity.VehicleBrand; import com.xxfc.platform.vehicle.entity.VehicleBrand;
import com.xxfc.platform.vehicle.mapper.VehicleBrandMapper; import com.xxfc.platform.vehicle.mapper.VehicleBrandMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import tk.mybatis.mapper.entity.Example;
import java.util.List;
/** /**
* *
...@@ -15,4 +19,22 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz; ...@@ -15,4 +19,22 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
*/ */
@Service @Service
public class VehicleBrandBiz extends BaseBiz<VehicleBrandMapper, VehicleBrand> { public class VehicleBrandBiz extends BaseBiz<VehicleBrandMapper, VehicleBrand> {
public Integer addBrand(VehicleCategory vehicleCategory){
Example example = new Example(VehicleBrand.class);
example.createCriteria().andEqualTo("cnName",vehicleCategory.getBrandName()).andEqualTo("isDel",0);
List<VehicleBrand> list = selectByExample(example);
Integer id;
if (list.size() == 0){
VehicleBrand vehicleBrand = new VehicleBrand();
vehicleBrand.setCnName(vehicleCategory.getBrandName());
insertSelective(vehicleBrand);
id = vehicleBrand.getId();
}else {
id = list.get(0).getId();
}
return id;
}
} }
\ No newline at end of file
package com.xxfc.platform.vehicle.biz; package com.xxfc.platform.vehicle.biz;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.xxfc.platform.vehicle.entity.VehicleCategory; import com.xxfc.platform.vehicle.entity.VehicleCategory;
import com.xxfc.platform.vehicle.mapper.VehicleCategoryMapper; import com.xxfc.platform.vehicle.mapper.VehicleCategoryMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import tk.mybatis.mapper.entity.Example;
import java.util.List;
/** /**
* *
...@@ -15,4 +19,23 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz; ...@@ -15,4 +19,23 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
*/ */
@Service @Service
public class VehicleCategoryBiz extends BaseBiz<VehicleCategoryMapper, VehicleCategory> { public class VehicleCategoryBiz extends BaseBiz<VehicleCategoryMapper, VehicleCategory> {
@Autowired
VehicleBrandBiz vehicleBrandBiz;
public VehicleCategory addCategory(VehicleCategory vehicleCategory){
Example example = new Example(VehicleCategory.class);
example.createCriteria().andEqualTo("name",vehicleCategory.getName()).andEqualTo("isDel",0);
List<VehicleCategory> list = selectByExample(example);
if (list.size() == 0){
Integer brandId = vehicleBrandBiz.addBrand(vehicleCategory);
vehicleCategory.setBrandId(brandId);
insertSelective(vehicleCategory);
}else {
vehicleCategory = list.get(0);
}
return vehicleCategory;
}
} }
\ 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