Compare commits

...

3 Commits

Author SHA1 Message Date
王宇航 061afaa89a 后台bug修改 2024-05-28 13:50:34 +08:00
王宇航 c4df190033 Merge remote-tracking branch 'origin/main' 2024-05-27 11:28:34 +08:00
王宇航 eb8c94b58a 部署 2024-05-27 11:28:24 +08:00
50 changed files with 1437 additions and 297 deletions

View File

@ -0,0 +1,98 @@
package com.ruoyi.common.core.utils.mail;
import java.util.Properties;
import javax.activation.DataHandler;
import javax.activation.FileDataSource;
import javax.mail.Authenticator;
import javax.mail.BodyPart;
import javax.mail.Message;
import javax.mail.Multipart;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
import javax.mail.internet.MimeUtility;
import org.apache.commons.lang3.StringUtils;
public class ALiYunMailUtil {
private static final String SEND_ADDRESS = "mail@gbgobig.com";
private static final String SEND_PASSWORD = "ganbeigobig@2024";
private static final String HOST = "smtp.qiye.aliyun.com";
private static final String PORT = "25"; // 或80
private static final String SUBJECT = "Email verification code";
private static final String FILE_PATH = null;
private static final String CC = null;
/**
* @param content
* @param internetAddress
* @throws Exception
* @throws AddressException
*/
public static void sendMail(String content, String internetAddress) throws AddressException, Exception {
// 设置SSL连接、邮件环境
// Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
// final String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
Properties props = System.getProperties();
props.setProperty("mail.smtp.host", HOST);
// props.setProperty("mail.smtp.socketFactory.class", SSL_FACTORY);
props.setProperty("mail.smtp.socketFactory.fallback", "false");
props.setProperty("mail.smtp.port", PORT); // 设置端口
props.setProperty("mail.debug", "true"); // 启用调试
props.setProperty("mail.smtp.socketFactory.port", "465");
props.setProperty("mail.smtp.auth", "true");
// 建立邮件会话
Session session = Session.getDefaultInstance(props, new Authenticator() { // 身份认证
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(SEND_ADDRESS, SEND_PASSWORD); // 发件人账号、密码
}
});
// 建立邮件对象
MimeMessage message = new MimeMessage(session);
// 设置邮件的发件人、收件人、主题
message.setFrom(new InternetAddress(SEND_ADDRESS)); // 发件人账号
message.setRecipients(Message.RecipientType.TO, internetAddress); // 收件人账号
// 标题
message.setSubject(SUBJECT); // 邮件标题
// 内容
Multipart multipart = new MimeMultipart();
BodyPart contentPart = new MimeBodyPart();
// 将内容包装在HTML样式标签中调整字体粗细
String styledContent = "<html><body><p style='font-weight: normal;'>"
+ content
+ "</p></body></html>";
contentPart.setContent(styledContent, "text/html;charset=utf-8"); // 邮件内容
multipart.addBodyPart(contentPart);
// 附件部分
if (StringUtils.isNotBlank(FILE_PATH)) {
BodyPart attachPart = new MimeBodyPart();
FileDataSource fileDataSource = new FileDataSource(FILE_PATH); // 附件地址 D:/题库上传模板v1.xlsx
attachPart.setDataHandler(new DataHandler(fileDataSource));
attachPart.setFileName(MimeUtility.encodeText(fileDataSource.getName()));
multipart.addBodyPart(attachPart);
}
message.setContent(multipart);
// 抄送地址
if (StringUtils.isNotBlank(CC)) {
InternetAddress[] internetAddressCC = new InternetAddress().parse(CC);
message.setRecipients(Message.RecipientType.CC, internetAddressCC);
}
// 发送邮件
Transport.send(message);
}
}

View File

@ -148,6 +148,19 @@
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf</artifactId>
</dependency>
<!-- JavaMail API -->
<dependency>
<groupId>javax.mail</groupId>
<artifactId>javax.mail-api</artifactId>
<version>1.6.2</version>
</dependency>
<!-- JavaMail implementation (e.g., for SMTP) -->
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.6.2</version>
</dependency>
</dependencies>

View File

@ -0,0 +1,115 @@
package com.ruoyi.app.controller;
import java.util.ArrayList;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.domain.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.app.domain.AppCountry;
import com.ruoyi.app.service.IAppCountryService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author wyh
* @date 2024-05-26
*/
@RestController
@RequestMapping("/country")
@Api(tags = "国外的国家" , description = "国外的国家")
public class AppCountryController extends BaseController
{
@Autowired
private IAppCountryService appCountryService;
/**
*
*/
@RequiresPermissions("app:country:list")
@GetMapping("/list")
@ApiOperation(value = "查询国外的国家", notes = "查询国外的国家", httpMethod = "GET")
public TableDataInfo list(AppCountry appCountry)
{
startPage();
List<AppCountry> list = appCountryService.selectAppCountryList(appCountry);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("app:country:export")
@Log(title = "国外的国家", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, AppCountry appCountry)
{
List<AppCountry> list = appCountryService.selectAppCountryList(appCountry);
ExcelUtil<AppCountry> util = new ExcelUtil<AppCountry>(AppCountry.class);
util.exportExcel(response, list, "国外的国家数据");
}
/**
*
*/
@RequiresPermissions("app:country:query")
@GetMapping(value = "/{id}")
@ApiOperation(value = "获取国外的国家详细信息", notes = "获取国外的国家详细信息", httpMethod = "GET")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(appCountryService.selectAppCountryById(id));
}
/**
*
*/
@RequiresPermissions("app:country:add")
@ApiOperation(value = "新增国外的国家", notes = "新增国外的国家", httpMethod = "POST")
@Log(title = "国外的国家", businessType = BusinessType.INSERT)
@PostMapping("/add")
public AjaxResult add(@RequestBody AppCountry appCountry)
{
return toAjax(appCountryService.insertAppCountry(appCountry));
}
/**
*
*/
@RequiresPermissions("app:country:edit")
@ApiOperation(value = "修改国外的国家", notes = "修改国外的国家", httpMethod = "PUT")
@Log(title = "国外的国家", businessType = BusinessType.UPDATE)
@PutMapping("/edit")
public AjaxResult edit(@RequestBody AppCountry appCountry)
{
return toAjax(appCountryService.updateAppCountry(appCountry));
}
/**
*
*/
@RequiresPermissions("app:country:remove")
@Log(title = "国外的国家", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(appCountryService.deleteAppCountryByIds(ids));
}
}

View File

