学校添加头像,用户背景图,手机端邮箱注册

main
王宇航 2024-05-20 16:19:16 +08:00
parent eebcbd1473
commit eef33a6983
22 changed files with 498 additions and 81 deletions

View File

@ -112,6 +112,24 @@
<groupId>io.swagger</groupId> <groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId> <artifactId>swagger-annotations</artifactId>
</dependency> </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> </dependencies>
</project> </project>

View File

@ -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;
}
}
}

View File

@ -14,11 +14,11 @@ spring:
nacos: nacos:
discovery: discovery:
# 服务注册地址 # 服务注册地址
server-addr: 127.0.0.1:8848 server-addr: 101.133.172.2:8848
namespace: 43773ac0-094b-44c4-892a-8a42782f8360 namespace: 43773ac0-094b-44c4-892a-8a42782f8360
config: config:
# 配置中心地址 # 配置中心地址
server-addr: 127.0.0.1:8848 server-addr: 101.133.172.2:8848
namespace: 43773ac0-094b-44c4-892a-8a42782f8360 namespace: 43773ac0-094b-44c4-892a-8a42782f8360
# 配置文件格式 # 配置文件格式
file-extension: yml file-extension: yml

View File

@ -144,6 +144,10 @@
<artifactId>green20220302</artifactId> <artifactId>green20220302</artifactId>
<version>1.0.3</version> <version>1.0.3</version>
</dependency> </dependency>
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf</artifactId>
</dependency>
</dependencies> </dependencies>

View File

@ -4,6 +4,7 @@ package com.ruoyi.app.controller;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.ruoyi.app.domain.AppRegister; import com.ruoyi.app.domain.AppRegister;
import com.ruoyi.app.domain.AppSchool;
import com.ruoyi.app.domain.AppUser; import com.ruoyi.app.domain.AppUser;
import com.ruoyi.app.domain.dto.HelperUtil; import com.ruoyi.app.domain.dto.HelperUtil;
import com.ruoyi.app.domain.dto.PayConfig; 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.LoginForm;
import com.ruoyi.app.form.RegisterForm; import com.ruoyi.app.form.RegisterForm;
import com.ruoyi.app.service.IAppRegisterService; import com.ruoyi.app.service.IAppRegisterService;
import com.ruoyi.app.service.IAppSchoolService;
import com.ruoyi.app.service.IAppUserService; import com.ruoyi.app.service.IAppUserService;
import com.ruoyi.common.core.domain.R; 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.StringUtils;
import com.ruoyi.common.core.utils.bean.BeanUtils;
import com.ruoyi.common.core.utils.ip.IpUtils; 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.IdUtils;
import com.ruoyi.common.core.utils.uuid.UUID;
import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.redis.service.RedisService; 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.service.TokenService;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.model.LoginUser; import com.ruoyi.system.api.model.LoginUser;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -27,9 +35,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.mail.MessagingException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import static com.alibaba.nacos.api.common.Constants.ACCESS_TOKEN; import static com.alibaba.nacos.api.common.Constants.ACCESS_TOKEN;
@ -37,7 +47,7 @@ import static com.alibaba.nacos.api.common.Constants.ACCESS_TOKEN;
@RestController @RestController
@RequestMapping("/app") @RequestMapping("/app")
@Api( @Api(
tags = "APP-登录接口" tags = "APP-登录接口"
) )
public class AppLoginController { public class AppLoginController {
@ -48,21 +58,51 @@ public class AppLoginController {
private IAppRegisterService appRegisterService; private IAppRegisterService appRegisterService;
@Autowired @Autowired
private static RedisService redisService; private RedisService redisService;
@Autowired
private IAppSchoolService schoolService;
@Autowired @Autowired
private TokenService tokenService; private TokenService tokenService;
@PostMapping("/register") @PostMapping("/register")
@ApiOperation(value = "注册" , notes = "注册") @ApiOperation(value = "注册", notes = "注册")
public R<?> register(@RequestBody RegisterForm registerForm) { public R<?> register(@RequestBody RegisterForm registerForm) {
AppUser appUser = appUserService.selectAppUserByPhone(registerForm.getPhoneNumber()); AppUser appUser = appUserService.selectAppUserByPhone(registerForm.getPhoneNumber());
AppRegister register = appRegisterService.selectAppRegisterByphone(registerForm.getPhoneNumber()); AppRegister register = appRegisterService.selectAppRegisterByphone(registerForm.getPhoneNumber());
Assert.notNull(registerForm.getSchoolId(), "学校id不能为空"); Assert.notNull(registerForm.getSchoolId(), "学校id不能为空");
AppSchool appSchool = schoolService.selectAppSchoolById(
registerForm.getSchoolId()
);
Assert.isNull(appUser, "手机号已注册"); Assert.isNull(appUser, "手机号已注册");
if (register != null && register.getStatus() != null) { 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) {
switch (register.getStatus()) { switch (register.getStatus()) {
@ -73,18 +113,19 @@ public class AppLoginController {
case 2: case 2:
return R.fail(201, "注册失败,您的账号已被驳回!"); 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, "申请成功,请等待审核结果!");
AppRegister appRegister = setAppRegister(registerForm);
appRegister.setInvitationCode(registerForm.getInvitationCode());
int i = appRegisterService.insertAppRegister(appRegister);
Assert.isTrue(i > 0, "注册失败");
return R.ok(null,"注册成功,请等待审核结果!");
} }
@PostMapping("/login") @PostMapping("/login")
@ApiOperation(value = "登录" , notes = "登录") @ApiOperation(value = "登录", notes = "登录")
public R<?> login(@RequestBody LoginForm loginForm) { public R<?> login(@RequestBody LoginForm loginForm) {
AppUser appUser = appUserService.selectAppUserByPhone(loginForm.getPhoneNumber()); AppUser appUser = appUserService.selectAppUserByPhone(loginForm.getPhoneNumber());
Assert.notNull(appUser, "手机号未注册"); Assert.notNull(appUser, "手机号未注册");
@ -93,7 +134,7 @@ public class AppLoginController {
// String code = (String) cacheObject; // String code = (String) cacheObject;
// Assert.isTrue(code.equals(loginForm.getCode()), "验证码错误"); // Assert.isTrue(code.equals(loginForm.getCode()), "验证码错误");
// } // }
String token = IdUtils.fastUUID(); String token = IdUtils.fastUUID();
LoginUser loginUser = new LoginUser(); LoginUser loginUser = new LoginUser();
loginUser.setUsername(appUser.getUsername()); loginUser.setUsername(appUser.getUsername());
Long userId = appUser.getId(); Long userId = appUser.getId();
@ -122,7 +163,7 @@ public class AppLoginController {
} }
@PostMapping("/accessToken") @PostMapping("/accessToken")
@ApiOperation(value = "accessToken登录" , notes = "accessToken登录") @ApiOperation(value = "accessToken登录", notes = "accessToken登录")
public R<?> accessToken(@RequestBody AppLoginUser loginUser) { public R<?> accessToken(@RequestBody AppLoginUser loginUser) {
LoginUser loginUser1 = tokenService.getLoginUser(loginUser.getAccessToken()); LoginUser loginUser1 = tokenService.getLoginUser(loginUser.getAccessToken());
Assert.notNull(loginUser1, "token失效"); Assert.notNull(loginUser1, "token失效");
@ -131,29 +172,90 @@ public class AppLoginController {
} }
@GetMapping("/info") @GetMapping("/info")
@ApiOperation(value = "获取用户信息" , notes = "获取用户信息") @ApiOperation(value = "获取用户信息", notes = "获取用户信息")
public R<?> info(HttpServletRequest request,@RequestParam(name = "userId")Long userId) { public R<?> info(HttpServletRequest request, @RequestParam(name = "userId") Long userId) {
AppUserVo appUserVo = appUserService.selectAppUserById(userId); AppUserVo appUserVo = appUserService.selectAppUserById(userId);
return R.ok(appUserVo); return R.ok(appUserVo);
} }
@RequestMapping("/getAccessToken") @RequestMapping("/getAccessToken")
@ApiOperation(value = "微信token" , notes = "微信token") @ApiOperation(value = "微信token", notes = "微信token")
public AjaxResult getAccessToken(@RequestParam String code) { 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("appid", PayConfig.APPID);
map.put("secret", PayConfig.appSecret); map.put("secret", PayConfig.appSecret);
map.put("code",code); map.put("code", code);
map.put("grant_type","authorization_code"); map.put("grant_type", "authorization_code");
try { try {
String resultStr = HelperUtil.sendHttpGet(PayConfig.access_token, map); 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); return AjaxResult.success(json);
} catch (Exception e) { } catch (Exception e) {
} }
return AjaxResult.success(null); 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>";
}
} }

View File

@ -137,4 +137,11 @@ public class AppUserController extends BaseController
List<AppUserInfoVo> list = appUserService.listUser(appUser); List<AppUserInfoVo> list = appUserService.listUser(appUser);
return getDataTable(list); 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));
}
} }

View File

@ -206,6 +206,25 @@ public class PayController extends BaseController
return AjaxResult.success(); 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") @PostMapping("/wechatPrePay")
@ApiOperation(value = "微信支付", notes = "微信支付", httpMethod = "POST") @ApiOperation(value = "微信支付", notes = "微信支付", httpMethod = "POST")
public AjaxResult wechatPrePay(@RequestBody AppOrderArg appOrderArg) { public AjaxResult wechatPrePay(@RequestBody AppOrderArg appOrderArg) {

View File

@ -11,43 +11,67 @@ import com.ruoyi.common.core.web.domain.BaseEntity;
* @author wyh * @author wyh
* @date 2024-04-18 * @date 2024-04-18
*/ */
public class AppSchool extends BaseEntity public class AppSchool extends BaseEntity {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 学校id */ /**
* id
*/
private Long id; private Long id;
/** 学校名称 */ /**
*
*/
@Excel(name = "学校名称") @Excel(name = "学校名称")
private String 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; this.id = id;
} }
public Long getId() public Long getId() {
{
return id; return id;
} }
public void setName(String name)
{ public void setName(String name) {
this.name = name; this.name = name;
} }
public String getName() public String getName() {
{
return name; return name;
} }
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId()) .append("id", getId())
.append("name", getName()) .append("name", getName())
.append("createTime", getCreateTime()) .append("createTime", getCreateTime())
.append("updateTime", getUpdateTime()) .append("updateTime", getUpdateTime())
.toString(); .append("email", getEmail())
.append("schoolImg", getSchoolImg())
.toString();
} }
} }

View File

@ -168,6 +168,10 @@ public class AppUser extends BaseEntity
private int status; private int status;
private Integer check;
private String backGroundImg;
/** 订单记录 */ /** 订单记录 */
@Excel(name = "订单记录") @Excel(name = "订单记录")
private Long orderId; private Long orderId;
@ -470,6 +474,14 @@ public class AppUser extends BaseEntity
return other; return other;
} }
public Integer getCheck() {
return check;
}
public void setCheck(Integer check) {
this.check = check;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -506,6 +518,7 @@ public class AppUser extends BaseEntity
.append("hobby", getHobby()) .append("hobby", getHobby())
.append("city", getCity()) .append("city", getCity())
.append("other", getOther()) .append("other", getOther())
.append("check", getCheck())
.toString(); .toString();
} }
} }

View File

@ -17,7 +17,6 @@ public class UseExchangeArg
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 城市id */
private String code; private String code;
private Long userId; private Long userId;

View File

@ -71,4 +71,8 @@ public interface AppUserMapper
void updateAppUserById(@Param("ids")List<Long> ids); void updateAppUserById(@Param("ids")List<Long> ids);
List<AppUserInfoVo> listUser(AppUser appUser); List<AppUserInfoVo> listUser(AppUser appUser);
AppUser selectAppUserByEmail(String email);
int vipById(@Param("id")Long id);
} }

View File

@ -5,13 +5,13 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Component //@Component
@ConfigurationProperties(prefix = "alisms") //@ConfigurationProperties(prefix = "alisms")
@Data @Data
public class AliSmsProperties { public class AliSmsProperties {
@Value(value = "${alisms.accessKeyId}") // @Value(value = "${alisms.accessKeyId}")
private String accessKeyId; private String accessKeyId;
@Value(value = "${alisms.accessKeySecret}") // @Value(value = "${alisms.accessKeySecret}")
private String accessKeySecret; private String accessKeySecret;
} }

View File

@ -67,4 +67,8 @@ public interface IAppUserService
public AppUserNetVo userNetData(AppUser appUser); public AppUserNetVo userNetData(AppUser appUser);
List<AppUserInfoVo> listUser(AppUser appUser); List<AppUserInfoVo> listUser(AppUser appUser);
AppUser selectAppUserByEmail(String email);
int vipById(Long id);
} }

View File

