|
@@ -4,20 +4,20 @@ import com.thoughtworks.xstream.XStream;
|
|
import com.ym.mec.collectfee.common.dao.BaseDAO;
|
|
import com.ym.mec.collectfee.common.dao.BaseDAO;
|
|
import com.ym.mec.collectfee.common.page.PageInfo;
|
|
import com.ym.mec.collectfee.common.page.PageInfo;
|
|
import com.ym.mec.collectfee.common.service.impl.BaseServiceImpl;
|
|
import com.ym.mec.collectfee.common.service.impl.BaseServiceImpl;
|
|
|
|
+import com.ym.mec.collectfee.common.sms.SmsExample;
|
|
import com.ym.mec.collectfee.dao.*;
|
|
import com.ym.mec.collectfee.dao.*;
|
|
import com.ym.mec.collectfee.entity.*;
|
|
import com.ym.mec.collectfee.entity.*;
|
|
import com.ym.mec.collectfee.service.ApplyInfoService;
|
|
import com.ym.mec.collectfee.service.ApplyInfoService;
|
|
-import com.ym.mec.collectfee.utils.CDesECB;
|
|
|
|
-import com.ym.mec.collectfee.utils.HttpUtil;
|
|
|
|
-import com.ym.mec.collectfee.utils.MapUtil;
|
|
|
|
-import com.ym.mec.collectfee.utils.XStreamUtil;
|
|
|
|
|
|
+import com.ym.mec.collectfee.utils.*;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import org.apache.commons.lang3.RandomStringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
+import javax.servlet.http.HttpSession;
|
|
import java.io.StringWriter;
|
|
import java.io.StringWriter;
|
|
import java.io.Writer;
|
|
import java.io.Writer;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
@@ -47,6 +47,22 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
|
|
|
|
|
|
@Value("${common.properties.key}")
|
|
@Value("${common.properties.key}")
|
|
private String key;
|
|
private String key;
|
|
|
|
+ @Value("${common.properties.sms-appId}")
|
|
|
|
+ private String appId;
|
|
|
|
+ @Value("${common.properties.sms-secretKey}")
|
|
|
|
+ private String secretKey;
|
|
|
|
+ @Value("${common.properties.sms-host-dev}")
|
|
|
|
+ private String host;
|
|
|
|
+ @Value("${common.properties.sms-send-request-url}")
|
|
|
|
+ private String sendUrl;
|
|
|
|
+ // 加密算法
|
|
|
|
+ private String algorithm = "AES/ECB/PKCS5Padding";
|
|
|
|
+ // 编码
|
|
|
|
+ private String encode = "UTF-8";
|
|
|
|
+ // 是否压缩
|
|
|
|
+ private boolean isGizp = true;
|
|
|
|
+
|
|
|
|
+ private final String loginVerifyCodeKey = "loginVerifyCode:";
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public BaseDAO<Integer, ApplyInfo> getDAO() {
|
|
public BaseDAO<Integer, ApplyInfo> getDAO() {
|
|
@@ -340,6 +356,26 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public boolean sendValidCode(String mobile, HttpSession session) {
|
|
|
|
+ String code = RandomStringUtils.randomNumeric(6);
|
|
|
|
+ session.setMaxInactiveInterval(900);
|
|
|
|
+ session.setAttribute(loginVerifyCodeKey + mobile,code);
|
|
|
|
+ SmsExample.setSingleSms(appId,secretKey,host,algorithm,String.format(Constants.SEND_LOGIN_SME_MSG, code),null,null,mobile,isGizp,encode);
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean verifySmsCode(String mobile,String smsCode,HttpSession session) {
|
|
|
|
+ Object attribute = session.getAttribute(loginVerifyCodeKey + mobile);
|
|
|
|
+ if(attribute != null){
|
|
|
|
+ if(StringUtils.isNotEmpty(attribute.toString()) && attribute.toString().equals(smsCode)){
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
private List<MecCourse> getCourses(String body) throws Exception{
|
|
private List<MecCourse> getCourses(String body) throws Exception{
|
|
body = getBody(body,123031);
|
|
body = getBody(body,123031);
|