|
@@ -8,15 +8,14 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.cyksj.common.constant.Constant;
|
|
import com.cyksj.common.constant.Constant;
|
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
import com.cyksj.common.task.GlobalThreadPoolTaskExecutor;
|
|
import com.cyksj.common.task.GlobalThreadPoolTaskExecutor;
|
|
|
-import com.cyksj.common.util.SmsUtil;
|
|
|
|
|
import com.cyksj.mapper.*;
|
|
import com.cyksj.mapper.*;
|
|
|
import com.cyksj.mapper.manage.GroupsTripsAccountReplaceRecordMapper;
|
|
import com.cyksj.mapper.manage.GroupsTripsAccountReplaceRecordMapper;
|
|
|
import com.cyksj.mapper.manage.cms.CmsUserMapper;
|
|
import com.cyksj.mapper.manage.cms.CmsUserMapper;
|
|
|
-import com.cyksj.mapper.market.task.UserBindDetailMapper;
|
|
|
|
|
import com.cyksj.model.entity.*;
|
|
import com.cyksj.model.entity.*;
|
|
|
import com.cyksj.model.request.ReplaceTripsAccountReq;
|
|
import com.cyksj.model.request.ReplaceTripsAccountReq;
|
|
|
import com.cyksj.model.views.GroupsAccountView;
|
|
import com.cyksj.model.views.GroupsAccountView;
|
|
|
import com.cyksj.service.mange.CmsGroupService;
|
|
import com.cyksj.service.mange.CmsGroupService;
|
|
|
|
|
+import com.cyksj.service.sms.SmsService;
|
|
|
import com.ejlchina.searcher.BeanSearcher;
|
|
import com.ejlchina.searcher.BeanSearcher;
|
|
|
import com.ejlchina.searcher.util.MapUtils;
|
|
import com.ejlchina.searcher.util.MapUtils;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
@@ -53,9 +52,7 @@ public class CmsGroupServiceImpl extends ServiceImpl<GroupsMapper,GroupsTrips> i
|
|
|
|
|
|
|
|
private final GoodsDonMapper goodsDonMapper;
|
|
private final GoodsDonMapper goodsDonMapper;
|
|
|
|
|
|
|
|
- private UserBindDetailMapper userBindDetailMapper;
|
|
|
|
|
-
|
|
|
|
|
- private final UserMapper userMapper;
|
|
|
|
|
|
|
+ private final SmsService smsService;
|
|
|
|
|
|
|
|
private static final GlobalThreadPoolTaskExecutor TASK_EXECUTOR = GlobalThreadPoolTaskExecutor.getInstance();
|
|
private static final GlobalThreadPoolTaskExecutor TASK_EXECUTOR = GlobalThreadPoolTaskExecutor.getInstance();
|
|
|
|
|
|
|
@@ -109,6 +106,12 @@ public class CmsGroupServiceImpl extends ServiceImpl<GroupsMapper,GroupsTrips> i
|
|
|
throw new BusinessRuntimeException("该账号已发车.请选择未发车账户");
|
|
throw new BusinessRuntimeException("该账号已发车.请选择未发车账户");
|
|
|
}
|
|
}
|
|
|
List<GroupsRelation> groupsRelations = relationMapper.selectList(Wrappers.lambdaQuery(GroupsRelation.class).eq(GroupsRelation::getGroupsId, groupsTrips.getId()).eq(GroupsRelation::getStatus, GroupsRelation.Status.validity));
|
|
List<GroupsRelation> groupsRelations = relationMapper.selectList(Wrappers.lambdaQuery(GroupsRelation.class).eq(GroupsRelation::getGroupsId, groupsTrips.getId()).eq(GroupsRelation::getStatus, GroupsRelation.Status.validity));
|
|
|
|
|
+ GroupsTrips trips = beanSearcher.searchFirst(GroupsTrips.class, MapUtils.builder().field(GroupsTrips::getId, groupsTrips.getId()).onlySelect(GroupsTrips::getTitle).build());
|
|
|
|
|
+ String title = "车票";
|
|
|
|
|
+ if (trips != null && StrUtil.isNotBlank(trips.getTitle())) {
|
|
|
|
|
+ title = trips.getTitle();
|
|
|
|
|
+ }
|
|
|
|
|
+ String msg = String.format(Constant.CHANGE_GROUPS_TRIPS_ACCOUNT, title);
|
|
|
groupsRelations.forEach((relation)->{
|
|
groupsRelations.forEach((relation)->{
|
|
|
if (relation.getExpiryTime() == null) {
|
|
if (relation.getExpiryTime() == null) {
|
|
|
List<OrderDon> orderDonList = orderDonMapper.selectList(Wrappers.lambdaQuery(OrderDon.class).eq(OrderDon::getUserId, relation.getUserId()).eq(OrderDon::getRelationId, relation.getId()).eq(OrderDon::getStatus, OrderDon.Status.hasPayment));
|
|
List<OrderDon> orderDonList = orderDonMapper.selectList(Wrappers.lambdaQuery(OrderDon.class).eq(OrderDon::getUserId, relation.getUserId()).eq(OrderDon::getRelationId, relation.getId()).eq(OrderDon::getStatus, OrderDon.Status.hasPayment));
|
|
@@ -127,6 +130,8 @@ public class CmsGroupServiceImpl extends ServiceImpl<GroupsMapper,GroupsTrips> i
|
|
|
orderDonMapper.updateById(orderDon);
|
|
orderDonMapper.updateById(orderDon);
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
+ //发送短信
|
|
|
|
|
+ smsService.sendSmsToRelationUser(relation.getUserId(), msg);
|
|
|
});
|
|
});
|
|
|
groupsTrips.setStatus(GroupsTrips.Status.validity);
|
|
groupsTrips.setStatus(GroupsTrips.Status.validity);
|
|
|
updateById(groupsTrips);
|
|
updateById(groupsTrips);
|
|
@@ -201,27 +206,13 @@ public class CmsGroupServiceImpl extends ServiceImpl<GroupsMapper,GroupsTrips> i
|
|
|
TASK_EXECUTOR.execute(() -> sendChangeAccountMsg(groupsId, goodsId));;
|
|
TASK_EXECUTOR.execute(() -> sendChangeAccountMsg(groupsId, goodsId));;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private void sendChangeAccountMsg(Long groupsId,Long goodsId) {
|
|
|
|
|
|
|
+ private void sendChangeAccountMsg(Long groupsId, Long goodsId) {
|
|
|
GoodsDon goodsDon = goodsDonMapper.selectById(goodsId);
|
|
GoodsDon goodsDon = goodsDonMapper.selectById(goodsId);
|
|
|
List<GroupsRelation> groupsRelations = beanSearcher.searchAll(GroupsRelation.class, MapUtils.builder().field(GroupsRelation::getGroupsId, groupsId).build());
|
|
List<GroupsRelation> groupsRelations = beanSearcher.searchAll(GroupsRelation.class, MapUtils.builder().field(GroupsRelation::getGroupsId, groupsId).build());
|
|
|
- groupsRelations.forEach(relation->{
|
|
|
|
|
- Long userId = relation.getUserId();
|
|
|
|
|
- User user = userMapper.selectById(userId);
|
|
|
|
|
- String phone = null;
|
|
|
|
|
- if (user != null) {
|
|
|
|
|
- phone = user.getLoginPhone();
|
|
|
|
|
- if (StrUtil.isEmpty(phone)) {
|
|
|
|
|
- UserBindDetail userBindDetail = userBindDetailMapper.selectById(userId);
|
|
|
|
|
- if (userBindDetail != null) {
|
|
|
|
|
- phone = userBindDetail.getPhone();
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- if (StrUtil.isNotBlank(phone)) {
|
|
|
|
|
- String title = goodsDon != null ? goodsDon.getTitle() : "车票";
|
|
|
|
|
- SmsUtil.sendLuoKey2Msg(phone, String.format(Constant.CHANGE_GROUPS_TRIPS_ACCOUNT, title));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ groupsRelations.forEach(relation -> {
|
|
|
|
|
+ String title = goodsDon != null ? goodsDon.getTitle() : "车票";
|
|
|
|
|
+ String msg = String.format(Constant.CHANGE_GROUPS_TRIPS_ACCOUNT, title);
|
|
|
|
|
+ smsService.sendSmsToRelationUser(relation.getUserId(), msg);
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|