Commit 2fe81558 by xiaoyj

轨迹接口修改

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@21918 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent 8ae3e333
......@@ -36,39 +36,7 @@ public class LogisticsController extends BaseController{
*/
@RequestMapping(value = "/catLogisticsTrail", method = { RequestMethod.GET, RequestMethod.POST })
public ResultObject catLogisticsTrail(HttpServletRequest request, Integer indentId) {
//查询订单物流详情
SysIndentLogistics sysIndentLogistics=indentLogisticsService.getByIndentId(indentId);
if (org.springframework.util.StringUtils.isEmpty(sysIndentLogistics)) {
return new ResultObject(ResultCodeEnum.INDENT_NOT_EXIST.getCode(), ResultCodeEnum.INDENT_NOT_EXIST.getMsg());
}
String expCode=sysIndentLogistics.getLogisticsUnicode();
String expNo=sysIndentLogistics.getLogisticsNo();
if(StringUtils.isEmpty(expCode) || StringUtils.isEmpty(expNo)){
return new ResultObject(ResultCodeEnum.INDENT_LOGISTICS_NOT_EXIST.getCode(), ResultCodeEnum.INDENT_LOGISTICS_NOT_EXIST.getMsg());
}
KdApiUtil kdApiUtil=new KdApiUtil();
try {
String result=kdApiUtil.getOrderTracesByJson(expCode,expNo);
JSONObject jsonObject=JSONObject.parseObject(result);
JSONArray objects=new JSONArray();
JSONArray traces= jsonObject.getJSONArray("Traces");
for(int i=traces.size()-1;i>=0;i--){
Object object=new Object();
object=traces.get(i);
objects.add(object);
}
List<Traces> list=objects.toJavaList(Traces.class);
TracesVo tracesVo=new TracesVo();
tracesVo.setTraces(list);
tracesVo.setExNo(expNo);
tracesVo.setExpressCompany(sysIndentLogistics.getExpressCompany());
return new ResultObject(ResultCodeEnum.SUCCESS.getCode(),ResultCodeEnum.SUCCESS.getMsg(),tracesVo);
} catch (Exception e) {
logger.info("物流信息查询异常");
}
return new ResultObject(ResultCodeEnum.ERROR.getCode(),ResultCodeEnum.ERROR.getMsg());
return logisticsService.catLogisticsTrail(indentId);
}
/**
......
package com.glsx.ordercenter.service;
import com.glsx.common.constants.ResultObject;
import com.glsx.ordercenter.pojo.SysLogistics;
import java.util.List;
public interface LogisticsService {
List<SysLogistics> listSysLogistics();
ResultObject catLogisticsTrail(Integer indentId);
}
package com.glsx.ordercenter.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.glsx.common.constants.ResultObject;
import com.glsx.ordercenter.constants.ResultCodeEnum;
import com.glsx.ordercenter.dto.Traces;
import com.glsx.ordercenter.dto.TracesVo;
import com.glsx.ordercenter.mapper.SysIndentLogisticsMapper;
import com.glsx.ordercenter.mapper.SysLogisticsMapper;
import com.glsx.ordercenter.pojo.SysIndentLogistics;
import com.glsx.ordercenter.pojo.SysLogistics;
import com.glsx.ordercenter.pojo.SysLogisticsExample;
import com.glsx.ordercenter.service.LogisticsService;
import com.glsx.ordercenter.utils.KdApiUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.List;
@Service
public class LogisticsServiceImpl implements LogisticsService{
public Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private SysLogisticsMapper sysLogisticsMapper;
@Autowired
private SysIndentLogisticsMapper indentLogisticsDao;
@Override
public List<SysLogistics> listSysLogistics() {
return sysLogisticsMapper.listSysLogistics();
}
@Override
public ResultObject catLogisticsTrail(Integer indentId) {
//查询订单物流详情
SysIndentLogistics sysIndentLogistics=indentLogisticsDao.getByIndentId(indentId);
if (org.springframework.util.StringUtils.isEmpty(sysIndentLogistics)) {
return new ResultObject(ResultCodeEnum.INDENT_NOT_EXIST.getCode(), ResultCodeEnum.INDENT_NOT_EXIST.getMsg());
}
String expCode=sysIndentLogistics.getLogisticsUnicode();
String expNo=sysIndentLogistics.getLogisticsNo();
if(StringUtils.isEmpty(expCode) || StringUtils.isEmpty(expNo)){
return new ResultObject(ResultCodeEnum.INDENT_LOGISTICS_NOT_EXIST.getCode(), ResultCodeEnum.INDENT_LOGISTICS_NOT_EXIST.getMsg());
}
KdApiUtil kdApiUtil=new KdApiUtil();
try {
String result=kdApiUtil.getOrderTracesByJson(expCode,expNo);
JSONObject jsonObject=JSONObject.parseObject(result);
JSONArray objects=new JSONArray();
JSONArray traces= jsonObject.getJSONArray("Traces");
for(int i=traces.size()-1;i>=0;i--){
Object object=new Object();
object=traces.get(i);
objects.add(object);
}
List<Traces> list=objects.toJavaList(Traces.class);
TracesVo tracesVo=new TracesVo();
tracesVo.setTraces(list);
tracesVo.setExNo(expNo);
tracesVo.setExpressCompany(sysIndentLogistics.getExpressCompany());
return new ResultObject(ResultCodeEnum.SUCCESS.getCode(),ResultCodeEnum.SUCCESS.getMsg(),tracesVo);
} catch (Exception e) {
logger.info("物流信息查询异常");
}
return new ResultObject(ResultCodeEnum.ERROR.getCode(),ResultCodeEnum.ERROR.getMsg());
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!