Commit 4f29b50c by zhanghj

V1.0.0--售后详情列表增加汽车信息

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@18494 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent 7dde60e7
...@@ -35,6 +35,8 @@ import java.util.regex.Pattern; ...@@ -35,6 +35,8 @@ import java.util.regex.Pattern;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -100,6 +102,9 @@ import com.glsx.ordercenter.service.IResourceMatchingService; ...@@ -100,6 +102,9 @@ import com.glsx.ordercenter.service.IResourceMatchingService;
*/ */
@Service @Service
public class OrderServiceImpl implements IOrderService { public class OrderServiceImpl implements IOrderService {
private Logger logger = LoggerFactory.getLogger(OrderServiceImpl.class);
@Autowired @Autowired
private SysOrderMapper orderDao; private SysOrderMapper orderDao;
...@@ -1163,34 +1168,55 @@ public class OrderServiceImpl implements IOrderService { ...@@ -1163,34 +1168,55 @@ public class OrderServiceImpl implements IOrderService {
order.setMachanicInfo(machanicInfo); order.setMachanicInfo(machanicInfo);
} }
// 车辆信息信息 // 车辆信息信息
if (order.getCarSeries() != null) { Integer serId=order.getCarSeries();
int serId=order.getCarSeries(); if (serId != null) {
int brandId=order.getCarBrand(); int brandId=order.getCarBrand();
JSONObject series = carBrandClient.getSeriesById(serId); String carType = order.getCarType();
JSONObject brand = carBrandClient.getBrandById(brandId); CarInfo carInfo = getCarInfo(brandId, serId, carType);
CarInfo carInfo = new CarInfo(); order.setCarInfo(carInfo);
carInfo.setBrand(brand.getString("data"));
carInfo.setSeries(series.getString("data"));
// 车辆信息信息
if (order.getCarType() != null) {
Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$");
String carType = order.getCarType();
if (pattern.matcher(carType).matches()) {
int typeId=Integer.parseInt(order.getCarType());
JSONObject type = carBrandClient.getCarTypeById(typeId);
if (!com.glsx.common.utils.StringUtils.isEmpty(type.getString("data"))) {
carInfo.setType(type.getString("data"));
}
}
}
order.setCarInfo(carInfo);
} }
return order; return order;
} }
@Override /**
*
* @author zhanghj
* @Title: getCarInfo
* @Description: TODO 获取车辆信息
* @param brandId
* @param serId
* @param carType
* @return
* CarInfo
*
*/
private CarInfo getCarInfo(int brandId, int serId, String carType) {
// TODO Auto-generated method stub
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.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) { public int getOrderCount(SysOrder sysOrder) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return orderDao.getOrderCount(sysOrder); return orderDao.getOrderCount(sysOrder);
...@@ -1687,7 +1713,18 @@ public class OrderServiceImpl implements IOrderService { ...@@ -1687,7 +1713,18 @@ public class OrderServiceImpl implements IOrderService {
if (page != null) { if (page != null) {
PageHelper.startPage(page.getPageIndex(), page.getPageSize(), true); PageHelper.startPage(page.getPageIndex(), page.getPageSize(), true);
} }
return orderDao.getAfterSaleRepairList(orderId, queryContent); List<SysOrder> list = orderDao.getAfterSaleRepairList(orderId, queryContent);
for (SysOrder order : list) {
// 车辆信息信息
Integer serId=order.getCarSeries();
if (serId != null) {
int brandId=order.getCarBrand();
String carType = order.getCarType();
CarInfo carInfo = getCarInfo(brandId, serId, carType);
order.setCarInfo(carInfo);
}
}
return list;
} }
@Transactional @Transactional
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!