ljx
parent
5d6644fd5b
commit
2716e42716
|
@ -54,7 +54,7 @@ public class SysPasswordService {
|
|||
throw new ServiceException(errMsg);
|
||||
}
|
||||
|
||||
if (!matches(user, password)) {
|
||||
if (!matches(user, password)) {
|
||||
retryCount = retryCount + 1;
|
||||
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, String.format("密码输入错误%s次", retryCount));
|
||||
redisService.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES);
|
||||
|
|
|
@ -24,6 +24,26 @@
|
|||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<!--邮箱依赖-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-mail</artifactId>
|
||||
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.4.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
<version>1.4.6</version>
|
||||
</dependency>
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package com.fivegroup.enter.apect;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.mail.javamail.JavaMailSender;
|
||||
import org.springframework.mail.javamail.JavaMailSenderImpl;
|
||||
|
||||
/**
|
||||
* @author LiuJiaXin
|
||||
* @version 2023/12/2 - 7:20
|
||||
*/
|
||||
@Configuration
|
||||
public class MailConfig {
|
||||
@Bean
|
||||
public JavaMailSender javaMailSender(){
|
||||
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
|
||||
return mailSender;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.fivegroup.enter.apect;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
/**
|
||||
* mybatis-plus分页
|
||||
*
|
||||
* @author LiuJiaXin
|
||||
* @version 2023/12/1 - 19:00
|
||||
*/
|
||||
@Configuration
|
||||
@EnableTransactionManagement
|
||||
public class MybatisPlusConfig {
|
||||
@Bean
|
||||
public MybatisPlusInterceptor mybatisPlusInterceptor(){
|
||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||
PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor();
|
||||
// paginationInnerInterceptor.setOptimizeJoin(true);
|
||||
paginationInnerInterceptor.setDbType(DbType.MYSQL);
|
||||
paginationInnerInterceptor.setOverflow(true);
|
||||
interceptor.addInnerInterceptor(paginationInnerInterceptor);
|
||||
OptimisticLockerInnerInterceptor optimisticLockerInnerInterceptor = new OptimisticLockerInnerInterceptor();
|
||||
interceptor.addInnerInterceptor(optimisticLockerInnerInterceptor);
|
||||
return interceptor;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
package com.fivegroup.enter.config;//package com.bwie.system.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CachePut;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.mail.javamail.JavaMailSender;
|
||||
import org.springframework.mail.javamail.MimeMessageHelper;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
|
||||
@Component
|
||||
public class EmailUtil {
|
||||
|
||||
@Autowired
|
||||
private JavaMailSender javaMailSender;
|
||||
|
||||
@CachePut(value = "aaa",key = "#email")
|
||||
public String saveCode(String code,String email){
|
||||
return code;
|
||||
}
|
||||
|
||||
@Cacheable(value = "aaa",key = "#email")
|
||||
public String getCode(String email){
|
||||
return null;
|
||||
}
|
||||
|
||||
//邮件发送 ===》封装的验证码发送方法
|
||||
public void sendCodeByEmail(String code,String email){
|
||||
|
||||
MimeMessage mimeMessage = javaMailSender.createMimeMessage();
|
||||
|
||||
try {
|
||||
MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true);
|
||||
helper.setSubject("验证码通知");
|
||||
//helper.setText("<a href='http://10.1.75.101:8080/student/confirmRead?id="+student.getId()+"'>点击</a>",true);
|
||||
helper.setText("您的验证码是:"+code);
|
||||
helper.setFrom("2779625738@qq.com");
|
||||
helper.setTo(email);
|
||||
helper.setTo(email);
|
||||
|
||||
javaMailSender.send(mimeMessage);
|
||||
} catch (MessagingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
// 图片
|
||||
// @Test
|
||||
// public void test(){
|
||||
//
|
||||
// MimeMessage mimeMessage = javaMailSender.createMimeMessage();
|
||||
// try {
|
||||
// MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true);
|
||||
// //标题
|
||||
// helper.setSubject("通知");
|
||||
// //内容
|
||||
// helper.setText("你好");
|
||||
// //发件人
|
||||
// helper.setFrom("2730874693@qq.com");
|
||||
// //收件人
|
||||
// helper.setTo("2730874693@qq.com");
|
||||
// //文件
|
||||
// helper.addAttachment("阿里云.txt",new File("C:\Users\1\Desktop"));
|
||||
//
|
||||
// javaMailSender.send(mimeMessage);
|
||||
// } catch (MessagingException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// 文件
|
||||
// @Test
|
||||
// public void test1(){
|
||||
//
|
||||
// MimeMessage mimeMessage = javaMailSender.createMimeMessage();
|
||||
// try {
|
||||
// MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true);
|
||||
// //标题
|
||||
// helper.setSubject("通知");
|
||||
// //内容
|
||||
// helper.setText("你好,给你看张图片<br>" + "<img src='cid:opp'>",true);
|
||||
// //发件人
|
||||
// helper.setFrom("2736321299@qq.com");
|
||||
// //收件人
|
||||
// helper.setTo("2736321299@qq.com");
|
||||
// //图片
|
||||
// helper.addInline("opp",new FileSystemResource(new File("C:\Users\1\Desktop\213.jpg")));
|
||||
//
|
||||
// javaMailSender.send(mimeMessage);
|
||||
// } catch (MessagingException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
}
|
|
@ -0,0 +1,110 @@
|
|||
package com.fivegroup.enter.controller;
|
||||
|
||||
import com.fivegroup.common.core.domain.Result;
|
||||
import com.fivegroup.common.system.domain.SysUser;
|
||||
import com.fivegroup.enter.apect.WebLog;
|
||||
import com.fivegroup.enter.demo.Center;
|
||||
import com.fivegroup.enter.service.AaaService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.support.SimpleTriggerContext;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author LiuJiaXin
|
||||
* @version 2023/12/2 - 9:03
|
||||
*/
|
||||
@RestController
|
||||
public class AaaController {
|
||||
@Autowired
|
||||
private AaaService aaaService;
|
||||
|
||||
/**
|
||||
* 若依 ======管理员找到对应的企业 点击生成账号 密码 进行随机生成并修改
|
||||
*/
|
||||
@PostMapping("/updateNamePassword")
|
||||
@WebLog(description = "随机生成账号和密码")
|
||||
public Result updateNamePassword(@RequestBody SysUser sysUser){
|
||||
aaaService.updateNamePassword(sysUser);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户id查询用户信息
|
||||
* @param sysUser
|
||||
* @return
|
||||
*/
|
||||
|
||||
@PostMapping("/showSysUser")
|
||||
@WebLog(description = "展示所有企业列表,倒序")
|
||||
public Result<List<SysUser>> showSysUser(@RequestBody SysUser sysUser){
|
||||
List<SysUser> list =aaaService.showSysUser(sysUser);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户邮箱发送账号密码
|
||||
* @param email
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/findByEmail/{email}")
|
||||
@WebLog(description = "根据用户邮箱发送账号密码")
|
||||
public Result findByEmail(@PathVariable String email){
|
||||
aaaService.findByEmail(email);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id修改中间表的审核状态 修改为待审核状态
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/updateRole/{userId}")
|
||||
@WebLog(description = "根据用户id修改用户审核")
|
||||
public Result updateRole(@PathVariable Integer userId){
|
||||
aaaService.updateRole(userId);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 企业根据注册id修改账号密码
|
||||
* @param sysUser
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("updateUserNamePassword")
|
||||
@WebLog(description = "企业修改账号和密码")
|
||||
public Result updateUserNamePassword(@RequestBody SysUser sysUser){
|
||||
aaaService.updateUserNamePassword(sysUser);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理员审核企业状态成为激活状态
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("updateRoleId/{userId}")
|
||||
@WebLog(description = "管理员审核企业状态为已激活状态")
|
||||
public Result updateRoleId(@PathVariable Integer userId){
|
||||
aaaService.updateRoleId(userId);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加中间表
|
||||
* @param center
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("addNumber")
|
||||
@WebLog(description = "添加中间表")
|
||||
public Result addNumber(@RequestBody Center center){
|
||||
aaaService.addNumber(center);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -31,11 +31,31 @@ public class FirmController {
|
|||
@PostMapping("/addFirm")
|
||||
@WebLog(description = "公司注册")
|
||||
public Result addFirm(@RequestBody Firm firm){
|
||||
firmService.addFirm(firm);
|
||||
firmService.save(firm);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("/findBykeeperEmail/{keeperEmail}")
|
||||
@WebLog(description = "邮箱号给企业发送账号和密码")
|
||||
public Result findBykeeperEmail(@PathVariable String keeperEmail){
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@GetMapping("/firmShow")
|
||||
@WebLog(description = "展示公司列表")
|
||||
public Result<List<Firm>> firmShow(){
|
||||
List<Firm> list = firmService.list();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* @PostMapping("firmShowPageinfo")
|
||||
@WebLog(description = "分页展示公司列表")
|
||||
public void firmShow(@PathVariable Integer gen){
|
||||
|
||||
}
|
||||
*/
|
||||
/**
|
||||
* 查询公司 最主要用于车辆入驻的动态下拉框使用
|
||||
* @return
|
||||
|
@ -52,10 +72,10 @@ public class FirmController {
|
|||
* @param firmId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/delFirm/{firmId}")
|
||||
@GetMapping("/delFirm")
|
||||
@WebLog(description = "注销公司")
|
||||
public Result delFirm(@PathVariable Integer firmId){
|
||||
firmService.delFirm(firmId);
|
||||
public Result delFirm(@RequestParam(value = "firmId") Integer firmId){
|
||||
firmService.removeById(firmId);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
@ -133,4 +153,7 @@ public class FirmController {
|
|||
firmService.selCar(carVin);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,203 @@
|
|||
package com.fivegroup.enter.controller;
|
||||
|
||||
import com.fivegroup.common.core.domain.Result;
|
||||
import com.fivegroup.enter.apect.WebLog;
|
||||
import com.fivegroup.enter.demo.Check;
|
||||
import com.fivegroup.enter.demo.Keeper;
|
||||
import com.fivegroup.enter.service.KeeperService;
|
||||
import org.apache.catalina.LifecycleState;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.connection.ReactiveSubscription;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 企业
|
||||
*
|
||||
* @author LiuJiaXin
|
||||
* @version 2023/12/1 - 23:07
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/keeper")
|
||||
public class KeeperController {
|
||||
@Autowired
|
||||
private KeeperService keeperService;
|
||||
/**
|
||||
* 若依 ======管理员找到对应的企业 点击生成账号 密码 进行随机生成并修改
|
||||
*/
|
||||
@PostMapping("/updateKeeperAdmin/{userId}")
|
||||
@WebLog(description = "随机生成账号和密码")
|
||||
public Result updateKeeperAdmin(@PathVariable Integer userId){
|
||||
keeperService.updateKeeperAdmin(userId);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 管理员手动添加企业基本信息(企业名称+企业注册时间+企业邮箱)
|
||||
* @param keeper
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/instertKeeper")
|
||||
@WebLog(description = "企业入驻")
|
||||
public Result instertKeeper(@RequestBody Keeper keeper){
|
||||
keeperService.save(keeper);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@PostMapping("/findByKeeperEmail/{keeperEmail}")
|
||||
@WebLog(description = "获取企业的账号密码通过邮箱的格式发送给企业")
|
||||
public Result findByKeeperEmail(@PathVariable String keeperEmail){
|
||||
keeperService.findByKeeperEmail(keeperEmail);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 添加企业
|
||||
* @param keeper
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/addKepper")
|
||||
@WebLog(description = "添加企业信息")
|
||||
public Result addKepper(@RequestBody Keeper keeper){
|
||||
keeperService.addKeeper(keeper);
|
||||
Result<Object> result = Result.success();
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有审核名称
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/showCheck")
|
||||
@WebLog(description = "查询所有审核名称")
|
||||
public Result<List<Check>> showCheck(){
|
||||
List<Check> list=keeperService.showCheck();
|
||||
Result<List<Check>> result = Result.success(list);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改等级为待审核
|
||||
* @param keeperId
|
||||
* @return
|
||||
*/
|
||||
|
||||
@PostMapping("/updatecheckId2")
|
||||
@WebLog(description = "修改审核等级为待审核")
|
||||
public Result updatecheckId2(@PathVariable Integer keeperId){
|
||||
keeperService.updatecheckId2(keeperId);
|
||||
Result<Object> result = Result.success();
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改审核等级为已激活
|
||||
* @param keepId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/updatecheckId1")
|
||||
@WebLog(description = "修改审核等级为已激活")
|
||||
public Result updatecheckId1(@PathVariable Integer keepId){
|
||||
keeperService.updatecheckId1(keepId);
|
||||
Result<Object> result = Result.success();
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 邮箱号发送账号密码
|
||||
* @param keeperEmail
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/findByemailgetCode/{keeperEmail}")
|
||||
@WebLog(description = "邮箱号发送账号和密码")
|
||||
public Result findByemailgetCode(@PathVariable String keeperEmail){
|
||||
keeperService.findByemailgetCode(keeperEmail);
|
||||
Result<Object> result = Result.success();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.fivegroup.enter.demo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 中间表
|
||||
*
|
||||
* @author LiuJiaXin
|
||||
* @version 2023/12/2 - 22:54
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("t_center")
|
||||
public class Center {
|
||||
@TableId(value = "center_id",type = IdType.AUTO)
|
||||
private Integer centerId;
|
||||
@TableField("userId")
|
||||
private Integer userId;
|
||||
@TableField("roleId")
|
||||
private Integer roleId;
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.fivegroup.enter.demo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 审核名称
|
||||
*
|
||||
* @author LiuJiaXin
|
||||
* @version 2023/12/1 - 23:37
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("t_check")
|
||||
public class Check {
|
||||
@TableId(value = "check_id",type = IdType.AUTO)
|
||||
private Integer checkId;
|
||||
@TableField("check_name")
|
||||
private String checkName;
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package com.fivegroup.enter.demo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 管理员表
|
||||
*
|
||||
* @author LiuJiaXin
|
||||
* @version 2023/12/1 - 21:56
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("t_keeper")
|
||||
public class Keeper {
|
||||
@TableId(value = "keeper_id",type = IdType.AUTO)
|
||||
private Integer keeperId;
|
||||
@TableField("keeper_name")
|
||||
private String keeperName;
|
||||
@TableField("keeper_time")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date keeperTime;
|
||||
@TableField("keeper_admin")
|
||||
private String keeperAdmin;
|
||||
@TableField("keeper_password")
|
||||
private String keeperPassword;
|
||||
@TableField("keeper_email")
|
||||
private String keeperEmail;
|
||||
@TableField("check_id")
|
||||
private Integer checkId;
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.fivegroup.enter.demo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 角色
|
||||
*
|
||||
* @author LiuJiaXin
|
||||
* @version 2023/12/2 - 23:10
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Role {
|
||||
@TableId(value = "centerId",type = IdType.AUTO)
|
||||
private Integer centerId;
|
||||
@TableField("userId")
|
||||
private Integer userId;
|
||||
@TableField("roleId")
|
||||
private Integer roleId;
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.fivegroup.enter.demo;
|
||||
|
||||
import com.alibaba.druid.sql.visitor.functions.Char;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 若依
|
||||
*
|
||||
* @author LiuJiaXin
|
||||
* @version 2023/12/2 - 7:57
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SysUser {
|
||||
private BigInteger userId;//用户ID
|
||||
private BigInteger deptId;//部门ID
|
||||
private String userName;//用户账号
|
||||
private String nickName;//用户昵称
|
||||
private String userType;//用户类型(00系统用户)
|
||||
private String email;//用户邮箱
|
||||
private String phonenumber;//手机号码
|
||||
private Char sex;//用户性别(0男 1女 2未知)
|
||||
private String avatar;//头像地址
|
||||
private String password;//密码
|
||||
private Char status;//帐号状态(0正常 1停用)
|
||||
private Char delFlag;//删除标志(0代表存在 2代表删除)
|
||||
private String loginIp;//最后登录IP
|
||||
private Date loginDate;//最后登录时间
|
||||
private String createBy;//创建者
|
||||
private Date createTime;//创建时间
|
||||
private String updateBy;//更新者
|
||||
private Date updateTime;
|
||||
private String remark;
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.fivegroup.enter.mapper;
|
||||
|
||||
import com.fivegroup.common.system.domain.SysUser;
|
||||
import com.fivegroup.enter.demo.Center;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface AaaMapper {
|
||||
|
||||
void updateNamePassword(SysUser sysUser);
|
||||
|
||||
List<SysUser> showSysUser(SysUser sysUser);
|
||||
|
||||
|
||||
void updateRole(Integer userId);
|
||||
|
||||
void updateUserNamePassword(SysUser sysUser);
|
||||
|
||||
void updateRoleId(Integer userId);
|
||||
|
||||
void addNumber(Center center);
|
||||
|
||||
SysUser findByEmail(@Param("email") String email);
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.fivegroup.enter.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.fivegroup.enter.demo.Check;
|
||||
import com.fivegroup.enter.demo.Keeper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface KepperMapper extends BaseMapper<Keeper> {
|
||||
void addKeeper(Keeper keeper);
|
||||
|
||||
List<Check> showCheck();
|
||||
|
||||
void updatecheckId2(@Param("keeperId") Integer keeperId);
|
||||
|
||||
void updatecheckId1(Integer keepId);
|
||||
|
||||
void updateKeeperAdmin(@Param("userId") Integer userId);
|
||||
|
||||
void selKeeper(String keeperEmail);
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.fivegroup.enter.service;
|
||||
|
||||
import com.fivegroup.common.system.domain.SysUser;
|
||||
import com.fivegroup.enter.demo.Center;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author LiuJiaXin
|
||||
* @version 2023/12/2 - 9:01
|
||||
*/
|
||||
public interface AaaService {
|
||||
void updateNamePassword(SysUser sysUser);
|
||||
|
||||
List<SysUser> showSysUser(SysUser sysUser);
|
||||
|
||||
void findByEmail(String email);
|
||||
|
||||
void updateRole(Integer userId);
|
||||
|
||||
void updateUserNamePassword(SysUser sysUser);
|
||||
|
||||
void updateRoleId(Integer userId);
|
||||
|
||||
void addNumber(Center center);
|
||||
}
|
|
@ -7,7 +7,7 @@ import com.fivegroup.enter.demo.Firm;
|
|||
import java.util.List;
|
||||
|
||||
public interface FirmService extends IService<Firm> {
|
||||
void addFirm(Firm firm);
|
||||
|
||||
|
||||
void addCar(Car car);
|
||||
|
||||
|
@ -15,7 +15,7 @@ public interface FirmService extends IService<Firm> {
|
|||
|
||||
void updateAuditId(Integer auditId);
|
||||
|
||||
void delFirm(Integer firmId);
|
||||
|
||||
|
||||
void updateFirm(Integer firmId);
|
||||
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package com.fivegroup.enter.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.fivegroup.enter.demo.Check;
|
||||
import com.fivegroup.enter.demo.Keeper;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface KeeperService extends IService<Keeper> {
|
||||
void addKeeper(Keeper keeper);
|
||||
|
||||
List<Check> showCheck();
|
||||
|
||||
void updatecheckId2(Integer keeperId);
|
||||
|
||||
void updatecheckId1(Integer keepId);
|
||||
|
||||
void findByemailgetCode(String keeperEmail);
|
||||
|
||||
void updateKeeperAdmin(Integer userId);
|
||||
|
||||
void findByKeeperEmail(String keeperEmail);
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
package com.fivegroup.enter.service.impl;
|
||||
|
||||
|
||||
import com.fivegroup.common.system.domain.SysUser;
|
||||
import com.fivegroup.enter.demo.Center;
|
||||
import com.fivegroup.enter.mapper.AaaMapper;
|
||||
import com.fivegroup.enter.service.AaaService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.mail.javamail.JavaMailSender;
|
||||
import org.springframework.mail.javamail.MimeMessageHelper;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* @author LiuJiaXin
|
||||
* @version 2023/12/2 - 9:01
|
||||
*/
|
||||
@Service
|
||||
public class AaaServiceImpl implements AaaService {
|
||||
@Autowired
|
||||
private AaaMapper aaaMapper;
|
||||
|
||||
@Override
|
||||
public void updateNamePassword(SysUser sysUser) {
|
||||
Random random = new Random();
|
||||
String str="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
String Password ="";
|
||||
StringBuffer sc = new StringBuffer();
|
||||
for (int z = 0; z < 8; z++) {
|
||||
int number = random.nextInt(62);
|
||||
sc.append(str.charAt(number));
|
||||
}
|
||||
|
||||
sysUser.setUserName(sc.toString());
|
||||
for (int a = 0; a < 4; a++) {
|
||||
Password += random.nextInt(10);
|
||||
}
|
||||
sysUser.setPassword(Password);
|
||||
aaaMapper.updateNamePassword(sysUser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysUser> showSysUser(SysUser sysUser) {
|
||||
return aaaMapper.showSysUser(sysUser);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private JavaMailSender javaMailSender;
|
||||
@Override
|
||||
public void findByEmail(String email) {
|
||||
SysUser sysUser=aaaMapper.findByEmail(email);
|
||||
|
||||
MimeMessage mimeMessage = javaMailSender.createMimeMessage();
|
||||
|
||||
try {
|
||||
MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true);
|
||||
helper.setSubject("账号和密码");
|
||||
helper.setText("这是您的账号"+sysUser.getUserName());
|
||||
helper.setText("这是您的密码"+sysUser.getPassword());
|
||||
helper.setTo(email);
|
||||
helper.setFrom("3056600483@qq.com");
|
||||
javaMailSender.send(mimeMessage);
|
||||
} catch (MessagingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateRole(Integer userId) {
|
||||
aaaMapper.updateRole(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUserNamePassword(SysUser sysUser) {
|
||||
BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
|
||||
String encode = bCryptPasswordEncoder.encode(sysUser.getPassword());
|
||||
sysUser.setPassword(encode);
|
||||
aaaMapper.updateUserNamePassword(sysUser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateRoleId(Integer userId) {
|
||||
aaaMapper.updateRoleId(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addNumber(Center center) {
|
||||
aaaMapper.addNumber(center);
|
||||
}
|
||||
|
||||
}
|
|
@ -8,6 +8,7 @@ import com.fivegroup.enter.service.FirmService;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -19,10 +20,6 @@ public class FirmServiceImpl extends ServiceImpl<FirmMapper, Firm> implements Fi
|
|||
@Autowired
|
||||
private FirmMapper firmMapper;
|
||||
|
||||
@Override
|
||||
public void addFirm(Firm firm) {
|
||||
firmMapper.insert(firm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCar(Car car) {
|
||||
|
@ -39,10 +36,6 @@ public class FirmServiceImpl extends ServiceImpl<FirmMapper, Firm> implements Fi
|
|||
firmMapper.updateAuditId(auditId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delFirm(Integer firmId) {
|
||||
firmMapper.delFirm(firmId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFirm(Integer firmId) {
|
||||
|
@ -71,4 +64,31 @@ public class FirmServiceImpl extends ServiceImpl<FirmMapper, Firm> implements Fi
|
|||
firmMapper.selCar(carVin);
|
||||
}
|
||||
|
||||
/**
|
||||
* 企业入驻
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean save(Firm entity) {
|
||||
boolean save = super.save(entity);
|
||||
if (!save) {
|
||||
throw new RuntimeException("企业添加失败!");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 企业注销
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean removeById(Serializable id) {
|
||||
boolean remove = super.removeById(id);
|
||||
if (!remove) {
|
||||
throw new RuntimeException("企业注销失败!");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,123 @@
|
|||
package com.fivegroup.enter.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fivegroup.common.system.domain.SysUser;
|
||||
import com.fivegroup.enter.demo.Check;
|
||||
import com.fivegroup.enter.demo.Keeper;
|
||||
import com.fivegroup.enter.mapper.KepperMapper;
|
||||
import com.fivegroup.enter.service.KeeperService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.mail.javamail.JavaMailSender;
|
||||
import org.springframework.mail.javamail.MimeMessageHelper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* @author LiuJiaXin
|
||||
* @version 2023/12/1 - 23:15
|
||||
*/
|
||||
@Service
|
||||
public class KeeperServiceImpl extends ServiceImpl<KepperMapper, Keeper> implements KeeperService {
|
||||
@Autowired
|
||||
private KepperMapper kepperMapper;
|
||||
|
||||
@Override
|
||||
public void addKeeper(Keeper keeper) {
|
||||
kepperMapper.addKeeper(keeper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Check> showCheck() {
|
||||
return kepperMapper.showCheck();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatecheckId2(Integer keeperId) {
|
||||
kepperMapper.updatecheckId2(keeperId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatecheckId1(Integer keepId) {
|
||||
kepperMapper.updatecheckId1(keepId);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private JavaMailSender javaMailSender;
|
||||
@Override
|
||||
public void findByemailgetCode(String keeperEmail) {
|
||||
Random random = new Random();
|
||||
String code="";
|
||||
String pwd="";
|
||||
for (int i = 0; i < 9; i++) {
|
||||
code += random.nextInt(10);
|
||||
}
|
||||
for (int a = 0; a < 6; a++) {
|
||||
pwd += random.nextInt(10);
|
||||
}
|
||||
|
||||
MimeMessage mimeMessage = javaMailSender.createMimeMessage();
|
||||
|
||||
try {
|
||||
MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true);
|
||||
helper.setSubject("生成的账户和密码");
|
||||
helper.setText("这里是账号"+code);
|
||||
helper.setText("这是密码"+pwd);
|
||||
helper.setTo(keeperEmail);
|
||||
helper.setFrom("3056600483@qq.com");
|
||||
javaMailSender.send(mimeMessage);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateKeeperAdmin(Integer userId) {
|
||||
SysUser sysUser = new SysUser();
|
||||
Random random = new Random();
|
||||
String str="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
String keeperPassword ="";
|
||||
StringBuffer sc = new StringBuffer();
|
||||
for (int z = 0; z < 8; z++) {
|
||||
int number = random.nextInt(62);
|
||||
sc.append(str.charAt(number));
|
||||
}
|
||||
|
||||
sysUser.setUserName(str.toString());
|
||||
for (int a = 0; a < 4; a++) {
|
||||
keeperPassword += random.nextInt(10);
|
||||
}
|
||||
sysUser.setPassword(keeperPassword);
|
||||
kepperMapper.updateKeeperAdmin(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findByKeeperEmail(String keeperEmail) {
|
||||
kepperMapper.selKeeper(keeperEmail);
|
||||
Keeper keeper = new Keeper();
|
||||
|
||||
String keeperAdmin = keeper.getKeeperAdmin();
|
||||
String keeperPassword = keeper.getKeeperPassword();
|
||||
MimeMessage mimeMessage = javaMailSender.createMimeMessage();
|
||||
try {
|
||||
MimeMessageHelper helper = new MimeMessageHelper(mimeMessage,true);
|
||||
helper.setSubject("随机生成的账号和密码");
|
||||
helper.setText("这是账号"+keeperAdmin);
|
||||
helper.setText("这是密码"+keeperPassword);
|
||||
helper.setTo(keeperEmail);
|
||||
helper.setFrom("3056600483@qq.com");
|
||||
javaMailSender.send(mimeMessage);
|
||||
} catch (MessagingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -41,6 +41,18 @@ spring:
|
|||
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
fdfs:
|
||||
so-timeout: 1500 # socket 连接时长
|
||||
connect-timeout: 600 # 连接 tracker 服务器超时时长
|
||||
# 这两个是你服务器的 IP 地址,注意 23000 端口也要打开,阿里云服务器记得配置安全组。tracker 要和 stroage 服务进行交流
|
||||
tracker-list: 121.36.202.181:22122
|
||||
web-server-url: 121.36.202.181:8888
|
||||
pool:
|
||||
jmx-enabled: false
|
||||
# 生成缩略图
|
||||
thumb-image:
|
||||
height: 500
|
||||
width: 500
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
<?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.fivegroup.enter.mapper.AaaMapper">
|
||||
<insert id="addNumber">
|
||||
INSERT INTO `car`.`t_center` (`center_id`, `user_id`, `role_id`) VALUES
|
||||
(
|
||||
null,
|
||||
#{userId},
|
||||
#{roleId}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateNamePassword">
|
||||
UPDATE `ry-cloud`.`sys_user` SET `user_name` =#{userName}, `password` = #{password} WHERE `user_id` = #{userId}
|
||||
</update>
|
||||
<update id="updateRole">
|
||||
UPDATE `car`.`t_center` SET `role_id` = 1 WHERE `user_id` = #{userId}
|
||||
</update>
|
||||
<update id="updateUserNamePassword">
|
||||
update `ry-cloud`.`sys_user` set user_name=#{userName},password=#{password} where user_id=#{userId}
|
||||
</update>
|
||||
<update id="updateRoleId">
|
||||
update `car`.`t_center` set role_id=2 where user_id = #{userId}
|
||||
</update>
|
||||
<select id="showSysUser" resultType="com.fivegroup.common.system.domain.SysUser">
|
||||
select *
|
||||
from `ry-cloud`.`sys_user`
|
||||
<where>
|
||||
<if test="nickName!=null and nickName!=''">
|
||||
and nick_name like concat('%',#{nickName},'%')
|
||||
</if>
|
||||
</where>ORDER BY user_id desc
|
||||
</select>
|
||||
<select id="findByEmail" resultType="com.fivegroup.common.system.domain.SysUser">
|
||||
select *
|
||||
from `ry-cloud`.`sys_user` where email=#{email}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
|
@ -4,24 +4,7 @@
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.fivegroup.enter.mapper.FirmMapper">
|
||||
|
||||
<insert id="addCar">
|
||||
INSERT INTO `car`.`t_car` (`car_id`, `car_code`, `car_vin`, `car_type_id`, `fence_id`, `car_status`, `battery_maker_id`, `motor_manufacturer_id`, `motor_id`, `battery_id`, `operating_area`, `audit_id`, `firm_id`) VALUES
|
||||
(
|
||||
NULL,
|
||||
#{carCode},
|
||||
#{carVin},
|
||||
#{carTypeId},
|
||||
#{fenceId},
|
||||
#{carStatus},
|
||||
#{batteryMakerId},
|
||||
#{motorManufacturerId},
|
||||
#{motorId},
|
||||
#{batteryId},
|
||||
#{operatingArea},
|
||||
1,
|
||||
#{firmId}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateAuditId">
|
||||
update t_car set audit_id=2 where audit_id=#{auditId}
|
||||
</update>
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
<?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.fivegroup.enter.mapper.KepperMapper">
|
||||
|
||||
<insert id="addKeeper">
|
||||
INSERT INTO `car`.`t_keeper` (`keeper_id`, `keeper_name`, `keeper_password`, `keeper_email`,`check_id`)
|
||||
VALUES (
|
||||
null,
|
||||
#{keeperName},
|
||||
#{keeperPassword},
|
||||
#{keeperEmail},
|
||||
0
|
||||
)
|
||||
|
||||
</insert>
|
||||
<update id="updatecheckId2">
|
||||
UPDATE `car`.`t_keeper` SET `check_id` = 2 WHERE `keeper_id` = #{keeperId}
|
||||
</update>
|
||||
<update id="updatecheckId1">
|
||||
UPDATE `car`.`t_keeper` SET `check_id` = 1 WHERE `keeper_id` = #{keeperId}
|
||||
</update>
|
||||
<update id="updateKeeperAdmin">
|
||||
UPDATE `ry-cloud`.`sys_user` SET `user_name` =#{userName}, `password` = #{password} WHERE `user_id` = #{userId}
|
||||
</update>
|
||||
<select id="showCheck" resultType="com.fivegroup.enter.demo.Check">
|
||||
select *
|
||||
from t_check
|
||||
</select>
|
||||
<select id="selKeeper">
|
||||
select *
|
||||
from t_keeper where keeper_email = #{keeperEmail}
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue