Compare commits

..

5 Commits

Author SHA1 Message Date
lijiayao e641083b46 2023-12-12 12:28:08 +08:00
lijiayao 0aca1ef4e1 提交登录模块 2023-12-11 18:37:56 +08:00
lijiayao 6f274516e4 提交登录模块 2023-12-11 09:15:01 +08:00
lijiayao 9ca3392e87 Merge remote-tracking branch 'origin/jiayao123' into jiayao123 2023-12-10 21:24:33 +08:00
lijiayao b51e26a0ff 提交登录模块 2023-12-10 21:24:02 +08:00
29 changed files with 31 additions and 645 deletions

View File

@ -9,7 +9,6 @@
<file url="file://$PROJECT_DIR$/bwie-common/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bwie-gateway/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bwie-gateway/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bwie-models/bwie-list/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bwie-models/bwie-user/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bwie-models/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bwie-models/src/main/resources" charset="UTF-8" />

View File

@ -3,13 +3,11 @@ package com.bwie.auth.controller;
import com.alibaba.fastjson.JSON;
import com.bwie.auth.service.AuthService;
import com.bwie.common.pojo.DTO.UserDto;
import com.bwie.common.pojo.User;
import com.bwie.common.pojo.vo.UserVo;
import com.bwie.common.result.Result;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;

View File

