|
@@ -14,18 +14,11 @@ import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
-import com.aliyuncs.DefaultAcsClient;
|
|
|
|
|
-import com.aliyuncs.IAcsClient;
|
|
|
|
|
-import com.aliyuncs.exceptions.ClientException;
|
|
|
|
|
-import com.aliyuncs.exceptions.ServerException;
|
|
|
|
|
-import com.aliyuncs.profile.DefaultProfile;
|
|
|
|
|
-import com.aliyuncs.profile.IClientProfile;
|
|
|
|
|
-import com.aliyuncs.sms.model.v20160927.SingleSendSmsRequest;
|
|
|
|
|
-import com.aliyuncs.sms.model.v20160927.SingleSendSmsResponse;
|
|
|
|
|
import com.goafanti.common.constant.AFTConstants;
|
|
import com.goafanti.common.constant.AFTConstants;
|
|
|
import com.goafanti.common.model.PatentCost;
|
|
import com.goafanti.common.model.PatentCost;
|
|
|
import com.goafanti.common.utils.DateUtils;
|
|
import com.goafanti.common.utils.DateUtils;
|
|
|
import com.goafanti.common.utils.LoggerUtils;
|
|
import com.goafanti.common.utils.LoggerUtils;
|
|
|
|
|
+import com.goafanti.common.utils.MobileMessageUtils;
|
|
|
import com.goafanti.patent.bo.PatentAnnualFeeTaskBo;
|
|
import com.goafanti.patent.bo.PatentAnnualFeeTaskBo;
|
|
|
import com.goafanti.patent.bo.PatentExpireBo;
|
|
import com.goafanti.patent.bo.PatentExpireBo;
|
|
|
import com.goafanti.patent.service.PatentCostService;
|
|
import com.goafanti.patent.service.PatentCostService;
|
|
@@ -44,6 +37,9 @@ public class PatentTask {
|
|
|
@Value(value = "${accessSecret}")
|
|
@Value(value = "${accessSecret}")
|
|
|
private String accessSecret = null;
|
|
private String accessSecret = null;
|
|
|
|
|
|
|
|
|
|
+ @Value(value = "${patentTemplate}")
|
|
|
|
|
+ private String patentTemplate = null;
|
|
|
|
|
+
|
|
|
private static final String LEAP_DAY = "02-29";
|
|
private static final String LEAP_DAY = "02-29";
|
|
|
|
|
|
|
|
private static final String LEAP_DAY_ADD = "03-01";
|
|
private static final String LEAP_DAY_ADD = "03-01";
|
|
@@ -130,25 +126,9 @@ public class PatentTask {
|
|
|
|
|
|
|
|
@SuppressWarnings("unused")
|
|
@SuppressWarnings("unused")
|
|
|
private void sendMessage(PatentExpireBo p) {
|
|
private void sendMessage(PatentExpireBo p) {
|
|
|
- IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKey, accessSecret);
|
|
|
|
|
- try {
|
|
|
|
|
- DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", "Sms", "sms.aliyuncs.com");
|
|
|
|
|
- } catch (ClientException e1) {
|
|
|
|
|
- }
|
|
|
|
|
- IAcsClient client = new DefaultAcsClient(profile);
|
|
|
|
|
- SingleSendSmsRequest request = new SingleSendSmsRequest();
|
|
|
|
|
- try {
|
|
|
|
|
- request.setSignName("阿凡提信息科技");// {\"code\":\""+mobileVerifyCode+"\"}
|
|
|
|
|
- request.setTemplateCode("SMS_37845022");
|
|
|
|
|
- request.setParamString(
|
|
|
|
|
- "{\"code\":\"" + p.getSerialNumber() + p.getPatentName() + "\",\"product\":\"阿凡提信息科技\"}");
|
|
|
|
|
- request.setRecNum(p.getMobile());
|
|
|
|
|
- SingleSendSmsResponse httpResponse = client.getAcsResponse(request);
|
|
|
|
|
- } catch (ServerException e) {
|
|
|
|
|
- LoggerUtils.fmtError(getClass(), e, "服务器端手机短信异常:%s", e.getMessage());
|
|
|
|
|
- } catch (ClientException e) {
|
|
|
|
|
- LoggerUtils.fmtError(getClass(), e, "客户端手机短信异常:%s", e.getMessage());
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ String paramString = "{\"patentName\":\"" + p.getPatentName() + "\",\"patentNumber\":\"" + p.getPatentNumber()
|
|
|
|
|
+ + "\"}";
|
|
|
|
|
+ MobileMessageUtils.sendMessage(patentTemplate, paramString, p.getMobile(), accessKey, accessSecret);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|