From b01bbb168eb36be0bbace118e79c8defcb5c566d Mon Sep 17 00:00:00 2001 From: linhw <5331581+linhw11@user.noreply.gitee.com> Date: Thu, 27 Jun 2024 16:22:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=9F=E8=83=BD=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/controller/AppLoginController.java | 35 ++- .../app/controller/AppRegisterController.java | 254 +++++++++--------- .../app/controller/AppUserController.java | 8 + .../ruoyi/app/controller/PayController.java | 5 +- .../java/com/ruoyi/app/domain/AppVip.java | 3 + .../ruoyi/app/service/IAppUserService.java | 2 + .../service/impl/AppRegisterServiceImpl.java | 5 +- .../app/service/impl/AppUserServiceImpl.java | 18 ++ .../resources/mapper/app/AppMessageMapper.xml | 1 + .../resources/mapper/app/AppVipMapper.xml | 11 +- 10 files changed, 207 insertions(+), 135 deletions(-) diff --git a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/controller/AppLoginController.java b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/controller/AppLoginController.java index ffd5321..7bbbbfc 100644 --- a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/controller/AppLoginController.java +++ b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/controller/AppLoginController.java @@ -33,6 +33,7 @@ import com.ruoyi.common.security.utils.SecurityUtils; import com.ruoyi.system.api.model.LoginUser; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.Assert; import org.springframework.web.bind.annotation.*; @@ -51,6 +52,7 @@ import static com.alibaba.nacos.api.common.Constants.ACCESS_TOKEN; @Api( tags = "APP-登录接口" ) +@Slf4j public class AppLoginController { @Autowired @@ -94,7 +96,34 @@ public class AppLoginController { Assert.notNull(appSchool, "学校不存在!"); String email = registerForm.getEmail(); - if (StringUtils.isNotEmpty(email) && appSchool.getEmail() != null && appSchool.getEmail().equals(email.substring(email.indexOf("@") + 1,email.length()))) { + if (org.apache.commons.lang3.StringUtils.isNotBlank(email)) { + if (org.apache.commons.lang3.StringUtils.isBlank(registerForm.getProve()) && org.apache.commons.lang3.StringUtils.isBlank(appSchool.getEmail())) { + return R.fail(2001,"该学校没有提供邮箱审核,请人工审核!"); + } + String emailStr = email.substring(email.indexOf("@") + 1,email.length()); + if (org.apache.commons.lang3.StringUtils.isBlank(registerForm.getProve()) && !emailStr.equals(appSchool.getEmail())) { + return R.fail(2001,"您提供的邮箱后缀与您的学校不符!请提供学习邮箱或人工审核。"); + } + AppRegister appRegister = setAppRegister(registerForm); + //校验邮箱是否已注册 + AppUser emailUser = appUserService.selectAppUserByEmail(registerForm.getEmail()); + if (emailUser != null && emailUser.getId() != null) { + return R.fail(2001,"该邮箱已注册请重新输入!"); + } + String uuid = IdUtils.fastUUID(); + redisService.setCacheObject(uuid, registerForm); + try { + String EM = "

欢迎来到我们的服务!!

" + + "

请点击下面的网址确认您的注册:

" + + "注册账号" + + ""; + AliMailUtil.sendMail(EM,registerForm.getEmail()); + log.info("邮箱发送成功-------------------"); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + /*if (StringUtils.isNotEmpty(email) && appSchool.getEmail() != null && appSchool.getEmail().equals(email.substring(email.indexOf("@") + 1,email.length()))) { AppRegister appRegister = setAppRegister(registerForm); //校验邮箱是否已注册 AppUser emailUser = appUserService.selectAppUserByEmail(registerForm.getEmail()); @@ -104,14 +133,14 @@ public class AppLoginController { try { String EM = "

欢迎来到我们的服务!!

" + "

请点击下面的网址确认您的注册:

" - + "注册账号" + + "注册账号" + ""; AliMailUtil.sendMail(EM,registerForm.getEmail()); } catch (Exception e) { throw new RuntimeException(e); } - } + }*/ if (register != null && register.getStatus() != null) { diff --git a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/controller/AppRegisterController.java b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/controller/AppRegisterController.java index e0b7df4..d19675f 100644 --- a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/controller/AppRegisterController.java +++ b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/controller/AppRegisterController.java @@ -1,127 +1,127 @@ -package com.ruoyi.app.controller; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.HttpURLConnection; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; - -import cn.hutool.http.HttpUtil; -import com.ruoyi.app.domain.vo.AppRegisterVo; -import io.swagger.annotations.Api; -import org.apache.http.HttpResponse; -import org.apache.http.client.HttpClient; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.util.EntityUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; -import com.ruoyi.common.log.annotation.Log; -import com.ruoyi.common.log.enums.BusinessType; -import com.ruoyi.common.security.annotation.RequiresPermissions; -import com.ruoyi.app.domain.AppRegister; -import com.ruoyi.app.service.IAppRegisterService; -import com.ruoyi.common.core.web.controller.BaseController; -import com.ruoyi.common.core.web.domain.AjaxResult; -import com.ruoyi.common.core.utils.poi.ExcelUtil; -import com.ruoyi.common.core.web.page.TableDataInfo; -import springfox.documentation.annotations.ApiIgnore; - -/** - * 注册审核Controller - * - * @author wyh - * @date 2024-04-23 - */ -@RestController -@RequestMapping("/register") -@ApiIgnore -public class AppRegisterController extends BaseController { - @Autowired - private IAppRegisterService appRegisterService; - - /** - * 查询注册审核列表 - */ - @RequiresPermissions("app:register:list") - @GetMapping("/list") - public TableDataInfo list(AppRegister appRegister) { - startPage(); - List list = appRegisterService.selectAppRegisterList(appRegister); - TableDataInfo dataTable = getDataTable(list); - dataTable.setTotal(appRegisterService.selectAppRegisterCount(appRegister)); - return dataTable; - } - - - /** - * 获取注册审核详细信息 - */ - @RequiresPermissions("app:register:query") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) { - return success(appRegisterService.selectAppRegisterById(id)); - } - - /** - * 新增注册审核 - */ - @RequiresPermissions("app:register:add") - @Log(title = "注册审核", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody AppRegister appRegister) { - return toAjax(appRegisterService.insertAppRegister(appRegister)); - } - - /** - * 修改注册审核 - */ - @RequiresPermissions("app:register:edit") - @Log(title = "注册审核", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody AppRegister appRegister) { - return toAjax(appRegisterService.updateAppRegister(appRegister)); - } - - /** - * 删除注册审核 - */ - @RequiresPermissions("app:register:remove") - @Log(title = "注册审核", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) { - return toAjax(appRegisterService.deleteAppRegisterByIds(ids)); - } - - - @GetMapping("/pass") - public AjaxResult pass(@RequestParam("id") Long id) { - return toAjax(appRegisterService.passAppRegister(id)); - } - - @PostMapping("/reject") - public AjaxResult reject(@RequestBody AppRegister appRegister) { - return toAjax(appRegisterService.rejectAppRegister(appRegister)); - } - - - public static void main(String[] args) { - HttpClient httpClient = HttpClients.createDefault(); - String pushId = "7e63c670480d8f2060f8d21800c3ae17"; - String url = "https://fc-mp-7a162b82-1b95-423b-bbba-424378aedca1.next.bspapp.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(); - } - } -} +package com.ruoyi.app.controller; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +import cn.hutool.http.HttpUtil; +import com.ruoyi.app.domain.vo.AppRegisterVo; +import io.swagger.annotations.Api; +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import com.ruoyi.common.log.annotation.Log; +import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.common.security.annotation.RequiresPermissions; +import com.ruoyi.app.domain.AppRegister; +import com.ruoyi.app.service.IAppRegisterService; +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.core.utils.poi.ExcelUtil; +import com.ruoyi.common.core.web.page.TableDataInfo; +import springfox.documentation.annotations.ApiIgnore; + +/** + * 注册审核Controller + * + * @author wyh + * @date 2024-04-23 + */ +@RestController +@RequestMapping("/register") +@ApiIgnore +public class AppRegisterController extends BaseController { + @Autowired + private IAppRegisterService appRegisterService; + + /** + * 查询注册审核列表 + */ + @RequiresPermissions("app:register:list") + @GetMapping("/list") + public TableDataInfo list(AppRegister appRegister) { + startPage(); + List list = appRegisterService.selectAppRegisterList(appRegister); + TableDataInfo dataTable = getDataTable(list); + dataTable.setTotal(appRegisterService.selectAppRegisterCount(appRegister)); + return dataTable; + } + + + /** + * 获取注册审核详细信息 + */ + @RequiresPermissions("app:register:query") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) { + return success(appRegisterService.selectAppRegisterById(id)); + } + + /** + * 新增注册审核 + */ + @RequiresPermissions("app:register:add") + @Log(title = "注册审核", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody AppRegister appRegister) { + return toAjax(appRegisterService.insertAppRegister(appRegister)); + } + + /** + * 修改注册审核 + */ + @RequiresPermissions("app:register:edit") + @Log(title = "注册审核", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody AppRegister appRegister) { + return toAjax(appRegisterService.updateAppRegister(appRegister)); + } + + /** + * 删除注册审核 + */ + @RequiresPermissions("app:register:remove") + @Log(title = "注册审核", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + return toAjax(appRegisterService.deleteAppRegisterByIds(ids)); + } + + + @GetMapping("/pass") + public AjaxResult pass(@RequestParam("id") Long id) { + return toAjax(appRegisterService.passAppRegister(id)); + } + + @PostMapping("/reject") + public AjaxResult reject(@RequestBody AppRegister appRegister) { + return toAjax(appRegisterService.rejectAppRegister(appRegister)); + } + + + public static void main(String[] args) { + HttpClient httpClient = HttpClients.createDefault(); + String pushId = "7e63c670480d8f2060f8d21800c3ae17"; + String url = "https://fc-mp-7a162b82-1b95-423b-bbba-424378aedca1.next.bspapp.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(); + } + } +} diff --git a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/controller/AppUserController.java b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/controller/AppUserController.java index 3b55c35..47f78b6 100644 --- a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/controller/AppUserController.java +++ b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/controller/AppUserController.java @@ -122,6 +122,14 @@ public class AppUserController extends BaseController return toAjax(appUserService.updateAppUser(appUser)); } + @Log(title = "app用户修改手机号", businessType = BusinessType.UPDATE) + @PutMapping("/editPhone") + @ApiOperation(value = "修改app用户信息", notes = "修改app用户信息", httpMethod = "PUT") + public AjaxResult editPhone(@RequestBody AppUser appUser) + { + return appUserService.editPhone(appUser); + } + /** * 删除app用户 */ diff --git a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/controller/PayController.java b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/controller/PayController.java index c1d7237..df46b17 100644 --- a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/controller/PayController.java +++ b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/controller/PayController.java @@ -431,7 +431,10 @@ public class PayController extends BaseController endDate = startDate; } endDate = appOrder.getLevel() == 1 ? DateUtils.dateAddTime(endDate,3,7) - : (appOrder.getLevel() == 2 ? DateUtils.dateAddTime(endDate,4,31) : DateUtils.dateAddTime(endDate,5,365)); + : (appOrder.getLevel() == 2 ? DateUtils.dateAddTime(endDate,4,1) : DateUtils.dateAddTime(endDate,5,1)); + if (appOrder.getLevel() == 4) { + endDate = DateUtils.dateAddTime(endDate,4,3); + } userEntity.setOrderStartTime(startDate); userEntity.setOrderEndTime(endDate); userEntity.setUpdateTime(new Date()); diff --git a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/domain/AppVip.java b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/domain/AppVip.java index f67a627..361833d 100644 --- a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/domain/AppVip.java +++ b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/domain/AppVip.java @@ -26,6 +26,9 @@ public class AppVip extends BaseEntity @Excel(name = "会员金额") private Long price; + @Excel(name = "0展示1不展示") + private Long status; + public void setId(Long id) { this.id = id; diff --git a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/service/IAppUserService.java b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/service/IAppUserService.java index af3efb0..a9428f1 100644 --- a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/service/IAppUserService.java +++ b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/service/IAppUserService.java @@ -49,6 +49,8 @@ public interface IAppUserService */ public int updateAppUser(AppUser appUser); + AjaxResult editPhone(AppUser appUser); + /** * 批量删除app用户 * diff --git a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/service/impl/AppRegisterServiceImpl.java b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/service/impl/AppRegisterServiceImpl.java index dc2f4df..2e09b48 100644 --- a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/service/impl/AppRegisterServiceImpl.java +++ b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/service/impl/AppRegisterServiceImpl.java @@ -234,7 +234,10 @@ public class AppRegisterServiceImpl implements IAppRegisterService { endDate = startDate; } endDate = order.getLevel() == 1 ? DateUtils.dateAddTime(endDate,3,7) - : (order.getLevel() == 2 ? DateUtils.dateAddTime(endDate,4,31) : DateUtils.dateAddTime(endDate,5,365)); + : (order.getLevel() == 2 ? DateUtils.dateAddTime(endDate,4,1) : DateUtils.dateAddTime(endDate,5,1)); + if (order.getLevel() == 4) { + endDate = DateUtils.dateAddTime(endDate,4,3); + } userEntity.setOrderStartTime(startDate); userEntity.setOrderEndTime(endDate); userEntity.setUpdateTime(new Date()); diff --git a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/service/impl/AppUserServiceImpl.java b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/service/impl/AppUserServiceImpl.java index 4f61e12..709a184 100644 --- a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/service/impl/AppUserServiceImpl.java +++ b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/service/impl/AppUserServiceImpl.java @@ -365,4 +365,22 @@ public class AppUserServiceImpl implements IAppUserService { return appUserMapper.selectAppuserCount(); } + + @Override + public AjaxResult editPhone(AppUser appUser) { + AppUser entity = appUserMapper.selectAppUserById(appUser.getId()); + if (appUser.getPhone() == entity.getPhone()) { + return AjaxResult.error(2001,"不能和原手机号一致!"); + } + entity = appUserMapper.selectAppUserByPhone(appUser.getPhone()); + if (entity != null) { + return AjaxResult.error(2001,"该手机号已存在请重新注册!"); + } + entity = new AppUser(); + entity.setId(appUser.getId()); + entity.setPhone(appUser.getPhone()); + entity.setUpdateTime(DateUtils.getNowDate()); + appUserMapper.updateAppUser(entity); + return AjaxResult.success(); + } } diff --git a/gan-modules/ruoyi-gan/src/main/resources/mapper/app/AppMessageMapper.xml b/gan-modules/ruoyi-gan/src/main/resources/mapper/app/AppMessageMapper.xml index 22ec87a..9d34c22 100644 --- a/gan-modules/ruoyi-gan/src/main/resources/mapper/app/AppMessageMapper.xml +++ b/gan-modules/ruoyi-gan/src/main/resources/mapper/app/AppMessageMapper.xml @@ -34,6 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and u.username like concat('%',#{username},'%') and a.content like concat('%',#{content},'%') and a.img_url = #{imgUrl} + and a.type = #{type} diff --git a/gan-modules/ruoyi-gan/src/main/resources/mapper/app/AppVipMapper.xml b/gan-modules/ruoyi-gan/src/main/resources/mapper/app/AppVipMapper.xml index b68320c..9596a2a 100644 --- a/gan-modules/ruoyi-gan/src/main/resources/mapper/app/AppVipMapper.xml +++ b/gan-modules/ruoyi-gan/src/main/resources/mapper/app/AppVipMapper.xml @@ -11,10 +11,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + - select id, create_time, update_time, remark, level, price from app_vip + select id, create_time, update_time, remark, level, price, status from app_vip @@ -39,7 +41,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" remark, level, price, - + status, + #{id}, #{createTime}, @@ -47,7 +50,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{remark}, #{level}, #{price}, - + #{status}, + @@ -58,6 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" remark = #{remark}, level = #{level}, price = #{price}, + status = #{status}, where id = #{id}