@ -41,7 +41,7 @@ public class AuthServiceImpl implements AuthService {
Result<User> userResult = userFeignService.sendCode(userPhone);
User user = userResult.getData();
if (user==null){
return Result.success("手机号不能为空");
return Result.success("手机号为空");
}
String code="";
for (int i = 0; i < 4; i++) {
@ -55,8 +55,8 @@ public class AuthServiceImpl implements AuthService {
public Result users(UserVo userVo) {
//feign调用查出sql数据
Result<User> userName = userFeignService.sendCode(userVo.getUserPhone());
User user = userName.getData();
Result<User> userResult = userFeignService.sendCode(userVo.getUserPhone());
User user = userResult.getData();
if (user==null){
return Result.error("该用户不存在,请先注册");
}

View File

@ -1,47 +0,0 @@
package com.bwie.common.pojo.DTO;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class DTOLogMake {
/*
*/
private Integer makeId;
/*
*/
private String carNum;
/*
(: 1, : 2, : 3)
*/
private Integer makeState;
/*
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date makeTime;
/*
id
*/
private Integer parkingId;
/*
id
*/
private Integer userId;
}

View File

@ -1,64 +0,0 @@
package com.bwie.common.pojo.DTO;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class DTOStop {
/*
*/
private Integer stopId;
/*
*/
private Integer carId;
/*
*/
private Integer userId;
/*
*/
private Integer parkingId;
/*
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date stopStart;
/*
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date stopEnd;
/*
*/
private Integer stopTime;
/*
(1- 2-)
*/
private Integer stopState;
/*
*/
private Integer stopPrice;
/*
*/
private Integer stopPay;
/*
*/
private Integer time;
}

View File

@ -1,7 +0,0 @@
package com.bwie.common.pojo;
public class Fang {
public void Fang(){
System.out.println("方十八是大帅比");
}
}

View File

@ -13,21 +13,25 @@ import java.util.Date;
* @author FangShiBa
* @date 2023/12/10
* @apiNote
*
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class LogMake {
/*
/**
*/
private Integer makeId;
/*
/**
*/
private Integer carId;
/**
*
*/
private String carNum;
/*
(: 1, : 2, : 3)
*/
@ -39,15 +43,7 @@ public class LogMake {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date makeTime;
/*
id
*/
private Integer parkingId;
/*
id
*/
private Integer userId;

View File

@ -28,9 +28,9 @@ public class Parking {
*/
private String parkingAddress;
/*
(: 1, : 2, : 3)
*/
private Integer parkingState;
private Integer makeId;

View File

@ -27,15 +27,12 @@ public class Stop {
*/
private Integer carId;
private String carNum;
/*
*/
private Integer userId;
/*
*/
private Integer parkingId;
/*
/**
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ -56,11 +53,7 @@ public class Stop {
*/
private Integer stopState;
/*
*/
private Integer stopPrice;
/*
*/
private Integer stopPay;
private String stopPrice;
}

View File

@ -1,33 +0,0 @@
package com.bwie.common.pojo.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class VOLogMake {
/*
*/
private String carNum;
/*
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date makeTime;
/*
id
*/
private Integer userId;
}

View File

@ -1,29 +0,0 @@
package com.bwie.common.pojo.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class VOStop {
/*
*/
private String carNum;
/*
*/
private Integer stopPrice;
/*
*/
private Integer stopPay;
public VOStop(String carNum, Integer stopPrice) {
this.carNum = carNum;
this.stopPrice = stopPrice;
}
}

View File

@ -1,67 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.bwie</groupId>
<artifactId>stopCar</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>bwie-list</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- 系统公共 依赖 -->
<dependency>
<groupId>com.bwie</groupId>
<artifactId>bwie-common</artifactId>
</dependency>
<!-- SpringBoot Web-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Druid -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.2.8</version>
</dependency>
<!-- Mysql Connector -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- Mybatis 依赖配置 -->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.2.2</version>
</dependency>
<!-- Pagehelper -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.4.1</version>
</dependency>
<!-- test -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.tobato</groupId>
<artifactId>fastdfs-client</artifactId>
<version>1.26.5</version>
</dependency>
</dependencies>
</project>

View File

@ -1,11 +0,0 @@
package com.bwie;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ListApplication {
public static void main(String[] args) {
SpringApplication.run(ListApplication.class);
}
}

View File

@ -1,36 +0,0 @@
package com.bwie.list.controller;
import com.alibaba.fastjson.JSONObject;
import com.bwie.common.pojo.vo.VOLogMake;
import com.bwie.common.result.Result;
import com.bwie.list.service.ParkingService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
@RestController
@Log4j2
public class ParkingController {
@Autowired
private ParkingService parkingService;
@Autowired
private HttpServletRequest request;
@PostMapping("/makeAppointment")
public Result makeAppointment(@RequestBody VOLogMake voLogMake){
log.info("功能名称:预约,请求URI:{},请求方式:{},请求参数:{}",
request.getRequestURI(),request.getMethod(),voLogMake);
Result result = parkingService.makeAppointment(voLogMake);
log.info("功能名称:预约,请求URI:{},请求方式:{},响应结果:{}",
request.getRequestURI(),request.getMethod(), JSONObject.toJSONString(result));
return result;
}
}

View File

@ -1,58 +0,0 @@
package com.bwie.list.controller;
import com.alibaba.fastjson.JSONObject;
import com.bwie.common.pojo.vo.VOStop;
import com.bwie.common.result.Result;
import com.bwie.list.service.StopService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
@RestController
@Log4j2
public class StopConroller {
@Autowired
private StopService stopService;
@Autowired
private HttpServletRequest request;
/**
*
* @param carNum
* @return
*/
@PostMapping("/findVOStop")
public Result findVOStop(@RequestParam String carNum){
log.info("功能名称:回显车牌号和应交停车费,请求URI:{},请求方式:{},请求参数:{}",
request.getRequestURI(),request.getMethod(),carNum);
Result result = stopService.findVOStop(carNum);
log.info("功能名称:回显车牌号和应交停车费,请求URI:{},请求方式:{},响应结果:{}",
request.getRequestURI(),request.getMethod(), JSONObject.toJSONString(result));
return result;
}
/**
*
* @param voStop
* @return
*/
@PostMapping("/takeStopPrice")
public Result takeStopPrice(@RequestBody VOStop voStop){
log.info("功能名称:支付,请求URI:{},请求方式:{},请求参数:{}",
request.getRequestURI(),request.getMethod(),voStop);
Result result = stopService.takeStopPrice(voStop);
log.info("功能名称:支付,请求URI:{},请求方式:{},响应结果:{}",
request.getRequestURI(),request.getMethod(), JSONObject.toJSONString(result));
return result;
}
}

View File

@ -1,10 +0,0 @@
package com.bwie.list.mapper;
import com.bwie.common.pojo.vo.VOLogMake;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ParkingMapper {
Integer makeAppointment(VOLogMake voLogMake);
}

View File

@ -1,19 +0,0 @@
package com.bwie.list.mapper;
import com.bwie.common.pojo.Car;
import com.bwie.common.pojo.DTO.DTOStop;
import com.bwie.common.pojo.Stop;
import com.bwie.common.pojo.vo.VOStop;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface StopMapper {
Car findCarId(VOStop voStop);
DTOStop findStartDate(@Param("carNum") String carNum);
Integer updateTime(Stop stop);
void addPay(@Param("userId") Integer userId, @Param("stopId") Integer stopId);
}

View File

@ -1,8 +0,0 @@
package com.bwie.list.service;
import com.bwie.common.pojo.vo.VOLogMake;
import com.bwie.common.result.Result;
public interface ParkingService {
Result makeAppointment(VOLogMake voLogMake);
}

View File

@ -1,11 +0,0 @@
package com.bwie.list.service;
import com.bwie.common.pojo.vo.VOStop;
import com.bwie.common.result.Result;
public interface StopService {
Result takeStopPrice(VOStop voStop);
Result findVOStop(String carNum);
}

View File

@ -1,46 +0,0 @@
package com.bwie.list.service.impl;
import com.alibaba.fastjson.JSON;
import com.bwie.common.constants.TokenConstants;
import com.bwie.common.pojo.User;
import com.bwie.common.pojo.vo.VOLogMake;
import com.bwie.common.result.Result;
import com.bwie.common.utils.JwtUtils;
import com.bwie.list.mapper.ParkingMapper;
import com.bwie.list.service.ParkingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
@Service
public class ParkingServiceImpl implements ParkingService {
@Autowired
private ParkingMapper parkingMapper;
@Autowired
private HttpServletRequest request;
@Autowired
private RedisTemplate<String,String> redisTemplate;
@Override
public Result makeAppointment(VOLogMake voLogMake) {
//1.获取用户信息
String token = request.getHeader("token");
String userKey = JwtUtils.getUserKey(token);
String s = redisTemplate.opsForValue().get(TokenConstants.LOGIN_TOKEN_KEY + userKey);
User user = JSON.parseObject(s, User.class);
if (user != null) {
voLogMake.setUserId(user.getUserId());
}
//2.添加预约信息
System.out.println("开始添加");
Integer i = parkingMapper.makeAppointment(voLogMake);
if (i>0){
return Result.success(voLogMake,"预约成功");
}
return Result.error("预约异常");
}
}

View File

@ -1,55 +0,0 @@
package com.bwie.list.service.impl;
import com.bwie.common.pojo.Car;
import com.bwie.common.pojo.DTO.DTOStop;
import com.bwie.common.pojo.Stop;
import com.bwie.common.pojo.vo.VOStop;
import com.bwie.common.result.Result;
import com.bwie.list.mapper.StopMapper;
import com.bwie.list.service.StopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class StopServiceImpl implements StopService {
@Autowired
private StopMapper stopMapper;
@Override
public Result takeStopPrice(VOStop voStop) {
//1.查找车牌号获取用户信息
Car car = stopMapper.findCarId(voStop);
System.out.println("hahahha");
//2.通过车牌号获取停车信息(得到停车时长)
DTOStop dtoStop = stopMapper.findStartDate(voStop.getCarNum());
//3.一个小时3元
if (dtoStop!=null){
Stop stop = new Stop();
stop.setStopId(dtoStop.getStopId());
stop.setStopTime(dtoStop.getTime());
stop.setStopPay(voStop.getStopPay());
stop.setStopPrice(voStop.getStopPrice());
Integer i = stopMapper.updateTime(stop);
if (i>0 && stop.getStopPrice().equals(stop.getStopPay())){
//添加日志
stopMapper.addPay(car.getUserId(),dtoStop.getStopId());
}
}
return Result.success("支付成功");
}
@Override
public Result findVOStop(String carNum) {
DTOStop dtoStop = stopMapper.findStartDate(carNum);
if (dtoStop!=null){
if (dtoStop.getTime()<1){
dtoStop.setStopPrice(3);
}else {
dtoStop.setStopPrice(dtoStop.getTime()*3);
}
return Result.success(dtoStop,"回显成功");
}
return Result.error("失败");
}
}

View File

@ -1,29 +0,0 @@
# Tomcat
server:
port: 9003
# Spring
spring:
main:
allow-circular-references: true
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
application:
# 应用名称
name: bwie-list
profiles:
# 环境配置
active: dev
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 82.157.236.130:8848
config:
# 配置中心地址
server-addr: 82.157.236.130:8848
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}

View File

@ -1,9 +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.bwie.list.mapper.ParkingMapper">
<insert id="makeAppointment">
insert into `stop_car`.`log_make` (`car_num`,`make_time`,`user_id`)
values (#{carNum},#{makeTime},#{userId})
</insert>
</mapper>

View File

@ -1,37 +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.bwie.list.mapper.StopMapper">
<insert id="addPay">
insert into `stop_car`.`log_pay` (`user_id`,`stop_id`,`pay_date`) values (#{userId},#{stopId},NOW())
</insert>
<update id="updateTime">
UPDATE `stop_car`.`t_stop` SET`stop_end` = now(), `stop_time` = #{stopTime}, `stop_state` = 2, `stop_price` = #{stopPrice}, `stop_pay` = #{stopPay} WHERE `stop_id` =#{stopId}
</update>
<select id="findCarId" resultType="com.bwie.common.pojo.Car">
select c.car_id,c.car_name,c.car_num,c.car_card,c.user_id,u.user_name,u.user_sex
FROM t_car c
LEFT JOIN t_user u on c.user_id = u.user_id
where c.car_num=#{carNum}
</select>
<select id="findStartDate" resultType="com.bwie.common.pojo.DTO.DTOStop">
select s.stop_id,s.parking_id,p.parking_name,p.parking_address,s.stop_start,stop_end,stop_time,
s.stop_state,s.stop_price,s.car_id,c.car_name,c.car_num,c.car_card,s.user_id,u.user_name,
u.user_phone,TIMESTAMPDIFF(HOUR,stop_start,NOW()) `time`
FROM t_stop s
LEFT JOIN t_car c on s.car_id = c.car_id
LEFT JOIN t_user u on s.user_id=u.user_id
LEFT JOIN t_parking p on s.parking_id = p.parking_id
where c.car_num=#{carNum}
</select>
<!--
select s.stop_id,s.parking_id,s.stop_start,stop_end,stop_time,s.stop_state,
s.stop_price,s.car_id,c.car_name,c.car_num,c.car_card,s.user_id,u.user_name,u.user_phone
FROM t_stop s
LEFT JOIN t_car c on s.car_id = c.car_id
LEFT JOIN t_user u on s.user_id=u.user_id
-->
</mapper>

View File

@ -1,35 +0,0 @@
package com.bwie.stopCar.controller;
import com.bwie.common.result.Result;
import com.bwie.stopCar.service.StopCarService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
/**
* @author FangShiBa
* @date 2023/12/12
* @apiNote
*/
@Log4j2
@RestController
@RequestMapping("/stopCar")
public class StopCarController {
@Autowired
private HttpServletRequest request;
@Autowired
private StopCarService service;
//扫码停车(扫码后跳转等车界面,输入车牌)点击确认后修改状态并记录时间判断是否为固定车辆(数据库登记)
//如果是,信息入库而后开闸,不是,添加信息,而后开闸
@PostMapping("/stopCar")
public Result stopCar(@RequestBody VOCar )
}

View File

@ -31,7 +31,6 @@ public class UserController {
public Result<User> sendCode(@PathVariable String userPhone){
log.info("功能描述:查询后台是否存在这个手机号,请求URI:{},请求方式:{},请求参数:{}",request.getServletPath(),request.getMethod(),userPhone);
User user=userService.sendCode(userPhone);
Result result =Result.success(user);
log.info("功能描述:查询后台是否存在这个手机号,请求URI:{},请求方式:{},响应结果:{}",request.getServletPath(),request.getMethod(), JSON.toJSONString(result));
@ -58,6 +57,7 @@ public class UserController {
log.info("功能描述:当用户不存在时,请注册,请求URI:{},请求方式:{},请求参数:{}",request.getServletPath(),request.getMethod(),userVo);
Result result=userService.register(userVo);
System.out.println(userVo);
log.info("功能描述:当用户不存在时,请注册,请求URI:{},请求方式:{},响应结果:{}",request.getServletPath(),request.getMethod(), JSON.toJSONString(result));
return result;
}

View File

@ -55,6 +55,6 @@ public class UserServiceImpl implements UserService {
throw new RuntimeException(e);
}
return Result.success("http://111.229.234.119:8848/"+url,"上传成功");
return Result.success("http://111.229.234.119:8888/"+url,"上传成功");
}
}

View File

@ -28,3 +28,15 @@ spring:
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
fdfs:
so-timeout: 1500 # socket 连接时长
connect-timeout: 600 # 连接 tracker 服务器超时时长
# 这两个是你服务器的 IP 地址,注意 23000 端口也要打开阿里云服务器记得配置安全组。tracker 要和 stroage 服务进行交流
tracker-list: 111.229.234.119:22122
web-server-url: 111.229.234.119:8888
pool:
jmx-enabled: false
# 生成缩略图
thumb-image:
height: 500
width: 500

View File

@ -14,7 +14,6 @@
<module>bwie-gateway</module>
<module>bwie-models</module>
<module>bwie-mq</module>
<module>bwie-models/bwie-list</module>
</modules>
<properties>