Commit e294f7bc by zhengxj

finish 处理车系为空 on 20190829

by zhengxj 

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@23701 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent 5c816c13
......@@ -1540,7 +1540,7 @@ public class OrderServiceImpl implements IOrderService {
if (serId != null) {
int brandId = order.getCarBrand();
String carType = order.getCarType();
CarInfo carInfo = getCarInfo(brandId, serId, carType);
CarInfo carInfo = orderUtil.getCarInfo(brandId, serId, carType);
order.setCarInfo(carInfo);
}
......@@ -1578,42 +1578,7 @@ public class OrderServiceImpl implements IOrderService {
return order;
}
/**
*
* @author zhanghj
* @Title: getCarInfo
* @Description: 获取车辆信息
* @param brandId
* @param serId
* @param carType
* @return CarInfo
*
*/
private CarInfo getCarInfo(int brandId, int serId, String carType) {
CarInfo carInfo = new CarInfo();
try {
JSONObject series = carBrandClient.getSeriesById(serId);
JSONObject brand = carBrandClient.getBrandById(brandId);
carInfo.setBrand(brand.getString("data"));
carInfo.setSeries(series.getString("data"));
// 车辆信息信息
if (!StringUtils.isEmpty(carType) && StringUtils.isNumber(carType)) {
int typeId = Integer.parseInt(carType);
JSONObject type = carBrandClient.getCarTypeById(typeId);
if (!com.glsx.common.utils.StringUtils.isEmpty(type.getString("data"))) {
carInfo.setType(type.getString("data"));
}
} else {
carInfo.setType(carType);
}
} catch (Exception e) {
logger.error("获取汽车信息,调用汽车品牌服务失败", e);
}
return carInfo;
}
@Override
public int getOrderCount(SysOrder sysOrder) {
......@@ -2493,7 +2458,7 @@ public class OrderServiceImpl implements IOrderService {
if (serId != null) {
int brandId = order.getCarBrand();
String carType = order.getCarType();
CarInfo carInfo = getCarInfo(brandId, serId, carType);
CarInfo carInfo = orderUtil.getCarInfo(brandId, serId, carType);
order.setCarInfo(carInfo);
}
}
......@@ -2766,10 +2731,10 @@ public class OrderServiceImpl implements IOrderService {
}
// 车辆信息信息
Integer serId = order.getCarSeries();
if (serId != null) {
if (serId != null && 0 != serId) {
int brandId = order.getCarBrand();
String carType = order.getCarType();
CarInfo carInfo = getCarInfo(brandId, serId, carType);
CarInfo carInfo = orderUtil.getCarInfo(brandId, serId, carType);
order.setCarInfo(carInfo);
}
......
......@@ -12,6 +12,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.alibaba.druid.util.StringUtils;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.util.StringUtil;
import com.glsx.common.constants.Constants;
......@@ -210,4 +211,42 @@ public class OrderUtil {
}
}
}
/**
*
* @author zhanghj
* @Title: getCarInfo
* @Description: 获取车辆信息
* @param brandId
* @param serId
* @param carType
* @return CarInfo
*
*/
public CarInfo getCarInfo(int brandId, int serId, String carType) {
CarInfo carInfo = new CarInfo();
try {
JSONObject series = carBrandClient.getSeriesById(serId);
JSONObject brand = carBrandClient.getBrandById(brandId);
carInfo.setBrand(brand.getString("data"));
carInfo.setSeries(series.getString("data"));
// 车辆信息信息
if (!StringUtils.isEmpty(carType) && StringUtils.isNumber(carType)) {
int typeId = Integer.parseInt(carType);
JSONObject type = carBrandClient.getCarTypeById(typeId);
if (!com.glsx.common.utils.StringUtils.isEmpty(type.getString("data"))) {
carInfo.setType(type.getString("data"));
}
} else {
carInfo.setType(carType);
}
} catch (Exception e) {
logger.error("获取汽车信息,调用汽车品牌服务失败", e);
}
return carInfo;
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!