Compare commits

..

No commits in common. "master" and "jiayao" have entirely different histories.

48 changed files with 12 additions and 1363 deletions

View File

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

View File

@ -1,10 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="EntryPointsManager">
<list size="1">
<item index="0" class="java.lang.String" itemvalue="lombok.NoArgsConstructor" />
</list>
</component>
<component name="ExternalStorageConfigurationManager" enabled="true" /> <component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager"> <component name="MavenProjectsManager">
<option name="originalFiles"> <option name="originalFiles">

View File

@ -1,17 +0,0 @@
package com.bwie.auth;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
/**
* @author 86175
*/
@EnableFeignClients
@SpringBootApplication
public class AuthApplication {
public static void main(String[] args) {
SpringApplication.run(AuthApplication.class,args);
}
}

View File

@ -1,71 +0,0 @@
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;
/**
* @author 86175
*/
@RestController
@RequestMapping("/auth")
@Log4j2
public class AuthController {
@Autowired
private AuthService authService;
@Autowired
private HttpServletRequest request;
/**
*
*
* @param userPhone
* @return
*/
@PostMapping("/sendCode/{userPhone}")
public Result sendCode(@PathVariable String userPhone) {
log.info("功能描述:发送验证码,请求URI:{},请求方式:{},请求参数:{}", request.getServletPath(), request.getMethod(), userPhone);
Result result = authService.sendCode(userPhone);
log.info("功能描述:发送验证码,请求URI:{},请求方式:{},响应结果:{}", request.getServletPath(), request.getMethod(), JSON.toJSONString(result));
return result;
}
/**
* +
*
*
*/
@PostMapping("/users")
public Result<UserDto> users(@RequestBody UserVo userVo) {
log.info("功能描述:登录进入停车页面,请求URI:{},请求方式:{},请求参数:{}", request.getServletPath(), request.getMethod(), userVo);
Result result = authService.users(userVo);
log.info("功能描述:登录进入停车页面,请求URI:{},请求方式:{},响应结果:{}", request.getServletPath(), request.getMethod(), JSON.toJSONString(result));
return result;
}
/**
*
*/
@PostMapping("/register")
public Result register(@RequestBody UserVo userVo){
log.info("功能描述:注册,请求URI:{},请求方式:{},请求参数:{}",request.getServletPath(),request.getMethod(),userVo);
Result result= authService.register(userVo);
log.info("功能描述:注册,请求URI:{},请求方式:{},响应结果:{}",request.getServletPath(),request.getMethod(), JSON.toJSONString(result));
return result;
}
}

View File

@ -1,32 +0,0 @@
package com.bwie.auth.fegin;
import com.bwie.common.pojo.User;
import com.bwie.common.pojo.vo.UserVo;
import com.bwie.common.result.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
* @author 86175
*/
@FeignClient("bwie-user")
public interface UserFeignService {
/**
*
*/
@PostMapping("/user/sendCode/{userPhone}")
public Result<User> sendCode(@PathVariable String userPhone);
@PostMapping("/user/findUserName/{userName}")
public Result<User> findUserName(@PathVariable String userName);
/**
*
*/
@PostMapping("/user/register")
public Result register(@RequestBody UserVo userVo);
}

View File

@ -1,20 +0,0 @@
package com.bwie.auth.service;
import com.bwie.common.pojo.vo.UserVo;
import com.bwie.common.result.Result;
import org.springframework.web.multipart.MultipartFile;
public interface AuthService {
Result sendCode(String userPhone);
/**
* @param userVo
* @return
*/
Result users(UserVo userVo);
Result register(UserVo userVo);
}

View File

