功能新增

main
linhw 2024-06-27 16:22:13 +08:00
parent 134525de69
commit b01bbb168e
10 changed files with 207 additions and 135 deletions

View File

@ -33,6 +33,7 @@ import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.model.LoginUser; import com.ruoyi.system.api.model.LoginUser;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -51,6 +52,7 @@ import static com.alibaba.nacos.api.common.Constants.ACCESS_TOKEN;
@Api( @Api(
tags = "APP-登录接口" tags = "APP-登录接口"
) )
@Slf4j
public class AppLoginController { public class AppLoginController {
@Autowired @Autowired
@ -94,7 +96,34 @@ public class AppLoginController {
Assert.notNull(appSchool, "学校不存在!"); Assert.notNull(appSchool, "学校不存在!");
String email = registerForm.getEmail(); 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 = "<html><body><h2>欢迎来到我们的服务!!</h2>"
+ "<p>请点击下面的网址确认您的注册:</p>"
+ "<a href=https://gobig.flameby.com/api/app/activation/" + uuid + "/" + registerForm.getEmail() + ">注册账号</a>"
+ "</body></html>";
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); AppRegister appRegister = setAppRegister(registerForm);
//校验邮箱是否已注册 //校验邮箱是否已注册
AppUser emailUser = appUserService.selectAppUserByEmail(registerForm.getEmail()); AppUser emailUser = appUserService.selectAppUserByEmail(registerForm.getEmail());
@ -104,14 +133,14 @@ public class AppLoginController {
try { try {
String EM = "<html><body><h2>欢迎来到我们的服务!!</h2>" String EM = "<html><body><h2>欢迎来到我们的服务!!</h2>"
+ "<p>请点击下面的网址确认您的注册:</p>" + "<p>请点击下面的网址确认您的注册:</p>"
+ "<a href=http://139.224.213.131:7008/app/activation/" + uuid + "/" + registerForm.getEmail() + ">注册账号</a>" + "<a href=https://gobig.flameby.com/api/app/activation/" + uuid + "/" + registerForm.getEmail() + ">注册账号</a>"
+ "</body></html>"; + "</body></html>";
AliMailUtil.sendMail(EM,registerForm.getEmail()); AliMailUtil.sendMail(EM,registerForm.getEmail());
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }*/
if (register != null && register.getStatus() != null) { if (register != null && register.getStatus() != null) {

View File

@ -1,127 +1,127 @@
package com.ruoyi.app.controller; package com.ruoyi.app.controller;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; 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 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.HttpResponse;
import org.apache.http.client.HttpClient; import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils; 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;
import com.ruoyi.common.log.enums.BusinessType; import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions; import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.app.domain.AppRegister; import com.ruoyi.app.domain.AppRegister;
import com.ruoyi.app.service.IAppRegisterService; import com.ruoyi.app.service.IAppRegisterService;
import com.ruoyi.common.core.web.controller.BaseController; 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 springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
/** /**
* Controller * Controller
* *
* @author wyh * @author wyh
* @date 2024-04-23 * @date 2024-04-23
*/ */
@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;
/** /**
* *
*/ */
@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); TableDataInfo dataTable = getDataTable(list);
dataTable.setTotal(appRegisterService.selectAppRegisterCount(appRegister)); dataTable.setTotal(appRegisterService.selectAppRegisterCount(appRegister));
return dataTable; 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));
} }
/** /**
* *
*/ */
@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));
} }
/** /**
* *
*/ */
@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));
} }
/** /**
* *
*/ */
@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) { public static void main(String[] args) {
HttpClient httpClient = HttpClients.createDefault(); HttpClient httpClient = HttpClients.createDefault();
String pushId = "7e63c670480d8f2060f8d21800c3ae17"; String pushId = "7e63c670480d8f2060f8d21800c3ae17";
String url = "https://fc-mp-7a162b82-1b95-423b-bbba-424378aedca1.next.bspapp.com/urlPush/pushId?pushId=" + pushId + "&title=审核失败&content=审核被驳回"; String url = "https://fc-mp-7a162b82-1b95-423b-bbba-424378aedca1.next.bspapp.com/urlPush/pushId?pushId=" + pushId + "&title=审核失败&content=审核被驳回";
try { try {
HttpGet request = new HttpGet(url); HttpGet request = new HttpGet(url);
HttpResponse response = httpClient.execute(request); HttpResponse response = httpClient.execute(request);
// Get the response entity as a String // Get the response entity as a String
String jsonResponse = EntityUtils.toString(response.getEntity()); String jsonResponse = EntityUtils.toString(response.getEntity());
System.out.println(jsonResponse); System.out.println(jsonResponse);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
} }

View File

@ -122,6 +122,14 @@ public class AppUserController extends BaseController
return toAjax(appUserService.updateAppUser(appUser)); 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 * app
*/ */

View File

@ -431,7 +431,10 @@ public class PayController extends BaseController
endDate = startDate; endDate = startDate;
} }
endDate = appOrder.getLevel() == 1 ? DateUtils.dateAddTime(endDate,3,7) 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.setOrderStartTime(startDate);
userEntity.setOrderEndTime(endDate); userEntity.setOrderEndTime(endDate);
userEntity.setUpdateTime(new Date()); userEntity.setUpdateTime(new Date());

