feat:修复后段

This commit is contained in:
Shu Guang 2025-04-08 23:40:57 +08:00
parent c66a64e2ca
commit a232ee0af7
116 changed files with 4170 additions and 134 deletions

1
backend/.idea/vcs.xml generated
View File

@ -2,5 +2,6 @@
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../../.." vcs="Git" />
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

View File

@ -0,0 +1,15 @@
package com.luozhihui;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@MapperScan("com.luozhihui.project.mapper")
public class CarManagerApplication {
public static void main(String[] args) {
SpringApplication.run(CarManagerApplication.class, args);
}
}

View File

@ -1,4 +1,4 @@
package com.liuyan.project.common;
package com.luozhihui.project.common;
//定义响应体
public class ApiResponse {
private Object data;

View File

@ -1,4 +1,4 @@
package com.liuyan.project.common;
package com.luozhihui.project.common;
//定义登录响应体
public class LoginResponse {
private Object data;

View File

@ -1,4 +1,4 @@
package com.liuyan.project.common;
package com.luozhihui.project.common;
//定义短信宝
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

View File

@ -1,4 +1,4 @@
package com.liuyan.project.common;
package com.luozhihui.project.common;
//定义响应体
public class totalResponse {
private Object data;

View File

@ -1,5 +1,5 @@
package com.liuyan.project.config;//package com.example.demo.config;
import com.liuyan.project.util.JwtUtil;
package com.luozhihui.project.config;//package com.example.demo.config;
import com.luozhihui.project.util.JwtUtil;
import org.springframework.web.servlet.HandlerInterceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

View File

@ -1,4 +1,4 @@
package com.liuyan.project.config;
package com.luozhihui.project.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.*;

View File

@ -1,8 +1,8 @@
package com.liuyan.project.controller;
import com.liuyan.project.common.LoginResponse;
import com.liuyan.project.entity.Admin;
import com.liuyan.project.mapper.AdminLoginMapper;
import com.liuyan.project.util.JwtUtil;
package com.luozhihui.project.controller;
import com.luozhihui.project.common.LoginResponse;
import com.luozhihui.project.entity.Admin;
import com.luozhihui.project.mapper.AdminLoginMapper;
import com.luozhihui.project.util.JwtUtil;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;

View File

@ -1,8 +1,8 @@
package com.liuyan.project.controller;
import com.liuyan.project.common.ApiResponse;
import com.liuyan.project.common.totalResponse;
import com.liuyan.project.entity.Brand;
import com.liuyan.project.mapper.BrandMapper;
package com.luozhihui.project.controller;
import com.luozhihui.project.common.ApiResponse;
import com.luozhihui.project.common.totalResponse;
import com.luozhihui.project.entity.Brand;
import com.luozhihui.project.mapper.BrandMapper;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Arrays;

View File

@ -1,8 +1,8 @@
package com.liuyan.project.controller;
package com.luozhihui.project.controller;
import com.liuyan.project.common.ApiResponse;
import com.liuyan.project.entity.Order;
import com.liuyan.project.mapper.CarRentMapper;
import com.luozhihui.project.common.ApiResponse;
import com.luozhihui.project.entity.Order;
import com.luozhihui.project.mapper.CarRentMapper;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;

View File

@ -1,7 +1,7 @@
package com.liuyan.project.controller;
import com.liuyan.project.common.ApiResponse;
import com.liuyan.project.entity.Car;
import com.liuyan.project.mapper.CarShowMapper;
package com.luozhihui.project.controller;
import com.luozhihui.project.common.ApiResponse;
import com.luozhihui.project.entity.Car;
import com.luozhihui.project.mapper.CarShowMapper;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Arrays;

View File

@ -1,6 +1,6 @@
package com.liuyan.project.controller;
package com.luozhihui.project.controller;
import com.liuyan.project.common.ApiResponse;
import com.luozhihui.project.common.ApiResponse;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;

View File

@ -1,9 +1,9 @@
package com.liuyan.project.controller;
package com.luozhihui.project.controller;
import com.liuyan.project.common.ApiResponse;
import com.liuyan.project.entity.Comment;
import com.liuyan.project.entity.User;
import com.liuyan.project.mapper.CommentMapper;
import com.luozhihui.project.common.ApiResponse;
import com.luozhihui.project.entity.Comment;
import com.luozhihui.project.entity.User;
import com.luozhihui.project.mapper.CommentMapper;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;

View File

@ -1,4 +1,4 @@
package com.liuyan.project.controller;
package com.luozhihui.project.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Controller;

View File

@ -0,0 +1,5 @@
package com.luozhihui.project.controller;
public class OrderMoneyController {
}

View File

@ -1,8 +1,8 @@
package com.liuyan.project.controller;
import com.liuyan.project.common.ApiResponse;
import com.liuyan.project.common.totalResponse;
import com.liuyan.project.entity.Order;
import com.liuyan.project.mapper.OrderShowMapper;
package com.luozhihui.project.controller;
import com.luozhihui.project.common.ApiResponse;
import com.luozhihui.project.common.totalResponse;
import com.luozhihui.project.entity.Order;
import com.luozhihui.project.mapper.OrderShowMapper;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.time.LocalDateTime;

View File

@ -1,7 +1,7 @@
package com.liuyan.project.controller;
import com.liuyan.project.common.ApiResponse;
import com.liuyan.project.entity.Pact;
import com.liuyan.project.mapper.PactShowMapper;
package com.luozhihui.project.controller;
import com.luozhihui.project.common.ApiResponse;
import com.luozhihui.project.entity.Pact;
import com.luozhihui.project.mapper.PactShowMapper;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;

View File

@ -1,8 +1,8 @@
package com.liuyan.project.controller;
package com.luozhihui.project.controller;
import com.liuyan.project.common.ApiResponse;
import com.liuyan.project.entity.Parking;
import com.liuyan.project.mapper.ParkingMapper;
import com.luozhihui.project.common.ApiResponse;
import com.luozhihui.project.entity.Parking;
import com.luozhihui.project.mapper.ParkingMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.*;

View File

@ -1,7 +1,7 @@
package com.liuyan.project.controller;
import com.liuyan.project.common.ApiResponse; // 导入 ApiResponse
import com.liuyan.project.common.SmsBaoConfig;
import com.liuyan.project.entity.Phone;
package com.luozhihui.project.controller;
import com.luozhihui.project.common.ApiResponse; // 导入 ApiResponse
import com.luozhihui.project.common.SmsBaoConfig;
import com.luozhihui.project.entity.Phone;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.liuyan.project.mapper.PhoneMapper;
import com.luozhihui.project.mapper.PhoneMapper;
import javax.annotation.Resource;
import java.io.BufferedReader;
import java.io.InputStream;

View File

@ -1,7 +1,7 @@
package com.liuyan.project.controller;
import com.liuyan.project.common.ApiResponse;
import com.liuyan.project.entity.Repair;
import com.liuyan.project.mapper.RepairShowMapper;
package com.luozhihui.project.controller;
import com.luozhihui.project.common.ApiResponse;
import com.luozhihui.project.entity.Repair;
import com.luozhihui.project.mapper.RepairShowMapper;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Arrays;

View File

@ -1,7 +1,7 @@
package com.liuyan.project.controller;
import com.liuyan.project.common.ApiResponse;
import com.liuyan.project.entity.User;
import com.liuyan.project.mapper.UserInfoMapper;
package com.luozhihui.project.controller;
import com.luozhihui.project.common.ApiResponse;
import com.luozhihui.project.entity.User;
import com.luozhihui.project.mapper.UserInfoMapper;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;

View File

@ -1,8 +1,8 @@
package com.liuyan.project.controller;
import com.liuyan.project.common.LoginResponse;
import com.liuyan.project.entity.User;
import com.liuyan.project.mapper.UserLoginMapper;
import com.liuyan.project.util.JwtUtil;
package com.luozhihui.project.controller;
import com.luozhihui.project.common.LoginResponse;
import com.luozhihui.project.entity.User;
import com.luozhihui.project.mapper.UserLoginMapper;
import com.luozhihui.project.util.JwtUtil;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;

View File

@ -1,9 +1,9 @@
package com.liuyan.project.controller;
package com.luozhihui.project.controller;
import com.liuyan.project.common.ApiResponse;
import com.liuyan.project.entity.User;
import com.liuyan.project.mapper.UserRegMapper;
import com.liuyan.project.mapper.PhoneMapper;
import com.luozhihui.project.common.ApiResponse;
import com.luozhihui.project.entity.User;
import com.luozhihui.project.mapper.UserRegMapper;
import com.luozhihui.project.mapper.PhoneMapper;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;

View File

@ -1,7 +1,7 @@
package com.liuyan.project.controller;
import com.liuyan.project.common.ApiResponse;
import com.liuyan.project.entity.User;
import com.liuyan.project.mapper.UserShowMapper;
package com.luozhihui.project.controller;
import com.luozhihui.project.common.ApiResponse;
import com.luozhihui.project.entity.User;
import com.luozhihui.project.mapper.UserShowMapper;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Arrays;

View File

@ -1,4 +1,4 @@
package com.liuyan.project.entity;
package com.luozhihui.project.entity;
public class Admin {
private Integer AdminId;

View File

@ -1,4 +1,4 @@
package com.liuyan.project.entity;
package com.luozhihui.project.entity;
public class Area {
private String area_id;

View File

@ -1,4 +1,4 @@
package com.liuyan.project.entity;
package com.luozhihui.project.entity;
public class Brand {
private String id;

View File

@ -1,4 +1,4 @@
package com.liuyan.project.entity;
package com.luozhihui.project.entity;
public class Car {
private Integer CarId;

View File

@ -1,4 +1,4 @@
package com.liuyan.project.entity;
package com.luozhihui.project.entity;
public class City {
private String city_id;

View File

@ -1,4 +1,4 @@
package com.liuyan.project.entity;
package com.luozhihui.project.entity;
public class Comment {
private int CommentId;

View File

@ -1,4 +1,4 @@
package com.liuyan.project.entity;
package com.luozhihui.project.entity;
import java.time.LocalDateTime;

View File

@ -1,4 +1,4 @@
package com.liuyan.project.entity;
package com.luozhihui.project.entity;
import java.util.Date;

View File

@ -1,4 +1,4 @@
package com.liuyan.project.entity;
package com.luozhihui.project.entity;
public class Parking {
private Integer id;

View File

@ -1,4 +1,4 @@
package com.liuyan.project.entity;
package com.luozhihui.project.entity;
public class Phone {
private String phone;

View File

@ -1,4 +1,4 @@
package com.liuyan.project.entity;
package com.luozhihui.project.entity;
public class Province {
private String province_id;

View File

@ -1,4 +1,4 @@
package com.liuyan.project.entity;
package com.luozhihui.project.entity;
public class Repair {
private Integer RepairId;

View File

@ -1,4 +1,4 @@
package com.liuyan.project.entity;
package com.luozhihui.project.entity;
public class User {
private Integer UserId;

View File

@ -1,7 +1,7 @@
package com.liuyan.project.mapper;
package com.luozhihui.project.mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import com.liuyan.project.entity.Admin;
import com.luozhihui.project.entity.Admin;
import java.util.List;

View File

@ -1,5 +1,5 @@
package com.liuyan.project.mapper;
import com.liuyan.project.entity.Brand;
package com.luozhihui.project.mapper;
import com.luozhihui.project.entity.Brand;
import org.apache.ibatis.annotations.*;
import org.springframework.transaction.annotation.Transactional;

View File

@ -1,9 +1,9 @@
package com.liuyan.project.mapper;
package com.luozhihui.project.mapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import com.liuyan.project.entity.Order;
import com.luozhihui.project.entity.Order;
import org.springframework.transaction.annotation.Transactional;
public interface CarRentMapper {

View File

@ -1,5 +1,5 @@
package com.liuyan.project.mapper;
import com.liuyan.project.entity.Car;
package com.luozhihui.project.mapper;
import com.luozhihui.project.entity.Car;
import org.apache.ibatis.annotations.*;
import org.springframework.transaction.annotation.Transactional;

View File

@ -1,6 +1,6 @@
package com.liuyan.project.mapper;
package com.luozhihui.project.mapper;
import com.liuyan.project.entity.Comment;
import com.luozhihui.project.entity.Comment;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.transaction.annotation.Transactional;

View File

@ -1,5 +1,5 @@
package com.liuyan.project.mapper;
import com.liuyan.project.entity.Order;
package com.luozhihui.project.mapper;
import com.luozhihui.project.entity.Order;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

View File

@ -1,5 +1,5 @@
package com.liuyan.project.mapper;
import com.liuyan.project.entity.Pact;
package com.luozhihui.project.mapper;
import com.luozhihui.project.entity.Pact;
import org.apache.ibatis.annotations.Select;
import java.util.List;

View File

@ -1,6 +1,6 @@
package com.liuyan.project.mapper;
import com.liuyan.project.entity.Parking;
import com.liuyan.project.entity.Brand;
package com.luozhihui.project.mapper;
import com.luozhihui.project.entity.Parking;
import com.luozhihui.project.entity.Brand;
import org.apache.ibatis.annotations.*;
import org.springframework.transaction.annotation.Transactional;

View File

@ -1,7 +1,7 @@
package com.liuyan.project.mapper;
package com.luozhihui.project.mapper;
//引入sql insert方法
import com.liuyan.project.entity.Phone;
import com.luozhihui.project.entity.Phone;
import org.apache.ibatis.annotations.*;
import org.springframework.transaction.annotation.Transactional;

View File

@ -1,5 +1,5 @@
package com.liuyan.project.mapper;
import com.liuyan.project.entity.Repair;
package com.luozhihui.project.mapper;
import com.luozhihui.project.entity.Repair;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

View File

@ -1,5 +1,5 @@
package com.liuyan.project.mapper;
import com.liuyan.project.entity.User;
package com.luozhihui.project.mapper;
import com.luozhihui.project.entity.User;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

View File

@ -1,8 +1,8 @@
package com.liuyan.project.mapper;
package com.luozhihui.project.mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import com.liuyan.project.entity.User;
import com.luozhihui.project.entity.User;
import java.util.List;

View File

@ -1,6 +1,6 @@
package com.liuyan.project.mapper;
package com.luozhihui.project.mapper;
//引入sql insert方法
import com.liuyan.project.entity.User;
import com.luozhihui.project.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

View File

@ -1,5 +1,5 @@
package com.liuyan.project.mapper;
import com.liuyan.project.entity.User;
package com.luozhihui.project.mapper;
import com.luozhihui.project.entity.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

View File

@ -1,4 +1,4 @@
package com.liuyan.project.util;
package com.luozhihui.project.util;
import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;

View File

@ -1,5 +0,0 @@
package com.liuyan.project.controller;
public class OrderMoneyController {
}

View File

@ -0,0 +1,15 @@
package com.luozhihui;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@MapperScan("com.luozhihui.project.mapper")
public class CarManagerApplication {
public static void main(String[] args) {
SpringApplication.run(CarManagerApplication.class, args);
}
}

View File

@ -0,0 +1,26 @@
package com.luozhihui.project.common;
//定义响应体
public class ApiResponse {
private Object data;
private int status;
private String message;
public ApiResponse(Object data, int status, String message) {
this.data = data;
this.status = status;
this.message = message;
}
public Object getData() {
return data;
}
public int getStatus() {
return status;
}
public String getMessage() {
return message;
}
}

View File

@ -0,0 +1,30 @@
package com.luozhihui.project.common;
//定义登录响应体
public class LoginResponse {
private Object data;
private Object token;
private int status;
private String message;
public LoginResponse(Object token,Object data, int status, String message) {
this.token = token;
this.data=data;
this.status = status;
this.message = message;
}
public Object getData() {
return data;
}
public Object getToken() {
return token;
}
public int getStatus() {
return status;
}
public String getMessage() {
return message;
}
}

View File

@ -0,0 +1,27 @@
package com.luozhihui.project.common;
//定义短信宝
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@Configuration
@ConfigurationProperties(prefix = "smsbao")
public class SmsBaoConfig {
private String username;
private String password;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}

View File

@ -0,0 +1,30 @@
package com.luozhihui.project.common;
//定义响应体
public class totalResponse {
private Object data;
private int status;
private String message;
private int total;
public totalResponse(Object data, int status, String message, Integer total) {
this.data = data;
this.status = status;
this.message = message;
this.total=total;
}
public Object getData() {
return data;
}
public int getStatus() {
return status;
}
public String getMessage() {
return message;
}
public int getTotal() {
return total;
}
}

View File

@ -0,0 +1,44 @@
package com.luozhihui.project.config;//package com.example.demo.config;
import com.luozhihui.project.util.JwtUtil;
import org.springframework.web.servlet.HandlerInterceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
//jwt
public class UserLoginInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
// 允许OPTIONS请求直接通过不做任何处理
if ("OPTIONS".equalsIgnoreCase(request.getMethod())) {
response.setStatus(HttpServletResponse.SC_OK);
return true;
}
// 以下是原有的token处理逻辑
String token = request.getHeader("Authorization");
if (token == null || token.isEmpty()) {
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
response.getWriter().write("Token is missing");
return false;
}
try {
String sub = JwtUtil.validateToken(token);
if (sub == null || sub.isEmpty()) {
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
response.getWriter().write("Token is invalid");
return false;
}
if (JwtUtil.isNeedUpdate(token)) {
String newToken = JwtUtil.createToken(sub);
response.setHeader("Authorization", newToken);
}
} catch (Exception e) {
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
response.getWriter().write("Token verification failed: " + e.getMessage());
return false;
}
return true;
}
}

View File

@ -0,0 +1,31 @@
package com.luozhihui.project.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.*;
/**
*
* 注册自定义拦截器
*/
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
@Override
public void addInterceptors(InterceptorRegistry registry) {
// 注册 registration 拦截器
InterceptorRegistration registration = registry.addInterceptor(new UserLoginInterceptor());
// 拦截所有的路径
registration.addPathPatterns("/**");
// 添加不拦截路径 /api/user/login 是登录的请求, /api/user/register 注册的请求
registration.excludePathPatterns(
//后台管理员登录
"/api/admin_login",
//用户登录
"/api/login",
//用户注册
"/api/user_register",
// //发送验证码
"/api/sendCode"
);
}
}

View File

@ -0,0 +1,47 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.controller;
import com.luozhihui.project.common.LoginResponse;
import com.luozhihui.project.entity.Admin;
import com.luozhihui.project.mapper.AdminLoginMapper;
import com.luozhihui.project.util.JwtUtil;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping({"/api"})
@CrossOrigin
public class AdminLoginController {
@Resource
AdminLoginMapper adminLoginMapper;
public AdminLoginController() {
}
@PostMapping({"/admin_login"})
public LoginResponse login(@RequestParam("AdminUser") String AdminUser, @RequestParam("AdminPassWord") String AdminPassWord) {
List<Admin> userList = this.adminLoginMapper.findByPhone(AdminUser);
System.out.println(userList);
if (userList.isEmpty()) {
return new LoginResponse((Object)null, (Object)null, 500, "用户不存在");
} else {
Admin admin = (Admin)userList.get(0);
if (admin.getAdminPassWord().equals(AdminPassWord)) {
JwtUtil jwtUtil = new JwtUtil();
String token = JwtUtil.createToken(((Admin)userList.get(0)).getAdminUser());
return new LoginResponse(token, (Object)null, 200, "登录成功");
} else {
return new LoginResponse((Object)null, (Object)null, 500, "密码错误");
}
}
}
}

View File

@ -0,0 +1,54 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.controller;
import com.luozhihui.project.common.ApiResponse;
import com.luozhihui.project.entity.Order;
import com.luozhihui.project.mapper.CarRentMapper;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping({"/api"})
@CrossOrigin
public class CarRentController {
@Resource
CarRentMapper carRentMapper;
public CarRentController() {
}
@PostMapping({"/carRent"})
public ApiResponse carRent(Order order) {
try {
this.carRentMapper.addorder(order);
System.out.println(order.getCarId());
this.carRentMapper.updateCarStatus(Integer.valueOf(order.getCarId()));
return new ApiResponse((Object)null, 200, "车位租借成功");
} catch (Exception var3) {
Exception e = var3;
e.printStackTrace();
return new ApiResponse((Object)null, 500, "服务器内部错误");
}
}
@PostMapping({"/returnCar"})
public ApiResponse returnCar(Order order) {
try {
this.carRentMapper.carRented(order);
this.carRentMapper.finishOrder(order.getOrderId());
this.carRentMapper.endCarStatus(order.getCarId(), order.getParking_id());
return new ApiResponse((Object)null, 200, "还车成功");
} catch (Exception var3) {
Exception e = var3;
e.printStackTrace();
return new ApiResponse((Object)null, 500, "服务器内部错误");
}
}
}

View File

@ -0,0 +1,140 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.controller;
import com.luozhihui.project.common.ApiResponse;
import com.luozhihui.project.entity.Car;
import com.luozhihui.project.mapper.CarShowMapper;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping({"/api"})
@CrossOrigin
public class CarShowController {
@Resource
CarShowMapper carShowMapper;
public CarShowController() {
}
@PostMapping({"/AllCar"})
public ApiResponse AllCar() {
try {
List<Car> car = this.carShowMapper.FindAllCar();
return car != null ? new ApiResponse(car, 200, "查询成功") : new ApiResponse((Object)null, 404, "未找到车辆");
} catch (Exception var2) {
Exception e = var2;
e.printStackTrace();
return new ApiResponse((Object)null, 500, "服务器内部错误");
}
}
@PostMapping({"/FindCarById"})
public ApiResponse FindCarById(Car car) {
try {
List<Car> cars = this.carShowMapper.FindCarById(car.getCarId());
return cars != null && !cars.isEmpty() ? new ApiResponse(cars, 200, "查询成功") : new ApiResponse((Object)null, 404, "未找到车辆");
} catch (Exception var3) {
Exception e = var3;
e.printStackTrace();
return new ApiResponse((Object)null, 500, "服务器内部错误");
}
}
@PostMapping({"/AddCar"})
public ApiResponse addCar(@RequestBody Car car) {
try {
this.carShowMapper.addCar(car);
return new ApiResponse((Object)null, 200, "车辆添加成功");
} catch (Exception var3) {
Exception e = var3;
e.printStackTrace();
return new ApiResponse((Object)null, 500, "服务器内部错误");
}
}
@CrossOrigin
@PostMapping({"/delete_car"})
public ApiResponse delete_cars(@RequestBody Map<String, Object> requestBody) {
try {
String carIdsParam = (String)requestBody.get("carIds");
List<String> carIdStrings = Arrays.asList(carIdsParam.split(","));
List<Long> carIds = (List)carIdStrings.stream().map(Long::parseLong).collect(Collectors.toList());
int deletedCount = 0;
Iterator var6 = carIds.iterator();
while(var6.hasNext()) {
Long carId = (Long)var6.next();
boolean isDeleted = this.carShowMapper.DeleteCarById(String.valueOf(carId));
if (isDeleted) {
++deletedCount;
}
}
if (deletedCount == carIds.size()) {
return new ApiResponse((Object)null, 200, "删除成功");
} else if (deletedCount == 0) {
return new ApiResponse((Object)null, 404, "未找到车辆信息");
} else {
return new ApiResponse((Object)null, 207, "部分车辆删除成功");
}
} catch (Exception var9) {
Exception e = var9;
e.printStackTrace();
return new ApiResponse((Object)null, 500, "服务器内部错误");
}
}
@PostMapping({"/upcarinfo"})
public ApiResponse updateCar(@RequestBody Car car) {
System.out.println("-----------------------------------------");
System.out.println(Integer.valueOf(car.getCarId()));
try {
System.out.println(Integer.valueOf(car.getCarId()));
Car existingCarinfo = this.carShowMapper.CarId(Integer.valueOf(car.getCarId()));
System.out.println(existingCarinfo);
if (existingCarinfo != null) {
existingCarinfo.setCarContent(car.getCarContent());
existingCarinfo.setCarPhoto(car.getCarPhoto());
this.carShowMapper.update(existingCarinfo);
return new ApiResponse((Object)null, 200, "车辆信息更新成功");
} else {
return new ApiResponse((Object)null, 404, "车辆不存在");
}
} catch (Exception var3) {
Exception e = var3;
return new ApiResponse(e.getMessage(), 500, "更新车辆信息发生异常");
}
}
@GetMapping({"/getCarsInParking"})
public ApiResponse getCarsInParking(@RequestParam Integer parking_id) {
if (parking_id == null) {
return new ApiResponse((Object)null, 400, "停车场ID不能为空");
} else {
try {
List<Car> result = this.carShowMapper.findCarsByParkingId(parking_id);
return result.isEmpty() ? new ApiResponse((Object)null, 404, "车辆列表为空") : new ApiResponse(result, 200, "获取停车场列表成功");
} catch (Exception var3) {
Exception e = var3;
return new ApiResponse(e.getMessage(), 500, "服务器错误");
}
}
}
}

View File

@ -0,0 +1,100 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.controller;
import com.luozhihui.project.common.ApiResponse;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping({"/api"})
@CrossOrigin
public class CityController {
@Autowired
private JdbcTemplate jdbcTemplate;
public CityController() {
}
@PostMapping({"/cityPicker"})
public ResponseEntity<Object> getCity(@RequestParam MultiValueMap<String, String> formData) {
String type = (String)formData.getFirst("type");
if (type == null) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("请求中缺少 'type' 字段");
} else {
switch (type) {
case "province":
return this.getProvince();
case "city":
String provinceCode = (String)formData.getFirst("province_code");
if (provinceCode == null) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("请求中缺少 'province_code' 字段");
}
return this.getCity(provinceCode);
case "area":
String cityCode = (String)formData.getFirst("city_code");
if (cityCode == null) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("请求中缺少 'city_code' 字段");
}
return this.getArea(cityCode);
default:
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("请求中的 'type' 字段无效");
}
}
}
private ResponseEntity<Object> getProvince() {
try {
List<Map<String, Object>> result = this.jdbcTemplate.queryForList("SELECT * FROM `province`");
return result.isEmpty() ? ResponseEntity.status(HttpStatus.NOT_FOUND).body("未找到省份数据") : ResponseEntity.ok(new ApiResponse(result, 200, "获取成功"));
} catch (DataAccessException var2) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("获取省份数据时出错");
}
}
private ResponseEntity<Object> getCity(String provinceCode) {
try {
String sql = "SELECT * FROM `city` WHERE city_code LIKE ?";
String provinceCodePrefix = provinceCode.substring(0, 2) + "%";
List<Map<String, Object>> result = this.jdbcTemplate.queryForList(sql, new Object[]{provinceCodePrefix});
return result.isEmpty() ? ResponseEntity.status(HttpStatus.NOT_FOUND).body("未找到所提供省份代码的城市数据") : ResponseEntity.ok(new ApiResponse(result, 200, "获取成功"));
} catch (DataAccessException var5) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("获取城市数据时出错");
}
}
private ResponseEntity<Object> getArea(String cityCode) {
try {
String sql = "SELECT * FROM `area` WHERE area_code LIKE ?";
String cityCodePrefix = cityCode.substring(0, 4) + "%";
List<Map<String, Object>> result = this.jdbcTemplate.queryForList(sql, new Object[]{cityCodePrefix});
if (result.isEmpty()) {
return ResponseEntity.status(HttpStatus.NOT_FOUND).body("未找到所提供城市代码的区县数据");
} else {
result.forEach((row) -> {
String areaName = (String)row.get("area_name");
row.put("area_name", areaName.trim());
});
return ResponseEntity.ok(new ApiResponse(result, 200, "获取成功"));
}
} catch (DataAccessException var5) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("获取区县数据时出错");
}
}
}

View File

@ -0,0 +1,47 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.controller;
import com.luozhihui.project.common.ApiResponse;
import com.luozhihui.project.entity.Comment;
import com.luozhihui.project.mapper.CommentMapper;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping({"/api"})
@CrossOrigin
public class CommentController {
@Resource
CommentMapper commentMapper;
public CommentController() {
}
@CrossOrigin
@PostMapping({"/comment"})
public ApiResponse postComment(Comment comment) {
this.commentMapper.save(comment);
return new ApiResponse((Object)null, 200, "发布成功");
}
@CrossOrigin
@PostMapping({"/AllComment"})
public ApiResponse AllComment() {
try {
List<Comment> comment = this.commentMapper.FindAllComment();
return comment != null ? new ApiResponse(comment, 200, "查询成功") : new ApiResponse((Object)null, 404, "未找到");
} catch (Exception var2) {
Exception e = var2;
e.printStackTrace();
return new ApiResponse((Object)null, 500, "服务器内部错误");
}
}
}

View File

@ -0,0 +1,174 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.controller;
import com.luozhihui.project.common.ApiResponse;
import com.luozhihui.project.entity.Category;
import com.luozhihui.project.entity.Post;
import com.luozhihui.project.entity.Reply;
import com.luozhihui.project.mapper.PostMapper;
import com.luozhihui.project.mapper.ReplyMapper;
import com.luozhihui.project.mapper.CategoryMapper;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping({"/api/forum"})
@CrossOrigin
public class ForumController {
@Resource
PostMapper postMapper;
@Resource
CategoryMapper categoryMapper;
@Resource
ReplyMapper replyMapper;
public ForumController() {
}
@GetMapping({"/categories"})
public ApiResponse listCategories() {
try {
List<Category> categories = this.categoryMapper.findAllCategories();
return new ApiResponse(categories, 200, "获取分类成功");
} catch (Exception var2) {
return new ApiResponse((Object)null, 500, "服务器错误");
}
}
@CrossOrigin
@GetMapping({"/posts"})
public ApiResponse listPosts(@RequestParam(required = false) Long categoryId, @RequestParam(required = false) String searchText, @RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = "10") int size) {
try {
int offset = (page - 1) * size;
List<Post> posts = this.postMapper.selectPostList(categoryId, searchText, offset, size);
int total = this.postMapper.countPosts(categoryId, searchText);
System.out.println(posts);
System.out.println(total);
Map<String, Object> result = new HashMap();
result.put("records", posts);
result.put("total", total);
result.put("size", size);
result.put("current", page);
return new ApiResponse(result, 200, "获取帖子列表成功");
} catch (Exception var9) {
return new ApiResponse((Object)null, 500, "服务器错误");
}
}
@GetMapping({"/posts/{id}"})
public ApiResponse getPost(@PathVariable Long id) {
try {
Post post = this.postMapper.selectById(id);
if (post == null) {
return new ApiResponse((Object)null, 404, "帖子不存在");
} else {
post.setViewCount(post.getViewCount() + 1);
this.postMapper.updateById(post);
return new ApiResponse(post, 200, "获取帖子成功");
}
} catch (Exception var3) {
return new ApiResponse((Object)null, 500, "服务器错误");
}
}
@GetMapping({"/post"})
public ApiResponse createPost(@RequestParam String title, @RequestParam String content, @RequestParam Integer categoryId, @RequestParam Integer userId) {
try {
Post post = new Post();
post.setTitle(title);
post.setContent(content);
post.setCategoryId(String.valueOf((long)categoryId));
post.setUserId(String.valueOf((long)userId));
post.setViewCount(Integer.valueOf(String.valueOf(0)));
post.setLikeCount(Integer.valueOf(String.valueOf(0)));
post.setReplyCount(Integer.valueOf(String.valueOf(0)));
post.setStatus(String.valueOf(1));
int result = this.postMapper.insert(post);
return result > 0 ? new ApiResponse(post.getId(), 200, "创建帖子成功") : new ApiResponse((Object)null, 500, "创建帖子失败");
} catch (Exception var7) {
return new ApiResponse((Object)null, 500, "服务器错误");
}
}
@CrossOrigin
@DeleteMapping({"/delePost/{id}"})
public ApiResponse deletePost(@PathVariable Long id) {
try {
int result = this.postMapper.deletePost(id);
return result > 0 ? new ApiResponse((Object)null, 200, "删除成功") : new ApiResponse((Object)null, 500, "删除失败");
} catch (Exception var3) {
return new ApiResponse((Object)null, 500, "服务器错误");
}
}
@CrossOrigin
@GetMapping({"/posts/{postId}/replies"})
public ApiResponse listReplies(@PathVariable Long postId) {
System.out.println(postId);
try {
List<Reply> replies = this.replyMapper.selectRepliesByPostId(postId);
return new ApiResponse(replies, 200, "获取回复成功");
} catch (Exception var3) {
Exception e = var3;
return new ApiResponse(e, 500, "服务器错误");
}
}
@PostMapping({"/posts/{postId}/repliesed"})
public ApiResponse createReply(@PathVariable Long postId, @RequestParam("userId") Long userId, @RequestParam("content") String content) {
try {
Reply reply = new Reply();
reply.setPostId(postId);
reply.setContent(content);
reply.setUserId(userId);
reply.setStatus(String.valueOf(1));
System.out.println(postId);
System.out.println(content);
System.out.println(userId);
int result = this.replyMapper.insertReply(reply);
return result > 0 ? new ApiResponse(reply, 200, "回复成功") : new ApiResponse((Object)null, 500, "回复失败");
} catch (Exception var6) {
Exception e = var6;
return new ApiResponse(e, 500, "服务器错误");
}
}
@PutMapping({"/replies/{id}"})
public ApiResponse updateReply(@PathVariable Long id, @RequestBody Reply reply) {
try {
reply.setId(id);
int result = this.replyMapper.updateReply(reply);
return result > 0 ? new ApiResponse(reply, 200, "修改成功") : new ApiResponse((Object)null, 500, "修改失败");
} catch (Exception var4) {
return new ApiResponse((Object)null, 500, "服务器错误");
}
}
@CrossOrigin
@DeleteMapping({"/replies/{id}"})
public ApiResponse deleteReply(@PathVariable Long id) {
try {
int result = this.replyMapper.deleteReply(id);
return result > 0 ? new ApiResponse((Object)null, 200, "删除成功") : new ApiResponse((Object)null, 500, "删除失败");
} catch (Exception var3) {
return new ApiResponse((Object)null, 500, "服务器错误");
}
}
}

View File

@ -0,0 +1,79 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.controller;
import java.util.HashMap;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
@Controller
@RestController
@RequestMapping({"/api"})
@CrossOrigin
public class GetCountController {
@Autowired
private JdbcTemplate jdbcTemplate;
public GetCountController() {
}
@PostMapping({"/getcount"})
@ResponseBody
public Map<String, Object> getCount() {
final Map<String, Object> data = new HashMap();
try {
Double totalMoney = (Double)this.jdbcTemplate.queryForObject("SELECT SUM(OrderMoney) AS total_money FROM `order` where OrderStatus = 1", Double.class);
data.put("total_money", totalMoney != null ? totalMoney : 0.0);
Map<String, Object> orderResult = this.jdbcTemplate.queryForMap("SELECT COUNT(OrderMoney) AS total_orders, SUM(OrderMoney) AS total_moneys FROM `order`");
data.put("total_orders", orderResult.get("total_orders"));
data.put("total_moneys", orderResult.get("total_moneys"));
Map<String, Object> todaySuccessResult = this.jdbcTemplate.queryForMap("SELECT COUNT(OrderMoney) AS today_amount, SUM(OrderMoney) AS today_total_money FROM `order` WHERE InTime >= CURDATE() AND OrderStatus = 1");
data.put("today_amount", todaySuccessResult.get("today_amount"));
data.put("today_total_money", todaySuccessResult.get("today_total_money"));
Map<String, Object> todayFailResult = this.jdbcTemplate.queryForMap("SELECT COUNT(OrderMoney) AS today2_amount , SUM(OrderMoney) AS today2_total_money FROM `order` WHERE InTime >= CURDATE() AND OrderStatus = 0");
data.put("today2_amount", todayFailResult.get("today2_amount"));
data.put("today2_total_money", todayFailResult.get("today2_total_money"));
Map<String, Object> yesterdaySuccessResult = this.jdbcTemplate.queryForMap("SELECT COUNT(OrderMoney) AS yes_amount, SUM(OrderMoney) AS yesday_total_money FROM `order` WHERE InTime >= CURDATE() - INTERVAL 1 DAY AND InTime < CURDATE() AND OrderStatus = 1");
data.put("yes_amount", yesterdaySuccessResult.get("yes_amount"));
data.put("yesday_total_money", yesterdaySuccessResult.get("yesday_total_money"));
Map<String, Object> yesterdayFailResult = this.jdbcTemplate.queryForMap("SELECT COUNT(OrderMoney) AS yes2_amount FROM `order` WHERE InTime >= CURDATE() - INTERVAL 1 DAY AND InTime < CURDATE() AND OrderStatus = 0");
data.put("yes2_amount", yesterdayFailResult.get("yes2_amount"));
Double todayTotalDay = (Double)this.jdbcTemplate.queryForObject("SELECT SUM(OrderMoney) AS today_total_day FROM `order` WHERE InTime >= CURDATE() AND OrderStatus = 1 AND Mode = 1", Double.class);
data.put("today_total_day", todayTotalDay != null ? todayTotalDay : 0.0);
Double todayTotalHour = (Double)this.jdbcTemplate.queryForObject("SELECT SUM(OrderMoney) AS today_total_hour FROM `order` WHERE InTime >= CURDATE() AND OrderStatus = 1 AND Mode = 0", Double.class);
data.put("today_total_hour", todayTotalHour != null ? todayTotalHour : 0.0);
Double totalUser = (Double)this.jdbcTemplate.queryForObject("SELECT COUNT(UserId) AS total_user FROM `user` ", Double.class);
data.put("total_user", totalUser != null ? totalUser : 0.0);
Double totalCar = (Double)this.jdbcTemplate.queryForObject("SELECT COUNT(CarId) AS total_car FROM `car` ", Double.class);
data.put("total_car", totalCar != null ? totalCar : 0.0);
return new HashMap<String, Object>() {
{
this.put("status", 1);
this.put("message", "获取成功!");
this.put("data", data);
}
};
} catch (Exception var12) {
final Exception e = var12;
e.printStackTrace();
return new HashMap<String, Object>() {
{
this.put("status", 200);
this.put("message", e.getMessage());
this.put("data", (Object)null);
}
};
}
}
}

View File

@ -0,0 +1,161 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.controller;
import com.luozhihui.project.common.ApiResponse;
import com.luozhihui.project.common.totalResponse;
import com.luozhihui.project.entity.Mode;
import com.luozhihui.project.mapper.ModeMapper;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping({"/api"})
@CrossOrigin
public class ModeController {
@Resource
ModeMapper modeMapper;
public ModeController() {
}
@PostMapping({"/AllModepage"})
public totalResponse AllBrand(@RequestParam int pageNumber, @RequestParam int pageSize) {
try {
List<Mode> mode = this.modeMapper.FindAllModepage((pageNumber - 1) * pageSize, pageSize);
int total = this.modeMapper.countMode();
return mode != null ? new totalResponse(mode, 200, "查询成功", total) : new totalResponse((Object)null, 404, "未找到该套餐", (Integer)null);
} catch (Exception var5) {
Exception e = var5;
e.printStackTrace();
return new totalResponse(e.getMessage(), 500, "服务器内部错误", (Integer)null);
}
}
@PostMapping({"/AllMode"})
public ApiResponse AllBrandpage() {
try {
List<Mode> mode = this.modeMapper.FindAllMode();
return mode != null ? new ApiResponse(mode, 200, "查询成功") : new ApiResponse((Object)null, 404, "未找到套餐");
} catch (Exception var2) {
Exception e = var2;
e.printStackTrace();
return new ApiResponse(e.getMessage(), 500, "服务器内部错误");
}
}
@PostMapping({"/FindModeById"})
public ApiResponse FindBrandById(@RequestParam("id") Long id) {
try {
Mode mode = (Mode)this.modeMapper.FindModedById(String.valueOf(id));
return mode != null ? new ApiResponse(mode, 200, "查询成功") : new ApiResponse((Object)null, 404, "未找到品牌信息");
} catch (Exception var3) {
Exception e = var3;
e.printStackTrace();
return new ApiResponse((Object)null, 500, "服务器内部错误:" + e.getMessage());
}
}
@CrossOrigin
@GetMapping({"/getPid"})
public ApiResponse FindModeByParkingId(Mode mode) {
try {
List<Mode> modes = this.modeMapper.FindModedByParkingId(mode.getParking_id());
return modes != null && !modes.isEmpty() ? new ApiResponse(modes, 200, "查询成功") : new ApiResponse((Object)null, 404, "未找到品牌信息");
} catch (Exception var3) {
Exception e = var3;
e.printStackTrace();
return new ApiResponse((Object)null, 500, "服务器内部错误:" + e.getMessage());
}
}
@CrossOrigin
@PostMapping({"/AddMode"})
public ApiResponse AddBrand(@RequestBody Mode mode) {
try {
this.modeMapper.addMode(mode);
return new ApiResponse((Object)null, 200, "添加成功");
} catch (Exception var3) {
Exception e = var3;
e.printStackTrace();
return new ApiResponse(e.getMessage(), 500, "服务器内部错误");
}
}
@CrossOrigin
@PostMapping({"/delete_mode"})
public ApiResponse delete_brand(@RequestBody Map<String, Object> requestBody) {
try {
String carIdsParam = (String)requestBody.get("ids");
List<String> carIdStrings = Arrays.asList(carIdsParam.split(","));
List<Long> carIds = (List)carIdStrings.stream().map(Long::parseLong).collect(Collectors.toList());
int deletedCount = 0;
Iterator var6 = carIds.iterator();
while(var6.hasNext()) {
Long carId = (Long)var6.next();
boolean isDeleted = this.modeMapper.DeleteModeById(String.valueOf(carId));
if (isDeleted) {
++deletedCount;
}
}
if (deletedCount == carIds.size()) {
return new ApiResponse((Object)null, 200, "删除成功");
} else if (deletedCount == 0) {
return new ApiResponse((Object)null, 404, "未找到信息");
} else {
return new ApiResponse((Object)null, 207, "部分删除成功");
}
} catch (Exception var9) {
Exception e = var9;
e.printStackTrace();
return new ApiResponse((Object)null, 500, "服务器内部错误");
}
}
@PostMapping({"/upmodeinfo"})
public ApiResponse updateCar(@RequestBody Mode mode) {
System.out.println(mode.getModeId());
System.out.println("-------------------------------");
try {
Mode existingBrandinfo = this.modeMapper.ModeId(mode.getModeId());
System.out.println(existingBrandinfo);
System.out.println(mode.getModeId());
if (existingBrandinfo != null) {
existingBrandinfo.setBetMoney(mode.getBetMoney());
existingBrandinfo.setDescription(mode.getDescription());
existingBrandinfo.setDayMoney(mode.getDayMoney());
existingBrandinfo.setHourMoney(mode.getHourMoney());
existingBrandinfo.setModeId(mode.getModeId());
existingBrandinfo.setMonthMoney(mode.getMonthMoney());
existingBrandinfo.setParking_id(mode.getParking_id());
existingBrandinfo.setModeName(mode.getModeName());
existingBrandinfo.setModeImg(mode.getModeImg());
existingBrandinfo.setModeNum(mode.getModeNum());
this.modeMapper.update(existingBrandinfo);
return new ApiResponse((Object)null, 200, "品牌信息更新成功");
} else {
return new ApiResponse((Object)null, 404, "品牌不存在");
}
} catch (Exception var3) {
Exception e = var3;
return new ApiResponse(e.getMessage(), 500, "更新品牌信息发生异常");
}
}
}

View File

@ -0,0 +1,11 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.controller;
public class OrderMoneyController {
public OrderMoneyController() {
}
}

View File

@ -0,0 +1,153 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.controller;
import com.luozhihui.project.common.ApiResponse;
import com.luozhihui.project.common.totalResponse;
import com.luozhihui.project.entity.Order;
import com.luozhihui.project.mapper.OrderShowMapper;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.CrossOrigin;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping({"/api"})
@CrossOrigin
public class OrderShowController {
@Resource
OrderShowMapper orderShowMapper;
public OrderShowController() {
}
@PostMapping({"/AllOrder"})
public ApiResponse AllCar() {
try {
List<Order> order = this.orderShowMapper.FindAllOrder();
return order != null ? new ApiResponse(order, 200, "查询成功") : new ApiResponse((Object)null, 404, "未找到订单");
} catch (Exception var2) {
Exception e = var2;
e.printStackTrace();
return new ApiResponse((Object)null, 500, "服务器内部错误");
}
}
@CrossOrigin
@PostMapping({"/getorder"})
public ApiResponse OrderTotal() {
try {
List<Order> order = this.orderShowMapper.GetOrder();
return order != null ? new ApiResponse(order, 200, "查询成功") : new ApiResponse((Object)null, 404, "未找到车辆");
} catch (Exception var2) {
Exception e = var2;
e.printStackTrace();
return new ApiResponse((Object)null, 500, "服务器内部错误");
}
}
@CrossOrigin
@PostMapping({"/delete_order"})
public ApiResponse delete_order(@RequestBody Map<String, Object> requestBody) {
try {
String orderIdsParam = (String)requestBody.get("orderIds");
List<String> orderIdStrings = Arrays.asList(orderIdsParam.split(","));
List<Long> orderIds = (List)orderIdStrings.stream().map(Long::parseLong).collect(Collectors.toList());
int deletedCount = 0;
Iterator var6 = orderIds.iterator();
while(var6.hasNext()) {
Long orderId = (Long)var6.next();
boolean isDeleted = this.orderShowMapper.DeleteOrderById(String.valueOf(orderId));
if (isDeleted) {
++deletedCount;
}
}
if (deletedCount == orderIds.size()) {
return new ApiResponse((Object)null, 200, "删除成功");
} else if (deletedCount == 0) {
return new ApiResponse((Object)null, 404, "未找到订单信息");
} else {
return new ApiResponse((Object)null, 207, "部分订单删除成功");
}
} catch (Exception var9) {
Exception e = var9;
e.printStackTrace();
return new ApiResponse((Object)null, 500, "服务器内部错误");
}
}
@PostMapping({"/FindOrderById"})
public totalResponse findOrderById(@RequestParam Integer userId, @RequestParam int pageNumber, @RequestParam int pageSize) {
try {
if (userId == null) {
return new totalResponse((Object)null, 400, "订单信息不完整", (Integer)null);
} else {
List<Order> orders = this.orderShowMapper.findOrdersByUserId(userId, (pageNumber - 1) * pageSize, pageSize);
int total = this.orderShowMapper.countOrdersByUserId(String.valueOf(userId));
if (orders != null && !orders.isEmpty()) {
ZoneId zoneId = ZoneId.systemDefault();
Iterator var7 = orders.iterator();
while(var7.hasNext()) {
Order o = (Order)var7.next();
LocalDateTime outTime;
if (o.getInTime() != null) {
outTime = o.getInTime().atZone(zoneId).toLocalDateTime();
o.setInTime(outTime);
}
if (o.getOutTime() != null) {
outTime = o.getOutTime().atZone(zoneId).toLocalDateTime();
o.setOutTime(outTime);
}
}
return new totalResponse(orders, 200, "查询成功", total);
} else {
return new totalResponse((Object)null, 404, "未找到订单", (Integer)null);
}
}
} catch (Exception var10) {
Exception e = var10;
e.printStackTrace();
return new totalResponse((Object)null, 500, "服务器内部错误", (Integer)null);
}
}
@CrossOrigin
@PostMapping({"/uporderinfo"})
public ApiResponse updateOrder(@RequestBody Order order) {
try {
int orderId = Integer.parseInt(order.getOrderId());
System.out.println(orderId);
Order existingOrderinfo = this.orderShowMapper.OrderId(orderId);
System.out.println(existingOrderinfo);
if (existingOrderinfo != null) {
existingOrderinfo.setOrderMoney(order.getOrderMoney());
existingOrderinfo.setOrderStatus(order.getOrderStatus());
this.orderShowMapper.update(existingOrderinfo);
return new ApiResponse((Object)null, 200, "订单信息更新成功");
} else {
return new ApiResponse((Object)null, 404, "订单不存在");
}
} catch (Exception var4) {
Exception e = var4;
return new ApiResponse(e.getMessage(), 500, "更新车辆信息发生异常");
}
}
}

View File

@ -0,0 +1,63 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.controller;
import com.luozhihui.project.common.ApiResponse;
import com.luozhihui.project.entity.Pact;
import com.luozhihui.project.mapper.PactShowMapper;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping({"/api"})
@CrossOrigin
public class PactShowController {
@Resource
PactShowMapper pactShowMapper;
public PactShowController() {
}
@PostMapping({"/AllPact"})
public ApiResponse AllCar() {
try {
List<Pact> pact = this.pactShowMapper.FindAllPact();
return pact != null ? new ApiResponse(pact, 200, "查询成功") : new ApiResponse((Object)null, 404, "未找到合同信息");
} catch (Exception var2) {
Exception e = var2;
e.printStackTrace();
return new ApiResponse((Object)null, 500, "服务器内部错误");
}
}
@PostMapping({"/FindPactById"})
public ApiResponse FindCarById(Pact pact) {
try {
List<Pact> pacts = this.pactShowMapper.FindPactById(pact.getUserId());
return pacts != null && !pacts.isEmpty() ? new ApiResponse(pacts, 200, "查询成功") : new ApiResponse((Object)null, 404, "未找到合同信息");
} catch (Exception var3) {
Exception e = var3;
e.printStackTrace();
return new ApiResponse((Object)null, 500, "服务器内部错误");
}
}
@PostMapping({"/FindPactByPactId"})
public ApiResponse FindPactById(Pact pact) {
try {
List<Pact> pacts = this.pactShowMapper.FindPactByPactId(String.valueOf(pact.getPactId()));
return pacts != null && !pacts.isEmpty() ? new ApiResponse(pacts, 200, "查询成功") : new ApiResponse((Object)null, 404, "未找到合同信息");
} catch (Exception var3) {
Exception e = var3;
e.printStackTrace();
return new ApiResponse((Object)null, 500, "服务器内部错误");
}
}
}

View File

@ -0,0 +1,153 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.controller;
import com.luozhihui.project.common.ApiResponse;
import com.luozhihui.project.entity.Parking;
import com.luozhihui.project.mapper.ParkingMapper;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.CrossOrigin;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RequestMapping({"/api"})
@CrossOrigin
@RestController
public class ParkingController {
@Autowired
private JdbcTemplate jdbcTemplate;
@Resource
ParkingMapper parkingMapper;
public ParkingController() {
}
@PostMapping({"/webParking"})
@CrossOrigin
public ApiResponse webParking() {
String sql = "SELECT `parking`.id, parkingName, coord, COUNT(`car`.`parking_id`) as carsNumber FROM `parking`, `car` WHERE parking.enable = 1 GROUP BY parking.id";
List<Map<String, Object>> result = this.jdbcTemplate.queryForList(sql);
if (result.isEmpty()) {
return new ApiResponse((Object)null, 404, "停车场为空");
} else {
Iterator var3 = result.iterator();
while(var3.hasNext()) {
Map<String, Object> row = (Map)var3.next();
String parkingId = row.get("id").toString();
String countSql = "SELECT COUNT(parking_id) as carsNumber FROM car WHERE parking_id = ?";
int carsNumber = (Integer)this.jdbcTemplate.queryForObject(countSql, Integer.class, new Object[]{parkingId});
row.put("carsNumber", carsNumber);
}
return new ApiResponse(result, 200, "停车场获取成功");
}
}
@PostMapping({"/AllParking"})
public ApiResponse AllParking() {
try {
List<Parking> parking = this.parkingMapper.FindAllParking();
return parking != null ? new ApiResponse(parking, 200, "查询成功") : new ApiResponse((Object)null, 404, "未找到停车场");
} catch (Exception var2) {
Exception e = var2;
e.printStackTrace();
return new ApiResponse(e.getMessage(), 500, "服务器内部错误");
}
}
@PostMapping({"/FindParkingById"})
public ApiResponse FindParkingById(@RequestParam("id") Long id) {
try {
Parking parking = (Parking)this.parkingMapper.FindParkingById(String.valueOf(id));
return parking != null ? new ApiResponse(parking, 200, "查询成功") : new ApiResponse((Object)null, 404, "未找到停车场信息");
} catch (Exception var3) {
Exception e = var3;
e.printStackTrace();
return new ApiResponse((Object)null, 500, "服务器内部错误:" + e.getMessage());
}
}
@PostMapping({"/AddParking"})
public ApiResponse AddBrand(@RequestBody Parking parking) {
try {
this.parkingMapper.addParking(parking);
return new ApiResponse((Object)null, 200, "停车场添加成功");
} catch (Exception var3) {
Exception e = var3;
e.printStackTrace();
return new ApiResponse(e.getMessage(), 500, "服务器内部错误");
}
}
@CrossOrigin
@PostMapping({"/delete_parking"})
public ApiResponse delete_parking(@RequestBody Map<String, Object> requestBody) {
try {
String carIdsParam = (String)requestBody.get("ids");
List<String> carIdStrings = Arrays.asList(carIdsParam.split(","));
List<Long> carIds = (List)carIdStrings.stream().map(Long::parseLong).collect(Collectors.toList());
int deletedCount = 0;
Iterator var6 = carIds.iterator();
while(var6.hasNext()) {
Long carId = (Long)var6.next();
boolean isDeleted = this.parkingMapper.DeleteParkingById(String.valueOf(carId));
if (isDeleted) {
++deletedCount;
}
}
if (deletedCount == carIds.size()) {
return new ApiResponse((Object)null, 200, "删除成功");
} else if (deletedCount == 0) {
return new ApiResponse((Object)null, 404, "未找到信息");
} else {
return new ApiResponse((Object)null, 207, "部分删除成功");
}
} catch (Exception var9) {
Exception e = var9;
e.printStackTrace();
return new ApiResponse((Object)null, 500, "服务器内部错误");
}
}
@PostMapping({"/upparkinginfo"})
public ApiResponse updateCar(@RequestBody Parking parking) {
System.out.println(parking.getId());
System.out.println("-------------------------------");
try {
Parking existingParkinginfo = this.parkingMapper.ParkingId(parking.getId());
System.out.println(existingParkinginfo);
if (existingParkinginfo != null) {
existingParkinginfo.setAddress(parking.getAddress());
existingParkinginfo.setCarsNumber(parking.getCarsNumber());
existingParkinginfo.setCoord(parking.getCoord());
existingParkinginfo.setEnable(parking.getEnable());
existingParkinginfo.setType(parking.getType());
existingParkinginfo.setParkingName(parking.getParkingName());
this.parkingMapper.update(existingParkinginfo);
return new ApiResponse((Object)null, 200, "停车场信息更新成功");
} else {
return new ApiResponse((Object)null, 404, "品牌不存在");
}
} catch (Exception var3) {
Exception e = var3;
return new ApiResponse(e.getMessage(), 500, "更新信息发生异常");
}
}
}

View File

@ -0,0 +1,170 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.controller;
import com.luozhihui.project.common.ApiResponse;
import com.luozhihui.project.common.SmsBaoConfig;
import com.luozhihui.project.entity.Phone;
import com.luozhihui.project.mapper.PhoneMapper;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Random;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@CrossOrigin
@RequestMapping({"/api"})
public class PhoneSendCodeController {
@Resource
PhoneMapper phoneMapper;
@Autowired
private SmsBaoConfig smsBaoConfig;
public PhoneSendCodeController() {
}
@PostMapping({"/sendCode"})
public ResponseEntity<ApiResponse> sendCode(@RequestParam String Phone) {
if (!this.isValidPhoneNumber(Phone)) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ApiResponse((Object)null, HttpStatus.BAD_REQUEST.value(), "不合法的数字"));
} else {
String randomCode = this.generateRandomCode();
boolean sendStatus = this.sendSms(Phone, randomCode);
return sendStatus ? ResponseEntity.ok(new ApiResponse((Object)null, HttpStatus.OK.value(), "验证码发送成功")) : ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(new ApiResponse((Object)null, HttpStatus.INTERNAL_SERVER_ERROR.value(), "验证码发送失败"));
}
}
private boolean isValidPhoneNumber(String Phone) {
return Phone != null && Phone.length() == 11 && Phone.matches("\\d+");
}
private String generateRandomCode() {
Random random = new Random();
int code = random.nextInt(9000) + 1000;
return String.valueOf(code);
}
private boolean sendSms(String Phone, String code) {
try {
String username = this.smsBaoConfig.getUsername();
String password = this.smsBaoConfig.getPassword();
String content = "【曙光网络】您的验证码为" + code + "在30分钟内有效。";
String smsBaoUrl = "http://api.smsbao.com/sms";
String httpArg = "u=" + username + "&p=" + this.md5(password) + "&m=" + Phone + "&c=" + this.encodeUrlString(content, "UTF-8");
String result = this.request(smsBaoUrl, httpArg);
if (result != null && result.equals("0")) {
this.saveVerificationCode(Phone, code);
return true;
} else {
return false;
}
} catch (Exception var9) {
Exception e = var9;
e.printStackTrace();
return false;
}
}
private String request(String smsBaoUrl, String httpArg) {
BufferedReader reader = null;
String result = null;
StringBuffer sbf = new StringBuffer();
smsBaoUrl = smsBaoUrl + "?" + httpArg;
try {
URL url = new URL(smsBaoUrl);
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod("GET");
connection.connect();
InputStream is = connection.getInputStream();
reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
String strRead = reader.readLine();
if (strRead != null) {
sbf.append(strRead);
while((strRead = reader.readLine()) != null) {
sbf.append("\n");
sbf.append(strRead);
}
}
reader.close();
result = sbf.toString();
} catch (Exception var10) {
Exception e = var10;
e.printStackTrace();
}
return result;
}
private String md5(String password) {
StringBuffer buf = null;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(password.getBytes());
byte[] b = md.digest();
buf = new StringBuffer("");
for(int offset = 0; offset < b.length; ++offset) {
int i = b[offset];
if (i < 0) {
i += 256;
}
if (i < 16) {
buf.append("0");
}
buf.append(Integer.toHexString(i));
}
} catch (NoSuchAlgorithmException var7) {
NoSuchAlgorithmException e = var7;
e.printStackTrace();
}
return buf.toString();
}
private String encodeUrlString(String content, String charset) {
String strret = null;
if (content == null) {
return content;
} else {
try {
strret = URLEncoder.encode(content, charset);
} catch (UnsupportedEncodingException var5) {
UnsupportedEncodingException e = var5;
e.printStackTrace();
}
return strret;
}
}
private void saveVerificationCode(String Phone, String code) {
Phone phone = new Phone();
phone.setPhone(Phone);
phone.setCode(code);
this.phoneMapper.save(phone);
}
}

View File

@ -0,0 +1,130 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.controller;
import com.luozhihui.project.common.ApiResponse;
import com.luozhihui.project.entity.Repair;
import com.luozhihui.project.mapper.RepairShowMapper;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.CrossOrigin;
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;
@RestController
@RequestMapping({"/api"})
@CrossOrigin
public class RepairShowController {
@Resource
RepairShowMapper repairShowMapper;
public RepairShowController() {
}
@PostMapping({"/AllRepair"})
public ApiResponse AllCar() {
try {
List<Repair> repair = this.repairShowMapper.FindAllRepair();
return repair != null ? new ApiResponse(repair, 200, "查询成功") : new ApiResponse((Object)null, 404, "未找到车辆");
} catch (Exception var2) {
Exception e = var2;
e.printStackTrace();
return new ApiResponse((Object)null, 500, "服务器内部错误:" + e.getMessage());
}
}
@PostMapping({"/AddRepair"})
public ApiResponse addRepair(@RequestBody Repair repair) {
try {
this.repairShowMapper.addRepair(repair);
this.repairShowMapper.updateCarStatusToRepair(repair.getCarId());
return new ApiResponse((Object)null, 200, "维修信息添加成功");
} catch (Exception var3) {
Exception e = var3;
e.printStackTrace();
return new ApiResponse((Object)null, 500, "服务器内部错误");
}
}
@CrossOrigin
@PostMapping({"/delete_repair"})
public ApiResponse delete_repairs(@RequestBody Map<String, Object> requestBody) {
try {
String repairIdsInt = (String)requestBody.get("repairIds");
String repairIdsParam = repairIdsInt;
List<String> repairIdStrings = Arrays.asList(repairIdsParam.split(","));
List<Long> repairIds = (List)repairIdStrings.stream().map(Long::parseLong).collect(Collectors.toList());
int deletedCount = 0;
Iterator var7 = repairIds.iterator();
while(var7.hasNext()) {
Long repairId = (Long)var7.next();
boolean isDeleted = this.repairShowMapper.DeleteRepairById(String.valueOf(repairId));
if (isDeleted) {
++deletedCount;
}
}
if (deletedCount == repairIds.size()) {
return new ApiResponse((Object)null, 200, "删除成功");
} else if (deletedCount == 0) {
return new ApiResponse((Object)null, 404, "未找到维修信息");
} else {
return new ApiResponse((Object)null, 207, "部分维修信息删除成功");
}
} catch (Exception var10) {
Exception e = var10;
e.printStackTrace();
return new ApiResponse(e.getMessage(), 500, "服务器内部错误");
}
}
@PostMapping({"/uprepair"})
public ApiResponse updateCar(@RequestBody Repair repair) {
try {
int repairId = repair.getRepairId();
System.out.println(repairId);
Repair existingRepairinfo = this.repairShowMapper.FindRepairById(String.valueOf(repairId));
System.out.println(existingRepairinfo);
if (existingRepairinfo != null) {
existingRepairinfo.setRepairMoney(repair.getRepairMoney());
existingRepairinfo.setRepairReason(repair.getRepairReason());
existingRepairinfo.setRepairStatus(repair.getRepairStatus());
this.repairShowMapper.update(existingRepairinfo);
if (repair.getRepairStatus() == 1) {
this.repairShowMapper.updateCarStatusToAvailable(repair.getCarId());
System.out.println("-----------------");
System.out.println(repair.getRepairStatus());
System.out.println(repair.getRepairStatus());
System.out.println(repair.getRepairStatus());
System.out.println(repair.getRepairStatus());
}
if (repair.getRepairStatus() == 0) {
this.repairShowMapper.updateCarStatusToRepair(repair.getCarId());
System.out.println("0000000000000000000");
System.out.println(repair.getRepairStatus());
System.out.println(repair.getRepairStatus());
System.out.println(repair.getRepairStatus());
System.out.println(repair.getRepairStatus());
}
return new ApiResponse((Object)null, 200, "维修信息更新成功");
} else {
return new ApiResponse((Object)null, 404, "车辆不存在");
}
} catch (Exception var4) {
Exception e = var4;
return new ApiResponse(e.getMessage(), 500, "更新车辆信息发生异常");
}
}
}

View File

@ -0,0 +1,58 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.controller;
import com.luozhihui.project.common.ApiResponse;
import com.luozhihui.project.entity.User;
import com.luozhihui.project.mapper.UserInfoMapper;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping({"/api"})
@CrossOrigin
public class UserInfoController {
@Resource
UserInfoMapper userInfoMapper;
public UserInfoController() {
}
@PostMapping({"/upuserinfo"})
public ApiResponse updateUser(User user) {
User existingUserinfo = this.userInfoMapper.findById(Integer.valueOf(user.getUserId()));
if (existingUserinfo != null) {
existingUserinfo.setPhone(user.getPhone());
existingUserinfo.setUserName(user.getUserName());
existingUserinfo.setPassWord(user.getPassWord());
existingUserinfo.setIdCard(user.getIdCard());
existingUserinfo.setDriverLicense(user.getDriverLicense());
this.userInfoMapper.update(existingUserinfo);
return new ApiResponse((Object)null, 200, "用户信息更新成功");
} else {
return new ApiResponse((Object)null, 404, "用户不存在");
}
}
@PostMapping({"/RealUser"})
public ApiResponse RealUser(User user) {
User existingUserinfo = this.userInfoMapper.findById(Integer.valueOf(user.getUserId()));
if (existingUserinfo != null) {
existingUserinfo.setPhone(user.getPhone());
existingUserinfo.setUserName(user.getUserName());
existingUserinfo.setIdCard(user.getIdCard());
existingUserinfo.setDriverLicense(user.getDriverLicense());
existingUserinfo.setAvatar(user.getAvatar());
this.userInfoMapper.update(existingUserinfo);
return new ApiResponse((Object)null, 200, "用户实名成功");
} else {
return new ApiResponse((Object)null, 404, "用户不存在");
}
}
}

View File

@ -0,0 +1,47 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.controller;
import com.luozhihui.project.common.LoginResponse;
import com.luozhihui.project.entity.User;
import com.luozhihui.project.mapper.UserLoginMapper;
import com.luozhihui.project.util.JwtUtil;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping({"/api"})
@CrossOrigin
public class UserLoginController {
@Resource
UserLoginMapper userLoginMapper;
public UserLoginController() {
}
@PostMapping({"/login"})
public LoginResponse login(@RequestParam("Phone") String Phone, @RequestParam("PassWord") String PassWord) {
List<User> userList = this.userLoginMapper.findByPhone(Phone);
System.out.println(userList);
if (userList.isEmpty()) {
return new LoginResponse((Object)null, (Object)null, 500, "用户不存在");
} else {
User user = (User)userList.get(0);
if (user.getPassWord().equals(PassWord)) {
JwtUtil jwtUtil = new JwtUtil();
String token = JwtUtil.createToken(((User)userList.get(0)).getPhone());
return new LoginResponse(token, user.getUserId(), 200, "登录成功");
} else {
return new LoginResponse((Object)null, (Object)null, 500, "账号或密码错误");
}
}
}
}

View File

@ -0,0 +1,73 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.controller;
import com.luozhihui.project.common.ApiResponse;
import com.luozhihui.project.entity.User;
import com.luozhihui.project.mapper.PhoneMapper;
import com.luozhihui.project.mapper.UserRegMapper;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping({"/api"})
@CrossOrigin
public class UserRegController {
@Resource
UserRegMapper userRegMapper;
@Resource
PhoneMapper phoneMapper;
public UserRegController() {
}
@CrossOrigin
@PostMapping({"/user_register"})
public ApiResponse UserReg(User user, String code, @RequestHeader(name = "Content-Type",required = false) String contentType) {
if (this.isPhoneRegistered(user.getPhone())) {
return new ApiResponse((Object)null, 400, "该手机号已被注册");
} else {
List<String> codes = this.phoneMapper.findByCode(user.getPhone());
if (codes != null && !codes.isEmpty()) {
String storedCode = (String)codes.get(0);
String userInputCode = user.getCode();
if (this.codeMatches(userInputCode, storedCode)) {
this.userRegMapper.save(user);
this.deleteCode(user.getPhone());
return new ApiResponse((Object)null, 200, "注册成功");
} else {
return new ApiResponse((Object)null, 400, "验证码不匹配");
}
} else {
return new ApiResponse((Object)null, 400, "注册失败");
}
}
}
private boolean codeMatches(String userInputCode, String storedCode) {
return userInputCode != null && storedCode != null ? userInputCode.equals(storedCode) : false;
}
private boolean isPhoneRegistered(String phone) {
if (phone == null) {
return false;
} else {
User existingUser = this.userRegMapper.findByPhone(phone);
return existingUser != null;
}
}
private void deleteCode(String phone) {
if (phone != null) {
this.phoneMapper.deleteCode(phone);
}
}
}

View File

@ -0,0 +1,122 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.controller;
import com.luozhihui.project.common.ApiResponse;
import com.luozhihui.project.entity.User;
import com.luozhihui.project.mapper.UserShowMapper;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.CrossOrigin;
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;
@RestController
@RequestMapping({"/api"})
@CrossOrigin
public class UserShowController {
@Resource
UserShowMapper userShowMapper;
public UserShowController() {
}
@CrossOrigin
@PostMapping({"/AllUser"})
public ApiResponse AllCar() {
try {
List<User> user = this.userShowMapper.FindAllUser();
return user != null ? new ApiResponse(user, 200, "查询成功") : new ApiResponse((Object)null, 404, "未找到");
} catch (Exception var2) {
Exception e = var2;
e.printStackTrace();
return new ApiResponse((Object)null, 500, "服务器内部错误");
}
}
@CrossOrigin
@PostMapping({"/FindUserById"})
public ApiResponse FindUserById(User user) {
try {
List<User> users = this.userShowMapper.FindUserById(user.getUserId());
return users != null && !users.isEmpty() ? new ApiResponse(users, 200, "查询成功") : new ApiResponse((Object)null, 404, "未找到用户信息");
} catch (Exception var3) {
Exception e = var3;
e.printStackTrace();
return new ApiResponse((Object)null, 500, "服务器内部错误");
}
}
@CrossOrigin
@PostMapping({"/delete_user"})
public ApiResponse delete_user(@RequestBody Map<String, Object> requestBody) {
try {
String userIdsParam = (String)requestBody.get("userIds");
List<String> userIdStrings = Arrays.asList(userIdsParam.split(","));
List<Long> userIds = (List)userIdStrings.stream().map(Long::parseLong).collect(Collectors.toList());
int deletedCount = 0;
Iterator var6 = userIds.iterator();
while(var6.hasNext()) {
Long userId = (Long)var6.next();
boolean isDeleted = this.userShowMapper.DeleteUserById(String.valueOf(userId));
if (isDeleted) {
++deletedCount;
}
}
if (deletedCount == userIds.size()) {
return new ApiResponse((Object)null, 200, "删除成功");
} else if (deletedCount == 0) {
return new ApiResponse((Object)null, 404, "未找到用户信息");
} else {
return new ApiResponse((Object)null, 207, "部分用户删除成功");
}
} catch (Exception var9) {
Exception e = var9;
e.printStackTrace();
return new ApiResponse((Object)null, 500, "服务器内部错误");
}
}
@CrossOrigin
@PostMapping({"/add_user"})
public ApiResponse addUser(@RequestBody User user) {
try {
if (user != null && this.isValidUser(user)) {
if (this.isUserExists(user)) {
return new ApiResponse((Object)null, 409, "用户已存在");
} else {
this.userShowMapper.adduser(user);
return new ApiResponse((Object)null, 200, "用户添加成功");
}
} else {
return new ApiResponse((Object)null, 400, "无效的用户数据");
}
} catch (Exception var3) {
return new ApiResponse((Object)null, 500, "内部服务器错误");
}
}
private boolean isValidUser(User user) {
return user != null;
}
private boolean isUserExists(User user) {
try {
User existingUser = (User)this.userShowMapper.FindUserByuserName(user.getUserName());
return existingUser != null;
} catch (Exception var3) {
return false;
}
}
}

View File

@ -0,0 +1,48 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.entity;
public class Admin {
private Integer AdminId;
private String AdminName;
private String AdminPassWord;
private String AdminUser;
public Admin() {
}
public Integer getAdminId() {
return this.AdminId;
}
public void setAdminId(Integer adminId) {
this.AdminId = adminId;
}
public String getAdminName() {
return this.AdminName;
}
public void setAdminName(String adminName) {
this.AdminName = adminName;
}
public String getAdminPassWord() {
return this.AdminPassWord;
}
public void setAdminPassWord(String adminPassWord) {
this.AdminPassWord = adminPassWord;
}
public String getAdminUser() {
return this.AdminUser;
}
public void setAdminUser(String adminUser) {
this.AdminUser = adminUser;
}
}

View File

@ -0,0 +1,57 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.entity;
public class Brand {
private String id;
private String brand_name_ch;
private String brand_name_en;
private String brand_logo;
private Integer status;
public Brand() {
}
public String getId() {
return this.id;
}
public void setId(Integer id) {
this.id = String.valueOf(id);
}
public String getBrand_name_ch() {
return this.brand_name_ch;
}
public void setBrand_name_ch(String brand_name_ch) {
this.brand_name_ch = brand_name_ch;
}
public String getBrand_name_en() {
return this.brand_name_en;
}
public void setBrand_name_en(String brand_name_en) {
this.brand_name_en = brand_name_en;
}
public String getBrand_logo() {
return this.brand_logo;
}
public void setBrand_logo(String brand_logo) {
this.brand_logo = brand_logo;
}
public Integer getStatus() {
return this.status;
}
public void setStatus(Integer status) {
this.status = status;
}
}

View File

@ -0,0 +1,75 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.entity;
public class Car {
private Integer CarId;
private String CarContent;
private String CarPhoto;
private String parking_id;
private String CarStatus;
private String CarNumber;
private String parkingName;
public Car() {
}
public String getParkingName() {
return this.parkingName;
}
public void setParkingName(String parkingName) {
this.parkingName = parkingName;
}
public String getCarNumber() {
return this.CarNumber;
}
public void setCarNumber(String carNumber) {
this.CarNumber = carNumber;
}
public String getParking_id() {
return this.parking_id;
}
public void setParking_id(String parking_id) {
this.parking_id = parking_id;
}
public String getCarId() {
return String.valueOf(this.CarId);
}
public void setCarId(Integer carId) {
this.CarId = carId;
}
public String getCarContent() {
return this.CarContent;
}
public void setCarContent(String carContent) {
this.CarContent = carContent;
}
public String getCarPhoto() {
return this.CarPhoto;
}
public void setCarPhoto(String carPhoto) {
this.CarPhoto = carPhoto;
}
public String getCarStatus() {
return this.CarStatus;
}
public void setCarStatus(String carStatus) {
this.CarStatus = carStatus;
}
}

View File

@ -0,0 +1,75 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.entity;
public class Category {
private Long id;
private String name;
private String description;
private Integer sort;
private Integer status;
private String createTime;
private String updateTime;
public Category() {
}
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return this.description;
}
public void setDescription(String description) {
this.description = description;
}
public Integer getSort() {
return this.sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public Integer getStatus() {
return this.status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getCreateTime() {
return this.createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getUpdateTime() {
return this.updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
}

View File

@ -0,0 +1,93 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.entity;
public class Comment {
private int CommentId;
private String text;
private String pub_date;
private String UserName;
private int CarId;
private int UserId;
private String CarContent;
private String CarNumber;
private int parking_id;
public Comment() {
}
public int getParking_id() {
return this.parking_id;
}
public void setParking_id(int parking_id) {
this.parking_id = parking_id;
}
public String getCarContent() {
return this.CarContent;
}
public void setCarContent(String carContent) {
this.CarContent = carContent;
}
public String getCarNumber() {
return this.CarNumber;
}
public void setCarNumber(String carNumber) {
this.CarNumber = carNumber;
}
public String getUserName() {
return this.UserName;
}
public void setUserName(String userName) {
this.UserName = userName;
}
public int getCommentId() {
return this.CommentId;
}
public void setCommentId(int commentId) {
this.CommentId = commentId;
}
public String getText() {
return this.text;
}
public void setText(String text) {
this.text = text;
}
public String getPub_date() {
return this.pub_date;
}
public void setPub_date(String pub_date) {
this.pub_date = pub_date;
}
public int getCarId() {
return this.CarId;
}
public void setCarId(int carId) {
this.CarId = carId;
}
public int getUserId() {
return this.UserId;
}
public void setUserId(int userId) {
this.UserId = userId;
}
}

View File

@ -0,0 +1,129 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.entity;
public class Mode {
private int ModeId;
private String BetMoney;
private String DayMoney;
private String HourMoney;
private String MonthMoney;
private String Description;
private String ModeStatus;
private String parking_id;
private String ModeName;
private String ModeImg;
private String parkingName;
private String ModeNum;
private String type;
public Mode() {
}
public String getType() {
return this.type;
}
public void setType(String type) {
this.type = type;
}
public int getModeId() {
return this.ModeId;
}
public void setModeId(int modeId) {
this.ModeId = modeId;
}
public String getBetMoney() {
return this.BetMoney;
}
public void setBetMoney(String betMoney) {
this.BetMoney = betMoney;
}
public String getDayMoney() {
return this.DayMoney;
}
public void setDayMoney(String dayMoney) {
this.DayMoney = dayMoney;
}
public String getHourMoney() {
return this.HourMoney;
}
public void setHourMoney(String hourMoney) {
this.HourMoney = hourMoney;
}
public String getMonthMoney() {
return this.MonthMoney;
}
public void setMonthMoney(String monthMoney) {
this.MonthMoney = monthMoney;
}
public String getDescription() {
return this.Description;
}
public void setDescription(String description) {
this.Description = description;
}
public String getModeStatus() {
return this.ModeStatus;
}
public void setModeStatus(String modeStatus) {
this.ModeStatus = modeStatus;
}
public String getParking_id() {
return this.parking_id;
}
public void setParking_id(String parking_id) {
this.parking_id = parking_id;
}
public String getModeName() {
return this.ModeName;
}
public void setModeName(String modeName) {
this.ModeName = modeName;
}
public String getModeImg() {
return this.ModeImg;
}
public void setModeImg(String modeImg) {
this.ModeImg = modeImg;
}
public String getParkingName() {
return this.parkingName;
}
public void setParkingName(String parkingName) {
this.parkingName = parkingName;
}
public String getModeNum() {
return this.ModeNum;
}
public void setModeNum(String modeNum) {
this.ModeNum = modeNum;
}
}

View File

@ -0,0 +1,203 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.entity;
import java.time.LocalDateTime;
public class Order {
private String OrderId;
private Integer UserId;
private Integer CarId;
private Double OrderMoney;
private String OutPicture;
private String InPicture;
private String carContent;
private LocalDateTime inTime;
private LocalDateTime outTime;
private Integer Mode;
private Integer ModeId;
private Integer OrderStatus;
private String UserName;
private String CarDayMoney;
private String CarHoursMoney;
private String CarNumber;
private String parking_id;
private String parkingName;
private String ModeName;
private String DayMoney;
private String HourMoney;
public Order() {
}
public Integer getModeId() {
return this.ModeId;
}
public String getCarNumber() {
return this.CarNumber;
}
public String getDayMoney() {
return this.DayMoney;
}
public void setDayMoney(String dayMoney) {
this.DayMoney = dayMoney;
}
public String getHourMoney() {
return this.HourMoney;
}
public void setHourMoney(String hourMoney) {
this.HourMoney = hourMoney;
}
public String getCarContent() {
return this.carContent;
}
public void setCarContent(String carContent) {
this.carContent = carContent;
}
public void setCarNumber(String carNumber) {
this.CarNumber = carNumber;
}
public String getModeName() {
return this.ModeName;
}
public void setModeName(String modeName) {
this.ModeName = modeName;
}
public String getParkingName() {
return this.parkingName;
}
public void setParkingName(String parkingName) {
this.parkingName = parkingName;
}
public void setModeId(Integer modeId) {
this.ModeId = modeId;
}
public String getParking_id() {
return this.parking_id;
}
public void setParking_id(String parking_id) {
this.parking_id = parking_id;
}
public String getCarDayMoney() {
return this.CarDayMoney;
}
public void setCarDayMoney(String carDayMoney) {
this.CarDayMoney = carDayMoney;
}
public String getCarHoursMoney() {
return this.CarHoursMoney;
}
public void setCarHoursMoney(String carHoursMoney) {
this.CarHoursMoney = carHoursMoney;
}
public LocalDateTime getInTime() {
return this.inTime;
}
public void setInTime(LocalDateTime inTime) {
this.inTime = inTime;
}
public LocalDateTime getOutTime() {
return this.outTime;
}
public void setOutTime(LocalDateTime outTime) {
this.outTime = outTime;
}
public Integer getMode() {
return this.Mode;
}
public void setMode(Integer mode) {
this.Mode = mode;
}
public String getOrderId() {
return this.OrderId;
}
public void setOrderId(String orderId) {
this.OrderId = orderId;
}
public String getUserId() {
return String.valueOf(this.UserId);
}
public void setUserId(Integer userId) {
this.UserId = userId;
}
public String getCarId() {
return String.valueOf(this.CarId);
}
public void setCarId(Integer carId) {
this.CarId = carId;
}
public Double getOrderMoney() {
return this.OrderMoney;
}
public void setOrderMoney(Double orderMoney) {
this.OrderMoney = orderMoney;
}
public String getOutPicture() {
return this.OutPicture;
}
public void setOutPicture(String outPicture) {
this.OutPicture = outPicture;
}
public String getInPicture() {
return this.InPicture;
}
public void setInPicture(String inPicture) {
this.InPicture = inPicture;
}
public Integer getOrderStatus() {
return this.OrderStatus;
}
public void setOrderStatus(Integer orderStatus) {
this.OrderStatus = orderStatus;
}
public String getUserName() {
return this.UserName;
}
public void setUserName(String userName) {
this.UserName = userName;
}
}

View File

@ -0,0 +1,95 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.entity;
import java.util.Date;
public class Pact {
private Integer PactId;
private Integer CarId;
private Integer UserId;
private Integer PactMoney;
private String CarModel;
private String UserName;
private String CarLicense;
private Date OutTime;
private Date InTime;
public Pact() {
}
public String getCarModel() {
return this.CarModel;
}
public void setCarModel(String carModel) {
this.CarModel = carModel;
}
public String getUserName() {
return this.UserName;
}
public void setUserName(String userName) {
this.UserName = userName;
}
public String getCarLicense() {
return this.CarLicense;
}
public void setCarLicense(String carLicense) {
this.CarLicense = carLicense;
}
public Integer getPactId() {
return this.PactId;
}
public void setPactId(Integer pactId) {
this.PactId = pactId;
}
public Integer getCarId() {
return this.CarId;
}
public void setCarId(Integer carId) {
this.CarId = carId;
}
public String getUserId() {
return String.valueOf(this.UserId);
}
public void setUserId(Integer userId) {
this.UserId = userId;
}
public Integer getPactMoney() {
return this.PactMoney;
}
public void setPactMoney(Integer pactMoney) {
this.PactMoney = pactMoney;
}
public Date getOutTime() {
return this.OutTime;
}
public void setOutTime(Date outTime) {
this.OutTime = outTime;
}
public Date getInTime() {
return this.InTime;
}
public void setInTime(Date inTime) {
this.InTime = inTime;
}
}

View File

@ -0,0 +1,75 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.entity;
public class Parking {
private Integer id;
private String parkingName;
private String address;
private Integer type;
private Integer carsNumber;
private String enable;
private String coord;
public Parking() {
}
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public String getParkingName() {
return this.parkingName;
}
public void setParkingName(String parkingName) {
this.parkingName = parkingName;
}
public String getAddress() {
return this.address;
}
public void setAddress(String address) {
this.address = address;
}
public Integer getType() {
return this.type;
}
public void setType(Integer type) {
this.type = type;
}
public Integer getCarsNumber() {
return this.carsNumber;
}
public void setCarsNumber(Integer carsNumber) {
this.carsNumber = carsNumber;
}
public String getEnable() {
return this.enable;
}
public void setEnable(String enable) {
this.enable = enable;
}
public String getCoord() {
return this.coord;
}
public void setCoord(String coord) {
this.coord = coord;
}
}

View File

@ -0,0 +1,30 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.entity;
public class Phone {
private String phone;
private String code;
public Phone() {
}
public String getPhone() {
return this.phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getCode() {
return this.code;
}
public void setCode(String code) {
this.code = code;
}
}

View File

@ -0,0 +1,131 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.entity;
import java.util.Date;
public class Post {
private Integer id;
private String title;
private String content;
private String userId;
private String categoryId;
private String status;
private Integer viewCount;
private Integer likeCount;
private Integer replyCount;
private String UserName;
private Date createTime;
private Date updateTime;
private String categoryName;
public Post() {
}
public String getCategoryName() {
return this.categoryName;
}
public void setCategoryName(String categoryName) {
this.categoryName = categoryName;
}
public String getUserName() {
return this.UserName;
}
public void setUserName(String userName) {
this.UserName = userName;
}
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public String getTitle() {
return this.title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return this.content;
}
public void setContent(String content) {
this.content = content;
}
public String getUserId() {
return this.userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getCategoryId() {
return this.categoryId;
}
public void setCategoryId(String categoryId) {
this.categoryId = categoryId;
}
public String getStatus() {
return this.status;
}
public void setStatus(String status) {
this.status = status;
}
public Integer getViewCount() {
return this.viewCount;
}
public void setViewCount(Integer viewCount) {
this.viewCount = viewCount;
}
public Integer getLikeCount() {
return this.likeCount;
}
public void setLikeCount(Integer likeCount) {
this.likeCount = likeCount;
}
public Integer getReplyCount() {
return this.replyCount;
}
public void setReplyCount(Integer replyCount) {
this.replyCount = replyCount;
}
public Date getCreateTime() {
return this.createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return this.updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}

View File

@ -0,0 +1,183 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.entity;
public class Repair {
private Integer RepairId;
private Integer CarId;
private String RepairReason;
private Integer PactId;
private Integer RepairMoney;
private Integer RepairStatus;
private String CarModel;
private String CarLicense;
private String CarContent;
private String CarColour;
private String CarPhoto;
private String CarPosition;
private String CarSecurityDeposit;
private String CarDayMoney;
private String CarHoursMoney;
private String OutTime;
private String InTime;
private String Mode;
private String CarStatus;
public Repair() {
}
public Integer getRepairId() {
return this.RepairId;
}
public void setRepairId(Integer repairId) {
this.RepairId = repairId;
}
public Integer getCarId() {
return this.CarId;
}
public void setCarId(Integer carId) {
this.CarId = carId;
}
public String getRepairReason() {
return this.RepairReason;
}
public void setRepairReason(String repairReason) {
this.RepairReason = repairReason;
}
public Integer getPactId() {
return this.PactId;
}
public void setPactId(Integer pactId) {
this.PactId = pactId;
}
public Integer getRepairMoney() {
return this.RepairMoney;
}
public void setRepairMoney(Integer repairMoney) {
this.RepairMoney = repairMoney;
}
public Integer getRepairStatus() {
return this.RepairStatus;
}
public void setRepairStatus(Integer repairStatus) {
this.RepairStatus = repairStatus;
}
public String getCarModel() {
return this.CarModel;
}
public void setCarModel(String carModel) {
this.CarModel = carModel;
}
public String getCarLicense() {
return this.CarLicense;
}
public void setCarLicense(String carLicense) {
this.CarLicense = carLicense;
}
public String getCarContent() {
return this.CarContent;
}
public void setCarContent(String carContent) {
this.CarContent = carContent;
}
public String getCarColour() {
return this.CarColour;
}
public void setCarColour(String carColour) {
this.CarColour = carColour;
}
public String getCarPhoto() {
return this.CarPhoto;
}
public void setCarPhoto(String carPhoto) {
this.CarPhoto = carPhoto;
}
public String getCarPosition() {
return this.CarPosition;
}
public void setCarPosition(String carPosition) {
this.CarPosition = carPosition;
}
public String getCarSecurityDeposit() {
return this.CarSecurityDeposit;
}
public void setCarSecurityDeposit(String carSecurityDeposit) {
this.CarSecurityDeposit = carSecurityDeposit;
}
public String getCarDayMoney() {
return this.CarDayMoney;
}
public void setCarDayMoney(String carDayMoney) {
this.CarDayMoney = carDayMoney;
}
public String getCarHoursMoney() {
return this.CarHoursMoney;
}
public void setCarHoursMoney(String carHoursMoney) {
this.CarHoursMoney = carHoursMoney;
}
public String getOutTime() {
return this.OutTime;
}
public void setOutTime(String outTime) {
this.OutTime = outTime;
}
public String getInTime() {
return this.InTime;
}
public void setInTime(String inTime) {
this.InTime = inTime;
}
public String getMode() {
return this.Mode;
}
public void setMode(String mode) {
this.Mode = mode;
}
public String getCarStatus() {
return this.CarStatus;
}
public void setCarStatus(String carStatus) {
this.CarStatus = carStatus;
}
}

View File

@ -0,0 +1,113 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.entity;
import java.util.Date;
public class Reply {
private Long id;
private String content;
private Long postId;
private Long userId;
private String parentId;
private String status;
private Date createTime;
private Date updateTime;
private String userName;
private String avatar;
private String authorAvatar;
public Reply() {
}
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
public String getContent() {
return this.content;
}
public void setContent(String content) {
this.content = content;
}
public Long getPostId() {
return this.postId;
}
public void setPostId(Long postId) {
this.postId = postId;
}
public Long getUserId() {
return this.userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getParentId() {
return this.parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public String getStatus() {
return this.status;
}
public void setStatus(String status) {
this.status = status;
}
public Date getCreateTime() {
return this.createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return this.updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getUserName() {
return this.userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getAuthorAvatar() {
return this.authorAvatar;
}
public void setAuthorAvatar(String authorAvatar) {
this.authorAvatar = authorAvatar;
}
public String getAvatar() {
return this.avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
}

View File

@ -0,0 +1,84 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.entity;
public class User {
private Integer UserId;
private String Phone;
private String UserName;
private String PassWord;
private String IdCard;
private String DriverLicense;
private String code;
private String avatar;
public User() {
}
public String getAvatar() {
return this.avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
public String getCode() {
return this.code;
}
public void setCode(String code) {
this.code = code;
}
public String getUserId() {
return String.valueOf(this.UserId);
}
public void setUserId(Integer userId) {
this.UserId = userId;
}
public String getPhone() {
return this.Phone;
}
public void setPhone(String phone) {
this.Phone = phone;
}
public String getUserName() {
return this.UserName;
}
public void setUserName(String userName) {
this.UserName = userName;
}
public String getPassWord() {
return this.PassWord;
}
public void setPassWord(String passWord) {
this.PassWord = passWord;
}
public String getIdCard() {
return this.IdCard;
}
public void setIdCard(String idCard) {
this.IdCard = idCard;
}
public String getDriverLicense() {
return this.DriverLicense;
}
public void setDriverLicense(String driverLicense) {
this.DriverLicense = driverLicense;
}
}

View File

@ -0,0 +1,16 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.mapper;
import com.luozhihui.project.entity.Admin;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
public interface AdminLoginMapper {
@Select({"select * from `admin` where `AdminUser`=#{AdminUser}"})
List<Admin> findByPhone(@Param("AdminUser") String AdminUser);
}

View File

@ -0,0 +1,42 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.mapper;
import com.luozhihui.project.entity.Brand;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.transaction.annotation.Transactional;
public interface BrandMapper {
@Select({"select * from `brand` LIMIT #{pageNum}, #{pageSize}"})
List<Brand> FindAllBrandpage(@Param("pageNum") int pageNum, @Param("pageSize") int pageSize);
@Select({"select * from `brand` "})
List<Brand> FindAllBrand();
@Select({"select * from `brand` where `id`=#{id}"})
List<Brand> FindBrandById(String Id);
@Insert({"insert into `brand`(`brand_name_ch`,`brand_name_en`,`brand_logo`,`status`) VALUES(#{brand_name_ch},#{brand_name_en},#{brand_logo},#{status})"})
@Transactional
void addBrand(Brand brand);
@Delete({"delete from `brand` where `id`=#{id}"})
boolean DeleteBrandById(String Id);
@Select({"select * from `brand` where `id`=#{id}"})
Brand BrandId(Integer Id);
@Update({"UPDATE brand SET brand_name_ch = #{brand_name_ch}, brand_name_en = #{brand_name_en}, brand_logo = #{brand_logo}, status = #{status} where `id`=#{id}"})
void update(Brand brand);
@Select({" SELECT COUNT(*) FROM `brand` "})
int countBrand();
}

View File

@ -0,0 +1,30 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.mapper;
import com.luozhihui.project.entity.Order;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.transaction.annotation.Transactional;
public interface CarRentMapper {
@Insert({"insert into `order`(`UserId`,`CarId`,`OrderMoney`,`OutPicture`,`OutTime`,`Mode`,`OrderStatus`,`modeId`,`parking_id`) VALUES (#{UserId},#{CarId},#{OrderMoney},#{OutPicture},NOW(),#{Mode},#{OrderStatus},#{modeId},#{parking_id})"})
@Transactional
void addorder(Order order);
@Update({"update `car` set `CarStatus` = 1 where `CarId` = #{CarId}"})
void updateCarStatus(Integer carId);
@Update({"update `order` SET `OrderMoney`=#{OrderMoney},`InPicture`=#{InPicture},`InTime`=NOW() WHERE `OrderId` = #{OrderId} "})
void carRented(Order order);
@Update({"update `order` set `OrderStatus` = 1 where `OrderId` = #{OrderId}"})
void finishOrder(String orderId);
@Update({"update `car` set `CarStatus` = 0, `parking_id` = #{parking_id} where `CarId` = #{carId}"})
void endCarStatus(@Param("carId") String carId, @Param("parking_id") String parkingId);
}

View File

@ -0,0 +1,38 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.mapper;
import com.luozhihui.project.entity.Car;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.transaction.annotation.Transactional;
public interface CarShowMapper {
@Select({"select car.*,`parking`.parkingName,`parking`.parkingName from `car` JOIN `parking` ON `car`.parking_id=`parking`.id"})
List<Car> FindAllCar();
@Select({"select * from `car` where `CarId`=#{CarId}"})
List<Car> FindCarById(String CarId);
@Insert({"insert into `car`(`CarContent`,`CarStatus`,`CarPhoto`,`parking_id`,`CarNumber`) VALUES(#{CarContent},#{CarStatus},#{CarPhoto},#{parking_id},#{CarNumber})"})
@Transactional
void addCar(Car car);
@Delete({"delete from `car` where `CarId`=#{CarId}"})
boolean DeleteCarById(String CarId);
@Select({"select * from `car` where `CarId`=#{CarId}"})
Car CarId(Integer CarId);
@Update({"UPDATE car SET CarContent = #{CarContent}, CarStatus = #{CarStatus}, CarPhoto = #{CarPhoto}, parking_id = #{parking_id}, CarNumber = #{CarNumber} where CarId = #{CarId}"})
void update(Car car);
@Select({"SELECT `car`.* FROM `car` WHERE parking_id=#{parking_id}"})
List<Car> findCarsByParkingId(Integer parking_id);
}

View File

@ -0,0 +1,40 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.mapper;
import com.luozhihui.project.entity.Category;
import java.util.List;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
@Mapper
public interface CategoryMapper {
@Select({"SELECT * FROM category WHERE status = 1 ORDER BY sort ASC"})
List<Category> findAllCategories();
@Select({"SELECT * FROM category WHERE id = #{id}"})
Category findById(@Param("id") Long id);
@Insert({"INSERT INTO category (name, description, sort, status, createTime, updateTime) VALUES (#{name}, #{description}, #{sort}, #{status}, NOW(), NOW())"})
@Options(
useGeneratedKeys = true,
keyProperty = "id"
)
int insert(Category category);
@Update({"UPDATE category SET name = #{name}, description = #{description}, sort = #{sort}, status = #{status}, updateTime = NOW() WHERE id = #{id}"})
int update(Category category);
@Update({"UPDATE category SET status = 0, updateTime = NOW() WHERE id = #{id}"})
int deleteById(@Param("id") Long id);
@Select({"SELECT COUNT(*) FROM category WHERE name = #{name} AND status = 1"})
int checkNameExists(@Param("name") String name);
}

View File

@ -0,0 +1,21 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.luozhihui.project.mapper;
import com.luozhihui.project.entity.Comment;
import java.util.List;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.transaction.annotation.Transactional;
public interface CommentMapper {
@Insert({"insert into `comments`(`UserName`,`text`,`CarId`,`UserId`,`pub_date`,`parking_id`) VALUES(#{UserName},#{text},#{CarId},#{UserId},NOW(),#{parking_id})"})
@Transactional
void save(Comment comment);
@Select({"SELECT comments.CommentId,comments.text,comments.pub_date,car.CarContent,car.CarNumber,user.UserName FROM `comments` JOIN `user` ON `user`.UserId = `comments`.UserId JOIN `car` ON `car`.CarId = `comments`.CarId JOIN `parking` ON `car`.CarId = `comments`.CarId"})
List<Comment> FindAllComment();
}

Some files were not shown because too many files have changed in this diff Show More