学校添加头像,用户背景图,手机端邮箱注册
parent
eebcbd1473
commit
eef33a6983
|
|
@ -112,6 +112,24 @@
|
|||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.mail</groupId>
|
||||
<artifactId>mail</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.thymeleaf</groupId>
|
||||
<artifactId>thymeleaf</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/gov.nih.nci.cbiit.scimgmt.i2erest.mailsender/mailclient -->
|
||||
<dependency>
|
||||
<groupId>gov.nih.nci.cbiit.scimgmt.i2erest.mailsender</groupId>
|
||||
<artifactId>mailclient</artifactId>
|
||||
<version>5.0.1</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,124 @@
|
|||
package com.ruoyi.common.core.utils.mail;
|
||||
|
||||
|
||||
import gov.nih.nci.cbiit.scimgmt.i2erest.mailsender.resttemplate.MailClientRestTemplateHeaderInterceptor;
|
||||
import org.thymeleaf.context.Context;
|
||||
|
||||
import javax.mail.*;
|
||||
import javax.mail.internet.InternetAddress;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
import java.util.Properties;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class MailUtil {
|
||||
/**
|
||||
* 使用网易邮箱发送邮件
|
||||
*
|
||||
* @param to 给谁发
|
||||
* @param text 发送内容
|
||||
*/
|
||||
public static void send_mail(String to, String text) throws MessagingException {
|
||||
//创建连接对象 连接到邮件服务器
|
||||
Properties properties = new Properties();
|
||||
//设置发送邮件的基本参数
|
||||
//发送邮件服务器
|
||||
|
||||
properties.put("mail.smtp.host", "smtp.163.com");
|
||||
//发送端口
|
||||
properties.put("mail.smtp.port", "25");
|
||||
properties.put("mail.smtp.auth", "true");
|
||||
|
||||
//设置发送邮件的账号和密码
|
||||
Session session = Session.getInstance(properties, new Authenticator() {
|
||||
@Override
|
||||
protected javax.mail.PasswordAuthentication getPasswordAuthentication() {
|
||||
|
||||
// return new javax.mail.PasswordAuthentication("你的网易邮箱", "你的网易邮箱授权码");
|
||||
return new javax.mail.PasswordAuthentication("wyhxjl994@163.com", "LYBNRTMBJQTITPNE");
|
||||
}
|
||||
});
|
||||
|
||||
//创建邮件对象
|
||||
Message message = new MimeMessage(session);
|
||||
//设置发件人
|
||||
try {
|
||||
message.setFrom(new InternetAddress("wyhxjl994@163.com"));
|
||||
//设置收件人
|
||||
message.setRecipient(Message.RecipientType.TO, new InternetAddress(to));
|
||||
//设置主题
|
||||
message.setSubject("欢迎注册干杯Go big社交平台!");
|
||||
//设置邮件正文 第二个参数是邮件发送的类型
|
||||
message.setContent(text, "text/html;charset=UTF-8");
|
||||
//发送一封邮件
|
||||
|
||||
Transport.send(message);
|
||||
} catch (javax.mail.MessagingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用qq邮箱发送邮件
|
||||
*
|
||||
* @param to 给谁发
|
||||
* @param text 发送内容
|
||||
*/
|
||||
public static void send_mail2(String to, String text) throws MessagingException {
|
||||
//创建连接对象 连接到邮件服务器
|
||||
Properties properties = new Properties();
|
||||
//设置发送邮件的基本参数
|
||||
//发送邮件服务器
|
||||
|
||||
properties.put("mail.smtp.host", "smtp.qq.com");
|
||||
//发送端口
|
||||
properties.put("mail.smtp.port", "587");
|
||||
properties.put("mail.smtp.auth", "true");
|
||||
|
||||
|
||||
//设置发送邮件的账号和密码
|
||||
Session session = Session.getInstance(properties, new Authenticator() {
|
||||
@Override
|
||||
protected javax.mail.PasswordAuthentication getPasswordAuthentication() {
|
||||
// return new javax.mail.PasswordAuthentication("你的QQ邮箱", "你的qq邮箱授权码");
|
||||
return new javax.mail.PasswordAuthentication("1741258558@qq.com", "sxmvraycsmkaddag");
|
||||
}
|
||||
});
|
||||
|
||||
//创建邮件对象
|
||||
Message message = new MimeMessage(session);
|
||||
//设置发件人
|
||||
try {
|
||||
message.setFrom(new InternetAddress("1741258558@qq.com"));
|
||||
//设置收件人
|
||||
message.setRecipient(Message.RecipientType.TO, new InternetAddress(to));
|
||||
//设置主题
|
||||
message.setSubject("欢迎注册干杯Go big社交平台!");
|
||||
//设置邮件正文 第二个参数是邮件发送的类型
|
||||
message.setContent(text, "text/html;charset=UTF-8");
|
||||
|
||||
//发送一封邮件
|
||||
Transport.send(message);
|
||||
} catch (javax.mail.MessagingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//邮箱格式的验证
|
||||
public static boolean validEmail(String userEmail) {
|
||||
Pattern p = Pattern.compile("[a-zA-Z0-9]+@[A-Za-z0-9]+\\.[a-z0-9]");
|
||||
Matcher m = p.matcher(userEmail);
|
||||
if(m.find()){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -14,11 +14,11 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 101.133.172.2:8848
|
||||
namespace: 43773ac0-094b-44c4-892a-8a42782f8360
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 101.133.172.2:8848
|
||||
namespace: 43773ac0-094b-44c4-892a-8a42782f8360
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
|
|
|
|||
|
|
@ -144,6 +144,10 @@
|
|||
<artifactId>green20220302</artifactId>
|
||||
<version>1.0.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.thymeleaf</groupId>
|
||||
<artifactId>thymeleaf</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ package com.ruoyi.app.controller;
|
|||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.app.domain.AppRegister;
|
||||
import com.ruoyi.app.domain.AppSchool;
|
||||
import com.ruoyi.app.domain.AppUser;
|
||||
import com.ruoyi.app.domain.dto.HelperUtil;
|
||||
import com.ruoyi.app.domain.dto.PayConfig;
|
||||
|
|
@ -12,14 +13,21 @@ import com.ruoyi.app.form.AppLoginUser;
|
|||
import com.ruoyi.app.form.LoginForm;
|
||||
import com.ruoyi.app.form.RegisterForm;
|
||||
import com.ruoyi.app.service.IAppRegisterService;
|
||||
import com.ruoyi.app.service.IAppSchoolService;
|
||||
import com.ruoyi.app.service.IAppUserService;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.utils.JwtUtils;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.common.core.utils.bean.BeanUtils;
|
||||
import com.ruoyi.common.core.utils.ip.IpUtils;
|
||||
import com.ruoyi.common.core.utils.mail.MailUtil;
|
||||
import com.ruoyi.common.core.utils.uuid.IdUtils;
|
||||
import com.ruoyi.common.core.utils.uuid.UUID;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.redis.service.RedisService;
|
||||
import com.ruoyi.common.security.auth.AuthUtil;
|
||||
import com.ruoyi.common.security.service.TokenService;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.system.api.model.LoginUser;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
|
@ -27,9 +35,11 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.util.Assert;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.mail.MessagingException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static com.alibaba.nacos.api.common.Constants.ACCESS_TOKEN;
|
||||
|
|
@ -48,20 +58,50 @@ public class AppLoginController {
|
|||
private IAppRegisterService appRegisterService;
|
||||
|
||||
@Autowired
|
||||
private static RedisService redisService;
|
||||
private RedisService redisService;
|
||||
|
||||
@Autowired
|
||||
private IAppSchoolService schoolService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@PostMapping("/register")
|
||||
@ApiOperation(value = "注册" , notes = "注册")
|
||||
@ApiOperation(value = "注册", notes = "注册")
|
||||
public R<?> register(@RequestBody RegisterForm registerForm) {
|
||||
AppUser appUser = appUserService.selectAppUserByPhone(registerForm.getPhoneNumber());
|
||||
AppRegister register = appRegisterService.selectAppRegisterByphone(registerForm.getPhoneNumber());
|
||||
|
||||
Assert.notNull(registerForm.getSchoolId(), "学校id不能为空");
|
||||
AppSchool appSchool = schoolService.selectAppSchoolById(
|
||||
registerForm.getSchoolId()
|
||||
);
|
||||
Assert.isNull(appUser, "手机号已注册");
|
||||
|
||||
if (StringUtils.isNotEmpty(registerForm.getEmail())) {
|
||||
//校验邮箱格式
|
||||
Assert.isTrue(MailUtil.validEmail(registerForm.getEmail()), "邮箱格式不正确") ;
|
||||
|
||||
//校验邮箱是否已注册
|
||||
AppUser emailUser = appUserService.selectAppUserByEmail(registerForm.getEmail());
|
||||
Assert.isNull(emailUser, "邮箱已注册");
|
||||
AppRegister appRegister = setAppRegister(registerForm);
|
||||
redisService.setCacheMapValue(IdUtils.fastUUID(),register.getEmail() , appRegister);
|
||||
appRegisterService.insertAppRegister(register);
|
||||
|
||||
Assert.isNull(emailUser, "邮箱已注册");
|
||||
try {
|
||||
String EM = "<html><body><h2>欢迎来到我们的服务!!</h2>"
|
||||
+ "<p>请点击下面的网址确认您的注册:</p>"
|
||||
+ "<p>http://localhost:9204/app/activation/"+ IdUtils.fastUUID() + "/" + register.getEmail() + "</p>"
|
||||
+ "</body></html>";
|
||||
|
||||
MailUtil.send_mail(registerForm.getEmail(), EM);
|
||||
} catch (MessagingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
} else {
|
||||
|
||||
if (register != null && register.getStatus() != null) {
|
||||
|
||||
|
||||
|
|
@ -74,17 +114,18 @@ public class AppLoginController {
|
|||
return R.fail(201, "注册失败,您的账号已被驳回!");
|
||||
}
|
||||
}
|
||||
|
||||
AppRegister appRegister = setAppRegister(registerForm);
|
||||
appRegister.setInvitationCode(registerForm.getInvitationCode());
|
||||
int i = appRegisterService.insertAppRegister(appRegister);
|
||||
|
||||
|
||||
Assert.isTrue(i > 0, "注册失败");
|
||||
return R.ok(null,"注册成功,请等待审核结果!");
|
||||
}
|
||||
return R.ok(null, "申请成功,请等待审核结果!");
|
||||
}
|
||||
|
||||
@PostMapping("/login")
|
||||
@ApiOperation(value = "登录" , notes = "登录")
|
||||
@ApiOperation(value = "登录", notes = "登录")
|
||||
public R<?> login(@RequestBody LoginForm loginForm) {
|
||||
AppUser appUser = appUserService.selectAppUserByPhone(loginForm.getPhoneNumber());
|
||||
Assert.notNull(appUser, "手机号未注册");
|
||||
|
|
@ -122,7 +163,7 @@ public class AppLoginController {
|
|||
}
|
||||
|
||||
@PostMapping("/accessToken")
|
||||
@ApiOperation(value = "accessToken登录" , notes = "accessToken登录")
|
||||
@ApiOperation(value = "accessToken登录", notes = "accessToken登录")
|
||||
public R<?> accessToken(@RequestBody AppLoginUser loginUser) {
|
||||
LoginUser loginUser1 = tokenService.getLoginUser(loginUser.getAccessToken());
|
||||
Assert.notNull(loginUser1, "token失效");
|
||||
|
|
@ -131,29 +172,90 @@ public class AppLoginController {
|
|||
}
|
||||
|
||||
@GetMapping("/info")
|
||||
@ApiOperation(value = "获取用户信息" , notes = "获取用户信息")
|
||||
public R<?> info(HttpServletRequest request,@RequestParam(name = "userId")Long userId) {
|
||||
@ApiOperation(value = "获取用户信息", notes = "获取用户信息")
|
||||
public R<?> info(HttpServletRequest request, @RequestParam(name = "userId") Long userId) {
|
||||
AppUserVo appUserVo = appUserService.selectAppUserById(userId);
|
||||
return R.ok(appUserVo);
|
||||
}
|
||||
|
||||
@RequestMapping("/getAccessToken")
|
||||
@ApiOperation(value = "微信token" , notes = "微信token")
|
||||
@ApiOperation(value = "微信token", notes = "微信token")
|
||||
public AjaxResult getAccessToken(@RequestParam String code) {
|
||||
Map<String ,String > map = new HashMap<>();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("appid", PayConfig.APPID);
|
||||
map.put("secret", PayConfig.appSecret);
|
||||
map.put("code",code);
|
||||
map.put("grant_type","authorization_code");
|
||||
map.put("code", code);
|
||||
map.put("grant_type", "authorization_code");
|
||||
try {
|
||||
String resultStr = HelperUtil.sendHttpGet(PayConfig.access_token, map);
|
||||
JSONObject json = JSON.parseObject(resultStr,JSONObject.class);
|
||||
JSONObject json = JSON.parseObject(resultStr, JSONObject.class);
|
||||
return AjaxResult.success(json);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return AjaxResult.success(null);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/mailRegister")
|
||||
@ApiOperation(value = "邮箱注册", notes = "邮箱注册")
|
||||
public R<?> mailRegister() {
|
||||
return R.ok("www.baudu.com");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@DeleteMapping("logout")
|
||||
public R<?> logout(HttpServletRequest request)
|
||||
{
|
||||
String token = SecurityUtils.getToken(request);
|
||||
if (StringUtils.isNotEmpty(token))
|
||||
{
|
||||
// 删除用户缓存记录
|
||||
AuthUtil.logoutByToken(token);
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(path = "/activation/{token}/{email}",method = RequestMethod.GET)
|
||||
public String activation(@PathVariable String token , @PathVariable String email) {
|
||||
Map<String, Object> cacheMap = redisService.getCacheMap(token);
|
||||
if (email.equals(cacheMap.get("email"))) {
|
||||
AppRegister appRegister = (AppRegister) cacheMap.get("email");
|
||||
appRegister.setStatus(1);
|
||||
appRegisterService.updateAppRegister(appRegister);
|
||||
|
||||
|
||||
AppUser appUser = new AppUser();
|
||||
BeanUtils.copyBeanProp(appUser, appRegister);
|
||||
appUserService.insertAppUser(appUser);
|
||||
}
|
||||
|
||||
|
||||
redisService.deleteObject(token);
|
||||
return "<!DOCTYPE html>\n" +
|
||||
"<html>\n" +
|
||||
"<head>\n" +
|
||||
" <title>Activation Result</title>\n" +
|
||||
" <style>\n" +
|
||||
" body {\n" +
|
||||
" font-family: Arial, sans-serif;\n" +
|
||||
" background-color: #f0f0f0;\n" +
|
||||
" text-align: center;\n" +
|
||||
" padding: 20px;\n" +
|
||||
" }\n" +
|
||||
" h2 {\n" +
|
||||
" color: #333;\n" +
|
||||
" }\n" +
|
||||
" </style>\n" +
|
||||
"</head>\n" +
|
||||
"<body>\n" +
|
||||
" <h2>注册成功!!请使用手机号进行登录~</h2>\n" +
|
||||
"</body>\n" +
|
||||
"</html>";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -137,4 +137,11 @@ public class AppUserController extends BaseController
|
|||
List<AppUserInfoVo> list = appUserService.listUser(appUser);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/vipById/{id}")
|
||||
@ApiOperation(value = "设置7天会员", notes = "设置7天会员", httpMethod = "GET")
|
||||
public AjaxResult vipById(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(appUserService.vipById(id));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -206,6 +206,25 @@ public class PayController extends BaseController
|
|||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@RequestMapping("/zero")
|
||||
@ApiOperation(value = "0元支付", notes = "兑换码支付", httpMethod = "POST")
|
||||
public AjaxResult test(@RequestBody UseExchangeArg useExchangeArg) throws ParseException {
|
||||
Long userId = useExchangeArg.getUserId();
|
||||
// 生成订单信息
|
||||
AppOrder order = new AppOrder();
|
||||
order.setPrice("0");
|
||||
order.setUserId(userId);
|
||||
order.setPayStatus(2);
|
||||
order.setPaySoure(3);
|
||||
order.setCreateTime(new Date());
|
||||
order.setLevel(1);
|
||||
appOrderMapper.insertAppOrder(order);
|
||||
|
||||
//修改用户信息
|
||||
updateUser(order);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("/wechatPrePay")
|
||||
@ApiOperation(value = "微信支付", notes = "微信支付", httpMethod = "POST")
|
||||
public AjaxResult wechatPrePay(@RequestBody AppOrderArg appOrderArg) {
|
||||
|
|
|
|||
|
|
@ -11,43 +11,67 @@ import com.ruoyi.common.core.web.domain.BaseEntity;
|
|||
* @author wyh
|
||||
* @date 2024-04-18
|
||||
*/
|
||||
public class AppSchool extends BaseEntity
|
||||
{
|
||||
public class AppSchool extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 学校id */
|
||||
/**
|
||||
* 学校id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/** 学校名称 */
|
||||
/**
|
||||
* 学校名称
|
||||
*/
|
||||
@Excel(name = "学校名称")
|
||||
private String name;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
@Excel(name = "邮箱域名后缀")
|
||||
private String email;
|
||||
|
||||
private String schoolImg;
|
||||
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getSchoolImg() {
|
||||
return schoolImg;
|
||||
}
|
||||
|
||||
public void setSchoolImg(String schoolImg) {
|
||||
this.schoolImg = schoolImg;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setName(String name)
|
||||
{
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("name", getName())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("email", getEmail())
|
||||
.append("schoolImg", getSchoolImg())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -168,6 +168,10 @@ public class AppUser extends BaseEntity
|
|||
|
||||
private int status;
|
||||
|
||||
private Integer check;
|
||||
|
||||
private String backGroundImg;
|
||||
|
||||
/** 订单记录 */
|
||||
@Excel(name = "订单记录")
|
||||
private Long orderId;
|
||||
|
|
@ -470,6 +474,14 @@ public class AppUser extends BaseEntity
|
|||
return other;
|
||||
}
|
||||
|
||||
public Integer getCheck() {
|
||||
return check;
|
||||
}
|
||||
|
||||
public void setCheck(Integer check) {
|
||||
this.check = check;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
|
|
@ -506,6 +518,7 @@ public class AppUser extends BaseEntity
|
|||
.append("hobby", getHobby())
|
||||
.append("city", getCity())
|
||||
.append("other", getOther())
|
||||
.append("check", getCheck())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ public class UseExchangeArg
|
|||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 城市id */
|
||||
private String code;
|
||||
|
||||
private Long userId;
|
||||
|
|
|
|||
|
|
@ -71,4 +71,8 @@ public interface AppUserMapper
|
|||
void updateAppUserById(@Param("ids")List<Long> ids);
|
||||
|
||||
List<AppUserInfoVo> listUser(AppUser appUser);
|
||||
|
||||
AppUser selectAppUserByEmail(String email);
|
||||
|
||||
int vipById(@Param("id")Long id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@ import org.springframework.beans.factory.annotation.Value;
|
|||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "alisms")
|
||||
//@Component
|
||||
//@ConfigurationProperties(prefix = "alisms")
|
||||
@Data
|
||||
public class AliSmsProperties {
|
||||
@Value(value = "${alisms.accessKeyId}")
|
||||
// @Value(value = "${alisms.accessKeyId}")
|
||||
private String accessKeyId;
|
||||
@Value(value = "${alisms.accessKeySecret}")
|
||||
// @Value(value = "${alisms.accessKeySecret}")
|
||||
private String accessKeySecret;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,4 +67,8 @@ public interface IAppUserService
|
|||
public AppUserNetVo userNetData(AppUser appUser);
|
||||
|
||||
List<AppUserInfoVo> listUser(AppUser appUser);
|
||||
|
||||
AppUser selectAppUserByEmail(String email);
|
||||
|
||||
int vipById(Long id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,12 +12,16 @@ import com.ruoyi.app.mapper.AppUserMapper;
|
|||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.common.core.utils.bean.BeanUtils;
|
||||
import com.ruoyi.common.core.utils.mail.MailUtil;
|
||||
import com.ruoyi.common.core.utils.uuid.IdUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.app.mapper.AppRegisterMapper;
|
||||
import com.ruoyi.app.domain.AppRegister;
|
||||
import com.ruoyi.app.service.IAppRegisterService;
|
||||
|
||||
import javax.mail.MessagingException;
|
||||
|
||||
/**
|
||||
* 注册审核Service业务层处理
|
||||
*
|
||||
|
|
@ -156,4 +160,19 @@ public class AppRegisterServiceImpl implements IAppRegisterService
|
|||
|
||||
return appRegisterMapper.selectAppRegisterByphone(phoneNumber);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
String token = "4e290542-53f3-4a33-96ff-9510dd050100";
|
||||
String email = "653809315@qq.com";
|
||||
String EM = "<html><body><h2>欢迎来到我们的服务!!</h2>"
|
||||
+ "<p>请点击下面的网址确认您的注册:</p>"
|
||||
+ "<p>http://localhost:9204/app/activation/"+ token + "/" + email + "</p>"
|
||||
+ "</body></html>";
|
||||
try {
|
||||
MailUtil.send_mail( "653809315@qq.com",EM);
|
||||
} catch (MessagingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -243,4 +243,15 @@ public class AppUserServiceImpl implements IAppUserService
|
|||
appUser.setIds(ids);
|
||||
return appUserMapper.listUser(appUser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppUser selectAppUserByEmail(String email) {
|
||||
|
||||
return appUserMapper.selectAppUserByEmail(email);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int vipById(Long id) {
|
||||
return appUserMapper.vipById(id);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,31 +21,31 @@ import java.util.concurrent.TimeUnit;
|
|||
@Component
|
||||
public class SendNoteUtil {
|
||||
|
||||
/**
|
||||
* 阿里云 accessKeyId : "fEZZyFvWkETS8Clm73f7qmY9ohcTpc"
|
||||
*/
|
||||
@Value("${alisms.accessKeyId}")
|
||||
private String accessKeyId;
|
||||
|
||||
/**
|
||||
* 阿里云 secret : "LTAI5tM1LeE2pkiS3qEFQkfb"
|
||||
*/
|
||||
@Value("${alisms.accessKeySecret}")
|
||||
private String accessKeySecret;
|
||||
@Autowired
|
||||
private AliSmsProperties aliSmsProperties;
|
||||
// /**
|
||||
// * 阿里云 accessKeyId : "fEZZyFvWkETS8Clm73f7qmY9ohcTpc"
|
||||
// */
|
||||
// @Value("${alisms.accessKeyId}")
|
||||
// private String accessKeyId;
|
||||
//
|
||||
// /**
|
||||
// * 阿里云 secret : "LTAI5tM1LeE2pkiS3qEFQkfb"
|
||||
// */
|
||||
// @Value("${alisms.accessKeySecret}")
|
||||
// private String accessKeySecret;
|
||||
// @Autowired
|
||||
// private AliSmsProperties aliSmsProperties;
|
||||
|
||||
/**
|
||||
* 阿里云签名
|
||||
*/
|
||||
@Value("${alisms.signName}")
|
||||
private String signName;
|
||||
// @Value("${alisms.signName}")
|
||||
private String signName = "丙煜";
|
||||
|
||||
/**
|
||||
* 阿里云短信模板Code
|
||||
*/
|
||||
@Value("${alisms.templateCode}")
|
||||
private String templateCode;
|
||||
// @Value("${alisms.templateCode}")
|
||||
private String templateCode = "SMS_465690552";
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -9,10 +9,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="name" column="name" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="email" column="email" />
|
||||
<result property="schoolImg" column="school_img" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectAppSchoolVo">
|
||||
select id, name, create_time, update_time from app_school
|
||||
select id, name, create_time, update_time , email , school_img from app_school
|
||||
</sql>
|
||||
|
||||
<select id="selectAppSchoolList" parameterType="AppSchool" resultMap="AppSchoolResult">
|
||||
|
|
@ -30,16 +32,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<insert id="insertAppSchool" parameterType="AppSchool">
|
||||
insert into app_school
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="name != null">name,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="name != null">
|
||||
name,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="email != null">
|
||||
email,
|
||||
</if>
|
||||
<if test="schoolImg != null">
|
||||
school_img,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="name != null">#{name},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="id != null">
|
||||
#{id},
|
||||
</if>
|
||||
<if test="name != null">
|
||||
#{name},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime},
|
||||
</if>
|
||||
<if test="email != null">
|
||||
#{email},
|
||||
</if>
|
||||
<if test="schoolImg != null">
|
||||
#{schoolImg},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
|
@ -49,6 +79,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="name != null">name = #{name},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="email != null">email = #{email},</if>
|
||||
<if test="schoolImg != null">school_img = #{schoolImg},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectAppUserDynamicVo">
|
||||
select id, user_id, content, video_url, topic_id, address, privacy_status, remark, create_time, update_time, create_by, updateBy,is_top ,city_id , province_id , townId from app_user_dynamic
|
||||
select id, user_id, content, video_url, topic_id, address, privacy_status, remark, create_time, update_time, create_by, updateBy,is_top ,city_id , province_id , town_id from app_user_dynamic
|
||||
</sql>
|
||||
|
||||
<select id="selectAppUserDynamicList" parameterType="AppUserDynamic" resultMap="AppUserDynamicResult">
|
||||
|
|
|
|||
|
|
@ -42,6 +42,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="orderId" column="order_id" />
|
||||
<result property="orderStartTime" column="order_start_time" />
|
||||
<result property="orderEndTime" column="order_end_time" />
|
||||
<result property="check" column="check" />
|
||||
<result property="backGroundImg" column="back_ground_img" />
|
||||
</resultMap>
|
||||
<sql id="appUserColumns">
|
||||
a.id as "id",
|
||||
|
|
@ -79,12 +81,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
a.is_member as "isMember",
|
||||
a.order_id as "orderId",
|
||||
a.order_start_time as "orderStartTime",
|
||||
a.order_end_time as "orderEndTime"
|
||||
a.order_end_time as "orderEndTime" ,
|
||||
a.`check` as "check",
|
||||
a.back_ground_img as "backGroundImg"
|
||||
</sql>
|
||||
|
||||
<sql id="selectAppUserVo">
|
||||
select id, username, password, nickname, email, phone, address, create_time, update_time, avatar_url, education, school, major, start_time, end_time, experience, company_name, industry, job_time, job_name, job_type, skill_id, job_content, type,is_member,job_end_time,
|
||||
order_id, order_start_time, order_end_time from app_user
|
||||
order_id, order_start_time, order_end_time , `check` , back_ground_img from app_user
|
||||
</sql>
|
||||
|
||||
<select id="selectAppUserList" parameterType="AppUser" resultMap="AppUserResult">
|
||||
|
|
@ -124,6 +128,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="orderId != null "> and order_id = #{orderId}</if>
|
||||
<if test="orderStartTime != null "> and order_start_time = #{orderStartTime}</if>
|
||||
<if test="orderEndTime != null "> and order_end_time = #{orderEndTime}</if>
|
||||
<if test="check != null "> and `check` = #{check}</if>
|
||||
<if test="backGroundImg != null "> and back_ground_img = #{backGroundImg}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
|
@ -246,6 +252,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="orderId != null">order_id,</if>
|
||||
<if test="orderStartTime != null">order_start_time,</if>
|
||||
<if test="orderEndTime != null">order_end_time,</if>
|
||||
<if test="check != null">`check`,</if>
|
||||
<if test="backGroundImg != null">`back_ground_img`,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="username != null">#{username},</if>
|
||||
|
|
@ -284,6 +292,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="orderId != null">#{orderId},</if>
|
||||
<if test="orderStartTime != null">#{orderStartTime},</if>
|
||||
<if test="orderEndTime != null">#{orderEndTime},</if>
|
||||
<if test="check != null">#{check},</if>
|
||||
<if test="backGroundImg != null">#{backGroundImg},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
|
@ -326,6 +336,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="orderId != null">order_id = #{orderId},</if>
|
||||
<if test="orderStartTime != null">order_start_time = #{orderStartTime},</if>
|
||||
<if test="orderEndTime != null">order_end_time = #{orderEndTime},</if>
|
||||
<if test="check != null">`check` = #{check},</if>
|
||||
<if test="backGroundImg != null">background_img = #{backGroundImg},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
|
@ -344,4 +356,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="selectAppUserByPhone" resultType="com.ruoyi.app.domain.AppUser">
|
||||
<include refid="selectAppUserVo"/> where phone = #{phoneNumber}
|
||||
</select>
|
||||
|
||||
<select id="selectAppUserByEmail" resultType="com.ruoyi.app.domain.AppUser">
|
||||
<include refid="selectAppUserVo"/> where email = #{email}
|
||||
</select>
|
||||
|
||||
<update id="vipById">
|
||||
</update>
|
||||
</mapper>
|
||||
|
|
@ -14,11 +14,11 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 101.133.172.2:8848
|
||||
namespace: 43773ac0-094b-44c4-892a-8a42782f8360
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 101.133.172.2:8848
|
||||
namespace: 43773ac0-094b-44c4-892a-8a42782f8360
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
|
|
|
|||
18
pom.xml
18
pom.xml
|
|
@ -239,6 +239,19 @@
|
|||
<artifactId>aliyun-java-sdk-dysmsapi</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.mail</groupId>
|
||||
<artifactId>mail</artifactId>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/gov.nih.nci.cbiit.scimgmt.i2erest.mailsender/mailclient -->
|
||||
<dependency>
|
||||
<groupId>gov.nih.nci.cbiit.scimgmt.i2erest.mailsender</groupId>
|
||||
<artifactId>mailclient</artifactId>
|
||||
<version>5.0.1</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
|
@ -299,6 +312,11 @@
|
|||
<enabled>true</enabled>
|
||||
</releases>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>mailclient</id>
|
||||
<name>mailclient</name>
|
||||
<url>https://ncimvn.nci.nih.gov/nexus/content/repositories/releases/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<pluginRepositories>
|
||||
|
|
|
|||
Loading…
Reference in New Issue