View File

@ -26,6 +26,9 @@ public class AppVip extends BaseEntity
@Excel(name = "会员金额") @Excel(name = "会员金额")
private Long price; private Long price;
@Excel(name = "0展示1不展示")
private Long status;
public void setId(Long id) public void setId(Long id)
{ {
this.id = id; this.id = id;

View File

@ -49,6 +49,8 @@ public interface IAppUserService
*/ */
public int updateAppUser(AppUser appUser); public int updateAppUser(AppUser appUser);
AjaxResult editPhone(AppUser appUser);
/** /**
* app * app
* *

View File

@ -234,7 +234,10 @@ public class AppRegisterServiceImpl implements IAppRegisterService {
endDate = startDate; endDate = startDate;
} }
endDate = order.getLevel() == 1 ? DateUtils.dateAddTime(endDate,3,7) 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.setOrderStartTime(startDate);
userEntity.setOrderEndTime(endDate); userEntity.setOrderEndTime(endDate);
userEntity.setUpdateTime(new Date()); userEntity.setUpdateTime(new Date());

View File

@ -365,4 +365,22 @@ public class AppUserServiceImpl implements IAppUserService {
return appUserMapper.selectAppuserCount(); 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();
}
} }

View File

@ -34,6 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="username != null "> and u.username like concat('%',#{username},'%')</if> <if test="username != null "> and u.username like concat('%',#{username},'%')</if>
<if test="content != null and content != ''"> and a.content like concat('%',#{content},'%')</if> <if test="content != null and content != ''"> and a.content like concat('%',#{content},'%')</if>
<if test="imgUrl != null and imgUrl != ''"> and a.img_url = #{imgUrl}</if> <if test="imgUrl != null and imgUrl != ''"> and a.img_url = #{imgUrl}</if>
<if test="type != null and type != ''"> and a.type = #{type}</if>
</where> </where>
</select> </select>

View File

@ -11,10 +11,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="remark" column="remark" /> <result property="remark" column="remark" />
<result property="level" column="level" /> <result property="level" column="level" />
<result property="price" column="price" /> <result property="price" column="price" />
<result property="status" column="status" />
</resultMap> </resultMap>
<sql id="selectAppVipVo"> <sql id="selectAppVipVo">
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
</sql> </sql>
<select id="selectAppVipList" parameterType="AppVip" resultMap="AppVipResult"> <select id="selectAppVipList" parameterType="AppVip" resultMap="AppVipResult">
@ -22,6 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where> <where>
<if test="level != null "> and level = #{level}</if> <if test="level != null "> and level = #{level}</if>
<if test="price != null "> and price = #{price}</if> <if test="price != null "> and price = #{price}</if>
<if test="status != null "> and status = #{status}</if>
</where> </where>
</select> </select>
@ -39,7 +41,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="remark != null">remark,</if> <if test="remark != null">remark,</if>
<if test="level != null">level,</if> <if test="level != null">level,</if>
<if test="price != null">price,</if> <if test="price != null">price,</if>
</trim> <if test="status != null">status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if> <if test="id != null">#{id},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
@ -47,7 +50,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="remark != null">#{remark},</if> <if test="remark != null">#{remark},</if>
<if test="level != null">#{level},</if> <if test="level != null">#{level},</if>
<if test="price != null">#{price},</if> <if test="price != null">#{price},</if>
</trim> <if test="status != null">#{status},</if>
</trim>
</insert> </insert>
<update id="updateAppVip" parameterType="AppVip"> <update id="updateAppVip" parameterType="AppVip">
@ -58,6 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>
<if test="level != null">level = #{level},</if> <if test="level != null">level = #{level},</if>
<if test="price != null">price = #{price},</if> <if test="price != null">price = #{price},</if>
<if test="status != null">status = #{status},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>