|
@@ -85,6 +85,7 @@ import com.cyksj.service.telegram.TelegramService;
|
|
|
import com.cyksj.service.template.TemplateCommonService;
|
|
import com.cyksj.service.template.TemplateCommonService;
|
|
|
import com.cyksj.service.user.UserBenefitsService;
|
|
import com.cyksj.service.user.UserBenefitsService;
|
|
|
import com.cyksj.service.user.UserBindRelationService;
|
|
import com.cyksj.service.user.UserBindRelationService;
|
|
|
|
|
+import com.cyksj.service.user.UserService;
|
|
|
import com.cyksj.service.wechat.WeChatService;
|
|
import com.cyksj.service.wechat.WeChatService;
|
|
|
import com.cyksj.task.JobManager;
|
|
import com.cyksj.task.JobManager;
|
|
|
import com.ejlchina.searcher.BeanSearcher;
|
|
import com.ejlchina.searcher.BeanSearcher;
|
|
@@ -124,6 +125,8 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
|
|
|
|
|
private final UserMapper userMapper;
|
|
private final UserMapper userMapper;
|
|
|
|
|
|
|
|
|
|
+ private final UserService userService;
|
|
|
|
|
+
|
|
|
private final WeChatService weChatService;
|
|
private final WeChatService weChatService;
|
|
|
|
|
|
|
|
private final RedisService redisService;
|
|
private final RedisService redisService;
|
|
@@ -287,7 +290,7 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
couponUser = couponStatusRecord(payRequest.getCouponExCode(), payRequest.getCouponId(), payRequest.getUserId(), couponPopularizeDto);
|
|
couponUser = couponStatusRecord(payRequest.getCouponExCode(), payRequest.getCouponId(), payRequest.getUserId(), couponPopularizeDto);
|
|
|
}
|
|
}
|
|
|
Boolean isNoLogin = payRequest.getIsNoLogin();
|
|
Boolean isNoLogin = payRequest.getIsNoLogin();
|
|
|
- User user;
|
|
|
|
|
|
|
+ User user = null;
|
|
|
String payOpenId = null;
|
|
String payOpenId = null;
|
|
|
Long relationId = 0L;
|
|
Long relationId = 0L;
|
|
|
Boolean isNeedTicket = checkIsNeedGroupsRelation(goodsDon);
|
|
Boolean isNeedTicket = checkIsNeedGroupsRelation(goodsDon);
|
|
@@ -301,11 +304,18 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
GroupsRelation relation = null;
|
|
GroupsRelation relation = null;
|
|
|
|
|
+ String orderPhone = payRequest.getPhone();
|
|
|
|
|
+ if (StrUtil.isNotBlank(orderPhone)) {
|
|
|
|
|
+ user = saveOrGetOrderPhoneUser(payRequest);
|
|
|
|
|
+ userId = user.getId();
|
|
|
|
|
+ }
|
|
|
if (userId == null) {
|
|
if (userId == null) {
|
|
|
user = new User();
|
|
user = new User();
|
|
|
user.setId(0l);
|
|
user.setId(0l);
|
|
|
} else {
|
|
} else {
|
|
|
- user = userMapper.selectById(userId);
|
|
|
|
|
|
|
+ if (user == null) {
|
|
|
|
|
+ user = userMapper.selectById(userId);
|
|
|
|
|
+ }
|
|
|
if (user == null) throw BusinessRuntimeException.getGatewayApiCode(GatewayApiCode.CMS_TOKEN_VALID);
|
|
if (user == null) throw BusinessRuntimeException.getGatewayApiCode(GatewayApiCode.CMS_TOKEN_VALID);
|
|
|
if (user.getIsBlack()) throw BusinessRuntimeException.getInstance("系统检测操作异常,请稍后再试");
|
|
if (user.getIsBlack()) throw BusinessRuntimeException.getInstance("系统检测操作异常,请稍后再试");
|
|
|
payOpenId = user.getOpenId();
|
|
payOpenId = user.getOpenId();
|
|
@@ -499,7 +509,7 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
}
|
|
}
|
|
|
orderDon.setPayTitle(payTitle.toString());
|
|
orderDon.setPayTitle(payTitle.toString());
|
|
|
//下单手机号
|
|
//下单手机号
|
|
|
- orderDon.setPhone(payRequest.getPhone());
|
|
|
|
|
|
|
+ orderDon.setPhone(orderPhone);
|
|
|
this.saveOrUpdate(orderDon);
|
|
this.saveOrUpdate(orderDon);
|
|
|
|
|
|
|
|
if (orderDon.getIsDp()) {
|
|
if (orderDon.getIsDp()) {
|
|
@@ -975,15 +985,19 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
}
|
|
}
|
|
|
OrderDetailView detail = beanSearcher.searchFirst(OrderDetailView.class, builder.build());
|
|
OrderDetailView detail = beanSearcher.searchFirst(OrderDetailView.class, builder.build());
|
|
|
//获取对应车票订单 账号密码
|
|
//获取对应车票订单 账号密码
|
|
|
- RenewalView renewalView = beanSearcher.searchFirst(RenewalView.class, MapUtils.builder()
|
|
|
|
|
- .field(RenewalView::getUserId, userId)
|
|
|
|
|
- .field(RenewalView::getRelationId, detail.getRelationId())
|
|
|
|
|
- .onlySelect(RenewalView::getAccount, RenewalView::getPassword)
|
|
|
|
|
- .build());
|
|
|
|
|
- if (renewalView != null) {
|
|
|
|
|
- detail.setAccount(renewalView.getAccount());
|
|
|
|
|
- detail.setPassword(renewalView.getPassword());
|
|
|
|
|
|
|
+ if (userId != null) {
|
|
|
|
|
+ List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
|
|
|
|
|
+ RenewalView renewalView = beanSearcher.searchFirst(RenewalView.class, MapUtils.builder()
|
|
|
|
|
+ .field(RenewalView::getUserId, userIdList).op(Operator.InList)
|
|
|
|
|
+ .field(RenewalView::getRelationId, detail.getRelationId())
|
|
|
|
|
+ .onlySelect(RenewalView::getAccount, RenewalView::getPassword)
|
|
|
|
|
+ .build());
|
|
|
|
|
+ if (renewalView != null) {
|
|
|
|
|
+ detail.setAccount(renewalView.getAccount());
|
|
|
|
|
+ detail.setPassword(renewalView.getPassword());
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
if (detail.getRelationId() != 0) {
|
|
if (detail.getRelationId() != 0) {
|
|
|
detail.setTransport(transportMapper.selectOne(Wrappers.lambdaQuery(OrderDonTransport.class).eq(OrderDonTransport::getOrderId, detail.getId()).last(" limit 1")));
|
|
detail.setTransport(transportMapper.selectOne(Wrappers.lambdaQuery(OrderDonTransport.class).eq(OrderDonTransport::getOrderId, detail.getId()).last(" limit 1")));
|
|
|
detail.setWaybill(waybillMapper.selectOne(Wrappers.lambdaQuery(OrderDonWaybill.class).eq(OrderDonWaybill::getOrderId, detail.getId()).last(" limit 1")));
|
|
detail.setWaybill(waybillMapper.selectOne(Wrappers.lambdaQuery(OrderDonWaybill.class).eq(OrderDonWaybill::getOrderId, detail.getId()).last(" limit 1")));
|
|
@@ -2541,4 +2555,27 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
}
|
|
}
|
|
|
return sku;
|
|
return sku;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public User saveOrGetOrderPhoneUser(OrderPayRequest payRequest) {
|
|
|
|
|
+ String orderPhone = payRequest.getPhone();
|
|
|
|
|
+ User user = userMapper.selectOne(Wrappers.lambdaQuery(User.class)
|
|
|
|
|
+ .eq(User::getLoginPhone, orderPhone).last("limit 1"));
|
|
|
|
|
+ if (user == null) {
|
|
|
|
|
+ user = new User();
|
|
|
|
|
+ StringBuilder name = new StringBuilder();
|
|
|
|
|
+ name.append(Constant.DEFAULT_NAME);
|
|
|
|
|
+ user.setPopularizeId(payRequest.getPopularizeId());
|
|
|
|
|
+ user.setLoginPhone(orderPhone);
|
|
|
|
|
+ user.setNickname(String.format("%s%s", name.toString(), RandomUtil.randomString(6)));
|
|
|
|
|
+ //默认头像
|
|
|
|
|
+ user.setHeadimgurl(Constant.DEFAULT_HEAD_IMG);
|
|
|
|
|
+ String registerEnv = null;
|
|
|
|
|
+ user.setRegisterEnv(StrUtil.isEmpty(registerEnv) ? User.RegisterEnv.pc.name() : registerEnv);
|
|
|
|
|
+ if (StrUtil.isEmpty(user.getShowId())) {
|
|
|
|
|
+ user.setShowId(userService.getUserShowId(user.getId()));
|
|
|
|
|
+ }
|
|
|
|
|
+ userMapper.insert(user);
|
|
|
|
|
+ }
|
|
|
|
|
+ return user;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|