|
@@ -23,6 +23,7 @@ import com.kxs.common.pay.model.QueryRequest;
|
|
|
import com.kxs.common.pay.model.QueryResponse;
|
|
|
import com.kxs.common.security.util.SecurityUtils;
|
|
|
import com.kxs.lhb.basic.api.amqp.RabbitOrderTimeoutQueueMQ;
|
|
|
+import com.kxs.lhb.basic.api.constant.enums.NotifyStatusEnum;
|
|
|
import com.kxs.lhb.basic.api.constant.enums.OrderStatusEnum;
|
|
|
import com.kxs.lhb.basic.api.dto.tongyi.OrderCancelReq;
|
|
|
import com.kxs.lhb.basic.api.dto.tongyi.OrderSubmitReq;
|
|
@@ -81,6 +82,8 @@ public class LhbOrderServiceImpl extends MPJBaseServiceImpl<LhbOrderMapper, LhbO
|
|
|
|
|
|
private final LhbIsvInfoService isvInfoService;
|
|
|
|
|
|
+ private final LhbAreaService areaService;
|
|
|
+
|
|
|
@Override
|
|
|
public List<QueryLogisticsVO> queryLogistics(Integer id) {
|
|
|
|
|
@@ -184,7 +187,6 @@ public class LhbOrderServiceImpl extends MPJBaseServiceImpl<LhbOrderMapper, LhbO
|
|
|
|
|
|
LhbGoods goods = goodsService.getById(param.getGoodsId());
|
|
|
if(goods.getServerFee().compareTo(param.getServerFee()) != 0){
|
|
|
-
|
|
|
throw new GlobalCustomerException("服务费与传入的服务费不匹配");
|
|
|
}
|
|
|
order.setIfCode(goods.getIfCode());
|
|
@@ -197,11 +199,16 @@ public class LhbOrderServiceImpl extends MPJBaseServiceImpl<LhbOrderMapper, LhbO
|
|
|
order.setGoodsId(param.getGoodsId());
|
|
|
order.setSkuId(param.getSkuId());
|
|
|
|
|
|
+ List<LhbArea> areas = areaService.getListAreas(List.of(param.getArea().split(StrUtil.COMMA)));
|
|
|
+ if(areas.size() != 3){
|
|
|
+ throw new GlobalCustomerException("地区传入错误");
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
LhbGoodsSku goodsSku = goodsSkuService.getById(param.getSkuId());
|
|
|
List<LhbGoodsActivities> activities = goodsActivitiesService.list(Wrappers.lambdaQuery(LhbGoodsActivities.class).eq(LhbGoodsActivities::getSkuId, goodsSku.getId()));
|
|
|
|
|
|
- //如果有服务费 需要先支付 在回调再下单
|
|
|
+ //如果有服务费 需要先支付 回调再下单
|
|
|
if(order.getServerFee().compareTo(BigDecimal.ZERO) == 0){
|
|
|
|
|
|
order.setStatus(OrderStatusEnum.PAY.getCode());
|
|
@@ -224,21 +231,11 @@ public class LhbOrderServiceImpl extends MPJBaseServiceImpl<LhbOrderMapper, LhbO
|
|
|
.regionId(order.getRegionId()).build();
|
|
|
String orderId = channelFactory.getChannel(order.getIfCode()).orderSubmit(req);
|
|
|
order.setOutOrderSn(orderId);
|
|
|
+ //下单成功推送预约信息到下游
|
|
|
+ sendToOrder(order, NotifyStatusEnum.NORMAL);
|
|
|
}
|
|
|
order.updateById();
|
|
|
|
|
|
- //下单成功推送预约信息到下游
|
|
|
- BindNotify bindNotify = BindNotify.builder().mobile(order.getMakeMobile())
|
|
|
- .isvNo(order.getIsvNo())
|
|
|
- .employNum(order.getEmployNum())
|
|
|
- .productName(order.getPackageName())
|
|
|
- .orderNo(order.getOrderSn())
|
|
|
- .receiveName(order.getCustName())
|
|
|
- .receiveMobile(order.getContMobile())
|
|
|
- .receiveAddress(order.getAddress())
|
|
|
- .createTime(LocalDateTimeUtil.format(LocalDate.now(), DatePattern.NORM_DATETIME_PATTERN))
|
|
|
- .build();
|
|
|
- notifyService.bindPush(bindNotify, order.getIsvNo());
|
|
|
return order.getId();
|
|
|
}
|
|
|
|
|
@@ -276,17 +273,7 @@ public class LhbOrderServiceImpl extends MPJBaseServiceImpl<LhbOrderMapper, LhbO
|
|
|
order.updateById();
|
|
|
|
|
|
//下单成功推送预约信息到下游
|
|
|
- BindNotify bindNotify = BindNotify.builder().mobile(order.getMakeMobile())
|
|
|
- .isvNo(order.getIsvNo())
|
|
|
- .employNum(order.getEmployNum())
|
|
|
- .productName(order.getPackageName())
|
|
|
- .orderNo(order.getOrderSn())
|
|
|
- .receiveName(order.getCustName())
|
|
|
- .receiveMobile(order.getContMobile())
|
|
|
- .receiveAddress(order.getAddress())
|
|
|
- .createTime(LocalDateTimeUtil.format(LocalDate.now(), DatePattern.NORM_DATETIME_PATTERN))
|
|
|
- .build();
|
|
|
- notifyService.bindPush(bindNotify, order.getIsvNo());
|
|
|
+ sendToOrder(order, NotifyStatusEnum.NORMAL);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -356,6 +343,7 @@ public class LhbOrderServiceImpl extends MPJBaseServiceImpl<LhbOrderMapper, LhbO
|
|
|
.applyPerson(SecurityUtils.getUser().getName()).build();
|
|
|
channelFactory.getChannel(order.getIfCode()).orderCancel(req);
|
|
|
|
|
|
+ sendToOrder(order, NotifyStatusEnum.CANCEL);
|
|
|
return Boolean.TRUE;
|
|
|
}
|
|
|
|
|
@@ -370,6 +358,10 @@ public class LhbOrderServiceImpl extends MPJBaseServiceImpl<LhbOrderMapper, LhbO
|
|
|
QueryOrderReq req = QueryOrderReq.builder().orderId(order.getOutOrderSn()).build();
|
|
|
String outStatus = channelFactory.getChannel(order.getIfCode()).queryStatus(req);
|
|
|
//更新状态
|
|
|
+ if("41".equals(outStatus) || "2".equals(outStatus)){
|
|
|
+ //41-配送中,不可取消订单 2-订单成功结束
|
|
|
+ sendToOrder(order, "41".equals(outStatus) ? NotifyStatusEnum.DISTRIBUTION : NotifyStatusEnum.FINISH);
|
|
|
+ }
|
|
|
update(Wrappers.lambdaUpdate(LhbOrder.class).eq(LhbOrder::getId, order.getId()).set(LhbOrder::getOutStatus, outStatus));
|
|
|
});
|
|
|
}
|
|
@@ -394,25 +386,39 @@ public class LhbOrderServiceImpl extends MPJBaseServiceImpl<LhbOrderMapper, LhbO
|
|
|
.set(LhbOrder::getFirstCharge, firstChargeAmt)
|
|
|
.set(LhbOrder::getIsFirstRecharge, CommonConstants.SUCCESS));
|
|
|
|
|
|
- //构建推送消息
|
|
|
- OrderNotify orderNotify = OrderNotify.builder().mobile(order.getMakeMobile())
|
|
|
- .isvNo(order.getIsvNo())
|
|
|
- .employNum(order.getEmployNum())
|
|
|
- .productName(order.getPackageName())
|
|
|
- .firstRechargeAmount(firstChargeAmt)
|
|
|
- .userName(order.getCustName())
|
|
|
- .orderNo(order.getOrderSn())
|
|
|
- .receiveName(order.getCustName())
|
|
|
- .receiveMobile(order.getContMobile())
|
|
|
- .receiveAddress(order.getAddress())
|
|
|
- .createTime(LocalDateTimeUtil.format(LocalDate.now(), DatePattern.NORM_DATETIME_PATTERN))
|
|
|
- .build();
|
|
|
- notifyService.orderPush(orderNotify, order.getIsvNo());
|
|
|
+ sendToOrder(order, NotifyStatusEnum.ACT);
|
|
|
}
|
|
|
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 构建推送消息
|
|
|
+ *
|
|
|
+ * @param order 次序
|
|
|
+ * @param notifyStatusEnum notify status 枚举
|
|
|
+ */
|
|
|
+ private void sendToOrder(LhbOrder order, NotifyStatusEnum notifyStatusEnum) {
|
|
|
+
|
|
|
+ List<LhbArea> areas = areaService.getListAreas(List.of(order.getArea().split(StrUtil.COMMA)));
|
|
|
+ BindNotify bindNotify = BindNotify.builder().mobile(order.getMakeMobile())
|
|
|
+ .isvNo(order.getIsvNo())
|
|
|
+ .employNum(order.getEmployNum())
|
|
|
+ .productName(order.getPackageName())
|
|
|
+ .firstRechargeAmount(order.getFirstCharge())
|
|
|
+ .orderNo(order.getOrderSn())
|
|
|
+ .receiveName(order.getCustName())
|
|
|
+ .receiveMobile(order.getContMobile())
|
|
|
+ .receiveAddress(order.getAddress())
|
|
|
+ .status(notifyStatusEnum.getCode())
|
|
|
+ .province(areas.get(0).getAreaName())
|
|
|
+ .city(areas.get(1).getAreaName())
|
|
|
+ .remark(order.getRemark())
|
|
|
+ .createTime(LocalDateTimeUtil.format(LocalDate.now(), DatePattern.NORM_DATETIME_PATTERN))
|
|
|
+ .build();
|
|
|
+ notifyService.bindPush(bindNotify, order.getIsvNo());
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|