|
@@ -7,7 +7,9 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
|
import com.fdkankan.common.util.PatternUtils;
|
|
|
+import com.fdkankan.sms.SendMailAcceUtils;
|
|
|
import com.fdkankan.sms.SmsService;
|
|
|
+import com.fdkankan.ucenter.common.MailUtil;
|
|
|
import com.fdkankan.ucenter.common.PageInfo;
|
|
|
import com.fdkankan.common.util.DateUtil;
|
|
|
import com.fdkankan.ucenter.common.constants.NacosProperty;
|
|
@@ -235,46 +237,102 @@ public class UserIncrementServiceImpl extends ServiceImpl<IUserIncrementMapper,
|
|
|
List<UserIncrement> expireData30 = this.getBaseMapper().findReadyExpire(30, 0);
|
|
|
List<UserIncrement> expireData15 = this.getBaseMapper().findReadyExpire(15, 0);
|
|
|
List<UserIncrement> expireData5 = this.getBaseMapper().findReadyExpire(5, 0);
|
|
|
+ List<UserIncrement> expireData3 = this.getBaseMapper().findReadyExpire(3, 0);
|
|
|
+ List<UserIncrement> expireData0 = this.getBaseMapper().findReadyExpire(0, 0);
|
|
|
List<UserIncrement> expireData = this.getBaseMapper().findReadyExpire(-1, 1);
|
|
|
|
|
|
- Map<Long, Integer> userIds = new HashMap<>();
|
|
|
+ Map<Long, Integer> userIdsRP = new HashMap<>();
|
|
|
+ Map<Long, Integer> userIdsSE = new HashMap<>();
|
|
|
for (UserIncrement userIncrementEntity : expireData30) {
|
|
|
if(userIncrementEntity.getUserId() != null){
|
|
|
- userIds.put(userIncrementEntity.getUserId(), 30);
|
|
|
+ if("PR".equals(userIncrementEntity.getMemberLevels())){
|
|
|
+ userIdsRP.put(userIncrementEntity.getUserId(), 30);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
for (UserIncrement userIncrementEntity : expireData15) {
|
|
|
if(userIncrementEntity.getUserId() != null){
|
|
|
- userIds.put(userIncrementEntity.getUserId(), 15);
|
|
|
+ if("PR".equals(userIncrementEntity.getMemberLevels())){
|
|
|
+ userIdsRP.put(userIncrementEntity.getUserId(), 15);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
for (UserIncrement userIncrementEntity : expireData5) {
|
|
|
if(userIncrementEntity.getUserId() != null){
|
|
|
- userIds.put(userIncrementEntity.getUserId(), 5);
|
|
|
+ if("PR".equals(userIncrementEntity.getMemberLevels())){
|
|
|
+ userIdsRP.put(userIncrementEntity.getUserId(), 5);
|
|
|
+ }
|
|
|
+ if("SE".equals(userIncrementEntity.getMemberLevels())){
|
|
|
+ userIdsSE.put(userIncrementEntity.getUserId(), 5);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (UserIncrement userIncrementEntity : expireData3) {
|
|
|
+ if(userIncrementEntity.getUserId() != null){
|
|
|
+ if("SE".equals(userIncrementEntity.getMemberLevels())){
|
|
|
+ userIdsSE.put(userIncrementEntity.getUserId(), 3);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (UserIncrement userIncrementEntity : expireData0) {
|
|
|
+ if(userIncrementEntity.getUserId() != null){
|
|
|
+ if("PR".equals(userIncrementEntity.getMemberLevels())){
|
|
|
+ userIdsRP.put(userIncrementEntity.getUserId(), 0);
|
|
|
+ }
|
|
|
+ if("SE".equals(userIncrementEntity.getMemberLevels())){
|
|
|
+ userIdsSE.put(userIncrementEntity.getUserId(), 0);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
for (UserIncrement userIncrementEntity : expireData) {
|
|
|
if(userIncrementEntity.getUserId() != null){
|
|
|
- userIds.put(userIncrementEntity.getUserId(), -1);
|
|
|
+ if("PR".equals(userIncrementEntity.getMemberLevels())){
|
|
|
+ userIdsRP.put(userIncrementEntity.getUserId(), -1);
|
|
|
+ }
|
|
|
+ if("SE".equals(userIncrementEntity.getMemberLevels())){
|
|
|
+ userIdsSE.put(userIncrementEntity.getUserId(), -1);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ this.sendMsg(userIdsRP,"premium");
|
|
|
+ this.sendMsg(userIdsSE,"senior");
|
|
|
+ }
|
|
|
|
|
|
- User userEntity = null;
|
|
|
+ private void sendMsg(Map<Long, Integer> userIds,String msgType) throws Exception {
|
|
|
String cnCode = "SMS_216275556";
|
|
|
String expireCode = "SMS_216425565";
|
|
|
for (Long userId : userIds.keySet()) {
|
|
|
- userEntity = userService.getById(userId);
|
|
|
+ User userEntity = userService.getById(userId);
|
|
|
if(userEntity != null){
|
|
|
- if(StringUtil.isNotBlank(userEntity.getUserName()) && StringUtils.isNumeric(userEntity.getUserName())){
|
|
|
+ if("oss".equals(NacosProperty.uploadType) && StringUtil.isNotBlank(userEntity.getUserName()) && StringUtils.isNumeric(userEntity.getUserName())){
|
|
|
if(userIds.get(userId) == -1){
|
|
|
smsService.sendSms(userEntity.getUserName(), "{\"time\":\"" + userIds.get(userId) + "\"}", expireCode);
|
|
|
continue;
|
|
|
}
|
|
|
smsService.sendSms(userEntity.getUserName(), "{\"time\":\"" + userIds.get(userId) + "\"}", cnCode);
|
|
|
}
|
|
|
+ if("aws".equals(NacosProperty.uploadType) && StringUtil.isNotBlank(userEntity.getUserName())){
|
|
|
+ Integer days = userIds.get(userId);
|
|
|
+ if(days!=null && days >= 0){
|
|
|
+ if(days > 0){
|
|
|
+ String EN_CODE_MSG_EUR = MailUtil.EN_CODE_MSG_EUR.replace("${member}",msgType+" ");
|
|
|
+ SendMailAcceUtils.sendMail(userEntity.getUserName(),
|
|
|
+ MailUtil.EN_CODE_SUBJECT_GQ, EN_CODE_MSG_EUR.replace("${code}",String.valueOf(userIds.get(userId))),
|
|
|
+ null);
|
|
|
+ }else{
|
|
|
+ SendMailAcceUtils.sendMail(userEntity.getUserName(),
|
|
|
+ MailUtil.EN_CODE_SUBJECT_GQ, MailUtil.EN_CODE_MSG_EUR_TODAY.replace("${member}"," "+msgType),
|
|
|
+ null);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ String EN_CODE_MSG_EUR_GQ = MailUtil.EN_CODE_MSG_EUR_GQ.replace("${member}",msgType+" ");
|
|
|
+ SendMailAcceUtils.sendMail(userEntity.getUserName(),
|
|
|
+ MailUtil.EN_CODE_SUBJECT_GQ, EN_CODE_MSG_EUR_GQ,null);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|