Commit dcc5893f by huiyang.chen

Merge branch 'feature-2020/8/6-McCafe-会阳' into develop

parents a9e48a93 b79b385b
......@@ -1324,7 +1324,7 @@ public class OrderAdapter {
}
private OrderViewStatusDto getOrderViewStatusDesc(QueryOrdersResponse.DataBean.OrderBean orderBean, String wxAppId) {
public OrderViewStatusDto getOrderViewStatusDesc(QueryOrdersResponse.DataBean.OrderBean orderBean, String wxAppId) {
OrderViewStatusDto orderViewStatusDto = new OrderViewStatusDto();
LogUtil.info("getOrderStatusDesc start ", new Gson().toJson(orderBean), new Gson().toJson(orderBean));
QueryOrdersResponse.DataBean.OrderBean.RefundBean refundBean = null;
......
......@@ -29,10 +29,7 @@ import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
......@@ -351,5 +348,14 @@ public class OrderController {
return orderservice.listFreeRider(vo);
}
/**
* 根据订单号查询订单状态和取餐码
*/
@ApiAnnotation(logMessage = "mcCafePollingPickUpCode")
@PostMapping("/mcCafePollingPickUpCode")
public BaseResponse mcCafePollingPickUpCode(@Validated @LogParams @RequestBody MaCafeQueryOrderVo vo) {
return orderservice.mcCafePollingPickUpCode(vo);
}
}
......@@ -123,4 +123,6 @@ public interface Orderservice {
BaseResponse mcCafeQueryOrderById(MaCafeQueryOrderVo queryOrderVo);
BaseResponse mcCafeQueryOrders(McCafeQueryOrderVo queryOrderVo);
BaseResponse mcCafePollingPickUpCode(MaCafeQueryOrderVo vo );
}
......@@ -882,27 +882,12 @@ public class OrderServiceImpl implements Orderservice {
BeanUtils.copyProperties(queryOrderVo,vo);
String channelType = this.getQueryOrderChannelType(vo, userLoginInfoDto);
QueryOrdersDto queryOrdersDto = orderAdapter.convent2QueryOrdersDtoMcCafe(queryOrderVo, userId, channelType);
//封装查询正在进行中的订单数
McCafeQueryOrderVo queryOrderVoNow =new McCafeQueryOrderVo();
BeanUtils.copyProperties(queryOrderVo,queryOrderVoNow);
List<Integer> queryOrderStatus = Arrays.asList(QueryOrderStatus.TAKE_MEAL.getCode());
List<Integer> queryOrderType = Arrays.asList(OrderType.COLLECT_GOODS.getCode(),OrderType.TAKE_OUT.getCode());
queryOrderVoNow.setQueryOrderStatus(queryOrderStatus);
queryOrderVoNow.setQueryOrderType(queryOrderType);
QueryOrdersDto queryOrdersDtoNow = orderAdapter.convent2QueryOrdersDtoMcCafe(queryOrderVoNow, userId, channelType);
QueryOrdersResponse queryOrderResponse;
QueryOrdersResponse queryOrderResponseNow;
try {
QueryOrdersRequest queryOrdersRequest2 = new QueryOrdersRequest();
BeanUtil.convertBean(queryOrdersDto, queryOrdersRequest2);
queryOrdersRequest2.setTrackingNo(LogTreadLocal.getTrackingNo());
queryOrderResponse = orderCenterSdkService.queryOrders(queryOrdersRequest2);
QueryOrdersRequest queryOrdersRequestNow = new QueryOrdersRequest();
BeanUtil.convertBean(queryOrdersDtoNow, queryOrdersRequestNow);
queryOrdersRequestNow.setTrackingNo(LogTreadLocal.getTrackingNo());
queryOrderResponseNow = orderCenterSdkService.queryOrders(queryOrdersRequestNow);
} catch (Exception e) {
LogUtil.error("queryOrders_error", gson.toJson(queryOrdersDto), e);
return ResponseUtil.error(ResponseResult.ORDER_QUERYORDER_ERROR);
......@@ -914,7 +899,6 @@ public class OrderServiceImpl implements Orderservice {
//用户无订单数据
if (queryOrderResponse.getData() == null || queryOrderResponse.getData().getCount() == 0) {
responseMap.put("count", 0);
responseMap.put("progressOrderCount", queryOrderResponseNow.getData() == null ? 0 : queryOrderResponseNow.getData().getCount());
responseMap.put("list", new ArrayList<QueryOrderResponseVo>());
return ResponseUtil.success(responseMap);
}
......@@ -994,7 +978,6 @@ public class OrderServiceImpl implements Orderservice {
List<QueryOrderResponseVo> queryOrderResponseVos = orderAdapter.convent2QueryOrderResponseVos(orders, userLoginInfoDto.getWxAppId(), userLoginInfoDto.getIappId());
responseMap.put("count", queryOrderResponse.getData() == null ? 0 : queryOrderResponse.getData().getCount());
responseMap.put("progressOrderCount", queryOrderResponseNow.getData() == null ? 0 : queryOrderResponseNow.getData().getCount());
responseMap.put("list", queryOrderResponseVos);
//只有有订单时才显示用户自定义取餐信息
if (CollectionUtils.isNotEmpty(queryOrderResponseVos)) {
......@@ -1003,6 +986,31 @@ public class OrderServiceImpl implements Orderservice {
return ResponseUtil.success(responseMap);
}
@Override
public BaseResponse mcCafePollingPickUpCode(MaCafeQueryOrderVo queryOrderVo) {
AssortmentCustomerInfoVo userLoginInfoDto = customerInfoManager.getCustomerInfoByObject(queryOrderVo.getSessionId());
if (userLoginInfoDto == null || StringUtils.isBlank(userLoginInfoDto.getMemberId())) {
return ResponseUtil.error(ResponseResult.NOT_LOGIN);
}
String oid =queryOrderVo.getOid();
if (StringUtils.isBlank(oid)) {
return ResponseUtil.error(ResponseResult.PARAMETER_MISSING.getCode(), "oid不能为空");
}
BaseQueryOrderRequest baseQueryOrderRequest = new BaseQueryOrderRequest();
baseQueryOrderRequest.setOrderId(oid);
baseQueryOrderRequest.setTrackingNo(LogTreadLocal.getTrackingNo());
QueryOrderByIdResponse response = orderCenterSdkService.queryOrderById(baseQueryOrderRequest);
if (!RESPONSE_SUCCESS_CODE.equals(response.getErrcode()) || response.getData() == null) {
return ResponseUtil.error(ResponseResult.ORDER_QUERYORDER_ERROR);
}
QueryOrdersResponse.DataBean.OrderBean orderBean = response.getData();
OrderViewStatusDto orderViewStatusDesc = orderAdapter.getOrderViewStatusDesc(orderBean, userLoginInfoDto.getWxAppId());
Map<String, Object> responseMap = Maps.newTreeMap();
responseMap.put("orderStatus", orderViewStatusDesc.getOrderStatus());
responseMap.put("takeCode",orderBean.getOtherCode() );
return ResponseUtil.success(responseMap);
}
private String getRedpacketsPicture(String activityId) {
if (StringUtils.isNotBlank(activityId)) {
try {
......
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