Commit d25900a4 by 吕明尚

增加自动提示权益会员失效

parent 7669fce1
......@@ -101,6 +101,8 @@ public class RedisTask {
final long FOUR_MINUTES = 60 * 4;
//1分钟的常量
final long ONE_MINUTES = 60;
final long THREE_DAY = 60 * 24 * 3;
final long TWO_DAY = 60 * 24 * 2;
/**
......@@ -465,6 +467,12 @@ public class RedisTask {
JSONObject jsonObject = new JSONObject(value);
Date expirationTime = jsonObject.getDate("expirationTime");
Long consumerId = jsonObject.getLong("consumerId");
//判断当前的日期是否在第3天和第2天中
long expire = (expirationTime.getTime() - new Date().getTime()) / 1000 / 60 / 60;
if (TWO_DAY < expire && expire < THREE_DAY) {
SConsumer sConsumer = sConsumerService.getById(consumerId);
smsService.sendOneSms(sConsumer.getPhone(), "年度权益会员将在3天后失效,请及时续约保障权益会员的权益");
}
});
}
......
package share.system.service;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import share.system.domain.*;
import share.system.domain.vo.SmsDownResultVo;
......@@ -85,5 +85,7 @@ public interface SmsService {
* @return SUCCESS
*/
String updateDownResult(String tKey, String password, List<SmsDownResultVo> data);
JSONObject sendOneSms(String phone, String content);
}
......@@ -46,6 +46,8 @@ public class RechargeServiceImpl extends ServiceImpl<RechargeMapper, Recharge> i
private ConsumerWalletService consumerWalletService;
@Autowired
private MemberConfigService memberConfigService;
@Autowired
private ISConsumptionRecordsService sConsumptionRecordsService;
/**
* 查询充值记录
......
......@@ -3,7 +3,6 @@ package share.system.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import org.slf4j.Logger;
......@@ -20,16 +19,13 @@ import share.common.utils.BaseUtil;
import share.common.utils.SmsUtil;
import share.system.domain.*;
import share.system.domain.vo.SmsDownResultVo;
import share.system.mapper.SysConfigMapper;
import share.system.service.ISysConfigService;
import share.system.service.SConsumerService;
import share.system.service.SmsLogService;
import share.system.service.SmsService;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
......@@ -368,6 +364,26 @@ public class SmsServiceImpl implements SmsService {
return null;
}
@Override
public JSONObject sendOneSms(String phone, String content) {
// 发送内容添加短信签名
String smsContent = StrUtil.concat(true, signature, content);
Long timestamp = DateUtil.date().getTime() / 1000;
JSONObject param = JSONUtil.createObj();
param.set("username", userName);
param.set("password", SecureUtil.md5(SecureUtil.md5(passWord) + timestamp));
param.set("tKey", timestamp);
param.set("mobile", phone);
param.set("content", smsContent);
param.set("time", DateUtil.now());
param.set("ext", extno);
try {
return smsUtil.postFrom(url + "/v2/sendSms", param);
} catch (BaseException exception) {
throw new BaseException(exception.getDefaultMessage());
}
}
private void checkResult(JSONObject result, SmsLog smsLog) {
smsLog.setRemark(SmsStatusEnum.getNameStr(result.getInt("code")));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment