diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8ab5285 --- /dev/null +++ b/.gitignore @@ -0,0 +1,34 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..76e7e84 --- /dev/null +++ b/pom.xml @@ -0,0 +1,89 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.3.4.RELEASE + + + com.qsd + orangecar + 1.0 + orange_car + 橘子汽车出租系统 + + + 1.8 + + + + + + org.springframework.boot + spring-boot-starter-jdbc + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-devtools + + + + + mysql + mysql-connector-java + + + com.baomidou + mybatis-plus-boot-starter + 3.4.0 + + + + org.hibernate.validator + hibernate-validator + + + + cn.hutool + hutool-all + 5.4.2 + + + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/src/main/java/com/qsd/orange/Application.java b/src/main/java/com/qsd/orange/Application.java new file mode 100644 index 0000000..29bd7f2 --- /dev/null +++ b/src/main/java/com/qsd/orange/Application.java @@ -0,0 +1,15 @@ +package com.qsd.orange; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +@SpringBootApplication +@EnableTransactionManagement +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/src/main/java/com/qsd/orange/config/SpringSecurityConfig.java b/src/main/java/com/qsd/orange/config/SpringSecurityConfig.java new file mode 100644 index 0000000..2bfb0de --- /dev/null +++ b/src/main/java/com/qsd/orange/config/SpringSecurityConfig.java @@ -0,0 +1,82 @@ +package com.qsd.orange.config; + +import com.qsd.orange.security.AccessFailureHandler; +import com.qsd.orange.security.LoginFailureHandler; +import com.qsd.orange.security.LoginSuccessHandler; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Bean; +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; + +@EnableWebSecurity +@EnableGlobalMethodSecurity(prePostEnabled = true) +public class SpringSecurityConfig extends WebSecurityConfigurerAdapter { + + @Autowired + @Qualifier("userDetailsServiceImpl") + private UserDetailsService userDetailsService; + @Autowired + private LoginSuccessHandler loginSuccessHandler; + @Autowired + private LoginFailureHandler loginFailureHandler; + @Autowired + private AccessFailureHandler accessFailureHandler; + @Autowired + private BCryptPasswordEncoder passwordEncoder; + + //授权规则 + @Override + protected void configure(HttpSecurity http) throws Exception { + //拦截规则 + http.authorizeRequests() + .antMatchers("/user/login").permitAll() + .antMatchers("/login.html").permitAll() + .antMatchers("/image/**").permitAll() + .antMatchers("/system/**").hasRole("1") + .antMatchers("/statistics/**").hasRole("1") + .anyRequest().authenticated(); + + //登录配置 + http.formLogin() + .loginPage("/login.html") + .loginProcessingUrl("/user/login") + .usernameParameter("username") + .passwordParameter("password") + .successHandler(loginSuccessHandler) + .failureHandler(loginFailureHandler); + + //注销配置 + http.logout() + .logoutUrl("/user/logout") + .logoutSuccessUrl("/login.html"); + + //关闭csrf防护 + http.csrf().disable(); + + //配置iframe请求 + http.headers().frameOptions().disable(); + + //处理认证失败请求 + http.exceptionHandling().accessDeniedHandler(accessFailureHandler); + + } + + //认证配置 + @Override + protected void configure(AuthenticationManagerBuilder auth) throws Exception { + auth.userDetailsService(userDetailsService) + .passwordEncoder(passwordEncoder); + } + + @Bean + public BCryptPasswordEncoder passwordEncoder(){ + return new BCryptPasswordEncoder(); + } + +} diff --git a/src/main/java/com/qsd/orange/config/WebConfig.java b/src/main/java/com/qsd/orange/config/WebConfig.java new file mode 100644 index 0000000..8280028 --- /dev/null +++ b/src/main/java/com/qsd/orange/config/WebConfig.java @@ -0,0 +1,9 @@ +package com.qsd.orange.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +@Configuration +public class WebConfig implements WebMvcConfigurer { + +} diff --git a/src/main/java/com/qsd/orange/controller/AnnouncementController.java b/src/main/java/com/qsd/orange/controller/AnnouncementController.java new file mode 100644 index 0000000..28be7d7 --- /dev/null +++ b/src/main/java/com/qsd/orange/controller/AnnouncementController.java @@ -0,0 +1,26 @@ +package com.qsd.orange.controller; + +import com.qsd.orange.service.AnnouncementService; +import com.qsd.orange.global.R; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("announcement") +public class AnnouncementController { + + @Autowired + private AnnouncementService announcementService; + + @GetMapping("all") + public R all( + @RequestParam(value = "page", required = false, defaultValue = "1") Integer page, + @RequestParam(value = "limit", required = false, defaultValue = "9") Integer limit + ){ + return R.success().page(announcementService.all(page, limit)); + } + +} diff --git a/src/main/java/com/qsd/orange/controller/CarController.java b/src/main/java/com/qsd/orange/controller/CarController.java new file mode 100644 index 0000000..dd2cd49 --- /dev/null +++ b/src/main/java/com/qsd/orange/controller/CarController.java @@ -0,0 +1,56 @@ +package com.qsd.orange.controller; + +import com.qsd.orange.po.BusCar; +import com.qsd.orange.service.CarService; +import com.qsd.orange.global.R; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.userdetails.User; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + +@RestController +@RequestMapping("car") +public class CarController { + + @Autowired + private CarService carService; + + @GetMapping("all") + public R all( + @RequestParam(value = "page", required = false, defaultValue = "1") Integer page, + @RequestParam(value = "limit", required = false, defaultValue = "9") Integer limit, + @RequestParam(value = "status", required = false, defaultValue = "-1")Integer status + ){ + return R.success().page(carService.queryAllCar(page, limit, status)); + } + + @GetMapping("search") + public R search( + @RequestParam(value = "page", required = false, defaultValue = "1") Integer page, + @RequestParam(value = "limit", required = false, defaultValue = "9") Integer limit, + @RequestParam(value = "status", required = false, defaultValue = "-1") Integer status, + @RequestParam(value = "brand", required = false, defaultValue = "") String brand, + @RequestParam(value = "color", required = false, defaultValue = "") String color + ){ + return R.success().page(carService.queryCar(page, limit, status, brand, color)); + } + + @GetMapping("search/number") + public R number( + @RequestParam(value = "page", required = false, defaultValue = "1") Integer page, + @RequestParam(value = "limit", required = false, defaultValue = "9") Integer limit, + @RequestParam(value = "number", required = false, defaultValue = "") String number + ){ + return R.success().page(carService.queryCarByNumber(page, limit, number)); + } + + @PostMapping("add") + public R add(@Valid BusCar car, Authentication authentication){ + User users = (User)authentication.getPrincipal(); + String username = users.getUsername(); + return R.choose(carService.add(username, car) > 0); + } + +} diff --git a/src/main/java/com/qsd/orange/controller/CheckController.java b/src/main/java/com/qsd/orange/controller/CheckController.java new file mode 100644 index 0000000..e4a9eda --- /dev/null +++ b/src/main/java/com/qsd/orange/controller/CheckController.java @@ -0,0 +1,32 @@ +package com.qsd.orange.controller; + +import com.qsd.orange.service.CheckService; +import com.qsd.orange.global.R; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.userdetails.User; +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("check") +public class CheckController { + + @Autowired + private CheckService checkService; + + @PostMapping("add") + public R add( + String id, + @RequestParam(value = "problem", required = false, defaultValue = "无") String problem, + @RequestParam(value = "compensate", required = false, defaultValue = "0") Double compensate, + @RequestParam(value = "description", required = false, defaultValue = "无") String description, + Authentication authentication + ){ + User users = (User)authentication.getPrincipal(); + return R.choose(checkService.add(id, problem, compensate, description, users.getUsername()) > 0); + } + +} diff --git a/src/main/java/com/qsd/orange/controller/CustomerController.java b/src/main/java/com/qsd/orange/controller/CustomerController.java new file mode 100644 index 0000000..0907879 --- /dev/null +++ b/src/main/java/com/qsd/orange/controller/CustomerController.java @@ -0,0 +1,63 @@ +package com.qsd.orange.controller; + +import com.qsd.orange.po.BusCustomer; +import com.qsd.orange.service.CustomerService; +import com.qsd.orange.global.R; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.userdetails.User; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + +@RestController +@RequestMapping("customer") +public class CustomerController { + + @Autowired + private CustomerService customerService; + + @GetMapping("all") + public R all( + @RequestParam(value = "page", required = false, defaultValue = "1") Integer page, + @RequestParam(value = "limit", required = false, defaultValue = "9") Integer limit + ){ + return R.success().page(customerService.queryCustomers(page, limit)); + } + + @GetMapping("search/identity") + public R searchByIdentity( + @RequestParam(value = "page", required = false, defaultValue = "1") Integer page, + @RequestParam(value = "limit", required = false, defaultValue = "9") Integer limit, + String keyword + ){ + return R.success().page(customerService.queryByCustomer(page, limit, "identity", keyword)); + } + + @GetMapping("search/name") + public R searchByName( + @RequestParam(value = "page", required = false, defaultValue = "1") Integer page, + @RequestParam(value = "limit", required = false, defaultValue = "9") Integer limit, + String keyword + ){ + return R.success().page(customerService.queryByCustomer(page, limit, "name", keyword)); + } + + @GetMapping("search/one/identity") + public R searchOneIdentity(String identity){ + return R.success().data("item", customerService.queryOne(identity)); + } + + @PostMapping("add") + public R add(@Valid BusCustomer customer, Authentication authentication){ + User user = (User)authentication.getPrincipal(); + String username = user.getUsername(); + return R.choose(customerService.addCustomer(username, customer) > 0); + } + + @PostMapping("update") + public R update(@Valid BusCustomer customer){ + return R.choose(customerService.updateCustomer(customer) > 0); + } + +} diff --git a/src/main/java/com/qsd/orange/controller/RentController.java b/src/main/java/com/qsd/orange/controller/RentController.java new file mode 100644 index 0000000..d68a456 --- /dev/null +++ b/src/main/java/com/qsd/orange/controller/RentController.java @@ -0,0 +1,97 @@ +package com.qsd.orange.controller; + +import com.qsd.orange.global.HttpResult; +import com.qsd.orange.global.R; +import com.qsd.orange.service.RentService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.userdetails.User; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; +@RestController +@RequestMapping("rent") +public class RentController { + + @Autowired + private RentService rentService; + + @PostMapping("add") + public R add(String identity, String number, String returnTime, Authentication authentication){ + User users = (User)authentication.getPrincipal(); + String username = users.getUsername(); + int add = rentService.add(identity, number, returnTime, username); + switch (add){ + case -1: + return R.error(HttpResult.CAR_IS_RENTING); + case 0: + return R.error(HttpResult.USER_INFO_ERROR); + case 1: + return R.success(); + default: + return R.error(HttpResult.SERVER_ERROR); + } + } + + @GetMapping("all") + public R all( + @RequestParam(value = "page", required = false, defaultValue = "1") Integer page, + @RequestParam(value = "limit", required = false, defaultValue = "9") Integer limit + ){ + return R.success().page(rentService.all(page, limit)); + } + + @GetMapping("search") + public R search( + @RequestParam(value = "page", required = false, defaultValue = "1") Integer page, + @RequestParam(value = "limit", required = false, defaultValue = "9") Integer limit, + String keyword, + Integer type + ){ + switch (type){ + case 0: + return R.success().page(rentService.search(page, limit, "id", keyword)); + case 1: + return R.success().page(rentService.search(page, limit, "customer_identity", keyword)); + case 2: + return R.success().page(rentService.search(page, limit, "car_number", keyword)); + default: + return R.error(HttpResult.PARAM_ERROR); + } + } + + @PostMapping("update/returnTime") + public R update(String id, String returnTime){ + int i = rentService.updateReturnTime(id, returnTime); + switch (i){ + case -3: + return R.error(HttpResult.PARAM_ERROR); + case -2: + case -1: + return R.error(HttpResult.DATE_ERROR); + case 0: + return R.error(HttpResult.NOT_FOUND); + case 1: + return R.success(); + default: + return R.error(HttpResult.SERVER_ERROR); + } + } + + @GetMapping("info") + public R info(String id){ + Map info = rentService.info(id); + int status = (Integer) info.get("status"); + info.remove("status"); + switch (status){ + case -1: + return R.error(HttpResult.CAR_IS_RETURN); + case 0: + return R.error(HttpResult.NOT_FOUND); + default: + return R.success().data(info); + } + + } + +} diff --git a/src/main/java/com/qsd/orange/controller/RouteController.java b/src/main/java/com/qsd/orange/controller/RouteController.java new file mode 100644 index 0000000..dcff47f --- /dev/null +++ b/src/main/java/com/qsd/orange/controller/RouteController.java @@ -0,0 +1,35 @@ +package com.qsd.orange.controller; + +import com.qsd.orange.po.SysUser; +import com.qsd.orange.service.UserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.userdetails.User; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; + +@Controller +public class RouteController { + + @Autowired + private UserService userService; + + @GetMapping("") + public String index(Model model, Authentication authentication){ + User users = (User)authentication.getPrincipal(); + SysUser user = userService.getInfo(users.getUsername()); + model.addAttribute("name", user.getName()); + model.addAttribute("type", user.getType()); + return "index"; + } + + @GetMapping("self") + public String self(Model model, Authentication authentication){ + User users = (User)authentication.getPrincipal(); + SysUser user = userService.getInfo(users.getUsername()); + model.addAttribute("user", user); + return "self"; + } + +} diff --git a/src/main/java/com/qsd/orange/controller/StatisticsController.java b/src/main/java/com/qsd/orange/controller/StatisticsController.java new file mode 100644 index 0000000..3d1878d --- /dev/null +++ b/src/main/java/com/qsd/orange/controller/StatisticsController.java @@ -0,0 +1,32 @@ +package com.qsd.orange.controller; + +import com.qsd.orange.dao.StatisticsDao; +import com.qsd.orange.global.R; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("statistics") +public class StatisticsController { + + @Autowired + private StatisticsDao statisticsDao; + + @GetMapping("region") + public R region(){ + return R.success().data("items", statisticsDao.getRegionVo()); + } + + @GetMapping("salesman/{year}") + public R salesman(@PathVariable("year") String year){ + return R.success().data("items", statisticsDao.getSalesman(year)); + } + @GetMapping("company/{year}") + public R company(@PathVariable("year") String year){ + return R.success().data("items", statisticsDao.getCompany(year)); + } + +} diff --git a/src/main/java/com/qsd/orange/controller/SystemAnnouncementController.java b/src/main/java/com/qsd/orange/controller/SystemAnnouncementController.java new file mode 100644 index 0000000..ec3f0e0 --- /dev/null +++ b/src/main/java/com/qsd/orange/controller/SystemAnnouncementController.java @@ -0,0 +1,34 @@ +package com.qsd.orange.controller; + +import com.qsd.orange.global.R; +import com.qsd.orange.po.SysAnnouncement; +import com.qsd.orange.service.AnnouncementService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.userdetails.User; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.Valid; + +@RestController +@RequestMapping("system/announcement") +public class SystemAnnouncementController { + + @Autowired + private AnnouncementService announcementService; + + @PostMapping("add") + public R add(@Valid SysAnnouncement announcement, Authentication authentication){ + User user = (User)authentication.getPrincipal(); + String username = user.getUsername(); + return R.choose(announcementService.add(announcement, username) > 0); + } + + @PostMapping("update") + public R update(SysAnnouncement announcement){ + return R.choose(announcementService.update(announcement) > 0); + } + +} diff --git a/src/main/java/com/qsd/orange/controller/SystemCarController.java b/src/main/java/com/qsd/orange/controller/SystemCarController.java new file mode 100644 index 0000000..a2eb1e7 --- /dev/null +++ b/src/main/java/com/qsd/orange/controller/SystemCarController.java @@ -0,0 +1,62 @@ +package com.qsd.orange.controller; + +import com.qsd.orange.global.R; +import com.qsd.orange.po.BusCar; +import com.qsd.orange.service.CarService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.userdetails.User; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + +@RestController +@RequestMapping("system/car") +public class SystemCarController { + + @Autowired + private CarService carService; + + @GetMapping("all") + public R all( + @RequestParam(value = "page", required = false, defaultValue = "1") Integer page, + @RequestParam(value = "limit", required = false, defaultValue = "9") Integer limit, + @RequestParam(value = "status", required = false, defaultValue = "-1")Integer status + ){ + return R.success().page(carService.queryAllCarSys(page, limit, status)); + } + + @GetMapping("search") + public R search( + @RequestParam(value = "page", required = false, defaultValue = "1") Integer page, + @RequestParam(value = "limit", required = false, defaultValue = "9") Integer limit, + @RequestParam(value = "status", required = false, defaultValue = "-1") Integer status, + @RequestParam(value = "brand", required = false, defaultValue = "") String brand, + @RequestParam(value = "color", required = false, defaultValue = "") String color + ){ + return R.success().page(carService.queryCarSys(page, limit, status, brand, color)); + } + + @PostMapping("add") + public R add(@Valid BusCar car, Authentication authentication){ + User users = (User)authentication.getPrincipal(); + String username = users.getUsername(); + return R.choose(carService.add(username, car) > 0); + } + + @PostMapping("update/all") + public R add(@Valid BusCar car){ + return R.choose(carService.update(car) > 0); + } + + @PostMapping("update/exist/enable") + public R enable(String number){ + return R.choose(carService.updateExist(number, 1) > 0); + } + + @PostMapping("update/exist/unable") + public R unable(String number){ + return R.choose(carService.updateExist(number, 0) > 0); + } + +} diff --git a/src/main/java/com/qsd/orange/controller/SystemCheckController.java b/src/main/java/com/qsd/orange/controller/SystemCheckController.java new file mode 100644 index 0000000..f8a212c --- /dev/null +++ b/src/main/java/com/qsd/orange/controller/SystemCheckController.java @@ -0,0 +1,31 @@ +package com.qsd.orange.controller; + +import com.qsd.orange.global.R; +import com.qsd.orange.service.CheckService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("system/check") +public class SystemCheckController { + + @Autowired + private CheckService checkService; + + @GetMapping("all") + public R all( + @RequestParam(value = "page", required = false, defaultValue = "1") Integer page, + @RequestParam(value = "limit", required = false, defaultValue = "9") Integer limit + ){ + return R.success().page(checkService.all(page, limit)); + } + + @GetMapping("search") + public R search(String id){ + return R.success().data("item", checkService.search(id)); + } + +} diff --git a/src/main/java/com/qsd/orange/controller/SystemRentController.java b/src/main/java/com/qsd/orange/controller/SystemRentController.java new file mode 100644 index 0000000..d9a7869 --- /dev/null +++ b/src/main/java/com/qsd/orange/controller/SystemRentController.java @@ -0,0 +1,49 @@ +package com.qsd.orange.controller; + +import com.qsd.orange.global.HttpResult; +import com.qsd.orange.global.R; +import com.qsd.orange.service.RentService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + + +@RestController +@RequestMapping("system/rent") +public class SystemRentController { + + @Autowired + private RentService rentService; + + @GetMapping("all") + public R all( + @RequestParam(value = "page", required = false, defaultValue = "1") Integer page, + @RequestParam(value = "limit", required = false, defaultValue = "9") Integer limit + ){ + return R.success().page(rentService.sysAll(page, limit)); + } + + @GetMapping("search") + public R search( + @RequestParam(value = "page", required = false, defaultValue = "1") Integer page, + @RequestParam(value = "limit", required = false, defaultValue = "9") Integer limit, + Integer status, + String keyword, + Integer type + ){ + switch (type){ + case 0: + return R.success().page(rentService.sysSearch(page, limit, status, "id", keyword)); + case 1: + return R.success().page(rentService.sysSearch(page, limit, status, "customer_identity", keyword)); + case 2: + return R.success().page(rentService.sysSearch(page, limit, status, "car_number", keyword)); + default: + return R.error(HttpResult.PARAM_ERROR); + } + } + + +} diff --git a/src/main/java/com/qsd/orange/controller/SystemResourceController.java b/src/main/java/com/qsd/orange/controller/SystemResourceController.java new file mode 100644 index 0000000..bf9ce74 --- /dev/null +++ b/src/main/java/com/qsd/orange/controller/SystemResourceController.java @@ -0,0 +1,67 @@ +package com.qsd.orange.controller; + +import cn.hutool.core.io.IoUtil; +import cn.hutool.core.io.file.FileWriter; +import cn.hutool.system.SystemUtil; +import com.qsd.orange.global.R; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.*; + +@RestController +@RequestMapping("system/resource/image") +public class SystemResourceController { + + public static final String IMAGE_PATH = SystemUtil.get("user.dir"); + + @PostMapping + public R updateImage(MultipartFile file){ + String temp = file.getName(); + System.out.println(temp); + temp = "png"; + String name = System.currentTimeMillis() + "." + temp; + BufferedOutputStream outputStream = null; + try(InputStream inputStream = file.getInputStream();) { + File f = new File(IMAGE_PATH, name); + if (!f.exists()){ + f.createNewFile(); + } + FileWriter fileWriter = new FileWriter(f); + outputStream = fileWriter.getOutputStream(); + IoUtil.copy(inputStream, outputStream); + } catch (IOException e) { + e.printStackTrace(); + return R.error(); + }finally { + try { + outputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return R.success().data("image", name); + } + + @GetMapping("{name}") + public void show(@PathVariable("name") String name, HttpServletResponse response) { + FileInputStream inputStream = null; + try { + inputStream = new FileInputStream(new File(IMAGE_PATH, name)); + response.setContentType("image/png"); + IoUtil.copy(inputStream, response.getOutputStream()); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + inputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + +} diff --git a/src/main/java/com/qsd/orange/controller/SystemUserController.java b/src/main/java/com/qsd/orange/controller/SystemUserController.java new file mode 100644 index 0000000..724c237 --- /dev/null +++ b/src/main/java/com/qsd/orange/controller/SystemUserController.java @@ -0,0 +1,41 @@ +package com.qsd.orange.controller; + +import com.qsd.orange.global.R; +import com.qsd.orange.po.SysUser; +import com.qsd.orange.service.UserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.Valid; + +@RestController +@RequestMapping("system/user") +public class SystemUserController { + + @Autowired + private UserService userService; + + @GetMapping("all") + public R all(){ + return R.success().data("items", userService.all()); + } + + @PostMapping("add") + public R add(@Valid SysUser user){ + return R.choose(userService.add(user) > 0); + } + + @PostMapping("update") + public R update(@Valid SysUser user){ + return R.choose(userService.update(user) > 0); + } + + @GetMapping("reset") + public R reset(String username){ + return R.choose(userService.reset(username) > 0); + } + +} diff --git a/src/main/java/com/qsd/orange/controller/UserController.java b/src/main/java/com/qsd/orange/controller/UserController.java new file mode 100644 index 0000000..f3de192 --- /dev/null +++ b/src/main/java/com/qsd/orange/controller/UserController.java @@ -0,0 +1,54 @@ +package com.qsd.orange.controller; + +import com.qsd.orange.global.HttpResult; +import com.qsd.orange.global.R; +import com.qsd.orange.po.SysUser; +import com.qsd.orange.service.UserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.userdetails.User; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("user") +public class UserController { + + @Autowired + private UserService userService; + + @PostMapping("info") + public R info(Authentication authentication){ + User users = (User)authentication.getPrincipal(); + String username = users.getUsername(); + SysUser info = userService.getInfo(username); + return R.success().data("item", info); + } + + @PostMapping("update/info") + public R updateInfo(SysUser user, Authentication authentication){ + User users = (User)authentication.getPrincipal(); + String username = users.getUsername(); + user.setUsername(username); + return R.choose(userService.update(user) > 0); + } + + @PostMapping("update/password") + public R updatePassword(String oldPassword, String newPassword, Authentication authentication){ + User users = (User)authentication.getPrincipal(); + String username = users.getUsername(); + int i = userService.updatePassword(username, oldPassword, newPassword); + switch (i){ + case -2: + return R.error(HttpResult.USERNAME_OR_PASSWORD_ERROR); + case -1: + return R.error(HttpResult.PASSWORD_NOT_SAME); + case 1: + return R.success(); + default: + return R.error(); + } + } + +} diff --git a/src/main/java/com/qsd/orange/dao/AnnouncementDao.java b/src/main/java/com/qsd/orange/dao/AnnouncementDao.java new file mode 100644 index 0000000..5727b68 --- /dev/null +++ b/src/main/java/com/qsd/orange/dao/AnnouncementDao.java @@ -0,0 +1,9 @@ +package com.qsd.orange.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.qsd.orange.po.SysAnnouncement; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface AnnouncementDao extends BaseMapper { +} diff --git a/src/main/java/com/qsd/orange/dao/CarDao.java b/src/main/java/com/qsd/orange/dao/CarDao.java new file mode 100644 index 0000000..134a554 --- /dev/null +++ b/src/main/java/com/qsd/orange/dao/CarDao.java @@ -0,0 +1,10 @@ +package com.qsd.orange.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.qsd.orange.po.BusCar; +import org.apache.ibatis.annotations.Mapper; + + +@Mapper +public interface CarDao extends BaseMapper { +} diff --git a/src/main/java/com/qsd/orange/dao/CheckDao.java b/src/main/java/com/qsd/orange/dao/CheckDao.java new file mode 100644 index 0000000..9991f8d --- /dev/null +++ b/src/main/java/com/qsd/orange/dao/CheckDao.java @@ -0,0 +1,9 @@ +package com.qsd.orange.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.qsd.orange.po.BusCheck; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface CheckDao extends BaseMapper { +} diff --git a/src/main/java/com/qsd/orange/dao/CustomerDao.java b/src/main/java/com/qsd/orange/dao/CustomerDao.java new file mode 100644 index 0000000..07d53de --- /dev/null +++ b/src/main/java/com/qsd/orange/dao/CustomerDao.java @@ -0,0 +1,9 @@ +package com.qsd.orange.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.qsd.orange.po.BusCustomer; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface CustomerDao extends BaseMapper { +} diff --git a/src/main/java/com/qsd/orange/dao/RentDao.java b/src/main/java/com/qsd/orange/dao/RentDao.java new file mode 100644 index 0000000..501f7e2 --- /dev/null +++ b/src/main/java/com/qsd/orange/dao/RentDao.java @@ -0,0 +1,13 @@ +package com.qsd.orange.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.qsd.orange.po.BusRent; +import org.apache.ibatis.annotations.Mapper; + + +@Mapper +public interface RentDao extends BaseMapper { + + String selectCarNumber(String id); + +} diff --git a/src/main/java/com/qsd/orange/dao/StatisticsDao.java b/src/main/java/com/qsd/orange/dao/StatisticsDao.java new file mode 100644 index 0000000..5652e02 --- /dev/null +++ b/src/main/java/com/qsd/orange/dao/StatisticsDao.java @@ -0,0 +1,23 @@ +package com.qsd.orange.dao; + +import com.qsd.orange.vo.StatisticsVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface StatisticsDao { + + /** + * 获取地区统计 + * */ + List getRegionVo(); + /** + * 业务员年度销售额 + * @param year 年份 + * */ + List getSalesman(@Param("year") String year); + + List getCompany(@Param("year") String year); +} diff --git a/src/main/java/com/qsd/orange/dao/UserDao.java b/src/main/java/com/qsd/orange/dao/UserDao.java new file mode 100644 index 0000000..5ab92f8 --- /dev/null +++ b/src/main/java/com/qsd/orange/dao/UserDao.java @@ -0,0 +1,13 @@ +package com.qsd.orange.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.qsd.orange.po.SysUser; +import org.apache.ibatis.annotations.Mapper; + + +@Mapper +public interface UserDao extends BaseMapper { + + SysUser selectOneById(String username); + +} diff --git a/src/main/java/com/qsd/orange/exception/LoginException.java b/src/main/java/com/qsd/orange/exception/LoginException.java new file mode 100644 index 0000000..c4cc36d --- /dev/null +++ b/src/main/java/com/qsd/orange/exception/LoginException.java @@ -0,0 +1,18 @@ +package com.qsd.orange.exception; + +import com.qsd.orange.global.HttpResult; +import com.qsd.orange.global.R; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; + + +@ControllerAdvice +public class LoginException { + + @ExceptionHandler(UsernameNotFoundException.class) + public R usernameNotFoundException(){ + return R.error(HttpResult.USERNAME_OR_PASSWORD_ERROR); + } + +} diff --git a/src/main/java/com/qsd/orange/exception/ParamException.java b/src/main/java/com/qsd/orange/exception/ParamException.java new file mode 100644 index 0000000..863ad59 --- /dev/null +++ b/src/main/java/com/qsd/orange/exception/ParamException.java @@ -0,0 +1,17 @@ +package com.qsd.orange.exception; + +import com.qsd.orange.global.HttpResult; +import com.qsd.orange.global.R; +import org.springframework.web.bind.MissingServletRequestParameterException; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestControllerAdvice; + +@RestControllerAdvice +public class ParamException { + + @ExceptionHandler(MissingServletRequestParameterException.class) + public R missingServletRequestParameterException(MissingServletRequestParameterException e){ + return R.error(HttpResult.PARAM_LACK); + } + +} diff --git a/src/main/java/com/qsd/orange/exception/ValidationException.java b/src/main/java/com/qsd/orange/exception/ValidationException.java new file mode 100644 index 0000000..df9f14b --- /dev/null +++ b/src/main/java/com/qsd/orange/exception/ValidationException.java @@ -0,0 +1,24 @@ +package com.qsd.orange.exception; + +import com.qsd.orange.global.HttpResult; +import com.qsd.orange.global.R; +import org.springframework.validation.BindException; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestControllerAdvice; + +import javax.validation.UnexpectedTypeException; + +@RestControllerAdvice +public class ValidationException { + + @ExceptionHandler({ + MethodArgumentNotValidException.class, + BindException.class, + UnexpectedTypeException.class + }) + public R validation(){ + return R.error(HttpResult.PARAM_ERROR); + } + +} diff --git a/src/main/java/com/qsd/orange/global/HttpResult.java b/src/main/java/com/qsd/orange/global/HttpResult.java new file mode 100644 index 0000000..beea782 --- /dev/null +++ b/src/main/java/com/qsd/orange/global/HttpResult.java @@ -0,0 +1,41 @@ +package com.qsd.orange.global; + +public enum HttpResult { + + SUCCESS(200, "成功"), + UN_AUTHORIZED(403, "权限错误"), + NOT_FOUND(404, "资源未找到"), + SERVER_ERROR(500, "服务器错误"), + USERNAME_OR_PASSWORD_ERROR(501, "用户名或密码错误"), + CAR_IS_RENTING(502, "车辆已被出租"), + USER_INFO_ERROR(503, "用户信息错误"), + PARAM_ERROR(504, "参数错误"), + DATE_ERROR(505, "参数日期错误"), + CAR_IS_RETURN(506, "车辆已归还"), + PARAM_LACK(507, "参数缺少"), + PASSWORD_NOT_SAME(508, "新密码与旧密码不能相同"); + + private Integer code; + private String message; + + HttpResult(Integer code, String message) { + this.code = code; + this.message = message; + } + + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/src/main/java/com/qsd/orange/global/R.java b/src/main/java/com/qsd/orange/global/R.java new file mode 100644 index 0000000..cca3134 --- /dev/null +++ b/src/main/java/com/qsd/orange/global/R.java @@ -0,0 +1,113 @@ +package com.qsd.orange.global; + +import java.util.HashMap; +import java.util.Map; + +import com.baomidou.mybatisplus.core.metadata.IPage; + + +public class R { + + private Boolean success; + private Integer code; + private String message; + private Map data = new HashMap(); + + private R() { + } + + public R success(Boolean success) { + this.setSuccess(success); + return this; + } + + public R message(String message) { + this.setMessage(message); + return this; + } + + public R code(Integer code) { + this.setCode(code); + return this; + } + + public R data(String key, Object value) { + this.data.put(key, value); + return this; + } + + public R data(Map map) { + this.setData(map); + return this; + } + + public R page(IPage page) { + this.data("total", page.getTotal()).data("record", page.getRecords()); + return this; + } + + public Boolean getSuccess() { + return success; + } + + public void setSuccess(Boolean success) { + this.success = success; + } + + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public Map getData() { + return data; + } + + public void setData(Map data) { + this.data = data; + } + + public static R choose(boolean flag) { + if (flag) { + return success(); + } else { + return error(); + } + } + + public static R success() { + R r = new R(); + r.setSuccess(true); + r.setCode(200); + r.setMessage("成功"); + return r; + } + + public static R error() { + R r = new R(); + r.setSuccess(false); + r.setCode(500); + r.setMessage("失败"); + return r; + } + + public static R error(HttpResult result) { + R r = new R(); + r.setSuccess(false); + r.setCode(result.getCode()); + r.setMessage(result.getMessage()); + return r; + } + +} diff --git a/src/main/java/com/qsd/orange/po/BusCar.java b/src/main/java/com/qsd/orange/po/BusCar.java new file mode 100644 index 0000000..0b83238 --- /dev/null +++ b/src/main/java/com/qsd/orange/po/BusCar.java @@ -0,0 +1,125 @@ +package com.qsd.orange.po; + +import java.io.Serializable; +import java.sql.Timestamp; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Null; + +/** + * 汽车表 + */ +@TableName("bus_car") +public class BusCar implements Serializable { + + private static final long serialVersionUID = 7074654537514458969L; + @TableId(type = IdType.NONE) + @NotBlank + private String number; + @NotBlank + private String brand; + @NotBlank + private String color; + @TableField("buy_price") + @NotNull + private Double buyPrice; + @TableField("rent_price") + @NotNull + private Double rentPrice; + //押金 + @NotNull + private Double deposit; + //出租状态 + @Null + private Integer status; + @NotBlank + private String description; + @NotBlank + private String image; + @Null + @JsonFormat(pattern="yyyy-MM-dd HH:mm", timezone="GMT+8") + private Timestamp created; + @Null + private String operator; + @Null + private Integer exist; + public String getNumber() { + return number; + } + public void setNumber(String number) { + this.number = number; + } + public String getBrand() { + return brand; + } + public void setBrand(String brand) { + this.brand = brand; + } + public String getColor() { + return color; + } + public void setColor(String color) { + this.color = color; + } + public Double getBuyPrice() { + return buyPrice; + } + public void setBuyPrice(Double buyPrice) { + this.buyPrice = buyPrice; + } + public Double getRentPrice() { + return rentPrice; + } + public void setRentPrice(Double rentPrice) { + this.rentPrice = rentPrice; + } + public Double getDeposit() { + return deposit; + } + public void setDeposit(Double deposit) { + this.deposit = deposit; + } + public Integer getStatus() { + return status; + } + public void setStatus(Integer status) { + this.status = status; + } + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + public String getImage() { + return image; + } + public void setImage(String image) { + this.image = image; + } + public Timestamp getCreated() { + return created; + } + public void setCreated(Timestamp created) { + this.created = created; + } + public String getOperator() { + return operator; + } + public void setOperator(String operator) { + this.operator = operator; + } + public Integer getExist() { + return exist; + } + public void setExist(Integer exist) { + this.exist = exist; + } +} diff --git a/src/main/java/com/qsd/orange/po/BusCheck.java b/src/main/java/com/qsd/orange/po/BusCheck.java new file mode 100644 index 0000000..28f7d53 --- /dev/null +++ b/src/main/java/com/qsd/orange/po/BusCheck.java @@ -0,0 +1,74 @@ +package com.qsd.orange.po; + +import java.io.Serializable; +import java.sql.Timestamp; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 还车表 + */ +@TableName("bus_check") +public class BusCheck implements Serializable { + + private static final long serialVersionUID = 7083995801146703176L; + @TableId(type = IdType.NONE) + private String id; + @TableField("check_date") + @JsonFormat(pattern="yyyy-MM-dd HH:mm", timezone="GMT+8") + private Timestamp checkDate; + private String description; + private String problem; + private Double compensate; + private String operator; + @TableField("rent_id") + private String rentId; + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + public Timestamp getCheckDate() { + return checkDate; + } + public void setCheckDate(Timestamp checkDate) { + this.checkDate = checkDate; + } + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + public String getProblem() { + return problem; + } + public void setProblem(String problem) { + this.problem = problem; + } + public Double getCompensate() { + return compensate; + } + public void setCompensate(Double compensate) { + this.compensate = compensate; + } + public String getOperator() { + return operator; + } + public void setOperator(String operator) { + this.operator = operator; + } + public String getRentId() { + return rentId; + } + public void setRentId(String rentId) { + this.rentId = rentId; + } + + +} diff --git a/src/main/java/com/qsd/orange/po/BusCustomer.java b/src/main/java/com/qsd/orange/po/BusCustomer.java new file mode 100644 index 0000000..da7e488 --- /dev/null +++ b/src/main/java/com/qsd/orange/po/BusCustomer.java @@ -0,0 +1,96 @@ +package com.qsd.orange.po; + +import java.io.Serializable; +import java.sql.Timestamp; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Null; + +/** + * 客户表 + */ +@TableName("bus_customer") +public class BusCustomer implements Serializable { + + private static final long serialVersionUID = 6658064314710608402L; + @TableId(type = IdType.NONE) + @NotBlank + private String identity; + @NotBlank + private String name; + private Integer gender; + private String address; + private String phone; + private String career; + @JsonFormat(pattern="yyyy-MM-dd HH:mm", timezone="GMT+8") + @Null + private Timestamp created; + @Null + private Boolean exist; + @Null + private String operator; + + public String getIdentity() { + return identity; + } + public void setIdentity(String identity) { + this.identity = identity; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public Integer getGender() { + return gender; + } + public void setGender(Integer gender) { + this.gender = gender; + } + public String getAddress() { + return address; + } + public void setAddress(String address) { + this.address = address; + } + public String getPhone() { + return phone; + } + public void setPhone(String phone) { + this.phone = phone; + } + public String getCareer() { + return career; + } + public void setCareer(String career) { + this.career = career; + } + public Timestamp getCreated() { + return created; + } + public void setCreated(Timestamp created) { + this.created = created; + } + + public Boolean getExist() { + return exist; + } + + public void setExist(Boolean exist) { + this.exist = exist; + } + + public String getOperator() { + return operator; + } + + public void setOperator(String operator) { + this.operator = operator; + } +} diff --git a/src/main/java/com/qsd/orange/po/BusRent.java b/src/main/java/com/qsd/orange/po/BusRent.java new file mode 100644 index 0000000..0ae6601 --- /dev/null +++ b/src/main/java/com/qsd/orange/po/BusRent.java @@ -0,0 +1,102 @@ +package com.qsd.orange.po; + +import java.io.Serializable; +import java.sql.Date; +import java.sql.Timestamp; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 出租单号 + */ +@TableName("bus_rent") +public class BusRent implements Serializable { + + private static final long serialVersionUID = 6129197607180087634L; + @TableId(type = IdType.NONE) + private String id; + private Double price; + @TableField("begin_time") + @JsonFormat(pattern="yyyy-MM-dd", timezone="GMT+8") + private Date beginTime; + @TableField("return_time") + @JsonFormat(pattern="yyyy-MM-dd", timezone="GMT+8") + private Date returnTime; + @TableField("real_time") + @JsonFormat(pattern="yyyy-MM-dd HH:mm", timezone="GMT+8") + private Timestamp realTime; + @TableField("rent_status") + private Integer rentStatus; + @TableField("customer_identity") + private String customerIdentity; + @TableField("car_number") + private String carNumber; + private String operator; + private Timestamp created; + + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + public Double getPrice() { + return price; + } + public void setPrice(Double price) { + this.price = price; + } + public Date getBeginTime() { + return beginTime; + } + public void setBeginTime(Date beginTime) { + this.beginTime = beginTime; + } + public Date getReturnTime() { + return returnTime; + } + public void setReturnTime(Date returnTime) { + this.returnTime = returnTime; + } + public Timestamp getRealTime() { + return realTime; + } + public void setRealTime(Timestamp realTime) { + this.realTime = realTime; + } + public Integer getRentStatus() { + return rentStatus; + } + public void setRentStatus(Integer rentStatus) { + this.rentStatus = rentStatus; + } + public String getCustomerIdentity() { + return customerIdentity; + } + public void setCustomerIdentity(String customerIdentity) { + this.customerIdentity = customerIdentity; + } + public String getCarNumber() { + return carNumber; + } + public void setCarNumber(String carNumber) { + this.carNumber = carNumber; + } + public String getOperator() { + return operator; + } + public void setOperator(String operator) { + this.operator = operator; + } + public Timestamp getCreated() { + return created; + } + public void setCreated(Timestamp created) { + this.created = created; + } + +} diff --git a/src/main/java/com/qsd/orange/po/SysAnnouncement.java b/src/main/java/com/qsd/orange/po/SysAnnouncement.java new file mode 100644 index 0000000..16e4e40 --- /dev/null +++ b/src/main/java/com/qsd/orange/po/SysAnnouncement.java @@ -0,0 +1,64 @@ +package com.qsd.orange.po; + +import java.io.Serializable; +import java.sql.Timestamp; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Null; + +/** + * 系统通知 + */ +@TableName("sys_announcement") +public class SysAnnouncement implements Serializable { + + private static final long serialVersionUID = 4845165626198699466L; + @TableId(type = IdType.AUTO) + @Null + private Integer id; + @NotBlank + private String title; + @NotBlank + private String content; + @JsonFormat(pattern="yyyy-MM-dd HH:mm", timezone="GMT+8") + @Null + private Timestamp created; + @Null + private String operator; + public Integer getId() { + return id; + } + public void setId(Integer id) { + this.id = id; + } + public String getTitle() { + return title; + } + public void setTitle(String title) { + this.title = title; + } + public String getContent() { + return content; + } + public void setContent(String content) { + this.content = content; + } + public Timestamp getCreated() { + return created; + } + public void setCreated(Timestamp created) { + this.created = created; + } + public String getOperator() { + return operator; + } + public void setOperator(String operator) { + this.operator = operator; + } + +} diff --git a/src/main/java/com/qsd/orange/po/SysUser.java b/src/main/java/com/qsd/orange/po/SysUser.java new file mode 100644 index 0000000..e91d67e --- /dev/null +++ b/src/main/java/com/qsd/orange/po/SysUser.java @@ -0,0 +1,92 @@ +package com.qsd.orange.po; + +import java.io.Serializable; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Null; + +/** + * 用户表 + */ +@TableName("sys_user") +public class SysUser implements Serializable { + + private static final long serialVersionUID = 5546148053917409573L; + @TableId(type = IdType.NONE) + @NotBlank + private String username; + @Null + private String password; + @NotBlank + private String identity; + @NotBlank + private String name; + private Integer gender; + private String address; + private String phone; + private String position; + @Null + private Integer type; + + 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; + } + public String getIdentity() { + return identity; + } + public void setIdentity(String identity) { + this.identity = identity; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public Integer getGender() { + return gender; + } + public void setGender(Integer gender) { + this.gender = gender; + } + public String getAddress() { + return address; + } + public void setAddress(String address) { + this.address = address; + } + public String getPhone() { + return phone; + } + public void setPhone(String phone) { + this.phone = phone; + } + public String getPosition() { + return position; + } + public void setPosition(String position) { + this.position = position; + } + public Integer getType() { + return type; + } + public void setType(Integer type) { + this.type = type; + } + + + +} diff --git a/src/main/java/com/qsd/orange/security/AccessFailureHandler.java b/src/main/java/com/qsd/orange/security/AccessFailureHandler.java new file mode 100644 index 0000000..9f05d8d --- /dev/null +++ b/src/main/java/com/qsd/orange/security/AccessFailureHandler.java @@ -0,0 +1,28 @@ +package com.qsd.orange.security; + +import cn.hutool.json.JSONUtil; +import com.qsd.orange.global.HttpResult; +import com.qsd.orange.global.R; +import org.springframework.security.access.AccessDeniedException; +import org.springframework.security.web.access.AccessDeniedHandler; +import org.springframework.stereotype.Component; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * 认证失败处理器 + */ +@Component +public class AccessFailureHandler implements AccessDeniedHandler { + + @Override + public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException, ServletException { + accessDeniedException.printStackTrace(); + response.setHeader("Content-Type", "application/json;charset=utf-8"); + response.getWriter().print(JSONUtil.parseObj(R.error(HttpResult.UN_AUTHORIZED)).toJSONString(4)); + } + +} diff --git a/src/main/java/com/qsd/orange/security/LoginFailureHandler.java b/src/main/java/com/qsd/orange/security/LoginFailureHandler.java new file mode 100644 index 0000000..3ebdf84 --- /dev/null +++ b/src/main/java/com/qsd/orange/security/LoginFailureHandler.java @@ -0,0 +1,25 @@ +package com.qsd.orange.security; + +import cn.hutool.json.JSONUtil; +import com.qsd.orange.global.HttpResult; +import com.qsd.orange.global.R; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.web.authentication.AuthenticationFailureHandler; +import org.springframework.stereotype.Controller; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +@Controller +public class LoginFailureHandler implements AuthenticationFailureHandler { + + @Override + public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { + response.setCharacterEncoding("utf-8"); + response.setContentType("application/json;charset=utf-8"); + response.getWriter().print(JSONUtil.toJsonStr(R.error(HttpResult.USERNAME_OR_PASSWORD_ERROR))); + } + +} diff --git a/src/main/java/com/qsd/orange/security/LoginSuccessHandler.java b/src/main/java/com/qsd/orange/security/LoginSuccessHandler.java new file mode 100644 index 0000000..e619b11 --- /dev/null +++ b/src/main/java/com/qsd/orange/security/LoginSuccessHandler.java @@ -0,0 +1,26 @@ +package com.qsd.orange.security; + +import cn.hutool.json.JSONUtil; +import com.qsd.orange.global.R; +import org.springframework.security.core.Authentication; +import org.springframework.security.web.authentication.AuthenticationSuccessHandler; +import org.springframework.stereotype.Controller; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +@Controller +public class LoginSuccessHandler implements AuthenticationSuccessHandler { + + @Override + public void onAuthenticationSuccess(HttpServletRequest request, + HttpServletResponse response, + Authentication authentication) throws IOException, ServletException { + response.setCharacterEncoding("utf-8"); + response.setContentType("application/json;charset=utf-8"); + response.getWriter().print(JSONUtil.toJsonStr(R.success())); + } + +} diff --git a/src/main/java/com/qsd/orange/service/AnnouncementService.java b/src/main/java/com/qsd/orange/service/AnnouncementService.java new file mode 100644 index 0000000..f1e4e2b --- /dev/null +++ b/src/main/java/com/qsd/orange/service/AnnouncementService.java @@ -0,0 +1,15 @@ +package com.qsd.orange.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.qsd.orange.po.SysAnnouncement; + +public interface AnnouncementService { + + //查询全部公告 + IPage all(Integer page, Integer limit); + //新增一条公告 + int add(SysAnnouncement announcement, String username); + //更新一条公告 + int update(SysAnnouncement announcement); + +} diff --git a/src/main/java/com/qsd/orange/service/CarService.java b/src/main/java/com/qsd/orange/service/CarService.java new file mode 100644 index 0000000..c85ba95 --- /dev/null +++ b/src/main/java/com/qsd/orange/service/CarService.java @@ -0,0 +1,53 @@ +package com.qsd.orange.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.qsd.orange.po.BusCar; + +public interface CarService { + + /** + * 查询全部汽车 + * @param page 页码 + * @param limit 每页数目 + * @param status 是否出租 + * */ + IPage queryAllCar(Integer page, Integer limit, Integer status); + /** + * 查询全部汽车 + * @param page 页码 + * @param limit 每页数目 + * @param status 是否出租 + * @param brand 汽车品牌 + * @param color 汽车颜色 + * */ + IPage queryCar(Integer page, Integer limit, Integer status, String brand, String color); + /** + * 查询全部汽车 + * 管理员 + * */ + IPage queryAllCarSys(Integer page, Integer limit, Integer status); + /** + * 查询全部汽车 + * 管理员 + * */ + IPage queryCarSys(Integer page, Integer limit, Integer status, String brand, String color); + IPage queryCarByNumber(Integer page, Integer limit, String number); + /** + * 增加一个车辆信息 + * @param username 用户名 + * @param car 汽车信息 + * */ + int add(String username, BusCar car); + /** + * 修改车辆信息 + * @param car 车辆信息 + * */ + int update(BusCar car); + /** + * 修改车辆状态,是否启用/报废 + * @param number 车牌号 + * @param exist 状态 + * */ + int updateExist(String number, Integer exist); + +} diff --git a/src/main/java/com/qsd/orange/service/CheckService.java b/src/main/java/com/qsd/orange/service/CheckService.java new file mode 100644 index 0000000..6785ea1 --- /dev/null +++ b/src/main/java/com/qsd/orange/service/CheckService.java @@ -0,0 +1,29 @@ +package com.qsd.orange.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.qsd.orange.po.BusCheck; + +public interface CheckService { + + /** + * 汽车入库 + * @param id 出租单号 + * @param problem 存在的问题 + * @param compensate 赔偿金额 + * @param description 问题描述 + * @param operator 操作员 + * */ + int add(String id, String problem, Double compensate, String description, String operator); + /** + * 查询全部检查单 + * @param page 页码 + * @param limit 每页数目 + * */ + IPage all(Integer page, Integer limit); + /** + * 查询一个检查单 + * @param id 出租单号 + * */ + BusCheck search(String id); + +} diff --git a/src/main/java/com/qsd/orange/service/CustomerService.java b/src/main/java/com/qsd/orange/service/CustomerService.java new file mode 100644 index 0000000..d4f0c60 --- /dev/null +++ b/src/main/java/com/qsd/orange/service/CustomerService.java @@ -0,0 +1,36 @@ +package com.qsd.orange.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.qsd.orange.po.BusCustomer; + +public interface CustomerService { + + /** + * 查询全部客户,根据添加日期 + * */ + IPage queryCustomers(Integer page, Integer limit); + /** + * 查询客户根据条件,并分页 + * @param page 页码 + * @param limit 每页数目 + * @param type 查询的类型 + * @param keyword 查询的字段 + * */ + IPage queryByCustomer(Integer page, Integer limit, String type, String keyword); + /** + * 根据身份证号查询一个用户 + * */ + BusCustomer queryOne(String identity); + /** + * 增加一个客户 + * @param operator 操作人员 + * @param customer 客户信息 + * */ + int addCustomer(String operator, BusCustomer customer); + /** + * 更新客户信息 + * @param customer 客户信息 + * */ + int updateCustomer(BusCustomer customer); + +} diff --git a/src/main/java/com/qsd/orange/service/RentService.java b/src/main/java/com/qsd/orange/service/RentService.java new file mode 100644 index 0000000..2f375af --- /dev/null +++ b/src/main/java/com/qsd/orange/service/RentService.java @@ -0,0 +1,62 @@ +package com.qsd.orange.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.qsd.orange.po.BusRent; + +import java.util.Map; + +public interface RentService { + + /** + * 增加一张出租单 + * 首先检查车辆状态,再进行增加 + * -2:车辆未找到;-1:车辆已被出租;0:客户未查到;1:成功 + * @param identity 用户身份证 + * @param number 车牌号 + * @param username 操作员 + * @return 返回完整出租单?还是只是结果? + * */ + int add(String identity, String number, String returnTime, String username); + /** + * 查询全部的出租单 + * @param page 页码 + * @param limit 每页数目 + * */ + IPage all(Integer page, Integer limit); + /** + * 根据类型搜索出租单 + * @param page 页码 + * @param limit 每页数目 + * @param type 类型 + * @param keyword 关键字 + * */ + IPage search(Integer page, Integer limit, String type, String keyword); + /** + * 修改归还日期 + * @param id 出租单号 + * @param returnTime 新归还日期 + * @return 0:出租单未找到;-1:新归还日期少于开始日期;-2:新归还日期少于今天;1:成功;-3:参数错误 + * */ + int updateReturnTime(String id, String returnTime); + /** + * 查询出租单详情、客户详情、车辆详情 + * @param id 出租单号 + * */ + Map info(String id); + /** + * 查询全部的出租单 + * @param page 页码 + * @param limit 每页数目 + * */ + IPage sysAll(Integer page, Integer limit); + /** + * 根据类型搜索出租单 + * @param page 页码 + * @param limit 每页数目 + * @param status 出租状态 + * @param type 类型 + * @param keyword 关键字 + * */ + IPage sysSearch(Integer page, Integer limit, Integer status, String type, String keyword); + +} diff --git a/src/main/java/com/qsd/orange/service/UserService.java b/src/main/java/com/qsd/orange/service/UserService.java new file mode 100644 index 0000000..01dc795 --- /dev/null +++ b/src/main/java/com/qsd/orange/service/UserService.java @@ -0,0 +1,45 @@ +package com.qsd.orange.service; + +import com.qsd.orange.po.SysUser; + +import java.util.List; + + +public interface UserService { + + /** + * 注册一个用户 + * @param user 用户信息 + * @return 1:成功,0:失败 + * */ + int add(SysUser user); + /** + * 更新用户信息 + * @param user 用户信息 + * @return 1:成功,0:失败 + * */ + int update(SysUser user); + /*** + * 更新密码 + * @param username 要更新的用户名 + * @param oldPassword 旧密码 + * @param newPassword 新密码 + * @return 0:失败,1:成功,-1:未变,-2:原密码错误 + */ + int updatePassword(String username, String oldPassword, String newPassword); + /** + * 获取用户信息 + * @param username 用户名 + * */ + SysUser getInfo(String username); + /** + * 查询全部用户,不包括管理员 + * */ + List all(); + /** + * 将用户密码重置为123456 + * @param username 用户名 + * */ + int reset(String username); + +} diff --git a/src/main/java/com/qsd/orange/service/impl/AnnouncementServiceImpl.java b/src/main/java/com/qsd/orange/service/impl/AnnouncementServiceImpl.java new file mode 100644 index 0000000..9c793e4 --- /dev/null +++ b/src/main/java/com/qsd/orange/service/impl/AnnouncementServiceImpl.java @@ -0,0 +1,40 @@ +package com.qsd.orange.service.impl; + +import cn.hutool.core.date.DateUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.qsd.orange.dao.AnnouncementDao; +import com.qsd.orange.po.SysAnnouncement; +import com.qsd.orange.service.AnnouncementService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class AnnouncementServiceImpl implements AnnouncementService { + + @Autowired + private AnnouncementDao announcementDao; + + @Override + public IPage all(Integer page, Integer limit) { + return announcementDao.selectPage(new Page<>(page, limit), new QueryWrapper().orderByDesc("created")); + } + + @Override + public int add(SysAnnouncement announcement, String username) { + announcement.setOperator(username); + announcement.setCreated(DateUtil.date().toTimestamp()); + return announcementDao.insert(announcement); + } + + @Override + public int update(SysAnnouncement announcement) { + SysAnnouncement temp = new SysAnnouncement(); + temp.setId(announcement.getId()); + temp.setTitle(announcement.getTitle()); + temp.setContent(announcement.getContent()); + return announcementDao.updateById(temp); + } + +} diff --git a/src/main/java/com/qsd/orange/service/impl/CarServiceImpl.java b/src/main/java/com/qsd/orange/service/impl/CarServiceImpl.java new file mode 100644 index 0000000..dcda6d6 --- /dev/null +++ b/src/main/java/com/qsd/orange/service/impl/CarServiceImpl.java @@ -0,0 +1,97 @@ +package com.qsd.orange.service.impl; + +import cn.hutool.core.date.DateUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.qsd.orange.dao.CarDao; +import com.qsd.orange.po.BusCar; +import com.qsd.orange.service.CarService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class CarServiceImpl implements CarService { + + @Autowired + private CarDao carDao; + + @Override + public IPage queryAllCar(Integer page, Integer limit, Integer status) { + return carDao.selectPage( + new Page<>(page, limit), + new QueryWrapper() + .and(true, i -> i + .eq(status >= 0, "status", status) + .eq("exist", 1) + ).orderByDesc("created")); + } + + @Override + public IPage queryCar(Integer page, Integer limit, Integer status, String brand, String color) { + return carDao.selectPage( + new Page<>(page, limit), + new QueryWrapper() + .and(true, i -> i + .like(brand != "", "brand", brand) + .like(color != "", "color", color) + .eq("exist", 1) + ) + .orderByDesc("created")); + } + + @Override + public IPage queryAllCarSys(Integer page, Integer limit, Integer status) { + return carDao.selectPage( + new Page<>(page, limit), + new QueryWrapper().eq(status >= 0, "status", status).orderByDesc("created")); + } + + @Override + public IPage queryCarSys(Integer page, Integer limit, Integer status, String brand, String color) { + return carDao.selectPage( + new Page<>(page, limit), + new QueryWrapper() + .and(true, i -> i + .like(brand != "", "brand", brand) + .like(color != "", "color", color) + ) + .orderByDesc("created")); + } + + @Override + public IPage queryCarByNumber(Integer page, Integer limit, String number) { + return carDao.selectPage( + new Page<>(page, limit), + new QueryWrapper() + .and(true, i -> i + .eq(true, "status", 0) + .eq(!number.equals(""), "number", number) + .eq("exist", 1) + ) + .orderByDesc("created")); + } + + @Override + public int add(String username, BusCar car) { + car.setCreated(DateUtil.date().toTimestamp()); + car.setOperator(username); + car.setStatus(0); + car.setExist(1); + return carDao.insert(car); + } + + @Override + public int update(BusCar car) { + return carDao.updateById(car); + } + + @Override + public int updateExist(String number, Integer exist) { + BusCar car = new BusCar(); + car.setNumber(number); + car.setExist(exist); + return carDao.updateById(car); + } + +} diff --git a/src/main/java/com/qsd/orange/service/impl/CheckServiceImpl.java b/src/main/java/com/qsd/orange/service/impl/CheckServiceImpl.java new file mode 100644 index 0000000..85d1887 --- /dev/null +++ b/src/main/java/com/qsd/orange/service/impl/CheckServiceImpl.java @@ -0,0 +1,78 @@ +package com.qsd.orange.service.impl; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.RandomUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.qsd.orange.dao.CarDao; +import com.qsd.orange.dao.CheckDao; +import com.qsd.orange.dao.RentDao; +import com.qsd.orange.po.BusCar; +import com.qsd.orange.po.BusCheck; +import com.qsd.orange.po.BusRent; +import com.qsd.orange.service.CheckService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.sql.Timestamp; + +@Service +public class CheckServiceImpl implements CheckService { + + @Autowired + private CheckDao checkDao; + @Autowired + private RentDao rentDao; + @Autowired + private CarDao carDao; + + @Override + @Transactional + public int add(String id, String problem, Double compensate, String description, String operator) { + String number = rentDao.selectCarNumber(id); + if(StrUtil.isEmpty(number)){ + return 0; + } + BusCheck check = new BusCheck(); + Timestamp returnTime = DateUtil.date().toTimestamp(); + check.setId("JC_" + DateUtil.date().toString("yyyyMMdd") + "_" + System.currentTimeMillis() + "_" + RandomUtil.randomNumbers(4)); + check.setCheckDate(returnTime); + check.setCompensate(compensate); + check.setDescription(description); + check.setProblem(problem); + check.setRentId(id); + check.setOperator(operator); + int insert = checkDao.insert(check); + if (insert > 0){ + //修改出租单状态 + BusRent rent = new BusRent(); + rent.setId(id); + rent.setRentStatus(1); + rent.setRealTime(returnTime); + rentDao.updateById(rent); + //修改车辆状态 + BusCar car = new BusCar(); + car.setNumber(number); + car.setStatus(0); + carDao.updateById(car); + } + return insert; + } + + @Override + public IPage all(Integer page, Integer limit) { + return checkDao.selectPage( + new Page<>(page, limit), + new QueryWrapper().orderByDesc("check_date") + ); + } + + @Override + public BusCheck search(String id) { + return checkDao.selectById(id); + } + +} diff --git a/src/main/java/com/qsd/orange/service/impl/CustomerServiceImpl.java b/src/main/java/com/qsd/orange/service/impl/CustomerServiceImpl.java new file mode 100644 index 0000000..8b28a63 --- /dev/null +++ b/src/main/java/com/qsd/orange/service/impl/CustomerServiceImpl.java @@ -0,0 +1,48 @@ +package com.qsd.orange.service.impl; + +import cn.hutool.core.date.DateUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.qsd.orange.dao.CustomerDao; +import com.qsd.orange.po.BusCustomer; +import com.qsd.orange.service.CustomerService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + + +@Service +public class CustomerServiceImpl implements CustomerService { + + @Autowired + private CustomerDao customerDao; + + @Override + public IPage queryCustomers(Integer page, Integer limit) { + return customerDao.selectPage(new Page<>(page, limit), new QueryWrapper().orderByDesc(true, "created")); + } + + @Override + public IPage queryByCustomer(Integer page, Integer limit, String type, String keyword) { + return customerDao.selectPage(new Page<>(page, limit), new QueryWrapper().like(true, type, keyword).orderByDesc(true, "created")); + } + + @Override + public BusCustomer queryOne(String identity) { + return customerDao.selectOne(new QueryWrapper().eq("identity", identity)); + } + + @Override + public int addCustomer(String operator, BusCustomer customer) { + customer.setCreated(DateUtil.date().toTimestamp()); + customer.setOperator(operator); + return customerDao.insert(customer); + } + + @Override + public int updateCustomer(BusCustomer customer) { + return customerDao.updateById(customer); + } + + +} diff --git a/src/main/java/com/qsd/orange/service/impl/RentServiceImpl.java b/src/main/java/com/qsd/orange/service/impl/RentServiceImpl.java new file mode 100644 index 0000000..f8d36d3 --- /dev/null +++ b/src/main/java/com/qsd/orange/service/impl/RentServiceImpl.java @@ -0,0 +1,154 @@ +package com.qsd.orange.service.impl; + +import cn.hutool.core.date.DateException; +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.RandomUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.qsd.orange.dao.CarDao; +import com.qsd.orange.dao.CustomerDao; +import com.qsd.orange.dao.RentDao; +import com.qsd.orange.po.BusCar; +import com.qsd.orange.po.BusCustomer; +import com.qsd.orange.po.BusRent; +import com.qsd.orange.service.RentService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.Map; + +@Service +public class RentServiceImpl implements RentService { + + @Autowired + private CarDao carDao; + @Autowired + private RentDao rentDao; + @Autowired + private CustomerDao customerDao; + + @Override + public int add(String identity, String number, String returnTime, String username) { + //查找车辆信息 + BusCar car = carDao.selectById(number); + if (car == null){ + return -2; + } + if (car.getStatus() == 1){ + return -1; + } + BusRent rent = new BusRent(); + rent.setCreated(DateUtil.date().toTimestamp()); + rent.setBeginTime(DateUtil.date().toSqlDate()); + rent.setRentStatus(0); + rent.setCarNumber(number); + rent.setReturnTime(DateUtil.parse(returnTime).toSqlDate()); + rent.setOperator(username); + rent.setPrice(car.getRentPrice()); + rent.setCustomerIdentity(identity); + rent.setId("CZ_" + DateUtil.date().toString("yyyyMMdd") + "_" + System.currentTimeMillis() + "_" + RandomUtil.randomNumbers(4)); + int insert = rentDao.insert(rent); + if (insert == 0){ + return 0; + } + //修改汽车状态 + BusCar busCar = new BusCar(); + busCar.setNumber(number); + busCar.setStatus(1); + return carDao.updateById(busCar); + } + + @Override + public IPage all(Integer page, Integer limit) { + return rentDao.selectPage( + new Page<>(page, limit), + new QueryWrapper() + .eq("rent_status", 0) + .orderByDesc("created")); + } + + @Override + public IPage search(Integer page, Integer limit, String type, String keyword) { + return rentDao.selectPage( + new Page<>(page, limit), + new QueryWrapper() + .and(true, i -> i + .eq("rent_status", 0) + .like(type, keyword)) + .orderByDesc("created")); + } + + @Override + public int updateReturnTime(String id, String returnTime) { + //首先获取原本开始日期、归还日期 + BusRent rent = rentDao.selectById(id); + if (rent == null){ + return 0; + } + DateTime returnDate = null; + try { + returnDate = DateUtil.parse(returnTime); + }catch (DateException e){ + return -3; + } + if (returnDate.isBefore(rent.getBeginTime())){ + return -1; + } + if (returnDate.isBefore(DateUtil.date())){ + return -2; + } + if (returnDate.compareTo(rent.getReturnTime()) == 0){ + return 1; + } + BusRent newRent = new BusRent(); + newRent.setId(id); + newRent.setReturnTime(returnDate.toSqlDate()); + //进行比对 + return rentDao.updateById(newRent); + } + + @Override + public Map info(String id) { + Map info = new HashMap<>(); + //出租单、车辆信息、客户信息 + BusRent rent = rentDao.selectById(id); + if (rent == null){ + info.put("status", 0); + return info; + } + if (rent.getRentStatus() == 1){ + info.put("status", -1); + return info; + } + info.put("status", 1); + info.put("rent", rent); + BusCustomer customer = customerDao.selectById(rent.getCustomerIdentity()); + info.put("customer", customer); + BusCar car = carDao.selectById(rent.getCarNumber()); + info.put("car", car); + return info; + } + + @Override + public IPage sysAll(Integer page, Integer limit) { + return rentDao.selectPage( + new Page<>(page, limit), + new QueryWrapper() + .orderByDesc("created")); + } + + @Override + public IPage sysSearch(Integer page, Integer limit, Integer status, String type, String keyword) { + return rentDao.selectPage( + new Page<>(page, limit), + new QueryWrapper() + .and(true, i -> i + .eq(status != 2, "rent_status", status) + .like(type, keyword)) + .orderByDesc("created")); + } + +} diff --git a/src/main/java/com/qsd/orange/service/impl/UserDetailsServiceImpl.java b/src/main/java/com/qsd/orange/service/impl/UserDetailsServiceImpl.java new file mode 100644 index 0000000..b455856 --- /dev/null +++ b/src/main/java/com/qsd/orange/service/impl/UserDetailsServiceImpl.java @@ -0,0 +1,30 @@ +package com.qsd.orange.service.impl; + +import com.qsd.orange.dao.UserDao; +import com.qsd.orange.po.SysUser; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.authority.AuthorityUtils; +import org.springframework.security.core.userdetails.User; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.stereotype.Service; + + +@Service +public class UserDetailsServiceImpl implements UserDetailsService { + + @Autowired + private UserDao userDao; + + @Override + public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { + SysUser user = userDao.selectById(username); + if (user == null){ + throw new UsernameNotFoundException("用户名没有找到"); + } + return new User(username, + user.getPassword(), + AuthorityUtils.commaSeparatedStringToAuthorityList("ROLE_" + user.getType().toString())); + } +} diff --git a/src/main/java/com/qsd/orange/service/impl/UserServiceImpl.java b/src/main/java/com/qsd/orange/service/impl/UserServiceImpl.java new file mode 100644 index 0000000..44c761c --- /dev/null +++ b/src/main/java/com/qsd/orange/service/impl/UserServiceImpl.java @@ -0,0 +1,73 @@ +package com.qsd.orange.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.qsd.orange.dao.UserDao; +import com.qsd.orange.po.SysUser; +import com.qsd.orange.service.UserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class UserServiceImpl implements UserService { + + @Autowired + private UserDao userDao; + @Autowired + private BCryptPasswordEncoder passwordEncoder; + + @Override + public int add(SysUser user) { + user.setType(0); + //设置密码 + String password = passwordEncoder.encode("123456"); + user.setPassword(password); + return userDao.insert(user); + } + + @Override + public int update(SysUser user) { + return userDao.updateById(user); + } + + @Override + public int updatePassword(String username, String oldPassword, String newPassword) { + SysUser user = userDao.selectById(username); + //真实密码 + String password = user.getPassword(); + //判断原密码是否正确 + if (!passwordEncoder.matches(oldPassword, password)){ + return -2; + } + newPassword = passwordEncoder.encode(newPassword); + //判断新密码与原密码是否相同 + if (password.equals(newPassword)){ + return -1; + } + SysUser up = new SysUser(); + up.setUsername(username); + up.setPassword(newPassword); + return userDao.updateById(up); + } + + @Override + public SysUser getInfo(String username) { + return userDao.selectOneById(username); + } + + @Override + public List all() { + return userDao.selectList(new QueryWrapper().eq("type", 0)); + } + + @Override + public int reset(String username) { + SysUser user = new SysUser(); + user.setUsername(username); + user.setPassword(passwordEncoder.encode("123456")); + return userDao.updateById(user); + } + +} diff --git a/src/main/java/com/qsd/orange/vo/StatisticsVo.java b/src/main/java/com/qsd/orange/vo/StatisticsVo.java new file mode 100644 index 0000000..eafbdc2 --- /dev/null +++ b/src/main/java/com/qsd/orange/vo/StatisticsVo.java @@ -0,0 +1,26 @@ +package com.qsd.orange.vo; + +import java.io.Serializable; + +public class StatisticsVo implements Serializable { + + private static final long serialVersionUID = 1L; + private String name; + private Integer value; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getValue() { + return value; + } + + public void setValue(Integer value) { + this.value = value; + } +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 0000000..93b9265 --- /dev/null +++ b/src/main/resources/application.yml @@ -0,0 +1,23 @@ +server: + port: 8081 + +spring: + application: + name: orangecar + datasource: + url: jdbc:mysql://localhost:3306/carrent?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=UTF-8 + username: root + password: 599377 + driver-class-name: com.mysql.cj.jdbc.Driver + thymeleaf: + cache: false + encoding: UTF-8 + servlet: + multipart: + max-file-size: 20MB + max-request-size: 20MB + +mybatis-plus: + mapper-locations: classpath:mapper/*.xml + type-aliases-package: com.qsd.orange.po + diff --git a/src/main/resources/mapper/RentDao.xml b/src/main/resources/mapper/RentDao.xml new file mode 100644 index 0000000..09b8ae7 --- /dev/null +++ b/src/main/resources/mapper/RentDao.xml @@ -0,0 +1,13 @@ + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/StatisticsDao.xml b/src/main/resources/mapper/StatisticsDao.xml new file mode 100644 index 0000000..fabcb70 --- /dev/null +++ b/src/main/resources/mapper/StatisticsDao.xml @@ -0,0 +1,39 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/UserDao.xml b/src/main/resources/mapper/UserDao.xml new file mode 100644 index 0000000..3c5b66d --- /dev/null +++ b/src/main/resources/mapper/UserDao.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/src/main/resources/static/business/check.html b/src/main/resources/static/business/check.html new file mode 100644 index 0000000..78e46fe --- /dev/null +++ b/src/main/resources/static/business/check.html @@ -0,0 +1,277 @@ + + + + + 橘子汽车租赁 + + + + + + + +
+
+
+
查询条件
+
+
+
+ +
+ +
+ +
+
+
+
+
+
+ +
+
+
生成检查单
+
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+ + +
+
+
+
+
+
+
+ +
+
+
+
车辆信息
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+
+
+
+
出租单信息
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+
+
+
+
客户信息
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ + + +
+
+
+ +
+ +
+
+
+
+
+
+
+
+
+ + + + \ No newline at end of file diff --git a/src/main/resources/static/business/rent.html b/src/main/resources/static/business/rent.html new file mode 100644 index 0000000..f46afb3 --- /dev/null +++ b/src/main/resources/static/business/rent.html @@ -0,0 +1,336 @@ + + + + + 橘子汽车租赁 + + + + + +
+
+
+
查询条件
+
+
+
+ +
+ +
+ +
+
+
+
+
+
+
+
车辆列表
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/src/main/resources/static/business/rents.html b/src/main/resources/static/business/rents.html new file mode 100644 index 0000000..20bcd7c --- /dev/null +++ b/src/main/resources/static/business/rents.html @@ -0,0 +1,212 @@ + + + + + 橘子汽车租赁 + + + + + +
+
+
查询条件
+
+
+
+ +
+ +
+
+
+ +
+ + + +
+
+
+
+ + +
+
+
+
+
+
+
+
+
+
出租单管理
+
+
+
+
+
+
+ + + + + \ No newline at end of file diff --git a/src/main/resources/static/car.html b/src/main/resources/static/car.html new file mode 100644 index 0000000..174d263 --- /dev/null +++ b/src/main/resources/static/car.html @@ -0,0 +1,172 @@ + + + + + 橘子汽车租赁 + + + + + +
+
+
+
查询条件
+
+
+
+ +
+ + + +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ + +
+
+
+
+
+
+
+
+
车辆列表
+
+ +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/src/main/resources/static/carhome.html b/src/main/resources/static/carhome.html new file mode 100644 index 0000000..133b624 --- /dev/null +++ b/src/main/resources/static/carhome.html @@ -0,0 +1,1078 @@ + + + + + + + +
+ + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/static/error/403.html b/src/main/resources/static/error/403.html new file mode 100644 index 0000000..68ba8f2 --- /dev/null +++ b/src/main/resources/static/error/403.html @@ -0,0 +1,10 @@ + + + + + Title + + +没有权限 + + \ No newline at end of file diff --git a/src/main/resources/static/favicon.ico b/src/main/resources/static/favicon.ico new file mode 100644 index 0000000..7a85d65 Binary files /dev/null and b/src/main/resources/static/favicon.ico differ diff --git a/src/main/resources/static/home.html b/src/main/resources/static/home.html new file mode 100644 index 0000000..cf73621 --- /dev/null +++ b/src/main/resources/static/home.html @@ -0,0 +1,108 @@ + + + + + 橘子汽车租赁 + + + + + +
+
+
+
公司公告
+
+
+
+
+
+
+
+
当前日历
+
+
+
+
+
+
+
+
当前时间
+
+
+
+
+
+
+ + + + \ No newline at end of file diff --git a/src/main/resources/static/image/ad.png b/src/main/resources/static/image/ad.png new file mode 100644 index 0000000..4069598 Binary files /dev/null and b/src/main/resources/static/image/ad.png differ diff --git a/src/main/resources/static/image/boat-1.jpg b/src/main/resources/static/image/boat-1.jpg new file mode 100644 index 0000000..807270e Binary files /dev/null and b/src/main/resources/static/image/boat-1.jpg differ diff --git a/src/main/resources/static/image/boat-2.jpg b/src/main/resources/static/image/boat-2.jpg new file mode 100644 index 0000000..8999710 Binary files /dev/null and b/src/main/resources/static/image/boat-2.jpg differ diff --git a/src/main/resources/static/image/boat-3.jpg b/src/main/resources/static/image/boat-3.jpg new file mode 100644 index 0000000..7970ec9 Binary files /dev/null and b/src/main/resources/static/image/boat-3.jpg differ diff --git a/src/main/resources/static/image/boat-4.jpg b/src/main/resources/static/image/boat-4.jpg new file mode 100644 index 0000000..7582e32 Binary files /dev/null and b/src/main/resources/static/image/boat-4.jpg differ diff --git a/src/main/resources/static/image/destination-1.jpg b/src/main/resources/static/image/destination-1.jpg new file mode 100644 index 0000000..3252f6c Binary files /dev/null and b/src/main/resources/static/image/destination-1.jpg differ diff --git a/src/main/resources/static/image/destination-2.jpg b/src/main/resources/static/image/destination-2.jpg new file mode 100644 index 0000000..b5d54c5 Binary files /dev/null and b/src/main/resources/static/image/destination-2.jpg differ diff --git a/src/main/resources/static/image/destination-3.jpg b/src/main/resources/static/image/destination-3.jpg new file mode 100644 index 0000000..3e5e648 Binary files /dev/null and b/src/main/resources/static/image/destination-3.jpg differ diff --git a/src/main/resources/static/image/destination-4.jpg b/src/main/resources/static/image/destination-4.jpg new file mode 100644 index 0000000..f0ce8ed Binary files /dev/null and b/src/main/resources/static/image/destination-4.jpg differ diff --git a/src/main/resources/static/image/destination-5.jpg b/src/main/resources/static/image/destination-5.jpg new file mode 100644 index 0000000..2f39b79 Binary files /dev/null and b/src/main/resources/static/image/destination-5.jpg differ diff --git a/src/main/resources/static/image/dfb.png b/src/main/resources/static/image/dfb.png new file mode 100644 index 0000000..afb0bed Binary files /dev/null and b/src/main/resources/static/image/dfb.png differ diff --git a/src/main/resources/static/image/drg.png b/src/main/resources/static/image/drg.png new file mode 100644 index 0000000..175e562 Binary files /dev/null and b/src/main/resources/static/image/drg.png differ diff --git a/src/main/resources/static/image/eq.png b/src/main/resources/static/image/eq.png new file mode 100644 index 0000000..602726e Binary files /dev/null and b/src/main/resources/static/image/eq.png differ diff --git a/src/main/resources/static/image/est.png b/src/main/resources/static/image/est.png new file mode 100644 index 0000000..8ee8f25 Binary files /dev/null and b/src/main/resources/static/image/est.png differ diff --git a/src/main/resources/static/image/fse.png b/src/main/resources/static/image/fse.png new file mode 100644 index 0000000..6e268db Binary files /dev/null and b/src/main/resources/static/image/fse.png differ diff --git a/src/main/resources/static/image/g.png b/src/main/resources/static/image/g.png new file mode 100644 index 0000000..f191387 Binary files /dev/null and b/src/main/resources/static/image/g.png differ diff --git a/src/main/resources/static/image/gh.png b/src/main/resources/static/image/gh.png new file mode 100644 index 0000000..b4f9d11 Binary files /dev/null and b/src/main/resources/static/image/gh.png differ diff --git a/src/main/resources/static/image/hd.png b/src/main/resources/static/image/hd.png new file mode 100644 index 0000000..fc38dbb Binary files /dev/null and b/src/main/resources/static/image/hd.png differ diff --git a/src/main/resources/static/image/hero-background.jpg b/src/main/resources/static/image/hero-background.jpg new file mode 100644 index 0000000..92814b4 Binary files /dev/null and b/src/main/resources/static/image/hero-background.jpg differ diff --git a/src/main/resources/static/image/hero-background11.jpg b/src/main/resources/static/image/hero-background11.jpg new file mode 100644 index 0000000..f04ef4b Binary files /dev/null and b/src/main/resources/static/image/hero-background11.jpg differ diff --git a/src/main/resources/static/image/hero-background2 (2).jpg b/src/main/resources/static/image/hero-background2 (2).jpg new file mode 100644 index 0000000..dabb73d Binary files /dev/null and b/src/main/resources/static/image/hero-background2 (2).jpg differ diff --git a/src/main/resources/static/image/hero-background2.jpg b/src/main/resources/static/image/hero-background2.jpg new file mode 100644 index 0000000..8f520f1 Binary files /dev/null and b/src/main/resources/static/image/hero-background2.jpg differ diff --git a/src/main/resources/static/image/hm.png b/src/main/resources/static/image/hm.png new file mode 100644 index 0000000..ab776bc Binary files /dev/null and b/src/main/resources/static/image/hm.png differ diff --git a/src/main/resources/static/image/icon-boat.png b/src/main/resources/static/image/icon-boat.png new file mode 100644 index 0000000..77f48c2 Binary files /dev/null and b/src/main/resources/static/image/icon-boat.png differ diff --git a/src/main/resources/static/image/jg.png b/src/main/resources/static/image/jg.png new file mode 100644 index 0000000..eab9b78 Binary files /dev/null and b/src/main/resources/static/image/jg.png differ diff --git a/src/main/resources/static/image/jyg.png b/src/main/resources/static/image/jyg.png new file mode 100644 index 0000000..a8a4629 Binary files /dev/null and b/src/main/resources/static/image/jyg.png differ diff --git a/src/main/resources/static/image/qweq.png b/src/main/resources/static/image/qweq.png new file mode 100644 index 0000000..fec0cde Binary files /dev/null and b/src/main/resources/static/image/qweq.png differ diff --git a/src/main/resources/static/image/rent-boat-background.jpg b/src/main/resources/static/image/rent-boat-background.jpg new file mode 100644 index 0000000..1a03488 Binary files /dev/null and b/src/main/resources/static/image/rent-boat-background.jpg differ diff --git a/src/main/resources/static/image/rent-boat-background1.jpg b/src/main/resources/static/image/rent-boat-background1.jpg new file mode 100644 index 0000000..9ca5620 Binary files /dev/null and b/src/main/resources/static/image/rent-boat-background1.jpg differ diff --git a/src/main/resources/static/image/rent-boat-background11.jpg b/src/main/resources/static/image/rent-boat-background11.jpg new file mode 100644 index 0000000..bf14ca3 Binary files /dev/null and b/src/main/resources/static/image/rent-boat-background11.jpg differ diff --git a/src/main/resources/static/image/rqw.png b/src/main/resources/static/image/rqw.png new file mode 100644 index 0000000..b2a0929 Binary files /dev/null and b/src/main/resources/static/image/rqw.png differ diff --git a/src/main/resources/static/image/site-identity.png b/src/main/resources/static/image/site-identity.png new file mode 100644 index 0000000..7c83a4d Binary files /dev/null and b/src/main/resources/static/image/site-identity.png differ diff --git a/src/main/resources/static/image/sound-off.png b/src/main/resources/static/image/sound-off.png new file mode 100644 index 0000000..1c304b7 Binary files /dev/null and b/src/main/resources/static/image/sound-off.png differ diff --git a/src/main/resources/static/image/sound-on.png b/src/main/resources/static/image/sound-on.png new file mode 100644 index 0000000..e8147ec Binary files /dev/null and b/src/main/resources/static/image/sound-on.png differ diff --git a/src/main/resources/static/image/tencent.png b/src/main/resources/static/image/tencent.png new file mode 100644 index 0000000..5230e34 Binary files /dev/null and b/src/main/resources/static/image/tencent.png differ diff --git a/src/main/resources/static/image/wa.png b/src/main/resources/static/image/wa.png new file mode 100644 index 0000000..bec23fb Binary files /dev/null and b/src/main/resources/static/image/wa.png differ diff --git a/src/main/resources/static/image/wda.png b/src/main/resources/static/image/wda.png new file mode 100644 index 0000000..69a4b10 Binary files /dev/null and b/src/main/resources/static/image/wda.png differ diff --git a/src/main/resources/static/image/wechat.png b/src/main/resources/static/image/wechat.png new file mode 100644 index 0000000..b5ba953 Binary files /dev/null and b/src/main/resources/static/image/wechat.png differ diff --git a/src/main/resources/static/image/weibo.png b/src/main/resources/static/image/weibo.png new file mode 100644 index 0000000..d2b965f Binary files /dev/null and b/src/main/resources/static/image/weibo.png differ diff --git a/src/main/resources/static/image/ygg.png b/src/main/resources/static/image/ygg.png new file mode 100644 index 0000000..4170fdb Binary files /dev/null and b/src/main/resources/static/image/ygg.png differ diff --git a/src/main/resources/static/login.html b/src/main/resources/static/login.html new file mode 100644 index 0000000..bfd37d7 --- /dev/null +++ b/src/main/resources/static/login.html @@ -0,0 +1,106 @@ + + + + + + 橙子汽车租赁 + + + + + + + + +
+
登录
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+
+ +
+
+
+ + + + \ No newline at end of file diff --git a/src/main/resources/static/statistics/company.html b/src/main/resources/static/statistics/company.html new file mode 100644 index 0000000..52e5860 --- /dev/null +++ b/src/main/resources/static/statistics/company.html @@ -0,0 +1,85 @@ + + + + + 公司年度月份销售额 + + + + + + +
+
+
+
+ +
+
+
+ +
+
+ +
+
+
+ +
+
+
+
+
+ + + \ No newline at end of file diff --git a/src/main/resources/static/statistics/region.html b/src/main/resources/static/statistics/region.html new file mode 100644 index 0000000..bbeb739 --- /dev/null +++ b/src/main/resources/static/statistics/region.html @@ -0,0 +1,75 @@ + + + + + 客户地区统计 + + + + + + +
+
+
+
+
+
+
+
+
+ + + \ No newline at end of file diff --git a/src/main/resources/static/statistics/salesman.html b/src/main/resources/static/statistics/salesman.html new file mode 100644 index 0000000..8c9ce3a --- /dev/null +++ b/src/main/resources/static/statistics/salesman.html @@ -0,0 +1,116 @@ + + + + + 业务员年度销售额 + + + + + + +
+
+
+
+ +
+
+
+ +
+
+ +
+
+
+ +
+
+
+
+
+ + + \ No newline at end of file diff --git a/src/main/resources/static/system/announcement.html b/src/main/resources/static/system/announcement.html new file mode 100644 index 0000000..ebe0077 --- /dev/null +++ b/src/main/resources/static/system/announcement.html @@ -0,0 +1,199 @@ + + + + + 橘子汽车租赁 + + + + + + +
+
+
+
公告管理
+
+
+
+
+
+
+ + + + + + \ No newline at end of file diff --git a/src/main/resources/static/system/car.html b/src/main/resources/static/system/car.html new file mode 100644 index 0000000..88c34d3 --- /dev/null +++ b/src/main/resources/static/system/car.html @@ -0,0 +1,421 @@ + + + + + 橘子汽车租赁 + + + + + +
+
+
+
查询条件
+
+
+
+ +
+ + + +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ + +
+
+
+
+
+
+
+
+
车辆列表
+
+ +
+
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/src/main/resources/static/system/check.html b/src/main/resources/static/system/check.html new file mode 100644 index 0000000..df313dc --- /dev/null +++ b/src/main/resources/static/system/check.html @@ -0,0 +1,145 @@ + + + + + 橘子汽车租赁 + + + + + +
+
+
+
查询条件
+
+
+
+ +
+ +
+ +
+
+
+
+
+
+
+
检查单管理
+
+
+
+
+
+
+ + + + \ No newline at end of file diff --git a/src/main/resources/static/system/rent.html b/src/main/resources/static/system/rent.html new file mode 100644 index 0000000..2dc29bc --- /dev/null +++ b/src/main/resources/static/system/rent.html @@ -0,0 +1,124 @@ + + + + + 橘子汽车租赁 + + + + + +
+
+
查询条件
+
+
+
+ +
+ +
+
+
+ +
+ + + +
+
+
+ +
+ + + +
+
+
+
+ + +
+
+
+
+
+
+
+
+
+
出租单管理
+
+
+
+
+
+
+ + + \ No newline at end of file diff --git a/src/main/resources/static/system/user.html b/src/main/resources/static/system/user.html new file mode 100644 index 0000000..2cc7f51 --- /dev/null +++ b/src/main/resources/static/system/user.html @@ -0,0 +1,261 @@ + + + + + 橘子汽车租赁 + + + + +
+
+
+
全部用户
+
+ +
+
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html new file mode 100644 index 0000000..120ac55 --- /dev/null +++ b/src/main/resources/templates/index.html @@ -0,0 +1,147 @@ + + + + + 阿耀汽车租赁 + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/self.html b/src/main/resources/templates/self.html new file mode 100644 index 0000000..e501217 --- /dev/null +++ b/src/main/resources/templates/self.html @@ -0,0 +1,161 @@ + + + + + 橘子汽车租赁 + + + + + + + +
+
+
+
个人中心
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ + +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ + +
+
+
+
+
+
+
+
+
密码修改
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ + +
+
+
+
+
+
+
+ + + \ No newline at end of file diff --git a/src/test/java/com/qsd/orange/ApplicationTests.java b/src/test/java/com/qsd/orange/ApplicationTests.java new file mode 100644 index 0000000..3a76011 --- /dev/null +++ b/src/test/java/com/qsd/orange/ApplicationTests.java @@ -0,0 +1,20 @@ +package com.qsd.orange; + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; + +@SpringBootTest +class ApplicationTests { + + @Autowired + private BCryptPasswordEncoder bCryptPasswordEncoder; + + @Test + void contextLoads() { + String encode = bCryptPasswordEncoder.encode("123456"); + System.out.println(encode); + } + +} diff --git a/src/test/java/com/qsd/orange/MD5Test.java b/src/test/java/com/qsd/orange/MD5Test.java new file mode 100644 index 0000000..54e9ff9 --- /dev/null +++ b/src/test/java/com/qsd/orange/MD5Test.java @@ -0,0 +1,20 @@ +package com.qsd.orange; + +import cn.hutool.crypto.digest.DigestAlgorithm; +import cn.hutool.crypto.digest.Digester; + +/** + * @Author Esion + * @Date 2020/9/23 19:42 + * @Version 1.0 + */ +public class MD5Test { + + public static void main(String[] args) { + String password = "123456"; + Digester md5 = new Digester(DigestAlgorithm.MD5); + password = md5.digestHex(password); + System.out.println(password); + } + +}