@ -1,98 +0,0 @@
package com.bwie.auth.service.impl;
import com.alibaba.fastjson.JSON;
import com.bwie.auth.fegin.UserFeignService;
import com.bwie.auth.service.AuthService;
import com.bwie.common.constants.JwtConstants;
import com.bwie.common.constants.TokenConstants;
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 com.bwie.common.utils.JwtUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.util.HashMap;
import java.util.Random;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
/**
* @author 86175
*
*/
@Service
public class AuthServiceImpl implements AuthService {
@Autowired
private UserFeignService userFeignService;
@Autowired
private StringRedisTemplate redisTemplate;
@Override
public Result sendCode(String userPhone) {
//feign调用查出sql数据
Result<User> userResult = userFeignService.sendCode(userPhone);
User user = userResult.getData();
if (user==null){
return Result.success("手机号不能为空");
}
String code="";
for (int i = 0; i < 4; i++) {
code+=new Random().nextInt(10);
}
redisTemplate.opsForValue().set(userPhone,code,15, TimeUnit.MINUTES);
return Result.success(code,"发送成功");
}
@Override
public Result users(UserVo userVo) {
//feign调用查出sql数据
Result<User> userName = userFeignService.sendCode(userVo.getUserPhone());
User user = userName.getData();
if (user==null){
return Result.error("该用户不存在,请先注册");
}
if (!userVo.getUserPhone().equals(user.getUserPhone())){
return Result.error("手机号不正确");
}
if (!redisTemplate.hasKey(userVo.getUserPhone())){
return Result.error("验证码已过期");
}
String code = redisTemplate.opsForValue().get(userVo.getUserPhone());
if (!code.equals(userVo.getCode())){
return Result.error("验证码失败");
}
HashMap<String, Object> map = new HashMap<>();
String userKey = UUID.randomUUID().toString();
map.put(JwtConstants.USER_KEY,userKey);
String token = JwtUtils.createToken(map);
redisTemplate.opsForValue().set(TokenConstants.LOGIN_TOKEN_KEY+userKey, JSON.toJSONString(user),30,TimeUnit.MINUTES);
UserDto userDto = new UserDto();
userDto.setToken(token);
userDto.setExpiredTime("token存储时间是30分钟");
if (user.getUserRole()==1){
return Result.success(userDto,"管理员登录");
}
return Result.success(userDto,"欢迎登录");
}
@Override
public Result register(UserVo userVo) {
userFeignService.register(userVo);
return Result.success("注册成功");
}
}

View File

@ -14,7 +14,7 @@ spring:
kafka: kafka:
producer: producer:
# Kafka服务器 # Kafka服务器
bootstrap-servers: 111.229.234.119:9092 bootstrap-servers: 110.42.214.8:9092
# 开启事务,必须在开启了事务的方法中发送,否则报错 # 开启事务,必须在开启了事务的方法中发送,否则报错
transaction-id-prefix: kafkaTx- transaction-id-prefix: kafkaTx-
# 发生错误后消息重发的次数开启事务必须设置大于0。 # 发生错误后消息重发的次数开启事务必须设置大于0。
@ -35,7 +35,7 @@ spring:
consumer: consumer:
# Kafka服务器 # Kafka服务器
bootstrap-servers: 111.229.234.119:9092 bootstrap-servers: 110.42.214.8:9092
group-id: firstGroup group-id: firstGroup
# 自动提交的时间间隔 在spring boot 2.X 版本中这里采用的是值的类型为Duration 需要符合特定的格式如1S,1M,2H,5D # 自动提交的时间间隔 在spring boot 2.X 版本中这里采用的是值的类型为Duration 需要符合特定的格式如1S,1M,2H,5D
#auto-commit-interval: 2s #auto-commit-interval: 2s
@ -90,10 +90,10 @@ spring:
nacos: nacos:
discovery: discovery:
# 服务注册地址 # 服务注册地址
server-addr: 111.229.234.119:8848 server-addr: 110.42.214.8:8848
config: config:
# 配置中心地址 # 配置中心地址
server-addr: 111.229.234.119:8848 server-addr: 110.42.214.8:8848
# 配置文件格式 # 配置文件格式
file-extension: yml file-extension: yml
# 共享配置 # 共享配置

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,18 +0,0 @@
package com.bwie.common.pojo.DTO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author 86175
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserDto {
private String token;
private String expiredTime;
}

View File

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

View File

@ -24,10 +24,9 @@ public class LogMake {
*/ */
private Integer makeId; private Integer makeId;
/* /*
*/ */
private String carNum; private Integer carId;
/* /*
(: 1, : 2, : 3) (: 1, : 2, : 3)
*/ */
@ -39,15 +38,7 @@ public class LogMake {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date makeTime; private Date makeTime;
/*
id
*/
private Integer parkingId;
/*
id
*/
private Integer userId;

View File

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

View File

@ -56,11 +56,7 @@ public class Stop {
*/ */
private Integer stopState; private Integer stopState;
/* /*
*/ */
private Integer stopPrice; private String stopPrice;
/*
*/
private Integer stopPay;
} }

View File

@ -1,4 +0,0 @@
package com.bwie.common.pojo.vo;
public class CarVo {
}

View File

@ -1,34 +0,0 @@
package com.bwie.common.pojo.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author 86175
*
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserVo {
/*
*/
private String userName;
/*
*/
private String userPhone;
/*
*/
private String userImg;
private String userSex;
private String code;
}

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,15 +0,0 @@
package com.bwie.gateway;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @author 86175
*/
@SpringBootApplication
public class GateWayApplication {
public static void main(String[] args) {
SpringApplication.run(GateWayApplication.class,args);
}
}

View File

@ -58,7 +58,6 @@ public class AuthFilter implements GlobalFilter, Ordered {
// 不放行 提示错误信息 // 不放行 提示错误信息
return GatewayUtils.errorResponse(exchange, "token不能为空", HttpStatus.UNAUTHORIZED); return GatewayUtils.errorResponse(exchange, "token不能为空", HttpStatus.UNAUTHORIZED);
} }
System.out.println("131");
try { try {
// token 合法性性 // token 合法性性
JwtUtils.parseToken(token); JwtUtils.parseToken(token);

View File

@ -18,10 +18,10 @@ spring:
nacos: nacos:
discovery: discovery:
# 服务注册地址 # 服务注册地址
server-addr: 111.229.234.119:8848 server-addr: 110.42.214.8:8848
config: config:
# 配置中心地址 # 配置中心地址
server-addr: 111.229.234.119:8848 server-addr: 110.42.214.8:8848
# 配置文件格式 # 配置文件格式
file-extension: yml file-extension: yml
# 共享配置 # 共享配置

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

@ -1,38 +0,0 @@
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store

View File

@ -1,60 +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>bwie-models</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>bwie-user</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>
</dependencies>
</project>

View File

@ -1,18 +0,0 @@
package com.bwie.user;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* user
* @author 86175
*/
@SpringBootApplication
public class UserApplication {
public static void main(String[] args) {
SpringApplication.run(UserApplication.class,args);
}
}

View File

@ -1,74 +0,0 @@
package com.bwie.user.controller;
import com.alibaba.fastjson.JSON;
import com.bwie.common.pojo.User;
import com.bwie.common.pojo.vo.UserVo;
import com.bwie.common.result.Result;
import com.bwie.user.service.UserService;
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;
/**
* @author 86175
*/
@RestController
@Log4j2
@RequestMapping("/user")
public class UserController {
@Autowired
private HttpServletRequest request;
@Autowired
private UserService userService;
/**
*
*/
@PostMapping("/sendCode/{userPhone}")
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));
return result;
}
@PostMapping("/findUserName/{userName}")
public Result<User> findUserName(@PathVariable String userName){
log.info("功能描述:查询后台是否存在这个用户名,请求URI:{},请求方式:{},请求参数:{}",request.getServletPath(),request.getMethod(),userName);
User user=userService.findUserName(userName);
Result result =Result.success(user);
log.info("功能描述:查询后台是否存在这个用户名,请求URI:{},请求方式:{},响应结果:{}",request.getServletPath(),request.getMethod(), JSON.toJSONString(result));
return result;
}
/**
*
*/
@PostMapping("/register")
public Result register(@RequestBody UserVo userVo){
log.info("功能描述:当用户不存在时,请注册,请求URI:{},请求方式:{},请求参数:{}",request.getServletPath(),request.getMethod(),userVo);
Result result=userService.register(userVo);
log.info("功能描述:当用户不存在时,请注册,请求URI:{},请求方式:{},响应结果:{}",request.getServletPath(),request.getMethod(), JSON.toJSONString(result));
return result;
}
/**
*
*/
@PostMapping("/upload")
public Result upload(@RequestBody MultipartFile file){
log.info("功能描述:上传图片,请求URI:{},请求方式:{},请求参数:{}",request.getServletPath(),request.getMethod(),file);
Result result=userService.upload(file);
log.info("功能描述:上传图片,请求URI:{},请求方式:{},响应结果:{}",request.getServletPath(),request.getMethod(), JSON.toJSONString(result));
return result;
}
}

View File

@ -1,26 +0,0 @@
package com.bwie.user.mapper;
import com.bwie.common.pojo.User;
import com.bwie.common.pojo.vo.UserVo;
import org.apache.ibatis.annotations.Mapper;
/**
* @author 86175
* user
*/
@Mapper
public interface UserMapper {
/**
* sql
* @param userPhone
* @return
*/
User sendCode(String userPhone);
User findUserName(String userName);
void register(UserVo userVo);
}

