|
@@ -1,10 +1,12 @@
|
|
|
package com.cyksj.service.mange.group;
|
|
package com.cyksj.service.mange.group;
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DateField;
|
|
import cn.hutool.core.date.DateField;
|
|
|
|
|
+import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
+import com.cyksj.common.EnvCommonService;
|
|
|
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;
|
|
@@ -54,6 +56,8 @@ public class CmsGroupServiceImpl extends ServiceImpl<GroupsMapper,GroupsTrips> i
|
|
|
|
|
|
|
|
private final SmsService smsService;
|
|
private final SmsService smsService;
|
|
|
|
|
|
|
|
|
|
+ private final EnvCommonService envCommonService;
|
|
|
|
|
+
|
|
|
private static final GlobalThreadPoolTaskExecutor TASK_EXECUTOR = GlobalThreadPoolTaskExecutor.getInstance();
|
|
private static final GlobalThreadPoolTaskExecutor TASK_EXECUTOR = GlobalThreadPoolTaskExecutor.getInstance();
|
|
|
|
|
|
|
|
|
|
|
|
@@ -125,6 +129,7 @@ public class CmsGroupServiceImpl extends ServiceImpl<GroupsMapper,GroupsTrips> i
|
|
|
if (StrUtil.isNotBlank(verifyCodes)) {
|
|
if (StrUtil.isNotBlank(verifyCodes)) {
|
|
|
verifyCodeArray = verifyCodes.split(",");
|
|
verifyCodeArray = verifyCodes.split(",");
|
|
|
}
|
|
}
|
|
|
|
|
+ Boolean isPrdEnv = envCommonService.isPrdEnv();
|
|
|
for (int i = 0; i < groupsRelations.size(); i++) {
|
|
for (int i = 0; i < groupsRelations.size(); i++) {
|
|
|
GroupsRelation relation = groupsRelations.get(i);
|
|
GroupsRelation relation = groupsRelations.get(i);
|
|
|
if (relation.getExpiryTime() == null) {
|
|
if (relation.getExpiryTime() == null) {
|
|
@@ -144,8 +149,10 @@ public class CmsGroupServiceImpl extends ServiceImpl<GroupsMapper,GroupsTrips> i
|
|
|
orderDonMapper.updateById(orderDon);
|
|
orderDonMapper.updateById(orderDon);
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
- //发送短信
|
|
|
|
|
- smsService.sendSmsToRelationUser(relation.getUserId(), msg);
|
|
|
|
|
|
|
+ if (relation.getUserId() != 0 && isPrdEnv) {
|
|
|
|
|
+ //发送短信
|
|
|
|
|
+ smsService.sendSmsToRelationUser(relation.getUserId(), msg);
|
|
|
|
|
+ }
|
|
|
if (verifyCodeArray != null && verifyCodeArray.length > 0 && i < verifyCodeArray.length) {
|
|
if (verifyCodeArray != null && verifyCodeArray.length > 0 && i < verifyCodeArray.length) {
|
|
|
relation.setVerifyCode(verifyCodeArray[i]);
|
|
relation.setVerifyCode(verifyCodeArray[i]);
|
|
|
relationMapper.updateById(relation);
|
|
relationMapper.updateById(relation);
|
|
@@ -226,11 +233,22 @@ public class CmsGroupServiceImpl extends ServiceImpl<GroupsMapper,GroupsTrips> i
|
|
|
|
|
|
|
|
private void sendChangeAccountMsg(Long groupsId, Long goodsId) {
|
|
private void sendChangeAccountMsg(Long groupsId, Long goodsId) {
|
|
|
GoodsDon goodsDon = goodsDonMapper.selectById(goodsId);
|
|
GoodsDon goodsDon = goodsDonMapper.selectById(goodsId);
|
|
|
|
|
+ String title = goodsDon != null ? goodsDon.getTitle() : "车票";
|
|
|
|
|
+ DateTime now = DateTime.now();
|
|
|
|
|
+ Boolean isPrd = envCommonService.isPrdEnv();
|
|
|
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 -> {
|
|
groupsRelations.forEach(relation -> {
|
|
|
- String title = goodsDon != null ? goodsDon.getTitle() : "车票";
|
|
|
|
|
- String msg = String.format(Constant.CHANGE_GROUPS_TRIPS_ACCOUNT, title);
|
|
|
|
|
- smsService.sendSmsToRelationUser(relation.getUserId(), msg);
|
|
|
|
|
|
|
+ if (relation.getExpiryTime() == null) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ //账号有效期小于5天的人,不发账号替换/改密码短信提醒
|
|
|
|
|
+ if (now.after(DateUtil.offsetDay(relation.getExpiryTime(), -5))) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (relation.getUserId() != 0 && isPrd) {
|
|
|
|
|
+ String msg = String.format(Constant.CHANGE_GROUPS_TRIPS_ACCOUNT, title);
|
|
|
|
|
+ smsService.sendSmsToRelationUser(relation.getUserId(), msg);
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|