@ -58,7 +58,7 @@ public class AppLoginController {
private IAppRegisterService appRegisterService;
@Autowired
private RedisService redisService;
private RedisService redisService;
@Autowired
private IAppSchoolService schoolService;
@ -69,54 +69,59 @@ public class AppLoginController {
@PostMapping("/register")
@ApiOperation(value = "注册", notes = "注册")
public R<?> register(@RequestBody RegisterForm registerForm) {
//判断用户是否已注册或已存在
AppUser appUser = appUserService.selectAppUserByPhone(registerForm.getPhoneNumber());
AppRegister register = appRegisterService.selectAppRegisterByphone(registerForm.getPhoneNumber());
Assert.isNull(appUser, "手机号已注册");
//查看是否提交过注册申请
AppRegister register = appRegisterService.selectAppRegisterByphone(registerForm.getPhoneNumber());
Assert.notNull(registerForm.getSchoolId(), "学校id不能为空");
//TODO
AppSchool appSchool = schoolService.selectAppSchoolById(
registerForm.getSchoolId()
);
Assert.isNull(appUser, "手机号已注册");
if (StringUtils.isNotEmpty(registerForm.getEmail())) {
//校验邮箱格式
// Assert.isTrue(MailUtil.validEmail(registerForm.getEmail()), "邮箱格式不正确") ;
AppRegister appRegister = setAppRegister(registerForm);
//校验邮箱是否已注册
AppUser emailUser = appUserService.selectAppUserByEmail(registerForm.getEmail());
Assert.isNull(emailUser, "邮箱已注册");
redisService.setCacheMapValue(IdUtils.fastUUID(),registerForm.getEmail() , registerForm);
try {
String EM = "<html><body><h2>欢迎来到我们的服务!!</h2>"
+ "<p>请点击下面的网址确认您的注册:</p>"
+ "<p>http://101.133.172.2:9204/app/activation/"+ IdUtils.fastUUID() + "/" + registerForm.getEmail() + "</p>"
+ "</body></html>";
// if (StringUtils.isNotEmpty(registerForm.getEmail())) {
// //校验邮箱格式
//// Assert.isTrue(MailUtil.validEmail(registerForm.getEmail()), "邮箱格式不正确") ;
// AppRegister appRegister = setAppRegister(registerForm);
// //校验邮箱是否已注册
// AppUser emailUser = appUserService.selectAppUserByEmail(registerForm.getEmail());
// Assert.isNull(emailUser, "邮箱已注册");
// redisService.setCacheMapValue(IdUtils.fastUUID(),registerForm.getEmail() , registerForm);
// try {
// String EM = "<html><body><h2>欢迎来到我们的服务!!</h2>"
// + "<p>请点击下面的网址确认您的注册:</p>"
// + "<p>http://101.133.172.2:9204/app/activation/"+ IdUtils.fastUUID() + "/" + registerForm.getEmail() + "</p>"
// + "</body></html>";
//
// MailUtil.send_mail(registerForm.getEmail(), EM);
// } catch (MessagingException e) {
// throw new RuntimeException(e);
// }
// } else {
MailUtil.send_mail(registerForm.getEmail(), EM);
} catch (MessagingException e) {
throw new RuntimeException(e);
if (register != null && register.getStatus() != null) {
switch (register.getStatus()) {
case 0:
return R.ok(null, "请等待,您的账号正在审核中!");
case 1:
return R.ok(null, "您的账号已通过");
case 2:
appRegisterService.updateAppRegisterByPhone(register);
break;
}
} else {
if (register != null && register.getStatus() != null) {
switch (register.getStatus()) {
case 0:
return R.fail(201, "注册失败,您的账号正在审核中!");
case 1:
return R.fail(201, "您的账号已通过");
case 2:
appRegisterService.updateAppRegisterByPhone(register);
break;
}
}else{
AppRegister appRegister = setAppRegister(registerForm);
appRegister.setInvitationCode(registerForm.getInvitationCode());
int i = appRegisterService.insertAppRegister(appRegister);
Assert.isTrue(i > 0, "注册失败");
}
AppRegister appRegister = setAppRegister(registerForm);
appRegister.setInvitationCode(registerForm.getInvitationCode());
int i = appRegisterService.insertAppRegister(appRegister);
Assert.isTrue(i > 0, "注册失败");
}
// }
return R.ok(null, "申请成功,请等待审核结果!");
}
@ -124,7 +129,26 @@ public class AppLoginController {
@ApiOperation(value = "登录", notes = "登录")
public R<?> login(@RequestBody LoginForm loginForm) {
AppUser appUser = appUserService.selectAppUserByPhone(loginForm.getPhoneNumber());
Assert.notNull(appUser, "手机号未注册");
if (appUser == null) {
AppRegister register = appRegisterService.selectAppRegisterByphone(loginForm.getPhoneNumber());
if (register != null && register.getStatus() != null) {
switch (register.getStatus()) {
case 0:
return R.fail(201, "请等待,您的账号正在审核中!");
case 1:
return R.ok(null, "您的账号已通过");
case 2:
appRegisterService.updateAppRegisterByPhone(register);
}
}
} else {
Assert.notNull(appUser, "手机号未注册");
}
// Object cacheObject = redisService.getCacheObject(loginForm.getPhoneNumber());
// if (cacheObject != null) {
// String code = (String) cacheObject;
@ -145,15 +169,23 @@ public class AppLoginController {
private static AppRegister setAppRegister(RegisterForm registerForm) {
AppRegister appRegister = new AppRegister();
appRegister.setPushId(registerForm.getPushId());
appRegister.setEducation(registerForm.getEducation());
appRegister.setMajor(registerForm.getMajor());
appRegister.setCompanyName(registerForm.getCompanyName());
appRegister.setPhone(registerForm.getPhoneNumber());
appRegister.setUsername(registerForm.getUsername());
appRegister.setProve(registerForm.getProve());
appRegister.setAvatarUrl(registerForm.getAvatarUrl());
appRegister.setSex(registerForm.getSex());
appRegister.setAddress(registerForm.getAddress());
appRegister.setNickname(registerForm.getNickname());
appRegister.setSchoolId(registerForm.getSchoolId());
appRegister.setEmail(registerForm.getEmail());
appRegister.setInvitationCode(registerForm.getInvitationCode());
appRegister.setProvinceId(registerForm.getProvinceId());
appRegister.setCityId(registerForm.getCityId());
appRegister.setTownId(registerForm.getTownId());
appRegister.setStatus(0);
return appRegister;
}
@ -199,13 +231,10 @@ public class AppLoginController {
}
@DeleteMapping("logout")
public R<?> logout(HttpServletRequest request)
{
public R<?> logout(HttpServletRequest request) {
String token = SecurityUtils.getToken(request);
if (StringUtils.isNotEmpty(token))
{
if (StringUtils.isNotEmpty(token)) {
// 删除用户缓存记录
AuthUtil.logoutByToken(token);
}
@ -213,8 +242,8 @@ public class AppLoginController {
}
@RequestMapping(path = "/activation/{token}/{email}",method = RequestMethod.GET)
public String activation(@PathVariable String token , @PathVariable String email) {
@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");

View File

@ -1,11 +1,22 @@
package com.ruoyi.app.controller;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import cn.hutool.http.HttpUtil;
import com.ruoyi.app.domain.vo.AppRegisterVo;
import io.swagger.annotations.Api;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.log.annotation.Log;
@ -28,8 +39,7 @@ import springfox.documentation.annotations.ApiIgnore;
@RestController
@RequestMapping("/register")
@ApiIgnore
public class AppRegisterController extends BaseController
{
public class AppRegisterController extends BaseController {
@Autowired
private IAppRegisterService appRegisterService;
@ -38,22 +48,21 @@ public class AppRegisterController extends BaseController
*/
@RequiresPermissions("app:register:list")
@GetMapping("/list")
public TableDataInfo list(AppRegister appRegister)
{
public TableDataInfo list(AppRegister appRegister) {
startPage();
List<AppRegisterVo> list = appRegisterService.selectAppRegisterList(appRegister);
return getDataTable(list);
TableDataInfo dataTable = getDataTable(list);
dataTable.setTotal(appRegisterService.selectAppRegisterCount(appRegister));
return dataTable;
}
/**
*
*/
@RequiresPermissions("app:register:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(appRegisterService.selectAppRegisterById(id));
}
@ -63,8 +72,7 @@ public class AppRegisterController extends BaseController
@RequiresPermissions("app:register:add")
@Log(title = "注册审核", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody AppRegister appRegister)
{
public AjaxResult add(@RequestBody AppRegister appRegister) {
return toAjax(appRegisterService.insertAppRegister(appRegister));
}
@ -74,8 +82,7 @@ public class AppRegisterController extends BaseController
@RequiresPermissions("app:register:edit")
@Log(title = "注册审核", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody AppRegister appRegister)
{
public AjaxResult edit(@RequestBody AppRegister appRegister) {
return toAjax(appRegisterService.updateAppRegister(appRegister));
}
@ -84,22 +91,37 @@ public class AppRegisterController extends BaseController
*/
@RequiresPermissions("app:register:remove")
@Log(title = "注册审核", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(appRegisterService.deleteAppRegisterByIds(ids));
}
@GetMapping("/pass")
public AjaxResult pass(@RequestParam("id") Long id){
public AjaxResult pass(@RequestParam("id") Long id) {
return toAjax(appRegisterService.passAppRegister(id));
}
@PostMapping("/reject")
public AjaxResult reject(@RequestBody AppRegister appRegister)
{
public AjaxResult reject(@RequestBody AppRegister appRegister) {
return toAjax(appRegisterService.rejectAppRegister(appRegister));
}
public static void main(String[] args) {
HttpClient httpClient = HttpClients.createDefault();
String pushId = "7e63c670480d8f2060f8d21800c3ae17";
String url = "https://tcb-am7ffkwasxkewhf-3cpy096b83a1.service.tcloudbase.com/urlPush/pushId?pushId=" + pushId + "&title=审核失败&content=审核被驳回";
try {
HttpGet request = new HttpGet(url);
HttpResponse response = httpClient.execute(request);
// Get the response entity as a String
String jsonResponse = EntityUtils.toString(response.getEntity());
System.out.println(jsonResponse);
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@ -4,6 +4,8 @@ import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.domain.SysUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
@ -17,6 +19,7 @@ import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/**
* Controller
@ -55,15 +58,14 @@ public class AppSchoolController extends BaseController
/**
*
*/
// @RequiresPermissions("app:school:export")
// @Log(title = "学校配置", businessType = BusinessType.EXPORT)
// @PostMapping("/export")
// public void export(HttpServletResponse response, AppSchool appSchool)
// {
// List<AppSchool> list = appSchoolService.selectAppSchoolList(appSchool);
// ExcelUtil<AppSchool> util = new ExcelUtil<AppSchool>(AppSchool.class);
// util.exportExcel(response, list, "学校配置数据");
// }
@Log(title = "学校配置", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, AppSchool appSchool)
{
List<AppSchool> list = appSchoolService.selectAppSchoolList(appSchool);
ExcelUtil<AppSchool> util = new ExcelUtil<AppSchool>(AppSchool.class);
util.exportExcel(response, list, "学校配置数据");
}
/**
*
@ -111,4 +113,21 @@ public class AppSchoolController extends BaseController
{
return toAjax(appSchoolService.deleteAppSchoolByIds(ids));
}
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response) throws IOException
{
ExcelUtil<AppSchool> util = new ExcelUtil<AppSchool>(AppSchool.class);
util.importTemplateExcel(response, "学校数据");
}
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
{
ExcelUtil<AppSchool> util = new ExcelUtil<AppSchool>(AppSchool.class);
List<AppSchool> userList = util.importExcel(file.getInputStream());
String message = appSchoolService.importSchool(userList, updateSupport);
return success(message);
}
}

View File

@ -116,10 +116,15 @@ public class AppTopicController extends BaseController
*/
@RequiresPermissions("app:topic:remove")
@Log(title = "话题信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
@DeleteMapping("/{id}")
@ApiOperation(value = "删除话题信息", notes = "删除话题信息", httpMethod = "DELETE")
public AjaxResult remove(@PathVariable Long[] ids)
public AjaxResult remove(@PathVariable Long id)
{
return toAjax(appTopicService.deleteAppTopicByIds(ids));
if (appTopicService.hasChildById(id)) {
return warn("存在子集数据,不允许删除");
}
return toAjax(appTopicService.deleteAppTopicByIds(id));
}
}

View File

@ -219,6 +219,7 @@ public class PayController extends BaseController
order.setPaySoure(3);
order.setCreateTime(new Date());
order.setLevel(1);
order.setOutTradeNo( KeyUtil.generateUniqueKey());
appOrderMapper.insertAppOrder(order);
//修改用户信息

View File

@ -1,6 +1,9 @@
package com.ruoyi.app.controller;
import com.ruoyi.app.domain.AppRegister;
import com.ruoyi.app.service.IAppRegisterService;
import com.ruoyi.app.utils.aliyun.sms.SendNoteUtil;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.web.domain.AjaxResult;
import io.swagger.annotations.Api;
@ -21,11 +24,26 @@ public class PhoneCodeController {
@Autowired
private SendNoteUtil sendNoteUtil;
@Autowired
private IAppRegisterService appRegisterService;
@GetMapping(value = "/send")
@ApiOperation(value = "发送短信验证码", notes = "发送短信验证码", httpMethod = "GET")
public AjaxResult sendCode(@RequestParam("phoneNumber") String phoneNum){
public AjaxResult sendCode(@RequestParam("phoneNumber") String phoneNum , @RequestParam("type") Integer type){
String send = "";
if (type == 1) {
String send = sendNoteUtil.sendNoteMessgae(phoneNum);
AppRegister appRegister = appRegisterService.selectAppRegisterByphone(phoneNum);
if (appRegister != null && appRegister.getStatus() == 0) {
return AjaxResult.error(201, "请等待,您的账号正在审核中!");
}
if (appRegister != null && appRegister.getStatus() == 2) {
return AjaxResult.error(201, "您的账号申请被驳回");
}
send = sendNoteUtil.sendNoteMessgae(phoneNum);
}else {
send = sendNoteUtil.sendMessage(phoneNum);
}
if ("OK".equals(send)) {
return AjaxResult.success();

View File

@ -0,0 +1,65 @@
package com.ruoyi.app.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
/**
* app_country
*
* @author wyh
* @date 2024-05-26
*/
public class AppCountry extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Integer id;
/** 国家名称 */
@Excel(name = "国家名称")
private String name;
/** 父级id */
@Excel(name = "父级id")
private Long parentId;
public void setId(Integer id)
{
this.id = id;
}
public Integer getId()
{
return id;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setParentId(Long parentId)
{
this.parentId = parentId;
}
public Long getParentId()
{
return parentId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("parentId", getParentId())
.toString();
}
}

View File

@ -1,5 +1,7 @@
package com.ruoyi.app.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
@ -11,6 +13,8 @@ import com.ruoyi.common.core.web.domain.BaseEntity;
* @author wyh
* @date 2024-04-23
*/
@Data
public class AppRegister extends BaseEntity
{
private static final long serialVersionUID = 1L;
@ -57,6 +61,28 @@ public class AppRegister extends BaseEntity
@Excel(name = "审核状态")
private Integer status;
@ApiModelProperty("推送id")
private String pushId;
/** 学历 */
@Excel(name = "学历")
private String education;
/** 专业 */
@Excel(name = "专业")
private String major;
/** 公司名称 */
@Excel(name = "公司名称")
private String companyName;
private String nickname;
private Integer provinceId;
private Integer cityId;
private Integer townId;
public void setId(Long id)
{
this.id = id;

View File

@ -174,6 +174,8 @@ public class AppUser extends BaseEntity
private String backGroundImg;
private String pushId;
/** 订单记录 */
@Excel(name = "订单记录")
private Long orderId;
@ -188,6 +190,13 @@ public class AppUser extends BaseEntity
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date orderEndTime;
private Integer provinceId;
private Integer cityId;
private Integer townId;
public void setId(Long id)
{
this.id = id;

View File

@ -75,6 +75,10 @@ public class AppUserDynamic extends BaseEntity
private List<Long> dynamicIds;
private Integer check;
private Boolean isOwner;
public void setIsTop(Long isTop)
{
this.isTop = isTop;

View File

@ -3,6 +3,7 @@ package com.ruoyi.app.domain.vo;
import com.ruoyi.app.domain.AppDynamicComment;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -15,6 +16,7 @@ import java.util.List;
* @author wyh
* @date 2024-04-24
*/
@Data
public class AppDynamicCommentVo extends AppDynamicComment
{
private static final long serialVersionUID = 1L;
@ -25,6 +27,12 @@ public class AppDynamicCommentVo extends AppDynamicComment
@Excel(name = "用户头像")
private String avatarUrl;
private Integer check;
/** 昵称 */
@Excel(name = "昵称")
private String nickname;
private List<AppDynamicCommentVo> children = new ArrayList<>();
public void setChildren(List<AppDynamicCommentVo> children) {

View File

@ -1,39 +1,60 @@
package com.ruoyi.app.domain.vo;
import com.ruoyi.app.domain.AppRegister;
import com.ruoyi.common.core.annotation.Excel;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@Data
public class AppRegisterVo {
public class AppRegisterVo extends AppRegister {
private static final long serialVersionUID = 1L;
/** 审核id */
/**
* id
*/
private Long id;
/** 手机号 */
/**
*
*/
private String phone;
/** 用户名 */
/**
*
*/
private String username;
/** 学校证明 */
/**
*
*/
private String prove;
/** 头像 */
/**
*
*/
private String avatarUrl;
/** 性别0-男1-女 */
/**
* 0-1-
*/
private Integer sex;
/** 地址 */
/**
*
*/
private String address;
/** 学校id */
/**
* id
*/
private Long schoolId;
private String schoolName;
/** 邮箱 */
/**
*
*/
private String email;

View File

@ -21,6 +21,8 @@ public class AppUserDataVo
private static final long serialVersionUID = 1L;
private String username;
private String nickname;
private Integer check;
private String avatarUrl;

View File

@ -25,6 +25,8 @@ public class AppUserDynamicVo extends AppUserDynamic
{
private static final long serialVersionUID = 1L;
private Integer isFans;
private String username;
private String avatarUrl;
@ -66,6 +68,7 @@ public class AppUserDynamicVo extends AppUserDynamic
private String townName;
private Integer check;
// 话题
private List<AppTopic> appTopicList = new ArrayList<>();

View File

@ -3,6 +3,7 @@ package com.ruoyi.app.domain.vo;
import com.ruoyi.app.domain.AppUserFriend;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -12,6 +13,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
* @author wyh
* @date 2024-04-24
*/
@Data
public class AppUserFriendVo extends AppUserFriend
{
private static final long serialVersionUID = 1L;
@ -19,6 +21,9 @@ public class AppUserFriendVo extends AppUserFriend
/** 我的id */
@Excel(name = "名字")
private String username;
private String nickname;
private Integer check;
/** 好友id */
@Excel(name = "头像")

View File

@ -27,6 +27,18 @@ public class AppUserVo extends AppUser
@Excel(name = "学校名称")
private String schoolName;
private String schoolImg;
private Integer provinceId;
private Integer cityId;
private Integer townId;
private String provinceName;
private String townName;
private List<AppSkill> userSkillList;
private String cityName;
@ -37,6 +49,8 @@ public class AppUserVo extends AppUser
private Integer attentionNum;
private int fansNum;
public void setUserSkillList(List<AppSkill> userSkillList) {
this.userSkillList = userSkillList;

View File

@ -1,6 +1,7 @@
package com.ruoyi.app.form;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.ruoyi.common.core.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -36,6 +37,29 @@ public class RegisterForm {
@ApiModelProperty("学校证明")
private String prove;
@ApiModelProperty("推送id")
private String pushId;
/** 学历 */
@Excel(name = "学历")
private String education;
/** 专业 */
@Excel(name = "专业")
private String major;
/** 公司名称 */
@Excel(name = "公司名称")
private String companyName;
private String nickname;
private Integer provinceId;
private Integer cityId;
private Integer townId;
@JsonIgnore
private Integer status;
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.app.mapper;
import java.util.List;
import com.ruoyi.app.domain.AppCountry;
/**
* Mapper
*
* @author wyh
* @date 2024-05-26
*/
public interface AppCountryMapper
{
/**
*
*
* @param id
* @return
*/
public AppCountry selectAppCountryById(Long id);
/**
*
*
* @param appCountry
* @return
*/
public List<AppCountry> selectAppCountryList(AppCountry appCountry);
/**
*
*
* @param appCountry
* @return
*/
public int insertAppCountry(AppCountry appCountry);
/**
*
*
* @param appCountry
* @return
*/
public int updateAppCountry(AppCountry appCountry);
/**
*
*
* @param id
* @return
*/
public int deleteAppCountryById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteAppCountryByIds(Long[] ids);
}

View File

@ -64,4 +64,7 @@ public interface AppRegisterMapper
String phoneNumber);
int updateAppRegisterByPhone(AppRegister appRegister);
long selectAppRegisterCount(AppRegister appRegister);
}

View File

@ -61,4 +61,8 @@ public interface AppSchoolMapper
public int deleteAppSchoolByIds(Long[] ids);
List<AppSchool> selectAppSchoolAllList(@Param("name") String name);
public AppSchool selectAppSchoolByName(String name);
public int updateAppSchoolByName(AppSchool appSchool);
}

View File

@ -59,5 +59,7 @@ public interface AppTopicMapper
* @param ids
* @return
*/
public int deleteAppTopicByIds(Long[] ids);
public int deleteAppTopicByIds(Long id);
public int hasChildById(Long id);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.app.service;
import java.util.List;
import com.ruoyi.app.domain.AppCountry;
/**
* Service
*
* @author wyh
* @date 2024-05-26
*/
public interface IAppCountryService
{
/**
*
*
* @param id
* @return
*/
public AppCountry selectAppCountryById(Long id);
/**
*
*
* @param appCountry
* @return
*/
public List<AppCountry> selectAppCountryList(AppCountry appCountry);
/**
*
*
* @param appCountry
* @return
*/
public int insertAppCountry(AppCountry appCountry);
/**
*
*
* @param appCountry
* @return
*/
public int updateAppCountry(AppCountry appCountry);
/**
*
*
* @param ids
* @return
*/
public int deleteAppCountryByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteAppCountryById(Long id);
}

View File

@ -68,4 +68,6 @@ public interface IAppRegisterService
AppRegister selectAppRegisterByphone(String phoneNumber);
long selectAppRegisterCount(AppRegister appRegister);
}

View File

@ -2,6 +2,7 @@ package com.ruoyi.app.service;
import java.util.List;
import com.ruoyi.app.domain.AppSchool;
import com.ruoyi.system.api.domain.SysUser;
/**
* Service
@ -60,4 +61,6 @@ public interface IAppSchoolService
public int deleteAppSchoolById(Long id);
List<AppSchool> selectAppSchoolAllList(String name);
public String importSchool(List<AppSchool> userList, boolean updateSupport);
}

View File

@ -51,7 +51,7 @@ public interface IAppTopicService
* @param ids
* @return
*/
public int deleteAppTopicByIds(Long[] ids);
public int deleteAppTopicByIds(Long id);
/**
*
@ -60,4 +60,6 @@ public interface IAppTopicService
* @return
*/
public int deleteAppTopicById(Long id);
boolean hasChildById(Long id);
}

View File

@ -0,0 +1,93 @@
package com.ruoyi.app.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.app.mapper.AppCountryMapper;
import com.ruoyi.app.domain.AppCountry;
import com.ruoyi.app.service.IAppCountryService;
/**
* Service
*
* @author wyh
* @date 2024-05-26
*/
@Service
public class AppCountryServiceImpl implements IAppCountryService
{
@Autowired
private AppCountryMapper appCountryMapper;
/**
*
*
* @param id
* @return
*/
@Override
public AppCountry selectAppCountryById(Long id)
{
return appCountryMapper.selectAppCountryById(id);
}
/**
*
*
* @param appCountry
* @return
*/
@Override
public List<AppCountry> selectAppCountryList(AppCountry appCountry)
{
return appCountryMapper.selectAppCountryList(appCountry);
}
/**
*
*
* @param appCountry
* @return
*/
@Override
public int insertAppCountry(AppCountry appCountry)
{
return appCountryMapper.insertAppCountry(appCountry);
}
/**
*
*
* @param appCountry
* @return
*/
@Override
public int updateAppCountry(AppCountry appCountry)
{
return appCountryMapper.updateAppCountry(appCountry);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteAppCountryByIds(Long[] ids)
{
return appCountryMapper.deleteAppCountryByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteAppCountryById(Long id)
{
return appCountryMapper.deleteAppCountryById(id);
}
}

View File

@ -166,7 +166,7 @@ public class AppDynamicCommentServiceImpl implements IAppDynamicCommentService
public static List<AppDynamicCommentVo> getChildrenAppDynamicCommentVoById(Long parentId, List<AppDynamicCommentVo> AppDynamicCommentVos) {
List<AppDynamicCommentVo> children = new ArrayList<AppDynamicCommentVo>();
for (AppDynamicCommentVo node : AppDynamicCommentVos) {
if (node.getParentId() == parentId) {
if (parentId.equals(node.getParentId())) {
//装载parentId对应的子节点
children.add(node);
}

View File

@ -7,9 +7,11 @@ import java.util.Map;
import java.util.stream.Collectors;
import com.ruoyi.app.domain.AppCity;
import com.ruoyi.app.domain.AppCountry;
import com.ruoyi.app.domain.AppTown;
import com.ruoyi.app.domain.vo.AreaVo;
import com.ruoyi.app.mapper.AppCityMapper;
import com.ruoyi.app.mapper.AppCountryMapper;
import com.ruoyi.app.mapper.AppTownMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -34,6 +36,9 @@ public class AppProvinceServiceImpl implements IAppProvinceService {
@Autowired
private AppTownMapper appTownMapper;
@Autowired
private AppCountryMapper appCountryMapper;
/**
*
*
@ -113,6 +118,7 @@ public class AppProvinceServiceImpl implements IAppProvinceService {
areaVo.setIsLeaf(false);
List<AreaVo> list = new ArrayList<>();
List<AppCity> appCities = appCityMapper.selectAppCityListByProvinceId(appProvince.getId());
boolean flag = true;
for (AppCity appCity : appCities) {
if (appCity.getName().equals(areaVo.getName())) {
@ -154,57 +160,22 @@ public class AppProvinceServiceImpl implements IAppProvinceService {
}
areaVos.add(areaVo);
}
areaVos.stream().filter(area -> area.getId()==35).forEach(area -> {
AppCountry appCountry = new AppCountry();
appCountry.setParentId(35L);
List<AppCountry> appCountries = appCountryMapper.selectAppCountryList(appCountry);
List<AreaVo> collect = appCountries.stream().map(country -> {
AreaVo areaVo = new AreaVo();
areaVo.setId(country.getId());
areaVo.setName(country.getName());
areaVo.setLevel(2);
return areaVo;
}).collect(Collectors.toList());
area.setChildren(collect);
area.setIsLeaf(false);
});
return areaVos;
// List<AreaVo> collect = appProvinces.stream()
// .map(appProvince -> {
// AreaVo areaVo = new AreaVo();
// areaVo.setId(appProvince.getId());
// areaVo.setName(appProvince.getName());
// areaVo.setLevel(1);
// areaVo.setIsLeaf(false);
//
// List<AppCity> appCities = appCityMapper.selectAppCityListByProvinceId(appProvince.getId());
// if (appCities == null || appCities.isEmpty()) {
// return areaVo;
// }
//
// List<AreaVo> children = appCities.stream()
// .map(appCity -> {
// AreaVo child = new AreaVo();
// child.setId(appCity.getId());
// child.setName(appCity.getName());
// child.setLevel(2);
// child.setIsLeaf(false);
//
// List<AppTown> appTowns = appTownMapper.getTownByCityId(appCity.getId());
// if (appTowns == null || appTowns.isEmpty()) {
// return child;
// }
//
// List<AreaVo> townChildren = appTowns.stream()
//// .filter(!appTown -> !appTown.getId().equals(appCity.getId())) // Filter out where child id is same as parent id
// .map(appTown -> {
// AreaVo townChild = new AreaVo();
// townChild.setId(appTown.getId());
// townChild.setName(appTown.getName());
// townChild.setLevel(3);
// townChild.setIsLeaf(true);
// return townChild;
// })
// .collect(Collectors.toList());
//
// child.setChildren(townChildren);
// return child;
// })
// .collect(Collectors.toList());
//
// areaVo.setChildren(children);
// return areaVo;
// })
// .collect(Collectors.toList());
//
// return collect;
}
}

View File

@ -4,6 +4,7 @@ import java.util.List;
import java.util.stream.Collectors;
import cn.hutool.core.lang.Assert;
import cn.hutool.http.HttpUtil;
import com.ruoyi.app.domain.AppSchool;
import com.ruoyi.app.domain.AppUser;
import com.ruoyi.app.domain.vo.AppRegisterVo;
@ -12,8 +13,14 @@ 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.ALiYunMailUtil;
import com.ruoyi.common.core.utils.mail.MailUtil;
import com.ruoyi.common.core.utils.uuid.IdUtils;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.app.mapper.AppRegisterMapper;
@ -29,8 +36,7 @@ import javax.mail.MessagingException;
* @date 2024-04-23
*/
@Service
public class AppRegisterServiceImpl implements IAppRegisterService
{
public class AppRegisterServiceImpl implements IAppRegisterService {
@Autowired
private AppRegisterMapper appRegisterMapper;
@ -47,8 +53,7 @@ public class AppRegisterServiceImpl implements IAppRegisterService
* @return
*/
@Override
public AppRegister selectAppRegisterById(Long id)
{
public AppRegister selectAppRegisterById(Long id) {
return appRegisterMapper.selectAppRegisterById(id);
}
@ -59,10 +64,10 @@ public class AppRegisterServiceImpl implements IAppRegisterService
* @return
*/
@Override
public List<AppRegisterVo> selectAppRegisterList(AppRegister appRegister)
{
public List<AppRegisterVo> selectAppRegisterList(AppRegister appRegister) {
List<AppRegister> appRegisters = appRegisterMapper.selectAppRegisterList(appRegister);
List<AppRegisterVo> collect = appRegisters.stream().map(register -> {
return appRegisters.stream().map(register -> {
AppRegisterVo appRegisterVo = new AppRegisterVo();
BeanUtils.copyBeanProp(appRegisterVo, register);
AppSchool appSchool = appSchoolMapper.selectAppSchoolById(register.getSchoolId());
@ -72,7 +77,6 @@ public class AppRegisterServiceImpl implements IAppRegisterService
return appRegisterVo;
}).collect(Collectors.toList());
return collect;
}
/**
@ -82,8 +86,7 @@ public class AppRegisterServiceImpl implements IAppRegisterService
* @return
*/
@Override
public int insertAppRegister(AppRegister appRegister)
{
public int insertAppRegister(AppRegister appRegister) {
appRegister.setCreateTime(DateUtils.getNowDate());
return appRegisterMapper.insertAppRegister(appRegister);
}
@ -95,8 +98,7 @@ public class AppRegisterServiceImpl implements IAppRegisterService
* @return
*/
@Override
public int updateAppRegister(AppRegister appRegister)
{
public int updateAppRegister(AppRegister appRegister) {
appRegister.setUpdateTime(DateUtils.getNowDate());
return appRegisterMapper.updateAppRegister(appRegister);
}
@ -114,8 +116,7 @@ public class AppRegisterServiceImpl implements IAppRegisterService
* @return
*/
@Override
public int deleteAppRegisterByIds(Long[] ids)
{
public int deleteAppRegisterByIds(Long[] ids) {
return appRegisterMapper.deleteAppRegisterByIds(ids);
}
@ -126,8 +127,7 @@ public class AppRegisterServiceImpl implements IAppRegisterService
* @return
*/
@Override
public int deleteAppRegisterById(Long id)
{
public int deleteAppRegisterById(Long id) {
return appRegisterMapper.deleteAppRegisterById(id);
}
@ -135,15 +135,47 @@ public class AppRegisterServiceImpl implements IAppRegisterService
public int passAppRegister(Long id) {
AppRegister appRegister = appRegisterMapper.selectAppRegisterById(id);
Assert.isTrue(appRegister != null, "该申请不存在");
Assert.isTrue(appRegister.getStatus() == 0, "该申请已审核");
Assert.isTrue(appRegister.getStatus() != null && appRegister.getStatus() == 0, "该申请已审核");
appRegister.setStatus(1);
appRegister.setUpdateTime(DateUtils.getNowDate());
int i = appRegisterMapper.updateAppRegister(appRegister);
if (i != 0) {
if (i > 0) {
AppUser appUser = new AppUser();
BeanUtils.copyBeanProp(appUser, appRegister);
BeanUtils.copyProperties(appRegister, appUser);
appUser.setCreateTime(DateUtils.getNowDate());
appUser.setUpdateTime(DateUtils.getNowDate());
appUser.setPhone(appRegister.getPhone() != null ? appRegister.getPhone() : null);
appUser.setEmail(appRegister.getEmail() != null ? appRegister.getEmail() : null);
appUser.setSchool(appRegister.getSchoolId() != null ? appRegister.getSchoolId() : null);
appUser.setUsername(appRegister.getUsername() != null ? appRegister.getUsername() : null);
appUser.setAddress(appRegister.getAddress() != null ? appRegister.getAddress() : null);
appUser.setSex(Long.valueOf(appRegister.getSex() != null ? appRegister.getSex() : null));
appUser.setAvatarUrl(appRegister.getAvatarUrl() != null ? appRegister.getAvatarUrl() : null);
appUser.setCompanyName(appRegister.getCompanyName() != null ? appRegister.getCompanyName() : null);
appUser.setEducation(appRegister.getEducation() != null ? appRegister.getEducation() : null);
appUser.setMajor(appRegister.getMajor() != null ? appRegister.getMajor() : null);
appUser.setPushId(appRegister.getPushId() != null ? appRegister.getPushId() : null);
appUser.setNickname(appRegister.getNickname() != null ? appRegister.getNickname() : null);
appUser.setProvinceId(appRegister.getProvinceId() != null ? appRegister.getProvinceId() : null);
appUser.setCityId(appRegister.getCityId() != null ? appRegister.getCityId() : null);
appUser.setTownId(appRegister.getTownId() != null ? appRegister.getTownId() : null);
appUserMapper.insertAppUser(appUser);
HttpClient httpClient = HttpClients.createDefault();
String pushId = appRegister.getPushId() != null ? appRegister.getPushId() : null;
String url = "https://tcb-am7ffkwasxkewhf-3cpy096b83a1.service.tcloudbase.com/urlPush/pushId?pushId=" + pushId + "&title=审核完成&content=审核已通过!";
try {
HttpGet request = new HttpGet(url);
HttpResponse response = httpClient.execute(request);
// Get the response entity as a String
String jsonResponse = EntityUtils.toString(response.getEntity());
System.out.println(jsonResponse);
} catch (Exception e) {
e.printStackTrace();
}
}
return i;
}
@ -158,7 +190,24 @@ public class AppRegisterServiceImpl implements IAppRegisterService
register.setRemark(appRegister.getRemark());
}
appRegister.setUpdateTime(DateUtils.getNowDate());
return appRegisterMapper.updateAppRegister(appRegister);
int i = appRegisterMapper.updateAppRegister(appRegister);
if (i > 0) {
HttpClient httpClient = HttpClients.createDefault();
String pushId = appRegister.getPushId() != null ? appRegister.getPushId() : null;
String url = "https://tcb-am7ffkwasxkewhf-3cpy096b83a1.service.tcloudbase.com/urlPush/pushId?pushId=" + pushId + "&title=审核失败&content=审核已被驳回!";
try {
HttpGet request = new HttpGet(url);
HttpResponse response = httpClient.execute(request);
// Get the response entity as a String
String jsonResponse = EntityUtils.toString(response.getEntity());
System.out.println(jsonResponse);
} catch (Exception e) {
e.printStackTrace();
}
}
return i;
}
@Override
@ -167,17 +216,24 @@ public class AppRegisterServiceImpl implements IAppRegisterService
return appRegisterMapper.selectAppRegisterByphone(phoneNumber);
}
@Override
public long selectAppRegisterCount(AppRegister appRegister) {
return appRegisterMapper.selectAppRegisterCount(appRegister);
}
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://101.133.172.2:9204/app/activation/"+ token + "/" + email + "</p>"
+ "<p>http://127.0.0.1:9204/app/activation/" + token + "/" + email + "</p>"
+ "</body></html>";
try {
MailUtil.send_mail( "653809315@qq.com",EM);
} catch (MessagingException e) {
ALiYunMailUtil.sendMail(EM, email);
} catch (MessagingException e) {
throw new RuntimeException(e);
} catch (Exception e) {
throw new RuntimeException(e);
}
}

View File

@ -1,14 +1,21 @@
package com.ruoyi.app.service.impl;
import java.util.List;
import com.ruoyi.common.core.exception.ServiceException;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.utils.bean.BeanValidators;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.domain.SysUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.app.mapper.AppSchoolMapper;
import com.ruoyi.app.domain.AppSchool;
import com.ruoyi.app.service.IAppSchoolService;
import javax.validation.Validator;
/**
* Service
*
@ -16,11 +23,14 @@ import com.ruoyi.app.service.IAppSchoolService;
* @date 2024-04-18
*/
@Service
public class AppSchoolServiceImpl implements IAppSchoolService
{
public class AppSchoolServiceImpl implements IAppSchoolService {
@Autowired
private AppSchoolMapper appSchoolMapper;
@Autowired
protected Validator validator;
/**
*
*
@ -28,8 +38,7 @@ public class AppSchoolServiceImpl implements IAppSchoolService
* @return
*/
@Override
public AppSchool selectAppSchoolById(Long id)
{
public AppSchool selectAppSchoolById(Long id) {
return appSchoolMapper.selectAppSchoolById(id);
}
@ -40,8 +49,7 @@ public class AppSchoolServiceImpl implements IAppSchoolService
* @return
*/
@Override
public List<AppSchool> selectAppSchoolList(AppSchool appSchool)
{
public List<AppSchool> selectAppSchoolList(AppSchool appSchool) {
return appSchoolMapper.selectAppSchoolList(appSchool);
}
@ -52,8 +60,7 @@ public class AppSchoolServiceImpl implements IAppSchoolService
* @return
*/
@Override
public int insertAppSchool(AppSchool appSchool)
{
public int insertAppSchool(AppSchool appSchool) {
appSchool.setCreateTime(DateUtils.getNowDate());
appSchool.setUpdateTime(DateUtils.getNowDate());
appSchool.setCreateBy(SecurityUtils.getUsername());
@ -68,8 +75,7 @@ public class AppSchoolServiceImpl implements IAppSchoolService
* @return
*/
@Override
public int updateAppSchool(AppSchool appSchool)
{
public int updateAppSchool(AppSchool appSchool) {
appSchool.setUpdateTime(DateUtils.getNowDate());
appSchool.setUpdateBy(SecurityUtils.getUsername());
return appSchoolMapper.updateAppSchool(appSchool);
@ -82,8 +88,7 @@ public class AppSchoolServiceImpl implements IAppSchoolService
* @return
*/
@Override
public int deleteAppSchoolByIds(Long[] ids)
{
public int deleteAppSchoolByIds(Long[] ids) {
return appSchoolMapper.deleteAppSchoolByIds(ids);
}
@ -94,14 +99,57 @@ public class AppSchoolServiceImpl implements IAppSchoolService
* @return
*/
@Override
public int deleteAppSchoolById(Long id)
{
public int deleteAppSchoolById(Long id) {
return appSchoolMapper.deleteAppSchoolById(id);
}
@Override
public List<AppSchool> selectAppSchoolAllList(String name) {
return appSchoolMapper.selectAppSchoolAllList(name);
return appSchoolMapper.selectAppSchoolAllList(name);
}
@Override
public String importSchool(List<AppSchool> schoolList, boolean updateSupport) {
if (StringUtils.isNull(schoolList) || schoolList.size() == 0) {
throw new ServiceException("导入学校数据不能为空!");
}
int successNum = 0;
int failureNum = 0;
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
for (AppSchool appSchool : schoolList) {
try {
// 验证是否存在这个用户
AppSchool s = appSchoolMapper.selectAppSchoolByName(appSchool.getName());
if (StringUtils.isNull(s)) {
BeanValidators.validateWithException(validator, appSchool);
appSchoolMapper.insertAppSchool(appSchool);
successNum++;
successMsg.append("<br/>" + successNum + "、学校 " + appSchool.getName() + " 导入成功");
} else if (updateSupport) {
BeanValidators.validateWithException(validator, appSchool);
appSchool.setUpdateTime(DateUtils.getNowDate());
appSchoolMapper.updateAppSchoolByName(appSchool);
successNum++;
successMsg.append("<br/>" + successNum + "、学校 " + appSchool.getName() + " 更新成功");
} else {
failureNum++;
failureMsg.append("<br/>" + failureNum + "、学校 " + appSchool.getName() + " 已存在");
}
} catch (Exception e) {
failureNum++;
String msg = "<br/>" + failureNum + "、学校 " + appSchool.getName() + " 导入失败:";
failureMsg.append(msg + e.getMessage());
}
}
if (failureNum > 0) {
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
throw new ServiceException(failureMsg.toString());
} else {
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
}
return successMsg.toString();
}
}

View File

@ -95,13 +95,13 @@ public class AppTopicServiceImpl implements IAppTopicService
/**
*
*
* @param ids
* @param id
* @return
*/
@Override
public int deleteAppTopicByIds(Long[] ids)
public int deleteAppTopicByIds(Long id)
{
return appTopicMapper.deleteAppTopicByIds(ids);
return appTopicMapper.deleteAppTopicByIds(id);
}
/**
@ -115,4 +115,10 @@ public class AppTopicServiceImpl implements IAppTopicService
{
return appTopicMapper.deleteAppTopicById(id);
}
@Override
public boolean hasChildById(Long id) {
int i = appTopicMapper.hasChildById(id);
return i > 0;
}
}

View File

@ -1,5 +1,6 @@
package com.ruoyi.app.service.impl;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@ -214,6 +215,21 @@ public class AppUserDynamicServiceImpl implements IAppUserDynamicService
AppDynamicComment appDynamicComment = new AppDynamicComment();
appDynamicComment.setDynamicId(id);
appUserDynamicVo.setCountComment(appDynamicCommentMapper.selectAppDynamicCommentList(appDynamicComment).size());
AppUserFriend appUserFriend = new AppUserFriend();
appUserFriend.setUserId(appUserDynamic.getUserId());
List<AppUserFriend> friends = appUserFriendMapper.selectAppUserFriendList(appUserFriend);
if (friends.stream().map(AppUserFriend::getFriendId).collect(Collectors.toList()).contains(appUserDynamicVo.getUserId())) {
appUserDynamicVo.setIsFans(0);
}else {
appUserDynamicVo.setIsFans(1);
}
}
List<AppUserDynamicVo> collect = new ArrayList<>();
if (appUserDynamic.getIsOwner() != null) {
collect = list.stream().filter(x -> x.getPrivacyStatus() != 1).collect(Collectors.toList());
return collect;
}
return list;
}

View File

@ -9,6 +9,9 @@ import com.ruoyi.app.domain.vo.AppUserInfoVo;
import com.ruoyi.app.domain.vo.AppUserNetVo;
import com.ruoyi.app.domain.vo.AppUserVo;
import com.ruoyi.app.mapper.*;
import com.ruoyi.app.service.IAppCityService;
import com.ruoyi.app.service.IAppProvinceService;
import com.ruoyi.app.service.IAppTownService;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.bean.BeanUtils;
import org.apache.commons.collections4.CollectionUtils;
@ -24,8 +27,7 @@ import com.ruoyi.app.service.IAppUserService;
* @date 2024-04-23
*/
@Service
public class AppUserServiceImpl implements IAppUserService
{
public class AppUserServiceImpl implements IAppUserService {
@Autowired
private AppUserMapper appUserMapper;
@ -44,6 +46,14 @@ public class AppUserServiceImpl implements IAppUserService
@Autowired
private AppSkillMapper appSkillMapper;
@Autowired
private AppProvinceMapper appProvinceMapper;
@Autowired
private AppCityMapper appCityMapper;
@Autowired
private AppTownMapper appTownMapper;
/**
* app
*
@ -54,11 +64,37 @@ public class AppUserServiceImpl implements IAppUserService
public AppUserVo selectAppUserById(Long id) {
AppUserVo appUser = appUserMapper.selectAppUserById(id);
List<AppSkill> appSkills = new ArrayList<>();
if (appUser.getSkillId() != null) {
List<String> skillIds = Arrays.asList(appUser.getSkillId().split(","));
for (String skillId : skillIds) {
AppSkill appSkill = appSkillMapper.selectAppSkillById(Long.valueOf(skillId));
appSkills.add(appSkill);
// if (appUser.getSkillId() != null) {
// List<String> skillIds = Arrays.asList(appUser.getSkillId().split(","));
// for (String skillId : skillIds) {
// AppSkill appSkill = appSkillMapper.selectAppSkillById(Long.valueOf(skillId));
// appSkills.add(appSkill);
// }
// }
if (appUser.getSchool() != null) {
AppSchool appSchool = appSchoolMapper.selectAppSchoolById(appUser.getSchool());
if (appSchool != null) {
appUser.setSchoolName(appSchool.getName());
appUser.setSchoolImg(appSchool.getSchoolImg());
}
}
if (appUser.getProvinceId() != null) {
AppProvince appProvince = appProvinceMapper.selectAppProvinceById(appUser.getProvinceId());
if (appProvince != null) {
appUser.setProvinceName(appProvince.getName());
}
}
if (appUser.getCityId() != null) {
AppCity appCity = appCityMapper.selectAppCityById(Long.valueOf(appUser.getCityId()));
if (appCity != null) {
appUser.setCityName(appCity.getName());
}
}
if (appUser.getTownId() != null) {
AppTown appTown = appTownMapper.selectAppTownById(Long.valueOf(appUser.getTownId()));
if (appTown != null) {
appUser.setTownName(appTown.getName());
}
}
appUser.setUserSkillList(appSkills);
@ -72,8 +108,7 @@ public class AppUserServiceImpl implements IAppUserService
* @return app
*/
@Override
public List<AppUserVo> selectAppUserList(AppUser appUser)
{
public List<AppUserVo> selectAppUserList(AppUser appUser) {
List<AppUser> appUsers = appUserMapper.selectAppUserList(appUser);
List<AppUserVo> appUserVos = new ArrayList<>();
if (CollectionUtils.isNotEmpty(appUsers)) {
@ -100,8 +135,7 @@ public class AppUserServiceImpl implements IAppUserService
* @return
*/
@Override
public int insertAppUser(AppUser appUser)
{
public int insertAppUser(AppUser appUser) {
appUser.setCreateTime(DateUtils.getNowDate());
return appUserMapper.insertAppUser(appUser);
}
@ -113,8 +147,7 @@ public class AppUserServiceImpl implements IAppUserService
* @return
*/
@Override
public int updateAppUser(AppUser appUser)
{
public int updateAppUser(AppUser appUser) {
appUser.setUpdateTime(DateUtils.getNowDate());
/*if (StringUtils.isNotBlank(appUser.getSkills())) {
// 删除标签
@ -173,7 +206,7 @@ public class AppUserServiceImpl implements IAppUserService
AppUserFriend appUserFriend = new AppUserFriend();
appUserFriend.setUserId(appUser.getAppId());
List<AppUserFriend> appUserFriends = appUserFriendMapper.selectAppUserFriendList(appUserFriend);
List<Long> ids = appUserFriends.stream().map(x->x.getFriendId()).collect(Collectors.toList());
List<Long> ids = appUserFriends.stream().map(x -> x.getFriendId()).collect(Collectors.toList());
AppUser entity = new AppUser();
entity.setIds(ids);
@ -223,25 +256,25 @@ public class AppUserServiceImpl implements IAppUserService
public List<AppUserInfoVo> listUser(AppUser appUser) {
int status = appUser.getStatus();
List<Long> ids = new ArrayList<>();
switch (status){
switch (status) {
case 1://好友
AppUserFriend appUserFriend = new AppUserFriend();
appUserFriend.setUserId(appUser.getAppId());
List<AppUserFriend> list = appUserFriendMapper.selectAppUserFriendList(appUserFriend);
ids = list.stream().map(x->x.getFriendId()).collect(Collectors.toList());
ids = list.stream().map(x -> x.getFriendId()).collect(Collectors.toList());
break;
case 2://关注
AppUserFans appUserFans = new AppUserFans();
appUserFans.setUserId(appUser.getAppId());
List<AppUserFans> userFans = appUserFansMapper.selectAppUserFansList(appUserFans);
ids = userFans.stream().map(x->x.getFriendId()).collect(Collectors.toList());
ids = userFans.stream().map(x -> x.getFriendId()).collect(Collectors.toList());
break;
case 3://粉丝
appUserFans = new AppUserFans();
appUserFans.setUserId(null);
appUserFans.setFriendId(appUser.getAppId());
userFans = appUserFansMapper.selectAppUserFansList(appUserFans);
ids = userFans.stream().map(x->x.getFriendId()).collect(Collectors.toList());
ids = userFans.stream().map(x -> x.getFriendId()).collect(Collectors.toList());
break;
}
appUser.setIds(ids);

View File

@ -30,12 +30,11 @@ public class OssServiceImpl implements OssService {
try {
//4、 创建OSSClient实例。
OSS ossClient = new OSSClientBuilder().build(schema + endpoint, accessKeyId, accessKeySecret);
String fileName = file.getOriginalFilename();//获取上传文件的名称
String fileName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));//获取上传文件的名称
InputStream inputStream = file.getInputStream();
// 通过ossClient上传文件 参数1桶名 参数2上传后的文件路径+文件名 ,参数3要上传的文件流
String objectName = new DateTime().toString("yyyy/MM/dd/") +
UUID.randomUUID().toString().replace("-", "").substring(0, 16) +
"_" + fileName;//使用UUID+源文件名称后缀拼接生成objectName
UUID.randomUUID().toString().replace("-", "").substring(0, 16) + fileName;//使用UUID+源文件名称后缀拼接生成objectName
ossClient.putObject(bucketName, objectName, inputStream);
// 关闭OSSClient。
ossClient.shutdown();
@ -61,7 +60,7 @@ public class OssServiceImpl implements OssService {
InputStream inputStream = file.getInputStream();
// 通过ossClient上传文件 参数1桶名 参数2上传后的文件路径+文件名 ,参数3要上传的文件流
String objectName = new DateTime().toString("yyyy/MM/dd/") +
UUID.randomUUID().toString().replace("-", "").substring(0, 16) +
UUID.randomUUID().toString().replace("-", "").substring(0, 8) +
"_" + fileName;//使用UUID+源文件名称后缀拼接生成objectName
ossClient.putObject(bucketName, objectName, inputStream);
// 关闭OSSClient。

View File

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.app.mapper.AppCountryMapper">
<resultMap type="AppCountry" id="AppCountryResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="parentId" column="parent_id" />
</resultMap>
<sql id="selectAppCountryVo">
select id, name, parent_id from app_country
</sql>
<select id="selectAppCountryList" parameterType="AppCountry" resultMap="AppCountryResult">
<include refid="selectAppCountryVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="parentId != null "> and parent_id = #{parentId}</if>
</where>
</select>
<select id="selectAppCountryById" parameterType="Long" resultMap="AppCountryResult">
<include refid="selectAppCountryVo"/>
where id = #{id}
</select>
<insert id="insertAppCountry" parameterType="AppCountry">
insert into app_country
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="name != null">name,</if>
<if test="parentId != null">parent_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="name != null">#{name},</if>
<if test="parentId != null">#{parentId},</if>
</trim>
</insert>
<update id="updateAppCountry" parameterType="AppCountry">
update app_country
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteAppCountryById" parameterType="Long">
delete from app_country where id = #{id}
</delete>
<delete id="deleteAppCountryByIds" parameterType="String">
delete from app_country where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -32,7 +32,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.content as "content",
a.create_time as "createTime",
u.username as "username",
u.avatar_url as "avatarUrl"
u.avatar_url as "avatarUrl",
u.`check` as "check",
u.nickname as "nickname"
from app_dynamic_comment a
LEFT JOIN app_user u on u.id = a.user_id
where a.dynamic_id = #{dynamicId}

View File

@ -21,10 +21,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="email" column="email" />
<result property="invitationCode" column="invitation_code" />
<result property="status" column="status" />
<result property="pushId" column="push_id" />
<result property="education" column="education" />
<result property="major" column="major" />
<result property="companyName" column="company_name" />
<result property="nickname" column="nickname" />
</resultMap>
<sql id="selectAppRegisterVo">
select id, phone, create_time, update_time, create_by, updateBy, remark, username, prove, avatar_url, sex, address, school_id, email ,invitation_code ,status from app_register
select id, phone, create_time, update_time, create_by, updateBy, remark, username, prove, avatar_url, sex, address, school_id, email ,invitation_code ,status , push_id , education , major , company_name , nickname from app_register
</sql>
<select id="selectAppRegisterList" parameterType="AppRegister" resultMap="AppRegisterResult">
@ -40,6 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="schoolId != null "> and school_id = #{schoolId}</if>
<if test="email != null and email != ''"> and email = #{email}</if>
</where>
order by create_time desc
</select>
<select id="selectAppRegisterById" parameterType="Long" resultMap="AppRegisterResult">
@ -65,6 +71,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="email != null">email,</if>
<if test="invitationCode != null">invitation_code,</if>
<if test="status != null">status,</if>
<if test="pushId != null">push_id,</if>
<if test="education != null">education,</if>
<if test="major != null">major,</if>
<if test="companyName != null">company_name,</if>
<if test="nickname != null">nickname,</if>
<if test="provinceId != null">province_id,</if>
<if test="cityId != null">city_id,</if>
<if test="townId != null">town_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="phone != null">#{phone},</if>
@ -82,7 +96,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="email != null">#{email},</if>
<if test="invitationCode != null">#{invitationCode},</if>
<if test="status != null">#{status},</if>
</trim>
<if test="pushId != null">#{pushId},</if>
<if test="education != null">#{education},</if>
<if test="major != null">#{major},</if>
<if test="companyName != null">#{companyName},</if>
<if test="nickname != null">#{nickname},</if>
<if test="provinceId != null">#{provinceId},</if>
<if test="cityId != null">#{cityId},</if>
<if test="townId != null">#{townId},</if>
</trim>
</insert>
<update id="updateAppRegister" parameterType="AppRegister">
@ -103,6 +125,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="email != null">email = #{email},</if>
<if test="invitationCode != null">invitation_code = #{invitationCode},</if>
<if test="status != null">status = #{status},</if>
<if test="pushId != null">push_id = #{pushId},</if>
<if test="education != null">education = #{education},</if>
<if test="major != null">major = #{major},</if>
<if test="companyName != null">company_name = #{companyName},</if>
<if test="nickname != null">nickname = #{nickname},</if>
</trim>
where id = #{id}
</update>
@ -138,8 +165,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="schoolId != null">school_id = #{schoolId},</if>
<if test="email != null">email = #{email},</if>
<if test="invitationCode != null">invitation_code = #{invitationCode},</if>
<if test="education != null">education = #{education},</if>
<if test="major != null">major = #{major},</if>
<if test="companyName != null">company_name = #{companyName},</if>
<if test="pushId != null">push_id = #{pushId},</if>
<if test="nickname != null">nickname = #{nickname},</if>
status = 0,
</trim>
where phone = #{phone}
</update>
<select id="selectAppRegisterCount" resultType="long">
select count(1) from app_register
</select>
</mapper>

View File

@ -102,4 +102,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
</where>
</select>
<select id="selectAppSchoolByName" resultMap="AppSchoolResult">
<include refid="selectAppSchoolVo"/>
where name = #{name}
</select>
<update id="updateAppSchoolByName">
update app_school
<trim prefix="SET" suffixOverrides=",">
<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 name = #{name}
</update>
</mapper>

View File

@ -91,9 +91,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteAppTopicByIds" parameterType="String">
delete from app_topic where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
delete from app_topic where id = #{id}
</delete>
<select id="hasChildById" resultType="Integer">
select count(1) from app_topic where parent_id = #{id}
</select>
</mapper>

View File

@ -56,7 +56,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.city_id as "cityId",
c.name as "cityName",
t.name as "townName",
p.name as "provinceName"
p.name as "provinceName",
u.`check` as "check",
u.nickname as "nickname"
from app_user_dynamic a
left join app_user u on u.id = a.user_id
left join app_city c on c.id = a.city_id

View File

@ -45,7 +45,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectFriendList" parameterType="AppUserFriend" resultType="com.ruoyi.app.domain.vo.AppUserFriendVo">
select a.id as "id",a.user_id as "userId",a.friend_id as "friendId",a.status as "status",a.create_time as "createTime",
u.username as "username",
u.avatar_url as "avatarUrl"
u.avatar_url as "avatarUrl",
u.nickname as "nickname",
u.`check` as "check"
from app_user_friend a
left join app_user u on u.id = a.friend_id
<where>

View File

@ -140,6 +140,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
s.name as "schoolName",
t.name as "cityName",
a.id as "userId",
a.job_end_time as "jobEndTime",
count(DISTINCT(r.id)) as "friendNum",
count(DISTINCT(l.id)) as "likeNum",
count(DISTINCT(f.id)) as "attentionNum",
@ -317,6 +318,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="education != null">education = #{education},</if>
<if test="school != null">school = #{school},</if>
<if test="major != null">major = #{major},</if>
<if test="isMember != null">is_member = #{isMember},</if>
<if test="startTime != null">start_time = #{startTime},</if>
<if test="endTime != null">end_time = #{endTime},</if>
<if test="experience != null">experience = #{experience},</if>

View File

@ -42,3 +42,11 @@ export function delSchool(id) {
method: 'delete'
})
}
export function uploadAvatar(data) {
return request({
url: '/api/oss/upload',
method: 'post',
data: data
})
}

View File

@ -269,7 +269,6 @@ export default {
this.schoolList = response.rows;
this.total = response.total;
this.loading = false;
console.log(response.rows);
this.schoolOptions = response.rows; // Correct way to update schoolOptions
});
},
@ -279,6 +278,7 @@ export default {
listRegister(this.queryParams).then(response => {
this.registerList = response.rows;
this.total = response.total;
console.log(response.total);
this.loading = false;
});
},

View File

@ -36,25 +36,12 @@
</el-col>
<el-col :span="1.5">
<el-button
type="success"
type="info"
plain
icon="el-icon-edit"
icon="el-icon-upload2"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['app:school:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['app:school:remove']"
>删除</el-button>
@click="handleImport"
>导入</el-button>
</el-col>
<el-col :span="1.5">
<el-button
@ -70,9 +57,24 @@
</el-row>
<el-table v-loading="loading" :data="schoolList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="学校id" align="center" prop="id" />
<el-table-column label="学校名称" align="center" prop="name" />
<el-table-column label="邮箱后缀" align="center" prop="email" />
<el-table-column
prop="schoolImg"
header-align="center"
align="center"
label="头像"
>
<template slot-scope="scope" class="demo-image__preview">
<img
:src="scope.row.schoolImg"
width="40"
height="40"
class="head_pic"
/>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
@ -107,17 +109,61 @@
<el-form-item label="学校名称" prop="name">
<el-input v-model="form.name" placeholder="请输入学校名称" />
</el-form-item>
<el-form-item label="邮箱域名" prop="email">
<el-input v-model="form.email" placeholder="请输入邮箱域名" />
</el-form-item>
<!-- <el-form-item label="学校头像">-->
<!-- <el-upload-->
<!-- class="avatar-uploader"-->
<!-- action="http://localhost:1024/dev-api//api/oss/upload"-->
<!-- :show-file-list="false"-->
<!-- :on-success="handleAvatarSuccess"-->
<!-- :before-upload="beforeAvatarUpload">-->
<!-- <img v-if="imageUrl" :src="imageUrl" class="avatar">-->
<!-- <i v-else class="el-icon-plus avatar-uploader-icon"></i>-->
<!-- </el-upload>-->
<!-- </el-form-item>-->
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<el-upload
ref="upload"
:limit="1"
accept=".xlsx, .xls"
:headers="upload.headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:auto-upload="false"
drag
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div class="el-upload__tip text-center" slot="tip">
<div class="el-upload__tip" slot="tip">
<el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的用户数据
</div>
<span>仅允许导入xlsxlsx格式文件</span>
<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate"></el-link>
</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm"> </el-button>
<el-button @click="upload.open = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listSchool, getSchool, delSchool, addSchool, updateSchool } from "@/api/app/school";
import { listSchool, getSchool, delSchool, addSchool, updateSchool , uploadAvatar } from "@/api/app/school";
import {getToken} from "@/utils/auth";
export default {
name: "School",
@ -151,7 +197,21 @@ export default {
form: {},
//
rules: {
}
},
upload: {
//
open: false,
//
title: "",
//
isUploading: false,
//
updateSupport: 0,
//
headers: { Authorization: "Bearer " + getToken() },
//
url: process.env.VUE_APP_BASE_API + "app/school/importData",
},
};
},
created() {
@ -251,7 +311,55 @@ export default {
this.download('app/school/export', {
...this.queryParams
}, `school_${new Date().getTime()}.xlsx`)
}
},
/** 导入按钮操作 */
handleImport() {
this.upload.title = "学校导入";
this.upload.open = true;
},
handleFileSuccess(response, file, fileList) {
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
this.getList();
},
//
submitFileForm() {
this.$refs.upload.submit();
},
importTemplate() {
this.download('app/school/importTemplate', {
}, `school_template_${new Date().getTime()}.xlsx`)
},
}
};
</script>
<style>
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #409EFF;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 178px;
height: 178px;
line-height: 178px;
text-align: center;
}
.avatar {
width: 178px;
height: 178px;
display: block;
}
</style>

View File

@ -1,3 +1,5 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
@ -28,43 +30,23 @@
</el-col>
<el-col :span="1.5">
<el-button
type="success"
type="info"
plain
icon="el-icon-edit"
icon="el-icon-sort"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['app:topic:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['app:topic:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['app:topic:export']"
>导出</el-button>
@click="toggleExpandAll"
>展开/折叠</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table
v-if="refreshTable"
v-loading="loading"
:data="topicList"
@selection-change="handleSelectionChange"
:default-expand-all="isExpandAll"
row-key="id"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
>
@ -143,14 +125,55 @@
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<el-dialog :title="title" :visible.sync="openUpdate" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="24" v-if="form.type === '0'">
<el-form-item label="话题分类" prop="name">
<el-input v-model="form.name" placeholder="请输入话题分类" />
</el-form-item>
</el-col>
<el-col :span="24" v-if="form.type === '1'">
<el-form-item label="话题名称" prop="parentId">
<el-select
v-model="form.parentId"
placeholder="请选择话题分类"
>
<el-option
v-for="item in options"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24" v-if="form.type === '1'">
<el-form-item label="话题名称" prop="name">
<el-input v-model="form.name" placeholder="请输入话题名称" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listTopic, getTopic, delTopic, addTopic, updateTopic ,listAppTopic } from "@/api/app/topic";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import IconSelect from "@/components/IconSelect";
export default {
name: "Topic",
components: { Treeselect, IconSelect },
data() {
return {
//
@ -163,6 +186,8 @@ export default {
multiple: true,
//
showSearch: true,
refreshTable: true,
isExpandAll: false,
//
total: 0,
//
@ -171,6 +196,7 @@ export default {
title: "",
//
open: false,
openUpdate: false,
//
queryParams: {
pageNum: 1,
@ -195,7 +221,7 @@ export default {
/** 查询话题信息列表 */
getAppTopic() {
this.loading = true;
// this.loading = true;
this.queryParams.parentId = 0;
this.queryParams.pageNum = 1;
this.queryParams.pageSize = 10000;
@ -222,14 +248,14 @@ export default {
//
reset() {
this.form = {
id: null,
name: null,
createTime: null,
updateTime: null,
createBy: null,
updateBy: null,
remark: null,
type: '0'
id: undefined,
name: undefined,
createTime: undefined,
updateTime: undefined,
createBy: undefined,
updateBy: undefined,
remark: undefined,
type: '1'
};
this.resetForm("form");
},
@ -259,11 +285,11 @@ export default {
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.getList();
this.getAppTopic();
const id = row.id || this.ids
getTopic(id).then(response => {
this.form = response.data;
this.open = true;
this.openUpdate = true;
this.title = "修改话题信息";
});
},
@ -274,7 +300,9 @@ export default {
if (this.form.id != null) {
updateTopic(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.openUpdate = false;
this.queryParams.parentId = null ;
this.getList();
this.reset();
});
@ -282,7 +310,9 @@ export default {
addTopic(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.queryParams.parentId = null ;
this.getList();
this.reset();
});
}
}
@ -303,7 +333,15 @@ export default {
this.download('app/topic/export', {
...this.queryParams
}, `topic_${new Date().getTime()}.xlsx`)
}
},
/** 展开/折叠操作 */
toggleExpandAll() {
this.refreshTable = false;
this.isExpandAll = !this.isExpandAll;
this.$nextTick(() => {
this.refreshTable = true;
});
},
}
};
</script>

View File

@ -256,6 +256,7 @@ export default {
list(this.addDateRange(this.queryParams, this.dateRange)).then( response => {
this.list = response.rows;
this.total = response.total;
console.log(response.total);
this.loading = false;
}
);