|
@@ -27,9 +27,10 @@ import com.kxs.lhb.basic.api.dto.tongyi.QueryOrderReq;
|
|
|
import com.kxs.lhb.basic.api.model.*;
|
|
|
import com.kxs.lhb.basic.api.vo.admin.sysOrder.QueryLogisticsVO;
|
|
|
import com.kxs.lhb.basic.api.vo.tongyi.QueryLogisticsRes;
|
|
|
-import com.kxs.lhb.basic.biz.channel.BasicService;
|
|
|
+import com.kxs.lhb.basic.biz.channel.factory.ChannelFactory;
|
|
|
import com.kxs.lhb.basic.biz.mapper.LhbOrderMapper;
|
|
|
import com.kxs.lhb.basic.biz.mq.model.params.BindNotify;
|
|
|
+import com.kxs.lhb.basic.biz.mq.model.params.OrderNotify;
|
|
|
import com.kxs.lhb.basic.biz.service.*;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -56,7 +57,7 @@ import java.util.stream.Collectors;
|
|
|
@Slf4j
|
|
|
public class LhbOrderServiceImpl extends MPJBaseServiceImpl<LhbOrderMapper, LhbOrder> implements LhbOrderService {
|
|
|
|
|
|
- private final BasicService basicService;
|
|
|
+ private final ChannelFactory channelFactory;
|
|
|
|
|
|
private final LhbUserService userService;
|
|
|
|
|
@@ -72,7 +73,7 @@ public class LhbOrderServiceImpl extends MPJBaseServiceImpl<LhbOrderMapper, LhbO
|
|
|
|
|
|
private final LhbNotifyService notifyService;
|
|
|
|
|
|
- private final LhbAreaService areaService;
|
|
|
+ private final LhbIsvInfoService isvInfoService;
|
|
|
|
|
|
@Override
|
|
|
public List<QueryLogisticsVO> queryLogistics(Integer id) {
|
|
@@ -83,7 +84,7 @@ public class LhbOrderServiceImpl extends MPJBaseServiceImpl<LhbOrderMapper, LhbO
|
|
|
throw new GlobalCustomerException("订单未下单");
|
|
|
}
|
|
|
QueryOrderReq req = QueryOrderReq.builder().orderId(order.getOutOrderSn()).build();
|
|
|
- QueryLogisticsRes queryLogisticsRes = basicService.queryLogistics(req);
|
|
|
+ QueryLogisticsRes queryLogisticsRes = channelFactory.getChannel(order.getIfCode()).queryLogistics(req);
|
|
|
order.setExpressNo(queryLogisticsRes.getExpressNo());
|
|
|
order.updateById();
|
|
|
|
|
@@ -112,7 +113,10 @@ public class LhbOrderServiceImpl extends MPJBaseServiceImpl<LhbOrderMapper, LhbO
|
|
|
if(age < Integer.parseInt(split[0]) || age > Integer.parseInt(split[1])){
|
|
|
throw new GlobalCustomerException("办理年龄段在" + ageSection + "岁之间");
|
|
|
}
|
|
|
-
|
|
|
+ LhbIsvInfo isvInfo = isvInfoService.getByIsvNo(order.getIsvNo());
|
|
|
+ if(isvInfo == null){
|
|
|
+ throw new GlobalCustomerException("服务商不存在");
|
|
|
+ }
|
|
|
//订单号
|
|
|
String orderSn = CommonConstants.ORDER_SN_PREFIX + IdUtil.getSnowflakeNextIdStr();
|
|
|
order.setOrderSn(orderSn);
|
|
@@ -124,7 +128,7 @@ public class LhbOrderServiceImpl extends MPJBaseServiceImpl<LhbOrderMapper, LhbO
|
|
|
.regionId(order.getRegionId())
|
|
|
.idenNr(order.getIdCard())
|
|
|
.number(order.getMakeMobile()).build();
|
|
|
- basicService.preNumber(req);
|
|
|
+ channelFactory.getChannel(goods.getIfCode()).preNumber(req);
|
|
|
|
|
|
order.insert();
|
|
|
|
|
@@ -183,10 +187,23 @@ public class LhbOrderServiceImpl extends MPJBaseServiceImpl<LhbOrderMapper, LhbO
|
|
|
.area(order.getArea())
|
|
|
.preNumber(Boolean.FALSE)
|
|
|
.regionId(order.getRegionId()).build();
|
|
|
- String orderId = basicService.orderSubmit(req);
|
|
|
+ String orderId = channelFactory.getChannel(order.getIfCode()).orderSubmit(req);
|
|
|
order.setOutOrderSn(orderId);
|
|
|
}
|
|
|
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();
|
|
|
}
|
|
|
|
|
@@ -219,12 +236,25 @@ public class LhbOrderServiceImpl extends MPJBaseServiceImpl<LhbOrderMapper, LhbO
|
|
|
.area(order.getArea())
|
|
|
.preNumber(Boolean.FALSE)
|
|
|
.regionId(order.getRegionId()).build();
|
|
|
- String orderId = basicService.orderSubmit(req);
|
|
|
+ String orderId = channelFactory.getChannel(order.getIfCode()).orderSubmit(req);
|
|
|
order.setOutOrderSn(orderId);
|
|
|
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());
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@Override
|
|
|
public Object payOrder(LhbOrder param) {
|
|
|
|
|
@@ -289,7 +319,7 @@ public class LhbOrderServiceImpl extends MPJBaseServiceImpl<LhbOrderMapper, LhbO
|
|
|
.orderId(order.getOutOrderSn())
|
|
|
.returnCause(param.getRemark())
|
|
|
.applyPerson(SecurityUtils.getUser().getName()).build();
|
|
|
- basicService.orderCancel(req);
|
|
|
+ channelFactory.getChannel(order.getIfCode()).orderCancel(req);
|
|
|
|
|
|
return Boolean.TRUE;
|
|
|
}
|
|
@@ -303,7 +333,7 @@ public class LhbOrderServiceImpl extends MPJBaseServiceImpl<LhbOrderMapper, LhbO
|
|
|
|
|
|
orders.forEach(order -> {
|
|
|
QueryOrderReq req = QueryOrderReq.builder().orderId(order.getOutOrderSn()).build();
|
|
|
- String outStatus = basicService.queryStatus(req);
|
|
|
+ String outStatus = channelFactory.getChannel(order.getIfCode()).queryStatus(req);
|
|
|
//更新状态
|
|
|
update(Wrappers.lambdaUpdate(LhbOrder.class).eq(LhbOrder::getId, order.getId()).set(LhbOrder::getOutStatus, outStatus));
|
|
|
});
|
|
@@ -318,7 +348,7 @@ public class LhbOrderServiceImpl extends MPJBaseServiceImpl<LhbOrderMapper, LhbO
|
|
|
|
|
|
orders.forEach(order -> {
|
|
|
QueryOrderReq req = QueryOrderReq.builder().orderId(order.getOutOrderSn()).build();
|
|
|
- String firstCharge = basicService.queryFirstCharge(req);
|
|
|
+ String firstCharge = channelFactory.getChannel(order.getIfCode()).queryFirstCharge(req);
|
|
|
if(firstCharge.contains("50") || firstCharge.contains("100")){
|
|
|
|
|
|
BigDecimal firstChargeAmt = firstCharge.contains("50") ? new BigDecimal("5000") : new BigDecimal("10000");
|
|
@@ -330,7 +360,9 @@ public class LhbOrderServiceImpl extends MPJBaseServiceImpl<LhbOrderMapper, LhbO
|
|
|
.set(LhbOrder::getIsFirstRecharge, CommonConstants.SUCCESS));
|
|
|
|
|
|
//构建推送消息
|
|
|
- BindNotify bindNotify = BindNotify.builder().mobile(order.getMakeMobile())
|
|
|
+ OrderNotify orderNotify = OrderNotify.builder().mobile(order.getMakeMobile())
|
|
|
+ .isvNo(order.getIsvNo())
|
|
|
+ .employNum(order.getEmployNum())
|
|
|
.productName(order.getPackageName())
|
|
|
.firstRechargeAmount(firstChargeAmt)
|
|
|
.userName(order.getCustName())
|
|
@@ -340,7 +372,7 @@ public class LhbOrderServiceImpl extends MPJBaseServiceImpl<LhbOrderMapper, LhbO
|
|
|
.receiveAddress(order.getAddress())
|
|
|
.createTime(LocalDateTimeUtil.format(LocalDate.now(), DatePattern.NORM_DATETIME_PATTERN))
|
|
|
.build();
|
|
|
- notifyService.bindPush(bindNotify, order.getIsvNo());
|
|
|
+ notifyService.orderPush(orderNotify, order.getIsvNo());
|
|
|
}
|
|
|
|
|
|
});
|