代码
/**
* 在线下单
* @return
*/
@RequestMapping(value ="/zipto/order.do", method = RequestMethod.POST)
@ResponseBody
public ResultDataApi orderAdd(@RequestBody OrderApiUnion orderApiUnion){
UserState state=userMapper.orderAddApi(orderApiUnion.getData());
ResultDataApi resultData=new ResultDataApi();
if(state.getiState()!=0){
for(int i=0;i<orderApiUnion.getData().getOrderDetailList().size();i++){
OrderDetailApi orderDetail=orderApiUnion.getData().getOrderDetailList().get(i);
orderDetail.setTidanNo(state.getTidanNo());
orderDetail.setCaseNo(String.format("%0" + 3 + "d", i+1));
UserState stateDetail= userMapper.orderDetailAddApi(orderDetail);
}
//至美通接口
JSONObject requestResult=setZiptoApiPost(orderApiUnion);
resultData.setCode(Integer.parseInt(requestResult.get("code").toString()));
resultData.setMsg(requestResult.get("msg").toString());
resultData.setData(requestResult.get("obj"));
}else {
resultData.setCode(-1);
resultData.setMsg(state.getsErrInfo());
}
return resultData;
}