@ -10,7 +10,7 @@ import java.util.List;
@Component @Component
public class ScheduledService { public class ScheduledService {
@Autowired @Autowired
private AppUserMapper appUserMapper; private AppUserMapper appUserMapper;
@Scheduled(cron = "0/5 * * * * *") @Scheduled(cron = "0/5 * * * * *")
public void updateUserMember(){ public void updateUserMember(){

View File

@ -12,12 +12,16 @@ import com.ruoyi.app.mapper.AppUserMapper;
import com.ruoyi.common.core.utils.DateUtils; import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.utils.bean.BeanUtils; 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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.app.mapper.AppRegisterMapper; import com.ruoyi.app.mapper.AppRegisterMapper;
import com.ruoyi.app.domain.AppRegister; import com.ruoyi.app.domain.AppRegister;
import com.ruoyi.app.service.IAppRegisterService; import com.ruoyi.app.service.IAppRegisterService;
import javax.mail.MessagingException;
/** /**
* Service * Service
* *
@ -156,4 +160,19 @@ public class AppRegisterServiceImpl implements IAppRegisterService
return appRegisterMapper.selectAppRegisterByphone(phoneNumber); 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);
}
}
} }

View File

@ -243,4 +243,15 @@ public class AppUserServiceImpl implements IAppUserService
appUser.setIds(ids); appUser.setIds(ids);
return appUserMapper.listUser(appUser); return appUserMapper.listUser(appUser);
} }
@Override
public AppUser selectAppUserByEmail(String email) {
return appUserMapper.selectAppUserByEmail(email);
}
@Override
public int vipById(Long id) {
return appUserMapper.vipById(id);
}
} }

View File

@ -21,31 +21,31 @@ import java.util.concurrent.TimeUnit;
@Component @Component
public class SendNoteUtil { public class SendNoteUtil {
/** // /**
* accessKeyId "fEZZyFvWkETS8Clm73f7qmY9ohcTpc" // * 阿里云 accessKeyId "fEZZyFvWkETS8Clm73f7qmY9ohcTpc"
*/ // */
@Value("${alisms.accessKeyId}") // @Value("${alisms.accessKeyId}")
private String accessKeyId; // private String accessKeyId;
//
/** // /**
* secret "LTAI5tM1LeE2pkiS3qEFQkfb" // * 阿里云 secret "LTAI5tM1LeE2pkiS3qEFQkfb"
*/ // */
@Value("${alisms.accessKeySecret}") // @Value("${alisms.accessKeySecret}")
private String accessKeySecret; // private String accessKeySecret;
@Autowired // @Autowired
private AliSmsProperties aliSmsProperties; // private AliSmsProperties aliSmsProperties;
/** /**
* *
*/ */
@Value("${alisms.signName}") // @Value("${alisms.signName}")
private String signName; private String signName = "丙煜";
/** /**
* Code * Code
*/ */
@Value("${alisms.templateCode}") // @Value("${alisms.templateCode}")
private String templateCode; private String templateCode = "SMS_465690552";
/** /**

View File

@ -9,10 +9,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="name" column="name" /> <result property="name" column="name" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="email" column="email" />
<result property="schoolImg" column="school_img" />
</resultMap> </resultMap>
<sql id="selectAppSchoolVo"> <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> </sql>
<select id="selectAppSchoolList" parameterType="AppSchool" resultMap="AppSchoolResult"> <select id="selectAppSchoolList" parameterType="AppSchool" resultMap="AppSchoolResult">
@ -30,17 +32,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertAppSchool" parameterType="AppSchool"> <insert id="insertAppSchool" parameterType="AppSchool">
insert into app_school insert into app_school
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if> <if test="id != null">
<if test="name != null">name,</if> id,
<if test="createTime != null">create_time,</if> </if>
<if test="updateTime != null">update_time,</if> <if test="name != null">
</trim> 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=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if> <if test="id != null">
<if test="name != null">#{name},</if> #{id},
<if test="createTime != null">#{createTime},</if> </if>
<if test="updateTime != null">#{updateTime},</if> <if test="name != null">
</trim> #{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> </insert>
<update id="updateAppSchool" parameterType="AppSchool"> <update id="updateAppSchool" parameterType="AppSchool">
@ -49,6 +79,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="name != null">name = #{name},</if> <if test="name != null">name = #{name},</if>
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</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> </trim>
where id = #{id} where id = #{id}
</update> </update>

View File

@ -21,7 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectAppUserDynamicVo"> <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> </sql>
<select id="selectAppUserDynamicList" parameterType="AppUserDynamic" resultMap="AppUserDynamicResult"> <select id="selectAppUserDynamicList" parameterType="AppUserDynamic" resultMap="AppUserDynamicResult">

View File

@ -42,6 +42,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="orderId" column="order_id" /> <result property="orderId" column="order_id" />
<result property="orderStartTime" column="order_start_time" /> <result property="orderStartTime" column="order_start_time" />
<result property="orderEndTime" column="order_end_time" /> <result property="orderEndTime" column="order_end_time" />
<result property="check" column="check" />
<result property="backGroundImg" column="back_ground_img" />
</resultMap> </resultMap>
<sql id="appUserColumns"> <sql id="appUserColumns">
a.id as "id", a.id as "id",
@ -79,12 +81,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.is_member as "isMember", a.is_member as "isMember",
a.order_id as "orderId", a.order_id as "orderId",
a.order_start_time as "orderStartTime", 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>
<sql id="selectAppUserVo"> <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, 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> </sql>
<select id="selectAppUserList" parameterType="AppUser" resultMap="AppUserResult"> <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="orderId != null "> and order_id = #{orderId}</if>
<if test="orderStartTime != null "> and order_start_time = #{orderStartTime}</if> <if test="orderStartTime != null "> and order_start_time = #{orderStartTime}</if>
<if test="orderEndTime != null "> and order_end_time = #{orderEndTime}</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> </where>
</select> </select>
@ -246,6 +252,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="orderId != null">order_id,</if> <if test="orderId != null">order_id,</if>
<if test="orderStartTime != null">order_start_time,</if> <if test="orderStartTime != null">order_start_time,</if>
<if test="orderEndTime != null">order_end_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>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="username != null">#{username},</if> <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="orderId != null">#{orderId},</if>
<if test="orderStartTime != null">#{orderStartTime},</if> <if test="orderStartTime != null">#{orderStartTime},</if>
<if test="orderEndTime != null">#{orderEndTime},</if> <if test="orderEndTime != null">#{orderEndTime},</if>
<if test="check != null">#{check},</if>
<if test="backGroundImg != null">#{backGroundImg},</if>
</trim> </trim>
</insert> </insert>
@ -326,6 +336,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="orderId != null">order_id = #{orderId},</if> <if test="orderId != null">order_id = #{orderId},</if>
<if test="orderStartTime != null">order_start_time = #{orderStartTime},</if> <if test="orderStartTime != null">order_start_time = #{orderStartTime},</if>
<if test="orderEndTime != null">order_end_time = #{orderEndTime},</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> </trim>
where id = #{id} where id = #{id}
</update> </update>
@ -344,4 +356,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectAppUserByPhone" resultType="com.ruoyi.app.domain.AppUser"> <select id="selectAppUserByPhone" resultType="com.ruoyi.app.domain.AppUser">
<include refid="selectAppUserVo"/> where phone = #{phoneNumber} <include refid="selectAppUserVo"/> where phone = #{phoneNumber}
</select> </select>
<select id="selectAppUserByEmail" resultType="com.ruoyi.app.domain.AppUser">
<include refid="selectAppUserVo"/> where email = #{email}
</select>
<update id="vipById">
</update>
</mapper> </mapper>

View File

@ -14,11 +14,11 @@ spring:
nacos: nacos:
discovery: discovery:
# 服务注册地址 # 服务注册地址
server-addr: 127.0.0.1:8848 server-addr: 101.133.172.2:8848
namespace: 43773ac0-094b-44c4-892a-8a42782f8360 namespace: 43773ac0-094b-44c4-892a-8a42782f8360
config: config:
# 配置中心地址 # 配置中心地址
server-addr: 127.0.0.1:8848 server-addr: 101.133.172.2:8848
namespace: 43773ac0-094b-44c4-892a-8a42782f8360 namespace: 43773ac0-094b-44c4-892a-8a42782f8360
# 配置文件格式 # 配置文件格式
file-extension: yml file-extension: yml

18
pom.xml
View File

@ -239,6 +239,19 @@
<artifactId>aliyun-java-sdk-dysmsapi</artifactId> <artifactId>aliyun-java-sdk-dysmsapi</artifactId>
<version>1.0.0</version> <version>1.0.0</version>
</dependency> </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> </dependencies>
</dependencyManagement> </dependencyManagement>
@ -299,6 +312,11 @@
<enabled>true</enabled> <enabled>true</enabled>
</releases> </releases>
</repository> </repository>
<repository>
<id>mailclient</id>
<name>mailclient</name>
<url>https://ncimvn.nci.nih.gov/nexus/content/repositories/releases/</url>
</repository>
</repositories> </repositories>
<pluginRepositories> <pluginRepositories>