Commit e19cf506 by 张洪旺

叫号器

parent d9a1f879
......@@ -18,7 +18,7 @@ import org.springframework.web.bind.annotation.RestController;
* 叫号器
*/
@Slf4j
@RequestMapping("/caller")
@RequestMapping("order/caller")
@RestController
@Validated
public class CallerController {
......
......@@ -24,6 +24,7 @@ import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.freemud.application.sdk.api.ordercenter.request.OrderExtInfoDto;
import com.freemud.application.sdk.api.storecenter.response.StoreResponse;
import com.freemud.sdk.api.assortment.order.enums.NewOrderType;
import com.freemud.sdk.api.assortment.order.request.order.BaseQueryOrderRequest;
import com.freemud.sdk.api.assortment.order.response.order.QueryOrderByIdResponse;
import com.freemud.sdk.api.assortment.order.response.order.QueryOrdersResponse;
......@@ -35,6 +36,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
......@@ -68,7 +70,7 @@ public class CallerService {
* @return
*/
public BaseResponse takeMealNotices(TakeMealNoticesVO vo) {
// cacheTakeMealNotices(vo);
cacheTakeMealNotices(vo);
if (Objects.isNull(vo.getOrderList())) {
return ResponseUtil.success();
}
......@@ -92,11 +94,18 @@ public class CallerService {
log.error("订单号:{},商户号:{},没有门店信息", orderId, orderBean.getShopId());
return;
}
List<Integer> takeawayOrderType = Lists.newArrayList(
NewOrderType.RESERVED_EXPRESS.getCode(),
NewOrderType.GENERAL_EXPRESS.getCode());
if (takeawayOrderType.contains(orderBean.getNewOrderType())) {
// 外卖单不发模板消息
return;
}
orderBean.setShopAddress(storeResponse.getBizVO().getAddress());
SubscribeMessageRequest subscribeMessageRequest = new SubscribeMessageRequest();
subscribeMessageRequest.setMiniAppId(extInfoDto.getAppid());
subscribeMessageRequest.setOpenIdList(Lists.newArrayList(extInfoDto.getOpenid()));
// coco order_client 2微信小程序 3支付宝小程序
// coco order_client 2微信小程序 3支付宝小程序 需要转换生态的
subscribeMessageRequest.setChannel(orderBean.getOrderClient().equals("2") ? 1 : 2);
boolean reservationOrder = isReservationOrder(orderBean);
if (reservationOrder) {
......@@ -121,6 +130,7 @@ public class CallerService {
subscribeMessageRequest.setScene("scene_instant");
subscribeMessageRequest.setMessageEventType(MessageEventTypeEnum.INSTANT_ORDER_TAKE_REMINDER.getType());
}
//发送模板消息
SubscribeMessageResponse subscribeMessageResponse = ecologyAdminApplicationClient.subscribeMessage(subscribeMessageRequest);
if (!ResponseCodeConstant.RESPONSE_SUCCESS.equals(subscribeMessageResponse.getCode())) {
log.error("ecologyAdminApplicationClient.subscribeMessage调用失败 ,request:{},body:{}", JSON.toJSONString(subscribeMessageResponse),
......
......@@ -33,6 +33,10 @@ import cn.freemud.entities.dto.delivery.OrderRemindRequestDto;
import cn.freemud.entities.dto.delivery.QueryDeliveryAmountResponseDto;
import cn.freemud.entities.dto.delivery.QueryLocusRiderTrackDto;
import cn.freemud.entities.dto.delivery.ResRiderTrackDto;
import cn.freemud.entities.dto.ecology.BookingOrderPayedScene;
import cn.freemud.entities.dto.ecology.InstantOrderPayedScene;
import cn.freemud.entities.dto.ecology.SubscribeMessageRequest;
import cn.freemud.entities.dto.ecology.SubscribeMessageResponse;
import cn.freemud.entities.dto.order.CreateOrderOperateDto;
import cn.freemud.entities.dto.order.CreatePrepayRequestDto;
import cn.freemud.entities.dto.order.FacePayRequestDto;
......@@ -55,6 +59,7 @@ import cn.freemud.utils.*;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.freemud.api.assortment.datamanager.entity.db.*;
import com.freemud.api.assortment.datamanager.entity.vo.AssortmentCustomerInfoVo;
import com.freemud.api.assortment.datamanager.manager.*;
......@@ -266,6 +271,8 @@ public class OrderServiceImpl implements Orderservice {
private ComPayClient comPayClient;
@Autowired
private AssortmentOpenPlatformIappWxappStoreManager assortmentOpenPlatformIappWxappStoreManager;
@Autowired
private EcologyAdminApplicationClient ecologyAdminApplicationClient;
@Value("${coco.partnerId}")
private String partnerId;
......@@ -1554,13 +1561,12 @@ public class OrderServiceImpl implements Orderservice {
if (StringUtils.isEmpty(orderRefundVo.getReason())) {
orderRefundVo.setReason("退款");
}
AssortmentCustomerInfoVo userInfo = null;
/* AssortmentCustomerInfoVo userInfo = customerInfoManager.getCustomerInfoByObject(orderRefundVo.getSessionId());
AssortmentCustomerInfoVo userInfo = customerInfoManager.getCustomerInfoByObject(orderRefundVo.getSessionId());
if (userInfo == null || StringUtils.isEmpty(userInfo.getMemberId())) {
return ResponseUtil.error(ResponseResult.NOT_LOGIN);
}*/
/* String memberId = userInfo.getMemberId();
String partnerId = userInfo.getPartnerId();*/
}
String memberId = userInfo.getMemberId();
String partnerId = userInfo.getPartnerId();
if (StringUtils.isBlank(orderRefundVo.getOid())) {
return ResponseUtil.error(ResponseResult.PARAMETER_MISSING.getCode(), "oid不能为空");
......@@ -1578,9 +1584,9 @@ public class OrderServiceImpl implements Orderservice {
if (!RESPONSE_SUCCESS_CODE.equals(orderByIdResponseDto.getErrcode()) || orderByIdResponseDto.getData() == null) {
return ResponseUtil.error(ResponseResult.ORDER_QUERYORDER_ERROR.getCode(), "订单信息不存在");
}
/* if (!memberId.equals(orderByIdResponseDto.getData().getUserId())) {
if (!memberId.equals(orderByIdResponseDto.getData().getUserId())) {
return ResponseUtil.error(ResponseResult.ORDER_QUERYORDER_ERROR.getCode(), "不能操作非本人的订单");
}*/
}
OrderBean orderBean = orderByIdResponseDto.getData();
// todo coco 商户校验
if (partnerId.equals(orderByIdResponseDto.getData().getCompanyId())) {
......@@ -2036,13 +2042,13 @@ public class OrderServiceImpl implements Orderservice {
*/
private void sendMessage(QueryOrdersResponseDto.DataBean.OrderBean orderBean, MessageEventType messageEventType) {
MessageTemplateRequest<MessagePushOrderTemplateRequest> messageTemplateRequest = null;
try {
messageTemplateRequest = messageNoticeAdapter.convent2MessageTemplateRequest(orderBean);
messageTemplateRequest.setMessageEventType(messageEventType);
this.messageTemplatePushService.sendTemplateMsg(messageTemplateRequest);
} catch (Exception e) {
LogUtil.error("sendTemplateMsg_error", JSONObject.toJSONString(orderBean), JSONObject.toJSONString(messageTemplateRequest), e);
}
try {
messageTemplateRequest = messageNoticeAdapter.convent2MessageTemplateRequest(orderBean);
messageTemplateRequest.setMessageEventType(messageEventType);
this.messageTemplatePushService.sendTemplateMsg(messageTemplateRequest);
} catch (Exception e) {
LogUtil.error("sendTemplateMsg_error", JSONObject.toJSONString(orderBean), JSONObject.toJSONString(messageTemplateRequest), e);
}
}
......
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