Compare commits

..

No commits in common. "061afaa89a678cbd26dc3a9cc72d61fef25e28f9" and "46bb732ced2a2d262cfd728d38a9fdefd4ced5ee" have entirely different histories.

50 changed files with 297 additions and 1437 deletions

View File

@ -1,98 +0,0 @@
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,19 +148,6 @@
<groupId>org.thymeleaf</groupId> <groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf</artifactId> <artifactId>thymeleaf</artifactId>
</dependency> </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> </dependencies>

View File

@ -1,115 +0,0 @@
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

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

View File

@ -1,22 +1,11 @@
package com.ruoyi.app.controller; 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.util.List;
import java.io.IOException; import java.io.IOException;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import cn.hutool.http.HttpUtil;
import com.ruoyi.app.domain.vo.AppRegisterVo; import com.ruoyi.app.domain.vo.AppRegisterVo;
import io.swagger.annotations.Api; 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.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.log.annotation.Log; import com.ruoyi.common.log.annotation.Log;
@ -39,7 +28,8 @@ import springfox.documentation.annotations.ApiIgnore;
@RestController @RestController
@RequestMapping("/register") @RequestMapping("/register")
@ApiIgnore @ApiIgnore
public class AppRegisterController extends BaseController { public class AppRegisterController extends BaseController
{
@Autowired @Autowired
private IAppRegisterService appRegisterService; private IAppRegisterService appRegisterService;
@ -48,21 +38,22 @@ public class AppRegisterController extends BaseController {
*/ */
@RequiresPermissions("app:register:list") @RequiresPermissions("app:register:list")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(AppRegister appRegister) { public TableDataInfo list(AppRegister appRegister)
{
startPage(); startPage();
List<AppRegisterVo> list = appRegisterService.selectAppRegisterList(appRegister); List<AppRegisterVo> list = appRegisterService.selectAppRegisterList(appRegister);
TableDataInfo dataTable = getDataTable(list); return getDataTable(list);
dataTable.setTotal(appRegisterService.selectAppRegisterCount(appRegister));
return dataTable;
} }
/** /**
* *
*/ */
@RequiresPermissions("app:register:query") @RequiresPermissions("app:register:query")
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) { public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(appRegisterService.selectAppRegisterById(id)); return success(appRegisterService.selectAppRegisterById(id));
} }
@ -72,7 +63,8 @@ public class AppRegisterController extends BaseController {
@RequiresPermissions("app:register:add") @RequiresPermissions("app:register:add")
@Log(title = "注册审核", businessType = BusinessType.INSERT) @Log(title = "注册审核", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody AppRegister appRegister) { public AjaxResult add(@RequestBody AppRegister appRegister)
{
return toAjax(appRegisterService.insertAppRegister(appRegister)); return toAjax(appRegisterService.insertAppRegister(appRegister));
} }
@ -82,7 +74,8 @@ public class AppRegisterController extends BaseController {
@RequiresPermissions("app:register:edit") @RequiresPermissions("app:register:edit")
@Log(title = "注册审核", businessType = BusinessType.UPDATE) @Log(title = "注册审核", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody AppRegister appRegister) { public AjaxResult edit(@RequestBody AppRegister appRegister)
{
return toAjax(appRegisterService.updateAppRegister(appRegister)); return toAjax(appRegisterService.updateAppRegister(appRegister));
} }
@ -92,36 +85,21 @@ public class AppRegisterController extends BaseController {
@RequiresPermissions("app:register:remove") @RequiresPermissions("app:register:remove")
@Log(title = "注册审核", businessType = BusinessType.DELETE) @Log(title = "注册审核", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) { public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(appRegisterService.deleteAppRegisterByIds(ids)); return toAjax(appRegisterService.deleteAppRegisterByIds(ids));
} }
@GetMapping("/pass") @GetMapping("/pass")
public AjaxResult pass(@RequestParam("id") Long id) { public AjaxResult pass(@RequestParam("id") Long id){
return toAjax(appRegisterService.passAppRegister(id)); return toAjax(appRegisterService.passAppRegister(id));
} }
@PostMapping("/reject") @PostMapping("/reject")
public AjaxResult reject(@RequestBody AppRegister appRegister) { public AjaxResult reject(@RequestBody AppRegister appRegister)
{
return toAjax(appRegisterService.rejectAppRegister(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,8 +4,6 @@ import java.util.List;
import java.io.IOException; import java.io.IOException;
import javax.servlet.http.HttpServletResponse; 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.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -19,7 +17,6 @@ import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil; import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo; import com.ruoyi.common.core.web.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/** /**
* Controller * Controller
@ -58,14 +55,15 @@ public class AppSchoolController extends BaseController
/** /**
* *
*/ */
@Log(title = "学校配置", businessType = BusinessType.EXPORT) // @RequiresPermissions("app:school:export")
@PostMapping("/export") // @Log(title = "学校配置", businessType = BusinessType.EXPORT)
public void export(HttpServletResponse response, AppSchool appSchool) // @PostMapping("/export")
{ // public void export(HttpServletResponse response, AppSchool appSchool)
List<AppSchool> list = appSchoolService.selectAppSchoolList(appSchool); // {
ExcelUtil<AppSchool> util = new ExcelUtil<AppSchool>(AppSchool.class); // List<AppSchool> list = appSchoolService.selectAppSchoolList(appSchool);
util.exportExcel(response, list, "学校配置数据"); // ExcelUtil<AppSchool> util = new ExcelUtil<AppSchool>(AppSchool.class);
} // util.exportExcel(response, list, "学校配置数据");
// }
/** /**
* *
@ -113,21 +111,4 @@ public class AppSchoolController extends BaseController
{ {
return toAjax(appSchoolService.deleteAppSchoolByIds(ids)); 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,15 +116,10 @@ public class AppTopicController extends BaseController
*/ */
@RequiresPermissions("app:topic:remove") @RequiresPermissions("app:topic:remove")
@Log(title = "话题信息", businessType = BusinessType.DELETE) @Log(title = "话题信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{id}") @DeleteMapping("/{ids}")
@ApiOperation(value = "删除话题信息", notes = "删除话题信息", httpMethod = "DELETE") @ApiOperation(value = "删除话题信息", notes = "删除话题信息", httpMethod = "DELETE")
public AjaxResult remove(@PathVariable Long id) public AjaxResult remove(@PathVariable Long[] ids)
{ {
return toAjax(appTopicService.deleteAppTopicByIds(ids));
if (appTopicService.hasChildById(id)) {
return warn("存在子集数据,不允许删除");
}
return toAjax(appTopicService.deleteAppTopicByIds(id));
} }
} }

View File

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

View File

@ -1,9 +1,6 @@
package com.ruoyi.app.controller; 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.app.utils.aliyun.sms.SendNoteUtil;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.domain.AjaxResult;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -24,26 +21,11 @@ public class PhoneCodeController {
@Autowired @Autowired
private SendNoteUtil sendNoteUtil; private SendNoteUtil sendNoteUtil;
@Autowired
private IAppRegisterService appRegisterService;
@GetMapping(value = "/send") @GetMapping(value = "/send")
@ApiOperation(value = "发送短信验证码", notes = "发送短信验证码", httpMethod = "GET") @ApiOperation(value = "发送短信验证码", notes = "发送短信验证码", httpMethod = "GET")
public AjaxResult sendCode(@RequestParam("phoneNumber") String phoneNum , @RequestParam("type") Integer type){ public AjaxResult sendCode(@RequestParam("phoneNumber") String phoneNum){
String send = "";
if (type == 1) {
AppRegister appRegister = appRegisterService.selectAppRegisterByphone(phoneNum); String send = sendNoteUtil.sendNoteMessgae(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)) { if ("OK".equals(send)) {
return AjaxResult.success(); return AjaxResult.success();

View File

@ -1,65 +0,0 @@
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,7 +1,5 @@
package com.ruoyi.app.domain; 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.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel; import com.ruoyi.common.core.annotation.Excel;
@ -13,8 +11,6 @@ import com.ruoyi.common.core.web.domain.BaseEntity;
* @author wyh * @author wyh
* @date 2024-04-23 * @date 2024-04-23
*/ */
@Data
public class AppRegister extends BaseEntity public class AppRegister extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -61,28 +57,6 @@ public class AppRegister extends BaseEntity
@Excel(name = "审核状态") @Excel(name = "审核状态")
private Integer status; 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) public void setId(Long id)
{ {
this.id = id; this.id = id;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,6 @@
package com.ruoyi.app.form; package com.ruoyi.app.form;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.ruoyi.common.core.annotation.Excel;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -37,29 +36,6 @@ public class RegisterForm {
@ApiModelProperty("学校证明") @ApiModelProperty("学校证明")
private String prove; 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 @JsonIgnore
private Integer status; private Integer status;
} }

View File

@ -1,61 +0,0 @@
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,7 +64,4 @@ public interface AppRegisterMapper
String phoneNumber); String phoneNumber);
int updateAppRegisterByPhone(AppRegister appRegister); int updateAppRegisterByPhone(AppRegister appRegister);
long selectAppRegisterCount(AppRegister appRegister);
} }

View File

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

View File

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

View File

@ -1,61 +0,0 @@
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,6 +68,4 @@ public interface IAppRegisterService
AppRegister selectAppRegisterByphone(String phoneNumber); AppRegister selectAppRegisterByphone(String phoneNumber);
long selectAppRegisterCount(AppRegister appRegister);
} }

View File

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

View File

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

View File

@ -1,93 +0,0 @@
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) { public static List<AppDynamicCommentVo> getChildrenAppDynamicCommentVoById(Long parentId, List<AppDynamicCommentVo> AppDynamicCommentVos) {
List<AppDynamicCommentVo> children = new ArrayList<AppDynamicCommentVo>(); List<AppDynamicCommentVo> children = new ArrayList<AppDynamicCommentVo>();
for (AppDynamicCommentVo node : AppDynamicCommentVos) { for (AppDynamicCommentVo node : AppDynamicCommentVos) {
if (parentId.equals(node.getParentId())) { if (node.getParentId() == parentId) {
//装载parentId对应的子节点 //装载parentId对应的子节点
children.add(node); children.add(node);
} }

View File

@ -7,11 +7,9 @@ import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.ruoyi.app.domain.AppCity; import com.ruoyi.app.domain.AppCity;
import com.ruoyi.app.domain.AppCountry;
import com.ruoyi.app.domain.AppTown; import com.ruoyi.app.domain.AppTown;
import com.ruoyi.app.domain.vo.AreaVo; import com.ruoyi.app.domain.vo.AreaVo;
import com.ruoyi.app.mapper.AppCityMapper; import com.ruoyi.app.mapper.AppCityMapper;
import com.ruoyi.app.mapper.AppCountryMapper;
import com.ruoyi.app.mapper.AppTownMapper; import com.ruoyi.app.mapper.AppTownMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -36,9 +34,6 @@ public class AppProvinceServiceImpl implements IAppProvinceService {
@Autowired @Autowired
private AppTownMapper appTownMapper; private AppTownMapper appTownMapper;
@Autowired
private AppCountryMapper appCountryMapper;
/** /**
* *
* *
@ -118,7 +113,6 @@ public class AppProvinceServiceImpl implements IAppProvinceService {
areaVo.setIsLeaf(false); areaVo.setIsLeaf(false);
List<AreaVo> list = new ArrayList<>(); List<AreaVo> list = new ArrayList<>();
List<AppCity> appCities = appCityMapper.selectAppCityListByProvinceId(appProvince.getId()); List<AppCity> appCities = appCityMapper.selectAppCityListByProvinceId(appProvince.getId());
boolean flag = true; boolean flag = true;
for (AppCity appCity : appCities) { for (AppCity appCity : appCities) {
if (appCity.getName().equals(areaVo.getName())) { if (appCity.getName().equals(areaVo.getName())) {
@ -160,22 +154,57 @@ public class AppProvinceServiceImpl implements IAppProvinceService {
} }
areaVos.add(areaVo); 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; 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,7 +4,6 @@ import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import cn.hutool.core.lang.Assert; import cn.hutool.core.lang.Assert;
import cn.hutool.http.HttpUtil;
import com.ruoyi.app.domain.AppSchool; import com.ruoyi.app.domain.AppSchool;
import com.ruoyi.app.domain.AppUser; import com.ruoyi.app.domain.AppUser;
import com.ruoyi.app.domain.vo.AppRegisterVo; import com.ruoyi.app.domain.vo.AppRegisterVo;
@ -13,14 +12,8 @@ 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.ALiYunMailUtil;
import com.ruoyi.common.core.utils.mail.MailUtil; 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 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.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;
@ -36,7 +29,8 @@ import javax.mail.MessagingException;
* @date 2024-04-23 * @date 2024-04-23
*/ */
@Service @Service
public class AppRegisterServiceImpl implements IAppRegisterService { public class AppRegisterServiceImpl implements IAppRegisterService
{
@Autowired @Autowired
private AppRegisterMapper appRegisterMapper; private AppRegisterMapper appRegisterMapper;
@ -53,7 +47,8 @@ public class AppRegisterServiceImpl implements IAppRegisterService {
* @return * @return
*/ */
@Override @Override
public AppRegister selectAppRegisterById(Long id) { public AppRegister selectAppRegisterById(Long id)
{
return appRegisterMapper.selectAppRegisterById(id); return appRegisterMapper.selectAppRegisterById(id);
} }
@ -64,10 +59,10 @@ public class AppRegisterServiceImpl implements IAppRegisterService {
* @return * @return
*/ */
@Override @Override
public List<AppRegisterVo> selectAppRegisterList(AppRegister appRegister) { public List<AppRegisterVo> selectAppRegisterList(AppRegister appRegister)
{
List<AppRegister> appRegisters = appRegisterMapper.selectAppRegisterList(appRegister); List<AppRegister> appRegisters = appRegisterMapper.selectAppRegisterList(appRegister);
return appRegisters.stream().map(register -> { List<AppRegisterVo> collect = appRegisters.stream().map(register -> {
AppRegisterVo appRegisterVo = new AppRegisterVo(); AppRegisterVo appRegisterVo = new AppRegisterVo();
BeanUtils.copyBeanProp(appRegisterVo, register); BeanUtils.copyBeanProp(appRegisterVo, register);
AppSchool appSchool = appSchoolMapper.selectAppSchoolById(register.getSchoolId()); AppSchool appSchool = appSchoolMapper.selectAppSchoolById(register.getSchoolId());
@ -77,6 +72,7 @@ public class AppRegisterServiceImpl implements IAppRegisterService {
return appRegisterVo; return appRegisterVo;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
return collect;
} }
/** /**
@ -86,7 +82,8 @@ public class AppRegisterServiceImpl implements IAppRegisterService {
* @return * @return
*/ */
@Override @Override
public int insertAppRegister(AppRegister appRegister) { public int insertAppRegister(AppRegister appRegister)
{
appRegister.setCreateTime(DateUtils.getNowDate()); appRegister.setCreateTime(DateUtils.getNowDate());
return appRegisterMapper.insertAppRegister(appRegister); return appRegisterMapper.insertAppRegister(appRegister);
} }
@ -98,7 +95,8 @@ public class AppRegisterServiceImpl implements IAppRegisterService {
* @return * @return
*/ */
@Override @Override
public int updateAppRegister(AppRegister appRegister) { public int updateAppRegister(AppRegister appRegister)
{
appRegister.setUpdateTime(DateUtils.getNowDate()); appRegister.setUpdateTime(DateUtils.getNowDate());
return appRegisterMapper.updateAppRegister(appRegister); return appRegisterMapper.updateAppRegister(appRegister);
} }
@ -116,7 +114,8 @@ public class AppRegisterServiceImpl implements IAppRegisterService {
* @return * @return
*/ */
@Override @Override
public int deleteAppRegisterByIds(Long[] ids) { public int deleteAppRegisterByIds(Long[] ids)
{
return appRegisterMapper.deleteAppRegisterByIds(ids); return appRegisterMapper.deleteAppRegisterByIds(ids);
} }
@ -127,7 +126,8 @@ public class AppRegisterServiceImpl implements IAppRegisterService {
* @return * @return
*/ */
@Override @Override
public int deleteAppRegisterById(Long id) { public int deleteAppRegisterById(Long id)
{
return appRegisterMapper.deleteAppRegisterById(id); return appRegisterMapper.deleteAppRegisterById(id);
} }
@ -135,47 +135,15 @@ public class AppRegisterServiceImpl implements IAppRegisterService {
public int passAppRegister(Long id) { public int passAppRegister(Long id) {
AppRegister appRegister = appRegisterMapper.selectAppRegisterById(id); AppRegister appRegister = appRegisterMapper.selectAppRegisterById(id);
Assert.isTrue(appRegister != null, "该申请不存在"); Assert.isTrue(appRegister != null, "该申请不存在");
Assert.isTrue(appRegister.getStatus() != null && appRegister.getStatus() == 0, "该申请已审核"); Assert.isTrue(appRegister.getStatus() == 0, "该申请已审核");
appRegister.setStatus(1); appRegister.setStatus(1);
appRegister.setUpdateTime(DateUtils.getNowDate()); appRegister.setUpdateTime(DateUtils.getNowDate());
int i = appRegisterMapper.updateAppRegister(appRegister); int i = appRegisterMapper.updateAppRegister(appRegister);
if (i > 0) { if (i != 0) {
AppUser appUser = new AppUser(); AppUser appUser = new AppUser();
BeanUtils.copyProperties(appRegister, appUser); BeanUtils.copyBeanProp(appUser, appRegister);
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); 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; return i;
} }
@ -190,24 +158,7 @@ public class AppRegisterServiceImpl implements IAppRegisterService {
register.setRemark(appRegister.getRemark()); register.setRemark(appRegister.getRemark());
} }
appRegister.setUpdateTime(DateUtils.getNowDate()); appRegister.setUpdateTime(DateUtils.getNowDate());
int i = appRegisterMapper.updateAppRegister(appRegister); return 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 @Override
@ -216,25 +167,18 @@ public class AppRegisterServiceImpl implements IAppRegisterService {
return appRegisterMapper.selectAppRegisterByphone(phoneNumber); return appRegisterMapper.selectAppRegisterByphone(phoneNumber);
} }
@Override
public long selectAppRegisterCount(AppRegister appRegister) {
return appRegisterMapper.selectAppRegisterCount(appRegister);
}
public static void main(String[] args) { public static void main(String[] args) {
String token = "4e290542-53f3-4a33-96ff-9510dd050100"; String token = "4e290542-53f3-4a33-96ff-9510dd050100";
String email = "653809315@qq.com"; String email = "653809315@qq.com";
String EM = "<html><body><h2>欢迎来到我们的服务!!</h2>" String EM = "<html><body><h2>欢迎来到我们的服务!!</h2>"
+ "<p>请点击下面的网址确认您的注册:</p>" + "<p>请点击下面的网址确认您的注册:</p>"
+ "<p>http://127.0.0.1:9204/app/activation/" + token + "/" + email + "</p>" + "<p>http://101.133.172.2:9204/app/activation/"+ token + "/" + email + "</p>"
+ "</body></html>"; + "</body></html>";
try { try {
ALiYunMailUtil.sendMail(EM, email); MailUtil.send_mail( "653809315@qq.com",EM);
} catch (MessagingException e) { } catch (MessagingException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} catch (Exception e) {
throw new RuntimeException(e);
} }
} }
} }

View File

@ -1,21 +1,14 @@
package com.ruoyi.app.service.impl; package com.ruoyi.app.service.impl;
import java.util.List; import java.util.List;
import com.ruoyi.common.core.exception.ServiceException;
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.bean.BeanValidators;
import com.ruoyi.common.security.utils.SecurityUtils; import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.domain.SysUser;
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.AppSchoolMapper; import com.ruoyi.app.mapper.AppSchoolMapper;
import com.ruoyi.app.domain.AppSchool; import com.ruoyi.app.domain.AppSchool;
import com.ruoyi.app.service.IAppSchoolService; import com.ruoyi.app.service.IAppSchoolService;
import javax.validation.Validator;
/** /**
* Service * Service
* *
@ -23,14 +16,11 @@ import javax.validation.Validator;
* @date 2024-04-18 * @date 2024-04-18
*/ */
@Service @Service
public class AppSchoolServiceImpl implements IAppSchoolService { public class AppSchoolServiceImpl implements IAppSchoolService
{
@Autowired @Autowired
private AppSchoolMapper appSchoolMapper; private AppSchoolMapper appSchoolMapper;
@Autowired
protected Validator validator;
/** /**
* *
* *
@ -38,7 +28,8 @@ public class AppSchoolServiceImpl implements IAppSchoolService {
* @return * @return
*/ */
@Override @Override
public AppSchool selectAppSchoolById(Long id) { public AppSchool selectAppSchoolById(Long id)
{
return appSchoolMapper.selectAppSchoolById(id); return appSchoolMapper.selectAppSchoolById(id);
} }
@ -49,7 +40,8 @@ public class AppSchoolServiceImpl implements IAppSchoolService {
* @return * @return
*/ */
@Override @Override
public List<AppSchool> selectAppSchoolList(AppSchool appSchool) { public List<AppSchool> selectAppSchoolList(AppSchool appSchool)
{
return appSchoolMapper.selectAppSchoolList(appSchool); return appSchoolMapper.selectAppSchoolList(appSchool);
} }
@ -60,7 +52,8 @@ public class AppSchoolServiceImpl implements IAppSchoolService {
* @return * @return
*/ */
@Override @Override
public int insertAppSchool(AppSchool appSchool) { public int insertAppSchool(AppSchool appSchool)
{
appSchool.setCreateTime(DateUtils.getNowDate()); appSchool.setCreateTime(DateUtils.getNowDate());
appSchool.setUpdateTime(DateUtils.getNowDate()); appSchool.setUpdateTime(DateUtils.getNowDate());
appSchool.setCreateBy(SecurityUtils.getUsername()); appSchool.setCreateBy(SecurityUtils.getUsername());
@ -75,7 +68,8 @@ public class AppSchoolServiceImpl implements IAppSchoolService {
* @return * @return
*/ */
@Override @Override
public int updateAppSchool(AppSchool appSchool) { public int updateAppSchool(AppSchool appSchool)
{
appSchool.setUpdateTime(DateUtils.getNowDate()); appSchool.setUpdateTime(DateUtils.getNowDate());
appSchool.setUpdateBy(SecurityUtils.getUsername()); appSchool.setUpdateBy(SecurityUtils.getUsername());
return appSchoolMapper.updateAppSchool(appSchool); return appSchoolMapper.updateAppSchool(appSchool);
@ -88,7 +82,8 @@ public class AppSchoolServiceImpl implements IAppSchoolService {
* @return * @return
*/ */
@Override @Override
public int deleteAppSchoolByIds(Long[] ids) { public int deleteAppSchoolByIds(Long[] ids)
{
return appSchoolMapper.deleteAppSchoolByIds(ids); return appSchoolMapper.deleteAppSchoolByIds(ids);
} }
@ -99,7 +94,8 @@ public class AppSchoolServiceImpl implements IAppSchoolService {
* @return * @return
*/ */
@Override @Override
public int deleteAppSchoolById(Long id) { public int deleteAppSchoolById(Long id)
{
return appSchoolMapper.deleteAppSchoolById(id); return appSchoolMapper.deleteAppSchoolById(id);
} }
@ -108,48 +104,4 @@ public class AppSchoolServiceImpl implements IAppSchoolService {
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 id * @param ids
* @return * @return
*/ */
@Override @Override
public int deleteAppTopicByIds(Long id) public int deleteAppTopicByIds(Long[] ids)
{ {
return appTopicMapper.deleteAppTopicByIds(id); return appTopicMapper.deleteAppTopicByIds(ids);
} }
/** /**
@ -115,10 +115,4 @@ public class AppTopicServiceImpl implements IAppTopicService
{ {
return appTopicMapper.deleteAppTopicById(id); return appTopicMapper.deleteAppTopicById(id);
} }
@Override
public boolean hasChildById(Long id) {
int i = appTopicMapper.hasChildById(id);
return i > 0;
}
} }

View File

@ -1,6 +1,5 @@
package com.ruoyi.app.service.impl; package com.ruoyi.app.service.impl;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -215,21 +214,6 @@ public class AppUserDynamicServiceImpl implements IAppUserDynamicService
AppDynamicComment appDynamicComment = new AppDynamicComment(); AppDynamicComment appDynamicComment = new AppDynamicComment();
appDynamicComment.setDynamicId(id); appDynamicComment.setDynamicId(id);
appUserDynamicVo.setCountComment(appDynamicCommentMapper.selectAppDynamicCommentList(appDynamicComment).size()); 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; return list;
} }

View File

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

View File

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

View File

@ -1,63 +0,0 @@
<?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,9 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.content as "content", a.content as "content",
a.create_time as "createTime", a.create_time as "createTime",
u.username as "username", 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 from app_dynamic_comment a
LEFT JOIN app_user u on u.id = a.user_id LEFT JOIN app_user u on u.id = a.user_id
where a.dynamic_id = #{dynamicId} where a.dynamic_id = #{dynamicId}

View File

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

View File

@ -102,20 +102,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if> <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
</where> </where>
</select> </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> </mapper>

View File

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

View File

@ -56,9 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.city_id as "cityId", a.city_id as "cityId",
c.name as "cityName", c.name as "cityName",
t.name as "townName", 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 from app_user_dynamic a
left join app_user u on u.id = a.user_id left join app_user u on u.id = a.user_id
left join app_city c on c.id = a.city_id left join app_city c on c.id = a.city_id

View File

@ -45,9 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectFriendList" parameterType="AppUserFriend" resultType="com.ruoyi.app.domain.vo.AppUserFriendVo"> <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", 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.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 from app_user_friend a
left join app_user u on u.id = a.friend_id left join app_user u on u.id = a.friend_id
<where> <where>

View File

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

View File

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

View File

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

View File

@ -36,12 +36,25 @@
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="info" type="success"
plain plain
icon="el-icon-upload2" icon="el-icon-edit"
size="mini" size="mini"
@click="handleImport" :disabled="single"
>导入</el-button> @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>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -57,24 +70,9 @@
</el-row> </el-row>
<el-table v-loading="loading" :data="schoolList" @selection-change="handleSelectionChange"> <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="学校id" align="center" prop="id" />
<el-table-column label="学校名称" align="center" prop="name" /> <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"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
@ -109,61 +107,17 @@
<el-form-item label="学校名称" prop="name"> <el-form-item label="学校名称" prop="name">
<el-input v-model="form.name" placeholder="请输入学校名称" /> <el-input v-model="form.name" placeholder="请输入学校名称" />
</el-form-item> </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> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </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> </div>
</template> </template>
<script> <script>
import { listSchool, getSchool, delSchool, addSchool, updateSchool , uploadAvatar } from "@/api/app/school"; import { listSchool, getSchool, delSchool, addSchool, updateSchool } from "@/api/app/school";
import {getToken} from "@/utils/auth";
export default { export default {
name: "School", name: "School",
@ -197,21 +151,7 @@ export default {
form: {}, form: {},
// //
rules: { rules: {
}, }
upload: {
//
open: false,
//
title: "",
//
isUploading: false,
//
updateSupport: 0,
//
headers: { Authorization: "Bearer " + getToken() },
//
url: process.env.VUE_APP_BASE_API + "app/school/importData",
},
}; };
}, },
created() { created() {
@ -311,55 +251,7 @@ export default {
this.download('app/school/export', { this.download('app/school/export', {
...this.queryParams ...this.queryParams
}, `school_${new Date().getTime()}.xlsx`) }, `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> </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,5 +1,3 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
@ -30,23 +28,43 @@
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="info" type="success"
plain plain
icon="el-icon-sort" icon="el-icon-edit"
size="mini" size="mini"
@click="toggleExpandAll" :disabled="single"
>展开/折叠</el-button> @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>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table <el-table
v-if="refreshTable"
v-loading="loading" v-loading="loading"
:data="topicList" :data="topicList"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
:default-expand-all="isExpandAll"
row-key="id" row-key="id"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}" :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
> >
@ -125,55 +143,14 @@
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </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> </div>
</template> </template>
<script> <script>
import { listTopic, getTopic, delTopic, addTopic, updateTopic ,listAppTopic } from "@/api/app/topic"; 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 { export default {
name: "Topic", name: "Topic",
components: { Treeselect, IconSelect },
data() { data() {
return { return {
// //
@ -186,8 +163,6 @@ export default {
multiple: true, multiple: true,
// //
showSearch: true, showSearch: true,
refreshTable: true,
isExpandAll: false,
// //
total: 0, total: 0,
// //
@ -196,7 +171,6 @@ export default {
title: "", title: "",
// //
open: false, open: false,
openUpdate: false,
// //
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
@ -221,7 +195,7 @@ export default {
/** 查询话题信息列表 */ /** 查询话题信息列表 */
getAppTopic() { getAppTopic() {
// this.loading = true; this.loading = true;
this.queryParams.parentId = 0; this.queryParams.parentId = 0;
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;
this.queryParams.pageSize = 10000; this.queryParams.pageSize = 10000;
@ -248,14 +222,14 @@ export default {
// //
reset() { reset() {
this.form = { this.form = {
id: undefined, id: null,
name: undefined, name: null,
createTime: undefined, createTime: null,
updateTime: undefined, updateTime: null,
createBy: undefined, createBy: null,
updateBy: undefined, updateBy: null,
remark: undefined, remark: null,
type: '1' type: '0'
}; };
this.resetForm("form"); this.resetForm("form");
}, },
@ -285,11 +259,11 @@ export default {
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
this.getAppTopic(); this.getList();
const id = row.id || this.ids const id = row.id || this.ids
getTopic(id).then(response => { getTopic(id).then(response => {
this.form = response.data; this.form = response.data;
this.openUpdate = true; this.open = true;
this.title = "修改话题信息"; this.title = "修改话题信息";
}); });
}, },
@ -300,9 +274,7 @@ export default {
if (this.form.id != null) { if (this.form.id != null) {
updateTopic(this.form).then(response => { updateTopic(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.openUpdate = false; this.open = false;
this.queryParams.parentId = null ;
this.getList(); this.getList();
this.reset(); this.reset();
}); });
@ -310,9 +282,7 @@ export default {
addTopic(this.form).then(response => { addTopic(this.form).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.open = false; this.open = false;
this.queryParams.parentId = null ;
this.getList(); this.getList();
this.reset();
}); });
} }
} }
@ -333,15 +303,7 @@ export default {
this.download('app/topic/export', { this.download('app/topic/export', {
...this.queryParams ...this.queryParams
}, `topic_${new Date().getTime()}.xlsx`) }, `topic_${new Date().getTime()}.xlsx`)
}, }
/** 展开/折叠操作 */
toggleExpandAll() {
this.refreshTable = false;
this.isExpandAll = !this.isExpandAll;
this.$nextTick(() => {
this.refreshTable = true;
});
},
} }
}; };
</script> </script>

View File

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