View File

@ -1,18 +0,0 @@
package com.bwie.user.service;
import com.bwie.common.pojo.User;
import com.bwie.common.pojo.vo.UserVo;
import com.bwie.common.result.Result;
import org.springframework.web.multipart.MultipartFile;
public interface UserService {
User sendCode(String userPhone);
User findUserName(String userName);
Result register(UserVo userVo);
Result upload(MultipartFile file);
}

View File

@ -1,60 +0,0 @@
package com.bwie.user.service.impl;
import com.bwie.common.pojo.User;
import com.bwie.common.pojo.vo.UserVo;
import com.bwie.common.result.Result;
import com.bwie.user.mapper.UserMapper;
import com.bwie.user.service.UserService;
import com.bwie.user.util.FastUtil;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
/**
* @author 86175
* user
*/
@Service
@Log4j2
public class UserServiceImpl implements UserService {
@Autowired
private UserMapper userMapper;
@Autowired
private FastUtil fastUtil;
@Override
public User sendCode(String userPhone) {
return userMapper.sendCode(userPhone);
}
@Override
public User findUserName(String userName) {
return userMapper.findUserName(userName);
}
@Override
public Result register(UserVo userVo) {
userMapper.register(userVo);
return Result.success("注册成功");
}
@Override
public Result upload(MultipartFile file) {
String url="";
try {
url=fastUtil.upload(file);
log.info("上传地址为:"+url);
if (url==null){
return Result.error("上传失败");
}
} catch (Exception e) {
throw new RuntimeException(e);
}
return Result.success("http://111.229.234.119:8848/"+url,"上传成功");
}
}

View File

@ -1,55 +0,0 @@
package com.bwie.user.util;
import org.springframework.stereotype.Component;
import com.github.tobato.fastdfs.domain.fdfs.StorePath;
import com.github.tobato.fastdfs.service.FastFileStorageClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
/**
* @BelongsProject: 0107day02
* @BelongsPackage: com.bw.config
* @Author: zhupengfei
* @CreateTime: 2023-02-01 08:52
*/
@Component
public class FastUtil {
private static final Logger log = LoggerFactory.getLogger(FastUtil.class);
@Resource
private FastFileStorageClient storageClient ;
/**
*
*/
public String upload(MultipartFile multipartFile) throws Exception{
String originalFilename = multipartFile.getOriginalFilename().
substring(multipartFile.getOriginalFilename().
lastIndexOf(".") + 1);
StorePath storePath = this.storageClient.uploadImageAndCrtThumbImage(
multipartFile.getInputStream(),
multipartFile.getSize(),originalFilename , null);
return storePath.getFullPath() ;
}
/**
*
*/
public String deleteFile(String fileUrl) {
if (StringUtils.isEmpty(fileUrl)) {
log.info("fileUrl == >>文件路径为空...");
return "文件路径不能为空";
}
try {
StorePath storePath = StorePath.parseFromUrl(fileUrl);
storageClient.deleteFile(storePath.getGroup(), storePath.getPath());
} catch (Exception e) {
log.error(e.getMessage());
}
return "删除成功";
}
}

View File

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

View File

@ -1,26 +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.user.mapper.UserMapper">
<insert id="register">
INSERT INTO `dome02`.`t_user`
(
`user_name`,
`user_sex`,
`user_phone`,
`user_img`,
`user_role`,
`meal_id`,
`coupon_id`
)
VALUES
(#{userName}, #{userSex}, #{userPhone}, #{userImg}, 2, null, null);
</insert>
<select id="sendCode" resultType="com.bwie.common.pojo.User">
select * from t_user where user_phone=#{userPhone}
</select>
<select id="findUserName" resultType="com.bwie.common.pojo.User">
select * from t_user where user_name=#{userName}
</select>
</mapper>

View File

@ -10,10 +10,6 @@
</parent> </parent>
<artifactId>bwie-models</artifactId> <artifactId>bwie-models</artifactId>
<packaging>pom</packaging>
<modules>
<module>bwie-user</module>
</modules>
<properties> <properties>
<maven.compiler.source>8</maven.compiler.source> <maven.compiler.source>8</maven.compiler.source>

View File

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